Netdev List
 help / color / mirror / Atom feed
* [PATCH 1/2] net: netsec: remove superfluous if statement
@ 2019-07-09 21:14 Ilias Apalodimas
  2019-07-09 21:14 ` [PATCH 2/2] net: netsec: remove static declaration for netsec_set_tx_de() Ilias Apalodimas
  2019-07-09 21:46 ` [PATCH 1/2] net: netsec: remove superfluous if statement David Miller
  0 siblings, 2 replies; 4+ messages in thread
From: Ilias Apalodimas @ 2019-07-09 21:14 UTC (permalink / raw)
  To: netdev, jaswinder.singh, davem; +Cc: Ilias Apalodimas

While freeing tx buffers the memory has to be unmapped if the packet was
an skb or was used for .ndo_xdp_xmit using the same arguments. Get rid
of the unneeded extra 'else if' statement

Signed-off-by: Ilias Apalodimas <ilias.apalodimas@linaro.org>
---
 drivers/net/ethernet/socionext/netsec.c | 8 ++++----
 1 file changed, 4 insertions(+), 4 deletions(-)

diff --git a/drivers/net/ethernet/socionext/netsec.c b/drivers/net/ethernet/socionext/netsec.c
index c3a4f86f56ee..7f9280f1fb28 100644
--- a/drivers/net/ethernet/socionext/netsec.c
+++ b/drivers/net/ethernet/socionext/netsec.c
@@ -654,12 +654,12 @@ static bool netsec_clean_tx_dring(struct netsec_priv *priv)
 		eop = (entry->attr >> NETSEC_TX_LAST) & 1;
 		dma_rmb();
 
-		if (desc->buf_type == TYPE_NETSEC_SKB)
+		/* if buf_type is either TYPE_NETSEC_SKB or
+		 * TYPE_NETSEC_XDP_NDO we mapped it
+		 */
+		if (desc->buf_type != TYPE_NETSEC_XDP_TX)
 			dma_unmap_single(priv->dev, desc->dma_addr, desc->len,
 					 DMA_TO_DEVICE);
-		else if (desc->buf_type == TYPE_NETSEC_XDP_NDO)
-			dma_unmap_single(priv->dev, desc->dma_addr,
-					 desc->len, DMA_TO_DEVICE);
 
 		if (!eop)
 			goto next;
-- 
2.20.1


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

end of thread, other threads:[~2019-07-09 21:47 UTC | newest]

Thread overview: 4+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2019-07-09 21:14 [PATCH 1/2] net: netsec: remove superfluous if statement Ilias Apalodimas
2019-07-09 21:14 ` [PATCH 2/2] net: netsec: remove static declaration for netsec_set_tx_de() Ilias Apalodimas
2019-07-09 21:47   ` David Miller
2019-07-09 21:46 ` [PATCH 1/2] net: netsec: remove superfluous if statement David Miller

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox