From: "Russell King (Oracle)" <linux@armlinux.org.uk>
To: Vladimir Oltean <olteanv@gmail.com>
Cc: Lukasz Majewski <lukma@denx.de>, Andrew Lunn <andrew@lunn.ch>,
Eric Dumazet <edumazet@google.com>,
Florian Fainelli <f.fainelli@gmail.com>,
"David S. Miller" <davem@davemloft.net>,
Jakub Kicinski <kuba@kernel.org>, Paolo Abeni <pabeni@redhat.com>,
Alexander Duyck <alexander.duyck@gmail.com>,
netdev@vger.kernel.org, linux-kernel@vger.kernel.org
Subject: Re: [PATCH 1/7] dsa: marvell: Provide per device information about max frame size
Date: Fri, 10 Mar 2023 14:04:39 +0000 [thread overview]
Message-ID: <ZAs492RCZcz6oyW7@shell.armlinux.org.uk> (raw)
In-Reply-To: <20230310120235.2cjxauvqxyei45li@skbuf>
On Fri, Mar 10, 2023 at 02:02:35PM +0200, Vladimir Oltean wrote:
> It would be good if the commit message contained the procedure based on
> which you had made these changes - and preferably they were mechanical.
> Having a small C program written would be absolutely ideal.
> This is so that reviewers wouldn't have to do it in parallel...
>
> My analysis has determined the following 3 categories:
>
> static int mv88e6xxx_get_max_mtu(struct dsa_switch *ds, int port)
> {
> struct mv88e6xxx_chip *chip = ds->priv;
>
> if (chip->info->ops->port_set_jumbo_size)
> return 10240 - VLAN_ETH_HLEN - EDSA_HLEN - ETH_FCS_LEN; // 10210
> else if (chip->info->ops->set_max_frame_size)
> return 1632 - VLAN_ETH_HLEN - EDSA_HLEN - ETH_FCS_LEN; // 1602
> return 1522 - VLAN_ETH_HLEN - EDSA_HLEN - ETH_FCS_LEN; // 1492
The question concerning the 1492 MTU (and the others above) is
something that does need to be addressed, but I don't believe it
should be part of this patch series.
In order to properly address this, we need to do a bit of research.
Originally, the driver calculated the MTU by taking the frame size
(1522, 1632 or 10240) and subtracting VLAN_ETH_HLEN and ETH_FCS_LEN.
This would mean the frame sizes were 1500, 1610 and 10218. However,
as a result of:
commit b9c587fed61cf88bd45822c3159644445f6d5aa6
Author: Andrew Lunn <andrew@lunn.ch>
Date: Sun Sep 26 19:41:26 2021 +0200
dsa: mv88e6xxx: Include tagger overhead when setting MTU for DSA and CPU ports
This was changed to include the EDSA_HLEN of 8 bytes. The question
is why - and that's a question for Andrew.
The frame size check is not well described looking at the 6176
functional specification. It takes about using an adjusted frame
size in the paragraph that talks about ingress headers, but then
it only takes about adjusting by two bytes which are sent before
the DA, only if MV88E6XXX_PORT_CTL0_HEADER is set (which we don't
touch).
Against the bits that control the maximum frame size, it does state
that "the definition of frame size is counting the frame bytes from
MAC-DA through Layer2 CRC of the frame".
No mention is made whether the EDSA header is included or not, the
assumption was that it wasn't prior to the commit above, but it
would appear that caused a problem, so the EDSA header was added.
Now, obviously, on external ports (those which don't use the EDSA
header) the EDSA header doesn't restrict the size of packets sent
or received on that port. However, the header does exist on the
CPU port - and the obvious question is, does the max frame size
apply, and if so does it apply with the EDSA header included or
excluded. We don't know from the documentation.
DSA ports (those between switches) don't use the EDSA header, but
instead use the DSA header which is four bytes long. Again, whether
that is included in the maximum frame size is unspecified.
Maybe Andrew has some input here as he made the above commit and
can remember why it was necessary.
However, to me, it seems to be rather absurd as it would mean that
on a device that only supports 1522 maximum packet size, the CPU
port using an EDSA header would be incapable of sending or
receiving a packet containing 1500 bytes of payload, VLAN header
and ethernet header, because as soon as the EDSA header is added
we're over the 1522 limit - and that would basically mean the
switch can't be used in a normal ethernet network to switch
such packets.
--
RMK's Patch system: https://www.armlinux.org.uk/developer/patches/
FTTP is here! 40Mbps down 10Mbps up. Decent connectivity at last!
next prev parent reply other threads:[~2023-03-10 14:05 UTC|newest]
Thread overview: 36+ messages / expand[flat|nested] mbox.gz Atom feed top
2023-03-09 12:54 [PATCH 0/7] dsa: marvell: Add support for mv88e6071 and 6020 switches Lukasz Majewski
2023-03-09 12:54 ` [PATCH 1/7] dsa: marvell: Provide per device information about max frame size Lukasz Majewski
2023-03-10 12:02 ` Vladimir Oltean
2023-03-10 12:25 ` Russell King (Oracle)
2023-03-10 13:04 ` Vladimir Oltean
2023-03-10 13:06 ` Vladimir Oltean
2023-03-10 13:17 ` Lukasz Majewski
2023-03-10 13:36 ` Vladimir Oltean
2023-03-10 14:10 ` Lukasz Majewski
2023-03-10 15:45 ` Vladimir Oltean
2023-03-10 16:12 ` Andrew Lunn
2023-03-12 15:55 ` Lukasz Majewski
2023-03-13 15:01 ` Vladimir Oltean
2023-03-10 14:04 ` Russell King (Oracle) [this message]
2023-03-09 12:54 ` [PATCH 2/7] net: dsa: mv88e6xxx: add support for MV88E6020 switch Lukasz Majewski
2023-03-10 14:23 ` Vladimir Oltean
2023-03-09 12:54 ` [PATCH 3/7] net: dsa: mv88e6xxx: add support for MV88E6071 switch Lukasz Majewski
2023-03-09 12:54 ` [PATCH 4/7] dsa: marvell: Define .set_max_frame_size() function for mv88e6250 SoC family Lukasz Majewski
2023-03-09 12:54 ` [PATCH 5/7] dsa: marvell: Add helper function to validate the max_frame_size variable Lukasz Majewski
2023-03-09 13:21 ` Russell King (Oracle)
2023-03-09 13:26 ` Russell King (Oracle)
2023-03-09 13:47 ` Lukasz Majewski
2023-03-09 13:52 ` Vladimir Oltean
2023-03-09 13:57 ` Lukasz Majewski
2023-03-09 12:54 ` [PATCH 6/7] dsa: marvell: Correct value of max_frame_size variable after validation Lukasz Majewski
2023-03-09 14:05 ` Russell King (Oracle)
2023-03-09 14:43 ` Lukasz Majewski
2023-03-09 15:31 ` Russell King (Oracle)
2023-03-10 9:47 ` Lukasz Majewski
2023-03-09 15:42 ` Andrew Lunn
2023-03-10 11:53 ` Lukasz Majewski
2023-03-10 12:06 ` Russell King (Oracle)
2023-03-10 13:19 ` Lukasz Majewski
2023-03-10 15:25 ` Vladimir Oltean
2023-03-09 12:54 ` [PATCH 7/7] dsa: marvell: Modify get max MTU callback to use per switch provided value Lukasz Majewski
2023-04-03 11:55 ` [PATCH 0/7] dsa: marvell: Add support for mv88e6071 and 6020 switches Vladimir Oltean
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=ZAs492RCZcz6oyW7@shell.armlinux.org.uk \
--to=linux@armlinux.org.uk \
--cc=alexander.duyck@gmail.com \
--cc=andrew@lunn.ch \
--cc=davem@davemloft.net \
--cc=edumazet@google.com \
--cc=f.fainelli@gmail.com \
--cc=kuba@kernel.org \
--cc=linux-kernel@vger.kernel.org \
--cc=lukma@denx.de \
--cc=netdev@vger.kernel.org \
--cc=olteanv@gmail.com \
--cc=pabeni@redhat.com \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).