net/ice: support IPv4/L4 checksum RSS offload
authorAlvin Zhang <alvinx.zhang@intel.com>
Fri, 24 Sep 2021 09:53:41 +0000 (17:53 +0800)
committerQi Zhang <qi.z.zhang@intel.com>
Fri, 24 Sep 2021 10:57:42 +0000 (12:57 +0200)
Add supports for RSS_IPV4_CHKSUM & RSS_L4_CHKSUM RSS offload types
in RSS flow.

Signed-off-by: Alvin Zhang <alvinx.zhang@intel.com>
Acked-by: Qi Zhang <qi.z.zhang@intel.com>
doc/guides/rel_notes/release_21_11.rst
drivers/net/ice/ice_hash.c

index d4c66d8..d7e0e44 100644 (file)
@@ -80,6 +80,7 @@ New Features
 * **Updated Intel ice driver.**
 
   * Added 1PPS out support by a devargs.
+  * Added IPv4 and L4 (TCP/UDP/SCTP) checksum hash support in RSS flow.
 
 * **Updated Marvell cnxk ethdev driver.**
 
index 545bf1b..20a3204 100644 (file)
@@ -374,13 +374,17 @@ struct ice_rss_hash_cfg eth_tmplt = {
 
 /* IPv4 */
 #define ICE_RSS_TYPE_ETH_IPV4          (ETH_RSS_ETH | ETH_RSS_IPV4 | \
-                                        ETH_RSS_FRAG_IPV4)
+                                        ETH_RSS_FRAG_IPV4 | \
+                                        ETH_RSS_IPV4_CHKSUM)
 #define ICE_RSS_TYPE_ETH_IPV4_UDP      (ICE_RSS_TYPE_ETH_IPV4 | \
-                                        ETH_RSS_NONFRAG_IPV4_UDP)
+                                        ETH_RSS_NONFRAG_IPV4_UDP | \
+                                        ETH_RSS_L4_CHKSUM)
 #define ICE_RSS_TYPE_ETH_IPV4_TCP      (ICE_RSS_TYPE_ETH_IPV4 | \
-                                        ETH_RSS_NONFRAG_IPV4_TCP)
+                                        ETH_RSS_NONFRAG_IPV4_TCP | \
+                                        ETH_RSS_L4_CHKSUM)
 #define ICE_RSS_TYPE_ETH_IPV4_SCTP     (ICE_RSS_TYPE_ETH_IPV4 | \
-                                        ETH_RSS_NONFRAG_IPV4_SCTP)
+                                        ETH_RSS_NONFRAG_IPV4_SCTP | \
+                                        ETH_RSS_L4_CHKSUM)
 #define ICE_RSS_TYPE_IPV4              ETH_RSS_IPV4
 #define ICE_RSS_TYPE_IPV4_UDP          (ETH_RSS_IPV4 | \
                                         ETH_RSS_NONFRAG_IPV4_UDP)
@@ -394,11 +398,14 @@ struct ice_rss_hash_cfg eth_tmplt = {
 #define ICE_RSS_TYPE_ETH_IPV6_FRAG     (ETH_RSS_ETH | ETH_RSS_IPV6 | \
                                         ETH_RSS_FRAG_IPV6)
 #define ICE_RSS_TYPE_ETH_IPV6_UDP      (ICE_RSS_TYPE_ETH_IPV6 | \
-                                        ETH_RSS_NONFRAG_IPV6_UDP)
+                                        ETH_RSS_NONFRAG_IPV6_UDP | \
+                                        ETH_RSS_L4_CHKSUM)
 #define ICE_RSS_TYPE_ETH_IPV6_TCP      (ICE_RSS_TYPE_ETH_IPV6 | \
-                                        ETH_RSS_NONFRAG_IPV6_TCP)
+                                        ETH_RSS_NONFRAG_IPV6_TCP | \
+                                        ETH_RSS_L4_CHKSUM)
 #define ICE_RSS_TYPE_ETH_IPV6_SCTP     (ICE_RSS_TYPE_ETH_IPV6 | \
-                                        ETH_RSS_NONFRAG_IPV6_SCTP)
+                                        ETH_RSS_NONFRAG_IPV6_SCTP | \
+                                        ETH_RSS_L4_CHKSUM)
 #define ICE_RSS_TYPE_IPV6              ETH_RSS_IPV6
 #define ICE_RSS_TYPE_IPV6_UDP          (ETH_RSS_IPV6 | \
                                         ETH_RSS_NONFRAG_IPV6_UDP)
@@ -689,6 +696,9 @@ ice_refine_hash_cfg_l234(struct ice_rss_hash_cfg *hash_cfg,
                } else {
                        *hash_flds &= ~ICE_FLOW_HASH_IPV4;
                }
+
+               if (rss_type & ETH_RSS_IPV4_CHKSUM)
+                       *hash_flds |= BIT_ULL(ICE_FLOW_FIELD_IDX_IPV4_CHKSUM);
        }
 
        if (*addl_hdrs & ICE_FLOW_SEG_HDR_IPV6) {
@@ -765,6 +775,9 @@ ice_refine_hash_cfg_l234(struct ice_rss_hash_cfg *hash_cfg,
                } else {
                        *hash_flds &= ~ICE_FLOW_HASH_UDP_PORT;
                }
+
+               if (rss_type & ETH_RSS_L4_CHKSUM)
+                       *hash_flds |= BIT_ULL(ICE_FLOW_FIELD_IDX_UDP_CHKSUM);
        }
 
        if (*addl_hdrs & ICE_FLOW_SEG_HDR_TCP) {
@@ -782,6 +795,9 @@ ice_refine_hash_cfg_l234(struct ice_rss_hash_cfg *hash_cfg,
                } else {
                        *hash_flds &= ~ICE_FLOW_HASH_TCP_PORT;
                }
+
+               if (rss_type & ETH_RSS_L4_CHKSUM)
+                       *hash_flds |= BIT_ULL(ICE_FLOW_FIELD_IDX_TCP_CHKSUM);
        }
 
        if (*addl_hdrs & ICE_FLOW_SEG_HDR_SCTP) {
@@ -799,6 +815,9 @@ ice_refine_hash_cfg_l234(struct ice_rss_hash_cfg *hash_cfg,
                } else {
                        *hash_flds &= ~ICE_FLOW_HASH_SCTP_PORT;
                }
+
+               if (rss_type & ETH_RSS_L4_CHKSUM)
+                       *hash_flds |= BIT_ULL(ICE_FLOW_FIELD_IDX_SCTP_CHKSUM);
        }
 
        if (*addl_hdrs & ICE_FLOW_SEG_HDR_L2TPV3) {