Re: [PATCH net v2] net: dsa: tag_rtl4_a: Bump min packet size

From: Florian Fainelli
Date: Tue Oct 31 2023 - 12:23:11 EST


On 10/31/23 07:06, Linus Walleij wrote:
On Tue, Oct 31, 2023 at 1:37 AM Andrew Lunn <andrew@xxxxxxx> wrote:
On Tue, Oct 31, 2023 at 01:09:06AM +0200, Vladimir Oltean wrote:
On Mon, Oct 30, 2023 at 11:57:33PM +0100, Linus Walleij wrote:
This of course make no sense, since the padding function should do nothing
when the packet is bigger than 60 bytes.

Indeed, this of course makes no sense. Ping doesn't work, or ARP doesn't
work? Could you add a static ARP entry for the 192.168.1.137 IP address?

Probably the ARP, since they are short packets and probably need the
padding.

It seems correct: the reason ping stops working is not that the ping
isn't reaching the host, I can see the pin request on tcpdumps.

The reason is that the host has no idea where to send the reply.
Because it's not getting any ARP replies.

And that is probably because the ARP replies are short and needs
padding to ETH_ZLEN.

I notice the code is probably borrowed from tag_brcm.c which does
exactly the same thing (ETH_ZLEN + tag). It comes with this
explanation:

/* The Ethernet switch we are interfaced with needs packets to
be at
* least 64 bytes (including FCS) otherwise they will be
discarded when
* they enter the switch port logic. When Broadcom tags are
enabled, we
* need to make sure that packets are at least 68 bytes
* (including FCS and tag) because the length verification is
done after
* the Broadcom tag is stripped off the ingress packet.
*
* Let dsa_slave_xmit() free the SKB
*/

The switch fabric is dropping smaller packets when CPU tags
(DSA tags) are enabled.

So is the padding to ETH_ZLEN OK or should is happen elsewhere?

This is OK IMHO because you may not always have knowledge of which Ethernet MAC the switch is interfaced with, and with the tagger code, you have a central location to address them all.

The padding should ideally be done by the Ethernet MAC, even better when the HW can do it on its own (as it should), because whether there is a switch or not, no link partner should accept runt packets (some might but this is not standard).
--
Florian