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 27306A04AD for ; Tue, 8 Feb 2022 05:35:15 +0100 (CET) Received: from [217.70.189.124] (localhost [127.0.0.1]) by mails.dpdk.org (Postfix) with ESMTP id 17AA240141; Tue, 8 Feb 2022 05:35:15 +0100 (CET) Received: from mga14.intel.com (mga14.intel.com [192.55.52.115]) by mails.dpdk.org (Postfix) with ESMTP id C1D5F40141; Tue, 8 Feb 2022 05:35:13 +0100 (CET) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=intel.com; i=@intel.com; q=dns/txt; s=Intel; t=1644294914; x=1675830914; h=from:to:cc:subject:date:message-id:in-reply-to: references:mime-version:content-transfer-encoding; bh=bjReauo7pbVl85ZZ5dITOfQL9qDUJ4e1ORNkmOJPtfo=; b=hM7QNm9e8mlvk2HCskc9VBs6hZOVU+vsxpCLDeAhhhxGKpQNwYLiNdli 6M7KAU/WyvppgI/DbUVbHqlKoRxj/ECDJ5HMmCq0dSkbNP5SEu3GE5DPR qtKw7THvLzxuhdlcK4/xgOt6rbWuiF4o6StiSqiaHJU10S41NuOa9rfOO o+fDEnHsx+E1OPmp7widOLHSdPF2PqMZaiJQGEX4EnZS6YpO72+DgcecE 87MsscaE15xhTDwtWebBNR9s2W8yMVYRWb26FE6dAt4RVlUjZOtKxdCRO 7Ls8wGKooZs2tcKCw4rLwHxLAP3sSZWNu1BKt7IvV35bKkAArv88lW8k0 g==; X-IronPort-AV: E=McAfee;i="6200,9189,10251"; a="249078029" X-IronPort-AV: E=Sophos;i="5.88,351,1635231600"; d="scan'208";a="249078029" Received: from fmsmga001.fm.intel.com ([10.253.24.23]) by fmsmga103.fm.intel.com with ESMTP/TLS/ECDHE-RSA-AES256-GCM-SHA384; 07 Feb 2022 20:35:12 -0800 X-ExtLoop1: 1 X-IronPort-AV: E=Sophos;i="5.88,351,1635231600"; d="scan'208";a="677986105" Received: from dpdk-jf-ntb-v1.sh.intel.com ([10.67.119.116]) by fmsmga001.fm.intel.com with ESMTP; 07 Feb 2022 20:35:11 -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 v2] net/ice: fix pattern check logic in FDIR Date: Tue, 8 Feb 2022 12:34:48 +0800 Message-Id: <20220208043448.2654636-1-junfeng.guo@intel.com> X-Mailer: git-send-email 2.25.1 In-Reply-To: <20220208042922.2644996-1-junfeng.guo@intel.com> References: <20220208042922.2644996-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 the pattern with non-zero spec value. If the spec is non-zero value but its mask is not full-mask, this Flow Director rule is not supported and will return failed. 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..9e4a0f158f 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_spec->hdr.src_addr && ipv4_mask->hdr.src_addr != UINT32_MAX) return -rte_errno; - if (!ipv4_mask->hdr.dst_addr && + if (ipv4_spec->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_spec->hdr.src_port && tcp_mask->hdr.src_port != UINT16_MAX) return -rte_errno; - if (!tcp_mask->hdr.dst_port && + if (tcp_spec->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_spec->hdr.src_port && udp_mask->hdr.src_port != UINT16_MAX) return -rte_errno; - if (!udp_mask->hdr.dst_port && + if (udp_spec->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_spec->hdr.src_port && sctp_mask->hdr.src_port != UINT16_MAX) return -rte_errno; - if (!sctp_mask->hdr.dst_port && + if (sctp_spec->hdr.dst_port && sctp_mask->hdr.dst_port != UINT16_MAX) return -rte_errno; -- 2.25.1