Lines Matching +full:magic +full:- +full:packet

1 // SPDX-License-Identifier: GPL-2.0-or-later
8 Copyright (C) 2005 Martin Langer <martin-langer@gmx.de>
29 switch (plcp->raw[0]) { in b43legacy_plcp_get_bitrate_idx_cck()
40 return -1; in b43legacy_plcp_get_bitrate_idx_cck()
49 switch (plcp->raw[0] & 0xF) { in b43legacy_plcp_get_bitrate_idx_ofdm()
68 return -1; in b43legacy_plcp_get_bitrate_idx_ofdm()
114 __le32 *data = &(plcp->data); in b43legacy_generate_plcp_hdr()
115 __u8 *raw = plcp->raw; in b43legacy_generate_plcp_hdr()
182 int use_encryption = !!info->control.hw_key; in generate_txhdr_fw3()
197 tx_rate = ieee80211_get_tx_rate(dev->wl->hw, info); in generate_txhdr_fw3()
199 rate = tx_rate->hw_value; in generate_txhdr_fw3()
201 rate_fb = ieee80211_get_alt_retry_rate(dev->wl->hw, info, 0) ? : tx_rate; in generate_txhdr_fw3()
202 rate_fb_ofdm = b43legacy_is_ofdm_rate(rate_fb->hw_value); in generate_txhdr_fw3()
204 txhdr->mac_frame_ctl = wlhdr->frame_control; in generate_txhdr_fw3()
205 memcpy(txhdr->tx_receiver, wlhdr->addr1, ETH_ALEN); in generate_txhdr_fw3()
208 if ((rate_fb->hw_value == rate) || in generate_txhdr_fw3()
209 (wlhdr->duration_id & cpu_to_le16(0x8000)) || in generate_txhdr_fw3()
210 (wlhdr->duration_id == cpu_to_le16(0))) { in generate_txhdr_fw3()
212 * dur_id field contains an AID, CFP magic or 0, in generate_txhdr_fw3()
214 txhdr->dur_fb = wlhdr->duration_id; in generate_txhdr_fw3()
216 txhdr->dur_fb = ieee80211_generic_frame_duration(dev->wl->hw, in generate_txhdr_fw3()
217 info->control.vif, in generate_txhdr_fw3()
218 info->band, in generate_txhdr_fw3()
225 u8 key_idx = info->control.hw_key->hw_key_idx; in generate_txhdr_fw3()
230 B43legacy_WARN_ON(key_idx >= dev->max_nr_keys); in generate_txhdr_fw3()
231 key = &(dev->key[key_idx]); in generate_txhdr_fw3()
233 if (key->enabled) { in generate_txhdr_fw3()
235 plcp_fragment_len += info->control.hw_key->icv_len; in generate_txhdr_fw3()
240 mac_ctl |= (key->algorithm << in generate_txhdr_fw3()
243 wlhdr_len = ieee80211_hdrlen(wlhdr->frame_control); in generate_txhdr_fw3()
244 iv_len = min_t(size_t, info->control.hw_key->iv_len, in generate_txhdr_fw3()
245 ARRAY_SIZE(txhdr->iv)); in generate_txhdr_fw3()
246 memcpy(txhdr->iv, ((u8 *)wlhdr) + wlhdr_len, iv_len); in generate_txhdr_fw3()
251 * Drop this packet completely. Do not transmit it in generate_txhdr_fw3()
253 return -ENOKEY; in generate_txhdr_fw3()
257 (&txhdr->plcp), plcp_fragment_len, in generate_txhdr_fw3()
259 b43legacy_generate_plcp_hdr(&txhdr->plcp_fb, plcp_fragment_len, in generate_txhdr_fw3()
260 rate_fb->hw_value); in generate_txhdr_fw3()
265 if (info->control.rates[0].flags & IEEE80211_TX_RC_USE_SHORT_PREAMBLE) in generate_txhdr_fw3()
270 rates = info->control.rates; in generate_txhdr_fw3()
271 if (!(info->flags & IEEE80211_TX_CTL_NO_ACK)) in generate_txhdr_fw3()
273 if (info->flags & IEEE80211_TX_CTL_ASSIGN_SEQ) in generate_txhdr_fw3()
275 if (info->flags & IEEE80211_TX_CTL_FIRST_FRAGMENT) in generate_txhdr_fw3()
285 (rates[0].count <= dev->wl->hw->conf.long_frame_max_tx_count)) { in generate_txhdr_fw3()
286 rates[0].count = dev->wl->hw->conf.long_frame_max_tx_count; in generate_txhdr_fw3()
289 rates[0].count = dev->wl->hw->conf.short_frame_max_tx_count; in generate_txhdr_fw3()
292 /* Generate the RTS or CTS-to-self frame */ in generate_txhdr_fw3()
301 rts_rate = ieee80211_get_rts_cts_rate(dev->wl->hw, info)->hw_value; in generate_txhdr_fw3()
308 ieee80211_ctstoself_get(dev->wl->hw, in generate_txhdr_fw3()
309 info->control.vif, in generate_txhdr_fw3()
313 (txhdr->rts_frame)); in generate_txhdr_fw3()
317 ieee80211_rts_get(dev->wl->hw, in generate_txhdr_fw3()
318 info->control.vif, in generate_txhdr_fw3()
321 (txhdr->rts_frame)); in generate_txhdr_fw3()
327 (&txhdr->rts_plcp), in generate_txhdr_fw3()
329 b43legacy_generate_plcp_hdr(&txhdr->rts_plcp_fb, in generate_txhdr_fw3()
331 hdr = (struct ieee80211_hdr *)(&txhdr->rts_frame); in generate_txhdr_fw3()
332 txhdr->rts_dur_fb = hdr->duration_id; in generate_txhdr_fw3()
335 /* Magic cookie */ in generate_txhdr_fw3()
336 txhdr->cookie = cpu_to_le16(cookie); in generate_txhdr_fw3()
339 txhdr->mac_ctl = cpu_to_le32(mac_ctl); in generate_txhdr_fw3()
340 txhdr->phy_ctl = cpu_to_le16(phy_ctl); in generate_txhdr_fw3()
361 struct b43legacy_phy *phy = &dev->phy; in b43legacy_rssi_postprocess()
364 switch (phy->radio_ver) { in b43legacy_rssi_postprocess()
369 tmp -= 256; in b43legacy_rssi_postprocess()
375 tmp -= 3; in b43legacy_rssi_postprocess()
377 if (dev->dev->bus->sprom.boardflags_lo in b43legacy_rssi_postprocess()
381 tmp = phy->nrssi_lt[in_rssi]; in b43legacy_rssi_postprocess()
382 tmp = 31 - tmp; in b43legacy_rssi_postprocess()
383 tmp *= -131; in b43legacy_rssi_postprocess()
385 tmp -= 57; in b43legacy_rssi_postprocess()
388 tmp = 31 - tmp; in b43legacy_rssi_postprocess()
389 tmp *= -149; in b43legacy_rssi_postprocess()
391 tmp -= 68; in b43legacy_rssi_postprocess()
393 if (phy->type == B43legacy_PHYTYPE_G && in b43legacy_rssi_postprocess()
400 tmp = in_rssi - 256; in b43legacy_rssi_postprocess()
406 tmp -= 11; in b43legacy_rssi_postprocess()
410 tmp -= 109; in b43legacy_rssi_postprocess()
412 tmp -= 83; in b43legacy_rssi_postprocess()
439 phystat0 = le16_to_cpu(rxhdr->phy_status0); in b43legacy_rx()
440 phystat3 = le16_to_cpu(rxhdr->phy_status3); in b43legacy_rx()
441 jssi = rxhdr->jssi; in b43legacy_rx()
442 macstat = le16_to_cpu(rxhdr->mac_status); in b43legacy_rx()
443 mactime = le16_to_cpu(rxhdr->mac_time); in b43legacy_rx()
444 chanstat = le16_to_cpu(rxhdr->channel); in b43legacy_rx()
447 dev->wl->ieee_stats.dot11FCSErrorCount++; in b43legacy_rx()
451 if (unlikely(skb->len < (sizeof(struct b43legacy_plcp_hdr6) + in b43legacy_rx()
453 b43legacydbg(dev->wl, "RX: Packet size underrun (1)\n"); in b43legacy_rx()
456 plcp = (struct b43legacy_plcp_hdr6 *)(skb->data + padding); in b43legacy_rx()
459 if (unlikely(skb->len < (2+2+6/*minimum hdr*/ + FCS_LEN))) { in b43legacy_rx()
460 b43legacydbg(dev->wl, "RX: Packet size underrun (2)\n"); in b43legacy_rx()
463 wlhdr = (struct ieee80211_hdr *)(skb->data); in b43legacy_rx()
464 fctl = wlhdr->frame_control; in b43legacy_rx()
479 B43legacy_WARN_ON(keyidx >= dev->max_nr_keys); in b43legacy_rx()
481 if (dev->key[keyidx].algorithm != B43legacy_SEC_ALGO_NONE) { in b43legacy_rx()
485 wlhdr->frame_control = fctl; in b43legacy_rx()
488 if (unlikely(skb->len < (wlhdr_len + 3))) { in b43legacy_rx()
489 b43legacydbg(dev->wl, "RX: Packet size" in b43legacy_rx()
493 if (skb->data[wlhdr_len + 3] & (1 << 5)) { in b43legacy_rx()
494 /* The Ext-IV Bit is set in the "KeyID" in b43legacy_rx()
503 if (unlikely(skb->len < (wlhdr_len + iv_len + in b43legacy_rx()
505 b43legacydbg(dev->wl, "RX: Packet size" in b43legacy_rx()
510 memmove(skb->data + iv_len, skb->data, wlhdr_len); in b43legacy_rx()
513 skb_trim(skb, skb->len - icv_len); in b43legacy_rx()
532 * 64-bit timestamp. Monitor interfaces need it for diagnostic in b43legacy_rx()
534 * This code assumes we get to process the packet within 16 bits in b43legacy_rx()
538 if (ieee80211_is_beacon(fctl) || dev->wl->radiotap_enabled) { in b43legacy_rx()
546 status.mactime -= 0x10000; in b43legacy_rx()
559 b43legacywarn(dev->wl, "Unexpected value for chanstat (0x%X)\n", in b43legacy_rx()
565 ieee80211_rx_irqsafe(dev->wl->hw, skb); in b43legacy_rx()
569 b43legacydbg(dev->wl, "RX: Packet dropped\n"); in b43legacy_rx()
578 if (status->intermediate) in b43legacy_handle_txstatus()
580 if (status->for_ampdu) in b43legacy_handle_txstatus()
582 if (!status->acked) in b43legacy_handle_txstatus()
583 dev->wl->ieee_stats.dot11ACKFailureCount++; in b43legacy_handle_txstatus()
584 if (status->rts_count) { in b43legacy_handle_txstatus()
585 if (status->rts_count == 0xF) /* FIXME */ in b43legacy_handle_txstatus()
586 dev->wl->ieee_stats.dot11RTSFailureCount++; in b43legacy_handle_txstatus()
588 dev->wl->ieee_stats.dot11RTSSuccessCount++; in b43legacy_handle_txstatus()
604 status.cookie = le16_to_cpu(hw->cookie); in b43legacy_handle_hwtxstatus()
605 status.seq = le16_to_cpu(hw->seq); in b43legacy_handle_hwtxstatus()
606 status.phy_stat = hw->phy_stat; in b43legacy_handle_hwtxstatus()
607 tmp = hw->count; in b43legacy_handle_hwtxstatus()
610 tmp = hw->flags << 1; in b43legacy_handle_hwtxstatus()
646 /* FIXME kill magic */ in b43legacy_qos_init()