DPDK patches and discussions
 help / color / mirror / Atom feed
* [dpdk-dev] [PATCH 0/4] fixes for hns3 PMD driver
@ 2020-03-26  7:14 Wei Hu (Xavier)
  2020-03-26  7:14 ` [dpdk-dev] [PATCH 1/4] net/hns3: fix RSS indirection table configuration Wei Hu (Xavier)
                   ` (4 more replies)
  0 siblings, 5 replies; 6+ messages in thread
From: Wei Hu (Xavier) @ 2020-03-26  7:14 UTC (permalink / raw)
  To: dev

This series are fixes for hns3 PMD driver.

Chengwen Feng (1):
  net/hns3: fix the return value of setting VLAN offload

Lijun Ou (2):
  net/hns3: fix RSS indirection table configuration
  net/hns3: fix configuring RSS hash when rules are flushed

Min Hu (Connor) (1):
  net/hns3: fix mailbox opcode data type

 drivers/net/hns3/hns3_dcb.c       | 15 +++++++++++++++
 drivers/net/hns3/hns3_ethdev.c    |  9 +++++++++
 drivers/net/hns3/hns3_ethdev.h    |  1 +
 drivers/net/hns3/hns3_ethdev_vf.c | 22 +++++++++++++++++++---
 drivers/net/hns3/hns3_flow.c      | 14 ++++++++++++++
 drivers/net/hns3/hns3_mbx.c       | 12 ++++++++----
 drivers/net/hns3/hns3_rss.c       | 31 +++++++++++++++++++++----------
 drivers/net/hns3/hns3_rss.h       |  2 ++
 8 files changed, 89 insertions(+), 17 deletions(-)

-- 
2.23.0


^ permalink raw reply	[flat|nested] 6+ messages in thread

* [dpdk-dev] [PATCH 1/4] net/hns3: fix RSS indirection table configuration
  2020-03-26  7:14 [dpdk-dev] [PATCH 0/4] fixes for hns3 PMD driver Wei Hu (Xavier)
@ 2020-03-26  7:14 ` Wei Hu (Xavier)
  2020-03-26  7:14 ` [dpdk-dev] [PATCH 2/4] net/hns3: fix configuring RSS hash when rules are flushed Wei Hu (Xavier)
                   ` (3 subsequent siblings)
  4 siblings, 0 replies; 6+ messages in thread
From: Wei Hu (Xavier) @ 2020-03-26  7:14 UTC (permalink / raw)
  To: dev

From: Lijun Ou <oulijun@huawei.com>

For the current hns3 PMD driver, there are some RSS related bugs at
the following scenes:
1. Start the application with the number of Rx queues equals 1(--rxq=1),
   modify the number of Rx queue to some number greater than 1 during
   normal operation. As a result, upper application can't receive packets
   from multiple rx queues.
2. Start testpmd application with the option disable-rss and the number
   of Rx queue is greater than 1(--disable-rss --rxq=N, N>1). As a result,
   upper application still can receive packets from multiple rx queues.

The root cause as below:
There are some error configuration in the RSS indirection table of hns3
network engine.

This patch fixes them with the following modification.
1. When rss size is changed, we need to update rss redirection table
   maintained by driver and configure them to hardware. Besides, during
   the entire reset process, we need to ensure that the rss table
   information are not overwritten and configured directly to the hardware
   in the RESET_STAGE_RESTORE stage of the reset process.
2. When satrting testpmd appication with the options disable-rss, it
   doesn't need to configure rss redirection table to hardware.

Fixes: c37ca66f2b27 ("net/hns3: support RSS")
Cc: stable@dpdk.org

Signed-off-by: Lijun Ou <oulijun@huawei.com>
Signed-off-by: Huisong Li <lihuisong@huawei.com>
Signed-off-by: Wei Hu (Xavier) <xavier.huwei@huawei.com>
---
 drivers/net/hns3/hns3_dcb.c       | 15 +++++++++++++++
 drivers/net/hns3/hns3_ethdev.c    |  8 ++++++++
 drivers/net/hns3/hns3_ethdev_vf.c |  8 ++++++++
 drivers/net/hns3/hns3_flow.c      | 13 +++++++++++++
 drivers/net/hns3/hns3_rss.c       | 28 ++++++++++++++++++----------
 drivers/net/hns3/hns3_rss.h       |  2 ++
 6 files changed, 64 insertions(+), 10 deletions(-)

diff --git a/drivers/net/hns3/hns3_dcb.c b/drivers/net/hns3/hns3_dcb.c
index 369a40e6a..8688de2a7 100644
--- a/drivers/net/hns3/hns3_dcb.c
+++ b/drivers/net/hns3/hns3_dcb.c
@@ -580,7 +580,9 @@ hns3_dcb_pri_shaper_cfg(struct hns3_hw *hw)
 void
 hns3_set_rss_size(struct hns3_hw *hw, uint16_t nb_rx_q)
 {
+	struct hns3_rss_conf *rss_cfg = &hw->rss_info;
 	uint16_t rx_qnum_per_tc;
+	int i;
 
 	rx_qnum_per_tc = nb_rx_q / hw->num_tc;
 	rx_qnum_per_tc = RTE_MIN(hw->rss_size_max, rx_qnum_per_tc);
@@ -590,6 +592,19 @@ hns3_set_rss_size(struct hns3_hw *hw, uint16_t nb_rx_q)
 		hw->alloc_rss_size = rx_qnum_per_tc;
 	}
 	hw->used_rx_queues = hw->num_tc * hw->alloc_rss_size;
+
+	/*
+	 * When rss size is changed, we need to update rss redirection table
+	 * maintained by driver. Besides, during the entire reset process, we
+	 * need to ensure that the rss table information are not overwritten
+	 * and configured directly to the hardware in the RESET_STAGE_RESTORE
+	 * stage of the reset process.
+	 */
+	if (rte_atomic16_read(&hw->reset.resetting) == 0) {
+		for (i = 0; i < HNS3_RSS_IND_TBL_SIZE; i++)
+			rss_cfg->rss_indirection_tbl[i] =
+							i % hw->alloc_rss_size;
+	}
 }
 
 void
diff --git a/drivers/net/hns3/hns3_ethdev.c b/drivers/net/hns3/hns3_ethdev.c
index 1d57de7f9..3f0b005e4 100644
--- a/drivers/net/hns3/hns3_ethdev.c
+++ b/drivers/net/hns3/hns3_ethdev.c
@@ -4258,6 +4258,12 @@ hns3_map_rx_interrupt(struct rte_eth_dev *dev)
 	return ret;
 }
 
+static void
+hns3_restore_filter(struct rte_eth_dev *dev)
+{
+	hns3_restore_rss_filter(dev);
+}
+
 static int
 hns3_dev_start(struct rte_eth_dev *dev)
 {
@@ -4289,6 +4295,8 @@ hns3_dev_start(struct rte_eth_dev *dev)
 	hns3_mp_req_start_rxtx(dev);
 	rte_eal_alarm_set(HNS3_SERVICE_INTERVAL, hns3_service_handler, dev);
 
+	hns3_restore_filter(dev);
+
 	hns3_info(hw, "hns3 dev start successful!");
 	return 0;
 }
diff --git a/drivers/net/hns3/hns3_ethdev_vf.c b/drivers/net/hns3/hns3_ethdev_vf.c
index 2e8acfee3..b93649c62 100644
--- a/drivers/net/hns3/hns3_ethdev_vf.c
+++ b/drivers/net/hns3/hns3_ethdev_vf.c
@@ -1744,6 +1744,12 @@ hns3vf_map_rx_interrupt(struct rte_eth_dev *dev)
 	return ret;
 }
 
+static void
+hns3vf_restore_filter(struct rte_eth_dev *dev)
+{
+	hns3_restore_rss_filter(dev);
+}
+
 static int
 hns3vf_dev_start(struct rte_eth_dev *dev)
 {
@@ -1773,6 +1779,8 @@ hns3vf_dev_start(struct rte_eth_dev *dev)
 	hns3_mp_req_start_rxtx(dev);
 	rte_eal_alarm_set(HNS3VF_SERVICE_INTERVAL, hns3vf_service_handler, dev);
 
+	hns3vf_restore_filter(dev);
+
 	return ret;
 }
 
diff --git a/drivers/net/hns3/hns3_flow.c b/drivers/net/hns3/hns3_flow.c
index 559b9d02b..53708d205 100644
--- a/drivers/net/hns3/hns3_flow.c
+++ b/drivers/net/hns3/hns3_flow.c
@@ -1546,6 +1546,19 @@ hns3_clear_rss_filter(struct rte_eth_dev *dev)
 	return hns3_config_rss_filter(dev, &hw->rss_info, false);
 }
 
+/* Restore the rss filter */
+int
+hns3_restore_rss_filter(struct rte_eth_dev *dev)
+{
+	struct hns3_adapter *hns = dev->data->dev_private;
+	struct hns3_hw *hw = &hns->hw;
+
+	if (hw->rss_info.conf.queue_num == 0)
+		return 0;
+
+	return hns3_config_rss_filter(dev, &hw->rss_info, true);
+}
+
 static int
 hns3_flow_parse_rss(struct rte_eth_dev *dev,
 		    const struct hns3_rss_conf *conf, bool add)
diff --git a/drivers/net/hns3/hns3_rss.c b/drivers/net/hns3/hns3_rss.c
index dfc42f840..737d5f109 100644
--- a/drivers/net/hns3/hns3_rss.c
+++ b/drivers/net/hns3/hns3_rss.c
@@ -127,7 +127,7 @@ hns3_set_rss_indir_table(struct hns3_hw *hw, uint8_t *indir, uint16_t size)
 		req->rss_set_bitmap = rte_cpu_to_le_16(HNS3_RSS_SET_BITMAP_MSK);
 		for (j = 0; j < HNS3_RSS_CFG_TBL_SIZE; j++) {
 			num = i * HNS3_RSS_CFG_TBL_SIZE + j;
-			req->rss_result[j] = indir[num] % hw->alloc_rss_size;
+			req->rss_result[j] = indir[num];
 		}
 		ret = hns3_cmd_send(hw, &desc, 1);
 		if (ret) {
@@ -423,7 +423,7 @@ hns3_dev_rss_reta_query(struct rte_eth_dev *dev,
 		shift = i % RTE_RETA_GROUP_SIZE;
 		if (reta_conf[idx].mask & (1ULL << shift))
 			reta_conf[idx].reta[shift] =
-			  rss_cfg->rss_indirection_tbl[i] % hw->alloc_rss_size;
+						rss_cfg->rss_indirection_tbl[i];
 	}
 	rte_spinlock_unlock(&hw->lock);
 	return 0;
@@ -532,7 +532,7 @@ hns3_config_rss(struct hns3_adapter *hns)
 
 	enum rte_eth_rx_mq_mode mq_mode = hw->data->dev_conf.rxmode.mq_mode;
 
-	/* When there is no open RSS, redirect the packet queue 0 */
+	/* When RSS is off, redirect the packet queue 0 */
 	if (((uint32_t)mq_mode & ETH_MQ_RX_RSS_FLAG) == 0)
 		hns3_rss_uninit(hns);
 
@@ -546,10 +546,16 @@ hns3_config_rss(struct hns3_adapter *hns)
 	if (ret)
 		return ret;
 
-	ret = hns3_set_rss_indir_table(hw, rss_cfg->rss_indirection_tbl,
-				       HNS3_RSS_IND_TBL_SIZE);
-	if (ret)
-		goto rss_tuple_uninit;
+	/*
+	 * When RSS is off, it doesn't need to configure rss redirection table
+	 * to hardware.
+	 */
+	if (((uint32_t)mq_mode & ETH_MQ_RX_RSS_FLAG)) {
+		ret = hns3_set_rss_indir_table(hw, rss_cfg->rss_indirection_tbl,
+					       HNS3_RSS_IND_TBL_SIZE);
+		if (ret)
+			goto rss_tuple_uninit;
+	}
 
 	ret = hns3_set_rss_tc_mode(hw);
 	if (ret)
@@ -558,9 +564,11 @@ hns3_config_rss(struct hns3_adapter *hns)
 	return ret;
 
 rss_indir_table_uninit:
-	ret1 = hns3_rss_reset_indir_table(hw);
-	if (ret1 != 0)
-		return ret;
+	if (((uint32_t)mq_mode & ETH_MQ_RX_RSS_FLAG)) {
+		ret1 = hns3_rss_reset_indir_table(hw);
+		if (ret1 != 0)
+			return ret;
+	}
 
 rss_tuple_uninit:
 	hns3_rss_tuple_uninit(hw);
diff --git a/drivers/net/hns3/hns3_rss.h b/drivers/net/hns3/hns3_rss.h
index 725970f89..3c7905132 100644
--- a/drivers/net/hns3/hns3_rss.h
+++ b/drivers/net/hns3/hns3_rss.h
@@ -111,4 +111,6 @@ int hns3_set_rss_tuple_by_rss_hf(struct hns3_hw *hw,
 				 uint64_t rss_hf);
 int hns3_set_rss_algo_key(struct hns3_hw *hw, uint8_t hash_algo,
 			  const uint8_t *key);
+int hns3_restore_rss_filter(struct rte_eth_dev *dev);
+
 #endif /* _HNS3_RSS_H_ */
-- 
2.23.0


^ permalink raw reply	[flat|nested] 6+ messages in thread

* [dpdk-dev] [PATCH 2/4] net/hns3: fix configuring RSS hash when rules are flushed
  2020-03-26  7:14 [dpdk-dev] [PATCH 0/4] fixes for hns3 PMD driver Wei Hu (Xavier)
  2020-03-26  7:14 ` [dpdk-dev] [PATCH 1/4] net/hns3: fix RSS indirection table configuration Wei Hu (Xavier)
@ 2020-03-26  7:14 ` Wei Hu (Xavier)
  2020-03-26  7:14 ` [dpdk-dev] [PATCH 3/4] net/hns3: fix mailbox opcode data type Wei Hu (Xavier)
                   ` (2 subsequent siblings)
  4 siblings, 0 replies; 6+ messages in thread
From: Wei Hu (Xavier) @ 2020-03-26  7:14 UTC (permalink / raw)
  To: dev

From: Lijun Ou <oulijun@huawei.com>

Currently, when performing test case as follow:
1. Run testpmd application based on hns3 network engine with multiple
   receive queues(--rxq=N --txq=N, N>1).
2. Create the special RSS rules by "create flow ..." commmand in the
   command prompt of the testpmd application.
3. Flush the RSS rules created in step 2 by "flow flush ..." command.
4. Enable RSS by "port config all rss all" command.
In step 4, the command exeuctes successfully. This phenomenon is
inconsistent with the expectation. The API function named
rte_eth_dev_rss_hash_update called in the command should return error
and the command should fail.

This patch fixes it by adding a flag for disabling rss in the driver.
When RSS rules is flushed, we set the the flag with true, and the
'.rss_hash_update' ops implementation function named
hns3_dev_rss_hash_update return -EINVAL.

Fixes: c37ca66f2b27 ("net/hns3: support RSS")
Cc: stable@dpdk.org

Signed-off-by: Lijun Ou <oulijun@huawei.com>
Signed-off-by: Wei Hu (Xavier) <xavier.huwei@huawei.com>
---
 drivers/net/hns3/hns3_ethdev.c    | 1 +
 drivers/net/hns3/hns3_ethdev.h    | 1 +
 drivers/net/hns3/hns3_ethdev_vf.c | 1 +
 drivers/net/hns3/hns3_flow.c      | 1 +
 drivers/net/hns3/hns3_rss.c       | 3 +++
 5 files changed, 7 insertions(+)

diff --git a/drivers/net/hns3/hns3_ethdev.c b/drivers/net/hns3/hns3_ethdev.c
index 3f0b005e4..215e2b2c6 100644
--- a/drivers/net/hns3/hns3_ethdev.c
+++ b/drivers/net/hns3/hns3_ethdev.c
@@ -2663,6 +2663,7 @@ hns3_get_board_configuration(struct hns3_hw *hw)
 
 	hw->mac.media_type = cfg.media_type;
 	hw->rss_size_max = cfg.rss_size_max;
+	hw->rss_dis_flag = false;
 	hw->rx_buf_len = cfg.rx_buf_len;
 	memcpy(hw->mac.mac_addr, cfg.mac_addr, RTE_ETHER_ADDR_LEN);
 	hw->mac.phy_addr = cfg.phy_addr;
diff --git a/drivers/net/hns3/hns3_ethdev.h b/drivers/net/hns3/hns3_ethdev.h
index 28484188a..0423e64ea 100644
--- a/drivers/net/hns3/hns3_ethdev.h
+++ b/drivers/net/hns3/hns3_ethdev.h
@@ -368,6 +368,7 @@ struct hns3_hw {
 
 	/* The configuration info of RSS */
 	struct hns3_rss_conf rss_info;
+	bool rss_dis_flag; /* disable rss flag. true: disable, false: enable */
 
 	uint8_t num_tc;             /* Total number of enabled TCs */
 	uint8_t hw_tc_map;
diff --git a/drivers/net/hns3/hns3_ethdev_vf.c b/drivers/net/hns3/hns3_ethdev_vf.c
index b93649c62..e0c40a10e 100644
--- a/drivers/net/hns3/hns3_ethdev_vf.c
+++ b/drivers/net/hns3/hns3_ethdev_vf.c
@@ -1022,6 +1022,7 @@ hns3vf_get_configuration(struct hns3_hw *hw)
 	int ret;
 
 	hw->mac.media_type = HNS3_MEDIA_TYPE_NONE;
+	hw->rss_dis_flag = false;
 
 	/* Get queue configuration from PF */
 	ret = hns3vf_get_queue_info(hw);
diff --git a/drivers/net/hns3/hns3_flow.c b/drivers/net/hns3/hns3_flow.c
index 53708d205..aef301a8a 100644
--- a/drivers/net/hns3/hns3_flow.c
+++ b/drivers/net/hns3/hns3_flow.c
@@ -1333,6 +1333,7 @@ hns3_disable_rss(struct hns3_hw *hw)
 
 	/* Disable RSS */
 	hw->rss_info.conf.types = 0;
+	hw->rss_dis_flag = true;
 
 	return 0;
 }
diff --git a/drivers/net/hns3/hns3_rss.c b/drivers/net/hns3/hns3_rss.c
index 737d5f109..95a637ddc 100644
--- a/drivers/net/hns3/hns3_rss.c
+++ b/drivers/net/hns3/hns3_rss.c
@@ -261,6 +261,9 @@ hns3_dev_rss_hash_update(struct rte_eth_dev *dev,
 	uint8_t *key = rss_conf->rss_key;
 	int ret;
 
+	if (hw->rss_dis_flag)
+		return -EINVAL;
+
 	rte_spinlock_lock(&hw->lock);
 	ret = hns3_set_rss_tuple_by_rss_hf(hw, tuple, rss_hf);
 	if (ret)
-- 
2.23.0


^ permalink raw reply	[flat|nested] 6+ messages in thread

* [dpdk-dev] [PATCH 3/4] net/hns3: fix mailbox opcode data type
  2020-03-26  7:14 [dpdk-dev] [PATCH 0/4] fixes for hns3 PMD driver Wei Hu (Xavier)
  2020-03-26  7:14 ` [dpdk-dev] [PATCH 1/4] net/hns3: fix RSS indirection table configuration Wei Hu (Xavier)
  2020-03-26  7:14 ` [dpdk-dev] [PATCH 2/4] net/hns3: fix configuring RSS hash when rules are flushed Wei Hu (Xavier)
@ 2020-03-26  7:14 ` Wei Hu (Xavier)
  2020-03-26  7:14 ` [dpdk-dev] [PATCH 4/4] net/hns3: fix the return value of setting VLAN offload Wei Hu (Xavier)
  2020-03-27 14:05 ` [dpdk-dev] [PATCH 0/4] fixes for hns3 PMD driver Andrew Rybchenko
  4 siblings, 0 replies; 6+ messages in thread
From: Wei Hu (Xavier) @ 2020-03-26  7:14 UTC (permalink / raw)
  To: dev

From: "Min Hu (Connor)" <humin29@huawei.com>

The mailbox opcode is defined as one byte in datasheet which is not
compatible with that in the current hns3 PMD driver.

This patch fixes the data type of the local variable for mailbox opcode
in driver, changing from uint16_t to uint8_t.

Fixes: 463e748964f5 ("net/hns3: support mailbox")
Cc: stable@dpdk.org

Signed-off-by: Min Hu (Connor) <humin29@huawei.com>
Signed-off-by: Wei Hu (Xavier) <xavier.huwei@huawei.com>
Signed-off-by: Chengwen Feng <fengchengwen@huawei.com>
---
 drivers/net/hns3/hns3_mbx.c | 12 ++++++++----
 1 file changed, 8 insertions(+), 4 deletions(-)

diff --git a/drivers/net/hns3/hns3_mbx.c b/drivers/net/hns3/hns3_mbx.c
index b03a3d6a1..34c8c688f 100644
--- a/drivers/net/hns3/hns3_mbx.c
+++ b/drivers/net/hns3/hns3_mbx.c
@@ -219,6 +219,7 @@ hns3_mbx_handler(struct hns3_hw *hw)
 	struct hns3_mac *mac = &hw->mac;
 	enum hns3_reset_level reset_level;
 	uint16_t *msg_q;
+	uint8_t opcode;
 	uint32_t tail;
 
 	tail = hw->arq.tail;
@@ -227,7 +228,8 @@ hns3_mbx_handler(struct hns3_hw *hw)
 	while (tail != hw->arq.head) {
 		msg_q = hw->arq.msg_q[hw->arq.head];
 
-		switch (msg_q[0]) {
+		opcode = msg_q[0] & 0xff;
+		switch (opcode) {
 		case HNS3_MBX_LINK_STAT_CHANGE:
 			memcpy(&mac->link_speed, &msg_q[2],
 				   sizeof(mac->link_speed));
@@ -249,7 +251,7 @@ hns3_mbx_handler(struct hns3_hw *hw)
 			break;
 		default:
 			hns3_err(hw, "Fetched unsupported(%d) message from arq",
-				 msg_q[0]);
+				 opcode);
 			break;
 		}
 
@@ -348,6 +350,7 @@ hns3_dev_handle_mbx_msg(struct hns3_hw *hw)
 	struct hns3_cmd_desc *desc;
 	uint32_t msg_data;
 	uint16_t *msg_q;
+	uint8_t opcode;
 	uint16_t flag;
 	uint8_t *temp;
 	int i;
@@ -358,12 +361,13 @@ hns3_dev_handle_mbx_msg(struct hns3_hw *hw)
 
 		desc = &crq->desc[crq->next_to_use];
 		req = (struct hns3_mbx_pf_to_vf_cmd *)desc->data;
+		opcode = req->msg[0] & 0xff;
 
 		flag = rte_le_to_cpu_16(crq->desc[crq->next_to_use].flag);
 		if (unlikely(!hns3_get_bit(flag, HNS3_CMDQ_RX_OUTVLD_B))) {
 			hns3_warn(hw,
 				  "dropped invalid mailbox message, code = %d",
-				  req->msg[0]);
+				  opcode);
 
 			/* dropping/not processing this invalid message */
 			crq->desc[crq->next_to_use].flag = 0;
@@ -371,7 +375,7 @@ hns3_dev_handle_mbx_msg(struct hns3_hw *hw)
 			continue;
 		}
 
-		switch (req->msg[0]) {
+		switch (opcode) {
 		case HNS3_MBX_PF_VF_RESP:
 			resp->resp_status = hns3_resp_to_errno(req->msg[3]);
 
-- 
2.23.0


^ permalink raw reply	[flat|nested] 6+ messages in thread

* [dpdk-dev] [PATCH 4/4] net/hns3: fix the return value of setting VLAN offload
  2020-03-26  7:14 [dpdk-dev] [PATCH 0/4] fixes for hns3 PMD driver Wei Hu (Xavier)
                   ` (2 preceding siblings ...)
  2020-03-26  7:14 ` [dpdk-dev] [PATCH 3/4] net/hns3: fix mailbox opcode data type Wei Hu (Xavier)
@ 2020-03-26  7:14 ` Wei Hu (Xavier)
  2020-03-27 14:05 ` [dpdk-dev] [PATCH 0/4] fixes for hns3 PMD driver Andrew Rybchenko
  4 siblings, 0 replies; 6+ messages in thread
From: Wei Hu (Xavier) @ 2020-03-26  7:14 UTC (permalink / raw)
  To: dev

From: Chengwen Feng <fengchengwen@huawei.com>

Currently, the '.vlan_offload_set' ops implementation function named
hns3vf_vlan_offload_set always return 0 in hns3 VF PMD driver.

This patch fixes it with the following modification in the function
named hns3vf_vlan_offload_set.
1. Avoid setting hardware configuration and return -EIO during resetting.
2. Add the return value dectection process for calling internal static
   function named hns3vf_en_hw_strip_rxvtag.

Fixes: a5475d61fa34 ("net/hns3: support VF")
Cc: stable@dpdk.org

Signed-off-by: Chengwen Feng <fengchengwen@huawei.com>
Signed-off-by: Wei Hu (Xavier) <xavier.huwei@huawei.com>
---
 drivers/net/hns3/hns3_ethdev_vf.c | 13 ++++++++++---
 1 file changed, 10 insertions(+), 3 deletions(-)

diff --git a/drivers/net/hns3/hns3_ethdev_vf.c b/drivers/net/hns3/hns3_ethdev_vf.c
index e0c40a10e..8be743d19 100644
--- a/drivers/net/hns3/hns3_ethdev_vf.c
+++ b/drivers/net/hns3/hns3_ethdev_vf.c
@@ -1150,6 +1150,13 @@ hns3vf_vlan_offload_set(struct rte_eth_dev *dev, int mask)
 	struct hns3_hw *hw = HNS3_DEV_PRIVATE_TO_HW(dev->data->dev_private);
 	struct rte_eth_conf *dev_conf = &dev->data->dev_conf;
 	unsigned int tmp_mask;
+	int ret = 0;
+
+	if (rte_atomic16_read(&hw->reset.resetting)) {
+		hns3_err(hw, "vf set vlan offload failed during resetting, "
+			     "mask = 0x%x", mask);
+		return -EIO;
+	}
 
 	tmp_mask = (unsigned int)mask;
 	/* Vlan stripping setting */
@@ -1157,13 +1164,13 @@ hns3vf_vlan_offload_set(struct rte_eth_dev *dev, int mask)
 		rte_spinlock_lock(&hw->lock);
 		/* Enable or disable VLAN stripping */
 		if (dev_conf->rxmode.offloads & DEV_RX_OFFLOAD_VLAN_STRIP)
-			hns3vf_en_hw_strip_rxvtag(hw, true);
+			ret = hns3vf_en_hw_strip_rxvtag(hw, true);
 		else
-			hns3vf_en_hw_strip_rxvtag(hw, false);
+			ret = hns3vf_en_hw_strip_rxvtag(hw, false);
 		rte_spinlock_unlock(&hw->lock);
 	}
 
-	return 0;
+	return ret;
 }
 
 static int
-- 
2.23.0


^ permalink raw reply	[flat|nested] 6+ messages in thread

* Re: [dpdk-dev] [PATCH 0/4] fixes for hns3 PMD driver
  2020-03-26  7:14 [dpdk-dev] [PATCH 0/4] fixes for hns3 PMD driver Wei Hu (Xavier)
                   ` (3 preceding siblings ...)
  2020-03-26  7:14 ` [dpdk-dev] [PATCH 4/4] net/hns3: fix the return value of setting VLAN offload Wei Hu (Xavier)
@ 2020-03-27 14:05 ` Andrew Rybchenko
  4 siblings, 0 replies; 6+ messages in thread
From: Andrew Rybchenko @ 2020-03-27 14:05 UTC (permalink / raw)
  To: Wei Hu (Xavier), dev

On 3/26/20 10:14 AM, Wei Hu (Xavier) wrote:
> This series are fixes for hns3 PMD driver.
> 
> Chengwen Feng (1):
>   net/hns3: fix the return value of setting VLAN offload
> 
> Lijun Ou (2):
>   net/hns3: fix RSS indirection table configuration
>   net/hns3: fix configuring RSS hash when rules are flushed
> 
> Min Hu (Connor) (1):
>   net/hns3: fix mailbox opcode data type
> 
>  drivers/net/hns3/hns3_dcb.c       | 15 +++++++++++++++
>  drivers/net/hns3/hns3_ethdev.c    |  9 +++++++++
>  drivers/net/hns3/hns3_ethdev.h    |  1 +
>  drivers/net/hns3/hns3_ethdev_vf.c | 22 +++++++++++++++++++---
>  drivers/net/hns3/hns3_flow.c      | 14 ++++++++++++++
>  drivers/net/hns3/hns3_mbx.c       | 12 ++++++++----
>  drivers/net/hns3/hns3_rss.c       | 31 +++++++++++++++++++++----------
>  drivers/net/hns3/hns3_rss.h       |  2 ++
>  8 files changed, 89 insertions(+), 17 deletions(-)
> 

Applied, thanks

^ permalink raw reply	[flat|nested] 6+ messages in thread

end of thread, other threads:[~2020-03-27 14:05 UTC | newest]

Thread overview: 6+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2020-03-26  7:14 [dpdk-dev] [PATCH 0/4] fixes for hns3 PMD driver Wei Hu (Xavier)
2020-03-26  7:14 ` [dpdk-dev] [PATCH 1/4] net/hns3: fix RSS indirection table configuration Wei Hu (Xavier)
2020-03-26  7:14 ` [dpdk-dev] [PATCH 2/4] net/hns3: fix configuring RSS hash when rules are flushed Wei Hu (Xavier)
2020-03-26  7:14 ` [dpdk-dev] [PATCH 3/4] net/hns3: fix mailbox opcode data type Wei Hu (Xavier)
2020-03-26  7:14 ` [dpdk-dev] [PATCH 4/4] net/hns3: fix the return value of setting VLAN offload Wei Hu (Xavier)
2020-03-27 14:05 ` [dpdk-dev] [PATCH 0/4] fixes for hns3 PMD driver Andrew Rybchenko

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).