aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorStephen Hemminger <shemminger@osdl.org>2006-10-26 18:46:55 -0400
committerDavid S. Miller <davem@sunset.davemloft.net>2006-12-03 00:22:37 -0500
commit5de4a473bda49554e4e9bd93b78f43c49a7ea69c (patch)
tree13a74efb896968e8b535561d5024e3cc8a2f19cc
parent2bdfe0baeca0e2750037b8fba71905c00ac3c515 (diff)
netpoll queue cleanup
The beast had a long and not very happy history. At one point, a friend (netdump) had asked that he open up a little. Well, the friend was long gone now, and the beast had this dangling piece hanging (netpoll_queue). It wasn't hard to stitch the netpoll_queue back in where it belonged and make everything tidy. Signed-off-by: Stephen Hemminger <shemminger@osdl.org>
-rw-r--r--drivers/net/netconsole.c1
-rw-r--r--include/linux/netpoll.h4
-rw-r--r--net/core/netpoll.c23
3 files changed, 5 insertions, 23 deletions
diff --git a/drivers/net/netconsole.c b/drivers/net/netconsole.c
index e6e8a9797b6d..69233f6aa05c 100644
--- a/drivers/net/netconsole.c
+++ b/drivers/net/netconsole.c
@@ -60,7 +60,6 @@ static struct netpoll np = {
60 .local_port = 6665, 60 .local_port = 6665,
61 .remote_port = 6666, 61 .remote_port = 6666,
62 .remote_mac = {0xff, 0xff, 0xff, 0xff, 0xff, 0xff}, 62 .remote_mac = {0xff, 0xff, 0xff, 0xff, 0xff, 0xff},
63 .drop = netpoll_queue,
64}; 63};
65static int configured = 0; 64static int configured = 0;
66 65
diff --git a/include/linux/netpoll.h b/include/linux/netpoll.h
index c65d12ec7bb0..b7eb008c43de 100644
--- a/include/linux/netpoll.h
+++ b/include/linux/netpoll.h
@@ -18,7 +18,7 @@ struct netpoll {
18 struct net_device *dev; 18 struct net_device *dev;
19 char dev_name[16], *name; 19 char dev_name[16], *name;
20 void (*rx_hook)(struct netpoll *, int, char *, int); 20 void (*rx_hook)(struct netpoll *, int, char *, int);
21 void (*drop)(struct sk_buff *skb); 21
22 u32 local_ip, remote_ip; 22 u32 local_ip, remote_ip;
23 u16 local_port, remote_port; 23 u16 local_port, remote_port;
24 unsigned char local_mac[6], remote_mac[6]; 24 unsigned char local_mac[6], remote_mac[6];
@@ -44,7 +44,7 @@ int netpoll_trap(void);
44void netpoll_set_trap(int trap); 44void netpoll_set_trap(int trap);
45void netpoll_cleanup(struct netpoll *np); 45void netpoll_cleanup(struct netpoll *np);
46int __netpoll_rx(struct sk_buff *skb); 46int __netpoll_rx(struct sk_buff *skb);
47void netpoll_queue(struct sk_buff *skb); 47
48 48
49#ifdef CONFIG_NETPOLL 49#ifdef CONFIG_NETPOLL
50static inline int netpoll_rx(struct sk_buff *skb) 50static inline int netpoll_rx(struct sk_buff *skb)
diff --git a/net/core/netpoll.c b/net/core/netpoll.c
index 6b34c394672f..0d1de3c47a01 100644
--- a/net/core/netpoll.c
+++ b/net/core/netpoll.c
@@ -77,19 +77,6 @@ static void queue_process(void *p)
77 } 77 }
78} 78}
79 79
80void netpoll_queue(struct sk_buff *skb)
81{
82 struct net_device *dev = skb->dev;
83 struct netpoll_info *npinfo = dev->npinfo;
84
85 if (!npinfo)
86 kfree_skb(skb);
87 else {
88 skb_queue_tail(&npinfo->txq, skb);
89 schedule_work(&npinfo->tx_work);
90 }
91}
92
93static int checksum_udp(struct sk_buff *skb, struct udphdr *uh, 80static int checksum_udp(struct sk_buff *skb, struct udphdr *uh,
94 unsigned short ulen, u32 saddr, u32 daddr) 81 unsigned short ulen, u32 saddr, u32 daddr)
95{ 82{
@@ -256,7 +243,7 @@ static void netpoll_send_skb(struct netpoll *np, struct sk_buff *skb)
256 } 243 }
257 244
258 /* don't get messages out of order, and no recursion */ 245 /* don't get messages out of order, and no recursion */
259 if ( !(np->drop == netpoll_queue && skb_queue_len(&npinfo->txq)) 246 if ( skb_queue_len(&npinfo->txq) == 0
260 && npinfo->poll_owner != smp_processor_id() 247 && npinfo->poll_owner != smp_processor_id()
261 && netif_tx_trylock(dev)) { 248 && netif_tx_trylock(dev)) {
262 249
@@ -277,11 +264,8 @@ static void netpoll_send_skb(struct netpoll *np, struct sk_buff *skb)
277 } 264 }
278 265
279 if (status != NETDEV_TX_OK) { 266 if (status != NETDEV_TX_OK) {
280 /* requeue for later */ 267 skb_queue_tail(&npinfo->txq, skb);
281 if (np->drop) 268 schedule_work(&npinfo->tx_work);
282 np->drop(skb);
283 else
284 __kfree_skb(skb);
285 } 269 }
286} 270}
287 271
@@ -809,4 +793,3 @@ EXPORT_SYMBOL(netpoll_setup);
809EXPORT_SYMBOL(netpoll_cleanup); 793EXPORT_SYMBOL(netpoll_cleanup);
810EXPORT_SYMBOL(netpoll_send_udp); 794EXPORT_SYMBOL(netpoll_send_udp);
811EXPORT_SYMBOL(netpoll_poll); 795EXPORT_SYMBOL(netpoll_poll);
812EXPORT_SYMBOL(netpoll_queue);