[dpdk-stable] [PATCH 18.11 18/19] net/bnxt: fix deferred start of Tx queues
Somnath Kotur
somnath.kotur at broadcom.com
Wed Dec 18 07:24:10 CET 2019
From: Kalesh AP <kalesh-anakkur.purayil at broadcom.com>
[ upstream commit aa2c00702bad7b2c742e11a86cb9dbbb8364fd88 ]
[ upstream commit 3955e26870bcc3336c87d1fabe6ebdf18b2a337b ]
Driver should not change "deferred_start" state of the tx queues.
It should get the state in queue_setup_op() and use that value.
Since the deferred start state was being used in the packet transmit
functions to determine whether the queue has been stopped already,
introduced a per-txq flag to track queue stopped/started state.
Fixes: 9b63c6fd70e3 ("net/bnxt: support Rx/Tx queue start/stop")
Signed-off-by: Kalesh AP <kalesh-anakkur.purayil at broadcom.com>
Signed-off-by: Ajit Khaparde <ajit.khaparde at broadcom.com>
Reviewed-by: Lance Richardson <lance.richardson at broadcom.com>
---
drivers/net/bnxt/bnxt_txq.c | 6 ++++++
drivers/net/bnxt/bnxt_txq.h | 1 +
drivers/net/bnxt/bnxt_txr.c | 6 +++---
3 files changed, 10 insertions(+), 3 deletions(-)
diff --git a/drivers/net/bnxt/bnxt_txq.c b/drivers/net/bnxt/bnxt_txq.c
index b76ad05..cf6ddfb 100644
--- a/drivers/net/bnxt/bnxt_txq.c
+++ b/drivers/net/bnxt/bnxt_txq.c
@@ -113,6 +113,7 @@ int bnxt_tx_queue_setup_op(struct rte_eth_dev *eth_dev,
txq->bp = bp;
txq->nb_tx_desc = nb_desc;
txq->tx_free_thresh = tx_conf->tx_free_thresh;
+ txq->tx_deferred_start = tx_conf->tx_deferred_start;
rc = bnxt_init_tx_ring_struct(txq, socket_id);
if (rc)
@@ -139,6 +140,11 @@ int bnxt_tx_queue_setup_op(struct rte_eth_dev *eth_dev,
eth_dev->data->tx_queues[queue_idx] = txq;
+ if (txq->tx_deferred_start)
+ txq->tx_started = false;
+ else
+ txq->tx_started = true;
+
out:
return rc;
}
diff --git a/drivers/net/bnxt/bnxt_txq.h b/drivers/net/bnxt/bnxt_txq.h
index 720ca90..29b90bf 100644
--- a/drivers/net/bnxt/bnxt_txq.h
+++ b/drivers/net/bnxt/bnxt_txq.h
@@ -24,6 +24,7 @@ struct bnxt_tx_queue {
uint8_t wthresh; /* Write-back threshold reg */
uint32_t ctx_curr; /* Hardware context states */
uint8_t tx_deferred_start; /* not in global dev start */
+ uint8_t tx_started; /* TX queue is started */
struct bnxt *bp;
int index;
diff --git a/drivers/net/bnxt/bnxt_txr.c b/drivers/net/bnxt/bnxt_txr.c
index 95272c9..348b111 100644
--- a/drivers/net/bnxt/bnxt_txr.c
+++ b/drivers/net/bnxt/bnxt_txr.c
@@ -418,7 +418,7 @@ uint16_t bnxt_xmit_pkts(void *tx_queue, struct rte_mbuf **tx_pkts,
bnxt_handle_tx_cp(txq);
/* Tx queue was stopped; wait for it to be restarted */
- if (txq->tx_deferred_start) {
+ if (unlikely(!txq->tx_started)) {
PMD_DRV_LOG(DEBUG, "Tx q stopped;return\n");
return 0;
}
@@ -448,7 +448,7 @@ int bnxt_tx_queue_start(struct rte_eth_dev *dev, uint16_t tx_queue_id)
struct bnxt_tx_queue *txq = bp->tx_queues[tx_queue_id];
dev->data->tx_queue_state[tx_queue_id] = RTE_ETH_QUEUE_STATE_STARTED;
- txq->tx_deferred_start = false;
+ txq->tx_started = true;
PMD_DRV_LOG(DEBUG, "Tx queue started\n");
return 0;
@@ -463,7 +463,7 @@ int bnxt_tx_queue_stop(struct rte_eth_dev *dev, uint16_t tx_queue_id)
bnxt_handle_tx_cp(txq);
dev->data->tx_queue_state[tx_queue_id] = RTE_ETH_QUEUE_STATE_STOPPED;
- txq->tx_deferred_start = true;
+ txq->tx_started = false;
PMD_DRV_LOG(DEBUG, "Tx queue stopped\n");
return 0;
--
2.10.1
More information about the stable
mailing list