From patchwork Wed Nov 22 10:25:40 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Wei Fang X-Patchwork-Id: 168294 Return-Path: Delivered-To: ouuuleilei@gmail.com Received: by 2002:a05:612c:2b07:b0:403:3b70:6f57 with SMTP id io7csp1227155vqb; Wed, 22 Nov 2023 02:34:41 -0800 (PST) X-Google-Smtp-Source: AGHT+IEsEqVbIFvXknKbA1WFxX+ftN4hgLJGVTMRLaSMgZ8eZnfmaBc6oTe9lAdhOKszKLIEKdEC X-Received: by 2002:a17:90b:3b51:b0:280:2c16:2186 with SMTP id ot17-20020a17090b3b5100b002802c162186mr1960715pjb.30.1700649280708; Wed, 22 Nov 2023 02:34:40 -0800 (PST) ARC-Seal: i=2; a=rsa-sha256; t=1700649280; cv=pass; d=google.com; s=arc-20160816; b=HTG+LEInjvYga8dhlmsdu5WwaoDteYljz5mOKrhfbCyTgQK+aXrwYGj6wBoSjQAM2L h40AZw+7dpWLGfimMEULB7zlJGKBkQIc5O9REHduhqb6iK4Fck+oFE4JZtzl2YQBIOUM 4luUUQVusiyCiZbaw5/DVwDSLQJwg4Rf6OeYskVd4R3vdDw4FcY9aJ3YbX48TxMxU1wu OtCrD4+HyyV+Ry2+oRLKx+wi8j5fz6Iux6PQk1pymg/aCjB5bGrA4PlZpIR6ToDh3Q2e LaH5T475Qe6ZunJ2hr74l+olgDTkANNwWEgjffQW4I+QUUaAbVwfWYi6N3/mp1eLlBNY EZrg== 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 :message-id:date:subject:cc:to:from:dkim-signature; bh=sQbrDqiNS6UQeU68bP38K+jAoTk1gyy7VwrabUWCv1w=; fh=09pd6M9A8v8DKqutiXQLUKjSz1hfgqMK7cP1YJ5fjQU=; b=BLehRq/rCOhYeZ5EZ6Wtcye4GLjQIwwNw0f9qAj3m45Ybk+0lpcfqtVxEgjN0PP9EZ alNJLnP8ktSTlgZB5iPAbCBOLPrE8Q4KQ0+dmtB+vtiZtKNLDJ/hs1qE0xTvGyqPPP6v isRV1cN+Fn+wuma/30gDVr7k4d+qdZVpyKukumTOp1zTnHTMxSoOuTd7qSqYyraalHpZ m/knnSXYY9Jz03ECgQQARP2JGw76umZcT7KAYFQLzZ9R0H0/HOD4GyaYIAefBgpFQiAi pLXr6UOExu8yl90bjIQrvFI1CtCcN4YLmUm+dHf6HxG9kC+sHOjby5tsHY2hsZ6ZAxmj H9wQ== ARC-Authentication-Results: i=2; mx.google.com; dkim=pass header.i=@nxp.com header.s=selector2 header.b=BVJY6IUq; 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::3:7 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 snail.vger.email (snail.vger.email. [2620:137:e000::3:7]) by mx.google.com with ESMTPS id a20-20020a17090ad81400b00263c23a5693si1184449pjv.13.2023.11.22.02.34.39 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Wed, 22 Nov 2023 02:34:40 -0800 (PST) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::3:7 as permitted sender) client-ip=2620:137:e000::3:7; Authentication-Results: mx.google.com; dkim=pass header.i=@nxp.com header.s=selector2 header.b=BVJY6IUq; 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::3:7 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 (depot.vger.email [IPv6:2620:137:e000::3:0]) by snail.vger.email (Postfix) with ESMTP id E23F78030B5D; Wed, 22 Nov 2023 02:34:32 -0800 (PST) X-Virus-Status: Clean X-Virus-Scanned: clamav-milter 0.103.11 at snail.vger.email Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S234945AbjKVKed (ORCPT + 99 others); Wed, 22 Nov 2023 05:34:33 -0500 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:43106 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S233111AbjKVKec (ORCPT ); Wed, 22 Nov 2023 05:34:32 -0500 Received: from EUR04-HE1-obe.outbound.protection.outlook.com (mail-he1eur04on2080.outbound.protection.outlook.com [40.107.7.80]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 75AB2B2; Wed, 22 Nov 2023 02:34:27 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=RjLI468Bh0QSQvIfd/ny0vHKSNX1e3L7FJMznARKrH78+SfMs+VZ6OQn4czfmleVrcK3mFZSZMm0Qmrg4maJy0rxIKcfQbJDzboPz1e5FRks+PnmI1c8OWOPHMl/n6QM1fnP43LMfiyYvB1Gin2H3Ohrzi0Pl6HurMO3ZI+dPaIzMb1bzGCDOw+pm8tsB7u0pLBFaLCTlbiiK3DUo8xmkovQGpMTPuzBcPP4HzbhiHWf6wbPDbGH1c0ljqSGpLYPPkXkNtS3dWuf9YtwwzutBD73RHu5j/fDKxiIf3u6mUvmioLj9UbOE3YUs0mUCONDlKCUJf0MWXq/7MfX0fj5IA== 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=sQbrDqiNS6UQeU68bP38K+jAoTk1gyy7VwrabUWCv1w=; b=KMWPzRYwFqPsmyawRUPZgfsQSDg2mjUaGFI9VeOsk7BDSfyQiRvSziQGmezHsP4zpFU2Uw+l6dfPrjQYf6hgLSCI1lKJFLo+eQUbAczSRaaW7G6FVRlx8mTUx16hZMp44lbF8HrMmKJNytPIcI7ZI2ACotC64tPvFjoAqJ0AAa0Yt9TFWVa+p+OiHhJI882wI/r+/Gz3Tqr/FsRgKewFUHZcJNXDIX7Ozk8wu+Xqp3/qr/5bN7RDLfDTAv1Z4+cuHx7JTkqbEFhJoef6jVjJrxuUOI9AVApqsOMkHRPxoa7ejEoj+G9iHurlTHjB+TMQe+PoP++Yag3xwoqskbQB4w== 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=sQbrDqiNS6UQeU68bP38K+jAoTk1gyy7VwrabUWCv1w=; b=BVJY6IUqRSJgMUeWyfrj3iEHU9yoZloRv0thgY4h4DSOE1/hCHa6IYEyefoMVzt0xG/CcEeN23g9rBuh4iPy9SQsJrW+yD17uHW/l1tlxNQ/mvOhwJAufubj5LRrVWHBSqmUjq3QqVWAkidXFeQFdLwcm3YOoqe0dmRkBkz6k8Y= Authentication-Results: dkim=none (message not signed) header.d=none;dmarc=none action=none header.from=nxp.com; Received: from AM5PR04MB3139.eurprd04.prod.outlook.com (2603:10a6:206:8::20) by AS1PR04MB9656.eurprd04.prod.outlook.com (2603:10a6:20b:478::19) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.7025.18; Wed, 22 Nov 2023 10:34:24 +0000 Received: from AM5PR04MB3139.eurprd04.prod.outlook.com ([fe80::d6ee:d372:176b:1786]) by AM5PR04MB3139.eurprd04.prod.outlook.com ([fe80::d6ee:d372:176b:1786%5]) with mapi id 15.20.7025.017; Wed, 22 Nov 2023 10:34:24 +0000 From: Wei Fang To: davem@davemloft.net, edumazet@google.com, kuba@kernel.org, pabeni@redhat.com, claudiu.manoil@nxp.com, vladimir.oltean@nxp.com, netdev@vger.kernel.org Cc: linux-kernel@vger.kernel.org Subject: [PATCH net-next] net: enetc: add ethtool::get_channels support Date: Wed, 22 Nov 2023 18:25:40 +0800 Message-Id: <20231122102540.3766699-1-wei.fang@nxp.com> X-Mailer: git-send-email 2.25.1 X-ClientProxiedBy: SI2PR02CA0005.apcprd02.prod.outlook.com (2603:1096:4:194::6) To AM5PR04MB3139.eurprd04.prod.outlook.com (2603:10a6:206:8::20) MIME-Version: 1.0 X-MS-PublicTrafficType: Email X-MS-TrafficTypeDiagnostic: AM5PR04MB3139:EE_|AS1PR04MB9656:EE_ X-MS-Office365-Filtering-Correlation-Id: 9d123d44-147c-40a3-c973-08dbeb469855 X-MS-Exchange-SenderADCheck: 1 X-MS-Exchange-AntiSpam-Relay: 0 X-Microsoft-Antispam: BCL:0; X-Microsoft-Antispam-Message-Info: 1xOqbWUALe6ob3ITDd1Z2n26w/EBXdkcMQRvE2SS8SsoN7Fhxso80Ai2eVCtmMBr4+MIjAGuaZr/4R18sUIeOum3FovkQqXUwu2KlgvMt78yllVvgbl1BoVWQdfHv6G/l3OmBoceQsqbgrmL6veC0jhHpzJhL/Lrnm9Z5QyqX7F8PoD7nax04YEscbgGDh+HcX5gdjkAIyILHaa2NOPIC9JXY/533WVWEiflyRUAeb79K2dS9TvMGEnJ6hTVFjMvYZSb3blu0QiGFbAV1lIB3T44Uiy+pgigTyYG+/AQlap7HSXnsbCoD7NUyT5X2mnllbTmP6Vl/JBalTZqoibCR9Lh6NOd6X0cjkQb/uKh0kqaPshN9ajpkXla1rneDd9NvSiWQ1e1BXRYmy/ZSejkDI5aWakqF0BNeSXJbGkg7B0XagBEDEdTT/4kE0GXfkkdLX4g/Fx4fZR+jgOKMNzCspU49cwfaXOpDM9IEE3GLUN9jlGtOByaF04PD08no5phZ8kpnmziDBM+i/qCdUziUz8ZLTmsrfpfzDsf9MpT3D6aWrkSDbPLxCCuwNdAOxnSQxrJiK7EDIHvTTcckBAM6kJ+fDAm/bp0gK+648Yvs84= X-Forefront-Antispam-Report: CIP:255.255.255.255;CTRY:;LANG:en;SCL:1;SRV:;IPV:NLI;SFV:NSPM;H:AM5PR04MB3139.eurprd04.prod.outlook.com;PTR:;CAT:NONE;SFS:(13230031)(346002)(376002)(366004)(396003)(39860400002)(136003)(230922051799003)(1800799012)(64100799003)(186009)(451199024)(66556008)(66476007)(66946007)(316002)(8676002)(8936002)(6486002)(4326008)(44832011)(478600001)(966005)(6666004)(6512007)(2906002)(6506007)(83380400001)(2616005)(1076003)(26005)(41300700001)(38100700002)(86362001)(38350700005)(36756003)(52116002)(5660300002);DIR:OUT;SFP:1101; X-MS-Exchange-AntiSpam-MessageData-ChunkCount: 1 X-MS-Exchange-AntiSpam-MessageData-0: IDtjftm5WFYRyoFmKLh80TAeH5HhXOKbgt/HeUjAgerxTMm17fLYDl8FG1/sE7fHeYo15XYV3ee8pWU+OYROq3P8WFJf/QdRvzen2Apxzh0f7FcyMCnJxtcp/qwBc3SWk980y25SWwQvUG5sWOSR3SD/Nd5YHlgNmbnnQ3fuKWQsohRopEIXEWkjBoDzdLblyipEVgAYAwMwbaxj3nfXZXi74aYoNZcB4Vlhu/PWxxpx8Kq8GZLnrB2ts2DY5UWcEE9xyp+DW8LRZxLVmnRms6t2+BpOGAjkMUPT28AI7hcllmWKCgvdeVK1Zc9bdwvVSXZfHoD0PeT+pBjnEw9LRc0LMeLwAf4VwmrJTYoEzMpME48c7EyF3+6NUcX7jxHG0EmSx1o3+mdr1/b1QCIHjzErUlnmgcLv0BqKw0YPsu3p2D0a4G2yD38nI1+ywfVL0S60GFp5QcqnXZScXZRsHszwlwb2aQGuhlUS57uP7zQfYTc1+GxYJXJOigoMhijn5U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xp.com X-MS-Exchange-CrossTenant-Network-Message-Id: 9d123d44-147c-40a3-c973-08dbeb469855 X-MS-Exchange-CrossTenant-AuthSource: AM5PR04MB3139.eurprd04.prod.outlook.com X-MS-Exchange-CrossTenant-AuthAs: Internal X-MS-Exchange-CrossTenant-OriginalArrivalTime: 22 Nov 2023 10:34:24.1184 (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: WHhsRh9KUV7uD8IOMDdy6JltA8yYYXcAeRjnRn80BZjusC7uCoXFKHpopDTFqlonbwhnCqSGZTHk4G+ogc7S1A== X-MS-Exchange-Transport-CrossTenantHeadersStamped: AS1PR04MB9656 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_BLOCKED, RCVD_IN_MSPIKE_H2,SPF_HELO_PASS,SPF_PASS,T_SCC_BODY_TEXT_LINE 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-Greylist: Sender passed SPF test, not delayed by milter-greylist-4.6.4 (snail.vger.email [0.0.0.0]); Wed, 22 Nov 2023 02:34:33 -0800 (PST) X-getmail-retrieved-from-mailbox: INBOX X-GMAIL-THRID: 1783260020337559015 X-GMAIL-MSGID: 1783260020337559015 Since ETHTOOL_MSG_RSS_GET netlink message [1] has been applied to ethtool tree, there is a netlink error when using "ethtool -x eno0" command to get RSS information from fsl-enetc driver, and the user cannot get the information, the error logs are as follows: root@ls1028ardb:~# ./ethtool -x eno0 netlink error: Operation not supported The rationale is that ethtool will issue a ETHTOOL_MSG_CHANNELS_GET netlink message to get the number of Rx ring. However, the fsl-enetc driver doesn't support ethtool::get_channels, so it directly returns -EOPNOTSUPP error. [1]: https://git.kernel.org/pub/scm/linux/kernel/git/jkirsher/ethtool.git/commit/?id=ffab99c1f3820e21d65686e030dcf2c4fd0a8bd0 Signed-off-by: Wei Fang --- .../net/ethernet/freescale/enetc/enetc_ethtool.c | 13 +++++++++++++ 1 file changed, 13 insertions(+) diff --git a/drivers/net/ethernet/freescale/enetc/enetc_ethtool.c b/drivers/net/ethernet/freescale/enetc/enetc_ethtool.c index e993ed04ab57..5fa1000b9b83 100644 --- a/drivers/net/ethernet/freescale/enetc/enetc_ethtool.c +++ b/drivers/net/ethernet/freescale/enetc/enetc_ethtool.c @@ -740,6 +740,17 @@ static int enetc_set_rxfh(struct net_device *ndev, const u32 *indir, return err; } +static void enetc_get_channels(struct net_device *ndev, + struct ethtool_channels *ch) +{ + struct enetc_ndev_priv *priv = netdev_priv(ndev); + + ch->max_rx = priv->num_rx_rings; + ch->max_tx = priv->num_tx_rings; + ch->rx_count = priv->num_rx_rings; + ch->tx_count = priv->num_tx_rings; +} + static void enetc_get_ringparam(struct net_device *ndev, struct ethtool_ringparam *ring, struct kernel_ethtool_ringparam *kernel_ring, @@ -1196,6 +1207,7 @@ static const struct ethtool_ops enetc_pf_ethtool_ops = { .get_rxfh_indir_size = enetc_get_rxfh_indir_size, .get_rxfh = enetc_get_rxfh, .set_rxfh = enetc_set_rxfh, + .get_channels = enetc_get_channels, .get_ringparam = enetc_get_ringparam, .get_coalesce = enetc_get_coalesce, .set_coalesce = enetc_set_coalesce, @@ -1226,6 +1238,7 @@ static const struct ethtool_ops enetc_vf_ethtool_ops = { .get_rxfh_indir_size = enetc_get_rxfh_indir_size, .get_rxfh = enetc_get_rxfh, .set_rxfh = enetc_set_rxfh, + .get_channels = enetc_get_channels, .get_ringparam = enetc_get_ringparam, .get_coalesce = enetc_get_coalesce, .set_coalesce = enetc_set_coalesce,