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 F179B45C88; Tue, 5 Nov 2024 12:33:18 +0100 (CET) Received: from mails.dpdk.org (localhost [127.0.0.1]) by mails.dpdk.org (Postfix) with ESMTP id 89D05402B3; Tue, 5 Nov 2024 12:33:18 +0100 (CET) Received: from mgamail.intel.com (mgamail.intel.com [192.198.163.16]) by mails.dpdk.org (Postfix) with ESMTP id 2AEE240151; Tue, 5 Nov 2024 12:33:15 +0100 (CET) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=intel.com; i=@intel.com; q=dns/txt; s=Intel; t=1730806396; x=1762342396; h=date:from:to:cc:subject:message-id:references: in-reply-to:mime-version; bh=U2FIoNrLnAtgqsL1vThtAwj14Va8ru1g/LS++4372L8=; b=JPvcNKHJ3gNFv0qQuKiStNvzBUY+DtOi2W5TeqnaFXcUoQbIPMlb5P5s MyxLxj7CUTKvCdXJRRSQ6k6W82qmiAxicj1nChdAmSWqMeKkc/kIHOsRg 6V39EWKoXm5eV6SRvxiD2SaGkrZ3d4JoYLoU4ra73H6MN9zGuWq0BWrFD 4UAtM+LFmksDjZl+Kj1LxeGfsdBEOboniJ1e9BVLUyBWH8KGlCLiMe2bl WwhJRevQIcpZOP4mwc23GE8E5Yr5K8ZcIkueovq+93SjclPcoDcC8GAj+ xjS3bKUGcTwz22aIn8vFAWJ8cpRsuVNMiwFJvpegf8huh8J389uvTkCxw w==; X-CSE-ConnectionGUID: psu9jRj3RguAoeajgjT7vQ== X-CSE-MsgGUID: S1QkNab9Ql2v6wTFIcQ8RQ== X-IronPort-AV: E=McAfee;i="6700,10204,11246"; a="18168687" X-IronPort-AV: E=Sophos;i="6.11,260,1725346800"; d="scan'208";a="18168687" Received: from fmviesa001.fm.intel.com ([10.60.135.141]) by fmvoesa110.fm.intel.com with ESMTP/TLS/ECDHE-RSA-AES256-GCM-SHA384; 05 Nov 2024 03:33:15 -0800 X-CSE-ConnectionGUID: Dk9ff+rESwa1sdJNJb+t8w== X-CSE-MsgGUID: oJng1kdGSHykVEUFZ8ZZFw== X-ExtLoop1: 1 X-IronPort-AV: E=Sophos;i="6.11,260,1725346800"; d="scan'208";a="114772378" Received: from orsmsx601.amr.corp.intel.com ([10.22.229.14]) by fmviesa001.fm.intel.com with ESMTP/TLS/AES256-GCM-SHA384; 05 Nov 2024 03:33:15 -0800 Received: from orsmsx601.amr.corp.intel.com (10.22.229.14) 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; Tue, 5 Nov 2024 03:33:14 -0800 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; Tue, 5 Nov 2024 03:33:14 -0800 Received: from NAM11-CO1-obe.outbound.protection.outlook.com (104.47.56.171) 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; Tue, 5 Nov 2024 03:33:14 -0800 ARC-Seal: i=1; a=rsa-sha256; s=arcselector10001; d=microsoft.com; cv=none; b=S8ZPFVfYU+qmfkCNKt/g/j9UcvfkjThaQ8XiSsmdBjbUtU/bOV004O4+4Askaff2xHBK9OjU8tnYg8yWrxz8FT5CsmKQjLFw+G0uRy4kAniAbMog3tV3lxfRMcGujBktxATrvvWfKvqkaYPEYNdP7hCuZQI1S4+/Ej1t6y1HqlY455Lqbm8CVqnK3kjjbzyijkm11MQ5Y9sQFXu8uC9Upfi5tl1+xHX7xEt5mD2O1pdYsck0vpODe4CT5KWzDBGjAHswoS7QXQODTVrZBVnoHGUSsmjRjdF/nHm9ZCPtFw6mg6hiNtT3DmW5jsr3XwiTlhqlp5FY95McC7Gs+vqdHA== 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=byU1CcJ6O6T6BJbuFYW+lTP2Lw8eN74pDfgzDl0cchw=; b=MeptfLqwp3/6qX00GYF9pnxcmsOz3uqWSC/BBArg3BMJNJnuuQ5jI2NfDXnWMxKeXZjCRVZnmV3eOFQtMpu7xkgXJJN0FZxcRFNl0r8spQVtA1n0pti18RjaYhAKzUmTvkclbFlsKUhRz0MuQ3GL9CrsXsk1U4xmLzhQ4mUtWKkvBL3qTdnpSgu4Fqlo3Vrv7yiHZPsKUDWQD4KUdhqL/iM9P1yL3yAwyDw7U0vdPlqIEPZCUGb/M0bSEo6+7Z8L58poS6xGtiVGxf4IVAuoufpAeD38CpUqSmKqUTTkuj4hrwhuJcko1FwxLrE+Ww6Ota8zBhFWbrLUCRsoLhVemg== 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 CY8PR11MB6914.namprd11.prod.outlook.com (2603:10b6:930:5a::13) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.8114.31; Tue, 5 Nov 2024 11:33:12 +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; Tue, 5 Nov 2024 11:33:12 +0000 Date: Tue, 5 Nov 2024 11:33:07 +0000 From: Bruce Richardson To: Soumyadeep Hore CC: , , , Subject: Re: [PATCH v4] net/ice: fix incorrect reading of PHY timestamp Message-ID: References: <20241104103112.885071-1-soumyadeep.hore@intel.com> <20241105101419.888975-1-soumyadeep.hore@intel.com> Content-Type: text/plain; charset="us-ascii" Content-Disposition: inline In-Reply-To: <20241105101419.888975-1-soumyadeep.hore@intel.com> X-ClientProxiedBy: DU2PR04CA0217.eurprd04.prod.outlook.com (2603:10a6:10:2b1::12) To DS0PR11MB7309.namprd11.prod.outlook.com (2603:10b6:8:13e::17) MIME-Version: 1.0 X-MS-PublicTrafficType: Email X-MS-TrafficTypeDiagnostic: DS0PR11MB7309:EE_|CY8PR11MB6914:EE_ X-MS-Office365-Filtering-Correlation-Id: 2315516e-d801-4c91-9331-08dcfd8da18e X-MS-Exchange-SenderADCheck: 1 X-MS-Exchange-AntiSpam-Relay: 0 X-Microsoft-Antispam: BCL:0;ARA:13230040|366016|376014|1800799024; X-Microsoft-Antispam-Message-Info: =?us-ascii?Q?+SGykF9DjotFf5Bb34pkIfTsYpR2GlFafZKWgc4VRNKtL7nWNvsFTDekoYoB?= =?us-ascii?Q?CR+8Bv8FT7RPMfoxJDnquNQtCtFuk53o/zAhNCIeIq8UeTRKIehKdwl5cTHJ?= =?us-ascii?Q?IJ0BmnDSEJNtPhA+EmnXPyE8GVJPOIRLogeqYcmPKXa5QBQqP3Kh6UBvvDsK?= =?us-ascii?Q?PnVjOjGkQWPLGk8uLTHm5PTnSlHOB4gqMRIUmDJuB+BaDrflRQyqyVLUi2HJ?= =?us-ascii?Q?HTT1wJmh6heZSHDEM9rNaPFxAEvhSvuOkkczezoYlYPomkpdpUxWTh4NxKdC?= =?us-ascii?Q?YEd68mfGSxNQ2m7aWvAMNNDbt05oJZwbCuW663MGv/XBGTMUpTRei1DIsE0Y?= =?us-ascii?Q?wBrNsSX1M5NpFuPFc8wAfANH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ii?Q?ZKZPnL/M0Mt0oX1Ez5b11cdDUbgbqUxjecjWA6pk+WHiBZwtIhtE1HVozZcb?= =?us-ascii?Q?odoaIHN6SvlTnDkysVmcRRGl?= 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)(366016)(376014)(1800799024); DIR:OUT; SFP:1101; X-MS-Exchange-AntiSpam-MessageData-ChunkCount: 1 X-MS-Exchange-AntiSpam-MessageData-0: =?us-ascii?Q?81RVwgKV/gadolnAcT0hfGNjkPKiHg23vsWTcJ/TeDsKs41sMPO0RzjgXW2l?= =?us-ascii?Q?65nejjVa2uIpBX3FvxrgtokTqt2cnVAAZWBot3Xj8CD3Sfb+EXXQFCHSWhVs?= =?us-ascii?Q?x+6yqBJowweXrfamzyCXfO/h1DgteEZcdKLDnznif03F5yKksfp4dHlrpJE2?= =?us-ascii?Q?7Zr2LuCo9v/9o+2ihohSLmvEKCe9kdxEzMVLso9Fp0IzSIF5m0GGSl6SddiJ?= =?us-ascii?Q?SrClAyizbM321LVZPuXulkII9P8jCH/LuFJXygw4/eAqC7WvjkxSbn+/6UdP?= =?us-ascii?Q?53X5Gsb2qGwe+WUFfuGq4CI7xUb+UAmqZ6zkoIoAtduKXOkPVVYf8mihsk3R?= =?us-ascii?Q?OkDwXjGb0mXIiI3CyZtAAXFDqqyiuEjw4vihtTFMFXbUQL9xgo2ymMKpAplv?= =?us-ascii?Q?4zvlfX84XtEDu28k8pAKIzcw/pOzBqBpCdKWwiYsF9vDATi6d8d9sHSVYnGp?= =?us-ascii?Q?b6asn0HMoZvlAygIAXbWcXPPnczjLzhGjZWdMvrNJSmozVpMWcHc/SGOGDS9?= =?us-ascii?Q?LBJnG23noiJxehH6lYsbaoIVxSLI6VO9LXMaz+gbryjE4GqN2lGywjrdCfg7?= =?us-ascii?Q?WqgLCMwnxdRodlw8G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mad6I1m?= =?us-ascii?Q?kEawfMQZiVg/e69XBSuIiULim+CiOqSYeEpmOKAzJrdsLP6jJwes4nkGQYQu?= =?us-ascii?Q?wtfXXhSCq3p2KQRpZ89Nc3Wwt3YiPWT8Wrv4C/gvr2wGGQ/syfynVfgPTKEN?= =?us-ascii?Q?FQ=3D=3D?= X-MS-Exchange-CrossTenant-Network-Message-Id: 2315516e-d801-4c91-9331-08dcfd8da18e X-MS-Exchange-CrossTenant-AuthSource: DS0PR11MB7309.namprd11.prod.outlook.com X-MS-Exchange-CrossTenant-AuthAs: Internal X-MS-Exchange-CrossTenant-OriginalArrivalTime: 05 Nov 2024 11:33:12.3942 (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: ZcZuEsJyD/vn0HsNdu/NSUbVeAK2G2XGbwVRHW3KCMAOe0LB6RdrsF5hWZ49wtz+hvw4zBuNlKE+mJ6knw0d/X6rNF0Kcj789pG5CPi6JGI= X-MS-Exchange-Transport-CrossTenantHeadersStamped: CY8PR11MB6914 X-OriginatorOrg: intel.com X-BeenThere: dev@dpdk.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: DPDK patches and discussions List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: dev-bounces@dpdk.org On Tue, Nov 05, 2024 at 10:14:19AM +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 > --- > v4: > - Addressed Bruce comments for do while loop introduction > --- > v3: > - Decreased the end time delay from 1 second to 10 microseconds > --- > v2: > - Addressed Bruce's comments > --- > drivers/net/ice/ice_ethdev.c | 19 ++++++++++++++++++- > 1 file changed, 18 insertions(+), 1 deletion(-) > > diff --git a/drivers/net/ice/ice_ethdev.c b/drivers/net/ice/ice_ethdev.c > index 70298ac330..7e2c6107ff 100644 > --- a/drivers/net/ice/ice_ethdev.c > +++ b/drivers/net/ice/ice_ethdev.c > @@ -6597,10 +6597,27 @@ 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 end_time; > const uint64_t mask = 0xFFFFFFFF; > int ret; > > + /* Set the end time with a delay of 10 microseconds */ > + end_time = rte_get_timer_cycles() + (rte_get_timer_hz() / 100000); > + > + do { > + 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; > + } > + > + if (rte_get_timer_cycles() > end_time) { > + PMD_DRV_LOG(ERR, "Timeout to get phy ready for timestamp"); > + return -1; > + } > + } while ((tstamp_ready & BIT_ULL(0)) == 0); > + Unfortunately, this is still not quite right. The important change in my last feedback was not the introduction of the do-while, but the switching of the two blocks inside the while loop, or the adding of an additional check to the timer expiry. You need to check that the bit is still not set before checking for timer expiry. When "get_timer_cycles() > end_time", it may also be the case that (tstamp_ready & BIT_ULL(0)) != 0, in which case you want to continue rather than returning error. /Bruce