From patchwork Fri Dec 13 14:08:50 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Vladimir Oltean X-Patchwork-Id: 13907185 X-Patchwork-Delegate: kuba@kernel.org Received: from EUR05-VI1-obe.outbound.protection.outlook.com (mail-vi1eur05on2064.outbound.protection.outlook.com [40.107.21.64]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id A058A1E25E7 for ; Fri, 13 Dec 2024 14:09:22 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=fail smtp.client-ip=40.107.21.64 ARC-Seal: i=2; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1734098964; cv=fail; b=ascpZRZIgxZ1/8I8cFYfJsw5BaG6aKK3t8qTyhMA5CMrJNRw7iFU8SB/cxEoH5SmeoN5Fad206tF7JkrqyfWQfIEQ0m9q/1RZwIeTc001ZdIHUApF4lxgMfKPKRPXy79c4F7aH8Cij0sR0KAQeBE9b89aEmmJ29BqTxhr24gn80= ARC-Message-Signature: i=2; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1734098964; c=relaxed/simple; bh=N/8ciaZAOIwCZOH/8WkkEcnpAVYkB7b0fEoEOwChONs=; h=From:To:Cc:Subject:Date:Message-ID:In-Reply-To:References: Content-Type:MIME-Version; b=OdwUJscBcrNdGEJ4IhdUOGCqsaRlBymZb0IrooaAGfqd/eSXV/aR+y7aVdP0BwncNfHJbyDBrDMv8tvnjy7iC+PcDT7Jb7SxA+mKfG5UWg+x7z3HEXLFfb92wIp6TaR/5+Plp6y8wlXS6Y6nfr8oqhq5SBtuc/b1Bw+nt+/PG5k= ARC-Authentication-Results: i=2; smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=nxp.com; spf=pass smtp.mailfrom=nxp.com; dkim=pass (2048-bit key) header.d=nxp.com header.i=@nxp.com header.b=VsP0ehcv; arc=fail smtp.client-ip=40.107.21.64 Authentication-Results: smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=nxp.com Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=nxp.com Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=nxp.com header.i=@nxp.com header.b="VsP0ehcv" ARC-Seal: i=1; a=rsa-sha256; s=arcselector10001; d=microsoft.com; cv=none; b=w/MdM9SsiAefqhgR15crSLhEr28GUdRLlYBelUxM2eNBP4HVZLlFbS2fhT81sFDbUVXTITXoulld8UWtC2gAqKv6CiWm/AXDRyZ8+l0o7grILPpRPi6ZmfRn77BXqHM4NvCCfeTPuda4+oqgXY6zSNyqszETJvwmUTA2TxxnvYmBvSfWWo/vxiycMuNMOnL/ka0hcV/c5YTiuCqtstxepg2JmPwbmnEg7k9duXaHc4Cohax4H3deRI2VFqsaRE+zQk1ebjIGl/9aKwygJ4gjVaTKLx4qXUL0UG9EkjQWOihipDQP2rah5S1L0Z8G+gi/qj1yzNP5CbOZXhl/tzdJew== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=microsoft.com; s=arcselector10001; 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=ouD43Bel0llkt9tlkg0dhfIVy/RXCQhWfbTcqDk8zR0=; b=q9Va2KrG70hyBA2EfV1AHsEJqdKZj33kxjPNDhxNm0/NrXkZPaTZ5aGqNo90+ulQSwpvvIjvlU7xN/CrAfWv6EMQtwII5n0Sq0G4caP8OLp1f6FUvWd+ucdy7SS/KHOf52k0PpxcUgfrhfY/TyRnuhytHUy6lvtdVeGMeOcrXaLsx5L2jUR+7AocC6IQBFJ+MJoFBxpBJ3wanaz8BNrt1e7fDHvjnu4xjDrsHty0lilpV+OM0H01Phc1RfYRm4jsRE4JMiBT+0vG3Iu5ZpyXk/TAAMk7W9wazsev0icrQoQixxCPUzvJDpY2Kt02dJIjTCo6oEXAbCEBHxUjreW3mw== 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=selector1; h=From:Date:Subject:Message-ID:Content-Type:MIME-Version:X-MS-Exchange-SenderADCheck; bh=ouD43Bel0llkt9tlkg0dhfIVy/RXCQhWfbTcqDk8zR0=; b=VsP0ehcvx4Q1uH89huKArx1zCEdyv6tkpdfcu7TBJPng7bD1bGaDMg4LyhKZ3haGHj1s0BwiAtPXYJFcE4gKQJJYslNsZs2yw0BdHoMxrWEmGAoOjhzc/hQy3tOBSS11JLbz6N3YIqOZW5fj416VaWq1ANo4A41BTwIIVHwdBaj1mNpb1ZZDrWt4BVGbpzkuJbTGgQuF2M9vMvTnPJx5gIt1dx36rSGsrPONDL1cC0BqybZEOwaaQbY7NXwplxpoM93urSQGSVOe+wFOL4D9Qg1yY0f09kkn3rkjUKfWgIrpt6UAEFjFFMpbKA9CiMHy4iHNCbI8ue3rkzN8ghfYCQ== Authentication-Results: dkim=none (message not signed) header.d=none;dmarc=none action=none header.from=nxp.com; Received: from AM8PR04MB7779.eurprd04.prod.outlook.com (2603:10a6:20b:24b::14) by AM9PR04MB8780.eurprd04.prod.outlook.com (2603:10a6:20b:40b::9) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.8251.18; Fri, 13 Dec 2024 14:09:15 +0000 Received: from AM8PR04MB7779.eurprd04.prod.outlook.com ([fe80::7417:d17f:8d97:44d2]) by AM8PR04MB7779.eurprd04.prod.outlook.com ([fe80::7417:d17f:8d97:44d2%6]) with mapi id 15.20.8251.015; Fri, 13 Dec 2024 14:09:15 +0000 From: Vladimir Oltean To: netdev@vger.kernel.org Cc: "David S. Miller" , Eric Dumazet , Jakub Kicinski , Paolo Abeni , Andrew Lunn , Claudiu Manoil , Alexandre Belloni , Horatiu Vultur , Daniel Machon , UNGLinuxDriver@microchip.com, Xiaoliang Yang , Yangbo Lu , Richard Cochran Subject: [PATCH net-next 2/4] net: dsa: implement get_ts_stats ethtool operation for user ports Date: Fri, 13 Dec 2024 16:08:50 +0200 Message-ID: <20241213140852.1254063-3-vladimir.oltean@nxp.com> X-Mailer: git-send-email 2.43.0 In-Reply-To: <20241213140852.1254063-1-vladimir.oltean@nxp.com> References: <20241213140852.1254063-1-vladimir.oltean@nxp.com> X-ClientProxiedBy: BE1P281CA0251.DEUP281.PROD.OUTLOOK.COM (2603:10a6:b10:8b::19) To AM8PR04MB7779.eurprd04.prod.outlook.com (2603:10a6:20b:24b::14) Precedence: bulk X-Mailing-List: netdev@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 X-MS-PublicTrafficType: Email X-MS-TrafficTypeDiagnostic: AM8PR04MB7779:EE_|AM9PR04MB8780:EE_ X-MS-Office365-Filtering-Correlation-Id: 3bbc92db-c764-4e7f-5e2b-08dd1b7fba26 X-MS-Exchange-SenderADCheck: 1 X-MS-Exchange-AntiSpam-Relay: 0 X-Microsoft-Antispam: BCL:0;ARA:13230040|366016|376014|7416014|52116014|1800799024|38350700014; X-Microsoft-Antispam-Message-Info: 9VWCsVf7w/vLaWIwei5UdJtlrJSnGtLkkKeFF56TMZd+eZ6kk6AZ4lMmpc9DiJUlRozT22na42918IihT+fd7b1S4+4m8+Qj6T9gTTxcCCm9ypDrbx5YE/GWxlgUA4A7H5ZHJ0Soc7Pi5hfkkNDNHFUHSsFoNjKBaZiimFgr3mtuJ6XBffk6M9QauLKyS5ncpmFgY4QlktlCJFJNmwVHNEFlJCZShWh/01WSXrQUrOY4QfBMYhguasxIqQGxJCJFWUxbCdhwepHgBu1hTnVGuwolo9J9Q2ciO3ZFvJZ7wehqLac0igVCmh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6prSNV+IIfi+R1TfMeISqSZrg== X-Forefront-Antispam-Report: CIP:255.255.255.255;CTRY:;LANG:en;SCL:1;SRV:;IPV:NLI;SFV:NSPM;H:AM8PR04MB7779.eurprd04.prod.outlook.com;PTR:;CAT:NONE;SFS:(13230040)(366016)(376014)(7416014)(52116014)(1800799024)(38350700014);DIR:OUT;SFP:1101; X-MS-Exchange-AntiSpam-MessageData-ChunkCount: 1 X-MS-Exchange-AntiSpam-MessageData-0: ovL/ji+q9OQ/rHeWBOJypnEOnHvXN9rK90gHZAnVKB5bnusK0LcAfi3EM/N9zGePmZvgoRkv7bAIUhG3+KaVUn+WagcSk2x+LkydKoutgnVOjA/hEa0eZ9WvQSsr4Uk/VcjuabPyI69+XQwibb0xL6V6YjZXE60BnuYDv+bDSgWYnScuhDx0xC+Oo440rDyeBL5g/Ef0OjKvANcIAPPQFZG5YkNghIPVpQwUmUOeCTPHB8Kp9Smr5NEfePOmqeAXaHFPNn4aU1hUtiR4vHvEaKm4TZiKwh1ZLDAGgbnZfSCEsZgGMdql4c8c3sQ/KteOJxOPI5jzNme10wyLnAA5KO5gpc+Uul9JEZhqRCjko0QhyL2FAh80zBDXI6mcAlILm0dmTJI7JkPH8j4RgPjz4HT8IHy4dpfPTdZShD3JWAmtPQNKUZAAJ2Qz7QvKLyWXaV+CHZUR4ypSZBvSKEHVR1NQmLatWyYV+vK74sh1kWZpiXIczq3qslRtC5TNuVrKjqFGh4IAUpCEK8brhpNVyUDfxfWeYOhcfu2lOO79bSv6n7Xfts2gxYaW5aQb80GneWpGIYyHjrFM09TNaK04Ztirav0C7WpGrh20cEK0WFErqicIPIbKgrBALQfYwqcdrlAHyfuBqX67e63gt9lH0nmYZdbgx0qQbjHW/OovY1P20nFBjefT5O+oQ3n/Ubpq1GCSabZwV7Xzok2GpvBJwJjHdpZXnpNjEr9EvdSbcFbH5CSw+9zRLBMVbLS+ui1bZMVPmqfTrh9OH2Ab+396DZzmRmR5ELyiie+i/n+q4lAuTZRnTOkIOO/IymXT/wh4ofcNNF4QUvaznMevW/uKvMfwvWWLm0UZhLtKRta+LLyqAZy2L8V5OcRRCLqvFRI6sEgEjyT7KqyvpUYyWqALcIR+0g/aM15Y/mX9EADJEZMjNdxBlQzA5JXH7YpdLfYOSxXLHNIExmYyJtXsPgxc6JgSORGBrtUL+a525UiJI+Jt+eE3vlfo9Nh9V05gaX5c+VH6n2l/ZuKa6DZIgPcsQc6jfPI6Tcw+t/GsGh151svV8rp2B+E4EEVnY2fe+03jZ+gcLTdxUEoaS3v8y5EcoDgXCsQiNXVozNivd56yS9WtvfVD6NepvpIP8K59eHl/peH3oGdjasqQ6gOF85VnHODJ1Eea7Avst6x3hjy9IHWq849J9VfUoqhV0bHn6kZgY98I3RjhRSx9IFFFPgs8Vdnb7xL9VI85ZHS4BYGT3c8fAi8BGBUzYfQyHug1IIBncqLeyKJ6pYoqCvIftBfOGAKEjSUYs+TSgSaqwHoItjt1WUGLdXI4l0IwDaaXGNF7LeEfKITk3MjzhIuMQ2gJppOHxXcL12ELK0wpVQ/ofG9IRUi2Ik5OEcD26DdYF3xcSfv0sNKuGAJElUtOYT3TnbW9r+r2usGTx06GlmdT2yJvJef/3y5xzLWkgEjnKC70Zva6dljIialb6ui2Ahp/UXEkRgktdrqnYxKIr2rKqS9jo/qXQEiUpRCcAC6LXQJPouYBuVA1xutm/aMfGoVCzrtV1PZUVDjWqcGi7WBqRmwwazlW1mzufCN2V36fXlyvl40BMH5uYJIQOhIMO+RfCQ== X-OriginatorOrg: nxp.com X-MS-Exchange-CrossTenant-Network-Message-Id: 3bbc92db-c764-4e7f-5e2b-08dd1b7fba26 X-MS-Exchange-CrossTenant-AuthSource: AM8PR04MB7779.eurprd04.prod.outlook.com X-MS-Exchange-CrossTenant-AuthAs: Internal X-MS-Exchange-CrossTenant-OriginalArrivalTime: 13 Dec 2024 14:09:15.6543 (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: FqcswDYUDFtdawmINkM4VnWNFxoNZ1W0uLzxHVI3kuDW9/YVMMJw2HnCfoHtPwPZXuDvDeeRcPLD6QMSWxQf2g== X-MS-Exchange-Transport-CrossTenantHeadersStamped: AM9PR04MB8780 X-Patchwork-Delegate: kuba@kernel.org Integrate with the standard infrastructure for reporting hardware packet timestamping statistics. Signed-off-by: Vladimir Oltean --- include/net/dsa.h | 2 ++ net/dsa/user.c | 11 +++++++++++ 2 files changed, 13 insertions(+) diff --git a/include/net/dsa.h b/include/net/dsa.h index 4aeedb296d67..d9dc1eb6dcd7 100644 --- a/include/net/dsa.h +++ b/include/net/dsa.h @@ -906,6 +906,8 @@ struct dsa_switch_ops { void (*get_rmon_stats)(struct dsa_switch *ds, int port, struct ethtool_rmon_stats *rmon_stats, const struct ethtool_rmon_hist_range **ranges); + void (*get_ts_stats)(struct dsa_switch *ds, int port, + struct ethtool_ts_stats *ts_stats); void (*get_stats64)(struct dsa_switch *ds, int port, struct rtnl_link_stats64 *s); void (*get_pause_stats)(struct dsa_switch *ds, int port, diff --git a/net/dsa/user.c b/net/dsa/user.c index 4a8de48a6f24..b777e0727036 100644 --- a/net/dsa/user.c +++ b/net/dsa/user.c @@ -1150,6 +1150,16 @@ dsa_user_get_rmon_stats(struct net_device *dev, ds->ops->get_rmon_stats(ds, dp->index, rmon_stats, ranges); } +static void dsa_user_get_ts_stats(struct net_device *dev, + struct ethtool_ts_stats *ts_stats) +{ + struct dsa_port *dp = dsa_user_to_port(dev); + struct dsa_switch *ds = dp->ds; + + if (ds->ops->get_ts_stats) + ds->ops->get_ts_stats(ds, dp->index, ts_stats); +} + static void dsa_user_net_selftest(struct net_device *ndev, struct ethtool_test *etest, u64 *buf) { @@ -2509,6 +2519,7 @@ static const struct ethtool_ops dsa_user_ethtool_ops = { .get_eth_mac_stats = dsa_user_get_eth_mac_stats, .get_eth_ctrl_stats = dsa_user_get_eth_ctrl_stats, .get_rmon_stats = dsa_user_get_rmon_stats, + .get_ts_stats = dsa_user_get_ts_stats, .set_wol = dsa_user_set_wol, .get_wol = dsa_user_get_wol, .set_eee = dsa_user_set_eee,