// SPDX-License-Identifier: GPL-2.0 OR BSD-3-Clause
/*
- * Copyright (C) 2024 Intel Corporation
+ * Copyright (C) 2024, 2026 Intel Corporation
*/
#include "key.h"
#include "iface.h"
struct ieee80211_sta *sta,
struct ieee80211_key_conf *key)
{
- struct iwl_mld_vif *mld_vif = iwl_mld_vif_from_mac80211(vif);
bool pairwise = key->flags & IEEE80211_KEY_FLAG_PAIRWISE;
bool igtk = key->keyidx == 4 || key->keyidx == 5;
u32 flags = 0;
break;
}
- if (!sta && vif->type == NL80211_IFTYPE_STATION)
- sta = mld_vif->ap_sta;
-
/* If we are installing an iGTK (in AP or STA mode), we need to tell
* the firmware this key will en/decrypt MGMT frames.
* Same goes if we are installing a pairwise key for an MFP station.
return BIT(link->mcast_sta.sta_id);
}
- /* for client mode use the AP STA also for group keys */
- if (!sta && vif->type == NL80211_IFTYPE_STATION)
- sta = mld_vif->ap_sta;
-
- /* STA should be non-NULL now */
+ /* STA should be non-NULL */
if (WARN_ON(!sta))
return 0;
struct ieee80211_sta *sta,
struct ieee80211_key_conf *key)
{
+ struct iwl_mld_vif *mld_vif = iwl_mld_vif_from_mac80211(vif);
struct iwl_mld *mld = IWL_MAC80211_GET_MLD(hw);
int ret;
+ /*
+ * FW always needs the AP STA for client mode.
+ * Note that during removal this could already
+ * be NULL (mac80211 removes keys after STAs)
+ * but then we'll already have removed the key
+ * and set hw_key_idx = STA_KEY_IDX_INVALID.
+ */
+ if (!sta && vif->type == NL80211_IFTYPE_STATION)
+ sta = mld_vif->ap_sta;
+
switch (cmd) {
case SET_KEY:
ret = iwl_mld_set_key_add(mld, vif, sta, key);