Skip to content

Commit

Permalink
[NETPOLL]: Don't need rx_flags.
Browse files Browse the repository at this point in the history
The rx_flags variable is redundant. Turning rx on/off is done
via setting the rx_np pointer.

Signed-off-by: Stephen Hemminger <shemminger@linux-foundation.org>
Signed-off-by: David S. Miller <davem@davemloft.net>
  • Loading branch information
Stephen Hemminger authored and David S. Miller committed Jan 28, 2008
1 parent 33f807b commit c7b6ea2
Show file tree
Hide file tree
Showing 2 changed files with 3 additions and 8 deletions.
7 changes: 3 additions & 4 deletions include/linux/netpoll.h
Original file line number Diff line number Diff line change
Expand Up @@ -25,7 +25,6 @@ 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 @@ -51,12 +50,12 @@ static inline int netpoll_rx(struct sk_buff *skb)
unsigned long flags;
int ret = 0;

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

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

Expand Down
4 changes: 0 additions & 4 deletions net/core/netpoll.c
Original file line number Diff line number Diff line change
Expand Up @@ -39,7 +39,6 @@ static struct sk_buff_head skb_pool;
static atomic_t trapped;

#define USEC_PER_POLL 50
#define NETPOLL_RX_ENABLED 1

#define MAX_SKB_SIZE \
(MAX_UDP_CHUNK + sizeof(struct udphdr) + \
Expand Down Expand Up @@ -675,7 +674,6 @@ 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 @@ -757,7 +755,6 @@ 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 @@ -799,7 +796,6 @@ 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

0 comments on commit c7b6ea2

Please sign in to comment.