From patchwork Sat Mar 9 08:44:35 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Rahul Rameshbabu X-Patchwork-Id: 13587532 X-Patchwork-Delegate: kuba@kernel.org Received: from NAM12-MW2-obe.outbound.protection.outlook.com (mail-mw2nam12on2044.outbound.protection.outlook.com [40.107.244.44]) (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 58B572D603; Sat, 9 Mar 2024 08:45:00 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=fail smtp.client-ip=40.107.244.44 ARC-Seal: i=2; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1709973902; cv=fail; b=DA0wK4YC6CPM4wCtDZLZRRulraP5x/gUR7knJzuv21hE4pprHlqF5fQhwPzvxjWzcla9EUHLZXK3RRpqCBTZKgvyDdTgqSgQ2rxAlw+F2Lhz8KQmRtRI/YRtG2EQ3KYtdbf/2Vo/ztSCDU+jeJmk9WtoDUXdzZ8qPXNoL+tMN3I= ARC-Message-Signature: i=2; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1709973902; c=relaxed/simple; bh=JRDWt4EGjmd0YtOuqx0r3pv3DIpAsjYBk09G5FwgP8w=; h=From:To:Cc:Subject:Date:Message-ID:In-Reply-To:References: Content-Type:MIME-Version; b=FugzRPzl/pE4OM43hlvoF2m3D4C/6tA1yaQlowjRX8O3k0/Hd8VF+HDEsd1TrUbV4SJgx9m55GQzJx1UIIfXRgUVZBW6fhFTscV2n+0zi1oWdcn6FRPLg3QPkZf0bbICCRq/F3j+jC0DSho06OglbJ6UISeuN6xAppMzrBW5l/4= 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=VUTukaRY; arc=fail smtp.client-ip=40.107.244.44 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="VUTukaRY" ARC-Seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=HuQephkNng46SbnOxUQnZe9zy4prShgUnfLSZc3sKz+uyxS3dlYsLVb+6Alnnh0YeeR5uzknwKkgn96HvQyAOA4cz57qJD1/HAUoC7WGvPwe/LxCvHtI/3A0Fr91Z+OBFpSBAzHEC129YOSkBoXl+0jL1E+oTP1CLJDDXexgs86AMtJDQG613N3UTDbT4ZfGOxWNeJj3NRihPK/oM+8ff+QUZsEdKtv0OOwHMA39OL2LjfSPCiMOKjzSBrJITJiLsQcEFfKKNP6KNT6M/EzhMJACRgNWmwVm2wV1QZkVbfi6AV3JPll7aAtHqyF5LpP1WZ8aUtudoPxcUX9DgQ6eMA== 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=I0OX826FMlvQ5XNt9IPcEa+pizUCnBKfzRzvDntygPc=; b=M1WzcGwgqVcstHYDitZBDueNwobG0wzhH1HcW/hQyXOEvkbaQ10STS7uZY2xoq24XP1yMkRR/4/sR1hVbORDuJnd6N0AokABKUrtuXZAGHvVIpE7dCInQrEAXQ6qFL1SoT1Kp+rXTJCWjoQp//LfL6sm6NuoWd0qO+I+84bzoMvwIi3vXhoqYMs1PtEItvMqKJLw+6gP1y+wIJdjOA7BJZHfEAFUlSOki7cVzIj4rggMJkVVrJy71LrbLJ0Ch2Ge/jvh9k/sbMXzSLFK7KphEXatDa6HWj90jIy1fYR4YHiKZyevSRFFnPz1yDuPAdlyp25ccMMwoIENvzF+et5Qcw== 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=I0OX826FMlvQ5XNt9IPcEa+pizUCnBKfzRzvDntygPc=; b=VUTukaRYeXbIB/fpjSmsF5lwd5fjgecdJJQwptiS1o+CQP+dpk+6OZg2wIXP7H+/cKLnhEPW1t9gyb045qcOP9UrDN5kgKbTA+e/CNM3LjgBRROXk5Kf0LXsincxLCkb84evis2ra07sSaC0vD/Jy8XQZ2Oa4cC8hWsM37CCq2JDuYBmm8nw+d4Uan/7lqv8g3kgfPJegdGGE+o46D7eUipz42mi0dvmqO+qmr6LrOift9ZHT2JV3Y+3Pt4TjH92LAjALyQAYxOvs6A4BoyeSTOHYIttXYMGicjkfsFn4pl4Fnw+jXRIoIkouc8cuswrJLKm1WE72YwXrNVz7AZQkQ== Authentication-Results: dkim=none (message not signed) header.d=none;dmarc=none action=none header.from=nvidia.com; Received: from BYAPR12MB2743.namprd12.prod.outlook.com (2603:10b6:a03:61::28) by CH3PR12MB9394.namprd12.prod.outlook.com (2603:10b6:610:1cf::11) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.7362.29; Sat, 9 Mar 2024 08:44:56 +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.7362.024; Sat, 9 Mar 2024 08:44:56 +0000 From: Rahul Rameshbabu To: rrameshbabu@nvidia.com Cc: ahmed.zaki@intel.com, aleksander.lobakin@intel.com, alexandre.torgue@foss.st.com, andrew@lunn.ch, 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, linux-doc@vger.kernel.org, linux-kernel@vger.kernel.org, liuhangbin@gmail.com, maxime.chevallier@bootlin.com, netdev@vger.kernel.org, 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 Subject: [PATCH RFC v2 1/6] ethtool: add interface to read Tx hardware timestamping statistics Date: Sat, 9 Mar 2024 00:44:35 -0800 Message-ID: <20240309084440.299358-2-rrameshbabu@nvidia.com> X-Mailer: git-send-email 2.42.0 In-Reply-To: <20240309084440.299358-1-rrameshbabu@nvidia.com> References: <20240223192658.45893-1-rrameshbabu@nvidia.com> <20240309084440.299358-1-rrameshbabu@nvidia.com> X-ClientProxiedBy: BYAPR05CA0051.namprd05.prod.outlook.com (2603:10b6:a03:74::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_|CH3PR12MB9394:EE_ X-MS-Office365-Filtering-Correlation-Id: 5831aebc-8746-41c6-d899-08dc401531cd X-MS-Exchange-SenderADCheck: 1 X-MS-Exchange-AntiSpam-Relay: 0 X-Microsoft-Antispam: BCL:0; X-Microsoft-Antispam-Message-Info: 9ihDgenn8pBJACRbcsEiBiv9vv9ZEVrbVJK9bwDGc7LVFvnbxxSrk+5lPVBtgmUseHDNLYladbMZiB1QHooelCsiOwSDfmBmUnT50wL7Ev41nqNLyHTkoA3XKtGleMtsIr0ZMJgEodZmICYMe0xLCCp5BirHfMdGaW3u0r40GvbcEjcQz/7/U9Dyldb+gyN7ckap8MnOBY2iGVP9Tu0J249x//Vuop5EPN83LTWcqa0+N/BpLxcZ1Y1KWcv6CfDlJ4rQfcL/e8ymZDeWUdM4+G7qAp3GWpKYBW4TZvJCKAFDZJdT9fyGGewo6AoHVgAO7jsVIi8rqUTeWPf4G22vAMdlKG9JblZAMGYsFq8+iLFZtCKFNf8t0qpCk82Lgj3nfq7NE8RApAqSEmeIe30z2z8/1TjyVLpvFz1CxK3Tj8HgCtFv1GoPUJ784Ki+oJfVrUsl+n86HpnDAImsLzn3SeIYe4A3Pd0FmVyHFrndonnIM4TnLcHboetz//rpEyfR3HJIcHGo6toZRKMiuhdciy3hlAaYXxgxNbTBPpPDJFbFhnvH9uuMDz7g4FNcpx/u4r9/uSMiidMazsSmlhMkx35QrJRQ2hOz0eIBHnvQtTTVAbKC+J4oNL1ksgpfulogxrsjUNhFgjdv70BY85AFsxPziCMrGtNA1aW81Z690n4= 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)(7416005)(1800799015);DIR:OUT;SFP:1101; X-MS-Exchange-AntiSpam-MessageData-ChunkCount: 1 X-MS-Exchange-AntiSpam-MessageData-0: jnGsR2U8F1RexY0kktASNoaoJqZxGw/yOWuKFIqD2Z+KsXuJV+YgQxHFEWRvWe2XPtHOt4+v6jJrJp9iaycXLReBpXosgnxoamp4IEafUhH9KCBcfZFS/JHaAdIonW5hOj5sjy7fIG7t6kMMOu6xMu4k5K6dNGU3AFLTH48cP9jbsW6xTYjFeGEImqLgYzj8B80e8UizevKRRdStXvNNHKOhXCYVsfvMjtgK074s1sUqLh9KIYCIt7gDkNyR8sr7A5cltxd9IE0gbSEn71C7H6EOm++gJj7WDnxjPJsQrhxc32MvOOz0QaMS8oObeVoSaK/HsFCfSBXJFYo+0Oa2NAQRd3RkeYSVaTx6V2jb7kRt601JrbPB3nAFFPOlKaK/K7f84qpShX7dKEIolphdOi35nDeXL4tL8reTNc4nJw9PFCcX/sOFRwVQh6frqMl2fUjKe98deyPMpi3W0893RUDF9Pa4TaSaWoSFXICfREqhPdjFXbQRicWe5Len91YfY+PJDkJTkD05w71sO0xZ3vdZdLa4XymAZAaE0uOztMiTnoNXaLidhSrepbuOyInJmuUetW688/BEWP4SejoQcvvFgqYER24F8xIKbBi8SpxmvJrdt3k40qVZhVA8cwC1+Hj54P7ZuWg26brWv2SqPMI5ul5Q1pwUaMS5R51Y9/k6cYczn8dKLsscm+WOBsZ5F5QhjftPmkfIS7+TX0GtGQ/9dbgsm5YOGXkKoT8MFpxAn2xa2UROSUsLOtCXskgQU+tssy1zl3YFYW3qSv4mfU+qIZW2ym0KOnYAwzAz1bcMYimZxqB+0bDNJFA8dskWDmWRMIz9/MAqqdHySpGHE2R/LbJBWAdI/nFc46HDVYyHezXOOHu+Yp8Po06jMbkjl4aeLeowque/Esk8B/6axeiqTLa8L6ASj6862BxBP3VL8lIbSRs+2yXBPWIp/3dSrtp0FJt2suPNTmf3RRuaZBQZCvFaIWS55lATua8yUksv/KyzLdLGuT5qOicnLMAFWljmH5e/19vSLU1IlmxRoLGGO722qL1ny/yox7t2M9YQwf2t95RjYkzLac41G0l3BJw06cK0d8X2YNsi2bUuMyU1ZrTDp9HVB0rz2yA77iZCsSpazR6RJAQPSnaTGZihapAx6jbR6O6a7kg/VdDYDK09ORfcJLEUQ1+9QqrCpAN+Wd2aFk743ZzpAT97lMFNHKTMhrj9xEcWdXGL6droF9rc2V2pt8cpYBlApB0KJU6Lm6lBQVSut/9qJXagqiXNOnDLCBdGKwljZgcVAD5xigKiX1evFYzqvJaK3c0yxSu9PM/3D6RwZr1fIqlvtPHJHHxsNdiYkQlRK5zh0glxoulGNJN2T3hGIz0uU2YXpIIT9H88tjt+NnlBwsyaDMQqUvBu3uNdR7juUYBZnvWr2SNrff6D3RA9geGb9T9hO7XqoR8PAwVjRyCesCdYtPmGee2fROFNZC7DwVAxFzr3txt2TanGsQMlakM6APs6tzGGcz/7mZqmOKifMEocjWjNd+z9DmbKLrxijfkCc0zcqrRv/KRoi6xzsQ6GNoQVHxKl5+YrBp4v7t6FjRTAZtAmw+aiP6draxswyOj6ylg8zg== X-OriginatorOrg: Nvidia.com X-MS-Exchange-CrossTenant-Network-Message-Id: 5831aebc-8746-41c6-d899-08dc401531cd X-MS-Exchange-CrossTenant-AuthSource: BYAPR12MB2743.namprd12.prod.outlook.com X-MS-Exchange-CrossTenant-AuthAs: Internal X-MS-Exchange-CrossTenant-OriginalArrivalTime: 09 Mar 2024 08:44:55.5093 (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: 4RxYZYq32jBDPOT1SADG6N6RymE1ETUxqxJhVPHNuqCqfJapfnQ9MiL5H1o46+Wgz5K+eD0OrpXrAYZxJDHY9Q== X-MS-Exchange-Transport-CrossTenantHeadersStamped: CH3PR12MB9394 X-Patchwork-Delegate: kuba@kernel.org X-Patchwork-State: RFC 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 --- Documentation/netlink/specs/ethtool.yaml | 20 +++++++++ include/linux/ethtool.h | 21 ++++++++++ include/uapi/linux/ethtool_netlink.h | 15 +++++++ net/ethtool/tsinfo.c | 52 +++++++++++++++++++++++- 4 files changed, 107 insertions(+), 1 deletion(-) diff --git a/Documentation/netlink/specs/ethtool.yaml b/Documentation/netlink/specs/ethtool.yaml index 197208f419dc..f99b003c78c0 100644 --- a/Documentation/netlink/specs/ethtool.yaml +++ b/Documentation/netlink/specs/ethtool.yaml @@ -559,6 +559,21 @@ attribute-sets: - name: tx-lpi-timer type: u32 + - + name: ts-stat + attributes: + - + name: pad + type: pad + - + name: tx-pkts + type: u64 + - + name: tx-lost + type: u64 + - + name: tx-err + type: u64 - name: tsinfo attributes: @@ -581,6 +596,10 @@ attribute-sets: - name: phc-index type: u32 + - + name: stats + type: nest + nested-attributes: ts-stat - name: cable-result attributes: @@ -1388,6 +1407,7 @@ operations: - tx-types - rx-filters - phc-index + - stats dump: *tsinfo-get-op - name: cable-test-act diff --git a/include/linux/ethtool.h b/include/linux/ethtool.h index b90c33607594..a1704938a6fb 100644 --- a/include/linux/ethtool.h +++ b/include/linux/ethtool.h @@ -483,6 +483,24 @@ 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 queried + * layer. + * @lost: Number of packet timestamps that failed to get applied on a + * packet by the queried layer. + * @err: Number of timestamping errors that occurred on the queried + * layer. + */ +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 @@ -759,6 +777,7 @@ struct ethtool_rxfh_param { * 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(). + * @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 @@ -901,6 +920,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..046a78d9421d 100644 --- a/include/uapi/linux/ethtool_netlink.h +++ b/include/uapi/linux/ethtool_netlink.h @@ -478,12 +478,27 @@ 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_PAD, + + ETHTOOL_A_TS_STAT_TX_PKT, /* array, u64 */ + ETHTOOL_A_TS_STAT_TX_LOST, /* array, u64 */ + ETHTOOL_A_TS_STAT_TX_ERR, /* array, 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..0d1370ded122 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_PAD + 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_u64_64bit(skb, attrtype, val, ETHTOOL_A_TS_STAT_PAD)) + 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_PKT) || + 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 Sat Mar 9 08:44:36 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Rahul Rameshbabu X-Patchwork-Id: 13587534 X-Patchwork-Delegate: kuba@kernel.org Received: from NAM12-MW2-obe.outbound.protection.outlook.com (mail-mw2nam12on2077.outbound.protection.outlook.com [40.107.244.77]) (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 1386438391; Sat, 9 Mar 2024 08:45:02 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=fail smtp.client-ip=40.107.244.77 ARC-Seal: i=2; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1709973906; cv=fail; b=sUwTDFN45kspXy8MrVm/FQk8naMKEB6a/T+Oy3Q8KuVg9XtgYP5xFln3RnsSs1nWyA89fRefk9v4uAoZ9Pbb29bREYvA8v2V3nMr+UMxaTxCUzcqzpAsgn1J3zHCpqLUy2UBuRVX859xqB/u1mKUL/e8JHrgpEbrl8TafUFfU3c= ARC-Message-Signature: i=2; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1709973906; c=relaxed/simple; bh=Gw1ihCHNwDGXu3omJz5gb4JIxKhd0pxJF2Us4AuhbZA=; h=From:To:Cc:Subject:Date:Message-ID:In-Reply-To:References: Content-Type:MIME-Version; b=hYFg5/z16vuZj4vgyZ58EuqMIaBsFWC3wD6q2S2Gdpg9UKpavI25QdwnUwjGcaJdflnYerygPvuhClP6rO6ov8XhxO96mFlIkgU0iB/Lv6SamkB/4iVvsSSsPss0lt1OJeBVAwmX0JmsVMy5Ij/31nydFnu7zB6htpDAVFYd7bw= 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=Z1gnZcpT; arc=fail smtp.client-ip=40.107.244.77 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="Z1gnZcpT" ARC-Seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=jQPIsykBhYDBFvSp/leiXNZXhOIZyGH+NeqP077PYVFdu3ivF1TsMzEYsbhKZn1ZrGuPZOvDhonoWzpai224O2QiRcLKaFSiF0dmlXhsxLIoN9GqTyxF9QC/GImISbHBrd62tERL2QHQyvVV/vioU4BDimGm38MbldZ/eSVwE9lXMkXNgxAoef4PSDIoO70/WP+k55GM6JN2Fz3mNZDqtUWK8ycVgO/bKIw374l2lOFW21bHym9pNg4OIFoYil9XRlehoI2uUYFFt1zv6+bPi4qaMsEaSQJwYD0kN78+Yl6FmO02mBAses9/xGuWoCHpzk3AK7XH16rP5w5b38JkEw== 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=Zfe8Ixs1TmZvYSGMbWnkoX0+FwKXN51Akjy4k7CR/RA=; b=LGxpBtItAH86LKOFubv4hT6PXKp5LIqOhQgpk1gZU5SjGDrnFBpr1wndcbHuxVizKu72JOid9S21u6HdP/HwgBX/e+nvuJlIPjiC1LSY5ECu/1fWYvm6xwDBz6FUsSHBpCt+Ih/1Y1OjzDlVZ5PrSLlWhtew26xbR/XeTX3+2N+XghQTvU3sirORT3+d+cXXj4JHL19CGFHIoVLwVXbeWEPpLzT3CjyGLumFRVyAO46uiVfRbzJv5u61Vm5hfNbNE3Wn/WpCcCWLiN+pze8/MdC9UUKFC+fma5fjKguR2+7J9LG7Vukm5z6lt2GvvK/cNSnPqn0CwbO6ztF2vY+MaA== 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=Zfe8Ixs1TmZvYSGMbWnkoX0+FwKXN51Akjy4k7CR/RA=; b=Z1gnZcpTgodeXaeNCNpgCFVqaHP0YV+EloaJ5p/1Pwn/bf5Ird5TiMirt2N0sHAM6fvOtuXYXVdsHOiLWYnF9P5QaXZ0gWxxoQI+pUWO2AfaSisXTgFipdEmOp2X9/qScI9TkBR9H5Aix2WqIuQ5lrEH7goDUh0PtnGA6soRVPV37clxYCZ+mBj3/OdNtLGEP/k/LDhKdWuJmS+cqreFaIG70zKq1F3fSuY09czn9v7duozJhvm17HvEhbV1yoCFtDxZLj9j59Tx27RLaB1yR9PY8W0k3sQopc0mTMJonflqF/EL77qzHmEmuAbmQQlp8w2CatsBy+ZCwnQoRVDNfw== Authentication-Results: dkim=none (message not signed) header.d=none;dmarc=none action=none header.from=nvidia.com; Received: from BYAPR12MB2743.namprd12.prod.outlook.com (2603:10b6:a03:61::28) by CH3PR12MB9394.namprd12.prod.outlook.com (2603:10b6:610:1cf::11) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.7362.29; Sat, 9 Mar 2024 08:44:56 +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.7362.024; Sat, 9 Mar 2024 08:44:56 +0000 From: Rahul Rameshbabu To: rrameshbabu@nvidia.com Cc: ahmed.zaki@intel.com, aleksander.lobakin@intel.com, alexandre.torgue@foss.st.com, andrew@lunn.ch, 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, linux-doc@vger.kernel.org, linux-kernel@vger.kernel.org, liuhangbin@gmail.com, maxime.chevallier@bootlin.com, netdev@vger.kernel.org, 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, Saeed Mahameed Subject: [PATCH RFC v2 2/6] net/mlx5e: Introduce lost_cqe statistic counter for PTP Tx port timestamping CQ Date: Sat, 9 Mar 2024 00:44:36 -0800 Message-ID: <20240309084440.299358-3-rrameshbabu@nvidia.com> X-Mailer: git-send-email 2.42.0 In-Reply-To: <20240309084440.299358-1-rrameshbabu@nvidia.com> References: <20240223192658.45893-1-rrameshbabu@nvidia.com> <20240309084440.299358-1-rrameshbabu@nvidia.com> X-ClientProxiedBy: SJ0PR03CA0054.namprd03.prod.outlook.com (2603:10b6:a03:33e::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_|CH3PR12MB9394:EE_ X-MS-Office365-Filtering-Correlation-Id: 8922ad58-ca86-40a0-ad3a-08dc40153253 X-MS-Exchange-SenderADCheck: 1 X-MS-Exchange-AntiSpam-Relay: 0 X-Microsoft-Antispam: BCL:0; X-Microsoft-Antispam-Message-Info: s1Sc2mDHh1c/Ef3m56LeuF/hE7Xh5MUlfQlYCXKtWF42liwK8rcb5ecM5WiXa179OZVGR+Rm0Q2PtJM0Gj+5bSDmYlBCv+8F1CrXh5pBmHLaqOfnG/BgKxfmBX8b4FFBGG3BUSG13yDmsO9d+pRKgi78EvrIaWvmKdsAA9XsnzCPGKiR+J14hcx2TawPD33ClTj6Kp/+RlAVXql4dS5AJ44SeFjudgmqhQZJPOVvvkzhHSl2b6/kUP2BJsxXxnbMS5iapzOgnmKnOJ5FXDQ291JqHxTwwdAYYUoK2hn4AFkYdVLLmgj67YDwFuPnbe6BNQX2Wfh747vcFKcvw6Fb1OgzSwuxSRzuHbKOm+ddldl01hskd9+o+maxPnLXSfN4+Uf/iB6ahyD5O1wPO2h7hl0xSRNsUSleH/uMEIFHPvfocX5y9Bmywf1kIIZtdfeZDgkDyO0NntSVIAIElQSOy/abQ2HrszEo6UC11HwVn4dP4fyWywS7IqHOIkHl+bZJHsh+XNnvJulSF+/ZXIeXDVj2R3O7Dn07ixaqqCz19Bnd3vo0Wm64HV2HpOuED7c8Nh/engB0pkZXKElzSb3dWrUQOWnRy+H1XIIVaTeA81sZhZKqWmXnKoKKkHxulGlXvRLXQ10wnNzuQ/a+qTrt4v4cro845O1BbQdvupxGhic= 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)(7416005)(1800799015);DIR:OUT;SFP:1101; X-MS-Exchange-AntiSpam-MessageData-ChunkCount: 1 X-MS-Exchange-AntiSpam-MessageData-0: 8lOi2hH6tsq/A3KOPh3uuRSnI6cPLNph+ju3VJLhTxpJmbT63CEIWgCqYFigxJemNowF4mFSk1OeZGMeegLVvCqRZyxP5TWV6flgki9HUMzDT/GXVoJLhIyWjWoEa5jcDljz/o8ckKVw+lIK2qDSnwSaifMBWZiv+NsXe0MDM6KUUBqYNPuxU68EMnDyitd0kdx8Cyg81qZF4E234kMOKi+P1TRifvW7voAQKPLtQO9XUY/OVCdTn9YcJHBD8ri2uq+7iGixGA4YbpuqA/VOE9zX+eldB3P8ynTbG0VFwJmDqOKdQJRetndVqIWprlbNaGOzxYNB8TKYed1k++ggW8jtAajGvtWycUtRcPUxG98MjXqxEhmdn59Epep9WEFXq+Tml4FQcJel/W/L0yQgj5Fa79pe1PzEXTC2c8fZDcCsMhxGIoDQ2vRUAbhpaRr9iVK8f3V7FOak86Y/nTNOvPUOI6+jrIbMZ3D4sK1GT2UF/M4FPVPFsF8CfRx6C9UuzGW7JwBnuR0zQoXfe5FMUuQRbxg/DKCrRcWCjUtMT+1uWW8OgjejpSdnzH8v7+MIE0YgCRnaAmzdpKGMIBw3XP7ahbfQ+PapY5RAq3LJLUn3JI/v+ML0mhyhDp1GypEmcSLDrZXgaNEaN/waI2FOtCfIB88aJf9RxvglPz5YhmPlOg4DePpds1ADH1VQWSzz6/rJLuqB7MRiTnWEsEHmtAF74B81uXWlYn5jg7sUxuBNqQQG2vV4aasAVczL8tKhr4tU4DgxG/jbTyhhAT8tceXSthH1nXVlh9JuHtBq9t2aWc6z7UqsU7UarP2vleTAJRKg/6OeyHTzhUjOaKrESQ/UxlCEpNSoDqtk4uz6djalRCaWm5v8JyLRpvDuHVTU4xkbKprl9meZZZMpN2uStGuJCsudJdUUmFVR+OlbOQDup1QUMOZy7ri0ZA9FGMSwPUrjwEZ/wXOP1zg8L2h1/UEcd1RSvCUtwuPve6Df09OnpAs3jywvwGvOzBgzFq5s9PU50xddR/7kBF0+G+mW9K866O5+RQkFfUZo/nqD9DTxKQ8O7MDJfzSPX4CrknBkbGUPBxNZUgwSGtpfdoKqRD9k4kDHgnqqb6cEVz2mTo/oaDTAwOqblzjdUU00DnlfnCr5WWG2Af4yexx6rFj0rfM9A5yOjmAbbbiC4YVGOtVgmVtcaQY1pccMuo1iIR3vAsvHTF5d12sQxYpYMrACiBFiFajERyM61myYhXE7H9Nx+aIrsyzemP9AYaA0eeJxvkjHC3nfU6lFJPYuYm5/opOO77uDC52s+4Ipy3OdyJX2NvkeIx9pdkI1ZnSBvTgLG8BH9b0XJKAeZlxEuys3to4bWXQfoooCHGkL69LxZP38DHaAGr5yVoKzA1nP9pMgmwxNVkUbf9Vfs0Rn5mqn7+l+pd3/ynMzl2grg4Lp8FcOa44odsVcqVZYSQj1r28rGFifO0KzDYTqgyIK92uTInhyN1V8LFcjAr+vgTovAZ9dU1Dcz/qmDbshvNgc+/sYUfmNfBKr7ffbfPn0UJniEC57C4QBn+E6kCfykdEd+0z+ENeZqjXk+oQDPEjc2WOvv751RUtbjKwpNibfCZY0CA== X-OriginatorOrg: Nvidia.com X-MS-Exchange-CrossTenant-Network-Message-Id: 8922ad58-ca86-40a0-ad3a-08dc40153253 X-MS-Exchange-CrossTenant-AuthSource: BYAPR12MB2743.namprd12.prod.outlook.com X-MS-Exchange-CrossTenant-AuthAs: Internal X-MS-Exchange-CrossTenant-OriginalArrivalTime: 09 Mar 2024 08:44:56.4011 (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: jyH4pHdWEcddYapr7xj5lcZCdbNktwGvjBoU0m0YIXhBO4zGw0Kt9TJtPMNEyxA1aFr3+D5Ebwyovd5qZplWyA== X-MS-Exchange-Transport-CrossTenantHeadersStamped: CH3PR12MB9394 X-Patchwork-Delegate: kuba@kernel.org X-Patchwork-State: RFC 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 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 fd4ef6431142..1dd4bf7f7dbe 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(&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 4b96ad657145..7e63d7c88894 100644 --- a/drivers/net/ethernet/mellanox/mlx5/core/en_stats.c +++ b/drivers/net/ethernet/mellanox/mlx5/core/en_stats.c @@ -2158,6 +2158,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 Sat Mar 9 08:44:37 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Rahul Rameshbabu X-Patchwork-Id: 13587533 X-Patchwork-Delegate: kuba@kernel.org Received: from NAM12-MW2-obe.outbound.protection.outlook.com (mail-mw2nam12on2044.outbound.protection.outlook.com [40.107.244.44]) (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 4613B37700; Sat, 9 Mar 2024 08:45:02 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=fail smtp.client-ip=40.107.244.44 ARC-Seal: i=2; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1709973904; cv=fail; b=Cw7khqgx0Rwt7Ps9fSPbVLtgsKjLp/3T5hquaCe7NxdmWZHZptsSTk8tkCBQq01yQcRwY8FS8PX+/XbiyossUKUTE1RQznn6t2SCo7/u2dgpE+g36WPAawV4UmcpLFt7QFoGzYeo6YpLXxVm6falUBZ9PHv9GpntzatS6cGgxwU= ARC-Message-Signature: i=2; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1709973904; c=relaxed/simple; bh=+XeEF5l/dtKxjpNYHuL7oJXguX+pvqJFoKNmsDwsa4s=; h=From:To:Cc:Subject:Date:Message-ID:In-Reply-To:References: Content-Type:MIME-Version; b=qcKHzojo/LUL7SY9YeSngnyK9ZpaKxpc8uSkfb4CNGumCyci/cMe7+8IVeu8yMGbDX0hZpWM+QlwmVcjaXPadDjXm6RBvX3NUocvVPYzHVuF+ca+NZh1IoQCNUarF0RzpLq3TwvvDZvfujAjz+0TpLxdc1SU/4jO+Uxq1xp2iuE= 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=G+zmhUSL; arc=fail smtp.client-ip=40.107.244.44 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="G+zmhUSL" ARC-Seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=RMEghy+S6BNYywfaCXjxLEGq8GvA8CbTbkFStFpqHXsrYkihSy5iQ7ljkmMRPp9jCm++f/eLVCKHlr4g9UtiUdywVonfrG+KjPeQcLBIq2mwU519nUeNjpTERX/kdZ6bu8Tp4k6lWybR2SejJlrTxwXSlwfb3btyMsFGq0/Ls1O8+UfqMwLlBipA2fMXG0XBUxbQMVHMycpwUIGmDVuG2GHieQ2sBOCV+WEms9WzNnRgbAGGzgvXuDI1T3ACnooirUohGKO92JUgGDTYAJRQ1VwNL3JTUJNB+Ng+W0oDQ+sZ6cvBx4orAPqwI/vLAC1J+EIbQOSeEvu5ma9tYlfOrQ== 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=QkMhlXsZodMWj8/aoxD22aQBNWGK9U04LHyjFE/QseI=; b=Hs4oqcUwk9zl16UwqQ0LLf+JFjiHP9oWs5cBdRo5ySsEcIgSrhAoHIwokfFzWcGwl8bcgWtiBFybC+nHBO59NvOEkV3gEtm82/LCe3J6RP5WoQOVL7x3thLJrL3XIY82NiR2xXAZl4HYO+lQ+ExXQLvxnjCFiQSoENm0C4kGNFpvqU3XHoERQDf4Pres+deA+AUKRXVxTe/qWlm/PAcVoPqBy7DQbaHudtTsJW/nmnAtsTQj0MUc+QsbXSrwkugBJ6FYbsVw8+jMeeJ6tlVgjAJ+6bUxJ/t+HqtV1QZr/opEuaRq+HFHREswSEYOEt5ijN+Sv1bDzwRDz2bliURAOw== 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=QkMhlXsZodMWj8/aoxD22aQBNWGK9U04LHyjFE/QseI=; b=G+zmhUSLGG48GUptxepHcWrbRCjbocnzf7hIhkXun1ti8w4KIuvFxZYg5ZnDBi6dRLcV5wcvZrNu6F+urIsEEnswghEIfYJwO0yeGc/LNzROI4cCXAP6g2FTr1WgXmXWg0h4wB5yyPsBv8gXimMVUTJWs31j2M6SiWEOe5XoVVdkLcrzFOMHWR+K9htexrNnPhOjTSB3hxQ8EEGfRj3Dl44Cij6Z8Mi84Ni0MdJuQqcwaHnMtBrNuuGOtjdyPs6WHARGGaSSa8++pMnVxbZdwsUpRunjha1YyrQYlNErcMOmCsTLgOaCpUCP32asKu9pnaVWLlxPAYeMIsCrKlCFrQ== Authentication-Results: dkim=none (message not signed) header.d=none;dmarc=none action=none header.from=nvidia.com; Received: from BYAPR12MB2743.namprd12.prod.outlook.com (2603:10b6:a03:61::28) by CH3PR12MB9394.namprd12.prod.outlook.com (2603:10b6:610:1cf::11) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.7362.29; Sat, 9 Mar 2024 08:44:57 +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.7362.024; Sat, 9 Mar 2024 08:44:57 +0000 From: Rahul Rameshbabu To: rrameshbabu@nvidia.com Cc: ahmed.zaki@intel.com, aleksander.lobakin@intel.com, alexandre.torgue@foss.st.com, andrew@lunn.ch, 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, linux-doc@vger.kernel.org, linux-kernel@vger.kernel.org, liuhangbin@gmail.com, maxime.chevallier@bootlin.com, netdev@vger.kernel.org, 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 Subject: [PATCH RFC v2 3/6] net/mlx5e: Introduce timestamps statistic counter for Tx DMA layer Date: Sat, 9 Mar 2024 00:44:37 -0800 Message-ID: <20240309084440.299358-4-rrameshbabu@nvidia.com> X-Mailer: git-send-email 2.42.0 In-Reply-To: <20240309084440.299358-1-rrameshbabu@nvidia.com> References: <20240223192658.45893-1-rrameshbabu@nvidia.com> <20240309084440.299358-1-rrameshbabu@nvidia.com> X-ClientProxiedBy: SJ0PR03CA0069.namprd03.prod.outlook.com (2603:10b6:a03:331::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_|CH3PR12MB9394:EE_ X-MS-Office365-Filtering-Correlation-Id: 5ae9d297-2aff-42f0-9346-08dc401532e3 X-MS-Exchange-SenderADCheck: 1 X-MS-Exchange-AntiSpam-Relay: 0 X-Microsoft-Antispam: BCL:0; X-Microsoft-Antispam-Message-Info: SNlQ4eLX2cEJmZJxfcLRmZH3W+IDtEE5vvV4lZelCaHb4abnUhbcHkBBmN3KCPaO1HSlvMumf2uk20SxjDnQBIPrVRtAkR7HEYwPeMqoLQWXajZYL9zLJJCAWZD+IgioWT6+C2e5mxuzdcdzDWMoab4MowhvAla0rIuNjztQmJ1ptvZPy1BImuXXswR2ThTdGL4CEByjYm7ZW3ImLJm0OQqciiXzPF7f0kLJAigdjF0DKDRdwST4fgeIOdpZsNCVf68La0725O3rDp/duDo55FxWkxklIYbhzaapKOsPO2fsJUthL3IGk/QTUV6aogGf/V0pDJM5GjBq29+4+mEmg/4kCE/OYx4ffZ2PCoNpgIV0kt+YtIOGgks2pOTn1HwrFmc7Qy3ckagJLHSPi2S3+5AmzE3rQR2gEnzbfPsmq39Qa+GKnjgTfifbN3EyuTGgHN0o4BlxzmBDL33GEktFgaw1w/wZIrFeXRSlRG+k8r/Fac8Lh442OxCrjDVkYFXJI1+t+Gb3WMf/FLBywpOZ10GcyNcBMx+CJMbiG2bPF6S5ztkFhbiYOzmenrBjk8jYYWHUk6wR9qNJL8JQHP7tTlcua9f3By80dsIi/TxjBQsvj7OGA0L91+Hxn1cZ8i/HN+HVEzoZT/4Ps5Mmr6lu2dQqyrjyYVzafYWHSDsQMBk= 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)(7416005)(1800799015);DIR:OUT;SFP:1101; X-MS-Exchange-AntiSpam-MessageData-ChunkCount: 1 X-MS-Exchange-AntiSpam-MessageData-0: man5AUH11nHWLpaBo8adj6z4kmXDm2hu3phwD7tJFq8W7DRNVScQMARrt3QYhXtNCJkPm3x0fEBLZHXg1yAzGsnFKSGKMBy01GasS1wY2mB6GT9lxjdY90ErFE0qzMcuSiAK+HqG+cSZlQcEVPd5loxyL0oRC8Rxw5AtZYSyyQ4PePmu9ovrdxSjhFgkUv+qNpvt8mGuK9Z6/zTzuY7LdEv0rWLPToqqUP2KXIDCnZO/F7sd/V9Gle+k7/tgik0L1CN+2HqPhFlUYlmQ+agOhZ0NXe8vQkaSF0hnVyKFjtFrFjPRRqSAboV/YoRsy0dDZ3hm0zjVEf67teAyYUQXXqrvuov8G+qSvckLRSLlOYDvh3etsS6q9Z/7jwPmYkV1/BixdwZ4+rJFqiGMSd2jREzvABrdcoxRyTRy6t5tWPb8RG6preHEHJCh9zePkA5mYdrD+B933FlfYiv+k1TvIuLhDmqzmsoIW86MdUed/qzr/MaOx1L/FkbnNm2EPZaZ3XN5Rg1ACVMdrkCDy2pKzEopkzqIQ2eer9YKYLl1silIWXutQJFHcJBclMZ8tnR+azeyfvMGxwfEPRYP5DPQWsKGAYnKqCoxMVEp/pZTP/etfWIvv+zhe/qsG7Yzg5W+aoGlj6jGDRf5CNuPWyuh0j9/yP5rbqjy2bxnE3u+ouMw2Q4m28xNqWe2YcW6yJayuEIgsjTu44t9BPvM0HuU167+LwwgJxceeOF5qr/ZGYH+T/ov/tf02V1pmm0BvhG5StgVEwXGiPyRW0mO/zH3uYFyStGSF1Iwwl5zLSQfqeplGiC8oJwIVl3BgK+I84yk8hb+PEnuNdniMAfTjUkqA3IB/ul3swJ0klgVODIEt4G1MO5wE8PT6L/uyThhHAntk/qJ0pNwWJKxMJFDEFW6ZRLvSPtaFDd6auFWIqZiC2ASxdbm5o/gHZtKg7CCO2fWVdFH+3y0Vf/kcV/eT8N8V/XMvT7ydNt0XEdo1jxZdeXLAfFcfSaJisbPxa2eC/F2qaoStwruFwrL3sLuxsy4EBdR9jo3yMuF7yMz+yB03OwPOE9l8KYexhusm20fTRU7a7HKnGK6hfEfjPgHxJSaVtmAuLvmK0dCFn/tdVIGNa4PJnYYKHPYd6089vpw7+cYWpwP/Ahr3PawxwfNYKMDwYrxbpdW1xRc6QT4Ol91BWpxmx1uk1ZQ7Rx+wseGuN9K/84m9BrX6whrqsbBoAgWtbnNHcLIva7LjqYAgh5iPEF3L/DB1v/+E5vSgX+LD/Bj6+V2lxhCDrfW4ReNHThbwOeK0+y+bNVhQb+H6jMJSlS7pm8VCLRcP4G/sGcac+FiYp3fDeKd7IW0nNeQrf6wiTeaJhFQiNUfVMIc+O30zsjLwm/A44q+ySjbkg8XBHiaeOGftdobEox/bQCny1WAvk+TuOXNqalYQxLvom35ylzFd79Kn12cxZ66bqrh5bkU5NGuLaEzjAKHheuGP60QFIWF0qHgL2hcn79vsTJnGPKyo6IUz1i8aul+73GNOIb9Pm8YoFT4HnY4eOVfUefQGD1YrfbjGkYdJ8SLgd6P3P9RmTGBBetWhXZNN+BQk+vaPpqIxHSXFi05OeK/1ifgVQ== X-OriginatorOrg: Nvidia.com X-MS-Exchange-CrossTenant-Network-Message-Id: 5ae9d297-2aff-42f0-9346-08dc401532e3 X-MS-Exchange-CrossTenant-AuthSource: BYAPR12MB2743.namprd12.prod.outlook.com X-MS-Exchange-CrossTenant-AuthAs: Internal X-MS-Exchange-CrossTenant-OriginalArrivalTime: 09 Mar 2024 08:44:57.3947 (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: oEkB38Conwe5FeCbMerGIG2Kr/UZDg8Rjlv5J3pB1iLPBhL1NN88Bmwqitee5TSGCRNYxPYrXm0qVqugJ2i0kg== X-MS-Exchange-Transport-CrossTenantHeadersStamped: CH3PR12MB9394 X-Patchwork-Delegate: kuba@kernel.org X-Patchwork-State: RFC Count number of transmitted packets that were hardware timestamped at the device DMA layer. Signed-off-by: Rahul Rameshbabu --- .../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 7e63d7c88894..bc31196d348a 100644 --- a/drivers/net/ethernet/mellanox/mlx5/core/en_stats.c +++ b/drivers/net/ethernet/mellanox/mlx5/core/en_stats.c @@ -2046,6 +2046,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 @@ -2198,6 +2199,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 5c166d9d2dca..5acba323246e 100644 --- a/drivers/net/ethernet/mellanox/mlx5/core/en_tx.c +++ b/drivers/net/ethernet/mellanox/mlx5/core/en_tx.c @@ -748,11 +748,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 Sat Mar 9 08:44:38 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Rahul Rameshbabu X-Patchwork-Id: 13587535 X-Patchwork-Delegate: kuba@kernel.org Received: from NAM12-MW2-obe.outbound.protection.outlook.com (mail-mw2nam12on2044.outbound.protection.outlook.com [40.107.244.44]) (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 559C8383A4; Sat, 9 Mar 2024 08:45:04 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=fail smtp.client-ip=40.107.244.44 ARC-Seal: i=2; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1709973906; cv=fail; b=DM3HDN71wkY5fZv3HhAlE/kSSXAlLtspty8BEE945gMm3BtfpMSVxlYIla2RphJ3mKPqEu1t1SPaOOGOAHgcBXyE+rrCBDV2Mk42vH8Fqo6YnJ50xDzLcGZokcaYtDPl8Cqtj19Qo73kq7+B0JsaX5zxDvNI4X8VQ3DBYqpF5jQ= ARC-Message-Signature: i=2; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1709973906; c=relaxed/simple; bh=iFNnJ0bKa83se8+RVz1QiXLm1qvQhKh9LkXMUQJyB4g=; h=From:To:Cc:Subject:Date:Message-ID:In-Reply-To:References: Content-Type:MIME-Version; b=RIPdhYlATizI+gRRApZDwhW+dqkv3uL9vuHICBPXtU6ouEQs/AzsCKuk44VdBxwIF2PAJzEf79ZecxAfBsH4ozAKPRDK6WaLCrXAx6I8h1NYpIa9xlG5cQW/pDkh/uzNlU+aPDZq7HdiynpoSMuFjmb9Q6NVPTNR2mR3XgKdGS4= 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=oOFnVzCt; arc=fail smtp.client-ip=40.107.244.44 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="oOFnVzCt" ARC-Seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=cKuytNgDQ6QyBVwdND3uUGyC+w3ibr4310FMorxW6x0rdlBwI91gk2FyBW1te8wSJymjp/ODcFSHXrbQBQKhb8EPOHlVYIVdPKQWUUc9UbqNXUDwFN7mindZKUxkWIE9nziOiibvxaG7pxm6In3mIZN/tDJAL+Ev21HEhcH9CWr7EIjtHelX3CDqxk667/IQUDNbk7m7oO6Ci1EpCCZOa7pEeufBFoWoGlWY/AmK0L5qINzaQOQybyc/Iwd6HtYhEPIkw0U+8MiCntfQquK4X6t3dnxH+VWRaehyXjSv1gFipAiSDO8wV6JMuPmUQrOnGlth1yjDO1jXy8rQL8xZSg== 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=wzktG3mbT3nH0+Ki/CyAOzoqSEJtEFXbQImRnJ3RQ5w=; b=jLUEq0HQlIyX0wOm9ETq8z5PK+oT42unABO1/q3vQsp6HCKjSUY/zq8gKZ0o86OeMHFxrxhZbRbO5eD3S65M1pmwKjMfgOAVpSymmJ6EIeakCjOalC/odSGYIu7wWN5LuV1qaQdOX7HVcQQ5g0wrOdOccBVQlT/JTCBPye78sKzpszwADvPraXllM3QKpPoKgsdQHBCcjFQi4Wunub3Jb3ChzU85QaQAvEG2jY8RwUIyJ3rnC2m45nV88CLHeFYERVae2epMIXRJ1OtB78Ee/GX5pwFuVYALQAMejDNBx0QjoC/3Nn5k48xYo5GFka5V6kOWcrexPIMcPGutzbnNMw== 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=wzktG3mbT3nH0+Ki/CyAOzoqSEJtEFXbQImRnJ3RQ5w=; b=oOFnVzCtE89iXQIF1Bv6hR3Q0NNCqwYh2iK7XMZ0knf1VAoMRFe6x3YnIMeSUVCpMItka4x8a7P5mzEUx/Bqx96fnl2fWkJgQicEWHMI3FAcdQyZZTdj4hWtkh7dmmpJSL9NCO1Pfqu1OxwPy4pZFvoueE+B+VLMgIGIGS7n7gsynChybmpE+pywkMTXaVYxDsYRC6hdcufjmaLv77xxh91VJ8YZ5DvSqe3Pw/dRUt+saZrKWpQQ9xgHpFN2HJz5+fB5HF8XPLqS1pv4bVk9Zlvu6X+Km1IZQSvr+YIpQHW1tMMrNYbZBtBQbaj3kc2g5VNeO07KIX9zrFRl5GiaRw== Authentication-Results: dkim=none (message not signed) header.d=none;dmarc=none action=none header.from=nvidia.com; Received: from BYAPR12MB2743.namprd12.prod.outlook.com (2603:10b6:a03:61::28) by CH3PR12MB9394.namprd12.prod.outlook.com (2603:10b6:610:1cf::11) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.7362.29; Sat, 9 Mar 2024 08:44:58 +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.7362.024; Sat, 9 Mar 2024 08:44:58 +0000 From: Rahul Rameshbabu To: rrameshbabu@nvidia.com Cc: ahmed.zaki@intel.com, aleksander.lobakin@intel.com, alexandre.torgue@foss.st.com, andrew@lunn.ch, 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, linux-doc@vger.kernel.org, linux-kernel@vger.kernel.org, liuhangbin@gmail.com, maxime.chevallier@bootlin.com, netdev@vger.kernel.org, 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 Subject: [PATCH RFC v2 4/6] net/mlx5e: Implement ethtool hardware timestamping statistics Date: Sat, 9 Mar 2024 00:44:38 -0800 Message-ID: <20240309084440.299358-5-rrameshbabu@nvidia.com> X-Mailer: git-send-email 2.42.0 In-Reply-To: <20240309084440.299358-1-rrameshbabu@nvidia.com> References: <20240223192658.45893-1-rrameshbabu@nvidia.com> <20240309084440.299358-1-rrameshbabu@nvidia.com> X-ClientProxiedBy: SJ0PR03CA0039.namprd03.prod.outlook.com (2603:10b6:a03:33e::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_|CH3PR12MB9394:EE_ X-MS-Office365-Filtering-Correlation-Id: bc2091ae-6028-4ba2-4d11-08dc4015337f X-MS-Exchange-SenderADCheck: 1 X-MS-Exchange-AntiSpam-Relay: 0 X-Microsoft-Antispam: BCL:0; X-Microsoft-Antispam-Message-Info: d53DZIugALo7qXvsZYlAyC9cMXy0d/PXCp5KVxoEYD713CZD50DlWqHXqxl0jKy08y8tmJupQC5aRdGtiY3tx6NOkjFnBbR1IugXmPPEVH0LntxoRp0wAsDU9q1Td7LbVM4ElfRbwziFWOQXHEg3t2q3hmxz8YfGT34mD36KnA6uVxUN+jJsT7zPUHquuBqUEIkEXkgsJJlXOP4OiirD4FxQ960iMLx5fqUxTQF6AaJWb4e1NFZQ0es/Fk1PLqDh+UxaS/LCVKeAnZlPcNkiwHCXml/eC0GO+wbRqLZe+fMeuF26Yd7r8mSiA/iQhr8qtvObhX28uzbaaUV78nYTh4+xlxxGWYuknImkmGVI3Viek3A5wODtoj7E9t7YwGgxo+sgmkEuOSGP1cZrJ58ZHVHX7oBD9nOmeOiAOFqsYEjRyrFmeZBRMHPb9pBmhXl+GBZragYYTLor/S7ZMPaUa/mIaD1Frz8jlu1B1nhWTDadc3nR4wgaLdiH5IDvqpRE3/5KU8eOyY9xOJmP5fUs+hCdEkJkbW4ABbsajmFILocSDFcxoNIJJjGeoGaZwgs5mlBI+mYLvOrx/+Pqpu3W9LZkFVR5PiAu5q8uAeqcfUsnQqUCpXWBF5tFRyGemllXlkZ+UHsA8sC3AZBP0qjeMKGLn25MnoCR9/bFE15zAYU= 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)(7416005)(1800799015);DIR:OUT;SFP:1101; X-MS-Exchange-AntiSpam-MessageData-ChunkCount: 1 X-MS-Exchange-AntiSpam-MessageData-0: VvU+fYRKk+b7SEyxxLW/DMkpfIuwwLu9DlD560J6jnu8lbeBlA7t9jB4S9iWP/ipWBNouiGj3xCXf4ldECxcriFg03KzlXhzCoPLqex9jGX8lF2BwYS5UCp/iD/kX9qrdGaeJmWQM0heMFrkcrGZFkK+ocaHvUwKRXJlJ0ytL59vjjgW0LKanuTrFyzfplvORfmWJLRixj/PjNovXQEt5KvhZq0m55K6AGL4bxDX9H9/Gk2lKJVDSdzCjT1D+xmDi7LkRUnIvNjxg4lpz7sY1ZEePPWCknL1nmQxxN1bi1NupamY4L4gTCwBF/bRlWuxhki7/pqWvsc7CdppBk1xdU7uYWiucW6tigtQavIiDql9mPG82oOtB/+8KZf7LDsux4ohNVuev4jCkf9xuW/euxB4QEh++/FSM7JjsZsW6LlIDCd3k5IOmPmC9L4gYa0MejoogPabPa3DDad7Upsnp9io26DNmFlaiQ+mY3puZpRSwcknSGErJ1iq2xuEBAaAgp/8yxv3bWRS0KhTQnOOCfPfAQPsvJcEoJwm5S/SxzU7j/xHaFmsOOYzmm0p/6XeTIAOT+eXLQYncOKMHiUiG3tiGZX6be2eFUp52OiIalQ3oEemmP7W/tHZcpHWLxsmGFFw3WJt/yIxaYuP2Ejl8baukb807rKhb30vkH4q+ZHHPeUFPOlUt6XMvQOnsK1tgxrlW0ckkXfd2YqOSnrtrHEkocrTtr7GongMAEntp4R5pcS1Il9i4yyW7YQt/u0oVy7Ah4r0hgzOUOxOSpTz/Pq/CayYPD7CrmrsbFdDOP7UOOeVKAE/hl+U4Ytzs+QEAQSewigLu9F1d3QS9H4/xHpoz2A0fFTBq/+LkOfy6BAYa9scGJ18mGFwHtyR9qrhAcYopzhOFUb7bviNa37yVnzMOygZfJapa7qFJU0bay7u27OukCPVoQI6ojzgqdmuWMNAzn4sWoUcarAMLF/FIHvoCIQvnW4DVKWYTdjRYRKs9gUL9GUrHRmjN7bX2cqtmINYV5ij8RnZl0SkEdw3kwQ5DWrI5QRIscGJtH++ycxzx70VcK4ncaUrJHu6xQe/93pGs+Kp5c3WT4SP5OCn1gOafDegMj/fPcOGuB4u9WjYizBAjKZw2y3NlZ1vWJ6nL4JY0YaaJZ2p08oY41uvitLloXjReP89ZYijIpKF2bkFA0JrhAgJqcytKKVjkBiNi0/3shhwe0B+Lkh2dZnZl/+vnMswS7T3A2D7FGl8Qshz8LsxdyOx8Jpk+jM4CP3f/497V0Kds1awqOwOKtx/liCn+DW4swVz6dfOUzqZSw+Qix2A4zmNVHksVemYxZyOcoedCPRWhXj95CT2OxopQR/3hsuDlIkysgyPIDqpDN1uqD9RoeBqKlRN2p9C25Q7mEjkjTpppaF7kWS2n3/SkqpenSfkKt1LgcvwKcMrn/JH3HDnAfkUCKN8RHMHD5X/rgi/DBklFegdYbdYmSZ1kDB2GYp/psnMPmdsi6C8T5aeiXtf/sEnqVTIEyyYWciY1FmZ56Y6mBbHTjpSK9kMxwthL4lEW9Lk2piHwbDoFggcwel31uGP9Llj13vUQqEGBoAytp7vG5TU7CpH/0EW3w== X-OriginatorOrg: Nvidia.com X-MS-Exchange-CrossTenant-Network-Message-Id: bc2091ae-6028-4ba2-4d11-08dc4015337f X-MS-Exchange-CrossTenant-AuthSource: BYAPR12MB2743.namprd12.prod.outlook.com X-MS-Exchange-CrossTenant-AuthAs: Internal X-MS-Exchange-CrossTenant-OriginalArrivalTime: 09 Mar 2024 08:44:58.3448 (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: iDoug1AGUUta6YJ5HBhSGhj6ju1xrsxVIboRQRuU7i/9HdZi4UVCu3qPp528Q3ll+eTGajU/rl+K9TZiYxyTHQ== X-MS-Exchange-Transport-CrossTenantHeadersStamped: CH3PR12MB9394 X-Patchwork-Delegate: kuba@kernel.org X-Patchwork-State: RFC Feed driver statistics counters related to hardware timestamping to standardized ethtool hardware timestamping statistics group. Signed-off-by: Rahul Rameshbabu --- .../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 bc31196d348a..465c1423528f 100644 --- a/drivers/net/ethernet/mellanox/mlx5/core/en_stats.c +++ b/drivers/net/ethernet/mellanox/mlx5/core/en_stats.c @@ -1155,6 +1155,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 Sat Mar 9 08:44: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: 13587536 Received: from NAM12-MW2-obe.outbound.protection.outlook.com (mail-mw2nam12on2077.outbound.protection.outlook.com [40.107.244.77]) (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 3AA2539AFA; Sat, 9 Mar 2024 08:45:06 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=fail smtp.client-ip=40.107.244.77 ARC-Seal: i=2; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1709973907; cv=fail; b=D9nJObcnoensR1eA9DUY5Licj9UjodT1RONlZA9S/36wCLO4779FVtu/nU+c3t2Fab03cLpq1eIkNXmXqbhEccoDs6OvV419ERJUyxVSg8Ipmk91yq73wYs9DVrQ68rKGnmHfR8lmVTl+PnC7CTQ2IVaVq6Lpw/4P8mJruljyhw= ARC-Message-Signature: i=2; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1709973907; c=relaxed/simple; bh=dN7L214BHKIN2vsw9rUU5smGx6bsG0dlxyQaFVdsgpw=; h=From:To:Cc:Subject:Date:Message-ID:In-Reply-To:References: Content-Type:MIME-Version; b=s4io0hG3HIuTXv6auGYoNxFhbKcSmjXI439oQPGiOHgeLT2qLdnBMGw/UEmdA3z3BFesOAA7jk8n5j6tveTIUrHAqb6CWPOLt/6LdxdcYfSpvhZP++rFuxeD4RPzlYO6CJXEHRmUiiTS09KDLcnjS80JW68v91IPogxGP0DGsN8= 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=mKnmZiCw; arc=fail smtp.client-ip=40.107.244.77 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="mKnmZiCw" ARC-Seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=SnXj9NQGKpKi7JEigSj/JeXALCXAll0TJKtlaQAg5GsWlxSmfQ3xCAHhCt8ng3Hcd0GTK7FlfPcCUltAiZjEmqd7TlqDsrXUFq3IY6r2hxhCS20ec13NiiipX6Nx87o08zJ8GK0BmBROo3zzEG0djPDWmNezfY3A2/zzeMY1u8mYa2ySutrKnU36eLbmSnFmdlNG3g+JhXPboMKeZB1RukvLwfCWmL0/dkAVu8q//t3mUvfODv0Gcv/elAvosZfqUO65YwyPlPVBbII/ldEJfDfqFYFl/So9R+kn5Vp+kpYItspNM1MdHo/1r6+uXJ/cV9JjuvytgYEFUPpMiV5Myg== 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=cbQRyhr40BMu2hpzbzg904a3AKx8411K4Ou5gTxN+aU=; b=TQZWfJj69GOCrr+7Reu6kxYEjRpkn0RGmJH4PDP8Lg2cS9TDmCmQ+x9ipKy6CwyMTnDIC5Qi9vRdWGpCEWSosnhcJzvYozU+uDsTPL6lhzTyBhIA6lrpdSPe0EbsgEXvGlyc1U3WT57CoYofGcF31muaQj3YB9OmMegu6w2Tt1K6IDOzDImcgzOq0lfeFlA1twQuyMlEA2b4/ljHo3UxIraRyyWDtOcs8ROLCzgHNBc8n+YL0VQUJqmrozx+btZwbi7Z743gV/3SzjDCNLB+Y6TnIEPgXlMLupUwc0jYv/DTXkwJVoFFz5aqUiA1WL4U+3wAr/PwictF6KFAcB7Mpw== 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=cbQRyhr40BMu2hpzbzg904a3AKx8411K4Ou5gTxN+aU=; b=mKnmZiCw07LHKy5ifiLy3QQcJpMRu5qNhbGHucPFbQqEoJ0nYSDRjDcsXvg1eZBRlY3cLQE/8dHb/vlN1SOAnPgyD4flV2ot/zywrBKdUJ2ijJgqirHnRNqmUjQI9VkW+SXFNNS8usH/U7Mpfz5qMLZa4ocyDX0vD5P9u9tHPK+7GMf9lsAni0tUUnKGBK2vs9xPHXv5beV4+B2fze7DKtF2+8xfe3AtlFkn/XvloBQ1wiozyZ2MF3PATA4BgXUFt8vQ75NgZ8OiwkCix7aOBa5GNzjNE9p/eiJ8b6+0Qcd7EqL7bdmoJ7oauiXtt9XZBSey/Yl8f6XApH5hol9dQg== Authentication-Results: dkim=none (message not signed) header.d=none;dmarc=none action=none header.from=nvidia.com; Received: from BYAPR12MB2743.namprd12.prod.outlook.com (2603:10b6:a03:61::28) by CH3PR12MB9394.namprd12.prod.outlook.com (2603:10b6:610:1cf::11) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.7362.29; Sat, 9 Mar 2024 08:44:59 +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.7362.024; Sat, 9 Mar 2024 08:44:59 +0000 From: Rahul Rameshbabu To: rrameshbabu@nvidia.com Cc: ahmed.zaki@intel.com, aleksander.lobakin@intel.com, alexandre.torgue@foss.st.com, andrew@lunn.ch, 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, linux-doc@vger.kernel.org, linux-kernel@vger.kernel.org, liuhangbin@gmail.com, maxime.chevallier@bootlin.com, netdev@vger.kernel.org, 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 Subject: [PATCH RFC v2 5/6] tools: ynl: ethtool.py: Make tool invokable from any CWD Date: Sat, 9 Mar 2024 00:44:39 -0800 Message-ID: <20240309084440.299358-6-rrameshbabu@nvidia.com> X-Mailer: git-send-email 2.42.0 In-Reply-To: <20240309084440.299358-1-rrameshbabu@nvidia.com> References: <20240223192658.45893-1-rrameshbabu@nvidia.com> <20240309084440.299358-1-rrameshbabu@nvidia.com> X-ClientProxiedBy: SJ0PR03CA0073.namprd03.prod.outlook.com (2603:10b6:a03:331::18) 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_|CH3PR12MB9394:EE_ X-MS-Office365-Filtering-Correlation-Id: 418ae04c-a1da-45ee-22e2-08dc4015340e X-MS-Exchange-SenderADCheck: 1 X-MS-Exchange-AntiSpam-Relay: 0 X-Microsoft-Antispam: BCL:0; X-Microsoft-Antispam-Message-Info: F+3Lu5VrUQvY3ywaxv9AfqjxBc/FMhwqeBV5k8NQjl58WfNHAhCpKkdm2Y3QCmgOM+lN4JyfG6MAsk1gpmkEqlNseQ/50m529dbhvmWJPotxjFEThoWXWUwW7mzcAYVtwSkTxcG9YkIeNM5PkvoWaxPm/GgGgtLtOvPE+AYT7o2l7jJXlGmTNqih3uE+cnYpOChT3jFMksX05mPJ58R1szfu4KaoKoo86mEXa19bB06oxj4wG8jyTZeWqN2QBc30YwqdSfwVo01TlfttXyYK3QKcIb3Hx3h/bCBCpmzVR1+OrcqQiDTNh48wL0LE284s3Od9gKpY5xms7tcWsYq62W5ZEtuWqsiZq4OqobtdyM+plUsx4f6gASBKwNE/incWCN9LrzaDBVe4DDtQxHZBJfbdVADUawwQ0IxlsJh5pn1nbVKX2BOez6yset9ciVUaK7BUseJEprc5+kwlFg+UVruEgN9Uw4gWwHQWJUeXZWZdyDKll0jwj7oZRoirN7g0lhSHxSmjEJS+vsk6FZvzuRY4jnZ5Bv+LYoRoCDMntf8KNqqnoSQ4eYZB9XHET0ZfCGLO16ipEX9qvO4EsmY1MIt/8Pb3oY/qPMO+PKM1lebjKyWolGyjbpM5XtE9d7SXxXVrcrOD3OUAjCec1BaMcptcKqtby6svGy4vXKOPS4g= 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)(7416005)(1800799015);DIR:OUT;SFP:1101; X-MS-Exchange-AntiSpam-MessageData-ChunkCount: 1 X-MS-Exchange-AntiSpam-MessageData-0: Ic5A4c7KJ/9SOQYAcxhkVe6QdmjM+BJo1p3ylRToa9bT0yRqKBUdzSmqpOLnIR5dVvXyWiwSwcZ/z8pT9Bs6krLx8ThWsD8T8KLHesqsPi5W3MohqyIvCM3mr9xhd96PeUZcWzKhZcNe2gbqSUVTtv1XKVH06kONdjMQ6EqIsEhMeyEHxXj0CimxDS0YX/30UDzEa2wqAOgRN0FcXDgLEhdL4x15nQkFfqrwbAGu7RSRPsNTSLlugjW7gbHHACV8NORY6f3l7deehNWT6jwmcQD5eQw33kJIOMrJWD62ljvdqnY9B1vsP21oKBhJ0c5HxA0pAin9mwXSegOxVopKC6OPJI1pR1Hm6nLBQcM3LCFacfFwz2ugycGwD4Da3HNk4v2GXuUedX+oG5iAnkzqSKe8PO5fc78dVGddDioQruQt7ZYKOsAbb4UgFoW93lOmus57i0TuegptDFwfFB/USjp76rBicZb4dtaTDZTjs5mu8ZEIIk0m1WaBeVk/Yp3F63A9uWzo30siLmA34xbXpPNDw46KdGh8zR3eougEFtjTL0FkqNqXhcHXwU8I0nhQ3qimGiyOWSCq8Ax/fCsxXnwA8vR2h0piRojViNh1aqXojxgsjPTBhDdgzSwGaVwgc6tjV69DvVToAqFLC4XJGDhDE5b2PevJWO35dDW9wwmGbP2RFgH9j7V40s0RkHIpK16Sm+GCvepmBivBE+ULrhgymlTY03h50mg+w6DhO82Eb7pp4SzD5dcicuXKeBtxwZRqExlIO3Y9eryBrWG1PImwDFUTOkXFDkTQyJkGyO7CQ/FdLfXdH8GVC0tTSJRF84tcNv9FpHSrbrZRl2b2cBC0MD032dJKLhQyGRBt6uq+vWaJaCRzFZ5SmaSB7OgGnKejyxDMeYf28JuGpc3NlEeo7mjAn5uDhwCt7Ecm5skVUgXWEEiPA00JPAzhQurTlZrgSSbxoS6CG117YGG2eMU3zHjOCVMJVduLRHaDZaVyikAZjCbzaQOjsG2hQgKfbymXQLhHrEmDfa/WBM+xRyNNCzgyB98qCinSG9JMwCm8y1LTvIse7NCvadp8x4kAoTCwLfKI4G8XXpl+9FkJPFpyCc99hZcv1L7senj8j/xGSFEv+lWe1kVnpqzClc2Ir5v+VrSFsTS+8oe1W0lc2c0i/lI/pn/O/thjB/XbIFkqmJGXtg1oqtPbwKCi1n5pdjXVUgYeo5nARochMbfWzGUNKwnk7uf8o+eJyOvtiNeYJ275ZMbj2UunMQVs13TQvyDfrIhFPzawgRNvC8F4dwoVwi39+D62wD9w2cQLvwXQpUyOQU0j70/zOoOw86ndkafd08LY8BZC1Te7My7adFi0LKjFRdTAUe7UStUXN49kzKMssTrVqCRaG50bsZyDuoVypA7nPmuX04RuxEreDtqq4DJgDmZVmQD4aFvcrZj2wPn1WYrQhS2TpTuQVlDWMTP+HE/FV2ctAnPx7rjOmdZfAkBTQwF8+14HRMPThuWICXwd4WEgnckYqq3FUVF3BsqcIy952VpUh8KzTE65sS8AzPl3Dns3g7dhrTrkGsUzTrQ2XlqngNrXJbUmozozV/FPWKyt24unwg8PaB3m1g== X-OriginatorOrg: Nvidia.com X-MS-Exchange-CrossTenant-Network-Message-Id: 418ae04c-a1da-45ee-22e2-08dc4015340e X-MS-Exchange-CrossTenant-AuthSource: BYAPR12MB2743.namprd12.prod.outlook.com X-MS-Exchange-CrossTenant-AuthAs: Internal X-MS-Exchange-CrossTenant-OriginalArrivalTime: 09 Mar 2024 08:44:59.2838 (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: AO+96ynP3gjggfz3cvbPq7wT9mFEdRHLaFoDAkMdxMGoA/TfSeNU5hHc+5S/RVyhhvZ050rxYLdtmfeboNpKvA== X-MS-Exchange-Transport-CrossTenantHeadersStamped: CH3PR12MB9394 X-Patchwork-State: RFC ethtool.py depends on yml files in a specific location of the linux kernel tree. Using relative lookup for those files means that ethtool.py would need to be run under tools/net/ynl/. Lookup needed yml files without depending on the current working directory that ethtool.py is invoked from. Signed-off-by: Rahul Rameshbabu --- tools/net/ynl/ethtool.py | 8 ++++++-- 1 file changed, 6 insertions(+), 2 deletions(-) diff --git a/tools/net/ynl/ethtool.py b/tools/net/ynl/ethtool.py index 6c9f7e31250c..44ba3ba58ed9 100755 --- a/tools/net/ynl/ethtool.py +++ b/tools/net/ynl/ethtool.py @@ -6,6 +6,7 @@ import json import pprint import sys import re +import os from lib import YnlFamily @@ -152,8 +153,11 @@ def main(): global args args = parser.parse_args() - spec = '../../../Documentation/netlink/specs/ethtool.yaml' - schema = '../../../Documentation/netlink/genetlink-legacy.yaml' + script_abs_dir = os.path.dirname(os.path.abspath(sys.argv[0])) + spec = os.path.join(script_abs_dir, + '../../../Documentation/netlink/specs/ethtool.yaml') + schema = os.path.join(script_abs_dir, + '../../../Documentation/netlink/genetlink-legacy.yaml') ynl = YnlFamily(spec, schema) From patchwork Sat Mar 9 08:44: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: 13587537 Received: from NAM12-MW2-obe.outbound.protection.outlook.com (mail-mw2nam12on2044.outbound.protection.outlook.com [40.107.244.44]) (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 6A54B3839D; Sat, 9 Mar 2024 08:45:06 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=fail smtp.client-ip=40.107.244.44 ARC-Seal: i=2; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1709973908; cv=fail; b=nUIJUgm0Az48f80+Z1+NvGoTlxSa3SWMSOUQG8Bv7SPR7S7oMp/3bQtPDgyv96KcNIzGWlO1uOzUVRdOEEpF+mhglAl/Ro+lLwHjWjCnMp4ThrA0mdN1MQJQcHNm+XMWXlgbevDOKLJSPG9VqwehAzSyprfUz2YH4xt1+bO83w0= ARC-Message-Signature: i=2; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1709973908; c=relaxed/simple; bh=h1BqVMbyqCstV3fz1rbJlr2tJLOfEoJS7bPuFTsMyOw=; h=From:To:Cc:Subject:Date:Message-ID:In-Reply-To:References: Content-Type:MIME-Version; b=dXOXrsc+YNIAHl8QPoFoQfDCvV51xk4tyKMXD8qqopl4GKbVKPduZjnzpbanmu7J+219U6YjK1ATami3A8kxVDZxeGytjkzFIgbJGYaoqlvnJQHPXh8Px5EZrwAcwlwtRJPBH+6kw6zQyefBP1xa0PS65SFma2OH/LTUAi6FnR4= 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=mlsi86uw; arc=fail smtp.client-ip=40.107.244.44 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="mlsi86uw" ARC-Seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=V28BDd7kXFbyNKpkg8X/w7xLHohqtu6OaR2ordJsXqSF/oDhjnVdAr7svs5jhd29GRrEKlSgCP3WkuUpKkeaHy6YP3TiJTWzVfYnFYALQCIXpcJbGDA126Bm3B6/JdMxjlYA9pN+2tWZ6CwUN/ejZsh29kc+Zo4fGJmj9Q57a3d0reFCvX8DfEzAlPDHtYphNwDjLfSIkCEOHX6tTyAiq03tC5yVEY2n74zsfSr9U2DbAonMGkdS4ndZs14bOZ7Opo6jqu59B+JrKxvBbycnX8LxeBqwzRnG7Z6/OndnyJ+7TwJ6YVEv2kSJy4WMLqQn/AbLm8sg3s+8JBpGqfcEPQ== 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=h8Z0RuwzlbvHvuvBzKaYz9Jq06PE5Uj1SUo9cOuL+Cs=; b=kcOhFyQsaKexxX5fTfL1/lDheA3u8RB8h3Zx+upbrxPFgsuM9/2LnqUYHcLFuKMzCbWeeiPwIwq0ezVeE32FIPTye2hstCq5OsDDIuBPvzbTgWekdah+pjQjaCsyF5VjxJxi/FiwDmYaLZHZoli63Uw4LFTzDPWqLsHiOrImctk2kiIZxb7XxuS37OKs9tP8ki2yIdNllFSeiKL9MZt3GDW40OfDcNmlQACqzYhwUMl2VHgYjfw02m2NZhh861QyFXh9xfBgAGvi5ObpqEaT3p7rxzo7jTNgJUJb/PA7KiTlO3lZZ/NWz36ZJibc9cZlF5/GP99GM+PFwAbyDqf7aA== 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=h8Z0RuwzlbvHvuvBzKaYz9Jq06PE5Uj1SUo9cOuL+Cs=; b=mlsi86uwLlF0X3XR+WCPhsHa+Bfnu+ZQfPpavPc6EPUURHKQoP/iTHj/LXqsOl7ybcqqZOx29w1XoMKHAVbOeU319BXPni6J+WKwI8H5w/2oxFMq18QzWYX2V/EzHbMXY5uM1RN3Deboj9bsjab9hGH2xor6EMOHrsXyrLyZHQfOJzPx8kVxw+m6ZmSkfUqBsZde8+qlihwNh5XYS7OQf0XQf21LjXG28zsiYG2TwzZF8LcmsnE9Lhw0ZSCsb2mFwgaTwCaU1RPkJ6P7tVBzr302ADar+Kte3OxjztBHU0CMjPaHNgITGi9599km0ZuGEumGH7OqujKIsssKv/o5KA== Authentication-Results: dkim=none (message not signed) header.d=none;dmarc=none action=none header.from=nvidia.com; Received: from BYAPR12MB2743.namprd12.prod.outlook.com (2603:10b6:a03:61::28) by CH3PR12MB9394.namprd12.prod.outlook.com (2603:10b6:610:1cf::11) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.7362.29; Sat, 9 Mar 2024 08:45:00 +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.7362.024; Sat, 9 Mar 2024 08:45:00 +0000 From: Rahul Rameshbabu To: rrameshbabu@nvidia.com Cc: ahmed.zaki@intel.com, aleksander.lobakin@intel.com, alexandre.torgue@foss.st.com, andrew@lunn.ch, 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, linux-doc@vger.kernel.org, linux-kernel@vger.kernel.org, liuhangbin@gmail.com, maxime.chevallier@bootlin.com, netdev@vger.kernel.org, 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 Subject: [PATCH RFC v2 6/6] tools: ynl: ethtool.py: Output timestamping statistics from tsinfo-get operation Date: Sat, 9 Mar 2024 00:44:40 -0800 Message-ID: <20240309084440.299358-7-rrameshbabu@nvidia.com> X-Mailer: git-send-email 2.42.0 In-Reply-To: <20240309084440.299358-1-rrameshbabu@nvidia.com> References: <20240223192658.45893-1-rrameshbabu@nvidia.com> <20240309084440.299358-1-rrameshbabu@nvidia.com> X-ClientProxiedBy: BYAPR01CA0033.prod.exchangelabs.com (2603:10b6:a02:80::46) 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_|CH3PR12MB9394:EE_ X-MS-Office365-Filtering-Correlation-Id: 6d1e0d06-fee7-4277-af08-08dc40153492 X-MS-Exchange-SenderADCheck: 1 X-MS-Exchange-AntiSpam-Relay: 0 X-Microsoft-Antispam: BCL:0; X-Microsoft-Antispam-Message-Info: NxN2PdfMq9od5FJCJhVxoOaLFcDDbtWy5kpXa7d125TicTKjF0XScbg8nepKrqHdHddKDhU2uZVjg5C7p+jVKmT2LlojmwimaCJTWFrpoR4ymghzijJMAs8ZUT+qdyHcfgTiJUeX6hcD6SUnJ4fVyknMzBvozbyew01/CbmZf9Rhu2THwifVqSTtdurp5VNNbU2LPSxrJ6Xv7npCcl3p1BIWglWOQHU99tscNMRk5Teg8Gtr5fkrOzugC456oDWW0RPJsurCr2L9+N4M7vtUOE4qXQpfy/Ul6x4KbSDQoN9Z7sjMkEWs+u42GDbWhNE4L40jHLxDhzwh4cybkVG9Tb3+d5UqRLQzvh11SeFwBft8qPKOWuVJCDPILbSaRMf53JvVjuqb9LRSfP/qF5qmise6mILWUcwwHpoR+eD97ohgCnVw5KYzFiVWJWOihNEE/oErOAERBwhbXesr4ka0ZHeg4EAQP9zhQhIGYXyZ4QA/uS2kYKTek/VaAHT4q3bOOBMZTQ78B0k8J4RZUy1+LKdWOHcr8a+Hlb01YDYAvTKv5IB4irilx4AZpXzORvcR3agNOWnun9v7ZO/8bnyv7gQ0fOurgFrq8AUBXnnv00fwgK7C12gWKKidwz4ZBu0QpiSX4Wep/cI7A/dDdYKlW8mdFn9cE0vH741Xtl3GDrs= 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)(7416005)(1800799015);DIR:OUT;SFP:1101; X-MS-Exchange-AntiSpam-MessageData-ChunkCount: 1 X-MS-Exchange-AntiSpam-MessageData-0: KrCkdH7ZYp3RftRDmMScrYzm/9PV194NabIwHI5ZZ9gvePcKcfxsZjqnlg3pQJiUzzWR0pTkEDgWc/y5Sms8nUUVGoLStLm57oz7Sx6DCGw0dK3lZxgdyPaKS9zqEUykbVFpmdB94cdGTMJwfBKX68wzLytJUsyb+uA/QeyW8tS3N0/30VbAtF2ulPo96laoBBOnNi6CPeTN5AXv1HAJT1fra6FtOZkCXOMcRiYZpbZl+v2qUeVRNvKV3KhB+2JejkKrDuFMBLAxjXrrw4ilkeD1QPz8eabBULqqu0dmmaSUxj0u5hKTBNu99jiGQYVSSeMMaCi5pGJ2D8gbjsdykmKOZ/Xy4XDtRItJr3Hetrh5LVKj2c4rshkK+GBIqDzjKsKXg5oEQ4SVNxEIS7aJg1gWh57V5GAFKRQY6E8zze5p7dvFKEohs0U7oZBWxhSgn4SNHTfG/f7LfJQx6ERnpozaX9gF9TLMgjVT4nMiUVpAKI4zpM74t2GsC1l6FuBARXB8n4YJVFa5AQLWjWYBZdSvf/MZz8zcWBvFNl1GIBr77bVlfTLVTVSw3megqM2bcZmC7bvOO34eRJXCTs86ZCiwNQgL38a18CQ80gHzfIt1fmQrc4Y6tC47au1XIOeGhZOJwOuCEfljutC3kw4Eyxu7cQW1EnbQzLJtZWCJgq9lCMbaEMzDUAs/aJOhdhz39HqRKAg7zWzLfpfGB9ic0KMXXygiGlQUM1jH+FerhSJj5sPIXyIAwrd6KbHiqUeR1ZfhUwFdAPd1P8KLDNEa5C0P264KfOPnyF2mnRgu1F4VGQ7hERQUIadS8nCrdM1bgnvx4W/1CJzaXSn8W/qJ2sQ3xbrrMdQMOj+3XpD4Khac+qedV4pTSC3eh/iNGR9fA75kf+mDJPOqNcZ9XuJnE5jVN0T0zwFXhsODXCwb+RCZ/nKyBltT8HUGS1qtvexsFTkqXCeF3QBhLuMxfRowR0gApyofK3GXZ6+5rzXnliWrHOHbvX1rx0MqGpnYa7J84/MMc87R1snlfBi7uZMwxxwFKbtIxJsfUJskLmBYptVofbIbK8nqZwmru8il9Dz0RCtBAq2Ffnk48xXUGj0T66efTDeuh1zdq8dmFnoJ1OCK/nGTR7Isf5wd1sRtv+H57I/IN20j1OiL7phSZ3oqv0IJYxzdEp2jqsKUpT0JxCaxvKTz3KRenPz9AXxrK8e1U+i0C76PgJbxseAlrK0JfzozpXKDV426yoUuNFRXbaKlhuY3jpvWwcEYRJSR4RPP3UrNXbo7XfvbvTlSTXE6jYOpCatupK8qpm6YKZoOmS+eFf0KaTntwgDWJdnqxWNCMW1NTouItS/bxTWQUGW+lgD2H3cddOrrh7IpVhZnbtcp4seGSyzbokkVwrpgoR9L3+M3Hsum0M+YzxW60lBejhImw7/yI/OpxbV4ToqVYYdFvErwtaWRENbbx7JcUwVilZ5d03VLGqwXZeC3zLAfqiT5yy3KNbryj+5gpZsqRrIYFlZg1uaO/jEx82r1W65qF2LSyTx9mYm5vo2wcs6KLJEHH1b+2JiMPpMFrxfWnjtWRU3DVl8emnjD2Q/44hVGXUvf1n5Cg3K9Y/ix+TlgkQ== X-OriginatorOrg: Nvidia.com X-MS-Exchange-CrossTenant-Network-Message-Id: 6d1e0d06-fee7-4277-af08-08dc40153492 X-MS-Exchange-CrossTenant-AuthSource: BYAPR12MB2743.namprd12.prod.outlook.com X-MS-Exchange-CrossTenant-AuthAs: Internal X-MS-Exchange-CrossTenant-OriginalArrivalTime: 09 Mar 2024 08:45:00.1439 (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: uqeZ3+5DtsBhpcidu0G8W6dn8Q358NCstGKGMU/N+exNs3t+Ox1BHNqZqAUih96PkmQ2i5n5yIs3LnxJ4v6wfw== X-MS-Exchange-Transport-CrossTenantHeadersStamped: CH3PR12MB9394 X-Patchwork-State: RFC 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 --- 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 44ba3ba58ed9..193399e7fbd1 100755 --- a/tools/net/ynl/ethtool.py +++ b/tools/net/ynl/ethtool.py @@ -324,7 +324,13 @@ def main(): return if args.show_time_stamping: - tsinfo = dumpit(ynl, args, 'tsinfo-get') + req = { + 'header': { + 'flags': 1 << 2, + }, + } + + tsinfo = dumpit(ynl, args, 'tsinfo-get', req) print(f'Time stamping parameters for {args.device}:') @@ -338,6 +344,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}:')