mirror of
https://github.com/Fishwaldo/linux-bl808.git
synced 2025-06-17 20:25:19 +00:00
netpoll: Add netpoll_rx_processing
Add a helper netpoll_rx_processing that reports when netpoll has receive side processing to perform. Signed-off-by: "Eric W. Biederman" <ebiederm@xmission.com> Signed-off-by: David S. Miller <davem@davemloft.net>
This commit is contained in:
parent
e97dc3fcf9
commit
ff60763143
2 changed files with 16 additions and 6 deletions
|
@ -82,14 +82,24 @@ static inline void netpoll_send_skb(struct netpoll *np, struct sk_buff *skb)
|
||||||
local_irq_restore(flags);
|
local_irq_restore(flags);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
#ifdef CONFIG_NETPOLL_TRAP
|
||||||
|
static inline bool netpoll_rx_processing(struct netpoll_info *npinfo)
|
||||||
|
{
|
||||||
|
return !list_empty(&npinfo->rx_np);
|
||||||
|
}
|
||||||
|
#else
|
||||||
|
static inline bool netpoll_rx_processing(struct netpoll_info *npinfo)
|
||||||
|
{
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
#endif
|
||||||
|
|
||||||
#ifdef CONFIG_NETPOLL
|
#ifdef CONFIG_NETPOLL
|
||||||
static inline bool netpoll_rx_on(struct sk_buff *skb)
|
static inline bool netpoll_rx_on(struct sk_buff *skb)
|
||||||
{
|
{
|
||||||
struct netpoll_info *npinfo = rcu_dereference_bh(skb->dev->npinfo);
|
struct netpoll_info *npinfo = rcu_dereference_bh(skb->dev->npinfo);
|
||||||
|
|
||||||
return npinfo && (!list_empty(&npinfo->rx_np) || npinfo->rx_flags);
|
return npinfo && (netpoll_rx_processing(npinfo) || npinfo->rx_flags);
|
||||||
}
|
}
|
||||||
|
|
||||||
static inline bool netpoll_rx(struct sk_buff *skb)
|
static inline bool netpoll_rx(struct sk_buff *skb)
|
||||||
|
@ -105,8 +115,8 @@ static inline bool netpoll_rx(struct sk_buff *skb)
|
||||||
|
|
||||||
npinfo = rcu_dereference_bh(skb->dev->npinfo);
|
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_processing again with the lock held */
|
||||||
if (npinfo->rx_flags && __netpoll_rx(skb, npinfo))
|
if (netpoll_rx_processing(npinfo) && __netpoll_rx(skb, npinfo))
|
||||||
ret = true;
|
ret = true;
|
||||||
spin_unlock(&npinfo->rx_lock);
|
spin_unlock(&npinfo->rx_lock);
|
||||||
|
|
||||||
|
|
|
@ -538,7 +538,7 @@ static void netpoll_neigh_reply(struct sk_buff *skb, struct netpoll_info *npinfo
|
||||||
int hlen, tlen;
|
int hlen, tlen;
|
||||||
int hits = 0, proto;
|
int hits = 0, proto;
|
||||||
|
|
||||||
if (list_empty(&npinfo->rx_np))
|
if (!netpoll_rx_processing(npinfo))
|
||||||
return;
|
return;
|
||||||
|
|
||||||
/* Before checking the packet, we do some early
|
/* Before checking the packet, we do some early
|
||||||
|
@ -770,7 +770,7 @@ int __netpoll_rx(struct sk_buff *skb, struct netpoll_info *npinfo)
|
||||||
struct netpoll *np, *tmp;
|
struct netpoll *np, *tmp;
|
||||||
uint16_t source;
|
uint16_t source;
|
||||||
|
|
||||||
if (list_empty(&npinfo->rx_np))
|
if (!netpoll_rx_processing(npinfo))
|
||||||
goto out;
|
goto out;
|
||||||
|
|
||||||
if (skb->dev->type != ARPHRD_ETHER)
|
if (skb->dev->type != ARPHRD_ETHER)
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue