RE: [PATCH v1 net-next] net: dsa: Allow only up to two HSR HW offloaded ports for KSZ9477
From: Woojung.Huh
Date: Tue Jun 18 2024 - 10:44:47 EST
Hi Dan & Andrew,
> On Tue, Jun 18, 2024 at 03:52:23PM +0200, Andrew Lunn wrote:
> > > diff --git a/drivers/net/dsa/microchip/ksz_common.c
> b/drivers/net/dsa/microchip/ksz_common.c
> > > index 2818e24e2a51..181e81af3a78 100644
> > > --- a/drivers/net/dsa/microchip/ksz_common.c
> > > +++ b/drivers/net/dsa/microchip/ksz_common.c
> > > @@ -3906,6 +3906,11 @@ static int ksz_hsr_join(struct dsa_switch *ds,
> int port, struct net_device *hsr,
> > > return -EOPNOTSUPP;
> > > }
> > >
> > > + if (hweight8(dev->hsr_ports) > 1) {
> > > + NL_SET_ERR_MSG_MOD(extack, "Cannot offload more than two
> ports (in use=0x%x)", dev->hsr_ports);
> > > + return -EOPNOTSUPP;
> > > + }
> >
> > Hi Dan
> >
> > I don't know HSR to well, but this is offloading to hardware, to
> > accelerate what Linux is already doing in software. It should be, if
> > the hardware says it cannot do it, software will continue to do the
> > job. So the extack message should never be seen.
>
> Ah. Okay. However the rest of the function prints similar messages
> and so probably we could remove those error messages as well. To be
> honest, I just wanted something which functioned as a comment and
> mentioned "two ports". Perhaps the condition would be more clear as
> >= 2 instead of > 1?
>
I'm not a HSR expert and so could be a dummy question.
I think this case (upto 2 HSR port offload) is different from other offload error.
Others are checking whether offload is possible or not, so SW HSR can kick in
when -EOPNOTSUPP returns. However, this happens when joining 3rd (2+) port
with hardware offload is enabled.
It is still working two ports are in HW HSR offload and next ports are in SW HSR?
Thanks.
Woojung