#ifdef CONFIG_IWLWIFI_DEBUG
int i;
#endif
- int rc = -1;
-
struct iwl_host_cmd cmd = {
.id = REPLY_TX_LINK_QUALITY_CMD,
.len = sizeof(struct iwl_link_quality_cmd),
if ((lq->sta_id == 0xFF) &&
(priv->iw_mode == IEEE80211_IF_TYPE_IBSS))
- return rc;
+ return -EINVAL;
if (lq->sta_id == 0xFF)
lq->sta_id = IWL_AP_ID;
if (iwl_is_associated(priv) && priv->assoc_station_added &&
priv->lq_mngr.lq_ready)
- rc = iwl_send_cmd(priv, &cmd);
+ return iwl_send_cmd(priv, &cmd);
- return rc;
+ return 0;
}
-static int rs_rate_scale_clear_window(struct iwl_rate_scale_data *window)
+static void rs_rate_scale_clear_window(struct iwl_rate_scale_data *window)
{
window->data = 0;
window->success_counter = 0;
window->counter = 0;
window->average_tpt = IWL_INVALID_VALUE;
window->stamp = 0;
-
- return 0;
}
static int rs_collect_tx_data(struct iwl_rate_scale_data *windows,
int scale_index, s32 tpt, u32 status)
{
- int rc = 0;
struct iwl_rate_scale_data *window = NULL;
u64 mask;
u8 win_size = IWL_RATE_MAX_WINDOW;
s32 fail_count;
- if (scale_index < 0)
- return -1;
-
- if (scale_index >= IWL_RATE_COUNT)
- return -1;
+ if (scale_index < 0 || scale_index >= IWL_RATE_COUNT)
+ return -EINVAL;
window = &(windows[scale_index]);
window->stamp = jiffies;
- return rc;
+ return 0;
}
-int static rs_mcs_from_tbl(struct iwl_rate *mcs_rate,
+static void rs_mcs_from_tbl(struct iwl_rate *mcs_rate,
struct iwl_scale_tbl_info *tbl,
int index, u8 use_green)
{
- int rc = 0;
-
if (is_legacy(tbl->lq_type)) {
mcs_rate->rate_n_flags = iwl_rates[index].plcp;
if (index >= IWL_FIRST_CCK_RATE && index <= IWL_LAST_CCK_RATE)
}
if (is_legacy(tbl->lq_type))
- return rc;
+ return;
if (tbl->is_fat) {
if (tbl->is_dup)
if (is_siso(tbl->lq_type))
mcs_rate->rate_n_flags &= ~RATE_MCS_SGI_MSK;
}
- return rc;
}
static int rs_get_tbl_info_from_mcs(const struct iwl_rate *mcs_rate,
if (index == IWL_RATE_INVALID) {
*rate_idx = -1;
- return -1;
+ return -EINVAL;
}
tbl->is_SGI = 0;
tbl->is_fat = 0;
}
}
-static inline s8 rs_use_green(struct iwl_priv *priv)
+static inline u8 rs_use_green(struct iwl_priv *priv)
{
- s8 rc = 0;
#ifdef CONFIG_IWLWIFI_HT
if (!priv->is_ht_enabled || !priv->current_assoc_ht.is_ht)
return 0;
- if ((priv->current_assoc_ht.is_green_field) &&
- !(priv->current_assoc_ht.operating_mode & 0x4))
- rc = 1;
+ return ((priv->current_assoc_ht.is_green_field) &&
+ !(priv->current_assoc_ht.operating_mode & 0x4));
#endif /*CONFIG_IWLWIFI_HT */
- return rc;
+ return 0;
}
/**
return (high << 8) | low;
}
-static int rs_get_lower_rate(struct iwl_rate_scale_priv *lq_data,
+static void rs_get_lower_rate(struct iwl_rate_scale_priv *lq_data,
struct iwl_scale_tbl_info *tbl, u8 scale_index,
u8 ht_possible, struct iwl_rate *mcs_rate)
{
}
/* if we did switched from HT to legacy check current rate */
- if ((switch_to_legacy) &&
- (rate_mask & (1 << scale_index))) {
+ if (switch_to_legacy && (rate_mask & (1 << scale_index))) {
rs_mcs_from_tbl(mcs_rate, tbl, scale_index, is_green);
- return 0;
+ return;
}
high_low = rs_get_adjacent_rate(scale_index, rate_mask, tbl->lq_type);
rs_mcs_from_tbl(mcs_rate, tbl, low, is_green);
else
rs_mcs_from_tbl(mcs_rate, tbl, scale_index, is_green);
-
- return 0;
}
static void rs_tx_status(void *priv_rate,
return ((valid_antenna & 0x2) ? 1:0);
else if (antenna_type == ANT_MAIN)
return ((valid_antenna & 0x1) ? 1:0);
- else if (antenna_type == ANT_BOTH) {
- if ((valid_antenna & 0x3) == 0x3)
- return 1;
- else
- return 0;
- }
+ else if (antenna_type == ANT_BOTH)
+ return ((valid_antenna & 0x3) == 0x3);
return 1;
}
enum iwl_antenna_type antenna_type)
{
if (antenna_type == ANT_AUX)
- return (rs_is_ant_connected(valid_antenna, ANT_MAIN));
+ return rs_is_ant_connected(valid_antenna, ANT_MAIN);
else
- return (rs_is_ant_connected(valid_antenna, ANT_AUX));
+ return rs_is_ant_connected(valid_antenna, ANT_AUX);
return 0;
}
struct iwl_rate_scale_priv *lq_data,
struct iwl_scale_tbl_info *tbl, int index)
{
- int rc = -1;
#ifdef CONFIG_IWLWIFI_HT
u16 rate_mask;
s32 rate;
if (!rs_is_both_ant_supp(lq_data->antenna))
return -1;
- rc = 0;
tbl->is_dup = lq_data->is_dup;
tbl->action = 0;
if (priv->current_channel_width == IWL_CHANNEL_WIDTH_40MHZ)
tbl->current_rate.rate_n_flags, is_green);
#endif /*CONFIG_IWLWIFI_HT */
- return rc;
+ return 0;
}
static int rs_switch_to_siso(struct iwl_priv *priv,
struct iwl_rate_scale_priv *lq_data,
struct iwl_scale_tbl_info *tbl, int index)
{
- int rc = -1;
#ifdef CONFIG_IWLWIFI_HT
u16 rate_mask;
u8 is_green = lq_data->is_green;
if (!priv->is_ht_enabled || !priv->current_assoc_ht.is_ht)
return -1;
- rc = 0;
tbl->is_dup = lq_data->is_dup;
tbl->lq_type = LQ_SISO;
tbl->action = 0;
tbl->current_rate.rate_n_flags, is_green);
#endif /*CONFIG_IWLWIFI_HT */
- return rc;
+ return 0;
}
static int rs_move_legacy_other(struct iwl_priv *priv,
struct iwl_rate_scale_priv *lq_data,
int index)
{
- int rc = 0;
+ int ret = 0;
struct iwl_scale_tbl_info *tbl =
&(lq_data->lq_info[lq_data->active_tbl]);
struct iwl_scale_tbl_info *search_tbl =
search_tbl->lq_type = LQ_SISO;
search_tbl->is_SGI = 0;
search_tbl->is_fat = 0;
- rc = rs_switch_to_siso(priv, lq_data, search_tbl,
+ ret = rs_switch_to_siso(priv, lq_data, search_tbl,
index);
- if (!rc) {
+ if (!ret) {
lq_data->search_better_tbl = 1;
lq_data->action_counter = 0;
- }
- if (!rc)
goto out;
+ }
break;
case IWL_LEGACY_SWITCH_MIMO:
search_tbl->is_SGI = 0;
search_tbl->is_fat = 0;
search_tbl->antenna_type = ANT_BOTH;
- rc = rs_switch_to_mimo(priv, lq_data, search_tbl,
+ ret = rs_switch_to_mimo(priv, lq_data, search_tbl,
index);
- if (!rc) {
+ if (!ret) {
lq_data->search_better_tbl = 1;
lq_data->action_counter = 0;
- }
- if (!rc)
goto out;
+ }
break;
}
tbl->action++;
struct iwl_rate_scale_priv *lq_data,
int index)
{
- int rc = -1;
+ int ret;
u8 is_green = lq_data->is_green;
struct iwl_scale_tbl_info *tbl =
&(lq_data->lq_info[lq_data->active_tbl]);
search_tbl->is_SGI = 0;
search_tbl->is_fat = 0;
search_tbl->antenna_type = ANT_BOTH;
- rc = rs_switch_to_mimo(priv, lq_data, search_tbl,
+ ret = rs_switch_to_mimo(priv, lq_data, search_tbl,
index);
- if (!rc)
+ if (!ret) {
lq_data->search_better_tbl = 1;
-
- if (!rc)
goto out;
+ }
break;
case IWL_SISO_SWITCH_GI:
IWL_DEBUG_HT("LQ: SISO SWITCH TO GI\n");
struct iwl_rate_scale_priv *lq_data,
int index)
{
- int rc = -1;
+ int ret;
s8 is_green = lq_data->is_green;
struct iwl_scale_tbl_info *tbl =
&(lq_data->lq_info[lq_data->active_tbl]);
else
search_tbl->antenna_type = ANT_AUX;
- rc = rs_switch_to_siso(priv, lq_data, search_tbl,
+ ret = rs_switch_to_siso(priv, lq_data, search_tbl,
index);
- if (!rc) {
+ if (!ret) {
lq_data->search_better_tbl = 1;
goto out;
}