Driver should not change "deferred_start" state of the rx 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 receive
functions to determine whether a stopped rx ring should be polled,
introduced a per-rxq flag to track queue stopped/started state.
Fixes:
9b63c6fd70e3 ("net/bnxt: support Rx/Tx queue start/stop")
Cc: stable@dpdk.org
Signed-off-by: Kalesh AP <kalesh-anakkur.purayil@broadcom.com>
Signed-off-by: Lance Richardson <lance.richardson@broadcom.com>
Reviewed-by: Ajit Khaparde <ajit.khaparde@broadcom.com>
qinfo->conf.rx_free_thresh = rxq->rx_free_thresh;
qinfo->conf.rx_drop_en = 0;
qinfo->conf.rx_free_thresh = rxq->rx_free_thresh;
qinfo->conf.rx_drop_en = 0;
- qinfo->conf.rx_deferred_start = 0;
+ qinfo->conf.rx_deferred_start = rxq->rx_deferred_start;
- if (bp->eth_dev->data->rx_queue_state[queue_index] ==
- RTE_ETH_QUEUE_STATE_STARTED) {
if (bnxt_init_one_rx_ring(rxq)) {
RTE_LOG(ERR, PMD,
"bnxt_init_one_rx_ring failed!\n");
if (bnxt_init_one_rx_ring(rxq)) {
RTE_LOG(ERR, PMD,
"bnxt_init_one_rx_ring failed!\n");
}
rte_atomic64_init(&rxq->rx_mbuf_alloc_fail);
}
rte_atomic64_init(&rxq->rx_mbuf_alloc_fail);
- rxq->rx_deferred_start = rx_conf->rx_deferred_start;
- queue_state = rxq->rx_deferred_start ? RTE_ETH_QUEUE_STATE_STOPPED :
- RTE_ETH_QUEUE_STATE_STARTED;
+ /* rxq 0 must not be stopped when used as async CPR */
+ if (!BNXT_NUM_ASYNC_CPR(bp) && queue_idx == 0)
+ rxq->rx_deferred_start = false;
+ else
+ rxq->rx_deferred_start = rx_conf->rx_deferred_start;
+
+ if (rxq->rx_deferred_start) {
+ queue_state = RTE_ETH_QUEUE_STATE_STOPPED;
+ rxq->rx_started = false;
+ } else {
+ queue_state = RTE_ETH_QUEUE_STATE_STARTED;
+ rxq->rx_started = true;
+ }
eth_dev->data->rx_queue_state[queue_idx] = queue_state;
rte_spinlock_init(&rxq->lock);
eth_dev->data->rx_queue_state[queue_idx] = queue_state;
rte_spinlock_init(&rxq->lock);
+ /* Set the queue state to started here.
+ * We check the status of the queue while posting buffer.
+ * If queue is it started, we do not post buffers for Rx.
+ */
+ rxq->rx_started = true;
bnxt_free_hwrm_rx_ring(bp, rx_queue_id);
rc = bnxt_alloc_hwrm_rx_ring(bp, rx_queue_id);
if (rc)
bnxt_free_hwrm_rx_ring(bp, rx_queue_id);
rc = bnxt_alloc_hwrm_rx_ring(bp, rx_queue_id);
if (rc)
vnic->fw_grp_ids[rx_queue_id] =
bp->grp_info[rx_queue_id].fw_grp_id;
vnic->fw_grp_ids[rx_queue_id] =
bp->grp_info[rx_queue_id].fw_grp_id;
+ PMD_DRV_LOG(DEBUG,
+ "vnic = %p fw_grp_id = %d\n",
+ vnic, bp->grp_info[rx_queue_id].fw_grp_id);
- PMD_DRV_LOG(DEBUG,
- "vnic = %p fw_grp_id = %d\n",
- vnic, bp->grp_info[rx_queue_id].fw_grp_id);
-
rc = bnxt_vnic_rss_configure(bp, vnic);
}
rc = bnxt_vnic_rss_configure(bp, vnic);
}
dev->data->rx_queue_state[rx_queue_id] =
RTE_ETH_QUEUE_STATE_STARTED;
dev->data->rx_queue_state[rx_queue_id] =
RTE_ETH_QUEUE_STATE_STARTED;
- rxq->rx_deferred_start = false;
- }
+ else
+ rxq->rx_started = false;
PMD_DRV_LOG(INFO,
"queue %d, rx_deferred_start %d, state %d!\n",
PMD_DRV_LOG(INFO,
"queue %d, rx_deferred_start %d, state %d!\n",
}
dev->data->rx_queue_state[rx_queue_id] = RTE_ETH_QUEUE_STATE_STOPPED;
}
dev->data->rx_queue_state[rx_queue_id] = RTE_ETH_QUEUE_STATE_STOPPED;
- rxq->rx_deferred_start = true;
+ rxq->rx_started = false;
PMD_DRV_LOG(DEBUG, "Rx queue stopped\n");
if (dev_conf->rxmode.mq_mode & ETH_MQ_RX_RSS_FLAG) {
PMD_DRV_LOG(DEBUG, "Rx queue stopped\n");
if (dev_conf->rxmode.mq_mode & ETH_MQ_RX_RSS_FLAG) {
uint16_t port_id; /* Device port identifier */
uint8_t crc_len; /* 0 if CRC stripped, 4 otherwise */
uint8_t rx_deferred_start; /* not in global dev start */
uint16_t port_id; /* Device port identifier */
uint8_t crc_len; /* 0 if CRC stripped, 4 otherwise */
uint8_t rx_deferred_start; /* not in global dev start */
+ uint8_t rx_started; /* RX queue is started */
struct bnxt *bp;
int index;
struct bnxt *bp;
int index;
if (unlikely(is_bnxt_in_error(rxq->bp)))
return 0;
if (unlikely(is_bnxt_in_error(rxq->bp)))
return 0;
- /* If Rx Q was stopped return. RxQ0 cannot be stopped. */
- if (unlikely(((rxq->rx_deferred_start ||
- !rte_spinlock_trylock(&rxq->lock)) &&
- rxq->queue_id)))
+ /* If Rx Q was stopped return */
+ if (unlikely(!rxq->rx_started ||
+ !rte_spinlock_trylock(&rxq->lock)))
return 0;
/* Handle RX burst request */
return 0;
/* Handle RX burst request */
0xFF, 0xFF, 0xFF, 0xFF); /* pkt_type (zeroes) */
/* If Rx Q was stopped return */
0xFF, 0xFF, 0xFF, 0xFF); /* pkt_type (zeroes) */
/* If Rx Q was stopped return */
- if (rxq->rx_deferred_start)
+ if (unlikely(!rxq->rx_started))
return 0;
if (rxq->rxrearm_nb >= RTE_BNXT_RXQ_REARM_THRESH)
return 0;
if (rxq->rxrearm_nb >= RTE_BNXT_RXQ_REARM_THRESH)