Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]


Groups > linux.kernel > #1608691

[net-next PATCH v3 3/8] net: Only define skb_mark_napi_id in one spot instead of two

From Alexander Duyck <alexander.duyck@gmail.com>
Newsgroups linux.kernel
Subject [net-next PATCH v3 3/8] net: Only define skb_mark_napi_id in one spot instead of two
Date 2017-03-24 18:10 +0100
Message-ID <toAST-4Ki-39@gated-at.bofh.it> (permalink)
References <toASS-4Ki-5@gated-at.bofh.it>
Organization linux.* mail to news gateway

Show all headers | View raw


From: Alexander Duyck <alexander.h.duyck@intel.com>

Instead of defining two versions of skb_mark_napi_id I think it is more
readable to just match the format of the sk_mark_napi_id functions and just
wrap the contents of the function instead of defining two versions of the
function.  This way we can save a few lines of code since we only need 2 of
the ifdef/endif but needed 5 for the extra function declaration.

Signed-off-by: Alexander Duyck <alexander.h.duyck@intel.com>
Acked-by: Eric Dumazet <edumazet@google.com>
---
 include/net/busy_poll.h |   22 +++++++++-------------
 1 file changed, 9 insertions(+), 13 deletions(-)

diff --git a/include/net/busy_poll.h b/include/net/busy_poll.h
index 3fcda9e70c3f..b82d6ba70a14 100644
--- a/include/net/busy_poll.h
+++ b/include/net/busy_poll.h
@@ -76,14 +76,6 @@ static inline bool busy_loop_timeout(unsigned long end_time)
 
 bool sk_busy_loop(struct sock *sk, int nonblock);
 
-/* used in the NIC receive handler to mark the skb */
-static inline void skb_mark_napi_id(struct sk_buff *skb,
-				    struct napi_struct *napi)
-{
-	skb->napi_id = napi->napi_id;
-}
-
-
 #else /* CONFIG_NET_RX_BUSY_POLL */
 static inline unsigned long net_busy_loop_on(void)
 {
@@ -100,11 +92,6 @@ static inline bool sk_can_busy_loop(struct sock *sk)
 	return false;
 }
 
-static inline void skb_mark_napi_id(struct sk_buff *skb,
-				    struct napi_struct *napi)
-{
-}
-
 static inline bool busy_loop_timeout(unsigned long end_time)
 {
 	return true;
@@ -117,6 +104,15 @@ static inline bool sk_busy_loop(struct sock *sk, int nonblock)
 
 #endif /* CONFIG_NET_RX_BUSY_POLL */
 
+/* used in the NIC receive handler to mark the skb */
+static inline void skb_mark_napi_id(struct sk_buff *skb,
+				    struct napi_struct *napi)
+{
+#ifdef CONFIG_NET_RX_BUSY_POLL
+	skb->napi_id = napi->napi_id;
+#endif
+}
+
 /* used in the protocol hanlder to propagate the napi_id to the socket */
 static inline void sk_mark_napi_id(struct sock *sk, const struct sk_buff *skb)
 {

Back to linux.kernel | Previous | NextPrevious in thread | Next in thread | Find similar | Unroll thread


Thread

[net-next PATCH v3 0/8] Add busy poll support for epoll Alexander Duyck <alexander.duyck@gmail.com> - 2017-03-24 18:10 +0100
  [net-next PATCH v3 5/8] net: Track start of busy loop instead of  when it should end Alexander Duyck <alexander.duyck@gmail.com> - 2017-03-24 18:10 +0100
    Re: [net-next PATCH v3 5/8] net: Track start of busy loop instead  of when it should end Eric Dumazet <eric.dumazet@gmail.com> - 2017-03-25 04:40 +0100
  [net-next PATCH v3 3/8] net: Only define skb_mark_napi_id in one  spot instead of two Alexander Duyck <alexander.duyck@gmail.com> - 2017-03-24 18:10 +0100
  [net-next PATCH v3 6/8] net: Commonize busy polling code to focus  on napi_id instead of socket Alexander Duyck <alexander.duyck@gmail.com> - 2017-03-24 18:10 +0100
  [net-next PATCH v3 7/8] epoll: Add busy poll support to epoll with  socket fds. Alexander Duyck <alexander.duyck@gmail.com> - 2017-03-24 18:20 +0100
    Re: [net-next PATCH v3 7/8] epoll: Add busy poll support to epoll  with socket fds. Eric Dumazet <eric.dumazet@gmail.com> - 2017-03-25 04:40 +0100
  [net-next PATCH v3 4/8] net: Change return type of sk_busy_loop  from bool to void Alexander Duyck <alexander.duyck@gmail.com> - 2017-03-24 18:20 +0100
  Re: [net-next PATCH v3 0/8] Add busy poll support for epoll David Miller <davem@davemloft.net> - 2017-03-25 03:30 +0100
  Re: [net-next PATCH v3 0/8] Add busy poll support for epoll David Miller <davem@davemloft.net> - 2017-03-25 05:00 +0100

csiph-web