lists.openwall.net   lists  /  announce  owl-users  owl-dev  john-users  john-dev  passwdqc-users  yescrypt  popa3d-users  /  oss-security  kernel-hardening  musl  sabotage  tlsify  passwords  /  crypt-dev  xvendor  /  Bugtraq  Full-Disclosure  linux-kernel  linux-netdev  linux-ext4  linux-hardening  linux-cve-announce  PHC 
Open Source and information security mailing list archives
 
Hash Suite: Windows password security audit tool. GUI, reports in PDF.
[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Date:   Mon, 14 Feb 2022 19:17:33 +0000
From:   Måns Rullgård <mans@...sr.com>
To:     Vladimir Oltean <olteanv@...il.com>
Cc:     Florian Fainelli <f.fainelli@...il.com>, netdev@...r.kernel.org,
        Egil Hjelmeland <privat@...l-hjelmeland.no>,
        Andrew Lunn <andrew@...n.ch>,
        Juergen Borleis <jbe@...gutronix.de>,
        Grygorii Strashko <grygorii.strashko@...com>,
        lorenzo@...nel.org
Subject: Re: DSA using cpsw and lan9303

Vladimir Oltean <olteanv@...il.com> writes:

> Hi Måns,
>
> On Mon, Feb 14, 2022 at 09:16:10AM -0800, Florian Fainelli wrote:
>> +others,
>>
>> netdev is a high volume list, you should probably copy directly the
>> people involved with the code you are working with.
>
> Thanks, Florian.
>
>> > Secondly, the cpsw driver strips VLAN tags from incoming frames, and
>> > this prevents the DSA parsing from working.  As a dirty workaround, I
>> > did this:
>> >
>> > diff --git a/drivers/net/ethernet/ti/cpsw_priv.c b/drivers/net/ethernet/ti/cpsw_priv.c
>> > index 424e644724e4..e15f42ece8bf 100644
>> > --- a/drivers/net/ethernet/ti/cpsw_priv.c
>> > +++ b/drivers/net/ethernet/ti/cpsw_priv.c
>> > @@ -235,6 +235,7 @@ void cpsw_rx_vlan_encap(struct sk_buff *skb)
>> >
>> >         /* Remove VLAN header encapsulation word */
>> >         skb_pull(skb, CPSW_RX_VLAN_ENCAP_HDR_SIZE);
>> > +       return;
>> >
>> >         pkt_type = (rx_vlan_encap_hdr >>
>> >                     CPSW_RX_VLAN_ENCAP_HDR_PKT_TYPE_SHIFT) &
>> >
>> > With these changes, everything seems to work as expected.
>> >
>> > Now I'd appreciate if someone could tell me how I should have done this.
>
> Assuming cpsw_rx_vlan_encap() doesn't just eat the VLAN, but puts it in
> the skb hwaccel area. The tag_lan9303.c tagger must deal with both
> variants of VLANs.
>
> For example, dsa_8021q_rcv() has:
>
> 	skb_push_rcsum(skb, ETH_HLEN);
> 	if (skb_vlan_tag_present(skb)) {
> 		tci = skb_vlan_tag_get(skb);
> 		__vlan_hwaccel_clear_tag(skb);
> 	} else {
> 		__skb_vlan_pop(skb, &tci);
> 	}
> 	skb_pull_rcsum(skb, ETH_HLEN);
>
> 	vid = tci & VLAN_VID_MASK;
>
> 	(process @vid here)
>
> which should give you a head start.

Thanks, that looks promising.

>> > Please don't make me send an actual patch.
>
> So what is your plan otherwise? :)

I meant I didn't want to send a patch I know to be broken only to
provoke a discussion.

-- 
Måns Rullgård

Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ