DPDK patches and discussions
 help / color / mirror / Atom feed
From: "Min Hu (Connor)" <humin29@huawei.com>
To: <dev@dpdk.org>
Cc: <ferruh.yigit@intel.com>
Subject: [dpdk-dev] [PATCH 5/6] net/hns3: fix config max queues to zero when fails
Date: Sun, 13 Jun 2021 10:31:55 +0800	[thread overview]
Message-ID: <1623551516-49635-6-git-send-email-humin29@huawei.com> (raw)
In-Reply-To: <1623551516-49635-1-git-send-email-humin29@huawei.com>

From: Huisong Li <lihuisong@huawei.com>

The "cfg_max_queues" maintains configured max queue numbers from user,
and is equal to the maximum of "nb_rx_queues" and "nb_tx_queues" in
"dev->data".

From the ethdev layer framework, "nb_rx/tx_queues" in "dev->data" were set
to zero in rte_eth_dev_configure() if ops.dev_configure in PMD fails to be
executed, In addition, if ops.dev_configure in HNS3 PMD failed, the fake
queues are also cleared on a device that does not support independent Rx/Tx
queues.

Therefore, the "cfg_max_queues" should be also set to zero when
dev_configure fails.

Fixes: fa29fe45a7b4 ("net/hns3: support queue start and stop")
Cc: stable@dpdk.org

Signed-off-by: Huisong Li <lihuisong@huawei.com>
Signed-off-by: Min Hu (Connor) <humin29@huawei.com>
---
 drivers/net/hns3/hns3_ethdev.c    | 2 ++
 drivers/net/hns3/hns3_ethdev_vf.c | 2 ++
 2 files changed, 4 insertions(+)

diff --git a/drivers/net/hns3/hns3_ethdev.c b/drivers/net/hns3/hns3_ethdev.c
index db96fbc..5f6daa9 100644
--- a/drivers/net/hns3/hns3_ethdev.c
+++ b/drivers/net/hns3/hns3_ethdev.c
@@ -2501,6 +2501,7 @@ hns3_dev_configure(struct rte_eth_dev *dev)
 	ret = hns3_set_fake_rx_or_tx_queues(dev, nb_rx_q, nb_tx_q);
 	if (ret) {
 		hns3_err(hw, "fail to set Rx/Tx fake queues, ret = %d.", ret);
+		hw->cfg_max_queues = 0;
 		return ret;
 	}
 
@@ -2549,6 +2550,7 @@ hns3_dev_configure(struct rte_eth_dev *dev)
 	return 0;
 
 cfg_err:
+	hw->cfg_max_queues = 0;
 	(void)hns3_set_fake_rx_or_tx_queues(dev, 0, 0);
 	hw->adapter_state = HNS3_NIC_INITIALIZED;
 
diff --git a/drivers/net/hns3/hns3_ethdev_vf.c b/drivers/net/hns3/hns3_ethdev_vf.c
index e0a0797..e582503 100644
--- a/drivers/net/hns3/hns3_ethdev_vf.c
+++ b/drivers/net/hns3/hns3_ethdev_vf.c
@@ -804,6 +804,7 @@ hns3vf_dev_configure(struct rte_eth_dev *dev)
 	ret = hns3_set_fake_rx_or_tx_queues(dev, nb_rx_q, nb_tx_q);
 	if (ret) {
 		hns3_err(hw, "fail to set Rx/Tx fake queues, ret = %d.", ret);
+		hw->cfg_max_queues = 0;
 		return ret;
 	}
 
@@ -863,6 +864,7 @@ hns3vf_dev_configure(struct rte_eth_dev *dev)
 	return 0;
 
 cfg_err:
+	hw->cfg_max_queues = 0;
 	(void)hns3_set_fake_rx_or_tx_queues(dev, 0, 0);
 	hw->adapter_state = HNS3_NIC_INITIALIZED;
 
-- 
2.7.4


  parent reply	other threads:[~2021-06-13  2:32 UTC|newest]

Thread overview: 11+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2021-06-13  2:31 [dpdk-dev] [PATCH 0/6] bugfixes for hns3 PMD Min Hu (Connor)
2021-06-13  2:31 ` [dpdk-dev] [PATCH 1/6] net/hns3: modify max reset fail retry count Min Hu (Connor)
2021-06-14 14:36   ` Andrew Rybchenko
2021-06-13  2:31 ` [dpdk-dev] [PATCH 2/6] net/hns3: fix delay time for waiting to stop rxtx Min Hu (Connor)
2021-06-13  2:31 ` [dpdk-dev] [PATCH 3/6] net/hns3: fix incorrect fake queue rollback Min Hu (Connor)
2021-06-13  2:31 ` [dpdk-dev] [PATCH 4/6] net/hns3: fix VLAN strip log Min Hu (Connor)
2021-06-13  2:31 ` Min Hu (Connor) [this message]
2021-06-13  2:31 ` [dpdk-dev] [PATCH 6/6] net/hns3: delete redundant blank lines Min Hu (Connor)
2021-06-14 14:43 ` [dpdk-dev] [PATCH 0/6] bugfixes for hns3 PMD Andrew Rybchenko
2021-06-15  0:47   ` Min Hu (Connor)
2021-06-17 14:56     ` Andrew Rybchenko

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=1623551516-49635-6-git-send-email-humin29@huawei.com \
    --to=humin29@huawei.com \
    --cc=dev@dpdk.org \
    --cc=ferruh.yigit@intel.com \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).