.. | .. |
---|
1 | | -/* |
---|
2 | | - * Copyright (c) 2012-2012 Quantenna Communications, Inc. |
---|
3 | | - * All rights reserved. |
---|
4 | | - * |
---|
5 | | - * This program is free software; you can redistribute it and/or |
---|
6 | | - * modify it under the terms of the GNU General Public License |
---|
7 | | - * as published by the Free Software Foundation; either version 2 |
---|
8 | | - * of the License, or (at your option) any later version. |
---|
9 | | - * |
---|
10 | | - * This program is distributed in the hope that it will be useful, |
---|
11 | | - * but WITHOUT ANY WARRANTY; without even the implied warranty of |
---|
12 | | - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the |
---|
13 | | - * GNU General Public License for more details. |
---|
14 | | - * |
---|
15 | | - */ |
---|
| 1 | +// SPDX-License-Identifier: GPL-2.0+ |
---|
| 2 | +/* Copyright (c) 2015-2016 Quantenna Communications. All rights reserved. */ |
---|
16 | 3 | |
---|
17 | 4 | #include <linux/kernel.h> |
---|
18 | 5 | #include <linux/etherdevice.h> |
---|
.. | .. |
---|
66 | 53 | static const struct ieee80211_txrx_stypes |
---|
67 | 54 | qtnf_mgmt_stypes[NUM_NL80211_IFTYPES] = { |
---|
68 | 55 | [NL80211_IFTYPE_STATION] = { |
---|
69 | | - .tx = BIT(IEEE80211_STYPE_ACTION >> 4), |
---|
| 56 | + .tx = BIT(IEEE80211_STYPE_ACTION >> 4) | |
---|
| 57 | + BIT(IEEE80211_STYPE_AUTH >> 4), |
---|
70 | 58 | .rx = BIT(IEEE80211_STYPE_ACTION >> 4) | |
---|
71 | | - BIT(IEEE80211_STYPE_PROBE_REQ >> 4), |
---|
| 59 | + BIT(IEEE80211_STYPE_PROBE_REQ >> 4) | |
---|
| 60 | + BIT(IEEE80211_STYPE_AUTH >> 4), |
---|
72 | 61 | }, |
---|
73 | 62 | [NL80211_IFTYPE_AP] = { |
---|
74 | | - .tx = BIT(IEEE80211_STYPE_ACTION >> 4), |
---|
| 63 | + .tx = BIT(IEEE80211_STYPE_ACTION >> 4) | |
---|
| 64 | + BIT(IEEE80211_STYPE_AUTH >> 4), |
---|
75 | 65 | .rx = BIT(IEEE80211_STYPE_ACTION >> 4) | |
---|
76 | 66 | BIT(IEEE80211_STYPE_PROBE_REQ >> 4) | |
---|
77 | 67 | BIT(IEEE80211_STYPE_ASSOC_REQ >> 4) | |
---|
.. | .. |
---|
112 | 102 | |
---|
113 | 103 | ret = cfg80211_check_combinations(wiphy, ¶ms); |
---|
114 | 104 | |
---|
| 105 | + if (ret) |
---|
| 106 | + return ret; |
---|
| 107 | + |
---|
| 108 | + /* Check repeater interface combination: primary VIF should be STA only. |
---|
| 109 | + * STA (primary) + AP (secondary) is OK. |
---|
| 110 | + * AP (primary) + STA (secondary) is not supported. |
---|
| 111 | + */ |
---|
| 112 | + vif = qtnf_mac_get_base_vif(mac); |
---|
| 113 | + if (vif && vif->wdev.iftype == NL80211_IFTYPE_AP && |
---|
| 114 | + vif != change_vif && new_type == NL80211_IFTYPE_STATION) { |
---|
| 115 | + ret = -EINVAL; |
---|
| 116 | + pr_err("MAC%u invalid combination: AP as primary repeater interface is not supported\n", |
---|
| 117 | + mac->macid); |
---|
| 118 | + } |
---|
| 119 | + |
---|
115 | 120 | return ret; |
---|
116 | 121 | } |
---|
117 | 122 | |
---|
.. | .. |
---|
122 | 127 | struct vif_params *params) |
---|
123 | 128 | { |
---|
124 | 129 | struct qtnf_vif *vif = qtnf_netdev_get_priv(dev); |
---|
125 | | - u8 *mac_addr; |
---|
| 130 | + u8 *mac_addr = NULL; |
---|
| 131 | + int use4addr = 0; |
---|
126 | 132 | int ret; |
---|
127 | 133 | |
---|
128 | 134 | ret = qtnf_validate_iface_combinations(wiphy, vif, type); |
---|
.. | .. |
---|
132 | 138 | return ret; |
---|
133 | 139 | } |
---|
134 | 140 | |
---|
135 | | - if (params) |
---|
| 141 | + if (params) { |
---|
136 | 142 | mac_addr = params->macaddr; |
---|
137 | | - else |
---|
138 | | - mac_addr = NULL; |
---|
| 143 | + use4addr = params->use_4addr; |
---|
| 144 | + } |
---|
139 | 145 | |
---|
140 | 146 | qtnf_scan_done(vif->mac, true); |
---|
141 | 147 | |
---|
142 | | - ret = qtnf_cmd_send_change_intf_type(vif, type, mac_addr); |
---|
| 148 | + ret = qtnf_cmd_send_change_intf_type(vif, type, use4addr, mac_addr); |
---|
143 | 149 | if (ret) { |
---|
144 | | - pr_err("VIF%u.%u: failed to change VIF type: %d\n", |
---|
145 | | - vif->mac->macid, vif->vifid, ret); |
---|
| 150 | + pr_err("VIF%u.%u: failed to change type to %d\n", |
---|
| 151 | + vif->mac->macid, vif->vifid, type); |
---|
146 | 152 | return ret; |
---|
147 | 153 | } |
---|
148 | 154 | |
---|
.. | .. |
---|
154 | 160 | { |
---|
155 | 161 | struct net_device *netdev = wdev->netdev; |
---|
156 | 162 | struct qtnf_vif *vif; |
---|
| 163 | + struct sk_buff *skb; |
---|
157 | 164 | |
---|
158 | 165 | if (WARN_ON(!netdev)) |
---|
159 | 166 | return -EFAULT; |
---|
.. | .. |
---|
166 | 173 | netif_tx_stop_all_queues(netdev); |
---|
167 | 174 | if (netif_carrier_ok(netdev)) |
---|
168 | 175 | netif_carrier_off(netdev); |
---|
| 176 | + |
---|
| 177 | + while ((skb = skb_dequeue(&vif->high_pri_tx_queue))) |
---|
| 178 | + dev_kfree_skb_any(skb); |
---|
| 179 | + |
---|
| 180 | + cancel_work_sync(&vif->high_pri_tx_work); |
---|
169 | 181 | |
---|
170 | 182 | if (netdev->reg_state == NETREG_REGISTERED) |
---|
171 | 183 | unregister_netdevice(netdev); |
---|
.. | .. |
---|
190 | 202 | struct qtnf_wmac *mac; |
---|
191 | 203 | struct qtnf_vif *vif; |
---|
192 | 204 | u8 *mac_addr = NULL; |
---|
| 205 | + int use4addr = 0; |
---|
193 | 206 | int ret; |
---|
194 | 207 | |
---|
195 | 208 | mac = wiphy_priv(wiphy); |
---|
.. | .. |
---|
216 | 229 | eth_zero_addr(vif->mac_addr); |
---|
217 | 230 | eth_zero_addr(vif->bssid); |
---|
218 | 231 | vif->bss_priority = QTNF_DEF_BSS_PRIORITY; |
---|
219 | | - vif->sta_state = QTNF_STA_DISCONNECTED; |
---|
220 | 232 | memset(&vif->wdev, 0, sizeof(vif->wdev)); |
---|
221 | 233 | vif->wdev.wiphy = wiphy; |
---|
222 | 234 | vif->wdev.iftype = type; |
---|
.. | .. |
---|
226 | 238 | return ERR_PTR(-ENOTSUPP); |
---|
227 | 239 | } |
---|
228 | 240 | |
---|
229 | | - if (params) |
---|
| 241 | + if (params) { |
---|
230 | 242 | mac_addr = params->macaddr; |
---|
| 243 | + use4addr = params->use_4addr; |
---|
| 244 | + } |
---|
231 | 245 | |
---|
232 | | - if (qtnf_cmd_send_add_intf(vif, type, mac_addr)) { |
---|
233 | | - pr_err("VIF%u.%u: failed to add VIF\n", mac->macid, vif->vifid); |
---|
| 246 | + ret = qtnf_cmd_send_add_intf(vif, type, use4addr, mac_addr); |
---|
| 247 | + if (ret) { |
---|
| 248 | + pr_err("VIF%u.%u: failed to add VIF %pM\n", |
---|
| 249 | + mac->macid, vif->vifid, mac_addr); |
---|
234 | 250 | goto err_cmd; |
---|
235 | 251 | } |
---|
236 | 252 | |
---|
237 | 253 | if (!is_valid_ether_addr(vif->mac_addr)) { |
---|
238 | 254 | pr_err("VIF%u.%u: FW reported bad MAC: %pM\n", |
---|
239 | 255 | mac->macid, vif->vifid, vif->mac_addr); |
---|
240 | | - goto err_mac; |
---|
| 256 | + ret = -EINVAL; |
---|
| 257 | + goto error_del_vif; |
---|
241 | 258 | } |
---|
242 | 259 | |
---|
243 | | - if (qtnf_core_net_attach(mac, vif, name, name_assign_t)) { |
---|
| 260 | + ret = qtnf_core_net_attach(mac, vif, name, name_assign_t); |
---|
| 261 | + if (ret) { |
---|
244 | 262 | pr_err("VIF%u.%u: failed to attach netdev\n", mac->macid, |
---|
245 | 263 | vif->vifid); |
---|
246 | | - goto err_net; |
---|
| 264 | + goto error_del_vif; |
---|
| 265 | + } |
---|
| 266 | + |
---|
| 267 | + if (qtnf_hwcap_is_set(&mac->bus->hw_info, QLINK_HW_CAPAB_HW_BRIDGE)) { |
---|
| 268 | + ret = qtnf_cmd_netdev_changeupper(vif, vif->netdev->ifindex); |
---|
| 269 | + if (ret) { |
---|
| 270 | + unregister_netdevice(vif->netdev); |
---|
| 271 | + vif->netdev = NULL; |
---|
| 272 | + goto error_del_vif; |
---|
| 273 | + } |
---|
247 | 274 | } |
---|
248 | 275 | |
---|
249 | 276 | vif->wdev.netdev = vif->netdev; |
---|
250 | 277 | return &vif->wdev; |
---|
251 | 278 | |
---|
252 | | -err_net: |
---|
253 | | - vif->netdev = NULL; |
---|
254 | | -err_mac: |
---|
| 279 | +error_del_vif: |
---|
255 | 280 | qtnf_cmd_send_del_intf(vif); |
---|
256 | 281 | err_cmd: |
---|
257 | 282 | vif->wdev.iftype = NL80211_IFTYPE_UNSPECIFIED; |
---|
258 | 283 | |
---|
259 | | - return ERR_PTR(-EFAULT); |
---|
| 284 | + return ERR_PTR(ret); |
---|
260 | 285 | } |
---|
261 | 286 | |
---|
262 | 287 | static int qtnf_mgmt_set_appie(struct qtnf_vif *vif, |
---|
.. | .. |
---|
335 | 360 | qtnf_scan_done(vif->mac, true); |
---|
336 | 361 | |
---|
337 | 362 | ret = qtnf_cmd_send_stop_ap(vif); |
---|
338 | | - if (ret) { |
---|
| 363 | + if (ret) |
---|
339 | 364 | pr_err("VIF%u.%u: failed to stop AP operation in FW\n", |
---|
340 | 365 | vif->mac->macid, vif->vifid); |
---|
341 | 366 | |
---|
342 | | - netif_carrier_off(vif->netdev); |
---|
343 | | - } |
---|
| 367 | + netif_carrier_off(vif->netdev); |
---|
344 | 368 | |
---|
345 | 369 | return ret; |
---|
346 | 370 | } |
---|
.. | .. |
---|
357 | 381 | return -EFAULT; |
---|
358 | 382 | } |
---|
359 | 383 | |
---|
360 | | - if (changed & (WIPHY_PARAM_RETRY_LONG | WIPHY_PARAM_RETRY_SHORT)) { |
---|
361 | | - pr_err("MAC%u: can't modify retry params\n", mac->macid); |
---|
362 | | - return -EOPNOTSUPP; |
---|
363 | | - } |
---|
364 | | - |
---|
365 | 384 | ret = qtnf_cmd_send_update_phy_params(mac, changed); |
---|
366 | 385 | if (ret) |
---|
367 | 386 | pr_err("MAC%u: failed to update PHY params\n", mac->macid); |
---|
.. | .. |
---|
370 | 389 | } |
---|
371 | 390 | |
---|
372 | 391 | static void |
---|
373 | | -qtnf_mgmt_frame_register(struct wiphy *wiphy, struct wireless_dev *wdev, |
---|
374 | | - u16 frame_type, bool reg) |
---|
| 392 | +qtnf_update_mgmt_frame_registrations(struct wiphy *wiphy, |
---|
| 393 | + struct wireless_dev *wdev, |
---|
| 394 | + struct mgmt_frame_regs *upd) |
---|
375 | 395 | { |
---|
376 | 396 | struct qtnf_vif *vif = qtnf_netdev_get_priv(wdev->netdev); |
---|
377 | | - u16 mgmt_type; |
---|
378 | | - u16 new_mask; |
---|
379 | | - u16 qlink_frame_type = 0; |
---|
| 397 | + u16 new_mask = upd->interface_stypes; |
---|
| 398 | + u16 old_mask = vif->mgmt_frames_bitmask; |
---|
| 399 | + static const struct { |
---|
| 400 | + u16 mask, qlink_type; |
---|
| 401 | + } updates[] = { |
---|
| 402 | + { |
---|
| 403 | + .mask = BIT(IEEE80211_STYPE_REASSOC_REQ >> 4) | |
---|
| 404 | + BIT(IEEE80211_STYPE_ASSOC_REQ >> 4), |
---|
| 405 | + .qlink_type = QLINK_MGMT_FRAME_ASSOC_REQ, |
---|
| 406 | + }, |
---|
| 407 | + { |
---|
| 408 | + .mask = BIT(IEEE80211_STYPE_AUTH >> 4), |
---|
| 409 | + .qlink_type = QLINK_MGMT_FRAME_AUTH, |
---|
| 410 | + }, |
---|
| 411 | + { |
---|
| 412 | + .mask = BIT(IEEE80211_STYPE_PROBE_REQ >> 4), |
---|
| 413 | + .qlink_type = QLINK_MGMT_FRAME_PROBE_REQ, |
---|
| 414 | + }, |
---|
| 415 | + { |
---|
| 416 | + .mask = BIT(IEEE80211_STYPE_ACTION >> 4), |
---|
| 417 | + .qlink_type = QLINK_MGMT_FRAME_ACTION, |
---|
| 418 | + }, |
---|
| 419 | + }; |
---|
| 420 | + unsigned int i; |
---|
380 | 421 | |
---|
381 | | - mgmt_type = (frame_type & IEEE80211_FCTL_STYPE) >> 4; |
---|
382 | | - |
---|
383 | | - if (reg) |
---|
384 | | - new_mask = vif->mgmt_frames_bitmask | BIT(mgmt_type); |
---|
385 | | - else |
---|
386 | | - new_mask = vif->mgmt_frames_bitmask & ~BIT(mgmt_type); |
---|
387 | | - |
---|
388 | | - if (new_mask == vif->mgmt_frames_bitmask) |
---|
| 422 | + if (new_mask == old_mask) |
---|
389 | 423 | return; |
---|
390 | 424 | |
---|
391 | | - switch (frame_type & IEEE80211_FCTL_STYPE) { |
---|
392 | | - case IEEE80211_STYPE_REASSOC_REQ: |
---|
393 | | - case IEEE80211_STYPE_ASSOC_REQ: |
---|
394 | | - qlink_frame_type = QLINK_MGMT_FRAME_ASSOC_REQ; |
---|
395 | | - break; |
---|
396 | | - case IEEE80211_STYPE_AUTH: |
---|
397 | | - qlink_frame_type = QLINK_MGMT_FRAME_AUTH; |
---|
398 | | - break; |
---|
399 | | - case IEEE80211_STYPE_PROBE_REQ: |
---|
400 | | - qlink_frame_type = QLINK_MGMT_FRAME_PROBE_REQ; |
---|
401 | | - break; |
---|
402 | | - case IEEE80211_STYPE_ACTION: |
---|
403 | | - qlink_frame_type = QLINK_MGMT_FRAME_ACTION; |
---|
404 | | - break; |
---|
405 | | - default: |
---|
406 | | - pr_warn("VIF%u.%u: unsupported frame type: %X\n", |
---|
407 | | - vif->mac->macid, vif->vifid, |
---|
408 | | - (frame_type & IEEE80211_FCTL_STYPE) >> 4); |
---|
409 | | - return; |
---|
410 | | - } |
---|
| 425 | + for (i = 0; i < ARRAY_SIZE(updates); i++) { |
---|
| 426 | + u16 mask = updates[i].mask; |
---|
| 427 | + u16 qlink_frame_type = updates[i].qlink_type; |
---|
| 428 | + bool reg; |
---|
411 | 429 | |
---|
412 | | - if (qtnf_cmd_send_register_mgmt(vif, qlink_frame_type, reg)) { |
---|
413 | | - pr_warn("VIF%u.%u: failed to %sregister mgmt frame type 0x%x\n", |
---|
414 | | - vif->mac->macid, vif->vifid, reg ? "" : "un", |
---|
415 | | - frame_type); |
---|
416 | | - return; |
---|
| 430 | + /* the ! are here due to the assoc/reassoc merge */ |
---|
| 431 | + if (!(new_mask & mask) == !(old_mask & mask)) |
---|
| 432 | + continue; |
---|
| 433 | + |
---|
| 434 | + reg = new_mask & mask; |
---|
| 435 | + |
---|
| 436 | + if (qtnf_cmd_send_register_mgmt(vif, qlink_frame_type, reg)) |
---|
| 437 | + pr_warn("VIF%u.%u: failed to %sregister qlink frame type 0x%x\n", |
---|
| 438 | + vif->mac->macid, vif->vifid, reg ? "" : "un", |
---|
| 439 | + qlink_frame_type); |
---|
417 | 440 | } |
---|
418 | 441 | |
---|
419 | 442 | vif->mgmt_frames_bitmask = new_mask; |
---|
420 | | - pr_debug("VIF%u.%u: %sregistered mgmt frame type 0x%x\n", |
---|
421 | | - vif->mac->macid, vif->vifid, reg ? "" : "un", frame_type); |
---|
422 | 443 | } |
---|
423 | 444 | |
---|
424 | 445 | static int |
---|
.. | .. |
---|
434 | 455 | *cookie = short_cookie; |
---|
435 | 456 | |
---|
436 | 457 | if (params->offchan) |
---|
437 | | - flags |= QLINK_MGMT_FRAME_TX_FLAG_OFFCHAN; |
---|
| 458 | + flags |= QLINK_FRAME_TX_FLAG_OFFCHAN; |
---|
438 | 459 | |
---|
439 | 460 | if (params->no_cck) |
---|
440 | | - flags |= QLINK_MGMT_FRAME_TX_FLAG_NO_CCK; |
---|
| 461 | + flags |= QLINK_FRAME_TX_FLAG_NO_CCK; |
---|
441 | 462 | |
---|
442 | 463 | if (params->dont_wait_for_ack) |
---|
443 | | - flags |= QLINK_MGMT_FRAME_TX_FLAG_ACK_NOWAIT; |
---|
| 464 | + flags |= QLINK_FRAME_TX_FLAG_ACK_NOWAIT; |
---|
444 | 465 | |
---|
445 | 466 | /* If channel is not specified, pass "freq = 0" to tell device |
---|
446 | 467 | * firmware to use current channel. |
---|
.. | .. |
---|
455 | 476 | le16_to_cpu(mgmt_frame->frame_control), mgmt_frame->da, |
---|
456 | 477 | params->len, short_cookie, flags); |
---|
457 | 478 | |
---|
458 | | - return qtnf_cmd_send_mgmt_frame(vif, short_cookie, flags, |
---|
459 | | - freq, |
---|
460 | | - params->buf, params->len); |
---|
| 479 | + return qtnf_cmd_send_frame(vif, short_cookie, flags, |
---|
| 480 | + freq, params->buf, params->len); |
---|
461 | 481 | } |
---|
462 | 482 | |
---|
463 | 483 | static int |
---|
.. | .. |
---|
478 | 498 | const struct qtnf_sta_node *sta_node; |
---|
479 | 499 | int ret; |
---|
480 | 500 | |
---|
481 | | - sta_node = qtnf_sta_list_lookup_index(&vif->sta_list, idx); |
---|
| 501 | + switch (vif->wdev.iftype) { |
---|
| 502 | + case NL80211_IFTYPE_STATION: |
---|
| 503 | + if (idx != 0 || !vif->wdev.current_bss) |
---|
| 504 | + return -ENOENT; |
---|
482 | 505 | |
---|
483 | | - if (unlikely(!sta_node)) |
---|
484 | | - return -ENOENT; |
---|
| 506 | + ether_addr_copy(mac, vif->bssid); |
---|
| 507 | + break; |
---|
| 508 | + case NL80211_IFTYPE_AP: |
---|
| 509 | + sta_node = qtnf_sta_list_lookup_index(&vif->sta_list, idx); |
---|
| 510 | + if (unlikely(!sta_node)) |
---|
| 511 | + return -ENOENT; |
---|
485 | 512 | |
---|
486 | | - ether_addr_copy(mac, sta_node->mac_addr); |
---|
| 513 | + ether_addr_copy(mac, sta_node->mac_addr); |
---|
| 514 | + break; |
---|
| 515 | + default: |
---|
| 516 | + return -ENOTSUPP; |
---|
| 517 | + } |
---|
487 | 518 | |
---|
488 | | - ret = qtnf_cmd_get_sta_info(vif, sta_node->mac_addr, sinfo); |
---|
| 519 | + ret = qtnf_cmd_get_sta_info(vif, mac, sinfo); |
---|
489 | 520 | |
---|
490 | | - if (unlikely(ret == -ENOENT)) { |
---|
491 | | - qtnf_sta_list_del(vif, mac); |
---|
492 | | - cfg80211_del_sta(vif->netdev, mac, GFP_KERNEL); |
---|
493 | | - sinfo->filled = 0; |
---|
| 521 | + if (vif->wdev.iftype == NL80211_IFTYPE_AP) { |
---|
| 522 | + if (ret == -ENOENT) { |
---|
| 523 | + cfg80211_del_sta(vif->netdev, mac, GFP_KERNEL); |
---|
| 524 | + sinfo->filled = 0; |
---|
| 525 | + } |
---|
494 | 526 | } |
---|
495 | 527 | |
---|
496 | 528 | sinfo->generation = vif->generation; |
---|
.. | .. |
---|
597 | 629 | if (ret) |
---|
598 | 630 | pr_err("VIF%u.%u: failed to delete STA %pM\n", |
---|
599 | 631 | vif->mac->macid, vif->vifid, params->mac); |
---|
| 632 | + |
---|
600 | 633 | return ret; |
---|
601 | 634 | } |
---|
602 | 635 | |
---|
.. | .. |
---|
604 | 637 | qtnf_scan(struct wiphy *wiphy, struct cfg80211_scan_request *request) |
---|
605 | 638 | { |
---|
606 | 639 | struct qtnf_wmac *mac = wiphy_priv(wiphy); |
---|
| 640 | + int ret; |
---|
607 | 641 | |
---|
608 | 642 | cancel_delayed_work_sync(&mac->scan_timeout); |
---|
609 | 643 | |
---|
610 | 644 | mac->scan_req = request; |
---|
611 | 645 | |
---|
612 | | - if (qtnf_cmd_send_scan(mac)) { |
---|
| 646 | + ret = qtnf_cmd_send_scan(mac); |
---|
| 647 | + if (ret) { |
---|
613 | 648 | pr_err("MAC%u: failed to start scan\n", mac->macid); |
---|
614 | 649 | mac->scan_req = NULL; |
---|
615 | | - return -EFAULT; |
---|
| 650 | + goto out; |
---|
616 | 651 | } |
---|
617 | 652 | |
---|
| 653 | + pr_debug("MAC%u: scan started\n", mac->macid); |
---|
618 | 654 | queue_delayed_work(mac->bus->workqueue, &mac->scan_timeout, |
---|
619 | 655 | QTNF_SCAN_TIMEOUT_SEC * HZ); |
---|
620 | 656 | |
---|
621 | | - return 0; |
---|
| 657 | +out: |
---|
| 658 | + return ret; |
---|
622 | 659 | } |
---|
623 | 660 | |
---|
624 | 661 | static int |
---|
.. | .. |
---|
631 | 668 | if (vif->wdev.iftype != NL80211_IFTYPE_STATION) |
---|
632 | 669 | return -EOPNOTSUPP; |
---|
633 | 670 | |
---|
634 | | - if (vif->sta_state != QTNF_STA_DISCONNECTED) |
---|
635 | | - return -EBUSY; |
---|
| 671 | + if (sme->auth_type == NL80211_AUTHTYPE_SAE && |
---|
| 672 | + !(sme->flags & CONNECT_REQ_EXTERNAL_AUTH_SUPPORT)) { |
---|
| 673 | + pr_err("can not offload authentication to userspace\n"); |
---|
| 674 | + return -EOPNOTSUPP; |
---|
| 675 | + } |
---|
636 | 676 | |
---|
637 | 677 | if (sme->bssid) |
---|
638 | 678 | ether_addr_copy(vif->bssid, sme->bssid); |
---|
.. | .. |
---|
641 | 681 | |
---|
642 | 682 | ret = qtnf_cmd_send_connect(vif, sme); |
---|
643 | 683 | if (ret) { |
---|
644 | | - pr_err("VIF%u.%u: failed to connect\n", vif->mac->macid, |
---|
645 | | - vif->vifid); |
---|
646 | | - return ret; |
---|
| 684 | + pr_err("VIF%u.%u: failed to connect\n", |
---|
| 685 | + vif->mac->macid, vif->vifid); |
---|
| 686 | + goto out; |
---|
647 | 687 | } |
---|
648 | 688 | |
---|
649 | | - vif->sta_state = QTNF_STA_CONNECTING; |
---|
650 | | - return 0; |
---|
| 689 | +out: |
---|
| 690 | + return ret; |
---|
| 691 | +} |
---|
| 692 | + |
---|
| 693 | +static int |
---|
| 694 | +qtnf_external_auth(struct wiphy *wiphy, struct net_device *dev, |
---|
| 695 | + struct cfg80211_external_auth_params *auth) |
---|
| 696 | +{ |
---|
| 697 | + struct qtnf_vif *vif = qtnf_netdev_get_priv(dev); |
---|
| 698 | + int ret; |
---|
| 699 | + |
---|
| 700 | + if (vif->wdev.iftype == NL80211_IFTYPE_STATION && |
---|
| 701 | + !ether_addr_equal(vif->bssid, auth->bssid)) |
---|
| 702 | + pr_warn("unexpected bssid: %pM", auth->bssid); |
---|
| 703 | + |
---|
| 704 | + ret = qtnf_cmd_send_external_auth(vif, auth); |
---|
| 705 | + if (ret) { |
---|
| 706 | + pr_err("VIF%u.%u: failed to report external auth\n", |
---|
| 707 | + vif->mac->macid, vif->vifid); |
---|
| 708 | + goto out; |
---|
| 709 | + } |
---|
| 710 | + |
---|
| 711 | +out: |
---|
| 712 | + return ret; |
---|
651 | 713 | } |
---|
652 | 714 | |
---|
653 | 715 | static int |
---|
.. | .. |
---|
669 | 731 | goto out; |
---|
670 | 732 | } |
---|
671 | 733 | |
---|
672 | | - qtnf_scan_done(mac, true); |
---|
673 | | - |
---|
674 | | - if (vif->sta_state == QTNF_STA_DISCONNECTED) |
---|
675 | | - goto out; |
---|
676 | | - |
---|
677 | 734 | ret = qtnf_cmd_send_disconnect(vif, reason_code); |
---|
678 | | - if (ret) { |
---|
679 | | - pr_err("VIF%u.%u: failed to disconnect\n", mac->macid, |
---|
680 | | - vif->vifid); |
---|
681 | | - goto out; |
---|
| 735 | + if (ret) |
---|
| 736 | + pr_err("VIF%u.%u: failed to disconnect\n", |
---|
| 737 | + mac->macid, vif->vifid); |
---|
| 738 | + |
---|
| 739 | + if (vif->wdev.current_bss) { |
---|
| 740 | + netif_carrier_off(vif->netdev); |
---|
| 741 | + cfg80211_disconnected(vif->netdev, reason_code, |
---|
| 742 | + NULL, 0, true, GFP_KERNEL); |
---|
682 | 743 | } |
---|
683 | 744 | |
---|
684 | 745 | out: |
---|
685 | | - if (vif->sta_state == QTNF_STA_CONNECTING) |
---|
686 | | - vif->sta_state = QTNF_STA_DISCONNECTED; |
---|
687 | | - |
---|
688 | 746 | return ret; |
---|
689 | 747 | } |
---|
690 | 748 | |
---|
.. | .. |
---|
697 | 755 | struct ieee80211_supported_band *sband; |
---|
698 | 756 | const struct cfg80211_chan_def *chandef = &wdev->chandef; |
---|
699 | 757 | struct ieee80211_channel *chan; |
---|
700 | | - struct qtnf_chan_stats stats; |
---|
701 | | - struct qtnf_vif *vif; |
---|
702 | 758 | int ret; |
---|
703 | | - |
---|
704 | | - vif = qtnf_netdev_get_priv(dev); |
---|
705 | 759 | |
---|
706 | 760 | sband = wiphy->bands[NL80211_BAND_2GHZ]; |
---|
707 | 761 | if (sband && idx >= sband->n_channels) { |
---|
.. | .. |
---|
716 | 770 | return -ENOENT; |
---|
717 | 771 | |
---|
718 | 772 | chan = &sband->channels[idx]; |
---|
719 | | - memset(&stats, 0, sizeof(stats)); |
---|
720 | | - |
---|
721 | 773 | survey->channel = chan; |
---|
722 | 774 | survey->filled = 0x0; |
---|
723 | 775 | |
---|
724 | | - if (chandef->chan) { |
---|
725 | | - if (chan->hw_value == chandef->chan->hw_value) |
---|
726 | | - survey->filled = SURVEY_INFO_IN_USE; |
---|
727 | | - } |
---|
| 776 | + if (chan == chandef->chan) |
---|
| 777 | + survey->filled = SURVEY_INFO_IN_USE; |
---|
728 | 778 | |
---|
729 | | - ret = qtnf_cmd_get_chan_stats(mac, chan->hw_value, &stats); |
---|
730 | | - switch (ret) { |
---|
731 | | - case 0: |
---|
732 | | - if (unlikely(stats.chan_num != chan->hw_value)) { |
---|
733 | | - pr_err("received stats for channel %d instead of %d\n", |
---|
734 | | - stats.chan_num, chan->hw_value); |
---|
735 | | - ret = -EINVAL; |
---|
736 | | - break; |
---|
737 | | - } |
---|
738 | | - |
---|
739 | | - survey->filled |= SURVEY_INFO_TIME | |
---|
740 | | - SURVEY_INFO_TIME_SCAN | |
---|
741 | | - SURVEY_INFO_TIME_BUSY | |
---|
742 | | - SURVEY_INFO_TIME_RX | |
---|
743 | | - SURVEY_INFO_TIME_TX | |
---|
744 | | - SURVEY_INFO_NOISE_DBM; |
---|
745 | | - |
---|
746 | | - survey->time_scan = stats.cca_try; |
---|
747 | | - survey->time = stats.cca_try; |
---|
748 | | - survey->time_tx = stats.cca_tx; |
---|
749 | | - survey->time_rx = stats.cca_rx; |
---|
750 | | - survey->time_busy = stats.cca_busy; |
---|
751 | | - survey->noise = stats.chan_noise; |
---|
752 | | - break; |
---|
753 | | - case -ENOENT: |
---|
754 | | - pr_debug("no stats for channel %u\n", chan->hw_value); |
---|
755 | | - ret = 0; |
---|
756 | | - break; |
---|
757 | | - default: |
---|
| 779 | + ret = qtnf_cmd_get_chan_stats(mac, chan->center_freq, survey); |
---|
| 780 | + if (ret) |
---|
758 | 781 | pr_debug("failed to get chan(%d) stats from card\n", |
---|
759 | 782 | chan->hw_value); |
---|
760 | | - ret = -EINVAL; |
---|
761 | | - break; |
---|
762 | | - } |
---|
763 | 783 | |
---|
764 | 784 | return ret; |
---|
765 | 785 | } |
---|
.. | .. |
---|
780 | 800 | ret = qtnf_cmd_get_channel(vif, chandef); |
---|
781 | 801 | if (ret) { |
---|
782 | 802 | pr_err("%s: failed to get channel: %d\n", ndev->name, ret); |
---|
| 803 | + ret = -ENODATA; |
---|
783 | 804 | goto out; |
---|
784 | 805 | } |
---|
785 | 806 | |
---|
.. | .. |
---|
789 | 810 | chandef->center_freq1, chandef->center_freq2, |
---|
790 | 811 | chandef->width); |
---|
791 | 812 | ret = -ENODATA; |
---|
| 813 | + goto out; |
---|
792 | 814 | } |
---|
793 | 815 | |
---|
794 | 816 | out: |
---|
.. | .. |
---|
858 | 880 | |
---|
859 | 881 | ret = qtnf_cmd_send_pm_set(vif, enabled ? QLINK_PM_AUTO_STANDBY : |
---|
860 | 882 | QLINK_PM_OFF, timeout); |
---|
861 | | - if (ret) { |
---|
| 883 | + if (ret) |
---|
862 | 884 | pr_err("%s: failed to set PM mode ret=%d\n", dev->name, ret); |
---|
863 | | - return ret; |
---|
| 885 | + |
---|
| 886 | + return ret; |
---|
| 887 | +} |
---|
| 888 | + |
---|
| 889 | +static int qtnf_get_tx_power(struct wiphy *wiphy, struct wireless_dev *wdev, |
---|
| 890 | + int *dbm) |
---|
| 891 | +{ |
---|
| 892 | + struct qtnf_vif *vif = qtnf_netdev_get_priv(wdev->netdev); |
---|
| 893 | + int ret; |
---|
| 894 | + |
---|
| 895 | + ret = qtnf_cmd_get_tx_power(vif, dbm); |
---|
| 896 | + if (ret) |
---|
| 897 | + pr_err("MAC%u: failed to get Tx power\n", vif->mac->macid); |
---|
| 898 | + |
---|
| 899 | + return ret; |
---|
| 900 | +} |
---|
| 901 | + |
---|
| 902 | +static int qtnf_set_tx_power(struct wiphy *wiphy, struct wireless_dev *wdev, |
---|
| 903 | + enum nl80211_tx_power_setting type, int mbm) |
---|
| 904 | +{ |
---|
| 905 | + struct qtnf_vif *vif; |
---|
| 906 | + int ret; |
---|
| 907 | + |
---|
| 908 | + if (wdev) { |
---|
| 909 | + vif = qtnf_netdev_get_priv(wdev->netdev); |
---|
| 910 | + } else { |
---|
| 911 | + struct qtnf_wmac *mac = wiphy_priv(wiphy); |
---|
| 912 | + |
---|
| 913 | + vif = qtnf_mac_get_base_vif(mac); |
---|
| 914 | + if (!vif) { |
---|
| 915 | + pr_err("MAC%u: primary VIF is not configured\n", |
---|
| 916 | + mac->macid); |
---|
| 917 | + return -EFAULT; |
---|
| 918 | + } |
---|
864 | 919 | } |
---|
865 | 920 | |
---|
| 921 | + ret = qtnf_cmd_set_tx_power(vif, type, mbm); |
---|
| 922 | + if (ret) |
---|
| 923 | + pr_err("MAC%u: failed to set Tx power\n", vif->mac->macid); |
---|
| 924 | + |
---|
| 925 | + return ret; |
---|
| 926 | +} |
---|
| 927 | + |
---|
| 928 | +static int qtnf_update_owe_info(struct wiphy *wiphy, struct net_device *dev, |
---|
| 929 | + struct cfg80211_update_owe_info *owe_info) |
---|
| 930 | +{ |
---|
| 931 | + struct qtnf_vif *vif = qtnf_netdev_get_priv(dev); |
---|
| 932 | + int ret; |
---|
| 933 | + |
---|
| 934 | + if (vif->wdev.iftype != NL80211_IFTYPE_AP) |
---|
| 935 | + return -EOPNOTSUPP; |
---|
| 936 | + |
---|
| 937 | + ret = qtnf_cmd_send_update_owe(vif, owe_info); |
---|
| 938 | + if (ret) { |
---|
| 939 | + pr_err("VIF%u.%u: failed to update owe info\n", |
---|
| 940 | + vif->mac->macid, vif->vifid); |
---|
| 941 | + goto out; |
---|
| 942 | + } |
---|
| 943 | + |
---|
| 944 | +out: |
---|
866 | 945 | return ret; |
---|
867 | 946 | } |
---|
868 | 947 | |
---|
.. | .. |
---|
940 | 1019 | .change_beacon = qtnf_change_beacon, |
---|
941 | 1020 | .stop_ap = qtnf_stop_ap, |
---|
942 | 1021 | .set_wiphy_params = qtnf_set_wiphy_params, |
---|
943 | | - .mgmt_frame_register = qtnf_mgmt_frame_register, |
---|
| 1022 | + .update_mgmt_frame_registrations = |
---|
| 1023 | + qtnf_update_mgmt_frame_registrations, |
---|
944 | 1024 | .mgmt_tx = qtnf_mgmt_tx, |
---|
945 | 1025 | .change_station = qtnf_change_station, |
---|
946 | 1026 | .del_station = qtnf_del_station, |
---|
.. | .. |
---|
952 | 1032 | .set_default_mgmt_key = qtnf_set_default_mgmt_key, |
---|
953 | 1033 | .scan = qtnf_scan, |
---|
954 | 1034 | .connect = qtnf_connect, |
---|
| 1035 | + .external_auth = qtnf_external_auth, |
---|
955 | 1036 | .disconnect = qtnf_disconnect, |
---|
956 | 1037 | .dump_survey = qtnf_dump_survey, |
---|
957 | 1038 | .get_channel = qtnf_get_channel, |
---|
.. | .. |
---|
959 | 1040 | .start_radar_detection = qtnf_start_radar_detection, |
---|
960 | 1041 | .set_mac_acl = qtnf_set_mac_acl, |
---|
961 | 1042 | .set_power_mgmt = qtnf_set_power_mgmt, |
---|
| 1043 | + .get_tx_power = qtnf_get_tx_power, |
---|
| 1044 | + .set_tx_power = qtnf_set_tx_power, |
---|
| 1045 | + .update_owe_info = qtnf_update_owe_info, |
---|
962 | 1046 | #ifdef CONFIG_PM |
---|
963 | 1047 | .suspend = qtnf_suspend, |
---|
964 | 1048 | .resume = qtnf_resume, |
---|
.. | .. |
---|
966 | 1050 | #endif |
---|
967 | 1051 | }; |
---|
968 | 1052 | |
---|
969 | | -static void qtnf_cfg80211_reg_notifier(struct wiphy *wiphy_in, |
---|
| 1053 | +static void qtnf_cfg80211_reg_notifier(struct wiphy *wiphy, |
---|
970 | 1054 | struct regulatory_request *req) |
---|
971 | 1055 | { |
---|
972 | | - struct qtnf_wmac *mac = wiphy_priv(wiphy_in); |
---|
973 | | - struct qtnf_bus *bus = mac->bus; |
---|
974 | | - struct wiphy *wiphy; |
---|
975 | | - unsigned int mac_idx; |
---|
| 1056 | + struct qtnf_wmac *mac = wiphy_priv(wiphy); |
---|
976 | 1057 | enum nl80211_band band; |
---|
977 | 1058 | int ret; |
---|
978 | 1059 | |
---|
979 | 1060 | pr_debug("MAC%u: initiator=%d alpha=%c%c\n", mac->macid, req->initiator, |
---|
980 | 1061 | req->alpha2[0], req->alpha2[1]); |
---|
981 | 1062 | |
---|
982 | | - ret = qtnf_cmd_reg_notify(bus, req); |
---|
| 1063 | + ret = qtnf_cmd_reg_notify(mac, req, qtnf_slave_radar_get(), |
---|
| 1064 | + qtnf_dfs_offload_get()); |
---|
983 | 1065 | if (ret) { |
---|
984 | | - if (ret != -EOPNOTSUPP && ret != -EALREADY) |
---|
985 | | - pr_err("failed to update reg domain to %c%c\n", |
---|
986 | | - req->alpha2[0], req->alpha2[1]); |
---|
| 1066 | + pr_err("MAC%u: failed to update region to %c%c: %d\n", |
---|
| 1067 | + mac->macid, req->alpha2[0], req->alpha2[1], ret); |
---|
987 | 1068 | return; |
---|
988 | 1069 | } |
---|
989 | 1070 | |
---|
990 | | - for (mac_idx = 0; mac_idx < QTNF_MAX_MAC; ++mac_idx) { |
---|
991 | | - if (!(bus->hw_info.mac_bitmap & (1 << mac_idx))) |
---|
| 1071 | + for (band = 0; band < NUM_NL80211_BANDS; ++band) { |
---|
| 1072 | + if (!wiphy->bands[band]) |
---|
992 | 1073 | continue; |
---|
993 | 1074 | |
---|
994 | | - mac = bus->mac[mac_idx]; |
---|
995 | | - if (!mac) |
---|
996 | | - continue; |
---|
997 | | - |
---|
998 | | - wiphy = priv_to_wiphy(mac); |
---|
999 | | - |
---|
1000 | | - for (band = 0; band < NUM_NL80211_BANDS; ++band) { |
---|
1001 | | - if (!wiphy->bands[band]) |
---|
1002 | | - continue; |
---|
1003 | | - |
---|
1004 | | - ret = qtnf_cmd_band_info_get(mac, wiphy->bands[band]); |
---|
1005 | | - if (ret) |
---|
1006 | | - pr_err("failed to get chan info for mac %u band %u\n", |
---|
1007 | | - mac_idx, band); |
---|
1008 | | - } |
---|
| 1075 | + ret = qtnf_cmd_band_info_get(mac, wiphy->bands[band]); |
---|
| 1076 | + if (ret) |
---|
| 1077 | + pr_err("MAC%u: failed to update band %u\n", |
---|
| 1078 | + mac->macid, band); |
---|
1009 | 1079 | } |
---|
1010 | 1080 | } |
---|
1011 | 1081 | |
---|
1012 | | -struct wiphy *qtnf_wiphy_allocate(struct qtnf_bus *bus) |
---|
| 1082 | +struct wiphy *qtnf_wiphy_allocate(struct qtnf_bus *bus, |
---|
| 1083 | + struct platform_device *pdev) |
---|
1013 | 1084 | { |
---|
1014 | 1085 | struct wiphy *wiphy; |
---|
1015 | 1086 | |
---|
1016 | | - if (bus->hw_info.hw_capab & QLINK_HW_CAPAB_DFS_OFFLOAD) |
---|
| 1087 | + if (qtnf_dfs_offload_get() && |
---|
| 1088 | + qtnf_hwcap_is_set(&bus->hw_info, QLINK_HW_CAPAB_DFS_OFFLOAD)) |
---|
1017 | 1089 | qtn_cfg80211_ops.start_radar_detection = NULL; |
---|
1018 | 1090 | |
---|
1019 | | - if (!(bus->hw_info.hw_capab & QLINK_HW_CAPAB_PWR_MGMT)) |
---|
| 1091 | + if (!qtnf_hwcap_is_set(&bus->hw_info, QLINK_HW_CAPAB_PWR_MGMT)) |
---|
1020 | 1092 | qtn_cfg80211_ops.set_power_mgmt = NULL; |
---|
1021 | 1093 | |
---|
1022 | 1094 | wiphy = wiphy_new(&qtn_cfg80211_ops, sizeof(struct qtnf_wmac)); |
---|
1023 | 1095 | if (!wiphy) |
---|
1024 | 1096 | return NULL; |
---|
1025 | 1097 | |
---|
1026 | | - set_wiphy_dev(wiphy, bus->dev); |
---|
| 1098 | + if (pdev) |
---|
| 1099 | + set_wiphy_dev(wiphy, &pdev->dev); |
---|
| 1100 | + else |
---|
| 1101 | + set_wiphy_dev(wiphy, bus->dev); |
---|
1027 | 1102 | |
---|
1028 | 1103 | return wiphy; |
---|
1029 | 1104 | } |
---|
.. | .. |
---|
1061 | 1136 | struct wiphy *wiphy = priv_to_wiphy(mac); |
---|
1062 | 1137 | struct qtnf_mac_info *macinfo = &mac->macinfo; |
---|
1063 | 1138 | int ret; |
---|
| 1139 | + bool regdomain_is_known; |
---|
1064 | 1140 | |
---|
1065 | 1141 | if (!wiphy) { |
---|
1066 | 1142 | pr_err("invalid wiphy pointer\n"); |
---|
.. | .. |
---|
1074 | 1150 | wiphy->coverage_class = macinfo->coverage_class; |
---|
1075 | 1151 | |
---|
1076 | 1152 | wiphy->max_scan_ssids = |
---|
1077 | | - (hw_info->max_scan_ssids) ? hw_info->max_scan_ssids : 1; |
---|
| 1153 | + (macinfo->max_scan_ssids) ? macinfo->max_scan_ssids : 1; |
---|
1078 | 1154 | wiphy->max_scan_ie_len = QTNF_MAX_VSIE_LEN; |
---|
1079 | 1155 | wiphy->mgmt_stypes = qtnf_mgmt_stypes; |
---|
1080 | 1156 | wiphy->max_remain_on_channel_duration = 5000; |
---|
.. | .. |
---|
1092 | 1168 | wiphy->flags |= WIPHY_FLAG_HAVE_AP_SME | |
---|
1093 | 1169 | WIPHY_FLAG_AP_PROBE_RESP_OFFLOAD | |
---|
1094 | 1170 | WIPHY_FLAG_AP_UAPSD | |
---|
1095 | | - WIPHY_FLAG_HAS_CHANNEL_SWITCH; |
---|
| 1171 | + WIPHY_FLAG_HAS_CHANNEL_SWITCH | |
---|
| 1172 | + WIPHY_FLAG_4ADDR_STATION | |
---|
| 1173 | + WIPHY_FLAG_NETNS_OK; |
---|
1096 | 1174 | wiphy->flags &= ~WIPHY_FLAG_PS_ON_BY_DEFAULT; |
---|
1097 | 1175 | |
---|
1098 | | - if (hw_info->hw_capab & QLINK_HW_CAPAB_DFS_OFFLOAD) |
---|
| 1176 | + if (qtnf_dfs_offload_get() && |
---|
| 1177 | + qtnf_hwcap_is_set(hw_info, QLINK_HW_CAPAB_DFS_OFFLOAD)) |
---|
1099 | 1178 | wiphy_ext_feature_set(wiphy, NL80211_EXT_FEATURE_DFS_OFFLOAD); |
---|
| 1179 | + |
---|
| 1180 | + if (qtnf_hwcap_is_set(hw_info, QLINK_HW_CAPAB_SCAN_DWELL)) |
---|
| 1181 | + wiphy_ext_feature_set(wiphy, |
---|
| 1182 | + NL80211_EXT_FEATURE_SET_SCAN_DWELL); |
---|
1100 | 1183 | |
---|
1101 | 1184 | wiphy->probe_resp_offload = NL80211_PROBE_RESP_OFFLOAD_SUPPORT_WPS | |
---|
1102 | 1185 | NL80211_PROBE_RESP_OFFLOAD_SUPPORT_WPS2; |
---|
.. | .. |
---|
1110 | 1193 | |
---|
1111 | 1194 | ether_addr_copy(wiphy->perm_addr, mac->macaddr); |
---|
1112 | 1195 | |
---|
1113 | | - if (hw_info->hw_capab & QLINK_HW_CAPAB_STA_INACT_TIMEOUT) |
---|
| 1196 | + if (qtnf_hwcap_is_set(hw_info, QLINK_HW_CAPAB_STA_INACT_TIMEOUT)) |
---|
1114 | 1197 | wiphy->features |= NL80211_FEATURE_INACTIVITY_TIMER; |
---|
1115 | 1198 | |
---|
1116 | | - if (hw_info->hw_capab & QLINK_HW_CAPAB_SCAN_RANDOM_MAC_ADDR) |
---|
| 1199 | + if (qtnf_hwcap_is_set(hw_info, QLINK_HW_CAPAB_SCAN_RANDOM_MAC_ADDR)) |
---|
1117 | 1200 | wiphy->features |= NL80211_FEATURE_SCAN_RANDOM_MAC_ADDR; |
---|
1118 | 1201 | |
---|
1119 | | - if (!(hw_info->hw_capab & QLINK_HW_CAPAB_OBSS_SCAN)) |
---|
| 1202 | + if (!qtnf_hwcap_is_set(hw_info, QLINK_HW_CAPAB_OBSS_SCAN)) |
---|
1120 | 1203 | wiphy->features |= NL80211_FEATURE_NEED_OBSS_SCAN; |
---|
| 1204 | + |
---|
| 1205 | + if (qtnf_hwcap_is_set(hw_info, QLINK_HW_CAPAB_SAE)) |
---|
| 1206 | + wiphy->features |= NL80211_FEATURE_SAE; |
---|
1121 | 1207 | |
---|
1122 | 1208 | #ifdef CONFIG_PM |
---|
1123 | 1209 | if (macinfo->wowlan) |
---|
1124 | 1210 | wiphy->wowlan = macinfo->wowlan; |
---|
1125 | 1211 | #endif |
---|
1126 | 1212 | |
---|
1127 | | - if (hw_info->hw_capab & QLINK_HW_CAPAB_REG_UPDATE) { |
---|
1128 | | - wiphy->regulatory_flags |= REGULATORY_STRICT_REG | |
---|
1129 | | - REGULATORY_CUSTOM_REG; |
---|
| 1213 | + regdomain_is_known = isalpha(mac->rd->alpha2[0]) && |
---|
| 1214 | + isalpha(mac->rd->alpha2[1]); |
---|
| 1215 | + |
---|
| 1216 | + if (qtnf_hwcap_is_set(hw_info, QLINK_HW_CAPAB_REG_UPDATE)) { |
---|
1130 | 1217 | wiphy->reg_notifier = qtnf_cfg80211_reg_notifier; |
---|
1131 | | - wiphy_apply_custom_regulatory(wiphy, hw_info->rd); |
---|
| 1218 | + |
---|
| 1219 | + if (mac->rd->alpha2[0] == '9' && mac->rd->alpha2[1] == '9') { |
---|
| 1220 | + wiphy->regulatory_flags |= REGULATORY_CUSTOM_REG | |
---|
| 1221 | + REGULATORY_STRICT_REG; |
---|
| 1222 | + wiphy_apply_custom_regulatory(wiphy, mac->rd); |
---|
| 1223 | + } else if (regdomain_is_known) { |
---|
| 1224 | + wiphy->regulatory_flags |= REGULATORY_STRICT_REG; |
---|
| 1225 | + } |
---|
1132 | 1226 | } else { |
---|
1133 | 1227 | wiphy->regulatory_flags |= REGULATORY_WIPHY_SELF_MANAGED; |
---|
1134 | 1228 | } |
---|
.. | .. |
---|
1151 | 1245 | goto out; |
---|
1152 | 1246 | |
---|
1153 | 1247 | if (wiphy->regulatory_flags & REGULATORY_WIPHY_SELF_MANAGED) |
---|
1154 | | - ret = regulatory_set_wiphy_regd(wiphy, hw_info->rd); |
---|
1155 | | - else if (isalpha(hw_info->rd->alpha2[0]) && |
---|
1156 | | - isalpha(hw_info->rd->alpha2[1])) |
---|
1157 | | - ret = regulatory_hint(wiphy, hw_info->rd->alpha2); |
---|
| 1248 | + ret = regulatory_set_wiphy_regd(wiphy, mac->rd); |
---|
| 1249 | + else if (regdomain_is_known) |
---|
| 1250 | + ret = regulatory_hint(wiphy, mac->rd->alpha2); |
---|
1158 | 1251 | |
---|
1159 | 1252 | out: |
---|
1160 | 1253 | return ret; |
---|
.. | .. |
---|
1165 | 1258 | struct qtnf_vif *vif = qtnf_netdev_get_priv(ndev); |
---|
1166 | 1259 | |
---|
1167 | 1260 | if (qtnf_cmd_send_updown_intf(vif, up)) |
---|
1168 | | - pr_err("failed to send up/down command to FW\n"); |
---|
| 1261 | + pr_err("failed to send %s command to VIF%u.%u\n", |
---|
| 1262 | + up ? "UP" : "DOWN", vif->mac->macid, vif->vifid); |
---|
1169 | 1263 | } |
---|
1170 | 1264 | |
---|
1171 | 1265 | void qtnf_virtual_intf_cleanup(struct net_device *ndev) |
---|
.. | .. |
---|
1173 | 1267 | struct qtnf_vif *vif = qtnf_netdev_get_priv(ndev); |
---|
1174 | 1268 | struct qtnf_wmac *mac = wiphy_priv(vif->wdev.wiphy); |
---|
1175 | 1269 | |
---|
1176 | | - if (vif->wdev.iftype == NL80211_IFTYPE_STATION) { |
---|
1177 | | - switch (vif->sta_state) { |
---|
1178 | | - case QTNF_STA_DISCONNECTED: |
---|
1179 | | - break; |
---|
1180 | | - case QTNF_STA_CONNECTING: |
---|
1181 | | - cfg80211_connect_result(vif->netdev, |
---|
1182 | | - vif->bssid, NULL, 0, |
---|
1183 | | - NULL, 0, |
---|
1184 | | - WLAN_STATUS_UNSPECIFIED_FAILURE, |
---|
1185 | | - GFP_KERNEL); |
---|
1186 | | - qtnf_disconnect(vif->wdev.wiphy, ndev, |
---|
1187 | | - WLAN_REASON_DEAUTH_LEAVING); |
---|
1188 | | - break; |
---|
1189 | | - case QTNF_STA_CONNECTED: |
---|
1190 | | - cfg80211_disconnected(vif->netdev, |
---|
1191 | | - WLAN_REASON_DEAUTH_LEAVING, |
---|
1192 | | - NULL, 0, 1, GFP_KERNEL); |
---|
1193 | | - qtnf_disconnect(vif->wdev.wiphy, ndev, |
---|
1194 | | - WLAN_REASON_DEAUTH_LEAVING); |
---|
1195 | | - break; |
---|
1196 | | - } |
---|
1197 | | - |
---|
1198 | | - vif->sta_state = QTNF_STA_DISCONNECTED; |
---|
1199 | | - } |
---|
| 1270 | + if (vif->wdev.iftype == NL80211_IFTYPE_STATION) |
---|
| 1271 | + qtnf_disconnect(vif->wdev.wiphy, ndev, |
---|
| 1272 | + WLAN_REASON_DEAUTH_LEAVING); |
---|
1200 | 1273 | |
---|
1201 | 1274 | qtnf_scan_done(mac, true); |
---|
1202 | 1275 | } |
---|
1203 | 1276 | |
---|
1204 | 1277 | void qtnf_cfg80211_vif_reset(struct qtnf_vif *vif) |
---|
1205 | 1278 | { |
---|
1206 | | - if (vif->wdev.iftype == NL80211_IFTYPE_STATION) { |
---|
1207 | | - switch (vif->sta_state) { |
---|
1208 | | - case QTNF_STA_CONNECTING: |
---|
1209 | | - cfg80211_connect_result(vif->netdev, |
---|
1210 | | - vif->bssid, NULL, 0, |
---|
1211 | | - NULL, 0, |
---|
1212 | | - WLAN_STATUS_UNSPECIFIED_FAILURE, |
---|
1213 | | - GFP_KERNEL); |
---|
1214 | | - break; |
---|
1215 | | - case QTNF_STA_CONNECTED: |
---|
1216 | | - cfg80211_disconnected(vif->netdev, |
---|
1217 | | - WLAN_REASON_DEAUTH_LEAVING, |
---|
1218 | | - NULL, 0, 1, GFP_KERNEL); |
---|
1219 | | - break; |
---|
1220 | | - case QTNF_STA_DISCONNECTED: |
---|
1221 | | - break; |
---|
1222 | | - } |
---|
1223 | | - } |
---|
| 1279 | + if (vif->wdev.iftype == NL80211_IFTYPE_STATION) |
---|
| 1280 | + cfg80211_disconnected(vif->netdev, WLAN_REASON_DEAUTH_LEAVING, |
---|
| 1281 | + NULL, 0, 1, GFP_KERNEL); |
---|
1224 | 1282 | |
---|
1225 | 1283 | cfg80211_shutdown_all_interfaces(vif->wdev.wiphy); |
---|
1226 | | - vif->sta_state = QTNF_STA_DISCONNECTED; |
---|
1227 | 1284 | } |
---|
1228 | 1285 | |
---|
1229 | 1286 | void qtnf_band_init_rates(struct ieee80211_supported_band *band) |
---|