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 EE79B4548E; Tue, 18 Jun 2024 17:11:05 +0200 (CEST) Received: from mails.dpdk.org (localhost [127.0.0.1]) by mails.dpdk.org (Postfix) with ESMTP id C628C40DD8; Tue, 18 Jun 2024 17:11:05 +0200 (CEST) Received: from mgamail.intel.com (mgamail.intel.com [198.175.65.12]) by mails.dpdk.org (Postfix) with ESMTP id 7D280402B4 for ; Tue, 18 Jun 2024 17:11:03 +0200 (CEST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=intel.com; i=@intel.com; q=dns/txt; s=Intel; t=1718723464; x=1750259464; h=date:from:to:cc:subject:message-id:references: in-reply-to:mime-version; bh=6AX0zIIUeJNoFV6kWrqYrhIZ3OjyucrFLmg60dQ7wFg=; b=WxZ0x5WPgTINSASPCwO1rAWQi9mUZgHd6oRF8mkgPaSU4qbTU4PaBtR+ Fae26Dbh8Srn4N2bePocvq7NMMNcETt50W2zFCrSwUsxfhxrGmxSR7L5q Zs9GQsFhxcAFQOStV8382/N+GImUjbTkgYhlzcEKpVyAbVCwSOHQLt0jr 3gUWM5X46GfzoozwZbjObfskBoItzqVn876QHR4HtkHqn8mSVK4nfaVs9 rDybYbpHBbHan75cZ3coXcCY3vfRCrQHkPN8YLMXgRYDrgBxbiq6+C849 QsH8ymOlKsiRKHLJQzFBMlEDIzKNIx/qY8ePdhYv3IQ9LALAIUJ3KgDsS g==; X-CSE-ConnectionGUID: hzJVuczzS6O102QkwjjWfQ== X-CSE-MsgGUID: qeq8riz9Rxm6Y5FD8BMOQQ== X-IronPort-AV: E=McAfee;i="6700,10204,11107"; a="27024134" X-IronPort-AV: E=Sophos;i="6.08,247,1712646000"; d="scan'208";a="27024134" Received: from fmviesa003.fm.intel.com ([10.60.135.143]) by orvoesa104.jf.intel.com with ESMTP/TLS/ECDHE-RSA-AES256-GCM-SHA384; 18 Jun 2024 08:11:03 -0700 X-CSE-ConnectionGUID: WWT3kVJIQPCfa1SoBtUEmg== X-CSE-MsgGUID: gP+9009eRYOGM6P5efYPlg== X-ExtLoop1: 1 X-IronPort-AV: E=Sophos;i="6.08,247,1712646000"; d="scan'208";a="45954828" Received: from fmsmsx602.amr.corp.intel.com ([10.18.126.82]) by fmviesa003.fm.intel.com with ESMTP/TLS/AES256-GCM-SHA384; 18 Jun 2024 08:11:02 -0700 Received: from fmsmsx610.amr.corp.intel.com (10.18.126.90) 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, 18 Jun 2024 08:11:02 -0700 Received: from fmsedg601.ED.cps.intel.com (10.1.192.135) by fmsmsx610.amr.corp.intel.com (10.18.126.90) 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, 18 Jun 2024 08:11:02 -0700 Received: from NAM10-MW2-obe.outbound.protection.outlook.com (104.47.55.43) 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, 18 Jun 2024 08:11:01 -0700 ARC-Seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=U7c0fgWLV9x9fYdRyA/PsNStJkIJAYZ5YPXqRbE3vfSVg+Dwdwk4gI7le6iLQ1uQpNSo+lJG/s79unQynpKjMm+beT7L1RjnGWH6+OAs2ML67UEEMPNY/x6skHMEaR4gBgTfridQBSyPk07Zt8AR5rtdgCdP5FTKrovXpA3jra9Y/iUlxfGpPBNJvJfNazGWGYqqRNPG7bR7ofwvIll0QQ5DlLYTlu8vDHPOUJGkE9gU6+w3qJJzn7gXeY5BjuCcqpSXOR/oW5114WfJc1NkKYhRdYTfMr/qrmfVr6JY+o1lYn8N32pYEqTTfit01880Yfhqy0EMDXuewLesSLetRA== 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=D1jrXKgtbbeg1sehl8cdyRXBJ+rmVtfcm+x5AH+kErQ=; b=hskyMGMWMqGt3U0SBsLMw9XkIpErnukqdquF3nmCuMwX8pkyMwb99kRASHyAyNxdHjOWTZHdStIqfHSc8nJBytPQX3ChwyyQFCGFcAYoMqOoyHxrsFolRu8+NBXJuMldhPaLmCboI3Svf3tO1psSwDd96oCN72ZkuFkE+OwYEvvwo3Jswvyzif1JHEyyQtfwrzi4wcERRzgf/ByTxLVKCIvT89cJczJcDbAT4jHWu4zlzdrY8HPuHhkdLc6bLn2YhJurCVOGaSlOuYBvyJQux7nvh72EWk1oPzcD6JGqpH0kVafAah3hCwyWXgcC9S6LFulaMWUxTV8AEpLZTZsZgA== 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 PH7PR11MB7025.namprd11.prod.outlook.com (2603:10b6:510:208::12) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.7677.30; Tue, 18 Jun 2024 15:10:59 +0000 Received: from DS0PR11MB7309.namprd11.prod.outlook.com ([fe80::f120:cc1f:d78d:ae9b]) by DS0PR11MB7309.namprd11.prod.outlook.com ([fe80::f120:cc1f:d78d:ae9b%7]) with mapi id 15.20.7677.030; Tue, 18 Jun 2024 15:10:59 +0000 Date: Tue, 18 Jun 2024 16:10:54 +0100 From: Bruce Richardson To: Anatoly Burakov CC: , Ian Stokes Subject: Re: [PATCH v2 055/148] net/ice/base: fix ice_ptp_one_port_cmd to avoid stale PHY commands Message-ID: References: <20240430154014.1026-1-ian.stokes@intel.com> Content-Type: text/plain; charset="us-ascii" Content-Disposition: inline In-Reply-To: X-ClientProxiedBy: DU7PR01CA0033.eurprd01.prod.exchangelabs.com (2603:10a6:10:50e::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_|PH7PR11MB7025:EE_ X-MS-Office365-Filtering-Correlation-Id: 29317bd7-a443-460c-6f9f-08dc8fa8dc47 X-MS-Exchange-SenderADCheck: 1 X-MS-Exchange-AntiSpam-Relay: 0 X-Microsoft-Antispam: BCL:0;ARA:13230037|366013|376011|1800799021; X-Microsoft-Antispam-Message-Info: =?us-ascii?Q?HAHLVF57qkLmekdQL2xwfWSSTZ263zF7ZqKjYq1tX3x6MMtCapzfvzBEOfHz?= =?us-ascii?Q?Z8Nz97gtIKu7RYB4Gm3kMNM7loWSBY8ads729eGcVWllMU22eT3Uh/Pu14md?= =?us-ascii?Q?u1RjFn+FgrzOA1MGOIw+CarDFEnsWEuoscQs3L9CeCFJAnJz4CyNzuxlUHH1?= =?us-ascii?Q?5/SAvAd1yiB7Rci8J06v6KVGSjHmW8nLFSZj2IO2TukKqHDGjrtO2TKjAe1o?= =?us-ascii?Q?N/CRQPAQlRymAnkn/e8gJ+rJvVLF8/3LeV4aWSG8a1gBUKPgkj7a1j6UJqjc?= =?us-ascii?Q?LxXLjed0wToXJGz3ZkJOvuBozjgmS3TBdUH/jZRYiOydROUt9OpnMbwtsKEy?= =?us-ascii?Q?2Vd1lL3XwcIXqhydswRjym52aWRfmEjYYU+oS1Y0vRzqoR1x0hwSkC0Ostgx?= =?us-ascii?Q?LOzSz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3seHKfmFFh9crjQv5e0FA5iTD?= =?us-ascii?Q?yA4eK3DDdFVKJoApGsV4o+Pm?= 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:(13230037)(366013)(376011)(1800799021); DIR:OUT; SFP:1101; X-MS-Exchange-AntiSpam-MessageData-ChunkCount: 1 X-MS-Exchange-AntiSpam-MessageData-0: =?us-ascii?Q?emtP/e/oa5zaya644xLOlv2mCFG3JzeM+pUqFpV0JueMFwYF+2Qkrh+gfshS?= =?us-ascii?Q?rz+BMiie0QzcfxGSEL828NzNASoGIduRiV1OVy4Mt12EuZd3Hp7UxnjPGbjW?= =?us-ascii?Q?gBy9YQRdlahorAbjsuuCNl9RbnvLuNLH/WKXkGlnxno4lxOhtprqcDDtanJ7?= =?us-ascii?Q?cS5mIMT5wuKKpyAzfU0NXFkecpd8zlzTDHqqRFoJxDfRtRMIi0xNReg4SIjb?= =?us-ascii?Q?kHK1oey4hWsyXw/CcUPmxQM+uclOFh9JIpRrKAhyreB4wdFKyeo1GlUjfhFe?= =?us-ascii?Q?rRoaSRM5W85TWMQrh/mYPFFtLw3cR++eAVZ6zSeGdJvrCD5kwjv5xi3N4MG4?= =?us-ascii?Q?S2sDolbTVxcTucVXmZjB0VWo2PBG5KizNWcX59rYK3ucDI6RqCeK0fW7/HCA?= =?us-ascii?Q?qIT0w1nAHR99RS/zwlOTw6aZw0pZYBd6WMIt2RtGM7ARMY9nEOs87o5thQAV?= =?us-ascii?Q?BAm3f815yg92F5v9Leg2+XOofD8AiT67KSkIesBXV1FnyyWZde7VpLPFpsNI?= =?us-ascii?Q?atptqC6J8QLHipGgkG0z0N3eLsRYx0RNsxzY+Z3f83YKbQDnrwNFkhl3gyUW?= =?us-ascii?Q?XfLhhRIc8ixZtPhbGjQSfHxRthS+KOt+hs9dGa586q5R/ZevUg3QIDAuQby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773ZxIdltiGF+IniICF?= =?us-ascii?Q?s3yuwqaEdFhmx3wZpJA2K1FsNdoEVwUbMslDHQ5H5W/akAJI1TU8QA5DKucm?= =?us-ascii?Q?tQ=3D=3D?= X-MS-Exchange-CrossTenant-Network-Message-Id: 29317bd7-a443-460c-6f9f-08dc8fa8dc47 X-MS-Exchange-CrossTenant-AuthSource: DS0PR11MB7309.namprd11.prod.outlook.com X-MS-Exchange-CrossTenant-AuthAs: Internal X-MS-Exchange-CrossTenant-OriginalArrivalTime: 18 Jun 2024 15:10:59.5337 (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: b9S6Es2xCaj9ef5rTVe6vd4DbnfygqLwTTnvXoFZqORP5ktNBnu+GlCojH6TxLL9ReVHNRrhnvf4UkAIW1+zKEd4KG4l7HkJjruk+XFGao4= X-MS-Exchange-Transport-CrossTenantHeadersStamped: PH7PR11MB7025 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 Wed, Jun 12, 2024 at 04:00:49PM +0100, Anatoly Burakov wrote: > From: Ian Stokes > > Code using ice_ptp_one_port_cmd() (or the device specific variants for E822 and > ETH56G) has a subtle bug where-in the executing of ice_ptp_exec_tmr_cmd() will > cause all other ports to execute their last executed command. > > Most flows operate on all timers at once, but some flows such as handling link > state change only operate on one port at a time. This can lead to issues if the > userspace performs clock operations at just the right time. > > In addition to this bug, recent support for new hardware families has > complicated the structure and organization of the various functions involved in > programming PHY ports. > > For example: > > * ETH56G and E822 both re-implement the same looping structure for > operating on all ports > * E810 and E830 use "ice_ptp_port_cmd" which takes a register value to > write and only operates on these two families despite having a generic > name. > > Refactor ice_ptp_one_port_cmd() to both fix the issue of stale PHY port > commands, and reduce the organizational complexity. > > Rename the existing device implementations from ice_ptp_one_port_cmd_ to > ice_ptp_write_port_cmd_. This function just performs the task of writing > one command to one port. Do not export this outside of ice_ptp_hw.c, instead > ensure all callers use the refactored ice_ptp_one_port_cmd() which properly > initializes all ports. > > Fix ice_ptp_one_port_cmd() to correctly loop over all ports. For the configured > port, call ice_ptp_write_port_cmd() with the configured command. For all other > ports, call ice_ptp_write_port_cmd() with ICE_PTP_NOP. > > Stop duplicating the port iteration logic in each of the > ice_ptp_port_cmd_() implementations, instead moving this into the generic > ice_ptp_port_cmd() implementation. > > Since every flow now properly initializes both the main timer register and all > port registers, ice_ptp_clean_cmd() is no longer needed, so remove it. > > This fixes the issue of using stale PHY port commands, and aligns better with > the flow for how ice_ptp_hw.c is implemented. > > Signed-off-by: Jacob Keller > Signed-off-by: Ian Stokes > --- > drivers/net/ice/base/ice_ptp_hw.c | 649 +++++++++++++++--------------- > drivers/net/ice/base/ice_ptp_hw.h | 25 +- > 2 files changed, 356 insertions(+), 318 deletions(-) > > +/** > + * ice_ptp_one_port_cmd - Program one PHY port for a timer command > + * @hw: pointer to HW struct > + * @configured_port: the port that should execute the command > + * @configured_cmd: the command to be executed on the configured port > + * @lock_sbq: true if the sideband queue lock must be acquired > + * > + * Prepare one port for executing a timer command, while preparing all other > + * ports to ICE_PTP_NOP. This allows executing a command on a single port > + * while ensuring all other ports do not execute stale commands. > + */ > +enum ice_status Compiler again throws build error on use of ice_status here. /Bruce > +ice_ptp_one_port_cmd(struct ice_hw *hw, u8 configured_port, > + enum ice_ptp_tmr_cmd configured_cmd, bool lock_sbq) > +{