From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from dpdk.org (dpdk.org [92.243.14.124]) by inbox.dpdk.org (Postfix) with ESMTP id 411AAA2EDB for ; Wed, 2 Oct 2019 19:18:31 +0200 (CEST) Received: from [92.243.14.124] (localhost [127.0.0.1]) by dpdk.org (Postfix) with ESMTP id 084871BF41; Wed, 2 Oct 2019 19:18:05 +0200 (CEST) Received: from rnd-relay.smtp.broadcom.com (unknown [192.19.229.170]) by dpdk.org (Postfix) with ESMTP id 5BA981BF1D; Wed, 2 Oct 2019 19:17:53 +0200 (CEST) Received: from mail-irv-17.broadcom.com (mail-irv-17.lvn.broadcom.net [10.75.242.48]) by rnd-relay.smtp.broadcom.com (Postfix) with ESMTP id 23EA630D330; Wed, 2 Oct 2019 10:16:36 -0700 (PDT) DKIM-Filter: OpenDKIM Filter v2.10.3 rnd-relay.smtp.broadcom.com 23EA630D330 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=broadcom.com; s=dkimrelay; t=1570036596; bh=uzPIwhuDVILV+YOQeP5OUFD18rw+BiMSuvdr81ITp1c=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=vxYleUKR5HKRu9yiKXSdOiMxFgQjTT+/KPS1ou0OvqIzwxhu7LPjzw94uuR+RI0K8 dUSZGTk1ErX6rM4jNxsQbokly3brAMBRlps9WeJXsThiwlIbxkWcp/o/RX6V4JAYJP qTYV8LlBkeMa5dOjI8lTKbPje6+iaWXSdPn/OVwU= Received: from C02VPB22HTD6.wifi.broadcom.net (c02vpb22htd6.wifi.broadcom.net [10.69.74.102]) by mail-irv-17.broadcom.com (Postfix) with ESMTP id F2A5714008E; Wed, 2 Oct 2019 10:17:47 -0700 (PDT) From: Ajit Khaparde To: dev@dpdk.org Cc: ferruh.yigit@intel.com, Kalesh AP , stable@dpdk.org, Lance Richardson Date: Wed, 2 Oct 2019 10:17:32 -0700 Message-Id: <20191002171745.4504-4-ajit.khaparde@broadcom.com> X-Mailer: git-send-email 2.20.1 (Apple Git-117) In-Reply-To: <20191002171745.4504-1-ajit.khaparde@broadcom.com> References: <20191002055423.99659-1-ajit.khaparde@broadcom.com> <20191002171745.4504-1-ajit.khaparde@broadcom.com> MIME-Version: 1.0 Content-Transfer-Encoding: 8bit Subject: [dpdk-dev] [PATCH v3 03/16] net/bnxt: fix rxq stop/start handling X-BeenThere: dev@dpdk.org X-Mailman-Version: 2.1.15 Precedence: list List-Id: DPDK patches and discussions List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: dev-bounces@dpdk.org Sender: "dev" From: Kalesh AP 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 Signed-off-by: Lance Richardson Reviewed-by: Ajit Khaparde --- drivers/net/bnxt/bnxt_ethdev.c | 2 +- drivers/net/bnxt/bnxt_ring.c | 3 +-- drivers/net/bnxt/bnxt_rxq.c | 36 +++++++++++++++++++--------- drivers/net/bnxt/bnxt_rxq.h | 1 + drivers/net/bnxt/bnxt_rxr.c | 7 +++--- drivers/net/bnxt/bnxt_rxtx_vec_sse.c | 2 +- 6 files changed, 32 insertions(+), 19 deletions(-) diff --git a/drivers/net/bnxt/bnxt_ethdev.c b/drivers/net/bnxt/bnxt_ethdev.c index 4095e9c720..d1c5acb3e2 100644 --- a/drivers/net/bnxt/bnxt_ethdev.c +++ b/drivers/net/bnxt/bnxt_ethdev.c @@ -1945,7 +1945,7 @@ bnxt_rxq_info_get_op(struct rte_eth_dev *dev, uint16_t queue_id, 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; } static void diff --git a/drivers/net/bnxt/bnxt_ring.c b/drivers/net/bnxt/bnxt_ring.c index 73eee43148..68a690de5a 100644 --- a/drivers/net/bnxt/bnxt_ring.c +++ b/drivers/net/bnxt/bnxt_ring.c @@ -561,8 +561,7 @@ int bnxt_alloc_hwrm_rx_ring(struct bnxt *bp, int queue_index) if (rc) goto err_out; - if (bp->eth_dev->data->rx_queue_state[queue_index] == - RTE_ETH_QUEUE_STATE_STARTED) { + if (!rxq->rx_started) { if (bnxt_init_one_rx_ring(rxq)) { RTE_LOG(ERR, PMD, "bnxt_init_one_rx_ring failed!\n"); diff --git a/drivers/net/bnxt/bnxt_rxq.c b/drivers/net/bnxt/bnxt_rxq.c index 192ffd8780..4b506f8653 100644 --- a/drivers/net/bnxt/bnxt_rxq.c +++ b/drivers/net/bnxt/bnxt_rxq.c @@ -357,9 +357,19 @@ int bnxt_rx_queue_setup_op(struct rte_eth_dev *eth_dev, } 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); @@ -432,6 +442,11 @@ int bnxt_rx_queue_start(struct rte_eth_dev *dev, uint16_t rx_queue_id) return -EINVAL; } + /* 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) @@ -448,20 +463,19 @@ int bnxt_rx_queue_start(struct rte_eth_dev *dev, uint16_t rx_queue_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); } - if (rc == 0) { + if (rc == 0) 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", @@ -500,7 +514,7 @@ int bnxt_rx_queue_stop(struct rte_eth_dev *dev, uint16_t rx_queue_id) } 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) { diff --git a/drivers/net/bnxt/bnxt_rxq.h b/drivers/net/bnxt/bnxt_rxq.h index c60b04426c..3693d89a60 100644 --- a/drivers/net/bnxt/bnxt_rxq.h +++ b/drivers/net/bnxt/bnxt_rxq.h @@ -30,6 +30,7 @@ struct bnxt_rx_queue { 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; diff --git a/drivers/net/bnxt/bnxt_rxr.c b/drivers/net/bnxt/bnxt_rxr.c index f60880c63e..b3cc0d8a04 100644 --- a/drivers/net/bnxt/bnxt_rxr.c +++ b/drivers/net/bnxt/bnxt_rxr.c @@ -574,10 +574,9 @@ uint16_t bnxt_recv_pkts(void *rx_queue, struct rte_mbuf **rx_pkts, 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 */ diff --git a/drivers/net/bnxt/bnxt_rxtx_vec_sse.c b/drivers/net/bnxt/bnxt_rxtx_vec_sse.c index 2e6e83c949..5ae812f3b9 100644 --- a/drivers/net/bnxt/bnxt_rxtx_vec_sse.c +++ b/drivers/net/bnxt/bnxt_rxtx_vec_sse.c @@ -224,7 +224,7 @@ bnxt_recv_pkts_vec(void *rx_queue, struct rte_mbuf **rx_pkts, 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) -- 2.20.1 (Apple Git-117)