All of lore.kernel.org
 help / color / mirror / Atom feed
From: Ilya Lipnitskiy <ilya.lipnitskiy@gmail.com>
To: Felix Fietkau <nbd@nbd.name>, John Crispin <john@phrozen.org>,
	Sean Wang <sean.wang@mediatek.com>,
	Mark Lee <Mark-MC.Lee@mediatek.com>,
	"David S. Miller" <davem@davemloft.net>,
	Jakub Kicinski <kuba@kernel.org>,
	Matthias Brugger <matthias.bgg@gmail.com>,
	netdev@vger.kernel.org, linux-kernel@vger.kernel.org,
	linux-arm-kernel@lists.infradead.org,
	linux-mediatek@lists.infradead.org
Cc: Ilya Lipnitskiy <ilya.lipnitskiy@gmail.com>
Subject: [PATCH net-next v2 03/15] net: ethernet: mtk_eth_soc: fix build_skb cleanup
Date: Thu, 22 Apr 2021 22:20:56 -0700	[thread overview]
Message-ID: <20210423052108.423853-4-ilya.lipnitskiy@gmail.com> (raw)
In-Reply-To: <20210423052108.423853-1-ilya.lipnitskiy@gmail.com>

In case build_skb fails, call skb_free_frag on the correct pointer. Also
update the DMA structures with the new mapping before exiting, because
the mapping was successful

Suggested-by: Felix Fietkau <nbd@nbd.name>
Signed-off-by: Ilya Lipnitskiy <ilya.lipnitskiy@gmail.com>
---
 drivers/net/ethernet/mediatek/mtk_eth_soc.c | 5 +++--
 1 file changed, 3 insertions(+), 2 deletions(-)

diff --git a/drivers/net/ethernet/mediatek/mtk_eth_soc.c b/drivers/net/ethernet/mediatek/mtk_eth_soc.c
index 540003f3fcb8..07daa5de8bec 100644
--- a/drivers/net/ethernet/mediatek/mtk_eth_soc.c
+++ b/drivers/net/ethernet/mediatek/mtk_eth_soc.c
@@ -1304,9 +1304,9 @@ static int mtk_poll_rx(struct napi_struct *napi, int budget,
 		/* receive data */
 		skb = build_skb(data, ring->frag_size);
 		if (unlikely(!skb)) {
-			skb_free_frag(new_data);
+			skb_free_frag(data);
 			netdev->stats.rx_dropped++;
-			goto release_desc;
+			goto skip_rx;
 		}
 		skb_reserve(skb, NET_SKB_PAD + NET_IP_ALIGN);
 
@@ -1326,6 +1326,7 @@ static int mtk_poll_rx(struct napi_struct *napi, int budget,
 		skb_record_rx_queue(skb, 0);
 		napi_gro_receive(napi, skb);
 
+skip_rx:
 		ring->data[idx] = new_data;
 		rxd->rxd1 = (unsigned int)dma_addr;
 
-- 
2.31.1


WARNING: multiple messages have this Message-ID (diff)
From: Ilya Lipnitskiy <ilya.lipnitskiy@gmail.com>
To: Felix Fietkau <nbd@nbd.name>, John Crispin <john@phrozen.org>,
	Sean Wang <sean.wang@mediatek.com>,
	Mark Lee <Mark-MC.Lee@mediatek.com>,
	"David S. Miller" <davem@davemloft.net>,
	Jakub Kicinski <kuba@kernel.org>,
	Matthias Brugger <matthias.bgg@gmail.com>,
	netdev@vger.kernel.org, linux-kernel@vger.kernel.org,
	linux-arm-kernel@lists.infradead.org,
	linux-mediatek@lists.infradead.org
Cc: Ilya Lipnitskiy <ilya.lipnitskiy@gmail.com>
Subject: [PATCH net-next v2 03/15] net: ethernet: mtk_eth_soc: fix build_skb cleanup
Date: Thu, 22 Apr 2021 22:20:56 -0700	[thread overview]
Message-ID: <20210423052108.423853-4-ilya.lipnitskiy@gmail.com> (raw)
In-Reply-To: <20210423052108.423853-1-ilya.lipnitskiy@gmail.com>

In case build_skb fails, call skb_free_frag on the correct pointer. Also
update the DMA structures with the new mapping before exiting, because
the mapping was successful

Suggested-by: Felix Fietkau <nbd@nbd.name>
Signed-off-by: Ilya Lipnitskiy <ilya.lipnitskiy@gmail.com>
---
 drivers/net/ethernet/mediatek/mtk_eth_soc.c | 5 +++--
 1 file changed, 3 insertions(+), 2 deletions(-)

diff --git a/drivers/net/ethernet/mediatek/mtk_eth_soc.c b/drivers/net/ethernet/mediatek/mtk_eth_soc.c
index 540003f3fcb8..07daa5de8bec 100644
--- a/drivers/net/ethernet/mediatek/mtk_eth_soc.c
+++ b/drivers/net/ethernet/mediatek/mtk_eth_soc.c
@@ -1304,9 +1304,9 @@ static int mtk_poll_rx(struct napi_struct *napi, int budget,
 		/* receive data */
 		skb = build_skb(data, ring->frag_size);
 		if (unlikely(!skb)) {
-			skb_free_frag(new_data);
+			skb_free_frag(data);
 			netdev->stats.rx_dropped++;
-			goto release_desc;
+			goto skip_rx;
 		}
 		skb_reserve(skb, NET_SKB_PAD + NET_IP_ALIGN);
 
@@ -1326,6 +1326,7 @@ static int mtk_poll_rx(struct napi_struct *napi, int budget,
 		skb_record_rx_queue(skb, 0);
 		napi_gro_receive(napi, skb);
 
+skip_rx:
 		ring->data[idx] = new_data;
 		rxd->rxd1 = (unsigned int)dma_addr;
 
-- 
2.31.1


_______________________________________________
Linux-mediatek mailing list
Linux-mediatek@lists.infradead.org
http://lists.infradead.org/mailman/listinfo/linux-mediatek

WARNING: multiple messages have this Message-ID (diff)
From: Ilya Lipnitskiy <ilya.lipnitskiy@gmail.com>
To: Felix Fietkau <nbd@nbd.name>, John Crispin <john@phrozen.org>,
	Sean Wang <sean.wang@mediatek.com>,
	Mark Lee <Mark-MC.Lee@mediatek.com>,
	"David S. Miller" <davem@davemloft.net>,
	Jakub Kicinski <kuba@kernel.org>,
	Matthias Brugger <matthias.bgg@gmail.com>,
	netdev@vger.kernel.org, linux-kernel@vger.kernel.org,
	linux-arm-kernel@lists.infradead.org,
	linux-mediatek@lists.infradead.org
Cc: Ilya Lipnitskiy <ilya.lipnitskiy@gmail.com>
Subject: [PATCH net-next v2 03/15] net: ethernet: mtk_eth_soc: fix build_skb cleanup
Date: Thu, 22 Apr 2021 22:20:56 -0700	[thread overview]
Message-ID: <20210423052108.423853-4-ilya.lipnitskiy@gmail.com> (raw)
In-Reply-To: <20210423052108.423853-1-ilya.lipnitskiy@gmail.com>

In case build_skb fails, call skb_free_frag on the correct pointer. Also
update the DMA structures with the new mapping before exiting, because
the mapping was successful

Suggested-by: Felix Fietkau <nbd@nbd.name>
Signed-off-by: Ilya Lipnitskiy <ilya.lipnitskiy@gmail.com>
---
 drivers/net/ethernet/mediatek/mtk_eth_soc.c | 5 +++--
 1 file changed, 3 insertions(+), 2 deletions(-)

diff --git a/drivers/net/ethernet/mediatek/mtk_eth_soc.c b/drivers/net/ethernet/mediatek/mtk_eth_soc.c
index 540003f3fcb8..07daa5de8bec 100644
--- a/drivers/net/ethernet/mediatek/mtk_eth_soc.c
+++ b/drivers/net/ethernet/mediatek/mtk_eth_soc.c
@@ -1304,9 +1304,9 @@ static int mtk_poll_rx(struct napi_struct *napi, int budget,
 		/* receive data */
 		skb = build_skb(data, ring->frag_size);
 		if (unlikely(!skb)) {
-			skb_free_frag(new_data);
+			skb_free_frag(data);
 			netdev->stats.rx_dropped++;
-			goto release_desc;
+			goto skip_rx;
 		}
 		skb_reserve(skb, NET_SKB_PAD + NET_IP_ALIGN);
 
@@ -1326,6 +1326,7 @@ static int mtk_poll_rx(struct napi_struct *napi, int budget,
 		skb_record_rx_queue(skb, 0);
 		napi_gro_receive(napi, skb);
 
+skip_rx:
 		ring->data[idx] = new_data;
 		rxd->rxd1 = (unsigned int)dma_addr;
 
-- 
2.31.1


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

  parent reply	other threads:[~2021-04-23  5:21 UTC|newest]

Thread overview: 51+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2021-04-23  5:20 [PATCH net-next v2 00/15] mtk_eth_soc: fixes and performance improvements Ilya Lipnitskiy
2021-04-23  5:20 ` Ilya Lipnitskiy
2021-04-23  5:20 ` Ilya Lipnitskiy
2021-04-23  5:20 ` [PATCH net-next v2 01/15] net: ethernet: mtk_eth_soc: fix RX VLAN offload Ilya Lipnitskiy
2021-04-23  5:20   ` Ilya Lipnitskiy
2021-04-23  5:20   ` Ilya Lipnitskiy
2021-04-23  5:20 ` [PATCH net-next v2 02/15] net: ethernet: mtk_eth_soc: unmap RX data before calling build_skb Ilya Lipnitskiy
2021-04-23  5:20   ` Ilya Lipnitskiy
2021-04-23  5:20   ` Ilya Lipnitskiy
2021-04-23  5:20 ` Ilya Lipnitskiy [this message]
2021-04-23  5:20   ` [PATCH net-next v2 03/15] net: ethernet: mtk_eth_soc: fix build_skb cleanup Ilya Lipnitskiy
2021-04-23  5:20   ` Ilya Lipnitskiy
2021-04-23  5:20 ` [PATCH net-next v2 04/15] net: ethernet: mtk_eth_soc: use napi_consume_skb Ilya Lipnitskiy
2021-04-23  5:20   ` Ilya Lipnitskiy
2021-04-23  5:20   ` Ilya Lipnitskiy
2021-04-23  5:20 ` [PATCH net-next v2 05/15] net: ethernet: mtk_eth_soc: reduce MDIO bus access latency Ilya Lipnitskiy
2021-04-23  5:20   ` Ilya Lipnitskiy
2021-04-23  5:20   ` Ilya Lipnitskiy
2021-04-23  5:20 ` [PATCH net-next v2 06/15] net: ethernet: mtk_eth_soc: remove unnecessary TX queue stops Ilya Lipnitskiy
2021-04-23  5:20   ` Ilya Lipnitskiy
2021-04-23  5:20   ` Ilya Lipnitskiy
2021-04-23  5:21 ` [PATCH net-next v2 07/15] net: ethernet: mtk_eth_soc: use larger burst size for QDMA TX Ilya Lipnitskiy
2021-04-23  5:21   ` Ilya Lipnitskiy
2021-04-23  5:21   ` Ilya Lipnitskiy
2021-04-23  5:21 ` [PATCH net-next v2 08/15] net: ethernet: mtk_eth_soc: increase DMA ring sizes Ilya Lipnitskiy
2021-04-23  5:21   ` Ilya Lipnitskiy
2021-04-23  5:21   ` Ilya Lipnitskiy
2021-04-23  5:21 ` [PATCH net-next v2 09/15] net: ethernet: mtk_eth_soc: implement dynamic interrupt moderation Ilya Lipnitskiy
2021-04-23  5:21   ` Ilya Lipnitskiy
2021-04-23  5:21   ` Ilya Lipnitskiy
2021-04-23  5:21 ` [PATCH net-next v2 10/15] net: ethernet: mtk_eth_soc: cache HW pointer of last freed TX descriptor Ilya Lipnitskiy
2021-04-23  5:21   ` Ilya Lipnitskiy
2021-04-23  5:21   ` Ilya Lipnitskiy
2021-04-23  5:21 ` [PATCH net-next v2 11/15] net: ethernet: mtk_eth_soc: only read the full RX descriptor if DMA is done Ilya Lipnitskiy
2021-04-23  5:21   ` Ilya Lipnitskiy
2021-04-23  5:21   ` Ilya Lipnitskiy
2021-04-23  5:21 ` [PATCH net-next v2 12/15] net: ethernet: mtk_eth_soc: reduce unnecessary interrupts Ilya Lipnitskiy
2021-04-23  5:21   ` Ilya Lipnitskiy
2021-04-23  5:21   ` Ilya Lipnitskiy
2021-04-23  5:21 ` [PATCH net-next v2 13/15] net: ethernet: mtk_eth_soc: rework NAPI callbacks Ilya Lipnitskiy
2021-04-23  5:21   ` Ilya Lipnitskiy
2021-04-23  5:21   ` Ilya Lipnitskiy
2021-04-23  5:21 ` [PATCH net-next v2 14/15] net: ethernet: mtk_eth_soc: set PPE flow hash as skb hash if present Ilya Lipnitskiy
2021-04-23  5:21   ` Ilya Lipnitskiy
2021-04-23  5:21   ` Ilya Lipnitskiy
2021-04-23  5:21 ` [PATCH net-next v2 15/15] net: ethernet: mtk_eth_soc: use iopoll.h macro for DMA init Ilya Lipnitskiy
2021-04-23  5:21   ` Ilya Lipnitskiy
2021-04-23  5:21   ` Ilya Lipnitskiy
2021-04-23 21:00 ` [PATCH net-next v2 00/15] mtk_eth_soc: fixes and performance improvements patchwork-bot+netdevbpf
2021-04-23 21:00   ` patchwork-bot+netdevbpf
2021-04-23 21:00   ` patchwork-bot+netdevbpf

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=20210423052108.423853-4-ilya.lipnitskiy@gmail.com \
    --to=ilya.lipnitskiy@gmail.com \
    --cc=Mark-MC.Lee@mediatek.com \
    --cc=davem@davemloft.net \
    --cc=john@phrozen.org \
    --cc=kuba@kernel.org \
    --cc=linux-arm-kernel@lists.infradead.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=linux-mediatek@lists.infradead.org \
    --cc=matthias.bgg@gmail.com \
    --cc=nbd@nbd.name \
    --cc=netdev@vger.kernel.org \
    --cc=sean.wang@mediatek.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 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.