lists.openwall.net   lists  /  announce  owl-users  owl-dev  john-users  john-dev  passwdqc-users  yescrypt  popa3d-users  /  oss-security  kernel-hardening  musl  sabotage  tlsify  passwords  /  crypt-dev  xvendor  /  Bugtraq  Full-Disclosure  linux-kernel  linux-netdev  linux-ext4  linux-hardening  linux-cve-announce  PHC 
Open Source and information security mailing list archives
 
Hash Suite: Windows password security audit tool. GUI, reports in PDF.
[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Date:   Sat, 19 Nov 2022 23:10:32 +0000
From:   Alexander Lobakin <alobakin@...me>
To:     linux-kbuild@...r.kernel.org
Cc:     Alexander Lobakin <alobakin@...me>,
        Masahiro Yamada <masahiroy@...nel.org>,
        Nicolas Schier <nicolas@...sle.eu>,
        Jens Axboe <axboe@...nel.dk>,
        Boris Brezillon <bbrezillon@...nel.org>,
        Borislav Petkov <bp@...en8.de>,
        Tony Luck <tony.luck@...el.com>,
        Miquel Raynal <miquel.raynal@...tlin.com>,
        Vladimir Oltean <vladimir.oltean@....com>,
        Alexandre Belloni <alexandre.belloni@...tlin.com>,
        Derek Chickles <dchickles@...vell.com>,
        Ioana Ciornei <ioana.ciornei@....com>,
        Salil Mehta <salil.mehta@...wei.com>,
        Sunil Goutham <sgoutham@...vell.com>,
        Grygorii Strashko <grygorii.strashko@...com>,
        Daniel Scally <djrscally@...il.com>,
        Hans de Goede <hdegoede@...hat.com>,
        Mark Brown <broonie@...nel.org>,
        Andy Shevchenko <andriy.shevchenko@...ux.intel.com>,
        NXP Linux Team <linux-imx@....com>, netdev@...r.kernel.org,
        linux-kernel@...r.kernel.org
Subject: [PATCH 17/18] net: octeontx2: fix mixed module-builtin object

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@...nel.org>
Signed-off-by: Alexander Lobakin <alobakin@...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@...vell.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@...vell.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@...vell.com>");
 MODULE_DESCRIPTION(DRV_STRING);
 MODULE_LICENSE("GPL v2");
--
2.38.1


Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ