From: sean.wang@kernel.org
To: nbd@nbd.name, lorenzo.bianconi@redhat.com
Cc: sean.wang@mediatek.com, deren.wu@mediatek.com,
mingyen.hsieh@mediatek.com, linux-wireless@vger.kernel.org,
linux-mediatek@lists.infradead.org, stable@vger.kernel.org
Subject: [PATCH v3 5/6] wifi: mt76: mt7925: integrate *mlo_sta_cmd and *sta_cmd
Date: Tue, 25 Feb 2025 16:35:55 -0800 [thread overview]
Message-ID: <20250226003556.82644-5-sean.wang@kernel.org> (raw)
In-Reply-To: <20250226003556.82644-1-sean.wang@kernel.org>
From: Ming Yen Hsieh <mingyen.hsieh@mediatek.com>
Integrate *mlo_sta_cmd and *sta_cmd for the MLO firmware.
Fixes: 86c051f2c418 ("wifi: mt76: mt7925: enabling MLO when the firmware supports it")
Cc: stable@vger.kernel.org
Signed-off-by: Ming Yen Hsieh <mingyen.hsieh@mediatek.com>
Signed-off-by: Sean Wang <sean.wang@mediatek.com>
---
v2: generate the patch based on the latest mt76 tree
v3: fixed merge error
---
.../net/wireless/mediatek/mt76/mt7925/mcu.c | 64 +--------
.../wireless/mediatek/mt76/mt7925/mcu.c.rej | 131 +++++++++++++-----
2 files changed, 104 insertions(+), 91 deletions(-)
diff --git a/drivers/net/wireless/mediatek/mt76/mt7925/mcu.c b/drivers/net/wireless/mediatek/mt76/mt7925/mcu.c
index 4c133200c70b..34e7165d1a0f 100644
--- a/drivers/net/wireless/mediatek/mt76/mt7925/mcu.c
+++ b/drivers/net/wireless/mediatek/mt76/mt7925/mcu.c
@@ -1820,49 +1820,6 @@ mt7925_mcu_sta_mld_tlv(struct sk_buff *skb,
}
}
-static int
-mt7925_mcu_sta_cmd(struct mt76_phy *phy,
- struct mt76_sta_cmd_info *info)
-{
- struct mt76_vif_link *mvif = (struct mt76_vif_link *)info->vif->drv_priv;
- struct mt76_dev *dev = phy->dev;
- struct sk_buff *skb;
- int conn_state;
-
- skb = __mt76_connac_mcu_alloc_sta_req(dev, mvif, info->wcid,
- MT7925_STA_UPDATE_MAX_SIZE);
- if (IS_ERR(skb))
- return PTR_ERR(skb);
-
- conn_state = info->enable ? CONN_STATE_PORT_SECURE :
- CONN_STATE_DISCONNECT;
- if (info->link_sta)
- mt76_connac_mcu_sta_basic_tlv(dev, skb, info->link_conf,
- info->link_sta,
- conn_state, info->newly);
- if (info->link_sta && info->enable) {
- mt7925_mcu_sta_phy_tlv(skb, info->vif, info->link_sta);
- mt7925_mcu_sta_ht_tlv(skb, info->link_sta);
- mt7925_mcu_sta_vht_tlv(skb, info->link_sta);
- mt76_connac_mcu_sta_uapsd(skb, info->vif, info->link_sta->sta);
- mt7925_mcu_sta_amsdu_tlv(skb, info->vif, info->link_sta);
- mt7925_mcu_sta_he_tlv(skb, info->link_sta);
- mt7925_mcu_sta_he_6g_tlv(skb, info->link_sta);
- mt7925_mcu_sta_eht_tlv(skb, info->link_sta);
- mt7925_mcu_sta_rate_ctrl_tlv(skb, info->vif,
- info->link_sta);
- mt7925_mcu_sta_state_v2_tlv(phy, skb, info->link_sta,
- info->vif, info->rcpi,
- info->state);
- mt7925_mcu_sta_mld_tlv(skb, info->vif, info->link_sta->sta);
- }
-
- if (info->enable)
- mt7925_mcu_sta_hdr_trans_tlv(skb, info->vif, info->link_sta);
-
- return mt76_mcu_skb_send_msg(dev, skb, info->cmd, true);
-}
-
static void
mt7925_mcu_sta_remove_tlv(struct sk_buff *skb)
{
@@ -1875,8 +1832,8 @@ mt7925_mcu_sta_remove_tlv(struct sk_buff *skb)
}
static int
-mt7925_mcu_mlo_sta_cmd(struct mt76_phy *phy,
- struct mt76_sta_cmd_info *info)
+mt7925_mcu_sta_cmd(struct mt76_phy *phy,
+ struct mt76_sta_cmd_info *info)
{
struct mt792x_vif *mvif = (struct mt792x_vif *)info->vif->drv_priv;
struct mt76_dev *dev = phy->dev;
@@ -1890,12 +1847,10 @@ mt7925_mcu_mlo_sta_cmd(struct mt76_phy *phy,
if (IS_ERR(skb))
return PTR_ERR(skb);
- if (info->enable)
+ if (info->enable && info->link_sta) {
mt76_connac_mcu_sta_basic_tlv(dev, skb, info->link_conf,
info->link_sta,
info->enable, info->newly);
-
- if (info->enable && info->link_sta) {
mt7925_mcu_sta_phy_tlv(skb, info->vif, info->link_sta);
mt7925_mcu_sta_ht_tlv(skb, info->link_sta);
mt7925_mcu_sta_vht_tlv(skb, info->link_sta);
@@ -1946,7 +1901,6 @@ int mt7925_mcu_sta_update(struct mt792x_dev *dev,
};
struct mt792x_sta *msta;
struct mt792x_link_sta *mlink;
- int err;
if (link_sta) {
msta = (struct mt792x_sta *)link_sta->sta->drv_priv;
@@ -1954,17 +1908,7 @@ int mt7925_mcu_sta_update(struct mt792x_dev *dev,
}
info.wcid = link_sta ? &mlink->wcid : &mvif->sta.deflink.wcid;
- if (link_sta)
- info.newly = state != MT76_STA_INFO_STATE_ASSOC;
- else
- info.newly = state == MT76_STA_INFO_STATE_ASSOC ? false : true;
-
- if (ieee80211_vif_is_mld(vif))
- err = mt7925_mcu_mlo_sta_cmd(&dev->mphy, &info);
- else
- err = mt7925_mcu_sta_cmd(&dev->mphy, &info);
-
- return err;
+ return mt7925_mcu_sta_cmd(&dev->mphy, &info);
}
int mt7925_mcu_set_beacon_filter(struct mt792x_dev *dev,
diff --git a/drivers/net/wireless/mediatek/mt76/mt7925/mcu.c.rej b/drivers/net/wireless/mediatek/mt76/mt7925/mcu.c.rej
index 3cdfc4e9a45f..dea7e7b3755a 100644
--- a/drivers/net/wireless/mediatek/mt76/mt7925/mcu.c.rej
+++ b/drivers/net/wireless/mediatek/mt76/mt7925/mcu.c.rej
@@ -1,35 +1,104 @@
--- drivers/net/wireless/mediatek/mt76/mt7925/mcu.c
+++ drivers/net/wireless/mediatek/mt76/mt7925/mcu.c
-@@ -2176,13 +2178,26 @@ void mt7925_mcu_bss_rlm_tlv(struct sk_buff *skb, struct mt76_phy *phy,
+@@ -1771,49 +1771,6 @@ mt7925_mcu_sta_mld_tlv(struct sk_buff *skb,
+ }
+ }
- tlv = mt76_connac_mcu_add_tlv(skb, UNI_BSS_INFO_RLM, sizeof(*req));
- req = (struct bss_rlm_tlv *)tlv;
-- req->control_channel = chandef->chan->hw_value,
-- req->center_chan = ieee80211_frequency_to_channel(freq1),
-- req->center_chan2 = ieee80211_frequency_to_channel(freq2),
-- req->tx_streams = hweight8(phy->antenna_mask),
-+ req->control_channel = chandef->chan->hw_value;
-+ req->center_chan = ieee80211_frequency_to_channel(freq1);
-+ req->center_chan2 = 0;
-+ req->tx_streams = hweight8(phy->antenna_mask);
- req->ht_op_info = 4, /* set HT 40M allowed */
-- req->rx_streams = hweight8(phy->antenna_mask),
-- req->band = band;
-+ req->rx_streams = hweight8(phy->antenna_mask);
-+ req->center_chan2 = 0;
-+ req->sco = 0;
-+
-+ switch (band) {
-+ case NL80211_BAND_2GHZ:
-+ req->band = 1;
-+ break;
-+ case NL80211_BAND_5GHZ:
-+ req->band = 2;
-+ break;
-+ case NL80211_BAND_6GHZ:
-+ req->band = 3;
-+ break;
-+ }
+-static int
+-mt7925_mcu_sta_cmd(struct mt76_phy *phy,
+- struct mt76_sta_cmd_info *info)
+-{
+- struct mt76_vif *mvif = (struct mt76_vif *)info->vif->drv_priv;
+- struct mt76_dev *dev = phy->dev;
+- struct sk_buff *skb;
+- int conn_state;
+-
+- skb = __mt76_connac_mcu_alloc_sta_req(dev, mvif, info->wcid,
+- MT7925_STA_UPDATE_MAX_SIZE);
+- if (IS_ERR(skb))
+- return PTR_ERR(skb);
+-
+- conn_state = info->enable ? CONN_STATE_PORT_SECURE :
+- CONN_STATE_DISCONNECT;
+- if (info->link_sta)
+- mt76_connac_mcu_sta_basic_tlv(dev, skb, info->vif,
+- info->link_sta,
+- conn_state, info->newly);
+- if (info->link_sta && info->enable) {
+- mt7925_mcu_sta_phy_tlv(skb, info->vif, info->link_sta);
+- mt7925_mcu_sta_ht_tlv(skb, info->link_sta);
+- mt7925_mcu_sta_vht_tlv(skb, info->link_sta);
+- mt76_connac_mcu_sta_uapsd(skb, info->vif, info->link_sta->sta);
+- mt7925_mcu_sta_amsdu_tlv(skb, info->vif, info->link_sta);
+- mt7925_mcu_sta_he_tlv(skb, info->link_sta);
+- mt7925_mcu_sta_he_6g_tlv(skb, info->link_sta);
+- mt7925_mcu_sta_eht_tlv(skb, info->link_sta);
+- mt7925_mcu_sta_rate_ctrl_tlv(skb, info->vif,
+- info->link_sta);
+- mt7925_mcu_sta_state_v2_tlv(phy, skb, info->link_sta,
+- info->vif, info->rcpi,
+- info->state);
+- mt7925_mcu_sta_mld_tlv(skb, info->vif, info->link_sta->sta);
+- }
+-
+- if (info->enable)
+- mt7925_mcu_sta_hdr_trans_tlv(skb, info->vif, info->link_sta);
+-
+- return mt76_mcu_skb_send_msg(dev, skb, info->cmd, true);
+-}
+-
+ static void
+ mt7925_mcu_sta_remove_tlv(struct sk_buff *skb)
+ {
+@@ -1826,8 +1783,8 @@ mt7925_mcu_sta_remove_tlv(struct sk_buff *skb)
+ }
- switch (chandef->width) {
- case NL80211_CHAN_WIDTH_40:
+ static int
+-mt7925_mcu_mlo_sta_cmd(struct mt76_phy *phy,
+- struct mt76_sta_cmd_info *info)
++mt7925_mcu_sta_cmd(struct mt76_phy *phy,
++ struct mt76_sta_cmd_info *info)
+ {
+ struct mt792x_vif *mvif = (struct mt792x_vif *)info->vif->drv_priv;
+ struct mt76_dev *dev = phy->dev;
+@@ -1841,12 +1798,10 @@ mt7925_mcu_mlo_sta_cmd(struct mt76_phy *phy,
+ if (IS_ERR(skb))
+ return PTR_ERR(skb);
+
+- if (info->enable)
++ if (info->enable && info->link_sta) {
+ mt76_connac_mcu_sta_basic_tlv(dev, skb, info->vif,
+ info->link_sta,
+ info->enable, info->newly);
+-
+- if (info->enable && info->link_sta) {
+ mt7925_mcu_sta_phy_tlv(skb, info->vif, info->link_sta);
+ mt7925_mcu_sta_ht_tlv(skb, info->link_sta);
+ mt7925_mcu_sta_vht_tlv(skb, info->link_sta);
+@@ -1896,7 +1851,6 @@ int mt7925_mcu_sta_update(struct mt792x_dev *dev,
+ };
+ struct mt792x_sta *msta;
+ struct mt792x_link_sta *mlink;
+- int err;
+
+ if (link_sta) {
+ msta = (struct mt792x_sta *)link_sta->sta->drv_priv;
+@@ -1904,17 +1858,7 @@ int mt7925_mcu_sta_update(struct mt792x_dev *dev,
+ }
+ info.wcid = link_sta ? &mlink->wcid : &mvif->sta.deflink.wcid;
+
+- if (link_sta)
+- info.newly = state != MT76_STA_INFO_STATE_ASSOC;
+- else
+- info.newly = state == MT76_STA_INFO_STATE_ASSOC ? false : true;
+-
+- if (ieee80211_vif_is_mld(vif))
+- err = mt7925_mcu_mlo_sta_cmd(&dev->mphy, &info);
+- else
+- err = mt7925_mcu_sta_cmd(&dev->mphy, &info);
+-
+- return err;
++ return mt7925_mcu_sta_cmd(&dev->mphy, &info);
+ }
+
+ int mt7925_mcu_set_beacon_filter(struct mt792x_dev *dev,
--
2.25.1
next prev parent reply other threads:[~2025-02-26 0:36 UTC|newest]
Thread overview: 8+ messages / expand[flat|nested] mbox.gz Atom feed top
2025-02-26 0:35 [PATCH v3 1/6] Revert "wifi: mt76: mt7925: Update mt7925_mcu_uni_[tx,rx]_ba for MLO" sean.wang
2025-02-26 0:35 ` [PATCH v3 2/6] wifi: mt76: mt7925: fix the wrong link_idx when has p2p_device sean.wang
2025-02-26 2:30 ` Ping-Ke Shih
2025-02-26 0:35 ` [PATCH v3 3/6] wifi: mt76: mt7925: fix the wrong simultaneous cap for MLO sean.wang
2025-02-26 0:35 ` [PATCH v3 4/6] wifi: mt76: mt7925: adjust rm BSS flow to prevent next connection failure sean.wang
2025-02-26 0:35 ` sean.wang [this message]
2025-02-26 0:35 ` [PATCH v3 6/6] wifi: mt76: mt7925: update the power-saving flow sean.wang
2025-02-26 2:25 ` [PATCH v3 1/6] Revert "wifi: mt76: mt7925: Update mt7925_mcu_uni_[tx,rx]_ba for MLO" Ping-Ke Shih
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=20250226003556.82644-5-sean.wang@kernel.org \
--to=sean.wang@kernel.org \
--cc=deren.wu@mediatek.com \
--cc=linux-mediatek@lists.infradead.org \
--cc=linux-wireless@vger.kernel.org \
--cc=lorenzo.bianconi@redhat.com \
--cc=mingyen.hsieh@mediatek.com \
--cc=nbd@nbd.name \
--cc=sean.wang@mediatek.com \
--cc=stable@vger.kernel.org \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.