From: Mingjin Ye <mingjinx.ye@intel.com>
To: dev@dpdk.org
Cc: Mingjin Ye <mingjinx.ye@intel.com>,
Bruce Richardson <bruce.richardson@intel.com>,
Anatoly Burakov <anatoly.burakov@intel.com>
Subject: [PATCH 2/3] net/ice: FDIR support IPv4 fragment masks
Date: Wed, 22 Jan 2025 08:23:09 +0000 [thread overview]
Message-ID: <20250122082310.380054-3-mingjinx.ye@intel.com> (raw)
In-Reply-To: <20250122082310.380054-1-mingjinx.ye@intel.com>
This patch supports enabling masks for IPv4 fragments in FDIR.
Flow rule can be created by the following command:
flow create 0 ingress group 2 pattern eth /
ipv4 fragment_offset spec 0x2000 fragment_offset mask 0x3FFF /
end <actions>
Signed-off-by: Mingjin Ye <mingjinx.ye@intel.com>
---
drivers/net/ice/ice_fdir_filter.c | 15 +++++++++++----
drivers/net/ice/ice_generic_flow.h | 2 ++
2 files changed, 13 insertions(+), 4 deletions(-)
diff --git a/drivers/net/ice/ice_fdir_filter.c b/drivers/net/ice/ice_fdir_filter.c
index 406918fed5..247f55118a 100644
--- a/drivers/net/ice/ice_fdir_filter.c
+++ b/drivers/net/ice/ice_fdir_filter.c
@@ -24,7 +24,8 @@
#define ICE_FDIR_INSET_ETH_IPV4 (\
ICE_FDIR_INSET_ETH | \
ICE_INSET_IPV4_SRC | ICE_INSET_IPV4_DST | ICE_INSET_IPV4_TOS | \
- ICE_INSET_IPV4_TTL | ICE_INSET_IPV4_PROTO | ICE_INSET_IPV4_PKID)
+ ICE_INSET_IPV4_TTL | ICE_INSET_IPV4_PROTO | ICE_INSET_IPV4_PKID | \
+ ICE_INSET_IPV4_OFFSET)
#define ICE_FDIR_INSET_ETH_IPV4_UDP (\
ICE_FDIR_INSET_ETH_IPV4 | \
@@ -930,6 +931,7 @@ ice_fdir_input_set_parse(uint64_t inset, enum ice_flow_field *field)
{ICE_INSET_IPV4_TTL, ICE_FLOW_FIELD_IDX_IPV4_TTL},
{ICE_INSET_IPV4_PROTO, ICE_FLOW_FIELD_IDX_IPV4_PROT},
{ICE_INSET_IPV4_PKID, ICE_FLOW_FIELD_IDX_IPV4_ID},
+ {ICE_INSET_IPV4_OFFSET, ICE_FLOW_FIELD_IDX_IPV4_OFFSET},
{ICE_INSET_IPV6_SRC, ICE_FLOW_FIELD_IDX_IPV6_SA},
{ICE_INSET_IPV6_DST, ICE_FLOW_FIELD_IDX_IPV6_DA},
{ICE_INSET_IPV6_TC, ICE_FLOW_FIELD_IDX_IPV6_DSCP},
@@ -2022,7 +2024,8 @@ ice_fdir_parse_pattern(__rte_unused struct ice_adapter *ad,
ipv4_last->hdr.next_proto_id ||
ipv4_last->hdr.hdr_checksum ||
ipv4_last->hdr.src_addr ||
- ipv4_last->hdr.dst_addr)) {
+ ipv4_last->hdr.dst_addr ||
+ ipv4_last->hdr.fragment_offset)) {
rte_flow_error_set(error, EINVAL,
RTE_FLOW_ERROR_TYPE_ITEM,
item, "Invalid IPv4 last.");
@@ -2047,19 +2050,23 @@ ice_fdir_parse_pattern(__rte_unused struct ice_adapter *ad,
*input_set |= ICE_INSET_IPV4_PROTO;
if (ipv4_mask->hdr.type_of_service == UINT8_MAX)
*input_set |= ICE_INSET_IPV4_TOS;
+ if ((ipv4_mask->hdr.fragment_offset &
+ rte_cpu_to_be_16(0x1FFF)) != 0)
+ *input_set |= ICE_INSET_IPV4_OFFSET;
p_v4->dst_ip = ipv4_spec->hdr.dst_addr;
p_v4->src_ip = ipv4_spec->hdr.src_addr;
p_v4->ttl = ipv4_spec->hdr.time_to_live;
p_v4->proto = ipv4_spec->hdr.next_proto_id;
p_v4->tos = ipv4_spec->hdr.type_of_service;
+ p_v4->fragment_offset = ipv4_spec->hdr.fragment_offset;
/* fragment Ipv4:
* spec is 0x2000, mask is 0x2000
*/
- if (ipv4_spec->hdr.fragment_offset ==
+ if (ipv4_spec->hdr.fragment_offset &
rte_cpu_to_be_16(RTE_IPV4_HDR_MF_FLAG) &&
- ipv4_mask->hdr.fragment_offset ==
+ ipv4_mask->hdr.fragment_offset &
rte_cpu_to_be_16(RTE_IPV4_HDR_MF_FLAG)) {
/* all IPv4 fragment packet has the same
* ethertype, if the spec and mask is valid,
diff --git a/drivers/net/ice/ice_generic_flow.h b/drivers/net/ice/ice_generic_flow.h
index 391d615b9a..509eb4b705 100644
--- a/drivers/net/ice/ice_generic_flow.h
+++ b/drivers/net/ice/ice_generic_flow.h
@@ -54,6 +54,7 @@
#define ICE_PFCP_SEID BIT_ULL(42)
#define ICE_PFCP_S_FIELD BIT_ULL(41)
#define ICE_IP_PK_ID BIT_ULL(40)
+#define ICE_IP_OFFSET BIT_ULL(39)
/* input set */
@@ -72,6 +73,7 @@
#define ICE_INSET_IPV4_PROTO (ICE_PROT_IPV4 | ICE_IP_PROTO)
#define ICE_INSET_IPV4_TTL (ICE_PROT_IPV4 | ICE_IP_TTL)
#define ICE_INSET_IPV4_PKID (ICE_PROT_IPV4 | ICE_IP_PK_ID)
+#define ICE_INSET_IPV4_OFFSET (ICE_PROT_IPV4 | ICE_IP_OFFSET)
#define ICE_INSET_IPV6_SRC (ICE_PROT_IPV6 | ICE_IP_SRC)
#define ICE_INSET_IPV6_DST (ICE_PROT_IPV6 | ICE_IP_DST)
#define ICE_INSET_IPV6_NEXT_HDR (ICE_PROT_IPV6 | ICE_IP_PROTO)
--
2.25.1
next prev parent reply other threads:[~2025-01-22 8:53 UTC|newest]
Thread overview: 5+ messages / expand[flat|nested] mbox.gz Atom feed top
2025-01-22 8:23 [PATCH 0/3] flexible IPv4 fragment action Mingjin Ye
2025-01-22 8:23 ` [PATCH 1/3] net/ice/base: add ipv4 fragment related field Mingjin Ye
2025-01-22 8:23 ` Mingjin Ye [this message]
2025-01-22 8:23 ` [PATCH 3/3] net/ice: ACL filter support for IPv4 fragment Mingjin Ye
2025-01-22 11:23 ` [PATCH 0/3] flexible IPv4 fragment action Bruce Richardson
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=20250122082310.380054-3-mingjinx.ye@intel.com \
--to=mingjinx.ye@intel.com \
--cc=anatoly.burakov@intel.com \
--cc=bruce.richardson@intel.com \
--cc=dev@dpdk.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 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).