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 F1CE2A034F for ; Wed, 22 Dec 2021 09:18:36 +0100 (CET) Received: from [217.70.189.124] (localhost [127.0.0.1]) by mails.dpdk.org (Postfix) with ESMTP id E3AEE41104; Wed, 22 Dec 2021 09:18:36 +0100 (CET) Received: from mga09.intel.com (mga09.intel.com [134.134.136.24]) by mails.dpdk.org (Postfix) with ESMTP id 0B4B540687; Wed, 22 Dec 2021 09:18:33 +0100 (CET) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=intel.com; i=@intel.com; q=dns/txt; s=Intel; t=1640161114; x=1671697114; h=from:to:cc:subject:date:message-id:in-reply-to: references:mime-version:content-transfer-encoding; bh=NhvD4Y8Yq5Fn+S1iiD1MsXq3YkZrfnOYXvqiDxVxeDw=; b=gIPInU4JgeObWfvZX5EpRMSsbuyqyfCWoTEVRvdkqUPLJerwaR5aGuCJ sl6gvsIx2GRYhDSqFBMItT7MW3z3YN7emzD+aNmB3Lx/Dnx6SKYHmxjq9 Y8iCzk/rvOF6wYTX6jdCCIzXyfDjwTyMmDvl9PYiky+KO7T9ZZGMFacks oSy1LErDofrtJKEqFMoQHtdtvnFAColivNvwaGIwgnTPsCdsXroMTh4EZ O+W3O0vTFGn5wW4AjP9XiZBqqj/qpCJ13Qpp+YlY0ajyc8Elv0ZwgVHew 8ZUr3diSo67i4a4YhAHeN+r1x3ezVFMSTlF8AFEthLDHV04+sqQvLXac6 g==; X-IronPort-AV: E=McAfee;i="6200,9189,10205"; a="240380688" X-IronPort-AV: E=Sophos;i="5.88,225,1635231600"; d="scan'208";a="240380688" Received: from fmsmga001.fm.intel.com ([10.253.24.23]) by orsmga102.jf.intel.com with ESMTP/TLS/ECDHE-RSA-AES256-GCM-SHA384; 22 Dec 2021 00:18:33 -0800 X-ExtLoop1: 1 X-IronPort-AV: E=Sophos;i="5.88,225,1635231600"; d="scan'208";a="664206879" Received: from dpdk-junfengguo-v1.sh.intel.com ([10.67.119.216]) by fmsmga001.fm.intel.com with ESMTP; 22 Dec 2021 00:18:30 -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 v3] net/ice: fix pattern check for FDIR parser Date: Wed, 22 Dec 2021 16:11:38 +0800 Message-Id: <20211222081138.1617225-1-junfeng.guo@intel.com> X-Mailer: git-send-email 2.25.1 In-Reply-To: <20211222080852.1604018-1-junfeng.guo@intel.com> References: <20211222080852.1604018-1-junfeng.guo@intel.com> 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..287032a6a7 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