Skip to content

Commit

Permalink
netpoll: Add netpoll_tx_running
Browse files Browse the repository at this point in the history
This patch adds the helper netpoll_tx_running for use within
ndo_start_xmit.  It returns non-zero if ndo_start_xmit is being
invoked by netpoll, and zero otherwise.

This is currently implemented by simply looking at the hardirq
count.  This is because for all non-netpoll uses of ndo_start_xmit,
IRQs must be enabled while netpoll always disables IRQs before
calling ndo_start_xmit.

Signed-off-by: Herbert Xu <herbert@gondor.apana.org.au>
Signed-off-by: David S. Miller <davem@davemloft.net>
  • Loading branch information
Herbert Xu authored and David S. Miller committed Jun 15, 2010
1 parent 8fdd95e commit c18370f
Showing 1 changed file with 9 additions and 0 deletions.
9 changes: 9 additions & 0 deletions include/linux/netpoll.h
Original file line number Diff line number Diff line change
Expand Up @@ -116,6 +116,11 @@ static inline void netpoll_poll_unlock(void *have)
}
}

static inline int netpoll_tx_running(struct net_device *dev)
{
return irqs_disabled();
}

#else
static inline int netpoll_rx(struct sk_buff *skb)
{
Expand All @@ -139,6 +144,10 @@ static inline void netpoll_poll_unlock(void *have)
static inline void netpoll_netdev_init(struct net_device *dev)
{
}
static inline int netpoll_tx_running(struct net_device *dev)
{
return 0;
}
#endif

#endif

0 comments on commit c18370f

Please sign in to comment.