From patchwork Mon Nov 7 14:38:24 2022 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Shenwei Wang X-Patchwork-Id: 16484 Return-Path: Delivered-To: ouuuleilei@gmail.com Received: by 2002:a5d:6687:0:0:0:0:0 with SMTP id l7csp2095881wru; Mon, 7 Nov 2022 06:50:46 -0800 (PST) X-Google-Smtp-Source: AMsMyM4Ah45NRnManFxrVXgqdg2PgxNfB5LvlGad/1geWa4LQYVzQ5PvhRDmSWXnYXWeqxLXa6He X-Received: by 2002:a05:6402:428f:b0:454:c988:4bb1 with SMTP id g15-20020a056402428f00b00454c9884bb1mr49863791edc.196.1667832646540; Mon, 07 Nov 2022 06:50:46 -0800 (PST) ARC-Seal: i=2; a=rsa-sha256; t=1667832646; cv=pass; d=google.com; s=arc-20160816; b=d/MnlUG9xWQIreLiOtv3Rkcwlknjjx5BjeFMmfhzOAW5cWuqGt64uJgE8CmOqO3AL9 GC/ELC26eWG338Xsb95TvWZvwZqNLpsxmfU2eC3xDmYnkoLUIH3mqdtLVp4B6gqTB838 Af+mebB4dlyMYkVtJ6QqBW7vvHVhW8XHiCrf+Lx9tlYnmr5Cog/8zITISN+qiHmuXYpc mdRKNInDlgIK9kV/6a+RxQxYi+Jk8H5SsRR10QR7vonoEYSLay4rqraBhwgRlpZppI7f TU2BdhYTjRkJGaGfOxhUHhkSRD8VuqGyWPp9gjvXUXOqbjrNBfXyBNzwoB2uocc4wIEp 810g== ARC-Message-Signature: i=2; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:mime-version:content-transfer-encoding :references:in-reply-to:message-id:date:subject:cc:to:from :dkim-signature; bh=hBQbjC/nrO2786LNIfK7WsUT+HcBlkTgsK7ptHxzTbc=; b=Ui9Q/3t6+w0LrfzZvEzJB+2bQbqla5MoxTZEgMExqMKWCmditBFbuj4xEvToL2EkcX ls91/8QKj5CZFIDIl8ItqjOZOjgVZ+UcpZkoUESLODz4r9jdeb61xhJFOyM2EVQww6qD ITMc5xe4ERYnpQSNoRjYzN6SA6zXF+w2sYuAWwMosO74zk7Z4He32vFm30ZJbSYVN21Q PIiHEw2SpeVZVAm29o+PsH9mMrNs1IvlsiVFRyknMp8XPjMyo4F5Hw0+K+escfou0/kK 2+y6x22fRc5oNMPXMXqH4M4owjMiSxLR/QsuWxg43KsqZN3SZll73npre7mDv6L2qEYC TcAQ== ARC-Authentication-Results: i=2; mx.google.com; dkim=pass header.i=@nxp.com header.s=selector2 header.b=beROjZ4M; arc=pass (i=1 spf=pass spfdomain=nxp.com dkim=pass dkdomain=nxp.com dmarc=pass fromdomain=nxp.com); spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=nxp.com Received: from out1.vger.email (out1.vger.email. [2620:137:e000::1:20]) by mx.google.com with ESMTP id lx4-20020a170906af0400b007470b52f94esi7882490ejb.199.2022.11.07.06.50.22; Mon, 07 Nov 2022 06:50:46 -0800 (PST) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) client-ip=2620:137:e000::1:20; Authentication-Results: mx.google.com; dkim=pass header.i=@nxp.com header.s=selector2 header.b=beROjZ4M; arc=pass (i=1 spf=pass spfdomain=nxp.com dkim=pass dkdomain=nxp.com dmarc=pass fromdomain=nxp.com); spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=nxp.com Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S231963AbiKGOjH (ORCPT + 99 others); Mon, 7 Nov 2022 09:39:07 -0500 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:53128 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S232152AbiKGOi5 (ORCPT ); Mon, 7 Nov 2022 09:38:57 -0500 Received: from EUR04-VI1-obe.outbound.protection.outlook.com (mail-eopbgr80047.outbound.protection.outlook.com [40.107.8.47]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 56F281A20F; Mon, 7 Nov 2022 06:38:56 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=Wo4l1ejjuQezHt56F3VhHA3zIywqka9GxjobiEIZxEoaG2YH2qlJavhl+d3Y3FYzmA1GWH8ADcPkURZ5FJyO+KtbChWzqaXPIHq5U5oBVlXN1tWDsY6gB5YwwLUGhV4r1PT1ZNTG6seZWIrdE46SAxvROiEiFX1HdciZ8BnQCpqWUvSDiKqmJ72i2etmtgfzlZn79avlcCvPgxEQHst/rCQwuqUe/dF/xldJwJmnVvzcOCXN5IPd3uW89R+EhyjMBGbcBQGdFwPK+hpq7N6N+5kEJff2KKaEe7888qY87+PnjAZBbZBKf6KUyaPLcShkH0krMLGNKhcMBVz1cf6bUQ== 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=hBQbjC/nrO2786LNIfK7WsUT+HcBlkTgsK7ptHxzTbc=; b=H5KB0v2S17ARbfC3jC+Ccrw3HigDbrhM6dlJQKnWMSu5vKSL/T57Dmca7KUXX9her9GgOpLGIUEBMe5VavM4vlxeSzDwfspF4ImAR+vVKv+lcTow7/NoZMDe8V9nmjTei7KO5yUc99ZqnAwWBkKSEh3UWZM/eYXFvcCseWUsuhH/Md4rSdICgU1WXnq6thB7minoKaDxQ+VrOR7AHrj1ohPBCbeEjHXKZgRcUi3d/wYF/3rYQODsqjZPrVpnzAFeI//eSg/dwdAbBaNI5KMJLkoppI5nRjrFRIBPfM0Q61KEoyPn/S87bDQ0Svz6PLlvuBaQttP5O7TaNCbsNRv0iQ== 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=hBQbjC/nrO2786LNIfK7WsUT+HcBlkTgsK7ptHxzTbc=; b=beROjZ4MMTsgOfWuW5TEv0tN/g8dw3cpo3sfLKmqn8ahWsO8XQ6cG4RL33wmAxNjvG0rpS8plc4sMb0eGE9JvVhjei2a3sh+kYnZ2WjP2x2/ltWsMub+Cg/L0TVQS4pdmp/lMIOn7jHdsiYzh2/ZH1sPd1TaZ4c3jRC/VCVAMPo= Authentication-Results: dkim=none (message not signed) header.d=none;dmarc=none action=none header.from=nxp.com; Received: from PAXPR04MB9185.eurprd04.prod.outlook.com (2603:10a6:102:231::11) by AS8PR04MB8385.eurprd04.prod.outlook.com (2603:10a6:20b:3f3::22) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.5791.20; Mon, 7 Nov 2022 14:38:54 +0000 Received: from PAXPR04MB9185.eurprd04.prod.outlook.com ([fe80::b1ab:dd4f:9237:d9f8]) by PAXPR04MB9185.eurprd04.prod.outlook.com ([fe80::b1ab:dd4f:9237:d9f8%3]) with mapi id 15.20.5791.026; Mon, 7 Nov 2022 14:38:54 +0000 From: Shenwei Wang To: "David S. Miller" , Eric Dumazet , Jakub Kicinski , Paolo Abeni Cc: Alexei Starovoitov , Daniel Borkmann , Jesper Dangaard Brouer , John Fastabend , netdev@vger.kernel.org, linux-kernel@vger.kernel.org, imx@lists.linux.dev, Shenwei Wang Subject: [PATCH 1/2] net: fec: simplify the code logic of quirks Date: Mon, 7 Nov 2022 08:38:24 -0600 Message-Id: <20221107143825.3368602-2-shenwei.wang@nxp.com> X-Mailer: git-send-email 2.34.1 In-Reply-To: <20221107143825.3368602-1-shenwei.wang@nxp.com> References: <20221107143825.3368602-1-shenwei.wang@nxp.com> X-ClientProxiedBy: BY5PR20CA0014.namprd20.prod.outlook.com (2603:10b6:a03:1f4::27) To PAXPR04MB9185.eurprd04.prod.outlook.com (2603:10a6:102:231::11) MIME-Version: 1.0 X-MS-PublicTrafficType: Email X-MS-TrafficTypeDiagnostic: PAXPR04MB9185:EE_|AS8PR04MB8385:EE_ X-MS-Office365-Filtering-Correlation-Id: 7f4b321c-a4e7-4842-67e1-08dac0cdcb46 X-MS-Exchange-SenderADCheck: 1 X-MS-Exchange-AntiSpam-Relay: 0 X-Microsoft-Antispam: BCL:0; X-Microsoft-Antispam-Message-Info: Td3pLXuvoaojBFW9I58iTohWCnprRVSaGqPcOtAgwuH3IyD6sf2X2s6X6QV6NMXw7gvqARFMPzFkYUAh8bN6MBy1OpGzt+hagdQcBMMZGNoGj/p7Jgm4CF7Q232hLGkQkbm60nt0t51XTdJXZ/nzAcUTfkbU1JLWbu9AVWLvv3qyQBiCKQGd9o/JNCXu4YQA6VFabj7a3y4lyt6nav0iL7iNnf1hr6fIBVlbsBztbjmWOloVXdCWwdSHQJVvGHxsAaPAoKjM90qnwcmlwR4531c2T48Z71xHNkF76+/5stDjzMMqOrUfHs6C58g7zpniod8Dz4fAODsw8W5+VbOviWrGQ+Oja0MHV9sWFUJ4+p2k0OOZNOSFOrFnpWB6vnqkiPUl6APYx4kOzS/OiBG7hDpdfAY18P+qt9cIil8R9P4e0G5y/pVcasNSkkJdbvRn3YbKgffBBUNWiSkPkMpMz5SO5kSWI+6J2PAcdKN8havdN8RS7j+tz7cJ9K5DS2v26dvUWF7RKnRz52AdohyLxSqgraoXng4ELMusSD/mSO52fy3gLXG0XuPSxWwaxaztaVKeZIS4EaEUC4dXdpxWqCM/MmOCpWOK5pCYEi+DH1AGSO2jl7UtiWEpRmCQyT8o88IuRZEpRLGy7Sm9DHlRlijNYPvwC2WK22C38lUarjRpca/pyi7pU2VKfaNPFuH9MxN50J/sZh3mfdzfP0cMxevgmgcbvEgrdmantL08oSp5gccq1uYnNmJ8yXEBIABR X-Forefront-Antispam-Report: CIP:255.255.255.255;CTRY:;LANG:en;SCL:1;SRV:;IPV:NLI;SFV:NSPM;H:PAXPR04MB9185.eurprd04.prod.outlook.com;PTR:;CAT:NONE;SFS:(13230022)(4636009)(346002)(136003)(376002)(366004)(396003)(39860400002)(451199015)(2906002)(66556008)(66476007)(8676002)(4326008)(66946007)(83380400001)(55236004)(52116002)(6666004)(6506007)(478600001)(86362001)(6486002)(2616005)(1076003)(186003)(316002)(6512007)(26005)(110136005)(36756003)(54906003)(5660300002)(8936002)(7416002)(38350700002)(38100700002)(41300700001)(44832011);DIR:OUT;SFP:1101; X-MS-Exchange-AntiSpam-MessageData-ChunkCount: 1 X-MS-Exchange-AntiSpam-MessageData-0: pNg1QDecl2Gy+fCdZNePapvRnVB7kJPW6QrCpVBcfjhmB7oSPkBNfPjWnVdSkBFX5T48CbP1P3D35+UjBRKE87YoH2NeuTCnU5A8x/1PXL/zPRm+M9AO+76BlZqPzbR1scz7GhFmKy9BpJPGI27eSC9QGkfZysVmfeTPSvf4TFcVWhvXEXkgb5T19Dw8vqhTWuJLkTaNsHheyhYIRYyhoQvyJbeSSXCAWqvfTdqbkzbToUR8SH6LUzIN7EBwIxq4Hp+6S+l0slmdsC9+x2ApvY1+WI4scxVzH0zHb3eNO6hFcXFTe4ccKfBd7KIJR6w6YPpKuCjMBG2/yczp1QJdal9A5AmwnhAiWGDFaDA3rkRIMUW+WqfG9aHRPKmQcDXR/LscV+q5mkulPN7RAegXrMVCFOXY+GiMXhzUcVa4ah3JXL+RrR9BGxpJ4xX9JO2N4NxDGa6D0mMWvKA1URPXzNgEKm3V5p12wyJVfSI/Ne2qJkciMYQ9bv0EggA0kSQdAP0mMhs7gYNUArb9wF6O0RgAP2M6euZB0mfAQ2/zS0Ketl65SHz4puh4H+38w2O3BIKisYUYhyp+hd05wddxMPEV4X0D0wn3asuNln1NQuVtWkJpSuaT6G/Ehjzc9G5dFWaSxyamaVKtefgFXHegQk3Hsohy13aO/WrJefUNwSfOwD4gVZ/3XZE9cR+nqP1UUy3i8UeJyXrdBcnstVpyu1orZZvDqQIc0urvory+80WKSWcNj15BVW5JuE+OY0HpXDUiAEaNTVz6i+yBQXVjcWGpG2KzIhx6I9XHZgzUELLMNX6dYKCo7GkWfdv6cnbEXQ/cLqzFIi2jd3v0UE6NexRDvh8lMMP65WZNaDPfcjFcAEzr03kUOD6ycZGlpODBbma24lPhj27NMbq4uoiXrJ4JcCjvQUzhTf8FjXZYbPeZFgtuwtYAvcOnF/vGW/vLvpFEhPIerKmklxT7Prl1luE+m6Eswvu99BLaDG29eLuwAOznjMP886PBFtMJwsTwQ1l9I8bmLmE4ShGjBKOmcF98EM43ip6MlygzlW8oy2Y6UUqFlkpnihQrZYnNAuN2xyOwb/dQCQMu65yfSS9+bwZhpOConoWfQkbqPeYp7QCupkMq9vjq5ElyvHQ0RAp8vSfB5Hyk43wzdLC/n2JbdqrJ7R4dmsxWJT8LMUTcCIU9OeMxCisl7tI6Tk0Q5zu3c2mdEONUF2Menjacp3eFVd9I88shWrkF5+vzmq+iiT7ZP9qKEIuyw/mJVVFEJLhid+GhA9dy9JUOXymoELFirsNAMdEOLi4TY16FBSSuWnvOAXbjdu2WZZj2Q2gX16xXp1j4/PG/3aFJaVfWSUm8FjYQofLUARxVRW07VKtU3errLBIpvl/c4+d2VJwvpbU/dzeAQDMycnVhmlyK8OzjQkREcaMgZ04EFMnF/P7GQNKnaDtjeY/hKce1XsyPwGrDK25rbZiGmy+UFGxU2c6luYVcQJDsZg6Hq9HXlL1ehm76aZ2tTUsLa9HAm34rVmvjafqlXFFVQn/BMGgqEZ2UOn0SmUVaer9jUT4Xvj2s81pSVLMxRaZL0DNrFlVUAr9L X-OriginatorOrg: nxp.com X-MS-Exchange-CrossTenant-Network-Message-Id: 7f4b321c-a4e7-4842-67e1-08dac0cdcb46 X-MS-Exchange-CrossTenant-AuthSource: PAXPR04MB9185.eurprd04.prod.outlook.com X-MS-Exchange-CrossTenant-AuthAs: Internal X-MS-Exchange-CrossTenant-OriginalArrivalTime: 07 Nov 2022 14:38:53.9907 (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: BmOk99sx+wqNPago2QOo66BcR6fkyi/yz2pGPpIU9NjCzAbA0zbCZ1SRe8xteo7wskES4aKGLxFcrMXbWVTC/Q== X-MS-Exchange-Transport-CrossTenantHeadersStamped: AS8PR04MB8385 X-Spam-Status: No, score=-2.1 required=5.0 tests=BAYES_00,DKIM_SIGNED, DKIM_VALID,DKIM_VALID_AU,DKIM_VALID_EF,RCVD_IN_DNSWL_NONE, RCVD_IN_MSPIKE_H2,SPF_HELO_PASS,SPF_PASS autolearn=ham autolearn_force=no version=3.4.6 X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on lindbergh.monkeyblade.net Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org X-getmail-retrieved-from-mailbox: =?utf-8?q?INBOX?= X-GMAIL-THRID: =?utf-8?q?1748849285178572913?= X-GMAIL-MSGID: =?utf-8?q?1748849285178572913?= Simplify the code logic of handling the quirk of FEC_QUIRK_HAS_RACC. If a SoC has the RACC quirk, the driver will enable the 16bit shift by default in the probe function for a better performance. This patch handles the logic in one place to make the logic simple and clean. The patch optimizes the fec_enet_xdp_get_tx_queue function according to Paolo Abeni's comments, and it also exludes the SoCs that require to do frame swap from XDP support. Signed-off-by: Shenwei Wang --- drivers/net/ethernet/freescale/fec_main.c | 49 ++++++++++++++--------- 1 file changed, 30 insertions(+), 19 deletions(-) diff --git a/drivers/net/ethernet/freescale/fec_main.c b/drivers/net/ethernet/freescale/fec_main.c index 6b062a0663f4..3fb870340c22 100644 --- a/drivers/net/ethernet/freescale/fec_main.c +++ b/drivers/net/ethernet/freescale/fec_main.c @@ -1581,8 +1581,20 @@ fec_enet_rx_queue(struct net_device *ndev, int budget, u16 queue_id) bool need_swap = fep->quirks & FEC_QUIRK_SWAP_FRAME; struct bpf_prog *xdp_prog = READ_ONCE(fep->xdp_prog); u32 ret, xdp_result = FEC_ENET_XDP_PASS; + u32 data_start = FEC_ENET_XDP_HEADROOM; struct xdp_buff xdp; struct page *page; + u32 sub_len = 4; + +#if !defined(CONFIG_M5272) + /*If it has the FEC_QUIRK_HAS_RACC quirk property, the bit of + * FEC_RACC_SHIFT16 is set by default in the probe function. + */ + if (fep->quirks & FEC_QUIRK_HAS_RACC) { + data_start += 2; + sub_len += 2; + } +#endif #ifdef CONFIG_M532x flush_cache_all(); @@ -1645,9 +1657,9 @@ fec_enet_rx_queue(struct net_device *ndev, int budget, u16 queue_id) if (xdp_prog) { xdp_buff_clear_frags_flag(&xdp); + /* subtract 16bit shift and FCS */ xdp_prepare_buff(&xdp, page_address(page), - FEC_ENET_XDP_HEADROOM, pkt_len, false); - + data_start, pkt_len - sub_len, false); ret = fec_enet_run_xdp(fep, xdp_prog, &xdp, rxq, index); xdp_result |= ret; if (ret != FEC_ENET_XDP_PASS) @@ -1659,18 +1671,15 @@ fec_enet_rx_queue(struct net_device *ndev, int budget, u16 queue_id) * bridging applications. */ skb = build_skb(page_address(page), PAGE_SIZE); - skb_reserve(skb, FEC_ENET_XDP_HEADROOM); - skb_put(skb, pkt_len - 4); + skb_reserve(skb, data_start); + skb_put(skb, pkt_len - sub_len); skb_mark_for_recycle(skb); - data = skb->data; - if (need_swap) + if (unlikely(need_swap)) { + data = page_address(page) + FEC_ENET_XDP_HEADROOM; swap_buffer(data, pkt_len); - -#if !defined(CONFIG_M5272) - if (fep->quirks & FEC_QUIRK_HAS_RACC) - data = skb_pull_inline(skb, 2); -#endif + } + data = skb->data; /* Extract the enhanced buffer descriptor */ ebdp = NULL; @@ -3562,6 +3571,13 @@ static int fec_enet_bpf(struct net_device *dev, struct netdev_bpf *bpf) switch (bpf->command) { case XDP_SETUP_PROG: + /* No need to support the SoCs that require to + * do the frame swap because the performance wouldn't be + * better than the skb mode. + */ + if (fep->quirks & FEC_QUIRK_SWAP_FRAME) + return -EOPNOTSUPP; + if (is_run) { napi_disable(&fep->napi); netif_tx_disable(dev); @@ -3589,17 +3605,12 @@ static int fec_enet_bpf(struct net_device *dev, struct netdev_bpf *bpf) } static int -fec_enet_xdp_get_tx_queue(struct fec_enet_private *fep, int cpu) +fec_enet_xdp_get_tx_queue(struct fec_enet_private *fep, int index) { - int index = cpu; - if (unlikely(index < 0)) - index = 0; - - while (index >= fep->num_tx_queues) - index -= fep->num_tx_queues; + return 0; - return index; + return (index % fep->num_tx_queues); } static int fec_enet_txq_xmit_frame(struct fec_enet_private *fep, From patchwork Mon Nov 7 14:38:25 2022 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Shenwei Wang X-Patchwork-Id: 16485 Return-Path: Delivered-To: ouuuleilei@gmail.com Received: by 2002:a5d:6687:0:0:0:0:0 with SMTP id l7csp2096001wru; Mon, 7 Nov 2022 06:51:00 -0800 (PST) X-Google-Smtp-Source: AMsMyM7jUZEwaebn3D+2xaStSJZdtC0li0wUhkKFK8pBkkcaH7kqF3RpYVX9DyotMSQLk7vk9L8Z X-Received: by 2002:a17:907:7617:b0:7ad:c0d5:bdf1 with SMTP id jx23-20020a170907761700b007adc0d5bdf1mr42210630ejc.211.1667832659894; Mon, 07 Nov 2022 06:50:59 -0800 (PST) ARC-Seal: i=2; a=rsa-sha256; t=1667832659; cv=pass; d=google.com; s=arc-20160816; b=BrV7QWub2yXznoJJ/eGfeLxXdnNovw/Fg//1ATZAQC4TtqXif2RGZB+jHdAq664Svx UVDapJd8e3U4dlunTsa8V50yZA0HQz2GyYWLnVpjFjELwYvFzXdUcyfLvFDqgKjVjfMF czaJ5PV2Xg5D3XQ0mXBrK4UPCjq6dn2RA12mnVge6uvrkjPN0JUwowaumbmz26FSn5SP apVdNtvaIsBABtwom4QXnaJbnL/aRcclgZwyQ2+s13MEIMXZqp2tSv+cOLyKWgxsB98K vokMSffJC9h+peJMa291REf5TDKzq9F6HzY1QhC6J0TaW0yavZNBLtIIUIP8t2RsYyk6 qzuA== ARC-Message-Signature: i=2; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:mime-version:content-transfer-encoding :references:in-reply-to:message-id:date:subject:cc:to:from :dkim-signature; bh=uKkFOHba/7wyF99Qm8WRBdJIHKC3++fDQAnGsKMf4CE=; b=EE7AZU4R3BQCffG6yY1TR0hJloO7Q2beTYtKs5mprXVIuPV4+QdfdL0AgOu7PENG5O wRMwm5yi7PLjZDQD4z8N0mf/aXANSAdusfRhTn6YJrtGXNX0gZ557vBcWyg7RedRMv88 3ug909dkKlBAxq/bebvzBG6BN2xMhmiHG0VhuvP23kDHN7/fas+wMcRUMl19b5bTk1ZA 0wwZVwevyG/h+xq9b/+fLfHycNlfkZ5UzwrYpWkLeJdI0WIDqnXCnCVj9dB1s7j0VZcg 1hFdZ13NVW0RdBuBGscMLFJxHn8E2M6Yfr2NDDt5hSds4QEiEw/7dkntRKfgnqVE56MW RNgA== ARC-Authentication-Results: i=2; mx.google.com; dkim=pass header.i=@nxp.com header.s=selector2 header.b=j6+KTX9N; arc=pass (i=1 spf=pass spfdomain=nxp.com dkim=pass dkdomain=nxp.com dmarc=pass fromdomain=nxp.com); spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=nxp.com Received: from out1.vger.email (out1.vger.email. [2620:137:e000::1:20]) by mx.google.com with ESMTP id cs19-20020a170906dc9300b0078bcc872a6esi9816430ejc.360.2022.11.07.06.50.35; Mon, 07 Nov 2022 06:50:59 -0800 (PST) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) client-ip=2620:137:e000::1:20; Authentication-Results: mx.google.com; dkim=pass header.i=@nxp.com header.s=selector2 header.b=j6+KTX9N; arc=pass (i=1 spf=pass spfdomain=nxp.com dkim=pass dkdomain=nxp.com dmarc=pass fromdomain=nxp.com); spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=nxp.com Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S232132AbiKGOj1 (ORCPT + 99 others); Mon, 7 Nov 2022 09:39:27 -0500 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:53424 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S232159AbiKGOjH (ORCPT ); Mon, 7 Nov 2022 09:39:07 -0500 Received: from EUR04-VI1-obe.outbound.protection.outlook.com (mail-eopbgr80073.outbound.protection.outlook.com [40.107.8.73]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 9499D6460; Mon, 7 Nov 2022 06:39:05 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=UuZTMxuSE3DGv0q9+MJw0rQlw03oMmABqyvIFLk+wmgwrOX/bI4tdluz/J8GBrZnLVLCi94Qt0eCjIodGWNuEZ5osY3yJ2xKm8hoy8fI59c5l+DKY8angdDRC5u9uDG4kiAHKt3xaFn7RaciL/ZMUhX5GO5o3fTuq/qA8xhTN+VgEMoPDWilapMildaYAzNIqIqy+BoAwlDFfqDoWy7O4ithhpdUlD0sqVsFYNiQFvtEIL3K1/CTmf/8WrUPb9AJqtCD1iKdst6n+TyRArH/dVMx9OvFTrUGBkdqJiMIu7OK2KvN1ZZKRb2VL+Hnz1rW2cPOpLbHoE5D8fbvKetKeA== 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=uKkFOHba/7wyF99Qm8WRBdJIHKC3++fDQAnGsKMf4CE=; b=X8qi9cd5lZjYXVrQEwx/p+dteTiSzdJS8xGmEmNGwg71llsRvzti/ADS5KuW16CBMD16BQq2BNw//F3S2U/8iKT8OhwmAkFtaf4VE8Xl5nEFmG/taa+bIvT0MBGl9aKm+46dXjic0JtBDFLDMiNOCNLB+aDwMFMgNHVbLGo4jtZTVqioZDBeBqBY6/tPF8VWQ4gJfDKCb9Yj6mPdCXyQsRBDYpgnL2dZVb0YID0ikJuUprA/dmbZR7/UKT2em4OereIgn/gvhmdz1NyHB5fRaIxb9EToucmxDSmPHcBTIN8wcZ8Quk9J+i2RiIFV5SoqwPyoLQ+QF+SmRgaIa9uS/w== 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=uKkFOHba/7wyF99Qm8WRBdJIHKC3++fDQAnGsKMf4CE=; b=j6+KTX9NxEo5YbZ9iEzpvVRTBT9MChglGK7JfGJE/sFuFmmU1NWfwfZrw7PM57A2HajJSYwUGaVyABNZkdrZ72Ch8RMw89PceHQNC6ufrKueL/gNuim8DXy56C3RliA8QJplBosuuplx1/iIP3qYiRpNoi6Aryh50YuzxerMMXY= Authentication-Results: dkim=none (message not signed) header.d=none;dmarc=none action=none header.from=nxp.com; Received: from PAXPR04MB9185.eurprd04.prod.outlook.com (2603:10a6:102:231::11) by AS8PR04MB8385.eurprd04.prod.outlook.com (2603:10a6:20b:3f3::22) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.5791.20; Mon, 7 Nov 2022 14:39:03 +0000 Received: from PAXPR04MB9185.eurprd04.prod.outlook.com ([fe80::b1ab:dd4f:9237:d9f8]) by PAXPR04MB9185.eurprd04.prod.outlook.com ([fe80::b1ab:dd4f:9237:d9f8%3]) with mapi id 15.20.5791.026; Mon, 7 Nov 2022 14:39:03 +0000 From: Shenwei Wang To: "David S. Miller" , Eric Dumazet , Jakub Kicinski , Paolo Abeni Cc: Alexei Starovoitov , Daniel Borkmann , Jesper Dangaard Brouer , John Fastabend , netdev@vger.kernel.org, linux-kernel@vger.kernel.org, imx@lists.linux.dev, Shenwei Wang Subject: [PATCH 2/2] net: fec: add xdp and page pool statistics Date: Mon, 7 Nov 2022 08:38:25 -0600 Message-Id: <20221107143825.3368602-3-shenwei.wang@nxp.com> X-Mailer: git-send-email 2.34.1 In-Reply-To: <20221107143825.3368602-1-shenwei.wang@nxp.com> References: <20221107143825.3368602-1-shenwei.wang@nxp.com> X-ClientProxiedBy: SJ0PR13CA0119.namprd13.prod.outlook.com (2603:10b6:a03:2c5::34) To PAXPR04MB9185.eurprd04.prod.outlook.com (2603:10a6:102:231::11) MIME-Version: 1.0 X-MS-PublicTrafficType: Email X-MS-TrafficTypeDiagnostic: PAXPR04MB9185:EE_|AS8PR04MB8385:EE_ X-MS-Office365-Filtering-Correlation-Id: a7525b33-1ef1-4c06-3aa6-08dac0cdd0c3 X-MS-Exchange-SenderADCheck: 1 X-MS-Exchange-AntiSpam-Relay: 0 X-Microsoft-Antispam: BCL:0; X-Microsoft-Antispam-Message-Info: cRrpZCSciBXCMw2rfjINpubPulApRyShhviQ20vajhrxgoO0BNIvELl2OyNqN3Y02oUijS4OmK4orYOw8HQAwR7eA/xcyZNpUhgJrupApJ0P7gDSU/ssUTC1/ODY701RJe9viiEIMLhrFQGjFSP3cLvZV91n5Z0lVZqM3H6NIjSw1ULlaVYcMqkS9rJgY6N5H5HZda30YdDvQvXQRw5E41OqsD7sIThJa7gKfeS1JR+JUThvppx0efEaNV+5kbkMyJXs/z3PIjtlTQbeHPPWIPUf1uQR+yYj6DdBMK0ay0fcZRYIUzPFn6Bsha83iytwBxYRQoL7sqA226IES4YD9IlaK63GuizUuVmc8I2xlrdw0m1a6a4Wqis/nDYBzkvVDN0VB3cgw0zso2UUzEH0rdUlm9581pdf0khJLrDXMuQMrVNS2qAEqq0//xfxHBnSKS75CtinZkp8zo/mCxoKpn3Xvq0I1sSkCBMa5Ly8o8GjGRUX216Y+nuozBNrk9P0yioJrAMmJC4G5Mv7gCII5m8W7+TN71ZfrlLTdkjK3J4hAwkKnfJQ9x8T7nOVJs+wZTNAvNgF/jhtB1wIoJ87N0alnW6el8OCsUU4VtQbnIB/bbSiJuiNwW7EnBf7QLorCJSdgaXN5K99KulZVNfo2s84mFyUPVmd7ZSg7PJGSCcFyfKc3TfdCqaMcNCgh1i9dQlLD8TvHbyagWC/+ssAykOtc8eH+yzXEFeiLGrMsktBO/yd1x3LDD8hFxiUQjLO X-Forefront-Antispam-Report: CIP:255.255.255.255;CTRY:;LANG:en;SCL:1;SRV:;IPV:NLI;SFV:NSPM;H:PAXPR04MB9185.eurprd04.prod.outlook.com;PTR:;CAT:NONE;SFS:(13230022)(4636009)(346002)(136003)(376002)(366004)(396003)(39860400002)(451199015)(2906002)(66556008)(66476007)(8676002)(4326008)(66946007)(83380400001)(55236004)(52116002)(6666004)(6506007)(478600001)(86362001)(6486002)(2616005)(1076003)(186003)(316002)(6512007)(26005)(110136005)(36756003)(54906003)(5660300002)(8936002)(7416002)(38350700002)(38100700002)(41300700001)(44832011);DIR:OUT;SFP:1101; X-MS-Exchange-AntiSpam-MessageData-ChunkCount: 1 X-MS-Exchange-AntiSpam-MessageData-0: rLVB8nULxjHkhhGWYfahL1Kac4O6tz9gyVI1yy/lEAtd1kg9w+Z96vbF6e4WCeXkVxgRm6C5xBYS5JoaiFK8IayJ1x8xPqHp4/a+iLP8s+swosg2UjUL422zEz3vhoy/l1aJ1UbLvrjfgtE4ZXVenCdJHFytvhEL4HDt3LeKVwLwD2AgRbloTtFJ7JtLVMGLL6VB6Wi54FNfCRgcaWsEoJWF29SFEIntUO7Wyg8zzdSCBe+VfFvtUw5/yXlMtQuXRDAgT5QBWXi84TYujGf/2vnfrcLyELsxNpbiFrV16Qyi2tYpyYltZGgSRETX0x68PWBeXI1hQhoh4HZDQ6PEbn3HhOXHxJxMMKCQM2O8pzdiUOMJfAtJ+yZQmF6GFKy9nHlDi9t0DycrILeuBwzXv6F4n9719D5xXwBMh3zUttgk0oQ0CiVv+xt7pT0EB84g1EsT7WGivU0b0GeMg2QYXvzuELCmnRl/eIdoZ9dIJEB+EfyydA5MvdHlyHZW5vCGApNooDfvjF5kCNXesj1lmHrHNc5fzF3AiXhzSyz7dbdbuCczUYZcC7MqaBvUQWSpyDy/0L73e8gGr83kqDoT6+kCWpkekOZGBTZN9Za3r1ioINiUNP4Mt3+DDDlPXr0CjRIarSMORf2AcTg51Rb5x+l1uLQYrjE2wEkCUis6aGndOQbv4FwD3tZa/BBSlrV10oN0DuCw3+Tdq5CYUJNTaXPEGG9SOnXMwYG/cU0jHWLr30ll8EInBGuwQVHQk8E2UYcAEQ5Q410aGHJD+C0pby1SKicOOXHVtiqRVlMmnnwlZdmBJDR4fP9qgbPTBsS52F20lSlSdHRGB6C/QVXBErL7q9od9Y220Fg/hpJmuUKPNrLajPq/4c7aY68PhZ5u0HW0WopqS/J08L30WZ37P9kmNI2f5Ab9W6lKuWBQ85xkKvBxrjD9umsf3UGvqnwpOzxbotOazr5hcPDUpsEdjOohFO+8rzw//sTKU8M5P6anfVU/frYYHpe7aEpTK6XKLWGdaapuF+9TBa8vFXgMT1EudknOJjzIhntp1KsA8GxAryJJysnXlG7lN6tekJ/Ua+yqElXkVlm6tqm9rzai4DgfIbgl4UPD7eQ5vD7kuBOwordnWGtGGVGGUdrWO3ip6osHVne+qvjxRqBuoNqIPzMl+iXjbs8AMDFp3MrkMgLzuD/4aDM+9XeIBV7WrN/AaQzMH+mzZ4zSQxvede0SmznOD+CnsIehcc4bs9jnf7OPP+S3u9Pao1tDbhVJ1qyPN11vazKnoCfTYWBLdW7fxqHf4vutrb/ZLJoMKdF1OnVG+6OXdiB64QMzNngS2Lv53v0D46fycfXmSh0N8gwhEfDdGawtL6F/30QjWnruFtyxbJZREYVbFZxLKpI/iDuChdFS+y80JJPZSSpP1WuA8iWJRXHfdNJPjYgvEkr+3ZQvDHrdXpj7cbdoVf6//Da3pNKPIgDUwh2qZiy0iARRFmpV8FHfjh0FfaCzVBRAp5/PTn3KeEsPV5wQomglmNiv4i1C3YXnD+JSBd+hwBxDk2AHjCD8o7N4bv02nxrQyhdpz1nT/2vtgXWDMU1X7FRk X-OriginatorOrg: nxp.com X-MS-Exchange-CrossTenant-Network-Message-Id: a7525b33-1ef1-4c06-3aa6-08dac0cdd0c3 X-MS-Exchange-CrossTenant-AuthSource: PAXPR04MB9185.eurprd04.prod.outlook.com X-MS-Exchange-CrossTenant-AuthAs: Internal X-MS-Exchange-CrossTenant-OriginalArrivalTime: 07 Nov 2022 14:39:03.1831 (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: IW3oxEdEIHayPl4Jq1H5wFRdwUfYSJaMDcGwoKkruU8bxSjOX7WQmbgoOKFKzrh/89tZ06WL8CG6FsuB0s984w== X-MS-Exchange-Transport-CrossTenantHeadersStamped: AS8PR04MB8385 X-Spam-Status: No, score=-2.1 required=5.0 tests=BAYES_00,DKIM_SIGNED, DKIM_VALID,DKIM_VALID_AU,DKIM_VALID_EF,RCVD_IN_DNSWL_NONE, RCVD_IN_MSPIKE_H2,SPF_HELO_PASS,SPF_PASS autolearn=ham autolearn_force=no version=3.4.6 X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on lindbergh.monkeyblade.net Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org X-getmail-retrieved-from-mailbox: =?utf-8?q?INBOX?= X-GMAIL-THRID: =?utf-8?q?1748849299063339051?= X-GMAIL-MSGID: =?utf-8?q?1748849299063339051?= Added xdp and page pool statistics. In order to make the implementation simple and compatible, the patch uses the 32bit integer to record the XDP statistics. Signed-off-by: Shenwei Wang --- drivers/net/ethernet/freescale/fec.h | 12 ++++ drivers/net/ethernet/freescale/fec_main.c | 70 ++++++++++++++++++++++- 2 files changed, 79 insertions(+), 3 deletions(-) diff --git a/drivers/net/ethernet/freescale/fec.h b/drivers/net/ethernet/freescale/fec.h index 61e847b18343..e3159234886c 100644 --- a/drivers/net/ethernet/freescale/fec.h +++ b/drivers/net/ethernet/freescale/fec.h @@ -526,6 +526,17 @@ struct fec_enet_priv_txrx_info { struct sk_buff *skb; }; +enum { + RX_XDP_REDIRECT = 0, + RX_XDP_PASS, + RX_XDP_DROP, + RX_XDP_TX, + RX_XDP_TX_ERRORS, + TX_XDP_XMIT, + TX_XDP_XMIT_ERRORS, + XDP_STATS_TOTAL, +}; + struct fec_enet_priv_tx_q { struct bufdesc_prop bd; unsigned char *tx_bounce[TX_RING_SIZE]; @@ -546,6 +557,7 @@ struct fec_enet_priv_rx_q { /* page_pool */ struct page_pool *page_pool; struct xdp_rxq_info xdp_rxq; + u32 stats[XDP_STATS_TOTAL]; /* rx queue number, in the range 0-7 */ u8 id; diff --git a/drivers/net/ethernet/freescale/fec_main.c b/drivers/net/ethernet/freescale/fec_main.c index 3fb870340c22..89fef370bc10 100644 --- a/drivers/net/ethernet/freescale/fec_main.c +++ b/drivers/net/ethernet/freescale/fec_main.c @@ -1523,10 +1523,12 @@ fec_enet_run_xdp(struct fec_enet_private *fep, struct bpf_prog *prog, switch (act) { case XDP_PASS: + rxq->stats[RX_XDP_PASS]++; ret = FEC_ENET_XDP_PASS; break; case XDP_REDIRECT: + rxq->stats[RX_XDP_REDIRECT]++; err = xdp_do_redirect(fep->netdev, xdp, prog); if (!err) { ret = FEC_ENET_XDP_REDIR; @@ -1549,6 +1551,7 @@ fec_enet_run_xdp(struct fec_enet_private *fep, struct bpf_prog *prog, fallthrough; /* handle aborts by dropping packet */ case XDP_DROP: + rxq->stats[RX_XDP_DROP]++; ret = FEC_ENET_XDP_CONSUMED; page = virt_to_head_page(xdp->data); page_pool_put_page(rxq->page_pool, page, sync, true); @@ -2657,37 +2660,91 @@ static const struct fec_stat { { "IEEE_rx_octets_ok", IEEE_R_OCTETS_OK }, }; -#define FEC_STATS_SIZE (ARRAY_SIZE(fec_stats) * sizeof(u64)) +static struct fec_xdp_stat { + char name[ETH_GSTRING_LEN]; + u64 count; +} fec_xdp_stats[XDP_STATS_TOTAL] = { + { "rx_xdp_redirect", 0 }, /* RX_XDP_REDIRECT = 0, */ + { "rx_xdp_pass", 0 }, /* RX_XDP_PASS, */ + { "rx_xdp_drop", 0 }, /* RX_XDP_DROP, */ + { "rx_xdp_tx", 0 }, /* RX_XDP_TX, */ + { "rx_xdp_tx_errors", 0 }, /* RX_XDP_TX_ERRORS, */ + { "tx_xdp_xmit", 0 }, /* TX_XDP_XMIT, */ + { "tx_xdp_xmit_errors", 0 }, /* TX_XDP_XMIT_ERRORS, */ +}; + +#define FEC_STATS_SIZE ((ARRAY_SIZE(fec_stats) + \ + ARRAY_SIZE(fec_xdp_stats)) * sizeof(u64)) static void fec_enet_update_ethtool_stats(struct net_device *dev) { struct fec_enet_private *fep = netdev_priv(dev); - int i; + struct fec_xdp_stat xdp_stats[7]; + int off = ARRAY_SIZE(fec_stats); + struct fec_enet_priv_rx_q *rxq; + int i, j; for (i = 0; i < ARRAY_SIZE(fec_stats); i++) fep->ethtool_stats[i] = readl(fep->hwp + fec_stats[i].offset); + + for (i = fep->num_rx_queues - 1; i >= 0; i--) { + rxq = fep->rx_queue[i]; + for (j = 0; j < XDP_STATS_TOTAL; j++) + xdp_stats[j].count += rxq->stats[j]; + } + + for (i = 0; i < XDP_STATS_TOTAL; i++) + fep->ethtool_stats[i + off] = xdp_stats[i].count; +} + +static void fec_enet_page_pool_stats(struct fec_enet_private *fep, u64 *data) +{ + struct page_pool_stats stats = {}; + struct fec_enet_priv_rx_q *rxq; + int i; + + for (i = fep->num_rx_queues - 1; i >= 0; i--) { + rxq = fep->rx_queue[i]; + + if (!rxq->page_pool) + continue; + + page_pool_get_stats(rxq->page_pool, &stats); + } + + page_pool_ethtool_stats_get(data, &stats); } static void fec_enet_get_ethtool_stats(struct net_device *dev, struct ethtool_stats *stats, u64 *data) { struct fec_enet_private *fep = netdev_priv(dev); + u64 *dst = data + FEC_STATS_SIZE / 8; if (netif_running(dev)) fec_enet_update_ethtool_stats(dev); memcpy(data, fep->ethtool_stats, FEC_STATS_SIZE); + + fec_enet_page_pool_stats(fep, dst); } static void fec_enet_get_strings(struct net_device *netdev, u32 stringset, u8 *data) { + int off = ARRAY_SIZE(fec_stats); int i; switch (stringset) { case ETH_SS_STATS: for (i = 0; i < ARRAY_SIZE(fec_stats); i++) memcpy(data + i * ETH_GSTRING_LEN, fec_stats[i].name, ETH_GSTRING_LEN); + for (i = 0; i < ARRAY_SIZE(fec_xdp_stats); i++) + memcpy(data + (i + off) * ETH_GSTRING_LEN, + fec_xdp_stats[i].name, ETH_GSTRING_LEN); + off = (i + off) * ETH_GSTRING_LEN; + page_pool_ethtool_stats_get_strings(data + off); + break; case ETH_SS_TEST: net_selftest_get_strings(data); @@ -2697,9 +2754,14 @@ static void fec_enet_get_strings(struct net_device *netdev, static int fec_enet_get_sset_count(struct net_device *dev, int sset) { + int count; + switch (sset) { case ETH_SS_STATS: - return ARRAY_SIZE(fec_stats); + count = ARRAY_SIZE(fec_stats) + ARRAY_SIZE(fec_xdp_stats); + count += page_pool_ethtool_stats_get_count(); + return count; + case ETH_SS_TEST: return net_selftest_get_count(); default: @@ -2718,6 +2780,8 @@ static void fec_enet_clear_ethtool_stats(struct net_device *dev) for (i = 0; i < ARRAY_SIZE(fec_stats); i++) writel(0, fep->hwp + fec_stats[i].offset); + for (i = 0; i < ARRAY_SIZE(fec_xdp_stats); i++) + fec_xdp_stats[i].count = 0; /* Don't disable MIB statistics counters */ writel(0, fep->hwp + FEC_MIB_CTRLSTAT); }