[PATCH] netdev: create an "is_napi_enabled()" call

!MAILaRCHIVE_VOTE_RePLACE
Previous message: [thread] [date] [author]
Next message: [thread] [date] [author]
To: Jeff Garzik <jeff@...>, Andrew Morton <akpm@...>
Cc: NetDev <netdev@...>, <e1000-devel@...>
Date: Tuesday, November 13, 2007 - 7:06 pm

In certain rare cases, it can be nice to be able to check
if napi is enabled or not. Create an is_napi_enabled() call.

Signed-off-by: Linas Vepstas <linas@austin.ibm.com>
-------
Actually, I'm confused about whether I'd mailed this previously.
It might be a duplicate submission.

 include/linux/netdevice.h |   11 +++++++++++
 1 file changed, 11 insertions(+)

Index: linux-2.6.23-rc8-mm1/include/linux/netdevice.h
===================================================================
--- linux-2.6.23-rc8-mm1.orig/include/linux/netdevice.h	2007-11-09 17:36:51.000000000 -0600
+++ linux-2.6.23-rc8-mm1/include/linux/netdevice.h	2007-11-09 17:40:19.000000000 -0600
@@ -384,6 +384,17 @@ static inline void napi_enable(struct na
 	clear_bit(NAPI_STATE_SCHED, &n->state);
 }
 
+/**
+ *	is_napi_enabled - return non-zero if napi enabled
+ *	@n: napi context
+ *
+ * Return true if napi is enabled.
+ */
+static inline bool is_napi_enabled(struct napi_struct *n)
+{
+	return !test_bit(NAPI_STATE_SCHED, &n->state);
+}
+
 /*
  *	The DEVICE structure.
  *	Actually, this whole structure is a big mistake.  It mixes I/O
-
To unsubscribe from this list: send the line "unsubscribe netdev" in
the body of a message to majordomo@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Previous message: [thread] [date] [author]
Next message: [thread] [date] [author]

Messages in current thread:
[PATCH] netdev: create an "is_napi_enabled()" call, Linas Vepstas, (Tue Nov 13, 7:06 pm)
Re: [PATCH] netdev: create an "is_napi_enabled()" call, David Miller, (Tue Nov 13, 9:42 pm)