xref: /wlan-dirver/qcacld-3.0/core/sme/inc/sme_qos_api.h (revision bb8e47c200751dd274982fa7d00566e04456aa23)
1 /*
2  * Copyright (c) 2014-2017 The Linux Foundation. All rights reserved.
3  *
4  * Permission to use, copy, modify, and/or distribute this software for
5  * any purpose with or without fee is hereby granted, provided that the
6  * above copyright notice and this permission notice appear in all
7  * copies.
8  *
9  * THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL
10  * WARRANTIES WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED
11  * WARRANTIES OF MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE
12  * AUTHOR BE LIABLE FOR ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL
13  * DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR
14  * PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR OTHER
15  * TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR
16  * PERFORMANCE OF THIS SOFTWARE.
17  */
18 
19 #if !defined(__SME_QOSAPI_H)
20 #define __SME_QOSAPI_H
21 
22 /**
23  * \file  sme_qos_api.h
24  *
25  * \brief prototype for SME QoS APIs
26  */
27 
28 /* Include Files */
29 #include "qdf_lock.h"
30 #include "qdf_trace.h"
31 #include "qdf_mem.h"
32 #include "qdf_types.h"
33 #include "ani_global.h"
34 #include "sir_api.h"
35 
36 /* Pre-processor Definitions */
37 #define SME_QOS_UAPSD_VO      0x01
38 #define SME_QOS_UAPSD_VI      0x02
39 #define SME_QOS_UAPSD_BE      0x08
40 #define SME_QOS_UAPSD_BK      0x04
41 
42 /* Enumeration of the various QoS status types that would be reported to HDD */
43 enum sme_qos_statustype {
44 	/*
45 	 * async: once PE notifies successful TSPEC negotiation, or CSR notifies
46 	 * for successful reassoc, notifies HDD with current QoS Params
47 	 */
48 	SME_QOS_STATUS_SETUP_SUCCESS_IND = 0,
49 	/* sync: only when App asked for APSD & it's already set with ACM = 0 */
50 	SME_QOS_STATUS_SETUP_SUCCESS_APSD_SET_ALREADY,
51 	/* sync or async: in case of async notify HDD with current QoS Params */
52 	SME_QOS_STATUS_SETUP_FAILURE_RSP,
53 	/* sync */
54 	SME_QOS_STATUS_SETUP_INVALID_PARAMS_RSP,
55 	/* sync: AP doesn't support QoS (WMM) */
56 	SME_QOS_STATUS_SETUP_NOT_QOS_AP_RSP,
57 	/* sync: either req has been sent down to PE or just buffered in SME */
58 	SME_QOS_STATUS_SETUP_REQ_PENDING_RSP,
59 	/*
60 	 * async: in case of flow aggregation, if the new TSPEC negotiation
61 	 * is successful, OR, notify existing flows that TSPEC is modified with
62 	 * current QoS Params
63 	 */
64 	SME_QOS_STATUS_SETUP_MODIFIED_IND,
65 	/* sync: no APSD asked for & ACM = 0 */
66 	SME_QOS_STATUS_SETUP_SUCCESS_NO_ACM_NO_APSD_RSP,
67 	/*
68 	 * async: In case of UAPSD, once PE notifies successful TSPEC
69 	 * negotiation, or CSR notifies for successful reassoc to SME-QoS,
70 	 * notify HDD if PMC can't put the module in UAPSD mode right away
71 	 * (QDF_STATUS_PMC_PENDING)
72 	 */
73 	SME_QOS_STATUS_SETUP_SUCCESS_IND_APSD_PENDING,
74 	/*
75 	 * async: In case of UAPSD, once PE notifies successful TSPEC
76 	 * negotiation, or CSR notifies for successful reassoc to SME-QoS,
77 	 * notify HDD if PMC can't put the module in UAPSD mode at all
78 	 * (QDF_STATUS_E_FAILURE)
79 	 */
80 	SME_QOS_STATUS_SETUP_SUCCESS_IND_APSD_SET_FAILED,
81 	/*
82 	 * sync: req has been sent down to PE in case of delts or addts
83 	 * for remain flows, OR if the AC doesn't have APSD or ACM
84 	 * async: once the downgrade req for QoS params is successful
85 	 */
86 	SME_QOS_STATUS_RELEASE_SUCCESS_RSP = 100,
87 	/* sync or async: in case of async notify HDD with current QoS Param */
88 	SME_QOS_STATUS_RELEASE_FAILURE_RSP,
89 	/* async: AP sent DELTS indication */
90 	SME_QOS_STATUS_RELEASE_QOS_LOST_IND,
91 	/*
92 	 * sync: an addts req has been sent down to PE to downgrade the
93 	 * QoS params or just buffered in SME
94 	 */
95 	SME_QOS_STATUS_RELEASE_REQ_PENDING_RSP,
96 	/* sync */
97 	SME_QOS_STATUS_RELEASE_INVALID_PARAMS_RSP,
98 	/*
99 	 * async: for QoS modify request if modification is successful,
100 	 * notifies HDD with current QoS Params
101 	 */
102 	SME_QOS_STATUS_MODIFY_SETUP_SUCCESS_IND = 200,
103 	/* sync: only when App asked for APSD & it's already set with ACM = 0 */
104 	SME_QOS_STATUS_MODIFY_SETUP_SUCCESS_APSD_SET_ALREADY,
105 	/* sync or async: in case of async notify HDD with current QoS Param */
106 	SME_QOS_STATUS_MODIFY_SETUP_FAILURE_RSP,
107 	/* sync: either req has been sent down to PE or just buffered in SME */
108 	SME_QOS_STATUS_MODIFY_SETUP_PENDING_RSP,
109 	/* sync: no APSD asked for & ACM = 0 */
110 	SME_QOS_STATUS_MODIFY_SETUP_SUCCESS_NO_ACM_NO_APSD_RSP,
111 	/* sync */
112 	SME_QOS_STATUS_MODIFY_SETUP_INVALID_PARAMS_RSP,
113 	/*
114 	 * async: In case of UAPSD, once PE notifies successful TSPEC
115 	 * negotiation or CSR notifies for successful reassoc to SME-QoS,
116 	 * notify HDD if PMC can't put the module in UAPSD mode right away
117 	 * (QDF_STATUS_PMC_PENDING)
118 	 */
119 	SME_QOS_STATUS_MODIFY_SETUP_SUCCESS_IND_APSD_PENDING,
120 	/*
121 	 * async: In case of UAPSD, once PE notifies successful TSPEC
122 	 * negotiation, or CSR notifies for successful reassoc to SME-QoS,
123 	 * notify HDD if PMC can't put the module in UAPSD mode at all
124 	 * (QDF_STATUS_E_FAILURE)
125 	 */
126 	SME_QOS_STATUS_MODIFY_SETUP_SUCCESS_IND_APSD_SET_FAILED,
127 	/* sync: STA is handing off to a new AP */
128 	SME_QOS_STATUS_HANDING_OFF = 300,
129 	/* async:powersave mode changed by PMC from UAPSD to Full power */
130 	SME_QOS_STATUS_OUT_OF_APSD_POWER_MODE_IND = 400,
131 	/* async:powersave mode changed by PMC from Full power to UAPSD */
132 	SME_QOS_STATUS_INTO_APSD_POWER_MODE_IND,
133 
134 };
135 
136 /*
137  * Enumeration of the various User priority (UP) types
138  * From 802.1D/802.11e/WMM specifications (all refer to same table)
139  */
140 enum sme_qos_wmmuptype {
141 	SME_QOS_WMM_UP_BE = 0,
142 	SME_QOS_WMM_UP_BK = 1,
143 	SME_QOS_WMM_UP_RESV = 2,        /* Reserved */
144 	SME_QOS_WMM_UP_EE = 3,
145 	SME_QOS_WMM_UP_CL = 4,
146 	SME_QOS_WMM_UP_VI = 5,
147 	SME_QOS_WMM_UP_VO = 6,
148 	SME_QOS_WMM_UP_NC = 7,
149 	SME_QOS_WMM_UP_MAX
150 };
151 
152 /*
153  * Enumeration of the various TSPEC ack policies.
154  * From 802.11 WMM specification
155  */
156 enum sme_qos_wmmack_policytype {
157 	SME_QOS_WMM_TS_ACK_POLICY_NORMAL_ACK = 0,
158 	SME_QOS_WMM_TS_ACK_POLICY_RESV1 = 1,
159 	SME_QOS_WMM_TS_ACK_POLICY_RESV2 = 2,    /* Reserved */
160 	SME_QOS_WMM_TS_ACK_POLICY_HT_IMMEDIATE_BLOCK_ACK = 3,
161 
162 };
163 
164 /*
165  * TS Info field in the WMM TSPEC
166  * See suggestive values above
167  */
168 struct sme_qos_wmmts_infotype {
169 	uint8_t burst_size_defn;
170 	enum sme_qos_wmmack_policytype ack_policy;
171 	enum sme_qos_wmmuptype up;    /* User priority */
172 	uint8_t psb;            /* power-save bit */
173 	enum sme_qos_wmm_dir_type direction;    /* Direction */
174 	uint8_t tid;            /* TID : To be filled up by SME-QoS */
175 };
176 
177 /* The WMM TSPEC Element (from the WMM spec)*/
178 struct sme_qos_wmmtspecinfo {
179 	struct sme_qos_wmmts_infotype ts_info;
180 	uint16_t nominal_msdu_size;
181 	uint16_t maximum_msdu_size;
182 	uint32_t min_service_interval;
183 	uint32_t max_service_interval;
184 	uint32_t inactivity_interval;
185 	uint32_t suspension_interval;
186 	uint32_t svc_start_time;
187 	uint32_t min_data_rate;
188 	uint32_t mean_data_rate;
189 	uint32_t peak_data_rate;
190 	uint32_t max_burst_size;
191 	uint32_t delay_bound;
192 	uint32_t min_phy_rate;
193 	uint16_t surplus_bw_allowance;
194 	uint16_t medium_time;
195 };
196 
197 /* External APIs */
198 typedef QDF_STATUS (*sme_QosCallback)(tHalHandle hHal, void *HDDcontext,
199 		struct sme_qos_wmmtspecinfo *pCurrentQoSInfo,
200 		enum sme_qos_statustype status, uint32_t QosFlowID);
201 enum sme_qos_statustype sme_qos_setup_req(tHalHandle hHal, uint32_t sessionId,
202 		struct sme_qos_wmmtspecinfo *pQoSInfo,
203 		sme_QosCallback QoSCallback, void *HDDcontext,
204 		enum sme_qos_wmmuptype UPType, uint32_t *pQosFlowID);
205 enum sme_qos_statustype sme_qos_modify_req(tHalHandle hHal,
206 		struct sme_qos_wmmtspecinfo *pQoSInfo, uint32_t QosFlowID);
207 enum sme_qos_statustype sme_qos_release_req(tHalHandle hHal, uint8_t session_id,
208 				      uint32_t QosFlowID);
209 bool sme_qos_is_ts_info_ack_policy_valid(tpAniSirGlobal pMac,
210 		struct sme_qos_wmmtspecinfo *pQoSInfo, uint8_t sessionId);
211 void sme_qos_update_hand_off(uint8_t sessionId, bool updateHandOff);
212 QDF_STATUS sme_update_dsc_pto_up_mapping(tHalHandle hHal,
213 		enum sme_qos_wmmuptype *dscpmapping, uint8_t sessionId);
214 
215 QDF_STATUS sme_offload_qos_process_out_of_uapsd_mode(tpAniSirGlobal mac_ctx,
216 		uint32_t session_id);
217 QDF_STATUS sme_offload_qos_process_into_uapsd_mode(tpAniSirGlobal mac_ctx,
218 		uint32_t session_id);
219 
220 
221 #endif /* #if !defined( __SME_QOSAPI_H ) */
222