Skip to content

Commit a8ea8d5

Browse files
danish-tidavem330
authored andcommitted
net: ti: icssg-prueth: Split out common object into module
icssg_prueth.c and icssg_prueth_sr1.c drivers use multiple common .c files. These common objects are getting added to multiple modules. As a result when both drivers are enabled in .config, below warning is seen. drivers/net/ethernet/ti/Makefile: icssg/icssg_common.o is added to multiple modules: icssg-prueth icssg-prueth-sr1 drivers/net/ethernet/ti/Makefile: icssg/icssg_classifier.o is added to multiple modules: icssg-prueth icssg-prueth-sr1 drivers/net/ethernet/ti/Makefile: icssg/icssg_config.o is added to multiple modules: icssg-prueth icssg-prueth-sr1 drivers/net/ethernet/ti/Makefile: icssg/icssg_mii_cfg.o is added to multiple modules: icssg-prueth icssg-prueth-sr1 drivers/net/ethernet/ti/Makefile: icssg/icssg_stats.o is added to multiple modules: icssg-prueth icssg-prueth-sr1 drivers/net/ethernet/ti/Makefile: icssg/icssg_ethtool.o is added to multiple modules: icssg-prueth icssg-prueth-sr1 Fix this by building a new module (icssg.o) for all the common objects. Both the driver can then depend on this common module. Some APIs being exported have emac_ as the prefix which may result into confusion with other existing APIs with emac_ prefix, to avoid confusion, rename the APIs being exported with emac_ to icssg_ prefix. This also fixes below error seen when both drivers are built. ERROR: modpost: "icssg_queue_pop" [drivers/net/ethernet/ti/icssg-prueth-sr1.ko] undefined! ERROR: modpost: "icssg_queue_push" [drivers/net/ethernet/ti/icssg-prueth-sr1.ko] undefined! Reported-and-tested-by: Thorsten Leemhuis <[email protected]> Closes: https://lore.kernel.org/oe-kbuild-all/[email protected]/ Fixes: 487f732 ("net: ti: icssg-prueth: Add helper functions to configure FDB") Reviewed-by: Roger Quadros <[email protected]> Signed-off-by: MD Danish Anwar <[email protected]> Reviewed-by: Sai Krishna <[email protected]> Signed-off-by: David S. Miller <[email protected]>
1 parent f8321fa commit a8ea8d5

File tree

12 files changed

+122
-69
lines changed

12 files changed

+122
-69
lines changed

drivers/net/ethernet/ti/Makefile

Lines changed: 14 additions & 18 deletions
Original file line numberDiff line numberDiff line change
@@ -31,22 +31,18 @@ ti-am65-cpsw-nuss-$(CONFIG_TI_AM65_CPSW_QOS) += am65-cpsw-qos.o
3131
ti-am65-cpsw-nuss-$(CONFIG_TI_K3_AM65_CPSW_SWITCHDEV) += am65-cpsw-switchdev.o
3232
obj-$(CONFIG_TI_K3_AM65_CPTS) += am65-cpts.o
3333

34-
obj-$(CONFIG_TI_ICSSG_PRUETH) += icssg-prueth.o
35-
icssg-prueth-y := icssg/icssg_prueth.o \
36-
icssg/icssg_common.o \
37-
icssg/icssg_classifier.o \
38-
icssg/icssg_queues.o \
39-
icssg/icssg_config.o \
40-
icssg/icssg_mii_cfg.o \
41-
icssg/icssg_stats.o \
42-
icssg/icssg_ethtool.o \
43-
icssg/icssg_switchdev.o
44-
obj-$(CONFIG_TI_ICSSG_PRUETH_SR1) += icssg-prueth-sr1.o
45-
icssg-prueth-sr1-y := icssg/icssg_prueth_sr1.o \
46-
icssg/icssg_common.o \
47-
icssg/icssg_classifier.o \
48-
icssg/icssg_config.o \
49-
icssg/icssg_mii_cfg.o \
50-
icssg/icssg_stats.o \
51-
icssg/icssg_ethtool.o
34+
obj-$(CONFIG_TI_ICSSG_PRUETH) += icssg-prueth.o icssg.o
35+
icssg-prueth-y := icssg/icssg_prueth.o icssg/icssg_switchdev.o
36+
37+
obj-$(CONFIG_TI_ICSSG_PRUETH_SR1) += icssg-prueth-sr1.o icssg.o
38+
icssg-prueth-sr1-y := icssg/icssg_prueth_sr1.o
39+
40+
icssg-y := icssg/icssg_common.o \
41+
icssg/icssg_classifier.o \
42+
icssg/icssg_queues.o \
43+
icssg/icssg_config.o \
44+
icssg/icssg_mii_cfg.o \
45+
icssg/icssg_stats.o \
46+
icssg/icssg_ethtool.o
47+
5248
obj-$(CONFIG_TI_ICSS_IEP) += icssg/icss_iep.o

drivers/net/ethernet/ti/icssg/icssg_classifier.c

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -297,6 +297,7 @@ void icssg_class_set_mac_addr(struct regmap *miig_rt, int slice, u8 *mac)
297297
mac[2] << 16 | mac[3] << 24));
298298
regmap_write(miig_rt, offs[slice].mac1, (u32)(mac[4] | mac[5] << 8));
299299
}
300+
EXPORT_SYMBOL_GPL(icssg_class_set_mac_addr);
300301

301302
static void icssg_class_ft1_add_mcast(struct regmap *miig_rt, int slice,
302303
int slot, const u8 *addr, const u8 *mask)
@@ -360,6 +361,7 @@ void icssg_class_disable(struct regmap *miig_rt, int slice)
360361
/* clear CFG2 */
361362
regmap_write(miig_rt, offs[slice].rx_class_cfg2, 0);
362363
}
364+
EXPORT_SYMBOL_GPL(icssg_class_disable);
363365

364366
void icssg_class_default(struct regmap *miig_rt, int slice, bool allmulti,
365367
bool is_sr1)
@@ -390,6 +392,7 @@ void icssg_class_default(struct regmap *miig_rt, int slice, bool allmulti,
390392
/* clear CFG2 */
391393
regmap_write(miig_rt, offs[slice].rx_class_cfg2, 0);
392394
}
395+
EXPORT_SYMBOL_GPL(icssg_class_default);
393396

394397
void icssg_class_promiscuous_sr1(struct regmap *miig_rt, int slice)
395398
{
@@ -408,6 +411,7 @@ void icssg_class_promiscuous_sr1(struct regmap *miig_rt, int slice)
408411
regmap_write(miig_rt, offset, data);
409412
}
410413
}
414+
EXPORT_SYMBOL_GPL(icssg_class_promiscuous_sr1);
411415

412416
void icssg_class_add_mcast_sr1(struct regmap *miig_rt, int slice,
413417
struct net_device *ndev)
@@ -449,6 +453,7 @@ void icssg_class_add_mcast_sr1(struct regmap *miig_rt, int slice,
449453
slot++;
450454
}
451455
}
456+
EXPORT_SYMBOL_GPL(icssg_class_add_mcast_sr1);
452457

453458
/* required for SAV check */
454459
void icssg_ft1_set_mac_addr(struct regmap *miig_rt, int slice, u8 *mac_addr)
@@ -460,3 +465,4 @@ void icssg_ft1_set_mac_addr(struct regmap *miig_rt, int slice, u8 *mac_addr)
460465
rx_class_ft1_set_da_mask(miig_rt, slice, 0, mask_addr);
461466
rx_class_ft1_cfg_set_type(miig_rt, slice, 0, FT1_CFG_TYPE_EQ);
462467
}
468+
EXPORT_SYMBOL_GPL(icssg_ft1_set_mac_addr);

drivers/net/ethernet/ti/icssg/icssg_common.c

Lines changed: 41 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -51,6 +51,7 @@ void prueth_cleanup_rx_chns(struct prueth_emac *emac,
5151
if (rx_chn->rx_chn)
5252
k3_udma_glue_release_rx_chn(rx_chn->rx_chn);
5353
}
54+
EXPORT_SYMBOL_GPL(prueth_cleanup_rx_chns);
5455

5556
void prueth_cleanup_tx_chns(struct prueth_emac *emac)
5657
{
@@ -71,6 +72,7 @@ void prueth_cleanup_tx_chns(struct prueth_emac *emac)
7172
memset(tx_chn, 0, sizeof(*tx_chn));
7273
}
7374
}
75+
EXPORT_SYMBOL_GPL(prueth_cleanup_tx_chns);
7476

7577
void prueth_ndev_del_tx_napi(struct prueth_emac *emac, int num)
7678
{
@@ -84,6 +86,7 @@ void prueth_ndev_del_tx_napi(struct prueth_emac *emac, int num)
8486
netif_napi_del(&tx_chn->napi_tx);
8587
}
8688
}
89+
EXPORT_SYMBOL_GPL(prueth_ndev_del_tx_napi);
8790

8891
void prueth_xmit_free(struct prueth_tx_chn *tx_chn,
8992
struct cppi5_host_desc_t *desc)
@@ -120,6 +123,7 @@ void prueth_xmit_free(struct prueth_tx_chn *tx_chn,
120123

121124
k3_cppi_desc_pool_free(tx_chn->desc_pool, first_desc);
122125
}
126+
EXPORT_SYMBOL_GPL(prueth_xmit_free);
123127

124128
int emac_tx_complete_packets(struct prueth_emac *emac, int chn,
125129
int budget, bool *tdown)
@@ -264,6 +268,7 @@ int prueth_ndev_add_tx_napi(struct prueth_emac *emac)
264268
prueth_ndev_del_tx_napi(emac, i);
265269
return ret;
266270
}
271+
EXPORT_SYMBOL_GPL(prueth_ndev_add_tx_napi);
267272

268273
int prueth_init_tx_chns(struct prueth_emac *emac)
269274
{
@@ -344,6 +349,7 @@ int prueth_init_tx_chns(struct prueth_emac *emac)
344349
prueth_cleanup_tx_chns(emac);
345350
return ret;
346351
}
352+
EXPORT_SYMBOL_GPL(prueth_init_tx_chns);
347353

348354
int prueth_init_rx_chns(struct prueth_emac *emac,
349355
struct prueth_rx_chn *rx_chn,
@@ -453,6 +459,7 @@ int prueth_init_rx_chns(struct prueth_emac *emac,
453459
prueth_cleanup_rx_chns(emac, rx_chn, max_rflows);
454460
return ret;
455461
}
462+
EXPORT_SYMBOL_GPL(prueth_init_rx_chns);
456463

457464
int prueth_dma_rx_push(struct prueth_emac *emac,
458465
struct sk_buff *skb,
@@ -490,6 +497,7 @@ int prueth_dma_rx_push(struct prueth_emac *emac,
490497
return k3_udma_glue_push_rx_chn(rx_chn->rx_chn, 0,
491498
desc_rx, desc_dma);
492499
}
500+
EXPORT_SYMBOL_GPL(prueth_dma_rx_push);
493501

494502
u64 icssg_ts_to_ns(u32 hi_sw, u32 hi, u32 lo, u32 cycle_time_ns)
495503
{
@@ -505,6 +513,7 @@ u64 icssg_ts_to_ns(u32 hi_sw, u32 hi, u32 lo, u32 cycle_time_ns)
505513

506514
return ns;
507515
}
516+
EXPORT_SYMBOL_GPL(icssg_ts_to_ns);
508517

509518
void emac_rx_timestamp(struct prueth_emac *emac,
510519
struct sk_buff *skb, u32 *psdata)
@@ -636,7 +645,7 @@ static int prueth_tx_ts_cookie_get(struct prueth_emac *emac)
636645
}
637646

638647
/**
639-
* emac_ndo_start_xmit - EMAC Transmit function
648+
* icssg_ndo_start_xmit - EMAC Transmit function
640649
* @skb: SKB pointer
641650
* @ndev: EMAC network adapter
642651
*
@@ -647,7 +656,7 @@ static int prueth_tx_ts_cookie_get(struct prueth_emac *emac)
647656
*
648657
* Return: enum netdev_tx
649658
*/
650-
enum netdev_tx emac_ndo_start_xmit(struct sk_buff *skb, struct net_device *ndev)
659+
enum netdev_tx icssg_ndo_start_xmit(struct sk_buff *skb, struct net_device *ndev)
651660
{
652661
struct cppi5_host_desc_t *first_desc, *next_desc, *cur_desc;
653662
struct prueth_emac *emac = netdev_priv(ndev);
@@ -806,6 +815,7 @@ enum netdev_tx emac_ndo_start_xmit(struct sk_buff *skb, struct net_device *ndev)
806815
netif_tx_stop_queue(netif_txq);
807816
return NETDEV_TX_BUSY;
808817
}
818+
EXPORT_SYMBOL_GPL(icssg_ndo_start_xmit);
809819

810820
static void prueth_tx_cleanup(void *data, dma_addr_t desc_dma)
811821
{
@@ -831,6 +841,7 @@ irqreturn_t prueth_rx_irq(int irq, void *dev_id)
831841

832842
return IRQ_HANDLED;
833843
}
844+
EXPORT_SYMBOL_GPL(prueth_rx_irq);
834845

835846
void prueth_emac_stop(struct prueth_emac *emac)
836847
{
@@ -855,6 +866,7 @@ void prueth_emac_stop(struct prueth_emac *emac)
855866
rproc_shutdown(prueth->rtu[slice]);
856867
rproc_shutdown(prueth->pru[slice]);
857868
}
869+
EXPORT_SYMBOL_GPL(prueth_emac_stop);
858870

859871
void prueth_cleanup_tx_ts(struct prueth_emac *emac)
860872
{
@@ -867,8 +879,9 @@ void prueth_cleanup_tx_ts(struct prueth_emac *emac)
867879
}
868880
}
869881
}
882+
EXPORT_SYMBOL_GPL(prueth_cleanup_tx_ts);
870883

871-
int emac_napi_rx_poll(struct napi_struct *napi_rx, int budget)
884+
int icssg_napi_rx_poll(struct napi_struct *napi_rx, int budget)
872885
{
873886
struct prueth_emac *emac = prueth_napi_to_emac(napi_rx);
874887
int rx_flow = emac->is_sr1 ?
@@ -905,6 +918,7 @@ int emac_napi_rx_poll(struct napi_struct *napi_rx, int budget)
905918

906919
return num_rx;
907920
}
921+
EXPORT_SYMBOL_GPL(icssg_napi_rx_poll);
908922

909923
int prueth_prepare_rx_chan(struct prueth_emac *emac,
910924
struct prueth_rx_chn *chn,
@@ -930,6 +944,7 @@ int prueth_prepare_rx_chan(struct prueth_emac *emac,
930944

931945
return 0;
932946
}
947+
EXPORT_SYMBOL_GPL(prueth_prepare_rx_chan);
933948

934949
void prueth_reset_tx_chan(struct prueth_emac *emac, int ch_num,
935950
bool free_skb)
@@ -944,6 +959,7 @@ void prueth_reset_tx_chan(struct prueth_emac *emac, int ch_num,
944959
k3_udma_glue_disable_tx_chn(emac->tx_chns[i].tx_chn);
945960
}
946961
}
962+
EXPORT_SYMBOL_GPL(prueth_reset_tx_chan);
947963

948964
void prueth_reset_rx_chan(struct prueth_rx_chn *chn,
949965
int num_flows, bool disable)
@@ -956,11 +972,13 @@ void prueth_reset_rx_chan(struct prueth_rx_chn *chn,
956972
if (disable)
957973
k3_udma_glue_disable_rx_chn(chn->rx_chn);
958974
}
975+
EXPORT_SYMBOL_GPL(prueth_reset_rx_chan);
959976

960-
void emac_ndo_tx_timeout(struct net_device *ndev, unsigned int txqueue)
977+
void icssg_ndo_tx_timeout(struct net_device *ndev, unsigned int txqueue)
961978
{
962979
ndev->stats.tx_errors++;
963980
}
981+
EXPORT_SYMBOL_GPL(icssg_ndo_tx_timeout);
964982

965983
static int emac_set_ts_config(struct net_device *ndev, struct ifreq *ifr)
966984
{
@@ -1024,7 +1042,7 @@ static int emac_get_ts_config(struct net_device *ndev, struct ifreq *ifr)
10241042
-EFAULT : 0;
10251043
}
10261044

1027-
int emac_ndo_ioctl(struct net_device *ndev, struct ifreq *ifr, int cmd)
1045+
int icssg_ndo_ioctl(struct net_device *ndev, struct ifreq *ifr, int cmd)
10281046
{
10291047
switch (cmd) {
10301048
case SIOCGHWTSTAMP:
@@ -1037,9 +1055,10 @@ int emac_ndo_ioctl(struct net_device *ndev, struct ifreq *ifr, int cmd)
10371055

10381056
return phy_do_ioctl(ndev, ifr, cmd);
10391057
}
1058+
EXPORT_SYMBOL_GPL(icssg_ndo_ioctl);
10401059

1041-
void emac_ndo_get_stats64(struct net_device *ndev,
1042-
struct rtnl_link_stats64 *stats)
1060+
void icssg_ndo_get_stats64(struct net_device *ndev,
1061+
struct rtnl_link_stats64 *stats)
10431062
{
10441063
struct prueth_emac *emac = netdev_priv(ndev);
10451064

@@ -1058,9 +1077,10 @@ void emac_ndo_get_stats64(struct net_device *ndev,
10581077
stats->tx_errors = ndev->stats.tx_errors;
10591078
stats->tx_dropped = ndev->stats.tx_dropped;
10601079
}
1080+
EXPORT_SYMBOL_GPL(icssg_ndo_get_stats64);
10611081

1062-
int emac_ndo_get_phys_port_name(struct net_device *ndev, char *name,
1063-
size_t len)
1082+
int icssg_ndo_get_phys_port_name(struct net_device *ndev, char *name,
1083+
size_t len)
10641084
{
10651085
struct prueth_emac *emac = netdev_priv(ndev);
10661086
int ret;
@@ -1071,6 +1091,7 @@ int emac_ndo_get_phys_port_name(struct net_device *ndev, char *name,
10711091

10721092
return 0;
10731093
}
1094+
EXPORT_SYMBOL_GPL(icssg_ndo_get_phys_port_name);
10741095

10751096
/* get emac_port corresponding to eth_node name */
10761097
int prueth_node_port(struct device_node *eth_node)
@@ -1089,6 +1110,7 @@ int prueth_node_port(struct device_node *eth_node)
10891110
else
10901111
return PRUETH_PORT_INVALID;
10911112
}
1113+
EXPORT_SYMBOL_GPL(prueth_node_port);
10921114

10931115
/* get MAC instance corresponding to eth_node name */
10941116
int prueth_node_mac(struct device_node *eth_node)
@@ -1107,6 +1129,7 @@ int prueth_node_mac(struct device_node *eth_node)
11071129
else
11081130
return PRUETH_MAC_INVALID;
11091131
}
1132+
EXPORT_SYMBOL_GPL(prueth_node_mac);
11101133

11111134
void prueth_netdev_exit(struct prueth *prueth,
11121135
struct device_node *eth_node)
@@ -1132,6 +1155,7 @@ void prueth_netdev_exit(struct prueth *prueth,
11321155
free_netdev(emac->ndev);
11331156
prueth->emac[mac] = NULL;
11341157
}
1158+
EXPORT_SYMBOL_GPL(prueth_netdev_exit);
11351159

11361160
int prueth_get_cores(struct prueth *prueth, int slice, bool is_sr1)
11371161
{
@@ -1182,6 +1206,7 @@ int prueth_get_cores(struct prueth *prueth, int slice, bool is_sr1)
11821206

11831207
return 0;
11841208
}
1209+
EXPORT_SYMBOL_GPL(prueth_get_cores);
11851210

11861211
void prueth_put_cores(struct prueth *prueth, int slice)
11871212
{
@@ -1194,6 +1219,7 @@ void prueth_put_cores(struct prueth *prueth, int slice)
11941219
if (prueth->pru[slice])
11951220
pru_rproc_put(prueth->pru[slice]);
11961221
}
1222+
EXPORT_SYMBOL_GPL(prueth_put_cores);
11971223

11981224
#ifdef CONFIG_PM_SLEEP
11991225
static int prueth_suspend(struct device *dev)
@@ -1250,3 +1276,9 @@ static int prueth_resume(struct device *dev)
12501276
const struct dev_pm_ops prueth_dev_pm_ops = {
12511277
SET_SYSTEM_SLEEP_PM_OPS(prueth_suspend, prueth_resume)
12521278
};
1279+
EXPORT_SYMBOL_GPL(prueth_dev_pm_ops);
1280+
1281+
MODULE_AUTHOR("Roger Quadros <[email protected]>");
1282+
MODULE_AUTHOR("Md Danish Anwar <[email protected]>");
1283+
MODULE_DESCRIPTION("PRUSS ICSSG Ethernet Driver Common Module");
1284+
MODULE_LICENSE("GPL");

0 commit comments

Comments
 (0)