diff mbox series

[2/2] net/iavf: support IPv4/L4 checksum RSS offload

Message ID 20210909065356.22388-2-alvinx.zhang@intel.com (mailing list archive)
State Superseded
Delegated to: Qi Zhang
Headers show
Series [1/2] common/iavf: enable hash calculation based on IPv4 checksum | expand

Checks

Context Check Description
ci/Intel-compilation fail Compilation issues
ci/checkpatch success coding style OK

Commit Message

Zhang, AlvinX Sept. 9, 2021, 6:53 a.m. UTC
Add supports for RSS_IPV4_CHKSUM & RSS_L4_CHKSUM RSS offload types
in RSS flow.

Signed-off-by: Alvin Zhang <alvinx.zhang@intel.com>
---
 drivers/net/iavf/iavf_hash.c | 38 +++++++++++++++++++++++++++++++-------
 1 file changed, 31 insertions(+), 7 deletions(-)
diff mbox series

Patch

diff --git a/drivers/net/iavf/iavf_hash.c b/drivers/net/iavf/iavf_hash.c
index 2b03dad..6a77378 100644
--- a/drivers/net/iavf/iavf_hash.c
+++ b/drivers/net/iavf/iavf_hash.c
@@ -342,23 +342,30 @@  struct virtchnl_proto_hdrs ipv4_ecpri_tmplt = {
 
 /* IPv4 outer */
 #define IAVF_RSS_TYPE_OUTER_IPV4	(ETH_RSS_ETH | ETH_RSS_IPV4 | \
-					 ETH_RSS_FRAG_IPV4)
+					 ETH_RSS_FRAG_IPV4 | \
+					 ETH_RSS_IPV4_CHKSUM)
 #define IAVF_RSS_TYPE_OUTER_IPV4_UDP	(IAVF_RSS_TYPE_OUTER_IPV4 | \
-					 ETH_RSS_NONFRAG_IPV4_UDP)
+					 ETH_RSS_NONFRAG_IPV4_UDP | \
+					 ETH_RSS_L4_CHKSUM)
 #define IAVF_RSS_TYPE_OUTER_IPV4_TCP	(IAVF_RSS_TYPE_OUTER_IPV4 | \
-					 ETH_RSS_NONFRAG_IPV4_TCP)
+					 ETH_RSS_NONFRAG_IPV4_TCP | \
+					 ETH_RSS_L4_CHKSUM)
 #define IAVF_RSS_TYPE_OUTER_IPV4_SCTP	(IAVF_RSS_TYPE_OUTER_IPV4 | \
-					 ETH_RSS_NONFRAG_IPV4_SCTP)
+					 ETH_RSS_NONFRAG_IPV4_SCTP | \
+					 ETH_RSS_L4_CHKSUM)
 /* IPv6 outer */
 #define IAVF_RSS_TYPE_OUTER_IPV6	(ETH_RSS_ETH | ETH_RSS_IPV6)
 #define IAVF_RSS_TYPE_OUTER_IPV6_FRAG	(IAVF_RSS_TYPE_OUTER_IPV6 | \
 					 ETH_RSS_FRAG_IPV6)
 #define IAVF_RSS_TYPE_OUTER_IPV6_UDP	(IAVF_RSS_TYPE_OUTER_IPV6 | \
-					 ETH_RSS_NONFRAG_IPV6_UDP)
+					 ETH_RSS_NONFRAG_IPV6_UDP | \
+					 ETH_RSS_L4_CHKSUM)
 #define IAVF_RSS_TYPE_OUTER_IPV6_TCP	(IAVF_RSS_TYPE_OUTER_IPV6 | \
-					 ETH_RSS_NONFRAG_IPV6_TCP)
+					 ETH_RSS_NONFRAG_IPV6_TCP | \
+					 ETH_RSS_L4_CHKSUM)
 #define IAVF_RSS_TYPE_OUTER_IPV6_SCTP	(IAVF_RSS_TYPE_OUTER_IPV6 | \
-					 ETH_RSS_NONFRAG_IPV6_SCTP)
+					 ETH_RSS_NONFRAG_IPV6_SCTP | \
+					 ETH_RSS_L4_CHKSUM)
 /* VLAN IPV4 */
 #define IAVF_RSS_TYPE_VLAN_IPV4		(IAVF_RSS_TYPE_OUTER_IPV4 | \
 					 ETH_RSS_S_VLAN | ETH_RSS_C_VLAN)
@@ -832,6 +839,10 @@  struct virtchnl_proto_hdrs ipv4_ecpri_tmplt = {
 			} else {
 				hdr->field_selector = 0;
 			}
+
+			if (rss_type & ETH_RSS_IPV4_CHKSUM)
+				REFINE_PROTO_FLD(ADD, IPV4_CHKSUM);
+
 			break;
 		case VIRTCHNL_PROTO_HDR_IPV4_FRAG:
 			if (rss_type &
@@ -844,6 +855,10 @@  struct virtchnl_proto_hdrs ipv4_ecpri_tmplt = {
 			} else {
 				hdr->field_selector = 0;
 			}
+
+			if (rss_type & ETH_RSS_IPV4_CHKSUM)
+				REFINE_PROTO_FLD(ADD, IPV4_CHKSUM);
+
 			break;
 		case VIRTCHNL_PROTO_HDR_IPV6:
 			if (rss_type &
@@ -895,6 +910,9 @@  struct virtchnl_proto_hdrs ipv4_ecpri_tmplt = {
 			} else {
 				hdr->field_selector = 0;
 			}
+
+			if (rss_type & ETH_RSS_L4_CHKSUM)
+				REFINE_PROTO_FLD(ADD, UDP_CHKSUM);
 			break;
 		case VIRTCHNL_PROTO_HDR_TCP:
 			if (rss_type &
@@ -911,6 +929,9 @@  struct virtchnl_proto_hdrs ipv4_ecpri_tmplt = {
 			} else {
 				hdr->field_selector = 0;
 			}
+
+			if (rss_type & ETH_RSS_L4_CHKSUM)
+				REFINE_PROTO_FLD(ADD, TCP_CHKSUM);
 			break;
 		case VIRTCHNL_PROTO_HDR_SCTP:
 			if (rss_type &
@@ -927,6 +948,9 @@  struct virtchnl_proto_hdrs ipv4_ecpri_tmplt = {
 			} else {
 				hdr->field_selector = 0;
 			}
+
+			if (rss_type & ETH_RSS_L4_CHKSUM)
+				REFINE_PROTO_FLD(ADD, SCTP_CHKSUM);
 			break;
 		case VIRTCHNL_PROTO_HDR_S_VLAN:
 			if (!(rss_type & ETH_RSS_S_VLAN))