diff --git a/mt76_connac_mcu.c b/mt76_connac_mcu.c index ed6c9ebba..d426e6367 100644 --- a/mt76_connac_mcu.c +++ b/mt76_connac_mcu.c @@ -2678,24 +2678,10 @@ int mt76_connac_mcu_bss_basic_tlv(struct sk_buff *skb, struct bss_info_basic *bss; struct tlv *tlv; - tlv = mt76_connac_mcu_add_tlv(skb, BSS_INFO_BASIC, sizeof(*bss)); - bss = (struct bss_info_basic *)tlv; - switch (vif->type) { case NL80211_IFTYPE_MESH_POINT: - case NL80211_IFTYPE_MONITOR: - break; case NL80211_IFTYPE_AP: - if (ieee80211_hw_check(phy->hw, SUPPORTS_MULTI_BSSID)) { - u8 bssid_id = vif->bss_conf.bssid_indicator; - struct wiphy *wiphy = phy->hw->wiphy; - - if (bssid_id > ilog2(wiphy->mbssid_max_interfaces)) - return -EINVAL; - - bss->non_tx_bssid = vif->bss_conf.bssid_index; - bss->max_bssid = bssid_id; - } + case NL80211_IFTYPE_MONITOR: break; case NL80211_IFTYPE_STATION: if (enable) { @@ -2721,6 +2707,9 @@ int mt76_connac_mcu_bss_basic_tlv(struct sk_buff *skb, break; } + tlv = mt76_connac_mcu_add_tlv(skb, BSS_INFO_BASIC, sizeof(*bss)); + + bss = (struct bss_info_basic *)tlv; bss->network_type = cpu_to_le32(type); bss->bmc_wcid_lo = to_wcid_lo(wlan_idx); bss->bmc_wcid_hi = to_wcid_hi(wlan_idx); diff --git a/mt76_connac_mcu.h b/mt76_connac_mcu.h index cf4ce3b1f..0d94dedf6 100644 --- a/mt76_connac_mcu.h +++ b/mt76_connac_mcu.h @@ -1135,7 +1135,6 @@ enum { MCU_EXT_CMD_SET_SER_TRIGGER = 0x81, MCU_EXT_CMD_TWT_AGRT_UPDATE = 0x94, MCU_EXT_CMD_FW_DBG_CTRL = 0x95, - MCU_EXT_CMD_OFFCH_SCAN_CTRL = 0x9a, MCU_EXT_CMD_SET_RDD_TH = 0x9d, MCU_EXT_CMD_MURU_CTRL = 0x9f, MCU_EXT_CMD_SET_SPR = 0xa8, diff --git a/mt7915/debugfs.c b/mt7915/debugfs.c index b95c81dbf..4bc04825a 100644 --- a/mt7915/debugfs.c +++ b/mt7915/debugfs.c @@ -157,11 +157,7 @@ mt7915_radar_trigger(void *data, u64 val) { struct mt7915_dev *dev = data; - if (val > MT_RX_SEL2) - return -EINVAL; - - return mt76_connac_mcu_rdd_cmd(&dev->mt76, RDD_RADAR_EMULATE, - val, 0, 0); + return mt76_connac_mcu_rdd_cmd(&dev->mt76, RDD_RADAR_EMULATE, 1, 0, 0); } DEFINE_DEBUGFS_ATTRIBUTE(fops_radar_trigger, NULL, @@ -386,53 +382,6 @@ static int mt7915_muru_stats_show(struct seq_file *file, void *data) } DEFINE_SHOW_ATTRIBUTE(mt7915_muru_stats); -static int -mt7915_rdd_monitor(struct seq_file *s, void *data) -{ - struct mt7915_dev *dev = dev_get_drvdata(s->private); - struct cfg80211_chan_def *chandef = &dev->rdd2_chandef; - const char *bw; - int ret = 0; - - mutex_lock(&dev->mt76.mutex); - - if (!cfg80211_chandef_valid(chandef)) { - ret = -EINVAL; - goto out; - } - - if (!dev->rdd2_phy) { - seq_puts(s, "not running\n"); - goto out; - } - - switch (chandef->width) { - case NL80211_CHAN_WIDTH_40: - bw = "40"; - break; - case NL80211_CHAN_WIDTH_80: - bw = "80"; - break; - case NL80211_CHAN_WIDTH_160: - bw = "160"; - break; - case NL80211_CHAN_WIDTH_80P80: - bw = "80P80"; - break; - default: - bw = "20"; - break; - } - - seq_printf(s, "channel %d (%d MHz) width %s MHz center1: %d MHz\n", - chandef->chan->hw_value, chandef->chan->center_freq, - bw, chandef->center_freq1); -out: - mutex_unlock(&dev->mt76.mutex); - - return ret; -} - static int mt7915_fw_debug_wm_set(void *data, u64 val) { @@ -1031,8 +980,6 @@ int mt7915_init_debugfs(struct mt7915_phy *phy) &dev->hw_pattern); debugfs_create_file("radar_trigger", 0200, dir, dev, &fops_radar_trigger); - debugfs_create_devm_seqfile(dev->mt76.dev, "rdd_monitor", dir, - mt7915_rdd_monitor); } if (!ext_phy) diff --git a/mt7915/init.c b/mt7915/init.c index e8c001b67..bdd13fa33 100644 --- a/mt7915/init.c +++ b/mt7915/init.c @@ -307,9 +307,6 @@ mt7915_regd_notifier(struct wiphy *wiphy, memcpy(dev->mt76.alpha2, request->alpha2, sizeof(dev->mt76.alpha2)); dev->mt76.region = request->dfs_region; - if (dev->mt76.region == NL80211_DFS_UNSET) - mt7915_mcu_rdd_background_enable(phy, NULL); - mt7915_init_txpower(dev, &mphy->sband_2g.sband); mt7915_init_txpower(dev, &mphy->sband_5g.sband); mt7915_init_txpower(dev, &mphy->sband_6g.sband); @@ -322,7 +319,6 @@ static void mt7915_init_wiphy(struct ieee80211_hw *hw) { struct mt7915_phy *phy = mt7915_hw_phy(hw); - struct mt76_dev *mdev = &phy->dev->mt76; struct wiphy *wiphy = hw->wiphy; struct mt7915_dev *dev = phy->dev; @@ -343,7 +339,6 @@ mt7915_init_wiphy(struct ieee80211_hw *hw) wiphy->n_iface_combinations = ARRAY_SIZE(if_comb); wiphy->reg_notifier = mt7915_regd_notifier; wiphy->flags |= WIPHY_FLAG_HAS_CHANNEL_SWITCH; - wiphy->mbssid_max_interfaces = 16; wiphy_ext_feature_set(wiphy, NL80211_EXT_FEATURE_BSS_COLOR); wiphy_ext_feature_set(wiphy, NL80211_EXT_FEATURE_VHT_IBSS); @@ -354,16 +349,9 @@ mt7915_init_wiphy(struct ieee80211_hw *hw) wiphy_ext_feature_set(wiphy, NL80211_EXT_FEATURE_UNSOL_BCAST_PROBE_RESP); wiphy_ext_feature_set(wiphy, NL80211_EXT_FEATURE_FILS_DISCOVERY); - if (!mdev->dev->of_node || - !of_property_read_bool(mdev->dev->of_node, - "mediatek,disable-radar-background")) - wiphy_ext_feature_set(wiphy, - NL80211_EXT_FEATURE_RADAR_BACKGROUND); - ieee80211_hw_set(hw, HAS_RATE_CONTROL); ieee80211_hw_set(hw, SUPPORTS_TX_ENCAP_OFFLOAD); ieee80211_hw_set(hw, SUPPORTS_RX_DECAP_OFFLOAD); - ieee80211_hw_set(hw, SUPPORTS_MULTI_BSSID); ieee80211_hw_set(hw, WANT_MONITOR_VIF); ieee80211_hw_set(hw, SUPPORTS_VHT_EXT_NSS_BW); diff --git a/mt7915/main.c b/mt7915/main.c index 00424a140..ddb8cf658 100644 --- a/mt7915/main.c +++ b/mt7915/main.c @@ -1354,55 +1354,6 @@ mt7915_twt_teardown_request(struct ieee80211_hw *hw, mutex_unlock(&dev->mt76.mutex); } -static int -mt7915_set_radar_background(struct ieee80211_hw *hw, - struct cfg80211_chan_def *chandef) -{ - struct mt7915_phy *phy = mt7915_hw_phy(hw); - struct mt7915_dev *dev = phy->dev; - int ret = -EINVAL; - bool running; - - mutex_lock(&dev->mt76.mutex); - - if (dev->mt76.region == NL80211_DFS_UNSET) - goto out; - - if (dev->rdd2_phy && dev->rdd2_phy != phy) { - /* rdd2 is already locked */ - ret = -EBUSY; - goto out; - } - - /* rdd2 already configured on a radar channel */ - running = dev->rdd2_phy && - cfg80211_chandef_valid(&dev->rdd2_chandef) && - !!(dev->rdd2_chandef.chan->flags & IEEE80211_CHAN_RADAR); - - if (!chandef || running || - !(chandef->chan->flags & IEEE80211_CHAN_RADAR)) { - ret = mt7915_mcu_rdd_background_enable(phy, NULL); - if (ret) - goto out; - - if (!running) - goto update_phy; - } - - ret = mt7915_mcu_rdd_background_enable(phy, chandef); - if (ret) - goto out; - -update_phy: - dev->rdd2_phy = chandef ? phy : NULL; - if (chandef) - dev->rdd2_chandef = *chandef; -out: - mutex_unlock(&dev->mt76.mutex); - - return ret; -} - #ifdef CONFIG_NET_MEDIATEK_SOC_WED static int mt7915_net_fill_forward_path(struct ieee80211_hw *hw, @@ -1482,7 +1433,6 @@ const struct ieee80211_ops mt7915_ops = { #ifdef CONFIG_MAC80211_DEBUGFS .sta_add_debugfs = mt7915_sta_add_debugfs, #endif - .set_radar_background = mt7915_set_radar_background, #ifdef CONFIG_NET_MEDIATEK_SOC_WED .net_fill_forward_path = mt7915_net_fill_forward_path, #endif diff --git a/mt7915/mcu.c b/mt7915/mcu.c index f11ca25d5..56ba7e603 100644 --- a/mt7915/mcu.c +++ b/mt7915/mcu.c @@ -265,12 +265,7 @@ mt7915_mcu_rx_radar_detected(struct mt7915_dev *dev, struct sk_buff *skb) if ((r->band_idx && !dev->phy.band_idx) && dev->mt76.phys[MT_BAND1]) mphy = dev->mt76.phys[MT_BAND1]; - if (r->band_idx == MT_RX_SEL2) - cfg80211_background_radar_event(mphy->hw->wiphy, - &dev->rdd2_chandef, - GFP_ATOMIC); - else - ieee80211_radar_detected(mphy->hw); + ieee80211_radar_detected(mphy->hw); dev->hw_pattern++; } @@ -1743,61 +1738,6 @@ mt7915_mcu_beacon_cntdwn(struct ieee80211_vif *vif, struct sk_buff *rskb, info->cnt = skb->data[offs->cntdwn_counter_offs[0]]; } -static void -mt7915_mcu_beacon_mbss(struct sk_buff *rskb, struct sk_buff *skb, - struct ieee80211_vif *vif, struct bss_info_bcn *bcn, - struct ieee80211_mutable_offsets *offs) -{ - struct bss_info_bcn_mbss *mbss; - const struct element *elem; - struct tlv *tlv; - - if (!vif->bss_conf.bssid_indicator) - return; - - tlv = mt7915_mcu_add_nested_subtlv(rskb, BSS_INFO_BCN_MBSSID, - sizeof(*mbss), &bcn->sub_ntlv, - &bcn->len); - - mbss = (struct bss_info_bcn_mbss *)tlv; - mbss->offset[0] = cpu_to_le16(offs->tim_offset); - mbss->bitmap = cpu_to_le32(1); - - for_each_element_id(elem, WLAN_EID_MULTIPLE_BSSID, - &skb->data[offs->mbssid_off], - skb->len - offs->mbssid_off) { - const struct element *sub_elem; - - if (elem->datalen < 2) - continue; - - for_each_element(sub_elem, elem->data + 1, elem->datalen - 1) { - const struct ieee80211_bssid_index *idx; - const u8 *idx_ie; - - if (sub_elem->id || sub_elem->datalen < 4) - continue; /* not a valid BSS profile */ - - /* Find WLAN_EID_MULTI_BSSID_IDX - * in the merged nontransmitted profile - */ - idx_ie = cfg80211_find_ie(WLAN_EID_MULTI_BSSID_IDX, - sub_elem->data, - sub_elem->datalen); - if (!idx_ie || idx_ie[1] < sizeof(*idx)) - continue; - - idx = (void *)(idx_ie + 2); - if (!idx->bssid_index || idx->bssid_index > 31) - continue; - - mbss->offset[idx->bssid_index] = - cpu_to_le16(idx_ie - skb->data); - mbss->bitmap |= cpu_to_le32(BIT(idx->bssid_index)); - } - } -} - static void mt7915_mcu_beacon_cont(struct mt7915_dev *dev, struct ieee80211_vif *vif, struct sk_buff *rskb, struct sk_buff *skb, @@ -1993,9 +1933,6 @@ int mt7915_mcu_add_beacon(struct ieee80211_hw *hw, struct ieee80211_vif *vif, int len = MT7915_MAX_BSS_OFFLOAD_SIZE; bool ext_phy = phy != &dev->phy; - if (vif->bss_conf.nontransmitted) - return 0; - rskb = __mt76_connac_mcu_alloc_sta_req(&dev->mt76, &mvif->mt76, NULL, len); if (IS_ERR(rskb)) @@ -2023,8 +1960,8 @@ int mt7915_mcu_add_beacon(struct ieee80211_hw *hw, struct ieee80211_vif *vif, mt7915_mcu_beacon_check_caps(phy, vif, skb); + /* TODO: subtag - 11v MBSSID */ mt7915_mcu_beacon_cntdwn(vif, rskb, skb, bcn, &offs); - mt7915_mcu_beacon_mbss(rskb, skb, vif, bcn, &offs); mt7915_mcu_beacon_cont(dev, vif, rskb, skb, bcn, &offs); dev_kfree_skb(skb); @@ -2525,99 +2462,6 @@ int mt7915_mcu_set_radar_th(struct mt7915_dev *dev, int index, sizeof(req), true); } -static int -mt7915_mcu_background_chain_ctrl(struct mt7915_phy *phy, - struct cfg80211_chan_def *chandef, - int cmd) -{ - struct mt7915_dev *dev = phy->dev; - struct mt76_phy *mphy = phy->mt76; - struct ieee80211_channel *chan = mphy->chandef.chan; - int freq = mphy->chandef.center_freq1; - struct mt7915_mcu_background_chain_ctrl req = { - .monitor_scan_type = 2, /* simple rx */ - }; - - if (!chandef && cmd != CH_SWITCH_BACKGROUND_SCAN_STOP) - return -EINVAL; - - if (!cfg80211_chandef_valid(&mphy->chandef)) - return -EINVAL; - - switch (cmd) { - case CH_SWITCH_BACKGROUND_SCAN_START: { - req.chan = chan->hw_value; - req.central_chan = ieee80211_frequency_to_channel(freq); - req.bw = mt76_connac_chan_bw(&mphy->chandef); - req.monitor_chan = chandef->chan->hw_value; - req.monitor_central_chan = - ieee80211_frequency_to_channel(chandef->center_freq1); - req.monitor_bw = mt76_connac_chan_bw(chandef); - req.band_idx = phy != &dev->phy; - req.scan_mode = 1; - break; - } - case CH_SWITCH_BACKGROUND_SCAN_RUNNING: - req.monitor_chan = chandef->chan->hw_value; - req.monitor_central_chan = - ieee80211_frequency_to_channel(chandef->center_freq1); - req.band_idx = phy != &dev->phy; - req.scan_mode = 2; - break; - case CH_SWITCH_BACKGROUND_SCAN_STOP: - req.chan = chan->hw_value; - req.central_chan = ieee80211_frequency_to_channel(freq); - req.bw = mt76_connac_chan_bw(&mphy->chandef); - req.tx_stream = hweight8(mphy->antenna_mask); - req.rx_stream = mphy->antenna_mask; - break; - default: - return -EINVAL; - } - req.band = chandef ? chandef->chan->band == NL80211_BAND_5GHZ : 1; - - return mt76_mcu_send_msg(&dev->mt76, MCU_EXT_CMD(OFFCH_SCAN_CTRL), - &req, sizeof(req), false); -} - -int mt7915_mcu_rdd_background_enable(struct mt7915_phy *phy, - struct cfg80211_chan_def *chandef) -{ - struct mt7915_dev *dev = phy->dev; - int err, region; - - if (!chandef) { /* disable offchain */ - err = mt76_connac_mcu_rdd_cmd(&dev->mt76, RDD_STOP, MT_RX_SEL2, - 0, 0); - if (err) - return err; - - return mt7915_mcu_background_chain_ctrl(phy, NULL, - CH_SWITCH_BACKGROUND_SCAN_STOP); - } - - err = mt7915_mcu_background_chain_ctrl(phy, chandef, - CH_SWITCH_BACKGROUND_SCAN_START); - if (err) - return err; - - switch (dev->mt76.region) { - case NL80211_DFS_ETSI: - region = 0; - break; - case NL80211_DFS_JP: - region = 2; - break; - case NL80211_DFS_FCC: - default: - region = 1; - break; - } - - return mt76_connac_mcu_rdd_cmd(&dev->mt76, RDD_START, MT_RX_SEL2, - 0, region); -} - int mt7915_mcu_set_chan_info(struct mt7915_phy *phy, int cmd) { static const u8 ch_band[] = { diff --git a/mt7915/mcu.h b/mt7915/mcu.h index 87cd1bfff..eb531f37a 100644 --- a/mt7915/mcu.h +++ b/mt7915/mcu.h @@ -106,29 +106,6 @@ struct mt7915_mcu_rdd_report { } hw_pulse[32]; } __packed; -struct mt7915_mcu_background_chain_ctrl { - u8 chan; /* primary channel */ - u8 central_chan; /* central channel */ - u8 bw; - u8 tx_stream; - u8 rx_stream; - - u8 monitor_chan; /* monitor channel */ - u8 monitor_central_chan;/* monitor central channel */ - u8 monitor_bw; - u8 monitor_tx_stream; - u8 monitor_rx_stream; - - u8 scan_mode; /* 0: ScanStop - * 1: ScanStart - * 2: ScanRunning - */ - u8 band_idx; /* DBDC */ - u8 monitor_scan_type; - u8 band; /* 0: 2.4GHz, 1: 5GHz */ - u8 rsv[2]; -} __packed; - struct mt7915_mcu_eeprom { u8 buffer_mode; u8 format; diff --git a/mt7915/mt7915.h b/mt7915/mt7915.h index 1c1e4058d..0c819842f 100644 --- a/mt7915/mt7915.h +++ b/mt7915/mt7915.h @@ -291,10 +291,6 @@ struct mt7915_dev { struct tasklet_struct irq_tasklet; struct mt7915_phy phy; - /* monitor rx chain configured channel */ - struct cfg80211_chan_def rdd2_chandef; - struct mt7915_phy *rdd2_phy; - u16 chainmask; u16 chainshift; u32 hif_idx; @@ -348,7 +344,6 @@ enum { enum { MT_RX_SEL0, MT_RX_SEL1, - MT_RX_SEL2, /* monitor chain */ }; enum mt7915_rdd_cmd { @@ -503,8 +498,6 @@ int mt7915_mcu_get_temperature(struct mt7915_phy *phy); int mt7915_mcu_set_thermal_throttling(struct mt7915_phy *phy, u8 state); int mt7915_mcu_get_rx_rate(struct mt7915_phy *phy, struct ieee80211_vif *vif, struct ieee80211_sta *sta, struct rate_info *rate); -int mt7915_mcu_rdd_background_enable(struct mt7915_phy *phy, - struct cfg80211_chan_def *chandef); int mt7915_mcu_rf_regval(struct mt7915_dev *dev, u32 regidx, u32 *val, bool set); int mt7915_mcu_wa_cmd(struct mt7915_dev *dev, int cmd, u32 a1, u32 a2, u32 a3); int mt7915_mcu_fw_log_2_host(struct mt7915_dev *dev, u8 type, u8 ctrl); diff --git a/tx.c b/tx.c index 55d911987..65e2b7c18 100644 --- a/tx.c +++ b/tx.c @@ -325,7 +325,7 @@ mt76_tx(struct mt76_phy *phy, struct ieee80211_sta *sta, if ((dev->drv->drv_flags & MT_DRV_HW_MGMT_TXQ) && !(info->flags & IEEE80211_TX_CTL_HW_80211_ENCAP) && !ieee80211_is_data(hdr->frame_control) && - !ieee80211_is_bufferable_mmpdu(skb)) { + !ieee80211_is_bufferable_mmpdu(hdr->frame_control)) { qid = MT_TXQ_PSD; }