[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <20240619200253.GY690967@kernel.org>
Date: Wed, 19 Jun 2024 21:02:53 +0100
From: Simon Horman <horms@...nel.org>
To: Michael Chan <michael.chan@...adcom.com>
Cc: davem@...emloft.net, netdev@...r.kernel.org, edumazet@...gle.com,
kuba@...nel.org, pabeni@...hat.com, pavan.chebbi@...adcom.com,
andrew.gospodarek@...adcom.com
Subject: Re: [PATCH net 3/3] bnxt_en: Restore PTP tx_avail count in case of
skb_pad() error
On Tue, Jun 18, 2024 at 02:53:13PM -0700, Michael Chan wrote:
> From: Pavan Chebbi <pavan.chebbi@...adcom.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@...adcom.com>
> Signed-off-by: Pavan Chebbi <pavan.chebbi@...adcom.com>
> Signed-off-by: Michael Chan <michael.chan@...adcom.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@...nel.org>
Powered by blists - more mailing lists