Commit 91fe4a4b authored by Amerigo Wang's avatar Amerigo Wang Committed by David S. Miller

netpoll: use netpoll_rx_on() in netpoll_rx()

The logic of the code is same, just call netpoll_rx_on().

Cc: "David S. Miller" <davem@davemloft.net>
Signed-off-by: default avatarCong Wang <amwang@redhat.com>
Signed-off-by: default avatarDavid S. Miller <davem@davemloft.net>
parent 57c5d461
...@@ -63,6 +63,13 @@ static inline void netpoll_send_skb(struct netpoll *np, struct sk_buff *skb) ...@@ -63,6 +63,13 @@ static inline void netpoll_send_skb(struct netpoll *np, struct sk_buff *skb)
#ifdef CONFIG_NETPOLL #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) static inline bool netpoll_rx(struct sk_buff *skb)
{ {
struct netpoll_info *npinfo; struct netpoll_info *npinfo;
...@@ -70,11 +77,11 @@ static inline bool netpoll_rx(struct sk_buff *skb) ...@@ -70,11 +77,11 @@ static inline bool netpoll_rx(struct sk_buff *skb)
bool ret = false; bool ret = false;
local_irq_save(flags); 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; goto out;
npinfo = rcu_dereference_bh(skb->dev->npinfo);
spin_lock(&npinfo->rx_lock); spin_lock(&npinfo->rx_lock);
/* check rx_flags again with the lock held */ /* check rx_flags again with the lock held */
if (npinfo->rx_flags && __netpoll_rx(skb, npinfo)) if (npinfo->rx_flags && __netpoll_rx(skb, npinfo))
...@@ -86,13 +93,6 @@ static inline bool netpoll_rx(struct sk_buff *skb) ...@@ -86,13 +93,6 @@ static inline bool netpoll_rx(struct sk_buff *skb)
return ret; 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) static inline int netpoll_receive_skb(struct sk_buff *skb)
{ {
if (!list_empty(&skb->dev->napi_list)) if (!list_empty(&skb->dev->napi_list))
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment