Skip to content

Commit

Permalink
net/hns3: fix delay for waiting to stop Rx/Tx
Browse files Browse the repository at this point in the history
[ upstream commit 4d8cce2 ]

When the primary process executes dev_stop or is being reset, the packet
sending and receiving functions is changed. In this moment, the primary
process requests secondary processes to change their Rx/Tx functions, and
delays a period of time in case of crashes when queues are still in use.
The delay time depends on the number of queues actually used, instead of
the maximum number of queues supported by the device.

Fixes: 23d4b61 ("net/hns3: support multiple process")

Signed-off-by: Huisong Li <lihuisong@huawei.com>
Signed-off-by: Min Hu (Connor) <humin29@huawei.com>
  • Loading branch information
LiHuiSong1 authored and cpaelzer committed Aug 11, 2021
1 parent ba81e4b commit 779b852
Show file tree
Hide file tree
Showing 2 changed files with 4 additions and 4 deletions.
4 changes: 2 additions & 2 deletions drivers/net/hns3/hns3_ethdev.c
Expand Up @@ -4742,7 +4742,7 @@ hns3_dev_stop(struct rte_eth_dev *dev)
/* Disable datapath on secondary process. */
hns3_mp_req_stop_rxtx(dev);
/* Prevent crashes when queues are still in use. */
rte_delay_ms(hw->tqps_num);
rte_delay_ms(hw->cfg_max_queues);

rte_spinlock_lock(&hw->lock);
if (rte_atomic16_read(&hw->reset.resetting) == 0) {
Expand Down Expand Up @@ -5201,7 +5201,7 @@ hns3_stop_service(struct hns3_adapter *hns)
rte_wmb();
/* Disable datapath on secondary process. */
hns3_mp_req_stop_rxtx(eth_dev);
rte_delay_ms(hw->tqps_num);
rte_delay_ms(hw->cfg_max_queues);

rte_spinlock_lock(&hw->lock);
if (hns->hw.adapter_state == HNS3_NIC_STARTED ||
Expand Down
4 changes: 2 additions & 2 deletions drivers/net/hns3/hns3_ethdev_vf.c
Expand Up @@ -1631,7 +1631,7 @@ hns3vf_dev_stop(struct rte_eth_dev *dev)
/* Disable datapath on secondary process. */
hns3_mp_req_stop_rxtx(dev);
/* Prevent crashes when queues are still in use. */
rte_delay_ms(hw->tqps_num);
rte_delay_ms(hw->cfg_max_queues);

rte_spinlock_lock(&hw->lock);
if (rte_atomic16_read(&hw->reset.resetting) == 0) {
Expand Down Expand Up @@ -2005,7 +2005,7 @@ hns3vf_stop_service(struct hns3_adapter *hns)
rte_wmb();
/* Disable datapath on secondary process. */
hns3_mp_req_stop_rxtx(eth_dev);
rte_delay_ms(hw->tqps_num);
rte_delay_ms(hw->cfg_max_queues);

rte_spinlock_lock(&hw->lock);
if (hw->adapter_state == HNS3_NIC_STARTED ||
Expand Down

0 comments on commit 779b852

Please sign in to comment.