From patchwork Sat Nov 19 23:10:52 2022 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Alexander Lobakin X-Patchwork-Id: 13049871 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 53CB0C433FE for ; Sat, 19 Nov 2022 23:12:21 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S235587AbiKSXMU (ORCPT ); Sat, 19 Nov 2022 18:12:20 -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 S235015AbiKSXLK (ORCPT ); Sat, 19 Nov 2022 18:11:10 -0500 Received: from mail-4322.protonmail.ch (mail-4322.protonmail.ch [185.70.43.22]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 622511AD8D; Sat, 19 Nov 2022 15:11:02 -0800 (PST) Date: Sat, 19 Nov 2022 23:10:52 +0000 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=pm.me; s=protonmail3; t=1668899460; x=1669158660; bh=qXAp3jTp36nfEd23id/Uz1+YLwDKQcbtNcZf8i0ukoE=; 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=OCVRh6lFR514A7UNG4ZC1uUXfW4M0cl1VhaJhCzABa22zisKoi3bUW5GatsAFOQU6 kuQMssFZPsYXGEfQjqkIfSKczcPrE5i7um4nDh/SpLYIj0kJ7V/NFuvL01QSpwRsYF UcxP9tdGM2g8FYXpqrBaJmxwDbZdBgJJhOaeYwJIDJnvFedFS0cABGgDMcNLswFpxA ZfC+F6L9sJyEr9vTQ0mJ3e/UDZ8QCLbyFQRwrsEXtcI6cOjUZr9aXz56+30VyFKld5 2Qja8UiVSq5Q4FbrP0Ge6YX7QdN178bhHaXxi6f3rjNBriOZ69FeymO94Z9L4wp/1F lcgH23xIbnYYQ== 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 18/18] net: cpsw: fix mixed module-builtin object Message-ID: <20221119225650.1044591-19-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: linux-kbuild@vger.kernel.org Apart from cpdma, there are 4 object files shared in one way or another by 5 modules: > scripts/Makefile.build:252: ./drivers/net/ethernet/ti/Makefile: > cpsw_ale.o is added to multiple modules: keystone_netcp > keystone_netcp_ethss ti_cpsw ti_cpsw_new > scripts/Makefile.build:252: ./drivers/net/ethernet/ti/Makefile: > cpsw_ethtool.o is added to multiple modules: ti_cpsw ti_cpsw_new > scripts/Makefile.build:252: ./drivers/net/ethernet/ti/Makefile: > cpsw_priv.o is added to multiple modules: ti_cpsw ti_cpsw_new > scripts/Makefile.build:252: ./drivers/net/ethernet/ti/Makefile: > cpsw_sl.o is added to multiple modules: ti_cpsw ti_cpsw_new All of those five are tristate, that means with some of the corresponding Kconfig options set to `m` and some to `y`, the same objects 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 the same code 4 x 5 = roughly 20 times. Introduce the new module, ti_cpsw_core, to provide the common functions used by all those modules. Fixes: 16f54164828b ("net: ethernet: ti: cpsw: drop CONFIG_TI_CPSW_ALE config option") Fixes: a8577e131266 ("net: ethernet: ti: netcp_ethss: fix build") Fixes: ed3525eda4c4 ("net: ethernet: ti: introduce cpsw switchdev based driver part 1 - dual-emac") Fixes: 93a76530316a ("net: ethernet: ti: introduce am65x/j721e gigabit eth subsystem driver") Suggested-by: Masahiro Yamada Signed-off-by: Alexander Lobakin --- drivers/net/ethernet/ti/Kconfig | 11 ++++++-- drivers/net/ethernet/ti/Makefile | 12 ++++---- drivers/net/ethernet/ti/am65-cpsw-nuss.c | 2 ++ drivers/net/ethernet/ti/cpsw.c | 1 + drivers/net/ethernet/ti/cpsw_ale.c | 20 +++++++++++++ drivers/net/ethernet/ti/cpsw_ethtool.c | 24 ++++++++++++++++ drivers/net/ethernet/ti/cpsw_new.c | 1 + drivers/net/ethernet/ti/cpsw_priv.c | 36 ++++++++++++++++++++++++ drivers/net/ethernet/ti/cpsw_sl.c | 8 ++++++ drivers/net/ethernet/ti/netcp_core.c | 2 ++ drivers/net/ethernet/ti/netcp_ethss.c | 2 ++ 11 files changed, 112 insertions(+), 7 deletions(-) -- 2.38.1 diff --git a/drivers/net/ethernet/ti/Kconfig b/drivers/net/ethernet/ti/Kconfig index 2ac0adf0c07d..407943735dd9 100644 --- a/drivers/net/ethernet/ti/Kconfig +++ b/drivers/net/ethernet/ti/Kconfig @@ -51,11 +51,15 @@ config TI_CPSW_PHY_SEL This driver supports configuring of the phy mode connected to the CPSW. DEPRECATED: use PHY_TI_GMII_SEL. +config TI_CPSW_CORE + tristate + select TI_DAVINCI_CPDMA + config TI_CPSW tristate "TI CPSW Switch Support" depends on ARCH_DAVINCI || ARCH_OMAP2PLUS || COMPILE_TEST depends on TI_CPTS || !TI_CPTS - select TI_DAVINCI_CPDMA + select TI_CPSW_CORE select TI_DAVINCI_MDIO select MFD_SYSCON select PAGE_POOL @@ -73,7 +77,7 @@ config TI_CPSW_SWITCHDEV depends on NET_SWITCHDEV depends on TI_CPTS || !TI_CPTS select PAGE_POOL - select TI_DAVINCI_CPDMA + select TI_CPSW_CORE select TI_DAVINCI_MDIO select MFD_SYSCON select REGMAP @@ -100,6 +104,7 @@ config TI_K3_AM65_CPSW_NUSS tristate "TI K3 AM654x/J721E CPSW Ethernet driver" depends on ARCH_K3 && OF && TI_K3_UDMA_GLUE_LAYER select NET_DEVLINK + select TI_CPSW_CORE select TI_DAVINCI_MDIO select PHYLINK imply PHY_TI_GMII_SEL @@ -147,6 +152,7 @@ config TI_AM65_CPSW_TAS config TI_KEYSTONE_NETCP tristate "TI Keystone NETCP Core Support" + select TI_CPSW_CORE select TI_DAVINCI_MDIO depends on OF depends on KEYSTONE_NAVIGATOR_DMA && KEYSTONE_NAVIGATOR_QMSS @@ -160,6 +166,7 @@ config TI_KEYSTONE_NETCP config TI_KEYSTONE_NETCP_ETHSS depends on TI_KEYSTONE_NETCP tristate "TI Keystone NETCP Ethernet subsystem Support" + select TI_CPSW_CORE help To compile this driver as a module, choose M here: the module diff --git a/drivers/net/ethernet/ti/Makefile b/drivers/net/ethernet/ti/Makefile index 28a741ed0ac8..5cda66c4b958 100644 --- a/drivers/net/ethernet/ti/Makefile +++ b/drivers/net/ethernet/ti/Makefile @@ -16,17 +16,19 @@ ti_davinci_emac-y := davinci_emac.o obj-$(CONFIG_TI_DAVINCI_MDIO) += davinci_mdio.o obj-$(CONFIG_TI_CPSW_PHY_SEL) += cpsw-phy-sel.o obj-$(CONFIG_TI_CPTS) += cpts.o +obj-$(CONFIG_TI_CPSW_CORE) += ti_cpsw_core.o +ti_cpsw_core-objs := cpsw_ale.o cpsw_ethtool.o cpsw_priv.o cpsw_sl.o obj-$(CONFIG_TI_CPSW) += ti_cpsw.o -ti_cpsw-y := cpsw.o cpsw_ale.o cpsw_priv.o cpsw_sl.o cpsw_ethtool.o +ti_cpsw-y := cpsw.o obj-$(CONFIG_TI_CPSW_SWITCHDEV) += ti_cpsw_new.o -ti_cpsw_new-y := cpsw_switchdev.o cpsw_new.o cpsw_ale.o cpsw_sl.o cpsw_priv.o cpsw_ethtool.o +ti_cpsw_new-y := cpsw_switchdev.o cpsw_new.o obj-$(CONFIG_TI_KEYSTONE_NETCP) += keystone_netcp.o -keystone_netcp-y := netcp_core.o cpsw_ale.o +keystone_netcp-y := netcp_core.o obj-$(CONFIG_TI_KEYSTONE_NETCP_ETHSS) += keystone_netcp_ethss.o -keystone_netcp_ethss-y := netcp_ethss.o netcp_sgmii.o netcp_xgbepcsr.o cpsw_ale.o +keystone_netcp_ethss-y := netcp_ethss.o netcp_sgmii.o netcp_xgbepcsr.o obj-$(CONFIG_TI_K3_AM65_CPSW_NUSS) += ti-am65-cpsw-nuss.o -ti-am65-cpsw-nuss-y := am65-cpsw-nuss.o cpsw_sl.o am65-cpsw-ethtool.o cpsw_ale.o k3-cppi-desc-pool.o am65-cpsw-qos.o +ti-am65-cpsw-nuss-y := am65-cpsw-nuss.o am65-cpsw-ethtool.o k3-cppi-desc-pool.o am65-cpsw-qos.o ti-am65-cpsw-nuss-$(CONFIG_TI_K3_AM65_CPSW_SWITCHDEV) += am65-cpsw-switchdev.o obj-$(CONFIG_TI_K3_AM65_CPTS) += am65-cpts.o diff --git a/drivers/net/ethernet/ti/am65-cpsw-nuss.c b/drivers/net/ethernet/ti/am65-cpsw-nuss.c index c50b137f92d7..e58a9b1b6690 100644 --- a/drivers/net/ethernet/ti/am65-cpsw-nuss.c +++ b/drivers/net/ethernet/ti/am65-cpsw-nuss.c @@ -2850,6 +2850,8 @@ static struct platform_driver am65_cpsw_nuss_driver = { module_platform_driver(am65_cpsw_nuss_driver); +MODULE_IMPORT_NS(TI_CPSW_CORE); + MODULE_LICENSE("GPL v2"); MODULE_AUTHOR("Grygorii Strashko "); MODULE_DESCRIPTION("TI AM65 CPSW Ethernet driver"); diff --git a/drivers/net/ethernet/ti/cpsw.c b/drivers/net/ethernet/ti/cpsw.c index b7ac61329b20..a21648dd26fe 100644 --- a/drivers/net/ethernet/ti/cpsw.c +++ b/drivers/net/ethernet/ti/cpsw.c @@ -1796,6 +1796,7 @@ static struct platform_driver cpsw_driver = { module_platform_driver(cpsw_driver); +MODULE_IMPORT_NS(TI_CPSW_CORE); MODULE_IMPORT_NS(TI_DAVINCI_CPDMA); MODULE_LICENSE("GPL"); diff --git a/drivers/net/ethernet/ti/cpsw_ale.c b/drivers/net/ethernet/ti/cpsw_ale.c index 231370e9a801..75ad7649b12e 100644 --- a/drivers/net/ethernet/ti/cpsw_ale.c +++ b/drivers/net/ethernet/ti/cpsw_ale.c @@ -452,6 +452,7 @@ int cpsw_ale_flush_multicast(struct cpsw_ale *ale, int port_mask, int vid) } return 0; } +EXPORT_SYMBOL_NS_GPL(cpsw_ale_flush_multicast, TI_CPSW_CORE); static inline void cpsw_ale_set_vlan_entry_type(u32 *ale_entry, int flags, u16 vid) @@ -489,6 +490,7 @@ int cpsw_ale_add_ucast(struct cpsw_ale *ale, const u8 *addr, int port, cpsw_ale_write(ale, idx, ale_entry); return 0; } +EXPORT_SYMBOL_NS_GPL(cpsw_ale_add_ucast, TI_CPSW_CORE); int cpsw_ale_del_ucast(struct cpsw_ale *ale, const u8 *addr, int port, int flags, u16 vid) @@ -504,6 +506,7 @@ int cpsw_ale_del_ucast(struct cpsw_ale *ale, const u8 *addr, int port, cpsw_ale_write(ale, idx, ale_entry); return 0; } +EXPORT_SYMBOL_NS_GPL(cpsw_ale_del_ucast, TI_CPSW_CORE); int cpsw_ale_add_mcast(struct cpsw_ale *ale, const u8 *addr, int port_mask, int flags, u16 vid, int mcast_state) @@ -537,6 +540,7 @@ int cpsw_ale_add_mcast(struct cpsw_ale *ale, const u8 *addr, int port_mask, cpsw_ale_write(ale, idx, ale_entry); return 0; } +EXPORT_SYMBOL_NS_GPL(cpsw_ale_add_mcast, TI_CPSW_CORE); int cpsw_ale_del_mcast(struct cpsw_ale *ale, const u8 *addr, int port_mask, int flags, u16 vid) @@ -566,6 +570,7 @@ int cpsw_ale_del_mcast(struct cpsw_ale *ale, const u8 *addr, int port_mask, cpsw_ale_write(ale, idx, ale_entry); return 0; } +EXPORT_SYMBOL_NS_GPL(cpsw_ale_del_mcast, TI_CPSW_CORE); /* ALE NetCP NU switch specific vlan functions */ static void cpsw_ale_set_vlan_mcast(struct cpsw_ale *ale, u32 *ale_entry, @@ -635,6 +640,7 @@ int cpsw_ale_add_vlan(struct cpsw_ale *ale, u16 vid, int port_mask, int untag, cpsw_ale_write(ale, idx, ale_entry); return 0; } +EXPORT_SYMBOL_NS_GPL(cpsw_ale_add_vlan, TI_CPSW_CORE); static void cpsw_ale_vlan_del_modify_int(struct cpsw_ale *ale, u32 *ale_entry, u16 vid, int port_mask) @@ -692,6 +698,7 @@ int cpsw_ale_vlan_del_modify(struct cpsw_ale *ale, u16 vid, int port_mask) return 0; } +EXPORT_SYMBOL_NS_GPL(cpsw_ale_vlan_del_modify, TI_CPSW_CORE); int cpsw_ale_del_vlan(struct cpsw_ale *ale, u16 vid, int port_mask) { @@ -726,6 +733,7 @@ int cpsw_ale_del_vlan(struct cpsw_ale *ale, u16 vid, int port_mask) return 0; } +EXPORT_SYMBOL_NS_GPL(cpsw_ale_del_vlan, TI_CPSW_CORE); int cpsw_ale_vlan_add_modify(struct cpsw_ale *ale, u16 vid, int port_mask, int untag_mask, int reg_mask, int unreg_mask) @@ -765,6 +773,7 @@ int cpsw_ale_vlan_add_modify(struct cpsw_ale *ale, u16 vid, int port_mask, return ret; } +EXPORT_SYMBOL_NS_GPL(cpsw_ale_vlan_add_modify, TI_CPSW_CORE); void cpsw_ale_set_unreg_mcast(struct cpsw_ale *ale, int unreg_mcast_mask, bool add) @@ -792,6 +801,7 @@ void cpsw_ale_set_unreg_mcast(struct cpsw_ale *ale, int unreg_mcast_mask, cpsw_ale_write(ale, idx, ale_entry); } } +EXPORT_SYMBOL_NS_GPL(cpsw_ale_set_unreg_mcast, TI_CPSW_CORE); static void cpsw_ale_vlan_set_unreg_mcast(struct cpsw_ale *ale, u32 *ale_entry, int allmulti) @@ -857,6 +867,7 @@ void cpsw_ale_set_allmulti(struct cpsw_ale *ale, int allmulti, int port) cpsw_ale_write(ale, idx, ale_entry); } } +EXPORT_SYMBOL_NS_GPL(cpsw_ale_set_allmulti, TI_CPSW_CORE); struct ale_control_info { const char *name; @@ -1114,6 +1125,7 @@ int cpsw_ale_control_set(struct cpsw_ale *ale, int port, int control, return 0; } +EXPORT_SYMBOL_NS_GPL(cpsw_ale_control_set, TI_CPSW_CORE); int cpsw_ale_control_get(struct cpsw_ale *ale, int port, int control) { @@ -1137,6 +1149,7 @@ int cpsw_ale_control_get(struct cpsw_ale *ale, int port, int control) tmp = readl_relaxed(ale->params.ale_regs + offset) >> shift; return tmp & BITMASK(info->bits); } +EXPORT_SYMBOL_NS_GPL(cpsw_ale_control_get, TI_CPSW_CORE); int cpsw_ale_rx_ratelimit_mc(struct cpsw_ale *ale, int port, unsigned int ratelimit_pps) @@ -1159,6 +1172,7 @@ int cpsw_ale_rx_ratelimit_mc(struct cpsw_ale *ale, int port, unsigned int rateli port, val * ALE_RATE_LIMIT_MIN_PPS); return 0; } +EXPORT_SYMBOL_NS_GPL(cpsw_ale_rx_ratelimit_mc, TI_CPSW_CORE); int cpsw_ale_rx_ratelimit_bc(struct cpsw_ale *ale, int port, unsigned int ratelimit_pps) @@ -1181,6 +1195,7 @@ int cpsw_ale_rx_ratelimit_bc(struct cpsw_ale *ale, int port, unsigned int rateli port, val * ALE_RATE_LIMIT_MIN_PPS); return 0; } +EXPORT_SYMBOL_NS_GPL(cpsw_ale_rx_ratelimit_bc, TI_CPSW_CORE); static void cpsw_ale_timer(struct timer_list *t) { @@ -1270,6 +1285,7 @@ void cpsw_ale_start(struct cpsw_ale *ale) cpsw_ale_aging_start(ale); } +EXPORT_SYMBOL_NS_GPL(cpsw_ale_start, TI_CPSW_CORE); void cpsw_ale_stop(struct cpsw_ale *ale) { @@ -1277,6 +1293,7 @@ void cpsw_ale_stop(struct cpsw_ale *ale) cpsw_ale_control_set(ale, 0, ALE_CLEAR, 1); cpsw_ale_control_set(ale, 0, ALE_ENABLE, 0); } +EXPORT_SYMBOL_NS_GPL(cpsw_ale_stop, TI_CPSW_CORE); static const struct cpsw_ale_dev_id cpsw_ale_id_match[] = { { @@ -1441,6 +1458,7 @@ struct cpsw_ale *cpsw_ale_create(struct cpsw_ale_params *params) cpsw_ale_control_set(ale, 0, ALE_CLEAR, 1); return ale; } +EXPORT_SYMBOL_NS_GPL(cpsw_ale_create, TI_CPSW_CORE); void cpsw_ale_dump(struct cpsw_ale *ale, u32 *data) { @@ -1451,8 +1469,10 @@ void cpsw_ale_dump(struct cpsw_ale *ale, u32 *data) data += ALE_ENTRY_WORDS; } } +EXPORT_SYMBOL_NS_GPL(cpsw_ale_dump, TI_CPSW_CORE); u32 cpsw_ale_get_num_entries(struct cpsw_ale *ale) { return ale ? ale->params.ale_entries : 0; } +EXPORT_SYMBOL_NS_GPL(cpsw_ale_get_num_entries, TI_CPSW_CORE); diff --git a/drivers/net/ethernet/ti/cpsw_ethtool.c b/drivers/net/ethernet/ti/cpsw_ethtool.c index a557a477d039..78396f84e42d 100644 --- a/drivers/net/ethernet/ti/cpsw_ethtool.c +++ b/drivers/net/ethernet/ti/cpsw_ethtool.c @@ -144,6 +144,7 @@ u32 cpsw_get_msglevel(struct net_device *ndev) return priv->msg_enable; } +EXPORT_SYMBOL_NS_GPL(cpsw_get_msglevel, TI_CPSW_CORE); void cpsw_set_msglevel(struct net_device *ndev, u32 value) { @@ -151,6 +152,7 @@ void cpsw_set_msglevel(struct net_device *ndev, u32 value) priv->msg_enable = value; } +EXPORT_SYMBOL_NS_GPL(cpsw_set_msglevel, TI_CPSW_CORE); int cpsw_get_coalesce(struct net_device *ndev, struct ethtool_coalesce *coal, struct kernel_ethtool_coalesce *kernel_coal, @@ -161,6 +163,7 @@ int cpsw_get_coalesce(struct net_device *ndev, struct ethtool_coalesce *coal, coal->rx_coalesce_usecs = cpsw->coal_intvl; return 0; } +EXPORT_SYMBOL_NS_GPL(cpsw_get_coalesce, TI_CPSW_CORE); int cpsw_set_coalesce(struct net_device *ndev, struct ethtool_coalesce *coal, struct kernel_ethtool_coalesce *kernel_coal, @@ -220,6 +223,7 @@ int cpsw_set_coalesce(struct net_device *ndev, struct ethtool_coalesce *coal, return 0; } +EXPORT_SYMBOL_NS_GPL(cpsw_set_coalesce, TI_CPSW_CORE); int cpsw_get_sset_count(struct net_device *ndev, int sset) { @@ -234,6 +238,7 @@ int cpsw_get_sset_count(struct net_device *ndev, int sset) return -EOPNOTSUPP; } } +EXPORT_SYMBOL_NS_GPL(cpsw_get_sset_count, TI_CPSW_CORE); static void cpsw_add_ch_strings(u8 **p, int ch_num, int rx_dir) { @@ -271,6 +276,7 @@ void cpsw_get_strings(struct net_device *ndev, u32 stringset, u8 *data) break; } } +EXPORT_SYMBOL_NS_GPL(cpsw_get_strings, TI_CPSW_CORE); void cpsw_get_ethtool_stats(struct net_device *ndev, struct ethtool_stats *stats, u64 *data) @@ -303,6 +309,7 @@ void cpsw_get_ethtool_stats(struct net_device *ndev, } } } +EXPORT_SYMBOL_NS_GPL(cpsw_get_ethtool_stats, TI_CPSW_CORE); void cpsw_get_pauseparam(struct net_device *ndev, struct ethtool_pauseparam *pause) @@ -313,6 +320,7 @@ void cpsw_get_pauseparam(struct net_device *ndev, pause->rx_pause = priv->rx_pause ? true : false; pause->tx_pause = priv->tx_pause ? true : false; } +EXPORT_SYMBOL_NS_GPL(cpsw_get_pauseparam, TI_CPSW_CORE); void cpsw_get_wol(struct net_device *ndev, struct ethtool_wolinfo *wol) { @@ -326,6 +334,7 @@ void cpsw_get_wol(struct net_device *ndev, struct ethtool_wolinfo *wol) if (cpsw->slaves[slave_no].phy) phy_ethtool_get_wol(cpsw->slaves[slave_no].phy, wol); } +EXPORT_SYMBOL_NS_GPL(cpsw_get_wol, TI_CPSW_CORE); int cpsw_set_wol(struct net_device *ndev, struct ethtool_wolinfo *wol) { @@ -338,6 +347,7 @@ int cpsw_set_wol(struct net_device *ndev, struct ethtool_wolinfo *wol) else return -EOPNOTSUPP; } +EXPORT_SYMBOL_NS_GPL(cpsw_set_wol, TI_CPSW_CORE); int cpsw_get_regs_len(struct net_device *ndev) { @@ -346,6 +356,7 @@ int cpsw_get_regs_len(struct net_device *ndev) return cpsw_ale_get_num_entries(cpsw->ale) * ALE_ENTRY_WORDS * sizeof(u32); } +EXPORT_SYMBOL_NS_GPL(cpsw_get_regs_len, TI_CPSW_CORE); void cpsw_get_regs(struct net_device *ndev, struct ethtool_regs *regs, void *p) { @@ -357,6 +368,7 @@ void cpsw_get_regs(struct net_device *ndev, struct ethtool_regs *regs, void *p) cpsw_ale_dump(cpsw->ale, reg); } +EXPORT_SYMBOL_NS_GPL(cpsw_get_regs, TI_CPSW_CORE); int cpsw_ethtool_op_begin(struct net_device *ndev) { @@ -370,6 +382,7 @@ int cpsw_ethtool_op_begin(struct net_device *ndev) return ret; } +EXPORT_SYMBOL_NS_GPL(cpsw_ethtool_op_begin, TI_CPSW_CORE); void cpsw_ethtool_op_complete(struct net_device *ndev) { @@ -380,6 +393,7 @@ void cpsw_ethtool_op_complete(struct net_device *ndev) if (ret < 0) cpsw_err(priv, drv, "ethtool complete failed %d\n", ret); } +EXPORT_SYMBOL_NS_GPL(cpsw_ethtool_op_complete, TI_CPSW_CORE); void cpsw_get_channels(struct net_device *ndev, struct ethtool_channels *ch) { @@ -394,6 +408,7 @@ void cpsw_get_channels(struct net_device *ndev, struct ethtool_channels *ch) ch->tx_count = cpsw->tx_ch_num; ch->combined_count = 0; } +EXPORT_SYMBOL_NS_GPL(cpsw_get_channels, TI_CPSW_CORE); int cpsw_get_link_ksettings(struct net_device *ndev, struct ethtool_link_ksettings *ecmd) @@ -408,6 +423,7 @@ int cpsw_get_link_ksettings(struct net_device *ndev, phy_ethtool_ksettings_get(cpsw->slaves[slave_no].phy, ecmd); return 0; } +EXPORT_SYMBOL_NS_GPL(cpsw_get_link_ksettings, TI_CPSW_CORE); int cpsw_set_link_ksettings(struct net_device *ndev, const struct ethtool_link_ksettings *ecmd) @@ -421,6 +437,7 @@ int cpsw_set_link_ksettings(struct net_device *ndev, return phy_ethtool_ksettings_set(cpsw->slaves[slave_no].phy, ecmd); } +EXPORT_SYMBOL_NS_GPL(cpsw_set_link_ksettings, TI_CPSW_CORE); int cpsw_get_eee(struct net_device *ndev, struct ethtool_eee *edata) { @@ -433,6 +450,7 @@ int cpsw_get_eee(struct net_device *ndev, struct ethtool_eee *edata) else return -EOPNOTSUPP; } +EXPORT_SYMBOL_NS_GPL(cpsw_get_eee, TI_CPSW_CORE); int cpsw_set_eee(struct net_device *ndev, struct ethtool_eee *edata) { @@ -445,6 +463,7 @@ int cpsw_set_eee(struct net_device *ndev, struct ethtool_eee *edata) else return -EOPNOTSUPP; } +EXPORT_SYMBOL_NS_GPL(cpsw_set_eee, TI_CPSW_CORE); int cpsw_nway_reset(struct net_device *ndev) { @@ -457,6 +476,7 @@ int cpsw_nway_reset(struct net_device *ndev) else return -EOPNOTSUPP; } +EXPORT_SYMBOL_NS_GPL(cpsw_nway_reset, TI_CPSW_CORE); static void cpsw_suspend_data_pass(struct net_device *ndev) { @@ -654,6 +674,7 @@ int cpsw_set_channels_common(struct net_device *ndev, cpsw_fail(cpsw); return ret; } +EXPORT_SYMBOL_NS_GPL(cpsw_set_channels_common, TI_CPSW_CORE); void cpsw_get_ringparam(struct net_device *ndev, struct ethtool_ringparam *ering, @@ -669,6 +690,7 @@ void cpsw_get_ringparam(struct net_device *ndev, ering->rx_max_pending = cpsw->descs_pool_size - CPSW_MAX_QUEUES; ering->rx_pending = cpdma_get_num_rx_descs(cpsw->dma); } +EXPORT_SYMBOL_NS_GPL(cpsw_get_ringparam, TI_CPSW_CORE); int cpsw_set_ringparam(struct net_device *ndev, struct ethtool_ringparam *ering, @@ -715,6 +737,7 @@ int cpsw_set_ringparam(struct net_device *ndev, cpsw_fail(cpsw); return ret; } +EXPORT_SYMBOL_NS_GPL(cpsw_set_ringparam, TI_CPSW_CORE); #if IS_ENABLED(CONFIG_TI_CPTS) int cpsw_get_ts_info(struct net_device *ndev, struct ethtool_ts_info *info) @@ -750,3 +773,4 @@ int cpsw_get_ts_info(struct net_device *ndev, struct ethtool_ts_info *info) return 0; } #endif +EXPORT_SYMBOL_NS_GPL(cpsw_get_ts_info, TI_CPSW_CORE); diff --git a/drivers/net/ethernet/ti/cpsw_new.c b/drivers/net/ethernet/ti/cpsw_new.c index 9ed398c04c04..d56b6c995252 100644 --- a/drivers/net/ethernet/ti/cpsw_new.c +++ b/drivers/net/ethernet/ti/cpsw_new.c @@ -2116,6 +2116,7 @@ static struct platform_driver cpsw_driver = { module_platform_driver(cpsw_driver); +MODULE_IMPORT_NS(TI_CPSW_CORE); MODULE_IMPORT_NS(TI_DAVINCI_CPDMA); MODULE_LICENSE("GPL"); diff --git a/drivers/net/ethernet/ti/cpsw_priv.c b/drivers/net/ethernet/ti/cpsw_priv.c index 758295c898ac..fb2c7785a71e 100644 --- a/drivers/net/ethernet/ti/cpsw_priv.c +++ b/drivers/net/ethernet/ti/cpsw_priv.c @@ -31,6 +31,7 @@ #define CPTS_N_ETX_TS 4 int (*cpsw_slave_index)(struct cpsw_common *cpsw, struct cpsw_priv *priv); +EXPORT_SYMBOL_NS_GPL(cpsw_slave_index, TI_CPSW_CORE); void cpsw_intr_enable(struct cpsw_common *cpsw) { @@ -39,6 +40,7 @@ void cpsw_intr_enable(struct cpsw_common *cpsw) cpdma_ctlr_int_ctrl(cpsw->dma, true); } +EXPORT_SYMBOL_NS_GPL(cpsw_intr_enable, TI_CPSW_CORE); void cpsw_intr_disable(struct cpsw_common *cpsw) { @@ -47,6 +49,7 @@ void cpsw_intr_disable(struct cpsw_common *cpsw) cpdma_ctlr_int_ctrl(cpsw->dma, false); } +EXPORT_SYMBOL_NS_GPL(cpsw_intr_disable, TI_CPSW_CORE); void cpsw_tx_handler(void *token, int len, int status) { @@ -81,6 +84,7 @@ void cpsw_tx_handler(void *token, int len, int status) ndev->stats.tx_packets++; ndev->stats.tx_bytes += len; } +EXPORT_SYMBOL_NS_GPL(cpsw_tx_handler, TI_CPSW_CORE); irqreturn_t cpsw_tx_interrupt(int irq, void *dev_id) { @@ -97,6 +101,7 @@ irqreturn_t cpsw_tx_interrupt(int irq, void *dev_id) napi_schedule(&cpsw->napi_tx); return IRQ_HANDLED; } +EXPORT_SYMBOL_NS_GPL(cpsw_tx_interrupt, TI_CPSW_CORE); irqreturn_t cpsw_rx_interrupt(int irq, void *dev_id) { @@ -113,6 +118,7 @@ irqreturn_t cpsw_rx_interrupt(int irq, void *dev_id) napi_schedule(&cpsw->napi_rx); return IRQ_HANDLED; } +EXPORT_SYMBOL_NS_GPL(cpsw_rx_interrupt, TI_CPSW_CORE); irqreturn_t cpsw_misc_interrupt(int irq, void *dev_id) { @@ -125,6 +131,7 @@ irqreturn_t cpsw_misc_interrupt(int irq, void *dev_id) return IRQ_HANDLED; } +EXPORT_SYMBOL_NS_GPL(cpsw_misc_interrupt, TI_CPSW_CORE); int cpsw_tx_mq_poll(struct napi_struct *napi_tx, int budget) { @@ -157,6 +164,7 @@ int cpsw_tx_mq_poll(struct napi_struct *napi_tx, int budget) return num_tx; } +EXPORT_SYMBOL_NS_GPL(cpsw_tx_mq_poll, TI_CPSW_CORE); int cpsw_tx_poll(struct napi_struct *napi_tx, int budget) { @@ -175,6 +183,7 @@ int cpsw_tx_poll(struct napi_struct *napi_tx, int budget) return num_tx; } +EXPORT_SYMBOL_NS_GPL(cpsw_tx_poll, TI_CPSW_CORE); int cpsw_rx_mq_poll(struct napi_struct *napi_rx, int budget) { @@ -207,6 +216,7 @@ int cpsw_rx_mq_poll(struct napi_struct *napi_rx, int budget) return num_rx; } +EXPORT_SYMBOL_NS_GPL(cpsw_rx_mq_poll, TI_CPSW_CORE); int cpsw_rx_poll(struct napi_struct *napi_rx, int budget) { @@ -225,6 +235,7 @@ int cpsw_rx_poll(struct napi_struct *napi_rx, int budget) return num_rx; } +EXPORT_SYMBOL_NS_GPL(cpsw_rx_poll, TI_CPSW_CORE); void cpsw_rx_vlan_encap(struct sk_buff *skb) { @@ -267,12 +278,14 @@ void cpsw_rx_vlan_encap(struct sk_buff *skb) skb_pull(skb, VLAN_HLEN); } } +EXPORT_SYMBOL_NS_GPL(cpsw_rx_vlan_encap, TI_CPSW_CORE); void cpsw_set_slave_mac(struct cpsw_slave *slave, struct cpsw_priv *priv) { slave_write(slave, mac_hi(priv->mac_addr), SA_HI); slave_write(slave, mac_lo(priv->mac_addr), SA_LO); } +EXPORT_SYMBOL_NS_GPL(cpsw_set_slave_mac, TI_CPSW_CORE); void soft_reset(const char *module, void __iomem *reg) { @@ -285,6 +298,7 @@ void soft_reset(const char *module, void __iomem *reg) WARN(readl_relaxed(reg) & 1, "failed to soft-reset %s\n", module); } +EXPORT_SYMBOL_NS_GPL(soft_reset, TI_CPSW_CORE); void cpsw_ndo_tx_timeout(struct net_device *ndev, unsigned int txqueue) { @@ -304,6 +318,7 @@ void cpsw_ndo_tx_timeout(struct net_device *ndev, unsigned int txqueue) netif_trans_update(ndev); netif_tx_wake_all_queues(ndev); } +EXPORT_SYMBOL_NS_GPL(cpsw_ndo_tx_timeout, TI_CPSW_CORE); static int cpsw_get_common_speed(struct cpsw_common *cpsw) { @@ -342,6 +357,7 @@ int cpsw_need_resplit(struct cpsw_common *cpsw) return 1; } +EXPORT_SYMBOL_NS_GPL(cpsw_need_resplit, TI_CPSW_CORE); void cpsw_split_res(struct cpsw_common *cpsw) { @@ -427,6 +443,7 @@ void cpsw_split_res(struct cpsw_common *cpsw) if (budget) cpsw->rxv[0].budget += budget; } +EXPORT_SYMBOL_NS_GPL(cpsw_split_res, TI_CPSW_CORE); int cpsw_init_common(struct cpsw_common *cpsw, void __iomem *ss_regs, int ale_ageout, phys_addr_t desc_mem_phys, @@ -547,6 +564,7 @@ int cpsw_init_common(struct cpsw_common *cpsw, void __iomem *ss_regs, return ret; } +EXPORT_SYMBOL_NS_GPL(cpsw_init_common, TI_CPSW_CORE); #if IS_ENABLED(CONFIG_TI_CPTS) @@ -728,6 +746,7 @@ int cpsw_ndo_ioctl(struct net_device *dev, struct ifreq *req, int cmd) return -EOPNOTSUPP; } +EXPORT_SYMBOL_NS_GPL(cpsw_ndo_ioctl, TI_CPSW_CORE); int cpsw_ndo_set_tx_maxrate(struct net_device *ndev, int queue, u32 rate) { @@ -777,6 +796,7 @@ int cpsw_ndo_set_tx_maxrate(struct net_device *ndev, int queue, u32 rate) cpsw_split_res(cpsw); return ret; } +EXPORT_SYMBOL_NS_GPL(cpsw_ndo_set_tx_maxrate, TI_CPSW_CORE); static int cpsw_tc_to_fifo(int tc, int num_tc) { @@ -801,6 +821,7 @@ bool cpsw_shp_is_off(struct cpsw_priv *priv) return !val; } +EXPORT_SYMBOL_NS_GPL(cpsw_shp_is_off, TI_CPSW_CORE); static void cpsw_fifo_shp_on(struct cpsw_priv *priv, int fifo, int on) { @@ -1062,6 +1083,7 @@ int cpsw_ndo_setup_tc(struct net_device *ndev, enum tc_setup_type type, return -EOPNOTSUPP; } } +EXPORT_SYMBOL_NS_GPL(cpsw_ndo_setup_tc, TI_CPSW_CORE); void cpsw_cbs_resume(struct cpsw_slave *slave, struct cpsw_priv *priv) { @@ -1075,6 +1097,7 @@ void cpsw_cbs_resume(struct cpsw_slave *slave, struct cpsw_priv *priv) cpsw_set_fifo_rlimit(priv, fifo, bw); } } +EXPORT_SYMBOL_NS_GPL(cpsw_cbs_resume, TI_CPSW_CORE); void cpsw_mqprio_resume(struct cpsw_slave *slave, struct cpsw_priv *priv) { @@ -1097,6 +1120,7 @@ void cpsw_mqprio_resume(struct cpsw_slave *slave, struct cpsw_priv *priv) slave_write(slave, tx_prio_map, tx_prio_rg); } +EXPORT_SYMBOL_NS_GPL(cpsw_mqprio_resume, TI_CPSW_CORE); int cpsw_fill_rx_channels(struct cpsw_priv *priv) { @@ -1142,6 +1166,7 @@ int cpsw_fill_rx_channels(struct cpsw_priv *priv) return 0; } +EXPORT_SYMBOL_NS_GPL(cpsw_fill_rx_channels, TI_CPSW_CORE); static struct page_pool *cpsw_create_page_pool(struct cpsw_common *cpsw, int size) @@ -1227,6 +1252,7 @@ void cpsw_destroy_xdp_rxqs(struct cpsw_common *cpsw) cpsw->page_pool[ch] = NULL; } } +EXPORT_SYMBOL_NS_GPL(cpsw_destroy_xdp_rxqs, TI_CPSW_CORE); int cpsw_create_xdp_rxqs(struct cpsw_common *cpsw) { @@ -1259,6 +1285,7 @@ int cpsw_create_xdp_rxqs(struct cpsw_common *cpsw) return ret; } +EXPORT_SYMBOL_NS_GPL(cpsw_create_xdp_rxqs, TI_CPSW_CORE); static int cpsw_xdp_prog_setup(struct cpsw_priv *priv, struct netdev_bpf *bpf) { @@ -1286,6 +1313,7 @@ int cpsw_ndo_bpf(struct net_device *ndev, struct netdev_bpf *bpf) return -EINVAL; } } +EXPORT_SYMBOL_NS_GPL(cpsw_ndo_bpf, TI_CPSW_CORE); int cpsw_xdp_tx_frame(struct cpsw_priv *priv, struct xdp_frame *xdpf, struct page *page, int port) @@ -1319,6 +1347,7 @@ int cpsw_xdp_tx_frame(struct cpsw_priv *priv, struct xdp_frame *xdpf, return ret; } +EXPORT_SYMBOL_NS_GPL(cpsw_xdp_tx_frame, TI_CPSW_CORE); int cpsw_run_xdp(struct cpsw_priv *priv, int ch, struct xdp_buff *xdp, struct page *page, int port, int *len) @@ -1381,6 +1410,7 @@ int cpsw_run_xdp(struct cpsw_priv *priv, int ch, struct xdp_buff *xdp, page_pool_recycle_direct(cpsw->page_pool[ch], page); return ret; } +EXPORT_SYMBOL_NS_GPL(cpsw_run_xdp, TI_CPSW_CORE); static int cpsw_qos_clsflower_add_policer(struct cpsw_priv *priv, struct netlink_ext_ack *extack, @@ -1580,3 +1610,9 @@ void cpsw_qos_clsflower_resume(struct cpsw_priv *priv) cpsw_ale_rx_ratelimit_mc(priv->cpsw->ale, port_id, priv->ale_mc_ratelimit.rate_packet_ps); } +EXPORT_SYMBOL_NS_GPL(cpsw_qos_clsflower_resume, TI_CPSW_CORE); + +MODULE_IMPORT_NS(TI_DAVINCI_CPDMA); + +MODULE_DESCRIPTION("TI CPSW Core Module"); +MODULE_LICENSE("GPL"); diff --git a/drivers/net/ethernet/ti/cpsw_sl.c b/drivers/net/ethernet/ti/cpsw_sl.c index 0c7531cb0f39..893e29d72213 100644 --- a/drivers/net/ethernet/ti/cpsw_sl.c +++ b/drivers/net/ethernet/ti/cpsw_sl.c @@ -200,6 +200,7 @@ u32 cpsw_sl_reg_read(struct cpsw_sl *sl, enum cpsw_sl_regs reg) dev_dbg(sl->dev, "cpsw_sl: reg: %04X r 0x%08X\n", sl->regs[reg], val); return val; } +EXPORT_SYMBOL_NS_GPL(cpsw_sl_reg_read, TI_CPSW_CORE); void cpsw_sl_reg_write(struct cpsw_sl *sl, enum cpsw_sl_regs reg, u32 val) { @@ -212,6 +213,7 @@ void cpsw_sl_reg_write(struct cpsw_sl *sl, enum cpsw_sl_regs reg, u32 val) dev_dbg(sl->dev, "cpsw_sl: reg: %04X w 0x%08X\n", sl->regs[reg], val); writel(val, sl->sl_base + sl->regs[reg]); } +EXPORT_SYMBOL_NS_GPL(cpsw_sl_reg_write, TI_CPSW_CORE); static const struct cpsw_sl_dev_id *cpsw_sl_match_id( const struct cpsw_sl_dev_id *id, @@ -252,6 +254,7 @@ struct cpsw_sl *cpsw_sl_get(const char *device_id, struct device *dev, return sl; } +EXPORT_SYMBOL_NS_GPL(cpsw_sl_get, TI_CPSW_CORE); void cpsw_sl_reset(struct cpsw_sl *sl, unsigned long tmo) { @@ -270,6 +273,7 @@ void cpsw_sl_reset(struct cpsw_sl *sl, unsigned long tmo) if (cpsw_sl_reg_read(sl, CPSW_SL_SOFT_RESET) & CPSW_SL_SOFT_RESET_BIT) dev_err(sl->dev, "cpsw_sl failed to soft-reset.\n"); } +EXPORT_SYMBOL_NS_GPL(cpsw_sl_reset, TI_CPSW_CORE); u32 cpsw_sl_ctl_set(struct cpsw_sl *sl, u32 ctl_funcs) { @@ -287,6 +291,7 @@ u32 cpsw_sl_ctl_set(struct cpsw_sl *sl, u32 ctl_funcs) return 0; } +EXPORT_SYMBOL_NS_GPL(cpsw_sl_ctl_set, TI_CPSW_CORE); u32 cpsw_sl_ctl_clr(struct cpsw_sl *sl, u32 ctl_funcs) { @@ -304,11 +309,13 @@ u32 cpsw_sl_ctl_clr(struct cpsw_sl *sl, u32 ctl_funcs) return 0; } +EXPORT_SYMBOL_NS_GPL(cpsw_sl_ctl_clr, TI_CPSW_CORE); void cpsw_sl_ctl_reset(struct cpsw_sl *sl) { cpsw_sl_reg_write(sl, CPSW_SL_MACCONTROL, 0); } +EXPORT_SYMBOL_NS_GPL(cpsw_sl_ctl_reset, TI_CPSW_CORE); int cpsw_sl_wait_for_idle(struct cpsw_sl *sl, unsigned long tmo) { @@ -326,3 +333,4 @@ int cpsw_sl_wait_for_idle(struct cpsw_sl *sl, unsigned long tmo) return 0; } +EXPORT_SYMBOL_NS_GPL(cpsw_sl_wait_for_idle, TI_CPSW_CORE); diff --git a/drivers/net/ethernet/ti/netcp_core.c b/drivers/net/ethernet/ti/netcp_core.c index aba70bef4894..7fe79626aa19 100644 --- a/drivers/net/ethernet/ti/netcp_core.c +++ b/drivers/net/ethernet/ti/netcp_core.c @@ -2275,6 +2275,8 @@ static struct platform_driver netcp_driver = { }; module_platform_driver(netcp_driver); +MODULE_IMPORT_NS(TI_CPSW_CORE); + MODULE_LICENSE("GPL v2"); MODULE_DESCRIPTION("TI NETCP driver for Keystone SOCs"); MODULE_AUTHOR("Sandeep Nair