From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from mail-wm1-f46.google.com (mail-wm1-f46.google.com [209.85.128.46]) (using TLSv1.2 with cipher ECDHE-RSA-AES128-GCM-SHA256 (128/128 bits)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id 5D0612D7DC4 for ; Wed, 18 Feb 2026 16:47:16 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=209.85.128.46 ARC-Seal:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1771433237; cv=none; b=BkKuLmIq4NY8Cg1JCR+1DKvvJ8qqu1iuK+UgvG9uDF6ZoEC4/PcblSN/bCgwTg/YmrlPkHym+8dmGphcPzWS7gGev0NmBYj2SAvdcWS5HqtNRs6xJHiR4ZalGvkiuTSYjuQmyO62XnZge2sCka53n9WR2NW93uZ1iO3tAp95xaY= ARC-Message-Signature:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1771433237; c=relaxed/simple; bh=v6a0tSwoyjviP5o/SSTg+qX/yAR1Jmag3m6xO34oric=; h=Date:From:To:Cc:Subject:Message-ID:References:MIME-Version: Content-Type:Content-Disposition:In-Reply-To; b=AogMdPpsMJxtQKrRpuBXaz+CMydooWnQ1bnZgBQHlvWWTmehfaIxrLXqk3xBEHi3W77vlMRToBXfxRK3iMD7FvA/4kvtabAl/1jcce/PbD94ki1MPkLnHCjgcVUa3b4JWmprVM7+vqcImUcn3029P9TD3PhyKZggBi8OTaiqKnc= ARC-Authentication-Results:i=1; smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=gmail.com; spf=pass smtp.mailfrom=gmail.com; dkim=pass (2048-bit key) header.d=gmail.com header.i=@gmail.com header.b=OkhcmUDk; arc=none smtp.client-ip=209.85.128.46 Authentication-Results: smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=gmail.com Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=gmail.com Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=gmail.com header.i=@gmail.com header.b="OkhcmUDk" Received: by mail-wm1-f46.google.com with SMTP id 5b1f17b1804b1-4836d9d54f6so64945e9.1 for ; Wed, 18 Feb 2026 08:47:16 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20230601; t=1771433235; x=1772038035; darn=vger.kernel.org; h=in-reply-to:content-disposition:mime-version:references:message-id :subject:cc:to:from:date:from:to:cc:subject:date:message-id:reply-to; bh=du4Nrq+7LsG/Kate6nNgSmb9eQhmGantuGa8Z1HBIjU=; b=OkhcmUDkrNm2O8mvp+tW44eRUhaDprkNMBgDRvMGAVu1vqDP7ujGIVjcPjCzp1tc3Y gXMWORU2ExjWYzejDWEjo+3fOvZSBP/xUcNJZg2paattLGOXQ5bNu0TOQJbyoRCumWDI 6Phbgy5le6X6NIasHxv6G6mSY8/E3kozolZblhn1wbbbEMktJXtXzD55k2Ggc6FNOJ2z jGHCh96uI+Dc56GOL/mb6AUH7ENYooyxiRvb+y6HrFKue4Q9wXE77GkGwVX0J0q7cIRb Aw5jOw6Qfv52nUSO4lNDp5xaeZ+Wkon4yhYTrLzIAn/dpyZDTTQoK2sBEWxkUrnEtSux npjg== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1771433235; x=1772038035; h=in-reply-to:content-disposition:mime-version:references:message-id :subject:cc:to:from:date:x-gm-gg:x-gm-message-state:from:to:cc :subject:date:message-id:reply-to; bh=du4Nrq+7LsG/Kate6nNgSmb9eQhmGantuGa8Z1HBIjU=; b=dtEA4ZRisuxoKX/0bhUcVHDjtpiwUnlwCt9iUHacM3rchNSQ3ENA8VHUuVOqVdb4XA TEG+/2HT1a3K/8JIIwg8ArW3RPqarAK8/HEw2ISb32+7tPB9BzVRyqLKIbQbF1/+8TQX rxAToR2JLnZiDxDgiIYSkBn76fleCgP0Zjv10fvtPqHVVBvZqQg92N6ft+80yIQ88up/ eqv+NPUUzP6Q0oVmivcxwSz2zRS0eCdrG77vIE4kQTFnafxxdERNRB6mJEGUjtmqY/AM uZwPh9pLuNg/PsBc+p4gEOaOt968BCt0NiXWHIxL26dQDL2K6TE7YGXwkC7VDV/Uh0Wo JA3w== X-Forwarded-Encrypted: i=1; AJvYcCWPYCHjBcZhmLDEZgVhQ3HFNLfA3is1L2gyNWGmyalqeF+7nTuMO8IELJEcrkH2ythNcXtCJhx2jDH8yjQ=@vger.kernel.org X-Gm-Message-State: AOJu0Yzb9kxzV/+QOVea66uuYAiHCnMVcEvVBLYE/+QhSAVfrR4CpjHJ LLOKxGDr+fypAEd51zEsz/OJB4DCn3mkNIYxzZ0W4KabPMTFN5cL8Z9X X-Gm-Gg: AZuq6aIxnaYs2X5/aPMk1bWJ3UYhfkpVwFNGte4E6rzBnh4L/LmaKCHgUMaM13GZovW qkms2JmrLodGoYkB/sh1hJczTpxoW/nip5MoitumQhUm2VUXhJu/+TkHdBzj6gtlxr8kEa+iK7A p3j+gP18iANOVWi5YKbXHKXZ+rtR2JAa91/NT6eHJ4OcvSKmDGiT8irnVVAaoFTjHrghi4r1arc EzvVvaWZfxQmAzGqKVSDjH5vy66m/PuIyNEFcCdMYNPsPyRb8ZjeJc3msyGt32u8fAURJGJamfT fdty9rT6FOCYm01LXgFDnBibpPTbT6wcFnU55237pJB2CUKSgq4RcBhp3Vj5o9I2PfDM+35ZQbR 20AKjjo2hVGTU/aq1h+MZNRIx9BGcJLgclDEQ22KpDDiifFBVUF3drJKZjHrCERc3dQIXkLm47i PlmbG+Thg2kYDkIKs= X-Received: by 2002:a05:600c:64cc:b0:477:a6f1:499d with SMTP id 5b1f17b1804b1-48371043eecmr169658225e9.3.1771433234448; Wed, 18 Feb 2026 08:47:14 -0800 (PST) Received: from skbuf ([2a02:2f04:d404:ea00:555a:a733:bf42:162d]) by smtp.gmail.com with ESMTPSA id 5b1f17b1804b1-4836aa0847asm676991105e9.3.2026.02.18.08.47.12 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Wed, 18 Feb 2026 08:47:13 -0800 (PST) Date: Wed, 18 Feb 2026 18:47:10 +0200 From: Vladimir Oltean To: Bastien Curutchet Cc: Woojung Huh , UNGLinuxDriver@microchip.com, Andrew Lunn , "David S. Miller" , Eric Dumazet , Jakub Kicinski , Paolo Abeni , Richard Cochran , Simon Horman , Pascal Eberhard , =?utf-8?Q?Miqu=C3=A8l?= Raynal , Thomas Petazzoni , netdev@vger.kernel.org, linux-kernel@vger.kernel.org Subject: Re: [PATCH net-next v4 8/8] net: dsa: microchip: Add two-step PTP support for KSZ8463 Message-ID: <20260218164710.rimvimmiaqampvy7@skbuf> References: <20260127-ksz8463-ptp-v4-0-652e021aae86@bootlin.com> <20260127-ksz8463-ptp-v4-0-652e021aae86@bootlin.com> <20260127-ksz8463-ptp-v4-8-652e021aae86@bootlin.com> <20260127-ksz8463-ptp-v4-8-652e021aae86@bootlin.com> <20260202134330.xzc2wmcwwqhw4dfc@skbuf> <20260218152551.vnqr7bl7yfrymrke@skbuf> <983ba1c7-06d9-4474-ac6f-ef3878b31436@bootlin.com> Precedence: bulk X-Mailing-List: linux-kernel@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <983ba1c7-06d9-4474-ac6f-ef3878b31436@bootlin.com> On Wed, Feb 18, 2026 at 05:42:32PM +0100, Bastien Curutchet wrote: > On 2/18/26 4:25 PM, Vladimir Oltean wrote: > > On Wed, Feb 18, 2026 at 04:21:26PM +0100, Bastien Curutchet wrote: > > > > You need to set port->last_tx_is_pdelayresp in the atomic section where > > > > you know for sure that there's a single TX timestampable skb in flight. > > > > There's no explicit lock which creates that atomic section, but the fact > > > > that the worker kthread of the tagger processes work items one by one is > > > > what gives you that guarantee. > > > > > > Thank you for the explanations. I suspected a race condition here but I > > > didn't know how to mitigate it. I tested a new version on my side with > > > port->last_tx_is_pdelayresp set in the ksz_port_deferred_xmit() worker and > > > it works fine. > > > > Good. > > > > Next question: if the logic is all in ksz_port_deferred_xmit(), which is > > sleepable and sends packets one by one, do you actually need to save the > > packet type in port->last_tx_is_pdelayresp? Can't you just keep a local > > variable with it? > > Well, I think I could but it feels like a significant rework of the existing > implementation. So far the register location is tied to the struct > ksz_ptp_irq, since on all the other switches one interrupt bit is associated > with one timestamp only. In fact, even on the KSZ8463 the same logic applies > because there are two interrupt bits per port: one for the sync messages and > one for the pdelay_req / pdelay_resp messages. > > If I'm not mistaken, using a local variable here would mean moving the > timestamp reading from ksz_ptp_msg_thread_fn() to ksz_port_deferred_xmit(). > We would then need to check the type of each packet before sending it, in > order to know where to read the timestamp after wait_for_completion() > returns. OK. I no longer had a git tree checked out with these patches, so I forgot you need the PTP type in the IRQ handler. It's fine the way you plan to send the next version. Thanks for checking.