92a8f2f70fd9c1d38ae028d74b65bfcaa3c3c648
[openwrt/staging/hauke.git] / package / kernel / mwlwifi / patches / 005-mac80211_update.patch
1 --- a/core.c
2 +++ b/core.c
3 @@ -718,7 +718,7 @@ static void mwl_chnl_switch_event(struct
4 vif = container_of((void *)mwl_vif, struct ieee80211_vif,
5 drv_priv);
6
7 - if (vif->csa_active)
8 + if (vif->bss_conf.csa_active)
9 ieee80211_csa_finish(vif);
10 }
11 spin_unlock_bh(&priv->vif_lock);
12 --- a/debugfs.c
13 +++ b/debugfs.c
14 @@ -498,9 +498,9 @@ static ssize_t mwl_debugfs_vif_read(stru
15 switch (vif->type) {
16 case NL80211_IFTYPE_AP:
17 len += scnprintf(p + len, size - len, "type: ap\n");
18 - memcpy(ssid, vif->bss_conf.ssid,
19 - vif->bss_conf.ssid_len);
20 - ssid[vif->bss_conf.ssid_len] = 0;
21 + memcpy(ssid, vif->cfg.ssid,
22 + vif->cfg.ssid_len);
23 + ssid[vif->cfg.ssid_len] = 0;
24 len += scnprintf(p + len, size - len,
25 "ssid: %s\n", ssid);
26 len += scnprintf(p + len, size - len,
27 @@ -522,8 +522,8 @@ static ssize_t mwl_debugfs_vif_read(stru
28 "type: unknown\n");
29 break;
30 }
31 - if (vif->chanctx_conf) {
32 - chan_def = &vif->chanctx_conf->def;
33 + if (vif->bss_conf.chanctx_conf) {
34 + chan_def = &vif->bss_conf.chanctx_conf->def;
35 len += scnprintf(p + len, size - len,
36 "channel: %d: width: %d\n",
37 chan_def->chan->hw_value,
38 @@ -596,18 +596,18 @@ static ssize_t mwl_debugfs_sta_read(stru
39 sta_info->wds ? "true" : "false",
40 sta_info->ba_hist.enable ? "enable" : "disable",
41 sta_info->is_amsdu_allowed ? sta_info->amsdu_ctrl.cap : 0 ,
42 - sta->ht_cap.ht_supported ? sta->ht_cap.cap : 0,
43 - sta->ht_cap.ht_supported ? sta->ht_cap.ampdu_factor : 0,
44 - sta->ht_cap.ht_supported ? sta->ht_cap.ampdu_density : 0,
45 - sta->ht_cap.ht_supported ? sta->ht_cap.mcs.rx_mask[0] : 0,
46 - sta->ht_cap.ht_supported ? sta->ht_cap.mcs.rx_mask[1] : 0,
47 - sta->ht_cap.ht_supported ? sta->ht_cap.mcs.rx_mask[2] : 0,
48 - sta->ht_cap.ht_supported ? sta->ht_cap.mcs.rx_mask[3] : 0,
49 - sta->vht_cap.vht_supported ? sta->vht_cap.cap : 0,
50 - sta->vht_cap.vht_supported ? sta->vht_cap.vht_mcs.rx_mcs_map : 0,
51 - sta->vht_cap.vht_supported ? sta->vht_cap.vht_mcs.tx_mcs_map : 0,
52 - sta->bandwidth,
53 - sta->rx_nss,
54 + sta->deflink.ht_cap.ht_supported ? sta->deflink.ht_cap.cap : 0,
55 + sta->deflink.ht_cap.ht_supported ? sta->deflink.ht_cap.ampdu_factor : 0,
56 + sta->deflink.ht_cap.ht_supported ? sta->deflink.ht_cap.ampdu_density : 0,
57 + sta->deflink.ht_cap.ht_supported ? sta->deflink.ht_cap.mcs.rx_mask[0] : 0,
58 + sta->deflink.ht_cap.ht_supported ? sta->deflink.ht_cap.mcs.rx_mask[1] : 0,
59 + sta->deflink.ht_cap.ht_supported ? sta->deflink.ht_cap.mcs.rx_mask[2] : 0,
60 + sta->deflink.ht_cap.ht_supported ? sta->deflink.ht_cap.mcs.rx_mask[3] : 0,
61 + sta->deflink.vht_cap.vht_supported ? sta->deflink.vht_cap.cap : 0,
62 + sta->deflink.vht_cap.vht_supported ? sta->deflink.vht_cap.vht_mcs.rx_mcs_map : 0,
63 + sta->deflink.vht_cap.vht_supported ? sta->deflink.vht_cap.vht_mcs.tx_mcs_map : 0,
64 + sta->deflink.bandwidth,
65 + sta->deflink.rx_nss,
66 sta->tdls,
67 sta->tdls_initiator,
68 sta->wme,
69 --- a/hif/fwcmd.c
70 +++ b/hif/fwcmd.c
71 @@ -633,11 +633,15 @@ einval:
72 }
73
74 static int mwl_fwcmd_set_ap_beacon(struct mwl_priv *priv,
75 - struct mwl_vif *mwl_vif,
76 - struct ieee80211_bss_conf *bss_conf)
77 + struct ieee80211_vif *vif)
78 {
79 struct hostcmd_cmd_ap_beacon *pcmd;
80 struct ds_params *phy_ds_param_set;
81 + struct mwl_vif *mwl_vif;
82 + struct ieee80211_bss_conf *bss_conf;
83 +
84 + mwl_vif = mwl_dev_get_vif(vif);
85 + bss_conf = &vif->bss_conf;
86
87 /* wmm structure of start command is defined less one byte,
88 * due to following field country is not used, add byte one
89 @@ -664,7 +668,7 @@ static int mwl_fwcmd_set_ap_beacon(struc
90 pcmd->cmd_hdr.macid = mwl_vif->macid;
91
92 ether_addr_copy(pcmd->start_cmd.sta_mac_addr, mwl_vif->bssid);
93 - memcpy(pcmd->start_cmd.ssid, bss_conf->ssid, bss_conf->ssid_len);
94 + memcpy(pcmd->start_cmd.ssid, vif->cfg.ssid, vif->cfg.ssid_len);
95 if (priv->chip_type == MWL8997)
96 ether_addr_copy(pcmd->start_cmd.bssid, mwl_vif->bssid);
97 pcmd->start_cmd.bss_type = 1;
98 @@ -2090,7 +2094,7 @@ int mwl_fwcmd_set_beacon(struct ieee8021
99 if (mwl_fwcmd_set_wsc_ie(hw, b_inf->ie_wsc_len, b_inf->ie_wsc_ptr))
100 goto err;
101
102 - if (mwl_fwcmd_set_ap_beacon(priv, mwl_vif, &vif->bss_conf))
103 + if (mwl_fwcmd_set_ap_beacon(priv, vif))
104 goto err;
105
106 if (b_inf->cap_info & WLAN_CAPABILITY_SPECTRUM_MGMT)
107 @@ -2152,38 +2156,38 @@ int mwl_fwcmd_set_new_stn_add(struct iee
108 ether_addr_copy(pcmd->mac_addr, sta->addr);
109
110 if (hw->conf.chandef.chan->band == NL80211_BAND_2GHZ)
111 - rates = sta->supp_rates[NL80211_BAND_2GHZ];
112 + rates = sta->deflink.supp_rates[NL80211_BAND_2GHZ];
113 else
114 - rates = sta->supp_rates[NL80211_BAND_5GHZ] << 5;
115 + rates = sta->deflink.supp_rates[NL80211_BAND_5GHZ] << 5;
116 pcmd->peer_info.legacy_rate_bitmap = cpu_to_le32(rates);
117
118 - if (sta->ht_cap.ht_supported) {
119 + if (sta->deflink.ht_cap.ht_supported) {
120 int i;
121
122 for (i = 0; i < 4; i++) {
123 - if (i < sta->rx_nss) {
124 + if (i < sta->deflink.rx_nss) {
125 pcmd->peer_info.ht_rates[i] =
126 - sta->ht_cap.mcs.rx_mask[i];
127 + sta->deflink.ht_cap.mcs.rx_mask[i];
128 } else {
129 pcmd->peer_info.ht_rates[i] = 0;
130 }
131 }
132 - pcmd->peer_info.ht_cap_info = cpu_to_le16(sta->ht_cap.cap);
133 + pcmd->peer_info.ht_cap_info = cpu_to_le16(sta->deflink.ht_cap.cap);
134 pcmd->peer_info.mac_ht_param_info =
135 - (sta->ht_cap.ampdu_factor & 3) |
136 - ((sta->ht_cap.ampdu_density & 7) << 2);
137 + (sta->deflink.ht_cap.ampdu_factor & 3) |
138 + ((sta->deflink.ht_cap.ampdu_density & 7) << 2);
139 }
140
141 - if (sta->vht_cap.vht_supported) {
142 + if (sta->deflink.vht_cap.vht_supported) {
143 u32 rx_mcs_map_mask = 0;
144
145 - rx_mcs_map_mask = ((0x0000FFFF) >> (sta->rx_nss * 2))
146 - << (sta->rx_nss * 2);
147 + rx_mcs_map_mask = ((0x0000FFFF) >> (sta->deflink.rx_nss * 2))
148 + << (sta->deflink.rx_nss * 2);
149 pcmd->peer_info.vht_max_rx_mcs =
150 cpu_to_le32((*((u32 *)
151 - &sta->vht_cap.vht_mcs.rx_mcs_map)) | rx_mcs_map_mask);
152 - pcmd->peer_info.vht_cap = cpu_to_le32(sta->vht_cap.cap);
153 - pcmd->peer_info.vht_rx_channel_width = sta->bandwidth;
154 + &sta->deflink.vht_cap.vht_mcs.rx_mcs_map)) | rx_mcs_map_mask);
155 + pcmd->peer_info.vht_cap = cpu_to_le32(sta->deflink.vht_cap.cap);
156 + pcmd->peer_info.vht_rx_channel_width = sta->deflink.bandwidth;
157 }
158
159 pcmd->is_qos_sta = sta->wme;
160 @@ -2239,38 +2243,38 @@ int mwl_fwcmd_set_new_stn_add_sc4(struct
161 ether_addr_copy(pcmd->mac_addr, sta->addr);
162
163 if (hw->conf.chandef.chan->band == NL80211_BAND_2GHZ)
164 - rates = sta->supp_rates[NL80211_BAND_2GHZ];
165 + rates = sta->deflink.supp_rates[NL80211_BAND_2GHZ];
166 else
167 - rates = sta->supp_rates[NL80211_BAND_5GHZ] << 5;
168 + rates = sta->deflink.supp_rates[NL80211_BAND_5GHZ] << 5;
169 pcmd->peer_info.legacy_rate_bitmap = cpu_to_le32(rates);
170
171 - if (sta->ht_cap.ht_supported) {
172 + if (sta->deflink.ht_cap.ht_supported) {
173 int i;
174
175 for (i = 0; i < 4; i++) {
176 - if (i < sta->rx_nss) {
177 + if (i < sta->deflink.rx_nss) {
178 pcmd->peer_info.ht_rates[i] =
179 - sta->ht_cap.mcs.rx_mask[i];
180 + sta->deflink.ht_cap.mcs.rx_mask[i];
181 } else {
182 pcmd->peer_info.ht_rates[i] = 0;
183 }
184 }
185 - pcmd->peer_info.ht_cap_info = cpu_to_le16(sta->ht_cap.cap);
186 + pcmd->peer_info.ht_cap_info = cpu_to_le16(sta->deflink.ht_cap.cap);
187 pcmd->peer_info.mac_ht_param_info =
188 - (sta->ht_cap.ampdu_factor & 3) |
189 - ((sta->ht_cap.ampdu_density & 7) << 2);
190 + (sta->deflink.ht_cap.ampdu_factor & 3) |
191 + ((sta->deflink.ht_cap.ampdu_density & 7) << 2);
192 }
193
194 - if (sta->vht_cap.vht_supported) {
195 + if (sta->deflink.vht_cap.vht_supported) {
196 u32 rx_mcs_map_mask = 0;
197
198 - rx_mcs_map_mask = ((0x0000FFFF) >> (sta->rx_nss * 2))
199 - << (sta->rx_nss * 2);
200 + rx_mcs_map_mask = ((0x0000FFFF) >> (sta->deflink.rx_nss * 2))
201 + << (sta->deflink.rx_nss * 2);
202 pcmd->peer_info.vht_max_rx_mcs =
203 cpu_to_le32((*((u32 *)
204 - &sta->vht_cap.vht_mcs.rx_mcs_map)) | rx_mcs_map_mask);
205 - pcmd->peer_info.vht_cap = cpu_to_le32(sta->vht_cap.cap);
206 - pcmd->peer_info.vht_rx_channel_width = sta->bandwidth;
207 + &sta->deflink.vht_cap.vht_mcs.rx_mcs_map)) | rx_mcs_map_mask);
208 + pcmd->peer_info.vht_cap = cpu_to_le32(sta->deflink.vht_cap.cap);
209 + pcmd->peer_info.vht_rx_channel_width = sta->deflink.bandwidth;
210 }
211
212 pcmd->is_qos_sta = sta->wme;
213 @@ -2787,9 +2791,9 @@ int mwl_fwcmd_create_ba(struct ieee80211
214 pcmd->ba_info.create_params.flags = cpu_to_le32(ba_flags);
215 pcmd->ba_info.create_params.queue_id = stream->idx;
216 pcmd->ba_info.create_params.param_info =
217 - (stream->sta->ht_cap.ampdu_factor &
218 + (stream->sta->deflink.ht_cap.ampdu_factor &
219 IEEE80211_HT_AMPDU_PARM_FACTOR) |
220 - ((stream->sta->ht_cap.ampdu_density << 2) &
221 + ((stream->sta->deflink.ht_cap.ampdu_density << 2) &
222 IEEE80211_HT_AMPDU_PARM_DENSITY);
223 if (direction == BA_FLAG_DIRECTION_UP) {
224 pcmd->ba_info.create_params.reset_seq_no = 0;
225 @@ -2799,9 +2803,9 @@ int mwl_fwcmd_create_ba(struct ieee80211
226 pcmd->ba_info.create_params.current_seq = cpu_to_le16(0);
227 }
228 if (priv->chip_type == MWL8964 &&
229 - stream->sta->vht_cap.vht_supported) {
230 + stream->sta->deflink.vht_cap.vht_supported) {
231 pcmd->ba_info.create_params.vht_rx_factor =
232 - cpu_to_le32((stream->sta->vht_cap.cap &
233 + cpu_to_le32((stream->sta->deflink.vht_cap.cap &
234 IEEE80211_VHT_CAP_MAX_A_MPDU_LENGTH_EXPONENT_MASK) >>
235 IEEE80211_VHT_CAP_MAX_A_MPDU_LENGTH_EXPONENT_SHIFT);
236 }
237 --- a/hif/pcie/8864/tx.c
238 +++ b/hif/pcie/8864/tx.c
239 @@ -743,7 +743,7 @@ void pcie_8864_tx_xmit(struct ieee80211_
240 index = SYSADPT_TX_WMM_QUEUES - index - 1;
241 txpriority = index;
242
243 - if (sta && sta->ht_cap.ht_supported &&
244 + if (sta && sta->deflink.ht_cap.ht_supported &&
245 !(xmitcontrol & EAGLE_TXD_XMITCTRL_USE_MC_RATE) &&
246 ieee80211_is_data_qos(wh->frame_control)) {
247 tid = qos & 0xf;
248 --- a/hif/pcie/8964/tx_ndp.c
249 +++ b/hif/pcie/8964/tx_ndp.c
250 @@ -607,7 +607,7 @@ void pcie_tx_xmit_ndp(struct ieee80211_h
251 pcie_tx_encapsulate_frame(priv, skb, k_conf);
252 } else {
253 tid = qos & 0x7;
254 - if (sta && sta->ht_cap.ht_supported && !eapol_frame &&
255 + if (sta && sta->deflink.ht_cap.ht_supported && !eapol_frame &&
256 qos != 0xFFFF) {
257 pcie_tx_count_packet(sta, tid);
258 spin_lock_bh(&priv->stream_lock);
259 --- a/hif/pcie/8997/tx.c
260 +++ b/hif/pcie/8997/tx.c
261 @@ -81,7 +81,7 @@ static int pcie_txbd_ring_create(struct
262 wiphy_info(priv->hw->wiphy,
263 "TX ring: - base: %p, pbase: 0x%x, len: %d\n",
264 pcie_priv->txbd_ring_vbase,
265 - pcie_priv->txbd_ring_pbase,
266 + (u32)pcie_priv->txbd_ring_pbase,
267 pcie_priv->txbd_ring_size);
268
269 for (num = 0; num < PCIE_MAX_TXRX_BD; num++) {
270 @@ -694,7 +694,7 @@ void pcie_8997_tx_xmit(struct ieee80211_
271 index = SYSADPT_TX_WMM_QUEUES - index - 1;
272 txpriority = index;
273
274 - if (sta && sta->ht_cap.ht_supported &&
275 + if (sta && sta->deflink.ht_cap.ht_supported &&
276 !(xmitcontrol & EAGLE_TXD_XMITCTRL_USE_MC_RATE) &&
277 ieee80211_is_data_qos(wh->frame_control)) {
278 tid = qos & 0xf;
279 --- a/mac80211.c
280 +++ b/mac80211.c
281 @@ -368,15 +368,15 @@ static void mwl_mac80211_bss_info_change
282 }
283 }
284
285 - if ((changed & BSS_CHANGED_ASSOC) && vif->bss_conf.assoc)
286 + if ((changed & BSS_CHANGED_ASSOC) && vif->cfg.assoc)
287 mwl_fwcmd_set_aid(hw, vif, (u8 *)vif->bss_conf.bssid,
288 - vif->bss_conf.aid);
289 + vif->cfg.aid);
290 }
291
292 static void mwl_mac80211_bss_info_changed_ap(struct ieee80211_hw *hw,
293 struct ieee80211_vif *vif,
294 struct ieee80211_bss_conf *info,
295 - u32 changed)
296 + u64 changed)
297 {
298 struct mwl_priv *priv = hw->priv;
299 struct mwl_vif *mwl_vif;
300 @@ -426,8 +426,8 @@ static void mwl_mac80211_bss_info_change
301 if (changed & (BSS_CHANGED_BEACON_INT | BSS_CHANGED_BEACON)) {
302 struct sk_buff *skb;
303
304 - if ((info->ssid[0] != '\0') &&
305 - (info->ssid_len != 0) &&
306 + if ((vif->cfg.ssid[0] != '\0') &&
307 + (vif->cfg.ssid_len != 0) &&
308 (!info->hidden_ssid)) {
309 if (mwl_vif->broadcast_ssid != true) {
310 mwl_fwcmd_broadcast_ssid_enable(hw, vif, true);
311 @@ -441,7 +441,7 @@ static void mwl_mac80211_bss_info_change
312 }
313
314 if (!mwl_vif->set_beacon) {
315 - skb = ieee80211_beacon_get(hw, vif);
316 + skb = ieee80211_beacon_get(hw, vif, 0);
317
318 if (skb) {
319 mwl_fwcmd_set_beacon(hw, vif, skb->data, skb->len);
320 @@ -458,7 +458,7 @@ static void mwl_mac80211_bss_info_change
321 static void mwl_mac80211_bss_info_changed(struct ieee80211_hw *hw,
322 struct ieee80211_vif *vif,
323 struct ieee80211_bss_conf *info,
324 - u32 changed)
325 + u64 changed)
326 {
327 switch (vif->type) {
328 case NL80211_IFTYPE_AP:
329 @@ -583,10 +583,10 @@ static int mwl_mac80211_sta_add(struct i
330 if (vif->type == NL80211_IFTYPE_MESH_POINT)
331 sta_info->is_mesh_node = true;
332
333 - if (sta->ht_cap.ht_supported) {
334 + if (sta->deflink.ht_cap.ht_supported) {
335 sta_info->is_ampdu_allowed = true;
336 sta_info->is_amsdu_allowed = false;
337 - if (sta->ht_cap.cap & IEEE80211_HT_CAP_MAX_AMSDU) {
338 + if (sta->deflink.ht_cap.cap & IEEE80211_HT_CAP_MAX_AMSDU) {
339 sta_info->amsdu_ctrl.cap = MWL_AMSDU_SIZE_8K;
340 sta_info->amsdu_ctrl.amsdu_allow_size = SYSADPT_AMSDU_8K_MAX_SIZE;
341 }
342 @@ -670,7 +670,7 @@ static int mwl_mac80211_sta_remove(struc
343
344 static int mwl_mac80211_conf_tx(struct ieee80211_hw *hw,
345 struct ieee80211_vif *vif,
346 - u16 queue,
347 + unsigned int link_id, u16 queue,
348 const struct ieee80211_tx_queue_params *params)
349 {
350 struct mwl_priv *priv = hw->priv;
351 @@ -934,4 +934,5 @@ const struct ieee80211_ops mwl_mac80211_
352 .pre_channel_switch = mwl_mac80211_chnl_switch,
353 .sw_scan_start = mwl_mac80211_sw_scan_start,
354 .sw_scan_complete = mwl_mac80211_sw_scan_complete,
355 + .wake_tx_queue = ieee80211_handle_wake_tx_queue,
356 };
357 --- a/utils.c
358 +++ b/utils.c
359 @@ -173,9 +173,9 @@ u32 utils_get_init_tx_rate(struct mwl_pr
360 u32 tx_rate;
361 u16 format, nss, bw, rate_mcs;
362
363 - if (sta->vht_cap.vht_supported)
364 + if (sta->deflink.vht_cap.vht_supported)
365 format = TX_RATE_FORMAT_11AC;
366 - else if (sta->ht_cap.ht_supported)
367 + else if (sta->deflink.ht_cap.ht_supported)
368 format = TX_RATE_FORMAT_11N;
369 else
370 format = TX_RATE_FORMAT_LEGACY;
371 @@ -192,11 +192,11 @@ u32 utils_get_init_tx_rate(struct mwl_pr
372 nss = 3;
373 break;
374 default:
375 - nss = sta->rx_nss;
376 + nss = sta->deflink.rx_nss;
377 break;
378 }
379 - if (nss > sta->rx_nss)
380 - nss = sta->rx_nss;
381 + if (nss > sta->deflink.rx_nss)
382 + nss = sta->deflink.rx_nss;
383
384 switch (conf->chandef.width) {
385 case NL80211_CHAN_WIDTH_20_NOHT:
386 @@ -213,11 +213,11 @@ u32 utils_get_init_tx_rate(struct mwl_pr
387 bw = TX_RATE_BANDWIDTH_160;
388 break;
389 default:
390 - bw = sta->bandwidth;
391 + bw = sta->deflink.bandwidth;
392 break;
393 }
394 - if (bw > sta->bandwidth)
395 - bw = sta->bandwidth;
396 + if (bw > sta->deflink.bandwidth)
397 + bw = sta->deflink.bandwidth;
398
399 switch (format) {
400 case TX_RATE_FORMAT_LEGACY: