Skip to content

Commit eda40be

Browse files
HoratiuVulturPaolo Abeni
authored andcommitted
net: lan966x: Remove ptp traps in case the ptp is not enabled.
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: 54e1ed6 ("net: lan966x: convert to ndo_hwtstamp_get() and ndo_hwtstamp_set()") Suggested-by: Vladimir Oltean <[email protected]> Reviewed-by: Vladimir Oltean <[email protected]> Signed-off-by: Horatiu Vultur <[email protected]> Link: https://lore.kernel.org/r/[email protected] Signed-off-by: Paolo Abeni <[email protected]>
1 parent 30a92c9 commit eda40be

File tree

1 file changed

+3
-3
lines changed

1 file changed

+3
-3
lines changed

drivers/net/ethernet/microchip/lan966x/lan966x_main.c

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -474,14 +474,14 @@ static int lan966x_port_hwtstamp_set(struct net_device *dev,
474474
cfg->source != HWTSTAMP_SOURCE_PHYLIB)
475475
return -EOPNOTSUPP;
476476

477+
if (cfg->source == HWTSTAMP_SOURCE_NETDEV && !port->lan966x->ptp)
478+
return -EOPNOTSUPP;
479+
477480
err = lan966x_ptp_setup_traps(port, cfg);
478481
if (err)
479482
return err;
480483

481484
if (cfg->source == HWTSTAMP_SOURCE_NETDEV) {
482-
if (!port->lan966x->ptp)
483-
return -EOPNOTSUPP;
484-
485485
err = lan966x_ptp_hwtstamp_set(port, cfg, extack);
486486
if (err) {
487487
lan966x_ptp_del_traps(port);

0 commit comments

Comments
 (0)