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 gets the length of a list.
43 */
44 static inline int
mwifiex_wmm_list_len(struct list_head * head)45 mwifiex_wmm_list_len(struct list_head *head)
46 {
47 struct list_head *pos;
48 int count = 0;
49
50 list_for_each(pos, head)
51 ++count;
52
53 return count;
54 }
55
56 /*
57 * This function checks if a RA list is empty or not.
58 */
59 static inline u8
mwifiex_wmm_is_ra_list_empty(struct list_head * ra_list_hhead)60 mwifiex_wmm_is_ra_list_empty(struct list_head *ra_list_hhead)
61 {
62 struct mwifiex_ra_list_tbl *ra_list;
63 int is_list_empty;
64
65 list_for_each_entry(ra_list, ra_list_hhead, list) {
66 is_list_empty = skb_queue_empty(&ra_list->skb_head);
67 if (!is_list_empty)
68 return false;
69 }
70
71 return true;
72 }
73
74 void mwifiex_wmm_add_buf_txqueue(struct mwifiex_private *priv,
75 struct sk_buff *skb);
76 void mwifiex_wmm_add_buf_bypass_txqueue(struct mwifiex_private *priv,
77 struct sk_buff *skb);
78 void mwifiex_ralist_add(struct mwifiex_private *priv, const u8 *ra);
79 void mwifiex_rotate_priolists(struct mwifiex_private *priv,
80 struct mwifiex_ra_list_tbl *ra, int tid);
81
82 int mwifiex_wmm_lists_empty(struct mwifiex_adapter *adapter);
83 int mwifiex_bypass_txlist_empty(struct mwifiex_adapter *adapter);
84 void mwifiex_wmm_process_tx(struct mwifiex_adapter *adapter);
85 void mwifiex_process_bypass_tx(struct mwifiex_adapter *adapter);
86 int mwifiex_is_ralist_valid(struct mwifiex_private *priv,
87 struct mwifiex_ra_list_tbl *ra_list, int tid);
88
89 u8 mwifiex_wmm_compute_drv_pkt_delay(struct mwifiex_private *priv,
90 const struct sk_buff *skb);
91 void mwifiex_wmm_init(struct mwifiex_adapter *adapter);
92
93 u32 mwifiex_wmm_process_association_req(struct mwifiex_private *priv,
94 u8 **assoc_buf,
95 struct ieee_types_wmm_parameter *wmmie,
96 struct ieee80211_ht_cap *htcap);
97
98 void mwifiex_wmm_setup_queue_priorities(struct mwifiex_private *priv,
99 struct ieee_types_wmm_parameter *wmm_ie);
100 void mwifiex_wmm_setup_ac_downgrade(struct mwifiex_private *priv);
101 int mwifiex_ret_wmm_get_status(struct mwifiex_private *priv,
102 const struct host_cmd_ds_command *resp);
103 struct mwifiex_ra_list_tbl *
104 mwifiex_wmm_get_queue_raptr(struct mwifiex_private *priv, u8 tid,
105 const u8 *ra_addr);
106 u8 mwifiex_wmm_downgrade_tid(struct mwifiex_private *priv, u32 tid);
107 void mwifiex_update_ralist_tx_pause(struct mwifiex_private *priv, u8 *mac,
108 u8 tx_pause);
109 void mwifiex_update_ralist_tx_pause_in_tdls_cs(struct mwifiex_private *priv,
110 u8 *mac, u8 tx_pause);
111
112 struct mwifiex_ra_list_tbl *mwifiex_wmm_get_ralist_node(struct mwifiex_private
113 *priv, u8 tid, const u8 *ra_addr);
114 #endif /* !_MWIFIEX_WMM_H_ */
115