From patchwork Tue Oct 18 14:18:54 2022 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Ioana Ciornei X-Patchwork-Id: 13010625 X-Patchwork-Delegate: kuba@kernel.org Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by smtp.lore.kernel.org (Postfix) with ESMTP id CE7CBC4332F for ; Tue, 18 Oct 2022 14:20:06 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S231150AbiJROUD (ORCPT ); Tue, 18 Oct 2022 10:20:03 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:43992 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S231297AbiJROT4 (ORCPT ); Tue, 18 Oct 2022 10:19:56 -0400 Received: from EUR02-AM5-obe.outbound.protection.outlook.com (mail-eopbgr00079.outbound.protection.outlook.com [40.107.0.79]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id B5475209B1; Tue, 18 Oct 2022 07:19:42 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=jPI5ytIKSR5ONuyjOydditwVyZFn6TqH68+jfjbObp5cg/MYW32WH14qgasYoGy8yKNLjzgGiryNZ8P4uoEH9pinJP2GN/NLdTciYP0PcwVtF/FmMlV21xO3mp2zdBcJruvKIxDhu0Y151vZ+j5ApVANEUyC5qc9iPz1zpwPdj82O6suqcX6Y03NineLYioVwWkA6uHpeUVh+eGlVr8O15FelyTWmb2BnE4tsM9LXJY9yymR/AQ/TKeblSCGda2kUkdvrkzd5YQVWbTVn/2V+/rNDUph4Cx36hfcg1g1RCZtocGIxIbyQcQy+3bQ5sn+8wqWsoBlGPwlht7u9x+U9Q== 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=om5/3Fa3Ngt/89BgxRVnuJSUI+YwVvLUV4H0kVUeAmU=; b=n1qSg9naPW0kV6yjjXBjXv4BfPLgFHsVeEStAbTQpXpqyRWkclpz0beSADWGtB/emDAM5Wb0/nKSnx+e2FhjxUecb2PdbYw2K4JbB7L/dJUyxmSBVfihjQs3K+nSRdxXPGwSsJrJPleB3OumNmQjUlI5YeVEjZtweWWZvU3ywLY6nkTY/IabISd8i+WduCmU8qY39Di9A/z6jcdmMhm0jYXV6YQXYzQI98qRs88hVGhx/U+AuLEekS4HaXiEHxti6+DTYF2QJXndZ9ljtr2AvaLzCMpF2W/tKULBesaU6YYa2prJ3XNOAoQKxfvCon8UK4VAnTiGNOsCEvZjjXMwtA== ARC-Authentication-Results: i=1; mx.microsoft.com 1; spf=pass smtp.mailfrom=nxp.com; dmarc=pass action=none header.from=nxp.com; dkim=pass header.d=nxp.com; arc=none DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=nxp.com; s=selector2; h=From:Date:Subject:Message-ID:Content-Type:MIME-Version:X-MS-Exchange-SenderADCheck; bh=om5/3Fa3Ngt/89BgxRVnuJSUI+YwVvLUV4H0kVUeAmU=; b=dCanRQ8F7QJkeBS+WlZBsRTKMtkJL7qIwJNWt7Zy/V/fbosks76SSayDEx4AWgnD/PhFqj78lg5K9JYB45hEpvuKMbvGPijLWQvQ4SxjIOua/lrj1GVhY6whY4VuSbTP34COGo2DgY1fVycidYKtI6vnWqB27sFD24Xd3UGLmYA= Authentication-Results: dkim=none (message not signed) header.d=none;dmarc=none action=none header.from=nxp.com; Received: from GV1PR04MB9055.eurprd04.prod.outlook.com (2603:10a6:150:1e::22) by DU2PR04MB9145.eurprd04.prod.outlook.com (2603:10a6:10:2f4::16) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.5723.26; Tue, 18 Oct 2022 14:19:35 +0000 Received: from GV1PR04MB9055.eurprd04.prod.outlook.com ([fe80::84a:2f01:9d76:3ff7]) by GV1PR04MB9055.eurprd04.prod.outlook.com ([fe80::84a:2f01:9d76:3ff7%7]) with mapi id 15.20.5723.033; Tue, 18 Oct 2022 14:19:34 +0000 From: Ioana Ciornei To: "David S. Miller" , Eric Dumazet , Jakub Kicinski , Paolo Abeni , netdev@vger.kernel.org Cc: Alexei Starovoitov , Daniel Borkmann , Jesper Dangaard Brouer , John Fastabend , bpf@vger.kernel.org Subject: [PATCH net-next v3 05/12] net: dpaa2-eth: export buffer pool info into a new debugfs file Date: Tue, 18 Oct 2022 17:18:54 +0300 Message-Id: <20221018141901.147965-6-ioana.ciornei@nxp.com> X-Mailer: git-send-email 2.25.1 In-Reply-To: <20221018141901.147965-1-ioana.ciornei@nxp.com> References: <20221018141901.147965-1-ioana.ciornei@nxp.com> X-ClientProxiedBy: AS4PR10CA0002.EURPRD10.PROD.OUTLOOK.COM (2603:10a6:20b:5dc::19) To GV1PR04MB9055.eurprd04.prod.outlook.com (2603:10a6:150:1e::22) MIME-Version: 1.0 X-MS-PublicTrafficType: Email X-MS-TrafficTypeDiagnostic: GV1PR04MB9055:EE_|DU2PR04MB9145:EE_ X-MS-Office365-Filtering-Correlation-Id: ba211b2b-8596-42b2-e6aa-08dab113c81f X-MS-Exchange-SenderADCheck: 1 X-MS-Exchange-AntiSpam-Relay: 0 X-Microsoft-Antispam: BCL:0; X-Microsoft-Antispam-Message-Info: o1Fpb6MbuuRjTXpJUJcFALldIl8b3cgt+K4ocu9bz6R3EyDW+yTsaa+xLrQAZ/Z4Iz4xQOI2p9oBdPJH6uvxTUWUelT0lmun1LVwoPyRYydYEG8c/eTE8Vv/CwFjT71ZMCmkYfZMgFki4yOOrSp9z82+x6gPO/zowHv/EkFYY2Bz+9P+64ezjk+HyrivNUXNyTikwwvRXrUZGJd07V3PhZtKDO5OCimj69CS25Rva8IfJfqmode9SEIpk9IvX17kneO4O6h3DHuKqZeQVa1WET4xupXZfFWbAg3kKnZ80S2w5026tR6Bk56+LLEwVTkkvUMzwNnPs9EGZQ4e7SnJgl9vBpJ2VWMYrtAQTCWPBGdFyFi8S+nP6U14k+Ree5YIShQW/avn12aRQ2/KzzKiY10H2kztLpvbahUTAv5mRnUIgj6r2R4Z0fQOX/OP6Cs61oV5wBMGTBlRx/tjsoHTQOFWL19UdPetujJdp1/dvL2ZSyg0nx65b7SsWf4jiTddSD6wjn/m9k6n2nF9snR+tKa3IGj49zisXv4iMMF0/4xroMD+lN4BI5r8nADlMXV47BTJshBewJu3iO77JaoQub9+vXF0PYjAaZ1YLQf1RuuIyxDSky6RI2xL/ah7sNkdSZFw/cRpxS5/MLRRqiqD+vsEGTyNlJwRadm+966luySdChg94NWV0fn3MSFgi5R6BNUskYvfj4ZtqHxnemkFnaSulAHsi5NgezYZKJd/l8MA+KHLOtE04bsHatMUN/c0FjpalQzqniiMKv+DB4ucJA== X-Forefront-Antispam-Report: CIP:255.255.255.255;CTRY:;LANG:en;SCL:1;SRV:;IPV:NLI;SFV:NSPM;H:GV1PR04MB9055.eurprd04.prod.outlook.com;PTR:;CAT:NONE;SFS:(13230022)(4636009)(366004)(396003)(136003)(376002)(346002)(39860400002)(451199015)(110136005)(6486002)(54906003)(6506007)(478600001)(26005)(36756003)(2906002)(44832011)(6512007)(38350700002)(38100700002)(316002)(4326008)(6666004)(8676002)(186003)(66556008)(52116002)(7416002)(41300700001)(8936002)(5660300002)(2616005)(66476007)(86362001)(66946007)(1076003);DIR:OUT;SFP:1101; X-MS-Exchange-AntiSpam-MessageData-ChunkCount: 1 X-MS-Exchange-AntiSpam-MessageData-0: piNOERr8Z2Ivwy84ZESCV8P+WuUjI5eF1JUhBw+68jX9cUAq1M+nBAFLjO6cGMdDQ3ndbT9MIPUmBzb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HtDEdwhNvwXNmlF3xxNWBIA6gZHA5Nvld4vRTAFzQWEDhGCWv/Av8TS+lDSK3x3fh5ufcdRLeNA/zjm7CYvT9m9L05BpwtuOTXkQHvwfZ91lyFbnf8V/L+iqS5lfbTBQ1lgOoG8pP6yEVSWWo9U6HPwuGZkx5OMgQefB1BQs7SU5ls6nwOLPfPc+hmlSms5MYe/mZlDsOhhuA02wStWDfy31ILCAlX5GbG9aVGq6TAvYAkcjSrCRBMDwgrU9ydnaHYiUUT+7k8ADqsc1aGuyui9Od/CyLNHmL85QPFtvVdU6lv/FUGRu5OgYtK0s5qtQgL7iER/xA+788Bcs+Suy9N2ACoHwT7U3tYoGNc54Nq8EpzstrYVE3UlvUA7TmWD2xLSQSu210YRQN2imUWjvC9oX+mOeCBd8DQKzJ2/7S97wzgklKfcW/8s8jAPaS X-OriginatorOrg: nxp.com X-MS-Exchange-CrossTenant-Network-Message-Id: ba211b2b-8596-42b2-e6aa-08dab113c81f X-MS-Exchange-CrossTenant-AuthSource: GV1PR04MB9055.eurprd04.prod.outlook.com X-MS-Exchange-CrossTenant-AuthAs: Internal X-MS-Exchange-CrossTenant-OriginalArrivalTime: 18 Oct 2022 14:19:34.8874 (UTC) X-MS-Exchange-CrossTenant-FromEntityHeader: Hosted X-MS-Exchange-CrossTenant-Id: 686ea1d3-bc2b-4c6f-a92c-d99c5c301635 X-MS-Exchange-CrossTenant-MailboxType: HOSTED X-MS-Exchange-CrossTenant-UserPrincipalName: zZEE5JSPn8C+zLyy3F6E/IA/OT9PqAnDvotoB99jFpDRDsS0Y7tyIvtW/vf4cU7/VzfSBaf5Ftka9REoDhrYDw== X-MS-Exchange-Transport-CrossTenantHeadersStamped: DU2PR04MB9145 Precedence: bulk List-ID: X-Mailing-List: netdev@vger.kernel.org X-Patchwork-Delegate: kuba@kernel.org Export the allocated buffer pools, the number of buffers that they have currently and which channels are using which BP. The output looks like below: Buffer pool info for eth2: IDX BPID Buf count CH#0 CH#1 CH#2 CH#3 BP#0 1 5124 x x x x Signed-off-by: Ioana Ciornei --- Changes in v2: - none Changes in v3: - none .../freescale/dpaa2/dpaa2-eth-debugfs.c | 49 +++++++++++++++++++ 1 file changed, 49 insertions(+) diff --git a/drivers/net/ethernet/freescale/dpaa2/dpaa2-eth-debugfs.c b/drivers/net/ethernet/freescale/dpaa2/dpaa2-eth-debugfs.c index 54e7fcf95c89..1af254caeb0d 100644 --- a/drivers/net/ethernet/freescale/dpaa2/dpaa2-eth-debugfs.c +++ b/drivers/net/ethernet/freescale/dpaa2/dpaa2-eth-debugfs.c @@ -119,6 +119,51 @@ static int dpaa2_dbg_ch_show(struct seq_file *file, void *offset) DEFINE_SHOW_ATTRIBUTE(dpaa2_dbg_ch); +static int dpaa2_dbg_bp_show(struct seq_file *file, void *offset) +{ + struct dpaa2_eth_priv *priv = (struct dpaa2_eth_priv *)file->private; + int i, j, num_queues, buf_cnt; + struct dpaa2_eth_bp *bp; + char ch_name[10]; + int err; + + /* Print out the header */ + seq_printf(file, "Buffer pool info for %s:\n", priv->net_dev->name); + seq_printf(file, "%s %10s%15s", "IDX", "BPID", "Buf count"); + num_queues = dpaa2_eth_queue_count(priv); + for (i = 0; i < num_queues; i++) { + snprintf(ch_name, sizeof(ch_name), "CH#%d", i); + seq_printf(file, "%10s", ch_name); + } + seq_printf(file, "\n"); + + /* For each buffer pool, print out its BPID, the number of buffers in + * that buffer pool and the channels which are using it. + */ + for (i = 0; i < priv->num_bps; i++) { + bp = priv->bp[i]; + + err = dpaa2_io_query_bp_count(NULL, bp->bpid, &buf_cnt); + if (err) { + netdev_warn(priv->net_dev, "Buffer count query error %d\n", err); + return err; + } + + seq_printf(file, "%3s%d%10d%15d", "BP#", i, bp->bpid, buf_cnt); + for (j = 0; j < num_queues; j++) { + if (priv->channel[j]->bp == bp) + seq_printf(file, "%10s", "x"); + else + seq_printf(file, "%10s", ""); + } + seq_printf(file, "\n"); + } + + return 0; +} + +DEFINE_SHOW_ATTRIBUTE(dpaa2_dbg_bp); + void dpaa2_dbg_add(struct dpaa2_eth_priv *priv) { struct fsl_mc_device *dpni_dev; @@ -139,6 +184,10 @@ void dpaa2_dbg_add(struct dpaa2_eth_priv *priv) /* per-fq stats file */ debugfs_create_file("ch_stats", 0444, dir, priv, &dpaa2_dbg_ch_fops); + + /* per buffer pool stats file */ + debugfs_create_file("bp_stats", 0444, dir, priv, &dpaa2_dbg_bp_fops); + } void dpaa2_dbg_remove(struct dpaa2_eth_priv *priv)