Article View: linux.kernel.netdev
Article #1204[PATCH net-next v2 04/14] ice: add helpers for Global RSS LUT alloc, free, vsi_update
From: Przemek Kitszel
Date: Fri, 09 Oct 2026 12:04
Date: Fri, 09 Oct 2026 12:04
180 lines
13706 bytes
13706 bytes
Add AQ commands for RSS Global LUT allocation and free operations.
The new functions are used by subsequent commits.
Add programming code for GLOBAL LUT ID of UPDATE VSI AQ,
do the same for RSS LUT "type", also for PF LUT in case of VF VSI.
Co-developed-by: Brett Creeley <brett.creeley@intel.com>
Signed-off-by: Brett Creeley <brett.creeley@intel.com>
Reviewed-by: Aleksandr Loktionov <aleksandr.loktionov@intel.com>
Signed-off-by: Przemek Kitszel <przemyslaw.kitszel@intel.com>
---
v2: fix whitespace (Sashiko)
---
drivers/net/ethernet/intel/ice/ice.h | 1 +
.../net/ethernet/intel/ice/ice_adminq_cmd.h | 1 +
drivers/net/ethernet/intel/ice/ice_switch.h | 2 +
drivers/net/ethernet/intel/ice/ice_lib.c | 28 +++++++++++--
drivers/net/ethernet/intel/ice/ice_switch.c | 41 +++++++++++++++++++
5 files changed, 69 insertions(+), 4 deletions(-)
diff --git a/drivers/net/ethernet/intel/ice/ice.h b/drivers/net/ethernet/intel/ice/ice.h
index 432da05c48c0..89a2bdbecf60 100644
--- a/drivers/net/ethernet/intel/ice/ice.h
+++ b/drivers/net/ethernet/intel/ice/ice.h
@@ -367,6 +367,7 @@ struct ice_vsi {
u8 *rss_hkey_user; /* User configured hash keys */
u8 *rss_lut_user; /* User configured lookup table entries */
u8 rss_lut_type; /* used to configure Get/Set RSS LUT AQ call */
+ u8 global_lut_id; /* valid when lut_type == GLOBAL_LUT */
/* aRFS members only allocated for the PF VSI */
#define ICE_MAX_ARFS_LIST 1024
diff --git a/drivers/net/ethernet/intel/ice/ice_adminq_cmd.h b/drivers/net/ethernet/intel/ice/ice_adminq_cmd.h
index 42878abac9eb..90c5587642d0 100644
--- a/drivers/net/ethernet/intel/ice/ice_adminq_cmd.h
+++ b/drivers/net/ethernet/intel/ice/ice_adminq_cmd.h
@@ -169,6 +169,7 @@ struct ice_aqc_set_port_params {
#define ICE_AQC_RES_TYPE_VSI_LIST_PRUNE 0x04
#define ICE_AQC_RES_TYPE_RECIPE 0x05
#define ICE_AQC_RES_TYPE_SWID 0x07
+#define ICE_AQC_RES_TYPE_GLOBAL_RSS_HASH 0x20
#define ICE_AQC_RES_TYPE_FDIR_COUNTER_BLOCK 0x21
#define ICE_AQC_RES_TYPE_FDIR_GUARANTEED_ENTRIES 0x22
#define ICE_AQC_RES_TYPE_FDIR_SHARED_ENTRIES 0x23
diff --git a/drivers/net/ethernet/intel/ice/ice_switch.h b/drivers/net/ethernet/intel/ice/ice_switch.h
index 671d7a5f359f..99b593b68bd0 100644
--- a/drivers/net/ethernet/intel/ice/ice_switch.h
+++ b/drivers/net/ethernet/intel/ice/ice_switch.h
@@ -387,6 +387,8 @@ ice_rem_adv_rule_by_id(struct ice_hw *hw,
struct ice_rule_query_data *remove_entry);
int ice_init_def_sw_recp(struct ice_hw *hw);
+int ice_alloc_rss_global_lut(struct ice_hw *hw, u16 *global_lut_id);
+int ice_free_rss_global_lut(struct ice_hw *hw, u16 global_lut_id);
u16 ice_get_hw_vsi_num(struct ice_hw *hw, u16 vsi_handle);
int ice_replay_vsi_all_fltr(struct ice_hw *hw, u16 vsi_handle);
diff --git a/drivers/net/ethernet/intel/ice/ice_lib.c b/drivers/net/ethernet/intel/ice/ice_lib.c
index 7cd2dd066ef5..8319956754b7 100644
--- a/drivers/net/ethernet/intel/ice/ice_lib.c
+++ b/drivers/net/ethernet/intel/ice/ice_lib.c
@@ -1247,30 +1247,46 @@ static void ice_set_fd_vsi_ctx(struct ice_vsi_ctx *ctxt, struct ice_vsi *vsi)
ctxt->info.fd_report_opt = cpu_to_le16(val);
}
+/* Translate @lut_type used in most of the places to the Admin Queue
+ * Q_OPT value for RSS.
+ * Used with VSI ADD and VSI UPDATE AQs (opcodes 0x0210, 0x0211).
+ */
+static u8 ice_lut_type_to_aq_qopt_rss_val(enum ice_lut_type lut_type)
+{
+ switch (lut_type) {
+ case ICE_LUT_PF:
+ return ICE_AQ_VSI_Q_OPT_RSS_LUT_PF;
+ case ICE_LUT_GLOBAL:
+ return ICE_AQ_VSI_Q_OPT_RSS_LUT_GBL;
+ case ICE_LUT_VSI:
+ default:
+ return ICE_AQ_VSI_Q_OPT_RSS_LUT_VSI;
+ }
+}
+
/**
* ice_set_rss_vsi_ctx - Set RSS VSI context before adding a VSI
* @ctxt: the VSI context being set
* @vsi: the VSI being configured
*/
static void ice_set_rss_vsi_ctx(struct ice_vsi_ctx *ctxt, struct ice_vsi *vsi)
{
u8 lut_type, hash_type;
+ u8 global_lut_id = 0;
struct device *dev;
struct ice_pf *pf;
pf = vsi->back;
dev = ice_pf_to_dev(pf);
switch (vsi->type) {
case ICE_VSI_CHNL:
- case ICE_VSI_PF:
- /* PF VSI will inherit RSS instance of PF */
lut_type = ICE_AQ_VSI_Q_OPT_RSS_LUT_PF;
break;
+ case ICE_VSI_PF:
case ICE_VSI_VF:
case ICE_VSI_SF:
- /* VF VSI will gets a small RSS table which is a VSI LUT type */
- lut_type = ICE_AQ_VSI_Q_OPT_RSS_LUT_VSI;
+ lut_type = ice_lut_type_to_aq_qopt_rss_val(vsi->rss_lut_type);
break;
default:
dev_dbg(dev, "Unsupported VSI type %s\n",
@@ -1281,8 +1297,12 @@ static void ice_set_rss_vsi_ctx(struct ice_vsi_ctx *ctxt, struct ice_vsi *vsi)
hash_type = ICE_AQ_VSI_Q_OPT_RSS_HASH_TPLZ;
vsi->rss_hfunc = hash_type;
+ if (vsi->rss_lut_type == ICE_LUT_GLOBAL)
+ global_lut_id = vsi->global_lut_id;
+
ctxt->info.q_opt_rss =
FIELD_PREP(ICE_AQ_VSI_Q_OPT_RSS_LUT_M, lut_type) |
+ FIELD_PREP(ICE_AQ_VSI_Q_OPT_RSS_GBL_LUT_M, global_lut_id) |
FIELD_PREP(ICE_AQ_VSI_Q_OPT_RSS_HASH_M, hash_type);
}
diff --git a/drivers/net/ethernet/intel/ice/ice_switch.c b/drivers/net/ethernet/intel/ice/ice_switch.c
index 4daee252e2a6..e6f08fe9b5c2 100644
--- a/drivers/net/ethernet/intel/ice/ice_switch.c
+++ b/drivers/net/ethernet/intel/ice/ice_switch.c
@@ -1527,6 +1527,47 @@ ice_aq_get_sw_cfg(struct ice_hw *hw, struct ice_aqc_get_sw_cfg_resp_elem *buf,
return status;
}
+/* Allocate a new Global LUT for the caller.
+ * LUT ID is returned via @global_lut_id.
+ */
+int ice_alloc_rss_global_lut(struct ice_hw *hw, u16 *global_lut_id)
+{
+ DEFINE_RAW_FLEX(struct ice_aqc_alloc_free_res_elem, buf, elem, 1);
+ u16 buf_len = __struct_size(buf);
+ int err;
+
+ buf->num_elems = cpu_to_le16(1);
+ buf->res_type = cpu_to_le16(ICE_AQC_RES_TYPE_GLOBAL_RSS_HASH);
+
+ err = ice_aq_alloc_free_res(hw, buf, buf_len, ice_aqc_opc_alloc_res);
+ if (err)
+ ice_debug(hw, ICE_DBG_RES, "Failed to allocate RSS global LUT, err %d\n",
+ err);
+ else
+ *global_lut_id = le16_to_cpu(buf->elem[0].e.sw_resp);
+
+ return err;
+}
+
+/* Free Global LUT at @global_lut_id. */
+int ice_free_rss_global_lut(struct ice_hw *hw, u16 global_lut_id)
+{
+ DEFINE_RAW_FLEX(struct ice_aqc_alloc_free_res_elem, buf, elem, 1);
+ u16 buf_len = __struct_size(buf);
+ int err;
+
+ buf->num_elems = cpu_to_le16(1);
+ buf->res_type = cpu_to_le16(ICE_AQC_RES_TYPE_GLOBAL_RSS_HASH);
+ buf->elem[0].e.sw_resp = cpu_to_le16(global_lut_id);
+
+ err = ice_aq_alloc_free_res(hw, buf, buf_len, ice_aqc_opc_free_res);
+ if (err)
+ ice_debug(hw, ICE_DBG_RES, "Failed to free RSS global LUT %d, err %d\n",
+ global_lut_id, err);
+
+ return err;
+}
+
/**
* ice_aq_add_vsi
* @hw: pointer to the HW struct
--
2.51.1
Technical Details
Message-ID:
<20261009121433.30347-5-przemyslaw.kitszel@intel.com>Path:
mbox-mo1.pugleaf.net!archive.usenet.blueworldhosting.com!usenet.blueworldhosting.com!diablo1.usenet.blueworldhosting.com!usenet.network!.POSTED!vger.kernel.org!netdev+bounces-343627-linux-kernel-netdev=dewy.ruReferences:
<20261009121433.30347-1-przemyslaw.kitszel@intel.com>Show Full Headers
Complete Article Headers
Path: mbox-mo1.pugleaf.net!archive.usenet.blueworldhosting.com!usenet.blueworldhosting.com!diablo1.usenet.blueworldhosting.com!usenet.network!.POSTED!vger.kernel.org!netdev+bounces-343627-linux-kernel-netdev=dewy.ru From: przemyslaw.kitszel@intel.com (Przemek Kitszel) Newsgroups: linux.kernel.netdev Subject: [PATCH net-next v2 04/14] ice: add helpers for Global RSS LUT alloc, free, vsi_update Date: Fri, 9 Oct 2026 14:04:15 +0200 Organization: Usenet Network Message-ID: <20261009121433.30347-5-przemyslaw.kitszel@intel.com> References: <20261009121433.30347-1-przemyslaw.kitszel@intel.com> MIME-Version: 1.0 Content-Transfer-Encoding: 8bit Injection-Info: usenet.network; logging-data="1099432"; mail-complaints-to="abuse@usenet.network" Cancel-Lock: sha1:5YfsdAzA0ZBX2OurXzdv0MXMzf4= sha256:exDcFx1hWyja2VqWkqi7EZ3OZiia/5q/hsNmBmqIW/E= sha1:K857gHu8l2ldJOxoM9ukucuH4rQ= sha256:MXSkl7iTfQh2d8yYjsdsU+TL/7Ys07UfAalKsosJOGU= List-ID: <netdev.vger.kernel.org> X-Mailpost-Empty-Hdrs: X-Spam-Level X-Received: from localhost (localhost [127.0.0.1]) by mail.dewy.ru (Postfix) with ESMTP id 226D910F672; Fri, 9 Oct 2026 15:16:28 +0300 (MSK) X-Virus-Scanned: Debian amavisd-new at usenet.network X-Spam-Flag: NO X-Spam-Score: -1.092 X-Spam-Status: No, score=-1.092 tagged_above=-9999 required=6.31 tests=[DKIMWL_WL_HIGH=-0.241, DKIM_SIGNED=0.1, DKIM_VALID=-0.1, DKIM_VALID_AU=-0.1, HEADER_FROM_DIFFERENT_DOMAINS=0.249, MAILING_LIST_MULTI=-1, SPF_HELO_NONE=0.001, SPF_PASS=-0.001] autolearn=ham autolearn_force=no X-Authentication-Results: mail.dewy.ru (amavisd-new); dkim=pass (2048-bit key) header.d=intel.com X-Received: from mail.dewy.ru ([127.0.0.1]) by localhost (mail.dewy.ru [127.0.0.1]) (amavisd-new, port 10024) with ESMTP id d5uMChcBY6WP; Fri, 9 Oct 2026 15:16:24 +0300 (MSK) X-Received-SPF: Pass (mailfrom) identity=mailfrom; client-ip=172.232.135.74; helo=sto.lore.kernel.org; envelope-from=netdev+bounces-343627-linux-kernel-netdev=dewy.ru@vger.kernel.org; receiver=<UNKNOWN> X-Authentication-Results: OpenDMARC; dmarc=fail (p=none dis=none) header.from=intel.com X-Received: from sto.lore.kernel.org (sto.lore.kernel.org [172.232.135.74]) by mail.dewy.ru (Postfix) with ESMTPS id AB14510E9C2; Fri, 9 Oct 2026 15:16:19 +0300 (MSK) X-Received: from smtp.subspace.kernel.org (conduit.subspace.kernel.org [100.90.174.1]) by sto.lore.kernel.org (Postfix) with ESMTP id F0F2C602B0B; Fri, 9 Oct 2026 12:15:28 +0000 (UTC) X-Received: from localhost.localdomain (localhost.localdomain [127.0.0.1]) by smtp.subspace.kernel.org (Postfix) with ESMTP id 41F4B4418E4; Fri, 9 Oct 2026 12:15:19 +0000 (UTC) X-Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=intel.com header.i=@intel.com header.b="Nh0FjFjp" X-Received: from mgamail.intel.com (mgamail.intel.com [192.198.163.10]) (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 6353E4D37B9 for <netdev@vger.kernel.org>; Fri, 9 Oct 2026 12:15:06 +0000 (UTC) X-Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=192.198.163.10 X-ARC-Seal: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1791548118; cv=none; b=C8IETZwiAoiztuTpL6SE/PjF75F0IPO+2js5MegJcxmakv6KBBdkzAyCOh4t97+FzcsirGz7Mdb2nfNTwlB/w/imXV+V/YR3e26U/R+AoyivdjwRgVqqklN08wxGBHJGlH0kLjk2pd0PK6fh/J/hTUqSjOYdDc0n3S2AZHvXyFk= X-ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1791548118; c=relaxed/simple; bh=3EoZw3SqKXPj6on6zJs8Qp+OWr6VM6QEbjKLmyEw17M=; h=From:To:Cc:Subject:Date:Message-ID:In-Reply-To:References: MIME-Version; b=Ni8n2hTyt+xy574gQBRaRy5I9h/0terjIrERRyBacWktO3u6tCW8W9oz71GhKF67FC8Fbv6zomtilrdWJtoeJUf69d+KDFeQ86tUddPATWlUPPzGP+2g4GupiDfF9csx90Cwzt1ns4UxOPMtdm4ekxPyUL+MY1bQQz/feThvjIs= X-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=Nh0FjFjp; arc=none smtp.client-ip=192.198.163.10 X-Authentication-Results: smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=intel.com X-Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=intel.com X-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=intel.com; i=@intel.com; q=dns/txt; s=Intel; t=1791548106; x=1823084106; h=from:to:cc:subject:date:message-id:in-reply-to: references:mime-version:content-transfer-encoding; bh=3EoZw3SqKXPj6on6zJs8Qp+OWr6VM6QEbjKLmyEw17M=; b=Nh0FjFjpDsIgRZi+PxutpsaQFuxnNTqRmnH+cRow1IAeJ5TMkYXQI1N8 kEaUDEpORtmMBt9ZwIoqlbPSGTloyekE0ymTXmzNvxGJys27+V/7Mb4U3 SIxWipz2m388FhWQy0bBY/B4aQVBZP+YqPT7tYtBEVNPDstfqnWoDjgO9 C5azJOXjQCEwKY2PohniTapBsHUuCiGrqUoGn1aFQAw9jggdTfDGkZ7GT uWqCA5YPThwM/7Kl8q/Q9nortx2svodrukaMLDn5ZKTs/+99IrYTSoktf MVnhWzeBci68R6uy2LMMyNSf1c/7w9kxFQv/xCBIspnlOv5bS4b03SaUX Q==; X-CSE-ConnectionGUID: 6gm9T3/zR9yrlAmr7CHlTw== X-CSE-MsgGUID: QmyHCIXbSVukas6T2wFUSg== X-IronPort-AV: E=McAfee;i="6800,10657,11929"; a="251127" X-IronPort-AV: E=Sophos;i="6.27,148,1787036400"; d="scan'208";a="251127" X-Received: from fmviesa002.fm.intel.com ([10.60.135.142]) by fmvoesa104.fm.intel.com with ESMTP/TLS/ECDHE-RSA-AES256-GCM-SHA384; 09 Oct 2026 05:14:55 -0700 X-CSE-ConnectionGUID: zcpYXfJCR4GlWj3YxfIZXg== X-CSE-MsgGUID: DdQeSYKiTLmmpLgLHm9CIQ== X-ExtLoop1: 1 X-IronPort-AV: E=Sophos;i="6.27,148,1787036400"; d="scan'208";a="420406" X-Received: from irvmail002.ir.intel.com ([10.43.11.120]) by fmviesa002.fm.intel.com with ESMTP; 09 Oct 2026 05:14:51 -0700 X-Received: from pkitszel-desk.tendawifi.com (unknown [10.245.245.238]) by irvmail002.ir.intel.com (Postfix) with ESMTP id 6E25A2FC44; Fri, 9 Oct 2026 13:14:46 +0100 (IST) X-Cc: Tony Nguyen <anthony.l.nguyen@intel.com>, Aleksandr Loktionov <aleksandr.loktionov@intel.com>, Michal Schmidt <mschmidt@redhat.com>, intel-wired-lan@lists.osuosl.org, edumazet@kernel.org, horms@kernel.org, pabeni@redhat.com, davem@davemloft.net, Jonathan Corbet <corbet@lwn.net>, skhan@linuxfoundation.org, rdunlap@infradead.org, andrew+netdev@lunn.ch, saeedm@nvidia.com, tariqt@nvidia.com, leon@kernel.org, mbloch@nvidia.com, jacob.e.keller@intel.com, jedrzej.jagielski@intel.com, anzaki@gmail.com, brett.creeley@amd.com, jtornosm@redhat.com, ohartoov@nvidia.com, Przemek Kitszel <przemyslaw.kitszel@intel.com> X-Mailer: git-send-email 2.51.1 X-In-Reply-To: <20261009121433.30347-1-przemyslaw.kitszel@intel.com> X-Precedence: bulk X-Mailing-List: netdev@vger.kernel.org X-List-Subscribe: <mailto:netdev+subscribe@vger.kernel.org> X-List-Unsubscribe: <mailto:netdev+unsubscribe@vger.kernel.org>