Commit 0aa5e96c authored by Sean Wang's avatar Sean Wang Committed by Felix Fietkau

wifi: mt76: mt7925: extend mt7925_mcu_[abort, set]_roc for per-link BSS

The channel context has to be bound with the per-link BSS, thus,
we extend mt7925_mcu_[abort, set]_roc to work with the per-link BSS
configuration.

The patch we created is a prerequisite to enable the MLO function in the
driver. It is purely a refactoring patch so the functionality should
remain unchanged.
Co-developed-by: default avatarDeren Wu <deren.wu@mediatek.com>
Signed-off-by: default avatarDeren Wu <deren.wu@mediatek.com>
Signed-off-by: default avatarSean Wang <sean.wang@mediatek.com>
Link: https://patch.msgid.link/20240613030241.5771-20-sean.wang@kernel.orgSigned-off-by: default avatarFelix Fietkau <nbd@nbd.name>
parent b6749ee8
...@@ -387,7 +387,7 @@ static void mt7925_roc_iter(void *priv, u8 *mac, ...@@ -387,7 +387,7 @@ static void mt7925_roc_iter(void *priv, u8 *mac,
struct mt792x_vif *mvif = (struct mt792x_vif *)vif->drv_priv; struct mt792x_vif *mvif = (struct mt792x_vif *)vif->drv_priv;
struct mt792x_phy *phy = priv; struct mt792x_phy *phy = priv;
mt7925_mcu_abort_roc(phy, mvif, phy->roc_token_id); mt7925_mcu_abort_roc(phy, &mvif->bss_conf, phy->roc_token_id);
} }
void mt7925_roc_work(struct work_struct *work) void mt7925_roc_work(struct work_struct *work)
...@@ -408,7 +408,8 @@ void mt7925_roc_work(struct work_struct *work) ...@@ -408,7 +408,8 @@ void mt7925_roc_work(struct work_struct *work)
ieee80211_remain_on_channel_expired(phy->mt76->hw); ieee80211_remain_on_channel_expired(phy->mt76->hw);
} }
static int mt7925_abort_roc(struct mt792x_phy *phy, struct mt792x_vif *vif) static int mt7925_abort_roc(struct mt792x_phy *phy,
struct mt792x_bss_conf *mconf)
{ {
int err = 0; int err = 0;
...@@ -417,14 +418,14 @@ static int mt7925_abort_roc(struct mt792x_phy *phy, struct mt792x_vif *vif) ...@@ -417,14 +418,14 @@ static int mt7925_abort_roc(struct mt792x_phy *phy, struct mt792x_vif *vif)
mt792x_mutex_acquire(phy->dev); mt792x_mutex_acquire(phy->dev);
if (test_and_clear_bit(MT76_STATE_ROC, &phy->mt76->state)) if (test_and_clear_bit(MT76_STATE_ROC, &phy->mt76->state))
err = mt7925_mcu_abort_roc(phy, vif, phy->roc_token_id); err = mt7925_mcu_abort_roc(phy, mconf, phy->roc_token_id);
mt792x_mutex_release(phy->dev); mt792x_mutex_release(phy->dev);
return err; return err;
} }
static int mt7925_set_roc(struct mt792x_phy *phy, static int mt7925_set_roc(struct mt792x_phy *phy,
struct mt792x_vif *vif, struct mt792x_bss_conf *mconf,
struct ieee80211_channel *chan, struct ieee80211_channel *chan,
int duration, int duration,
enum mt7925_roc_req type) enum mt7925_roc_req type)
...@@ -436,7 +437,7 @@ static int mt7925_set_roc(struct mt792x_phy *phy, ...@@ -436,7 +437,7 @@ static int mt7925_set_roc(struct mt792x_phy *phy,
phy->roc_grant = false; phy->roc_grant = false;
err = mt7925_mcu_set_roc(phy, vif, chan, duration, type, err = mt7925_mcu_set_roc(phy, mconf, chan, duration, type,
++phy->roc_token_id); ++phy->roc_token_id);
if (err < 0) { if (err < 0) {
clear_bit(MT76_STATE_ROC, &phy->mt76->state); clear_bit(MT76_STATE_ROC, &phy->mt76->state);
...@@ -444,7 +445,7 @@ static int mt7925_set_roc(struct mt792x_phy *phy, ...@@ -444,7 +445,7 @@ static int mt7925_set_roc(struct mt792x_phy *phy,
} }
if (!wait_event_timeout(phy->roc_wait, phy->roc_grant, 4 * HZ)) { if (!wait_event_timeout(phy->roc_wait, phy->roc_grant, 4 * HZ)) {
mt7925_mcu_abort_roc(phy, vif, phy->roc_token_id); mt7925_mcu_abort_roc(phy, mconf, phy->roc_token_id);
clear_bit(MT76_STATE_ROC, &phy->mt76->state); clear_bit(MT76_STATE_ROC, &phy->mt76->state);
err = -ETIMEDOUT; err = -ETIMEDOUT;
} }
...@@ -464,7 +465,8 @@ static int mt7925_remain_on_channel(struct ieee80211_hw *hw, ...@@ -464,7 +465,8 @@ static int mt7925_remain_on_channel(struct ieee80211_hw *hw,
int err; int err;
mt792x_mutex_acquire(phy->dev); mt792x_mutex_acquire(phy->dev);
err = mt7925_set_roc(phy, mvif, chan, duration, MT7925_ROC_REQ_ROC); err = mt7925_set_roc(phy, &mvif->bss_conf,
chan, duration, MT7925_ROC_REQ_ROC);
mt792x_mutex_release(phy->dev); mt792x_mutex_release(phy->dev);
return err; return err;
...@@ -476,7 +478,7 @@ static int mt7925_cancel_remain_on_channel(struct ieee80211_hw *hw, ...@@ -476,7 +478,7 @@ static int mt7925_cancel_remain_on_channel(struct ieee80211_hw *hw,
struct mt792x_vif *mvif = (struct mt792x_vif *)vif->drv_priv; struct mt792x_vif *mvif = (struct mt792x_vif *)vif->drv_priv;
struct mt792x_phy *phy = mt792x_hw_phy(hw); struct mt792x_phy *phy = mt792x_hw_phy(hw);
return mt7925_abort_roc(phy, mvif); return mt7925_abort_roc(phy, &mvif->bss_conf);
} }
static int mt7925_set_key(struct ieee80211_hw *hw, enum set_key_cmd cmd, static int mt7925_set_key(struct ieee80211_hw *hw, enum set_key_cmd cmd,
...@@ -1345,7 +1347,8 @@ static void mt7925_mgd_prepare_tx(struct ieee80211_hw *hw, ...@@ -1345,7 +1347,8 @@ static void mt7925_mgd_prepare_tx(struct ieee80211_hw *hw,
jiffies_to_msecs(HZ); jiffies_to_msecs(HZ);
mt792x_mutex_acquire(dev); mt792x_mutex_acquire(dev);
mt7925_set_roc(mvif->phy, mvif, mvif->bss_conf.mt76.ctx->def.chan, duration, mt7925_set_roc(mvif->phy, &mvif->bss_conf,
mvif->bss_conf.mt76.ctx->def.chan, duration,
MT7925_ROC_REQ_JOIN); MT7925_ROC_REQ_JOIN);
mt792x_mutex_release(dev); mt792x_mutex_release(dev);
} }
...@@ -1356,7 +1359,7 @@ static void mt7925_mgd_complete_tx(struct ieee80211_hw *hw, ...@@ -1356,7 +1359,7 @@ static void mt7925_mgd_complete_tx(struct ieee80211_hw *hw,
{ {
struct mt792x_vif *mvif = (struct mt792x_vif *)vif->drv_priv; struct mt792x_vif *mvif = (struct mt792x_vif *)vif->drv_priv;
mt7925_abort_roc(mvif->phy, mvif); mt7925_abort_roc(mvif->phy, &mvif->bss_conf);
} }
static void mt7925_vif_cfg_changed(struct ieee80211_hw *hw, static void mt7925_vif_cfg_changed(struct ieee80211_hw *hw,
......
...@@ -1050,7 +1050,7 @@ int mt7925_mcu_add_key(struct mt76_dev *dev, struct ieee80211_vif *vif, ...@@ -1050,7 +1050,7 @@ int mt7925_mcu_add_key(struct mt76_dev *dev, struct ieee80211_vif *vif,
return mt76_mcu_skb_send_msg(dev, skb, mcu_cmd, true); return mt76_mcu_skb_send_msg(dev, skb, mcu_cmd, true);
} }
int mt7925_mcu_set_roc(struct mt792x_phy *phy, struct mt792x_vif *vif, int mt7925_mcu_set_roc(struct mt792x_phy *phy, struct mt792x_bss_conf *mconf,
struct ieee80211_channel *chan, int duration, struct ieee80211_channel *chan, int duration,
enum mt7925_roc_req type, u8 token_id) enum mt7925_roc_req type, u8 token_id)
{ {
...@@ -1086,7 +1086,7 @@ int mt7925_mcu_set_roc(struct mt792x_phy *phy, struct mt792x_vif *vif, ...@@ -1086,7 +1086,7 @@ int mt7925_mcu_set_roc(struct mt792x_phy *phy, struct mt792x_vif *vif,
.tokenid = token_id, .tokenid = token_id,
.reqtype = type, .reqtype = type,
.maxinterval = cpu_to_le32(duration), .maxinterval = cpu_to_le32(duration),
.bss_idx = vif->bss_conf.mt76.idx, .bss_idx = mconf->mt76.idx,
.control_channel = chan->hw_value, .control_channel = chan->hw_value,
.bw = CMD_CBW_20MHZ, .bw = CMD_CBW_20MHZ,
.bw_from_ap = CMD_CBW_20MHZ, .bw_from_ap = CMD_CBW_20MHZ,
...@@ -1117,7 +1117,7 @@ int mt7925_mcu_set_roc(struct mt792x_phy *phy, struct mt792x_vif *vif, ...@@ -1117,7 +1117,7 @@ int mt7925_mcu_set_roc(struct mt792x_phy *phy, struct mt792x_vif *vif,
&req, sizeof(req), false); &req, sizeof(req), false);
} }
int mt7925_mcu_abort_roc(struct mt792x_phy *phy, struct mt792x_vif *vif, int mt7925_mcu_abort_roc(struct mt792x_phy *phy, struct mt792x_bss_conf *mconf,
u8 token_id) u8 token_id)
{ {
struct mt792x_dev *dev = phy->dev; struct mt792x_dev *dev = phy->dev;
...@@ -1138,7 +1138,7 @@ int mt7925_mcu_abort_roc(struct mt792x_phy *phy, struct mt792x_vif *vif, ...@@ -1138,7 +1138,7 @@ int mt7925_mcu_abort_roc(struct mt792x_phy *phy, struct mt792x_vif *vif,
.tag = cpu_to_le16(UNI_ROC_ABORT), .tag = cpu_to_le16(UNI_ROC_ABORT),
.len = cpu_to_le16(sizeof(struct roc_abort_tlv)), .len = cpu_to_le16(sizeof(struct roc_abort_tlv)),
.tokenid = token_id, .tokenid = token_id,
.bss_idx = vif->bss_conf.mt76.idx, .bss_idx = mconf->mt76.idx,
.dbdcband = 0xff, /* auto*/ .dbdcband = 0xff, /* auto*/
}, },
}; };
......
...@@ -292,10 +292,10 @@ int mt7925_set_tx_sar_pwr(struct ieee80211_hw *hw, ...@@ -292,10 +292,10 @@ int mt7925_set_tx_sar_pwr(struct ieee80211_hw *hw,
int mt7925_mcu_regval(struct mt792x_dev *dev, u32 regidx, u32 *val, bool set); int mt7925_mcu_regval(struct mt792x_dev *dev, u32 regidx, u32 *val, bool set);
int mt7925_mcu_set_clc(struct mt792x_dev *dev, u8 *alpha2, int mt7925_mcu_set_clc(struct mt792x_dev *dev, u8 *alpha2,
enum environment_cap env_cap); enum environment_cap env_cap);
int mt7925_mcu_set_roc(struct mt792x_phy *phy, struct mt792x_vif *vif, int mt7925_mcu_set_roc(struct mt792x_phy *phy, struct mt792x_bss_conf *mconf,
struct ieee80211_channel *chan, int duration, struct ieee80211_channel *chan, int duration,
enum mt7925_roc_req type, u8 token_id); enum mt7925_roc_req type, u8 token_id);
int mt7925_mcu_abort_roc(struct mt792x_phy *phy, struct mt792x_vif *vif, int mt7925_mcu_abort_roc(struct mt792x_phy *phy, struct mt792x_bss_conf *mconf,
u8 token_id); u8 token_id);
int mt7925_mcu_fill_message(struct mt76_dev *mdev, struct sk_buff *skb, int mt7925_mcu_fill_message(struct mt76_dev *mdev, struct sk_buff *skb,
int cmd, int *wait_seq); int cmd, int *wait_seq);
......
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