[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <Y7M+mWMU+DJPYubp@lunn.ch>
Date: Mon, 2 Jan 2023 21:29:13 +0100
From: Andrew Lunn <andrew@...n.ch>
To: Lukasz Majewski <lukma@...x.de>
Cc: Vladimir Oltean <olteanv@...il.com>,
Eric Dumazet <edumazet@...gle.com>,
Florian Fainelli <f.fainelli@...il.com>,
"David S. Miller" <davem@...emloft.net>,
Jakub Kicinski <kuba@...nel.org>,
Russell King <linux@...linux.org.uk>,
Paolo Abeni <pabeni@...hat.com>,
Alexander Duyck <alexander.duyck@...il.com>,
netdev@...r.kernel.org, linux-kernel@...r.kernel.org
Subject: Re: [PATCH v3 1/3] dsa: marvell: Provide per device information
about max frame size
> @@ -3548,7 +3548,9 @@ static int mv88e6xxx_get_max_mtu(struct dsa_switch *ds, int port)
> if (chip->info->ops->port_set_jumbo_size)
> return 10240 - VLAN_ETH_HLEN - EDSA_HLEN - ETH_FCS_LEN;
> else if (chip->info->ops->set_max_frame_size)
> - return 1632 - VLAN_ETH_HLEN - EDSA_HLEN - ETH_FCS_LEN;
> + return (max_t(int, chip->info->max_frame_size, 1632)
> + - VLAN_ETH_HLEN - EDSA_HLEN - ETH_FCS_LEN);
> +
> return 1522 - VLAN_ETH_HLEN - EDSA_HLEN - ETH_FCS_LEN;
I would also prefer if all this if/else logic is removed, and the code
simply returned chip->info->max_frame_size - VLAN_ETH_HLEN - EDSA_HLEN - ETH_FCS_LEN;
> +++ b/drivers/net/dsa/mv88e6xxx/chip.h
> @@ -132,6 +132,7 @@ struct mv88e6xxx_info {
> unsigned int num_gpio;
> unsigned int max_vid;
> unsigned int max_sid;
> + unsigned int max_frame_size;
It might be worth adding a comment here what this value actually
represents. We don't want any mixups where the value already has the
frame checksum removed for example.
Andrew
Powered by blists - more mailing lists