]> git.droids-corp.org - dpdk.git/commitdiff
net/hns3: fix queue state after reset
authorChengchang Tang <tangchengchang@huawei.com>
Mon, 9 Nov 2020 14:29:01 +0000 (22:29 +0800)
committerFerruh Yigit <ferruh.yigit@intel.com>
Fri, 13 Nov 2020 18:43:26 +0000 (19:43 +0100)
FLR operation will reset the queue enabling state and
the driver needs to restore the state after reset.
If the driver does not restore the state, it will result
in unpredictable behavior with reset when user start or
stop queue by calling the relevant function if.

This patch fix it by add a queue enabling state restore
function to the reset handler.

Fixes: fa29fe45a7b4 ("net/hns3: support queue start and stop")
Cc: stable@dpdk.org
Signed-off-by: Chengchang Tang <tangchengchang@huawei.com>
Signed-off-by: Lijun Ou <oulijun@huawei.com>
drivers/net/hns3/hns3_ethdev.c
drivers/net/hns3/hns3_ethdev_vf.c
drivers/net/hns3/hns3_rxtx.c
drivers/net/hns3/hns3_rxtx.h

index ba967249da094c85f6dc405b439c06b4d95ccbe4..79c03894d368c1e91042cad8005432e4b45c0e7e 100644 (file)
@@ -5570,6 +5570,11 @@ hns3_start_service(struct hns3_adapter *hns)
 
                /* Enable interrupt of all rx queues before enabling queues */
                hns3_dev_all_rx_queue_intr_enable(hw, true);
+               /*
+                * Enable state of each rxq and txq will be recovered after
+                * reset, so we need to restore them before enable all tqps;
+                */
+               hns3_restore_tqp_enable_state(hw);
                /*
                 * When finished the initialization, enable queues to receive
                 * and transmit packets.
index 1535f267138d1e57d223e31fc260fb9ad6aa885b..995a5ad6e2bf5688943f034c4e7a1765a7d729e8 100644 (file)
@@ -2423,6 +2423,11 @@ hns3vf_start_service(struct hns3_adapter *hns)
 
                /* Enable interrupt of all rx queues before enabling queues */
                hns3_dev_all_rx_queue_intr_enable(hw, true);
+               /*
+                * Enable state of each rxq and txq will be recovered after
+                * reset, so we need to restore them before enable all tqps;
+                */
+               hns3_restore_tqp_enable_state(hw);
                /*
                 * When finished the initialization, enable queues to receive
                 * and transmit packets.
index 85316caadb3066dd5abacff9f6698314fcd1a1f3..4b88b4692338b8e8ed6ac8b9a449a37686566899 100644 (file)
@@ -502,6 +502,26 @@ start_rxqs_fail:
        return -EINVAL;
 }
 
+void
+hns3_restore_tqp_enable_state(struct hns3_hw *hw)
+{
+       struct hns3_rx_queue *rxq;
+       struct hns3_tx_queue *txq;
+       uint16_t i;
+
+       for (i = 0; i < hw->data->nb_rx_queues; i++) {
+               rxq = hw->data->rx_queues[i];
+               if (rxq != NULL)
+                       hns3_enable_rxq(rxq, rxq->enabled);
+       }
+
+       for (i = 0; i < hw->data->nb_tx_queues; i++) {
+               txq = hw->data->tx_queues[i];
+               if (txq != NULL)
+                       hns3_enable_txq(txq, txq->enabled);
+       }
+}
+
 void
 hns3_stop_all_txqs(struct rte_eth_dev *dev)
 {
index 8b32abe52ad7d89fdf95f8728e98075765d31294..6538848feeb31b13ef14927a7dc6459fcdcfc0d5 100644 (file)
@@ -677,5 +677,6 @@ uint32_t hns3_get_tqp_reg_offset(uint16_t idx);
 int hns3_start_all_txqs(struct rte_eth_dev *dev);
 int hns3_start_all_rxqs(struct rte_eth_dev *dev);
 void hns3_stop_all_txqs(struct rte_eth_dev *dev);
+void hns3_restore_tqp_enable_state(struct hns3_hw *hw);
 
 #endif /* _HNS3_RXTX_H_ */