DPDK patches and discussions
 help / color / mirror / Atom feed
From: "faicker.mo" <faicker.mo@ucloud.cn>
To: dev@dpdk.org
Cc: "faicker.mo" <faicker.mo@ucloud.cn>
Subject: [dpdk-dev] [PATCH] net/ixgbe: put 5tuple check in front to jump over ntuple filter case
Date: Tue, 18 Sep 2018 13:48:52 +0800	[thread overview]
Message-ID: <1537249732-7530-1-git-send-email-faicker.mo@ucloud.cn> (raw)

From: "faicker.mo" <faicker.mo@ucloud.cn>

Check in func ntuple_filter_to_5tuple is too late for fdir filter rule,
add check in func cons_parse_ntuple_filter.

Signed-off-by: faicker.mo <faicker.mo@ucloud.cn>
---
 drivers/net/ixgbe/ixgbe_flow.c | 29 +++++++++++++++++++++++++++++
 1 file changed, 29 insertions(+)

diff --git a/drivers/net/ixgbe/ixgbe_flow.c b/drivers/net/ixgbe/ixgbe_flow.c
index 1adf1b8..f0fafeb 100644
--- a/drivers/net/ixgbe/ixgbe_flow.c
+++ b/drivers/net/ixgbe/ixgbe_flow.c
@@ -363,6 +363,17 @@ const struct rte_flow_action *next_no_void_action(
 				item, "Not supported by ntuple filter");
 			return -rte_errno;
 		}
+		if ((ipv4_mask->hdr.src_addr != 0 &&
+			ipv4_mask->hdr.src_addr != UINT32_MAX) ||
+			(ipv4_mask->hdr.dst_addr != 0 &&
+			ipv4_mask->hdr.dst_addr != UINT32_MAX) ||
+			(ipv4_mask->hdr.next_proto_id != UINT8_MAX &&
+			ipv4_mask->hdr.next_proto_id != 0)) {
+			rte_flow_error_set(error,
+				EINVAL, RTE_FLOW_ERROR_TYPE_ITEM,
+				item, "Not supported by ntuple filter");
+			return -rte_errno;
+		}
 
 		filter->dst_ip_mask = ipv4_mask->hdr.dst_addr;
 		filter->src_ip_mask = ipv4_mask->hdr.src_addr;
@@ -432,6 +443,15 @@ const struct rte_flow_action *next_no_void_action(
 				item, "Not supported by ntuple filter");
 			return -rte_errno;
 		}
+		if ((tcp_mask->hdr.src_port != 0 &&
+			tcp_mask->hdr.src_port != UINT16_MAX) ||
+			(tcp_mask->hdr.dst_port != 0 &&
+			tcp_mask->hdr.dst_port != UINT16_MAX)) {
+			rte_flow_error_set(error,
+				EINVAL, RTE_FLOW_ERROR_TYPE_ITEM,
+				item, "Not supported by ntuple filter");
+			return -rte_errno;
+		}
 
 		filter->dst_port_mask  = tcp_mask->hdr.dst_port;
 		filter->src_port_mask  = tcp_mask->hdr.src_port;
@@ -467,6 +487,15 @@ const struct rte_flow_action *next_no_void_action(
 				item, "Not supported by ntuple filter");
 			return -rte_errno;
 		}
+		if ((udp_mask->hdr.src_port != 0 &&
+			udp_mask->hdr.src_port != UINT16_MAX) ||
+			(udp_mask->hdr.dst_port != 0 &&
+			udp_mask->hdr.dst_port != UINT16_MAX)) {
+			rte_flow_error_set(error,
+				EINVAL, RTE_FLOW_ERROR_TYPE_ITEM,
+				item, "Not supported by ntuple filter");
+			return -rte_errno;
+		}
 
 		filter->dst_port_mask = udp_mask->hdr.dst_port;
 		filter->src_port_mask = udp_mask->hdr.src_port;
-- 
1.8.3.1

             reply	other threads:[~2018-09-18  5:51 UTC|newest]

Thread overview: 10+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2018-09-18  5:48 faicker.mo [this message]
2018-09-21 15:48 ` Zhang, Qi Z
2018-09-26  8:15   ` mocan
2018-09-26 11:14     ` Zhang, Qi Z
2018-10-08  9:46       ` Zhao1, Wei
2018-10-10 18:36         ` Zhang, Qi Z
2018-10-11  8:10           ` Zhao1, Wei
2018-10-15  3:30             ` Zhang, Qi Z
2018-10-17  5:57               ` Zhao1, Wei
2018-10-19 17:10                 ` Zhang, Qi Z

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=1537249732-7530-1-git-send-email-faicker.mo@ucloud.cn \
    --to=faicker.mo@ucloud.cn \
    --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).