[RFC PATCH v2 4/4] net: core: use a dynamic_call for pt_prev->list_func() in list RX path

From: Edward Cree
Date: Fri Feb 01 2019 - 19:08:15 EST


There are currently only two possible callees, ip_list_rcv and
ipv6_list_rcv. Even when more are added, most packets will typically
follow one of a small number of callees on any given system.

Signed-off-by: Edward Cree <ecree@xxxxxxxxxxxxxx>
---
net/core/dev.c | 6 +++++-
1 file changed, 5 insertions(+), 1 deletion(-)

diff --git a/net/core/dev.c b/net/core/dev.c
index 7b38a33689d8..ecf41618a279 100644
--- a/net/core/dev.c
+++ b/net/core/dev.c
@@ -5006,6 +5006,9 @@ int netif_receive_skb_core(struct sk_buff *skb)
}
EXPORT_SYMBOL(netif_receive_skb_core);

+DYNAMIC_CALL_3(void, deliver_skb_list, struct list_head *, struct packet_type *,
+ struct net_device *);
+
static inline void __netif_receive_skb_list_ptype(struct list_head *head,
struct packet_type *pt_prev,
struct net_device *orig_dev)
@@ -5017,7 +5020,8 @@ static inline void __netif_receive_skb_list_ptype(struct list_head *head,
if (list_empty(head))
return;
if (pt_prev->list_func != NULL)
- pt_prev->list_func(head, pt_prev, orig_dev);
+ dynamic_deliver_skb_list(pt_prev->list_func, head, pt_prev,
+ orig_dev);
else
list_for_each_entry_safe(skb, next, head, list)
dynamic_deliver_skb(pt_prev->func, skb, skb->dev,