aboutsummaryrefslogtreecommitdiffstats
path: root/drivers/net/wireless/iwlegacy/4965-mac.c
diff options
context:
space:
mode:
authorStanislaw Gruszka <sgruszka@redhat.com>2011-12-23 02:13:45 -0500
committerJohn W. Linville <linville@tuxdriver.com>2012-01-04 14:30:44 -0500
commit616107ed818876076bc482d3a33f89c31297b86e (patch)
treeb2888035059c7aae1e24b30f5d1509214f0db377 /drivers/net/wireless/iwlegacy/4965-mac.c
parenta0c1ef3b12f88c0ed7683472395145e491808b4b (diff)
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: Stanislaw Gruszka <sgruszka@redhat.com> Signed-off-by: John W. Linville <linville@tuxdriver.com>
Diffstat (limited to 'drivers/net/wireless/iwlegacy/4965-mac.c')
-rw-r--r--drivers/net/wireless/iwlegacy/4965-mac.c33
1 files changed, 9 insertions, 24 deletions
diff --git a/drivers/net/wireless/iwlegacy/4965-mac.c b/drivers/net/wireless/iwlegacy/4965-mac.c
index e1dfb2c4f832..cefc623f19ea 100644
--- a/drivers/net/wireless/iwlegacy/4965-mac.c
+++ b/drivers/net/wireless/iwlegacy/4965-mac.c
@@ -819,12 +819,6 @@ il4965_get_channels_for_scan(struct il_priv *il, struct ieee80211_vif *vif,
819 return added; 819 return added;
820} 820}
821 821
822static inline u32
823il4965_ant_idx_to_flags(u8 ant_idx)
824{
825 return BIT(ant_idx) << RATE_MCS_ANT_POS;
826}
827
828static void 822static void
829il4965_toggle_tx_ant(struct il_priv *il, u8 *ant, u8 valid) 823il4965_toggle_tx_ant(struct il_priv *il, u8 *ant, u8 valid)
830{ 824{
@@ -976,9 +970,8 @@ il4965_request_scan(struct il_priv *il, struct ieee80211_vif *vif)
976 rx_ant = il->cfg->scan_rx_antennas[band]; 970 rx_ant = il->cfg->scan_rx_antennas[band];
977 971
978 il4965_toggle_tx_ant(il, &il->scan_tx_ant[band], scan_tx_antennas); 972 il4965_toggle_tx_ant(il, &il->scan_tx_ant[band], scan_tx_antennas);
979 rate_flags |= il4965_ant_idx_to_flags(il->scan_tx_ant[band]); 973 rate_flags |= BIT(il->scan_tx_ant[band]) << RATE_MCS_ANT_POS;
980 scan->tx_cmd.rate_n_flags = 974 scan->tx_cmd.rate_n_flags = cpu_to_le32(rate | rate_flags);
981 il4965_hw_set_rate_n_flags(rate, rate_flags);
982 975
983 /* In power save mode use one chain, otherwise use all chains */ 976 /* In power save mode use one chain, otherwise use all chains */
984 if (test_bit(S_POWER_PMI, &il->status)) { 977 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 tx_cmd->next_frame_len = 0; 1523 tx_cmd->next_frame_len = 0;
1531} 1524}
1532 1525
1533#define RTS_DFAULT_RETRY_LIMIT 60
1534
1535static void 1526static void
1536il4965_tx_cmd_build_rate(struct il_priv *il, struct il_tx_cmd *tx_cmd, 1527il4965_tx_cmd_build_rate(struct il_priv *il, struct il_tx_cmd *tx_cmd,
1537 struct ieee80211_tx_info *info, __le16 fc) 1528 struct ieee80211_tx_info *info, __le16 fc)
1538{ 1529{
1530 const u8 rts_retry_limit = 60;
1539 u32 rate_flags; 1531 u32 rate_flags;
1540 int rate_idx; 1532 int rate_idx;
1541 u8 rts_retry_limit;
1542 u8 data_retry_limit; 1533 u8 data_retry_limit;
1543 u8 rate_plcp; 1534 u8 rate_plcp;
1544 1535
@@ -1548,12 +1539,8 @@ il4965_tx_cmd_build_rate(struct il_priv *il, struct il_tx_cmd *tx_cmd,
1548 else 1539 else
1549 data_retry_limit = IL4965_DEFAULT_TX_RETRY; 1540 data_retry_limit = IL4965_DEFAULT_TX_RETRY;
1550 tx_cmd->data_retry_limit = data_retry_limit; 1541 tx_cmd->data_retry_limit = data_retry_limit;
1551
1552 /* Set retry limit on RTS packets */ 1542 /* Set retry limit on RTS packets */
1553 rts_retry_limit = RTS_DFAULT_RETRY_LIMIT; 1543 tx_cmd->rts_retry_limit = min(data_retry_limit, rts_retry_limit);
1554 if (data_retry_limit < rts_retry_limit)
1555 rts_retry_limit = data_retry_limit;
1556 tx_cmd->rts_retry_limit = rts_retry_limit;
1557 1544
1558 /* DATA packets will use the uCode station table for rate/antenna 1545 /* DATA packets will use the uCode station table for rate/antenna
1559 * selection */ 1546 * selection */
@@ -1589,11 +1576,10 @@ il4965_tx_cmd_build_rate(struct il_priv *il, struct il_tx_cmd *tx_cmd,
1589 1576
1590 /* Set up antennas */ 1577 /* Set up antennas */
1591 il4965_toggle_tx_ant(il, &il->mgmt_tx_ant, il->hw_params.valid_tx_ant); 1578 il4965_toggle_tx_ant(il, &il->mgmt_tx_ant, il->hw_params.valid_tx_ant);
1592 rate_flags |= il4965_ant_idx_to_flags(il->mgmt_tx_ant); 1579 rate_flags |= BIT(il->mgmt_tx_ant) << RATE_MCS_ANT_POS;
1593 1580
1594 /* Set the rate in the TX cmd */ 1581 /* Set the rate in the TX cmd */
1595 tx_cmd->rate_n_flags = 1582 tx_cmd->rate_n_flags = cpu_to_le32(rate_plcp | rate_flags);
1596 il4965_hw_set_rate_n_flags(rate_plcp, rate_flags);
1597} 1583}
1598 1584
1599static void 1585static void
@@ -2753,7 +2739,7 @@ il4965_sta_alloc_lq(struct il_priv *il, u8 sta_id)
2753 rate_flags |= 2739 rate_flags |=
2754 il4965_first_antenna(il->hw_params. 2740 il4965_first_antenna(il->hw_params.
2755 valid_tx_ant) << RATE_MCS_ANT_POS; 2741 valid_tx_ant) << RATE_MCS_ANT_POS;
2756 rate_n_flags = il4965_hw_set_rate_n_flags(il_rates[r].plcp, rate_flags); 2742 rate_n_flags = cpu_to_le32(il_rates[r].plcp | rate_flags);
2757 for (i = 0; i < LINK_QUAL_MAX_RETRY_NUM; i++) 2743 for (i = 0; i < LINK_QUAL_MAX_RETRY_NUM; i++)
2758 link_cmd->rs_table[i].rate_n_flags = rate_n_flags; 2744 link_cmd->rs_table[i].rate_n_flags = rate_n_flags;
2759 2745
@@ -3538,11 +3524,10 @@ il4965_hw_get_beacon_cmd(struct il_priv *il, struct il_frame *frame)
3538 /* Set up packet rate and flags */ 3524 /* Set up packet rate and flags */
3539 rate = il_get_lowest_plcp(il, il->beacon_ctx); 3525 rate = il_get_lowest_plcp(il, il->beacon_ctx);
3540 il4965_toggle_tx_ant(il, &il->mgmt_tx_ant, il->hw_params.valid_tx_ant); 3526 il4965_toggle_tx_ant(il, &il->mgmt_tx_ant, il->hw_params.valid_tx_ant);
3541 rate_flags = il4965_ant_idx_to_flags(il->mgmt_tx_ant); 3527 rate_flags = BIT(il->mgmt_tx_ant) << RATE_MCS_ANT_POS;
3542 if ((rate >= IL_FIRST_CCK_RATE) && (rate <= IL_LAST_CCK_RATE)) 3528 if ((rate >= IL_FIRST_CCK_RATE) && (rate <= IL_LAST_CCK_RATE))
3543 rate_flags |= RATE_MCS_CCK_MSK; 3529 rate_flags |= RATE_MCS_CCK_MSK;
3544 tx_beacon_cmd->tx.rate_n_flags = 3530 tx_beacon_cmd->tx.rate_n_flags = cpu_to_le32(rate | rate_flags);
3545 il4965_hw_set_rate_n_flags(rate, rate_flags);
3546 3531
3547 return sizeof(*tx_beacon_cmd) + frame_size; 3532 return sizeof(*tx_beacon_cmd) + frame_size;
3548} 3533}