1 // SPDX-License-Identifier: ISC
3 * Copyright (C) 2018 Stanislaw Gruszka <stf_xl@wp.pl>
4 * Copyright (C) 2016 Felix Fietkau <nbd@nbd.name>
7 #include <linux/module.h>
10 #define CCK_RATE(_idx, _rate) { \
12 .flags = IEEE80211_RATE_SHORT_PREAMBLE, \
13 .hw_value = (MT_PHY_TYPE_CCK << 8) | (_idx), \
14 .hw_value_short = (MT_PHY_TYPE_CCK << 8) | (8 + (_idx)), \
17 #define OFDM_RATE(_idx, _rate) { \
19 .hw_value = (MT_PHY_TYPE_OFDM << 8) | (_idx), \
20 .hw_value_short = (MT_PHY_TYPE_OFDM << 8) | (_idx), \
23 struct ieee80211_rate mt76x02_rates[] = {
37 EXPORT_SYMBOL_GPL(mt76x02_rates);
39 static const struct ieee80211_iface_limit mt76x02_if_limits[] = {
42 .types = BIT(NL80211_IFTYPE_ADHOC)
45 .types = BIT(NL80211_IFTYPE_STATION) |
46 #ifdef CONFIG_MAC80211_MESH
47 BIT(NL80211_IFTYPE_MESH_POINT) |
49 BIT(NL80211_IFTYPE_AP)
53 static const struct ieee80211_iface_limit mt76x02u_if_limits[] = {
56 .types = BIT(NL80211_IFTYPE_ADHOC)
59 .types = BIT(NL80211_IFTYPE_STATION) |
60 #ifdef CONFIG_MAC80211_MESH
61 BIT(NL80211_IFTYPE_MESH_POINT) |
63 BIT(NL80211_IFTYPE_AP)
67 static const struct ieee80211_iface_combination mt76x02_if_comb[] = {
69 .limits = mt76x02_if_limits,
70 .n_limits = ARRAY_SIZE(mt76x02_if_limits),
72 .num_different_channels = 1,
73 .beacon_int_infra_match = true,
74 .radar_detect_widths = BIT(NL80211_CHAN_WIDTH_20_NOHT) |
75 BIT(NL80211_CHAN_WIDTH_20) |
76 BIT(NL80211_CHAN_WIDTH_40) |
77 BIT(NL80211_CHAN_WIDTH_80),
81 static const struct ieee80211_iface_combination mt76x02u_if_comb[] = {
83 .limits = mt76x02u_if_limits,
84 .n_limits = ARRAY_SIZE(mt76x02u_if_limits),
86 .num_different_channels = 1,
87 .beacon_int_infra_match = true,
92 mt76x02_led_set_config(struct mt76_dev *mdev, u8 delay_on,
95 struct mt76x02_dev *dev = container_of(mdev, struct mt76x02_dev,
99 val = MT_LED_STATUS_DURATION(0xff) |
100 MT_LED_STATUS_OFF(delay_off) |
101 MT_LED_STATUS_ON(delay_on);
103 mt76_wr(dev, MT_LED_S0(mdev->led_pin), val);
104 mt76_wr(dev, MT_LED_S1(mdev->led_pin), val);
106 val = MT_LED_CTRL_REPLAY(mdev->led_pin) |
107 MT_LED_CTRL_KICK(mdev->led_pin);
109 val |= MT_LED_CTRL_POLARITY(mdev->led_pin);
110 mt76_wr(dev, MT_LED_CTRL, val);
114 mt76x02_led_set_blink(struct led_classdev *led_cdev,
115 unsigned long *delay_on,
116 unsigned long *delay_off)
118 struct mt76_dev *mdev = container_of(led_cdev, struct mt76_dev,
120 u8 delta_on, delta_off;
122 delta_off = max_t(u8, *delay_off / 10, 1);
123 delta_on = max_t(u8, *delay_on / 10, 1);
125 mt76x02_led_set_config(mdev, delta_on, delta_off);
131 mt76x02_led_set_brightness(struct led_classdev *led_cdev,
132 enum led_brightness brightness)
134 struct mt76_dev *mdev = container_of(led_cdev, struct mt76_dev,
138 mt76x02_led_set_config(mdev, 0, 0xff);
140 mt76x02_led_set_config(mdev, 0xff, 0);
143 void mt76x02_init_device(struct mt76x02_dev *dev)
145 struct ieee80211_hw *hw = mt76_hw(dev);
146 struct wiphy *wiphy = hw->wiphy;
148 INIT_DELAYED_WORK(&dev->mt76.mac_work, mt76x02_mac_work);
152 hw->max_report_rates = 7;
153 hw->max_rate_tries = 1;
154 hw->extra_tx_headroom = 2;
156 if (mt76_is_usb(&dev->mt76)) {
157 hw->extra_tx_headroom += sizeof(struct mt76x02_txwi) +
159 wiphy->iface_combinations = mt76x02u_if_comb;
160 wiphy->n_iface_combinations = ARRAY_SIZE(mt76x02u_if_comb);
162 INIT_DELAYED_WORK(&dev->wdt_work, mt76x02_wdt_work);
164 mt76x02_dfs_init_detector(dev);
166 wiphy->reg_notifier = mt76x02_regd_notifier;
167 wiphy->iface_combinations = mt76x02_if_comb;
168 wiphy->n_iface_combinations = ARRAY_SIZE(mt76x02_if_comb);
169 wiphy->flags |= WIPHY_FLAG_HAS_CHANNEL_SWITCH;
171 /* init led callbacks */
172 if (IS_ENABLED(CONFIG_MT76_LEDS)) {
173 dev->mt76.led_cdev.brightness_set =
174 mt76x02_led_set_brightness;
175 dev->mt76.led_cdev.blink_set = mt76x02_led_set_blink;
179 wiphy_ext_feature_set(wiphy, NL80211_EXT_FEATURE_VHT_IBSS);
181 hw->sta_data_size = sizeof(struct mt76x02_sta);
182 hw->vif_data_size = sizeof(struct mt76x02_vif);
184 ieee80211_hw_set(hw, SUPPORTS_HT_CCK_RATES);
186 dev->mt76.global_wcid.idx = 255;
187 dev->mt76.global_wcid.hw_key_idx = -1;
190 if (is_mt76x2(dev)) {
191 dev->mphy.sband_2g.sband.ht_cap.cap |=
192 IEEE80211_HT_CAP_LDPC_CODING;
193 dev->mphy.sband_5g.sband.ht_cap.cap |=
194 IEEE80211_HT_CAP_LDPC_CODING;
195 dev->mt76.chainmask = 0x202;
196 dev->mt76.antenna_mask = 3;
198 dev->mt76.chainmask = 0x101;
199 dev->mt76.antenna_mask = 1;
202 EXPORT_SYMBOL_GPL(mt76x02_init_device);
204 void mt76x02_configure_filter(struct ieee80211_hw *hw,
205 unsigned int changed_flags,
206 unsigned int *total_flags, u64 multicast)
208 struct mt76x02_dev *dev = hw->priv;
211 #define MT76_FILTER(_flag, _hw) do { \
212 flags |= *total_flags & FIF_##_flag; \
213 dev->mt76.rxfilter &= ~(_hw); \
214 dev->mt76.rxfilter |= !(flags & FIF_##_flag) * (_hw); \
217 mutex_lock(&dev->mt76.mutex);
219 dev->mt76.rxfilter &= ~MT_RX_FILTR_CFG_OTHER_BSS;
221 MT76_FILTER(FCSFAIL, MT_RX_FILTR_CFG_CRC_ERR);
222 MT76_FILTER(PLCPFAIL, MT_RX_FILTR_CFG_PHY_ERR);
223 MT76_FILTER(CONTROL, MT_RX_FILTR_CFG_ACK |
224 MT_RX_FILTR_CFG_CTS |
225 MT_RX_FILTR_CFG_CFEND |
226 MT_RX_FILTR_CFG_CFACK |
228 MT_RX_FILTR_CFG_CTRL_RSV);
229 MT76_FILTER(PSPOLL, MT_RX_FILTR_CFG_PSPOLL);
231 *total_flags = flags;
232 mt76_wr(dev, MT_RX_FILTR_CFG, dev->mt76.rxfilter);
234 mutex_unlock(&dev->mt76.mutex);
236 EXPORT_SYMBOL_GPL(mt76x02_configure_filter);
238 int mt76x02_sta_add(struct mt76_dev *mdev, struct ieee80211_vif *vif,
239 struct ieee80211_sta *sta)
241 struct mt76x02_dev *dev = container_of(mdev, struct mt76x02_dev, mt76);
242 struct mt76x02_sta *msta = (struct mt76x02_sta *)sta->drv_priv;
243 struct mt76x02_vif *mvif = (struct mt76x02_vif *)vif->drv_priv;
246 memset(msta, 0, sizeof(*msta));
248 idx = mt76_wcid_alloc(dev->mt76.wcid_mask, ARRAY_SIZE(dev->mt76.wcid));
254 msta->wcid.idx = idx;
255 msta->wcid.hw_key_idx = -1;
256 mt76x02_mac_wcid_setup(dev, idx, mvif->idx, sta->addr);
257 mt76x02_mac_wcid_set_drop(dev, idx, false);
258 ewma_pktlen_init(&msta->pktlen);
260 if (vif->type == NL80211_IFTYPE_AP)
261 set_bit(MT_WCID_FLAG_CHECK_PS, &msta->wcid.flags);
265 EXPORT_SYMBOL_GPL(mt76x02_sta_add);
267 void mt76x02_sta_remove(struct mt76_dev *mdev, struct ieee80211_vif *vif,
268 struct ieee80211_sta *sta)
270 struct mt76x02_dev *dev = container_of(mdev, struct mt76x02_dev, mt76);
271 struct mt76_wcid *wcid = (struct mt76_wcid *)sta->drv_priv;
274 mt76x02_mac_wcid_set_drop(dev, idx, true);
275 mt76x02_mac_wcid_setup(dev, idx, 0, NULL);
277 EXPORT_SYMBOL_GPL(mt76x02_sta_remove);
280 mt76x02_vif_init(struct mt76x02_dev *dev, struct ieee80211_vif *vif,
283 struct mt76x02_vif *mvif = (struct mt76x02_vif *)vif->drv_priv;
284 struct mt76_txq *mtxq;
286 memset(mvif, 0, sizeof(*mvif));
289 mvif->group_wcid.idx = MT_VIF_WCID(idx);
290 mvif->group_wcid.hw_key_idx = -1;
291 mtxq = (struct mt76_txq *)vif->txq->drv_priv;
292 mtxq->wcid = &mvif->group_wcid;
294 mt76_txq_init(&dev->mt76, vif->txq);
298 mt76x02_add_interface(struct ieee80211_hw *hw, struct ieee80211_vif *vif)
300 struct mt76x02_dev *dev = hw->priv;
301 unsigned int idx = 0;
303 /* Allow to change address in HW if we create first interface. */
304 if (!dev->vif_mask &&
305 (((vif->addr[0] ^ dev->mt76.macaddr[0]) & ~GENMASK(4, 1)) ||
306 memcmp(vif->addr + 1, dev->mt76.macaddr + 1, ETH_ALEN - 1)))
307 mt76x02_mac_setaddr(dev, vif->addr);
309 if (vif->addr[0] & BIT(1))
310 idx = 1 + (((dev->mt76.macaddr[0] ^ vif->addr[0]) >> 2) & 7);
313 * Client mode typically only has one configurable BSSID register,
314 * which is used for bssidx=0. This is linked to the MAC address.
315 * Since mac80211 allows changing interface types, and we cannot
316 * force the use of the primary MAC address for a station mode
317 * interface, we need some other way of configuring a per-interface
319 * The hardware provides an AP-Client feature, where bssidx 0-7 are
320 * used for AP mode and bssidx 8-15 for client mode.
321 * We shift the station interface bss index by 8 to force the
322 * hardware to recognize the BSSID.
323 * The resulting bssidx mismatch for unicast frames is ignored by hw.
325 if (vif->type == NL80211_IFTYPE_STATION)
328 if (dev->vif_mask & BIT(idx))
331 dev->vif_mask |= BIT(idx);
333 mt76x02_vif_init(dev, vif, idx);
336 EXPORT_SYMBOL_GPL(mt76x02_add_interface);
338 void mt76x02_remove_interface(struct ieee80211_hw *hw,
339 struct ieee80211_vif *vif)
341 struct mt76x02_dev *dev = hw->priv;
342 struct mt76x02_vif *mvif = (struct mt76x02_vif *)vif->drv_priv;
344 mt76_txq_remove(&dev->mt76, vif->txq);
345 dev->vif_mask &= ~BIT(mvif->idx);
347 EXPORT_SYMBOL_GPL(mt76x02_remove_interface);
349 int mt76x02_ampdu_action(struct ieee80211_hw *hw, struct ieee80211_vif *vif,
350 struct ieee80211_ampdu_params *params)
352 enum ieee80211_ampdu_mlme_action action = params->action;
353 struct ieee80211_sta *sta = params->sta;
354 struct mt76x02_dev *dev = hw->priv;
355 struct mt76x02_sta *msta = (struct mt76x02_sta *)sta->drv_priv;
356 struct ieee80211_txq *txq = sta->txq[params->tid];
357 u16 tid = params->tid;
358 u16 ssn = params->ssn;
359 struct mt76_txq *mtxq;
365 mtxq = (struct mt76_txq *)txq->drv_priv;
367 mutex_lock(&dev->mt76.mutex);
369 case IEEE80211_AMPDU_RX_START:
370 mt76_rx_aggr_start(&dev->mt76, &msta->wcid, tid,
371 ssn, params->buf_size);
372 mt76_set(dev, MT_WCID_ADDR(msta->wcid.idx) + 4, BIT(16 + tid));
374 case IEEE80211_AMPDU_RX_STOP:
375 mt76_rx_aggr_stop(&dev->mt76, &msta->wcid, tid);
376 mt76_clear(dev, MT_WCID_ADDR(msta->wcid.idx) + 4,
379 case IEEE80211_AMPDU_TX_OPERATIONAL:
381 mtxq->send_bar = false;
382 ieee80211_send_bar(vif, sta->addr, tid, mtxq->agg_ssn);
384 case IEEE80211_AMPDU_TX_STOP_FLUSH:
385 case IEEE80211_AMPDU_TX_STOP_FLUSH_CONT:
388 case IEEE80211_AMPDU_TX_START:
389 mtxq->agg_ssn = IEEE80211_SN_TO_SEQ(ssn);
390 ret = IEEE80211_AMPDU_TX_START_IMMEDIATE;
392 case IEEE80211_AMPDU_TX_STOP_CONT:
394 ieee80211_stop_tx_ba_cb_irqsafe(vif, sta->addr, tid);
397 mutex_unlock(&dev->mt76.mutex);
401 EXPORT_SYMBOL_GPL(mt76x02_ampdu_action);
403 int mt76x02_set_key(struct ieee80211_hw *hw, enum set_key_cmd cmd,
404 struct ieee80211_vif *vif, struct ieee80211_sta *sta,
405 struct ieee80211_key_conf *key)
407 struct mt76x02_dev *dev = hw->priv;
408 struct mt76x02_vif *mvif = (struct mt76x02_vif *)vif->drv_priv;
409 struct mt76x02_sta *msta;
410 struct mt76_wcid *wcid;
411 int idx = key->keyidx;
414 /* fall back to sw encryption for unsupported ciphers */
415 switch (key->cipher) {
416 case WLAN_CIPHER_SUITE_WEP40:
417 case WLAN_CIPHER_SUITE_WEP104:
418 case WLAN_CIPHER_SUITE_TKIP:
419 case WLAN_CIPHER_SUITE_CCMP:
426 * The hardware does not support per-STA RX GTK, fall back
427 * to software mode for these.
429 if ((vif->type == NL80211_IFTYPE_ADHOC ||
430 vif->type == NL80211_IFTYPE_MESH_POINT) &&
431 (key->cipher == WLAN_CIPHER_SUITE_TKIP ||
432 key->cipher == WLAN_CIPHER_SUITE_CCMP) &&
433 !(key->flags & IEEE80211_KEY_FLAG_PAIRWISE))
437 * In USB AP mode, broadcast/multicast frames are setup in beacon
438 * data registers and sent via HW beacons engine, they require to
439 * be already encrypted.
441 if (mt76_is_usb(&dev->mt76) &&
442 vif->type == NL80211_IFTYPE_AP &&
443 !(key->flags & IEEE80211_KEY_FLAG_PAIRWISE))
446 msta = sta ? (struct mt76x02_sta *)sta->drv_priv : NULL;
447 wcid = msta ? &msta->wcid : &mvif->group_wcid;
449 if (cmd == SET_KEY) {
450 key->hw_key_idx = wcid->idx;
451 wcid->hw_key_idx = idx;
452 if (key->flags & IEEE80211_KEY_FLAG_RX_MGMT) {
453 key->flags |= IEEE80211_KEY_FLAG_SW_MGMT_TX;
457 if (idx == wcid->hw_key_idx) {
458 wcid->hw_key_idx = -1;
464 mt76_wcid_key_setup(&dev->mt76, wcid, key);
467 if (key || wcid->hw_key_idx == idx) {
468 ret = mt76x02_mac_wcid_set_key(dev, wcid->idx, key);
473 return mt76x02_mac_shared_key_setup(dev, mvif->idx, idx, key);
476 return mt76x02_mac_wcid_set_key(dev, msta->wcid.idx, key);
478 EXPORT_SYMBOL_GPL(mt76x02_set_key);
480 int mt76x02_conf_tx(struct ieee80211_hw *hw, struct ieee80211_vif *vif,
481 u16 queue, const struct ieee80211_tx_queue_params *params)
483 struct mt76x02_dev *dev = hw->priv;
484 u8 cw_min = 5, cw_max = 10, qid;
487 qid = dev->mt76.q_tx[queue].q->hw_idx;
490 cw_min = fls(params->cw_min);
492 cw_max = fls(params->cw_max);
494 val = FIELD_PREP(MT_EDCA_CFG_TXOP, params->txop) |
495 FIELD_PREP(MT_EDCA_CFG_AIFSN, params->aifs) |
496 FIELD_PREP(MT_EDCA_CFG_CWMIN, cw_min) |
497 FIELD_PREP(MT_EDCA_CFG_CWMAX, cw_max);
498 mt76_wr(dev, MT_EDCA_CFG_AC(qid), val);
500 val = mt76_rr(dev, MT_WMM_TXOP(qid));
501 val &= ~(MT_WMM_TXOP_MASK << MT_WMM_TXOP_SHIFT(qid));
502 val |= params->txop << MT_WMM_TXOP_SHIFT(qid);
503 mt76_wr(dev, MT_WMM_TXOP(qid), val);
505 val = mt76_rr(dev, MT_WMM_AIFSN);
506 val &= ~(MT_WMM_AIFSN_MASK << MT_WMM_AIFSN_SHIFT(qid));
507 val |= params->aifs << MT_WMM_AIFSN_SHIFT(qid);
508 mt76_wr(dev, MT_WMM_AIFSN, val);
510 val = mt76_rr(dev, MT_WMM_CWMIN);
511 val &= ~(MT_WMM_CWMIN_MASK << MT_WMM_CWMIN_SHIFT(qid));
512 val |= cw_min << MT_WMM_CWMIN_SHIFT(qid);
513 mt76_wr(dev, MT_WMM_CWMIN, val);
515 val = mt76_rr(dev, MT_WMM_CWMAX);
516 val &= ~(MT_WMM_CWMAX_MASK << MT_WMM_CWMAX_SHIFT(qid));
517 val |= cw_max << MT_WMM_CWMAX_SHIFT(qid);
518 mt76_wr(dev, MT_WMM_CWMAX, val);
522 EXPORT_SYMBOL_GPL(mt76x02_conf_tx);
524 void mt76x02_set_tx_ackto(struct mt76x02_dev *dev)
526 u8 ackto, sifs, slottime = dev->slottime;
528 /* As defined by IEEE 802.11-2007 17.3.8.6 */
529 slottime += 3 * dev->coverage_class;
530 mt76_rmw_field(dev, MT_BKOFF_SLOT_CFG,
531 MT_BKOFF_SLOT_CFG_SLOTTIME, slottime);
533 sifs = mt76_get_field(dev, MT_XIFS_TIME_CFG,
534 MT_XIFS_TIME_CFG_OFDM_SIFS);
536 ackto = slottime + sifs;
537 mt76_rmw_field(dev, MT_TX_TIMEOUT_CFG,
538 MT_TX_TIMEOUT_CFG_ACKTO, ackto);
540 EXPORT_SYMBOL_GPL(mt76x02_set_tx_ackto);
542 void mt76x02_set_coverage_class(struct ieee80211_hw *hw,
545 struct mt76x02_dev *dev = hw->priv;
547 mutex_lock(&dev->mt76.mutex);
548 dev->coverage_class = coverage_class;
549 mt76x02_set_tx_ackto(dev);
550 mutex_unlock(&dev->mt76.mutex);
552 EXPORT_SYMBOL_GPL(mt76x02_set_coverage_class);
554 int mt76x02_set_rts_threshold(struct ieee80211_hw *hw, u32 val)
556 struct mt76x02_dev *dev = hw->priv;
558 if (val != ~0 && val > 0xffff)
561 mutex_lock(&dev->mt76.mutex);
562 mt76x02_mac_set_rts_thresh(dev, val);
563 mutex_unlock(&dev->mt76.mutex);
567 EXPORT_SYMBOL_GPL(mt76x02_set_rts_threshold);
569 void mt76x02_sta_rate_tbl_update(struct ieee80211_hw *hw,
570 struct ieee80211_vif *vif,
571 struct ieee80211_sta *sta)
573 struct mt76x02_dev *dev = hw->priv;
574 struct mt76x02_sta *msta = (struct mt76x02_sta *)sta->drv_priv;
575 struct ieee80211_sta_rates *rates = rcu_dereference(sta->rates);
576 struct ieee80211_tx_rate rate = {};
581 rate.idx = rates->rate[0].idx;
582 rate.flags = rates->rate[0].flags;
583 mt76x02_mac_wcid_set_rate(dev, &msta->wcid, &rate);
585 EXPORT_SYMBOL_GPL(mt76x02_sta_rate_tbl_update);
587 void mt76x02_remove_hdr_pad(struct sk_buff *skb, int len)
594 hdrlen = ieee80211_get_hdrlen_from_skb(skb);
595 memmove(skb->data + len, skb->data, hdrlen);
598 EXPORT_SYMBOL_GPL(mt76x02_remove_hdr_pad);
600 void mt76x02_sw_scan_complete(struct ieee80211_hw *hw,
601 struct ieee80211_vif *vif)
603 struct mt76x02_dev *dev = hw->priv;
605 clear_bit(MT76_SCANNING, &dev->mt76.state);
606 if (dev->cal.gain_init_done) {
607 /* Restore AGC gain and resume calibration after scanning. */
608 dev->cal.low_gain = -1;
609 ieee80211_queue_delayed_work(hw, &dev->cal_work, 0);
612 EXPORT_SYMBOL_GPL(mt76x02_sw_scan_complete);
614 void mt76x02_sta_ps(struct mt76_dev *mdev, struct ieee80211_sta *sta,
617 struct mt76x02_dev *dev = container_of(mdev, struct mt76x02_dev, mt76);
618 struct mt76x02_sta *msta = (struct mt76x02_sta *)sta->drv_priv;
619 int idx = msta->wcid.idx;
621 mt76_stop_tx_queues(&dev->mt76, sta, true);
622 if (mt76_is_mmio(mdev))
623 mt76x02_mac_wcid_set_drop(dev, idx, ps);
625 EXPORT_SYMBOL_GPL(mt76x02_sta_ps);
627 void mt76x02_bss_info_changed(struct ieee80211_hw *hw,
628 struct ieee80211_vif *vif,
629 struct ieee80211_bss_conf *info,
632 struct mt76x02_vif *mvif = (struct mt76x02_vif *)vif->drv_priv;
633 struct mt76x02_dev *dev = hw->priv;
635 mutex_lock(&dev->mt76.mutex);
637 if (changed & BSS_CHANGED_BSSID)
638 mt76x02_mac_set_bssid(dev, mvif->idx, info->bssid);
640 if (changed & BSS_CHANGED_HT || changed & BSS_CHANGED_ERP_CTS_PROT)
641 mt76x02_mac_set_tx_protection(dev, info->use_cts_prot,
642 info->ht_operation_mode);
644 if (changed & BSS_CHANGED_BEACON_INT) {
645 mt76_rmw_field(dev, MT_BEACON_TIME_CFG,
646 MT_BEACON_TIME_CFG_INTVAL,
647 info->beacon_int << 4);
648 dev->mt76.beacon_int = info->beacon_int;
651 if (changed & BSS_CHANGED_BEACON_ENABLED)
652 mt76x02_mac_set_beacon_enable(dev, vif, info->enable_beacon);
654 if (changed & BSS_CHANGED_ERP_PREAMBLE)
655 mt76x02_mac_set_short_preamble(dev, info->use_short_preamble);
657 if (changed & BSS_CHANGED_ERP_SLOT) {
658 int slottime = info->use_short_slot ? 9 : 20;
660 dev->slottime = slottime;
661 mt76x02_set_tx_ackto(dev);
664 mutex_unlock(&dev->mt76.mutex);
666 EXPORT_SYMBOL_GPL(mt76x02_bss_info_changed);
668 void mt76x02_config_mac_addr_list(struct mt76x02_dev *dev)
670 struct ieee80211_hw *hw = mt76_hw(dev);
671 struct wiphy *wiphy = hw->wiphy;
674 for (i = 0; i < ARRAY_SIZE(dev->macaddr_list); i++) {
675 u8 *addr = dev->macaddr_list[i].addr;
677 memcpy(addr, dev->mt76.macaddr, ETH_ALEN);
683 addr[0] ^= ((i - 1) << 2);
685 wiphy->addresses = dev->macaddr_list;
686 wiphy->n_addresses = ARRAY_SIZE(dev->macaddr_list);
688 EXPORT_SYMBOL_GPL(mt76x02_config_mac_addr_list);
690 MODULE_LICENSE("Dual BSD/GPL");