2010-03-16 17:23:31 +00:00
|
|
|
/******************************************************************************
|
|
|
|
*
|
|
|
|
* GPL LICENSE SUMMARY
|
|
|
|
*
|
2011-04-05 16:42:00 +00:00
|
|
|
* Copyright(c) 2008 - 2011 Intel Corporation. All rights reserved.
|
2010-03-16 17:23:31 +00:00
|
|
|
*
|
|
|
|
* This program is free software; you can redistribute it and/or modify
|
|
|
|
* it under the terms of version 2 of the GNU General Public License as
|
|
|
|
* published by the Free Software Foundation.
|
|
|
|
*
|
|
|
|
* This program is distributed in the hope that it will be useful, but
|
|
|
|
* WITHOUT ANY WARRANTY; without even the implied warranty of
|
|
|
|
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
|
|
|
|
* General Public License for more details.
|
|
|
|
*
|
|
|
|
* You should have received a copy of the GNU General Public License
|
|
|
|
* along with this program; if not, write to the Free Software
|
|
|
|
* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110,
|
|
|
|
* USA
|
|
|
|
*
|
|
|
|
* The full GNU General Public License is included in this distribution
|
|
|
|
* in the file called LICENSE.GPL.
|
|
|
|
*
|
|
|
|
* Contact Information:
|
|
|
|
* Intel Linux Wireless <ilw@linux.intel.com>
|
|
|
|
* Intel Corporation, 5200 N.E. Elam Young Parkway, Hillsboro, OR 97124-6497
|
|
|
|
*
|
|
|
|
*****************************************************************************/
|
|
|
|
|
|
|
|
#include <linux/kernel.h>
|
|
|
|
#include <linux/module.h>
|
|
|
|
#include <linux/init.h>
|
|
|
|
#include <linux/sched.h>
|
|
|
|
|
|
|
|
#include "iwl-dev.h"
|
|
|
|
#include "iwl-core.h"
|
|
|
|
#include "iwl-io.h"
|
2010-03-16 19:37:28 +00:00
|
|
|
#include "iwl-agn.h"
|
2010-03-16 17:23:31 +00:00
|
|
|
|
2010-08-23 08:46:32 +00:00
|
|
|
int iwlagn_send_rxon_assoc(struct iwl_priv *priv,
|
|
|
|
struct iwl_rxon_context *ctx)
|
2010-03-16 17:23:31 +00:00
|
|
|
{
|
|
|
|
int ret = 0;
|
|
|
|
struct iwl5000_rxon_assoc_cmd rxon_assoc;
|
2010-08-23 08:46:32 +00:00
|
|
|
const struct iwl_rxon_cmd *rxon1 = &ctx->staging;
|
|
|
|
const struct iwl_rxon_cmd *rxon2 = &ctx->active;
|
2010-03-16 17:23:31 +00:00
|
|
|
|
|
|
|
if ((rxon1->flags == rxon2->flags) &&
|
|
|
|
(rxon1->filter_flags == rxon2->filter_flags) &&
|
|
|
|
(rxon1->cck_basic_rates == rxon2->cck_basic_rates) &&
|
|
|
|
(rxon1->ofdm_ht_single_stream_basic_rates ==
|
|
|
|
rxon2->ofdm_ht_single_stream_basic_rates) &&
|
|
|
|
(rxon1->ofdm_ht_dual_stream_basic_rates ==
|
|
|
|
rxon2->ofdm_ht_dual_stream_basic_rates) &&
|
|
|
|
(rxon1->ofdm_ht_triple_stream_basic_rates ==
|
|
|
|
rxon2->ofdm_ht_triple_stream_basic_rates) &&
|
|
|
|
(rxon1->acquisition_data == rxon2->acquisition_data) &&
|
|
|
|
(rxon1->rx_chain == rxon2->rx_chain) &&
|
|
|
|
(rxon1->ofdm_basic_rates == rxon2->ofdm_basic_rates)) {
|
|
|
|
IWL_DEBUG_INFO(priv, "Using current RXON_ASSOC. Not resending.\n");
|
|
|
|
return 0;
|
|
|
|
}
|
|
|
|
|
2010-08-23 08:46:32 +00:00
|
|
|
rxon_assoc.flags = ctx->staging.flags;
|
|
|
|
rxon_assoc.filter_flags = ctx->staging.filter_flags;
|
|
|
|
rxon_assoc.ofdm_basic_rates = ctx->staging.ofdm_basic_rates;
|
|
|
|
rxon_assoc.cck_basic_rates = ctx->staging.cck_basic_rates;
|
2010-03-16 17:23:31 +00:00
|
|
|
rxon_assoc.reserved1 = 0;
|
|
|
|
rxon_assoc.reserved2 = 0;
|
|
|
|
rxon_assoc.reserved3 = 0;
|
|
|
|
rxon_assoc.ofdm_ht_single_stream_basic_rates =
|
2010-08-23 08:46:32 +00:00
|
|
|
ctx->staging.ofdm_ht_single_stream_basic_rates;
|
2010-03-16 17:23:31 +00:00
|
|
|
rxon_assoc.ofdm_ht_dual_stream_basic_rates =
|
2010-08-23 08:46:32 +00:00
|
|
|
ctx->staging.ofdm_ht_dual_stream_basic_rates;
|
|
|
|
rxon_assoc.rx_chain_select_flags = ctx->staging.rx_chain;
|
2010-03-16 17:23:31 +00:00
|
|
|
rxon_assoc.ofdm_ht_triple_stream_basic_rates =
|
2010-08-23 08:46:32 +00:00
|
|
|
ctx->staging.ofdm_ht_triple_stream_basic_rates;
|
|
|
|
rxon_assoc.acquisition_data = ctx->staging.acquisition_data;
|
2010-03-16 17:23:31 +00:00
|
|
|
|
2010-08-23 08:46:37 +00:00
|
|
|
ret = iwl_send_cmd_pdu_async(priv, ctx->rxon_assoc_cmd,
|
2010-03-16 17:23:31 +00:00
|
|
|
sizeof(rxon_assoc), &rxon_assoc, NULL);
|
|
|
|
if (ret)
|
|
|
|
return ret;
|
|
|
|
|
|
|
|
return ret;
|
|
|
|
}
|
|
|
|
|
2010-05-06 17:15:21 +00:00
|
|
|
int iwlagn_send_tx_ant_config(struct iwl_priv *priv, u8 valid_tx_ant)
|
2010-03-16 17:23:31 +00:00
|
|
|
{
|
|
|
|
struct iwl_tx_ant_config_cmd tx_ant_cmd = {
|
|
|
|
.valid = cpu_to_le32(valid_tx_ant),
|
|
|
|
};
|
|
|
|
|
|
|
|
if (IWL_UCODE_API(priv->ucode_ver) > 1) {
|
|
|
|
IWL_DEBUG_HC(priv, "select valid tx ant: %u\n", valid_tx_ant);
|
|
|
|
return iwl_send_cmd_pdu(priv, TX_ANT_CONFIGURATION_CMD,
|
|
|
|
sizeof(struct iwl_tx_ant_config_cmd),
|
|
|
|
&tx_ant_cmd);
|
|
|
|
} else {
|
|
|
|
IWL_DEBUG_HC(priv, "TX_ANT_CONFIGURATION_CMD not supported\n");
|
|
|
|
return -EOPNOTSUPP;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
/* Currently this is the superset of everything */
|
|
|
|
static u16 iwlagn_get_hcmd_size(u8 cmd_id, u16 len)
|
|
|
|
{
|
|
|
|
return len;
|
|
|
|
}
|
|
|
|
|
|
|
|
static u16 iwlagn_build_addsta_hcmd(const struct iwl_addsta_cmd *cmd, u8 *data)
|
|
|
|
{
|
|
|
|
u16 size = (u16)sizeof(struct iwl_addsta_cmd);
|
|
|
|
struct iwl_addsta_cmd *addsta = (struct iwl_addsta_cmd *)data;
|
|
|
|
memcpy(addsta, cmd, size);
|
|
|
|
/* resrved in 5000 */
|
|
|
|
addsta->rate_n_flags = cpu_to_le16(0);
|
|
|
|
return size;
|
|
|
|
}
|
|
|
|
|
|
|
|
static void iwlagn_gain_computation(struct iwl_priv *priv,
|
|
|
|
u32 average_noise[NUM_RX_CHAINS],
|
|
|
|
u16 min_average_noise_antenna_i,
|
|
|
|
u32 min_average_noise,
|
|
|
|
u8 default_chain)
|
|
|
|
{
|
|
|
|
int i;
|
|
|
|
s32 delta_g;
|
|
|
|
struct iwl_chain_noise_data *data = &priv->chain_noise_data;
|
|
|
|
|
|
|
|
/*
|
|
|
|
* Find Gain Code for the chains based on "default chain"
|
|
|
|
*/
|
|
|
|
for (i = default_chain + 1; i < NUM_RX_CHAINS; i++) {
|
|
|
|
if ((data->disconn_array[i])) {
|
|
|
|
data->delta_gain_code[i] = 0;
|
|
|
|
continue;
|
|
|
|
}
|
|
|
|
|
2010-10-06 15:10:00 +00:00
|
|
|
delta_g = (priv->cfg->base_params->chain_noise_scale *
|
2010-03-16 17:23:31 +00:00
|
|
|
((s32)average_noise[default_chain] -
|
|
|
|
(s32)average_noise[i])) / 1500;
|
|
|
|
|
|
|
|
/* bound gain by 2 bits value max, 3rd bit is sign */
|
|
|
|
data->delta_gain_code[i] =
|
|
|
|
min(abs(delta_g), (long) CHAIN_NOISE_MAX_DELTA_GAIN_CODE);
|
|
|
|
|
|
|
|
if (delta_g < 0)
|
|
|
|
/*
|
|
|
|
* set negative sign ...
|
|
|
|
* note to Intel developers: This is uCode API format,
|
|
|
|
* not the format of any internal device registers.
|
|
|
|
* Do not change this format for e.g. 6050 or similar
|
|
|
|
* devices. Change format only if more resolution
|
|
|
|
* (i.e. more than 2 bits magnitude) is needed.
|
|
|
|
*/
|
|
|
|
data->delta_gain_code[i] |= (1 << 2);
|
|
|
|
}
|
|
|
|
|
|
|
|
IWL_DEBUG_CALIB(priv, "Delta gains: ANT_B = %d ANT_C = %d\n",
|
|
|
|
data->delta_gain_code[1], data->delta_gain_code[2]);
|
|
|
|
|
|
|
|
if (!data->radio_write) {
|
|
|
|
struct iwl_calib_chain_noise_gain_cmd cmd;
|
|
|
|
|
|
|
|
memset(&cmd, 0, sizeof(cmd));
|
|
|
|
|
2010-07-14 00:13:15 +00:00
|
|
|
cmd.hdr.op_code = priv->_agn.phy_calib_chain_noise_gain_cmd;
|
2010-03-16 17:23:31 +00:00
|
|
|
cmd.hdr.first_group = 0;
|
|
|
|
cmd.hdr.groups_num = 1;
|
|
|
|
cmd.hdr.data_valid = 1;
|
|
|
|
cmd.delta_gain_1 = data->delta_gain_code[1];
|
|
|
|
cmd.delta_gain_2 = data->delta_gain_code[2];
|
|
|
|
iwl_send_cmd_pdu_async(priv, REPLY_PHY_CALIBRATION_CMD,
|
|
|
|
sizeof(cmd), &cmd, NULL);
|
|
|
|
|
|
|
|
data->radio_write = 1;
|
|
|
|
data->state = IWL_CHAIN_NOISE_CALIBRATED;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
static void iwlagn_chain_noise_reset(struct iwl_priv *priv)
|
|
|
|
{
|
|
|
|
struct iwl_chain_noise_data *data = &priv->chain_noise_data;
|
|
|
|
int ret;
|
|
|
|
|
2010-05-11 22:25:03 +00:00
|
|
|
if ((data->state == IWL_CHAIN_NOISE_ALIVE) &&
|
2010-08-23 08:46:32 +00:00
|
|
|
iwl_is_any_associated(priv)) {
|
2010-03-16 17:23:31 +00:00
|
|
|
struct iwl_calib_chain_noise_reset_cmd cmd;
|
|
|
|
|
2010-05-11 22:25:03 +00:00
|
|
|
/* clear data for chain noise calibration algorithm */
|
|
|
|
data->chain_noise_a = 0;
|
|
|
|
data->chain_noise_b = 0;
|
|
|
|
data->chain_noise_c = 0;
|
|
|
|
data->chain_signal_a = 0;
|
|
|
|
data->chain_signal_b = 0;
|
|
|
|
data->chain_signal_c = 0;
|
|
|
|
data->beacon_count = 0;
|
|
|
|
|
|
|
|
memset(&cmd, 0, sizeof(cmd));
|
2010-07-14 00:13:15 +00:00
|
|
|
cmd.hdr.op_code = priv->_agn.phy_calib_chain_noise_reset_cmd;
|
2010-03-16 17:23:31 +00:00
|
|
|
cmd.hdr.first_group = 0;
|
|
|
|
cmd.hdr.groups_num = 1;
|
|
|
|
cmd.hdr.data_valid = 1;
|
|
|
|
ret = iwl_send_cmd_pdu(priv, REPLY_PHY_CALIBRATION_CMD,
|
|
|
|
sizeof(cmd), &cmd);
|
|
|
|
if (ret)
|
|
|
|
IWL_ERR(priv,
|
|
|
|
"Could not send REPLY_PHY_CALIBRATION_CMD\n");
|
|
|
|
data->state = IWL_CHAIN_NOISE_ACCUMULATE;
|
|
|
|
IWL_DEBUG_CALIB(priv, "Run chain_noise_calibrate\n");
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
iwlagn: fix rts cts protection
Currently the driver will try to protect all frames,
which leads to a lot of odd things like sending an
RTS with a zeroed RA before multicast frames, which
is clearly bogus.
In order to fix all of this, we need to take a step
back and see what we need to achieve:
* we need RTS/CTS protection if requested by
the AP for the BSS, mac80211 tells us this
* in that case, CTS-to-self should only be
enabled when mac80211 tells us
* additionally, as a hardware workaround, on
some devices we have to protect aggregated
frames with RTS
To achieve the first two items, set up the RXON
accordingly and set the protection required flag
in the transmit command when mac80211 requests
protection for the frame.
To achieve the last item, set the rate-control
RTS-requested flag for all stations that we have
aggregation sessions with, and set the protection
required flag when sending aggregated frames (on
those devices where this is required).
Since otherwise bugs can occur, do not allow the
user to override the RTS-for-aggregation setting
from sysfs any more.
Finally, also clean up the way all these flags get
set in the driver and move everything into the
device-specific functions.
Cc: stable@kernel.org [2.6.35]
Signed-off-by: Johannes Berg <johannes.berg@intel.com>
Signed-off-by: Wey-Yi Guy <wey-yi.w.guy@intel.com>
Signed-off-by: John W. Linville <linville@tuxdriver.com>
2010-08-09 17:57:02 +00:00
|
|
|
static void iwlagn_tx_cmd_protection(struct iwl_priv *priv,
|
|
|
|
struct ieee80211_tx_info *info,
|
|
|
|
__le16 fc, __le32 *tx_flags)
|
2010-03-16 17:23:31 +00:00
|
|
|
{
|
iwlagn: fix rts cts protection
Currently the driver will try to protect all frames,
which leads to a lot of odd things like sending an
RTS with a zeroed RA before multicast frames, which
is clearly bogus.
In order to fix all of this, we need to take a step
back and see what we need to achieve:
* we need RTS/CTS protection if requested by
the AP for the BSS, mac80211 tells us this
* in that case, CTS-to-self should only be
enabled when mac80211 tells us
* additionally, as a hardware workaround, on
some devices we have to protect aggregated
frames with RTS
To achieve the first two items, set up the RXON
accordingly and set the protection required flag
in the transmit command when mac80211 requests
protection for the frame.
To achieve the last item, set the rate-control
RTS-requested flag for all stations that we have
aggregation sessions with, and set the protection
required flag when sending aggregated frames (on
those devices where this is required).
Since otherwise bugs can occur, do not allow the
user to override the RTS-for-aggregation setting
from sysfs any more.
Finally, also clean up the way all these flags get
set in the driver and move everything into the
device-specific functions.
Cc: stable@kernel.org [2.6.35]
Signed-off-by: Johannes Berg <johannes.berg@intel.com>
Signed-off-by: Wey-Yi Guy <wey-yi.w.guy@intel.com>
Signed-off-by: John W. Linville <linville@tuxdriver.com>
2010-08-09 17:57:02 +00:00
|
|
|
if (info->control.rates[0].flags & IEEE80211_TX_RC_USE_RTS_CTS ||
|
|
|
|
info->control.rates[0].flags & IEEE80211_TX_RC_USE_CTS_PROTECT) {
|
|
|
|
*tx_flags |= TX_CMD_FLG_PROT_REQUIRE_MSK;
|
|
|
|
return;
|
|
|
|
}
|
|
|
|
|
2010-10-06 15:10:00 +00:00
|
|
|
if (priv->cfg->ht_params &&
|
|
|
|
priv->cfg->ht_params->use_rts_for_aggregation &&
|
iwlagn: fix rts cts protection
Currently the driver will try to protect all frames,
which leads to a lot of odd things like sending an
RTS with a zeroed RA before multicast frames, which
is clearly bogus.
In order to fix all of this, we need to take a step
back and see what we need to achieve:
* we need RTS/CTS protection if requested by
the AP for the BSS, mac80211 tells us this
* in that case, CTS-to-self should only be
enabled when mac80211 tells us
* additionally, as a hardware workaround, on
some devices we have to protect aggregated
frames with RTS
To achieve the first two items, set up the RXON
accordingly and set the protection required flag
in the transmit command when mac80211 requests
protection for the frame.
To achieve the last item, set the rate-control
RTS-requested flag for all stations that we have
aggregation sessions with, and set the protection
required flag when sending aggregated frames (on
those devices where this is required).
Since otherwise bugs can occur, do not allow the
user to override the RTS-for-aggregation setting
from sysfs any more.
Finally, also clean up the way all these flags get
set in the driver and move everything into the
device-specific functions.
Cc: stable@kernel.org [2.6.35]
Signed-off-by: Johannes Berg <johannes.berg@intel.com>
Signed-off-by: Wey-Yi Guy <wey-yi.w.guy@intel.com>
Signed-off-by: John W. Linville <linville@tuxdriver.com>
2010-08-09 17:57:02 +00:00
|
|
|
info->flags & IEEE80211_TX_CTL_AMPDU) {
|
|
|
|
*tx_flags |= TX_CMD_FLG_PROT_REQUIRE_MSK;
|
|
|
|
return;
|
|
|
|
}
|
2010-03-16 17:23:31 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
/* Calc max signal level (dBm) among 3 possible receivers */
|
|
|
|
static int iwlagn_calc_rssi(struct iwl_priv *priv,
|
|
|
|
struct iwl_rx_phy_res *rx_resp)
|
|
|
|
{
|
|
|
|
/* data from PHY/DSP regarding signal strength, etc.,
|
|
|
|
* contents are always there, not configurable by host
|
|
|
|
*/
|
2010-08-04 15:42:17 +00:00
|
|
|
struct iwlagn_non_cfg_phy *ncphy =
|
|
|
|
(struct iwlagn_non_cfg_phy *)rx_resp->non_cfg_phy_buf;
|
2010-03-16 17:23:31 +00:00
|
|
|
u32 val, rssi_a, rssi_b, rssi_c, max_rssi;
|
|
|
|
u8 agc;
|
|
|
|
|
2010-08-04 15:42:17 +00:00
|
|
|
val = le32_to_cpu(ncphy->non_cfg_phy[IWLAGN_RX_RES_AGC_IDX]);
|
|
|
|
agc = (val & IWLAGN_OFDM_AGC_MSK) >> IWLAGN_OFDM_AGC_BIT_POS;
|
2010-03-16 17:23:31 +00:00
|
|
|
|
|
|
|
/* Find max rssi among 3 possible receivers.
|
|
|
|
* These values are measured by the digital signal processor (DSP).
|
|
|
|
* They should stay fairly constant even as the signal strength varies,
|
|
|
|
* if the radio's automatic gain control (AGC) is working right.
|
|
|
|
* AGC value (see below) will provide the "interesting" info.
|
|
|
|
*/
|
2010-08-04 15:42:17 +00:00
|
|
|
val = le32_to_cpu(ncphy->non_cfg_phy[IWLAGN_RX_RES_RSSI_AB_IDX]);
|
|
|
|
rssi_a = (val & IWLAGN_OFDM_RSSI_INBAND_A_BITMSK) >>
|
|
|
|
IWLAGN_OFDM_RSSI_A_BIT_POS;
|
|
|
|
rssi_b = (val & IWLAGN_OFDM_RSSI_INBAND_B_BITMSK) >>
|
|
|
|
IWLAGN_OFDM_RSSI_B_BIT_POS;
|
|
|
|
val = le32_to_cpu(ncphy->non_cfg_phy[IWLAGN_RX_RES_RSSI_C_IDX]);
|
|
|
|
rssi_c = (val & IWLAGN_OFDM_RSSI_INBAND_C_BITMSK) >>
|
|
|
|
IWLAGN_OFDM_RSSI_C_BIT_POS;
|
2010-03-16 17:23:31 +00:00
|
|
|
|
|
|
|
max_rssi = max_t(u32, rssi_a, rssi_b);
|
|
|
|
max_rssi = max_t(u32, max_rssi, rssi_c);
|
|
|
|
|
|
|
|
IWL_DEBUG_STATS(priv, "Rssi In A %d B %d C %d Max %d AGC dB %d\n",
|
|
|
|
rssi_a, rssi_b, rssi_c, max_rssi, agc);
|
|
|
|
|
|
|
|
/* dBm = max_rssi dB - agc dB - constant.
|
|
|
|
* Higher AGC (higher radio gain) means lower signal. */
|
2010-03-23 18:37:59 +00:00
|
|
|
return max_rssi - agc - IWLAGN_RSSI_OFFSET;
|
2010-03-16 17:23:31 +00:00
|
|
|
}
|
|
|
|
|
2010-08-27 16:44:50 +00:00
|
|
|
static int iwlagn_set_pan_params(struct iwl_priv *priv)
|
|
|
|
{
|
|
|
|
struct iwl_wipan_params_cmd cmd;
|
|
|
|
struct iwl_rxon_context *ctx_bss, *ctx_pan;
|
|
|
|
int slot0 = 300, slot1 = 0;
|
|
|
|
int ret;
|
|
|
|
|
|
|
|
if (priv->valid_contexts == BIT(IWL_RXON_CTX_BSS))
|
|
|
|
return 0;
|
|
|
|
|
|
|
|
BUILD_BUG_ON(NUM_IWL_RXON_CTX != 2);
|
|
|
|
|
|
|
|
lockdep_assert_held(&priv->mutex);
|
|
|
|
|
|
|
|
ctx_bss = &priv->contexts[IWL_RXON_CTX_BSS];
|
|
|
|
ctx_pan = &priv->contexts[IWL_RXON_CTX_PAN];
|
|
|
|
|
2010-09-03 13:32:21 +00:00
|
|
|
/*
|
|
|
|
* If the PAN context is inactive, then we don't need
|
|
|
|
* to update the PAN parameters, the last thing we'll
|
|
|
|
* have done before it goes inactive is making the PAN
|
|
|
|
* parameters be WLAN-only.
|
|
|
|
*/
|
|
|
|
if (!ctx_pan->is_active)
|
|
|
|
return 0;
|
|
|
|
|
2010-08-27 16:44:50 +00:00
|
|
|
memset(&cmd, 0, sizeof(cmd));
|
|
|
|
|
|
|
|
/* only 2 slots are currently allowed */
|
|
|
|
cmd.num_slots = 2;
|
|
|
|
|
|
|
|
cmd.slots[0].type = 0; /* BSS */
|
|
|
|
cmd.slots[1].type = 1; /* PAN */
|
|
|
|
|
2011-01-06 16:07:10 +00:00
|
|
|
if (priv->_agn.hw_roc_channel) {
|
|
|
|
/* both contexts must be used for this to happen */
|
|
|
|
slot1 = priv->_agn.hw_roc_duration;
|
2011-01-06 16:07:11 +00:00
|
|
|
slot0 = IWL_MIN_SLOT_TIME;
|
2011-01-06 16:07:10 +00:00
|
|
|
} else if (ctx_bss->vif && ctx_pan->vif) {
|
2010-08-27 16:44:50 +00:00
|
|
|
int bcnint = ctx_pan->vif->bss_conf.beacon_int;
|
2010-11-11 02:25:49 +00:00
|
|
|
int dtim = ctx_pan->vif->bss_conf.dtim_period ?: 1;
|
2010-08-27 16:44:50 +00:00
|
|
|
|
|
|
|
/* should be set, but seems unused?? */
|
|
|
|
cmd.flags |= cpu_to_le16(IWL_WIPAN_PARAMS_FLG_SLOTTED_MODE);
|
|
|
|
|
|
|
|
if (ctx_pan->vif->type == NL80211_IFTYPE_AP &&
|
|
|
|
bcnint &&
|
|
|
|
bcnint != ctx_bss->vif->bss_conf.beacon_int) {
|
|
|
|
IWL_ERR(priv,
|
|
|
|
"beacon intervals don't match (%d, %d)\n",
|
|
|
|
ctx_bss->vif->bss_conf.beacon_int,
|
|
|
|
ctx_pan->vif->bss_conf.beacon_int);
|
|
|
|
} else
|
|
|
|
bcnint = max_t(int, bcnint,
|
|
|
|
ctx_bss->vif->bss_conf.beacon_int);
|
|
|
|
if (!bcnint)
|
2010-09-03 13:30:55 +00:00
|
|
|
bcnint = DEFAULT_BEACON_INTERVAL;
|
2010-08-27 16:44:50 +00:00
|
|
|
slot0 = bcnint / 2;
|
|
|
|
slot1 = bcnint - slot0;
|
|
|
|
|
|
|
|
if (test_bit(STATUS_SCAN_HW, &priv->status) ||
|
|
|
|
(!ctx_bss->vif->bss_conf.idle &&
|
|
|
|
!ctx_bss->vif->bss_conf.assoc)) {
|
2011-01-06 16:07:11 +00:00
|
|
|
slot0 = dtim * bcnint * 3 - IWL_MIN_SLOT_TIME;
|
|
|
|
slot1 = IWL_MIN_SLOT_TIME;
|
2010-08-27 16:44:50 +00:00
|
|
|
} else if (!ctx_pan->vif->bss_conf.idle &&
|
2010-11-11 02:25:49 +00:00
|
|
|
!ctx_pan->vif->bss_conf.assoc) {
|
2011-01-06 16:07:11 +00:00
|
|
|
slot1 = bcnint * 3 - IWL_MIN_SLOT_TIME;
|
|
|
|
slot0 = IWL_MIN_SLOT_TIME;
|
2010-08-27 16:44:50 +00:00
|
|
|
}
|
|
|
|
} else if (ctx_pan->vif) {
|
|
|
|
slot0 = 0;
|
|
|
|
slot1 = max_t(int, 1, ctx_pan->vif->bss_conf.dtim_period) *
|
|
|
|
ctx_pan->vif->bss_conf.beacon_int;
|
2010-09-03 13:30:55 +00:00
|
|
|
slot1 = max_t(int, DEFAULT_BEACON_INTERVAL, slot1);
|
2010-08-30 13:12:00 +00:00
|
|
|
|
|
|
|
if (test_bit(STATUS_SCAN_HW, &priv->status)) {
|
2011-01-06 16:07:11 +00:00
|
|
|
slot0 = slot1 * 3 - IWL_MIN_SLOT_TIME;
|
|
|
|
slot1 = IWL_MIN_SLOT_TIME;
|
2010-08-30 13:12:00 +00:00
|
|
|
}
|
2010-08-27 16:44:50 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
cmd.slots[0].width = cpu_to_le16(slot0);
|
|
|
|
cmd.slots[1].width = cpu_to_le16(slot1);
|
|
|
|
|
|
|
|
ret = iwl_send_cmd_pdu(priv, REPLY_WIPAN_PARAMS, sizeof(cmd), &cmd);
|
|
|
|
if (ret)
|
|
|
|
IWL_ERR(priv, "Error setting PAN parameters (%d)\n", ret);
|
|
|
|
|
|
|
|
return ret;
|
|
|
|
}
|
|
|
|
|
2010-03-16 17:23:31 +00:00
|
|
|
struct iwl_hcmd_ops iwlagn_hcmd = {
|
|
|
|
.rxon_assoc = iwlagn_send_rxon_assoc,
|
2010-09-22 16:01:55 +00:00
|
|
|
.commit_rxon = iwlagn_commit_rxon,
|
2010-09-22 16:01:58 +00:00
|
|
|
.set_rxon_chain = iwlagn_set_rxon_chain,
|
2010-03-16 17:23:31 +00:00
|
|
|
.set_tx_ant = iwlagn_send_tx_ant_config,
|
2010-04-13 08:04:31 +00:00
|
|
|
.send_bt_config = iwl_send_bt_config,
|
2010-08-27 16:44:50 +00:00
|
|
|
.set_pan_params = iwlagn_set_pan_params,
|
2010-03-16 17:23:31 +00:00
|
|
|
};
|
|
|
|
|
2010-08-23 14:57:14 +00:00
|
|
|
struct iwl_hcmd_ops iwlagn_bt_hcmd = {
|
|
|
|
.rxon_assoc = iwlagn_send_rxon_assoc,
|
2010-09-22 16:01:55 +00:00
|
|
|
.commit_rxon = iwlagn_commit_rxon,
|
2010-09-22 16:01:58 +00:00
|
|
|
.set_rxon_chain = iwlagn_set_rxon_chain,
|
2010-08-23 14:57:14 +00:00
|
|
|
.set_tx_ant = iwlagn_send_tx_ant_config,
|
|
|
|
.send_bt_config = iwlagn_send_advance_bt_config,
|
2010-08-27 16:44:50 +00:00
|
|
|
.set_pan_params = iwlagn_set_pan_params,
|
2010-08-23 14:57:14 +00:00
|
|
|
};
|
|
|
|
|
2010-03-16 17:23:31 +00:00
|
|
|
struct iwl_hcmd_utils_ops iwlagn_hcmd_utils = {
|
|
|
|
.get_hcmd_size = iwlagn_get_hcmd_size,
|
|
|
|
.build_addsta_hcmd = iwlagn_build_addsta_hcmd,
|
|
|
|
.gain_computation = iwlagn_gain_computation,
|
|
|
|
.chain_noise_reset = iwlagn_chain_noise_reset,
|
iwlagn: fix rts cts protection
Currently the driver will try to protect all frames,
which leads to a lot of odd things like sending an
RTS with a zeroed RA before multicast frames, which
is clearly bogus.
In order to fix all of this, we need to take a step
back and see what we need to achieve:
* we need RTS/CTS protection if requested by
the AP for the BSS, mac80211 tells us this
* in that case, CTS-to-self should only be
enabled when mac80211 tells us
* additionally, as a hardware workaround, on
some devices we have to protect aggregated
frames with RTS
To achieve the first two items, set up the RXON
accordingly and set the protection required flag
in the transmit command when mac80211 requests
protection for the frame.
To achieve the last item, set the rate-control
RTS-requested flag for all stations that we have
aggregation sessions with, and set the protection
required flag when sending aggregated frames (on
those devices where this is required).
Since otherwise bugs can occur, do not allow the
user to override the RTS-for-aggregation setting
from sysfs any more.
Finally, also clean up the way all these flags get
set in the driver and move everything into the
device-specific functions.
Cc: stable@kernel.org [2.6.35]
Signed-off-by: Johannes Berg <johannes.berg@intel.com>
Signed-off-by: Wey-Yi Guy <wey-yi.w.guy@intel.com>
Signed-off-by: John W. Linville <linville@tuxdriver.com>
2010-08-09 17:57:02 +00:00
|
|
|
.tx_cmd_protection = iwlagn_tx_cmd_protection,
|
2010-03-16 17:23:31 +00:00
|
|
|
.calc_rssi = iwlagn_calc_rssi,
|
2010-04-06 11:12:42 +00:00
|
|
|
.request_scan = iwlagn_request_scan,
|
2010-09-22 16:01:56 +00:00
|
|
|
.post_scan = iwlagn_post_scan,
|
2010-03-16 17:23:31 +00:00
|
|
|
};
|