net: ibm: emac: Reserve VLAN header in MJS limit
Subsystems (2)
PATCH 1/1 net: ibm: emac: Reserve VLAN header in MJS limit
The IBM EMAC programs its Maximum Jumbo Size (MJS) drop threshold from ndev->mtu directly. The hardware sizes the threshold against the L2 frame minus the ethernet header, but does not discount the 802.1Q tag, so a frame carrying a VLAN tag and a full 1500-byte payload exceeds MJS by exactly 4 bytes and is dropped.
This is normally hidden because JPSM (and therefore the MJS check) only engages when the MTU is raised above ETH_DATA_LEN. With the qca8k DSA tagger the conduit MTU is bumped by QCA_HDR_LEN to 1502 during dsa_conduit_setup(), which is enough to enable JPSM and expose the off-by-VLAN-tag in the limit.
Pad MJS by VLAN_HLEN so a VLAN-tagged full-MTU frame passes.
Reported on Meraki MX60 (qca8k switch): tagged VLAN traffic drops at 1500-byte payload, while 1496 bytes works and untagged 1500 bytes works.
--- drivers/net/ethernet/ibm/emac/core.c | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-)
drivers/net/ethernet/ibm/emac/core.c +2 -1
@@ -30,6 +30,7 @@#include <linux/skbuff.h> #include <linux/crc32.h> #include <linux/ethtool.h> +#include <linux/if_vlan.h> #include <linux/mii.h> #include <linux/bitops.h> #include <linux/of.h>
@@ -457,7 +458,7 @@ static inline u32 emac_iff2rmr(struct net_device *ndev)if (emac_has_feature (dev,EMAC_APM821XX_REQ_JUMBO_FRAME_SIZE )) { r &= ~EMAC4_RMR_MJS_MASK ; - r |=EMAC4_RMR_MJS (ndev->mtu); + r |=EMAC4_RMR_MJS (ndev->mtu +VLAN_HLEN ); }return r;
Signature · 1 line
2.54.0
Quoted 12 lines · Rosen Penev
The IBM EMAC programs its Maximum Jumbo Size (MJS) drop threshold from
ndev->mtudirectly. The hardware sizes the threshold against the L2 frame minus the ethernet header, but does not discount the 802.1Q tag, so a frame carrying a VLAN tag and a full 1500-byte payload exceeds MJS by exactly 4 bytes and is dropped.This is normally hidden because JPSM (and therefore the MJS check) only engages when the MTU is raised above
ETH_DATA_LEN. With the qca8k DSA tagger the conduit MTU is bumped byQCA_HDR_LENto 1502 duringdsa_conduit_setup(), which is enough to enable JPSM and expose the off-by-VLAN-tag in the limit.
Quoted 8 lines
Pad MJS by
VLAN_HLENso a VLAN-tagged full-MTU frame passes.Reported on Meraki MX60 (qca8k switch): tagged VLAN traffic drops at 1500-byte payload, while 1496 bytes works and untagged 1500 bytes works.
Assisted-by Claude:Opus-4.7Signed-off-by Rosen Penev <[email protected]>
If this results in dropped packets, that seems like a user visible bug.. Should this have a Fixes tag and target the net-next tree? I guess its not a "regression" since the driver has always behaved this way, but it still seems like a bug to me.
Quoted 25 lines
--- drivers/net/ethernet/ibm/emac/core.c | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-)drivers/net/ethernet/ibm/emac/core.c +2
-1@@ -30,6 +30,7 @@#include <linux/skbuff.h> #include <linux/crc32.h> #include <linux/ethtool.h> +#include <linux/if_vlan.h> #include <linux/mii.h> #include <linux/bitops.h> #include <linux/of.h> @@ -457,7 +458,7 @@ static inline u32 emac_iff2rmr(struct net_device *ndev)if (emac_has_feature (dev,EMAC_APM821XX_REQ_JUMBO_FRAME_SIZE )) { r &= ~EMAC4_RMR_MJS_MASK ; - r |=EMAC4_RMR_MJS (ndev->mtu); + r |=EMAC4_RMR_MJS (ndev->mtu +VLAN_HLEN ); }return r;
Quoted 20 lines · Jacob Keller
Quoted 18 lines · Rosen Penev
The IBM EMAC programs its Maximum Jumbo Size (MJS) drop threshold from
ndev->mtudirectly. The hardware sizes the threshold against the L2 frame minus the ethernet header, but does not discount the 802.1Q tag, so a frame carrying a VLAN tag and a full 1500-byte payload exceeds MJS by exactly 4 bytes and is dropped.This is normally hidden because JPSM (and therefore the MJS check) only engages when the MTU is raised above
ETH_DATA_LEN. With the qca8k DSA tagger the conduit MTU is bumped byQCA_HDR_LENto 1502 duringdsa_conduit_setup(), which is enough to enable JPSM and expose the off-by-VLAN-tag in the limit.Pad MJS by
VLAN_HLENso a VLAN-tagged full-MTU frame passes.Reported on Meraki MX60 (qca8k switch): tagged VLAN traffic drops at 1500-byte payload, while 1496 bytes works and untagged 1500 bytes works.
Quoted 7 lines
Quoted 2 lines
Assisted-by Claude:Opus-4.7Signed-off-by Rosen Penev <[email protected]>If this results in dropped packets, that seems like a user visible bug.. Should this have a Fixes tag and target the net-next tree? I guess its not a "regression" since the driver has always behaved this way, but it still seems like a bug to me.
Good question. This bug is because of DSA. When this driver was written, DSA didn't exist.
net instead of net-next makes sense but it's not my call to make.
Trivia: downstream OpenWrt used its own downstream switching mechanism called swconfig. Before I transitioned this device to DSA, it worked fine. After DSA it started to fail on tagged VLAN.
Quoted 27 lines
Quoted 26 lines
--- drivers/net/ethernet/ibm/emac/core.c | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-)drivers/net/ethernet/ibm/emac/core.c +2
-1@@ -30,6 +30,7 @@#include <linux/skbuff.h> #include <linux/crc32.h> #include <linux/ethtool.h> +#include <linux/if_vlan.h> #include <linux/mii.h> #include <linux/bitops.h> #include <linux/of.h> @@ -457,7 +458,7 @@ static inline u32 emac_iff2rmr(struct net_device *ndev)if (emac_has_feature (dev,EMAC_APM821XX_REQ_JUMBO_FRAME_SIZE )) { r &= ~EMAC4_RMR_MJS_MASK ; - r |=EMAC4_RMR_MJS (ndev->mtu); + r |=EMAC4_RMR_MJS (ndev->mtu +VLAN_HLEN ); }return r;
Paolo Abeni
maintainerQuoted 19 lines · Jacob Keller
Quoted 18 lines · Rosen Penev
The IBM EMAC programs its Maximum Jumbo Size (MJS) drop threshold from
ndev->mtudirectly. The hardware sizes the threshold against the L2 frame minus the ethernet header, but does not discount the 802.1Q tag, so a frame carrying a VLAN tag and a full 1500-byte payload exceeds MJS by exactly 4 bytes and is dropped.This is normally hidden because JPSM (and therefore the MJS check) only engages when the MTU is raised above
ETH_DATA_LEN. With the qca8k DSA tagger the conduit MTU is bumped byQCA_HDR_LENto 1502 duringdsa_conduit_setup(), which is enough to enable JPSM and expose the off-by-VLAN-tag in the limit.Pad MJS by
VLAN_HLENso a VLAN-tagged full-MTU frame passes.Reported on Meraki MX60 (qca8k switch): tagged VLAN traffic drops at 1500-byte payload, while 1496 bytes works and untagged 1500 bytes works.
Quoted 7 lines
Quoted 2 lines
Assisted-by Claude:Opus-4.7Signed-off-by Rosen Penev <[email protected]>If this results in dropped packets, that seems like a user visible bug.. Should this have a Fixes tag and target the net-next tree? I guess its not a "regression" since the driver has always behaved this way, but it still seems like a bug to me.
Given it never worked and we are trying to keep the amount of changes into net under control, I tend to consider this suitable for net-next i.e. enable DSA support.
/P
This patch was applied to netdev/net-next.git (main) by Paolo Abeni <[email protected]>:
Hello:
This patch was applied to netdev/net-next.git (main) by Paolo Abeni <[email protected]>:
Quoted 6 lines · On Tue, 26 May 2026 13:22:47 -0700 you wrote:
The IBM EMAC programs its Maximum Jumbo Size (MJS) drop threshold from
ndev->mtudirectly. The hardware sizes the threshold against the L2 frame minus the ethernet header, but does not discount the 802.1Q tag, so a frame carrying a VLAN tag and a full 1500-byte payload exceeds MJS by exactly 4 bytes and is dropped.
Quoted 7 lines
This is normally hidden because JPSM (and therefore the MJS check) only engages when the MTU is raised above
ETH_DATA_LEN. With the qca8k DSA tagger the conduit MTU is bumped byQCA_HDR_LENto 1502 duringdsa_conduit_setup(), which is enough to enable JPSM and expose the off-by-VLAN-tag in the limit.[...]
Here is the summary with links:
- [net-next] net: ibm: emac: Reserve VLAN header in MJS limit
https://git.kernel.org/netdev/net-next/c/0906c117f81c
You are awesome, thank you!
Signature · 2 lines
Deet-doot-dot, I am a bot. https://korg.docs.kernel.org/patchwork/pwbot.html
Jacob Keller
Reviewed-byQuoted 28 lines · Paolo Abeni
Quoted 19 lines · Jacob Keller
Quoted 18 lines · Rosen Penev
The IBM EMAC programs its Maximum Jumbo Size (MJS) drop threshold from
ndev->mtudirectly. The hardware sizes the threshold against the L2 frame minus the ethernet header, but does not discount the 802.1Q tag, so a frame carrying a VLAN tag and a full 1500-byte payload exceeds MJS by exactly 4 bytes and is dropped.This is normally hidden because JPSM (and therefore the MJS check) only engages when the MTU is raised above
ETH_DATA_LEN. With the qca8k DSA tagger the conduit MTU is bumped byQCA_HDR_LENto 1502 duringdsa_conduit_setup(), which is enough to enable JPSM and expose the off-by-VLAN-tag in the limit.Pad MJS by
VLAN_HLENso a VLAN-tagged full-MTU frame passes.Reported on Meraki MX60 (qca8k switch): tagged VLAN traffic drops at 1500-byte payload, while 1496 bytes works and untagged 1500 bytes works.
Quoted 7 lines
Quoted 2 lines
Assisted-by Claude:Opus-4.7Signed-off-by Rosen Penev <[email protected]>If this results in dropped packets, that seems like a user visible bug.. Should this have a Fixes tag and target the net-next tree? I guess its not a "regression" since the driver has always behaved this way, but it still seems like a bug to me.
Quoted 6 lines
Given it never worked and we are trying to keep the amount of changes into net under control, I tend to consider this suitable for net-next i.e. enable DSA support.
/P
Makes sense.