gpio: rcar: Fix runtime PM imbalance on error
[linux/fpc-iii.git] / drivers / net / wireless / marvell / mwifiex / wmm.h
blob04d7da95e307877a62564cc331d3ae3b4a1afd91
1 /*
2 * NXP Wireless LAN device driver: WMM
4 * Copyright 2011-2020 NXP
6 * This software file (the "File") is distributed by NXP
7 * under the terms of the GNU General Public License Version 2, June 1991
8 * (the "License"). You may use, redistribute and/or modify this File in
9 * accordance with the terms and conditions of the License, a copy of which
10 * is available by writing to the Free Software Foundation, Inc.,
11 * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA or on the
12 * worldwide web at http://www.gnu.org/licenses/old-licenses/gpl-2.0.txt.
14 * THE FILE IS DISTRIBUTED AS-IS, WITHOUT WARRANTY OF ANY KIND, AND THE
15 * IMPLIED WARRANTIES OF MERCHANTABILITY OR FITNESS FOR A PARTICULAR PURPOSE
16 * ARE EXPRESSLY DISCLAIMED. The License provides additional details about
17 * this warranty disclaimer.
20 #ifndef _MWIFIEX_WMM_H_
21 #define _MWIFIEX_WMM_H_
23 enum ieee_types_wmm_aciaifsn_bitmasks {
24 MWIFIEX_AIFSN = (BIT(0) | BIT(1) | BIT(2) | BIT(3)),
25 MWIFIEX_ACM = BIT(4),
26 MWIFIEX_ACI = (BIT(5) | BIT(6)),
29 enum ieee_types_wmm_ecw_bitmasks {
30 MWIFIEX_ECW_MIN = (BIT(0) | BIT(1) | BIT(2) | BIT(3)),
31 MWIFIEX_ECW_MAX = (BIT(4) | BIT(5) | BIT(6) | BIT(7)),
34 static const u16 mwifiex_1d_to_wmm_queue[8] = { 1, 0, 0, 1, 2, 2, 3, 3 };
37 * This table inverses the tos_to_tid operation to get a priority
38 * which is in sequential order, and can be compared.
39 * Use this to compare the priority of two different TIDs.
41 static const u8 tos_to_tid_inv[] = {
42 0x02, /* from tos_to_tid[2] = 0 */
43 0x00, /* from tos_to_tid[0] = 1 */
44 0x01, /* from tos_to_tid[1] = 2 */
45 0x03,
46 0x04,
47 0x05,
48 0x06,
49 0x07};
52 * This function retrieves the TID of the given RA list.
54 static inline int
55 mwifiex_get_tid(struct mwifiex_ra_list_tbl *ptr)
57 struct sk_buff *skb;
59 if (skb_queue_empty(&ptr->skb_head))
60 return 0;
62 skb = skb_peek(&ptr->skb_head);
64 return skb->priority;
68 * This function gets the length of a list.
70 static inline int
71 mwifiex_wmm_list_len(struct list_head *head)
73 struct list_head *pos;
74 int count = 0;
76 list_for_each(pos, head)
77 ++count;
79 return count;
83 * This function checks if a RA list is empty or not.
85 static inline u8
86 mwifiex_wmm_is_ra_list_empty(struct list_head *ra_list_hhead)
88 struct mwifiex_ra_list_tbl *ra_list;
89 int is_list_empty;
91 list_for_each_entry(ra_list, ra_list_hhead, list) {
92 is_list_empty = skb_queue_empty(&ra_list->skb_head);
93 if (!is_list_empty)
94 return false;
97 return true;
100 void mwifiex_wmm_add_buf_txqueue(struct mwifiex_private *priv,
101 struct sk_buff *skb);
102 void mwifiex_wmm_add_buf_bypass_txqueue(struct mwifiex_private *priv,
103 struct sk_buff *skb);
104 void mwifiex_ralist_add(struct mwifiex_private *priv, const u8 *ra);
105 void mwifiex_rotate_priolists(struct mwifiex_private *priv,
106 struct mwifiex_ra_list_tbl *ra, int tid);
108 int mwifiex_wmm_lists_empty(struct mwifiex_adapter *adapter);
109 int mwifiex_bypass_txlist_empty(struct mwifiex_adapter *adapter);
110 void mwifiex_wmm_process_tx(struct mwifiex_adapter *adapter);
111 void mwifiex_process_bypass_tx(struct mwifiex_adapter *adapter);
112 int mwifiex_is_ralist_valid(struct mwifiex_private *priv,
113 struct mwifiex_ra_list_tbl *ra_list, int tid);
115 u8 mwifiex_wmm_compute_drv_pkt_delay(struct mwifiex_private *priv,
116 const struct sk_buff *skb);
117 void mwifiex_wmm_init(struct mwifiex_adapter *adapter);
119 u32 mwifiex_wmm_process_association_req(struct mwifiex_private *priv,
120 u8 **assoc_buf,
121 struct ieee_types_wmm_parameter *wmmie,
122 struct ieee80211_ht_cap *htcap);
124 void mwifiex_wmm_setup_queue_priorities(struct mwifiex_private *priv,
125 struct ieee_types_wmm_parameter *wmm_ie);
126 void mwifiex_wmm_setup_ac_downgrade(struct mwifiex_private *priv);
127 int mwifiex_ret_wmm_get_status(struct mwifiex_private *priv,
128 const struct host_cmd_ds_command *resp);
129 struct mwifiex_ra_list_tbl *
130 mwifiex_wmm_get_queue_raptr(struct mwifiex_private *priv, u8 tid,
131 const u8 *ra_addr);
132 u8 mwifiex_wmm_downgrade_tid(struct mwifiex_private *priv, u32 tid);
133 void mwifiex_update_ralist_tx_pause(struct mwifiex_private *priv, u8 *mac,
134 u8 tx_pause);
135 void mwifiex_update_ralist_tx_pause_in_tdls_cs(struct mwifiex_private *priv,
136 u8 *mac, u8 tx_pause);
138 struct mwifiex_ra_list_tbl *mwifiex_wmm_get_ralist_node(struct mwifiex_private
139 *priv, u8 tid, const u8 *ra_addr);
140 #endif /* !_MWIFIEX_WMM_H_ */