Skip to contentSkip to conversation

net/iavf: fix VF reset issue for hash

dpdk-dev Applied Jeff Guo 4 participants 7 messages May 18, 2020 – May 19, 2020 Network drivers

lore
Share & tools
lore

Jeff Guo

author
#0 lore raw

Since there are some default rss configure in kernel PF/VF but not DPDK IAVF, if these configurations be modified by VF and then VF reset, this default rss configurations can not be reset to default by IAVF. So need to add default rss set in IAVF hash initial process.

Fixes 7be10c3004be ("net/iavf: add RSS configuration for VF")
---
 drivers/net/iavf/iavf_hash.c | 51 +++++++++++++++++++++++++++++++++++-
 1 file changed, 50 insertions(+), 1 deletion(-)
drivers/net/iavf/iavf_hash.c +50 -1
index 975c84556..04b3492ce 100644
@@ -857,6 +857,17 @@ struct iavf_hash_match_type iavf_hash_type_list[] = {
 					&hdrs_hint_ipv6_sctp},
 };
 
+struct virtchnl_proto_hdrs *iavf_hash_default_hdrs[] = {
+	&hdrs_hint_ipv4,
+	&hdrs_hint_ipv4_udp,
+	&hdrs_hint_ipv4_tcp,
+	&hdrs_hint_ipv4_sctp,
+	&hdrs_hint_ipv6,
+	&hdrs_hint_ipv6_udp,
+	&hdrs_hint_ipv6_tcp,
+	&hdrs_hint_ipv6_sctp,
+};
+
 static struct iavf_flow_engine iavf_hash_engine = {
 	.init = iavf_hash_init,
 	.create = iavf_hash_create,
@@ -875,6 +886,33 @@ static struct iavf_flow_parser iavf_hash_parser = {
 	.stage = IAVF_FLOW_STAGE_RSS,
 };
 
+static int
+iavf_hash_default_set(struct iavf_adapter *ad)
+{
+	struct virtchnl_rss_cfg *rss_cfg;
+	uint16_t i;
+	int ret;
+
+	rss_cfg = rte_zmalloc("iavf rss rule",
+			      sizeof(struct virtchnl_rss_cfg), 0);
+	if (!rss_cfg)
+		return -ENOMEM;
+
+	for (i = 0; i < RTE_DIM(iavf_hash_default_hdrs); i++) {
+		rss_cfg->proto_hdrs = *iavf_hash_default_hdrs[i];
+		rss_cfg->rss_algorithm = VIRTCHNL_RSS_ALG_TOEPLITZ_ASYMMETRIC;
+
+		ret = iavf_add_del_rss_cfg(ad, rss_cfg, true);
+		if (ret) {
+			PMD_DRV_LOG(ERR, "fail to add RSS configure");
+			rte_free(rss_cfg);
+			return ret;
+		}
+	}
+
+	return ret;
+}
+
 RTE_INIT(iavf_hash_engine_init)
 {
 	struct iavf_flow_engine *engine = &iavf_hash_engine;
@@ -887,6 +925,7 @@ iavf_hash_init(struct iavf_adapter *ad)
 {
 	struct iavf_info *vf = IAVF_DEV_PRIVATE_TO_VF(ad);
 	struct iavf_flow_parser *parser;
+	int ret;
 
 	if (!vf->vf_res)
 		return -EINVAL;
@@ -896,7 +935,17 @@ iavf_hash_init(struct iavf_adapter *ad)
 
 	parser = &iavf_hash_parser;
 
-	return iavf_register_parser(parser, ad);
+	ret = iavf_register_parser(parser, ad);
+	if (ret) {
+		PMD_DRV_LOG(ERR, "fail to register hash parser");
+		return ret;
+	}
+
+	ret = iavf_hash_default_set(ad);
+	if (ret)
+		PMD_DRV_LOG(ERR, "fail to set default RSS");
+
+	return ret;
 }
 
 static int
Signature · 1 line
2.20.1
#1 lore raw

Test-by Zhiwei.He <[email protected]>

-----Original Message-----
From: dev <[email protected]> On Behalf Of Jeff Guo
Sent: Tuesday, May 19, 2020 8:20 AM
To: Xing, Beilei <[email protected]>; Ye, Xiaolong <[email protected]>; Zhang, Qi Z <[email protected]>; Wu, Jingjing <[email protected]>
Cc: [email protected]; Guo, Jia <[email protected]>
Subject: [dpdk-dev] net/iavf: fix VF reset issue for hash

Since there are some default rss configure in kernel PF/VF but not DPDK IAVF, if these configurations be modified by VF and then VF reset, this default rss configurations can not be reset to default by IAVF. So need to add default rss set in IAVF hash initial process.

Fixes 7be10c3004be ("net/iavf: add RSS configuration for VF")
---
 drivers/net/iavf/iavf_hash.c | 51 +++++++++++++++++++++++++++++++++++-
 1 file changed, 50 insertions(+), 1 deletion(-)
drivers/net/iavf/iavf_hash.c +37 -0
@@ -857,6 +857,17 @@ struct iavf_hash_match_type iavf_hash_type_list[] = {
 					&hdrs_hint_ipv6_sctp},
 };
 
+struct virtchnl_proto_hdrs *iavf_hash_default_hdrs[] = {
+	&hdrs_hint_ipv4,
+	&hdrs_hint_ipv4_udp,
+	&hdrs_hint_ipv4_tcp,
+	&hdrs_hint_ipv4_sctp,
+	&hdrs_hint_ipv6,
+	&hdrs_hint_ipv6_udp,
+	&hdrs_hint_ipv6_tcp,
+	&hdrs_hint_ipv6_sctp,
+};
+
 static struct iavf_flow_engine iavf_hash_engine = {
 	.init = iavf_hash_init,
 	.create = iavf_hash_create,
@@ -875,6 +886,33 @@ static struct iavf_flow_parser iavf_hash_parser = {
 	.stage = IAVF_FLOW_STAGE_RSS,
 };
 
+static int
+iavf_hash_default_set(struct iavf_adapter *ad) {
+	struct virtchnl_rss_cfg *rss_cfg;
+	uint16_t i;
+	int ret;
+
+	rss_cfg = rte_zmalloc("iavf rss rule",
+			      sizeof(struct virtchnl_rss_cfg), 0);
+	if (!rss_cfg)
+		return -ENOMEM;
+
+	for (i = 0; i < RTE_DIM(iavf_hash_default_hdrs); i++) {
+		rss_cfg->proto_hdrs = *iavf_hash_default_hdrs[i];
+		rss_cfg->rss_algorithm = VIRTCHNL_RSS_ALG_TOEPLITZ_ASYMMETRIC;
+
+		ret = iavf_add_del_rss_cfg(ad, rss_cfg, true);
+		if (ret) {
+			PMD_DRV_LOG(ERR, "fail to add RSS configure");
+			rte_free(rss_cfg);
+			return ret;
+		}
+	}
+
+	return ret;
+}
+
 RTE_INIT(iavf_hash_engine_init)
 {
 	struct iavf_flow_engine *engine = &iavf_hash_engine; @@ -887,6 +925,7 @@ iavf_hash_init(struct iavf_adapter *ad)  {

struct iavf_info *vf = IAVF_DEV_PRIVATE_TO_VF(ad); struct iavf_flow_parser *parser;
+ int ret;

if (!vf->vf_res)
return -EINVAL;
@@ -896,7 +935,17 @@ iavf_hash_init(struct iavf_adapter *ad)

parser = &iavf_hash_parser;

- return iavf_register_parser(parser, ad);
+ ret = iavf_register_parser(parser, ad);
+ if (ret) {
+ PMD_DRV_LOG(ERR, "fail to register hash parser");
+ return ret;
+ }
+
+ ret = iavf_hash_default_set(ad);
+ if (ret)
+ PMD_DRV_LOG(ERR, "fail to set default RSS");
+
+ return ret;
}

static int
--
2.20.1

Acked-by
#2 lore raw
Quoted 22 lines

-----Original Message-----
From: He, Zhiwei <[email protected]>
Sent: Monday, May 18, 2020 9:15 PM
To: Guo, Jia <[email protected]>; Xing, Beilei <[email protected]>; Ye, Xiaolong <[email protected]>; Zhang, Qi Z <[email protected]>; Wu, Jingjing <[email protected]>
Cc: [email protected]; Guo, Jia <[email protected]>
Subject: RE: [dpdk-dev] net/iavf: fix VF reset issue for hash

Test-by Zhiwei.He <[email protected]>

-----Original Message-----
From: dev <[email protected]> On Behalf Of Jeff Guo
Sent: Tuesday, May 19, 2020 8:20 AM
To: Xing, Beilei <[email protected]>; Ye, Xiaolong <[email protected]>; Zhang, Qi Z <[email protected]>; Wu, Jingjing <[email protected]>
Cc: [email protected]; Guo, Jia <[email protected]>
Subject: [dpdk-dev] net/iavf: fix VF reset issue for hash

Quoted 6 lines

Since there are some default rss configure in kernel PF/VF but not DPDK IAVF, if these configurations be modified by VF and then VF reset, this default rss configurations can not be reset to default by IAVF. So need to add default rss set in IAVF hash initial process.

#3 lore raw
In reply to Jeff Guo
Quoted 79 lines · Jeff Guo

Since there are some default rss configure in kernel PF/VF but not DPDK IAVF, if these configurations be modified by VF and then VF reset, this default rss configurations can not be reset to default by IAVF. So need to add default rss set in IAVF hash initial process.

Fixes 7be10c3004be ("net/iavf: add RSS configuration for VF")

---
drivers/net/iavf/iavf_hash.c | 51 +++++++++++++++++++++++++++++++++++-

1 file changed, 50 insertions(+), 1 deletion(-)
drivers/net/iavf/iavf_hash.c +39 -0
index 975c84556..04b3492ce 100644
@@ -857,6 +857,17 @@ struct iavf_hash_match_type iavf_hash_type_list[] = {
 					&hdrs_hint_ipv6_sctp},
 };
 
+struct virtchnl_proto_hdrs *iavf_hash_default_hdrs[] = {
+	&hdrs_hint_ipv4,
+	&hdrs_hint_ipv4_udp,
+	&hdrs_hint_ipv4_tcp,
+	&hdrs_hint_ipv4_sctp,
+	&hdrs_hint_ipv6,
+	&hdrs_hint_ipv6_udp,
+	&hdrs_hint_ipv6_tcp,
+	&hdrs_hint_ipv6_sctp,
+};
+
 static struct iavf_flow_engine iavf_hash_engine = {
 	.init = iavf_hash_init,
 	.create = iavf_hash_create,
@@ -875,6 +886,33 @@ static struct iavf_flow_parser iavf_hash_parser = {
 	.stage = IAVF_FLOW_STAGE_RSS,
 };
 
+static int
+iavf_hash_default_set(struct iavf_adapter *ad)
+{
+	struct virtchnl_rss_cfg *rss_cfg;
+	uint16_t i;
+	int ret;
+
+	rss_cfg = rte_zmalloc("iavf rss rule",
+			      sizeof(struct virtchnl_rss_cfg), 0);
+	if (!rss_cfg)
+		return -ENOMEM;
+
+	for (i = 0; i < RTE_DIM(iavf_hash_default_hdrs); i++) {
+		rss_cfg->proto_hdrs = *iavf_hash_default_hdrs[i];
+		rss_cfg->rss_algorithm = VIRTCHNL_RSS_ALG_TOEPLITZ_ASYMMETRIC;
+
+		ret = iavf_add_del_rss_cfg(ad, rss_cfg, true);
+		if (ret) {
+			PMD_DRV_LOG(ERR, "fail to add RSS configure");
+			rte_free(rss_cfg);
+			return ret;
+		}
+	}
+
+	return ret;
+}
+
 RTE_INIT(iavf_hash_engine_init)
 {
 	struct iavf_flow_engine *engine = &iavf_hash_engine;
@@ -887,6 +925,7 @@ iavf_hash_init(struct iavf_adapter *ad)
 {
 	struct iavf_info *vf = IAVF_DEV_PRIVATE_TO_VF(ad);
 	struct iavf_flow_parser *parser;
+	int ret;
 
 	if (!vf->vf_res)
 		return -EINVAL;
@@ -896,7 +935,17 @@ iavf_hash_init(struct iavf_adapter *ad)
 
 	parser = &iavf_hash_parser;
 

drivers/net/iavf/iavf_hash.c iavf_hash_init(struct iavf_adapter *ad) · line 946

Quoted 10 lines
drivers/net/iavf/iavf_hash.c +9 -1
-	return iavf_register_parser(parser, ad);
+	ret = iavf_register_parser(parser, ad);
+	if (ret) {
+		PMD_DRV_LOG(ERR, "fail to register hash parser");
+		return ret;
+	}
+
+	ret = iavf_hash_default_set(ad);
+	if (ret)
+		PMD_DRV_LOG(ERR, "fail to set default RSS");

Do we need to call iavf_unregister_parser in case of iavf_hash_default_set failure?

Thanks,
Xiaolong

Quoted 8 lines
drivers/net/iavf/iavf_hash.c +2 -0
+
+	return ret;
 }
 

static int

Signature · 1 line
2.20.1
author
#4 lore raw

hi, xiaolong

Quoted 92 lines · Ye Xiaolong
Quoted 79 lines · Jeff Guo

Since there are some default rss configure in kernel PF/VF but not DPDK IAVF, if these configurations be modified by VF and then VF reset, this default rss configurations can not be reset to default by IAVF. So need to add default rss set in IAVF hash initial process.

Fixes 7be10c3004be ("net/iavf: add RSS configuration for VF")

---
drivers/net/iavf/iavf_hash.c | 51 +++++++++++++++++++++++++++++++++++-

1 file changed, 50 insertions(+), 1 deletion(-)
drivers/net/iavf/iavf_hash.c +39 -0
index 975c84556..04b3492ce 100644
@@ -857,6 +857,17 @@ struct iavf_hash_match_type iavf_hash_type_list[] = {
 					&hdrs_hint_ipv6_sctp},
 };
 
+struct virtchnl_proto_hdrs *iavf_hash_default_hdrs[] = {
+	&hdrs_hint_ipv4,
+	&hdrs_hint_ipv4_udp,
+	&hdrs_hint_ipv4_tcp,
+	&hdrs_hint_ipv4_sctp,
+	&hdrs_hint_ipv6,
+	&hdrs_hint_ipv6_udp,
+	&hdrs_hint_ipv6_tcp,
+	&hdrs_hint_ipv6_sctp,
+};
+
 static struct iavf_flow_engine iavf_hash_engine = {
 	.init = iavf_hash_init,
 	.create = iavf_hash_create,
@@ -875,6 +886,33 @@ static struct iavf_flow_parser iavf_hash_parser = {
 	.stage = IAVF_FLOW_STAGE_RSS,
 };
 
+static int
+iavf_hash_default_set(struct iavf_adapter *ad)
+{
+	struct virtchnl_rss_cfg *rss_cfg;
+	uint16_t i;
+	int ret;
+
+	rss_cfg = rte_zmalloc("iavf rss rule",
+			      sizeof(struct virtchnl_rss_cfg), 0);
+	if (!rss_cfg)
+		return -ENOMEM;
+
+	for (i = 0; i < RTE_DIM(iavf_hash_default_hdrs); i++) {
+		rss_cfg->proto_hdrs = *iavf_hash_default_hdrs[i];
+		rss_cfg->rss_algorithm = VIRTCHNL_RSS_ALG_TOEPLITZ_ASYMMETRIC;
+
+		ret = iavf_add_del_rss_cfg(ad, rss_cfg, true);
+		if (ret) {
+			PMD_DRV_LOG(ERR, "fail to add RSS configure");
+			rte_free(rss_cfg);
+			return ret;
+		}
+	}
+
+	return ret;
+}
+
 RTE_INIT(iavf_hash_engine_init)
 {
 	struct iavf_flow_engine *engine = &iavf_hash_engine;
@@ -887,6 +925,7 @@ iavf_hash_init(struct iavf_adapter *ad)
 {
 	struct iavf_info *vf = IAVF_DEV_PRIVATE_TO_VF(ad);
 	struct iavf_flow_parser *parser;
+	int ret;
 
 	if (!vf->vf_res)
 		return -EINVAL;
@@ -896,7 +935,17 @@ iavf_hash_init(struct iavf_adapter *ad)
 
 	parser = &iavf_hash_parser;
 

drivers/net/iavf/iavf_hash.c iavf_hash_init(struct iavf_adapter *ad) · line 946

Quoted 10 lines
drivers/net/iavf/iavf_hash.c +9 -1
-	return iavf_register_parser(parser, ad);
+	ret = iavf_register_parser(parser, ad);
+	if (ret) {
+		PMD_DRV_LOG(ERR, "fail to register hash parser");
+		return ret;
+	}
+
+	ret = iavf_hash_default_set(ad);
+	if (ret)
+		PMD_DRV_LOG(ERR, "fail to set default RSS");

Do we need to call iavf_unregister_parser in case of iavf_hash_default_set failure?

Quoted 2 lines

Thanks,
Xiaolong

It should be and v2 will send. Thanks.

Quoted 8 lines
Quoted 8 lines
drivers/net/iavf/iavf_hash.c +2 -0
+
+	return ret;
 }
 

static int

Signature · 1 line
2.20.1
author
#5 lore raw

PATCH v2 1/1 net/iavf: fix VF reset issue for hash

In reply to Jeff Guo

Since there are some default rss configure in kernel PF/VF but not DPDK IAVF, if these configurations be modified by VF and then VF reset, this default rss configurations can not be reset to default by IAVF. So need to add default rss set in IAVF hash initial process.

Fixes 7be10c3004be ("net/iavf: add RSS configuration for VF")

---
v2->v1:
add hash engine unregister process

---
 drivers/net/iavf/iavf_hash.c | 53 +++++++++++++++++++++++++++++++++++-
 1 file changed, 52 insertions(+), 1 deletion(-)
drivers/net/iavf/iavf_hash.c +52 -1
index 975c84556..56ab170d8 100644
@@ -857,6 +857,17 @@ struct iavf_hash_match_type iavf_hash_type_list[] = {
 					&hdrs_hint_ipv6_sctp},
 };
 
+struct virtchnl_proto_hdrs *iavf_hash_default_hdrs[] = {
+	&hdrs_hint_ipv4,
+	&hdrs_hint_ipv4_udp,
+	&hdrs_hint_ipv4_tcp,
+	&hdrs_hint_ipv4_sctp,
+	&hdrs_hint_ipv6,
+	&hdrs_hint_ipv6_udp,
+	&hdrs_hint_ipv6_tcp,
+	&hdrs_hint_ipv6_sctp,
+};
+
 static struct iavf_flow_engine iavf_hash_engine = {
 	.init = iavf_hash_init,
 	.create = iavf_hash_create,
@@ -875,6 +886,33 @@ static struct iavf_flow_parser iavf_hash_parser = {
 	.stage = IAVF_FLOW_STAGE_RSS,
 };
 
+static int
+iavf_hash_default_set(struct iavf_adapter *ad)
+{
+	struct virtchnl_rss_cfg *rss_cfg;
+	uint16_t i;
+	int ret;
+
+	rss_cfg = rte_zmalloc("iavf rss rule",
+			      sizeof(struct virtchnl_rss_cfg), 0);
+	if (!rss_cfg)
+		return -ENOMEM;
+
+	for (i = 0; i < RTE_DIM(iavf_hash_default_hdrs); i++) {
+		rss_cfg->proto_hdrs = *iavf_hash_default_hdrs[i];
+		rss_cfg->rss_algorithm = VIRTCHNL_RSS_ALG_TOEPLITZ_ASYMMETRIC;
+
+		ret = iavf_add_del_rss_cfg(ad, rss_cfg, true);
+		if (ret) {
+			PMD_DRV_LOG(ERR, "fail to add RSS configure");
+			rte_free(rss_cfg);
+			return ret;
+		}
+	}
+
+	return ret;
+}
+
 RTE_INIT(iavf_hash_engine_init)
 {
 	struct iavf_flow_engine *engine = &iavf_hash_engine;
@@ -887,6 +925,7 @@ iavf_hash_init(struct iavf_adapter *ad)
 {
 	struct iavf_info *vf = IAVF_DEV_PRIVATE_TO_VF(ad);
 	struct iavf_flow_parser *parser;
+	int ret;
 
 	if (!vf->vf_res)
 		return -EINVAL;
@@ -896,7 +935,19 @@ iavf_hash_init(struct iavf_adapter *ad)
 
 	parser = &iavf_hash_parser;
 
-	return iavf_register_parser(parser, ad);
+	ret = iavf_register_parser(parser, ad);
+	if (ret) {
+		PMD_DRV_LOG(ERR, "fail to register hash parser");
+		return ret;
+	}
+
+	ret = iavf_hash_default_set(ad);
+	if (ret) {
+		PMD_DRV_LOG(ERR, "fail to set default RSS");
+		iavf_unregister_parser(parser, ad);
+	}
+
+	return ret;
 }
 
 static int
Signature · 1 line
2.20.1
Applied
#6 lore raw
Quoted 7 lines · Jeff Guo

Since there are some default rss configure in kernel PF/VF but not DPDK IAVF, if these configurations be modified by VF and then VF reset, this default rss configurations can not be reset to default by IAVF. So need to add default rss set in IAVF hash initial process.

Fixes 7be10c3004be ("net/iavf: add RSS configuration for VF")

Fixes tag should be put before the SOB, fixed it while merging.

Quoted 93 lines

---
v2->v1:
add hash engine unregister process
---
drivers/net/iavf/iavf_hash.c | 53 +++++++++++++++++++++++++++++++++++-

1 file changed, 52 insertions(+), 1 deletion(-)
drivers/net/iavf/iavf_hash.c +52 -1
index 975c84556..56ab170d8 100644
@@ -857,6 +857,17 @@ struct iavf_hash_match_type iavf_hash_type_list[] = {
 					&hdrs_hint_ipv6_sctp},
 };
 
+struct virtchnl_proto_hdrs *iavf_hash_default_hdrs[] = {
+	&hdrs_hint_ipv4,
+	&hdrs_hint_ipv4_udp,
+	&hdrs_hint_ipv4_tcp,
+	&hdrs_hint_ipv4_sctp,
+	&hdrs_hint_ipv6,
+	&hdrs_hint_ipv6_udp,
+	&hdrs_hint_ipv6_tcp,
+	&hdrs_hint_ipv6_sctp,
+};
+
 static struct iavf_flow_engine iavf_hash_engine = {
 	.init = iavf_hash_init,
 	.create = iavf_hash_create,
@@ -875,6 +886,33 @@ static struct iavf_flow_parser iavf_hash_parser = {
 	.stage = IAVF_FLOW_STAGE_RSS,
 };
 
+static int
+iavf_hash_default_set(struct iavf_adapter *ad)
+{
+	struct virtchnl_rss_cfg *rss_cfg;
+	uint16_t i;
+	int ret;
+
+	rss_cfg = rte_zmalloc("iavf rss rule",
+			      sizeof(struct virtchnl_rss_cfg), 0);
+	if (!rss_cfg)
+		return -ENOMEM;
+
+	for (i = 0; i < RTE_DIM(iavf_hash_default_hdrs); i++) {
+		rss_cfg->proto_hdrs = *iavf_hash_default_hdrs[i];
+		rss_cfg->rss_algorithm = VIRTCHNL_RSS_ALG_TOEPLITZ_ASYMMETRIC;
+
+		ret = iavf_add_del_rss_cfg(ad, rss_cfg, true);
+		if (ret) {
+			PMD_DRV_LOG(ERR, "fail to add RSS configure");
+			rte_free(rss_cfg);
+			return ret;
+		}
+	}
+
+	return ret;
+}
+
 RTE_INIT(iavf_hash_engine_init)
 {
 	struct iavf_flow_engine *engine = &iavf_hash_engine;
@@ -887,6 +925,7 @@ iavf_hash_init(struct iavf_adapter *ad)
 {
 	struct iavf_info *vf = IAVF_DEV_PRIVATE_TO_VF(ad);
 	struct iavf_flow_parser *parser;
+	int ret;
 
 	if (!vf->vf_res)
 		return -EINVAL;
@@ -896,7 +935,19 @@ iavf_hash_init(struct iavf_adapter *ad)
 
 	parser = &iavf_hash_parser;
 
-	return iavf_register_parser(parser, ad);
+	ret = iavf_register_parser(parser, ad);
+	if (ret) {
+		PMD_DRV_LOG(ERR, "fail to register hash parser");
+		return ret;
+	}
+
+	ret = iavf_hash_default_set(ad);
+	if (ret) {
+		PMD_DRV_LOG(ERR, "fail to set default RSS");
+		iavf_unregister_parser(parser, ad);
+	}
+
+	return ret;
 }
 
Quoted 4 lines

static int

Signature · 1 line
2.20.1

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