From patchwork Wed Apr 3 21:28:39 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Rahul Rameshbabu X-Patchwork-Id: 13616723 X-Patchwork-Delegate: kuba@kernel.org Received: from NAM12-MW2-obe.outbound.protection.outlook.com (mail-mw2nam12on2117.outbound.protection.outlook.com [40.107.244.117]) (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 ABDB6156860; Wed, 3 Apr 2024 21:29:41 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=fail smtp.client-ip=40.107.244.117 ARC-Seal: i=2; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1712179783; cv=fail; b=Vn8kGxBHqfbxcd4UIA1CnYusNaBWLVDESy58rU8xavhoMpVpnvVK+8QwMDsSk8JuQGCzV5dXj64Uh+nYhZHEdk104eL5u7MbmNQVq28XbpeEVO/WWCYh6XXdtDXVaaa0251k0JnD05NI8J1o4cKKp6FqfFhFAHFpy8wvEtL/jvo= ARC-Message-Signature: i=2; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1712179783; c=relaxed/simple; bh=YAd7EEvF0Np65JsTlkvO6thAZQDyW2SpU68734RQWPU=; h=From:To:Cc:Subject:Date:Message-ID:In-Reply-To:References: Content-Type:MIME-Version; b=uIBRq33qwDd/JQLXCVb8oTBfS8/3iPfFZ5VxBSp2+cUo4uD1OsWFVzo5343UY79xs609vxVxyB5RISpmwYyT4nmyDlagjhdOlOsvzebSrx/gLarcBX1qsIlhSvUWSGwDn2v5pqCPWk6p3/W82hEzu+kQ6BvGD9fxv54StkzgcKw= ARC-Authentication-Results: i=2; smtp.subspace.kernel.org; dmarc=pass (p=reject dis=none) header.from=nvidia.com; spf=fail smtp.mailfrom=nvidia.com; dkim=pass (2048-bit key) header.d=Nvidia.com header.i=@Nvidia.com header.b=dwl1L0jx; arc=fail smtp.client-ip=40.107.244.117 Authentication-Results: smtp.subspace.kernel.org; dmarc=pass (p=reject dis=none) header.from=nvidia.com Authentication-Results: smtp.subspace.kernel.org; spf=fail smtp.mailfrom=nvidia.com Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=Nvidia.com header.i=@Nvidia.com header.b="dwl1L0jx" ARC-Seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=kKJVbwx9cO3y4zGvasWb4xIICNDi05BT90gr/10AxdXHX8hEeX3IA2o5xQ7MIZJ48Tzr0xCratzBJ57/kwgJxuUfqALLbYiKXIvNAuS0/67tBQO74O2fkLpohnTYEt/uCh9RT2bv+3NN/UfcH4XniuJ02OT7J7KVVDoKoFhXE59md4hR/ssDspyVqCcvnOwDBQsXpPP1HuvfZbQha/A+GVG9Np1BQ/5OQQGF/SMTUgt0enQL/PWd2GtNdJhKVQ7OwTf0FReXdaI4ZfJziIvsR+jfRnP2E3OVfyFkLEgiRK5a4nrrZw93e0U0xWQRwv9aAznEX1YXm69coC9+/m3UQA== 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=8EqEnmgq+Ec/6hhhQGst4Vqk1FvLRL2j2mFc0T8D5vc=; b=flm2DHR+o/5ckKzwfyFTd7pOs118rlGbIt8fLzD2TBx+18Fo3bjrnyuVqegQ+lEPCuErkXieUY82R0uXBG33qtYuwNvLE6MeinfT0WiKaz93srJHtlxrYmAO8AWrO/i9lpbYvdd7OSlz7r3FtyXJl0OzJxrN0Sp4NShPZ1+pyaN/ckmGSYOC4T16W0GtNvLhFvN2Kks4Cfp0QfbZBiVP2b+Khtk9rSWi0SAvsJ0FNd14+D6k9GL8jSD2re2ZhrFpVgLq1pRgMgE5wi6mQ9x0H0EBet+GXss+lrnspItfUI27WyQ6Ck12pJqrica22QFGkYDbawVi2lsEkqKzRRX4Ig== ARC-Authentication-Results: i=1; mx.microsoft.com 1; spf=pass smtp.mailfrom=nvidia.com; dmarc=pass action=none header.from=nvidia.com; dkim=pass header.d=nvidia.com; arc=none DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=Nvidia.com; s=selector2; h=From:Date:Subject:Message-ID:Content-Type:MIME-Version:X-MS-Exchange-SenderADCheck; bh=8EqEnmgq+Ec/6hhhQGst4Vqk1FvLRL2j2mFc0T8D5vc=; b=dwl1L0jxSzic98verPhR5PZpkESIa37neoOyshd/9B01Yd4kbNUhdSa1M4CB4Vn5QWIBc+aBRFfRO634F7APqn8fneuivtPO40QGesOgN+NwP4yMhE9UVab1EAXiorp0qgqZo8q9D9/qnw0GLXuH2pVDE7pwjgUP7PWM8Rorf/LNJHYhF8VTmJmNl4tO2OAcP6eJqK615RicGDmfgXoNWqqovNvTjgikoQHnI40scEB8me/JoOUIN+I0Rh5wTzEQzzMnAx1OsKCk22+HuzyMZM2ihbAK+LJwK8EStht5/y/adR+DiJ1SMPo8Jsq1LpkgOQLCpyqrdjWlXGR0jcZfFA== Received: from BYAPR12MB2743.namprd12.prod.outlook.com (2603:10b6:a03:61::28) by IA1PR12MB8586.namprd12.prod.outlook.com (2603:10b6:208:44e::9) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.7409.46; Wed, 3 Apr 2024 21:29:37 +0000 Received: from BYAPR12MB2743.namprd12.prod.outlook.com ([fe80::459b:b6fe:a74c:5fbf]) by BYAPR12MB2743.namprd12.prod.outlook.com ([fe80::459b:b6fe:a74c:5fbf%6]) with mapi id 15.20.7409.042; Wed, 3 Apr 2024 21:29:37 +0000 From: Rahul Rameshbabu To: netdev@vger.kernel.org, linux-kernel@vger.kernel.org, linux-doc@vger.kernel.org Cc: ahmed.zaki@intel.com, aleksander.lobakin@intel.com, alexandre.torgue@foss.st.com, andrew@lunn.ch, cjubran@nvidia.com, corbet@lwn.net, davem@davemloft.net, dtatulea@nvidia.com, edumazet@google.com, gal@nvidia.com, hkallweit1@gmail.com, jacob.e.keller@intel.com, jiri@resnulli.us, joabreu@synopsys.com, justinstitt@google.com, kory.maincent@bootlin.com, kuba@kernel.org, leon@kernel.org, liuhangbin@gmail.com, maxime.chevallier@bootlin.com, pabeni@redhat.com, paul.greenwalt@intel.com, przemyslaw.kitszel@intel.com, rdunlap@infradead.org, richardcochran@gmail.com, saeed@kernel.org, tariqt@nvidia.com, vadim.fedorenko@linux.dev, vladimir.oltean@nxp.com, wojciech.drewek@intel.com, Rahul Rameshbabu Subject: [PATCH net-next v2 1/6] ethtool: add interface to read Tx hardware timestamping statistics Date: Wed, 3 Apr 2024 14:28:39 -0700 Message-ID: <20240403212931.128541-2-rrameshbabu@nvidia.com> X-Mailer: git-send-email 2.42.0 In-Reply-To: <20240403212931.128541-1-rrameshbabu@nvidia.com> References: <20240403212931.128541-1-rrameshbabu@nvidia.com> X-ClientProxiedBy: SJ0PR05CA0068.namprd05.prod.outlook.com (2603:10b6:a03:332::13) To BYAPR12MB2743.namprd12.prod.outlook.com (2603:10b6:a03:61::28) 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: BYAPR12MB2743:EE_|IA1PR12MB8586:EE_ X-MS-Exchange-SenderADCheck: 1 X-MS-Exchange-AntiSpam-Relay: 0 X-Microsoft-Antispam: BCL:0; X-Microsoft-Antispam-Message-Info: LttNEbVu4DrzDTHi7jDMn74WPday9KWPnkjG8UHkIGwrL0MRAWcJv/dbtEPCMLZ4ZWD2/yLqh316URy8DL8Ugu/MSAeiNXhbf3r81WVrqIzJrLf9TNfypC9J0axxeWRZ/Zfe4vZH4LuNeTUJkHxdNrxSwwBSPVjEQ3kOh/hiVijJpo09Ns9M1iexswRSvj+pc6y5NFDkTjvehhQosM+RG2sx5LU1HnF3do8qCkEjQKrGdcdhvK0CwWQ+TeN+h4QuX6Dy/DkKtOMXZ627YcKUwtjJArSMxtBKBIFSNExzBTLY1hIBPHt16Bf0rsIkiO2QtnDkuvJLHq9C+KsZrWMA3At0+VXyPUNZLRep5wFb/VdnPFFRxm8ZzIxW+4DZ0J2MhnsCo9Rm3uAbPZJYcUJreRbATigKz2tgof5v7zBx/AEwwqwUp6Fpx5wGeE6epagz8UQ5IsRFe9vL8fgAM73LCLfjChmL6boyMYURvmXAZglNMsO4d1EZNY8Nxw/lqLsKjDyZW70Ft8Q3ZP0CdRrlw/Tvi0lIgXTqmtw2aRbhnV08aTVp2GPpATe4DltUVkAXaqKitIFlRdX+uNyDIzvafRzgB66nEuOWECBw1jdDbngPM6XuTZ2rTt7JJfn1NKtcngXiKCpPnoCjRKqHL+CQT5cpCnQbgEITjCsMPmK2NFI= X-Forefront-Antispam-Report: CIP:255.255.255.255;CTRY:;LANG:en;SCL:1;SRV:;IPV:NLI;SFV:NSPM;H:BYAPR12MB2743.namprd12.prod.outlook.com;PTR:;CAT:NONE;SFS:(13230031)(1800799015)(376005)(7416005)(366007);DIR:OUT;SFP:1102; X-MS-Exchange-AntiSpam-MessageData-ChunkCount: 1 X-MS-Exchange-AntiSpam-MessageData-0: fRHZU8z37deMFJ+bbSyZr0EPuNJiePX2O8khoS58kGXhYPWcOmbHZG8w1pcO+EzbKZ254isg+b5P42YIm3C2Zgm+48r32WLkXamnpPi/FvsZffFooHWfBjLA9Bvz43lOFF7KWFkmaIGLYa8/DVYbXYOkjGOiKILQckbblwL6+nZTiYt373A+3wuzLat0CHyrVnhFjDhawMm9FMyhGSceOurcXJumou+3MdFEH9H2vpSlPHBx5OEpCzoUq5KIWDdeq2fZwSB2GXhD1C7v0J3NVHm/l1tKc0NnlTauM+EyeQYEffFIknw78Hev4ZEIDhemnIDQ3A26uOF30hXua5EiaKsEO2xjk7baHMjhrfGJI3UTlMrRsgJHyW5HGix8RdAwMBGYEtQuhLREpsDR6937uCCPgfJlDsU+WDl1nSoyfCGwAeICURMICFHBRNRD28C4VjtFfwqOixwUBcbNxuDW9ArlRZ2rnvjJTdrWbdNsK6AOn9ZUzJicxHH3jA43/pgw0EP+2MvnuVkZNldKZZOM/IBGT/sEYoi3WoeYXR5xQY5iIxw15bHSmzc1pmYPHEnMDkpMKBgXL3+xYXwD3uZVKoB4kzMQ7x/muehwpbItdc/xGDl3jMGa15bn1Z4jMtNKYRF3WYRY9L4IgNJwJf1Do2IxUo8fHygEyQVxCTlyy8oE1WvxXhvIwLN7wYiCzT7iHurdLB9KDvGKq/dH+K1oyPX+j/lH6MTq5q6Mf/szhw4LWF3YwCNYpoCiycvU6zV0nTGv+j0edKZmudFRuVDic3pv/EYDen2fIyJJ+paHz+28UDzXmNENokOhSB2yON0BfW09LbiSDhjdZfgQqi9xN1SRkwrLYp6GIcmjgQcqCU3veUnKzO5wAfgoh1P8gvgoiazn39viYz9ZMdtTf34HSXfMFGSQW9EipK75BNG7aiWrDaL7qMFSDHBMWBuwifdnERwwwJLp7hz/ZEztnXu/E45u6zKpEexedKrdTRsXAtCAZrcjDrPXTIAfPOEfgJjsscpltkGc5PPV6uzCnWA3WS0gnSH6ct0boVwCztgB7TagEj949lA0TzuItSoo0G3Qu7oRo6Vk2dpjEre3sUcJD6uhdV13bn7sNUl8dijYphzPyqQyaAK89b6AzFi0tlbylmdnmuzi7ZI6OZ3Ly1Z3mBOHF0otY+UofrPs9pBNYSrDzH3wAGYQCTB8r9SQzGPRPJADV4OtCr52rCyVGRILEIglpsY5Ud2SCv4KU0p+lIEL58ditxqmfBTdHwEPo52o/rCJ2o2Kr2c8BJKtU8mesEm3Cmvq2oxICWe3s0lJfy7VvHk9Kdzz8cHI7PNzTc3rmU6yoqdAik/zoOF4wgyCTZeeOaFOthLWE+Q+Hg5GwMBT0ywgPLpPgf4kWUim5V11iEnzfuFNOVZPUtvMbU6PVf9ofnbjjItIEPrkGLDxWOf6oMaLpg6YcBmZBkDmMEkHvYYiORoBT6TXFEsmK1lz4o4zY3mioXwSSPFsFHJ7y/2dVvN65ZJchBmLtLkMS7czjszgr4O/BinnPbHyAcEkX6bwUDk7CYyLXrJLnpY76jqm3pbehCyBNY3WiuXdIUyNQwD718tkDLEUVL9ZEu3ziA== X-OriginatorOrg: Nvidia.com X-MS-Exchange-CrossTenant-Network-Message-Id: 21959c7f-c194-4c14-14bd-08dc542529fc X-MS-Exchange-CrossTenant-AuthSource: BYAPR12MB2743.namprd12.prod.outlook.com X-MS-Exchange-CrossTenant-AuthAs: Internal X-MS-Exchange-CrossTenant-OriginalArrivalTime: 03 Apr 2024 21:29:37.6015 (UTC) X-MS-Exchange-CrossTenant-FromEntityHeader: Hosted X-MS-Exchange-CrossTenant-Id: 43083d15-7273-40c1-b7db-39efd9ccc17a X-MS-Exchange-CrossTenant-MailboxType: HOSTED X-MS-Exchange-CrossTenant-UserPrincipalName: xvSkVwOkbrRjsSZkKARyO1ogkm8BRQd3UWWEjM8215YBeSlQoxlTkLXyLS3yXt70BAx/0yExEHhAYIH+WNPLyw== X-MS-Exchange-Transport-CrossTenantHeadersStamped: IA1PR12MB8586 X-Patchwork-Delegate: kuba@kernel.org Multiple network devices that support hardware timestamping appear to have common behavior with regards to timestamp handling. Implement common Tx hardware timestamping statistics in a tx_stats struct_group. Common Rx hardware timestamping statistics can subsequently be implemented in a rx_stats struct_group for ethtool_ts_stats. Signed-off-by: Rahul Rameshbabu Reviewed-by: Dragos Tatulea --- Notes: Changes: v1->v2: - Fixed scripts/kernel-doc warning in include/linux/ethtool.h Documentation/netlink/specs/ethtool.yaml | 17 +++++++ Documentation/networking/ethtool-netlink.rst | 9 ++++ include/linux/ethtool.h | 27 +++++++++- include/uapi/linux/ethtool_netlink.h | 14 ++++++ net/ethtool/tsinfo.c | 52 +++++++++++++++++++- 5 files changed, 117 insertions(+), 2 deletions(-) diff --git a/Documentation/netlink/specs/ethtool.yaml b/Documentation/netlink/specs/ethtool.yaml index 197208f419dc..f5aa1e7f3383 100644 --- a/Documentation/netlink/specs/ethtool.yaml +++ b/Documentation/netlink/specs/ethtool.yaml @@ -559,6 +559,18 @@ attribute-sets: - name: tx-lpi-timer type: u32 + - + name: ts-stat + attributes: + - + name: tx-pkts + type: uint + - + name: tx-lost + type: uint + - + name: tx-err + type: uint - name: tsinfo attributes: @@ -581,6 +593,10 @@ attribute-sets: - name: phc-index type: u32 + - + name: stats + type: nest + nested-attributes: ts-stat - name: cable-result attributes: @@ -1388,6 +1404,7 @@ operations: - tx-types - rx-filters - phc-index + - stats dump: *tsinfo-get-op - name: cable-test-act diff --git a/Documentation/networking/ethtool-netlink.rst b/Documentation/networking/ethtool-netlink.rst index d583d9abf2f8..08d330b0f50f 100644 --- a/Documentation/networking/ethtool-netlink.rst +++ b/Documentation/networking/ethtool-netlink.rst @@ -1237,12 +1237,21 @@ Kernel response contents: ``ETHTOOL_A_TSINFO_TX_TYPES`` bitset supported Tx types ``ETHTOOL_A_TSINFO_RX_FILTERS`` bitset supported Rx filters ``ETHTOOL_A_TSINFO_PHC_INDEX`` u32 PTP hw clock index + ``ETHTOOL_A_TSINFO_STATS`` nested HW timestamping statistics ===================================== ====== ========================== ``ETHTOOL_A_TSINFO_PHC_INDEX`` is absent if there is no associated PHC (there is no special value for this case). The bitset attributes are omitted if they would be empty (no bit set). +Additional hardware timestamping statistics response contents: + + ===================================== ====== =================================== + ``ETHTOOL_A_TS_STAT_TX_PKTS`` u64 Packets with Tx HW timestamps + ``ETHTOOL_A_TS_STAT_TX_LOST`` u64 Tx HW timestamp not arrived count + ``ETHTOOL_A_TS_STAT_TX_ERR`` u64 HW error request Tx timestamp count + ===================================== ====== =================================== + CABLE_TEST ========== diff --git a/include/linux/ethtool.h b/include/linux/ethtool.h index 9901e563f706..6fd9107d3cc0 100644 --- a/include/linux/ethtool.h +++ b/include/linux/ethtool.h @@ -480,6 +480,26 @@ struct ethtool_rmon_stats { ); }; +/** + * struct ethtool_ts_stats - HW timestamping statistics + * @pkts: Number of packets successfully timestamped by the hardware. + * @lost: Number of hardware timestamping requests where the timestamping + * information from the hardware never arrived for submission with + * the skb. + * @err: Number of arbitrary timestamp generation error events that the + * hardware encountered, exclusive of @lost statistics. Cases such + * as resource exhaustion, unavailability, firmware errors, and + * detected illogical timestamp values not submitted with the skb + * are inclusive to this counter. + */ +struct ethtool_ts_stats { + struct_group(tx_stats, + u64 pkts; + u64 lost; + u64 err; + ); +}; + #define ETH_MODULE_EEPROM_PAGE_LEN 128 #define ETH_MODULE_MAX_I2C_ADDRESS 0x7f @@ -755,7 +775,10 @@ struct ethtool_rxfh_param { * @get_ts_info: Get the time stamping and PTP hardware clock capabilities. * It may be called with RCU, or rtnl or reference on the device. * Drivers supporting transmit time stamps in software should set this to - * ethtool_op_get_ts_info(). + * ethtool_op_get_ts_info(). Drivers must not zero statistics which they + * don't report. The stats structure is initialized to ETHTOOL_STAT_NOT_SET + * indicating driver does not report statistics. + * @get_ts_stats: Query the device hardware timestamping statistics. * @get_module_info: Get the size and type of the eeprom contained within * a plug-in module. * @get_module_eeprom: Get the eeprom information from the plug-in module @@ -898,6 +921,8 @@ struct ethtool_ops { struct ethtool_dump *, void *); int (*set_dump)(struct net_device *, struct ethtool_dump *); int (*get_ts_info)(struct net_device *, struct ethtool_ts_info *); + void (*get_ts_stats)(struct net_device *dev, + struct ethtool_ts_stats *ts_stats); int (*get_module_info)(struct net_device *, struct ethtool_modinfo *); int (*get_module_eeprom)(struct net_device *, diff --git a/include/uapi/linux/ethtool_netlink.h b/include/uapi/linux/ethtool_netlink.h index 3f89074aa06c..8dfd714c2308 100644 --- a/include/uapi/linux/ethtool_netlink.h +++ b/include/uapi/linux/ethtool_netlink.h @@ -478,12 +478,26 @@ enum { ETHTOOL_A_TSINFO_TX_TYPES, /* bitset */ ETHTOOL_A_TSINFO_RX_FILTERS, /* bitset */ ETHTOOL_A_TSINFO_PHC_INDEX, /* u32 */ + ETHTOOL_A_TSINFO_STATS, /* nest - _A_TSINFO_STAT */ /* add new constants above here */ __ETHTOOL_A_TSINFO_CNT, ETHTOOL_A_TSINFO_MAX = (__ETHTOOL_A_TSINFO_CNT - 1) }; +enum { + ETHTOOL_A_TS_STAT_UNSPEC, + + ETHTOOL_A_TS_STAT_TX_PKTS, /* u64 */ + ETHTOOL_A_TS_STAT_TX_LOST, /* u64 */ + ETHTOOL_A_TS_STAT_TX_ERR, /* u64 */ + + /* add new constants above here */ + __ETHTOOL_A_TS_STAT_CNT, + ETHTOOL_A_TS_STAT_MAX = (__ETHTOOL_A_TS_STAT_CNT - 1) + +}; + /* PHC VCLOCKS */ enum { diff --git a/net/ethtool/tsinfo.c b/net/ethtool/tsinfo.c index 9daed0aab162..be2755c8d8fd 100644 --- a/net/ethtool/tsinfo.c +++ b/net/ethtool/tsinfo.c @@ -13,14 +13,18 @@ struct tsinfo_req_info { struct tsinfo_reply_data { struct ethnl_reply_data base; struct ethtool_ts_info ts_info; + struct ethtool_ts_stats stats; }; #define TSINFO_REPDATA(__reply_base) \ container_of(__reply_base, struct tsinfo_reply_data, base) +#define ETHTOOL_TS_STAT_CNT \ + (__ETHTOOL_A_TS_STAT_CNT - (ETHTOOL_A_TS_STAT_UNSPEC + 1)) + const struct nla_policy ethnl_tsinfo_get_policy[] = { [ETHTOOL_A_TSINFO_HEADER] = - NLA_POLICY_NESTED(ethnl_header_policy), + NLA_POLICY_NESTED(ethnl_header_policy_stats), }; static int tsinfo_prepare_data(const struct ethnl_req_info *req_base, @@ -34,6 +38,12 @@ static int tsinfo_prepare_data(const struct ethnl_req_info *req_base, ret = ethnl_ops_begin(dev); if (ret < 0) return ret; + if (req_base->flags & ETHTOOL_FLAG_STATS && + dev->ethtool_ops->get_ts_stats) { + ethtool_stats_init((u64 *)&data->stats, + sizeof(data->stats) / sizeof(u64)); + dev->ethtool_ops->get_ts_stats(dev, &data->stats); + } ret = __ethtool_get_ts_info(dev, &data->ts_info); ethnl_ops_complete(dev); @@ -79,10 +89,47 @@ static int tsinfo_reply_size(const struct ethnl_req_info *req_base, } if (ts_info->phc_index >= 0) len += nla_total_size(sizeof(u32)); /* _TSINFO_PHC_INDEX */ + if (req_base->flags & ETHTOOL_FLAG_STATS) + len += nla_total_size(0) + /* _TSINFO_STATS */ + nla_total_size_64bit(sizeof(u64)) * ETHTOOL_TS_STAT_CNT; return len; } +static int tsinfo_put_stat(struct sk_buff *skb, u64 val, u16 attrtype) +{ + if (val == ETHTOOL_STAT_NOT_SET) + return 0; + if (nla_put_uint(skb, attrtype, val)) + return -EMSGSIZE; + return 0; +} + +static int tsinfo_put_stats(struct sk_buff *skb, + const struct ethtool_ts_stats *stats) +{ + struct nlattr *nest; + + nest = nla_nest_start(skb, ETHTOOL_A_TSINFO_STATS); + if (!nest) + return -EMSGSIZE; + + if (tsinfo_put_stat(skb, stats->tx_stats.pkts, + ETHTOOL_A_TS_STAT_TX_PKTS) || + tsinfo_put_stat(skb, stats->tx_stats.lost, + ETHTOOL_A_TS_STAT_TX_LOST) || + tsinfo_put_stat(skb, stats->tx_stats.err, + ETHTOOL_A_TS_STAT_TX_ERR)) + goto err_cancel; + + nla_nest_end(skb, nest); + return 0; + +err_cancel: + nla_nest_cancel(skb, nest); + return -EMSGSIZE; +} + static int tsinfo_fill_reply(struct sk_buff *skb, const struct ethnl_req_info *req_base, const struct ethnl_reply_data *reply_base) @@ -119,6 +166,9 @@ static int tsinfo_fill_reply(struct sk_buff *skb, if (ts_info->phc_index >= 0 && nla_put_u32(skb, ETHTOOL_A_TSINFO_PHC_INDEX, ts_info->phc_index)) return -EMSGSIZE; + if (req_base->flags & ETHTOOL_FLAG_STATS && + tsinfo_put_stats(skb, &data->stats)) + return -EMSGSIZE; return 0; } From patchwork Wed Apr 3 21:28:40 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Rahul Rameshbabu X-Patchwork-Id: 13616724 X-Patchwork-Delegate: kuba@kernel.org Received: from NAM12-MW2-obe.outbound.protection.outlook.com (mail-mw2nam12on2117.outbound.protection.outlook.com [40.107.244.117]) (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 AF92F15688F; Wed, 3 Apr 2024 21:29:43 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=fail smtp.client-ip=40.107.244.117 ARC-Seal: i=2; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1712179785; cv=fail; b=QYvuM4we5ERhC6hVPKsHNsywnvEmESUR7LINbFJwpkBKv7Jl5LuQzp3c7vV3lnWVwGSXBmds1xih5kAsg2me1TNJhMCFQztC0vQNwJNkSrodwIgt+0USh/3fn7GjoQxZayHVQAO2cFigbmwJET1YP8778N5DKVtDGC2z7Jcx4/0= ARC-Message-Signature: i=2; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1712179785; c=relaxed/simple; bh=1Iq1rPE5Vws/F9owFdesCR0VVEd8lfjFoG6/fp2+b+E=; h=From:To:Cc:Subject:Date:Message-ID:In-Reply-To:References: Content-Type:MIME-Version; b=NTIPTsmdVSTnsG597tIdc+XnPbcA4jm6wOJumFmwdgzVqanBQtMHil5tx5OOTvmOt1C3es1bNv7R1UE02pS9JsPhgM/JPFWEZWfttCqEXXpVE+T32mly2pHX9aFpvBJLNqx8nQnt/poFCVfbVq1rfEqzGCy/krMazdDtsgfv22c= ARC-Authentication-Results: i=2; smtp.subspace.kernel.org; dmarc=pass (p=reject dis=none) header.from=nvidia.com; spf=fail smtp.mailfrom=nvidia.com; dkim=pass (2048-bit key) header.d=Nvidia.com header.i=@Nvidia.com header.b=hPe7HvQx; arc=fail smtp.client-ip=40.107.244.117 Authentication-Results: smtp.subspace.kernel.org; dmarc=pass (p=reject dis=none) header.from=nvidia.com Authentication-Results: smtp.subspace.kernel.org; spf=fail smtp.mailfrom=nvidia.com Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=Nvidia.com header.i=@Nvidia.com header.b="hPe7HvQx" ARC-Seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=Z7WG4dcqYl9/k556jB2a5iYeECVwpp0kwTu+jnrJLvYmkHAFrublgtsAIPP5/u/soN5GHMk5khyix0yCa7VL3Jop58Ng9gg835rGvjnBXOU/QKjE+6FcXSFA27NdXHwWcxlvJ3msBOMNEiNKWMAwsgdveYS3mbca66uK16t3UnYvgmYxbgKj0VvgHrI0iKFfQSoesAa8RbzGtxPTVlXl9itP9BuzmfLGq8TDaRxz2dQfZlcxsiu8MQmP4a3O/CC0j6BFFsZXAEdu5Vl1q4pv9OkChfkMPYdOEOIeC0rvnGy/XVpF8K2v1E4rJl+FhZjkruGmJb8D/KjGqTKmWieImw== 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=/jA2vxHsGi7a/yAU0vv9kA467PAZ1r09oWr5tHTIlCI=; b=XwnQgAY4w+9lzBwUJ7bRHxThQCtjomAZO7nUywrurg8iVcI/R4j+xPGXWy95PLviBrvEk2itFJHLFIz3XC+/anO+7lpL+F0MbZqSj/ZPxDVTUUsaD7xueuresVNcZmc4PSy1R0jOsZlnM2HMGCSVU0uJMimQEuZ18joYcb5DNnpj2Wc2n7Bn8Su+JHbMsIs1FE/uhvvDuUAgZ9tklSSe7yRuZMhy59PIeKxRF5OnUUa1N9Xi6xPaOV4Aq0koCuBcMnNrZDiP3tTrkCXY2sDBYRcAM6gsJidwPODXwk1WlwWCmRRxMSlZma0fIv+pXEDwkuTjJ1DaD4FeUdHu1uUmPA== ARC-Authentication-Results: i=1; mx.microsoft.com 1; spf=pass smtp.mailfrom=nvidia.com; dmarc=pass action=none header.from=nvidia.com; dkim=pass header.d=nvidia.com; arc=none DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=Nvidia.com; s=selector2; h=From:Date:Subject:Message-ID:Content-Type:MIME-Version:X-MS-Exchange-SenderADCheck; bh=/jA2vxHsGi7a/yAU0vv9kA467PAZ1r09oWr5tHTIlCI=; b=hPe7HvQxTMUlELCTqf+8nuAG35nB5p8JxzvDSk3YwQm+1G2ZfcS26HIU5wZhKZFqV3CS/VRn4/toaVZOdv/utd4T3R8nq9NR+n60oh83G2Y/xwtBSbG8CH9cIzTTzhbK+Q8JkeQueCRpTG/sC2mgWeAn+/jL8hEKPAgXTMZ5JEt1LqgY94vmkj3CdZMHfxwZub+cGymNrPouWAMohSgElyQ+BUdCa0hGv0eD8sSOsAHOyVrpZ7/4ohMAGVp9FoUp0q4p/Z6JxAhVIXBgJbKVTg6sIjaZR+Nb+Jzz+JrS0ye0HZfLzCNxQVA2aYUraC0tQ7O+ue+07IcfHB/OG8K9Uw== Received: from BYAPR12MB2743.namprd12.prod.outlook.com (2603:10b6:a03:61::28) by IA1PR12MB8586.namprd12.prod.outlook.com (2603:10b6:208:44e::9) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.7409.46; Wed, 3 Apr 2024 21:29:38 +0000 Received: from BYAPR12MB2743.namprd12.prod.outlook.com ([fe80::459b:b6fe:a74c:5fbf]) by BYAPR12MB2743.namprd12.prod.outlook.com ([fe80::459b:b6fe:a74c:5fbf%6]) with mapi id 15.20.7409.042; Wed, 3 Apr 2024 21:29:38 +0000 From: Rahul Rameshbabu To: netdev@vger.kernel.org, linux-kernel@vger.kernel.org, linux-doc@vger.kernel.org Cc: ahmed.zaki@intel.com, aleksander.lobakin@intel.com, alexandre.torgue@foss.st.com, andrew@lunn.ch, cjubran@nvidia.com, corbet@lwn.net, davem@davemloft.net, dtatulea@nvidia.com, edumazet@google.com, gal@nvidia.com, hkallweit1@gmail.com, jacob.e.keller@intel.com, jiri@resnulli.us, joabreu@synopsys.com, justinstitt@google.com, kory.maincent@bootlin.com, kuba@kernel.org, leon@kernel.org, liuhangbin@gmail.com, maxime.chevallier@bootlin.com, pabeni@redhat.com, paul.greenwalt@intel.com, przemyslaw.kitszel@intel.com, rdunlap@infradead.org, richardcochran@gmail.com, saeed@kernel.org, tariqt@nvidia.com, vadim.fedorenko@linux.dev, vladimir.oltean@nxp.com, wojciech.drewek@intel.com, Rahul Rameshbabu , Saeed Mahameed Subject: [PATCH net-next v2 2/6] net/mlx5e: Introduce lost_cqe statistic counter for PTP Tx port timestamping CQ Date: Wed, 3 Apr 2024 14:28:40 -0700 Message-ID: <20240403212931.128541-3-rrameshbabu@nvidia.com> X-Mailer: git-send-email 2.42.0 In-Reply-To: <20240403212931.128541-1-rrameshbabu@nvidia.com> References: <20240403212931.128541-1-rrameshbabu@nvidia.com> X-ClientProxiedBy: BYAPR05CA0001.namprd05.prod.outlook.com (2603:10b6:a03:c0::14) To BYAPR12MB2743.namprd12.prod.outlook.com (2603:10b6:a03:61::28) 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: BYAPR12MB2743:EE_|IA1PR12MB8586:EE_ X-MS-Exchange-SenderADCheck: 1 X-MS-Exchange-AntiSpam-Relay: 0 X-Microsoft-Antispam: BCL:0; X-Microsoft-Antispam-Message-Info: hN8Gr2JJgL197hTwDQnF7keCnlG2CYAF9ONaQZjxI6vba00Zf8jXIN6G/i6q9oDlcLkp0tPV/9obPDlJKvNJgd/g0iWPeQt4EHU/8FtbEckLKhA/Ad6y+FJgaYJk2pbHl4dO7wm7qV6JQvaXSlQ0kbr9N44a1G5kZBUFGdjzdjtynFs/MInNU6zJ9HMtbQnZPbdRs1gnJUl+lmE7mmNNj9V+EM+o3PfyTLBreULhBou1GolN0WhHhJNODxSBtwc3Bnd5vTqA4Ne440xxve1Y0kPJPExDS7ZkNqGSqS7rBX6rac9DXHuOYxAIJQaypECecE+BT7sI7DcnqW8j4Ge3Ts/T0ltiOvmbVMux3MlSv3fA0Bq9Rh9dUCRXA1MwtB+1D9n7rAS7MpqmNGladWBnTP8ojH0qqXaF23GBdnKIk2BZU/tEy3k08M4aGzGJhKB2agjrID0vHLXWOkACsNID4sTGsN+ujQteSEIoZFgob5p3Rl/7T5LjXHp4TpS9JDX/9nLaB7DSCM1/KW/QbqDO89D+HeaqnfqItU2EYaIrO+okG6mqFjEEwI/xau99nHmmSgPNhhgCTt5XMnKulIlo90B9DIwGll3c2aEsjwDcH0jii7PxfA5GKM6wPZPCJljv3GUCIynZJPBOBUxSp24TAU7zRadbskfptsbWZVGtS2g= X-Forefront-Antispam-Report: CIP:255.255.255.255;CTRY:;LANG:en;SCL:1;SRV:;IPV:NLI;SFV:NSPM;H:BYAPR12MB2743.namprd12.prod.outlook.com;PTR:;CAT:NONE;SFS:(13230031)(1800799015)(376005)(7416005)(366007);DIR:OUT;SFP:1102; X-MS-Exchange-AntiSpam-MessageData-ChunkCount: 1 X-MS-Exchange-AntiSpam-MessageData-0: TE+0R01o7AdeVMwnF3A012eTcvLMXK3OZud7PYu+SoatFCZgU9yd/RpE7vaPL4TNHT5V4xZNK47o3H1HluOiRnn7aZT71xIzBHJ+i7T8bFu9sGPmuHHEtVo0p/Kh4HPIaqNM4+gOiH1BTpmPHSzDjHsh9BBzI3AEqNxAJbxQ6J4fdYxtMxyIYQl2ib+xTnwcFblUFVHLHqqJ2jv5QhSS4qrQiWwuNT03LR7Llyx5d6ysAMY8h4orX6SPrpnj3mMlxEwDdseoe5oOUQscuntV449knj3+NIX/j+3RBVSgsmdztF83bTZWxrPSSXGu68TV339YKt+M+MhaRZ0S6N59xWLMhKvvgP6tr8e7K5VhKHk4ixFdT/Qk1i1Oub4FehiVCJRKfkt08SbvCBKTssiWBIZPHubzOtZ+FrtELGyyeJplOPxy33/WoiFSEYcFGD5x9PXPgA/xfr3GAoHKE50WHRWt6fpEbbQUV1zTVhGT3yrhrJMda/vWWEJ4GCIC01dOmWYfNcT9cFvxS8M/cLOUVwQE0KV5lvbvVGAd/NSzK4TMEjzmdaRVz8cp9p54xazS0ShYWvNHCLBPVkcL0qGjsgHWn5nwk4SS6B3fqRwfc+3PaCsL4ITzk0kzsX7JfygRDZH3/OKF+684OS3Sxu50LuQtiVGdaHO5FqZjCFfcuWR4aYfSw0uv7AoWAkvTaGvSN48YvfagEv96OK0hMQmPtIz+JJxYYBov4eT6mZMpmEGrFeLI9ZwJG13DX3EWaK3BplIbNvrMyKH235e3btyDwqrr+rtsknA25SZB9FGHvwSb0JnVn+WfWauxjWSlCh5gLaIbkESDFSNBOIsbGgP//5C6eQ5AE8pZOhVwyy/12E94kg/MLt2PJzuI9wQiVB3+imqH98IqpxSUQE6RZeSxpDi5EmRMOpKW0kFTIWYnNbwRsGBWicVEDWwcUeS9Rfy1b/BSF0dbD2JAC5P46yRfdtsHy92IdGCIlKri13LfAnOT6sZQLNl8WLxGHf1m8lPGws68JhE3TJF6ocVtVPhgj0LbP+R2YMMoBgTdxAQCr4U+YbSd1+SQ/Sbyk0U95mK8E9hKFfg+WFEcYkLWLMwOU8hNhxUFdkWg2rpou93S/BcqkNJJU1eshFgUBjGWplNfeK6U03B8P2YX3vyCxmhGp3zqjPmtlCjp0o3jJdA63Xg2s3JQM2aOZ9yLwv38c8tiWbG5uAi5N+/jr7tJYLgMmTjNi0P82hxuLxxb1CWO3yy/7YKgqwA/XKL2E++QyW3Q8H0yW89UZnbpfbYBJAeT4I5iCheioNebsTSeoqRvrNWQc2fW6ZMB2WtVIGc+wtHn/c8+tdyodaudBRFhxl8Pb2gvxfLd7z8zMZQv2NiSc5x0MjcC8WnhLXbuLtLTLg7udq4Gb2AWzQjb6LSRB7hptkTxfO6f1ijeOJyXliBN/IXtqdoykigOpNbIdsNIcrDmhEGntNSpL41fNCc5AVm1yKk1H9ScRdV/kcgMr9xQMvahqWqlVGVyTn0RxgRGTMGpIZmTp3OWXN984SB2fz8328UJzu0hB29kEA5NkbupEM3nAJjBMOcqoU7fHN0GxR83KXnDq0nOlopMym6EqmTcCA== X-OriginatorOrg: Nvidia.com X-MS-Exchange-CrossTenant-Network-Message-Id: 0dfa297a-7b89-4396-2114-08dc54252a55 X-MS-Exchange-CrossTenant-AuthSource: BYAPR12MB2743.namprd12.prod.outlook.com X-MS-Exchange-CrossTenant-AuthAs: Internal X-MS-Exchange-CrossTenant-OriginalArrivalTime: 03 Apr 2024 21:29:38.2240 (UTC) X-MS-Exchange-CrossTenant-FromEntityHeader: Hosted X-MS-Exchange-CrossTenant-Id: 43083d15-7273-40c1-b7db-39efd9ccc17a X-MS-Exchange-CrossTenant-MailboxType: HOSTED X-MS-Exchange-CrossTenant-UserPrincipalName: aXZTUUnFGMH2Vc2BqVQmqax2GbLsBhJXn9TZmna5dSyqR+Se6wcJBUGNlXKj9t3p9+RlveZdaLgN5m8xL4Uo9w== X-MS-Exchange-Transport-CrossTenantHeadersStamped: IA1PR12MB8586 X-Patchwork-Delegate: kuba@kernel.org Track the number of times a CQE was expected to not be delivered on PTP Tx port timestamping CQ. A CQE is expected to not be delivered if a certain amount of time passes since the corresponding CQE containing the DMA timestamp information has arrived. Increment the late_cqe counter when such a CQE does manage to be delivered to the CQ. Signed-off-by: Rahul Rameshbabu Reviewed-by: Tariq Toukan Reviewed-by: Dragos Tatulea Signed-off-by: Saeed Mahameed --- .../device_drivers/ethernet/mellanox/mlx5/counters.rst | 6 ++++++ drivers/net/ethernet/mellanox/mlx5/core/en/ptp.c | 1 + drivers/net/ethernet/mellanox/mlx5/core/en_stats.c | 1 + drivers/net/ethernet/mellanox/mlx5/core/en_stats.h | 1 + 4 files changed, 9 insertions(+) diff --git a/Documentation/networking/device_drivers/ethernet/mellanox/mlx5/counters.rst b/Documentation/networking/device_drivers/ethernet/mellanox/mlx5/counters.rst index f69ee1ebee01..5464cd9e2694 100644 --- a/Documentation/networking/device_drivers/ethernet/mellanox/mlx5/counters.rst +++ b/Documentation/networking/device_drivers/ethernet/mellanox/mlx5/counters.rst @@ -702,6 +702,12 @@ the software port. the device typically ensures not posting the CQE. - Error + * - `ptp_cq[i]_lost_cqe` + - Number of times a CQE is expected to not be delivered on the PTP + timestamping CQE by the device due to a time delta elapsing. If such a + CQE is somehow delivered, `ptp_cq[i]_late_cqe` is incremented. + - Error + .. [#ring_global] The corresponding ring and global counters do not share the same name (i.e. do not follow the common naming scheme). diff --git a/drivers/net/ethernet/mellanox/mlx5/core/en/ptp.c b/drivers/net/ethernet/mellanox/mlx5/core/en/ptp.c index d0af7271da34..afd654583b6b 100644 --- a/drivers/net/ethernet/mellanox/mlx5/core/en/ptp.c +++ b/drivers/net/ethernet/mellanox/mlx5/core/en/ptp.c @@ -169,6 +169,7 @@ static void mlx5e_ptpsq_mark_ts_cqes_undelivered(struct mlx5e_ptpsq *ptpsq, WARN_ON_ONCE(!pos->inuse); pos->inuse = false; list_del(&pos->entry); + ptpsq->cq_stats->lost_cqe++; } spin_unlock_bh(&cqe_list->tracker_list_lock); } diff --git a/drivers/net/ethernet/mellanox/mlx5/core/en_stats.c b/drivers/net/ethernet/mellanox/mlx5/core/en_stats.c index f3d0898bdbc6..64a435f914ff 100644 --- a/drivers/net/ethernet/mellanox/mlx5/core/en_stats.c +++ b/drivers/net/ethernet/mellanox/mlx5/core/en_stats.c @@ -2175,6 +2175,7 @@ static const struct counter_desc ptp_cq_stats_desc[] = { { MLX5E_DECLARE_PTP_CQ_STAT(struct mlx5e_ptp_cq_stats, abort) }, { MLX5E_DECLARE_PTP_CQ_STAT(struct mlx5e_ptp_cq_stats, abort_abs_diff_ns) }, { MLX5E_DECLARE_PTP_CQ_STAT(struct mlx5e_ptp_cq_stats, late_cqe) }, + { MLX5E_DECLARE_PTP_CQ_STAT(struct mlx5e_ptp_cq_stats, lost_cqe) }, }; static const struct counter_desc ptp_rq_stats_desc[] = { diff --git a/drivers/net/ethernet/mellanox/mlx5/core/en_stats.h b/drivers/net/ethernet/mellanox/mlx5/core/en_stats.h index 12b3607afecd..03f6265d3ed5 100644 --- a/drivers/net/ethernet/mellanox/mlx5/core/en_stats.h +++ b/drivers/net/ethernet/mellanox/mlx5/core/en_stats.h @@ -461,6 +461,7 @@ struct mlx5e_ptp_cq_stats { u64 abort; u64 abort_abs_diff_ns; u64 late_cqe; + u64 lost_cqe; }; struct mlx5e_rep_stats { From patchwork Wed Apr 3 21:28:41 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Rahul Rameshbabu X-Patchwork-Id: 13616725 X-Patchwork-Delegate: kuba@kernel.org Received: from NAM12-MW2-obe.outbound.protection.outlook.com (mail-mw2nam12on2097.outbound.protection.outlook.com [40.107.244.97]) (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 693CE156C62; Wed, 3 Apr 2024 21:29:48 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=fail smtp.client-ip=40.107.244.97 ARC-Seal: i=2; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1712179790; cv=fail; b=LZg/V4GAqRuyJVEXRKsBouhq7/rnw0prUUsEAA9+5CN5b3FHhOONeGltD7MbTolX5LIyoc9VLM7tMaNp0hteGzCK+5OGeSmHQuW5MstLbZSWWTWyejFTtmDnfqXhxkN2/kEBqu645U1/G1lsrZKzzur5Q0Su/00tQnzFMlI+geQ= ARC-Message-Signature: i=2; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1712179790; c=relaxed/simple; bh=WwhCAT5WSnm2yd9jWnS4IDeSKji8NSr3NtaxtHVz2iA=; h=From:To:Cc:Subject:Date:Message-ID:In-Reply-To:References: Content-Type:MIME-Version; b=qllvmwV4GhCl+isl/HDHKgQ9uyIst2dGDXxlfIuDQObJpEinsYOniUHyM5zftjmO4+/hIuthzy9dSzI0XASU34Bgh9QITjswl9ypnt6kSUGtFmd4Sp9hG3n4HBoQCJ/Swn+lbwcyoaFPN1lLEFTLUn7HbzxWr5AY5rVg9EJ5M4M= ARC-Authentication-Results: i=2; smtp.subspace.kernel.org; dmarc=pass (p=reject dis=none) header.from=nvidia.com; spf=fail smtp.mailfrom=nvidia.com; dkim=pass (2048-bit key) header.d=Nvidia.com header.i=@Nvidia.com header.b=YQqbarAX; arc=fail smtp.client-ip=40.107.244.97 Authentication-Results: smtp.subspace.kernel.org; dmarc=pass (p=reject dis=none) header.from=nvidia.com Authentication-Results: smtp.subspace.kernel.org; spf=fail smtp.mailfrom=nvidia.com Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=Nvidia.com header.i=@Nvidia.com header.b="YQqbarAX" ARC-Seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=mG27bhtPQ2ICkW0rsem6I4j5IpqR8hnZLp2OoiXqhWZe0gOF1XCqzW/aZycTsEfGGlXLEBcJVsmLZORc9cjyUZRiCSZB80njMByuN2Fv00shdHbt1dnMStNdOYw4klV4d1w+tniOZ4B/06C+3Lw/Qk7wVT05Ka6yHwytuxYhA2N7hqzFgJIiA8ibOwgbmr8ZzDf0wIyA2evcf707F2xIP4sL0+D5GpDhTUZY4A6DvDHUsNXcMbLiytoGR/hYAbbd0cFkor4+UizLV2/Fzb2hiPtv2q8hW3cfakpLggnyqc5gVsickZt0WcjlKlMz1m7VmXmY/XFJAC2TmFCAqk3P0w== 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=HsYmuphJHuA47Un9AfdK2eX8onvVH+g4LnJUTGpZUkI=; b=H3fAEzGuR8E72VOGf1JZ5YmVBEFBiT9RLFreBCvU+UeaMvlVvIVs0D87JpmPFOEK6wgfGhZTptKc8K1QgknqkbwD3KvXRyy8483fZusWF+vLlPPu2MBgz8Qdg+erXXEfa1H2S2L4y2veAbZ7by82eWZPwkjT1mJrJzTUPqDBtnVQvE0AFHbTN2RlxYjFGTL9w8190XFyBaA3q/xCOPVMDb59wGpoK9+FYT3B1d5tXh74VU5totTJ+L/4EQo8tAE72TCyWoEXc7aDshBfAaXZYEBRekUnBLJyTnM0UcXd8bdPd5N1IDCIPXrROP/UoaCekm7LzcNIF1SCdR5gwbxrUA== ARC-Authentication-Results: i=1; mx.microsoft.com 1; spf=pass smtp.mailfrom=nvidia.com; dmarc=pass action=none header.from=nvidia.com; dkim=pass header.d=nvidia.com; arc=none DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=Nvidia.com; s=selector2; h=From:Date:Subject:Message-ID:Content-Type:MIME-Version:X-MS-Exchange-SenderADCheck; bh=HsYmuphJHuA47Un9AfdK2eX8onvVH+g4LnJUTGpZUkI=; b=YQqbarAXW43ckJvRQevTrpgmcEsAUrP6u+e+bAwQK4jFo65Wt0w4hmGt6gJwVJ1SYH/dRchOj2svaEayc0J8It65JGzQ3HYl/lCyyJp2Clz4QxERLbuHi7Qnin+2hd6lQWI5mY+Ot9fHhFtvIf3C62l8JBiTNTg/FPXshHrrPX0ESxNujni3aw3I6N9Zg/EVTas2AvwQmdkNQkpDekoJWNV+wsCcyFnr4Gf0IrCaGQJSgAib+dVL4g/WKDxBON3m+QxVkY9+T4gAAsmBgG9A0yHuLEO6c9szxjEMLCq3cnvvP1080YOFzwKMGAd9DbePgjclXR75DTo3bioev4LnjQ== Received: from BYAPR12MB2743.namprd12.prod.outlook.com (2603:10b6:a03:61::28) by IA1PR12MB8586.namprd12.prod.outlook.com (2603:10b6:208:44e::9) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.7409.46; Wed, 3 Apr 2024 21:29:39 +0000 Received: from BYAPR12MB2743.namprd12.prod.outlook.com ([fe80::459b:b6fe:a74c:5fbf]) by BYAPR12MB2743.namprd12.prod.outlook.com ([fe80::459b:b6fe:a74c:5fbf%6]) with mapi id 15.20.7409.042; Wed, 3 Apr 2024 21:29:39 +0000 From: Rahul Rameshbabu To: netdev@vger.kernel.org, linux-kernel@vger.kernel.org, linux-doc@vger.kernel.org Cc: ahmed.zaki@intel.com, aleksander.lobakin@intel.com, alexandre.torgue@foss.st.com, andrew@lunn.ch, cjubran@nvidia.com, corbet@lwn.net, davem@davemloft.net, dtatulea@nvidia.com, edumazet@google.com, gal@nvidia.com, hkallweit1@gmail.com, jacob.e.keller@intel.com, jiri@resnulli.us, joabreu@synopsys.com, justinstitt@google.com, kory.maincent@bootlin.com, kuba@kernel.org, leon@kernel.org, liuhangbin@gmail.com, maxime.chevallier@bootlin.com, pabeni@redhat.com, paul.greenwalt@intel.com, przemyslaw.kitszel@intel.com, rdunlap@infradead.org, richardcochran@gmail.com, saeed@kernel.org, tariqt@nvidia.com, vadim.fedorenko@linux.dev, vladimir.oltean@nxp.com, wojciech.drewek@intel.com, Rahul Rameshbabu Subject: [PATCH net-next v2 3/6] net/mlx5e: Introduce timestamps statistic counter for Tx DMA layer Date: Wed, 3 Apr 2024 14:28:41 -0700 Message-ID: <20240403212931.128541-4-rrameshbabu@nvidia.com> X-Mailer: git-send-email 2.42.0 In-Reply-To: <20240403212931.128541-1-rrameshbabu@nvidia.com> References: <20240403212931.128541-1-rrameshbabu@nvidia.com> X-ClientProxiedBy: SJ0PR05CA0024.namprd05.prod.outlook.com (2603:10b6:a03:33b::29) To BYAPR12MB2743.namprd12.prod.outlook.com (2603:10b6:a03:61::28) 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: BYAPR12MB2743:EE_|IA1PR12MB8586:EE_ X-MS-Exchange-SenderADCheck: 1 X-MS-Exchange-AntiSpam-Relay: 0 X-Microsoft-Antispam: BCL:0; X-Microsoft-Antispam-Message-Info: vb+OPPT1PRuphbg5LyeELINibLQThB/09qdqukHUICCyahHeTMzqqb+WHJ8vxVn4GuiDUq6BH1VRf5NWt/5lcncEhNKHWtiMeddknMSij3T4/jukXdBRDjwKT0ejGczJimIRPlhltCNlul0uJDhegqsqE2hZ1GeL9zrEU7HEi0tdT681uurGJVEUmBMEUezE3lJp5nf7YWa3OSJXF3ukUeSgEZD+2P5ILFIMP2LZyOhx8mudOGzUQueys4VlxNPhyy6Ix7JHe6m0O33GYcIqbe0KAkVdUvy6ZwbuN5z79MzOl6uF5La3EqgQH/ehNRd9pjpzFyQAbr2N7vfI25RzW3A56W3RTvFoT/bTBPYs/JB1pG6ZmGd2DBIksBhEPHkROybsR97UYn5ND9D80eiyGEhPXRqVA+BbN9vlpwac2ex04CLRrRP19tuJsgCRDJ7WumQ5tp4J19XrXocEcXdkfCfMjtLeeKCHmg3eI9fdAj/sWarg2RvkjUz8Kp3/hwIkz47qJCioUwwCvKAXf97vWF29nyt2rbVrFvpFq9pcRLZ5qzOUvYaU30ytYnBT/ooFBabEI9As79bfLaizju7r4E752DEGYzA6sY0T3h80SAttIJIBAbceeM/bggFR2+7GbNOzEIelNBMwOBvGATSPoC5uOV2IG7I2fLAHe205ShI= X-Forefront-Antispam-Report: CIP:255.255.255.255;CTRY:;LANG:en;SCL:1;SRV:;IPV:NLI;SFV:NSPM;H:BYAPR12MB2743.namprd12.prod.outlook.com;PTR:;CAT:NONE;SFS:(13230031)(1800799015)(376005)(7416005)(366007);DIR:OUT;SFP:1102; X-MS-Exchange-AntiSpam-MessageData-ChunkCount: 1 X-MS-Exchange-AntiSpam-MessageData-0: YS1lrVk9oleZrrYTDajn8uV3BR4V4jdznLoYzNbos+Nxan83LI90SusRbO+hYRUK9q3FhhQP94zS1XjWOaK0/sE8f4ilJTRzGFkBHsgkEQYLrnRYQaqRaJmrKyFhHaS3+LKjzNfNClGrLpqR5ngbcETnAWkwbXVwetlRY+5eYpXXjkmUFq31FOs97DRZilNwxyogIA6chmR1xS03jw1pw4gCo+hIZO6kTXKzePBw4BcgMENegT2ArEKwE5ZdiFh1DEFkzNLY/zLnB5a1b/ZOYC6Id6H7BgfUFUJjS2N/itibW4Jf/Czj3UP5FE9FPKY5vhqb3RmDpvaBN5P7HHepflrKYS0RXNH27s9hjLA72WTqv4oEjQobi6l4oQE2ziBSF/lxHPtDIpVbPsGDnW9+1hob1su1Dmi8vsQknFqgb6uqQe1xZJj8y1ZsD65hMbeFUsu7GI+oArbnPfQV+h04O/EH+mbn+ZEZE66Swkt7EKhsZIkK5Rpp8M5znR/andjIZr6EK/MJ6dENX/GBxzI7oTeWerTqu4ZKMwp3CTBbn1QdnfjktQapxi6CQUTqyG+okIhAfuT/6yMoDJnsuYe4VCRX0IzTkyGqV9t67yUOvYEtbMIVlxSkbDJKVOvCg9F9vmStyK70tcyBt1IE3/Zx+S/J4ECUtWkwq/Pu76U7ymR2kfxZgdEL6Sxca4+B0OzPYQKpULkK0DDURBjc3ZesVmKvccykbkU/KBNBedBNO9yf/SJ5IOuN6QHTGXh0jQEbNOwcuG+gkNTsT7nBzca4/HXk/QqjXgeskfyJc7MO6C56pwHhR6kvNNkcJoLH4Hc6G/qE+jcxc8OJtBbn06NYOyAB2LJ1eVcg/GDMxh6I8tefSpmkJj5aDK9BhtuNcYOI9HIMmt/ulTlO2UnwnX3N2xXEQTIl7GI7ZKv9SCOrlxdkFQyTdThHccDAQ5y97Ay4VSEEA2goEd1nzp+qLMK/tGWuRnTPbw+bXJpjCxzuKvTx+R5LHkdlxcfOSLEOcRAwKoZ4/s8KpWdbMM/G12i00yX6O2xJBh5KPaOqCd/BXX4AP8QTfh9ssxe6ZwR3s3FYf/Pvkr7uy7yqgpI3qzdyOS4gHiDcNo0ykahcl7qdvNGrtK29QjllZcaSzoxOtAmP0/eIzwhg4lTOHVdleZrw3Zg4K0TNHinNIxbWtTMGAbwZt/vLK0UKg49De+UgKFogzPJNQ6eW31QmXct+6FXPDM2ZnIWhdpVg/et/HKBlvIjgfyRzRmDSOZvCerNihm0H7MLNk+piVDYAScb3+bZHsolT3fG1podpW+2M7Q1Z5wN8NYUbY15T+3sSeKR8q6bjlGmxlN+EAswK+umvDt16NHC3iG+d2AFvxg5yapaExMY/u7tdTmrhoHldQtaxmDJQ1h8URWC9rpJ139SLXOLAHfPidG+KLq1gpEJSSsvYKSPvCYQiTwQJUFszH/oBo1QLKLwv3TDL3mZaVhZy2e4q8rmxXZepSwfAM3UkbXy8N/qkD2AxaSr/19OGO+059Bc+mrRf5H23ngFmVuyLHVGD4LF4el/coE8nARR+GHO1ZbrY7FAjsD6S3eq04dJHjMGp4zsCGDiVCJ0let/hW0Le3Q== X-OriginatorOrg: Nvidia.com X-MS-Exchange-CrossTenant-Network-Message-Id: bb00f957-f1b8-4e63-d0fd-08dc54252ad9 X-MS-Exchange-CrossTenant-AuthSource: BYAPR12MB2743.namprd12.prod.outlook.com X-MS-Exchange-CrossTenant-AuthAs: Internal X-MS-Exchange-CrossTenant-OriginalArrivalTime: 03 Apr 2024 21:29:39.0401 (UTC) X-MS-Exchange-CrossTenant-FromEntityHeader: Hosted X-MS-Exchange-CrossTenant-Id: 43083d15-7273-40c1-b7db-39efd9ccc17a X-MS-Exchange-CrossTenant-MailboxType: HOSTED X-MS-Exchange-CrossTenant-UserPrincipalName: kc2DQx+BDgS4y07cEyt8U3gN1MkIygGBDYvH4aS1R6/lv9HeoodWjnBm1xp9LzSV9ctxqum5DreGpfhDDdo6MA== X-MS-Exchange-Transport-CrossTenantHeadersStamped: IA1PR12MB8586 X-Patchwork-Delegate: kuba@kernel.org Count number of transmitted packets that were hardware timestamped at the device DMA layer. Signed-off-by: Rahul Rameshbabu Reviewed-by: Dragos Tatulea --- .../device_drivers/ethernet/mellanox/mlx5/counters.rst | 5 +++++ drivers/net/ethernet/mellanox/mlx5/core/en_stats.c | 2 ++ drivers/net/ethernet/mellanox/mlx5/core/en_stats.h | 1 + drivers/net/ethernet/mellanox/mlx5/core/en_tx.c | 6 ++++-- 4 files changed, 12 insertions(+), 2 deletions(-) diff --git a/Documentation/networking/device_drivers/ethernet/mellanox/mlx5/counters.rst b/Documentation/networking/device_drivers/ethernet/mellanox/mlx5/counters.rst index 5464cd9e2694..fed821ef9b09 100644 --- a/Documentation/networking/device_drivers/ethernet/mellanox/mlx5/counters.rst +++ b/Documentation/networking/device_drivers/ethernet/mellanox/mlx5/counters.rst @@ -300,6 +300,11 @@ the software port. in the beginning of the queue. This is a normal condition. - Informative + * - `tx[i]_timestamps` + - Transmitted packets that were hardware timestamped at the device's DMA + layer. + - Informative + * - `tx[i]_added_vlan_packets` - The number of packets sent where vlan tag insertion was offloaded to the hardware. diff --git a/drivers/net/ethernet/mellanox/mlx5/core/en_stats.c b/drivers/net/ethernet/mellanox/mlx5/core/en_stats.c index 64a435f914ff..a06c6c80e36f 100644 --- a/drivers/net/ethernet/mellanox/mlx5/core/en_stats.c +++ b/drivers/net/ethernet/mellanox/mlx5/core/en_stats.c @@ -2063,6 +2063,7 @@ static const struct counter_desc sq_stats_desc[] = { { MLX5E_DECLARE_TX_STAT(struct mlx5e_sq_stats, csum_partial_inner) }, { MLX5E_DECLARE_TX_STAT(struct mlx5e_sq_stats, added_vlan_packets) }, { MLX5E_DECLARE_TX_STAT(struct mlx5e_sq_stats, nop) }, + { MLX5E_DECLARE_TX_STAT(struct mlx5e_sq_stats, timestamps) }, { MLX5E_DECLARE_TX_STAT(struct mlx5e_sq_stats, mpwqe_blks) }, { MLX5E_DECLARE_TX_STAT(struct mlx5e_sq_stats, mpwqe_pkts) }, #ifdef CONFIG_MLX5_EN_TLS @@ -2215,6 +2216,7 @@ static const struct counter_desc qos_sq_stats_desc[] = { { MLX5E_DECLARE_QOS_TX_STAT(struct mlx5e_sq_stats, csum_partial_inner) }, { MLX5E_DECLARE_QOS_TX_STAT(struct mlx5e_sq_stats, added_vlan_packets) }, { MLX5E_DECLARE_QOS_TX_STAT(struct mlx5e_sq_stats, nop) }, + { MLX5E_DECLARE_QOS_TX_STAT(struct mlx5e_sq_stats, timestamps) }, { MLX5E_DECLARE_QOS_TX_STAT(struct mlx5e_sq_stats, mpwqe_blks) }, { MLX5E_DECLARE_QOS_TX_STAT(struct mlx5e_sq_stats, mpwqe_pkts) }, #ifdef CONFIG_MLX5_EN_TLS diff --git a/drivers/net/ethernet/mellanox/mlx5/core/en_stats.h b/drivers/net/ethernet/mellanox/mlx5/core/en_stats.h index 03f6265d3ed5..3c634c5fd420 100644 --- a/drivers/net/ethernet/mellanox/mlx5/core/en_stats.h +++ b/drivers/net/ethernet/mellanox/mlx5/core/en_stats.h @@ -429,6 +429,7 @@ struct mlx5e_sq_stats { u64 stopped; u64 dropped; u64 recover; + u64 timestamps; /* dirtied @completion */ u64 cqes ____cacheline_aligned_in_smp; u64 wake; diff --git a/drivers/net/ethernet/mellanox/mlx5/core/en_tx.c b/drivers/net/ethernet/mellanox/mlx5/core/en_tx.c index 2fa076b23fbe..09a592909101 100644 --- a/drivers/net/ethernet/mellanox/mlx5/core/en_tx.c +++ b/drivers/net/ethernet/mellanox/mlx5/core/en_tx.c @@ -750,11 +750,13 @@ static void mlx5e_consume_skb(struct mlx5e_txqsq *sq, struct sk_buff *skb, u64 ts = get_cqe_ts(cqe); hwts.hwtstamp = mlx5e_cqe_ts_to_ns(sq->ptp_cyc2time, sq->clock, ts); - if (sq->ptpsq) + if (sq->ptpsq) { mlx5e_skb_cb_hwtstamp_handler(skb, MLX5E_SKB_CB_CQE_HWTSTAMP, hwts.hwtstamp, sq->ptpsq->cq_stats); - else + } else { skb_tstamp_tx(skb, &hwts); + sq->stats->timestamps++; + } } napi_consume_skb(skb, napi_budget); From patchwork Wed Apr 3 21:28:42 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Rahul Rameshbabu X-Patchwork-Id: 13616726 X-Patchwork-Delegate: kuba@kernel.org Received: from NAM02-SN1-obe.outbound.protection.outlook.com (mail-sn1nam02on2117.outbound.protection.outlook.com [40.107.96.117]) (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 2B026156F27; Wed, 3 Apr 2024 21:29:50 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=fail smtp.client-ip=40.107.96.117 ARC-Seal: i=2; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1712179792; cv=fail; b=WxhLHZyHOsKC1CSS0XFQ7WtwczufEl+IAUFlPXtztzFqsETBoslFf8fxQVzU4FwVwEDMYDFxKpZsj2GMiGo+0u8WiOs87CkbN2CHcLPi5KR91xBUaNgUqmCIgMUUUkgrsnK/DOcZinwf4HA/1b8WlTUs+Z7H3wMbsoYsxTSTut4= ARC-Message-Signature: i=2; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1712179792; c=relaxed/simple; bh=NlhCiYtdLwkmc+hC/Q7dhKKn+EFCgunwTcHkbnFAQc0=; h=From:To:Cc:Subject:Date:Message-ID:In-Reply-To:References: Content-Type:MIME-Version; b=ob2zLmUjZtNDrVRHxDe+OgTpcmSG+4bzORUem4yGsNlVtwrUbzIGH4bYfZgCSIzBzkO8ElP8Evi9OkISUVLC9LelM0fZ4cq6xu2iP382J2n6lMFufEnIiGxUnfmnsXyxosU+MrJwV6f91LJTPSYA6PK9ZNFrK11CrKRAuLh9NbI= ARC-Authentication-Results: i=2; smtp.subspace.kernel.org; dmarc=pass (p=reject dis=none) header.from=nvidia.com; spf=fail smtp.mailfrom=nvidia.com; dkim=pass (2048-bit key) header.d=Nvidia.com header.i=@Nvidia.com header.b=eL+MxXMW; arc=fail smtp.client-ip=40.107.96.117 Authentication-Results: smtp.subspace.kernel.org; dmarc=pass (p=reject dis=none) header.from=nvidia.com Authentication-Results: smtp.subspace.kernel.org; spf=fail smtp.mailfrom=nvidia.com Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=Nvidia.com header.i=@Nvidia.com header.b="eL+MxXMW" ARC-Seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=lQdvANgZqpbe/7HUF4oaFSIAN9hG8c3WiL+w5qog4gsjlA8R2RG/aEYfJeVwYwOzGLVXGwrB0zvH1NhfOxoFO9Mb61uadz41md6zuzGDPCEx3y5nultdoFUXhZ7a/wynGUcZiiCyScc4oeoD2X/wIJFtn+wpSEO0la2m3EuGrEhnb0f8uan9UAoyNT1ex9JyyV7GqXOjSQR1wegMbirYjdBN6MEji5CiycQ0Xdhb4vQhHogRG307D26nAZ0GtuIgbw8pFcJcDsXSxFDcyX2LpYNq741Yx4MNGIkoLXzB4TOep1RENvmjcoKcskeGkGHOfFIX9kkuChUiBYS5Pu/lwA== 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=pJynZq47AZ51ddW8veWZuitCK5J0k25xaq8Bltpe0GE=; b=TEk1nZHyyMRF4aQfuXciP3NLr4RCjXdaDRFglhkesyFHoKS47pzux7UISJXdWzGsSuMlUn3sHSATyTxm2Iwp/T8isTl42UiJ5xA+tEQQfmJHuU5HvEGoRcFyGAM31PqTfD65kwrThGp9Moq+Wvoah8Njt3cbJszlGmyz/GK63B5kltlAMI97gm0DnbnAC7q5L7kXdPaZZDQnXT93J1rihgc3cXtc9UPl94DOIC6or5Eaw2eSHg3zD2HN6Guth/ccOzb0CY+KnZE4lkzDegcEUODgQkShq4ZWmPakkaKUnPfYmHdu0AJ3/MCp4jozA5KkIrqgSPBV/cYQTmmHftyU0w== ARC-Authentication-Results: i=1; mx.microsoft.com 1; spf=pass smtp.mailfrom=nvidia.com; dmarc=pass action=none header.from=nvidia.com; dkim=pass header.d=nvidia.com; arc=none DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=Nvidia.com; s=selector2; h=From:Date:Subject:Message-ID:Content-Type:MIME-Version:X-MS-Exchange-SenderADCheck; bh=pJynZq47AZ51ddW8veWZuitCK5J0k25xaq8Bltpe0GE=; b=eL+MxXMWNn2QOa3+7hHoImWQgKeVHRlbCEDWgxsSGCF9Iw5dxJDcq4m20A6djypQCi84sOkpDysd1c50dekyTdPrq9OYaiK5td+5wbC+aeCwUmhnv0Am1utwfdml4FyhbRPoPHnfYMN9AH5s2Q195f+pq/YSh6qwDi8+pZI2q61f4e3BixSqZCIr8AI4Ov/v/i4+gNdtTbHllAo/NsVi36gWQQww+IFezkvrqOwd2sn8hxaF7zhKQ2TldFYqEbTYmnKRAHsvZQKTp1o/R6A8SnPH7JBFa7AhoJX2H7j3q+Akdl1bokysu+FOxmjunpJTtVqh85bs2ewvvJEIWg97Og== Received: from BYAPR12MB2743.namprd12.prod.outlook.com (2603:10b6:a03:61::28) by IA1PR12MB8586.namprd12.prod.outlook.com (2603:10b6:208:44e::9) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.7409.46; Wed, 3 Apr 2024 21:29:46 +0000 Received: from BYAPR12MB2743.namprd12.prod.outlook.com ([fe80::459b:b6fe:a74c:5fbf]) by BYAPR12MB2743.namprd12.prod.outlook.com ([fe80::459b:b6fe:a74c:5fbf%6]) with mapi id 15.20.7409.042; Wed, 3 Apr 2024 21:29:46 +0000 From: Rahul Rameshbabu To: netdev@vger.kernel.org, linux-kernel@vger.kernel.org, linux-doc@vger.kernel.org Cc: ahmed.zaki@intel.com, aleksander.lobakin@intel.com, alexandre.torgue@foss.st.com, andrew@lunn.ch, cjubran@nvidia.com, corbet@lwn.net, davem@davemloft.net, dtatulea@nvidia.com, edumazet@google.com, gal@nvidia.com, hkallweit1@gmail.com, jacob.e.keller@intel.com, jiri@resnulli.us, joabreu@synopsys.com, justinstitt@google.com, kory.maincent@bootlin.com, kuba@kernel.org, leon@kernel.org, liuhangbin@gmail.com, maxime.chevallier@bootlin.com, pabeni@redhat.com, paul.greenwalt@intel.com, przemyslaw.kitszel@intel.com, rdunlap@infradead.org, richardcochran@gmail.com, saeed@kernel.org, tariqt@nvidia.com, vadim.fedorenko@linux.dev, vladimir.oltean@nxp.com, wojciech.drewek@intel.com, Rahul Rameshbabu Subject: [PATCH net-next v2 4/6] net/mlx5e: Implement ethtool hardware timestamping statistics Date: Wed, 3 Apr 2024 14:28:42 -0700 Message-ID: <20240403212931.128541-5-rrameshbabu@nvidia.com> X-Mailer: git-send-email 2.42.0 In-Reply-To: <20240403212931.128541-1-rrameshbabu@nvidia.com> References: <20240403212931.128541-1-rrameshbabu@nvidia.com> X-ClientProxiedBy: SJ0PR05CA0004.namprd05.prod.outlook.com (2603:10b6:a03:33b::9) To BYAPR12MB2743.namprd12.prod.outlook.com (2603:10b6:a03:61::28) 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: BYAPR12MB2743:EE_|IA1PR12MB8586:EE_ X-MS-Exchange-SenderADCheck: 1 X-MS-Exchange-AntiSpam-Relay: 0 X-Microsoft-Antispam: BCL:0; X-Microsoft-Antispam-Message-Info: 8SdxizOxrBAv5BwrUfjprjwslkw4ax/wXZ/+Tn5Yd0TNxFRHWi0ayccl4tlORafpASxeTBlw7REpyDApdWW5ZwJ/LaUEkNLGwcZ1mnvYxYVgyB9i8O2tNgZJH2IG5+QFvU/Nr6YMmiEWi/UK4w26tAbhenYPpCcgYMk9vY/M4L85QlcY+rFVWHKCMkQv1wmZ26UNbYTqugDQMvrM2ENe/aNhPf7XWueji6i5AC66ceU7DBvl3gYHs5k3ZtZK0CYq0epqcJRFHcwOoNDBqm65w0DfK80b9VAoyGyVKGml9/hITbOdwmWTbFsKDhLxWPv4vNRjsa8VGfW3I0K0+SP/3x4emuHzs9fjcja/6RGLL7veJuxfQaqKXN4h0WgfzSeuZzda8RM6h9GkXfdwNxvD18lpUN2RI7hrBTXFh2naLIKWj5l0tkY7xZkhWtmbDbWr7v0c+Lm7GZRrq2dxsKRrwC9+omRXwqDNbVtCKfML249nnXz3GmREkOgZCESsP/Gli/iS8xEuvm+/K9mom4s5qKRUGepyJxCx3KU0Hj4AddUg4UjmPzkfVZnGtIA66zcaXi7S/en0SWEyVsZhdxOSwXgDG0bz/Huiyfj09HrKamscd6PXqjOrVwFtZpH2SPHRNlsKpfO6OZWctXSGEyutKJkWD/uYOmAS0fWB4g2kUDg= X-Forefront-Antispam-Report: CIP:255.255.255.255;CTRY:;LANG:en;SCL:1;SRV:;IPV:NLI;SFV:NSPM;H:BYAPR12MB2743.namprd12.prod.outlook.com;PTR:;CAT:NONE;SFS:(13230031)(1800799015)(376005)(7416005)(366007);DIR:OUT;SFP:1102; X-MS-Exchange-AntiSpam-MessageData-ChunkCount: 1 X-MS-Exchange-AntiSpam-MessageData-0: RqxHZQb1hhvrHUQhbab3qVFeob2JbiJVTirbyyW23AkVO1xfxyV7mbo4gWpyeeFkg1De/GCmv43SdpH/P+SgoZCeJ/04fH3uOntN60m3GD20KbK2aflDOV56CoZv4L3BLwYHqqtG6A1pUwKOm7j1efNut+cih2dEAQgl883UGgHj4Gj+Z095HRyDT2RMgLX03trlO/IlmCyiafnJxgoRjmHugNueL37GV1SLBJQ+hZ4ZL4NYndhVWmj8skFkCSFT87K9IE17QB+3cIw8jFq7VpItsY+/WvkLfHHbbrIVDbnpVOnSE4eB6AsiyW5FkXaAldeRWsJtincxJ/vdyhEnWtFVeHn4n4UrYs2YgqESw7t5sFmV0IRxg56YFCfWQ5b97sFEGFdWD52pzg5bifWrUUAekUgnHEFuu1KTpYSgCM4+3/xO2WyoD79XwsTH0F/rqvdKMbLcpKuptRxamaq+fANFi5Za6+G73DdgVZvFVAuF6B1QadJp+88QLuk68UQ+DpQlXoErXG3fllweu1b8KFpzLPj785xZe/ndIafcD2fVrBAN51HzHqUgFFRhg5A/KyOiGLtL0Dtdf5F9Fhg32xiNHp0BPNbj7PgIe6kugrljrdlCjcbCVvaQWi5b7T6NM0rUp6JWfnEu6gsWxpM8hna6Is523xzg4hs9dUG/+oELpHQQYFGctj+WhbtgUJqX3fcw6WJuYn7e/47ktEL7lOgyxAQYP5OKj9mETlbVm44btyaIVdvAS55uX9VuDgeT2YSWn9zulbc9uP0t+ZMz77NEi3uPZE8bhgHFF21Pe9nfLtfBSdCiSviXHT1YXg17tvOXLk9OANpBzVSdH6gJCfKPHzb1CC1SdoWJ5tFq7jiMm3nbeE+wScn2/ncTihVn9mT4kw7/phxiA0qxlqBZnTcInUX1nHhNE7a17MowKWU5z1yWAj5p6xVqOohlzCfh+qN/aEHtoHIW29fiJU4Q9PmFZEJU5tyh9aP2gnJlaM8TeEsrayAa4HDnvp0BfMd5iuCk415UfmIh8fWZ0+0FwvXBKdD0CyRy2XedH4X8b/Cc8XC8bick5Xo3XCIq3DM0QZeyW7mz1JNGfn/LYC6cRHbXo5uuQkJM8tdL7QklSOsR46Op5pZ+tsun02IiV8oNK/ZyR75SHLrK+MiNYlJQIMDAEVIYpavs+Zg/5KowmnHsBlaYhsfsq4gnTHNXTDLOXdlm+y/z4kElVhoVWHYQWSYtz0UGv8sneXWISwMDMC7GhzTOCXAiQkQ3FWjHtZK4tNzDYa9+NB9ch55Jj01pnaMsat1xUUaS63KL3KcoNKitgQNcMbxQVUk/5DIIqe6Kgs1ECAEqZU1Skb+1g0cCUTbqN1HcH4K7SgWGVSg1WrJqdoDKtOIa2h4CLg/u6Nt8cB7X+j0ZY6oof8MkVbWq7SYvoFKSVz9n2E9QHq4rXLYFkiATLB/6kN1bwyx2G5STqNTEpKof4Nghbw24SPWwl50lPNO0SxxI99v9m+cVvIeC7jUFD0dWxup6jRnsuPIoRGMqb1R25Hix7OiudWd7TN9Qc8JEHYMTUs0nK6+NmA2UDfj+1nBJokj5AO6ipBvbqWyRptJw5KRyFaLNSlPmTQ== X-OriginatorOrg: Nvidia.com X-MS-Exchange-CrossTenant-Network-Message-Id: 4d219ca2-f8fa-4c81-8d1e-08dc54252b5f X-MS-Exchange-CrossTenant-AuthSource: BYAPR12MB2743.namprd12.prod.outlook.com X-MS-Exchange-CrossTenant-AuthAs: Internal X-MS-Exchange-CrossTenant-OriginalArrivalTime: 03 Apr 2024 21:29:39.9305 (UTC) X-MS-Exchange-CrossTenant-FromEntityHeader: Hosted X-MS-Exchange-CrossTenant-Id: 43083d15-7273-40c1-b7db-39efd9ccc17a X-MS-Exchange-CrossTenant-MailboxType: HOSTED X-MS-Exchange-CrossTenant-UserPrincipalName: DL6ZYRZbofNB6XCkwqLvbVWAHK1FEg3tQFn8h8RUbyywIU0MYpMa0lOOcgVK93YlwKhetU/xGPPadISw7keTcw== X-MS-Exchange-Transport-CrossTenantHeadersStamped: IA1PR12MB8586 X-Patchwork-Delegate: kuba@kernel.org Feed driver statistics counters related to hardware timestamping to standardized ethtool hardware timestamping statistics group. Signed-off-by: Rahul Rameshbabu Reviewed-by: Dragos Tatulea --- .../ethernet/mellanox/mlx5/core/en_ethtool.c | 9 ++++ .../ethernet/mellanox/mlx5/core/en_stats.c | 45 +++++++++++++++++++ .../ethernet/mellanox/mlx5/core/en_stats.h | 2 + 3 files changed, 56 insertions(+) diff --git a/drivers/net/ethernet/mellanox/mlx5/core/en_ethtool.c b/drivers/net/ethernet/mellanox/mlx5/core/en_ethtool.c index cc51ce16df14..d3b77054c30a 100644 --- a/drivers/net/ethernet/mellanox/mlx5/core/en_ethtool.c +++ b/drivers/net/ethernet/mellanox/mlx5/core/en_ethtool.c @@ -2381,6 +2381,14 @@ static void mlx5e_get_rmon_stats(struct net_device *netdev, mlx5e_stats_rmon_get(priv, rmon_stats, ranges); } +static void mlx5e_get_ts_stats(struct net_device *netdev, + struct ethtool_ts_stats *ts_stats) +{ + struct mlx5e_priv *priv = netdev_priv(netdev); + + mlx5e_stats_ts_get(priv, ts_stats); +} + const struct ethtool_ops mlx5e_ethtool_ops = { .cap_rss_ctx_supported = true, .supported_coalesce_params = ETHTOOL_COALESCE_USECS | @@ -2430,5 +2438,6 @@ const struct ethtool_ops mlx5e_ethtool_ops = { .get_eth_mac_stats = mlx5e_get_eth_mac_stats, .get_eth_ctrl_stats = mlx5e_get_eth_ctrl_stats, .get_rmon_stats = mlx5e_get_rmon_stats, + .get_ts_stats = mlx5e_get_ts_stats, .get_link_ext_stats = mlx5e_get_link_ext_stats }; diff --git a/drivers/net/ethernet/mellanox/mlx5/core/en_stats.c b/drivers/net/ethernet/mellanox/mlx5/core/en_stats.c index a06c6c80e36f..d8cf1fe99fb0 100644 --- a/drivers/net/ethernet/mellanox/mlx5/core/en_stats.c +++ b/drivers/net/ethernet/mellanox/mlx5/core/en_stats.c @@ -1172,6 +1172,51 @@ void mlx5e_stats_rmon_get(struct mlx5e_priv *priv, *ranges = mlx5e_rmon_ranges; } +void mlx5e_stats_ts_get(struct mlx5e_priv *priv, + struct ethtool_ts_stats *ts_stats) +{ + int i, j; + + mutex_lock(&priv->state_lock); + + if (priv->tx_ptp_opened) { + struct mlx5e_ptp *ptp = priv->channels.ptp; + + ts_stats->pkts = 0; + ts_stats->err = 0; + ts_stats->lost = 0; + + /* Aggregate stats across all TCs */ + for (i = 0; i < ptp->num_tc; i++) { + struct mlx5e_ptp_cq_stats *stats = + ptp->ptpsq[i].cq_stats; + + ts_stats->pkts += stats->cqe; + ts_stats->err += stats->abort + stats->err_cqe + + stats->late_cqe; + ts_stats->lost += stats->lost_cqe; + } + } else { + /* DMA layer will always successfully timestamp packets. Other + * counters do not make sense for this layer. + */ + ts_stats->pkts = 0; + + /* Aggregate stats across all SQs */ + for (j = 0; j < priv->channels.num; j++) { + struct mlx5e_channel *c = priv->channels.c[j]; + + for (i = 0; i < c->num_tc; i++) { + struct mlx5e_sq_stats *stats = c->sq[i].stats; + + ts_stats->pkts += stats->timestamps; + } + } + } + + mutex_unlock(&priv->state_lock); +} + #define PPORT_PHY_STATISTICAL_OFF(c) \ MLX5_BYTE_OFF(ppcnt_reg, \ counter_set.phys_layer_statistical_cntrs.c##_high) diff --git a/drivers/net/ethernet/mellanox/mlx5/core/en_stats.h b/drivers/net/ethernet/mellanox/mlx5/core/en_stats.h index 3c634c5fd420..7b3e6cf1229a 100644 --- a/drivers/net/ethernet/mellanox/mlx5/core/en_stats.h +++ b/drivers/net/ethernet/mellanox/mlx5/core/en_stats.h @@ -126,6 +126,8 @@ void mlx5e_stats_eth_ctrl_get(struct mlx5e_priv *priv, void mlx5e_stats_rmon_get(struct mlx5e_priv *priv, struct ethtool_rmon_stats *rmon, const struct ethtool_rmon_hist_range **ranges); +void mlx5e_stats_ts_get(struct mlx5e_priv *priv, + struct ethtool_ts_stats *ts_stats); void mlx5e_get_link_ext_stats(struct net_device *dev, struct ethtool_link_ext_stats *stats); From patchwork Wed Apr 3 21:28:43 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Rahul Rameshbabu X-Patchwork-Id: 13616728 X-Patchwork-Delegate: kuba@kernel.org Received: from NAM02-SN1-obe.outbound.protection.outlook.com (mail-sn1nam02on2117.outbound.protection.outlook.com [40.107.96.117]) (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 E771F156F3B; Wed, 3 Apr 2024 21:29:52 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=fail smtp.client-ip=40.107.96.117 ARC-Seal: i=2; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1712179795; cv=fail; b=n/JmH84EuWZyfbJ4h2WDXcPUBr13L1K0qyv09wEJjs/6myrq2jCHPnOYkaD928Rx1yGFm3oC3eDP5T+9NNb7m5WKzGrqL17GdHSVXg3aS2rnEOzxrB22W9BubOi9LyCLFMeUEfPH+NUR1l+HzHtWmalNT0yfF+7Q7z7JvUYzXdg= ARC-Message-Signature: i=2; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1712179795; c=relaxed/simple; bh=i37RrI0Yfd+qpbhqvBQb0KwqxFEgy6CsR2rSzcv5NG8=; h=From:To:Cc:Subject:Date:Message-ID:In-Reply-To:References: Content-Type:MIME-Version; b=Dg9go6ZxFgO7TrLm3IpmPBhzcnRVRE1pR1VzIy6j+8cvBhrOQ1z2PsfLEzCFSJ6XHJHjyMjkOclIhxEN6swcC6BGlxXwHwNuaEnqo6Fjl31XqtmdgF6c1DZli++UCHBKNcYHKzaYhahdQYjZy6Jv9n5Uh4xPRgdmonmaab8yiEs= ARC-Authentication-Results: i=2; smtp.subspace.kernel.org; dmarc=pass (p=reject dis=none) header.from=nvidia.com; spf=fail smtp.mailfrom=nvidia.com; dkim=pass (2048-bit key) header.d=Nvidia.com header.i=@Nvidia.com header.b=eUxuJd75; arc=fail smtp.client-ip=40.107.96.117 Authentication-Results: smtp.subspace.kernel.org; dmarc=pass (p=reject dis=none) header.from=nvidia.com Authentication-Results: smtp.subspace.kernel.org; spf=fail smtp.mailfrom=nvidia.com Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=Nvidia.com header.i=@Nvidia.com header.b="eUxuJd75" ARC-Seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=kMvj8Q7dB6vTqSENFLy/+8BOcws4YzQjywnA7hDSPPWWVfTTVNlNKzHymaRaxgSeRCEvRZnWEUIqt1BMuV833OdSfQKEpCExjD7B8nL45dSdflLemhJIV+3PSZejO8zkL6whbZmLXhYzkT7mx3FC+0SIBCnRPCKvBghfFeGBPvJZnWtILm0b0Dm8IGsgD2cZ6ZsGeMWVeWBlx9JH1tt238UGmoP/JqEC+wtzMa03wbp/F9uapaZh5TsRKiaBwhyDgnWLJ6wy7R4VFf7dg09gE7AZOg0pBYyFjAPSPCTWweGPvD6850/3oWDQ2q7J8IzKG6s4iKiUJt7ehvLX8GoF9g== 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=1bZiNK+KNKQ4yMz90KgKJ+Sq/gR08XGQsI5wDFJnBIQ=; b=lXWf5PmbLr5VEmZT6WX+pBeWNQlet0Rv9NRE3eATAfnZ/85NSjpOzVBS1bwNIEdmuh/gw3/AiBuMdlUOtkK3iOLHOTPSeavmBULEXpbMv2edJKOgWe5dEWt61KIbCA8E89z0Qt2v5VKfphJQYgbISiY199kx+O4O0VFeKQbHCP4T5amz+FPUA5Upq7GF3DJbj3NWb3v8wcyrE/3/BNl9OGgYKnuJUItWA9jFxkGF1xEYjx11Gh1vG31gbPplZWD6MDsamhiCCrBOkxO/TuQ2Aa45J+WrpQ5wmRo6PQ4HM73FwN/VcXwRV0c+ReOERko4adcIUrC1YjjfsXzE4UYR2g== ARC-Authentication-Results: i=1; mx.microsoft.com 1; spf=pass smtp.mailfrom=nvidia.com; dmarc=pass action=none header.from=nvidia.com; dkim=pass header.d=nvidia.com; arc=none DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=Nvidia.com; s=selector2; h=From:Date:Subject:Message-ID:Content-Type:MIME-Version:X-MS-Exchange-SenderADCheck; bh=1bZiNK+KNKQ4yMz90KgKJ+Sq/gR08XGQsI5wDFJnBIQ=; b=eUxuJd75JVRz/vQ9kiV4CEgJnE3l7Dgi1VISWa7DRmBN/HwbUbY7iuCvhSyAkb5cyWpdeCw5aS77Zk4W5aXX0sIymekzSTu0iy262VsVfOm/pd0uwYmT980uY8Go6ndnKVREGsJKiOu6mcf+7H8z3QJP9EI+hqyEn4uPsmx2XHwS5syYYjrwLU7JcBVJegUaORErms7rMVJa73Yxavk8LJb8uZfwoPjLMXMhgmKsv4g1Zf0d9a0MU/Knpw8EvofehjFXaKvgoU23B1dYQbHH3ZMjZFDWffl/rGtgoi2q2C9IZ92bDgg+Bf45Ip25vePDJ/gnugKTLj8P1jiI0HngvQ== Received: from BYAPR12MB2743.namprd12.prod.outlook.com (2603:10b6:a03:61::28) by IA1PR12MB8586.namprd12.prod.outlook.com (2603:10b6:208:44e::9) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.7409.46; Wed, 3 Apr 2024 21:29:47 +0000 Received: from BYAPR12MB2743.namprd12.prod.outlook.com ([fe80::459b:b6fe:a74c:5fbf]) by BYAPR12MB2743.namprd12.prod.outlook.com ([fe80::459b:b6fe:a74c:5fbf%6]) with mapi id 15.20.7409.042; Wed, 3 Apr 2024 21:29:47 +0000 From: Rahul Rameshbabu To: netdev@vger.kernel.org, linux-kernel@vger.kernel.org, linux-doc@vger.kernel.org Cc: ahmed.zaki@intel.com, aleksander.lobakin@intel.com, alexandre.torgue@foss.st.com, andrew@lunn.ch, cjubran@nvidia.com, corbet@lwn.net, davem@davemloft.net, dtatulea@nvidia.com, edumazet@google.com, gal@nvidia.com, hkallweit1@gmail.com, jacob.e.keller@intel.com, jiri@resnulli.us, joabreu@synopsys.com, justinstitt@google.com, kory.maincent@bootlin.com, kuba@kernel.org, leon@kernel.org, liuhangbin@gmail.com, maxime.chevallier@bootlin.com, pabeni@redhat.com, paul.greenwalt@intel.com, przemyslaw.kitszel@intel.com, rdunlap@infradead.org, richardcochran@gmail.com, saeed@kernel.org, tariqt@nvidia.com, vadim.fedorenko@linux.dev, vladimir.oltean@nxp.com, wojciech.drewek@intel.com, Rahul Rameshbabu Subject: [PATCH net-next v2 5/6] netlink: specs: ethtool: add header-flags enumeration Date: Wed, 3 Apr 2024 14:28:43 -0700 Message-ID: <20240403212931.128541-6-rrameshbabu@nvidia.com> X-Mailer: git-send-email 2.42.0 In-Reply-To: <20240403212931.128541-1-rrameshbabu@nvidia.com> References: <20240403212931.128541-1-rrameshbabu@nvidia.com> X-ClientProxiedBy: SJ0PR05CA0025.namprd05.prod.outlook.com (2603:10b6:a03:33b::30) To BYAPR12MB2743.namprd12.prod.outlook.com (2603:10b6:a03:61::28) 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: BYAPR12MB2743:EE_|IA1PR12MB8586:EE_ X-MS-Exchange-SenderADCheck: 1 X-MS-Exchange-AntiSpam-Relay: 0 X-Microsoft-Antispam: BCL:0; X-Microsoft-Antispam-Message-Info: SpHkT7t/3Kiepobv35DCP2jusXLI8OxNwWCX61XZb2cMGky1CZgchXmJgl7uVVCdM2Q67BrwR/as3lSTuI0DpphdTNzZlrTey2vPEcKec4fiPiTk1HnR3Fw7POHQSeZL+JNXUm6Gb3aVQxFNa5YpOzwu/hhTCrY6UbhVFduP8x8lsnPRjpPYNL6nz6QrIA3l7F9p37JE5U7hPYF8VSRZ21DHT/bAefDEM3hTPY9DPzXvimp4txT9D4SdmEyPexrSaE3oLw7QsWwW+iGitgNH0vQe+lXQ/OUgqDkweodo46Qn4T0I//gGJDbksTO6Dgd27FSS3BhugBVbjNmDQIEK05moHlgJguNkK6ILX7dSneTvJRhLf6ukO6PST65lwOHMGFuBUcpQHb/d0bPb6QC2judDn4QfaMI/qoSZTwBep1YHaQadR67rTVsnUmGeXUhimpNY4gmSVbuMNsMpwCTZPolVAhThpfChS9KkGtdW9Rf6+g0zzhJtYdTc5kDyaOu3DvGxcWsrAH0AeXnQzPiSJgDoJtDKwF16+IdDRJk/nFEWIAPXYQgtMPGdnNtsLVoqO+K1d0xmEtQPauoKTutQZ+polyopKDJI7kcnJOsCt0agoyOIwR2AJfl2BtJuXkTz1YQqzBtLHojp51yt8tR2eAs5+4GgygNPszxONWGV+tA= X-Forefront-Antispam-Report: CIP:255.255.255.255;CTRY:;LANG:en;SCL:1;SRV:;IPV:NLI;SFV:NSPM;H:BYAPR12MB2743.namprd12.prod.outlook.com;PTR:;CAT:NONE;SFS:(13230031)(1800799015)(376005)(7416005)(366007);DIR:OUT;SFP:1102; X-MS-Exchange-AntiSpam-MessageData-ChunkCount: 1 X-MS-Exchange-AntiSpam-MessageData-0: 55bsp0A+DZFUp3tNdN/6EWsq/W9VYAbkbYpUo73GjacqgJA36rYf/GKnV0KW0aEiT41fEwx896q5SU/daCgTOScJA4LksT3viRnULNeb9IHtQ8Ml2XtjvEf3xFLUYSY+KHhcGMQHQQZFF9bk7C8Z6BYG4RaTnn+xLx6ZUU8iYzSp0cf4GFzb2PeOHlrnhPIRzGq8g0MdSQukrpL6SIbGStMUZRIRikshtZgekGAibiKTzDUlTjCDi7QX8clRRVp4pK6ZjE2+bwxZ0XrRfdlpBO7wX7z/9h6WxDCVciCRBNZ/+V4zb783WCkgq1+6qz1JFczPxr2DniJLNeq0UVRQwaoCLxU4APCTXMxmZVCkNYYTPqUSsEE9lRSmYZF7z400dwrldoND8yMDr/cAwGa5DpAt3pof5WC5jLoLaH/801MKAx4MQGUoiPgtHjfGKX2DQWS6NDvq8D6bFndwE70YzDUWEdkHVNUvIr9VhNvI7vD3aHNT8N+Cdnv1pPJkmN8gimUtIrLWQcMsb56Valxq/YGcJG2r82umXIHrOCkogfwBXwg8klDq7XwnT91dcxxRf6GMVqbAkcNQJlXJAZNMmfQHyncB/MMEQI4VTQNrffGbJoIJEYnILBQ7DEaQmirJTjtB7IwNgH5cshY4sp7Cpx8NnQ0z/dRx0SjZSPoddJqpYVhdGX0gSSmjQL/tn78qfV38ldjdItfAfaENL/HTl84AcawNnmDE9zqA8jjo9qb1y59gp25gMeclLfEz3c/NVKSuGX5MMPX9+caS7ttz0pzUlxvqcVhVvnHCdApwNbyGwPn6ovAhXrn94ibvT76mvVspd0bDuY+AwYp4akS63czMepvQMcsHXGZwK0EODcVyRr52kk3Je5rbdQOv0QAP3x0nTzVKZf7mCZMpBDAaLWFJo2OzvUE0i+KIDTNag1cHJQ1nTeZUSqqH0/In97oNEg53Co9/xKeGF7wO59LacbTFiP2wU3tDrD24Eqxg/5Sg4WWb5r+WhPFs88Q/J/H8nzpaOT3OjUZ94Pqpp4f9XlPDlxWo3GjgWjYRofHIh0SfUlf2qICUGU96ra8oOJ5rDGy2mX9AM7nvln31WLtUdV+5IlRZRmpz1JZ+kgqYXD2BvhQghhNyvrImSPJ0X9aTp3tFzgYEW9Ei1w9Sfg2gpbvIOrqM+LsRcHxRH84aWM+t6/6evfDQcChKDM74DxRKy0xSgArRkM70+2qgS1XJWKoMmjDN/IeIpd/9rIar91+Lp42pH3wkIVBY5ya6q5fGYP7CKeb1Nu446xIB75evNzwunIhkEnfnOng04M0ykIG/QqoruwudRmJfLTE9WLCdf2DmqHQgAXwbkSmzF6IqLBH699ALuhGG5B7aZbOUP8mCaY71sHacC7VPqRBxbGL0PeOOuzLCsPvB2TFmxUBF2FmFmTJKER+rpZYx20+uLRbGM6NHSECzyKlj22jSE8LpZ4HQQ1gRBKexO21AUj8WRF+NF1OyFJPNcV+SLlPI5mE4Li46HiJomjgsOvx02AhYowrclwgtMpZhqsJT5yFKPwqCjZBJ77k87GHVyDIkvmS4qxF55s/xn0kg+srtPfuhIWy6yYGgSd4tzDoVtz9ZfQ== X-OriginatorOrg: Nvidia.com X-MS-Exchange-CrossTenant-Network-Message-Id: d617e90a-83f2-4fdc-1c0e-08dc54252bcd X-MS-Exchange-CrossTenant-AuthSource: BYAPR12MB2743.namprd12.prod.outlook.com X-MS-Exchange-CrossTenant-AuthAs: Internal X-MS-Exchange-CrossTenant-OriginalArrivalTime: 03 Apr 2024 21:29:40.6332 (UTC) X-MS-Exchange-CrossTenant-FromEntityHeader: Hosted X-MS-Exchange-CrossTenant-Id: 43083d15-7273-40c1-b7db-39efd9ccc17a X-MS-Exchange-CrossTenant-MailboxType: HOSTED X-MS-Exchange-CrossTenant-UserPrincipalName: /B23eES0EGZeFyALx96uvqV4moIFu8e3j5WPalOTPRzyBob1k5xPaCraS34f5cDFoE2QFVj26qxHC2bWTMAQXw== X-MS-Exchange-Transport-CrossTenantHeadersStamped: IA1PR12MB8586 X-Patchwork-Delegate: kuba@kernel.org Enable specifying header flags using enumerated entries in the spec file rather than raw flag values. Suggested-by: Jakub Kicinski Signed-off-by: Rahul Rameshbabu Reviewed-by: Dragos Tatulea --- Documentation/netlink/specs/ethtool.yaml | 5 +++++ include/uapi/linux/ethtool_netlink.h | 11 +++++------ 2 files changed, 10 insertions(+), 6 deletions(-) diff --git a/Documentation/netlink/specs/ethtool.yaml b/Documentation/netlink/specs/ethtool.yaml index f5aa1e7f3383..bae3bb013787 100644 --- a/Documentation/netlink/specs/ethtool.yaml +++ b/Documentation/netlink/specs/ethtool.yaml @@ -16,6 +16,10 @@ definitions: name: stringset type: enum entries: [] + - + name: header-flags + type: flags + entries: [ compact-bitset, omit-reply, stats ] attribute-sets: - @@ -30,6 +34,7 @@ attribute-sets: - name: flags type: u32 + enum: header-flags - name: bitset-bit diff --git a/include/uapi/linux/ethtool_netlink.h b/include/uapi/linux/ethtool_netlink.h index 8dfd714c2308..34a4a64262b2 100644 --- a/include/uapi/linux/ethtool_netlink.h +++ b/include/uapi/linux/ethtool_netlink.h @@ -117,12 +117,11 @@ enum { /* request header */ -/* use compact bitsets in reply */ -#define ETHTOOL_FLAG_COMPACT_BITSETS (1 << 0) -/* provide optional reply for SET or ACT requests */ -#define ETHTOOL_FLAG_OMIT_REPLY (1 << 1) -/* request statistics, if supported by the driver */ -#define ETHTOOL_FLAG_STATS (1 << 2) +enum ethtool_header_flags { + ETHTOOL_FLAG_COMPACT_BITSETS = 1 << 0, /* use compact bitsets in reply */ + ETHTOOL_FLAG_OMIT_REPLY = 1 << 1, /* provide optional reply for SET or ACT requests */ + ETHTOOL_FLAG_STATS = 1 << 2, /* request statistics, if supported by the driver */ +}; #define ETHTOOL_FLAG_ALL (ETHTOOL_FLAG_COMPACT_BITSETS | \ ETHTOOL_FLAG_OMIT_REPLY | \ From patchwork Wed Apr 3 21:28:45 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Rahul Rameshbabu X-Patchwork-Id: 13616727 X-Patchwork-Delegate: kuba@kernel.org Received: from NAM10-MW2-obe.outbound.protection.outlook.com (mail-mw2nam10on2133.outbound.protection.outlook.com [40.107.94.133]) (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 3EC26156F28; Wed, 3 Apr 2024 21:29:50 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=fail smtp.client-ip=40.107.94.133 ARC-Seal: i=2; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1712179794; cv=fail; b=hjt8U83e2MxuHkRBtTXE8aMp1XBczHwZFE6nHuzr5JzIJWdJ/r4oXDsCJI5w8UB9Dlzb6MqxXol8j1eqbirBWhJJbJFvmUUcMqPuWHniMqA6UAAkbRyk8R8VRQOtzzCh8iiNW43XaTQBub0BJ2rPeS/kBIOV+z8bFkmD1T3E8iM= ARC-Message-Signature: i=2; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1712179794; c=relaxed/simple; bh=WcARV9EEmygFik7TxeEZLEIAzAFkt5zRbts9fcuh/9c=; h=From:To:Cc:Subject:Date:Message-ID:In-Reply-To:References: Content-Type:MIME-Version; b=MKDz9lLeFKintKyFYEsnD0URVs0AWQnaCVmOqu19wVvSIldaxuMMWiN3cpmryXotTYvJu0iMI3FH4Fldw8nzCYNnZFoXOSnS232Sgtl/OkFF8DdTfddugfPIh33EiUMPNloDaPbnbHE5jMsyVK87eAC1s6VHrcbPi0aJzppKwIU= ARC-Authentication-Results: i=2; smtp.subspace.kernel.org; dmarc=pass (p=reject dis=none) header.from=nvidia.com; spf=fail smtp.mailfrom=nvidia.com; dkim=pass (2048-bit key) header.d=Nvidia.com header.i=@Nvidia.com header.b=S+BpDJ1w; arc=fail smtp.client-ip=40.107.94.133 Authentication-Results: smtp.subspace.kernel.org; dmarc=pass (p=reject dis=none) header.from=nvidia.com Authentication-Results: smtp.subspace.kernel.org; spf=fail smtp.mailfrom=nvidia.com Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=Nvidia.com header.i=@Nvidia.com header.b="S+BpDJ1w" ARC-Seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=kn54yxOLrZg+918IEeqGM6nKhFImeeBnoG7kvDUZLYt6qguIdN2rMPEUT4lS5ZA158GsSbjBFiqfve+PYDhrbJQeANTLzk4dH3KgWYWJpfPBGUQrSCrckcWlfQVTAPWdRgMve44lSIzhlQ35pbQN6qC7aKdKB2m3KeCmHdY+DooARlcAiwTxy3G3D/y89Mse68++3CCIufsyfhdJuBq1J/3pN+rMdjRt23wM3IMhj5GcNPxX1kZTnqO1H477QT5U5oSMYlwo5t+r7YJYBHHCuDpzMhhmoHKRMH6KvChbmWcWl4XyWTxssI/C8HP6UaJzZKWluq01u4Lci5iDnRsUBA== 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=yzu2h7owJYfaBza9LYpvZJNzfQg78YM7Kwm33ootnEo=; b=T8JgjBCBOCIRpuGgjCmZHyGac7BPHfWw2L7ozNxUc/dLeqoQ5wmShmUipH2PSgjuYTDZHt4vUfOtWSul/gsbayFJ8St+XSCmEdGTrPIlnY6LGJd2tf2SwVH7jVQc4HsQQ571nFhIpLIx2vToMApPenOIzG5MQXoDChhc5e08DTFCEclYhvyQTYbDE1ukWeKIz2abfeIxuqEvgCGZhxDJUl2Y+R10GDgsyJshjLsMGZHCDpV2KSjM69P3QNrOx+G6HrytoxDii2GEwPWog515TNL2qkGsfwoAG+dRhF3iMsEsFhGSH1sfonkIRXtlFHlxXe0tslKWPuJupuuERSBAtg== ARC-Authentication-Results: i=1; mx.microsoft.com 1; spf=pass smtp.mailfrom=nvidia.com; dmarc=pass action=none header.from=nvidia.com; dkim=pass header.d=nvidia.com; arc=none DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=Nvidia.com; s=selector2; h=From:Date:Subject:Message-ID:Content-Type:MIME-Version:X-MS-Exchange-SenderADCheck; bh=yzu2h7owJYfaBza9LYpvZJNzfQg78YM7Kwm33ootnEo=; b=S+BpDJ1wPBJbbgfW2bjc0+pAS+fcB5tkxQ/wxZCNnioicFKVuytGieTBBKi4fF1LDn0Z4KLDrHeG6yDNxzgVGJ6c5xx0nO++TAeMYcLBQyJrGl1YyfdDZvlAANKO7FKRApjnyIz/IESpUBZPoSP5JOoNspRnlTQL0cX6xjW/8wFJEiQYuRrr3rXDZp9Xm166qq0Wby7Uzs/pO7AqHAEC8++/zE0CyYYZ14H4FOJHcFR7txQcdFROhVfMegBeTTpb6UxN21mk2FOp6b/CR71ZJGrrs0lRsLCVIG/9dcMmIYHYDIC4kzv+D4QxlaKD4U74BjnWfLTxZbgDmFtA9FmAPA== Received: from BYAPR12MB2743.namprd12.prod.outlook.com (2603:10b6:a03:61::28) by DS0PR12MB8317.namprd12.prod.outlook.com (2603:10b6:8:f4::10) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.7409.46; Wed, 3 Apr 2024 21:29:48 +0000 Received: from BYAPR12MB2743.namprd12.prod.outlook.com ([fe80::459b:b6fe:a74c:5fbf]) by BYAPR12MB2743.namprd12.prod.outlook.com ([fe80::459b:b6fe:a74c:5fbf%6]) with mapi id 15.20.7409.042; Wed, 3 Apr 2024 21:29:48 +0000 From: Rahul Rameshbabu To: netdev@vger.kernel.org, linux-kernel@vger.kernel.org, linux-doc@vger.kernel.org Cc: ahmed.zaki@intel.com, aleksander.lobakin@intel.com, alexandre.torgue@foss.st.com, andrew@lunn.ch, cjubran@nvidia.com, corbet@lwn.net, davem@davemloft.net, dtatulea@nvidia.com, edumazet@google.com, gal@nvidia.com, hkallweit1@gmail.com, jacob.e.keller@intel.com, jiri@resnulli.us, joabreu@synopsys.com, justinstitt@google.com, kory.maincent@bootlin.com, kuba@kernel.org, leon@kernel.org, liuhangbin@gmail.com, maxime.chevallier@bootlin.com, pabeni@redhat.com, paul.greenwalt@intel.com, przemyslaw.kitszel@intel.com, rdunlap@infradead.org, richardcochran@gmail.com, saeed@kernel.org, tariqt@nvidia.com, vadim.fedorenko@linux.dev, vladimir.oltean@nxp.com, wojciech.drewek@intel.com, Rahul Rameshbabu Subject: [PATCH net-next v2 6/6] tools: ynl: ethtool.py: Output timestamping statistics from tsinfo-get operation Date: Wed, 3 Apr 2024 14:28:45 -0700 Message-ID: <20240403212931.128541-8-rrameshbabu@nvidia.com> X-Mailer: git-send-email 2.42.0 In-Reply-To: <20240403212931.128541-1-rrameshbabu@nvidia.com> References: <20240403212931.128541-1-rrameshbabu@nvidia.com> X-ClientProxiedBy: BYAPR11CA0072.namprd11.prod.outlook.com (2603:10b6:a03:80::49) To BYAPR12MB2743.namprd12.prod.outlook.com (2603:10b6:a03:61::28) 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: BYAPR12MB2743:EE_|DS0PR12MB8317:EE_ X-MS-Exchange-SenderADCheck: 1 X-MS-Exchange-AntiSpam-Relay: 0 X-Microsoft-Antispam: BCL:0; X-Microsoft-Antispam-Message-Info: ZUMytboxh5Fwq1TJtTh1BVuMIzbrPGtxpRHwwHmnJ/1aFxQ3L12mhpv3Uo8UIMgbj6IFu/BtcOs3yUiokPIc/Fwuk82twNJqmbCG3HjRUQT4lLZEHVY7kfhujTCtovkjH7xQ9tToOSpOHlofvm560/bTHglvB4p5TTfDqj3h24G/YbHvyODkDpxAe4EGqQnD2k1K9K/Nw8u12BpfN41QZcpc+ok04vCFzvsPrCS+MmzPY46ncrpu1DJFJs4OhM35JlwHUI7nEWFXl9HeyVGrfwfOOnDQYIVLfuF+MKDtfUMdXIaAFCVsjzCSweGAPpF6VCnhHD0b12B1wnt5pfRLYXp6lN6alsLpIkR9+vTK+zhk2KTuETCJLeCW9RA9H9BePvX26c9XXS5EzTNzPFk/+EzWOb0EjqhzUQfE6rtcECBW24i6q/7sztkHfbspXb2zACAxiWCzkAJKVmAk0AJSG8wWt+dqrwZlSTjyrRgez/3UUKrQpWBnKengy5G/b9dp8vKxQgJrwHhIYoQ5LzDxmRerhqgkdp5Hnak7Nn7abrppgAb0NgqutxNJXOauZPqbSa0yfNIyKDhKT0/wd4YQiyr1dhrD4r2mw2Cz+oMpPXpjgEtIl4ZVQaDCI+VW3oAeB0syKM8F/0WkVhi5mWTilc/qMIVz7Dqpl6UKfSS7RT8= X-Forefront-Antispam-Report: CIP:255.255.255.255;CTRY:;LANG:en;SCL:1;SRV:;IPV:NLI;SFV:NSPM;H:BYAPR12MB2743.namprd12.prod.outlook.com;PTR:;CAT:NONE;SFS:(13230031)(7416005)(366007)(376005)(1800799015);DIR:OUT;SFP:1102; X-MS-Exchange-AntiSpam-MessageData-ChunkCount: 1 X-MS-Exchange-AntiSpam-MessageData-0: U/KSOzFYycLncG0Adi2zrSZPJINXEQaLp3lRqMcIVGaOxlOiQ/OZqGkNsx5ID22kjIYkuvvCXJl6kccNNG7PnTs6sAqPAy/4xa67ab+DS/8VR6jb+SN454Sdv7AyDt4XoLZCOb8gdMlQwF+MgKftmbjSWCNRyRYXrmGWDkmHPZ14oCW19ZeAlUOp/ZSToXjksfI2JLouNwQK5hiOH3AvmvtRE8XrOFDmOitFU6KZNzI+oWGZ9ktOizRTqGsmDArImiAqOYSismr29sI+qW9QtYdH53+vp/nGNz3EzANZTCornvgll98XueyrRwNfxc22Vujfj1A4/Bo06FTJ1r3K3vQig90umr45eCeZbIfkRKG544CT8phE6+xxh+yktxATBzi/dHLYB/rpBznxMCKBuYGPs+j5GXLN3T7Ll1u0xH6iPuAf/OaPr6Qe+DfK3arfXel0rcEfUHYZ+fxthFXr68+j/2z6KUNGVwmQRjHdLuljVQumToTcf0J2O7dnQPMti918mrs8lfYuIuZA0XANNmG7u1ayyFHTDMsV0hBWSfgfqXmkniE8D/9KkRt+34eZn7uSFqlBit9itWQZSG29eTg3fdJ3eC7SdMS+LpdpqcK2Hj0POvOn/EBT7J6aBfpr65XM2y7JPMpmdxB7uGv1N/tO+u/X9GKxf+AZ221KWIRdQjJX1mH2OrR9HX/yEzVQ4jqYGzrov832/Kgt6wwnsQ7Vdjdq6YRp8V0LzDXyWxHno5fO7K9GOixZYdbSWrZiUSokgu5ow8CEvSUOv+lO1NTiUUfv+WWptOIS82jMwYRoPNWNJhV6v+TgXJy4zpf+ln/LJ0Sg14mqbzyscq2woxoqewAPNlWoifba8IeG1oe39zwfmc7CodVPxiR27emGWEDLEJZND3mdUfwq1JGsZeliG8hgLKlM7pSvSN8LPgZjFivdsM4gu0cCXzRv28+4oH2UyrH8Ec5v8/BOB+2AP3xu/rYvpU1n2A+H1NIdgYhEagYwPP2pOYFd2IOswDZ9RAeEVDwEEjfghfhmoc5Ho7GTei0QgCsH5CsQY9X4PGL6jTF13uaQSEjLv+39SzO7DSXxL+VjR8/OrXhkRHeU+t1haUwT/elq6pubO+cc1NDIilYQAZ4Ys4Ov0xmH6F072QqbMh4LohYHzCLd0grIdr2TOFQ9ZivACaKBhnBx9+qJUUzHgPMr5qgWEeJxiQZ69D0feH6px18R8i0xJUtO9DQzvQXWgAu/LarS4NywXNG6/EXnW66I9OCVgiBpY49CXrYhvko/MOJzA6yxfWKG/Xh5qzH0tnXM36qZPngyf9MpHi1wVsCJF6gFLVpbgwSlpFAvdYCvP6b1QhmfDYDTcJUH9hJc4wYECuLVqNrhbjKwqNQXdHJ102Oo4umxbkqF4zDdBK+jVpOVkJLD4/ujsPuQJhoNkEemCu82YWQOxoMQ70t8VA3l6AhRTgMJifcbm7ipoyYJD0eduqOQ4SmT9oAU0HXPBEZF+gnMOg6nwNVqAN7BAEwBYZMvb9S2MZZqb+RAIAZ2u27/A6GIw6aTAv6N8lQ8xl//9dfC6mc8X9TVbRfmp75JNoB79XlZf6X3SLUHaZ8ZfYyIaoxp1lFF7w== X-OriginatorOrg: Nvidia.com X-MS-Exchange-CrossTenant-Network-Message-Id: f2d2db69-b335-43ad-24f2-08dc54252cb2 X-MS-Exchange-CrossTenant-AuthSource: BYAPR12MB2743.namprd12.prod.outlook.com X-MS-Exchange-CrossTenant-AuthAs: Internal X-MS-Exchange-CrossTenant-OriginalArrivalTime: 03 Apr 2024 21:29:42.1222 (UTC) X-MS-Exchange-CrossTenant-FromEntityHeader: Hosted X-MS-Exchange-CrossTenant-Id: 43083d15-7273-40c1-b7db-39efd9ccc17a X-MS-Exchange-CrossTenant-MailboxType: HOSTED X-MS-Exchange-CrossTenant-UserPrincipalName: E7O9mPw6b469gSPb702W4fmrpDNbnbIM1UR7SxlWow0R5REyufwYc+aSYrMLpoyTDyc5cOJdJL+ivFXTJeiMOQ== X-MS-Exchange-Transport-CrossTenantHeadersStamped: DS0PR12MB8317 X-Patchwork-Delegate: kuba@kernel.org Print the nested stats attribute containing timestamping statistics when the --show-time-stamping flag is used. [root@binary-eater-vm-01 linux-ethtool-ts]# ./tools/net/ynl/ethtool.py --show-time-stamping mlx5_1 Time stamping parameters for mlx5_1: Capabilities: hardware-transmit hardware-receive hardware-raw-clock PTP Hardware Clock: 0 Hardware Transmit Timestamp Modes: off on Hardware Receive Filter Modes: none all Statistics: tx-pkts: 8 tx-lost: 0 tx-err: 0 Signed-off-by: Rahul Rameshbabu Reviewed-by: Dragos Tatulea --- tools/net/ynl/ethtool.py | 11 ++++++++++- 1 file changed, 10 insertions(+), 1 deletion(-) diff --git a/tools/net/ynl/ethtool.py b/tools/net/ynl/ethtool.py index 6c9f7e31250c..47264ae20036 100755 --- a/tools/net/ynl/ethtool.py +++ b/tools/net/ynl/ethtool.py @@ -320,7 +320,13 @@ def main(): return if args.show_time_stamping: - tsinfo = dumpit(ynl, args, 'tsinfo-get') + req = { + 'header': { + 'flags': 'stats', + }, + } + + tsinfo = dumpit(ynl, args, 'tsinfo-get', req) print(f'Time stamping parameters for {args.device}:') @@ -334,6 +340,9 @@ def main(): print('Hardware Receive Filter Modes:') [print(f'\t{v}') for v in bits_to_dict(tsinfo['rx-filters'])] + + print('Statistics:') + [print(f'\t{k}: {v}') for k, v in tsinfo['stats'].items()] return print(f'Settings for {args.device}:')