DPDK patches and discussions
 help / color / mirror / Atom feed
From: "He, Zhiwei" <zhiwei.he@intel.com>
To: "Guo, Jia" <jia.guo@intel.com>,
	"Xing, Beilei" <beilei.xing@intel.com>,
	"Ye, Xiaolong" <xiaolong.ye@intel.com>,
	"Zhang, Qi Z" <qi.z.zhang@intel.com>,
	 "Wu, Jingjing" <jingjing.wu@intel.com>
Cc: "dev@dpdk.org" <dev@dpdk.org>, "Guo, Jia" <jia.guo@intel.com>
Subject: Re: [dpdk-dev] net/iavf: fix VF reset issue for hash
Date: Mon, 18 May 2020 13:14:32 +0000	[thread overview]
Message-ID: <BYAPR11MB266491695ECC58D7BC560DE0ECB80@BYAPR11MB2664.namprd11.prod.outlook.com> (raw)
In-Reply-To: <20200519002017.106445-1-jia.guo@intel.com>

Test-by Zhiwei.He <Zhiwei.he@intel.com>

-----Original Message-----
From: dev <dev-bounces@dpdk.org> On Behalf Of Jeff Guo
Sent: Tuesday, May 19, 2020 8:20 AM
To: Xing, Beilei <beilei.xing@intel.com>; Ye, Xiaolong <xiaolong.ye@intel.com>; Zhang, Qi Z <qi.z.zhang@intel.com>; Wu, Jingjing <jingjing.wu@intel.com>
Cc: dev@dpdk.org; Guo, Jia <jia.guo@intel.com>
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.

Signed-off-by: Jeff Guo <jia.guo@intel.com>
Fixes: 7be10c3004be ("net/iavf: add RSS configuration for VF")
---
 drivers/net/iavf/iavf_hash.c | 51 +++++++++++++++++++++++++++++++++++-
 1 file changed, 50 insertions(+), 1 deletion(-)

diff --git a/drivers/net/iavf/iavf_hash.c b/drivers/net/iavf/iavf_hash.c index 975c84556..04b3492ce 100644
--- a/drivers/net/iavf/iavf_hash.c
+++ b/drivers/net/iavf/iavf_hash.c
@@ -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


  reply	other threads:[~2020-05-18 13:14 UTC|newest]

Thread overview: 7+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2020-05-19  0:20 Jeff Guo
2020-05-18 13:14 ` He, Zhiwei [this message]
2020-05-18 13:36   ` Zhang, Qi Z
2020-05-18 23:54 ` Ye Xiaolong
2020-05-19  2:03   ` Jeff Guo
2020-05-19 14:23 ` [dpdk-dev] [dpdk-dev v2] " Jeff Guo
2020-05-19  3:08   ` Ye Xiaolong

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=BYAPR11MB266491695ECC58D7BC560DE0ECB80@BYAPR11MB2664.namprd11.prod.outlook.com \
    --to=zhiwei.he@intel.com \
    --cc=beilei.xing@intel.com \
    --cc=dev@dpdk.org \
    --cc=jia.guo@intel.com \
    --cc=jingjing.wu@intel.com \
    --cc=qi.z.zhang@intel.com \
    --cc=xiaolong.ye@intel.com \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
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).