[PATCH v8 4/8] net: dsa: allow rcv() and xmit() to be optional

Tim Harvey tharvey at gateworks.com
Wed Nov 30 18:27:23 CET 2022


On Wed, Nov 30, 2022 at 9:25 AM Vladimir Oltean <vladimir.oltean at nxp.com> wrote:
>
> On Tue, Nov 29, 2022 at 04:58:33PM -0800, Tim Harvey wrote:
> > Yes, it makes sense. How about the following patch instead:
> >
> > diff --git a/net/dsa-uclass.c b/net/dsa-uclass.c
> > index 211a991cdd0d..1ae9adc66eda 100644
> > --- a/net/dsa-uclass.c
> > +++ b/net/dsa-uclass.c
> > @@ -142,6 +142,9 @@ static int dsa_port_send(struct udevice *pdev,
> > void *packet, int length)
> >         struct dsa_port_pdata *port_pdata;
> >         int err;
> >
> > +       if (!ops->xmit)
> > +               return eth_get_ops(master)->send(master, packet, length);
>
> My 2 cents, I would avoid calling eth_get_ops(master)->send() twice.
> Either keep the mangling inside the "if" block, or pass the length
> argument by reference to your function, or use a goto skip_mangling.
>

Ok, I'll submit a v9 series momentarily with an if block.

Thanks!

Tim


More information about the U-Boot mailing list