/* it's easy when the STA is not an MLD */ if (!sta->valid_links) return BIT(mvmsta->deflink.sta_id);
/* but if it is an MLD, get the mask of all the FW STAs it has ... */
for_each_sta_active_link(vif, sta, link_sta, link_id) { struct iwl_mvm_link_sta *mvm_link_sta;
/* unless we have a specific link in mind */ if (filter_link_id >= 0 && link_id != filter_link_id) continue;
mvm_link_sta =
rcu_dereference_check(mvmsta->link[link_id],
lockdep_is_held(&mvm->mutex)); if (!mvm_link_sta) continue;
if (fw_has_capa(&mvm->fw->ucode_capa,
IWL_UCODE_TLV_CAPA_STA_EXP_MFP_SUPPORT) &&
sta->type == STATION_TYPE_BCAST_MGMT)
cmd.mfp = cpu_to_le32(1);
if (addr) {
memcpy(cmd.peer_mld_address, addr, ETH_ALEN);
memcpy(cmd.peer_link_address, addr, ETH_ALEN);
}
return iwl_mvm_mld_send_sta_cmd(mvm, &cmd);
}
/* * Remove a station from the FW table. Before sending the command to remove * the station validate that the station is indeed known to the driver (sanity * only).
*/ staticint iwl_mvm_mld_rm_sta_from_fw(struct iwl_mvm *mvm, u32 sta_id)
{ struct iwl_remove_sta_cmd rm_sta_cmd = {
.sta_id = cpu_to_le32(sta_id),
}; int ret;
/* Note: internal stations are marked as error values */ if (!rcu_access_pointer(mvm->fw_id_to_mac_id[sta_id])) {
IWL_ERR(mvm, "Invalid station id %d\n", sta_id); return -EINVAL;
}
ret = iwl_mvm_send_cmd_pdu(mvm, WIDE_ID(MAC_CONF_GROUP, STA_REMOVE_CMD),
0, sizeof(rm_sta_cmd), &rm_sta_cmd); if (ret) {
IWL_ERR(mvm, "Failed to remove station. Id=%d\n", sta_id); return ret;
}
ret = iwl_mvm_send_cmd_pdu(mvm, WIDE_ID(MAC_CONF_GROUP, AUX_STA_CMD),
0, sizeof(cmd), &cmd); if (ret)
IWL_ERR(mvm, "Failed to send AUX_STA_CMD\n"); return ret;
}
/* * Adds an internal sta to the FW table with its queues
*/ int iwl_mvm_mld_add_int_sta_with_queue(struct iwl_mvm *mvm, struct iwl_mvm_int_sta *sta, const u8 *addr, int link_id,
u16 *queue, u8 tid, unsignedint *_wdg_timeout)
{ int ret, txq; unsignedint wdg_timeout = _wdg_timeout ? *_wdg_timeout :
mvm->trans->mac_cfg->base->wd_timeout;
if (WARN_ON_ONCE(sta->sta_id == IWL_INVALID_STA)) return -ENOSPC;
if (sta->type == STATION_TYPE_AUX)
ret = iwl_mvm_add_aux_sta_to_fw(mvm, sta, link_id); else
ret = iwl_mvm_mld_add_int_sta_to_fw(mvm, sta, addr, link_id); if (ret) return ret;
/* * For 22000 firmware and on we cannot add queue to a station unknown * to firmware so enable queue here - after the station was added
*/
txq = iwl_mvm_tvqm_enable_txq(mvm, NULL, sta->sta_id, tid,
wdg_timeout); if (txq < 0) {
iwl_mvm_mld_rm_sta_from_fw(mvm, sta->sta_id); return txq;
}
*queue = txq;
return 0;
}
/* * Adds a new int sta: allocate it in the driver, add it to the FW table, * and add its queues.
*/ staticint iwl_mvm_mld_add_int_sta(struct iwl_mvm *mvm, struct iwl_mvm_int_sta *int_sta, u16 *queue, enum nl80211_iftype iftype, enum iwl_fw_sta_type sta_type, int link_id, const u8 *addr, u8 tid, unsignedint *wdg_timeout)
{ int ret;
lockdep_assert_held(&mvm->mutex);
/* qmask argument is not used in the new tx api, send a don't care */
ret = iwl_mvm_allocate_int_sta(mvm, int_sta, 0, iftype,
sta_type); if (ret) return ret;
ret = iwl_mvm_mld_add_int_sta_with_queue(mvm, int_sta, addr, link_id,
queue, tid, wdg_timeout); if (ret) {
iwl_mvm_dealloc_int_sta(mvm, int_sta); return ret;
}
return 0;
}
/* Allocate a new station entry for the broadcast station to the given vif, * and send it to the FW. * Note that each P2P mac should have its own broadcast station.
*/ int iwl_mvm_mld_add_bcast_sta(struct iwl_mvm *mvm, struct ieee80211_vif *vif, struct ieee80211_bss_conf *link_conf)
{ struct iwl_mvm_vif *mvmvif = iwl_mvm_vif_from_mac80211(vif); struct iwl_mvm_vif_link_info *mvm_link =
mvmvif->link[link_conf->link_id]; struct iwl_mvm_int_sta *bsta = &mvm_link->bcast_sta; staticconst u8 _baddr[] = {0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF}; const u8 *baddr = _baddr; unsignedint wdg_timeout =
iwl_mvm_get_wd_timeout(mvm, vif);
u16 *queue;
lockdep_assert_held(&mvm->mutex);
if (vif->type == NL80211_IFTYPE_ADHOC)
baddr = link_conf->bssid;
/* Allocate a new station entry for the multicast station to the given vif, * and send it to the FW. * Note that each AP/GO mac should have its own multicast station.
*/ int iwl_mvm_mld_add_mcast_sta(struct iwl_mvm *mvm, struct ieee80211_vif *vif, struct ieee80211_bss_conf *link_conf)
{ struct iwl_mvm_vif *mvmvif = iwl_mvm_vif_from_mac80211(vif); struct iwl_mvm_vif_link_info *mvm_link =
mvmvif->link[link_conf->link_id]; struct iwl_mvm_int_sta *msta = &mvm_link->mcast_sta; staticconst u8 _maddr[] = {0x03, 0x00, 0x00, 0x00, 0x00, 0x00}; const u8 *maddr = _maddr; unsignedint timeout = iwl_mvm_get_wd_timeout(mvm, vif);
lockdep_assert_held(&mvm->mutex);
if (WARN_ON(vif->type != NL80211_IFTYPE_AP &&
vif->type != NL80211_IFTYPE_ADHOC)) return -EOPNOTSUPP;
/* In IBSS, ieee80211_check_queues() sets the cab_queue to be * invalid, so make sure we use the queue we want. * Note that this is done here as we want to avoid making DQA * changes in mac80211 layer.
*/ if (vif->type == NL80211_IFTYPE_ADHOC)
mvm_link->cab_queue = IWL_MVM_DQA_GCAST_QUEUE;
/* Allocate a new station entry for the sniffer station to the given vif, * and send it to the FW.
*/ int iwl_mvm_mld_add_snif_sta(struct iwl_mvm *mvm, struct ieee80211_vif *vif, struct ieee80211_bss_conf *link_conf)
{ struct iwl_mvm_vif *mvmvif = iwl_mvm_vif_from_mac80211(vif); struct iwl_mvm_vif_link_info *mvm_link =
mvmvif->link[link_conf->link_id];
int iwl_mvm_mld_add_aux_sta(struct iwl_mvm *mvm, u32 lmac_id)
{
lockdep_assert_held(&mvm->mutex);
/* In CDB NICs we need to specify which lmac to use for aux activity; * use the link_id argument place to send lmac_id to the function.
*/ return iwl_mvm_mld_add_int_sta(mvm, &mvm->aux_sta, &mvm->aux_queue,
NL80211_IFTYPE_UNSPECIFIED,
STATION_TYPE_AUX, lmac_id, NULL,
IWL_MAX_TID_COUNT, NULL);
}
staticint iwl_mvm_mld_disable_txq(struct iwl_mvm *mvm, u32 sta_mask,
u16 *queueptr, u8 tid)
{ int queue = *queueptr; int ret = 0;
/* Removes a sta from the FW table, disable its queues, and dealloc it
*/ staticint iwl_mvm_mld_rm_int_sta(struct iwl_mvm *mvm, struct iwl_mvm_int_sta *int_sta, bool flush, u8 tid, u16 *queuptr)
{ int ret;
lockdep_assert_held(&mvm->mutex);
if (WARN_ON_ONCE(int_sta->sta_id == IWL_INVALID_STA)) return -EINVAL;
if (flush)
iwl_mvm_flush_sta(mvm, int_sta->sta_id, int_sta->tfd_queue_msk);
/* Send the FW a request to remove the station from it's internal data * structures, and in addition remove it from the local data structure.
*/ int iwl_mvm_mld_rm_mcast_sta(struct iwl_mvm *mvm, struct ieee80211_vif *vif, struct ieee80211_bss_conf *link_conf)
{ struct iwl_mvm_vif *mvmvif = iwl_mvm_vif_from_mac80211(vif); struct iwl_mvm_vif_link_info *link = mvmvif->link[link_conf->link_id];
if (rcu_access_pointer(sta->link[link_id]) == &sta->deflink) {
link = &mvm_sta->deflink;
} else {
link = kzalloc(sizeof(*link), GFP_KERNEL); if (!link) return -ENOMEM;
}
/* allocate all the links of a sta, called when the station is first added */ staticint iwl_mvm_mld_alloc_sta_links(struct iwl_mvm *mvm, struct ieee80211_vif *vif, struct ieee80211_sta *sta)
{ struct iwl_mvm_sta *mvm_sta = iwl_mvm_sta_from_mac80211(sta); struct ieee80211_link_sta *link_sta; unsignedint link_id; int ret;
lockdep_assert_held(&mvm->mutex);
for_each_sta_active_link(vif, sta, link_sta, link_id) { if (WARN_ON(mvm_sta->link[link_id])) continue;
ret = iwl_mvm_mld_alloc_sta_link(mvm, vif, sta, link_id); if (ret) goto err;
}
/* First add an empty station since allocating a queue requires * a valid station. Since we need a link_id to allocate a station, * pick up the first valid one.
*/
for_each_sta_active_link(vif, sta, link_sta, link_id) { struct iwl_mvm_vif_link_info *mvm_link; struct ieee80211_bss_conf *link_conf =
link_conf_dereference_protected(vif, link_id); struct iwl_mvm_link_sta *mvm_link_sta =
rcu_dereference_protected(mvm_sta->link[link_id],
lockdep_is_held(&mvm->mutex));
if (!link_conf) continue;
mvm_link = mvmvif->link[link_conf->link_id];
if (!mvm_link || !mvm_link_sta) continue;
sta_id = mvm_link_sta->sta_id;
ret = iwl_mvm_mld_cfg_sta(mvm, sta, vif, link_sta,
link_conf, mvm_link_sta); if (ret) return ret;
rcu_assign_pointer(mvm->fw_id_to_mac_id[sta_id], sta);
rcu_assign_pointer(mvm->fw_id_to_link_sta[sta_id], link_sta);
ret = 0;
}
/* flush its queues here since we are freeing mvm_sta */
for_each_sta_active_link(vif, sta, link_sta, link_id) { struct iwl_mvm_link_sta *mvm_link_sta =
rcu_dereference_protected(mvm_sta->link[link_id],
lockdep_is_held(&mvm->mutex));
if (WARN_ON(!mvm_link_sta)) return -EINVAL;
ret = iwl_mvm_flush_sta_tids(mvm, mvm_link_sta->sta_id,
0xffff); if (ret) return ret;
}
ret = iwl_mvm_wait_sta_queues_empty(mvm, mvm_sta); if (ret) return ret;
/* Block/unblock all the stations of the given mvmvif */ for (i = 0; i < mvm->fw->ucode_capa.num_stations; i++) {
sta = rcu_dereference(mvm->fw_id_to_mac_id[i]); if (IS_ERR_OR_NULL(sta)) continue;
mvm_sta = iwl_mvm_sta_from_mac80211(sta); if (mvm_sta->mac_id_n_color !=
FW_CMD_ID_AND_COLOR(mvmvif->id, mvmvif->color)) continue;
Die Informationen auf dieser Webseite wurden
nach bestem Wissen sorgfältig zusammengestellt. Es wird jedoch weder Vollständigkeit, noch Richtigkeit,
noch Qualität der bereit gestellten Informationen zugesichert.
Bemerkung:
Die farbliche Syntaxdarstellung und die Messung sind noch experimentell.