diff mbox series

ethernet: octeontx2: avoid linking objects into multiple modules

Message ID 20240528152527.2148092-1-arnd@kernel.org (mailing list archive)
State Accepted
Commit 727c94c9539aa8865cdbf6a783da6a6585f1fec2
Delegated to: Netdev Maintainers
Headers show
Series ethernet: octeontx2: avoid linking objects into multiple modules | expand

Checks

Context Check Description
netdev/series_format warning Single patches do not need cover letters; Target tree name not specified in the subject
netdev/tree_selection success Guessed tree name to be net-next
netdev/ynl success Generated files up to date; no warnings/errors; no diff in generated;
netdev/fixes_present success Fixes tag not required for -next series
netdev/header_inline success No static functions without inline keyword in header files
netdev/build_32bit success Errors and warnings before: 8 this patch: 8
netdev/build_tools success No tools touched, skip
netdev/cc_maintainers success CCed 9 of 9 maintainers
netdev/build_clang success Errors and warnings before: 906 this patch: 906
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: 906 this patch: 906
netdev/checkpatch success total: 0 errors, 0 warnings, 0 checks, 89 lines checked
netdev/build_clang_rust success No Rust files in patch. Skipping build
netdev/kdoc success Errors and warnings before: 0 this patch: 0
netdev/source_inline success Was 0 now: 0
netdev/contest success net-next-2024-05-30--06-00 (tests: 1042)

Commit Message

Arnd Bergmann May 28, 2024, 3:25 p.m. UTC
From: Arnd Bergmann <arnd@arndb.de>

Each object file contains information about which module it gets linked
into, so linking the same file into multiple modules now causes a warning:

scripts/Makefile.build:254: drivers/net/ethernet/marvell/octeontx2/nic/Makefile: otx2_devlink.o is added to multiple modules: rvu_nicpf rvu_nicvf

Change the way that octeontx2 ethernet is built by moving the common
file into a separate module with exported symbols instead.

Signed-off-by: Arnd Bergmann <arnd@arndb.de>
---
 .../net/ethernet/marvell/octeontx2/nic/Makefile    | 14 ++++++++------
 .../ethernet/marvell/octeontx2/nic/otx2_dcbnl.c    | 11 +++++++++++
 .../ethernet/marvell/octeontx2/nic/otx2_devlink.c  |  6 ++++++
 3 files changed, 25 insertions(+), 6 deletions(-)

Comments

Jacob Keller May 30, 2024, 5:54 p.m. UTC | #1
On 5/28/2024 8:25 AM, Arnd Bergmann wrote:
> From: Arnd Bergmann <arnd@arndb.de>
> 
> Each object file contains information about which module it gets linked
> into, so linking the same file into multiple modules now causes a warning:
> 
> scripts/Makefile.build:254: drivers/net/ethernet/marvell/octeontx2/nic/Makefile: otx2_devlink.o is added to multiple modules: rvu_nicpf rvu_nicvf
> 

When I tried to build, I don't see any warnings produced on the current
net-next with W=1. Is this something new and not yet in net-next tree?
If not, how do I enable this warning in my local build?

> Change the way that octeontx2 ethernet is built by moving the common
> file into a separate module with exported symbols instead.
> 
> Signed-off-by: Arnd Bergmann <arnd@arndb.de>
> ---

The change makes sense to me. I built and tested both before and after
this change.

On my system, before the build change, the driver built to 3 separate
modules totaling 2029176 bytes:

> -rw-r--r--. 1 jekeller jekeller   72104 May 30 10:46 otx2_ptp.ko
> -rw-r--r--. 1 jekeller jekeller 1774008 May 30 10:46 rvu_nicpf.ko
> -rw-r--r--. 1 jekeller jekeller  183064 May 30 10:46 rvu_nicvf.ko
After this change, the driver builds to 5 separate modules totaling
1977984 bytes:

> -rw-r--r--. 1 jekeller jekeller   81480 May 30 10:46 otx2_dcbnl.ko
> -rw-r--r--. 1 jekeller jekeller   19784 May 30 10:46 otx2_devlink.ko
> -rw-r--r--. 1 jekeller jekeller   72104 May 30 10:46 otx2_ptp.ko
> -rw-r--r--. 1 jekeller jekeller 1698880 May 30 10:46 rvu_nicpf.ko
> -rw-r--r--. 1 jekeller jekeller  105736 May 30 10:46 rvu_nicvf.ko

This is a savings of 51192 bytes from removing the duplicated object code.

Reviewed-by: Jacob Keller <jacob.e.keller@intel.com>
Arnd Bergmann May 30, 2024, 6:52 p.m. UTC | #2
On Thu, May 30, 2024, at 19:54, Jacob Keller wrote:
> On 5/28/2024 8:25 AM, Arnd Bergmann wrote:
>> From: Arnd Bergmann <arnd@arndb.de>
>> 
>> Each object file contains information about which module it gets linked
>> into, so linking the same file into multiple modules now causes a warning:
>> 
>> scripts/Makefile.build:254: drivers/net/ethernet/marvell/octeontx2/nic/Makefile: otx2_devlink.o is added to multiple modules: rvu_nicpf rvu_nicvf
>> 
>
> When I tried to build, I don't see any warnings produced on the current
> net-next with W=1. Is this something new and not yet in net-next tree?
> If not, how do I enable this warning in my local build?

The warning has been around with W=1 for over a year now, it still
shows up here:

make ARCH=arm64 allmodconfig drivers/net/ethernet/marvell/octeontx2/ -skj20
scripts/Makefile.build:236: drivers/net/ethernet/marvell/octeontx2/nic/Makefile: otx2_devlink.o is added to multiple modules: rvu_nicpf rvu_nicvf
scripts/Makefile.build:236: drivers/net/ethernet/marvell/octeontx2/nic/Makefile: otx2_dcbnl.o is added to multiple modules: rvu_nicpf rvu_nicvf


    Arnd
Jacob Keller May 30, 2024, 8:30 p.m. UTC | #3
On 5/30/2024 11:52 AM, Arnd Bergmann wrote:
> On Thu, May 30, 2024, at 19:54, Jacob Keller wrote:
>> On 5/28/2024 8:25 AM, Arnd Bergmann wrote:
>>> From: Arnd Bergmann <arnd@arndb.de>
>>>
>>> Each object file contains information about which module it gets linked
>>> into, so linking the same file into multiple modules now causes a warning:
>>>
>>> scripts/Makefile.build:254: drivers/net/ethernet/marvell/octeontx2/nic/Makefile: otx2_devlink.o is added to multiple modules: rvu_nicpf rvu_nicvf
>>>
>>
>> When I tried to build, I don't see any warnings produced on the current
>> net-next with W=1. Is this something new and not yet in net-next tree?
>> If not, how do I enable this warning in my local build?
> 
> The warning has been around with W=1 for over a year now, it still
> shows up here:
> 
> make ARCH=arm64 allmodconfig drivers/net/ethernet/marvell/octeontx2/ -skj20
> scripts/Makefile.build:236: drivers/net/ethernet/marvell/octeontx2/nic/Makefile: otx2_devlink.o is added to multiple modules: rvu_nicpf rvu_nicvf
> scripts/Makefile.build:236: drivers/net/ethernet/marvell/octeontx2/nic/Makefile: otx2_dcbnl.o is added to multiple modules: rvu_nicpf rvu_nicvf
> 
> 
>     Arnd

Hmm. Ah yep, I must have missed W=1. I thought I had it enabled. Doing a
clean rebuild with it, I do see the warnings.

Thanks,
Jake
patchwork-bot+netdevbpf@kernel.org May 31, 2024, 1:10 a.m. UTC | #4
Hello:

This patch was applied to netdev/net-next.git (main)
by Jakub Kicinski <kuba@kernel.org>:

On Tue, 28 May 2024 17:25:05 +0200 you wrote:
> From: Arnd Bergmann <arnd@arndb.de>
> 
> Each object file contains information about which module it gets linked
> into, so linking the same file into multiple modules now causes a warning:
> 
> scripts/Makefile.build:254: drivers/net/ethernet/marvell/octeontx2/nic/Makefile: otx2_devlink.o is added to multiple modules: rvu_nicpf rvu_nicvf
> 
> [...]

Here is the summary with links:
  - ethernet: octeontx2: avoid linking objects into multiple modules
    https://git.kernel.org/netdev/net-next/c/727c94c9539a

You are awesome, thank you!
diff mbox series

Patch

diff --git a/drivers/net/ethernet/marvell/octeontx2/nic/Makefile b/drivers/net/ethernet/marvell/octeontx2/nic/Makefile
index 5664f768cb0c..e4c5dc46dd42 100644
--- a/drivers/net/ethernet/marvell/octeontx2/nic/Makefile
+++ b/drivers/net/ethernet/marvell/octeontx2/nic/Makefile
@@ -3,16 +3,18 @@ 
 # Makefile for Marvell's RVU Ethernet device drivers
 #
 
-obj-$(CONFIG_OCTEONTX2_PF) += rvu_nicpf.o otx2_ptp.o
-obj-$(CONFIG_OCTEONTX2_VF) += rvu_nicvf.o otx2_ptp.o
+obj-$(CONFIG_OCTEONTX2_PF) += rvu_nicpf.o otx2_ptp.o otx2_devlink.o
+obj-$(CONFIG_OCTEONTX2_VF) += rvu_nicvf.o otx2_ptp.o otx2_devlink.o
 
 rvu_nicpf-y := otx2_pf.o otx2_common.o otx2_txrx.o otx2_ethtool.o \
                otx2_flows.o otx2_tc.o cn10k.o otx2_dmac_flt.o \
-               otx2_devlink.o qos_sq.o qos.o
-rvu_nicvf-y := otx2_vf.o otx2_devlink.o
+               qos_sq.o qos.o
+rvu_nicvf-y := otx2_vf.o
 
-rvu_nicpf-$(CONFIG_DCB) += otx2_dcbnl.o
-rvu_nicvf-$(CONFIG_DCB) += otx2_dcbnl.o
+ifdef CONFIG_DCB
+obj-$(CONFIG_OCTEONTX2_PF) += otx2_dcbnl.o
+obj-$(CONFIG_OCTEONTX2_VF) += otx2_dcbnl.o
+endif
 rvu_nicpf-$(CONFIG_MACSEC) += cn10k_macsec.o
 
 ccflags-y += -I$(srctree)/drivers/net/ethernet/marvell/octeontx2/af
diff --git a/drivers/net/ethernet/marvell/octeontx2/nic/otx2_dcbnl.c b/drivers/net/ethernet/marvell/octeontx2/nic/otx2_dcbnl.c
index 28fb643d2917..0d7e611d9a05 100644
--- a/drivers/net/ethernet/marvell/octeontx2/nic/otx2_dcbnl.c
+++ b/drivers/net/ethernet/marvell/octeontx2/nic/otx2_dcbnl.c
@@ -54,6 +54,7 @@  int otx2_pfc_txschq_config(struct otx2_nic *pfvf)
 
 	return 0;
 }
+EXPORT_SYMBOL_GPL(otx2_pfc_txschq_config);
 
 static int otx2_pfc_txschq_alloc_one(struct otx2_nic *pfvf, u8 prio)
 {
@@ -122,6 +123,7 @@  int otx2_pfc_txschq_alloc(struct otx2_nic *pfvf)
 
 	return 0;
 }
+EXPORT_SYMBOL_GPL(otx2_pfc_txschq_alloc);
 
 static int otx2_pfc_txschq_stop_one(struct otx2_nic *pfvf, u8 prio)
 {
@@ -260,6 +262,7 @@  int otx2_pfc_txschq_update(struct otx2_nic *pfvf)
 
 	return 0;
 }
+EXPORT_SYMBOL_GPL(otx2_pfc_txschq_update);
 
 int otx2_pfc_txschq_stop(struct otx2_nic *pfvf)
 {
@@ -282,6 +285,7 @@  int otx2_pfc_txschq_stop(struct otx2_nic *pfvf)
 
 	return 0;
 }
+EXPORT_SYMBOL_GPL(otx2_pfc_txschq_stop);
 
 int otx2_config_priority_flow_ctrl(struct otx2_nic *pfvf)
 {
@@ -321,6 +325,7 @@  int otx2_config_priority_flow_ctrl(struct otx2_nic *pfvf)
 	mutex_unlock(&pfvf->mbox.lock);
 	return err;
 }
+EXPORT_SYMBOL_GPL(otx2_config_priority_flow_ctrl);
 
 void otx2_update_bpid_in_rqctx(struct otx2_nic *pfvf, int vlan_prio, int qidx,
 			       bool pfc_enable)
@@ -385,6 +390,7 @@  void otx2_update_bpid_in_rqctx(struct otx2_nic *pfvf, int vlan_prio, int qidx,
 			 "Updating BPIDs in CQ and Aura contexts of RQ%d failed with err %d\n",
 			 qidx, err);
 }
+EXPORT_SYMBOL_GPL(otx2_update_bpid_in_rqctx);
 
 static int otx2_dcbnl_ieee_getpfc(struct net_device *dev, struct ieee_pfc *pfc)
 {
@@ -472,3 +478,8 @@  int otx2_dcbnl_set_ops(struct net_device *dev)
 
 	return 0;
 }
+EXPORT_SYMBOL_GPL(otx2_dcbnl_set_ops);
+
+MODULE_LICENSE("GPL");
+MODULE_DESCRIPTION("Marvell RVU dcbnl");
+MODULE_AUTHOR("Sunil Goutham <sgoutham@marvell.com>");
diff --git a/drivers/net/ethernet/marvell/octeontx2/nic/otx2_devlink.c b/drivers/net/ethernet/marvell/octeontx2/nic/otx2_devlink.c
index 99ddf31269d9..440f574d1195 100644
--- a/drivers/net/ethernet/marvell/octeontx2/nic/otx2_devlink.c
+++ b/drivers/net/ethernet/marvell/octeontx2/nic/otx2_devlink.c
@@ -113,6 +113,7 @@  int otx2_register_dl(struct otx2_nic *pfvf)
 	devlink_free(dl);
 	return err;
 }
+EXPORT_SYMBOL_GPL(otx2_register_dl);
 
 void otx2_unregister_dl(struct otx2_nic *pfvf)
 {
@@ -124,3 +125,8 @@  void otx2_unregister_dl(struct otx2_nic *pfvf)
 				  ARRAY_SIZE(otx2_dl_params));
 	devlink_free(dl);
 }
+EXPORT_SYMBOL_GPL(otx2_unregister_dl);
+
+MODULE_LICENSE("GPL");
+MODULE_DESCRIPTION("Marvell RVU PF/VF Netdev Devlink");
+MODULE_AUTHOR("Sunil Goutham <sgoutham@marvell.com>");