From mboxrd@z Thu Jan 1 00:00:00 1970 Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.remote-ip=23.88.97.239 ARC-Seal: i=1; d=subspace.kernel.org; s=arc20261015; a=rsa-sha256; cv=none; t=1796234710; b=oSq3ehVx3sIs/qMxzqkKmVAzrUsVlA+oZSZne7fqDebQvJie1ZFqAjV9WzQ03WyUcMvZ 7hvFOf1zX10qUBW8ZWEoBUz45JIQ/3mMlHNDQ4vawuc5hki/ImjJwPw5W5mp+G3DMbGiM 0VIdySrK9VQ9L1rG+taLM7yd3prt76JZm4H+hICgdS88ftTSMfbMlXfF/Ql52blECd66G GlhDPx1O4zs6ddrTJ7VLMZNBpLSRX6VXKFyapPTd9p67cdLyTYZLolgCkpLnHZ/chr9zH EfYyA63ZOFtPWK08pSwqKlHBbGm/qk0yoixQYEsr+DVbBS8+m2irXcyJ3wGZIfS5eLw== ARC-Message-Signature: i=1; d=subspace.kernel.org; s=arc20261015; a=rsa-sha256; c=relaxed/relaxed; t=1796234710; h=DMARC-Filter:DKIM-Signature:Received:X-Spam-Checker-Version: X-Spam-Level:X-Spam-Status:DKIM-Signature:Received:Message-ID:Date: MIME-Version:User-Agent:Subject:To:Cc:References:From: Content-Language:In-Reply-To:Content-Type:Content-Transfer-Encoding; bh=F+z33qeFbqaXEAek7TFpXDaNLW9HHX7y0e15pLxLIbQ=; b=LejvrgiTDqnUqSu8EhFj8yIi9YsjhyH8ELT1iIteoLhmlzlq+Vhmmdalavllb3geYX9v 9oiZbrx595Z6bEuOrOwZ/nJzqb09l/x+3p6dqlnUoy5vYU0a3FH4u3jqIQ7A+v0bZJhDS CHg2P/R+Hl6M+fVBuoIEhi5HbpL3dsm6z0jCmWFASL4ae1WYXsu+rnliCrpQxqn0tiSw0 GPlqnVAYmXZH7nyi4XGEBrgdsjI3mULdD3uXW039yyrUEMICbYlKzdcgKMVL6XkAEugYC J9jUNsZGmJCJ1gx+d2qGk4l1uQAVEK7V407FlYpnvyFH1eHIn7+1tXK/s8QtfZClDUQ== ARC-Authentication-Results: i=1; smtp.subspace.kernel.org; dmarc=none header.from=birger-koblitz.de; spf=pass smtp.mailfrom=birger-koblitz.de; dkim=pass header.d=birger-koblitz.de header.i=@birger-koblitz.de header.a=rsa-sha256 header.s=default header.b=uKAeIYMY; dkim=pass header.d=birger-koblitz.de header.i=@birger-koblitz.de header.a=rsa-sha256 header.s=default header.b=tLd50T+l; arc=none smtp.remote-ip=23.88.97.239 Received: from bkemail.birger-koblitz.de (bkemail.birger-koblitz.de [23.88.97.239]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature ECDSA (prime256v1) server-digest SHA256) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id 981CF606A6AF; Wed, 2 Dec 2026 18:05:09 +0000 (UTC) DMARC-Filter: OpenDMARC Filter v1.4.2 smtp.subspace.kernel.org 981CF606A6AF Authentication-Results: smtp.subspace.kernel.org; dmarc=none (p=none dis=none) header.from=birger-koblitz.de Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=birger-koblitz.de Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key, unprotected) header.d=birger-koblitz.de header.i=@birger-koblitz.de header.a=rsa-sha256 header.s=default header.b=uKAeIYMY; dkim=pass (2048-bit key) header.d=birger-koblitz.de header.i=@birger-koblitz.de header.a=rsa-sha256 header.s=default header.b=tLd50T+l DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=birger-koblitz.de; s=default; t=1796234702; bh=XQTibmhsPALb0/AqrwFSwCOwa/NNJAS+x3+QzvxdMJQ=; h=Date:Subject:To:Cc:References:From:In-Reply-To:From; b=uKAeIYMYjSXld6e8FFnxrSKO+vCfBpy5l7PqfBJy7i+bUBFbROtR7wfFPYqAc5wXi OrwOEOUvS+FuRb6i5gRl/XJrzzmdw6XaqQtB0putV5pjipIr4oBoTPi+W24z240BaV xZWIetSLBLXPNx0BtcxtwQf4uHunB/Y1SQpRYhd/SrOSb0ySjPYL7PA45GyjtVi7kD dwy/6hJMNbbIdvoxA0BPa2DOAQLlcw2rz5JMK5i0o62XlS5P5MbGm/9BOqfRMipLy0 B0Aw2pOKyJDqTbjGY/sikPo+eMWWEJGfvmRsSRR/Q2VdbVAuRi/1fSDd4QvFWHvb6f gn6Z7NRMxlWOw== Received: by bkemail.birger-koblitz.de (Postfix, from userid 109) id 2AA754A281; Wed, 2 Dec 2026 18:05:02 +0000 (UTC) X-Spam-Level: DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=birger-koblitz.de; s=default; t=1796234701; bh=XQTibmhsPALb0/AqrwFSwCOwa/NNJAS+x3+QzvxdMJQ=; h=Date:Subject:To:Cc:References:From:In-Reply-To:From; b=tLd50T+lwrX+tzWbin4h2mizzr/wsH5hjww2GjDzIBK+fYuJ4OvNgXYyF7Dvtl8sU FDynuS+ogWVYPRIeI74LWC5ntdzcRT0zfTHQHfORU3fBmfRpzFoIMWDgwRVVSSQbAj BwioJG5yWvqjZMqUYZ/qHn7m4JQmQN7d38jt88/D0Dp31w84q0FoK71mp7Tlg2xO1R WaVVbzlGy406B/7WUaaoiTcxOHfaR1t63mjbhzj2nwgoj/5YVm+LobWQBjles5j6YQ LyfZVxjhpLrInAOFDNq1ENmdL6pZF+5XjlpV1rOH8AL55N2WH+aU5B/nZDBcCLtwVq nbctoT25Kv47w== Received: from [IPV6:2a00:6020:47a3:e800:271c:c6c5:9fde:77cb] (unknown [IPv6:2a00:6020:47a3:e800:271c:c6c5:9fde:77cb]) by bkemail.birger-koblitz.de (Postfix) with ESMTPSA id E95CE4A275; Wed, 2 Dec 2026 18:05:00 +0000 (UTC) Message-ID: <69086382-37be-4385-ab62-4286e64bf702@birger-koblitz.de> Date: Wed, 2 Dec 2026 19:05:00 +0100 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: Vadim Fedorenko , 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> From: Birger Koblitz Content-Language: en-US In-Reply-To: Content-Type: text/plain; charset=UTF-8; format=flowed Content-Transfer-Encoding: 7bit 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. Cheers, Birger