提交 9deccfcd 编写于 作者: G Gregory Greenman 提交者: Johannes Berg

wifi: iwlwifi: mvm: rework active links counting

Remove fw_active_links_num counter since we now have a bitmap of
active links in vif. Also, update link activation status only when
LINK_CONTEXT_MODIFY_ACTIVE bit set in changes parameter.
Signed-off-by: NGregory Greenman <gregory.greenman@intel.com>
Link: https://lore.kernel.org/r/20230329100040.1ecfb27b6b84.I3a5e0bc32b3728e4caae8a231bc3f04ea1d89cad@changeidSigned-off-by: NJohannes Berg <johannes.berg@intel.com>
上级 ef36f1df
...@@ -104,11 +104,6 @@ int iwl_mvm_link_changed(struct iwl_mvm *mvm, struct ieee80211_vif *vif, ...@@ -104,11 +104,6 @@ int iwl_mvm_link_changed(struct iwl_mvm *mvm, struct ieee80211_vif *vif,
link_info->fw_link_id == IWL_MVM_FW_LINK_ID_INVALID)) link_info->fw_link_id == IWL_MVM_FW_LINK_ID_INVALID))
return -EINVAL; return -EINVAL;
/* cannot activate third link */
if (!link_info->active && active &&
mvmvif->fw_active_links_num >= IWL_MVM_FW_MAX_ACTIVE_LINKS_NUM)
return -EINVAL;
if (changes & LINK_CONTEXT_MODIFY_ACTIVE) { if (changes & LINK_CONTEXT_MODIFY_ACTIVE) {
/* When activating a link, phy context should be valid; /* When activating a link, phy context should be valid;
* when deactivating a link, it also should be valid since * when deactivating a link, it also should be valid since
...@@ -119,6 +114,22 @@ int iwl_mvm_link_changed(struct iwl_mvm *mvm, struct ieee80211_vif *vif, ...@@ -119,6 +114,22 @@ int iwl_mvm_link_changed(struct iwl_mvm *mvm, struct ieee80211_vif *vif,
if (!link_info->phy_ctxt) if (!link_info->phy_ctxt)
return 0; return 0;
/* check there aren't too many active links */
if (!link_info->active && active) {
int i, count = 0;
/* link with phy_ctxt is active in FW */
for_each_mvm_vif_valid_link(mvmvif, i)
if (mvmvif->link[i]->phy_ctxt)
count++;
/* FIXME: IWL_MVM_FW_MAX_ACTIVE_LINKS_NUM should be
* defined per HW
*/
if (count >= IWL_MVM_FW_MAX_ACTIVE_LINKS_NUM)
return -EINVAL;
}
/* Catch early if driver tries to activate or deactivate a link /* Catch early if driver tries to activate or deactivate a link
* twice. * twice.
*/ */
...@@ -230,18 +241,8 @@ int iwl_mvm_link_changed(struct iwl_mvm *mvm, struct ieee80211_vif *vif, ...@@ -230,18 +241,8 @@ int iwl_mvm_link_changed(struct iwl_mvm *mvm, struct ieee80211_vif *vif,
cmd.flags_mask = cpu_to_le32(flags_mask); cmd.flags_mask = cpu_to_le32(flags_mask);
ret = iwl_mvm_link_cmd_send(mvm, &cmd, FW_CTXT_ACTION_MODIFY); ret = iwl_mvm_link_cmd_send(mvm, &cmd, FW_CTXT_ACTION_MODIFY);
if (!ret) { if (!ret && (changes & LINK_CONTEXT_MODIFY_ACTIVE))
/* the FW is updated, so now it's possible to update the
* activation status. If activating a link, it was already
* checked above that we didn't reach the FW limit.
*/
if (link_info->active && !active)
mvmvif->fw_active_links_num--;
else if (!link_info->active && active)
mvmvif->fw_active_links_num++;
link_info->active = active; link_info->active = active;
}
return ret; return ret;
} }
......
...@@ -1027,7 +1027,6 @@ static void iwl_mvm_cleanup_iterator(void *data, u8 *mac, ...@@ -1027,7 +1027,6 @@ static void iwl_mvm_cleanup_iterator(void *data, u8 *mac,
memset(&mvmvif->bf_data, 0, sizeof(mvmvif->bf_data)); memset(&mvmvif->bf_data, 0, sizeof(mvmvif->bf_data));
mvmvif->fw_active_links_num = 0;
for_each_mvm_vif_valid_link(mvmvif, link_id) { for_each_mvm_vif_valid_link(mvmvif, link_id) {
mvmvif->link[link_id]->ap_sta_id = IWL_MVM_INVALID_STA; mvmvif->link[link_id]->ap_sta_id = IWL_MVM_INVALID_STA;
mvmvif->link[link_id]->fw_link_id = IWL_MVM_FW_LINK_ID_INVALID; mvmvif->link[link_id]->fw_link_id = IWL_MVM_FW_LINK_ID_INVALID;
......
...@@ -355,7 +355,6 @@ struct iwl_mvm_vif_link_info { ...@@ -355,7 +355,6 @@ struct iwl_mvm_vif_link_info {
* @csa_failed: CSA failed to schedule time event, report an error later * @csa_failed: CSA failed to schedule time event, report an error later
* @csa_bcn_pending: indicates that we are waiting for a beacon on a new channel * @csa_bcn_pending: indicates that we are waiting for a beacon on a new channel
* @features: hw features active for this vif * @features: hw features active for this vif
* @fw_active_links_num: the number of activated links
*/ */
struct iwl_mvm_vif { struct iwl_mvm_vif {
struct iwl_mvm *mvm; struct iwl_mvm *mvm;
...@@ -439,8 +438,6 @@ struct iwl_mvm_vif { ...@@ -439,8 +438,6 @@ struct iwl_mvm_vif {
struct ieee80211_key_conf __rcu *keys[2]; struct ieee80211_key_conf __rcu *keys[2];
} bcn_prot; } bcn_prot;
u32 fw_active_links_num;
struct iwl_mvm_vif_link_info deflink; struct iwl_mvm_vif_link_info deflink;
struct iwl_mvm_vif_link_info *link[IEEE80211_MLD_MAX_NUM_LINKS]; struct iwl_mvm_vif_link_info *link[IEEE80211_MLD_MAX_NUM_LINKS];
}; };
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册