mirror of https://lore.kernel.org/lkml/
 help / color / mirror / Atom feed
From: Edward Cree <ecree@solarflare.com>
To: <namit@vmware.com>, <jpoimboe@redhat.com>
Cc: <linux-kernel@vger.kernel.org>, <x86@kernel.org>
Subject: [RFC PATCH v2 2/4] net: core: use a dynamic_call for pt_prev->func() in RX path
Date: Sat, 2 Feb 2019 00:07:41 +0000	[thread overview]
Message-ID: <29064c76-5938-7070-dd1d-c36504bee03c@solarflare.com> (raw)
In-Reply-To: <1c8bfbb9-c76f-85d7-f6e2-aba33d5950b0@solarflare.com>

Typically a small number of callees, such as ip[v6]_rcv or packet_rcv,
 will cover most packets.

Signed-off-by: Edward Cree <ecree@solarflare.com>
---
 net/core/dev.c | 12 +++++++++---
 1 file changed, 9 insertions(+), 3 deletions(-)

diff --git a/net/core/dev.c b/net/core/dev.c
index 8e276e0192a1..7b38a33689d8 100644
--- a/net/core/dev.c
+++ b/net/core/dev.c
@@ -146,6 +146,7 @@
 #include <net/udp_tunnel.h>
 #include <linux/net_namespace.h>
 #include <linux/indirect_call_wrapper.h>
+#include <linux/dynamic_call.h>
 
 #include "net-sysfs.h"
 
@@ -1949,6 +1950,9 @@ int dev_forward_skb(struct net_device *dev, struct sk_buff *skb)
 }
 EXPORT_SYMBOL_GPL(dev_forward_skb);
 
+DYNAMIC_CALL_4(int, deliver_skb, struct sk_buff *, struct net_device *,
+	       struct packet_type *, struct net_device *);
+
 static inline int deliver_skb(struct sk_buff *skb,
 			      struct packet_type *pt_prev,
 			      struct net_device *orig_dev)
@@ -1956,7 +1960,7 @@ static inline int deliver_skb(struct sk_buff *skb,
 	if (unlikely(skb_orphan_frags_rx(skb, GFP_ATOMIC)))
 		return -ENOMEM;
 	refcount_inc(&skb->users);
-	return pt_prev->func(skb, skb->dev, pt_prev, orig_dev);
+	return dynamic_deliver_skb(pt_prev->func, skb, skb->dev, pt_prev, orig_dev);
 }
 
 static inline void deliver_ptype_list_skb(struct sk_buff *skb,
@@ -4970,7 +4974,8 @@ static int __netif_receive_skb_one_core(struct sk_buff *skb, bool pfmemalloc)
 
 	ret = __netif_receive_skb_core(skb, pfmemalloc, &pt_prev);
 	if (pt_prev)
-		ret = pt_prev->func(skb, skb->dev, pt_prev, orig_dev);
+		ret = dynamic_deliver_skb(pt_prev->func, skb, skb->dev, pt_prev,
+					  orig_dev);
 	return ret;
 }
 
@@ -5015,7 +5020,8 @@ static inline void __netif_receive_skb_list_ptype(struct list_head *head,
 		pt_prev->list_func(head, pt_prev, orig_dev);
 	else
 		list_for_each_entry_safe(skb, next, head, list)
-			pt_prev->func(skb, skb->dev, pt_prev, orig_dev);
+			dynamic_deliver_skb(pt_prev->func, skb, skb->dev,
+					    pt_prev, orig_dev);
 }
 
 static void __netif_receive_skb_list_core(struct list_head *head, bool pfmemalloc)


  parent reply	other threads:[~2019-02-02  0:07 UTC|newest]

Thread overview: 8+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2019-02-02  0:05 [RFC PATCH v2 0/4] dynamic indirect call promotion Edward Cree
2019-02-02  0:07 ` [RFC PATCH v2 1/4] static_call: add indirect call promotion (dynamic_call) infrastructure Edward Cree
2019-02-02  0:07 ` Edward Cree [this message]
2019-02-02  0:07 ` [RFC PATCH v2 3/4] net: core: use a dynamic_call for dst_input Edward Cree
2019-02-02  0:08 ` [RFC PATCH v2 4/4] net: core: use a dynamic_call for pt_prev->list_func() in list RX path Edward Cree
2019-02-05  8:50 ` [RFC PATCH v2 0/4] dynamic indirect call promotion Nadav Amit
2019-02-15 17:21   ` Edward Cree
2019-02-18 16:22     ` Nadav Amit

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=29064c76-5938-7070-dd1d-c36504bee03c@solarflare.com \
    --to=ecree@solarflare.com \
    --cc=jpoimboe@redhat.com \
    --cc=linux-kernel@vger.kernel.org \
    --cc=namit@vmware.com \
    --cc=x86@kernel.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox

all inboxes | Powered by JetHome®