mirror of https://lore.kernel.org/lkml/
 help / color / mirror / Atom feed
From: "Arnd Bergmann" <arnd@kernel.org>
To: "Wei Fang" <wei.fang@nxp.com>,
	"Vladimir Oltean" <vladimir.oltean@nxp.com>
Cc: "Claudiu Manoil" <claudiu.manoil@nxp.com>,
	"Clark Wang" <xiaoning.wang@nxp.com>,
	"andrew+netdev@lunn.ch" <andrew+netdev@lunn.ch>,
	"David S . Miller" <davem@davemloft.net>,
	"Eric Dumazet" <edumazet@google.com>,
	"Jakub Kicinski" <kuba@kernel.org>,
	"Paolo Abeni" <pabeni@redhat.com>,
	Netdev <netdev@vger.kernel.org>,
	"linux-kernel@vger.kernel.org" <linux-kernel@vger.kernel.org>,
	"imx@lists.linux.dev" <imx@lists.linux.dev>
Subject: Re: [PATCH net] net: enetc: fix the netc-lib driver build dependency
Date: Wed, 04 Jun 2025 09:24:22 +0200	[thread overview]
Message-ID: <b2068b86-dcbb-4fee-b091-4910e975a9b9@app.fastmail.com> (raw)
In-Reply-To: <PAXPR04MB85104C607BF23FFFD6663ABB886CA@PAXPR04MB8510.eurprd04.prod.outlook.com>

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

  reply	other threads:[~2025-06-04  7:24 UTC|newest]

Thread overview: 7+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2025-06-03 10:50 Wei Fang
2025-06-03 20:45 ` Vladimir Oltean
2025-06-04  2:44   ` Wei Fang
2025-06-04  7:24     ` Arnd Bergmann [this message]
2025-06-04  9:11       ` Vladimir Oltean
2025-06-04  9:30         ` Arnd Bergmann
2025-06-04 11:32           ` Wei Fang

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=b2068b86-dcbb-4fee-b091-4910e975a9b9@app.fastmail.com \
    --to=arnd@kernel.org \
    --cc=andrew+netdev@lunn.ch \
    --cc=claudiu.manoil@nxp.com \
    --cc=davem@davemloft.net \
    --cc=edumazet@google.com \
    --cc=imx@lists.linux.dev \
    --cc=kuba@kernel.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=netdev@vger.kernel.org \
    --cc=pabeni@redhat.com \
    --cc=vladimir.oltean@nxp.com \
    --cc=wei.fang@nxp.com \
    --cc=xiaoning.wang@nxp.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®