From patchwork Tue Jun 25 12:08:04 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Amit Cohen X-Patchwork-Id: 13710967 X-Patchwork-Delegate: kuba@kernel.org Received: from NAM12-DM6-obe.outbound.protection.outlook.com (mail-dm6nam12on2062.outbound.protection.outlook.com [40.107.243.62]) (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 080DC14D452 for ; Tue, 25 Jun 2024 12:08:50 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=fail smtp.client-ip=40.107.243.62 ARC-Seal: i=2; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1719317332; cv=fail; b=nmkdbjhSXgj+8fA4QodMYcbTfMFYmDc7rdwPCksIUcGaBto1YmtJZ9/VZ3fNYpW0uvBDSAFIEt3GvSeirLBnK70zguQPAzMCjjtCs48wdk8HxGsdhfO5C6tQq3+P40+WojECvRX/XWMGCYn6ji+w+NkZ6mYRKxsF2/l4JevgSwM= ARC-Message-Signature: i=2; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1719317332; c=relaxed/simple; bh=IcUaao8c0GOYSZhUvi6y3/my+wvV9HJBUCVrJ4nNsME=; h=From:To:CC:Subject:Date:Message-ID:In-Reply-To:References: MIME-Version:Content-Type; b=KokvjoZNNWxE9Kr/p6OfJRjsJHOQVdwL2nIXoOA4lXYWebHE1t7qwKZO4gK5UNZq60rW2XVMknGuBjf49ZEOdwF9Ju9Kzzo6kDYbDiS4Ffbte8RO5q8Y7OEDHO9gZ2tgyAcvAwqh2JGvhQQyNIjQqPR/yolrq2GU+yLxsCr+dME= ARC-Authentication-Results: i=2; smtp.subspace.kernel.org; dmarc=pass (p=reject dis=none) header.from=nvidia.com; spf=fail smtp.mailfrom=nvidia.com; dkim=pass (2048-bit key) header.d=Nvidia.com header.i=@Nvidia.com header.b=kskLnGBV; arc=fail smtp.client-ip=40.107.243.62 Authentication-Results: smtp.subspace.kernel.org; dmarc=pass (p=reject dis=none) header.from=nvidia.com Authentication-Results: smtp.subspace.kernel.org; spf=fail smtp.mailfrom=nvidia.com Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=Nvidia.com header.i=@Nvidia.com header.b="kskLnGBV" ARC-Seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=Ewzn7RxCYBPerYCg9HFO7Bz6Jfe23sqJ63eWIZKgsxd9DTS4fBJuZjo81HzJuTQtIJTAGedO+7S3/wsill0Te332yv4H7riQoxmzjujbUX0u33vm97jWlZ4qXzu+HsnBruEWVmJZfIJf5Z6BgKrPrfdLRSOYXt8DMWJLC8m71BBt6L/W/nMMIAlHyuh/Rby7lPEm2xiAEwVPSTbbyacXrW/aQwsvpwTKsdPQy83NBbxTTy0+OsbBnUunR5jmIMlT3Z9BKihpeb36cLv5d33RaRXZnAm9OHWaT/O4mgWAIcn2WeCySI2yA/WlRTmYxtidqYSdpuOHuKuDm30jrkCzyQ== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=microsoft.com; s=arcselector9901; h=From:Date:Subject:Message-ID:Content-Type:MIME-Version:X-MS-Exchange-AntiSpam-MessageData-ChunkCount:X-MS-Exchange-AntiSpam-MessageData-0:X-MS-Exchange-AntiSpam-MessageData-1; bh=9NABsRTiLqv/rsopKvTad4kU0WMyccy2o3BzsvUGhuE=; b=S6Yn4cLel1HABTbrj+pWcFtv9+eSMff/9m872DwvErJxEGOCaBoJrvBuh7H2FLgj80Dt/eTx12XEOKREI3dxBm8gyeOpXCe2rroqCuyrCMl3YmZ9G1laAdHlzlxSOvK8hCXxbrkhyXdPbODoqeFgcsntdYHdylB2Y3t4qAEfutnsv+LgZuISaY75fS5++uU88sHwY3oyirkh8qagxdHmOj+ayevzHmDvI2Y6vqL5vUpaz/zdvtgckfAAQ/CD7avPcVdym5auEPnIm+LJOfx8J1yxizUElciydNSR2pAMPz9TrWJbe5zk+S2efE3WECYublCaVJLmrESzFp+RaQEdew== ARC-Authentication-Results: i=1; mx.microsoft.com 1; spf=pass (sender ip is 216.228.117.161) smtp.rcpttodomain=kernel.org smtp.mailfrom=nvidia.com; dmarc=pass (p=reject sp=reject pct=100) action=none header.from=nvidia.com; dkim=none (message not signed); arc=none (0) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=Nvidia.com; s=selector2; h=From:Date:Subject:Message-ID:Content-Type:MIME-Version:X-MS-Exchange-SenderADCheck; bh=9NABsRTiLqv/rsopKvTad4kU0WMyccy2o3BzsvUGhuE=; b=kskLnGBVp1G4ynUS0z0ulf3eHLNRoxu1yNgEhB/2CdBs4FMjCE9JQsL0X4rIzzOagNbfjmvLn989yAIoGaUlMVwrZMoSPVwT2KQIN+t8gmBpBQghVZlaUUQRSOsLh/em3s2muzQwFHjZ+ruQOtyco1C9bAGnq3wchaqLvh4Yq7YLfyFtw3KTpKq+3I1XgAzZxPVflPRqWGszZfJCaTXNE0WMjshWj7YkMdnKLibaVqYN/AV7SnqOFKfUPTy8MDImY6V/nbgX2TVYToBUtqLvP+eFm/t78Sl5J/E62yVBclEELrV9KOkpd8MPGc3IhZrsrUUyfgddAEeL8Sl9SeBgCQ== Received: from BN9PR03CA0767.namprd03.prod.outlook.com (2603:10b6:408:13a::22) by IA0PR12MB8207.namprd12.prod.outlook.com (2603:10b6:208:401::8) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.7698.30; Tue, 25 Jun 2024 12:08:47 +0000 Received: from BN1PEPF0000468B.namprd05.prod.outlook.com (2603:10b6:408:13a:cafe::76) by BN9PR03CA0767.outlook.office365.com (2603:10b6:408:13a::22) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.7677.38 via Frontend Transport; Tue, 25 Jun 2024 12:08:47 +0000 X-MS-Exchange-Authentication-Results: spf=pass (sender IP is 216.228.117.161) smtp.mailfrom=nvidia.com; dkim=none (message not signed) header.d=none;dmarc=pass action=none header.from=nvidia.com; Received-SPF: Pass (protection.outlook.com: domain of nvidia.com designates 216.228.117.161 as permitted sender) receiver=protection.outlook.com; client-ip=216.228.117.161; helo=mail.nvidia.com; pr=C Received: from mail.nvidia.com (216.228.117.161) by BN1PEPF0000468B.mail.protection.outlook.com (10.167.243.136) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.7677.15 via Frontend Transport; Tue, 25 Jun 2024 12:08:47 +0000 Received: from rnnvmail201.nvidia.com (10.129.68.8) by mail.nvidia.com (10.129.200.67) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.2.1544.4; Tue, 25 Jun 2024 05:08:28 -0700 Received: from dev-r-vrt-155.mtr.labs.mlnx (10.126.231.35) by rnnvmail201.nvidia.com (10.129.68.8) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.2.1544.4; Tue, 25 Jun 2024 05:08:25 -0700 From: Amit Cohen To: CC: , , , , , , , , Amit Cohen Subject: [PATCH RFC net-next 1/4] net: core: page_pool_user: Allow flexibility of 'ifindex' value Date: Tue, 25 Jun 2024 15:08:04 +0300 Message-ID: <20240625120807.1165581-2-amcohen@nvidia.com> X-Mailer: git-send-email 2.45.1 In-Reply-To: <20240625120807.1165581-1-amcohen@nvidia.com> References: <20240625120807.1165581-1-amcohen@nvidia.com> Precedence: bulk X-Mailing-List: netdev@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 X-ClientProxiedBy: rnnvmail202.nvidia.com (10.129.68.7) To rnnvmail201.nvidia.com (10.129.68.8) X-EOPAttributedMessage: 0 X-MS-PublicTrafficType: Email X-MS-TrafficTypeDiagnostic: BN1PEPF0000468B:EE_|IA0PR12MB8207:EE_ X-MS-Office365-Filtering-Correlation-Id: 68e7ef6f-7394-47a2-eda2-08dc950f917c X-MS-Exchange-SenderADCheck: 1 X-MS-Exchange-AntiSpam-Relay: 0 X-Microsoft-Antispam: BCL:0;ARA:13230037|376011|36860700010|82310400023|1800799021; X-Microsoft-Antispam-Message-Info: q+XdOqe8cuqFlLuVcsmSnTNDEAlAwK3YBEWKW1IfnokUhXtEz9C/GOSDAfQBY5IcEwDFWpCTKTMHroDB1RQkd8agJabAizIr43fXFSIors/TS97Pd6KWaQYXxGvtIyi9yQqidb/WyzxBdghmCFqLpnl+Z0eUmleRhhW+XnQd7m6/fj3TVxkeyVACj7yZ2tLAKFvmCxQ4Z8U6ycb9kKdfyV2/eKd99vjqd65ZT54yWecd4U9X2BNVT6XpeTUAOS4pCu6i8GDuU6DiWAOZJI7Npp1hIBXB9r4aQrfyC9MqnSXUwaJFxsnwjfRVIx9aoiRmvAEiWJ6dxni7VDa9MvsjZY1uRJKC9ybcqO5WACQ1XGjoqHa4n0HcO49MmPrhIeqxikJ36H4AEj2sfCEo01fx1LWp/W0QL0I32ySCVjsBYOm4sSnTptQutZHAHOF52ZKMO6YgRPXlxt9kSw802Lx61TIJVKtFgawodvtv47bvYtW0IVAKKlRMCOGS07m1t00jDem72mgQ83zrY5zhgDlg5OLmNJo6csRCcDSI65x4oKu/VMG2f2VJD0MrYNY4vkSIUxzc2wC6ZGwvmCagVka9a/122p9Zf9egfvHr4qLj1nh8jpbb870sgBQd5YY4qV3sUfVUJpHEubKtJLnIq9gzWKL6sulcD7u8Ue5DajlQy5I1TW0S4i288lpzVKqwiGvoYjpBNrT3+32XK9xHqaCKuLwCXKinrXSn2YlNA2K2BPnMuVFnNJt+8w2bSzm3aD8uMOafLw/iXPAcgUQGLUjyZNaii3/q4rDB9xV0GaLLVsLbr5dnbHYWDiLtx07zBp9eAZy0ioY6ESPTTMKPhCDeFkVPube0hvUPa+eSpcq/Ss2HMxuBTnWSQMCQv+VF4depPHDvuku60FGqLzMo3yL1MhkzXs5k7waWIf5grVdQuaItcTT7iZdOZ1sGtWqVP0lE/8Gn/FX+yNIv+miz2SzramzcpP+0qxLhEIXsSLJMqsFI5ZksvgVTeFdU3agnQuFZTsezOq6BVbZ5AWf9vNFQiUkHS+Vl/GBtGA2/XVHAIoXkWQ5XlsfavDDCdBFloPW00WKBw0WuZsV2MaVmWEC2xDn7s2Rp5z7ETTzJXG+fA2dEKzNF8n+IQT3LmTj+6+mcIPwL1cuUyRhc+yD1KTOMI2kLguELdOLex5ChutpG8CmOkjkIbUKL7iikXdqC6uKKcobA+J33FLI+y4FmXKJNuJwzplIm0iqn7U81u1ctf9/3AunANRN1ztTF8KfNviGr+s7Dk2WwBqFW0JGLFwYA3Oz1YQBTANkl1bIMYb/XpPeVfDA4NV6s1tyOPsERH+1M/NBVK22DMt1EO9l58n2gtFv7xLbQ7In/YRFpU3z8Nn3vwEwY7CPnukWwussaWwURPaNW2DrFBFYEUKA3LM/eVQ== X-Forefront-Antispam-Report: CIP:216.228.117.161;CTRY:US;LANG:en;SCL:1;SRV:;IPV:NLI;SFV:NSPM;H:mail.nvidia.com;PTR:dc6edge2.nvidia.com;CAT:NONE;SFS:(13230037)(376011)(36860700010)(82310400023)(1800799021);DIR:OUT;SFP:1101; X-OriginatorOrg: Nvidia.com X-MS-Exchange-CrossTenant-OriginalArrivalTime: 25 Jun 2024 12:08:47.5668 (UTC) X-MS-Exchange-CrossTenant-Network-Message-Id: 68e7ef6f-7394-47a2-eda2-08dc950f917c X-MS-Exchange-CrossTenant-Id: 43083d15-7273-40c1-b7db-39efd9ccc17a X-MS-Exchange-CrossTenant-OriginalAttributedTenantConnectingIp: TenantId=43083d15-7273-40c1-b7db-39efd9ccc17a;Ip=[216.228.117.161];Helo=[mail.nvidia.com] X-MS-Exchange-CrossTenant-AuthSource: BN1PEPF0000468B.namprd05.prod.outlook.com X-MS-Exchange-CrossTenant-AuthAs: Anonymous X-MS-Exchange-CrossTenant-FromEntityHeader: HybridOnPrem X-MS-Exchange-Transport-CrossTenantHeadersStamped: IA0PR12MB8207 X-Patchwork-Delegate: kuba@kernel.org X-Patchwork-State: RFC Netlink message of page pool query includes 'ifindex'. Currently, this value is always set to 'pool->slow.netdev->ifindex'. This allows getting responses only for page pools which holds pointer to real netdevice. In case that driver does not have 1:1 mapping between page pool and netdevice, 'pool->slow.netdev->ifindex' will not point to netdevice. That means that such drivers cannot query page pools info and statistics. The functions page_pool_nl_stats_fill()/page_pool_nl_fill() get page pool structure and use 'ifindex' which is stored in the pool to fill netlink message. Instead, let the callers decide which 'ifindex' should be used. For now, all the callers pass 'pool->slow.netdev->ifindex', so there is no behavior change. The next patch will change dump behavior. Signed-off-by: Amit Cohen --- net/core/page_pool_user.c | 22 ++++++++++------------ 1 file changed, 10 insertions(+), 12 deletions(-) diff --git a/net/core/page_pool_user.c b/net/core/page_pool_user.c index 3a3277ba167b..44948f7b9d68 100644 --- a/net/core/page_pool_user.c +++ b/net/core/page_pool_user.c @@ -30,7 +30,7 @@ static DEFINE_MUTEX(page_pools_lock); */ typedef int (*pp_nl_fill_cb)(struct sk_buff *rsp, const struct page_pool *pool, - const struct genl_info *info); + const struct genl_info *info, int ifindex); static int netdev_nl_page_pool_get_do(struct genl_info *info, u32 id, pp_nl_fill_cb fill) @@ -53,7 +53,7 @@ netdev_nl_page_pool_get_do(struct genl_info *info, u32 id, pp_nl_fill_cb fill) goto err_unlock; } - err = fill(rsp, pool, info); + err = fill(rsp, pool, info, pool->slow.netdev->ifindex); if (err) goto err_free_msg; @@ -92,7 +92,7 @@ netdev_nl_page_pool_get_dump(struct sk_buff *skb, struct netlink_callback *cb, continue; state->pp_id = pool->user.id; - err = fill(skb, pool, info); + err = fill(skb, pool, info, pool->slow.netdev->ifindex); if (err) goto out; } @@ -108,7 +108,7 @@ netdev_nl_page_pool_get_dump(struct sk_buff *skb, struct netlink_callback *cb, static int page_pool_nl_stats_fill(struct sk_buff *rsp, const struct page_pool *pool, - const struct genl_info *info) + const struct genl_info *info, int ifindex) { #ifdef CONFIG_PAGE_POOL_STATS struct page_pool_stats stats = {}; @@ -125,9 +125,8 @@ page_pool_nl_stats_fill(struct sk_buff *rsp, const struct page_pool *pool, nest = nla_nest_start(rsp, NETDEV_A_PAGE_POOL_STATS_INFO); if (nla_put_uint(rsp, NETDEV_A_PAGE_POOL_ID, pool->user.id) || - (pool->slow.netdev->ifindex != LOOPBACK_IFINDEX && - nla_put_u32(rsp, NETDEV_A_PAGE_POOL_IFINDEX, - pool->slow.netdev->ifindex))) + (ifindex != LOOPBACK_IFINDEX && + nla_put_u32(rsp, NETDEV_A_PAGE_POOL_IFINDEX, ifindex))) goto err_cancel_nest; nla_nest_end(rsp, nest); @@ -210,7 +209,7 @@ int netdev_nl_page_pool_stats_get_dumpit(struct sk_buff *skb, static int page_pool_nl_fill(struct sk_buff *rsp, const struct page_pool *pool, - const struct genl_info *info) + const struct genl_info *info, int ifindex) { size_t inflight, refsz; void *hdr; @@ -222,9 +221,8 @@ page_pool_nl_fill(struct sk_buff *rsp, const struct page_pool *pool, if (nla_put_uint(rsp, NETDEV_A_PAGE_POOL_ID, pool->user.id)) goto err_cancel; - if (pool->slow.netdev->ifindex != LOOPBACK_IFINDEX && - nla_put_u32(rsp, NETDEV_A_PAGE_POOL_IFINDEX, - pool->slow.netdev->ifindex)) + if (ifindex != LOOPBACK_IFINDEX && + nla_put_u32(rsp, NETDEV_A_PAGE_POOL_IFINDEX, ifindex)) goto err_cancel; if (pool->user.napi_id && nla_put_uint(rsp, NETDEV_A_PAGE_POOL_NAPI_ID, pool->user.napi_id)) @@ -271,7 +269,7 @@ static void netdev_nl_page_pool_event(const struct page_pool *pool, u32 cmd) if (!ntf) return; - if (page_pool_nl_fill(ntf, pool, &info)) { + if (page_pool_nl_fill(ntf, pool, &info, pool->slow.netdev->ifindex)) { nlmsg_free(ntf); return; } From patchwork Tue Jun 25 12:08:05 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Amit Cohen X-Patchwork-Id: 13710968 X-Patchwork-Delegate: kuba@kernel.org Received: from NAM10-MW2-obe.outbound.protection.outlook.com (mail-mw2nam10on2086.outbound.protection.outlook.com [40.107.94.86]) (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 858AB14D45E for ; Tue, 25 Jun 2024 12:08:52 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=fail smtp.client-ip=40.107.94.86 ARC-Seal: i=2; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1719317334; cv=fail; b=HLbFs5L4mCw6SOK7JBnMR8AJ4TW2QJwXY3r0z9s7kLLp9tHSt0IaM16C2aWkY/mn51RhqHRv8qTBFYKjdOgOiyrAI3hcpJ76ouO3BY3Si8rjIWcP+HUeazQ4DDOE3JN0EZgXJk7K+HlDmRJoU2ZbpqMda08WnD4gnvzueXapNB8= ARC-Message-Signature: i=2; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1719317334; c=relaxed/simple; bh=kvexmGOM+20u9zBGAo4tcZ9yrtdZJMnKe2kZxuog2a0=; h=From:To:CC:Subject:Date:Message-ID:In-Reply-To:References: MIME-Version:Content-Type; b=lAij8vz2RoAK3kZpUiH/eyXfyldG1os3Aj1diBlyoBLYQ+0vGiUHGfcBDmHcoSxadu9heAQunCTTyeiqLDnB2J+jQK1bB6rgibuvVifJoKndZXVrEIOTpRF6gk6dz5NQb62Luz5TMxHi6JOFFX4lwSnR2FciwSwtmvx61+LM9hg= ARC-Authentication-Results: i=2; smtp.subspace.kernel.org; dmarc=pass (p=reject dis=none) header.from=nvidia.com; spf=fail smtp.mailfrom=nvidia.com; dkim=pass (2048-bit key) header.d=Nvidia.com header.i=@Nvidia.com header.b=dLe1dFU6; arc=fail smtp.client-ip=40.107.94.86 Authentication-Results: smtp.subspace.kernel.org; dmarc=pass (p=reject dis=none) header.from=nvidia.com Authentication-Results: smtp.subspace.kernel.org; spf=fail smtp.mailfrom=nvidia.com Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=Nvidia.com header.i=@Nvidia.com header.b="dLe1dFU6" ARC-Seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=oYCeRSD15KK667OfK75+5Og3wWcqGIFrpmDsjjmaHLGAaGjXT3TRqp16Std3P5F5IqvUND7EiTdOJvPItj0lXblVHqd658sOdDQN7fRhVtBJmaqyLMLO+O6c3BnpQ51VqVdgPPhAF5fnpSjayy54OSreOviJkoXTcshmbsvALecCY2kdPHjYWHSz8YM7p/P/leU7x1RAllQFR/D0X0jNCFOqJRr08LCF4z++DKZLICvErj0umoX0kDuJok8F/61UGZHWOx5+WzUEUKBOtHddQRd0lAJWpyvH5VXH7PflxWBI6s6l5jZxa1a5epGPlkzVcvRZbXe3whODXpRgDrmW2A== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=microsoft.com; s=arcselector9901; h=From:Date:Subject:Message-ID:Content-Type:MIME-Version:X-MS-Exchange-AntiSpam-MessageData-ChunkCount:X-MS-Exchange-AntiSpam-MessageData-0:X-MS-Exchange-AntiSpam-MessageData-1; bh=401wB8S3y7ZdCdLR0MfnDr3+2MPnws7NgvfXzPhZ5Hs=; b=juA5DYeUqfckgjYcZhiRKjbRft9/zelCcjWjEO5liSaqwqwrRoICJPYr9MdQvqzIQQUGKcAxkWH8GAnklWEYJ1PaHHKEnlZQN8CZceruS6SoWGXhjs6SY4QQX1FmoZM4T9v65Nt9TWo1ictHfxq3rdx9PS475sjPNLOGfvZQiX4bRTjKHqEaqs3LQsHAIXxQxJTV4tBCQL1NAUZmF0iQK6xP7oDlc/rOgB537y7uTwOX9PS8C24pqB8vpJg/L3NGz6g9PhKEMRjfA+oWsRWXVnHGwiX6sHNnS17j6y7XYuDTMHk/26le/jPEV2prz+PjSeTFJiuyQ2GLJKD4iKqaiA== ARC-Authentication-Results: i=1; mx.microsoft.com 1; spf=pass (sender ip is 216.228.117.160) smtp.rcpttodomain=kernel.org smtp.mailfrom=nvidia.com; dmarc=pass (p=reject sp=reject pct=100) action=none header.from=nvidia.com; dkim=none (message not signed); arc=none (0) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=Nvidia.com; s=selector2; h=From:Date:Subject:Message-ID:Content-Type:MIME-Version:X-MS-Exchange-SenderADCheck; bh=401wB8S3y7ZdCdLR0MfnDr3+2MPnws7NgvfXzPhZ5Hs=; b=dLe1dFU6snp+1YdlHXC5r2XfAzL00jQ76JOevlO6WubanCP9s3dReIUoKgNxXh/Prxm3B78szYFBT6QPCNN/qByREqGYh4H1+ZxZD08oLmdHgdBfxbex67x930Qjm14bVZAuKaFCqDZourUp4T5Szo27EtvttmtqMULMZglQ9InzNjbRxHPMBJ479Iv+kfKbPwUWRaeVJzksE1+hatBbynLChez0oa3foZvaAtC+/dBVLtNHA2E1BPeYUvwygmhWneBzIgQPiWA/Csn/O6NgAidYr2+CHNj7IvUJfxKEA3Tfdg6dRrwkdMPuNQCYIGNnmbkE+R4WuVqTpAoWLMCZRA== Received: from DM6PR18CA0010.namprd18.prod.outlook.com (2603:10b6:5:15b::23) by SA1PR12MB8162.namprd12.prod.outlook.com (2603:10b6:806:33a::18) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.7698.32; Tue, 25 Jun 2024 12:08:49 +0000 Received: from DS1PEPF0001708F.namprd03.prod.outlook.com (2603:10b6:5:15b:cafe::d0) by DM6PR18CA0010.outlook.office365.com (2603:10b6:5:15b::23) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.7677.38 via Frontend Transport; Tue, 25 Jun 2024 12:08:49 +0000 X-MS-Exchange-Authentication-Results: spf=pass (sender IP is 216.228.117.160) smtp.mailfrom=nvidia.com; dkim=none (message not signed) header.d=none;dmarc=pass action=none header.from=nvidia.com; Received-SPF: Pass (protection.outlook.com: domain of nvidia.com designates 216.228.117.160 as permitted sender) receiver=protection.outlook.com; client-ip=216.228.117.160; helo=mail.nvidia.com; pr=C Received: from mail.nvidia.com (216.228.117.160) by DS1PEPF0001708F.mail.protection.outlook.com (10.167.17.139) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.7677.15 via Frontend Transport; Tue, 25 Jun 2024 12:08:49 +0000 Received: from rnnvmail201.nvidia.com (10.129.68.8) by mail.nvidia.com (10.129.200.66) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.2.1544.4; Tue, 25 Jun 2024 05:08:31 -0700 Received: from dev-r-vrt-155.mtr.labs.mlnx (10.126.231.35) by rnnvmail201.nvidia.com (10.129.68.8) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.2.1544.4; Tue, 25 Jun 2024 05:08:28 -0700 From: Amit Cohen To: CC: , , , , , , , , Amit Cohen Subject: [PATCH RFC net-next 2/4] net: core: page_pool_user: Change 'ifindex' for page pool dump Date: Tue, 25 Jun 2024 15:08:05 +0300 Message-ID: <20240625120807.1165581-3-amcohen@nvidia.com> X-Mailer: git-send-email 2.45.1 In-Reply-To: <20240625120807.1165581-1-amcohen@nvidia.com> References: <20240625120807.1165581-1-amcohen@nvidia.com> Precedence: bulk X-Mailing-List: netdev@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 X-ClientProxiedBy: rnnvmail202.nvidia.com (10.129.68.7) To rnnvmail201.nvidia.com (10.129.68.8) X-EOPAttributedMessage: 0 X-MS-PublicTrafficType: Email X-MS-TrafficTypeDiagnostic: DS1PEPF0001708F:EE_|SA1PR12MB8162:EE_ X-MS-Office365-Filtering-Correlation-Id: e7a6874f-9c7a-4c1a-e186-08dc950f9260 X-MS-Exchange-SenderADCheck: 1 X-MS-Exchange-AntiSpam-Relay: 0 X-Microsoft-Antispam: BCL:0;ARA:13230037|82310400023|1800799021|36860700010|376011; X-Microsoft-Antispam-Message-Info: L+KtXbic6O6a3gYuAp5C9wV6srrOWfX+OPiku2t/0a2MpbchkeUlRIJVFEfeIYt6JGsIgmmiLeIRyhEcH+SwsQeimLkkRbMkkEItbrbIF7OiT3nVC+Ln2SGsiA/qi0FMtHsMnAoVec6Aa8pGf8XmFkHimecy0Xt+vHxTMAU5uGvhCQZ9qr/uvBPvStV2r+KGWV8t+jUJUKI9LA+ERlVJKJq1CaRjvFdoYWHFRO+Awaz3PQ9fVEjzJBuXi5sMTcAd9OpmeyAQ/BQNP9Vnri78m6WoEMKXgGw/R33DLz/ULlXuaw0fDCRKB1BMJ2xxoLpHupuN+wtPYM/l1js5ZoN9LiYC563cFnpnT00HIs7inU05EKGzUbo4eX4mu4Br2s5CYs4KAJ/l7XTFjILbYz7kXhKS8XDMg5nQ2kWvgt4RvP/UB7sKjtZZt9NvT7zGFhW1Nx3Crxfl6pCLyikCnDmrTCHdgrtSlATpsmTtYENwJB/886KeKxfExVSTzHkWg5VFEd3NRuc7toiqqonpF1wMuEi4dr6Z1VM/EyOlw4yUrYbMFQpGjskkqY3J4OvpBli11U/zPR+1Abew9M7bmQFy8dRRZlr2Q+H+K/+zYSiIQGTOPosnfF9asIIeNWgFB0/rUkJDFu79Zq3D9DpT7TMhaGdsfPHsztb3UhqygqMlM7T0cmUia21m8BNT9OnyTxUpilTx9M9lOkksgAl+HA3h8x9VsLe759xIvWmTMJ/x4pn+GhP7mzYpvsiXd6YptdTbwn7KaH32j7V4LLftD0uL1Vi8xA4Krh0c+40fU87/9Ier4hwstUxuGlqWa7XprYdfmGXcOZ3nXXq1PymAxuzKQMK9MTiITUImcR1hHNT04LdGyBeQVJGpWG8qCFpVSWCXaGTSgdnLwXqqw/LgHbSl+Z2G4ra6wgFWlqPLziLb1DW4odGVPk7B0jzs4KIjBG+LFLvciiuAbVY5C+IQSU491x/D558xzZ9HpiGKfNMPMpsZoDVDHdD8c0a2+FznUPpMxYSTUJ35HdPlyYE1W8aPK+C4hEnITzgPnnods+OfOrvd6DPSXz7IsnNijYHR8K28aWRxAvwHmSKhprCZXdsXvzZC4hkJ26JR5dIJCaVAjq7TiTHj8KjmZfQQ79v2x5rOdPYxaz8r4JXM+YHVFiLvwQK+A7tv0ZeJpa2uBxz0tl1gxhlhT+gYvZai2AiTKFXD6bZdLHzC/8qBXzwllwPu7iTQ9w23ieonPUBD1jQ637WUDfnCtTZEeZ2N4dkhHojGaARJT5NGhIXAd2p/F9D1mwQEK6qS+NzdMcruNWuF+WDIQwegSNCgHT/crlCiOIjkDbxUe+1n5cx/A988vsrldPf0lAlbfMJc+3DDwQBRZ658O5qCEnlJvmT2o1qiuRYlFOv+0Qf1mv+Ox+V7vu132w== X-Forefront-Antispam-Report: CIP:216.228.117.160;CTRY:US;LANG:en;SCL:1;SRV:;IPV:NLI;SFV:NSPM;H:mail.nvidia.com;PTR:dc6edge1.nvidia.com;CAT:NONE;SFS:(13230037)(82310400023)(1800799021)(36860700010)(376011);DIR:OUT;SFP:1101; X-OriginatorOrg: Nvidia.com X-MS-Exchange-CrossTenant-OriginalArrivalTime: 25 Jun 2024 12:08:49.1232 (UTC) X-MS-Exchange-CrossTenant-Network-Message-Id: e7a6874f-9c7a-4c1a-e186-08dc950f9260 X-MS-Exchange-CrossTenant-Id: 43083d15-7273-40c1-b7db-39efd9ccc17a X-MS-Exchange-CrossTenant-OriginalAttributedTenantConnectingIp: TenantId=43083d15-7273-40c1-b7db-39efd9ccc17a;Ip=[216.228.117.160];Helo=[mail.nvidia.com] X-MS-Exchange-CrossTenant-AuthSource: DS1PEPF0001708F.namprd03.prod.outlook.com X-MS-Exchange-CrossTenant-AuthAs: Anonymous X-MS-Exchange-CrossTenant-FromEntityHeader: HybridOnPrem X-MS-Exchange-Transport-CrossTenantHeadersStamped: SA1PR12MB8162 X-Patchwork-Delegate: kuba@kernel.org X-Patchwork-State: RFC Currently, to dump all page pools, there is a loop which iterates over all netdevices in the relevant net, then, for each netdevice, iterate over all page pools which are attached to this netdevice, and call the fill() function with the pool. With the exiting code, the netlink message is filled with 'pool->slow.netdev->ifindex', which means that if a pool is used by several netdevices, it will not be dumped with the real netdevice via page-pool-get/page-pool-stats-get, as this pointer should be NULL in such case. Change 'ifindex' which is passed to fill() function, pass the 'ifindex' of the netdevice which the pool is stored in its list. This should not change the behavior for drivers which has netdevice per page pool, as the same value is passed now. It will allow drivers which have page pool for several netdevices to dump all the pools. The drivers just need to make 'netdev->page_pools' list to hold all the pools which the netdevice consumes pages from. Note that 'ifindex' for get command is not changed. Signed-off-by: Amit Cohen --- net/core/page_pool_user.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/net/core/page_pool_user.c b/net/core/page_pool_user.c index 44948f7b9d68..ce4a34adad8a 100644 --- a/net/core/page_pool_user.c +++ b/net/core/page_pool_user.c @@ -92,7 +92,7 @@ netdev_nl_page_pool_get_dump(struct sk_buff *skb, struct netlink_callback *cb, continue; state->pp_id = pool->user.id; - err = fill(skb, pool, info, pool->slow.netdev->ifindex); + err = fill(skb, pool, info, netdev->ifindex); if (err) goto out; } From patchwork Tue Jun 25 12:08:06 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Amit Cohen X-Patchwork-Id: 13710969 X-Patchwork-Delegate: kuba@kernel.org Received: from NAM02-BN1-obe.outbound.protection.outlook.com (mail-bn1nam02on2045.outbound.protection.outlook.com [40.107.212.45]) (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 2274D14D45E for ; Tue, 25 Jun 2024 12:08:56 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=fail smtp.client-ip=40.107.212.45 ARC-Seal: i=2; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1719317338; cv=fail; b=QN+eL1FFUw4gEF8Mv7ee2MUf1QW11jC/5/CmxgpfGacOcLBsrq4kDDKYLtjul2aEg6B/sZXj7ZoUOIwjx5BzozDJS+IjOptwiDQAojpyhafr5v+E0H+rwjl4mis7ejjGnJCjAYRjq5E7Mcf1s7O6sz2YRqYla5ZW4mRgXBYJndw= ARC-Message-Signature: i=2; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1719317338; c=relaxed/simple; bh=GSHBqyhAwqhOWue9FNMbSm2xqYhpHDst3qNlLSTLnVs=; h=From:To:CC:Subject:Date:Message-ID:In-Reply-To:References: MIME-Version:Content-Type; b=RthudyRBtxyNVeAiYss1JU+doG0sUIGLEtU2NEnOjFsuR2KwefnhehzFuKHYSK1G7uDbwemlt5X4jsNfKPm4IobFz1QFu+pvWY89xzWlM7v4s3B2jaIPszBhi/7ZXzgM31mwo3ko7Sdx9ojDnVwAXCUp7DPrVcN7RLZW7HsIsQ8= ARC-Authentication-Results: i=2; smtp.subspace.kernel.org; dmarc=pass (p=reject dis=none) header.from=nvidia.com; spf=fail smtp.mailfrom=nvidia.com; dkim=pass (2048-bit key) header.d=Nvidia.com header.i=@Nvidia.com header.b=M9EBv4Qp; arc=fail smtp.client-ip=40.107.212.45 Authentication-Results: smtp.subspace.kernel.org; dmarc=pass (p=reject dis=none) header.from=nvidia.com Authentication-Results: smtp.subspace.kernel.org; spf=fail smtp.mailfrom=nvidia.com Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=Nvidia.com header.i=@Nvidia.com header.b="M9EBv4Qp" ARC-Seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=UjMpv/nU6CBmiMdKa3Kx40oEQkdlA1sbQVbXd/B6cbOZNCcXxVvkw+Aq41f2oJazIR0iV7DzmeuU4XSZoTQahIUcaxxQB7c091VU7+7sWnBV5Gr0KWYbDOLvV166hSS7FCwJk8svpYlrVLsjIaykw7E4Ay/43wySwyTlj2vVqZ8F6AeBQR4qSFWBG38XvN7TUow+APfR7DzjnNi7CbeB+tXIZbBa/oqPDgWKXsMRtts1f+1tzDcucCL8EJ9CqxiYUMd6oNYyAIPk7tPnI2yc0ayEaEfNE8HWgXlIZH39VYwfQZI1fh+chGc7MnSbNQ0MjFRqlxxwgdUc0iodgsSe+w== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=microsoft.com; s=arcselector9901; h=From:Date:Subject:Message-ID:Content-Type:MIME-Version:X-MS-Exchange-AntiSpam-MessageData-ChunkCount:X-MS-Exchange-AntiSpam-MessageData-0:X-MS-Exchange-AntiSpam-MessageData-1; bh=Qm0LTzfYHRXcrHaBeIcuxrDE4X/gdrNdRM5J+Z6C15I=; b=OrVj4GFMKmaRvZzI8NfHYjPjmSza87ryziY8sn0qWueJIr0P2cw/uk2YdfVpkshGqetUdOCUDeGE/hKvIKHtzLSGeEFC9yiFF3D80a+FpqLsosE0FlDrzOKdTFt65+NSTJnzPvdEUtqYtjqJbUKzkOWiPDGeR2dsJ49ZtSSzSVCD9xqUPmqPbf9nQ4qjti4MlqGsjZBXqPiWyNStX5CdLWql2JPxv0jWgiMdKTiHT4AFCOWnge9mMQqn9Rpt/VY2Cmo1Gqr8Nf+8HAVl0cvpj88Gwqdn9Lql6RrInHIlNhnp6YD6kYKK06GTNbHonXUmjIpxHJC/qk6iq2kUniesRA== ARC-Authentication-Results: i=1; mx.microsoft.com 1; spf=pass (sender ip is 216.228.117.160) smtp.rcpttodomain=kernel.org smtp.mailfrom=nvidia.com; dmarc=pass (p=reject sp=reject pct=100) action=none header.from=nvidia.com; dkim=none (message not signed); arc=none (0) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=Nvidia.com; s=selector2; h=From:Date:Subject:Message-ID:Content-Type:MIME-Version:X-MS-Exchange-SenderADCheck; bh=Qm0LTzfYHRXcrHaBeIcuxrDE4X/gdrNdRM5J+Z6C15I=; b=M9EBv4QpJjlsQWg7GfuG3OxYMNhb2k9NEdD3sEzn54kFMxvReqAhBIHcAx1ajqF4/plp1UYvlh07MJLTh4Oqq9jUnXaO2gnGySPnUavHv6tlB3nz7qfCIGEHIZ9UlXBvMtz9nGz/t5PG3iSdxWFacRgiGxrmgon30UEbZ9QcSWqjfKHBJzt/eyciWg0X7KytB0nun2LMv4QIepxUVYBmW6l5xhUYYl3R3Tr7FDOMPPAazBBTSQ++vU/PkUK1D5rHpZLx2xUjNMUJvxRANhJgwfxfr+ODOSXJkgNfjL+WmL4qaYRSQkQyI6GV7hpOOPE/pbOhXZ0YO8ZXp0DNBPZgng== Received: from DM6PR18CA0002.namprd18.prod.outlook.com (2603:10b6:5:15b::15) by SJ0PR12MB6781.namprd12.prod.outlook.com (2603:10b6:a03:44b::22) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.7698.32; Tue, 25 Jun 2024 12:08:51 +0000 Received: from DS1PEPF0001708F.namprd03.prod.outlook.com (2603:10b6:5:15b:cafe::55) by DM6PR18CA0002.outlook.office365.com (2603:10b6:5:15b::15) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.7677.38 via Frontend Transport; Tue, 25 Jun 2024 12:08:50 +0000 X-MS-Exchange-Authentication-Results: spf=pass (sender IP is 216.228.117.160) smtp.mailfrom=nvidia.com; dkim=none (message not signed) header.d=none;dmarc=pass action=none header.from=nvidia.com; Received-SPF: Pass (protection.outlook.com: domain of nvidia.com designates 216.228.117.160 as permitted sender) receiver=protection.outlook.com; client-ip=216.228.117.160; helo=mail.nvidia.com; pr=C Received: from mail.nvidia.com (216.228.117.160) by DS1PEPF0001708F.mail.protection.outlook.com (10.167.17.139) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.7677.15 via Frontend Transport; Tue, 25 Jun 2024 12:08:50 +0000 Received: from rnnvmail201.nvidia.com (10.129.68.8) by mail.nvidia.com (10.129.200.66) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.2.1544.4; Tue, 25 Jun 2024 05:08:34 -0700 Received: from dev-r-vrt-155.mtr.labs.mlnx (10.126.231.35) by rnnvmail201.nvidia.com (10.129.68.8) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.2.1544.4; Tue, 25 Jun 2024 05:08:31 -0700 From: Amit Cohen To: CC: , , , , , , , , Amit Cohen Subject: [PATCH RFC net-next 3/4] mlxsw: pci: Allow get page pool info/stats via netlink Date: Tue, 25 Jun 2024 15:08:06 +0300 Message-ID: <20240625120807.1165581-4-amcohen@nvidia.com> X-Mailer: git-send-email 2.45.1 In-Reply-To: <20240625120807.1165581-1-amcohen@nvidia.com> References: <20240625120807.1165581-1-amcohen@nvidia.com> Precedence: bulk X-Mailing-List: netdev@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 X-ClientProxiedBy: rnnvmail202.nvidia.com (10.129.68.7) To rnnvmail201.nvidia.com (10.129.68.8) X-EOPAttributedMessage: 0 X-MS-PublicTrafficType: Email X-MS-TrafficTypeDiagnostic: DS1PEPF0001708F:EE_|SJ0PR12MB6781:EE_ X-MS-Office365-Filtering-Correlation-Id: 26008df8-1f78-4ee7-24f2-08dc950f9367 X-MS-Exchange-SenderADCheck: 1 X-MS-Exchange-AntiSpam-Relay: 0 X-Microsoft-Antispam: BCL:0;ARA:13230037|82310400023|1800799021|376011|36860700010; X-Microsoft-Antispam-Message-Info: OQfrlvzwwmX7wZf01l0qazDxnVTCsYr0t/Z/sTl1+bXYiScTVVusOA+vUXSEWrNbuhFKWRUicjufuPiOnhmhHlir1j5ZkBiNMLTsQUCESsdoA1bFQwnMVeRq+2FNiX+29sXk4HQ1d6pj8qmocL56QCrlO+ViGJgONcn68CWGOX+e3Q7QPn+S+b52UheRCmtfOcc/gT7b1qB0oM0e6z48YMrxHzC2mTL/E3D5wJ9zseWZ00bfZmpfk4oyMASXRtqTgKqvalxHVJrpXEhFK9qyxCwPoRxJGzheoRKoVaGnZwA4cjvJX/GBx5I8PmJdPXR8YllSxofRIsJOxEo4g7zqQKxack/7r+2fPV2TMBloivQyKuXPsSh6zjjVUiCCsKZ58vvVGG+lTqqhST8j4jVfbJoit7SYH5TYyk5U3T/3eGqOrDcmCmxVjXKx5Hq9An2hP0lXLIHDj1JqxtQ7lm5CSG33UzqefzviqmTfMm2LNoEmSnJXthU7ORJbxSJtrrzEXSLnSXkaSTKhTn4pc/lVkJK4dupR+i1ifb13jhf1DFd+SIPamD8V5oMYzbfX2NO/NTVTp/FwlsFAGlZTq8y3Kk1bW1MhRyTmZ1rU+AoOKr9gzguBJQFL4gQUBuaeMhIQ72f8nvQ7HzhPuTQ4vrl4Dh4vnRchRudi/BZ7ODwvRQHYcf/N2bScY+/1dV27uv+5PDuk+H54ft6XJaXhEoXMYvRNOvsFM8TAK+8TQfChfIi+lhC6H2L6RtJlDVBFRgfbDc2Z15+L0HkVUlyRQljOCB/Ku8XVVCza2RHxoNh5xHPcwV/m4gqGZPJTrVZb5wyZ+iFEvIFefROm8LKC58Vgzn1qAHVm4nsT/sBIN/IS+qf6A31htUe4oukh+7uIh3g+ocAEykcgziUlVjIFfN22Vo8XJxUDvrWveq1aNTjmBK3hlJlBSLWOQIbjj4iAm0mLGYq1L7U9n14eFPSDLtBCYTDBKx9SgV3bCYML0TClkWvOrLYax5543jeGZysShMTJFHSinye32Q12Q8KAIb8Vaq7PtsROVvEJ+7/k1qD5arS8BNn5pe1MrFYEX/T9LiBnK6ukEUMC/P2qJAmdcVW35alfny1FYfDJuqY9Djd0pSIR5FyOae/mCwNmGaCs+UxQlUgOZUUIHDbEVd4xvmDdtAuDW8tTwQ/aIJwxbpznZhlpGO/hcLOzG/NT5CR7Ye5RLPYu4Ip/k7wgTjpuDayMl15JrWT8y00Fi3oBdixn4tBNunDeU96zS901tuSmZcAWGIMHxingEnP7HK0omzNrdObUgTPPbrMZjeDkwy97tCNcKDjnJFds0fouznX67iY69wCaGqd68oKo+Dn6pKa8T5zPwCMq5js5cf/LqqA8iVqJFxGZE8Wu/nuyxT07AoSLSRqxoH5iMgsfw+yOEW7hFw== X-Forefront-Antispam-Report: CIP:216.228.117.160;CTRY:US;LANG:en;SCL:1;SRV:;IPV:NLI;SFV:NSPM;H:mail.nvidia.com;PTR:dc6edge1.nvidia.com;CAT:NONE;SFS:(13230037)(82310400023)(1800799021)(376011)(36860700010);DIR:OUT;SFP:1101; X-OriginatorOrg: Nvidia.com X-MS-Exchange-CrossTenant-OriginalArrivalTime: 25 Jun 2024 12:08:50.8420 (UTC) X-MS-Exchange-CrossTenant-Network-Message-Id: 26008df8-1f78-4ee7-24f2-08dc950f9367 X-MS-Exchange-CrossTenant-Id: 43083d15-7273-40c1-b7db-39efd9ccc17a X-MS-Exchange-CrossTenant-OriginalAttributedTenantConnectingIp: TenantId=43083d15-7273-40c1-b7db-39efd9ccc17a;Ip=[216.228.117.160];Helo=[mail.nvidia.com] X-MS-Exchange-CrossTenant-AuthSource: DS1PEPF0001708F.namprd03.prod.outlook.com X-MS-Exchange-CrossTenant-AuthAs: Anonymous X-MS-Exchange-CrossTenant-FromEntityHeader: HybridOnPrem X-MS-Exchange-Transport-CrossTenantHeadersStamped: SJ0PR12MB6781 X-Patchwork-Delegate: kuba@kernel.org X-Patchwork-State: RFC Spectrum ASICs do not have queue per netdevice, so mlxsw driver does not have NAPI per netdevice, instead "dummy" netdevice is used. Lately, the driver started using page pool for buffers allocations, each Rx queue (RDQ) uses a dedicated page pool. To allow user to query page pool info and statistics, page pool should be attached to netdevice. Setting "dummy" netdevice as part of page pool parameters allows querying info about specific pool. Without this patch, "do" commands fail: $ ./tools/net/ynl/cli.py --spec Documentation/netlink/specs/netdev.yaml \ --do page-pool-get --json '{"id" : "20"}' --output-json Netlink error: No such file or directory nl_len = 36 (20) nl_flags = 0x100 nl_type = 2 error: -2 With this patch, user can query info of specific pool: $ ./tools/net/ynl/cli.py --spec Documentation/netlink/specs/netdev.yaml \ --do page-pool-get --json '{"id" : "20"}' --output-json {"id": 20, "ifindex": 0, "napi-id": 108, "inflight": 3072, "inflight-mem": 12582912} Note that this behavior works only in case that the devlink instance in the initial namespace, in case that the devlink instance is reloaded to another namesapce, get command will fail as the dummy netdevice associated with the pools belongs to the initial namespace. $ ip netns add pp_test $ devlink dev reload pci/0000:xx:00.0 netns pp_test $ ip netns exec pp_test ./tools/net/ynl/cli.py \ --spec Documentation/netlink/specs/netdev.yaml \ --do page-pool-stats-get --json '{"info" : {"id" : "20"}}' --output-json Netlink error: No such file or directory nl_len = 36 (20) nl_flags = 0x100 nl_type = 2 error: -2 A next patch will allow user use "dump" command also. Signed-off-by: Amit Cohen --- drivers/net/ethernet/mellanox/mlxsw/pci.c | 1 + 1 file changed, 1 insertion(+) diff --git a/drivers/net/ethernet/mellanox/mlxsw/pci.c b/drivers/net/ethernet/mellanox/mlxsw/pci.c index cb043379c01c..7abb4b2fe541 100644 --- a/drivers/net/ethernet/mellanox/mlxsw/pci.c +++ b/drivers/net/ethernet/mellanox/mlxsw/pci.c @@ -892,6 +892,7 @@ static int mlxsw_pci_cq_page_pool_init(struct mlxsw_pci_queue *q, pp_params.dev = &mlxsw_pci->pdev->dev; pp_params.napi = &q->u.cq.napi; pp_params.dma_dir = DMA_FROM_DEVICE; + pp_params.netdev = q->pci->napi_dev_rx; page_pool = page_pool_create(&pp_params); if (IS_ERR(page_pool)) From patchwork Tue Jun 25 12:08:07 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Amit Cohen X-Patchwork-Id: 13710970 X-Patchwork-Delegate: kuba@kernel.org Received: from NAM10-BN7-obe.outbound.protection.outlook.com (mail-bn7nam10on2050.outbound.protection.outlook.com [40.107.92.50]) (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 5A1501509A5 for ; Tue, 25 Jun 2024 12:08:58 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=fail smtp.client-ip=40.107.92.50 ARC-Seal: i=2; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1719317340; cv=fail; b=sNX2OMd5Lvc35pDAqbM5BbEPLv54StrgiR241l/lPPMWGZ2uQu9enGLcFvbhdYD7qkOgIFrcC+Gr73y59D31iceVtp2tKPlef8MB4ziuTPhx3SDtV7TEtob1yrPnquZI2EfchLcNhgljKqKE/CXH6U4+KzYyB8TPy50JPxq+Z9I= ARC-Message-Signature: i=2; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1719317340; c=relaxed/simple; bh=ITHFml1Qg7bjOnrrCohycqW+szqvdOWFbHGo1bR47tw=; h=From:To:CC:Subject:Date:Message-ID:In-Reply-To:References: MIME-Version:Content-Type; b=HJBD2oDRnBVnbrpgYMdEU+ytrJ3W/9VA68t9icFDQu4YOHbLkNCzpdc3oAmBIh+up543YD99z0bes738wRU5q0cF1eTyGPE/FX0gQYGQvojidgoyehhkhGWu65H3JbQocTIw3ib/A+PgxZsAHJLwksF888mRxWugH2Yq1O0c3GA= ARC-Authentication-Results: i=2; smtp.subspace.kernel.org; dmarc=pass (p=reject dis=none) header.from=nvidia.com; spf=fail smtp.mailfrom=nvidia.com; dkim=pass (2048-bit key) header.d=Nvidia.com header.i=@Nvidia.com header.b=Mv0h6IE9; arc=fail smtp.client-ip=40.107.92.50 Authentication-Results: smtp.subspace.kernel.org; dmarc=pass (p=reject dis=none) header.from=nvidia.com Authentication-Results: smtp.subspace.kernel.org; spf=fail smtp.mailfrom=nvidia.com Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=Nvidia.com header.i=@Nvidia.com header.b="Mv0h6IE9" ARC-Seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=l411CQxmyQv66s5H2zh40iP2ipiREafVUFFmAfR+cPbSlmLPo1koD/rc3xIIgSQ8dOD3pF+9dsRTMswVvumawqeqr4b6YEtbBaV1qv+KvSwKFXG4C+Z9mHiz3wgMI9Q/PvoCJv3P+cQbK6Cpb9mUD5JJ9Ksdm+veKcKWsRQRJoboID4ZnRdcxFiONY8A8K2Qm3rqf6WfCyUEqooslQH7k7PWSC1iXkNqCaxoq4sowEKFjDn6TU39yTlpO22epM1fnErvFOWiCxJwV8zI22LRHUiuM+rks/Tym3OXjuuK2Os0aJ7usLrRVy6ToZfWl/PXt1TbUN36wE/f5gw2oHYUnA== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=microsoft.com; s=arcselector9901; h=From:Date:Subject:Message-ID:Content-Type:MIME-Version:X-MS-Exchange-AntiSpam-MessageData-ChunkCount:X-MS-Exchange-AntiSpam-MessageData-0:X-MS-Exchange-AntiSpam-MessageData-1; bh=n7gHFfYA3swwjN1lpwyXmEZ63rXgWzCVnd8do4GX3nQ=; b=jXLoJRO4YKYGXUjzXl9LZb4EztNbssDpRzF/9MG523mSaF7V7yMTB/h3wvZBIEWc+WGtoKaPS3GS1QiHFTbcIpHAjwiWlQd/uHpmpQ32dyvX7hdURg49jJQCPGtZUDtPmGjFC5qNqmD667AiKiW/u5zMeQ0bYyZq5r1fFgTFWVrhz3CbwP4g3KDKN5ZLzW6VNA4WnQYPfX1K6E0J09Beb2bf1ufr65BRGVslh+bc731zBcuNDkxDaCN4Vao3uaj5KQ8At1QCD9nuGGTuh+i6z3uUpPkl6DBNqWbMoykkMeacHy+dfJa9PhMgmwUp+bdBcSvT/8l+MDyEJ3LtNuVdpg== ARC-Authentication-Results: i=1; mx.microsoft.com 1; spf=pass (sender ip is 216.228.117.161) smtp.rcpttodomain=kernel.org smtp.mailfrom=nvidia.com; dmarc=pass (p=reject sp=reject pct=100) action=none header.from=nvidia.com; dkim=none (message not signed); arc=none (0) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=Nvidia.com; s=selector2; h=From:Date:Subject:Message-ID:Content-Type:MIME-Version:X-MS-Exchange-SenderADCheck; bh=n7gHFfYA3swwjN1lpwyXmEZ63rXgWzCVnd8do4GX3nQ=; b=Mv0h6IE96RazihEFK2lDliI5SgMdfDXZxOlGEjvzJFRoeL2sXlwW2QsNtAhauY/Z9Kwk4nE2avoGCppD3/Ivis1VgFHcOlnukJrsIxGF+sf5mO1Brp7JutQz658k1Gxuq+OLlHaIWbMFP0VnDyPZuQ6jQCnnEo/au5e9AzppY/qtxnJio3agp3Qb/s1JiYQPJCVxMCuo0EE7t9jELhIgG1nsCqXAOMaBhNJGJsFkFVEUI0LEfL+NfzScc0BzhMyo7Uj4R47J//EAPvzA6setnSvdaocwy+ESj/KUp+jMnUXfeuxoKPSSDz+q/80MIEfLh0DP3uFEtWcdF1Uf6kKTdQ== Received: from BN8PR15CA0022.namprd15.prod.outlook.com (2603:10b6:408:c0::35) by SA3PR12MB9106.namprd12.prod.outlook.com (2603:10b6:806:37e::14) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.7698.30; Tue, 25 Jun 2024 12:08:54 +0000 Received: from BN1PEPF0000468E.namprd05.prod.outlook.com (2603:10b6:408:c0:cafe::98) by BN8PR15CA0022.outlook.office365.com (2603:10b6:408:c0::35) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.7677.38 via Frontend Transport; Tue, 25 Jun 2024 12:08:54 +0000 X-MS-Exchange-Authentication-Results: spf=pass (sender IP is 216.228.117.161) smtp.mailfrom=nvidia.com; dkim=none (message not signed) header.d=none;dmarc=pass action=none header.from=nvidia.com; Received-SPF: Pass (protection.outlook.com: domain of nvidia.com designates 216.228.117.161 as permitted sender) receiver=protection.outlook.com; client-ip=216.228.117.161; helo=mail.nvidia.com; pr=C Received: from mail.nvidia.com (216.228.117.161) by BN1PEPF0000468E.mail.protection.outlook.com (10.167.243.139) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.7677.15 via Frontend Transport; Tue, 25 Jun 2024 12:08:54 +0000 Received: from rnnvmail201.nvidia.com (10.129.68.8) by mail.nvidia.com (10.129.200.67) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.2.1544.4; Tue, 25 Jun 2024 05:08:38 -0700 Received: from dev-r-vrt-155.mtr.labs.mlnx (10.126.231.35) by rnnvmail201.nvidia.com (10.129.68.8) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.2.1544.4; Tue, 25 Jun 2024 05:08:34 -0700 From: Amit Cohen To: CC: , , , , , , , , Amit Cohen Subject: [PATCH RFC net-next 4/4] mlxsw: Set page pools list for netdevices Date: Tue, 25 Jun 2024 15:08:07 +0300 Message-ID: <20240625120807.1165581-5-amcohen@nvidia.com> X-Mailer: git-send-email 2.45.1 In-Reply-To: <20240625120807.1165581-1-amcohen@nvidia.com> References: <20240625120807.1165581-1-amcohen@nvidia.com> Precedence: bulk X-Mailing-List: netdev@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 X-ClientProxiedBy: rnnvmail202.nvidia.com (10.129.68.7) To rnnvmail201.nvidia.com (10.129.68.8) X-EOPAttributedMessage: 0 X-MS-PublicTrafficType: Email X-MS-TrafficTypeDiagnostic: BN1PEPF0000468E:EE_|SA3PR12MB9106:EE_ X-MS-Office365-Filtering-Correlation-Id: 0bbbd664-81f1-48c2-2102-08dc950f955d X-MS-Exchange-SenderADCheck: 1 X-MS-Exchange-AntiSpam-Relay: 0 X-Microsoft-Antispam: BCL:0;ARA:13230037|82310400023|1800799021|36860700010|376011; X-Microsoft-Antispam-Message-Info: 7nti1ca+zXzvNXepCpvkrpZEvw54udURs7e+JHXdKey9FxlxcMqzr9mh61OuzyDqCPaVVNOq9bUR3PqBPO2Uae7WreqMEKxJz/2/qqqxXPEGFHmDB8Q5W5JY9slzPBEcU7PZogRuvfIdujg/WvwBlXiRKLMw8JykItY/UHGeNnrhSqvoZtFvw2ToGXU6oUOFC7ZNWbSMV2dgN3z8HYCQFnO+82LI+3jADhI+meNt5+mIP4qu+FJc0EI7HWtg1zy/hpOpukOBNLa2tVa7TzTWZwqqxhohP4Fd/kMRkhpFEzqHQnUzwtNlTOLhaudRGuLZxU68P2y3/hcRWJTDOz3CJq41ldSMUxJRot/4X3F8497h8cXaKskqObuUfDHNViSyV8Ri/vzfRRRo9RUJE27iI1aDagajVqGnIhGRVHXygWq7PrlrkxFplOwt9RXHAfewTTq6j5ZQ48OrMn0hrz6HcQyW/Q5tAANzw43KzRGp3pe0nfRFU8kN0OvGp+Wmf8qmfHrblyc2NqymhgK9DjvQYQha4H08jOWzFPzZOjQAREUcmh17oYEvkV2xa3xpwi2hZCaiNeCnxPdK55CLrzTJ+C3aRm8cRe4tX+orZdWf2/3PZTzmDvmytnmj7Jz+PylZBRMFmZDN51QoZKo2DZmfQ2b4nE8kp20S4eatQFZKTRptcFCOVWu80d9GHcqio4TkXB9blnGUUswXhUk1XuvX86zr9ifJ3nXBnHCb2ClCO98Cbe7dKlzKFBmyVF6OD8qrNnombK4Zu8nKUJKSXxdpX6ihP9W05SHk/jpND9tnZDoxJcXMB0NdQm3nzomY8es/O7n3N/D4K2v7uVcJSykx/NMgECJl9dVwG88Sm4FQugOSbm/VImcQZr6260mNhKoS5Av9OGAZbTgas4aZ7D5mUnZopVORktqd/PtJvKUWL5sfnrZHSU33UAcRaR5O1MruKpPLzRwIyM2uGLf0qF8Kuft10sfR1a+t+EfpJBfIkARewQPvU9j+Dvcnp1JxvZNm/zll3pFd43C1XW4JS2t+Rv5zid2CLQvzEfIfEA/gwhtfuo4c2W0GGO0wKzpxFJDH2jMmo8XeHe7eIadC3LZh4g2UicfiCMGodD4f9+icSuI+hGEajWmnTTdfwM9tTK/KVQh6rHkj7RmOXdV2NEXxGWXUl/OtUs9L278dT3kCBO3NqQ3fPOuq/Ut94ctXhP8xTOA9kCaDggBwfkNu/pNbF6bwg3a+B/hOCqQBvtkCIo5WW/jd1Xd99TPjtBAPAAVVKicCdLatOyvSS3oOInltU/znEK0xiZ/mLXUkBZHQUIcZ2W8KPs3ErnoUaeRRDfHlech4ssOPXK0cA045PDNcboY7bo8BZ4OI3fa15uyBN6x97O4gJzHRyXprKT2zKXUUqTcmdx4qt2gucMW+LFi9WQ== X-Forefront-Antispam-Report: CIP:216.228.117.161;CTRY:US;LANG:en;SCL:1;SRV:;IPV:NLI;SFV:NSPM;H:mail.nvidia.com;PTR:dc6edge2.nvidia.com;CAT:NONE;SFS:(13230037)(82310400023)(1800799021)(36860700010)(376011);DIR:OUT;SFP:1101; X-OriginatorOrg: Nvidia.com X-MS-Exchange-CrossTenant-OriginalArrivalTime: 25 Jun 2024 12:08:54.0693 (UTC) X-MS-Exchange-CrossTenant-Network-Message-Id: 0bbbd664-81f1-48c2-2102-08dc950f955d X-MS-Exchange-CrossTenant-Id: 43083d15-7273-40c1-b7db-39efd9ccc17a X-MS-Exchange-CrossTenant-OriginalAttributedTenantConnectingIp: TenantId=43083d15-7273-40c1-b7db-39efd9ccc17a;Ip=[216.228.117.161];Helo=[mail.nvidia.com] X-MS-Exchange-CrossTenant-AuthSource: BN1PEPF0000468E.namprd05.prod.outlook.com X-MS-Exchange-CrossTenant-AuthAs: Anonymous X-MS-Exchange-CrossTenant-FromEntityHeader: HybridOnPrem X-MS-Exchange-Transport-CrossTenantHeadersStamped: SA3PR12MB9106 X-Patchwork-Delegate: kuba@kernel.org X-Patchwork-State: RFC Spectrum ASICs do not have queue per netdevice, so mlxsw driver does not have NAPI per netdevice, instead, "dummy" netdevice is used. Lately, the driver started using page pool for buffers allocations, each Rx queue (RDQ) uses a dedicated page pool. A previous patch uses "dummy" Rx netdevice as the netdevice of each allocated page pool. This will result "napi_dev_rx->page_pools" holding all the page pools which are used by the driver. Ideally, we would like to allow user to dump page pools - to get all the pools which are allocated from the driver for each netdevice, as each netdevice uses all the pools. For that, add bus operation to get 'hlist_head' of the "dummy" netdevice. Set this list head for all netdevices as part of port creation. With the previous patches which allow filling netlink with netdevice which holds the page pool in its list, now we can dump all page pools for each netdevice. Without this set, "dump" commands do not print page pools stats: $ ./tools/net/ynl/cli.py --spec Documentation/netlink/specs/netdev.yaml \ --dump page-pool-stats-get --output-json | jq [] With this set, "dump" commands print all the page pools for all the netdevices: $ ./tools/net/ynl/cli.py --spec Documentation/netlink/specs/netdev.yaml \ --dump page-pool-stats-get --output-json | jq [ ... { "info": { "id": 5, "ifindex": 64 }, "alloc-fast": 1434916, "alloc-slow": 49, .... "recycle-ring": 1454621, } ... ] $ ./tools/net/ynl/cli.py --spec Documentation/netlink/specs/netdev.yaml \ --dump page-pool-get --output-json | \ jq -e ".[] | select(.ifindex == 64)" | grep "napi-id" | wc -l 56 Note that CONFIG_PAGE_POOL_STATS should be enabled to get statistics. Signed-off-by: Amit Cohen --- drivers/net/ethernet/mellanox/mlxsw/core.c | 6 ++++++ drivers/net/ethernet/mellanox/mlxsw/core.h | 2 ++ drivers/net/ethernet/mellanox/mlxsw/pci.c | 8 ++++++++ drivers/net/ethernet/mellanox/mlxsw/spectrum.c | 2 ++ 4 files changed, 18 insertions(+) diff --git a/drivers/net/ethernet/mellanox/mlxsw/core.c b/drivers/net/ethernet/mellanox/mlxsw/core.c index 4a79c0d7e7ad..15b367b37ba9 100644 --- a/drivers/net/ethernet/mellanox/mlxsw/core.c +++ b/drivers/net/ethernet/mellanox/mlxsw/core.c @@ -2337,6 +2337,12 @@ int mlxsw_core_skb_transmit(struct mlxsw_core *mlxsw_core, struct sk_buff *skb, } EXPORT_SYMBOL(mlxsw_core_skb_transmit); +struct hlist_head mlxsw_core_page_pools_head(struct mlxsw_core *mlxsw_core) +{ + return mlxsw_core->bus->page_pools_head(mlxsw_core->bus_priv); +} +EXPORT_SYMBOL(mlxsw_core_page_pools_head); + void mlxsw_core_ptp_transmitted(struct mlxsw_core *mlxsw_core, struct sk_buff *skb, u16 local_port) { diff --git a/drivers/net/ethernet/mellanox/mlxsw/core.h b/drivers/net/ethernet/mellanox/mlxsw/core.h index 6d11225594dd..9925f541ed50 100644 --- a/drivers/net/ethernet/mellanox/mlxsw/core.h +++ b/drivers/net/ethernet/mellanox/mlxsw/core.h @@ -95,6 +95,7 @@ bool mlxsw_core_skb_transmit_busy(struct mlxsw_core *mlxsw_core, const struct mlxsw_tx_info *tx_info); int mlxsw_core_skb_transmit(struct mlxsw_core *mlxsw_core, struct sk_buff *skb, const struct mlxsw_tx_info *tx_info); +struct hlist_head mlxsw_core_page_pools_head(struct mlxsw_core *mlxsw_core); void mlxsw_core_ptp_transmitted(struct mlxsw_core *mlxsw_core, struct sk_buff *skb, u16 local_port); @@ -498,6 +499,7 @@ struct mlxsw_bus { u32 (*read_utc_nsec)(void *bus_priv); enum mlxsw_cmd_mbox_config_profile_lag_mode (*lag_mode)(void *bus_priv); enum mlxsw_cmd_mbox_config_profile_flood_mode (*flood_mode)(void *priv); + struct hlist_head (*page_pools_head)(void *bus_priv); u8 features; }; diff --git a/drivers/net/ethernet/mellanox/mlxsw/pci.c b/drivers/net/ethernet/mellanox/mlxsw/pci.c index 7abb4b2fe541..16516ae6a818 100644 --- a/drivers/net/ethernet/mellanox/mlxsw/pci.c +++ b/drivers/net/ethernet/mellanox/mlxsw/pci.c @@ -2179,6 +2179,13 @@ mlxsw_pci_flood_mode(void *bus_priv) return mlxsw_pci->flood_mode; } +static struct hlist_head mlxsw_pci_page_pools_head(void *bus_priv) +{ + struct mlxsw_pci *mlxsw_pci = bus_priv; + + return mlxsw_pci->napi_dev_rx->page_pools; +} + static const struct mlxsw_bus mlxsw_pci_bus = { .kind = "pci", .init = mlxsw_pci_init, @@ -2192,6 +2199,7 @@ static const struct mlxsw_bus mlxsw_pci_bus = { .read_utc_nsec = mlxsw_pci_read_utc_nsec, .lag_mode = mlxsw_pci_lag_mode, .flood_mode = mlxsw_pci_flood_mode, + .page_pools_head = mlxsw_pci_page_pools_head, .features = MLXSW_BUS_F_TXRX | MLXSW_BUS_F_RESET, }; diff --git a/drivers/net/ethernet/mellanox/mlxsw/spectrum.c b/drivers/net/ethernet/mellanox/mlxsw/spectrum.c index f064789f3240..3c78690c248f 100644 --- a/drivers/net/ethernet/mellanox/mlxsw/spectrum.c +++ b/drivers/net/ethernet/mellanox/mlxsw/spectrum.c @@ -1826,6 +1826,7 @@ static int mlxsw_sp_port_create(struct mlxsw_sp *mlxsw_sp, u16 local_port, goto err_register_netdev; } + dev->page_pools = mlxsw_core_page_pools_head(mlxsw_sp->core); mlxsw_core_schedule_dw(&mlxsw_sp_port->periodic_hw_stats.update_dw, 0); return 0; @@ -1880,6 +1881,7 @@ static void mlxsw_sp_port_remove(struct mlxsw_sp *mlxsw_sp, u16 local_port) u8 module = mlxsw_sp_port->mapping.module; cancel_delayed_work_sync(&mlxsw_sp_port->periodic_hw_stats.update_dw); + INIT_HLIST_HEAD(&mlxsw_sp_port->dev->page_pools); /* Reset list head. */ cancel_delayed_work_sync(&mlxsw_sp_port->ptp.shaper_dw); unregister_netdev(mlxsw_sp_port->dev); /* This calls ndo_stop */ mlxsw_sp_port_ptp_clear(mlxsw_sp_port);