wifi: wilc1000: use pre-assigned cookie for remain_on_channel and mgmt_tx

Stop generating cookies by incrementing inc_roc_cookie in
remain_on_channel() and via get_random_u32() in mgmt_tx(). Use the
pre-assigned cookie from cfg80211 instead. Remove the now-unused id
local variable from remain_on_channel().

Assisted-by: Claude:claude-sonnet-4-6
Signed-off-by: Arend van Spriel <arend.vanspriel@broadcom.com>
Link: https://patch.msgid.link/20260731123509.1975281-8-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:03 +02:00
committed by Johannes Berg
parent 63d42f1729
commit cdda9756ee

View File

@@ -1106,18 +1106,13 @@ static int remain_on_channel(struct wiphy *wiphy,
int ret = 0;
struct wilc_vif *vif = netdev_priv(wdev->netdev);
struct wilc_priv *priv = &vif->priv;
u64 id;
if (wdev->iftype == NL80211_IFTYPE_AP) {
netdev_dbg(vif->ndev, "Required while in AP mode\n");
return ret;
}
id = ++priv->inc_roc_cookie;
if (id == 0)
id = ++priv->inc_roc_cookie;
ret = wilc_remain_on_channel(vif, id, chan->hw_value,
ret = wilc_remain_on_channel(vif, *cookie, chan->hw_value,
wilc_wfi_remain_on_channel_expired);
if (ret)
return ret;
@@ -1125,8 +1120,7 @@ static int remain_on_channel(struct wiphy *wiphy,
vif->wilc->op_ch = chan->hw_value;
priv->remain_on_ch_params.listen_ch = chan;
priv->remain_on_ch_params.listen_cookie = id;
*cookie = id;
priv->remain_on_ch_params.listen_cookie = *cookie;
priv->p2p_listen_state = true;
priv->remain_on_ch_params.listen_duration = duration;
@@ -1170,7 +1164,6 @@ static int mgmt_tx(struct wiphy *wiphy,
const u8 *vendor_ie;
int ret = 0;
*cookie = get_random_u32();
priv->tx_cookie = *cookie;
mgmt = (const struct ieee80211_mgmt *)buf;