From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by smtp.lore.kernel.org (Postfix) with ESMTP id 03CB1C433EF for ; Wed, 16 Feb 2022 13:18:44 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S232982AbiBPNSw convert rfc822-to-8bit (ORCPT ); Wed, 16 Feb 2022 08:18:52 -0500 Received: from mxb-00190b01.gslb.pphosted.com ([23.128.96.19]:39764 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S234014AbiBPNSn (ORCPT ); Wed, 16 Feb 2022 08:18:43 -0500 Received: from unicorn.mansr.com (unicorn.mansr.com [IPv6:2001:8b0:ca0d:8d8e::2]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id A9E7029C106 for ; Wed, 16 Feb 2022 05:17:48 -0800 (PST) Received: from raven.mansr.com (raven.mansr.com [IPv6:2001:8b0:ca0d:8d8e::3]) by unicorn.mansr.com (Postfix) with ESMTPS id 5A29815361; Wed, 16 Feb 2022 13:17:47 +0000 (GMT) Received: by raven.mansr.com (Postfix, from userid 51770) id 4D149219C0A; Wed, 16 Feb 2022 13:17:47 +0000 (GMT) From: =?iso-8859-1?Q?M=E5ns_Rullg=E5rd?= To: Vladimir Oltean Cc: Florian Fainelli , netdev@vger.kernel.org, Egil Hjelmeland , Andrew Lunn , Juergen Borleis , Grygorii Strashko , lorenzo@kernel.org Subject: Re: DSA using cpsw and lan9303 References: <20220215205418.a25ro255qbv5hpjk@skbuf> Date: Wed, 16 Feb 2022 13:17:47 +0000 In-Reply-To: <20220215205418.a25ro255qbv5hpjk@skbuf> (Vladimir Oltean's message of "Tue, 15 Feb 2022 22:54:18 +0200") Message-ID: User-Agent: Gnus/5.13 (Gnus v5.13) Emacs/27.2 (gnu/linux) MIME-Version: 1.0 Content-Type: text/plain; charset=iso-8859-1 Content-Transfer-Encoding: 8BIT Precedence: bulk List-ID: X-Mailing-List: netdev@vger.kernel.org Vladimir Oltean 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. >> >> On 2/14/22 8:44 AM, Måns Rullgård wrote: >> > The hardware I'm working on has a LAN9303 switch connected to the >> > Ethernet port of an AM335x (ZCE package). In trying to make DSA work >> > with this combination, I have encountered two problems. >> > >> > Firstly, the cpsw driver configures the hardware to filter out frames >> > with unknown VLAN tags. To make it accept the tagged frames coming from >> > the LAN9303, I had to modify the latter driver like this: >> > >> > diff --git a/drivers/net/dsa/lan9303-core.c b/drivers/net/dsa/lan9303-core.c >> > index 2de67708bbd2..460c998c0c33 100644 >> > --- a/drivers/net/dsa/lan9303-core.c >> > +++ b/drivers/net/dsa/lan9303-core.c >> > @@ -1078,20 +1079,28 @@ static int lan9303_port_enable(struct dsa_switch *ds, int port, >> > struct phy_device *phy) >> > { >> > struct lan9303 *chip = ds->priv; >> > + struct net_device *master; >> > >> > if (!dsa_is_user_port(ds, port)) >> > return 0; >> > >> > + master = dsa_to_port(chip->ds, 0)->master; >> > + vlan_vid_add(master, htons(ETH_P_8021Q), port); >> >> That looks about right given that net/dsa/tag_lan9303.c appears to be a >> quasi DSA_TAG_PROTO_8021Q implementation AFAICT. > > In case it was not clear, I agree with Florian that this looks "about right", > I just thought that mentioning it wouldn't bring much to the table. > But I noticed you submitted a patch for the other issue and not for this. > > Some complaints about accessing the CPU port as dsa_to_port(chip->ds, 0), > but it's not the first place in this driver where that is done. What would be the proper way to do it? > dsa_tag_8021q_port_setup() also has: > > /* Add @rx_vid to the master's RX filter. */ > vlan_vid_add(master, ctx->proto, rx_vid); > > which is an indication that other switches with VLAN-based tagging > protocols should handle this somehow, somewhere. > > Note, though, that vlan_vid_add() allocates memory, so it would be good > to have a vlan_vid_del() too at some point. Yes, I just didn't include that bit in the initial query. -- Måns Rullgård