Donate to e Foundation | Murena handsets with /e/OS | Own a part of Murena! Learn more

Commit fe07aa7a authored by Ron Rindjunsky's avatar Ron Rindjunsky Committed by John W. Linville
Browse files

iwlwifi: arranging aggregation actions



This patch makes some renaming of the ampdu_action functions inside
iwlwifi, and adds checks for correct station id in Rx flows

Signed-off-by: default avatarRon Rindjunsky <ron.rindjunsky@intel.com>
Signed-off-by: default avatarTomas Winkler <tomas.winkler@intel.com>
Signed-off-by: default avatarJohn W. Linville <linville@tuxdriver.com>
parent 3ec47732
Loading
Loading
Loading
Loading
+37 −33
Original line number Original line Diff line number Diff line
@@ -4063,10 +4063,15 @@ void iwl4965_set_ht_add_station(struct iwl_priv *priv, u8 index,
	return;
	return;
}
}


static void iwl4965_sta_modify_add_ba_tid(struct iwl_priv *priv,
static int iwl4965_rx_agg_start(struct iwl_priv *priv,
					  int sta_id, int tid, u16 ssn)
				const u8 *addr, int tid, u16 ssn)
{
{
	unsigned long flags;
	unsigned long flags;
	int sta_id;

	sta_id = iwl_find_station(priv, addr);
	if (sta_id == IWL_INVALID_STATION)
		return -ENXIO;


	spin_lock_irqsave(&priv->sta_lock, flags);
	spin_lock_irqsave(&priv->sta_lock, flags);
	priv->stations[sta_id].sta.station_flags_msk = 0;
	priv->stations[sta_id].sta.station_flags_msk = 0;
@@ -4076,13 +4081,19 @@ static void iwl4965_sta_modify_add_ba_tid(struct iwl_priv *priv,
	priv->stations[sta_id].sta.mode = STA_CONTROL_MODIFY_MSK;
	priv->stations[sta_id].sta.mode = STA_CONTROL_MODIFY_MSK;
	spin_unlock_irqrestore(&priv->sta_lock, flags);
	spin_unlock_irqrestore(&priv->sta_lock, flags);


	iwl4965_send_add_station(priv, &priv->stations[sta_id].sta, CMD_ASYNC);
	return iwl4965_send_add_station(priv, &priv->stations[sta_id].sta,
					CMD_ASYNC);
}
}


static void iwl4965_sta_modify_del_ba_tid(struct iwl_priv *priv,
static int iwl4965_rx_agg_stop(struct iwl_priv *priv,
					  int sta_id, int tid)
			       const u8 *addr, int tid)
{
{
	unsigned long flags;
	unsigned long flags;
	int sta_id;

	sta_id = iwl_find_station(priv, addr);
	if (sta_id == IWL_INVALID_STATION)
		return -ENXIO;


	spin_lock_irqsave(&priv->sta_lock, flags);
	spin_lock_irqsave(&priv->sta_lock, flags);
	priv->stations[sta_id].sta.station_flags_msk = 0;
	priv->stations[sta_id].sta.station_flags_msk = 0;
@@ -4091,7 +4102,8 @@ static void iwl4965_sta_modify_del_ba_tid(struct iwl_priv *priv,
	priv->stations[sta_id].sta.mode = STA_CONTROL_MODIFY_MSK;
	priv->stations[sta_id].sta.mode = STA_CONTROL_MODIFY_MSK;
	spin_unlock_irqrestore(&priv->sta_lock, flags);
	spin_unlock_irqrestore(&priv->sta_lock, flags);


	iwl4965_send_add_station(priv, &priv->stations[sta_id].sta, CMD_ASYNC);
	return iwl4965_send_add_station(priv, &priv->stations[sta_id].sta,
					CMD_ASYNC);
}
}


/*
/*
@@ -4110,7 +4122,7 @@ static int iwl4965_txq_ctx_activate_free(struct iwl_priv *priv)
	return -1;
	return -1;
}
}


static int iwl4965_mac_ht_tx_agg_start(struct ieee80211_hw *hw, const u8 *da,
static int iwl4965_tx_agg_start(struct ieee80211_hw *hw, const u8 *ra,
				u16 tid, u16 *start_seq_num)
				u16 tid, u16 *start_seq_num)
{
{
	struct iwl_priv *priv = hw->priv;
	struct iwl_priv *priv = hw->priv;
@@ -4128,10 +4140,10 @@ static int iwl4965_mac_ht_tx_agg_start(struct ieee80211_hw *hw, const u8 *da,
	else
	else
		return -EINVAL;
		return -EINVAL;


	IWL_WARNING("%s on da = %s tid = %d\n",
	IWL_WARNING("%s on ra = %s tid = %d\n",
			__func__, print_mac(mac, da), tid);
			__func__, print_mac(mac, ra), tid);


	sta_id = iwl_find_station(priv, da);
	sta_id = iwl_find_station(priv, ra);
	if (sta_id == IWL_INVALID_STATION)
	if (sta_id == IWL_INVALID_STATION)
		return -ENXIO;
		return -ENXIO;


@@ -4160,7 +4172,7 @@ static int iwl4965_mac_ht_tx_agg_start(struct ieee80211_hw *hw, const u8 *da,
	if (tid_data->tfds_in_queue == 0) {
	if (tid_data->tfds_in_queue == 0) {
		printk(KERN_ERR "HW queue is empty\n");
		printk(KERN_ERR "HW queue is empty\n");
		tid_data->agg.state = IWL_AGG_ON;
		tid_data->agg.state = IWL_AGG_ON;
		ieee80211_start_tx_ba_cb_irqsafe(hw, da, tid);
		ieee80211_start_tx_ba_cb_irqsafe(hw, ra, tid);
	} else {
	} else {
		IWL_DEBUG_HT("HW queue is NOT empty: %d packets in HW queue\n",
		IWL_DEBUG_HT("HW queue is NOT empty: %d packets in HW queue\n",
				tid_data->tfds_in_queue);
				tid_data->tfds_in_queue);
@@ -4169,10 +4181,8 @@ static int iwl4965_mac_ht_tx_agg_start(struct ieee80211_hw *hw, const u8 *da,
	return ret;
	return ret;
}
}


static int iwl4965_mac_ht_tx_agg_stop(struct ieee80211_hw *hw, const u8 *da,
static int iwl4965_tx_agg_stop(struct ieee80211_hw *hw, const u8 *ra, u16 tid)
				      u16 tid)
{
{

	struct iwl_priv *priv = hw->priv;
	struct iwl_priv *priv = hw->priv;
	int tx_fifo_id, txq_id, sta_id, ssn = -1;
	int tx_fifo_id, txq_id, sta_id, ssn = -1;
	struct iwl4965_tid_data *tid_data;
	struct iwl4965_tid_data *tid_data;
@@ -4180,8 +4190,8 @@ static int iwl4965_mac_ht_tx_agg_stop(struct ieee80211_hw *hw, const u8 *da,
	unsigned long flags;
	unsigned long flags;
	DECLARE_MAC_BUF(mac);
	DECLARE_MAC_BUF(mac);


	if (!da) {
	if (!ra) {
		IWL_ERROR("da = NULL\n");
		IWL_ERROR("ra = NULL\n");
		return -EINVAL;
		return -EINVAL;
	}
	}


@@ -4190,7 +4200,7 @@ static int iwl4965_mac_ht_tx_agg_stop(struct ieee80211_hw *hw, const u8 *da,
	else
	else
		return -EINVAL;
		return -EINVAL;


	sta_id = iwl_find_station(priv, da);
	sta_id = iwl_find_station(priv, ra);


	if (sta_id == IWL_INVALID_STATION)
	if (sta_id == IWL_INVALID_STATION)
		return -ENXIO;
		return -ENXIO;
@@ -4212,7 +4222,7 @@ static int iwl4965_mac_ht_tx_agg_stop(struct ieee80211_hw *hw, const u8 *da,
		return 0;
		return 0;
	}
	}


	IWL_DEBUG_HT("HW queue empty\n");;
	IWL_DEBUG_HT("HW queue is empty\n");
	priv->stations[sta_id].tid[tid].agg.state = IWL_AGG_OFF;
	priv->stations[sta_id].tid[tid].agg.state = IWL_AGG_OFF;


	spin_lock_irqsave(&priv->lock, flags);
	spin_lock_irqsave(&priv->lock, flags);
@@ -4222,10 +4232,7 @@ static int iwl4965_mac_ht_tx_agg_stop(struct ieee80211_hw *hw, const u8 *da,
	if (ret)
	if (ret)
		return ret;
		return ret;


	ieee80211_stop_tx_ba_cb_irqsafe(priv->hw, da, tid);
	ieee80211_stop_tx_ba_cb_irqsafe(priv->hw, ra, tid);

	IWL_DEBUG_INFO("iwl4965_mac_ht_tx_agg_stop on da=%s tid=%d\n",
			print_mac(mac, da), tid);


	return 0;
	return 0;
}
}
@@ -4235,27 +4242,24 @@ int iwl4965_mac_ampdu_action(struct ieee80211_hw *hw,
			     const u8 *addr, u16 tid, u16 *ssn)
			     const u8 *addr, u16 tid, u16 *ssn)
{
{
	struct iwl_priv *priv = hw->priv;
	struct iwl_priv *priv = hw->priv;
	int sta_id;
	DECLARE_MAC_BUF(mac);
	DECLARE_MAC_BUF(mac);


	IWL_DEBUG_HT("A-MPDU action on da=%s tid=%d ",
	IWL_DEBUG_HT("A-MPDU action on addr %s tid %d\n",
		     print_mac(mac, addr), tid);
		     print_mac(mac, addr), tid);
	sta_id = iwl_find_station(priv, addr);

	switch (action) {
	switch (action) {
	case IEEE80211_AMPDU_RX_START:
	case IEEE80211_AMPDU_RX_START:
		IWL_DEBUG_HT("start Rx\n");
		IWL_DEBUG_HT("start Rx\n");
		iwl4965_sta_modify_add_ba_tid(priv, sta_id, tid, *ssn);
		return iwl4965_rx_agg_start(priv, addr, tid, *ssn);
		break;
	case IEEE80211_AMPDU_RX_STOP:
	case IEEE80211_AMPDU_RX_STOP:
		IWL_DEBUG_HT("stop Rx\n");
		IWL_DEBUG_HT("stop Rx\n");
		iwl4965_sta_modify_del_ba_tid(priv, sta_id, tid);
		return iwl4965_rx_agg_stop(priv, addr, tid);
		break;
	case IEEE80211_AMPDU_TX_START:
	case IEEE80211_AMPDU_TX_START:
		IWL_DEBUG_HT("start Tx\n");
		IWL_DEBUG_HT("start Tx\n");
		return iwl4965_mac_ht_tx_agg_start(hw, addr, tid, ssn);
		return iwl4965_tx_agg_start(hw, addr, tid, ssn);
	case IEEE80211_AMPDU_TX_STOP:
	case IEEE80211_AMPDU_TX_STOP:
		IWL_DEBUG_HT("stop Tx\n");
		IWL_DEBUG_HT("stop Tx\n");
		return iwl4965_mac_ht_tx_agg_stop(hw, addr, tid);
		return iwl4965_tx_agg_stop(hw, addr, tid);
	default:
	default:
		IWL_DEBUG_HT("unknown\n");
		IWL_DEBUG_HT("unknown\n");
		return -EINVAL;
		return -EINVAL;