DPDK patches and discussions
 help / color / mirror / Atom feed
* [PATCH] net/ice/base: enable FDIR support for IPV6_NETX_PROTO
@ 2022-04-07  3:01 Jie Wang
  2022-05-07  9:13 ` [PATCH v2] " Jie Wang
  0 siblings, 1 reply; 5+ messages in thread
From: Jie Wang @ 2022-04-07  3:01 UTC (permalink / raw)
  To: dev; +Cc: stevex.yang, qiming.yang, qi.z.zhang, Jie Wang

To support the new DDP and be compatible with the old version DDP
file, API function 'check_ddp_support_proto_id' is added to detect
if the required protocol ID is supported by the current DDP file.

Add new protocol ID IPV6_NETX_PROTO support for PF FDIR if current
DDP is new DDP and keep behavior if it is the old version DDP.

Signed-off-by: Jie Wang <jie1x.wang@intel.com>
---
 drivers/net/ice/base/ice_flow.c          | 16 +++++++++-
 drivers/net/ice/base/ice_parser.c        | 40 ++++++++++++++++++++++++
 drivers/net/ice/base/ice_parser.h        |  1 +
 drivers/net/ice/base/ice_protocol_type.h |  1 +
 4 files changed, 57 insertions(+), 1 deletion(-)

diff --git a/drivers/net/ice/base/ice_flow.c b/drivers/net/ice/base/ice_flow.c
index bcbb9b12c4..054897c1e7 100644
--- a/drivers/net/ice/base/ice_flow.c
+++ b/drivers/net/ice/base/ice_flow.c
@@ -1370,6 +1370,7 @@ ice_flow_xtract_fld(struct ice_hw *hw, struct ice_flow_prof_params *params,
 	u16 sib_mask = 0;
 	u16 mask;
 	u16 off;
+	bool exist;
 
 	flds = params->prof->segs[seg].fields;
 
@@ -1410,7 +1411,16 @@ ice_flow_xtract_fld(struct ice_hw *hw, struct ice_flow_prof_params *params,
 		break;
 	case ICE_FLOW_FIELD_IDX_IPV6_TTL:
 	case ICE_FLOW_FIELD_IDX_IPV6_PROT:
-		prot_id = seg == 0 ? ICE_PROT_IPV6_OF_OR_S : ICE_PROT_IPV6_IL;
+		exist = check_ddp_support_proto_id(hw,
+						   ICE_PROT_IPV6_NEXT_PROTO);
+		if (!exist)
+			prot_id = seg == 0 ?
+				  ICE_PROT_IPV6_OF_OR_S :
+				  ICE_PROT_IPV6_IL;
+		else
+			prot_id = seg == 0 ?
+				  ICE_PROT_IPV6_NEXT_PROTO :
+				  ICE_PROT_IPV6_IL;
 
 		/* TTL and PROT share the same extraction seq. entry.
 		 * Each is considered a sibling to the other in terms of sharing
@@ -1543,6 +1553,10 @@ ice_flow_xtract_fld(struct ice_hw *hw, struct ice_flow_prof_params *params,
 	flds[fld].xtrct.disp = (u8)(ice_flds_info[fld].off % ese_bits);
 	flds[fld].xtrct.idx = params->es_cnt;
 	flds[fld].xtrct.mask = ice_flds_info[fld].mask;
+	if (prot_id == ICE_PROT_IPV6_NEXT_PROTO) {
+		flds[fld].xtrct.off = 0;
+		flds[fld].xtrct.disp = 0;
+	}
 
 	/* Adjust the next field-entry index after accommodating the number of
 	 * entries this field consumes
diff --git a/drivers/net/ice/base/ice_parser.c b/drivers/net/ice/base/ice_parser.c
index 9b106baff0..7340ca0590 100644
--- a/drivers/net/ice/base/ice_parser.c
+++ b/drivers/net/ice/base/ice_parser.c
@@ -552,3 +552,43 @@ void ice_parser_profile_dump(struct ice_hw *hw, struct ice_parser_profile *prof)
 	ice_info(hw, "flags = 0x%04x\n", prof->flags);
 	ice_info(hw, "flags_msk = 0x%04x\n", prof->flags_msk);
 }
+
+/**
+ * check_ddp_support_proto_id - check DDP package file support protocol ID
+ * @hw: pointer to the HW struct
+ * @proto_id: protocol ID value
+ *
+ * This function maintains the compatibility of the program process by checking
+ * whether the current DDP file supports the required protocol ID.
+ */
+bool check_ddp_support_proto_id(struct ice_hw *hw, enum ice_prot_id proto_id)
+{
+	struct ice_proto_grp_item *proto_grp_table;
+	struct ice_proto_grp_item *proto_grp;
+	bool exist = false;
+	u16 idx = 0;
+	u16 i;
+
+	proto_grp_table = ice_proto_grp_table_get(hw);
+	if (!proto_grp_table)
+		goto exit;
+
+	do {
+		proto_grp = &proto_grp_table[idx];
+		if (idx != proto_grp->idx)
+			break;
+
+		for (i = 0; i < ICE_PROTO_COUNT_PER_GRP; i++) {
+			if (proto_grp->po[i].proto_id == proto_id) {
+				exist = true;
+				goto exit;
+			}
+		}
+
+		idx++;
+	} while (idx);
+
+exit:
+	ice_free(hw, proto_grp_table);
+	return exist;
+}
diff --git a/drivers/net/ice/base/ice_parser.h b/drivers/net/ice/base/ice_parser.h
index 816aea782a..161061498a 100644
--- a/drivers/net/ice/base/ice_parser.h
+++ b/drivers/net/ice/base/ice_parser.h
@@ -110,4 +110,5 @@ enum ice_status ice_parser_profile_init(struct ice_parser_result *rslt,
 					struct ice_parser_profile *prof);
 void ice_parser_profile_dump(struct ice_hw *hw,
 			     struct ice_parser_profile *prof);
+bool check_ddp_support_proto_id(struct ice_hw *hw, enum ice_prot_id proto_id);
 #endif /* _ICE_PARSER_H_ */
diff --git a/drivers/net/ice/base/ice_protocol_type.h b/drivers/net/ice/base/ice_protocol_type.h
index 0e6e5990be..83867418c6 100644
--- a/drivers/net/ice/base/ice_protocol_type.h
+++ b/drivers/net/ice/base/ice_protocol_type.h
@@ -163,6 +163,7 @@ enum ice_prot_id {
 	ICE_PROT_IPV6_OF_OR_S	= 40,
 	ICE_PROT_IPV6_IL	= 41,
 	ICE_PROT_IPV6_IL_IL	= 42,
+	ICE_PROT_IPV6_NEXT_PROTO = 43,
 	ICE_PROT_IPV6_FRAG	= 47,
 	ICE_PROT_TCP_IL		= 49,
 	ICE_PROT_UDP_OF		= 52,
-- 
2.25.1


^ permalink raw reply	[flat|nested] 5+ messages in thread

* [PATCH v2] net/ice/base: enable FDIR support for IPV6_NETX_PROTO
  2022-04-07  3:01 [PATCH] net/ice/base: enable FDIR support for IPV6_NETX_PROTO Jie Wang
@ 2022-05-07  9:13 ` Jie Wang
  2022-05-11 14:31   ` Zhang, Qi Z
  0 siblings, 1 reply; 5+ messages in thread
From: Jie Wang @ 2022-05-07  9:13 UTC (permalink / raw)
  To: dev; +Cc: stevex.yang, qiming.yang, qi.z.zhang, Jie Wang

To support the new DDP and be compatible with the old version DDP
file, API function 'check_ddp_support_proto_id' is added to detect
if the required protocol ID is supported by the current DDP file.

Add new protocol ID IPV6_NETX_PROTO support for PF FDIR if current
DDP is new DDP and keep behavior if it is the old version DDP.

v2: rebase and optimize the API function

Signed-off-by: Jie Wang <jie1x.wang@intel.com>
---
 drivers/net/ice/base/ice_flow.c          | 16 ++++++++++-
 drivers/net/ice/base/ice_parser.c        | 35 ++++++++++++++++++++++++
 drivers/net/ice/base/ice_parser.h        |  2 ++
 drivers/net/ice/base/ice_proto_grp.c     |  1 -
 drivers/net/ice/base/ice_proto_grp.h     |  1 +
 drivers/net/ice/base/ice_protocol_type.h |  1 +
 6 files changed, 54 insertions(+), 2 deletions(-)

diff --git a/drivers/net/ice/base/ice_flow.c b/drivers/net/ice/base/ice_flow.c
index bcbb9b12c4..4a73f0c674 100644
--- a/drivers/net/ice/base/ice_flow.c
+++ b/drivers/net/ice/base/ice_flow.c
@@ -1370,6 +1370,7 @@ ice_flow_xtract_fld(struct ice_hw *hw, struct ice_flow_prof_params *params,
 	u16 sib_mask = 0;
 	u16 mask;
 	u16 off;
+	bool exist;
 
 	flds = params->prof->segs[seg].fields;
 
@@ -1410,7 +1411,16 @@ ice_flow_xtract_fld(struct ice_hw *hw, struct ice_flow_prof_params *params,
 		break;
 	case ICE_FLOW_FIELD_IDX_IPV6_TTL:
 	case ICE_FLOW_FIELD_IDX_IPV6_PROT:
-		prot_id = seg == 0 ? ICE_PROT_IPV6_OF_OR_S : ICE_PROT_IPV6_IL;
+		prot_id = ICE_PROT_IPV6_NEXT_PROTO;
+		exist = ice_check_ddp_support_proto_id(hw, prot_id);
+		if (!exist)
+			prot_id = seg == 0 ?
+				  ICE_PROT_IPV6_OF_OR_S :
+				  ICE_PROT_IPV6_IL;
+		else
+			prot_id = seg == 0 ?
+				  ICE_PROT_IPV6_NEXT_PROTO :
+				  ICE_PROT_IPV6_IL;
 
 		/* TTL and PROT share the same extraction seq. entry.
 		 * Each is considered a sibling to the other in terms of sharing
@@ -1543,6 +1553,10 @@ ice_flow_xtract_fld(struct ice_hw *hw, struct ice_flow_prof_params *params,
 	flds[fld].xtrct.disp = (u8)(ice_flds_info[fld].off % ese_bits);
 	flds[fld].xtrct.idx = params->es_cnt;
 	flds[fld].xtrct.mask = ice_flds_info[fld].mask;
+	if (prot_id == ICE_PROT_IPV6_NEXT_PROTO) {
+		flds[fld].xtrct.off = 0;
+		flds[fld].xtrct.disp = 0;
+	}
 
 	/* Adjust the next field-entry index after accommodating the number of
 	 * entries this field consumes
diff --git a/drivers/net/ice/base/ice_parser.c b/drivers/net/ice/base/ice_parser.c
index 9b106baff0..6529f5d635 100644
--- a/drivers/net/ice/base/ice_parser.c
+++ b/drivers/net/ice/base/ice_parser.c
@@ -552,3 +552,38 @@ void ice_parser_profile_dump(struct ice_hw *hw, struct ice_parser_profile *prof)
 	ice_info(hw, "flags = 0x%04x\n", prof->flags);
 	ice_info(hw, "flags_msk = 0x%04x\n", prof->flags_msk);
 }
+
+/**
+ * ice_check_ddp_support_proto_id - check DDP package file support protocol ID
+ * @hw: pointer to the HW struct
+ * @proto_id: protocol ID value
+ *
+ * This function maintains the compatibility of the program process by checking
+ * whether the current DDP file supports the required protocol ID.
+ */
+bool ice_check_ddp_support_proto_id(struct ice_hw *hw,
+				    enum ice_prot_id proto_id)
+{
+	struct ice_proto_grp_item *proto_grp_table;
+	struct ice_proto_grp_item *proto_grp;
+	bool exist = false;
+	u16 idx, i;
+
+	proto_grp_table = ice_proto_grp_table_get(hw);
+	if (!proto_grp_table)
+		return false;
+
+	for (idx = 0; idx < ICE_PROTO_GRP_TABLE_SIZE; idx++) {
+		proto_grp = &proto_grp_table[idx];
+		for (i = 0; i < ICE_PROTO_COUNT_PER_GRP; i++) {
+			if (proto_grp->po[i].proto_id == proto_id) {
+				exist = true;
+				goto exit;
+			}
+		}
+	}
+
+exit:
+	ice_free(hw, proto_grp_table);
+	return exist;
+}
diff --git a/drivers/net/ice/base/ice_parser.h b/drivers/net/ice/base/ice_parser.h
index 816aea782a..22c73b686b 100644
--- a/drivers/net/ice/base/ice_parser.h
+++ b/drivers/net/ice/base/ice_parser.h
@@ -110,4 +110,6 @@ enum ice_status ice_parser_profile_init(struct ice_parser_result *rslt,
 					struct ice_parser_profile *prof);
 void ice_parser_profile_dump(struct ice_hw *hw,
 			     struct ice_parser_profile *prof);
+bool ice_check_ddp_support_proto_id(struct ice_hw *hw,
+				    enum ice_prot_id proto_id);
 #endif /* _ICE_PARSER_H_ */
diff --git a/drivers/net/ice/base/ice_proto_grp.c b/drivers/net/ice/base/ice_proto_grp.c
index 69d5d9a18a..7ce87de110 100644
--- a/drivers/net/ice/base/ice_proto_grp.c
+++ b/drivers/net/ice/base/ice_proto_grp.c
@@ -5,7 +5,6 @@
 #include "ice_common.h"
 #include "ice_parser_util.h"
 
-#define ICE_PROTO_GRP_TABLE_SIZE 192
 
 static void _proto_off_dump(struct ice_hw *hw, struct ice_proto_off *po,
 			    int idx)
diff --git a/drivers/net/ice/base/ice_proto_grp.h b/drivers/net/ice/base/ice_proto_grp.h
index 88d84505dd..1a5b5d5f44 100644
--- a/drivers/net/ice/base/ice_proto_grp.h
+++ b/drivers/net/ice/base/ice_proto_grp.h
@@ -6,6 +6,7 @@
 #define _ICE_PROTO_GRP_H_
 
 #define ICE_PROTO_COUNT_PER_GRP 8
+#define ICE_PROTO_GRP_TABLE_SIZE 192
 
 struct ice_proto_off {
 	bool polarity; /* true: positive, false: nagtive */
diff --git a/drivers/net/ice/base/ice_protocol_type.h b/drivers/net/ice/base/ice_protocol_type.h
index 0e6e5990be..83867418c6 100644
--- a/drivers/net/ice/base/ice_protocol_type.h
+++ b/drivers/net/ice/base/ice_protocol_type.h
@@ -163,6 +163,7 @@ enum ice_prot_id {
 	ICE_PROT_IPV6_OF_OR_S	= 40,
 	ICE_PROT_IPV6_IL	= 41,
 	ICE_PROT_IPV6_IL_IL	= 42,
+	ICE_PROT_IPV6_NEXT_PROTO = 43,
 	ICE_PROT_IPV6_FRAG	= 47,
 	ICE_PROT_TCP_IL		= 49,
 	ICE_PROT_UDP_OF		= 52,
-- 
2.25.1


^ permalink raw reply	[flat|nested] 5+ messages in thread

* RE: [PATCH v2] net/ice/base: enable FDIR support for IPV6_NETX_PROTO
  2022-05-07  9:13 ` [PATCH v2] " Jie Wang
@ 2022-05-11 14:31   ` Zhang, Qi Z
  2022-05-11 14:55     ` Thomas Monjalon
  0 siblings, 1 reply; 5+ messages in thread
From: Zhang, Qi Z @ 2022-05-11 14:31 UTC (permalink / raw)
  To: Wang, Jie1X, dev; +Cc: Yang, SteveX, Yang, Qiming



> -----Original Message-----
> From: Wang, Jie1X <jie1x.wang@intel.com>
> Sent: Saturday, May 7, 2022 5:14 PM
> To: dev@dpdk.org
> Cc: Yang, SteveX <stevex.yang@intel.com>; Yang, Qiming
> <qiming.yang@intel.com>; Zhang, Qi Z <qi.z.zhang@intel.com>; Wang, Jie1X
> <jie1x.wang@intel.com>
> Subject: [PATCH v2] net/ice/base: enable FDIR support for IPV6_NETX_PROTO
> 
> To support the new DDP and be compatible with the old version DDP file, API
> function 'check_ddp_support_proto_id' is added to detect if the required
> protocol ID is supported by the current DDP file.
> 
> Add new protocol ID IPV6_NETX_PROTO support for PF FDIR if current DDP is
> new DDP and keep behavior if it is the old version DDP.
> 
> v2: rebase and optimize the API function
> 
> Signed-off-by: Jie Wang <jie1x.wang@intel.com>

Acked-by: Qi Zhang <qi.z.zhang@intel.com>

Applied to dpdk-next-net-intel.

Thanks
Qi

^ permalink raw reply	[flat|nested] 5+ messages in thread

* Re: [PATCH v2] net/ice/base: enable FDIR support for IPV6_NETX_PROTO
  2022-05-11 14:31   ` Zhang, Qi Z
@ 2022-05-11 14:55     ` Thomas Monjalon
  2022-05-11 15:04       ` Zhang, Qi Z
  0 siblings, 1 reply; 5+ messages in thread
From: Thomas Monjalon @ 2022-05-11 14:55 UTC (permalink / raw)
  To: Wang, Jie1X, Zhang, Qi Z; +Cc: dev, Yang, SteveX, Yang, Qiming

11/05/2022 16:31, Zhang, Qi Z:
> From: Wang, Jie1X <jie1x.wang@intel.com>
> > 
> > To support the new DDP and be compatible with the old version DDP file, API
> > function 'check_ddp_support_proto_id' is added to detect if the required
> > protocol ID is supported by the current DDP file.
> > 
> > Add new protocol ID IPV6_NETX_PROTO support for PF FDIR if current DDP is
> > new DDP and keep behavior if it is the old version DDP.
> > 
> > v2: rebase and optimize the API function
> > 
> > Signed-off-by: Jie Wang <jie1x.wang@intel.com>
> 
> Acked-by: Qi Zhang <qi.z.zhang@intel.com>
> 
> Applied to dpdk-next-net-intel.

Do you mean NEXT_PROTO instead of NETX?

Qi, I expect you fix this kind of mistake while merging please, thank you.



^ permalink raw reply	[flat|nested] 5+ messages in thread

* RE: [PATCH v2] net/ice/base: enable FDIR support for IPV6_NETX_PROTO
  2022-05-11 14:55     ` Thomas Monjalon
@ 2022-05-11 15:04       ` Zhang, Qi Z
  0 siblings, 0 replies; 5+ messages in thread
From: Zhang, Qi Z @ 2022-05-11 15:04 UTC (permalink / raw)
  To: Thomas Monjalon, Wang, Jie1X; +Cc: dev, Yang, SteveX, Yang, Qiming



> -----Original Message-----
> From: Thomas Monjalon <thomas@monjalon.net>
> Sent: Wednesday, May 11, 2022 10:55 PM
> To: Wang, Jie1X <jie1x.wang@intel.com>; Zhang, Qi Z <qi.z.zhang@intel.com>
> Cc: dev@dpdk.org; Yang, SteveX <stevex.yang@intel.com>; Yang, Qiming
> <qiming.yang@intel.com>
> Subject: Re: [PATCH v2] net/ice/base: enable FDIR support for
> IPV6_NETX_PROTO
> 
> 11/05/2022 16:31, Zhang, Qi Z:
> > From: Wang, Jie1X <jie1x.wang@intel.com>
> > >
> > > To support the new DDP and be compatible with the old version DDP
> > > file, API function 'check_ddp_support_proto_id' is added to detect
> > > if the required protocol ID is supported by the current DDP file.
> > >
> > > Add new protocol ID IPV6_NETX_PROTO support for PF FDIR if current
> > > DDP is new DDP and keep behavior if it is the old version DDP.
> > >
> > > v2: rebase and optimize the API function
> > >
> > > Signed-off-by: Jie Wang <jie1x.wang@intel.com>
> >
> > Acked-by: Qi Zhang <qi.z.zhang@intel.com>
> >
> > Applied to dpdk-next-net-intel.
> 
> Do you mean NEXT_PROTO instead of NETX?
> 
> Qi, I expect you fix this kind of mistake while merging please, thank you.

Yes, it should be NEXT_PROTO, I have fixed in dpdk-next-net-intel. thanks
> 


^ permalink raw reply	[flat|nested] 5+ messages in thread

end of thread, other threads:[~2022-05-11 15:04 UTC | newest]

Thread overview: 5+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2022-04-07  3:01 [PATCH] net/ice/base: enable FDIR support for IPV6_NETX_PROTO Jie Wang
2022-05-07  9:13 ` [PATCH v2] " Jie Wang
2022-05-11 14:31   ` Zhang, Qi Z
2022-05-11 14:55     ` Thomas Monjalon
2022-05-11 15:04       ` Zhang, Qi Z

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).