From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from mails.dpdk.org (mails.dpdk.org [217.70.189.124]) by inbox.dpdk.org (Postfix) with ESMTP id 2CF84A034F for ; Wed, 22 Dec 2021 09:11:53 +0100 (CET) Received: from [217.70.189.124] (localhost [127.0.0.1]) by mails.dpdk.org (Postfix) with ESMTP id 1BE8441101; Wed, 22 Dec 2021 09:11:53 +0100 (CET) Received: from mga06.intel.com (mga06.intel.com [134.134.136.31]) by mails.dpdk.org (Postfix) with ESMTP id 1481A40040; Wed, 22 Dec 2021 09:11:49 +0100 (CET) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=intel.com; i=@intel.com; q=dns/txt; s=Intel; t=1640160710; x=1671696710; h=from:to:cc:subject:date:message-id:mime-version: content-transfer-encoding; bh=n+NPvOMZSTiF4321Ncqq60RxRjGSNLWDhzzJ0ns2250=; b=fTyTvBeGJiFudCeKw2/2ovRPGoFFoLMZA2kI3Y4QTWyJHZG957PNH2dR h7QN0SKW7FejSXJoTsVw+bH8ODPZ2Qxm81wcHXNGDQMgfuNUbMRrwyZ+4 YL2xQmfnC6fA121T3uapJI36n4q9YgqpXd8l7QIWF9+olbSTEsQ4SApsq 3y9QasmYhvif7UAbI9DdK78eSxqZjeCHqNqo8pPLS6tyr6h3nhOgSqrqN 6MRRmTmjFm3ipHv9Ll5bOQh5DPv8agQWqjNwJrZQmXP97KnNwFubMkCgZ d7r3OT9DJX+v1eq7ppxXOl2wU0+1AAFCQ4AvJaSXHYkfu1Yk1ZhIFilq0 Q==; X-IronPort-AV: E=McAfee;i="6200,9189,10205"; a="301338550" X-IronPort-AV: E=Sophos;i="5.88,225,1635231600"; d="scan'208";a="301338550" Received: from orsmga008.jf.intel.com ([10.7.209.65]) by orsmga104.jf.intel.com with ESMTP/TLS/ECDHE-RSA-AES256-GCM-SHA384; 22 Dec 2021 00:09:20 -0800 X-ExtLoop1: 1 X-IronPort-AV: E=Sophos;i="5.88,225,1635231600"; d="scan'208";a="521585171" Received: from dpdk-junfengguo-v1.sh.intel.com ([10.67.119.216]) by orsmga008.jf.intel.com with ESMTP; 22 Dec 2021 00:09:17 -0800 From: Junfeng Guo To: qi.z.zhang@intel.com, jingjing.wu@intel.com, beilei.xing@intel.com Cc: dev@dpdk.org, stable@dpdk.org, ferruh.yigit@intel.com, junfeng.guo@intel.com Subject: [PATCH] net/ice: fix pattern check for FDIR parser Date: Wed, 22 Dec 2021 16:02:24 +0800 Message-Id: <20211222080224.1580328-1-junfeng.guo@intel.com> X-Mailer: git-send-email 2.25.1 MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-BeenThere: stable@dpdk.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: patches for DPDK stable branches List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: stable-bounces@dpdk.org FDIR rules with masks are not supported in current code. Thus add pattern check for IPv4/UDP/TCP/SCTP addr/port to terminate the FDIR programming stage. Fixes: 1b71ed2cdd5d ("net/ice: refactor flow pattern parser") Cc: stable@dpdk.org Signed-off-by: Junfeng Guo --- drivers/net/ice/ice_fdir_filter.c | 32 +++++++++++++++++++++++++++++++ 1 file changed, 32 insertions(+) diff --git a/drivers/net/ice/ice_fdir_filter.c b/drivers/net/ice/ice_fdir_filter.c index 13a2ac42df..24278c1217 100644 --- a/drivers/net/ice/ice_fdir_filter.c +++ b/drivers/net/ice/ice_fdir_filter.c @@ -2037,6 +2037,14 @@ ice_fdir_parse_pattern(__rte_unused struct ice_adapter *ad, return -rte_errno; } + /* Mask for IPv4 src/dst addrs not supported */ + if (!ipv4_mask->hdr.src_addr && + ipv4_mask->hdr.src_addr == UINT32_MAX) + return -rte_errno; + if (!ipv4_mask->hdr.dst_addr && + ipv4_mask->hdr.dst_addr == UINT32_MAX) + return -rte_errno; + if (ipv4_mask->hdr.dst_addr == UINT32_MAX) *input_set |= ICE_INSET_IPV4_DST; if (ipv4_mask->hdr.src_addr == UINT32_MAX) @@ -2178,6 +2186,14 @@ ice_fdir_parse_pattern(__rte_unused struct ice_adapter *ad, return -rte_errno; } + /* Mask for TCP src/dst ports not supported */ + if (!tcp_mask->hdr.src_port && + tcp_mask->hdr.src_port == UINT16_MAX) + return -rte_errno; + if (!tcp_mask->hdr.dst_port && + tcp_mask->hdr.dst_port == UINT16_MAX) + return -rte_errno; + if (tcp_mask->hdr.src_port == UINT16_MAX) *input_set |= ICE_INSET_TCP_SRC_PORT; if (tcp_mask->hdr.dst_port == UINT16_MAX) @@ -2217,6 +2233,14 @@ ice_fdir_parse_pattern(__rte_unused struct ice_adapter *ad, return -rte_errno; } + /* Mask for UDP src/dst ports not supported */ + if (!udp_mask->hdr.src_port && + udp_mask->hdr.src_port == UINT16_MAX) + return -rte_errno; + if (!udp_mask->hdr.dst_port && + udp_mask->hdr.dst_port == UINT16_MAX) + return -rte_errno; + if (udp_mask->hdr.src_port == UINT16_MAX) *input_set |= ICE_INSET_UDP_SRC_PORT; if (udp_mask->hdr.dst_port == UINT16_MAX) @@ -2254,6 +2278,14 @@ ice_fdir_parse_pattern(__rte_unused struct ice_adapter *ad, return -rte_errno; } + /* Mask for SCTP src/dst ports not supported */ + if (!sctp_mask->hdr.src_port && + sctp_mask->hdr.src_port == UINT16_MAX) + return -rte_errno; + if (!sctp_mask->hdr.dst_port && + sctp_mask->hdr.dst_port == UINT16_MAX) + return -rte_errno; + if (sctp_mask->hdr.src_port == UINT16_MAX) *input_set |= ICE_INSET_SCTP_SRC_PORT; if (sctp_mask->hdr.dst_port == UINT16_MAX) -- 2.25.1