iwlagn: remove iwlagn_hcmd_utils structure and call directly
Not needed since the driver split. Move single use routines to calling location and keep static where possible. Signed-off-by: Don Fry <donald.h.fry@intel.com> Signed-off-by: Wey-Yi Guy <wey-yi.w.guy@intel.com> Signed-off-by: John W. Linville <linville@tuxdriver.com>
This commit is contained in:
committed by
John W. Linville
parent
4e30811977
commit
5c3d29fc0d
@@ -188,7 +188,6 @@ static struct iwl_lib_ops iwl1000_lib = {
|
|||||||
|
|
||||||
static const struct iwl_ops iwl1000_ops = {
|
static const struct iwl_ops iwl1000_ops = {
|
||||||
.lib = &iwl1000_lib,
|
.lib = &iwl1000_lib,
|
||||||
.utils = &iwlagn_hcmd_utils,
|
|
||||||
};
|
};
|
||||||
|
|
||||||
static struct iwl_base_params iwl1000_base_params = {
|
static struct iwl_base_params iwl1000_base_params = {
|
||||||
|
@@ -210,22 +210,18 @@ static struct iwl_lib_ops iwl2030_lib = {
|
|||||||
|
|
||||||
static const struct iwl_ops iwl2000_ops = {
|
static const struct iwl_ops iwl2000_ops = {
|
||||||
.lib = &iwl2000_lib,
|
.lib = &iwl2000_lib,
|
||||||
.utils = &iwlagn_hcmd_utils,
|
|
||||||
};
|
};
|
||||||
|
|
||||||
static const struct iwl_ops iwl2030_ops = {
|
static const struct iwl_ops iwl2030_ops = {
|
||||||
.lib = &iwl2030_lib,
|
.lib = &iwl2030_lib,
|
||||||
.utils = &iwlagn_hcmd_utils,
|
|
||||||
};
|
};
|
||||||
|
|
||||||
static const struct iwl_ops iwl105_ops = {
|
static const struct iwl_ops iwl105_ops = {
|
||||||
.lib = &iwl2000_lib,
|
.lib = &iwl2000_lib,
|
||||||
.utils = &iwlagn_hcmd_utils,
|
|
||||||
};
|
};
|
||||||
|
|
||||||
static const struct iwl_ops iwl135_ops = {
|
static const struct iwl_ops iwl135_ops = {
|
||||||
.lib = &iwl2030_lib,
|
.lib = &iwl2030_lib,
|
||||||
.utils = &iwlagn_hcmd_utils,
|
|
||||||
};
|
};
|
||||||
|
|
||||||
static struct iwl_base_params iwl2000_base_params = {
|
static struct iwl_base_params iwl2000_base_params = {
|
||||||
|
@@ -362,12 +362,10 @@ static struct iwl_lib_ops iwl5150_lib = {
|
|||||||
|
|
||||||
static const struct iwl_ops iwl5000_ops = {
|
static const struct iwl_ops iwl5000_ops = {
|
||||||
.lib = &iwl5000_lib,
|
.lib = &iwl5000_lib,
|
||||||
.utils = &iwlagn_hcmd_utils,
|
|
||||||
};
|
};
|
||||||
|
|
||||||
static const struct iwl_ops iwl5150_ops = {
|
static const struct iwl_ops iwl5150_ops = {
|
||||||
.lib = &iwl5150_lib,
|
.lib = &iwl5150_lib,
|
||||||
.utils = &iwlagn_hcmd_utils,
|
|
||||||
};
|
};
|
||||||
|
|
||||||
static struct iwl_base_params iwl5000_base_params = {
|
static struct iwl_base_params iwl5000_base_params = {
|
||||||
|
@@ -313,24 +313,20 @@ static struct iwl_nic_ops iwl6150_nic_ops = {
|
|||||||
|
|
||||||
static const struct iwl_ops iwl6000_ops = {
|
static const struct iwl_ops iwl6000_ops = {
|
||||||
.lib = &iwl6000_lib,
|
.lib = &iwl6000_lib,
|
||||||
.utils = &iwlagn_hcmd_utils,
|
|
||||||
};
|
};
|
||||||
|
|
||||||
static const struct iwl_ops iwl6050_ops = {
|
static const struct iwl_ops iwl6050_ops = {
|
||||||
.lib = &iwl6000_lib,
|
.lib = &iwl6000_lib,
|
||||||
.utils = &iwlagn_hcmd_utils,
|
|
||||||
.nic = &iwl6050_nic_ops,
|
.nic = &iwl6050_nic_ops,
|
||||||
};
|
};
|
||||||
|
|
||||||
static const struct iwl_ops iwl6150_ops = {
|
static const struct iwl_ops iwl6150_ops = {
|
||||||
.lib = &iwl6000_lib,
|
.lib = &iwl6000_lib,
|
||||||
.utils = &iwlagn_hcmd_utils,
|
|
||||||
.nic = &iwl6150_nic_ops,
|
.nic = &iwl6150_nic_ops,
|
||||||
};
|
};
|
||||||
|
|
||||||
static const struct iwl_ops iwl6030_ops = {
|
static const struct iwl_ops iwl6030_ops = {
|
||||||
.lib = &iwl6030_lib,
|
.lib = &iwl6030_lib,
|
||||||
.utils = &iwlagn_hcmd_utils,
|
|
||||||
};
|
};
|
||||||
|
|
||||||
static struct iwl_base_params iwl6000_base_params = {
|
static struct iwl_base_params iwl6000_base_params = {
|
||||||
|
@@ -67,6 +67,7 @@
|
|||||||
#include "iwl-core.h"
|
#include "iwl-core.h"
|
||||||
#include "iwl-agn-calib.h"
|
#include "iwl-agn-calib.h"
|
||||||
#include "iwl-trans.h"
|
#include "iwl-trans.h"
|
||||||
|
#include "iwl-agn.h"
|
||||||
|
|
||||||
/*****************************************************************************
|
/*****************************************************************************
|
||||||
* INIT calibrations framework
|
* INIT calibrations framework
|
||||||
@@ -993,8 +994,7 @@ void iwl_chain_noise_calibration(struct iwl_priv *priv)
|
|||||||
IWL_DEBUG_CALIB(priv, "min_average_noise = %d, antenna %d\n",
|
IWL_DEBUG_CALIB(priv, "min_average_noise = %d, antenna %d\n",
|
||||||
min_average_noise, min_average_noise_antenna_i);
|
min_average_noise, min_average_noise_antenna_i);
|
||||||
|
|
||||||
if (priv->cfg->ops->utils->gain_computation)
|
iwlagn_gain_computation(priv, average_noise,
|
||||||
priv->cfg->ops->utils->gain_computation(priv, average_noise,
|
|
||||||
min_average_noise_antenna_i, min_average_noise,
|
min_average_noise_antenna_i, min_average_noise,
|
||||||
find_first_chain(priv->cfg->valid_rx_ant));
|
find_first_chain(priv->cfg->valid_rx_ant));
|
||||||
|
|
||||||
|
@@ -71,13 +71,6 @@ void iwl_sensitivity_calibration(struct iwl_priv *priv);
|
|||||||
|
|
||||||
void iwl_init_sensitivity(struct iwl_priv *priv);
|
void iwl_init_sensitivity(struct iwl_priv *priv);
|
||||||
void iwl_reset_run_time_calib(struct iwl_priv *priv);
|
void iwl_reset_run_time_calib(struct iwl_priv *priv);
|
||||||
static inline void iwl_chain_noise_reset(struct iwl_priv *priv)
|
|
||||||
{
|
|
||||||
|
|
||||||
if (!priv->disable_chain_noise_cal &&
|
|
||||||
priv->cfg->ops->utils->chain_noise_reset)
|
|
||||||
priv->cfg->ops->utils->chain_noise_reset(priv);
|
|
||||||
}
|
|
||||||
|
|
||||||
int iwl_send_calib_results(struct iwl_priv *priv);
|
int iwl_send_calib_results(struct iwl_priv *priv);
|
||||||
int iwl_calib_set(struct iwl_calib_result *res, const u8 *buf, int len);
|
int iwl_calib_set(struct iwl_calib_result *res, const u8 *buf, int len);
|
||||||
|
@@ -57,17 +57,7 @@ int iwlagn_send_tx_ant_config(struct iwl_priv *priv, u8 valid_tx_ant)
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
static u16 iwlagn_build_addsta_hcmd(const struct iwl_addsta_cmd *cmd, u8 *data)
|
void iwlagn_gain_computation(struct iwl_priv *priv,
|
||||||
{
|
|
||||||
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],
|
u32 average_noise[NUM_RX_CHAINS],
|
||||||
u16 min_average_noise_antenna_i,
|
u16 min_average_noise_antenna_i,
|
||||||
u32 min_average_noise,
|
u32 min_average_noise,
|
||||||
@@ -126,89 +116,6 @@ static void iwlagn_gain_computation(struct iwl_priv *priv,
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
static void iwlagn_chain_noise_reset(struct iwl_priv *priv)
|
|
||||||
{
|
|
||||||
struct iwl_chain_noise_data *data = &priv->chain_noise_data;
|
|
||||||
int ret;
|
|
||||||
|
|
||||||
if ((data->state == IWL_CHAIN_NOISE_ALIVE) &&
|
|
||||||
iwl_is_any_associated(priv)) {
|
|
||||||
struct iwl_calib_chain_noise_reset_cmd cmd;
|
|
||||||
|
|
||||||
/* 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));
|
|
||||||
iwl_set_calib_hdr(&cmd.hdr,
|
|
||||||
priv->_agn.phy_calib_chain_noise_reset_cmd);
|
|
||||||
ret = trans_send_cmd_pdu(priv,
|
|
||||||
REPLY_PHY_CALIBRATION_CMD,
|
|
||||||
CMD_SYNC, 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");
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
static void iwlagn_tx_cmd_protection(struct iwl_priv *priv,
|
|
||||||
struct ieee80211_tx_info *info,
|
|
||||||
__le16 fc, __le32 *tx_flags)
|
|
||||||
{
|
|
||||||
if (info->control.rates[0].flags & IEEE80211_TX_RC_USE_RTS_CTS ||
|
|
||||||
info->control.rates[0].flags & IEEE80211_TX_RC_USE_CTS_PROTECT ||
|
|
||||||
info->flags & IEEE80211_TX_CTL_AMPDU)
|
|
||||||
*tx_flags |= TX_CMD_FLG_PROT_REQUIRE_MSK;
|
|
||||||
}
|
|
||||||
|
|
||||||
/* 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
|
|
||||||
*/
|
|
||||||
struct iwlagn_non_cfg_phy *ncphy =
|
|
||||||
(struct iwlagn_non_cfg_phy *)rx_resp->non_cfg_phy_buf;
|
|
||||||
u32 val, rssi_a, rssi_b, rssi_c, max_rssi;
|
|
||||||
u8 agc;
|
|
||||||
|
|
||||||
val = le32_to_cpu(ncphy->non_cfg_phy[IWLAGN_RX_RES_AGC_IDX]);
|
|
||||||
agc = (val & IWLAGN_OFDM_AGC_MSK) >> IWLAGN_OFDM_AGC_BIT_POS;
|
|
||||||
|
|
||||||
/* 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.
|
|
||||||
*/
|
|
||||||
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;
|
|
||||||
|
|
||||||
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. */
|
|
||||||
return max_rssi - agc - IWLAGN_RSSI_OFFSET;
|
|
||||||
}
|
|
||||||
|
|
||||||
int iwlagn_set_pan_params(struct iwl_priv *priv)
|
int iwlagn_set_pan_params(struct iwl_priv *priv)
|
||||||
{
|
{
|
||||||
struct iwl_wipan_params_cmd cmd;
|
struct iwl_wipan_params_cmd cmd;
|
||||||
@@ -301,12 +208,3 @@ int iwlagn_set_pan_params(struct iwl_priv *priv)
|
|||||||
|
|
||||||
return ret;
|
return ret;
|
||||||
}
|
}
|
||||||
|
|
||||||
struct iwl_hcmd_utils_ops iwlagn_hcmd_utils = {
|
|
||||||
.build_addsta_hcmd = iwlagn_build_addsta_hcmd,
|
|
||||||
.gain_computation = iwlagn_gain_computation,
|
|
||||||
.chain_noise_reset = iwlagn_chain_noise_reset,
|
|
||||||
.tx_cmd_protection = iwlagn_tx_cmd_protection,
|
|
||||||
.calc_rssi = iwlagn_calc_rssi,
|
|
||||||
.request_scan = iwlagn_request_scan,
|
|
||||||
};
|
|
||||||
|
@@ -674,6 +674,38 @@ static void iwlagn_check_needed_chains(struct iwl_priv *priv,
|
|||||||
ht_conf->single_chain_sufficient = !need_multiple;
|
ht_conf->single_chain_sufficient = !need_multiple;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
static void iwlagn_chain_noise_reset(struct iwl_priv *priv)
|
||||||
|
{
|
||||||
|
struct iwl_chain_noise_data *data = &priv->chain_noise_data;
|
||||||
|
int ret;
|
||||||
|
|
||||||
|
if ((data->state == IWL_CHAIN_NOISE_ALIVE) &&
|
||||||
|
iwl_is_any_associated(priv)) {
|
||||||
|
struct iwl_calib_chain_noise_reset_cmd cmd;
|
||||||
|
|
||||||
|
/* 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));
|
||||||
|
iwl_set_calib_hdr(&cmd.hdr,
|
||||||
|
priv->_agn.phy_calib_chain_noise_reset_cmd);
|
||||||
|
ret = trans_send_cmd_pdu(priv,
|
||||||
|
REPLY_PHY_CALIBRATION_CMD,
|
||||||
|
CMD_SYNC, 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");
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
void iwlagn_bss_info_changed(struct ieee80211_hw *hw,
|
void iwlagn_bss_info_changed(struct ieee80211_hw *hw,
|
||||||
struct ieee80211_vif *vif,
|
struct ieee80211_vif *vif,
|
||||||
struct ieee80211_bss_conf *bss_conf,
|
struct ieee80211_bss_conf *bss_conf,
|
||||||
@@ -782,7 +814,8 @@ void iwlagn_bss_info_changed(struct ieee80211_hw *hw,
|
|||||||
iwl_power_update_mode(priv, false);
|
iwl_power_update_mode(priv, false);
|
||||||
|
|
||||||
/* Enable RX differential gain and sensitivity calibrations */
|
/* Enable RX differential gain and sensitivity calibrations */
|
||||||
iwl_chain_noise_reset(priv);
|
if (!priv->disable_chain_noise_cal)
|
||||||
|
iwlagn_chain_noise_reset(priv);
|
||||||
priv->start_calib = 1;
|
priv->start_calib = 1;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@@ -339,6 +339,16 @@ void iwlagn_txq_set_sched(struct iwl_priv *priv, u32 mask)
|
|||||||
iwl_write_prph(priv, IWLAGN_SCD_TXFACT, mask);
|
iwl_write_prph(priv, IWLAGN_SCD_TXFACT, mask);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
static void iwlagn_tx_cmd_protection(struct iwl_priv *priv,
|
||||||
|
struct ieee80211_tx_info *info,
|
||||||
|
__le16 fc, __le32 *tx_flags)
|
||||||
|
{
|
||||||
|
if (info->control.rates[0].flags & IEEE80211_TX_RC_USE_RTS_CTS ||
|
||||||
|
info->control.rates[0].flags & IEEE80211_TX_RC_USE_CTS_PROTECT ||
|
||||||
|
info->flags & IEEE80211_TX_CTL_AMPDU)
|
||||||
|
*tx_flags |= TX_CMD_FLG_PROT_REQUIRE_MSK;
|
||||||
|
}
|
||||||
|
|
||||||
/*
|
/*
|
||||||
* handle build REPLY_TX command notification.
|
* handle build REPLY_TX command notification.
|
||||||
*/
|
*/
|
||||||
@@ -388,7 +398,7 @@ static void iwlagn_tx_cmd_build_basic(struct iwl_priv *priv,
|
|||||||
tx_flags |= TX_CMD_FLG_SEQ_CTL_MSK;
|
tx_flags |= TX_CMD_FLG_SEQ_CTL_MSK;
|
||||||
}
|
}
|
||||||
|
|
||||||
priv->cfg->ops->utils->tx_cmd_protection(priv, info, fc, &tx_flags);
|
iwlagn_tx_cmd_protection(priv, info, fc, &tx_flags);
|
||||||
|
|
||||||
tx_flags &= ~(TX_CMD_FLG_ANT_SEL_MSK);
|
tx_flags &= ~(TX_CMD_FLG_ANT_SEL_MSK);
|
||||||
if (ieee80211_is_mgmt(fc)) {
|
if (ieee80211_is_mgmt(fc)) {
|
||||||
|
@@ -109,9 +109,6 @@ extern struct iwl_cfg iwl135_bg_cfg;
|
|||||||
extern struct iwl_cfg iwl135_bgn_cfg;
|
extern struct iwl_cfg iwl135_bgn_cfg;
|
||||||
|
|
||||||
extern struct iwl_mod_params iwlagn_mod_params;
|
extern struct iwl_mod_params iwlagn_mod_params;
|
||||||
extern struct iwl_hcmd_ops iwlagn_hcmd;
|
|
||||||
extern struct iwl_hcmd_ops iwlagn_bt_hcmd;
|
|
||||||
extern struct iwl_hcmd_utils_ops iwlagn_hcmd_utils;
|
|
||||||
|
|
||||||
extern struct ieee80211_ops iwlagn_hw_ops;
|
extern struct ieee80211_ops iwlagn_hw_ops;
|
||||||
|
|
||||||
@@ -253,6 +250,12 @@ int iwlagn_manage_ibss_station(struct iwl_priv *priv,
|
|||||||
int iwlagn_send_tx_ant_config(struct iwl_priv *priv, u8 valid_tx_ant);
|
int iwlagn_send_tx_ant_config(struct iwl_priv *priv, u8 valid_tx_ant);
|
||||||
int iwlagn_send_beacon_cmd(struct iwl_priv *priv);
|
int iwlagn_send_beacon_cmd(struct iwl_priv *priv);
|
||||||
int iwlagn_set_pan_params(struct iwl_priv *priv);
|
int iwlagn_set_pan_params(struct iwl_priv *priv);
|
||||||
|
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);
|
||||||
|
|
||||||
|
|
||||||
/* bt coex */
|
/* bt coex */
|
||||||
void iwlagn_send_advance_bt_config(struct iwl_priv *priv);
|
void iwlagn_send_advance_bt_config(struct iwl_priv *priv);
|
||||||
|
@@ -80,22 +80,6 @@ struct iwl_cmd;
|
|||||||
|
|
||||||
#define IWL_CMD(x) case x: return #x
|
#define IWL_CMD(x) case x: return #x
|
||||||
|
|
||||||
struct iwl_hcmd_utils_ops {
|
|
||||||
u16 (*build_addsta_hcmd)(const struct iwl_addsta_cmd *cmd, u8 *data);
|
|
||||||
void (*gain_computation)(struct iwl_priv *priv,
|
|
||||||
u32 *average_noise,
|
|
||||||
u16 min_average_noise_antennat_i,
|
|
||||||
u32 min_average_noise,
|
|
||||||
u8 default_chain);
|
|
||||||
void (*chain_noise_reset)(struct iwl_priv *priv);
|
|
||||||
void (*tx_cmd_protection)(struct iwl_priv *priv,
|
|
||||||
struct ieee80211_tx_info *info,
|
|
||||||
__le16 fc, __le32 *tx_flags);
|
|
||||||
int (*calc_rssi)(struct iwl_priv *priv,
|
|
||||||
struct iwl_rx_phy_res *rx_resp);
|
|
||||||
int (*request_scan)(struct iwl_priv *priv, struct ieee80211_vif *vif);
|
|
||||||
};
|
|
||||||
|
|
||||||
struct iwl_lib_ops {
|
struct iwl_lib_ops {
|
||||||
/* set hw dependent parameters */
|
/* set hw dependent parameters */
|
||||||
int (*set_hw_params)(struct iwl_priv *priv);
|
int (*set_hw_params)(struct iwl_priv *priv);
|
||||||
@@ -126,7 +110,6 @@ struct iwl_nic_ops {
|
|||||||
|
|
||||||
struct iwl_ops {
|
struct iwl_ops {
|
||||||
const struct iwl_lib_ops *lib;
|
const struct iwl_lib_ops *lib;
|
||||||
const struct iwl_hcmd_utils_ops *utils;
|
|
||||||
const struct iwl_nic_ops *nic;
|
const struct iwl_nic_ops *nic;
|
||||||
};
|
};
|
||||||
|
|
||||||
|
@@ -902,6 +902,47 @@ static u32 iwl_translate_rx_status(struct iwl_priv *priv, u32 decrypt_in)
|
|||||||
return decrypt_out;
|
return decrypt_out;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/* 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
|
||||||
|
*/
|
||||||
|
struct iwlagn_non_cfg_phy *ncphy =
|
||||||
|
(struct iwlagn_non_cfg_phy *)rx_resp->non_cfg_phy_buf;
|
||||||
|
u32 val, rssi_a, rssi_b, rssi_c, max_rssi;
|
||||||
|
u8 agc;
|
||||||
|
|
||||||
|
val = le32_to_cpu(ncphy->non_cfg_phy[IWLAGN_RX_RES_AGC_IDX]);
|
||||||
|
agc = (val & IWLAGN_OFDM_AGC_MSK) >> IWLAGN_OFDM_AGC_BIT_POS;
|
||||||
|
|
||||||
|
/* 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.
|
||||||
|
*/
|
||||||
|
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;
|
||||||
|
|
||||||
|
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. */
|
||||||
|
return max_rssi - agc - IWLAGN_RSSI_OFFSET;
|
||||||
|
}
|
||||||
|
|
||||||
/* Called for REPLY_RX (legacy ABG frames), or
|
/* Called for REPLY_RX (legacy ABG frames), or
|
||||||
* REPLY_RX_MPDU_CMD (HT high-throughput N frames). */
|
* REPLY_RX_MPDU_CMD (HT high-throughput N frames). */
|
||||||
static void iwl_rx_reply_rx(struct iwl_priv *priv,
|
static void iwl_rx_reply_rx(struct iwl_priv *priv,
|
||||||
@@ -983,7 +1024,7 @@ static void iwl_rx_reply_rx(struct iwl_priv *priv,
|
|||||||
priv->ucode_beacon_time = le32_to_cpu(phy_res->beacon_time_stamp);
|
priv->ucode_beacon_time = le32_to_cpu(phy_res->beacon_time_stamp);
|
||||||
|
|
||||||
/* Find max signal strength (dBm) among 3 antenna/receiver chains */
|
/* Find max signal strength (dBm) among 3 antenna/receiver chains */
|
||||||
rx_status.signal = priv->cfg->ops->utils->calc_rssi(priv, phy_res);
|
rx_status.signal = iwlagn_calc_rssi(priv, phy_res);
|
||||||
|
|
||||||
iwl_dbg_log_rx_data_frame(priv, len, header);
|
iwl_dbg_log_rx_data_frame(priv, len, header);
|
||||||
IWL_DEBUG_STATS_LIMIT(priv, "Rssi %d, TSF %llu\n",
|
IWL_DEBUG_STATS_LIMIT(priv, "Rssi %d, TSF %llu\n",
|
||||||
|
@@ -350,9 +350,6 @@ int __must_check iwl_scan_initiate(struct iwl_priv *priv,
|
|||||||
|
|
||||||
lockdep_assert_held(&priv->mutex);
|
lockdep_assert_held(&priv->mutex);
|
||||||
|
|
||||||
if (WARN_ON(!priv->cfg->ops->utils->request_scan))
|
|
||||||
return -EOPNOTSUPP;
|
|
||||||
|
|
||||||
cancel_delayed_work(&priv->scan_check);
|
cancel_delayed_work(&priv->scan_check);
|
||||||
|
|
||||||
if (!iwl_is_ready_rf(priv)) {
|
if (!iwl_is_ready_rf(priv)) {
|
||||||
@@ -381,7 +378,7 @@ int __must_check iwl_scan_initiate(struct iwl_priv *priv,
|
|||||||
priv->scan_start = jiffies;
|
priv->scan_start = jiffies;
|
||||||
priv->scan_band = band;
|
priv->scan_band = band;
|
||||||
|
|
||||||
ret = priv->cfg->ops->utils->request_scan(priv, vif);
|
ret = iwlagn_request_scan(priv, vif);
|
||||||
if (ret) {
|
if (ret) {
|
||||||
clear_bit(STATUS_SCANNING, &priv->status);
|
clear_bit(STATUS_SCANNING, &priv->status);
|
||||||
priv->scan_type = IWL_SCAN_NORMAL;
|
priv->scan_type = IWL_SCAN_NORMAL;
|
||||||
|
@@ -36,6 +36,7 @@
|
|||||||
#include "iwl-core.h"
|
#include "iwl-core.h"
|
||||||
#include "iwl-sta.h"
|
#include "iwl-sta.h"
|
||||||
#include "iwl-trans.h"
|
#include "iwl-trans.h"
|
||||||
|
#include "iwl-agn.h"
|
||||||
|
|
||||||
/* priv->sta_lock must be held */
|
/* priv->sta_lock must be held */
|
||||||
static void iwl_sta_ucode_activate(struct iwl_priv *priv, u8 sta_id)
|
static void iwl_sta_ucode_activate(struct iwl_priv *priv, u8 sta_id)
|
||||||
@@ -133,6 +134,16 @@ static void iwl_add_sta_callback(struct iwl_priv *priv,
|
|||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
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;
|
||||||
|
}
|
||||||
|
|
||||||
int iwl_send_add_sta(struct iwl_priv *priv,
|
int iwl_send_add_sta(struct iwl_priv *priv,
|
||||||
struct iwl_addsta_cmd *sta, u8 flags)
|
struct iwl_addsta_cmd *sta, u8 flags)
|
||||||
{
|
{
|
||||||
@@ -156,7 +167,7 @@ int iwl_send_add_sta(struct iwl_priv *priv,
|
|||||||
might_sleep();
|
might_sleep();
|
||||||
}
|
}
|
||||||
|
|
||||||
cmd.len[0] = priv->cfg->ops->utils->build_addsta_hcmd(sta, data);
|
cmd.len[0] = iwlagn_build_addsta_hcmd(sta, data);
|
||||||
ret = trans_send_cmd(priv, &cmd);
|
ret = trans_send_cmd(priv, &cmd);
|
||||||
|
|
||||||
if (ret || (flags & CMD_ASYNC))
|
if (ret || (flags & CMD_ASYNC))
|
||||||
|
Reference in New Issue
Block a user