Commit 616107ed authored by Stanislaw Gruszka's avatar Stanislaw Gruszka Committed by John W. Linville

iwlegacy: 4965: small tx_cmd build cleanup

Get rid of two inline functions related and simplify a bit
rts_retry_limit calculations.
Signed-off-by: default avatarStanislaw Gruszka <sgruszka@redhat.com>
Signed-off-by: default avatarJohn W. Linville <linville@tuxdriver.com>
parent a0c1ef3b
...@@ -819,12 +819,6 @@ il4965_get_channels_for_scan(struct il_priv *il, struct ieee80211_vif *vif, ...@@ -819,12 +819,6 @@ il4965_get_channels_for_scan(struct il_priv *il, struct ieee80211_vif *vif,
return added; return added;
} }
static inline u32
il4965_ant_idx_to_flags(u8 ant_idx)
{
return BIT(ant_idx) << RATE_MCS_ANT_POS;
}
static void static void
il4965_toggle_tx_ant(struct il_priv *il, u8 *ant, u8 valid) il4965_toggle_tx_ant(struct il_priv *il, u8 *ant, u8 valid)
{ {
...@@ -976,9 +970,8 @@ il4965_request_scan(struct il_priv *il, struct ieee80211_vif *vif) ...@@ -976,9 +970,8 @@ il4965_request_scan(struct il_priv *il, struct ieee80211_vif *vif)
rx_ant = il->cfg->scan_rx_antennas[band]; rx_ant = il->cfg->scan_rx_antennas[band];
il4965_toggle_tx_ant(il, &il->scan_tx_ant[band], scan_tx_antennas); il4965_toggle_tx_ant(il, &il->scan_tx_ant[band], scan_tx_antennas);
rate_flags |= il4965_ant_idx_to_flags(il->scan_tx_ant[band]); rate_flags |= BIT(il->scan_tx_ant[band]) << RATE_MCS_ANT_POS;
scan->tx_cmd.rate_n_flags = scan->tx_cmd.rate_n_flags = cpu_to_le32(rate | rate_flags);
il4965_hw_set_rate_n_flags(rate, rate_flags);
/* In power save mode use one chain, otherwise use all chains */ /* In power save mode use one chain, otherwise use all chains */
if (test_bit(S_POWER_PMI, &il->status)) { if (test_bit(S_POWER_PMI, &il->status)) {
...@@ -1530,15 +1523,13 @@ il4965_tx_cmd_build_basic(struct il_priv *il, struct sk_buff *skb, ...@@ -1530,15 +1523,13 @@ il4965_tx_cmd_build_basic(struct il_priv *il, struct sk_buff *skb,
tx_cmd->next_frame_len = 0; tx_cmd->next_frame_len = 0;
} }
#define RTS_DFAULT_RETRY_LIMIT 60
static void static void
il4965_tx_cmd_build_rate(struct il_priv *il, struct il_tx_cmd *tx_cmd, il4965_tx_cmd_build_rate(struct il_priv *il, struct il_tx_cmd *tx_cmd,
struct ieee80211_tx_info *info, __le16 fc) struct ieee80211_tx_info *info, __le16 fc)
{ {
const u8 rts_retry_limit = 60;
u32 rate_flags; u32 rate_flags;
int rate_idx; int rate_idx;
u8 rts_retry_limit;
u8 data_retry_limit; u8 data_retry_limit;
u8 rate_plcp; u8 rate_plcp;
...@@ -1548,12 +1539,8 @@ il4965_tx_cmd_build_rate(struct il_priv *il, struct il_tx_cmd *tx_cmd, ...@@ -1548,12 +1539,8 @@ il4965_tx_cmd_build_rate(struct il_priv *il, struct il_tx_cmd *tx_cmd,
else else
data_retry_limit = IL4965_DEFAULT_TX_RETRY; data_retry_limit = IL4965_DEFAULT_TX_RETRY;
tx_cmd->data_retry_limit = data_retry_limit; tx_cmd->data_retry_limit = data_retry_limit;
/* Set retry limit on RTS packets */ /* Set retry limit on RTS packets */
rts_retry_limit = RTS_DFAULT_RETRY_LIMIT; tx_cmd->rts_retry_limit = min(data_retry_limit, rts_retry_limit);
if (data_retry_limit < rts_retry_limit)
rts_retry_limit = data_retry_limit;
tx_cmd->rts_retry_limit = rts_retry_limit;
/* DATA packets will use the uCode station table for rate/antenna /* DATA packets will use the uCode station table for rate/antenna
* selection */ * selection */
...@@ -1589,11 +1576,10 @@ il4965_tx_cmd_build_rate(struct il_priv *il, struct il_tx_cmd *tx_cmd, ...@@ -1589,11 +1576,10 @@ il4965_tx_cmd_build_rate(struct il_priv *il, struct il_tx_cmd *tx_cmd,
/* Set up antennas */ /* Set up antennas */
il4965_toggle_tx_ant(il, &il->mgmt_tx_ant, il->hw_params.valid_tx_ant); il4965_toggle_tx_ant(il, &il->mgmt_tx_ant, il->hw_params.valid_tx_ant);
rate_flags |= il4965_ant_idx_to_flags(il->mgmt_tx_ant); rate_flags |= BIT(il->mgmt_tx_ant) << RATE_MCS_ANT_POS;
/* Set the rate in the TX cmd */ /* Set the rate in the TX cmd */
tx_cmd->rate_n_flags = tx_cmd->rate_n_flags = cpu_to_le32(rate_plcp | rate_flags);
il4965_hw_set_rate_n_flags(rate_plcp, rate_flags);
} }
static void static void
...@@ -2753,7 +2739,7 @@ il4965_sta_alloc_lq(struct il_priv *il, u8 sta_id) ...@@ -2753,7 +2739,7 @@ il4965_sta_alloc_lq(struct il_priv *il, u8 sta_id)
rate_flags |= rate_flags |=
il4965_first_antenna(il->hw_params. il4965_first_antenna(il->hw_params.
valid_tx_ant) << RATE_MCS_ANT_POS; valid_tx_ant) << RATE_MCS_ANT_POS;
rate_n_flags = il4965_hw_set_rate_n_flags(il_rates[r].plcp, rate_flags); rate_n_flags = cpu_to_le32(il_rates[r].plcp | rate_flags);
for (i = 0; i < LINK_QUAL_MAX_RETRY_NUM; i++) for (i = 0; i < LINK_QUAL_MAX_RETRY_NUM; i++)
link_cmd->rs_table[i].rate_n_flags = rate_n_flags; link_cmd->rs_table[i].rate_n_flags = rate_n_flags;
...@@ -3538,11 +3524,10 @@ il4965_hw_get_beacon_cmd(struct il_priv *il, struct il_frame *frame) ...@@ -3538,11 +3524,10 @@ il4965_hw_get_beacon_cmd(struct il_priv *il, struct il_frame *frame)
/* Set up packet rate and flags */ /* Set up packet rate and flags */
rate = il_get_lowest_plcp(il, il->beacon_ctx); rate = il_get_lowest_plcp(il, il->beacon_ctx);
il4965_toggle_tx_ant(il, &il->mgmt_tx_ant, il->hw_params.valid_tx_ant); il4965_toggle_tx_ant(il, &il->mgmt_tx_ant, il->hw_params.valid_tx_ant);
rate_flags = il4965_ant_idx_to_flags(il->mgmt_tx_ant); rate_flags = BIT(il->mgmt_tx_ant) << RATE_MCS_ANT_POS;
if ((rate >= IL_FIRST_CCK_RATE) && (rate <= IL_LAST_CCK_RATE)) if ((rate >= IL_FIRST_CCK_RATE) && (rate <= IL_LAST_CCK_RATE))
rate_flags |= RATE_MCS_CCK_MSK; rate_flags |= RATE_MCS_CCK_MSK;
tx_beacon_cmd->tx.rate_n_flags = tx_beacon_cmd->tx.rate_n_flags = cpu_to_le32(rate | rate_flags);
il4965_hw_set_rate_n_flags(rate, rate_flags);
return sizeof(*tx_beacon_cmd) + frame_size; return sizeof(*tx_beacon_cmd) + frame_size;
} }
......
...@@ -167,12 +167,6 @@ il4965_hw_get_rate(__le32 rate_n_flags) ...@@ -167,12 +167,6 @@ il4965_hw_get_rate(__le32 rate_n_flags)
return le32_to_cpu(rate_n_flags) & 0xFF; return le32_to_cpu(rate_n_flags) & 0xFF;
} }
static inline __le32
il4965_hw_set_rate_n_flags(u8 rate, u32 flags)
{
return cpu_to_le32(flags | (u32) rate);
}
/* eeprom */ /* eeprom */
void il4965_eeprom_get_mac(const struct il_priv *il, u8 * mac); void il4965_eeprom_get_mac(const struct il_priv *il, u8 * mac);
int il4965_eeprom_acquire_semaphore(struct il_priv *il); int il4965_eeprom_acquire_semaphore(struct il_priv *il);
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment