Commit 32a5690e authored by Johannes Berg's avatar Johannes Berg

wifi: iwlwifi: mvm: support wider-bandwidth OFDMA

To support wider-bandwidth OFDMA we need to configure the
PHY context in the firmware, which will in turn configure
the DSP accordingly. Pass the relevant information down.
Signed-off-by: default avatarJohannes Berg <johannes.berg@intel.com>
Signed-off-by: default avatarMiri Korenblit <miriam.rachel.korenblit@intel.com>
Link: https://msgid.link/20240218194912.ca666ede5dd6.I357972823d20e9045e2c97dbb7ac24fe9f5a6e41@changeidSigned-off-by: default avatarJohannes Berg <johannes.berg@intel.com>
parent 894dd84e
...@@ -720,7 +720,7 @@ static int iwl_mvm_d3_reprogram(struct iwl_mvm *mvm, struct ieee80211_vif *vif, ...@@ -720,7 +720,7 @@ static int iwl_mvm_d3_reprogram(struct iwl_mvm *mvm, struct ieee80211_vif *vif,
struct iwl_mvm_vif *mvmvif = iwl_mvm_vif_from_mac80211(vif); struct iwl_mvm_vif *mvmvif = iwl_mvm_vif_from_mac80211(vif);
struct ieee80211_chanctx_conf *ctx; struct ieee80211_chanctx_conf *ctx;
u8 chains_static, chains_dynamic; u8 chains_static, chains_dynamic;
struct cfg80211_chan_def chandef; struct cfg80211_chan_def chandef, ap_def;
int ret, i; int ret, i;
struct iwl_binding_cmd_v1 binding_cmd = {}; struct iwl_binding_cmd_v1 binding_cmd = {};
struct iwl_time_quota_cmd quota_cmd = {}; struct iwl_time_quota_cmd quota_cmd = {};
...@@ -742,12 +742,13 @@ static int iwl_mvm_d3_reprogram(struct iwl_mvm *mvm, struct ieee80211_vif *vif, ...@@ -742,12 +742,13 @@ static int iwl_mvm_d3_reprogram(struct iwl_mvm *mvm, struct ieee80211_vif *vif,
return -EINVAL; return -EINVAL;
} }
chandef = ctx->def; chandef = ctx->def;
ap_def = ctx->ap;
chains_static = ctx->rx_chains_static; chains_static = ctx->rx_chains_static;
chains_dynamic = ctx->rx_chains_dynamic; chains_dynamic = ctx->rx_chains_dynamic;
rcu_read_unlock(); rcu_read_unlock();
ret = iwl_mvm_phy_ctxt_add(mvm, mvmvif->deflink.phy_ctxt, &chandef, ret = iwl_mvm_phy_ctxt_add(mvm, mvmvif->deflink.phy_ctxt, &chandef,
chains_static, chains_dynamic); &ap_def, chains_static, chains_dynamic);
if (ret) if (ret)
return ret; return ret;
......
...@@ -592,7 +592,7 @@ static ssize_t iwl_dbgfs_rx_phyinfo_write(struct ieee80211_vif *vif, char *buf, ...@@ -592,7 +592,7 @@ static ssize_t iwl_dbgfs_rx_phyinfo_write(struct ieee80211_vif *vif, char *buf,
for_each_vif_active_link(vif, link_conf, link_id) { for_each_vif_active_link(vif, link_conf, link_id) {
struct ieee80211_chanctx_conf *chanctx_conf; struct ieee80211_chanctx_conf *chanctx_conf;
struct cfg80211_chan_def min_def; struct cfg80211_chan_def min_def, ap_def;
struct iwl_mvm_phy_ctxt *phy_ctxt; struct iwl_mvm_phy_ctxt *phy_ctxt;
u8 chains_static, chains_dynamic; u8 chains_static, chains_dynamic;
...@@ -606,6 +606,7 @@ static ssize_t iwl_dbgfs_rx_phyinfo_write(struct ieee80211_vif *vif, char *buf, ...@@ -606,6 +606,7 @@ static ssize_t iwl_dbgfs_rx_phyinfo_write(struct ieee80211_vif *vif, char *buf,
* everything here and use it after unlocking * everything here and use it after unlocking
*/ */
min_def = chanctx_conf->min_def; min_def = chanctx_conf->min_def;
ap_def = chanctx_conf->ap;
chains_static = chanctx_conf->rx_chains_static; chains_static = chanctx_conf->rx_chains_static;
chains_dynamic = chanctx_conf->rx_chains_dynamic; chains_dynamic = chanctx_conf->rx_chains_dynamic;
rcu_read_unlock(); rcu_read_unlock();
...@@ -614,7 +615,7 @@ static ssize_t iwl_dbgfs_rx_phyinfo_write(struct ieee80211_vif *vif, char *buf, ...@@ -614,7 +615,7 @@ static ssize_t iwl_dbgfs_rx_phyinfo_write(struct ieee80211_vif *vif, char *buf,
if (!phy_ctxt) if (!phy_ctxt)
continue; continue;
ret = iwl_mvm_phy_ctxt_changed(mvm, phy_ctxt, &min_def, ret = iwl_mvm_phy_ctxt_changed(mvm, phy_ctxt, &min_def, &ap_def,
chains_static, chains_dynamic); chains_static, chains_dynamic);
} }
......
...@@ -438,7 +438,7 @@ int iwl_mvm_ftm_start_responder(struct iwl_mvm *mvm, struct ieee80211_vif *vif, ...@@ -438,7 +438,7 @@ int iwl_mvm_ftm_start_responder(struct iwl_mvm *mvm, struct ieee80211_vif *vif,
rcu_read_unlock(); rcu_read_unlock();
phy_ctxt = &mvm->phy_ctxts[*phy_ctxt_id]; phy_ctxt = &mvm->phy_ctxts[*phy_ctxt_id];
ret = iwl_mvm_phy_ctxt_changed(mvm, phy_ctxt, &ctx.def, ret = iwl_mvm_phy_ctxt_changed(mvm, phy_ctxt, &ctx.def, &ctx.ap,
ctx.rx_chains_static, ctx.rx_chains_static,
ctx.rx_chains_dynamic); ctx.rx_chains_dynamic);
if (ret) if (ret)
......
...@@ -1644,6 +1644,9 @@ static int iwl_mvm_mac_add_interface(struct ieee80211_hw *hw, ...@@ -1644,6 +1644,9 @@ static int iwl_mvm_mac_add_interface(struct ieee80211_hw *hw,
IEEE80211_VIF_SUPPORTS_CQM_RSSI; IEEE80211_VIF_SUPPORTS_CQM_RSSI;
} }
if (vif->p2p || iwl_fw_lookup_cmd_ver(mvm->fw, PHY_CONTEXT_CMD, 1) < 5)
vif->driver_flags |= IEEE80211_VIF_IGNORE_OFDMA_WIDER_BW;
if (vif->type == NL80211_IFTYPE_P2P_DEVICE) if (vif->type == NL80211_IFTYPE_P2P_DEVICE)
mvm->p2p_device_vif = vif; mvm->p2p_device_vif = vif;
...@@ -4651,7 +4654,7 @@ static int iwl_mvm_p2p_find_phy_ctxt(struct iwl_mvm *mvm, ...@@ -4651,7 +4654,7 @@ static int iwl_mvm_p2p_find_phy_ctxt(struct iwl_mvm *mvm,
cfg80211_chandef_create(&chandef, channel, NL80211_CHAN_NO_HT); cfg80211_chandef_create(&chandef, channel, NL80211_CHAN_NO_HT);
return iwl_mvm_phy_ctxt_add(mvm, mvmvif->deflink.phy_ctxt, return iwl_mvm_phy_ctxt_add(mvm, mvmvif->deflink.phy_ctxt,
&chandef, 1, 1); &chandef, NULL, 1, 1);
} }
/* Execute the common part for MLD and non-MLD modes */ /* Execute the common part for MLD and non-MLD modes */
...@@ -4772,7 +4775,7 @@ static int __iwl_mvm_add_chanctx(struct iwl_mvm *mvm, ...@@ -4772,7 +4775,7 @@ static int __iwl_mvm_add_chanctx(struct iwl_mvm *mvm,
goto out; goto out;
} }
ret = iwl_mvm_phy_ctxt_add(mvm, phy_ctxt, def, ret = iwl_mvm_phy_ctxt_add(mvm, phy_ctxt, def, &ctx->ap,
ctx->rx_chains_static, ctx->rx_chains_static,
ctx->rx_chains_dynamic); ctx->rx_chains_dynamic);
if (ret) { if (ret) {
...@@ -4850,7 +4853,7 @@ void iwl_mvm_change_chanctx(struct ieee80211_hw *hw, ...@@ -4850,7 +4853,7 @@ void iwl_mvm_change_chanctx(struct ieee80211_hw *hw,
} }
iwl_mvm_bt_coex_vif_change(mvm); iwl_mvm_bt_coex_vif_change(mvm);
iwl_mvm_phy_ctxt_changed(mvm, phy_ctxt, def, iwl_mvm_phy_ctxt_changed(mvm, phy_ctxt, def, &ctx->ap,
ctx->rx_chains_static, ctx->rx_chains_static,
ctx->rx_chains_dynamic); ctx->rx_chains_dynamic);
......
...@@ -1810,9 +1810,11 @@ void iwl_mvm_rx_shared_mem_cfg_notif(struct iwl_mvm *mvm, ...@@ -1810,9 +1810,11 @@ void iwl_mvm_rx_shared_mem_cfg_notif(struct iwl_mvm *mvm,
struct iwl_mvm_phy_ctxt *iwl_mvm_get_free_phy_ctxt(struct iwl_mvm *mvm); struct iwl_mvm_phy_ctxt *iwl_mvm_get_free_phy_ctxt(struct iwl_mvm *mvm);
int iwl_mvm_phy_ctxt_add(struct iwl_mvm *mvm, struct iwl_mvm_phy_ctxt *ctxt, int iwl_mvm_phy_ctxt_add(struct iwl_mvm *mvm, struct iwl_mvm_phy_ctxt *ctxt,
const struct cfg80211_chan_def *chandef, const struct cfg80211_chan_def *chandef,
const struct cfg80211_chan_def *ap,
u8 chains_static, u8 chains_dynamic); u8 chains_static, u8 chains_dynamic);
int iwl_mvm_phy_ctxt_changed(struct iwl_mvm *mvm, struct iwl_mvm_phy_ctxt *ctxt, int iwl_mvm_phy_ctxt_changed(struct iwl_mvm *mvm, struct iwl_mvm_phy_ctxt *ctxt,
const struct cfg80211_chan_def *chandef, const struct cfg80211_chan_def *chandef,
const struct cfg80211_chan_def *ap,
u8 chains_static, u8 chains_dynamic); u8 chains_static, u8 chains_dynamic);
void iwl_mvm_phy_ctxt_ref(struct iwl_mvm *mvm, void iwl_mvm_phy_ctxt_ref(struct iwl_mvm *mvm,
struct iwl_mvm_phy_ctxt *ctxt); struct iwl_mvm_phy_ctxt *ctxt);
......
...@@ -198,12 +198,16 @@ int iwl_mvm_phy_send_rlc(struct iwl_mvm *mvm, struct iwl_mvm_phy_ctxt *ctxt, ...@@ -198,12 +198,16 @@ int iwl_mvm_phy_send_rlc(struct iwl_mvm *mvm, struct iwl_mvm_phy_ctxt *ctxt,
static int iwl_mvm_phy_ctxt_apply(struct iwl_mvm *mvm, static int iwl_mvm_phy_ctxt_apply(struct iwl_mvm *mvm,
struct iwl_mvm_phy_ctxt *ctxt, struct iwl_mvm_phy_ctxt *ctxt,
const struct cfg80211_chan_def *chandef, const struct cfg80211_chan_def *chandef,
const struct cfg80211_chan_def *ap,
u8 chains_static, u8 chains_dynamic, u8 chains_static, u8 chains_dynamic,
u32 action) u32 action)
{ {
int ret; int ret;
int ver = iwl_fw_lookup_cmd_ver(mvm->fw, PHY_CONTEXT_CMD, 1); int ver = iwl_fw_lookup_cmd_ver(mvm->fw, PHY_CONTEXT_CMD, 1);
if (ver < 5 || !ap || !ap->chan)
ap = NULL;
if (ver >= 3 && ver <= 5) { if (ver >= 3 && ver <= 5) {
struct iwl_phy_context_cmd cmd = {}; struct iwl_phy_context_cmd cmd = {};
...@@ -215,6 +219,11 @@ static int iwl_mvm_phy_ctxt_apply(struct iwl_mvm *mvm, ...@@ -215,6 +219,11 @@ static int iwl_mvm_phy_ctxt_apply(struct iwl_mvm *mvm,
chains_static, chains_static,
chains_dynamic); chains_dynamic);
if (ap) {
cmd.v5.sbb_bandwidth = iwl_mvm_get_channel_width(ap);
cmd.v5.sbb_ctrl_channel_loc = iwl_mvm_get_ctrl_pos(ap);
}
ret = iwl_mvm_send_cmd_pdu(mvm, PHY_CONTEXT_CMD, ret = iwl_mvm_send_cmd_pdu(mvm, PHY_CONTEXT_CMD,
0, sizeof(cmd), &cmd); 0, sizeof(cmd), &cmd);
} else if (ver < 3) { } else if (ver < 3) {
...@@ -255,6 +264,7 @@ static int iwl_mvm_phy_ctxt_apply(struct iwl_mvm *mvm, ...@@ -255,6 +264,7 @@ static int iwl_mvm_phy_ctxt_apply(struct iwl_mvm *mvm,
*/ */
int iwl_mvm_phy_ctxt_add(struct iwl_mvm *mvm, struct iwl_mvm_phy_ctxt *ctxt, int iwl_mvm_phy_ctxt_add(struct iwl_mvm *mvm, struct iwl_mvm_phy_ctxt *ctxt,
const struct cfg80211_chan_def *chandef, const struct cfg80211_chan_def *chandef,
const struct cfg80211_chan_def *ap,
u8 chains_static, u8 chains_dynamic) u8 chains_static, u8 chains_dynamic)
{ {
int ret; int ret;
...@@ -267,7 +277,7 @@ int iwl_mvm_phy_ctxt_add(struct iwl_mvm *mvm, struct iwl_mvm_phy_ctxt *ctxt, ...@@ -267,7 +277,7 @@ int iwl_mvm_phy_ctxt_add(struct iwl_mvm *mvm, struct iwl_mvm_phy_ctxt *ctxt,
ctxt->width = chandef->width; ctxt->width = chandef->width;
ctxt->center_freq1 = chandef->center_freq1; ctxt->center_freq1 = chandef->center_freq1;
ret = iwl_mvm_phy_ctxt_apply(mvm, ctxt, chandef, ret = iwl_mvm_phy_ctxt_apply(mvm, ctxt, chandef, ap,
chains_static, chains_dynamic, chains_static, chains_dynamic,
FW_CTXT_ACTION_ADD); FW_CTXT_ACTION_ADD);
...@@ -301,6 +311,7 @@ void iwl_mvm_phy_ctxt_ref(struct iwl_mvm *mvm, struct iwl_mvm_phy_ctxt *ctxt) ...@@ -301,6 +311,7 @@ void iwl_mvm_phy_ctxt_ref(struct iwl_mvm *mvm, struct iwl_mvm_phy_ctxt *ctxt)
*/ */
int iwl_mvm_phy_ctxt_changed(struct iwl_mvm *mvm, struct iwl_mvm_phy_ctxt *ctxt, int iwl_mvm_phy_ctxt_changed(struct iwl_mvm *mvm, struct iwl_mvm_phy_ctxt *ctxt,
const struct cfg80211_chan_def *chandef, const struct cfg80211_chan_def *chandef,
const struct cfg80211_chan_def *ap,
u8 chains_static, u8 chains_dynamic) u8 chains_static, u8 chains_dynamic)
{ {
enum iwl_ctxt_action action = FW_CTXT_ACTION_MODIFY; enum iwl_ctxt_action action = FW_CTXT_ACTION_MODIFY;
...@@ -324,7 +335,7 @@ int iwl_mvm_phy_ctxt_changed(struct iwl_mvm *mvm, struct iwl_mvm_phy_ctxt *ctxt, ...@@ -324,7 +335,7 @@ int iwl_mvm_phy_ctxt_changed(struct iwl_mvm *mvm, struct iwl_mvm_phy_ctxt *ctxt,
int ret; int ret;
/* ... remove it here ...*/ /* ... remove it here ...*/
ret = iwl_mvm_phy_ctxt_apply(mvm, ctxt, chandef, ret = iwl_mvm_phy_ctxt_apply(mvm, ctxt, chandef, NULL,
chains_static, chains_dynamic, chains_static, chains_dynamic,
FW_CTXT_ACTION_REMOVE); FW_CTXT_ACTION_REMOVE);
if (ret) if (ret)
...@@ -338,7 +349,7 @@ int iwl_mvm_phy_ctxt_changed(struct iwl_mvm *mvm, struct iwl_mvm_phy_ctxt *ctxt, ...@@ -338,7 +349,7 @@ int iwl_mvm_phy_ctxt_changed(struct iwl_mvm *mvm, struct iwl_mvm_phy_ctxt *ctxt,
ctxt->width = chandef->width; ctxt->width = chandef->width;
ctxt->center_freq1 = chandef->center_freq1; ctxt->center_freq1 = chandef->center_freq1;
return iwl_mvm_phy_ctxt_apply(mvm, ctxt, chandef, return iwl_mvm_phy_ctxt_apply(mvm, ctxt, chandef, ap,
chains_static, chains_dynamic, chains_static, chains_dynamic,
action); action);
} }
...@@ -358,7 +369,7 @@ void iwl_mvm_phy_ctxt_unref(struct iwl_mvm *mvm, struct iwl_mvm_phy_ctxt *ctxt) ...@@ -358,7 +369,7 @@ void iwl_mvm_phy_ctxt_unref(struct iwl_mvm *mvm, struct iwl_mvm_phy_ctxt *ctxt)
cfg80211_chandef_create(&chandef, ctxt->channel, NL80211_CHAN_NO_HT); cfg80211_chandef_create(&chandef, ctxt->channel, NL80211_CHAN_NO_HT);
iwl_mvm_phy_ctxt_apply(mvm, ctxt, &chandef, 1, 1, iwl_mvm_phy_ctxt_apply(mvm, ctxt, &chandef, NULL, 1, 1,
FW_CTXT_ACTION_REMOVE); FW_CTXT_ACTION_REMOVE);
} }
......
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