xref: /linux/drivers/net/wireless/marvell/mwifiex/wmm.h (revision cdd5b5a9761fd66d17586e4f4ba6588c70e640ea)
1 /* SPDX-License-Identifier: GPL-2.0-only */
2 /*
3  * NXP Wireless LAN device driver: WMM
4  *
5  * Copyright 2011-2020 NXP
6  */
7 
8 #ifndef _MWIFIEX_WMM_H_
9 #define _MWIFIEX_WMM_H_
10 
11 enum ieee_types_wmm_aciaifsn_bitmasks {
12 	MWIFIEX_AIFSN = (BIT(0) | BIT(1) | BIT(2) | BIT(3)),
13 	MWIFIEX_ACM = BIT(4),
14 	MWIFIEX_ACI = (BIT(5) | BIT(6)),
15 };
16 
17 enum ieee_types_wmm_ecw_bitmasks {
18 	MWIFIEX_ECW_MIN = (BIT(0) | BIT(1) | BIT(2) | BIT(3)),
19 	MWIFIEX_ECW_MAX = (BIT(4) | BIT(5) | BIT(6) | BIT(7)),
20 };
21 
22 extern const u16 mwifiex_1d_to_wmm_queue[];
23 extern const u8 tos_to_tid_inv[];
24 
25 /*
26  * This function retrieves the TID of the given RA list.
27  */
28 static inline int
mwifiex_get_tid(struct mwifiex_ra_list_tbl * ptr)29 mwifiex_get_tid(struct mwifiex_ra_list_tbl *ptr)
30 {
31 	struct sk_buff *skb;
32 
33 	if (skb_queue_empty(&ptr->skb_head))
34 		return 0;
35 
36 	skb = skb_peek(&ptr->skb_head);
37 
38 	return skb->priority;
39 }
40 
41 /*
42  * This function checks if a RA list is empty or not.
43  */
44 static inline u8
mwifiex_wmm_is_ra_list_empty(struct list_head * ra_list_hhead)45 mwifiex_wmm_is_ra_list_empty(struct list_head *ra_list_hhead)
46 {
47 	struct mwifiex_ra_list_tbl *ra_list;
48 	int is_list_empty;
49 
50 	list_for_each_entry(ra_list, ra_list_hhead, list) {
51 		is_list_empty = skb_queue_empty(&ra_list->skb_head);
52 		if (!is_list_empty)
53 			return false;
54 	}
55 
56 	return true;
57 }
58 
59 void mwifiex_wmm_add_buf_txqueue(struct mwifiex_private *priv,
60 				 struct sk_buff *skb);
61 void mwifiex_wmm_add_buf_bypass_txqueue(struct mwifiex_private *priv,
62 					struct sk_buff *skb);
63 void mwifiex_ralist_add(struct mwifiex_private *priv, const u8 *ra);
64 void mwifiex_rotate_priolists(struct mwifiex_private *priv,
65 			      struct mwifiex_ra_list_tbl *ra, int tid);
66 
67 int mwifiex_wmm_lists_empty(struct mwifiex_adapter *adapter);
68 int mwifiex_bypass_txlist_empty(struct mwifiex_adapter *adapter);
69 void mwifiex_wmm_process_tx(struct mwifiex_adapter *adapter);
70 void mwifiex_process_bypass_tx(struct mwifiex_adapter *adapter);
71 int mwifiex_is_ralist_valid(struct mwifiex_private *priv,
72 			    struct mwifiex_ra_list_tbl *ra_list, int tid);
73 
74 u8 mwifiex_wmm_compute_drv_pkt_delay(struct mwifiex_private *priv,
75 				     const struct sk_buff *skb);
76 void mwifiex_wmm_init(struct mwifiex_adapter *adapter);
77 
78 u32 mwifiex_wmm_process_association_req(struct mwifiex_private *priv,
79 					u8 **assoc_buf,
80 					struct ieee_types_wmm_parameter *wmmie,
81 					struct ieee80211_ht_cap *htcap);
82 
83 void mwifiex_wmm_setup_queue_priorities(struct mwifiex_private *priv,
84 					struct ieee_types_wmm_parameter *wmm_ie);
85 void mwifiex_wmm_setup_ac_downgrade(struct mwifiex_private *priv);
86 int mwifiex_ret_wmm_get_status(struct mwifiex_private *priv,
87 			       const struct host_cmd_ds_command *resp);
88 struct mwifiex_ra_list_tbl *
89 mwifiex_wmm_get_queue_raptr(struct mwifiex_private *priv, u8 tid,
90 			    const u8 *ra_addr);
91 u8 mwifiex_wmm_downgrade_tid(struct mwifiex_private *priv, u32 tid);
92 void mwifiex_update_ralist_tx_pause(struct mwifiex_private *priv, u8 *mac,
93 				    u8 tx_pause);
94 void mwifiex_update_ralist_tx_pause_in_tdls_cs(struct mwifiex_private *priv,
95 					       u8 *mac, u8 tx_pause);
96 
97 struct mwifiex_ra_list_tbl *mwifiex_wmm_get_ralist_node(struct mwifiex_private
98 					*priv, u8 tid, const u8 *ra_addr);
99 #endif /* !_MWIFIEX_WMM_H_ */
100