From: Wei Zhao <wei.zhao1@intel.com>
To: dev@dpdk.org
Cc: Wei Zhao <wei.zhao1@intel.com>
Subject: [dpdk-dev] [PATCH v3] net/ixgbe: fix ntuple filter support for sctp
Date: Fri, 28 Apr 2017 11:40:18 +0800 [thread overview]
Message-ID: <1493350818-5904-1-git-send-email-wei.zhao1@intel.com> (raw)
In-Reply-To: <1493271581-56385-1-git-send-email-wei.zhao1@intel.com>
Add the support of RTE_FLOW_ITEM_TYPE_SCTP type packet for
ixgbe ntuple filter.
Fixes: 672be56d76a ("net/ixgbe: parse n-tuple filter")
Signed-off-by: Wei Zhao <wei.zhao1@intel.com>
Acked-by: Wenzhuo Lu <wenzhuo.lu@intel.com>
---
Changes in v2:
add type check of RTE_FLOW_ITEM_TYPE_SCTP for item flow.
Changes in v3:
change comments for support of SCTP
---
drivers/net/ixgbe/ixgbe_flow.c | 34 ++++++++++++++++++++++++++++++----
1 file changed, 30 insertions(+), 4 deletions(-)
diff --git a/drivers/net/ixgbe/ixgbe_flow.c b/drivers/net/ixgbe/ixgbe_flow.c
index e2ba9c2..7da69a4 100644
--- a/drivers/net/ixgbe/ixgbe_flow.c
+++ b/drivers/net/ixgbe/ixgbe_flow.c
@@ -121,8 +121,8 @@
* IPV4 src_addr 192.168.1.20 0xFFFFFFFF
* dst_addr 192.167.3.50 0xFFFFFFFF
* next_proto_id 17 0xFF
- * UDP/TCP src_port 80 0xFFFF
- * dst_port 80 0xFFFF
+ * UDP/TCP/ src_port 80 0xFFFF
+ * SCTP dst_port 80 0xFFFF
* END
* other members in mask and spec should set to 0x00.
* item->last should be NULL.
@@ -142,6 +142,8 @@ cons_parse_ntuple_filter(const struct rte_flow_attr *attr,
const struct rte_flow_item_tcp *tcp_mask;
const struct rte_flow_item_udp *udp_spec;
const struct rte_flow_item_udp *udp_mask;
+ const struct rte_flow_item_sctp *sctp_spec;
+ const struct rte_flow_item_sctp *sctp_mask;
uint32_t index;
if (!pattern) {
@@ -253,7 +255,8 @@ cons_parse_ntuple_filter(const struct rte_flow_attr *attr,
index++;
NEXT_ITEM_OF_PATTERN(item, pattern, index);
if (item->type != RTE_FLOW_ITEM_TYPE_TCP &&
- item->type != RTE_FLOW_ITEM_TYPE_UDP) {
+ item->type != RTE_FLOW_ITEM_TYPE_UDP &&
+ item->type != RTE_FLOW_ITEM_TYPE_SCTP) {
memset(filter, 0, sizeof(struct rte_eth_ntuple_filter));
rte_flow_error_set(error, EINVAL,
RTE_FLOW_ERROR_TYPE_ITEM,
@@ -319,7 +322,7 @@ cons_parse_ntuple_filter(const struct rte_flow_attr *attr,
filter->dst_port = tcp_spec->hdr.dst_port;
filter->src_port = tcp_spec->hdr.src_port;
filter->tcp_flags = tcp_spec->hdr.tcp_flags;
- } else {
+ } else if (item->type == RTE_FLOW_ITEM_TYPE_UDP) {
udp_mask = (const struct rte_flow_item_udp *)item->mask;
/**
@@ -342,6 +345,29 @@ cons_parse_ntuple_filter(const struct rte_flow_attr *attr,
udp_spec = (const struct rte_flow_item_udp *)item->spec;
filter->dst_port = udp_spec->hdr.dst_port;
filter->src_port = udp_spec->hdr.src_port;
+ } else {
+ sctp_mask = (const struct rte_flow_item_sctp *)item->mask;
+
+ /**
+ * Only support src & dst ports,
+ * others should be masked.
+ */
+ if (sctp_mask->hdr.tag ||
+ sctp_mask->hdr.cksum) {
+ memset(filter, 0,
+ sizeof(struct rte_eth_ntuple_filter));
+ rte_flow_error_set(error, EINVAL,
+ RTE_FLOW_ERROR_TYPE_ITEM,
+ item, "Not supported by ntuple filter");
+ return -rte_errno;
+ }
+
+ filter->dst_port_mask = sctp_mask->hdr.dst_port;
+ filter->src_port_mask = sctp_mask->hdr.src_port;
+
+ sctp_spec = (const struct rte_flow_item_sctp *)item->spec;
+ filter->dst_port = sctp_spec->hdr.dst_port;
+ filter->src_port = sctp_spec->hdr.src_port;
}
/* check if the next not void item is END */
--
2.9.3
prev parent reply other threads:[~2017-04-28 3:47 UTC|newest]
Thread overview: 7+ messages / expand[flat|nested] mbox.gz Atom feed top
2017-04-27 5:39 [dpdk-dev] [PATCH v2] " Wei Zhao
2017-04-27 7:12 ` Lu, Wenzhuo
2017-04-27 9:43 ` Ferruh Yigit
2017-04-28 2:18 ` Zhao1, Wei
2017-04-28 3:37 ` [dpdk-dev] [PATCH v3] " Wei Zhao
2017-04-28 5:36 ` Ferruh Yigit
2017-04-28 3:40 ` Wei Zhao [this message]
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=1493350818-5904-1-git-send-email-wei.zhao1@intel.com \
--to=wei.zhao1@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).