From patchwork Sat Nov 19 23:10:32 2022 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Alexander Lobakin X-Patchwork-Id: 13049855 X-Patchwork-Delegate: kuba@kernel.org Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by smtp.lore.kernel.org (Postfix) with ESMTP id D705AC4332F for ; Sat, 19 Nov 2022 23:11:27 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S235403AbiKSXLS (ORCPT ); Sat, 19 Nov 2022 18:11:18 -0500 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:35100 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S235277AbiKSXKx (ORCPT ); Sat, 19 Nov 2022 18:10:53 -0500 Received: from mail-0301.mail-europe.com (mail-0301.mail-europe.com [188.165.51.139]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id E77941A388 for ; Sat, 19 Nov 2022 15:10:51 -0800 (PST) Date: Sat, 19 Nov 2022 23:10:32 +0000 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=pm.me; s=protonmail3; t=1668899445; x=1669158645; bh=lZ7Rs/ZnddACw1jvzs/PqLsltYLTGpkimYjbYKt//JU=; h=Date:To:From:Cc:Subject:Message-ID:In-Reply-To:References: Feedback-ID:From:To:Cc:Date:Subject:Reply-To:Feedback-ID: Message-ID:BIMI-Selector; b=MwkzEn1Z43pI6k3ysRRUAd78NdgilKCbiURPSU97ud6PlYDuD3r4wX6kynsud2BDV FTgz0dIEhO0vqk69Q9ajklQkuUJTQUtv5Kfke1xyFpEpF9rgACfyhr4daSrfsx3B1J NwVytXSux8c4DY7dTJbFnBZ/5qoUCO+b5JS9y9tdhpIdlnUzDdVB481RrUoLPXyFop 7beDz4m4lmYWIDUYmcAC+eEZKejYBokFJWi6hPnMt+kecxCZ+rwCuKqGUI83jvEfX6 Np0bActEFWr2aY6rHGeA31YLT/OZPm6Ym/XQ2GGyRphcbaJSkCAUykj1kUORpfvI1G tMIri4Tqm44TQ== To: linux-kbuild@vger.kernel.org From: Alexander Lobakin Cc: Alexander Lobakin , Masahiro Yamada , Nicolas Schier , Jens Axboe , Boris Brezillon , Borislav Petkov , Tony Luck , Miquel Raynal , Vladimir Oltean , Alexandre Belloni , Derek Chickles , Ioana Ciornei , Salil Mehta , Sunil Goutham , Grygorii Strashko , Daniel Scally , Hans de Goede , Mark Brown , Andy Shevchenko , NXP Linux Team , netdev@vger.kernel.org, linux-kernel@vger.kernel.org Subject: [PATCH 17/18] net: octeontx2: fix mixed module-builtin object Message-ID: <20221119225650.1044591-18-alobakin@pm.me> In-Reply-To: <20221119225650.1044591-1-alobakin@pm.me> References: <20221119225650.1044591-1-alobakin@pm.me> Feedback-ID: 22809121:user:proton MIME-Version: 1.0 Precedence: bulk List-ID: X-Mailing-List: netdev@vger.kernel.org X-Patchwork-Delegate: kuba@kernel.org 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 Signed-off-by: Alexander Lobakin Reviewed-by: Masahiro Yamada --- 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(-) -- 2.38.1 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 "); 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 "); -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 "); MODULE_DESCRIPTION(DRV_STRING); MODULE_LICENSE("GPL v2");