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