From patchwork Fri Sep 23 15:45:45 2022 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Ioana Ciornei X-Patchwork-Id: 12986705 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 469C9C6FA82 for ; Fri, 23 Sep 2022 15:47:20 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S232699AbiIWPrQ (ORCPT ); Fri, 23 Sep 2022 11:47:16 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:50484 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S230431AbiIWPqo (ORCPT ); Fri, 23 Sep 2022 11:46:44 -0400 Received: from EUR01-VE1-obe.outbound.protection.outlook.com (mail-eopbgr140041.outbound.protection.outlook.com [40.107.14.41]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 9AB21EEEA9; Fri, 23 Sep 2022 08:46:43 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=n6TaFk/BGxquJbGNtQPjJOzRFMg9eVOIGuzJ19BcWESlIekHlB2CS2MOQpwWK9nPXI0G01Y1bfFNrAOuzYdQwGf6ewwDnQTeAfvrcDxvnSpBip87YdWMxaags/mLgYA3vGrK+2za3SS/1Tb5KkePTezntTjFwhLrlU24Lno6mhxqiLZqzJ3F/eUC/arS24b9K77qgbJncCSWfTt9sJi6nGLMLrojtYAM/5hLvBCvQAw+h1t9h00GEwGir5A+IgHRkYtAL3jVI+6lhZU5MHKzS4z8lPvQMQoqhSOwf7ZuOFJCamR5+FpsNvDWl4zaq7XbZh5l6bTCbu4rbr/cQIrCTQ== 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=+8eJ7yWHziSfb726kvIjhWxXFJ9cMO8kur2oOM8JYcA=; b=P0PxO0tWufFcnPoTgv4LVdHKMCGwIGh1XGm20xH0eFoMjh2glgE1lOGGRYY8AUS7IX4TSA6EJWpnpmcjadeGmxWUwtwljx+SOCmEyUh+y/o3XjWqcPWvwtPHvuLIFaTeINd+Lofkbl0njROpYQgmNUnQ/e41QzYGLpbS5AGdyLROQ29mayZquH1Ot4VPu5Y3pkghnEVwhiyr94FF5cUs/btPckdFaw5QbxRc0XonQFd+zUByID1Gopspi8heoxNldjKZikClzXsUM5q6wsyeD/Yhlk9LVt7lx9XwvGhiOEZw/5xz8vV1+wQ1KXWFQLABvr9lIhmVTZAZN+m7w9ciEw== 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=+8eJ7yWHziSfb726kvIjhWxXFJ9cMO8kur2oOM8JYcA=; b=IElYZjRmXVgyR+7pIMwaZ91Ehjq/fxXq3reWnsbBKhBsJQRKs0kBogb+EFQKGaHgz+t2HzkRs95fPkCaK3bEX36LE5h1Eb4hYJcK4hKX875F6T75TM9UO0pVelgeAPCr3trv62cUKqi5jsKeR2D065dG/ozuj4WOA7hFtcYfPjw= 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 AS8PR04MB8996.eurprd04.prod.outlook.com (2603:10a6:20b:42f::22) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.5654.20; Fri, 23 Sep 2022 15:46:39 +0000 Received: from GV1PR04MB9055.eurprd04.prod.outlook.com ([fe80::dd0b:d481:bc5a:9f15]) by GV1PR04MB9055.eurprd04.prod.outlook.com ([fe80::dd0b:d481:bc5a:9f15%4]) with mapi id 15.20.5654.018; Fri, 23 Sep 2022 15:46:39 +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, Robert-Ionut Alexa , Ioana Ciornei Subject: [PATCH net-next v2 01/12] net: dpaa2-eth: add support to query the number of queues through ethtool Date: Fri, 23 Sep 2022 18:45:45 +0300 Message-Id: <20220923154556.721511-2-ioana.ciornei@nxp.com> X-Mailer: git-send-email 2.25.1 In-Reply-To: <20220923154556.721511-1-ioana.ciornei@nxp.com> References: <20220923154556.721511-1-ioana.ciornei@nxp.com> X-ClientProxiedBy: AM3PR05CA0152.eurprd05.prod.outlook.com (2603:10a6:207:3::30) To GV1PR04MB9055.eurprd04.prod.outlook.com (2603:10a6:150:1e::22) MIME-Version: 1.0 X-MS-PublicTrafficType: Email X-MS-TrafficTypeDiagnostic: GV1PR04MB9055:EE_|AS8PR04MB8996:EE_ X-MS-Office365-Filtering-Correlation-Id: 3c0f2288-d524-4985-1068-08da9d7ace1b X-MS-Exchange-SenderADCheck: 1 X-MS-Exchange-AntiSpam-Relay: 0 X-Microsoft-Antispam: BCL:0; X-Microsoft-Antispam-Message-Info: XqcrJuNLZKcHog6ATpCmR1EKNBFO3K98tg4TT3Atff6NWlGM6v2B81ygQAGD3U2mHn0/8EOo9X38APTZAX8dDf9P2Axxc/bmbHClR2bK6d0VnPyrXjEikotV2erooYPooHSE2r+68dFVWexkjI2E+bXiaDzmN/hS6GADJhATEsJKfXbYJTRf6oebPdg9uFyJ+opzJMff25d9mVGyUBxoTmJm1PzwLz7G2/EsY6ZB1P9otuAWLLZLoxvKGIexArazwJNWf5l+Qk7ijbusE1UUQBU7Urd3N+tCrDQVIY+AQJ6jbshZhGqwfIEUOxPpZY/3g/ilwnZh0Q2693Rn/WLAYPh9OjLBoi/emC2cIYnRSKk4w2ZjMQulmhiuARcmoSegP8fb37fA5C2Ld3qVaXEPeuccBVSb5Mc21ITIrVkXasmCCvrMmaWCezqLClE9ixT6/NkjlGfZLbYRs94wFm74wSeduc7lu7WInGNYyAJNCEhCSd4E6VJM4NyeO2q9Qqyw+vb04vClD/XVvDuQU2PXM/0RPWtrf3Bx5DGn6fGgJ6LCTu/cwmbUiXiKyrkE7DFZ5uoBu31Jfk4B+8VrKWF3QA79yTCEtUO9L1z85WhscVRxwujcRrmcAzYjJP1Xt0V0h6MlfznbzZ9DQph/bR47T3yYp77Rcr9Nb4WcUroZpxgkhsdrHs6ilZIfOfy9XvJd1feHI5olrV2ZaRkJHfTIJzH4d7OR2N7SxEd93aZYp2fxMG8gKTttt6MS1SfPd/uBOvdQuT3Rp++ndDRnXRMg8A== 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)(136003)(396003)(346002)(376002)(366004)(39860400002)(451199015)(6486002)(36756003)(316002)(54906003)(2616005)(4326008)(38350700002)(1076003)(38100700002)(6512007)(26005)(86362001)(52116002)(66476007)(110136005)(186003)(6506007)(83380400001)(6666004)(66946007)(2906002)(66556008)(478600001)(8676002)(41300700001)(5660300002)(44832011)(8936002)(7416002);DIR:OUT;SFP:1101; X-MS-Exchange-AntiSpam-MessageData-ChunkCount: 1 X-MS-Exchange-AntiSpam-MessageData-0: vFeVuvcHgEd7QUrw37za5aWuvUC+IsgASddXCrevIGNI6jUGjZiJYMcGBuGldlbgJuz5L8WWeCgTQ1IUft0Mei2gvQw+mSVMKUkm4ELP1/yfznIpY23O5gvJelhMKVWQ8Z91eBqKFCF0NV0VhxW8rFbCbnsFBy1jNcvgLoKJfPaO0kIPkI+mlQgl5k2NSATFBkbxA3BbzIlpw5JS+QtMCPdyex8JvbdLIrHj/JqdBpAN+3GvGzAIozz99+iB5N68h4Cr0FVhyhxL8asnonTspYcvl27g3hs9LSByBbtia2wf1YIFfy8q/uAP7Ql2VcK26mDG48XuTbRkrjXjruDQ4fEuQ9azj+PUHxqI2NPChP5TsS7m/dXkoopWalq8DNNLDI47rPYUp/Xm+8ve2G46J9joOZksf+E9P5GHIHh8MyOarsz3x7zgBuqh89OPUc15fjmV89O12LnN4XP+cucqQoIXFYRCs9dV+kIIkVNXte2NTfUyY4QSVGDB37hDhlhmXZxjTYS9K7RFllT71EgXtxu1YYRapNbZEv8Hxvws3Xp/ZTh/qtMmYvueVSJ/uWK2q0YjLkEClxRJuZtSXu8Y7gRYbXBmT9PCJVhV15z2Cd+LfSxgeMDv76oNZwvUSKIn0Zh4Vp/qV3jS2urlMHF7QYaoHYGp0JHBDwEgWH3YABxNKpRPhhN4vQlzlq58faI3lpijwd8TrFNAfRHteoazBkiCThRVch2lkF+3uotNua7D6rP6X8Ig55Gd5WLjPElEFWj8gW9KC+nvfZFMfpUCJQ3FznJlKLyFl7fyBASf6ljJ4jglco6EGJylH+t0HnooZsYSmdmMan/KsVZFN1Xk/t7N6HkAu91NJu/MavYE96dVRPrMb2d0ABWIxrgeuhp09emoahbMvFOSqbX5jHfz4j7xgKMjne74qtIgPVK1BWcSnq+FhOjw+rR04+ZTl36Wy+RyiZYwezP8jlgkMUVOAQu5+0tcP1Y5YT+i6qx7JHQZEDKpUwvgBdHNdXV9OywgRkfMO2BV3SilczCup3IAJu5fc0JP3iOkMs8wXpmbRbua6C+axbHMCosmGw3wDctelLgWyzFdnSCKpZuDXmfY9C9YYDLs4IFwS/MsKju/F788YBoz86yZfvQLvJ31foNYirFNhPAWOpHHOBk7eCqpTKTF/USMpxZG/Kq3kkizOev2RbCNBvf4wJvZYRtEgpYSHOPVu4txxyZ2IIoj25mAsO8w/45G0sCcN3xanEPRNNbUWcsOCkX0CNyaMqMB/O0HacewDhHvNHvgFGucRcDO8zjY8RlLghTICgLT3iEzS+mbnOLfO9Gi+w8pskKfLHVlEKYaBCEAXWqW2hZe5uQEstLc8Rgjerw+/45GS34xHMOWH7kUP5YbgcnyGsag276NFvl5EzxloPdegAoa949wt3L2I6toZRh8p782YuFc+n8OAGqwo5FLkFJHNW60PMPmLH1yFrJnI7bFBjDKYhywPf+0ZrgAm4vsXDk05cuOQmfgH8pQE9bzOBtjTMHcIl4n6HCYuqd9WXkYqr1U7yYDECt/YCraQRR03RHQn2dh/EC5WY6T2jNE+OkQGRGNUdBg X-OriginatorOrg: nxp.com X-MS-Exchange-CrossTenant-Network-Message-Id: 3c0f2288-d524-4985-1068-08da9d7ace1b X-MS-Exchange-CrossTenant-AuthSource: GV1PR04MB9055.eurprd04.prod.outlook.com X-MS-Exchange-CrossTenant-AuthAs: Internal X-MS-Exchange-CrossTenant-OriginalArrivalTime: 23 Sep 2022 15:46:39.7374 (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: xUabvRsaYFh7h4E76IFZDjYu2J6GD+1S8Cs5tCwplxbTCh7ZeRiqDZDqe21DjTuSJYRk5xCpM7dF6AkfhKqpxw== X-MS-Exchange-Transport-CrossTenantHeadersStamped: AS8PR04MB8996 Precedence: bulk List-ID: X-Mailing-List: netdev@vger.kernel.org X-Patchwork-Delegate: kuba@kernel.org From: Robert-Ionut Alexa The .get_channels() ethtool_ops callback is implemented and exports the number of queues: Rx, Tx, Tx conf and Rx err. The last two ones, Tx confirmation and Rx err, are counted as 'others'. The .set_channels() callback is not implemented since the DPAA2 software/firmware architecture does not allow the dynamic reconfiguration of the number of queues. Signed-off-by: Robert-Ionut Alexa Signed-off-by: Ioana Ciornei --- Changes in v2: - none .../ethernet/freescale/dpaa2/dpaa2-ethtool.c | 27 +++++++++++++++++-- 1 file changed, 25 insertions(+), 2 deletions(-) diff --git a/drivers/net/ethernet/freescale/dpaa2/dpaa2-ethtool.c b/drivers/net/ethernet/freescale/dpaa2/dpaa2-ethtool.c index eea7d7a07c00..97ec2adf5dc5 100644 --- a/drivers/net/ethernet/freescale/dpaa2/dpaa2-ethtool.c +++ b/drivers/net/ethernet/freescale/dpaa2/dpaa2-ethtool.c @@ -1,7 +1,6 @@ // SPDX-License-Identifier: (GPL-2.0+ OR BSD-3-Clause) /* Copyright 2014-2016 Freescale Semiconductor Inc. - * Copyright 2016 NXP - * Copyright 2020 NXP + * Copyright 2016-2022 NXP */ #include @@ -876,6 +875,29 @@ static int dpaa2_eth_set_coalesce(struct net_device *dev, return err; } +static void dpaa2_eth_get_channels(struct net_device *net_dev, + struct ethtool_channels *channels) +{ + struct dpaa2_eth_priv *priv = netdev_priv(net_dev); + int queue_count = dpaa2_eth_queue_count(priv); + + channels->max_rx = queue_count; + channels->max_tx = queue_count; + channels->rx_count = queue_count; + channels->tx_count = queue_count; + + /* Tx confirmation and Rx error */ + channels->max_other = queue_count + 1; + channels->max_combined = channels->max_rx + + channels->max_tx + + channels->max_other; + /* Tx conf and Rx err */ + channels->other_count = queue_count + 1; + channels->combined_count = channels->rx_count + + channels->tx_count + + channels->other_count; +} + const struct ethtool_ops dpaa2_ethtool_ops = { .supported_coalesce_params = ETHTOOL_COALESCE_RX_USECS | ETHTOOL_COALESCE_USE_ADAPTIVE_RX, @@ -896,4 +918,5 @@ const struct ethtool_ops dpaa2_ethtool_ops = { .set_tunable = dpaa2_eth_set_tunable, .get_coalesce = dpaa2_eth_get_coalesce, .set_coalesce = dpaa2_eth_set_coalesce, + .get_channels = dpaa2_eth_get_channels, }; From patchwork Fri Sep 23 15:45:46 2022 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Ioana Ciornei X-Patchwork-Id: 12986704 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 666D6C6FA82 for ; Fri, 23 Sep 2022 15:47:16 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S232684AbiIWPrO (ORCPT ); Fri, 23 Sep 2022 11:47:14 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:48564 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S230256AbiIWPqq (ORCPT ); Fri, 23 Sep 2022 11:46:46 -0400 Received: from EUR01-VE1-obe.outbound.protection.outlook.com (mail-eopbgr140041.outbound.protection.outlook.com [40.107.14.41]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 1DBDFCC8D8; Fri, 23 Sep 2022 08:46:44 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=J4bneLF4s2WBtPC9rtRau8+BRhB6pFujaFmNedNiZUmXPNzLHUDiDJpR9s4ru/tviKntDU7gD1sfMYRAiIxG1pAwZoCm/e+oqUXvEYYpA+mXS6SlYrFc0peccvJKTVC0B3k7Ibt1mfXyR9qtKw/L6cGTVYm8nutv0RRL0mEA/HptMP1uSIaAbJKrcHNEU93CWTlvCAD8xwPT1D9DvQSl+aW/D9HEYSaZ1LQlNqbS7gmEDqlTZY804BNFiVoosFuyVT3GpQ2BPIRm/HliQ/obW8HX3pZPBS2nd+q5ba/j1ZnfVJKiRP0EvqB5ZgPAIdszM30FWR99yvfmv9VYF4dNPg== 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=DgBWrXqvHUGsSPocnDI192UWSZ4tP2omJgi1606C6Fw=; b=CMUueeSh8vkfVv6+CkQIvqtW8ZLI/UksW8iYdMGA52z7mT+x+Y0hd98APEAF9RZtq0BNGlNogOiXrUABr69lZgLynWUNGG3zLX47/KLIfjBHpUrK3ts9xfPXRVaR+uDQxDlYLxgG4k4mI5I+quDhVOUcNzTTzbFgWJNoFYklf9lhQ1LggzKgKVtGo/+Iu4J1NWxvjmEwilia7MTDGYj83X2a2Ntm613nUJPXYOXg0ueEExfNnDCuLEXq55jcmdEDaJzDB3Jkyr9PylmqPmMy4XW1yWibQlKUkLIV8BwCyjTwpiPx8t9JKALOPVB74+LE07vK+/9o0yOR6IhcTYDXTw== 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=DgBWrXqvHUGsSPocnDI192UWSZ4tP2omJgi1606C6Fw=; b=LZlLRqL5jjQN4W+Aee8CDgQTSIXTcPEjZzBM3t1IqTqQvt4UGtVMbKj6T9/5rh+E6VCDQkFdwDVK84qSlmb/V6LMxsEof6r4hGhuDWumIpY9ZI83Kt7LRjyJjBNmv/Cp2rdoiwav/jVWD1CHXKMsqlQCuT4iOBkOjZ+XIgfHwbE= 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 AS8PR04MB8996.eurprd04.prod.outlook.com (2603:10a6:20b:42f::22) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.5654.20; Fri, 23 Sep 2022 15:46:41 +0000 Received: from GV1PR04MB9055.eurprd04.prod.outlook.com ([fe80::dd0b:d481:bc5a:9f15]) by GV1PR04MB9055.eurprd04.prod.outlook.com ([fe80::dd0b:d481:bc5a:9f15%4]) with mapi id 15.20.5654.018; Fri, 23 Sep 2022 15:46:41 +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, Ioana Ciornei Subject: [PATCH net-next v2 02/12] net: dpaa2-eth: rearrange variable in dpaa2_eth_get_ethtool_stats Date: Fri, 23 Sep 2022 18:45:46 +0300 Message-Id: <20220923154556.721511-3-ioana.ciornei@nxp.com> X-Mailer: git-send-email 2.25.1 In-Reply-To: <20220923154556.721511-1-ioana.ciornei@nxp.com> References: <20220923154556.721511-1-ioana.ciornei@nxp.com> X-ClientProxiedBy: AM3PR05CA0152.eurprd05.prod.outlook.com (2603:10a6:207:3::30) To GV1PR04MB9055.eurprd04.prod.outlook.com (2603:10a6:150:1e::22) MIME-Version: 1.0 X-MS-PublicTrafficType: Email X-MS-TrafficTypeDiagnostic: GV1PR04MB9055:EE_|AS8PR04MB8996:EE_ X-MS-Office365-Filtering-Correlation-Id: 9193d902-01d2-4eee-bff1-08da9d7acede X-MS-Exchange-SenderADCheck: 1 X-MS-Exchange-AntiSpam-Relay: 0 X-Microsoft-Antispam: BCL:0; X-Microsoft-Antispam-Message-Info: Ioh/v504VbsGRFGbiW/uQqgkXiz2jdLDPNt/rwkCwRTjKCQbbsfNt/4QfP9tF7TEUwTP6QGqiJSq0s2YwAMbGcpCEWduPmtJ2NOIH+42vKBS9ixzc8q4/Mm/oTUM4eVYP1olnyUliei+rgmb7uRgtb1f8OIf7DOckGvJzOOyPZ5MsRet24URGBNoGRMySI4x6rLX3OHwSFI5GBAb6SIFELl1M/HLzkjTMRdf9ZcD/7amCnTfqwjqK0Wf8bHoVntjwIorE/FJvWCQkQBFs/RKlyAcpu86GTK9WKbU4wrp9dJAWQQNTq8pFjUprlZ5eOMk+kRT9xekeK7QlkNjoZI7S8uLHaKyRrnTf/5WaQiK+Qo8oTfOl3+NLNW/lH/o4xhuURzFrN5XqPsBIl+HCRGAK/KXbgJLpGPKAD8/8aKuUu+8aXV3tzNHperL9ddROierNzGpfFlCnS06xser1kEbKDIfpnfie3YK50p9Yw3+Vhe1TAf5me2t7PaAHZ9PS4v0zkbywMTop+ZaBXbqVgDnHnOa0HiveQ2GtKsB5m5nZiYHU8J2DjR5aDsTy5PUZ8QIqUD8h0nzZgdlHQ9WdBqOhVoywT2BWowCRJYSIa49Rv7N1D6nMIhcfEMREie6mwDh8XYe24YWio/4z6odVDP2mOs6ZWPV3d+RprzQEb4qD0WRH4VllXrn1JyhRZjyFVSgq3UonF/Mq48dpPTWWFF0VBOScBJGdnriGLsp9B8J3HMeFXY5v9Z6K1qY6x50waIHDNcPSCgP0xKMSKWI63lloA== 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)(136003)(396003)(346002)(376002)(366004)(39860400002)(451199015)(6486002)(36756003)(316002)(54906003)(2616005)(4326008)(38350700002)(1076003)(38100700002)(6512007)(26005)(86362001)(52116002)(66476007)(110136005)(186003)(6506007)(83380400001)(66946007)(2906002)(66556008)(478600001)(8676002)(41300700001)(5660300002)(44832011)(8936002)(7416002);DIR:OUT;SFP:1101; X-MS-Exchange-AntiSpam-MessageData-ChunkCount: 1 X-MS-Exchange-AntiSpam-MessageData-0: jxkF8Z1B/sRyUQ4eByX09aKRcSSh04k+Sv3Gyey2K+6J7C0VBz6NADx1Bsg6jGiiYaikoytMf5BgHSDdD11x2/RMvI3rdXnTaT5U4qjgj6tLmHaPIMp6Fi4EAwDT4q8Nz4y2SXRR85tZNAHIjlZ+qDhfeUfTeGKX/a0p7qHDTZEnEdQRNf0oD8e8wG0XFRs5SmkehV+c26sz+UhofZIKCl+n1W37gKTWUnlQAyV0b24ogTm2qXd/8yRPFWDK65E20v0vQs3yaebXWga+N3XXHgit1WxpGgS4R8pJl5RX8r0xkhyZA+Cb844GNTRQy8pwFahyvsRoTwq25XpQkDrihSB2lFcuOJYfOCx4Wsh9Y38MKLtINNwvjT7ekw7Fidy8OhYrTqZK0fCqT5OE4k/X+FpHnJtLvjS+KZppOZmHbLWU9DY9vqvo5Uv9EMjXEv37dcQL+WDIJ3RB0/GWQ06aMPe6xWNKAAJ3bZuJ0V2GOzOB3qA40vYRZ5Af8I2Eo2fKLnyKN4jl2l932M934Pp6Z62ftvAx7ScFHUY/L1F+4JgxMaCN/aKEFoCMNt4Ce6b57BRhY/GI0yJZTEeGvOsjePHHS5PNjol7IMxWd7TRP0o87M69ajvl68ift92OWNOSEh5pdEjeWW0gxSyEtuNgP3xNlM9wTWFxAq9zN2iJZPxw/dh3K/6DjqlgKIvBr5SEUJet30YengKEo4eXSL7QPHVh9KlIcWEOWTisq3AitSmlJc9s/iWuLWo+L5zjkvLy2cDMGK/a85gLxbENBpvdYaUmygav8CWkqazRc835pouriB761feB0R0WN3xSpf6Qb1bJleu5QlSTxc1mgEJdepUcSF/6GqLi9z2KsGqBY+k2E6f6Tc3Wk9PdztPOBNxCH3f1dW6Av+d9ETPtAD1chA4JBZOioCWBHAo92QAZJwJOGhhTgma/qtb5EE9lbR5/5Dg1uzHvlZKfjB7EF0TWnfCdmHgCobB/bO6yYurBx0dDrXG3KpGfVNAWu1e/p9tMgkEi5ZaZTzKV2Y4NZobGBdTyqX+JfUT4rVzUJFXG5qv1tn5ysDFjTOV746GG+RwY/CyeZCx/XtEyM8+n4ain5n3M62YuvAo9svagy2+lud/dEmHl2ZmHvHf8MVz/RQXFeInTcrzOc3vJzR6POaibqiuvv/hRlX/tfM7CyBNjdEtDOai8tyGXxaVG7S39fiJ/UvLOfvZea7bzDsOCszy6h+W9JKgyvW1Eqe0rwAbJnep82ry/c9c8zkY5alqHIG00vpbsLWan/jAw+/N40ii6/cfTgiFaSHfFn0VYvG4CfbS80ijVnchQCggCSLzrUCXhdsZpN7cxwDomHq1Ti+AlbfemPi3ekGlohuRc3X/NLMx9qSYmLCd7KREt7WlSZNYAbfN2NKsXgUtI+wmW5TMrkU+JI+GuSWfIQWDgpSfXdzJW6gOzC9IBavcH0yzIKwBCVErEBDDyibXWsSQapwzFIPlptrnbY30DeKqSHlaysAyMCVw02J22O2lb47gc4mkC74U00ZPv1ZcQOhpBcA8+jpnMksLyzyQGwvQ6teOccJ0nvcAyU/DdGshWNzr+NkjH X-OriginatorOrg: nxp.com X-MS-Exchange-CrossTenant-Network-Message-Id: 9193d902-01d2-4eee-bff1-08da9d7acede X-MS-Exchange-CrossTenant-AuthSource: GV1PR04MB9055.eurprd04.prod.outlook.com X-MS-Exchange-CrossTenant-AuthAs: Internal X-MS-Exchange-CrossTenant-OriginalArrivalTime: 23 Sep 2022 15:46:41.0211 (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: FDjtDVFuEz09vXMRizqSeV9+PGw9T8Z5QisqERLiZQeos+JD8wTXpB26Elng6lRjeXC2u6U835oZJP7sLXDTZg== X-MS-Exchange-Transport-CrossTenantHeadersStamped: AS8PR04MB8996 Precedence: bulk List-ID: X-Mailing-List: netdev@vger.kernel.org X-Patchwork-Delegate: kuba@kernel.org Rearrange the variables in the dpaa2_eth_get_ethtool_stats() function so that we adhere to the reverse Christmas tree rule. Also, in the next patch we are adding more variables and I didn't know where to place them with the current ordering. Signed-off-by: Ioana Ciornei --- Changes in v2: - none .../ethernet/freescale/dpaa2/dpaa2-ethtool.c | 18 ++++++++---------- 1 file changed, 8 insertions(+), 10 deletions(-) diff --git a/drivers/net/ethernet/freescale/dpaa2/dpaa2-ethtool.c b/drivers/net/ethernet/freescale/dpaa2/dpaa2-ethtool.c index 97ec2adf5dc5..46b493892f3b 100644 --- a/drivers/net/ethernet/freescale/dpaa2/dpaa2-ethtool.c +++ b/drivers/net/ethernet/freescale/dpaa2/dpaa2-ethtool.c @@ -226,17 +226,8 @@ static void dpaa2_eth_get_ethtool_stats(struct net_device *net_dev, struct ethtool_stats *stats, u64 *data) { - int i = 0; - int j, k, err; - int num_cnt; - union dpni_statistics dpni_stats; - u32 fcnt, bcnt; - u32 fcnt_rx_total = 0, fcnt_tx_total = 0; - u32 bcnt_rx_total = 0, bcnt_tx_total = 0; - u32 buf_cnt; struct dpaa2_eth_priv *priv = netdev_priv(net_dev); - struct dpaa2_eth_drv_stats *extras; - struct dpaa2_eth_ch_stats *ch_stats; + union dpni_statistics dpni_stats; int dpni_stats_page_size[DPNI_STATISTICS_CNT] = { sizeof(dpni_stats.page_0), sizeof(dpni_stats.page_1), @@ -246,6 +237,13 @@ static void dpaa2_eth_get_ethtool_stats(struct net_device *net_dev, sizeof(dpni_stats.page_5), sizeof(dpni_stats.page_6), }; + u32 fcnt_rx_total = 0, fcnt_tx_total = 0; + u32 bcnt_rx_total = 0, bcnt_tx_total = 0; + struct dpaa2_eth_ch_stats *ch_stats; + struct dpaa2_eth_drv_stats *extras; + int j, k, err, num_cnt, i = 0; + u32 fcnt, bcnt; + u32 buf_cnt; memset(data, 0, sizeof(u64) * (DPAA2_ETH_NUM_STATS + DPAA2_ETH_NUM_EXTRA_STATS)); From patchwork Fri Sep 23 15:45:47 2022 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Ioana Ciornei X-Patchwork-Id: 12986703 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 027FDECAAD8 for ; Fri, 23 Sep 2022 15:47:15 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S232588AbiIWPrM (ORCPT ); Fri, 23 Sep 2022 11:47:12 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:46810 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S229461AbiIWPqu (ORCPT ); Fri, 23 Sep 2022 11:46:50 -0400 Received: from EUR01-VE1-obe.outbound.protection.outlook.com (mail-eopbgr140041.outbound.protection.outlook.com [40.107.14.41]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 994ADFFA7A; Fri, 23 Sep 2022 08:46:46 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=bmPkj6FDb9QwL639DagB/RtcHIst1UEm0aFtQ9XS3GQsjS3uMvdaJLcl6eqOBH+MFSOpZm1CqBzBTJD2v5jRRftHFLWMC+aCPZusmwsRYHPVxASI6+2GzhWFiCptOA2aoC3/AAFPDhGG60ek1o1xNMcMNob1/5JFcXSgV4i8jCKd4qBwoQNencNOnWEErPukc9W7W/cwK/vrLb3lt7XDRissLU0cI9EPqcGqGoFZcd+/P5nQ/p8n2hPGnS03NuGUQ+IcXW5wmy7hIzhstsg4EbBNY27pnb3m6XZspxMvkiEEoIYAAWNr2joKMAO35OSrQf16+zLxQZ9R4B/7SjZUUA== 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=T5CeeY5y75eSQhyFQdAOYz6TiGhA0XQ6y1I5vR1H9cI=; b=ItT6vQ2yPCJxabt00oDnwTvUZIPZnJJMmc8ICJ7PfzIlLHyj0bI8mt72fZuJWGKRvTGgV7wMeUJJVceUDmBMqrfN+8FVxS3/8pu6r9FJ5n9YbkKEa4+DLIkVNAfA0+R9jNE5/CeN9+LGzR2F5VybsoaR/jcYhyr+pt+jZlpkvzhMDdPVkJ77Dmw4HcYjG38ofBT0gYAoNOychpy900CfR9/L1/2DF9yMbZxP7CHGyS8G7m0IhBm8pnu6xhRbIwZgoUPhpuKon4bUnd7G6UphCPPef25InBtXcEGwNkMCrcRf4LqU8dazusj2th6wMrSlLkGOS2Cce+eTc0NS5KALRw== 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=T5CeeY5y75eSQhyFQdAOYz6TiGhA0XQ6y1I5vR1H9cI=; b=FivG8NbogQGEKG7SkcOyZmBoD0tUC7fapa7jeEA3b6UDSlNX8dT0tn/mJFuUFpt9Y4a5nhRxdGpz+QAcj6uukQJWMt7VCQFvREYwToV0KmZ4n70AlGPEUXkf888JliOeOFATPdn8ZCf03tkNqRc7/kfiaojPvrzD7nR4VvenWgI= 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 AS8PR04MB8996.eurprd04.prod.outlook.com (2603:10a6:20b:42f::22) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.5654.20; Fri, 23 Sep 2022 15:46:42 +0000 Received: from GV1PR04MB9055.eurprd04.prod.outlook.com ([fe80::dd0b:d481:bc5a:9f15]) by GV1PR04MB9055.eurprd04.prod.outlook.com ([fe80::dd0b:d481:bc5a:9f15%4]) with mapi id 15.20.5654.018; Fri, 23 Sep 2022 15:46:42 +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, Robert-Ionut Alexa , Ioana Ciornei Subject: [PATCH net-next v2 03/12] net: dpaa2-eth: add support for multiple buffer pools per DPNI Date: Fri, 23 Sep 2022 18:45:47 +0300 Message-Id: <20220923154556.721511-4-ioana.ciornei@nxp.com> X-Mailer: git-send-email 2.25.1 In-Reply-To: <20220923154556.721511-1-ioana.ciornei@nxp.com> References: <20220923154556.721511-1-ioana.ciornei@nxp.com> X-ClientProxiedBy: AM3PR05CA0152.eurprd05.prod.outlook.com (2603:10a6:207:3::30) To GV1PR04MB9055.eurprd04.prod.outlook.com (2603:10a6:150:1e::22) MIME-Version: 1.0 X-MS-PublicTrafficType: Email X-MS-TrafficTypeDiagnostic: GV1PR04MB9055:EE_|AS8PR04MB8996:EE_ X-MS-Office365-Filtering-Correlation-Id: b7cf0deb-0384-406a-7f7d-08da9d7acfb8 X-MS-Exchange-SenderADCheck: 1 X-MS-Exchange-AntiSpam-Relay: 0 X-Microsoft-Antispam: BCL:0; X-Microsoft-Antispam-Message-Info: AwrtsBOHqrS4QlQbG7MLEh7m+6OoXklT0aus15BkN9Y5h8F0SCHPxGlRpO670H8zQoZtTJsqzAvRMSX8OVHqLQ6PLxXZ1ShgTK+5Zr4SE/e7kn+xsXZL537OkXr77Gd21gfTKPsmHkSIbXKPIzKKJv3T8OUXDoeVPO1LE1fPNjCKkSHiISHjZUzwVP7a27cgG9jUtoWrwx1PWEN9lpDu5zD2m/HynV7NwuuORZdvxj6IUZD34ilJGIHEiQ2AkGzcA5o12Gfhrq0N/HaciXRACvCwltXHRj/YuWUP+62nAJR3u+E9fnohYgENUg6jGerN20Gbkx4MMx1SN8826wSRX+gKXRDD97ZqDjTzS3bPU8t2fLa+cYIFTnKfVLxt/JZRslTjb8f0RsAei3ziJYqwpt7NaI4x9t6nrY+qW6xYiKTcQ27hL8VgRD+R08SPyog84gK98hw7KNlCReSXLu9gRrHa7HF39hCE6BgqcN43sPitNAK+mvVVOdKS2WfaQ2lBps0s3Ki5vBZ/Si25aiBydUCR2kUYruISW5W++v8ooSqUMO94tHH2pQ5eYbv3yy/+wcwZ+7M8GM45wVX6gYkL844HDZbE0zBkkQecoe7CNdQqoGyPK03lKLEn8Z8BihjTYM/0gbfO7asFOptgDQP/cJMZPovIfe/V5li5HrQTmLaGryepPmYxXxM0ZO7RNUW2oHolJ3j1yC0Q47vPQKua8SN3IoTUk1pT1hcICpz0kB9wVsEtWbJTltyUXkWj0ESX2+pBys6hgd7iD0qqX4rgZg== 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)(136003)(396003)(346002)(376002)(366004)(39860400002)(451199015)(6486002)(36756003)(316002)(54906003)(2616005)(4326008)(38350700002)(1076003)(38100700002)(6512007)(26005)(86362001)(52116002)(66476007)(110136005)(186003)(6506007)(83380400001)(66946007)(2906002)(66556008)(478600001)(8676002)(41300700001)(5660300002)(30864003)(44832011)(8936002)(7416002);DIR:OUT;SFP:1101; X-MS-Exchange-AntiSpam-MessageData-ChunkCount: 1 X-MS-Exchange-AntiSpam-MessageData-0: eXXmFwZ16/RmGrlGdGm+6VnmCFEXwqCPpHoOe5Q9DK0hOko1ouyCAfhU5IqjSu5oY1E18f0tLGbB41rlIQaQ6pGSDTURoSCyTy5ATba3x/jlZf71hGHGj91MkzoHkyh48mR6h4TuMfqMyipuLMMEjfdnOFq6YTNu2fCO+KNI3hurokqpcHcis6qiftz1yqZkalI4hN9wqsgLqRtvm3lGCT+mDI50+z0wz6K9g7RJNMdKuOe60xd6vwXMUkNHRAupaUmRcGIIU1Xg0hBB+O2KzuQYPfzeAa6g9Fv2Gy+6Tcws+iRSsEcUEqR9N5IZwatJzvr7Y9ZcUim9z0tj28gqQLC3h9Z4j3Q7jfcQ6300GgRp88rqTMFjseDUbvt/jju2FHC5SiOAJZc6htSbjoztFTZ5IimRICB3eZh35SqtCm0oyEYbonqhDwFnesHmdaXSA/HcEPst258haWLoIM9hg9Ji9zllCNEaAa6gXjm7J+JxnXNqqMEeK8mX9HMT/wHTAfEdWcKC6rxzIjQMDYbhoDUe3AxOSLYOw64Vzt2vW0R1pYRgxi4AzYxZ67KF+yCRyZ4U/BIYngO9m1osgxt4msAiMemai/vCptseaz7iXQD+Zm1oxr4ZzvK4cRjTVQ60ktdu4LHYbWsg04LzjC/4B7Fgy/9lRqh/rXPAVtnFiA+2Yx46zAoNJJZbklMic49Xjc+JQIP12z5OSsTep6fmcQ25/9Nx0jmLL2CHYPnZ7O00piACkNLHoybO1gW3Syfz+RvnmdyupCl6WLEnYFsu3VkBsVW29jmOv45M1ynEXNknADflkCG53XVbeRjEbWburuyckUQYOZtUMrqMWV7SFyvbqCd/Pc1uxjgZI96ZWxLgAY8FGKEY25zHBZvgZLkcCt0HRFwRY1bBymCda/oET1mfiMg/qdSHsnALo10T195wSCRW5k4u38V43X4tVf5NoxRSiwjPCKjlR/+oEG4nOFErtPHN10VPLrgCVBriLqGTxfL7g3mmcfG/icPsIddA+uuS3rayaZKu1rVvUTt+dWYnUqUwhCkAKB7JOzafWSAo30Jqg/tSXG1qHPIxO0r53+UVLTRsjpYQh0+QLs8Kq3GDdY1nDOjtF8iY52RVOquToVrzgy2Ewthz/i0T0VucYKpSAre31ks4JJzdKglPH9H74Sfzm4DKf0Ctc+UmfVqqmhBDndNSRt1/vD3rk+BacoVP8zmEZpODtlt5jgg1Kr7JItofFfsbxVe1gTrOtHa0qlG8NqseVu9jH4ujLMVsVDKZ9xbxL2S1wbBgVBoqjiE2tCY4QgQINLNLGrVUE/eN/tLD9vqCKckjbNeyaNRxENlUdUKFZDoFEvgfB7nDW3pY9trQrx8dGRUMbCqSQIiIsQe3Abc2LET8ZSbLEQTDFLED1UrZ7zQTt40/ce21O91K3gpYBhNV2afEmbXozTQIY1wbDNS/DXNohhfHiRzkZQ2UnrVK1S8wksagf8X0e4Ei7RAjE4BTqloP946k6LcqA4GN8Tu6aHyjxlJAQ4ltrTpM6Rjos43rZZprDyN653QFt99latKRpITlPxYQTmcJKKHQhPeWkxW9apJY+TKy X-OriginatorOrg: nxp.com X-MS-Exchange-CrossTenant-Network-Message-Id: b7cf0deb-0384-406a-7f7d-08da9d7acfb8 X-MS-Exchange-CrossTenant-AuthSource: GV1PR04MB9055.eurprd04.prod.outlook.com X-MS-Exchange-CrossTenant-AuthAs: Internal X-MS-Exchange-CrossTenant-OriginalArrivalTime: 23 Sep 2022 15:46:42.4601 (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: H5vBqmphIkLDVGmkfK1CiirFZ3t1DwxbDn5cA6r7jM14yUaZpDtwVADGKmcPgw0ZgKnxjJEUtA67jIPzZTa4KQ== X-MS-Exchange-Transport-CrossTenantHeadersStamped: AS8PR04MB8996 Precedence: bulk List-ID: X-Mailing-List: netdev@vger.kernel.org X-Patchwork-Delegate: kuba@kernel.org From: Robert-Ionut Alexa This patch allows the configuration of multiple buffer pools associated with a single DPNI object, each distinct DPBP object not necessarily shared among all queues. The user can interogate both the number of buffer pools and the buffer count in each buffer pool by using the .get_ethtool_stats() callback. Signed-off-by: Robert-Ionut Alexa Signed-off-by: Ioana Ciornei --- Changes in v2: - Export dpaa2_eth_allocate_dpbp/dpaa2_eth_free_dpbp in this patch to avoid a build warning. The functions will be used in next patches. .../net/ethernet/freescale/dpaa2/dpaa2-eth.c | 188 ++++++++++++------ .../net/ethernet/freescale/dpaa2/dpaa2-eth.h | 26 ++- .../ethernet/freescale/dpaa2/dpaa2-ethtool.c | 15 +- 3 files changed, 162 insertions(+), 67 deletions(-) diff --git a/drivers/net/ethernet/freescale/dpaa2/dpaa2-eth.c b/drivers/net/ethernet/freescale/dpaa2/dpaa2-eth.c index 75d51572693d..aa93ed339b63 100644 --- a/drivers/net/ethernet/freescale/dpaa2/dpaa2-eth.c +++ b/drivers/net/ethernet/freescale/dpaa2/dpaa2-eth.c @@ -1,6 +1,6 @@ // SPDX-License-Identifier: (GPL-2.0+ OR BSD-3-Clause) /* Copyright 2014-2016 Freescale Semiconductor Inc. - * Copyright 2016-2020 NXP + * Copyright 2016-2022 NXP */ #include #include @@ -304,7 +304,7 @@ static void dpaa2_eth_recycle_buf(struct dpaa2_eth_priv *priv, if (ch->recycled_bufs_cnt < DPAA2_ETH_BUFS_PER_CMD) return; - while ((err = dpaa2_io_service_release(ch->dpio, priv->bpid, + while ((err = dpaa2_io_service_release(ch->dpio, ch->bp->bpid, ch->recycled_bufs, ch->recycled_bufs_cnt)) == -EBUSY) { if (retries++ >= DPAA2_ETH_SWP_BUSY_RETRIES) @@ -1631,7 +1631,7 @@ static int dpaa2_eth_set_tx_csum(struct dpaa2_eth_priv *priv, bool enable) * to the specified buffer pool */ static int dpaa2_eth_add_bufs(struct dpaa2_eth_priv *priv, - struct dpaa2_eth_channel *ch, u16 bpid) + struct dpaa2_eth_channel *ch) { struct device *dev = priv->net_dev->dev.parent; u64 buf_array[DPAA2_ETH_BUFS_PER_CMD]; @@ -1663,12 +1663,12 @@ static int dpaa2_eth_add_bufs(struct dpaa2_eth_priv *priv, trace_dpaa2_eth_buf_seed(priv->net_dev, page_address(page), DPAA2_ETH_RX_BUF_RAW_SIZE, addr, priv->rx_buf_size, - bpid); + ch->bp->bpid); } release_bufs: /* In case the portal is busy, retry until successful */ - while ((err = dpaa2_io_service_release(ch->dpio, bpid, + while ((err = dpaa2_io_service_release(ch->dpio, ch->bp->bpid, buf_array, i)) == -EBUSY) { if (retries++ >= DPAA2_ETH_SWP_BUSY_RETRIES) break; @@ -1697,39 +1697,59 @@ static int dpaa2_eth_add_bufs(struct dpaa2_eth_priv *priv, return 0; } -static int dpaa2_eth_seed_pool(struct dpaa2_eth_priv *priv, u16 bpid) +static int dpaa2_eth_seed_pool(struct dpaa2_eth_priv *priv, + struct dpaa2_eth_channel *ch) { - int i, j; + int i; int new_count; - for (j = 0; j < priv->num_channels; j++) { - for (i = 0; i < DPAA2_ETH_NUM_BUFS; - i += DPAA2_ETH_BUFS_PER_CMD) { - new_count = dpaa2_eth_add_bufs(priv, priv->channel[j], bpid); - priv->channel[j]->buf_count += new_count; + for (i = 0; i < DPAA2_ETH_NUM_BUFS; i += DPAA2_ETH_BUFS_PER_CMD) { + new_count = dpaa2_eth_add_bufs(priv, ch); + ch->buf_count += new_count; - if (new_count < DPAA2_ETH_BUFS_PER_CMD) { - return -ENOMEM; - } - } + if (new_count < DPAA2_ETH_BUFS_PER_CMD) + return -ENOMEM; } return 0; } +static void dpaa2_eth_seed_pools(struct dpaa2_eth_priv *priv) +{ + struct net_device *net_dev = priv->net_dev; + struct dpaa2_eth_channel *channel; + int i, err = 0; + + for (i = 0; i < priv->num_channels; i++) { + channel = priv->channel[i]; + + err = dpaa2_eth_seed_pool(priv, channel); + + /* Not much to do; the buffer pool, though not filled up, + * may still contain some buffers which would enable us + * to limp on. + */ + if (err) + netdev_err(net_dev, "Buffer seeding failed for DPBP %d (bpid=%d)\n", + channel->bp->dev->obj_desc.id, + channel->bp->bpid); + } +} + /* - * Drain the specified number of buffers from the DPNI's private buffer pool. + * Drain the specified number of buffers from one of the DPNI's private buffer + * pools. * @count must not exceeed DPAA2_ETH_BUFS_PER_CMD */ -static void dpaa2_eth_drain_bufs(struct dpaa2_eth_priv *priv, int count) +static void dpaa2_eth_drain_bufs(struct dpaa2_eth_priv *priv, int bpid, + int count) { u64 buf_array[DPAA2_ETH_BUFS_PER_CMD]; int retries = 0; int ret; do { - ret = dpaa2_io_service_acquire(NULL, priv->bpid, - buf_array, count); + ret = dpaa2_io_service_acquire(NULL, bpid, buf_array, count); if (ret < 0) { if (ret == -EBUSY && retries++ < DPAA2_ETH_SWP_BUSY_RETRIES) @@ -1742,23 +1762,35 @@ static void dpaa2_eth_drain_bufs(struct dpaa2_eth_priv *priv, int count) } while (ret); } -static void dpaa2_eth_drain_pool(struct dpaa2_eth_priv *priv) +static void dpaa2_eth_drain_pool(struct dpaa2_eth_priv *priv, int bpid) { int i; - dpaa2_eth_drain_bufs(priv, DPAA2_ETH_BUFS_PER_CMD); - dpaa2_eth_drain_bufs(priv, 1); + /* Drain the buffer pool */ + dpaa2_eth_drain_bufs(priv, bpid, DPAA2_ETH_BUFS_PER_CMD); + dpaa2_eth_drain_bufs(priv, bpid, 1); + /* Setup to zero the buffer count of all channels which were + * using this buffer pool. + */ for (i = 0; i < priv->num_channels; i++) - priv->channel[i]->buf_count = 0; + if (priv->channel[i]->bp->bpid == bpid) + priv->channel[i]->buf_count = 0; +} + +static void dpaa2_eth_drain_pools(struct dpaa2_eth_priv *priv) +{ + int i; + + for (i = 0; i < priv->num_bps; i++) + dpaa2_eth_drain_pool(priv, priv->bp[i]->bpid); } /* Function is called from softirq context only, so we don't need to guard * the access to percpu count */ static int dpaa2_eth_refill_pool(struct dpaa2_eth_priv *priv, - struct dpaa2_eth_channel *ch, - u16 bpid) + struct dpaa2_eth_channel *ch) { int new_count; @@ -1766,7 +1798,7 @@ static int dpaa2_eth_refill_pool(struct dpaa2_eth_priv *priv, return 0; do { - new_count = dpaa2_eth_add_bufs(priv, ch, bpid); + new_count = dpaa2_eth_add_bufs(priv, ch); if (unlikely(!new_count)) { /* Out of memory; abort for now, we'll try later on */ break; @@ -1848,7 +1880,7 @@ static int dpaa2_eth_poll(struct napi_struct *napi, int budget) break; /* Refill pool if appropriate */ - dpaa2_eth_refill_pool(priv, ch, priv->bpid); + dpaa2_eth_refill_pool(priv, ch); store_cleaned = dpaa2_eth_consume_frames(ch, &fq); if (store_cleaned <= 0) @@ -2047,15 +2079,7 @@ static int dpaa2_eth_open(struct net_device *net_dev) struct dpaa2_eth_priv *priv = netdev_priv(net_dev); int err; - err = dpaa2_eth_seed_pool(priv, priv->bpid); - if (err) { - /* Not much to do; the buffer pool, though not filled up, - * may still contain some buffers which would enable us - * to limp on. - */ - netdev_err(net_dev, "Buffer seeding failed for DPBP %d (bpid=%d)\n", - priv->dpbp_dev->obj_desc.id, priv->bpid); - } + dpaa2_eth_seed_pools(priv); if (!dpaa2_eth_is_type_phy(priv)) { /* We'll only start the txqs when the link is actually ready; @@ -2088,7 +2112,7 @@ static int dpaa2_eth_open(struct net_device *net_dev) enable_err: dpaa2_eth_disable_ch_napi(priv); - dpaa2_eth_drain_pool(priv); + dpaa2_eth_drain_pools(priv); return err; } @@ -2193,7 +2217,7 @@ static int dpaa2_eth_stop(struct net_device *net_dev) dpaa2_eth_disable_ch_napi(priv); /* Empty the buffer pool */ - dpaa2_eth_drain_pool(priv); + dpaa2_eth_drain_pools(priv); /* Empty the Scatter-Gather Buffer cache */ dpaa2_eth_sgt_cache_drain(priv); @@ -3204,13 +3228,14 @@ static void dpaa2_eth_setup_fqs(struct dpaa2_eth_priv *priv) dpaa2_eth_set_fq_affinity(priv); } -/* Allocate and configure one buffer pool for each interface */ -static int dpaa2_eth_setup_dpbp(struct dpaa2_eth_priv *priv) +/* Allocate and configure a buffer pool */ +struct dpaa2_eth_bp *dpaa2_eth_allocate_dpbp(struct dpaa2_eth_priv *priv) { - int err; - struct fsl_mc_device *dpbp_dev; struct device *dev = priv->net_dev->dev.parent; + struct fsl_mc_device *dpbp_dev; struct dpbp_attr dpbp_attrs; + struct dpaa2_eth_bp *bp; + int err; err = fsl_mc_object_allocate(to_fsl_mc_device(dev), FSL_MC_POOL_DPBP, &dpbp_dev); @@ -3219,12 +3244,16 @@ static int dpaa2_eth_setup_dpbp(struct dpaa2_eth_priv *priv) err = -EPROBE_DEFER; else dev_err(dev, "DPBP device allocation failed\n"); - return err; + return ERR_PTR(err); } - priv->dpbp_dev = dpbp_dev; + bp = kzalloc(sizeof(*bp), GFP_KERNEL); + if (!bp) { + err = -ENOMEM; + goto err_alloc; + } - err = dpbp_open(priv->mc_io, 0, priv->dpbp_dev->obj_desc.id, + err = dpbp_open(priv->mc_io, 0, dpbp_dev->obj_desc.id, &dpbp_dev->mc_handle); if (err) { dev_err(dev, "dpbp_open() failed\n"); @@ -3249,9 +3278,11 @@ static int dpaa2_eth_setup_dpbp(struct dpaa2_eth_priv *priv) dev_err(dev, "dpbp_get_attributes() failed\n"); goto err_get_attr; } - priv->bpid = dpbp_attrs.bpid; - return 0; + bp->dev = dpbp_dev; + bp->bpid = dpbp_attrs.bpid; + + return bp; err_get_attr: dpbp_disable(priv->mc_io, 0, dpbp_dev->mc_handle); @@ -3259,17 +3290,57 @@ static int dpaa2_eth_setup_dpbp(struct dpaa2_eth_priv *priv) err_reset: dpbp_close(priv->mc_io, 0, dpbp_dev->mc_handle); err_open: +err_alloc: fsl_mc_object_free(dpbp_dev); - return err; + return ERR_PTR(err); +} + +static int dpaa2_eth_setup_default_dpbp(struct dpaa2_eth_priv *priv) +{ + struct dpaa2_eth_bp *bp; + int i; + + bp = dpaa2_eth_allocate_dpbp(priv); + if (IS_ERR(bp)) + return PTR_ERR(bp); + + priv->bp[DPAA2_ETH_DEFAULT_BP_IDX] = bp; + priv->num_bps++; + + for (i = 0; i < priv->num_channels; i++) + priv->channel[i]->bp = bp; + + return 0; +} + +void dpaa2_eth_free_dpbp(struct dpaa2_eth_priv *priv, struct dpaa2_eth_bp *bp) +{ + int idx_bp; + + /* Find the index at which this BP is stored */ + for (idx_bp = 0; idx_bp < priv->num_bps; idx_bp++) + if (priv->bp[idx_bp] == bp) + break; + + /* Drain the pool and disable the associated MC object */ + dpaa2_eth_drain_pool(priv, bp->bpid); + dpbp_disable(priv->mc_io, 0, bp->dev->mc_handle); + dpbp_close(priv->mc_io, 0, bp->dev->mc_handle); + fsl_mc_object_free(bp->dev); + kfree(bp); + + /* Move the last in use DPBP over in this position */ + priv->bp[idx_bp] = priv->bp[priv->num_bps - 1]; + priv->num_bps--; } -static void dpaa2_eth_free_dpbp(struct dpaa2_eth_priv *priv) +static void dpaa2_eth_free_dpbps(struct dpaa2_eth_priv *priv) { - dpaa2_eth_drain_pool(priv); - dpbp_disable(priv->mc_io, 0, priv->dpbp_dev->mc_handle); - dpbp_close(priv->mc_io, 0, priv->dpbp_dev->mc_handle); - fsl_mc_object_free(priv->dpbp_dev); + int i; + + for (i = 0; i < priv->num_bps; i++) + dpaa2_eth_free_dpbp(priv, priv->bp[i]); } static int dpaa2_eth_set_buffer_layout(struct dpaa2_eth_priv *priv) @@ -4154,6 +4225,7 @@ static int dpaa2_eth_set_default_cls(struct dpaa2_eth_priv *priv) */ static int dpaa2_eth_bind_dpni(struct dpaa2_eth_priv *priv) { + struct dpaa2_eth_bp *bp = priv->bp[DPAA2_ETH_DEFAULT_BP_IDX]; struct net_device *net_dev = priv->net_dev; struct device *dev = net_dev->dev.parent; struct dpni_pools_cfg pools_params; @@ -4162,7 +4234,7 @@ static int dpaa2_eth_bind_dpni(struct dpaa2_eth_priv *priv) int i; pools_params.num_dpbp = 1; - pools_params.pools[0].dpbp_id = priv->dpbp_dev->obj_desc.id; + pools_params.pools[0].dpbp_id = bp->dev->obj_desc.id; pools_params.pools[0].backup_pool = 0; pools_params.pools[0].buffer_size = priv->rx_buf_size; err = dpni_set_pools(priv->mc_io, 0, priv->mc_token, &pools_params); @@ -4642,7 +4714,7 @@ static int dpaa2_eth_probe(struct fsl_mc_device *dpni_dev) dpaa2_eth_setup_fqs(priv); - err = dpaa2_eth_setup_dpbp(priv); + err = dpaa2_eth_setup_default_dpbp(priv); if (err) goto err_dpbp_setup; @@ -4778,7 +4850,7 @@ static int dpaa2_eth_probe(struct fsl_mc_device *dpni_dev) err_alloc_percpu_stats: dpaa2_eth_del_ch_napi(priv); err_bind: - dpaa2_eth_free_dpbp(priv); + dpaa2_eth_free_dpbps(priv); err_dpbp_setup: dpaa2_eth_free_dpio(priv); err_dpio_setup: @@ -4831,7 +4903,7 @@ static int dpaa2_eth_remove(struct fsl_mc_device *ls_dev) free_percpu(priv->percpu_extras); dpaa2_eth_del_ch_napi(priv); - dpaa2_eth_free_dpbp(priv); + dpaa2_eth_free_dpbps(priv); dpaa2_eth_free_dpio(priv); dpaa2_eth_free_dpni(priv); if (priv->onestep_reg_base) diff --git a/drivers/net/ethernet/freescale/dpaa2/dpaa2-eth.h b/drivers/net/ethernet/freescale/dpaa2/dpaa2-eth.h index 447718483ef4..bb0881e7033b 100644 --- a/drivers/net/ethernet/freescale/dpaa2/dpaa2-eth.h +++ b/drivers/net/ethernet/freescale/dpaa2/dpaa2-eth.h @@ -1,6 +1,6 @@ /* SPDX-License-Identifier: (GPL-2.0+ OR BSD-3-Clause) */ /* Copyright 2014-2016 Freescale Semiconductor Inc. - * Copyright 2016-2020 NXP + * Copyright 2016-2022 NXP */ #ifndef __DPAA2_ETH_H @@ -109,6 +109,14 @@ #define DPAA2_ETH_RX_BUF_ALIGN_REV1 256 #define DPAA2_ETH_RX_BUF_ALIGN 64 +/* The firmware allows assigning multiple buffer pools to a single DPNI - + * maximum 8 DPBP objects. By default, only the first DPBP (idx 0) is used for + * all queues. Thus, when enabling AF_XDP we must accommodate up to 9 DPBPs + * object: the default and 8 other distinct buffer pools, one for each queue. + */ +#define DPAA2_ETH_DEFAULT_BP_IDX 0 +#define DPAA2_ETH_MAX_BPS 9 + /* We are accommodating a skb backpointer and some S/G info * in the frame's software annotation. The hardware * options are either 0 or 64, so we choose the latter. @@ -454,6 +462,11 @@ struct dpaa2_eth_ch_xdp { unsigned int res; }; +struct dpaa2_eth_bp { + struct fsl_mc_device *dev; + int bpid; +}; + struct dpaa2_eth_channel { struct dpaa2_io_notification_ctx nctx; struct fsl_mc_device *dpcon; @@ -472,6 +485,8 @@ struct dpaa2_eth_channel { /* Buffers to be recycled back in the buffer pool */ u64 recycled_bufs[DPAA2_ETH_BUFS_PER_CMD]; int recycled_bufs_cnt; + + struct dpaa2_eth_bp *bp; }; struct dpaa2_eth_dist_fields { @@ -535,14 +550,16 @@ struct dpaa2_eth_priv { u8 ptp_correction_off; void (*dpaa2_set_onestep_params_cb)(struct dpaa2_eth_priv *priv, u32 offset, u8 udp); - struct fsl_mc_device *dpbp_dev; u16 rx_buf_size; - u16 bpid; struct iommu_domain *iommu_domain; enum hwtstamp_tx_types tx_tstamp_type; /* Tx timestamping type */ bool rx_tstamp; /* Rx timestamping enabled */ + /* Buffer pool management */ + struct dpaa2_eth_bp *bp[DPAA2_ETH_MAX_BPS]; + int num_bps; + u16 tx_qdid; struct fsl_mc_io *mc_io; /* Cores which have an affine DPIO/DPCON. @@ -771,4 +788,7 @@ void dpaa2_eth_dl_traps_unregister(struct dpaa2_eth_priv *priv); struct dpaa2_eth_trap_item *dpaa2_eth_dl_get_trap(struct dpaa2_eth_priv *priv, struct dpaa2_fapr *fapr); + +struct dpaa2_eth_bp *dpaa2_eth_allocate_dpbp(struct dpaa2_eth_priv *priv); +void dpaa2_eth_free_dpbp(struct dpaa2_eth_priv *priv, struct dpaa2_eth_bp *bp); #endif /* __DPAA2_H */ diff --git a/drivers/net/ethernet/freescale/dpaa2/dpaa2-ethtool.c b/drivers/net/ethernet/freescale/dpaa2/dpaa2-ethtool.c index 46b493892f3b..32a38a03db57 100644 --- a/drivers/net/ethernet/freescale/dpaa2/dpaa2-ethtool.c +++ b/drivers/net/ethernet/freescale/dpaa2/dpaa2-ethtool.c @@ -241,9 +241,9 @@ static void dpaa2_eth_get_ethtool_stats(struct net_device *net_dev, u32 bcnt_rx_total = 0, bcnt_tx_total = 0; struct dpaa2_eth_ch_stats *ch_stats; struct dpaa2_eth_drv_stats *extras; + u32 buf_cnt, buf_cnt_total = 0; int j, k, err, num_cnt, i = 0; u32 fcnt, bcnt; - u32 buf_cnt; memset(data, 0, sizeof(u64) * (DPAA2_ETH_NUM_STATS + DPAA2_ETH_NUM_EXTRA_STATS)); @@ -305,12 +305,15 @@ static void dpaa2_eth_get_ethtool_stats(struct net_device *net_dev, *(data + i++) = fcnt_tx_total; *(data + i++) = bcnt_tx_total; - err = dpaa2_io_query_bp_count(NULL, priv->bpid, &buf_cnt); - if (err) { - netdev_warn(net_dev, "Buffer count query error %d\n", err); - return; + for (j = 0; j < priv->num_bps; j++) { + err = dpaa2_io_query_bp_count(NULL, priv->bp[j]->bpid, &buf_cnt); + if (err) { + netdev_warn(net_dev, "Buffer count query error %d\n", err); + return; + } + buf_cnt_total += buf_cnt; } - *(data + i++) = buf_cnt; + *(data + i++) = buf_cnt_total; if (dpaa2_eth_has_mac(priv)) dpaa2_mac_get_ethtool_stats(priv->mac, data + i); From patchwork Fri Sep 23 15:45:48 2022 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Ioana Ciornei X-Patchwork-Id: 12986707 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 6B959C6FA82 for ; Fri, 23 Sep 2022 15:47:26 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S232828AbiIWPrZ (ORCPT ); Fri, 23 Sep 2022 11:47:25 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:46800 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S229517AbiIWPqv (ORCPT ); Fri, 23 Sep 2022 11:46:51 -0400 Received: from EUR01-VE1-obe.outbound.protection.outlook.com (mail-eopbgr140041.outbound.protection.outlook.com [40.107.14.41]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id F35E6B9B; Fri, 23 Sep 2022 08:46:49 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=C7wZJllCccbgvhcC47xC/o/Rhiflx9ifWbT9JYh5zTe3p0817zsEwIIY7KuqXQqT2AMkUr3DOeAPKbyD69PnKIsuccffsNt6xZHjXubU1siGJcf0jYxkIExu/xQbBm3iK05TP6RaoGZa8uqVwWmp6lwMBdBY+aC2n55sx+qjY9adugqZIvfPhmOL/xy2RUKQyGnlZC2Y8C3jR2WWLWP5VMsd+8IkTgoLsKfEWT6ikLzF7SnRiCIaNY1iHxs3ja1F95eblMBZT4HDu+7DbNDln66j0jiz+gW+l+Nncj7DinPOs7xpBR1rz/XsfrU5PVqoE/7LTObwOiYKeWxtec3UWg== 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=pQlg0GNxhAlw2+YJphOGYJj4HZ9HHgrPznZnlXhCY7M=; b=WUTrWo32A/OxxrM+S2FDuDcCET1JrtG53KxrRJoqfSxYvF3PG/SdOAR93sVQUsFZDgZJ7tLesm0Y8xja2OGs1zbUpOeLPwndB8ru5TuLiG/GMfyLjb2txFlnAaaHaUYBYddlBh5PC8IVTe/11qzO5epERBQ1otJjwC12i7E6yIIS7l6b+M2jQu8nXblLpKmigoHg1hoNzJ5iRaz4fYX2sZFkhmZgxCK1Veol5AWiHNiN4/JVTn2NrISFXG19QX4DQ/RkpwDqroWE/8rUJQ990C4gDPccK3gT5ytURN/97Amak82uo8iAtxYIqWM8oKsnUhnQfZN2bVZ486PscFtMdQ== 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=pQlg0GNxhAlw2+YJphOGYJj4HZ9HHgrPznZnlXhCY7M=; b=UaY7mAOCGWLRC6f9dzPT4Y6X5EG3hfMo7G1vAsZ70jbTebF/YqE/y9KCs7b6LSg/wkJPA8w37vMkrI75Qv6S8ybW3aT9gHDhsTiBiztYX/tMQdoc3HBrWT5GnEDuBUIAS2zzxAecBFpRGeG2g29WGXE1m5ZKTlAVcO+iwCivE3U= 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 AS8PR04MB8996.eurprd04.prod.outlook.com (2603:10a6:20b:42f::22) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.5654.20; Fri, 23 Sep 2022 15:46:43 +0000 Received: from GV1PR04MB9055.eurprd04.prod.outlook.com ([fe80::dd0b:d481:bc5a:9f15]) by GV1PR04MB9055.eurprd04.prod.outlook.com ([fe80::dd0b:d481:bc5a:9f15%4]) with mapi id 15.20.5654.018; Fri, 23 Sep 2022 15:46:43 +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, Ioana Ciornei Subject: [PATCH net-next v2 04/12] net: dpaa2-eth: export the CH# in the 'ch_stats' debug file Date: Fri, 23 Sep 2022 18:45:48 +0300 Message-Id: <20220923154556.721511-5-ioana.ciornei@nxp.com> X-Mailer: git-send-email 2.25.1 In-Reply-To: <20220923154556.721511-1-ioana.ciornei@nxp.com> References: <20220923154556.721511-1-ioana.ciornei@nxp.com> X-ClientProxiedBy: AM3PR05CA0152.eurprd05.prod.outlook.com (2603:10a6:207:3::30) To GV1PR04MB9055.eurprd04.prod.outlook.com (2603:10a6:150:1e::22) MIME-Version: 1.0 X-MS-PublicTrafficType: Email X-MS-TrafficTypeDiagnostic: GV1PR04MB9055:EE_|AS8PR04MB8996:EE_ X-MS-Office365-Filtering-Correlation-Id: c62ca720-0f5a-4555-d255-08da9d7ad07b X-MS-Exchange-SenderADCheck: 1 X-MS-Exchange-AntiSpam-Relay: 0 X-Microsoft-Antispam: BCL:0; X-Microsoft-Antispam-Message-Info: dgsnjLXENgwmmqEULjdKgTNC02G811SkpI9ap0BE6Fs9wi4i5PqUaeYxBypVf/c2wRdqkZif29fmHYZk62gIlFKCbXlmuAXd59o8gHFYNragJrA9cXNtenXdfVEKCisEOzM0syE3IUCd25Ac8bj9D196GSl78SY0hCqF3GcKDMw/AgwjrWU22Ymm3KD6QRquodMP85N9XDuScobRC7kodf4I/+RMMLUewdZND9RaYU2a+NqrTexpjigYev+1oN1b+GF2xWJawEPVP12gUMHvgyr5YA3AMf6ug/BGk2U65bmMoEriw/zJpTxyDdei/drBS4/j72NHmNKFq68LsFwIsSv+1lX/2YvU3oCsCGcsPO4qBuodyYTT6/c0aDTjArfLIs6MLq/Qdm6tyro2BMprR57WZNKZ3yhZd7qeo7CslHQishnuU+jsJzB32rRzaZitG0duQACm1Ur6hi3WoH5C3Du/MsfNma2ULUH4h2z6P1PxS9xyQyxsjgm++SGgu0TstGXltronkO94mbrmxIuS7po2ocPZVT2Dp6aUxDKWlR2ttCbU5t7Wm3ZhXuasI6LtIFZ6kG5YkzTgl21cw5nyRtmdDEbnRAecQebP5qRUU7gw1tLjjtrbDtkmqZqY4Do27xUxhTsSsvu9D09eRAsoBEtp3QRfWuxt3T37TcR1sthJL5A3j6JJqxeGaQaKfary2JSblkv6OoiiH+Pc8ZZTHT0g9rAr/3NozowixcKEPjY8fuHF2jF2Od73SMh1l4gWBIBZMmNXesOTPeshU70RhA== 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)(136003)(396003)(346002)(376002)(366004)(39860400002)(451199015)(6486002)(36756003)(316002)(54906003)(2616005)(4326008)(38350700002)(1076003)(38100700002)(6512007)(26005)(86362001)(52116002)(66476007)(110136005)(186003)(6506007)(83380400001)(66946007)(2906002)(66556008)(478600001)(8676002)(41300700001)(5660300002)(44832011)(8936002)(7416002);DIR:OUT;SFP:1101; X-MS-Exchange-AntiSpam-MessageData-ChunkCount: 1 X-MS-Exchange-AntiSpam-MessageData-0: IyuVvSJkd5oNneAENvTiJQRtzdB4DIkT/gY0LuYSuMPo90IBk+tREOW6GNYhr1jC/5jDq9COeaVPuwik0PatKpUYcEitOZx6nWJbrTK+shgYrmzV7j5TfHyaAZhyHSvThQbrh/W4LPOwe0jPkPDuGOuTWJMhzlv8rOMCLbFO+YplvOtmk+15DOfgHw86pmKqvXmJSMG4ovGHEIwt/jXrrxcM+vZFV2aijJrNqq4obualR4ROfo5igohoFntuaEvZAorlPPbLjGAcxE8vDM0/j1c4HEAoBg0QzKGDYggmmu1QnxVHJNUnun3UasZXEl+loofJubsJzHMelICKe62gBsGwufeIYJAgfKO79/dgbMFe+r0eOiPbF/XNRsFQMC/AyteuWR88KDvZnei9QDkOIyu3TurAfVDRYwnj0qHS0z/dXAPtEnjIpwbuVITv7Yz11w7xZp+44Q9k2D5jEPCkKoU/ZcKGJxFUH/vggr5oBJkzxpYiZ6symndLeg+RwRFwcG27uPEXB9ROJV8GqxW3K9w+dhAwEe4AmW9IzmXQKKKCfYuilDEHWxUmKQDLqNuPruTVfRdC8TQtCKcU4aaqakkXmLbraFvyDOzAQ6MTIeN1YGbgDXltfBaJN9uoSFty2SZzPMCzwDUIlTtEgQMX1L9tUsV6gMaCXWa0h91PceMpsV7VCqFmIWOj2+9BQHbGX1piI9IN75pBQJOJgeQcu1hP0n1DrhAhGHz1A+QudoL2haO8MLsO+4ndwOkGgxJmD0R6ztEhdd17Hdnhsr/lwWk6GHemOI4vBx0+IVa0qmGOFxkLHZhdv0DfRwyp/VxIUz6lXHioY4JxgU8z2anAbI8Gm1LH2Pc/m21cwEqp5RJieptUQe9O8BW4oCdpRC4RSzo3ytqmpV5XIvhSEsiCwFUB6XlK2O4xqhSRRg1qgZBvfqbi/mOMv/4e4mocXFeutjv+dhkBqa+tYPjDYuBe4V5GVs7DrnbgU1EZwL5zmG+wbcbfmSI1B8o+PEk/FVhGjNax/QVxV5t4cJuf5mun0FWfgTtRO+SM/6Uv52zR4JvEXnobMofyHAE0V/ObBaSJNDsUmk9wseIDAZ57X3Cx+u9UOFlw5auoRPLwWCRqJ34j0G/FdM+y3il6L7UX9x3BOYpX2sMDBTmI3PAK52SPsGqYbELacVXfve2m+pdsHhmG/cMIDeFU0pVdbzJnWf1o/KdJn1KrEsBROk6mYSN2Pnj8PkGuqSIzIbXRyb0ZRiwg7BoC/WG5SjrwwfzKUGM9LCiIGzTAE9cGWA0+Pe3q4URl2bekbx4Um5APWioEJ3HBmEbt4BOLJKXQxSPl1taB0fDcyBw0x6mnl/x4Wch6iE59jEUPslW6GtAgwNemx7RhEIZoEjD4fwlhAERHsa+H07i9Ln4Vtr0Kamss2f0XmErBRM99BJjBjL2hFqkeZnAZRsodwP5FpI2Zyp4ORCeZhgXCANTmbQBrxPteAZDAyDN9sCBMpIqb6akMVBx8U/d65JBR89bphJ54R9wXAI2BgFLw0dyeWQ1dJBJSh4BIIv7qp6/G/1pSRvOJ4DHXHOZobl/w2PR/eqic7zl/zvWO X-OriginatorOrg: nxp.com X-MS-Exchange-CrossTenant-Network-Message-Id: c62ca720-0f5a-4555-d255-08da9d7ad07b X-MS-Exchange-CrossTenant-AuthSource: GV1PR04MB9055.eurprd04.prod.outlook.com X-MS-Exchange-CrossTenant-AuthAs: Internal X-MS-Exchange-CrossTenant-OriginalArrivalTime: 23 Sep 2022 15:46:43.7268 (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: PDo3WE/jV/nC30lJ3SmzNz13Wm57hHvnXZzi3xMttUyq0nlVhmDkPKvYYjGsn0t78TsFqt60Iy4lsp6OT3A+Vw== X-MS-Exchange-Transport-CrossTenantHeadersStamped: AS8PR04MB8996 Precedence: bulk List-ID: X-Mailing-List: netdev@vger.kernel.org X-Patchwork-Delegate: kuba@kernel.org Just give out an index for each channel that we export into the debug file in the form of CH#. This is purely to help corelate each channel information from one debugfs file to another one. Signed-off-by: Ioana Ciornei --- Changes in v2: - none drivers/net/ethernet/freescale/dpaa2/dpaa2-eth-debugfs.c | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/drivers/net/ethernet/freescale/dpaa2/dpaa2-eth-debugfs.c b/drivers/net/ethernet/freescale/dpaa2/dpaa2-eth-debugfs.c index 8356af4631fd..54e7fcf95c89 100644 --- a/drivers/net/ethernet/freescale/dpaa2/dpaa2-eth-debugfs.c +++ b/drivers/net/ethernet/freescale/dpaa2/dpaa2-eth-debugfs.c @@ -98,14 +98,14 @@ static int dpaa2_dbg_ch_show(struct seq_file *file, void *offset) int i; seq_printf(file, "Channel stats for %s:\n", priv->net_dev->name); - seq_printf(file, "%s%16s%16s%16s%16s%16s%16s\n", - "CHID", "CPU", "Deq busy", "Frames", "CDANs", + seq_printf(file, "%s %5s%16s%16s%16s%16s%16s%16s\n", + "IDX", "CHID", "CPU", "Deq busy", "Frames", "CDANs", "Avg Frm/CDAN", "Buf count"); for (i = 0; i < priv->num_channels; i++) { ch = priv->channel[i]; - seq_printf(file, "%4d%16d%16llu%16llu%16llu%16llu%16d\n", - ch->ch_id, + seq_printf(file, "%3s%d%6d%16d%16llu%16llu%16llu%16llu%16d\n", + "CH#", i, ch->ch_id, ch->nctx.desired_cpu, ch->stats.dequeue_portal_busy, ch->stats.frames, From patchwork Fri Sep 23 15:45:49 2022 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Ioana Ciornei X-Patchwork-Id: 12986708 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 8E505C6FA82 for ; Fri, 23 Sep 2022 15:47:29 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S232837AbiIWPr0 (ORCPT ); Fri, 23 Sep 2022 11:47:26 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:46136 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S229532AbiIWPqv (ORCPT ); Fri, 23 Sep 2022 11:46:51 -0400 Received: from EUR01-VE1-obe.outbound.protection.outlook.com (mail-eopbgr140041.outbound.protection.outlook.com [40.107.14.41]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 0A719DE8F; Fri, 23 Sep 2022 08:46:51 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=HgT+iIPFzSGGzznAS2tUd7KJ+BNSuEyF3PWpcJqw4rONmkvfqxK0/p47JkI8kQgHa4leq0cZsi9fQI5lDNYXHrYq50OSJhCqHlMGdzzDorrR3Nf7IFOZxJNC3Ee1xbX+Q6g2RF+njLyuB2/5bnqN0CzfpF+fyD4Xy7D1I4v7UT4Miw0qCZfo+7PoKMd+GwN5UEOFUCj4La9xVO8j3Ph0FcCexxyF4ksxhYFCgCjoRakQ1wOoo/Pj2fJMkCc64Dio+JawnVWYO3i7WQhmdHa4a3oIMT6CTaVO/E5fp2fQp20JxQvmFHcy/4qR7ngnq2aSSwD31Ooi7p3TUMKUEH5ryw== 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=eQLq0rYVbvSKT8gUe1nEJkdDIepuj0CC6eE1isPzDFE=; b=JmRpYChKPSgv/jmClDj3wXnBMB5VP4vsksvziJi6y3RmCyos3oV2eNo/mqNHkMx0kXnmF2vS2FgfYrgqpzajNR35ZL2jxmSCB7bHlkqnZBNUBitQIWZTpJT3Tg+/SFM5V/AzlphKZmEticf+8UdxsptP/ULE3P0b6ksAcJIGzNckFMgVgCQtGZE6wKAeGI2KYLrJS1mcpYDgqr0q25EF1yDyoeicZMGw6ob9HIhljx14OheCMpNLmfmcpQxVYEMPIJGpeKWNo7MNZ/4cSlbq8JrHCTlh9Zxdw/7hIIJtJm4dUHcbU1nQFzxLEkNThuVdvN1EHt7lEQXRv8CvptKo5A== 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=eQLq0rYVbvSKT8gUe1nEJkdDIepuj0CC6eE1isPzDFE=; b=gY0wz8R23UyaLQR0xNU0/UVLVU+z3MKMKPmhwIyEak9lRAoUXjqSqjEUTmbBVd1bt+Mg6sEi72SOjsmAtoEbnIDepEsDEV27ZYDoIU/5vsWu/3+tMAaeuQAjih08jq6MnITm9ob0MnA3kDGnXJPZ3ZahgxPdR6Lwcw8P0tVWBqs= 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 AS8PR04MB8996.eurprd04.prod.outlook.com (2603:10a6:20b:42f::22) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.5654.20; Fri, 23 Sep 2022 15:46:45 +0000 Received: from GV1PR04MB9055.eurprd04.prod.outlook.com ([fe80::dd0b:d481:bc5a:9f15]) by GV1PR04MB9055.eurprd04.prod.outlook.com ([fe80::dd0b:d481:bc5a:9f15%4]) with mapi id 15.20.5654.018; Fri, 23 Sep 2022 15:46:45 +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, Ioana Ciornei Subject: [PATCH net-next v2 05/12] net: dpaa2-eth: export buffer pool info into a new debugfs file Date: Fri, 23 Sep 2022 18:45:49 +0300 Message-Id: <20220923154556.721511-6-ioana.ciornei@nxp.com> X-Mailer: git-send-email 2.25.1 In-Reply-To: <20220923154556.721511-1-ioana.ciornei@nxp.com> References: <20220923154556.721511-1-ioana.ciornei@nxp.com> X-ClientProxiedBy: AM3PR05CA0152.eurprd05.prod.outlook.com (2603:10a6:207:3::30) To GV1PR04MB9055.eurprd04.prod.outlook.com (2603:10a6:150:1e::22) MIME-Version: 1.0 X-MS-PublicTrafficType: Email X-MS-TrafficTypeDiagnostic: GV1PR04MB9055:EE_|AS8PR04MB8996:EE_ X-MS-Office365-Filtering-Correlation-Id: ad503230-a736-4078-7c13-08da9d7ad13f X-MS-Exchange-SenderADCheck: 1 X-MS-Exchange-AntiSpam-Relay: 0 X-Microsoft-Antispam: BCL:0; X-Microsoft-Antispam-Message-Info: EJaZ0ulF8/XYj+hHQ1zHg2KtnY+Z9DNKPp0o/jhGPn6s9a2K2Wr3PtslCyZdS8ZtJgKFpiofLp8ieUi/4zSR3iVhpdlDSbuMeyF3mGpUS4voA1Tznkr+1+v2/EJPpK5Ud+a1ZjhXC5tO22jrjU3BIVJO9fs7CygaBt7HJbKRrcT/zuzkGBXqwjfFADgLOiL2128qjt3DaX0OSX8cskcdH0v8iR7iX/HVQ4WuxjR7HRkUGFyfP4m0yzyk4lh6+y7dA76sYiEhdOdjuptlE/U56QYiYtBT5fjxT539nrZwSRAelYQIOGdU9lqWNS+agV0VhtHJOkPVwFsiNqc5OrYSy60eMRiWPnNxLPYx4sslDtZw7ZLGtW9NZ0j5fHzLRISo1qjqyxC/johBX825TI4+13AATc3CPj9Two5Plopi45HqKIiEYA+okvKhLH3LggEDLS3Pq+n6riSjeVe92keQzVSZZ8ATIFbRwVnTxRN+MYEnrs6NmYs+6IrSxvWxwCfJnnvRJpAiZm+15AgAfxNDymH2aW+oYpLdeenV/BWoRcY6weziUpskeK2aBnZIbaP909QOS78XQJrTOQpY0ngGJrlYB+SOucjf3EbshyBqQyVjhfJm+GzRE8jS4EXs7Coxa63fZztDD8hcqGwgZYClgmMWZbrdyPIFTpXb0AwIn+9kyo7kHDgqya0piJBg1GyeG7Z6Ugm+64MF9pCIjING/VIEVB4dIBdqq6tLToOsf53E95Syfh2l+BCc81pREWLIJLObXiKx5fns4otSf/PJtA== 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)(136003)(396003)(346002)(376002)(366004)(39860400002)(451199015)(6486002)(36756003)(316002)(54906003)(2616005)(4326008)(38350700002)(1076003)(38100700002)(6512007)(26005)(86362001)(52116002)(66476007)(110136005)(186003)(6506007)(66946007)(2906002)(66556008)(478600001)(8676002)(41300700001)(5660300002)(44832011)(8936002)(7416002);DIR:OUT;SFP:1101; X-MS-Exchange-AntiSpam-MessageData-ChunkCount: 1 X-MS-Exchange-AntiSpam-MessageData-0: JNZEYIPpINXFLHnx2ervRMFh3xp/lCge282uMSXFzTFuus2QoT66eSOBRUtsAM4KcF/WHeOlEMorge8SreHsTFoWH0sYW13srgQMxX35fTwx1svl///+Uryw5kzBXiyTBrgnA1KkdEQR6NFDVhIEo7/JSz2FszmL5oadSTUssneBhM+Y5GwGmBrdtrhPj/TGSJL2gPIsKGNdzaM7erJmyepI6mLZqAG70uV8HZo2h6Q88LpZuX6A8I+ZdWN2Wti/ML49MmNSisA7Mxzoyd9kHJ0PUHPKK50VlyPelfrKkUuU0oN/sxBdXxsZhhbzJDbpWKcX6JmEQuD6Vhh/GZ9EHbFg64YCJZwX19bcOAhUM89b9PP0jUs31Em+kzNDJ8frayjjAtePUzm/GApsS1dkTvhLZEtSpKEvM7rvrRRVaC/2TlewbvxuRSgUKqxpgASfScSXWZuRgbRWe+gkx2YmxhHdIjkJMY2o+0rnzaltpCykdRsxeKQigJEORd5vNMGdGYAP1XRtoxmoBcFUa0JbYgonAimJn6oFQxrR7PukKDptfVvi1rUXDRLZhsq0CY5/SKKr6DijPn8JS+KR+WRsab8BGNtXixvjSreRlwHu1Qw7LwWnOX3qzIfSDdYYoaJsPR1Q+RBk+bdq0tgigB4OcddB/OnRcCEZbxPe11/d8jcU/cqpKqkTqhZ6iW7+wAoDRiPJILOB4D05EsaOIeFtWvy+kG5A86wV3M1r+vjjfSlPrX2H8jkBBf61/drgdLCqgGlT4DZglVcRTr5gXVYG+L0L0W6Vfd8uuvaNJM8Y0AIACsVxU5PnAOwWES4MCE+hHO9wroYjKD0aUh3lTqXGdT10W2699uyxIo/k4a/tqc26J8vFJiR7IAy2m6MKCwZvluwiVo2bd2B2eiuFMPNmRXs3CIMBnPjmrfE/Bqa2M+Hx8xjqvsMKRJ+lTMLGx/xa3pcMnDCYmsDdVFssomG7ieef5po/BwBirsTRBwp5TTsttowtq3qgN6Ka0rfpk+j44Luto38WkNYSIObyhW643k44zvx8WImw/+YMpFBvsR2bVJBSwrhtDr14I0sRcgn4TlVMrrcXT7U+F23QyWtWi8Ysen5SQ2JmkZONDvM/pWQrMZw/Gbf+NZ68mANK4NtO57cZZfFOX73JBFK7xGwFU2E5p1dlfoM/1LD7qaQFExFx8YVVHf/XKqMDi2XKzMFV8rtN1/gXCAOwCXGJGI321GNugKZRw7lkEp+pv4q9neq4mRbvboTjfSCRUrt/BgrQ5TiPfJbDLXtO8QGfoYRuFStsCp9nXDu/sXJtI7iqZd5iOJgunJzCZtxrO+y1z/wncVOMfAll5PXu25pPgIHT/x57j0CNdcBtN+M24C1TnYUHqCI5qn35/zWS1ulH/pNC2M8CDvDZnrlg5KsK/+YRAQpj3Lvd25rqdUFydn+8DcrsNuixftzClhvdBrznX43gCfqT7s5IauJNMNeNrflDtwYO5j5SrugfJpmK+oG+1CQWAQqfoARTWfR5gaxTiGnARqCOhSZGrX15HuGx5bJSDjNqK7hJe+bYTlQRwLenVaCFyWvVdF/3Z6FH5IOLNUZn X-OriginatorOrg: nxp.com X-MS-Exchange-CrossTenant-Network-Message-Id: ad503230-a736-4078-7c13-08da9d7ad13f X-MS-Exchange-CrossTenant-AuthSource: GV1PR04MB9055.eurprd04.prod.outlook.com X-MS-Exchange-CrossTenant-AuthAs: Internal X-MS-Exchange-CrossTenant-OriginalArrivalTime: 23 Sep 2022 15:46:45.0078 (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: mKOG6YytOdWEP82BNI62IF5vTBWqEk5sG5xJMq3+Y8+FAyMRXFqU6Vi+Tg1HclpFdNneFKsjRzdlM+vSmGXT4Q== X-MS-Exchange-Transport-CrossTenantHeadersStamped: AS8PR04MB8996 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 .../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) From patchwork Fri Sep 23 15:45:50 2022 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Ioana Ciornei X-Patchwork-Id: 12986710 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 469DEC6FA82 for ; Fri, 23 Sep 2022 15:47:34 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S232873AbiIWPrc (ORCPT ); Fri, 23 Sep 2022 11:47:32 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:46150 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S231800AbiIWPqx (ORCPT ); Fri, 23 Sep 2022 11:46:53 -0400 Received: from EUR01-VE1-obe.outbound.protection.outlook.com (mail-eopbgr140041.outbound.protection.outlook.com [40.107.14.41]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 0F246240A2; Fri, 23 Sep 2022 08:46:52 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=JL49ZgnTTgZDm+RyREqXas3YSjj5SxjjO/aHdbjO6Y5o/rgmDy/r/j06kVdRtJIhZ/Sog4wXwJxLF5xrhUJUXVIvCiV5cSJjBixCLgQWKVC8OhnkSAogtpkF3Xnzd5BXQIsqqV40JZL1i1djo8k+G46zF8X/eKmpijtNcx0QznkOVv14tTkF8TxEfYg/+0blIyZA6z0iIFXRyc09jA4aiVlEkSp/jB7bBMZQiz9T/6yzFb0RQtmSK2FWuoTFvrcscOOg0tqZfaMNt0kHc2O/kHSBL7Li2zD879ckQPJnAvM8bW4fg26HLYVnHSNoojoz651O8xvLYXkwNeP9+rrCoA== 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=C9y4Qo8C0vtJLh4LC40sqwMcAf3H+YGDFicH+t5pvvg=; b=Kyjc0yjMNubO3NNb9IZdIxLxFvwf8y6jnzy1iVNEKaBHMeu49HUGsX2XUl1EQaarENCAXoqhZNB9+IsEVRUXgxHnCArwo4FWYfJ8qheLzYkzPJZur4LEgSe58AapNNkZpCIISKqAL89Xr9RNXortl4jYf9ITp0VhPFpEG+eJ/8Dr0dHPBA4KggeeuqG9FDmVsIqKXWcy7GJRPZ90D8FFTSBUrEO0knJBnghR2XS1GhhMgA7bfPiIDnZ4EHbQ0mD9ORbF9/oukLSXreEMsg/Zu17fZEDatVkCISdNmEG6xzBYw00GKRd0YMqmFwD29/oBr4HU0uW1xfVoh8tmvmbe+A== 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=C9y4Qo8C0vtJLh4LC40sqwMcAf3H+YGDFicH+t5pvvg=; b=QGyd87YNH2ZhI0/hK+2DemE5jgeRx3Of1WiylRRR+QA13MtKpJkBqU3YmAXVCiNkwIJrjhmVp/42H6He5O33nPGAOzMpJahfOgNAPipYJpdKlaRRUetdE8OSNULj8Z+hmxIgRq5OV05gPkAijXKxNRylQ2U7neztCzdIt4RF3ew= 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 AS8PR04MB8996.eurprd04.prod.outlook.com (2603:10a6:20b:42f::22) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.5654.20; Fri, 23 Sep 2022 15:46:46 +0000 Received: from GV1PR04MB9055.eurprd04.prod.outlook.com ([fe80::dd0b:d481:bc5a:9f15]) by GV1PR04MB9055.eurprd04.prod.outlook.com ([fe80::dd0b:d481:bc5a:9f15%4]) with mapi id 15.20.5654.018; Fri, 23 Sep 2022 15:46:46 +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, Robert-Ionut Alexa , Ioana Ciornei Subject: [PATCH net-next v2 06/12] net: dpaa2-eth: update the dpni_set_pools() API to support per QDBIN pools Date: Fri, 23 Sep 2022 18:45:50 +0300 Message-Id: <20220923154556.721511-7-ioana.ciornei@nxp.com> X-Mailer: git-send-email 2.25.1 In-Reply-To: <20220923154556.721511-1-ioana.ciornei@nxp.com> References: <20220923154556.721511-1-ioana.ciornei@nxp.com> X-ClientProxiedBy: AM3PR05CA0152.eurprd05.prod.outlook.com (2603:10a6:207:3::30) To GV1PR04MB9055.eurprd04.prod.outlook.com (2603:10a6:150:1e::22) MIME-Version: 1.0 X-MS-PublicTrafficType: Email X-MS-TrafficTypeDiagnostic: GV1PR04MB9055:EE_|AS8PR04MB8996:EE_ X-MS-Office365-Filtering-Correlation-Id: 8a563e02-6265-41cd-e55e-08da9d7ad20c X-MS-Exchange-SenderADCheck: 1 X-MS-Exchange-AntiSpam-Relay: 0 X-Microsoft-Antispam: BCL:0; X-Microsoft-Antispam-Message-Info: AafCkKoIo5SuclbWzrp7Vb1hJdutM9KbnD280ae+05Zw8xVDdKNPd3jHkLigtpw5oeprzz4r6fqamS5LM+xLt12zftui0W26OktAYpSlBx99RDr+ArKmGg1E0TgjAAZc/Xnb77NtryQ5ooPZIGq1gHGhhV2zcFOr06zPI6SFfHENg3Y90a3hRx50XdVZsg9KQQduHifcARwovWLRkQ1OH0ixg1TanIAIkKteDsA2kf4CgZ5usHU/0nEUkl8M3/UrDeDAng5gXZZDG+4D1Y9vS/ch/ueqOqxP7N0WJ5ExLmnQZAOB2IPrnKriK0a8fcMW60SpKd8pCvXckNzabcQLMUE4wLogi07YO0UZBJb/1mEy0JHDURi9Lp2Qaxp4gChSYL5NMmeIGiNqAx98vrwXWD7WaFcnCtMzeMlLl4PEZE1usL/jVk0jMlzY9JMjCa7YsH4UsycP2XqkVOiAEx9OLGUvTpgqmeEb3FARFKGG70fIptf5OGn5mncLgs+Zr1qbSo8G0b7Jc3+SRkJPx65U5qTX9fn+SfuogUB5HQW4jANENRkySuRIvxJOXUUyOt7qDU0i3vJv1SuqXor9W46TctDYcNsihEuxADXKBBgWlekWiTUys5EMhvvd01jd8K/RemQfUuq86Ce5DnKlQH/Ebd6ek0y2TMA54AHJ4uitpMxhbVGlxrR8ZSYZSTfuT20qyvJ1/GDcDC0kaHALNKjatAZtvtCPNOnNykj3UBusz/Joa3yGf3EKJP9/urbd/PdAp9lrLrR6bQ6LSLrSuC9T+Q== 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)(136003)(396003)(346002)(376002)(366004)(39860400002)(451199015)(6486002)(36756003)(316002)(54906003)(2616005)(4326008)(15650500001)(38350700002)(1076003)(38100700002)(6512007)(26005)(86362001)(52116002)(66476007)(110136005)(186003)(6506007)(83380400001)(6666004)(66946007)(2906002)(66556008)(478600001)(8676002)(41300700001)(5660300002)(44832011)(8936002)(7416002);DIR:OUT;SFP:1101; X-MS-Exchange-AntiSpam-MessageData-ChunkCount: 1 X-MS-Exchange-AntiSpam-MessageData-0: xdwwJy3yvt6vjfAccnzORz/2lWL4HBkEIga3gp7PDZ26yyeKYdW4AgkGWQvilxiIobSc0WbyIWIFJFiAd4lrDe2d/pxiMEZyEY4us35ziZ1wwYXA2aNVip1LPQ5KfPcA9MoC0FtebOVyaBwgWGeWc3SUJ+RN5z2pGnsu15hk2YcPEDXMdRey36pIa7WJFfGGwMHnCWtBEc+gkxj+5O2AJbgZZWoTCWXgHn7B/1w3THLqKUJte4i09xhw9P8wo+MTSQgG1yTFkHbUXZAVDEpBCBJaI7m9ybI1xIIH1Ssb1IC770/i/06PmEr/DV+en/Q5cmlMN5znedKA/aykHbPjnvvd93rLwccF0yo6+zF6WPnGewULMED1vmjyZascvOY2pKBNeGKw6QXQslxcS1+oDQQbQe0bDimr8JOw70rZ+3W7Am1KxlFvy7Bd1z00yASkXg5IHSEj/V9CdE9CGlZhSwMN7ck8qH+2EYjVQQ9Ureen2YXwbYG6Q+VRDen2vdfUTA/gS9nYMqay2veRnQQgkYwb4cpicbQMdyTySXscisql7U6Zu2P2Yzgrlxf3/9gs2VQLsdz5jaeskyCVVG1pV1aC/Rv7AB9jhW/Xk9KWDJ4MPxfG+eUB6pH5wTYZ0Gb/je4LoRNg3X4CAsYQqBjIYkxjE42cHgjp/MSKpDRFcCfKb1eb61I9m8v1yLiX3SY3dtWF8t3NBFvATOApbRuryLqHpfGy1AUpHYyC+HKJYNb57M0DiQTOemiwccKouBPZfkGfZb6ZqNRC9VLtQwN5AvkIfay6H8dB8l9SjZg31zKSKV+vc2qy6q4QvsKMjNm2TVR/XwrviP8rUaLas+oNfLG02tgp4HRpHLu98xqDzNQ4DP6wVyFI1btQ29a4B2BvSJhXpYy4nvl4FARFR41elCQT/4jjjBLDDOxQgmqNTpA3Su4M/UunmU70TqTwyS6M4BMK4bFkY4StbOdmqQfg5iX2d0eidGbCzuBog5KHnXgvwvS7VkF0RygahhxRdTWbJA7YLQeho2NL4t+3kL61Itz8k9OyxpE1HFsRXfTJsUeZjiTszttB5aLuisjXEzF1gK3S0sLg1UvlvauzJMH3IK83pPhcJoJBJhbA96/beYj0VYaTdQKFA4ZLsHt2zKbqSf6x8XcSPTQoUdG0eHzbI3WhIlXSuLGSnct+KBbh4BNsOWw2zHTL8S6xtikUVv3qdI6X6NhLp22Ny7mRv/S8IFqaGBs4fW/d1jLCouiEhfrRf4gVHRlYakdXNmsHOT7YjFrnbmeKphy6qThEbgiml8R6IDAGV0Rjn0tRIbdBM5LtJM2jRApx4YN1HnpPTRJBAexSkNgUn4D4OwAyL5fItxTlmBCmj7b8J4IP1bfkxin/sWQN6nj0na58Tyw3mmX4tn9WeLRidCrizrkt70z5gQw8DtfWRJ81ZyjRxIxiWu1Ap/ypY5M1gefwUn052L6wJHdTZ4aecB8ynTt52Z2UShkOwf/V7P5U+MF/2ifDHzuxLbYrbST7PQo2NoYys+QtYd/HOPmdAC/W+UA2okipzicJJhatYPKuRUY5DcR7XSv62Ii+WQp8/qiiz3FSnIl0 X-OriginatorOrg: nxp.com X-MS-Exchange-CrossTenant-Network-Message-Id: 8a563e02-6265-41cd-e55e-08da9d7ad20c X-MS-Exchange-CrossTenant-AuthSource: GV1PR04MB9055.eurprd04.prod.outlook.com X-MS-Exchange-CrossTenant-AuthAs: Internal X-MS-Exchange-CrossTenant-OriginalArrivalTime: 23 Sep 2022 15:46:46.4165 (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: m93rlD5Alvd5BfzM2AykOoygFah8rvU/JiPFEW9qD+7RAAwxdUgaADlmbPPSXhjjXv/EmGTzasDmY+o1sOp5Tw== X-MS-Exchange-Transport-CrossTenantHeadersStamped: AS8PR04MB8996 Precedence: bulk List-ID: X-Mailing-List: netdev@vger.kernel.org X-Patchwork-Delegate: kuba@kernel.org From: Robert-Ionut Alexa Update the dpni_set_pool() firmware API so that in the next patches we can configure per Rx queue (per QDBIN) buffer pools. This is a hard requirement of the AF_XDP, thus we need the newer API version. Signed-off-by: Robert-Ionut Alexa Signed-off-by: Ioana Ciornei --- Changes in v2: - use __le16 instead of u16 for the dpbp_id field .../net/ethernet/freescale/dpaa2/dpni-cmd.h | 19 +++++++++++++------ drivers/net/ethernet/freescale/dpaa2/dpni.c | 6 +++++- drivers/net/ethernet/freescale/dpaa2/dpni.h | 9 +++++++++ 3 files changed, 27 insertions(+), 7 deletions(-) diff --git a/drivers/net/ethernet/freescale/dpaa2/dpni-cmd.h b/drivers/net/ethernet/freescale/dpaa2/dpni-cmd.h index 828f538097af..be9492b8d5dc 100644 --- a/drivers/net/ethernet/freescale/dpaa2/dpni-cmd.h +++ b/drivers/net/ethernet/freescale/dpaa2/dpni-cmd.h @@ -13,10 +13,12 @@ #define DPNI_VER_MINOR 0 #define DPNI_CMD_BASE_VERSION 1 #define DPNI_CMD_2ND_VERSION 2 +#define DPNI_CMD_3RD_VERSION 3 #define DPNI_CMD_ID_OFFSET 4 #define DPNI_CMD(id) (((id) << DPNI_CMD_ID_OFFSET) | DPNI_CMD_BASE_VERSION) #define DPNI_CMD_V2(id) (((id) << DPNI_CMD_ID_OFFSET) | DPNI_CMD_2ND_VERSION) +#define DPNI_CMD_V3(id) (((id) << DPNI_CMD_ID_OFFSET) | DPNI_CMD_3RD_VERSION) #define DPNI_CMDID_OPEN DPNI_CMD(0x801) #define DPNI_CMDID_CLOSE DPNI_CMD(0x800) @@ -39,7 +41,7 @@ #define DPNI_CMDID_GET_IRQ_STATUS DPNI_CMD(0x016) #define DPNI_CMDID_CLEAR_IRQ_STATUS DPNI_CMD(0x017) -#define DPNI_CMDID_SET_POOLS DPNI_CMD(0x200) +#define DPNI_CMDID_SET_POOLS DPNI_CMD_V3(0x200) #define DPNI_CMDID_SET_ERRORS_BEHAVIOR DPNI_CMD(0x20B) #define DPNI_CMDID_GET_QDID DPNI_CMD(0x210) @@ -115,14 +117,19 @@ struct dpni_cmd_open { }; #define DPNI_BACKUP_POOL(val, order) (((val) & 0x1) << (order)) + +struct dpni_cmd_pool { + __le16 dpbp_id; + u8 priority_mask; + u8 pad; +}; + struct dpni_cmd_set_pools { - /* cmd word 0 */ u8 num_dpbp; u8 backup_pool_mask; - __le16 pad; - /* cmd word 0..4 */ - __le32 dpbp_id[DPNI_MAX_DPBP]; - /* cmd word 4..6 */ + u8 pad; + u8 pool_options; + struct dpni_cmd_pool pool[DPNI_MAX_DPBP]; __le16 buffer_size[DPNI_MAX_DPBP]; }; diff --git a/drivers/net/ethernet/freescale/dpaa2/dpni.c b/drivers/net/ethernet/freescale/dpaa2/dpni.c index 6c3b36f20fb8..02601a283b59 100644 --- a/drivers/net/ethernet/freescale/dpaa2/dpni.c +++ b/drivers/net/ethernet/freescale/dpaa2/dpni.c @@ -173,8 +173,12 @@ int dpni_set_pools(struct fsl_mc_io *mc_io, token); cmd_params = (struct dpni_cmd_set_pools *)cmd.params; cmd_params->num_dpbp = cfg->num_dpbp; + cmd_params->pool_options = cfg->pool_options; for (i = 0; i < DPNI_MAX_DPBP; i++) { - cmd_params->dpbp_id[i] = cpu_to_le32(cfg->pools[i].dpbp_id); + cmd_params->pool[i].dpbp_id = + cpu_to_le16(cfg->pools[i].dpbp_id); + cmd_params->pool[i].priority_mask = + cfg->pools[i].priority_mask; cmd_params->buffer_size[i] = cpu_to_le16(cfg->pools[i].buffer_size); cmd_params->backup_pool_mask |= diff --git a/drivers/net/ethernet/freescale/dpaa2/dpni.h b/drivers/net/ethernet/freescale/dpaa2/dpni.h index 6fffd519aa00..5c0a1d5ac934 100644 --- a/drivers/net/ethernet/freescale/dpaa2/dpni.h +++ b/drivers/net/ethernet/freescale/dpaa2/dpni.h @@ -92,19 +92,28 @@ int dpni_close(struct fsl_mc_io *mc_io, u32 cmd_flags, u16 token); +#define DPNI_POOL_ASSOC_QPRI 0 +#define DPNI_POOL_ASSOC_QDBIN 1 + /** * struct dpni_pools_cfg - Structure representing buffer pools configuration * @num_dpbp: Number of DPBPs + * @pool_options: Buffer assignment options. + * This field is a combination of DPNI_POOL_ASSOC_flags * @pools: Array of buffer pools parameters; The number of valid entries * must match 'num_dpbp' value * @pools.dpbp_id: DPBP object ID + * @pools.priority: Priority mask that indicates TC's used with this buffer. + * If set to 0x00 MC will assume value 0xff. * @pools.buffer_size: Buffer size * @pools.backup_pool: Backup pool */ struct dpni_pools_cfg { u8 num_dpbp; + u8 pool_options; struct { int dpbp_id; + u8 priority_mask; u16 buffer_size; int backup_pool; } pools[DPNI_MAX_DPBP]; From patchwork Fri Sep 23 15:45:51 2022 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Ioana Ciornei X-Patchwork-Id: 12986709 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 2AE45C6FA82 for ; Fri, 23 Sep 2022 15:47:32 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S232861AbiIWPr3 (ORCPT ); Fri, 23 Sep 2022 11:47:29 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:48668 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S231533AbiIWPqw (ORCPT ); Fri, 23 Sep 2022 11:46:52 -0400 Received: from EUR05-VI1-obe.outbound.protection.outlook.com (mail-vi1eur05on2071.outbound.protection.outlook.com [40.107.21.71]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 56011DFF0; Fri, 23 Sep 2022 08:46:51 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=UvqlqIS23mdk/xry1pE2cpjjKF4ECRPhjFWNNKc4dXlKrhtxaPXk4yLwH4ydyEHSmAzWj5dqNrsbFUut/s33AYRqvB9BT1RuWkkbWK33bU42JeFBIwrCILUF1tHX7waa6+Apy6nByNrb6Ou1mTdz5X3W9QBeyXZ6nHS08FKDfYpD8yl9x7xfiggdZtyVt0BrUW5pUf0fhXw/pxDA8d+hptEJv9saBbQaQpnZGvKHaYuzLRo4c138XIFiu5Fk+zw2C8uSVtS+/1fc8C43Os03eN4LIzGkjnYUZpPkVlQNefutxGtSrCFy65xY+jaWrJ4IOQeQ89EiZIyGlB27Q70Nhg== 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=ZtPbCQ+ml/Dq0MeBdk+YWGR0W9o8044lN5BTHO96ecw=; b=GOfJKhm9xSkdturkTzRcgYOjwaWI6jI61gwvLV9WKQwckV83UlLuKCBKf/BpHhdC7wdF6vY4GRbBdrXfQvH2I9G1Zmmd84glrnYH02ezNG2/pjG2+Zp4VcfkoMm8qd5KISV51jn1wdRu01uCb22gIr6w+wq2K6SIv+4JOFnllNTyoUrkGG608xAkp9853VNxCEwGptBwcNSObs2EQNcRhtdLnrYIyOTK13hkrf8r8+kmDoIxflkspmVSDVpJFrAF2UHSfjVlUHLdl1jvZtXhG0f4mhQzyiF8RAkKh/8IuGFSWSuqUn/qxKPLxjwE9AyVitYc59PvLKl+UUxgbA5+zA== 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=ZtPbCQ+ml/Dq0MeBdk+YWGR0W9o8044lN5BTHO96ecw=; b=ozr+Xt8vN0/HeBkAE4eST0LuZAHU8+OSyPGLIkRSxOBHQTdxnm/I3uZQzbmseg7Mk1Aroov+pttiTQ8PagtQ3I06BGqNnDER6wLmzkDABOZ4iXV7qqZdCZD7C6V2Ac41482g0gzkg7MqRj7z3gWlhCiC1GqA2y46ixMMhAC7mpo= 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 AS8PR04MB8724.eurprd04.prod.outlook.com (2603:10a6:20b:42b::6) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.5654.20; Fri, 23 Sep 2022 15:46:48 +0000 Received: from GV1PR04MB9055.eurprd04.prod.outlook.com ([fe80::dd0b:d481:bc5a:9f15]) by GV1PR04MB9055.eurprd04.prod.outlook.com ([fe80::dd0b:d481:bc5a:9f15%4]) with mapi id 15.20.5654.018; Fri, 23 Sep 2022 15:46:47 +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, Ioana Ciornei Subject: [PATCH net-next v2 07/12] net: dpaa2-eth: use dev_close/open instead of the internal functions Date: Fri, 23 Sep 2022 18:45:51 +0300 Message-Id: <20220923154556.721511-8-ioana.ciornei@nxp.com> X-Mailer: git-send-email 2.25.1 In-Reply-To: <20220923154556.721511-1-ioana.ciornei@nxp.com> References: <20220923154556.721511-1-ioana.ciornei@nxp.com> X-ClientProxiedBy: AM3PR05CA0152.eurprd05.prod.outlook.com (2603:10a6:207:3::30) To GV1PR04MB9055.eurprd04.prod.outlook.com (2603:10a6:150:1e::22) MIME-Version: 1.0 X-MS-PublicTrafficType: Email X-MS-TrafficTypeDiagnostic: GV1PR04MB9055:EE_|AS8PR04MB8724:EE_ X-MS-Office365-Filtering-Correlation-Id: 2a406335-0b8f-418c-611e-08da9d7ad2d7 X-MS-Exchange-SenderADCheck: 1 X-MS-Exchange-AntiSpam-Relay: 0 X-Microsoft-Antispam: BCL:0; X-Microsoft-Antispam-Message-Info: eQYwOfiPlYfUtJ+uGosTY8Al1HxiDR7tTl+Z2LPBTGVa4yvunt/noinXaoBGtl8U3o++VvRBef82OC/ixacNT2DS09D4RZCqRqdQSq14yF2kJI+N0KGr4I6QqpZRgNXp13lcXZBAREAW4dxdkoKAl9RxoJu/yvcyXb+m2R/ngIK4D+FTnvhEQh+0iwtOVuTJ8mrpEOxoAKt9e3fENX3tznGNktB8GifBgODfWFDuDQx9ZKitMM6KXUAj7MrJPJ3KlBhEsCCw/ktD7Me5+EgWa38hrbbsT83C3XHM2nZOKgV7iVbL+Qs/dee6O73E3ThXETkQjiEeOaN0aBZQubFLydUsHKUcfV6bkCAyLlxJmmtazaxakMwPzCm4tliP4xcMxPTd7Q9cHIw4Kc2pb8BuqCU6dkPwdwAMFRW1i4LFbQ/9TUXWilvcY7GBqVgwIxkVSjIF8eLThP4YjxtCxVUsLAnG3Ja1hZKhK29WGAhnyKlTm8FcG1Lg6M1FFTKzcMijirnPgIVsbYDTkRVibGrNkn+6PB7h0iHtGGKLcUhcXvLrWGZzN+fI7HatuZGx8BMnQNL565GJvt4NJ7SUr3BVKCKLfRq7BgSxQOeujlUU/02d04IUV85Us88Kv+x56ZFodDd1gFl6n7xkMtFf5lEu8zwJ4MqYfa1gHCbfz+EHNJysW7l4N4SbFt4ff4VREqtkxsvwPAQRvYxNhEoPCNtHduKxYuCw9JzFHkPqY5VXr/6rAjVNCtU8TxvvHXZOsmjgFgmohD/1K8Ji6fUDaViHWRae582oNXDFg2+DfERm5c8= 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)(39860400002)(366004)(396003)(376002)(346002)(136003)(451199015)(66476007)(41300700001)(52116002)(83380400001)(6506007)(66556008)(4326008)(66946007)(8676002)(26005)(36756003)(6512007)(38350700002)(8936002)(38100700002)(6486002)(110136005)(54906003)(6666004)(316002)(478600001)(2906002)(2616005)(44832011)(86362001)(1076003)(7416002)(5660300002)(186003)(309714004);DIR:OUT;SFP:1101; X-MS-Exchange-AntiSpam-MessageData-ChunkCount: 1 X-MS-Exchange-AntiSpam-MessageData-0: gjxMplx/Q7+aFFjvxudBjfe2hJDYYsaSDxZjmMu+LthhNt1a+HONlFmPhx9M7+3x9VMbe1oMiLFmALJhOHUhaqpvYSmFDobduufWdDMfdfLq/6bdpHIQGP/PsBSFpuYq1pvuYd2eqGYkIG51+jl+cqcHh6qlnGTAdVOXybrSGgGzDPEzWjIU6gF7fwz92srpYpz/NTuZ4une086hyL+xMK7gU0Z8Ul1BBazo2zhj/Ys+VyCeGt4Nk/YyMMLFoU08tZe5C8nvxxooSPgia5ri3qLQqe8NNecoFt58oeHYqJYSQOpS7PXbAqGMDSdPxVMKqJF/j1xpse/q8Cz/WGXJx0Wr8OLtu9uiFe5A1DXhJyFvi6RjjXqQbCLG2WrgFQwr0Ex/MbZZNDQNt6eVbc0GsZoEXJwXh0Z9r2z4G/VF9Gy8sbp9jxudiKwBDElFKuMmoZQwbMzgkSJR4MjBuBuJn2UV0y/nFPmLFH5ohIkRrWj3+SoW8YKO9nTg/5ycmgnmUbZEsNqU4mw/yQn364b5oa/1AyyReZ/Z42nQZby1SUnb1Hns7ECVPtAJ3GNVm5USfXrbgb2sAXspuli0YdZoskWXZCs8YCY9veH7IMUqU0b49yoaxeIIN+jfsnvaNIIc4Bq1TvCogX04M4k80crgfIyq8DDFRREKCfJoXr4ZzaBxdv7BegT3WL+IpfLGS1qma4bgSUpIy+2/NmA/PMr26k5VqIcYciVinAiKyoUPtKEoyry9XizzmXHLYO2t8993qr9cYQruemyeqys3jcOjFaz7+2mLPbO8GpCIBcjcJytl04obn0/ZN9GC8kMvOHjIdEaOPBWxjtYIQHB/39iPHTN+JZ03sEimL1CIYnQxkOaj3VqrfP5OfMBxdJ8XNCW5TxIa4u8J0ZhdZ4TbkDDuK8LLxjrtM+u7yWIcmv5ZdbiM2Nkz7kQU5WXofNBH8rbnXpuywGv8h97c0mmiXPn3vschERlb2r1/lGcNCpqlARHEo9MjqPlxQCdL4ky7OtsrAEUBAKn+SIz0iRVtm7gw06vxp/MNDp1QJEtAgpHd+5hWiXDvEuFyLxfvm32Abk1Mhdhyi9ihkdAfseW6V9qSGFpXW9cW1eH0RRwiaZTHleZ58Vw5exy+2wsUbPe/i7C5U5XfVlb/F+eslYY6FyZfundaxnzr+U0JWMc94i5Yw8v8ZXTmaAcvQdc5/aPglAyJHXweA2mbeK2oGbW/FflqrZYZcsdrF94h42D87WmcbvKosz280Xzo5ArbLTA2OqUB+XVXQDW2YQDShNBOExvEo0ogGttFehvM/BLqEbN9ke3mVmJmls0LaV2/7Wo4FqGQNFgCLV2TB0yvO6ai8MmBrrxb8TUj1/pzQYMTOFEXWgmk9Rvg9EpUn7Ld2YqkjsRXmQyq8uEZuQdTJuA0ELmr6fnQOP1b2XggIqiRIOyb7KN/9oZxKaPuQhqElfWIOEWVWg01wALghiF8by27Mwc7TIc+97wiEKsAGdxDZA8KEH7H32zWZ23Hn71uC5rKjMSci7wAx+kKPWyxAFlOpT6e/QtBpVAEmD83M14LZpbHKVHEY1SVbhA7+YrvbuM7yKTN X-OriginatorOrg: nxp.com X-MS-Exchange-CrossTenant-Network-Message-Id: 2a406335-0b8f-418c-611e-08da9d7ad2d7 X-MS-Exchange-CrossTenant-AuthSource: GV1PR04MB9055.eurprd04.prod.outlook.com X-MS-Exchange-CrossTenant-AuthAs: Internal X-MS-Exchange-CrossTenant-OriginalArrivalTime: 23 Sep 2022 15:46:47.6966 (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: DM/rWxqDwe4rIvOyY5HX21l7kjMSVXylyYHtVPinXnPxgYy5WaLQLFnHzLfoiswkO/C8S/eBZaoKtMqCKfxeQw== X-MS-Exchange-Transport-CrossTenantHeadersStamped: AS8PR04MB8724 Precedence: bulk List-ID: X-Mailing-List: netdev@vger.kernel.org X-Patchwork-Delegate: kuba@kernel.org Instead of calling the internal functions which implement .ndo_stop and .ndo_open, we can simply call dev_close and dev_open, so that we keep the code cleaner. Also, in the next patches we'll use the same APIs from other files without needing to export the internal functions. Signed-off-by: Ioana Ciornei --- Changes in v2: - none drivers/net/ethernet/freescale/dpaa2/dpaa2-eth.c | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/drivers/net/ethernet/freescale/dpaa2/dpaa2-eth.c b/drivers/net/ethernet/freescale/dpaa2/dpaa2-eth.c index aa93ed339b63..d40d25e62b6a 100644 --- a/drivers/net/ethernet/freescale/dpaa2/dpaa2-eth.c +++ b/drivers/net/ethernet/freescale/dpaa2/dpaa2-eth.c @@ -2626,7 +2626,7 @@ static int dpaa2_eth_setup_xdp(struct net_device *dev, struct bpf_prog *prog) need_update = (!!priv->xdp_prog != !!prog); if (up) - dpaa2_eth_stop(dev); + dev_close(dev); /* While in xdp mode, enforce a maximum Rx frame size based on MTU. * Also, when switching between xdp/non-xdp modes we need to reconfigure @@ -2654,7 +2654,7 @@ static int dpaa2_eth_setup_xdp(struct net_device *dev, struct bpf_prog *prog) } if (up) { - err = dpaa2_eth_open(dev); + err = dev_open(dev, NULL); if (err) return err; } @@ -2665,7 +2665,7 @@ static int dpaa2_eth_setup_xdp(struct net_device *dev, struct bpf_prog *prog) if (prog) bpf_prog_sub(prog, priv->num_channels); if (up) - dpaa2_eth_open(dev); + dev_open(dev, NULL); return err; } From patchwork Fri Sep 23 15:45:52 2022 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Ioana Ciornei X-Patchwork-Id: 12986711 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 74496C6FA8B for ; Fri, 23 Sep 2022 15:47:37 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S232878AbiIWPre (ORCPT ); Fri, 23 Sep 2022 11:47:34 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:52814 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S231562AbiIWPqx (ORCPT ); Fri, 23 Sep 2022 11:46:53 -0400 Received: from EUR05-VI1-obe.outbound.protection.outlook.com (mail-vi1eur05on2071.outbound.protection.outlook.com [40.107.21.71]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 8F19F82D34; Fri, 23 Sep 2022 08:46:52 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=AoSksGxXoe/PaSqidh9cz2wVKM4z1sdTverv59IYbOIf3J6i/uwBm19krrWopz3yAb7K21Sfj5MrmtB8rbc52qD3M200r5pvuYRA3/X1eQc7quwduxPLQE3yjPDWGPEXyzzj/PIl8oJR7/nIQZ0rxZBNs6fjJTeIjSWeZTdbJaHROPmA6jN3QdkLnKbZf07lOnaQ2PSObCjMUJIpmkvktN8chtcmTykrhZCApL2VcL95mDsl7s86SqQb0OsXwJkX9naYwDWcAuOlmxfcyDU466VdBs+icXF+u4DtCgpAH5wb83OJoYAvijCXGFPNaBOlKOgJ2lcm24ey+3cI8Wfu0w== 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=tfy1cQe2pjTdl74BJUssYxOzvnUsE5DOmtj4haeFNqA=; b=D4yk7uOjdkx556aWSSJZ+2nbQ4IkEdesp6PyC/9jalWyglr8w9XOO+8X966AEf5ZoGXX8quDPqQ4UW9W+edR+KlyH5DstnIZ7yRrYNAvXETduZGpOllA8VDBR76LoD8x53s6kJoQzbgL2XInQvaVHO+YK5PyP9goe159BcLyz7/S8o6qHjlf3YLqY8IYQ9+dJq8RuwjYMV3We9KZXwZQI1JnJ67yROOxqpk+wwduTTkCp7zooki5ylLkH8oRew4sLgm1DzkgOQRtyG6WNG8djI//HEyyYKyd0OPY8P4saTQGAQh1l2cw7zT1jXfdXt+Acmr0g5tVFP54s/iLbOpvLA== 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=tfy1cQe2pjTdl74BJUssYxOzvnUsE5DOmtj4haeFNqA=; b=Rc+/wjGnY6ZMFM+/Jq8ZYB/Sz4ZZ5v18Gy9wFdmRizTQ3DgSfDLEsGqYbs4vq/lOqQ+hZZJ7yrMwjHp4BslkbBPso+ZSkUVRCdX34LKmmaZYgpSIpQ/BrYgPyCgHD+I9/YUllUT3/sZwKfGA2jffpPC8K3YJc89eUUZgKTN7C5E= 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 AS8PR04MB8724.eurprd04.prod.outlook.com (2603:10a6:20b:42b::6) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.5654.20; Fri, 23 Sep 2022 15:46:49 +0000 Received: from GV1PR04MB9055.eurprd04.prod.outlook.com ([fe80::dd0b:d481:bc5a:9f15]) by GV1PR04MB9055.eurprd04.prod.outlook.com ([fe80::dd0b:d481:bc5a:9f15%4]) with mapi id 15.20.5654.018; Fri, 23 Sep 2022 15:46:49 +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, Robert-Ionut Alexa , Ioana Ciornei Subject: [PATCH net-next v2 08/12] net: dpaa2-eth: create and export the dpaa2_eth_alloc_skb function Date: Fri, 23 Sep 2022 18:45:52 +0300 Message-Id: <20220923154556.721511-9-ioana.ciornei@nxp.com> X-Mailer: git-send-email 2.25.1 In-Reply-To: <20220923154556.721511-1-ioana.ciornei@nxp.com> References: <20220923154556.721511-1-ioana.ciornei@nxp.com> X-ClientProxiedBy: AM3PR05CA0152.eurprd05.prod.outlook.com (2603:10a6:207:3::30) To GV1PR04MB9055.eurprd04.prod.outlook.com (2603:10a6:150:1e::22) MIME-Version: 1.0 X-MS-PublicTrafficType: Email X-MS-TrafficTypeDiagnostic: GV1PR04MB9055:EE_|AS8PR04MB8724:EE_ X-MS-Office365-Filtering-Correlation-Id: 9afe0694-7931-4ac9-bc05-08da9d7ad3ab X-MS-Exchange-SenderADCheck: 1 X-MS-Exchange-AntiSpam-Relay: 0 X-Microsoft-Antispam: BCL:0; X-Microsoft-Antispam-Message-Info: WWWAK8lPnnncQBpF7WLZjNswJLBX2Lf8YliF7loFqk3Os5vgTghvDbeWZzJQ4CJsovbMJKXtFxsk7VPmUFy+2d7WPgykcfsoCGbb+1k0VhJcZU5TXarkSEoKIMNI9isrY8n5ntYKVrg0Y1i1RLo/rd4e7YPQEvOx609xqULiaOVJETtkA0TZQnrppgokjnf3ILgSYHoJtSPhPlgE0OdWiVkuznNAvdKRPAo/PuhupEkD0fsYZlxeVanbfa5yPdZEmfh7BzpC64TkLt54TrOaNJAjHh0XCP6/uao5Sac/ePfzUJKECKg0f86HA+6kgIk3UbqEykQAR/ejF6u21yOqXf9Av3HN0+PqNZJTl968O8b0/KRLLRCcbRIG92ijhWPYiv2ezdiqYH3T/+7VuZjnww3FOdlYVHitPerK2IyDoIJqmkyrNJKdj+3YKTSt3KOskPcL+Gi7B5DfRwQbU53ddT03qHjMB+RnbNiABihtm3wEveIkbO+J83BWii3DLVW6L3JMuNV2onRrpDWFYJjN/61N2wZd8KrHuSgl99ZE2Tper30mbL5lNtWifePMCpVTIyrRz9YhNy29NF/+zhLssu1c+wY/ceM3K3LcTUYNl6AEc+suVYFXOrezY1HRuwAVaZKNtCYC1weNahZ7pZQTrWrYA4ZdkFTBfsuCD2aWMg3KO+Ur+P+/WZX+t/1gNa0ZbDQ5G/NoNdcFjbeC6wL5pHzaWc5zReq3l1z8QmxwdzEUYhkHXOIYRoYN5XUDsu//yuH78XJp3/tuc4XFt1HOtA== 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)(39860400002)(366004)(396003)(376002)(346002)(136003)(451199015)(66476007)(41300700001)(52116002)(83380400001)(6506007)(66556008)(4326008)(66946007)(8676002)(26005)(36756003)(6512007)(38350700002)(8936002)(38100700002)(6486002)(110136005)(54906003)(6666004)(316002)(478600001)(2906002)(2616005)(44832011)(86362001)(1076003)(7416002)(5660300002)(186003);DIR:OUT;SFP:1101; X-MS-Exchange-AntiSpam-MessageData-ChunkCount: 1 X-MS-Exchange-AntiSpam-MessageData-0: cA8iyeP5HNaloh80j/F6A1D0IMxYel6ggivhcZiWO+z6LEFKFZ06R7ZAan2+Tb7lkUs49xgAM+syNmnqAiMMl5l3ZEAwzKeTyzWXAceMMNSIy0zpFtYYHJocgj5L/HJFMEerx9PfvA/PU6UGYvZDzp/vbv8+9GJkMnuqCjnGXIWyIneFVyITdOyVgLPcdvm2r26eQnjqk0qWJzEqOizwOgfevqRLBalJHlRmeuc93HJkpG8Urbm6zlg6PJxTkduHicvCMtnCf6i1VZA4qhrizrMC7+B9eDW3/U1ba0ziUmFxi0U60XQpsoQnbwXhoLWLnBuqMVga6Xnw45GurVd6WdiZkK53ZwpL/FX9RsAiDsRurvzFZnV+3SmJ6eHCudv1iMrbOGV3RIcasXy6mj3SWzEkSUu1dk04v8ixJtwlcJSMG62c49sOfgeVpHHSJlJIYs+llPRH9nbCfYGIjyjzqko5U9EYUvj9glBOxCrfUo2bKBCoiCNhlcW5qJOJZD75cxU8OZ13mapXEwz2tDxa+olmk//UvkfF/D1OYHc7GoT4fryshavwJ/2UadIF4z8Q8bgoFDswDjOEHhSL3KyiFU8AyZoEze/FaqyRFS87XWOAIjTW4epkL6lxOpM8Jxd+SeIREOHx3ZIv17Se1o97kFm34f5WTo5QZDd3Jf8dNi4g0qQUayq4YHdeD2EaBOmlFLDQbbYMHEmo8lnIXjje00PkKbEwbJetzCo0OHkDy7kHpbfZVkVeZoV8z4vldUgx7nm36rssxPmh9aGQ5qhvNhoeqpxjbLsenKyqxDtoFaWr5+zxQCmIL/S0ZfTkGnfBNI1exyoBQCSSKT35r8QE4m5pmWzkYUEelBpZRuSdJFkIfRfW4llHlCE0lH3W+vH0EWVochL4q8NYBp6nJGiyYi4NoThwbaNpa79IAF/orQYG7CbOUCJ9Q6ny+irS07dUOc4KD2XY5ThoBS79uzuInxMV5QicswOQXvV/bOSpO4k13QhDt8fYM0CIdZCZ90OrN95QsG3c6/bRi/uxrKZrwpAKDgnU//NxIEbTS8JZERFxOJJ9oGu4ueysD3uyMdhzUUp6bcf83BN3ciBnAbjw8Nzik97D+twHksCGOOmT8FwxGf120ByT/cDNXDgYbOs34cHJNKTkkeE0/xhgxuadHhOWWpex1nyto9FGZNtq4P/LRqV4/p6tD3I3ZyrttHd87krI/spcYTTvIwDx4utsdivYknK9jt0PsUzo33TDq2U9B/XyIFNitxnhHQiCoGyh99PPa5oUJQ+isJHciQIKynxhISAQvXPmcOF2YWo84lpca3kokDfVb6BBWASwSwsLftu8vC4TLSg1wJ8UXvinQgmKpWxTlDgv5CD/HghrHZu9KXJWOkObFPJwGXqU61ILkugwQ56giAo0Ez0G+tegWlkjoCuDijLy5XDwwxkfK65v/zkXKqK64MHOdN0k6pMJ6nNS5TNWDEkLvXbutqiKZkilbWDBQC+Qo3py7c5uAi+L/cmA4e3czyr3zFGkZxSnLTALS3J6v8bdovBT221ahK2nuNc7ZHeT7Wq2IXCKhIf1Uoh032DcJS1EuMm/HmUx X-OriginatorOrg: nxp.com X-MS-Exchange-CrossTenant-Network-Message-Id: 9afe0694-7931-4ac9-bc05-08da9d7ad3ab X-MS-Exchange-CrossTenant-AuthSource: GV1PR04MB9055.eurprd04.prod.outlook.com X-MS-Exchange-CrossTenant-AuthAs: Internal X-MS-Exchange-CrossTenant-OriginalArrivalTime: 23 Sep 2022 15:46:49.3226 (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: WfqEvvXAS9+1/ahIjbe7y2Rd+RcjlFaVDRyDaV4qLz/VpUGtqXmdZO5aR6Vhxa9WjktSVM1WvR9dv9QUKn0xmQ== X-MS-Exchange-Transport-CrossTenantHeadersStamped: AS8PR04MB8724 Precedence: bulk List-ID: X-Mailing-List: netdev@vger.kernel.org X-Patchwork-Delegate: kuba@kernel.org From: Robert-Ionut Alexa The dpaa2_eth_alloc_skb() function is added by moving code from the dpaa2_eth_copybreak() previously defined function. What the new API does is to allocate a new skb, copy the frame data from the passed FD to the new skb and then return the skb. Export this new function since we'll need the this functionality also from the XSK code path. Signed-off-by: Robert-Ionut Alexa Signed-off-by: Ioana Ciornei --- Changes in v2: - none .../net/ethernet/freescale/dpaa2/dpaa2-eth.c | 25 +++++++++++++------ .../net/ethernet/freescale/dpaa2/dpaa2-eth.h | 5 ++++ 2 files changed, 22 insertions(+), 8 deletions(-) diff --git a/drivers/net/ethernet/freescale/dpaa2/dpaa2-eth.c b/drivers/net/ethernet/freescale/dpaa2/dpaa2-eth.c index d40d25e62b6a..a3958f02bd7e 100644 --- a/drivers/net/ethernet/freescale/dpaa2/dpaa2-eth.c +++ b/drivers/net/ethernet/freescale/dpaa2/dpaa2-eth.c @@ -485,19 +485,15 @@ static u32 dpaa2_eth_run_xdp(struct dpaa2_eth_priv *priv, return xdp_act; } -static struct sk_buff *dpaa2_eth_copybreak(struct dpaa2_eth_channel *ch, - const struct dpaa2_fd *fd, - void *fd_vaddr) +struct sk_buff *dpaa2_eth_alloc_skb(struct dpaa2_eth_priv *priv, + struct dpaa2_eth_channel *ch, + const struct dpaa2_fd *fd, u32 fd_length, + void *fd_vaddr) { u16 fd_offset = dpaa2_fd_get_offset(fd); - struct dpaa2_eth_priv *priv = ch->priv; - u32 fd_length = dpaa2_fd_get_len(fd); struct sk_buff *skb = NULL; unsigned int skb_len; - if (fd_length > priv->rx_copybreak) - return NULL; - skb_len = fd_length + dpaa2_eth_needed_headroom(NULL); skb = napi_alloc_skb(&ch->napi, skb_len); @@ -514,6 +510,19 @@ static struct sk_buff *dpaa2_eth_copybreak(struct dpaa2_eth_channel *ch, return skb; } +static struct sk_buff *dpaa2_eth_copybreak(struct dpaa2_eth_channel *ch, + const struct dpaa2_fd *fd, + void *fd_vaddr) +{ + struct dpaa2_eth_priv *priv = ch->priv; + u32 fd_length = dpaa2_fd_get_len(fd); + + if (fd_length > priv->rx_copybreak) + return NULL; + + return dpaa2_eth_alloc_skb(priv, ch, fd, fd_length, fd_vaddr); +} + /* Main Rx frame processing routine */ static void dpaa2_eth_rx(struct dpaa2_eth_priv *priv, struct dpaa2_eth_channel *ch, diff --git a/drivers/net/ethernet/freescale/dpaa2/dpaa2-eth.h b/drivers/net/ethernet/freescale/dpaa2/dpaa2-eth.h index bb0881e7033b..7c46ec37b29a 100644 --- a/drivers/net/ethernet/freescale/dpaa2/dpaa2-eth.h +++ b/drivers/net/ethernet/freescale/dpaa2/dpaa2-eth.h @@ -791,4 +791,9 @@ struct dpaa2_eth_trap_item *dpaa2_eth_dl_get_trap(struct dpaa2_eth_priv *priv, struct dpaa2_eth_bp *dpaa2_eth_allocate_dpbp(struct dpaa2_eth_priv *priv); void dpaa2_eth_free_dpbp(struct dpaa2_eth_priv *priv, struct dpaa2_eth_bp *bp); + +struct sk_buff *dpaa2_eth_alloc_skb(struct dpaa2_eth_priv *priv, + struct dpaa2_eth_channel *ch, + const struct dpaa2_fd *fd, u32 fd_length, + void *fd_vaddr); #endif /* __DPAA2_H */ From patchwork Fri Sep 23 15:45:53 2022 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Ioana Ciornei X-Patchwork-Id: 12986712 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 8BD98ECAAD8 for ; Fri, 23 Sep 2022 15:47:38 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S232220AbiIWPrg (ORCPT ); Fri, 23 Sep 2022 11:47:36 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:46138 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S231827AbiIWPqz (ORCPT ); Fri, 23 Sep 2022 11:46:55 -0400 Received: from EUR05-VI1-obe.outbound.protection.outlook.com (mail-vi1eur05on2071.outbound.protection.outlook.com [40.107.21.71]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id B2779A0604; Fri, 23 Sep 2022 08:46:53 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=Apm+pm2Ro2un1L22nKLRHm2l6VHtFKchyMkDoIZqakR0JfwWOzjhUooWyWNGMhnpiRBr/lLHXLVwiXB6HE4AUccuy1h1LYy2JQhgvd/ys0wOGXurnLAMXNprUATOHLbfiHpiCRDKnB6+uAHTUzZwEi/VshYu68Gm6X3au+DfhcqTNLavlxR304JF0ufKeaJwtp90acS2eFUBG9PDktZbuRsBL5cek2QsxicJ+MVMs+LrGTfEfvJ4r3O+aabxhVd571paw/oXDuGAR0T40rF4U5qjKAVaZrreHJH4qvzbCH9BnGHAUD+lembCkHr2bLu9yL90caFziM+2QaPULF8qHg== 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=YEOn5DO3hl1VkUQBPD2J76rzTXzWMwjDw3iWyE8TNJ4=; b=LBVyeMDyAM0LEOjvCBmaETFLQvlA4jbP3k2XsfOwyiFfq1RkJS2PJqrr7ZU9ZeRfkiDRcD2PlCgTPWWztzGBrqUyYTI6tAX5aoAlYgeujwaFqRkWgjA4wlYwhyZHD+ZhccnYg+Tgl/FRsVuQNSGAG9YJsxwAMI9JrLcTDJ7F3dYW26cwIH8Oj7kL4LLS2lYI9hJfdqSYW4eYI12EaIAp2yiMPFZLCVtgPRTd6Fdedp9w7RLCUWJ5FZ+24mUguCPilL0PVKxqQg5Dh5C3xp/ij7vabsdB0/BhCqX+EPz7vkPR+C0Yd1ObtTxpcbfu7qCY/+UQWz1PwBCsnJfSHjCqNA== 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=YEOn5DO3hl1VkUQBPD2J76rzTXzWMwjDw3iWyE8TNJ4=; b=o72VL+DH0/C23Tz/51di6hq0u1iy5YMzaz/7eYHZTUL9ldG3Vnsf2ieG+lCDLL2GLWFM3J8iP3YhF2DJ4s6A9BrUbNiqS7Bf3nb6+XvsClupvrfhHJLHHguC59ft8X/51U2NtK2tnNH7ND9Xiu6iLx7hpqsMpfQByYYQ2v8uMsw= 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 AS8PR04MB8724.eurprd04.prod.outlook.com (2603:10a6:20b:42b::6) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.5654.20; Fri, 23 Sep 2022 15:46:50 +0000 Received: from GV1PR04MB9055.eurprd04.prod.outlook.com ([fe80::dd0b:d481:bc5a:9f15]) by GV1PR04MB9055.eurprd04.prod.outlook.com ([fe80::dd0b:d481:bc5a:9f15%4]) with mapi id 15.20.5654.018; Fri, 23 Sep 2022 15:46:50 +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, Robert-Ionut Alexa , Ioana Ciornei Subject: [PATCH net-next v2 09/12] net: dpaa2-eth: create and export the dpaa2_eth_receive_skb() function Date: Fri, 23 Sep 2022 18:45:53 +0300 Message-Id: <20220923154556.721511-10-ioana.ciornei@nxp.com> X-Mailer: git-send-email 2.25.1 In-Reply-To: <20220923154556.721511-1-ioana.ciornei@nxp.com> References: <20220923154556.721511-1-ioana.ciornei@nxp.com> X-ClientProxiedBy: AM3PR05CA0152.eurprd05.prod.outlook.com (2603:10a6:207:3::30) To GV1PR04MB9055.eurprd04.prod.outlook.com (2603:10a6:150:1e::22) MIME-Version: 1.0 X-MS-PublicTrafficType: Email X-MS-TrafficTypeDiagnostic: GV1PR04MB9055:EE_|AS8PR04MB8724:EE_ X-MS-Office365-Filtering-Correlation-Id: 4727ac53-f39b-4739-f5af-08da9d7ad4af X-MS-Exchange-SenderADCheck: 1 X-MS-Exchange-AntiSpam-Relay: 0 X-Microsoft-Antispam: BCL:0; X-Microsoft-Antispam-Message-Info: 5bIHy3vO08lMjZaPt1/1KEswtQECM1dbNYI3IPGZ+7rccPESHmDga43f948ooIusfXOAD0ghaEjaj9i/KNnX1o9Ve9j92gy7wUrGBZ26CMHCum4PAXsXuIeU13kMGPEF+9VPJg5B+QXSms/emJp9CJH9JfH5PA3RxyA0Idz48iN+dl2cFIvyUTWmDqZYrbSyaM1fxO+wzrt7UwYoSpEzQS8r8hBz/fdQESne0BcZAp4cjNCjfUP+QbxYxcXlwzYH1OZ2yNHX7CpcSHiNDShzVKz8ieZyxCRu+gNdT1oo8wZThyjMgH6/Q/Y4EIblHUsVWg6auSw3Jdg0Tcb5IW0RdHaO23FMr5TTZ5eo7aNgi0sMnx0IHkd5OWYx7puDUUkoQHALe1INIF4Xj12v0zJc34D4CtVwPBNKyTvr5Sr2ouRs0a16TCKFB8C2g0gCdnI6BBXzpGBG8wgHvQZUYVyvK0p4oRz/+X9wsbcIibpCQS0yoEWhgVxdXjYDloQCe5uQrfDsDZWN9+992OZQZC18hKqpw/iKtZhMUeIll2J+MiR0PGOmpzFUYff8SUTUuOVQ8b5Okhv2MyQTL8cqU6VfTclJQ6CbE6eLHt0+jK/yqIZWVt+owwSM6iUDwc8+yOYCoHa3+JPdUbZz9r5+0AbvJiw+iutL0ffrhPUnzBeuQjE55lC/heVrkA52hurRwfdKETz9UwMDlRGo7NX1y56NcOheghcczNtNt+2pKHQB1jUtEiVvJ7dZO0s2e7ryMfq+9NPGAn+LRGZloI8WuG0JLA== 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)(39860400002)(366004)(396003)(376002)(346002)(136003)(451199015)(66476007)(41300700001)(52116002)(83380400001)(6506007)(66556008)(4326008)(66946007)(8676002)(26005)(36756003)(6512007)(38350700002)(8936002)(38100700002)(6486002)(110136005)(54906003)(316002)(478600001)(2906002)(2616005)(44832011)(86362001)(1076003)(7416002)(5660300002)(186003);DIR:OUT;SFP:1101; X-MS-Exchange-AntiSpam-MessageData-ChunkCount: 1 X-MS-Exchange-AntiSpam-MessageData-0: +/sKyRRl6f6mFrAPcq+Ag5Qat8wdLmWcmP6Jb0fyodLGs/hqSvTK5wNvwGVvYsdbV9o4UD0PisdjbYxLGb/cR5LkMUmHbYRtINPQZ0/AX2VUII325iILYIz15mB2aJl/BUOtmDP1W5AboHAkKTNcJ1lVQffu6U6AWd+TmnboUl++F6Ok+e3nFM7YDYhnfTDJBVwqP47UuSH07Rkuh+OmaUB+BKSUKNejKi4ig18EKrTwh7of5H8BHYWcUFFAbS+UMMoYNTJLGR/MT8mIZndqxal7qtQflgw+yr4LBHjjMoJV8KxfiBxnaqKKixEB6Ihy2y5sh+Q8RwDVi2vdXuEWutkvwCQLRbogrloX4jNeVvq1AnJZjMA28TpDauBzOdsdqnK5Y7EUHmvpT3NvjFqybrK/VwG94GXBPRQBt8uMlCe4iTytEE2TnbHbTnY9e31xeobT/Bq4Sj+h6/l/Nv3Fm3KWgSBMkc/siU9+wBMv49TvmKGzhYQwnSLcFzsZePo8SFpLllEV1ziX8MfTKUlL/CYXK9EExnbN4xAyL4AX7MxCa/qzOeiii1m+MyERfnzR0CEwXIiutA06heDL2q/jZTAib3LnZeAf2O8BU7KklGxBYpmUzwsiZIULG0VAPUwXAk5ntfmRJjNlAANpyMWXvju33WfA+RayjjZP1loBDbIal2V6VCtFThVMOXn0mD3FuEBTcLRIbNjj8zDIrEE7bV6zsLbXfqxsdc6k98FIixuPaf3eQA59M28E52OMJEv31gRgLeiSScyvt1mDqOFvjFZN0dVHvfbsFQFEy39liArZcxUt6duBhaNFP5XxxMOZTCYPlCYdbPgKUZrgIM0gbo6U7IiDsRcFPERYmz1FJHYRyjxs2VAAFhANZDT5ZJ3sTXFiCTULLRCAb7GOTX/M/sF4JUDG6wFbVnfJ3qw7HXRp/jLmR4k2UrpG0Guhvo9h/bdW8GM7CExNX/vJpK4wAW/29R1MnFCOpSuLczgpgt09J8ZiwvIK73k0aIh38AArHiHGnE6iwHtcEY76eFVoykaoRpb3BoQWQcEX16hnRTC0T/f/iHU9Z+5dxL2mdCWkvuhLNSACqroi0zfZUL2tIwAoG3cQCffhr32b3IC/CsDJA9ROFfWRfjzk57Jvp2A48QmPYtIv9yBsjug3q64aqHolZnrmFE9gAfXJP/iTVJ9dvZKT0waL3ATV0gPQixug0guaAY01HXitRDE488xNOr+l2t6OboifkKUw10bk7rPkjIu+E8oK0MK2VzMdLqS8NAxfEjygig2uOjUG0eERhHlDXAvwm8SrjvsCtfmyiLfmRaMO0R2bi3gtvcmd1kvavvQ76Y2vRD6UXstRpABMnJFbYdHRyp2iStywgei9Gheg6Pu65khYdlggxHhaBhlqrQh0Y2H1EUlAvml1rSqxG3UKLXGuK8gVirsRkJtyPq9qCan2+g/6F5OFmiRhP1iqSBHhK0sSTLvLZml19WPqk7QDPoBgTpJime2Twcrc1hoSnyT+y78dOoTTbBWHnYWGAun0DJkqYZbKqaRYYOzhqymeVMvWnf6srnzMhczh5/1DNcmG3YDdc2XVkoerdgBEzRl0+vbrYVMpmTFurlvUsQ== X-OriginatorOrg: nxp.com X-MS-Exchange-CrossTenant-Network-Message-Id: 4727ac53-f39b-4739-f5af-08da9d7ad4af X-MS-Exchange-CrossTenant-AuthSource: GV1PR04MB9055.eurprd04.prod.outlook.com X-MS-Exchange-CrossTenant-AuthAs: Internal X-MS-Exchange-CrossTenant-OriginalArrivalTime: 23 Sep 2022 15:46:50.7624 (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: LtWd/yK4q/3B2J91w9BE7/fZ+5LD6gVOruhOcp6Of8MbCIM0uhmQ+vMpkHZjU/gvf9vKa4yf1zaFXpjIXrxTjg== X-MS-Exchange-Transport-CrossTenantHeadersStamped: AS8PR04MB8724 Precedence: bulk List-ID: X-Mailing-List: netdev@vger.kernel.org X-Patchwork-Delegate: kuba@kernel.org From: Robert-Ionut Alexa Carve out code from the dpaa2_eth_rx() function in order to create and export the dpaa2_eth_receive_skb() function. Do this in order to reuse this code also from the XSK path which will be introduced in a later patch. Signed-off-by: Robert-Ionut Alexa Signed-off-by: Ioana Ciornei --- Changes in v2: - none .../net/ethernet/freescale/dpaa2/dpaa2-eth.c | 84 +++++++++++-------- .../net/ethernet/freescale/dpaa2/dpaa2-eth.h | 12 +++ 2 files changed, 59 insertions(+), 37 deletions(-) diff --git a/drivers/net/ethernet/freescale/dpaa2/dpaa2-eth.c b/drivers/net/ethernet/freescale/dpaa2/dpaa2-eth.c index a3958f02bd7e..d786740d1bdd 100644 --- a/drivers/net/ethernet/freescale/dpaa2/dpaa2-eth.c +++ b/drivers/net/ethernet/freescale/dpaa2/dpaa2-eth.c @@ -523,11 +523,53 @@ static struct sk_buff *dpaa2_eth_copybreak(struct dpaa2_eth_channel *ch, return dpaa2_eth_alloc_skb(priv, ch, fd, fd_length, fd_vaddr); } +void dpaa2_eth_receive_skb(struct dpaa2_eth_priv *priv, + struct dpaa2_eth_channel *ch, + const struct dpaa2_fd *fd, void *vaddr, + struct dpaa2_eth_fq *fq, + struct rtnl_link_stats64 *percpu_stats, + struct sk_buff *skb) +{ + struct dpaa2_fas *fas; + u32 status = 0; + + fas = dpaa2_get_fas(vaddr, false); + prefetch(fas); + prefetch(skb->data); + + /* Get the timestamp value */ + if (priv->rx_tstamp) { + struct skb_shared_hwtstamps *shhwtstamps = skb_hwtstamps(skb); + __le64 *ts = dpaa2_get_ts(vaddr, false); + u64 ns; + + memset(shhwtstamps, 0, sizeof(*shhwtstamps)); + + ns = DPAA2_PTP_CLK_PERIOD_NS * le64_to_cpup(ts); + shhwtstamps->hwtstamp = ns_to_ktime(ns); + } + + /* Check if we need to validate the L4 csum */ + if (likely(dpaa2_fd_get_frc(fd) & DPAA2_FD_FRC_FASV)) { + status = le32_to_cpu(fas->status); + dpaa2_eth_validate_rx_csum(priv, status, skb); + } + + skb->protocol = eth_type_trans(skb, priv->net_dev); + skb_record_rx_queue(skb, fq->flowid); + + percpu_stats->rx_packets++; + percpu_stats->rx_bytes += dpaa2_fd_get_len(fd); + ch->stats.bytes_per_cdan += dpaa2_fd_get_len(fd); + + list_add_tail(&skb->list, ch->rx_list); +} + /* Main Rx frame processing routine */ -static void dpaa2_eth_rx(struct dpaa2_eth_priv *priv, - struct dpaa2_eth_channel *ch, - const struct dpaa2_fd *fd, - struct dpaa2_eth_fq *fq) +void dpaa2_eth_rx(struct dpaa2_eth_priv *priv, + struct dpaa2_eth_channel *ch, + const struct dpaa2_fd *fd, + struct dpaa2_eth_fq *fq) { dma_addr_t addr = dpaa2_fd_get_addr(fd); u8 fd_format = dpaa2_fd_get_format(fd); @@ -536,9 +578,7 @@ static void dpaa2_eth_rx(struct dpaa2_eth_priv *priv, struct rtnl_link_stats64 *percpu_stats; struct dpaa2_eth_drv_stats *percpu_extras; struct device *dev = priv->net_dev->dev.parent; - struct dpaa2_fas *fas; void *buf_data; - u32 status = 0; u32 xdp_act; /* Tracing point */ @@ -548,8 +588,6 @@ static void dpaa2_eth_rx(struct dpaa2_eth_priv *priv, dma_sync_single_for_cpu(dev, addr, priv->rx_buf_size, DMA_BIDIRECTIONAL); - fas = dpaa2_get_fas(vaddr, false); - prefetch(fas); buf_data = vaddr + dpaa2_fd_get_offset(fd); prefetch(buf_data); @@ -587,35 +625,7 @@ static void dpaa2_eth_rx(struct dpaa2_eth_priv *priv, if (unlikely(!skb)) goto err_build_skb; - prefetch(skb->data); - - /* Get the timestamp value */ - if (priv->rx_tstamp) { - struct skb_shared_hwtstamps *shhwtstamps = skb_hwtstamps(skb); - __le64 *ts = dpaa2_get_ts(vaddr, false); - u64 ns; - - memset(shhwtstamps, 0, sizeof(*shhwtstamps)); - - ns = DPAA2_PTP_CLK_PERIOD_NS * le64_to_cpup(ts); - shhwtstamps->hwtstamp = ns_to_ktime(ns); - } - - /* Check if we need to validate the L4 csum */ - if (likely(dpaa2_fd_get_frc(fd) & DPAA2_FD_FRC_FASV)) { - status = le32_to_cpu(fas->status); - dpaa2_eth_validate_rx_csum(priv, status, skb); - } - - skb->protocol = eth_type_trans(skb, priv->net_dev); - skb_record_rx_queue(skb, fq->flowid); - - percpu_stats->rx_packets++; - percpu_stats->rx_bytes += dpaa2_fd_get_len(fd); - ch->stats.bytes_per_cdan += dpaa2_fd_get_len(fd); - - list_add_tail(&skb->list, ch->rx_list); - + dpaa2_eth_receive_skb(priv, ch, fd, vaddr, fq, percpu_stats, skb); return; err_build_skb: diff --git a/drivers/net/ethernet/freescale/dpaa2/dpaa2-eth.h b/drivers/net/ethernet/freescale/dpaa2/dpaa2-eth.h index 7c46ec37b29a..3c4fc46b1324 100644 --- a/drivers/net/ethernet/freescale/dpaa2/dpaa2-eth.h +++ b/drivers/net/ethernet/freescale/dpaa2/dpaa2-eth.h @@ -796,4 +796,16 @@ struct sk_buff *dpaa2_eth_alloc_skb(struct dpaa2_eth_priv *priv, struct dpaa2_eth_channel *ch, const struct dpaa2_fd *fd, u32 fd_length, void *fd_vaddr); + +void dpaa2_eth_receive_skb(struct dpaa2_eth_priv *priv, + struct dpaa2_eth_channel *ch, + const struct dpaa2_fd *fd, void *vaddr, + struct dpaa2_eth_fq *fq, + struct rtnl_link_stats64 *percpu_stats, + struct sk_buff *skb); + +void dpaa2_eth_rx(struct dpaa2_eth_priv *priv, + struct dpaa2_eth_channel *ch, + const struct dpaa2_fd *fd, + struct dpaa2_eth_fq *fq); #endif /* __DPAA2_H */ From patchwork Fri Sep 23 15:45: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: 12986713 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 E0FDEECAAD8 for ; Fri, 23 Sep 2022 15:47:40 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S232402AbiIWPri (ORCPT ); Fri, 23 Sep 2022 11:47:38 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:46180 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S231981AbiIWPq6 (ORCPT ); Fri, 23 Sep 2022 11:46:58 -0400 Received: from EUR05-VI1-obe.outbound.protection.outlook.com (mail-vi1eur05on2071.outbound.protection.outlook.com [40.107.21.71]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id CA53313A979; Fri, 23 Sep 2022 08:46:55 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=dKamwHRNt9UYI/C6IB9CQuhqXpQmxT5fRdvIuC99Fio4cmfu0CC0yo1lcrD0MF25gf9QT36FfSbMtZ/nPgF1EzfjRuXZ7m+gfrD1vune46clnape8wQcTcW9svkLdY8c/hHIv2rW0QjWXyiEDKW2cdxOZ8kPbS1eFoJ9uWgMwB8sEp/udEHJeGe7Hcv5epQMVgwL+dwHdJnozitAKyLOCMABn9dHuTX0DniNx+g7vnQduIIOw+Mqwjf1hM5VRRqJMa/TUtPb7UByjUth54oWcekQwXES7ncML60BGyUZPruMJ3N8k0b9TI1ylPn+mipFFHtkDR3aAKtc3gh0hk7v1Q== 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=ptshYWobvMSlKm168dltpvtpUE5UJaun/a4bZhKbTlI=; b=lM0OovnV5W+rlNiOQMjvqIasCTaUjSvpbnHqRmnPn+I7PHDKRoGYNV0KD7Gv5k3I8gYoFyfMwWA4/JfGA5kEdSsjpdjQ1jbQQZFVcaXxT+AM7dYHRao42aNCt/XJl74k0QQ9acexoQKfCdqAAW7mXjSGBV3J2AHu8QkXNg+FgM5AdXfdpYmv5x5Xwr4+nxRj9H1N8tmTuGssqnftBGak1CVr6Vq+ncDLKLpojgQQClVS+zCoLAf9LraXDEgxkYp+Jz56eQcBebhznsejiovzuox24EoUuBKPO89up4c6yJDnFl5rvh29ASWF5O27F4pC3v0gNhgD7Oqr921N56w6Aw== 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=ptshYWobvMSlKm168dltpvtpUE5UJaun/a4bZhKbTlI=; b=GZ3NXp342sjxByl0ouao7XDl9iU+2V/1olZqJ+HnCWq/fE6WqKIk7VK7jbIcK5ClaYRUkV6o+bseV75ru/aQb9zf+EHfElNRLtpOX3LiHYpOUEd5EHDcEIHYbPaTvT/mjDkGANtvGCX91DwRzL6ZJwDO+nobFGnDmeGRhy0N4As= 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 AS8PR04MB8724.eurprd04.prod.outlook.com (2603:10a6:20b:42b::6) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.5654.20; Fri, 23 Sep 2022 15:46:52 +0000 Received: from GV1PR04MB9055.eurprd04.prod.outlook.com ([fe80::dd0b:d481:bc5a:9f15]) by GV1PR04MB9055.eurprd04.prod.outlook.com ([fe80::dd0b:d481:bc5a:9f15%4]) with mapi id 15.20.5654.018; Fri, 23 Sep 2022 15:46:52 +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, Robert-Ionut Alexa , Ioana Ciornei Subject: [PATCH net-next v2 10/12] net: dpaa2-eth: AF_XDP RX zero copy support Date: Fri, 23 Sep 2022 18:45:54 +0300 Message-Id: <20220923154556.721511-11-ioana.ciornei@nxp.com> X-Mailer: git-send-email 2.25.1 In-Reply-To: <20220923154556.721511-1-ioana.ciornei@nxp.com> References: <20220923154556.721511-1-ioana.ciornei@nxp.com> X-ClientProxiedBy: AM3PR05CA0152.eurprd05.prod.outlook.com (2603:10a6:207:3::30) To GV1PR04MB9055.eurprd04.prod.outlook.com (2603:10a6:150:1e::22) MIME-Version: 1.0 X-MS-PublicTrafficType: Email X-MS-TrafficTypeDiagnostic: GV1PR04MB9055:EE_|AS8PR04MB8724:EE_ X-MS-Office365-Filtering-Correlation-Id: 67ab1b2b-31a9-4e92-02c1-08da9d7ad57b X-MS-Exchange-SenderADCheck: 1 X-MS-Exchange-AntiSpam-Relay: 0 X-Microsoft-Antispam: BCL:0; X-Microsoft-Antispam-Message-Info: f5MUTBMMuqRPkikmInfOt7BBjmjQ9dqSYXIkQI10Vg3ebSoz/Ep7OfLXot400Qu2x5JdUd3eYod519ZIg3WDVagHVNd/Ccwqi6dtUhWujuCwo/H79X+sgg479XHvo2b6pcXO8B1XONGGiXb0g2zbJa1ArA0XgNIcUUkVI3/TNzxKyLI24i6Fz41QeaTXk5RdiQ4h4V2GodiVPBNe/215fxZa+Cbx2cMxdZUK6EHNAqwP7E3INkbAX73F+KhQan7ExHvX/dvr44k8dxT/Lb5RR7XxtiljUQxOUmn61dQG+sK0sOBaxvTHKlGgOFyehxdOJH0iKWePIRcZveMqR2otOBUUDU1lzt7tfXUmjpcsSK9uzYQ503V6WNKAVcKJo8um4oYf4H6bl1blMZDpltc6MDZUlUYbVyAthJ6/VfnW3g6ee0b5GVuqbv+9Js/U6hTr3Xss5Ncgzd71VZpjuOjp45mh1RgOMJst/oidz3wum7kg7zuXHl0fVPG+cpZd9x/lEs1bit+EyFk2yAoqSQdhfFxIv/UeEolOUs6F4rqY6mna2nRJ1mwUlLfQWlXUhf+GRhDpiAzk6txsgQ8KCUN+kouDmTXS5BQC3wINVtO2Mhg9FhYciDPIdovJdBk9xZYQcRuZeQKYUFVHVRnuFx68po3jMmDnS2mKT+hwxHYYzsLohyCg+IiL2GTCZhSLx9datGtUh0W7EUa1hMnHZCllFHzGigkdFAbFhsV+cgUzQtaNTTVy8BrHaDNh4JVBp5IkKtgX310KEXrUFAvEYvpAgw== 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)(39860400002)(366004)(396003)(376002)(346002)(136003)(451199015)(66476007)(41300700001)(52116002)(83380400001)(6506007)(66556008)(4326008)(66946007)(8676002)(26005)(36756003)(6512007)(38350700002)(8936002)(38100700002)(6486002)(110136005)(54906003)(316002)(478600001)(2906002)(2616005)(30864003)(44832011)(86362001)(1076003)(7416002)(5660300002)(186003);DIR:OUT;SFP:1101; X-MS-Exchange-AntiSpam-MessageData-ChunkCount: 1 X-MS-Exchange-AntiSpam-MessageData-0: RjbBvl6TrGwGcCSrLJQMXDJLF9dDhgCFskqXamNM5Ikq0mMZhNVyD3Rs5U9BvXkYwA28CcxwBGn7ykkKOCyuYaQV7dcV2BvSYLUg1siM4XVMcPk2dCuf/Det7OqrU2OYQ0W58H3SZgYQCLjjagCsbjmvRrXe6zLPntos8Ounm7TBCKJfUrnLf+HKyZa6bXsyzv/f4ZLbupEpt7EUO5Ph6m3xHZAJ5LBmEJrZ74r1YNa23wSzshgauE2xMoFY9d0BveS1Bm51Uq840ZiJ03OdvTqUcGHmiEKpJlEZ0Yio8ejmiaAbkW9yKXMzOGY6hXvsLLo0t8RFx3kKmvhF2DC1bHrPA000Ldbbn72yptn3q5RCBREVufRBKX4g4kaNRg8nudF3p3gAgNV9vyBH4GutOKUe16pxR7csm1HR7ugyDHThM2wjHzMhqL25pc0opOQve90pTcSL7+b9IGfSoH3PUsce1oMuoeHFw9h8lAH6t5rttUjnidV+p0K3s6KK2AGt+Zed2akgE7gzs8HOxnFkDZcCrbyP5gOvUhTm3YmOWq4siT6oM7uHs5vAKYUypezlnot9qNin8kukAC5ZgYc/vuvlLcFKVY6z/rEXb7z55AjwV6yoz6SYEOUoUQ+FQj6d14ZkbUtoAwBXpM6WRH2MAjYJILyKVUnOohZe2UQilJHm7tait9Ur4jzytDBOOCbqR9tZLApFDSn/ayllNSSWMb6RCj86ZJL5MyW7ibBxoHGL2GgPBImJHDTgFFpUrvs5MsEvckipVja6Wo24N7A3QXdTfqyn3Pcgv4nbffNgeCbFA49hEGbZFXFShMwO2q7EHooh04gRr/FM38PLJDwuK9wzvb66+SbyJVH9SofslEXJhijtLyhPBMS5WwV1B1YZk9saHROghhfPbHFZfhuQ3kvJUsK5oew1FfUWQLBc7sGpmcPNYJm6O+Tb2GWpLAzaT7s3FRTA7ERolR2mF9cGHbr58Mrcoe32VxMHYh4J7d0MV3UgGAAUX15UHvcKjAEP85aJSvu1iLMPIXxLRiJjAf/00qBzwMwvVsrPQOdTWOiwtcqrhgIZGevSHOKO0GJWzdcNknwVLR7O23K8IjSbsKrlY+Nli5xU5fdoSh1eQzBWrVm68HauQBdKGXvXvZE2IfEAXdy1PDCV8X4fgfJMBH8sXapq+7YoGsm51VIR4zkaFUftarHftCqWcRvoYOIY/3MPh453foXRpLYCSSPllzDVC7LEWhbshw8EODwktUxdGBZwLFIX4M1lBFNIb27mJEgGX16e8QjgjsbKCzyLYyzK2Y1Qi7f6aJlwLTsEnz5nnlSRJorAxS55Zq8hId0SbXd6a/bULdNNZ+GUehPRu/x9Y126GDZARTsN+Krsn7X/nr3BNUkiJkn5DS8eCM/hn80nSrnqA6PA4mJ+vOchZNlMz6TGNzFVvFVsi0Y054k29RTGP7UwPfFSbhkyB4HRmKpMvL7QgLFri2r5n6UfcrFh9bo6ccIwAUZ9lfmqUu5H2NQkdcfnizwK5DivzLV4I10aKYrSALr3MBBlVF4awzRiqYobl7wWGmpFcOZcMOVfC6BA/e5mrX4V/VxcJJmlc7CfkeIn/h5FgNFB1iJFew== X-OriginatorOrg: nxp.com X-MS-Exchange-CrossTenant-Network-Message-Id: 67ab1b2b-31a9-4e92-02c1-08da9d7ad57b X-MS-Exchange-CrossTenant-AuthSource: GV1PR04MB9055.eurprd04.prod.outlook.com X-MS-Exchange-CrossTenant-AuthAs: Internal X-MS-Exchange-CrossTenant-OriginalArrivalTime: 23 Sep 2022 15:46:52.1400 (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: iG2eYCCmjaTcAOUkD2KZXriDUEpfGjVidy+UDvZHzp4ashKQjKwDUqwzaa8jcM3agkZt9NrFhszt9H9Z6C+I2A== X-MS-Exchange-Transport-CrossTenantHeadersStamped: AS8PR04MB8724 Precedence: bulk List-ID: X-Mailing-List: netdev@vger.kernel.org X-Patchwork-Delegate: kuba@kernel.org From: Robert-Ionut Alexa This patch adds the support for receiving packets via the AF_XDP zero-copy mechanism in the dpaa2-eth driver. The support is available only on the LX2160A SoC and variants because we are relying on the HW capability to associate a buffer pool to a specific queue (QDBIN), only available on newer WRIOP versions. On the control path, the dpaa2_xsk_enable_pool() function is responsible to allocate a buffer pool (BP), setup this new BP to be used only on the requested queue and change the consume function to point to the XSK ZC one. We are forced to call dev_close() in order to change the queue to buffer pool association (dpaa2_xsk_set_bp_per_qdbin) . This also works in our favor since at dev_close() the buffer pools will be drained and at the later dev_open() call they will be again seeded, this time with buffers allocated from the XSK pool if needed. On the data path, a new software annotation type is defined to be used only for the XSK scenarios. This will enable us to pass keep necessary information about a packet buffer between the moment in which it was seeded and when it's received by the driver. In the XSK case, we are keeping the associated xdp_buff. Depending on the action returned by the BPF program, we will do the following: - XDP_PASS: copy the contents of the packet into a brand new skb, recycle the initial buffer. - XDP_TX: just enqueue the same frame descriptor back into the Tx path, the buffer will get automatically released into the initial BP. - XDP_REDIRECT: call xdp_do_redirect() and exit. Signed-off-by: Robert-Ionut Alexa Signed-off-by: Ioana Ciornei --- Changes in v2: - none MAINTAINERS | 1 + drivers/net/ethernet/freescale/dpaa2/Makefile | 2 +- .../net/ethernet/freescale/dpaa2/dpaa2-eth.c | 131 ++++--- .../net/ethernet/freescale/dpaa2/dpaa2-eth.h | 36 +- .../net/ethernet/freescale/dpaa2/dpaa2-xsk.c | 327 ++++++++++++++++++ 5 files changed, 452 insertions(+), 45 deletions(-) create mode 100644 drivers/net/ethernet/freescale/dpaa2/dpaa2-xsk.c diff --git a/MAINTAINERS b/MAINTAINERS index 1415a1498d68..004411566f48 100644 --- a/MAINTAINERS +++ b/MAINTAINERS @@ -6290,6 +6290,7 @@ F: drivers/net/ethernet/freescale/dpaa2/Kconfig F: drivers/net/ethernet/freescale/dpaa2/Makefile F: drivers/net/ethernet/freescale/dpaa2/dpaa2-eth* F: drivers/net/ethernet/freescale/dpaa2/dpaa2-mac* +F: drivers/net/ethernet/freescale/dpaa2/dpaa2-xsk* F: drivers/net/ethernet/freescale/dpaa2/dpkg.h F: drivers/net/ethernet/freescale/dpaa2/dpmac* F: drivers/net/ethernet/freescale/dpaa2/dpni* diff --git a/drivers/net/ethernet/freescale/dpaa2/Makefile b/drivers/net/ethernet/freescale/dpaa2/Makefile index 3d9842af7f10..1b05ba8d1cbf 100644 --- a/drivers/net/ethernet/freescale/dpaa2/Makefile +++ b/drivers/net/ethernet/freescale/dpaa2/Makefile @@ -7,7 +7,7 @@ obj-$(CONFIG_FSL_DPAA2_ETH) += fsl-dpaa2-eth.o obj-$(CONFIG_FSL_DPAA2_PTP_CLOCK) += fsl-dpaa2-ptp.o obj-$(CONFIG_FSL_DPAA2_SWITCH) += fsl-dpaa2-switch.o -fsl-dpaa2-eth-objs := dpaa2-eth.o dpaa2-ethtool.o dpni.o dpaa2-mac.o dpmac.o dpaa2-eth-devlink.o +fsl-dpaa2-eth-objs := dpaa2-eth.o dpaa2-ethtool.o dpni.o dpaa2-mac.o dpmac.o dpaa2-eth-devlink.o dpaa2-xsk.o fsl-dpaa2-eth-${CONFIG_FSL_DPAA2_ETH_DCB} += dpaa2-eth-dcb.o fsl-dpaa2-eth-${CONFIG_DEBUG_FS} += dpaa2-eth-debugfs.o fsl-dpaa2-ptp-objs := dpaa2-ptp.o dprtc.o diff --git a/drivers/net/ethernet/freescale/dpaa2/dpaa2-eth.c b/drivers/net/ethernet/freescale/dpaa2/dpaa2-eth.c index d786740d1bdd..1e94506bf9e6 100644 --- a/drivers/net/ethernet/freescale/dpaa2/dpaa2-eth.c +++ b/drivers/net/ethernet/freescale/dpaa2/dpaa2-eth.c @@ -19,6 +19,7 @@ #include #include #include +#include #include "dpaa2-eth.h" @@ -104,8 +105,8 @@ static void dpaa2_ptp_onestep_reg_update_method(struct dpaa2_eth_priv *priv) priv->dpaa2_set_onestep_params_cb = dpaa2_update_ptp_onestep_direct; } -static void *dpaa2_iova_to_virt(struct iommu_domain *domain, - dma_addr_t iova_addr) +void *dpaa2_iova_to_virt(struct iommu_domain *domain, + dma_addr_t iova_addr) { phys_addr_t phys_addr; @@ -279,23 +280,33 @@ static struct sk_buff *dpaa2_eth_build_frag_skb(struct dpaa2_eth_priv *priv, * be released in the pool */ static void dpaa2_eth_free_bufs(struct dpaa2_eth_priv *priv, u64 *buf_array, - int count) + int count, bool xsk_zc) { struct device *dev = priv->net_dev->dev.parent; + struct dpaa2_eth_swa *swa; + struct xdp_buff *xdp_buff; void *vaddr; int i; for (i = 0; i < count; i++) { vaddr = dpaa2_iova_to_virt(priv->iommu_domain, buf_array[i]); - dma_unmap_page(dev, buf_array[i], priv->rx_buf_size, - DMA_BIDIRECTIONAL); - free_pages((unsigned long)vaddr, 0); + + if (!xsk_zc) { + dma_unmap_page(dev, buf_array[i], priv->rx_buf_size, + DMA_BIDIRECTIONAL); + free_pages((unsigned long)vaddr, 0); + } else { + swa = (struct dpaa2_eth_swa *) + (vaddr + DPAA2_ETH_RX_HWA_SIZE); + xdp_buff = swa->xsk.xdp_buff; + xsk_buff_free(xdp_buff); + } } } -static void dpaa2_eth_recycle_buf(struct dpaa2_eth_priv *priv, - struct dpaa2_eth_channel *ch, - dma_addr_t addr) +void dpaa2_eth_recycle_buf(struct dpaa2_eth_priv *priv, + struct dpaa2_eth_channel *ch, + dma_addr_t addr) { int retries = 0; int err; @@ -313,7 +324,8 @@ static void dpaa2_eth_recycle_buf(struct dpaa2_eth_priv *priv, } if (err) { - dpaa2_eth_free_bufs(priv, ch->recycled_bufs, ch->recycled_bufs_cnt); + dpaa2_eth_free_bufs(priv, ch->recycled_bufs, + ch->recycled_bufs_cnt, ch->xsk_zc); ch->buf_count -= ch->recycled_bufs_cnt; } @@ -377,10 +389,10 @@ static void dpaa2_eth_xdp_tx_flush(struct dpaa2_eth_priv *priv, fq->xdp_tx_fds.num = 0; } -static void dpaa2_eth_xdp_enqueue(struct dpaa2_eth_priv *priv, - struct dpaa2_eth_channel *ch, - struct dpaa2_fd *fd, - void *buf_start, u16 queue_id) +void dpaa2_eth_xdp_enqueue(struct dpaa2_eth_priv *priv, + struct dpaa2_eth_channel *ch, + struct dpaa2_fd *fd, + void *buf_start, u16 queue_id) { struct dpaa2_faead *faead; struct dpaa2_fd *dest_fd; @@ -1652,37 +1664,63 @@ static int dpaa2_eth_set_tx_csum(struct dpaa2_eth_priv *priv, bool enable) static int dpaa2_eth_add_bufs(struct dpaa2_eth_priv *priv, struct dpaa2_eth_channel *ch) { + struct xdp_buff *xdp_buffs[DPAA2_ETH_BUFS_PER_CMD]; struct device *dev = priv->net_dev->dev.parent; u64 buf_array[DPAA2_ETH_BUFS_PER_CMD]; + struct dpaa2_eth_swa *swa; struct page *page; dma_addr_t addr; int retries = 0; - int i, err; - - for (i = 0; i < DPAA2_ETH_BUFS_PER_CMD; i++) { - /* Allocate buffer visible to WRIOP + skb shared info + - * alignment padding - */ - /* allocate one page for each Rx buffer. WRIOP sees - * the entire page except for a tailroom reserved for - * skb shared info + int i = 0, err; + u32 batch; + + /* Allocate buffers visible to WRIOP */ + if (!ch->xsk_zc) { + for (i = 0; i < DPAA2_ETH_BUFS_PER_CMD; i++) { + /* Also allocate skb shared info and alignment padding. + * There is one page for each Rx buffer. WRIOP sees + * the entire page except for a tailroom reserved for + * skb shared info + */ + page = dev_alloc_pages(0); + if (!page) + goto err_alloc; + + addr = dma_map_page(dev, page, 0, priv->rx_buf_size, + DMA_BIDIRECTIONAL); + if (unlikely(dma_mapping_error(dev, addr))) + goto err_map; + + buf_array[i] = addr; + + /* tracing point */ + trace_dpaa2_eth_buf_seed(priv->net_dev, + page_address(page), + DPAA2_ETH_RX_BUF_RAW_SIZE, + addr, priv->rx_buf_size, + ch->bp->bpid); + } + } else if (xsk_buff_can_alloc(ch->xsk_pool, DPAA2_ETH_BUFS_PER_CMD)) { + /* Allocate XSK buffers for AF_XDP fast path in batches + * of DPAA2_ETH_BUFS_PER_CMD. Bail out if the UMEM cannot + * provide enough buffers at the moment */ - page = dev_alloc_pages(0); - if (!page) + batch = xsk_buff_alloc_batch(ch->xsk_pool, xdp_buffs, + DPAA2_ETH_BUFS_PER_CMD); + if (!batch) goto err_alloc; - addr = dma_map_page(dev, page, 0, priv->rx_buf_size, - DMA_BIDIRECTIONAL); - if (unlikely(dma_mapping_error(dev, addr))) - goto err_map; + for (i = 0; i < batch; i++) { + swa = (struct dpaa2_eth_swa *)(xdp_buffs[i]->data_hard_start + + DPAA2_ETH_RX_HWA_SIZE); + swa->xsk.xdp_buff = xdp_buffs[i]; - buf_array[i] = addr; + addr = xsk_buff_xdp_get_frame_dma(xdp_buffs[i]); + if (unlikely(dma_mapping_error(dev, addr))) + goto err_map; - /* tracing point */ - trace_dpaa2_eth_buf_seed(priv->net_dev, page_address(page), - DPAA2_ETH_RX_BUF_RAW_SIZE, - addr, priv->rx_buf_size, - ch->bp->bpid); + buf_array[i] = addr; + } } release_bufs: @@ -1698,14 +1736,19 @@ static int dpaa2_eth_add_bufs(struct dpaa2_eth_priv *priv, * not much else we can do about it */ if (err) { - dpaa2_eth_free_bufs(priv, buf_array, i); + dpaa2_eth_free_bufs(priv, buf_array, i, ch->xsk_zc); return 0; } return i; err_map: - __free_pages(page, 0); + if (!ch->xsk_zc) { + __free_pages(page, 0); + } else { + for (; i < batch; i++) + xsk_buff_free(xdp_buffs[i]); + } err_alloc: /* If we managed to allocate at least some buffers, * release them to hardware @@ -1764,8 +1807,13 @@ static void dpaa2_eth_drain_bufs(struct dpaa2_eth_priv *priv, int bpid, int count) { u64 buf_array[DPAA2_ETH_BUFS_PER_CMD]; + bool xsk_zc = false; int retries = 0; - int ret; + int i, ret; + + for (i = 0; i < priv->num_channels; i++) + if (priv->channel[i]->bp->bpid == bpid) + xsk_zc = priv->channel[i]->xsk_zc; do { ret = dpaa2_io_service_acquire(NULL, bpid, buf_array, count); @@ -1776,7 +1824,7 @@ static void dpaa2_eth_drain_bufs(struct dpaa2_eth_priv *priv, int bpid, netdev_err(priv->net_dev, "dpaa2_io_service_acquire() failed\n"); return; } - dpaa2_eth_free_bufs(priv, buf_array, ret); + dpaa2_eth_free_bufs(priv, buf_array, ret, xsk_zc); retries = 0; } while (ret); } @@ -2694,6 +2742,8 @@ static int dpaa2_eth_xdp(struct net_device *dev, struct netdev_bpf *xdp) switch (xdp->command) { case XDP_SETUP_PROG: return dpaa2_eth_setup_xdp(dev, xdp->prog); + case XDP_SETUP_XSK_POOL: + return dpaa2_xsk_setup_pool(dev, xdp->xsk.pool, xdp->xsk.queue_id); default: return -EINVAL; } @@ -2924,6 +2974,7 @@ static const struct net_device_ops dpaa2_eth_ops = { .ndo_change_mtu = dpaa2_eth_change_mtu, .ndo_bpf = dpaa2_eth_xdp, .ndo_xdp_xmit = dpaa2_eth_xdp_xmit, + .ndo_xsk_wakeup = dpaa2_xsk_wakeup, .ndo_setup_tc = dpaa2_eth_setup_tc, .ndo_vlan_rx_add_vid = dpaa2_eth_rx_add_vid, .ndo_vlan_rx_kill_vid = dpaa2_eth_rx_kill_vid @@ -4246,8 +4297,8 @@ static int dpaa2_eth_bind_dpni(struct dpaa2_eth_priv *priv) { struct dpaa2_eth_bp *bp = priv->bp[DPAA2_ETH_DEFAULT_BP_IDX]; struct net_device *net_dev = priv->net_dev; + struct dpni_pools_cfg pools_params = { 0 }; struct device *dev = net_dev->dev.parent; - struct dpni_pools_cfg pools_params; struct dpni_error_cfg err_cfg; int err = 0; int i; diff --git a/drivers/net/ethernet/freescale/dpaa2/dpaa2-eth.h b/drivers/net/ethernet/freescale/dpaa2/dpaa2-eth.h index 3c4fc46b1324..38f67b98865f 100644 --- a/drivers/net/ethernet/freescale/dpaa2/dpaa2-eth.h +++ b/drivers/net/ethernet/freescale/dpaa2/dpaa2-eth.h @@ -130,6 +130,7 @@ enum dpaa2_eth_swa_type { DPAA2_ETH_SWA_SINGLE, DPAA2_ETH_SWA_SG, DPAA2_ETH_SWA_XDP, + DPAA2_ETH_SWA_XSK, DPAA2_ETH_SWA_SW_TSO, }; @@ -151,6 +152,9 @@ struct dpaa2_eth_swa { int dma_size; struct xdp_frame *xdpf; } xdp; + struct { + struct xdp_buff *xdp_buff; + } xsk; struct { struct sk_buff *skb; int num_sg; @@ -429,12 +433,19 @@ enum dpaa2_eth_fq_type { }; struct dpaa2_eth_priv; +struct dpaa2_eth_channel; +struct dpaa2_eth_fq; struct dpaa2_eth_xdp_fds { struct dpaa2_fd fds[DEV_MAP_BULK_SIZE]; ssize_t num; }; +typedef void dpaa2_eth_consume_cb_t(struct dpaa2_eth_priv *priv, + struct dpaa2_eth_channel *ch, + const struct dpaa2_fd *fd, + struct dpaa2_eth_fq *fq); + struct dpaa2_eth_fq { u32 fqid; u32 tx_qdbin; @@ -447,10 +458,7 @@ struct dpaa2_eth_fq { struct dpaa2_eth_channel *channel; enum dpaa2_eth_fq_type type; - void (*consume)(struct dpaa2_eth_priv *priv, - struct dpaa2_eth_channel *ch, - const struct dpaa2_fd *fd, - struct dpaa2_eth_fq *fq); + dpaa2_eth_consume_cb_t *consume; struct dpaa2_eth_fq_stats stats; struct dpaa2_eth_xdp_fds xdp_redirect_fds; @@ -486,6 +494,8 @@ struct dpaa2_eth_channel { u64 recycled_bufs[DPAA2_ETH_BUFS_PER_CMD]; int recycled_bufs_cnt; + bool xsk_zc; + struct xsk_buff_pool *xsk_pool; struct dpaa2_eth_bp *bp; }; @@ -808,4 +818,22 @@ void dpaa2_eth_rx(struct dpaa2_eth_priv *priv, struct dpaa2_eth_channel *ch, const struct dpaa2_fd *fd, struct dpaa2_eth_fq *fq); + +struct dpaa2_eth_bp *dpaa2_eth_allocate_dpbp(struct dpaa2_eth_priv *priv); +void dpaa2_eth_free_dpbp(struct dpaa2_eth_priv *priv, + struct dpaa2_eth_bp *bp); + +void *dpaa2_iova_to_virt(struct iommu_domain *domain, dma_addr_t iova_addr); +void dpaa2_eth_recycle_buf(struct dpaa2_eth_priv *priv, + struct dpaa2_eth_channel *ch, + dma_addr_t addr); + +void dpaa2_eth_xdp_enqueue(struct dpaa2_eth_priv *priv, + struct dpaa2_eth_channel *ch, + struct dpaa2_fd *fd, + void *buf_start, u16 queue_id); + +int dpaa2_xsk_wakeup(struct net_device *dev, u32 qid, u32 flags); +int dpaa2_xsk_setup_pool(struct net_device *dev, struct xsk_buff_pool *pool, u16 qid); + #endif /* __DPAA2_H */ diff --git a/drivers/net/ethernet/freescale/dpaa2/dpaa2-xsk.c b/drivers/net/ethernet/freescale/dpaa2/dpaa2-xsk.c new file mode 100644 index 000000000000..2df7bffec5a7 --- /dev/null +++ b/drivers/net/ethernet/freescale/dpaa2/dpaa2-xsk.c @@ -0,0 +1,327 @@ +// SPDX-License-Identifier: (GPL-2.0+ OR BSD-3-Clause) +/* Copyright 2022 NXP + */ +#include +#include +#include +#include +#include + +#include "dpaa2-eth.h" + +static void dpaa2_eth_setup_consume_func(struct dpaa2_eth_priv *priv, + struct dpaa2_eth_channel *ch, + enum dpaa2_eth_fq_type type, + dpaa2_eth_consume_cb_t *consume) +{ + struct dpaa2_eth_fq *fq; + int i; + + for (i = 0; i < priv->num_fqs; i++) { + fq = &priv->fq[i]; + + if (fq->type != type) + continue; + if (fq->channel != ch) + continue; + + fq->consume = consume; + } +} + +static u32 dpaa2_xsk_run_xdp(struct dpaa2_eth_priv *priv, + struct dpaa2_eth_channel *ch, + struct dpaa2_eth_fq *rx_fq, + struct dpaa2_fd *fd, void *vaddr) +{ + dma_addr_t addr = dpaa2_fd_get_addr(fd); + struct bpf_prog *xdp_prog; + struct xdp_buff *xdp_buff; + struct dpaa2_eth_swa *swa; + u32 xdp_act = XDP_PASS; + int err; + + xdp_prog = READ_ONCE(ch->xdp.prog); + if (!xdp_prog) + goto out; + + swa = (struct dpaa2_eth_swa *)(vaddr + DPAA2_ETH_RX_HWA_SIZE + + ch->xsk_pool->umem->headroom); + xdp_buff = swa->xsk.xdp_buff; + + xdp_buff->data_hard_start = vaddr; + xdp_buff->data = vaddr + dpaa2_fd_get_offset(fd); + xdp_buff->data_end = xdp_buff->data + dpaa2_fd_get_len(fd); + xdp_set_data_meta_invalid(xdp_buff); + xdp_buff->rxq = &ch->xdp_rxq; + + xsk_buff_dma_sync_for_cpu(xdp_buff, ch->xsk_pool); + xdp_act = bpf_prog_run_xdp(xdp_prog, xdp_buff); + + /* xdp.data pointer may have changed */ + dpaa2_fd_set_offset(fd, xdp_buff->data - vaddr); + dpaa2_fd_set_len(fd, xdp_buff->data_end - xdp_buff->data); + + if (likely(xdp_act == XDP_REDIRECT)) { + err = xdp_do_redirect(priv->net_dev, xdp_buff, xdp_prog); + if (unlikely(err)) { + ch->stats.xdp_drop++; + dpaa2_eth_recycle_buf(priv, ch, addr); + } else { + ch->buf_count--; + ch->stats.xdp_redirect++; + } + + goto xdp_redir; + } + + switch (xdp_act) { + case XDP_PASS: + break; + case XDP_TX: + dpaa2_eth_xdp_enqueue(priv, ch, fd, vaddr, rx_fq->flowid); + break; + default: + bpf_warn_invalid_xdp_action(priv->net_dev, xdp_prog, xdp_act); + fallthrough; + case XDP_ABORTED: + trace_xdp_exception(priv->net_dev, xdp_prog, xdp_act); + fallthrough; + case XDP_DROP: + dpaa2_eth_recycle_buf(priv, ch, addr); + ch->stats.xdp_drop++; + break; + } + +xdp_redir: + ch->xdp.res |= xdp_act; +out: + return xdp_act; +} + +/* Rx frame processing routine for the AF_XDP fast path */ +static void dpaa2_xsk_rx(struct dpaa2_eth_priv *priv, + struct dpaa2_eth_channel *ch, + const struct dpaa2_fd *fd, + struct dpaa2_eth_fq *fq) +{ + dma_addr_t addr = dpaa2_fd_get_addr(fd); + u8 fd_format = dpaa2_fd_get_format(fd); + struct rtnl_link_stats64 *percpu_stats; + u32 fd_length = dpaa2_fd_get_len(fd); + struct sk_buff *skb; + void *vaddr; + u32 xdp_act; + + vaddr = dpaa2_iova_to_virt(priv->iommu_domain, addr); + percpu_stats = this_cpu_ptr(priv->percpu_stats); + + if (fd_format != dpaa2_fd_single) { + WARN_ON(priv->xdp_prog); + /* AF_XDP doesn't support any other formats */ + goto err_frame_format; + } + + xdp_act = dpaa2_xsk_run_xdp(priv, ch, fq, (struct dpaa2_fd *)fd, vaddr); + if (xdp_act != XDP_PASS) { + percpu_stats->rx_packets++; + percpu_stats->rx_bytes += dpaa2_fd_get_len(fd); + return; + } + + /* Build skb */ + skb = dpaa2_eth_alloc_skb(priv, ch, fd, fd_length, vaddr); + if (!skb) + /* Nothing else we can do, recycle the buffer and + * drop the frame. + */ + goto err_alloc_skb; + + /* Send the skb to the Linux networking stack */ + dpaa2_eth_receive_skb(priv, ch, fd, vaddr, fq, percpu_stats, skb); + + return; + +err_alloc_skb: + dpaa2_eth_recycle_buf(priv, ch, addr); +err_frame_format: + percpu_stats->rx_dropped++; +} + +static void dpaa2_xsk_set_bp_per_qdbin(struct dpaa2_eth_priv *priv, + struct dpni_pools_cfg *pools_params) +{ + int curr_bp = 0, i, j; + + pools_params->pool_options = DPNI_POOL_ASSOC_QDBIN; + for (i = 0; i < priv->num_bps; i++) { + for (j = 0; j < priv->num_channels; j++) + if (priv->bp[i] == priv->channel[j]->bp) + pools_params->pools[curr_bp].priority_mask |= (1 << j); + if (!pools_params->pools[curr_bp].priority_mask) + continue; + + pools_params->pools[curr_bp].dpbp_id = priv->bp[i]->bpid; + pools_params->pools[curr_bp].buffer_size = priv->rx_buf_size; + pools_params->pools[curr_bp++].backup_pool = 0; + } + pools_params->num_dpbp = curr_bp; +} + +static int dpaa2_xsk_disable_pool(struct net_device *dev, u16 qid) +{ + struct xsk_buff_pool *pool = xsk_get_pool_from_qid(dev, qid); + struct dpaa2_eth_priv *priv = netdev_priv(dev); + struct dpni_pools_cfg pools_params = { 0 }; + struct dpaa2_eth_channel *ch; + int err; + bool up; + + ch = priv->channel[qid]; + if (!ch->xsk_pool) + return -EINVAL; + + up = netif_running(dev); + if (up) + dev_close(dev); + + xsk_pool_dma_unmap(pool, 0); + err = xdp_rxq_info_reg_mem_model(&ch->xdp_rxq, + MEM_TYPE_PAGE_ORDER0, NULL); + if (err) + netdev_err(dev, "xsk_rxq_info_reg_mem_model() failed (err = %d)\n", + err); + + dpaa2_eth_free_dpbp(priv, ch->bp); + + ch->xsk_zc = false; + ch->xsk_pool = NULL; + ch->bp = priv->bp[DPAA2_ETH_DEFAULT_BP_IDX]; + + dpaa2_eth_setup_consume_func(priv, ch, DPAA2_RX_FQ, dpaa2_eth_rx); + + dpaa2_xsk_set_bp_per_qdbin(priv, &pools_params); + err = dpni_set_pools(priv->mc_io, 0, priv->mc_token, &pools_params); + if (err) + netdev_err(dev, "dpni_set_pools() failed\n"); + + if (up) { + err = dev_open(dev, NULL); + if (err) + return err; + } + + return 0; +} + +static int dpaa2_xsk_enable_pool(struct net_device *dev, + struct xsk_buff_pool *pool, + u16 qid) +{ + struct dpaa2_eth_priv *priv = netdev_priv(dev); + struct dpni_pools_cfg pools_params = { 0 }; + struct dpaa2_eth_channel *ch; + int err, err2; + bool up; + + if (priv->dpni_attrs.wriop_version < DPAA2_WRIOP_VERSION(3, 0, 0)) { + netdev_err(dev, "AF_XDP zero-copy not supported on devices <= WRIOP(3, 0, 0)\n"); + return -EOPNOTSUPP; + } + + if (priv->dpni_attrs.num_queues > 8) { + netdev_err(dev, "AF_XDP zero-copy not supported on DPNI with more then 8 queues\n"); + return -EOPNOTSUPP; + } + + up = netif_running(dev); + if (up) + dev_close(dev); + + err = xsk_pool_dma_map(pool, priv->net_dev->dev.parent, 0); + if (err) { + netdev_err(dev, "xsk_pool_dma_map() failed (err = %d)\n", + err); + goto err_dma_unmap; + } + + ch = priv->channel[qid]; + err = xdp_rxq_info_reg_mem_model(&ch->xdp_rxq, MEM_TYPE_XSK_BUFF_POOL, NULL); + if (err) { + netdev_err(dev, "xdp_rxq_info_reg_mem_model() failed (err = %d)\n", err); + goto err_mem_model; + } + xsk_pool_set_rxq_info(pool, &ch->xdp_rxq); + + priv->bp[priv->num_bps] = dpaa2_eth_allocate_dpbp(priv); + if (IS_ERR(priv->bp[priv->num_bps])) { + err = PTR_ERR(priv->bp[priv->num_bps]); + goto err_bp_alloc; + } + ch->xsk_zc = true; + ch->xsk_pool = pool; + ch->bp = priv->bp[priv->num_bps++]; + + dpaa2_eth_setup_consume_func(priv, ch, DPAA2_RX_FQ, dpaa2_xsk_rx); + + dpaa2_xsk_set_bp_per_qdbin(priv, &pools_params); + err = dpni_set_pools(priv->mc_io, 0, priv->mc_token, &pools_params); + if (err) { + netdev_err(dev, "dpni_set_pools() failed\n"); + goto err_set_pools; + } + + if (up) { + err = dev_open(dev, NULL); + if (err) + return err; + } + + return 0; + +err_set_pools: + err2 = dpaa2_xsk_disable_pool(dev, qid); + if (err2) + netdev_err(dev, "dpaa2_xsk_disable_pool() failed %d\n", err2); +err_bp_alloc: + err2 = xdp_rxq_info_reg_mem_model(&priv->channel[qid]->xdp_rxq, + MEM_TYPE_PAGE_ORDER0, NULL); + if (err2) + netdev_err(dev, "xsk_rxq_info_reg_mem_model() failed with %d)\n", err2); +err_mem_model: + xsk_pool_dma_unmap(pool, 0); +err_dma_unmap: + if (up) + dev_open(dev, NULL); + + return err; +} + +int dpaa2_xsk_setup_pool(struct net_device *dev, struct xsk_buff_pool *pool, u16 qid) +{ + return pool ? dpaa2_xsk_enable_pool(dev, pool, qid) : + dpaa2_xsk_disable_pool(dev, qid); +} + +int dpaa2_xsk_wakeup(struct net_device *dev, u32 qid, u32 flags) +{ + struct dpaa2_eth_priv *priv = netdev_priv(dev); + struct dpaa2_eth_channel *ch = priv->channel[qid]; + + if (!priv->link_state.up) + return -ENETDOWN; + + if (!priv->xdp_prog) + return -EINVAL; + + if (!ch->xsk_zc) + return -EINVAL; + + /* We do not have access to a per channel SW interrupt, so instead we + * schedule a NAPI instance. + */ + if (!napi_if_scheduled_mark_missed(&ch->napi)) + napi_schedule(&ch->napi); + + return 0; +} From patchwork Fri Sep 23 15:45:55 2022 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Ioana Ciornei X-Patchwork-Id: 12986714 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 24B24C6FA82 for ; Fri, 23 Sep 2022 15:47:46 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S229794AbiIWPrm (ORCPT ); Fri, 23 Sep 2022 11:47:42 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:47352 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S230448AbiIWPrD (ORCPT ); Fri, 23 Sep 2022 11:47:03 -0400 Received: from EUR05-VI1-obe.outbound.protection.outlook.com (mail-vi1eur05on2071.outbound.protection.outlook.com [40.107.21.71]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id A1E8C13E7CC; Fri, 23 Sep 2022 08:46:58 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=TjcGj3ZSqT2Yu5sCTdLNdylq1GE/FcaOtiWTh5Yf1CYByk/jfQdWTKNQtkx5CZHKWkPxSIWLiXVcJaPf7Llj9VnOExuBEqG6MRGEL23Qwf6LIOLeldeY1k2gVpSYkVIeMf0+0QGN7tP6x/Vr9SSJowRr3dFHABsDwQ8S5E2wvLBm8q/g7OFa0zwjahgMXjKo6SApnG37HdNgTWnlkCRqMaP6jQaCTRyzbZzdE9ZODlxv9hZD39Red0IU3ObJHOiIKVdCWEJXnZ7QGkUiynSnM3yEyBleMQkulQoSiK38HNBnya4M5xI/gyAdPSOmHyIkACZaVSsAe2sGdVWZWf6NCw== 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=bHbJHpBAJ8dgeuyVtluaMKejajTi4NghnRGJWzd+3jw=; b=HIPq/hUxlf0+phwD7fpRBolaaxGyx3xsyCUKH+1F2arWDD834nQtgHnfgrizVru8jEFbxDyJFMA6a8LWoFCIpQMRkwdoZzhqxLDAMvGPdtrbi5L1U9hIrpamxDM+5MBJAZXsK8E9wJY58BIWJQtHaDXptEAFDf/qL2LPrLAqn5L2Otc3MSpHxaPMtx0/RiffiECQM3ClfIw7VAOZM8juJ8LymWkovQQSS1+ac4wx1qv5wJswAe9ooAYN1liwqTupYmYx20KR5EtUpm8ULtBCGiC/hVjLnnG1ckme5syT4Pl2L3xNa3zZLsHPJka0KSHzDzomLb2bJ9kLY/Q5FpYqFg== 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=bHbJHpBAJ8dgeuyVtluaMKejajTi4NghnRGJWzd+3jw=; b=MES2KgPzNCUq5w8OrR1IT943AmkiI1yrGex8fVod5YdN4Sjn1cA/uvg+cmzbiEH/vOLS3BCK7SkIup+FlLIORJSFqrsS25T5FQvjocH1mh0kKlowFdWc0ASx1M76NX7XPYKlZ4iAin7NxuzOlSp1My2f5yvBgXCqFkQ4+FOGI5g= 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 AS8PR04MB8724.eurprd04.prod.outlook.com (2603:10a6:20b:42b::6) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.5654.20; Fri, 23 Sep 2022 15:46:53 +0000 Received: from GV1PR04MB9055.eurprd04.prod.outlook.com ([fe80::dd0b:d481:bc5a:9f15]) by GV1PR04MB9055.eurprd04.prod.outlook.com ([fe80::dd0b:d481:bc5a:9f15%4]) with mapi id 15.20.5654.018; Fri, 23 Sep 2022 15:46:53 +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, Robert-Ionut Alexa , Ioana Ciornei Subject: [PATCH net-next v2 11/12] net: dpaa2-eth: AF_XDP TX zero copy support Date: Fri, 23 Sep 2022 18:45:55 +0300 Message-Id: <20220923154556.721511-12-ioana.ciornei@nxp.com> X-Mailer: git-send-email 2.25.1 In-Reply-To: <20220923154556.721511-1-ioana.ciornei@nxp.com> References: <20220923154556.721511-1-ioana.ciornei@nxp.com> X-ClientProxiedBy: AM3PR05CA0152.eurprd05.prod.outlook.com (2603:10a6:207:3::30) To GV1PR04MB9055.eurprd04.prod.outlook.com (2603:10a6:150:1e::22) MIME-Version: 1.0 X-MS-PublicTrafficType: Email X-MS-TrafficTypeDiagnostic: GV1PR04MB9055:EE_|AS8PR04MB8724:EE_ X-MS-Office365-Filtering-Correlation-Id: 589834dc-84ed-4594-6a02-08da9d7ad651 X-MS-Exchange-SenderADCheck: 1 X-MS-Exchange-AntiSpam-Relay: 0 X-Microsoft-Antispam: BCL:0; X-Microsoft-Antispam-Message-Info: OFGfVYYtFDypDSJhYVXr8cG0Vy3ASJlP6YpXXZiLv/3MG62zcnoskJ2zWQtEU+1+/UNJ3Jmi3e9ia9+LQpe8DQZfxYGS07kIn2nOiFzi4b0ZqKmBGwE9Kdm3IIRDg2v3BysM9lwibsSBl6FVmIiyiMCk+KYwIWK1WZjBXJOYICS7J0T6HfkfvvOp3s7pEnUffXq7KcYTLpIfs/Cs5gnQUAAXh7C4rTJcA+hJQQ5I07do5tTE/U0i32ZpCetwI3GuuwPY2JYGdtYfY3vrdQR9+LkWbnQjMBzg5EQailKsXTSp5fAo13/ZRWTsqcy1c+QJw+QsM+J5u+qzmgHvvo1RHFyYe+Msfz9PVMCpqWnYOe7YU8ttWm1m0+U3m1ofiRWqawl5y8yUogJxrdl5Gy1ERCDn+qrzC677fSoDAcaA14IAz/35vrIWzpG6kERJvZNX2fnM3J93X3pJe2h3GJ1BA8yM6B76lDYxWSrSbPKzP4G30vhoqpNax6fnj/X9ZYd1pSDNEcZ2WGZgzfcwRAuCTskzukEQC+qq7Jw5bXz64+aPS7jWaET5Q9vBjU8vRv0yJVQQ8Z1q0GPnWpxr2Nns9RT2MK8gi5GKOf5ErjDoxh4g3GuYD10TaaW0+6VZStzVSWpxw0mXAi7us4ymZUfRx6KQgBcOiAL19DnMpVik9vZS5yAvnMO2tIgCYxxYMevtijbdu+4yDmySd7jih9nAE6s+Y/H7QTK+ys/sq90iBY3yX/wsVtqqeG9M0iyOx/kRLrUCW4bHitN7O5dqhoOSKA== 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)(39860400002)(366004)(396003)(376002)(346002)(136003)(451199015)(66476007)(41300700001)(52116002)(83380400001)(6506007)(66556008)(4326008)(66946007)(8676002)(26005)(36756003)(6512007)(38350700002)(8936002)(38100700002)(6486002)(110136005)(54906003)(316002)(478600001)(2906002)(2616005)(30864003)(44832011)(86362001)(1076003)(7416002)(5660300002)(186003);DIR:OUT;SFP:1101; X-MS-Exchange-AntiSpam-MessageData-ChunkCount: 1 X-MS-Exchange-AntiSpam-MessageData-0: VmuixnR2xtcKagIFxKg1M84gHwY4zh5uPhOD/jwW08JkYzTu4mgbjbBIc59P2sw7dUxvSjHvcedDhVHF5YGvNMkMeiiBOddvd8d8b+ErjJAxiKb16bkbrJFgFZmHpRZ/sEDwYaq5iCmDbwxFoFGdNGe5TSuShaatj95MkILfWvi9FzbPXezwKqZojMhvqmVWNP/zzE45GxmoQn7RjORCedTxWZvTVg3ttS92rlU1PgWDLK44miwVndPDwk8GMij2xauy+3jsFR5lqzFjnY0dxyg9MBGlAcKX7St1mw/UgC0Hp9yVw2/Siopv/SR3XJW1NLZyuNZPA24ptn4Wo7+yuRmMrj0kdhrdvAomQjs9k7FL86F8bpuL9RtIwbZj3qwqn3eoYq+9Dw2y2L/VuaqiLpQ+YKPy3Ij/E3Lk+wXXEhr50Uru3WIjAxezYoCPTbazY8QC+uMLObZg0/YZdm0E32Cz1lZ6Pb+/EA9mESzJMGOhsPb0sAzGP/C6g7+XnqWkvTkKRnmX+/vxEcq9K/4KczXsZIVxS+hB1SBn3EIW6sAjAZxTMyDG2F41ZiJKOF5vOt2qA1+Em/KQ1iiuiyQDDtfLmOhvIEcq7WhjCxuXSMnHGw26JqUdJ13IdLlSqwBnh5M3qu++MufJwYonDr1B6iN2/ZtckT74J79FV8PviwEwTQzWWe6vIcNdD0ipViPXA6pH9Drvg/Jo1M6JGBJHdTcGi9lNDAh4V8rZhY/rFPTxAFvPwvU7mk7pnxcebX721ufcsQTmzrXH5wDzGTjUt9bbyCZg6D/6bgPEtmg91K2WySNzBDts5uwUF8uDiSOwElQncQYzHWGlIrFL2nsrzpl3gLaVEtPcb28fCQy7DHKryNo9pqv1cim9KXeeAmM4Cih1NeSTlqXniv6q1zaZT7/jS2MdMpgFfN8WnAFHQyzSNPiLIOf3HFFRyIK4oaUBXh9SrSiMHZB4S2I95LdOj6RxSyC/aTUJyxk4W8CIRfHQEpy5WWtM03A/5kMqdUZ6fgzt8Lu+TfPKSnRP8xiy+/IEH4ruFy6OwpnVDQJ9ONkQi8wCU4MDwtlzYrDFzMbVjcXD/6MnC7purnp1+U30Bhq3do1tZzImlwqfw8x0pm2VjqTjg7uiC3IUgYM+q2mYJj3w6dN7s1y0tRpm0UL3rX7Sgb/yIebPYa4G27jnKCIxiGhErbfNOloyq1TRDWpF/Qq7fiLMX6bUoqn2Hz0SUyJ+utkv6WRvD1xEaR8sqO3suceWWnWFAhuwZN0K6u9kC33l8cUwNWPIwKGQJQ4VkVRKYCWcsowVB5w7JAMbUeBko6XJTZa4aTYXOGRxT7nLBqi93qx8hxt7HVjmi8FQ08uDkGqBgFUpixDPDBOLCiEvJxtHGfijzgevM5whN8zpVzBx0koDa9uGdEIMjWYZtsZ5tfqgZm9GKJWJzuBXyEhA2R9hMqrh61WcNVmnbycvyHwfmsVlNqgwCNTcWX6jD0Rpf6j0Na4TTkZTTbUFsVc7AhTX8MbfeBCBJ7jPDfIM+w0qE6zkUrkluvIKqnFPjTPVGxm1GS+4q7HU4Dy+4If7RTI4z65dYBB1OPZlER3zYj+HagsI9Yu0Ypa3C8HPQg== X-OriginatorOrg: nxp.com X-MS-Exchange-CrossTenant-Network-Message-Id: 589834dc-84ed-4594-6a02-08da9d7ad651 X-MS-Exchange-CrossTenant-AuthSource: GV1PR04MB9055.eurprd04.prod.outlook.com X-MS-Exchange-CrossTenant-AuthAs: Internal X-MS-Exchange-CrossTenant-OriginalArrivalTime: 23 Sep 2022 15:46:53.5451 (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: BV80STpgGOE9IKHpcCn/PqGHZTowyBDL2ot/TxH7cWSxkaBhsHIZThQg4AmpTcv+cxxJi0j52rxIfSfODu72Jw== X-MS-Exchange-Transport-CrossTenantHeadersStamped: AS8PR04MB8724 Precedence: bulk List-ID: X-Mailing-List: netdev@vger.kernel.org X-Patchwork-Delegate: kuba@kernel.org From: Robert-Ionut Alexa Add support in dpaa2-eth for packet processing on the Tx path using AF_XDP zero copy mode. The newly added dpaa2_xsk_tx() function will handle enqueuing AF_XDP Tx packets into the appropriate queue and update any necessary statistics. On a more detailed note, the dpaa2_xsk_tx_build_fd() function handles creating a Scatter-Gather frame descriptor with only one data buffer. This is needed because otherwise we would need to impose a headroom in the Tx buffer to store our software annotation structures. This tactic is already used on the normal data path of the dpaa2-eth driver, thus we are reusing the dpaa2_eth_sgt_get/dpaa2_eth_sgt_recycle functions in order to allocate and recycle the Scatter-Gather table buffers. In case we have reached the maximum number of Tx XSK packets to be sent in a NAPI cycle, we'll exit the dpaa2_eth_poll() and hope to be rescheduled again. On the XSK Tx confirmation path, we are just unmapping the SGT buffer and recycle it for further use. Signed-off-by: Robert-Ionut Alexa Signed-off-by: Ioana Ciornei --- Changes in v2: - none .../net/ethernet/freescale/dpaa2/dpaa2-eth.c | 48 +++++-- .../net/ethernet/freescale/dpaa2/dpaa2-eth.h | 22 +++- .../net/ethernet/freescale/dpaa2/dpaa2-xsk.c | 123 ++++++++++++++++++ 3 files changed, 183 insertions(+), 10 deletions(-) diff --git a/drivers/net/ethernet/freescale/dpaa2/dpaa2-eth.c b/drivers/net/ethernet/freescale/dpaa2/dpaa2-eth.c index 1e94506bf9e6..4cfdbf644466 100644 --- a/drivers/net/ethernet/freescale/dpaa2/dpaa2-eth.c +++ b/drivers/net/ethernet/freescale/dpaa2/dpaa2-eth.c @@ -858,7 +858,7 @@ static void dpaa2_eth_enable_tx_tstamp(struct dpaa2_eth_priv *priv, } } -static void *dpaa2_eth_sgt_get(struct dpaa2_eth_priv *priv) +void *dpaa2_eth_sgt_get(struct dpaa2_eth_priv *priv) { struct dpaa2_eth_sgt_cache *sgt_cache; void *sgt_buf = NULL; @@ -880,7 +880,7 @@ static void *dpaa2_eth_sgt_get(struct dpaa2_eth_priv *priv) return sgt_buf; } -static void dpaa2_eth_sgt_recycle(struct dpaa2_eth_priv *priv, void *sgt_buf) +void dpaa2_eth_sgt_recycle(struct dpaa2_eth_priv *priv, void *sgt_buf) { struct dpaa2_eth_sgt_cache *sgt_cache; @@ -1115,9 +1115,10 @@ static int dpaa2_eth_build_single_fd(struct dpaa2_eth_priv *priv, * This can be called either from dpaa2_eth_tx_conf() or on the error path of * dpaa2_eth_tx(). */ -static void dpaa2_eth_free_tx_fd(struct dpaa2_eth_priv *priv, - struct dpaa2_eth_fq *fq, - const struct dpaa2_fd *fd, bool in_napi) +void dpaa2_eth_free_tx_fd(struct dpaa2_eth_priv *priv, + struct dpaa2_eth_channel *ch, + struct dpaa2_eth_fq *fq, + const struct dpaa2_fd *fd, bool in_napi) { struct device *dev = priv->net_dev->dev.parent; dma_addr_t fd_addr, sg_addr; @@ -1184,6 +1185,10 @@ static void dpaa2_eth_free_tx_fd(struct dpaa2_eth_priv *priv, if (!swa->tso.is_last_fd) should_free_skb = 0; + } else if (swa->type == DPAA2_ETH_SWA_XSK) { + /* Unmap the SGT Buffer */ + dma_unmap_single(dev, fd_addr, swa->xsk.sgt_size, + DMA_BIDIRECTIONAL); } else { skb = swa->single.skb; @@ -1201,6 +1206,12 @@ static void dpaa2_eth_free_tx_fd(struct dpaa2_eth_priv *priv, return; } + if (swa->type == DPAA2_ETH_SWA_XSK) { + ch->xsk_tx_pkts_sent++; + dpaa2_eth_sgt_recycle(priv, buffer_start); + return; + } + if (swa->type != DPAA2_ETH_SWA_XDP && in_napi) { fq->dq_frames++; fq->dq_bytes += fd_len; @@ -1375,7 +1386,7 @@ static int dpaa2_eth_build_gso_fd(struct dpaa2_eth_priv *priv, err_sgt_get: /* Free all the other FDs that were already fully created */ for (i = 0; i < index; i++) - dpaa2_eth_free_tx_fd(priv, NULL, &fd_start[i], false); + dpaa2_eth_free_tx_fd(priv, NULL, NULL, &fd_start[i], false); return err; } @@ -1491,7 +1502,7 @@ static netdev_tx_t __dpaa2_eth_tx(struct sk_buff *skb, if (unlikely(err < 0)) { percpu_stats->tx_errors++; /* Clean up everything, including freeing the skb */ - dpaa2_eth_free_tx_fd(priv, fq, fd, false); + dpaa2_eth_free_tx_fd(priv, NULL, fq, fd, false); netdev_tx_completed_queue(nq, 1, fd_len); } else { percpu_stats->tx_packets += total_enqueued; @@ -1584,7 +1595,7 @@ static void dpaa2_eth_tx_conf(struct dpaa2_eth_priv *priv, /* Check frame errors in the FD field */ fd_errors = dpaa2_fd_get_ctrl(fd) & DPAA2_FD_TX_ERR_MASK; - dpaa2_eth_free_tx_fd(priv, fq, fd, true); + dpaa2_eth_free_tx_fd(priv, ch, fq, fd, true); if (likely(!fd_errors)) return; @@ -1929,6 +1940,7 @@ static int dpaa2_eth_poll(struct napi_struct *napi, int budget) struct dpaa2_eth_fq *fq, *txc_fq = NULL; struct netdev_queue *nq; int store_cleaned, work_done; + bool work_done_zc = false; struct list_head rx_list; int retries = 0; u16 flowid; @@ -1941,6 +1953,15 @@ static int dpaa2_eth_poll(struct napi_struct *napi, int budget) INIT_LIST_HEAD(&rx_list); ch->rx_list = &rx_list; + if (ch->xsk_zc) { + work_done_zc = dpaa2_xsk_tx(priv, ch); + /* If we reached the XSK Tx per NAPI threshold, we're done */ + if (work_done_zc) { + work_done = budget; + goto out; + } + } + do { err = dpaa2_eth_pull_channel(ch); if (unlikely(err)) @@ -1993,6 +2014,11 @@ static int dpaa2_eth_poll(struct napi_struct *napi, int budget) out: netif_receive_skb_list(ch->rx_list); + if (ch->xsk_tx_pkts_sent) { + xsk_tx_completed(ch->xsk_pool, ch->xsk_tx_pkts_sent); + ch->xsk_tx_pkts_sent = 0; + } + if (txc_fq && txc_fq->dq_frames) { nq = netdev_get_tx_queue(priv->net_dev, txc_fq->flowid); netdev_tx_completed_queue(nq, txc_fq->dq_frames, @@ -2989,7 +3015,11 @@ static void dpaa2_eth_cdan_cb(struct dpaa2_io_notification_ctx *ctx) /* Update NAPI statistics */ ch->stats.cdan++; - napi_schedule(&ch->napi); + /* NAPI can also be scheduled from the AF_XDP Tx path. Mark a missed + * so that it can be rescheduled again. + */ + if (!napi_if_scheduled_mark_missed(&ch->napi)) + napi_schedule(&ch->napi); } /* Allocate and configure a DPCON object */ diff --git a/drivers/net/ethernet/freescale/dpaa2/dpaa2-eth.h b/drivers/net/ethernet/freescale/dpaa2/dpaa2-eth.h index 38f67b98865f..5d0fc432e5b2 100644 --- a/drivers/net/ethernet/freescale/dpaa2/dpaa2-eth.h +++ b/drivers/net/ethernet/freescale/dpaa2/dpaa2-eth.h @@ -53,6 +53,12 @@ */ #define DPAA2_ETH_TXCONF_PER_NAPI 256 +/* Maximum number of Tx frames to be processed in a single NAPI + * call when AF_XDP is running. Bind it to DPAA2_ETH_TXCONF_PER_NAPI + * to maximize the throughput. + */ +#define DPAA2_ETH_TX_ZC_PER_NAPI DPAA2_ETH_TXCONF_PER_NAPI + /* Buffer qouta per channel. We want to keep in check number of ingress frames * in flight: for small sized frames, congestion group taildrop may kick in * first; for large sizes, Rx FQ taildrop threshold will ensure only a @@ -154,6 +160,7 @@ struct dpaa2_eth_swa { } xdp; struct { struct xdp_buff *xdp_buff; + int sgt_size; } xsk; struct { struct sk_buff *skb; @@ -495,6 +502,7 @@ struct dpaa2_eth_channel { int recycled_bufs_cnt; bool xsk_zc; + int xsk_tx_pkts_sent; struct xsk_buff_pool *xsk_pool; struct dpaa2_eth_bp *bp; }; @@ -531,7 +539,7 @@ struct dpaa2_eth_trap_data { #define DPAA2_ETH_DEFAULT_COPYBREAK 512 -#define DPAA2_ETH_ENQUEUE_MAX_FDS 200 +#define DPAA2_ETH_ENQUEUE_MAX_FDS 256 struct dpaa2_eth_fds { struct dpaa2_fd array[DPAA2_ETH_ENQUEUE_MAX_FDS]; }; @@ -836,4 +844,16 @@ void dpaa2_eth_xdp_enqueue(struct dpaa2_eth_priv *priv, int dpaa2_xsk_wakeup(struct net_device *dev, u32 qid, u32 flags); int dpaa2_xsk_setup_pool(struct net_device *dev, struct xsk_buff_pool *pool, u16 qid); +void dpaa2_eth_free_tx_fd(struct dpaa2_eth_priv *priv, + struct dpaa2_eth_channel *ch, + struct dpaa2_eth_fq *fq, + const struct dpaa2_fd *fd, bool in_napi); +bool dpaa2_xsk_tx(struct dpaa2_eth_priv *priv, + struct dpaa2_eth_channel *ch); + +/* SGT (Scatter-Gather Table) cache management */ +void *dpaa2_eth_sgt_get(struct dpaa2_eth_priv *priv); + +void dpaa2_eth_sgt_recycle(struct dpaa2_eth_priv *priv, void *sgt_buf); + #endif /* __DPAA2_H */ diff --git a/drivers/net/ethernet/freescale/dpaa2/dpaa2-xsk.c b/drivers/net/ethernet/freescale/dpaa2/dpaa2-xsk.c index 2df7bffec5a7..731318842054 100644 --- a/drivers/net/ethernet/freescale/dpaa2/dpaa2-xsk.c +++ b/drivers/net/ethernet/freescale/dpaa2/dpaa2-xsk.c @@ -196,6 +196,7 @@ static int dpaa2_xsk_disable_pool(struct net_device *dev, u16 qid) ch->xsk_zc = false; ch->xsk_pool = NULL; + ch->xsk_tx_pkts_sent = 0; ch->bp = priv->bp[DPAA2_ETH_DEFAULT_BP_IDX]; dpaa2_eth_setup_consume_func(priv, ch, DPAA2_RX_FQ, dpaa2_eth_rx); @@ -325,3 +326,125 @@ int dpaa2_xsk_wakeup(struct net_device *dev, u32 qid, u32 flags) return 0; } + +static int dpaa2_xsk_tx_build_fd(struct dpaa2_eth_priv *priv, + struct dpaa2_eth_channel *ch, + struct dpaa2_fd *fd, + struct xdp_desc *xdp_desc) +{ + struct device *dev = priv->net_dev->dev.parent; + struct dpaa2_sg_entry *sgt; + struct dpaa2_eth_swa *swa; + void *sgt_buf = NULL; + dma_addr_t sgt_addr; + int sgt_buf_size; + dma_addr_t addr; + int err = 0; + + /* Prepare the HW SGT structure */ + sgt_buf_size = priv->tx_data_offset + sizeof(struct dpaa2_sg_entry); + sgt_buf = dpaa2_eth_sgt_get(priv); + if (unlikely(!sgt_buf)) + return -ENOMEM; + sgt = (struct dpaa2_sg_entry *)(sgt_buf + priv->tx_data_offset); + + /* Get the address of the XSK Tx buffer */ + addr = xsk_buff_raw_get_dma(ch->xsk_pool, xdp_desc->addr); + xsk_buff_raw_dma_sync_for_device(ch->xsk_pool, addr, xdp_desc->len); + + /* Fill in the HW SGT structure */ + dpaa2_sg_set_addr(sgt, addr); + dpaa2_sg_set_len(sgt, xdp_desc->len); + dpaa2_sg_set_final(sgt, true); + + /* Store the necessary info in the SGT buffer */ + swa = (struct dpaa2_eth_swa *)sgt_buf; + swa->type = DPAA2_ETH_SWA_XSK; + swa->xsk.sgt_size = sgt_buf_size; + + /* Separately map the SGT buffer */ + sgt_addr = dma_map_single(dev, sgt_buf, sgt_buf_size, DMA_BIDIRECTIONAL); + if (unlikely(dma_mapping_error(dev, sgt_addr))) { + err = -ENOMEM; + goto sgt_map_failed; + } + + /* Initialize FD fields */ + memset(fd, 0, sizeof(struct dpaa2_fd)); + dpaa2_fd_set_offset(fd, priv->tx_data_offset); + dpaa2_fd_set_format(fd, dpaa2_fd_sg); + dpaa2_fd_set_addr(fd, sgt_addr); + dpaa2_fd_set_len(fd, xdp_desc->len); + dpaa2_fd_set_ctrl(fd, FD_CTRL_PTA); + + return 0; + +sgt_map_failed: + dpaa2_eth_sgt_recycle(priv, sgt_buf); + + return err; +} + +bool dpaa2_xsk_tx(struct dpaa2_eth_priv *priv, + struct dpaa2_eth_channel *ch) +{ + struct xdp_desc *xdp_descs = ch->xsk_pool->tx_descs; + struct dpaa2_eth_drv_stats *percpu_extras; + struct rtnl_link_stats64 *percpu_stats; + int budget = DPAA2_ETH_TX_ZC_PER_NAPI; + int total_enqueued, enqueued; + int retries, max_retries; + struct dpaa2_eth_fq *fq; + struct dpaa2_fd *fds; + int batch, i, err; + + percpu_stats = this_cpu_ptr(priv->percpu_stats); + percpu_extras = this_cpu_ptr(priv->percpu_extras); + fds = (this_cpu_ptr(priv->fd))->array; + + /* Use the FQ with the same idx as the affine CPU */ + fq = &priv->fq[ch->nctx.desired_cpu]; + + batch = xsk_tx_peek_release_desc_batch(ch->xsk_pool, budget); + if (!batch) + return false; + + /* Create a FD for each XSK frame to be sent */ + for (i = 0; i < batch; i++) { + err = dpaa2_xsk_tx_build_fd(priv, ch, &fds[i], &xdp_descs[i]); + if (err) { + batch = i; + break; + } + } + + /* Enqueue all the created FDs */ + max_retries = batch * DPAA2_ETH_ENQUEUE_RETRIES; + total_enqueued = 0; + enqueued = 0; + retries = 0; + while (total_enqueued < batch && retries < max_retries) { + err = priv->enqueue(priv, fq, &fds[total_enqueued], 0, + batch - total_enqueued, &enqueued); + if (err == -EBUSY) { + retries++; + continue; + } + + total_enqueued += enqueued; + } + percpu_extras->tx_portal_busy += retries; + + /* Update statistics */ + percpu_stats->tx_packets += total_enqueued; + for (i = 0; i < total_enqueued; i++) + percpu_stats->tx_bytes += dpaa2_fd_get_len(&fds[i]); + for (i = total_enqueued; i < batch; i++) { + dpaa2_eth_free_tx_fd(priv, ch, fq, &fds[i], false); + percpu_stats->tx_errors++; + } + + xsk_tx_release(ch->xsk_pool); + + return total_enqueued == budget ? true : false; +} From patchwork Fri Sep 23 15:45:56 2022 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Ioana Ciornei X-Patchwork-Id: 12986715 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 3AAF7ECAAD8 for ; Fri, 23 Sep 2022 15:48:01 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S232294AbiIWPr7 (ORCPT ); Fri, 23 Sep 2022 11:47:59 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:48132 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S232213AbiIWPrG (ORCPT ); Fri, 23 Sep 2022 11:47:06 -0400 Received: from EUR05-VI1-obe.outbound.protection.outlook.com (mail-vi1eur05on2071.outbound.protection.outlook.com [40.107.21.71]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 87BD85A8B2; Fri, 23 Sep 2022 08:47:03 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=izNsB3dRphDE7CRcIOs4TSvq+SAR+4Guqz1ZnyGyOLIU2BPWxxfb3Vqleicqy68Dp+jkxZr9dZIpN9bBKsOvrwMMxqd+6N/v+V/c7Ru2jkSQ7AeOQDLp7up7J2CjYQ/a1xU/aXUwg0TQQyzpsxqCkOhqjmZIefztzuFXgb4g10xug+UPB/fQdsXr0jiH1Xw/0Oj28sIVGqcg+rv1/uzCFL9pFsINtDVosv6Opg+uwgnCO4CsGYYlYfCbuX6kJlVxzstOCxqK4LIsqcGD00sfsLKl18aAgIYTlFvfWn0qrVkL+JQK74II3w7yNXkoUQaiz9LTD0OARzwtbjXiP5dpbQ== 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=iRifrcB0Hnsok+K4UozMkJwYCQ9Z0pkV6fmXuhnux8U=; b=HXyb30iRgp8jL9K3Kmu68Dos6Ro4vKa/W3EvQGDu7Z5GU/0zstFTkHlsZpmxPtItiVo6MpprixyEO0rb14tskjA4H5Qcj6z2rn6N/WIcHFznRMKkKLEO6GWJyP7w2G0Dwd9XykgwWdp7TWtyy3ySeAW+bMsHH0z+Ig3BD2alXtkxXJ5ohQwbKVMpI4MyARe8Ift6PYLov3hXNxSixKRTTqOqFPhktigmzD+kUtuaKPPtEAAvz0db3p6ERPLpjZyZ2ytchkdpb6FIYsRZH8rmpWRjEJX0TtXRuoCILxRpgfhzC7osRedSpSP4dI8gYWl3aBWkuRdE9H/blpvf/NWwpw== 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=iRifrcB0Hnsok+K4UozMkJwYCQ9Z0pkV6fmXuhnux8U=; b=nLkWRMYyJaHxxdyI8O5MKv4vbCzygmNCx2k4SHi7Q3SfFnVnaSqF7TSr/HhXafkjhfPXmY2lHK62fZAPonqh84Y8WlQr0U30fYpteNjA797GMkDyW/DLcPUXig/SPn3YCIBWoXyUhsDCI9cBScjAWI2tDGpVcGgtgYuMKIzOGwQ= 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 AS8PR04MB8724.eurprd04.prod.outlook.com (2603:10a6:20b:42b::6) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.5654.20; Fri, 23 Sep 2022 15:46:55 +0000 Received: from GV1PR04MB9055.eurprd04.prod.outlook.com ([fe80::dd0b:d481:bc5a:9f15]) by GV1PR04MB9055.eurprd04.prod.outlook.com ([fe80::dd0b:d481:bc5a:9f15%4]) with mapi id 15.20.5654.018; Fri, 23 Sep 2022 15:46:55 +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, Robert-Ionut Alexa , Ioana Ciornei Subject: [PATCH net-next v2 12/12] net: dpaa2-eth: add trace points on XSK events Date: Fri, 23 Sep 2022 18:45:56 +0300 Message-Id: <20220923154556.721511-13-ioana.ciornei@nxp.com> X-Mailer: git-send-email 2.25.1 In-Reply-To: <20220923154556.721511-1-ioana.ciornei@nxp.com> References: <20220923154556.721511-1-ioana.ciornei@nxp.com> X-ClientProxiedBy: AM3PR05CA0152.eurprd05.prod.outlook.com (2603:10a6:207:3::30) To GV1PR04MB9055.eurprd04.prod.outlook.com (2603:10a6:150:1e::22) MIME-Version: 1.0 X-MS-PublicTrafficType: Email X-MS-TrafficTypeDiagnostic: GV1PR04MB9055:EE_|AS8PR04MB8724:EE_ X-MS-Office365-Filtering-Correlation-Id: f36dff1a-2dc7-4f02-11ca-08da9d7ad734 X-MS-Exchange-SenderADCheck: 1 X-MS-Exchange-AntiSpam-Relay: 0 X-Microsoft-Antispam: BCL:0; X-Microsoft-Antispam-Message-Info: 3k1B5yPvDaC405ibl29PsQZs+j4k+F9Y5/KuQG5PvpcuVKZlzktAl1jSw839bUQZhJykf3luK3iBAe2u26aVmItHyDaH8ZCMNwrR7frBSR0mZ0LIb1aYVjc7uQGuh9FKwAPVLFWsZIse0RpHkVoW9kaoUiPzdKZjD4Hml1Vin9L7dF7u4GFB5vPxwmyiYpyKNS9DYO0M1bPYLiCvMBTxBJfcn5dKntgykABxEUQiMRSS+nfTc3q9gZxFNeVMDgAjC08wR9iqpxI30uvuodZr00nFP55ccH08UsGatGjbyUyKHK3l663RACHMOHmAzYa+hdDOCJRw5yoG8aWcfRnlFVXKLRT/Iv2KVUgz4SjjsDQDaT62klHRY84WOg0mp2rVvvCZ0/d092pRQffCRycNN7Gt3dttwLMDnNNel5/GPLa7zzpHWuHyVkyISCQCZMoEOPqaAZEBY1pmx9MujGj7LejGJIViVRsmWVCSmHf7e7DxVw42nEuxVNbsnSsXFI2rt+KR+PZ7KD3R4fnh3JaCfELQ9ajMQ5BOXwQvSC8tkXrPohe6v9h2+Mf44BtPFCo9Kj8OwCNue6Dp7cZZMzoZyUj3t9Fy7v4CVRzaQeIuE8UnlzC8t/x9X+89U5HEbqQ/rj0+P7IT6HB9UZqRZKHt13Pe1So/du+GrdDCN5fb4Wsh31VPUTuwIP1HbIhc0yLsHYC+ZZ+fIiGv/KKdyZxTg4xRClYqCdJjGTN4WVBrC2VUIU6eH7Th98wbmtfDvdWgGi9YCj6pY1EK9AcQzcgEQQ== 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)(39860400002)(366004)(396003)(376002)(346002)(136003)(451199015)(66476007)(41300700001)(52116002)(83380400001)(6506007)(66556008)(4326008)(66946007)(8676002)(26005)(36756003)(6512007)(38350700002)(8936002)(38100700002)(6486002)(110136005)(54906003)(316002)(478600001)(2906002)(2616005)(44832011)(86362001)(1076003)(7416002)(5660300002)(186003);DIR:OUT;SFP:1101; X-MS-Exchange-AntiSpam-MessageData-ChunkCount: 1 X-MS-Exchange-AntiSpam-MessageData-0: VzEfOWSWI15j43FKa4ZSYLCRBHmT77Q0+ZTROvS6obv9jKSORxZm62huV73vo34DWhooitmfPhBdU41+nfFCYf+0niuQGpyLPedF0QDaE+wusfMBqHL4kB5d4mvQ1Mjb37Nh/ExgToj62Ky0S4tWzthPqlB733jtTAOpmdowxDywMaYw0gKkQSu7yGP0b8NqxA6DAk6M8DfaWyldz1PpuHSl/x9PD9HzTAh+fLNp6scwYM3J9v7NgdVU12zSp4CtknNxYxyCrudutUWUdXIS2UNdz39CTTVQQvZeAJockpzaptYTVQNgpxLIgIqZ8M8ZrNwm/rCX93ywR+YRmPa35AfRoLIGwJCo32LhlSOQxeuANyxMCnvTMO4ytjljyGFu6jHBqefLKv5mrGMROElR/OCdqW2IJ7b40Kwdx/Pq9prqy1RYm3FVc95c4GmRobmpWl8QGGCx+ARXGL8yWEI94wmKZQbmXTXCOKQHHFSvJOWY8K9NRHTV69KoJeSPInB0gUgIkQfsUckj4qe9e8OooiAq07oGQcbmXrquzqRh8DsV12wGnLoeVl6bpJ+htVyzwP7fr8heHwBpUX+I7lU5BOWK0TYF619w8X4T7fBp/N3AkKngVk1wMPCTV5+nXYf9XCU25yH8AJe4y+4V4yHbuCk8HBjCpNzR6+7iowZ9ft0b1Bq/DFNDUSBmrwX9S9XdHQYgNcN5wvz/h32zFbhJtNJU/zAOj5E//56kdsBCEGPPyoxi7YKG+Sxxb6NpjVDHjx3G0ijM1ZkyDO/PgM9Bxs9phusJgqclG2LcpZH2NH0XfC3pPppZf+wkxM3OdyLSb6tw8IF08Z6wJOal1Th4cE97x6cDO9E7bBknn0tOTt7Pfr246hsMH2h7ik1w0o8Z6GVk3INCFT5k7Km77m1go3PxrryPnE3LtYit2Eza64y5VBOaZENQDXwLtYlLw8K+Se6I8xeN9m7TmocpQzakUCH4mdDWNDvKn9RJkBNStH2ORUks0iyi93P48w1hW5eMhzJqeuA6+2R8feQdEgeJ1EGvGn7arEe2ALfVX7OQIz5hDUIN6bDWZ9wkd/qbh65O3kVkOqHLAtWx5omLwZPpXeYQZko3gqL8mKuHsEQIdF4oJriMg4ZStBpdAeRv1FsLY2KObKQMZenlVNby5McTEJKVDh2ZqVIdoYHy9l/CgE8UmZVzHq6l0z+Uh2P00Ccb27edvTdS91QSdIMdVh/F4qsGRsNbcVHFc6dec+iIBpNlZ7VT/+5WRvBP09P7MFF8m0VfPBebna7G3B4pw0Qx4oT6cabZcqa80Zw/7ocMCvvmJn3vY/lYbVwQMfX9lJ9dK5iAeBQZqrT3/0eCb4a2IyYWjDvvOszVMQ0ga8OdzppD6IsL3KLzRMUDalNw6CByJR0ydeBejbaAbBOVNn8z0O9Z8uWWFvwKqlrBOHBcbPB386KW4H6A0yqIxmxFATc1PpAUe3P25TIhhQtLVXI3IziTKVNSwJxf/hoMWsiHZm3Y6IfjJl/+Wln+ppxKMK57AqeGg5z6W0jQcZf0hkFgpJRzkwdm/lt4UouMyPuyr1NspXAgIs8wmMQg1dtguxIsMj3mQYb6cQStRRn38xafVg== X-OriginatorOrg: nxp.com X-MS-Exchange-CrossTenant-Network-Message-Id: f36dff1a-2dc7-4f02-11ca-08da9d7ad734 X-MS-Exchange-CrossTenant-AuthSource: GV1PR04MB9055.eurprd04.prod.outlook.com X-MS-Exchange-CrossTenant-AuthAs: Internal X-MS-Exchange-CrossTenant-OriginalArrivalTime: 23 Sep 2022 15:46:55.0930 (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: RN8D1Rrf+1WAGXpw4f9WCG96XONpSFznO6rdGBlhTveulf6eMCJAY+dRQsdRS2erU+5GPsnwKqR2/U+hPxCXEg== X-MS-Exchange-Transport-CrossTenantHeadersStamped: AS8PR04MB8724 Precedence: bulk List-ID: X-Mailing-List: netdev@vger.kernel.org X-Patchwork-Delegate: kuba@kernel.org From: Robert-Ionut Alexa Define the dpaa2_tx_xsk_fd and dpaa2_rx_xsk_fd trace events for the XSK zero-copy Rx and Tx path. Also, define the dpaa2_eth_buf as an event class so that both dpaa2_eth_buf_seed and dpaa2_xsk_buf_seed traces can derive from the same class. Signed-off-by: Robert-Ionut Alexa Signed-off-by: Ioana Ciornei --- Changes in v2: - Use xdp_buff->data_hard_start when tracing the BP seeding. .../freescale/dpaa2/dpaa2-eth-trace.h | 142 +++++++++++------- .../net/ethernet/freescale/dpaa2/dpaa2-eth.c | 6 + .../net/ethernet/freescale/dpaa2/dpaa2-xsk.c | 4 + 3 files changed, 101 insertions(+), 51 deletions(-) diff --git a/drivers/net/ethernet/freescale/dpaa2/dpaa2-eth-trace.h b/drivers/net/ethernet/freescale/dpaa2/dpaa2-eth-trace.h index 5fb5f14e01ec..9b43fadb9b11 100644 --- a/drivers/net/ethernet/freescale/dpaa2/dpaa2-eth-trace.h +++ b/drivers/net/ethernet/freescale/dpaa2/dpaa2-eth-trace.h @@ -73,6 +73,14 @@ DEFINE_EVENT(dpaa2_eth_fd, dpaa2_tx_fd, TP_ARGS(netdev, fd) ); +/* Tx (egress) XSK fd */ +DEFINE_EVENT(dpaa2_eth_fd, dpaa2_tx_xsk_fd, + TP_PROTO(struct net_device *netdev, + const struct dpaa2_fd *fd), + + TP_ARGS(netdev, fd) +); + /* Rx fd */ DEFINE_EVENT(dpaa2_eth_fd, dpaa2_rx_fd, TP_PROTO(struct net_device *netdev, @@ -81,6 +89,14 @@ DEFINE_EVENT(dpaa2_eth_fd, dpaa2_rx_fd, TP_ARGS(netdev, fd) ); +/* Rx XSK fd */ +DEFINE_EVENT(dpaa2_eth_fd, dpaa2_rx_xsk_fd, + TP_PROTO(struct net_device *netdev, + const struct dpaa2_fd *fd), + + TP_ARGS(netdev, fd) +); + /* Tx confirmation fd */ DEFINE_EVENT(dpaa2_eth_fd, dpaa2_tx_conf_fd, TP_PROTO(struct net_device *netdev, @@ -90,57 +106,81 @@ DEFINE_EVENT(dpaa2_eth_fd, dpaa2_tx_conf_fd, ); /* Log data about raw buffers. Useful for tracing DPBP content. */ -TRACE_EVENT(dpaa2_eth_buf_seed, - /* Trace function prototype */ - TP_PROTO(struct net_device *netdev, - /* virtual address and size */ - void *vaddr, - size_t size, - /* dma map address and size */ - dma_addr_t dma_addr, - size_t map_size, - /* buffer pool id, if relevant */ - u16 bpid), - - /* Repeat argument list here */ - TP_ARGS(netdev, vaddr, size, dma_addr, map_size, bpid), - - /* A structure containing the relevant information we want - * to record. Declare name and type for each normal element, - * name, type and size for arrays. Use __string for variable - * length strings. - */ - TP_STRUCT__entry( - __field(void *, vaddr) - __field(size_t, size) - __field(dma_addr_t, dma_addr) - __field(size_t, map_size) - __field(u16, bpid) - __string(name, netdev->name) - ), - - /* The function that assigns values to the above declared - * fields - */ - TP_fast_assign( - __entry->vaddr = vaddr; - __entry->size = size; - __entry->dma_addr = dma_addr; - __entry->map_size = map_size; - __entry->bpid = bpid; - __assign_str(name, netdev->name); - ), - - /* This is what gets printed when the trace event is - * triggered. - */ - TP_printk(TR_BUF_FMT, - __get_str(name), - __entry->vaddr, - __entry->size, - &__entry->dma_addr, - __entry->map_size, - __entry->bpid) +DECLARE_EVENT_CLASS(dpaa2_eth_buf, + /* Trace function prototype */ + TP_PROTO(struct net_device *netdev, + /* virtual address and size */ + void *vaddr, + size_t size, + /* dma map address and size */ + dma_addr_t dma_addr, + size_t map_size, + /* buffer pool id, if relevant */ + u16 bpid), + + /* Repeat argument list here */ + TP_ARGS(netdev, vaddr, size, dma_addr, map_size, bpid), + + /* A structure containing the relevant information we want + * to record. Declare name and type for each normal element, + * name, type and size for arrays. Use __string for variable + * length strings. + */ + TP_STRUCT__entry( + __field(void *, vaddr) + __field(size_t, size) + __field(dma_addr_t, dma_addr) + __field(size_t, map_size) + __field(u16, bpid) + __string(name, netdev->name) + ), + + /* The function that assigns values to the above declared + * fields + */ + TP_fast_assign( + __entry->vaddr = vaddr; + __entry->size = size; + __entry->dma_addr = dma_addr; + __entry->map_size = map_size; + __entry->bpid = bpid; + __assign_str(name, netdev->name); + ), + + /* This is what gets printed when the trace event is + * triggered. + */ + TP_printk(TR_BUF_FMT, + __get_str(name), + __entry->vaddr, + __entry->size, + &__entry->dma_addr, + __entry->map_size, + __entry->bpid) +); + +/* Main memory buff seeding */ +DEFINE_EVENT(dpaa2_eth_buf, dpaa2_eth_buf_seed, + TP_PROTO(struct net_device *netdev, + void *vaddr, + size_t size, + dma_addr_t dma_addr, + size_t map_size, + u16 bpid), + + TP_ARGS(netdev, vaddr, size, dma_addr, map_size, bpid) +); + +/* UMEM buff seeding on AF_XDP fast path */ +DEFINE_EVENT(dpaa2_eth_buf, dpaa2_xsk_buf_seed, + TP_PROTO(struct net_device *netdev, + void *vaddr, + size_t size, + dma_addr_t dma_addr, + size_t map_size, + u16 bpid), + + TP_ARGS(netdev, vaddr, size, dma_addr, map_size, bpid) ); /* If only one event of a certain type needs to be declared, use TRACE_EVENT(). diff --git a/drivers/net/ethernet/freescale/dpaa2/dpaa2-eth.c b/drivers/net/ethernet/freescale/dpaa2/dpaa2-eth.c index 4cfdbf644466..e78781cd37bb 100644 --- a/drivers/net/ethernet/freescale/dpaa2/dpaa2-eth.c +++ b/drivers/net/ethernet/freescale/dpaa2/dpaa2-eth.c @@ -1731,6 +1731,12 @@ static int dpaa2_eth_add_bufs(struct dpaa2_eth_priv *priv, goto err_map; buf_array[i] = addr; + + trace_dpaa2_xsk_buf_seed(priv->net_dev, + xdp_buffs[i]->data_hard_start, + DPAA2_ETH_RX_BUF_RAW_SIZE, + addr, priv->rx_buf_size, + ch->bp->bpid); } } diff --git a/drivers/net/ethernet/freescale/dpaa2/dpaa2-xsk.c b/drivers/net/ethernet/freescale/dpaa2/dpaa2-xsk.c index 731318842054..567f52affe21 100644 --- a/drivers/net/ethernet/freescale/dpaa2/dpaa2-xsk.c +++ b/drivers/net/ethernet/freescale/dpaa2/dpaa2-xsk.c @@ -113,6 +113,8 @@ static void dpaa2_xsk_rx(struct dpaa2_eth_priv *priv, void *vaddr; u32 xdp_act; + trace_dpaa2_rx_xsk_fd(priv->net_dev, fd); + vaddr = dpaa2_iova_to_virt(priv->iommu_domain, addr); percpu_stats = this_cpu_ptr(priv->percpu_stats); @@ -416,6 +418,8 @@ bool dpaa2_xsk_tx(struct dpaa2_eth_priv *priv, batch = i; break; } + + trace_dpaa2_tx_xsk_fd(priv->net_dev, &fds[i]); } /* Enqueue all the created FDs */