[v1] net/iavf: support default RSS for IP fragment packet

Message ID 20210712023943.800953-1-wenjun1.wu@intel.com (mailing list archive)
State Superseded, archived
Delegated to: Qi Zhang
Headers
Series [v1] net/iavf: support default RSS for IP fragment packet |

Checks

Context Check Description
ci/checkpatch success coding style OK
ci/github-robot success github build: passed
ci/iol-intel-Functional success Functional Testing PASS
ci/iol-intel-Performance success Performance Testing PASS
ci/Intel-compilation success Compilation OK
ci/intel-Testing success Testing PASS
ci/iol-abi-testing warning Testing issues
ci/iol-testing fail Testing issues

Commit Message

Wenjun Wu July 12, 2021, 2:39 a.m. UTC
  This patch adds default RSS support for IPv4 and IPv6 fragment packet.

Signed-off-by: Wenjun Wu <wenjun1.wu@intel.com>
---
 drivers/net/iavf/iavf_hash.c | 60 +++++++++++++++++++++---------------
 1 file changed, 36 insertions(+), 24 deletions(-)
  

Patch

diff --git a/drivers/net/iavf/iavf_hash.c b/drivers/net/iavf/iavf_hash.c
index 03dae5d999..e76d094aae 100644
--- a/drivers/net/iavf/iavf_hash.c
+++ b/drivers/net/iavf/iavf_hash.c
@@ -566,6 +566,29 @@  static struct iavf_flow_parser iavf_hash_parser = {
 	.stage = IAVF_FLOW_STAGE_RSS,
 };
 
+static void
+iavf_hash_add_fragment_hdr(struct virtchnl_proto_hdrs *hdrs, int layer)
+{
+	struct virtchnl_proto_hdr *hdr1;
+	struct virtchnl_proto_hdr *hdr2;
+	int i;
+
+	if (layer < 0 || layer > hdrs->count)
+		return;
+
+	/* shift headers layer */
+	for (i = hdrs->count; i >= layer; i--) {
+		hdr1 = &hdrs->proto_hdr[i];
+		hdr2 = &hdrs->proto_hdr[i - 1];
+		*hdr1 = *hdr2;
+	}
+
+	/* adding dummy fragment header */
+	hdr1 = &hdrs->proto_hdr[layer];
+	VIRTCHNL_SET_PROTO_HDR_TYPE(hdr1, IPV4_FRAG);
+	hdrs->count = ++layer;
+}
+
 int
 iavf_rss_hash_set(struct iavf_adapter *ad, uint64_t rss_hf, bool add)
 {
@@ -580,7 +603,9 @@  iavf_rss_hash_set(struct iavf_adapter *ad, uint64_t rss_hf, bool add)
 	ETH_RSS_NONFRAG_IPV4_TCP | \
 	ETH_RSS_NONFRAG_IPV6_TCP | \
 	ETH_RSS_NONFRAG_IPV4_SCTP | \
-	ETH_RSS_NONFRAG_IPV6_SCTP)
+	ETH_RSS_NONFRAG_IPV6_SCTP | \
+	ETH_RSS_FRAG_IPV4 | \
+	ETH_RSS_FRAG_IPV6)
 
 	rss_cfg.rss_algorithm = VIRTCHNL_RSS_ALG_TOEPLITZ_ASYMMETRIC;
 	if (rss_hf & ETH_RSS_IPV4) {
@@ -606,6 +631,10 @@  iavf_rss_hash_set(struct iavf_adapter *ad, uint64_t rss_hf, bool add)
 	if (rss_hf & ETH_RSS_IPV6) {
 		rss_cfg.proto_hdrs = inner_ipv6_tmplt;
 		iavf_add_del_rss_cfg(ad, &rss_cfg, add);
+		if (rss_hf & ETH_RSS_FRAG_IPV6) {
+			rss_cfg.proto_hdrs = outer_ipv6_frag_tmplt;
+			iavf_add_del_rss_cfg(ad, &rss_cfg, add);
+		}
 	}
 
 	if (rss_hf & ETH_RSS_NONFRAG_IPV6_UDP) {
@@ -623,6 +652,12 @@  iavf_rss_hash_set(struct iavf_adapter *ad, uint64_t rss_hf, bool add)
 		iavf_add_del_rss_cfg(ad, &rss_cfg, add);
 	}
 
+	if (rss_hf & ETH_RSS_FRAG_IPV4) {
+		rss_cfg.proto_hdrs = outer_ipv4_tmplt;
+		iavf_hash_add_fragment_hdr(&rss_cfg.proto_hdrs, 1);
+		iavf_add_del_rss_cfg(ad, &rss_cfg, add);
+	}
+
 	vf->rss_hf = rss_hf & IAVF_RSS_HF_ALL;
 	return 0;
 }
@@ -737,29 +772,6 @@  do { \
 	REFINE_PROTO_FLD(ADD, fld_2);	\
 } while (0)
 
-static void
-iavf_hash_add_fragment_hdr(struct virtchnl_proto_hdrs *hdrs, int layer)
-{
-	struct virtchnl_proto_hdr *hdr1;
-	struct virtchnl_proto_hdr *hdr2;
-	int i;
-
-	if (layer < 0 || layer > hdrs->count)
-		return;
-
-	/* shift headers layer */
-	for (i = hdrs->count; i >= layer; i--) {
-		hdr1 = &hdrs->proto_hdr[i];
-		hdr2 = &hdrs->proto_hdr[i - 1];
-		*hdr1 = *hdr2;
-	}
-
-	/* adding dummy fragment header */
-	hdr1 = &hdrs->proto_hdr[layer];
-	VIRTCHNL_SET_PROTO_HDR_TYPE(hdr1, IPV4_FRAG);
-	hdrs->count = ++layer;
-}
-
 /* refine proto hdrs base on l2, l3, l4 rss type */
 static void
 iavf_refine_proto_hdrs_l234(struct virtchnl_proto_hdrs *proto_hdrs,