aboutsummaryrefslogtreecommitdiffstats
path: root/drivers/net
diff options
context:
space:
mode:
authorStanislaw Gruszka <sgruszka@redhat.com>2011-12-23 02:13:44 -0500
committerJohn W. Linville <linville@tuxdriver.com>2012-01-04 14:30:44 -0500
commita0c1ef3b12f88c0ed7683472395145e491808b4b (patch)
tree64898a51da973c8e029fbea69cf18a5577d07cff /drivers/net
parent17d4eca6432bb1d4753d7894b824271673a1640a (diff)
iwlegacy: 4965: toggle tx antenna inline
Make function static and change antenna number inline. Signed-off-by: Stanislaw Gruszka <sgruszka@redhat.com> Signed-off-by: John W. Linville <linville@tuxdriver.com>
Diffstat (limited to 'drivers/net')
-rw-r--r--drivers/net/wireless/iwlegacy/4965-mac.c41
-rw-r--r--drivers/net/wireless/iwlegacy/4965.h2
2 files changed, 18 insertions, 25 deletions
diff --git a/drivers/net/wireless/iwlegacy/4965-mac.c b/drivers/net/wireless/iwlegacy/4965-mac.c
index 4aaef4135564..e1dfb2c4f832 100644
--- a/drivers/net/wireless/iwlegacy/4965-mac.c
+++ b/drivers/net/wireless/iwlegacy/4965-mac.c
@@ -825,6 +825,21 @@ il4965_ant_idx_to_flags(u8 ant_idx)
825 return BIT(ant_idx) << RATE_MCS_ANT_POS; 825 return BIT(ant_idx) << RATE_MCS_ANT_POS;
826} 826}
827 827
828static void
829il4965_toggle_tx_ant(struct il_priv *il, u8 *ant, u8 valid)
830{
831 int i;
832 u8 ind = *ant;
833
834 for (i = 0; i < RATE_ANT_NUM - 1; i++) {
835 ind = (ind + 1) < RATE_ANT_NUM ? ind + 1 : 0;
836 if (valid & BIT(ind)) {
837 *ant = ind;
838 return;
839 }
840 }
841}
842
828int 843int
829il4965_request_scan(struct il_priv *il, struct ieee80211_vif *vif) 844il4965_request_scan(struct il_priv *il, struct ieee80211_vif *vif)
830{ 845{
@@ -960,8 +975,7 @@ il4965_request_scan(struct il_priv *il, struct ieee80211_vif *vif)
960 if (il->cfg->scan_rx_antennas[band]) 975 if (il->cfg->scan_rx_antennas[band])
961 rx_ant = il->cfg->scan_rx_antennas[band]; 976 rx_ant = il->cfg->scan_rx_antennas[band];
962 977
963 il->scan_tx_ant[band] = 978 il4965_toggle_tx_ant(il, &il->scan_tx_ant[band], scan_tx_antennas);
964 il4965_toggle_tx_ant(il, il->scan_tx_ant[band], scan_tx_antennas);
965 rate_flags |= il4965_ant_idx_to_flags(il->scan_tx_ant[band]); 979 rate_flags |= il4965_ant_idx_to_flags(il->scan_tx_ant[band]);
966 scan->tx_cmd.rate_n_flags = 980 scan->tx_cmd.rate_n_flags =
967 il4965_hw_set_rate_n_flags(rate, rate_flags); 981 il4965_hw_set_rate_n_flags(rate, rate_flags);
@@ -1171,20 +1185,6 @@ il4965_set_rxon_chain(struct il_priv *il, struct il_rxon_context *ctx)
1171 active_rx_cnt < idle_rx_cnt); 1185 active_rx_cnt < idle_rx_cnt);
1172} 1186}
1173 1187
1174u8
1175il4965_toggle_tx_ant(struct il_priv *il, u8 ant, u8 valid)
1176{
1177 int i;
1178 u8 ind = ant;
1179
1180 for (i = 0; i < RATE_ANT_NUM - 1; i++) {
1181 ind = (ind + 1) < RATE_ANT_NUM ? ind + 1 : 0;
1182 if (valid & BIT(ind))
1183 return ind;
1184 }
1185 return ant;
1186}
1187
1188static const char * 1188static const char *
1189il4965_get_fh_string(int cmd) 1189il4965_get_fh_string(int cmd)
1190{ 1190{
@@ -1588,10 +1588,7 @@ il4965_tx_cmd_build_rate(struct il_priv *il, struct il_tx_cmd *tx_cmd,
1588 rate_flags |= RATE_MCS_CCK_MSK; 1588 rate_flags |= RATE_MCS_CCK_MSK;
1589 1589
1590 /* Set up antennas */ 1590 /* Set up antennas */
1591 il->mgmt_tx_ant = 1591 il4965_toggle_tx_ant(il, &il->mgmt_tx_ant, il->hw_params.valid_tx_ant);
1592 il4965_toggle_tx_ant(il, il->mgmt_tx_ant,
1593 il->hw_params.valid_tx_ant);
1594
1595 rate_flags |= il4965_ant_idx_to_flags(il->mgmt_tx_ant); 1592 rate_flags |= il4965_ant_idx_to_flags(il->mgmt_tx_ant);
1596 1593
1597 /* Set the rate in the TX cmd */ 1594 /* Set the rate in the TX cmd */
@@ -3540,9 +3537,7 @@ il4965_hw_get_beacon_cmd(struct il_priv *il, struct il_frame *frame)
3540 3537
3541 /* Set up packet rate and flags */ 3538 /* Set up packet rate and flags */
3542 rate = il_get_lowest_plcp(il, il->beacon_ctx); 3539 rate = il_get_lowest_plcp(il, il->beacon_ctx);
3543 il->mgmt_tx_ant = 3540 il4965_toggle_tx_ant(il, &il->mgmt_tx_ant, il->hw_params.valid_tx_ant);
3544 il4965_toggle_tx_ant(il, il->mgmt_tx_ant,
3545 il->hw_params.valid_tx_ant);
3546 rate_flags = il4965_ant_idx_to_flags(il->mgmt_tx_ant); 3541 rate_flags = il4965_ant_idx_to_flags(il->mgmt_tx_ant);
3547 if ((rate >= IL_FIRST_CCK_RATE) && (rate <= IL_LAST_CCK_RATE)) 3542 if ((rate >= IL_FIRST_CCK_RATE) && (rate <= IL_LAST_CCK_RATE))
3548 rate_flags |= RATE_MCS_CCK_MSK; 3543 rate_flags |= RATE_MCS_CCK_MSK;
diff --git a/drivers/net/wireless/iwlegacy/4965.h b/drivers/net/wireless/iwlegacy/4965.h
index 74472314bc37..ca254aa4fd35 100644
--- a/drivers/net/wireless/iwlegacy/4965.h
+++ b/drivers/net/wireless/iwlegacy/4965.h
@@ -107,8 +107,6 @@ void il4965_set_wr_ptrs(struct il_priv *il, int txq_id, u32 idx);
107void il4965_tx_queue_set_status(struct il_priv *il, struct il_tx_queue *txq, 107void il4965_tx_queue_set_status(struct il_priv *il, struct il_tx_queue *txq,
108 int tx_fifo_id, int scd_retry); 108 int tx_fifo_id, int scd_retry);
109 109
110u8 il4965_toggle_tx_ant(struct il_priv *il, u8 ant_idx, u8 valid);
111
112/* rx */ 110/* rx */
113void il4965_hdl_missed_beacon(struct il_priv *il, struct il_rx_buf *rxb); 111void il4965_hdl_missed_beacon(struct il_priv *il, struct il_rx_buf *rxb);
114bool il4965_good_plcp_health(struct il_priv *il, struct il_rx_pkt *pkt); 112bool il4965_good_plcp_health(struct il_priv *il, struct il_rx_pkt *pkt);