netdev.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: Jakub Kicinski <jakub.kicinski@netronome.com>
To: davem@davemloft.net
Cc: netdev@vger.kernel.org, oss-drivers@netronome.com,
	alexei.starovoitov@gmail.com,
	Jakub Kicinski <jakub.kicinski@netronome.com>,
	Dirk van der Merwe <dirk.vandermerwe@netronome.com>
Subject: [PATCH net-next 01/13] nfp: count all failed TX attempts as errors
Date: Wed,  5 Jun 2019 14:11:31 -0700	[thread overview]
Message-ID: <20190605211143.29689-2-jakub.kicinski@netronome.com> (raw)
In-Reply-To: <20190605211143.29689-1-jakub.kicinski@netronome.com>

Currently if we need to modify the head of the skb and allocation
fails we would free the skb and not increment the error counter.
Make sure all errors are counted.

Signed-off-by: Jakub Kicinski <jakub.kicinski@netronome.com>
Reviewed-by: Dirk van der Merwe <dirk.vandermerwe@netronome.com>
---
 drivers/net/ethernet/netronome/nfp/nfp_net_common.c | 12 +++++-------
 1 file changed, 5 insertions(+), 7 deletions(-)

diff --git a/drivers/net/ethernet/netronome/nfp/nfp_net_common.c b/drivers/net/ethernet/netronome/nfp/nfp_net_common.c
index b82b684f52ce..0c163b086de5 100644
--- a/drivers/net/ethernet/netronome/nfp/nfp_net_common.c
+++ b/drivers/net/ethernet/netronome/nfp/nfp_net_common.c
@@ -873,17 +873,14 @@ static int nfp_net_tx(struct sk_buff *skb, struct net_device *netdev)
 	}
 
 	md_bytes = nfp_net_prep_port_id(skb);
-	if (unlikely(md_bytes < 0)) {
-		nfp_net_tx_xmit_more_flush(tx_ring);
-		dev_kfree_skb_any(skb);
-		return NETDEV_TX_OK;
-	}
+	if (unlikely(md_bytes < 0))
+		goto err_flush;
 
 	/* Start with the head skbuf */
 	dma_addr = dma_map_single(dp->dev, skb->data, skb_headlen(skb),
 				  DMA_TO_DEVICE);
 	if (dma_mapping_error(dp->dev, dma_addr))
-		goto err_free;
+		goto err_dma_err;
 
 	wr_idx = D_IDX(tx_ring, tx_ring->wr_p);
 
@@ -979,8 +976,9 @@ static int nfp_net_tx(struct sk_buff *skb, struct net_device *netdev)
 	tx_ring->txbufs[wr_idx].skb = NULL;
 	tx_ring->txbufs[wr_idx].dma_addr = 0;
 	tx_ring->txbufs[wr_idx].fidx = -2;
-err_free:
+err_dma_err:
 	nn_dp_warn(dp, "Failed to map DMA TX buffer\n");
+err_flush:
 	nfp_net_tx_xmit_more_flush(tx_ring);
 	u64_stats_update_begin(&r_vec->tx_sync);
 	r_vec->tx_errors++;
-- 
2.21.0


  reply	other threads:[~2019-06-05 21:12 UTC|newest]

Thread overview: 15+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2019-06-05 21:11 [PATCH net-next 00/13] nfp: tls: add basic TX offload Jakub Kicinski
2019-06-05 21:11 ` Jakub Kicinski [this message]
2019-06-05 21:11 ` [PATCH net-next 02/13] nfp: make bar_lock a semaphore Jakub Kicinski
2019-06-05 21:11 ` [PATCH net-next 03/13] nfp: parse the mailbox cmsg TLV Jakub Kicinski
2019-06-05 21:11 ` [PATCH net-next 04/13] nfp: add support for sending control messages via mailbox Jakub Kicinski
2019-06-05 21:11 ` [PATCH net-next 05/13] nfp: parse crypto opcode TLV Jakub Kicinski
2019-06-05 21:11 ` [PATCH net-next 06/13] nfp: add tls init code Jakub Kicinski
2019-06-05 21:11 ` [PATCH net-next 07/13] nfp: prepare for more TX metadata prepend Jakub Kicinski
2019-06-05 21:11 ` [PATCH net-next 08/13] net/tls: split the TLS_DRIVER_STATE_SIZE and bump TX to 16 bytes Jakub Kicinski
2019-06-05 21:11 ` [PATCH net-next 09/13] net/tls: simplify driver context retrieval Jakub Kicinski
2019-06-05 21:11 ` [PATCH net-next 10/13] net/tls: export TLS per skb encryption Jakub Kicinski
2019-06-05 21:11 ` [PATCH net-next 11/13] nfp: tls: add datapath support for TLS TX Jakub Kicinski
2019-06-05 21:11 ` [PATCH net-next 12/13] nfp: tls: add/delete TLS TX connections Jakub Kicinski
2019-06-05 21:11 ` [PATCH net-next 13/13] nfp: tls: add basic statistics Jakub Kicinski
2019-06-06 21:13 ` [PATCH net-next 00/13] nfp: tls: add basic TX offload David Miller

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=20190605211143.29689-2-jakub.kicinski@netronome.com \
    --to=jakub.kicinski@netronome.com \
    --cc=alexei.starovoitov@gmail.com \
    --cc=davem@davemloft.net \
    --cc=dirk.vandermerwe@netronome.com \
    --cc=netdev@vger.kernel.org \
    --cc=oss-drivers@netronome.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).