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:37:35 +0200 Message-ID: <20180518063735.GY1972@nanopsycho> References: <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> <57d602af-2996-dde5-72b1-2d4f58a47032@gmail.com> <20180518014137.GB6069@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-wr0-f176.google.com ([209.85.128.176]:37377 "EHLO mail-wr0-f176.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1751156AbeERGhh (ORCPT ); Fri, 18 May 2018 02:37:37 -0400 Received: by mail-wr0-f176.google.com with SMTP id h5-v6so7953210wrm.4 for ; Thu, 17 May 2018 23:37:37 -0700 (PDT) Content-Disposition: inline In-Reply-To: <20180518014137.GB6069@lunn.ch> Sender: netdev-owner@vger.kernel.org List-ID: Fri, May 18, 2018 at 03:41:37AM CEST, andrew@lunn.ch wrote: >> >>> 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 port does not exist on the switch, so it should not even be >> registered IMHO. > >Hi Florian > >The ports do exist, when you called dsa_switch_alloc() you said the >switch has 12 ports. What benefit does it have to register unused ports? What is a usecase for them. Like Florian, I also think they should not be registered. > > Andrew