From: Herbert Xu Date: Thu, 10 Jun 2010 16:12:49 +0000 (+0000) Subject: netpoll: Add netpoll_tx_running X-Git-Tag: v3.12-rc1~9497^2~583 X-Git-Url: http://review.tizen.org/git/?a=commitdiff_plain;h=c18370f5b2949d9cca519355f33690b75e1e7c8b;p=kernel%2Fkernel-generic.git netpoll: Add netpoll_tx_running 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 Signed-off-by: David S. Miller --- diff --git a/include/linux/netpoll.h b/include/linux/netpoll.h index f3ad74a..4c77fe7 100644 --- a/include/linux/netpoll.h +++ b/include/linux/netpoll.h @@ -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) { @@ -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