Re: [PATCH net-next v3 4/4] net: lan966x: Add ptp trap rules

From: Horatiu Vultur
Date: Fri Dec 09 2022 - 07:53:59 EST


The 12/09/2022 13:10, Michael Walle wrote:
>
> Hi,

Hi Michael,

>
> > > > The issue is because you have not enabled the TCAM lookups per
> > > > port. They can be enabled using this commands:
> > > >
> > > > tc qdisc add dev eth0 clsact
> > >
> > > This gives me the following error, might be a missing kconfig option:
> > >
> > > # tc qdisc add dev eth0 clsact
> > > RTNETLINK answers: Operation not supported
> >
> > Yes that should be the case, I think you are missing:
> > CONFIG_NET_SCHED
> > But may be others when you try to add the next rule.
>
> I guess I'd need to update my kernel config sometime. At the
> moment I just have a basic one, as there is still so much stuff
> missing for the lan9668. So I haven't come around testing anything
> else. As I said, I just noticed because my rootfs happens to have
> linuxptp started by default.

I understand.

>
> > > > tc filter add dev eth0 ingress prio 5 handle 5 matchall skip_sw action
> > > > goto chain 8000000
> > > >
> > > > This will enable the lookup and then you should be able to start again
> > > > the ptp4l. Sorry for not mention this, at least I should have written
> > > > it
> > > > somewhere that this is required.
> > > >
> > > > I was not sure if lan966x should or not enable tcam lookups
> > > > automatically when a ptp trap action is added. I am open to suggestion
> > > > here.
> > >
> > > IMHO, from a user point of view this should just work. For a user
> > > there is no connection between running linuxptp and some filtering
> > > stuff with 'tc'.
> > >
> > > Also, if the answer to my question above is yes, and ptp should
> > > have worked on eth0 before, this is a regression then.
> >
> > OK, I can see your point.
> > With the following diff, you should see the same behaviour as before:
>
> Ok, I can say, I don't see the error message anymore. Haven't tested
> PTP though. I'd need to setup it up first.

Good, at least no more warnings and should not be any regression there.

>
> Does it also work out of the box with the following patch if
> the interface is part of a bridge or do you still have to do
> the tc magic from above?

You will still need to enable the TCAM using the tc command to have it
working when the interface is part of the bridge.

>
> -michael
>
> > ---
> > diff --git
> > a/drivers/net/ethernet/microchip/lan966x/lan966x_vcap_impl.c
> > b/drivers/net/ethernet/microchip/lan966x/lan966x_vcap_impl.c
> > index 904f5a3f636d3..538f4b76cf97a 100644
> > --- a/drivers/net/ethernet/microchip/lan966x/lan966x_vcap_impl.c
> > +++ b/drivers/net/ethernet/microchip/lan966x/lan966x_vcap_impl.c
> > @@ -91,8 +91,6 @@ lan966x_vcap_is2_get_port_keysets(struct net_device
> > *dev, int lookup,
> >
> > /* Check if the port keyset selection is enabled */
> > val = lan_rd(lan966x, ANA_VCAP_S2_CFG(port->chip_port));
> > - if (!ANA_VCAP_S2_CFG_ENA_GET(val))
> > - return -ENOENT;
> >
> > /* Collect all keysets for the port in a list */
> > if (l3_proto == ETH_P_ALL)
> > ---
> >
> > >
> > > -michael

--
/Horatiu