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 A97AEA2EDB for ; Wed, 2 Oct 2019 19:19:43 +0200 (CEST) Received: from [92.243.14.124] (localhost [127.0.0.1]) by dpdk.org (Postfix) with ESMTP id 5869E1BF8E; Wed, 2 Oct 2019 19:18:18 +0200 (CEST) Received: from rnd-relay.smtp.broadcom.com (unknown [192.19.229.170]) by dpdk.org (Postfix) with ESMTP id 79B221BF29 for ; Wed, 2 Oct 2019 19:17:54 +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 B25E330D36F; Wed, 2 Oct 2019 10:16:36 -0700 (PDT) DKIM-Filter: OpenDKIM Filter v2.10.3 rnd-relay.smtp.broadcom.com B25E330D36F DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=broadcom.com; s=dkimrelay; t=1570036596; bh=kEclmymkzIuPieqNGvTixgNLM/Rfd9+YiOmrgryoMH4=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=ESIoXpp4eo1C7HKCiUNIPJBO/4kr38HsmdG7Nh2JJpxctaRoHMcEk2rwEAEAuHjSB ybLX5vN9BDKl3pqPZat8y7EkhBo1PZdNKF9CCO71w/4GjUvVmGS3ARhH84UAqYPYsy jnLe0sKYEJfbLnikjIUl7E+/fBdQJ5AwUlLReuVQ= Received: from C02VPB22HTD6.wifi.broadcom.net (c02vpb22htd6.wifi.broadcom.net [10.69.74.102]) by mail-irv-17.broadcom.com (Postfix) with ESMTP id 8EF1E14008B; Wed, 2 Oct 2019 10:17:48 -0700 (PDT) From: Ajit Khaparde To: dev@dpdk.org Cc: ferruh.yigit@intel.com, Kalesh AP , Lance Richardson Date: Wed, 2 Oct 2019 10:17:37 -0700 Message-Id: <20191002171745.4504-9-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 08/16] net/bnxt: fix use of deferred start of transmit queues 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 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 Reviewed-by: Lance Richardson Signed-off-by: Ajit Khaparde --- drivers/net/bnxt/bnxt_rxtx_vec_sse.c | 2 +- drivers/net/bnxt/bnxt_txq.c | 5 +++++ drivers/net/bnxt/bnxt_txq.h | 1 + drivers/net/bnxt/bnxt_txr.c | 6 +++--- 4 files changed, 10 insertions(+), 4 deletions(-) diff --git a/drivers/net/bnxt/bnxt_rxtx_vec_sse.c b/drivers/net/bnxt/bnxt_rxtx_vec_sse.c index 5ae812f3b9..029053e305 100644 --- a/drivers/net/bnxt/bnxt_rxtx_vec_sse.c +++ b/drivers/net/bnxt/bnxt_rxtx_vec_sse.c @@ -482,7 +482,7 @@ bnxt_xmit_pkts_vec(void *tx_queue, struct rte_mbuf **tx_pkts, struct bnxt_tx_queue *txq = tx_queue; /* Tx queue was stopped; wait for it to be restarted */ - if (unlikely(txq->tx_deferred_start)) { + if (unlikely(!txq->tx_started)) { PMD_DRV_LOG(DEBUG, "Tx q stopped;return\n"); return 0; } diff --git a/drivers/net/bnxt/bnxt_txq.c b/drivers/net/bnxt/bnxt_txq.c index 0901324793..ea20d737fe 100644 --- a/drivers/net/bnxt/bnxt_txq.c +++ b/drivers/net/bnxt/bnxt_txq.c @@ -131,6 +131,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) @@ -157,6 +158,10 @@ 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 9190e3f731..7a442516d2 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 172b480b2e..99d2009055 100644 --- a/drivers/net/bnxt/bnxt_txr.c +++ b/drivers/net/bnxt/bnxt_txr.c @@ -469,7 +469,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; } @@ -518,7 +518,7 @@ int bnxt_tx_queue_start(struct rte_eth_dev *dev, uint16_t tx_queue_id) return rc; 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; @@ -538,7 +538,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.20.1 (Apple Git-117)