Linux Audio

Check our new training course

Loading...
Note: File does not exist in v6.2.
  1/*
  2 * Marvell Wireless LAN device driver: 802.11n
  3 *
  4 * Copyright (C) 2011, Marvell International Ltd.
  5 *
  6 * This software file (the "File") is distributed by Marvell International
  7 * Ltd. 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.
 13 *
 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.
 18 */
 19
 20#ifndef _MWIFIEX_11N_H_
 21#define _MWIFIEX_11N_H_
 22
 23#include "11n_aggr.h"
 24#include "11n_rxreorder.h"
 25#include "wmm.h"
 26
 27int mwifiex_ret_11n_delba(struct mwifiex_private *priv,
 28			  struct host_cmd_ds_command *resp);
 29int mwifiex_ret_11n_addba_req(struct mwifiex_private *priv,
 30			      struct host_cmd_ds_command *resp);
 31int mwifiex_ret_11n_cfg(struct host_cmd_ds_command *resp,
 32			struct mwifiex_ds_11n_tx_cfg *tx_cfg);
 33int mwifiex_cmd_11n_cfg(struct host_cmd_ds_command *cmd, u16 cmd_action,
 34			struct mwifiex_ds_11n_tx_cfg *txcfg);
 35
 36int mwifiex_cmd_append_11n_tlv(struct mwifiex_private *priv,
 37			       struct mwifiex_bssdescriptor *bss_desc,
 38			       u8 **buffer);
 39void mwifiex_cfg_tx_buf(struct mwifiex_private *priv,
 40			struct mwifiex_bssdescriptor *bss_desc);
 41void mwifiex_fill_cap_info(struct mwifiex_private *, u8 radio_type,
 42			   struct mwifiex_ie_types_htcap *);
 43int mwifiex_set_get_11n_htcap_cfg(struct mwifiex_private *priv,
 44				  u16 action, int *htcap_cfg);
 45void mwifiex_11n_delete_tx_ba_stream_tbl_entry(struct mwifiex_private *priv,
 46					     struct mwifiex_tx_ba_stream_tbl
 47					     *tx_tbl);
 48void mwifiex_11n_delete_all_tx_ba_stream_tbl(struct mwifiex_private *priv);
 49struct mwifiex_tx_ba_stream_tbl *mwifiex_11n_get_tx_ba_stream_tbl(struct
 50							     mwifiex_private
 51							     *priv, int tid,
 52							     u8 *ra);
 53void mwifiex_11n_create_tx_ba_stream_tbl(struct mwifiex_private *priv, u8 *ra,
 54				       int tid,
 55				       enum mwifiex_ba_status ba_status);
 56int mwifiex_send_addba(struct mwifiex_private *priv, int tid, u8 *peer_mac);
 57int mwifiex_send_delba(struct mwifiex_private *priv, int tid, u8 *peer_mac,
 58		       int initiator);
 59void mwifiex_11n_delete_ba_stream(struct mwifiex_private *priv, u8 *del_ba);
 60int mwifiex_get_rx_reorder_tbl(struct mwifiex_private *priv,
 61			      struct mwifiex_ds_rx_reorder_tbl *buf);
 62int mwifiex_get_tx_ba_stream_tbl(struct mwifiex_private *priv,
 63			       struct mwifiex_ds_tx_ba_stream_tbl *buf);
 64int mwifiex_ret_amsdu_aggr_ctrl(struct host_cmd_ds_command *resp,
 65				struct mwifiex_ds_11n_amsdu_aggr_ctrl
 66				*amsdu_aggr_ctrl);
 67int mwifiex_cmd_recfg_tx_buf(struct mwifiex_private *priv,
 68			     struct host_cmd_ds_command *cmd,
 69			     int cmd_action, u16 *buf_size);
 70int mwifiex_cmd_amsdu_aggr_ctrl(struct host_cmd_ds_command *cmd,
 71				int cmd_action,
 72				struct mwifiex_ds_11n_amsdu_aggr_ctrl *aa_ctrl);
 73
 74/*
 75 * This function checks whether AMPDU is allowed or not for a particular TID.
 76 */
 77static inline u8
 78mwifiex_is_ampdu_allowed(struct mwifiex_private *priv, int tid)
 79{
 80	return ((priv->aggr_prio_tbl[tid].ampdu_ap != BA_STREAM_NOT_ALLOWED)
 81		? true : false);
 82}
 83
 84/*
 85 * This function checks whether AMSDU is allowed or not for a particular TID.
 86 */
 87static inline u8
 88mwifiex_is_amsdu_allowed(struct mwifiex_private *priv, int tid)
 89{
 90	return (((priv->aggr_prio_tbl[tid].amsdu != BA_STREAM_NOT_ALLOWED)
 91			&& ((priv->is_data_rate_auto)
 92			|| !((priv->bitmap_rates[2]) & 0x03)))
 93		? true : false);
 94}
 95
 96/*
 97 * This function checks whether a space is available for new BA stream or not.
 98 */
 99static inline u8 mwifiex_space_avail_for_new_ba_stream(
100					struct mwifiex_adapter *adapter)
101{
102	struct mwifiex_private *priv;
103	u8 i;
104	u32 ba_stream_num = 0;
105
106	for (i = 0; i < adapter->priv_num; i++) {
107		priv = adapter->priv[i];
108		if (priv)
109			ba_stream_num += mwifiex_wmm_list_len(
110						(struct list_head *)
111						&priv->tx_ba_stream_tbl_ptr);
112	}
113
114	return ((ba_stream_num <
115		 MWIFIEX_MAX_TX_BASTREAM_SUPPORTED) ? true : false);
116}
117
118/*
119 * This function finds the correct Tx BA stream to delete.
120 *
121 * Upon successfully locating, both the TID and the RA are returned.
122 */
123static inline u8
124mwifiex_find_stream_to_delete(struct mwifiex_private *priv, int ptr_tid,
125			      int *ptid, u8 *ra)
126{
127	int tid;
128	u8 ret = false;
129	struct mwifiex_tx_ba_stream_tbl *tx_tbl;
130	unsigned long flags;
131
132	tid = priv->aggr_prio_tbl[ptr_tid].ampdu_user;
133
134	spin_lock_irqsave(&priv->tx_ba_stream_tbl_lock, flags);
135	list_for_each_entry(tx_tbl, &priv->tx_ba_stream_tbl_ptr, list) {
136		if (tid > priv->aggr_prio_tbl[tx_tbl->tid].ampdu_user) {
137			tid = priv->aggr_prio_tbl[tx_tbl->tid].ampdu_user;
138			*ptid = tx_tbl->tid;
139			memcpy(ra, tx_tbl->ra, ETH_ALEN);
140			ret = true;
141		}
142	}
143	spin_unlock_irqrestore(&priv->tx_ba_stream_tbl_lock, flags);
144
145	return ret;
146}
147
148/*
149 * This function checks whether BA stream is set up or not.
150 */
151static inline int
152mwifiex_is_ba_stream_setup(struct mwifiex_private *priv,
153			  struct mwifiex_ra_list_tbl *ptr, int tid)
154{
155	struct mwifiex_tx_ba_stream_tbl *tx_tbl;
156
157	tx_tbl = mwifiex_11n_get_tx_ba_stream_tbl(priv, tid, ptr->ra);
158	if (tx_tbl && IS_BASTREAM_SETUP(tx_tbl))
159		return true;
160
161	return false;
162}
163#endif /* !_MWIFIEX_11N_H_ */