Received: by 2002:a05:7412:bbc7:b0:fc:a2b0:25d7 with SMTP id kh7csp134199rdb; Thu, 1 Feb 2024 04:31:59 -0800 (PST) X-Google-Smtp-Source: AGHT+IFZxXT/rYfsQvoG0s0ns+V9GsAl1q7BYgIk0RfpRQvcc3EyfkP/PpAk3PGlK7HSVnMELty1 X-Received: by 2002:aa7:9851:0:b0:6db:afd4:f54c with SMTP id n17-20020aa79851000000b006dbafd4f54cmr4965810pfq.0.1706790719691; Thu, 01 Feb 2024 04:31:59 -0800 (PST) ARC-Seal: i=2; a=rsa-sha256; t=1706790719; cv=pass; d=google.com; s=arc-20160816; b=Yyp2ukSlsQOMjsvb0Z2i+xP/AkBQjyYIq3yeK1XQT4VUfrJaqT80wmBIu9IF05Yf0A ryYVQruFOFHl3cD9liEHwGxly7OWAAKHwy/FgINK6PBvxNWtexSjEcxcVz8THZhlC9UB 0gZKCr5NGnyL6iOcyQp1/RgV5OY5a5xCNMifwzPNSQVsFlLHXxMkPAmgEVo5JUbCwcTK mSJ41hAjShNeK6bB/4dBKb1prbAjKfzKK5sY/wmmSHK5xXGe0+qrPvOyyswZVHMQyCvk Vs/heo44nkpqeLYPv83D+Q+3GRuPnl/69AZaKyPNIHqbQTNCcyGgy7mGcxOeR/PwkwsU kADg== ARC-Message-Signature: i=2; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=content-transfer-encoding:mime-version:list-unsubscribe :list-subscribe:list-id:precedence:references:in-reply-to:message-id :date:subject:cc:to:from:dkim-signature; bh=pFjKjcppPTSc7/UnoKO2XZtjkk2vfRdvBQOIN3ODFXc=; fh=qHZKnWpDgxR2EKVVYNH0FGxkPC6yoRMWJr9Ok3KrG+Y=; b=mguPBQRgMxbNKALkUufNuTqRS/9uSpPmS08Ymo1vlvosUvBDF+lmHCZYPygykkr6mh hW8d3l3CCvGgWAv7hMVdW8lqb776ByZKPMYosz1W1UcCMZm08XUADlMGYsq/cW+MWRg5 pk4LbMYlXCW/9IRC/Yxb1b81TAYYF+SiKWTw57iDlDUZVRbC3IWewLkpzbVn2nLODZLZ aUnPuzhy2zV0vTGifMl4RTNq93Cb0gj4lQSx4tvP5Zd2hGKe7KepRuqTSCWRQnDnexrZ qDs9naEHJEhvP5X+r/Z1Zy+s5CE4Rt9lQM0JqmYDQjv0MIZF0AdD5uK1GtE9cK0dcSJl p9pQ==; dara=google.com ARC-Authentication-Results: i=2; mx.google.com; dkim=pass header.i=@intel.com header.s=Intel header.b=arg38sw4; arc=pass (i=1 spf=pass spfdomain=intel.com dkim=pass dkdomain=intel.com dmarc=pass fromdomain=intel.com); spf=pass (google.com: domain of linux-kernel+bounces-48132-linux.lists.archive=gmail.com@vger.kernel.org designates 139.178.88.99 as permitted sender) smtp.mailfrom="linux-kernel+bounces-48132-linux.lists.archive=gmail.com@vger.kernel.org"; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=intel.com X-Forwarded-Encrypted: i=1; AJvYcCXXZdZoGRoB5UTmZFKOlO6c8QEl+PZMhGSXQoTHWpA2uxS8+E0YHiUnMWW5wSsh9pcFDAwQqSEcmUp3HSqGdiwlfz9DRnestmMk0wmQYg== Return-Path: Received: from sv.mirrors.kernel.org (sv.mirrors.kernel.org. [139.178.88.99]) by mx.google.com with ESMTPS id f22-20020a056a000b1600b006dfbecd4271si4282356pfu.85.2024.02.01.04.31.59 for (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Thu, 01 Feb 2024 04:31:59 -0800 (PST) Received-SPF: pass (google.com: domain of linux-kernel+bounces-48132-linux.lists.archive=gmail.com@vger.kernel.org designates 139.178.88.99 as permitted sender) client-ip=139.178.88.99; Authentication-Results: mx.google.com; dkim=pass header.i=@intel.com header.s=Intel header.b=arg38sw4; arc=pass (i=1 spf=pass spfdomain=intel.com dkim=pass dkdomain=intel.com dmarc=pass fromdomain=intel.com); spf=pass (google.com: domain of linux-kernel+bounces-48132-linux.lists.archive=gmail.com@vger.kernel.org designates 139.178.88.99 as permitted sender) smtp.mailfrom="linux-kernel+bounces-48132-linux.lists.archive=gmail.com@vger.kernel.org"; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=intel.com Received: from smtp.subspace.kernel.org (wormhole.subspace.kernel.org [52.25.139.140]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by sv.mirrors.kernel.org (Postfix) with ESMTPS id 5ECE8297F69 for ; Thu, 1 Feb 2024 12:31:59 +0000 (UTC) Received: from localhost.localdomain (localhost.localdomain [127.0.0.1]) by smtp.subspace.kernel.org (Postfix) with ESMTP id BD4CA77A1F; Thu, 1 Feb 2024 12:25:28 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=intel.com header.i=@intel.com header.b="arg38sw4" Received: from mgamail.intel.com (mgamail.intel.com [198.175.65.15]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id 326E215F301; Thu, 1 Feb 2024 12:25:25 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=198.175.65.15 ARC-Seal:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1706790327; cv=none; b=OFLjX5TyCA96e6/h221gNpHVMZEDfs90Jpb9Gzn4yq5mneHBWNZDzDHvsag0Yf8xV4Oqt4+HX6E9r3jlSWhPg+NU3CYhMK1KjKAWV/QsZXqUtVlK0MqNkm+n5lY/yAx4Ny4VBuBwWwDwSobfw7peoXfEVLkNfy0rM/tPN1efSWw= ARC-Message-Signature:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1706790327; c=relaxed/simple; bh=Dd/X/a3E7PTQCMqLWky4djaC4x8rNov+S5OGSCD8Vtk=; h=From:To:Cc:Subject:Date:Message-ID:In-Reply-To:References: MIME-Version; b=KOq8w4Ve/h0HlTEYmNzdFY7B97llBhuup9Dbay9AF/nminMXUOnZbpjsWJRwPvbRD1mn24rHiTzAf2BSDlXhdDFiCvyxds9DJ6Qw1hv+VxJWXTwRZSeNZ6EvmKJNLq6rzsJ0oQtINoJJHlIH2L4bkwFLLEG0EmR71dLAOOwqqqU= ARC-Authentication-Results:i=1; smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=intel.com; spf=pass smtp.mailfrom=intel.com; dkim=pass (2048-bit key) header.d=intel.com header.i=@intel.com header.b=arg38sw4; arc=none smtp.client-ip=198.175.65.15 Authentication-Results: smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=intel.com Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=intel.com DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=intel.com; i=@intel.com; q=dns/txt; s=Intel; t=1706790327; x=1738326327; h=from:to:cc:subject:date:message-id:in-reply-to: references:mime-version:content-transfer-encoding; bh=Dd/X/a3E7PTQCMqLWky4djaC4x8rNov+S5OGSCD8Vtk=; b=arg38sw4XeSUk5qkVuLdo+kzBuah2lTP0abqA7jeEm+dut9ZwhfRoMFd vyj4W143DsBpE2lmTSnmJynHzQQLMS6jUyrEwH87SdVodZ6pOHh5ouzIJ SgtrTJcn8ZKU/x2B+IQzJLCNiR9nsCuJnyxZFryku706VofbZ6dol6QU/ dt1SFpYna1DEKp65OYfXvs3UVDz9ZKOziZ+ibsjzE5wAHjnDErrnM1Wt3 1ulwGntjBVZTeayW5yf9WH3HKDY6Ny7CGH8Z/J/ChFVQHO7PZwZDAjNgE 1pi+qQSKmwSBg22VoU9HZ1OAPE1U4q7z7bIn5MtNPnFJlQ6d180ywsgLY Q==; X-IronPort-AV: E=McAfee;i="6600,9927,10969"; a="3747314" X-IronPort-AV: E=Sophos;i="6.05,234,1701158400"; d="scan'208";a="3747314" Received: from orviesa004.jf.intel.com ([10.64.159.144]) by orvoesa107.jf.intel.com with ESMTP/TLS/ECDHE-RSA-AES256-GCM-SHA384; 01 Feb 2024 04:25:26 -0800 X-ExtLoop1: 1 X-IronPort-AV: E=Sophos;i="6.05,234,1701158400"; d="scan'208";a="4499234" Received: from newjersey.igk.intel.com ([10.102.20.203]) by orviesa004.jf.intel.com with ESMTP; 01 Feb 2024 04:25:12 -0800 From: Alexander Lobakin To: "David S. Miller" , Eric Dumazet , Jakub Kicinski , Paolo Abeni Cc: Alexander Lobakin , Michal Swiatkowski , Marcin Szycik , Wojciech Drewek , Yury Norov , Andy Shevchenko , Rasmus Villemoes , Alexander Potapenko , Jiri Pirko , Ido Schimmel , Przemek Kitszel , Simon Horman , linux-btrfs@vger.kernel.org, dm-devel@redhat.com, ntfs3@lists.linux.dev, linux-s390@vger.kernel.org, intel-wired-lan@lists.osuosl.org, netdev@vger.kernel.org, linux-kernel@vger.kernel.org, Simon Horman Subject: [PATCH net-next v5 20/21] ice: refactor ICE_TC_FLWR_FIELD_ENC_OPTS Date: Thu, 1 Feb 2024 13:22:15 +0100 Message-ID: <20240201122216.2634007-21-aleksander.lobakin@intel.com> X-Mailer: git-send-email 2.43.0 In-Reply-To: <20240201122216.2634007-1-aleksander.lobakin@intel.com> References: <20240201122216.2634007-1-aleksander.lobakin@intel.com> Precedence: bulk X-Mailing-List: linux-kernel@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 Content-Transfer-Encoding: 8bit From: Marcin Szycik FLOW_DISSECTOR_KEY_ENC_OPTS can be used for multiple headers, but currently it is treated as GTP-exclusive in ice. Rename ICE_TC_FLWR_FIELD_ENC_OPTS to ICE_TC_FLWR_FIELD_GTP_OPTS and check for tunnel type earlier. After this refactor, it is easier to add new headers using FLOW_DISSECTOR_KEY_ENC_OPTS - instead of checking tunnel type in ice_tc_count_lkups() and ice_tc_fill_tunnel_outer(), it needs to be checked only once, in ice_parse_tunnel_attr(). Signed-off-by: Marcin Szycik Reviewed-by: Simon Horman Signed-off-by: Alexander Lobakin --- drivers/net/ethernet/intel/ice/ice_tc_lib.h | 2 +- drivers/net/ethernet/intel/ice/ice_tc_lib.c | 10 +++++----- 2 files changed, 6 insertions(+), 6 deletions(-) diff --git a/drivers/net/ethernet/intel/ice/ice_tc_lib.h b/drivers/net/ethernet/intel/ice/ice_tc_lib.h index 65d387163a46..5d188ad7517a 100644 --- a/drivers/net/ethernet/intel/ice/ice_tc_lib.h +++ b/drivers/net/ethernet/intel/ice/ice_tc_lib.h @@ -22,7 +22,7 @@ #define ICE_TC_FLWR_FIELD_ENC_SRC_L4_PORT BIT(15) #define ICE_TC_FLWR_FIELD_ENC_DST_MAC BIT(16) #define ICE_TC_FLWR_FIELD_ETH_TYPE_ID BIT(17) -#define ICE_TC_FLWR_FIELD_ENC_OPTS BIT(18) +#define ICE_TC_FLWR_FIELD_GTP_OPTS BIT(18) #define ICE_TC_FLWR_FIELD_CVLAN BIT(19) #define ICE_TC_FLWR_FIELD_PPPOE_SESSID BIT(20) #define ICE_TC_FLWR_FIELD_PPP_PROTO BIT(21) diff --git a/drivers/net/ethernet/intel/ice/ice_tc_lib.c b/drivers/net/ethernet/intel/ice/ice_tc_lib.c index b890410a2bc0..80797db9f2b9 100644 --- a/drivers/net/ethernet/intel/ice/ice_tc_lib.c +++ b/drivers/net/ethernet/intel/ice/ice_tc_lib.c @@ -35,7 +35,7 @@ ice_tc_count_lkups(u32 flags, struct ice_tc_flower_lyr_2_4_hdrs *headers, if (flags & ICE_TC_FLWR_FIELD_ENC_DST_MAC) lkups_cnt++; - if (flags & ICE_TC_FLWR_FIELD_ENC_OPTS) + if (flags & ICE_TC_FLWR_FIELD_GTP_OPTS) lkups_cnt++; if (flags & (ICE_TC_FLWR_FIELD_ENC_SRC_IPV4 | @@ -219,8 +219,7 @@ ice_tc_fill_tunnel_outer(u32 flags, struct ice_tc_flower_fltr *fltr, i++; } - if (flags & ICE_TC_FLWR_FIELD_ENC_OPTS && - (fltr->tunnel_type == TNL_GTPU || fltr->tunnel_type == TNL_GTPC)) { + if (flags & ICE_TC_FLWR_FIELD_GTP_OPTS) { list[i].type = ice_proto_type_from_tunnel(fltr->tunnel_type); if (fltr->gtp_pdu_info_masks.pdu_type) { @@ -1401,7 +1400,8 @@ ice_parse_tunnel_attr(struct net_device *dev, struct flow_rule *rule, } } - if (flow_rule_match_key(rule, FLOW_DISSECTOR_KEY_ENC_OPTS)) { + if (flow_rule_match_key(rule, FLOW_DISSECTOR_KEY_ENC_OPTS) && + (fltr->tunnel_type == TNL_GTPU || fltr->tunnel_type == TNL_GTPC)) { struct flow_match_enc_opts match; flow_rule_match_enc_opts(rule, &match); @@ -1412,7 +1412,7 @@ ice_parse_tunnel_attr(struct net_device *dev, struct flow_rule *rule, memcpy(&fltr->gtp_pdu_info_masks, &match.mask->data[0], sizeof(struct gtp_pdu_session_info)); - fltr->flags |= ICE_TC_FLWR_FIELD_ENC_OPTS; + fltr->flags |= ICE_TC_FLWR_FIELD_GTP_OPTS; } return 0; -- 2.43.0