From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from mails.dpdk.org (mails.dpdk.org [217.70.189.124]) by inbox.dpdk.org (Postfix) with ESMTP id 6B33642DFB; Fri, 7 Jul 2023 20:53:27 +0200 (CEST) Received: from mails.dpdk.org (localhost [127.0.0.1]) by mails.dpdk.org (Postfix) with ESMTP id F09DF4021F; Fri, 7 Jul 2023 20:53:26 +0200 (CEST) Received: from linux.microsoft.com (linux.microsoft.com [13.77.154.182]) by mails.dpdk.org (Postfix) with ESMTP id C53CC4014F for ; Fri, 7 Jul 2023 20:53:24 +0200 (CEST) Received: by linux.microsoft.com (Postfix, from userid 1004) id D1A1720C08F5; Fri, 7 Jul 2023 11:53:23 -0700 (PDT) DKIM-Filter: OpenDKIM Filter v2.11.0 linux.microsoft.com D1A1720C08F5 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linuxonhyperv.com; s=default; t=1688756003; bh=jIKATJXWLRJzHIv5azjfbetNIklZptGBq8NDpeFZZbA=; h=From:To:Cc:Subject:Date:From; b=T1Uue+OKyVgNj7h2vTz0gTmr2IfSeQG+mTFPCU0r9r2e8XKUtN/iRzcdH5tf6Ar40 yHw8oEa0TxT8DqSIYzWYsRsmVe+yKRE5XhZ0+b87MsTBbHT2OlH05BdHNdlEkVLp+w 1IJh9BrUHT5v5acbVPvHORpjY/1ZR1hqaqsQDcJc= From: longli@linuxonhyperv.com To: Ferruh Yigit , Andrew Rybchenko Cc: dev@dpdk.org, Ajay Sharma , Long Li Subject: [PATCH] net/mana: set the correct queue state Date: Fri, 7 Jul 2023 11:53:15 -0700 Message-Id: <1688755996-25172-1-git-send-email-longli@linuxonhyperv.com> X-Mailer: git-send-email 1.8.3.1 X-BeenThere: dev@dpdk.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: DPDK patches and discussions List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: dev-bounces@dpdk.org From: Long Li Set the queue state when queue is started/stopped Signed-off-by: Long Li --- drivers/net/mana/rx.c | 15 +++++++++++++++ drivers/net/mana/tx.c | 13 +++++++++++++ 2 files changed, 28 insertions(+) diff --git a/drivers/net/mana/rx.c b/drivers/net/mana/rx.c index 220b372b15..1047ac1743 100644 --- a/drivers/net/mana/rx.c +++ b/drivers/net/mana/rx.c @@ -131,6 +131,10 @@ mana_stop_rx_queues(struct rte_eth_dev *dev) struct mana_priv *priv = dev->data->dev_private; int ret, i; + for (i = 0; i < priv->num_queues; i++) + if (dev->data->rx_queue_state[i] == RTE_ETH_QUEUE_STATE_STOPPED) + return -EINVAL; + if (priv->rwq_qp) { ret = ibv_destroy_qp(priv->rwq_qp); if (ret) @@ -187,7 +191,10 @@ mana_stop_rx_queues(struct rte_eth_dev *dev) memset(&rxq->gdma_rq, 0, sizeof(rxq->gdma_rq)); memset(&rxq->gdma_cq, 0, sizeof(rxq->gdma_cq)); + + dev->data->rx_queue_state[i] = RTE_ETH_QUEUE_STATE_STOPPED; } + return 0; } @@ -199,6 +206,11 @@ mana_start_rx_queues(struct rte_eth_dev *dev) struct ibv_wq *ind_tbl[priv->num_queues]; DRV_LOG(INFO, "start rx queues"); + + for (i = 0; i < priv->num_queues; i++) + if (dev->data->rx_queue_state[i] == RTE_ETH_QUEUE_STATE_STARTED) + return -EINVAL; + for (i = 0; i < priv->num_queues; i++) { struct mana_rxq *rxq = dev->data->rx_queues[i]; struct ibv_wq_init_attr wq_attr = {}; @@ -373,6 +385,9 @@ mana_start_rx_queues(struct rte_eth_dev *dev) goto fail; } + for (i = 0; i < priv->num_queues; i++) + dev->data->rx_queue_state[i] = RTE_ETH_QUEUE_STATE_STARTED; + return 0; fail: diff --git a/drivers/net/mana/tx.c b/drivers/net/mana/tx.c index 5947efbe8d..eb4b60cc10 100644 --- a/drivers/net/mana/tx.c +++ b/drivers/net/mana/tx.c @@ -15,6 +15,10 @@ mana_stop_tx_queues(struct rte_eth_dev *dev) struct mana_priv *priv = dev->data->dev_private; int i, ret; + for (i = 0; i < priv->num_queues; i++) + if (dev->data->tx_queue_state[i] == RTE_ETH_QUEUE_STATE_STOPPED) + return -EINVAL; + for (i = 0; i < priv->num_queues; i++) { struct mana_txq *txq = dev->data->tx_queues[i]; @@ -51,6 +55,8 @@ mana_stop_tx_queues(struct rte_eth_dev *dev) memset(&txq->gdma_sq, 0, sizeof(txq->gdma_sq)); memset(&txq->gdma_cq, 0, sizeof(txq->gdma_cq)); + + dev->data->tx_queue_state[i] = RTE_ETH_QUEUE_STATE_STOPPED; } return 0; @@ -63,6 +69,11 @@ mana_start_tx_queues(struct rte_eth_dev *dev) int ret, i; /* start TX queues */ + + for (i = 0; i < priv->num_queues; i++) + if (dev->data->tx_queue_state[i] == RTE_ETH_QUEUE_STATE_STARTED) + return -EINVAL; + for (i = 0; i < priv->num_queues; i++) { struct mana_txq *txq; struct ibv_qp_init_attr qp_attr = { 0 }; @@ -142,6 +153,8 @@ mana_start_tx_queues(struct rte_eth_dev *dev) txq->gdma_cq.id, txq->gdma_cq.buffer, txq->gdma_cq.count, txq->gdma_cq.size, txq->gdma_cq.head); + + dev->data->tx_queue_state[i] = RTE_ETH_QUEUE_STATE_STARTED; } return 0; -- 2.34.1