Commit c8ee33e1 authored by Gregory Greenman's avatar Gregory Greenman Committed by Johannes Berg

wifi: iwlwifi: mvm: sta preparation for MLO

Split iwl_mvm_sta into general and link specific parts. As a first
step, all link dependent parameters reside in deflink.

The change was done mostly using the spatch below with some manual
adjustments.

@iwl_mvm_sta@
struct iwl_mvm_sta *s;
identifier var = {sta_id, lq_sta, avg_energy};
@@

(
  s->
-    var
+    deflink.var
)
Signed-off-by: default avatarGregory Greenman <gregory.greenman@intel.com>
Link: https://lore.kernel.org/r/20230328104948.34eace06d583.I1f8c5e919a71b21030460fbdd220d42401b688b1@changeidSigned-off-by: default avatarJohannes Berg <johannes.berg@intel.com>
parent 650cadb7
...@@ -194,7 +194,7 @@ static int iwl_mvm_bt_coex_reduced_txp(struct iwl_mvm *mvm, u8 sta_id, ...@@ -194,7 +194,7 @@ static int iwl_mvm_bt_coex_reduced_txp(struct iwl_mvm *mvm, u8 sta_id,
if (mvmsta->bt_reduced_txpower == enable) if (mvmsta->bt_reduced_txpower == enable)
return 0; return 0;
value = mvmsta->sta_id; value = mvmsta->deflink.sta_id;
if (enable) if (enable)
value |= BT_REDUCED_TX_POWER_BIT; value |= BT_REDUCED_TX_POWER_BIT;
......
...@@ -376,7 +376,7 @@ static ssize_t iwl_dbgfs_rs_data_read(struct file *file, char __user *user_buf, ...@@ -376,7 +376,7 @@ static ssize_t iwl_dbgfs_rs_data_read(struct file *file, char __user *user_buf,
{ {
struct ieee80211_sta *sta = file->private_data; struct ieee80211_sta *sta = file->private_data;
struct iwl_mvm_sta *mvmsta = iwl_mvm_sta_from_mac80211(sta); struct iwl_mvm_sta *mvmsta = iwl_mvm_sta_from_mac80211(sta);
struct iwl_lq_sta_rs_fw *lq_sta = &mvmsta->lq_sta.rs_fw; struct iwl_lq_sta_rs_fw *lq_sta = &mvmsta->deflink.lq_sta.rs_fw;
struct iwl_mvm *mvm = lq_sta->pers.drv; struct iwl_mvm *mvm = lq_sta->pers.drv;
static const size_t bufsz = 2048; static const size_t bufsz = 2048;
char *buff; char *buff;
......
...@@ -922,7 +922,7 @@ static int iwl_mvm_mac_ampdu_action(struct ieee80211_hw *hw, ...@@ -922,7 +922,7 @@ static int iwl_mvm_mac_ampdu_action(struct ieee80211_hw *hw,
switch (action) { switch (action) {
case IEEE80211_AMPDU_RX_START: case IEEE80211_AMPDU_RX_START:
if (iwl_mvm_vif_from_mac80211(vif)->deflink.ap_sta_id == if (iwl_mvm_vif_from_mac80211(vif)->deflink.ap_sta_id ==
iwl_mvm_sta_from_mac80211(sta)->sta_id) { iwl_mvm_sta_from_mac80211(sta)->deflink.sta_id) {
struct iwl_mvm_vif *mvmvif; struct iwl_mvm_vif *mvmvif;
u16 macid = iwl_mvm_vif_from_mac80211(vif)->id; u16 macid = iwl_mvm_vif_from_mac80211(vif)->id;
struct iwl_mvm_tcm_mac *mdata = &mvm->tcm.data[macid]; struct iwl_mvm_tcm_mac *mdata = &mvm->tcm.data[macid];
...@@ -3116,7 +3116,7 @@ static void __iwl_mvm_mac_sta_notify(struct ieee80211_hw *hw, ...@@ -3116,7 +3116,7 @@ static void __iwl_mvm_mac_sta_notify(struct ieee80211_hw *hw,
*/ */
break; break;
case STA_NOTIFY_AWAKE: case STA_NOTIFY_AWAKE:
if (WARN_ON(mvmsta->sta_id == IWL_MVM_INVALID_STA)) if (WARN_ON(mvmsta->deflink.sta_id == IWL_MVM_INVALID_STA))
break; break;
if (txqs) if (txqs)
...@@ -3206,8 +3206,8 @@ static void iwl_mvm_sta_pre_rcu_remove(struct ieee80211_hw *hw, ...@@ -3206,8 +3206,8 @@ static void iwl_mvm_sta_pre_rcu_remove(struct ieee80211_hw *hw,
* callback deleted the station. * callback deleted the station.
*/ */
mutex_lock(&mvm->mutex); mutex_lock(&mvm->mutex);
if (sta == rcu_access_pointer(mvm->fw_id_to_mac_id[mvm_sta->sta_id])) if (sta == rcu_access_pointer(mvm->fw_id_to_mac_id[mvm_sta->deflink.sta_id]))
rcu_assign_pointer(mvm->fw_id_to_mac_id[mvm_sta->sta_id], rcu_assign_pointer(mvm->fw_id_to_mac_id[mvm_sta->deflink.sta_id],
ERR_PTR(-ENOENT)); ERR_PTR(-ENOENT));
mutex_unlock(&mvm->mutex); mutex_unlock(&mvm->mutex);
...@@ -3534,7 +3534,8 @@ static int iwl_mvm_mac_sta_state(struct ieee80211_hw *hw, ...@@ -3534,7 +3534,8 @@ static int iwl_mvm_mac_sta_state(struct ieee80211_hw *hw,
!iwlwifi_mod_params.disable_11ax) || !iwlwifi_mod_params.disable_11ax) ||
(vif->bss_conf.eht_support && (vif->bss_conf.eht_support &&
!iwlwifi_mod_params.disable_11be)) !iwlwifi_mod_params.disable_11be))
iwl_mvm_cfg_he_sta(mvm, vif, mvm_sta->sta_id); iwl_mvm_cfg_he_sta(mvm, vif,
mvm_sta->deflink.sta_id);
} else if (vif->type == NL80211_IFTYPE_STATION) { } else if (vif->type == NL80211_IFTYPE_STATION) {
vif->bss_conf.he_support = sta->deflink.he_cap.has_he; vif->bss_conf.he_support = sta->deflink.he_cap.has_he;
...@@ -5470,13 +5471,13 @@ static void iwl_mvm_mac_sta_statistics(struct ieee80211_hw *hw, ...@@ -5470,13 +5471,13 @@ static void iwl_mvm_mac_sta_statistics(struct ieee80211_hw *hw,
struct iwl_mvm_vif *mvmvif = iwl_mvm_vif_from_mac80211(vif); struct iwl_mvm_vif *mvmvif = iwl_mvm_vif_from_mac80211(vif);
struct iwl_mvm_sta *mvmsta = iwl_mvm_sta_from_mac80211(sta); struct iwl_mvm_sta *mvmsta = iwl_mvm_sta_from_mac80211(sta);
if (mvmsta->avg_energy) { if (mvmsta->deflink.avg_energy) {
sinfo->signal_avg = -(s8)mvmsta->avg_energy; sinfo->signal_avg = -(s8)mvmsta->deflink.avg_energy;
sinfo->filled |= BIT_ULL(NL80211_STA_INFO_SIGNAL_AVG); sinfo->filled |= BIT_ULL(NL80211_STA_INFO_SIGNAL_AVG);
} }
if (iwl_mvm_has_tlc_offload(mvm)) { if (iwl_mvm_has_tlc_offload(mvm)) {
struct iwl_lq_sta_rs_fw *lq_sta = &mvmsta->lq_sta.rs_fw; struct iwl_lq_sta_rs_fw *lq_sta = &mvmsta->deflink.lq_sta.rs_fw;
iwl_mvm_set_sta_rate(lq_sta->last_rate_n_flags, &sinfo->txrate); iwl_mvm_set_sta_rate(lq_sta->last_rate_n_flags, &sinfo->txrate);
sinfo->filled |= BIT_ULL(NL80211_STA_INFO_TX_BITRATE); sinfo->filled |= BIT_ULL(NL80211_STA_INFO_TX_BITRATE);
...@@ -5491,7 +5492,7 @@ static void iwl_mvm_mac_sta_statistics(struct ieee80211_hw *hw, ...@@ -5491,7 +5492,7 @@ static void iwl_mvm_mac_sta_statistics(struct ieee80211_hw *hw,
mutex_lock(&mvm->mutex); mutex_lock(&mvm->mutex);
if (mvmvif->deflink.ap_sta_id != mvmsta->sta_id) if (mvmvif->deflink.ap_sta_id != mvmsta->deflink.sta_id)
goto unlock; goto unlock;
if (iwl_mvm_request_statistics(mvm, false)) if (iwl_mvm_request_statistics(mvm, false))
......
...@@ -22,7 +22,7 @@ static u32 iwl_mvm_get_sec_sta_mask(struct iwl_mvm *mvm, ...@@ -22,7 +22,7 @@ static u32 iwl_mvm_get_sec_sta_mask(struct iwl_mvm *mvm,
if (sta) { if (sta) {
struct iwl_mvm_sta *mvmsta = iwl_mvm_sta_from_mac80211(sta); struct iwl_mvm_sta *mvmsta = iwl_mvm_sta_from_mac80211(sta);
return BIT(mvmsta->sta_id); return BIT(mvmsta->deflink.sta_id);
} }
if (vif->type == NL80211_IFTYPE_STATION && if (vif->type == NL80211_IFTYPE_STATION &&
......
...@@ -243,7 +243,7 @@ static int iwl_mvm_mld_disable_txq(struct iwl_mvm *mvm, ...@@ -243,7 +243,7 @@ static int iwl_mvm_mld_disable_txq(struct iwl_mvm *mvm,
.operation = cpu_to_le32(IWL_SCD_QUEUE_REMOVE), .operation = cpu_to_le32(IWL_SCD_QUEUE_REMOVE),
.u.remove.tid = cpu_to_le32(tid), .u.remove.tid = cpu_to_le32(tid),
.u.remove.sta_mask = .u.remove.sta_mask =
cpu_to_le32(BIT(mvmsta->sta_id)), cpu_to_le32(BIT(mvmsta->deflink.sta_id)),
}; };
ret = iwl_mvm_send_cmd_pdu(mvm, cmd_id, 0, ret = iwl_mvm_send_cmd_pdu(mvm, cmd_id, 0,
...@@ -348,7 +348,7 @@ static void iwl_mvm_mld_sta_modify_disable_tx(struct iwl_mvm *mvm, ...@@ -348,7 +348,7 @@ static void iwl_mvm_mld_sta_modify_disable_tx(struct iwl_mvm *mvm,
mvm_sta->disable_tx = disable; mvm_sta->disable_tx = disable;
cmd.sta_id = cpu_to_le32(mvm_sta->sta_id); cmd.sta_id = cpu_to_le32(mvm_sta->deflink.sta_id);
cmd.disable = cpu_to_le32(disable); cmd.disable = cpu_to_le32(disable);
ret = iwl_mvm_send_cmd_pdu(mvm, ret = iwl_mvm_send_cmd_pdu(mvm,
......
...@@ -438,7 +438,7 @@ void iwl_mvm_tlc_update_notif(struct iwl_mvm *mvm, ...@@ -438,7 +438,7 @@ void iwl_mvm_tlc_update_notif(struct iwl_mvm *mvm,
flags = le32_to_cpu(notif->flags); flags = le32_to_cpu(notif->flags);
lq_sta = &mvmsta->lq_sta.rs_fw; lq_sta = &mvmsta->deflink.lq_sta.rs_fw;
if (flags & IWL_TLC_NOTIF_FLAG_RATE) { if (flags & IWL_TLC_NOTIF_FLAG_RATE) {
char pretty_rate[100]; char pretty_rate[100];
...@@ -547,12 +547,12 @@ void rs_fw_rate_init(struct iwl_mvm *mvm, struct ieee80211_sta *sta, ...@@ -547,12 +547,12 @@ void rs_fw_rate_init(struct iwl_mvm *mvm, struct ieee80211_sta *sta,
{ {
struct ieee80211_hw *hw = mvm->hw; struct ieee80211_hw *hw = mvm->hw;
struct iwl_mvm_sta *mvmsta = iwl_mvm_sta_from_mac80211(sta); struct iwl_mvm_sta *mvmsta = iwl_mvm_sta_from_mac80211(sta);
struct iwl_lq_sta_rs_fw *lq_sta = &mvmsta->lq_sta.rs_fw; struct iwl_lq_sta_rs_fw *lq_sta = &mvmsta->deflink.lq_sta.rs_fw;
u32 cmd_id = WIDE_ID(DATA_PATH_GROUP, TLC_MNG_CONFIG_CMD); u32 cmd_id = WIDE_ID(DATA_PATH_GROUP, TLC_MNG_CONFIG_CMD);
struct ieee80211_supported_band *sband = hw->wiphy->bands[band]; struct ieee80211_supported_band *sband = hw->wiphy->bands[band];
u16 max_amsdu_len = rs_fw_get_max_amsdu_len(sta); u16 max_amsdu_len = rs_fw_get_max_amsdu_len(sta);
struct iwl_tlc_config_cmd_v4 cfg_cmd = { struct iwl_tlc_config_cmd_v4 cfg_cmd = {
.sta_id = mvmsta->sta_id, .sta_id = mvmsta->deflink.sta_id,
.max_ch_width = update ? .max_ch_width = update ?
rs_fw_bw_from_sta_bw(sta) : IWL_TLC_MNG_CH_WIDTH_20MHZ, rs_fw_bw_from_sta_bw(sta) : IWL_TLC_MNG_CH_WIDTH_20MHZ,
.flags = cpu_to_le16(rs_fw_get_config_flags(mvm, sta, sband)), .flags = cpu_to_le16(rs_fw_get_config_flags(mvm, sta, sband)),
...@@ -641,12 +641,12 @@ int rs_fw_tx_protection(struct iwl_mvm *mvm, struct iwl_mvm_sta *mvmsta, ...@@ -641,12 +641,12 @@ int rs_fw_tx_protection(struct iwl_mvm *mvm, struct iwl_mvm_sta *mvmsta,
void iwl_mvm_rs_add_sta(struct iwl_mvm *mvm, struct iwl_mvm_sta *mvmsta) void iwl_mvm_rs_add_sta(struct iwl_mvm *mvm, struct iwl_mvm_sta *mvmsta)
{ {
struct iwl_lq_sta_rs_fw *lq_sta = &mvmsta->lq_sta.rs_fw; struct iwl_lq_sta_rs_fw *lq_sta = &mvmsta->deflink.lq_sta.rs_fw;
IWL_DEBUG_RATE(mvm, "create station rate scale window\n"); IWL_DEBUG_RATE(mvm, "create station rate scale window\n");
lq_sta->pers.drv = mvm; lq_sta->pers.drv = mvm;
lq_sta->pers.sta_id = mvmsta->sta_id; lq_sta->pers.sta_id = mvmsta->deflink.sta_id;
lq_sta->pers.chains = 0; lq_sta->pers.chains = 0;
memset(lq_sta->pers.chain_signal, 0, sizeof(lq_sta->pers.chain_signal)); memset(lq_sta->pers.chain_signal, 0, sizeof(lq_sta->pers.chain_signal));
lq_sta->pers.last_rssi = S8_MIN; lq_sta->pers.last_rssi = S8_MIN;
......
...@@ -754,7 +754,7 @@ static int rs_collect_tlc_data(struct iwl_mvm *mvm, ...@@ -754,7 +754,7 @@ static int rs_collect_tlc_data(struct iwl_mvm *mvm,
return -EINVAL; return -EINVAL;
if (tbl->column != RS_COLUMN_INVALID) { if (tbl->column != RS_COLUMN_INVALID) {
struct lq_sta_pers *pers = &mvmsta->lq_sta.rs_drv.pers; struct lq_sta_pers *pers = &mvmsta->deflink.lq_sta.rs_drv.pers;
pers->tx_stats[tbl->column][scale_index].total += attempts; pers->tx_stats[tbl->column][scale_index].total += attempts;
pers->tx_stats[tbl->column][scale_index].success += successes; pers->tx_stats[tbl->column][scale_index].success += successes;
...@@ -2599,7 +2599,7 @@ void rs_update_last_rssi(struct iwl_mvm *mvm, ...@@ -2599,7 +2599,7 @@ void rs_update_last_rssi(struct iwl_mvm *mvm,
struct iwl_mvm_sta *mvmsta, struct iwl_mvm_sta *mvmsta,
struct ieee80211_rx_status *rx_status) struct ieee80211_rx_status *rx_status)
{ {
struct iwl_lq_sta *lq_sta = &mvmsta->lq_sta.rs_drv; struct iwl_lq_sta *lq_sta = &mvmsta->deflink.lq_sta.rs_drv;
int i; int i;
lq_sta->pers.chains = rx_status->chains; lq_sta->pers.chains = rx_status->chains;
...@@ -2711,7 +2711,7 @@ static void *rs_drv_alloc_sta(void *mvm_rate, struct ieee80211_sta *sta, ...@@ -2711,7 +2711,7 @@ static void *rs_drv_alloc_sta(void *mvm_rate, struct ieee80211_sta *sta,
struct iwl_mvm_sta *mvmsta = iwl_mvm_sta_from_mac80211(sta); struct iwl_mvm_sta *mvmsta = iwl_mvm_sta_from_mac80211(sta);
struct iwl_op_mode *op_mode = (struct iwl_op_mode *)mvm_rate; struct iwl_op_mode *op_mode = (struct iwl_op_mode *)mvm_rate;
struct iwl_mvm *mvm = IWL_OP_MODE_GET_MVM(op_mode); struct iwl_mvm *mvm = IWL_OP_MODE_GET_MVM(op_mode);
struct iwl_lq_sta *lq_sta = &mvmsta->lq_sta.rs_drv; struct iwl_lq_sta *lq_sta = &mvmsta->deflink.lq_sta.rs_drv;
IWL_DEBUG_RATE(mvm, "create station rate scale window\n"); IWL_DEBUG_RATE(mvm, "create station rate scale window\n");
...@@ -2917,18 +2917,18 @@ static void rs_drv_rate_init(struct iwl_mvm *mvm, struct ieee80211_sta *sta, ...@@ -2917,18 +2917,18 @@ static void rs_drv_rate_init(struct iwl_mvm *mvm, struct ieee80211_sta *sta,
struct ieee80211_sta_ht_cap *ht_cap = &sta->deflink.ht_cap; struct ieee80211_sta_ht_cap *ht_cap = &sta->deflink.ht_cap;
struct ieee80211_sta_vht_cap *vht_cap = &sta->deflink.vht_cap; struct ieee80211_sta_vht_cap *vht_cap = &sta->deflink.vht_cap;
struct iwl_mvm_sta *mvmsta = iwl_mvm_sta_from_mac80211(sta); struct iwl_mvm_sta *mvmsta = iwl_mvm_sta_from_mac80211(sta);
struct iwl_lq_sta *lq_sta = &mvmsta->lq_sta.rs_drv; struct iwl_lq_sta *lq_sta = &mvmsta->deflink.lq_sta.rs_drv;
struct ieee80211_supported_band *sband; struct ieee80211_supported_band *sband;
unsigned long supp; /* must be unsigned long for for_each_set_bit */ unsigned long supp; /* must be unsigned long for for_each_set_bit */
lockdep_assert_held(&mvmsta->lq_sta.rs_drv.pers.lock); lockdep_assert_held(&mvmsta->deflink.lq_sta.rs_drv.pers.lock);
/* clear all non-persistent lq data */ /* clear all non-persistent lq data */
memset(lq_sta, 0, offsetof(typeof(*lq_sta), pers)); memset(lq_sta, 0, offsetof(typeof(*lq_sta), pers));
sband = hw->wiphy->bands[band]; sband = hw->wiphy->bands[band];
lq_sta->lq.sta_id = mvmsta->sta_id; lq_sta->lq.sta_id = mvmsta->deflink.sta_id;
mvmsta->amsdu_enabled = 0; mvmsta->amsdu_enabled = 0;
mvmsta->max_amsdu_len = sta->cur->max_amsdu_len; mvmsta->max_amsdu_len = sta->cur->max_amsdu_len;
...@@ -2940,7 +2940,7 @@ static void rs_drv_rate_init(struct iwl_mvm *mvm, struct ieee80211_sta *sta, ...@@ -2940,7 +2940,7 @@ static void rs_drv_rate_init(struct iwl_mvm *mvm, struct ieee80211_sta *sta,
IWL_DEBUG_RATE(mvm, IWL_DEBUG_RATE(mvm,
"LQ: *** rate scale station global init for station %d ***\n", "LQ: *** rate scale station global init for station %d ***\n",
mvmsta->sta_id); mvmsta->deflink.sta_id);
/* TODO: what is a good starting rate for STA? About middle? Maybe not /* TODO: what is a good starting rate for STA? About middle? Maybe not
* the lowest or the highest rate.. Could consider using RSSI from * the lowest or the highest rate.. Could consider using RSSI from
* previous packets? Need to have IEEE 802.1X auth succeed immediately * previous packets? Need to have IEEE 802.1X auth succeed immediately
...@@ -3032,7 +3032,7 @@ static void __iwl_mvm_rs_tx_status(struct iwl_mvm *mvm, ...@@ -3032,7 +3032,7 @@ static void __iwl_mvm_rs_tx_status(struct iwl_mvm *mvm,
u8 lq_color = RS_DRV_DATA_LQ_COLOR_GET(tlc_info); u8 lq_color = RS_DRV_DATA_LQ_COLOR_GET(tlc_info);
u32 tx_resp_hwrate = (uintptr_t)info->status.status_driver_data[1]; u32 tx_resp_hwrate = (uintptr_t)info->status.status_driver_data[1];
struct iwl_mvm_sta *mvmsta = iwl_mvm_sta_from_mac80211(sta); struct iwl_mvm_sta *mvmsta = iwl_mvm_sta_from_mac80211(sta);
struct iwl_lq_sta *lq_sta = &mvmsta->lq_sta.rs_drv; struct iwl_lq_sta *lq_sta = &mvmsta->deflink.lq_sta.rs_drv;
if (!lq_sta->pers.drv) { if (!lq_sta->pers.drv) {
IWL_DEBUG_RATE(mvm, "Rate scaling not initialized yet.\n"); IWL_DEBUG_RATE(mvm, "Rate scaling not initialized yet.\n");
...@@ -3256,11 +3256,11 @@ void iwl_mvm_rs_tx_status(struct iwl_mvm *mvm, struct ieee80211_sta *sta, ...@@ -3256,11 +3256,11 @@ void iwl_mvm_rs_tx_status(struct iwl_mvm *mvm, struct ieee80211_sta *sta,
/* If it's locked we are in middle of init flow /* If it's locked we are in middle of init flow
* just wait for next tx status to update the lq_sta data * just wait for next tx status to update the lq_sta data
*/ */
if (!spin_trylock(&mvmsta->lq_sta.rs_drv.pers.lock)) if (!spin_trylock(&mvmsta->deflink.lq_sta.rs_drv.pers.lock))
return; return;
__iwl_mvm_rs_tx_status(mvm, sta, tid, info, ndp); __iwl_mvm_rs_tx_status(mvm, sta, tid, info, ndp);
spin_unlock(&mvmsta->lq_sta.rs_drv.pers.lock); spin_unlock(&mvmsta->deflink.lq_sta.rs_drv.pers.lock);
} }
#ifdef CONFIG_MAC80211_DEBUGFS #ifdef CONFIG_MAC80211_DEBUGFS
...@@ -3436,7 +3436,7 @@ static void rs_bfer_active_iter(void *_data, ...@@ -3436,7 +3436,7 @@ static void rs_bfer_active_iter(void *_data,
{ {
struct rs_bfer_active_iter_data *data = _data; struct rs_bfer_active_iter_data *data = _data;
struct iwl_mvm_sta *mvmsta = iwl_mvm_sta_from_mac80211(sta); struct iwl_mvm_sta *mvmsta = iwl_mvm_sta_from_mac80211(sta);
struct iwl_lq_cmd *lq_cmd = &mvmsta->lq_sta.rs_drv.lq; struct iwl_lq_cmd *lq_cmd = &mvmsta->deflink.lq_sta.rs_drv.lq;
u32 ss_params = le32_to_cpu(lq_cmd->ss_params); u32 ss_params = le32_to_cpu(lq_cmd->ss_params);
if (sta == data->exclude_sta) if (sta == data->exclude_sta)
...@@ -3467,7 +3467,8 @@ static int rs_bfer_priority(struct iwl_mvm_sta *sta) ...@@ -3467,7 +3467,8 @@ static int rs_bfer_priority(struct iwl_mvm_sta *sta)
prio = 1; prio = 1;
break; break;
default: default:
WARN_ONCE(true, "viftype %d sta_id %d", viftype, sta->sta_id); WARN_ONCE(true, "viftype %d sta_id %d", viftype,
sta->deflink.sta_id);
prio = -1; prio = -1;
} }
...@@ -3544,12 +3545,12 @@ static void rs_set_lq_ss_params(struct iwl_mvm *mvm, ...@@ -3544,12 +3545,12 @@ static void rs_set_lq_ss_params(struct iwl_mvm *mvm,
} }
IWL_DEBUG_RATE(mvm, "Found existing sta %d with BFER activated\n", IWL_DEBUG_RATE(mvm, "Found existing sta %d with BFER activated\n",
bfer_mvmsta->sta_id); bfer_mvmsta->deflink.sta_id);
/* Disallow BFER on another STA if active and we're a higher priority */ /* Disallow BFER on another STA if active and we're a higher priority */
if (rs_bfer_priority_cmp(mvmsta, bfer_mvmsta) > 0) { if (rs_bfer_priority_cmp(mvmsta, bfer_mvmsta) > 0) {
struct iwl_lq_cmd *bfersta_lq_cmd = struct iwl_lq_cmd *bfersta_lq_cmd =
&bfer_mvmsta->lq_sta.rs_drv.lq; &bfer_mvmsta->deflink.lq_sta.rs_drv.lq;
u32 bfersta_ss_params = le32_to_cpu(bfersta_lq_cmd->ss_params); u32 bfersta_ss_params = le32_to_cpu(bfersta_lq_cmd->ss_params);
bfersta_ss_params &= ~LQ_SS_BFER_ALLOWED; bfersta_ss_params &= ~LQ_SS_BFER_ALLOWED;
...@@ -3559,7 +3560,7 @@ static void rs_set_lq_ss_params(struct iwl_mvm *mvm, ...@@ -3559,7 +3560,7 @@ static void rs_set_lq_ss_params(struct iwl_mvm *mvm,
ss_params |= LQ_SS_BFER_ALLOWED; ss_params |= LQ_SS_BFER_ALLOWED;
IWL_DEBUG_RATE(mvm, IWL_DEBUG_RATE(mvm,
"Lower priority BFER sta found (%d). Switch BFER\n", "Lower priority BFER sta found (%d). Switch BFER\n",
bfer_mvmsta->sta_id); bfer_mvmsta->deflink.sta_id);
} }
out: out:
lq_cmd->ss_params = cpu_to_le32(ss_params); lq_cmd->ss_params = cpu_to_le32(ss_params);
...@@ -3744,7 +3745,7 @@ static ssize_t rs_sta_dbgfs_scale_table_read(struct file *file, ...@@ -3744,7 +3745,7 @@ static ssize_t rs_sta_dbgfs_scale_table_read(struct file *file,
struct iwl_lq_sta *lq_sta = file->private_data; struct iwl_lq_sta *lq_sta = file->private_data;
struct iwl_mvm_sta *mvmsta = struct iwl_mvm_sta *mvmsta =
container_of(lq_sta, struct iwl_mvm_sta, lq_sta.rs_drv); container_of(lq_sta, struct iwl_mvm_sta, deflink.lq_sta.rs_drv);
struct iwl_mvm *mvm; struct iwl_mvm *mvm;
struct iwl_scale_tbl_info *tbl = &(lq_sta->lq_info[lq_sta->active_tbl]); struct iwl_scale_tbl_info *tbl = &(lq_sta->lq_info[lq_sta->active_tbl]);
struct rs_rate *rate = &tbl->rate; struct rs_rate *rate = &tbl->rate;
...@@ -4045,7 +4046,8 @@ static void rs_drv_add_sta_debugfs(void *mvm, void *priv_sta, ...@@ -4045,7 +4046,8 @@ static void rs_drv_add_sta_debugfs(void *mvm, void *priv_sta,
struct iwl_lq_sta *lq_sta = priv_sta; struct iwl_lq_sta *lq_sta = priv_sta;
struct iwl_mvm_sta *mvmsta; struct iwl_mvm_sta *mvmsta;
mvmsta = container_of(lq_sta, struct iwl_mvm_sta, lq_sta.rs_drv); mvmsta = container_of(lq_sta, struct iwl_mvm_sta,
deflink.lq_sta.rs_drv);
if (!mvmsta->vif) if (!mvmsta->vif)
return; return;
...@@ -4102,9 +4104,9 @@ void iwl_mvm_rs_rate_init(struct iwl_mvm *mvm, struct ieee80211_sta *sta, ...@@ -4102,9 +4104,9 @@ void iwl_mvm_rs_rate_init(struct iwl_mvm *mvm, struct ieee80211_sta *sta,
} else { } else {
struct iwl_mvm_sta *mvmsta = iwl_mvm_sta_from_mac80211(sta); struct iwl_mvm_sta *mvmsta = iwl_mvm_sta_from_mac80211(sta);
spin_lock(&mvmsta->lq_sta.rs_drv.pers.lock); spin_lock(&mvmsta->deflink.lq_sta.rs_drv.pers.lock);
rs_drv_rate_init(mvm, sta, band); rs_drv_rate_init(mvm, sta, band);
spin_unlock(&mvmsta->lq_sta.rs_drv.pers.lock); spin_unlock(&mvmsta->deflink.lq_sta.rs_drv.pers.lock);
} }
} }
...@@ -4121,7 +4123,7 @@ void iwl_mvm_rate_control_unregister(void) ...@@ -4121,7 +4123,7 @@ void iwl_mvm_rate_control_unregister(void)
static int rs_drv_tx_protection(struct iwl_mvm *mvm, struct iwl_mvm_sta *mvmsta, static int rs_drv_tx_protection(struct iwl_mvm *mvm, struct iwl_mvm_sta *mvmsta,
bool enable) bool enable)
{ {
struct iwl_lq_cmd *lq = &mvmsta->lq_sta.rs_drv.lq; struct iwl_lq_cmd *lq = &mvmsta->deflink.lq_sta.rs_drv.lq;
lockdep_assert_held(&mvm->mutex); lockdep_assert_held(&mvm->mutex);
......
...@@ -241,7 +241,7 @@ static void iwl_mvm_rx_handle_tcm(struct iwl_mvm *mvm, ...@@ -241,7 +241,7 @@ static void iwl_mvm_rx_handle_tcm(struct iwl_mvm *mvm,
!mvmvif->deflink.queue_params[IEEE80211_AC_VI].uapsd && !mvmvif->deflink.queue_params[IEEE80211_AC_VI].uapsd &&
!mvmvif->deflink.queue_params[IEEE80211_AC_BE].uapsd && !mvmvif->deflink.queue_params[IEEE80211_AC_BE].uapsd &&
!mvmvif->deflink.queue_params[IEEE80211_AC_BK].uapsd) || !mvmvif->deflink.queue_params[IEEE80211_AC_BK].uapsd) ||
mvmsta->sta_id != mvmvif->deflink.ap_sta_id) mvmsta->deflink.sta_id != mvmvif->deflink.ap_sta_id)
return; return;
if (rate_n_flags & RATE_MCS_HT_MSK_V1) { if (rate_n_flags & RATE_MCS_HT_MSK_V1) {
...@@ -712,14 +712,14 @@ static void iwl_mvm_stats_energy_iter(void *_data, ...@@ -712,14 +712,14 @@ static void iwl_mvm_stats_energy_iter(void *_data,
{ {
struct iwl_mvm_sta *mvmsta = iwl_mvm_sta_from_mac80211(sta); struct iwl_mvm_sta *mvmsta = iwl_mvm_sta_from_mac80211(sta);
u8 *energy = _data; u8 *energy = _data;
u32 sta_id = mvmsta->sta_id; u32 sta_id = mvmsta->deflink.sta_id;
if (WARN_ONCE(sta_id >= IWL_MVM_STATION_COUNT_MAX, "sta_id %d >= %d", if (WARN_ONCE(sta_id >= IWL_MVM_STATION_COUNT_MAX, "sta_id %d >= %d",
sta_id, IWL_MVM_STATION_COUNT_MAX)) sta_id, IWL_MVM_STATION_COUNT_MAX))
return; return;
if (energy[sta_id]) if (energy[sta_id])
mvmsta->avg_energy = energy[sta_id]; mvmsta->deflink.avg_energy = energy[sta_id];
} }
......
...@@ -979,9 +979,10 @@ static bool iwl_mvm_reorder(struct iwl_mvm *mvm, ...@@ -979,9 +979,10 @@ static bool iwl_mvm_reorder(struct iwl_mvm *mvm,
return false; return false;
} }
if (WARN(tid != baid_data->tid || mvm_sta->sta_id != baid_data->sta_id, if (WARN(tid != baid_data->tid ||
mvm_sta->deflink.sta_id != baid_data->sta_id,
"baid 0x%x is mapped to sta:%d tid:%d, but was received for sta:%d tid:%d\n", "baid 0x%x is mapped to sta:%d tid:%d, but was received for sta:%d tid:%d\n",
baid, baid_data->sta_id, baid_data->tid, mvm_sta->sta_id, baid, baid_data->sta_id, baid_data->tid, mvm_sta->deflink.sta_id,
tid)) tid))
return false; return false;
......
...@@ -330,9 +330,27 @@ struct iwl_mvm_rxq_dup_data { ...@@ -330,9 +330,27 @@ struct iwl_mvm_rxq_dup_data {
u8 last_sub_frame[IWL_MAX_TID_COUNT + 1]; u8 last_sub_frame[IWL_MAX_TID_COUNT + 1];
} ____cacheline_aligned_in_smp; } ____cacheline_aligned_in_smp;
/**
* struct iwl_mvm_link_sta - link specific parameters of a station
* @rcu_head: used for freeing the data
* @sta_id: the index of the station in the fw
* @lq_sta: holds rate scaling data, either for the case when RS is done in
* the driver - %rs_drv or in the FW - %rs_fw.
* @avg_energy: energy as reported by FW statistics notification
*/
struct iwl_mvm_link_sta {
struct rcu_head rcu_head;
u32 sta_id;
union {
struct iwl_lq_sta_rs_fw rs_fw;
struct iwl_lq_sta rs_drv;
} lq_sta;
u8 avg_energy;
};
/** /**
* struct iwl_mvm_sta - representation of a station in the driver * struct iwl_mvm_sta - representation of a station in the driver
* @sta_id: the index of the station in the fw (will be replaced by id_n_color)
* @tfd_queue_msk: the tfd queues used by the station * @tfd_queue_msk: the tfd queues used by the station
* @mac_id_n_color: the MAC context this station is linked to * @mac_id_n_color: the MAC context this station is linked to
* @tid_disable_agg: bitmap: if bit(tid) is set, the fw won't send ampdus for * @tid_disable_agg: bitmap: if bit(tid) is set, the fw won't send ampdus for
...@@ -347,8 +365,6 @@ struct iwl_mvm_rxq_dup_data { ...@@ -347,8 +365,6 @@ struct iwl_mvm_rxq_dup_data {
* and from Tx response flow, it needs a spinlock. * and from Tx response flow, it needs a spinlock.
* @tid_data: per tid data + mgmt. Look at %iwl_mvm_tid_data. * @tid_data: per tid data + mgmt. Look at %iwl_mvm_tid_data.
* @tid_to_baid: a simple map of TID to baid * @tid_to_baid: a simple map of TID to baid
* @lq_sta: holds rate scaling data, either for the case when RS is done in
* the driver - %rs_drv or in the FW - %rs_fw.
* @reserved_queue: the queue reserved for this STA for DQA purposes * @reserved_queue: the queue reserved for this STA for DQA purposes
* Every STA has is given one reserved queue to allow it to operate. If no * Every STA has is given one reserved queue to allow it to operate. If no
* such queue can be guaranteed, the STA addition will fail. * such queue can be guaranteed, the STA addition will fail.
...@@ -374,6 +390,12 @@ struct iwl_mvm_rxq_dup_data { ...@@ -374,6 +390,12 @@ struct iwl_mvm_rxq_dup_data {
* used during connection establishment (e.g. for the 4 way handshake * used during connection establishment (e.g. for the 4 way handshake
* exchange). * exchange).
* @pairwise_cipher: used to feed iwlmei upon authorization * @pairwise_cipher: used to feed iwlmei upon authorization
* @deflink: the default link station, for non-MLO STA, all link specific data
* is accessed via deflink (or link[0]). For MLO, it will hold data of the
* first added link STA.
* @link: per link sta entries. For non-MLO only link[0] holds data. For MLO,
* link[0] points to deflink and link[link_id] is allocated when new link
* sta is added.
* *
* When mac80211 creates a station it reserves some space (hw->sta_data_size) * When mac80211 creates a station it reserves some space (hw->sta_data_size)
* in the structure for use by driver. This structure is placed in that * in the structure for use by driver. This structure is placed in that
...@@ -381,7 +403,6 @@ struct iwl_mvm_rxq_dup_data { ...@@ -381,7 +403,6 @@ struct iwl_mvm_rxq_dup_data {
* *
*/ */
struct iwl_mvm_sta { struct iwl_mvm_sta {
u32 sta_id;
u32 tfd_queue_msk; u32 tfd_queue_msk;
u32 mac_id_n_color; u32 mac_id_n_color;
u16 tid_disable_agg; u16 tid_disable_agg;
...@@ -393,10 +414,6 @@ struct iwl_mvm_sta { ...@@ -393,10 +414,6 @@ struct iwl_mvm_sta {
spinlock_t lock; spinlock_t lock;
struct iwl_mvm_tid_data tid_data[IWL_MAX_TID_COUNT + 1]; struct iwl_mvm_tid_data tid_data[IWL_MAX_TID_COUNT + 1];
u8 tid_to_baid[IWL_MAX_TID_COUNT]; u8 tid_to_baid[IWL_MAX_TID_COUNT];
union {
struct iwl_lq_sta_rs_fw rs_fw;
struct iwl_lq_sta rs_drv;
} lq_sta;
struct ieee80211_vif *vif; struct ieee80211_vif *vif;
struct iwl_mvm_key_pn __rcu *ptk_pn[4]; struct iwl_mvm_key_pn __rcu *ptk_pn[4];
struct iwl_mvm_rxq_dup_data *dup_data; struct iwl_mvm_rxq_dup_data *dup_data;
...@@ -414,9 +431,11 @@ struct iwl_mvm_sta { ...@@ -414,9 +431,11 @@ struct iwl_mvm_sta {
bool sleeping; bool sleeping;
u8 agg_tids; u8 agg_tids;
u8 sleep_tx_count; u8 sleep_tx_count;
u8 avg_energy;
u8 tx_ant; u8 tx_ant;
u32 pairwise_cipher; u32 pairwise_cipher;
struct iwl_mvm_link_sta deflink;
struct iwl_mvm_link_sta __rcu *link[IEEE80211_MLD_MAX_NUM_LINKS];
}; };
u16 iwl_mvm_tid_queued(struct iwl_mvm *mvm, struct iwl_mvm_tid_data *tid_data); u16 iwl_mvm_tid_queued(struct iwl_mvm *mvm, struct iwl_mvm_tid_data *tid_data);
......
...@@ -369,7 +369,7 @@ iwl_mvm_tdls_config_channel_switch(struct iwl_mvm *mvm, ...@@ -369,7 +369,7 @@ iwl_mvm_tdls_config_channel_switch(struct iwl_mvm *mvm,
goto out; goto out;
} }
mvmsta = iwl_mvm_sta_from_mac80211(sta); mvmsta = iwl_mvm_sta_from_mac80211(sta);
cmd.peer_sta_id = cpu_to_le32(mvmsta->sta_id); cmd.peer_sta_id = cpu_to_le32(mvmsta->deflink.sta_id);
if (!chandef) { if (!chandef) {
if (mvm->tdls_cs.state == IWL_MVM_TDLS_SW_REQ_SENT && if (mvm->tdls_cs.state == IWL_MVM_TDLS_SW_REQ_SENT &&
...@@ -414,7 +414,7 @@ iwl_mvm_tdls_config_channel_switch(struct iwl_mvm *mvm, ...@@ -414,7 +414,7 @@ iwl_mvm_tdls_config_channel_switch(struct iwl_mvm *mvm,
} }
iwl_mvm_set_tx_cmd(mvm, skb, &tail->frame.tx_cmd, info, iwl_mvm_set_tx_cmd(mvm, skb, &tail->frame.tx_cmd, info,
mvmsta->sta_id); mvmsta->deflink.sta_id);
iwl_mvm_set_tx_cmd_rate(mvm, &tail->frame.tx_cmd, info, sta, iwl_mvm_set_tx_cmd_rate(mvm, &tail->frame.tx_cmd, info, sta,
hdr->frame_control); hdr->frame_control);
...@@ -431,7 +431,7 @@ iwl_mvm_tdls_config_channel_switch(struct iwl_mvm *mvm, ...@@ -431,7 +431,7 @@ iwl_mvm_tdls_config_channel_switch(struct iwl_mvm *mvm,
/* channel switch has started, update state */ /* channel switch has started, update state */
if (type != TDLS_MOVE_CH) { if (type != TDLS_MOVE_CH) {
mvm->tdls_cs.cur_sta_id = mvmsta->sta_id; mvm->tdls_cs.cur_sta_id = mvmsta->deflink.sta_id;
iwl_mvm_tdls_update_cs_state(mvm, iwl_mvm_tdls_update_cs_state(mvm,
type == TDLS_SEND_CHAN_SW_REQ ? type == TDLS_SEND_CHAN_SW_REQ ?
IWL_MVM_TDLS_SW_REQ_SENT : IWL_MVM_TDLS_SW_REQ_SENT :
...@@ -541,7 +541,7 @@ iwl_mvm_tdls_channel_switch(struct ieee80211_hw *hw, ...@@ -541,7 +541,7 @@ iwl_mvm_tdls_channel_switch(struct ieee80211_hw *hw,
} }
mvmsta = iwl_mvm_sta_from_mac80211(sta); mvmsta = iwl_mvm_sta_from_mac80211(sta);
mvm->tdls_cs.peer.sta_id = mvmsta->sta_id; mvm->tdls_cs.peer.sta_id = mvmsta->deflink.sta_id;
mvm->tdls_cs.peer.chandef = *chandef; mvm->tdls_cs.peer.chandef = *chandef;
mvm->tdls_cs.peer.initiator = sta->tdls_initiator; mvm->tdls_cs.peer.initiator = sta->tdls_initiator;
mvm->tdls_cs.peer.op_class = oper_class; mvm->tdls_cs.peer.op_class = oper_class;
......
...@@ -1084,7 +1084,7 @@ static int iwl_mvm_tx_mpdu(struct iwl_mvm *mvm, struct sk_buff *skb, ...@@ -1084,7 +1084,7 @@ static int iwl_mvm_tx_mpdu(struct iwl_mvm *mvm, struct sk_buff *skb,
if (WARN_ON_ONCE(!mvmsta)) if (WARN_ON_ONCE(!mvmsta))
return -1; return -1;
if (WARN_ON_ONCE(mvmsta->sta_id == IWL_MVM_INVALID_STA)) if (WARN_ON_ONCE(mvmsta->deflink.sta_id == IWL_MVM_INVALID_STA))
return -1; return -1;
if (unlikely(ieee80211_is_any_nullfunc(fc)) && sta->deflink.he_cap.has_he) if (unlikely(ieee80211_is_any_nullfunc(fc)) && sta->deflink.he_cap.has_he)
...@@ -1094,7 +1094,7 @@ static int iwl_mvm_tx_mpdu(struct iwl_mvm *mvm, struct sk_buff *skb, ...@@ -1094,7 +1094,7 @@ static int iwl_mvm_tx_mpdu(struct iwl_mvm *mvm, struct sk_buff *skb,
iwl_mvm_probe_resp_set_noa(mvm, skb); iwl_mvm_probe_resp_set_noa(mvm, skb);
dev_cmd = iwl_mvm_set_tx_params(mvm, skb, info, hdrlen, dev_cmd = iwl_mvm_set_tx_params(mvm, skb, info, hdrlen,
sta, mvmsta->sta_id); sta, mvmsta->deflink.sta_id);
if (!dev_cmd) if (!dev_cmd)
goto drop; goto drop;
...@@ -1170,7 +1170,7 @@ static int iwl_mvm_tx_mpdu(struct iwl_mvm *mvm, struct sk_buff *skb, ...@@ -1170,7 +1170,7 @@ static int iwl_mvm_tx_mpdu(struct iwl_mvm *mvm, struct sk_buff *skb,
} }
IWL_DEBUG_TX(mvm, "TX to [%d|%d] Q:%d - seq: 0x%x len %d\n", IWL_DEBUG_TX(mvm, "TX to [%d|%d] Q:%d - seq: 0x%x len %d\n",
mvmsta->sta_id, tid, txq_id, mvmsta->deflink.sta_id, tid, txq_id,
IEEE80211_SEQ_TO_SN(seq_number), skb->len); IEEE80211_SEQ_TO_SN(seq_number), skb->len);
/* From now on, we cannot access info->control */ /* From now on, we cannot access info->control */
...@@ -1205,7 +1205,8 @@ static int iwl_mvm_tx_mpdu(struct iwl_mvm *mvm, struct sk_buff *skb, ...@@ -1205,7 +1205,8 @@ static int iwl_mvm_tx_mpdu(struct iwl_mvm *mvm, struct sk_buff *skb,
iwl_trans_free_tx_cmd(mvm->trans, dev_cmd); iwl_trans_free_tx_cmd(mvm->trans, dev_cmd);
spin_unlock(&mvmsta->lock); spin_unlock(&mvmsta->lock);
drop: drop:
IWL_DEBUG_TX(mvm, "TX to [%d|%d] dropped\n", mvmsta->sta_id, tid); IWL_DEBUG_TX(mvm, "TX to [%d|%d] dropped\n", mvmsta->deflink.sta_id,
tid);
return -1; return -1;
} }
...@@ -1222,7 +1223,7 @@ int iwl_mvm_tx_skb_sta(struct iwl_mvm *mvm, struct sk_buff *skb, ...@@ -1222,7 +1223,7 @@ int iwl_mvm_tx_skb_sta(struct iwl_mvm *mvm, struct sk_buff *skb,
if (WARN_ON_ONCE(!mvmsta)) if (WARN_ON_ONCE(!mvmsta))
return -1; return -1;
if (WARN_ON_ONCE(mvmsta->sta_id == IWL_MVM_INVALID_STA)) if (WARN_ON_ONCE(mvmsta->deflink.sta_id == IWL_MVM_INVALID_STA))
return -1; return -1;
memcpy(&info, skb->cb, sizeof(info)); memcpy(&info, skb->cb, sizeof(info));
...@@ -2230,17 +2231,22 @@ int iwl_mvm_flush_sta_tids(struct iwl_mvm *mvm, u32 sta_id, u16 tids) ...@@ -2230,17 +2231,22 @@ int iwl_mvm_flush_sta_tids(struct iwl_mvm *mvm, u32 sta_id, u16 tids)
int iwl_mvm_flush_sta(struct iwl_mvm *mvm, void *sta, bool internal) int iwl_mvm_flush_sta(struct iwl_mvm *mvm, void *sta, bool internal)
{ {
struct iwl_mvm_int_sta *int_sta = sta; u32 sta_id, tfd_queue_msk;
struct iwl_mvm_sta *mvm_sta = sta;
BUILD_BUG_ON(offsetof(struct iwl_mvm_int_sta, sta_id) != if (internal) {
offsetof(struct iwl_mvm_sta, sta_id)); struct iwl_mvm_int_sta *int_sta = sta;
if (iwl_mvm_has_new_tx_api(mvm)) sta_id = int_sta->sta_id;
return iwl_mvm_flush_sta_tids(mvm, mvm_sta->sta_id, 0xffff); tfd_queue_msk = int_sta->tfd_queue_msk;
} else {
struct iwl_mvm_sta *mvm_sta = sta;
if (internal) sta_id = mvm_sta->deflink.sta_id;
return iwl_mvm_flush_tx_path(mvm, int_sta->tfd_queue_msk); tfd_queue_msk = mvm_sta->tfd_queue_msk;
}
if (iwl_mvm_has_new_tx_api(mvm))
return iwl_mvm_flush_sta_tids(mvm, sta_id, 0xffff);
return iwl_mvm_flush_tx_path(mvm, mvm_sta->tfd_queue_msk); return iwl_mvm_flush_tx_path(mvm, tfd_queue_msk);
} }
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment