wifi: wil6210: use pre-assigned cookie for remain_on_channel, mgmt_tx and probe_peer

Stop overwriting the pre-assigned cookie in wil_p2p_listen(),
wil_cfg80211_mgmt_tx(), and wil_cfg80211_probe_peer().

For remain_on_channel, store the pre-assigned cookie in p2p->cookie
instead of incrementing it. All cancel and expiry callbacks already
read from p2p->cookie so they pick up the correct value.

For mgmt_tx, remove the defensive "cookie ? *cookie : 0" guard;
cfg80211 guarantees a non-NULL cookie pointer.

For probe_peer, store the pre-assigned cookie in req->cookie instead
of the CID value. The CID is still available via req->cid for STA
lookup in wil_probe_client_handle().

Assisted-by: Claude:claude-sonnet-4-6
Signed-off-by: Arend van Spriel <arend.vanspriel@broadcom.com>
Link: https://patch.msgid.link/20260731123509.1975281-5-arend.vanspriel@broadcom.com
Signed-off-by: Johannes Berg <johannes.berg@intel.com>
This commit is contained in:
Arend van Spriel
2026-07-31 14:35:00 +02:00
committed by Johannes Berg
parent 5c4b13cb50
commit 70557cadc8
2 changed files with 3 additions and 5 deletions

View File

@@ -1488,8 +1488,7 @@ int wil_cfg80211_mgmt_tx(struct wiphy *wiphy, struct wireless_dev *wdev,
*/
tx_status = (rc == 0);
rc = (rc == -EAGAIN) ? 0 : rc;
cfg80211_mgmt_tx_status(wdev, cookie ? *cookie : 0, buf, len,
tx_status, GFP_KERNEL);
cfg80211_mgmt_tx_status(wdev, *cookie, buf, len, tx_status, GFP_KERNEL);
return rc;
}
@@ -2399,13 +2398,12 @@ static int wil_cfg80211_probe_peer(struct wiphy *wiphy,
return -ENOMEM;
req->cid = cid;
req->cookie = cid;
req->cookie = *cookie;
mutex_lock(&vif->probe_client_mutex);
list_add_tail(&req->list, &vif->probe_client_pending);
mutex_unlock(&vif->probe_client_mutex);
*cookie = req->cookie;
queue_work(wil->wq_service, &vif->probe_client_worker);
return 0;
}

View File

@@ -144,7 +144,7 @@ int wil_p2p_listen(struct wil6210_priv *wil, struct wireless_dev *wdev,
}
memcpy(&p2p->listen_chan, chan, sizeof(*chan));
*cookie = ++p2p->cookie;
p2p->cookie = *cookie;
p2p->listen_duration = duration;
mutex_lock(&wil->vif_mutex);