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: 23355 Return-Path: Delivered-To: ouuuleilei@gmail.com Received: by 2002:adf:f944:0:0:0:0:0 with SMTP id q4csp904791wrr; Sat, 19 Nov 2022 15:35:48 -0800 (PST) X-Google-Smtp-Source: AA0mqf7J2qYGCpqkPkeB3MCpaO3s4zwmJf7qOsuFOhXPfZlLYouKRdJEyz+TO5SlsvJ4ix2VBTrg X-Received: by 2002:a17:906:6dd7:b0:7a1:1c24:e564 with SMTP id j23-20020a1709066dd700b007a11c24e564mr10525828ejt.629.1668900947933; Sat, 19 Nov 2022 15:35:47 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1668900947; cv=none; d=google.com; s=arc-20160816; b=YOr5B6YJo6C53KiF4ZbJlR8YTiw7ODfSSYidVzUYDQNKt6oAZ+d7VutmVmTE3bhmqM VjIoXZU4GIuNflJB5sKWgpe8oeauZpbtUPSh5D6/AMRjqmThfq8d22kizimT8NPAn07/ TuD99txmmCnI3oaG2dvd4M4ZdFrQQf1qT+3Gwj522M12kQdXwM+doUWn/H/zOtX/DVGM KPDP+WpBwEFfzQ7BMhipHfqO8MPrkTJ4t9+LXfd7qFboLXqnwCJ47VaizdaccDhf9AV9 cBannMqYE2DV1PLUZMOm+077ctBJPWiITLB2SqfUQwhEq0Y/1rdJkoyVIsldxZ+Bl3jf KGyw== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:content-transfer-encoding:mime-version :feedback-id:references:in-reply-to:message-id:subject:cc:from:to :dkim-signature:date; bh=lZ7Rs/ZnddACw1jvzs/PqLsltYLTGpkimYjbYKt//JU=; b=GXtfzLs+DSJ3/sGQ59S+gtFQapXQGKlfdziuYi0YYEIa77vpeAdklZZmcazj+5Fc3F CHAYjsPF3E44tWQ+RnyyESWUH59gizwgzeSurEwmyd1jM8rLohNE9iRlGbUKsPb54AZ4 y6RXvow12KEAzES/nTdIYaOQhTMzeWkxMn6W4tQIQcge14Lc9Uc1TyBj6WRCtqdQpLtA q6FdFFiSrtNhp1gT+aqrJAaRXOU/O+ZzFHw+RTtYjnlANzJOJ5pgXH/rYTlz/Ywu/bhA rWfz6/q7KBmPxxbpnLJ2aMyxz9dCBP2vBzZheIxdD9A9aBBBexFBcNhZz+8N4GhCEjGx uImA== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@pm.me header.s=protonmail3 header.b=MwkzEn1Z; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=QUARANTINE sp=QUARANTINE dis=NONE) header.from=pm.me Received: from out1.vger.email (out1.vger.email. [2620:137:e000::1:20]) by mx.google.com with ESMTP id ds15-20020a0564021ccf00b00459b51c2b25si6467616edb.438.2022.11.19.15.35.19; Sat, 19 Nov 2022 15:35:47 -0800 (PST) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) client-ip=2620:137:e000::1:20; Authentication-Results: mx.google.com; dkim=pass header.i=@pm.me header.s=protonmail3 header.b=MwkzEn1Z; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=QUARANTINE sp=QUARANTINE dis=NONE) header.from=pm.me Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S235376AbiKSXLO (ORCPT + 99 others); Sat, 19 Nov 2022 18:11:14 -0500 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:34070 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S234216AbiKSXKu (ORCPT ); Sat, 19 Nov 2022 18:10:50 -0500 Received: from mail-40133.protonmail.ch (mail-40133.protonmail.ch [185.70.40.133]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 552451A237; Sat, 19 Nov 2022 15:10:47 -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 X-Spam-Status: No, score=-2.1 required=5.0 tests=BAYES_00,DKIM_SIGNED, DKIM_VALID,DKIM_VALID_AU,DKIM_VALID_EF,RCVD_IN_MSPIKE_H2,SPF_HELO_PASS, SPF_PASS autolearn=ham autolearn_force=no version=3.4.6 X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on lindbergh.monkeyblade.net Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org X-getmail-retrieved-from-mailbox: =?utf-8?q?INBOX?= X-GMAIL-THRID: =?utf-8?q?1749969480312927976?= X-GMAIL-MSGID: =?utf-8?q?1749969480312927976?= 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");