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 E9CA0A04AE for ; Tue, 8 Feb 2022 08:09:54 +0100 (CET) Received: from [217.70.189.124] (localhost [127.0.0.1]) by mails.dpdk.org (Postfix) with ESMTP id 19AA041140; Tue, 8 Feb 2022 08:09:54 +0100 (CET) Received: from mga09.intel.com (mga09.intel.com [134.134.136.24]) by mails.dpdk.org (Postfix) with ESMTP id A2D0E40141; Tue, 8 Feb 2022 08:09:51 +0100 (CET) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=intel.com; i=@intel.com; q=dns/txt; s=Intel; t=1644304192; x=1675840192; h=from:to:cc:subject:date:message-id:in-reply-to: references:mime-version:content-transfer-encoding; bh=UiDTJohSyqrxEX0wc9GTte6uL3fMWn4C5IcYCnVS5/Q=; b=Z2n2fpcmLiEgaPqE0VnORb4XyItrr69cB6U4tT/zKuAhYIOlr37dKd8e LEvhAwUvCw1/8IznbrF0oC/tsTu+AAiT+Ervrt4BO71XAzUVoXcdCwuhA 5hNnybXYa17vpfcaoF7uNG0Erkl9y8hzeAjh1fJ9wyhIwPOcy8rxR8Uu6 9G/MSQkGgzoae2R3zwDQuUDgAHU+gMbq0xgysClSq+hxeqhav14uEblCM EmgU7JPMp2KMxTAXFAru7HtZkS8ddbIzeVVG3/IxNtVmUakGPZfdIBE1E 2xAXaLfxJW3Vtkg244yISjPssju2DcwUeLKSBE08vdsiroMBTg0WtODpM A==; X-IronPort-AV: E=McAfee;i="6200,9189,10251"; a="248653442" X-IronPort-AV: E=Sophos;i="5.88,352,1635231600"; d="scan'208";a="248653442" Received: from orsmga008.jf.intel.com ([10.7.209.65]) by orsmga102.jf.intel.com with ESMTP/TLS/ECDHE-RSA-AES256-GCM-SHA384; 07 Feb 2022 23:09:50 -0800 X-ExtLoop1: 1 X-IronPort-AV: E=Sophos;i="5.88,352,1635231600"; d="scan'208";a="540474566" Received: from dpdk-jf-ntb-v1.sh.intel.com ([10.67.119.116]) by orsmga008.jf.intel.com with ESMTP; 07 Feb 2022 23:09:48 -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, junfeng.guo@intel.com Subject: [PATCH v3] net/ice: fix pattern check logic in FDIR Date: Tue, 8 Feb 2022 15:09:25 +0800 Message-Id: <20220208070925.2825528-1-junfeng.guo@intel.com> X-Mailer: git-send-email 2.25.1 In-Reply-To: <20220208043448.2654636-1-junfeng.guo@intel.com> References: <20220208043448.2654636-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 Mask for IPv4/UDP/TCP/SCTP addr/port are not supported in current code. Thus we need to check each pattern mask. Only zero-mask and full-mask are allowed to pass the pattern parse, otherwise will return failure. Fixes: 54be6102ef97 ("net/ice: fix pattern check for FDIR parser") Cc: stable@dpdk.org Signed-off-by: Junfeng Guo --- drivers/net/ice/ice_fdir_filter.c | 16 ++++++++-------- 1 file changed, 8 insertions(+), 8 deletions(-) diff --git a/drivers/net/ice/ice_fdir_filter.c b/drivers/net/ice/ice_fdir_filter.c index 287032a6a7..ff1cee1195 100644 --- a/drivers/net/ice/ice_fdir_filter.c +++ b/drivers/net/ice/ice_fdir_filter.c @@ -2038,10 +2038,10 @@ ice_fdir_parse_pattern(__rte_unused struct ice_adapter *ad, } /* Mask for IPv4 src/dst addrs not supported */ - if (!ipv4_mask->hdr.src_addr && + if (ipv4_mask->hdr.src_addr && ipv4_mask->hdr.src_addr != UINT32_MAX) return -rte_errno; - if (!ipv4_mask->hdr.dst_addr && + if (ipv4_mask->hdr.dst_addr && ipv4_mask->hdr.dst_addr != UINT32_MAX) return -rte_errno; @@ -2187,10 +2187,10 @@ ice_fdir_parse_pattern(__rte_unused struct ice_adapter *ad, } /* Mask for TCP src/dst ports not supported */ - if (!tcp_mask->hdr.src_port && + if (tcp_mask->hdr.src_port && tcp_mask->hdr.src_port != UINT16_MAX) return -rte_errno; - if (!tcp_mask->hdr.dst_port && + if (tcp_mask->hdr.dst_port && tcp_mask->hdr.dst_port != UINT16_MAX) return -rte_errno; @@ -2234,10 +2234,10 @@ ice_fdir_parse_pattern(__rte_unused struct ice_adapter *ad, } /* Mask for UDP src/dst ports not supported */ - if (!udp_mask->hdr.src_port && + if (udp_mask->hdr.src_port && udp_mask->hdr.src_port != UINT16_MAX) return -rte_errno; - if (!udp_mask->hdr.dst_port && + if (udp_mask->hdr.dst_port && udp_mask->hdr.dst_port != UINT16_MAX) return -rte_errno; @@ -2279,10 +2279,10 @@ ice_fdir_parse_pattern(__rte_unused struct ice_adapter *ad, } /* Mask for SCTP src/dst ports not supported */ - if (!sctp_mask->hdr.src_port && + if (sctp_mask->hdr.src_port && sctp_mask->hdr.src_port != UINT16_MAX) return -rte_errno; - if (!sctp_mask->hdr.dst_port && + if (sctp_mask->hdr.dst_port && sctp_mask->hdr.dst_port != UINT16_MAX) return -rte_errno; -- 2.25.1