Lines Matching full:mac
42 struct qtnf_wmac *mac = NULL; in qtnf_core_get_mac() local
45 pr_err("invalid MAC index %u\n", macid); in qtnf_core_get_mac()
50 mac = bus->mac[macid]; in qtnf_core_get_mac()
52 if (unlikely(!mac)) { in qtnf_core_get_mac()
53 pr_err("MAC%u: not initialized\n", macid); in qtnf_core_get_mac()
57 return mac; in qtnf_core_get_mac()
84 queue_work(vif->mac->bus->hprio_workqueue, &vif->high_pri_tx_work); in qtnf_packet_send_hi_pri()
93 struct qtnf_wmac *mac; in qtnf_netdev_hard_start_xmit() local
109 mac = vif->mac; in qtnf_netdev_hard_start_xmit()
110 if (unlikely(!mac)) { in qtnf_netdev_hard_start_xmit()
111 pr_err_ratelimited("%s: NULL mac pointer", ndev->name); in qtnf_netdev_hard_start_xmit()
133 return qtnf_bus_data_tx(mac->bus, skb, mac->macid, vif->vifid); in qtnf_netdev_hard_start_xmit()
141 struct qtnf_wmac *mac; in qtnf_netdev_tx_timeout() local
144 if (unlikely(!vif || !vif->mac || !vif->mac->bus)) in qtnf_netdev_tx_timeout()
147 mac = vif->mac; in qtnf_netdev_tx_timeout()
148 bus = mac->bus; in qtnf_netdev_tx_timeout()
150 pr_warn("VIF%u.%u: Tx timeout- %lu\n", mac->macid, vif->vifid, jiffies); in qtnf_netdev_tx_timeout()
175 qtnf_scan_done(vif->mac, true); in qtnf_netdev_set_mac_address()
191 const struct qtnf_bus *bus = vif->mac->bus; in qtnf_netdev_port_parent_id()
210 struct qtnf_wmac *mac, in qtnf_mac_init_single_band() argument
221 ret = qtnf_cmd_band_info_get(mac, wiphy->bands[band]); in qtnf_mac_init_single_band()
223 pr_err("MAC%u: band %u: failed to get chans info: %d\n", in qtnf_mac_init_single_band()
224 mac->macid, band, ret); in qtnf_mac_init_single_band()
233 static int qtnf_mac_init_bands(struct qtnf_wmac *mac) in qtnf_mac_init_bands() argument
235 struct wiphy *wiphy = priv_to_wiphy(mac); in qtnf_mac_init_bands()
238 if (mac->macinfo.bands_cap & QLINK_BAND_2GHZ) { in qtnf_mac_init_bands()
239 ret = qtnf_mac_init_single_band(wiphy, mac, NL80211_BAND_2GHZ); in qtnf_mac_init_bands()
244 if (mac->macinfo.bands_cap & QLINK_BAND_5GHZ) { in qtnf_mac_init_bands()
245 ret = qtnf_mac_init_single_band(wiphy, mac, NL80211_BAND_5GHZ); in qtnf_mac_init_bands()
250 if (mac->macinfo.bands_cap & QLINK_BAND_60GHZ) in qtnf_mac_init_bands()
251 ret = qtnf_mac_init_single_band(wiphy, mac, NL80211_BAND_60GHZ); in qtnf_mac_init_bands()
257 struct qtnf_vif *qtnf_mac_get_free_vif(struct qtnf_wmac *mac) in qtnf_mac_get_free_vif() argument
263 vif = &mac->iflist[i]; in qtnf_mac_get_free_vif()
271 struct qtnf_vif *qtnf_mac_get_base_vif(struct qtnf_wmac *mac) in qtnf_mac_get_base_vif() argument
275 vif = &mac->iflist[QTNF_PRIMARY_VIF_IDX]; in qtnf_mac_get_base_vif()
283 void qtnf_mac_iface_comb_free(struct qtnf_wmac *mac) in qtnf_mac_iface_comb_free() argument
288 if (mac->macinfo.if_comb) { in qtnf_mac_iface_comb_free()
289 for (i = 0; i < mac->macinfo.n_if_comb; i++) { in qtnf_mac_iface_comb_free()
290 comb = &mac->macinfo.if_comb[i]; in qtnf_mac_iface_comb_free()
295 kfree(mac->macinfo.if_comb); in qtnf_mac_iface_comb_free()
296 mac->macinfo.if_comb = NULL; in qtnf_mac_iface_comb_free()
300 void qtnf_mac_ext_caps_free(struct qtnf_wmac *mac) in qtnf_mac_ext_caps_free() argument
302 if (mac->macinfo.extended_capabilities_len) { in qtnf_mac_ext_caps_free()
303 kfree(mac->macinfo.extended_capabilities); in qtnf_mac_ext_caps_free()
304 mac->macinfo.extended_capabilities = NULL; in qtnf_mac_ext_caps_free()
306 kfree(mac->macinfo.extended_capabilities_mask); in qtnf_mac_ext_caps_free()
307 mac->macinfo.extended_capabilities_mask = NULL; in qtnf_mac_ext_caps_free()
309 mac->macinfo.extended_capabilities_len = 0; in qtnf_mac_ext_caps_free()
334 static void qtnf_mac_init_primary_intf(struct qtnf_wmac *mac) in qtnf_mac_init_primary_intf() argument
336 struct qtnf_vif *vif = &mac->iflist[QTNF_PRIMARY_VIF_IDX]; in qtnf_mac_init_primary_intf()
340 vif->wdev.wiphy = priv_to_wiphy(mac); in qtnf_mac_init_primary_intf()
345 static void qtnf_mac_scan_finish(struct qtnf_wmac *mac, bool aborted) in qtnf_mac_scan_finish() argument
351 mutex_lock(&mac->mac_lock); in qtnf_mac_scan_finish()
353 if (mac->scan_req) { in qtnf_mac_scan_finish()
354 cfg80211_scan_done(mac->scan_req, &info); in qtnf_mac_scan_finish()
355 mac->scan_req = NULL; in qtnf_mac_scan_finish()
358 mutex_unlock(&mac->mac_lock); in qtnf_mac_scan_finish()
361 void qtnf_scan_done(struct qtnf_wmac *mac, bool aborted) in qtnf_scan_done() argument
363 cancel_delayed_work_sync(&mac->scan_timeout); in qtnf_scan_done()
364 qtnf_mac_scan_finish(mac, aborted); in qtnf_scan_done()
369 struct qtnf_wmac *mac = in qtnf_mac_scan_timeout() local
372 pr_warn("MAC%d: scan timed out\n", mac->macid); in qtnf_mac_scan_timeout()
373 qtnf_mac_scan_finish(mac, true); in qtnf_mac_scan_timeout()
397 struct qtnf_wmac *mac; in qtnf_core_mac_alloc() local
417 mac = wiphy_priv(wiphy); in qtnf_core_mac_alloc()
419 mac->macid = macid; in qtnf_core_mac_alloc()
420 mac->pdev = pdev; in qtnf_core_mac_alloc()
421 mac->bus = bus; in qtnf_core_mac_alloc()
422 mutex_init(&mac->mac_lock); in qtnf_core_mac_alloc()
423 INIT_DELAYED_WORK(&mac->scan_timeout, qtnf_mac_scan_timeout); in qtnf_core_mac_alloc()
426 vif = &mac->iflist[i]; in qtnf_core_mac_alloc()
430 vif->mac = mac; in qtnf_core_mac_alloc()
437 qtnf_mac_init_primary_intf(mac); in qtnf_core_mac_alloc()
438 bus->mac[macid] = mac; in qtnf_core_mac_alloc()
440 return mac; in qtnf_core_mac_alloc()
447 int qtnf_core_net_attach(struct qtnf_wmac *mac, struct qtnf_vif *vif, in qtnf_core_net_attach() argument
450 struct wiphy *wiphy = priv_to_wiphy(mac); in qtnf_core_net_attach()
473 if (qtnf_hwcap_is_set(&mac->bus->hw_info, QLINK_HW_CAPAB_HW_BRIDGE)) in qtnf_core_net_attach()
492 struct qtnf_wmac *mac; in qtnf_core_mac_detach() local
498 mac = bus->mac[macid]; in qtnf_core_mac_detach()
500 if (!mac) in qtnf_core_mac_detach()
503 wiphy = priv_to_wiphy(mac); in qtnf_core_mac_detach()
506 vif = &mac->iflist[i]; in qtnf_core_mac_detach()
517 if (mac->wiphy_registered) in qtnf_core_mac_detach()
534 platform_device_unregister(mac->pdev); in qtnf_core_mac_detach()
535 qtnf_mac_iface_comb_free(mac); in qtnf_core_mac_detach()
536 qtnf_mac_ext_caps_free(mac); in qtnf_core_mac_detach()
537 kfree(mac->macinfo.wowlan); in qtnf_core_mac_detach()
538 kfree(mac->rd); in qtnf_core_mac_detach()
539 mac->rd = NULL; in qtnf_core_mac_detach()
541 bus->mac[macid] = NULL; in qtnf_core_mac_detach()
546 struct qtnf_wmac *mac; in qtnf_core_mac_attach() local
551 pr_info("MAC%u is not active in FW\n", macid); in qtnf_core_mac_attach()
555 mac = qtnf_core_mac_alloc(bus, macid); in qtnf_core_mac_attach()
556 if (IS_ERR(mac)) { in qtnf_core_mac_attach()
557 pr_err("MAC%u allocation failed\n", macid); in qtnf_core_mac_attach()
558 return PTR_ERR(mac); in qtnf_core_mac_attach()
561 vif = qtnf_mac_get_base_vif(mac); in qtnf_core_mac_attach()
563 pr_err("MAC%u: primary VIF is not ready\n", macid); in qtnf_core_mac_attach()
571 pr_err("MAC%u: failed to add VIF\n", macid); in qtnf_core_mac_attach()
575 ret = qtnf_cmd_get_mac_info(mac); in qtnf_core_mac_attach()
577 pr_err("MAC%u: failed to get MAC info\n", macid); in qtnf_core_mac_attach()
581 /* Use MAC address of the first active radio as a unique device ID */ in qtnf_core_mac_attach()
582 if (is_zero_ether_addr(mac->bus->hw_id)) in qtnf_core_mac_attach()
583 ether_addr_copy(mac->bus->hw_id, mac->macaddr); in qtnf_core_mac_attach()
585 ret = qtnf_mac_init_bands(mac); in qtnf_core_mac_attach()
587 pr_err("MAC%u: failed to init bands\n", macid); in qtnf_core_mac_attach()
591 ret = qtnf_wiphy_register(&bus->hw_info, mac); in qtnf_core_mac_attach()
593 pr_err("MAC%u: wiphy registration failed\n", macid); in qtnf_core_mac_attach()
597 mac->wiphy_registered = 1; in qtnf_core_mac_attach()
600 wiphy_lock(priv_to_wiphy(mac)); in qtnf_core_mac_attach()
601 ret = qtnf_core_net_attach(mac, vif, "wlan%d", NET_NAME_ENUM); in qtnf_core_mac_attach()
602 wiphy_unlock(priv_to_wiphy(mac)); in qtnf_core_mac_attach()
606 pr_err("MAC%u: failed to attach netdev\n", macid); in qtnf_core_mac_attach()
616 pr_debug("MAC%u initialized\n", macid); in qtnf_core_mac_attach()
665 bus = vif->mac->bus; in qtnf_core_netdevice_event()
676 vif->mac->macid, vif->vifid, netdev_name(brdev), in qtnf_core_netdevice_event()
763 pr_err("MAC%u: attach failed: %d\n", i, ret); in qtnf_core_attach()
823 struct qtnf_wmac *mac; in qtnf_classify_skb() local
839 pr_err_ratelimited("invalid mac(%u)\n", meta->macid); in qtnf_classify_skb()
848 mac = bus->mac[meta->macid]; in qtnf_classify_skb()
850 if (unlikely(!mac)) { in qtnf_classify_skb()
851 pr_err_ratelimited("mac(%d) does not exist\n", meta->macid); in qtnf_classify_skb()
855 vif = &mac->iflist[meta->ifidx]; in qtnf_classify_skb()
882 struct qtnf_wmac *mac; in qtnf_wake_all_queues() local
887 if (unlikely(!vif || !vif->mac || !vif->mac->bus)) in qtnf_wake_all_queues()
890 bus = vif->mac->bus; in qtnf_wake_all_queues()
896 mac = bus->mac[macid]; in qtnf_wake_all_queues()
898 vif = &mac->iflist[i]; in qtnf_wake_all_queues()