18c2ecf20Sopenharmony_ci/*
28c2ecf20Sopenharmony_ci * NXP Wireless LAN device driver: WMM
38c2ecf20Sopenharmony_ci *
48c2ecf20Sopenharmony_ci * Copyright 2011-2020 NXP
58c2ecf20Sopenharmony_ci *
68c2ecf20Sopenharmony_ci * This software file (the "File") is distributed by NXP
78c2ecf20Sopenharmony_ci * under the terms of the GNU General Public License Version 2, June 1991
88c2ecf20Sopenharmony_ci * (the "License").  You may use, redistribute and/or modify this File in
98c2ecf20Sopenharmony_ci * accordance with the terms and conditions of the License, a copy of which
108c2ecf20Sopenharmony_ci * is available by writing to the Free Software Foundation, Inc.,
118c2ecf20Sopenharmony_ci * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA or on the
128c2ecf20Sopenharmony_ci * worldwide web at http://www.gnu.org/licenses/old-licenses/gpl-2.0.txt.
138c2ecf20Sopenharmony_ci *
148c2ecf20Sopenharmony_ci * THE FILE IS DISTRIBUTED AS-IS, WITHOUT WARRANTY OF ANY KIND, AND THE
158c2ecf20Sopenharmony_ci * IMPLIED WARRANTIES OF MERCHANTABILITY OR FITNESS FOR A PARTICULAR PURPOSE
168c2ecf20Sopenharmony_ci * ARE EXPRESSLY DISCLAIMED.  The License provides additional details about
178c2ecf20Sopenharmony_ci * this warranty disclaimer.
188c2ecf20Sopenharmony_ci */
198c2ecf20Sopenharmony_ci
208c2ecf20Sopenharmony_ci#ifndef _MWIFIEX_WMM_H_
218c2ecf20Sopenharmony_ci#define _MWIFIEX_WMM_H_
228c2ecf20Sopenharmony_ci
238c2ecf20Sopenharmony_cienum ieee_types_wmm_aciaifsn_bitmasks {
248c2ecf20Sopenharmony_ci	MWIFIEX_AIFSN = (BIT(0) | BIT(1) | BIT(2) | BIT(3)),
258c2ecf20Sopenharmony_ci	MWIFIEX_ACM = BIT(4),
268c2ecf20Sopenharmony_ci	MWIFIEX_ACI = (BIT(5) | BIT(6)),
278c2ecf20Sopenharmony_ci};
288c2ecf20Sopenharmony_ci
298c2ecf20Sopenharmony_cienum ieee_types_wmm_ecw_bitmasks {
308c2ecf20Sopenharmony_ci	MWIFIEX_ECW_MIN = (BIT(0) | BIT(1) | BIT(2) | BIT(3)),
318c2ecf20Sopenharmony_ci	MWIFIEX_ECW_MAX = (BIT(4) | BIT(5) | BIT(6) | BIT(7)),
328c2ecf20Sopenharmony_ci};
338c2ecf20Sopenharmony_ci
348c2ecf20Sopenharmony_ciextern const u16 mwifiex_1d_to_wmm_queue[];
358c2ecf20Sopenharmony_ciextern const u8 tos_to_tid_inv[];
368c2ecf20Sopenharmony_ci
378c2ecf20Sopenharmony_ci/*
388c2ecf20Sopenharmony_ci * This function retrieves the TID of the given RA list.
398c2ecf20Sopenharmony_ci */
408c2ecf20Sopenharmony_cistatic inline int
418c2ecf20Sopenharmony_cimwifiex_get_tid(struct mwifiex_ra_list_tbl *ptr)
428c2ecf20Sopenharmony_ci{
438c2ecf20Sopenharmony_ci	struct sk_buff *skb;
448c2ecf20Sopenharmony_ci
458c2ecf20Sopenharmony_ci	if (skb_queue_empty(&ptr->skb_head))
468c2ecf20Sopenharmony_ci		return 0;
478c2ecf20Sopenharmony_ci
488c2ecf20Sopenharmony_ci	skb = skb_peek(&ptr->skb_head);
498c2ecf20Sopenharmony_ci
508c2ecf20Sopenharmony_ci	return skb->priority;
518c2ecf20Sopenharmony_ci}
528c2ecf20Sopenharmony_ci
538c2ecf20Sopenharmony_ci/*
548c2ecf20Sopenharmony_ci * This function gets the length of a list.
558c2ecf20Sopenharmony_ci */
568c2ecf20Sopenharmony_cistatic inline int
578c2ecf20Sopenharmony_cimwifiex_wmm_list_len(struct list_head *head)
588c2ecf20Sopenharmony_ci{
598c2ecf20Sopenharmony_ci	struct list_head *pos;
608c2ecf20Sopenharmony_ci	int count = 0;
618c2ecf20Sopenharmony_ci
628c2ecf20Sopenharmony_ci	list_for_each(pos, head)
638c2ecf20Sopenharmony_ci		++count;
648c2ecf20Sopenharmony_ci
658c2ecf20Sopenharmony_ci	return count;
668c2ecf20Sopenharmony_ci}
678c2ecf20Sopenharmony_ci
688c2ecf20Sopenharmony_ci/*
698c2ecf20Sopenharmony_ci * This function checks if a RA list is empty or not.
708c2ecf20Sopenharmony_ci */
718c2ecf20Sopenharmony_cistatic inline u8
728c2ecf20Sopenharmony_cimwifiex_wmm_is_ra_list_empty(struct list_head *ra_list_hhead)
738c2ecf20Sopenharmony_ci{
748c2ecf20Sopenharmony_ci	struct mwifiex_ra_list_tbl *ra_list;
758c2ecf20Sopenharmony_ci	int is_list_empty;
768c2ecf20Sopenharmony_ci
778c2ecf20Sopenharmony_ci	list_for_each_entry(ra_list, ra_list_hhead, list) {
788c2ecf20Sopenharmony_ci		is_list_empty = skb_queue_empty(&ra_list->skb_head);
798c2ecf20Sopenharmony_ci		if (!is_list_empty)
808c2ecf20Sopenharmony_ci			return false;
818c2ecf20Sopenharmony_ci	}
828c2ecf20Sopenharmony_ci
838c2ecf20Sopenharmony_ci	return true;
848c2ecf20Sopenharmony_ci}
858c2ecf20Sopenharmony_ci
868c2ecf20Sopenharmony_civoid mwifiex_wmm_add_buf_txqueue(struct mwifiex_private *priv,
878c2ecf20Sopenharmony_ci				 struct sk_buff *skb);
888c2ecf20Sopenharmony_civoid mwifiex_wmm_add_buf_bypass_txqueue(struct mwifiex_private *priv,
898c2ecf20Sopenharmony_ci					struct sk_buff *skb);
908c2ecf20Sopenharmony_civoid mwifiex_ralist_add(struct mwifiex_private *priv, const u8 *ra);
918c2ecf20Sopenharmony_civoid mwifiex_rotate_priolists(struct mwifiex_private *priv,
928c2ecf20Sopenharmony_ci			      struct mwifiex_ra_list_tbl *ra, int tid);
938c2ecf20Sopenharmony_ci
948c2ecf20Sopenharmony_ciint mwifiex_wmm_lists_empty(struct mwifiex_adapter *adapter);
958c2ecf20Sopenharmony_ciint mwifiex_bypass_txlist_empty(struct mwifiex_adapter *adapter);
968c2ecf20Sopenharmony_civoid mwifiex_wmm_process_tx(struct mwifiex_adapter *adapter);
978c2ecf20Sopenharmony_civoid mwifiex_process_bypass_tx(struct mwifiex_adapter *adapter);
988c2ecf20Sopenharmony_ciint mwifiex_is_ralist_valid(struct mwifiex_private *priv,
998c2ecf20Sopenharmony_ci			    struct mwifiex_ra_list_tbl *ra_list, int tid);
1008c2ecf20Sopenharmony_ci
1018c2ecf20Sopenharmony_ciu8 mwifiex_wmm_compute_drv_pkt_delay(struct mwifiex_private *priv,
1028c2ecf20Sopenharmony_ci				     const struct sk_buff *skb);
1038c2ecf20Sopenharmony_civoid mwifiex_wmm_init(struct mwifiex_adapter *adapter);
1048c2ecf20Sopenharmony_ci
1058c2ecf20Sopenharmony_ciu32 mwifiex_wmm_process_association_req(struct mwifiex_private *priv,
1068c2ecf20Sopenharmony_ci					u8 **assoc_buf,
1078c2ecf20Sopenharmony_ci					struct ieee_types_wmm_parameter *wmmie,
1088c2ecf20Sopenharmony_ci					struct ieee80211_ht_cap *htcap);
1098c2ecf20Sopenharmony_ci
1108c2ecf20Sopenharmony_civoid mwifiex_wmm_setup_queue_priorities(struct mwifiex_private *priv,
1118c2ecf20Sopenharmony_ci					struct ieee_types_wmm_parameter *wmm_ie);
1128c2ecf20Sopenharmony_civoid mwifiex_wmm_setup_ac_downgrade(struct mwifiex_private *priv);
1138c2ecf20Sopenharmony_ciint mwifiex_ret_wmm_get_status(struct mwifiex_private *priv,
1148c2ecf20Sopenharmony_ci			       const struct host_cmd_ds_command *resp);
1158c2ecf20Sopenharmony_cistruct mwifiex_ra_list_tbl *
1168c2ecf20Sopenharmony_cimwifiex_wmm_get_queue_raptr(struct mwifiex_private *priv, u8 tid,
1178c2ecf20Sopenharmony_ci			    const u8 *ra_addr);
1188c2ecf20Sopenharmony_ciu8 mwifiex_wmm_downgrade_tid(struct mwifiex_private *priv, u32 tid);
1198c2ecf20Sopenharmony_civoid mwifiex_update_ralist_tx_pause(struct mwifiex_private *priv, u8 *mac,
1208c2ecf20Sopenharmony_ci				    u8 tx_pause);
1218c2ecf20Sopenharmony_civoid mwifiex_update_ralist_tx_pause_in_tdls_cs(struct mwifiex_private *priv,
1228c2ecf20Sopenharmony_ci					       u8 *mac, u8 tx_pause);
1238c2ecf20Sopenharmony_ci
1248c2ecf20Sopenharmony_cistruct mwifiex_ra_list_tbl *mwifiex_wmm_get_ralist_node(struct mwifiex_private
1258c2ecf20Sopenharmony_ci					*priv, u8 tid, const u8 *ra_addr);
1268c2ecf20Sopenharmony_ci#endif /* !_MWIFIEX_WMM_H_ */
127