wifi: iwlwifi: mld: iwl_mld_remove_link can't fail

iwl_mld_remove_link removes the link from both the FW and from the
driver.
If removing it from the FW failed, we assume that the FW is
dead anyway and remove it from the driver as well.
On the other hand, we still return an error value, indicating the caller
(i.e. mac80211) that the link couldn't be removed - while it was
actually removed.
Later, mac80211 might tell the driver again to remove that link,
and then the driver will warn that it doesn't exist.

Fix this by making iwl_mld_remove_link a void function.

Signed-off-by: Miri Korenblit <miriam.rachel.korenblit@intel.com>
Reviewed-by: Benjamin Berg <benjamin.berg@intel.com>
Reviewed-by: Emmanuel Grumbach <emmanuel.grumbach@intel.com>
Link: https://patch.msgid.link/20250313002008.16fe6ebae412.If5371ff7e096b7078ff9e98ff0e72010cd1f076d@changeid
Signed-off-by: Johannes Berg <johannes.berg@intel.com>
This commit is contained in:
Miri Korenblit
2025-03-13 00:22:36 +02:00
committed by Johannes Berg
parent bb307028a0
commit 5789f7913e
3 changed files with 12 additions and 20 deletions

View File

@@ -455,7 +455,7 @@ void iwl_mld_deactivate_link(struct iwl_mld *mld,
mld_link->fw_id);
}
static int
static void
iwl_mld_rm_link_from_fw(struct iwl_mld *mld, struct ieee80211_bss_conf *link)
{
struct iwl_mld_link *mld_link = iwl_mld_link_from_mac80211(link);
@@ -464,13 +464,13 @@ iwl_mld_rm_link_from_fw(struct iwl_mld *mld, struct ieee80211_bss_conf *link)
lockdep_assert_wiphy(mld->wiphy);
if (WARN_ON(!mld_link))
return -EINVAL;
return;
cmd.link_id = cpu_to_le32(mld_link->fw_id);
cmd.spec_link_id = link->link_id;
cmd.phy_id = cpu_to_le32(FW_CTXT_ID_INVALID);
return iwl_mld_send_link_cmd(mld, &cmd, FW_CTXT_ACTION_REMOVE);
iwl_mld_send_link_cmd(mld, &cmd, FW_CTXT_ACTION_REMOVE);
}
static void iwl_mld_omi_bw_update(struct iwl_mld *mld,
@@ -832,18 +832,17 @@ int iwl_mld_add_link(struct iwl_mld *mld,
}
/* Remove link from fw, unmap the bss_conf, and destroy the link structure */
int iwl_mld_remove_link(struct iwl_mld *mld,
struct ieee80211_bss_conf *bss_conf)
void iwl_mld_remove_link(struct iwl_mld *mld,
struct ieee80211_bss_conf *bss_conf)
{
struct iwl_mld_vif *mld_vif = iwl_mld_vif_from_mac80211(bss_conf->vif);
struct iwl_mld_link *link = iwl_mld_link_from_mac80211(bss_conf);
bool is_deflink = link == &mld_vif->deflink;
int ret;
if (WARN_ON(!link || link->active))
return -EINVAL;
return;
ret = iwl_mld_rm_link_from_fw(mld, bss_conf);
iwl_mld_rm_link_from_fw(mld, bss_conf);
/* Continue cleanup on failure */
if (!is_deflink)
@@ -854,11 +853,9 @@ int iwl_mld_remove_link(struct iwl_mld *mld,
wiphy_delayed_work_cancel(mld->wiphy, &link->rx_omi.finished_work);
if (WARN_ON(link->fw_id >= mld->fw->ucode_capa.num_links))
return -EINVAL;
return;
RCU_INIT_POINTER(mld->fw_id_to_bss_conf[link->fw_id], NULL);
return ret;
}
void iwl_mld_handle_missed_beacon_notif(struct iwl_mld *mld,

View File

@@ -114,8 +114,8 @@ iwl_mld_cleanup_link(struct iwl_mld *mld, struct iwl_mld_link *link)
int iwl_mld_add_link(struct iwl_mld *mld,
struct ieee80211_bss_conf *bss_conf);
int iwl_mld_remove_link(struct iwl_mld *mld,
struct ieee80211_bss_conf *bss_conf);
void iwl_mld_remove_link(struct iwl_mld *mld,
struct ieee80211_bss_conf *bss_conf);
int iwl_mld_activate_link(struct iwl_mld *mld,
struct ieee80211_bss_conf *link);
void iwl_mld_deactivate_link(struct iwl_mld *mld,

View File

@@ -2456,13 +2456,8 @@ iwl_mld_change_vif_links(struct ieee80211_hw *hw,
added |= BIT(0);
for (int i = 0; i < IEEE80211_MLD_MAX_NUM_LINKS; i++) {
if (removed & BIT(i)) {
link_conf = old[i];
err = iwl_mld_remove_link(mld, link_conf);
if (err)
return err;
}
if (removed & BIT(i))
iwl_mld_remove_link(mld, old[i]);
}
for (int i = 0; i < IEEE80211_MLD_MAX_NUM_LINKS; i++) {