DPDK patches and discussions
 help / color / mirror / Atom feed
From: Alvin Zhang <alvinx.zhang@intel.com>
To: qi.z.zhang@intel.com, junfeng.guo@intel.com
Cc: dev@dpdk.org, Alvin Zhang <alvinx.zhang@intel.com>
Subject: [dpdk-dev] [PATCH] net/ice: support IPv4/L4 checksum RSS offload
Date: Thu,  9 Sep 2021 14:47:33 +0800	[thread overview]
Message-ID: <20210909064733.19960-1-alvinx.zhang@intel.com> (raw)

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/ice/ice_hash.c | 33 ++++++++++++++++++++++++++-------
 1 file changed, 26 insertions(+), 7 deletions(-)

diff --git a/drivers/net/ice/ice_hash.c b/drivers/net/ice/ice_hash.c
index 54d14df..3bf8027 100644
--- a/drivers/net/ice/ice_hash.c
+++ b/drivers/net/ice/ice_hash.c
@@ -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 @@ struct ice_rss_hash_cfg eth_tmplt = {
 		} 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 @@ struct ice_rss_hash_cfg eth_tmplt = {
 		} 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 @@ struct ice_rss_hash_cfg eth_tmplt = {
 		} 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 @@ struct ice_rss_hash_cfg eth_tmplt = {
 		} 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) {
-- 
1.8.3.1


             reply	other threads:[~2021-09-09  6:47 UTC|newest]

Thread overview: 4+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2021-09-09  6:47 Alvin Zhang [this message]
2021-09-24  9:05 ` [dpdk-dev] [PATCH v2] " Alvin Zhang
2021-09-24  9:53   ` [dpdk-dev] [PATCH v3] " Alvin Zhang
2021-09-24 11:05     ` Zhang, Qi Z

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=20210909064733.19960-1-alvinx.zhang@intel.com \
    --to=alvinx.zhang@intel.com \
    --cc=dev@dpdk.org \
    --cc=junfeng.guo@intel.com \
    --cc=qi.z.zhang@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).