public inbox for linux-kbuild@vger.kernel.org
 help / color / mirror / Atom feed
From: Alexander Lobakin <alobakin@pm.me>
To: linux-kbuild@vger.kernel.org
Cc: Alexander Lobakin <alobakin@pm.me>,
	Masahiro Yamada <masahiroy@kernel.org>,
	Nicolas Schier <nicolas@fjasle.eu>, Jens Axboe <axboe@kernel.dk>,
	Boris Brezillon <bbrezillon@kernel.org>,
	Borislav Petkov <bp@alien8.de>, Tony Luck <tony.luck@intel.com>,
	Miquel Raynal <miquel.raynal@bootlin.com>,
	Vladimir Oltean <vladimir.oltean@nxp.com>,
	Alexandre Belloni <alexandre.belloni@bootlin.com>,
	Derek Chickles <dchickles@marvell.com>,
	Ioana Ciornei <ioana.ciornei@nxp.com>,
	Salil Mehta <salil.mehta@huawei.com>,
	Sunil Goutham <sgoutham@marvell.com>,
	Grygorii Strashko <grygorii.strashko@ti.com>,
	Daniel Scally <djrscally@gmail.com>,
	Hans de Goede <hdegoede@redhat.com>,
	Mark Brown <broonie@kernel.org>,
	Andy Shevchenko <andriy.shevchenko@linux.intel.com>,
	NXP Linux Team <linux-imx@nxp.com>,
	netdev@vger.kernel.org, linux-kernel@vger.kernel.org
Subject: [PATCH 17/18] net: octeontx2: fix mixed module-builtin object
Date: Sat, 19 Nov 2022 23:10:32 +0000	[thread overview]
Message-ID: <20221119225650.1044591-18-alobakin@pm.me> (raw)
In-Reply-To: <20221119225650.1044591-1-alobakin@pm.me>

With CONFIG_OCTEONTX2_PF=y and CONFIG_OCTEONTX2_VF=m, several object
files  are linked to a module and also to vmlinux even though the
expected CFLAGS are different between builtins and modules.
This is the same situation as fixed by
commit 637a642f5ca5 ("zstd: Fixing mixed module-builtin objects").
There's also no need to duplicate relatively big piece of object
code into two modules.

Introduce the new module, rvu_niccommon, to provide the common
functions to both rvu_nicpf and rvu_nicvf. Also, otx2_ptp.o was not
shared, but built as a standalone module (it was fixed already a year
ago the same way this commit does due to link issues). As it's used
by both PF and VF modules in the same way, just link it into that new
common one.

Fixes: 2da489432747 ("octeontx2-pf: devlink params support to set mcam entry count")
Fixes: 8e67558177f8 ("octeontx2-pf: PFC config support with DCBx")
Suggested-by: Masahiro Yamada <masahiroy@kernel.org>
Signed-off-by: Alexander Lobakin <alobakin@pm.me>
---
 drivers/net/ethernet/marvell/octeontx2/Kconfig     |  5 +++++
 .../net/ethernet/marvell/octeontx2/nic/Makefile    | 14 +++++++-------
 .../ethernet/marvell/octeontx2/nic/otx2_common.h   |  1 -
 .../ethernet/marvell/octeontx2/nic/otx2_dcbnl.c    |  8 +++++++-
 .../ethernet/marvell/octeontx2/nic/otx2_devlink.c  |  2 ++
 .../net/ethernet/marvell/octeontx2/nic/otx2_pf.c   |  2 ++
 .../net/ethernet/marvell/octeontx2/nic/otx2_ptp.c  |  2 +-
 .../net/ethernet/marvell/octeontx2/nic/otx2_vf.c   |  2 ++
 8 files changed, 26 insertions(+), 10 deletions(-)

diff --git a/drivers/net/ethernet/marvell/octeontx2/Kconfig b/drivers/net/ethernet/marvell/octeontx2/Kconfig
index 6b4f640163f7..eb03bdcaf606 100644
--- a/drivers/net/ethernet/marvell/octeontx2/Kconfig
+++ b/drivers/net/ethernet/marvell/octeontx2/Kconfig
@@ -28,8 +28,12 @@ config NDC_DIS_DYNAMIC_CACHING
 	  , NPA stack pages etc in NDC. Also locks down NIX SQ/CQ/RQ/RSS and
 	  NPA Aura/Pool contexts.

+config OCTEONTX2_NIC_COMMON
+	tristate
+
 config OCTEONTX2_PF
 	tristate "Marvell OcteonTX2 NIC Physical Function driver"
+	select OCTEONTX2_NIC_COMMON
 	select OCTEONTX2_MBOX
 	select NET_DEVLINK
 	depends on MACSEC || !MACSEC
@@ -44,5 +48,6 @@ config OCTEONTX2_PF
 config OCTEONTX2_VF
 	tristate "Marvell OcteonTX2 NIC Virtual Function driver"
 	depends on OCTEONTX2_PF
+	select OCTEONTX2_NIC_COMMON
 	help
 	  This driver supports Marvell's OcteonTX2 NIC virtual function.
diff --git a/drivers/net/ethernet/marvell/octeontx2/nic/Makefile b/drivers/net/ethernet/marvell/octeontx2/nic/Makefile
index 73fdb8798614..040c841645bd 100644
--- a/drivers/net/ethernet/marvell/octeontx2/nic/Makefile
+++ b/drivers/net/ethernet/marvell/octeontx2/nic/Makefile
@@ -3,16 +3,16 @@
 # 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_NIC_COMMON) += rvu_niccommon.o
+obj-$(CONFIG_OCTEONTX2_PF) += rvu_nicpf.o
+obj-$(CONFIG_OCTEONTX2_VF) += rvu_nicvf.o

+rvu_niccommon-y := otx2_devlink.o otx2_ptp.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
-rvu_nicvf-y := otx2_vf.o otx2_devlink.o
+               otx2_flows.o otx2_tc.o cn10k.o otx2_dmac_flt.o
+rvu_nicvf-y := otx2_vf.o

-rvu_nicpf-$(CONFIG_DCB) += otx2_dcbnl.o
-rvu_nicvf-$(CONFIG_DCB) += otx2_dcbnl.o
+rvu_niccommon-$(CONFIG_DCB) += otx2_dcbnl.o
 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_common.h b/drivers/net/ethernet/marvell/octeontx2/nic/otx2_common.h
index 282db6fe3b08..06307000cfd1 100644
--- a/drivers/net/ethernet/marvell/octeontx2/nic/otx2_common.h
+++ b/drivers/net/ethernet/marvell/octeontx2/nic/otx2_common.h
@@ -1018,7 +1018,6 @@ int otx2_dcbnl_set_ops(struct net_device *dev);
 /* PFC support */
 int otx2_pfc_txschq_config(struct otx2_nic *pfvf);
 int otx2_pfc_txschq_alloc(struct otx2_nic *pfvf);
-int otx2_pfc_txschq_update(struct otx2_nic *pfvf);
 int otx2_pfc_txschq_stop(struct otx2_nic *pfvf);
 #endif

diff --git a/drivers/net/ethernet/marvell/octeontx2/nic/otx2_dcbnl.c b/drivers/net/ethernet/marvell/octeontx2/nic/otx2_dcbnl.c
index ccaf97bb1ce0..8e862785325d 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_NS_GPL(otx2_pfc_txschq_config, OCTEONTX2_NIC_COMMON);

 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_NS_GPL(otx2_pfc_txschq_alloc, OCTEONTX2_NIC_COMMON);

 static int otx2_pfc_txschq_stop_one(struct otx2_nic *pfvf, u8 prio)
 {
@@ -201,7 +203,7 @@ static int otx2_pfc_update_sq_smq_mapping(struct otx2_nic *pfvf, int prio)
 	return 0;
 }

-int otx2_pfc_txschq_update(struct otx2_nic *pfvf)
+static int otx2_pfc_txschq_update(struct otx2_nic *pfvf)
 {
 	bool if_up = netif_running(pfvf->netdev);
 	u8 pfc_en = pfvf->pfc_en, pfc_bit_set;
@@ -289,6 +291,7 @@ int otx2_pfc_txschq_stop(struct otx2_nic *pfvf)

 	return 0;
 }
+EXPORT_SYMBOL_NS_GPL(otx2_pfc_txschq_stop, OCTEONTX2_NIC_COMMON);

 int otx2_config_priority_flow_ctrl(struct otx2_nic *pfvf)
 {
@@ -328,6 +331,7 @@ int otx2_config_priority_flow_ctrl(struct otx2_nic *pfvf)
 	mutex_unlock(&pfvf->mbox.lock);
 	return err;
 }
+EXPORT_SYMBOL_NS_GPL(otx2_config_priority_flow_ctrl, OCTEONTX2_NIC_COMMON);

 void otx2_update_bpid_in_rqctx(struct otx2_nic *pfvf, int vlan_prio, int qidx,
 			       bool pfc_enable)
@@ -392,6 +396,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_NS_GPL(otx2_update_bpid_in_rqctx, OCTEONTX2_NIC_COMMON);

 static int otx2_dcbnl_ieee_getpfc(struct net_device *dev, struct ieee_pfc *pfc)
 {
@@ -468,3 +473,4 @@ int otx2_dcbnl_set_ops(struct net_device *dev)

 	return 0;
 }
+EXPORT_SYMBOL_NS_GPL(otx2_dcbnl_set_ops, OCTEONTX2_NIC_COMMON);
diff --git a/drivers/net/ethernet/marvell/octeontx2/nic/otx2_devlink.c b/drivers/net/ethernet/marvell/octeontx2/nic/otx2_devlink.c
index 777a27047c8e..73cbedb861f3 100644
--- a/drivers/net/ethernet/marvell/octeontx2/nic/otx2_devlink.c
+++ b/drivers/net/ethernet/marvell/octeontx2/nic/otx2_devlink.c
@@ -128,6 +128,7 @@ int otx2_register_dl(struct otx2_nic *pfvf)
 	devlink_free(dl);
 	return err;
 }
+EXPORT_SYMBOL_NS_GPL(otx2_register_dl, OCTEONTX2_NIC_COMMON);

 void otx2_unregister_dl(struct otx2_nic *pfvf)
 {
@@ -139,3 +140,4 @@ void otx2_unregister_dl(struct otx2_nic *pfvf)
 				  ARRAY_SIZE(otx2_dl_params));
 	devlink_free(dl);
 }
+EXPORT_SYMBOL_NS_GPL(otx2_unregister_dl, OCTEONTX2_NIC_COMMON);
diff --git a/drivers/net/ethernet/marvell/octeontx2/nic/otx2_pf.c b/drivers/net/ethernet/marvell/octeontx2/nic/otx2_pf.c
index 303930499a4c..11e3ccee61c1 100644
--- a/drivers/net/ethernet/marvell/octeontx2/nic/otx2_pf.c
+++ b/drivers/net/ethernet/marvell/octeontx2/nic/otx2_pf.c
@@ -34,6 +34,8 @@ static const struct pci_device_id otx2_pf_id_table[] = {
 	{ 0, }  /* end of table */
 };

+MODULE_IMPORT_NS(OCTEONTX2_NIC_COMMON);
+
 MODULE_AUTHOR("Sunil Goutham <sgoutham@marvell.com>");
 MODULE_DESCRIPTION(DRV_STRING);
 MODULE_LICENSE("GPL v2");
diff --git a/drivers/net/ethernet/marvell/octeontx2/nic/otx2_ptp.c b/drivers/net/ethernet/marvell/octeontx2/nic/otx2_ptp.c
index 896b2f9bac34..ef48f50d3771 100644
--- a/drivers/net/ethernet/marvell/octeontx2/nic/otx2_ptp.c
+++ b/drivers/net/ethernet/marvell/octeontx2/nic/otx2_ptp.c
@@ -394,5 +394,5 @@ int otx2_ptp_tstamp2time(struct otx2_nic *pfvf, u64 tstamp, u64 *tsns)
 EXPORT_SYMBOL_GPL(otx2_ptp_tstamp2time);

 MODULE_AUTHOR("Sunil Goutham <sgoutham@marvell.com>");
-MODULE_DESCRIPTION("Marvell RVU NIC PTP Driver");
+MODULE_DESCRIPTION("Marvell RVU NIC Common Module");
 MODULE_LICENSE("GPL v2");
diff --git a/drivers/net/ethernet/marvell/octeontx2/nic/otx2_vf.c b/drivers/net/ethernet/marvell/octeontx2/nic/otx2_vf.c
index 86653bb8e403..59ec45e16637 100644
--- a/drivers/net/ethernet/marvell/octeontx2/nic/otx2_vf.c
+++ b/drivers/net/ethernet/marvell/octeontx2/nic/otx2_vf.c
@@ -24,6 +24,8 @@ static const struct pci_device_id otx2_vf_id_table[] = {
 	{ }
 };

+MODULE_IMPORT_NS(OCTEONTX2_NIC_COMMON);
+
 MODULE_AUTHOR("Sunil Goutham <sgoutham@marvell.com>");
 MODULE_DESCRIPTION(DRV_STRING);
 MODULE_LICENSE("GPL v2");
--
2.38.1



  parent reply	other threads:[~2022-11-19 23:11 UTC|newest]

Thread overview: 61+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2022-11-19 23:03 [PATCH 00/18] treewide: fix object files shared between several modules Alexander Lobakin
2022-11-19 23:04 ` [PATCH 01/18] block/rnbd: fix mixed module-builtin object Alexander Lobakin
2022-11-21 21:17   ` Andrew Davis
2022-11-22  5:59     ` Masahiro Yamada
2022-11-29 18:24       ` Andrew Davis
2022-11-19 23:04 ` [PATCH 02/18] drm/bridge: imx: " Alexander Lobakin
2022-11-19 23:05 ` [PATCH 03/18] drm/bridge: imx: turn imx8{qm,qxp}-ldb into single-object modules Alexander Lobakin
2022-11-19 23:05 ` [PATCH 04/18] sound: fix mixed module-builtin object Alexander Lobakin
2022-11-19 23:05 ` [PATCH 05/18] mfd: rsmu: " Alexander Lobakin
2022-11-19 23:06 ` [PATCH 06/18] mfd: rsmu: turn rsmu-{core,i2c,spi} into single-object modules Alexander Lobakin
2022-11-19 23:06 ` [PATCH 07/18] net: liquidio: fix mixed module-builtin object Alexander Lobakin
2022-11-19 23:06 ` [PATCH 08/18] net: enetc: " Alexander Lobakin
2022-11-23 13:03   ` Masahiro Yamada
2022-11-19 23:07 ` [PATCH 09/18] net: emac, cpsw: fix mixed module-builtin object (davinci_cpdma) Alexander Lobakin
2022-11-23 16:04   ` Masahiro Yamada
2022-11-19 23:07 ` [PATCH 10/18] EDAC: i10nm, skx: fix mixed module-builtin object Alexander Lobakin
2022-11-23 16:12   ` Masahiro Yamada
2022-11-19 23:08 ` [PATCH 11/18] platform/x86: int3472: fix object shared between several modules Alexander Lobakin
2022-11-20 13:55   ` Andy Shevchenko
2022-11-20 20:54     ` Hans de Goede
2022-11-20 23:45       ` Masahiro Yamada
2022-11-21  8:12         ` Hans de Goede
2022-11-21  9:06           ` Masahiro Yamada
2022-11-21  9:34             ` Hans de Goede
2022-11-23 21:19               ` Alexander Lobakin
2022-11-23 21:10           ` Alexander Lobakin
2022-11-23  0:01     ` Alexander Lobakin
2022-11-19 23:08 ` [PATCH 12/18] mtd: tests: " Alexander Lobakin
2022-11-23 13:11   ` Masahiro Yamada
2022-11-23 16:59     ` Miquel Raynal
2022-11-24 11:31       ` Miquel Raynal
2022-11-19 23:09 ` [PATCH 13/18] crypto: octeontx2: fix objects " Alexander Lobakin
2022-11-23 16:26   ` Masahiro Yamada
2022-11-19 23:09 ` [PATCH 14/18] dsa: ocelot: fix mixed module-builtin object Alexander Lobakin
2022-11-21 17:55   ` Vladimir Oltean
2022-11-21 18:12     ` Colin Foster
2022-11-21 21:02       ` Vladimir Oltean
2022-11-23 21:31       ` Alexander Lobakin
2022-11-23 21:47       ` Alexander Lobakin
2022-11-23 22:18         ` Colin Foster
2022-11-23 22:36           ` Vladimir Oltean
2022-11-21 18:59     ` Andy Shevchenko
2022-11-19 23:09 ` [PATCH 15/18] net: dpaa2: " Alexander Lobakin
2022-11-23 21:02   ` Masahiro Yamada
2022-11-19 23:10 ` [PATCH 16/18] net: hns3: " Alexander Lobakin
2022-11-22 12:39   ` Salil Mehta
2022-11-23 22:07     ` Alexander Lobakin
2022-11-24  9:58       ` Salil Mehta
2022-11-19 23:10 ` Alexander Lobakin [this message]
2022-11-23 20:54   ` [PATCH 17/18] net: octeontx2: " Masahiro Yamada
2022-11-19 23:10 ` [PATCH 18/18] net: cpsw: " Alexander Lobakin
2022-11-23 20:37   ` Masahiro Yamada
2022-11-20 11:58 ` [PATCH 00/18] treewide: fix object files shared between several modules Mark Brown
2022-11-20 12:26   ` Conor Dooley
2022-11-22 11:28     ` Mark Brown
2022-11-22 21:37   ` Alexander Lobakin
2022-11-23 11:51     ` Mark Brown
2022-11-21 19:50 ` Jakub Kicinski
2022-11-23 21:40   ` Alexander Lobakin
2022-11-23 21:39 ` Masahiro Yamada
2023-02-10 17:31 ` Alexander Lobakin

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=20221119225650.1044591-18-alobakin@pm.me \
    --to=alobakin@pm.me \
    --cc=alexandre.belloni@bootlin.com \
    --cc=andriy.shevchenko@linux.intel.com \
    --cc=axboe@kernel.dk \
    --cc=bbrezillon@kernel.org \
    --cc=bp@alien8.de \
    --cc=broonie@kernel.org \
    --cc=dchickles@marvell.com \
    --cc=djrscally@gmail.com \
    --cc=grygorii.strashko@ti.com \
    --cc=hdegoede@redhat.com \
    --cc=ioana.ciornei@nxp.com \
    --cc=linux-imx@nxp.com \
    --cc=linux-kbuild@vger.kernel.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=masahiroy@kernel.org \
    --cc=miquel.raynal@bootlin.com \
    --cc=netdev@vger.kernel.org \
    --cc=nicolas@fjasle.eu \
    --cc=salil.mehta@huawei.com \
    --cc=sgoutham@marvell.com \
    --cc=tony.luck@intel.com \
    --cc=vladimir.oltean@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