Linux kernel mirror (for testing) git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git
kernel os linux
1
fork

Configure Feed

Select the types of activity you want to include in your feed.

net: ethernet: ti-cpsw: fix linking built-in code to modules

There are six variants of the cpsw driver, sharing various parts of
the code: davinci-emac, cpsw, cpsw-switchdev, netcp, netcp_ethss and
am65-cpsw-nuss.

I noticed that this means some files can be linked into more than
one loadable module, or even part of vmlinux but also linked into
a loadable module, both of which mess up assumptions of the build
system, and causes warnings:

scripts/Makefile.build:279: cpsw_ale.o is added to multiple modules: ti-am65-cpsw-nuss ti_cpsw ti_cpsw_new
scripts/Makefile.build:279: cpsw_priv.o is added to multiple modules: ti_cpsw ti_cpsw_new
scripts/Makefile.build:279: cpsw_sl.o is added to multiple modules: ti-am65-cpsw-nuss ti_cpsw ti_cpsw_new
scripts/Makefile.build:279: cpsw_ethtool.o is added to multiple modules: ti_cpsw ti_cpsw_new
scripts/Makefile.build:279: davinci_cpdma.o is added to multiple modules: ti_cpsw ti_cpsw_new ti_davinci_emac

Change this back to having separate modules for each portion that
can be linked standalone, exporting symbols as needed:

- ti-cpsw-common.ko now contains both cpsw-common.o and
davinci_cpdma.o as they are always used together

- ti-cpsw-priv.ko contains cpsw_priv.o, cpsw_sl.o and cpsw_ethtool.o,
which are the core of the cpsw and cpsw-new drivers.

- ti-cpsw-sl.ko contains the cpsw-sl.o object and is used on
ti-am65-cpsw-nuss.ko in addition to the two other cpsw variants.

- ti-cpsw-ale.o is the one standalone module that is used by all
except davinci_emac.

Each of these will be built-in if any of its users are built-in, otherwise
it's a loadable module if there is at least one module using it. I did
not bring back the separate Kconfig symbols for this, but just handle
it using Makefile logic.

Note: ideally this is something that Kbuild complains about, but usually
we just notice when something using THIS_MODULE misbehaves in a way that
a user notices.

Fixes: 99f6297182729 ("net: ethernet: ti: cpsw: drop TI_DAVINCI_CPDMA config option")
Link: https://lore.kernel.org/lkml/20240417084400.3034104-1-arnd@kernel.org/
Signed-off-by: Arnd Bergmann <arnd@arndb.de>
Link: https://patch.msgid.link/20260402184726.3746487-2-arnd@kernel.org
Signed-off-by: Jakub Kicinski <kuba@kernel.org>

authored by

Arnd Bergmann and committed by
Jakub Kicinski
df75bd55 961f3c53

+139 -15
+15 -15
drivers/net/ethernet/ti/Makefile
··· 6 6 obj-$(CONFIG_TI_PRUETH) += icssm-prueth.o 7 7 icssm-prueth-y := icssm/icssm_prueth.o icssm/icssm_prueth_switch.o icssm/icssm_switchdev.o 8 8 9 - obj-$(CONFIG_TI_CPSW) += cpsw-common.o 10 - obj-$(CONFIG_TI_DAVINCI_EMAC) += cpsw-common.o 11 - obj-$(CONFIG_TI_CPSW_SWITCHDEV) += cpsw-common.o 9 + ti-cpsw-common-y += cpsw-common.o davinci_cpdma.o 10 + ti-cpsw-priv-y += cpsw_priv.o cpsw_ethtool.o 11 + ti-cpsw-ale-y += cpsw_ale.o 12 + ti-cpsw-sl-y += cpsw_sl.o 12 13 13 14 obj-$(CONFIG_TLAN) += tlan.o 14 - obj-$(CONFIG_TI_DAVINCI_EMAC) += ti_davinci_emac.o 15 - ti_davinci_emac-y := davinci_emac.o davinci_cpdma.o 15 + obj-$(CONFIG_TI_DAVINCI_EMAC) += davinci_emac.o ti-cpsw-common.o 16 16 obj-$(CONFIG_TI_DAVINCI_MDIO) += davinci_mdio.o 17 17 obj-$(CONFIG_TI_CPSW_PHY_SEL) += cpsw-phy-sel.o 18 18 obj-$(CONFIG_TI_CPTS) += cpts.o 19 - obj-$(CONFIG_TI_CPSW) += ti_cpsw.o 20 - ti_cpsw-y := cpsw.o davinci_cpdma.o cpsw_ale.o cpsw_priv.o cpsw_sl.o cpsw_ethtool.o 21 - obj-$(CONFIG_TI_CPSW_SWITCHDEV) += ti_cpsw_new.o 22 - ti_cpsw_new-y := cpsw_switchdev.o cpsw_new.o davinci_cpdma.o cpsw_ale.o cpsw_sl.o cpsw_priv.o cpsw_ethtool.o 19 + obj-$(CONFIG_TI_CPSW) += ti_cpsw.o ti-cpsw-common.o ti-cpsw-priv.o ti-cpsw-ale.o ti-cpsw-sl.o 20 + ti_cpsw-y := cpsw.o 21 + obj-$(CONFIG_TI_CPSW_SWITCHDEV) += ti_cpsw_new.o ti-cpsw-common.o ti-cpsw-priv.o ti-cpsw-ale.o ti-cpsw-sl.o 22 + ti_cpsw_new-y := cpsw_switchdev.o cpsw_new.o 23 23 24 - obj-$(CONFIG_TI_KEYSTONE_NETCP) += keystone_netcp.o 25 - keystone_netcp-y := netcp_core.o cpsw_ale.o 26 - obj-$(CONFIG_TI_KEYSTONE_NETCP_ETHSS) += keystone_netcp_ethss.o 27 - keystone_netcp_ethss-y := netcp_ethss.o netcp_sgmii.o netcp_xgbepcsr.o cpsw_ale.o 24 + obj-$(CONFIG_TI_KEYSTONE_NETCP) += keystone_netcp.o ti-cpsw-ale.o 25 + keystone_netcp-y := netcp_core.o 26 + obj-$(CONFIG_TI_KEYSTONE_NETCP_ETHSS) += keystone_netcp_ethss.o ti-cpsw-ale.o 27 + keystone_netcp_ethss-y := netcp_ethss.o netcp_sgmii.o netcp_xgbepcsr.o 28 28 29 29 obj-$(CONFIG_TI_K3_CPPI_DESC_POOL) += k3-cppi-desc-pool.o 30 30 31 - obj-$(CONFIG_TI_K3_AM65_CPSW_NUSS) += ti-am65-cpsw-nuss.o 32 - ti-am65-cpsw-nuss-y := am65-cpsw-nuss.o cpsw_sl.o am65-cpsw-ethtool.o cpsw_ale.o 31 + obj-$(CONFIG_TI_K3_AM65_CPSW_NUSS) += ti-am65-cpsw-nuss.o ti-cpsw-sl.o ti-cpsw-ale.o 32 + ti-am65-cpsw-nuss-y := am65-cpsw-nuss.o am65-cpsw-ethtool.o 33 33 ti-am65-cpsw-nuss-$(CONFIG_TI_AM65_CPSW_QOS) += am65-cpsw-qos.o 34 34 ti-am65-cpsw-nuss-$(CONFIG_TI_K3_AM65_CPSW_SWITCHDEV) += am65-cpsw-switchdev.o 35 35 obj-$(CONFIG_TI_K3_AM65_CPTS) += am65-cpts.o
+25
drivers/net/ethernet/ti/cpsw_ale.c
··· 493 493 } 494 494 return 0; 495 495 } 496 + EXPORT_SYMBOL_GPL(cpsw_ale_flush_multicast); 496 497 497 498 static inline void cpsw_ale_set_vlan_entry_type(u32 *ale_entry, 498 499 int flags, u16 vid) ··· 531 530 cpsw_ale_write(ale, idx, ale_entry); 532 531 return 0; 533 532 } 533 + EXPORT_SYMBOL_GPL(cpsw_ale_add_ucast); 534 534 535 535 int cpsw_ale_del_ucast(struct cpsw_ale *ale, const u8 *addr, int port, 536 536 int flags, u16 vid) ··· 547 545 cpsw_ale_write(ale, idx, ale_entry); 548 546 return 0; 549 547 } 548 + EXPORT_SYMBOL_GPL(cpsw_ale_del_ucast); 550 549 551 550 int cpsw_ale_add_mcast(struct cpsw_ale *ale, const u8 *addr, int port_mask, 552 551 int flags, u16 vid, int mcast_state) ··· 581 578 cpsw_ale_write(ale, idx, ale_entry); 582 579 return 0; 583 580 } 581 + EXPORT_SYMBOL_GPL(cpsw_ale_add_mcast); 584 582 585 583 int cpsw_ale_del_mcast(struct cpsw_ale *ale, const u8 *addr, int port_mask, 586 584 int flags, u16 vid) ··· 611 607 cpsw_ale_write(ale, idx, ale_entry); 612 608 return 0; 613 609 } 610 + EXPORT_SYMBOL_GPL(cpsw_ale_del_mcast); 614 611 615 612 /* ALE NetCP NU switch specific vlan functions */ 616 613 static void cpsw_ale_set_vlan_mcast(struct cpsw_ale *ale, u32 *ale_entry, ··· 681 676 cpsw_ale_write(ale, idx, ale_entry); 682 677 return 0; 683 678 } 679 + EXPORT_SYMBOL_GPL(cpsw_ale_add_vlan); 684 680 685 681 static void cpsw_ale_vlan_del_modify_int(struct cpsw_ale *ale, u32 *ale_entry, 686 682 u16 vid, int port_mask) ··· 739 733 740 734 return 0; 741 735 } 736 + EXPORT_SYMBOL_GPL(cpsw_ale_vlan_del_modify); 742 737 743 738 int cpsw_ale_del_vlan(struct cpsw_ale *ale, u16 vid, int port_mask) 744 739 { ··· 774 767 775 768 return 0; 776 769 } 770 + EXPORT_SYMBOL_GPL(cpsw_ale_del_vlan); 777 771 778 772 int cpsw_ale_vlan_add_modify(struct cpsw_ale *ale, u16 vid, int port_mask, 779 773 int untag_mask, int reg_mask, int unreg_mask) ··· 814 806 815 807 return ret; 816 808 } 809 + EXPORT_SYMBOL_GPL(cpsw_ale_vlan_add_modify); 817 810 818 811 void cpsw_ale_set_unreg_mcast(struct cpsw_ale *ale, int unreg_mcast_mask, 819 812 bool add) ··· 842 833 cpsw_ale_write(ale, idx, ale_entry); 843 834 } 844 835 } 836 + EXPORT_SYMBOL_GPL(cpsw_ale_set_unreg_mcast); 845 837 846 838 static void cpsw_ale_vlan_set_unreg_mcast(struct cpsw_ale *ale, u32 *ale_entry, 847 839 int allmulti) ··· 908 898 cpsw_ale_write(ale, idx, ale_entry); 909 899 } 910 900 } 901 + EXPORT_SYMBOL_GPL(cpsw_ale_set_allmulti); 911 902 912 903 struct ale_control_info { 913 904 const char *name; ··· 1166 1155 1167 1156 return 0; 1168 1157 } 1158 + EXPORT_SYMBOL_GPL(cpsw_ale_control_set); 1169 1159 1170 1160 int cpsw_ale_control_get(struct cpsw_ale *ale, int port, int control) 1171 1161 { ··· 1190 1178 tmp = readl_relaxed(ale->params.ale_regs + offset) >> shift; 1191 1179 return tmp & BITMASK(info->bits); 1192 1180 } 1181 + EXPORT_SYMBOL_GPL(cpsw_ale_control_get); 1193 1182 1194 1183 int cpsw_ale_rx_ratelimit_mc(struct cpsw_ale *ale, int port, unsigned int ratelimit_pps) 1195 1184 ··· 1213 1200 port, val * ALE_RATE_LIMIT_MIN_PPS); 1214 1201 return 0; 1215 1202 } 1203 + EXPORT_SYMBOL_GPL(cpsw_ale_rx_ratelimit_mc); 1216 1204 1217 1205 int cpsw_ale_rx_ratelimit_bc(struct cpsw_ale *ale, int port, unsigned int ratelimit_pps) 1218 1206 ··· 1236 1222 port, val * ALE_RATE_LIMIT_MIN_PPS); 1237 1223 return 0; 1238 1224 } 1225 + EXPORT_SYMBOL_GPL(cpsw_ale_rx_ratelimit_bc); 1239 1226 1240 1227 static void cpsw_ale_timer(struct timer_list *t) 1241 1228 { ··· 1326 1311 1327 1312 cpsw_ale_aging_start(ale); 1328 1313 } 1314 + EXPORT_SYMBOL_GPL(cpsw_ale_start); 1329 1315 1330 1316 void cpsw_ale_stop(struct cpsw_ale *ale) 1331 1317 { ··· 1334 1318 cpsw_ale_control_set(ale, 0, ALE_CLEAR, 1); 1335 1319 cpsw_ale_control_set(ale, 0, ALE_ENABLE, 0); 1336 1320 } 1321 + EXPORT_SYMBOL_GPL(cpsw_ale_stop); 1337 1322 1338 1323 static const struct reg_field ale_fields_cpsw[] = { 1339 1324 /* CPSW_ALE_IDVER_REG */ ··· 1635 1618 cpsw_ale_control_set(ale, 0, ALE_CLEAR, 1); 1636 1619 return ale; 1637 1620 } 1621 + EXPORT_SYMBOL_GPL(cpsw_ale_create); 1638 1622 1639 1623 void cpsw_ale_dump(struct cpsw_ale *ale, u32 *data) 1640 1624 { ··· 1646 1628 data += ALE_ENTRY_WORDS; 1647 1629 } 1648 1630 } 1631 + EXPORT_SYMBOL_GPL(cpsw_ale_dump); 1649 1632 1650 1633 void cpsw_ale_restore(struct cpsw_ale *ale, u32 *data) 1651 1634 { ··· 1657 1638 data += ALE_ENTRY_WORDS; 1658 1639 } 1659 1640 } 1641 + EXPORT_SYMBOL_GPL(cpsw_ale_restore); 1660 1642 1661 1643 u32 cpsw_ale_get_num_entries(struct cpsw_ale *ale) 1662 1644 { 1663 1645 return ale ? ale->params.ale_entries : 0; 1664 1646 } 1647 + EXPORT_SYMBOL_GPL(cpsw_ale_get_num_entries); 1665 1648 1666 1649 /* Reads the specified policer index into ALE POLICER registers */ 1667 1650 static void cpsw_ale_policer_read_idx(struct cpsw_ale *ale, u32 idx) ··· 1766 1745 1); 1767 1746 } 1768 1747 } 1748 + EXPORT_SYMBOL_GPL(cpsw_ale_classifier_setup_default); 1749 + 1750 + MODULE_LICENSE("GPL"); 1751 + MODULE_DESCRIPTION("TI N-Port Ethernet Switch Address Lookup Engine");
+24
drivers/net/ethernet/ti/cpsw_ethtool.c
··· 144 144 145 145 return priv->msg_enable; 146 146 } 147 + EXPORT_SYMBOL_GPL(cpsw_get_msglevel); 147 148 148 149 void cpsw_set_msglevel(struct net_device *ndev, u32 value) 149 150 { ··· 152 151 153 152 priv->msg_enable = value; 154 153 } 154 + EXPORT_SYMBOL_GPL(cpsw_set_msglevel); 155 155 156 156 int cpsw_get_coalesce(struct net_device *ndev, struct ethtool_coalesce *coal, 157 157 struct kernel_ethtool_coalesce *kernel_coal, ··· 163 161 coal->rx_coalesce_usecs = cpsw->coal_intvl; 164 162 return 0; 165 163 } 164 + EXPORT_SYMBOL_GPL(cpsw_get_coalesce); 166 165 167 166 int cpsw_set_coalesce(struct net_device *ndev, struct ethtool_coalesce *coal, 168 167 struct kernel_ethtool_coalesce *kernel_coal, ··· 223 220 224 221 return 0; 225 222 } 223 + EXPORT_SYMBOL_GPL(cpsw_set_coalesce); 226 224 227 225 int cpsw_get_sset_count(struct net_device *ndev, int sset) 228 226 { ··· 238 234 return -EOPNOTSUPP; 239 235 } 240 236 } 237 + EXPORT_SYMBOL_GPL(cpsw_get_sset_count); 241 238 242 239 static void cpsw_add_ch_strings(u8 **p, int ch_num, int rx_dir) 243 240 { ··· 276 271 break; 277 272 } 278 273 } 274 + EXPORT_SYMBOL_GPL(cpsw_get_strings); 279 275 280 276 void cpsw_get_ethtool_stats(struct net_device *ndev, 281 277 struct ethtool_stats *stats, u64 *data) ··· 309 303 } 310 304 } 311 305 } 306 + EXPORT_SYMBOL_GPL(cpsw_get_ethtool_stats); 312 307 313 308 void cpsw_get_pauseparam(struct net_device *ndev, 314 309 struct ethtool_pauseparam *pause) ··· 320 313 pause->rx_pause = priv->rx_pause ? true : false; 321 314 pause->tx_pause = priv->tx_pause ? true : false; 322 315 } 316 + EXPORT_SYMBOL_GPL(cpsw_get_pauseparam); 323 317 324 318 void cpsw_get_wol(struct net_device *ndev, struct ethtool_wolinfo *wol) 325 319 { ··· 334 326 if (cpsw->slaves[slave_no].phy) 335 327 phy_ethtool_get_wol(cpsw->slaves[slave_no].phy, wol); 336 328 } 329 + EXPORT_SYMBOL_GPL(cpsw_get_wol); 337 330 338 331 int cpsw_set_wol(struct net_device *ndev, struct ethtool_wolinfo *wol) 339 332 { ··· 347 338 else 348 339 return -EOPNOTSUPP; 349 340 } 341 + EXPORT_SYMBOL_GPL(cpsw_set_wol); 350 342 351 343 int cpsw_get_regs_len(struct net_device *ndev) 352 344 { ··· 356 346 return cpsw_ale_get_num_entries(cpsw->ale) * 357 347 ALE_ENTRY_WORDS * sizeof(u32); 358 348 } 349 + EXPORT_SYMBOL_GPL(cpsw_get_regs_len); 359 350 360 351 void cpsw_get_regs(struct net_device *ndev, struct ethtool_regs *regs, void *p) 361 352 { ··· 368 357 369 358 cpsw_ale_dump(cpsw->ale, reg); 370 359 } 360 + EXPORT_SYMBOL_GPL(cpsw_get_regs); 371 361 372 362 int cpsw_ethtool_op_begin(struct net_device *ndev) 373 363 { ··· 382 370 383 371 return ret; 384 372 } 373 + EXPORT_SYMBOL_GPL(cpsw_ethtool_op_begin); 385 374 386 375 void cpsw_ethtool_op_complete(struct net_device *ndev) 387 376 { ··· 390 377 391 378 pm_runtime_put(priv->cpsw->dev); 392 379 } 380 + EXPORT_SYMBOL_GPL(cpsw_ethtool_op_complete); 393 381 394 382 void cpsw_get_channels(struct net_device *ndev, struct ethtool_channels *ch) 395 383 { ··· 405 391 ch->tx_count = cpsw->tx_ch_num; 406 392 ch->combined_count = 0; 407 393 } 394 + EXPORT_SYMBOL_GPL(cpsw_get_channels); 408 395 409 396 int cpsw_get_link_ksettings(struct net_device *ndev, 410 397 struct ethtool_link_ksettings *ecmd) ··· 420 405 phy_ethtool_ksettings_get(cpsw->slaves[slave_no].phy, ecmd); 421 406 return 0; 422 407 } 408 + EXPORT_SYMBOL_GPL(cpsw_get_link_ksettings); 423 409 424 410 int cpsw_set_link_ksettings(struct net_device *ndev, 425 411 const struct ethtool_link_ksettings *ecmd) ··· 434 418 435 419 return phy_ethtool_ksettings_set(cpsw->slaves[slave_no].phy, ecmd); 436 420 } 421 + EXPORT_SYMBOL_GPL(cpsw_set_link_ksettings); 437 422 438 423 int cpsw_get_eee(struct net_device *ndev, struct ethtool_keee *edata) 439 424 { ··· 447 430 else 448 431 return -EOPNOTSUPP; 449 432 } 433 + EXPORT_SYMBOL_GPL(cpsw_get_eee); 450 434 451 435 int cpsw_nway_reset(struct net_device *ndev) 452 436 { ··· 460 442 else 461 443 return -EOPNOTSUPP; 462 444 } 445 + EXPORT_SYMBOL_GPL(cpsw_nway_reset); 463 446 464 447 static void cpsw_suspend_data_pass(struct net_device *ndev) 465 448 { ··· 658 639 cpsw_fail(cpsw); 659 640 return ret; 660 641 } 642 + EXPORT_SYMBOL_GPL(cpsw_set_channels_common); 661 643 662 644 void cpsw_get_ringparam(struct net_device *ndev, 663 645 struct ethtool_ringparam *ering, ··· 674 654 ering->rx_max_pending = cpsw->descs_pool_size - CPSW_MAX_QUEUES; 675 655 ering->rx_pending = cpdma_get_num_rx_descs(cpsw->dma); 676 656 } 657 + EXPORT_SYMBOL_GPL(cpsw_get_ringparam); 677 658 678 659 int cpsw_set_ringparam(struct net_device *ndev, 679 660 struct ethtool_ringparam *ering, ··· 721 700 cpsw_fail(cpsw); 722 701 return ret; 723 702 } 703 + EXPORT_SYMBOL_GPL(cpsw_set_ringparam); 724 704 725 705 #if IS_ENABLED(CONFIG_TI_CPTS) 726 706 int cpsw_get_ts_info(struct net_device *ndev, struct kernel_ethtool_ts_info *info) ··· 742 720 (1 << HWTSTAMP_FILTER_PTP_V2_EVENT); 743 721 return 0; 744 722 } 723 + EXPORT_SYMBOL_GPL(cpsw_get_ts_info); 745 724 #else 746 725 int cpsw_get_ts_info(struct net_device *ndev, struct kernel_ethtool_ts_info *info) 747 726 { ··· 752 729 info->rx_filters = 0; 753 730 return 0; 754 731 } 732 + EXPORT_SYMBOL_GPL(cpsw_get_ts_info); 755 733 #endif
+37
drivers/net/ethernet/ti/cpsw_priv.c
··· 32 32 #define CPTS_N_ETX_TS 4 33 33 34 34 int (*cpsw_slave_index)(struct cpsw_common *cpsw, struct cpsw_priv *priv); 35 + EXPORT_SYMBOL_GPL(cpsw_slave_index); 35 36 36 37 void cpsw_intr_enable(struct cpsw_common *cpsw) 37 38 { ··· 41 40 42 41 cpdma_ctlr_int_ctrl(cpsw->dma, true); 43 42 } 43 + EXPORT_SYMBOL_GPL(cpsw_intr_enable); 44 44 45 45 void cpsw_intr_disable(struct cpsw_common *cpsw) 46 46 { ··· 50 48 51 49 cpdma_ctlr_int_ctrl(cpsw->dma, false); 52 50 } 51 + EXPORT_SYMBOL_GPL(cpsw_intr_disable); 53 52 54 53 void cpsw_tx_handler(void *token, int len, int status) 55 54 { ··· 85 82 ndev->stats.tx_packets++; 86 83 ndev->stats.tx_bytes += len; 87 84 } 85 + EXPORT_SYMBOL_GPL(cpsw_tx_handler); 88 86 89 87 irqreturn_t cpsw_tx_interrupt(int irq, void *dev_id) 90 88 { ··· 102 98 napi_schedule(&cpsw->napi_tx); 103 99 return IRQ_HANDLED; 104 100 } 101 + EXPORT_SYMBOL_GPL(cpsw_tx_interrupt); 105 102 106 103 irqreturn_t cpsw_rx_interrupt(int irq, void *dev_id) 107 104 { ··· 119 114 napi_schedule(&cpsw->napi_rx); 120 115 return IRQ_HANDLED; 121 116 } 117 + EXPORT_SYMBOL_GPL(cpsw_rx_interrupt); 122 118 123 119 irqreturn_t cpsw_misc_interrupt(int irq, void *dev_id) 124 120 { ··· 132 126 133 127 return IRQ_HANDLED; 134 128 } 129 + EXPORT_SYMBOL_GPL(cpsw_misc_interrupt); 135 130 136 131 int cpsw_tx_mq_poll(struct napi_struct *napi_tx, int budget) 137 132 { ··· 165 158 166 159 return num_tx; 167 160 } 161 + EXPORT_SYMBOL_GPL(cpsw_tx_mq_poll); 168 162 169 163 int cpsw_tx_poll(struct napi_struct *napi_tx, int budget) 170 164 { ··· 184 176 185 177 return num_tx; 186 178 } 179 + EXPORT_SYMBOL_GPL(cpsw_tx_poll); 187 180 188 181 int cpsw_rx_mq_poll(struct napi_struct *napi_rx, int budget) 189 182 { ··· 217 208 218 209 return num_rx; 219 210 } 211 + EXPORT_SYMBOL_GPL(cpsw_rx_mq_poll); 220 212 221 213 int cpsw_rx_poll(struct napi_struct *napi_rx, int budget) 222 214 { ··· 236 226 237 227 return num_rx; 238 228 } 229 + EXPORT_SYMBOL_GPL(cpsw_rx_poll); 239 230 240 231 void cpsw_rx_vlan_encap(struct sk_buff *skb) 241 232 { ··· 279 268 skb_pull(skb, VLAN_HLEN); 280 269 } 281 270 } 271 + EXPORT_SYMBOL_GPL(cpsw_rx_vlan_encap); 282 272 283 273 void cpsw_set_slave_mac(struct cpsw_slave *slave, struct cpsw_priv *priv) 284 274 { 285 275 slave_write(slave, mac_hi(priv->mac_addr), SA_HI); 286 276 slave_write(slave, mac_lo(priv->mac_addr), SA_LO); 287 277 } 278 + EXPORT_SYMBOL_GPL(cpsw_set_slave_mac); 288 279 289 280 void cpsw_soft_reset(const char *module, void __iomem *reg) 290 281 { ··· 299 286 300 287 WARN(readl_relaxed(reg) & 1, "failed to soft-reset %s\n", module); 301 288 } 289 + EXPORT_SYMBOL_GPL(cpsw_soft_reset); 302 290 303 291 void cpsw_ndo_tx_timeout(struct net_device *ndev, unsigned int txqueue) 304 292 { ··· 319 305 netif_trans_update(ndev); 320 306 netif_tx_wake_all_queues(ndev); 321 307 } 308 + EXPORT_SYMBOL_GPL(cpsw_ndo_tx_timeout); 322 309 323 310 static int cpsw_get_common_speed(struct cpsw_common *cpsw) 324 311 { ··· 358 343 359 344 return 1; 360 345 } 346 + EXPORT_SYMBOL_GPL(cpsw_need_resplit); 361 347 362 348 void cpsw_split_res(struct cpsw_common *cpsw) 363 349 { ··· 444 428 if (budget) 445 429 cpsw->rxv[0].budget += budget; 446 430 } 431 + EXPORT_SYMBOL_GPL(cpsw_split_res); 447 432 448 433 int cpsw_init_common(struct cpsw_common *cpsw, void __iomem *ss_regs, 449 434 int ale_ageout, phys_addr_t desc_mem_phys, ··· 565 548 566 549 return ret; 567 550 } 551 + EXPORT_SYMBOL_GPL(cpsw_init_common); 568 552 569 553 #if IS_ENABLED(CONFIG_TI_CPTS) 570 554 ··· 696 678 697 679 return 0; 698 680 } 681 + EXPORT_SYMBOL_GPL(cpsw_hwtstamp_set); 699 682 700 683 int cpsw_hwtstamp_get(struct net_device *dev, 701 684 struct kernel_hwtstamp_config *cfg) ··· 714 695 715 696 return 0; 716 697 } 698 + EXPORT_SYMBOL_GPL(cpsw_hwtstamp_get); 717 699 #else 718 700 int cpsw_hwtstamp_get(struct net_device *dev, 719 701 struct kernel_hwtstamp_config *cfg) 720 702 { 721 703 return -EOPNOTSUPP; 722 704 } 705 + EXPORT_SYMBOL_GPL(cpsw_hwtstamp_set); 723 706 724 707 int cpsw_hwtstamp_set(struct net_device *dev, 725 708 struct kernel_hwtstamp_config *cfg, ··· 729 708 { 730 709 return -EOPNOTSUPP; 731 710 } 711 + EXPORT_SYMBOL_GPL(cpsw_hwtstamp_get); 732 712 #endif /*CONFIG_TI_CPTS*/ 733 713 734 714 int cpsw_ndo_set_tx_maxrate(struct net_device *ndev, int queue, u32 rate) ··· 780 758 cpsw_split_res(cpsw); 781 759 return ret; 782 760 } 761 + EXPORT_SYMBOL_GPL(cpsw_ndo_set_tx_maxrate); 783 762 784 763 static int cpsw_tc_to_fifo(int tc, int num_tc) 785 764 { ··· 805 782 806 783 return !val; 807 784 } 785 + EXPORT_SYMBOL_GPL(cpsw_shp_is_off); 808 786 809 787 static void cpsw_fifo_shp_on(struct cpsw_priv *priv, int fifo, int on) 810 788 { ··· 1067 1043 return -EOPNOTSUPP; 1068 1044 } 1069 1045 } 1046 + EXPORT_SYMBOL_GPL(cpsw_ndo_setup_tc); 1070 1047 1071 1048 void cpsw_cbs_resume(struct cpsw_slave *slave, struct cpsw_priv *priv) 1072 1049 { ··· 1081 1056 cpsw_set_fifo_rlimit(priv, fifo, bw); 1082 1057 } 1083 1058 } 1059 + EXPORT_SYMBOL_GPL(cpsw_cbs_resume); 1084 1060 1085 1061 void cpsw_mqprio_resume(struct cpsw_slave *slave, struct cpsw_priv *priv) 1086 1062 { ··· 1104 1078 1105 1079 slave_write(slave, tx_prio_map, tx_prio_rg); 1106 1080 } 1081 + EXPORT_SYMBOL_GPL(cpsw_mqprio_resume); 1107 1082 1108 1083 int cpsw_fill_rx_channels(struct cpsw_priv *priv) 1109 1084 { ··· 1150 1123 1151 1124 return 0; 1152 1125 } 1126 + EXPORT_SYMBOL_GPL(cpsw_fill_rx_channels); 1153 1127 1154 1128 static struct page_pool *cpsw_create_page_pool(struct cpsw_common *cpsw, 1155 1129 int size) ··· 1236 1208 cpsw->page_pool[ch] = NULL; 1237 1209 } 1238 1210 } 1211 + EXPORT_SYMBOL_GPL(cpsw_destroy_xdp_rxqs); 1239 1212 1240 1213 int cpsw_create_xdp_rxqs(struct cpsw_common *cpsw) 1241 1214 { ··· 1269 1240 1270 1241 return ret; 1271 1242 } 1243 + EXPORT_SYMBOL_GPL(cpsw_create_xdp_rxqs); 1272 1244 1273 1245 static int cpsw_xdp_prog_setup(struct cpsw_priv *priv, struct netdev_bpf *bpf) 1274 1246 { ··· 1297 1267 return -EINVAL; 1298 1268 } 1299 1269 } 1270 + EXPORT_SYMBOL_GPL(cpsw_ndo_bpf); 1300 1271 1301 1272 int cpsw_xdp_tx_frame(struct cpsw_priv *priv, struct xdp_frame *xdpf, 1302 1273 struct page *page, int port) ··· 1331 1300 1332 1301 return ret; 1333 1302 } 1303 + EXPORT_SYMBOL_GPL(cpsw_xdp_tx_frame); 1334 1304 1335 1305 int cpsw_run_xdp(struct cpsw_priv *priv, int ch, struct xdp_buff *xdp, 1336 1306 struct page *page, int port, int *len) ··· 1394 1362 page_pool_recycle_direct(cpsw->page_pool[ch], page); 1395 1363 return ret; 1396 1364 } 1365 + EXPORT_SYMBOL_GPL(cpsw_run_xdp); 1397 1366 1398 1367 static int cpsw_qos_clsflower_add_policer(struct cpsw_priv *priv, 1399 1368 struct netlink_ext_ack *extack, ··· 1597 1564 cpsw_ale_rx_ratelimit_mc(priv->cpsw->ale, port_id, 1598 1565 priv->ale_mc_ratelimit.rate_packet_ps); 1599 1566 } 1567 + EXPORT_SYMBOL_GPL(cpsw_qos_clsflower_resume); 1568 + 1569 + MODULE_LICENSE("GPL"); 1570 + MODULE_DESCRIPTION("TI CPSW Ethernet Switch Driver");
+11
drivers/net/ethernet/ti/cpsw_sl.c
··· 200 200 dev_dbg(sl->dev, "cpsw_sl: reg: %04X r 0x%08X\n", sl->regs[reg], val); 201 201 return val; 202 202 } 203 + EXPORT_SYMBOL_GPL(cpsw_sl_reg_read); 203 204 204 205 void cpsw_sl_reg_write(struct cpsw_sl *sl, enum cpsw_sl_regs reg, u32 val) 205 206 { ··· 213 212 dev_dbg(sl->dev, "cpsw_sl: reg: %04X w 0x%08X\n", sl->regs[reg], val); 214 213 writel(val, sl->sl_base + sl->regs[reg]); 215 214 } 215 + EXPORT_SYMBOL_GPL(cpsw_sl_reg_write); 216 216 217 217 static const struct cpsw_sl_dev_id *cpsw_sl_match_id( 218 218 const struct cpsw_sl_dev_id *id, ··· 254 252 255 253 return sl; 256 254 } 255 + EXPORT_SYMBOL_GPL(cpsw_sl_get); 257 256 258 257 void cpsw_sl_reset(struct cpsw_sl *sl, unsigned long tmo) 259 258 { ··· 273 270 if (cpsw_sl_reg_read(sl, CPSW_SL_SOFT_RESET) & CPSW_SL_SOFT_RESET_BIT) 274 271 dev_err(sl->dev, "cpsw_sl failed to soft-reset.\n"); 275 272 } 273 + EXPORT_SYMBOL_GPL(cpsw_sl_reset); 276 274 277 275 u32 cpsw_sl_ctl_set(struct cpsw_sl *sl, u32 ctl_funcs) 278 276 { ··· 291 287 292 288 return 0; 293 289 } 290 + EXPORT_SYMBOL_GPL(cpsw_sl_ctl_set); 294 291 295 292 u32 cpsw_sl_ctl_clr(struct cpsw_sl *sl, u32 ctl_funcs) 296 293 { ··· 309 304 310 305 return 0; 311 306 } 307 + EXPORT_SYMBOL_GPL(cpsw_sl_ctl_clr); 312 308 313 309 void cpsw_sl_ctl_reset(struct cpsw_sl *sl) 314 310 { 315 311 cpsw_sl_reg_write(sl, CPSW_SL_MACCONTROL, 0); 316 312 } 313 + EXPORT_SYMBOL_GPL(cpsw_sl_ctl_reset); 317 314 318 315 int cpsw_sl_wait_for_idle(struct cpsw_sl *sl, unsigned long tmo) 319 316 { ··· 333 326 334 327 return 0; 335 328 } 329 + EXPORT_SYMBOL_GPL(cpsw_sl_wait_for_idle); 330 + 331 + MODULE_LICENSE("GPL"); 332 + MODULE_DESCRIPTION("TI Ethernet Switch media-access-controller (MAC) submodule");
+27
drivers/net/ethernet/ti/davinci_cpdma.c
··· 531 531 ctlr->num_chan = CPDMA_MAX_CHANNELS; 532 532 return ctlr; 533 533 } 534 + EXPORT_SYMBOL_GPL(cpdma_ctlr_create); 534 535 535 536 int cpdma_ctlr_start(struct cpdma_ctlr *ctlr) 536 537 { ··· 592 591 spin_unlock_irqrestore(&ctlr->lock, flags); 593 592 return 0; 594 593 } 594 + EXPORT_SYMBOL_GPL(cpdma_ctlr_start); 595 595 596 596 int cpdma_ctlr_stop(struct cpdma_ctlr *ctlr) 597 597 { ··· 625 623 spin_unlock_irqrestore(&ctlr->lock, flags); 626 624 return 0; 627 625 } 626 + EXPORT_SYMBOL_GPL(cpdma_ctlr_stop); 628 627 629 628 int cpdma_ctlr_destroy(struct cpdma_ctlr *ctlr) 630 629 { ··· 643 640 cpdma_desc_pool_destroy(ctlr); 644 641 return ret; 645 642 } 643 + EXPORT_SYMBOL_GPL(cpdma_ctlr_destroy); 646 644 647 645 int cpdma_ctlr_int_ctrl(struct cpdma_ctlr *ctlr, bool enable) 648 646 { ··· 664 660 spin_unlock_irqrestore(&ctlr->lock, flags); 665 661 return 0; 666 662 } 663 + EXPORT_SYMBOL_GPL(cpdma_ctlr_int_ctrl); 667 664 668 665 void cpdma_ctlr_eoi(struct cpdma_ctlr *ctlr, u32 value) 669 666 { 670 667 dma_reg_write(ctlr, CPDMA_MACEOIVECTOR, value); 671 668 } 669 + EXPORT_SYMBOL_GPL(cpdma_ctlr_eoi); 672 670 673 671 u32 cpdma_ctrl_rxchs_state(struct cpdma_ctlr *ctlr) 674 672 { 675 673 return dma_reg_read(ctlr, CPDMA_RXINTSTATMASKED); 676 674 } 675 + EXPORT_SYMBOL_GPL(cpdma_ctrl_rxchs_state); 677 676 678 677 u32 cpdma_ctrl_txchs_state(struct cpdma_ctlr *ctlr) 679 678 { 680 679 return dma_reg_read(ctlr, CPDMA_TXINTSTATMASKED); 681 680 } 681 + EXPORT_SYMBOL_GPL(cpdma_ctrl_txchs_state); 682 682 683 683 static void cpdma_chan_set_descs(struct cpdma_ctlr *ctlr, 684 684 int rx, int desc_num, ··· 810 802 spin_unlock_irqrestore(&ctlr->lock, flags); 811 803 return ret; 812 804 } 805 + EXPORT_SYMBOL_GPL(cpdma_chan_set_weight); 813 806 814 807 /* cpdma_chan_get_min_rate - get minimum allowed rate for channel 815 808 * Should be called before cpdma_chan_set_rate. ··· 825 816 826 817 return DIV_ROUND_UP(divident, divisor); 827 818 } 819 + EXPORT_SYMBOL_GPL(cpdma_chan_get_min_rate); 828 820 829 821 /* cpdma_chan_set_rate - limits bandwidth for transmit channel. 830 822 * The bandwidth * limited channels have to be in order beginning from lowest. ··· 870 860 spin_unlock_irqrestore(&ctlr->lock, flags); 871 861 return ret; 872 862 } 863 + EXPORT_SYMBOL_GPL(cpdma_chan_set_rate); 873 864 874 865 u32 cpdma_chan_get_rate(struct cpdma_chan *ch) 875 866 { ··· 883 872 884 873 return rate; 885 874 } 875 + EXPORT_SYMBOL_GPL(cpdma_chan_get_rate); 886 876 887 877 struct cpdma_chan *cpdma_chan_create(struct cpdma_ctlr *ctlr, int chan_num, 888 878 cpdma_handler_fn handler, int rx_type) ··· 943 931 spin_unlock_irqrestore(&ctlr->lock, flags); 944 932 return chan; 945 933 } 934 + EXPORT_SYMBOL_GPL(cpdma_chan_create); 946 935 947 936 int cpdma_chan_get_rx_buf_num(struct cpdma_chan *chan) 948 937 { ··· 956 943 957 944 return desc_num; 958 945 } 946 + EXPORT_SYMBOL_GPL(cpdma_chan_get_rx_buf_num); 959 947 960 948 int cpdma_chan_destroy(struct cpdma_chan *chan) 961 949 { ··· 978 964 spin_unlock_irqrestore(&ctlr->lock, flags); 979 965 return 0; 980 966 } 967 + EXPORT_SYMBOL_GPL(cpdma_chan_destroy); 981 968 982 969 int cpdma_chan_get_stats(struct cpdma_chan *chan, 983 970 struct cpdma_chan_stats *stats) ··· 991 976 spin_unlock_irqrestore(&chan->lock, flags); 992 977 return 0; 993 978 } 979 + EXPORT_SYMBOL_GPL(cpdma_chan_get_stats); 994 980 995 981 static void __cpdma_chan_submit(struct cpdma_chan *chan, 996 982 struct cpdma_desc __iomem *desc) ··· 1116 1100 spin_unlock_irqrestore(&chan->lock, flags); 1117 1101 return ret; 1118 1102 } 1103 + EXPORT_SYMBOL_GPL(cpdma_chan_idle_submit); 1119 1104 1120 1105 int cpdma_chan_idle_submit_mapped(struct cpdma_chan *chan, void *token, 1121 1106 dma_addr_t data, int len, int directed) ··· 1142 1125 spin_unlock_irqrestore(&chan->lock, flags); 1143 1126 return ret; 1144 1127 } 1128 + EXPORT_SYMBOL_GPL(cpdma_chan_idle_submit_mapped); 1145 1129 1146 1130 int cpdma_chan_submit(struct cpdma_chan *chan, void *token, void *data, 1147 1131 int len, int directed) ··· 1168 1150 spin_unlock_irqrestore(&chan->lock, flags); 1169 1151 return ret; 1170 1152 } 1153 + EXPORT_SYMBOL_GPL(cpdma_chan_submit); 1171 1154 1172 1155 int cpdma_chan_submit_mapped(struct cpdma_chan *chan, void *token, 1173 1156 dma_addr_t data, int len, int directed) ··· 1194 1175 spin_unlock_irqrestore(&chan->lock, flags); 1195 1176 return ret; 1196 1177 } 1178 + EXPORT_SYMBOL_GPL(cpdma_chan_submit_mapped); 1197 1179 1198 1180 bool cpdma_check_free_tx_desc(struct cpdma_chan *chan) 1199 1181 { ··· 1209 1189 spin_unlock_irqrestore(&chan->lock, flags); 1210 1190 return free_tx_desc; 1211 1191 } 1192 + EXPORT_SYMBOL_GPL(cpdma_check_free_tx_desc); 1212 1193 1213 1194 static void __cpdma_chan_free(struct cpdma_chan *chan, 1214 1195 struct cpdma_desc __iomem *desc, ··· 1310 1289 } 1311 1290 return used; 1312 1291 } 1292 + EXPORT_SYMBOL_GPL(cpdma_chan_process); 1313 1293 1314 1294 int cpdma_chan_start(struct cpdma_chan *chan) 1315 1295 { ··· 1330 1308 1331 1309 return 0; 1332 1310 } 1311 + EXPORT_SYMBOL_GPL(cpdma_chan_start); 1333 1312 1334 1313 int cpdma_chan_stop(struct cpdma_chan *chan) 1335 1314 { ··· 1393 1370 spin_unlock_irqrestore(&chan->lock, flags); 1394 1371 return 0; 1395 1372 } 1373 + EXPORT_SYMBOL_GPL(cpdma_chan_stop); 1396 1374 1397 1375 int cpdma_chan_int_ctrl(struct cpdma_chan *chan, bool enable) 1398 1376 { ··· 1440 1416 { 1441 1417 return ctlr->num_rx_desc; 1442 1418 } 1419 + EXPORT_SYMBOL_GPL(cpdma_get_num_rx_descs); 1443 1420 1444 1421 int cpdma_get_num_tx_descs(struct cpdma_ctlr *ctlr) 1445 1422 { 1446 1423 return ctlr->num_tx_desc; 1447 1424 } 1425 + EXPORT_SYMBOL_GPL(cpdma_get_num_tx_descs); 1448 1426 1449 1427 int cpdma_set_num_rx_descs(struct cpdma_ctlr *ctlr, int num_rx_desc) 1450 1428 { ··· 1468 1442 1469 1443 return ret; 1470 1444 } 1445 + EXPORT_SYMBOL_GPL(cpdma_set_num_rx_descs);