* [PATCH net] net: enetc: fix the netc-lib driver build dependency
@ 2025-06-03 10:50 Wei Fang
2025-06-03 20:45 ` Vladimir Oltean
0 siblings, 1 reply; 7+ messages in thread
From: Wei Fang @ 2025-06-03 10:50 UTC (permalink / raw)
To: claudiu.manoil, vladimir.oltean, xiaoning.wang, andrew+netdev,
davem, edumazet, kuba, pabeni
Cc: netdev, linux-kernel, imx, arnd
The kernel robot reported the following errors when the netc-lib driver
was compiled as a loadable module and the enetc-core driver was built-in.
ld.lld: error: undefined symbol: ntmp_init_cbdr
referenced by enetc_cbdr.c:88 (drivers/net/ethernet/freescale/enetc/enetc_cbdr.c:88)
ld.lld: error: undefined symbol: ntmp_free_cbdr
referenced by enetc_cbdr.c:96 (drivers/net/ethernet/freescale/enetc/enetc_cbdr.c:96)
Simply changing "tristate" to "bool" can fix this issue, but take into
account that the netc-lib driver needs to support being compiled as a
loadable module. So we can solve this issue and support "tristate" by
setting the default value.
Reported-by: Arnd Bergmann <arnd@kernel.org>
Reported-by: kernel test robot <lkp@intel.com>
Closes: https://lore.kernel.org/oe-kbuild-all/202505220734.x6TF6oHR-lkp@intel.com/
Fixes: 4701073c3deb ("net: enetc: add initial netc-lib driver to support NTMP")
Signed-off-by: Wei Fang <wei.fang@nxp.com>
---
Arnd Bergmann has posted a similar patch [1], but it has not been updated
since the first version, perhaps he is busy with more important things.
In order to fix the issue ASAP, I made this patch. And I added the
Reported-by tag to give credit to Arnd Bergmann.
[1] https://lore.kernel.org/imx/20250520161218.3581272-1-arnd@kernel.org/
---
drivers/net/ethernet/freescale/enetc/Kconfig | 1 +
1 file changed, 1 insertion(+)
diff --git a/drivers/net/ethernet/freescale/enetc/Kconfig b/drivers/net/ethernet/freescale/enetc/Kconfig
index e917132d3714..06759bedb193 100644
--- a/drivers/net/ethernet/freescale/enetc/Kconfig
+++ b/drivers/net/ethernet/freescale/enetc/Kconfig
@@ -17,6 +17,7 @@ config NXP_ENETC_PF_COMMON
config NXP_NETC_LIB
tristate
+ default y if FSL_ENETC_CORE=y && NXP_ENETC4=m
help
This module provides common functionalities for both ENETC and NETC
Switch, such as NETC Table Management Protocol (NTMP) 2.0, common tc
--
2.34.1
^ permalink raw reply related [flat|nested] 7+ messages in thread
* Re: [PATCH net] net: enetc: fix the netc-lib driver build dependency
2025-06-03 10:50 [PATCH net] net: enetc: fix the netc-lib driver build dependency Wei Fang
@ 2025-06-03 20:45 ` Vladimir Oltean
2025-06-04 2:44 ` Wei Fang
0 siblings, 1 reply; 7+ messages in thread
From: Vladimir Oltean @ 2025-06-03 20:45 UTC (permalink / raw)
To: Wei Fang
Cc: claudiu.manoil, xiaoning.wang, andrew+netdev, davem, edumazet,
kuba, pabeni, netdev, linux-kernel, imx, arnd
On Tue, Jun 03, 2025 at 06:50:56PM +0800, Wei Fang wrote:
> The kernel robot reported the following errors when the netc-lib driver
> was compiled as a loadable module and the enetc-core driver was built-in.
>
> ld.lld: error: undefined symbol: ntmp_init_cbdr
> referenced by enetc_cbdr.c:88 (drivers/net/ethernet/freescale/enetc/enetc_cbdr.c:88)
> ld.lld: error: undefined symbol: ntmp_free_cbdr
> referenced by enetc_cbdr.c:96 (drivers/net/ethernet/freescale/enetc/enetc_cbdr.c:96)
>
> Simply changing "tristate" to "bool" can fix this issue, but take into
> account that the netc-lib driver needs to support being compiled as a
> loadable module. So we can solve this issue and support "tristate" by
> setting the default value.
>
> Reported-by: Arnd Bergmann <arnd@kernel.org>
> Reported-by: kernel test robot <lkp@intel.com>
> Closes: https://lore.kernel.org/oe-kbuild-all/202505220734.x6TF6oHR-lkp@intel.com/
> Fixes: 4701073c3deb ("net: enetc: add initial netc-lib driver to support NTMP")
> Signed-off-by: Wei Fang <wei.fang@nxp.com>
> ---
> Arnd Bergmann has posted a similar patch [1], but it has not been updated
> since the first version, perhaps he is busy with more important things.
> In order to fix the issue ASAP, I made this patch. And I added the
> Reported-by tag to give credit to Arnd Bergmann.
> [1] https://lore.kernel.org/imx/20250520161218.3581272-1-arnd@kernel.org/
> ---
Ok, so to summarize, you want nxp-netc-lib.ko to be separate from
fsl-enetc-core.ko, because when you upstream the switch driver (also a
consumer of ntmp.o), you want it to depend just on nxp-netc-lib.ko but
not on the full fsl-enetc-core.ko.
Does it practically matter, given the fact that the yet-to-be-upstreamed
switch is DSA, and needs the conduit interface driver to load anyway?
> drivers/net/ethernet/freescale/enetc/Kconfig | 1 +
> 1 file changed, 1 insertion(+)
>
> diff --git a/drivers/net/ethernet/freescale/enetc/Kconfig b/drivers/net/ethernet/freescale/enetc/Kconfig
> index e917132d3714..06759bedb193 100644
> --- a/drivers/net/ethernet/freescale/enetc/Kconfig
> +++ b/drivers/net/ethernet/freescale/enetc/Kconfig
> @@ -17,6 +17,7 @@ config NXP_ENETC_PF_COMMON
>
> config NXP_NETC_LIB
> tristate
> + default y if FSL_ENETC_CORE=y && NXP_ENETC4=m
So your logic here is: NXP_NETC_LIB has only one select/reverse dependency (NXP_ENETC4)
and FSL_ENETC_CORE has 3 (FSL_ENETC, NXP_ENETC4, FSL_ENETC_VF).
If the only reverse dependency of NXP_NETC_LIB, NXP_ENETC4, becomes m,
then NXP_NETC_LIB also becomes m, but in reality, FSL_ENETC_CORE, via
cbdr.o, still depends on symbols from NXP_NETC_LIB.
So you influence NXP_NETC_LIB to not become m when its only selecter is m,
instead stay y.
Won't this need to change, and become even more complicated when
NXP_NETC_LIB gains another selecter, the switch driver?
> help
> This module provides common functionalities for both ENETC and NETC
> Switch, such as NETC Table Management Protocol (NTMP) 2.0, common tc
> --
> 2.34.1
>
What about this interpretation? cbdr.o uses symbols from NXP_NETC_LIB,
so the Kconfig option controlling cbdr.o, aka FSL_ENETC_CORE, should
select NXP_NETC_LIB. This solves the problem in a way which is more
logical to me, and doesn't need to change when the switch is later added.
Then you can drop "select NXP_NETC_LIB" from NXP_ENETC4, because the
dependency will transfer transitively via FSL_ENETC_CORE.
diff --git a/drivers/net/ethernet/freescale/enetc/Kconfig b/drivers/net/ethernet/freescale/enetc/Kconfig
index 616ea22ceabc..ef31eea0fc50 100644
--- a/drivers/net/ethernet/freescale/enetc/Kconfig
+++ b/drivers/net/ethernet/freescale/enetc/Kconfig
@@ -1,6 +1,7 @@
# SPDX-License-Identifier: GPL-2.0
config FSL_ENETC_CORE
tristate
+ select NXP_NETC_LIB
help
This module supports common functionality between the PF and VF
drivers for the NXP ENETC controller.
@@ -47,7 +48,6 @@ config NXP_ENETC4
select FSL_ENETC_CORE
select FSL_ENETC_MDIO
select NXP_ENETC_PF_COMMON
- select NXP_NETC_LIB
select PHYLINK
select DIMLIB
help
^ permalink raw reply related [flat|nested] 7+ messages in thread
* RE: [PATCH net] net: enetc: fix the netc-lib driver build dependency
2025-06-03 20:45 ` Vladimir Oltean
@ 2025-06-04 2:44 ` Wei Fang
2025-06-04 7:24 ` Arnd Bergmann
0 siblings, 1 reply; 7+ messages in thread
From: Wei Fang @ 2025-06-04 2:44 UTC (permalink / raw)
To: Vladimir Oltean
Cc: Claudiu Manoil, Clark Wang, andrew+netdev@lunn.ch,
davem@davemloft.net, edumazet@google.com, kuba@kernel.org,
pabeni@redhat.com, netdev@vger.kernel.org,
linux-kernel@vger.kernel.org, imx@lists.linux.dev,
arnd@kernel.org
> Ok, so to summarize, you want nxp-netc-lib.ko to be separate from
> fsl-enetc-core.ko, because when you upstream the switch driver (also a
> consumer of ntmp.o), you want it to depend just on nxp-netc-lib.ko but
> not on the full fsl-enetc-core.ko.
> If the only reverse dependency of NXP_NETC_LIB, NXP_ENETC4, becomes m,
> then NXP_NETC_LIB also becomes m, but in reality, FSL_ENETC_CORE, via
> cbdr.o, still depends on symbols from NXP_NETC_LIB.
>
> So you influence NXP_NETC_LIB to not become m when its only selecter is m,
> instead stay y.
>
> Won't this need to change, and become even more complicated when
> NXP_NETC_LIB gains another selecter, the switch driver?
The dependency needs to be updated as follows when switch driver is
added, to avoid the compilation errors.
default y if FSL_ENETC_CORE=y && (NXP_ENETC4=m || NET_DSA_NETC_SWITCH=m)
>
> > help
> > This module provides common functionalities for both ENETC and NETC
> > Switch, such as NETC Table Management Protocol (NTMP) 2.0, common tc
> > --
> > 2.34.1
> >
>
> What about this interpretation? cbdr.o uses symbols from NXP_NETC_LIB,
> so the Kconfig option controlling cbdr.o, aka FSL_ENETC_CORE, should
> select NXP_NETC_LIB. This solves the problem in a way which is more
> logical to me, and doesn't need to change when the switch is later added.
>
Yes, this is also a solution. I thought that LS1028A does not need the netc-lib
driver at all. Doing so will result in netc-lib being compiled on the LS1028A
platform, which may be unacceptable, so I did not do this. Since you think
this is better, I will apply this solution next. Thanks.
> Then you can drop "select NXP_NETC_LIB" from NXP_ENETC4, because the
> dependency will transfer transitively via FSL_ENETC_CORE.
>
> diff --git a/drivers/net/ethernet/freescale/enetc/Kconfig
> b/drivers/net/ethernet/freescale/enetc/Kconfig
> index 616ea22ceabc..ef31eea0fc50 100644
> --- a/drivers/net/ethernet/freescale/enetc/Kconfig
> +++ b/drivers/net/ethernet/freescale/enetc/Kconfig
> @@ -1,6 +1,7 @@
> # SPDX-License-Identifier: GPL-2.0
> config FSL_ENETC_CORE
> tristate
> + select NXP_NETC_LIB
> help
> This module supports common functionality between the PF and VF
> drivers for the NXP ENETC controller.
> @@ -47,7 +48,6 @@ config NXP_ENETC4
> select FSL_ENETC_CORE
> select FSL_ENETC_MDIO
> select NXP_ENETC_PF_COMMON
> - select NXP_NETC_LIB
> select PHYLINK
> select DIMLIB
> help
^ permalink raw reply [flat|nested] 7+ messages in thread
* Re: [PATCH net] net: enetc: fix the netc-lib driver build dependency
2025-06-04 2:44 ` Wei Fang
@ 2025-06-04 7:24 ` Arnd Bergmann
2025-06-04 9:11 ` Vladimir Oltean
0 siblings, 1 reply; 7+ messages in thread
From: Arnd Bergmann @ 2025-06-04 7:24 UTC (permalink / raw)
To: Wei Fang, Vladimir Oltean
Cc: Claudiu Manoil, Clark Wang, andrew+netdev@lunn.ch,
David S . Miller, Eric Dumazet, Jakub Kicinski, Paolo Abeni,
Netdev, linux-kernel@vger.kernel.org, imx@lists.linux.dev
On Wed, Jun 4, 2025, at 04:44, Wei Fang wrote:
>> Ok, so to summarize, you want nxp-netc-lib.ko to be separate from
>> fsl-enetc-core.ko, because when you upstream the switch driver (also a
>> consumer of ntmp.o), you want it to depend just on nxp-netc-lib.ko but
>> not on the full fsl-enetc-core.ko.
>> If the only reverse dependency of NXP_NETC_LIB, NXP_ENETC4, becomes m,
>> then NXP_NETC_LIB also becomes m, but in reality, FSL_ENETC_CORE, via
>> cbdr.o, still depends on symbols from NXP_NETC_LIB.
>>
>> So you influence NXP_NETC_LIB to not become m when its only selecter is m,
>> instead stay y.
>>
>> Won't this need to change, and become even more complicated when
>> NXP_NETC_LIB gains another selecter, the switch driver?
>
> The dependency needs to be updated as follows when switch driver is
> added, to avoid the compilation errors.
>
> default y if FSL_ENETC_CORE=y && (NXP_ENETC4=m || NET_DSA_NETC_SWITCH=m)
>
>>
>> > help
>> > This module provides common functionalities for both ENETC and NETC
>> > Switch, such as NETC Table Management Protocol (NTMP) 2.0, common tc
>> > --
>> > 2.34.1
>> >
>>
>> What about this interpretation? cbdr.o uses symbols from NXP_NETC_LIB,
>> so the Kconfig option controlling cbdr.o, aka FSL_ENETC_CORE, should
>> select NXP_NETC_LIB. This solves the problem in a way which is more
>> logical to me, and doesn't need to change when the switch is later added.
>>
>
> Yes, this is also a solution. I thought that LS1028A does not need the netc-lib
> driver at all. Doing so will result in netc-lib being compiled on the LS1028A
> platform, which may be unacceptable, so I did not do this. Since you think
> this is better, I will apply this solution next. Thanks.
I think this version should work, and make logical sense:
--- a/drivers/net/ethernet/freescale/enetc/Kconfig
+++ b/drivers/net/ethernet/freescale/enetc/Kconfig
@@ -1,6 +1,7 @@
# SPDX-License-Identifier: GPL-2.0
config FSL_ENETC_CORE
tristate
+ select NXP_NETC_LIB if NXP_ENETC_NTMP
help
This module supports common functionality between the PF and VF
drivers for the NXP ENETC controller.
@@ -22,6 +23,9 @@ config NXP_NETC_LIB
Switch, such as NETC Table Management Protocol (NTMP) 2.0, common tc
flower and debugfs interfaces and so on.
+config NXP_ENETC_NTMP
+ bool
+
config FSL_ENETC
tristate "ENETC PF driver"
depends on PCI_MSI
@@ -45,7 +49,7 @@ config NXP_ENETC4
select FSL_ENETC_CORE
select FSL_ENETC_MDIO
select NXP_ENETC_PF_COMMON
- select NXP_NETC_LIB
+ select NXP_ENETC_NTMP
select PHYLINK
select DIMLIB
help
FSL_ENETC selects the feature it actually wants, and FSL_ENETC_CORE
enables the module based on the set of features that are enabled.
The switch module can then equally enable bool symbol. Not sure
what the best name would be for that symbol, that depends on what
you expect to get added to NXP_NETC_LIB.
Arnd
^ permalink raw reply [flat|nested] 7+ messages in thread
* Re: [PATCH net] net: enetc: fix the netc-lib driver build dependency
2025-06-04 7:24 ` Arnd Bergmann
@ 2025-06-04 9:11 ` Vladimir Oltean
2025-06-04 9:30 ` Arnd Bergmann
0 siblings, 1 reply; 7+ messages in thread
From: Vladimir Oltean @ 2025-06-04 9:11 UTC (permalink / raw)
To: Arnd Bergmann
Cc: Wei Fang, Claudiu Manoil, Clark Wang, andrew+netdev@lunn.ch,
David S . Miller, Eric Dumazet, Jakub Kicinski, Paolo Abeni,
Netdev, linux-kernel@vger.kernel.org, imx@lists.linux.dev
On Wed, Jun 04, 2025 at 09:24:22AM +0200, Arnd Bergmann wrote:
> On Wed, Jun 4, 2025, at 04:44, Wei Fang wrote:
> >> Ok, so to summarize, you want nxp-netc-lib.ko to be separate from
> >> fsl-enetc-core.ko, because when you upstream the switch driver (also a
> >> consumer of ntmp.o), you want it to depend just on nxp-netc-lib.ko but
> >> not on the full fsl-enetc-core.ko.
> >> If the only reverse dependency of NXP_NETC_LIB, NXP_ENETC4, becomes m,
> >> then NXP_NETC_LIB also becomes m, but in reality, FSL_ENETC_CORE, via
> >> cbdr.o, still depends on symbols from NXP_NETC_LIB.
> >>
> >> So you influence NXP_NETC_LIB to not become m when its only selecter is m,
> >> instead stay y.
> >>
> >> Won't this need to change, and become even more complicated when
> >> NXP_NETC_LIB gains another selecter, the switch driver?
> >
> > The dependency needs to be updated as follows when switch driver is
> > added, to avoid the compilation errors.
> >
> > default y if FSL_ENETC_CORE=y && (NXP_ENETC4=m || NET_DSA_NETC_SWITCH=m)
> >
> >>
> >> > help
> >> > This module provides common functionalities for both ENETC and NETC
> >> > Switch, such as NETC Table Management Protocol (NTMP) 2.0, common tc
> >> > --
> >> > 2.34.1
> >> >
> >>
> >> What about this interpretation? cbdr.o uses symbols from NXP_NETC_LIB,
> >> so the Kconfig option controlling cbdr.o, aka FSL_ENETC_CORE, should
> >> select NXP_NETC_LIB. This solves the problem in a way which is more
> >> logical to me, and doesn't need to change when the switch is later added.
> >>
> >
> > Yes, this is also a solution. I thought that LS1028A does not need the netc-lib
> > driver at all. Doing so will result in netc-lib being compiled on the LS1028A
> > platform, which may be unacceptable, so I did not do this. Since you think
> > this is better, I will apply this solution next. Thanks.
>
> I think this version should work, and make logical sense:
>
> --- a/drivers/net/ethernet/freescale/enetc/Kconfig
> +++ b/drivers/net/ethernet/freescale/enetc/Kconfig
> @@ -1,6 +1,7 @@
> # SPDX-License-Identifier: GPL-2.0
> config FSL_ENETC_CORE
> tristate
> + select NXP_NETC_LIB if NXP_ENETC_NTMP
> help
> This module supports common functionality between the PF and VF
> drivers for the NXP ENETC controller.
> @@ -22,6 +23,9 @@ config NXP_NETC_LIB
> Switch, such as NETC Table Management Protocol (NTMP) 2.0, common tc
> flower and debugfs interfaces and so on.
>
> +config NXP_ENETC_NTMP
> + bool
> +
> config FSL_ENETC
> tristate "ENETC PF driver"
> depends on PCI_MSI
> @@ -45,7 +49,7 @@ config NXP_ENETC4
> select FSL_ENETC_CORE
> select FSL_ENETC_MDIO
> select NXP_ENETC_PF_COMMON
> - select NXP_NETC_LIB
> + select NXP_ENETC_NTMP
> select PHYLINK
> select DIMLIB
> help
>
> FSL_ENETC selects the feature it actually wants, and FSL_ENETC_CORE
> enables the module based on the set of features that are enabled.
> The switch module can then equally enable bool symbol. Not sure
> what the best name would be for that symbol, that depends on what
> you expect to get added to NXP_NETC_LIB.
>
> Arnd
Thanks, this seems to be the best proposal thus far. IMO it is also easy
to maintain and it also fully satisfies the imposed requirements. I checked
that when FSL_ENETC_CORE goes to m, NXP_NETC_LIB also goes to m, and
when it remains y, the latter also remains y. Note, FSL_ENETC_CORE only
goes to m when all its selecters are m. More importantly, when
NXP_ENETC4=n, NXP_NETC_LIB is also n. The drivers seem to build in all
cases.
Will you send a patch with this proposal, or should Wei do it with a
Suggested-by?
^ permalink raw reply [flat|nested] 7+ messages in thread
* Re: [PATCH net] net: enetc: fix the netc-lib driver build dependency
2025-06-04 9:11 ` Vladimir Oltean
@ 2025-06-04 9:30 ` Arnd Bergmann
2025-06-04 11:32 ` Wei Fang
0 siblings, 1 reply; 7+ messages in thread
From: Arnd Bergmann @ 2025-06-04 9:30 UTC (permalink / raw)
To: Vladimir Oltean
Cc: Wei Fang, Claudiu Manoil, Clark Wang, andrew+netdev@lunn.ch,
David S . Miller, Eric Dumazet, Jakub Kicinski, Paolo Abeni,
Netdev, linux-kernel@vger.kernel.org, imx@lists.linux.dev
On Wed, Jun 4, 2025, at 11:11, Vladimir Oltean wrote:
> On Wed, Jun 04, 2025 at 09:24:22AM +0200, Arnd Bergmann wrote:
>> On Wed, Jun 4, 2025, at 04:44, Wei Fang wrote:
> Thanks, this seems to be the best proposal thus far. IMO it is also easy
> to maintain and it also fully satisfies the imposed requirements. I checked
> that when FSL_ENETC_CORE goes to m, NXP_NETC_LIB also goes to m, and
> when it remains y, the latter also remains y. Note, FSL_ENETC_CORE only
> goes to m when all its selecters are m. More importantly, when
> NXP_ENETC4=n, NXP_NETC_LIB is also n. The drivers seem to build in all
> cases.
>
> Will you send a patch with this proposal, or should Wei do it with a
> Suggested-by?
I'd prefer Wei to send it as a tested patch with my Suggested-by.
I've also tested this version overnight on my randconfig build
system.
Arnd
^ permalink raw reply [flat|nested] 7+ messages in thread
* RE: [PATCH net] net: enetc: fix the netc-lib driver build dependency
2025-06-04 9:30 ` Arnd Bergmann
@ 2025-06-04 11:32 ` Wei Fang
0 siblings, 0 replies; 7+ messages in thread
From: Wei Fang @ 2025-06-04 11:32 UTC (permalink / raw)
To: Arnd Bergmann, Vladimir Oltean
Cc: Claudiu Manoil, Clark Wang, andrew+netdev@lunn.ch,
David S . Miller, Eric Dumazet, Jakub Kicinski, Paolo Abeni,
Netdev, linux-kernel@vger.kernel.org, imx@lists.linux.dev
> > Thanks, this seems to be the best proposal thus far. IMO it is also
> > easy to maintain and it also fully satisfies the imposed requirements.
> > I checked that when FSL_ENETC_CORE goes to m, NXP_NETC_LIB also goes
> > to m, and when it remains y, the latter also remains y. Note,
> > FSL_ENETC_CORE only goes to m when all its selecters are m. More
> > importantly, when NXP_ENETC4=n, NXP_NETC_LIB is also n. The drivers
> > seem to build in all cases.
> >
> > Will you send a patch with this proposal, or should Wei do it with a
> > Suggested-by?
>
> I'd prefer Wei to send it as a tested patch with my Suggested-by.
> I've also tested this version overnight on my randconfig build system.
>
Thanks, I will improve the solution.
^ permalink raw reply [flat|nested] 7+ messages in thread
end of thread, other threads:[~2025-06-04 11:33 UTC | newest]
Thread overview: 7+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2025-06-03 10:50 [PATCH net] net: enetc: fix the netc-lib driver build dependency Wei Fang
2025-06-03 20:45 ` Vladimir Oltean
2025-06-04 2:44 ` Wei Fang
2025-06-04 7:24 ` Arnd Bergmann
2025-06-04 9:11 ` Vladimir Oltean
2025-06-04 9:30 ` Arnd Bergmann
2025-06-04 11:32 ` Wei Fang
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).