Re: [PATCH net] net: lan966x: Remove ptp traps in case the ptp is not enabled.

From: Horatiu Vultur
Date: Fri May 17 2024 - 06:53:52 EST


The 05/17/2024 13:23, Vladimir Oltean wrote:
>
> On Fri, May 17, 2024 at 12:18:11PM +0200, Horatiu Vultur wrote:
> > The 05/17/2024 13:04, Vladimir Oltean wrote:
> > >
> > > On Thu, May 16, 2024 at 08:48:55AM +0200, Horatiu Vultur wrote:
> > > > > Alternatively, the -EOPNOTSUPP check could be moved before programming
> > > > > the traps in the first place.
> > > >
> > > > Thanks for the review.
> > > > Actually I don't think this alternative will work. In case of PHY
> > > > timestamping, we would still like to add those rules regardless if
> > > > ptp is enabled on lan966x.
> > > >
> > > > >
> > > > > Reviewed-by: Vladimir Oltean <vladimir.oltean@xxxxxxx>
> > > >
> > > > --
> > > > /Horatiu
> > >
> > > I don't understand why this would not have worked?
> > >
> > > diff --git a/drivers/net/ethernet/microchip/lan966x/lan966x_main.c b/drivers/net/ethernet/microchip/lan966x/lan966x_main.c
> > > index b12d3b8a64fd..1439a36e8394 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;
> > > +
> >
> > This should also work.
> > Initially I thought you wanted to have only the check for
> > port->lan966x->ptp here. And that is why I said it would not work.
>
> Ok. I see the patch was marked as "changes requested". I think the
> second alternative would be better anyway, because a requested
> configuration which cannot be supported will be rejected outright,
> rather than doing some stuff, figuring out it cannot be done, then
> undoing what was done. Would you mind sending a v2 like this?

I will send a v2 as you suggested.

--
/Horatiu