From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from mails.dpdk.org (mails.dpdk.org [217.70.189.124]) by inbox.dpdk.org (Postfix) with ESMTP id BB00F45C0A for ; Tue, 29 Oct 2024 11:38:07 +0100 (CET) Received: from mails.dpdk.org (localhost [127.0.0.1]) by mails.dpdk.org (Postfix) with ESMTP id A945F42E10; Tue, 29 Oct 2024 11:38:07 +0100 (CET) Received: from mgamail.intel.com (mgamail.intel.com [198.175.65.20]) by mails.dpdk.org (Postfix) with ESMTP id CD2D340144; Tue, 29 Oct 2024 11:38:04 +0100 (CET) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=intel.com; i=@intel.com; q=dns/txt; s=Intel; t=1730198285; x=1761734285; h=message-id:date:subject:to:cc:references:from: in-reply-to:mime-version; bh=Wfxf8BCklgDnM3QWQldUl0t/n7uwFvIZQPalUKYrHGg=; b=CdhbkqT0FrBwbgL+fyf/60GTaLa2yUdj0LIiEsrEsPZ4S/Lk5Z1hUD5w 2frud6Qhc6qecWZMTZMA4t071YpIIDaEMSgYm4TyB9tV37RNje75kJtYV 3e9ZARokg1Q3I8E+wuCrPeIxAHV6fG2yI0tF7qLTL1J4w8DGlPdHkxXde 2P28oIYIhzGqjeDU0A+wNdlsVulECWPZjoHROBXrkwmW0JQrj7vOL1rkA V0fAjfTz9NJ/74Sk6+2zphdjoxClwlpCXuqx6SlGDA0eKmZm1Q50QzTmA S+int240KrFIJuRrEaCcuRTWTeR1p2/75NEAhTSlRshFQfUqrDflivLQ7 A==; X-CSE-ConnectionGUID: nQOCUGeiRcqKBt7PWmuQQg== X-CSE-MsgGUID: nb4xDT3pQd+8nCim26GXxQ== X-IronPort-AV: E=McAfee;i="6700,10204,11222"; a="29605735" X-IronPort-AV: E=Sophos;i="6.11,199,1725346800"; d="scan'208,217";a="29605735" Received: from orviesa004.jf.intel.com ([10.64.159.144]) by orvoesa112.jf.intel.com with ESMTP/TLS/ECDHE-RSA-AES256-GCM-SHA384; 29 Oct 2024 03:38:04 -0700 X-CSE-ConnectionGUID: VHcZe0doTbmo+/xZ0LcsDg== X-CSE-MsgGUID: LrIDXhzBQUySzX78YPyrpg== X-ExtLoop1: 1 X-IronPort-AV: E=Sophos;i="6.11,241,1725346800"; d="scan'208,217";a="87049533" Received: from fmsmsx602.amr.corp.intel.com ([10.18.126.82]) by orviesa004.jf.intel.com with ESMTP/TLS/AES256-GCM-SHA384; 29 Oct 2024 03:38:03 -0700 Received: from fmsmsx603.amr.corp.intel.com (10.18.126.83) by fmsmsx602.amr.corp.intel.com (10.18.126.82) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_128_GCM_SHA256) id 15.1.2507.39; Tue, 29 Oct 2024 03:38:03 -0700 Received: from fmsedg601.ED.cps.intel.com (10.1.192.135) by fmsmsx603.amr.corp.intel.com (10.18.126.83) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_128_GCM_SHA256) id 15.1.2507.39 via Frontend Transport; Tue, 29 Oct 2024 03:38:03 -0700 Received: from NAM04-MW2-obe.outbound.protection.outlook.com (104.47.73.168) by edgegateway.intel.com (192.55.55.70) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.1.2507.39; Tue, 29 Oct 2024 03:38:00 -0700 ARC-Seal: i=1; a=rsa-sha256; s=arcselector10001; d=microsoft.com; cv=none; b=GF/8nlP6Yz1yh+f9Z97ickZ+KFQFrTJNHsuUNTfEz9AIOefJ1/7QjjqZkcL+W7sRB8SqN2Dsm4VrlApRgkRYrAskEsnZy79X6m0oEjuZx41UwQlV3JWbPLfcfU5VE1wqnVSa2V1vzxKt2toTK6gaRoB/JkzyjslUNsMX1GoV3bEMt/W2PAr+1h9EFLzwnEZ72FFNyzp/UjEMUALwNQ48YMW9x3db4dNQMfEfM3f4DLLfHwrnegoInzMkgtWgdhHRTX2uBcM5h5UIyrRRLJJwvsImVPcECW09ZrogI4mnG09atqueuQSGcMarchjfO3mTTzx1QDgMauhW+c6St3FIEg== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=microsoft.com; s=arcselector10001; h=From:Date:Subject:Message-ID:Content-Type:MIME-Version:X-MS-Exchange-AntiSpam-MessageData-ChunkCount:X-MS-Exchange-AntiSpam-MessageData-0:X-MS-Exchange-AntiSpam-MessageData-1; bh=8vQXTh4wSAd/Mhbi/7OM+RL0xfS+m4uHNEiEwYruQ/0=; b=mI1hOXOQ75LMeRVaUdV6C10t3yeRqoFg0lgfWPnWmvkJ2OwyUyN/C9bXiiDhkMxeghJVM270KMgfKpcDxY/2/KbSQ2+9htfsqyK3Fc5nGKzivf2GrNZrMzgLUJIhkhrPLUZLUmZm5NmnfNHSbEGVG72li9XBibXzyJegMwMGlxAXKcIEX0nk6sCKCCO4B2d9q14xptrfZBLK8Q/zUvVpJonxqBR59wT3Mccw2PPsg1fZThT/YU0DfX2HN79JAugRZF37Qe5PV+70h4YiQm+KZFk+V3Mj/59/QkVUzrp9Pbd6PYZooCIOOu0oJDJXrQf3BUg6Q1CN3K6OfXRrl4fe9w== ARC-Authentication-Results: i=1; mx.microsoft.com 1; spf=pass smtp.mailfrom=intel.com; dmarc=pass action=none header.from=intel.com; dkim=pass header.d=intel.com; arc=none Authentication-Results: dkim=none (message not signed) header.d=none;dmarc=none action=none header.from=intel.com; Received: from IA1PR11MB6074.namprd11.prod.outlook.com (2603:10b6:208:3d6::14) by DM4PR11MB6432.namprd11.prod.outlook.com (2603:10b6:8:ba::8) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.8093.25; Tue, 29 Oct 2024 10:37:52 +0000 Received: from IA1PR11MB6074.namprd11.prod.outlook.com ([fe80::37f8:8ecb:2c75:3092]) by IA1PR11MB6074.namprd11.prod.outlook.com ([fe80::37f8:8ecb:2c75:3092%3]) with mapi id 15.20.8093.018; Tue, 29 Oct 2024 10:37:52 +0000 Content-Type: multipart/alternative; boundary="------------M36P0mkSYQuoeTm30fXDd8Hi" Message-ID: Date: Tue, 29 Oct 2024 16:07:45 +0530 User-Agent: Mozilla Thunderbird Subject: Re: [PATCH v1] net/ice: fix incorrect reading of PHY timestamp To: Soumyadeep Hore , CC: , , References: <20241025102625.801994-1-soumyadeep.hore@intel.com> Content-Language: en-US From: "Singh, Aman Deep" In-Reply-To: <20241025102625.801994-1-soumyadeep.hore@intel.com> X-ClientProxiedBy: MA0PR01CA0064.INDPRD01.PROD.OUTLOOK.COM (2603:1096:a01:ad::6) To IA1PR11MB6074.namprd11.prod.outlook.com (2603:10b6:208:3d6::14) MIME-Version: 1.0 X-MS-PublicTrafficType: Email X-MS-TrafficTypeDiagnostic: IA1PR11MB6074:EE_|DM4PR11MB6432:EE_ X-MS-Office365-Filtering-Correlation-Id: f2a60845-5282-4053-5840-08dcf805bdb8 X-MS-Exchange-SenderADCheck: 1 X-MS-Exchange-AntiSpam-Relay: 0 X-Microsoft-Antispam: BCL:0;ARA:13230040|1800799024|366016|376014|8096899003; X-Microsoft-Antispam-Message-Info: =?utf-8?B?UE1GN2lmWEEyVUxBUEhmRUh4Rng0TWtCZHEzdzRuNWhjeFRhWm9hTG9saVpm?= =?utf-8?B?Z296OXBhQzh2QmpNaXNoZ2M3TzZRTWNjYytGTWk3Skl2ODh3WGIyckl5eEFU?= =?utf-8?B?OGRXSXpQUGVwZ1VoVFZja0FTVzNpc2plTmZoOUxXcHFmMmFJTzdBbUpSNHB1?= =?utf-8?B?VnBoR3RZVTh2RlptN085N0JWUzVCNUZVQi8vVzlybDFodnhZU1VKOTdKMVA3?= =?utf-8?B?d3NSK3VtaU5rUkZqK0dRWnpaUllMbmk1V2lGZWxCQm1xRlM1UEx3NGh4bTJI?= =?utf-8?B?NzdGellrSlB3bElMWWNYcHVNMldlMHNSNy9RWmZ1QXJTSnc5aWFpSURhOVhl?= =?utf-8?B?UEpvS1JNSGt3elFjWUFqTGtB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f-8?B?cVBneEtZbkRndk51aGRpenJtMEpDbGMybVB0SDJkMjNvNU1kQlVYWk1uWWtF?= =?utf-8?B?aC9XTktNbTlna0huTkJLNlhlQzMvNnF6ejNqNXNERVJoWnZHcVZ2K2FxOXpL?= =?utf-8?B?SHNLTDZkS2Y4enQwbUhCbjBYZEV3NDVXek9GdmZNZi9Bdzk4UUtFYS84ZjEz?= =?utf-8?B?WVN5VmxLa1VBQ1RKck1tVjBDS2NETWxhT1JLcHNUYU1GaVBGQlNaTXdKR0Zj?= =?utf-8?B?UUJuUldiWFNOdjhtL0ljMHVFK1dMSnJsUGZzc2pGZkpZYU1nVkFtR1hwcjhW?= =?utf-8?B?enNnTWI5NjZmQngrbFBPeUJEYzU2NGg3aUpuNE1udmtwa3VkNGhWYTBhRE0y?= =?utf-8?B?OUlaRmlUUVh6VzZja21JUUlFdWVKeUxKTXZyY0FXMVV1a0VMbVBOWkkwZFA1?= =?utf-8?B?Z25DNUVNcVhEZ3JaSE96RkxISmRzSld4WmJyLzdweG45R1k1VUNrVGZEQU1S?= =?utf-8?Q?3YyroU4S0LTAJSrZTw=3D?= X-Forefront-Antispam-Report: CIP:255.255.255.255; CTRY:; LANG:en; SCL:1; SRV:; IPV:NLI; SFV:NSPM; H:IA1PR11MB6074.namprd11.prod.outlook.com; PTR:; CAT:NONE; SFS:(13230040)(1800799024)(366016)(376014)(8096899003); DIR:OUT; SFP:1101; X-MS-Exchange-AntiSpam-MessageData-ChunkCount: 1 X-MS-Exchange-AntiSpam-MessageData-0: =?utf-8?B?bGxxdmk3UUVBV3NvOXdwbDE4ODRINDdQMng3L2NLbHczZGg3TUhFSXQzajRa?= =?utf-8?B?cjZtMEg4TFMxNXVaSVpHTDBtRTh6ZithTjdGYmxPK1hwenQvNHhPNWdianRl?= =?utf-8?B?ZjJNRlhqTkV2YmNjbzZMVzIrbGpMNlNmR0RBZ2NTc2d1eCs4RFRvWWJ1Z2Ns?= =?utf-8?B?M1BoMVliSWYwRVY5RitXaj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f-8?B?MU9IaStuMktpRzNyVUdicGxkVzZEM3hFMy9DWkVlN2VYc0NUZlBzWWZVa0xk?= =?utf-8?B?MURjWTJ2V0txVUhFL0F6UUp4V1E3REFKdFg0K3Z6bVdnMGNERUZBRS81K3Zz?= =?utf-8?B?aFVXQmQycFlpaG1zSTY0bGVIOFBSdmQxS3drSDU0RjMyalI2Q0F4RFlzRVo3?= =?utf-8?B?L1E9PQ==?= X-MS-Exchange-CrossTenant-Network-Message-Id: f2a60845-5282-4053-5840-08dcf805bdb8 X-MS-Exchange-CrossTenant-AuthSource: IA1PR11MB6074.namprd11.prod.outlook.com X-MS-Exchange-CrossTenant-AuthAs: Internal X-MS-Exchange-CrossTenant-OriginalArrivalTime: 29 Oct 2024 10:37:52.5030 (UTC) X-MS-Exchange-CrossTenant-FromEntityHeader: Hosted X-MS-Exchange-CrossTenant-Id: 46c98d88-e344-4ed4-8496-4ed7712e255d X-MS-Exchange-CrossTenant-MailboxType: HOSTED X-MS-Exchange-CrossTenant-UserPrincipalName: yThTMXTXKvyiP/Y02iVypQJrhyYp+XvMS5ixG7HsNxVACIkKKDBas23ADjE1NFDtkoNyax1+yNO4OEAMicvHdA2URDo8rf/F1fobceCBnjg= X-MS-Exchange-Transport-CrossTenantHeadersStamped: DM4PR11MB6432 X-OriginatorOrg: intel.com X-BeenThere: stable@dpdk.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: patches for DPDK stable branches List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: stable-bounces@dpdk.org --------------M36P0mkSYQuoeTm30fXDd8Hi Content-Type: text/plain; charset="UTF-8"; format=flowed Content-Transfer-Encoding: 7bit On 25-10-2024 15:56, Soumyadeep Hore wrote: > In ICE PMD, previously the ready bitmap checking before reading > PHY timestamp was not present. This caused incorrect Tx > timestamping. > > The ready bitmap checking is enabled and PHY timestamp is read once > the ready bitmap gives positive value. > > Fixes: 881169950d80 ("net/ice/base: implement initial PTP support for E830") > Cc:stable@dpdk.org > > Signed-off-by: Soumyadeep Hore Acked-by: Aman Singh > --- > drivers/net/ice/ice_ethdev.c | 18 +++++++++++++++++- > 1 file changed, 17 insertions(+), 1 deletion(-) > > diff --git a/drivers/net/ice/ice_ethdev.c b/drivers/net/ice/ice_ethdev.c > index 70298ac330..efc6db4346 100644 > --- a/drivers/net/ice/ice_ethdev.c > +++ b/drivers/net/ice/ice_ethdev.c > @@ -6597,10 +6597,26 @@ ice_timesync_read_tx_timestamp(struct rte_eth_dev *dev, > struct ice_hw *hw = ICE_DEV_PRIVATE_TO_HW(dev->data->dev_private); > struct ice_adapter *ad = > ICE_DEV_PRIVATE_TO_ADAPTER(dev->data->dev_private); > - uint64_t ts_ns, tstamp; > + uint64_t ts_ns, tstamp, tstamp_ready = 0; > + uint64_t start_time, curr_time; > const uint64_t mask = 0xFFFFFFFF; > int ret; > > + start_time = rte_get_timer_cycles() / (rte_get_timer_hz() / 1000); > + > + while (!(tstamp_ready & BIT_ULL(0))) { > + ret = ice_get_phy_tx_tstamp_ready(hw, ad->ptp_tx_block, &tstamp_ready); > + if (ret) { > + PMD_DRV_LOG(ERR, "Failed to get phy ready for timestamp"); > + return -1; > + } > + curr_time = rte_get_timer_cycles() / (rte_get_timer_hz() / 1000); > + if (curr_time - start_time > 1000) { > + PMD_DRV_LOG(ERR, "Timeout to get phy ready for timestamp"); > + return -1; > + } > + } > + > ret = ice_read_phy_tstamp(hw, ad->ptp_tx_block, ad->ptp_tx_index, &tstamp); > if (ret || tstamp == 0) { > PMD_DRV_LOG(ERR, "Failed to read phy timestamp"); --------------M36P0mkSYQuoeTm30fXDd8Hi Content-Type: text/html; charset="UTF-8" Content-Transfer-Encoding: 8bit


On 25-10-2024 15:56, Soumyadeep Hore wrote:
In ICE PMD, previously the ready bitmap checking before reading
PHY timestamp was not present. This caused incorrect Tx
timestamping.

The ready bitmap checking is enabled and PHY timestamp is read once
the ready bitmap gives positive value.

Fixes: 881169950d80 ("net/ice/base: implement initial PTP support for E830")
Cc: stable@dpdk.org

Signed-off-by: Soumyadeep Hore <soumyadeep.hore@intel.com>
Acked-by: Aman Singh <aman.deep.singh@intel.com>
---
 drivers/net/ice/ice_ethdev.c | 18 +++++++++++++++++-
 1 file changed, 17 insertions(+), 1 deletion(-)

diff --git a/drivers/net/ice/ice_ethdev.c b/drivers/net/ice/ice_ethdev.c
index 70298ac330..efc6db4346 100644
--- a/drivers/net/ice/ice_ethdev.c
+++ b/drivers/net/ice/ice_ethdev.c
@@ -6597,10 +6597,26 @@ ice_timesync_read_tx_timestamp(struct rte_eth_dev *dev,
 	struct ice_hw *hw = ICE_DEV_PRIVATE_TO_HW(dev->data->dev_private);
 	struct ice_adapter *ad =
 			ICE_DEV_PRIVATE_TO_ADAPTER(dev->data->dev_private);
-	uint64_t ts_ns, tstamp;
+	uint64_t ts_ns, tstamp, tstamp_ready = 0;
+	uint64_t start_time, curr_time;
 	const uint64_t mask = 0xFFFFFFFF;
 	int ret;
 
+	start_time = rte_get_timer_cycles() / (rte_get_timer_hz() / 1000);
+
+	while (!(tstamp_ready & BIT_ULL(0))) {
+		ret = ice_get_phy_tx_tstamp_ready(hw, ad->ptp_tx_block, &tstamp_ready);
+		if (ret) {
+			PMD_DRV_LOG(ERR, "Failed to get phy ready for timestamp");
+			return -1;
+		}
+		curr_time = rte_get_timer_cycles() / (rte_get_timer_hz() / 1000);
+		if (curr_time - start_time > 1000) {
+			PMD_DRV_LOG(ERR, "Timeout to get phy ready for timestamp");
+			return -1;
+		}
+	}
+
 	ret = ice_read_phy_tstamp(hw, ad->ptp_tx_block, ad->ptp_tx_index, &tstamp);
 	if (ret || tstamp == 0) {
 		PMD_DRV_LOG(ERR, "Failed to read phy timestamp");
--------------M36P0mkSYQuoeTm30fXDd8Hi--