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 1517345C94 for ; Wed, 6 Nov 2024 12:00:00 +0100 (CET) Received: from mails.dpdk.org (localhost [127.0.0.1]) by mails.dpdk.org (Postfix) with ESMTP id 0C71C42E4C; Wed, 6 Nov 2024 12:00:00 +0100 (CET) Received: from mgamail.intel.com (mgamail.intel.com [192.198.163.18]) by mails.dpdk.org (Postfix) with ESMTP id 2F51A40265; Wed, 6 Nov 2024 11:59:57 +0100 (CET) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=intel.com; i=@intel.com; q=dns/txt; s=Intel; t=1730890798; x=1762426798; h=date:from:to:cc:subject:message-id:references: in-reply-to:mime-version; bh=8H+KfvoC0qI3J+tZRMwBjqukrFZsIL8uNdIm31gT/mk=; b=nvVzFLnS0Zi23uists0SN3X9/agynEf/wR6KOAovbIR32Dlm9FRqKwnj oriGBX245g/bPWYvjtAY64cr/5GJPED0ukcOjnqycpF3vZN3rC6wGVPAw MeThVeqnxv4nyQy9aLVeifDvJCgivGLr7auIVhJxL+MDi3WyCn1AsRqGv SvmHkYJx7s40aUi78jyntp15QL4LGAOVg6TC2hqG5D5u+aGuoV09mZpOz ig2r262GOHt9e7UcQ/S5W2/tIt8vX4ohNh8KO5Oxa5E6DEw2QMZfXiFZk 1WmoDdGEuQusgqJnf/YVxCOUJ3VoFipvfj3m/pNpLObk6/mYoImR4qJjS g==; X-CSE-ConnectionGUID: x+muaMtBSYqmKKBlwHv5gQ== X-CSE-MsgGUID: YPVBatj1StCDs7WF1V0R7A== X-IronPort-AV: E=McAfee;i="6700,10204,11247"; a="30110608" X-IronPort-AV: E=Sophos;i="6.11,262,1725346800"; d="scan'208";a="30110608" Received: from fmviesa002.fm.intel.com ([10.60.135.142]) by fmvoesa112.fm.intel.com with ESMTP/TLS/ECDHE-RSA-AES256-GCM-SHA384; 06 Nov 2024 02:59:56 -0800 X-CSE-ConnectionGUID: x8utYUAWTjy3qTT45A9V6A== X-CSE-MsgGUID: Fl+p/d7YRlSDuUII7jaTfg== X-ExtLoop1: 1 X-IronPort-AV: E=Sophos;i="6.11,262,1725346800"; d="scan'208";a="107801928" Received: from fmsmsx602.amr.corp.intel.com ([10.18.126.82]) by fmviesa002.fm.intel.com with ESMTP/TLS/AES256-GCM-SHA384; 06 Nov 2024 02:59:56 -0800 Received: from fmsmsx601.amr.corp.intel.com (10.18.126.81) 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; Wed, 6 Nov 2024 02:59:55 -0800 Received: from FMSEDG603.ED.cps.intel.com (10.1.192.133) by fmsmsx601.amr.corp.intel.com (10.18.126.81) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_128_GCM_SHA256) id 15.1.2507.39 via Frontend Transport; Wed, 6 Nov 2024 02:59:55 -0800 Received: from NAM11-DM6-obe.outbound.protection.outlook.com (104.47.57.169) by edgegateway.intel.com (192.55.55.68) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.1.2507.39; Wed, 6 Nov 2024 02:59:55 -0800 ARC-Seal: i=1; a=rsa-sha256; s=arcselector10001; d=microsoft.com; cv=none; b=zAv3IJ/kA1BeucvWfJbYXuscFV6wdrnuFXzylZCykLWsNUOHEA2tQlXWYYS9Bp37xqfmZLZ66pr0hkWBZdlOOEMGPfVufBjbZ7N4YS9XBcoeeSsJDEagfdsPBN0gOD8Xz2tOh7XyAhK2ev7rpIXPoMl3gyq+Duh8ZcrOaO11jBruQobaFooMeAsLBvBlyhCqqW7YzlWPi8JYttWl72vg3d2Rhr22RmgQrh90p1pZlQyP97Un/9YWrmnmghgHPjHQ8X21q9T3ZmOGGXA5ozJhaMRtVLCBHwhaiD1myLjKpWF6Om4kMZmnw/fzAbx+m7lw03LkfpTOdG5TXDXBARcgaw== 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=AoMe8Nhf6SSYvY/kKetsoR9lTA0bGZ25/eS/004Wp0c=; b=tCJfPCNlYV/XRHhDM8MU7aOGR+QLzbvSYv6grnAvDLCqTqU2kHuTTU9rAHxlf3OCaqDqinFh+WWxByResq6Z0EHYj3ieayGlOQxthEcvxfa2qrrb1NLAYIN6UhVuu5byjdL3andUSd/2Gje+1HYlQ+MeuWF06jnPnAurgPJ7LlcVXdtaScfSlY2/Gdgw+nxbdp3Aupu7C8yPvpVmIPt0JKY7oYjR4xkAD3GdSITR56xOKojGEKAcsY64HWtHZ/51H2jzxEblJR06lbbf2C6IIGZe/vmAVC0UqC2uSmwSG3emZQ3gb6J+LHDrb8hW9dgoxN0eLH9x2rlvxAAk5a8ZLQ== 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 DM4PR11MB8178.namprd11.prod.outlook.com (2603:10b6:8:18f::20) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.8137.19; Wed, 6 Nov 2024 10:59:53 +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; Wed, 6 Nov 2024 10:59:53 +0000 Date: Wed, 6 Nov 2024 10:59:47 +0000 From: Bruce Richardson To: Soumyadeep Hore CC: , , , Subject: Re: [PATCH v5] net/ice: fix incorrect reading of PHY timestamp Message-ID: References: <20241105101419.888975-1-soumyadeep.hore@intel.com> <20241106082229.892805-1-soumyadeep.hore@intel.com> Content-Type: text/plain; charset="us-ascii" Content-Disposition: inline In-Reply-To: <20241106082229.892805-1-soumyadeep.hore@intel.com> X-ClientProxiedBy: DU7P250CA0023.EURP250.PROD.OUTLOOK.COM (2603:10a6:10:54f::11) To DS0PR11MB7309.namprd11.prod.outlook.com (2603:10b6:8:13e::17) MIME-Version: 1.0 X-MS-PublicTrafficType: Email X-MS-TrafficTypeDiagnostic: DS0PR11MB7309:EE_|DM4PR11MB8178:EE_ X-MS-Office365-Filtering-Correlation-Id: ff1f5ded-93a2-4142-ea8c-08dcfe52241c 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?VZxLvPUaEZjqTfzLdkpjt+wcD9DbeBaTpSElxQePvvnv4CqM9nL+liEnaGMw?= =?us-ascii?Q?bY7BjPg3QbgFOPusCbjM7EqyU3aG8kWmOiGCD2dh/RoRU5M9XWuQwX3kCKzL?= =?us-ascii?Q?i1S7f82Y2CIFDqIH9pSh7UBVOh9HM2k764la2Glh2XryLjqflaVZlRJ8q4Wf?= =?us-ascii?Q?a+jz3g3qsjtEishFxX4MU2Wgn6aoHVMWNAUdmDFj8jatOb7iyD1ZVe4L9isO?= =?us-ascii?Q?RBIVmEwS14+qIQgVaFAXA2oyxaWSk44j2d1V7lHvyLOBVKjOo6r11Epzsmtx?= =?us-ascii?Q?rDIeA5yTWPWal5oTF2cN4fWCwoD0lUwdarmA0yJVpaA79fN7U1wMm0Mx4g2P?= =?us-ascii?Q?ObwJGKgGtiVmzT0lf6zQRq/IF0SqNP5cdKI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8EX16M2aaEJl3kF6+DTdVaAYsaPMBjtjfJHgidBNk+U9/y?= =?us-ascii?Q?vXWvns62C9Z3rovE++QId/Sg?= 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?wzblu3G99+ZygSD8JPK4WBeD858vd/feSpC8+H6BEWtl2+ilk9QTa1Nvb6LN?= =?us-ascii?Q?WF8TKk4DJb+Y2t5myfuJ6sZLsvfJhQHGuBqva5hZsvU0Dn3L4V9seFvEg2Oy?= =?us-ascii?Q?QQXBAp74/jDhA7j+St9QBz8EoJl/NOwZqTCbeEUtq9OPyqiBN8sEa0gyfksC?= =?us-ascii?Q?714NFapNF61QkeQE7pxySXtACbwXVAKPC5nDPv8ygnfmEJ+4hB1LfSYGCWCE?= =?us-ascii?Q?l1T48k0kwgQQF6DoLPvob3jvyDctk2Sqq9wkuPc8iFmPd/agFizs/0mmzZ2c?= =?us-ascii?Q?LAbNK/N3HpArSLgn0Q+vUxJf5BuiruL+fh8uloPNNJue70idQ6NZZTkHkbdf?= =?us-ascii?Q?7rslxVldbAax2n9BjzPJpKoJUkrXLNuW9qhakawS9eX5ebVjWiQBZnfxJUsP?= =?us-ascii?Q?2+mEZb9JL1TT9UwdP9RF6NcxX8CAESwTpDWrG8X6xKDpsXu6d3z498qLn5dt?= =?us-ascii?Q?qKDFmYii1+vzUV5a0LU+c/xB5JzGexLsS5vrymAt+1GCThQRrXf2jc8r2yCg?= =?us-ascii?Q?W/IEUBJJ4lKkywDQtBAmreAR/6B10JSzRw20N4F+o67bT4YMwjfTL5V8kknb?= =?us-ascii?Q?VYc2h/pthipt5XxTY05lOb1Mq6gRu1UlfVyu2vq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6VfexBBtaULCw2rJf2CpTKv2rgV2yZ//9KC1qfwlcSp2/?= =?us-ascii?Q?eTkgGq62/dMYALjWht6zhdZAk2qfobO/pxydkmR4/7ALhu+Tkez8qPFLP/L7?= =?us-ascii?Q?xw=3D=3D?= X-MS-Exchange-CrossTenant-Network-Message-Id: ff1f5ded-93a2-4142-ea8c-08dcfe52241c X-MS-Exchange-CrossTenant-AuthSource: DS0PR11MB7309.namprd11.prod.outlook.com X-MS-Exchange-CrossTenant-AuthAs: Internal X-MS-Exchange-CrossTenant-OriginalArrivalTime: 06 Nov 2024 10:59:52.7909 (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: fIl+VH+QmqfGH72yyx7j6pg5/RZwDOIvlfHU15LNT0tzMriVW+zUxUmxPvB/0lmHyMjP/+/InUmNBQwud68sP766d2AagrfDwK6PBP9wDj8= X-MS-Exchange-Transport-CrossTenantHeadersStamped: DM4PR11MB8178 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 Wed, Nov 06, 2024 at 08:22:29AM +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 Reviewed-by: Bruce Richardson > --- > v5: > - Addressed edge case as specified in Bruce's comment > --- > 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..4a7fb2b656 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 ((tstamp_ready & BIT_ULL(0)) == 0 && 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); > + > 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"); > -- > 2.43.0 >