iwlagn: Add support for bluetooth statistics notification
WiFi/BT combo devices has different statistics notification structure, adding the support here to make sure the structure align correctly. Signed-off-by: Wey-Yi Guy <wey-yi.w.guy@intel.com>
This commit is contained in:
@@ -605,8 +605,7 @@ void iwl_init_sensitivity(struct iwl_priv *priv)
|
|||||||
IWL_DEBUG_CALIB(priv, "<<return 0x%X\n", ret);
|
IWL_DEBUG_CALIB(priv, "<<return 0x%X\n", ret);
|
||||||
}
|
}
|
||||||
|
|
||||||
void iwl_sensitivity_calibration(struct iwl_priv *priv,
|
void iwl_sensitivity_calibration(struct iwl_priv *priv, void *resp)
|
||||||
struct iwl_notif_statistics *resp)
|
|
||||||
{
|
{
|
||||||
u32 rx_enable_time;
|
u32 rx_enable_time;
|
||||||
u32 fa_cck;
|
u32 fa_cck;
|
||||||
@@ -616,8 +615,8 @@ void iwl_sensitivity_calibration(struct iwl_priv *priv,
|
|||||||
u32 norm_fa_ofdm;
|
u32 norm_fa_ofdm;
|
||||||
u32 norm_fa_cck;
|
u32 norm_fa_cck;
|
||||||
struct iwl_sensitivity_data *data = NULL;
|
struct iwl_sensitivity_data *data = NULL;
|
||||||
struct statistics_rx_non_phy *rx_info = &(resp->rx.general);
|
struct statistics_rx_non_phy *rx_info;
|
||||||
struct statistics_rx *statistics = &(resp->rx);
|
struct statistics_rx_phy *ofdm, *cck;
|
||||||
unsigned long flags;
|
unsigned long flags;
|
||||||
struct statistics_general_data statis;
|
struct statistics_general_data statis;
|
||||||
|
|
||||||
@@ -632,6 +631,16 @@ void iwl_sensitivity_calibration(struct iwl_priv *priv,
|
|||||||
}
|
}
|
||||||
|
|
||||||
spin_lock_irqsave(&priv->lock, flags);
|
spin_lock_irqsave(&priv->lock, flags);
|
||||||
|
if (priv->cfg->bt_statistics) {
|
||||||
|
rx_info = &(((struct iwl_bt_notif_statistics *)resp)->
|
||||||
|
rx.general.common);
|
||||||
|
ofdm = &(((struct iwl_bt_notif_statistics *)resp)->rx.ofdm);
|
||||||
|
cck = &(((struct iwl_bt_notif_statistics *)resp)->rx.cck);
|
||||||
|
} else {
|
||||||
|
rx_info = &(((struct iwl_notif_statistics *)resp)->rx.general);
|
||||||
|
ofdm = &(((struct iwl_notif_statistics *)resp)->rx.ofdm);
|
||||||
|
cck = &(((struct iwl_notif_statistics *)resp)->rx.cck);
|
||||||
|
}
|
||||||
if (rx_info->interference_data_flag != INTERFERENCE_DATA_AVAILABLE) {
|
if (rx_info->interference_data_flag != INTERFERENCE_DATA_AVAILABLE) {
|
||||||
IWL_DEBUG_CALIB(priv, "<< invalid data.\n");
|
IWL_DEBUG_CALIB(priv, "<< invalid data.\n");
|
||||||
spin_unlock_irqrestore(&priv->lock, flags);
|
spin_unlock_irqrestore(&priv->lock, flags);
|
||||||
@@ -640,23 +649,23 @@ void iwl_sensitivity_calibration(struct iwl_priv *priv,
|
|||||||
|
|
||||||
/* Extract Statistics: */
|
/* Extract Statistics: */
|
||||||
rx_enable_time = le32_to_cpu(rx_info->channel_load);
|
rx_enable_time = le32_to_cpu(rx_info->channel_load);
|
||||||
fa_cck = le32_to_cpu(statistics->cck.false_alarm_cnt);
|
fa_cck = le32_to_cpu(cck->false_alarm_cnt);
|
||||||
fa_ofdm = le32_to_cpu(statistics->ofdm.false_alarm_cnt);
|
fa_ofdm = le32_to_cpu(ofdm->false_alarm_cnt);
|
||||||
bad_plcp_cck = le32_to_cpu(statistics->cck.plcp_err);
|
bad_plcp_cck = le32_to_cpu(cck->plcp_err);
|
||||||
bad_plcp_ofdm = le32_to_cpu(statistics->ofdm.plcp_err);
|
bad_plcp_ofdm = le32_to_cpu(ofdm->plcp_err);
|
||||||
|
|
||||||
statis.beacon_silence_rssi_a =
|
statis.beacon_silence_rssi_a =
|
||||||
le32_to_cpu(statistics->general.beacon_silence_rssi_a);
|
le32_to_cpu(rx_info->beacon_silence_rssi_a);
|
||||||
statis.beacon_silence_rssi_b =
|
statis.beacon_silence_rssi_b =
|
||||||
le32_to_cpu(statistics->general.beacon_silence_rssi_b);
|
le32_to_cpu(rx_info->beacon_silence_rssi_b);
|
||||||
statis.beacon_silence_rssi_c =
|
statis.beacon_silence_rssi_c =
|
||||||
le32_to_cpu(statistics->general.beacon_silence_rssi_c);
|
le32_to_cpu(rx_info->beacon_silence_rssi_c);
|
||||||
statis.beacon_energy_a =
|
statis.beacon_energy_a =
|
||||||
le32_to_cpu(statistics->general.beacon_energy_a);
|
le32_to_cpu(rx_info->beacon_energy_a);
|
||||||
statis.beacon_energy_b =
|
statis.beacon_energy_b =
|
||||||
le32_to_cpu(statistics->general.beacon_energy_b);
|
le32_to_cpu(rx_info->beacon_energy_b);
|
||||||
statis.beacon_energy_c =
|
statis.beacon_energy_c =
|
||||||
le32_to_cpu(statistics->general.beacon_energy_c);
|
le32_to_cpu(rx_info->beacon_energy_c);
|
||||||
|
|
||||||
spin_unlock_irqrestore(&priv->lock, flags);
|
spin_unlock_irqrestore(&priv->lock, flags);
|
||||||
|
|
||||||
@@ -728,8 +737,7 @@ static inline u8 find_first_chain(u8 mask)
|
|||||||
* 1) Which antennas are connected.
|
* 1) Which antennas are connected.
|
||||||
* 2) Differential rx gain settings to balance the 3 receivers.
|
* 2) Differential rx gain settings to balance the 3 receivers.
|
||||||
*/
|
*/
|
||||||
void iwl_chain_noise_calibration(struct iwl_priv *priv,
|
void iwl_chain_noise_calibration(struct iwl_priv *priv, void *stat_resp)
|
||||||
struct iwl_notif_statistics *stat_resp)
|
|
||||||
{
|
{
|
||||||
struct iwl_chain_noise_data *data = NULL;
|
struct iwl_chain_noise_data *data = NULL;
|
||||||
|
|
||||||
@@ -753,7 +761,7 @@ void iwl_chain_noise_calibration(struct iwl_priv *priv,
|
|||||||
u32 active_chains = 0;
|
u32 active_chains = 0;
|
||||||
u8 num_tx_chains;
|
u8 num_tx_chains;
|
||||||
unsigned long flags;
|
unsigned long flags;
|
||||||
struct statistics_rx_non_phy *rx_info = &(stat_resp->rx.general);
|
struct statistics_rx_non_phy *rx_info;
|
||||||
u8 first_chain;
|
u8 first_chain;
|
||||||
|
|
||||||
if (priv->disable_chain_noise_cal)
|
if (priv->disable_chain_noise_cal)
|
||||||
@@ -772,6 +780,13 @@ void iwl_chain_noise_calibration(struct iwl_priv *priv,
|
|||||||
}
|
}
|
||||||
|
|
||||||
spin_lock_irqsave(&priv->lock, flags);
|
spin_lock_irqsave(&priv->lock, flags);
|
||||||
|
if (priv->cfg->bt_statistics) {
|
||||||
|
rx_info = &(((struct iwl_bt_notif_statistics *)stat_resp)->
|
||||||
|
rx.general.common);
|
||||||
|
} else {
|
||||||
|
rx_info = &(((struct iwl_notif_statistics *)stat_resp)->
|
||||||
|
rx.general);
|
||||||
|
}
|
||||||
if (rx_info->interference_data_flag != INTERFERENCE_DATA_AVAILABLE) {
|
if (rx_info->interference_data_flag != INTERFERENCE_DATA_AVAILABLE) {
|
||||||
IWL_DEBUG_CALIB(priv, " << Interference data unavailable\n");
|
IWL_DEBUG_CALIB(priv, " << Interference data unavailable\n");
|
||||||
spin_unlock_irqrestore(&priv->lock, flags);
|
spin_unlock_irqrestore(&priv->lock, flags);
|
||||||
@@ -780,8 +795,19 @@ void iwl_chain_noise_calibration(struct iwl_priv *priv,
|
|||||||
|
|
||||||
rxon_band24 = !!(priv->staging_rxon.flags & RXON_FLG_BAND_24G_MSK);
|
rxon_band24 = !!(priv->staging_rxon.flags & RXON_FLG_BAND_24G_MSK);
|
||||||
rxon_chnum = le16_to_cpu(priv->staging_rxon.channel);
|
rxon_chnum = le16_to_cpu(priv->staging_rxon.channel);
|
||||||
stat_band24 = !!(stat_resp->flag & STATISTICS_REPLY_FLG_BAND_24G_MSK);
|
if (priv->cfg->bt_statistics) {
|
||||||
stat_chnum = le32_to_cpu(stat_resp->flag) >> 16;
|
stat_band24 = !!(((struct iwl_bt_notif_statistics *)
|
||||||
|
stat_resp)->flag &
|
||||||
|
STATISTICS_REPLY_FLG_BAND_24G_MSK);
|
||||||
|
stat_chnum = le32_to_cpu(((struct iwl_bt_notif_statistics *)
|
||||||
|
stat_resp)->flag) >> 16;
|
||||||
|
} else {
|
||||||
|
stat_band24 = !!(((struct iwl_notif_statistics *)
|
||||||
|
stat_resp)->flag &
|
||||||
|
STATISTICS_REPLY_FLG_BAND_24G_MSK);
|
||||||
|
stat_chnum = le32_to_cpu(((struct iwl_notif_statistics *)
|
||||||
|
stat_resp)->flag) >> 16;
|
||||||
|
}
|
||||||
|
|
||||||
/* Make sure we accumulate data for just the associated channel
|
/* Make sure we accumulate data for just the associated channel
|
||||||
* (even if scanning). */
|
* (even if scanning). */
|
||||||
|
@@ -31,21 +31,24 @@
|
|||||||
static int iwl_statistics_flag(struct iwl_priv *priv, char *buf, int bufsz)
|
static int iwl_statistics_flag(struct iwl_priv *priv, char *buf, int bufsz)
|
||||||
{
|
{
|
||||||
int p = 0;
|
int p = 0;
|
||||||
|
u32 flag;
|
||||||
|
|
||||||
p += scnprintf(buf + p, bufsz - p, "Statistics Flag(0x%X):\n",
|
if (priv->cfg->bt_statistics)
|
||||||
le32_to_cpu(priv->_agn.statistics.flag));
|
flag = le32_to_cpu(priv->_agn.statistics_bt.flag);
|
||||||
if (le32_to_cpu(priv->_agn.statistics.flag) &
|
else
|
||||||
UCODE_STATISTICS_CLEAR_MSK)
|
flag = le32_to_cpu(priv->_agn.statistics.flag);
|
||||||
|
|
||||||
|
p += scnprintf(buf + p, bufsz - p, "Statistics Flag(0x%X):\n", flag);
|
||||||
|
if (flag & UCODE_STATISTICS_CLEAR_MSK)
|
||||||
p += scnprintf(buf + p, bufsz - p,
|
p += scnprintf(buf + p, bufsz - p,
|
||||||
"\tStatistics have been cleared\n");
|
"\tStatistics have been cleared\n");
|
||||||
p += scnprintf(buf + p, bufsz - p, "\tOperational Frequency: %s\n",
|
p += scnprintf(buf + p, bufsz - p, "\tOperational Frequency: %s\n",
|
||||||
(le32_to_cpu(priv->_agn.statistics.flag) &
|
(flag & UCODE_STATISTICS_FREQUENCY_MSK)
|
||||||
UCODE_STATISTICS_FREQUENCY_MSK)
|
|
||||||
? "2.4 GHz" : "5.2 GHz");
|
? "2.4 GHz" : "5.2 GHz");
|
||||||
p += scnprintf(buf + p, bufsz - p, "\tTGj Narrow Band: %s\n",
|
p += scnprintf(buf + p, bufsz - p, "\tTGj Narrow Band: %s\n",
|
||||||
(le32_to_cpu(priv->_agn.statistics.flag) &
|
(flag & UCODE_STATISTICS_NARROW_BAND_MSK)
|
||||||
UCODE_STATISTICS_NARROW_BAND_MSK)
|
|
||||||
? "enabled" : "disabled");
|
? "enabled" : "disabled");
|
||||||
|
|
||||||
return p;
|
return p;
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -79,6 +82,26 @@ ssize_t iwl_ucode_rx_stats_read(struct file *file, char __user *user_buf,
|
|||||||
* the last statistics notification from uCode
|
* the last statistics notification from uCode
|
||||||
* might not reflect the current uCode activity
|
* might not reflect the current uCode activity
|
||||||
*/
|
*/
|
||||||
|
if (priv->cfg->bt_statistics) {
|
||||||
|
ofdm = &priv->_agn.statistics_bt.rx.ofdm;
|
||||||
|
cck = &priv->_agn.statistics_bt.rx.cck;
|
||||||
|
general = &priv->_agn.statistics_bt.rx.general.common;
|
||||||
|
ht = &priv->_agn.statistics_bt.rx.ofdm_ht;
|
||||||
|
accum_ofdm = &priv->_agn.accum_statistics_bt.rx.ofdm;
|
||||||
|
accum_cck = &priv->_agn.accum_statistics_bt.rx.cck;
|
||||||
|
accum_general =
|
||||||
|
&priv->_agn.accum_statistics_bt.rx.general.common;
|
||||||
|
accum_ht = &priv->_agn.accum_statistics_bt.rx.ofdm_ht;
|
||||||
|
delta_ofdm = &priv->_agn.delta_statistics_bt.rx.ofdm;
|
||||||
|
delta_cck = &priv->_agn.delta_statistics_bt.rx.cck;
|
||||||
|
delta_general =
|
||||||
|
&priv->_agn.delta_statistics_bt.rx.general.common;
|
||||||
|
delta_ht = &priv->_agn.delta_statistics_bt.rx.ofdm_ht;
|
||||||
|
max_ofdm = &priv->_agn.max_delta_bt.rx.ofdm;
|
||||||
|
max_cck = &priv->_agn.max_delta_bt.rx.cck;
|
||||||
|
max_general = &priv->_agn.max_delta_bt.rx.general.common;
|
||||||
|
max_ht = &priv->_agn.max_delta_bt.rx.ofdm_ht;
|
||||||
|
} else {
|
||||||
ofdm = &priv->_agn.statistics.rx.ofdm;
|
ofdm = &priv->_agn.statistics.rx.ofdm;
|
||||||
cck = &priv->_agn.statistics.rx.cck;
|
cck = &priv->_agn.statistics.rx.cck;
|
||||||
general = &priv->_agn.statistics.rx.general;
|
general = &priv->_agn.statistics.rx.general;
|
||||||
@@ -95,6 +118,7 @@ ssize_t iwl_ucode_rx_stats_read(struct file *file, char __user *user_buf,
|
|||||||
max_cck = &priv->_agn.max_delta.rx.cck;
|
max_cck = &priv->_agn.max_delta.rx.cck;
|
||||||
max_general = &priv->_agn.max_delta.rx.general;
|
max_general = &priv->_agn.max_delta.rx.general;
|
||||||
max_ht = &priv->_agn.max_delta.rx.ofdm_ht;
|
max_ht = &priv->_agn.max_delta.rx.ofdm_ht;
|
||||||
|
}
|
||||||
|
|
||||||
pos += iwl_statistics_flag(priv, buf, bufsz);
|
pos += iwl_statistics_flag(priv, buf, bufsz);
|
||||||
pos += scnprintf(buf + pos, bufsz - pos, "%-32s current"
|
pos += scnprintf(buf + pos, bufsz - pos, "%-32s current"
|
||||||
@@ -560,10 +584,18 @@ ssize_t iwl_ucode_tx_stats_read(struct file *file,
|
|||||||
* the last statistics notification from uCode
|
* the last statistics notification from uCode
|
||||||
* might not reflect the current uCode activity
|
* might not reflect the current uCode activity
|
||||||
*/
|
*/
|
||||||
|
if (priv->cfg->bt_statistics) {
|
||||||
|
tx = &priv->_agn.statistics_bt.tx;
|
||||||
|
accum_tx = &priv->_agn.accum_statistics_bt.tx;
|
||||||
|
delta_tx = &priv->_agn.delta_statistics_bt.tx;
|
||||||
|
max_tx = &priv->_agn.max_delta_bt.tx;
|
||||||
|
} else {
|
||||||
tx = &priv->_agn.statistics.tx;
|
tx = &priv->_agn.statistics.tx;
|
||||||
accum_tx = &priv->_agn.accum_statistics.tx;
|
accum_tx = &priv->_agn.accum_statistics.tx;
|
||||||
delta_tx = &priv->_agn.delta_statistics.tx;
|
delta_tx = &priv->_agn.delta_statistics.tx;
|
||||||
max_tx = &priv->_agn.max_delta.tx;
|
max_tx = &priv->_agn.max_delta.tx;
|
||||||
|
}
|
||||||
|
|
||||||
pos += iwl_statistics_flag(priv, buf, bufsz);
|
pos += iwl_statistics_flag(priv, buf, bufsz);
|
||||||
pos += scnprintf(buf + pos, bufsz - pos, "%-32s current"
|
pos += scnprintf(buf + pos, bufsz - pos, "%-32s current"
|
||||||
"acumulative delta max\n",
|
"acumulative delta max\n",
|
||||||
@@ -777,18 +809,34 @@ ssize_t iwl_ucode_general_stats_read(struct file *file, char __user *user_buf,
|
|||||||
* the last statistics notification from uCode
|
* the last statistics notification from uCode
|
||||||
* might not reflect the current uCode activity
|
* might not reflect the current uCode activity
|
||||||
*/
|
*/
|
||||||
|
if (priv->cfg->bt_statistics) {
|
||||||
|
general = &priv->_agn.statistics_bt.general.common;
|
||||||
|
dbg = &priv->_agn.statistics_bt.general.common.dbg;
|
||||||
|
div = &priv->_agn.statistics_bt.general.common.div;
|
||||||
|
accum_general = &priv->_agn.accum_statistics_bt.general.common;
|
||||||
|
accum_dbg = &priv->_agn.accum_statistics_bt.general.common.dbg;
|
||||||
|
accum_div = &priv->_agn.accum_statistics_bt.general.common.div;
|
||||||
|
delta_general = &priv->_agn.delta_statistics_bt.general.common;
|
||||||
|
max_general = &priv->_agn.max_delta_bt.general.common;
|
||||||
|
delta_dbg = &priv->_agn.delta_statistics_bt.general.common.dbg;
|
||||||
|
max_dbg = &priv->_agn.max_delta_bt.general.common.dbg;
|
||||||
|
delta_div = &priv->_agn.delta_statistics_bt.general.common.div;
|
||||||
|
max_div = &priv->_agn.max_delta_bt.general.common.div;
|
||||||
|
} else {
|
||||||
general = &priv->_agn.statistics.general.common;
|
general = &priv->_agn.statistics.general.common;
|
||||||
dbg = &priv->_agn.statistics.general.common.dbg;
|
dbg = &priv->_agn.statistics.general.common.dbg;
|
||||||
div = &priv->_agn.statistics.general.common.div;
|
div = &priv->_agn.statistics.general.common.div;
|
||||||
accum_general = &priv->_agn.accum_statistics.general.common;
|
accum_general = &priv->_agn.accum_statistics.general.common;
|
||||||
|
accum_dbg = &priv->_agn.accum_statistics.general.common.dbg;
|
||||||
|
accum_div = &priv->_agn.accum_statistics.general.common.div;
|
||||||
delta_general = &priv->_agn.delta_statistics.general.common;
|
delta_general = &priv->_agn.delta_statistics.general.common;
|
||||||
max_general = &priv->_agn.max_delta.general.common;
|
max_general = &priv->_agn.max_delta.general.common;
|
||||||
accum_dbg = &priv->_agn.accum_statistics.general.common.dbg;
|
|
||||||
delta_dbg = &priv->_agn.delta_statistics.general.common.dbg;
|
delta_dbg = &priv->_agn.delta_statistics.general.common.dbg;
|
||||||
max_dbg = &priv->_agn.max_delta.general.common.dbg;
|
max_dbg = &priv->_agn.max_delta.general.common.dbg;
|
||||||
accum_div = &priv->_agn.accum_statistics.general.common.div;
|
|
||||||
delta_div = &priv->_agn.delta_statistics.general.common.div;
|
delta_div = &priv->_agn.delta_statistics.general.common.div;
|
||||||
max_div = &priv->_agn.max_delta.general.common.div;
|
max_div = &priv->_agn.max_delta.general.common.div;
|
||||||
|
}
|
||||||
|
|
||||||
pos += iwl_statistics_flag(priv, buf, bufsz);
|
pos += iwl_statistics_flag(priv, buf, bufsz);
|
||||||
pos += scnprintf(buf + pos, bufsz - pos, "%-32s current"
|
pos += scnprintf(buf + pos, bufsz - pos, "%-32s current"
|
||||||
"acumulative delta max\n",
|
"acumulative delta max\n",
|
||||||
|
@@ -67,18 +67,23 @@ void iwl_rx_missed_beacon_notif(struct iwl_priv *priv,
|
|||||||
* exactly when to expect beacons, therefore only when we're associated. */
|
* exactly when to expect beacons, therefore only when we're associated. */
|
||||||
static void iwl_rx_calc_noise(struct iwl_priv *priv)
|
static void iwl_rx_calc_noise(struct iwl_priv *priv)
|
||||||
{
|
{
|
||||||
struct statistics_rx_non_phy *rx_info
|
struct statistics_rx_non_phy *rx_info;
|
||||||
= &(priv->_agn.statistics.rx.general);
|
|
||||||
int num_active_rx = 0;
|
int num_active_rx = 0;
|
||||||
int total_silence = 0;
|
int total_silence = 0;
|
||||||
int bcn_silence_a =
|
int bcn_silence_a, bcn_silence_b, bcn_silence_c;
|
||||||
le32_to_cpu(rx_info->beacon_silence_rssi_a) & IN_BAND_FILTER;
|
|
||||||
int bcn_silence_b =
|
|
||||||
le32_to_cpu(rx_info->beacon_silence_rssi_b) & IN_BAND_FILTER;
|
|
||||||
int bcn_silence_c =
|
|
||||||
le32_to_cpu(rx_info->beacon_silence_rssi_c) & IN_BAND_FILTER;
|
|
||||||
int last_rx_noise;
|
int last_rx_noise;
|
||||||
|
|
||||||
|
if (priv->cfg->bt_statistics)
|
||||||
|
rx_info = &(priv->_agn.statistics_bt.rx.general.common);
|
||||||
|
else
|
||||||
|
rx_info = &(priv->_agn.statistics.rx.general);
|
||||||
|
bcn_silence_a =
|
||||||
|
le32_to_cpu(rx_info->beacon_silence_rssi_a) & IN_BAND_FILTER;
|
||||||
|
bcn_silence_b =
|
||||||
|
le32_to_cpu(rx_info->beacon_silence_rssi_b) & IN_BAND_FILTER;
|
||||||
|
bcn_silence_c =
|
||||||
|
le32_to_cpu(rx_info->beacon_silence_rssi_c) & IN_BAND_FILTER;
|
||||||
|
|
||||||
if (bcn_silence_a) {
|
if (bcn_silence_a) {
|
||||||
total_silence += bcn_silence_a;
|
total_silence += bcn_silence_a;
|
||||||
num_active_rx++;
|
num_active_rx++;
|
||||||
@@ -112,17 +117,35 @@ static void iwl_rx_calc_noise(struct iwl_priv *priv)
|
|||||||
static void iwl_accumulative_statistics(struct iwl_priv *priv,
|
static void iwl_accumulative_statistics(struct iwl_priv *priv,
|
||||||
__le32 *stats)
|
__le32 *stats)
|
||||||
{
|
{
|
||||||
int i;
|
int i, size;
|
||||||
__le32 *prev_stats;
|
__le32 *prev_stats;
|
||||||
u32 *accum_stats;
|
u32 *accum_stats;
|
||||||
u32 *delta, *max_delta;
|
u32 *delta, *max_delta;
|
||||||
|
struct statistics_general_common *general, *accum_general;
|
||||||
|
struct statistics_tx *tx, *accum_tx;
|
||||||
|
|
||||||
|
if (priv->cfg->bt_statistics) {
|
||||||
|
prev_stats = (__le32 *)&priv->_agn.statistics_bt;
|
||||||
|
accum_stats = (u32 *)&priv->_agn.accum_statistics_bt;
|
||||||
|
size = sizeof(struct iwl_bt_notif_statistics);
|
||||||
|
general = &priv->_agn.statistics_bt.general.common;
|
||||||
|
accum_general = &priv->_agn.accum_statistics_bt.general.common;
|
||||||
|
tx = &priv->_agn.statistics_bt.tx;
|
||||||
|
accum_tx = &priv->_agn.accum_statistics_bt.tx;
|
||||||
|
delta = (u32 *)&priv->_agn.delta_statistics_bt;
|
||||||
|
max_delta = (u32 *)&priv->_agn.max_delta_bt;
|
||||||
|
} else {
|
||||||
prev_stats = (__le32 *)&priv->_agn.statistics;
|
prev_stats = (__le32 *)&priv->_agn.statistics;
|
||||||
accum_stats = (u32 *)&priv->_agn.accum_statistics;
|
accum_stats = (u32 *)&priv->_agn.accum_statistics;
|
||||||
|
size = sizeof(struct iwl_notif_statistics);
|
||||||
|
general = &priv->_agn.statistics.general.common;
|
||||||
|
accum_general = &priv->_agn.accum_statistics.general.common;
|
||||||
|
tx = &priv->_agn.statistics.tx;
|
||||||
|
accum_tx = &priv->_agn.accum_statistics.tx;
|
||||||
delta = (u32 *)&priv->_agn.delta_statistics;
|
delta = (u32 *)&priv->_agn.delta_statistics;
|
||||||
max_delta = (u32 *)&priv->_agn.max_delta;
|
max_delta = (u32 *)&priv->_agn.max_delta;
|
||||||
|
}
|
||||||
for (i = sizeof(__le32); i < sizeof(struct iwl_notif_statistics);
|
for (i = sizeof(__le32); i < size;
|
||||||
i += sizeof(__le32), stats++, prev_stats++, delta++,
|
i += sizeof(__le32), stats++, prev_stats++, delta++,
|
||||||
max_delta++, accum_stats++) {
|
max_delta++, accum_stats++) {
|
||||||
if (le32_to_cpu(*stats) > le32_to_cpu(*prev_stats)) {
|
if (le32_to_cpu(*stats) > le32_to_cpu(*prev_stats)) {
|
||||||
@@ -135,18 +158,12 @@ static void iwl_accumulative_statistics(struct iwl_priv *priv,
|
|||||||
}
|
}
|
||||||
|
|
||||||
/* reset accumulative statistics for "no-counter" type statistics */
|
/* reset accumulative statistics for "no-counter" type statistics */
|
||||||
priv->_agn.accum_statistics.general.common.temperature =
|
accum_general->temperature = general->temperature;
|
||||||
priv->_agn.statistics.general.common.temperature;
|
accum_general->temperature_m = general->temperature_m;
|
||||||
priv->_agn.accum_statistics.general.common.temperature_m =
|
accum_general->ttl_timestamp = general->ttl_timestamp;
|
||||||
priv->_agn.statistics.general.common.temperature_m;
|
accum_tx->tx_power.ant_a = tx->tx_power.ant_a;
|
||||||
priv->_agn.accum_statistics.general.common.ttl_timestamp =
|
accum_tx->tx_power.ant_b = tx->tx_power.ant_b;
|
||||||
priv->_agn.statistics.general.common.ttl_timestamp;
|
accum_tx->tx_power.ant_c = tx->tx_power.ant_c;
|
||||||
priv->_agn.accum_statistics.tx.tx_power.ant_a =
|
|
||||||
priv->_agn.statistics.tx.tx_power.ant_a;
|
|
||||||
priv->_agn.accum_statistics.tx.tx_power.ant_b =
|
|
||||||
priv->_agn.statistics.tx.tx_power.ant_b;
|
|
||||||
priv->_agn.accum_statistics.tx.tx_power.ant_c =
|
|
||||||
priv->_agn.statistics.tx.tx_power.ant_c;
|
|
||||||
}
|
}
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
@@ -185,11 +202,30 @@ bool iwl_good_plcp_health(struct iwl_priv *priv,
|
|||||||
* by zero.
|
* by zero.
|
||||||
*/
|
*/
|
||||||
if (plcp_msec) {
|
if (plcp_msec) {
|
||||||
|
struct statistics_rx_phy *ofdm;
|
||||||
|
struct statistics_rx_ht_phy *ofdm_ht;
|
||||||
|
|
||||||
|
if (priv->cfg->bt_statistics) {
|
||||||
|
ofdm = &pkt->u.stats_bt.rx.ofdm;
|
||||||
|
ofdm_ht = &pkt->u.stats_bt.rx.ofdm_ht;
|
||||||
combined_plcp_delta =
|
combined_plcp_delta =
|
||||||
(le32_to_cpu(pkt->u.stats.rx.ofdm.plcp_err) -
|
(le32_to_cpu(ofdm->plcp_err) -
|
||||||
le32_to_cpu(priv->_agn.statistics.rx.ofdm.plcp_err)) +
|
le32_to_cpu(priv->_agn.statistics_bt.
|
||||||
(le32_to_cpu(pkt->u.stats.rx.ofdm_ht.plcp_err) -
|
rx.ofdm.plcp_err)) +
|
||||||
le32_to_cpu(priv->_agn.statistics.rx.ofdm_ht.plcp_err));
|
(le32_to_cpu(ofdm_ht->plcp_err) -
|
||||||
|
le32_to_cpu(priv->_agn.statistics_bt.
|
||||||
|
rx.ofdm_ht.plcp_err));
|
||||||
|
} else {
|
||||||
|
ofdm = &pkt->u.stats.rx.ofdm;
|
||||||
|
ofdm_ht = &pkt->u.stats.rx.ofdm_ht;
|
||||||
|
combined_plcp_delta =
|
||||||
|
(le32_to_cpu(ofdm->plcp_err) -
|
||||||
|
le32_to_cpu(priv->_agn.statistics.
|
||||||
|
rx.ofdm.plcp_err)) +
|
||||||
|
(le32_to_cpu(ofdm_ht->plcp_err) -
|
||||||
|
le32_to_cpu(priv->_agn.statistics.
|
||||||
|
rx.ofdm_ht.plcp_err));
|
||||||
|
}
|
||||||
|
|
||||||
if ((combined_plcp_delta > 0) &&
|
if ((combined_plcp_delta > 0) &&
|
||||||
((combined_plcp_delta * 100) / plcp_msec) >
|
((combined_plcp_delta * 100) / plcp_msec) >
|
||||||
@@ -208,13 +244,12 @@ bool iwl_good_plcp_health(struct iwl_priv *priv,
|
|||||||
IWL_DEBUG_RADIO(priv, "plcp_err exceeded %u, "
|
IWL_DEBUG_RADIO(priv, "plcp_err exceeded %u, "
|
||||||
"%u, %u, %u, %u, %d, %u mSecs\n",
|
"%u, %u, %u, %u, %d, %u mSecs\n",
|
||||||
priv->cfg->plcp_delta_threshold,
|
priv->cfg->plcp_delta_threshold,
|
||||||
le32_to_cpu(pkt->u.stats.rx.ofdm.plcp_err),
|
le32_to_cpu(ofdm->plcp_err),
|
||||||
le32_to_cpu(
|
le32_to_cpu(ofdm->plcp_err),
|
||||||
priv->_agn.statistics.rx.ofdm.plcp_err),
|
le32_to_cpu(ofdm_ht->plcp_err),
|
||||||
le32_to_cpu(pkt->u.stats.rx.ofdm_ht.plcp_err),
|
le32_to_cpu(ofdm_ht->plcp_err),
|
||||||
le32_to_cpu(
|
|
||||||
priv->_agn.statistics.rx.ofdm_ht.plcp_err),
|
|
||||||
combined_plcp_delta, plcp_msec);
|
combined_plcp_delta, plcp_msec);
|
||||||
|
|
||||||
rc = false;
|
rc = false;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@@ -227,22 +262,48 @@ void iwl_rx_statistics(struct iwl_priv *priv,
|
|||||||
int change;
|
int change;
|
||||||
struct iwl_rx_packet *pkt = rxb_addr(rxb);
|
struct iwl_rx_packet *pkt = rxb_addr(rxb);
|
||||||
|
|
||||||
|
if (priv->cfg->bt_statistics) {
|
||||||
|
IWL_DEBUG_RX(priv,
|
||||||
|
"Statistics notification received (%d vs %d).\n",
|
||||||
|
(int)sizeof(struct iwl_bt_notif_statistics),
|
||||||
|
le32_to_cpu(pkt->len_n_flags) &
|
||||||
|
FH_RSCSR_FRAME_SIZE_MSK);
|
||||||
|
|
||||||
IWL_DEBUG_RX(priv, "Statistics notification received (%d vs %d).\n",
|
change = ((priv->_agn.statistics_bt.general.common.temperature !=
|
||||||
(int)sizeof(priv->_agn.statistics),
|
pkt->u.stats_bt.general.common.temperature) ||
|
||||||
le32_to_cpu(pkt->len_n_flags) & FH_RSCSR_FRAME_SIZE_MSK);
|
((priv->_agn.statistics_bt.flag &
|
||||||
|
STATISTICS_REPLY_FLG_HT40_MODE_MSK) !=
|
||||||
|
(pkt->u.stats_bt.flag &
|
||||||
|
STATISTICS_REPLY_FLG_HT40_MODE_MSK)));
|
||||||
|
#ifdef CONFIG_IWLWIFI_DEBUGFS
|
||||||
|
iwl_accumulative_statistics(priv, (__le32 *)&pkt->u.stats_bt);
|
||||||
|
#endif
|
||||||
|
|
||||||
|
} else {
|
||||||
|
IWL_DEBUG_RX(priv,
|
||||||
|
"Statistics notification received (%d vs %d).\n",
|
||||||
|
(int)sizeof(struct iwl_notif_statistics),
|
||||||
|
le32_to_cpu(pkt->len_n_flags) &
|
||||||
|
FH_RSCSR_FRAME_SIZE_MSK);
|
||||||
|
|
||||||
change = ((priv->_agn.statistics.general.common.temperature !=
|
change = ((priv->_agn.statistics.general.common.temperature !=
|
||||||
pkt->u.stats.general.common.temperature) ||
|
pkt->u.stats.general.common.temperature) ||
|
||||||
((priv->_agn.statistics.flag &
|
((priv->_agn.statistics.flag &
|
||||||
STATISTICS_REPLY_FLG_HT40_MODE_MSK) !=
|
STATISTICS_REPLY_FLG_HT40_MODE_MSK) !=
|
||||||
(pkt->u.stats.flag & STATISTICS_REPLY_FLG_HT40_MODE_MSK)));
|
(pkt->u.stats.flag &
|
||||||
|
STATISTICS_REPLY_FLG_HT40_MODE_MSK)));
|
||||||
#ifdef CONFIG_IWLWIFI_DEBUGFS
|
#ifdef CONFIG_IWLWIFI_DEBUGFS
|
||||||
iwl_accumulative_statistics(priv, (__le32 *)&pkt->u.stats);
|
iwl_accumulative_statistics(priv, (__le32 *)&pkt->u.stats);
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
iwl_recover_from_statistics(priv, pkt);
|
iwl_recover_from_statistics(priv, pkt);
|
||||||
|
|
||||||
|
if (priv->cfg->bt_statistics)
|
||||||
|
memcpy(&priv->_agn.statistics_bt, &pkt->u.stats_bt,
|
||||||
|
sizeof(priv->_agn.statistics_bt));
|
||||||
|
else
|
||||||
memcpy(&priv->_agn.statistics, &pkt->u.stats,
|
memcpy(&priv->_agn.statistics, &pkt->u.stats,
|
||||||
sizeof(priv->_agn.statistics));
|
sizeof(priv->_agn.statistics));
|
||||||
|
|
||||||
@@ -277,6 +338,12 @@ void iwl_reply_statistics(struct iwl_priv *priv,
|
|||||||
sizeof(struct iwl_notif_statistics));
|
sizeof(struct iwl_notif_statistics));
|
||||||
memset(&priv->_agn.max_delta, 0,
|
memset(&priv->_agn.max_delta, 0,
|
||||||
sizeof(struct iwl_notif_statistics));
|
sizeof(struct iwl_notif_statistics));
|
||||||
|
memset(&priv->_agn.accum_statistics_bt, 0,
|
||||||
|
sizeof(struct iwl_bt_notif_statistics));
|
||||||
|
memset(&priv->_agn.delta_statistics_bt, 0,
|
||||||
|
sizeof(struct iwl_bt_notif_statistics));
|
||||||
|
memset(&priv->_agn.max_delta_bt, 0,
|
||||||
|
sizeof(struct iwl_bt_notif_statistics));
|
||||||
#endif
|
#endif
|
||||||
IWL_DEBUG_RX(priv, "Statistics have been cleared\n");
|
IWL_DEBUG_RX(priv, "Statistics have been cleared\n");
|
||||||
}
|
}
|
||||||
|
@@ -3008,9 +3008,17 @@ static void iwl_bg_run_time_calib_work(struct work_struct *work)
|
|||||||
}
|
}
|
||||||
|
|
||||||
if (priv->start_calib) {
|
if (priv->start_calib) {
|
||||||
iwl_chain_noise_calibration(priv, &priv->_agn.statistics);
|
if (priv->cfg->bt_statistics) {
|
||||||
|
iwl_chain_noise_calibration(priv,
|
||||||
iwl_sensitivity_calibration(priv, &priv->_agn.statistics);
|
(void *)&priv->_agn.statistics_bt);
|
||||||
|
iwl_sensitivity_calibration(priv,
|
||||||
|
(void *)&priv->_agn.statistics_bt);
|
||||||
|
} else {
|
||||||
|
iwl_chain_noise_calibration(priv,
|
||||||
|
(void *)&priv->_agn.statistics);
|
||||||
|
iwl_sensitivity_calibration(priv,
|
||||||
|
(void *)&priv->_agn.statistics);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
mutex_unlock(&priv->mutex);
|
mutex_unlock(&priv->mutex);
|
||||||
|
@@ -66,10 +66,8 @@
|
|||||||
#include "iwl-core.h"
|
#include "iwl-core.h"
|
||||||
#include "iwl-commands.h"
|
#include "iwl-commands.h"
|
||||||
|
|
||||||
void iwl_chain_noise_calibration(struct iwl_priv *priv,
|
void iwl_chain_noise_calibration(struct iwl_priv *priv, void *stat_resp);
|
||||||
struct iwl_notif_statistics *stat_resp);
|
void iwl_sensitivity_calibration(struct iwl_priv *priv, void *resp);
|
||||||
void iwl_sensitivity_calibration(struct iwl_priv *priv,
|
|
||||||
struct iwl_notif_statistics *resp);
|
|
||||||
|
|
||||||
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);
|
||||||
|
@@ -3988,6 +3988,7 @@ struct iwl_rx_packet {
|
|||||||
struct iwl_sleep_notification sleep_notif;
|
struct iwl_sleep_notification sleep_notif;
|
||||||
struct iwl_spectrum_resp spectrum;
|
struct iwl_spectrum_resp spectrum;
|
||||||
struct iwl_notif_statistics stats;
|
struct iwl_notif_statistics stats;
|
||||||
|
struct iwl_bt_notif_statistics stats_bt;
|
||||||
struct iwl_compressed_ba_resp compressed_ba;
|
struct iwl_compressed_ba_resp compressed_ba;
|
||||||
struct iwl_missed_beacon_notif missed_beacon;
|
struct iwl_missed_beacon_notif missed_beacon;
|
||||||
struct iwl_coex_medium_notification coex_medium_notif;
|
struct iwl_coex_medium_notification coex_medium_notif;
|
||||||
|
@@ -1322,10 +1322,14 @@ struct iwl_priv {
|
|||||||
u32 inst_evtlog_ptr, inst_evtlog_size, inst_errlog_ptr;
|
u32 inst_evtlog_ptr, inst_evtlog_size, inst_errlog_ptr;
|
||||||
|
|
||||||
struct iwl_notif_statistics statistics;
|
struct iwl_notif_statistics statistics;
|
||||||
|
struct iwl_bt_notif_statistics statistics_bt;
|
||||||
#ifdef CONFIG_IWLWIFI_DEBUGFS
|
#ifdef CONFIG_IWLWIFI_DEBUGFS
|
||||||
struct iwl_notif_statistics accum_statistics;
|
struct iwl_notif_statistics accum_statistics;
|
||||||
struct iwl_notif_statistics delta_statistics;
|
struct iwl_notif_statistics delta_statistics;
|
||||||
struct iwl_notif_statistics max_delta;
|
struct iwl_notif_statistics max_delta;
|
||||||
|
struct iwl_bt_notif_statistics accum_statistics_bt;
|
||||||
|
struct iwl_bt_notif_statistics delta_statistics_bt;
|
||||||
|
struct iwl_bt_notif_statistics max_delta_bt;
|
||||||
#endif
|
#endif
|
||||||
} _agn;
|
} _agn;
|
||||||
#endif
|
#endif
|
||||||
|
Reference in New Issue
Block a user