Re: [PATCH net] net: dsa: tag_rtl4_a: Fix egress tags

Linus Walleij
2021-08-30T21:56:37Z

On Mon, Aug 30, 2021 at 9:29 AM Vladimir Oltean <olteanv@gmail.com> wrote:
> On Sun, Aug 29, 2021 at 01:56:19AM +0200, Linus Walleij wrote:
> > I noticed that only port 0 worked on the RTL8366RB since we
> > started to use custom tags.
> >
> > It turns out that the format of egress custom tags is actually
> > different from ingress custom tags. While the lower bits just
> > contain the port number in ingress tags, egress tags need to
> > indicate destination port by setting the bit for the
> > corresponding port.
> >
> > It was working on port 0 because port 0 added 0x00 as port
> > number in the lower bits, and if you do this the packet gets
> > broadcasted to all ports, including the intended port.
> > Ooops.
>
> Does it get broadcast, or forwarded by MAC DA/VLAN ID as you'd expect
> for a regular data packet?

It gets broadcast :/

> > - out = (RTL4_A_PROTOCOL_RTL8366RB << 12) | (2 << 8);
>
> What was 2 << 8? This patch changes that part.

It was a bit set in the ingress packets, we don't really know
what egress tag bits there are so first I just copied this
and since it turns out the bits in the lower order are not
correct I dropped this too and it works fine.

Do you want me to clarify in the commit message and
resend?

Yours,
Linus Walleij