Skip to content

Commit

Permalink
netpoll: use netpoll_rx_on() in netpoll_rx()
Browse files Browse the repository at this point in the history
The logic of the code is same, just call netpoll_rx_on().

Cc: "David S. Miller" <[email protected]>
Signed-off-by: Cong Wang <[email protected]>
Signed-off-by: David S. Miller <[email protected]>
  • Loading branch information
Amerigo Wang authored and davem330 committed Aug 14, 2012
1 parent 57c5d46 commit 91fe4a4
Showing 1 changed file with 9 additions and 9 deletions.
18 changes: 9 additions & 9 deletions include/linux/netpoll.h
Original file line number Diff line number Diff line change
Expand Up @@ -63,18 +63,25 @@ static inline void netpoll_send_skb(struct netpoll *np, struct sk_buff *skb)


#ifdef CONFIG_NETPOLL
static inline int netpoll_rx_on(struct sk_buff *skb)
{
struct netpoll_info *npinfo = rcu_dereference_bh(skb->dev->npinfo);

return npinfo && (!list_empty(&npinfo->rx_np) || npinfo->rx_flags);
}

static inline bool netpoll_rx(struct sk_buff *skb)
{
struct netpoll_info *npinfo;
unsigned long flags;
bool ret = false;

local_irq_save(flags);
npinfo = rcu_dereference_bh(skb->dev->npinfo);

if (!npinfo || (list_empty(&npinfo->rx_np) && !npinfo->rx_flags))
if (!netpoll_rx_on(skb))
goto out;

npinfo = rcu_dereference_bh(skb->dev->npinfo);
spin_lock(&npinfo->rx_lock);
/* check rx_flags again with the lock held */
if (npinfo->rx_flags && __netpoll_rx(skb, npinfo))
Expand All @@ -86,13 +93,6 @@ static inline bool netpoll_rx(struct sk_buff *skb)
return ret;
}

static inline int netpoll_rx_on(struct sk_buff *skb)
{
struct netpoll_info *npinfo = rcu_dereference_bh(skb->dev->npinfo);

return npinfo && (!list_empty(&npinfo->rx_np) || npinfo->rx_flags);
}

static inline int netpoll_receive_skb(struct sk_buff *skb)
{
if (!list_empty(&skb->dev->napi_list))
Expand Down

0 comments on commit 91fe4a4

Please sign in to comment.