1 /* SPDX-License-Identifier: GPL-2.0 */
2 #ifndef _TSTYPE_H_
3 #define _TSTYPE_H_
4 #include "rtl819x_Qos.h"
5 
6 #define TS_ADDBA_DELAY		60
7 
8 #define TOTAL_TS_NUM		16
9 #define TCLAS_NUM		4
10 
11 /*  This define the Tx/Rx directions */
12 enum tr_select {
13 	TX_DIR = 0,
14 	RX_DIR = 1,
15 };
16 
17 union qos_tclas {
18 	struct type_general {
19 		u8		priority;
20 		u8		classifier_type;
21 		u8		mask;
22 	} type_general;
23 
24 	struct type0_eth {
25 		u8		priority;
26 		u8		classifier_type;
27 		u8		mask;
28 		u8		src_addr[6];
29 		u8		dst_addr[6];
30 		u16		type;
31 	} type0_eth;
32 
33 	struct type1_ipv4 {
34 		u8		priority;
35 		u8		classifier_type;
36 		u8		mask;
37 		u8		version;
38 		u8		src_ip[4];
39 		u8		dst_ip[4];
40 		u16		src_port;
41 		u16		dst_port;
42 		u8		dscp;
43 		u8		protocol;
44 		u8		reserved;
45 	} type1_ipv4;
46 
47 	struct type1_ipv6 {
48 		u8		priority;
49 		u8		classifier_type;
50 		u8		mask;
51 		u8		version;
52 		u8		src_ip[16];
53 		u8		dst_ip[16];
54 		u16		src_port;
55 		u16		dst_port;
56 		u8		flow_label[3];
57 	} type1_ipv6;
58 
59 	struct type2_8021q {
60 		u8		priority;
61 		u8		classifier_type;
62 		u8		mask;
63 		u16		tag_type;
64 	} type2_8021q;
65 };
66 
67 struct ts_common_info {
68 	struct list_head		list;
69 	struct timer_list		setup_timer;
70 	struct timer_list		inact_timer;
71 	u8				addr[6];
72 	struct tspec_body		t_spec;
73 	union qos_tclas			t_class[TCLAS_NUM];
74 	u8				t_clas_proc;
75 	u8				t_clas_num;
76 };
77 
78 struct tx_ts_record {
79 	struct ts_common_info		ts_common_info;
80 	u16				tx_cur_seq;
81 	struct ba_record		tx_pending_ba_record;
82 	struct ba_record		tx_admitted_ba_record;
83 	u8				add_ba_req_in_progress;
84 	u8				add_ba_req_delayed;
85 	u8				using_ba;
86 	struct timer_list		ts_add_ba_timer;
87 	u8				num;
88 };
89 
90 struct rx_ts_record {
91 	struct ts_common_info		ts_common_info;
92 	u16				rx_indicate_seq;
93 	u16				rx_timeout_indicate_seq;
94 	struct list_head		rx_pending_pkt_list;
95 	struct timer_list		rx_pkt_pending_timer;
96 	struct ba_record		rx_admitted_ba_record;
97 	u16				rx_last_seq_num;
98 	u8				rx_last_frag_num;
99 	u8				num;
100 };
101 
102 #endif
103