* [PATCH net-next v2] net: stmmac: Programming sequence for VLAN packets with split header
@ 2024-10-16 23:43 Abhishek Chauhan
2024-10-17 14:25 ` Simon Horman
2024-10-22 11:00 ` patchwork-bot+netdevbpf
0 siblings, 2 replies; 3+ messages in thread
From: Abhishek Chauhan @ 2024-10-16 23:43 UTC (permalink / raw)
To: Alexandre Torgue, Jose Abreu, David S . Miller, Eric Dumazet,
Jakub Kicinski, Paolo Abeni, Maxime Coquelin, netdev, linux-stm32,
linux-arm-kernel, Andrew Halaney, Simon Horman, Ong, Boon Leong,
Mohammad Athari Bin Ismail, Wong Vee Khee, Tan Tee Min,
Jon Hunter
Cc: kernel
Currently reset state configuration of split header works fine for
non-tagged packets and we see no corruption in payload of any size
We need additional programming sequence with reset configuration to
handle VLAN tagged packets to avoid corruption in payload for packets
of size greater than 256 bytes.
Without this change ping application complains about corruption
in payload when the size of the VLAN packet exceeds 256 bytes.
With this change tagged and non-tagged packets of any size works fine
and there is no corruption seen.
Current configuration which has the issue for VLAN packet
----------------------------------------------------------
Split happens at the position at Layer 3 header
|MAC-DA|MAC-SA|Vlan Tag|Ether type|IP header|IP data|Rest of the payload|
2 bytes ^
|
With the fix we are making sure that the split happens now at
Layer 2 which is end of ethernet header and start of IP payload
Ip traffic split
-----------------
Bits which take care of this are SPLM and SPLOFST
SPLM = Split mode is set to Layer 2
SPLOFST = These bits indicate the value of offset from the beginning
of Length/Type field at which header split should take place when the
appropriate SPLM is selected. Reset value is 2bytes.
Un-tagged data (without VLAN)
|MAC-DA|MAC-SA|Ether type|IP header|IP data|Rest of the payload|
2bytes ^
|
Tagged data (with VLAN)
|MAC-DA|MAC-SA|VLAN Tag|Ether type|IP header|IP data|Rest of the payload|
2bytes ^
|
Non-IP traffic split such AV packet
------------------------------------
Bits which take care of this are
SAVE = Split AV Enable
SAVO = Split AV Offset, similar to SPLOFST but this is for AVTP
packets.
|Preamble|MAC-DA|MAC-SA|VLAN tag|Ether type|IEEE 1722 payload|CRC|
2bytes ^
|
Signed-off-by: Abhishek Chauhan <quic_abchauha@quicinc.com>
---
Changes since v1
- took care of comments from Simon on FIELD_PREP
- explained the details of l2 and l3 split as requested by Andrew
- Added folks from intel and Nvidia who disabled split header
need to check if they faced similar issues and if this fix
can help them too.
Changes since v0
- The reason for posting it on net-next is to enable this new feature.
drivers/net/ethernet/stmicro/stmmac/dwmac4.h | 5 +++++
drivers/net/ethernet/stmicro/stmmac/dwmac4_dma.c | 5 +++++
2 files changed, 10 insertions(+)
diff --git a/drivers/net/ethernet/stmicro/stmmac/dwmac4.h b/drivers/net/ethernet/stmicro/stmmac/dwmac4.h
index 93a78fd0737b..28fff6cab812 100644
--- a/drivers/net/ethernet/stmicro/stmmac/dwmac4.h
+++ b/drivers/net/ethernet/stmicro/stmmac/dwmac4.h
@@ -44,6 +44,7 @@
#define GMAC_MDIO_DATA 0x00000204
#define GMAC_GPIO_STATUS 0x0000020C
#define GMAC_ARP_ADDR 0x00000210
+#define GMAC_EXT_CFG1 0x00000238
#define GMAC_ADDR_HIGH(reg) (0x300 + reg * 8)
#define GMAC_ADDR_LOW(reg) (0x304 + reg * 8)
#define GMAC_L3L4_CTRL(reg) (0x900 + (reg) * 0x30)
@@ -284,6 +285,10 @@ enum power_event {
#define GMAC_HW_FEAT_DVLAN BIT(5)
#define GMAC_HW_FEAT_NRVF GENMASK(2, 0)
+/* MAC extended config 1 */
+#define GMAC_CONFIG1_SAVE_EN BIT(24)
+#define GMAC_CONFIG1_SPLM(v) FIELD_PREP(GENMASK(9, 8), v)
+
/* GMAC GPIO Status reg */
#define GMAC_GPO0 BIT(16)
#define GMAC_GPO1 BIT(17)
diff --git a/drivers/net/ethernet/stmicro/stmmac/dwmac4_dma.c b/drivers/net/ethernet/stmicro/stmmac/dwmac4_dma.c
index e0165358c4ac..7c895e0ae71f 100644
--- a/drivers/net/ethernet/stmicro/stmmac/dwmac4_dma.c
+++ b/drivers/net/ethernet/stmicro/stmmac/dwmac4_dma.c
@@ -526,6 +526,11 @@ static void dwmac4_enable_sph(struct stmmac_priv *priv, void __iomem *ioaddr,
value |= GMAC_CONFIG_HDSMS_256; /* Segment max 256 bytes */
writel(value, ioaddr + GMAC_EXT_CONFIG);
+ value = readl(ioaddr + GMAC_EXT_CFG1);
+ value |= GMAC_CONFIG1_SPLM(1); /* Split mode set to L2OFST */
+ value |= GMAC_CONFIG1_SAVE_EN; /* Enable Split AV mode */
+ writel(value, ioaddr + GMAC_EXT_CFG1);
+
value = readl(ioaddr + DMA_CHAN_CONTROL(dwmac4_addrs, chan));
if (en)
value |= DMA_CONTROL_SPH;
--
2.25.1
^ permalink raw reply related [flat|nested] 3+ messages in thread* Re: [PATCH net-next v2] net: stmmac: Programming sequence for VLAN packets with split header
2024-10-16 23:43 [PATCH net-next v2] net: stmmac: Programming sequence for VLAN packets with split header Abhishek Chauhan
@ 2024-10-17 14:25 ` Simon Horman
2024-10-22 11:00 ` patchwork-bot+netdevbpf
1 sibling, 0 replies; 3+ messages in thread
From: Simon Horman @ 2024-10-17 14:25 UTC (permalink / raw)
To: Abhishek Chauhan
Cc: Alexandre Torgue, Jose Abreu, David S . Miller, Eric Dumazet,
Jakub Kicinski, Paolo Abeni, Maxime Coquelin, netdev, linux-stm32,
linux-arm-kernel, Andrew Halaney, Ong, Boon Leong,
Mohammad Athari Bin Ismail, Wong Vee Khee, Tan Tee Min,
Jon Hunter, kernel
On Wed, Oct 16, 2024 at 04:43:13PM -0700, Abhishek Chauhan wrote:
> Currently reset state configuration of split header works fine for
> non-tagged packets and we see no corruption in payload of any size
>
> We need additional programming sequence with reset configuration to
> handle VLAN tagged packets to avoid corruption in payload for packets
> of size greater than 256 bytes.
>
> Without this change ping application complains about corruption
> in payload when the size of the VLAN packet exceeds 256 bytes.
>
> With this change tagged and non-tagged packets of any size works fine
> and there is no corruption seen.
>
> Current configuration which has the issue for VLAN packet
> ----------------------------------------------------------
>
> Split happens at the position at Layer 3 header
> |MAC-DA|MAC-SA|Vlan Tag|Ether type|IP header|IP data|Rest of the payload|
> 2 bytes ^
> |
>
> With the fix we are making sure that the split happens now at
> Layer 2 which is end of ethernet header and start of IP payload
>
> Ip traffic split
> -----------------
>
> Bits which take care of this are SPLM and SPLOFST
> SPLM = Split mode is set to Layer 2
> SPLOFST = These bits indicate the value of offset from the beginning
> of Length/Type field at which header split should take place when the
> appropriate SPLM is selected. Reset value is 2bytes.
>
> Un-tagged data (without VLAN)
> |MAC-DA|MAC-SA|Ether type|IP header|IP data|Rest of the payload|
> 2bytes ^
> |
>
> Tagged data (with VLAN)
> |MAC-DA|MAC-SA|VLAN Tag|Ether type|IP header|IP data|Rest of the payload|
> 2bytes ^
> |
>
> Non-IP traffic split such AV packet
> ------------------------------------
>
> Bits which take care of this are
> SAVE = Split AV Enable
> SAVO = Split AV Offset, similar to SPLOFST but this is for AVTP
> packets.
>
> |Preamble|MAC-DA|MAC-SA|VLAN tag|Ether type|IEEE 1722 payload|CRC|
> 2bytes ^
> |
>
> Signed-off-by: Abhishek Chauhan <quic_abchauha@quicinc.com>
> ---
> Changes since v1
> - took care of comments from Simon on FIELD_PREP
> - explained the details of l2 and l3 split as requested by Andrew
> - Added folks from intel and Nvidia who disabled split header
> need to check if they faced similar issues and if this fix
> can help them too.
>
> Changes since v0
> - The reason for posting it on net-next is to enable this new feature.
Reviewed-by: Simon Horman <horms@kernel.org>
^ permalink raw reply [flat|nested] 3+ messages in thread
* Re: [PATCH net-next v2] net: stmmac: Programming sequence for VLAN packets with split header
2024-10-16 23:43 [PATCH net-next v2] net: stmmac: Programming sequence for VLAN packets with split header Abhishek Chauhan
2024-10-17 14:25 ` Simon Horman
@ 2024-10-22 11:00 ` patchwork-bot+netdevbpf
1 sibling, 0 replies; 3+ messages in thread
From: patchwork-bot+netdevbpf @ 2024-10-22 11:00 UTC (permalink / raw)
To: Abhishek Chauhan
Cc: alexandre.torgue, joabreu, davem, edumazet, kuba, pabeni,
mcoquelin.stm32, netdev, linux-stm32, linux-arm-kernel, ahalaney,
horms, Ong, boon.leong.ong, mohammad.athari.ismail, vee.khee.wong,
tee.min.tan, jonathanh, kernel
Hello:
This patch was applied to netdev/net-next.git (main)
by Paolo Abeni <pabeni@redhat.com>:
On Wed, 16 Oct 2024 16:43:13 -0700 you wrote:
> Currently reset state configuration of split header works fine for
> non-tagged packets and we see no corruption in payload of any size
>
> We need additional programming sequence with reset configuration to
> handle VLAN tagged packets to avoid corruption in payload for packets
> of size greater than 256 bytes.
>
> [...]
Here is the summary with links:
- [net-next,v2] net: stmmac: Programming sequence for VLAN packets with split header
https://git.kernel.org/netdev/net-next/c/d10f1a4e44c3
You are awesome, thank you!
--
Deet-doot-dot, I am a bot.
https://korg.docs.kernel.org/patchwork/pwbot.html
^ permalink raw reply [flat|nested] 3+ messages in thread
end of thread, other threads:[~2024-10-22 11:00 UTC | newest]
Thread overview: 3+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2024-10-16 23:43 [PATCH net-next v2] net: stmmac: Programming sequence for VLAN packets with split header Abhishek Chauhan
2024-10-17 14:25 ` Simon Horman
2024-10-22 11:00 ` patchwork-bot+netdevbpf
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).