From mboxrd@z Thu Jan 1 00:00:00 1970 Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.remote-ip=91.218.175.135 ARC-Seal: i=1; d=subspace.kernel.org; s=arc20261015; a=rsa-sha256; cv=none; t=1796245755; b=l56YAJAynZFppZgfqWwicqv2ZcCbm2PIZ6Ks07FwU8G2kYLEJfAQFA/HBUIn5xoVr4UJ EB6LFQubmCqEX/Q3D4haoVIRP6dypnFg62aqeva/AfrgX4Wjn2Ouy8UAhHERYkyjT+O58 VpVkPNPV8xADALMIStdD7wuh+9ZtxC4qenGNv/XN+i+bfS0c3pD4oFkt1fLYg8j68lp5T tN0NlzatQKzNu8n/iLVQQKx6vEHkaH5846wmx7zXne5gFCgl194thYgV1brToKB1xxl8B rrvYZmtoBmenF99z/ThWAQBLqHzdj4jOzpxLC29hR0miAavz+CeCuHqr/Y8LLiYkqpA== ARC-Message-Signature: i=1; d=subspace.kernel.org; s=arc20261015; a=rsa-sha256; c=relaxed/relaxed; t=1796245755; 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=roiTXmc3p0Jpg1f7PPfpXZNyg2o9aOBjXhKDKwXnmFDMlbrduUifG09sk7q0ChyPOoPG b25Xn9s6gRGWdrsO7+YQzUaO+XoPYRyx/RvszjUe/o0Ph11LddWu4YCUFlXmzvQ8If9vN TFya+II0jb/1s/XHpYLV/i8SMm0V0ShHSYrZJ9vdJZ12RoNbyEKzc/CLKe8ELgqR6TpPt F4FkMBXMbyZ0o8Pp1Gf/ihws58VLDrCyQundt1mJjmIf1hfRgueTO68NSeXiaVy4a/jVK mcs1g7nXdesUYIJMhNARBah1+sXQBH6GX7oJls9GDNaqbqr1gW6Bp+lmpeptdupg4EA== 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=91.218.175.135 Received: from mta0.migadu.com (out-135.mta0.migadu.com [91.218.175.135]) (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 28B1A606A32D for ; Wed, 2 Dec 2026 21:09:08 +0000 (UTC) DMARC-Filter: OpenDMARC Filter v1.4.2 smtp.subspace.kernel.org 28B1A606A32D 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: linux-kernel@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: linux-kernel@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: linux-kernel@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