All of lore.kernel.org
 help / color / mirror / Atom feed
* [PATCH net v2 0/1] Prevent DSA tags from breaking COE
@ 2024-01-02 16:27 ` Romain Gantois
  0 siblings, 0 replies; 18+ messages in thread
From: Romain Gantois @ 2024-01-02 16:27 UTC (permalink / raw)
  To: Alexandre Torgue, Jose Abreu
  Cc: Romain Gantois, David S. Miller, Eric Dumazet, Jakub Kicinski,
	Paolo Abeni, Maxime Coquelin, Miquel Raynal, Maxime Chevallier,
	Sylvain Girard, Vladimir Oltean, Andrew Lunn, Pascal EBERHARD,
	Richard Tresidder, Linus Walleij, netdev, linux-stm32,
	linux-arm-kernel

Hello everyone,

This is the second version of my proposed fix for the stmmac checksum
offloading issue that has recently been reported.

significant changes in v2:
- replaced the stmmac_link_up-based fix with an ethertype check in the TX
  and RX hotpaths.

The Checksum Offloading Engine of some stmmac cores (e.g. DWMAC1000)
computes an incorrect checksum when presented with DSA-tagged packets. This
causes all TCP/UDP transfers to break when the stmmac device is connected
to the CPU port of a DSA switch.

I ran some tests using different tagging protocols with DSA_LOOP, and all
of the protocols that set a custom ethertype field in the MAC header caused
the checksum offload engine to ignore the tagged packets. On TX, this
caused packets to egress with incorrect checksums. On RX, these packets
were similarly ignored by the COE, yet the stmmac driver set
CHECKSUM_UNNECESSARY, wrongly assuming that their checksums had been
verified in hardware.

Version 2 of this patch series fixes this issue by checking ethertype
fields in both the TX and RX hotpaths of the stmmac driver. On TX, if a
non-IP ethertype is detected, the packet is checksummed in software.  On
RX, the same condition causes stmmac to avoid setting CHECKSUM_UNNECESSARY.

To measure the performance degradation to the TX/RX hotpaths, I did some
iperf3 runs with 512-byte unfragmented UDP packets.

measured degradation on TX: -670 pps (-2.9%) on RX: -485 pps (-1.7%)
original performances on TX: 22kpps on RX: 27kpps

The performance hit on the RX path can be partly explained by the fact that
the stmmac driver doesn't set CHECKSUM_UNNECESSARY anymore.

The slightly higher TX degradation is harder to explain but I should note
that the external PHYs used in my setup have been causing performance
issues on TX, which could be affecting the results.

Best Regards,

Romain

Romain Gantois (1):
  net: stmmac: Prevent DSA tags from breaking COE on stmmac

 .../net/ethernet/stmicro/stmmac/stmmac_main.c | 21 ++++++++++++++++---
 1 file changed, 18 insertions(+), 3 deletions(-)

-- 
2.43.0


^ permalink raw reply	[flat|nested] 18+ messages in thread

* [PATCH net v2 0/1] Prevent DSA tags from breaking COE
@ 2024-01-02 16:27 ` Romain Gantois
  0 siblings, 0 replies; 18+ messages in thread
From: Romain Gantois @ 2024-01-02 16:27 UTC (permalink / raw)
  To: Alexandre Torgue, Jose Abreu
  Cc: Romain Gantois, David S. Miller, Eric Dumazet, Jakub Kicinski,
	Paolo Abeni, Maxime Coquelin, Miquel Raynal, Maxime Chevallier,
	Sylvain Girard, Vladimir Oltean, Andrew Lunn, Pascal EBERHARD,
	Richard Tresidder, Linus Walleij, netdev, linux-stm32,
	linux-arm-kernel

Hello everyone,

This is the second version of my proposed fix for the stmmac checksum
offloading issue that has recently been reported.

significant changes in v2:
- replaced the stmmac_link_up-based fix with an ethertype check in the TX
  and RX hotpaths.

The Checksum Offloading Engine of some stmmac cores (e.g. DWMAC1000)
computes an incorrect checksum when presented with DSA-tagged packets. This
causes all TCP/UDP transfers to break when the stmmac device is connected
to the CPU port of a DSA switch.

I ran some tests using different tagging protocols with DSA_LOOP, and all
of the protocols that set a custom ethertype field in the MAC header caused
the checksum offload engine to ignore the tagged packets. On TX, this
caused packets to egress with incorrect checksums. On RX, these packets
were similarly ignored by the COE, yet the stmmac driver set
CHECKSUM_UNNECESSARY, wrongly assuming that their checksums had been
verified in hardware.

Version 2 of this patch series fixes this issue by checking ethertype
fields in both the TX and RX hotpaths of the stmmac driver. On TX, if a
non-IP ethertype is detected, the packet is checksummed in software.  On
RX, the same condition causes stmmac to avoid setting CHECKSUM_UNNECESSARY.

To measure the performance degradation to the TX/RX hotpaths, I did some
iperf3 runs with 512-byte unfragmented UDP packets.

measured degradation on TX: -670 pps (-2.9%) on RX: -485 pps (-1.7%)
original performances on TX: 22kpps on RX: 27kpps

The performance hit on the RX path can be partly explained by the fact that
the stmmac driver doesn't set CHECKSUM_UNNECESSARY anymore.

The slightly higher TX degradation is harder to explain but I should note
that the external PHYs used in my setup have been causing performance
issues on TX, which could be affecting the results.

Best Regards,

Romain

Romain Gantois (1):
  net: stmmac: Prevent DSA tags from breaking COE on stmmac

 .../net/ethernet/stmicro/stmmac/stmmac_main.c | 21 ++++++++++++++++---
 1 file changed, 18 insertions(+), 3 deletions(-)

-- 
2.43.0


_______________________________________________
linux-arm-kernel mailing list
linux-arm-kernel@lists.infradead.org
http://lists.infradead.org/mailman/listinfo/linux-arm-kernel

^ permalink raw reply	[flat|nested] 18+ messages in thread

* [PATCH net v2 1/1] net: stmmac: Prevent DSA tags from breaking COE on stmmac
  2024-01-02 16:27 ` Romain Gantois
@ 2024-01-02 16:27   ` Romain Gantois
  -1 siblings, 0 replies; 18+ messages in thread
From: Romain Gantois @ 2024-01-02 16:27 UTC (permalink / raw)
  To: Alexandre Torgue, Jose Abreu
  Cc: Romain Gantois, David S. Miller, Eric Dumazet, Jakub Kicinski,
	Paolo Abeni, Maxime Coquelin, Miquel Raynal, Maxime Chevallier,
	Sylvain Girard, Vladimir Oltean, Andrew Lunn, Pascal EBERHARD,
	Richard Tresidder, Linus Walleij, netdev, linux-stm32,
	linux-arm-kernel, stable

Some DSA tagging protocols change the EtherType field in the MAC header
e.g.  DSA_TAG_PROTO_(DSA/EDSA/BRCM/MTK/RTL4C_A/SJA1105). On TX these tagged
frames are ignored by the checksum offload engine and IP header checker of
some stmmac cores.

On RX, the stmmac driver wrongly assumes that checksums have been computed
for these tagged packets, and sets CHECKSUM_UNNECESSARY.

Add an additional check in the stmmac tx and rx hotpaths so that COE is
deactivated for packets with ethertypes that will not trigger the COE and
ip header checks.

Fixes: 6b2c6e4a938f ("net: stmmac: propagate feature flags to vlan")
Cc: stable@vger.kernel.org
Reported-by: Richard Tresidder <rtresidd@electromag.com.au>
Closes: https://lore.kernel.org/netdev/e5c6c75f-2dfa-4e50-a1fb-6bf4cdb617c2@electromag.com.au/
Reported-by: Romain Gantois <romain.gantois@bootlin.com>
Closes: https://lore.kernel.org/netdev/c57283ed-6b9b-b0e6-ee12-5655c1c54495@bootlin.com/
Signed-off-by: Romain Gantois <romain.gantois@bootlin.com>
---
 .../net/ethernet/stmicro/stmmac/stmmac_main.c | 21 ++++++++++++++++---
 1 file changed, 18 insertions(+), 3 deletions(-)

diff --git a/drivers/net/ethernet/stmicro/stmmac/stmmac_main.c b/drivers/net/ethernet/stmicro/stmmac/stmmac_main.c
index 37e64283f910..bb2ae6b32b2f 100644
--- a/drivers/net/ethernet/stmicro/stmmac/stmmac_main.c
+++ b/drivers/net/ethernet/stmicro/stmmac/stmmac_main.c
@@ -4371,6 +4371,17 @@ static netdev_tx_t stmmac_tso_xmit(struct sk_buff *skb, struct net_device *dev)
 	return NETDEV_TX_OK;
 }
 
+/* Check if ethertype will trigger IP
+ * header checks/COE in hardware
+ */
+static inline bool stmmac_has_ip_ethertype(struct sk_buff *skb)
+{
+	__be16 proto = eth_header_parse_protocol(skb);
+
+	return (proto == htons(ETH_P_IP)) || (proto == htons(ETH_P_IPV6)) ||
+		(proto == htons(ETH_P_8021Q));
+}
+
 /**
  *  stmmac_xmit - Tx entry point of the driver
  *  @skb : the socket buffer
@@ -4435,9 +4446,13 @@ static netdev_tx_t stmmac_xmit(struct sk_buff *skb, struct net_device *dev)
 	/* DWMAC IPs can be synthesized to support tx coe only for a few tx
 	 * queues. In that case, checksum offloading for those queues that don't
 	 * support tx coe needs to fallback to software checksum calculation.
+	 *
+	 * Packets that won't trigger the COE e.g. most DSA-tagged packets will
+	 * also have to be checksummed in software.
 	 */
 	if (csum_insertion &&
-	    priv->plat->tx_queues_cfg[queue].coe_unsupported) {
+	    (priv->plat->tx_queues_cfg[queue].coe_unsupported ||
+	    !stmmac_has_ip_ethertype(skb))) {
 		if (unlikely(skb_checksum_help(skb)))
 			goto dma_map_err;
 		csum_insertion = !csum_insertion;
@@ -4997,7 +5012,7 @@ static void stmmac_dispatch_skb_zc(struct stmmac_priv *priv, u32 queue,
 	stmmac_rx_vlan(priv->dev, skb);
 	skb->protocol = eth_type_trans(skb, priv->dev);
 
-	if (unlikely(!coe))
+	if (unlikely(!coe) || !stmmac_has_ip_ethertype(skb))
 		skb_checksum_none_assert(skb);
 	else
 		skb->ip_summed = CHECKSUM_UNNECESSARY;
@@ -5513,7 +5528,7 @@ static int stmmac_rx(struct stmmac_priv *priv, int limit, u32 queue)
 		stmmac_rx_vlan(priv->dev, skb);
 		skb->protocol = eth_type_trans(skb, priv->dev);
 
-		if (unlikely(!coe))
+		if (unlikely(!coe) || !stmmac_has_ip_ethertype(skb))
 			skb_checksum_none_assert(skb);
 		else
 			skb->ip_summed = CHECKSUM_UNNECESSARY;
-- 
2.43.0


^ permalink raw reply related	[flat|nested] 18+ messages in thread

* [PATCH net v2 1/1] net: stmmac: Prevent DSA tags from breaking COE on stmmac
@ 2024-01-02 16:27   ` Romain Gantois
  0 siblings, 0 replies; 18+ messages in thread
From: Romain Gantois @ 2024-01-02 16:27 UTC (permalink / raw)
  To: Alexandre Torgue, Jose Abreu
  Cc: Romain Gantois, David S. Miller, Eric Dumazet, Jakub Kicinski,
	Paolo Abeni, Maxime Coquelin, Miquel Raynal, Maxime Chevallier,
	Sylvain Girard, Vladimir Oltean, Andrew Lunn, Pascal EBERHARD,
	Richard Tresidder, Linus Walleij, netdev, linux-stm32,
	linux-arm-kernel, stable

Some DSA tagging protocols change the EtherType field in the MAC header
e.g.  DSA_TAG_PROTO_(DSA/EDSA/BRCM/MTK/RTL4C_A/SJA1105). On TX these tagged
frames are ignored by the checksum offload engine and IP header checker of
some stmmac cores.

On RX, the stmmac driver wrongly assumes that checksums have been computed
for these tagged packets, and sets CHECKSUM_UNNECESSARY.

Add an additional check in the stmmac tx and rx hotpaths so that COE is
deactivated for packets with ethertypes that will not trigger the COE and
ip header checks.

Fixes: 6b2c6e4a938f ("net: stmmac: propagate feature flags to vlan")
Cc: stable@vger.kernel.org
Reported-by: Richard Tresidder <rtresidd@electromag.com.au>
Closes: https://lore.kernel.org/netdev/e5c6c75f-2dfa-4e50-a1fb-6bf4cdb617c2@electromag.com.au/
Reported-by: Romain Gantois <romain.gantois@bootlin.com>
Closes: https://lore.kernel.org/netdev/c57283ed-6b9b-b0e6-ee12-5655c1c54495@bootlin.com/
Signed-off-by: Romain Gantois <romain.gantois@bootlin.com>
---
 .../net/ethernet/stmicro/stmmac/stmmac_main.c | 21 ++++++++++++++++---
 1 file changed, 18 insertions(+), 3 deletions(-)

diff --git a/drivers/net/ethernet/stmicro/stmmac/stmmac_main.c b/drivers/net/ethernet/stmicro/stmmac/stmmac_main.c
index 37e64283f910..bb2ae6b32b2f 100644
--- a/drivers/net/ethernet/stmicro/stmmac/stmmac_main.c
+++ b/drivers/net/ethernet/stmicro/stmmac/stmmac_main.c
@@ -4371,6 +4371,17 @@ static netdev_tx_t stmmac_tso_xmit(struct sk_buff *skb, struct net_device *dev)
 	return NETDEV_TX_OK;
 }
 
+/* Check if ethertype will trigger IP
+ * header checks/COE in hardware
+ */
+static inline bool stmmac_has_ip_ethertype(struct sk_buff *skb)
+{
+	__be16 proto = eth_header_parse_protocol(skb);
+
+	return (proto == htons(ETH_P_IP)) || (proto == htons(ETH_P_IPV6)) ||
+		(proto == htons(ETH_P_8021Q));
+}
+
 /**
  *  stmmac_xmit - Tx entry point of the driver
  *  @skb : the socket buffer
@@ -4435,9 +4446,13 @@ static netdev_tx_t stmmac_xmit(struct sk_buff *skb, struct net_device *dev)
 	/* DWMAC IPs can be synthesized to support tx coe only for a few tx
 	 * queues. In that case, checksum offloading for those queues that don't
 	 * support tx coe needs to fallback to software checksum calculation.
+	 *
+	 * Packets that won't trigger the COE e.g. most DSA-tagged packets will
+	 * also have to be checksummed in software.
 	 */
 	if (csum_insertion &&
-	    priv->plat->tx_queues_cfg[queue].coe_unsupported) {
+	    (priv->plat->tx_queues_cfg[queue].coe_unsupported ||
+	    !stmmac_has_ip_ethertype(skb))) {
 		if (unlikely(skb_checksum_help(skb)))
 			goto dma_map_err;
 		csum_insertion = !csum_insertion;
@@ -4997,7 +5012,7 @@ static void stmmac_dispatch_skb_zc(struct stmmac_priv *priv, u32 queue,
 	stmmac_rx_vlan(priv->dev, skb);
 	skb->protocol = eth_type_trans(skb, priv->dev);
 
-	if (unlikely(!coe))
+	if (unlikely(!coe) || !stmmac_has_ip_ethertype(skb))
 		skb_checksum_none_assert(skb);
 	else
 		skb->ip_summed = CHECKSUM_UNNECESSARY;
@@ -5513,7 +5528,7 @@ static int stmmac_rx(struct stmmac_priv *priv, int limit, u32 queue)
 		stmmac_rx_vlan(priv->dev, skb);
 		skb->protocol = eth_type_trans(skb, priv->dev);
 
-		if (unlikely(!coe))
+		if (unlikely(!coe) || !stmmac_has_ip_ethertype(skb))
 			skb_checksum_none_assert(skb);
 		else
 			skb->ip_summed = CHECKSUM_UNNECESSARY;
-- 
2.43.0


_______________________________________________
linux-arm-kernel mailing list
linux-arm-kernel@lists.infradead.org
http://lists.infradead.org/mailman/listinfo/linux-arm-kernel

^ permalink raw reply related	[flat|nested] 18+ messages in thread

* Re: [PATCH net v2 1/1] net: stmmac: Prevent DSA tags from breaking COE on stmmac
  2024-01-02 16:27   ` Romain Gantois
@ 2024-01-02 20:26     ` Florian Fainelli
  -1 siblings, 0 replies; 18+ messages in thread
From: Florian Fainelli @ 2024-01-02 20:26 UTC (permalink / raw)
  To: Romain Gantois, Alexandre Torgue, Jose Abreu
  Cc: David S. Miller, Eric Dumazet, Jakub Kicinski, Paolo Abeni,
	Maxime Coquelin, Miquel Raynal, Maxime Chevallier,
	Sylvain Girard, Vladimir Oltean, Andrew Lunn, Pascal EBERHARD,
	Richard Tresidder, Linus Walleij, netdev, linux-stm32,
	linux-arm-kernel, stable

On 1/2/24 08:27, Romain Gantois wrote:
> Some DSA tagging protocols change the EtherType field in the MAC header
> e.g.  DSA_TAG_PROTO_(DSA/EDSA/BRCM/MTK/RTL4C_A/SJA1105). On TX these tagged
> frames are ignored by the checksum offload engine and IP header checker of
> some stmmac cores.
> 
> On RX, the stmmac driver wrongly assumes that checksums have been computed
> for these tagged packets, and sets CHECKSUM_UNNECESSARY.
> 
> Add an additional check in the stmmac tx and rx hotpaths so that COE is
> deactivated for packets with ethertypes that will not trigger the COE and
> ip header checks.
> 
> Fixes: 6b2c6e4a938f ("net: stmmac: propagate feature flags to vlan")
> Cc: stable@vger.kernel.org
> Reported-by: Richard Tresidder <rtresidd@electromag.com.au>
> Closes: https://lore.kernel.org/netdev/e5c6c75f-2dfa-4e50-a1fb-6bf4cdb617c2@electromag.com.au/
> Reported-by: Romain Gantois <romain.gantois@bootlin.com>
> Closes: https://lore.kernel.org/netdev/c57283ed-6b9b-b0e6-ee12-5655c1c54495@bootlin.com/

Fairly sure those should be Link: and Closes: should be used for bug 
tracker entries.

> Signed-off-by: Romain Gantois <romain.gantois@bootlin.com>
> ---
>   .../net/ethernet/stmicro/stmmac/stmmac_main.c | 21 ++++++++++++++++---
>   1 file changed, 18 insertions(+), 3 deletions(-)
> 
> diff --git a/drivers/net/ethernet/stmicro/stmmac/stmmac_main.c b/drivers/net/ethernet/stmicro/stmmac/stmmac_main.c
> index 37e64283f910..bb2ae6b32b2f 100644
> --- a/drivers/net/ethernet/stmicro/stmmac/stmmac_main.c
> +++ b/drivers/net/ethernet/stmicro/stmmac/stmmac_main.c
> @@ -4371,6 +4371,17 @@ static netdev_tx_t stmmac_tso_xmit(struct sk_buff *skb, struct net_device *dev)
>   	return NETDEV_TX_OK;
>   }
>   
> +/* Check if ethertype will trigger IP
> + * header checks/COE in hardware
> + */
> +static inline bool stmmac_has_ip_ethertype(struct sk_buff *skb)
> +{
> +	__be16 proto = eth_header_parse_protocol(skb);
> +
> +	return (proto == htons(ETH_P_IP)) || (proto == htons(ETH_P_IPV6)) ||
> +		(proto == htons(ETH_P_8021Q));

Do you need to include ETH_P_8021AD in that list as well or is not 
stmmac capable of checksuming beyond a single VLAN tag?

Thanks!
-- 
Florian


^ permalink raw reply	[flat|nested] 18+ messages in thread

* Re: [PATCH net v2 1/1] net: stmmac: Prevent DSA tags from breaking COE on stmmac
@ 2024-01-02 20:26     ` Florian Fainelli
  0 siblings, 0 replies; 18+ messages in thread
From: Florian Fainelli @ 2024-01-02 20:26 UTC (permalink / raw)
  To: Romain Gantois, Alexandre Torgue, Jose Abreu
  Cc: David S. Miller, Eric Dumazet, Jakub Kicinski, Paolo Abeni,
	Maxime Coquelin, Miquel Raynal, Maxime Chevallier,
	Sylvain Girard, Vladimir Oltean, Andrew Lunn, Pascal EBERHARD,
	Richard Tresidder, Linus Walleij, netdev, linux-stm32,
	linux-arm-kernel, stable

On 1/2/24 08:27, Romain Gantois wrote:
> Some DSA tagging protocols change the EtherType field in the MAC header
> e.g.  DSA_TAG_PROTO_(DSA/EDSA/BRCM/MTK/RTL4C_A/SJA1105). On TX these tagged
> frames are ignored by the checksum offload engine and IP header checker of
> some stmmac cores.
> 
> On RX, the stmmac driver wrongly assumes that checksums have been computed
> for these tagged packets, and sets CHECKSUM_UNNECESSARY.
> 
> Add an additional check in the stmmac tx and rx hotpaths so that COE is
> deactivated for packets with ethertypes that will not trigger the COE and
> ip header checks.
> 
> Fixes: 6b2c6e4a938f ("net: stmmac: propagate feature flags to vlan")
> Cc: stable@vger.kernel.org
> Reported-by: Richard Tresidder <rtresidd@electromag.com.au>
> Closes: https://lore.kernel.org/netdev/e5c6c75f-2dfa-4e50-a1fb-6bf4cdb617c2@electromag.com.au/
> Reported-by: Romain Gantois <romain.gantois@bootlin.com>
> Closes: https://lore.kernel.org/netdev/c57283ed-6b9b-b0e6-ee12-5655c1c54495@bootlin.com/

Fairly sure those should be Link: and Closes: should be used for bug 
tracker entries.

> Signed-off-by: Romain Gantois <romain.gantois@bootlin.com>
> ---
>   .../net/ethernet/stmicro/stmmac/stmmac_main.c | 21 ++++++++++++++++---
>   1 file changed, 18 insertions(+), 3 deletions(-)
> 
> diff --git a/drivers/net/ethernet/stmicro/stmmac/stmmac_main.c b/drivers/net/ethernet/stmicro/stmmac/stmmac_main.c
> index 37e64283f910..bb2ae6b32b2f 100644
> --- a/drivers/net/ethernet/stmicro/stmmac/stmmac_main.c
> +++ b/drivers/net/ethernet/stmicro/stmmac/stmmac_main.c
> @@ -4371,6 +4371,17 @@ static netdev_tx_t stmmac_tso_xmit(struct sk_buff *skb, struct net_device *dev)
>   	return NETDEV_TX_OK;
>   }
>   
> +/* Check if ethertype will trigger IP
> + * header checks/COE in hardware
> + */
> +static inline bool stmmac_has_ip_ethertype(struct sk_buff *skb)
> +{
> +	__be16 proto = eth_header_parse_protocol(skb);
> +
> +	return (proto == htons(ETH_P_IP)) || (proto == htons(ETH_P_IPV6)) ||
> +		(proto == htons(ETH_P_8021Q));

Do you need to include ETH_P_8021AD in that list as well or is not 
stmmac capable of checksuming beyond a single VLAN tag?

Thanks!
-- 
Florian


_______________________________________________
linux-arm-kernel mailing list
linux-arm-kernel@lists.infradead.org
http://lists.infradead.org/mailman/listinfo/linux-arm-kernel

^ permalink raw reply	[flat|nested] 18+ messages in thread

* Re: [PATCH net v2 1/1] net: stmmac: Prevent DSA tags from breaking COE on stmmac
  2024-01-02 16:27   ` Romain Gantois
@ 2024-01-02 20:27     ` Linus Walleij
  -1 siblings, 0 replies; 18+ messages in thread
From: Linus Walleij @ 2024-01-02 20:27 UTC (permalink / raw)
  To: Romain Gantois
  Cc: Alexandre Torgue, Jose Abreu, David S. Miller, Eric Dumazet,
	Jakub Kicinski, Paolo Abeni, Maxime Coquelin, Miquel Raynal,
	Maxime Chevallier, Sylvain Girard, Vladimir Oltean, Andrew Lunn,
	Pascal EBERHARD, Richard Tresidder, netdev, linux-stm32,
	linux-arm-kernel, stable

Hi Romain,

overall this patch makes sense.

On Tue, Jan 2, 2024 at 5:27 PM Romain Gantois
<romain.gantois@bootlin.com> wrote:

> Some DSA tagging protocols change the EtherType field in the MAC header
> e.g.  DSA_TAG_PROTO_(DSA/EDSA/BRCM/MTK/RTL4C_A/SJA1105). On TX these tagged
> frames are ignored by the checksum offload engine and IP header checker of
> some stmmac cores.
>
> On RX, the stmmac driver wrongly assumes that checksums have been computed
> for these tagged packets, and sets CHECKSUM_UNNECESSARY.
>
> Add an additional check in the stmmac tx and rx hotpaths so that COE is
> deactivated for packets with ethertypes that will not trigger the COE and
> ip header checks.
>
> Fixes: 6b2c6e4a938f ("net: stmmac: propagate feature flags to vlan")
> Cc: stable@vger.kernel.org
> Reported-by: Richard Tresidder <rtresidd@electromag.com.au>
> Closes: https://lore.kernel.org/netdev/e5c6c75f-2dfa-4e50-a1fb-6bf4cdb617c2@electromag.com.au/
> Reported-by: Romain Gantois <romain.gantois@bootlin.com>
> Closes: https://lore.kernel.org/netdev/c57283ed-6b9b-b0e6-ee12-5655c1c54495@bootlin.com/
> Signed-off-by: Romain Gantois <romain.gantois@bootlin.com>
(...)

> +static inline bool stmmac_has_ip_ethertype(struct sk_buff *skb)
> +{
> +       __be16 proto = eth_header_parse_protocol(skb);

I made a new function for this in my patch
https://lore.kernel.org/netdev/20231222-new-gemini-ethernet-regression-v4-2-a36e71b0f32b@linaro.org/

I was careful to add if (!pskb_may_pull(skb, ETH_HLEN)) because Eric
was very specific about this, I suppose you could get fragment frames that
are smaller than an ethernet header.

I should use eth_header_parse_protocol() instead of reimplementing it
though. :/

Should we add an if (!pskb_may_pull(skb, ETH_HLEN)) to
eth_header_parse_protocol()?

Yours,
Linus Walleij

^ permalink raw reply	[flat|nested] 18+ messages in thread

* Re: [PATCH net v2 1/1] net: stmmac: Prevent DSA tags from breaking COE on stmmac
@ 2024-01-02 20:27     ` Linus Walleij
  0 siblings, 0 replies; 18+ messages in thread
From: Linus Walleij @ 2024-01-02 20:27 UTC (permalink / raw)
  To: Romain Gantois
  Cc: Alexandre Torgue, Jose Abreu, David S. Miller, Eric Dumazet,
	Jakub Kicinski, Paolo Abeni, Maxime Coquelin, Miquel Raynal,
	Maxime Chevallier, Sylvain Girard, Vladimir Oltean, Andrew Lunn,
	Pascal EBERHARD, Richard Tresidder, netdev, linux-stm32,
	linux-arm-kernel, stable

Hi Romain,

overall this patch makes sense.

On Tue, Jan 2, 2024 at 5:27 PM Romain Gantois
<romain.gantois@bootlin.com> wrote:

> Some DSA tagging protocols change the EtherType field in the MAC header
> e.g.  DSA_TAG_PROTO_(DSA/EDSA/BRCM/MTK/RTL4C_A/SJA1105). On TX these tagged
> frames are ignored by the checksum offload engine and IP header checker of
> some stmmac cores.
>
> On RX, the stmmac driver wrongly assumes that checksums have been computed
> for these tagged packets, and sets CHECKSUM_UNNECESSARY.
>
> Add an additional check in the stmmac tx and rx hotpaths so that COE is
> deactivated for packets with ethertypes that will not trigger the COE and
> ip header checks.
>
> Fixes: 6b2c6e4a938f ("net: stmmac: propagate feature flags to vlan")
> Cc: stable@vger.kernel.org
> Reported-by: Richard Tresidder <rtresidd@electromag.com.au>
> Closes: https://lore.kernel.org/netdev/e5c6c75f-2dfa-4e50-a1fb-6bf4cdb617c2@electromag.com.au/
> Reported-by: Romain Gantois <romain.gantois@bootlin.com>
> Closes: https://lore.kernel.org/netdev/c57283ed-6b9b-b0e6-ee12-5655c1c54495@bootlin.com/
> Signed-off-by: Romain Gantois <romain.gantois@bootlin.com>
(...)

> +static inline bool stmmac_has_ip_ethertype(struct sk_buff *skb)
> +{
> +       __be16 proto = eth_header_parse_protocol(skb);

I made a new function for this in my patch
https://lore.kernel.org/netdev/20231222-new-gemini-ethernet-regression-v4-2-a36e71b0f32b@linaro.org/

I was careful to add if (!pskb_may_pull(skb, ETH_HLEN)) because Eric
was very specific about this, I suppose you could get fragment frames that
are smaller than an ethernet header.

I should use eth_header_parse_protocol() instead of reimplementing it
though. :/

Should we add an if (!pskb_may_pull(skb, ETH_HLEN)) to
eth_header_parse_protocol()?

Yours,
Linus Walleij

_______________________________________________
linux-arm-kernel mailing list
linux-arm-kernel@lists.infradead.org
http://lists.infradead.org/mailman/listinfo/linux-arm-kernel

^ permalink raw reply	[flat|nested] 18+ messages in thread

* Re: [PATCH net v2 1/1] net: stmmac: Prevent DSA tags from breaking COE on stmmac
  2024-01-02 20:26     ` Florian Fainelli
@ 2024-01-03  8:40       ` Romain Gantois
  -1 siblings, 0 replies; 18+ messages in thread
From: Romain Gantois @ 2024-01-03  8:40 UTC (permalink / raw)
  To: Florian Fainelli
  Cc: Romain Gantois, Alexandre Torgue, Jose Abreu, David S. Miller,
	Eric Dumazet, Jakub Kicinski, Paolo Abeni, Maxime Coquelin,
	Miquel Raynal, Maxime Chevallier, Sylvain Girard,
	Vladimir Oltean, Andrew Lunn, Pascal EBERHARD, Richard Tresidder,
	Linus Walleij, netdev, linux-stm32, linux-arm-kernel, stable

Hi Florian,

On Tue, 2 Jan 2024, Florian Fainelli wrote:

...
> > Fixes: 6b2c6e4a938f ("net: stmmac: propagate feature flags to vlan")
> > Cc: stable@vger.kernel.org
> > Reported-by: Richard Tresidder <rtresidd@electromag.com.au>
> > Closes:
> > https://lore.kernel.org/netdev/e5c6c75f-2dfa-4e50-a1fb-6bf4cdb617c2@electromag.com.au/
> > Reported-by: Romain Gantois <romain.gantois@bootlin.com>
> > Closes:
> > https://lore.kernel.org/netdev/c57283ed-6b9b-b0e6-ee12-5655c1c54495@bootlin.com/
> 
> Fairly sure those should be Link: and Closes: should be used for bug tracker
> entries.

ACK

> > +	return (proto == htons(ETH_P_IP)) || (proto == htons(ETH_P_IPV6)) ||
> > +		(proto == htons(ETH_P_8021Q));
> 
> Do you need to include ETH_P_8021AD in that list as well or is not stmmac
> capable of checksuming beyond a single VLAN tag?

The datasheet for my Ethernet controller doesn't mention 802.1ad tag 
handling and I ran some loopback tests that showed that this controller doesn't 
recognize 802.1ad frames as vlan frames. I also haven't seen anything in the 
stmmac driver that suggests that 802.1ad offloading is supported. Maybe the 
stmmac maintainers could weigh in on this?

Best Regards,

-- 
Romain Gantois, Bootlin
Embedded Linux and Kernel engineering
https://bootlin.com

^ permalink raw reply	[flat|nested] 18+ messages in thread

* Re: [PATCH net v2 1/1] net: stmmac: Prevent DSA tags from breaking COE on stmmac
@ 2024-01-03  8:40       ` Romain Gantois
  0 siblings, 0 replies; 18+ messages in thread
From: Romain Gantois @ 2024-01-03  8:40 UTC (permalink / raw)
  To: Florian Fainelli
  Cc: Romain Gantois, Alexandre Torgue, Jose Abreu, David S. Miller,
	Eric Dumazet, Jakub Kicinski, Paolo Abeni, Maxime Coquelin,
	Miquel Raynal, Maxime Chevallier, Sylvain Girard,
	Vladimir Oltean, Andrew Lunn, Pascal EBERHARD, Richard Tresidder,
	Linus Walleij, netdev, linux-stm32, linux-arm-kernel, stable

Hi Florian,

On Tue, 2 Jan 2024, Florian Fainelli wrote:

...
> > Fixes: 6b2c6e4a938f ("net: stmmac: propagate feature flags to vlan")
> > Cc: stable@vger.kernel.org
> > Reported-by: Richard Tresidder <rtresidd@electromag.com.au>
> > Closes:
> > https://lore.kernel.org/netdev/e5c6c75f-2dfa-4e50-a1fb-6bf4cdb617c2@electromag.com.au/
> > Reported-by: Romain Gantois <romain.gantois@bootlin.com>
> > Closes:
> > https://lore.kernel.org/netdev/c57283ed-6b9b-b0e6-ee12-5655c1c54495@bootlin.com/
> 
> Fairly sure those should be Link: and Closes: should be used for bug tracker
> entries.

ACK

> > +	return (proto == htons(ETH_P_IP)) || (proto == htons(ETH_P_IPV6)) ||
> > +		(proto == htons(ETH_P_8021Q));
> 
> Do you need to include ETH_P_8021AD in that list as well or is not stmmac
> capable of checksuming beyond a single VLAN tag?

The datasheet for my Ethernet controller doesn't mention 802.1ad tag 
handling and I ran some loopback tests that showed that this controller doesn't 
recognize 802.1ad frames as vlan frames. I also haven't seen anything in the 
stmmac driver that suggests that 802.1ad offloading is supported. Maybe the 
stmmac maintainers could weigh in on this?

Best Regards,

-- 
Romain Gantois, Bootlin
Embedded Linux and Kernel engineering
https://bootlin.com

_______________________________________________
linux-arm-kernel mailing list
linux-arm-kernel@lists.infradead.org
http://lists.infradead.org/mailman/listinfo/linux-arm-kernel

^ permalink raw reply	[flat|nested] 18+ messages in thread

* Re: [PATCH net v2 1/1] net: stmmac: Prevent DSA tags from breaking COE on stmmac
  2024-01-02 20:27     ` Linus Walleij
@ 2024-01-03  9:11       ` Romain Gantois
  -1 siblings, 0 replies; 18+ messages in thread
From: Romain Gantois @ 2024-01-03  9:11 UTC (permalink / raw)
  To: Linus Walleij
  Cc: Romain Gantois, Alexandre Torgue, Jose Abreu, David S. Miller,
	Eric Dumazet, Jakub Kicinski, Paolo Abeni, Maxime Coquelin,
	Miquel Raynal, Maxime Chevallier, Sylvain Girard,
	Vladimir Oltean, Andrew Lunn, Pascal EBERHARD, Richard Tresidder,
	netdev, linux-stm32, linux-arm-kernel, stable

Hi Linus,

On Tue, 2 Jan 2024, Linus Walleij wrote:
...
> > +static inline bool stmmac_has_ip_ethertype(struct sk_buff *skb)
> > +{
> > +       __be16 proto = eth_header_parse_protocol(skb);
> 
> I made a new function for this in my patch
> https://lore.kernel.org/netdev/20231222-new-gemini-ethernet-regression-v4-2-a36e71b0f32b@linaro.org/
> 
> I was careful to add if (!pskb_may_pull(skb, ETH_HLEN)) because Eric
> was very specific about this, I suppose you could get fragment frames that
> are smaller than an ethernet header.

Okay nice, then I'll rewrite this series to use the new function once your 
changes make it in.

> Should we add an if (!pskb_may_pull(skb, ETH_HLEN)) to
> eth_header_parse_protocol()?
That does sound logical to me but I couldn't tell you what the impact on current 
callers would be. The net maintainers will probably have a better idea of this.

Best Regards,

-- 
Romain Gantois, Bootlin
Embedded Linux and Kernel engineering
https://bootlin.com

_______________________________________________
linux-arm-kernel mailing list
linux-arm-kernel@lists.infradead.org
http://lists.infradead.org/mailman/listinfo/linux-arm-kernel

^ permalink raw reply	[flat|nested] 18+ messages in thread

* Re: [PATCH net v2 1/1] net: stmmac: Prevent DSA tags from breaking COE on stmmac
@ 2024-01-03  9:11       ` Romain Gantois
  0 siblings, 0 replies; 18+ messages in thread
From: Romain Gantois @ 2024-01-03  9:11 UTC (permalink / raw)
  To: Linus Walleij
  Cc: Romain Gantois, Alexandre Torgue, Jose Abreu, David S. Miller,
	Eric Dumazet, Jakub Kicinski, Paolo Abeni, Maxime Coquelin,
	Miquel Raynal, Maxime Chevallier, Sylvain Girard,
	Vladimir Oltean, Andrew Lunn, Pascal EBERHARD, Richard Tresidder,
	netdev, linux-stm32, linux-arm-kernel, stable

Hi Linus,

On Tue, 2 Jan 2024, Linus Walleij wrote:
...
> > +static inline bool stmmac_has_ip_ethertype(struct sk_buff *skb)
> > +{
> > +       __be16 proto = eth_header_parse_protocol(skb);
> 
> I made a new function for this in my patch
> https://lore.kernel.org/netdev/20231222-new-gemini-ethernet-regression-v4-2-a36e71b0f32b@linaro.org/
> 
> I was careful to add if (!pskb_may_pull(skb, ETH_HLEN)) because Eric
> was very specific about this, I suppose you could get fragment frames that
> are smaller than an ethernet header.

Okay nice, then I'll rewrite this series to use the new function once your 
changes make it in.

> Should we add an if (!pskb_may_pull(skb, ETH_HLEN)) to
> eth_header_parse_protocol()?
That does sound logical to me but I couldn't tell you what the impact on current 
callers would be. The net maintainers will probably have a better idea of this.

Best Regards,

-- 
Romain Gantois, Bootlin
Embedded Linux and Kernel engineering
https://bootlin.com

^ permalink raw reply	[flat|nested] 18+ messages in thread

* Re: [PATCH net v2 1/1] net: stmmac: Prevent DSA tags from breaking COE on stmmac
  2024-01-03  9:11       ` Romain Gantois
@ 2024-01-03 16:42         ` Linus Walleij
  -1 siblings, 0 replies; 18+ messages in thread
From: Linus Walleij @ 2024-01-03 16:42 UTC (permalink / raw)
  To: Romain Gantois
  Cc: Alexandre Torgue, Jose Abreu, David S. Miller, Eric Dumazet,
	Jakub Kicinski, Paolo Abeni, Maxime Coquelin, Miquel Raynal,
	Maxime Chevallier, Sylvain Girard, Vladimir Oltean, Andrew Lunn,
	Pascal EBERHARD, Richard Tresidder, netdev, linux-stm32,
	linux-arm-kernel, stable

On Wed, Jan 3, 2024 at 10:11 AM Romain Gantois
<romain.gantois@bootlin.com> wrote:
> On Tue, 2 Jan 2024, Linus Walleij wrote:
> ...
> > > +static inline bool stmmac_has_ip_ethertype(struct sk_buff *skb)
> > > +{
> > > +       __be16 proto = eth_header_parse_protocol(skb);
> >
> > I made a new function for this in my patch
> > https://lore.kernel.org/netdev/20231222-new-gemini-ethernet-regression-v4-2-a36e71b0f32b@linaro.org/
> >
> > I was careful to add if (!pskb_may_pull(skb, ETH_HLEN)) because Eric
> > was very specific about this, I suppose you could get fragment frames that
> > are smaller than an ethernet header.
>
> Okay nice, then I'll rewrite this series to use the new function once your
> changes make it in.

I just rewrote my patch to use eth_header_parse_protocol() instead.
I should not invent a new version of something that already exist.

> > Should we add an if (!pskb_may_pull(skb, ETH_HLEN)) to
> > eth_header_parse_protocol()?
>
> That does sound logical to me but I couldn't tell you what the impact on current
> callers would be. The net maintainers will probably have a better idea of this.

I can propose a separate patch for this with RFC.

Yours,
Linus Walleij

^ permalink raw reply	[flat|nested] 18+ messages in thread

* Re: [PATCH net v2 1/1] net: stmmac: Prevent DSA tags from breaking COE on stmmac
@ 2024-01-03 16:42         ` Linus Walleij
  0 siblings, 0 replies; 18+ messages in thread
From: Linus Walleij @ 2024-01-03 16:42 UTC (permalink / raw)
  To: Romain Gantois
  Cc: Alexandre Torgue, Jose Abreu, David S. Miller, Eric Dumazet,
	Jakub Kicinski, Paolo Abeni, Maxime Coquelin, Miquel Raynal,
	Maxime Chevallier, Sylvain Girard, Vladimir Oltean, Andrew Lunn,
	Pascal EBERHARD, Richard Tresidder, netdev, linux-stm32,
	linux-arm-kernel, stable

On Wed, Jan 3, 2024 at 10:11 AM Romain Gantois
<romain.gantois@bootlin.com> wrote:
> On Tue, 2 Jan 2024, Linus Walleij wrote:
> ...
> > > +static inline bool stmmac_has_ip_ethertype(struct sk_buff *skb)
> > > +{
> > > +       __be16 proto = eth_header_parse_protocol(skb);
> >
> > I made a new function for this in my patch
> > https://lore.kernel.org/netdev/20231222-new-gemini-ethernet-regression-v4-2-a36e71b0f32b@linaro.org/
> >
> > I was careful to add if (!pskb_may_pull(skb, ETH_HLEN)) because Eric
> > was very specific about this, I suppose you could get fragment frames that
> > are smaller than an ethernet header.
>
> Okay nice, then I'll rewrite this series to use the new function once your
> changes make it in.

I just rewrote my patch to use eth_header_parse_protocol() instead.
I should not invent a new version of something that already exist.

> > Should we add an if (!pskb_may_pull(skb, ETH_HLEN)) to
> > eth_header_parse_protocol()?
>
> That does sound logical to me but I couldn't tell you what the impact on current
> callers would be. The net maintainers will probably have a better idea of this.

I can propose a separate patch for this with RFC.

Yours,
Linus Walleij

_______________________________________________
linux-arm-kernel mailing list
linux-arm-kernel@lists.infradead.org
http://lists.infradead.org/mailman/listinfo/linux-arm-kernel

^ permalink raw reply	[flat|nested] 18+ messages in thread

* Re: [PATCH net v2 1/1] net: stmmac: Prevent DSA tags from breaking COE on stmmac
  2024-01-02 16:27   ` Romain Gantois
@ 2024-01-03 20:10     ` Vladimir Oltean
  -1 siblings, 0 replies; 18+ messages in thread
From: Vladimir Oltean @ 2024-01-03 20:10 UTC (permalink / raw)
  To: Romain Gantois
  Cc: Alexandre Torgue, Jose Abreu, David S. Miller, Eric Dumazet,
	Jakub Kicinski, Paolo Abeni, Maxime Coquelin, Miquel Raynal,
	Maxime Chevallier, Sylvain Girard, Andrew Lunn, Pascal EBERHARD,
	Richard Tresidder, Linus Walleij, netdev, linux-stm32,
	linux-arm-kernel, stable

On Tue, Jan 02, 2024 at 05:27:15PM +0100, Romain Gantois wrote:
> +/* Check if ethertype will trigger IP
> + * header checks/COE in hardware
> + */
> +static inline bool stmmac_has_ip_ethertype(struct sk_buff *skb)
> +{
> +	__be16 proto = eth_header_parse_protocol(skb);
> +
> +	return (proto == htons(ETH_P_IP)) || (proto == htons(ETH_P_IPV6)) ||
> +		(proto == htons(ETH_P_8021Q));

proto == htons(ETH_P_8021Q) means that the skb has an IP EtherType?
What if an IP header does not follow after the VLAN header?

> +}

^ permalink raw reply	[flat|nested] 18+ messages in thread

* Re: [PATCH net v2 1/1] net: stmmac: Prevent DSA tags from breaking COE on stmmac
@ 2024-01-03 20:10     ` Vladimir Oltean
  0 siblings, 0 replies; 18+ messages in thread
From: Vladimir Oltean @ 2024-01-03 20:10 UTC (permalink / raw)
  To: Romain Gantois
  Cc: Alexandre Torgue, Jose Abreu, David S. Miller, Eric Dumazet,
	Jakub Kicinski, Paolo Abeni, Maxime Coquelin, Miquel Raynal,
	Maxime Chevallier, Sylvain Girard, Andrew Lunn, Pascal EBERHARD,
	Richard Tresidder, Linus Walleij, netdev, linux-stm32,
	linux-arm-kernel, stable

On Tue, Jan 02, 2024 at 05:27:15PM +0100, Romain Gantois wrote:
> +/* Check if ethertype will trigger IP
> + * header checks/COE in hardware
> + */
> +static inline bool stmmac_has_ip_ethertype(struct sk_buff *skb)
> +{
> +	__be16 proto = eth_header_parse_protocol(skb);
> +
> +	return (proto == htons(ETH_P_IP)) || (proto == htons(ETH_P_IPV6)) ||
> +		(proto == htons(ETH_P_8021Q));

proto == htons(ETH_P_8021Q) means that the skb has an IP EtherType?
What if an IP header does not follow after the VLAN header?

> +}

_______________________________________________
linux-arm-kernel mailing list
linux-arm-kernel@lists.infradead.org
http://lists.infradead.org/mailman/listinfo/linux-arm-kernel

^ permalink raw reply	[flat|nested] 18+ messages in thread

* Re: [PATCH net v2 1/1] net: stmmac: Prevent DSA tags from breaking COE on stmmac
  2024-01-03 20:10     ` Vladimir Oltean
@ 2024-01-03 22:25       ` Linus Walleij
  -1 siblings, 0 replies; 18+ messages in thread
From: Linus Walleij @ 2024-01-03 22:25 UTC (permalink / raw)
  To: Vladimir Oltean
  Cc: Romain Gantois, Alexandre Torgue, Jose Abreu, David S. Miller,
	Eric Dumazet, Jakub Kicinski, Paolo Abeni, Maxime Coquelin,
	Miquel Raynal, Maxime Chevallier, Sylvain Girard, Andrew Lunn,
	Pascal EBERHARD, Richard Tresidder, netdev, linux-stm32,
	linux-arm-kernel, stable

On Wed, Jan 3, 2024 at 9:10 PM Vladimir Oltean <olteanv@gmail.com> wrote:
> On Tue, Jan 02, 2024 at 05:27:15PM +0100, Romain Gantois wrote:
> > +/* Check if ethertype will trigger IP
> > + * header checks/COE in hardware
> > + */
> > +static inline bool stmmac_has_ip_ethertype(struct sk_buff *skb)
> > +{
> > +     __be16 proto = eth_header_parse_protocol(skb);
> > +
> > +     return (proto == htons(ETH_P_IP)) || (proto == htons(ETH_P_IPV6)) ||
> > +             (proto == htons(ETH_P_8021Q));
>
> proto == htons(ETH_P_8021Q) means that the skb has an IP EtherType?
> What if an IP header does not follow after the VLAN header?

It's probably best to do like I do here:
https://lore.kernel.org/netdev/20240102-new-gemini-ethernet-regression-v5-2-cf61ab3aa8cd@linaro.org/

+ if (ethertype == ETH_P_8021Q)
+   ethertype = ntohs(__vlan_get_protocol(skb, htons(ethertype), NULL));

Yours,
Linus Walleij

^ permalink raw reply	[flat|nested] 18+ messages in thread

* Re: [PATCH net v2 1/1] net: stmmac: Prevent DSA tags from breaking COE on stmmac
@ 2024-01-03 22:25       ` Linus Walleij
  0 siblings, 0 replies; 18+ messages in thread
From: Linus Walleij @ 2024-01-03 22:25 UTC (permalink / raw)
  To: Vladimir Oltean
  Cc: Romain Gantois, Alexandre Torgue, Jose Abreu, David S. Miller,
	Eric Dumazet, Jakub Kicinski, Paolo Abeni, Maxime Coquelin,
	Miquel Raynal, Maxime Chevallier, Sylvain Girard, Andrew Lunn,
	Pascal EBERHARD, Richard Tresidder, netdev, linux-stm32,
	linux-arm-kernel, stable

On Wed, Jan 3, 2024 at 9:10 PM Vladimir Oltean <olteanv@gmail.com> wrote:
> On Tue, Jan 02, 2024 at 05:27:15PM +0100, Romain Gantois wrote:
> > +/* Check if ethertype will trigger IP
> > + * header checks/COE in hardware
> > + */
> > +static inline bool stmmac_has_ip_ethertype(struct sk_buff *skb)
> > +{
> > +     __be16 proto = eth_header_parse_protocol(skb);
> > +
> > +     return (proto == htons(ETH_P_IP)) || (proto == htons(ETH_P_IPV6)) ||
> > +             (proto == htons(ETH_P_8021Q));
>
> proto == htons(ETH_P_8021Q) means that the skb has an IP EtherType?
> What if an IP header does not follow after the VLAN header?

It's probably best to do like I do here:
https://lore.kernel.org/netdev/20240102-new-gemini-ethernet-regression-v5-2-cf61ab3aa8cd@linaro.org/

+ if (ethertype == ETH_P_8021Q)
+   ethertype = ntohs(__vlan_get_protocol(skb, htons(ethertype), NULL));

Yours,
Linus Walleij

_______________________________________________
linux-arm-kernel mailing list
linux-arm-kernel@lists.infradead.org
http://lists.infradead.org/mailman/listinfo/linux-arm-kernel

^ permalink raw reply	[flat|nested] 18+ messages in thread

end of thread, other threads:[~2024-01-03 22:26 UTC | newest]

Thread overview: 18+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2024-01-02 16:27 [PATCH net v2 0/1] Prevent DSA tags from breaking COE Romain Gantois
2024-01-02 16:27 ` Romain Gantois
2024-01-02 16:27 ` [PATCH net v2 1/1] net: stmmac: Prevent DSA tags from breaking COE on stmmac Romain Gantois
2024-01-02 16:27   ` Romain Gantois
2024-01-02 20:26   ` Florian Fainelli
2024-01-02 20:26     ` Florian Fainelli
2024-01-03  8:40     ` Romain Gantois
2024-01-03  8:40       ` Romain Gantois
2024-01-02 20:27   ` Linus Walleij
2024-01-02 20:27     ` Linus Walleij
2024-01-03  9:11     ` Romain Gantois
2024-01-03  9:11       ` Romain Gantois
2024-01-03 16:42       ` Linus Walleij
2024-01-03 16:42         ` Linus Walleij
2024-01-03 20:10   ` Vladimir Oltean
2024-01-03 20:10     ` Vladimir Oltean
2024-01-03 22:25     ` Linus Walleij
2024-01-03 22:25       ` Linus Walleij

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.