From: Lijun Ou <oulijun@huawei.com>
To: <ferruh.yigit@intel.com>
Cc: <dev@dpdk.org>, <linuxarm@huawei.com>
Subject: [dpdk-dev] [PATCH 2/4] net/hns3: fix unused queues with not disabled
Date: Fri, 20 Nov 2020 19:27:34 +0800 [thread overview]
Message-ID: <1605871656-51819-3-git-send-email-oulijun@huawei.com> (raw)
In-Reply-To: <1605871656-51819-1-git-send-email-oulijun@huawei.com>
From: Chengchang Tang <tangchengchang@huawei.com>
For kupeng 930, there are 3 registers to control the enable
status of a TQP(i.e. task queue pair, include a txq and a rxq).
One of them controls whether the TQP is enabled, and the other
two controls whether the rxq and txq are enabled. The registers
used to control the enabled status of the rxq and txq are enabled
by default. Therefore, after the TQP is enabled, the rxq and txq
are enabled by default. Currently, when the number of rxq is not
equal to the number of txq, the unused rxqs or txqs are not disabled
by driver, so these unused queues will be enabled in this situation.
And the related HW rings have not been initialized which could
lead to a hardware exception.
This patch fix it by disable these unused queues during enable the TQPs.
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_rxtx.c | 35 +++++++++++++++++++++++++++--------
1 file changed, 27 insertions(+), 8 deletions(-)
diff --git a/drivers/net/hns3/hns3_rxtx.c b/drivers/net/hns3/hns3_rxtx.c
index c76e635..88d3bab 100644
--- a/drivers/net/hns3/hns3_rxtx.c
+++ b/drivers/net/hns3/hns3_rxtx.c
@@ -353,6 +353,19 @@ hns3_update_all_queues_pvid_proc_en(struct hns3_hw *hw)
}
}
+static void
+hns3_stop_unused_queue(void *tqp_base, enum hns3_ring_type queue_type)
+{
+ uint32_t reg_offset;
+ uint32_t reg;
+
+ reg_offset = queue_type == HNS3_RING_TYPE_TX ?
+ HNS3_RING_TX_EN_REG : HNS3_RING_RX_EN_REG;
+ reg = hns3_read_reg(tqp_base, reg_offset);
+ reg &= ~BIT(HNS3_RING_EN_B);
+ hns3_write_reg(tqp_base, reg_offset, reg);
+}
+
void
hns3_enable_all_queues(struct hns3_hw *hw, bool en)
{
@@ -368,16 +381,22 @@ hns3_enable_all_queues(struct hns3_hw *hw, bool en)
if (hns3_dev_indep_txrx_supported(hw)) {
rxq = i < nb_rx_q ? hw->data->rx_queues[i] : NULL;
txq = i < nb_tx_q ? hw->data->tx_queues[i] : NULL;
+
+ tqp_base = (void *)((char *)hw->io_base +
+ hns3_get_tqp_reg_offset(i));
/*
- * After initialization, rxq and txq won't be NULL at
- * the same time.
+ * If queue struct is not initialized, it means the
+ * related HW ring has not been initialized yet.
+ * So, these queues should be disabled before enable
+ * the tqps to avoid a HW exception since the queues
+ * are enabled by default.
*/
- if (rxq != NULL)
- tqp_base = rxq->io_base;
- else if (txq != NULL)
- tqp_base = txq->io_base;
- else
- return;
+ if (rxq == NULL)
+ hns3_stop_unused_queue(tqp_base,
+ HNS3_RING_TYPE_RX);
+ if (txq == NULL)
+ hns3_stop_unused_queue(tqp_base,
+ HNS3_RING_TYPE_TX);
} else {
rxq = i < nb_rx_q ? hw->data->rx_queues[i] :
hw->fkq_data.rx_queues[i - nb_rx_q];
--
2.7.4
next prev parent reply other threads:[~2020-11-20 11:27 UTC|newest]
Thread overview: 23+ messages / expand[flat|nested] mbox.gz Atom feed top
2020-11-20 11:27 [dpdk-dev] [PATCH 0/4] hns3 fixes Lijun Ou
2020-11-20 11:27 ` [dpdk-dev] [PATCH 1/4] net/hns3: fix segment fault with the multi-TC Lijun Ou
2020-11-20 11:27 ` Lijun Ou [this message]
2020-11-20 11:27 ` [dpdk-dev] [PATCH 3/4] net/hns3: adjust printing MAC addresses in log Lijun Ou
2020-11-20 14:25 ` Ferruh Yigit
2020-12-07 14:52 ` oulijun
2020-12-10 11:54 ` oulijun
2020-11-20 11:27 ` [dpdk-dev] [PATCH 4/4] net/hns3: fix FEC state query Lijun Ou
2020-11-20 14:33 ` Ferruh Yigit
2020-11-20 14:35 ` Ferruh Yigit
2020-12-02 12:42 ` Min Hu (Connor)
2020-12-07 14:50 ` oulijun
2020-11-20 14:38 ` [dpdk-dev] [PATCH 0/4] hns3 fixes Ferruh Yigit
2020-11-20 14:58 ` oulijun
2020-11-20 15:38 ` Ferruh Yigit
2020-11-20 17:53 ` Ferruh Yigit
2020-12-07 14:54 ` oulijun
2020-12-07 16:17 ` Ferruh Yigit
2020-12-10 12:48 ` [dpdk-dev] [PATCH V2 0/2] " Lijun Ou
2020-12-10 12:48 ` [dpdk-dev] [PATCH V2 1/2] net/hns3: adjust printing MAC addresses in log Lijun Ou
2020-12-10 12:48 ` [dpdk-dev] [PATCH V2 2/2] net/hns3: fix FEC state query Lijun Ou
2020-12-10 16:30 ` [dpdk-dev] [PATCH V2 0/2] hns3 fixes Ferruh Yigit
2020-12-11 1:44 ` oulijun
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=1605871656-51819-3-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).