DPDK patches and discussions
 help / color / mirror / Atom feed
From: Lijun Ou <oulijun@huawei.com>
To: <ferruh.yigit@intel.com>
Cc: <dev@dpdk.org>, <linuxarm@huawei.com>
Subject: [dpdk-dev] [PATCH v2 5/5] net/hns3: fix queue enabling status not store after FLR
Date: Fri, 6 Nov 2020 11:51:56 +0800	[thread overview]
Message-ID: <1604634716-43484-6-git-send-email-oulijun@huawei.com> (raw)
In-Reply-To: <1604634716-43484-1-git-send-email-oulijun@huawei.com>

From: Chengchang Tang <tangchengchang@huawei.com>

The FLR will resets the queue enabling status. In the
current code, the queue enabling status is not restored
after the reset. Therefore, if upper layer users have
called queue start/stop function before the reset, the
behavior after the reset is not as expected.

This patch fix it by add a queue enabling status 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    |  5 +++++
 drivers/net/hns3/hns3_ethdev_vf.c |  5 +++++
 drivers/net/hns3/hns3_rxtx.c      | 20 ++++++++++++++++++++
 drivers/net/hns3/hns3_rxtx.h      |  1 +
 4 files changed, 31 insertions(+)

diff --git a/drivers/net/hns3/hns3_ethdev.c b/drivers/net/hns3/hns3_ethdev.c
index b27cf67..e177549 100644
--- a/drivers/net/hns3/hns3_ethdev.c
+++ b/drivers/net/hns3/hns3_ethdev.c
@@ -5567,6 +5567,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 restore them before enable all tqps;
+		 */
+		hns3_restore_tqp_enable_state(hw);
+		/*
 		 * When finished the initialization, enable queues to receive
 		 * and transmit packets.
 		 */
diff --git a/drivers/net/hns3/hns3_ethdev_vf.c b/drivers/net/hns3/hns3_ethdev_vf.c
index 2f6d91b..511cd26 100644
--- a/drivers/net/hns3/hns3_ethdev_vf.c
+++ b/drivers/net/hns3/hns3_ethdev_vf.c
@@ -2424,6 +2424,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 restore them before enable all tqps;
+		 */
+		hns3_restore_tqp_enable_state(hw);
+		/*
 		 * When finished the initialization, enable queues to receive
 		 * and transmit packets.
 		 */
diff --git a/drivers/net/hns3/hns3_rxtx.c b/drivers/net/hns3/hns3_rxtx.c
index 285c06d..c76e635 100644
--- a/drivers/net/hns3/hns3_rxtx.c
+++ b/drivers/net/hns3/hns3_rxtx.c
@@ -503,6 +503,26 @@ hns3_start_all_rxqs(struct rte_eth_dev *dev)
 }
 
 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)
 {
 	struct hns3_hw *hw = HNS3_DEV_PRIVATE_TO_HW(dev->data->dev_private);
diff --git a/drivers/net/hns3/hns3_rxtx.h b/drivers/net/hns3/hns3_rxtx.h
index 8b32abe..6538848 100644
--- a/drivers/net/hns3/hns3_rxtx.h
+++ b/drivers/net/hns3/hns3_rxtx.h
@@ -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_ */
-- 
2.7.4


  parent reply	other threads:[~2020-11-06  3:53 UTC|newest]

Thread overview: 30+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2020-11-05 14:23 [dpdk-dev] [PATCH 0/5] bugfix and cleanups for hns3 Lijun Ou
2020-11-05 14:23 ` [dpdk-dev] [PATCH 1/5] net/hns3: use correct logging format symbol Lijun Ou
2020-11-05 14:23 ` [dpdk-dev] [PATCH 2/5] net/hns3: use unsigned types for bit operator Lijun Ou
2020-11-05 14:23 ` [dpdk-dev] [PATCH 3/5] net/hns3: adjust some code style Lijun Ou
2020-11-05 14:23 ` [dpdk-dev] [PATCH 4/5] net/hns3: check PCI config space writes Lijun Ou
2020-11-05 14:23 ` [dpdk-dev] [PATCH 5/5] net/hns3: fix queue enabling status not store after FLR Lijun Ou
2020-11-06  3:51 ` [dpdk-dev] [PATCH v2 0/5] bugfix and cleanups for hns3 Lijun Ou
2020-11-06  3:51   ` [dpdk-dev] [PATCH v2 1/5] net/hns3: use correct logging format symbol Lijun Ou
2020-11-06  3:51   ` [dpdk-dev] [PATCH v2 2/5] net/hns3: use unsigned types for bit operator Lijun Ou
2020-11-06 16:38     ` Ferruh Yigit
2020-11-09  9:21       ` oulijun
2020-11-09  9:28       ` oulijun
2020-11-06  3:51   ` [dpdk-dev] [PATCH v2 3/5] net/hns3: adjust some code style Lijun Ou
2020-11-06 16:44     ` Ferruh Yigit
2020-11-09  9:32       ` oulijun
2020-11-09 10:51         ` Ferruh Yigit
2020-11-06  3:51   ` [dpdk-dev] [PATCH v2 4/5] net/hns3: check PCI config space writes Lijun Ou
2020-11-06 16:45     ` Ferruh Yigit
2020-11-09 13:44       ` oulijun
2020-11-06  3:51   ` Lijun Ou [this message]
2020-11-06 16:57     ` [dpdk-dev] [PATCH v2 5/5] net/hns3: fix queue enabling status not store after FLR Ferruh Yigit
2020-11-09 14:27       ` oulijun
2020-11-09 14:28   ` [dpdk-dev] [PATCH V3 0/6] bugfix and cleanups for hns3 Lijun Ou
2020-11-09 14:28     ` [dpdk-dev] [PATCH V3 1/6] net/hns3: use correct logging format symbol Lijun Ou
2020-11-09 14:28     ` [dpdk-dev] [PATCH V3 2/6] net/hns3: use unsigned types for bit operator Lijun Ou
2020-11-09 14:28     ` [dpdk-dev] [PATCH V3 3/6] net/hns3: adjust code style for initial struct Lijun Ou
2020-11-09 14:29     ` [dpdk-dev] [PATCH V3 4/6] net/hns3: check PCI config space writes Lijun Ou
2020-11-09 14:29     ` [dpdk-dev] [PATCH V3 5/6] net/hns3: fix queue enabling state not store after FLR Lijun Ou
2020-11-09 14:29     ` [dpdk-dev] [PATCH V3 6/6] net/hns3: remove some unnecessary blank lines Lijun Ou
2020-11-10 10:17     ` [dpdk-dev] [PATCH V3 0/6] bugfix and cleanups for hns3 Ferruh Yigit

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=1604634716-43484-6-git-send-email-oulijun@huawei.com \
    --to=oulijun@huawei.com \
    --cc=dev@dpdk.org \
    --cc=ferruh.yigit@intel.com \
    --cc=linuxarm@huawei.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).