Skip to contentSkip to conversation

net/ice: fix RSS advanced rule invalid issue

PATCH Superseded Junyu Jiang 4 participants 13 messages Mar 19, 2020 – Apr 8, 2020 Network drivers

lore
Share & tools
lore
#0 lore raw

PATCH 1/1 net/ice: fix RSS advanced rule invalid issue

This patch added a restore function of RSS advanced rule to fix the rule invalid when after running port stop and port start.

Fixes 5ad3db8d4bdd ("net/ice: enable advanced RSS")
---
 drivers/net/ice/ice_ethdev.c | 47 ++++++++++++++++++++++++++++++++++++
 1 file changed, 47 insertions(+)
drivers/net/ice/ice_ethdev.c +47 -0
index 85ef83e92..2dd8120f1 100644
@@ -47,6 +47,11 @@ struct proto_xtr_ol_flag {
 	bool required;
 };
 
+struct ice_hash_flow_cfg {
+	bool simple_xor;
+	struct ice_rss_cfg rss_cfg;
+};
+
 static struct proto_xtr_ol_flag ice_proto_xtr_ol_flag_params[] = {
 	[PROTO_XTR_VLAN] = {
 		.param = { .name = "ice_dynflag_proto_xtr_vlan" },
@@ -2464,6 +2469,45 @@ ice_dev_configure(struct rte_eth_dev *dev)
 	return 0;
 }
 
+static int
+ice_rss_restore(struct rte_eth_dev *dev)
+{
+	struct ice_pf *pf = ICE_DEV_PRIVATE_TO_PF(dev->data->dev_private);
+	struct ice_hw *hw = ICE_PF_TO_HW(pf);
+	struct ice_vsi *vsi = pf->main_vsi;
+	struct rte_flow *p_flow;
+	struct ice_hash_flow_cfg *filter_ptr;
+	struct ice_flow_engine *engine;
+	uint32_t reg;
+	int ret;
+
+	TAILQ_FOREACH(p_flow, &pf->flow_list, node) {
+		engine = p_flow->engine;
+		if (engine->type == ICE_FLOW_ENGINE_HASH) {
+			filter_ptr = (struct ice_hash_flow_cfg *)p_flow->rule;
+			/* Enable registers for simple_xor hash function. */
+			if (filter_ptr->simple_xor == 1) {
+				reg = ICE_READ_REG(hw,
+					VSIQF_HASH_CTL(vsi->vsi_id));
+				reg = (reg & (~VSIQF_HASH_CTL_HASH_SCHEME_M)) |
+					(2 << VSIQF_HASH_CTL_HASH_SCHEME_S);
+				ICE_WRITE_REG(hw,
+					VSIQF_HASH_CTL(vsi->vsi_id), reg);
+			} else {
+				ret = ice_add_rss_cfg(hw, vsi->idx,
+					filter_ptr->rss_cfg.hashed_flds,
+					filter_ptr->rss_cfg.packet_hdr,
+					filter_ptr->rss_cfg.symm);
+				if (ret)
+					PMD_DRV_LOG(ERR,
+						"%s restore rss fail %d",
+						__func__, ret);
+			}
+		}
+	}
+	return 0;
+}
+
 static int ice_init_rss(struct ice_pf *pf)
 {
 	struct ice_hw *hw = ICE_PF_TO_HW(pf);
@@ -2591,6 +2635,9 @@ static int ice_init_rss(struct ice_pf *pf)
 		PMD_DRV_LOG(ERR, "%s PPPoE/PPPoD_SessionID rss flow fail %d",
 				__func__, ret);
 
+	/* restore RSS configuration */
+	ice_rss_restore(dev);
+
 	return 0;
 }
 
Signature · 1 line
2.17.1
#1 lore raw

Hi, Junyu
Comments inline.
And I have a proposal, why we don't put ice_rss_init into ice_dev_init, so the rss rule will not recovery.

Qiming

Quoted 10 lines

-----Original Message-----
From: Jiang, JunyuX <[email protected]>
Sent: Thursday, March 19, 2020 15:48
To: [email protected]
Cc: Yang, Qiming <[email protected]>; Zhang, Qi Z <[email protected]>; Jiang, JunyuX <[email protected]>; [email protected]
Subject: [PATCH] net/ice: fix RSS advanced rule invalid issue

This patch added a restore function of RSS advanced rule to fix the rule

I think it should be 'for RSS advanced rule'

Quoted 1 line

invalid when after running port stop and port start.

Delete 'when'

Quoted 15 lines
Fixes 5ad3db8d4bdd ("net/ice: enable advanced RSS")
---
 drivers/net/ice/ice_ethdev.c | 47
++++++++++++++++++++++++++++++++++++
 1 file changed, 47 insertions(+)
drivers/net/ice/ice_ethdev.c +0 -0
index 85ef83e92..2dd8120f1 100644

drivers/net/ice/ice_ethdev.c struct proto_xtr_ol_flag { · line 51

Quoted 5 lines
drivers/net/ice/ice_ethdev.c +2 -0
@@ -47,6 +47,11 @@ struct proto_xtr_ol_flag {
 	bool required;
 };
 
+struct ice_hash_flow_cfg {
+	bool simple_xor;

Why not an enum for the algorithm?

Quoted 14 lines
drivers/net/ice/ice_ethdev.c +3 -0
+	struct ice_rss_cfg rss_cfg;
+};
+
 static struct proto_xtr_ol_flag ice_proto_xtr_ol_flag_params[] = {
 	[PROTO_XTR_VLAN] = {
 		.param = { .name = "ice_dynflag_proto_xtr_vlan" }, @@ -

2464,6 +2469,45 @@ ice_dev_configure(struct rte_eth_dev *dev)

drivers/net/ice/ice_ethdev.c +3 -0
 	return 0;
 }
 
+static int
+ice_rss_restore(struct rte_eth_dev *dev) {
+	struct ice_pf *pf = ICE_DEV_PRIVATE_TO_PF(dev->data-
Quoted 1 line

dev_private);

drivers/net/ice/ice_ethdev.c ice_dev_configure(struct rte_eth_dev *dev) · line 2476

Quoted 1 line
drivers/net/ice/ice_ethdev.c +1 -0
+	struct ice_hw *hw = ICE_PF_TO_HW(pf);

Please use the same function as PF, like DEV_TO_PF

drivers/net/ice/ice_ethdev.c ice_dev_configure(struct rte_eth_dev *dev) · line 2479

Quoted 3 lines
drivers/net/ice/ice_ethdev.c +3 -0
+	struct ice_vsi *vsi = pf->main_vsi;
+	struct rte_flow *p_flow;
+	struct ice_hash_flow_cfg *filter_ptr;

What's the ptr means?

Quoted 48 lines
drivers/net/ice/ice_ethdev.c +13 -0
+	struct ice_flow_engine *engine;
+	uint32_t reg;
+	int ret;
+
+	TAILQ_FOREACH(p_flow, &pf->flow_list, node) {
+		engine = p_flow->engine;
+		if (engine->type == ICE_FLOW_ENGINE_HASH) {
+			filter_ptr = (struct ice_hash_flow_cfg *)p_flow->rule;
+			/* Enable registers for simple_xor hash function. */
+			if (filter_ptr->simple_xor == 1) {
+				reg = ICE_READ_REG(hw,
+					VSIQF_HASH_CTL(vsi->vsi_id));
+				reg = (reg &

(~VSIQF_HASH_CTL_HASH_SCHEME_M)) |

drivers/net/ice/ice_ethdev.c +1 -0
+					(2 <<

VSIQF_HASH_CTL_HASH_SCHEME_S);

drivers/net/ice/ice_ethdev.c +20 -1
+				ICE_WRITE_REG(hw,
+					VSIQF_HASH_CTL(vsi->vsi_id), reg);
+			} else {
+				ret = ice_add_rss_cfg(hw, vsi->idx,
+					filter_ptr->rss_cfg.hashed_flds,
+					filter_ptr->rss_cfg.packet_hdr,
+					filter_ptr->rss_cfg.symm);
+				if (ret)
+					PMD_DRV_LOG(ERR,
+						"%s restore rss fail %d",
+						__func__, ret);
+			}
+		}
+	}
+	return 0;
+}
+
 static int ice_init_rss(struct ice_pf *pf)  {
 	struct ice_hw *hw = ICE_PF_TO_HW(pf);
@@ -2591,6 +2635,9 @@ static int ice_init_rss(struct ice_pf *pf)
 		PMD_DRV_LOG(ERR, "%s PPPoE/PPPoD_SessionID rss flow
 fail %d",
 				__func__, ret);
 
+	/* restore RSS configuration */
+	ice_rss_restore(dev);
+
 	return 0;
 }
 
--

2.17.1

#2 lore raw

PATCH v2 1/1 net/ice: fix RSS advanced rule invalid issue

In reply to Junyu Jiang

This patch added a restore function for RSS advanced rule to fix the rule invalid after running port stop and port start.

Fixes 5ad3db8d4bdd ("net/ice: enable advanced RSS")
---
 drivers/net/ice/ice_ethdev.c | 47 ++++++++++++++++++++++++++++++++++++
 1 file changed, 47 insertions(+)
drivers/net/ice/ice_ethdev.c +47 -0
index 85ef83e92..2dd8120f1 100644
@@ -47,6 +47,11 @@ struct proto_xtr_ol_flag {
 	bool required;
 };
 
+struct ice_hash_flow_cfg {
+	bool simple_xor;
+	struct ice_rss_cfg rss_cfg;
+};
+
 static struct proto_xtr_ol_flag ice_proto_xtr_ol_flag_params[] = {
 	[PROTO_XTR_VLAN] = {
 		.param = { .name = "ice_dynflag_proto_xtr_vlan" },
@@ -2464,6 +2469,45 @@ ice_dev_configure(struct rte_eth_dev *dev)
 	return 0;
 }
 
+static int
+ice_rss_restore(struct rte_eth_dev *dev)
+{
+	struct ice_pf *pf = ICE_DEV_PRIVATE_TO_PF(dev->data->dev_private);
+	struct ice_hw *hw = ICE_PF_TO_HW(pf);
+	struct ice_vsi *vsi = pf->main_vsi;
+	struct rte_flow *p_flow;
+	struct ice_hash_flow_cfg *filter_ptr;
+	struct ice_flow_engine *engine;
+	uint32_t reg;
+	int ret;
+
+	TAILQ_FOREACH(p_flow, &pf->flow_list, node) {
+		engine = p_flow->engine;
+		if (engine->type == ICE_FLOW_ENGINE_HASH) {
+			filter_ptr = (struct ice_hash_flow_cfg *)p_flow->rule;
+			/* Enable registers for simple_xor hash function. */
+			if (filter_ptr->simple_xor == 1) {
+				reg = ICE_READ_REG(hw,
+					VSIQF_HASH_CTL(vsi->vsi_id));
+				reg = (reg & (~VSIQF_HASH_CTL_HASH_SCHEME_M)) |
+					(2 << VSIQF_HASH_CTL_HASH_SCHEME_S);
+				ICE_WRITE_REG(hw,
+					VSIQF_HASH_CTL(vsi->vsi_id), reg);
+			} else {
+				ret = ice_add_rss_cfg(hw, vsi->idx,
+					filter_ptr->rss_cfg.hashed_flds,
+					filter_ptr->rss_cfg.packet_hdr,
+					filter_ptr->rss_cfg.symm);
+				if (ret)
+					PMD_DRV_LOG(ERR,
+						"%s restore rss fail %d",
+						__func__, ret);
+			}
+		}
+	}
+	return 0;
+}
+
 static int ice_init_rss(struct ice_pf *pf)
 {
 	struct ice_hw *hw = ICE_PF_TO_HW(pf);
@@ -2591,6 +2635,9 @@ static int ice_init_rss(struct ice_pf *pf)
 		PMD_DRV_LOG(ERR, "%s PPPoE/PPPoD_SessionID rss flow fail %d",
 				__func__, ret);
 
+	/* restore RSS configuration */
+	ice_rss_restore(dev);
+
 	return 0;
 }
 
Signature · 1 line
2.17.1
#3 lore raw

PATCH v2 1/1 net/ice: fix RSS advanced rule invalid issue

In reply to Junyu Jiang

This patch added a restore function for RSS advanced rule to fix the rule invalid after running port stop and port start.

Fixes 5ad3db8d4bdd ("net/ice: enable advanced RSS")
---
 drivers/net/ice/ice_ethdev.c | 47 ++++++++++++++++++++++++++++++++++++
 1 file changed, 47 insertions(+)
drivers/net/ice/ice_ethdev.c +47 -0
index 85ef83e92..c2ee37c59 100644
@@ -47,6 +47,11 @@ struct proto_xtr_ol_flag {
 	bool required;
 };
 
+struct ice_hash_flow_cfg {
+	bool simple_xor;
+	struct ice_rss_cfg rss_cfg;
+};
+
 static struct proto_xtr_ol_flag ice_proto_xtr_ol_flag_params[] = {
 	[PROTO_XTR_VLAN] = {
 		.param = { .name = "ice_dynflag_proto_xtr_vlan" },
@@ -2464,6 +2469,45 @@ ice_dev_configure(struct rte_eth_dev *dev)
 	return 0;
 }
 
+static int
+ice_rss_restore(struct rte_eth_dev *dev)
+{
+	struct ice_pf *pf = ICE_DEV_PRIVATE_TO_PF(dev->data->dev_private);
+	struct ice_hw *hw = ICE_DEV_PRIVATE_TO_HW(dev->data->dev_private);
+	struct ice_vsi *vsi = pf->main_vsi;
+	struct rte_flow *p_flow;
+	struct ice_hash_flow_cfg *filter_ptr;
+	struct ice_flow_engine *engine;
+	uint32_t reg;
+	int ret;
+
+	TAILQ_FOREACH(p_flow, &pf->flow_list, node) {
+		engine = p_flow->engine;
+		if (engine->type == ICE_FLOW_ENGINE_HASH) {
+			filter_ptr = (struct ice_hash_flow_cfg *)p_flow->rule;
+			/* Enable registers for simple_xor hash function. */
+			if (filter_ptr->simple_xor == 1) {
+				reg = ICE_READ_REG(hw,
+					VSIQF_HASH_CTL(vsi->vsi_id));
+				reg = (reg & (~VSIQF_HASH_CTL_HASH_SCHEME_M)) |
+					(2 << VSIQF_HASH_CTL_HASH_SCHEME_S);
+				ICE_WRITE_REG(hw,
+					VSIQF_HASH_CTL(vsi->vsi_id), reg);
+			} else {
+				ret = ice_add_rss_cfg(hw, vsi->idx,
+					filter_ptr->rss_cfg.hashed_flds,
+					filter_ptr->rss_cfg.packet_hdr,
+					filter_ptr->rss_cfg.symm);
+				if (ret)
+					PMD_DRV_LOG(ERR,
+						"%s restore rss fail %d",
+						__func__, ret);
+			}
+		}
+	}
+	return 0;
+}
+
 static int ice_init_rss(struct ice_pf *pf)
 {
 	struct ice_hw *hw = ICE_PF_TO_HW(pf);
@@ -2591,6 +2635,9 @@ static int ice_init_rss(struct ice_pf *pf)
 		PMD_DRV_LOG(ERR, "%s PPPoE/PPPoD_SessionID rss flow fail %d",
 				__func__, ret);
 
+	/* restore RSS configuration */
+	ice_rss_restore(dev);
+
 	return 0;
 }
 
Signature · 1 line
2.17.1
#4 lore raw

Hi, Junyu
NACKed.
I still keep my point of view, I think no need to enable a restore function.
Beside, 'ptr' = rss rule? I don't get your point, please don't define a various with a no meaning name.

Hi, Qi
What do you think about move the 'ice_rss_init' into 'ice_dev_init' ?

Qiming

Quoted 98 lines

-----Original Message-----
From: Jiang, JunyuX <[email protected]>
Sent: Thursday, March 26, 2020 14:57
To: [email protected]
Cc: Zhang, Qi Z <[email protected]>; Yang, Qiming <[email protected]>; Jiang, JunyuX <[email protected]>; [email protected]
Subject: [PATCH v2] net/ice: fix RSS advanced rule invalid issue

This patch added a restore function for RSS advanced rule to fix the rule invalid after running port stop and port start.

Fixes 5ad3db8d4bdd ("net/ice: enable advanced RSS")
---
 drivers/net/ice/ice_ethdev.c | 47
++++++++++++++++++++++++++++++++++++
 1 file changed, 47 insertions(+)
drivers/net/ice/ice_ethdev.c +5 -0
index 85ef83e92..c2ee37c59 100644
@@ -47,6 +47,11 @@ struct proto_xtr_ol_flag {
 	bool required;
 };
 
+struct ice_hash_flow_cfg {
+	bool simple_xor;
+	struct ice_rss_cfg rss_cfg;
+};
+
 static struct proto_xtr_ol_flag ice_proto_xtr_ol_flag_params[] = {
 	[PROTO_XTR_VLAN] = {
 		.param = { .name = "ice_dynflag_proto_xtr_vlan" }, @@ -

2464,6 +2469,45 @@ ice_dev_configure(struct rte_eth_dev *dev)

drivers/net/ice/ice_ethdev.c +3 -0
 	return 0;
 }
 
+static int
+ice_rss_restore(struct rte_eth_dev *dev) {
+	struct ice_pf *pf = ICE_DEV_PRIVATE_TO_PF(dev->data-
Quoted 1 line

dev_private);

drivers/net/ice/ice_ethdev.c +1 -0
+	struct ice_hw *hw = ICE_DEV_PRIVATE_TO_HW(dev->data-
Quoted 1 line

dev_private);

drivers/net/ice/ice_ethdev.c +16 -0
+	struct ice_vsi *vsi = pf->main_vsi;
+	struct rte_flow *p_flow;
+	struct ice_hash_flow_cfg *filter_ptr;
+	struct ice_flow_engine *engine;
+	uint32_t reg;
+	int ret;
+
+	TAILQ_FOREACH(p_flow, &pf->flow_list, node) {
+		engine = p_flow->engine;
+		if (engine->type == ICE_FLOW_ENGINE_HASH) {
+			filter_ptr = (struct ice_hash_flow_cfg *)p_flow->rule;
+			/* Enable registers for simple_xor hash function. */
+			if (filter_ptr->simple_xor == 1) {
+				reg = ICE_READ_REG(hw,
+					VSIQF_HASH_CTL(vsi->vsi_id));
+				reg = (reg &

(~VSIQF_HASH_CTL_HASH_SCHEME_M)) |

drivers/net/ice/ice_ethdev.c +1 -0
+					(2 <<

VSIQF_HASH_CTL_HASH_SCHEME_S);

drivers/net/ice/ice_ethdev.c +20 -1
+				ICE_WRITE_REG(hw,
+					VSIQF_HASH_CTL(vsi->vsi_id), reg);
+			} else {
+				ret = ice_add_rss_cfg(hw, vsi->idx,
+					filter_ptr->rss_cfg.hashed_flds,
+					filter_ptr->rss_cfg.packet_hdr,
+					filter_ptr->rss_cfg.symm);
+				if (ret)
+					PMD_DRV_LOG(ERR,
+						"%s restore rss fail %d",
+						__func__, ret);
+			}
+		}
+	}
+	return 0;
+}
+
 static int ice_init_rss(struct ice_pf *pf)  {
 	struct ice_hw *hw = ICE_PF_TO_HW(pf);
@@ -2591,6 +2635,9 @@ static int ice_init_rss(struct ice_pf *pf)
 		PMD_DRV_LOG(ERR, "%s PPPoE/PPPoD_SessionID rss flow
 fail %d",
 				__func__, ret);
 
+	/* restore RSS configuration */
+	ice_rss_restore(dev);
+
 	return 0;
 }
 
--

2.17.1

#5 lore raw

PATCH v3 1/1 net/ice: fix RSS advanced rule invalid issue

In reply to Junyu Jiang

This patch moved the ice_init_rss into ice_dev_configure to fix RSS advanced rule invalid after running port stop and port start.

Fixes 5ad3db8d4bdd ("net/ice: enable advanced RSS")
---
 drivers/net/ice/ice_ethdev.c | 13 +++++++------
 1 file changed, 7 insertions(+), 6 deletions(-)
drivers/net/ice/ice_ethdev.c +7 -6
index 85ef83e92..1d94d2a41 100644
@@ -155,6 +155,7 @@ static int ice_dev_udp_tunnel_port_add(struct rte_eth_dev *dev,
 			struct rte_eth_udp_tunnel *udp_tunnel);
 static int ice_dev_udp_tunnel_port_del(struct rte_eth_dev *dev,
 			struct rte_eth_udp_tunnel *udp_tunnel);
+static int ice_init_rss(struct ice_pf *pf);
 
 static const struct rte_pci_id pci_id_ice_map[] = {
 	{ RTE_PCI_DEVICE(ICE_INTEL_VENDOR_ID, ICE_DEV_ID_E810C_BACKPLANE) },
@@ -2451,6 +2452,8 @@ ice_dev_configure(struct rte_eth_dev *dev)
 {
 	struct ice_adapter *ad =
 		ICE_DEV_PRIVATE_TO_ADAPTER(dev->data->dev_private);
+	struct ice_pf *pf = ICE_DEV_PRIVATE_TO_PF(dev->data->dev_private);
+	int ret;
 
 	/* Initialize to TRUE. If any of Rx queues doesn't meet the
 	 * bulk allocation or vector Rx preconditions we will reset it.
@@ -2461,6 +2464,10 @@ ice_dev_configure(struct rte_eth_dev *dev)
 	if (dev->data->dev_conf.rxmode.mq_mode & ETH_MQ_RX_RSS_FLAG)
 		dev->data->dev_conf.rxmode.offloads |= DEV_RX_OFFLOAD_RSS_HASH;
 
+	ret = ice_init_rss(pf);
+	if (ret)
+		PMD_DRV_LOG(ERR, "Failed to enable rss for PF");
+
 	return 0;
 }
 
@@ -2797,12 +2804,6 @@ ice_dev_start(struct rte_eth_dev *dev)
 		}
 	}
 
-	ret = ice_init_rss(pf);
-	if (ret) {
-		PMD_DRV_LOG(ERR, "Failed to enable rss for PF");
-		goto rx_err;
-	}
-
 	ice_set_rx_function(dev);
 	ice_set_tx_function(dev);
 
Signature · 1 line
2.17.1
#6 lore raw

PATCH v4 1/1 net/ice: fix RSS advanced rule invalid issue

In reply to Junyu Jiang

This patch moved the RSS initialization from dev start to dev configure to fix RSS advanced rule invalid after running port stop and port start.

Fixes 5ad3db8d4bdd ("net/ice: enable advanced RSS")
---
 drivers/net/ice/ice_ethdev.c | 48 ++++++++++++++++++------------------
 1 file changed, 24 insertions(+), 24 deletions(-)
drivers/net/ice/ice_ethdev.c +24 -24
index 85ef83e92..4cfdbd838 100644
@@ -2446,24 +2446,6 @@ ice_dev_uninit(struct rte_eth_dev *dev)
 	return 0;
 }
 
-static int
-ice_dev_configure(struct rte_eth_dev *dev)
-{
-	struct ice_adapter *ad =
-		ICE_DEV_PRIVATE_TO_ADAPTER(dev->data->dev_private);
-
-	/* Initialize to TRUE. If any of Rx queues doesn't meet the
-	 * bulk allocation or vector Rx preconditions we will reset it.
-	 */
-	ad->rx_bulk_alloc_allowed = true;
-	ad->tx_simple_allowed = true;
-
-	if (dev->data->dev_conf.rxmode.mq_mode & ETH_MQ_RX_RSS_FLAG)
-		dev->data->dev_conf.rxmode.offloads |= DEV_RX_OFFLOAD_RSS_HASH;
-
-	return 0;
-}
-
 static int ice_init_rss(struct ice_pf *pf)
 {
 	struct ice_hw *hw = ICE_PF_TO_HW(pf);
@@ -2594,6 +2576,30 @@ static int ice_init_rss(struct ice_pf *pf)
 	return 0;
 }
 
+static int
+ice_dev_configure(struct rte_eth_dev *dev)
+{
+	struct ice_adapter *ad =
+		ICE_DEV_PRIVATE_TO_ADAPTER(dev->data->dev_private);
+	struct ice_pf *pf = ICE_DEV_PRIVATE_TO_PF(dev->data->dev_private);
+	int ret;
+
+	/* Initialize to TRUE. If any of Rx queues doesn't meet the
+	 * bulk allocation or vector Rx preconditions we will reset it.
+	 */
+	ad->rx_bulk_alloc_allowed = true;
+	ad->tx_simple_allowed = true;
+
+	if (dev->data->dev_conf.rxmode.mq_mode & ETH_MQ_RX_RSS_FLAG)
+		dev->data->dev_conf.rxmode.offloads |= DEV_RX_OFFLOAD_RSS_HASH;
+
+	ret = ice_init_rss(pf);
+	if (ret)
+		PMD_DRV_LOG(ERR, "Failed to enable rss for PF");
+
+	return ret;
+}
+
 static void
 __vsi_queues_bind_intr(struct ice_vsi *vsi, uint16_t msix_vect,
 		       int base_queue, int nb_queue)
@@ -2797,12 +2803,6 @@ ice_dev_start(struct rte_eth_dev *dev)
 		}
 	}
 
-	ret = ice_init_rss(pf);
-	if (ret) {
-		PMD_DRV_LOG(ERR, "Failed to enable rss for PF");
-		goto rx_err;
-	}
-
 	ice_set_rx_function(dev);
 	ice_set_tx_function(dev);
 
Signature · 1 line
2.17.1
#7 lore raw

Nacked

Quoted 35 lines

-----Original Message-----
From: Jiang, JunyuX <[email protected]>
Sent: Wednesday, April 1, 2020 16:27
To: [email protected]
Cc: Zhang, Qi Z <[email protected]>; Yang, Qiming <[email protected]>; Jiang, JunyuX <[email protected]>; [email protected]
Subject: [PATCH v4] net/ice: fix RSS advanced rule invalid issue

This patch moved the RSS initialization from dev start to dev configure to fix RSS advanced rule invalid after running port stop and port start.

Fixes 5ad3db8d4bdd ("net/ice: enable advanced RSS")
---
 drivers/net/ice/ice_ethdev.c | 48 ++++++++++++++++++------------------
 1 file changed, 24 insertions(+), 24 deletions(-)
drivers/net/ice/ice_ethdev.c +0 -7
index 85ef83e92..4cfdbd838 100644
@@ -2446,24 +2446,6 @@ ice_dev_uninit(struct rte_eth_dev *dev)
 	return 0;
 }
 
-static int
-ice_dev_configure(struct rte_eth_dev *dev) -{
-	struct ice_adapter *ad =
-		ICE_DEV_PRIVATE_TO_ADAPTER(dev->data->dev_private);
-
-	/* Initialize to TRUE. If any of Rx queues doesn't meet the
-	 * bulk allocation or vector Rx preconditions we will reset it.

drivers/net/ice/ice_ethdev.c ice_dev_uninit(struct rte_eth_dev *dev) · line 2465

Quoted 10 lines
drivers/net/ice/ice_ethdev.c +0 -8
-	 */
-	ad->rx_bulk_alloc_allowed = true;
-	ad->tx_simple_allowed = true;
-
-	if (dev->data->dev_conf.rxmode.mq_mode &
 ETH_MQ_RX_RSS_FLAG)
-		dev->data->dev_conf.rxmode.offloads |=
 DEV_RX_OFFLOAD_RSS_HASH;
-
-	return 0;

Why you delete the original logical?!

Quoted 52 lines
drivers/net/ice/ice_ethdev.c +23 -9
-}
-
 static int ice_init_rss(struct ice_pf *pf)  {
 	struct ice_hw *hw = ICE_PF_TO_HW(pf);
@@ -2594,6 +2576,30 @@ static int ice_init_rss(struct ice_pf *pf)
 	return 0;
 }
 
+static int
+ice_dev_configure(struct rte_eth_dev *dev) {
+	struct ice_adapter *ad =
+		ICE_DEV_PRIVATE_TO_ADAPTER(dev->data->dev_private);
+	struct ice_pf *pf = ICE_DEV_PRIVATE_TO_PF(dev->data-
 >dev_private);
+	int ret;
+
+	/* Initialize to TRUE. If any of Rx queues doesn't meet the
+	 * bulk allocation or vector Rx preconditions we will reset it.
+	 */
+	ad->rx_bulk_alloc_allowed = true;
+	ad->tx_simple_allowed = true;
+
+	if (dev->data->dev_conf.rxmode.mq_mode &
 ETH_MQ_RX_RSS_FLAG)
+		dev->data->dev_conf.rxmode.offloads |=
 DEV_RX_OFFLOAD_RSS_HASH;
+
+	ret = ice_init_rss(pf);
+	if (ret)
+		PMD_DRV_LOG(ERR, "Failed to enable rss for PF");
+
+	return ret;
+}
+
 static void
 __vsi_queues_bind_intr(struct ice_vsi *vsi, uint16_t msix_vect,
 		       int base_queue, int nb_queue)
@@ -2797,12 +2803,6 @@ ice_dev_start(struct rte_eth_dev *dev)
 		}
 	}
 
-	ret = ice_init_rss(pf);
-	if (ret) {
-		PMD_DRV_LOG(ERR, "Failed to enable rss for PF");
-		goto rx_err;
-	}
-
 	ice_set_rx_function(dev);
 	ice_set_tx_function(dev);
 
--

2.17.1

#8 lore raw
In reply to Junyu Jiang

The [PATCH v4] net/ice: fix RSS advanced rule invalid issue patch test -by Zhiwei.he <[email protected]>

-----Original Message-----
From: dev <[email protected]> On Behalf Of Junyu Jiang
Sent: Wednesday, April 1, 2020 4:27 PM
To: [email protected]
Cc: Zhang, Qi Z <[email protected]>; Yang, Qiming <[email protected]>; Jiang, JunyuX <[email protected]>; [email protected]
Subject: [dpdk-dev] [PATCH v4] net/ice: fix RSS advanced rule invalid issue

This patch moved the RSS initialization from dev start to dev configure to fix RSS advanced rule invalid after running port stop and port start.

Fixes 5ad3db8d4bdd ("net/ice: enable advanced RSS")
---
 drivers/net/ice/ice_ethdev.c | 48 ++++++++++++++++++------------------
 1 file changed, 24 insertions(+), 24 deletions(-)
drivers/net/ice/ice_ethdev.c +23 -23
@@ -2446,24 +2446,6 @@ ice_dev_uninit(struct rte_eth_dev *dev)
 	return 0;
 }
 
-static int
-ice_dev_configure(struct rte_eth_dev *dev) -{
-	struct ice_adapter *ad =
-		ICE_DEV_PRIVATE_TO_ADAPTER(dev->data->dev_private);
-
-	/* Initialize to TRUE. If any of Rx queues doesn't meet the
-	 * bulk allocation or vector Rx preconditions we will reset it.
-	 */
-	ad->rx_bulk_alloc_allowed = true;
-	ad->tx_simple_allowed = true;
-
-	if (dev->data->dev_conf.rxmode.mq_mode & ETH_MQ_RX_RSS_FLAG)
-		dev->data->dev_conf.rxmode.offloads |= DEV_RX_OFFLOAD_RSS_HASH;
-
-	return 0;
-}
-
 static int ice_init_rss(struct ice_pf *pf)  {
 	struct ice_hw *hw = ICE_PF_TO_HW(pf);
@@ -2594,6 +2576,30 @@ static int ice_init_rss(struct ice_pf *pf)
 	return 0;
 }
 
+static int
+ice_dev_configure(struct rte_eth_dev *dev) {
+	struct ice_adapter *ad =
+		ICE_DEV_PRIVATE_TO_ADAPTER(dev->data->dev_private);
+	struct ice_pf *pf = ICE_DEV_PRIVATE_TO_PF(dev->data->dev_private);
+	int ret;
+
+	/* Initialize to TRUE. If any of Rx queues doesn't meet the
+	 * bulk allocation or vector Rx preconditions we will reset it.
+	 */
+	ad->rx_bulk_alloc_allowed = true;
+	ad->tx_simple_allowed = true;
+
+	if (dev->data->dev_conf.rxmode.mq_mode & ETH_MQ_RX_RSS_FLAG)
+		dev->data->dev_conf.rxmode.offloads |= DEV_RX_OFFLOAD_RSS_HASH;
+
+	ret = ice_init_rss(pf);
+	if (ret)
+		PMD_DRV_LOG(ERR, "Failed to enable rss for PF");
+
+	return ret;
+}
+
 static void
 __vsi_queues_bind_intr(struct ice_vsi *vsi, uint16_t msix_vect,
 		       int base_queue, int nb_queue)
@@ -2797,12 +2803,6 @@ ice_dev_start(struct rte_eth_dev *dev)
 		}
 	}
 
-	ret = ice_init_rss(pf);
-	if (ret) {
-		PMD_DRV_LOG(ERR, "Failed to enable rss for PF");
-		goto rx_err;
-	}
-
 	ice_set_rx_function(dev);
 	ice_set_tx_function(dev);
 

--
2.17.1

#9 lore raw

PATCH v5 1/1 net/ice: fix RSS advanced rule invalid issue

In reply to Junyu Jiang

This patch moved the RSS initialization from dev start to dev configure to fix RSS advanced rule invalid after running port stop and port start.

Fixes 5ad3db8d4bdd ("net/ice: enable advanced RSS")
---
 drivers/net/ice/ice_ethdev.c | 50 +++++++++++++++++++-----------------
 1 file changed, 26 insertions(+), 24 deletions(-)
drivers/net/ice/ice_ethdev.c +26 -24
index 85ef83e92..90a91c9c1 100644
@@ -2446,24 +2446,6 @@ ice_dev_uninit(struct rte_eth_dev *dev)
 	return 0;
 }
 
-static int
-ice_dev_configure(struct rte_eth_dev *dev)
-{
-	struct ice_adapter *ad =
-		ICE_DEV_PRIVATE_TO_ADAPTER(dev->data->dev_private);
-
-	/* Initialize to TRUE. If any of Rx queues doesn't meet the
-	 * bulk allocation or vector Rx preconditions we will reset it.
-	 */
-	ad->rx_bulk_alloc_allowed = true;
-	ad->tx_simple_allowed = true;
-
-	if (dev->data->dev_conf.rxmode.mq_mode & ETH_MQ_RX_RSS_FLAG)
-		dev->data->dev_conf.rxmode.offloads |= DEV_RX_OFFLOAD_RSS_HASH;
-
-	return 0;
-}
-
 static int ice_init_rss(struct ice_pf *pf)
 {
 	struct ice_hw *hw = ICE_PF_TO_HW(pf);
@@ -2594,6 +2576,32 @@ static int ice_init_rss(struct ice_pf *pf)
 	return 0;
 }
 
+static int
+ice_dev_configure(struct rte_eth_dev *dev)
+{
+	struct ice_adapter *ad =
+		ICE_DEV_PRIVATE_TO_ADAPTER(dev->data->dev_private);
+	struct ice_pf *pf = ICE_DEV_PRIVATE_TO_PF(dev->data->dev_private);
+	int ret;
+
+	/* Initialize to TRUE. If any of Rx queues doesn't meet the
+	 * bulk allocation or vector Rx preconditions we will reset it.
+	 */
+	ad->rx_bulk_alloc_allowed = true;
+	ad->tx_simple_allowed = true;
+
+	if (dev->data->dev_conf.rxmode.mq_mode & ETH_MQ_RX_RSS_FLAG)
+		dev->data->dev_conf.rxmode.offloads |= DEV_RX_OFFLOAD_RSS_HASH;
+
+	ret = ice_init_rss(pf);
+	if (ret) {
+		PMD_DRV_LOG(ERR, "Failed to enable rss for PF");
+		return ret;
+	}
+
+	return 0;
+}
+
 static void
 __vsi_queues_bind_intr(struct ice_vsi *vsi, uint16_t msix_vect,
 		       int base_queue, int nb_queue)
@@ -2797,12 +2805,6 @@ ice_dev_start(struct rte_eth_dev *dev)
 		}
 	}
 
-	ret = ice_init_rss(pf);
-	if (ret) {
-		PMD_DRV_LOG(ERR, "Failed to enable rss for PF");
-		goto rx_err;
-	}
-
 	ice_set_rx_function(dev);
 	ice_set_tx_function(dev);
 
Signature · 1 line
2.17.1
#10 lore raw

The patch V5 has test-by Zhiwei<[email protected]>

-----Original Message-----
From: dev <[email protected]> On Behalf Of Junyu Jiang
Sent: Tuesday, April 7, 2020 9:48 AM
To: [email protected]
Cc: Zhang, Qi Z <[email protected]>; Yang, Qiming <[email protected]>; Jiang, JunyuX <[email protected]>; [email protected]
Subject: [dpdk-dev] [PATCH v5] net/ice: fix RSS advanced rule invalid issue

This patch moved the RSS initialization from dev start to dev configure to fix RSS advanced rule invalid after running port stop and port start.

Fixes 5ad3db8d4bdd ("net/ice: enable advanced RSS")
---
 drivers/net/ice/ice_ethdev.c | 50 +++++++++++++++++++-----------------
 1 file changed, 26 insertions(+), 24 deletions(-)
drivers/net/ice/ice_ethdev.c +25 -23
@@ -2446,24 +2446,6 @@ ice_dev_uninit(struct rte_eth_dev *dev)
 	return 0;
 }
 
-static int
-ice_dev_configure(struct rte_eth_dev *dev) -{
-	struct ice_adapter *ad =
-		ICE_DEV_PRIVATE_TO_ADAPTER(dev->data->dev_private);
-
-	/* Initialize to TRUE. If any of Rx queues doesn't meet the
-	 * bulk allocation or vector Rx preconditions we will reset it.
-	 */
-	ad->rx_bulk_alloc_allowed = true;
-	ad->tx_simple_allowed = true;
-
-	if (dev->data->dev_conf.rxmode.mq_mode & ETH_MQ_RX_RSS_FLAG)
-		dev->data->dev_conf.rxmode.offloads |= DEV_RX_OFFLOAD_RSS_HASH;
-
-	return 0;
-}
-
 static int ice_init_rss(struct ice_pf *pf)  {
 	struct ice_hw *hw = ICE_PF_TO_HW(pf);
@@ -2594,6 +2576,32 @@ static int ice_init_rss(struct ice_pf *pf)
 	return 0;
 }
 
+static int
+ice_dev_configure(struct rte_eth_dev *dev) {
+	struct ice_adapter *ad =
+		ICE_DEV_PRIVATE_TO_ADAPTER(dev->data->dev_private);
+	struct ice_pf *pf = ICE_DEV_PRIVATE_TO_PF(dev->data->dev_private);
+	int ret;
+
+	/* Initialize to TRUE. If any of Rx queues doesn't meet the
+	 * bulk allocation or vector Rx preconditions we will reset it.
+	 */
+	ad->rx_bulk_alloc_allowed = true;
+	ad->tx_simple_allowed = true;
+
+	if (dev->data->dev_conf.rxmode.mq_mode & ETH_MQ_RX_RSS_FLAG)
+		dev->data->dev_conf.rxmode.offloads |= DEV_RX_OFFLOAD_RSS_HASH;
+
+	ret = ice_init_rss(pf);
+	if (ret) {
+		PMD_DRV_LOG(ERR, "Failed to enable rss for PF");
+		return ret;
+	}
+
+	return 0;
+}
+
 static void
 __vsi_queues_bind_intr(struct ice_vsi *vsi, uint16_t msix_vect,
 		       int base_queue, int nb_queue)
@@ -2797,12 +2805,6 @@ ice_dev_start(struct rte_eth_dev *dev)
 		}
 	}
 
-	ret = ice_init_rss(pf);
-	if (ret) {
-		PMD_DRV_LOG(ERR, "Failed to enable rss for PF");
-		goto rx_err;
-	}
-
 	ice_set_rx_function(dev);
 	ice_set_tx_function(dev);
 

--
2.17.1

Acked-by on v5 1/1
#11 lore raw
In reply to Junyu Jiang
Quoted 99 lines

-----Original Message-----
From: Jiang, JunyuX <[email protected]>
Sent: 2020年4月7日 9:48
To: [email protected]
Cc: Zhang, Qi Z <[email protected]>; Yang, Qiming <[email protected]>; Jiang, JunyuX <[email protected]>; [email protected]
Subject: [PATCH v5] net/ice: fix RSS advanced rule invalid issue

This patch moved the RSS initialization from dev start to dev configure to fix RSS advanced rule invalid after running port stop and port start.

Fixes 5ad3db8d4bdd ("net/ice: enable advanced RSS")
---
 drivers/net/ice/ice_ethdev.c | 50 +++++++++++++++++++-----------------
 1 file changed, 26 insertions(+), 24 deletions(-)
drivers/net/ice/ice_ethdev.c index renamed from drivers/net/ice/ice_ethdev.c +0 -0

85ef83e92..90a91c9c1 100644

drivers/net/ice/ice_ethdev.c +25 -24
@@ -2446,24 +2446,6 @@ ice_dev_uninit(struct rte_eth_dev *dev)
 	return 0;
 }
 
-static int
-ice_dev_configure(struct rte_eth_dev *dev) -{
-	struct ice_adapter *ad =
-		ICE_DEV_PRIVATE_TO_ADAPTER(dev->data->dev_private);
-
-	/* Initialize to TRUE. If any of Rx queues doesn't meet the
-	 * bulk allocation or vector Rx preconditions we will reset it.
-	 */
-	ad->rx_bulk_alloc_allowed = true;
-	ad->tx_simple_allowed = true;
-
-	if (dev->data->dev_conf.rxmode.mq_mode &
 ETH_MQ_RX_RSS_FLAG)
-		dev->data->dev_conf.rxmode.offloads |=
 DEV_RX_OFFLOAD_RSS_HASH;
-
-	return 0;
-}
-
 static int ice_init_rss(struct ice_pf *pf)  {
 	struct ice_hw *hw = ICE_PF_TO_HW(pf);
@@ -2594,6 +2576,32 @@ static int ice_init_rss(struct ice_pf *pf)
 	return 0;
 }
 
+static int
+ice_dev_configure(struct rte_eth_dev *dev) {
+	struct ice_adapter *ad =
+		ICE_DEV_PRIVATE_TO_ADAPTER(dev->data->dev_private);
+	struct ice_pf *pf = ICE_DEV_PRIVATE_TO_PF(dev->data-
 >dev_private);
+	int ret;
+
+	/* Initialize to TRUE. If any of Rx queues doesn't meet the
+	 * bulk allocation or vector Rx preconditions we will reset it.
+	 */
+	ad->rx_bulk_alloc_allowed = true;
+	ad->tx_simple_allowed = true;
+
+	if (dev->data->dev_conf.rxmode.mq_mode &
 ETH_MQ_RX_RSS_FLAG)
+		dev->data->dev_conf.rxmode.offloads |=
 DEV_RX_OFFLOAD_RSS_HASH;
+
+	ret = ice_init_rss(pf);
+	if (ret) {
+		PMD_DRV_LOG(ERR, "Failed to enable rss for PF");
+		return ret;
+	}
+
+	return 0;
+}
+
 static void
 __vsi_queues_bind_intr(struct ice_vsi *vsi, uint16_t msix_vect,
 		       int base_queue, int nb_queue)
@@ -2797,12 +2805,6 @@ ice_dev_start(struct rte_eth_dev *dev)
 		}
 	}
 
-	ret = ice_init_rss(pf);
-	if (ret) {
-		PMD_DRV_LOG(ERR, "Failed to enable rss for PF");
-		goto rx_err;
-	}
-
 	ice_set_rx_function(dev);
 	ice_set_tx_function(dev);
 
--

2.17.1

Applied
#12 lore raw
In reply to Junyu Jiang
Quoted 89 lines · Junyu Jiang

This patch moved the RSS initialization from dev start to dev configure to fix RSS advanced rule invalid after running port stop and port start.

Fixes 5ad3db8d4bdd ("net/ice: enable advanced RSS")

---
drivers/net/ice/ice_ethdev.c | 50 +++++++++++++++++++-----------------

1 file changed, 26 insertions(+), 24 deletions(-)
drivers/net/ice/ice_ethdev.c +26 -18
index 85ef83e92..90a91c9c1 100644
@@ -2446,24 +2446,6 @@ ice_dev_uninit(struct rte_eth_dev *dev)
 	return 0;
 }
 
-static int
-ice_dev_configure(struct rte_eth_dev *dev)
-{
-	struct ice_adapter *ad =
-		ICE_DEV_PRIVATE_TO_ADAPTER(dev->data->dev_private);
-
-	/* Initialize to TRUE. If any of Rx queues doesn't meet the
-	 * bulk allocation or vector Rx preconditions we will reset it.
-	 */
-	ad->rx_bulk_alloc_allowed = true;
-	ad->tx_simple_allowed = true;
-
-	if (dev->data->dev_conf.rxmode.mq_mode & ETH_MQ_RX_RSS_FLAG)
-		dev->data->dev_conf.rxmode.offloads |= DEV_RX_OFFLOAD_RSS_HASH;
-
-	return 0;
-}
-
 static int ice_init_rss(struct ice_pf *pf)
 {
 	struct ice_hw *hw = ICE_PF_TO_HW(pf);
@@ -2594,6 +2576,32 @@ static int ice_init_rss(struct ice_pf *pf)
 	return 0;
 }
 
+static int
+ice_dev_configure(struct rte_eth_dev *dev)
+{
+	struct ice_adapter *ad =
+		ICE_DEV_PRIVATE_TO_ADAPTER(dev->data->dev_private);
+	struct ice_pf *pf = ICE_DEV_PRIVATE_TO_PF(dev->data->dev_private);
+	int ret;
+
+	/* Initialize to TRUE. If any of Rx queues doesn't meet the
+	 * bulk allocation or vector Rx preconditions we will reset it.
+	 */
+	ad->rx_bulk_alloc_allowed = true;
+	ad->tx_simple_allowed = true;
+
+	if (dev->data->dev_conf.rxmode.mq_mode & ETH_MQ_RX_RSS_FLAG)
+		dev->data->dev_conf.rxmode.offloads |= DEV_RX_OFFLOAD_RSS_HASH;
+
+	ret = ice_init_rss(pf);
+	if (ret) {
+		PMD_DRV_LOG(ERR, "Failed to enable rss for PF");
+		return ret;
+	}
+
+	return 0;
+}
+

static void
__vsi_queues_bind_intr(struct ice_vsi *vsi, uint16_t msix_vect,
int base_queue, int nb_queue)

drivers/net/ice/ice_ethdev.c +0 -6
@@ -2797,12 +2805,6 @@ ice_dev_start(struct rte_eth_dev *dev)
 		}
 	}
 
-	ret = ice_init_rss(pf);
-	if (ret) {
-		PMD_DRV_LOG(ERR, "Failed to enable rss for PF");
-		goto rx_err;
-	}
-
 	ice_set_rx_function(dev);
 	ice_set_tx_function(dev);
 
Signature · 1 line
2.17.1

Applied to dpdk-next-net-intel, Thanks.