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 2D35845BD4 for ; Fri, 25 Oct 2024 10:55:48 +0200 (CEST) Received: from mails.dpdk.org (localhost [127.0.0.1]) by mails.dpdk.org (Postfix) with ESMTP id 220154065F; Fri, 25 Oct 2024 10:55:48 +0200 (CEST) Received: from mgamail.intel.com (mgamail.intel.com [198.175.65.9]) by mails.dpdk.org (Postfix) with ESMTP id 8FB1140156; Fri, 25 Oct 2024 10:55:45 +0200 (CEST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=intel.com; i=@intel.com; q=dns/txt; s=Intel; t=1729846546; x=1761382546; h=date:from:to:cc:subject:message-id:references: in-reply-to:mime-version; bh=MA1Qp8cg35mCxJ9i1ShTLmscvhJJ/cXF/gKM1/9i1YE=; b=jCjTYmldtlpkiYW/wboif8Ugkh67lZb9l75llRvNtnCITpQb7/ivSydx jDLeYupKYWxYXo/3KumDbf01fF15J7FLL2XlZMawMnqF3Ukk8ZycspRHP Alcki+PF954OwdDx5TU9V1LAC2wGkQjliiToS12M/u1a41T5+RYtltrz8 VYi9PFXs37aCqy6+aCFTrw4qCEezlsXAjkqfzY2kEoefhGC6RBmGwLPe8 rvHADvZWxvzsbPG7F1I/NNNbiJd4xqt04vnWrRWg1ZNFji9DpyfOyT7rw /hUXgxxJvhg7JZq1ckqKuYaitdvLI7aOM9L6KhSosWyg6RmWXpeJwhxMf Q==; X-CSE-ConnectionGUID: fxPVIRA8QrumZ7PL3J2iyg== X-CSE-MsgGUID: vONMOVx2SxOrTsnq9yYY+w== X-IronPort-AV: E=McAfee;i="6700,10204,11222"; a="52063557" X-IronPort-AV: E=Sophos;i="6.11,199,1725346800"; d="scan'208";a="52063557" Received: from fmviesa008.fm.intel.com ([10.60.135.148]) by orvoesa101.jf.intel.com with ESMTP/TLS/ECDHE-RSA-AES256-GCM-SHA384; 25 Oct 2024 01:55:45 -0700 X-CSE-ConnectionGUID: bLfEznoVRVCYgJqb9uhFQw== X-CSE-MsgGUID: K4F9oS4zQ1iL/n0vRMQnlg== X-ExtLoop1: 1 X-IronPort-AV: E=Sophos;i="6.11,231,1725346800"; d="scan'208";a="80966377" Received: from orsmsx603.amr.corp.intel.com ([10.22.229.16]) by fmviesa008.fm.intel.com with ESMTP/TLS/AES256-GCM-SHA384; 25 Oct 2024 01:55:43 -0700 Received: from orsmsx601.amr.corp.intel.com (10.22.229.14) by ORSMSX603.amr.corp.intel.com (10.22.229.16) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_128_GCM_SHA256) id 15.1.2507.39; Fri, 25 Oct 2024 01:55:40 -0700 Received: from ORSEDG602.ED.cps.intel.com (10.7.248.7) by orsmsx601.amr.corp.intel.com (10.22.229.14) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_128_GCM_SHA256) id 15.1.2507.39 via Frontend Transport; Fri, 25 Oct 2024 01:55:40 -0700 Received: from NAM10-DM6-obe.outbound.protection.outlook.com (104.47.58.42) by edgegateway.intel.com (134.134.137.103) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.1.2507.39; Fri, 25 Oct 2024 01:55:40 -0700 ARC-Seal: i=1; a=rsa-sha256; s=arcselector10001; d=microsoft.com; cv=none; b=sHmHQRvhsiUJWZ4SAjCcwDETT5eoFsPx2cJeBytGlvKjWOF5OKFRqkWYyoRDSsrtGQvinmxtYBjY0KyhauPSfYmcBW/uLwwWK0cEE5j0BVe6nm8TYCE/K2yWI6N9vLuR51CzTwwtfxQwEZ6IutqwjO8jV+quNuBzYLFnm6FatF0hh+GhCPQjnFU6OLTys1hngbz9ufnAs+xrNTfxydVqPgjLwmBX9LWpt4glijSrHYir2pKtee2EFJklU8RtMHOKCw5DlrIREozXMbmnxKj7LCE2w6aX9J1cH1Pze8yrRR3uY1d7P8lWnLl5eYQI5grnx5n7q+cMsg7dfOaKrLAX1w== 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=EopXcUBPJQaz71c0L1wy9gPE/FMWZJUc1IbhgsmSZrA=; b=cX0BRt1sxt9et3k3w31/GT1qA473PyVkKZpztN6Wbcj3nVCyEHMbkypJSzJqKK/iBoUywHHJ+4UTAZ430ZrxOrSUr7r+H+bGl1LNio7SDNlMye4n6moBBSzxVTRm3chpiZ9M4S0dBrnKXG/YQJW/JZKCf3oAQNVnPcDAMhwwVYneA2EmkM1kj7cuGwHddWjbCzkkNNNoCey5t5aHYDFiMzn7QUlz2jX/mTTf+ZFa6mnWcZAbG8bVNX1eoobf7nHsfaw0wzBXfwREa1ZyCh21zacOg6jDsKLig/fBvjfEQIMmhQBZkzOIx0UXQX1aWO+mB3Z3N4RyH+ZRvbK7e+L2/Q== 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 DS0PR11MB7309.namprd11.prod.outlook.com (2603:10b6:8:13e::17) by DM6PR11MB4641.namprd11.prod.outlook.com (2603:10b6:5:2a9::13) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.8093.23; Fri, 25 Oct 2024 08:55:36 +0000 Received: from DS0PR11MB7309.namprd11.prod.outlook.com ([fe80::f120:cc1f:d78d:ae9b]) by DS0PR11MB7309.namprd11.prod.outlook.com ([fe80::f120:cc1f:d78d:ae9b%4]) with mapi id 15.20.8093.018; Fri, 25 Oct 2024 08:55:31 +0000 Date: Fri, 25 Oct 2024 09:55:24 +0100 From: Bruce Richardson To: Soumyadeep Hore CC: , , , Subject: Re: [PATCH v3] net/ice: fix incorrect reading of PHY timestamp Message-ID: References: <20241025051419.679693-1-soumyadeep.hore@intel.com> <20241025073211.681268-1-soumyadeep.hore@intel.com> Content-Type: text/plain; charset="us-ascii" Content-Disposition: inline In-Reply-To: <20241025073211.681268-1-soumyadeep.hore@intel.com> X-ClientProxiedBy: WA0P291CA0019.POLP291.PROD.OUTLOOK.COM (2603:10a6:1d0:1::21) To DS0PR11MB7309.namprd11.prod.outlook.com (2603:10b6:8:13e::17) MIME-Version: 1.0 X-MS-PublicTrafficType: Email X-MS-TrafficTypeDiagnostic: DS0PR11MB7309:EE_|DM6PR11MB4641:EE_ X-MS-Office365-Filtering-Correlation-Id: e0de4fcd-492d-4a94-cec9-08dcf4d2c79a X-MS-Exchange-SenderADCheck: 1 X-MS-Exchange-AntiSpam-Relay: 0 X-Microsoft-Antispam: BCL:0;ARA:13230040|1800799024|376014|366016; X-Microsoft-Antispam-Message-Info: =?us-ascii?Q?mKdlE4n+/nOInJza7im0VhQ2zwaFCuJdd+7FAw4vCuQJiYHUeFMq5QvhuaPz?= =?us-ascii?Q?l1HPA6gn5TQWVhzszq57p0dHvT713CfvSDFH5qMcaO3nP9UfOv5ppjCBifkF?= =?us-ascii?Q?VSYmfvV2CQz+s4DFznQw/Wx0jrBhlDXdKfRXlYM9FkI+p83LHDHks5ZTeuZ7?= =?us-ascii?Q?8XU4IMfdQby6cGxEasOOOlljqS2gBKrfq5uE80aMZ4Mfz1X+gxaXbsAPqcuV?= =?us-ascii?Q?qH9As6SveuOQ+VOlGHcL8nyjMD3ZgJtUjLpjhxkV3Dchr/r6RnEi/FyPvrKV?= =?us-ascii?Q?/+iG3qcjpFKiaZEI4vfR4BfRpZBAyS5VXf9GEtAvxR373MOzRH89zBNV+cdu?= =?us-ascii?Q?Gvb37y0uzFnb8q0x78WBuIgYMHdF7zICow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qkiJidtJKw22c1fYFLzuPy0hV2l+CeUuRfalgGykU6BeGpt3Yr1du+MwcH?= =?us-ascii?Q?U7hx4zMc8KKEJsmPCN6rt/dr?= X-Forefront-Antispam-Report: CIP:255.255.255.255; CTRY:; LANG:en; SCL:1; SRV:; IPV:NLI; SFV:NSPM; H:DS0PR11MB7309.namprd11.prod.outlook.com; PTR:; CAT:NONE; SFS:(13230040)(1800799024)(376014)(366016); DIR:OUT; SFP:1101; X-MS-Exchange-AntiSpam-MessageData-ChunkCount: 1 X-MS-Exchange-AntiSpam-MessageData-0: =?us-ascii?Q?XVyq7ISmfQI48b8zhmPLtTpme+izVRg1hotycdq9KSnorsIKAV4/+sIqAZ68?= =?us-ascii?Q?fVOuvxI7sRGsSyCBHmco9JJfjZjKW3Cnv/h4yfNIDhqU5ZgTZpK+3OQcLM5A?= =?us-ascii?Q?z5aFZnju3L4HbqnzXW7wJEPQpWk01vpyi5KER18XwEEQMlH/jpgsnkfSK3hx?= =?us-ascii?Q?G57OX61axUNgFrt6IIc1bl+XD50mZNYoyfmIMgwZjkbv8uOc3uJBlLU9m+vS?= =?us-ascii?Q?CMybs1SaNMN4OtDahfjAVlg/mlyqk5U9d9SA93lCo5AMfKWD4kbdM5eKJZTC?= =?us-ascii?Q?uXV7IGLPYaDBdj9krYx4lihOlNqAluEaeSQxRRtg2yHy4Lr9tZZdj4bUMHpV?= =?us-ascii?Q?wycfomQLwzyWdzyFxhSa9sKeJhFdLJhbSTUfZUtQtymHQt57ADikCVXS/fsy?= =?us-ascii?Q?cRuj71aQbvbz3FXeyG0ypqukarn8boYs57ls1uL/gsrbba095oJRsXawyyUR?= =?us-ascii?Q?OHfJUzRn6JcKc5d52+1PLv/F40K66qhNDIBl1u57Pz4HalLu5mQn61Ueucnq?= =?us-ascii?Q?7k+ruevas0uPOaevN8QQTK9M2sRx+aW4ZBOS485kox1qE9wxIcwTyoU86p5v?= =?us-ascii?Q?UlidAL+Hm+fwQgUeal/+aot6zi+Q9poUSD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srhICWkd6pKJlL9iuOfgIYRkNle3mcPWqdF1vMUSQNUu+uACnEni8?= =?us-ascii?Q?hnH34MTAJ6vQuYHB6j+0iq9huu4xQU6snDdfdGCuOicqzrqMTpVTYorjEggi?= =?us-ascii?Q?VA=3D=3D?= X-MS-Exchange-CrossTenant-Network-Message-Id: e0de4fcd-492d-4a94-cec9-08dcf4d2c79a X-MS-Exchange-CrossTenant-AuthSource: DS0PR11MB7309.namprd11.prod.outlook.com X-MS-Exchange-CrossTenant-AuthAs: Internal X-MS-Exchange-CrossTenant-OriginalArrivalTime: 25 Oct 2024 08:55:31.1601 (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: Nw4so0X3XFLihg5jsBm2BuI8Lz23E3QPkGuraw8+d20xu+z+d7AMFoPZfb8veRjeT2QhBl4RBi+z0kLLk0rsoinetmJ0GoD2veTsIZNBU20= X-MS-Exchange-Transport-CrossTenantHeadersStamped: DM6PR11MB4641 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 On Fri, Oct 25, 2024 at 07:32:11AM +0000, 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 > --- > 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 7b1bd163a2..e0db47cf28 100644 > --- a/drivers/net/ice/ice_ethdev.c > +++ b/drivers/net/ice/ice_ethdev.c > @@ -6517,12 +6517,28 @@ ice_timesync_read_tx_timestamp(struct rte_eth_dev *dev, > struct ice_adapter *ad = > ICE_DEV_PRIVATE_TO_ADAPTER(dev->data->dev_private); > uint8_t lport; > - uint64_t ts_ns, ns, tstamp; > + uint64_t ts_ns, ns, tstamp, tstamp_ready = 0; > + uint64_t start_time, curr_time; > const uint64_t mask = 0xFFFFFFFF; > int ret; > > lport = hw->port_info->lport; > > + start_time = rte_get_timer_cycles() / (rte_get_timer_hz() / 1000); Why all the division by 1000? > + > + while (!(tstamp_ready & BIT_ULL(0))) { > + ret = ice_get_phy_tx_tstamp_ready(hw, lport, &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) { Is 1 second not a very long time to wait for this? Surely even milliseconds is a very long delay in this case. In terms of the logic, rather than constantly comparing vs the start time and doing lots of division, I think it would be simpler to just set a max end-time. For example, to keep the current 1s limit: uint64_t end_time = rte_get_timer_cycles?() + rte_get_timer_hz() ... if (rte_get_timer_cycles() > end_time) { ... } > + PMD_DRV_LOG(ERR, "Timeout to get phy ready for timestamp"); > + return -1; > + } > + } > + > ret = ice_read_phy_tstamp(hw, lport, 0, &tstamp); > if (ret) { > PMD_DRV_LOG(ERR, "Failed to read phy timestamp"); > -- > 2.43.0 >