diff mbox series

veth: Drop MTU check when forwarding packets

Message ID CALttK1TYZURJo8AKtGQFcKKMvzssy3mF=iG9rODqvEiPw_qqpg@mail.gmail.com (mailing list archive)
State Superseded
Delegated to: Netdev Maintainers
Headers show
Series veth: Drop MTU check when forwarding packets | expand

Checks

Context Check Description
netdev/tree_selection success Guessing tree name failed - patch did not apply, async

Commit Message

Duan Jiong Aug. 8, 2024, 4:32 a.m. UTC
>From dcf061830aba15b57819600b5db782981bab973a Mon Sep 17 00:00:00 2001
From: Duan Jiong <djduanjiong@gmail.com>
Date: Thu, 8 Aug 2024 12:23:01 +0800
Subject: [PATCH] veth: Drop MTU check when forwarding packets

When the mtu of the veth card is not the same at both ends, there is
no need to check the mtu when forwarding packets, and it should be a
permissible behavior to allow receiving packets with larger mtu than
your own.

Signed-off-by: Duan Jiong <djduanjiong@gmail.com>
---
 drivers/net/veth.c        | 2 +-
 include/linux/netdevice.h | 1 +
 net/core/dev.c            | 6 ++++++
 3 files changed, 8 insertions(+), 1 deletion(-)

        return __dev_forward_skb2(dev, skb, true);

Comments

Duan Jiong Aug. 8, 2024, 5:23 a.m. UTC | #1
There's a problem with the patch formatting, so ignore it and send the
v2 version later.

Duan Jiong <djduanjiong@gmail.com> 于2024年8月8日周四 12:32写道:
>
> From dcf061830aba15b57819600b5db782981bab973a Mon Sep 17 00:00:00 2001
> From: Duan Jiong <djduanjiong@gmail.com>
> Date: Thu, 8 Aug 2024 12:23:01 +0800
> Subject: [PATCH] veth: Drop MTU check when forwarding packets
>
> When the mtu of the veth card is not the same at both ends, there is
> no need to check the mtu when forwarding packets, and it should be a
> permissible behavior to allow receiving packets with larger mtu than
> your own.
>
> Signed-off-by: Duan Jiong <djduanjiong@gmail.com>
> ---
>  drivers/net/veth.c        | 2 +-
>  include/linux/netdevice.h | 1 +
>  net/core/dev.c            | 6 ++++++
>  3 files changed, 8 insertions(+), 1 deletion(-)
>
> diff --git a/drivers/net/veth.c b/drivers/net/veth.c
> index 426e68a95067..f505fe2a55c1 100644
> --- a/drivers/net/veth.c
> +++ b/drivers/net/veth.c
> @@ -317,7 +317,7 @@ static int veth_xdp_rx(struct veth_rq *rq, struct
> sk_buff *skb)
>  static int veth_forward_skb(struct net_device *dev, struct sk_buff *skb,
>                             struct veth_rq *rq, bool xdp)
>  {
> -       return __dev_forward_skb(dev, skb) ?: xdp ?
> +       return __dev_forward_skb_nomtu(dev, skb) ?: xdp ?
>                 veth_xdp_rx(rq, skb) :
>                 __netif_rx(skb);
>  }
> diff --git a/include/linux/netdevice.h b/include/linux/netdevice.h
> index d20c6c99eb88..8cee9b40e50e 100644
> --- a/include/linux/netdevice.h
> +++ b/include/linux/netdevice.h
> @@ -3943,6 +3943,7 @@ int bpf_xdp_link_attach(const union bpf_attr
> *attr, struct bpf_prog *prog);
>  u8 dev_xdp_prog_count(struct net_device *dev);
>  u32 dev_xdp_prog_id(struct net_device *dev, enum bpf_xdp_mode mode);
>
> +int __dev_forward_skb_nomtu(struct net_device *dev, struct sk_buff *skb);
>  int __dev_forward_skb(struct net_device *dev, struct sk_buff *skb);
>  int dev_forward_skb(struct net_device *dev, struct sk_buff *skb);
>  int dev_forward_skb_nomtu(struct net_device *dev, struct sk_buff *skb);
> diff --git a/net/core/dev.c b/net/core/dev.c
> index e1bb6d7856d9..acd740f78b1c 100644
> --- a/net/core/dev.c
> +++ b/net/core/dev.c
> @@ -2190,6 +2190,12 @@ static int __dev_forward_skb2(struct net_device
> *dev, struct sk_buff *skb,
>         return ret;
>  }
>
> +int __dev_forward_skb_nomtu(struct net_device *dev, struct sk_buff *skb)
> +{
> +       return __dev_forward_skb2(dev, skb, false);
> +}
> +EXPORT_SYMBOL_GPL(__dev_forward_skb_nomtu);
> +
>  int __dev_forward_skb(struct net_device *dev, struct sk_buff *skb)
>  {
>         return __dev_forward_skb2(dev, skb, true);
> --
> 2.38.1
Jakub Kicinski Aug. 8, 2024, 2:59 p.m. UTC | #2
On Thu, 8 Aug 2024 13:23:56 +0800 Duan Jiong wrote:
> There's a problem with the patch formatting, so ignore it and send the
> v2 version later.

Kindly, please read the documentation before you send more patches:

https://www.kernel.org/doc/html/next/process/maintainer-netdev.html
diff mbox series

Patch

diff --git a/drivers/net/veth.c b/drivers/net/veth.c
index 426e68a95067..f505fe2a55c1 100644
--- a/drivers/net/veth.c
+++ b/drivers/net/veth.c
@@ -317,7 +317,7 @@  static int veth_xdp_rx(struct veth_rq *rq, struct
sk_buff *skb)
 static int veth_forward_skb(struct net_device *dev, struct sk_buff *skb,
                            struct veth_rq *rq, bool xdp)
 {
-       return __dev_forward_skb(dev, skb) ?: xdp ?
+       return __dev_forward_skb_nomtu(dev, skb) ?: xdp ?
                veth_xdp_rx(rq, skb) :
                __netif_rx(skb);
 }
diff --git a/include/linux/netdevice.h b/include/linux/netdevice.h
index d20c6c99eb88..8cee9b40e50e 100644
--- a/include/linux/netdevice.h
+++ b/include/linux/netdevice.h
@@ -3943,6 +3943,7 @@  int bpf_xdp_link_attach(const union bpf_attr
*attr, struct bpf_prog *prog);
 u8 dev_xdp_prog_count(struct net_device *dev);
 u32 dev_xdp_prog_id(struct net_device *dev, enum bpf_xdp_mode mode);

+int __dev_forward_skb_nomtu(struct net_device *dev, struct sk_buff *skb);
 int __dev_forward_skb(struct net_device *dev, struct sk_buff *skb);
 int dev_forward_skb(struct net_device *dev, struct sk_buff *skb);
 int dev_forward_skb_nomtu(struct net_device *dev, struct sk_buff *skb);
diff --git a/net/core/dev.c b/net/core/dev.c
index e1bb6d7856d9..acd740f78b1c 100644
--- a/net/core/dev.c
+++ b/net/core/dev.c
@@ -2190,6 +2190,12 @@  static int __dev_forward_skb2(struct net_device
*dev, struct sk_buff *skb,
        return ret;
 }

+int __dev_forward_skb_nomtu(struct net_device *dev, struct sk_buff *skb)
+{
+       return __dev_forward_skb2(dev, skb, false);
+}
+EXPORT_SYMBOL_GPL(__dev_forward_skb_nomtu);
+
 int __dev_forward_skb(struct net_device *dev, struct sk_buff *skb)
 {