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 C9B494611C; Fri, 24 Jan 2025 10:44:57 +0100 (CET) Received: from mails.dpdk.org (localhost [127.0.0.1]) by mails.dpdk.org (Postfix) with ESMTP id C9E3940F35; Fri, 24 Jan 2025 10:44:49 +0100 (CET) Received: from mgamail.intel.com (mgamail.intel.com [198.175.65.18]) by mails.dpdk.org (Postfix) with ESMTP id DE16E40EDD for ; Fri, 24 Jan 2025 10:44:47 +0100 (CET) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=intel.com; i=@intel.com; q=dns/txt; s=Intel; t=1737711888; x=1769247888; h=from:to:cc:subject:date:message-id:in-reply-to: references:mime-version:content-transfer-encoding; bh=Eb0cnDl4V38YC3YuyKTv1LHD5WscuV7F+LslllHMK68=; b=JxsgDv05rapcdNxYJcZ1e8RoeMru9hzfdeZsEv8BrgXEJg9+yvIDCFbY ixXjN/u5sy5pdnk4NN2HFbTZ+CSUjIu5PdgXGxkarLHqlrDMaVVDB1lLt 2892mW54F1Ym8zoqYcUDlRBCUzyEHUyxXkWa5LknhuaktAFfEoehTvqXN 4kYWMdTEUQnQrvuMgcWvN5tcJsUdv+e9u976+wu/vTr5Y2GgNVGmzsFZ6 LPy43vZCXc82gnfR6tQmrwBRPs1N9Ixw8McoW7HPbU0R9JBdHX5rAsQ1b 0Ark35rqEtJHhgQUonnl9CAY8YiAp8OwzVISHwRw9AQbMh4IYEBBXKjed w==; X-CSE-ConnectionGUID: mgBG9zvKRYip/SdAIhqjOg== X-CSE-MsgGUID: BVCjNNSiTqGh5BUJKftF1A== X-IronPort-AV: E=McAfee;i="6700,10204,11314"; a="38341314" X-IronPort-AV: E=Sophos;i="6.12,310,1728975600"; d="scan'208";a="38341314" Received: from orviesa010.jf.intel.com ([10.64.159.150]) by orvoesa110.jf.intel.com with ESMTP/TLS/ECDHE-RSA-AES256-GCM-SHA384; 24 Jan 2025 01:44:48 -0800 X-CSE-ConnectionGUID: aNsbjvVMR8iUbr99rnwhzg== X-CSE-MsgGUID: rfmPBu31TCaXkjV5IfAocQ== X-ExtLoop1: 1 X-IronPort-AV: E=Sophos;i="6.12,224,1728975600"; d="scan'208";a="107568380" Received: from unknown (HELO localhost.localdomain) ([10.239.252.253]) by orviesa010-auth.jf.intel.com with ESMTP/TLS/ECDHE-RSA-AES256-GCM-SHA384; 24 Jan 2025 01:44:46 -0800 From: Mingjin Ye To: dev@dpdk.org Cc: Mingjin Ye , Bruce Richardson , Anatoly Burakov Subject: [PATCH v2 2/3] net/ice: FDIR support IPv4 fragment masks Date: Fri, 24 Jan 2025 09:13:22 +0000 Message-Id: <20250124091324.403435-3-mingjinx.ye@intel.com> X-Mailer: git-send-email 2.25.1 In-Reply-To: <20250124091324.403435-1-mingjinx.ye@intel.com> References: <20250122082310.380054-0-mingjinx.ye@intel.com> <20250124091324.403435-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..940fe171b6 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_FRAG_OFS) #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_FRAG_OFS, ICE_FLOW_FIELD_IDX_IPV4_FRAG_OFS}, {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_FRAG_OFS; 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..54bbb47398 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_FRAG_OFS 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_FRAG_OFS (ICE_PROT_IPV4 | ICE_IP_FRAG_OFS) #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