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

Commit 48669953 authored by John W. Linville's avatar John W. Linville
Browse files

Merge branch 'wireless-next-2.6' of...

parents 5b714c6a d0fe478c
Loading
Loading
Loading
Loading
+2 −2
Original line number Original line Diff line number Diff line
@@ -130,7 +130,7 @@ static int iwl1000_hw_set_hw_params(struct iwl_priv *priv)
			sizeof(struct iwlagn_scd_bc_tbl);
			sizeof(struct iwlagn_scd_bc_tbl);
	priv->hw_params.tfd_size = sizeof(struct iwl_tfd);
	priv->hw_params.tfd_size = sizeof(struct iwl_tfd);
	priv->hw_params.max_stations = IWLAGN_STATION_COUNT;
	priv->hw_params.max_stations = IWLAGN_STATION_COUNT;
	priv->hw_params.bcast_sta_id = IWLAGN_BROADCAST_ID;
	priv->contexts[IWL_RXON_CTX_BSS].bcast_sta_id = IWLAGN_BROADCAST_ID;


	priv->hw_params.max_data_size = IWLAGN_RTC_DATA_SIZE;
	priv->hw_params.max_data_size = IWLAGN_RTC_DATA_SIZE;
	priv->hw_params.max_inst_size = IWLAGN_RTC_INST_SIZE;
	priv->hw_params.max_inst_size = IWLAGN_RTC_INST_SIZE;
@@ -217,7 +217,7 @@ static struct iwl_lib_ops iwl1000_lib = {
		.set_ct_kill = iwl1000_set_ct_threshold,
		.set_ct_kill = iwl1000_set_ct_threshold,
	 },
	 },
	.manage_ibss_station = iwlagn_manage_ibss_station,
	.manage_ibss_station = iwlagn_manage_ibss_station,
	.update_bcast_station = iwl_update_bcast_station,
	.update_bcast_stations = iwl_update_bcast_stations,
	.debugfs_ops = {
	.debugfs_ops = {
		.rx_stats_read = iwl_ucode_rx_stats_read,
		.rx_stats_read = iwl_ucode_rx_stats_read,
		.tx_stats_read = iwl_ucode_tx_stats_read,
		.tx_stats_read = iwl_ucode_tx_stats_read,
+1 −0
Original line number Original line Diff line number Diff line
@@ -226,6 +226,7 @@ struct iwl3945_eeprom {


/* 4 DATA + 1 CMD. There are 2 HCCA queues that are not used. */
/* 4 DATA + 1 CMD. There are 2 HCCA queues that are not used. */
#define IWL39_NUM_QUEUES        5
#define IWL39_NUM_QUEUES        5
#define IWL39_CMD_QUEUE_NUM	4


#define IWL_DEFAULT_TX_RETRY  15
#define IWL_DEFAULT_TX_RETRY  15


+4 −3
Original line number Original line Diff line number Diff line
@@ -343,7 +343,7 @@ void iwl3945_rs_rate_init(struct iwl_priv *priv, struct ieee80211_sta *sta, u8 s
	int i;
	int i;


	IWL_DEBUG_INFO(priv, "enter\n");
	IWL_DEBUG_INFO(priv, "enter\n");
	if (sta_id == priv->hw_params.bcast_sta_id)
	if (sta_id == priv->contexts[IWL_RXON_CTX_BSS].bcast_sta_id)
		goto out;
		goto out;


	psta = (struct iwl3945_sta_priv *) sta->drv_priv;
	psta = (struct iwl3945_sta_priv *) sta->drv_priv;
@@ -932,7 +932,7 @@ void iwl3945_rate_scale_init(struct ieee80211_hw *hw, s32 sta_id)


	rcu_read_lock();
	rcu_read_lock();


	sta = ieee80211_find_sta(priv->vif,
	sta = ieee80211_find_sta(priv->contexts[IWL_RXON_CTX_BSS].vif,
				 priv->stations[sta_id].sta.sta.addr);
				 priv->stations[sta_id].sta.sta.addr);
	if (!sta) {
	if (!sta) {
		IWL_DEBUG_RATE(priv, "Unable to find station to initialize rate scaling.\n");
		IWL_DEBUG_RATE(priv, "Unable to find station to initialize rate scaling.\n");
@@ -949,7 +949,8 @@ void iwl3945_rate_scale_init(struct ieee80211_hw *hw, s32 sta_id)
	switch (priv->band) {
	switch (priv->band) {
	case IEEE80211_BAND_2GHZ:
	case IEEE80211_BAND_2GHZ:
		/* TODO: this always does G, not a regression */
		/* TODO: this always does G, not a regression */
		if (priv->active_rxon.flags & RXON_FLG_TGG_PROTECT_MSK) {
		if (priv->contexts[IWL_RXON_CTX_BSS].active.flags &
						RXON_FLG_TGG_PROTECT_MSK) {
			rs_sta->tgg = 1;
			rs_sta->tgg = 1;
			rs_sta->expected_tpt = iwl3945_expected_tpt_g_prot;
			rs_sta->expected_tpt = iwl3945_expected_tpt_g_prot;
		} else
		} else
+48 −38
Original line number Original line Diff line number Diff line
@@ -245,7 +245,7 @@ int iwl3945_rs_next_rate(struct iwl_priv *priv, int rate)
		break;
		break;
	case IEEE80211_BAND_2GHZ:
	case IEEE80211_BAND_2GHZ:
		if (!(priv->_3945.sta_supp_rates & IWL_OFDM_RATES_MASK) &&
		if (!(priv->_3945.sta_supp_rates & IWL_OFDM_RATES_MASK) &&
		    iwl_is_associated(priv)) {
		    iwl_is_associated(priv, IWL_RXON_CTX_BSS)) {
			if (rate == IWL_RATE_11M_INDEX)
			if (rate == IWL_RATE_11M_INDEX)
				next_rate = IWL_RATE_5M_INDEX;
				next_rate = IWL_RATE_5M_INDEX;
		}
		}
@@ -273,7 +273,7 @@ static void iwl3945_tx_queue_reclaim(struct iwl_priv *priv,
	struct iwl_queue *q = &txq->q;
	struct iwl_queue *q = &txq->q;
	struct iwl_tx_info *tx_info;
	struct iwl_tx_info *tx_info;


	BUG_ON(txq_id == IWL_CMD_QUEUE_NUM);
	BUG_ON(txq_id == IWL39_CMD_QUEUE_NUM);


	for (index = iwl_queue_inc_wrap(index, q->n_bd); q->read_ptr != index;
	for (index = iwl_queue_inc_wrap(index, q->n_bd); q->read_ptr != index;
		q->read_ptr = iwl_queue_inc_wrap(q->read_ptr, q->n_bd)) {
		q->read_ptr = iwl_queue_inc_wrap(q->read_ptr, q->n_bd)) {
@@ -285,7 +285,7 @@ static void iwl3945_tx_queue_reclaim(struct iwl_priv *priv,
	}
	}


	if (iwl_queue_space(q) > q->low_mark && (txq_id >= 0) &&
	if (iwl_queue_space(q) > q->low_mark && (txq_id >= 0) &&
			(txq_id != IWL_CMD_QUEUE_NUM) &&
			(txq_id != IWL39_CMD_QUEUE_NUM) &&
			priv->mac80211_registered)
			priv->mac80211_registered)
		iwl_wake_queue(priv, txq_id);
		iwl_wake_queue(priv, txq_id);
}
}
@@ -760,7 +760,7 @@ void iwl3945_hw_build_tx_cmd_rate(struct iwl_priv *priv,
		data_retry_limit = IWL_DEFAULT_TX_RETRY;
		data_retry_limit = IWL_DEFAULT_TX_RETRY;
	tx_cmd->data_retry_limit = data_retry_limit;
	tx_cmd->data_retry_limit = data_retry_limit;


	if (tx_id >= IWL_CMD_QUEUE_NUM)
	if (tx_id >= IWL39_CMD_QUEUE_NUM)
		rts_retry_limit = 3;
		rts_retry_limit = 3;
	else
	else
		rts_retry_limit = 7;
		rts_retry_limit = 7;
@@ -909,7 +909,7 @@ static int iwl3945_txq_ctx_reset(struct iwl_priv *priv)


	/* Tx queue(s) */
	/* Tx queue(s) */
	for (txq_id = 0; txq_id < priv->hw_params.max_txq_num; txq_id++) {
	for (txq_id = 0; txq_id < priv->hw_params.max_txq_num; txq_id++) {
		slots_num = (txq_id == IWL_CMD_QUEUE_NUM) ?
		slots_num = (txq_id == IWL39_CMD_QUEUE_NUM) ?
				TFD_CMD_SLOTS : TFD_TX_CMD_SLOTS;
				TFD_CMD_SLOTS : TFD_TX_CMD_SLOTS;
		rc = iwl_tx_queue_init(priv, &priv->txq[txq_id], slots_num,
		rc = iwl_tx_queue_init(priv, &priv->txq[txq_id], slots_num,
				       txq_id);
				       txq_id);
@@ -1072,7 +1072,7 @@ void iwl3945_hw_txq_ctx_free(struct iwl_priv *priv)
	if (priv->txq)
	if (priv->txq)
		for (txq_id = 0; txq_id < priv->hw_params.max_txq_num;
		for (txq_id = 0; txq_id < priv->hw_params.max_txq_num;
		     txq_id++)
		     txq_id++)
			if (txq_id == IWL_CMD_QUEUE_NUM)
			if (txq_id == IWL39_CMD_QUEUE_NUM)
				iwl_cmd_queue_free(priv);
				iwl_cmd_queue_free(priv);
			else
			else
				iwl_tx_queue_free(priv, txq_id);
				iwl_tx_queue_free(priv, txq_id);
@@ -1439,17 +1439,18 @@ static int iwl3945_send_tx_power(struct iwl_priv *priv)
	int rate_idx, i;
	int rate_idx, i;
	const struct iwl_channel_info *ch_info = NULL;
	const struct iwl_channel_info *ch_info = NULL;
	struct iwl3945_txpowertable_cmd txpower = {
	struct iwl3945_txpowertable_cmd txpower = {
		.channel = priv->active_rxon.channel,
		.channel = priv->contexts[IWL_RXON_CTX_BSS].active.channel,
	};
	};
	u16 chan;

	chan = le16_to_cpu(priv->contexts[IWL_RXON_CTX_BSS].active.channel);


	txpower.band = (priv->band == IEEE80211_BAND_5GHZ) ? 0 : 1;
	txpower.band = (priv->band == IEEE80211_BAND_5GHZ) ? 0 : 1;
	ch_info = iwl_get_channel_info(priv,
	ch_info = iwl_get_channel_info(priv, priv->band, chan);
				       priv->band,
				       le16_to_cpu(priv->active_rxon.channel));
	if (!ch_info) {
	if (!ch_info) {
		IWL_ERR(priv,
		IWL_ERR(priv,
			"Failed to get channel info for channel %d [%d]\n",
			"Failed to get channel info for channel %d [%d]\n",
			le16_to_cpu(priv->active_rxon.channel), priv->band);
			chan, priv->band);
		return -EINVAL;
		return -EINVAL;
	}
	}


@@ -1710,7 +1711,8 @@ int iwl3945_hw_reg_set_txpower(struct iwl_priv *priv, s8 power)
	return 0;
	return 0;
}
}


static int iwl3945_send_rxon_assoc(struct iwl_priv *priv)
static int iwl3945_send_rxon_assoc(struct iwl_priv *priv,
				   struct iwl_rxon_context *ctx)
{
{
	int rc = 0;
	int rc = 0;
	struct iwl_rx_packet *pkt;
	struct iwl_rx_packet *pkt;
@@ -1721,8 +1723,8 @@ static int iwl3945_send_rxon_assoc(struct iwl_priv *priv)
		.flags = CMD_WANT_SKB,
		.flags = CMD_WANT_SKB,
		.data = &rxon_assoc,
		.data = &rxon_assoc,
	};
	};
	const struct iwl_rxon_cmd *rxon1 = &priv->staging_rxon;
	const struct iwl_rxon_cmd *rxon1 = &ctx->staging;
	const struct iwl_rxon_cmd *rxon2 = &priv->active_rxon;
	const struct iwl_rxon_cmd *rxon2 = &ctx->active;


	if ((rxon1->flags == rxon2->flags) &&
	if ((rxon1->flags == rxon2->flags) &&
	    (rxon1->filter_flags == rxon2->filter_flags) &&
	    (rxon1->filter_flags == rxon2->filter_flags) &&
@@ -1732,10 +1734,10 @@ static int iwl3945_send_rxon_assoc(struct iwl_priv *priv)
		return 0;
		return 0;
	}
	}


	rxon_assoc.flags = priv->staging_rxon.flags;
	rxon_assoc.flags = ctx->staging.flags;
	rxon_assoc.filter_flags = priv->staging_rxon.filter_flags;
	rxon_assoc.filter_flags = ctx->staging.filter_flags;
	rxon_assoc.ofdm_basic_rates = priv->staging_rxon.ofdm_basic_rates;
	rxon_assoc.ofdm_basic_rates = ctx->staging.ofdm_basic_rates;
	rxon_assoc.cck_basic_rates = priv->staging_rxon.cck_basic_rates;
	rxon_assoc.cck_basic_rates = ctx->staging.cck_basic_rates;
	rxon_assoc.reserved = 0;
	rxon_assoc.reserved = 0;


	rc = iwl_send_cmd_sync(priv, &cmd);
	rc = iwl_send_cmd_sync(priv, &cmd);
@@ -1761,14 +1763,14 @@ static int iwl3945_send_rxon_assoc(struct iwl_priv *priv)
 * function correctly transitions out of the RXON_ASSOC_MSK state if
 * function correctly transitions out of the RXON_ASSOC_MSK state if
 * a HW tune is required based on the RXON structure changes.
 * a HW tune is required based on the RXON structure changes.
 */
 */
static int iwl3945_commit_rxon(struct iwl_priv *priv)
static int iwl3945_commit_rxon(struct iwl_priv *priv,
			       struct iwl_rxon_context *ctx)
{
{
	/* cast away the const for active_rxon in this function */
	/* cast away the const for active_rxon in this function */
	struct iwl3945_rxon_cmd *active_rxon = (void *)&priv->active_rxon;
	struct iwl3945_rxon_cmd *active_rxon = (void *)&ctx->active;
	struct iwl3945_rxon_cmd *staging_rxon = (void *)&priv->staging_rxon;
	struct iwl3945_rxon_cmd *staging_rxon = (void *)&ctx->staging;
	int rc = 0;
	int rc = 0;
	bool new_assoc =
	bool new_assoc = !!(staging_rxon->filter_flags & RXON_FILTER_ASSOC_MSK);
		!!(priv->staging_rxon.filter_flags & RXON_FILTER_ASSOC_MSK);


	if (!iwl_is_alive(priv))
	if (!iwl_is_alive(priv))
		return -1;
		return -1;
@@ -1781,7 +1783,7 @@ static int iwl3945_commit_rxon(struct iwl_priv *priv)
	    ~(RXON_FLG_DIS_DIV_MSK | RXON_FLG_ANT_SEL_MSK);
	    ~(RXON_FLG_DIS_DIV_MSK | RXON_FLG_ANT_SEL_MSK);
	staging_rxon->flags |= iwl3945_get_antenna_flags(priv);
	staging_rxon->flags |= iwl3945_get_antenna_flags(priv);


	rc = iwl_check_rxon_cmd(priv);
	rc = iwl_check_rxon_cmd(priv, ctx);
	if (rc) {
	if (rc) {
		IWL_ERR(priv, "Invalid RXON configuration.  Not committing.\n");
		IWL_ERR(priv, "Invalid RXON configuration.  Not committing.\n");
		return -EINVAL;
		return -EINVAL;
@@ -1790,8 +1792,9 @@ static int iwl3945_commit_rxon(struct iwl_priv *priv)
	/* If we don't need to send a full RXON, we can use
	/* If we don't need to send a full RXON, we can use
	 * iwl3945_rxon_assoc_cmd which is used to reconfigure filter
	 * iwl3945_rxon_assoc_cmd which is used to reconfigure filter
	 * and other flags for the current radio configuration. */
	 * and other flags for the current radio configuration. */
	if (!iwl_full_rxon_required(priv)) {
	if (!iwl_full_rxon_required(priv, &priv->contexts[IWL_RXON_CTX_BSS])) {
		rc = iwl_send_rxon_assoc(priv);
		rc = iwl_send_rxon_assoc(priv,
					 &priv->contexts[IWL_RXON_CTX_BSS]);
		if (rc) {
		if (rc) {
			IWL_ERR(priv, "Error setting RXON_ASSOC "
			IWL_ERR(priv, "Error setting RXON_ASSOC "
				  "configuration (%d).\n", rc);
				  "configuration (%d).\n", rc);
@@ -1807,7 +1810,7 @@ static int iwl3945_commit_rxon(struct iwl_priv *priv)
	 * an RXON_ASSOC and the new config wants the associated mask enabled,
	 * an RXON_ASSOC and the new config wants the associated mask enabled,
	 * we must clear the associated from the active configuration
	 * we must clear the associated from the active configuration
	 * before we apply the new config */
	 * before we apply the new config */
	if (iwl_is_associated(priv) && new_assoc) {
	if (iwl_is_associated(priv, IWL_RXON_CTX_BSS) && new_assoc) {
		IWL_DEBUG_INFO(priv, "Toggling associated bit on current RXON\n");
		IWL_DEBUG_INFO(priv, "Toggling associated bit on current RXON\n");
		active_rxon->filter_flags &= ~RXON_FILTER_ASSOC_MSK;
		active_rxon->filter_flags &= ~RXON_FILTER_ASSOC_MSK;


@@ -1819,7 +1822,7 @@ static int iwl3945_commit_rxon(struct iwl_priv *priv)
		active_rxon->reserved5 = 0;
		active_rxon->reserved5 = 0;
		rc = iwl_send_cmd_pdu(priv, REPLY_RXON,
		rc = iwl_send_cmd_pdu(priv, REPLY_RXON,
				      sizeof(struct iwl3945_rxon_cmd),
				      sizeof(struct iwl3945_rxon_cmd),
				      &priv->active_rxon);
				      &priv->contexts[IWL_RXON_CTX_BSS].active);


		/* If the mask clearing failed then we set
		/* If the mask clearing failed then we set
		 * active_rxon back to what it was previously */
		 * active_rxon back to what it was previously */
@@ -1829,8 +1832,9 @@ static int iwl3945_commit_rxon(struct iwl_priv *priv)
				  "configuration (%d).\n", rc);
				  "configuration (%d).\n", rc);
			return rc;
			return rc;
		}
		}
		iwl_clear_ucode_stations(priv);
		iwl_clear_ucode_stations(priv,
		iwl_restore_stations(priv);
					 &priv->contexts[IWL_RXON_CTX_BSS]);
		iwl_restore_stations(priv, &priv->contexts[IWL_RXON_CTX_BSS]);
	}
	}


	IWL_DEBUG_INFO(priv, "Sending RXON\n"
	IWL_DEBUG_INFO(priv, "Sending RXON\n"
@@ -1848,7 +1852,7 @@ static int iwl3945_commit_rxon(struct iwl_priv *priv)
	staging_rxon->reserved4 = 0;
	staging_rxon->reserved4 = 0;
	staging_rxon->reserved5 = 0;
	staging_rxon->reserved5 = 0;


	iwl_set_rxon_hwcrypto(priv, !iwl3945_mod_params.sw_crypto);
	iwl_set_rxon_hwcrypto(priv, ctx, !iwl3945_mod_params.sw_crypto);


	/* Apply the new configuration */
	/* Apply the new configuration */
	rc = iwl_send_cmd_pdu(priv, REPLY_RXON,
	rc = iwl_send_cmd_pdu(priv, REPLY_RXON,
@@ -1862,8 +1866,9 @@ static int iwl3945_commit_rxon(struct iwl_priv *priv)
	memcpy(active_rxon, staging_rxon, sizeof(*active_rxon));
	memcpy(active_rxon, staging_rxon, sizeof(*active_rxon));


	if (!new_assoc) {
	if (!new_assoc) {
		iwl_clear_ucode_stations(priv);
		iwl_clear_ucode_stations(priv,
		iwl_restore_stations(priv);
					 &priv->contexts[IWL_RXON_CTX_BSS]);
		iwl_restore_stations(priv, &priv->contexts[IWL_RXON_CTX_BSS]);
	}
	}


	/* If we issue a new RXON command which required a tune then we must
	/* If we issue a new RXON command which required a tune then we must
@@ -2302,7 +2307,9 @@ static int iwl3945_manage_ibss_station(struct iwl_priv *priv,
	int ret;
	int ret;


	if (add) {
	if (add) {
		ret = iwl_add_bssid_station(priv, vif->bss_conf.bssid, false,
		ret = iwl_add_bssid_station(
				priv, &priv->contexts[IWL_RXON_CTX_BSS],
				vif->bss_conf.bssid, false,
				&vif_priv->ibss_bssid_sta_id);
				&vif_priv->ibss_bssid_sta_id);
		if (ret)
		if (ret)
			return ret;
			return ret;
@@ -2366,7 +2373,7 @@ int iwl3945_init_hw_rate_table(struct iwl_priv *priv)
		 * 1M CCK rates */
		 * 1M CCK rates */


		if (!(priv->_3945.sta_supp_rates & IWL_OFDM_RATES_MASK) &&
		if (!(priv->_3945.sta_supp_rates & IWL_OFDM_RATES_MASK) &&
		    iwl_is_associated(priv)) {
		    iwl_is_associated(priv, IWL_RXON_CTX_BSS)) {


			index = IWL_FIRST_CCK_RATE;
			index = IWL_FIRST_CCK_RATE;
			for (i = IWL_RATE_6M_INDEX_TABLE;
			for (i = IWL_RATE_6M_INDEX_TABLE;
@@ -2421,7 +2428,9 @@ int iwl3945_hw_set_hw_params(struct iwl_priv *priv)
	priv->hw_params.max_rxq_size = RX_QUEUE_SIZE;
	priv->hw_params.max_rxq_size = RX_QUEUE_SIZE;
	priv->hw_params.max_rxq_log = RX_QUEUE_SIZE_LOG;
	priv->hw_params.max_rxq_log = RX_QUEUE_SIZE_LOG;
	priv->hw_params.max_stations = IWL3945_STATION_COUNT;
	priv->hw_params.max_stations = IWL3945_STATION_COUNT;
	priv->hw_params.bcast_sta_id = IWL3945_BROADCAST_ID;
	priv->contexts[IWL_RXON_CTX_BSS].bcast_sta_id = IWL3945_BROADCAST_ID;

	priv->sta_key_max_num = STA_KEY_MAX_NUM;


	priv->hw_params.rx_wrt_ptr_reg = FH39_RSCSR_CHNL0_WPTR;
	priv->hw_params.rx_wrt_ptr_reg = FH39_RSCSR_CHNL0_WPTR;
	priv->hw_params.max_beacon_itrvl = IWL39_MAX_UCODE_BEACON_INTERVAL;
	priv->hw_params.max_beacon_itrvl = IWL39_MAX_UCODE_BEACON_INTERVAL;
@@ -2439,7 +2448,8 @@ unsigned int iwl3945_hw_get_beacon_cmd(struct iwl_priv *priv,
	tx_beacon_cmd = (struct iwl3945_tx_beacon_cmd *)&frame->u;
	tx_beacon_cmd = (struct iwl3945_tx_beacon_cmd *)&frame->u;
	memset(tx_beacon_cmd, 0, sizeof(*tx_beacon_cmd));
	memset(tx_beacon_cmd, 0, sizeof(*tx_beacon_cmd));


	tx_beacon_cmd->tx.sta_id = priv->hw_params.bcast_sta_id;
	tx_beacon_cmd->tx.sta_id =
		priv->contexts[IWL_RXON_CTX_BSS].bcast_sta_id;
	tx_beacon_cmd->tx.stop_time.life_time = TX_CMD_LIFE_TIME_INFINITE;
	tx_beacon_cmd->tx.stop_time.life_time = TX_CMD_LIFE_TIME_INFINITE;


	frame_size = iwl3945_fill_beacon_frame(priv,
	frame_size = iwl3945_fill_beacon_frame(priv,
+30 −27
Original line number Original line Diff line number Diff line
@@ -347,7 +347,7 @@ static void iwl4965_chain_noise_reset(struct iwl_priv *priv)
	struct iwl_chain_noise_data *data = &(priv->chain_noise_data);
	struct iwl_chain_noise_data *data = &(priv->chain_noise_data);


	if ((data->state == IWL_CHAIN_NOISE_ALIVE) &&
	if ((data->state == IWL_CHAIN_NOISE_ALIVE) &&
	     iwl_is_associated(priv)) {
	    iwl_is_any_associated(priv)) {
		struct iwl_calib_diff_gain_cmd cmd;
		struct iwl_calib_diff_gain_cmd cmd;


		/* clear data for chain noise calibration algorithm */
		/* clear data for chain noise calibration algorithm */
@@ -576,7 +576,7 @@ static int iwl4965_alive_notify(struct iwl_priv *priv)
	/* Activate all Tx DMA/FIFO channels */
	/* Activate all Tx DMA/FIFO channels */
	priv->cfg->ops->lib->txq_set_sched(priv, IWL_MASK(0, 6));
	priv->cfg->ops->lib->txq_set_sched(priv, IWL_MASK(0, 6));


	iwl4965_set_wr_ptrs(priv, IWL_CMD_QUEUE_NUM, 0);
	iwl4965_set_wr_ptrs(priv, IWL_DEFAULT_CMD_QUEUE_NUM, 0);


	/* make sure all queue are not stopped */
	/* make sure all queue are not stopped */
	memset(&priv->queue_stopped[0], 0, sizeof(priv->queue_stopped));
	memset(&priv->queue_stopped[0], 0, sizeof(priv->queue_stopped));
@@ -587,6 +587,7 @@ static int iwl4965_alive_notify(struct iwl_priv *priv)
	priv->txq_ctx_active_msk = 0;
	priv->txq_ctx_active_msk = 0;
	/* Map each Tx/cmd queue to its corresponding fifo */
	/* Map each Tx/cmd queue to its corresponding fifo */
	BUILD_BUG_ON(ARRAY_SIZE(default_queue_to_tx_fifo) != 7);
	BUILD_BUG_ON(ARRAY_SIZE(default_queue_to_tx_fifo) != 7);

	for (i = 0; i < ARRAY_SIZE(default_queue_to_tx_fifo); i++) {
	for (i = 0; i < ARRAY_SIZE(default_queue_to_tx_fifo); i++) {
		int ac = default_queue_to_tx_fifo[i];
		int ac = default_queue_to_tx_fifo[i];


@@ -656,7 +657,7 @@ static int iwl4965_hw_set_hw_params(struct iwl_priv *priv)
			sizeof(struct iwl4965_scd_bc_tbl);
			sizeof(struct iwl4965_scd_bc_tbl);
	priv->hw_params.tfd_size = sizeof(struct iwl_tfd);
	priv->hw_params.tfd_size = sizeof(struct iwl_tfd);
	priv->hw_params.max_stations = IWL4965_STATION_COUNT;
	priv->hw_params.max_stations = IWL4965_STATION_COUNT;
	priv->hw_params.bcast_sta_id = IWL4965_BROADCAST_ID;
	priv->contexts[IWL_RXON_CTX_BSS].bcast_sta_id = IWL4965_BROADCAST_ID;
	priv->hw_params.max_data_size = IWL49_RTC_DATA_SIZE;
	priv->hw_params.max_data_size = IWL49_RTC_DATA_SIZE;
	priv->hw_params.max_inst_size = IWL49_RTC_INST_SIZE;
	priv->hw_params.max_inst_size = IWL49_RTC_INST_SIZE;
	priv->hw_params.max_bsm_size = BSM_SRAM_SIZE;
	priv->hw_params.max_bsm_size = BSM_SRAM_SIZE;
@@ -1374,6 +1375,7 @@ static int iwl4965_send_tx_power(struct iwl_priv *priv)
	u8 band = 0;
	u8 band = 0;
	bool is_ht40 = false;
	bool is_ht40 = false;
	u8 ctrl_chan_high = 0;
	u8 ctrl_chan_high = 0;
	struct iwl_rxon_context *ctx = &priv->contexts[IWL_RXON_CTX_BSS];


	if (test_bit(STATUS_SCANNING, &priv->status)) {
	if (test_bit(STATUS_SCANNING, &priv->status)) {
		/* If this gets hit a lot, switch it to a BUG() and catch
		/* If this gets hit a lot, switch it to a BUG() and catch
@@ -1385,17 +1387,16 @@ static int iwl4965_send_tx_power(struct iwl_priv *priv)


	band = priv->band == IEEE80211_BAND_2GHZ;
	band = priv->band == IEEE80211_BAND_2GHZ;


	is_ht40 =  is_ht40_channel(priv->active_rxon.flags);
	is_ht40 = is_ht40_channel(ctx->active.flags);


	if (is_ht40 &&
	if (is_ht40 && (ctx->active.flags & RXON_FLG_CTRL_CHANNEL_LOC_HI_MSK))
	    (priv->active_rxon.flags & RXON_FLG_CTRL_CHANNEL_LOC_HI_MSK))
		ctrl_chan_high = 1;
		ctrl_chan_high = 1;


	cmd.band = band;
	cmd.band = band;
	cmd.channel = priv->active_rxon.channel;
	cmd.channel = ctx->active.channel;


	ret = iwl4965_fill_txpower_tbl(priv, band,
	ret = iwl4965_fill_txpower_tbl(priv, band,
				le16_to_cpu(priv->active_rxon.channel),
				le16_to_cpu(ctx->active.channel),
				is_ht40, ctrl_chan_high, &cmd.tx_power);
				is_ht40, ctrl_chan_high, &cmd.tx_power);
	if (ret)
	if (ret)
		goto out;
		goto out;
@@ -1406,12 +1407,13 @@ out:
	return ret;
	return ret;
}
}


static int iwl4965_send_rxon_assoc(struct iwl_priv *priv)
static int iwl4965_send_rxon_assoc(struct iwl_priv *priv,
				   struct iwl_rxon_context *ctx)
{
{
	int ret = 0;
	int ret = 0;
	struct iwl4965_rxon_assoc_cmd rxon_assoc;
	struct iwl4965_rxon_assoc_cmd rxon_assoc;
	const struct iwl_rxon_cmd *rxon1 = &priv->staging_rxon;
	const struct iwl_rxon_cmd *rxon1 = &ctx->staging;
	const struct iwl_rxon_cmd *rxon2 = &priv->active_rxon;
	const struct iwl_rxon_cmd *rxon2 = &ctx->active;


	if ((rxon1->flags == rxon2->flags) &&
	if ((rxon1->flags == rxon2->flags) &&
	    (rxon1->filter_flags == rxon2->filter_flags) &&
	    (rxon1->filter_flags == rxon2->filter_flags) &&
@@ -1426,16 +1428,16 @@ static int iwl4965_send_rxon_assoc(struct iwl_priv *priv)
		return 0;
		return 0;
	}
	}


	rxon_assoc.flags = priv->staging_rxon.flags;
	rxon_assoc.flags = ctx->staging.flags;
	rxon_assoc.filter_flags = priv->staging_rxon.filter_flags;
	rxon_assoc.filter_flags = ctx->staging.filter_flags;
	rxon_assoc.ofdm_basic_rates = priv->staging_rxon.ofdm_basic_rates;
	rxon_assoc.ofdm_basic_rates = ctx->staging.ofdm_basic_rates;
	rxon_assoc.cck_basic_rates = priv->staging_rxon.cck_basic_rates;
	rxon_assoc.cck_basic_rates = ctx->staging.cck_basic_rates;
	rxon_assoc.reserved = 0;
	rxon_assoc.reserved = 0;
	rxon_assoc.ofdm_ht_single_stream_basic_rates =
	rxon_assoc.ofdm_ht_single_stream_basic_rates =
	    priv->staging_rxon.ofdm_ht_single_stream_basic_rates;
	    ctx->staging.ofdm_ht_single_stream_basic_rates;
	rxon_assoc.ofdm_ht_dual_stream_basic_rates =
	rxon_assoc.ofdm_ht_dual_stream_basic_rates =
	    priv->staging_rxon.ofdm_ht_dual_stream_basic_rates;
	    ctx->staging.ofdm_ht_dual_stream_basic_rates;
	rxon_assoc.rx_chain_select_flags = priv->staging_rxon.rx_chain;
	rxon_assoc.rx_chain_select_flags = ctx->staging.rx_chain;


	ret = iwl_send_cmd_pdu_async(priv, REPLY_RXON_ASSOC,
	ret = iwl_send_cmd_pdu_async(priv, REPLY_RXON_ASSOC,
				     sizeof(rxon_assoc), &rxon_assoc, NULL);
				     sizeof(rxon_assoc), &rxon_assoc, NULL);
@@ -1448,6 +1450,7 @@ static int iwl4965_send_rxon_assoc(struct iwl_priv *priv)
static int iwl4965_hw_channel_switch(struct iwl_priv *priv,
static int iwl4965_hw_channel_switch(struct iwl_priv *priv,
				     struct ieee80211_channel_switch *ch_switch)
				     struct ieee80211_channel_switch *ch_switch)
{
{
	struct iwl_rxon_context *ctx = &priv->contexts[IWL_RXON_CTX_BSS];
	int rc;
	int rc;
	u8 band = 0;
	u8 band = 0;
	bool is_ht40 = false;
	bool is_ht40 = false;
@@ -1458,22 +1461,22 @@ static int iwl4965_hw_channel_switch(struct iwl_priv *priv,
	u16 ch;
	u16 ch;
	u32 tsf_low;
	u32 tsf_low;
	u8 switch_count;
	u8 switch_count;
	u16 beacon_interval = le16_to_cpu(priv->rxon_timing.beacon_interval);
	u16 beacon_interval = le16_to_cpu(ctx->timing.beacon_interval);
	struct ieee80211_vif *vif = priv->vif;
	struct ieee80211_vif *vif = ctx->vif;
	band = priv->band == IEEE80211_BAND_2GHZ;
	band = priv->band == IEEE80211_BAND_2GHZ;


	is_ht40 = is_ht40_channel(priv->staging_rxon.flags);
	is_ht40 = is_ht40_channel(ctx->staging.flags);


	if (is_ht40 &&
	if (is_ht40 &&
	    (priv->staging_rxon.flags & RXON_FLG_CTRL_CHANNEL_LOC_HI_MSK))
	    (ctx->staging.flags & RXON_FLG_CTRL_CHANNEL_LOC_HI_MSK))
		ctrl_chan_high = 1;
		ctrl_chan_high = 1;


	cmd.band = band;
	cmd.band = band;
	cmd.expect_beacon = 0;
	cmd.expect_beacon = 0;
	ch = ch_switch->channel->hw_value;
	ch = ch_switch->channel->hw_value;
	cmd.channel = cpu_to_le16(ch);
	cmd.channel = cpu_to_le16(ch);
	cmd.rxon_flags = priv->staging_rxon.flags;
	cmd.rxon_flags = ctx->staging.flags;
	cmd.rxon_filter_flags = priv->staging_rxon.filter_flags;
	cmd.rxon_filter_flags = ctx->staging.filter_flags;
	switch_count = ch_switch->count;
	switch_count = ch_switch->count;
	tsf_low = ch_switch->timestamp & 0x0ffffffff;
	tsf_low = ch_switch->timestamp & 0x0ffffffff;
	/*
	/*
@@ -1508,7 +1511,7 @@ static int iwl4965_hw_channel_switch(struct iwl_priv *priv,
		cmd.expect_beacon = is_channel_radar(ch_info);
		cmd.expect_beacon = is_channel_radar(ch_info);
	else {
	else {
		IWL_ERR(priv, "invalid channel switch from %u to %u\n",
		IWL_ERR(priv, "invalid channel switch from %u to %u\n",
			priv->active_rxon.channel, ch);
			ctx->active.channel, ch);
		return -EFAULT;
		return -EFAULT;
	}
	}


@@ -2007,7 +2010,7 @@ static u8 iwl_find_station(struct iwl_priv *priv, const u8 *addr)
		start = IWL_STA_ID;
		start = IWL_STA_ID;


	if (is_broadcast_ether_addr(addr))
	if (is_broadcast_ether_addr(addr))
		return priv->hw_params.bcast_sta_id;
		return priv->contexts[IWL_RXON_CTX_BSS].bcast_sta_id;


	spin_lock_irqsave(&priv->sta_lock, flags);
	spin_lock_irqsave(&priv->sta_lock, flags);
	for (i = start; i < priv->hw_params.max_stations; i++)
	for (i = start; i < priv->hw_params.max_stations; i++)
@@ -2280,7 +2283,7 @@ static struct iwl_lib_ops iwl4965_lib = {
		.set_ct_kill = iwl4965_set_ct_threshold,
		.set_ct_kill = iwl4965_set_ct_threshold,
	},
	},
	.manage_ibss_station = iwlagn_manage_ibss_station,
	.manage_ibss_station = iwlagn_manage_ibss_station,
	.update_bcast_station = iwl_update_bcast_station,
	.update_bcast_stations = iwl_update_bcast_stations,
	.debugfs_ops = {
	.debugfs_ops = {
		.rx_stats_read = iwl_ucode_rx_stats_read,
		.rx_stats_read = iwl_ucode_rx_stats_read,
		.tx_stats_read = iwl_ucode_tx_stats_read,
		.tx_stats_read = iwl_ucode_tx_stats_read,
Loading