Netdev List
 help / color / mirror / Atom feed
From: Vadim Fedorenko <vadim.fedorenko@linux.dev>
To: Birger Koblitz <mail@birger-koblitz.de>, Andrew Lunn <andrew@lunn.ch>
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
Subject: Re: [PATCH net-next 3/3] net: usb: ax88179: Enable PTP
Date: Wed, 2 Dec 2026 21:09:04 +0000	[thread overview]
Message-ID: <b393463a-c80d-4a3d-97d0-52219fecbccf@linux.dev> (raw)
In-Reply-To: <69086382-37be-4385-ab62-4286e64bf702@birger-koblitz.de>

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


  reply	other threads:[~2026-12-02 21:09 UTC|newest]

Thread overview: 13+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2026-11-29  9:29 [PATCH net-next 0/3] net: usb: ax88179: Add support for PTP Birger Koblitz
2026-11-29  9:29 ` [PATCH net-next 1/3] net: usb: ax88179: Add PTP data structures and definitions Birger Koblitz
2026-11-29  9:29 ` [PATCH net-next 2/3] net: usb: ax88179: Add PTP Implementation Birger Koblitz
2026-11-29 18:31   ` Manuel Ebner
2026-11-30  5:18     ` Birger Koblitz
2026-11-29  9:29 ` [PATCH net-next 3/3] net: usb: ax88179: Enable PTP Birger Koblitz
2026-11-29 15:48   ` Andrew Lunn
2026-11-29 17:24     ` Birger Koblitz
2026-11-29 21:09       ` Andrew Lunn
2026-12-02 15:12       ` Vadim Fedorenko
2026-12-02 18:05         ` Birger Koblitz
2026-12-02 21:09           ` Vadim Fedorenko [this message]
2026-11-29 21:18   ` kernel test robot

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=b393463a-c80d-4a3d-97d0-52219fecbccf@linux.dev \
    --to=vadim.fedorenko@linux.dev \
    --cc=andrew+netdev@lunn.ch \
    --cc=andrew@lunn.ch \
    --cc=davem@davemloft.net \
    --cc=edumazet@kernel.org \
    --cc=kuba@kernel.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=linux-usb@vger.kernel.org \
    --cc=linux@armlinux.org.uk \
    --cc=mail@birger-koblitz.de \
    --cc=netdev@vger.kernel.org \
    --cc=pabeni@redhat.com \
    --cc=richardcochran@gmail.com \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox