All of lore.kernel.org
 help / color / mirror / Atom feed
* [PATCH net-next 0/2] Enable TSO for DSA ports on Airoha EN7581 SoC
@ 2025-02-12  6:51 Lorenzo Bianconi
  2025-02-12  6:51 ` [PATCH net-next 1/2] net: airoha: Fix TSO support for header cloned skbs Lorenzo Bianconi
                   ` (2 more replies)
  0 siblings, 3 replies; 6+ messages in thread
From: Lorenzo Bianconi @ 2025-02-12  6:51 UTC (permalink / raw)
  To: Felix Fietkau, Sean Wang, Andrew Lunn, David S. Miller,
	Eric Dumazet, Jakub Kicinski, Paolo Abeni, Matthias Brugger,
	AngeloGioacchino Del Regno
  Cc: linux-arm-kernel, linux-mediatek, netdev, Lorenzo Bianconi

Add missing vlan_features configuration to enable TSO/Scatter Gather for
airoha_eth lan ports.
Fix checksum configuration for TSO packets with cloned headers.

---
Lorenzo Bianconi (2):
      net: airoha: Fix TSO support for header cloned skbs
      net: airoha: Enable TSO/Scatter Gather for LAN port

 drivers/net/ethernet/mediatek/airoha_eth.c | 11 ++++++-----
 1 file changed, 6 insertions(+), 5 deletions(-)
---
base-commit: 4e41231249f4083a095085ff86e317e29313c2c3
change-id: 20250211-airoha-fix-tso-44a6f9cb14c0

Best regards,
-- 
Lorenzo Bianconi <lorenzo@kernel.org>



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

* [PATCH net-next 1/2] net: airoha: Fix TSO support for header cloned skbs
  2025-02-12  6:51 [PATCH net-next 0/2] Enable TSO for DSA ports on Airoha EN7581 SoC Lorenzo Bianconi
@ 2025-02-12  6:51 ` Lorenzo Bianconi
  2025-02-12  8:20   ` Mateusz Polchlopek
  2025-02-12  6:51 ` [PATCH net-next 2/2] net: airoha: Enable TSO/Scatter Gather for LAN port Lorenzo Bianconi
  2025-02-12 10:03 ` [PATCH net-next 0/2] Enable TSO for DSA ports on Airoha EN7581 SoC Lorenzo Bianconi
  2 siblings, 1 reply; 6+ messages in thread
From: Lorenzo Bianconi @ 2025-02-12  6:51 UTC (permalink / raw)
  To: Felix Fietkau, Sean Wang, Andrew Lunn, David S. Miller,
	Eric Dumazet, Jakub Kicinski, Paolo Abeni, Matthias Brugger,
	AngeloGioacchino Del Regno
  Cc: linux-arm-kernel, linux-mediatek, netdev, Lorenzo Bianconi

For GSO packets, skb_cow_head() will reallocate the skb for TSO header
cloned skbs in airoha_dev_xmit(). For this reason, sinfo pointer can be
no more valid. Fix the issue relying on skb_shinfo() macro directly in
airoha_dev_xmit().
This is not a user visible issue since we can't currently enable TSO for
DSA user ports since we are missing to initialize net_device
vlan_features field.

Fixes: 23020f049327 ("net: airoha: Introduce ethernet support for EN7581 SoC")
Signed-off-by: Lorenzo Bianconi <lorenzo@kernel.org>
---
 drivers/net/ethernet/mediatek/airoha_eth.c | 10 +++++-----
 1 file changed, 5 insertions(+), 5 deletions(-)

diff --git a/drivers/net/ethernet/mediatek/airoha_eth.c b/drivers/net/ethernet/mediatek/airoha_eth.c
index 09f448f291240257c5748725848ede231c502fbd..aa5f220ddbcf9ca5bee1173114294cb3aec701c9 100644
--- a/drivers/net/ethernet/mediatek/airoha_eth.c
+++ b/drivers/net/ethernet/mediatek/airoha_eth.c
@@ -2556,11 +2556,10 @@ static u16 airoha_dev_select_queue(struct net_device *dev, struct sk_buff *skb,
 static netdev_tx_t airoha_dev_xmit(struct sk_buff *skb,
 				   struct net_device *dev)
 {
-	struct skb_shared_info *sinfo = skb_shinfo(skb);
 	struct airoha_gdm_port *port = netdev_priv(dev);
+	u32 nr_frags = 1 + skb_shinfo(skb)->nr_frags;
 	u32 msg0, msg1, len = skb_headlen(skb);
 	struct airoha_qdma *qdma = port->qdma;
-	u32 nr_frags = 1 + sinfo->nr_frags;
 	struct netdev_queue *txq;
 	struct airoha_queue *q;
 	void *data = skb->data;
@@ -2583,8 +2582,9 @@ static netdev_tx_t airoha_dev_xmit(struct sk_buff *skb,
 		if (skb_cow_head(skb, 0))
 			goto error;
 
-		if (sinfo->gso_type & (SKB_GSO_TCPV4 | SKB_GSO_TCPV6)) {
-			__be16 csum = cpu_to_be16(sinfo->gso_size);
+		if (skb_shinfo(skb)->gso_type & (SKB_GSO_TCPV4 |
+						 SKB_GSO_TCPV6)) {
+			__be16 csum = cpu_to_be16(skb_shinfo(skb)->gso_size);
 
 			tcp_hdr(skb)->check = (__force __sum16)csum;
 			msg0 |= FIELD_PREP(QDMA_ETH_TXMSG_TSO_MASK, 1);
@@ -2613,7 +2613,7 @@ static netdev_tx_t airoha_dev_xmit(struct sk_buff *skb,
 	for (i = 0; i < nr_frags; i++) {
 		struct airoha_qdma_desc *desc = &q->desc[index];
 		struct airoha_queue_entry *e = &q->entry[index];
-		skb_frag_t *frag = &sinfo->frags[i];
+		skb_frag_t *frag = &skb_shinfo(skb)->frags[i];
 		dma_addr_t addr;
 		u32 val;
 

-- 
2.48.1



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

* [PATCH net-next 2/2] net: airoha: Enable TSO/Scatter Gather for LAN port
  2025-02-12  6:51 [PATCH net-next 0/2] Enable TSO for DSA ports on Airoha EN7581 SoC Lorenzo Bianconi
  2025-02-12  6:51 ` [PATCH net-next 1/2] net: airoha: Fix TSO support for header cloned skbs Lorenzo Bianconi
@ 2025-02-12  6:51 ` Lorenzo Bianconi
  2025-02-12  8:23   ` Mateusz Polchlopek
  2025-02-12 10:03 ` [PATCH net-next 0/2] Enable TSO for DSA ports on Airoha EN7581 SoC Lorenzo Bianconi
  2 siblings, 1 reply; 6+ messages in thread
From: Lorenzo Bianconi @ 2025-02-12  6:51 UTC (permalink / raw)
  To: Felix Fietkau, Sean Wang, Andrew Lunn, David S. Miller,
	Eric Dumazet, Jakub Kicinski, Paolo Abeni, Matthias Brugger,
	AngeloGioacchino Del Regno
  Cc: linux-arm-kernel, linux-mediatek, netdev, Lorenzo Bianconi

Set net_device vlan_features in order to enable TSO and Scatter Gather
for DSA user ports.

Signed-off-by: Lorenzo Bianconi <lorenzo@kernel.org>
---
 drivers/net/ethernet/mediatek/airoha_eth.c | 1 +
 1 file changed, 1 insertion(+)

diff --git a/drivers/net/ethernet/mediatek/airoha_eth.c b/drivers/net/ethernet/mediatek/airoha_eth.c
index aa5f220ddbcf9ca5bee1173114294cb3aec701c9..321e5d15198c5ec6a0764be418aa447e8d9e4512 100644
--- a/drivers/net/ethernet/mediatek/airoha_eth.c
+++ b/drivers/net/ethernet/mediatek/airoha_eth.c
@@ -3188,6 +3188,7 @@ static int airoha_alloc_gdm_port(struct airoha_eth *eth, struct device_node *np)
 			   NETIF_F_SG | NETIF_F_TSO |
 			   NETIF_F_HW_TC;
 	dev->features |= dev->hw_features;
+	dev->vlan_features = dev->hw_features;
 	dev->dev.of_node = np;
 	dev->irq = qdma->irq;
 	SET_NETDEV_DEV(dev, eth->dev);

-- 
2.48.1



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

* Re: [PATCH net-next 1/2] net: airoha: Fix TSO support for header cloned skbs
  2025-02-12  6:51 ` [PATCH net-next 1/2] net: airoha: Fix TSO support for header cloned skbs Lorenzo Bianconi
@ 2025-02-12  8:20   ` Mateusz Polchlopek
  0 siblings, 0 replies; 6+ messages in thread
From: Mateusz Polchlopek @ 2025-02-12  8:20 UTC (permalink / raw)
  To: Lorenzo Bianconi, Felix Fietkau, Sean Wang, Andrew Lunn,
	David S. Miller, Eric Dumazet, Jakub Kicinski, Paolo Abeni,
	Matthias Brugger, AngeloGioacchino Del Regno
  Cc: linux-arm-kernel, linux-mediatek, netdev



On 2/12/2025 7:51 AM, Lorenzo Bianconi wrote:
> For GSO packets, skb_cow_head() will reallocate the skb for TSO header
> cloned skbs in airoha_dev_xmit(). For this reason, sinfo pointer can be
> no more valid. Fix the issue relying on skb_shinfo() macro directly in
> airoha_dev_xmit().
> This is not a user visible issue since we can't currently enable TSO for
> DSA user ports since we are missing to initialize net_device
> vlan_features field.
> 
> Fixes: 23020f049327 ("net: airoha: Introduce ethernet support for EN7581 SoC")
> Signed-off-by: Lorenzo Bianconi <lorenzo@kernel.org>
> ---
>   drivers/net/ethernet/mediatek/airoha_eth.c | 10 +++++-----
>   1 file changed, 5 insertions(+), 5 deletions(-)
> 
> diff --git a/drivers/net/ethernet/mediatek/airoha_eth.c b/drivers/net/ethernet/mediatek/airoha_eth.c
> index 09f448f291240257c5748725848ede231c502fbd..aa5f220ddbcf9ca5bee1173114294cb3aec701c9 100644
> --- a/drivers/net/ethernet/mediatek/airoha_eth.c
> +++ b/drivers/net/ethernet/mediatek/airoha_eth.c
> @@ -2556,11 +2556,10 @@ static u16 airoha_dev_select_queue(struct net_device *dev, struct sk_buff *skb,
>   static netdev_tx_t airoha_dev_xmit(struct sk_buff *skb,
>   				   struct net_device *dev)
>   {
> -	struct skb_shared_info *sinfo = skb_shinfo(skb);
>   	struct airoha_gdm_port *port = netdev_priv(dev);
> +	u32 nr_frags = 1 + skb_shinfo(skb)->nr_frags;
>   	u32 msg0, msg1, len = skb_headlen(skb);
>   	struct airoha_qdma *qdma = port->qdma;
> -	u32 nr_frags = 1 + sinfo->nr_frags;
>   	struct netdev_queue *txq;
>   	struct airoha_queue *q;
>   	void *data = skb->data;
> @@ -2583,8 +2582,9 @@ static netdev_tx_t airoha_dev_xmit(struct sk_buff *skb,
>   		if (skb_cow_head(skb, 0))
>   			goto error;
>   
> -		if (sinfo->gso_type & (SKB_GSO_TCPV4 | SKB_GSO_TCPV6)) {
> -			__be16 csum = cpu_to_be16(sinfo->gso_size);
> +		if (skb_shinfo(skb)->gso_type & (SKB_GSO_TCPV4 |
> +						 SKB_GSO_TCPV6)) {
> +			__be16 csum = cpu_to_be16(skb_shinfo(skb)->gso_size);
>   
>   			tcp_hdr(skb)->check = (__force __sum16)csum;
>   			msg0 |= FIELD_PREP(QDMA_ETH_TXMSG_TSO_MASK, 1);
> @@ -2613,7 +2613,7 @@ static netdev_tx_t airoha_dev_xmit(struct sk_buff *skb,
>   	for (i = 0; i < nr_frags; i++) {
>   		struct airoha_qdma_desc *desc = &q->desc[index];
>   		struct airoha_queue_entry *e = &q->entry[index];
> -		skb_frag_t *frag = &sinfo->frags[i];
> +		skb_frag_t *frag = &skb_shinfo(skb)->frags[i];
>   		dma_addr_t addr;
>   		u32 val;
>   
> 

Thanks for this change:
Reviewed-by: Mateusz Polchlopek <mateusz.polchlopek@intel.com>


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

* Re: [PATCH net-next 2/2] net: airoha: Enable TSO/Scatter Gather for LAN port
  2025-02-12  6:51 ` [PATCH net-next 2/2] net: airoha: Enable TSO/Scatter Gather for LAN port Lorenzo Bianconi
@ 2025-02-12  8:23   ` Mateusz Polchlopek
  0 siblings, 0 replies; 6+ messages in thread
From: Mateusz Polchlopek @ 2025-02-12  8:23 UTC (permalink / raw)
  To: Lorenzo Bianconi, Felix Fietkau, Sean Wang, Andrew Lunn,
	David S. Miller, Eric Dumazet, Jakub Kicinski, Paolo Abeni,
	Matthias Brugger, AngeloGioacchino Del Regno
  Cc: linux-arm-kernel, linux-mediatek, netdev



On 2/12/2025 7:51 AM, Lorenzo Bianconi wrote:
> Set net_device vlan_features in order to enable TSO and Scatter Gather
> for DSA user ports.
> 
> Signed-off-by: Lorenzo Bianconi <lorenzo@kernel.org>
> ---
>   drivers/net/ethernet/mediatek/airoha_eth.c | 1 +
>   1 file changed, 1 insertion(+)
> 
> diff --git a/drivers/net/ethernet/mediatek/airoha_eth.c b/drivers/net/ethernet/mediatek/airoha_eth.c
> index aa5f220ddbcf9ca5bee1173114294cb3aec701c9..321e5d15198c5ec6a0764be418aa447e8d9e4512 100644
> --- a/drivers/net/ethernet/mediatek/airoha_eth.c
> +++ b/drivers/net/ethernet/mediatek/airoha_eth.c
> @@ -3188,6 +3188,7 @@ static int airoha_alloc_gdm_port(struct airoha_eth *eth, struct device_node *np)
>   			   NETIF_F_SG | NETIF_F_TSO |
>   			   NETIF_F_HW_TC;
>   	dev->features |= dev->hw_features;
> +	dev->vlan_features = dev->hw_features;
>   	dev->dev.of_node = np;
>   	dev->irq = qdma->irq;
>   	SET_NETDEV_DEV(dev, eth->dev);
> 

Reviewed-by: Mateusz Polchlopek <mateusz.polchlopek@intel.com>



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

* Re: [PATCH net-next 0/2] Enable TSO for DSA ports on Airoha EN7581 SoC
  2025-02-12  6:51 [PATCH net-next 0/2] Enable TSO for DSA ports on Airoha EN7581 SoC Lorenzo Bianconi
  2025-02-12  6:51 ` [PATCH net-next 1/2] net: airoha: Fix TSO support for header cloned skbs Lorenzo Bianconi
  2025-02-12  6:51 ` [PATCH net-next 2/2] net: airoha: Enable TSO/Scatter Gather for LAN port Lorenzo Bianconi
@ 2025-02-12 10:03 ` Lorenzo Bianconi
  2 siblings, 0 replies; 6+ messages in thread
From: Lorenzo Bianconi @ 2025-02-12 10:03 UTC (permalink / raw)
  To: Felix Fietkau, Sean Wang, Andrew Lunn, David S. Miller,
	Eric Dumazet, Jakub Kicinski, Paolo Abeni, Matthias Brugger,
	AngeloGioacchino Del Regno
  Cc: linux-arm-kernel, linux-mediatek, netdev

[-- Attachment #1: Type: text/plain, Size: 771 bytes --]

> Add missing vlan_features configuration to enable TSO/Scatter Gather for
> airoha_eth lan ports.
> Fix checksum configuration for TSO packets with cloned headers.
> 
> ---
> Lorenzo Bianconi (2):
>       net: airoha: Fix TSO support for header cloned skbs
>       net: airoha: Enable TSO/Scatter Gather for LAN port
> 
>  drivers/net/ethernet/mediatek/airoha_eth.c | 11 ++++++-----
>  1 file changed, 6 insertions(+), 5 deletions(-)
> ---
> base-commit: 4e41231249f4083a095085ff86e317e29313c2c3
> change-id: 20250211-airoha-fix-tso-44a6f9cb14c0

Hi,

I figured out I am missing a patch in this series, please drop it, I will
repost. Sorry for the noise.

Regards,
Lorenzo

> 
> Best regards,
> -- 
> Lorenzo Bianconi <lorenzo@kernel.org>
> 

[-- Attachment #2: signature.asc --]
[-- Type: application/pgp-signature, Size: 228 bytes --]

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

end of thread, other threads:[~2025-02-12 10:23 UTC | newest]

Thread overview: 6+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2025-02-12  6:51 [PATCH net-next 0/2] Enable TSO for DSA ports on Airoha EN7581 SoC Lorenzo Bianconi
2025-02-12  6:51 ` [PATCH net-next 1/2] net: airoha: Fix TSO support for header cloned skbs Lorenzo Bianconi
2025-02-12  8:20   ` Mateusz Polchlopek
2025-02-12  6:51 ` [PATCH net-next 2/2] net: airoha: Enable TSO/Scatter Gather for LAN port Lorenzo Bianconi
2025-02-12  8:23   ` Mateusz Polchlopek
2025-02-12 10:03 ` [PATCH net-next 0/2] Enable TSO for DSA ports on Airoha EN7581 SoC Lorenzo Bianconi

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.