Netdev List
 help / color / mirror / Atom feed
From: David Yang <mmyangfl@gmail.com>
To: netdev@vger.kernel.org
Cc: David Yang <mmyangfl@gmail.com>,
	Jian Shen <shenjian15@huawei.com>,
	Jijie Shao <shaojijie@huawei.com>,
	Andrew Lunn <andrew+netdev@lunn.ch>,
	"David S. Miller" <davem@davemloft.net>,
	Eric Dumazet <edumazet@kernel.org>,
	Jakub Kicinski <kuba@kernel.org>, Paolo Abeni <pabeni@redhat.com>,
	Zhangfei Gao <zhangfei.gao@linaro.org>,
	Dongpo Li <lidongpo@hisilicon.com>
Subject: [PATCH net 2/3] net: hix5hd2_gmac: release TX SG buffers if using SG
Date: Thu, 26 Nov 2026 19:03:04 +0800	[thread overview]
Message-ID: <20261126110310.344521-3-mmyangfl@gmail.com> (raw)
In-Reply-To: <20261126110310.344521-1-mmyangfl@gmail.com>

The commit in question added scatter-gather feature for TX queues, but
left the release path in hix5hd2_free_dma_desc_rings() untouched.

Give the release the same branch the reclaim has.

Fixes: e5222b1c3f21 ("net: hix5hd2_gmac: add tx scatter-gather feature")
Signed-off-by: David Yang <mmyangfl@gmail.com>
---
 drivers/net/ethernet/hisilicon/hix5hd2_gmac.c | 11 ++++++++---
 1 file changed, 8 insertions(+), 3 deletions(-)

diff --git a/drivers/net/ethernet/hisilicon/hix5hd2_gmac.c b/drivers/net/ethernet/hisilicon/hix5hd2_gmac.c
index 46386a0954a2..0d4701d1e173 100644
--- a/drivers/net/ethernet/hisilicon/hix5hd2_gmac.c
+++ b/drivers/net/ethernet/hisilicon/hix5hd2_gmac.c
@@ -816,9 +816,14 @@ static void hix5hd2_free_dma_desc_rings(struct hix5hd2_priv *priv)
 		if (skb == NULL)
 			continue;
 
-		desc = priv->tx_bq.desc + i;
-		addr = le32_to_cpu(desc->buff_addr);
-		dma_unmap_single(priv->dev, addr, skb->len, DMA_TO_DEVICE);
+		if (skb_shinfo(skb)->nr_frags) {
+			hix5hd2_clean_sg_desc(priv, skb, i);
+		} else {
+			desc = priv->tx_bq.desc + i;
+			addr = le32_to_cpu(desc->buff_addr);
+			dma_unmap_single(priv->dev, addr, skb->len,
+					 DMA_TO_DEVICE);
+		}
 		dev_kfree_skb_any(skb);
 		priv->tx_skb[i] = NULL;
 	}
-- 
2.53.0


  parent reply	other threads:[~2026-11-26 11:04 UTC|newest]

Thread overview: 4+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2026-11-26 11:03 [PATCH net 0/3] net: hix5hd2_gmac: fix memory corruption across interface reopen David Yang
2026-11-26 11:03 ` [PATCH net 1/3] net: hix5hd2_gmac: unmap input TX buffers, not returned ones David Yang
2026-11-26 11:03 ` David Yang [this message]
2026-11-26 11:03 ` [PATCH net 3/3] net: hix5hd2_gmac: keep TX/RX queues alive across a close David Yang

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=20261126110310.344521-3-mmyangfl@gmail.com \
    --to=mmyangfl@gmail.com \
    --cc=andrew+netdev@lunn.ch \
    --cc=davem@davemloft.net \
    --cc=edumazet@kernel.org \
    --cc=kuba@kernel.org \
    --cc=lidongpo@hisilicon.com \
    --cc=netdev@vger.kernel.org \
    --cc=pabeni@redhat.com \
    --cc=shaojijie@huawei.com \
    --cc=shenjian15@huawei.com \
    --cc=zhangfei.gao@linaro.org \
    /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