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: Fri, 18 May 2018 08:55:35 +0200 Message-ID: <20180518065535.GZ1972@nanopsycho> References: <20180517140239.GT1972@nanopsycho> <189f0c4d-aacb-73b9-0ff6-9feefe320c46@gmail.com> <20180517143020.GU1972@nanopsycho> <4ba82a94-18c9-e5bb-8e96-11af8cfefa73@gmail.com> <20180517173907.GW1972@nanopsycho> <408e70ee-d3b4-8431-5ca7-6defa17b7088@gmail.com> <20180517204855.GX1972@nanopsycho> <20180517210856.GJ23601@lunn.ch> <862a5fb4-7a3c-9c3f-bd50-f25bbcb2ca59@gmail.com> <20180517224017.GA3943@lunn.ch> Mime-Version: 1.0 Content-Type: text/plain; charset=us-ascii Cc: Florian Fainelli , 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: Andrew Lunn Return-path: Received: from mail-wm0-f65.google.com ([74.125.82.65]:40532 "EHLO mail-wm0-f65.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1750882AbeERGzi (ORCPT ); Fri, 18 May 2018 02:55:38 -0400 Received: by mail-wm0-f65.google.com with SMTP id j5-v6so13043112wme.5 for ; Thu, 17 May 2018 23:55:37 -0700 (PDT) Content-Disposition: inline In-Reply-To: <20180517224017.GA3943@lunn.ch> Sender: netdev-owner@vger.kernel.org List-ID: Fri, May 18, 2018 at 12:40:17AM CEST, andrew@lunn.ch wrote: >On Thu, May 17, 2018 at 03:06:36PM -0700, Florian Fainelli wrote: >> On 05/17/2018 02:08 PM, Andrew Lunn wrote: >> > On Thu, May 17, 2018 at 10:48:55PM +0200, Jiri Pirko wrote: >> >> Thu, May 17, 2018 at 09:14:32PM CEST, f.fainelli@gmail.com wrote: >> >>> On 05/17/2018 10:39 AM, Jiri Pirko wrote: >> >>>>>> That is compiled inside "fixed_phy", isn't it? >> >>>>> >> >>>>> It matches what CONFIG_FIXED_PHY is, so if it's built-in it also becomes >> >>>>> built-in, if is modular, it is also modular, this was fixed with >> >>>>> 40013ff20b1beed31184935fc0aea6a859d4d4ef ("net: dsa: Fix functional >> >>>>> dsa-loop dependency on FIXED_PHY") >> >>>> >> >>>> Now I have it compiled as module, and after modprobe dsa_loop I see: >> >>>> [ 1168.129202] libphy: Fixed MDIO Bus: probed >> >>>> [ 1168.222716] dsa-loop fixed-0:1f: DSA mockup driver: 0x1f >> >>>> >> >>>> This messages I did not see when I had fixed_phy compiled as buildin. >> >>>> >> >>>> But I still see no netdevs :/ >> >>> >> >>> The platform data assumes there is a network device named "eth0" as the >> >> >> >> Oups, I missed, I created dummy device and modprobed again. Now I see: >> >> >> >> $ sudo devlink port >> >> mdio_bus/fixed-0:1f/0: type eth netdev lan1 >> >> mdio_bus/fixed-0:1f/1: type eth netdev lan2 >> >> mdio_bus/fixed-0:1f/2: type eth netdev lan3 >> >> mdio_bus/fixed-0:1f/3: type eth netdev lan4 >> >> mdio_bus/fixed-0:1f/4: type notset >> >> mdio_bus/fixed-0:1f/5: type notset >> >> mdio_bus/fixed-0:1f/6: type notset >> >> mdio_bus/fixed-0:1f/7: type notset >> >> mdio_bus/fixed-0:1f/8: type notset >> >> mdio_bus/fixed-0:1f/9: type notset >> >> mdio_bus/fixed-0:1f/10: type notset >> >> mdio_bus/fixed-0:1f/11: type notset >> >> >> >> I wonder why there are ports 4-11 >> > >> > Hi Jiri >> > >> > ds = dsa_switch_alloc(&mdiodev->dev, DSA_MAX_PORTS); >> > >> > It is allocating a switch with 12 ports. However only 4 of them have >> > names. So the core only creates slave devices for those 4. >> > >> > This is a useful test. Real hardware often has unused ports. A WiFi AP >> > with a 7 port switch which only uses 6 ports is often seen. >> >> The following patch should fix this: >> >> >> diff --git a/net/dsa/dsa2.c b/net/dsa/dsa2.c >> index adf50fbc4c13..a06c29ec91f0 100644 >> --- a/net/dsa/dsa2.c >> +++ b/net/dsa/dsa2.c >> @@ -262,13 +262,14 @@ static int dsa_port_setup(struct dsa_port *dp) >> >> memset(&dp->devlink_port, 0, sizeof(dp->devlink_port)); >> >> + if (dp->type == DSA_PORT_TYPE_UNUSED) >> + return 0; >> + >> err = devlink_port_register(ds->devlink, &dp->devlink_port, >> dp->index); > >Hi Florian, Jiri > >Maybe it is better to add a devlink port type unused? The output with my patchset looks like this now: salt:~/iproute2$ sudo devlink/devlink port mdio_bus/fixed-0:1f/0: type eth netdev lan1 flavour physical number 0 mdio_bus/fixed-0:1f/1: type eth netdev lan2 flavour physical number 1 mdio_bus/fixed-0:1f/2: type eth netdev lan3 flavour physical number 2 mdio_bus/fixed-0:1f/3: type eth netdev lan4 flavour physical number 3 mdio_bus/fixed-0:1f/4: type notset mdio_bus/fixed-0:1f/5: type notset flavour cpu number 5 mdio_bus/fixed-0:1f/6: type notset mdio_bus/fixed-0:1f/7: type notset mdio_bus/fixed-0:1f/8: type notset mdio_bus/fixed-0:1f/9: type notset mdio_bus/fixed-0:1f/10: type notset mdio_bus/fixed-0:1f/11: type notset