public inbox for netdev@vger.kernel.org 
 help / color / mirror / Atom feed
From: Michael Chan <michael.chan@broadcom•com>
To: davem@davemloft•net
Cc: netdev@vger•kernel.org, edumazet@google•com, kuba@kernel•org,
	pabeni@redhat•com, pavan.chebbi@broadcom•com,
	andrew.gospodarek@broadcom•com
Subject: [PATCH net 3/3] bnxt_en: Restore PTP tx_avail count in case of skb_pad() error
Date: Tue, 18 Jun 2024 14:53:13 -0700	[thread overview]
Message-ID: <20240618215313.29631-4-michael.chan@broadcom.com> (raw)
In-Reply-To: <20240618215313.29631-1-michael.chan@broadcom.com>

[-- Attachment #1: Type: text/plain, Size: 1552 bytes --]

From: Pavan Chebbi <pavan.chebbi@broadcom•com>

The current code only restores PTP tx_avail count when we get DMA
mapping errors.  Fix it so that the PTP tx_avail count will be
restored for both DMA mapping errors and skb_pad() errors.
Otherwise PTP TX timestamp will not be available after a PTP
packet hits the skb_pad() error.

Fixes: 83bb623c968e ("bnxt_en: Transmit and retrieve packet timestamps"
Reviewed-by: Andy Gospodarek <andrew.gospodarek@broadcom•com>
Signed-off-by: Pavan Chebbi <pavan.chebbi@broadcom•com>
Signed-off-by: Michael Chan <michael.chan@broadcom•com>
---
 drivers/net/ethernet/broadcom/bnxt/bnxt.c | 5 ++---
 1 file changed, 2 insertions(+), 3 deletions(-)

diff --git a/drivers/net/ethernet/broadcom/bnxt/bnxt.c b/drivers/net/ethernet/broadcom/bnxt/bnxt.c
index 89d29d6d7517..a6d69a45fa01 100644
--- a/drivers/net/ethernet/broadcom/bnxt/bnxt.c
+++ b/drivers/net/ethernet/broadcom/bnxt/bnxt.c
@@ -732,9 +732,6 @@ static netdev_tx_t bnxt_start_xmit(struct sk_buff *skb, struct net_device *dev)
 	return NETDEV_TX_OK;
 
 tx_dma_error:
-	if (BNXT_TX_PTP_IS_SET(lflags))
-		atomic_inc(&bp->ptp_cfg->tx_avail);
-
 	last_frag = i;
 
 	/* start back at beginning and unmap skb */
@@ -756,6 +753,8 @@ static netdev_tx_t bnxt_start_xmit(struct sk_buff *skb, struct net_device *dev)
 tx_free:
 	dev_kfree_skb_any(skb);
 tx_kick_pending:
+	if (BNXT_TX_PTP_IS_SET(lflags))
+		atomic_inc(&bp->ptp_cfg->tx_avail);
 	if (txr->kick_pending)
 		bnxt_txr_db_kick(bp, txr, txr->tx_prod);
 	txr->tx_buf_ring[txr->tx_prod].skb = NULL;
-- 
2.30.1


[-- Attachment #2: S/MIME Cryptographic Signature --]
[-- Type: application/pkcs7-signature, Size: 4209 bytes --]

  parent reply	other threads:[~2024-06-18 21:54 UTC|newest]

Thread overview: 12+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2024-06-18 21:53 [PATCH net 0/3] bnxt_en: Bug fixes for net Michael Chan
2024-06-18 21:53 ` [PATCH net 1/3] bnxt_en: Update firmware interface to 1.10.3.44 Michael Chan
2024-06-19 20:02   ` Simon Horman
2024-06-18 21:53 ` [PATCH net 2/3] bnxt_en: Set TSO max segs on devices with limits Michael Chan
2024-06-20  0:13   ` Jakub Kicinski
2024-06-20  6:50     ` Michael Chan
2024-06-20 13:45       ` Jakub Kicinski
2024-06-20  8:11     ` Eric Dumazet
2024-06-18 21:53 ` Michael Chan [this message]
2024-06-19 20:02   ` [PATCH net 3/3] bnxt_en: Restore PTP tx_avail count in case of skb_pad() error Simon Horman
2024-06-19 20:04     ` Simon Horman
2024-06-20 14:00 ` [PATCH net 0/3] bnxt_en: Bug fixes for net 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=20240618215313.29631-4-michael.chan@broadcom.com \
    --to=michael.chan@broadcom$(echo .)com \
    --cc=andrew.gospodarek@broadcom$(echo .)com \
    --cc=davem@davemloft$(echo .)net \
    --cc=edumazet@google$(echo .)com \
    --cc=kuba@kernel$(echo .)org \
    --cc=netdev@vger$(echo .)kernel.org \
    --cc=pabeni@redhat$(echo .)com \
    --cc=pavan.chebbi@broadcom$(echo .)com \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html
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