Netdev List
 help / color / mirror / Atom feed
* [PATCH net] net: lan966x: fix disabling timestamping without PTP traps
@ 2026-11-23 14:53 Daniel Machon
  2026-11-27  9:11 ` Paolo Abeni
  2026-11-27 10:40 ` patchwork-bot+netdevbpf
  0 siblings, 2 replies; 5+ messages in thread
From: Daniel Machon @ 2026-11-23 14:53 UTC (permalink / raw)
  To: Horatiu Vultur, UNGLinuxDriver, Andrew Lunn, David S. Miller,
	Eric Dumazet, Jakub Kicinski, Paolo Abeni, Richard Cochran
  Cc: netdev

lan966x_ptp_del_trap() looks up a PTP trap rule with vcap_get_rule() and
removes the port from it, or deletes the rule when no other port needs
it. The traps are removed whenever timestamping is configured with
HWTSTAMP_FILTER_NONE.

Before this patch, every vcap_get_rule() error is returned as -EEXIST,
including the -ENOENT for a trap rule that does not exist, so disabling
timestamping on a port that has no traps installed fails. This breaks
moving the hardware timestamp provider of a port from its PHY to the
MAC.

Return 0 for -ENOENT, as there is nothing to remove. Pass any other
error from vcap_get_rule() on, as the rule may still be installed with
this port in its ingress port mask.

Triggered during test development, without kernel modifications, on a
lan9668 board whose LAN8814 PHYs are the default timestamp provider:
"ethtool --set-hwtimestamp-cfg <port> index <switch PHC> qualifier
precise" failed with "File exists". With the fix the same command moves
the provider to the MAC.

Fixes: 72df3489fb10 ("net: lan966x: Add ptp trap rules")
Signed-off-by: Daniel Machon <daniel.machon@microchip.com>
---
 drivers/net/ethernet/microchip/lan966x/lan966x_ptp.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/drivers/net/ethernet/microchip/lan966x/lan966x_ptp.c b/drivers/net/ethernet/microchip/lan966x/lan966x_ptp.c
index 9be2cfe6feeb7..e3af7831a10c3 100644
--- a/drivers/net/ethernet/microchip/lan966x/lan966x_ptp.c
+++ b/drivers/net/ethernet/microchip/lan966x/lan966x_ptp.c
@@ -110,7 +110,7 @@ static int lan966x_ptp_del_trap(struct lan966x_port *port,
 
 	vrule = vcap_get_rule(lan966x->vcap_ctrl, rule_id);
 	if (IS_ERR(vrule))
-		return -EEXIST;
+		return PTR_ERR(vrule) == -ENOENT ? 0 : PTR_ERR(vrule);
 
 	vcap_rule_get_key_u32(vrule, VCAP_KF_IF_IGR_PORT_MASK, &value, &mask);
 	mask |= BIT(port->chip_port);

---
base-commit: af6737b9066832a2017c281159950ba92385ce00
change-id: 20261123-lan966x-ptp-del-trap-98dde01c5f7b

Best regards,
-- 
Daniel Machon <daniel.machon@microchip.com>


^ permalink raw reply related	[flat|nested] 5+ messages in thread

* Re: [PATCH net] net: lan966x: fix disabling timestamping without PTP traps
  2026-11-23 14:53 [PATCH net] net: lan966x: fix disabling timestamping without PTP traps Daniel Machon
@ 2026-11-27  9:11 ` Paolo Abeni
  2026-11-27  9:45   ` Daniel Machon
  2026-11-27 10:40 ` patchwork-bot+netdevbpf
  1 sibling, 1 reply; 5+ messages in thread
From: Paolo Abeni @ 2026-11-27  9:11 UTC (permalink / raw)
  To: Daniel Machon, Horatiu Vultur, UNGLinuxDriver, Andrew Lunn,
	David S. Miller, Eric Dumazet, Jakub Kicinski, Richard Cochran
  Cc: netdev

On 11/23/26 15:53, Daniel Machon wrote:
> lan966x_ptp_del_trap() looks up a PTP trap rule with vcap_get_rule() and
> removes the port from it, or deletes the rule when no other port needs
> it. The traps are removed whenever timestamping is configured with
> HWTSTAMP_FILTER_NONE.
> 
> Before this patch, every vcap_get_rule() error is returned as -EEXIST,
> including the -ENOENT for a trap rule that does not exist, so disabling
> timestamping on a port that has no traps installed fails. This breaks
> moving the hardware timestamp provider of a port from its PHY to the
> MAC.
> 
> Return 0 for -ENOENT, as there is nothing to remove. Pass any other
> error from vcap_get_rule() on, as the rule may still be installed with
> this port in its ingress port mask.
> 
> Triggered during test development, without kernel modifications, on a
> lan9668 board whose LAN8814 PHYs are the default timestamp provider:
> "ethtool --set-hwtimestamp-cfg <port> index <switch PHC> qualifier
> precise" failed with "File exists". With the fix the same command moves
> the provider to the MAC.
> 
> Fixes: 72df3489fb10 ("net: lan966x: Add ptp trap rules")
> Signed-off-by: Daniel Machon <daniel.machon@microchip.com>
IMHO this is borderline for net at this point of the cycle. Any strong
objection to move this one to net-next?

Thanks,

Paolo


^ permalink raw reply	[flat|nested] 5+ messages in thread

* Re: [PATCH net] net: lan966x: fix disabling timestamping without PTP traps
  2026-11-27  9:11 ` Paolo Abeni
@ 2026-11-27  9:45   ` Daniel Machon
  2026-11-27 10:31     ` Paolo Abeni
  0 siblings, 1 reply; 5+ messages in thread
From: Daniel Machon @ 2026-11-27  9:45 UTC (permalink / raw)
  To: Paolo Abeni
  Cc: Horatiu Vultur, UNGLinuxDriver, Andrew Lunn, David S. Miller,
	Eric Dumazet, Jakub Kicinski, Richard Cochran, netdev

> On 11/23/26 15:53, Daniel Machon wrote:
> > lan966x_ptp_del_trap() looks up a PTP trap rule with vcap_get_rule() and
> > removes the port from it, or deletes the rule when no other port needs
> > it. The traps are removed whenever timestamping is configured with
> > HWTSTAMP_FILTER_NONE.
> > 
> > Before this patch, every vcap_get_rule() error is returned as -EEXIST,
> > including the -ENOENT for a trap rule that does not exist, so disabling
> > timestamping on a port that has no traps installed fails. This breaks
> > moving the hardware timestamp provider of a port from its PHY to the
> > MAC.
> > 
> > Return 0 for -ENOENT, as there is nothing to remove. Pass any other
> > error from vcap_get_rule() on, as the rule may still be installed with
> > this port in its ingress port mask.
> > 
> > Triggered during test development, without kernel modifications, on a
> > lan9668 board whose LAN8814 PHYs are the default timestamp provider:
> > "ethtool --set-hwtimestamp-cfg <port> index <switch PHC> qualifier
> > precise" failed with "File exists". With the fix the same command moves
> > the provider to the MAC.
> > 
> > Fixes: 72df3489fb10 ("net: lan966x: Add ptp trap rules")
> > Signed-off-by: Daniel Machon <daniel.machon@microchip.com>
> IMHO this is borderline for net at this point of the cycle. Any strong
> objection to move this one to net-next?

net-next is fine. Does that require a repost without a fixes tag, or can you
apply it directly as-is?

> 
> Thanks,
> 
> Paolo
> 

/Daniel

^ permalink raw reply	[flat|nested] 5+ messages in thread

* Re: [PATCH net] net: lan966x: fix disabling timestamping without PTP traps
  2026-11-27  9:45   ` Daniel Machon
@ 2026-11-27 10:31     ` Paolo Abeni
  0 siblings, 0 replies; 5+ messages in thread
From: Paolo Abeni @ 2026-11-27 10:31 UTC (permalink / raw)
  To: Daniel Machon
  Cc: Horatiu Vultur, UNGLinuxDriver, Andrew Lunn, David S. Miller,
	Eric Dumazet, Jakub Kicinski, Richard Cochran, netdev

On 11/27/26 10:45, Daniel Machon wrote:
>> On 11/23/26 15:53, Daniel Machon wrote:
>>> lan966x_ptp_del_trap() looks up a PTP trap rule with vcap_get_rule() and
>>> removes the port from it, or deletes the rule when no other port needs
>>> it. The traps are removed whenever timestamping is configured with
>>> HWTSTAMP_FILTER_NONE.
>>>
>>> Before this patch, every vcap_get_rule() error is returned as -EEXIST,
>>> including the -ENOENT for a trap rule that does not exist, so disabling
>>> timestamping on a port that has no traps installed fails. This breaks
>>> moving the hardware timestamp provider of a port from its PHY to the
>>> MAC.
>>>
>>> Return 0 for -ENOENT, as there is nothing to remove. Pass any other
>>> error from vcap_get_rule() on, as the rule may still be installed with
>>> this port in its ingress port mask.
>>>
>>> Triggered during test development, without kernel modifications, on a
>>> lan9668 board whose LAN8814 PHYs are the default timestamp provider:
>>> "ethtool --set-hwtimestamp-cfg <port> index <switch PHC> qualifier
>>> precise" failed with "File exists". With the fix the same command moves
>>> the provider to the MAC.
>>>
>>> Fixes: 72df3489fb10 ("net: lan966x: Add ptp trap rules")
>>> Signed-off-by: Daniel Machon <daniel.machon@microchip.com>
>> IMHO this is borderline for net at this point of the cycle. Any strong
>> objection to move this one to net-next?
> 
> net-next is fine. Does that require a repost without a fixes tag, or can you
> apply it directly as-is?
No repost needed, thanks!

Paolo


^ permalink raw reply	[flat|nested] 5+ messages in thread

* Re: [PATCH net] net: lan966x: fix disabling timestamping without PTP traps
  2026-11-23 14:53 [PATCH net] net: lan966x: fix disabling timestamping without PTP traps Daniel Machon
  2026-11-27  9:11 ` Paolo Abeni
@ 2026-11-27 10:40 ` patchwork-bot+netdevbpf
  1 sibling, 0 replies; 5+ messages in thread
From: patchwork-bot+netdevbpf @ 2026-11-27 10:40 UTC (permalink / raw)
  To: Daniel Machon
  Cc: horatiu.vultur, UNGLinuxDriver, andrew+netdev, davem, edumazet,
	kuba, pabeni, richardcochran, netdev

Hello:

This patch was applied to netdev/net-next.git (main)
by Paolo Abeni <pabeni@redhat.com>:

On Mon, 23 Nov 2026 15:53:54 +0100 you wrote:
> lan966x_ptp_del_trap() looks up a PTP trap rule with vcap_get_rule() and
> removes the port from it, or deletes the rule when no other port needs
> it. The traps are removed whenever timestamping is configured with
> HWTSTAMP_FILTER_NONE.
> 
> Before this patch, every vcap_get_rule() error is returned as -EEXIST,
> including the -ENOENT for a trap rule that does not exist, so disabling
> timestamping on a port that has no traps installed fails. This breaks
> moving the hardware timestamp provider of a port from its PHY to the
> MAC.
> 
> [...]

Here is the summary with links:
  - [net] net: lan966x: fix disabling timestamping without PTP traps
    https://git.kernel.org/netdev/net-next/c/e20a00eb02ca

You are awesome, thank you!
-- 
Deet-doot-dot, I am a bot.
https://korg.docs.kernel.org/patchwork/pwbot.html



^ permalink raw reply	[flat|nested] 5+ messages in thread

end of thread, other threads:[~2026-11-27 10:40 UTC | newest]

Thread overview: 5+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2026-11-23 14:53 [PATCH net] net: lan966x: fix disabling timestamping without PTP traps Daniel Machon
2026-11-27  9:11 ` Paolo Abeni
2026-11-27  9:45   ` Daniel Machon
2026-11-27 10:31     ` Paolo Abeni
2026-11-27 10:40 ` patchwork-bot+netdevbpf

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox