aboutsummaryrefslogtreecommitdiffstats
path: root/net/core/netpoll.c
diff options
context:
space:
mode:
authorLinus Torvalds <torvalds@woody.linux-foundation.org>2008-03-04 23:20:58 -0500
committerLinus Torvalds <torvalds@woody.linux-foundation.org>2008-03-04 23:20:58 -0500
commit27d0483aa1ef66a8877d71b63bb97f46ab0246b2 (patch)
treeca84a9db8c79b789d40d2d9ae30d0349fd3562fc /net/core/netpoll.c
parent665c1ef8369138dad7773da6407fe77ccff87deb (diff)
parentdea75bdfa57f75a7a7ec2961ec28db506c18e5db (diff)
Merge git://git.kernel.org/pub/scm/linux/kernel/git/davem/net-2.6
* git://git.kernel.org/pub/scm/linux/kernel/git/davem/net-2.6: (22 commits) [IPCONFIG]: The kernel gets no IP from some DHCP servers b43legacy: Fix module init message rndis_wlan: fix broken data copy libertas: compare the current command with response libertas: fix sanity check on sequence number in command response p54: fix eeprom parser length sanity checks p54: fix EEPROM structure endianness ssb: Add pcibios_enable_device() return value check rc80211-pid: fix rate adjustment [ESP]: Add select on AUTHENC [TCP]: Improve ipv4 established hash function. [NETPOLL]: Revert two bogus cleanups that broke netconsole. [PPPOL2TP]: Add missing sock_put() in pppol2tp_tunnel_closeall() Subject: [PPPOL2TP] add missing sock_put() in pppol2tp_recv_dequeue() [BLUETOOTH]: l2cap info_timer delete fix in hci_conn_del [NET]: Fix race in generic address resolution. iucv: fix build error on !SMP [TCP]: Must count fack_count also when skipping [TUN]: Fix RTNL-locking in tun/tap driver [SCTP]: Use proc_create to setup de->proc_fops. ...
Diffstat (limited to 'net/core/netpoll.c')
-rw-r--r--net/core/netpoll.c12
1 files changed, 8 insertions, 4 deletions
diff --git a/net/core/netpoll.c b/net/core/netpoll.c
index 6faa128a4c8e..4b7e756181c9 100644
--- a/net/core/netpoll.c
+++ b/net/core/netpoll.c
@@ -39,6 +39,8 @@ static struct sk_buff_head skb_pool;
39static atomic_t trapped; 39static atomic_t trapped;
40 40
41#define USEC_PER_POLL 50 41#define USEC_PER_POLL 50
42#define NETPOLL_RX_ENABLED 1
43#define NETPOLL_RX_DROP 2
42 44
43#define MAX_SKB_SIZE \ 45#define MAX_SKB_SIZE \
44 (MAX_UDP_CHUNK + sizeof(struct udphdr) + \ 46 (MAX_UDP_CHUNK + sizeof(struct udphdr) + \
@@ -126,11 +128,13 @@ static int poll_one_napi(struct netpoll_info *npinfo,
126 if (!test_bit(NAPI_STATE_SCHED, &napi->state)) 128 if (!test_bit(NAPI_STATE_SCHED, &napi->state))
127 return budget; 129 return budget;
128 130
131 npinfo->rx_flags |= NETPOLL_RX_DROP;
129 atomic_inc(&trapped); 132 atomic_inc(&trapped);
130 133
131 work = napi->poll(napi, budget); 134 work = napi->poll(napi, budget);
132 135
133 atomic_dec(&trapped); 136 atomic_dec(&trapped);
137 npinfo->rx_flags &= ~NETPOLL_RX_DROP;
134 138
135 return budget - work; 139 return budget - work;
136} 140}
@@ -472,7 +476,7 @@ int __netpoll_rx(struct sk_buff *skb)
472 if (skb->dev->type != ARPHRD_ETHER) 476 if (skb->dev->type != ARPHRD_ETHER)
473 goto out; 477 goto out;
474 478
475 /* if receive ARP during middle of NAPI poll, then queue */ 479 /* check if netpoll clients need ARP */
476 if (skb->protocol == htons(ETH_P_ARP) && 480 if (skb->protocol == htons(ETH_P_ARP) &&
477 atomic_read(&trapped)) { 481 atomic_read(&trapped)) {
478 skb_queue_tail(&npi->arp_tx, skb); 482 skb_queue_tail(&npi->arp_tx, skb);
@@ -534,9 +538,6 @@ int __netpoll_rx(struct sk_buff *skb)
534 return 1; 538 return 1;
535 539
536out: 540out:
537 /* If packet received while already in poll then just
538 * silently drop.
539 */
540 if (atomic_read(&trapped)) { 541 if (atomic_read(&trapped)) {
541 kfree_skb(skb); 542 kfree_skb(skb);
542 return 1; 543 return 1;
@@ -675,6 +676,7 @@ int netpoll_setup(struct netpoll *np)
675 goto release; 676 goto release;
676 } 677 }
677 678
679 npinfo->rx_flags = 0;
678 npinfo->rx_np = NULL; 680 npinfo->rx_np = NULL;
679 681
680 spin_lock_init(&npinfo->rx_lock); 682 spin_lock_init(&npinfo->rx_lock);
@@ -756,6 +758,7 @@ int netpoll_setup(struct netpoll *np)
756 758
757 if (np->rx_hook) { 759 if (np->rx_hook) {
758 spin_lock_irqsave(&npinfo->rx_lock, flags); 760 spin_lock_irqsave(&npinfo->rx_lock, flags);
761 npinfo->rx_flags |= NETPOLL_RX_ENABLED;
759 npinfo->rx_np = np; 762 npinfo->rx_np = np;
760 spin_unlock_irqrestore(&npinfo->rx_lock, flags); 763 spin_unlock_irqrestore(&npinfo->rx_lock, flags);
761 } 764 }
@@ -797,6 +800,7 @@ void netpoll_cleanup(struct netpoll *np)
797 if (npinfo->rx_np == np) { 800 if (npinfo->rx_np == np) {
798 spin_lock_irqsave(&npinfo->rx_lock, flags); 801 spin_lock_irqsave(&npinfo->rx_lock, flags);
799 npinfo->rx_np = NULL; 802 npinfo->rx_np = NULL;
803 npinfo->rx_flags &= ~NETPOLL_RX_ENABLED;
800 spin_unlock_irqrestore(&npinfo->rx_lock, flags); 804 spin_unlock_irqrestore(&npinfo->rx_lock, flags);
801 } 805 }
802 806