From mboxrd@z Thu Jan 1 00:00:00 1970 From: Jiri Pirko Subject: Re: [patch net-next RFC 04/12] dsa: set devlink port attrs for dsa ports Date: Thu, 17 May 2018 16:30:20 +0200 Message-ID: <20180517143020.GU1972@nanopsycho> References: <20180322105522.8186-1-jiri@resnulli.us> <20180322105522.8186-5-jiri@resnulli.us> <20180323133002.GF5145@lunn.ch> <20180323144914.GA2125@nanopsycho> <20180517140239.GT1972@nanopsycho> <189f0c4d-aacb-73b9-0ff6-9feefe320c46@gmail.com> Mime-Version: 1.0 Content-Type: text/plain; charset=us-ascii Cc: Andrew Lunn , netdev@vger.kernel.org, davem@davemloft.net, idosch@mellanox.com, jakub.kicinski@netronome.com, mlxsw@mellanox.com, vivien.didelot@savoirfairelinux.com, michael.chan@broadcom.com, ganeshgr@chelsio.com, saeedm@mellanox.com, simon.horman@netronome.com, pieter.jansenvanvuuren@netronome.com, john.hurley@netronome.com, dirk.vandermerwe@netronome.com, alexander.h.duyck@intel.com, ogerlitz@mellanox.com, dsahern@gmail.com, vijaya.guvva@cavium.com, satananda.burla@cavium.com, raghu.vatsavayi@cavium.com, felix.manlunas@cavium.com, gospo@broadcom.com, sathya.perla@broadcom.com, vasundhara-v.volam@broadcom.com, tariqt@mellanox.com, eranbe@mellanox.com, jeffrey.t.kirsher@intel.com To: Florian Fainelli Return-path: Received: from mail-wr0-f194.google.com ([209.85.128.194]:42973 "EHLO mail-wr0-f194.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1752062AbeEQOaX (ORCPT ); Thu, 17 May 2018 10:30:23 -0400 Received: by mail-wr0-f194.google.com with SMTP id t16-v6so2744986wrm.9 for ; Thu, 17 May 2018 07:30:22 -0700 (PDT) Content-Disposition: inline In-Reply-To: <189f0c4d-aacb-73b9-0ff6-9feefe320c46@gmail.com> Sender: netdev-owner@vger.kernel.org List-ID: Thu, May 17, 2018 at 04:08:10PM CEST, f.fainelli@gmail.com wrote: > > >On 05/17/2018 07:02 AM, Jiri Pirko wrote: >> Fri, Mar 23, 2018 at 06:09:29PM CET, f.fainelli@gmail.com wrote: >>> On 03/23/2018 07:49 AM, Jiri Pirko wrote: >>>> Fri, Mar 23, 2018 at 02:30:02PM CET, andrew@lunn.ch wrote: >>>>> On Thu, Mar 22, 2018 at 11:55:14AM +0100, Jiri Pirko wrote: >>>>>> From: Jiri Pirko >>>>>> >>>>>> Set the attrs and allow to expose port flavour to user via devlink. >>>>>> >>>>>> Signed-off-by: Jiri Pirko >>>>>> --- >>>>>> net/dsa/dsa2.c | 23 +++++++++++++++++++++++ >>>>>> 1 file changed, 23 insertions(+) >>>>>> >>>>>> diff --git a/net/dsa/dsa2.c b/net/dsa/dsa2.c >>>>>> index adf50fbc4c13..49453690696d 100644 >>>>>> --- a/net/dsa/dsa2.c >>>>>> +++ b/net/dsa/dsa2.c >>>>>> @@ -270,7 +270,27 @@ static int dsa_port_setup(struct dsa_port *dp) >>>>>> case DSA_PORT_TYPE_UNUSED: >>>>>> break; >>>>>> case DSA_PORT_TYPE_CPU: >>>>>> + /* dp->index is used now as port_number. However >>>>>> + * CPU ports should have separate numbering >>>>>> + * independent from front panel port numbers. >>>>>> + */ >>>>>> + devlink_port_attrs_set(&dp->devlink_port, >>>>>> + DEVLINK_PORT_FLAVOUR_CPU, >>>>>> + dp->index, false, 0); >>>>>> + err = dsa_port_link_register_of(dp); >>>>>> + if (err) { >>>>>> + dev_err(ds->dev, "failed to setup link for port %d.%d\n", >>>>>> + ds->index, dp->index); >>>>>> + return err; >>>>>> + } >>>>> >>>>> Ah, i get it. These used to be two case statements with one code >>>>> block. But you split them apart, so needed to duplicate the >>>>> dsa_port_link_register. >>>>> >>>>> Unfortunately, you forgot to add a 'break;', so it still falls >>>>> through, and overwrites the port flavour to DSA. >>>> >>>> ah, crap. Don't have hw to test this :/ >>>> Will fix. Thanks! >>> >>> You don't need hardware, there is drivers/net/dsa/dsa_loop.c which will >>> emulate a DSA switch. It won't create interconnect ports, since only one >> >> Hmm, trying to use dsa_loop. Doing: >> modprobe dsa_loop >> modprobe fixed_phy >> >> I don't see the netdevs. Any idea what am I doing wrong? Thanks! > >Yes, modprobe dsa-loop-bdinfo first, which will create the That is compiled inside "fixed_phy", isn't it? In my case, "Module fixed_phy is builtin" So it should be enough just to "modprobe dsa_loop", right? That does not work :/ >mdio_board_info and then modprobe dsa-loop. > >> >> >>> switch can be created with the method chosen, but this would have helped >>> you catch the missing break since the "CPU" port would have been >>> displayed as "DSA" anyway. >>> >>> If you need hardware, I am sure this can be somehow arranged. By that, I >>> mean something on which you can run upstream Linux on without out of >>> tree patches. >>> -- >>> Florian > >-- >Florian