All of lore.kernel.org
 help / color / mirror / Atom feed
From: Haiyue Wang <haiyue.wang@intel.com>
To: intel-wired-lan@osuosl.org
Subject: [Intel-wired-lan] [Patch v5 05/18] ice: Enhanced IPv4 and IPv6 flow filter
Date: Tue,  9 Mar 2021 11:08:02 +0800	[thread overview]
Message-ID: <20210309030815.5299-6-haiyue.wang@intel.com> (raw)
In-Reply-To: <20210309030815.5299-1-haiyue.wang@intel.com>

From: Qi Zhang <qi.z.zhang@intel.com>

Separate IPv4 and IPv6 ptype bit mask table into 2 tables:
With or without L4 protocols.

When a flow filter without any l4 type is specified, the
ICE_FLOW_SEG_HDR_IPV_OTHER flag can be used to describe if user
want to create a IP rule target for all IP packet or just IP
packet without l4 header.

Signed-off-by: Dan Nowlin <dan.nowlin@intel.com>
Signed-off-by: Qi Zhang <qi.z.zhang@intel.com>
---
 drivers/net/ethernet/intel/ice/ice_flow.c | 54 ++++++++++++++++++++---
 drivers/net/ethernet/intel/ice/ice_flow.h |  4 ++
 2 files changed, 53 insertions(+), 5 deletions(-)

diff --git a/drivers/net/ethernet/intel/ice/ice_flow.c b/drivers/net/ethernet/intel/ice/ice_flow.c
index 750f44572475..7da4d2f820c0 100644
--- a/drivers/net/ethernet/intel/ice/ice_flow.c
+++ b/drivers/net/ethernet/intel/ice/ice_flow.c
@@ -156,7 +156,9 @@ static const u32 ice_ptypes_macvlan_il[] = {
 	0x00000000, 0x00000000, 0x00000000, 0x00000000,
 };
 
-/* Packet types for packets with an Outer/First/Single IPv4 header */
+/* Packet types for packets with an Outer/First/Single IPv4 header, does NOT
+ * include IPV4 other PTYPEs
+ */
 static const u32 ice_ptypes_ipv4_ofos[] = {
 	0x1DC00000, 0x04000800, 0x00000000, 0x00000000,
 	0x00000000, 0x00000155, 0x00000000, 0x00000000,
@@ -166,6 +168,18 @@ static const u32 ice_ptypes_ipv4_ofos[] = {
 	0x00000000, 0x00000000, 0x00000000, 0x00000000,
 	0x00000000, 0x00000000, 0x00000000, 0x00000000,
 	0x00000000, 0x00000000, 0x00000000, 0x00000000,
+};
+
+/* Packet types for packets with an Outer/First/Single IPv4 header, includes
+ * IPV4 other PTYPEs
+ */
+static const u32 ice_ptypes_ipv4_ofos_all[] = {
+	0x1DC00000, 0x04000800, 0x00000000, 0x00000000,
+	0x00000000, 0x00000155, 0x00000000, 0x00000000,
+	0x00000000, 0x000FC000, 0x83E0F800, 0x00000101,
+	0x00000000, 0x00000000, 0x00000000, 0x00000000,
+	0x00000000, 0x00000000, 0x00000000, 0x00000000,
+	0x00000000, 0x00000000, 0x00000000, 0x00000000,
 	0x00000000, 0x00000000, 0x00000000, 0x00000000,
 	0x00000000, 0x00000000, 0x00000000, 0x00000000,
 };
@@ -182,7 +196,9 @@ static const u32 ice_ptypes_ipv4_il[] = {
 	0x00000000, 0x00000000, 0x00000000, 0x00000000,
 };
 
-/* Packet types for packets with an Outer/First/Single IPv6 header */
+/* Packet types for packets with an Outer/First/Single IPv6 header, does NOT
+ * include IVP6 other PTYPEs
+ */
 static const u32 ice_ptypes_ipv6_ofos[] = {
 	0x00000000, 0x00000000, 0x77000000, 0x10002000,
 	0x00000000, 0x000002AA, 0x00000000, 0x00000000,
@@ -192,6 +208,18 @@ static const u32 ice_ptypes_ipv6_ofos[] = {
 	0x00000000, 0x00000000, 0x00000000, 0x00000000,
 	0x00000000, 0x00000000, 0x00000000, 0x00000000,
 	0x00000000, 0x00000000, 0x00000000, 0x00000000,
+};
+
+/* Packet types for packets with an Outer/First/Single IPv6 header, includes
+ * IPV6 other PTYPEs
+ */
+static const u32 ice_ptypes_ipv6_ofos_all[] = {
+	0x00000000, 0x00000000, 0x77000000, 0x10002000,
+	0x00000000, 0x000002AA, 0x00000000, 0x00000000,
+	0x00080F00, 0x03F00000, 0x7C1F0000, 0x00000206,
+	0x00000000, 0x00000000, 0x00000000, 0x00000000,
+	0x00000000, 0x00000000, 0x00000000, 0x00000000,
+	0x00000000, 0x00000000, 0x00000000, 0x00000000,
 	0x00000000, 0x00000000, 0x00000000, 0x00000000,
 	0x00000000, 0x00000000, 0x00000000, 0x00000000,
 };
@@ -577,6 +605,9 @@ struct ice_flow_prof_params {
 #define ICE_FLOW_SEG_HDRS_L4_MASK	\
 	(ICE_FLOW_SEG_HDR_ICMP | ICE_FLOW_SEG_HDR_TCP | ICE_FLOW_SEG_HDR_UDP | \
 	 ICE_FLOW_SEG_HDR_SCTP)
+/* mask for L4 protocols that are NOT part of IPV4/6 OTHER PTYPE groups */
+#define ICE_FLOW_SEG_HDRS_L4_MASK_NO_OTHER	\
+	(ICE_FLOW_SEG_HDR_TCP | ICE_FLOW_SEG_HDR_UDP | ICE_FLOW_SEG_HDR_SCTP)
 
 /**
  * ice_flow_val_hdrs - validates packet segments for valid protocol headers
@@ -692,8 +723,21 @@ ice_flow_proc_seg_hdrs(struct ice_flow_prof_params *params)
 				   (const unsigned long *)ice_ptypes_arp_of,
 				   ICE_FLOW_PTYPE_MAX);
 		}
+
 		if ((hdrs & ICE_FLOW_SEG_HDR_IPV4) &&
-		    !(hdrs & ICE_FLOW_SEG_HDRS_L4_MASK)) {
+		    (hdrs & ICE_FLOW_SEG_HDR_IPV_OTHER)) {
+			src = i ? (const unsigned long *)ice_ptypes_ipv4_il :
+				(const unsigned long *)ice_ptypes_ipv4_ofos_all;
+			bitmap_and(params->ptypes, params->ptypes, src,
+				   ICE_FLOW_PTYPE_MAX);
+		} else if ((hdrs & ICE_FLOW_SEG_HDR_IPV6) &&
+			   (hdrs & ICE_FLOW_SEG_HDR_IPV_OTHER)) {
+			src = i ? (const unsigned long *)ice_ptypes_ipv6_il :
+				(const unsigned long *)ice_ptypes_ipv6_ofos_all;
+			bitmap_and(params->ptypes, params->ptypes, src,
+				   ICE_FLOW_PTYPE_MAX);
+		} else if ((hdrs & ICE_FLOW_SEG_HDR_IPV4) &&
+			   !(hdrs & ICE_FLOW_SEG_HDRS_L4_MASK_NO_OTHER)) {
 			src = !i ? (const unsigned long *)ice_ipv4_ofos_no_l4 :
 				(const unsigned long *)ice_ipv4_il_no_l4;
 			bitmap_and(params->ptypes, params->ptypes, src,
@@ -704,7 +748,7 @@ ice_flow_proc_seg_hdrs(struct ice_flow_prof_params *params)
 			bitmap_and(params->ptypes, params->ptypes, src,
 				   ICE_FLOW_PTYPE_MAX);
 		} else if ((hdrs & ICE_FLOW_SEG_HDR_IPV6) &&
-			   !(hdrs & ICE_FLOW_SEG_HDRS_L4_MASK)) {
+			   !(hdrs & ICE_FLOW_SEG_HDRS_L4_MASK_NO_OTHER)) {
 			src = !i ? (const unsigned long *)ice_ipv6_ofos_no_l4 :
 				(const unsigned long *)ice_ipv6_il_no_l4;
 			bitmap_and(params->ptypes, params->ptypes, src,
@@ -1793,7 +1837,7 @@ ice_flow_set_rss_seg_info(struct ice_flow_seg_info *segs, u64 hash_fields,
 	ICE_FLOW_SET_HDRS(segs, flow_hdr);
 
 	if (segs->hdrs & ~ICE_FLOW_RSS_SEG_HDR_VAL_MASKS &
-	    ~ICE_FLOW_RSS_HDRS_INNER_MASK)
+	    ~ICE_FLOW_RSS_HDRS_INNER_MASK & ~ICE_FLOW_SEG_HDR_IPV_OTHER)
 		return ICE_ERR_PARAM;
 
 	val = (u64)(segs->hdrs & ICE_FLOW_RSS_SEG_HDR_L3_MASKS);
diff --git a/drivers/net/ethernet/intel/ice/ice_flow.h b/drivers/net/ethernet/intel/ice/ice_flow.h
index ed8b8dcf8fee..a5434fcbce25 100644
--- a/drivers/net/ethernet/intel/ice/ice_flow.h
+++ b/drivers/net/ethernet/intel/ice/ice_flow.h
@@ -135,6 +135,10 @@ enum ice_flow_seg_hdr {
 	ICE_FLOW_SEG_HDR_ESP		= 0x00100000,
 	ICE_FLOW_SEG_HDR_AH		= 0x00200000,
 	ICE_FLOW_SEG_HDR_NAT_T_ESP	= 0x00400000,
+	/* The following is an additive bit for ICE_FLOW_SEG_HDR_IPV4 and
+	 * ICE_FLOW_SEG_HDR_IPV6 which include the IPV4 other PTYPEs
+	 */
+	ICE_FLOW_SEG_HDR_IPV_OTHER      = 0x20000000,
 };
 
 /* These segments all have the same PTYPES, but are otherwise distinguished by
-- 
2.30.1


  parent reply	other threads:[~2021-03-09  3:08 UTC|newest]

Thread overview: 58+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2021-03-09  3:07 [Intel-wired-lan] [Patch v5 00/18] Enable Intel VF flow director with DDP Haiyue Wang
2021-03-09  3:07 ` [Intel-wired-lan] [Patch v5 01/18] ice: Add more basic protocol support for flow filter Haiyue Wang
2021-03-15  7:45   ` Wang, Haiyue
2021-03-15  7:55     ` Chen, BoX C
2021-03-15  7:59     ` Chen, BoX C
2021-03-15  8:13     ` Chen, BoX C
2021-03-09  3:07 ` [Intel-wired-lan] [Patch v5 02/18] ice: Support non word aligned input set field Haiyue Wang
2021-03-15  8:15   ` Wang, Haiyue
2021-03-15  8:17     ` Chen, BoX C
2021-03-09  3:08 ` [Intel-wired-lan] [Patch v5 03/18] ice: Add more advanced protocol support in flow filter Haiyue Wang
2021-03-15  8:16   ` Wang, Haiyue
2021-03-15  8:18     ` Chen, BoX C
2021-03-09  3:08 ` [Intel-wired-lan] [Patch v5 04/18] ice: Support to separate GTP-U uplink and downlink Haiyue Wang
2021-03-15  8:17   ` Wang, Haiyue
2021-03-15  8:18     ` Chen, BoX C
2021-03-09  3:08 ` Haiyue Wang [this message]
2021-03-15  8:17   ` [Intel-wired-lan] [Patch v5 05/18] ice: Enhanced IPv4 and IPv6 flow filter Wang, Haiyue
2021-03-15  8:18     ` Chen, BoX C
2021-03-09  3:08 ` [Intel-wired-lan] [Patch v5 06/18] ice: Add support for per VF ctrl VSI enabling Haiyue Wang
2021-03-15  8:18   ` Wang, Haiyue
2021-03-15  8:18     ` Chen, BoX C
2021-03-09  3:08 ` [Intel-wired-lan] [Patch v5 07/18] ice: Enable FDIR Configure for AVF Haiyue Wang
2021-03-15  8:18   ` Wang, Haiyue
2021-03-15  8:20     ` Chen, BoX C
2021-03-09  3:08 ` [Intel-wired-lan] [Patch v5 08/18] ice: Add FDIR pattern action parser for VF Haiyue Wang
2021-03-15  8:19   ` Wang, Haiyue
2021-03-15  8:20     ` Chen, BoX C
2021-03-09  3:08 ` [Intel-wired-lan] [Patch v5 09/18] ice: Add new actions support for VF FDIR Haiyue Wang
2021-03-15  8:19   ` Wang, Haiyue
2021-03-15  8:20     ` Chen, BoX C
2021-03-09  3:08 ` [Intel-wired-lan] [Patch v5 10/18] ice: Add non-IP Layer2 protocol FDIR filter for AVF Haiyue Wang
2021-03-15  8:20   ` Wang, Haiyue
2021-03-15  8:20     ` Chen, BoX C
2021-03-09  3:08 ` [Intel-wired-lan] [Patch v5 11/18] ice: Add GTPU " Haiyue Wang
2021-03-15  8:20   ` Wang, Haiyue
2021-03-15  8:21     ` Chen, BoX C
2021-03-09  3:08 ` [Intel-wired-lan] [Patch v5 12/18] ice: Add more FDIR filter type " Haiyue Wang
2021-03-15  8:21   ` Wang, Haiyue
2021-03-15  8:21     ` Chen, BoX C
2021-03-09  3:08 ` [Intel-wired-lan] [Patch v5 13/18] ice: Check FDIR program status " Haiyue Wang
2021-03-15  8:21   ` Wang, Haiyue
2021-03-15  8:22     ` Chen, BoX C
2021-03-09  3:08 ` [Intel-wired-lan] [Patch v5 14/18] iavf: Add framework to enable ethtool ntuple filters Haiyue Wang
2021-03-16 16:30   ` Wang, Haiyue
2021-03-17  1:27     ` Chen, BoX C
2021-03-09  3:08 ` [Intel-wired-lan] [Patch v5 15/18] iavf: Support IPv4 Flow Director filters Haiyue Wang
2021-03-15 21:43   ` kernel test robot
2021-03-16 16:31   ` Wang, Haiyue
2021-03-17  1:28     ` Chen, BoX C
2021-03-09  3:08 ` [Intel-wired-lan] [Patch v5 16/18] iavf: Support IPv6 " Haiyue Wang
2021-03-16 16:31   ` Wang, Haiyue
2021-03-17  1:28     ` Chen, BoX C
2021-03-09  3:08 ` [Intel-wired-lan] [Patch v5 17/18] iavf: Support Ethernet Type " Haiyue Wang
2021-03-16 16:31   ` Wang, Haiyue
2021-03-17  1:28     ` Chen, BoX C
2021-03-09  3:08 ` [Intel-wired-lan] [Patch v5 18/18] iavf: Enable flex-bytes support Haiyue Wang
2021-03-16 16:32   ` Wang, Haiyue
2021-03-17  1:28     ` Chen, BoX C

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=20210309030815.5299-6-haiyue.wang@intel.com \
    --to=haiyue.wang@intel.com \
    --cc=intel-wired-lan@osuosl.org \
    /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 an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.