netdev.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: Simon Horman <horms@kernel.org>
To: Michael Chan <michael.chan@broadcom.com>
Cc: davem@davemloft.net, netdev@vger.kernel.org, edumazet@google.com,
	kuba@kernel.org, pabeni@redhat.com, pavan.chebbi@broadcom.com,
	andrew.gospodarek@broadcom.com
Subject: Re: [PATCH net 3/3] bnxt_en: Restore PTP tx_avail count in case of skb_pad() error
Date: Wed, 19 Jun 2024 21:02:53 +0100	[thread overview]
Message-ID: <20240619200253.GY690967@kernel.org> (raw)
In-Reply-To: <20240618215313.29631-4-michael.chan@broadcom.com>

On Tue, Jun 18, 2024 at 02:53:13PM -0700, Michael Chan wrote:
> 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;

This now also applies to jumps to tx_free.

I assume that is fine because although atomic_dec_if_positive() called on
&bp->ptp_cfg->tx_avail, has not net been called, neither has the bit
TX_BD_FLAGS_STAMP of lflags been set.

Reviewed-by: Simon Horman <horms@kernel.org>


  reply	other threads:[~2024-06-19 20:02 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 ` [PATCH net 3/3] bnxt_en: Restore PTP tx_avail count in case of skb_pad() error Michael Chan
2024-06-19 20:02   ` Simon Horman [this message]
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=20240619200253.GY690967@kernel.org \
    --to=horms@kernel.org \
    --cc=andrew.gospodarek@broadcom.com \
    --cc=davem@davemloft.net \
    --cc=edumazet@google.com \
    --cc=kuba@kernel.org \
    --cc=michael.chan@broadcom.com \
    --cc=netdev@vger.kernel.org \
    --cc=pabeni@redhat.com \
    --cc=pavan.chebbi@broadcom.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).