From: Jiawen Wu <jiawenwu@trustnetic.com>
To: dev@dpdk.org
Cc: zaiyuwang@trustnetic.com, Jiawen Wu <jiawenwu@trustnetic.com>,
stable@dpdk.org
Subject: [PATCH 13/19] net/txgbe: filter FDIR match flex bytes for tunnel packets
Date: Mon, 27 Oct 2025 11:15:36 +0800 [thread overview]
Message-ID: <20251027031542.10512-14-jiawenwu@trustnetic.com> (raw)
In-Reply-To: <20251027031542.10512-1-jiawenwu@trustnetic.com>
For tunnel packets, pattern RAW is also supported to match in FDIR
rules. Fix to process this field.
Fixes: a1851465f825 ("net/txgbe: fix to create FDIR filter for tunnel packet")
Cc: stable@dpdk.org
Signed-off-by: Jiawen Wu <jiawenwu@trustnetic.com>
---
drivers/net/txgbe/txgbe_flow.c | 125 ++++++++++++++++++++++++++++++++-
1 file changed, 123 insertions(+), 2 deletions(-)
diff --git a/drivers/net/txgbe/txgbe_flow.c b/drivers/net/txgbe/txgbe_flow.c
index 5b03a35949..095c84823f 100644
--- a/drivers/net/txgbe/txgbe_flow.c
+++ b/drivers/net/txgbe/txgbe_flow.c
@@ -2222,6 +2222,8 @@ txgbe_parse_fdir_filter_tunnel(const struct rte_flow_attr *attr,
const struct rte_flow_item_udp *udp_mask;
const struct rte_flow_item_sctp *sctp_spec;
const struct rte_flow_item_sctp *sctp_mask;
+ const struct rte_flow_item_raw *raw_mask;
+ const struct rte_flow_item_raw *raw_spec;
u8 ptid = 0;
uint32_t j;
@@ -2548,7 +2550,8 @@ txgbe_parse_fdir_filter_tunnel(const struct rte_flow_attr *attr,
if (item->type != RTE_FLOW_ITEM_TYPE_TCP &&
item->type != RTE_FLOW_ITEM_TYPE_UDP &&
item->type != RTE_FLOW_ITEM_TYPE_SCTP &&
- item->type != RTE_FLOW_ITEM_TYPE_END) {
+ item->type != RTE_FLOW_ITEM_TYPE_END &&
+ item->type != RTE_FLOW_ITEM_TYPE_RAW) {
memset(rule, 0, sizeof(struct txgbe_fdir_rule));
rte_flow_error_set(error, EINVAL,
RTE_FLOW_ERROR_TYPE_ITEM,
@@ -2637,7 +2640,8 @@ txgbe_parse_fdir_filter_tunnel(const struct rte_flow_attr *attr,
if (item->type != RTE_FLOW_ITEM_TYPE_TCP &&
item->type != RTE_FLOW_ITEM_TYPE_UDP &&
item->type != RTE_FLOW_ITEM_TYPE_SCTP &&
- item->type != RTE_FLOW_ITEM_TYPE_END) {
+ item->type != RTE_FLOW_ITEM_TYPE_END &&
+ item->type != RTE_FLOW_ITEM_TYPE_RAW) {
memset(rule, 0, sizeof(struct txgbe_fdir_rule));
rte_flow_error_set(error, EINVAL,
RTE_FLOW_ERROR_TYPE_ITEM,
@@ -2699,6 +2703,16 @@ txgbe_parse_fdir_filter_tunnel(const struct rte_flow_attr *attr,
rule->input.dst_port =
tcp_spec->hdr.dst_port;
}
+
+ item = next_no_fuzzy_pattern(pattern, item);
+ if (item->type != RTE_FLOW_ITEM_TYPE_RAW &&
+ item->type != RTE_FLOW_ITEM_TYPE_END) {
+ memset(rule, 0, sizeof(struct txgbe_fdir_rule));
+ rte_flow_error_set(error, EINVAL,
+ RTE_FLOW_ERROR_TYPE_ITEM,
+ item, "Not supported by fdir filter");
+ return -rte_errno;
+ }
}
/* Get the UDP info */
@@ -2748,6 +2762,16 @@ txgbe_parse_fdir_filter_tunnel(const struct rte_flow_attr *attr,
rule->input.dst_port =
udp_spec->hdr.dst_port;
}
+
+ item = next_no_fuzzy_pattern(pattern, item);
+ if (item->type != RTE_FLOW_ITEM_TYPE_RAW &&
+ item->type != RTE_FLOW_ITEM_TYPE_END) {
+ memset(rule, 0, sizeof(struct txgbe_fdir_rule));
+ rte_flow_error_set(error, EINVAL,
+ RTE_FLOW_ERROR_TYPE_ITEM,
+ item, "Not supported by fdir filter");
+ return -rte_errno;
+ }
}
/* Get the SCTP info */
@@ -2798,6 +2822,103 @@ txgbe_parse_fdir_filter_tunnel(const struct rte_flow_attr *attr,
rule->input.dst_port =
sctp_spec->hdr.dst_port;
}
+
+ item = next_no_fuzzy_pattern(pattern, item);
+ if (item->type != RTE_FLOW_ITEM_TYPE_RAW &&
+ item->type != RTE_FLOW_ITEM_TYPE_END) {
+ memset(rule, 0, sizeof(struct txgbe_fdir_rule));
+ rte_flow_error_set(error, EINVAL,
+ RTE_FLOW_ERROR_TYPE_ITEM,
+ item, "Not supported by fdir filter");
+ return -rte_errno;
+ }
+ }
+
+ /* Get the flex byte info */
+ if (item->type == RTE_FLOW_ITEM_TYPE_RAW) {
+ uint16_t pattern = 0;
+
+ /* Not supported last point for range*/
+ if (item->last) {
+ rte_flow_error_set(error, EINVAL,
+ RTE_FLOW_ERROR_TYPE_UNSPECIFIED,
+ item, "Not supported last point for range");
+ return -rte_errno;
+ }
+ /* mask should not be null */
+ if (!item->mask || !item->spec) {
+ memset(rule, 0, sizeof(struct txgbe_fdir_rule));
+ rte_flow_error_set(error, EINVAL,
+ RTE_FLOW_ERROR_TYPE_ITEM,
+ item, "Not supported by fdir filter");
+ return -rte_errno;
+ }
+
+ rule->b_mask = TRUE;
+ raw_mask = item->mask;
+
+ /* check mask */
+ if (raw_mask->relative != 0x1 ||
+ raw_mask->search != 0x1 ||
+ raw_mask->reserved != 0x0 ||
+ (uint32_t)raw_mask->offset != 0xffffffff ||
+ raw_mask->limit != 0xffff ||
+ raw_mask->length != 0xffff) {
+ memset(rule, 0, sizeof(struct txgbe_fdir_rule));
+ rte_flow_error_set(error, EINVAL,
+ RTE_FLOW_ERROR_TYPE_ITEM,
+ item, "Not supported by fdir filter");
+ return -rte_errno;
+ }
+
+ rule->b_spec = TRUE;
+ raw_spec = item->spec;
+
+ /* check spec */
+ if (raw_spec->search != 0 ||
+ raw_spec->reserved != 0 ||
+ raw_spec->offset > TXGBE_MAX_FLX_SOURCE_OFF ||
+ raw_spec->offset % 2 ||
+ raw_spec->limit != 0 ||
+ raw_spec->length != 4 ||
+ /* pattern can't be 0xffff */
+ (raw_spec->pattern[0] == 0xff &&
+ raw_spec->pattern[1] == 0xff &&
+ raw_spec->pattern[2] == 0xff &&
+ raw_spec->pattern[3] == 0xff)) {
+ memset(rule, 0, sizeof(struct txgbe_fdir_rule));
+ rte_flow_error_set(error, EINVAL,
+ RTE_FLOW_ERROR_TYPE_ITEM,
+ item, "Not supported by fdir filter");
+ return -rte_errno;
+ }
+
+ /* check pattern mask */
+ if (raw_mask->pattern[0] != 0xff ||
+ raw_mask->pattern[1] != 0xff ||
+ raw_mask->pattern[2] != 0xff ||
+ raw_mask->pattern[3] != 0xff) {
+ memset(rule, 0, sizeof(struct txgbe_fdir_rule));
+ rte_flow_error_set(error, EINVAL,
+ RTE_FLOW_ERROR_TYPE_ITEM,
+ item, "Not supported by fdir filter");
+ return -rte_errno;
+ }
+
+ rule->mask.flex_bytes_mask = 0xffff;
+ /* Convert pattern string to hex bytes */
+ if (sscanf((const char *)raw_spec->pattern, "%hx", &pattern) != 1) {
+ memset(rule, 0, sizeof(struct txgbe_fdir_rule));
+ rte_flow_error_set(error, EINVAL,
+ RTE_FLOW_ERROR_TYPE_ITEM,
+ item, "Failed to parse raw pattern");
+ return -rte_errno;
+ }
+ rule->input.flex_bytes = (pattern & 0x00FF) << 8;
+ rule->input.flex_bytes |= (pattern & 0xFF00) >> 8;
+
+ rule->flex_bytes_offset = raw_spec->offset;
+ rule->flex_relative = raw_spec->relative;
}
if (item->type != RTE_FLOW_ITEM_TYPE_END) {
--
2.48.1
next prev parent reply other threads:[~2025-10-27 3:17 UTC|newest]
Thread overview: 21+ messages / expand[flat|nested] mbox.gz Atom feed top
2025-10-27 3:15 [PATCH 00/19] Wangxun Fixes Jiawen Wu
2025-10-27 3:15 ` [PATCH 01/19] net/txgbe: fix hardware statistic rx_l3_l4_xsum_error Jiawen Wu
2025-10-27 3:15 ` [PATCH 02/19] net/ngbe: " Jiawen Wu
2025-10-27 3:15 ` [PATCH 03/19] net/txgbe: reduce memory size of ring descriptors Jiawen Wu
2025-10-27 3:15 ` [PATCH 04/19] net/ngbe: " Jiawen Wu
2025-10-27 3:15 ` [PATCH 05/19] net/txgbe: fix VF Rx buffer size in config register Jiawen Wu
2025-10-27 3:15 ` [PATCH 06/19] net/ngbe: " Jiawen Wu
2025-10-27 3:15 ` [PATCH 07/19] net/txgbe: remove duplicate txq assignment Jiawen Wu
2025-10-27 3:15 ` [PATCH 08/19] net/txgbe: add device arguments for FDIR Jiawen Wu
2025-10-27 3:15 ` [PATCH 09/19] net/txgbe: fix the maxinum number of FDIR filter Jiawen Wu
2025-10-27 3:15 ` [PATCH 10/19] net/txgbe: fix FDIR mode is not be cleared Jiawen Wu
2025-10-27 3:15 ` [PATCH 11/19] net/txgbe: fix FDIR drop action for L4 match packets Jiawen Wu
2025-10-27 3:15 ` [PATCH 12/19] net/txgbe: fix to create FDIR filter for tunnel SCTP packet Jiawen Wu
2025-10-27 3:15 ` Jiawen Wu [this message]
2025-10-27 3:15 ` [PATCH 14/19] net/txgbe: fix FDIR rule raw relative for L3 packets Jiawen Wu
2025-10-27 3:15 ` [PATCH 15/19] net/txgbe: fix FDIR input mask Jiawen Wu
2025-10-27 3:15 ` [PATCH 16/19] net/txgbe: switch to use FDIR when ntuple filter is full Jiawen Wu
2025-10-27 3:15 ` [PATCH 17/19] net/txgbe: fix VF-PF message for ntuple flow filter Jiawen Wu
2025-10-27 3:15 ` [PATCH 18/19] net/txgbe: switch to use FDIR on VF Jiawen Wu
2025-10-27 3:15 ` [PATCH 19/19] net/txgbe: remove unsupported flow action mark Jiawen Wu
2025-10-27 16:51 ` [PATCH 00/19] Wangxun Fixes Stephen Hemminger
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=20251027031542.10512-14-jiawenwu@trustnetic.com \
--to=jiawenwu@trustnetic.com \
--cc=dev@dpdk.org \
--cc=stable@dpdk.org \
--cc=zaiyuwang@trustnetic.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).