Message ID | 1543754077-18643-2-git-send-email-tariqt@mellanox.com |
---|---|
State | Accepted, archived |
Delegated to: | David Miller |
Headers | show |
Series | [net,1/2] net/mlx4_en: Change min MTU size to ETH_MIN_MTU | expand |
From: Tariq Toukan > Sent: 02 December 2018 12:35 > From: Eran Ben Elisha <eranbe@mellanox.com> > > NIC driver minimal MTU size shall be set to ETH_MIN_MTU, as defined in > the RFC791 and in the network stack. Remove old mlx4_en only define for > it, which was set to wrong value. ... > > - /* MTU range: 46 - hw-specific max */ > - dev->min_mtu = MLX4_EN_MIN_MTU; > + /* MTU range: 68 - hw-specific max */ > + dev->min_mtu = ETH_MIN_MTU; > dev->max_mtu = priv->max_mtu; Where does 68 come from? The minimum size of an ethernet packet including the mac addresses and CRC is 64 bytes - but that would never be an 'mtu'. Since 64 - 46 = 18, the 46 probably excludes both MAC addresses, the ethertype/length and the CRC. This is 'sort of' the minimum mtu for an ethernet frame. I'm not sure which values are supposed to be in dev->min/max_mtu. David - Registered Address Lakeside, Bramley Road, Mount Farm, Milton Keynes, MK1 1PT, UK Registration No: 1397386 (Wales)
On 12/04/2018 08:59 AM, David Laight wrote: > From: Tariq Toukan >> Sent: 02 December 2018 12:35 >> From: Eran Ben Elisha <eranbe@mellanox.com> >> >> NIC driver minimal MTU size shall be set to ETH_MIN_MTU, as defined in >> the RFC791 and in the network stack. Remove old mlx4_en only define for >> it, which was set to wrong value. > ... >> >> - /* MTU range: 46 - hw-specific max */ >> - dev->min_mtu = MLX4_EN_MIN_MTU; >> + /* MTU range: 68 - hw-specific max */ >> + dev->min_mtu = ETH_MIN_MTU; >> dev->max_mtu = priv->max_mtu; > > Where does 68 come from? Min IPv4 MTU per RFC791 > The minimum size of an ethernet packet including the mac addresses > and CRC is 64 bytes - but that would never be an 'mtu'. > > Since 64 - 46 = 18, the 46 probably excludes both MAC addresses, > the ethertype/length and the CRC. > This is 'sort of' the minimum mtu for an ethernet frame. > > I'm not sure which values are supposed to be in dev->min/max_mtu. I am not sure we really care, only syzkaller can possibly.
From: Eric Dumazet > Sent: 04 December 2018 17:04 > > On 12/04/2018 08:59 AM, David Laight wrote: > > From: Tariq Toukan > >> Sent: 02 December 2018 12:35 > >> From: Eran Ben Elisha <eranbe@mellanox.com> > >> > >> NIC driver minimal MTU size shall be set to ETH_MIN_MTU, as defined in > >> the RFC791 and in the network stack. Remove old mlx4_en only define for > >> it, which was set to wrong value. > > ... > >> > >> - /* MTU range: 46 - hw-specific max */ > >> - dev->min_mtu = MLX4_EN_MIN_MTU; > >> + /* MTU range: 68 - hw-specific max */ > >> + dev->min_mtu = ETH_MIN_MTU; > >> dev->max_mtu = priv->max_mtu; > > > > Where does 68 come from? > > Min IPv4 MTU per RFC791 Which has nothing to do with an ethernet driver. Indeed, IIRC, it is the smallest maximum frame size that IPv4 can work over. David - Registered Address Lakeside, Bramley Road, Mount Farm, Milton Keynes, MK1 1PT, UK Registration No: 1397386 (Wales)
From: Eric Dumazet > Sent: 04 December 2018 17:04 > On 12/04/2018 08:59 AM, David Laight wrote: > > From: Tariq Toukan > >> Sent: 02 December 2018 12:35 > >> From: Eran Ben Elisha <eranbe@mellanox.com> > >> > >> NIC driver minimal MTU size shall be set to ETH_MIN_MTU, as defined in > >> the RFC791 and in the network stack. Remove old mlx4_en only define for > >> it, which was set to wrong value. > > ... > >> > >> - /* MTU range: 46 - hw-specific max */ > >> - dev->min_mtu = MLX4_EN_MIN_MTU; > >> + /* MTU range: 68 - hw-specific max */ > >> + dev->min_mtu = ETH_MIN_MTU; > >> dev->max_mtu = priv->max_mtu; > > > > Where does 68 come from? > > Min IPv4 MTU per RFC791 Maybe I'm just confused and these are the ranges that the 'maximum mtu' can be set to. David - Registered Address Lakeside, Bramley Road, Mount Farm, Milton Keynes, MK1 1PT, UK Registration No: 1397386 (Wales)
On Tue, Dec 4, 2018 at 9:06 AM Eric Dumazet <eric.dumazet@gmail.com> wrote: > > > > On 12/04/2018 08:59 AM, David Laight wrote: > > Where does 68 come from? > > Min IPv4 MTU per RFC791 > What's wrong with using IPV4_MIN_MTU instead of 68 even in just comment?
diff --git a/drivers/net/ethernet/mellanox/mlx4/en_netdev.c b/drivers/net/ethernet/mellanox/mlx4/en_netdev.c index b744cd49a785..6b88881b8e35 100644 --- a/drivers/net/ethernet/mellanox/mlx4/en_netdev.c +++ b/drivers/net/ethernet/mellanox/mlx4/en_netdev.c @@ -3493,8 +3493,8 @@ int mlx4_en_init_netdev(struct mlx4_en_dev *mdev, int port, dev->gso_partial_features = NETIF_F_GSO_UDP_TUNNEL_CSUM; } - /* MTU range: 46 - hw-specific max */ - dev->min_mtu = MLX4_EN_MIN_MTU; + /* MTU range: 68 - hw-specific max */ + dev->min_mtu = ETH_MIN_MTU; dev->max_mtu = priv->max_mtu; mdev->pndev[port] = dev; diff --git a/drivers/net/ethernet/mellanox/mlx4/mlx4_en.h b/drivers/net/ethernet/mellanox/mlx4/mlx4_en.h index 485d856546c6..8137454e2534 100644 --- a/drivers/net/ethernet/mellanox/mlx4/mlx4_en.h +++ b/drivers/net/ethernet/mellanox/mlx4/mlx4_en.h @@ -161,7 +161,6 @@ #define MLX4_SELFTEST_LB_MIN_MTU (MLX4_LOOPBACK_TEST_PAYLOAD + NET_IP_ALIGN + \ ETH_HLEN + PREAMBLE_LEN) -#define MLX4_EN_MIN_MTU 46 /* VLAN_HLEN is added twice,to support skb vlan tagged with multiple * headers. (For example: ETH_P_8021Q and ETH_P_8021AD). */