diff options
author | Lorenzo Bianconi <lorenzo.bianconi@redhat.com> | 2018-10-07 05:45:22 -0400 |
---|---|---|
committer | Felix Fietkau <nbd@nbd.name> | 2018-10-13 11:39:22 -0400 |
commit | 8d66af49a3db9a74c34c0bbf9b47e376fc1f7019 (patch) | |
tree | 1465e0c42ba974516a1cd2327713afa958952fcc /drivers/net/wireless | |
parent | 95c3e451e6277462790b56aac568414c067a11f8 (diff) |
mt76: use mt76x02_dev instead of mt76_dev in mt76x02_mac.c
Use mt76x02_dev data structure as reference in mt76x02_mac.c
instead of mt76_dev
Signed-off-by: Lorenzo Bianconi <lorenzo.bianconi@redhat.com>
Signed-off-by: Felix Fietkau <nbd@nbd.name>
Diffstat (limited to 'drivers/net/wireless')
14 files changed, 111 insertions, 110 deletions
diff --git a/drivers/net/wireless/mediatek/mt76/mt76x0/eeprom.c b/drivers/net/wireless/mediatek/mt76/mt76x0/eeprom.c index 5735038c0e2d..bea1af7ffa73 100644 --- a/drivers/net/wireless/mediatek/mt76/mt76x0/eeprom.c +++ b/drivers/net/wireless/mediatek/mt76/mt76x0/eeprom.c | |||
@@ -337,8 +337,7 @@ int mt76x0_eeprom_init(struct mt76x02_dev *dev) | |||
337 | dev_info(dev->mt76.dev, "EEPROM ver:%02hhx fae:%02hhx\n", | 337 | dev_info(dev->mt76.dev, "EEPROM ver:%02hhx fae:%02hhx\n", |
338 | version, fae); | 338 | version, fae); |
339 | 339 | ||
340 | mt76x02_mac_setaddr(&dev->mt76, | 340 | mt76x02_mac_setaddr(dev, dev->mt76.eeprom.data + MT_EE_MAC_ADDR); |
341 | dev->mt76.eeprom.data + MT_EE_MAC_ADDR); | ||
342 | mt76x0_set_chip_cap(dev); | 341 | mt76x0_set_chip_cap(dev); |
343 | mt76x0_set_freq_offset(dev); | 342 | mt76x0_set_freq_offset(dev); |
344 | mt76x0_set_temp_offset(dev); | 343 | mt76x0_set_temp_offset(dev); |
diff --git a/drivers/net/wireless/mediatek/mt76/mt76x02.h b/drivers/net/wireless/mediatek/mt76/mt76x02.h index 724c46b137e8..30a9790793d3 100644 --- a/drivers/net/wireless/mediatek/mt76/mt76x02.h +++ b/drivers/net/wireless/mediatek/mt76/mt76x02.h | |||
@@ -143,7 +143,7 @@ void mt76x02_tx_set_txpwr_auto(struct mt76x02_dev *dev, s8 txpwr); | |||
143 | int mt76x02_insert_hdr_pad(struct sk_buff *skb); | 143 | int mt76x02_insert_hdr_pad(struct sk_buff *skb); |
144 | void mt76x02_remove_hdr_pad(struct sk_buff *skb, int len); | 144 | void mt76x02_remove_hdr_pad(struct sk_buff *skb, int len); |
145 | void mt76x02_tx_complete(struct mt76_dev *dev, struct sk_buff *skb); | 145 | void mt76x02_tx_complete(struct mt76_dev *dev, struct sk_buff *skb); |
146 | bool mt76x02_tx_status_data(struct mt76_dev *dev, u8 *update); | 146 | bool mt76x02_tx_status_data(struct mt76_dev *mdev, u8 *update); |
147 | void mt76x02_queue_rx_skb(struct mt76_dev *mdev, enum mt76_rxq_id q, | 147 | void mt76x02_queue_rx_skb(struct mt76_dev *mdev, enum mt76_rxq_id q, |
148 | struct sk_buff *skb); | 148 | struct sk_buff *skb); |
149 | void mt76x02_rx_poll_complete(struct mt76_dev *mdev, enum mt76_rxq_id q); | 149 | void mt76x02_rx_poll_complete(struct mt76_dev *mdev, enum mt76_rxq_id q); |
diff --git a/drivers/net/wireless/mediatek/mt76/mt76x02_mac.c b/drivers/net/wireless/mediatek/mt76/mt76x02_mac.c index 244245418ebb..e217dcec28d9 100644 --- a/drivers/net/wireless/mediatek/mt76/mt76x02_mac.c +++ b/drivers/net/wireless/mediatek/mt76/mt76x02_mac.c | |||
@@ -45,8 +45,8 @@ mt76x02_mac_get_key_info(struct ieee80211_key_conf *key, u8 *key_data) | |||
45 | } | 45 | } |
46 | EXPORT_SYMBOL_GPL(mt76x02_mac_get_key_info); | 46 | EXPORT_SYMBOL_GPL(mt76x02_mac_get_key_info); |
47 | 47 | ||
48 | int mt76x02_mac_shared_key_setup(struct mt76_dev *dev, u8 vif_idx, u8 key_idx, | 48 | int mt76x02_mac_shared_key_setup(struct mt76x02_dev *dev, u8 vif_idx, |
49 | struct ieee80211_key_conf *key) | 49 | u8 key_idx, struct ieee80211_key_conf *key) |
50 | { | 50 | { |
51 | enum mt76x02_cipher_type cipher; | 51 | enum mt76x02_cipher_type cipher; |
52 | u8 key_data[32]; | 52 | u8 key_data[32]; |
@@ -56,20 +56,20 @@ int mt76x02_mac_shared_key_setup(struct mt76_dev *dev, u8 vif_idx, u8 key_idx, | |||
56 | if (cipher == MT_CIPHER_NONE && key) | 56 | if (cipher == MT_CIPHER_NONE && key) |
57 | return -EOPNOTSUPP; | 57 | return -EOPNOTSUPP; |
58 | 58 | ||
59 | val = __mt76_rr(dev, MT_SKEY_MODE(vif_idx)); | 59 | val = mt76_rr(dev, MT_SKEY_MODE(vif_idx)); |
60 | val &= ~(MT_SKEY_MODE_MASK << MT_SKEY_MODE_SHIFT(vif_idx, key_idx)); | 60 | val &= ~(MT_SKEY_MODE_MASK << MT_SKEY_MODE_SHIFT(vif_idx, key_idx)); |
61 | val |= cipher << MT_SKEY_MODE_SHIFT(vif_idx, key_idx); | 61 | val |= cipher << MT_SKEY_MODE_SHIFT(vif_idx, key_idx); |
62 | __mt76_wr(dev, MT_SKEY_MODE(vif_idx), val); | 62 | mt76_wr(dev, MT_SKEY_MODE(vif_idx), val); |
63 | 63 | ||
64 | __mt76_wr_copy(dev, MT_SKEY(vif_idx, key_idx), key_data, | 64 | mt76_wr_copy(dev, MT_SKEY(vif_idx, key_idx), key_data, |
65 | sizeof(key_data)); | 65 | sizeof(key_data)); |
66 | 66 | ||
67 | return 0; | 67 | return 0; |
68 | } | 68 | } |
69 | EXPORT_SYMBOL_GPL(mt76x02_mac_shared_key_setup); | 69 | EXPORT_SYMBOL_GPL(mt76x02_mac_shared_key_setup); |
70 | 70 | ||
71 | int mt76x02_mac_wcid_set_key(struct mt76_dev *dev, u8 idx, | 71 | int mt76x02_mac_wcid_set_key(struct mt76x02_dev *dev, u8 idx, |
72 | struct ieee80211_key_conf *key) | 72 | struct ieee80211_key_conf *key) |
73 | { | 73 | { |
74 | enum mt76x02_cipher_type cipher; | 74 | enum mt76x02_cipher_type cipher; |
75 | u8 key_data[32]; | 75 | u8 key_data[32]; |
@@ -79,25 +79,26 @@ int mt76x02_mac_wcid_set_key(struct mt76_dev *dev, u8 idx, | |||
79 | if (cipher == MT_CIPHER_NONE && key) | 79 | if (cipher == MT_CIPHER_NONE && key) |
80 | return -EOPNOTSUPP; | 80 | return -EOPNOTSUPP; |
81 | 81 | ||
82 | __mt76_wr_copy(dev, MT_WCID_KEY(idx), key_data, sizeof(key_data)); | 82 | mt76_wr_copy(dev, MT_WCID_KEY(idx), key_data, sizeof(key_data)); |
83 | __mt76_rmw_field(dev, MT_WCID_ATTR(idx), MT_WCID_ATTR_PKEY_MODE, cipher); | 83 | mt76_rmw_field(dev, MT_WCID_ATTR(idx), MT_WCID_ATTR_PKEY_MODE, cipher); |
84 | 84 | ||
85 | memset(iv_data, 0, sizeof(iv_data)); | 85 | memset(iv_data, 0, sizeof(iv_data)); |
86 | if (key) { | 86 | if (key) { |
87 | __mt76_rmw_field(dev, MT_WCID_ATTR(idx), MT_WCID_ATTR_PAIRWISE, | 87 | mt76_rmw_field(dev, MT_WCID_ATTR(idx), MT_WCID_ATTR_PAIRWISE, |
88 | !!(key->flags & IEEE80211_KEY_FLAG_PAIRWISE)); | 88 | !!(key->flags & IEEE80211_KEY_FLAG_PAIRWISE)); |
89 | iv_data[3] = key->keyidx << 6; | 89 | iv_data[3] = key->keyidx << 6; |
90 | if (cipher >= MT_CIPHER_TKIP) | 90 | if (cipher >= MT_CIPHER_TKIP) |
91 | iv_data[3] |= 0x20; | 91 | iv_data[3] |= 0x20; |
92 | } | 92 | } |
93 | 93 | ||
94 | __mt76_wr_copy(dev, MT_WCID_IV(idx), iv_data, sizeof(iv_data)); | 94 | mt76_wr_copy(dev, MT_WCID_IV(idx), iv_data, sizeof(iv_data)); |
95 | 95 | ||
96 | return 0; | 96 | return 0; |
97 | } | 97 | } |
98 | EXPORT_SYMBOL_GPL(mt76x02_mac_wcid_set_key); | 98 | EXPORT_SYMBOL_GPL(mt76x02_mac_wcid_set_key); |
99 | 99 | ||
100 | void mt76x02_mac_wcid_setup(struct mt76_dev *dev, u8 idx, u8 vif_idx, u8 *mac) | 100 | void mt76x02_mac_wcid_setup(struct mt76x02_dev *dev, u8 idx, |
101 | u8 vif_idx, u8 *mac) | ||
101 | { | 102 | { |
102 | struct mt76_wcid_addr addr = {}; | 103 | struct mt76_wcid_addr addr = {}; |
103 | u32 attr; | 104 | u32 attr; |
@@ -105,10 +106,10 @@ void mt76x02_mac_wcid_setup(struct mt76_dev *dev, u8 idx, u8 vif_idx, u8 *mac) | |||
105 | attr = FIELD_PREP(MT_WCID_ATTR_BSS_IDX, vif_idx & 7) | | 106 | attr = FIELD_PREP(MT_WCID_ATTR_BSS_IDX, vif_idx & 7) | |
106 | FIELD_PREP(MT_WCID_ATTR_BSS_IDX_EXT, !!(vif_idx & 8)); | 107 | FIELD_PREP(MT_WCID_ATTR_BSS_IDX_EXT, !!(vif_idx & 8)); |
107 | 108 | ||
108 | __mt76_wr(dev, MT_WCID_ATTR(idx), attr); | 109 | mt76_wr(dev, MT_WCID_ATTR(idx), attr); |
109 | 110 | ||
110 | __mt76_wr(dev, MT_WCID_TX_RATE(idx), 0); | 111 | mt76_wr(dev, MT_WCID_TX_RATE(idx), 0); |
111 | __mt76_wr(dev, MT_WCID_TX_RATE(idx) + 4, 0); | 112 | mt76_wr(dev, MT_WCID_TX_RATE(idx) + 4, 0); |
112 | 113 | ||
113 | if (idx >= 128) | 114 | if (idx >= 128) |
114 | return; | 115 | return; |
@@ -116,22 +117,22 @@ void mt76x02_mac_wcid_setup(struct mt76_dev *dev, u8 idx, u8 vif_idx, u8 *mac) | |||
116 | if (mac) | 117 | if (mac) |
117 | memcpy(addr.macaddr, mac, ETH_ALEN); | 118 | memcpy(addr.macaddr, mac, ETH_ALEN); |
118 | 119 | ||
119 | __mt76_wr_copy(dev, MT_WCID_ADDR(idx), &addr, sizeof(addr)); | 120 | mt76_wr_copy(dev, MT_WCID_ADDR(idx), &addr, sizeof(addr)); |
120 | } | 121 | } |
121 | EXPORT_SYMBOL_GPL(mt76x02_mac_wcid_setup); | 122 | EXPORT_SYMBOL_GPL(mt76x02_mac_wcid_setup); |
122 | 123 | ||
123 | void mt76x02_mac_wcid_set_drop(struct mt76_dev *dev, u8 idx, bool drop) | 124 | void mt76x02_mac_wcid_set_drop(struct mt76x02_dev *dev, u8 idx, bool drop) |
124 | { | 125 | { |
125 | u32 val = __mt76_rr(dev, MT_WCID_DROP(idx)); | 126 | u32 val = mt76_rr(dev, MT_WCID_DROP(idx)); |
126 | u32 bit = MT_WCID_DROP_MASK(idx); | 127 | u32 bit = MT_WCID_DROP_MASK(idx); |
127 | 128 | ||
128 | /* prevent unnecessary writes */ | 129 | /* prevent unnecessary writes */ |
129 | if ((val & bit) != (bit * drop)) | 130 | if ((val & bit) != (bit * drop)) |
130 | __mt76_wr(dev, MT_WCID_DROP(idx), (val & ~bit) | (bit * drop)); | 131 | mt76_wr(dev, MT_WCID_DROP(idx), (val & ~bit) | (bit * drop)); |
131 | } | 132 | } |
132 | EXPORT_SYMBOL_GPL(mt76x02_mac_wcid_set_drop); | 133 | EXPORT_SYMBOL_GPL(mt76x02_mac_wcid_set_drop); |
133 | 134 | ||
134 | void mt76x02_txq_init(struct mt76_dev *dev, struct ieee80211_txq *txq) | 135 | void mt76x02_txq_init(struct mt76x02_dev *dev, struct ieee80211_txq *txq) |
135 | { | 136 | { |
136 | struct mt76_txq *mtxq; | 137 | struct mt76_txq *mtxq; |
137 | 138 | ||
@@ -151,7 +152,7 @@ void mt76x02_txq_init(struct mt76_dev *dev, struct ieee80211_txq *txq) | |||
151 | mtxq->wcid = &mvif->group_wcid; | 152 | mtxq->wcid = &mvif->group_wcid; |
152 | } | 153 | } |
153 | 154 | ||
154 | mt76_txq_init(dev, txq); | 155 | mt76_txq_init(&dev->mt76, txq); |
155 | } | 156 | } |
156 | EXPORT_SYMBOL_GPL(mt76x02_txq_init); | 157 | EXPORT_SYMBOL_GPL(mt76x02_txq_init); |
157 | 158 | ||
@@ -198,8 +199,8 @@ mt76x02_mac_fill_txwi(struct mt76x02_txwi *txwi, struct sk_buff *skb, | |||
198 | } | 199 | } |
199 | 200 | ||
200 | static __le16 | 201 | static __le16 |
201 | mt76x02_mac_tx_rate_val(struct mt76_dev *dev, | 202 | mt76x02_mac_tx_rate_val(struct mt76x02_dev *dev, |
202 | const struct ieee80211_tx_rate *rate, u8 *nss_val) | 203 | const struct ieee80211_tx_rate *rate, u8 *nss_val) |
203 | { | 204 | { |
204 | u16 rateval; | 205 | u16 rateval; |
205 | u8 phy, rate_idx; | 206 | u8 phy, rate_idx; |
@@ -224,10 +225,10 @@ mt76x02_mac_tx_rate_val(struct mt76_dev *dev, | |||
224 | bw = 1; | 225 | bw = 1; |
225 | } else { | 226 | } else { |
226 | const struct ieee80211_rate *r; | 227 | const struct ieee80211_rate *r; |
227 | int band = dev->chandef.chan->band; | 228 | int band = dev->mt76.chandef.chan->band; |
228 | u16 val; | 229 | u16 val; |
229 | 230 | ||
230 | r = &dev->hw->wiphy->bands[band]->bitrates[rate->idx]; | 231 | r = &dev->mt76.hw->wiphy->bands[band]->bitrates[rate->idx]; |
231 | if (rate->flags & IEEE80211_TX_RC_USE_SHORT_PREAMBLE) | 232 | if (rate->flags & IEEE80211_TX_RC_USE_SHORT_PREAMBLE) |
232 | val = r->hw_value_short; | 233 | val = r->hw_value_short; |
233 | else | 234 | else |
@@ -248,22 +249,22 @@ mt76x02_mac_tx_rate_val(struct mt76_dev *dev, | |||
248 | return cpu_to_le16(rateval); | 249 | return cpu_to_le16(rateval); |
249 | } | 250 | } |
250 | 251 | ||
251 | void mt76x02_mac_wcid_set_rate(struct mt76_dev *dev, struct mt76_wcid *wcid, | 252 | void mt76x02_mac_wcid_set_rate(struct mt76x02_dev *dev, struct mt76_wcid *wcid, |
252 | const struct ieee80211_tx_rate *rate) | 253 | const struct ieee80211_tx_rate *rate) |
253 | { | 254 | { |
254 | spin_lock_bh(&dev->lock); | 255 | spin_lock_bh(&dev->mt76.lock); |
255 | wcid->tx_rate = mt76x02_mac_tx_rate_val(dev, rate, &wcid->tx_rate_nss); | 256 | wcid->tx_rate = mt76x02_mac_tx_rate_val(dev, rate, &wcid->tx_rate_nss); |
256 | wcid->tx_rate_set = true; | 257 | wcid->tx_rate_set = true; |
257 | spin_unlock_bh(&dev->lock); | 258 | spin_unlock_bh(&dev->mt76.lock); |
258 | } | 259 | } |
259 | 260 | ||
260 | bool mt76x02_mac_load_tx_status(struct mt76_dev *dev, | 261 | bool mt76x02_mac_load_tx_status(struct mt76x02_dev *dev, |
261 | struct mt76x02_tx_status *stat) | 262 | struct mt76x02_tx_status *stat) |
262 | { | 263 | { |
263 | u32 stat1, stat2; | 264 | u32 stat1, stat2; |
264 | 265 | ||
265 | stat2 = __mt76_rr(dev, MT_TX_STAT_FIFO_EXT); | 266 | stat2 = mt76_rr(dev, MT_TX_STAT_FIFO_EXT); |
266 | stat1 = __mt76_rr(dev, MT_TX_STAT_FIFO); | 267 | stat1 = mt76_rr(dev, MT_TX_STAT_FIFO); |
267 | 268 | ||
268 | stat->valid = !!(stat1 & MT_TX_STAT_FIFO_VALID); | 269 | stat->valid = !!(stat1 & MT_TX_STAT_FIFO_VALID); |
269 | if (!stat->valid) | 270 | if (!stat->valid) |
@@ -339,7 +340,7 @@ mt76x02_mac_process_tx_rate(struct ieee80211_tx_rate *txrate, u16 rate, | |||
339 | return 0; | 340 | return 0; |
340 | } | 341 | } |
341 | 342 | ||
342 | void mt76x02_mac_write_txwi(struct mt76_dev *dev, struct mt76x02_txwi *txwi, | 343 | void mt76x02_mac_write_txwi(struct mt76x02_dev *dev, struct mt76x02_txwi *txwi, |
343 | struct sk_buff *skb, struct mt76_wcid *wcid, | 344 | struct sk_buff *skb, struct mt76_wcid *wcid, |
344 | struct ieee80211_sta *sta, int len) | 345 | struct ieee80211_sta *sta, int len) |
345 | { | 346 | { |
@@ -349,7 +350,7 @@ void mt76x02_mac_write_txwi(struct mt76_dev *dev, struct mt76x02_txwi *txwi, | |||
349 | u16 rate_ht_mask = FIELD_PREP(MT_RXWI_RATE_PHY, BIT(1) | BIT(2)); | 350 | u16 rate_ht_mask = FIELD_PREP(MT_RXWI_RATE_PHY, BIT(1) | BIT(2)); |
350 | u8 nss; | 351 | u8 nss; |
351 | s8 txpwr_adj, max_txpwr_adj; | 352 | s8 txpwr_adj, max_txpwr_adj; |
352 | u8 ccmp_pn[8], nstreams = dev->chainmask & 0xf; | 353 | u8 ccmp_pn[8], nstreams = dev->mt76.chainmask & 0xf; |
353 | 354 | ||
354 | memset(txwi, 0, sizeof(*txwi)); | 355 | memset(txwi, 0, sizeof(*txwi)); |
355 | 356 | ||
@@ -374,24 +375,25 @@ void mt76x02_mac_write_txwi(struct mt76_dev *dev, struct mt76x02_txwi *txwi, | |||
374 | txwi->eiv = *((__le32 *)&ccmp_pn[1]); | 375 | txwi->eiv = *((__le32 *)&ccmp_pn[1]); |
375 | } | 376 | } |
376 | 377 | ||
377 | spin_lock_bh(&dev->lock); | 378 | spin_lock_bh(&dev->mt76.lock); |
378 | if (wcid && (rate->idx < 0 || !rate->count)) { | 379 | if (wcid && (rate->idx < 0 || !rate->count)) { |
379 | txwi->rate = wcid->tx_rate; | 380 | txwi->rate = wcid->tx_rate; |
380 | max_txpwr_adj = wcid->max_txpwr_adj; | 381 | max_txpwr_adj = wcid->max_txpwr_adj; |
381 | nss = wcid->tx_rate_nss; | 382 | nss = wcid->tx_rate_nss; |
382 | } else { | 383 | } else { |
383 | txwi->rate = mt76x02_mac_tx_rate_val(dev, rate, &nss); | 384 | txwi->rate = mt76x02_mac_tx_rate_val(dev, rate, &nss); |
384 | max_txpwr_adj = mt76x02_tx_get_max_txpwr_adj(dev, rate); | 385 | max_txpwr_adj = mt76x02_tx_get_max_txpwr_adj(&dev->mt76, rate); |
385 | } | 386 | } |
386 | spin_unlock_bh(&dev->lock); | 387 | spin_unlock_bh(&dev->mt76.lock); |
387 | 388 | ||
388 | txpwr_adj = mt76x02_tx_get_txpwr_adj(dev, dev->txpower_conf, | 389 | txpwr_adj = mt76x02_tx_get_txpwr_adj(&dev->mt76, |
390 | dev->mt76.txpower_conf, | ||
389 | max_txpwr_adj); | 391 | max_txpwr_adj); |
390 | txwi->ctl2 = FIELD_PREP(MT_TX_PWR_ADJ, txpwr_adj); | 392 | txwi->ctl2 = FIELD_PREP(MT_TX_PWR_ADJ, txpwr_adj); |
391 | 393 | ||
392 | if (nstreams > 1 && mt76_rev(dev) >= MT76XX_REV_E4) | 394 | if (nstreams > 1 && mt76_rev(&dev->mt76) >= MT76XX_REV_E4) |
393 | txwi->txstream = 0x13; | 395 | txwi->txstream = 0x13; |
394 | else if (nstreams > 1 && mt76_rev(dev) >= MT76XX_REV_E3 && | 396 | else if (nstreams > 1 && mt76_rev(&dev->mt76) >= MT76XX_REV_E3 && |
395 | !(txwi->rate & cpu_to_le16(rate_ht_mask))) | 397 | !(txwi->rate & cpu_to_le16(rate_ht_mask))) |
396 | txwi->txstream = 0x93; | 398 | txwi->txstream = 0x93; |
397 | 399 | ||
@@ -400,9 +402,9 @@ void mt76x02_mac_write_txwi(struct mt76_dev *dev, struct mt76x02_txwi *txwi, | |||
400 | EXPORT_SYMBOL_GPL(mt76x02_mac_write_txwi); | 402 | EXPORT_SYMBOL_GPL(mt76x02_mac_write_txwi); |
401 | 403 | ||
402 | static void | 404 | static void |
403 | mt76x02_mac_fill_tx_status(struct mt76_dev *dev, | 405 | mt76x02_mac_fill_tx_status(struct mt76x02_dev *dev, |
404 | struct ieee80211_tx_info *info, | 406 | struct ieee80211_tx_info *info, |
405 | struct mt76x02_tx_status *st, int n_frames) | 407 | struct mt76x02_tx_status *st, int n_frames) |
406 | { | 408 | { |
407 | struct ieee80211_tx_rate *rate = info->status.rates; | 409 | struct ieee80211_tx_rate *rate = info->status.rates; |
408 | int cur_idx, last_rate; | 410 | int cur_idx, last_rate; |
@@ -413,7 +415,7 @@ mt76x02_mac_fill_tx_status(struct mt76_dev *dev, | |||
413 | 415 | ||
414 | last_rate = min_t(int, st->retry, IEEE80211_TX_MAX_RATES - 1); | 416 | last_rate = min_t(int, st->retry, IEEE80211_TX_MAX_RATES - 1); |
415 | mt76x02_mac_process_tx_rate(&rate[last_rate], st->rate, | 417 | mt76x02_mac_process_tx_rate(&rate[last_rate], st->rate, |
416 | dev->chandef.chan->band); | 418 | dev->mt76.chandef.chan->band); |
417 | if (last_rate < IEEE80211_TX_MAX_RATES - 1) | 419 | if (last_rate < IEEE80211_TX_MAX_RATES - 1) |
418 | rate[last_rate + 1].idx = -1; | 420 | rate[last_rate + 1].idx = -1; |
419 | 421 | ||
@@ -441,8 +443,8 @@ mt76x02_mac_fill_tx_status(struct mt76_dev *dev, | |||
441 | info->flags |= IEEE80211_TX_STAT_ACK; | 443 | info->flags |= IEEE80211_TX_STAT_ACK; |
442 | } | 444 | } |
443 | 445 | ||
444 | void mt76x02_send_tx_status(struct mt76_dev *dev, | 446 | void mt76x02_send_tx_status(struct mt76x02_dev *dev, |
445 | struct mt76x02_tx_status *stat, u8 *update) | 447 | struct mt76x02_tx_status *stat, u8 *update) |
446 | { | 448 | { |
447 | struct ieee80211_tx_info info = {}; | 449 | struct ieee80211_tx_info info = {}; |
448 | struct ieee80211_sta *sta = NULL; | 450 | struct ieee80211_sta *sta = NULL; |
@@ -450,8 +452,8 @@ void mt76x02_send_tx_status(struct mt76_dev *dev, | |||
450 | struct mt76x02_sta *msta = NULL; | 452 | struct mt76x02_sta *msta = NULL; |
451 | 453 | ||
452 | rcu_read_lock(); | 454 | rcu_read_lock(); |
453 | if (stat->wcid < ARRAY_SIZE(dev->wcid)) | 455 | if (stat->wcid < ARRAY_SIZE(dev->mt76.wcid)) |
454 | wcid = rcu_dereference(dev->wcid[stat->wcid]); | 456 | wcid = rcu_dereference(dev->mt76.wcid[stat->wcid]); |
455 | 457 | ||
456 | if (wcid) { | 458 | if (wcid) { |
457 | void *priv; | 459 | void *priv; |
@@ -476,7 +478,7 @@ void mt76x02_send_tx_status(struct mt76_dev *dev, | |||
476 | } | 478 | } |
477 | 479 | ||
478 | mt76x02_mac_fill_tx_status(dev, &info, &msta->status, | 480 | mt76x02_mac_fill_tx_status(dev, &info, &msta->status, |
479 | msta->n_frames); | 481 | msta->n_frames); |
480 | 482 | ||
481 | msta->status = *stat; | 483 | msta->status = *stat; |
482 | msta->n_frames = 1; | 484 | msta->n_frames = 1; |
@@ -486,7 +488,7 @@ void mt76x02_send_tx_status(struct mt76_dev *dev, | |||
486 | *update = 1; | 488 | *update = 1; |
487 | } | 489 | } |
488 | 490 | ||
489 | ieee80211_tx_status_noskb(dev->hw, sta, &info); | 491 | ieee80211_tx_status_noskb(dev->mt76.hw, sta, &info); |
490 | 492 | ||
491 | out: | 493 | out: |
492 | rcu_read_unlock(); | 494 | rcu_read_unlock(); |
@@ -561,21 +563,21 @@ mt76x02_mac_process_rate(struct mt76_rx_status *status, u16 rate) | |||
561 | } | 563 | } |
562 | EXPORT_SYMBOL_GPL(mt76x02_mac_process_rate); | 564 | EXPORT_SYMBOL_GPL(mt76x02_mac_process_rate); |
563 | 565 | ||
564 | void mt76x02_mac_setaddr(struct mt76_dev *dev, u8 *addr) | 566 | void mt76x02_mac_setaddr(struct mt76x02_dev *dev, u8 *addr) |
565 | { | 567 | { |
566 | ether_addr_copy(dev->macaddr, addr); | 568 | ether_addr_copy(dev->mt76.macaddr, addr); |
567 | 569 | ||
568 | if (!is_valid_ether_addr(dev->macaddr)) { | 570 | if (!is_valid_ether_addr(dev->mt76.macaddr)) { |
569 | eth_random_addr(dev->macaddr); | 571 | eth_random_addr(dev->mt76.macaddr); |
570 | dev_info(dev->dev, | 572 | dev_info(dev->mt76.dev, |
571 | "Invalid MAC address, using random address %pM\n", | 573 | "Invalid MAC address, using random address %pM\n", |
572 | dev->macaddr); | 574 | dev->mt76.macaddr); |
573 | } | 575 | } |
574 | 576 | ||
575 | __mt76_wr(dev, MT_MAC_ADDR_DW0, get_unaligned_le32(dev->macaddr)); | 577 | mt76_wr(dev, MT_MAC_ADDR_DW0, get_unaligned_le32(dev->mt76.macaddr)); |
576 | __mt76_wr(dev, MT_MAC_ADDR_DW1, | 578 | mt76_wr(dev, MT_MAC_ADDR_DW1, |
577 | get_unaligned_le16(dev->macaddr + 4) | | 579 | get_unaligned_le16(dev->mt76.macaddr + 4) | |
578 | FIELD_PREP(MT_MAC_ADDR_DW1_U2ME_MASK, 0xff)); | 580 | FIELD_PREP(MT_MAC_ADDR_DW1_U2ME_MASK, 0xff)); |
579 | } | 581 | } |
580 | EXPORT_SYMBOL_GPL(mt76x02_mac_setaddr); | 582 | EXPORT_SYMBOL_GPL(mt76x02_mac_setaddr); |
581 | 583 | ||
@@ -697,7 +699,7 @@ void mt76x02_mac_poll_tx_status(struct mt76x02_dev *dev, bool irq) | |||
697 | 699 | ||
698 | while (!irq || !kfifo_is_full(&dev->txstatus_fifo)) { | 700 | while (!irq || !kfifo_is_full(&dev->txstatus_fifo)) { |
699 | spin_lock_irqsave(&dev->mt76.mmio.irq_lock, flags); | 701 | spin_lock_irqsave(&dev->mt76.mmio.irq_lock, flags); |
700 | ret = mt76x02_mac_load_tx_status(&dev->mt76, &stat); | 702 | ret = mt76x02_mac_load_tx_status(dev, &stat); |
701 | spin_unlock_irqrestore(&dev->mt76.mmio.irq_lock, flags); | 703 | spin_unlock_irqrestore(&dev->mt76.mmio.irq_lock, flags); |
702 | 704 | ||
703 | if (!ret) | 705 | if (!ret) |
@@ -706,7 +708,7 @@ void mt76x02_mac_poll_tx_status(struct mt76x02_dev *dev, bool irq) | |||
706 | trace_mac_txstat_fetch(dev, &stat); | 708 | trace_mac_txstat_fetch(dev, &stat); |
707 | 709 | ||
708 | if (!irq) { | 710 | if (!irq) { |
709 | mt76x02_send_tx_status(&dev->mt76, &stat, &update); | 711 | mt76x02_send_tx_status(dev, &stat, &update); |
710 | continue; | 712 | continue; |
711 | } | 713 | } |
712 | 714 | ||
diff --git a/drivers/net/wireless/mediatek/mt76/mt76x02_mac.h b/drivers/net/wireless/mediatek/mt76/mt76x02_mac.h index 4f7ee4620ab5..d99c18743969 100644 --- a/drivers/net/wireless/mediatek/mt76/mt76x02_mac.h +++ b/drivers/net/wireless/mediatek/mt76/mt76x02_mac.h | |||
@@ -198,28 +198,29 @@ mt76x02_skb_tx_info(struct sk_buff *skb) | |||
198 | return (void *)info->status.status_driver_data; | 198 | return (void *)info->status.status_driver_data; |
199 | } | 199 | } |
200 | 200 | ||
201 | void mt76x02_txq_init(struct mt76_dev *dev, struct ieee80211_txq *txq); | 201 | void mt76x02_txq_init(struct mt76x02_dev *dev, struct ieee80211_txq *txq); |
202 | enum mt76x02_cipher_type | 202 | enum mt76x02_cipher_type |
203 | mt76x02_mac_get_key_info(struct ieee80211_key_conf *key, u8 *key_data); | 203 | mt76x02_mac_get_key_info(struct ieee80211_key_conf *key, u8 *key_data); |
204 | 204 | ||
205 | int mt76x02_mac_shared_key_setup(struct mt76_dev *dev, u8 vif_idx, u8 key_idx, | 205 | int mt76x02_mac_shared_key_setup(struct mt76x02_dev *dev, u8 vif_idx, |
206 | struct ieee80211_key_conf *key); | 206 | u8 key_idx, struct ieee80211_key_conf *key); |
207 | int mt76x02_mac_wcid_set_key(struct mt76_dev *dev, u8 idx, | 207 | int mt76x02_mac_wcid_set_key(struct mt76x02_dev *dev, u8 idx, |
208 | struct ieee80211_key_conf *key); | 208 | struct ieee80211_key_conf *key); |
209 | void mt76x02_mac_wcid_setup(struct mt76_dev *dev, u8 idx, u8 vif_idx, u8 *mac); | 209 | void mt76x02_mac_wcid_setup(struct mt76x02_dev *dev, u8 idx, u8 vif_idx, |
210 | void mt76x02_mac_wcid_set_drop(struct mt76_dev *dev, u8 idx, bool drop); | 210 | u8 *mac); |
211 | void mt76x02_mac_wcid_set_rate(struct mt76_dev *dev, struct mt76_wcid *wcid, | 211 | void mt76x02_mac_wcid_set_drop(struct mt76x02_dev *dev, u8 idx, bool drop); |
212 | const struct ieee80211_tx_rate *rate); | 212 | void mt76x02_mac_wcid_set_rate(struct mt76x02_dev *dev, struct mt76_wcid *wcid, |
213 | bool mt76x02_mac_load_tx_status(struct mt76_dev *dev, | 213 | const struct ieee80211_tx_rate *rate); |
214 | struct mt76x02_tx_status *stat); | 214 | bool mt76x02_mac_load_tx_status(struct mt76x02_dev *dev, |
215 | void mt76x02_send_tx_status(struct mt76_dev *dev, | 215 | struct mt76x02_tx_status *stat); |
216 | struct mt76x02_tx_status *stat, u8 *update); | 216 | void mt76x02_send_tx_status(struct mt76x02_dev *dev, |
217 | struct mt76x02_tx_status *stat, u8 *update); | ||
217 | int mt76x02_mac_process_rx(struct mt76x02_dev *dev, struct sk_buff *skb, | 218 | int mt76x02_mac_process_rx(struct mt76x02_dev *dev, struct sk_buff *skb, |
218 | void *rxi); | 219 | void *rxi); |
219 | int | 220 | int |
220 | mt76x02_mac_process_rate(struct mt76_rx_status *status, u16 rate); | 221 | mt76x02_mac_process_rate(struct mt76_rx_status *status, u16 rate); |
221 | void mt76x02_mac_setaddr(struct mt76_dev *dev, u8 *addr); | 222 | void mt76x02_mac_setaddr(struct mt76x02_dev *dev, u8 *addr); |
222 | void mt76x02_mac_write_txwi(struct mt76_dev *dev, struct mt76x02_txwi *txwi, | 223 | void mt76x02_mac_write_txwi(struct mt76x02_dev *dev, struct mt76x02_txwi *txwi, |
223 | struct sk_buff *skb, struct mt76_wcid *wcid, | 224 | struct sk_buff *skb, struct mt76_wcid *wcid, |
224 | struct ieee80211_sta *sta, int len); | 225 | struct ieee80211_sta *sta, int len); |
225 | void mt76x02_mac_poll_tx_status(struct mt76x02_dev *dev, bool irq); | 226 | void mt76x02_mac_poll_tx_status(struct mt76x02_dev *dev, bool irq); |
diff --git a/drivers/net/wireless/mediatek/mt76/mt76x02_mmio.c b/drivers/net/wireless/mediatek/mt76/mt76x02_mmio.c index 1b945079c802..39f092034240 100644 --- a/drivers/net/wireless/mediatek/mt76/mt76x02_mmio.c +++ b/drivers/net/wireless/mediatek/mt76/mt76x02_mmio.c | |||
@@ -65,7 +65,7 @@ static void mt76x02_process_tx_status_fifo(struct mt76x02_dev *dev) | |||
65 | u8 update = 1; | 65 | u8 update = 1; |
66 | 66 | ||
67 | while (kfifo_get(&dev->txstatus_fifo, &stat)) | 67 | while (kfifo_get(&dev->txstatus_fifo, &stat)) |
68 | mt76x02_send_tx_status(&dev->mt76, &stat, &update); | 68 | mt76x02_send_tx_status(dev, &stat, &update); |
69 | } | 69 | } |
70 | 70 | ||
71 | static void mt76x02_tx_tasklet(unsigned long data) | 71 | static void mt76x02_tx_tasklet(unsigned long data) |
diff --git a/drivers/net/wireless/mediatek/mt76/mt76x02_txrx.c b/drivers/net/wireless/mediatek/mt76/mt76x02_txrx.c index 830377221739..865fa1b84086 100644 --- a/drivers/net/wireless/mediatek/mt76/mt76x02_txrx.c +++ b/drivers/net/wireless/mediatek/mt76/mt76x02_txrx.c | |||
@@ -157,8 +157,9 @@ void mt76x02_tx_complete(struct mt76_dev *dev, struct sk_buff *skb) | |||
157 | } | 157 | } |
158 | EXPORT_SYMBOL_GPL(mt76x02_tx_complete); | 158 | EXPORT_SYMBOL_GPL(mt76x02_tx_complete); |
159 | 159 | ||
160 | bool mt76x02_tx_status_data(struct mt76_dev *dev, u8 *update) | 160 | bool mt76x02_tx_status_data(struct mt76_dev *mdev, u8 *update) |
161 | { | 161 | { |
162 | struct mt76x02_dev *dev = container_of(mdev, struct mt76x02_dev, mt76); | ||
162 | struct mt76x02_tx_status stat; | 163 | struct mt76x02_tx_status stat; |
163 | 164 | ||
164 | if (!mt76x02_mac_load_tx_status(dev, &stat)) | 165 | if (!mt76x02_mac_load_tx_status(dev, &stat)) |
@@ -181,9 +182,9 @@ int mt76x02_tx_prepare_skb(struct mt76_dev *mdev, void *txwi, | |||
181 | int ret; | 182 | int ret; |
182 | 183 | ||
183 | if (q == &dev->mt76.q_tx[MT_TXQ_PSD] && wcid && wcid->idx < 128) | 184 | if (q == &dev->mt76.q_tx[MT_TXQ_PSD] && wcid && wcid->idx < 128) |
184 | mt76x02_mac_wcid_set_drop(&dev->mt76, wcid->idx, false); | 185 | mt76x02_mac_wcid_set_drop(dev, wcid->idx, false); |
185 | 186 | ||
186 | mt76x02_mac_write_txwi(mdev, txwi, skb, wcid, sta, skb->len); | 187 | mt76x02_mac_write_txwi(dev, txwi, skb, wcid, sta, skb->len); |
187 | 188 | ||
188 | ret = mt76x02_insert_hdr_pad(skb); | 189 | ret = mt76x02_insert_hdr_pad(skb); |
189 | if (ret < 0) | 190 | if (ret < 0) |
diff --git a/drivers/net/wireless/mediatek/mt76/mt76x02_usb.h b/drivers/net/wireless/mediatek/mt76/mt76x02_usb.h index 28aabcfd1195..0126e51d77ed 100644 --- a/drivers/net/wireless/mediatek/mt76/mt76x02_usb.h +++ b/drivers/net/wireless/mediatek/mt76/mt76x02_usb.h | |||
@@ -25,7 +25,7 @@ int mt76x02u_mcu_fw_send_data(struct mt76x02_dev *dev, const void *data, | |||
25 | int data_len, u32 max_payload, u32 offset); | 25 | int data_len, u32 max_payload, u32 offset); |
26 | 26 | ||
27 | int mt76x02u_skb_dma_info(struct sk_buff *skb, int port, u32 flags); | 27 | int mt76x02u_skb_dma_info(struct sk_buff *skb, int port, u32 flags); |
28 | int mt76x02u_tx_prepare_skb(struct mt76_dev *dev, void *data, | 28 | int mt76x02u_tx_prepare_skb(struct mt76_dev *mdev, void *data, |
29 | struct sk_buff *skb, struct mt76_queue *q, | 29 | struct sk_buff *skb, struct mt76_queue *q, |
30 | struct mt76_wcid *wcid, struct ieee80211_sta *sta, | 30 | struct mt76_wcid *wcid, struct ieee80211_sta *sta, |
31 | u32 *tx_info); | 31 | u32 *tx_info); |
diff --git a/drivers/net/wireless/mediatek/mt76/mt76x02_usb_core.c b/drivers/net/wireless/mediatek/mt76/mt76x02_usb_core.c index 7c6c973af386..e43c53e8e6be 100644 --- a/drivers/net/wireless/mediatek/mt76/mt76x02_usb_core.c +++ b/drivers/net/wireless/mediatek/mt76/mt76x02_usb_core.c | |||
@@ -99,11 +99,12 @@ mt76x02u_set_txinfo(struct sk_buff *skb, struct mt76_wcid *wcid, u8 ep) | |||
99 | return mt76x02u_skb_dma_info(skb, WLAN_PORT, flags); | 99 | return mt76x02u_skb_dma_info(skb, WLAN_PORT, flags); |
100 | } | 100 | } |
101 | 101 | ||
102 | int mt76x02u_tx_prepare_skb(struct mt76_dev *dev, void *data, | 102 | int mt76x02u_tx_prepare_skb(struct mt76_dev *mdev, void *data, |
103 | struct sk_buff *skb, struct mt76_queue *q, | 103 | struct sk_buff *skb, struct mt76_queue *q, |
104 | struct mt76_wcid *wcid, struct ieee80211_sta *sta, | 104 | struct mt76_wcid *wcid, struct ieee80211_sta *sta, |
105 | u32 *tx_info) | 105 | u32 *tx_info) |
106 | { | 106 | { |
107 | struct mt76x02_dev *dev = container_of(mdev, struct mt76x02_dev, mt76); | ||
107 | struct mt76x02_txwi *txwi; | 108 | struct mt76x02_txwi *txwi; |
108 | int err, len = skb->len; | 109 | int err, len = skb->len; |
109 | 110 | ||
diff --git a/drivers/net/wireless/mediatek/mt76/mt76x02_util.c b/drivers/net/wireless/mediatek/mt76/mt76x02_util.c index 8263b785df5c..3351e0c7a9f7 100644 --- a/drivers/net/wireless/mediatek/mt76/mt76x02_util.c +++ b/drivers/net/wireless/mediatek/mt76/mt76x02_util.c | |||
@@ -103,10 +103,10 @@ int mt76x02_sta_add(struct ieee80211_hw *hw, struct ieee80211_vif *vif, | |||
103 | msta->wcid.sta = 1; | 103 | msta->wcid.sta = 1; |
104 | msta->wcid.idx = idx; | 104 | msta->wcid.idx = idx; |
105 | msta->wcid.hw_key_idx = -1; | 105 | msta->wcid.hw_key_idx = -1; |
106 | mt76x02_mac_wcid_setup(&dev->mt76, idx, mvif->idx, sta->addr); | 106 | mt76x02_mac_wcid_setup(dev, idx, mvif->idx, sta->addr); |
107 | mt76x02_mac_wcid_set_drop(&dev->mt76, idx, false); | 107 | mt76x02_mac_wcid_set_drop(dev, idx, false); |
108 | for (i = 0; i < ARRAY_SIZE(sta->txq); i++) | 108 | for (i = 0; i < ARRAY_SIZE(sta->txq); i++) |
109 | mt76x02_txq_init(&dev->mt76, sta->txq[i]); | 109 | mt76x02_txq_init(dev, sta->txq[i]); |
110 | 110 | ||
111 | if (vif->type == NL80211_IFTYPE_AP) | 111 | if (vif->type == NL80211_IFTYPE_AP) |
112 | set_bit(MT_WCID_FLAG_CHECK_PS, &msta->wcid.flags); | 112 | set_bit(MT_WCID_FLAG_CHECK_PS, &msta->wcid.flags); |
@@ -134,9 +134,9 @@ int mt76x02_sta_remove(struct ieee80211_hw *hw, struct ieee80211_vif *vif, | |||
134 | rcu_assign_pointer(dev->mt76.wcid[idx], NULL); | 134 | rcu_assign_pointer(dev->mt76.wcid[idx], NULL); |
135 | for (i = 0; i < ARRAY_SIZE(sta->txq); i++) | 135 | for (i = 0; i < ARRAY_SIZE(sta->txq); i++) |
136 | mt76_txq_remove(&dev->mt76, sta->txq[i]); | 136 | mt76_txq_remove(&dev->mt76, sta->txq[i]); |
137 | mt76x02_mac_wcid_set_drop(&dev->mt76, idx, true); | 137 | mt76x02_mac_wcid_set_drop(dev, idx, true); |
138 | mt76_wcid_free(dev->mt76.wcid_mask, idx); | 138 | mt76_wcid_free(dev->mt76.wcid_mask, idx); |
139 | mt76x02_mac_wcid_setup(&dev->mt76, idx, 0, NULL); | 139 | mt76x02_mac_wcid_setup(dev, idx, 0, NULL); |
140 | mutex_unlock(&dev->mt76.mutex); | 140 | mutex_unlock(&dev->mt76.mutex); |
141 | 141 | ||
142 | return 0; | 142 | return 0; |
@@ -151,7 +151,7 @@ void mt76x02_vif_init(struct mt76x02_dev *dev, struct ieee80211_vif *vif, | |||
151 | mvif->idx = idx; | 151 | mvif->idx = idx; |
152 | mvif->group_wcid.idx = MT_VIF_WCID(idx); | 152 | mvif->group_wcid.idx = MT_VIF_WCID(idx); |
153 | mvif->group_wcid.hw_key_idx = -1; | 153 | mvif->group_wcid.hw_key_idx = -1; |
154 | mt76x02_txq_init(&dev->mt76, vif->txq); | 154 | mt76x02_txq_init(dev, vif->txq); |
155 | } | 155 | } |
156 | EXPORT_SYMBOL_GPL(mt76x02_vif_init); | 156 | EXPORT_SYMBOL_GPL(mt76x02_vif_init); |
157 | 157 | ||
@@ -301,17 +301,15 @@ int mt76x02_set_key(struct ieee80211_hw *hw, enum set_key_cmd cmd, | |||
301 | 301 | ||
302 | if (!msta) { | 302 | if (!msta) { |
303 | if (key || wcid->hw_key_idx == idx) { | 303 | if (key || wcid->hw_key_idx == idx) { |
304 | ret = mt76x02_mac_wcid_set_key(&dev->mt76, | 304 | ret = mt76x02_mac_wcid_set_key(dev, wcid->idx, key); |
305 | wcid->idx, key); | ||
306 | if (ret) | 305 | if (ret) |
307 | return ret; | 306 | return ret; |
308 | } | 307 | } |
309 | 308 | ||
310 | return mt76x02_mac_shared_key_setup(&dev->mt76, | 309 | return mt76x02_mac_shared_key_setup(dev, mvif->idx, idx, key); |
311 | mvif->idx, idx, key); | ||
312 | } | 310 | } |
313 | 311 | ||
314 | return mt76x02_mac_wcid_set_key(&dev->mt76, msta->wcid.idx, key); | 312 | return mt76x02_mac_wcid_set_key(dev, msta->wcid.idx, key); |
315 | } | 313 | } |
316 | EXPORT_SYMBOL_GPL(mt76x02_set_key); | 314 | EXPORT_SYMBOL_GPL(mt76x02_set_key); |
317 | 315 | ||
@@ -363,7 +361,7 @@ void mt76x02_sta_rate_tbl_update(struct ieee80211_hw *hw, | |||
363 | struct ieee80211_vif *vif, | 361 | struct ieee80211_vif *vif, |
364 | struct ieee80211_sta *sta) | 362 | struct ieee80211_sta *sta) |
365 | { | 363 | { |
366 | struct mt76_dev *dev = hw->priv; | 364 | struct mt76x02_dev *dev = hw->priv; |
367 | struct mt76x02_sta *msta = (struct mt76x02_sta *) sta->drv_priv; | 365 | struct mt76x02_sta *msta = (struct mt76x02_sta *) sta->drv_priv; |
368 | struct ieee80211_sta_rates *rates = rcu_dereference(sta->rates); | 366 | struct ieee80211_sta_rates *rates = rcu_dereference(sta->rates); |
369 | struct ieee80211_tx_rate rate = {}; | 367 | struct ieee80211_tx_rate rate = {}; |
@@ -374,7 +372,7 @@ void mt76x02_sta_rate_tbl_update(struct ieee80211_hw *hw, | |||
374 | rate.idx = rates->rate[0].idx; | 372 | rate.idx = rates->rate[0].idx; |
375 | rate.flags = rates->rate[0].flags; | 373 | rate.flags = rates->rate[0].flags; |
376 | mt76x02_mac_wcid_set_rate(dev, &msta->wcid, &rate); | 374 | mt76x02_mac_wcid_set_rate(dev, &msta->wcid, &rate); |
377 | msta->wcid.max_txpwr_adj = mt76x02_tx_get_max_txpwr_adj(dev, &rate); | 375 | msta->wcid.max_txpwr_adj = mt76x02_tx_get_max_txpwr_adj(&dev->mt76, &rate); |
378 | } | 376 | } |
379 | EXPORT_SYMBOL_GPL(mt76x02_sta_rate_tbl_update); | 377 | EXPORT_SYMBOL_GPL(mt76x02_sta_rate_tbl_update); |
380 | 378 | ||
diff --git a/drivers/net/wireless/mediatek/mt76/mt76x2/pci_init.c b/drivers/net/wireless/mediatek/mt76/mt76x2/pci_init.c index d98d1286f7c1..4e920c71cee9 100644 --- a/drivers/net/wireless/mediatek/mt76/mt76x2/pci_init.c +++ b/drivers/net/wireless/mediatek/mt76/mt76x2/pci_init.c | |||
@@ -143,14 +143,14 @@ static int mt76x2_mac_reset(struct mt76x02_dev *dev, bool hard) | |||
143 | mt76_wr(dev, MT_WCID_DROP_BASE + i * 4, 0); | 143 | mt76_wr(dev, MT_WCID_DROP_BASE + i * 4, 0); |
144 | 144 | ||
145 | for (i = 0; i < 256; i++) | 145 | for (i = 0; i < 256; i++) |
146 | mt76x02_mac_wcid_setup(&dev->mt76, i, 0, NULL); | 146 | mt76x02_mac_wcid_setup(dev, i, 0, NULL); |
147 | 147 | ||
148 | for (i = 0; i < MT_MAX_VIFS; i++) | 148 | for (i = 0; i < MT_MAX_VIFS; i++) |
149 | mt76x02_mac_wcid_setup(&dev->mt76, MT_VIF_WCID(i), i, NULL); | 149 | mt76x02_mac_wcid_setup(dev, MT_VIF_WCID(i), i, NULL); |
150 | 150 | ||
151 | for (i = 0; i < 16; i++) | 151 | for (i = 0; i < 16; i++) |
152 | for (k = 0; k < 4; k++) | 152 | for (k = 0; k < 4; k++) |
153 | mt76x02_mac_shared_key_setup(&dev->mt76, i, k, NULL); | 153 | mt76x02_mac_shared_key_setup(dev, i, k, NULL); |
154 | 154 | ||
155 | for (i = 0; i < 8; i++) { | 155 | for (i = 0; i < 8; i++) { |
156 | mt76x2_mac_set_bssid(dev, i, null_addr); | 156 | mt76x2_mac_set_bssid(dev, i, null_addr); |
diff --git a/drivers/net/wireless/mediatek/mt76/mt76x2/pci_mac.c b/drivers/net/wireless/mediatek/mt76/mt76x2/pci_mac.c index 08366c5988ea..4b331ed14bb2 100644 --- a/drivers/net/wireless/mediatek/mt76/mt76x2/pci_mac.c +++ b/drivers/net/wireless/mediatek/mt76/mt76x2/pci_mac.c | |||
@@ -36,7 +36,7 @@ mt76_write_beacon(struct mt76x02_dev *dev, int offset, struct sk_buff *skb) | |||
36 | if (WARN_ON_ONCE(beacon_len < skb->len + sizeof(struct mt76x02_txwi))) | 36 | if (WARN_ON_ONCE(beacon_len < skb->len + sizeof(struct mt76x02_txwi))) |
37 | return -ENOSPC; | 37 | return -ENOSPC; |
38 | 38 | ||
39 | mt76x02_mac_write_txwi(&dev->mt76, &txwi, skb, NULL, NULL, skb->len); | 39 | mt76x02_mac_write_txwi(dev, &txwi, skb, NULL, NULL, skb->len); |
40 | 40 | ||
41 | mt76_wr_copy(dev, offset, &txwi, sizeof(txwi)); | 41 | mt76_wr_copy(dev, offset, &txwi, sizeof(txwi)); |
42 | offset += sizeof(txwi); | 42 | offset += sizeof(txwi); |
diff --git a/drivers/net/wireless/mediatek/mt76/mt76x2/pci_main.c b/drivers/net/wireless/mediatek/mt76/mt76x2/pci_main.c index 65fef082e7cc..034a06295668 100644 --- a/drivers/net/wireless/mediatek/mt76/mt76x2/pci_main.c +++ b/drivers/net/wireless/mediatek/mt76/mt76x2/pci_main.c | |||
@@ -172,7 +172,7 @@ mt76x2_sta_ps(struct mt76_dev *mdev, struct ieee80211_sta *sta, bool ps) | |||
172 | int idx = msta->wcid.idx; | 172 | int idx = msta->wcid.idx; |
173 | 173 | ||
174 | mt76_stop_tx_queues(&dev->mt76, sta, true); | 174 | mt76_stop_tx_queues(&dev->mt76, sta, true); |
175 | mt76x02_mac_wcid_set_drop(&dev->mt76, idx, ps); | 175 | mt76x02_mac_wcid_set_drop(dev, idx, ps); |
176 | } | 176 | } |
177 | 177 | ||
178 | static void | 178 | static void |
diff --git a/drivers/net/wireless/mediatek/mt76/mt76x2/usb_init.c b/drivers/net/wireless/mediatek/mt76/mt76x2/usb_init.c index 6214781714c4..51d3eabfa01b 100644 --- a/drivers/net/wireless/mediatek/mt76/mt76x2/usb_init.c +++ b/drivers/net/wireless/mediatek/mt76/mt76x2/usb_init.c | |||
@@ -204,8 +204,7 @@ int mt76x2u_init_hardware(struct mt76x02_dev *dev) | |||
204 | if (err < 0) | 204 | if (err < 0) |
205 | return err; | 205 | return err; |
206 | 206 | ||
207 | mt76x02_mac_setaddr(&dev->mt76, | 207 | mt76x02_mac_setaddr(dev, dev->mt76.eeprom.data + MT_EE_MAC_ADDR); |
208 | dev->mt76.eeprom.data + MT_EE_MAC_ADDR); | ||
209 | dev->mt76.rxfilter = mt76_rr(dev, MT_RX_FILTR_CFG); | 208 | dev->mt76.rxfilter = mt76_rr(dev, MT_RX_FILTR_CFG); |
210 | 209 | ||
211 | mt76x2u_init_beacon_offsets(dev); | 210 | mt76x2u_init_beacon_offsets(dev); |
diff --git a/drivers/net/wireless/mediatek/mt76/mt76x2/usb_main.c b/drivers/net/wireless/mediatek/mt76/mt76x2/usb_main.c index 87941ed3fb7c..1971a1b00038 100644 --- a/drivers/net/wireless/mediatek/mt76/mt76x2/usb_main.c +++ b/drivers/net/wireless/mediatek/mt76/mt76x2/usb_main.c | |||
@@ -50,7 +50,7 @@ static int mt76x2u_add_interface(struct ieee80211_hw *hw, | |||
50 | struct mt76x02_dev *dev = hw->priv; | 50 | struct mt76x02_dev *dev = hw->priv; |
51 | 51 | ||
52 | if (!ether_addr_equal(dev->mt76.macaddr, vif->addr)) | 52 | if (!ether_addr_equal(dev->mt76.macaddr, vif->addr)) |
53 | mt76x02_mac_setaddr(&dev->mt76, vif->addr); | 53 | mt76x02_mac_setaddr(dev, vif->addr); |
54 | 54 | ||
55 | mt76x02_vif_init(dev, vif, 0); | 55 | mt76x02_vif_init(dev, vif, 0); |
56 | return 0; | 56 | return 0; |