Subject: Re: [patch net-next RFC 04/12] dsa: set devlink port attrs for dsa ports

From: Andrew Lunn <[email-masked]>
Date: Thu, 17 May 2018 23:08:56 +0200

On Thu, May 17, 2018 at 10:48:55PM +0200, Jiri Pirko wrote:
> Thu, May 17, 2018 at 09:14:32PM CEST, [email-masked] 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.

     Andrew