Commit 5d2dbccc authored by Alexis Lothoré's avatar Alexis Lothoré Committed by Kalle Valo
Browse files

wifi: wilc1000: split deeply nested RCU list traversal in dedicated helper



Move netif_wake_queue and its surrounding RCU operations in a dedicated
function to clarify wilc_txq_task and ease refactoring

Signed-off-by: default avatarAlexis Lothoré <alexis.lothore@bootlin.com>
Signed-off-by: default avatarKalle Valo <kvalo@kernel.org>
Link: https://msgid.link/20240215-wilc_fix_rcu_usage-v1-1-f610e46c6f82@bootlin.com
parent 03830bb9
Loading
Loading
Loading
Loading
+14 −11
Original line number Diff line number Diff line
@@ -140,6 +140,19 @@ int wilc_wlan_get_num_conn_ifcs(struct wilc *wilc)
	return ret_val;
}

static void wilc_wake_tx_queues(struct wilc *wl)
{
	int srcu_idx;
	struct wilc_vif *ifc;

	srcu_idx = srcu_read_lock(&wl->srcu);
	list_for_each_entry_rcu(ifc, &wl->vif_list, list) {
		if (ifc->mac_opened && netif_queue_stopped(ifc->ndev))
			netif_wake_queue(ifc->ndev);
	}
	srcu_read_unlock(&wl->srcu, srcu_idx);
}

static int wilc_txq_task(void *vp)
{
	int ret;
@@ -160,17 +173,7 @@ static int wilc_txq_task(void *vp)
		do {
			ret = wilc_wlan_handle_txq(wl, &txq_count);
			if (txq_count < FLOW_CONTROL_LOWER_THRESHOLD) {
				int srcu_idx;
				struct wilc_vif *ifc;

				srcu_idx = srcu_read_lock(&wl->srcu);
				list_for_each_entry_rcu(ifc, &wl->vif_list,
							list) {
					if (ifc->mac_opened &&
					    netif_queue_stopped(ifc->ndev))
						netif_wake_queue(ifc->ndev);
				}
				srcu_read_unlock(&wl->srcu, srcu_idx);
				wilc_wake_tx_queues(wl);
			}
			if (ret != WILC_VMM_ENTRY_FULL_RETRY)
				break;