Message ID | 20240209-realtek_reverse-v6-0-0662f8cbc7b5@gmail.com (mailing list archive) |
---|---|
Headers | show |
Series | net: dsa: realtek: variants to drivers, interfaces to a common module | expand |
On Fri, Feb 9, 2024 at 6:04 AM Luiz Angelo Daros de Luca <luizluca@gmail.com> wrote: > The current driver consists of two interface modules (SMI and MDIO) and > two family/variant modules (RTL8365MB and RTL8366RB). The SMI and MDIO > modules serve as the platform and MDIO drivers, respectively, calling > functions from the variant modules. In this setup, one interface module > can be loaded independently of the other, but both variants must be > loaded (if not disabled at build time) for any type of interface. This > approach doesn't scale well, especially with the addition of more switch > variants (e.g., RTL8366B), leading to loaded but unused modules. > Additionally, this also seems upside down, as the specific driver code > normally depends on the more generic functions and not the other way > around. > > Each variant module was converted into real drivers, serving as both a > platform driver (for switches connected using the SMI interface) and an > MDIO driver (for MDIO-connected switches). The relationship between the > variant and interface modules is reversed, with the variant module now > calling both interface functions (if not disabled at build time). While > in most devices only one interface is likely used, the interface code is > significantly smaller than a variant module, consuming fewer resources > than the previous code. With variant modules now functioning as real > drivers, compatible strings are published only in a single variant > module, preventing conflicts. > > The patch series introduces a new common module for functions shared by > both variants. This module also absorbs the two previous interface > modules, as they would always be loaded anyway. > > The series relocates the user MII driver from realtek-smi to rtl83xx. It > is now used by MDIO-connected switches instead of the generic DSA > driver. There's a change in how this driver locates the MDIO node. It > now only searches for a child node named "mdio". > > The dsa_switch in realtek_priv->ds is now embedded in the struct. It is > always in use and avoids dynamic memory allocation. > > Testing has been performed with an RTL8367S (rtl8365mb) using MDIO > interface and an RTL8366RB (rtl8366) with SMI interface. Tested on my RTL8366RB on a D-Link DIR-685 as well, works like a charm: Tested-by: Linus Walleij <linus.walleij@linaro.org> Yours, Linus Walleij
Hello: This series was applied to netdev/net-next.git (main) by David S. Miller <davem@davemloft.net>: On Fri, 09 Feb 2024 02:03:36 -0300 you wrote: > The current driver consists of two interface modules (SMI and MDIO) and > two family/variant modules (RTL8365MB and RTL8366RB). The SMI and MDIO > modules serve as the platform and MDIO drivers, respectively, calling > functions from the variant modules. In this setup, one interface module > can be loaded independently of the other, but both variants must be > loaded (if not disabled at build time) for any type of interface. This > approach doesn't scale well, especially with the addition of more switch > variants (e.g., RTL8366B), leading to loaded but unused modules. > Additionally, this also seems upside down, as the specific driver code > normally depends on the more generic functions and not the other way > around. > > [...] Here is the summary with links: - [net-next,v6,01/11] net: dsa: realtek: drop cleanup from realtek_ops https://git.kernel.org/netdev/net-next/c/33f4336cbd32 - [net-next,v6,02/11] net: dsa: realtek: introduce REALTEK_DSA namespace https://git.kernel.org/netdev/net-next/c/ded3813b44fe - [net-next,v6,03/11] net: dsa: realtek: convert variants into real drivers https://git.kernel.org/netdev/net-next/c/bce254b839ab - [net-next,v6,04/11] net: dsa: realtek: keep variant reference in realtek_priv https://git.kernel.org/netdev/net-next/c/4667a1db2f55 - [net-next,v6,05/11] net: dsa: realtek: common rtl83xx module https://git.kernel.org/netdev/net-next/c/8be040ecd94c - [net-next,v6,06/11] net: dsa: realtek: merge rtl83xx and interface modules into realtek_dsa https://git.kernel.org/netdev/net-next/c/98b75c1c149c - [net-next,v6,07/11] net: dsa: realtek: get internal MDIO node by name https://git.kernel.org/netdev/net-next/c/8685c98d45c5 - [net-next,v6,08/11] net: dsa: realtek: clean user_mii_bus setup https://git.kernel.org/netdev/net-next/c/68c66d8d8a19 - [net-next,v6,09/11] net: dsa: realtek: migrate user_mii_bus setup to realtek_dsa https://git.kernel.org/netdev/net-next/c/b4bd77971f3c - [net-next,v6,10/11] net: dsa: realtek: use the same mii bus driver for both interfaces https://git.kernel.org/netdev/net-next/c/bba140a566ed - [net-next,v6,11/11] net: dsa: realtek: embed dsa_switch into realtek_priv https://git.kernel.org/netdev/net-next/c/9fc469b2943d You are awesome, thank you!
> Tested on my RTL8366RB on a D-Link DIR-685 as well, works like a > charm: Thanks, Linus. An independent test is always welcome. > Tested-by: Linus Walleij <linus.walleij@linaro.org> Regards, Luiz
> Hello: > > This series was applied to netdev/net-next.git (main) > by David S. Miller <davem@davemloft.net>: > > On Fri, 09 Feb 2024 02:03:36 -0300 you wrote: > > The current driver consists of two interface modules (SMI and MDIO) and > > two family/variant modules (RTL8365MB and RTL8366RB). The SMI and MDIO > > modules serve as the platform and MDIO drivers, respectively, calling > > functions from the variant modules. In this setup, one interface module > > can be loaded independently of the other, but both variants must be > > loaded (if not disabled at build time) for any type of interface. This > > approach doesn't scale well, especially with the addition of more switch > > variants (e.g., RTL8366B), leading to loaded but unused modules. > > Additionally, this also seems upside down, as the specific driver code > > normally depends on the more generic functions and not the other way > > around. > > > > [...] > > Here is the summary with links: > - [net-next,v6,01/11] net: dsa: realtek: drop cleanup from realtek_ops > https://git.kernel.org/netdev/net-next/c/33f4336cbd32 > - [net-next,v6,02/11] net: dsa: realtek: introduce REALTEK_DSA namespace > https://git.kernel.org/netdev/net-next/c/ded3813b44fe > - [net-next,v6,03/11] net: dsa: realtek: convert variants into real drivers > https://git.kernel.org/netdev/net-next/c/bce254b839ab > - [net-next,v6,04/11] net: dsa: realtek: keep variant reference in realtek_priv > https://git.kernel.org/netdev/net-next/c/4667a1db2f55 > - [net-next,v6,05/11] net: dsa: realtek: common rtl83xx module > https://git.kernel.org/netdev/net-next/c/8be040ecd94c > - [net-next,v6,06/11] net: dsa: realtek: merge rtl83xx and interface modules into realtek_dsa > https://git.kernel.org/netdev/net-next/c/98b75c1c149c > - [net-next,v6,07/11] net: dsa: realtek: get internal MDIO node by name > https://git.kernel.org/netdev/net-next/c/8685c98d45c5 > - [net-next,v6,08/11] net: dsa: realtek: clean user_mii_bus setup > https://git.kernel.org/netdev/net-next/c/68c66d8d8a19 > - [net-next,v6,09/11] net: dsa: realtek: migrate user_mii_bus setup to realtek_dsa > https://git.kernel.org/netdev/net-next/c/b4bd77971f3c > - [net-next,v6,10/11] net: dsa: realtek: use the same mii bus driver for both interfaces > https://git.kernel.org/netdev/net-next/c/bba140a566ed > - [net-next,v6,11/11] net: dsa: realtek: embed dsa_switch into realtek_priv > https://git.kernel.org/netdev/net-next/c/9fc469b2943d > > You are awesome, thank you! Thank you all involved, especially Vladmir who invested quite some time on this. Regards, Luiz
On Mon, Feb 12, 2024 at 09:45:19AM -0300, Luiz Angelo Daros de Luca wrote:
> Thank you all involved, especially Vladmir who invested quite some time on this.
Thank you as well for being persistent. Unfortunately, due to some
personal things that need my attention, I have been reading my emails on
and off in the past few weeks, and will continue to do so for some weeks
to come still. Sorry for the delays.