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