From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from m50210.mail.qiye.163.com (m50210.mail.qiye.163.com [123.125.50.210]) by dpdk.org (Postfix) with ESMTP id C74E2F04 for ; Tue, 18 Sep 2018 07:51:21 +0200 (CEST) Received: from opengrok.localdomain (unknown [120.132.1.243]) by smtp6 (Coremail) with SMTP id RNOowEA5mUXekaBbs_vgAQ--.2S2; Tue, 18 Sep 2018 13:49:19 +0800 (CST) From: "faicker.mo" To: dev@dpdk.org Cc: "faicker.mo" Date: Tue, 18 Sep 2018 13:48:52 +0800 Message-Id: <1537249732-7530-1-git-send-email-faicker.mo@ucloud.cn> X-Mailer: git-send-email 1.8.3.1 X-CM-TRANSID: RNOowEA5mUXekaBbs_vgAQ--.2S2 X-Coremail-Antispam: 1Uf129KBjDUn29KB7ZKAUJUUUUU529EdanIXcx71UUUUU7v73 VFW2AGmfu7bjvjm3AaLaJ3UbIYCTnIWIevJa73UjIFyTuYvjfUBw0eDUUUU X-Originating-IP: [120.132.1.243] X-CM-SenderInfo: pprft0w6xfz0lxgou0/1tbifRnFf1rpNncRdAAAsJ Subject: [dpdk-dev] [PATCH] net/ixgbe: put 5tuple check in front to jump over ntuple filter case X-BeenThere: dev@dpdk.org X-Mailman-Version: 2.1.15 Precedence: list List-Id: DPDK patches and discussions List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Tue, 18 Sep 2018 05:51:22 -0000 From: "faicker.mo" 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 --- 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