* [PATCH net] vrf: fix maximum MTU
@ 2021-06-08 14:59 Nicolas Dichtel
2021-06-08 15:22 ` David Ahern
2021-06-08 18:50 ` patchwork-bot+netdevbpf
0 siblings, 2 replies; 3+ messages in thread
From: Nicolas Dichtel @ 2021-06-08 14:59 UTC (permalink / raw)
To: davem, kuba; +Cc: netdev, dsahern, Nicolas Dichtel, Miaohe Lin
My initial goal was to fix the default MTU, which is set to 65536, ie above
the maximum defined in the driver: 65535 (ETH_MAX_MTU).
In fact, it's seems more consistent, wrt min_mtu, to set the max_mtu to
IP6_MAX_MTU (65535 + sizeof(struct ipv6hdr)) and use it by default.
Let's also, for consistency, set the mtu in vrf_setup(). This function
calls ether_setup(), which set the mtu to 1500. Thus, the whole mtu config
is done in the same function.
Before the patch:
$ ip link add blue type vrf table 1234
$ ip link list blue
9: blue: <NOARP,MASTER> mtu 65536 qdisc noop state DOWN mode DEFAULT group default qlen 1000
link/ether fa:f5:27:70:24:2a brd ff:ff:ff:ff:ff:ff
$ ip link set dev blue mtu 65535
$ ip link set dev blue mtu 65536
Error: mtu greater than device maximum.
Fixes: 5055376a3b44 ("net: vrf: Fix ping failed when vrf mtu is set to 0")
CC: Miaohe Lin <linmiaohe@huawei.com>
Signed-off-by: Nicolas Dichtel <nicolas.dichtel@6wind.com>
---
drivers/net/vrf.c | 6 ++----
1 file changed, 2 insertions(+), 4 deletions(-)
diff --git a/drivers/net/vrf.c b/drivers/net/vrf.c
index 503e2fd7ce51..28a6c4cfe9b8 100644
--- a/drivers/net/vrf.c
+++ b/drivers/net/vrf.c
@@ -1183,9 +1183,6 @@ static int vrf_dev_init(struct net_device *dev)
dev->flags = IFF_MASTER | IFF_NOARP;
- /* MTU is irrelevant for VRF device; set to 64k similar to lo */
- dev->mtu = 64 * 1024;
-
/* similarly, oper state is irrelevant; set to up to avoid confusion */
dev->operstate = IF_OPER_UP;
netdev_lockdep_set_classes(dev);
@@ -1685,7 +1682,8 @@ static void vrf_setup(struct net_device *dev)
* which breaks networking.
*/
dev->min_mtu = IPV6_MIN_MTU;
- dev->max_mtu = ETH_MAX_MTU;
+ dev->max_mtu = IP6_MAX_MTU;
+ dev->mtu = dev->max_mtu;
}
static int vrf_validate(struct nlattr *tb[], struct nlattr *data[],
--
2.30.0
^ permalink raw reply related [flat|nested] 3+ messages in thread
* Re: [PATCH net] vrf: fix maximum MTU
2021-06-08 14:59 [PATCH net] vrf: fix maximum MTU Nicolas Dichtel
@ 2021-06-08 15:22 ` David Ahern
2021-06-08 18:50 ` patchwork-bot+netdevbpf
1 sibling, 0 replies; 3+ messages in thread
From: David Ahern @ 2021-06-08 15:22 UTC (permalink / raw)
To: Nicolas Dichtel, davem, kuba; +Cc: netdev, Miaohe Lin
On 6/8/21 8:59 AM, Nicolas Dichtel wrote:
> My initial goal was to fix the default MTU, which is set to 65536, ie above
> the maximum defined in the driver: 65535 (ETH_MAX_MTU).
>
> In fact, it's seems more consistent, wrt min_mtu, to set the max_mtu to
> IP6_MAX_MTU (65535 + sizeof(struct ipv6hdr)) and use it by default.
>
> Let's also, for consistency, set the mtu in vrf_setup(). This function
> calls ether_setup(), which set the mtu to 1500. Thus, the whole mtu config
> is done in the same function.
>
> Before the patch:
> $ ip link add blue type vrf table 1234
> $ ip link list blue
> 9: blue: <NOARP,MASTER> mtu 65536 qdisc noop state DOWN mode DEFAULT group default qlen 1000
> link/ether fa:f5:27:70:24:2a brd ff:ff:ff:ff:ff:ff
> $ ip link set dev blue mtu 65535
> $ ip link set dev blue mtu 65536
> Error: mtu greater than device maximum.
>
> Fixes: 5055376a3b44 ("net: vrf: Fix ping failed when vrf mtu is set to 0")
> CC: Miaohe Lin <linmiaohe@huawei.com>
> Signed-off-by: Nicolas Dichtel <nicolas.dichtel@6wind.com>
> ---
> drivers/net/vrf.c | 6 ++----
> 1 file changed, 2 insertions(+), 4 deletions(-)
>
Reviewed-by: David Ahern <dsahern@gmail.com>
^ permalink raw reply [flat|nested] 3+ messages in thread
* Re: [PATCH net] vrf: fix maximum MTU
2021-06-08 14:59 [PATCH net] vrf: fix maximum MTU Nicolas Dichtel
2021-06-08 15:22 ` David Ahern
@ 2021-06-08 18:50 ` patchwork-bot+netdevbpf
1 sibling, 0 replies; 3+ messages in thread
From: patchwork-bot+netdevbpf @ 2021-06-08 18:50 UTC (permalink / raw)
To: Nicolas Dichtel; +Cc: davem, kuba, netdev, dsahern, linmiaohe
Hello:
This patch was applied to netdev/net.git (refs/heads/master):
On Tue, 8 Jun 2021 16:59:51 +0200 you wrote:
> My initial goal was to fix the default MTU, which is set to 65536, ie above
> the maximum defined in the driver: 65535 (ETH_MAX_MTU).
>
> In fact, it's seems more consistent, wrt min_mtu, to set the max_mtu to
> IP6_MAX_MTU (65535 + sizeof(struct ipv6hdr)) and use it by default.
>
> Let's also, for consistency, set the mtu in vrf_setup(). This function
> calls ether_setup(), which set the mtu to 1500. Thus, the whole mtu config
> is done in the same function.
>
> [...]
Here is the summary with links:
- [net] vrf: fix maximum MTU
https://git.kernel.org/netdev/net/c/9bb392f62447
You are awesome, thank you!
--
Deet-doot-dot, I am a bot.
https://korg.docs.kernel.org/patchwork/pwbot.html
^ permalink raw reply [flat|nested] 3+ messages in thread
end of thread, other threads:[~2021-06-08 19:14 UTC | newest]
Thread overview: 3+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2021-06-08 14:59 [PATCH net] vrf: fix maximum MTU Nicolas Dichtel
2021-06-08 15:22 ` David Ahern
2021-06-08 18:50 ` patchwork-bot+netdevbpf
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.