Skip to content

Commit

Permalink
net/hns3: fix maximum queues on configuration failure
Browse files Browse the repository at this point in the history
[ upstream commit 5b96963 ]

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: fa29fe4 ("net/hns3: support queue start and stop")

Signed-off-by: Huisong Li <lihuisong@huawei.com>
Signed-off-by: Min Hu (Connor) <humin29@huawei.com>
  • Loading branch information
LiHuiSong1 authored and bluca committed Jul 12, 2021
1 parent fc75068 commit 1fa5c27
Show file tree
Hide file tree
Showing 2 changed files with 4 additions and 0 deletions.
2 changes: 2 additions & 0 deletions drivers/net/hns3/hns3_ethdev.c
Expand Up @@ -2380,6 +2380,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;
}

Expand Down Expand Up @@ -2439,6 +2440,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;

Expand Down
2 changes: 2 additions & 0 deletions drivers/net/hns3/hns3_ethdev_vf.c
Expand Up @@ -802,6 +802,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;
}

Expand Down Expand Up @@ -871,6 +872,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;

Expand Down

0 comments on commit 1fa5c27

Please sign in to comment.