From patchwork Sat Nov 19 23:06:58 2022 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Alexander Lobakin X-Patchwork-Id: 23346 Return-Path: Delivered-To: ouuuleilei@gmail.com Received: by 2002:adf:f944:0:0:0:0:0 with SMTP id q4csp897866wrr; Sat, 19 Nov 2022 15:07:52 -0800 (PST) X-Google-Smtp-Source: AA0mqf5+u2AIq7kP3QgsC1pM0qoOC7+PBZWC70BCdc05gYoUN/ekiR+Xytgm3bmVwlN68E5aBKRn X-Received: by 2002:a17:902:b283:b0:188:bc8e:9569 with SMTP id u3-20020a170902b28300b00188bc8e9569mr5723045plr.43.1668899272660; Sat, 19 Nov 2022 15:07:52 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1668899272; cv=none; d=google.com; s=arc-20160816; b=sror/pVCDZE/Df6v1QjurAuzGuu7dPDHubog+YnwIKSysEhzwQqeBLbv968oRWmATp /79J9ed0rpZtkVAF4er3bOnBn3iPGqOHv3UtH9tRJIxxRxJA8/a3pEb+23O5yTOZ9p2a c+kN+vsMWhUxIRtuh4DHHYHoO7CNsBFoX9Vau/0CD2FdlleZvkSxPgI/xNzSNa8pLhbs S8lL8q9MD+PfvB2dy9nqEJsXg9mV4UEE4bTFHaSmeTooecarT3rCvcrFjhPOxUPBbOZj l/oFBT5seGmRhQ5Q1chtIbHHa1Sx5Era/54osbeBydkTXRqTNJDwpx0I7hB/gVMM/DKr sq1A== 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=LnKnOV/7tqamV85lyv9w7/9/rIynES3UvAepG2Xk9lc=; b=KCgMZxyiptNoUcyTZvXVzA8gupaXl+DzdrgHZdl2U6ubstMIVmojeLRWwzLuYKhUMl SHM4jrrhagYfj8pDV0CMCQutosMSIcDqsE7ecmMs23vaLo6AX4xlTVMe5YLvqCWA4kz5 niWh2f+Ox7gEuCXK+62D/Yb2r2/szGu4NRzLJ3pj7ra1HqhWkYkeG6g9K0o86aLyj7LL dIMHQCTgKr+6DRAqQI8K1myrqf60vcSMx93M5N+Q29xDDsRCFxvROKvpDc1kkHA9YEtJ A22ZuoPPMx9cFP5f6b/mEh7dJplfZWSN3tZ5s/HS0UJSufNTIejyubRepX8fRoE6EtXV jqWA== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@pm.me header.s=protonmail3 header.b=ExvFYecK; 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 x3-20020a634843000000b004403e01f82asi7337872pgk.230.2022.11.19.15.07.40; Sat, 19 Nov 2022 15:07:52 -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=ExvFYecK; 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 S235169AbiKSXHT (ORCPT + 99 others); Sat, 19 Nov 2022 18:07:19 -0500 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:58706 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S235234AbiKSXHK (ORCPT ); Sat, 19 Nov 2022 18:07:10 -0500 Received: from mail-40134.protonmail.ch (mail-40134.protonmail.ch [185.70.40.134]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id BF8421A07B for ; Sat, 19 Nov 2022 15:07:07 -0800 (PST) Date: Sat, 19 Nov 2022 23:06:58 +0000 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=pm.me; s=protonmail3; t=1668899225; x=1669158425; bh=LnKnOV/7tqamV85lyv9w7/9/rIynES3UvAepG2Xk9lc=; 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=ExvFYecKRj5uu0y27km2iciyyRSVRCIgGEp4QeveHcaeRXUy0cl08EL3gJQ/cxm40 lCfZ7esl/EROsiVfEhvfdIVsKdw+uqraePAZHr/3xBkGq1HgB9DKaOFUgL22LnRy9g Vm7FmrEwLtYfopgIOEmy42YTUzUlP+D+SY7p7zg7U2csOT+8ypPAX+3XWTdDu9Csbd INNlwQXnbg5yRwF5k17zD0rLctCH4N1wkYZwexs7g7rRJR4fMvQpOEeU8kmvTDTNDj g4e/TVxQfR1GbQEP2gGOZm79ObQ3T4EDpcoj18suV9vNcXy32r8JNANhSdNWqRJk6k Ucm0Me0ITfc1Q== 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 08/18] net: enetc: fix mixed module-builtin object Message-ID: <20221119225650.1044591-9-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,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?1749967723354072315?= X-GMAIL-MSGID: =?utf-8?q?1749967723354072315?= From: Masahiro Yamada With CONFIG_FSL_ENETC=m and CONFIG_FSL_ENETC_VF=y (or vice versa), $(common-objs) 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"). Introduce the new module, fsl-enetc-core, to provide the common functions to fsl-enetc and fsl-enetc-vf. [ alobakin: add exports to common functions ] Signed-off-by: Masahiro Yamada Reviewed-by: Alexander Lobakin Signed-off-by: Alexander Lobakin Reviewed-by: Masahiro Yamada --- drivers/net/ethernet/freescale/enetc/Kconfig | 5 +++++ drivers/net/ethernet/freescale/enetc/Makefile | 7 ++++--- drivers/net/ethernet/freescale/enetc/enetc.c | 21 +++++++++++++++++++ .../net/ethernet/freescale/enetc/enetc_cbdr.c | 7 +++++++ .../ethernet/freescale/enetc/enetc_ethtool.c | 2 ++ .../net/ethernet/freescale/enetc/enetc_pf.c | 2 ++ .../net/ethernet/freescale/enetc/enetc_vf.c | 2 ++ 7 files changed, 43 insertions(+), 3 deletions(-) -- 2.38.1 diff --git a/drivers/net/ethernet/freescale/enetc/Kconfig b/drivers/net/ethernet/freescale/enetc/Kconfig index cdc0ff89388a..a8a38df34760 100644 --- a/drivers/net/ethernet/freescale/enetc/Kconfig +++ b/drivers/net/ethernet/freescale/enetc/Kconfig @@ -1,7 +1,11 @@ # SPDX-License-Identifier: GPL-2.0 +config FSL_ENETC_CORE + tristate + config FSL_ENETC tristate "ENETC PF driver" depends on PCI && PCI_MSI + select FSL_ENETC_CORE select FSL_ENETC_IERB select FSL_ENETC_MDIO select PHYLINK @@ -17,6 +21,7 @@ config FSL_ENETC config FSL_ENETC_VF tristate "ENETC VF driver" depends on PCI && PCI_MSI + select FSL_ENETC_CORE select FSL_ENETC_MDIO select PHYLINK select DIMLIB diff --git a/drivers/net/ethernet/freescale/enetc/Makefile b/drivers/net/ethernet/freescale/enetc/Makefile index e0e8dfd13793..d67319e09bad 100644 --- a/drivers/net/ethernet/freescale/enetc/Makefile +++ b/drivers/net/ethernet/freescale/enetc/Makefile @@ -1,14 +1,15 @@ # SPDX-License-Identifier: GPL-2.0 -common-objs := enetc.o enetc_cbdr.o enetc_ethtool.o +obj-$(CONFIG_FSL_ENETC_CORE) += fsl-enetc-core.o +fsl-enetc-core-y += enetc.o enetc_cbdr.o enetc_ethtool.o obj-$(CONFIG_FSL_ENETC) += fsl-enetc.o -fsl-enetc-y := enetc_pf.o $(common-objs) +fsl-enetc-y := enetc_pf.o fsl-enetc-$(CONFIG_PCI_IOV) += enetc_msg.o fsl-enetc-$(CONFIG_FSL_ENETC_QOS) += enetc_qos.o obj-$(CONFIG_FSL_ENETC_VF) += fsl-enetc-vf.o -fsl-enetc-vf-y := enetc_vf.o $(common-objs) +fsl-enetc-vf-y := enetc_vf.o obj-$(CONFIG_FSL_ENETC_IERB) += fsl-enetc-ierb.o fsl-enetc-ierb-y := enetc_ierb.o diff --git a/drivers/net/ethernet/freescale/enetc/enetc.c b/drivers/net/ethernet/freescale/enetc/enetc.c index f8c06c3f9464..f13bb6b1c026 100644 --- a/drivers/net/ethernet/freescale/enetc/enetc.c +++ b/drivers/net/ethernet/freescale/enetc/enetc.c @@ -651,6 +651,7 @@ netdev_tx_t enetc_xmit(struct sk_buff *skb, struct net_device *ndev) return enetc_start_xmit(skb, ndev); } +EXPORT_SYMBOL_NS_GPL(enetc_xmit, FSL_ENETC_CORE); static irqreturn_t enetc_msix(int irq, void *data) { @@ -1384,6 +1385,7 @@ int enetc_xdp_xmit(struct net_device *ndev, int num_frames, return xdp_tx_frm_cnt; } +EXPORT_SYMBOL_NS_GPL(enetc_xdp_xmit, FSL_ENETC_CORE); static void enetc_map_rx_buff_to_xdp(struct enetc_bdr *rx_ring, int i, struct xdp_buff *xdp_buff, u16 size) @@ -1735,6 +1737,7 @@ void enetc_get_si_caps(struct enetc_si *si) if (val & ENETC_SIPCAPR0_PSFP) si->hw_features |= ENETC_SI_F_PSFP; } +EXPORT_SYMBOL_NS_GPL(enetc_get_si_caps, FSL_ENETC_CORE); static int enetc_dma_alloc_bdr(struct enetc_bdr *r, size_t bd_size) { @@ -1999,6 +2002,7 @@ int enetc_configure_si(struct enetc_ndev_priv *priv) return 0; } +EXPORT_SYMBOL_NS_GPL(enetc_configure_si, FSL_ENETC_CORE); void enetc_init_si_rings_params(struct enetc_ndev_priv *priv) { @@ -2018,6 +2022,7 @@ void enetc_init_si_rings_params(struct enetc_ndev_priv *priv) priv->ic_mode = ENETC_IC_RX_ADAPTIVE | ENETC_IC_TX_MANUAL; priv->tx_ictt = ENETC_TXIC_TIMETHR; } +EXPORT_SYMBOL_NS_GPL(enetc_init_si_rings_params, FSL_ENETC_CORE); int enetc_alloc_si_resources(struct enetc_ndev_priv *priv) { @@ -2030,11 +2035,13 @@ int enetc_alloc_si_resources(struct enetc_ndev_priv *priv) return 0; } +EXPORT_SYMBOL_NS_GPL(enetc_alloc_si_resources, FSL_ENETC_CORE); void enetc_free_si_resources(struct enetc_ndev_priv *priv) { kfree(priv->cls_rules); } +EXPORT_SYMBOL_NS_GPL(enetc_free_si_resources, FSL_ENETC_CORE); static void enetc_setup_txbdr(struct enetc_hw *hw, struct enetc_bdr *tx_ring) { @@ -2398,6 +2405,7 @@ int enetc_open(struct net_device *ndev) return err; } +EXPORT_SYMBOL_NS_GPL(enetc_open, FSL_ENETC_CORE); void enetc_stop(struct net_device *ndev) { @@ -2439,6 +2447,7 @@ int enetc_close(struct net_device *ndev) return 0; } +EXPORT_SYMBOL_NS_GPL(enetc_close, FSL_ENETC_CORE); int enetc_setup_tc_mqprio(struct net_device *ndev, void *type_data) { @@ -2494,6 +2503,7 @@ int enetc_setup_tc_mqprio(struct net_device *ndev, void *type_data) return 0; } +EXPORT_SYMBOL_NS_GPL(enetc_setup_tc_mqprio, FSL_ENETC_CORE); static int enetc_setup_xdp_prog(struct net_device *dev, struct bpf_prog *prog, struct netlink_ext_ack *extack) @@ -2542,6 +2552,7 @@ int enetc_setup_bpf(struct net_device *dev, struct netdev_bpf *xdp) return 0; } +EXPORT_SYMBOL_NS_GPL(enetc_setup_bpf, FSL_ENETC_CORE); struct net_device_stats *enetc_get_stats(struct net_device *ndev) { @@ -2573,6 +2584,7 @@ struct net_device_stats *enetc_get_stats(struct net_device *ndev) return stats; } +EXPORT_SYMBOL_NS_GPL(enetc_get_stats, FSL_ENETC_CORE); static int enetc_set_rss(struct net_device *ndev, int en) { @@ -2625,6 +2637,7 @@ void enetc_set_features(struct net_device *ndev, netdev_features_t features) enetc_enable_txvlan(ndev, !!(features & NETIF_F_HW_VLAN_CTAG_TX)); } +EXPORT_SYMBOL_NS_GPL(enetc_set_features, FSL_ENETC_CORE); #ifdef CONFIG_FSL_ENETC_PTP_CLOCK static int enetc_hwtstamp_set(struct net_device *ndev, struct ifreq *ifr) @@ -2708,6 +2721,7 @@ int enetc_ioctl(struct net_device *ndev, struct ifreq *rq, int cmd) return phylink_mii_ioctl(priv->phylink, rq, cmd); } +EXPORT_SYMBOL_NS_GPL(enetc_ioctl, FSL_ENETC_CORE); int enetc_alloc_msix(struct enetc_ndev_priv *priv) { @@ -2809,6 +2823,7 @@ int enetc_alloc_msix(struct enetc_ndev_priv *priv) return err; } +EXPORT_SYMBOL_NS_GPL(enetc_alloc_msix, FSL_ENETC_CORE); void enetc_free_msix(struct enetc_ndev_priv *priv) { @@ -2838,6 +2853,7 @@ void enetc_free_msix(struct enetc_ndev_priv *priv) /* disable all MSIX for this device */ pci_free_irq_vectors(priv->si->pdev); } +EXPORT_SYMBOL_NS_GPL(enetc_free_msix, FSL_ENETC_CORE); static void enetc_kfree_si(struct enetc_si *si) { @@ -2927,6 +2943,7 @@ int enetc_pci_probe(struct pci_dev *pdev, const char *name, int sizeof_priv) return err; } +EXPORT_SYMBOL_NS_GPL(enetc_pci_probe, FSL_ENETC_CORE); void enetc_pci_remove(struct pci_dev *pdev) { @@ -2938,3 +2955,7 @@ void enetc_pci_remove(struct pci_dev *pdev) pci_release_mem_regions(pdev); pci_disable_device(pdev); } +EXPORT_SYMBOL_NS_GPL(enetc_pci_remove, FSL_ENETC_CORE); + +MODULE_DESCRIPTION("ENETC Core"); +MODULE_LICENSE("Dual BSD/GPL"); diff --git a/drivers/net/ethernet/freescale/enetc/enetc_cbdr.c b/drivers/net/ethernet/freescale/enetc/enetc_cbdr.c index af68dc46a795..acb48ceef760 100644 --- a/drivers/net/ethernet/freescale/enetc/enetc_cbdr.c +++ b/drivers/net/ethernet/freescale/enetc/enetc_cbdr.c @@ -44,6 +44,7 @@ int enetc_setup_cbdr(struct device *dev, struct enetc_hw *hw, int bd_count, return 0; } +EXPORT_SYMBOL_NS_GPL(enetc_setup_cbdr, FSL_ENETC_CORE); void enetc_teardown_cbdr(struct enetc_cbdr *cbdr) { @@ -57,6 +58,7 @@ void enetc_teardown_cbdr(struct enetc_cbdr *cbdr) cbdr->bd_base = NULL; cbdr->dma_dev = NULL; } +EXPORT_SYMBOL_NS_GPL(enetc_teardown_cbdr, FSL_ENETC_CORE); static void enetc_clean_cbdr(struct enetc_cbdr *ring) { @@ -127,6 +129,7 @@ int enetc_send_cmd(struct enetc_si *si, struct enetc_cbd *cbd) return 0; } +EXPORT_SYMBOL_NS_GPL(enetc_send_cmd, FSL_ENETC_CORE); int enetc_clear_mac_flt_entry(struct enetc_si *si, int index) { @@ -140,6 +143,7 @@ int enetc_clear_mac_flt_entry(struct enetc_si *si, int index) return enetc_send_cmd(si, &cbd); } +EXPORT_SYMBOL_NS_GPL(enetc_clear_mac_flt_entry, FSL_ENETC_CORE); int enetc_set_mac_flt_entry(struct enetc_si *si, int index, char *mac_addr, int si_map) @@ -165,6 +169,7 @@ int enetc_set_mac_flt_entry(struct enetc_si *si, int index, return enetc_send_cmd(si, &cbd); } +EXPORT_SYMBOL_NS_GPL(enetc_set_mac_flt_entry, FSL_ENETC_CORE); /* Set entry in RFS table */ int enetc_set_fs_entry(struct enetc_si *si, struct enetc_cmd_rfse *rfse, @@ -197,6 +202,7 @@ int enetc_set_fs_entry(struct enetc_si *si, struct enetc_cmd_rfse *rfse, return err; } +EXPORT_SYMBOL_NS_GPL(enetc_set_fs_entry, FSL_ENETC_CORE); static int enetc_cmd_rss_table(struct enetc_si *si, u32 *table, int count, bool read) @@ -248,3 +254,4 @@ int enetc_set_rss_table(struct enetc_si *si, const u32 *table, int count) { return enetc_cmd_rss_table(si, (u32 *)table, count, false); } +EXPORT_SYMBOL_NS_GPL(enetc_set_rss_table, FSL_ENETC_CORE); diff --git a/drivers/net/ethernet/freescale/enetc/enetc_ethtool.c b/drivers/net/ethernet/freescale/enetc/enetc_ethtool.c index c8369e3752b0..e3d3a34fc96b 100644 --- a/drivers/net/ethernet/freescale/enetc/enetc_ethtool.c +++ b/drivers/net/ethernet/freescale/enetc/enetc_ethtool.c @@ -651,6 +651,7 @@ void enetc_set_rss_key(struct enetc_hw *hw, const u8 *bytes) for (i = 0; i < ENETC_RSSHASH_KEY_SIZE / 4; i++) enetc_port_wr(hw, ENETC_PRSSK(i), ((u32 *)bytes)[i]); } +EXPORT_SYMBOL_NS_GPL(enetc_set_rss_key, FSL_ENETC_CORE); static int enetc_set_rxfh(struct net_device *ndev, const u32 *indir, const u8 *key, const u8 hfunc) @@ -926,3 +927,4 @@ void enetc_set_ethtool_ops(struct net_device *ndev) else ndev->ethtool_ops = &enetc_vf_ethtool_ops; } +EXPORT_SYMBOL_NS_GPL(enetc_set_ethtool_ops, FSL_ENETC_CORE); diff --git a/drivers/net/ethernet/freescale/enetc/enetc_pf.c b/drivers/net/ethernet/freescale/enetc/enetc_pf.c index bdf94335ee99..b767b6a28e8b 100644 --- a/drivers/net/ethernet/freescale/enetc/enetc_pf.c +++ b/drivers/net/ethernet/freescale/enetc/enetc_pf.c @@ -1410,5 +1410,7 @@ static struct pci_driver enetc_pf_driver = { }; module_pci_driver(enetc_pf_driver); +MODULE_IMPORT_NS(FSL_ENETC_CORE); + MODULE_DESCRIPTION(ENETC_DRV_NAME_STR); MODULE_LICENSE("Dual BSD/GPL"); diff --git a/drivers/net/ethernet/freescale/enetc/enetc_vf.c b/drivers/net/ethernet/freescale/enetc/enetc_vf.c index dfcaac302e24..ab53799618c7 100644 --- a/drivers/net/ethernet/freescale/enetc/enetc_vf.c +++ b/drivers/net/ethernet/freescale/enetc/enetc_vf.c @@ -259,5 +259,7 @@ static struct pci_driver enetc_vf_driver = { }; module_pci_driver(enetc_vf_driver); +MODULE_IMPORT_NS(FSL_ENETC_CORE); + MODULE_DESCRIPTION(ENETC_DRV_NAME_STR); MODULE_LICENSE("Dual BSD/GPL");