Skip to content

Commit c92b132

Browse files
rogerqdavem330
authored andcommitted
net: ethernet: am65-cpsw: Build am65-cpsw-qos only if required
Build am65-cpsw-qos only if CONFIG_TI_AM65_CPSW_TAS is enabled. Signed-off-by: Roger Quadros <[email protected]> Reviewed-by: Vladimir Oltean <[email protected]> Signed-off-by: David S. Miller <[email protected]>
1 parent c8659bd commit c92b132

File tree

3 files changed

+28
-13
lines changed

3 files changed

+28
-13
lines changed

drivers/net/ethernet/ti/Makefile

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -26,7 +26,8 @@ keystone_netcp_ethss-y := netcp_ethss.o netcp_sgmii.o netcp_xgbepcsr.o cpsw_ale.
2626
obj-$(CONFIG_TI_K3_CPPI_DESC_POOL) += k3-cppi-desc-pool.o
2727

2828
obj-$(CONFIG_TI_K3_AM65_CPSW_NUSS) += ti-am65-cpsw-nuss.o
29-
ti-am65-cpsw-nuss-y := am65-cpsw-nuss.o cpsw_sl.o am65-cpsw-ethtool.o cpsw_ale.o am65-cpsw-qos.o
29+
ti-am65-cpsw-nuss-y := am65-cpsw-nuss.o cpsw_sl.o am65-cpsw-ethtool.o cpsw_ale.o
30+
ti-am65-cpsw-nuss-$(CONFIG_TI_AM65_CPSW_TAS) += am65-cpsw-qos.o
3031
ti-am65-cpsw-nuss-$(CONFIG_TI_K3_AM65_CPSW_SWITCHDEV) += am65-cpsw-switchdev.o
3132
obj-$(CONFIG_TI_K3_AM65_CPTS) += am65-cpts.o
3233

drivers/net/ethernet/ti/am65-cpsw-qos.c

Lines changed: 0 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -571,9 +571,6 @@ static int am65_cpsw_setup_taprio(struct net_device *ndev, void *type_data)
571571
taprio->cmd != TAPRIO_CMD_DESTROY)
572572
return -EOPNOTSUPP;
573573

574-
if (!IS_ENABLED(CONFIG_TI_AM65_CPSW_TAS))
575-
return -ENODEV;
576-
577574
if (!netif_running(ndev)) {
578575
dev_err(&ndev->dev, "interface is down, link speed unknown\n");
579576
return -ENETDOWN;
@@ -599,9 +596,6 @@ static int am65_cpsw_tc_query_caps(struct net_device *ndev, void *type_data)
599596
case TC_SETUP_QDISC_TAPRIO: {
600597
struct tc_taprio_caps *caps = base->caps;
601598

602-
if (!IS_ENABLED(CONFIG_TI_AM65_CPSW_TAS))
603-
return -EOPNOTSUPP;
604-
605599
caps->gate_mask_per_txq = true;
606600

607601
return 0;
@@ -806,9 +800,6 @@ void am65_cpsw_qos_link_up(struct net_device *ndev, int link_speed)
806800
{
807801
struct am65_cpsw_port *port = am65_ndev_to_port(ndev);
808802

809-
if (!IS_ENABLED(CONFIG_TI_AM65_CPSW_TAS))
810-
return;
811-
812803
am65_cpsw_est_link_up(ndev, link_speed);
813804
port->qos.link_down_time = 0;
814805
}
@@ -817,9 +808,6 @@ void am65_cpsw_qos_link_down(struct net_device *ndev)
817808
{
818809
struct am65_cpsw_port *port = am65_ndev_to_port(ndev);
819810

820-
if (!IS_ENABLED(CONFIG_TI_AM65_CPSW_TAS))
821-
return;
822-
823811
if (!port->qos.link_down_time)
824812
port->qos.link_down_time = ktime_get();
825813

drivers/net/ethernet/ti/am65-cpsw-qos.h

Lines changed: 26 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -31,11 +31,37 @@ struct am65_cpsw_qos {
3131
struct am65_cpsw_ale_ratelimit ale_mc_ratelimit;
3232
};
3333

34+
#if IS_ENABLED(CONFIG_TI_AM65_CPSW_TAS)
3435
int am65_cpsw_qos_ndo_setup_tc(struct net_device *ndev, enum tc_setup_type type,
3536
void *type_data);
3637
void am65_cpsw_qos_link_up(struct net_device *ndev, int link_speed);
3738
void am65_cpsw_qos_link_down(struct net_device *ndev);
3839
int am65_cpsw_qos_ndo_tx_p0_set_maxrate(struct net_device *ndev, int queue, u32 rate_mbps);
3940
void am65_cpsw_qos_tx_p0_rate_init(struct am65_cpsw_common *common);
41+
#else
42+
static inline int am65_cpsw_qos_ndo_setup_tc(struct net_device *ndev,
43+
enum tc_setup_type type,
44+
void *type_data)
45+
{
46+
return -EOPNOTSUPP;
47+
}
48+
49+
static inline void am65_cpsw_qos_link_up(struct net_device *ndev,
50+
int link_speed)
51+
{ }
52+
53+
static inline void am65_cpsw_qos_link_down(struct net_device *ndev)
54+
{ }
55+
56+
static inline int am65_cpsw_qos_ndo_tx_p0_set_maxrate(struct net_device *ndev,
57+
int queue,
58+
u32 rate_mbps)
59+
{
60+
return 0;
61+
}
62+
63+
static inline void am65_cpsw_qos_tx_p0_rate_init(struct am65_cpsw_common *common)
64+
{ }
65+
#endif
4066

4167
#endif /* AM65_CPSW_QOS_H_ */

0 commit comments

Comments
 (0)