51 b43_tx_legacy_rate_phy_ctl_ent(
u8 bitrate)
56 for (i = 0; i <
ARRAY_SIZE(b43_tx_legacy_rate_phy_ctl); i++) {
57 e = &(b43_tx_legacy_rate_phy_ctl[
i]);
67 static int b43_plcp_get_bitrate_idx_cck(
struct b43_plcp_hdr6 *plcp)
69 switch (plcp->raw[0]) {
83 static int b43_plcp_get_bitrate_idx_ofdm(
struct b43_plcp_hdr6 *plcp,
bool aphy)
85 int base = aphy ? 0 : 4;
87 switch (plcp->raw[0] & 0xF) {
149 const u16 octets,
const u8 bitrate)
153 if (b43_is_ofdm_rate(bitrate)) {
164 if ((octets * 16 % bitrate) > 0) {
167 && ((octets * 8 % 11) < 4)) {
196 e = b43_tx_legacy_rate_phy_ctl_ent(bitrate);
207 static u8 b43_calc_fallback_rate(
u8 bitrate)
246 const unsigned char *fragment_data = skb_frag->
data;
247 unsigned int fragment_len = skb_frag->
len;
252 int use_encryption = !!info->
control.hw_key;
256 int rate_ofdm, rate_fb_ofdm;
257 unsigned int plcp_fragment_len;
267 memset(txhdr, 0,
sizeof(*txhdr));
269 txrate = ieee80211_get_tx_rate(dev->
wl->hw, info);
271 rate_ofdm = b43_is_ofdm_rate(rate);
272 fbrate = ieee80211_get_alt_retry_rate(dev->
wl->hw, info, 0) ? : txrate;
274 rate_fb_ofdm = b43_is_ofdm_rate(rate_fb);
284 if ((rate_fb == rate) ||
294 fragment_len, fbrate);
297 plcp_fragment_len = fragment_len +
FCS_LEN;
298 if (use_encryption) {
299 u8 key_idx = info->
control.hw_key->hw_key_idx;
305 key = &(dev->
key[key_idx]);
317 plcp_fragment_len += info->
control.hw_key->icv_len;
319 key_idx = b43_kidx_to_fw(dev, key_idx);
331 ieee80211_get_tkip_p1k(info->
control.hw_key, skb_frag, phase1key);
333 for (i = 0; i < 5; i++) {
334 txhdr->
iv[i * 2 + 0] = phase1key[
i];
335 txhdr->
iv[i * 2 + 1] = phase1key[
i] >> 8;
338 memcpy(txhdr->
iv + 10, ((
u8 *) wlhdr) + wlhdr_len, 3);
340 iv_len =
min((
size_t) info->
control.hw_key->iv_len,
342 memcpy(txhdr->
iv, ((
u8 *) wlhdr) + wlhdr_len, iv_len);
345 switch (dev->
fw.hdr_format) {
348 plcp_fragment_len, rate);
352 plcp_fragment_len, rate);
356 plcp_fragment_len, rate);
360 plcp_fragment_len, rate_fb);
419 (rates[0].count <= dev->wl->hw->conf.long_frame_max_tx_count)) {
420 rates[0].
count = dev->
wl->hw->conf.long_frame_max_tx_count;
423 rates[0].
count = dev->
wl->hw->conf.short_frame_max_tx_count;
427 if ((rates[0].
flags & IEEE80211_TX_RC_USE_RTS_CTS) ||
431 int rts_rate, rts_rate_fb;
432 int rts_rate_ofdm, rts_rate_fb_ofdm;
436 rts_cts_rate = ieee80211_get_rts_cts_rate(dev->
wl->hw, info);
439 rts_rate_ofdm = b43_is_ofdm_rate(rts_rate);
440 rts_rate_fb = b43_calc_fallback_rate(rts_rate);
441 rts_rate_fb_ofdm = b43_is_ofdm_rate(rts_rate_fb);
443 if (rates[0].
flags & IEEE80211_TX_RC_USE_CTS_PROTECT) {
446 switch (dev->
fw.hdr_format) {
461 fragment_data, fragment_len,
468 switch (dev->
fw.hdr_format) {
483 fragment_data, fragment_len,
491 switch (dev->
fw.hdr_format) {
508 switch (dev->
fw.hdr_format) {
533 if (rts_rate_fb_ofdm)
538 if (rates[0].
flags & IEEE80211_TX_RC_USE_RTS_CTS &&
541 b43_generate_tx_phy_ctl1(dev, rts_rate));
543 b43_generate_tx_phy_ctl1(dev, rts_rate_fb));
548 switch (dev->
fw.hdr_format) {
564 cpu_to_le16(b43_generate_tx_phy_ctl1(dev, rate_fb));
575 static s8 b43_rssi_postprocess(
struct b43_wldev *dev,
577 int adjust_2053,
int adjust_2050)
596 if (dev->
dev->bus_sprom->
639 static s8 b43_rssinoise_postprocess(
struct b43_wldev *dev,
u8 in_rssi)
648 ret = b43_rssi_postprocess(dev, in_rssi, 0, 1, 1);
657 struct b43_plcp_hdr6 *plcp;
661 u16 phystat0, phystat3;
668 memset(&status, 0,
sizeof(status));
673 switch (dev->
fw.hdr_format) {
689 dev->
wl->ieee_stats.dot11FCSErrorCount++;
705 if (
unlikely(skb->
len < (
sizeof(
struct b43_plcp_hdr6) + padding))) {
706 b43dbg(dev->
wl,
"RX: Packet size underrun (1)\n");
709 plcp = (
struct b43_plcp_hdr6 *)(skb->
data + padding);
710 skb_pull(skb,
sizeof(
struct b43_plcp_hdr6) + padding);
713 b43dbg(dev->
wl,
"RX: Packet size underrun (2)\n");
728 keyidx = b43_kidx_to_raw(dev, keyidx);
735 "RX: Packet size underrun (3)\n");
743 switch (chanstat & B43_RX_CHAN_PHYTYPE) {
761 status.
signal = b43_rssi_postprocess(dev, rxhdr->
jssi,
769 rate_idx = b43_plcp_get_bitrate_idx_ofdm(plcp,
772 rate_idx = b43_plcp_get_bitrate_idx_cck(plcp);
790 if (ieee80211_is_beacon(fctl) || dev->
wl->radiotap_enabled) {
794 low_mactime_now = status.
mactime;
797 if (low_mactime_now <= mactime)
803 switch (chanstat & B43_RX_CHAN_PHYTYPE) {
809 status.
freq = b43_channel_to_freq_5ghz(chanid);
815 status.
freq = chanid + 2400;
824 status.
freq = b43_freq_to_channel_5ghz(chanid);
827 status.
freq = b43_freq_to_channel_2ghz(chanid);
835 memcpy(IEEE80211_SKB_RXCB(skb), &status,
sizeof(status));
836 ieee80211_rx_ni(dev->
wl->hw, skb);
856 dev->
wl->ieee_stats.dot11ACKFailureCount++;
859 dev->
wl->ieee_stats.dot11RTSFailureCount++;
861 dev->
wl->ieee_stats.dot11RTSSuccessCount++;
864 if (b43_using_pio_transfers(dev))
879 bool frame_success =
true;
885 retry_limit = report->
status.rates[0].count;
886 ieee80211_tx_info_clear_status(report);
895 frame_success =
false;
900 report->
status.rates[0].count = 0;
901 }
else if (status->
rts_count > dev->
wl->hw->conf.short_frame_max_tx_count) {
909 report->
status.rates[0].count = 0;
913 report->
status.rates[0].count = retry_limit;
919 report->
status.rates[1].idx = -1;
923 return frame_success;
929 if (b43_using_pio_transfers(dev))
938 if (b43_using_pio_transfers(dev))