Article View: linux.kernel.netdev
Article #25919Re: [PATCH net-next 3/3] net: usb: ax88179: Enable PTP
From: Birger Koblitz
Date: Wed, 02 Dec 2026 18:05
Date: Wed, 02 Dec 2026 18:05
59 lines
13127 bytes
13127 bytes
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
Technical Details
Message-ID:
<69086382-37be-4385-ab62-4286e64bf702@birger-koblitz.de>Path:
mbox-mo1.pugleaf.net!srv.newsdeef.eu.MISMATCH!feed-us-txt.newsdeef.eu!feed-us-ny.newsdeef.eu!srv.newsdeef.eu!newsfeed.bofh.team!news.nntp4.net!nntp.xenet.de!news.neodome.net!usenet.network!.POSTED!vger.kernel.org!netdev+bounces-375987-linux-kernel-netdev=dewy.ruReferences:
<20261129-ptp-v1-0-8148c402beaf@birger-koblitz.de> <20261129-ptp-v1-3-8148c402beaf@birger-koblitz.de> <b0be6f63-f8c1-4d6f-99a1-bf709e70dfd1@lunn.ch> <74970c25-597f-4a33-871e-f46db5606acb@birger-koblitz.de> <fb25c3d9-a352-4afa-ac21-415554a6bffe@linux.dev>Show Full Headers
Complete Article Headers
Path: mbox-mo1.pugleaf.net!srv.newsdeef.eu.MISMATCH!feed-us-txt.newsdeef.eu!feed-us-ny.newsdeef.eu!srv.newsdeef.eu!newsfeed.bofh.team!news.nntp4.net!nntp.xenet.de!news.neodome.net!usenet.network!.POSTED!vger.kernel.org!netdev+bounces-375987-linux-kernel-netdev=dewy.ru From: mail@birger-koblitz.de (Birger Koblitz) Newsgroups: linux.kernel.netdev Subject: Re: [PATCH net-next 3/3] net: usb: ax88179: Enable PTP Date: Wed, 2 Dec 2026 19:05:00 +0100 Organization: Usenet Network Message-ID: <69086382-37be-4385-ab62-4286e64bf702@birger-koblitz.de> References: <20261129-ptp-v1-0-8148c402beaf@birger-koblitz.de> <20261129-ptp-v1-3-8148c402beaf@birger-koblitz.de> <b0be6f63-f8c1-4d6f-99a1-bf709e70dfd1@lunn.ch> <74970c25-597f-4a33-871e-f46db5606acb@birger-koblitz.de> <fb25c3d9-a352-4afa-ac21-415554a6bffe@linux.dev> MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8; format=flowed Content-Transfer-Encoding: 7bit Injection-Info: usenet.network; logging-data="2027271"; mail-complaints-to="abuse@usenet.network" Cancel-Lock: sha1:Vhp1w4ctC7BAlPwdNYgscp4m/aA= sha256:Q7fdjV7QWnQHoDc9/Zpa1fLh7R1JVu6CM9UWE6vOX6I= sha1:4F0mCHAnz49r9XrFvmm8ZzM5XXU= sha256:G+0COW1QHhZgoArQpuVLjkQAVm44c7SUny0k6Xb7Dow= Content-Language: en-US List-ID: <netdev.vger.kernel.org> X-Mailpost-Empty-Hdrs: X-Spam-Level X-Received: from localhost (localhost [127.0.0.1]) by mail.dewy.ru (Postfix) with ESMTP id BDAC71176EA; Wed, 2 Dec 2026 21:05:49 +0300 (MSK) X-Virus-Scanned: Debian amavisd-new at usenet.network X-Spam-Flag: NO X-Spam-Score: -1.95 X-Spam-Status: No, score=-1.95 tagged_above=-9999 required=6.31 tests=[DCC_CHECK=1.1, DCC_REPUT_70_89=0.1, DKIM_SIGNED=0.1, DKIM_VALID=-0.1, DKIM_VALID_AU=-0.1, HEADER_FROM_DIFFERENT_DOMAINS=0.249, MAILING_LIST_MULTI=-1, RCVD_IN_DNSWL_MED=-2.3, SPF_HELO_NONE=0.001, SPF_PASS=-0.001, URIBL_BLOCKED=0.001] autolearn=ham autolearn_force=no X-Authentication-Results: mail.dewy.ru (amavisd-new); dkim=pass (2048-bit key) header.d=birger-koblitz.de header.b=uKAeIYMY; dkim=pass (2048-bit key) header.d=birger-koblitz.de header.b=tLd50T+l X-Received: from mail.dewy.ru ([127.0.0.1]) by localhost (mail.dewy.ru [127.0.0.1]) (amavisd-new, port 10024) with ESMTP id mHWkQdVDvlqm; Wed, 2 Dec 2026 21:05:42 +0300 (MSK) X-Received-SPF: Pass (mailfrom) identity=mailfrom; client-ip=172.234.253.10; helo=sea.lore.kernel.org; envelope-from=netdev+bounces-375987-linux-kernel-netdev=dewy.ru@vger.kernel.org; receiver=<UNKNOWN> X-Authentication-Results: OpenDMARC; dmarc=none (p=none dis=none) header.from=birger-koblitz.de X-Received: from sea.lore.kernel.org (sea.lore.kernel.org [172.234.253.10]) by mail.dewy.ru (Postfix) with ESMTPS id 53B5D1176AC; Wed, 2 Dec 2026 21:05:28 +0300 (MSK) X-Received: from smtp.subspace.kernel.org (conduit.subspace.kernel.org [100.77.114.92]) by sea.lore.kernel.org (Postfix) with ESMTP id 774AA2D444; Wed, 2 Dec 2026 18:05:12 +0000 (UTC) X-Authentication-Results: smtp.subspace.kernel.org; arc=fail smtp.remote-ip=127.0.0.1 X-ARC-Seal: i=2; d=subspace.kernel.org; s=arc20261015; a=rsa-sha256; cv=fail; t=1796234711; b=1+DVNhc+yehH/qo7cSdcFEWpYc0UjuitSmxzW+xsuHl4cfceptnxJvFud2Mywb5/7yd/ I4BWJ5Zs960l6ne98iX6HMXRxJ+JcMNOSlhpHof+HlVISqugP6AmHg/gRBm21NwcZuQM+ AuYvNGSO8MgrBTIpW+ZNe8jbhwMKnnlb3ESBahziZBjiCnbXsFM3upyAQE4MpD46WWAbB 7MHWVNTJNSY99zVfzmRZdgVFVaFL4x9GX26WDNIoU5RhNiXmGAOrwMtqV2HWDZnjJiKUY Y2uQ1lJd3aYuwfvOQYmRR5ZOaNWqII/v9XjbEVQ9zWIO3SDexsZPue0jORJ+RoEQ+wg== X-ARC-Message-Signature: i=2; d=subspace.kernel.org; s=arc20261015; a=rsa-sha256; c=relaxed/relaxed; t=1796234711; h=X-Original-To:Received:DMARC-Filter:DKIM-Signature:Received: X-Spam-Level:DKIM-Signature:Received:Message-ID:Date:X-Mailing-List: List-Id:List-Post:List-Help:List-Subscribe:List-Unsubscribe: List-Owner:Precedence:MIME-Version:User-Agent:Subject:To:Cc: References:From:Content-Language:In-Reply-To:Content-Type: Content-Transfer-Encoding; bh=F+z33qeFbqaXEAek7TFpXDaNLW9HHX7y0e15pLxLIbQ=; b=FAdaOJv5UyKt5BtADHRZTX2hsgXBRH2vw233mbhAt7k/A+pmQ201HiZao2yrCVe9soR6 JJoIT914mryVUtf8a78Wf9OSuVO2qiGOzy4Q3Tb4TB8qyq/TD+5RRn4sl2YGYEvxAl3gi 1cXjmB+p63JmRPVQ7geLw42NZCRWsqNAahP5y5KkHsQAozLwwsTSiQk0l1Ps/7pJOnLBu 0Q8f4SXs2zhl6Me2PFHZmuVBQOQhjsK46WTDy8tbSNx0ChnA7hjAh+QWUIL1cnmDdDGK3 2SjTa3wwHkeoi5dizVdZOVjS07eFHjy1NCU6mby+ZrJnUUtzWj/WNOgL9RoBB77PJ2Q== X-ARC-Authentication-Results: i=2; smtp.subspace.kernel.org; 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; dmarc=none header.from=birger-koblitz.de; spf=pass smtp.mailfrom=birger-koblitz.de; arc=fail smtp.remote-ip=127.0.0.1 X-Received: from localhost.localdomain (localhost [127.0.0.1]) by smtp.subspace.kernel.org (Postfix) with ESMTP id 2CC02606A6AA; Wed, 2 Dec 2026 18:05:11 +0000 (UTC) X-Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) 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 X-Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.remote-ip=23.88.97.239 X-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== X-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== X-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 X-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) X-DMARC-Filter: OpenDMARC Filter v1.4.2 smtp.subspace.kernel.org 981CF606A6AF X-Authentication-Results: smtp.subspace.kernel.org; dmarc=none (p=none dis=none) header.from=birger-koblitz.de X-Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=birger-koblitz.de X-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== X-Received: by bkemail.birger-koblitz.de (Postfix, from userid 109) id 2AA754A281; Wed, 2 Dec 2026 18:05:02 +0000 (UTC) X-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== X-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) X-Mailing-List: netdev@vger.kernel.org X-List-Post: <mailto:netdev@vger.kernel.org> X-List-Help: <mailto:netdev+help@vger.kernel.org> X-List-Subscribe: <mailto:netdev+subscribe@vger.kernel.org> X-List-Unsubscribe: <mailto:netdev+unsubscribe@vger.kernel.org> X-List-Owner: <mailto:netdev+owner@vger.kernel.org> X-Precedence: list X-User-Agent: Mozilla Thunderbird X-Cc: Andrew Lunn <andrew+netdev@lunn.ch>, "David S. Miller" <davem@davemloft.net>, Eric Dumazet <edumazet@kernel.org>, Jakub Kicinski <kuba@kernel.org>, Paolo Abeni <pabeni@redhat.com>, Richard Cochran <richardcochran@gmail.com>, Russell King <linux@armlinux.org.uk>, netdev@vger.kernel.org, linux-usb@vger.kernel.org, linux-kernel@vger.kernel.org X-In-Reply-To: <fb25c3d9-a352-4afa-ac21-415554a6bffe@linux.dev>