From patchwork Tue Apr 2 20:52:01 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Rahul Rameshbabu X-Patchwork-Id: 13614596 X-Patchwork-Delegate: kuba@kernel.org Received: from NAM12-MW2-obe.outbound.protection.outlook.com (mail-mw2nam12on2130.outbound.protection.outlook.com [40.107.244.130]) (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 E993215E5A6; Tue, 2 Apr 2024 20:52:58 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=fail smtp.client-ip=40.107.244.130 ARC-Seal: i=2; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1712091180; cv=fail; b=B3jSnKFSeIb+foUz8J9Bjdj2qBs3kW/r+kYpltk0wc8GRPFGIi6w6jRyxDmAXxpHsU+3a6MgPiONMVgyBclMSDI/u+XJaT6QlWh2JPjWuWw5N3SQ3UUuAt1FWEvsxFPRjKI5U1zbId2K05UjAAtwJeX5YMGdHY1xPgdPOXmN+SM= ARC-Message-Signature: i=2; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1712091180; c=relaxed/simple; bh=j6stmcY22YZ0xweGD3iFWeL6dMCnH8/BRpBH1YzqmaE=; h=From:To:Cc:Subject:Date:Message-ID:In-Reply-To:References: Content-Type:MIME-Version; b=goZZ7q907F26uEVZk2cmqKZO9uPAxt7Cc9CekrC+yokvo3Y64fnGQakQ67pul3DjUBkak9kUItk5oXlsF4YBxQfP243T35DHUc465KRufiScgF6qeKGT4u2Y7TB0l57ugqgbbFD6DXfwnQn/+VRdWswT58Je1UqnBSOzWJZa34E= 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=ZyVaUReg; arc=fail smtp.client-ip=40.107.244.130 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="ZyVaUReg" ARC-Seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=N0tTRhcKfvLFiSLYpodR3t8tfKqaH0Yoh1vc1BGL9rP9kFBBCPXxcnXMuJ097O4jC9QYUqUFseaZRDbPQnK9Zx6hQw63C9l4ZPvoQPJOWqi5aw2vrWwQtS2kV0JCAbPFdBv3NziLw4Stk8w+4F3xeOyt7c3j9OlktJc4P1rr67bJR6k1EJIoWjPjQBSMg9/N/QOLmaSAKvyVaq1b/qqV71bugWzKsmxFPWrst5UqDfplUGtKq8Je6RbBf6rVVXSghMtYG9GFnZxyQmAXazPC6Ggl+2FY3fZU7ZSqLcNoOR1Ijw/F0qaswWMX7xxM2hszrFCuvlGXw+deDIJPS8dLVA== 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=+53jNI38qiikc0vyHelGLzbgxCEV/EElUoregCyvTGQ=; b=QArp/1Q46ICFyjGYlO1rOWvFZhQ+/74DUhYLkUn90ucXDRNI+3fOKj8gJaLF8iH4oP1YlLzP5lzUqcWtRNfAIV6HiVC16+kcBy0KMkqxs9RKYL3DIgAiT4z7s3Yyul30riRA1d4ZY1PaWcnaA4HdQhYKZeDoz+Ot3Ha61GwUog1ZAfZGzBz31CF4Zobg0kLLooj89DSzmv7Kz9UkdXMJPosLGwGjn9MChv9uC8644/Zu//kG/vscGeY7lhQP1bwYc0Odp3oIOsaquNIr4mgizxHjeVIroVwVdAPrQRPGLsDccw2355PFcN1Atybu7AVle4Ssu3TNHQ9JwPi2rF7ZSA== 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=+53jNI38qiikc0vyHelGLzbgxCEV/EElUoregCyvTGQ=; b=ZyVaURegBO19WaCTGhAELxHW1Eqn3a+VtGLYfne5e3RspcBpibKrDJ9X37gU3d2AqyWb7lKBIuYgWb51WQxtylT9dPRs5IicY/+FZgYn/YrFY6zl1asL5cDWqBNqlhjKRIx1dKKSpfI+XzQhvtoojJoQZkYWUlpizVAKsWsJjDKtUe/1QyYb/k59YTgJP6R8TbyXD5Gi540dgdhyIycmsT4xvRQLifjGsx5whxcsm/wQP0KjbuxeVWAK4vaYxoT2jXQsZHOhH1ZX0x7F5kAMswxdWk3HS6gqdkoApxDQ22idoDZQjdSikm8hJv7I6Aw2Y7Q1fBL0lifewd+bmUdWTw== Received: from BYAPR12MB2743.namprd12.prod.outlook.com (2603:10b6:a03:61::28) by MW3PR12MB4393.namprd12.prod.outlook.com (2603:10b6:303:2c::22) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.7409.46; Tue, 2 Apr 2024 20:52:27 +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; Tue, 2 Apr 2024 20:52:27 +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 v1 1/6] ethtool: add interface to read Tx hardware timestamping statistics Date: Tue, 2 Apr 2024 13:52:01 -0700 Message-ID: <20240402205223.137565-2-rrameshbabu@nvidia.com> X-Mailer: git-send-email 2.42.0 In-Reply-To: <20240402205223.137565-1-rrameshbabu@nvidia.com> References: <20240402205223.137565-1-rrameshbabu@nvidia.com> X-ClientProxiedBy: SJ0PR03CA0285.namprd03.prod.outlook.com (2603:10b6:a03:39e::20) 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_|MW3PR12MB4393:EE_ X-MS-Exchange-SenderADCheck: 1 X-MS-Exchange-AntiSpam-Relay: 0 X-Microsoft-Antispam: BCL:0; X-Microsoft-Antispam-Message-Info: QACBuQBVNwYdsvLChoNoXMQLM8BxxIYDo9/c61viO/4Njr4LinLfzlaczRvtxn16D9NPFt1X4WOlYjlo3Kfot2MhXoirE60q4vS5qjnUtcTNvMsFAraQB3FgWz+SLmCoft7GZDh8pbYwnEmr7TIkvKN76Ow6NVwX/U0xz6VyUQ2U6azPM22gMs03C/S82dUcHVeccchoKpDWzRqCNRVl+3SD2BkCc2HNi3mMQY0C+5p45vjmnEtfmAppTZUb+H5+DzKksTdo9hVufFVxfRseXzFo9qjGFCrRIHFxWa8RVGVMuLaxetJ+UZ2AmQZX+AOuQGSOUCkbeRzKb2XnG2mqyvGwK9IfJl7IpLzeCmoUYVxoj9rDjMDM0+ZhPvEOCcwczZnEvB0Bj+6aGzheC2Gn0AlRMbjOJJDBosVW7T7kWdmG5sz3tn2MKin4yromkbEdjXnDPj8KBvLx1OhpniBveBY+6tIibswqTFspWlcJTuCwVBLcgjWAY97FUQ2oC8QRb7YHOmyoBvUQ391NYiliJ5FeGbuKQkbexvDGEsw+tc6akjQfMn1Hxlm8KFr/o0ePV7mlomzOD2wlIw1NrTGLijqUm0CKG/96kXm2uIAixEUusLnCjOrGRZrhmvVuNVi0G947Vem4rPWa0E2Mq1VAIg== 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)(376005)(1800799015)(7416005)(366007);DIR:OUT;SFP:1102; X-MS-Exchange-AntiSpam-MessageData-ChunkCount: 1 X-MS-Exchange-AntiSpam-MessageData-0: hccMaao0kLALirdvrx3YjTQjy6Vcuq7BwTESz850p3ft4sY3IP9tgCjpoOmFRdvFqU3oBOVd+HS44OMPulT/lR7T/PmtM5xxMehZN35YDIVHKfKNpX58A4A/p1HvBPOfc4Tml2/tYsP+SwPqzn4EgJpmwi0UIZ4CTl3heswTReo/UK8/8GLnYBXgianKtpK0EVZutwSZKeG7EjxBS1uZ1Re8prFT9cFORCh60DTjFrvgZGhAOfAKY3pir0k/GO8E+67zQrYSFCBxiSFE+BSfH/LuwxZgpiElTqsHpnkIKi0ylhPSQ20Ma0/hg5Sl1a1ZH2ah1V6KCVLD3vFxr8z6Xo19SC8zGXMK67f+HUmAUwNmyHNzs9iRhTmPRnb88nCK2ZfKbs+7Bb96XVkKlUaq9jQ7UjHEBGlSR9y2XDzu1DU8G0Zoi7qihh46reqKea4PRlb+24TbSkVwW4H4weEvUQThRC5U34pzTevU1aPPukbjqfM45T1Yp7RvGCyp/5HHRQf0Ztobc5RlXXfiUzDw38sCxJbGsDjeLSgswza0z0eJy4wezDxIcwQucbAAZbtqY+XTseCrGKoe52BTo5Zjo8P4df3/o+2CRYXEtPZpIeQ6c6SQVrU/GIKBWScQ364LPbG77EtRUk9bhg+wPInJ+w6QNccVgrg8xTz1yKYMMLZC2LmW7NziBmWY2wG5v4/1HxFOXIGGoByLcPVhNUIfhAkTn32X7dy1obAPkZ1e7Q9zz7yAXN3/zi/AIIkRsH3eP0SWJur5z+A8y4UNPI2xDXZsgBrxov4c2QvTlMVdRxJg6iFO54xFK9damVdVRnoi8OMEWktHrB1zACTdiw/mdXnokbd35APGumbx5jCcFT7nGlldPsKKIR9sdK7D4dMx6THTUnlkO7YLsnxJlKcJW36tj38tlnAYTuBzEwZrVmNz+AYfgojNaKfsGUkJFFd85NHDeJcOnEKEPQOR0A52BXAdFtAUiskTj4MCaqR9uu9gmO2ztASgyzrNkxXYUVJizOP6YfQD3sdoR3OHSCbuowfkJXtU6hKDC8i87oKRc5lJhSahu6MJkin5HdHH2PL60kVkDakvhuxfJGtXr6hPceprYr9mmLeiSlYuyiuSkq+gY/HB51kk37zA0Htzv417lvShPfuinaTmKfkU4D2JpiIleGBLFkfmTwcVyiPcrGSxoMj1MIMTKoaBu203uxT1z362Jtp+wIBra2NywXNWZuVO4QA/687HTZvBMrjtyXXsNVMClK3mjOAmd1vU1kK9EYE/yM7zTQtsqdmlDq6/lXOqaoRWUS9A3tck/1KpKGrIss8D0IAAzFFqCBxY7a/VupBYiNguLk6UGUtPDHO1YF2AMvOQOK9EVvItVKsAXlh5VgvaqHX1u31Xj9pfyP+90T1z/C7TnMQZif4rAZ0ePY+B0+upEPPWUOX7vMbqnZ9XhbhFsaIHfh4Nm3FSMilVeG3Tnnr0K8gPedFBpqLUX0MKbTstB6Hbi/fUjnecWr65+6yoVRlt293Mdh7+JXXlXfG3CykMYMilogf41UGsDe4vMxfqb1sXwxk4Ybc/BZy6gczQJAOkw9vHSo3OeRLbW1oEh0KXMKmWSEKaHB1HLw== X-OriginatorOrg: Nvidia.com X-MS-Exchange-CrossTenant-Network-Message-Id: 2d7e4233-5eea-4b10-02bc-08dc5356ce46 X-MS-Exchange-CrossTenant-AuthSource: BYAPR12MB2743.namprd12.prod.outlook.com X-MS-Exchange-CrossTenant-AuthAs: Internal X-MS-Exchange-CrossTenant-OriginalArrivalTime: 02 Apr 2024 20:52:27.4126 (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: qe5vH2iG5LKe4rU6NViTpmMsH17lDmVEq1SwOuK+iVHpAgo8ikWBXuKS25V6yCV6gjSitWplD5UlWM5qajNC2w== X-MS-Exchange-Transport-CrossTenantHeadersStamped: MW3PR12MB4393 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 --- Documentation/netlink/specs/ethtool.yaml | 17 +++++++ Documentation/networking/ethtool-netlink.rst | 9 ++++ include/linux/ethtool.h | 28 ++++++++++- include/uapi/linux/ethtool_netlink.h | 14 ++++++ net/ethtool/tsinfo.c | 52 +++++++++++++++++++- 5 files changed, 118 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..4b5ca7628700 100644 --- a/include/linux/ethtool.h +++ b/include/linux/ethtool.h @@ -480,6 +480,27 @@ struct ethtool_rmon_stats { ); }; +/** + * struct ethtool_ts_stats - HW timestamping statistics + * @tx_stats: struct group for TX HW timestamping + * @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 +776,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 +922,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 Tue Apr 2 20:52:02 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Rahul Rameshbabu X-Patchwork-Id: 13614595 X-Patchwork-Delegate: kuba@kernel.org Received: from NAM12-MW2-obe.outbound.protection.outlook.com (mail-mw2nam12on2094.outbound.protection.outlook.com [40.107.244.94]) (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 93CBE15E1F3; Tue, 2 Apr 2024 20:52:55 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=fail smtp.client-ip=40.107.244.94 ARC-Seal: i=2; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1712091180; cv=fail; b=KXa5GrS4ywT3t3kj3ZgDZRJuLCofFX25iFw0D/ngNdVni4PBW7syM6jzH8YpBCjgJ+aDB6V0G5VxWrWa5nATnDXeJPeHTnSFcCTMADCGD1CsuLSvdJBfLPlw3w8X3y1p0GBSd/EZWDcjakEZiR39e2O0SR5xb5CXe8NO6tqGAgY= ARC-Message-Signature: i=2; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1712091180; 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=hoMCXXCA8aOpZNKzbuwNcTTrRvV2dFOOKJQehOxNaWFhCr+xlWJC8HN2bxvyk9q8ByrnEKgyjEyPHA3N/4ILreKlRiKw4uTJTgZXX4VBuNftzbdqCbGyVj5UWbTkkqC/GqHtqazfBzmWuhufu1hDGjJbwWd+i4yBGYMdsMFc2nQ= 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=sYlU7N2Z; arc=fail smtp.client-ip=40.107.244.94 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="sYlU7N2Z" ARC-Seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=jS9Pfu2uNq04wjgVW17yQ9kD9SwINjaRIdzk0lEVy01Gn623ovo3zYtOmehMgNY84iISQyjRojQAIKMfigPNwi+r5CHt3zgd/Ef9a35z8hZCXBjY7D4CZHc2Vxy8WZHfoweeb/uaaBTTChV0bM4/Rfjoy+qCn1a0MA3TT07Fvr6R/vINUlWGa5n6Jk7WlIdhjRQ4trrfyrtV/p6KokH9YHKfNZ8iUVQ45jvQudCpbQTN4COMGS06fLnycItEzob2kRc0PwcqTzGdz1wdUuOVGgDVxMnMZAAAUNatmehrpLHvisIYGBXxWErVtSKNHTbIG76FVUbXt9XYHQga+cjsmQ== 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=EU+yqXaH2qICV/eB5FDpeLHqQynTmNTQuAyBKEAw47wzhqp50cCOayIHAbgWp4tNnHa1NymShofuJTvfm6P8fEDlcsGI1g8oGVgnV9nJaKq27WTG53r6FdkGKATyV5W0QRBKIfGN9+FlPm8JoqzG/9k/Isw7lu8FFA75vqwmasgUj44EEqFW1TaeVaAmyw1jvi2wFU6Rk/OxQsJ9AEnWOFuD24pLvQfqKn8rTUU3CkBv3JjSf8OPvxVKKei1T2Rw2/67t8X20q1P6xNnyVl02W6rGLBjejyJO1OXY3lkS/O6jC6iYidEDpULY8YZAWYsVTRK6HyHiTPeDxIXq0Kf5g== 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=sYlU7N2Z7yWGEVZ4FVP/w4ILYDcKF/LqUElks8Mx1O+VGcuglarTHpaeDzPLN9r82K3Hpu60Y4YdVpCYm/CoC7MJOLsGPM2bpb9xfiF/3ZQ/050L5sM+9gUjMW3+VlU+SMYetbOyURZFd8X4s/LRBndMP/nchJ+cMaha+UnWDEQtqOTAlZLRlBWf+sqDufi6jx7QFD+H4VYZXqV4TJYvW7edk4ruZfI5OkcPnnkmFg7ppS4HsC8H8+w15xOSkjc38HT1fQCb3+F24xT76LTX7WhxD5OFVTQNNpH60LJwolErjm9vM82P1o3Aq/LyeryETujrPG0789Ox8Awo3Jf54A== Received: from BYAPR12MB2743.namprd12.prod.outlook.com (2603:10b6:a03:61::28) by MW3PR12MB4393.namprd12.prod.outlook.com (2603:10b6:303:2c::22) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.7409.46; Tue, 2 Apr 2024 20:52:28 +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; Tue, 2 Apr 2024 20:52:28 +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 v1 2/6] net/mlx5e: Introduce lost_cqe statistic counter for PTP Tx port timestamping CQ Date: Tue, 2 Apr 2024 13:52:02 -0700 Message-ID: <20240402205223.137565-3-rrameshbabu@nvidia.com> X-Mailer: git-send-email 2.42.0 In-Reply-To: <20240402205223.137565-1-rrameshbabu@nvidia.com> References: <20240402205223.137565-1-rrameshbabu@nvidia.com> X-ClientProxiedBy: SJ0PR03CA0291.namprd03.prod.outlook.com (2603:10b6:a03:39e::26) 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_|MW3PR12MB4393:EE_ X-MS-Exchange-SenderADCheck: 1 X-MS-Exchange-AntiSpam-Relay: 0 X-Microsoft-Antispam: BCL:0; X-Microsoft-Antispam-Message-Info: nAbstr8VkE5Cz0oPtEPoAY7+zgUSba2+wlrBU39ZwQ+nsjuev4HKSWuLYiLdd0I2en/i8BwSkf2WKyQRhTYuMclN/HhenLMJ4FfO8ppAUDVkf+meSgVStpAN2KVCBOvXqXOsfR76DKTxAANHMhpSQUhX0zc2Vx5Qkbex8nuPn+bGRuq2xYLLMxfVX9+6DjQuwUh23lV/bJuO2JGxa/3EQUiCz/1NKSOmaxTGntV/ohddYYf5YtcDPmV/csJqI5VHbgIEtyStbUcCDcvLfHm0+HreQNiCv7H+y8WWLzLwoTf6mC2MjRvjphtpF7rAtmwFAayy90qlnkA3ggwUM8QXk2grbAptQ//elcoR57xUMV7oQua5ndCFQyhUqjzfleNw7baMwGFEKBAG/tWo6u+1DfZ0NC3bEKqAIMo4sNiZ9HUiM2M1O83nop45eF1YN2Tr4mdC6FmcxN6AK3UJSvw/9MNA/Owe+F+e5mu2+Ms33ww2qcapYbfGXXAR4pnRx9dmPG5tdEcfzK+x7HOUhaAH4+0CfDWNQa/kkBwfd6k6QlIbMOoykYqQU2BIQ3+ByPXj1EpFf0onJzW6lLF8OnXdUxl3zv6jnlUIAhzAs5G/96DwERHE3LqjHPeTTz6T4KKEHrtWRhTmJTJ4IDvvet+atr8CKpgQ+XuzXTQuPi4d52s= 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)(376005)(1800799015)(7416005)(366007);DIR:OUT;SFP:1102; X-MS-Exchange-AntiSpam-MessageData-ChunkCount: 1 X-MS-Exchange-AntiSpam-MessageData-0: 52Og4Y2fJO8/iYKLDy1G94aNWkEM6u/qPTtOPtnLq+4hgpP8ypDb9trVHbvPqpDqPN+megCkmQ/SphN8PpKJkmozkb2d8xcNxfF9F9yAFlWVIZvX3X4/YoHrbwqmVh2M2RQdb6EVNsvdmx70SJsiGBQUzA8VanLDWYzp+0MpFw9cYNf6QGA/sWlAFm0LpFhsq6dZA0bdrWZEKumJ2XukdCRCVQ/NNLHUzV2rM/QU7oFmQKpozgITE9x9s1Ato58qTho5jNf9CbJA/lSzn5pnfzBa1VCvnJwxEuSrCfnoC7ym8rTVdLtUGJFSvdwCpzhskwEsRdY14vDoiegJQ512du9EMcW/5Jr6fqgWzRfbpIsXqkrGZ5Qb0ztU3d5lKnmiPTxXYZGaFicqqedeob9/owwEUOj7N8THcpfh3tiaP3aSqhwQh28V01HkRxKtfuv/SMSc4Wgs3OozcNx8yGdYGa5ywHOL5OAvmDTDxrFEcKZjKqsOGTAENLDBmGfgLIrKkPuOQaBsqm5GKzTVddTfIJFQQR9wXO65gmMHL+B+AlizGjniMiQIT2uaLjEY2Jzu7qKk24wiQK6MJ+eFJxEZ0+p9CMXI1mHUzLD4QyLcdG6CnHnE3QhCVlp3CpJ/tqIWXzriYJAfKIPX0ZZFb6ccoUToBjh7JTlxmJGXkmWHLLBRPjrpA9UymBNZ/9/bqTfN1er5yGbOqm4JwNJk2Fq1GkbTIVe4G56MdljrJPBEEjZcNj6hL/gpLRwH/r0cgAP/7x8u/YTY9Q+baLDTy/+YT8ieu9W0FhE9YWpOJrxW2KS07hMIHUU8eZIO6dg3JRlkSS8AJ/R+1I6LLNoXmQrzEn2OkPVQsz1Ys6U91EqFcxb7+PBYwNpCAXPZ3LAPdoPVVhya2Zxxe8uOVZoU+o3UAPbPNuyFiKLtk8wMxkyP5+tHP+Oq71w0tvMQj2Dleb0+QuHuSgwkc2ARl2jHc70/mIfuXktwZKDF5BAdDx0L17wgPGa0PMi3I9/NZPK7+IEKgdcg5uv7V80oo9pnuzMCON4GeA3RFrmXU8JwP/u1I8QC1jDX/fu3Fbqh7NU/sxpz1F+Sds6vtNavMcPFmWMwxvdzAecBWu2ZW1RKZQnebTtu/wsoWk3oCXIpp5fgQvoXOuiaHop2W1Zbj/2u2oIUMNrkukt5AppZH9tl7MPHnpqatJ5AuAxG5I8Ek8nwzaWJwo4Pfvr0Ym2m4DqzylHC0kJIWz6aj+P6aIgS02xSLKH0Uc7/1Y5sal0nHAdcfIqEsWzTcACNbLFIW2U54++Jn+PEnmPhtEfl2HIhf468qHffqq2ZW1B96dOqWB5xswDyvLgMpDh63qJlFP0TfAuQHbqCzcVYPFm4rAxm2161gA4vm7eri/Nzh4P1BPNhLysbwqL0ZcvomC4U+DG1z33SAbriorByIHOtmedGgg/6JdAkoi+NxWMfAWoodlkv6jaXlhQIEaXMsJZK3odTpJz3+kDbOG+6kO6xUZIlDA4ZKj4WGfh2rktY2u8zT7tGRimhIcf7utf6rt5Coym2Ue2h6gP4XIY856hwnxqhe/IPV4P2KAjlUh4b8wkUuCe9tHeo+9lP+802nbbFGlcQZOM0bQ== X-OriginatorOrg: Nvidia.com X-MS-Exchange-CrossTenant-Network-Message-Id: 6763e5c0-086e-4fa7-bce7-08dc5356cec3 X-MS-Exchange-CrossTenant-AuthSource: BYAPR12MB2743.namprd12.prod.outlook.com X-MS-Exchange-CrossTenant-AuthAs: Internal X-MS-Exchange-CrossTenant-OriginalArrivalTime: 02 Apr 2024 20:52:28.2050 (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: 2T0HnPK4kQbm7oxz+9LSO88TOJyjcvQS/UUE0j5yfZh4KcMwRRtVwlK5PezR0gqjv+M6Oud0FkIwB6RLIQjl6A== X-MS-Exchange-Transport-CrossTenantHeadersStamped: MW3PR12MB4393 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 Tue Apr 2 20:52:03 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Rahul Rameshbabu X-Patchwork-Id: 13614597 X-Patchwork-Delegate: kuba@kernel.org Received: from NAM12-MW2-obe.outbound.protection.outlook.com (mail-mw2nam12on2094.outbound.protection.outlook.com [40.107.244.94]) (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 2419A15E5B4; Tue, 2 Apr 2024 20:53:00 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=fail smtp.client-ip=40.107.244.94 ARC-Seal: i=2; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1712091181; cv=fail; b=W3/4xDJJ8jvcJWRReWSKsULVe2ME3Q28nRai/wXnxIpZM4+1wDSL75hssckXPEnCRdtsEBFBeNQaLQDxgq6OvFFJL6jkAW84tNJFxPqTIAvxvwtJMBpUzoVnJFlfoCRS7bs92LnaA5BvKQRRMFZ+GL9MsNkxE6v0E1Pb1Gkgec4= ARC-Message-Signature: i=2; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1712091181; c=relaxed/simple; bh=WwhCAT5WSnm2yd9jWnS4IDeSKji8NSr3NtaxtHVz2iA=; h=From:To:Cc:Subject:Date:Message-ID:In-Reply-To:References: Content-Type:MIME-Version; b=sG2T3kF1WyC+/qelVKrsMlQ/RARsnquw9Ll/z8ipJ2ug155JRzSLAbeYa416hJFGrycIU1sgtD7MxkrfrU7s0Mdw/KA0vZm48nvsHUgmdiN4RKVmlGOQQmSFC31j7YalAp1sgT+EWmSq1SRn91r3dV2Y2cSLEdkgcxg5vv8BhoQ= 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=NU/6IeLx; arc=fail smtp.client-ip=40.107.244.94 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="NU/6IeLx" ARC-Seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=OSd6A1vih4os4oFxYZfq4oyRtBbhML6LBgBm3i9cubriLTYwHhgs9L+qCBpRqCXud+AhEsLluYyteEY9L9nQGHkdNHAjYuzFeEZN8C8qCCyo0U5nBKme5QtkjlhBBoWxj64G888TUoqyWK7Xfoi04OlSZFNa320nCivHPm1Tkvdk5PodK/9c8T2Gr/Hggfh0DJhABShuOsZmoxATrwe+JMfpLKT0qh8eKp/NgjvZ6+EFSLTdhtCl897LuY9Qq0Rm8T7x5g0ee2L0LSIYwDuEzjuo1rDdAGKER4/xpqwD24oZS0hlLbJS3rqiUG68ErI4Zq2ZPziFoXwDPKMhI+COUw== 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=nN37PEiv61F8wxfvu4bRtSiOikFFPNQxvXXdcI/5QWc5tT9Mk5dI5RoKYhc+N2yvoODTSetnyMo7d4Kn0ANiY2YaJVaxEaqurJ+iW2ON6luNeh+eYk4jjETTTGh+1g+ob+DMR9xq8M5mN4QcjK3j9+gDwGYJz/jmazhNiBmHxofAYCMr2A4gh8n7Wh7csSjrirYsCl96xhwjUlOUJ/0hezWyhYlQEWDE6ReFfWTpRbfVBTDADjytdot4HslwuwVuqHVoEfMocPGQUaO9yEBQcrmEWFhBa2urwIhQtq8AHdfhCG6E08pWT7de10EjpB8BzRaAXq7NT0M6wZ8QMZBZFg== 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=NU/6IeLxgk4/9bnJsvuaiqxUS/0tlhTXxfdXymn1HS64h4+uh0YDa2roBkrv2Hw0XTLpz+IRzubX2PgrG6AIPfr7kC8lAF2s+tOdhdrRy4ipNpy+2m4mJMtDJFQrtY44Y6sk/Ngapne41bJbpojTD5Q133DcMMO7dJN3tUekb3cGLwysuYalyn890Kq71ZkLmjZb4qTrBA9Iszr5MrblpjlZDY9fVAc2J5EEoz/zStXCbxIR9xeX//q8blbOnP0EigMS8DEUrJfgeiI82Cm8ihzUctg15A92pDOECaMIaUn02cqQjCw8UtlbO6ZTQOnS8foBNT6RmyC3cIDdPdozcA== Received: from BYAPR12MB2743.namprd12.prod.outlook.com (2603:10b6:a03:61::28) by MW3PR12MB4393.namprd12.prod.outlook.com (2603:10b6:303:2c::22) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.7409.46; Tue, 2 Apr 2024 20:52:29 +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; Tue, 2 Apr 2024 20:52:29 +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 v1 3/6] net/mlx5e: Introduce timestamps statistic counter for Tx DMA layer Date: Tue, 2 Apr 2024 13:52:03 -0700 Message-ID: <20240402205223.137565-4-rrameshbabu@nvidia.com> X-Mailer: git-send-email 2.42.0 In-Reply-To: <20240402205223.137565-1-rrameshbabu@nvidia.com> References: <20240402205223.137565-1-rrameshbabu@nvidia.com> X-ClientProxiedBy: BYAPR08CA0068.namprd08.prod.outlook.com (2603:10b6:a03:117::45) 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_|MW3PR12MB4393:EE_ X-MS-Exchange-SenderADCheck: 1 X-MS-Exchange-AntiSpam-Relay: 0 X-Microsoft-Antispam: BCL:0; X-Microsoft-Antispam-Message-Info: DD3dzDQivHNnIleKOCDk155f3BpitnyGYcN9I1qaifgBndIcop2yAnExeoqQecNMlwyFt2/nt0FJIlG7YRd2dHXpExi6jKWYzrMLuKdedzsKghmhFS7tH2jzebZodP/LyPejmFhjzu2pbIfEBH0mjSKA8YH+N6RwEO9fwd1DyrygjpyjmJmNljWjWYZf61lUbCfLqraoTYWYIAo0B8pPSRFkOsNm2GL/JwQxBnK3t0tWSu1Pd2MTp13CWWzGA2vWCwh98ecgt+NErRNkQ+nAYgrQiJowmHgdKqWll0YselFCpMqkDDNvpF4TfmkTCBb+O3WgPPJYkNFR6KON16u8DcsSVwsRzCp7hpbAMsG7IXb1kRjgRf3Swp9VtEBE1yIFA5kDrt+QphdwdLQOmHZJjK/j2GeZVlzGOco5EKxFGQk9g2S/U6F7FeTlOMKLb7ULYRivIPKx5DSwNrdhCdzokeMJlws41zD7+xvdwItj4MpAMS0bo1Qfk51+rhKLhb6dL5yQGkeaMK3aFTVTy9miyxuaDktIo0Uo16dsv3txiKlCjoRtjEOr55mwMm7xyMFAcBs5vOsVrI+lGp3+SNvTdF8+4UtNrpIGM+XK27c9GVGVdrN/yokpiCuj9XUQ1QdOJGQiE7COELIJQgTyR/EfHpBY2LFQQFsZ4lIThJ6z/1c= 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)(376005)(1800799015)(7416005)(366007);DIR:OUT;SFP:1102; X-MS-Exchange-AntiSpam-MessageData-ChunkCount: 1 X-MS-Exchange-AntiSpam-MessageData-0: +/K3sLiVaE5SwQvOhlQEt0c8+X0RbfPOvRhGzLVF1XVOqmlUK37Q6m2sc1W85vULPgY2Gx3LHUL/A1OQNSSGZZJctNh7RePeoMFuFy+fNcmLo9y6oGvb+i1lqXLMAGWabyDb2w3rjjOvbLEVB/ecTMbJ11qidL5ElxMhPpFjCS00t0HbXoG++OnHBEY7rhZtzp90+1V1DXEM9A3izsGvPOeuurxHFopfHI1pm/jlCFWQpU/w/+7bUHao2Po05/XQju2yv/WOvHmDlenXXQoAIj0chwQxQlKSaUadPj9ida97Tq+xmtD7uukaT0FYRmzI2/hEvejWfcpGbxMEHcIQ+6F8zNJyxzboVZkoBSvbpsH77mgqe21P0Jnkm79x3nNKcI1fJ+Uf0rWlGXYLRdqTAGTRJYGZDD2vvPYPWFNhq8ZvNn9Ak5eCbnlJ8R0CmUZV27n7E/K3tnnCmHbgVMknO8EjTcRBHY97iaHoePOrcFPrXxYazXDTKneZ1VzOKg2iw+mPe4JmVf0wRgbmwbH7ysal3bAy+ZFkQtFiaerdJXwzPDmfZ9kG4Snpc/2/3AbTOm2NLl5XW+I4WtJGSmr+gqxrOjwwuNBrpCXc9K3fXJsOpw1A9h5WZu3rbkl3jpUEHIYFNOZ+Nf/5zvueeQgiZ00f2isHj1+7JP8BB+VLcWJq9Mven2/E9zIOshViy7ANVLkGErDi1zV3QdlBaCAs4b89Za1FHO9qbfN5dxGhNoXMRNqfaM+Me/UEgVBu5lX9nQIyGyXKObsRhtRBIWM/tQs7WBYybfncvm9RBsAjFk5FOdXTV1nWC5klLppuJajLzojjc/fJ8yq1NF3sNy39WVmtuNrExuI8pRYz9Xbx6wz3xykuJErOPQ469Cp5AIcWoFAuCxZi85/C4LzwnCLn7HE4nsT+sy4IYIDR4BVyzuBlAEg5gaIEyRyXLeKFyXY4apwG/mV7iRKUj4LnCAVtQ/hnvccwf+qma0C5e4/3IVSH1UN4O19RdUIE8mAXJ699Dke0P3W3unqVVZIi/2Yy+5oiLJi5JhqUjXLUVA+RTPH5v/71HEcE7MkVztRmBWzwK7ITjkvD5xJQFi+BnWVWH9/Xm+SbvIf6NewnNMZzaxzqB6CbwYHfTVqSZcOy+u0GU34g36fD3vP2PskMK5DvxA/xBVu5T2XgUNQ6W0G2dJV6DFYCaVGZCDct/PWxZ1h2OvN9v9V38BWGY1siaY+PH+v434wMWGH0hw/yJmTobBGI+RyLxRNHgTKEe4Qy4RUL1hAKhDIDQHZBgWwwgn/yKu3OOWSS55uw/9D5BEqJtuu6R62rNf8AVW8u5rmxTJDOfuxPuYHEbC10DZ3PObO6LOeBm1PVEXisaIAcZJwBAAmVomfEUU9DxTYA4/QGi/5vozWA8g9LhxPZhARsKte3nRSKmkuKRwWJVbuDGVAEmYV1n61z4oVSMH5fkjNGQdJFqU7WsSp48BXLRKJB8iP8AkNYOvCd682ydXnG/E1LEIm2ZcJAX+/sBzHbWVEOpm8DBr4aECsCLeA8HCBmIaUOrjeB3WUjItKLydJCt6NvE7BFoFrkdFV1l6qfbsYS5KMPe9De64unCZwJ9yQl52wkGQ== X-OriginatorOrg: Nvidia.com X-MS-Exchange-CrossTenant-Network-Message-Id: 1bf4ce95-c0ef-40fa-632c-08dc5356cf37 X-MS-Exchange-CrossTenant-AuthSource: BYAPR12MB2743.namprd12.prod.outlook.com X-MS-Exchange-CrossTenant-AuthAs: Internal X-MS-Exchange-CrossTenant-OriginalArrivalTime: 02 Apr 2024 20:52:28.9745 (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: j2l7t0S80HTl98AMg8zJu71K+AjYfPkN9nYRqvzxWY1cEDztHqkA4dl2+b5gNpjpsTA7b/WVKDbLKRM4EqJklw== X-MS-Exchange-Transport-CrossTenantHeadersStamped: MW3PR12MB4393 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 Tue Apr 2 20:52:04 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Rahul Rameshbabu X-Patchwork-Id: 13614598 X-Patchwork-Delegate: kuba@kernel.org Received: from NAM12-MW2-obe.outbound.protection.outlook.com (mail-mw2nam12on2130.outbound.protection.outlook.com [40.107.244.130]) (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 BEAC415E5C0; Tue, 2 Apr 2024 20:53:00 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=fail smtp.client-ip=40.107.244.130 ARC-Seal: i=2; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1712091182; cv=fail; b=ZC6/GlEr+Xg4eFL2ocsCM+EljAPvz4/RvhPmiJx9c41BONFgrFfdEacUlVlx2mkBfpbP+49Gcha60T4fzz79XgXM5vtzAy//V5oXUpzbz2eBslVUbnyFNo6bljwbWLwSMAvQ0Z7bDBEYatCUfRE4TH4SZQI4VuyN+VlQagnydYc= ARC-Message-Signature: i=2; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1712091182; 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=kpJ4GVyplOPiAPofecdIKGuzNWEnLbV8hPMX/DYp1kUXrcB0b0Db9tjp7vnCDwt+kz+Cn0WKxHhmxWHwKFkYdjGrL0UV6H4Ika5B1B13auH0Sg8oz97xCVTSAc0APZgp8sAAnG3JXDj0DauxQkGiH0gkT0IW7YSmiJaZBsdUymo= 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=l0mGLfZj; arc=fail smtp.client-ip=40.107.244.130 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="l0mGLfZj" ARC-Seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=VY0l/bLozFGba7FGr/LMIA94xOpoS6FLkZXOM7Rv436ZaLM6rhoDfXtB0VsWnz4uDft6qpJVqqyNUUDWg7xHl9VkECPDTfbm28HBtYytQ/3RxPiFb7AtyrMDA/s2Y2bViPI/qYruIuosa7J95U4dfTfa1OFshRvEVdkEmwHkyq4qWqN9aHU+YqRjpBzITOb8cr9AcIgM7JmUoaylHXIPB8d1u1lUx26ce1HGHnBz7fZNbzvn07SitP3BJRHNYZ1ms2gkDXx1rT/QFTZgmrNYGZqxPAbhDlqvHv549aLQkpbzrj9dPvOkf8xj+Lj82jurDuIvaEssaLVokQ2kWfFm2g== 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=QCYNgkaw6BoyJ25WwRn0ej4OA4UoWndC1GTHdAQefz2bUcCRgauwU2iTtxJkfswZeV26Om3gHIz5ey1xjDqv47LsnbVn0hqa5kLVH0hnEQ+uJIzF9ZiUydgwqgBzxTHQkXPdtOTtVuGsGHySyH0lVGPQlTsM9GSjSvgBnvKWCd20mJ7Xtp37ihOc+7/GzOURdT6dofTnOtD3/9MLQdtBZo4MoqTZJ4N3kkOvmzoXnTC8iG88ssX3fZ8L8UFcriCXMRBdyrfGiS6qCtLozM/qS+mfZrNrOwW9V2wQY2pjXFBCaKUqnMGUBhHkqWJsuHhZ/JS3cWy6bwYspPf0K+xUNw== 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=l0mGLfZjD1cXI/b+lsH1a9Dc691nLAltl1BKpsaOC1Ks5I+Dnq8VsZxkVWyCQiChdW229dFDWGYmKiH9rjg5awJN9G3mQZIQeeJdWf2aV4ZPnqEzqt9Bp01gTL5zLVYymVgEx5bva8mpZIpGmTpPRksTpUi97oTmYmL4TVFmXyT3qj1Wn0iUFUXvO50KniJtziyIjmMlCuY/yCcfwT3PU0w53dUHd0A3ySPOYZU7hM4brqRjOiDYzfG3/AE7t2Zd2+YQPEBP4lIOLg+L3e4S5k6wRy0meReKT/79n6tBcf87p1Z0CCOi1+E8aMw1glrez8+DrQ+EzLuEmInkr6M/dw== Received: from BYAPR12MB2743.namprd12.prod.outlook.com (2603:10b6:a03:61::28) by MW3PR12MB4393.namprd12.prod.outlook.com (2603:10b6:303:2c::22) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.7409.46; Tue, 2 Apr 2024 20:52:29 +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; Tue, 2 Apr 2024 20:52:29 +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 v1 4/6] net/mlx5e: Implement ethtool hardware timestamping statistics Date: Tue, 2 Apr 2024 13:52:04 -0700 Message-ID: <20240402205223.137565-5-rrameshbabu@nvidia.com> X-Mailer: git-send-email 2.42.0 In-Reply-To: <20240402205223.137565-1-rrameshbabu@nvidia.com> References: <20240402205223.137565-1-rrameshbabu@nvidia.com> X-ClientProxiedBy: BYAPR06CA0034.namprd06.prod.outlook.com (2603:10b6:a03:d4::47) 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_|MW3PR12MB4393:EE_ X-MS-Exchange-SenderADCheck: 1 X-MS-Exchange-AntiSpam-Relay: 0 X-Microsoft-Antispam: BCL:0; X-Microsoft-Antispam-Message-Info: 69iUCWndM65znCEqWz0kbZEnNSf7I43clZsP4liOF6aN7H5RQSUz8xtRGVjp1U9KRcM9s0O7SU0t7LbHdWnHxVKOLgu8YF6zHcKtC1z2zdy3b/XXbbUHHFVPkj9L6P4Q1DFWiTtArRkyDl5oHWStnOqz5VPQxc9E2rWV8bsKE+dZUrd+tkC26MzrUmyDy0cRjpxLzFGDCq3VCh9SqMKcFY17SKlmJg9/g/tG2fWwYNCdHAMSU2wn2B6ULZ9ss0V/0uTW9Tc1PRxfFNrwXygLd8//dOYHVvRB4zLSj+gjLl6IZtt2WpAY6sF3H/v48oDiCD7ow+io8rU9jy/FBeB7IzxM5hsmy1o1sg+og1FH2wJnvvNKVyhBYHzC6EC0by9GzFtq2DulQ0u5ws6fJ5BIuodiAvqqmvzqCGuOCdjBGPAG8VQwMMlel7jaJUaM1zqt9bWrr8yIW1P1Iph5c3Rr84O84F5UY6wG7Uw5iSx5IPatD64Q6f1FBX7g5uogr36Q5wpw+9ygsRc7x1DcwsklPLb3/HJr5XE1khrFhM2gOfCLL/ZbPCUYbEbWenNfTVhivbRrqjzd38GP75HwROENxhs9B52ovcHJzUF1NR5AvBcYkv+RDnD8eP59q2suSFgbnVgaHGxrbvMzDeWAN2JaSm6UQE34Nx0FVJwmlMUUxY0= 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)(376005)(1800799015)(7416005)(366007);DIR:OUT;SFP:1102; X-MS-Exchange-AntiSpam-MessageData-ChunkCount: 1 X-MS-Exchange-AntiSpam-MessageData-0: WBKeA+OqUdHb0mcQEm9nTlpg5BWDUwJYmLEbKYIw7bZuWimfpLTdn4nXBO5GgFhqiFb5dSm05b4s0LaFWJBboY/HuLjMjHWTm1aOhldECLp0Zz4A+m01FlK8KQoQ81Ek4KRCrqd2lrFtCbxPUN2okZGi5tZ60YFiZQPxl/5bxkBrsmaj3UFrDY+YyaZIrMK6ly3zDLRMYPPqofsilzUReFlp0Y5Uadl32XFwU8z+n+jIuzx//iyYjwNPhxCwUXr68jyTXzs9OK+Pr8juhmvND5JIALabnakWS1Flf4upjltzruzHV/Td85uhN19NMCVBBh7QlYDdCcvG3lx925MhBdzHa7qVYmzLUkoljVfJ7ZiQlGyJU7xOvhZOjaTJWc6ud2riI63oQdN79aUoXXBETdh1ViSThvGZEOVsn+q94K6huDEtZQ30NWna1+Z5vAU9wT5LhVwBtQu4heW3xKiHfUtxguro6V6wZWMg5TcZjUIknaB615WrUlIqz2aa+cbYM1AjbnZ+Rxi3nMLN5t61EEiXwaP1IDpOJW1N5Zr4S8EwjqiHITlji8MW8/UlSQNtFKZC/GhTVkNXpyZbi/De74IpHoxsSuzB7p4V0izmSCiJ0P5bN2Yduy54Ow7vRWyK86XHoPKylu/udOR3/z4GBJxcsWT+wb1lkENCTnfIGczKUlV1mWUIcQd5riilmSNg1ize62VoQdash0HB8vai4UPY3mH7Ur4L9Ni14CjvYwKbtc2dvq1M1O39xUgs6DMBkv38FDnLx3ua1CU3g0lMC8Y4cNQjc9rrc9epEyV7BcvdKXhnLbqRwQ+RgAet6AvVV7SaopedXuaoM9bYYnx1rN8VDu7hSZY7caJehdy6Vrf1B6YABFkrjRGe69zqAIoi+6RQqO8llFvYOdmXxPAOQqn8BRnE0uFmlnc7NrtwYdv2sXog5xdMSnh9kiV4+7KKTzh8VcL8EmY7Nx8D3cXyeGI1+9E0FmuS/yqxVYv0uDkDakNvfjkQrjJeATxmJmneZh2IXHtpKRf7Wudu2AKGuh7OeKa0lX3mYGMZIVESNPCIZP1NvJoGUMxmdDaqhySagsWRxiXxtjlqYD382U0mbdlfJ6yaIfiO0NclrYaiCeUYKJcMGJmHx66CILAdCg/GhzI3MoevcWIiaPmzYuXtiWfbCzJwfIjW4RgNf0KuScjfH+tVhjeLzX3Pos9w9GjU6UTzSDygNTNr6/pFbRMMlNYGthYyqEiqcHJFXP5MBFKIoHYjc6t8ZZr51X+rYcgkQ5Mfbs/EjGxJPWEImKAPIiBD2v5G2FnkcB1A51EeNJ660Nqqi3Uv/ypzVNKQSyCJ6CtCGD6EKjIlezf/uIS6gWwE5UdiNja/L6smLHQRXGj3u5/ARnXlA9i0RquOS0lFl1OtQT0FFgRx4NF8thxHAdHq1BoBeSukXc+7U+1eyL/N+rtMPaoVUdHxOE2ijRfW1bqYyzKDf8/K70HU2/2rUh095xlGw2YZabMc0T+/k57qA2UnLh90reFsoHqFGGoNsT7h0p7xL8E/dFxC3maR7jOP8Nxpr59IlPJKfrN5nwskm0wSzZHUkAbPJ82yn2DPFv35a5raPunXqvh5mdcPkg== X-OriginatorOrg: Nvidia.com X-MS-Exchange-CrossTenant-Network-Message-Id: d2d00c8d-c309-4fa5-1de1-08dc5356cf84 X-MS-Exchange-CrossTenant-AuthSource: BYAPR12MB2743.namprd12.prod.outlook.com X-MS-Exchange-CrossTenant-AuthAs: Internal X-MS-Exchange-CrossTenant-OriginalArrivalTime: 02 Apr 2024 20:52:29.5182 (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: r+QBEox+JE6loSZtzZjW66c0Y0/wgQtAdc7YwXhM/M5N8levHtzAj4+szb+Zwpkuh+ienLwDgZNyug4q58TBJg== X-MS-Exchange-Transport-CrossTenantHeadersStamped: MW3PR12MB4393 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 Tue Apr 2 20:52:05 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Rahul Rameshbabu X-Patchwork-Id: 13614599 X-Patchwork-Delegate: kuba@kernel.org Received: from NAM12-MW2-obe.outbound.protection.outlook.com (mail-mw2nam12on2094.outbound.protection.outlook.com [40.107.244.94]) (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 E337515E7EC; Tue, 2 Apr 2024 20:53:01 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=fail smtp.client-ip=40.107.244.94 ARC-Seal: i=2; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1712091184; cv=fail; b=Wi9Sraj/Qs5Qwgf2TUbvr9eNHSD2IxIMG375UHVZYbsOt7Er/ll1wav1M9shItE8maBTD8+fIsHNiKTr8J4Aj22LpTojJwLweK/SmcDCJIJ+fpvsqXw0DPHcaPBlrFyNh+uywC96E5NGvkdzyLB6NTdvj3oNs/Je2A3Fl2+2uL0= ARC-Message-Signature: i=2; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1712091184; c=relaxed/simple; bh=i37RrI0Yfd+qpbhqvBQb0KwqxFEgy6CsR2rSzcv5NG8=; h=From:To:Cc:Subject:Date:Message-ID:In-Reply-To:References: Content-Type:MIME-Version; b=puDuMS1Yx81XdtJ1quDzLhtMmmBI6mjZPtKFAl4OIih5n5ybYTdZn1BL27MqljeGTvXc7eZ0QjFz0T3ihby+DxkJJ2ZemvMzA9E0UMZeEpnQUaiWHHlfJaI2UG5BAzObT9LlharctBWjZcMYz8TNLUieKzOWT+CrzojY4/0nsw0= 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=PafcERh+; arc=fail smtp.client-ip=40.107.244.94 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="PafcERh+" ARC-Seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=FdM4ZJQyUDFoJzce8HlBANO3k/OHXob0VZcIzC87s5K05IUrfrD/oa/UVWua7rCl8l+qNRmJVRkZ63eA8DsbUT/SlBQI+I/f1rng7LJG/VmoZGCuYCvfxNNFYfqHpXhiDf2B8mWI1P16cp9tQ8AcfCgR0l3gSQC+UPB2IMHScqY8lvujhBCKqwwVzD6LFSWr3IPubn3NZzcNM+nk62qcNgQCdXoKqDopxJUdc1Qrev5/nEnnZon4zZgBDkM5lsTxj98gVj1VrsgFpCcD0VsaD3iGUZ55rTvtYUywx8wApbqFB0Q9rKoNlplpY/kUmD+Gy/hScFtfvno5/WrdZ6oVPw== 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=cmLeTvTYv4n81NejGhQ1fRiH+HkGOtOg+gOxT1sHdJOT44wKAXkPvCqT5LhFZk1kgpyUrlbi+KxFDC4hc/0ZNYFFinmgzuLK0z5WpnjbA9fI0xsDmbLEWyH6+uPLWVVJL2KqB8Y5m6ErCRFf/h9YQyNSSYCRVY+jk3DZteY1CuehMH0bntegLc/MeafPwLCxTwmC/Q4CXEB9qhlbqg8weRZRKF+UK7aLOn/reokeEfrb6xSlzHRKAJEXeryVirWDLbcxE+LxrHCsJoHe8iThqFiPmenyMj8wgrMfUxfGoKKkETFbYWcwTclc391WvMpyYa4VLE9atS6+MHQus0w1BQ== 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=PafcERh+kRxBvTQsQg1Vr+8CZvT0rQcQSCU0xX9fkj+2NPb2gii4qVRD4UGPuzyllrfcAr5DlWVgzmkeowWhYSigbgMnVgtDE/RLySzQzPUSyZzG7H2LubRqD5ilORx+U5Psq/JW2MF3jqjwOe+g9WOyMQfET3ldVQOrNYAkPlpxXwMIZCynoHCuPLI0ywG87FCruOZmoAK/Gbr8dYjiwnJHPZR2vl4rmoJcW1vh7/phjmOJ8HnV5zKalVFZCGAsS6cUUZ7cKlSxTWoSoccJ29f9WHTsv7lmvVuSheU/lH+TAHxnj11WBsQXYTgA6S+6olLf9szljZghHzFL7+MO1A== Received: from BYAPR12MB2743.namprd12.prod.outlook.com (2603:10b6:a03:61::28) by MW3PR12MB4393.namprd12.prod.outlook.com (2603:10b6:303:2c::22) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.7409.46; Tue, 2 Apr 2024 20:52:30 +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; Tue, 2 Apr 2024 20:52:30 +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 v1 5/6] netlink: specs: ethtool: add header-flags enumeration Date: Tue, 2 Apr 2024 13:52:05 -0700 Message-ID: <20240402205223.137565-6-rrameshbabu@nvidia.com> X-Mailer: git-send-email 2.42.0 In-Reply-To: <20240402205223.137565-1-rrameshbabu@nvidia.com> References: <20240402205223.137565-1-rrameshbabu@nvidia.com> X-ClientProxiedBy: SJ0PR03CA0293.namprd03.prod.outlook.com (2603:10b6:a03:39e::28) 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_|MW3PR12MB4393:EE_ X-MS-Exchange-SenderADCheck: 1 X-MS-Exchange-AntiSpam-Relay: 0 X-Microsoft-Antispam: BCL:0; X-Microsoft-Antispam-Message-Info: DypMzFw3u4zNWdgBXOadM06KP8IS6H6GA0LDgIk/+NMBuuRSLPNmVO+naTDUKSJf2TBIYcRSYRRHXlKGO1S78WOVwKskNqsnglAAn41FHbNxQp5WjokQrVYr4XWp4pQ8fY/53K3N1eSyz116FOmaV6Oz5fwK/x50zorsYkaYcScT9rv0JayEFFCQF0LT+LAZw2AafHTeYJHRojRxxgT1lZvGl5jzx4w0JIxqXHGg5cYMbpe5WQF84vue7f+SIID1zBkEZkRB/68LO/2EkJUjkcGeQOQJnfv+rJGRwExk0Ajg5ae38FVzbhZFOoLf4Hg2iDao8Fr9krNOf3QpmMfRT9AL6u8xLwqqyPCPKfmrsGSehuF5HE0GSqOMwyxVKg4sLuKk/mGxqlXH3HfsnLTLnjyN9LSpMnFEelMyHHliRse26UDVZCaPjN/OX//fCXpZuUwsHYF+2hYxT/mWXHRxecAVTY7cEwJYDtS5e3bk7Kg2bNmLg1YTEhFPc/N0l/M0ndMr4EpfZy5dWKqDXupljQH4uW4rsZavSYx/Kg31lvY9CHmpVK8yZiMRI6wR/XN/7qCEzCwxDmHZAMLaNRTf9P9zp/VVV/Eq1ALEyWwbxWsQc74exJ3DZQ4qzfSxYZSvP/yL92gQpYfGAztv6YeTfKcLvfWq9xSZYSBQAjLxovA= 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)(376005)(1800799015)(7416005)(366007);DIR:OUT;SFP:1102; X-MS-Exchange-AntiSpam-MessageData-ChunkCount: 1 X-MS-Exchange-AntiSpam-MessageData-0: vdX/32sAduWM8bQbg8WqWz88oAr5zMmneJSw3/+jKTDRqgeZaL3+yLaAAbJasRbxMfFw+gNnRdd7phAx9OH7vBMDcWQkJEW6c+DzQsGKjT8wP96hHi7AcrX2Inc9JPtCjbaG0NjSAJlf1HktIxJgLrA/pamzkP7E0naiaLoXmXixQWItu98otexHekfO29ISRxP9AqGtjfgf6SCnG5b3qBNorxkU0iKquUUsGp5ZfAtwJlg+XGa1IyzxyJAHlbxPDbZ1+N1JOpTQduIZYsDAbQqj3cXK8xCV4pv5uMnL9gMxSLzqlWRCvXNJXR+vs2pJPYq4fTW/R0e0RaA05t99qPoSYtaZky12yo/QjNalfw/PMa9CPeEMN/Tnf+LVXtCOrObvbg5W0EU0OX21vlN92I67m7XjwqYKYBtbuum69sOshMQiM2JFhVbeXkIwATQTk39q6CedHRsjOp/ebA0xifA5hRUMDK+u4VoiCeMZ7OIKizXR2zBwGgwMNNedimslrS+vLPOEPOXAFGTQxvBofphWX/tvDE6Eo87li8Mf8dKxZ7w/gtldBp8cU/ZW/ZKN+NWHjBXjhCCrd5Nrbz3rlgbNP9o28F1BYdhr/9SKC056hzR9KjikQlIiN05oYDZxWKL5tApo/Q4UDUcR9KFpauzkIYcTxlbB8EOtPCieCq4BCv/cd7ki3iVvOYOorAtFXs7Zcywe1HHcnJdwwx6J00usejh/bmn9vpALAJXkctp/OJT5015N17JnslIG59d8hYKm8D9CIzTv98XrUeyKGZMEYq/vVOuvZaDO4gJcC6CmKtL/N5nF46g+NBqKaKqSo7O1moikmzrG5SjbUAFvphHKppHFAj0im1g2aFZSH8r2DxkOPvtWglK6lznSXqDpO2jGa+2v2MxRf4nKD5aAlhHnCtWKiJy1AsVv+Vzv+pjSKmAdfNHNfcgj4JwB6nJb0tOYjLapRC9kZ75dckIAudzdjGHIh8SwilF1/cckWHHs9vL7dizqYnkqZpGHUqoYvlXADYXEgWo38EBEtHbpXmV3+5WvtcSCa7705XWduIy+kRqLhkpILMSwA5b8KGvpYNdI7zY2BhfW7aghxrJ7r59DNtHEpcee19x85uBZm6MIblDWV3/XUcmmhzJLFVp0st/jQa1295ZCO2bWKznJ5gLxszJh4csnLGVqQjkVWyTwnhsFAsiYj/tOvlIPJLspd5vrC+47obfDT4BDA1VHFqtZlY2zGlREkPkcb0fDHQIQoR+cl1L4NtPRFZfgG7tZq5hrBDfR+Zdsc9oHUHrOaAHT+1Kgbx+5LSKyyS318SQXXiCtY5gchMyytd885+XzpbWZGzA0Yv44vWJQ4SKwP4ysX0O6razIfZHf5afBpfsIQ+AhYR+U7ZWhygFS0TK3ajBX1+evVnCmuAMgGchmOvC+F2D5DFo0z01mJUNpJFJIcSbR2ArFcQ65gAtLimFhchkGSxj5tiQxqoMh7cyz70FQFvn+xM+j3dnX0tmqcUeLUqBQYpx0Q0yMplkKwjqoJbGBlYjT8XIjh00hqRW+oSKY88aA6rujX7V1IgIa2kO6BY5afQ1foW+d6GmDISqOr30PaIE9AfUY6AVPl51Kmw== X-OriginatorOrg: Nvidia.com X-MS-Exchange-CrossTenant-Network-Message-Id: 0880f769-3a49-4ec3-742f-08dc5356d033 X-MS-Exchange-CrossTenant-AuthSource: BYAPR12MB2743.namprd12.prod.outlook.com X-MS-Exchange-CrossTenant-AuthAs: Internal X-MS-Exchange-CrossTenant-OriginalArrivalTime: 02 Apr 2024 20:52:30.6268 (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: UMIc3mv/QpnD9t/z30B3QTSPT4FiI/6JkjFvqqFMg4Es0ERpehgr9NwINtTrXLAXwJ/GjnChP9jVczRtcSAzHg== X-MS-Exchange-Transport-CrossTenantHeadersStamped: MW3PR12MB4393 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 Tue Apr 2 20:52:06 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Rahul Rameshbabu X-Patchwork-Id: 13614600 X-Patchwork-Delegate: kuba@kernel.org Received: from NAM12-MW2-obe.outbound.protection.outlook.com (mail-mw2nam12on2130.outbound.protection.outlook.com [40.107.244.130]) (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 6FCE515E802; Tue, 2 Apr 2024 20:53:02 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=fail smtp.client-ip=40.107.244.130 ARC-Seal: i=2; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1712091184; cv=fail; b=ISZFv2tUQKz5nR9go43/hQcYrRuK5JWA+nQA7BBNbnoWj4m3D62ffJgk90hqtDwNaiEEHnvx+kgwnK+tGoJgY4PdtqFLijH3B5SSoQXVlhjy2olmYKPrjD1Cw5b4iBgKJZhint5T3GB8vLO1GVvJUpXN1UMnB3SANKvJEIoGFKI= ARC-Message-Signature: i=2; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1712091184; c=relaxed/simple; bh=WcARV9EEmygFik7TxeEZLEIAzAFkt5zRbts9fcuh/9c=; h=From:To:Cc:Subject:Date:Message-ID:In-Reply-To:References: Content-Type:MIME-Version; b=qEypD53XFBnUPJ4cnCmmafLkZKkFPB1yQpuccgvCoe+EFZ1Sm1jaCn5KuJSZ/7NcYRGCaEoZwY4GqLIoxycZ6vmXbxamMRMWYjvp/IomToKNofmCEwi6vf0e5UEdgo+1tVgY26QsEz+bHYQ3jVWe74nVn+3irI8911UWVBKHgQY= 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=jL23Jaut; arc=fail smtp.client-ip=40.107.244.130 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="jL23Jaut" ARC-Seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=bzLRO8tj8r1mTzqCckVB9Nahoyrk/TdxrvP/vZ5XP/OS4kUK8pnEhQUpRIFLQCzbdvsi2l1srm5nN6GXnCZgXVjROnbfvxq9Qycg5DKR54I1UaM3DHSa/kW8recDmoJ853qwvhCYRl5Dz4RYpQ7rPR210lHLD9U0tcZTwCg20UvlTOAIFHD+wpTGjO8wIllO16B1kKqi7eTiRMbLg2/Z6ZGCmLlGqKNbE14LmdPexknFeEdUdzIJZPWTIUGvIhmfjhuNDvAln6iEohCxrkOlcc2Kq9Kk+ez6Kt3RwWryAtRzxBRInoG5MdDT/dTVXAC2oqJJw7o+X9D1t+Daoj/vgA== 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=jIW9cji/1TPZ5iFMO+muWw0G6eV5BjXUmkEUQvr7NVP5F5bwm9Pm8bvWdDtT5t3I4XnI/ycXdlCiNbofA6xwg64eUnX22RWUAK1aR/4o2Vr4i29bV5PBSawnyjHHXMuAU4vetxqnx86latVVBSs2RvF9dVrl9Bh3A0wyjI89XrG0PH/+/0CQLyU5NnqzWfUk8Zjg+514lyz+wPmmCGbvGvD0OV9aNFWwA5kLymGHlnL4mRYGgGiLkZTzqJzgLHiRbJIOzq58AU6+6XnFpaPkCbUtX2J2UJ8E0slp6jiXcIASw+o7it3JwGRCCbszFYdHdefSnNc/r2czF5tZIK9bBg== 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=jL23JautuNSCJYFNY7SXmf+lraaWU5mmN7GeIspmZe9/yoAxOqA120Lzbbpujmf0dSaC559EWp5wJI1xfLQ3HZIQSTo4p5QK61Dk96ydDemfRYyEslYbO3dNbJNLMgiyI2hM2731qNRFJj8hrNrdV25PNgmQzV9OCdkboCDoh5LaEPtk3gGAhBIlpr7SpFifMgOknhmz1goIe7WxBUtemqnqfYpMKAfyDE+3ivi2jIcfN7eCQfo1DuFTA5wJnq+S7+UZo+dtPzLUty630wA3UaDfQ/pS1zM6HXXdLn0BtdmeL2GCkXCnsYjz6ZETBXUBRnjt2KLT4/ScVsgpkgUqeg== Received: from BYAPR12MB2743.namprd12.prod.outlook.com (2603:10b6:a03:61::28) by MW3PR12MB4393.namprd12.prod.outlook.com (2603:10b6:303:2c::22) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.7409.46; Tue, 2 Apr 2024 20:52:31 +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; Tue, 2 Apr 2024 20:52:31 +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 v1 6/6] tools: ynl: ethtool.py: Output timestamping statistics from tsinfo-get operation Date: Tue, 2 Apr 2024 13:52:06 -0700 Message-ID: <20240402205223.137565-7-rrameshbabu@nvidia.com> X-Mailer: git-send-email 2.42.0 In-Reply-To: <20240402205223.137565-1-rrameshbabu@nvidia.com> References: <20240402205223.137565-1-rrameshbabu@nvidia.com> X-ClientProxiedBy: BYAPR08CA0047.namprd08.prod.outlook.com (2603:10b6:a03:117::24) 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_|MW3PR12MB4393:EE_ X-MS-Exchange-SenderADCheck: 1 X-MS-Exchange-AntiSpam-Relay: 0 X-Microsoft-Antispam: BCL:0; X-Microsoft-Antispam-Message-Info: aFZ102qLer7g+aZs04VCB8gtGekLpdfAQ4B0RIXkLtdkV3ouKCdy2Xby6vXusYRC6LO6WBg5C7JRkH/BnuHvVqqRvmY7j7Jiguf6WSDlxKF/VHqrGJ8H0sZQ6iaoFT9LPlec8ZGXpBb3U11U/VrypjraYUbFoeXZtk/Rr0KoKBGZExAZdNLKLG+VFOVewemGA2/T2uBZ5UojvRDUPC4xaCyOP9UB2jJE1t59s8m/Qw5c3Q+B/wYPkaD7CxcqaI/Q5aBTeVWNUomQMqrsmYRAAOJxaJo0HnPK/cNvWj51rXac5RR/t9gWAFLth590NH2xzWMNtfoj/Blt5PpcZlJeFybAK4ZJeiw8AaXKkloJyo3MCmTe0fvFZTioHOeXHPg6ADKHXTR7bhYs6UZsuB6b+a7UiK2rUNOlsRQv1/7wHcjC5fb4mP4ddpg4nsfz7ooj/dKZJnWGhA6fanVpuUbbeisRh1evY+vzJa40vgVB7H0Wf+k9ynEMM6NxDOuqNT6J+PsCEgq/IPIEKfmWTBdc0R0np1pW7SSAltcz6gSHScDW16sGLReUPqlD2Ei6k9ckTpWps3mdEy8YrD/6sB/l9gzJ6t18jvv4Pws2KeHPB8AuI4ZbLskISa5jmEXlYojLvFjWzFfGlNen+ecJrhAT/ioE2c2jxiuz2swFZ/1yxmE= 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)(376005)(1800799015)(7416005)(366007);DIR:OUT;SFP:1102; X-MS-Exchange-AntiSpam-MessageData-ChunkCount: 1 X-MS-Exchange-AntiSpam-MessageData-0: RkXVXk3v8gLz8kEvj9CDwFmgjot0h/TpkG/YYL1F/0IMQwKVjZM5HEHvZWo8h+BGj8fJ42qln2vtumJTqsxg2ZXtoHfW5lAl5OYnpB1eqlC7ZUR+pGXoUHBNff838Bg5wDcdTWcDsrI0m12irw38uCMigSUlqzudouvZBwUK6RsaQa2CKEuPIH2P/WtZi3Tq707K0YiZinUJ9lLTrLBvwGL5X3tjQhIoRFcy+MuQ6JFg7vC7qwF2kB70HxNulNK+dXr0/oqS/nbCS/4wIkTlvi2rvWwQTI+xYx/m3YjN0JZK6H2wAJbLGftIyI+9cZbuv2vEjJMfn3xmytY//UDSRvEStahZu4ofez9kUML7UozqJcLmyO2RDr44P+6YSQN491ZRL3t2TAQNMnay6yONaD7vtwIdYzVmpb2ZQr4FURHcpFnGDTCKqFTSv6QowkqVs1hcizV71ROkFxFQu8ovNkBpEkV5E0Fykgkxp5DtnQ1DM4ekFLkv9L0T3r/ps5Le4OvkGc00N/M42Bb0CypLZR87Zn9+FpfqRCnoGANN4OeVHmWsiM+c8Eiik7h+hzLBpLCGUIhbcwEIIZ2vnC7Krp3Gla15QyqIeE5f7PxTQJ7VLXHxfp/DHgeo0wE3CE4zH+7uixH3raMElnExQMksVzteJUDL8kwW7XetnzN1YCFsTlQeLCEzsBCiX8qZDX2EXH/pCQ9i87WlOlxnw1GJd+SEhSNxoXO68rSb+r3WSqDrtkG6PicMTyEZEZKbweFqI1xYn2e26EL+dB9SOyRuXUQ9Ms4BVr3p4PVx0yVRWYwUGc1zHBOSoHiPLAvo2GMOjNyHGQuW7FP0DP3bqDVZ1CG03Xxwobl2WF5rPz+aEzM+jjWAbAzY4ru+Tryu3pkvEz27fBn8ncTaY87koliAfSap3hDofQNOab5UqabyR+61FqaHtX5m3KrS29LUUSHJQxcOhHGuIrb581NKbN9qjWqgl1E2RVoGRAruzMWWY1hcA1S7PhgBix4K3oQEpZAELc2G40WNI3i8X+5i4zD57TQ0fqiC0qE9o/CYYesZ1Dg+bQhm8BVlEX11yMegv6EqHUe96TSNKkV+nCltowVaYFDe8JJDZFZcGbwfAXPKRYJr2WyxmUT4mSmX4CexGQYJIl+FW04o6Q4RuMXr+urYQrUyjnnHV+azVCYUPDHFIKAnlbglksPcFdc589kYlWHn8Rs8eNRjyiowVZKPUQUyHeM1aEAej1ZHWnXaiTLcHkhSzDSLBSpr3gadDbhkViujVRdHgq55SD0PCUe9W74Tm8CJOK0wBtc2FItj9BKGs42cvPZb2MN7q6o6t5aAyodlrU/8HjTVAVC2X/DvaI+F5K1ku7/E944iQI9vX1xqO4mEVHU1ZMIasYfLZAHgElVlOsLiqRKEKONWS6bn/wfQccY+ElNrKbjgQXzbl3JpBqvjyJbR2xbOapSSTa8eRUSgupL9/MoYiSXAqyGIl3LM5JeGmkt/WFk5Cm5widTUdVnVIngTLhFdRm2+9yrBYw3ZBQw2x/huEfXhGissAVK5wSedr/4VySUS/b1wiM1KzcaFqMUEK+zXX0LBpAhFn/ua7CbEKDggWCyRdLESk7wq+A== X-OriginatorOrg: Nvidia.com X-MS-Exchange-CrossTenant-Network-Message-Id: c4e3427b-f110-45c1-3f08-08dc5356d0a8 X-MS-Exchange-CrossTenant-AuthSource: BYAPR12MB2743.namprd12.prod.outlook.com X-MS-Exchange-CrossTenant-AuthAs: Internal X-MS-Exchange-CrossTenant-OriginalArrivalTime: 02 Apr 2024 20:52:31.4234 (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: +nfJil5YMKqEuBNA+dkQvY7PSL3y9atvV3P70fHfNZPqAKFFfeQ8v8TBgFC/HosvX8mWGI8N3mhXvSSGjHDz/A== X-MS-Exchange-Transport-CrossTenantHeadersStamped: MW3PR12MB4393 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}:')