Subject: Re: [PATCH net-next 02/10] bnxt_en: Add is_ts_pkt field to struct bnxt_sw_tx_bd

From: Jakub Kicinski <[email-masked]>
Date: Thu, 27 Jun 2024 17:08:07 -0700

On Wed, 26 Jun 2024 09:42:59 -0700 Michael Chan wrote:
> @@ -612,9 +613,11 @@ static netdev_tx_t bnxt_start_xmit(struct sk_buff *skb, struct net_device *dev)
>  normal_tx:
>  	if (length < BNXT_MIN_PKT_SIZE) {
>  		pad = BNXT_MIN_PKT_SIZE - length;
> -		if (skb_pad(skb, pad))
> +		if (skb_pad(skb, pad)) {
>  			/* SKB already freed. */
> +			tx_buf->is_ts_pkt = 0;
>  			goto tx_kick_pending;
> +		}
>  		length = BNXT_MIN_PKT_SIZE;
>  	}

There is a jump to tx_free in between these two, when DMA mapping
head fails. It appears not to clear is_ts_pkt.

Why not add the clearing above the line on the error patch which 
clears the skb pointer?

@@ -771,6 +770,7 @@ static netdev_tx_t bnxt_start_xmit(struct sk_buff *skb, struct net_device *dev)
        if (txr->kick_pending)
                bnxt_txr_db_kick(bp, txr, txr->tx_prod);
        txr->tx_buf_ring[txr->tx_prod].skb = NULL;
+       txr->tx_buf_ring[txr->tx_prod].is_ts_pkt = 0;
        dev_core_stats_tx_dropped_inc(dev);
        return NETDEV_TX_OK;
 }

> @@ -741,6 +744,7 @@ static netdev_tx_t bnxt_start_xmit(struct sk_buff *skb, struct net_device *dev)
>  	/* start back at beginning and unmap skb */
>  	prod = txr->tx_prod;
>  	tx_buf = &txr->tx_buf_ring[RING_TX(bp, prod)];
> +	tx_buf->is_ts_pkt = 0;
>  	dma_unmap_single(&pdev->dev, dma_unmap_addr(tx_buf, mapping),
>  			 skb_headlen(skb), DMA_TO_DEVICE);
>  	prod = NEXT_TX(prod);