OSDN Git Service

net: ftmac100: allow increasing MTU to make most use of single-segment buffers
authorSergei Antonov <saproj@gmail.com>
Fri, 28 Oct 2022 18:32:20 +0000 (21:32 +0300)
committerJakub Kicinski <kuba@kernel.org>
Tue, 1 Nov 2022 03:02:57 +0000 (20:02 -0700)
commit37c8489012dd9e830f2138ef6f2f52dc60ff944c
tree35ab8d5a3a4621714451adea4cf06573177f584a
parent30f837b7b92394599ddc366ff4cf8b77d070d4f4
net: ftmac100: allow increasing MTU to make most use of single-segment buffers

If the FTMAC100 is used as a DSA master, then it is expected that frames
which are MTU sized on the wire facing the external switch port (1500
octets in L2 payload, plus L2 header) also get a DSA tag when seen by
the host port.

This extra tag increases the length of the packet as the host port sees
it, and the FTMAC100 is not prepared to handle frames whose length
exceeds 1518 octets (including FCS) at all.

Only a minimal rework is needed to support this configuration. Since
MTU-sized DSA-tagged frames still fit within a single buffer (RX_BUF_SIZE),
we just need to optimize the resource management rather than implement
multi buffer RX.

In ndo_change_mtu(), we toggle the FTMAC100_MACCR_RX_FTL bit to tell the
hardware to drop (or not) frames with an L2 payload length larger than
1500. We need to replicate the MACCR configuration in ftmac100_start_hw()
as well, since there is a hardware reset there which clears previous
settings.

The advantage of dynamically changing FTMAC100_MACCR_RX_FTL is that when
dev->mtu is at the default value of 1500, large frames are automatically
dropped in hardware and we do not spend CPU cycles dropping them.

Suggested-by: Vladimir Oltean <vladimir.oltean@nxp.com>
Signed-off-by: Sergei Antonov <saproj@gmail.com>
Link: https://lore.kernel.org/r/20221028183220.155948-3-saproj@gmail.com
Signed-off-by: Jakub Kicinski <kuba@kernel.org>
drivers/net/ethernet/faraday/ftmac100.c