From: Florian Fainelli <f.fainelli@gmail.com>
To: Josua Mayer <josua@solid-run.com>, Andrew Lunn <andrew@lunn.ch>,
Vladimir Oltean <olteanv@gmail.com>,
"David S. Miller" <davem@davemloft.net>,
Eric Dumazet <edumazet@google.com>,
Jakub Kicinski <kuba@kernel.org>, Paolo Abeni <pabeni@redhat.com>
Cc: netdev@vger.kernel.org, linux-kernel@vger.kernel.org,
Mor Nagli <mor.nagli@solid-run.com>
Subject: Re: [PATCH net-next v3] net: dsa: mv88e6xxx: control mdio bus-id truncation for long paths
Date: Sun, 05 May 2024 12:11:57 -0700 [thread overview]
Message-ID: <A40C71BD-A733-43D2-A563-FEB1322ECB5C@gmail.com> (raw)
In-Reply-To: <20240505-mv88e6xxx-truncate-busid-v3-1-e70d6ec2f3db@solid-run.com>
Le 5 mai 2024 02:52:45 GMT-07:00, Josua Mayer <josua@solid-run.com> a écrit :
>mv88e6xxx supports multiple mdio buses as children, e.g. to model both
>internal and external phys. If the child buses mdio ids are truncated,
>they might collide with each other leading to an obscure error from
>kobject_add.
>
>The maximum length of bus id is currently defined as 61
>(MII_BUS_ID_SIZE). Truncation can occur on platforms with long node
>names and multiple levels before the parent bus on which the dsa switch
>itself sits, e.g. CN9130 [1].
>
>Compare the return value of snprintf against maximum bus-id length to
>detect truncation. In that case write an incrementing marker to the end
>to avoid name collisions.
>This changes the problematic bus-ids mdio and mdio-external from [1]
>to [2].
>
>Truncation at the beginning was considered as a workaround, however that
>is still subject to name collisions in sysfs where only the first
>characters differ.
>
>[1]
>[ 8.324631] mv88e6085 f212a200.mdio-mii:04: switch 0x1760 detected: Marvell 88E6176, revision 1
>[ 8.389516] mv88e6085 f212a200.mdio-mii:04: Truncated bus-id may collide.
>[ 8.592367] mv88e6085 f212a200.mdio-mii:04: Truncated bus-id may collide.
>[ 8.623593] sysfs: cannot create duplicate filename '/devices/platform/cp0/cp0:config-space@f2000000/f212a200.mdio/mdio_bus/f212a200.mdio-mii/f212a200.mdio-mii:04/mdio_bus/!cp0!config-space@f2000000!mdio@12a200!ethernet-switch@4!mdi'
>[ 8.785480] kobject: kobject_add_internal failed for !cp0!config-space@f2000000!mdio@12a200!ethernet-switch@4!mdi with -EEXIST, don't try to register things with the same name in the same directory.
>[ 8.936514] libphy: mii_bus /cp0/config-space@f2000000/mdio@12a200/ethernet-switch@4/mdi failed to register
>[ 8.946300] mdio_bus !cp0!config-space@f2000000!mdio@12a200!ethernet-switch@4!mdi: __mdiobus_register: -22
>[ 8.956003] mv88e6085 f212a200.mdio-mii:04: Cannot register MDIO bus (-22)
>[ 8.965329] mv88e6085: probe of f212a200.mdio-mii:04 failed with error -22
>
>[2]
>/devices/platform/cp0/cp0:config-space@f2000000/f212a200.mdio/mdio_bus/f212a200.mdio-mii/f212a200.mdio-mii:04/mdio_bus/!cp0!config-space@f2000000!mdio@12a200!ethernet-switch...!-0
>/devices/platform/cp0/cp0:config-space@f2000000/f212a200.mdio/mdio_bus/f212a200.mdio-mii/f212a200.mdio-mii:04/mdio_bus/!cp0!config-space@f2000000!mdio@12a200!ethernet-switch...!-1
>
>Signed-off-by: Josua Mayer <josua@solid-run.com>
>---
The idea and implementation is reasonable but this could affect other drivers than mv88e6xxx, why not move that logic to mdiobus_register() and tracking the truncation index globally within the MDIO bus layer?
If we prefer a driver based solution, the mii_bus object could carry a truncation format, at the risk of creating more variation between drivers in case of truncation. We could also wait until we have another driver requiring a similar solution before promoting this to a wider range.
Florian
next prev parent reply other threads:[~2024-05-05 19:12 UTC|newest]
Thread overview: 6+ messages / expand[flat|nested] mbox.gz Atom feed top
2024-05-05 9:52 Josua Mayer
2024-05-05 19:11 ` Florian Fainelli [this message]
2024-05-07 12:03 ` Josua Mayer
2024-05-13 15:32 ` Jakub Kicinski
2024-11-18 14:57 ` Josua Mayer
2024-11-18 15:05 ` Andrew Lunn
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=A40C71BD-A733-43D2-A563-FEB1322ECB5C@gmail.com \
--to=f.fainelli@gmail.com \
--cc=andrew@lunn.ch \
--cc=davem@davemloft.net \
--cc=edumazet@google.com \
--cc=josua@solid-run.com \
--cc=kuba@kernel.org \
--cc=linux-kernel@vger.kernel.org \
--cc=mor.nagli@solid-run.com \
--cc=netdev@vger.kernel.org \
--cc=olteanv@gmail.com \
--cc=pabeni@redhat.com \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox
all inboxes | Powered by JetHome®