Skip to content

Commit

Permalink
---
Browse files Browse the repository at this point in the history
yaml
---
r: 86919
b: refs/heads/master
c: 3123e66
h: refs/heads/master
i:
  86917: 8d6e4d0
  86915: 262da0f
  86911: 219931f
v: v3
  • Loading branch information
David S. Miller committed Mar 5, 2008
1 parent 2541a87 commit a194023
Show file tree
Hide file tree
Showing 6 changed files with 17 additions and 11 deletions.
2 changes: 1 addition & 1 deletion [refs]
Original file line number Diff line number Diff line change
@@ -1,2 +1,2 @@
---
refs/heads/master: c256e05b7b30fab484deacb4f8cff59ce649c75e
refs/heads/master: 3123e666ea92ab0b1762e97e0785d20a0ab25088
7 changes: 4 additions & 3 deletions trunk/include/linux/netpoll.h
Original file line number Diff line number Diff line change
Expand Up @@ -25,6 +25,7 @@ struct netpoll {

struct netpoll_info {
atomic_t refcnt;
int rx_flags;
spinlock_t rx_lock;
struct netpoll *rx_np; /* netpoll that registered an rx_hook */
struct sk_buff_head arp_tx; /* list of arp requests to reply to */
Expand All @@ -50,12 +51,12 @@ static inline int netpoll_rx(struct sk_buff *skb)
unsigned long flags;
int ret = 0;

if (!npinfo || !npinfo->rx_np)
if (!npinfo || (!npinfo->rx_np && !npinfo->rx_flags))
return 0;

spin_lock_irqsave(&npinfo->rx_lock, flags);
/* check rx_np again with the lock held */
if (npinfo->rx_np && __netpoll_rx(skb))
/* check rx_flags again with the lock held */
if (npinfo->rx_flags && __netpoll_rx(skb))
ret = 1;
spin_unlock_irqrestore(&npinfo->rx_lock, flags);

Expand Down
3 changes: 2 additions & 1 deletion trunk/include/net/inet_sock.h
Original file line number Diff line number Diff line change
Expand Up @@ -175,7 +175,8 @@ extern void build_ehash_secret(void);
static inline unsigned int inet_ehashfn(const __be32 laddr, const __u16 lport,
const __be32 faddr, const __be16 fport)
{
return jhash_2words((__force __u32) laddr ^ (__force __u32) faddr,
return jhash_3words((__force __u32) laddr,
(__force __u32) faddr,
((__u32) lport) << 16 | (__force __u32)fport,
inet_ehash_secret);
}
Expand Down
12 changes: 8 additions & 4 deletions trunk/net/core/netpoll.c
Original file line number Diff line number Diff line change
Expand Up @@ -39,6 +39,8 @@ static struct sk_buff_head skb_pool;
static atomic_t trapped;

#define USEC_PER_POLL 50
#define NETPOLL_RX_ENABLED 1
#define NETPOLL_RX_DROP 2

#define MAX_SKB_SIZE \
(MAX_UDP_CHUNK + sizeof(struct udphdr) + \
Expand Down Expand Up @@ -126,11 +128,13 @@ static int poll_one_napi(struct netpoll_info *npinfo,
if (!test_bit(NAPI_STATE_SCHED, &napi->state))
return budget;

npinfo->rx_flags |= NETPOLL_RX_DROP;
atomic_inc(&trapped);

work = napi->poll(napi, budget);

atomic_dec(&trapped);
npinfo->rx_flags &= ~NETPOLL_RX_DROP;

return budget - work;
}
Expand Down Expand Up @@ -472,7 +476,7 @@ int __netpoll_rx(struct sk_buff *skb)
if (skb->dev->type != ARPHRD_ETHER)
goto out;

/* if receive ARP during middle of NAPI poll, then queue */
/* check if netpoll clients need ARP */
if (skb->protocol == htons(ETH_P_ARP) &&
atomic_read(&trapped)) {
skb_queue_tail(&npi->arp_tx, skb);
Expand Down Expand Up @@ -534,9 +538,6 @@ int __netpoll_rx(struct sk_buff *skb)
return 1;

out:
/* If packet received while already in poll then just
* silently drop.
*/
if (atomic_read(&trapped)) {
kfree_skb(skb);
return 1;
Expand Down Expand Up @@ -675,6 +676,7 @@ int netpoll_setup(struct netpoll *np)
goto release;
}

npinfo->rx_flags = 0;
npinfo->rx_np = NULL;

spin_lock_init(&npinfo->rx_lock);
Expand Down Expand Up @@ -756,6 +758,7 @@ int netpoll_setup(struct netpoll *np)

if (np->rx_hook) {
spin_lock_irqsave(&npinfo->rx_lock, flags);
npinfo->rx_flags |= NETPOLL_RX_ENABLED;
npinfo->rx_np = np;
spin_unlock_irqrestore(&npinfo->rx_lock, flags);
}
Expand Down Expand Up @@ -797,6 +800,7 @@ void netpoll_cleanup(struct netpoll *np)
if (npinfo->rx_np == np) {
spin_lock_irqsave(&npinfo->rx_lock, flags);
npinfo->rx_np = NULL;
npinfo->rx_flags &= ~NETPOLL_RX_ENABLED;
spin_unlock_irqrestore(&npinfo->rx_lock, flags);
}

Expand Down
2 changes: 1 addition & 1 deletion trunk/net/ipv4/Kconfig
Original file line number Diff line number Diff line change
Expand Up @@ -343,7 +343,7 @@ config INET_ESP
tristate "IP: ESP transformation"
select XFRM
select CRYPTO
select CRYPTO_AEAD
select CRYPTO_AUTHENC
select CRYPTO_HMAC
select CRYPTO_MD5
select CRYPTO_CBC
Expand Down
2 changes: 1 addition & 1 deletion trunk/net/ipv6/Kconfig
Original file line number Diff line number Diff line change
Expand Up @@ -85,7 +85,7 @@ config INET6_ESP
depends on IPV6
select XFRM
select CRYPTO
select CRYPTO_AEAD
select CRYPTO_AUTHENC
select CRYPTO_HMAC
select CRYPTO_MD5
select CRYPTO_CBC
Expand Down

0 comments on commit a194023

Please sign in to comment.