linux-mediatek.lists.infradead.org archive mirror
 help / color / mirror / Atom feed
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
Subject: [PATCH 22/47] wifi: mt76: mt7925: add mt7925_mcu_bss_rlm_tlv to constitue the RLM TLV
Date: Wed, 12 Jun 2024 20:02:16 -0700	[thread overview]
Message-ID: <20240613030241.5771-23-sean.wang@kernel.org> (raw)
In-Reply-To: <20240613030241.5771-1-sean.wang@kernel.org>

From: Sean Wang <sean.wang@mediatek.com>

add mt7925_mcu_bss_rlm_tlv to maintain consistency with the other TLVs that
constitute the command for creating the per-link BSS.

Co-developed-by: Ming Yen Hsieh <mingyen.hsieh@mediatek.com>
Signed-off-by: Ming Yen Hsieh <mingyen.hsieh@mediatek.com>
Signed-off-by: Sean Wang <sean.wang@mediatek.com>
---
 .../net/wireless/mediatek/mt76/mt7925/mcu.c   | 64 +++++++++++++++++--
 .../net/wireless/mediatek/mt76/mt7925/mcu.h   | 16 +++++
 2 files changed, 74 insertions(+), 6 deletions(-)

diff --git a/drivers/net/wireless/mediatek/mt76/mt7925/mcu.c b/drivers/net/wireless/mediatek/mt76/mt7925/mcu.c
index 7624ec23e064..96b7a9df17d8 100644
--- a/drivers/net/wireless/mediatek/mt76/mt7925/mcu.c
+++ b/drivers/net/wireless/mediatek/mt76/mt7925/mcu.c
@@ -1921,6 +1921,59 @@ mt7925_mcu_uni_add_beacon_offload(struct mt792x_dev *dev,
 				 &req, sizeof(req), true);
 }
 
+static
+void mt7925_mcu_bss_rlm_tlv(struct sk_buff *skb, struct mt76_phy *phy,
+			    struct ieee80211_chanctx_conf *ctx)
+{
+	struct cfg80211_chan_def *chandef = ctx ? &ctx->def : &phy->chandef;
+	int freq1 = chandef->center_freq1, freq2 = chandef->center_freq2;
+	enum nl80211_band band = chandef->chan->band;
+	struct bss_rlm_tlv *req;
+	struct tlv *tlv;
+
+	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->ht_op_info = 4, /* set HT 40M allowed */
+	req->rx_streams = hweight8(phy->antenna_mask),
+	req->band = band;
+
+	switch (chandef->width) {
+	case NL80211_CHAN_WIDTH_40:
+		req->bw = CMD_CBW_40MHZ;
+		break;
+	case NL80211_CHAN_WIDTH_80:
+		req->bw = CMD_CBW_80MHZ;
+		break;
+	case NL80211_CHAN_WIDTH_80P80:
+		req->bw = CMD_CBW_8080MHZ;
+		break;
+	case NL80211_CHAN_WIDTH_160:
+		req->bw = CMD_CBW_160MHZ;
+		break;
+	case NL80211_CHAN_WIDTH_5:
+		req->bw = CMD_CBW_5MHZ;
+		break;
+	case NL80211_CHAN_WIDTH_10:
+		req->bw = CMD_CBW_10MHZ;
+		break;
+	case NL80211_CHAN_WIDTH_20_NOHT:
+	case NL80211_CHAN_WIDTH_20:
+	default:
+		req->bw = CMD_CBW_20MHZ;
+		req->ht_op_info = 0;
+		break;
+	}
+
+	if (req->control_channel < req->center_chan)
+		req->sco = 1; /* SCA */
+	else if (req->control_channel > req->center_chan)
+		req->sco = 3; /* SCB */
+}
+
 int mt7925_mcu_set_chctx(struct mt76_phy *phy, struct mt76_vif *mvif,
 			 struct ieee80211_chanctx_conf *ctx)
 {
@@ -2326,9 +2379,10 @@ int mt7925_mcu_add_bss_info(struct mt792x_phy *phy,
 			    int enable)
 {
 	struct mt792x_vif *mvif = (struct mt792x_vif *)link_conf->vif->drv_priv;
+	struct mt792x_bss_conf *mconf = mt792x_vif_to_link(mvif,
+							   link_conf->link_id);
 	struct mt792x_dev *dev = phy->dev;
 	struct sk_buff *skb;
-	int err;
 
 	skb = __mt7925_mcu_alloc_bss_req(&dev->mt76, &mvif->bss_conf.mt76,
 					 MT7925_BSS_UPDATE_MAX_SIZE);
@@ -2350,12 +2404,10 @@ int mt7925_mcu_add_bss_info(struct mt792x_phy *phy,
 		mt7925_mcu_bss_color_tlv(skb, link_conf, enable);
 	}
 
-	err = mt76_mcu_skb_send_msg(&dev->mt76, skb,
-				    MCU_UNI_CMD(BSS_INFO_UPDATE), true);
-	if (err < 0)
-		return err;
+	mt7925_mcu_bss_rlm_tlv(skb, phy->mt76, mconf->mt76.ctx);
 
-	return mt7925_mcu_set_chctx(phy->mt76, &mvif->bss_conf.mt76, ctx);
+	return mt76_mcu_skb_send_msg(&dev->mt76, skb,
+				     MCU_UNI_CMD(BSS_INFO_UPDATE), true);
 }
 
 int mt7925_mcu_set_dbdc(struct mt76_phy *phy)
diff --git a/drivers/net/wireless/mediatek/mt76/mt7925/mcu.h b/drivers/net/wireless/mediatek/mt76/mt7925/mcu.h
index d3584743c266..c5197577cdc8 100644
--- a/drivers/net/wireless/mediatek/mt76/mt7925/mcu.h
+++ b/drivers/net/wireless/mediatek/mt76/mt7925/mcu.h
@@ -456,6 +456,21 @@ struct bss_ifs_time_tlv {
 	__le16 eifs_cck_time;
 } __packed;
 
+struct bss_rlm_tlv {
+	__le16 tag;
+	__le16 len;
+	u8 control_channel;
+	u8 center_chan;
+	u8 center_chan2;
+	u8 bw;
+	u8 tx_streams;
+	u8 rx_streams;
+	u8 ht_op_info;
+	u8 sco;
+	u8 band;
+	u8 pad[3];
+} __packed;
+
 #define MT7925_STA_UPDATE_MAX_SIZE	(sizeof(struct sta_req_hdr) +		\
 					 sizeof(struct sta_rec_basic) +		\
 					 sizeof(struct sta_rec_bf) +		\
@@ -484,6 +499,7 @@ struct bss_ifs_time_tlv {
 					 sizeof(struct bss_info_uni_he) +		\
 					 sizeof(struct bss_info_uni_bss_color) +	\
 					 sizeof(struct bss_ifs_time_tlv) +		\
+					 sizeof(struct bss_rlm_tlv) +		\
 					 sizeof(struct tlv))
 
 #define MT_CONNAC3_SKU_POWER_LIMIT      449
-- 
2.34.1



  parent reply	other threads:[~2024-06-13  3:03 UTC|newest]

Thread overview: 51+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2024-06-13  3:01 [PATCH 00/47] Prerequisite Refactoring for Enabling MLO on MT7925 sean.wang
2024-06-13  3:01 ` [PATCH 01/47] wifi: mt76: mt792x: add struct mt792x_bss_conf sean.wang
2024-06-13  3:01 ` [PATCH 02/47] wifi: mt76: mt792x: add struct mt792x_link_sta sean.wang
2024-06-13  3:01 ` [PATCH 03/47] wifi: mt76: mt792x: add struct mt792x_chanctx sean.wang
2024-06-13  3:01 ` [PATCH 04/47] wifi: mt76: mt7925: support for split bss_info_changed method sean.wang
2024-06-13  3:01 ` [PATCH 05/47] wifi: mt76: mt792x: extend mt76_connac_mcu_uni_add_dev for per-link BSS sean.wang
2024-06-13  3:02 ` [PATCH 06/47] wifi: mt76: mt7925: extend mt7925_mcu_set_tx with " sean.wang
2024-06-13  3:02 ` [PATCH 07/47] wifi: mt76: mt7925: extend mt7925_mcu_add_bss_info " sean.wang
2024-06-13  3:02 ` [PATCH 08/47] wifi: mt76: mt7925: extend mt7925_mcu_set_timing " sean.wang
2024-06-13  3:02 ` [PATCH 09/47] wifi: mt76: mt7925: extend mt7925_mcu_bss_ifs_tlv " sean.wang
2024-06-13  3:02 ` [PATCH 10/47] wifi: mt76: mt7925: extend mt7925_mcu_bss_color_tlv " sean.wang
2024-06-13  3:02 ` [PATCH 11/47] wifi: mt76: mt7925: extend mt7925_mcu_bss_he_tlv " sean.wang
2024-06-13  3:02 ` [PATCH 12/47] wifi: mt76: mt7925: extend mt7925_mcu_bss_qos_tlv " sean.wang
2024-06-13  3:02 ` [PATCH 13/47] wifi: mt76: mt7925: extend mt7925_mcu_bss_mld_tlv " sean.wang
2024-06-13  3:02 ` [PATCH 14/47] wifi: mt76: mt7925: extend mt7925_mcu_bss_bmc_tlv " sean.wang
2024-06-13  3:02 ` [PATCH 15/47] wifi: mt76: mt7925: remove unused parameters in mt7925_mcu_bss_bmc_tlv sean.wang
2024-06-13  3:02 ` [PATCH 16/47] wifi: mt76: mt7925: extend mt7925_mcu_bss_sec_tlv for per-link BSS sean.wang
2024-06-13  3:02 ` [PATCH 17/47] wifi: mt76: mt7925: extend mt7925_mcu_bss_basic_tlv " sean.wang
2024-06-13  3:02 ` [PATCH 18/47] wifi: mt76: mt7925: extend mt7925_mcu_set_bss_pm " sean.wang
2024-06-13  3:02 ` [PATCH 19/47] wifi: mt76: mt7925: extend mt7925_mcu_[abort, set]_roc " sean.wang
2024-06-13  3:02 ` [PATCH 20/47] wifi: mt76: mt7925: extend mt7925_mcu_uni_bss_bcnft " sean.wang
2024-06-13  3:02 ` [PATCH 21/47] wifi: mt76: mt7925: extend mt7925_mcu_uni_bss_ps " sean.wang
2024-06-13  3:02 ` sean.wang [this message]
2024-06-13  3:02 ` [PATCH 23/47] wifi: mt76: mt7925: mt7925_mcu_set_chctx rely on mt7925_mcu_bss_rlm_tlv sean.wang
2024-06-13  3:02 ` [PATCH 24/47] wifi: mt76: mt7925: extend mt7925_mcu_sta_update for per-link STA sean.wang
2024-06-13  3:02 ` [PATCH 25/47] wifi: mt76: mt7925: extend mt7925_mcu_sta_state_v2_tlv " sean.wang
2024-06-13  3:02 ` [PATCH 26/47] wifi: mt76: mt7925: extend mt7925_mcu_sta_rate_ctrl_tlv with " sean.wang
2024-06-13  3:02 ` [PATCH 27/47] wifi: mt76: mt7925: extend mt7925_mcu_sta_eht_tlv for " sean.wang
2024-06-13  3:02 ` [PATCH 28/47] wifi: mt76: mt7925: extend mt7925_mcu_sta_he_6g_tlv " sean.wang
2024-06-13  3:02 ` [PATCH 29/47] wifi: mt76: mt7925: extend mt7925_mcu_sta_he_tlv " sean.wang
2024-06-13  3:02 ` [PATCH 30/47] wifi: mt76: mt7925: extend mt7925_mcu_sta_amsdu_tlv " sean.wang
2024-06-13  3:02 ` [PATCH 31/47] wifi: mt76: mt7925: extend mt7925_mcu_sta_vht_tlv " sean.wang
2024-06-13  3:02 ` [PATCH 32/47] wifi: mt76: mt7925: extend mt7925_mcu_sta_ht_tlv " sean.wang
2024-06-13  3:02 ` [PATCH 33/47] wifi: mt76: mt7925: extend mt7925_mcu_sta_phy_tlv " sean.wang
2024-06-13  3:02 ` [PATCH 34/47] wifi: mt76: mt7925: extend mt7925_get_phy_mode_ext " sean.wang
2024-06-13  3:02 ` [PATCH 35/47] wifi: mt76: mt7925: extend mt7925_get_phy_mode " sean.wang
2024-06-13  3:02 ` [PATCH 36/47] wifi: mt76: mt792x: extend mt76_connac_get_phy_mode_v2 " sean.wang
2024-06-13  3:02 ` [PATCH 37/47] wifi: mt76: mt762x: extend mt76_connac_mcu_sta_basic_tlv " sean.wang
2024-06-24 17:44   ` Felix Fietkau
2024-06-24 19:03     ` Felix Fietkau
2024-06-25 20:10       ` Sean Wang
2024-06-13  3:02 ` [PATCH 38/47] wifi: mt76: mt7925: extend mt7925_mcu_sta_hdr_trans_tlv " sean.wang
2024-06-13  3:02 ` [PATCH 39/47] wifi: mt76: mt7925: extend mt7925_mcu_add_bss_info " sean.wang
2024-06-13  3:02 ` [PATCH 40/47] wifi: mt76: mt7925: extend mt7925_mcu_bss_mld_tlv " sean.wang
2024-06-13  3:02 ` [PATCH 41/47] wifi: mt76: mt7925: extend mt7925_mcu_bss_basic_tlv " sean.wang
2024-06-13  3:02 ` [PATCH 42/47] wifi: mt76: mt7925: add mt7925_mac_link_sta_add to create " sean.wang
2024-06-13  3:02 ` [PATCH 43/47] wifi: mt76: mt7925: add mt7925_mac_link_sta_assoc to associate " sean.wang
2024-06-13  3:02 ` [PATCH 44/47] wifi: mt76: mt7925: add mt7925_mac_link_sta_remove to remove " sean.wang
2024-06-13  3:02 ` [PATCH 45/47] wifi: mt76: mt7925: add mt7925_mac_link_bss_add to create per-link BSS sean.wang
2024-06-13  3:02 ` [PATCH 46/47] wifi: mt76: mt7925: add mt7925_mac_link_bss_remove to remove " sean.wang
2024-06-13  3:02 ` [PATCH 47/47] wifi: mt76: mt7925: simpify mt7925_mcu_sta_cmd logic by removing fw_offload sean.wang

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=20240613030241.5771-23-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 \
    /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 a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).