netdev.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: Lorenzo Bianconi <lorenzo@kernel.org>
To: Andrew Lunn <andrew+netdev@lunn.ch>,
	 "David S. Miller" <davem@davemloft.net>,
	Eric Dumazet <edumazet@google.com>,
	 Jakub Kicinski <kuba@kernel.org>,
	Paolo Abeni <pabeni@redhat.com>,  Felix Fietkau <nbd@nbd.name>,
	Sean Wang <sean.wang@mediatek.com>,
	 Matthias Brugger <matthias.bgg@gmail.com>,
	 AngeloGioacchino Del Regno
	<angelogioacchino.delregno@collabora.com>,
	 Philipp Zabel <p.zabel@pengutronix.de>,
	Rob Herring <robh@kernel.org>,
	 Krzysztof Kozlowski <krzk+dt@kernel.org>,
	 Conor Dooley <conor+dt@kernel.org>,
	Lorenzo Bianconi <lorenzo@kernel.org>,
	 "Chester A. Unal" <chester.a.unal@arinc9.com>,
	 Daniel Golle <daniel@makrotopia.org>,
	DENG Qingfang <dqfext@gmail.com>,  Andrew Lunn <andrew@lunn.ch>,
	Vladimir Oltean <olteanv@gmail.com>
Cc: netdev@vger.kernel.org, linux-arm-kernel@lists.infradead.org,
	 linux-mediatek@lists.infradead.org, devicetree@vger.kernel.org,
	 upstream@airoha.com,
	Mateusz Polchlopek <mateusz.polchlopek@intel.com>
Subject: [PATCH net-next v4 01/16] net: airoha: Fix TSO support for header cloned skbs
Date: Thu, 13 Feb 2025 16:34:20 +0100	[thread overview]
Message-ID: <20250213-airoha-en7581-flowtable-offload-v4-1-b69ca16d74db@kernel.org> (raw)
In-Reply-To: <20250213-airoha-en7581-flowtable-offload-v4-0-b69ca16d74db@kernel.org>

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")
Reviewed-by: Mateusz Polchlopek <mateusz.polchlopek@intel.com>
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


  reply	other threads:[~2025-02-13 15:34 UTC|newest]

Thread overview: 26+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2025-02-13 15:34 [PATCH net-next v4 00/16] Introduce flowtable hw offloading in airoha_eth driver Lorenzo Bianconi
2025-02-13 15:34 ` Lorenzo Bianconi [this message]
2025-02-14 21:35   ` [PATCH net-next v4 01/16] net: airoha: Fix TSO support for header cloned skbs Jakub Kicinski
2025-02-13 15:34 ` [PATCH net-next v4 02/16] net: airoha: Move airoha_eth driver in a dedicated folder Lorenzo Bianconi
2025-02-13 15:34 ` [PATCH net-next v4 03/16] net: airoha: Move definitions in airoha_eth.h Lorenzo Bianconi
2025-02-13 15:34 ` [PATCH net-next v4 04/16] net: airoha: Move reg/write utility routines " Lorenzo Bianconi
2025-02-13 15:34 ` [PATCH net-next v4 05/16] net: airoha: Move register definitions in airoha_regs.h Lorenzo Bianconi
2025-02-13 15:34 ` [PATCH net-next v4 06/16] net: airoha: Move DSA tag in DMA descriptor Lorenzo Bianconi
2025-02-13 15:34 ` [PATCH net-next v4 07/16] net: dsa: mt7530: Enable Rx sptag for EN7581 SoC Lorenzo Bianconi
2025-02-13 15:34 ` [PATCH net-next v4 08/16] net: airoha: Enable support for multiple net_devices Lorenzo Bianconi
2025-02-13 15:34 ` [PATCH net-next v4 09/16] net: airoha: Move REG_GDM_FWD_CFG() initialization in airoha_dev_init() Lorenzo Bianconi
2025-02-13 15:34 ` [PATCH net-next v4 10/16] net: airoha: Rename airoha_set_gdm_port_fwd_cfg() in airoha_set_vip_for_gdm_port() Lorenzo Bianconi
2025-02-13 15:34 ` [PATCH net-next v4 11/16] dt-bindings: net: airoha: Add the NPU node for EN7581 SoC Lorenzo Bianconi
2025-02-14  8:03   ` Krzysztof Kozlowski
2025-02-13 15:34 ` [PATCH net-next v4 12/16] dt-bindings: net: airoha: Add airoha,npu phandle property Lorenzo Bianconi
2025-02-13 15:34 ` [PATCH net-next v4 13/16] net: airoha: Introduce Airoha NPU support Lorenzo Bianconi
2025-02-17 18:38   ` Simon Horman
2025-02-17 19:23     ` Lorenzo Bianconi
2025-02-18 13:27       ` Simon Horman
2025-02-18 13:45         ` Lorenzo Bianconi
2025-02-13 15:34 ` [PATCH net-next v4 14/16] net: airoha: Introduce flowtable offload support Lorenzo Bianconi
2025-02-14 14:06   ` kernel test robot
2025-02-13 15:34 ` [PATCH net-next v4 15/16] net: airoha: Add loopback support for GDM2 Lorenzo Bianconi
2025-02-13 15:34 ` [PATCH net-next v4 16/16] net: airoha: Introduce PPE debugfs support Lorenzo Bianconi
2025-02-17 18:44   ` Simon Horman
2025-02-17 21:43     ` Lorenzo Bianconi

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20250213-airoha-en7581-flowtable-offload-v4-1-b69ca16d74db@kernel.org \
    --to=lorenzo@kernel.org \
    --cc=andrew+netdev@lunn.ch \
    --cc=andrew@lunn.ch \
    --cc=angelogioacchino.delregno@collabora.com \
    --cc=chester.a.unal@arinc9.com \
    --cc=conor+dt@kernel.org \
    --cc=daniel@makrotopia.org \
    --cc=davem@davemloft.net \
    --cc=devicetree@vger.kernel.org \
    --cc=dqfext@gmail.com \
    --cc=edumazet@google.com \
    --cc=krzk+dt@kernel.org \
    --cc=kuba@kernel.org \
    --cc=linux-arm-kernel@lists.infradead.org \
    --cc=linux-mediatek@lists.infradead.org \
    --cc=mateusz.polchlopek@intel.com \
    --cc=matthias.bgg@gmail.com \
    --cc=nbd@nbd.name \
    --cc=netdev@vger.kernel.org \
    --cc=olteanv@gmail.com \
    --cc=p.zabel@pengutronix.de \
    --cc=pabeni@redhat.com \
    --cc=robh@kernel.org \
    --cc=sean.wang@mediatek.com \
    --cc=upstream@airoha.com \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
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).