DPDK patches and discussions
 help / color / mirror / Atom feed
* [dpdk-dev] [PATCH 0/8] bugfix for hns3 PMD
@ 2021-07-17  2:02 Min Hu (Connor)
  2021-07-17  2:02 ` [dpdk-dev] [PATCH 1/8] net/hns3: fix residual MAC address entry Min Hu (Connor)
                   ` (8 more replies)
  0 siblings, 9 replies; 10+ messages in thread
From: Min Hu (Connor) @ 2021-07-17  2:02 UTC (permalink / raw)
  To: dev; +Cc: ferruh.yigit, andrew.rybchenko

This patchset contains 8 bugfixes for hns3 PMD.

Chengchang Tang (2):
  net/hns3: fix residual MAC address entry
  net/hns3: delete duplicate compile-time check

Chengwen Feng (3):
  net/hns3: delete unnecessary zero assignments
  net/hns3: fix incorrect comment
  net/hns3: fix flow list separate management

HongBo Zheng (1):
  net/hns3: fix the timing issue of clearing interrupt source

Huisong Li (2):
  net/hns3: fix a print position about auto-negotiation
  net/hns3: fix Tx pkt prepare address when dev stop

 drivers/net/hns3/hns3_ethdev.c    |  62 +++++----------
 drivers/net/hns3/hns3_ethdev.h    |   3 +
 drivers/net/hns3/hns3_ethdev_vf.c |  29 ++-----
 drivers/net/hns3/hns3_fdir.h      |   7 +-
 drivers/net/hns3/hns3_flow.c      | 160 +++++++++++++++++---------------------
 drivers/net/hns3/hns3_rxtx.c      |   2 +-
 drivers/net/hns3/hns3_rxtx_vec.c  |   4 -
 drivers/net/hns3/hns3_tm.c        |  18 -----
 8 files changed, 103 insertions(+), 182 deletions(-)

-- 
2.7.4


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

* [dpdk-dev] [PATCH 1/8] net/hns3: fix residual MAC address entry
  2021-07-17  2:02 [dpdk-dev] [PATCH 0/8] bugfix for hns3 PMD Min Hu (Connor)
@ 2021-07-17  2:02 ` Min Hu (Connor)
  2021-07-17  2:02 ` [dpdk-dev] [PATCH 2/8] net/hns3: delete unnecessary zero assignments Min Hu (Connor)
                   ` (7 subsequent siblings)
  8 siblings, 0 replies; 10+ messages in thread
From: Min Hu (Connor) @ 2021-07-17  2:02 UTC (permalink / raw)
  To: dev; +Cc: ferruh.yigit, andrew.rybchenko

From: Chengchang Tang <tangchengchang@huawei.com>

Currently, even if we fail to remove the origin MAC address from the HW,
the set_default_mac will go on, and add the new MAC address to the HW.
Eventually cause the original MAC address entry to remain in the HW, and
users may receive unexpected packets.

This patch make set_default_mac return directly to failure if deleting
the original MAC address fails, simplifying the behavior of the driver
and solving the problem of residual MAC address entry.

Fixes: 7d7f9f80bbfb ("net/hns3: support MAC address related operations")
Cc: stable@dpdk.org

Signed-off-by: Chengchang Tang <tangchengchang@huawei.com>
Signed-off-by: Min Hu (Connor) <humin29@huawei.com>
---
 drivers/net/hns3/hns3_ethdev.c | 22 +++++++++-------------
 1 file changed, 9 insertions(+), 13 deletions(-)

diff --git a/drivers/net/hns3/hns3_ethdev.c b/drivers/net/hns3/hns3_ethdev.c
index 17b995a..3699b56 100644
--- a/drivers/net/hns3/hns3_ethdev.c
+++ b/drivers/net/hns3/hns3_ethdev.c
@@ -1748,7 +1748,6 @@ hns3_set_default_mac_addr(struct rte_eth_dev *dev,
 	struct rte_ether_addr *oaddr;
 	char mac_str[RTE_ETHER_ADDR_FMT_SIZE];
 	bool default_addr_setted;
-	bool rm_succes = false;
 	int ret, ret_val;
 
 	/*
@@ -1768,9 +1767,10 @@ hns3_set_default_mac_addr(struct rte_eth_dev *dev,
 					      oaddr);
 			hns3_warn(hw, "Remove old uc mac address(%s) fail: %d",
 				  mac_str, ret);
-			rm_succes = false;
-		} else
-			rm_succes = true;
+
+			rte_spinlock_unlock(&hw->lock);
+			return ret;
+		}
 	}
 
 	ret = hns3_add_uc_addr_common(hw, mac_addr);
@@ -1805,16 +1805,12 @@ hns3_set_default_mac_addr(struct rte_eth_dev *dev,
 	}
 
 err_add_uc_addr:
-	if (rm_succes) {
-		ret_val = hns3_add_uc_addr_common(hw, oaddr);
-		if (ret_val) {
-			hns3_ether_format_addr(mac_str, RTE_ETHER_ADDR_FMT_SIZE,
-					      oaddr);
-			hns3_warn(hw,
-				  "Failed to restore old uc mac addr(%s): %d",
+	ret_val = hns3_add_uc_addr_common(hw, oaddr);
+	if (ret_val) {
+		hns3_ether_format_addr(mac_str, RTE_ETHER_ADDR_FMT_SIZE, oaddr);
+		hns3_warn(hw, "Failed to restore old uc mac addr(%s): %d",
 				  mac_str, ret_val);
-			hw->mac.default_addr_setted = false;
-		}
+		hw->mac.default_addr_setted = false;
 	}
 	rte_spinlock_unlock(&hw->lock);
 
-- 
2.7.4


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

* [dpdk-dev] [PATCH 2/8] net/hns3: delete unnecessary zero assignments
  2021-07-17  2:02 [dpdk-dev] [PATCH 0/8] bugfix for hns3 PMD Min Hu (Connor)
  2021-07-17  2:02 ` [dpdk-dev] [PATCH 1/8] net/hns3: fix residual MAC address entry Min Hu (Connor)
@ 2021-07-17  2:02 ` Min Hu (Connor)
  2021-07-17  2:02 ` [dpdk-dev] [PATCH 3/8] net/hns3: fix incorrect comment Min Hu (Connor)
                   ` (6 subsequent siblings)
  8 siblings, 0 replies; 10+ messages in thread
From: Min Hu (Connor) @ 2021-07-17  2:02 UTC (permalink / raw)
  To: dev; +Cc: ferruh.yigit, andrew.rybchenko

From: Chengwen Feng <fengchengwen@huawei.com>

The output parameter 'cap' was cleared at the function entry, the
latter zero assignment 'cap' fields was unnecessary, so delete them.

Fixes: c09c7847d892 ("net/hns3: support traffic management")
Cc: stable@dpdk.org

Signed-off-by: Chengwen Feng <fengchengwen@huawei.com>
Signed-off-by: Min Hu (Connor) <humin29@huawei.com>
---
 drivers/net/hns3/hns3_tm.c | 18 ------------------
 1 file changed, 18 deletions(-)

diff --git a/drivers/net/hns3/hns3_tm.c b/drivers/net/hns3/hns3_tm.c
index 7fd9818..db5ac78 100644
--- a/drivers/net/hns3/hns3_tm.c
+++ b/drivers/net/hns3/hns3_tm.c
@@ -134,33 +134,15 @@ hns3_tm_capabilities_get(struct rte_eth_dev *dev,
 	cap->leaf_nodes_identical = 1;
 	cap->shaper_n_max = 1 + HNS3_MAX_TC_NUM;
 	cap->shaper_private_n_max = 1 + HNS3_MAX_TC_NUM;
-	cap->shaper_private_dual_rate_n_max = 0;
-	cap->shaper_private_rate_min = 0;
 	cap->shaper_private_rate_max =
 		hns3_tm_rate_convert_firmware2tm(hw->max_tm_rate);
-	cap->shaper_shared_n_max = 0;
-	cap->shaper_shared_n_nodes_per_shaper_max = 0;
-	cap->shaper_shared_n_shapers_per_node_max = 0;
-	cap->shaper_shared_dual_rate_n_max = 0;
-	cap->shaper_shared_rate_min = 0;
-	cap->shaper_shared_rate_max = 0;
 
 	cap->sched_n_children_max = max_tx_queues;
 	cap->sched_sp_n_priorities_max = 1;
-	cap->sched_wfq_n_children_per_group_max = 0;
-	cap->sched_wfq_n_groups_max = 0;
 	cap->sched_wfq_weight_max = 1;
 
-	cap->cman_head_drop_supported = 0;
-	cap->dynamic_update_mask = 0;
 	cap->shaper_pkt_length_adjust_min = RTE_TM_ETH_FRAMING_OVERHEAD;
 	cap->shaper_pkt_length_adjust_max = RTE_TM_ETH_FRAMING_OVERHEAD_FCS;
-	cap->cman_wred_context_n_max = 0;
-	cap->cman_wred_context_private_n_max = 0;
-	cap->cman_wred_context_shared_n_max = 0;
-	cap->cman_wred_context_shared_n_nodes_per_context_max = 0;
-	cap->cman_wred_context_shared_n_contexts_per_node_max = 0;
-	cap->stats_mask = 0;
 
 	return 0;
 }
-- 
2.7.4


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

* [dpdk-dev] [PATCH 3/8] net/hns3: fix incorrect comment
  2021-07-17  2:02 [dpdk-dev] [PATCH 0/8] bugfix for hns3 PMD Min Hu (Connor)
  2021-07-17  2:02 ` [dpdk-dev] [PATCH 1/8] net/hns3: fix residual MAC address entry Min Hu (Connor)
  2021-07-17  2:02 ` [dpdk-dev] [PATCH 2/8] net/hns3: delete unnecessary zero assignments Min Hu (Connor)
@ 2021-07-17  2:02 ` Min Hu (Connor)
  2021-07-17  2:02 ` [dpdk-dev] [PATCH 4/8] net/hns3: fix the timing issue of clearing interrupt source Min Hu (Connor)
                   ` (5 subsequent siblings)
  8 siblings, 0 replies; 10+ messages in thread
From: Min Hu (Connor) @ 2021-07-17  2:02 UTC (permalink / raw)
  To: dev; +Cc: ferruh.yigit, andrew.rybchenko

From: Chengwen Feng <fengchengwen@huawei.com>

This patch fixed incorrect comment of hns3_parse_fdir_filter().

Fixes: fcba820d9b9e ("net/hns3: support flow director")
Cc: stable@dpdk.org

Signed-off-by: Chengwen Feng <fengchengwen@huawei.com>
Signed-off-by: Min Hu (Connor) <humin29@huawei.com>
---
 drivers/net/hns3/hns3_flow.c | 59 +++++++++++++++++---------------------------
 1 file changed, 23 insertions(+), 36 deletions(-)

diff --git a/drivers/net/hns3/hns3_flow.c b/drivers/net/hns3/hns3_flow.c
index 82810e0..755a6f2 100644
--- a/drivers/net/hns3/hns3_flow.c
+++ b/drivers/net/hns3/hns3_flow.c
@@ -1134,42 +1134,29 @@ is_tunnel_packet(enum rte_flow_item_type type)
 }
 
 /*
- * Parse the rule to see if it is a IP or MAC VLAN flow director rule.
- * And get the flow director filter info BTW.
- * UDP/TCP/SCTP PATTERN:
- * The first not void item can be ETH or IPV4 or IPV6
- * The second not void item must be IPV4 or IPV6 if the first one is ETH.
- * The next not void item could be UDP or TCP or SCTP (optional)
- * The next not void item could be RAW (for flexbyte, optional)
- * The next not void item must be END.
- * A Fuzzy Match pattern can appear at any place before END.
- * Fuzzy Match is optional for IPV4 but is required for IPV6
- * MAC VLAN PATTERN:
- * The first not void item must be ETH.
- * The second not void item must be MAC VLAN.
- * The next not void item must be END.
- * ACTION:
- * The first not void action should be QUEUE or DROP.
- * The second not void optional action should be MARK,
- * mark_id is a uint32_t number.
- * The next not void action should be END.
- * UDP/TCP/SCTP pattern example:
- * ITEM		Spec			Mask
- * ETH		NULL			NULL
- * IPV4		src_addr 192.168.1.20	0xFFFFFFFF
- *		dst_addr 192.167.3.50	0xFFFFFFFF
- * UDP/TCP/SCTP	src_port	80	0xFFFF
- *		dst_port	80	0xFFFF
- * END
- * MAC VLAN pattern example:
- * ITEM		Spec			Mask
- * ETH		dst_addr
-		{0xAC, 0x7B, 0xA1,	{0xFF, 0xFF, 0xFF,
-		0x2C, 0x6D, 0x36}	0xFF, 0xFF, 0xFF}
- * MAC VLAN	tci	0x2016		0xEFFF
- * END
- * Other members in mask and spec should set to 0x00.
- * Item->last should be NULL.
+ * Parse the flow director rule.
+ * The supported PATTERN:
+ *   case: non-tunnel packet:
+ *     ETH : src-mac, dst-mac, ethertype
+ *     VLAN: tag1, tag2
+ *     IPv4: src-ip, dst-ip, tos, proto
+ *     IPv6: src-ip(last 32 bit addr), dst-ip(last 32 bit addr), proto
+ *     UDP : src-port, dst-port
+ *     TCP : src-port, dst-port
+ *     SCTP: src-port, dst-port, tag
+ *   case: tunnel packet:
+ *     OUTER-ETH: ethertype
+ *     OUTER-L3 : proto
+ *     OUTER-L4 : src-port, dst-port
+ *     TUNNEL   : vni, flow-id(only valid when NVGRE)
+ *     INNER-ETH/VLAN/IPv4/IPv6/UDP/TCP/SCTP: same as non-tunnel packet
+ * The supported ACTION:
+ *    QUEUE
+ *    DROP
+ *    COUNT
+ *    MARK: the id range [0, 4094]
+ *    FLAG
+ *    RSS: only valid if firmware support FD_QUEUE_REGION.
  */
 static int
 hns3_parse_fdir_filter(struct rte_eth_dev *dev,
-- 
2.7.4


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

* [dpdk-dev] [PATCH 4/8] net/hns3: fix the timing issue of clearing interrupt source
  2021-07-17  2:02 [dpdk-dev] [PATCH 0/8] bugfix for hns3 PMD Min Hu (Connor)
                   ` (2 preceding siblings ...)
  2021-07-17  2:02 ` [dpdk-dev] [PATCH 3/8] net/hns3: fix incorrect comment Min Hu (Connor)
@ 2021-07-17  2:02 ` Min Hu (Connor)
  2021-07-17  2:02 ` [dpdk-dev] [PATCH 5/8] net/hns3: delete duplicate compile-time check Min Hu (Connor)
                   ` (4 subsequent siblings)
  8 siblings, 0 replies; 10+ messages in thread
From: Min Hu (Connor) @ 2021-07-17  2:02 UTC (permalink / raw)
  To: dev; +Cc: ferruh.yigit, andrew.rybchenko

From: HongBo Zheng <zhenghongbo3@huawei.com>

Currently, the PF/VF does not clear the interrupt source immediately
after receiving the interrupt. As a result, if the second interrupt
task is triggered when processing the first interrupt task, clearing
the interrupt source before exiting will clear the interrupt sources
of the two tasks at the same time. As a result, no interrupt is
triggered for the second task.

Clearing interrupt source immediately after checking event cause
ensures that:
1. Even if two interrupt tasks are triggered at the same time, they can
be processed.
2. If the second task is triggered during the processing of the first
task and the interrupt source is not cleared, the interrupt is reported
after vector0 is enabled.

Fixes: a5475d61fa34 ("net/hns3: support VF")
Fixes: 3988ab0eee52 ("net/hns3: add abnormal interrupt process")
Cc: stable@dpdk.org

Signed-off-by: HongBo Zheng <zhenghongbo3@huawei.com>
Signed-off-by: Min Hu (Connor) <humin29@huawei.com>
---
 drivers/net/hns3/hns3_ethdev.c    | 2 +-
 drivers/net/hns3/hns3_ethdev_vf.c | 5 ++---
 2 files changed, 3 insertions(+), 4 deletions(-)

diff --git a/drivers/net/hns3/hns3_ethdev.c b/drivers/net/hns3/hns3_ethdev.c
index 3699b56..f994c28 100644
--- a/drivers/net/hns3/hns3_ethdev.c
+++ b/drivers/net/hns3/hns3_ethdev.c
@@ -317,6 +317,7 @@ hns3_interrupt_handler(void *param)
 	vector0_int = hns3_read_dev(hw, HNS3_VECTOR0_OTHER_INT_STS_REG);
 	ras_int = hns3_read_dev(hw, HNS3_RAS_PF_OTHER_INT_STS_REG);
 	cmdq_int = hns3_read_dev(hw, HNS3_VECTOR0_CMDQ_SRC_REG);
+	hns3_clear_event_cause(hw, event_cause, clearval);
 	/* vector 0 interrupt is shared with reset and mailbox source events. */
 	if (event_cause == HNS3_VECTOR0_EVENT_ERR) {
 		hns3_warn(hw, "received interrupt: vector0_int_stat:0x%x "
@@ -335,7 +336,6 @@ hns3_interrupt_handler(void *param)
 			  vector0_int, ras_int, cmdq_int);
 	}
 
-	hns3_clear_event_cause(hw, event_cause, clearval);
 	/* Enable interrupt if it is not cause by reset */
 	hns3_pf_enable_irq0(hw);
 }
diff --git a/drivers/net/hns3/hns3_ethdev_vf.c b/drivers/net/hns3/hns3_ethdev_vf.c
index 8f3be64..de659c0 100644
--- a/drivers/net/hns3/hns3_ethdev_vf.c
+++ b/drivers/net/hns3/hns3_ethdev_vf.c
@@ -1116,6 +1116,8 @@ hns3vf_interrupt_handler(void *param)
 
 	/* Read out interrupt causes */
 	event_cause = hns3vf_check_event_cause(hns, &clearval);
+	/* Clear interrupt causes */
+	hns3vf_clear_event_cause(hw, clearval);
 
 	switch (event_cause) {
 	case HNS3VF_VECTOR0_EVENT_RST:
@@ -1128,9 +1130,6 @@ hns3vf_interrupt_handler(void *param)
 		break;
 	}
 
-	/* Clear interrupt causes */
-	hns3vf_clear_event_cause(hw, clearval);
-
 	/* Enable interrupt */
 	hns3vf_enable_irq0(hw);
 }
-- 
2.7.4


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

* [dpdk-dev] [PATCH 5/8] net/hns3: delete duplicate compile-time check
  2021-07-17  2:02 [dpdk-dev] [PATCH 0/8] bugfix for hns3 PMD Min Hu (Connor)
                   ` (3 preceding siblings ...)
  2021-07-17  2:02 ` [dpdk-dev] [PATCH 4/8] net/hns3: fix the timing issue of clearing interrupt source Min Hu (Connor)
@ 2021-07-17  2:02 ` Min Hu (Connor)
  2021-07-17  2:02 ` [dpdk-dev] [PATCH 6/8] net/hns3: fix a print position about auto-negotiation Min Hu (Connor)
                   ` (3 subsequent siblings)
  8 siblings, 0 replies; 10+ messages in thread
From: Min Hu (Connor) @ 2021-07-17  2:02 UTC (permalink / raw)
  To: dev; +Cc: ferruh.yigit, andrew.rybchenko

From: Chengchang Tang <tangchengchang@huawei.com>

This patch delete duplicate compile-gime check.

Fixes: cb12e988f35f ("net/hns3: add compile-time verification on Rx vector")
Cc: stable@dpdk.org

Signed-off-by: Chengchang Tang <tangchengchang@huawei.com>
Signed-off-by: Min Hu (Connor) <humin29@huawei.com>
---
 drivers/net/hns3/hns3_rxtx_vec.c | 4 ----
 1 file changed, 4 deletions(-)

diff --git a/drivers/net/hns3/hns3_rxtx_vec.c b/drivers/net/hns3/hns3_rxtx_vec.c
index cc8b970..844512f 100644
--- a/drivers/net/hns3/hns3_rxtx_vec.c
+++ b/drivers/net/hns3/hns3_rxtx_vec.c
@@ -172,8 +172,6 @@ hns3_rxq_vec_setup_rearm_data(struct hns3_rx_queue *rxq)
 			 offsetof(struct rte_mbuf, rearm_data));
 	RTE_BUILD_BUG_ON(offsetof(struct rte_mbuf, refcnt) <
 			 offsetof(struct rte_mbuf, rearm_data));
-	RTE_BUILD_BUG_ON(offsetof(struct rte_mbuf, refcnt) <
-			 offsetof(struct rte_mbuf, rearm_data));
 	RTE_BUILD_BUG_ON(offsetof(struct rte_mbuf, nb_segs) <
 			 offsetof(struct rte_mbuf, rearm_data));
 	RTE_BUILD_BUG_ON(offsetof(struct rte_mbuf, port) <
@@ -182,8 +180,6 @@ hns3_rxq_vec_setup_rearm_data(struct hns3_rx_queue *rxq)
 			 offsetof(struct rte_mbuf, rearm_data) > 6);
 	RTE_BUILD_BUG_ON(offsetof(struct rte_mbuf, refcnt) -
 			 offsetof(struct rte_mbuf, rearm_data) > 6);
-	RTE_BUILD_BUG_ON(offsetof(struct rte_mbuf, refcnt) -
-			 offsetof(struct rte_mbuf, rearm_data) > 6);
 	RTE_BUILD_BUG_ON(offsetof(struct rte_mbuf, nb_segs) -
 			 offsetof(struct rte_mbuf, rearm_data) > 6);
 	RTE_BUILD_BUG_ON(offsetof(struct rte_mbuf, port) -
-- 
2.7.4


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

* [dpdk-dev] [PATCH 6/8] net/hns3: fix a print position about auto-negotiation
  2021-07-17  2:02 [dpdk-dev] [PATCH 0/8] bugfix for hns3 PMD Min Hu (Connor)
                   ` (4 preceding siblings ...)
  2021-07-17  2:02 ` [dpdk-dev] [PATCH 5/8] net/hns3: delete duplicate compile-time check Min Hu (Connor)
@ 2021-07-17  2:02 ` Min Hu (Connor)
  2021-07-17  2:02 ` [dpdk-dev] [PATCH 7/8] net/hns3: fix flow list separate management Min Hu (Connor)
                   ` (2 subsequent siblings)
  8 siblings, 0 replies; 10+ messages in thread
From: Min Hu (Connor) @ 2021-07-17  2:02 UTC (permalink / raw)
  To: dev; +Cc: ferruh.yigit, andrew.rybchenko

From: Huisong Li <lihuisong@huawei.com>

PF driver prints a warning on device that does not support auto-negotiation
when user does not configure "link_speeds" (default 0), which means
auto-negotiation. Currently, this warning information is printed in
dev_configure stage and a success is returned. Perhaps the user may call
dev_configure multiple times before dev_start for some reason or purpose.
In this case, this message may be printed multiple times. So this patch
moves it to dev_start stage.

Fixes: cfc9fe48c4d4 ("net/hns3: move link speeds check to configure")
Cc: stable@dpdk.org

Signed-off-by: Huisong Li <lihuisong@huawei.com>
Signed-off-by: Min Hu (Connor) <humin29@huawei.com>
---
 drivers/net/hns3/hns3_ethdev.c | 14 +++++++-------
 1 file changed, 7 insertions(+), 7 deletions(-)

diff --git a/drivers/net/hns3/hns3_ethdev.c b/drivers/net/hns3/hns3_ethdev.c
index f994c28..4a302d2 100644
--- a/drivers/net/hns3/hns3_ethdev.c
+++ b/drivers/net/hns3/hns3_ethdev.c
@@ -2437,14 +2437,11 @@ hns3_check_link_speed(struct hns3_hw *hw, uint32_t link_speeds)
 	/*
 	 * Some hardware doesn't support auto-negotiation, but users may not
 	 * configure link_speeds (default 0), which means auto-negotiation.
-	 * In this case, a warning message need to be printed, instead of
-	 * an error.
+	 * In this case, it should return success.
 	 */
 	if (link_speeds == ETH_LINK_SPEED_AUTONEG &&
-	    hw->mac.support_autoneg == 0) {
-		hns3_warn(hw, "auto-negotiation is not supported, use default fixed speed!");
+	    hw->mac.support_autoneg == 0)
 		return 0;
-	}
 
 	if (link_speeds != ETH_LINK_SPEED_AUTONEG) {
 		ret = hns3_check_port_speed(hw, link_speeds);
@@ -5515,10 +5512,13 @@ hns3_set_fiber_port_link_speed(struct hns3_hw *hw,
 	/*
 	 * Some hardware doesn't support auto-negotiation, but users may not
 	 * configure link_speeds (default 0), which means auto-negotiation.
-	 * In this case, it should return success.
+	 * In this case, a warning message need to be printed, instead of
+	 * an error.
 	 */
-	if (cfg->autoneg)
+	if (cfg->autoneg) {
+		hns3_warn(hw, "auto-negotiation is not supported, use default fixed speed!");
 		return 0;
+	}
 
 	return hns3_cfg_mac_speed_dup(hw, cfg->speed, cfg->duplex);
 }
-- 
2.7.4


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

* [dpdk-dev] [PATCH 7/8] net/hns3: fix flow list separate management
  2021-07-17  2:02 [dpdk-dev] [PATCH 0/8] bugfix for hns3 PMD Min Hu (Connor)
                   ` (5 preceding siblings ...)
  2021-07-17  2:02 ` [dpdk-dev] [PATCH 6/8] net/hns3: fix a print position about auto-negotiation Min Hu (Connor)
@ 2021-07-17  2:02 ` Min Hu (Connor)
  2021-07-17  2:02 ` [dpdk-dev] [PATCH 8/8] net/hns3: fix Tx pkt prepare address when dev stop Min Hu (Connor)
  2021-07-23 12:49 ` [dpdk-dev] [PATCH 0/8] bugfix for hns3 PMD Thomas Monjalon
  8 siblings, 0 replies; 10+ messages in thread
From: Min Hu (Connor) @ 2021-07-17  2:02 UTC (permalink / raw)
  To: dev; +Cc: ferruh.yigit, andrew.rybchenko

From: Chengwen Feng <fengchengwen@huawei.com>

Currently, hns3 driver saves rte flow list into the
rte_eth_dev.process_private filed, it may cause following problem:
The FDIR/RSS rules cannot be managed in a unified manner because
the management structure is not visible between processes.

This patch fixes it by moving rte flow list to struct hns3_hw which is
visible between processes.

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

Signed-off-by: Chengwen Feng <fengchengwen@huawei.com>
Signed-off-by: Min Hu (Connor) <humin29@huawei.com>
---
 drivers/net/hns3/hns3_ethdev.c    |  24 ++-------
 drivers/net/hns3/hns3_ethdev.h    |   3 ++
 drivers/net/hns3/hns3_ethdev_vf.c |  24 ++-------
 drivers/net/hns3/hns3_fdir.h      |   7 +--
 drivers/net/hns3/hns3_flow.c      | 101 +++++++++++++++++++-------------------
 5 files changed, 60 insertions(+), 99 deletions(-)

diff --git a/drivers/net/hns3/hns3_ethdev.c b/drivers/net/hns3/hns3_ethdev.c
index 4a302d2..a374fa7 100644
--- a/drivers/net/hns3/hns3_ethdev.c
+++ b/drivers/net/hns3/hns3_ethdev.c
@@ -5292,6 +5292,7 @@ hns3_uninit_pf(struct rte_eth_dev *eth_dev)
 	hns3_rss_uninit(hns);
 	(void)hns3_config_gro(hw, false);
 	hns3_promisc_uninit(hw);
+	hns3_flow_uninit(eth_dev);
 	hns3_fdir_filter_uninit(hns);
 	hns3_uninit_umv_space(hw);
 	hns3_tqp_stats_uninit(hw);
@@ -5918,11 +5919,8 @@ hns3_dev_close(struct rte_eth_dev *eth_dev)
 	struct hns3_hw *hw = &hns->hw;
 	int ret = 0;
 
-	if (rte_eal_process_type() != RTE_PROC_PRIMARY) {
-		rte_free(eth_dev->process_private);
-		eth_dev->process_private = NULL;
+	if (rte_eal_process_type() != RTE_PROC_PRIMARY)
 		return 0;
-	}
 
 	if (hw->adapter_state == HNS3_NIC_STARTED)
 		ret = hns3_dev_stop(eth_dev);
@@ -5937,8 +5935,6 @@ hns3_dev_close(struct rte_eth_dev *eth_dev)
 	hns3_uninit_pf(eth_dev);
 	hns3_free_all_queues(eth_dev);
 	rte_free(hw->reset.wait_data);
-	rte_free(eth_dev->process_private);
-	eth_dev->process_private = NULL;
 	hns3_mp_uninit_primary();
 	hns3_warn(hw, "Close port %u finished", hw->data->port_id);
 
@@ -7398,15 +7394,6 @@ hns3_dev_init(struct rte_eth_dev *eth_dev)
 
 	PMD_INIT_FUNC_TRACE();
 
-	eth_dev->process_private = (struct hns3_process_private *)
-	    rte_zmalloc_socket("hns3_filter_list",
-			       sizeof(struct hns3_process_private),
-			       RTE_CACHE_LINE_SIZE, eth_dev->device->numa_node);
-	if (eth_dev->process_private == NULL) {
-		PMD_INIT_LOG(ERR, "Failed to alloc memory for process private");
-		return -ENOMEM;
-	}
-
 	hns3_flow_init(eth_dev);
 
 	hns3_set_rxtx_function(eth_dev);
@@ -7510,8 +7497,6 @@ hns3_dev_init(struct rte_eth_dev *eth_dev)
 	eth_dev->tx_pkt_burst = NULL;
 	eth_dev->tx_pkt_prepare = NULL;
 	eth_dev->tx_descriptor_status = NULL;
-	rte_free(eth_dev->process_private);
-	eth_dev->process_private = NULL;
 	return ret;
 }
 
@@ -7523,11 +7508,8 @@ hns3_dev_uninit(struct rte_eth_dev *eth_dev)
 
 	PMD_INIT_FUNC_TRACE();
 
-	if (rte_eal_process_type() != RTE_PROC_PRIMARY) {
-		rte_free(eth_dev->process_private);
-		eth_dev->process_private = NULL;
+	if (rte_eal_process_type() != RTE_PROC_PRIMARY)
 		return 0;
-	}
 
 	if (hw->adapter_state < HNS3_NIC_CLOSING)
 		hns3_dev_close(eth_dev);
diff --git a/drivers/net/hns3/hns3_ethdev.h b/drivers/net/hns3/hns3_ethdev.h
index 3485614..8e66d9f 100644
--- a/drivers/net/hns3/hns3_ethdev.h
+++ b/drivers/net/hns3/hns3_ethdev.h
@@ -630,6 +630,9 @@ struct hns3_hw {
 	struct hns3_port_base_vlan_config port_base_vlan_cfg;
 
 	pthread_mutex_t flows_lock; /* rte_flow ops lock */
+	struct hns3_fdir_rule_list flow_fdir_list; /* flow fdir rule list */
+	struct hns3_rss_filter_list flow_rss_list; /* flow RSS rule list */
+	struct hns3_flow_mem_list flow_list;
 
 	/*
 	 * PMD setup and configuration is not thread safe. Since it is not
diff --git a/drivers/net/hns3/hns3_ethdev_vf.c b/drivers/net/hns3/hns3_ethdev_vf.c
index de659c0..8d9b797 100644
--- a/drivers/net/hns3/hns3_ethdev_vf.c
+++ b/drivers/net/hns3/hns3_ethdev_vf.c
@@ -2071,6 +2071,7 @@ hns3vf_uninit_vf(struct rte_eth_dev *eth_dev)
 	(void)hns3_config_gro(hw, false);
 	(void)hns3vf_set_alive(hw, false);
 	(void)hns3vf_set_promisc_mode(hw, false, false, false);
+	hns3_flow_uninit(eth_dev);
 	hns3_tqp_stats_uninit(hw);
 	hns3vf_disable_irq0(hw);
 	rte_intr_disable(&pci_dev->intr_handle);
@@ -2186,11 +2187,8 @@ hns3vf_dev_close(struct rte_eth_dev *eth_dev)
 	struct hns3_hw *hw = &hns->hw;
 	int ret = 0;
 
-	if (rte_eal_process_type() != RTE_PROC_PRIMARY) {
-		rte_free(eth_dev->process_private);
-		eth_dev->process_private = NULL;
+	if (rte_eal_process_type() != RTE_PROC_PRIMARY)
 		return 0;
-	}
 
 	if (hw->adapter_state == HNS3_NIC_STARTED)
 		ret = hns3vf_dev_stop(eth_dev);
@@ -2204,8 +2202,6 @@ hns3vf_dev_close(struct rte_eth_dev *eth_dev)
 	hns3vf_uninit_vf(eth_dev);
 	hns3_free_all_queues(eth_dev);
 	rte_free(hw->reset.wait_data);
-	rte_free(eth_dev->process_private);
-	eth_dev->process_private = NULL;
 	hns3_mp_uninit_primary();
 	hns3_warn(hw, "Close port %u finished", hw->data->port_id);
 
@@ -2962,15 +2958,6 @@ hns3vf_dev_init(struct rte_eth_dev *eth_dev)
 
 	PMD_INIT_FUNC_TRACE();
 
-	eth_dev->process_private = (struct hns3_process_private *)
-	    rte_zmalloc_socket("hns3_filter_list",
-			       sizeof(struct hns3_process_private),
-			       RTE_CACHE_LINE_SIZE, eth_dev->device->numa_node);
-	if (eth_dev->process_private == NULL) {
-		PMD_INIT_LOG(ERR, "Failed to alloc memory for process private");
-		return -ENOMEM;
-	}
-
 	hns3_flow_init(eth_dev);
 
 	hns3_set_rxtx_function(eth_dev);
@@ -3072,8 +3059,6 @@ hns3vf_dev_init(struct rte_eth_dev *eth_dev)
 	eth_dev->tx_pkt_burst = NULL;
 	eth_dev->tx_pkt_prepare = NULL;
 	eth_dev->tx_descriptor_status = NULL;
-	rte_free(eth_dev->process_private);
-	eth_dev->process_private = NULL;
 
 	return ret;
 }
@@ -3086,11 +3071,8 @@ hns3vf_dev_uninit(struct rte_eth_dev *eth_dev)
 
 	PMD_INIT_FUNC_TRACE();
 
-	if (rte_eal_process_type() != RTE_PROC_PRIMARY) {
-		rte_free(eth_dev->process_private);
-		eth_dev->process_private = NULL;
+	if (rte_eal_process_type() != RTE_PROC_PRIMARY)
 		return 0;
-	}
 
 	if (hw->adapter_state < HNS3_NIC_CLOSING)
 		hns3vf_dev_close(eth_dev);
diff --git a/drivers/net/hns3/hns3_fdir.h b/drivers/net/hns3/hns3_fdir.h
index fc62daa..3f610f7 100644
--- a/drivers/net/hns3/hns3_fdir.h
+++ b/drivers/net/hns3/hns3_fdir.h
@@ -189,12 +189,6 @@ TAILQ_HEAD(hns3_fdir_rule_list, hns3_fdir_rule_ele);
 TAILQ_HEAD(hns3_rss_filter_list, hns3_rss_conf_ele);
 TAILQ_HEAD(hns3_flow_mem_list, hns3_flow_mem);
 
-struct hns3_process_private {
-	struct hns3_fdir_rule_list fdir_list;
-	struct hns3_rss_filter_list filter_rss_list;
-	struct hns3_flow_mem_list flow_list;
-};
-
 /*
  *  A structure used to define fields of a FDIR related info.
  */
@@ -220,6 +214,7 @@ int hns3_fdir_filter_program(struct hns3_adapter *hns,
 int hns3_clear_all_fdir_filter(struct hns3_adapter *hns);
 int hns3_get_count(struct hns3_hw *hw, uint32_t id, uint64_t *value);
 void hns3_flow_init(struct rte_eth_dev *dev);
+void hns3_flow_uninit(struct rte_eth_dev *dev);
 int hns3_restore_all_fdir_filter(struct hns3_adapter *hns);
 
 #endif /* _HNS3_FDIR_H_ */
diff --git a/drivers/net/hns3/hns3_flow.c b/drivers/net/hns3/hns3_flow.c
index 755a6f2..fc77979 100644
--- a/drivers/net/hns3/hns3_flow.c
+++ b/drivers/net/hns3/hns3_flow.c
@@ -1202,54 +1202,34 @@ hns3_parse_fdir_filter(struct rte_eth_dev *dev,
 	return hns3_handle_actions(dev, actions, rule, error);
 }
 
-void
-hns3_flow_init(struct rte_eth_dev *dev)
-{
-	struct hns3_hw *hw = HNS3_DEV_PRIVATE_TO_HW(dev->data->dev_private);
-	struct hns3_process_private *process_list = dev->process_private;
-	pthread_mutexattr_t attr;
-
-	if (rte_eal_process_type() == RTE_PROC_PRIMARY) {
-		pthread_mutexattr_init(&attr);
-		pthread_mutexattr_setpshared(&attr, PTHREAD_PROCESS_SHARED);
-		pthread_mutex_init(&hw->flows_lock, &attr);
-		dev->data->dev_flags |= RTE_ETH_DEV_FLOW_OPS_THREAD_SAFE;
-	}
-
-	TAILQ_INIT(&process_list->fdir_list);
-	TAILQ_INIT(&process_list->filter_rss_list);
-	TAILQ_INIT(&process_list->flow_list);
-}
-
 static void
 hns3_filterlist_flush(struct rte_eth_dev *dev)
 {
-	struct hns3_process_private *process_list = dev->process_private;
+	struct hns3_hw *hw = HNS3_DEV_PRIVATE_TO_HW(dev->data->dev_private);
 	struct hns3_fdir_rule_ele *fdir_rule_ptr;
 	struct hns3_rss_conf_ele *rss_filter_ptr;
 	struct hns3_flow_mem *flow_node;
 
-	fdir_rule_ptr = TAILQ_FIRST(&process_list->fdir_list);
+	fdir_rule_ptr = TAILQ_FIRST(&hw->flow_fdir_list);
 	while (fdir_rule_ptr) {
-		TAILQ_REMOVE(&process_list->fdir_list, fdir_rule_ptr, entries);
+		TAILQ_REMOVE(&hw->flow_fdir_list, fdir_rule_ptr, entries);
 		rte_free(fdir_rule_ptr);
-		fdir_rule_ptr = TAILQ_FIRST(&process_list->fdir_list);
+		fdir_rule_ptr = TAILQ_FIRST(&hw->flow_fdir_list);
 	}
 
-	rss_filter_ptr = TAILQ_FIRST(&process_list->filter_rss_list);
+	rss_filter_ptr = TAILQ_FIRST(&hw->flow_rss_list);
 	while (rss_filter_ptr) {
-		TAILQ_REMOVE(&process_list->filter_rss_list, rss_filter_ptr,
-			     entries);
+		TAILQ_REMOVE(&hw->flow_rss_list, rss_filter_ptr, entries);
 		rte_free(rss_filter_ptr);
-		rss_filter_ptr = TAILQ_FIRST(&process_list->filter_rss_list);
+		rss_filter_ptr = TAILQ_FIRST(&hw->flow_rss_list);
 	}
 
-	flow_node = TAILQ_FIRST(&process_list->flow_list);
+	flow_node = TAILQ_FIRST(&hw->flow_list);
 	while (flow_node) {
-		TAILQ_REMOVE(&process_list->flow_list, flow_node, entries);
+		TAILQ_REMOVE(&hw->flow_list, flow_node, entries);
 		rte_free(flow_node->flow);
 		rte_free(flow_node);
-		flow_node = TAILQ_FIRST(&process_list->flow_list);
+		flow_node = TAILQ_FIRST(&hw->flow_list);
 	}
 }
 
@@ -1519,7 +1499,6 @@ static int
 hns3_config_rss_filter(struct rte_eth_dev *dev,
 		       const struct hns3_rss_conf *conf, bool add)
 {
-	struct hns3_process_private *process_list = dev->process_private;
 	struct hns3_adapter *hns = dev->data->dev_private;
 	struct hns3_rss_conf_ele *rss_filter_ptr;
 	struct hns3_hw *hw = &hns->hw;
@@ -1604,7 +1583,7 @@ hns3_config_rss_filter(struct rte_eth_dev *dev,
 	 * When create a new RSS rule, the old rule will be overlaid and set
 	 * invalid.
 	 */
-	TAILQ_FOREACH(rss_filter_ptr, &process_list->filter_rss_list, entries)
+	TAILQ_FOREACH(rss_filter_ptr, &hw->flow_rss_list, entries)
 		rss_filter_ptr->filter_info.valid = false;
 
 rss_config_err:
@@ -1616,7 +1595,6 @@ hns3_config_rss_filter(struct rte_eth_dev *dev,
 static int
 hns3_clear_rss_filter(struct rte_eth_dev *dev)
 {
-	struct hns3_process_private *process_list = dev->process_private;
 	struct hns3_adapter *hns = dev->data->dev_private;
 	struct hns3_rss_conf_ele *rss_filter_ptr;
 	struct hns3_hw *hw = &hns->hw;
@@ -1624,10 +1602,9 @@ hns3_clear_rss_filter(struct rte_eth_dev *dev)
 	int rss_rule_fail_cnt = 0; /* count for failure of clearing RSS rules */
 	int ret = 0;
 
-	rss_filter_ptr = TAILQ_FIRST(&process_list->filter_rss_list);
+	rss_filter_ptr = TAILQ_FIRST(&hw->flow_rss_list);
 	while (rss_filter_ptr) {
-		TAILQ_REMOVE(&process_list->filter_rss_list, rss_filter_ptr,
-			     entries);
+		TAILQ_REMOVE(&hw->flow_rss_list, rss_filter_ptr, entries);
 		ret = hns3_config_rss_filter(dev, &rss_filter_ptr->filter_info,
 					     false);
 		if (ret)
@@ -1635,7 +1612,7 @@ hns3_clear_rss_filter(struct rte_eth_dev *dev)
 		else
 			rss_rule_succ_cnt++;
 		rte_free(rss_filter_ptr);
-		rss_filter_ptr = TAILQ_FIRST(&process_list->filter_rss_list);
+		rss_filter_ptr = TAILQ_FIRST(&hw->flow_rss_list);
 	}
 
 	if (rss_rule_fail_cnt) {
@@ -1739,7 +1716,6 @@ hns3_flow_create(struct rte_eth_dev *dev, const struct rte_flow_attr *attr,
 		 const struct rte_flow_action actions[],
 		 struct rte_flow_error *error)
 {
-	struct hns3_process_private *process_list = dev->process_private;
 	struct hns3_adapter *hns = dev->data->dev_private;
 	struct hns3_hw *hw = &hns->hw;
 	const struct hns3_rss_conf *rss_conf;
@@ -1771,7 +1747,7 @@ hns3_flow_create(struct rte_eth_dev *dev, const struct rte_flow_attr *attr,
 	}
 
 	flow_node->flow = flow;
-	TAILQ_INSERT_TAIL(&process_list->flow_list, flow_node, entries);
+	TAILQ_INSERT_TAIL(&hw->flow_list, flow_node, entries);
 
 	act = hns3_find_rss_general_action(pattern, actions);
 	if (act) {
@@ -1793,8 +1769,7 @@ hns3_flow_create(struct rte_eth_dev *dev, const struct rte_flow_attr *attr,
 		hns3_rss_conf_copy(&rss_filter_ptr->filter_info,
 				   &rss_conf->conf);
 		rss_filter_ptr->filter_info.valid = true;
-		TAILQ_INSERT_TAIL(&process_list->filter_rss_list,
-				  rss_filter_ptr, entries);
+		TAILQ_INSERT_TAIL(&hw->flow_rss_list, rss_filter_ptr, entries);
 
 		flow->rule = rss_filter_ptr;
 		flow->filter_type = RTE_ETH_FILTER_HASH;
@@ -1828,8 +1803,7 @@ hns3_flow_create(struct rte_eth_dev *dev, const struct rte_flow_attr *attr,
 	if (!ret) {
 		memcpy(&fdir_rule_ptr->fdir_conf, &fdir_rule,
 			sizeof(struct hns3_fdir_rule));
-		TAILQ_INSERT_TAIL(&process_list->fdir_list,
-				  fdir_rule_ptr, entries);
+		TAILQ_INSERT_TAIL(&hw->flow_fdir_list, fdir_rule_ptr, entries);
 		flow->rule = fdir_rule_ptr;
 		flow->filter_type = RTE_ETH_FILTER_FDIR;
 
@@ -1844,7 +1818,7 @@ hns3_flow_create(struct rte_eth_dev *dev, const struct rte_flow_attr *attr,
 	rte_flow_error_set(error, -ret, RTE_FLOW_ERROR_TYPE_HANDLE, NULL,
 			   "Failed to create flow");
 out:
-	TAILQ_REMOVE(&process_list->flow_list, flow_node, entries);
+	TAILQ_REMOVE(&hw->flow_list, flow_node, entries);
 	rte_free(flow_node);
 	rte_free(flow);
 	return NULL;
@@ -1855,13 +1829,13 @@ static int
 hns3_flow_destroy(struct rte_eth_dev *dev, struct rte_flow *flow,
 		  struct rte_flow_error *error)
 {
-	struct hns3_process_private *process_list = dev->process_private;
 	struct hns3_adapter *hns = dev->data->dev_private;
 	struct hns3_fdir_rule_ele *fdir_rule_ptr;
 	struct hns3_rss_conf_ele *rss_filter_ptr;
 	struct hns3_flow_mem *flow_node;
 	enum rte_filter_type filter_type;
 	struct hns3_fdir_rule fdir_rule;
+	struct hns3_hw *hw = &hns->hw;
 	int ret;
 
 	if (flow == NULL)
@@ -1884,7 +1858,7 @@ hns3_flow_destroy(struct rte_eth_dev *dev, struct rte_flow *flow,
 						  "Destroy FDIR fail.Try again");
 		if (fdir_rule.flags & HNS3_RULE_FLAG_COUNTER)
 			hns3_counter_release(dev, fdir_rule.act_cnt.id);
-		TAILQ_REMOVE(&process_list->fdir_list, fdir_rule_ptr, entries);
+		TAILQ_REMOVE(&hw->flow_fdir_list, fdir_rule_ptr, entries);
 		rte_free(fdir_rule_ptr);
 		fdir_rule_ptr = NULL;
 		break;
@@ -1897,8 +1871,7 @@ hns3_flow_destroy(struct rte_eth_dev *dev, struct rte_flow *flow,
 						  RTE_FLOW_ERROR_TYPE_HANDLE,
 						  flow,
 						  "Destroy RSS fail.Try again");
-		TAILQ_REMOVE(&process_list->filter_rss_list, rss_filter_ptr,
-			     entries);
+		TAILQ_REMOVE(&hw->flow_rss_list, rss_filter_ptr, entries);
 		rte_free(rss_filter_ptr);
 		rss_filter_ptr = NULL;
 		break;
@@ -1908,10 +1881,9 @@ hns3_flow_destroy(struct rte_eth_dev *dev, struct rte_flow *flow,
 					  "Unsupported filter type");
 	}
 
-	TAILQ_FOREACH(flow_node, &process_list->flow_list, entries) {
+	TAILQ_FOREACH(flow_node, &hw->flow_list, entries) {
 		if (flow_node->flow == flow) {
-			TAILQ_REMOVE(&process_list->flow_list, flow_node,
-				     entries);
+			TAILQ_REMOVE(&hw->flow_list, flow_node, entries);
 			rte_free(flow_node);
 			flow_node = NULL;
 			break;
@@ -2097,3 +2069,30 @@ hns3_dev_flow_ops_get(struct rte_eth_dev *dev,
 	*ops = &hns3_flow_ops;
 	return 0;
 }
+
+void
+hns3_flow_init(struct rte_eth_dev *dev)
+{
+	struct hns3_hw *hw = HNS3_DEV_PRIVATE_TO_HW(dev->data->dev_private);
+	pthread_mutexattr_t attr;
+
+	if (rte_eal_process_type() != RTE_PROC_PRIMARY)
+		return;
+
+	pthread_mutexattr_init(&attr);
+	pthread_mutexattr_setpshared(&attr, PTHREAD_PROCESS_SHARED);
+	pthread_mutex_init(&hw->flows_lock, &attr);
+	dev->data->dev_flags |= RTE_ETH_DEV_FLOW_OPS_THREAD_SAFE;
+
+	TAILQ_INIT(&hw->flow_fdir_list);
+	TAILQ_INIT(&hw->flow_rss_list);
+	TAILQ_INIT(&hw->flow_list);
+}
+
+void
+hns3_flow_uninit(struct rte_eth_dev *dev)
+{
+	struct rte_flow_error error;
+	if (rte_eal_process_type() == RTE_PROC_PRIMARY)
+		hns3_flow_flush_wrap(dev, &error);
+}
-- 
2.7.4


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

* [dpdk-dev] [PATCH 8/8] net/hns3: fix Tx pkt prepare address when dev stop
  2021-07-17  2:02 [dpdk-dev] [PATCH 0/8] bugfix for hns3 PMD Min Hu (Connor)
                   ` (6 preceding siblings ...)
  2021-07-17  2:02 ` [dpdk-dev] [PATCH 7/8] net/hns3: fix flow list separate management Min Hu (Connor)
@ 2021-07-17  2:02 ` Min Hu (Connor)
  2021-07-23 12:49 ` [dpdk-dev] [PATCH 0/8] bugfix for hns3 PMD Thomas Monjalon
  8 siblings, 0 replies; 10+ messages in thread
From: Min Hu (Connor) @ 2021-07-17  2:02 UTC (permalink / raw)
  To: dev; +Cc: ferruh.yigit, andrew.rybchenko

From: Huisong Li <lihuisong@huawei.com>

In some special scenarios, such as TSO scenarios, the user layer may need
to call the tx_pkt_prepare(), and then call tx_pkt_burst() to send packets.
If the return value of tx_pkt_parepare() isn't equal to the numbers of
packets requested to send, warning message may be printed at the user
layer. Currently, tx_pkt_prepare() is assigned to dummy function when
dev_stop() is called in hns3 PMD. At this moment, if user layer continues
to send packets, the warning message will always be printed. So this patch
modifies the address to NULL.

Fixes: 2790c6464725 ("net/hns3: support device reset")
Cc: stable@dpdk.org

Signed-off-by: Huisong Li <lihuisong@huawei.com>
Signed-off-by: Min Hu (Connor) <humin29@huawei.com>
---
 drivers/net/hns3/hns3_rxtx.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/drivers/net/hns3/hns3_rxtx.c b/drivers/net/hns3/hns3_rxtx.c
index a86e105..d3fbe08 100644
--- a/drivers/net/hns3/hns3_rxtx.c
+++ b/drivers/net/hns3/hns3_rxtx.c
@@ -4386,7 +4386,7 @@ void hns3_set_rxtx_function(struct rte_eth_dev *eth_dev)
 	} else {
 		eth_dev->rx_pkt_burst = hns3_dummy_rxtx_burst;
 		eth_dev->tx_pkt_burst = hns3_dummy_rxtx_burst;
-		eth_dev->tx_pkt_prepare = hns3_dummy_rxtx_burst;
+		eth_dev->tx_pkt_prepare = NULL;
 	}
 }
 
-- 
2.7.4


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

* Re: [dpdk-dev] [PATCH 0/8] bugfix for hns3 PMD
  2021-07-17  2:02 [dpdk-dev] [PATCH 0/8] bugfix for hns3 PMD Min Hu (Connor)
                   ` (7 preceding siblings ...)
  2021-07-17  2:02 ` [dpdk-dev] [PATCH 8/8] net/hns3: fix Tx pkt prepare address when dev stop Min Hu (Connor)
@ 2021-07-23 12:49 ` Thomas Monjalon
  8 siblings, 0 replies; 10+ messages in thread
From: Thomas Monjalon @ 2021-07-23 12:49 UTC (permalink / raw)
  To: Min Hu (Connor); +Cc: dev, ferruh.yigit, andrew.rybchenko

17/07/2021 04:02, Min Hu (Connor):
> This patchset contains 8 bugfixes for hns3 PMD.
> 
> Chengchang Tang (2):
>   net/hns3: fix residual MAC address entry
>   net/hns3: delete duplicate compile-time check
> 
> Chengwen Feng (3):
>   net/hns3: delete unnecessary zero assignments
>   net/hns3: fix incorrect comment
>   net/hns3: fix flow list separate management
> 
> HongBo Zheng (1):
>   net/hns3: fix the timing issue of clearing interrupt source
> 
> Huisong Li (2):
>   net/hns3: fix a print position about auto-negotiation
>   net/hns3: fix Tx pkt prepare address when dev stop

Applied, thanks.




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

end of thread, other threads:[~2021-07-23 12:49 UTC | newest]

Thread overview: 10+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2021-07-17  2:02 [dpdk-dev] [PATCH 0/8] bugfix for hns3 PMD Min Hu (Connor)
2021-07-17  2:02 ` [dpdk-dev] [PATCH 1/8] net/hns3: fix residual MAC address entry Min Hu (Connor)
2021-07-17  2:02 ` [dpdk-dev] [PATCH 2/8] net/hns3: delete unnecessary zero assignments Min Hu (Connor)
2021-07-17  2:02 ` [dpdk-dev] [PATCH 3/8] net/hns3: fix incorrect comment Min Hu (Connor)
2021-07-17  2:02 ` [dpdk-dev] [PATCH 4/8] net/hns3: fix the timing issue of clearing interrupt source Min Hu (Connor)
2021-07-17  2:02 ` [dpdk-dev] [PATCH 5/8] net/hns3: delete duplicate compile-time check Min Hu (Connor)
2021-07-17  2:02 ` [dpdk-dev] [PATCH 6/8] net/hns3: fix a print position about auto-negotiation Min Hu (Connor)
2021-07-17  2:02 ` [dpdk-dev] [PATCH 7/8] net/hns3: fix flow list separate management Min Hu (Connor)
2021-07-17  2:02 ` [dpdk-dev] [PATCH 8/8] net/hns3: fix Tx pkt prepare address when dev stop Min Hu (Connor)
2021-07-23 12:49 ` [dpdk-dev] [PATCH 0/8] bugfix for hns3 PMD Thomas Monjalon

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