xref: /linux/drivers/net/ethernet/ti/am65-cpsw-qos.h (revision 908fc4c2)
1 /* SPDX-License-Identifier: GPL-2.0 */
2 /* Copyright (C) 2020 Texas Instruments Incorporated - http://www.ti.com/
3  */
4 
5 #ifndef AM65_CPSW_QOS_H_
6 #define AM65_CPSW_QOS_H_
7 
8 #include <linux/netdevice.h>
9 #include <net/pkt_sched.h>
10 
11 struct am65_cpsw_est {
12 	int buf;
13 	/* has to be the last one */
14 	struct tc_taprio_qopt_offload taprio;
15 };
16 
17 struct am65_cpsw_ale_ratelimit {
18 	unsigned long cookie;
19 	u64 rate_packet_ps;
20 };
21 
22 struct am65_cpsw_qos {
23 	struct am65_cpsw_est *est_admin;
24 	struct am65_cpsw_est *est_oper;
25 	ktime_t link_down_time;
26 	int link_speed;
27 
28 	struct am65_cpsw_ale_ratelimit ale_bc_ratelimit;
29 	struct am65_cpsw_ale_ratelimit ale_mc_ratelimit;
30 };
31 
32 int am65_cpsw_qos_ndo_setup_tc(struct net_device *ndev, enum tc_setup_type type,
33 			       void *type_data);
34 void am65_cpsw_qos_link_up(struct net_device *ndev, int link_speed);
35 void am65_cpsw_qos_link_down(struct net_device *ndev);
36 
37 #endif /* AM65_CPSW_QOS_H_ */
38