Lines Matching +full:bd +full:- +full:address

22 static inline int get_rssi0(struct wcn36xx_rx_bd *bd)  in get_rssi0()  argument
24 return 100 - ((bd->phy_stat0 >> 24) & 0xff); in get_rssi0()
27 static inline int get_snr(struct wcn36xx_rx_bd *bd) in get_snr() argument
29 return ((bd->phy_stat1 >> 24) & 0xff); in get_snr()
40 /* Buffer descriptor rx_ch field is limited to 5-bit (4+1), a mapping is used
134 /* 11ac 20 MHz 800ns GI MCS 0-8 */
156 /* 11ac 20 MHz 400ns SGI MCS 6-8 */
166 /* 11ac 40 MHz 800ns GI MCS 0-9 */
187 /* 11ac 40 MHz 400ns SGI MCS 5-7 */
195 /* 11ac 40 MHz 400ns SGI MCS 5-7 */
202 /* 11ac 80 MHz 800ns GI MCS 0-7 */
215 /* 11ac 80 MHz 800 ns GI MCS 8-9 */
228 /* 11ac 80 MHz 400 ns SGI MCS 6-7 */
235 /* 11ac 80 MHz 400ns SGI MCS 8-9 */
249 total_len += skb->len; in wcn36xx_unchain_msdu()
251 space = total_len - skb_tailroom(first); in wcn36xx_unchain_msdu()
259 skb_copy_from_linear_data(skb, skb_put(first, skb->len), in wcn36xx_unchain_msdu()
260 skb->len); in wcn36xx_unchain_msdu()
286 idx = wcn->hw->wiphy->bands[NL80211_BAND_2GHZ]->n_channels; in wcn36xx_update_survey()
288 sband = wcn->hw->wiphy->bands[band]; in wcn36xx_update_survey()
289 channel = sband->channels; in wcn36xx_update_survey()
291 for (i = 0; i < sband->n_channels; i++, channel++) { in wcn36xx_update_survey()
292 if (channel->center_freq == freq) { in wcn36xx_update_survey()
298 spin_lock(&wcn->survey_lock); in wcn36xx_update_survey()
299 wcn->chan_survey[idx].rssi = rssi; in wcn36xx_update_survey()
300 wcn->chan_survey[idx].snr = snr; in wcn36xx_update_survey()
301 spin_unlock(&wcn->survey_lock); in wcn36xx_update_survey()
311 struct wcn36xx_rx_bd *bd; in wcn36xx_rx_skb() local
320 bd = (struct wcn36xx_rx_bd *)skb->data; in wcn36xx_rx_skb()
321 buff_to_be(bd, sizeof(*bd)/sizeof(u32)); in wcn36xx_rx_skb()
323 "BD <<< ", (char *)bd, in wcn36xx_rx_skb()
326 if (bd->pdu.mpdu_data_off <= bd->pdu.mpdu_header_off || in wcn36xx_rx_skb()
327 bd->pdu.mpdu_len < bd->pdu.mpdu_header_len) in wcn36xx_rx_skb()
330 if (bd->asf && !bd->esf) { /* chained A-MSDU chunks */ in wcn36xx_rx_skb()
332 if (bd->pdu.mpdu_data_off + bd->pdu.mpdu_len > WCN36XX_PKT_SIZE) in wcn36xx_rx_skb()
335 skb_put(skb, bd->pdu.mpdu_data_off + bd->pdu.mpdu_len); in wcn36xx_rx_skb()
336 skb_pull(skb, bd->pdu.mpdu_data_off); in wcn36xx_rx_skb()
338 /* Only set status for first chained BD (with mac header) */ in wcn36xx_rx_skb()
342 if (bd->pdu.mpdu_header_off < sizeof(*bd) || in wcn36xx_rx_skb()
343 bd->pdu.mpdu_header_off + bd->pdu.mpdu_len > WCN36XX_PKT_SIZE) in wcn36xx_rx_skb()
346 skb_put(skb, bd->pdu.mpdu_header_off + bd->pdu.mpdu_len); in wcn36xx_rx_skb()
347 skb_pull(skb, bd->pdu.mpdu_header_off); in wcn36xx_rx_skb()
349 hdr = (struct ieee80211_hdr *) skb->data; in wcn36xx_rx_skb()
350 fc = __le16_to_cpu(hdr->frame_control); in wcn36xx_rx_skb()
351 sn = IEEE80211_SEQ_TO_SN(__le16_to_cpu(hdr->seq_ctrl)); in wcn36xx_rx_skb()
354 status.signal = -get_rssi0(bd); in wcn36xx_rx_skb()
364 if (bd->scan_learn) { in wcn36xx_rx_skb()
366 * band/channel from bd descriptor. in wcn36xx_rx_skb()
368 u8 hwch = (bd->reserved0 << 4) + bd->rx_ch; in wcn36xx_rx_skb()
370 if (bd->rf_band != 1 && hwch <= sizeof(ab_rx_ch_map) && hwch >= 1) { in wcn36xx_rx_skb()
372 status.freq = ieee80211_channel_to_frequency(ab_rx_ch_map[hwch - 1], in wcn36xx_rx_skb()
383 wcn36xx_update_survey(wcn, status.signal, get_snr(bd), in wcn36xx_rx_skb()
386 if (bd->rate_id < ARRAY_SIZE(wcn36xx_rate_table)) { in wcn36xx_rx_skb()
387 rate = &wcn36xx_rate_table[bd->rate_id]; in wcn36xx_rx_skb()
388 status.encoding = rate->encoding; in wcn36xx_rx_skb()
389 status.enc_flags = rate->encoding_flags; in wcn36xx_rx_skb()
390 status.bw = rate->bw; in wcn36xx_rx_skb()
391 status.rate_idx = rate->mcs_or_legacy_index; in wcn36xx_rx_skb()
398 status.rate_idx -= 4; in wcn36xx_rx_skb()
407 if (ieee80211_is_beacon(hdr->frame_control) || in wcn36xx_rx_skb()
408 ieee80211_is_probe_resp(hdr->frame_control)) in wcn36xx_rx_skb()
413 if (ieee80211_is_beacon(hdr->frame_control)) { in wcn36xx_rx_skb()
415 skb, skb->len, fc, sn); in wcn36xx_rx_skb()
417 (char *)skb->data, skb->len); in wcn36xx_rx_skb()
420 skb, skb->len, fc, sn); in wcn36xx_rx_skb()
422 (char *)skb->data, skb->len); in wcn36xx_rx_skb()
427 if (unlikely(bd->asf && !(bd->lsf && bd->esf))) { in wcn36xx_rx_skb()
428 if (bd->esf && !skb_queue_empty(&wcn->amsdu)) { in wcn36xx_rx_skb()
430 __skb_queue_purge_irq(&wcn->amsdu); in wcn36xx_rx_skb()
433 __skb_queue_tail(&wcn->amsdu, skb); in wcn36xx_rx_skb()
435 if (!bd->lsf) in wcn36xx_rx_skb()
438 skb = wcn36xx_unchain_msdu(&wcn->amsdu); in wcn36xx_rx_skb()
443 ieee80211_rx_irqsafe(wcn->hw, skb); in wcn36xx_rx_skb()
449 skb, bd->pdu.mpdu_len, bd->pdu.mpdu_header_off, in wcn36xx_rx_skb()
450 bd->pdu.mpdu_data_off, bd->asf, bd->esf, bd->lsf); in wcn36xx_rx_skb()
453 __skb_queue_purge_irq(&wcn->amsdu); in wcn36xx_rx_skb()
455 return -EINVAL; in wcn36xx_rx_skb()
458 static void wcn36xx_set_tx_pdu(struct wcn36xx_tx_bd *bd, in wcn36xx_set_tx_pdu() argument
463 bd->pdu.mpdu_header_len = mpdu_header_len; in wcn36xx_set_tx_pdu()
464 bd->pdu.mpdu_header_off = sizeof(*bd); in wcn36xx_set_tx_pdu()
465 bd->pdu.mpdu_data_off = bd->pdu.mpdu_header_len + in wcn36xx_set_tx_pdu()
466 bd->pdu.mpdu_header_off; in wcn36xx_set_tx_pdu()
467 bd->pdu.mpdu_len = len; in wcn36xx_set_tx_pdu()
468 bd->pdu.tid = tid; in wcn36xx_set_tx_pdu()
476 list_for_each_entry(vif_priv, &wcn->vif_list, list) { in get_vif_by_addr()
478 if (memcmp(vif->addr, addr, ETH_ALEN) == 0) in get_vif_by_addr()
489 struct ieee80211_hdr *hdr = (struct ieee80211_hdr *)skb->data; in wcn36xx_tx_start_ampdu()
493 if (!conf_is_ht(&wcn->hw->conf)) in wcn36xx_tx_start_ampdu()
498 if (WARN_ON(!ieee80211_is_data_qos(hdr->frame_control))) in wcn36xx_tx_start_ampdu()
507 spin_lock(&sta_priv->ampdu_lock); in wcn36xx_tx_start_ampdu()
508 if (sta_priv->ampdu_state[tid] != WCN36XX_AMPDU_NONE) in wcn36xx_tx_start_ampdu()
511 if (sta_priv->non_agg_frame_ct++ >= WCN36XX_AMPDU_START_THRESH) { in wcn36xx_tx_start_ampdu()
512 sta_priv->ampdu_state[tid] = WCN36XX_AMPDU_START; in wcn36xx_tx_start_ampdu()
513 sta_priv->non_agg_frame_ct = 0; in wcn36xx_tx_start_ampdu()
517 spin_unlock(&sta_priv->ampdu_lock); in wcn36xx_tx_start_ampdu()
520 static void wcn36xx_set_tx_data(struct wcn36xx_tx_bd *bd, in wcn36xx_set_tx_data() argument
527 struct ieee80211_hdr *hdr = (struct ieee80211_hdr *)skb->data; in wcn36xx_set_tx_data()
531 bool is_data_qos = ieee80211_is_data_qos(hdr->frame_control); in wcn36xx_set_tx_data()
534 bd->bd_rate = WCN36XX_BD_RATE_DATA; in wcn36xx_set_tx_data()
541 __vif_priv = sta_priv->vif; in wcn36xx_set_tx_data()
544 bd->dpu_sign = sta_priv->ucast_dpu_sign; in wcn36xx_set_tx_data()
545 if (vif->type == NL80211_IFTYPE_STATION) { in wcn36xx_set_tx_data()
546 bd->sta_index = sta_priv->bss_sta_index; in wcn36xx_set_tx_data()
547 bd->dpu_desc_idx = sta_priv->bss_dpu_desc_index; in wcn36xx_set_tx_data()
548 } else if (vif->type == NL80211_IFTYPE_AP || in wcn36xx_set_tx_data()
549 vif->type == NL80211_IFTYPE_ADHOC || in wcn36xx_set_tx_data()
550 vif->type == NL80211_IFTYPE_MESH_POINT) { in wcn36xx_set_tx_data()
551 bd->sta_index = sta_priv->sta_index; in wcn36xx_set_tx_data()
552 bd->dpu_desc_idx = sta_priv->dpu_desc_index; in wcn36xx_set_tx_data()
555 __vif_priv = get_vif_by_addr(wcn, hdr->addr2); in wcn36xx_set_tx_data()
556 bd->sta_index = __vif_priv->self_sta_index; in wcn36xx_set_tx_data()
557 bd->dpu_desc_idx = __vif_priv->self_dpu_desc_index; in wcn36xx_set_tx_data()
558 bd->dpu_sign = __vif_priv->self_ucast_dpu_sign; in wcn36xx_set_tx_data()
563 /* TID->QID is one-to-one mapping */ in wcn36xx_set_tx_data()
564 bd->queue_id = tid; in wcn36xx_set_tx_data()
565 bd->pdu.bd_ssn = WCN36XX_TXBD_SSN_FILL_DPU_QOS; in wcn36xx_set_tx_data()
567 bd->pdu.bd_ssn = WCN36XX_TXBD_SSN_FILL_DPU_NON_QOS; in wcn36xx_set_tx_data()
570 if (info->flags & IEEE80211_TX_INTFL_DONT_ENCRYPT || in wcn36xx_set_tx_data()
571 (sta_priv && !sta_priv->is_data_encrypted)) { in wcn36xx_set_tx_data()
572 bd->dpu_ne = 1; in wcn36xx_set_tx_data()
575 if (ieee80211_is_any_nullfunc(hdr->frame_control)) { in wcn36xx_set_tx_data()
577 bd->queue_id = WCN36XX_TX_U_WQ_ID; in wcn36xx_set_tx_data()
578 bd->bd_rate = WCN36XX_BD_RATE_CTRL; in wcn36xx_set_tx_data()
579 if (ieee80211_is_qos_nullfunc(hdr->frame_control)) in wcn36xx_set_tx_data()
580 bd->pdu.bd_ssn = WCN36XX_TXBD_SSN_FILL_HOST; in wcn36xx_set_tx_data()
584 bd->ub = 1; in wcn36xx_set_tx_data()
585 bd->ack_policy = 1; in wcn36xx_set_tx_data()
589 wcn36xx_set_tx_pdu(bd, in wcn36xx_set_tx_data()
593 skb->len, tid); in wcn36xx_set_tx_data()
599 static void wcn36xx_set_tx_mgmt(struct wcn36xx_tx_bd *bd, in wcn36xx_set_tx_mgmt() argument
605 struct ieee80211_hdr *hdr = (struct ieee80211_hdr *)skb->data; in wcn36xx_set_tx_mgmt()
607 get_vif_by_addr(wcn, hdr->addr2); in wcn36xx_set_tx_mgmt()
608 bd->sta_index = __vif_priv->self_sta_index; in wcn36xx_set_tx_mgmt()
609 bd->dpu_desc_idx = __vif_priv->self_dpu_desc_index; in wcn36xx_set_tx_mgmt()
610 bd->dpu_ne = 1; in wcn36xx_set_tx_mgmt()
613 if (ieee80211_is_mgmt(hdr->frame_control)) in wcn36xx_set_tx_mgmt()
614 bd->bd_rate = (WCN36XX_BAND(wcn) == NL80211_BAND_5GHZ) ? in wcn36xx_set_tx_mgmt()
617 else if (ieee80211_is_ctl(hdr->frame_control)) in wcn36xx_set_tx_mgmt()
618 bd->bd_rate = WCN36XX_BD_RATE_CTRL; in wcn36xx_set_tx_mgmt()
624 * unicast even if address is broadcast. in wcn36xx_set_tx_mgmt()
626 if (__vif_priv->is_joining && in wcn36xx_set_tx_mgmt()
627 ieee80211_is_probe_req(hdr->frame_control)) in wcn36xx_set_tx_mgmt()
632 bd->ub = 1; in wcn36xx_set_tx_mgmt()
634 bd->ack_policy = 1; in wcn36xx_set_tx_mgmt()
635 bd->queue_id = WCN36XX_TX_B_WQ_ID; in wcn36xx_set_tx_mgmt()
637 bd->queue_id = WCN36XX_TX_U_WQ_ID; in wcn36xx_set_tx_mgmt()
640 bd->pdu.bd_ssn = WCN36XX_TXBD_SSN_FILL_DPU_NON_QOS; in wcn36xx_set_tx_mgmt()
642 wcn36xx_set_tx_pdu(bd, in wcn36xx_set_tx_mgmt()
643 ieee80211_is_data_qos(hdr->frame_control) ? in wcn36xx_set_tx_mgmt()
646 skb->len, WCN36XX_TID); in wcn36xx_set_tx_mgmt()
653 struct ieee80211_hdr *hdr = (struct ieee80211_hdr *)skb->data; in wcn36xx_start_tx()
656 bool is_low = ieee80211_is_data(hdr->frame_control); in wcn36xx_start_tx()
657 bool bcast = is_broadcast_ether_addr(hdr->addr1) || in wcn36xx_start_tx()
658 is_multicast_ether_addr(hdr->addr1); in wcn36xx_start_tx()
659 bool ack_ind = (info->flags & IEEE80211_TX_CTL_REQ_TX_STATUS) && in wcn36xx_start_tx()
660 !(info->flags & IEEE80211_TX_CTL_NO_ACK); in wcn36xx_start_tx()
661 struct wcn36xx_tx_bd bd; in wcn36xx_start_tx() local
664 memset(&bd, 0, sizeof(bd)); in wcn36xx_start_tx()
668 skb, skb->len, __le16_to_cpu(hdr->frame_control), in wcn36xx_start_tx()
669 IEEE80211_SEQ_TO_SN(__le16_to_cpu(hdr->seq_ctrl)), in wcn36xx_start_tx()
672 wcn36xx_dbg_dump(WCN36XX_DBG_TX_DUMP, "", skb->data, skb->len); in wcn36xx_start_tx()
674 bd.dpu_rf = WCN36XX_BMU_WQ_TX; in wcn36xx_start_tx()
682 ieee80211_stop_queues(wcn->hw); in wcn36xx_start_tx()
685 bd.tx_comp = 1; in wcn36xx_start_tx()
690 wcn36xx_set_tx_data(&bd, wcn, &vif_priv, sta_priv, skb, bcast); in wcn36xx_start_tx()
693 wcn36xx_set_tx_mgmt(&bd, wcn, &vif_priv, skb, bcast); in wcn36xx_start_tx()
695 buff_to_be(&bd, sizeof(bd)/sizeof(u32)); in wcn36xx_start_tx()
696 bd.tx_bd_sign = 0xbdbdbdbd; in wcn36xx_start_tx()
698 ret = wcn36xx_dxe_tx_frame(wcn, vif_priv, &bd, skb, is_low); in wcn36xx_start_tx()
701 ieee80211_wake_queues(wcn->hw); in wcn36xx_start_tx()
710 if (stats->tx_rate_flags & HAL_TX_RATE_LEGACY) in wcn36xx_process_tx_rate()
711 info->legacy = stats->tx_rate * 5; in wcn36xx_process_tx_rate()
713 info->flags = 0; in wcn36xx_process_tx_rate()
714 info->mcs = stats->mcs_index; in wcn36xx_process_tx_rate()
715 info->nss = 1; in wcn36xx_process_tx_rate()
717 if (stats->tx_rate_flags & (HAL_TX_RATE_HT20 | HAL_TX_RATE_HT40)) in wcn36xx_process_tx_rate()
718 info->flags |= RATE_INFO_FLAGS_MCS; in wcn36xx_process_tx_rate()
720 if (stats->tx_rate_flags & (HAL_TX_RATE_VHT20 | HAL_TX_RATE_VHT40 | HAL_TX_RATE_VHT80)) in wcn36xx_process_tx_rate()
721 info->flags |= RATE_INFO_FLAGS_VHT_MCS; in wcn36xx_process_tx_rate()
723 if (stats->tx_rate_flags & HAL_TX_RATE_SGI) in wcn36xx_process_tx_rate()
724 info->flags |= RATE_INFO_FLAGS_SHORT_GI; in wcn36xx_process_tx_rate()
726 if (stats->tx_rate_flags & (HAL_TX_RATE_HT20 | HAL_TX_RATE_VHT20)) in wcn36xx_process_tx_rate()
727 info->bw = RATE_INFO_BW_20; in wcn36xx_process_tx_rate()
729 if (stats->tx_rate_flags & (HAL_TX_RATE_HT40 | HAL_TX_RATE_VHT40)) in wcn36xx_process_tx_rate()
730 info->bw = RATE_INFO_BW_40; in wcn36xx_process_tx_rate()
732 if (stats->tx_rate_flags & HAL_TX_RATE_VHT80) in wcn36xx_process_tx_rate()
733 info->bw = RATE_INFO_BW_80; in wcn36xx_process_tx_rate()