From patchwork Wed Apr 3 21:28:41 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Rahul Rameshbabu X-Patchwork-Id: 13616725 X-Patchwork-Delegate: kuba@kernel.org Received: from NAM12-MW2-obe.outbound.protection.outlook.com (mail-mw2nam12on2097.outbound.protection.outlook.com [40.107.244.97]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id 693CE156C62; Wed, 3 Apr 2024 21:29:48 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=fail smtp.client-ip=40.107.244.97 ARC-Seal: i=2; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1712179790; cv=fail; b=LZg/V4GAqRuyJVEXRKsBouhq7/rnw0prUUsEAA9+5CN5b3FHhOONeGltD7MbTolX5LIyoc9VLM7tMaNp0hteGzCK+5OGeSmHQuW5MstLbZSWWTWyejFTtmDnfqXhxkN2/kEBqu645U1/G1lsrZKzzur5Q0Su/00tQnzFMlI+geQ= ARC-Message-Signature: i=2; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1712179790; c=relaxed/simple; bh=WwhCAT5WSnm2yd9jWnS4IDeSKji8NSr3NtaxtHVz2iA=; h=From:To:Cc:Subject:Date:Message-ID:In-Reply-To:References: Content-Type:MIME-Version; b=qllvmwV4GhCl+isl/HDHKgQ9uyIst2dGDXxlfIuDQObJpEinsYOniUHyM5zftjmO4+/hIuthzy9dSzI0XASU34Bgh9QITjswl9ypnt6kSUGtFmd4Sp9hG3n4HBoQCJ/Swn+lbwcyoaFPN1lLEFTLUn7HbzxWr5AY5rVg9EJ5M4M= ARC-Authentication-Results: i=2; smtp.subspace.kernel.org; dmarc=pass (p=reject dis=none) header.from=nvidia.com; spf=fail smtp.mailfrom=nvidia.com; dkim=pass (2048-bit key) header.d=Nvidia.com header.i=@Nvidia.com header.b=YQqbarAX; arc=fail smtp.client-ip=40.107.244.97 Authentication-Results: smtp.subspace.kernel.org; dmarc=pass (p=reject dis=none) header.from=nvidia.com Authentication-Results: smtp.subspace.kernel.org; spf=fail smtp.mailfrom=nvidia.com Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=Nvidia.com header.i=@Nvidia.com header.b="YQqbarAX" ARC-Seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=mG27bhtPQ2ICkW0rsem6I4j5IpqR8hnZLp2OoiXqhWZe0gOF1XCqzW/aZycTsEfGGlXLEBcJVsmLZORc9cjyUZRiCSZB80njMByuN2Fv00shdHbt1dnMStNdOYw4klV4d1w+tniOZ4B/06C+3Lw/Qk7wVT05Ka6yHwytuxYhA2N7hqzFgJIiA8ibOwgbmr8ZzDf0wIyA2evcf707F2xIP4sL0+D5GpDhTUZY4A6DvDHUsNXcMbLiytoGR/hYAbbd0cFkor4+UizLV2/Fzb2hiPtv2q8hW3cfakpLggnyqc5gVsickZt0WcjlKlMz1m7VmXmY/XFJAC2TmFCAqk3P0w== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=microsoft.com; s=arcselector9901; h=From:Date:Subject:Message-ID:Content-Type:MIME-Version:X-MS-Exchange-AntiSpam-MessageData-ChunkCount:X-MS-Exchange-AntiSpam-MessageData-0:X-MS-Exchange-AntiSpam-MessageData-1; bh=HsYmuphJHuA47Un9AfdK2eX8onvVH+g4LnJUTGpZUkI=; b=H3fAEzGuR8E72VOGf1JZ5YmVBEFBiT9RLFreBCvU+UeaMvlVvIVs0D87JpmPFOEK6wgfGhZTptKc8K1QgknqkbwD3KvXRyy8483fZusWF+vLlPPu2MBgz8Qdg+erXXEfa1H2S2L4y2veAbZ7by82eWZPwkjT1mJrJzTUPqDBtnVQvE0AFHbTN2RlxYjFGTL9w8190XFyBaA3q/xCOPVMDb59wGpoK9+FYT3B1d5tXh74VU5totTJ+L/4EQo8tAE72TCyWoEXc7aDshBfAaXZYEBRekUnBLJyTnM0UcXd8bdPd5N1IDCIPXrROP/UoaCekm7LzcNIF1SCdR5gwbxrUA== ARC-Authentication-Results: i=1; mx.microsoft.com 1; spf=pass smtp.mailfrom=nvidia.com; dmarc=pass action=none header.from=nvidia.com; dkim=pass header.d=nvidia.com; arc=none DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=Nvidia.com; s=selector2; h=From:Date:Subject:Message-ID:Content-Type:MIME-Version:X-MS-Exchange-SenderADCheck; bh=HsYmuphJHuA47Un9AfdK2eX8onvVH+g4LnJUTGpZUkI=; b=YQqbarAXW43ckJvRQevTrpgmcEsAUrP6u+e+bAwQK4jFo65Wt0w4hmGt6gJwVJ1SYH/dRchOj2svaEayc0J8It65JGzQ3HYl/lCyyJp2Clz4QxERLbuHi7Qnin+2hd6lQWI5mY+Ot9fHhFtvIf3C62l8JBiTNTg/FPXshHrrPX0ESxNujni3aw3I6N9Zg/EVTas2AvwQmdkNQkpDekoJWNV+wsCcyFnr4Gf0IrCaGQJSgAib+dVL4g/WKDxBON3m+QxVkY9+T4gAAsmBgG9A0yHuLEO6c9szxjEMLCq3cnvvP1080YOFzwKMGAd9DbePgjclXR75DTo3bioev4LnjQ== Received: from BYAPR12MB2743.namprd12.prod.outlook.com (2603:10b6:a03:61::28) by IA1PR12MB8586.namprd12.prod.outlook.com (2603:10b6:208:44e::9) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.7409.46; Wed, 3 Apr 2024 21:29:39 +0000 Received: from BYAPR12MB2743.namprd12.prod.outlook.com ([fe80::459b:b6fe:a74c:5fbf]) by BYAPR12MB2743.namprd12.prod.outlook.com ([fe80::459b:b6fe:a74c:5fbf%6]) with mapi id 15.20.7409.042; Wed, 3 Apr 2024 21:29:39 +0000 From: Rahul Rameshbabu To: netdev@vger.kernel.org, linux-kernel@vger.kernel.org, linux-doc@vger.kernel.org Cc: ahmed.zaki@intel.com, aleksander.lobakin@intel.com, alexandre.torgue@foss.st.com, andrew@lunn.ch, cjubran@nvidia.com, corbet@lwn.net, davem@davemloft.net, dtatulea@nvidia.com, edumazet@google.com, gal@nvidia.com, hkallweit1@gmail.com, jacob.e.keller@intel.com, jiri@resnulli.us, joabreu@synopsys.com, justinstitt@google.com, kory.maincent@bootlin.com, kuba@kernel.org, leon@kernel.org, liuhangbin@gmail.com, maxime.chevallier@bootlin.com, pabeni@redhat.com, paul.greenwalt@intel.com, przemyslaw.kitszel@intel.com, rdunlap@infradead.org, richardcochran@gmail.com, saeed@kernel.org, tariqt@nvidia.com, vadim.fedorenko@linux.dev, vladimir.oltean@nxp.com, wojciech.drewek@intel.com, Rahul Rameshbabu Subject: [PATCH net-next v2 3/6] net/mlx5e: Introduce timestamps statistic counter for Tx DMA layer Date: Wed, 3 Apr 2024 14:28:41 -0700 Message-ID: <20240403212931.128541-4-rrameshbabu@nvidia.com> X-Mailer: git-send-email 2.42.0 In-Reply-To: <20240403212931.128541-1-rrameshbabu@nvidia.com> References: <20240403212931.128541-1-rrameshbabu@nvidia.com> X-ClientProxiedBy: SJ0PR05CA0024.namprd05.prod.outlook.com (2603:10b6:a03:33b::29) To BYAPR12MB2743.namprd12.prod.outlook.com (2603:10b6:a03:61::28) Precedence: bulk X-Mailing-List: netdev@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 X-MS-PublicTrafficType: Email X-MS-TrafficTypeDiagnostic: BYAPR12MB2743:EE_|IA1PR12MB8586:EE_ X-MS-Exchange-SenderADCheck: 1 X-MS-Exchange-AntiSpam-Relay: 0 X-Microsoft-Antispam: BCL:0; X-Microsoft-Antispam-Message-Info: vb+OPPT1PRuphbg5LyeELINibLQThB/09qdqukHUICCyahHeTMzqqb+WHJ8vxVn4GuiDUq6BH1VRf5NWt/5lcncEhNKHWtiMeddknMSij3T4/jukXdBRDjwKT0ejGczJimIRPlhltCNlul0uJDhegqsqE2hZ1GeL9zrEU7HEi0tdT681uurGJVEUmBMEUezE3lJp5nf7YWa3OSJXF3ukUeSgEZD+2P5ILFIMP2LZyOhx8mudOGzUQueys4VlxNPhyy6Ix7JHe6m0O33GYcIqbe0KAkVdUvy6ZwbuN5z79MzOl6uF5La3EqgQH/ehNRd9pjpzFyQAbr2N7vfI25RzW3A56W3RTvFoT/bTBPYs/JB1pG6ZmGd2DBIksBhEPHkROybsR97UYn5ND9D80eiyGEhPXRqVA+BbN9vlpwac2ex04CLRrRP19tuJsgCRDJ7WumQ5tp4J19XrXocEcXdkfCfMjtLeeKCHmg3eI9fdAj/sWarg2RvkjUz8Kp3/hwIkz47qJCioUwwCvKAXf97vWF29nyt2rbVrFvpFq9pcRLZ5qzOUvYaU30ytYnBT/ooFBabEI9As79bfLaizju7r4E752DEGYzA6sY0T3h80SAttIJIBAbceeM/bggFR2+7GbNOzEIelNBMwOBvGATSPoC5uOV2IG7I2fLAHe205ShI= X-Forefront-Antispam-Report: CIP:255.255.255.255;CTRY:;LANG:en;SCL:1;SRV:;IPV:NLI;SFV:NSPM;H:BYAPR12MB2743.namprd12.prod.outlook.com;PTR:;CAT:NONE;SFS:(13230031)(1800799015)(376005)(7416005)(366007);DIR:OUT;SFP:1102; X-MS-Exchange-AntiSpam-MessageData-ChunkCount: 1 X-MS-Exchange-AntiSpam-MessageData-0: YS1lrVk9oleZrrYTDajn8uV3BR4V4jdznLoYzNbos+Nxan83LI90SusRbO+hYRUK9q3FhhQP94zS1XjWOaK0/sE8f4ilJTRzGFkBHsgkEQYLrnRYQaqRaJmrKyFhHaS3+LKjzNfNClGrLpqR5ngbcETnAWkwbXVwetlRY+5eYpXXjkmUFq31FOs97DRZilNwxyogIA6chmR1xS03jw1pw4gCo+hIZO6kTXKzePBw4BcgMENegT2ArEKwE5ZdiFh1DEFkzNLY/zLnB5a1b/ZOYC6Id6H7BgfUFUJjS2N/itibW4Jf/Czj3UP5FE9FPKY5vhqb3RmDpvaBN5P7HHepflrKYS0RXNH27s9hjL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LXOLAHfPidG+KLq1gpEJSSsvYKSPvCYQiTwQJUFszH/oBo1QLKLwv3TDL3mZaVhZy2e4q8rmxXZepSwfAM3UkbXy8N/qkD2AxaSr/19OGO+059Bc+mrRf5H23ngFmVuyLHVGD4LF4el/coE8nARR+GHO1ZbrY7FAjsD6S3eq04dJHjMGp4zsCGDiVCJ0let/hW0Le3Q== X-OriginatorOrg: Nvidia.com X-MS-Exchange-CrossTenant-Network-Message-Id: bb00f957-f1b8-4e63-d0fd-08dc54252ad9 X-MS-Exchange-CrossTenant-AuthSource: BYAPR12MB2743.namprd12.prod.outlook.com X-MS-Exchange-CrossTenant-AuthAs: Internal X-MS-Exchange-CrossTenant-OriginalArrivalTime: 03 Apr 2024 21:29:39.0401 (UTC) X-MS-Exchange-CrossTenant-FromEntityHeader: Hosted X-MS-Exchange-CrossTenant-Id: 43083d15-7273-40c1-b7db-39efd9ccc17a X-MS-Exchange-CrossTenant-MailboxType: HOSTED X-MS-Exchange-CrossTenant-UserPrincipalName: kc2DQx+BDgS4y07cEyt8U3gN1MkIygGBDYvH4aS1R6/lv9HeoodWjnBm1xp9LzSV9ctxqum5DreGpfhDDdo6MA== X-MS-Exchange-Transport-CrossTenantHeadersStamped: IA1PR12MB8586 X-Patchwork-Delegate: kuba@kernel.org Count number of transmitted packets that were hardware timestamped at the device DMA layer. Signed-off-by: Rahul Rameshbabu Reviewed-by: Dragos Tatulea --- .../device_drivers/ethernet/mellanox/mlx5/counters.rst | 5 +++++ drivers/net/ethernet/mellanox/mlx5/core/en_stats.c | 2 ++ drivers/net/ethernet/mellanox/mlx5/core/en_stats.h | 1 + drivers/net/ethernet/mellanox/mlx5/core/en_tx.c | 6 ++++-- 4 files changed, 12 insertions(+), 2 deletions(-) diff --git a/Documentation/networking/device_drivers/ethernet/mellanox/mlx5/counters.rst b/Documentation/networking/device_drivers/ethernet/mellanox/mlx5/counters.rst index 5464cd9e2694..fed821ef9b09 100644 --- a/Documentation/networking/device_drivers/ethernet/mellanox/mlx5/counters.rst +++ b/Documentation/networking/device_drivers/ethernet/mellanox/mlx5/counters.rst @@ -300,6 +300,11 @@ the software port. in the beginning of the queue. This is a normal condition. - Informative + * - `tx[i]_timestamps` + - Transmitted packets that were hardware timestamped at the device's DMA + layer. + - Informative + * - `tx[i]_added_vlan_packets` - The number of packets sent where vlan tag insertion was offloaded to the hardware. diff --git a/drivers/net/ethernet/mellanox/mlx5/core/en_stats.c b/drivers/net/ethernet/mellanox/mlx5/core/en_stats.c index 64a435f914ff..a06c6c80e36f 100644 --- a/drivers/net/ethernet/mellanox/mlx5/core/en_stats.c +++ b/drivers/net/ethernet/mellanox/mlx5/core/en_stats.c @@ -2063,6 +2063,7 @@ static const struct counter_desc sq_stats_desc[] = { { MLX5E_DECLARE_TX_STAT(struct mlx5e_sq_stats, csum_partial_inner) }, { MLX5E_DECLARE_TX_STAT(struct mlx5e_sq_stats, added_vlan_packets) }, { MLX5E_DECLARE_TX_STAT(struct mlx5e_sq_stats, nop) }, + { MLX5E_DECLARE_TX_STAT(struct mlx5e_sq_stats, timestamps) }, { MLX5E_DECLARE_TX_STAT(struct mlx5e_sq_stats, mpwqe_blks) }, { MLX5E_DECLARE_TX_STAT(struct mlx5e_sq_stats, mpwqe_pkts) }, #ifdef CONFIG_MLX5_EN_TLS @@ -2215,6 +2216,7 @@ static const struct counter_desc qos_sq_stats_desc[] = { { MLX5E_DECLARE_QOS_TX_STAT(struct mlx5e_sq_stats, csum_partial_inner) }, { MLX5E_DECLARE_QOS_TX_STAT(struct mlx5e_sq_stats, added_vlan_packets) }, { MLX5E_DECLARE_QOS_TX_STAT(struct mlx5e_sq_stats, nop) }, + { MLX5E_DECLARE_QOS_TX_STAT(struct mlx5e_sq_stats, timestamps) }, { MLX5E_DECLARE_QOS_TX_STAT(struct mlx5e_sq_stats, mpwqe_blks) }, { MLX5E_DECLARE_QOS_TX_STAT(struct mlx5e_sq_stats, mpwqe_pkts) }, #ifdef CONFIG_MLX5_EN_TLS diff --git a/drivers/net/ethernet/mellanox/mlx5/core/en_stats.h b/drivers/net/ethernet/mellanox/mlx5/core/en_stats.h index 03f6265d3ed5..3c634c5fd420 100644 --- a/drivers/net/ethernet/mellanox/mlx5/core/en_stats.h +++ b/drivers/net/ethernet/mellanox/mlx5/core/en_stats.h @@ -429,6 +429,7 @@ struct mlx5e_sq_stats { u64 stopped; u64 dropped; u64 recover; + u64 timestamps; /* dirtied @completion */ u64 cqes ____cacheline_aligned_in_smp; u64 wake; diff --git a/drivers/net/ethernet/mellanox/mlx5/core/en_tx.c b/drivers/net/ethernet/mellanox/mlx5/core/en_tx.c index 2fa076b23fbe..09a592909101 100644 --- a/drivers/net/ethernet/mellanox/mlx5/core/en_tx.c +++ b/drivers/net/ethernet/mellanox/mlx5/core/en_tx.c @@ -750,11 +750,13 @@ static void mlx5e_consume_skb(struct mlx5e_txqsq *sq, struct sk_buff *skb, u64 ts = get_cqe_ts(cqe); hwts.hwtstamp = mlx5e_cqe_ts_to_ns(sq->ptp_cyc2time, sq->clock, ts); - if (sq->ptpsq) + if (sq->ptpsq) { mlx5e_skb_cb_hwtstamp_handler(skb, MLX5E_SKB_CB_CQE_HWTSTAMP, hwts.hwtstamp, sq->ptpsq->cq_stats); - else + } else { skb_tstamp_tx(skb, &hwts); + sq->stats->timestamps++; + } } napi_consume_skb(skb, napi_budget);