Lines Matching +full:rate +full:- +full:b

2  * Copyright (c) 2004-2008 Reyk Floeter <reyk@openbsd.org>
3 * Copyright (c) 2006-2008 Nick Kossifidis <mickflemm@gmail.com>
4 * Copyright (c) 2007-2008 Matthew W. S. Bell <mentor@madwifi.org>
5 * Copyright (c) 2007-2008 Luis Rodriguez <mcgrof@winlab.rutgers.edu>
6 * Copyright (c) 2007-2008 Pavel Roskin <proski@gnu.org>
7 * Copyright (c) 2007-2008 Jiri Slaby <jirislaby@gmail.com>
40 * - Buffering of RX and TX frames (after QCU/DCUs)
42 * - Encrypting and decrypting (using the built-in engine)
44 * - Generating ACKs, RTS/CTS frames
46 * - Maintaining TSF
48 * - FCS
50 * - Updating beacon data (with TSF etc)
52 * - Generating virtual CCA
54 * - RX/Multicast filtering
56 * - BSSID filtering
58 * - Various statistics
60 * -Different operating modes: AP, STA, IBSS
71 * based on current tx rate instead of the base rate.
75 * rate -> duration table. This mapping is hw-based so
79 * ah->ah_ack_bitrate_high to true else base rate is
83 /* Tx -> ACK */
84 /* 1Mb -> 1Mb */ { 0,
85 /* 2MB -> 2Mb */ 1,
86 /* 5.5Mb -> 2Mb */ 1,
87 /* 11Mb -> 2Mb */ 1,
88 /* 6Mb -> 6Mb */ 4,
89 /* 9Mb -> 6Mb */ 4,
90 /* 12Mb -> 12Mb */ 6,
91 /* 18Mb -> 12Mb */ 6,
92 /* 24Mb -> 24Mb */ 8,
93 /* 36Mb -> 24Mb */ 8,
94 /* 48Mb -> 24Mb */ 8,
95 /* 54Mb -> 24Mb */ 8 };
102 * ath5k_hw_get_frame_duration() - Get tx time of a frame
106 * @rate: The @struct ieee80211_rate
109 * Calculate tx duration of a frame given it's rate and length
115 int len, struct ieee80211_rate *rate, bool shortpre) in ath5k_hw_get_frame_duration() argument
122 if (!ah->ah_bwmode) { in ath5k_hw_get_frame_duration()
123 __le16 raw_dur = ieee80211_generic_frame_duration(ah->hw, in ath5k_hw_get_frame_duration()
124 NULL, band, len, rate); in ath5k_hw_get_frame_duration()
129 dur -= 96; in ath5k_hw_get_frame_duration()
134 bitrate = rate->bitrate; in ath5k_hw_get_frame_duration()
139 switch (ah->ah_bwmode) { in ath5k_hw_get_frame_duration()
162 /* Bit rate is in 100Kbits */ in ath5k_hw_get_frame_duration()
172 * ath5k_hw_get_default_slottime() - Get the default slot time for current mode
178 struct ieee80211_channel *channel = ah->ah_current_channel; in ath5k_hw_get_default_slottime()
181 switch (ah->ah_bwmode) { in ath5k_hw_get_default_slottime()
194 if ((channel->hw_value == AR5K_MODE_11B) && !ah->ah_short_slot) in ath5k_hw_get_default_slottime()
203 * ath5k_hw_get_default_sifs() - Get the default SIFS for current mode
209 struct ieee80211_channel *channel = ah->ah_current_channel; in ath5k_hw_get_default_sifs()
212 switch (ah->ah_bwmode) { in ath5k_hw_get_default_sifs()
225 if (channel->band == NL80211_BAND_5GHZ) in ath5k_hw_get_default_sifs()
234 * ath5k_hw_update_mib_counters() - Update MIB counters (mac layer statistics)
246 struct ath5k_statistics *stats = &ah->stats; in ath5k_hw_update_mib_counters()
248 /* Read-And-Clear */ in ath5k_hw_update_mib_counters()
249 stats->ack_fail += ath5k_hw_reg_read(ah, AR5K_ACK_FAIL); in ath5k_hw_update_mib_counters()
250 stats->rts_fail += ath5k_hw_reg_read(ah, AR5K_RTS_FAIL); in ath5k_hw_update_mib_counters()
251 stats->rts_ok += ath5k_hw_reg_read(ah, AR5K_RTS_OK); in ath5k_hw_update_mib_counters()
252 stats->fcs_error += ath5k_hw_reg_read(ah, AR5K_FCS_FAIL); in ath5k_hw_update_mib_counters()
253 stats->beacons += ath5k_hw_reg_read(ah, AR5K_BEACON_CNT); in ath5k_hw_update_mib_counters()
262 * ath5k_hw_write_rate_duration() - Fill rate code to duration table
265 * Write the rate code to duration table upon hw reset. This is a helper for
267 * the hardware, based on current mode, for each rate. The rates which are
268 * capable of short preamble (802.11b rates 2Mbps, 5.5Mbps, and 11Mbps) have
269 * different rate code so we write their value twice (one for long preamble
280 struct ieee80211_rate *rate; in ath5k_hw_write_rate_duration() local
285 /* Write rate duration table */ in ath5k_hw_write_rate_duration()
286 for (i = 0; i < ah->sbands[band].n_bitrates; i++) { in ath5k_hw_write_rate_duration()
290 if (ah->ah_ack_bitrate_high) in ath5k_hw_write_rate_duration()
291 rate = &ah->sbands[band].bitrates[ack_rates_high[i]]; in ath5k_hw_write_rate_duration()
292 /* CCK -> 1Mb */ in ath5k_hw_write_rate_duration()
294 rate = &ah->sbands[band].bitrates[0]; in ath5k_hw_write_rate_duration()
295 /* OFDM -> 6Mb */ in ath5k_hw_write_rate_duration()
297 rate = &ah->sbands[band].bitrates[4]; in ath5k_hw_write_rate_duration()
300 reg = AR5K_RATE_DUR(rate->hw_value); in ath5k_hw_write_rate_duration()
304 * its 14 bytes. Note we use the control rate and not the in ath5k_hw_write_rate_duration()
305 * actual rate for this rate. See mac80211 tx.c in ath5k_hw_write_rate_duration()
307 * what rate we should choose to TX ACKs. */ in ath5k_hw_write_rate_duration()
309 rate, false); in ath5k_hw_write_rate_duration()
313 if (!(rate->flags & IEEE80211_RATE_SHORT_PREAMBLE)) in ath5k_hw_write_rate_duration()
316 tx_time = ath5k_hw_get_frame_duration(ah, band, 10, rate, true); in ath5k_hw_write_rate_duration()
323 * ath5k_hw_set_ack_timeout() - Set ACK timeout on PCU
332 return -EINVAL; in ath5k_hw_set_ack_timeout()
341 * ath5k_hw_set_cts_timeout() - Set CTS timeout on PCU
350 return -EINVAL; in ath5k_hw_set_cts_timeout()
364 * ath5k_hw_set_lladdr() - Set station id
378 memcpy(common->macaddr, mac, ETH_ALEN); in ath5k_hw_set_lladdr()
392 * ath5k_hw_set_bssid() - Set current BSSID on hw
407 if (ah->ah_version == AR5K_AR5212) in ath5k_hw_set_bssid()
414 get_unaligned_le32(common->curbssid), in ath5k_hw_set_bssid()
417 get_unaligned_le16(common->curbssid + 4) | in ath5k_hw_set_bssid()
418 ((common->curaid & 0x3fff) << AR5K_BSS_ID1_AID_S), in ath5k_hw_set_bssid()
421 if (common->curaid == 0) { in ath5k_hw_set_bssid()
433 * ath5k_hw_set_bssid_mask() - Filter out bssids we listen
454 memcpy(common->bssidmask, mask, ETH_ALEN); in ath5k_hw_set_bssid_mask()
455 if (ah->ah_version == AR5K_AR5212) in ath5k_hw_set_bssid_mask()
460 * ath5k_hw_set_mcast_filter() - Set multicast filter
473 * ath5k_hw_get_rx_filter() - Get current rx filter
490 if (ah->ah_version == AR5K_AR5212) { in ath5k_hw_get_rx_filter()
503 * ath5k_hw_set_rx_filter() - Set rx filter
517 if (ah->ah_version == AR5K_AR5212) { in ath5k_hw_set_rx_filter()
527 if (ah->ah_version == AR5K_AR5210 && in ath5k_hw_set_rx_filter()
543 if (ah->ah_version == AR5K_AR5212) in ath5k_hw_set_rx_filter()
556 * ath5k_hw_get_tsf64() - Get the full 64bit TSF
568 /* This code is time critical - we don't want to be interrupted here */ in ath5k_hw_get_tsf64()
602 * ath5k_hw_set_tsf64() - Set a new 64bit TSF
616 * ath5k_hw_reset_tsf() - Force a TSF reset
639 * ath5k_hw_init_beacon_timers() - Initialize beacon timers
655 switch (ah->opmode) { in ath5k_hw_init_beacon_timers()
662 if (ah->ah_version == AR5K_AR5210) { in ath5k_hw_init_beacon_timers()
676 /* On non-STA modes timer1 is used as next DMA in ath5k_hw_init_beacon_timers()
679 timer1 = (next_beacon - AR5K_TUNE_DMA_BEACON_RESP) << 3; in ath5k_hw_init_beacon_timers()
680 timer2 = (next_beacon - AR5K_TUNE_SW_BEACON_RESP) << 3; in ath5k_hw_init_beacon_timers()
693 if (ah->opmode == NL80211_IFTYPE_AP || in ath5k_hw_init_beacon_timers()
694 ah->opmode == NL80211_IFTYPE_MESH_POINT) in ath5k_hw_init_beacon_timers()
711 * performing a clear-on-write operation on PISR in ath5k_hw_init_beacon_timers()
715 if (ah->ah_version == AR5K_AR5210) in ath5k_hw_init_beacon_timers()
721 * based on vif->bss_conf params, until then in ath5k_hw_init_beacon_timers()
728 * ath5k_check_timer_win() - Check if timer B is timer A + window
729 * @a: timer a (before b)
730 * @b: timer b (after a)
731 * @window: difference between a and b
734 * This helper function checks if timer B is timer A + window and covers
735 * cases where timer A or B might have already been updated or wrapped
741 ath5k_check_timer_win(int a, int b, int window, int intval) in ath5k_check_timer_win() argument
744 * 1.) usually B should be A + window in ath5k_check_timer_win()
745 * 2.) A already updated, B not updated yet in ath5k_check_timer_win()
747 * 4.) B has wrapped around in ath5k_check_timer_win()
749 if ((b - a == window) || /* 1.) */ in ath5k_check_timer_win()
750 (a - b == intval - window) || /* 2.) */ in ath5k_check_timer_win()
751 ((a | 0x10000) - b == intval - window) || /* 3.) */ in ath5k_check_timer_win()
752 ((b | 0x10000) - a == window)) /* 4.) */ in ath5k_check_timer_win()
758 * ath5k_hw_check_beacon_timers() - Check if the beacon timers are correct
765 * HW timer registers (TIMER0 - TIMER3), which are closely related to the
772 * at any time - this is something we can't avoid. If the TSF jumps to a
783 * updated again. But - because the beacon interval is usually not an exact
817 * ath5k_hw_set_coverage_class() - Set IEEE 802.11 coverage class
826 /* As defined by IEEE 802.11-2007 17.3.8.6 */ in ath5k_hw_set_coverage_class()
835 ah->ah_coverage_class = coverage_class; in ath5k_hw_set_coverage_class()
843 * ath5k_hw_start_rx_pcu() - Start RX engine
858 * ath5k_hw_stop_rx_pcu() - Stop RX engine
870 * ath5k_hw_set_opmode() - Set PCU operating mode
888 | (ah->ah_version == AR5K_AR5210 ? in ath5k_hw_set_opmode()
897 if (ah->ah_version == AR5K_AR5210) in ath5k_hw_set_opmode()
907 if (ah->ah_version == AR5K_AR5210) in ath5k_hw_set_opmode()
915 | (ah->ah_version == AR5K_AR5210 ? in ath5k_hw_set_opmode()
920 | (ah->ah_version == AR5K_AR5210 ? in ath5k_hw_set_opmode()
925 return -EINVAL; in ath5k_hw_set_opmode()
931 low_id = get_unaligned_le32(common->macaddr); in ath5k_hw_set_opmode()
932 high_id = get_unaligned_le16(common->macaddr + 4); in ath5k_hw_set_opmode()
939 if (ah->ah_version == AR5K_AR5210) in ath5k_hw_set_opmode()
946 * ath5k_hw_pcu_init() - Initialize PCU
962 /* Write rate duration table only on AR5212 and if in ath5k_hw_pcu_init()
966 if (ah->ah_version == AR5K_AR5212 && in ath5k_hw_pcu_init()
967 ah->nvifs) in ath5k_hw_pcu_init()
984 if (ah->ah_mac_srev >= AR5K_SREV_AR2413) { in ath5k_hw_pcu_init()
990 if (ah->ah_version == AR5K_AR5212) { in ath5k_hw_pcu_init()
999 if (ah->ah_coverage_class > 0) in ath5k_hw_pcu_init()
1000 ath5k_hw_set_coverage_class(ah, ah->ah_coverage_class); in ath5k_hw_pcu_init()
1003 if (ah->ah_version == AR5K_AR5212) { in ath5k_hw_pcu_init()
1005 if (ah->ah_ack_bitrate_high) in ath5k_hw_pcu_init()