1 /* SPDX-License-Identifier: GPL-2.0-only */
2 /*
3 * NXP Wireless LAN device driver: WMM
4 *
5 * Copyright 2011-2024 NXP
6 */
7
8 #ifndef _NXPWIFI_WMM_H_
9 #define _NXPWIFI_WMM_H_
10
11 enum ieee_types_wmm_aciaifsn_bitmasks {
12 NXPWIFI_AIFSN = (BIT(0) | BIT(1) | BIT(2) | BIT(3)),
13 NXPWIFI_ACM = BIT(4),
14 NXPWIFI_ACI = (BIT(5) | BIT(6)),
15 };
16
17 enum ieee_types_wmm_ecw_bitmasks {
18 NXPWIFI_ECW_MIN = (BIT(0) | BIT(1) | BIT(2) | BIT(3)),
19 NXPWIFI_ECW_MAX = (BIT(4) | BIT(5) | BIT(6) | BIT(7)),
20 };
21
22 extern const u16 nxpwifi_1d_to_wmm_queue[];
23
24 /* Retrieve the TID of the given RA list. */
25 static inline int
nxpwifi_get_tid(struct nxpwifi_ra_list_tbl * ptr)26 nxpwifi_get_tid(struct nxpwifi_ra_list_tbl *ptr)
27 {
28 struct sk_buff *skb;
29
30 if (skb_queue_empty(&ptr->skb_head))
31 return 0;
32
33 skb = skb_peek(&ptr->skb_head);
34
35 return skb->priority;
36 }
37
38 void nxpwifi_wmm_add_buf_txqueue(struct nxpwifi_private *priv,
39 struct sk_buff *skb);
40 void nxpwifi_wmm_add_buf_bypass_txqueue(struct nxpwifi_private *priv,
41 struct sk_buff *skb);
42 void nxpwifi_ralist_add(struct nxpwifi_private *priv, const u8 *ra);
43 void nxpwifi_rotate_priolists(struct nxpwifi_private *priv,
44 struct nxpwifi_ra_list_tbl *ra, int tid);
45
46 bool nxpwifi_wmm_lists_empty(struct nxpwifi_adapter *adapter);
47 bool nxpwifi_bypass_txlist_empty(struct nxpwifi_adapter *adapter);
48 void nxpwifi_wmm_process_tx(struct nxpwifi_adapter *adapter);
49 void nxpwifi_process_bypass_tx(struct nxpwifi_adapter *adapter);
50 bool nxpwifi_is_ralist_valid(struct nxpwifi_private *priv,
51 struct nxpwifi_ra_list_tbl *ra_list, int tid);
52
53 u8 nxpwifi_wmm_compute_drv_pkt_delay(struct nxpwifi_private *priv,
54 const struct sk_buff *skb);
55 void nxpwifi_wmm_init(struct nxpwifi_adapter *adapter);
56
57 u32 nxpwifi_wmm_process_association_req(struct nxpwifi_private *priv,
58 u8 **assoc_buf,
59 struct ieee80211_wmm_param_ie *wmmie,
60 struct ieee80211_ht_cap *htcap);
61
62 void nxpwifi_wmm_setup_queue_priorities(struct nxpwifi_private *priv,
63 struct ieee80211_wmm_param_ie *wmm_ie);
64 void nxpwifi_wmm_setup_ac_downgrade(struct nxpwifi_private *priv);
65 int nxpwifi_ret_wmm_get_status(struct nxpwifi_private *priv,
66 const struct host_cmd_ds_command *resp);
67 struct nxpwifi_ra_list_tbl *
68 nxpwifi_wmm_get_queue_raptr(struct nxpwifi_private *priv, u8 tid,
69 const u8 *ra_addr);
70 u8 nxpwifi_wmm_downgrade_tid(struct nxpwifi_private *priv, u32 tid);
71 void nxpwifi_update_ralist_tx_pause(struct nxpwifi_private *priv, u8 *mac,
72 u8 tx_pause);
73
74 struct nxpwifi_ra_list_tbl *nxpwifi_wmm_get_ralist_node(struct nxpwifi_private
75 *priv, u8 tid, const u8 *ra_addr);
76 void nxpwifi_wmm_init_tos_to_tid_inv(struct nxpwifi_private *priv);
77 #endif /* !_NXPWIFI_WMM_H_ */
78