[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <CAKR-sGdCD3i9_XpOAsc-uFXXy23FK1+UHj78KK5z99yUfD-V8A@mail.gmail.com>
Date: Fri, 17 Mar 2023 17:25:16 +0100
From: Álvaro Fernández Rojas <noltari@...il.com>
To: Michal Swiatkowski <michal.swiatkowski@...ux.intel.com>
Cc: andrew@...n.ch, f.fainelli@...il.com, jonas.gorski@...il.com,
olteanv@...il.com, davem@...emloft.net, edumazet@...gle.com,
kuba@...nel.org, pabeni@...hat.com, netdev@...r.kernel.org,
linux-kernel@...r.kernel.org
Subject: Re: [PATCH] net: dsa: tag_brcm: legacy: fix daisy-chained switches
El vie, 17 mar 2023 a las 13:26, Michal Swiatkowski
(<michal.swiatkowski@...ux.intel.com>) escribió:
>
> On Fri, Mar 17, 2023 at 01:08:15PM +0100, Álvaro Fernández Rojas wrote:
> > When BCM63xx internal switches are connected to switches with a 4-byte
> > Broadcom tag, it does not identify the packet as VLAN tagged, so it adds one
> > based on its PVID (which is likely 0).
> > Right now, the packet is received by the BCM63xx internal switch and the 6-byte
> > tag is properly processed. The next step would to decode the corresponding
> > 4-byte tag. However, the internal switch adds an invalid VLAN tag after the
> > 6-byte tag and the 4-byte tag handling fails.
> > In order to fix this we need to remove the invalid VLAN tag after the 6-byte
> > tag before passing it to the 4-byte tag decoding.
> >
> > Signed-off-by: Álvaro Fernández Rojas <noltari@...il.com>
> > ---
> > net/dsa/tag_brcm.c | 10 ++++++++--
> > 1 file changed, 8 insertions(+), 2 deletions(-)
> >
> > diff --git a/net/dsa/tag_brcm.c b/net/dsa/tag_brcm.c
> > index 10239daa5745..cacdafb41200 100644
> > --- a/net/dsa/tag_brcm.c
> > +++ b/net/dsa/tag_brcm.c
> > @@ -7,6 +7,7 @@
> >
> > #include <linux/dsa/brcm.h>
> > #include <linux/etherdevice.h>
> > +#include <linux/if_vlan.h>
> > #include <linux/list.h>
> > #include <linux/slab.h>
> >
> > @@ -252,6 +253,7 @@ static struct sk_buff *brcm_leg_tag_xmit(struct sk_buff *skb,
> > static struct sk_buff *brcm_leg_tag_rcv(struct sk_buff *skb,
> > struct net_device *dev)
> > {
> > + int len = BRCM_LEG_TAG_LEN;
> > int source_port;
> > u8 *brcm_tag;
> >
> > @@ -266,12 +268,16 @@ static struct sk_buff *brcm_leg_tag_rcv(struct sk_buff *skb,
> > if (!skb->dev)
> > return NULL;
> >
> > + /* VLAN tag is added by BCM63xx internal switch */
> > + if (netdev_uses_dsa(skb->dev))
> > + len += VLAN_HLEN;
> > +
> > /* Remove Broadcom tag and update checksum */
> > - skb_pull_rcsum(skb, BRCM_LEG_TAG_LEN);
> > + skb_pull_rcsum(skb, len);
> >
> > dsa_default_offload_fwd_mark(skb);
> >
> > - dsa_strip_etype_header(skb, BRCM_LEG_TAG_LEN);
> > + dsa_strip_etype_header(skb, len);
> >
> > return skb;
> > }
> LGTM, but You can add fixes tag.
> Reviewed-by: Michal Swiatkowski <michal.swiatkowski@...ux.intel.com>
Thanks Michal, I will give time for others to review this before
sending v2 with the fixes tag.
>
> > --
> > 2.30.2
> >
--
Álvaro
Powered by blists - more mailing lists