Lines Matching refs:wil

12 bool wil_has_other_active_ifaces(struct wil6210_priv *wil,  in wil_has_other_active_ifaces()  argument
19 for (i = 0; i < GET_MAX_VIFS(wil); i++) { in wil_has_other_active_ifaces()
20 vif = wil->vifs[i]; in wil_has_other_active_ifaces()
33 bool wil_has_active_ifaces(struct wil6210_priv *wil, bool up, bool ok) in wil_has_active_ifaces() argument
36 return wil_has_other_active_ifaces(wil, NULL, up, ok); in wil_has_active_ifaces()
41 struct wil6210_priv *wil = ndev_to_wil(ndev); in wil_open() local
44 wil_dbg_misc(wil, "open\n"); in wil_open()
47 test_bit(WMI_FW_CAPABILITY_WMI_ONLY, wil->fw_capabilities)) { in wil_open()
48 wil_err(wil, "while in debug_fw or wmi_only mode\n"); in wil_open()
52 if (!wil_has_other_active_ifaces(wil, ndev, true, false)) { in wil_open()
53 wil_dbg_misc(wil, "open, first iface\n"); in wil_open()
54 rc = wil_pm_runtime_get(wil); in wil_open()
58 rc = wil_up(wil); in wil_open()
60 wil_pm_runtime_put(wil); in wil_open()
68 struct wil6210_priv *wil = ndev_to_wil(ndev); in wil_stop() local
71 wil_dbg_misc(wil, "stop\n"); in wil_stop()
73 if (!wil_has_other_active_ifaces(wil, ndev, true, false)) { in wil_stop()
74 wil_dbg_misc(wil, "stop, last iface\n"); in wil_stop()
75 rc = wil_down(wil); in wil_stop()
77 wil_pm_runtime_put(wil); in wil_stop()
93 struct wil6210_priv *wil = container_of(napi, struct wil6210_priv, in wil6210_netdev_poll_rx() local
98 wil_rx_handle(wil, &quota); in wil6210_netdev_poll_rx()
103 wil6210_unmask_irq_rx(wil); in wil6210_netdev_poll_rx()
104 wil_dbg_txrx(wil, "NAPI RX complete\n"); in wil6210_netdev_poll_rx()
107 wil_dbg_txrx(wil, "NAPI RX poll(%d) done %d\n", budget, done); in wil6210_netdev_poll_rx()
114 struct wil6210_priv *wil = container_of(napi, struct wil6210_priv, in wil6210_netdev_poll_rx_edma() local
119 wil_rx_handle_edma(wil, &quota); in wil6210_netdev_poll_rx_edma()
124 wil6210_unmask_irq_rx_edma(wil); in wil6210_netdev_poll_rx_edma()
125 wil_dbg_txrx(wil, "NAPI RX complete\n"); in wil6210_netdev_poll_rx_edma()
128 wil_dbg_txrx(wil, "NAPI RX poll(%d) done %d\n", budget, done); in wil6210_netdev_poll_rx_edma()
135 struct wil6210_priv *wil = container_of(napi, struct wil6210_priv, in wil6210_netdev_poll_tx() local
142 struct wil_ring *ring = &wil->ring_tx[i]; in wil6210_netdev_poll_tx()
143 struct wil_ring_tx_data *txdata = &wil->ring_tx_data[i]; in wil6210_netdev_poll_tx()
147 txdata->mid >= GET_MAX_VIFS(wil)) in wil6210_netdev_poll_tx()
150 vif = wil->vifs[txdata->mid]; in wil6210_netdev_poll_tx()
152 wil_dbg_txrx(wil, "Invalid MID %d\n", txdata->mid); in wil6210_netdev_poll_tx()
161 wil6210_unmask_irq_tx(wil); in wil6210_netdev_poll_tx()
162 wil_dbg_txrx(wil, "NAPI TX complete\n"); in wil6210_netdev_poll_tx()
165 wil_dbg_txrx(wil, "NAPI TX poll(%d) done %d\n", budget, tx_done); in wil6210_netdev_poll_tx()
172 struct wil6210_priv *wil = container_of(napi, struct wil6210_priv, in wil6210_netdev_poll_tx_edma() local
176 struct wil_status_ring *sring = &wil->srings[wil->tx_sring_idx]; in wil6210_netdev_poll_tx_edma()
181 tx_done = wil_tx_sring_handler(wil, sring); in wil6210_netdev_poll_tx_edma()
185 wil6210_unmask_irq_tx_edma(wil); in wil6210_netdev_poll_tx_edma()
186 wil_dbg_txrx(wil, "NAPI TX complete\n"); in wil6210_netdev_poll_tx_edma()
189 wil_dbg_txrx(wil, "NAPI TX poll(%d) done %d\n", budget, tx_done); in wil6210_netdev_poll_tx_edma()
231 struct wil6210_priv *wil = vif_to_wil(vif); in wil_connect_timer_fn() local
234 wil_err(wil, "Connect timeout detected, disconnect station\n"); in wil_connect_timer_fn()
240 q = queue_work(wil->wmi_wq, &vif->disconnect_worker); in wil_connect_timer_fn()
241 wil_dbg_wmi(wil, "queue_work of disconnect_worker -> %d\n", q); in wil_connect_timer_fn()
247 struct wil6210_priv *wil = vif_to_wil(vif); in wil_scan_timer_fn() local
249 clear_bit(wil_status_fwready, wil->status); in wil_scan_timer_fn()
250 wil_err(wil, "Scan timeout detected, start fw error recovery\n"); in wil_scan_timer_fn()
251 wil_fw_error_recovery(wil); in wil_scan_timer_fn()
257 struct wil6210_priv *wil = vif_to_wil(vif); in wil_p2p_discovery_timer_fn() local
259 wil_dbg_misc(wil, "p2p_discovery_timer_fn\n"); in wil_p2p_discovery_timer_fn()
285 static u8 wil_vif_find_free_mid(struct wil6210_priv *wil) in wil_vif_find_free_mid() argument
289 for (i = 0; i < GET_MAX_VIFS(wil); i++) { in wil_vif_find_free_mid()
290 if (!wil->vifs[i]) in wil_vif_find_free_mid()
298 wil_vif_alloc(struct wil6210_priv *wil, const char *name, in wil_vif_alloc() argument
306 mid = wil_vif_find_free_mid(wil); in wil_vif_alloc()
308 wil_err(wil, "no available virtual interface\n"); in wil_vif_alloc()
315 dev_err(wil_to_dev(wil), "alloc_netdev failed\n"); in wil_vif_alloc()
319 wil->main_ndev = ndev; in wil_vif_alloc()
327 vif->wil = wil; in wil_vif_alloc()
332 wdev->wiphy = wil->wiphy; in wil_vif_alloc()
350 struct wil6210_priv *wil; in wil_if_alloc() local
354 wil = wil_cfg80211_init(dev); in wil_if_alloc()
355 if (IS_ERR(wil)) { in wil_if_alloc()
357 return wil; in wil_if_alloc()
360 rc = wil_priv_init(wil); in wil_if_alloc()
366 wil_dbg_misc(wil, "if_alloc\n"); in wil_if_alloc()
368 vif = wil_vif_alloc(wil, "wlan%d", NET_NAME_UNKNOWN, in wil_if_alloc()
376 wil->radio_wdev = vif_to_wdev(vif); in wil_if_alloc()
378 return wil; in wil_if_alloc()
381 wil_priv_deinit(wil); in wil_if_alloc()
384 wil_cfg80211_deinit(wil); in wil_if_alloc()
389 void wil_if_free(struct wil6210_priv *wil) in wil_if_free() argument
391 struct net_device *ndev = wil->main_ndev; in wil_if_free()
393 wil_dbg_misc(wil, "if_free\n"); in wil_if_free()
398 wil_priv_deinit(wil); in wil_if_free()
400 wil->main_ndev = NULL; in wil_if_free()
404 wil_cfg80211_deinit(wil); in wil_if_free()
407 int wil_vif_add(struct wil6210_priv *wil, struct wil6210_vif *vif) in wil_vif_add() argument
411 bool any_active = wil_has_active_ifaces(wil, true, false); in wil_vif_add()
416 if (wil->vifs[vif->mid]) { in wil_vif_add()
422 rc = wmi_port_allocate(wil, vif->mid, ndev->dev_addr, in wil_vif_add()
431 wmi_port_delete(wil, vif->mid); in wil_vif_add()
435 wil->vifs[vif->mid] = vif; in wil_vif_add()
439 int wil_if_add(struct wil6210_priv *wil) in wil_if_add() argument
441 struct wiphy *wiphy = wil->wiphy; in wil_if_add()
442 struct net_device *ndev = wil->main_ndev; in wil_if_add()
446 wil_dbg_misc(wil, "entered"); in wil_if_add()
448 strscpy(wiphy->fw_version, wil->fw_version, sizeof(wiphy->fw_version)); in wil_if_add()
452 wil_err(wil, "failed to register wiphy, err %d\n", rc); in wil_if_add()
456 wil->napi_ndev = alloc_netdev_dummy(0); in wil_if_add()
457 if (!wil->napi_ndev) { in wil_if_add()
458 wil_err(wil, "failed to allocate dummy netdev"); in wil_if_add()
462 if (wil->use_enhanced_dma_hw) { in wil_if_add()
463 netif_napi_add(wil->napi_ndev, &wil->napi_rx, in wil_if_add()
465 netif_napi_add_tx(wil->napi_ndev, in wil_if_add()
466 &wil->napi_tx, wil6210_netdev_poll_tx_edma); in wil_if_add()
468 netif_napi_add(wil->napi_ndev, &wil->napi_rx, in wil_if_add()
470 netif_napi_add_tx(wil->napi_ndev, in wil_if_add()
471 &wil->napi_tx, wil6210_netdev_poll_tx); in wil_if_add()
474 wil_update_net_queues_bh(wil, vif, NULL, true); in wil_if_add()
478 rc = wil_vif_add(wil, vif); in wil_if_add()
487 free_netdev(wil->napi_ndev); in wil_if_add()
493 void wil_vif_remove(struct wil6210_priv *wil, u8 mid) in wil_vif_remove() argument
497 bool any_active = wil_has_active_ifaces(wil, true, false); in wil_vif_remove()
500 if (mid >= GET_MAX_VIFS(wil)) { in wil_vif_remove()
501 wil_err(wil, "invalid MID: %d\n", mid); in wil_vif_remove()
505 vif = wil->vifs[mid]; in wil_vif_remove()
507 wil_err(wil, "MID %d not registered\n", mid); in wil_vif_remove()
511 mutex_lock(&wil->mutex); in wil_vif_remove()
513 mutex_unlock(&wil->mutex); in wil_vif_remove()
522 wmi_port_delete(wil, vif->mid); in wil_vif_remove()
525 mutex_lock(&wil->vif_mutex); in wil_vif_remove()
526 wil->vifs[mid] = NULL; in wil_vif_remove()
529 if (test_bit(wil_status_napi_en, wil->status)) { in wil_vif_remove()
530 napi_synchronize(&wil->napi_rx); in wil_vif_remove()
531 napi_synchronize(&wil->napi_tx); in wil_vif_remove()
533 mutex_unlock(&wil->vif_mutex); in wil_vif_remove()
535 flush_work(&wil->wmi_event_worker); in wil_vif_remove()
547 void wil_if_remove(struct wil6210_priv *wil) in wil_if_remove() argument
549 struct net_device *ndev = wil->main_ndev; in wil_if_remove()
553 wil_dbg_misc(wil, "if_remove\n"); in wil_if_remove()
557 wil_vif_remove(wil, 0); in wil_if_remove()
561 netif_napi_del(&wil->napi_tx); in wil_if_remove()
562 netif_napi_del(&wil->napi_rx); in wil_if_remove()
564 free_netdev(wil->napi_ndev); in wil_if_remove()