[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <f0329c00-8d5a-ba89-c793-608f85cf70b3@kernel.org>
Date: Mon, 12 Jun 2023 17:27:14 +0300
From: Roger Quadros <rogerq@...nel.org>
To: Arnd Bergmann <arnd@...nel.org>, "David S. Miller" <davem@...emloft.net>,
Eric Dumazet <edumazet@...gle.com>, Jakub Kicinski <kuba@...nel.org>,
Paolo Abeni <pabeni@...hat.com>
Cc: Grygorii Strashko <grygorii.strashko@...com>, linux-omap@...r.kernel.org,
Vignesh Raghavendra <vigneshr@...com>, Nishanth Menon <nm@...com>,
Tero Kristo <kristo@...nel.org>, Arnd Bergmann <arnd@...db.de>,
Randy Dunlap <rdunlap@...radead.org>, Mao Wenan <maowenan@...wei.com>,
Andrew Lunn <andrew@...n.ch>, netdev@...r.kernel.org,
linux-kernel@...r.kernel.org, Alexei Starovoitov <ast@...nel.org>,
Daniel Borkmann <daniel@...earbox.net>,
Jesper Dangaard Brouer <hawk@...nel.org>,
John Fastabend <john.fastabend@...il.com>,
Simon Horman <simon.horman@...igine.com>,
Vladimir Oltean <vladimir.oltean@....com>, bpf@...r.kernel.org
Subject: Re: [PATCH 3/3] net: ethernet: ti-cpsw: fix linking built-in code to
modules
Hi Arnd,
On 12/06/2023 15:40, Arnd Bergmann wrote:
> From: Arnd Bergmann <arnd@...db.de>
>
> There are six variants of the cpsw driver, sharing various parts of
> the code: davinci-emac, cpsw, cpsw-switchdev, netcp, netcp_ethss and
> am65-cpsw-nuss.
>
> I noticed that this means some files can be linked into more than
> one loadable module, or even part of vmlinux but also linked into
> a loadable module, both of which mess up assumptions of the build
> system.
>
> Change this back to having separate modules for each portion that
> can be linked standalone, exporting symbols as needed:
>
> - ti-cpsw-common.ko now contains both cpsw-common.o and
> davinci_cpdma.o as they are always used together
>
> - ti-cpsw-priv.ko contains cpsw_priv.o, cpsw_sl.o and cpsw_ethtool.o,
> which are the core of the cpsw and cpsw-new drivers.
>
> - ti-cpsw-ale.o is the one standalone module that is used by all
> except davinci_emac.
>
> Each of these will be built-in if any of its users are built-in,
> otherwise it's a loadable module if there is at least one module
> using it. I did not bring back the separate Kconfig symbols for
> this, but just handle it using Makefile logic.
>
> Note: ideally this is something that Kbuild complains about, but
> usually we just notice when something using THIS_MODULS misbehaves
> in a way that a user notices.
>
> Fixes: 99f6297182729 ("net: ethernet: ti: cpsw: drop TI_DAVINCI_CPDMA config option")
> Signed-off-by: Arnd Bergmann <arnd@...db.de>
> ---
> drivers/net/ethernet/ti/Makefile | 29 +++++++++++-----------
> drivers/net/ethernet/ti/cpsw_ale.c | 23 +++++++++++++++++
> drivers/net/ethernet/ti/cpsw_ethtool.c | 25 +++++++++++++++++++
> drivers/net/ethernet/ti/cpsw_priv.c | 33 +++++++++++++++++++++++++
> drivers/net/ethernet/ti/cpsw_sl.c | 8 ++++++
> drivers/net/ethernet/ti/davinci_cpdma.c | 27 ++++++++++++++++++++
> 6 files changed, 130 insertions(+), 15 deletions(-)
>
> diff --git a/drivers/net/ethernet/ti/Makefile b/drivers/net/ethernet/ti/Makefile
> index 75f761efbea71..d1f44f7667a96 100644
> --- a/drivers/net/ethernet/ti/Makefile
> +++ b/drivers/net/ethernet/ti/Makefile
> @@ -3,28 +3,27 @@
> # Makefile for the TI network device drivers.
> #
>
> -obj-$(CONFIG_TI_CPSW) += cpsw-common.o
> -obj-$(CONFIG_TI_DAVINCI_EMAC) += cpsw-common.o
> -obj-$(CONFIG_TI_CPSW_SWITCHDEV) += cpsw-common.o
> +ti-cpsw-common-y += cpsw-common.o davinci_cpdma.o
> +ti-cpsw-priv-y += cpsw_priv.o cpsw_sl.o cpsw_ethtool.o
> +ti-cpsw-ale-y += cpsw_ale.o
>
> obj-$(CONFIG_TLAN) += tlan.o
> obj-$(CONFIG_CPMAC) += cpmac.o
> -obj-$(CONFIG_TI_DAVINCI_EMAC) += ti_davinci_emac.o
> -ti_davinci_emac-y := davinci_emac.o davinci_cpdma.o
> +obj-$(CONFIG_TI_DAVINCI_EMAC) += davinci_emac.o ti-cpsw-common.o
> obj-$(CONFIG_TI_DAVINCI_MDIO) += davinci_mdio.o
> obj-$(CONFIG_TI_CPSW_PHY_SEL) += cpsw-phy-sel.o
> obj-$(CONFIG_TI_CPTS) += cpts.o
> -obj-$(CONFIG_TI_CPSW) += ti_cpsw.o
> -ti_cpsw-y := cpsw.o davinci_cpdma.o cpsw_ale.o cpsw_priv.o cpsw_sl.o cpsw_ethtool.o
> -obj-$(CONFIG_TI_CPSW_SWITCHDEV) += ti_cpsw_new.o
> -ti_cpsw_new-y := cpsw_switchdev.o cpsw_new.o davinci_cpdma.o cpsw_ale.o cpsw_sl.o cpsw_priv.o cpsw_ethtool.o
> +obj-$(CONFIG_TI_CPSW) += ti_cpsw.o ti-cpsw-common.o ti-cpsw-priv.o ti-cpsw-ale.o
> +ti_cpsw-y := cpsw.o
> +obj-$(CONFIG_TI_CPSW_SWITCHDEV) += ti_cpsw_new.o ti-cpsw-common.o ti-cpsw-priv.o ti-cpsw-ale.o
> +ti_cpsw_new-y := cpsw_switchdev.o cpsw_new.o
>
> -obj-$(CONFIG_TI_KEYSTONE_NETCP) += keystone_netcp.o
> -keystone_netcp-y := netcp_core.o cpsw_ale.o
> -obj-$(CONFIG_TI_KEYSTONE_NETCP_ETHSS) += keystone_netcp_ethss.o
> -keystone_netcp_ethss-y := netcp_ethss.o netcp_sgmii.o netcp_xgbepcsr.o cpsw_ale.o
> +obj-$(CONFIG_TI_KEYSTONE_NETCP) += keystone_netcp.o ti-cpsw-ale.o
> +keystone_netcp-y := netcp_core.o
> +obj-$(CONFIG_TI_KEYSTONE_NETCP_ETHSS) += keystone_netcp_ethss.o ti-cpsw-ale.o
> +keystone_netcp_ethss-y := netcp_ethss.o netcp_sgmii.o netcp_xgbepcsr.o
>
> -obj-$(CONFIG_TI_K3_AM65_CPSW_NUSS) += ti-am65-cpsw-nuss.o
> -ti-am65-cpsw-nuss-y := am65-cpsw-nuss.o cpsw_sl.o am65-cpsw-ethtool.o cpsw_ale.o k3-cppi-desc-pool.o am65-cpsw-qos.o
> +obj-$(CONFIG_TI_K3_AM65_CPSW_NUSS) += ti-am65-cpsw-nuss.o ti-cpsw-priv.o ti-cpsw-ale.o
cpsw_priv.o and cpsw_ethtool.o (included in ti-cpsw-priv.o) are not required by ti-am65-cpsw-nuss.
It only needs cpsw_sl.o
--
cheers,
-roger
Powered by blists - more mailing lists