• Home
  • Line#
  • Scopes#
  • Navigate#
  • Raw
  • Download
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_common;
12 
13 struct am65_cpsw_est {
14 	int buf;
15 	/* has to be the last one */
16 	struct tc_taprio_qopt_offload taprio;
17 };
18 
19 struct am65_cpsw_ale_ratelimit {
20 	unsigned long cookie;
21 	u64 rate_packet_ps;
22 };
23 
24 struct am65_cpsw_qos {
25 	struct am65_cpsw_est *est_admin;
26 	struct am65_cpsw_est *est_oper;
27 	ktime_t link_down_time;
28 	int link_speed;
29 
30 	struct am65_cpsw_ale_ratelimit ale_bc_ratelimit;
31 	struct am65_cpsw_ale_ratelimit ale_mc_ratelimit;
32 };
33 
34 int am65_cpsw_qos_ndo_setup_tc(struct net_device *ndev, enum tc_setup_type type,
35 			       void *type_data);
36 void am65_cpsw_qos_link_up(struct net_device *ndev, int link_speed);
37 void am65_cpsw_qos_link_down(struct net_device *ndev);
38 int am65_cpsw_qos_ndo_tx_p0_set_maxrate(struct net_device *ndev, int queue, u32 rate_mbps);
39 void am65_cpsw_qos_tx_p0_rate_init(struct am65_cpsw_common *common);
40 
41 #endif /* AM65_CPSW_QOS_H_ */
42