Commit ba101ad5 authored by Xinming Hu's avatar Xinming Hu Committed by Kalle Valo
Browse files

mwifiex: add tdls channel switch status



This patch add new tdls status used for tdls channel switch.
Driver in turn would block cmd path and data path if tdls
channel switching. Data path to non tdls peer should be blocked
if tdls channel switch to off-channel.

Signed-off-by: default avatarXinming Hu <huxm@marvell.com>
Signed-off-by: default avatarAvinash Patil <patila@marvell.com>
Signed-off-by: default avatarCathy Luo <cluo@marvell.com>
Signed-off-by: default avatarKalle Valo <kvalo@codeaurora.org>
parent 9186a1f3
Loading
Loading
Loading
Loading
+3 −0
Original line number Diff line number Diff line
@@ -141,6 +141,9 @@ enum mwifiex_tdls_status {
	TDLS_SETUP_COMPLETE,
	TDLS_SETUP_FAILURE,
	TDLS_LINK_TEARDOWN,
	TDLS_CHAN_SWITCHING,
	TDLS_IN_BASE_CHAN,
	TDLS_IN_OFF_CHAN,
};

enum mwifiex_tdls_error_code {
+12 −2
Original line number Diff line number Diff line
@@ -299,9 +299,15 @@ process_start:

			if ((!adapter->scan_chan_gap_enabled &&
			     adapter->scan_processing) || adapter->data_sent ||
			     mwifiex_is_tdls_chan_switching
			     (mwifiex_get_priv(adapter,
					       MWIFIEX_BSS_ROLE_STA)) ||
			    (mwifiex_wmm_lists_empty(adapter) &&
			     skb_queue_empty(&adapter->tx_data_q))) {
				if (adapter->cmd_sent || adapter->curr_cmd ||
					!mwifiex_is_send_cmd_allowed
						(mwifiex_get_priv(adapter,
						MWIFIEX_BSS_ROLE_STA)) ||
				    (!is_command_pending(adapter)))
					break;
			}
@@ -342,7 +348,9 @@ process_start:
			continue;
		}

		if (!adapter->cmd_sent && !adapter->curr_cmd) {
		if (!adapter->cmd_sent && !adapter->curr_cmd &&
		    mwifiex_is_send_cmd_allowed
		    (mwifiex_get_priv(adapter, MWIFIEX_BSS_ROLE_STA))) {
			if (mwifiex_exec_next_cmd(adapter) == -1) {
				ret = -1;
				break;
@@ -365,7 +373,9 @@ process_start:

		if ((adapter->scan_chan_gap_enabled ||
		     !adapter->scan_processing) &&
		    !adapter->data_sent && !mwifiex_wmm_lists_empty(adapter)) {
		    !adapter->data_sent && !mwifiex_wmm_lists_empty(adapter) &&
		    !mwifiex_is_tdls_chan_switching
			(mwifiex_get_priv(adapter, MWIFIEX_BSS_ROLE_STA))) {
			mwifiex_wmm_process_tx(adapter);
			if (adapter->hs_activated) {
				adapter->is_hs_configured = false;
+3 −0
Original line number Diff line number Diff line
@@ -1461,6 +1461,9 @@ struct mwifiex_sta_node *
mwifiex_add_sta_entry(struct mwifiex_private *priv, const u8 *mac);
struct mwifiex_sta_node *
mwifiex_get_sta_entry(struct mwifiex_private *priv, const u8 *mac);
u8 mwifiex_is_tdls_chan_switching(struct mwifiex_private *priv);
u8 mwifiex_is_tdls_off_chan(struct mwifiex_private *priv);
u8 mwifiex_is_send_cmd_allowed(struct mwifiex_private *priv);
int mwifiex_send_tdls_data_frame(struct mwifiex_private *priv, const u8 *peer,
				 u8 action_code, u8 dialog_token,
				 u16 status_code, const u8 *extra_ies,
+59 −0
Original line number Diff line number Diff line
@@ -531,6 +531,65 @@ mwifiex_get_sta_entry(struct mwifiex_private *priv, const u8 *mac)
	return NULL;
}

static struct mwifiex_sta_node *
mwifiex_get_tdls_sta_entry(struct mwifiex_private *priv, u8 status)
{
	struct mwifiex_sta_node *node;

	list_for_each_entry(node, &priv->sta_list, list) {
		if (node->tdls_status == status)
			return node;
	}

	return NULL;
}

/* If tdls channel switching is on-going, tx data traffic should be
 * blocked until the switching stage completed.
 */
u8 mwifiex_is_tdls_chan_switching(struct mwifiex_private *priv)
{
	struct mwifiex_sta_node *sta_ptr;

	if (!priv || !ISSUPP_TDLS_ENABLED(priv->adapter->fw_cap_info))
		return false;

	sta_ptr = mwifiex_get_tdls_sta_entry(priv, TDLS_CHAN_SWITCHING);
	if (sta_ptr)
		return true;

	return false;
}

u8 mwifiex_is_tdls_off_chan(struct mwifiex_private *priv)
{
	struct mwifiex_sta_node *sta_ptr;

	if (!priv || !ISSUPP_TDLS_ENABLED(priv->adapter->fw_cap_info))
		return false;

	sta_ptr = mwifiex_get_tdls_sta_entry(priv, TDLS_IN_OFF_CHAN);
	if (sta_ptr)
		return true;

	return false;
}

/* If tdls channel switching is on-going or tdls operate on off-channel,
 * cmd path should be blocked until tdls switched to base-channel.
 */
u8 mwifiex_is_send_cmd_allowed(struct mwifiex_private *priv)
{
	if (!priv || !ISSUPP_TDLS_ENABLED(priv->adapter->fw_cap_info))
		return true;

	if (mwifiex_is_tdls_chan_switching(priv) ||
	    mwifiex_is_tdls_off_chan(priv))
		return false;

	return true;
}

/* This function will add a sta_node entry to associated station list
 * table with the given mac address.
 * If entry exist already, existing entry is returned.