Skip to contentSkip to conversation

bugfix for hns3 PMD

PATCH Applied Min Hu (Connor) 2 participants 10 messages Jul 17, 2021 – Jul 23, 2021 Network drivers

lore
Share & tools
lore
#0 lore raw

cover bugfix for hns3 PMD

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(-)
Signature · 1 line
2.7.4
#1 lore raw

PATCH 1/8 net/hns3: fix residual MAC address entry

From: Chengchang Tang <[email protected]>

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")
---
 drivers/net/hns3/hns3_ethdev.c | 22 +++++++++-------------
 1 file changed, 9 insertions(+), 13 deletions(-)
drivers/net/hns3/hns3_ethdev.c +9 -13
index 17b995a..3699b56 100644
@@ -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);
 
Signature · 1 line
2.7.4
#2 lore raw

PATCH 2/8 net/hns3: delete unnecessary zero assignments

In reply to Min Hu (Connor)

From: Chengwen Feng <[email protected]>

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")
---
 drivers/net/hns3/hns3_tm.c | 18 ------------------
 1 file changed, 18 deletions(-)
drivers/net/hns3/hns3_tm.c +0 -18
index 7fd9818..db5ac78 100644
@@ -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;
 }
Signature · 1 line
2.7.4
#3 lore raw

PATCH 3/8 net/hns3: fix incorrect comment

In reply to Min Hu (Connor)

From: Chengwen Feng <[email protected]>

This patch fixed incorrect comment of hns3_parse_fdir_filter().

Fixes fcba820d9b9e ("net/hns3: support flow director")
---
 drivers/net/hns3/hns3_flow.c | 59 +++++++++++++++++---------------------------
 1 file changed, 23 insertions(+), 36 deletions(-)
drivers/net/hns3/hns3_flow.c +23 -36
index 82810e0..755a6f2 100644
@@ -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,
Signature · 1 line
2.7.4
#4 lore raw

PATCH 4/8 net/hns3: fix the timing issue of clearing interrupt source

In reply to Min Hu (Connor)

From: HongBo Zheng <[email protected]>

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")
---
 drivers/net/hns3/hns3_ethdev.c    | 2 +-
 drivers/net/hns3/hns3_ethdev_vf.c | 5 ++---
 2 files changed, 3 insertions(+), 4 deletions(-)
drivers/net/hns3/hns3_ethdev.c +1 -1
index 3699b56..f994c28 100644
@@ -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);
 }
drivers/net/hns3/hns3_ethdev_vf.c +2 -3
index 8f3be64..de659c0 100644
@@ -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);
 }
Signature · 1 line
2.7.4
#5 lore raw

PATCH 5/8 net/hns3: delete duplicate compile-time check

In reply to Min Hu (Connor)

From: Chengchang Tang <[email protected]>

This patch delete duplicate compile-gime check.

Fixes cb12e988f35f ("net/hns3: add compile-time verification on Rx vector")
---
 drivers/net/hns3/hns3_rxtx_vec.c | 4 ----
 1 file changed, 4 deletions(-)
drivers/net/hns3/hns3_rxtx_vec.c +0 -4
index cc8b970..844512f 100644
@@ -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) -
Signature · 1 line
2.7.4
#6 lore raw

PATCH 6/8 net/hns3: fix a print position about auto-negotiation

In reply to Min Hu (Connor)

From: Huisong Li <[email protected]>

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")
---
 drivers/net/hns3/hns3_ethdev.c | 14 +++++++-------
 1 file changed, 7 insertions(+), 7 deletions(-)
drivers/net/hns3/hns3_ethdev.c +7 -7
index f994c28..4a302d2 100644
@@ -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);
 }
Signature · 1 line
2.7.4
#7 lore raw

PATCH 7/8 net/hns3: fix flow list separate management

In reply to Min Hu (Connor)

From: Chengwen Feng <[email protected]>

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")
---
 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(-)
drivers/net/hns3/hns3_ethdev.c +3 -21
index 4a302d2..a374fa7 100644
@@ -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);
drivers/net/hns3/hns3_ethdev.h +3 -0
index 3485614..8e66d9f 100644
@@ -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
drivers/net/hns3/hns3_ethdev_vf.c +3 -21
index de659c0..8d9b797 100644
@@ -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);
drivers/net/hns3/hns3_fdir.h +1 -6
index fc62daa..3f610f7 100644
@@ -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_ */
drivers/net/hns3/hns3_flow.c +50 -51

220 lines not on this page · raw message

Signature · 1 line
2.7.4
#8 lore raw

PATCH 8/8 net/hns3: fix Tx pkt prepare address when dev stop

In reply to Min Hu (Connor)

From: Huisong Li <[email protected]>

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")
---
 drivers/net/hns3/hns3_rxtx.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)
drivers/net/hns3/hns3_rxtx.c +1 -1
index a86e105..d3fbe08 100644
@@ -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;
 	}
 }
 
Signature · 1 line
2.7.4
#9 lore raw
In reply to Min Hu (Connor)

17/07/2021 04:02, Min Hu (Connor):

Quoted 11 lines

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

Quoted 6 lines

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.