From: Mohammad Shuab Siddique <[email protected]>

bnxt_dev_start_op() unconditionally enabled
RTE_ETH_TX_OFFLOAD_MBUF_FAST_FREE on every Tx queue that wasn't in
the PTP/1588 path, overriding any offload configuration the
application had explicitly requested via rte_eth_dev_configure()/
rte_eth_tx_queue_setup(). Applications that need mbuf refcnt tracking
(and therefore must keep this offload disabled) had no way to do so.

Track whether the offload was actually requested at queue-setup time
and only re-enable it in bnxt_dev_start_op() when it was.

Fixes: 5722ed1aafd2 ("net/bnxt: support timestamp parsing in Tx")
Cc: [email protected]

Signed-off-by: Dakota Sicher <[email protected]>
Signed-off-by: Mohammad Shuab Siddique <[email protected]>
---
 drivers/net/bnxt/bnxt_ethdev.c | 3 ++-
 drivers/net/bnxt/bnxt_txq.c    | 3 +++
 drivers/net/bnxt/bnxt_txq.h    | 1 +
 3 files changed, 6 insertions(+), 1 deletion(-)

diff --git a/drivers/net/bnxt/bnxt_ethdev.c b/drivers/net/bnxt/bnxt_ethdev.c
index 8e8ead8f61..9f5be8e24b 100644
--- a/drivers/net/bnxt/bnxt_ethdev.c
+++ b/drivers/net/bnxt/bnxt_ethdev.c
@@ -1939,7 +1939,8 @@ int bnxt_dev_start_op(struct rte_eth_dev *eth_dev)
                                        
RTE_MIN(rte_align32pow2(txq->nb_tx_desc) / 4,
                                                RTE_BNXT_MAX_TX_BURST);
                } else {
-                       txq->offloads |= RTE_ETH_TX_OFFLOAD_MBUF_FAST_FREE;
+                       if (txq->fast_free_requested)
+                               txq->offloads |= 
RTE_ETH_TX_OFFLOAD_MBUF_FAST_FREE;
                        txq->tx_free_thresh =
                                RTE_MIN(rte_align32pow2(txq->nb_tx_desc) / 4,
                                        RTE_BNXT_MAX_TX_BURST);
diff --git a/drivers/net/bnxt/bnxt_txq.c b/drivers/net/bnxt/bnxt_txq.c
index 03407c556a..f6b858c15b 100644
--- a/drivers/net/bnxt/bnxt_txq.c
+++ b/drivers/net/bnxt/bnxt_txq.c
@@ -177,6 +177,9 @@ int bnxt_tx_queue_setup_op(struct rte_eth_dev *eth_dev,
                txq->tx_free_thresh = RTE_BNXT_MIN_TX_BURST;
        txq->offloads = eth_dev->data->dev_conf.txmode.offloads |
                        tx_conf->offloads;
+       txq->fast_free_requested =
+               (txq->offloads & RTE_ETH_TX_OFFLOAD_MBUF_FAST_FREE) != 0;
+
        /* mbuf fast free not supported for the following. Reset the bit */
        if (bp->ieee_1588)
                txq->offloads &= ~RTE_ETH_TX_OFFLOAD_MBUF_FAST_FREE;
diff --git a/drivers/net/bnxt/bnxt_txq.h b/drivers/net/bnxt/bnxt_txq.h
index ac8af91c57..ffaac986c7 100644
--- a/drivers/net/bnxt/bnxt_txq.h
+++ b/drivers/net/bnxt/bnxt_txq.h
@@ -22,6 +22,7 @@ struct bnxt_tx_queue {
        uint8_t                 wthresh; /* Write-back threshold reg */
        uint8_t                 tx_deferred_start; /* not in global dev start */
        uint8_t                 tx_started; /* TX queue is started */
+       bool                    fast_free_requested;
 
        struct bnxt             *bp;
        int                     index;
-- 
2.47.3

Reply via email to