diff mbox series

[net] net: ethernet: ti: Fix mixed module-builtin object

Message ID 20231013100549.3198564-1-danishanwar@ti.com (mailing list archive)
State Superseded
Delegated to: Netdev Maintainers
Headers show
Series [net] net: ethernet: ti: Fix mixed module-builtin object | expand

Checks

Context Check Description
netdev/series_format success Single patches do not need cover letters
netdev/tree_selection success Clearly marked for net
netdev/fixes_present fail Series targets non-next tree, but doesn't contain any Fixes tags
netdev/header_inline success No static functions without inline keyword in header files
netdev/build_32bit success Errors and warnings before: 9 this patch: 9
netdev/cc_maintainers warning 1 maintainers not CCed: grygorii.strashko@ti.com
netdev/build_clang success Errors and warnings before: 9 this patch: 9
netdev/verify_signedoff success Signed-off-by tag matches author and committer
netdev/deprecated_api success None detected
netdev/check_selftest success No net selftest shell script
netdev/verify_fixes success No Fixes tag
netdev/build_allmodconfig_warn success Errors and warnings before: 9 this patch: 9
netdev/checkpatch success total: 0 errors, 0 warnings, 0 checks, 83 lines checked
netdev/kdoc success Errors and warnings before: 0 this patch: 0
netdev/source_inline success Was 0 now: 0

Commit Message

MD Danish Anwar Oct. 13, 2023, 10:05 a.m. UTC
With CONFIG_TI_K3_AM65_CPSW_NUSS=y and CONFIG_TI_ICSSG_PRUETH=m,
k3-cppi-desc-pool.o is linked to a module and also to vmlinux even though
the expected CFLAGS are different between builtins and modules.

The build system is complaining about the following:

k3-cppi-desc-pool.o is added to multiple modules: icssg-prueth
ti-am65-cpsw-nuss

Introduce the new module, k3-cppi-desc-pool, to provide the common
functions to ti-am65-cpsw-nuss and icssg-prueth.

Signed-off-by: MD Danish Anwar <danishanwar@ti.com>
---
 drivers/net/ethernet/ti/Kconfig             | 5 +++++
 drivers/net/ethernet/ti/Makefile            | 7 ++++---
 drivers/net/ethernet/ti/k3-cppi-desc-pool.c | 7 +++++++
 3 files changed, 16 insertions(+), 3 deletions(-)


base-commit: e8c127b0576660da9195504fe8393fe9da3de9ce

Comments

Arnd Bergmann Oct. 13, 2023, 10:38 a.m. UTC | #1
On Fri, Oct 13, 2023, at 12:05, MD Danish Anwar wrote:
> With CONFIG_TI_K3_AM65_CPSW_NUSS=y and CONFIG_TI_ICSSG_PRUETH=m,
> k3-cppi-desc-pool.o is linked to a module and also to vmlinux even though
> the expected CFLAGS are different between builtins and modules.
>
> The build system is complaining about the following:
>
> k3-cppi-desc-pool.o is added to multiple modules: icssg-prueth
> ti-am65-cpsw-nuss
>
> Introduce the new module, k3-cppi-desc-pool, to provide the common
> functions to ti-am65-cpsw-nuss and icssg-prueth.
>
> Signed-off-by: MD Danish Anwar <danishanwar@ti.com>

I submitted a different patch for this a while ago:
https://lore.kernel.org/lkml/20230612124024.520720-3-arnd@kernel.org/

I think I never sent a v2 of that, but I still have a
working version in my local tree. I've replaced my version
with yours for testing now, to see if you still need something
beyond that.

    Arnd
MD Danish Anwar Oct. 13, 2023, 11:10 a.m. UTC | #2
Hi Arnd,

On 13/10/23 16:08, Arnd Bergmann wrote:
> On Fri, Oct 13, 2023, at 12:05, MD Danish Anwar wrote:
>> With CONFIG_TI_K3_AM65_CPSW_NUSS=y and CONFIG_TI_ICSSG_PRUETH=m,
>> k3-cppi-desc-pool.o is linked to a module and also to vmlinux even though
>> the expected CFLAGS are different between builtins and modules.
>>
>> The build system is complaining about the following:
>>
>> k3-cppi-desc-pool.o is added to multiple modules: icssg-prueth
>> ti-am65-cpsw-nuss
>>
>> Introduce the new module, k3-cppi-desc-pool, to provide the common
>> functions to ti-am65-cpsw-nuss and icssg-prueth.
>>
>> Signed-off-by: MD Danish Anwar <danishanwar@ti.com>
> 
> I submitted a different patch for this a while ago:
> https://lore.kernel.org/lkml/20230612124024.520720-3-arnd@kernel.org/
> 
> I think I never sent a v2 of that, but I still have a
> working version in my local tree. I've replaced my version
> with yours for testing now, to see if you still need something
> beyond that.
> 

I see your patch addresses different modules. My patch introduces a new
module for k3-cppi-desc-pool which is used by both am65-cpsw-nuss and
icssg-prueth driver. Where as your patch addresses modules common across
different cpsw drivers (davinci-emac, cpsw, cpsw-switchdev, netcp,
netcp_ethss and am65-cpsw-nuss). So I think that both these patches are
addressing differet warnings.

>     Arnd
Alexander Lobakin Oct. 13, 2023, 3:27 p.m. UTC | #3
From: Md Danish Anwar <danishanwar@ti.com>
Date: Fri, 13 Oct 2023 15:35:49 +0530

> With CONFIG_TI_K3_AM65_CPSW_NUSS=y and CONFIG_TI_ICSSG_PRUETH=m,
> k3-cppi-desc-pool.o is linked to a module and also to vmlinux even though
> the expected CFLAGS are different between builtins and modules.
> 
> The build system is complaining about the following:
> 
> k3-cppi-desc-pool.o is added to multiple modules: icssg-prueth
> ti-am65-cpsw-nuss

I also fixed a bunch of these in the ethernet/ti/ folder a year ago[0],
you can take a look. I never made it to the upstream branches since I
took a rest from my home Linux projects and never got back to them yet :P

> 
> Introduce the new module, k3-cppi-desc-pool, to provide the common
> functions to ti-am65-cpsw-nuss and icssg-prueth.

[...]

[0] https://lore.kernel.org/all/20221119225650.1044591-19-alobakin@pm.me

Thanks,
Olek
Paolo Abeni Oct. 17, 2023, 11:04 a.m. UTC | #4
On Fri, 2023-10-13 at 15:35 +0530, MD Danish Anwar wrote:
> With CONFIG_TI_K3_AM65_CPSW_NUSS=y and CONFIG_TI_ICSSG_PRUETH=m,
> k3-cppi-desc-pool.o is linked to a module and also to vmlinux even though
> the expected CFLAGS are different between builtins and modules.
> 
> The build system is complaining about the following:
> 
> k3-cppi-desc-pool.o is added to multiple modules: icssg-prueth
> ti-am65-cpsw-nuss
> 
> Introduce the new module, k3-cppi-desc-pool, to provide the common
> functions to ti-am65-cpsw-nuss and icssg-prueth.
> 
> Signed-off-by: MD Danish Anwar <danishanwar@ti.com>

Given that you target the -net tree, please include a suitable fixes
tag, thanks!

Paolo
Arnd Bergmann Oct. 17, 2023, 11:38 a.m. UTC | #5
On Fri, Oct 13, 2023, at 13:10, MD Danish Anwar wrote:
> On 13/10/23 16:08, Arnd Bergmann wrote:
>> On Fri, Oct 13, 2023, at 12:05, MD Danish Anwar wrote:
>>> With CONFIG_TI_K3_AM65_CPSW_NUSS=y and CONFIG_TI_ICSSG_PRUETH=m,
>>> k3-cppi-desc-pool.o is linked to a module and also to vmlinux even though
>>> the expected CFLAGS are different between builtins and modules.
>>>
>>> The build system is complaining about the following:
>>>
>>> k3-cppi-desc-pool.o is added to multiple modules: icssg-prueth
>>> ti-am65-cpsw-nuss
>>>
>>> Introduce the new module, k3-cppi-desc-pool, to provide the common
>>> functions to ti-am65-cpsw-nuss and icssg-prueth.
>>>
>>> Signed-off-by: MD Danish Anwar <danishanwar@ti.com>
>> 
>> I submitted a different patch for this a while ago:
>> https://lore.kernel.org/lkml/20230612124024.520720-3-arnd@kernel.org/
>> 
>> I think I never sent a v2 of that, but I still have a
>> working version in my local tree. I've replaced my version
>> with yours for testing now, to see if you still need something
>> beyond that.
>> 
>
> I see your patch addresses different modules. My patch introduces a new
> module for k3-cppi-desc-pool which is used by both am65-cpsw-nuss and
> icssg-prueth driver. Where as your patch addresses modules common across
> different cpsw drivers (davinci-emac, cpsw, cpsw-switchdev, netcp,
> netcp_ethss and am65-cpsw-nuss). So I think that both these patches are
> addressing differet warnings.

Right, I can resend my patch (or Alexander Lobakin can rebase his version)
after yours makes it in. Note that your patch introduces a warning about
a missing license and description for the new module, so you should
probably include this hunk:

--- a/drivers/net/ethernet/ti/k3-cppi-desc-pool.c
+++ b/drivers/net/ethernet/ti/k3-cppi-desc-pool.c
@@ -131,3 +131,6 @@ size_t k3_cppi_desc_pool_avail(struct k3_cppi_desc_pool *pool)
        return gen_pool_avail(pool->gen_pool) / pool->desc_size;
 }
 EXPORT_SYMBOL_GPL(k3_cppi_desc_pool_avail);
+
+MODULE_LICENSE("GPL");
+MODULE_DESCRIPTION("TI K3 CPPI5 descriptors pool API");
MD Danish Anwar Oct. 18, 2023, 4:28 a.m. UTC | #6
On 17/10/23 4:34 pm, Paolo Abeni wrote:
> On Fri, 2023-10-13 at 15:35 +0530, MD Danish Anwar wrote:
>> With CONFIG_TI_K3_AM65_CPSW_NUSS=y and CONFIG_TI_ICSSG_PRUETH=m,
>> k3-cppi-desc-pool.o is linked to a module and also to vmlinux even though
>> the expected CFLAGS are different between builtins and modules.
>>
>> The build system is complaining about the following:
>>
>> k3-cppi-desc-pool.o is added to multiple modules: icssg-prueth
>> ti-am65-cpsw-nuss
>>
>> Introduce the new module, k3-cppi-desc-pool, to provide the common
>> functions to ti-am65-cpsw-nuss and icssg-prueth.
>>
>> Signed-off-by: MD Danish Anwar <danishanwar@ti.com>
> 
> Given that you target the -net tree, please include a suitable fixes
> tag, thanks!
> 

Sure. I'll add the proper fixes tag in commit message and send next
revision.

> Paolo
>
MD Danish Anwar Oct. 18, 2023, 4:29 a.m. UTC | #7
On 17/10/23 5:08 pm, Arnd Bergmann wrote:
> On Fri, Oct 13, 2023, at 13:10, MD Danish Anwar wrote:
>> On 13/10/23 16:08, Arnd Bergmann wrote:
>>> On Fri, Oct 13, 2023, at 12:05, MD Danish Anwar wrote:
>>>> With CONFIG_TI_K3_AM65_CPSW_NUSS=y and CONFIG_TI_ICSSG_PRUETH=m,
>>>> k3-cppi-desc-pool.o is linked to a module and also to vmlinux even though
>>>> the expected CFLAGS are different between builtins and modules.
>>>>
>>>> The build system is complaining about the following:
>>>>
>>>> k3-cppi-desc-pool.o is added to multiple modules: icssg-prueth
>>>> ti-am65-cpsw-nuss
>>>>
>>>> Introduce the new module, k3-cppi-desc-pool, to provide the common
>>>> functions to ti-am65-cpsw-nuss and icssg-prueth.
>>>>
>>>> Signed-off-by: MD Danish Anwar <danishanwar@ti.com>
>>>
>>> I submitted a different patch for this a while ago:
>>> https://lore.kernel.org/lkml/20230612124024.520720-3-arnd@kernel.org/
>>>
>>> I think I never sent a v2 of that, but I still have a
>>> working version in my local tree. I've replaced my version
>>> with yours for testing now, to see if you still need something
>>> beyond that.
>>>
>>
>> I see your patch addresses different modules. My patch introduces a new
>> module for k3-cppi-desc-pool which is used by both am65-cpsw-nuss and
>> icssg-prueth driver. Where as your patch addresses modules common across
>> different cpsw drivers (davinci-emac, cpsw, cpsw-switchdev, netcp,
>> netcp_ethss and am65-cpsw-nuss). So I think that both these patches are
>> addressing differet warnings.
> 
> Right, I can resend my patch (or Alexander Lobakin can rebase his version)
> after yours makes it in. Note that your patch introduces a warning about
> a missing license and description for the new module, so you should
> probably include this hunk:
> 

Sure Arnd, I'll add this and send v2.

> --- a/drivers/net/ethernet/ti/k3-cppi-desc-pool.c
> +++ b/drivers/net/ethernet/ti/k3-cppi-desc-pool.c
> @@ -131,3 +131,6 @@ size_t k3_cppi_desc_pool_avail(struct k3_cppi_desc_pool *pool)
>         return gen_pool_avail(pool->gen_pool) / pool->desc_size;
>  }
>  EXPORT_SYMBOL_GPL(k3_cppi_desc_pool_avail);
> +
> +MODULE_LICENSE("GPL");
> +MODULE_DESCRIPTION("TI K3 CPPI5 descriptors pool API");
diff mbox series

Patch

diff --git a/drivers/net/ethernet/ti/Kconfig b/drivers/net/ethernet/ti/Kconfig
index 0784a3d0bbff..e60b557d59b9 100644
--- a/drivers/net/ethernet/ti/Kconfig
+++ b/drivers/net/ethernet/ti/Kconfig
@@ -90,12 +90,16 @@  config TI_CPTS
 	  The unit can time stamp PTP UDP/IPv4 and Layer 2 packets, and the
 	  driver offers a PTP Hardware Clock.
 
+config TI_K3_CPPI_DESC_POOL
+	tristate
+
 config TI_K3_AM65_CPSW_NUSS
 	tristate "TI K3 AM654x/J721E CPSW Ethernet driver"
 	depends on ARCH_K3 && OF && TI_K3_UDMA_GLUE_LAYER
 	select NET_DEVLINK
 	select TI_DAVINCI_MDIO
 	select PHYLINK
+	select TI_K3_CPPI_DESC_POOL
 	imply PHY_TI_GMII_SEL
 	depends on TI_K3_AM65_CPTS || !TI_K3_AM65_CPTS
 	help
@@ -180,6 +184,7 @@  config TI_ICSSG_PRUETH
 	tristate "TI Gigabit PRU Ethernet driver"
 	select PHYLIB
 	select TI_ICSS_IEP
+	select TI_K3_CPPI_DESC_POOL
 	depends on PRU_REMOTEPROC
 	depends on ARCH_K3 && OF && TI_K3_UDMA_GLUE_LAYER
 	help
diff --git a/drivers/net/ethernet/ti/Makefile b/drivers/net/ethernet/ti/Makefile
index e38ec9d6c99b..27de1d697134 100644
--- a/drivers/net/ethernet/ti/Makefile
+++ b/drivers/net/ethernet/ti/Makefile
@@ -23,14 +23,15 @@  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_K3_CPPI_DESC_POOL) += k3-cppi-desc-pool.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
+ti-am65-cpsw-nuss-y := am65-cpsw-nuss.o cpsw_sl.o am65-cpsw-ethtool.o cpsw_ale.o am65-cpsw-qos.o
 ti-am65-cpsw-nuss-$(CONFIG_TI_K3_AM65_CPSW_SWITCHDEV) += am65-cpsw-switchdev.o
 obj-$(CONFIG_TI_K3_AM65_CPTS) += am65-cpts.o
 
 obj-$(CONFIG_TI_ICSSG_PRUETH) += icssg-prueth.o
-icssg-prueth-y := k3-cppi-desc-pool.o \
-		  icssg/icssg_prueth.o \
+icssg-prueth-y := icssg/icssg_prueth.o \
 		  icssg/icssg_classifier.o \
 		  icssg/icssg_queues.o \
 		  icssg/icssg_config.o \
diff --git a/drivers/net/ethernet/ti/k3-cppi-desc-pool.c b/drivers/net/ethernet/ti/k3-cppi-desc-pool.c
index 38cc12f9f133..1d9b456edff4 100644
--- a/drivers/net/ethernet/ti/k3-cppi-desc-pool.c
+++ b/drivers/net/ethernet/ti/k3-cppi-desc-pool.c
@@ -39,6 +39,7 @@  void k3_cppi_desc_pool_destroy(struct k3_cppi_desc_pool *pool)
 
 	gen_pool_destroy(pool->gen_pool);	/* frees pool->name */
 }
+EXPORT_SYMBOL_GPL(k3_cppi_desc_pool_destroy);
 
 struct k3_cppi_desc_pool *
 k3_cppi_desc_pool_create_name(struct device *dev, size_t size,
@@ -98,29 +99,35 @@  k3_cppi_desc_pool_create_name(struct device *dev, size_t size,
 	devm_kfree(pool->dev, pool);
 	return ERR_PTR(ret);
 }
+EXPORT_SYMBOL_GPL(k3_cppi_desc_pool_create_name);
 
 dma_addr_t k3_cppi_desc_pool_virt2dma(struct k3_cppi_desc_pool *pool,
 				      void *addr)
 {
 	return addr ? pool->dma_addr + (addr - pool->cpumem) : 0;
 }
+EXPORT_SYMBOL_GPL(k3_cppi_desc_pool_virt2dma);
 
 void *k3_cppi_desc_pool_dma2virt(struct k3_cppi_desc_pool *pool, dma_addr_t dma)
 {
 	return dma ? pool->cpumem + (dma - pool->dma_addr) : NULL;
 }
+EXPORT_SYMBOL_GPL(k3_cppi_desc_pool_dma2virt);
 
 void *k3_cppi_desc_pool_alloc(struct k3_cppi_desc_pool *pool)
 {
 	return (void *)gen_pool_alloc(pool->gen_pool, pool->desc_size);
 }
+EXPORT_SYMBOL_GPL(k3_cppi_desc_pool_alloc);
 
 void k3_cppi_desc_pool_free(struct k3_cppi_desc_pool *pool, void *addr)
 {
 	gen_pool_free(pool->gen_pool, (unsigned long)addr, pool->desc_size);
 }
+EXPORT_SYMBOL_GPL(k3_cppi_desc_pool_free);
 
 size_t k3_cppi_desc_pool_avail(struct k3_cppi_desc_pool *pool)
 {
 	return gen_pool_avail(pool->gen_pool) / pool->desc_size;
 }
+EXPORT_SYMBOL_GPL(k3_cppi_desc_pool_avail);