From patchwork Tue Aug 6 14:33:03 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Przemek Kitszel X-Patchwork-Id: 13755003 X-Patchwork-Delegate: kuba@kernel.org Received: from mgamail.intel.com (mgamail.intel.com [198.175.65.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 CCA85166F1B for ; Tue, 6 Aug 2024 14:34:51 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=198.175.65.10 ARC-Seal: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1722954893; cv=none; b=pnABZ3/e2EjPvoVYpSuT9sSguwZUr1EY+4E3e8C3cLXAlMKEyN5W7FIS1Gd0npErThtDljF3JT3+/jRRZ8Lpjov1NOOLnKmFWuGhTPgIsOzrFGsp3zPPq44Blmc8+FndX+ZsRilKVX/+BaxPHxo8m9TAJp5OT/2OFalFO/ia24c= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1722954893; c=relaxed/simple; bh=l2+DWoxrNzXQLMwKZYrnPWRwkQteaDc39IHsxX467Tc=; h=From:To:Cc:Subject:Date:Message-Id:In-Reply-To:References: MIME-Version; b=qek7kirToja+zezqoIZ30YM1y21llnpCkf0Cn+hlFEzlRdHWoiGJcmVu9xdqgbqAaVPzbskZHOfzVDv3UdK3IHyhs0Rzm58z34sm2vy0W3X/CBU7HdMo5VrmWx05hcXRamqB+c65cHAVTH0fGlRZvnhxKRqBLpxYBBxXKIAY960= 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=T+fdvjKz; arc=none smtp.client-ip=198.175.65.10 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 Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=intel.com header.i=@intel.com header.b="T+fdvjKz" DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=intel.com; i=@intel.com; q=dns/txt; s=Intel; t=1722954893; x=1754490893; h=from:to:cc:subject:date:message-id:in-reply-to: references:mime-version:content-transfer-encoding; bh=l2+DWoxrNzXQLMwKZYrnPWRwkQteaDc39IHsxX467Tc=; b=T+fdvjKzPUSM4Z8ulOzYQ2Q2EcplWQ8PCjyrpYdaOsoHu7jh80YDPkne BzFL+xC8VQqJ136/lqoXhQpQFIBVRdUHfeM6X5OVFgNzzd+7WwyT0uqKN 9dECf4QmHVFQirwnTT+I96ijGqlgWVV6JIBnNu34APJW47IcBNj3+U6RK ++Lwfhux6g33vA0Ynulb3oUeF3pK3PjIyayEImfu/mLybWBPqh6OKPEWM 5diY7MB//n9apwTzsA+dYNdp5W5rPJpUvDW0jbgzvz2qwuFIGQrgYKCEV d8sujvHLZ6U2jZSGXqLadIu9put0hjikTPcZx9jJcAMuJWDXGrxOlSHov Q==; X-CSE-ConnectionGUID: qZ1SGg9TRMWf7v4kVCFMuw== X-CSE-MsgGUID: GtkTZ58iSdeCI7xuw2XNAQ== X-IronPort-AV: E=McAfee;i="6700,10204,11156"; a="38428570" X-IronPort-AV: E=Sophos;i="6.09,268,1716274800"; d="scan'208";a="38428570" Received: from fmviesa009.fm.intel.com ([10.60.135.149]) by orvoesa102.jf.intel.com with ESMTP/TLS/ECDHE-RSA-AES256-GCM-SHA384; 06 Aug 2024 07:34:51 -0700 X-CSE-ConnectionGUID: iCgJhR3iS1qISEFpsRSvMQ== X-CSE-MsgGUID: BHnq8UedQwePcm6P5tQUcQ== X-ExtLoop1: 1 X-IronPort-AV: E=Sophos;i="6.09,268,1716274800"; d="scan'208";a="56502644" Received: from irvmail002.ir.intel.com ([10.43.11.120]) by fmviesa009.fm.intel.com with ESMTP; 06 Aug 2024 07:34:47 -0700 Received: from vecna.igk.intel.com (vecna.igk.intel.com [10.123.220.17]) by irvmail002.ir.intel.com (Postfix) with ESMTP id 2144B28795; Tue, 6 Aug 2024 15:34:45 +0100 (IST) From: Przemek Kitszel To: netdev@vger.kernel.org, Ido Schimmel , Petr Machata , Jakub Kicinski , Jiri Pirko , Andrew Lunn , Florian Fainelli , Vladimir Oltean Cc: "David S. Miller" , Eric Dumazet , Paolo Abeni , Saeed Mahameed , Leon Romanovsky , Tariq Toukan , Tony Nguyen , nex.sw.ncis.osdt.itp.upstreaming@intel.com, Przemek Kitszel , Wojciech Drewek Subject: [PATCH net-next 1/5] net: dsa: replace devlink resource registration calls by devl_ variants Date: Tue, 6 Aug 2024 16:33:03 +0200 Message-Id: <20240806143307.14839-2-przemyslaw.kitszel@intel.com> X-Mailer: git-send-email 2.39.3 In-Reply-To: <20240806143307.14839-1-przemyslaw.kitszel@intel.com> References: <20240806143307.14839-1-przemyslaw.kitszel@intel.com> Precedence: bulk X-Mailing-List: netdev@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 X-Patchwork-Delegate: kuba@kernel.org Replace devlink_resource_register(), devlink_resource_occ_get_register(), and devlink_resource_occ_get_unregister() calls by respective devl_* variants. Mentioned functions have no direct users in any drivers, and are going to be removed in subsequent patches. Reviewed-by: Wojciech Drewek Signed-off-by: Przemek Kitszel --- net/dsa/devlink.c | 23 ++++++++++++++++------- 1 file changed, 16 insertions(+), 7 deletions(-) diff --git a/net/dsa/devlink.c b/net/dsa/devlink.c index 0aac887d0098..f41f9fc2194e 100644 --- a/net/dsa/devlink.c +++ b/net/dsa/devlink.c @@ -229,10 +229,15 @@ int dsa_devlink_resource_register(struct dsa_switch *ds, u64 parent_resource_id, const struct devlink_resource_size_params *size_params) { - return devlink_resource_register(ds->devlink, resource_name, - resource_size, resource_id, - parent_resource_id, - size_params); + int ret; + + devl_lock(ds->devlink); + ret = devl_resource_register(ds->devlink, resource_name, resource_size, + resource_id, parent_resource_id, + size_params); + devl_unlock(ds->devlink); + + return ret; } EXPORT_SYMBOL_GPL(dsa_devlink_resource_register); @@ -247,15 +252,19 @@ void dsa_devlink_resource_occ_get_register(struct dsa_switch *ds, devlink_resource_occ_get_t *occ_get, void *occ_get_priv) { - return devlink_resource_occ_get_register(ds->devlink, resource_id, - occ_get, occ_get_priv); + devl_lock(ds->devlink); + devl_resource_occ_get_register(ds->devlink, resource_id, occ_get, + occ_get_priv); + devl_unlock(ds->devlink); } EXPORT_SYMBOL_GPL(dsa_devlink_resource_occ_get_register); void dsa_devlink_resource_occ_get_unregister(struct dsa_switch *ds, u64 resource_id) { - devlink_resource_occ_get_unregister(ds->devlink, resource_id); + devl_lock(ds->devlink); + devl_resource_occ_get_unregister(ds->devlink, resource_id); + devl_unlock(ds->devlink); } EXPORT_SYMBOL_GPL(dsa_devlink_resource_occ_get_unregister); From patchwork Tue Aug 6 14:33:04 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Przemek Kitszel X-Patchwork-Id: 13755004 X-Patchwork-Delegate: kuba@kernel.org Received: from mgamail.intel.com (mgamail.intel.com [198.175.65.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 8EE661BE875 for ; Tue, 6 Aug 2024 14:34:53 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=198.175.65.10 ARC-Seal: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1722954895; cv=none; b=cdPZiq4mylWI/fPqxu+x6qz7bB79RlIZ6doCDw3tRbDdlEWckoKYF7xMj+OSqkyj4D+nTizreFJxSW/onTZ0274aToKorg+2diD//Aj7M/3MGEZaxtP6hJHryfn73SGHyJoX/2T5tI53/gJQ3bma44QbjINLlH9LieLuKN9RYs4= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1722954895; c=relaxed/simple; bh=hvJcyTQU8clBOnn9VsyeWAQ6y5rQrHzJ6jXZvpaL/GA=; h=From:To:Cc:Subject:Date:Message-Id:In-Reply-To:References: MIME-Version; b=Wi498xRfBcfjmvGuZEbZQYo6Juu8b7xXtYSUzmB8rhNilRI7BaXqWzJnxt0U55rpVZRZCa0hfanqIMSUnXnjHkCuAIGvznHKUxIb9it7y8wU6CRKrZR7OJFN5rBobDrAeHkJ44CcayLlP7He6vOJjrx0TR5SUGPY3NeG4kKK/L0= 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=LjVMwRL4; arc=none smtp.client-ip=198.175.65.10 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 Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=intel.com header.i=@intel.com header.b="LjVMwRL4" DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=intel.com; i=@intel.com; q=dns/txt; s=Intel; t=1722954894; x=1754490894; h=from:to:cc:subject:date:message-id:in-reply-to: references:mime-version:content-transfer-encoding; bh=hvJcyTQU8clBOnn9VsyeWAQ6y5rQrHzJ6jXZvpaL/GA=; b=LjVMwRL4NpcfXQwKtfIT3PUzkMi20+y/1vy9k7TIA1CoUNFDSe65Rzyn a+sBhviXsOHHWwrzyCLCzCXzf0y8bTvQN75pUvAme9wGfBbODh87smB7Q uUTRLITAPamxlAtvWqfjVY9wBOlyaRi6o2lz0r72cGs+SnDa1nNuPoYOt dUruIHI/6dCyj++UID8yZqhCxNOnl0uMjP/HfDO4ttxjuo3rBHHaJbwbJ ILTHY5ZIl7x+d2/CN+dGoXROgBGomNJtoxJkj4svPPpfTQFSyEQs4HsGi +Qy9KRU/XX50ngZDu4+43cClLKLdLVeWBoz4UzWPVrKiAyr0f45EDFo0i w==; X-CSE-ConnectionGUID: jruYfb/TSVOXl1rJun007Q== X-CSE-MsgGUID: aKxIoWZEQU2Y1G4loVtyIw== X-IronPort-AV: E=McAfee;i="6700,10204,11156"; a="38428585" X-IronPort-AV: E=Sophos;i="6.09,268,1716274800"; d="scan'208";a="38428585" Received: from fmviesa009.fm.intel.com ([10.60.135.149]) by orvoesa102.jf.intel.com with ESMTP/TLS/ECDHE-RSA-AES256-GCM-SHA384; 06 Aug 2024 07:34:52 -0700 X-CSE-ConnectionGUID: CWdc+eIbRQSCGiDvEFg6FA== X-CSE-MsgGUID: fNcRvlaOR+2NRnb37rwVkQ== X-ExtLoop1: 1 X-IronPort-AV: E=Sophos;i="6.09,268,1716274800"; d="scan'208";a="56502651" Received: from irvmail002.ir.intel.com ([10.43.11.120]) by fmviesa009.fm.intel.com with ESMTP; 06 Aug 2024 07:34:48 -0700 Received: from vecna.igk.intel.com (vecna.igk.intel.com [10.123.220.17]) by irvmail002.ir.intel.com (Postfix) with ESMTP id 4155728796; Tue, 6 Aug 2024 15:34:46 +0100 (IST) From: Przemek Kitszel To: netdev@vger.kernel.org, Ido Schimmel , Petr Machata , Jakub Kicinski , Jiri Pirko , Andrew Lunn , Florian Fainelli , Vladimir Oltean Cc: "David S. Miller" , Eric Dumazet , Paolo Abeni , Saeed Mahameed , Leon Romanovsky , Tariq Toukan , Tony Nguyen , nex.sw.ncis.osdt.itp.upstreaming@intel.com, Przemek Kitszel , Wojciech Drewek Subject: [PATCH net-next 2/5] devlink: remove unused devlink_resource_occ_get_register() and _unregister() Date: Tue, 6 Aug 2024 16:33:04 +0200 Message-Id: <20240806143307.14839-3-przemyslaw.kitszel@intel.com> X-Mailer: git-send-email 2.39.3 In-Reply-To: <20240806143307.14839-1-przemyslaw.kitszel@intel.com> References: <20240806143307.14839-1-przemyslaw.kitszel@intel.com> Precedence: bulk X-Mailing-List: netdev@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 X-Patchwork-Delegate: kuba@kernel.org Remove not used devlink_resource_occ_get_register() and devlink_resource_occ_get_unregister() functions; current devlink resource users are fine with devl_ variants of the two. Reviewed-by: Wojciech Drewek Signed-off-by: Przemek Kitszel --- include/net/devlink.h | 7 ------- net/devlink/resource.c | 39 --------------------------------------- 2 files changed, 46 deletions(-) diff --git a/include/net/devlink.h b/include/net/devlink.h index db5eff6cb60f..fdd6a0f9891d 100644 --- a/include/net/devlink.h +++ b/include/net/devlink.h @@ -1797,15 +1797,8 @@ void devl_resource_occ_get_register(struct devlink *devlink, u64 resource_id, devlink_resource_occ_get_t *occ_get, void *occ_get_priv); -void devlink_resource_occ_get_register(struct devlink *devlink, - u64 resource_id, - devlink_resource_occ_get_t *occ_get, - void *occ_get_priv); void devl_resource_occ_get_unregister(struct devlink *devlink, u64 resource_id); - -void devlink_resource_occ_get_unregister(struct devlink *devlink, - u64 resource_id); int devl_params_register(struct devlink *devlink, const struct devlink_param *params, size_t params_count); diff --git a/net/devlink/resource.c b/net/devlink/resource.c index 594c8aeb3bfa..6ae4b2080399 100644 --- a/net/devlink/resource.c +++ b/net/devlink/resource.c @@ -516,28 +516,6 @@ void devl_resource_occ_get_register(struct devlink *devlink, } EXPORT_SYMBOL_GPL(devl_resource_occ_get_register); -/** - * devlink_resource_occ_get_register - register occupancy getter - * - * @devlink: devlink - * @resource_id: resource id - * @occ_get: occupancy getter callback - * @occ_get_priv: occupancy getter callback priv - * - * Context: Takes and release devlink->lock . - */ -void devlink_resource_occ_get_register(struct devlink *devlink, - u64 resource_id, - devlink_resource_occ_get_t *occ_get, - void *occ_get_priv) -{ - devl_lock(devlink); - devl_resource_occ_get_register(devlink, resource_id, - occ_get, occ_get_priv); - devl_unlock(devlink); -} -EXPORT_SYMBOL_GPL(devlink_resource_occ_get_register); - /** * devl_resource_occ_get_unregister - unregister occupancy getter * @@ -560,20 +538,3 @@ void devl_resource_occ_get_unregister(struct devlink *devlink, resource->occ_get_priv = NULL; } EXPORT_SYMBOL_GPL(devl_resource_occ_get_unregister); - -/** - * devlink_resource_occ_get_unregister - unregister occupancy getter - * - * @devlink: devlink - * @resource_id: resource id - * - * Context: Takes and release devlink->lock . - */ -void devlink_resource_occ_get_unregister(struct devlink *devlink, - u64 resource_id) -{ - devl_lock(devlink); - devl_resource_occ_get_unregister(devlink, resource_id); - devl_unlock(devlink); -} -EXPORT_SYMBOL_GPL(devlink_resource_occ_get_unregister); From patchwork Tue Aug 6 14:33:05 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Przemek Kitszel X-Patchwork-Id: 13755005 X-Patchwork-Delegate: kuba@kernel.org Received: from mgamail.intel.com (mgamail.intel.com [198.175.65.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 ED7A11C3789 for ; Tue, 6 Aug 2024 14:34:53 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=198.175.65.10 ARC-Seal: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1722954896; cv=none; b=uqB2f3kolLfHJJghXdj/PE+u6bxZN/Mnk5SIf5Y+kf3h1uK9xxMmH5P3vKjujPRl9RWJg98cLiOzji6WJRWRZVMDhueWhZkGK/JFMpxxzIgsvyaKXHQjmEEz4rJv7PDu3XFeHvBTLnrTvaZNHdpSh4CPxKPpmlhAYnwCAkK/stI= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1722954896; c=relaxed/simple; bh=gF3KbyWMt7RLSqbMQB9ay8P9po3XOk7tPnnw9LpN3L0=; h=From:To:Cc:Subject:Date:Message-Id:In-Reply-To:References: MIME-Version; b=acKjeSGgGEsuabC9XmRXUhIqnJbmOWaE/YO2BQpM0OPObd2A2kRYJQTS47MRNfp6FPLhz7+J+XBG0ECJtlqHQsqA/bpECxBR0UW7pJwV9/1fr3+Bh4/vd3h0+r4iO+/b23/0mpFwiCsdsYveJ+vaILk0q6Zf/zrePbBYV4u6JaA= 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=CCGoDHnC; arc=none smtp.client-ip=198.175.65.10 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 Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=intel.com header.i=@intel.com header.b="CCGoDHnC" DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=intel.com; i=@intel.com; q=dns/txt; s=Intel; t=1722954895; x=1754490895; h=from:to:cc:subject:date:message-id:in-reply-to: references:mime-version:content-transfer-encoding; bh=gF3KbyWMt7RLSqbMQB9ay8P9po3XOk7tPnnw9LpN3L0=; b=CCGoDHnCVNAYRg7zztSu0WrEQ408TaeHkVfaz0VTJtTkT7XyLs1wnhRy 5L8P5OqG/hFTEqZ5dut+bqxxh5BJk9gdf/DKvi5Y7aagBjARoHb5voSEY gnHb8D5eMt2yzMa+RmH5ObLMR8rHayNVaT44US26BUaJ2ojbnQ+lzNktS CWtR6WvSzHPz3LDcau4b2bXOqQyToG2nQdJLMB4hv8CjPq7QkfO85pOz+ 4rBZZm93gok5zzpv1x76Omd47mAaOi3685WTN/ySiZBwpPO6F1ko3PCu1 PP6E7xzILYnxkVDAswwRhJZ40w6k9VpDXT4rOrT8qNVA5YFAdEzWWwDKk w==; X-CSE-ConnectionGUID: 9KvonjZTQnuxySrLs3Wu/g== X-CSE-MsgGUID: E/KPJAw2SDaumH4Q5gZpuw== X-IronPort-AV: E=McAfee;i="6700,10204,11156"; a="38428596" X-IronPort-AV: E=Sophos;i="6.09,268,1716274800"; d="scan'208";a="38428596" Received: from fmviesa009.fm.intel.com ([10.60.135.149]) by orvoesa102.jf.intel.com with ESMTP/TLS/ECDHE-RSA-AES256-GCM-SHA384; 06 Aug 2024 07:34:53 -0700 X-CSE-ConnectionGUID: TS0pstdTRmqGpSV7qtqWDg== X-CSE-MsgGUID: LVfcf6CDScGPK7chXZc++Q== X-ExtLoop1: 1 X-IronPort-AV: E=Sophos;i="6.09,268,1716274800"; d="scan'208";a="56502655" Received: from irvmail002.ir.intel.com ([10.43.11.120]) by fmviesa009.fm.intel.com with ESMTP; 06 Aug 2024 07:34:49 -0700 Received: from vecna.igk.intel.com (vecna.igk.intel.com [10.123.220.17]) by irvmail002.ir.intel.com (Postfix) with ESMTP id 6E6F32879E; Tue, 6 Aug 2024 15:34:47 +0100 (IST) From: Przemek Kitszel To: netdev@vger.kernel.org, Ido Schimmel , Petr Machata , Jakub Kicinski , Jiri Pirko , Andrew Lunn , Florian Fainelli , Vladimir Oltean Cc: "David S. Miller" , Eric Dumazet , Paolo Abeni , Saeed Mahameed , Leon Romanovsky , Tariq Toukan , Tony Nguyen , nex.sw.ncis.osdt.itp.upstreaming@intel.com, Przemek Kitszel , Wojciech Drewek Subject: [PATCH net-next 3/5] devlink: remove unused devlink_resource_register() Date: Tue, 6 Aug 2024 16:33:05 +0200 Message-Id: <20240806143307.14839-4-przemyslaw.kitszel@intel.com> X-Mailer: git-send-email 2.39.3 In-Reply-To: <20240806143307.14839-1-przemyslaw.kitszel@intel.com> References: <20240806143307.14839-1-przemyslaw.kitszel@intel.com> Precedence: bulk X-Mailing-List: netdev@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 X-Patchwork-Delegate: kuba@kernel.org Remove unused devlink_resource_register(); all the drivers use devl_resource_register() variant instead. Reviewed-by: Wojciech Drewek Signed-off-by: Przemek Kitszel --- include/net/devlink.h | 6 ------ net/devlink/resource.c | 33 --------------------------------- 2 files changed, 39 deletions(-) diff --git a/include/net/devlink.h b/include/net/devlink.h index fdd6a0f9891d..fbb9a2668e24 100644 --- a/include/net/devlink.h +++ b/include/net/devlink.h @@ -1779,12 +1779,6 @@ int devl_resource_register(struct devlink *devlink, u64 resource_id, u64 parent_resource_id, const struct devlink_resource_size_params *size_params); -int devlink_resource_register(struct devlink *devlink, - const char *resource_name, - u64 resource_size, - u64 resource_id, - u64 parent_resource_id, - const struct devlink_resource_size_params *size_params); void devl_resources_unregister(struct devlink *devlink); void devlink_resources_unregister(struct devlink *devlink); int devl_resource_size_get(struct devlink *devlink, diff --git a/net/devlink/resource.c b/net/devlink/resource.c index 6ae4b2080399..15efa9f49461 100644 --- a/net/devlink/resource.c +++ b/net/devlink/resource.c @@ -384,39 +384,6 @@ int devl_resource_register(struct devlink *devlink, } EXPORT_SYMBOL_GPL(devl_resource_register); -/** - * devlink_resource_register - devlink resource register - * - * @devlink: devlink - * @resource_name: resource's name - * @resource_size: resource's size - * @resource_id: resource's id - * @parent_resource_id: resource's parent id - * @size_params: size parameters - * - * Generic resources should reuse the same names across drivers. - * Please see the generic resources list at: - * Documentation/networking/devlink/devlink-resource.rst - * - * Context: Takes and release devlink->lock . - */ -int devlink_resource_register(struct devlink *devlink, - const char *resource_name, - u64 resource_size, - u64 resource_id, - u64 parent_resource_id, - const struct devlink_resource_size_params *size_params) -{ - int err; - - devl_lock(devlink); - err = devl_resource_register(devlink, resource_name, resource_size, - resource_id, parent_resource_id, size_params); - devl_unlock(devlink); - return err; -} -EXPORT_SYMBOL_GPL(devlink_resource_register); - static void devlink_resource_unregister(struct devlink *devlink, struct devlink_resource *resource) { From patchwork Tue Aug 6 14:33:06 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Przemek Kitszel X-Patchwork-Id: 13755006 X-Patchwork-Delegate: kuba@kernel.org Received: from mgamail.intel.com (mgamail.intel.com [198.175.65.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 4B2451C4601 for ; Tue, 6 Aug 2024 14:34:55 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=198.175.65.10 ARC-Seal: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1722954897; cv=none; b=jmT84c7oRWW2zoFA4oPqjTQIyoA46o1GyDA2/co/GuByqjmlW1QLHD/aFtvPeOvCuhDo3Ln33n8Ry/O6DVmRopoon0p4Icb4RfMOYnvRgn+2E+MJ12lSJm2sOnKKct+14VGDn3N8YM8KlgX2z+eyWP8cxl5UcU+jiOjf3R+nnaE= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1722954897; c=relaxed/simple; bh=b6SMk+FXgO1iDBLTbVmbVgG1rZu85XxWnDG6QDG9c1c=; h=From:To:Cc:Subject:Date:Message-Id:In-Reply-To:References: MIME-Version; b=Mtwfdm1ePh8B3sv2ACgNs125VFR8pL+mvxGjClyRzCdfpjax20nFDdZ/0ihPAhLIitn5Fjp1O504I6VZDJyq0G8D/jJltTgxbv0Me4YFrPHiY30xh82dJaKCEMqNJfuiVl41fEvKSbwBAvpd3ZLglFq/F4raNK5IBlidWoBZnRM= 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=GGfUvjgV; arc=none smtp.client-ip=198.175.65.10 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 Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=intel.com header.i=@intel.com header.b="GGfUvjgV" DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=intel.com; i=@intel.com; q=dns/txt; s=Intel; t=1722954896; x=1754490896; h=from:to:cc:subject:date:message-id:in-reply-to: references:mime-version:content-transfer-encoding; bh=b6SMk+FXgO1iDBLTbVmbVgG1rZu85XxWnDG6QDG9c1c=; b=GGfUvjgVXbebDWLxO4WTu2YnzsTJNtAF+G2dgHq7P0d799IS6Ph4oSqC uJesJu9zAZ/y9UEuugO+dsJd1nRbtewB5LOXQOwTvyJptrvJpgU2WHDWi ZfmBrWhZ5tFLup5QaYBL0DqHSrbEQ2Bq3/2rLM7bvYcxkKJZFm3foQpNt qNU1XoTyOh9tYZVjiL3NNKHsjcxbo5CbEE06UCzy5/X9YnXkmsYJ1EoWI byDlZKGzHDQHj3BeZisqVyROkXWUCd31fM5DTPtvfB1O70lwRz+Ee2pBz mUaNKQlAYkMefuCPCF1fk6WlNvW8wDD+XejLn8z+bBP+BRGXQFUzuLJV4 w==; X-CSE-ConnectionGUID: xXdKO+n2SjeyjPQtQwV+jg== X-CSE-MsgGUID: 9k0BhTOMT1ejxo/C8jC9QQ== X-IronPort-AV: E=McAfee;i="6700,10204,11156"; a="38428614" X-IronPort-AV: E=Sophos;i="6.09,268,1716274800"; d="scan'208";a="38428614" Received: from fmviesa009.fm.intel.com ([10.60.135.149]) by orvoesa102.jf.intel.com with ESMTP/TLS/ECDHE-RSA-AES256-GCM-SHA384; 06 Aug 2024 07:34:56 -0700 X-CSE-ConnectionGUID: lMCJP4exRfa7TW3QEyY2Eg== X-CSE-MsgGUID: BXsFOtYhS56f+tx5TxEvWg== X-ExtLoop1: 1 X-IronPort-AV: E=Sophos;i="6.09,268,1716274800"; d="scan'208";a="56502665" Received: from irvmail002.ir.intel.com ([10.43.11.120]) by fmviesa009.fm.intel.com with ESMTP; 06 Aug 2024 07:34:50 -0700 Received: from vecna.igk.intel.com (vecna.igk.intel.com [10.123.220.17]) by irvmail002.ir.intel.com (Postfix) with ESMTP id 8EED52FC41; Tue, 6 Aug 2024 15:34:48 +0100 (IST) From: Przemek Kitszel To: netdev@vger.kernel.org, Ido Schimmel , Petr Machata , Jakub Kicinski , Jiri Pirko , Andrew Lunn , Florian Fainelli , Vladimir Oltean Cc: "David S. Miller" , Eric Dumazet , Paolo Abeni , Saeed Mahameed , Leon Romanovsky , Tariq Toukan , Tony Nguyen , nex.sw.ncis.osdt.itp.upstreaming@intel.com, Przemek Kitszel , Wojciech Drewek Subject: [PATCH net-next 4/5] devlink: embed driver's priv data callback param into devlink_resource Date: Tue, 6 Aug 2024 16:33:06 +0200 Message-Id: <20240806143307.14839-5-przemyslaw.kitszel@intel.com> X-Mailer: git-send-email 2.39.3 In-Reply-To: <20240806143307.14839-1-przemyslaw.kitszel@intel.com> References: <20240806143307.14839-1-przemyslaw.kitszel@intel.com> Precedence: bulk X-Mailing-List: netdev@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 X-Patchwork-Delegate: kuba@kernel.org Extend devlink resource by flex array to store drivers priv data, in current usages it just replaces occupation getter's priv callback pointer. Coupling lifetime of the resource and its getters metadata (don't confuse with simple pointer to PF) is generally a good idea, and makes driver code nicer. Next commit will show how to makes use of it to combine related occ getters into one - "mlxsw: spectrum_kvdl: combine devlink resource occupation getters". Note that we pass resource size at both resource register and occupation getter register times, to avoid situation when developer forgets to extend the former call when changing the latter one. Note that it's compile tested only, I will exercise new interface also by Intel's ice driver later. Reviewed-by: Wojciech Drewek Signed-off-by: Przemek Kitszel --- include/net/devlink.h | 5 ++-- .../ethernet/mellanox/mlx5/core/sf/hw_table.c | 5 ++-- drivers/net/ethernet/mellanox/mlxsw/core.c | 5 ++-- .../net/ethernet/mellanox/mlxsw/spectrum.c | 18 ++++++------- .../ethernet/mellanox/mlxsw/spectrum1_kvdl.c | 14 +++++------ .../ethernet/mellanox/mlxsw/spectrum_cnt.c | 9 ++++--- .../mellanox/mlxsw/spectrum_policer.c | 6 ++--- .../mellanox/mlxsw/spectrum_port_range.c | 2 +- .../ethernet/mellanox/mlxsw/spectrum_router.c | 4 +-- .../ethernet/mellanox/mlxsw/spectrum_span.c | 3 ++- drivers/net/netdevsim/dev.c | 14 +++++------ drivers/net/netdevsim/fib.c | 10 ++++---- net/devlink/resource.c | 25 ++++++++++++------- net/dsa/devlink.c | 4 +-- 14 files changed, 68 insertions(+), 56 deletions(-) diff --git a/include/net/devlink.h b/include/net/devlink.h index fbb9a2668e24..48e009c7b90c 100644 --- a/include/net/devlink.h +++ b/include/net/devlink.h @@ -1778,7 +1778,8 @@ int devl_resource_register(struct devlink *devlink, u64 resource_size, u64 resource_id, u64 parent_resource_id, - const struct devlink_resource_size_params *size_params); + const struct devlink_resource_size_params *size_params, + size_t priv_data_size); void devl_resources_unregister(struct devlink *devlink); void devlink_resources_unregister(struct devlink *devlink); int devl_resource_size_get(struct devlink *devlink, @@ -1790,7 +1791,7 @@ int devl_dpipe_table_resource_set(struct devlink *devlink, void devl_resource_occ_get_register(struct devlink *devlink, u64 resource_id, devlink_resource_occ_get_t *occ_get, - void *occ_get_priv); + void *occ_get_priv, size_t occ_priv_size); void devl_resource_occ_get_unregister(struct devlink *devlink, u64 resource_id); int devl_params_register(struct devlink *devlink, diff --git a/drivers/net/ethernet/mellanox/mlx5/core/sf/hw_table.c b/drivers/net/ethernet/mellanox/mlx5/core/sf/hw_table.c index 1f613320fe07..f8b574687a41 100644 --- a/drivers/net/ethernet/mellanox/mlx5/core/sf/hw_table.c +++ b/drivers/net/ethernet/mellanox/mlx5/core/sf/hw_table.c @@ -259,15 +259,16 @@ static int mlx5_sf_hw_table_res_register(struct mlx5_core_dev *dev, u16 max_fn, devlink_resource_size_params_init(&size_params, max_fn, max_fn, 1, DEVLINK_RESOURCE_UNIT_ENTRY); err = devl_resource_register(devlink, "max_local_SFs", max_fn, MLX5_DL_RES_MAX_LOCAL_SFS, - DEVLINK_RESOURCE_ID_PARENT_TOP, &size_params); + DEVLINK_RESOURCE_ID_PARENT_TOP, + &size_params, sizeof(void *)); if (err) return err; devlink_resource_size_params_init(&size_params, max_ext_fn, max_ext_fn, 1, DEVLINK_RESOURCE_UNIT_ENTRY); return devl_resource_register(devlink, "max_external_SFs", max_ext_fn, MLX5_DL_RES_MAX_EXTERNAL_SFS, DEVLINK_RESOURCE_ID_PARENT_TOP, - &size_params); + &size_params, sizeof(void *)); } int mlx5_sf_hw_table_init(struct mlx5_core_dev *dev) diff --git a/drivers/net/ethernet/mellanox/mlxsw/core.c b/drivers/net/ethernet/mellanox/mlxsw/core.c index 4a79c0d7e7ad..81d14ccfb949 100644 --- a/drivers/net/ethernet/mellanox/mlxsw/core.c +++ b/drivers/net/ethernet/mellanox/mlxsw/core.c @@ -134,7 +134,7 @@ static int mlxsw_core_resources_ports_register(struct mlxsw_core *mlxsw_core) DEVLINK_RESOURCE_GENERIC_NAME_PORTS, max_ports, MLXSW_CORE_RESOURCE_PORTS, DEVLINK_RESOURCE_ID_PARENT_TOP, - &ports_num_params); + &ports_num_params, sizeof(void *)); } static int mlxsw_ports_init(struct mlxsw_core *mlxsw_core, bool reload) @@ -161,7 +161,8 @@ static int mlxsw_ports_init(struct mlxsw_core *mlxsw_core, bool reload) } atomic_set(&mlxsw_core->active_ports_count, 0); devl_resource_occ_get_register(devlink, MLXSW_CORE_RESOURCE_PORTS, - mlxsw_ports_occ_get, mlxsw_core); + mlxsw_ports_occ_get, &mlxsw_core, + sizeof(mlxsw_core)); return 0; diff --git a/drivers/net/ethernet/mellanox/mlxsw/spectrum.c b/drivers/net/ethernet/mellanox/mlxsw/spectrum.c index f064789f3240..2730ae3d8fe6 100644 --- a/drivers/net/ethernet/mellanox/mlxsw/spectrum.c +++ b/drivers/net/ethernet/mellanox/mlxsw/spectrum.c @@ -3660,16 +3660,16 @@ static int mlxsw_sp1_resources_kvd_register(struct mlxsw_core *mlxsw_core) err = devl_resource_register(devlink, MLXSW_SP_RESOURCE_NAME_KVD, kvd_size, MLXSW_SP_RESOURCE_KVD, DEVLINK_RESOURCE_ID_PARENT_TOP, - &kvd_size_params); + &kvd_size_params, sizeof(void *)); if (err) return err; linear_size = profile->kvd_linear_size; err = devl_resource_register(devlink, MLXSW_SP_RESOURCE_NAME_KVD_LINEAR, linear_size, MLXSW_SP_RESOURCE_KVD_LINEAR, MLXSW_SP_RESOURCE_KVD, - &linear_size_params); + &linear_size_params, sizeof(void *)); if (err) return err; @@ -3686,16 +3686,16 @@ static int mlxsw_sp1_resources_kvd_register(struct mlxsw_core *mlxsw_core) double_size, MLXSW_SP_RESOURCE_KVD_HASH_DOUBLE, MLXSW_SP_RESOURCE_KVD, - &hash_double_size_params); + &hash_double_size_params, sizeof(void *)); if (err) return err; single_size = kvd_size - double_size - linear_size; err = devl_resource_register(devlink, MLXSW_SP_RESOURCE_NAME_KVD_HASH_SINGLE, single_size, MLXSW_SP_RESOURCE_KVD_HASH_SINGLE, MLXSW_SP_RESOURCE_KVD, - &hash_single_size_params); + &hash_single_size_params, sizeof(void *)); if (err) return err; @@ -3719,7 +3719,7 @@ static int mlxsw_sp2_resources_kvd_register(struct mlxsw_core *mlxsw_core) return devl_resource_register(devlink, MLXSW_SP_RESOURCE_NAME_KVD, kvd_size, MLXSW_SP_RESOURCE_KVD, DEVLINK_RESOURCE_ID_PARENT_TOP, - &kvd_size_params); + &kvd_size_params, sizeof(void *)); } static int mlxsw_sp_resources_span_register(struct mlxsw_core *mlxsw_core) @@ -3738,7 +3738,7 @@ static int mlxsw_sp_resources_span_register(struct mlxsw_core *mlxsw_core) return devl_resource_register(devlink, MLXSW_SP_RESOURCE_NAME_SPAN, max_span, MLXSW_SP_RESOURCE_SPAN, DEVLINK_RESOURCE_ID_PARENT_TOP, - &span_size_params); + &span_size_params, sizeof(void *)); } static int @@ -3762,7 +3762,7 @@ mlxsw_sp_resources_rif_mac_profile_register(struct mlxsw_core *mlxsw_core) max_rif_mac_profiles, MLXSW_SP_RESOURCE_RIF_MAC_PROFILES, DEVLINK_RESOURCE_ID_PARENT_TOP, - &size_params); + &size_params, sizeof(void *)); } static int mlxsw_sp_resources_rifs_register(struct mlxsw_core *mlxsw_core) @@ -3781,7 +3781,7 @@ static int mlxsw_sp_resources_rifs_register(struct mlxsw_core *mlxsw_core) return devl_resource_register(devlink, "rifs", max_rifs, MLXSW_SP_RESOURCE_RIFS, DEVLINK_RESOURCE_ID_PARENT_TOP, - &size_params); + &size_params, sizeof(void *)); } static int @@ -3801,7 +3801,7 @@ mlxsw_sp_resources_port_range_register(struct mlxsw_core *mlxsw_core) return devl_resource_register(devlink, "port_range_registers", max, MLXSW_SP_RESOURCE_PORT_RANGE_REGISTERS, DEVLINK_RESOURCE_ID_PARENT_TOP, - &size_params); + &size_params, sizeof(void *)); } static int mlxsw_sp1_resources_register(struct mlxsw_core *mlxsw_core) diff --git a/drivers/net/ethernet/mellanox/mlxsw/spectrum1_kvdl.c b/drivers/net/ethernet/mellanox/mlxsw/spectrum1_kvdl.c index 1e3fc989393c..ee5f12746371 100644 --- a/drivers/net/ethernet/mellanox/mlxsw/spectrum1_kvdl.c +++ b/drivers/net/ethernet/mellanox/mlxsw/spectrum1_kvdl.c @@ -341,19 +341,19 @@ static int mlxsw_sp1_kvdl_init(struct mlxsw_sp *mlxsw_sp, void *priv) devl_resource_occ_get_register(devlink, MLXSW_SP_RESOURCE_KVD_LINEAR, mlxsw_sp1_kvdl_occ_get, - kvdl); + &kvdl, sizeof(kvdl)); devl_resource_occ_get_register(devlink, MLXSW_SP_RESOURCE_KVD_LINEAR_SINGLE, mlxsw_sp1_kvdl_single_occ_get, - kvdl); + &kvdl, sizeof(kvdl)); devl_resource_occ_get_register(devlink, MLXSW_SP_RESOURCE_KVD_LINEAR_CHUNKS, mlxsw_sp1_kvdl_chunks_occ_get, - kvdl); + &kvdl, sizeof(kvdl)); devl_resource_occ_get_register(devlink, MLXSW_SP_RESOURCE_KVD_LINEAR_LARGE_CHUNKS, mlxsw_sp1_kvdl_large_chunks_occ_get, - kvdl); + &kvdl, sizeof(kvdl)); return 0; } @@ -400,7 +400,7 @@ int mlxsw_sp1_kvdl_resources_register(struct mlxsw_core *mlxsw_core) MLXSW_SP1_KVDL_SINGLE_SIZE, MLXSW_SP_RESOURCE_KVD_LINEAR_SINGLE, MLXSW_SP_RESOURCE_KVD_LINEAR, - &size_params); + &size_params, sizeof(void *)); if (err) return err; @@ -411,7 +411,7 @@ int mlxsw_sp1_kvdl_resources_register(struct mlxsw_core *mlxsw_core) MLXSW_SP1_KVDL_CHUNKS_SIZE, MLXSW_SP_RESOURCE_KVD_LINEAR_CHUNKS, MLXSW_SP_RESOURCE_KVD_LINEAR, - &size_params); + &size_params, sizeof(void *)); if (err) return err; @@ -422,6 +422,6 @@ int mlxsw_sp1_kvdl_resources_register(struct mlxsw_core *mlxsw_core) MLXSW_SP1_KVDL_LARGE_CHUNKS_SIZE, MLXSW_SP_RESOURCE_KVD_LINEAR_LARGE_CHUNKS, MLXSW_SP_RESOURCE_KVD_LINEAR, - &size_params); + &size_params, sizeof(void *)); return err; } diff --git a/drivers/net/ethernet/mellanox/mlxsw/spectrum_cnt.c b/drivers/net/ethernet/mellanox/mlxsw/spectrum_cnt.c index 50e591420bd9..bf6a9623bccb 100644 --- a/drivers/net/ethernet/mellanox/mlxsw/spectrum_cnt.c +++ b/drivers/net/ethernet/mellanox/mlxsw/spectrum_cnt.c @@ -76,7 +76,7 @@ static int mlxsw_sp_counter_sub_pools_init(struct mlxsw_sp *mlxsw_sp) devl_resource_occ_get_register(devlink, sub_pool->resource_id, mlxsw_sp_counter_sub_pool_occ_get, - sub_pool); + &sub_pool, sizeof(sub_pool)); sub_pool->base_index = base_index; base_index += sub_pool->size; @@ -140,7 +140,8 @@ int mlxsw_sp_counter_pool_init(struct mlxsw_sp *mlxsw_sp) if (err) goto err_pool_resource_size_get; devl_resource_occ_get_register(devlink, MLXSW_SP_RESOURCE_COUNTERS, - mlxsw_sp_counter_pool_occ_get, pool); + mlxsw_sp_counter_pool_occ_get, &pool, + sizeof(pool)); pool->usage = bitmap_zalloc(pool->pool_size, GFP_KERNEL); if (!pool->usage) { @@ -267,7 +268,7 @@ int mlxsw_sp_counter_resources_register(struct mlxsw_core *mlxsw_core) pool_size, MLXSW_SP_RESOURCE_COUNTERS, DEVLINK_RESOURCE_ID_PARENT_TOP, - &size_params); + &size_params, sizeof(void *)); if (err) return err; @@ -292,7 +293,7 @@ int mlxsw_sp_counter_resources_register(struct mlxsw_core *mlxsw_core) sub_pool_size, sub_pool->resource_id, MLXSW_SP_RESOURCE_COUNTERS, - &size_params); + &size_params, sizeof(void *)); if (err) return err; total_bank_config += sub_pool->bank_count; diff --git a/drivers/net/ethernet/mellanox/mlxsw/spectrum_policer.c b/drivers/net/ethernet/mellanox/mlxsw/spectrum_policer.c index 22ebb207ce4d..e3b3d998d60f 100644 --- a/drivers/net/ethernet/mellanox/mlxsw/spectrum_policer.c +++ b/drivers/net/ethernet/mellanox/mlxsw/spectrum_policer.c @@ -97,7 +97,7 @@ mlxsw_sp_policer_single_rate_family_init(struct mlxsw_sp_policer_family *family) devl_resource_occ_get_register(devlink, MLXSW_SP_RESOURCE_SINGLE_RATE_POLICERS, mlxsw_sp_policer_single_rate_occ_get, - family); + &family, sizeof(family)); return 0; } @@ -423,7 +423,7 @@ int mlxsw_sp_policer_resources_register(struct mlxsw_core *mlxsw_core) global_policers, MLXSW_SP_RESOURCE_GLOBAL_POLICERS, DEVLINK_RESOURCE_ID_PARENT_TOP, - &size_params); + &size_params, sizeof(void *)); if (err) return err; @@ -434,7 +434,7 @@ int mlxsw_sp_policer_resources_register(struct mlxsw_core *mlxsw_core) single_rate_policers, MLXSW_SP_RESOURCE_SINGLE_RATE_POLICERS, MLXSW_SP_RESOURCE_GLOBAL_POLICERS, - &size_params); + &size_params, sizeof(void *)); if (err) return err; diff --git a/drivers/net/ethernet/mellanox/mlxsw/spectrum_port_range.c b/drivers/net/ethernet/mellanox/mlxsw/spectrum_port_range.c index 2d193de12be6..52271eb93797 100644 --- a/drivers/net/ethernet/mellanox/mlxsw/spectrum_port_range.c +++ b/drivers/net/ethernet/mellanox/mlxsw/spectrum_port_range.c @@ -183,7 +183,7 @@ int mlxsw_sp_port_range_init(struct mlxsw_sp *mlxsw_sp) devl_resource_occ_get_register(priv_to_devlink(core), MLXSW_SP_RESOURCE_PORT_RANGE_REGISTERS, mlxsw_sp_port_range_reg_occ_get, - pr_core); + &pr_core, sizeof(pr_core)); return 0; } diff --git a/drivers/net/ethernet/mellanox/mlxsw/spectrum_router.c b/drivers/net/ethernet/mellanox/mlxsw/spectrum_router.c index 800dfb64ec83..52eeea33a00f 100644 --- a/drivers/net/ethernet/mellanox/mlxsw/spectrum_router.c +++ b/drivers/net/ethernet/mellanox/mlxsw/spectrum_router.c @@ -11132,11 +11132,11 @@ static int mlxsw_sp_rifs_init(struct mlxsw_sp *mlxsw_sp) devl_resource_occ_get_register(devlink, MLXSW_SP_RESOURCE_RIF_MAC_PROFILES, mlxsw_sp_rif_mac_profiles_occ_get, - mlxsw_sp); + &mlxsw_sp, sizeof(mlxsw_sp)); devl_resource_occ_get_register(devlink, MLXSW_SP_RESOURCE_RIFS, mlxsw_sp_rifs_occ_get, - mlxsw_sp); + &mlxsw_sp, sizeof(mlxsw_sp)); return 0; diff --git a/drivers/net/ethernet/mellanox/mlxsw/spectrum_span.c b/drivers/net/ethernet/mellanox/mlxsw/spectrum_span.c index 4b5fd71c897d..2d6a0ad06f19 100644 --- a/drivers/net/ethernet/mellanox/mlxsw/spectrum_span.c +++ b/drivers/net/ethernet/mellanox/mlxsw/spectrum_span.c @@ -107,7 +107,8 @@ int mlxsw_sp_span_init(struct mlxsw_sp *mlxsw_sp) goto err_init; devl_resource_occ_get_register(devlink, MLXSW_SP_RESOURCE_SPAN, - mlxsw_sp_span_occ_get, mlxsw_sp); + mlxsw_sp_span_occ_get, &mlxsw_sp, + sizeof(mlxsw_sp)); INIT_WORK(&span->work, mlxsw_sp_span_respin_work); return 0; diff --git a/drivers/net/netdevsim/dev.c b/drivers/net/netdevsim/dev.c index 92a7a36b93ac..707be92dbc65 100644 --- a/drivers/net/netdevsim/dev.c +++ b/drivers/net/netdevsim/dev.c @@ -439,59 +439,59 @@ static int nsim_dev_resources_register(struct devlink *devlink) err = devl_resource_register(devlink, "IPv4", (u64)-1, NSIM_RESOURCE_IPV4, DEVLINK_RESOURCE_ID_PARENT_TOP, - ¶ms); + ¶ms, 0); if (err) { pr_err("Failed to register IPv4 top resource\n"); goto err_out; } err = devl_resource_register(devlink, "fib", (u64)-1, NSIM_RESOURCE_IPV4_FIB, - NSIM_RESOURCE_IPV4, ¶ms); + NSIM_RESOURCE_IPV4, ¶ms, 0); if (err) { pr_err("Failed to register IPv4 FIB resource\n"); goto err_out; } err = devl_resource_register(devlink, "fib-rules", (u64)-1, NSIM_RESOURCE_IPV4_FIB_RULES, - NSIM_RESOURCE_IPV4, ¶ms); + NSIM_RESOURCE_IPV4, ¶ms, 0); if (err) { pr_err("Failed to register IPv4 FIB rules resource\n"); goto err_out; } /* Resources for IPv6 */ err = devl_resource_register(devlink, "IPv6", (u64)-1, NSIM_RESOURCE_IPV6, DEVLINK_RESOURCE_ID_PARENT_TOP, - ¶ms); + ¶ms, 0); if (err) { pr_err("Failed to register IPv6 top resource\n"); goto err_out; } err = devl_resource_register(devlink, "fib", (u64)-1, NSIM_RESOURCE_IPV6_FIB, - NSIM_RESOURCE_IPV6, ¶ms); + NSIM_RESOURCE_IPV6, ¶ms, 0); if (err) { pr_err("Failed to register IPv6 FIB resource\n"); goto err_out; } err = devl_resource_register(devlink, "fib-rules", (u64)-1, NSIM_RESOURCE_IPV6_FIB_RULES, - NSIM_RESOURCE_IPV6, ¶ms); + NSIM_RESOURCE_IPV6, ¶ms, 0); if (err) { pr_err("Failed to register IPv6 FIB rules resource\n"); goto err_out; } /* Resources for nexthops */ err = devl_resource_register(devlink, "nexthops", (u64)-1, NSIM_RESOURCE_NEXTHOPS, DEVLINK_RESOURCE_ID_PARENT_TOP, - ¶ms); + ¶ms, 0); if (err) { pr_err("Failed to register NEXTHOPS resource\n"); goto err_out; diff --git a/drivers/net/netdevsim/fib.c b/drivers/net/netdevsim/fib.c index a1f91ff8ec56..799e75cef13a 100644 --- a/drivers/net/netdevsim/fib.c +++ b/drivers/net/netdevsim/fib.c @@ -1602,23 +1602,23 @@ struct nsim_fib_data *nsim_fib_create(struct devlink *devlink, devl_resource_occ_get_register(devlink, NSIM_RESOURCE_IPV4_FIB, nsim_fib_ipv4_resource_occ_get, - data); + &data, sizeof(data)); devl_resource_occ_get_register(devlink, NSIM_RESOURCE_IPV4_FIB_RULES, nsim_fib_ipv4_rules_res_occ_get, - data); + &data, sizeof(data)); devl_resource_occ_get_register(devlink, NSIM_RESOURCE_IPV6_FIB, nsim_fib_ipv6_resource_occ_get, - data); + &data, sizeof(data)); devl_resource_occ_get_register(devlink, NSIM_RESOURCE_IPV6_FIB_RULES, nsim_fib_ipv6_rules_res_occ_get, - data); + &data, sizeof(data)); devl_resource_occ_get_register(devlink, NSIM_RESOURCE_NEXTHOPS, nsim_fib_nexthops_res_occ_get, - data); + &data, sizeof(data)); return data; err_nexthop_nb_unregister: diff --git a/net/devlink/resource.c b/net/devlink/resource.c index 15efa9f49461..71feaa963ebe 100644 --- a/net/devlink/resource.c +++ b/net/devlink/resource.c @@ -19,7 +19,8 @@ * @list: parent list * @resource_list: list of child resources * @occ_get: occupancy getter callback - * @occ_get_priv: occupancy getter callback priv + * @priv_size: @priv data size + * @priv: priv data allocated for the driver, passed to occupancy callbacks */ struct devlink_resource { const char *name; @@ -32,7 +33,8 @@ struct devlink_resource { struct list_head list; struct list_head resource_list; devlink_resource_occ_get_t *occ_get; - void *occ_get_priv; + size_t priv_size; + u8 priv[] __counted_by(priv_size); }; static struct devlink_resource * @@ -158,7 +160,7 @@ static int devlink_resource_occ_put(struct devlink_resource *resource, if (!resource->occ_get) return 0; return nla_put_u64_64bit(skb, DEVLINK_ATTR_RESOURCE_OCC, - resource->occ_get(resource->occ_get_priv), + resource->occ_get(resource->priv), DEVLINK_ATTR_PAD); } @@ -326,6 +328,7 @@ int devlink_resources_validate(struct devlink *devlink, * @resource_id: resource's id * @parent_resource_id: resource's parent id * @size_params: size parameters + * @priv_data_size: sizeof of priv data member of the resource * * Generic resources should reuse the same names across drivers. * Please see the generic resources list at: @@ -336,7 +339,8 @@ int devl_resource_register(struct devlink *devlink, u64 resource_size, u64 resource_id, u64 parent_resource_id, - const struct devlink_resource_size_params *size_params) + const struct devlink_resource_size_params *size_params, + size_t priv_data_size) { struct devlink_resource *resource; struct list_head *resource_list; @@ -350,9 +354,11 @@ int devl_resource_register(struct devlink *devlink, if (resource) return -EINVAL; - resource = kzalloc(sizeof(*resource), GFP_KERNEL); + resource = kzalloc(struct_size(resource, priv, priv_data_size), + GFP_KERNEL); if (!resource) return -ENOMEM; + resource->priv_size = priv_data_size; if (top_hierarchy) { resource_list = &devlink->resource_list; @@ -463,23 +469,25 @@ EXPORT_SYMBOL_GPL(devl_resource_size_get); * @resource_id: resource id * @occ_get: occupancy getter callback * @occ_get_priv: occupancy getter callback priv + * @occ_priv_size: */ void devl_resource_occ_get_register(struct devlink *devlink, u64 resource_id, devlink_resource_occ_get_t *occ_get, - void *occ_get_priv) + void *occ_get_priv, size_t occ_priv_size) { struct devlink_resource *resource; lockdep_assert_held(&devlink->lock); resource = devlink_resource_find(devlink, NULL, resource_id); - if (WARN_ON(!resource)) + if (WARN_ON(!resource || occ_priv_size > resource->priv_size)) return; WARN_ON(resource->occ_get); resource->occ_get = occ_get; - resource->occ_get_priv = occ_get_priv; + /* put driver provided data into resource priv memory */ + memcpy(resource->priv, occ_get_priv, occ_priv_size); } EXPORT_SYMBOL_GPL(devl_resource_occ_get_register); @@ -502,6 +510,5 @@ void devl_resource_occ_get_unregister(struct devlink *devlink, WARN_ON(!resource->occ_get); resource->occ_get = NULL; - resource->occ_get_priv = NULL; } EXPORT_SYMBOL_GPL(devl_resource_occ_get_unregister); diff --git a/net/dsa/devlink.c b/net/dsa/devlink.c index f41f9fc2194e..29adf2d47540 100644 --- a/net/dsa/devlink.c +++ b/net/dsa/devlink.c @@ -234,7 +234,7 @@ int dsa_devlink_resource_register(struct dsa_switch *ds, devl_lock(ds->devlink); ret = devl_resource_register(ds->devlink, resource_name, resource_size, resource_id, parent_resource_id, - size_params); + size_params, sizeof(void *)); devl_unlock(ds->devlink); return ret; @@ -254,7 +254,7 @@ void dsa_devlink_resource_occ_get_register(struct dsa_switch *ds, { devl_lock(ds->devlink); devl_resource_occ_get_register(ds->devlink, resource_id, occ_get, - occ_get_priv); + &occ_get_priv, sizeof(occ_get_priv)); devl_unlock(ds->devlink); } EXPORT_SYMBOL_GPL(dsa_devlink_resource_occ_get_register); From patchwork Tue Aug 6 14:33:07 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Przemek Kitszel X-Patchwork-Id: 13755007 X-Patchwork-Delegate: kuba@kernel.org Received: from mgamail.intel.com (mgamail.intel.com [198.175.65.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 ADAF21BE875 for ; Tue, 6 Aug 2024 14:34:56 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=198.175.65.10 ARC-Seal: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1722954898; cv=none; b=h+YqiClLHyZTVRvzZRfhs6a0CpiqEaOzaMfOA3mQbxn1DRkHKDBGaCLmo7gFAiXhtjX2N3AFx50ssnAMku87yVzyvfkGMt4pGjozZ35hyLi3/b5xEhDyR0aZC0upUv5ojM93DSNDIa3pD9xT0JwwuSfPmaKN6MftKzhXIHHglgE= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1722954898; c=relaxed/simple; bh=yUUWnROm3mCAZpy7+Gd2lIerK1GenBdD6Pb4PPzTBKU=; h=From:To:Cc:Subject:Date:Message-Id:In-Reply-To:References: MIME-Version; b=faLF8Udlget+U1aFuYK9PncA2xSnvHKhN2L7TmRnBLAfV/Z6SPBMREUu5m7u5Qy7WTRZ0sT8jw0Qzg49m7XTL41sdYetFiafrdWLA99EYotHx/kMJcg5buadR0N2U8uDj4gzFI6GREugo9dOHM5DSrOMtMmVrNRb4/BYwz15KD4= 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=HiTu6bys; arc=none smtp.client-ip=198.175.65.10 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 Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=intel.com header.i=@intel.com header.b="HiTu6bys" DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=intel.com; i=@intel.com; q=dns/txt; s=Intel; t=1722954897; x=1754490897; h=from:to:cc:subject:date:message-id:in-reply-to: references:mime-version:content-transfer-encoding; bh=yUUWnROm3mCAZpy7+Gd2lIerK1GenBdD6Pb4PPzTBKU=; b=HiTu6bysczUDdf2ce4AXQY6XcsfKdhVHxexQdG0PiEo8S13iFpeCxapS jbKWY+xzpzfdeIRYZZuJPcvwdxC1cWBLPWjO2DoQFSWsUimK9/6WWEj54 99WF5B1V7v3kwMYqgtBTo39UCM3PYYgPpPb5H2V4niPUzSVNtkgB/F3wF mSB04QX/NQ932guhoLGNkVtE+FNMkG0fTaudBeoOKTU+eI4AX10ACex4B NaexQpDED3r2A17qMI8rBRi672JpjQIWdprzwj6CjVKNaMIw7gdu3HwI5 zbtFC0Hi/xinQBn0lOsGwosMmvT6NHhqkTILfF37iekcpNgre+dfRGKMW w==; X-CSE-ConnectionGUID: ZbhIs4HERLil7bU7jHmaOw== X-CSE-MsgGUID: S2elkq92RXCCnjL2tYHz1w== X-IronPort-AV: E=McAfee;i="6700,10204,11156"; a="38428626" X-IronPort-AV: E=Sophos;i="6.09,268,1716274800"; d="scan'208";a="38428626" Received: from fmviesa009.fm.intel.com ([10.60.135.149]) by orvoesa102.jf.intel.com with ESMTP/TLS/ECDHE-RSA-AES256-GCM-SHA384; 06 Aug 2024 07:34:57 -0700 X-CSE-ConnectionGUID: KZU1tXN7SAaroKVl6Tp8Rw== X-CSE-MsgGUID: cBI7KZiMQ/6r4PpIgpinvw== X-ExtLoop1: 1 X-IronPort-AV: E=Sophos;i="6.09,268,1716274800"; d="scan'208";a="56502675" Received: from irvmail002.ir.intel.com ([10.43.11.120]) by fmviesa009.fm.intel.com with ESMTP; 06 Aug 2024 07:34:51 -0700 Received: from vecna.igk.intel.com (vecna.igk.intel.com [10.123.220.17]) by irvmail002.ir.intel.com (Postfix) with ESMTP id E475F2FC42; Tue, 6 Aug 2024 15:34:49 +0100 (IST) From: Przemek Kitszel To: netdev@vger.kernel.org, Ido Schimmel , Petr Machata , Jakub Kicinski , Jiri Pirko , Andrew Lunn , Florian Fainelli , Vladimir Oltean Cc: "David S. Miller" , Eric Dumazet , Paolo Abeni , Saeed Mahameed , Leon Romanovsky , Tariq Toukan , Tony Nguyen , nex.sw.ncis.osdt.itp.upstreaming@intel.com, Przemek Kitszel , Wojciech Drewek Subject: [PATCH net-next 5/5] mlxsw: spectrum_kvdl: combine devlink resource occupation getters Date: Tue, 6 Aug 2024 16:33:07 +0200 Message-Id: <20240806143307.14839-6-przemyslaw.kitszel@intel.com> X-Mailer: git-send-email 2.39.3 In-Reply-To: <20240806143307.14839-1-przemyslaw.kitszel@intel.com> References: <20240806143307.14839-1-przemyslaw.kitszel@intel.com> Precedence: bulk X-Mailing-List: netdev@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 X-Patchwork-Delegate: kuba@kernel.org Combine spectrum1 kvdl devlink resource occupation getters into one. Thanks to previous commit of the series we could easily embed more than just a single pointer into devlink resource. Reviewed-by: Wojciech Drewek Signed-off-by: Przemek Kitszel --- .../net/ethernet/mellanox/mlxsw/spectrum.h | 5 ++ .../net/ethernet/mellanox/mlxsw/spectrum.c | 3 +- .../ethernet/mellanox/mlxsw/spectrum1_kvdl.c | 80 ++++++++----------- 3 files changed, 41 insertions(+), 47 deletions(-) diff --git a/drivers/net/ethernet/mellanox/mlxsw/spectrum.h b/drivers/net/ethernet/mellanox/mlxsw/spectrum.h index 8d3c61287696..91fe5fffa675 100644 --- a/drivers/net/ethernet/mellanox/mlxsw/spectrum.h +++ b/drivers/net/ethernet/mellanox/mlxsw/spectrum.h @@ -836,6 +836,11 @@ int mlxsw_sp_kvdl_alloc_count_query(struct mlxsw_sp *mlxsw_sp, unsigned int *p_alloc_count); /* spectrum1_kvdl.c */ +struct mlxsw_sp1_kvdl_occ_ctx { + struct mlxsw_sp1_kvdl *kvdl; + int first_part_id; + bool count_all_parts; +}; extern const struct mlxsw_sp_kvdl_ops mlxsw_sp1_kvdl_ops; int mlxsw_sp1_kvdl_resources_register(struct mlxsw_core *mlxsw_core); diff --git a/drivers/net/ethernet/mellanox/mlxsw/spectrum.c b/drivers/net/ethernet/mellanox/mlxsw/spectrum.c index 2730ae3d8fe6..3bda2b2d16f9 100644 --- a/drivers/net/ethernet/mellanox/mlxsw/spectrum.c +++ b/drivers/net/ethernet/mellanox/mlxsw/spectrum.c @@ -3669,7 +3669,8 @@ static int mlxsw_sp1_resources_kvd_register(struct mlxsw_core *mlxsw_core) linear_size, MLXSW_SP_RESOURCE_KVD_LINEAR, MLXSW_SP_RESOURCE_KVD, - &linear_size_params, sizeof(void *)); + &linear_size_params, + sizeof(struct mlxsw_sp1_kvdl_occ_ctx)); if (err) return err; diff --git a/drivers/net/ethernet/mellanox/mlxsw/spectrum1_kvdl.c b/drivers/net/ethernet/mellanox/mlxsw/spectrum1_kvdl.c index ee5f12746371..a8bf052adf31 100644 --- a/drivers/net/ethernet/mellanox/mlxsw/spectrum1_kvdl.c +++ b/drivers/net/ethernet/mellanox/mlxsw/spectrum1_kvdl.c @@ -292,68 +292,53 @@ static u64 mlxsw_sp1_kvdl_part_occ(struct mlxsw_sp1_kvdl_part *part) static u64 mlxsw_sp1_kvdl_occ_get(void *priv) { - const struct mlxsw_sp1_kvdl *kvdl = priv; + struct mlxsw_sp1_kvdl_occ_ctx *ctx = priv; + bool cnt_all = ctx->count_all_parts; + int beg, end; u64 occ = 0; - int i; - for (i = 0; i < MLXSW_SP1_KVDL_PARTS_INFO_LEN; i++) - occ += mlxsw_sp1_kvdl_part_occ(kvdl->parts[i]); + beg = cnt_all ? 0 : ctx->first_part_id, + end = cnt_all ? MLXSW_SP1_KVDL_PARTS_INFO_LEN : beg + 1; + for (int i = beg; i < end; i++) + occ += mlxsw_sp1_kvdl_part_occ(ctx->kvdl->parts[i]); return occ; } -static u64 mlxsw_sp1_kvdl_single_occ_get(void *priv) -{ - const struct mlxsw_sp1_kvdl *kvdl = priv; - struct mlxsw_sp1_kvdl_part *part; - - part = kvdl->parts[MLXSW_SP1_KVDL_PART_ID_SINGLE]; - return mlxsw_sp1_kvdl_part_occ(part); -} - -static u64 mlxsw_sp1_kvdl_chunks_occ_get(void *priv) -{ - const struct mlxsw_sp1_kvdl *kvdl = priv; - struct mlxsw_sp1_kvdl_part *part; - - part = kvdl->parts[MLXSW_SP1_KVDL_PART_ID_CHUNKS]; - return mlxsw_sp1_kvdl_part_occ(part); -} - -static u64 mlxsw_sp1_kvdl_large_chunks_occ_get(void *priv) -{ - const struct mlxsw_sp1_kvdl *kvdl = priv; - struct mlxsw_sp1_kvdl_part *part; - - part = kvdl->parts[MLXSW_SP1_KVDL_PART_ID_LARGE_CHUNKS]; - return mlxsw_sp1_kvdl_part_occ(part); -} - static int mlxsw_sp1_kvdl_init(struct mlxsw_sp *mlxsw_sp, void *priv) { struct devlink *devlink = priv_to_devlink(mlxsw_sp->core); - struct mlxsw_sp1_kvdl *kvdl = priv; + struct mlxsw_sp1_kvdl_occ_ctx ctx = { priv }; int err; - err = mlxsw_sp1_kvdl_parts_init(mlxsw_sp, kvdl); + err = mlxsw_sp1_kvdl_parts_init(mlxsw_sp, ctx.kvdl); if (err) return err; - devl_resource_occ_get_register(devlink, - MLXSW_SP_RESOURCE_KVD_LINEAR, - mlxsw_sp1_kvdl_occ_get, - &kvdl, sizeof(kvdl)); + + ctx.first_part_id = MLXSW_SP1_KVDL_PART_ID_SINGLE; devl_resource_occ_get_register(devlink, MLXSW_SP_RESOURCE_KVD_LINEAR_SINGLE, - mlxsw_sp1_kvdl_single_occ_get, - &kvdl, sizeof(kvdl)); + mlxsw_sp1_kvdl_occ_get, + &ctx, sizeof(ctx)); + + ctx.first_part_id = MLXSW_SP1_KVDL_PART_ID_CHUNKS; devl_resource_occ_get_register(devlink, MLXSW_SP_RESOURCE_KVD_LINEAR_CHUNKS, - mlxsw_sp1_kvdl_chunks_occ_get, - &kvdl, sizeof(kvdl)); + mlxsw_sp1_kvdl_occ_get, + &ctx, sizeof(ctx)); + + ctx.first_part_id = MLXSW_SP1_KVDL_PART_ID_LARGE_CHUNKS; devl_resource_occ_get_register(devlink, MLXSW_SP_RESOURCE_KVD_LINEAR_LARGE_CHUNKS, - mlxsw_sp1_kvdl_large_chunks_occ_get, - &kvdl, sizeof(kvdl)); + mlxsw_sp1_kvdl_occ_get, + &ctx, sizeof(ctx)); + + ctx.count_all_parts = true; + devl_resource_occ_get_register(devlink, + MLXSW_SP_RESOURCE_KVD_LINEAR, + mlxsw_sp1_kvdl_occ_get, + &ctx, sizeof(ctx)); + return 0; } @@ -400,7 +385,8 @@ int mlxsw_sp1_kvdl_resources_register(struct mlxsw_core *mlxsw_core) MLXSW_SP1_KVDL_SINGLE_SIZE, MLXSW_SP_RESOURCE_KVD_LINEAR_SINGLE, MLXSW_SP_RESOURCE_KVD_LINEAR, - &size_params, sizeof(void *)); + &size_params, + sizeof(struct mlxsw_sp1_kvdl_occ_ctx)); if (err) return err; @@ -411,7 +397,8 @@ int mlxsw_sp1_kvdl_resources_register(struct mlxsw_core *mlxsw_core) MLXSW_SP1_KVDL_CHUNKS_SIZE, MLXSW_SP_RESOURCE_KVD_LINEAR_CHUNKS, MLXSW_SP_RESOURCE_KVD_LINEAR, - &size_params, sizeof(void *)); + &size_params, + sizeof(struct mlxsw_sp1_kvdl_occ_ctx)); if (err) return err; @@ -422,6 +409,7 @@ int mlxsw_sp1_kvdl_resources_register(struct mlxsw_core *mlxsw_core) MLXSW_SP1_KVDL_LARGE_CHUNKS_SIZE, MLXSW_SP_RESOURCE_KVD_LINEAR_LARGE_CHUNKS, MLXSW_SP_RESOURCE_KVD_LINEAR, - &size_params, sizeof(void *)); + &size_params, + sizeof(struct mlxsw_sp1_kvdl_occ_ctx)); return err; }