{"id":2235035,"url":"http://patchwork.ozlabs.org/api/1.2/patches/2235035/?format=json","web_url":"http://patchwork.ozlabs.org/project/intel-wired-lan/patch/20260508124208.11622-15-przemyslaw.kitszel@intel.com/","project":{"id":46,"url":"http://patchwork.ozlabs.org/api/1.2/projects/46/?format=json","name":"Intel Wired Ethernet development","link_name":"intel-wired-lan","list_id":"intel-wired-lan.osuosl.org","list_email":"intel-wired-lan@osuosl.org","web_url":"","scm_url":"","webscm_url":"","list_archive_url":"","list_archive_url_format":"","commit_url_format":""},"msgid":"<20260508124208.11622-15-przemyslaw.kitszel@intel.com>","list_archive_url":null,"date":"2026-05-08T12:42:07","name":"[iwl-next,v1,14/15] ice: represent RSS LUTs as devlink resources","commit_ref":null,"pull_url":null,"state":"new","archived":false,"hash":"3b83cb2beb68192b799c5a352375f0c91bfab2e7","submitter":{"id":85252,"url":"http://patchwork.ozlabs.org/api/1.2/people/85252/?format=json","name":"Przemek Kitszel","email":"przemyslaw.kitszel@intel.com"},"delegate":null,"mbox":"http://patchwork.ozlabs.org/project/intel-wired-lan/patch/20260508124208.11622-15-przemyslaw.kitszel@intel.com/mbox/","series":[{"id":503388,"url":"http://patchwork.ozlabs.org/api/1.2/series/503388/?format=json","web_url":"http://patchwork.ozlabs.org/project/intel-wired-lan/list/?series=503388","date":"2026-05-08T12:41:53","name":"devlink, mlx5, iavf, ice: XLVF for iavf","version":1,"mbox":"http://patchwork.ozlabs.org/series/503388/mbox/"}],"comments":"http://patchwork.ozlabs.org/api/patches/2235035/comments/","check":"pending","checks":"http://patchwork.ozlabs.org/api/patches/2235035/checks/","tags":{},"related":[],"headers":{"Return-Path":"<intel-wired-lan-bounces@osuosl.org>","X-Original-To":["incoming@patchwork.ozlabs.org","intel-wired-lan@lists.osuosl.org"],"Delivered-To":["patchwork-incoming@legolas.ozlabs.org","intel-wired-lan@lists.osuosl.org"],"Authentication-Results":["legolas.ozlabs.org;\n\tdkim=pass (2048-bit key;\n unprotected) header.d=osuosl.org header.i=@osuosl.org header.a=rsa-sha256\n header.s=default header.b=rJQoIRae;\n\tdkim-atps=neutral","legolas.ozlabs.org;\n spf=pass (sender SPF authorized) smtp.mailfrom=osuosl.org\n (client-ip=2605:bc80:3010::137; helo=smtp4.osuosl.org;\n envelope-from=intel-wired-lan-bounces@osuosl.org;\n receiver=patchwork.ozlabs.org)"],"Received":["from smtp4.osuosl.org (smtp4.osuosl.org [IPv6:2605:bc80:3010::137])\n\t(using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits)\n\t key-exchange x25519 server-signature ECDSA (secp384r1) server-digest SHA384)\n\t(No client certificate requested)\n\tby legolas.ozlabs.org (Postfix) with ESMTPS id 4gBq3M2RZxz1yJq\n\tfor <incoming@patchwork.ozlabs.org>; Fri, 08 May 2026 23:00:15 +1000 (AEST)","from localhost (localhost [127.0.0.1])\n\tby smtp4.osuosl.org (Postfix) with ESMTP id BA0D5410AA;\n\tFri,  8 May 2026 13:00:12 +0000 (UTC)","from smtp4.osuosl.org ([127.0.0.1])\n by localhost (smtp4.osuosl.org [127.0.0.1]) (amavis, port 10024) with ESMTP\n id 936x9Uo9Bd9u; Fri,  8 May 2026 13:00:11 +0000 (UTC)","from lists1.osuosl.org (lists1.osuosl.org [140.211.166.142])\n\tby smtp4.osuosl.org (Postfix) with ESMTP id 88D4E4121E;\n\tFri,  8 May 2026 13:00:10 +0000 (UTC)","from smtp4.osuosl.org (smtp4.osuosl.org [140.211.166.137])\n by lists1.osuosl.org (Postfix) with ESMTP id 169A3358\n for <intel-wired-lan@lists.osuosl.org>; Fri,  8 May 2026 13:00:09 +0000 (UTC)","from localhost (localhost [127.0.0.1])\n by smtp4.osuosl.org (Postfix) with ESMTP id E063740F74\n for <intel-wired-lan@lists.osuosl.org>; Fri,  8 May 2026 13:00:08 +0000 (UTC)","from smtp4.osuosl.org ([127.0.0.1])\n by localhost (smtp4.osuosl.org [127.0.0.1]) (amavis, port 10024) with ESMTP\n id YJYmm-CdjDCM for <intel-wired-lan@lists.osuosl.org>;\n Fri,  8 May 2026 13:00:06 +0000 (UTC)","from mgamail.intel.com (mgamail.intel.com [198.175.65.17])\n by smtp4.osuosl.org (Postfix) with ESMTPS id 0EBD940FAC\n for <intel-wired-lan@lists.osuosl.org>; Fri,  8 May 2026 13:00:06 +0000 (UTC)","from fmviesa005.fm.intel.com ([10.60.135.145])\n by orvoesa109.jf.intel.com with ESMTP/TLS/ECDHE-RSA-AES256-GCM-SHA384;\n 08 May 2026 06:00:06 -0700","from irvmail002.ir.intel.com ([10.43.11.120])\n by fmviesa005.fm.intel.com with ESMTP; 08 May 2026 05:59:59 -0700","from vecna.igk.intel.com (vecna.igk.intel.com [10.123.220.17])\n by irvmail002.ir.intel.com (Postfix) with ESMTP id 2E0F22FC40;\n Fri,  8 May 2026 13:59:57 +0100 (IST)"],"X-Virus-Scanned":["amavis at osuosl.org","amavis at osuosl.org"],"X-Comment":"SPF check N/A for local connections - client-ip=140.211.166.142;\n helo=lists1.osuosl.org; envelope-from=intel-wired-lan-bounces@osuosl.org;\n receiver=<UNKNOWN> ","DKIM-Filter":["OpenDKIM Filter v2.11.0 smtp4.osuosl.org 88D4E4121E","OpenDKIM Filter v2.11.0 smtp4.osuosl.org 0EBD940FAC"],"DKIM-Signature":"v=1; a=rsa-sha256; c=relaxed/relaxed; d=osuosl.org;\n\ts=default; t=1778245210;\n\tbh=k3bJei3YyZblhsB7sX+fjXn8O5htMfP+g3nEnaHLhp0=;\n\th=From:To:Cc:Date:In-Reply-To:References:Subject:List-Id:\n\t List-Unsubscribe:List-Archive:List-Post:List-Help:List-Subscribe:\n\t From;\n\tb=rJQoIRaed774NI74RQ7UCk0HWQGGpS6Om/AS2ViPPZZ9RuWwnkYLHddH7lqf5mkic\n\t HmKGXzljxx3IV02oDmsehdPaXwtgmYa5NB8M0RjVN10+ZGFYrkgDb4XQZMYTtO7Udd\n\t UCGOuSxHPsq6i11bJ+JpYThtXJYucf0aA7AS6u0gUmGsSCOQBpKoQwqxH8Kud2w5Hp\n\t GLR0L7Ld2bY9UP2GFvYhpYq+MK2hYVE4KuonMqF+iLh2KL7jc1KnlQhkySSlfu7L6h\n\t 8GN0InlFVRUF/m6kbNo+aqk/116fs8Hpd4kKWUf8u4v+KxzUfDS0J7SQREO0WPJUfm\n\t NPJgZi0opmjyQ==","Received-SPF":"Pass (mailfrom) identity=mailfrom; client-ip=198.175.65.17;\n helo=mgamail.intel.com; envelope-from=przemyslaw.kitszel@intel.com;\n receiver=<UNKNOWN>","DMARC-Filter":"OpenDMARC Filter v1.4.2 smtp4.osuosl.org 0EBD940FAC","X-CSE-ConnectionGUID":["ReyqDxhwR9OeT0ictUFvcA==","+X98ZoFgR8mNLHXVbs+/eg=="],"X-CSE-MsgGUID":["/U4JGSYXRzC5gArG9Mo+Tg==","/7DlEC4wQneWNmGm5XlXhw=="],"X-IronPort-AV":["E=McAfee;i=\"6800,10657,11779\"; a=\"79200003\"","E=Sophos;i=\"6.23,223,1770624000\"; d=\"scan'208\";a=\"79200003\"","E=Sophos;i=\"6.23,223,1770624000\"; d=\"scan'208\";a=\"241730289\""],"X-ExtLoop1":"1","From":"Przemek Kitszel <przemyslaw.kitszel@intel.com>","To":"intel-wired-lan@lists.osuosl.org, Michal Schmidt <mschmidt@redhat.com>,\n Jakub Kicinski <kuba@kernel.org>, Jiri Pirko <jiri@resnulli.us>","Cc":"netdev@vger.kernel.org, Simon Horman <horms@kernel.org>,\n Tony Nguyen <anthony.l.nguyen@intel.com>,\n Michal Swiatkowski <michal.swiatkowski@linux.intel.com>,\n bruce.richardson@intel.com,\n Vladimir Medvedkin <vladimir.medvedkin@intel.com>,\n padraig.j.connolly@intel.com, ananth.s@intel.com,\n timothy.miskell@intel.com, Jacob Keller <jacob.e.keller@intel.com>,\n Lukasz Czapnik <lukasz.czapnik@intel.com>,\n Aleksandr Loktionov <aleksandr.loktionov@intel.com>,\n Andrew Lunn <andrew+netdev@lunn.ch>,\n \"David S. Miller\" <davem@davemloft.net>,\n Eric Dumazet <edumazet@google.com>, Paolo Abeni <pabeni@redhat.com>,\n Saeed Mahameed <saeedm@nvidia.com>, Leon Romanovsky <leon@kernel.org>,\n Tariq Toukan <tariqt@nvidia.com>, Mark Bloch <mbloch@nvidia.com>,\n Przemek Kitszel <przemyslaw.kitszel@intel.com>","Date":"Fri,  8 May 2026 14:42:07 +0200","Message-Id":"<20260508124208.11622-15-przemyslaw.kitszel@intel.com>","X-Mailer":"git-send-email 2.39.3","In-Reply-To":"<20260508124208.11622-1-przemyslaw.kitszel@intel.com>","References":"<20260508124208.11622-1-przemyslaw.kitszel@intel.com>","MIME-Version":"1.0","Content-Transfer-Encoding":"8bit","X-Mailman-Original-DKIM-Signature":"v=1; a=rsa-sha256; c=relaxed/simple;\n d=intel.com; i=@intel.com; q=dns/txt; s=Intel;\n t=1778245207; x=1809781207;\n h=from:to:cc:subject:date:message-id:in-reply-to:\n references:mime-version:content-transfer-encoding;\n bh=MGdbzFFwU6U1zqIT3tFYSxP97PQFNS4VRYoi03Dd5Dc=;\n b=UINN9VuaD3KWKxj4EPpFLyyOttu1Iv1mQav37Nq/w8BmEFcD27YDT0i/\n OT2/qFvAoGA+fMQdsdD8QsNZkktPvuwx16Y5OJkCEVtPVem48tmgMv59O\n QjqPiJy/4MFdJ0qiLO614SLUGHI7cU0O464biDBVfUlZgc+k2yHk0XX+R\n h6Ek/WMzcRAb03zRpDjMyaP+dzd2hlsHZ2W+3ai957n4E0l+EIfCh5pdN\n U2mNY/uCpmrYVetk8kdeeWTwWzxK+58uJxG9H/CFtPOItq0xzNYWWEBg5\n BXmWr6d/BgUHHr9zaTG72wem5ztd8rDtzS2yKD3pYzcc9lvd31T2EVoau\n w==;","X-Mailman-Original-Authentication-Results":["smtp4.osuosl.org;\n dmarc=pass (p=none dis=none)\n header.from=intel.com","smtp4.osuosl.org;\n dkim=pass (2048-bit key) header.d=intel.com header.i=@intel.com\n header.a=rsa-sha256 header.s=Intel header.b=UINN9Vua"],"Subject":"[Intel-wired-lan] [PATCH iwl-next v1 14/15] ice: represent RSS LUTs\n as devlink resources","X-BeenThere":"intel-wired-lan@osuosl.org","X-Mailman-Version":"2.1.30","Precedence":"list","List-Id":"Intel Wired Ethernet Linux Kernel Driver Development\n <intel-wired-lan.osuosl.org>","List-Unsubscribe":"<https://lists.osuosl.org/mailman/options/intel-wired-lan>,\n <mailto:intel-wired-lan-request@osuosl.org?subject=unsubscribe>","List-Archive":"<http://lists.osuosl.org/pipermail/intel-wired-lan/>","List-Post":"<mailto:intel-wired-lan@osuosl.org>","List-Help":"<mailto:intel-wired-lan-request@osuosl.org?subject=help>","List-Subscribe":"<https://lists.osuosl.org/mailman/listinfo/intel-wired-lan>,\n <mailto:intel-wired-lan-request@osuosl.org?subject=subscribe>","Errors-To":"intel-wired-lan-bounces@osuosl.org","Sender":"\"Intel-wired-lan\" <intel-wired-lan-bounces@osuosl.org>"},"content":"E800 family offers three kinds of RSS LUTs: VSI LUT (sized 64), GLOBAL LUT\n(sized 256), and PF LUT (sized 2048). Until now the GLOBAL kind was not\nused at all. There are two possible usages for it, subsequent commit will\ngive VF option to acquire it, and this one enables PF to switch between PF\nLUT and GLOBAL LUT - switching to smaller one is, again, to make it\npossible for VF to then acquire the former one.\n\nDevlink resources are used to let user show current usage and change the\nallocation, see examples below.\n\nDefault state on 8-port card, asking for aggregate \"whole device\" usage,\nnote that there are as many PF LUTs as there is PFs, and, for e810, there\nare 16 GLOBAL LUTs:\n$ devlink resource show devlink_index/11\ndevlink_index/11:\n  name rss size 8 unit entry size_min 0 size_max 24 size_gran 1 dpipe_tables none\n    resources:\n      name lut_512 size 0 unit entry size_min 0 size_max 16 size_gran 1 dpipe_tables none\n      name lut_2048 size 8 unit entry size_min 0 size_max 8 size_gran 1 dpipe_tables none\n\nNow let's add GLOBAL LUT for a single PF (on one-port NIC):\n$ sudo devlink resource set pci/0000:18:00.0 path rss/lut_512 size 1\nAnd show it's resources after that:\n$ devlink resource show pci/0000:18:00.0\npci/0000:18:00.0:\n  name rss size 2 unit entry size_min 0 size_max 2 size_gran 1 dpipe_tables none\n    resources:\n      name lut_512 size 1 unit entry size_min 0 size_max 1 size_gran 1 dpipe_tables none\n      name lut_2048 size 1 unit entry size_min 0 size_max 1 size_gran 1 dpipe_tables none\nLet's take the PF LUT out of that PF afterwards:\n$ sudo devlink resource set pci/0000:18:00.0 path rss/lut_2048 size 0\nnow `ethtool -x $ifacename` will report smaller RSS table.\n\nSigned-off-by: Przemek Kitszel <przemyslaw.kitszel@intel.com>\n---\n drivers/net/ethernet/intel/ice/Makefile       |   1 +\n .../net/ethernet/intel/ice/devlink/resource.h |  19 +\n drivers/net/ethernet/intel/ice/ice_adapter.h  |  40 ++\n drivers/net/ethernet/intel/ice/ice_common.h   |   1 +\n .../net/ethernet/intel/ice/devlink/resource.c | 469 ++++++++++++++++++\n drivers/net/ethernet/intel/ice/ice_adapter.c  |  12 +-\n drivers/net/ethernet/intel/ice/ice_common.c   |   2 +-\n drivers/net/ethernet/intel/ice/ice_lib.c      |  23 +-\n drivers/net/ethernet/intel/ice/ice_main.c     |  14 +-\n 9 files changed, 573 insertions(+), 8 deletions(-)\n create mode 100644 drivers/net/ethernet/intel/ice/devlink/resource.h\n create mode 100644 drivers/net/ethernet/intel/ice/devlink/resource.c","diff":"diff --git a/drivers/net/ethernet/intel/ice/Makefile b/drivers/net/ethernet/intel/ice/Makefile\nindex 7f06d9bafe4a..0217ab6403de 100644\n--- a/drivers/net/ethernet/intel/ice/Makefile\n+++ b/drivers/net/ethernet/intel/ice/Makefile\n@@ -37,6 +37,7 @@ ice-y := ice_main.o\t\\\n \t devlink/devlink.o\t\\\n \t devlink/health.o \\\n \t devlink/port.o \\\n+\t devlink/resource.o \\\n \t ice_sf_eth.o\t\\\n \t ice_sf_vsi_vlan_ops.o \\\n \t ice_ddp.o\t\\\ndiff --git a/drivers/net/ethernet/intel/ice/devlink/resource.h b/drivers/net/ethernet/intel/ice/devlink/resource.h\nnew file mode 100644\nindex 000000000000..947f77a3cd49\n--- /dev/null\n+++ b/drivers/net/ethernet/intel/ice/devlink/resource.h\n@@ -0,0 +1,19 @@\n+/* SPDX-License-Identifier: GPL-2.0 */\n+/* Copyright (c) 2026, Intel Corporation. */\n+\n+#ifndef _ICE_DEVL_RESOURCE_H_\n+#define _ICE_DEVL_RESOURCE_H_\n+\n+struct devlink;\n+struct ice_adapter;\n+struct ice_hw;\n+struct ice_pf;\n+\n+void ice_devl_pf_resources_register(struct ice_pf *pf);\n+void ice_devl_whole_dev_resources_register(const struct ice_hw *hw,\n+\t\t\t\t\t   struct ice_adapter *adapter);\n+\n+int ice_take_rss_lut_pf(struct ice_pf *pf);\n+void ice_free_rss_lut_flr(struct ice_pf *pf);\n+\n+#endif /* _ICE_DEVL_RESOURCE_H_ */\ndiff --git a/drivers/net/ethernet/intel/ice/ice_adapter.h b/drivers/net/ethernet/intel/ice/ice_adapter.h\nindex 5539ec5f8515..5a9148eb7b63 100644\n--- a/drivers/net/ethernet/intel/ice/ice_adapter.h\n+++ b/drivers/net/ethernet/intel/ice/ice_adapter.h\n@@ -12,6 +12,40 @@\n struct pci_dev;\n struct ice_pf;\n \n+enum ice_devl_resource_id {\n+\t/* keep parent IDs prior to children, because we register in order */\n+\tICE_TOP_RESOURCE = DEVLINK_RESOURCE_ID_PARENT_TOP,\n+\tICE_RSS_LUT_BOTH,\n+\tICE_RSS_LUT_GLOBAL,\n+\tICE_RSS_LUT_PF,\n+\tICE_DEVL_RESOURCES_COUNT\n+};\n+\n+#define ICE_MAX_DEVL_RESOURCE_UNITS 16\n+\n+/**\n+ * struct ice_devl_resource - driver data for devlink resource, config & runtime\n+ *\n+ * @owner: entity that owns given resource (like ptr to ice_pf or ice_vf)\n+ * @pf_id: on which PF the VF is (or just PF id when PF is the owner)\n+ * @name: name of the resource to register it with\n+ * @get: occ getter callback\n+ * @set: occ setter callback\n+ * @start_size: starting size of the resource\n+ * @max_size: max size of the resource, to present in the uAPI/validate against\n+ * @parent_id: ID of the parent resource\n+ */\n+struct ice_devl_resource {\n+\tvoid *owner[ICE_MAX_DEVL_RESOURCE_UNITS];\n+\tu8 pf_id[ICE_MAX_DEVL_RESOURCE_UNITS];\n+\tconst char *name;\n+\tdevlink_resource_occ_get_t *get;\n+\tdevlink_resource_occ_set_t *set;\n+\tu32 start_size;\n+\tu32 max_size;\n+\tu32 parent_id;\n+};\n+\n /**\n  * struct ice_port_list - data used to store the list of adapter ports\n  *\n@@ -34,6 +68,7 @@ struct ice_port_list {\n  * @txq_ctx_lock: Spinlock protecting access to the GLCOMM_QTX_CNTX_CTL register\n  * @ctrl_pf: Control PF of the adapter\n  * @ports: Ports list\n+ * @resources: array of ice's data for devlink resources\n  */\n struct ice_adapter {\n \tstruct devlink *devlink;\n@@ -45,9 +80,14 @@ struct ice_adapter {\n \n \tstruct ice_pf *ctrl_pf;\n \tstruct ice_port_list ports;\n+\n+\tstruct ice_devl_resource resources[ICE_DEVL_RESOURCES_COUNT];\n };\n \n struct ice_adapter *ice_adapter_get(struct pci_dev *pdev);\n void ice_adapter_put(struct ice_adapter *adapter);\n \n+DEFINE_GUARD(ice_adapter_devl, struct ice_adapter *,\n+\t     devl_lock((_T)->devlink), devl_unlock((_T)->devlink))\n+\n #endif /* _ICE_ADAPTER_H */\ndiff --git a/drivers/net/ethernet/intel/ice/ice_common.h b/drivers/net/ethernet/intel/ice/ice_common.h\nindex dbb44e9deaf7..c58dd5207da6 100644\n--- a/drivers/net/ethernet/intel/ice/ice_common.h\n+++ b/drivers/net/ethernet/intel/ice/ice_common.h\n@@ -125,6 +125,7 @@ int ice_read_txq_ctx(struct ice_hw *hw, struct ice_tlan_ctx *tlan_ctx,\n int ice_write_txq_ctx(struct ice_hw *hw, struct ice_tlan_ctx *tlan_ctx,\n \t\t      u32 txq_index);\n \n+enum ice_lut_size ice_lut_type_to_size(enum ice_lut_type type);\n int\n ice_aq_get_rss_lut(struct ice_hw *hw, struct ice_aq_get_set_rss_lut_params *get_params);\n int\ndiff --git a/drivers/net/ethernet/intel/ice/devlink/resource.c b/drivers/net/ethernet/intel/ice/devlink/resource.c\nnew file mode 100644\nindex 000000000000..42b65730ea52\n--- /dev/null\n+++ b/drivers/net/ethernet/intel/ice/devlink/resource.c\n@@ -0,0 +1,469 @@\n+// SPDX-License-Identifier: GPL-2.0\n+/* Copyright (c) 2026, Intel Corporation. */\n+\n+#include \"resource.h\"\n+#include \"ice_adapter.h\"\n+#include \"ice.h\"\n+#include \"ice_lib.h\"\n+\n+#define ICE_NUM_GLOBAL_LUTS\t16\n+#define ICE_ANY_SLOT\t\t-1\n+\n+static u32 ice_devl_res_cnt(const struct ice_adapter *adapter,\n+\t\t\t    enum ice_devl_resource_id res_id)\n+{\n+\tconst struct ice_devl_resource *res = &adapter->resources[res_id];\n+\tu32 sum = 0;\n+\n+\tfor (int i = 0; i < res->max_size; i++)\n+\t\tsum += res->owner[i] != NULL;\n+\n+\treturn sum;\n+}\n+\n+static int ice_devl_res_take(struct ice_pf *pf,\n+\t\t\t     enum ice_devl_resource_id res_id, int slot,\n+\t\t\t     void *owner)\n+{\n+\tstruct ice_devl_resource *res = &pf->adapter->resources[res_id];\n+\tint end = slot == ICE_ANY_SLOT ? res->max_size : slot + 1;\n+\tint beg = slot == ICE_ANY_SLOT ? 0 : slot;\n+\tint err, new_id = ICE_ANY_SLOT;\n+\n+\tfor (int id = beg; id < end; id++) {\n+\t\tif (!res->owner[id]) {\n+\t\t\tnew_id = id;\n+\t\t\tbreak;\n+\t\t}\n+\t}\n+\tif (new_id == ICE_ANY_SLOT)\n+\t\treturn -ENOSPC;\n+\n+\tif (res_id == ICE_RSS_LUT_GLOBAL) {\n+\t\tstruct ice_vsi *vsi;\n+\t\tu16 lut_id;\n+\n+\t\terr = ice_alloc_rss_global_lut(&pf->hw, &lut_id);\n+\t\tif (err)\n+\t\t\treturn err;\n+\t\tif (lut_id != new_id)\n+\t\t\treturn -ENOANO;\n+\n+\t\tif (pf == owner)\n+\t\t\tvsi = ice_get_main_vsi(pf);\n+\t\telse\n+\t\t\tvsi = ice_get_vf_vsi(owner);\n+\n+\t\tvsi->global_lut_id = new_id;\n+\t}\n+\n+\tres->owner[new_id] = owner;\n+\tres->pf_id[new_id] = pf->hw.pf_id;\n+\treturn new_id;\n+}\n+\n+static int ice_devl_res_free(struct ice_pf *pf,\n+\t\t\t     enum ice_devl_resource_id res_id, void *owner)\n+{\n+\tstruct ice_devl_resource *res = &pf->adapter->resources[res_id];\n+\tint err = 0, id_to_free = ICE_ANY_SLOT;\n+\n+\tfor (int i = 0; i < res->max_size; i++) {\n+\t\tif (res->owner[i] == owner) {\n+\t\t\tid_to_free = i;\n+\t\t\tbreak;\n+\t\t}\n+\t}\n+\tif (id_to_free == ICE_ANY_SLOT)\n+\t\treturn 0;\n+\n+\tif (res_id == ICE_RSS_LUT_GLOBAL)\n+\t\terr = ice_free_rss_global_lut(&pf->hw, id_to_free);\n+\n+\tres->owner[id_to_free] = NULL;\n+\treturn err;\n+}\n+\n+void ice_free_rss_lut_flr(struct ice_pf *pf)\n+{\n+\tstruct ice_devl_resource *res, *resources = pf->adapter->resources;\n+\tint pf_id = pf->hw.pf_id;\n+\n+\tscoped_guard(ice_adapter_devl, pf->adapter) {\n+\t\tresources[ICE_RSS_LUT_PF].owner[pf_id] = NULL;\n+\t\t\n+\t\tres = &resources[ICE_RSS_LUT_GLOBAL];\n+\t\tfor (int i = 0; i < res->max_size; i++) {\n+\t\t\t/* On FLR/PFR resources assigned to PF are cleared by\n+\t\t\t * FW, reflect that in the SW table.\n+\t\t\t * VFs on given PF must be de-programmed too.\n+\t\t\t */\n+\t\t\tif (res->pf_id[i] == pf_id)\n+\t\t\t\tres->owner[i] = NULL;\n+\t\t}\n+\t}\t\t\n+}\n+\n+static int ice_devl_res_owned_idx(struct ice_adapter *adapter,\n+\t\t\t\t  enum ice_devl_resource_id res_id, void *owner)\n+{\n+\tconst struct ice_devl_resource *res = &adapter->resources[res_id];\n+\n+\tfor (int i = 0; i < res->max_size; i++) {\n+\t\tif (res->owner[i] == owner)\n+\t\t\treturn i;\n+\t}\n+\n+\treturn -ENXIO;\n+}\n+\n+static bool ice_is_devl_res_owned_by(struct ice_adapter *adapter,\n+\t\t\t\t     enum ice_devl_resource_id res_id,\n+\t\t\t\t     void *owner)\n+{\n+\treturn ice_devl_res_owned_idx(adapter, res_id, owner) >= 0;\n+}\n+\n+static u64 ice_rss_lut_whole_dev_occ_get_global(void *priv)\n+{\n+\tstruct ice_adapter *adapter = priv;\n+\n+\treturn ice_devl_res_cnt(adapter, ICE_RSS_LUT_GLOBAL);\n+}\n+\n+static u64 ice_rss_lut_whole_dev_occ_get_pf(void *priv)\n+{\n+\tstruct ice_adapter *adapter = priv;\n+\n+\treturn ice_devl_res_cnt(adapter, ICE_RSS_LUT_PF);\n+}\n+\n+static u64 ice_rss_lut_whole_dev_occ_get_both(void *priv)\n+{\n+\treturn ice_rss_lut_whole_dev_occ_get_global(priv) +\n+\t       ice_rss_lut_whole_dev_occ_get_pf(priv);\n+}\n+\n+static u64 ice_rss_lut_pf_occ_get_global(void *priv)\n+{\n+\tstruct ice_adapter *adapter;\n+\tstruct ice_pf *pf = priv;\n+\n+\tadapter = pf->adapter;\n+\tscoped_guard(ice_adapter_devl, adapter)\n+\t\treturn ice_is_devl_res_owned_by(adapter, ICE_RSS_LUT_GLOBAL, pf);\n+}\n+\n+static u64 ice_rss_lut_pf_occ_get_pf(void *priv)\n+{\n+\tstruct ice_adapter *adapter;\n+\tstruct ice_pf *pf = priv;\n+\n+\tadapter = pf->adapter;\n+\tscoped_guard(ice_adapter_devl, adapter)\n+\t\treturn ice_is_devl_res_owned_by(adapter, ICE_RSS_LUT_PF, pf);\n+}\n+\n+static u64 ice_rss_lut_pf_occ_get_both(void *priv)\n+{\n+\tstruct ice_adapter *adapter;\n+\tstruct ice_pf *pf = priv;\n+\n+\tadapter = pf->adapter;\n+\tscoped_guard(ice_adapter_devl, adapter)\n+\t\treturn ice_is_devl_res_owned_by(adapter, ICE_RSS_LUT_PF, pf) +\n+\t\t       ice_is_devl_res_owned_by(adapter, ICE_RSS_LUT_GLOBAL, pf);\n+}\n+\n+static int ice_devl_resource_deny_occ_set(u64 size,\n+\t\t\t\t\t  struct netlink_ext_ack *extack,\n+\t\t\t\t\t  void *priv)\n+{\n+\tNL_SET_ERR_MSG_MOD(extack,\n+\t\t\"can not change directly, parent/aggregate resource just adds up children data\");\n+\treturn -EPERM;\n+}\n+\n+enum ice_rss_lut_resource_state {\n+\tICE_HAS_NO_LUT = 0,\n+\tICE_HAS_GLOBAL_LUT = BIT(ICE_RSS_LUT_GLOBAL),\n+\tICE_HAS_PF_LUT = BIT(ICE_RSS_LUT_PF),\n+\tICE_HAS_BOTH_LUTS = ICE_HAS_GLOBAL_LUT | ICE_HAS_PF_LUT,\n+};\n+\n+/** ice_rss_lut_resource_state - compute opaque resource state for given owner\n+ * @adapter: the adapter the @owner is on\n+ * @owner: the entity to compute state of resources for\n+ *\n+ * Return: computed current state of the RSS resources the @owner has.\n+ */\n+static enum ice_rss_lut_resource_state\n+ice_rss_lut_resource_state(struct ice_adapter *adapter, void *owner)\n+{\n+\tenum ice_rss_lut_resource_state ret = ICE_HAS_NO_LUT;\n+\n+\tif (ice_is_devl_res_owned_by(adapter, ICE_RSS_LUT_GLOBAL, owner))\n+\t\tret |= ICE_HAS_GLOBAL_LUT;\n+\tif (ice_is_devl_res_owned_by(adapter, ICE_RSS_LUT_PF, owner))\n+\t\tret |= ICE_HAS_PF_LUT;\n+\n+\treturn ret;\n+}\n+\n+static int ice_maybe_change_rss_lut(struct ice_pf *pf, void *owner,\n+\t\t\t\t    enum ice_rss_lut_resource_state old,\n+\t\t\t\t    enum ice_rss_lut_resource_state new,\n+\t\t\t\t    struct netlink_ext_ack *extack)\n+{\n+\tstruct ice_aq_get_set_rss_lut_params params = {};\n+\tstruct ice_adapter *adapter = pf->adapter;\n+\tstruct ice_hw *hw = &pf->hw;\n+\tenum ice_lut_type lut_type;\n+\tint err, lut_size, lut_id;\n+\tstruct ice_vsi *vsi;\n+\tu8 *lut;\n+\n+\tif (old & new & ICE_HAS_PF_LUT)\n+\t\treturn 0;\n+\n+\tif (new & ICE_HAS_PF_LUT) {\n+\t\tlut_type = ICE_LUT_PF;\n+\t} else if (new & ICE_HAS_GLOBAL_LUT) {\n+\t\tlut_id = ice_devl_res_owned_idx(adapter, ICE_RSS_LUT_GLOBAL, owner);\n+\t\tif (lut_id < 0)\n+\t\t\treturn lut_id;\n+\n+\t\tlut_type = ICE_LUT_GLOBAL;\n+\t\tparams.global_lut_id = lut_id;\n+\t} else {\n+\t\tlut_type = ICE_LUT_VSI;\n+\t\tif (owner == pf) {\n+\t\t\tNL_SET_ERR_MSG_FMT(extack, \"cannot change PF to use LUT_VSI (sized 64)\");\n+\t\t\treturn -EDOM;\n+\t\t}\n+\t}\n+\n+\tif (pf == owner) {\n+\t\tvsi = ice_get_main_vsi(pf);\n+\t} else {\n+\t\treturn -EOPNOTSUPP;\n+\t}\n+\n+\tlut_size = ice_lut_type_to_size(lut_type);\n+\tlut = kmalloc(lut_size, GFP_KERNEL);\n+\tif (!lut)\n+\t\treturn -ENOMEM;\n+\tice_fill_rss_lut(lut, lut_size, vsi->rss_size);\n+\tparams.lut = lut;\n+\tparams.lut_size = lut_size;\n+\tparams.lut_type = lut_type;\n+\tparams.vsi_handle = vsi->idx;\n+\terr = ice_aq_set_rss_lut(hw, &params);\n+\tif (err) {\n+\t\tNL_SET_ERR_MSG_FMT(extack, \"AQ failed: %s\", libie_aq_str(hw->adminq.sq_last_status));\n+\t\tgoto out;\n+\t}\n+\n+\tvsi->rss_table_size = lut_size;\n+\tvsi->rss_lut_type = lut_type;\n+out:\n+\tkfree(lut);\n+\treturn err;\n+}\n+\n+static int ice_devl_res_change(bool take, enum ice_devl_resource_id res_id,\n+\t\t\t       struct ice_pf *pf, void *owner, int slot,\n+\t\t\t       struct netlink_ext_ack *extack)\n+{\n+\tenum ice_rss_lut_resource_state old, new, change;\n+\tstruct ice_adapter *adapter = pf->adapter;\n+\tint err;\n+\n+\tchange = BIT(res_id);\n+\told = ice_rss_lut_resource_state(adapter, owner);\n+\tnew = old;\n+\tif (take)\n+\t\tnew |= change;\n+\telse\n+\t\tnew &= ~change;\n+\tif (new == old)\n+\t\treturn 0;\n+\n+\tif (pf == owner && !take && old != ICE_HAS_BOTH_LUTS) {\n+\t\tNL_SET_ERR_MSG_MOD(extack,\n+\t\t\t\"at least one of 512+ sized LUTs must be assigned to PF device at all times\");\n+\t\treturn -EDOM;\n+\t}\n+\n+\tif (take) {\n+\t\tint slot_id;\n+\t\t\n+\t\tslot_id = ice_devl_res_take(pf, res_id, slot, owner);\n+\t\tif (slot_id < 0)\n+\t\t\treturn slot_id;\n+\t}\n+\n+\terr = ice_maybe_change_rss_lut(pf, owner, old, new, extack);\n+\tif (err) {\n+\t\tNL_SET_ERR_MSG_FMT(extack, \"failed to change RSS LUT, err: %d\", err);\n+\t\tif (!take)\n+\t\t\t/* We have not released the resource, so we don't free\n+\t\t\t * it, to avoid freeing LUT still in use or assigning it\n+\t\t\t * to other entity.\n+\t\t\t */\n+\t\t\treturn -EBUSY;\n+\n+\t\tgoto undo_res_take;\n+\t}\n+\n+\tif (!take) {\n+undo_res_take:\n+\t\tint rel_err;\n+\n+\t\trel_err = ice_devl_res_free(pf, res_id, owner);\n+\t\tif (rel_err) {\n+\t\t\tNL_SET_ERR_MSG_FMT(extack,\n+\t\t\t\t\"could not free resource, err: %d\", rel_err);\n+\t\t\tif (!err)\n+\t\t\t\terr = rel_err;\n+\t\t}\n+\t}\n+\n+\treturn err;\n+}\n+\n+static int ice_rss_lut_pf_occ_set_pf(u64 size, struct netlink_ext_ack *extack,\n+\t\t\t\t     void *priv)\n+{\n+\tstruct ice_pf *pf = priv;\n+\tint pf_id = pf->hw.pf_id;\n+\n+\tscoped_guard(ice_adapter_devl, pf->adapter)\n+\t\treturn ice_devl_res_change(size, ICE_RSS_LUT_PF, pf, pf, pf_id,\n+\t\t\t\t\t   extack);\n+}\n+\n+static int ice_rss_lut_pf_occ_set_global(u64 size,\n+\t\t\t\t\t struct netlink_ext_ack *extack,\n+\t\t\t\t\t void *priv)\n+{\n+\tstruct ice_pf *pf = priv;\n+\n+\tscoped_guard(ice_adapter_devl, pf->adapter)\n+\t\treturn ice_devl_res_change(size, ICE_RSS_LUT_GLOBAL, pf, pf,\n+\t\t\t\t\t   ICE_ANY_SLOT, extack);\n+}\n+\n+/**\n+ * ice_take_rss_lut_pf - allocate PF RSS LUT for PF\n+ * @pf: the PF device that PF LUT is physically on, and to allocate it for\n+ *\n+ * Acquire PF RSS LUT for the caller.\n+ *\n+ * Return: 0 on success, negative on error.\n+ */\n+int ice_take_rss_lut_pf(struct ice_pf *pf)\n+{\n+\tint ret, pf_id = pf->hw.pf_id;\n+\n+\tscoped_guard(ice_adapter_devl, pf->adapter) {\n+\t\tret = ice_devl_res_take(pf, ICE_RSS_LUT_PF, pf_id, pf);\n+\t\tif (ret >= 0)\n+\t\t\treturn 0;\n+\n+\t\treturn ret;\n+\t}\n+}\n+\n+static void ice_devl_res_register(struct devlink *devlink,\n+\t\t\t\t  struct ice_devl_resource *resources,\n+\t\t\t\t  void *occ_priv)\n+{\n+\tstruct devlink_resource_size_params size_params;\n+\n+\tdevlink_resource_size_params_init(&size_params, 0, 0, 1,\n+\t\t\t\t\t  DEVLINK_RESOURCE_UNIT_ENTRY);\n+\tfor (int i = 0; i < ICE_DEVL_RESOURCES_COUNT; i++) {\n+\t\tstruct ice_devl_resource *res = &resources[i];\n+\t\tint err, resource_id = i;\n+\n+\t\tif (!res->name)\n+\t\t\tcontinue; /* skip empty entries in config table */\n+\n+\t\tsize_params.size_max = res->max_size;\n+\t\terr = devl_resource_register(devlink, res->name,\n+\t\t\t\t\t     res->start_size, resource_id,\n+\t\t\t\t\t     res->parent_id, &size_params);\n+\t\tif (WARN_ONCE(err, \"not all resource handlers registered, err: %d, resname: %s\\n\",\n+\t\t\t      err, res->name))\n+\t\t\tbreak;\n+\n+\t\tdevl_resource_occ_set_get_register(devlink, resource_id,\n+\t\t\t\t\t\t   res->set, res->get, occ_priv);\n+\t}\n+}\n+\n+void ice_devl_whole_dev_resources_register(const struct ice_hw *hw,\n+\t\t\t\t\t   struct ice_adapter *adapter)\n+{\n+\tstruct devlink *devlink = adapter->devlink;\n+\tint pf_lut_cnt = hw->dev_caps.num_funcs;\n+\n+\tdevl_assert_locked(devlink);\n+\n+\tadapter->resources[ICE_RSS_LUT_GLOBAL] = (struct ice_devl_resource) {\n+\t\t.name = \"lut_512\",\n+\t\t.parent_id = ICE_RSS_LUT_BOTH,\n+\t\t.max_size = ICE_NUM_GLOBAL_LUTS,\n+\t\t.get = ice_rss_lut_whole_dev_occ_get_global,\n+\t\t.set = ice_devl_resource_deny_occ_set,\n+\t};\n+\tadapter->resources[ICE_RSS_LUT_PF] = (struct ice_devl_resource) {\n+\t\t.name = \"lut_2048\",\n+\t\t.parent_id = ICE_RSS_LUT_BOTH,\n+\t\t.max_size = pf_lut_cnt,\n+\t\t.get = ice_rss_lut_whole_dev_occ_get_pf,\n+\t\t.set = ice_devl_resource_deny_occ_set,\n+\t};\n+\tadapter->resources[ICE_RSS_LUT_BOTH] = (struct ice_devl_resource) {\n+\t\t.name = \"rss\",\n+\t\t.parent_id = ICE_TOP_RESOURCE,\n+\t\t.max_size = pf_lut_cnt + ICE_NUM_GLOBAL_LUTS,\n+\t\t.get = ice_rss_lut_whole_dev_occ_get_both,\n+\t\t.set = ice_devl_resource_deny_occ_set,\n+\t};\n+\n+\tice_devl_res_register(devlink, adapter->resources, adapter);\n+}\n+\n+void ice_devl_pf_resources_register(struct ice_pf *pf)\n+{\n+\tstruct ice_devl_resource pf_resources[ICE_DEVL_RESOURCES_COUNT] = {\n+\t\t[ICE_RSS_LUT_GLOBAL] = {\n+\t\t\t.name = \"lut_512\",\n+\t\t\t.parent_id = ICE_RSS_LUT_BOTH,\n+\t\t\t.max_size = 1,\n+\t\t\t.get = ice_rss_lut_pf_occ_get_global,\n+\t\t\t.set = ice_rss_lut_pf_occ_set_global,\n+\t\t},\n+\t\t[ICE_RSS_LUT_PF] = {\n+\t\t\t.name = \"lut_2048\",\n+\t\t\t.parent_id = ICE_RSS_LUT_BOTH,\n+\t\t\t.max_size = 1,\n+\t\t\t.get = ice_rss_lut_pf_occ_get_pf,\n+\t\t\t.set = ice_rss_lut_pf_occ_set_pf,\n+\t\t\t.start_size = 1,\n+\t\t},\n+\t\t[ICE_RSS_LUT_BOTH] = {\n+\t\t\t.name = \"rss\",\n+\t\t\t.parent_id = ICE_TOP_RESOURCE,\n+\t\t\t.max_size = 2,\n+\t\t\t.get = ice_rss_lut_pf_occ_get_both,\n+\t\t\t.set = ice_devl_resource_deny_occ_set,\n+\t\t},\n+\t};\n+\tstruct devlink *devlink = priv_to_devlink(pf);\n+\n+\tdevl_assert_locked(devlink);\n+\tice_devl_res_register(devlink, pf_resources, pf);\n+}\ndiff --git a/drivers/net/ethernet/intel/ice/ice_adapter.c b/drivers/net/ethernet/intel/ice/ice_adapter.c\nindex d07d349a1692..064cf649714d 100644\n--- a/drivers/net/ethernet/intel/ice/ice_adapter.c\n+++ b/drivers/net/ethernet/intel/ice/ice_adapter.c\n@@ -8,6 +8,8 @@\n #include \"ice_adapter.h\"\n #include \"ice.h\"\n \n+#include \"devlink/resource.h\"\n+\n #define ICE_ADAPTER_FIXED_INDEX\tBIT_ULL(63)\n \n #define ICE_ADAPTER_INDEX_E825C\t\\\n@@ -37,6 +39,7 @@ static u64 ice_adapter_index(struct pci_dev *pdev)\n \n static int ice_adapter_init(void *priv, void *init_param)\n {\n+\tconst struct ice_hw *hw = init_param;\n \tstruct ice_adapter *adapter = priv;\n \tstruct devlink *devlink;\n \n@@ -49,12 +52,18 @@ static int ice_adapter_init(void *priv, void *init_param)\n \tmutex_init(&adapter->ports.lock);\n \tINIT_LIST_HEAD(&adapter->ports.ports);\n \n+\tice_devl_whole_dev_resources_register(hw, adapter);\n+\n \treturn 0;\n }\n \n static void ice_adapter_fini(void *priv)\n {\n \tstruct ice_adapter *adapter = priv;\n+\tstruct devlink *devlink;\n+\n+\tdevlink = shd_priv_to_devlink(adapter);\n+\tdevl_resources_unregister(devlink);\n \n \tWARN_ON(!list_empty(&adapter->ports.ports));\n \tmutex_destroy(&adapter->ports.lock);\n@@ -80,15 +89,16 @@ static const struct devlink_ops ice_adapter_devlink_ops = {\n  */\n struct ice_adapter *ice_adapter_get(struct pci_dev *pdev)\n {\n+\tstruct ice_pf *pf = pci_get_drvdata(pdev);\n \tstruct ice_adapter *adapter;\n \tstruct devlink *devlink;\n \tchar devlink_id[32];\n \tu64 index;\n \n \tindex = ice_adapter_index(pdev);\n \tsnprintf(devlink_id, sizeof(devlink_id), \"%llx\", index);\n \tdevlink = devlink_shd_get(devlink_id, &ice_adapter_devlink_ops,\n-\t\t\t\t  sizeof(*adapter), NULL, pdev->dev.driver);\n+\t\t\t\t  sizeof(*adapter), &pf->hw, pdev->dev.driver);\n \tif (!devlink)\n \t\treturn ERR_PTR(-ENOMEM);\n \ndiff --git a/drivers/net/ethernet/intel/ice/ice_common.c b/drivers/net/ethernet/intel/ice/ice_common.c\nindex 168890986696..41eae7b0a3db 100644\n--- a/drivers/net/ethernet/intel/ice/ice_common.c\n+++ b/drivers/net/ethernet/intel/ice/ice_common.c\n@@ -4514,7 +4514,7 @@ ice_aq_sff_eeprom(struct ice_hw *hw, u16 lport, u8 bus_addr,\n \treturn status;\n }\n \n-static enum ice_lut_size ice_lut_type_to_size(enum ice_lut_type type)\n+enum ice_lut_size ice_lut_type_to_size(enum ice_lut_type type)\n {\n \tswitch (type) {\n \tcase ICE_LUT_VSI:\ndiff --git a/drivers/net/ethernet/intel/ice/ice_lib.c b/drivers/net/ethernet/intel/ice/ice_lib.c\nindex 2ac4e23f30b5..e47f2f881701 100644\n--- a/drivers/net/ethernet/intel/ice/ice_lib.c\n+++ b/drivers/net/ethernet/intel/ice/ice_lib.c\n@@ -10,6 +10,8 @@\n #include \"ice_type.h\"\n #include \"ice_vsi_vlan_ops.h\"\n \n+#include \"devlink/resource.h\"\n+\n /**\n  * ice_vsi_type_str - maps VSI type enum to string equivalents\n  * @vsi_type: VSI type enum\n@@ -885,10 +887,10 @@ static void ice_rss_clean(struct ice_vsi *vsi)\n }\n \n /**\n- * ice_vsi_set_rss_params - Setup RSS capabilities per VSI type\n+ * ice_vsi_set_dflt_rss_params - Setup default RSS capabilities per VSI type\n  * @vsi: the VSI being configured\n  */\n-static void ice_vsi_set_rss_params(struct ice_vsi *vsi)\n+static void ice_vsi_set_dflt_rss_params(struct ice_vsi *vsi)\n {\n \tstruct ice_hw_common_caps *cap;\n \tstruct ice_pf *pf = vsi->back;\n@@ -2352,6 +2354,9 @@ static int ice_vsi_cfg_def(struct ice_vsi *vsi)\n \n \tvsi->vsw = pf->first_sw;\n \n+\tif (vsi->flags & ICE_VSI_FLAG_INIT)\n+\t\tice_vsi_set_dflt_rss_params(vsi);\n+\n \tret = ice_vsi_alloc_def(vsi, vsi->ch);\n \tif (ret)\n \t\treturn ret;\n@@ -2371,7 +2376,14 @@ static int ice_vsi_cfg_def(struct ice_vsi *vsi)\n \t}\n \n \t/* set RSS capabilities */\n-\tice_vsi_set_rss_params(vsi);\n+\tif ((vsi->flags & ICE_VSI_FLAG_INIT) && vsi->type == ICE_VSI_PF) {\n+\t\tret = ice_take_rss_lut_pf(pf);\n+\t\tif (ret) {\n+\t\t\tdev_err(dev, \"Failed to allocate RSS LUT for PF: %d\\n\",\n+\t\t\t\tret);\n+\t\t\tgoto unroll_vsi_alloc_stat;\n+\t\t}\n+\t}\n \n \t/* set TC configuration */\n \tice_vsi_set_tc_cfg(vsi);\n@@ -2559,6 +2571,11 @@ void ice_vsi_decfg(struct ice_vsi *vsi)\n \tice_vsi_put_qs(vsi);\n \tice_vsi_free_arrays(vsi);\n \n+\tif (vsi->flags & ICE_VSI_FLAG_INIT) {\n+\t\tif (vsi->type == ICE_VSI_PF)\n+\t\t\tice_free_rss_lut_flr(pf);\n+\t}\n+\n \t/* SR-IOV determines needed MSIX resources all at once instead of per\n \t * VSI since when VFs are spawned we know how many VFs there are and how\n \t * many interrupts each VF needs. SR-IOV MSIX resources are also\ndiff --git a/drivers/net/ethernet/intel/ice/ice_main.c b/drivers/net/ethernet/intel/ice/ice_main.c\nindex 42d9c4220f43..94232f4a45ad 100644\n--- a/drivers/net/ethernet/intel/ice/ice_main.c\n+++ b/drivers/net/ethernet/intel/ice/ice_main.c\n@@ -15,6 +15,7 @@\n #include \"ice_dcb_nl.h\"\n #include \"devlink/devlink.h\"\n #include \"devlink/port.h\"\n+#include \"devlink/resource.h\"\n #include \"ice_sf_eth.h\"\n #include \"ice_hwmon.h\"\n #include \"ice_acl.h\"\n@@ -5037,6 +5038,7 @@ static int ice_init_devlink(struct ice_pf *pf)\n \tice_devlink_init_regions(pf);\n \tice_devlink_register(pf);\n \tice_health_init(pf);\n+\tice_devl_pf_resources_register(pf);\n \n \treturn 0;\n }\n@@ -5047,6 +5049,7 @@ static void ice_deinit_devlink(struct ice_pf *pf)\n \tice_devlink_unregister(pf);\n \tice_devlink_destroy_regions(pf);\n \tice_devlink_unregister_params(pf);\n+\tdevl_resources_unregister(priv_to_devlink(pf));\n }\n \n static int ice_init(struct ice_pf *pf)\n@@ -7972,6 +7975,8 @@ int ice_set_rss_lut(struct ice_vsi *vsi, u8 *lut, u16 lut_size)\n \tparams.lut_size = lut_size;\n \tparams.lut_type = vsi->rss_lut_type;\n \tparams.lut = lut;\n+\tif (params.lut_type == ICE_LUT_GLOBAL)\n+\t\tparams.global_lut_id = vsi->global_lut_id;\n \n \tstatus = ice_aq_set_rss_lut(hw, &params);\n \tif (status)\n@@ -8025,11 +8030,14 @@ int ice_get_rss_lut(struct ice_vsi *vsi, u8 *lut, u16 lut_size)\n \tparams.lut_size = lut_size;\n \tparams.lut_type = vsi->rss_lut_type;\n \tparams.lut = lut;\n+\tif (params.lut_type == ICE_LUT_GLOBAL)\n+\t\tparams.global_lut_id = vsi->global_lut_id;\n \n \tstatus = ice_aq_get_rss_lut(hw, &params);\n-\tif (status)\n-\t\tdev_err(ice_pf_to_dev(vsi->back), \"Cannot get RSS lut, err %d aq_err %s\\n\",\n-\t\t\tstatus, libie_aq_str(hw->adminq.sq_last_status));\n+\tif (status) {\n+\t\tdev_err(ice_pf_to_dev(vsi->back), \"Cannot get RSS lut, err %d aq_err %s, luttype: %d\\n\",\n+\t\t\tstatus, libie_aq_str(hw->adminq.sq_last_status), params.lut_type);\n+\t}\n \n \treturn status;\n }\n","prefixes":["iwl-next","v1","14/15"]}