Lines Matching +full:hw +full:- +full:flow +full:- +full:ctrl

1 // SPDX-License-Identifier: ISC
12 switch (mt76_chip(&(_dev)->mt76)) { \
47 for (nss = 8; nss > 0; nss--) { in mt7915_mcu_get_sta_nss()
48 u8 nss_mcs = (mcs_map >> (2 * (nss - 1))) & 3; in mt7915_mcu_get_sta_nss()
54 return nss - 1; in mt7915_mcu_get_sta_nss()
61 struct mt7915_sta *msta = (struct mt7915_sta *)sta->drv_priv; in mt7915_mcu_set_sta_he_mcs()
62 struct mt7915_dev *dev = msta->vif->phy->dev; in mt7915_mcu_set_sta_he_mcs()
63 enum nl80211_band band = msta->vif->phy->mt76->chandef.chan->band; in mt7915_mcu_set_sta_he_mcs()
64 const u16 *mask = msta->vif->bitrate_mask.control[band].he_mcs; in mt7915_mcu_set_sta_he_mcs()
65 int nss, max_nss = sta->deflink.rx_nss > 3 ? 4 : sta->deflink.rx_nss; in mt7915_mcu_set_sta_he_mcs()
84 mcs = mcs ? fls(mcs & mask[nss]) - 1 : -1; in mt7915_mcu_set_sta_he_mcs()
104 if (is_mt7915(&dev->mt76) && nss > 1 && in mt7915_mcu_set_sta_he_mcs()
105 sta->deflink.bandwidth == IEEE80211_STA_RX_BW_160) in mt7915_mcu_set_sta_he_mcs()
116 struct mt7915_sta *msta = (struct mt7915_sta *)sta->drv_priv; in mt7915_mcu_set_sta_vht_mcs()
117 struct mt7915_dev *dev = msta->vif->phy->dev; in mt7915_mcu_set_sta_vht_mcs()
118 u16 mcs_map = le16_to_cpu(sta->deflink.vht_cap.vht_mcs.rx_mcs_map); in mt7915_mcu_set_sta_vht_mcs()
119 int nss, max_nss = sta->deflink.rx_nss > 3 ? 4 : sta->deflink.rx_nss; in mt7915_mcu_set_sta_vht_mcs()
140 if (is_mt7915(&dev->mt76) && nss > 1 && in mt7915_mcu_set_sta_vht_mcs()
141 sta->deflink.bandwidth == IEEE80211_STA_RX_BW_160) in mt7915_mcu_set_sta_vht_mcs()
150 int nss, max_nss = sta->deflink.rx_nss > 3 ? 4 : sta->deflink.rx_nss; in mt7915_mcu_set_sta_ht_mcs()
153 ht_mcs[nss] = sta->deflink.ht_cap.mcs.rx_mask[nss] & mask[nss]; in mt7915_mcu_set_sta_ht_mcs()
164 dev_err(mdev->dev, "Message %08x (seq %d) timeout\n", in mt7915_mcu_parse_response()
166 return -ETIMEDOUT; in mt7915_mcu_parse_response()
169 rxd = (struct mt76_connac2_mcu_rxd *)skb->data; in mt7915_mcu_parse_response()
170 if (seq != rxd->seq && in mt7915_mcu_parse_response()
171 !(rxd->eid == MCU_CMD_EXT_CID && in mt7915_mcu_parse_response()
172 rxd->ext_eid == MCU_EXT_EVENT_WA_TX_STAT)) in mt7915_mcu_parse_response()
173 return -EAGAIN; in mt7915_mcu_parse_response()
176 skb_pull(skb, sizeof(*rxd) - 4); in mt7915_mcu_parse_response()
177 ret = *skb->data; in mt7915_mcu_parse_response()
180 ret = le32_to_cpu(*(__le32 *)skb->data); in mt7915_mcu_parse_response()
202 else if (test_bit(MT76_STATE_MCU_RUNNING, &dev->mphy.state)) in mt7915_mcu_send_message()
207 return mt76_tx_queue_skb_raw(dev, mdev->q_mcu[qid], skb, 0); in mt7915_mcu_send_message()
222 return mt76_mcu_send_msg(&dev->mt76, cmd, &req, sizeof(req), false); in mt7915_mcu_wa_cmd()
228 if (vif->bss_conf.csa_active) in mt7915_mcu_csa_finish()
235 struct mt76_phy *mphy = &dev->mt76.phy; in mt7915_mcu_rx_csa_notify()
238 c = (struct mt7915_mcu_csa_notify *)skb->data; in mt7915_mcu_rx_csa_notify()
240 if (c->band_idx > MT_BAND1) in mt7915_mcu_rx_csa_notify()
243 if ((c->band_idx && !dev->phy.mt76->band_idx) && in mt7915_mcu_rx_csa_notify()
244 dev->mt76.phys[MT_BAND1]) in mt7915_mcu_rx_csa_notify()
245 mphy = dev->mt76.phys[MT_BAND1]; in mt7915_mcu_rx_csa_notify()
247 ieee80211_iterate_active_interfaces_atomic(mphy->hw, in mt7915_mcu_rx_csa_notify()
249 mt7915_mcu_csa_finish, mphy->hw); in mt7915_mcu_rx_csa_notify()
255 struct mt76_phy *mphy = &dev->mt76.phy; in mt7915_mcu_rx_thermal_notify()
259 t = (struct mt7915_mcu_thermal_notify *)skb->data; in mt7915_mcu_rx_thermal_notify()
260 if (t->ctrl.ctrl_id != THERMAL_PROTECT_ENABLE) in mt7915_mcu_rx_thermal_notify()
263 if (t->ctrl.band_idx > MT_BAND1) in mt7915_mcu_rx_thermal_notify()
266 if ((t->ctrl.band_idx && !dev->phy.mt76->band_idx) && in mt7915_mcu_rx_thermal_notify()
267 dev->mt76.phys[MT_BAND1]) in mt7915_mcu_rx_thermal_notify()
268 mphy = dev->mt76.phys[MT_BAND1]; in mt7915_mcu_rx_thermal_notify()
270 phy = (struct mt7915_phy *)mphy->priv; in mt7915_mcu_rx_thermal_notify()
271 phy->throttle_state = t->ctrl.duty.duty_cycle; in mt7915_mcu_rx_thermal_notify()
277 struct mt76_phy *mphy = &dev->mt76.phy; in mt7915_mcu_rx_radar_detected()
280 r = (struct mt7915_mcu_rdd_report *)skb->data; in mt7915_mcu_rx_radar_detected()
282 if (r->band_idx > MT_RX_SEL2) in mt7915_mcu_rx_radar_detected()
285 if ((r->band_idx && !dev->phy.mt76->band_idx) && in mt7915_mcu_rx_radar_detected()
286 dev->mt76.phys[MT_BAND1]) in mt7915_mcu_rx_radar_detected()
287 mphy = dev->mt76.phys[MT_BAND1]; in mt7915_mcu_rx_radar_detected()
289 if (r->band_idx == MT_RX_SEL2) in mt7915_mcu_rx_radar_detected()
290 cfg80211_background_radar_event(mphy->hw->wiphy, in mt7915_mcu_rx_radar_detected()
291 &dev->rdd2_chandef, in mt7915_mcu_rx_radar_detected()
294 ieee80211_radar_detected(mphy->hw); in mt7915_mcu_rx_radar_detected()
295 dev->hw_pattern++; in mt7915_mcu_rx_radar_detected()
302 int len = skb->len - sizeof(*rxd); in mt7915_mcu_rx_log_message()
305 rxd = (struct mt76_connac2_mcu_rxd *)skb->data; in mt7915_mcu_rx_log_message()
308 switch (rxd->s2d_index) { in mt7915_mcu_rx_log_message()
325 wiphy_info(mt76_hw(dev)->wiphy, "%s: %.*s", type, len, data); in mt7915_mcu_rx_log_message()
331 if (!vif->bss_conf.color_change_active) in mt7915_mcu_cca_finish()
340 struct mt76_phy *mphy = &dev->mt76.phy; in mt7915_mcu_rx_bcc_notify()
343 b = (struct mt7915_mcu_bcc_notify *)skb->data; in mt7915_mcu_rx_bcc_notify()
345 if (b->band_idx > MT_BAND1) in mt7915_mcu_rx_bcc_notify()
348 if ((b->band_idx && !dev->phy.mt76->band_idx) && in mt7915_mcu_rx_bcc_notify()
349 dev->mt76.phys[MT_BAND1]) in mt7915_mcu_rx_bcc_notify()
350 mphy = dev->mt76.phys[MT_BAND1]; in mt7915_mcu_rx_bcc_notify()
352 ieee80211_iterate_active_interfaces_atomic(mphy->hw, in mt7915_mcu_rx_bcc_notify()
354 mt7915_mcu_cca_finish, mphy->hw); in mt7915_mcu_rx_bcc_notify()
362 rxd = (struct mt76_connac2_mcu_rxd *)skb->data; in mt7915_mcu_rx_ext_event()
363 switch (rxd->ext_eid) { in mt7915_mcu_rx_ext_event()
389 rxd = (struct mt76_connac2_mcu_rxd *)skb->data; in mt7915_mcu_rx_unsolicited_event()
390 switch (rxd->eid) { in mt7915_mcu_rx_unsolicited_event()
404 rxd = (struct mt76_connac2_mcu_rxd *)skb->data; in mt7915_mcu_rx_event()
405 if ((rxd->ext_eid == MCU_EXT_EVENT_THERMAL_PROTECT || in mt7915_mcu_rx_event()
406 rxd->ext_eid == MCU_EXT_EVENT_FW_LOG_2_HOST || in mt7915_mcu_rx_event()
407 rxd->ext_eid == MCU_EXT_EVENT_ASSERT_DUMP || in mt7915_mcu_rx_event()
408 rxd->ext_eid == MCU_EXT_EVENT_PS_SYNC || in mt7915_mcu_rx_event()
409 rxd->ext_eid == MCU_EXT_EVENT_BCC_NOTIFY || in mt7915_mcu_rx_event()
410 !rxd->seq) && in mt7915_mcu_rx_event()
411 !(rxd->eid == MCU_CMD_EXT_CID && in mt7915_mcu_rx_event()
412 rxd->ext_eid == MCU_EXT_EVENT_WA_TX_STAT)) in mt7915_mcu_rx_event()
415 mt76_mcu_rx_event(&dev->mt76, skb); in mt7915_mcu_rx_event()
451 if (!elem || elem->datalen <= 10 || in mt7915_check_he_obss_narrow_bw_ru_iter()
452 !(elem->data[10] & in mt7915_check_he_obss_narrow_bw_ru_iter()
454 data->tolerated = false; in mt7915_check_he_obss_narrow_bw_ru_iter()
459 static bool mt7915_check_he_obss_narrow_bw_ru(struct ieee80211_hw *hw, in mt7915_check_he_obss_narrow_bw_ru() argument
466 if (!(vif->bss_conf.chandef.chan->flags & IEEE80211_CHAN_RADAR)) in mt7915_check_he_obss_narrow_bw_ru()
469 cfg80211_bss_iter(hw->wiphy, &vif->bss_conf.chandef, in mt7915_check_he_obss_narrow_bw_ru()
475 * tolerate 26-tone RU UL OFDMA transmissions using HE TB PPDU. in mt7915_check_he_obss_narrow_bw_ru()
484 struct cfg80211_chan_def *chandef = &phy->mt76->chandef; in mt7915_mcu_bss_rfch_tlv()
487 int freq1 = chandef->center_freq1; in mt7915_mcu_bss_rfch_tlv()
492 ch->pri_ch = chandef->chan->hw_value; in mt7915_mcu_bss_rfch_tlv()
493 ch->center_ch0 = ieee80211_frequency_to_channel(freq1); in mt7915_mcu_bss_rfch_tlv()
494 ch->bw = mt76_connac_chan_bw(chandef); in mt7915_mcu_bss_rfch_tlv()
496 if (chandef->width == NL80211_CHAN_WIDTH_80P80) { in mt7915_mcu_bss_rfch_tlv()
497 int freq2 = chandef->center_freq2; in mt7915_mcu_bss_rfch_tlv()
499 ch->center_ch1 = ieee80211_frequency_to_channel(freq2); in mt7915_mcu_bss_rfch_tlv()
502 if (vif->bss_conf.he_support && vif->type == NL80211_IFTYPE_STATION) { in mt7915_mcu_bss_rfch_tlv()
503 struct mt76_phy *mphy = phy->mt76; in mt7915_mcu_bss_rfch_tlv()
505 ch->he_ru26_block = in mt7915_mcu_bss_rfch_tlv()
506 mt7915_check_he_obss_narrow_bw_ru(mphy->hw, vif); in mt7915_mcu_bss_rfch_tlv()
507 ch->he_all_disable = false; in mt7915_mcu_bss_rfch_tlv()
509 ch->he_all_disable = true; in mt7915_mcu_bss_rfch_tlv()
517 int max_nss = hweight8(phy->mt76->antenna_mask); in mt7915_mcu_bss_ra_tlv()
524 ra->op_mode = vif->type == NL80211_IFTYPE_AP; in mt7915_mcu_bss_ra_tlv()
525 ra->adhoc_en = vif->type == NL80211_IFTYPE_ADHOC; in mt7915_mcu_bss_ra_tlv()
526 ra->short_preamble = true; in mt7915_mcu_bss_ra_tlv()
527 ra->tx_streams = max_nss; in mt7915_mcu_bss_ra_tlv()
528 ra->rx_streams = max_nss; in mt7915_mcu_bss_ra_tlv()
529 ra->algo = 4; in mt7915_mcu_bss_ra_tlv()
530 ra->train_up_rule = 2; in mt7915_mcu_bss_ra_tlv()
531 ra->train_up_high_thres = 110; in mt7915_mcu_bss_ra_tlv()
532 ra->train_up_rule_rssi = -70; in mt7915_mcu_bss_ra_tlv()
533 ra->low_traffic_thres = 2; in mt7915_mcu_bss_ra_tlv()
534 ra->phy_cap = cpu_to_le32(0xfdf); in mt7915_mcu_bss_ra_tlv()
535 ra->interval = cpu_to_le32(500); in mt7915_mcu_bss_ra_tlv()
536 ra->fast_interval = cpu_to_le32(100); in mt7915_mcu_bss_ra_tlv()
549 cap = mt76_connac_get_he_phy_cap(phy->mt76, vif); in mt7915_mcu_bss_he_tlv()
554 he->he_pe_duration = vif->bss_conf.htc_trig_based_pkt_ext; in mt7915_mcu_bss_he_tlv()
555 if (!he->he_pe_duration) in mt7915_mcu_bss_he_tlv()
556 he->he_pe_duration = DEFAULT_HE_PE_DURATION; in mt7915_mcu_bss_he_tlv()
558 he->he_rts_thres = cpu_to_le16(vif->bss_conf.frame_time_rts_th); in mt7915_mcu_bss_he_tlv()
559 if (!he->he_rts_thres) in mt7915_mcu_bss_he_tlv()
560 he->he_rts_thres = cpu_to_le16(DEFAULT_HE_DURATION_RTS_THRES); in mt7915_mcu_bss_he_tlv()
562 he->max_nss_mcs[CMD_HE_MCS_BW80] = cap->he_mcs_nss_supp.tx_mcs_80; in mt7915_mcu_bss_he_tlv()
563 he->max_nss_mcs[CMD_HE_MCS_BW160] = cap->he_mcs_nss_supp.tx_mcs_160; in mt7915_mcu_bss_he_tlv()
564 he->max_nss_mcs[CMD_HE_MCS_BW8080] = cap->he_mcs_nss_supp.tx_mcs_80p80; in mt7915_mcu_bss_he_tlv()
578 amsdu->cmp_bitmap_0 = cpu_to_le32(TXD_CMP_MAP1); in mt7915_mcu_bss_hw_amsdu_tlv()
579 amsdu->cmp_bitmap_1 = cpu_to_le32(TXD_CMP_MAP2); in mt7915_mcu_bss_hw_amsdu_tlv()
580 amsdu->trig_thres = cpu_to_le16(2); in mt7915_mcu_bss_hw_amsdu_tlv()
581 amsdu->enable = true; in mt7915_mcu_bss_hw_amsdu_tlv()
588 struct cfg80211_chan_def *chandef = &phy->mt76->chandef; in mt7915_mcu_bss_bmc_tlv()
589 enum nl80211_band band = chandef->chan->band; in mt7915_mcu_bss_bmc_tlv()
596 bmc->short_preamble = true; in mt7915_mcu_bss_bmc_tlv()
598 bmc->bc_trans = cpu_to_le16(0x2000); in mt7915_mcu_bss_bmc_tlv()
599 bmc->mc_trans = cpu_to_le16(0x2080); in mt7915_mcu_bss_bmc_tlv()
607 struct mt7915_dev *dev = phy->dev; in mt7915_mcu_muar_config()
608 struct mt7915_vif *mvif = (struct mt7915_vif *)vif->drv_priv; in mt7915_mcu_muar_config()
609 u32 idx = mvif->mt76.omac_idx - REPEATER_BSSID_START; in mt7915_mcu_muar_config()
610 u32 mask = phy->omac_mask >> 32 & ~BIT(idx); in mt7915_mcu_muar_config()
611 const u8 *addr = vif->addr; in mt7915_mcu_muar_config()
627 .band = phy->mt76->band_idx, in mt7915_mcu_muar_config()
632 addr = vif->bss_conf.bssid; in mt7915_mcu_muar_config()
637 return mt76_mcu_send_msg(&dev->mt76, MCU_EXT_CMD(MUAR_UPDATE), &req, in mt7915_mcu_muar_config()
644 struct mt7915_vif *mvif = (struct mt7915_vif *)vif->drv_priv; in mt7915_mcu_add_bss_info()
645 struct mt7915_dev *dev = phy->dev; in mt7915_mcu_add_bss_info()
648 if (mvif->mt76.omac_idx >= REPEATER_BSSID_START) { in mt7915_mcu_add_bss_info()
653 skb = __mt76_connac_mcu_alloc_sta_req(&dev->mt76, &mvif->mt76, NULL, in mt7915_mcu_add_bss_info()
662 mt76_connac_mcu_bss_basic_tlv(skb, vif, NULL, phy->mt76, in mt7915_mcu_add_bss_info()
663 mvif->sta.wcid.idx, enable); in mt7915_mcu_add_bss_info()
665 if (vif->type == NL80211_IFTYPE_MONITOR) in mt7915_mcu_add_bss_info()
674 if (vif->bss_conf.he_support) in mt7915_mcu_add_bss_info()
677 if (mvif->mt76.omac_idx >= EXT_BSSID_START && in mt7915_mcu_add_bss_info()
678 mvif->mt76.omac_idx < REPEATER_BSSID_START) in mt7915_mcu_add_bss_info()
679 mt76_connac_mcu_bss_ext_tlv(skb, &mvif->mt76); in mt7915_mcu_add_bss_info()
682 return mt76_mcu_skb_send_msg(&dev->mt76, skb, in mt7915_mcu_add_bss_info()
691 struct mt7915_sta *msta = (struct mt7915_sta *)params->sta->drv_priv; in mt7915_mcu_add_tx_ba()
692 struct mt7915_vif *mvif = msta->vif; in mt7915_mcu_add_tx_ba()
694 if (enable && !params->amsdu) in mt7915_mcu_add_tx_ba()
695 msta->wcid.amsdu = false; in mt7915_mcu_add_tx_ba()
697 return mt76_connac_mcu_sta_ba(&dev->mt76, &mvif->mt76, params, in mt7915_mcu_add_tx_ba()
706 struct mt7915_sta *msta = (struct mt7915_sta *)params->sta->drv_priv; in mt7915_mcu_add_rx_ba()
707 struct mt7915_vif *mvif = msta->vif; in mt7915_mcu_add_rx_ba()
709 return mt76_connac_mcu_sta_ba(&dev->mt76, &mvif->mt76, params, in mt7915_mcu_add_rx_ba()
718 struct mt7915_vif *mvif = (struct mt7915_vif *)vif->drv_priv; in mt7915_mcu_sta_he_tlv()
719 struct ieee80211_he_cap_elem *elem = &sta->deflink.he_cap.he_cap_elem; in mt7915_mcu_sta_he_tlv()
725 if (!sta->deflink.he_cap.has_he) in mt7915_mcu_sta_he_tlv()
732 if (elem->mac_cap_info[0] & IEEE80211_HE_MAC_CAP0_HTC_HE) in mt7915_mcu_sta_he_tlv()
735 if (elem->mac_cap_info[2] & IEEE80211_HE_MAC_CAP2_BSR) in mt7915_mcu_sta_he_tlv()
738 if (elem->mac_cap_info[3] & IEEE80211_HE_MAC_CAP3_OMI_CONTROL) in mt7915_mcu_sta_he_tlv()
741 if (elem->mac_cap_info[4] & IEEE80211_HE_MAC_CAP4_AMSDU_IN_AMPDU) in mt7915_mcu_sta_he_tlv()
744 if (elem->mac_cap_info[4] & IEEE80211_HE_MAC_CAP4_BQR) in mt7915_mcu_sta_he_tlv()
747 if (elem->phy_cap_info[0] & in mt7915_mcu_sta_he_tlv()
752 if (mvif->cap.he_ldpc && in mt7915_mcu_sta_he_tlv()
753 (elem->phy_cap_info[1] & in mt7915_mcu_sta_he_tlv()
757 if (elem->phy_cap_info[1] & in mt7915_mcu_sta_he_tlv()
761 if (elem->phy_cap_info[2] & in mt7915_mcu_sta_he_tlv()
765 if (elem->phy_cap_info[2] & in mt7915_mcu_sta_he_tlv()
769 if (elem->phy_cap_info[2] & in mt7915_mcu_sta_he_tlv()
773 if (elem->phy_cap_info[6] & in mt7915_mcu_sta_he_tlv()
777 if (elem->phy_cap_info[6] & in mt7915_mcu_sta_he_tlv()
781 if (elem->phy_cap_info[7] & in mt7915_mcu_sta_he_tlv()
785 if (elem->phy_cap_info[7] & in mt7915_mcu_sta_he_tlv()
789 if (elem->phy_cap_info[7] & in mt7915_mcu_sta_he_tlv()
793 if (elem->phy_cap_info[8] & in mt7915_mcu_sta_he_tlv()
797 if (elem->phy_cap_info[8] & in mt7915_mcu_sta_he_tlv()
801 if (elem->phy_cap_info[9] & in mt7915_mcu_sta_he_tlv()
805 if (elem->phy_cap_info[9] & in mt7915_mcu_sta_he_tlv()
809 he->he_cap = cpu_to_le32(cap); in mt7915_mcu_sta_he_tlv()
811 mcs_map = sta->deflink.he_cap.he_mcs_nss_supp; in mt7915_mcu_sta_he_tlv()
812 switch (sta->deflink.bandwidth) { in mt7915_mcu_sta_he_tlv()
814 if (elem->phy_cap_info[0] & in mt7915_mcu_sta_he_tlv()
817 &he->max_nss_mcs[CMD_HE_MCS_BW8080], in mt7915_mcu_sta_he_tlv()
821 &he->max_nss_mcs[CMD_HE_MCS_BW160], in mt7915_mcu_sta_he_tlv()
826 &he->max_nss_mcs[CMD_HE_MCS_BW80], in mt7915_mcu_sta_he_tlv()
831 he->t_frame_dur = in mt7915_mcu_sta_he_tlv()
832 HE_MAC(CAP1_TF_MAC_PAD_DUR_MASK, elem->mac_cap_info[1]); in mt7915_mcu_sta_he_tlv()
833 he->max_ampdu_exp = in mt7915_mcu_sta_he_tlv()
834 HE_MAC(CAP3_MAX_AMPDU_LEN_EXP_MASK, elem->mac_cap_info[3]); in mt7915_mcu_sta_he_tlv()
836 he->bw_set = in mt7915_mcu_sta_he_tlv()
837 HE_PHY(CAP0_CHANNEL_WIDTH_SET_MASK, elem->phy_cap_info[0]); in mt7915_mcu_sta_he_tlv()
838 he->device_class = in mt7915_mcu_sta_he_tlv()
839 HE_PHY(CAP1_DEVICE_CLASS_A, elem->phy_cap_info[1]); in mt7915_mcu_sta_he_tlv()
840 he->punc_pream_rx = in mt7915_mcu_sta_he_tlv()
841 HE_PHY(CAP1_PREAMBLE_PUNC_RX_MASK, elem->phy_cap_info[1]); in mt7915_mcu_sta_he_tlv()
843 he->dcm_tx_mode = in mt7915_mcu_sta_he_tlv()
844 HE_PHY(CAP3_DCM_MAX_CONST_TX_MASK, elem->phy_cap_info[3]); in mt7915_mcu_sta_he_tlv()
845 he->dcm_tx_max_nss = in mt7915_mcu_sta_he_tlv()
846 HE_PHY(CAP3_DCM_MAX_TX_NSS_2, elem->phy_cap_info[3]); in mt7915_mcu_sta_he_tlv()
847 he->dcm_rx_mode = in mt7915_mcu_sta_he_tlv()
848 HE_PHY(CAP3_DCM_MAX_CONST_RX_MASK, elem->phy_cap_info[3]); in mt7915_mcu_sta_he_tlv()
849 he->dcm_rx_max_nss = in mt7915_mcu_sta_he_tlv()
850 HE_PHY(CAP3_DCM_MAX_RX_NSS_2, elem->phy_cap_info[3]); in mt7915_mcu_sta_he_tlv()
851 he->dcm_rx_max_nss = in mt7915_mcu_sta_he_tlv()
852 HE_PHY(CAP8_DCM_MAX_RU_MASK, elem->phy_cap_info[8]); in mt7915_mcu_sta_he_tlv()
854 he->pkt_ext = 2; in mt7915_mcu_sta_he_tlv()
861 struct mt7915_vif *mvif = (struct mt7915_vif *)vif->drv_priv; in mt7915_mcu_sta_muru_tlv()
862 struct ieee80211_he_cap_elem *elem = &sta->deflink.he_cap.he_cap_elem; in mt7915_mcu_sta_muru_tlv()
866 if (vif->type != NL80211_IFTYPE_STATION && in mt7915_mcu_sta_muru_tlv()
867 vif->type != NL80211_IFTYPE_AP) in mt7915_mcu_sta_muru_tlv()
874 muru->cfg.mimo_dl_en = mvif->cap.he_mu_ebfer || in mt7915_mcu_sta_muru_tlv()
875 mvif->cap.vht_mu_ebfer || in mt7915_mcu_sta_muru_tlv()
876 mvif->cap.vht_mu_ebfee; in mt7915_mcu_sta_muru_tlv()
877 if (!is_mt7915(&dev->mt76)) in mt7915_mcu_sta_muru_tlv()
878 muru->cfg.mimo_ul_en = true; in mt7915_mcu_sta_muru_tlv()
879 muru->cfg.ofdma_dl_en = true; in mt7915_mcu_sta_muru_tlv()
881 if (sta->deflink.vht_cap.vht_supported) in mt7915_mcu_sta_muru_tlv()
882 muru->mimo_dl.vht_mu_bfee = in mt7915_mcu_sta_muru_tlv()
883 !!(sta->deflink.vht_cap.cap & IEEE80211_VHT_CAP_MU_BEAMFORMEE_CAPABLE); in mt7915_mcu_sta_muru_tlv()
885 if (!sta->deflink.he_cap.has_he) in mt7915_mcu_sta_muru_tlv()
888 muru->mimo_dl.partial_bw_dl_mimo = in mt7915_mcu_sta_muru_tlv()
889 HE_PHY(CAP6_PARTIAL_BANDWIDTH_DL_MUMIMO, elem->phy_cap_info[6]); in mt7915_mcu_sta_muru_tlv()
891 muru->mimo_ul.full_ul_mimo = in mt7915_mcu_sta_muru_tlv()
892 HE_PHY(CAP2_UL_MU_FULL_MU_MIMO, elem->phy_cap_info[2]); in mt7915_mcu_sta_muru_tlv()
893 muru->mimo_ul.partial_ul_mimo = in mt7915_mcu_sta_muru_tlv()
894 HE_PHY(CAP2_UL_MU_PARTIAL_MU_MIMO, elem->phy_cap_info[2]); in mt7915_mcu_sta_muru_tlv()
896 muru->ofdma_dl.punc_pream_rx = in mt7915_mcu_sta_muru_tlv()
897 HE_PHY(CAP1_PREAMBLE_PUNC_RX_MASK, elem->phy_cap_info[1]); in mt7915_mcu_sta_muru_tlv()
898 muru->ofdma_dl.he_20m_in_40m_2g = in mt7915_mcu_sta_muru_tlv()
899 HE_PHY(CAP8_20MHZ_IN_40MHZ_HE_PPDU_IN_2G, elem->phy_cap_info[8]); in mt7915_mcu_sta_muru_tlv()
900 muru->ofdma_dl.he_20m_in_160m = in mt7915_mcu_sta_muru_tlv()
901 HE_PHY(CAP8_20MHZ_IN_160MHZ_HE_PPDU, elem->phy_cap_info[8]); in mt7915_mcu_sta_muru_tlv()
902 muru->ofdma_dl.he_80m_in_160m = in mt7915_mcu_sta_muru_tlv()
903 HE_PHY(CAP8_80MHZ_IN_160MHZ_HE_PPDU, elem->phy_cap_info[8]); in mt7915_mcu_sta_muru_tlv()
905 muru->ofdma_ul.t_frame_dur = in mt7915_mcu_sta_muru_tlv()
906 HE_MAC(CAP1_TF_MAC_PAD_DUR_MASK, elem->mac_cap_info[1]); in mt7915_mcu_sta_muru_tlv()
907 muru->ofdma_ul.mu_cascading = in mt7915_mcu_sta_muru_tlv()
908 HE_MAC(CAP2_MU_CASCADING, elem->mac_cap_info[2]); in mt7915_mcu_sta_muru_tlv()
909 muru->ofdma_ul.uo_ra = in mt7915_mcu_sta_muru_tlv()
910 HE_MAC(CAP3_OFDMA_RA, elem->mac_cap_info[3]); in mt7915_mcu_sta_muru_tlv()
919 if (!sta->deflink.ht_cap.ht_supported) in mt7915_mcu_sta_ht_tlv()
925 ht->ht_cap = cpu_to_le16(sta->deflink.ht_cap.cap); in mt7915_mcu_sta_ht_tlv()
934 if (!sta->deflink.vht_cap.vht_supported) in mt7915_mcu_sta_vht_tlv()
940 vht->vht_cap = cpu_to_le32(sta->deflink.vht_cap.cap); in mt7915_mcu_sta_vht_tlv()
941 vht->vht_rx_mcs_map = sta->deflink.vht_cap.vht_mcs.rx_mcs_map; in mt7915_mcu_sta_vht_tlv()
942 vht->vht_tx_mcs_map = sta->deflink.vht_cap.vht_mcs.tx_mcs_map; in mt7915_mcu_sta_vht_tlv()
949 struct mt7915_sta *msta = (struct mt7915_sta *)sta->drv_priv; in mt7915_mcu_sta_amsdu_tlv()
953 if (vif->type != NL80211_IFTYPE_STATION && in mt7915_mcu_sta_amsdu_tlv()
954 vif->type != NL80211_IFTYPE_AP) in mt7915_mcu_sta_amsdu_tlv()
957 if (!sta->deflink.agg.max_amsdu_len) in mt7915_mcu_sta_amsdu_tlv()
962 amsdu->max_amsdu_num = 8; in mt7915_mcu_sta_amsdu_tlv()
963 amsdu->amsdu_en = true; in mt7915_mcu_sta_amsdu_tlv()
964 msta->wcid.amsdu = true; in mt7915_mcu_sta_amsdu_tlv()
966 switch (sta->deflink.agg.max_amsdu_len) { in mt7915_mcu_sta_amsdu_tlv()
968 if (!is_mt7915(&dev->mt76)) { in mt7915_mcu_sta_amsdu_tlv()
969 amsdu->max_mpdu_size = in mt7915_mcu_sta_amsdu_tlv()
976 amsdu->max_mpdu_size = IEEE80211_VHT_CAP_MAX_MPDU_LENGTH_7991; in mt7915_mcu_sta_amsdu_tlv()
979 amsdu->max_mpdu_size = IEEE80211_VHT_CAP_MAX_MPDU_LENGTH_3895; in mt7915_mcu_sta_amsdu_tlv()
988 struct mt7915_vif *mvif = (struct mt7915_vif *)vif->drv_priv; in mt7915_mcu_sta_wtbl_tlv()
994 msta = sta ? (struct mt7915_sta *)sta->drv_priv : &mvif->sta; in mt7915_mcu_sta_wtbl_tlv()
995 wcid = sta ? &msta->wcid : NULL; in mt7915_mcu_sta_wtbl_tlv()
998 wtbl_hdr = mt76_connac_mcu_alloc_wtbl_req(&dev->mt76, &msta->wcid, in mt7915_mcu_sta_wtbl_tlv()
1004 mt76_connac_mcu_wtbl_generic_tlv(&dev->mt76, skb, vif, sta, tlv, in mt7915_mcu_sta_wtbl_tlv()
1008 mt76_connac_mcu_wtbl_ht_tlv(&dev->mt76, skb, sta, tlv, in mt7915_mcu_sta_wtbl_tlv()
1009 wtbl_hdr, mvif->cap.ht_ldpc, in mt7915_mcu_sta_wtbl_tlv()
1010 mvif->cap.vht_ldpc); in mt7915_mcu_sta_wtbl_tlv()
1019 struct mt7915_vif *mvif = (struct mt7915_vif *)vif->drv_priv; in mt7915_is_ebf_supported()
1020 int tx_ant = hweight8(phy->mt76->chainmask) - 1; in mt7915_is_ebf_supported()
1022 if (vif->type != NL80211_IFTYPE_STATION && in mt7915_is_ebf_supported()
1023 vif->type != NL80211_IFTYPE_AP) in mt7915_is_ebf_supported()
1029 if (sta->deflink.he_cap.has_he) { in mt7915_is_ebf_supported()
1030 struct ieee80211_he_cap_elem *pe = &sta->deflink.he_cap.he_cap_elem; in mt7915_is_ebf_supported()
1033 return mvif->cap.he_su_ebfee && in mt7915_is_ebf_supported()
1034 HE_PHY(CAP3_SU_BEAMFORMER, pe->phy_cap_info[3]); in mt7915_is_ebf_supported()
1036 return mvif->cap.he_su_ebfer && in mt7915_is_ebf_supported()
1037 HE_PHY(CAP4_SU_BEAMFORMEE, pe->phy_cap_info[4]); in mt7915_is_ebf_supported()
1040 if (sta->deflink.vht_cap.vht_supported) { in mt7915_is_ebf_supported()
1041 u32 cap = sta->deflink.vht_cap.cap; in mt7915_is_ebf_supported()
1044 return mvif->cap.vht_su_ebfee && in mt7915_is_ebf_supported()
1047 return mvif->cap.vht_su_ebfer && in mt7915_is_ebf_supported()
1057 bf->sounding_phy = MT_PHY_TYPE_OFDM; in mt7915_mcu_sta_sounding_rate()
1058 bf->ndp_rate = 0; /* mcs0 */ in mt7915_mcu_sta_sounding_rate()
1059 bf->ndpa_rate = MT7915_CFEND_RATE_DEFAULT; /* ofdm 24m */ in mt7915_mcu_sta_sounding_rate()
1060 bf->rept_poll_rate = MT7915_CFEND_RATE_DEFAULT; /* ofdm 24m */ in mt7915_mcu_sta_sounding_rate()
1067 struct ieee80211_mcs_info *mcs = &sta->deflink.ht_cap.mcs; in mt7915_mcu_sta_bfer_ht()
1070 bf->tx_mode = MT_PHY_TYPE_HT; in mt7915_mcu_sta_bfer_ht()
1072 if ((mcs->tx_params & IEEE80211_HT_MCS_TX_RX_DIFF) && in mt7915_mcu_sta_bfer_ht()
1073 (mcs->tx_params & IEEE80211_HT_MCS_TX_DEFINED)) in mt7915_mcu_sta_bfer_ht()
1075 mcs->tx_params); in mt7915_mcu_sta_bfer_ht()
1076 else if (mcs->rx_mask[3]) in mt7915_mcu_sta_bfer_ht()
1078 else if (mcs->rx_mask[2]) in mt7915_mcu_sta_bfer_ht()
1080 else if (mcs->rx_mask[1]) in mt7915_mcu_sta_bfer_ht()
1083 bf->nrow = hweight8(phy->mt76->chainmask) - 1; in mt7915_mcu_sta_bfer_ht()
1084 bf->ncol = min_t(u8, bf->nrow, n); in mt7915_mcu_sta_bfer_ht()
1085 bf->ibf_ncol = n; in mt7915_mcu_sta_bfer_ht()
1092 struct ieee80211_sta_vht_cap *pc = &sta->deflink.vht_cap; in mt7915_mcu_sta_bfer_vht()
1093 struct ieee80211_sta_vht_cap *vc = &phy->mt76->sband_5g.sband.vht_cap; in mt7915_mcu_sta_bfer_vht()
1094 u16 mcs_map = le16_to_cpu(pc->vht_mcs.rx_mcs_map); in mt7915_mcu_sta_bfer_vht()
1096 u8 tx_ant = hweight8(phy->mt76->chainmask) - 1; in mt7915_mcu_sta_bfer_vht()
1098 bf->tx_mode = MT_PHY_TYPE_VHT; in mt7915_mcu_sta_bfer_vht()
1106 pc->cap); in mt7915_mcu_sta_bfer_vht()
1108 vc->cap); in mt7915_mcu_sta_bfer_vht()
1109 bf->nrow = min_t(u8, min_t(u8, snd_dim, sts), tx_ant); in mt7915_mcu_sta_bfer_vht()
1110 bf->ncol = min_t(u8, nss_mcs, bf->nrow); in mt7915_mcu_sta_bfer_vht()
1111 bf->ibf_ncol = bf->ncol; in mt7915_mcu_sta_bfer_vht()
1113 if (sta->deflink.bandwidth == IEEE80211_STA_RX_BW_160) in mt7915_mcu_sta_bfer_vht()
1114 bf->nrow = 1; in mt7915_mcu_sta_bfer_vht()
1116 bf->nrow = tx_ant; in mt7915_mcu_sta_bfer_vht()
1117 bf->ncol = min_t(u8, nss_mcs, bf->nrow); in mt7915_mcu_sta_bfer_vht()
1118 bf->ibf_ncol = nss_mcs; in mt7915_mcu_sta_bfer_vht()
1120 if (sta->deflink.bandwidth == IEEE80211_STA_RX_BW_160) in mt7915_mcu_sta_bfer_vht()
1121 bf->ibf_nrow = 1; in mt7915_mcu_sta_bfer_vht()
1129 struct ieee80211_sta_he_cap *pc = &sta->deflink.he_cap; in mt7915_mcu_sta_bfer_he()
1130 struct ieee80211_he_cap_elem *pe = &pc->he_cap_elem; in mt7915_mcu_sta_bfer_he()
1132 mt76_connac_get_he_phy_cap(phy->mt76, vif); in mt7915_mcu_sta_bfer_he()
1133 const struct ieee80211_he_cap_elem *ve = &vc->he_cap_elem; in mt7915_mcu_sta_bfer_he()
1134 u16 mcs_map = le16_to_cpu(pc->he_mcs_nss_supp.rx_mcs_80); in mt7915_mcu_sta_bfer_he()
1138 bf->tx_mode = MT_PHY_TYPE_HE_SU; in mt7915_mcu_sta_bfer_he()
1142 bf->trigger_su = HE_PHY(CAP6_TRIG_SU_BEAMFORMING_FB, in mt7915_mcu_sta_bfer_he()
1143 pe->phy_cap_info[6]); in mt7915_mcu_sta_bfer_he()
1144 bf->trigger_mu = HE_PHY(CAP6_TRIG_MU_BEAMFORMING_PARTIAL_BW_FB, in mt7915_mcu_sta_bfer_he()
1145 pe->phy_cap_info[6]); in mt7915_mcu_sta_bfer_he()
1147 ve->phy_cap_info[5]); in mt7915_mcu_sta_bfer_he()
1149 pe->phy_cap_info[4]); in mt7915_mcu_sta_bfer_he()
1150 bf->nrow = min_t(u8, snd_dim, sts); in mt7915_mcu_sta_bfer_he()
1151 bf->ncol = min_t(u8, nss_mcs, bf->nrow); in mt7915_mcu_sta_bfer_he()
1152 bf->ibf_ncol = bf->ncol; in mt7915_mcu_sta_bfer_he()
1154 if (sta->deflink.bandwidth != IEEE80211_STA_RX_BW_160) in mt7915_mcu_sta_bfer_he()
1158 if (pe->phy_cap_info[0] & in mt7915_mcu_sta_bfer_he()
1160 mcs_map = le16_to_cpu(pc->he_mcs_nss_supp.rx_mcs_160); in mt7915_mcu_sta_bfer_he()
1163 bf->ncol_gt_bw80 = nss_mcs; in mt7915_mcu_sta_bfer_he()
1166 if (pe->phy_cap_info[0] & in mt7915_mcu_sta_bfer_he()
1168 mcs_map = le16_to_cpu(pc->he_mcs_nss_supp.rx_mcs_80p80); in mt7915_mcu_sta_bfer_he()
1171 if (bf->ncol_gt_bw80) in mt7915_mcu_sta_bfer_he()
1172 bf->ncol_gt_bw80 = min_t(u8, bf->ncol_gt_bw80, nss_mcs); in mt7915_mcu_sta_bfer_he()
1174 bf->ncol_gt_bw80 = nss_mcs; in mt7915_mcu_sta_bfer_he()
1178 ve->phy_cap_info[5]); in mt7915_mcu_sta_bfer_he()
1180 pe->phy_cap_info[4]); in mt7915_mcu_sta_bfer_he()
1182 bf->nrow_gt_bw80 = min_t(int, snd_dim, sts); in mt7915_mcu_sta_bfer_he()
1189 struct mt7915_vif *mvif = (struct mt7915_vif *)vif->drv_priv; in mt7915_mcu_sta_bfer_tlv()
1190 struct mt7915_phy *phy = mvif->phy; in mt7915_mcu_sta_bfer_tlv()
1191 int tx_ant = hweight8(phy->mt76->chainmask) - 1; in mt7915_mcu_sta_bfer_tlv()
1202 if (!(sta->deflink.ht_cap.ht_supported || sta->deflink.he_cap.has_he)) in mt7915_mcu_sta_bfer_tlv()
1206 if (!ebf && !dev->ibf) in mt7915_mcu_sta_bfer_tlv()
1216 if (sta->deflink.he_cap.has_he && ebf) in mt7915_mcu_sta_bfer_tlv()
1218 else if (sta->deflink.vht_cap.vht_supported) in mt7915_mcu_sta_bfer_tlv()
1220 else if (sta->deflink.ht_cap.ht_supported) in mt7915_mcu_sta_bfer_tlv()
1225 bf->bf_cap = ebf ? ebf : dev->ibf << 1; in mt7915_mcu_sta_bfer_tlv()
1226 bf->bw = sta->deflink.bandwidth; in mt7915_mcu_sta_bfer_tlv()
1227 bf->ibf_dbw = sta->deflink.bandwidth; in mt7915_mcu_sta_bfer_tlv()
1228 bf->ibf_nrow = tx_ant; in mt7915_mcu_sta_bfer_tlv()
1230 if (!ebf && sta->deflink.bandwidth <= IEEE80211_STA_RX_BW_40 && !bf->ncol) in mt7915_mcu_sta_bfer_tlv()
1231 bf->ibf_timeout = 0x48; in mt7915_mcu_sta_bfer_tlv()
1233 bf->ibf_timeout = 0x18; in mt7915_mcu_sta_bfer_tlv()
1235 if (ebf && bf->nrow != tx_ant) in mt7915_mcu_sta_bfer_tlv()
1236 bf->mem_20m = matrix[tx_ant][bf->ncol]; in mt7915_mcu_sta_bfer_tlv()
1238 bf->mem_20m = matrix[bf->nrow][bf->ncol]; in mt7915_mcu_sta_bfer_tlv()
1240 switch (sta->deflink.bandwidth) { in mt7915_mcu_sta_bfer_tlv()
1243 bf->mem_total = bf->mem_20m * 2; in mt7915_mcu_sta_bfer_tlv()
1246 bf->mem_total = bf->mem_20m; in mt7915_mcu_sta_bfer_tlv()
1258 struct mt7915_vif *mvif = (struct mt7915_vif *)vif->drv_priv; in mt7915_mcu_sta_bfee_tlv()
1259 struct mt7915_phy *phy = mvif->phy; in mt7915_mcu_sta_bfee_tlv()
1260 int tx_ant = hweight8(phy->mt76->chainmask) - 1; in mt7915_mcu_sta_bfee_tlv()
1265 if (!(sta->deflink.vht_cap.vht_supported || sta->deflink.he_cap.has_he)) in mt7915_mcu_sta_bfee_tlv()
1274 if (sta->deflink.he_cap.has_he) { in mt7915_mcu_sta_bfee_tlv()
1275 struct ieee80211_he_cap_elem *pe = &sta->deflink.he_cap.he_cap_elem; in mt7915_mcu_sta_bfee_tlv()
1278 pe->phy_cap_info[5]); in mt7915_mcu_sta_bfee_tlv()
1279 } else if (sta->deflink.vht_cap.vht_supported) { in mt7915_mcu_sta_bfee_tlv()
1280 struct ieee80211_sta_vht_cap *pc = &sta->deflink.vht_cap; in mt7915_mcu_sta_bfee_tlv()
1283 pc->cap); in mt7915_mcu_sta_bfee_tlv()
1287 bfee->fb_identity_matrix = (nrow == 1 && tx_ant == 2); in mt7915_mcu_sta_bfee_tlv()
1310 struct mt7915_vif *mvif = (struct mt7915_vif *)vif->drv_priv; in mt7915_mcu_set_fixed_rate_ctrl()
1311 struct mt7915_sta *msta = (struct mt7915_sta *)sta->drv_priv; in mt7915_mcu_set_fixed_rate_ctrl()
1317 skb = mt76_connac_mcu_alloc_sta_req(&dev->mt76, &mvif->mt76, in mt7915_mcu_set_fixed_rate_ctrl()
1318 &msta->wcid); in mt7915_mcu_set_fixed_rate_ctrl()
1333 ra->phy = *phy; in mt7915_mcu_set_fixed_rate_ctrl()
1336 ra->mmps_mode = mt7915_mcu_get_mmps_mode(sta->deflink.smps_mode); in mt7915_mcu_set_fixed_rate_ctrl()
1339 ra->spe_idx = *(u8 *)data; in mt7915_mcu_set_fixed_rate_ctrl()
1344 ra->field = cpu_to_le32(field); in mt7915_mcu_set_fixed_rate_ctrl()
1346 return mt76_mcu_skb_send_msg(&dev->mt76, skb, in mt7915_mcu_set_fixed_rate_ctrl()
1353 struct mt7915_vif *mvif = (struct mt7915_vif *)vif->drv_priv; in mt7915_mcu_add_smps()
1354 struct mt7915_sta *msta = (struct mt7915_sta *)sta->drv_priv; in mt7915_mcu_add_smps()
1360 skb = mt76_connac_mcu_alloc_sta_req(&dev->mt76, &mvif->mt76, in mt7915_mcu_add_smps()
1361 &msta->wcid); in mt7915_mcu_add_smps()
1367 wtbl_hdr = mt76_connac_mcu_alloc_wtbl_req(&dev->mt76, &msta->wcid, in mt7915_mcu_add_smps()
1374 ret = mt76_mcu_skb_send_msg(&dev->mt76, skb, in mt7915_mcu_add_smps()
1387 struct mt7915_vif *mvif = (struct mt7915_vif *)vif->drv_priv; in mt7915_mcu_set_spe_idx()
1388 struct mt76_phy *mphy = mvif->phy->mt76; in mt7915_mcu_set_spe_idx()
1389 u8 spe_idx = mt76_connac_spe_idx(mphy->antenna_mask); in mt7915_mcu_set_spe_idx()
1400 struct mt7915_vif *mvif = (struct mt7915_vif *)vif->drv_priv; in mt7915_mcu_add_rate_ctrl_fixed()
1401 struct cfg80211_chan_def *chandef = &mvif->phy->mt76->chandef; in mt7915_mcu_add_rate_ctrl_fixed()
1402 struct cfg80211_bitrate_mask *mask = &mvif->bitrate_mask; in mt7915_mcu_add_rate_ctrl_fixed()
1403 enum nl80211_band band = chandef->chan->band; in mt7915_mcu_add_rate_ctrl_fixed()
1409 u8 i, gi = mask->control[band]._gi; \ in mt7915_mcu_add_rate_ctrl_fixed()
1411 for (i = 0; i <= sta->deflink.bandwidth; i++) { \ in mt7915_mcu_add_rate_ctrl_fixed()
1413 phy.he_ltf |= mask->control[band].he_ltf << (i << (_he));\ in mt7915_mcu_add_rate_ctrl_fixed()
1415 for (i = 0; i < ARRAY_SIZE(mask->control[band]._mcs); i++) { \ in mt7915_mcu_add_rate_ctrl_fixed()
1416 if (!mask->control[band]._mcs[i]) \ in mt7915_mcu_add_rate_ctrl_fixed()
1418 nrates += hweight16(mask->control[band]._mcs[i]); \ in mt7915_mcu_add_rate_ctrl_fixed()
1419 phy.mcs = ffs(mask->control[band]._mcs[i]) - 1; \ in mt7915_mcu_add_rate_ctrl_fixed()
1425 if (sta->deflink.he_cap.has_he) { in mt7915_mcu_add_rate_ctrl_fixed()
1427 } else if (sta->deflink.vht_cap.vht_supported) { in mt7915_mcu_add_rate_ctrl_fixed()
1429 } else if (sta->deflink.ht_cap.ht_supported) { in mt7915_mcu_add_rate_ctrl_fixed()
1432 nrates = hweight32(mask->control[band].legacy); in mt7915_mcu_add_rate_ctrl_fixed()
1433 phy.mcs = ffs(mask->control[band].legacy) - 1; in mt7915_mcu_add_rate_ctrl_fixed()
1438 if (mask->control[band].gi == NL80211_TXRATE_DEFAULT_GI && in mt7915_mcu_add_rate_ctrl_fixed()
1439 mask->control[band].he_gi == GENMASK(7, 0) && in mt7915_mcu_add_rate_ctrl_fixed()
1440 mask->control[band].he_ltf == GENMASK(7, 0) && in mt7915_mcu_add_rate_ctrl_fixed()
1453 if (mask->control[band].gi != NL80211_TXRATE_DEFAULT_GI || in mt7915_mcu_add_rate_ctrl_fixed()
1454 mask->control[band].he_gi != GENMASK(7, 0)) { in mt7915_mcu_add_rate_ctrl_fixed()
1455 struct mt7915_sta *msta = (struct mt7915_sta *)sta->drv_priv; in mt7915_mcu_add_rate_ctrl_fixed()
1462 addr = mt7915_mac_wtbl_lmac_addr(dev, msta->wcid.idx, 7); in mt7915_mcu_add_rate_ctrl_fixed()
1463 if (sta->deflink.he_cap.has_he) in mt7915_mcu_add_rate_ctrl_fixed()
1475 if (mask->control[band].he_ltf != GENMASK(7, 0)) { in mt7915_mcu_add_rate_ctrl_fixed()
1489 struct mt7915_vif *mvif = (struct mt7915_vif *)vif->drv_priv; in mt7915_mcu_sta_rate_ctrl_tlv()
1490 struct mt76_phy *mphy = mvif->phy->mt76; in mt7915_mcu_sta_rate_ctrl_tlv()
1491 struct cfg80211_chan_def *chandef = &mphy->chandef; in mt7915_mcu_sta_rate_ctrl_tlv()
1492 struct cfg80211_bitrate_mask *mask = &mvif->bitrate_mask; in mt7915_mcu_sta_rate_ctrl_tlv()
1493 enum nl80211_band band = chandef->chan->band; in mt7915_mcu_sta_rate_ctrl_tlv()
1496 u32 supp_rate = sta->deflink.supp_rates[band]; in mt7915_mcu_sta_rate_ctrl_tlv()
1497 u32 cap = sta->wme ? STA_CAP_WMM : 0; in mt7915_mcu_sta_rate_ctrl_tlv()
1502 ra->valid = true; in mt7915_mcu_sta_rate_ctrl_tlv()
1503 ra->auto_rate = true; in mt7915_mcu_sta_rate_ctrl_tlv()
1504 ra->phy_mode = mt76_connac_get_phy_mode(mphy, vif, band, sta); in mt7915_mcu_sta_rate_ctrl_tlv()
1505 ra->channel = chandef->chan->hw_value; in mt7915_mcu_sta_rate_ctrl_tlv()
1506 ra->bw = sta->deflink.bandwidth; in mt7915_mcu_sta_rate_ctrl_tlv()
1507 ra->phy.bw = sta->deflink.bandwidth; in mt7915_mcu_sta_rate_ctrl_tlv()
1508 ra->mmps_mode = mt7915_mcu_get_mmps_mode(sta->deflink.smps_mode); in mt7915_mcu_sta_rate_ctrl_tlv()
1511 supp_rate &= mask->control[band].legacy; in mt7915_mcu_sta_rate_ctrl_tlv()
1512 ra->rate_len = hweight32(supp_rate); in mt7915_mcu_sta_rate_ctrl_tlv()
1515 ra->supp_mode = MODE_CCK; in mt7915_mcu_sta_rate_ctrl_tlv()
1516 ra->supp_cck_rate = supp_rate & GENMASK(3, 0); in mt7915_mcu_sta_rate_ctrl_tlv()
1518 if (ra->rate_len > 4) { in mt7915_mcu_sta_rate_ctrl_tlv()
1519 ra->supp_mode |= MODE_OFDM; in mt7915_mcu_sta_rate_ctrl_tlv()
1520 ra->supp_ofdm_rate = supp_rate >> 4; in mt7915_mcu_sta_rate_ctrl_tlv()
1523 ra->supp_mode = MODE_OFDM; in mt7915_mcu_sta_rate_ctrl_tlv()
1524 ra->supp_ofdm_rate = supp_rate; in mt7915_mcu_sta_rate_ctrl_tlv()
1528 if (sta->deflink.ht_cap.ht_supported) { in mt7915_mcu_sta_rate_ctrl_tlv()
1529 ra->supp_mode |= MODE_HT; in mt7915_mcu_sta_rate_ctrl_tlv()
1530 ra->af = sta->deflink.ht_cap.ampdu_factor; in mt7915_mcu_sta_rate_ctrl_tlv()
1531 ra->ht_gf = !!(sta->deflink.ht_cap.cap & IEEE80211_HT_CAP_GRN_FLD); in mt7915_mcu_sta_rate_ctrl_tlv()
1534 if (sta->deflink.ht_cap.cap & IEEE80211_HT_CAP_SGI_20) in mt7915_mcu_sta_rate_ctrl_tlv()
1536 if (sta->deflink.ht_cap.cap & IEEE80211_HT_CAP_SGI_40) in mt7915_mcu_sta_rate_ctrl_tlv()
1538 if (sta->deflink.ht_cap.cap & IEEE80211_HT_CAP_TX_STBC) in mt7915_mcu_sta_rate_ctrl_tlv()
1540 if (sta->deflink.ht_cap.cap & IEEE80211_HT_CAP_RX_STBC) in mt7915_mcu_sta_rate_ctrl_tlv()
1542 if (mvif->cap.ht_ldpc && in mt7915_mcu_sta_rate_ctrl_tlv()
1543 (sta->deflink.ht_cap.cap & IEEE80211_HT_CAP_LDPC_CODING)) in mt7915_mcu_sta_rate_ctrl_tlv()
1546 mt7915_mcu_set_sta_ht_mcs(sta, ra->ht_mcs, in mt7915_mcu_sta_rate_ctrl_tlv()
1547 mask->control[band].ht_mcs); in mt7915_mcu_sta_rate_ctrl_tlv()
1548 ra->supp_ht_mcs = *(__le32 *)ra->ht_mcs; in mt7915_mcu_sta_rate_ctrl_tlv()
1551 if (sta->deflink.vht_cap.vht_supported) { in mt7915_mcu_sta_rate_ctrl_tlv()
1554 ra->supp_mode |= MODE_VHT; in mt7915_mcu_sta_rate_ctrl_tlv()
1556 sta->deflink.vht_cap.cap); in mt7915_mcu_sta_rate_ctrl_tlv()
1557 ra->af = max_t(u8, ra->af, af); in mt7915_mcu_sta_rate_ctrl_tlv()
1560 if (sta->deflink.vht_cap.cap & IEEE80211_VHT_CAP_SHORT_GI_80) in mt7915_mcu_sta_rate_ctrl_tlv()
1562 if (sta->deflink.vht_cap.cap & IEEE80211_VHT_CAP_SHORT_GI_160) in mt7915_mcu_sta_rate_ctrl_tlv()
1564 if (sta->deflink.vht_cap.cap & IEEE80211_VHT_CAP_TXSTBC) in mt7915_mcu_sta_rate_ctrl_tlv()
1566 if (sta->deflink.vht_cap.cap & IEEE80211_VHT_CAP_RXSTBC_1) in mt7915_mcu_sta_rate_ctrl_tlv()
1568 if (mvif->cap.vht_ldpc && in mt7915_mcu_sta_rate_ctrl_tlv()
1569 (sta->deflink.vht_cap.cap & IEEE80211_VHT_CAP_RXLDPC)) in mt7915_mcu_sta_rate_ctrl_tlv()
1572 mt7915_mcu_set_sta_vht_mcs(sta, ra->supp_vht_mcs, in mt7915_mcu_sta_rate_ctrl_tlv()
1573 mask->control[band].vht_mcs); in mt7915_mcu_sta_rate_ctrl_tlv()
1576 if (sta->deflink.he_cap.has_he) { in mt7915_mcu_sta_rate_ctrl_tlv()
1577 ra->supp_mode |= MODE_HE; in mt7915_mcu_sta_rate_ctrl_tlv()
1580 if (sta->deflink.he_6ghz_capa.capa) in mt7915_mcu_sta_rate_ctrl_tlv()
1581 ra->af = le16_get_bits(sta->deflink.he_6ghz_capa.capa, in mt7915_mcu_sta_rate_ctrl_tlv()
1585 ra->sta_cap = cpu_to_le32(cap); in mt7915_mcu_sta_rate_ctrl_tlv()
1591 struct mt7915_vif *mvif = (struct mt7915_vif *)vif->drv_priv; in mt7915_mcu_add_rate_ctrl()
1592 struct mt7915_sta *msta = (struct mt7915_sta *)sta->drv_priv; in mt7915_mcu_add_rate_ctrl()
1596 skb = mt76_connac_mcu_alloc_sta_req(&dev->mt76, &mvif->mt76, in mt7915_mcu_add_rate_ctrl()
1597 &msta->wcid); in mt7915_mcu_add_rate_ctrl()
1602 * once dev->rc_work changes the settings driver should also in mt7915_mcu_add_rate_ctrl()
1609 * i.e 0-{7,8,9} for VHT. in mt7915_mcu_add_rate_ctrl()
1613 ret = mt76_mcu_skb_send_msg(&dev->mt76, skb, in mt7915_mcu_add_rate_ctrl()
1630 struct mt7915_vif *mvif = (struct mt7915_vif *)vif->drv_priv; in mt7915_mcu_add_group()
1642 .val = cpu_to_le32(mvif->mt76.idx % 16), in mt7915_mcu_add_group()
1645 msta = sta ? (struct mt7915_sta *)sta->drv_priv : &mvif->sta; in mt7915_mcu_add_group()
1646 req.wlan_idx_lo = to_wcid_lo(msta->wcid.idx); in mt7915_mcu_add_group()
1647 req.wlan_idx_hi = to_wcid_hi(msta->wcid.idx); in mt7915_mcu_add_group()
1649 return mt76_mcu_send_msg(&dev->mt76, MCU_EXT_CMD(SET_DRR_CTRL), &req, in mt7915_mcu_add_group()
1656 struct mt7915_vif *mvif = (struct mt7915_vif *)vif->drv_priv; in mt7915_mcu_add_sta()
1661 msta = sta ? (struct mt7915_sta *)sta->drv_priv : &mvif->sta; in mt7915_mcu_add_sta()
1663 skb = mt76_connac_mcu_alloc_sta_req(&dev->mt76, &mvif->mt76, in mt7915_mcu_add_sta()
1664 &msta->wcid); in mt7915_mcu_add_sta()
1669 mt76_connac_mcu_sta_basic_tlv(&dev->mt76, skb, vif, sta, enable, in mt7915_mcu_add_sta()
1670 !rcu_access_pointer(dev->mt76.wcid[msta->wcid.idx])); in mt7915_mcu_add_sta()
1709 ret = mt76_connac_mcu_sta_wed_update(&dev->mt76, skb); in mt7915_mcu_add_sta()
1713 return mt76_mcu_skb_send_msg(&dev->mt76, skb, in mt7915_mcu_add_sta()
1720 struct mtk_wed_device *wed = &dev->mt76.mmio.wed; in mt7915_mcu_wed_enable_rx_stats()
1738 struct mt7915_dev *dev = phy->dev; in mt7915_mcu_add_dev_info()
1739 struct mt7915_vif *mvif = (struct mt7915_vif *)vif->drv_priv; in mt7915_mcu_add_dev_info()
1757 .omac_idx = mvif->mt76.omac_idx, in mt7915_mcu_add_dev_info()
1758 .band_idx = mvif->mt76.band_idx, in mt7915_mcu_add_dev_info()
1766 .band_idx = mvif->mt76.band_idx, in mt7915_mcu_add_dev_info()
1770 if (mvif->mt76.omac_idx >= REPEATER_BSSID_START) in mt7915_mcu_add_dev_info()
1773 memcpy(data.tlv.omac_addr, vif->addr, ETH_ALEN); in mt7915_mcu_add_dev_info()
1774 return mt76_mcu_send_msg(&dev->mt76, MCU_EXT_CMD(DEV_INFO_UPDATE), in mt7915_mcu_add_dev_info()
1787 if (!offs->cntdwn_counter_offs[0]) in mt7915_mcu_beacon_cntdwn()
1790 sub_tag = vif->bss_conf.csa_active ? BSS_INFO_BCN_CSA : BSS_INFO_BCN_BCC; in mt7915_mcu_beacon_cntdwn()
1792 &bcn->sub_ntlv, &bcn->len); in mt7915_mcu_beacon_cntdwn()
1794 info->cnt = skb->data[offs->cntdwn_counter_offs[0]]; in mt7915_mcu_beacon_cntdwn()
1806 if (!vif->bss_conf.bssid_indicator) in mt7915_mcu_beacon_mbss()
1810 sizeof(*mbss), &bcn->sub_ntlv, in mt7915_mcu_beacon_mbss()
1811 &bcn->len); in mt7915_mcu_beacon_mbss()
1814 mbss->offset[0] = cpu_to_le16(offs->tim_offset); in mt7915_mcu_beacon_mbss()
1815 mbss->bitmap = cpu_to_le32(1); in mt7915_mcu_beacon_mbss()
1818 &skb->data[offs->mbssid_off], in mt7915_mcu_beacon_mbss()
1819 skb->len - offs->mbssid_off) { in mt7915_mcu_beacon_mbss()
1822 if (elem->datalen < 2) in mt7915_mcu_beacon_mbss()
1825 for_each_element(sub_elem, elem->data + 1, elem->datalen - 1) { in mt7915_mcu_beacon_mbss()
1829 if (sub_elem->id || sub_elem->datalen < 4) in mt7915_mcu_beacon_mbss()
1836 sub_elem->data, in mt7915_mcu_beacon_mbss()
1837 sub_elem->datalen); in mt7915_mcu_beacon_mbss()
1846 if (!idx->bssid_index || idx->bssid_index > 31) in mt7915_mcu_beacon_mbss()
1849 mbss->offset[idx->bssid_index] = in mt7915_mcu_beacon_mbss()
1850 cpu_to_le16(idx_ie - skb->data); in mt7915_mcu_beacon_mbss()
1851 mbss->bitmap |= cpu_to_le32(BIT(idx->bssid_index)); in mt7915_mcu_beacon_mbss()
1862 struct mt76_wcid *wcid = &dev->mt76.global_wcid; in mt7915_mcu_beacon_cont()
1866 int len = sizeof(*cont) + MT_TXD_SIZE + skb->len; in mt7915_mcu_beacon_cont()
1870 len, &bcn->sub_ntlv, &bcn->len); in mt7915_mcu_beacon_cont()
1873 cont->pkt_len = cpu_to_le16(MT_TXD_SIZE + skb->len); in mt7915_mcu_beacon_cont()
1874 cont->tim_ofs = cpu_to_le16(offs->tim_offset); in mt7915_mcu_beacon_cont()
1876 if (offs->cntdwn_counter_offs[0]) { in mt7915_mcu_beacon_cont()
1877 u16 offset = offs->cntdwn_counter_offs[0]; in mt7915_mcu_beacon_cont()
1879 if (vif->bss_conf.csa_active) in mt7915_mcu_beacon_cont()
1880 cont->csa_ofs = cpu_to_le16(offset - 4); in mt7915_mcu_beacon_cont()
1881 if (vif->bss_conf.color_change_active) in mt7915_mcu_beacon_cont()
1882 cont->bcc_ofs = cpu_to_le16(offset - 3); in mt7915_mcu_beacon_cont()
1886 mt7915_mac_write_txwi(&dev->mt76, (__le32 *)buf, skb, wcid, 0, NULL, in mt7915_mcu_beacon_cont()
1888 memcpy(buf + MT_TXD_SIZE, skb->data, skb->len); in mt7915_mcu_beacon_cont()
1898 struct ieee80211_hw *hw = mt76_hw(dev); in mt7915_mcu_beacon_inband_discov() local
1899 struct mt7915_phy *phy = mt7915_hw_phy(hw); in mt7915_mcu_beacon_inband_discov()
1900 struct mt7915_vif *mvif = (struct mt7915_vif *)vif->drv_priv; in mt7915_mcu_beacon_inband_discov()
1901 struct cfg80211_chan_def *chandef = &mvif->phy->mt76->chandef; in mt7915_mcu_beacon_inband_discov()
1902 enum nl80211_band band = chandef->chan->band; in mt7915_mcu_beacon_inband_discov()
1903 struct mt76_wcid *wcid = &dev->mt76.global_wcid; in mt7915_mcu_beacon_inband_discov()
1908 bool ext_phy = phy != &dev->phy; in mt7915_mcu_beacon_inband_discov()
1913 vif->bss_conf.fils_discovery.max_interval) { in mt7915_mcu_beacon_inband_discov()
1914 interval = vif->bss_conf.fils_discovery.max_interval; in mt7915_mcu_beacon_inband_discov()
1915 skb = ieee80211_get_fils_discovery_tmpl(hw, vif); in mt7915_mcu_beacon_inband_discov()
1917 vif->bss_conf.unsol_bcast_probe_resp_interval) { in mt7915_mcu_beacon_inband_discov()
1918 interval = vif->bss_conf.unsol_bcast_probe_resp_interval; in mt7915_mcu_beacon_inband_discov()
1919 skb = ieee80211_get_unsol_bcast_probe_resp_tmpl(hw, vif); in mt7915_mcu_beacon_inband_discov()
1926 info->control.vif = vif; in mt7915_mcu_beacon_inband_discov()
1927 info->band = band; in mt7915_mcu_beacon_inband_discov()
1929 info->hw_queue |= FIELD_PREP(MT_TX_HW_QUEUE_PHY, ext_phy); in mt7915_mcu_beacon_inband_discov()
1931 len = sizeof(*discov) + MT_TXD_SIZE + skb->len; in mt7915_mcu_beacon_inband_discov()
1934 if (len > (MT7915_MAX_BSS_OFFLOAD_SIZE - rskb->len)) { in mt7915_mcu_beacon_inband_discov()
1935 dev_err(dev->mt76.dev, "inband discovery size limit exceed\n"); in mt7915_mcu_beacon_inband_discov()
1941 len, &bcn->sub_ntlv, &bcn->len); in mt7915_mcu_beacon_inband_discov()
1943 discov->tx_mode = OFFLOAD_TX_MODE_SU; in mt7915_mcu_beacon_inband_discov()
1945 discov->tx_type = !!(changed & BSS_CHANGED_FILS_DISCOVERY); in mt7915_mcu_beacon_inband_discov()
1946 discov->tx_interval = interval; in mt7915_mcu_beacon_inband_discov()
1947 discov->prob_rsp_len = cpu_to_le16(MT_TXD_SIZE + skb->len); in mt7915_mcu_beacon_inband_discov()
1948 discov->enable = true; in mt7915_mcu_beacon_inband_discov()
1952 mt7915_mac_write_txwi(&dev->mt76, (__le32 *)buf, skb, wcid, 0, NULL, in mt7915_mcu_beacon_inband_discov()
1954 memcpy(buf + MT_TXD_SIZE, skb->data, skb->len); in mt7915_mcu_beacon_inband_discov()
1959 int mt7915_mcu_add_beacon(struct ieee80211_hw *hw, struct ieee80211_vif *vif, in mt7915_mcu_add_beacon() argument
1962 struct mt7915_dev *dev = mt7915_hw_dev(hw); in mt7915_mcu_add_beacon()
1963 struct mt7915_phy *phy = mt7915_hw_phy(hw); in mt7915_mcu_add_beacon()
1964 struct mt7915_vif *mvif = (struct mt7915_vif *)vif->drv_priv; in mt7915_mcu_add_beacon()
1971 bool ext_phy = phy != &dev->phy; in mt7915_mcu_add_beacon()
1973 if (vif->bss_conf.nontransmitted) in mt7915_mcu_add_beacon()
1976 rskb = __mt76_connac_mcu_alloc_sta_req(&dev->mt76, &mvif->mt76, in mt7915_mcu_add_beacon()
1983 bcn->enable = en; in mt7915_mcu_add_beacon()
1988 skb = ieee80211_beacon_get_template(hw, vif, &offs, 0); in mt7915_mcu_add_beacon()
1990 return -EINVAL; in mt7915_mcu_add_beacon()
1992 if (skb->len > MT7915_MAX_BEACON_SIZE - MT_TXD_SIZE) { in mt7915_mcu_add_beacon()
1993 dev_err(dev->mt76.dev, "Bcn size limit exceed\n"); in mt7915_mcu_add_beacon()
1995 return -EINVAL; in mt7915_mcu_add_beacon()
1999 info->hw_queue = FIELD_PREP(MT_TX_HW_QUEUE_PHY, ext_phy); in mt7915_mcu_add_beacon()
2012 return mt76_mcu_skb_send_msg(&phy->dev->mt76, rskb, in mt7915_mcu_add_beacon()
2021 dev_err(dev->mt76.dev, "Timeout for driver own\n"); in mt7915_driver_own()
2022 return -EIO; in mt7915_driver_own()
2040 dev_err(dev->mt76.dev, "Timeout for initializing firmware\n"); in mt7915_firmware_state()
2041 return -EIO; in mt7915_firmware_state()
2053 mt76_connac_mcu_restart(&dev->mt76); in mt7915_load_firmware()
2056 dev_err(dev->mt76.dev, in mt7915_load_firmware()
2062 ret = mt76_connac2_load_patch(&dev->mt76, fw_name_var(dev, ROM_PATCH)); in mt7915_load_firmware()
2066 ret = mt76_connac2_load_ram(&dev->mt76, fw_name_var(dev, FIRMWARE_WM), in mt7915_load_firmware()
2075 mt76_queue_tx_cleanup(dev, dev->mt76.q_mcu[MT_MCUQ_FWDL], false); in mt7915_load_firmware()
2077 dev_dbg(dev->mt76.dev, "Firmware init done\n"); in mt7915_load_firmware()
2082 int mt7915_mcu_fw_log_2_host(struct mt7915_dev *dev, u8 type, u8 ctrl) in mt7915_mcu_fw_log_2_host() argument
2088 .ctrl_val = ctrl in mt7915_mcu_fw_log_2_host()
2092 return mt76_mcu_send_msg(&dev->mt76, MCU_WA_EXT_CMD(FW_LOG_2_HOST), in mt7915_mcu_fw_log_2_host()
2095 return mt76_mcu_send_msg(&dev->mt76, MCU_EXT_CMD(FW_LOG_2_HOST), &data, in mt7915_mcu_fw_log_2_host()
2113 return mt76_mcu_send_msg(&dev->mt76, MCU_EXT_CMD(FW_DBG_CTRL), &data, in mt7915_mcu_fw_dbg_ctrl()
2127 return mt76_mcu_send_msg(&dev->mt76, MCU_EXT_CMD(MURU_CTRL), &data, in mt7915_mcu_muru_debug_set()
2133 struct mt7915_dev *dev = phy->dev; in mt7915_mcu_muru_debug_get()
2143 .band_idx = phy->mt76->band_idx, in mt7915_mcu_muru_debug_get()
2146 ret = mt76_mcu_send_and_get_msg(&dev->mt76, MCU_EXT_CMD(MURU_CTRL), in mt7915_mcu_muru_debug_get()
2151 mu_stats = (struct mt7915_mcu_muru_stats *)(skb->data); in mt7915_mcu_muru_debug_get()
2153 /* accumulate stats, these are clear-on-read */ in mt7915_mcu_muru_debug_get()
2154 #define __dl_u32(s) phy->mib.dl_##s += le32_to_cpu(mu_stats->dl.s) in mt7915_mcu_muru_debug_get()
2155 #define __ul_u32(s) phy->mib.ul_##s += le32_to_cpu(mu_stats->ul.s) in mt7915_mcu_muru_debug_get()
2202 return mt76_mcu_send_msg(&dev->mt76, MCU_WA_EXT_CMD(MWDS_SUPPORT), &req, in mt7915_mcu_set_mwds()
2217 return mt76_mcu_send_msg(&dev->mt76, MCU_EXT_CMD(MURU_CTRL), &req, in mt7915_mcu_set_muru_ctrl()
2249 ret = mt76_mcu_send_msg(&dev->mt76, MCU_EXT_CMD(RX_AIRTIME_CTRL), &req, in mt7915_mcu_init_rx_airtime()
2258 return mt76_mcu_send_msg(&dev->mt76, MCU_EXT_CMD(RX_AIRTIME_CTRL), &req, in mt7915_mcu_init_rx_airtime()
2277 .len = cpu_to_le16(sizeof(req) - sizeof(req.args)), in mt7915_red_set_watermark()
2278 .high_mark = cpu_to_le16(MT7915_HW_TOKEN_SIZE - 256), in mt7915_red_set_watermark()
2279 .low_mark = cpu_to_le16(MT7915_HW_TOKEN_SIZE - 256 - 1536), in mt7915_red_set_watermark()
2282 return mt76_mcu_send_msg(&dev->mt76, MCU_WA_PARAM_CMD(SET), &req, in mt7915_red_set_watermark()
2300 ret = mt76_mcu_send_msg(&dev->mt76, MCU_EXT_CMD(RED_ENABLE), &req, in mt7915_mcu_set_red()
2322 if (dev->hif2) { in mt7915_mcu_init_firmware()
2332 set_bit(MT76_STATE_MCU_RUNNING, &dev->mphy.state); in mt7915_mcu_init_firmware()
2341 if ((mtk_wed_device_active(&dev->mt76.mmio.wed) && in mt7915_mcu_init_firmware()
2342 is_mt7915(&dev->mt76)) || in mt7915_mcu_init_firmware()
2343 !mtk_wed_get_rx_capa(&dev->mt76.mmio.wed)) in mt7915_mcu_init_firmware()
2359 return mt7915_mcu_set_red(dev, mtk_wed_device_active(&dev->mt76.mmio.wed)); in mt7915_mcu_init_firmware()
2370 dev->mt76.mcu_ops = &mt7915_mcu_ops; in mt7915_mcu_init()
2377 mt76_connac_mcu_restart(&dev->mt76); in mt7915_mcu_exit()
2379 dev_err(dev->mt76.dev, "Failed to exit mcu\n"); in mt7915_mcu_exit()
2384 if (dev->hif2) in mt7915_mcu_exit()
2388 skb_queue_purge(&dev->mt76.mcu.res_q); in mt7915_mcu_exit()
2408 return mt76_mcu_send_msg(&dev->mt76, MCU_EXT_CMD(RX_HDR_TRANS), in mt7915_mcu_set_rx_hdr_trans_blacklist()
2437 ret = mt76_mcu_send_msg(&dev->mt76, MCU_EXT_CMD(RX_HDR_TRANS), in mt7915_mcu_set_mac()
2445 return mt76_mcu_send_msg(&dev->mt76, MCU_EXT_CMD(MAC_INIT_CTRL), in mt7915_mcu_set_mac()
2452 u8 num = req->total; in mt7915_mcu_update_edca()
2453 size_t len = sizeof(*req) - in mt7915_mcu_update_edca()
2454 (IEEE80211_NUM_ACS - num) * sizeof(struct edca); in mt7915_mcu_update_edca()
2456 return mt76_mcu_send_msg(&dev->mt76, MCU_EXT_CMD(EDCA_UPDATE), req, in mt7915_mcu_update_edca()
2468 struct mt7915_vif *mvif = (struct mt7915_vif *)vif->drv_priv; in mt7915_mcu_set_tx()
2472 struct ieee80211_tx_queue_params *q = &mvif->queue_params[ac]; in mt7915_mcu_set_tx()
2475 e->set = WMM_PARAM_SET; in mt7915_mcu_set_tx()
2476 e->queue = ac + mvif->mt76.wmm_idx * MT76_CONNAC_MAX_WMM_SETS; in mt7915_mcu_set_tx()
2477 e->aifs = q->aifs; in mt7915_mcu_set_tx()
2478 e->txop = cpu_to_le16(q->txop); in mt7915_mcu_set_tx()
2480 if (q->cw_min) in mt7915_mcu_set_tx()
2481 e->cw_min = fls(q->cw_min); in mt7915_mcu_set_tx()
2483 e->cw_min = 5; in mt7915_mcu_set_tx()
2485 if (q->cw_max) in mt7915_mcu_set_tx()
2486 e->cw_max = cpu_to_le16(fls(q->cw_max)); in mt7915_mcu_set_tx()
2488 e->cw_max = cpu_to_le16(10); in mt7915_mcu_set_tx()
2505 return mt76_mcu_send_msg(&dev->mt76, MCU_EXT_CMD(SET_RDD_TH), &req, in mt7915_mcu_set_fcc5_lpn()
2525 #define __req_field(field) .field = cpu_to_le32(pulse->field) in mt7915_mcu_set_pulse_th()
2536 return mt76_mcu_send_msg(&dev->mt76, MCU_EXT_CMD(SET_RDD_TH), &req, in mt7915_mcu_set_pulse_th()
2567 #define __req_field_u8(field) .field = pattern->field in mt7915_mcu_set_radar_th()
2568 #define __req_field_u32(field) .field = cpu_to_le32(pattern->field) in mt7915_mcu_set_radar_th()
2588 return mt76_mcu_send_msg(&dev->mt76, MCU_EXT_CMD(SET_RDD_TH), &req, in mt7915_mcu_set_radar_th()
2597 struct mt7915_dev *dev = phy->dev; in mt7915_mcu_background_chain_ctrl()
2598 struct mt76_phy *mphy = phy->mt76; in mt7915_mcu_background_chain_ctrl()
2599 struct ieee80211_channel *chan = mphy->chandef.chan; in mt7915_mcu_background_chain_ctrl()
2600 int freq = mphy->chandef.center_freq1; in mt7915_mcu_background_chain_ctrl()
2606 return -EINVAL; in mt7915_mcu_background_chain_ctrl()
2608 if (!cfg80211_chandef_valid(&mphy->chandef)) in mt7915_mcu_background_chain_ctrl()
2609 return -EINVAL; in mt7915_mcu_background_chain_ctrl()
2613 req.chan = chan->hw_value; in mt7915_mcu_background_chain_ctrl()
2615 req.bw = mt76_connac_chan_bw(&mphy->chandef); in mt7915_mcu_background_chain_ctrl()
2616 req.monitor_chan = chandef->chan->hw_value; in mt7915_mcu_background_chain_ctrl()
2618 ieee80211_frequency_to_channel(chandef->center_freq1); in mt7915_mcu_background_chain_ctrl()
2620 req.band_idx = phy->mt76->band_idx; in mt7915_mcu_background_chain_ctrl()
2625 req.monitor_chan = chandef->chan->hw_value; in mt7915_mcu_background_chain_ctrl()
2627 ieee80211_frequency_to_channel(chandef->center_freq1); in mt7915_mcu_background_chain_ctrl()
2628 req.band_idx = phy->mt76->band_idx; in mt7915_mcu_background_chain_ctrl()
2632 req.chan = chan->hw_value; in mt7915_mcu_background_chain_ctrl()
2634 req.bw = mt76_connac_chan_bw(&mphy->chandef); in mt7915_mcu_background_chain_ctrl()
2635 req.tx_stream = hweight8(mphy->antenna_mask); in mt7915_mcu_background_chain_ctrl()
2636 req.rx_stream = mphy->antenna_mask; in mt7915_mcu_background_chain_ctrl()
2639 return -EINVAL; in mt7915_mcu_background_chain_ctrl()
2641 req.band = chandef ? chandef->chan->band == NL80211_BAND_5GHZ : 1; in mt7915_mcu_background_chain_ctrl()
2643 return mt76_mcu_send_msg(&dev->mt76, MCU_EXT_CMD(OFFCH_SCAN_CTRL), in mt7915_mcu_background_chain_ctrl()
2650 struct mt7915_dev *dev = phy->dev; in mt7915_mcu_rdd_background_enable()
2654 err = mt76_connac_mcu_rdd_cmd(&dev->mt76, RDD_STOP, MT_RX_SEL2, in mt7915_mcu_rdd_background_enable()
2668 switch (dev->mt76.region) { in mt7915_mcu_rdd_background_enable()
2681 return mt76_connac_mcu_rdd_cmd(&dev->mt76, RDD_START, MT_RX_SEL2, in mt7915_mcu_rdd_background_enable()
2692 struct mt7915_dev *dev = phy->dev; in mt7915_mcu_set_chan_info()
2693 struct cfg80211_chan_def *chandef = &phy->mt76->chandef; in mt7915_mcu_set_chan_info()
2694 int freq1 = chandef->center_freq1; in mt7915_mcu_set_chan_info()
2695 u8 band = phy->mt76->band_idx; in mt7915_mcu_set_chan_info()
2714 .control_ch = chandef->chan->hw_value, in mt7915_mcu_set_chan_info()
2717 .tx_path_num = hweight16(phy->mt76->chainmask), in mt7915_mcu_set_chan_info()
2718 .rx_path = phy->mt76->chainmask >> (dev->chainshift * band), in mt7915_mcu_set_chan_info()
2720 .channel_band = ch_band[chandef->chan->band], in mt7915_mcu_set_chan_info()
2724 if (phy->mt76->test.tx_antenna_mask && in mt7915_mcu_set_chan_info()
2725 mt76_testmode_enabled(phy->mt76)) { in mt7915_mcu_set_chan_info()
2726 req.tx_path_num = fls(phy->mt76->test.tx_antenna_mask); in mt7915_mcu_set_chan_info()
2727 req.rx_path = phy->mt76->test.tx_antenna_mask; in mt7915_mcu_set_chan_info()
2731 if (mt76_connac_spe_idx(phy->mt76->antenna_mask)) in mt7915_mcu_set_chan_info()
2732 req.tx_path_num = fls(phy->mt76->antenna_mask); in mt7915_mcu_set_chan_info()
2735 dev->mt76.hw->conf.flags & IEEE80211_CONF_MONITOR) in mt7915_mcu_set_chan_info()
2737 else if (phy->mt76->hw->conf.flags & IEEE80211_CONF_OFFCHANNEL) in mt7915_mcu_set_chan_info()
2739 else if (!cfg80211_reg_can_beacon(phy->mt76->hw->wiphy, chandef, in mt7915_mcu_set_chan_info()
2748 if (chandef->width == NL80211_CHAN_WIDTH_80P80) { in mt7915_mcu_set_chan_info()
2749 int freq2 = chandef->center_freq2; in mt7915_mcu_set_chan_info()
2754 return mt76_mcu_send_msg(&dev->mt76, cmd, &req, sizeof(req), true); in mt7915_mcu_set_chan_info()
2765 u8 *eep = (u8 *)dev->mt76.eeprom.data; in mt7915_mcu_set_eeprom_flash()
2773 if (i == total - 1 && !!(eeprom_size % PER_PAGE_SIZE)) in mt7915_mcu_set_eeprom_flash()
2778 skb = mt76_mcu_msg_alloc(&dev->mt76, NULL, in mt7915_mcu_set_eeprom_flash()
2781 return -ENOMEM; in mt7915_mcu_set_eeprom_flash()
2783 req.format = FIELD_PREP(MAX_PAGE_IDX_MASK, total - 1) | in mt7915_mcu_set_eeprom_flash()
2790 ret = mt76_mcu_skb_send_msg(&dev->mt76, skb, in mt7915_mcu_set_eeprom_flash()
2806 if (dev->flash_mode) in mt7915_mcu_set_eeprom()
2809 return mt76_mcu_send_msg(&dev->mt76, MCU_EXT_CMD(EFUSE_BUFFER_MODE), in mt7915_mcu_set_eeprom()
2824 ret = mt76_mcu_send_and_get_msg(&dev->mt76, in mt7915_mcu_get_eeprom()
2830 res = (struct mt7915_mcu_eeprom_info *)skb->data; in mt7915_mcu_get_eeprom()
2832 buf = dev->mt76.eeprom.data + le32_to_cpu(res->addr); in mt7915_mcu_get_eeprom()
2834 buf = (u8 *)dev->mt76.eeprom.data + le32_to_cpu(res->addr); in mt7915_mcu_get_eeprom()
2836 memcpy(buf, res->data, MT7915_EEPROM_BLOCK_SIZE); in mt7915_mcu_get_eeprom()
2855 ret = mt76_mcu_send_and_get_msg(&dev->mt76, in mt7915_mcu_get_eeprom_free_block()
2861 *block_num = *(u8 *)skb->data; in mt7915_mcu_get_eeprom_free_block()
2883 skb = mt76_mcu_msg_alloc(&dev->mt76, NULL, sizeof(req) + len); in mt7915_mcu_set_pre_cal()
2885 return -ENOMEM; in mt7915_mcu_set_pre_cal()
2892 return mt76_mcu_skb_send_msg(&dev->mt76, skb, cmd, false); in mt7915_mcu_set_pre_cal()
2897 u8 idx = 0, *cal = dev->cal, *eep = dev->mt76.eeprom.data; in mt7915_mcu_apply_group_cal()
2917 total -= len; in mt7915_mcu_apply_group_cal()
2933 return -1; in mt7915_find_freq_idx()
2959 return -1; in mt7915_dpd_freq_idx()
2968 freq - 10); in mt7915_dpd_freq_idx()
2978 struct mt7915_dev *dev = phy->dev; in mt7915_mcu_apply_tx_dpd()
2979 struct cfg80211_chan_def *chandef = &phy->mt76->chandef; in mt7915_mcu_apply_tx_dpd()
2980 u16 total = 2, center_freq = chandef->center_freq1; in mt7915_mcu_apply_tx_dpd()
2981 u8 *cal = dev->cal, *eep = dev->mt76.eeprom.data; in mt7915_mcu_apply_tx_dpd()
2987 idx = mt7915_dpd_freq_idx(center_freq, chandef->width); in mt7915_mcu_apply_tx_dpd()
2989 return -EINVAL; in mt7915_mcu_apply_tx_dpd()
2995 while (total--) { in mt7915_mcu_apply_tx_dpd()
3012 struct mt76_channel_state *state = phy->mt76->chan_state; in mt7915_mcu_get_chan_mib_info()
3013 struct mt76_channel_state *state_ts = &phy->state_ts; in mt7915_mcu_get_chan_mib_info()
3014 struct mt7915_dev *dev = phy->dev; in mt7915_mcu_get_chan_mib_info()
3022 if (is_mt7915(&dev->mt76)) { in mt7915_mcu_get_chan_mib_info()
3046 req[i].band = cpu_to_le32(phy->mt76->band_idx); in mt7915_mcu_get_chan_mib_info()
3050 ret = mt76_mcu_send_and_get_msg(&dev->mt76, MCU_EXT_CMD(GET_MIB_INFO), in mt7915_mcu_get_chan_mib_info()
3055 res = (struct mt7915_mcu_mib *)(skb->data + offs_cc); in mt7915_mcu_get_chan_mib_info()
3059 cc_tx = is_mt7915(&dev->mt76) ? __res_u64(1) - __res_u64(4) : __res_u64(1); in mt7915_mcu_get_chan_mib_info()
3064 state->cc_tx += cc_tx - state_ts->cc_tx; in mt7915_mcu_get_chan_mib_info()
3065 state->cc_bss_rx += __res_u64(2) - state_ts->cc_bss_rx; in mt7915_mcu_get_chan_mib_info()
3066 state->cc_rx += __res_u64(2) + __res_u64(3) - state_ts->cc_rx; in mt7915_mcu_get_chan_mib_info()
3067 state->cc_busy += __res_u64(0) + cc_tx + __res_u64(2) + __res_u64(3) - in mt7915_mcu_get_chan_mib_info()
3068 state_ts->cc_busy; in mt7915_mcu_get_chan_mib_info()
3071 state_ts->cc_tx = cc_tx; in mt7915_mcu_get_chan_mib_info()
3072 state_ts->cc_bss_rx = __res_u64(2); in mt7915_mcu_get_chan_mib_info()
3073 state_ts->cc_rx = __res_u64(2) + __res_u64(3); in mt7915_mcu_get_chan_mib_info()
3074 state_ts->cc_busy = __res_u64(0) + cc_tx + __res_u64(2) + __res_u64(3); in mt7915_mcu_get_chan_mib_info()
3084 struct mt7915_dev *dev = phy->dev; in mt7915_mcu_get_temperature()
3092 .band_idx = phy->mt76->band_idx, in mt7915_mcu_get_temperature()
3095 return mt76_mcu_send_msg(&dev->mt76, MCU_EXT_CMD(THERMAL_CTRL), &req, in mt7915_mcu_get_temperature()
3101 struct mt7915_dev *dev = phy->dev; in mt7915_mcu_set_thermal_throttling()
3103 .band_idx = phy->mt76->band_idx, in mt7915_mcu_set_thermal_throttling()
3114 ret = mt76_mcu_send_msg(&dev->mt76, MCU_EXT_CMD(THERMAL_PROT), in mt7915_mcu_set_thermal_throttling()
3124 struct mt7915_dev *dev = phy->dev; in mt7915_mcu_set_thermal_protect()
3126 struct mt7915_mcu_thermal_ctrl ctrl; in mt7915_mcu_set_thermal_protect() member
3133 .ctrl = { in mt7915_mcu_set_thermal_protect()
3134 .band_idx = phy->mt76->band_idx, in mt7915_mcu_set_thermal_protect()
3141 req.ctrl.ctrl_id = THERMAL_PROTECT_DISABLE; in mt7915_mcu_set_thermal_protect()
3142 ret = mt76_mcu_send_msg(&dev->mt76, MCU_EXT_CMD(THERMAL_PROT), in mt7915_mcu_set_thermal_protect()
3143 &req, sizeof(req.ctrl), false); in mt7915_mcu_set_thermal_protect()
3148 /* set high-temperature trigger threshold */ in mt7915_mcu_set_thermal_protect()
3149 req.ctrl.ctrl_id = THERMAL_PROTECT_ENABLE; in mt7915_mcu_set_thermal_protect()
3151 req.restore_temp = cpu_to_le32(phy->throttle_temp[0] - 10); in mt7915_mcu_set_thermal_protect()
3152 req.trigger_temp = cpu_to_le32(phy->throttle_temp[1]); in mt7915_mcu_set_thermal_protect()
3155 return mt76_mcu_send_msg(&dev->mt76, MCU_EXT_CMD(THERMAL_PROT), in mt7915_mcu_set_thermal_protect()
3161 struct mt7915_dev *dev = phy->dev; in mt7915_mcu_set_txpower_frame_min()
3169 .band_idx = phy->mt76->band_idx, in mt7915_mcu_set_txpower_frame_min()
3173 return mt76_mcu_send_msg(&dev->mt76, in mt7915_mcu_set_txpower_frame_min()
3182 struct mt7915_sta *msta = (struct mt7915_sta *)sta->drv_priv; in mt7915_mcu_set_txpower_frame()
3183 struct mt7915_dev *dev = phy->dev; in mt7915_mcu_set_txpower_frame()
3184 struct mt76_phy *mphy = phy->mt76; in mt7915_mcu_set_txpower_frame()
3194 .band_idx = phy->mt76->band_idx, in mt7915_mcu_set_txpower_frame()
3195 .txpower_max = DIV_ROUND_UP(mphy->txpower_cur, 2), in mt7915_mcu_set_txpower_frame()
3196 .wcid = cpu_to_le16(msta->wcid.idx), in mt7915_mcu_set_txpower_frame()
3206 if (txpower > mphy->txpower_cur || txpower < 0) in mt7915_mcu_set_txpower_frame()
3207 return -EINVAL; in mt7915_mcu_set_txpower_frame()
3212 if (sta->deflink.ht_cap.ht_supported) { in mt7915_mcu_set_txpower_frame()
3218 if (sta->deflink.vht_cap.vht_supported) { in mt7915_mcu_set_txpower_frame()
3222 if (sta->deflink.he_cap.has_he) { in mt7915_mcu_set_txpower_frame()
3228 return -EINVAL; in mt7915_mcu_set_txpower_frame()
3233 DIV_ROUND_UP(txpower - txpower_sku[offs], 2); in mt7915_mcu_set_txpower_frame()
3236 return mt76_mcu_send_msg(&dev->mt76, in mt7915_mcu_set_txpower_frame()
3243 struct mt7915_dev *dev = phy->dev; in mt7915_mcu_set_txpower_sku()
3244 struct mt76_phy *mphy = phy->mt76; in mt7915_mcu_set_txpower_sku()
3245 struct ieee80211_hw *hw = mphy->hw; in mt7915_mcu_set_txpower_sku() local
3248 .band_idx = phy->mt76->band_idx, in mt7915_mcu_set_txpower_sku()
3255 tx_power = mt7915_get_power_bound(phy, hw->conf.power_level); in mt7915_mcu_set_txpower_sku()
3256 tx_power = mt76_get_rate_power_limits(mphy, mphy->chandef.chan, in mt7915_mcu_set_txpower_sku()
3258 mphy->txpower_cur = tx_power; in mt7915_mcu_set_txpower_sku()
3280 return mt76_mcu_send_msg(&dev->mt76, in mt7915_mcu_set_txpower_sku()
3288 struct mt7915_dev *dev = phy->dev; in mt7915_mcu_get_txpower_sku()
3297 .band_idx = phy->mt76->band_idx, in mt7915_mcu_get_txpower_sku()
3303 ret = mt76_mcu_send_and_get_msg(&dev->mt76, in mt7915_mcu_get_txpower_sku()
3309 memcpy(txpower_sku, skb->data + 4, sizeof(txpower_sku)); in mt7915_mcu_get_txpower_sku()
3336 return mt76_mcu_send_msg(&dev->mt76, MCU_EXT_CMD(ATE_CTRL), &req, in mt7915_mcu_set_test_param()
3342 struct mt7915_dev *dev = phy->dev; in mt7915_mcu_set_sku_en()
3350 .band_idx = phy->mt76->band_idx, in mt7915_mcu_set_sku_en()
3354 return mt76_mcu_send_msg(&dev->mt76, in mt7915_mcu_set_sku_en()
3372 return mt76_mcu_send_msg(&dev->mt76, MCU_EXT_CMD(SET_SER_TRIGGER), in mt7915_mcu_set_ser()
3411 req.type.ibf = dev->ibf; in mt7915_mcu_set_txbf()
3418 return -EINVAL; in mt7915_mcu_set_txbf()
3421 return mt76_mcu_send_msg(&dev->mt76, MCU_EXT_CMD(TXBF_ACTION), &req, in mt7915_mcu_set_txbf()
3428 struct mt7915_dev *dev = phy->dev; in mt7915_mcu_enable_obss_spr()
3432 .band_idx = phy->mt76->band_idx, in mt7915_mcu_enable_obss_spr()
3436 return mt76_mcu_send_msg(&dev->mt76, MCU_EXT_CMD(SET_SPR), &req, in mt7915_mcu_enable_obss_spr()
3444 struct mt7915_dev *dev = phy->dev; in mt7915_mcu_set_obss_spr_pd()
3446 struct mt7915_mcu_sr_ctrl ctrl; in mt7915_mcu_set_obss_spr_pd() member
3460 .ctrl = { in mt7915_mcu_set_obss_spr_pd()
3463 .band_idx = phy->mt76->band_idx, in mt7915_mcu_set_obss_spr_pd()
3474 if (he_obss_pd->sr_ctrl & in mt7915_mcu_set_obss_spr_pd()
3477 else if (he_obss_pd->sr_ctrl & IEEE80211_HE_SPR_NON_SRG_OFFSET_PRESENT) in mt7915_mcu_set_obss_spr_pd()
3478 req.param.pd_th_non_srg = max_th - he_obss_pd->non_srg_max_offset; in mt7915_mcu_set_obss_spr_pd()
3482 if (he_obss_pd->sr_ctrl & IEEE80211_HE_SPR_SRG_INFORMATION_PRESENT) in mt7915_mcu_set_obss_spr_pd()
3483 req.param.pd_th_srg = max_th - he_obss_pd->max_offset; in mt7915_mcu_set_obss_spr_pd()
3490 return mt76_mcu_send_msg(&dev->mt76, MCU_EXT_CMD(SET_SPR), &req, in mt7915_mcu_set_obss_spr_pd()
3498 struct mt7915_vif *mvif = (struct mt7915_vif *)vif->drv_priv; in mt7915_mcu_set_obss_spr_siga()
3499 struct mt7915_dev *dev = phy->dev; in mt7915_mcu_set_obss_spr_siga()
3500 u8 omac = mvif->mt76.omac_idx; in mt7915_mcu_set_obss_spr_siga()
3502 struct mt7915_mcu_sr_ctrl ctrl; in mt7915_mcu_set_obss_spr_siga() member
3509 .ctrl = { in mt7915_mcu_set_obss_spr_siga()
3512 .band_idx = phy->mt76->band_idx, in mt7915_mcu_set_obss_spr_siga()
3515 .omac = omac > HW_BSSID_MAX ? omac - 12 : omac, in mt7915_mcu_set_obss_spr_siga()
3520 if (he_obss_pd->sr_ctrl & IEEE80211_HE_SPR_HESIGA_SR_VAL15_ALLOWED) in mt7915_mcu_set_obss_spr_siga()
3530 return mt76_mcu_send_msg(&dev->mt76, MCU_EXT_CMD(SET_SPR), &req, in mt7915_mcu_set_obss_spr_siga()
3538 struct mt7915_dev *dev = phy->dev; in mt7915_mcu_set_obss_spr_bitmap()
3540 struct mt7915_mcu_sr_ctrl ctrl; in mt7915_mcu_set_obss_spr_bitmap() member
3548 .ctrl = { in mt7915_mcu_set_obss_spr_bitmap()
3551 .band_idx = phy->mt76->band_idx, in mt7915_mcu_set_obss_spr_bitmap()
3556 memcpy(&bitmap, he_obss_pd->bss_color_bitmap, sizeof(bitmap)); in mt7915_mcu_set_obss_spr_bitmap()
3557 req.bitmap.color_l[req.ctrl.band_idx] = cpu_to_le32(bitmap); in mt7915_mcu_set_obss_spr_bitmap()
3559 memcpy(&bitmap, he_obss_pd->bss_color_bitmap + 4, sizeof(bitmap)); in mt7915_mcu_set_obss_spr_bitmap()
3560 req.bitmap.color_h[req.ctrl.band_idx] = cpu_to_le32(bitmap); in mt7915_mcu_set_obss_spr_bitmap()
3562 memcpy(&bitmap, he_obss_pd->partial_bssid_bitmap, sizeof(bitmap)); in mt7915_mcu_set_obss_spr_bitmap()
3563 req.bitmap.bssid_l[req.ctrl.band_idx] = cpu_to_le32(bitmap); in mt7915_mcu_set_obss_spr_bitmap()
3565 memcpy(&bitmap, he_obss_pd->partial_bssid_bitmap + 4, sizeof(bitmap)); in mt7915_mcu_set_obss_spr_bitmap()
3566 req.bitmap.bssid_h[req.ctrl.band_idx] = cpu_to_le32(bitmap); in mt7915_mcu_set_obss_spr_bitmap()
3568 return mt76_mcu_send_msg(&dev->mt76, MCU_EXT_CMD(SET_SPR), &req, in mt7915_mcu_set_obss_spr_bitmap()
3583 if (sr_scene_detect && !he_obss_pd->enable) in mt7915_mcu_add_obss_spr()
3587 ret = mt7915_mcu_enable_obss_spr(phy, SPR_ENABLE, he_obss_pd->enable); in mt7915_mcu_add_obss_spr()
3591 if (sr_scene_detect || !he_obss_pd->enable) in mt7915_mcu_add_obss_spr()
3598 /* set SRG/non-SRG OBSS PD threshold */ in mt7915_mcu_add_obss_spr()
3615 struct mt7915_vif *mvif = (struct mt7915_vif *)vif->drv_priv; in mt7915_mcu_get_rx_rate()
3616 struct mt7915_sta *msta = (struct mt7915_sta *)sta->drv_priv; in mt7915_mcu_get_rx_rate()
3617 struct mt7915_dev *dev = phy->dev; in mt7915_mcu_get_rx_rate()
3618 struct mt76_phy *mphy = phy->mt76; in mt7915_mcu_get_rx_rate()
3625 .band = mvif->mt76.band_idx, in mt7915_mcu_get_rx_rate()
3626 .wcid = cpu_to_le16(msta->wcid.idx), in mt7915_mcu_get_rx_rate()
3634 ret = mt76_mcu_send_and_get_msg(&dev->mt76, MCU_EXT_CMD(PHY_STAT_INFO), in mt7915_mcu_get_rx_rate()
3639 res = (struct mt7915_mcu_phy_rx_info *)skb->data; in mt7915_mcu_get_rx_rate()
3641 rate->mcs = res->rate; in mt7915_mcu_get_rx_rate()
3642 rate->nss = res->nsts + 1; in mt7915_mcu_get_rx_rate()
3644 switch (res->mode) { in mt7915_mcu_get_rx_rate()
3649 if (mphy->chandef.chan->band == NL80211_BAND_5GHZ) in mt7915_mcu_get_rx_rate()
3650 sband = &mphy->sband_5g.sband; in mt7915_mcu_get_rx_rate()
3651 else if (mphy->chandef.chan->band == NL80211_BAND_6GHZ) in mt7915_mcu_get_rx_rate()
3652 sband = &mphy->sband_6g.sband; in mt7915_mcu_get_rx_rate()
3654 sband = &mphy->sband_2g.sband; in mt7915_mcu_get_rx_rate()
3656 rate->mcs = mt76_get_rate(&dev->mt76, sband, rate->mcs, cck); in mt7915_mcu_get_rx_rate()
3657 rate->legacy = sband->bitrates[rate->mcs].bitrate; in mt7915_mcu_get_rx_rate()
3661 if (rate->mcs > 31) { in mt7915_mcu_get_rx_rate()
3662 ret = -EINVAL; in mt7915_mcu_get_rx_rate()
3666 rate->flags = RATE_INFO_FLAGS_MCS; in mt7915_mcu_get_rx_rate()
3667 if (res->gi) in mt7915_mcu_get_rx_rate()
3668 rate->flags |= RATE_INFO_FLAGS_SHORT_GI; in mt7915_mcu_get_rx_rate()
3671 if (rate->mcs > 9) { in mt7915_mcu_get_rx_rate()
3672 ret = -EINVAL; in mt7915_mcu_get_rx_rate()
3676 rate->flags = RATE_INFO_FLAGS_VHT_MCS; in mt7915_mcu_get_rx_rate()
3677 if (res->gi) in mt7915_mcu_get_rx_rate()
3678 rate->flags |= RATE_INFO_FLAGS_SHORT_GI; in mt7915_mcu_get_rx_rate()
3684 if (res->gi > NL80211_RATE_INFO_HE_GI_3_2 || rate->mcs > 11) { in mt7915_mcu_get_rx_rate()
3685 ret = -EINVAL; in mt7915_mcu_get_rx_rate()
3688 rate->he_gi = res->gi; in mt7915_mcu_get_rx_rate()
3689 rate->flags = RATE_INFO_FLAGS_HE_MCS; in mt7915_mcu_get_rx_rate()
3692 ret = -EINVAL; in mt7915_mcu_get_rx_rate()
3696 switch (res->bw) { in mt7915_mcu_get_rx_rate()
3698 rate->bw = RATE_INFO_BW_160; in mt7915_mcu_get_rx_rate()
3701 rate->bw = RATE_INFO_BW_80; in mt7915_mcu_get_rx_rate()
3704 rate->bw = RATE_INFO_BW_40; in mt7915_mcu_get_rx_rate()
3707 rate->bw = RATE_INFO_BW_20; in mt7915_mcu_get_rx_rate()
3721 struct mt7915_vif *mvif = (struct mt7915_vif *)vif->drv_priv; in mt7915_mcu_update_bss_color()
3726 skb = __mt76_connac_mcu_alloc_sta_req(&dev->mt76, &mvif->mt76, in mt7915_mcu_update_bss_color()
3734 bss_color->disable = !he_bss_color->enabled; in mt7915_mcu_update_bss_color()
3735 bss_color->color = he_bss_color->color; in mt7915_mcu_update_bss_color()
3737 return mt76_mcu_skb_send_msg(&dev->mt76, skb, in mt7915_mcu_update_bss_color()
3747 struct mt7915_twt_flow *flow, in mt7915_mcu_twt_agrt_update() argument
3767 .tbl_idx = flow->table_id, in mt7915_mcu_twt_agrt_update()
3769 .own_mac_idx = mvif->mt76.omac_idx, in mt7915_mcu_twt_agrt_update()
3770 .flowid = flow->id, in mt7915_mcu_twt_agrt_update()
3771 .peer_id = cpu_to_le16(flow->wcid), in mt7915_mcu_twt_agrt_update()
3772 .duration = flow->duration, in mt7915_mcu_twt_agrt_update()
3773 .bss_idx = mvif->mt76.idx, in mt7915_mcu_twt_agrt_update()
3774 .start_tsf = cpu_to_le64(flow->tsf), in mt7915_mcu_twt_agrt_update()
3775 .mantissa = flow->mantissa, in mt7915_mcu_twt_agrt_update()
3776 .exponent = flow->exp, in mt7915_mcu_twt_agrt_update()
3780 if (flow->protection) in mt7915_mcu_twt_agrt_update()
3782 if (!flow->flowtype) in mt7915_mcu_twt_agrt_update()
3784 if (flow->trigger) in mt7915_mcu_twt_agrt_update()
3787 return mt76_mcu_send_msg(&dev->mt76, MCU_EXT_CMD(TWT_AGRT_UPDATE), in mt7915_mcu_twt_agrt_update()
3817 ret = mt76_mcu_send_and_get_msg(&dev->mt76, MCU_WA_PARAM_CMD(QUERY), in mt7915_mcu_wed_wa_tx_stats()
3822 if (!is_mt7915(&dev->mt76)) in mt7915_mcu_wed_wa_tx_stats()
3825 res = (struct mt7915_mcu_wa_tx_stat *)skb->data; in mt7915_mcu_wed_wa_tx_stats()
3827 if (le16_to_cpu(res->wlan_idx) != wlan_idx) { in mt7915_mcu_wed_wa_tx_stats()
3828 ret = -EINVAL; in mt7915_mcu_wed_wa_tx_stats()
3834 wcid = rcu_dereference(dev->mt76.wcid[wlan_idx]); in mt7915_mcu_wed_wa_tx_stats()
3836 wcid->stats.tx_packets += le32_to_cpu(res->tx_packets); in mt7915_mcu_wed_wa_tx_stats()
3838 ret = -EINVAL; in mt7915_mcu_wed_wa_tx_stats()
3862 return mt76_mcu_send_msg(&dev->mt76, MCU_EXT_CMD(RF_REG_ACCESS), in mt7915_mcu_rf_regval()
3865 ret = mt76_mcu_send_and_get_msg(&dev->mt76, MCU_EXT_QUERY(RF_REG_ACCESS), in mt7915_mcu_rf_regval()
3870 *val = le32_to_cpu(*(__le32 *)(skb->data + 8)); in mt7915_mcu_rf_regval()