From mboxrd@z Thu Jan 1 00:00:00 1970 Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.remote-ip=95.215.58.13 ARC-Seal: i=1; d=subspace.kernel.org; s=arc20261015; a=rsa-sha256; cv=none; t=1796245750; b=MkzpDO0LKB/LypS6K5ug2RdhFJ8F6vebxWPG+PjSRb6T4dRvaxfeNkAvuq9aFgxYNSvj FgZDpZDzu1rG2JLDUTm6Q3Tq2YasRfmptyTFIN+eQbQ6V+lgbzQZwPA0bRPPkx7A0dmSX hVtyAP9q9N86ReA+eIF2g/MdZCBYj3VouGzj2CVLfXV4tepM6s4iI3P4PH5mpmSRem98A fLZyvKfGUCcBQq5f53MBS+vsl/Vq4skDPdOiMoXHLvQpw2PmSFJAyd2k8wjapq0BAkLsY ibaCxbhHUWfDo+GObm6+k6VIBAJlCSmnZu4ogAG860E/2o0/20peB3Ot2UkBMVs9TZA== ARC-Message-Signature: i=1; d=subspace.kernel.org; s=arc20261015; a=rsa-sha256; c=relaxed/relaxed; t=1796245750; h=DMARC-Filter:X-Envelope-To:DKIM-Signature:X-Envelope-To:Received: X-Mizu-Trace-ID:X-Migadu-Flow:Message-ID:Date:MIME-Version:User-Agent: Subject:To:Cc:References:Content-Language:From:In-Reply-To: Content-Type:Content-Transfer-Encoding; bh=eVv//j+y11pFv5m29aaVVFRgFaUTzbGhl/mDNdsB2jI=; b=P3q3tALMxyg7uHA45q8VFuOGWZ/CpZ3BrhPQ2e5bMchUX7emBII/aPdW9votkQYQiuMp 297DxfPe6ekkY3g7kGCFOSENxfnYKu0YdVgIl5uMRkzYRM/XlRJipmYzsHu86rmcIFAch YsoonQhtGKdnL40iKho4yfc2DgYXSmlFyKjfCjP5ow+pTzGWpTv44dYKLLX+iAtMIuc28 3/mLF22BxECEBu1VQXi5yZIPt1+qzFac1Ckh+FvCKMh2qAubGI7DYVh0KX+n5naVvXNMM FAQIlbNAD3feMj1a7OCvgrRR707xZ6H9dlxmJuuzhtVJ2nvy9MWY04ajBsZZY2OS/jw== ARC-Authentication-Results: i=1; smtp.subspace.kernel.org; dmarc=pass header.from=linux.dev; spf=pass smtp.mailfrom=linux.dev; dkim=pass header.d=linux.dev header.i=@linux.dev header.a=rsa-sha256 header.s=key1 header.b=SZWtXe3s; arc=none smtp.remote-ip=95.215.58.13 Received: from mta1.migadu.com (out-13.mta1.migadu.com [95.215.58.13]) (using TLSv1.3 with cipher TLS_AES_128_GCM_SHA256 (128/128 bits) key-exchange X25519 server-signature ECDSA (prime256v1) server-digest SHA256) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id 51774606A322 for ; Wed, 2 Dec 2026 21:09:07 +0000 (UTC) DMARC-Filter: OpenDMARC Filter v1.4.2 smtp.subspace.kernel.org 51774606A322 Authentication-Results: smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=linux.dev Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=linux.dev Authentication-Results: smtp.subspace.kernel.org; dkim=pass (1024-bit key, unprotected) header.d=linux.dev header.i=@linux.dev header.a=rsa-sha256 header.s=key1 header.b=SZWtXe3s X-Envelope-To: netdev@vger.kernel.org DKIM-Signature: a=rsa-sha256; bh=pu9oUytOFD9iwleR9LoXpvK8IadPRVjcVKjLObYbbTM=; c=simple/simple; d=linux.dev; h=from:to:subject:date:message-id:mime-version:content-type; s=key1; t=1796245746; v=1; x=1796850546; b=SZWtXe3sLw3dDLSphDYyiOUZtYE9EyDAmbEugv9nEs80SaXBvVf1PcHuyBHnHdca8Spsii8g weJ2LQtZULe/1yOW7/F3txqDRn10b1FPWa0nRVX87XE8yozbEj1z4oBsAZ05qteOQyBOZNt2BJm SCqwIDqqfTrT3bgbYdFzAgnY= X-Envelope-To: netdev@vger.kernel.org Received: by smtp.migadu.com with ESMTPS id cfbaf85b202e57dd; Wed, 02 Dec 2026 21:09:05 +0000 X-Mizu-Trace-ID: cfbaf85b202e57dd X-Migadu-Flow: FLOW_OUT Message-ID: Date: Wed, 2 Dec 2026 21:09:04 +0000 X-Mailing-List: netdev@vger.kernel.org List-Id: List-Post: List-Help: List-Subscribe: List-Unsubscribe: List-Owner: Precedence: list MIME-Version: 1.0 User-Agent: Mozilla Thunderbird Subject: Re: [PATCH net-next 3/3] net: usb: ax88179: Enable PTP To: Birger Koblitz , Andrew Lunn Cc: Andrew Lunn , "David S. Miller" , Eric Dumazet , Jakub Kicinski , Paolo Abeni , Richard Cochran , Russell King , netdev@vger.kernel.org, linux-usb@vger.kernel.org, linux-kernel@vger.kernel.org References: <20261129-ptp-v1-0-8148c402beaf@birger-koblitz.de> <20261129-ptp-v1-3-8148c402beaf@birger-koblitz.de> <74970c25-597f-4a33-871e-f46db5606acb@birger-koblitz.de> <69086382-37be-4385-ab62-4286e64bf702@birger-koblitz.de> Content-Language: en-US From: Vadim Fedorenko In-Reply-To: <69086382-37be-4385-ab62-4286e64bf702@birger-koblitz.de> Content-Type: text/plain; charset=UTF-8; format=flowed Content-Transfer-Encoding: 8bit On 02.12.2026 18:05, Birger Koblitz wrote: > Hi Vadim, > > On 02/12/2026 4:12 pm, Vadim Fedorenko wrote: >> On 29/11/2026 17:24, Birger Koblitz wrote: >>> Thanks Andrew for reviewing this! >>> >>> On 29/11/2026 4:48 pm, Andrew Lunn wrote: >>>>> +static bool ptp_enable; >>>>> +module_param(ptp_enable, bool, 0); >>>>> +MODULE_PARM_DESC(ptp_enable, "Enable PTP hardware timestamping"); >>>>> + >>>> >>>> Module parameters are not liked. Is this needed? Why not always enable >>>> it? >>> I was not aware of that. I will enable PTP by default. That it disables >>> NETIF_F_SG and NETIF_F_TSO is probably a small price for users of the >>> AX88179A for the extra PTP functionality, and on the AX88279 no impact on the >>> rest of the features whatsoever. PTP also does not cost any resources when >>> not in use. >> >> Is it possible to dynamically disable NETIF_F_SG and NETIF_F_TSO when HW >> timestamps are requested? >> This is a deceptively simple question. There are actually 3 sides to this: > - Is it possible for the driver to change features and are they then picked up? > I investigated a bit and that appears doable: drivers can update their features > and just call netdev_update_features(). > Features like NETIF_F_SG/NETIF_F_TSO are then handled dynamically when treating > SKBs. > - Then there is the question of whether the driver can enable/disable PTP in > order to have NETIF_F_SG/NETIF_F_TSO or not. This is a bit more unpractical, > because it requires a reset of the device to activate different firmware options > and including power-cycling the internal PHY. > My understanding is that it is the PHY doing the timestamping and then the MAC > and USB interface handle the timestamps coming from the PHY. Cycling the PHY is > definitely necessary, without it, no timestamps are generated. There is already > a fallback in ax88179a_bind() which kicks in when PTP setup for some reason > fails (e.g. because the firmware version of the dongle is too low): > /* Disable PTP functionality again and cycle PHY to take effect */ > ax88179_write_cmd(dev, AX_FW_MODE, AX_FW_MODE_179A, 0, 0, NULL); > ax88179_write_u8(dev, AX88179A_PHY_POWER, 0, 0, 0); >         msleep(50); > So that is not very practical, but doable. > > - The third part is I believe the tricky one. Timestamps are requested when you > send PTP frames and ask for timestamps in the socket. In practice, you use ptp4l > and bind it to a network interface. If this does not have a PTP clock, it will > never ask for timestamps. So the driver needs to set up the PTP clock even if > not providing timestamping. I believe this works, because the firmware options > are for the timestamping functionality, not the clock. When an skb is sent it > then carries the SKBTX_HW_TSTAMP. So basically out of tx_fixup we have to ask > for a reset of the device with subsequent link-down/up that takes a couple of > seconds and may have network manager and company kick in. > I believe that to be impractical, but maybe there are better ideas. Well, technically timestamps are requested once .ndo_hwtstamp_set() called with tx/rx configuration which enables timestamper. But if this actually needs PHY reset, then yes, I agree, it might be impractical. But I would consult with vendor whether it's actually needed, or it's just implemented this way to be sure that driver doesn't expect timestamps before it's actually enabled in HW. > > Cheers, >   Birger