netdev.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* [PATCH net v2] net: lan966x: Remove ptp traps in case the ptp is not enabled.
@ 2024-05-17 13:58 Horatiu Vultur
  2024-05-22  8:20 ` patchwork-bot+netdevbpf
  0 siblings, 1 reply; 2+ messages in thread
From: Horatiu Vultur @ 2024-05-17 13:58 UTC (permalink / raw)
  To: davem, edumazet, kuba, pabeni, richardcochran, vladimir.oltean,
	jacob.e.keller
  Cc: UNGLinuxDriver, netdev, linux-kernel, Horatiu Vultur

Lan966x is adding ptp traps to redirect the ptp frames to the CPU such
that the HW will not forward these frames anywhere. The issue is that in
case ptp is not enabled and the timestamping source is et to
HWTSTAMP_SOURCE_NETDEV then these traps would not be removed on the
error path.
Fix this by removing the traps in this case as they are not needed.

Fixes: 54e1ed69c40a ("net: lan966x: convert to ndo_hwtstamp_get() and ndo_hwtstamp_set()")
Suggested-by: Vladimir Oltean <vladimir.oltean@nxp.com>
Reviewed-by: Vladimir Oltean <vladimir.oltean@nxp.com>
Signed-off-by: Horatiu Vultur <horatiu.vultur@microchip.com>
---
v1->v2:
- as suggested by Vladimir, add the check before programming the traps
  in the first place
---
 drivers/net/ethernet/microchip/lan966x/lan966x_main.c | 6 +++---
 1 file changed, 3 insertions(+), 3 deletions(-)

diff --git a/drivers/net/ethernet/microchip/lan966x/lan966x_main.c b/drivers/net/ethernet/microchip/lan966x/lan966x_main.c
index 2635ef8958c80..fbff37067ab78 100644
--- a/drivers/net/ethernet/microchip/lan966x/lan966x_main.c
+++ b/drivers/net/ethernet/microchip/lan966x/lan966x_main.c
@@ -474,14 +474,14 @@ static int lan966x_port_hwtstamp_set(struct net_device *dev,
 	    cfg->source != HWTSTAMP_SOURCE_PHYLIB)
 		return -EOPNOTSUPP;
 
+	if (cfg->source == HWTSTAMP_SOURCE_NETDEV && !port->lan966x->ptp)
+		return -EOPNOTSUPP;
+
 	err = lan966x_ptp_setup_traps(port, cfg);
 	if (err)
 		return err;
 
 	if (cfg->source == HWTSTAMP_SOURCE_NETDEV) {
-		if (!port->lan966x->ptp)
-			return -EOPNOTSUPP;
-
 		err = lan966x_ptp_hwtstamp_set(port, cfg, extack);
 		if (err) {
 			lan966x_ptp_del_traps(port);
-- 
2.34.1


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

* Re: [PATCH net v2] net: lan966x: Remove ptp traps in case the ptp is not enabled.
  2024-05-17 13:58 [PATCH net v2] net: lan966x: Remove ptp traps in case the ptp is not enabled Horatiu Vultur
@ 2024-05-22  8:20 ` patchwork-bot+netdevbpf
  0 siblings, 0 replies; 2+ messages in thread
From: patchwork-bot+netdevbpf @ 2024-05-22  8:20 UTC (permalink / raw)
  To: Horatiu Vultur
  Cc: davem, edumazet, kuba, pabeni, richardcochran, vladimir.oltean,
	jacob.e.keller, UNGLinuxDriver, netdev, linux-kernel

Hello:

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

On Fri, 17 May 2024 15:58:08 +0200 you wrote:
> Lan966x is adding ptp traps to redirect the ptp frames to the CPU such
> that the HW will not forward these frames anywhere. The issue is that in
> case ptp is not enabled and the timestamping source is et to
> HWTSTAMP_SOURCE_NETDEV then these traps would not be removed on the
> error path.
> Fix this by removing the traps in this case as they are not needed.
> 
> [...]

Here is the summary with links:
  - [net,v2] net: lan966x: Remove ptp traps in case the ptp is not enabled.
    https://git.kernel.org/netdev/net/c/eda40be3a5ff

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] 2+ messages in thread

end of thread, other threads:[~2024-05-22  8:20 UTC | newest]

Thread overview: 2+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2024-05-17 13:58 [PATCH net v2] net: lan966x: Remove ptp traps in case the ptp is not enabled Horatiu Vultur
2024-05-22  8:20 ` 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;
as well as URLs for NNTP newsgroup(s).