1 /* SPDX-License-Identifier: GPL-2.0 */
2 #ifndef __INC_QOS_TYPE_H
3 #define __INC_QOS_TYPE_H
4 
5 /*
6  * ACI/AIFSN Field.
7  * Ref: WMM spec 2.2.2: WME Parameter Element, p.12.
8  * Note: 1 Byte Length
9  */
10 struct aci_aifsn {
11 	u8	aifsn:4;
12 	u8	acm:1;
13 	u8	aci:2;
14 	u8:1;
15 };
16 
17 /*
18  * Direction Field Values.
19  * Ref: WMM spec 2.2.11: WME TSPEC Element, p.18.
20  */
21 enum direction_value {
22 	DIR_UP			= 0,		// 0x00	// UpLink
23 	DIR_DOWN		= 1,		// 0x01	// DownLink
24 	DIR_DIRECT		= 2,		// 0x10	// DirectLink
25 	DIR_BI_DIR		= 3,		// 0x11	// Bi-Direction
26 };
27 
28 /*
29  * TS Info field in WMM TSPEC Element.
30  * Ref:
31  *	1. WMM spec 2.2.11: WME TSPEC Element, p.18.
32  *	2. 8185 QoS code: QOS_TSINFO [def. in QoS_mp.h]
33  * Note: sizeof 3 Bytes
34  */
35 struct qos_tsinfo {
36 	u16		uc_traffic_type:1;	        //WMM is reserved
37 	u16		uc_tsid:4;
38 	u16		uc_direction:2;
39 	u16		uc_access_policy:2;	        //WMM: bit8=0, bit7=1
40 	u16		uc_aggregation:1;	        //WMM is reserved
41 	u16		uc_psb:1;		        //WMMSA is APSD
42 	u16		uc_up:3;
43 	u16		uc_ts_info_ack_policy:2;	//WMM is reserved
44 	u8		uc_schedule:1;		        //WMM is reserved
45 	u8:7;
46 };
47 
48 /*
49  * WMM TSPEC Body.
50  * Ref: WMM spec 2.2.11: WME TSPEC Element, p.16.
51  * Note: sizeof 55 bytes
52  */
53 struct tspec_body {
54 	struct qos_tsinfo	ts_info;	//u8	TSInfo[3];
55 	u16	nominal_msd_usize;
56 	u16	max_msd_usize;
57 	u32	min_service_itv;
58 	u32	max_service_itv;
59 	u32	inactivity_itv;
60 	u32	suspen_itv;
61 	u32	service_start_time;
62 	u32	min_data_rate;
63 	u32	mean_data_rate;
64 	u32	peak_data_rate;
65 	u32	max_burst_size;
66 	u32	delay_bound;
67 	u32	min_phy_rate;
68 	u16	surplus_bandwidth_allowance;
69 	u16	medium_time;
70 };
71 
72 /*
73  *      802.11 Management frame Status Code field
74  */
75 struct octet_string {
76 	u8		*octet;
77 	u16             length;
78 };
79 
80 #define is_ac_valid(ac)			(((ac) <= 7) ? true : false)
81 
82 #endif // #ifndef __INC_QOS_TYPE_H
83