Thread (16 messages) flat view 16 messages, 2 authors, 2020-12-17

Re: [PATCH bpf-next V8 5/8] bpf: drop MTU check when doing TC-BPF redirect to ingress

From: Jesper Dangaard Brouer <hidden>
Date: 2020-12-17 16:12:56
Also in: bpf

On Thu, 17 Dec 2020 15:46:55 +0100
Jesper Dangaard Brouer [off-list ref] wrote:
quoted
quoted
diff --git a/net/core/filter.c b/net/core/filter.c
index d6125cfc49c3..4673afe59533 100644
--- a/net/core/filter.c
+++ b/net/core/filter.c
@@ -2083,13 +2083,21 @@ static const struct bpf_func_proto bpf_csum_level_proto = {
  
  static inline int __bpf_rx_skb(struct net_device *dev, struct sk_buff *skb)
  {
-	return dev_forward_skb(dev, skb);
+	int ret = ____dev_forward_skb(dev, skb, false);
+
+	if (likely(!ret)) {
+		skb->protocol = eth_type_trans(skb, dev);
+		skb_postpull_rcsum(skb, eth_hdr(skb), ETH_HLEN);
+		ret = netif_rx(skb);    
Why netif_rx() and not netif_rx_internal() as in dev_forward_skb() originally?
One extra call otherwise.  
This is because the function below calls netif_rx(), which is just
outside patch-diff-window.  Thus, it looked wrong/strange to call
netif_rx_internal(), but sure I can use netif_rx_internal() instead.
Well, when building I found that we obviously cannot call
netif_rx_internal() as this is filter.c, else we get a build error:

net/core/filter.c:2091:9: error: implicit declaration of function ‘netif_rx_internal’ [-Werror=implicit-function-declaration]
 2091 |   ret = netif_rx_internal(skb);
      |         ^~~~~~~~~~~~~~~~~

-- 
Best regards,
  Jesper Dangaard Brouer
  MSc.CS, Principal Kernel Engineer at Red Hat
  LinkedIn: http://www.linkedin.com/in/brouer
Keyboard shortcuts
hback out one level
jnext message in thread
kprevious message in thread
ldrill in
Escclose help / fold thread tree
?toggle this help