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 B76CE460E0; Wed, 22 Jan 2025 09:53:29 +0100 (CET) Received: from mails.dpdk.org (localhost [127.0.0.1]) by mails.dpdk.org (Postfix) with ESMTP id C345340395; Wed, 22 Jan 2025 09:53:21 +0100 (CET) Received: from mgamail.intel.com (mgamail.intel.com [198.175.65.21]) by mails.dpdk.org (Postfix) with ESMTP id 236E44060B for ; Wed, 22 Jan 2025 09:53:20 +0100 (CET) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=intel.com; i=@intel.com; q=dns/txt; s=Intel; t=1737536001; x=1769072001; h=from:to:cc:subject:date:message-id:in-reply-to: references:mime-version:content-transfer-encoding; bh=qXYPqvmkJah3pvOu/NE/LbCcmp+0VJvh5nXF0c8GpZQ=; b=Py4Pdp/Ff7t7tED2DoX4VXusPgK6t4MC8SxFVhZ9hgj9jS+MUv6tyusM wMr4mNe9Eyb9/0gdsizDkSV9DKKIndybIb9W9Kw+Bzfxw8dGuoJfDjKdX tZeQ2chTnZnm07C52DwCJnpbrx5zNs6RGDjwdio9q2b4pJpLUGaT2C2ho 1PRSsf4jegALj2ILnP4MaGkQK6Vi/uWTfGyxTgQaT6suHo/xGkZXkGJVX PWmat9/j7Qqg3SOB9AmuunNHcLYKGkUjp6bQGlO8NrcXMS7TSbYZibCOw TD0fGxA0tSUJxZICsYsQS73o6CMs1eL+ioZuAv4jlMeRp1+dmqwoxpTrf Q==; X-CSE-ConnectionGUID: 4hujTgCvS2OBxEjNf+QNNg== X-CSE-MsgGUID: 8d9rqwtPSaGL5cKmii/UMQ== X-IronPort-AV: E=McAfee;i="6700,10204,11322"; a="37865379" X-IronPort-AV: E=Sophos;i="6.13,224,1732608000"; d="scan'208";a="37865379" Received: from fmviesa004.fm.intel.com ([10.60.135.144]) by orvoesa113.jf.intel.com with ESMTP/TLS/ECDHE-RSA-AES256-GCM-SHA384; 22 Jan 2025 00:53:20 -0800 X-CSE-ConnectionGUID: IJkLlEKCTgCv3DnvAMoBnw== X-CSE-MsgGUID: 4db9vyZZRNmM9ejEjFhXhw== X-ExtLoop1: 1 X-IronPort-AV: E=Sophos;i="6.13,224,1732608000"; d="scan'208";a="112076331" Received: from unknown (HELO localhost.localdomain) ([10.239.252.253]) by fmviesa004-auth.fm.intel.com with ESMTP/TLS/ECDHE-RSA-AES256-GCM-SHA384; 22 Jan 2025 00:53:18 -0800 From: Mingjin Ye To: dev@dpdk.org Cc: Mingjin Ye , Bruce Richardson , Anatoly Burakov Subject: [PATCH 2/3] net/ice: FDIR support IPv4 fragment masks Date: Wed, 22 Jan 2025 08:23:09 +0000 Message-Id: <20250122082310.380054-3-mingjinx.ye@intel.com> X-Mailer: git-send-email 2.25.1 In-Reply-To: <20250122082310.380054-1-mingjinx.ye@intel.com> References: <20250122082310.380054-1-mingjinx.ye@intel.com> MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-BeenThere: dev@dpdk.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: DPDK patches and discussions List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: dev-bounces@dpdk.org This patch supports enabling masks for IPv4 fragments in FDIR. Flow rule can be created by the following command: flow create 0 ingress group 2 pattern eth / ipv4 fragment_offset spec 0x2000 fragment_offset mask 0x3FFF / end Signed-off-by: Mingjin Ye --- drivers/net/ice/ice_fdir_filter.c | 15 +++++++++++---- drivers/net/ice/ice_generic_flow.h | 2 ++ 2 files changed, 13 insertions(+), 4 deletions(-) diff --git a/drivers/net/ice/ice_fdir_filter.c b/drivers/net/ice/ice_fdir_filter.c index 406918fed5..247f55118a 100644 --- a/drivers/net/ice/ice_fdir_filter.c +++ b/drivers/net/ice/ice_fdir_filter.c @@ -24,7 +24,8 @@ #define ICE_FDIR_INSET_ETH_IPV4 (\ ICE_FDIR_INSET_ETH | \ ICE_INSET_IPV4_SRC | ICE_INSET_IPV4_DST | ICE_INSET_IPV4_TOS | \ - ICE_INSET_IPV4_TTL | ICE_INSET_IPV4_PROTO | ICE_INSET_IPV4_PKID) + ICE_INSET_IPV4_TTL | ICE_INSET_IPV4_PROTO | ICE_INSET_IPV4_PKID | \ + ICE_INSET_IPV4_OFFSET) #define ICE_FDIR_INSET_ETH_IPV4_UDP (\ ICE_FDIR_INSET_ETH_IPV4 | \ @@ -930,6 +931,7 @@ ice_fdir_input_set_parse(uint64_t inset, enum ice_flow_field *field) {ICE_INSET_IPV4_TTL, ICE_FLOW_FIELD_IDX_IPV4_TTL}, {ICE_INSET_IPV4_PROTO, ICE_FLOW_FIELD_IDX_IPV4_PROT}, {ICE_INSET_IPV4_PKID, ICE_FLOW_FIELD_IDX_IPV4_ID}, + {ICE_INSET_IPV4_OFFSET, ICE_FLOW_FIELD_IDX_IPV4_OFFSET}, {ICE_INSET_IPV6_SRC, ICE_FLOW_FIELD_IDX_IPV6_SA}, {ICE_INSET_IPV6_DST, ICE_FLOW_FIELD_IDX_IPV6_DA}, {ICE_INSET_IPV6_TC, ICE_FLOW_FIELD_IDX_IPV6_DSCP}, @@ -2022,7 +2024,8 @@ ice_fdir_parse_pattern(__rte_unused struct ice_adapter *ad, ipv4_last->hdr.next_proto_id || ipv4_last->hdr.hdr_checksum || ipv4_last->hdr.src_addr || - ipv4_last->hdr.dst_addr)) { + ipv4_last->hdr.dst_addr || + ipv4_last->hdr.fragment_offset)) { rte_flow_error_set(error, EINVAL, RTE_FLOW_ERROR_TYPE_ITEM, item, "Invalid IPv4 last."); @@ -2047,19 +2050,23 @@ ice_fdir_parse_pattern(__rte_unused struct ice_adapter *ad, *input_set |= ICE_INSET_IPV4_PROTO; if (ipv4_mask->hdr.type_of_service == UINT8_MAX) *input_set |= ICE_INSET_IPV4_TOS; + if ((ipv4_mask->hdr.fragment_offset & + rte_cpu_to_be_16(0x1FFF)) != 0) + *input_set |= ICE_INSET_IPV4_OFFSET; p_v4->dst_ip = ipv4_spec->hdr.dst_addr; p_v4->src_ip = ipv4_spec->hdr.src_addr; p_v4->ttl = ipv4_spec->hdr.time_to_live; p_v4->proto = ipv4_spec->hdr.next_proto_id; p_v4->tos = ipv4_spec->hdr.type_of_service; + p_v4->fragment_offset = ipv4_spec->hdr.fragment_offset; /* fragment Ipv4: * spec is 0x2000, mask is 0x2000 */ - if (ipv4_spec->hdr.fragment_offset == + if (ipv4_spec->hdr.fragment_offset & rte_cpu_to_be_16(RTE_IPV4_HDR_MF_FLAG) && - ipv4_mask->hdr.fragment_offset == + ipv4_mask->hdr.fragment_offset & rte_cpu_to_be_16(RTE_IPV4_HDR_MF_FLAG)) { /* all IPv4 fragment packet has the same * ethertype, if the spec and mask is valid, diff --git a/drivers/net/ice/ice_generic_flow.h b/drivers/net/ice/ice_generic_flow.h index 391d615b9a..509eb4b705 100644 --- a/drivers/net/ice/ice_generic_flow.h +++ b/drivers/net/ice/ice_generic_flow.h @@ -54,6 +54,7 @@ #define ICE_PFCP_SEID BIT_ULL(42) #define ICE_PFCP_S_FIELD BIT_ULL(41) #define ICE_IP_PK_ID BIT_ULL(40) +#define ICE_IP_OFFSET BIT_ULL(39) /* input set */ @@ -72,6 +73,7 @@ #define ICE_INSET_IPV4_PROTO (ICE_PROT_IPV4 | ICE_IP_PROTO) #define ICE_INSET_IPV4_TTL (ICE_PROT_IPV4 | ICE_IP_TTL) #define ICE_INSET_IPV4_PKID (ICE_PROT_IPV4 | ICE_IP_PK_ID) +#define ICE_INSET_IPV4_OFFSET (ICE_PROT_IPV4 | ICE_IP_OFFSET) #define ICE_INSET_IPV6_SRC (ICE_PROT_IPV6 | ICE_IP_SRC) #define ICE_INSET_IPV6_DST (ICE_PROT_IPV6 | ICE_IP_DST) #define ICE_INSET_IPV6_NEXT_HDR (ICE_PROT_IPV6 | ICE_IP_PROTO) -- 2.25.1