[PATCH v2 1/3] net/ice/base: add ipv4 fragment related field

Mingjin Ye mingjinx.ye at intel.com
Fri Jan 24 10:13:21 CET 2025


Added support for the Flags and Fragment Offset fields of ipv4 fragments.

Field definitions are the same as in rte_ipv4_hdr.

Signed-off-by: Mingjin Ye <mingjinx.ye at intel.com>
---
V2: All names standardised to *_IPV4_FRAG_OFS.
---
 drivers/net/ice/base/ice_fdir.h | 2 ++
 drivers/net/ice/base/ice_flow.c | 5 +++++
 drivers/net/ice/base/ice_flow.h | 1 +
 3 files changed, 8 insertions(+)

diff --git a/drivers/net/ice/base/ice_fdir.h b/drivers/net/ice/base/ice_fdir.h
index 1bb8a14a5d..3dd03f93f7 100644
--- a/drivers/net/ice/base/ice_fdir.h
+++ b/drivers/net/ice/base/ice_fdir.h
@@ -56,6 +56,7 @@
 #define ICE_IPV4_TOS_OFFSET		15
 #define ICE_IPV4_ID_OFFSET		18
 #define ICE_IPV4_TTL_OFFSET		22
+#define ICE_IPV4_FRAG_OFS		20
 #define ICE_IPV6_TC_OFFSET		14
 #define ICE_IPV6_HLIM_OFFSET		21
 #define ICE_IPV6_PROTO_OFFSET		20
@@ -181,6 +182,7 @@ struct ice_fdir_v4 {
 	u8 proto;
 	u8 ttl;
 	__be16 packet_id;
+	__be16 fragment_offset;
 };
 
 #define ICE_IPV6_ADDR_LEN_AS_U32		4
diff --git a/drivers/net/ice/base/ice_flow.c b/drivers/net/ice/base/ice_flow.c
index 0d64a5bb1e..cdc9ee26c5 100644
--- a/drivers/net/ice/base/ice_flow.c
+++ b/drivers/net/ice/base/ice_flow.c
@@ -19,6 +19,7 @@
 #define ICE_FLOW_FLD_SZ_TCP_CHKSUM	2
 #define ICE_FLOW_FLD_SZ_UDP_CHKSUM	2
 #define ICE_FLOW_FLD_SZ_SCTP_CHKSUM	4
+#define ICE_FLOW_FLD_SZ_IPV4_FRAG_OFS	2
 #define ICE_FLOW_FLD_SZ_IP_DSCP		1
 #define ICE_FLOW_FLD_SZ_IP_TTL		1
 #define ICE_FLOW_FLD_SZ_IP_PROT		1
@@ -87,6 +88,9 @@ struct ice_flow_field_info ice_flds_info[ICE_FLOW_FIELD_IDX_MAX] = {
 	/* ICE_FLOW_FIELD_IDX_IPV4_TTL */
 	ICE_FLOW_FLD_INFO_MSK(ICE_FLOW_SEG_HDR_NONE, 8,
 			      ICE_FLOW_FLD_SZ_IP_TTL, 0xff00),
+	/* ICE_FLOW_FIELD_IDX_IPV4_FRAG_OFS */
+	ICE_FLOW_FLD_INFO_MSK(ICE_FLOW_SEG_HDR_IPV_FRAG, 6,
+			      ICE_FLOW_FLD_SZ_IPV4_FRAG_OFS, 0x3fff),
 	/* ICE_FLOW_FIELD_IDX_IPV4_PROT */
 	ICE_FLOW_FLD_INFO_MSK(ICE_FLOW_SEG_HDR_NONE, 8,
 			      ICE_FLOW_FLD_SZ_IP_PROT, 0x00ff),
@@ -1459,6 +1463,7 @@ ice_flow_xtract_fld(struct ice_hw *hw, struct ice_flow_prof_params *params,
 			prot_id = ICE_PROT_IPV4_IL_IL;
 		break;
 	case ICE_FLOW_FIELD_IDX_IPV4_ID:
+	case ICE_FLOW_FIELD_IDX_IPV4_FRAG_OFS:
 		prot_id = ICE_PROT_IPV4_OF_OR_S;
 		break;
 	case ICE_FLOW_FIELD_IDX_IPV6_SA:
diff --git a/drivers/net/ice/base/ice_flow.h b/drivers/net/ice/base/ice_flow.h
index 65b261beca..6cbddef8c8 100644
--- a/drivers/net/ice/base/ice_flow.h
+++ b/drivers/net/ice/base/ice_flow.h
@@ -239,6 +239,7 @@ enum ice_flow_field {
 	ICE_FLOW_FIELD_IDX_IPV4_DSCP,
 	ICE_FLOW_FIELD_IDX_IPV6_DSCP,
 	ICE_FLOW_FIELD_IDX_IPV4_TTL,
+	ICE_FLOW_FIELD_IDX_IPV4_FRAG_OFS,
 	ICE_FLOW_FIELD_IDX_IPV4_PROT,
 	ICE_FLOW_FIELD_IDX_IPV6_TTL,
 	ICE_FLOW_FIELD_IDX_IPV6_PROT,
-- 
2.25.1



More information about the dev mailing list