From patchwork Thu Jun 13 03:01:55 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Sean Wang X-Patchwork-Id: 13696034 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from bombadil.infradead.org (bombadil.infradead.org [198.137.202.133]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.lore.kernel.org (Postfix) with ESMTPS id 77819C27C77 for ; Thu, 13 Jun 2024 03:02:55 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=lists.infradead.org; s=bombadil.20210309; h=Sender:List-Subscribe:List-Help :List-Post:List-Archive:List-Unsubscribe:List-Id:Content-Transfer-Encoding: MIME-Version:References:In-Reply-To:Message-Id:Date:Subject:Cc:To:From: Reply-To:Content-Type:Content-ID:Content-Description:Resent-Date:Resent-From: Resent-Sender:Resent-To:Resent-Cc:Resent-Message-ID:List-Owner; bh=TrIB9nmZ0mM4VWUa4rBGVpAGtlPIy7BctTXo1Pu6SMg=; b=4O4JZvk9sUhh3bmeCMUYkS8aVg /7y/xRUWYXFDZDg/K2O/etrCAXDSCIeGXNlmiyKowJKFL1XYpW7DIlW8kLvIqzSc7GqOO4WZGVvb4 fQct16dw5mzWR12NQy/oCQtFnfNykkXf8iEjy6dgAV5RaZpTkPjsfXLHiyJ5m7cYq/7cH0jyqD2xu 00KvXt6Z7OOEetCJ7r3tD5BoJz19PwrR9HH/6EpKhI54uJQhzEhvouE0jTMyCokdRQuwb7hQacRzk vMA5ccPqqEE072zfDS3fg0Wb8oNQkAhmqZOTEppX1E080jYjcW5lKstSNgvxFoEM2DHy7ZdNy3fb3 JLuxqmiA==; Received: from localhost ([::1] helo=bombadil.infradead.org) by bombadil.infradead.org with esmtp (Exim 4.97.1 #2 (Red Hat Linux)) id 1sHajn-0000000EvUP-0Wsv; Thu, 13 Jun 2024 03:02:55 +0000 Received: from mail-oo1-f50.google.com ([209.85.161.50]) by bombadil.infradead.org with esmtps (Exim 4.97.1 #2 (Red Hat Linux)) id 1sHajj-0000000EvT7-1cWo for linux-mediatek@lists.infradead.org; Thu, 13 Jun 2024 03:02:54 +0000 Received: by mail-oo1-f50.google.com with SMTP id 006d021491bc7-5bad97708efso31418eaf.1 for ; Wed, 12 Jun 2024 20:02:50 -0700 (PDT) X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1718247770; x=1718852570; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:x-gm-message-state:from:to:cc :subject:date:message-id:reply-to; bh=TrIB9nmZ0mM4VWUa4rBGVpAGtlPIy7BctTXo1Pu6SMg=; b=qNE/O4p9PUNVA9fQQa4YRI1Ku7YehZkjh3FT0Vj9kW0h1d0//ChpBbECtNCnqXZ50e dOI0hx8B3uqOs3vpZF5ZupKOM7/88dQFYL1SkRRpewtsm9szcVa9yR20Yfr5mjIRAWio A+dAIlp/4E16OK2WSG3AqCQA3f2tvRIYR1AnfCpZgxcLcjrEGKpzwTAptSdoHcqzt+h4 2x0pgrO7BSRaGiaOSfkuCk4uzDB3+Av64hzLsnHgOnwD/4hQpC9j9eaOYWpTtSHrZ1ZI OGp9GTAan65HFNBxpAYMRglvpjs55pwmnwYCr3vZLOGL09snG8xj6C+ao7UUEMdGrGT+ Tzjw== X-Forwarded-Encrypted: i=1; AJvYcCX1Fd7YVhD4HE9vc90wvHrjkII/oHpItm8phNnb+APQNCCb3udjTYC3If7dtPtYN9jDAOsBTt/uIEqeBC1XT3kAp1lBE0A1ZXEk+5iKGegBut0o X-Gm-Message-State: AOJu0Yxkud5ECLqe4bruf9XZxU+e9s4A9byFtyv+t/7tNxabh2lsCbNo dJ6uNJljmHqsOboZkOXYawvikToWv5BUbpnunVJomY0uyyPkHdWIuWeAc+RTDqU= X-Google-Smtp-Source: AGHT+IF0HkgmqiTaSKojhJVnTG/nx36GXl3UgEYrHzjefWtGXCenBiB7AEY1M29ATTKNjgtOVF/PUA== X-Received: by 2002:a4a:a5ca:0:b0:5ba:e11d:a2ae with SMTP id 006d021491bc7-5bb3b9f4ef7mr3670526eaf.1.1718247769530; Wed, 12 Jun 2024 20:02:49 -0700 (PDT) Received: from sean-ThinkPad-T450s.lan ([207.191.35.252]) by smtp.gmail.com with ESMTPSA id 006d021491bc7-5bd629263c5sm67685eaf.46.2024.06.12.20.02.46 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Wed, 12 Jun 2024 20:02:46 -0700 (PDT) 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 01/47] wifi: mt76: mt792x: add struct mt792x_bss_conf Date: Wed, 12 Jun 2024 20:01:55 -0700 Message-Id: <20240613030241.5771-2-sean.wang@kernel.org> X-Mailer: git-send-email 2.25.1 In-Reply-To: <20240613030241.5771-1-sean.wang@kernel.org> References: <20240613030241.5771-1-sean.wang@kernel.org> MIME-Version: 1.0 X-CRM114-Version: 20100106-BlameMichelson ( TRE 0.8.0 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20240612_200251_483480_E00123FE X-CRM114-Status: GOOD ( 19.25 ) X-BeenThere: linux-mediatek@lists.infradead.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Sender: "Linux-mediatek" Errors-To: linux-mediatek-bounces+linux-mediatek=archiver.kernel.org@lists.infradead.org From: Deren Wu We are introducing a new structure, mt792x_bss_conf, to manage per-link configurations in preparation for future STA support of Multi-Link Operation (MLO). The patch does not include any logic changes, only structural changes. We have moved relevant parameters from the mt7921x_vif structure such as to mt76 of mt76_vif structure, rssi and Tx queue parameters to mt7921x_bss_conf structure. We can access those members to configure the BSS for this interface, whether it is our own BSS or the one we are associated with. However, we have not yet created the per-link BSS configuration indexed by link ID for Multi-Link Device (MLD) support. This step needs to be extended before adding MLD support for AP mode. Co-developed-by: Sean Wang Signed-off-by: Sean Wang Signed-off-by: Deren Wu --- .../net/wireless/mediatek/mt76/mt7921/main.c | 42 +++++++------- .../net/wireless/mediatek/mt76/mt7921/mcu.c | 42 +++++++------- .../net/wireless/mediatek/mt76/mt7925/main.c | 56 +++++++++---------- .../net/wireless/mediatek/mt76/mt7925/mcu.c | 56 +++++++++---------- drivers/net/wireless/mediatek/mt76/mt792x.h | 12 ++-- .../net/wireless/mediatek/mt76/mt792x_core.c | 18 +++--- .../net/wireless/mediatek/mt76/mt792x_mac.c | 2 +- 7 files changed, 115 insertions(+), 113 deletions(-) diff --git a/drivers/net/wireless/mediatek/mt76/mt7921/main.c b/drivers/net/wireless/mediatek/mt76/mt7921/main.c index 3e3ad3518d85..2752e1735575 100644 --- a/drivers/net/wireless/mediatek/mt76/mt7921/main.c +++ b/drivers/net/wireless/mediatek/mt76/mt7921/main.c @@ -295,30 +295,30 @@ mt7921_add_interface(struct ieee80211_hw *hw, struct ieee80211_vif *vif) mt792x_mutex_acquire(dev); - mvif->mt76.idx = __ffs64(~dev->mt76.vif_mask); - if (mvif->mt76.idx >= MT792x_MAX_INTERFACES) { + mvif->bss_conf.mt76.idx = __ffs64(~dev->mt76.vif_mask); + if (mvif->bss_conf.mt76.idx >= MT792x_MAX_INTERFACES) { ret = -ENOSPC; goto out; } - mvif->mt76.omac_idx = mvif->mt76.idx; + mvif->bss_conf.mt76.omac_idx = mvif->bss_conf.mt76.idx; mvif->phy = phy; - mvif->mt76.band_idx = 0; - mvif->mt76.wmm_idx = mvif->mt76.idx % MT76_CONNAC_MAX_WMM_SETS; + mvif->bss_conf.mt76.band_idx = 0; + mvif->bss_conf.mt76.wmm_idx = mvif->bss_conf.mt76.idx % MT76_CONNAC_MAX_WMM_SETS; ret = mt76_connac_mcu_uni_add_dev(&dev->mphy, vif, &mvif->sta.wcid, true); if (ret) goto out; - dev->mt76.vif_mask |= BIT_ULL(mvif->mt76.idx); - phy->omac_mask |= BIT_ULL(mvif->mt76.omac_idx); + dev->mt76.vif_mask |= BIT_ULL(mvif->bss_conf.mt76.idx); + phy->omac_mask |= BIT_ULL(mvif->bss_conf.mt76.omac_idx); - idx = MT792x_WTBL_RESERVED - mvif->mt76.idx; + idx = MT792x_WTBL_RESERVED - mvif->bss_conf.mt76.idx; INIT_LIST_HEAD(&mvif->sta.wcid.poll_list); mvif->sta.wcid.idx = idx; - mvif->sta.wcid.phy_idx = mvif->mt76.band_idx; + mvif->sta.wcid.phy_idx = mvif->bss_conf.mt76.band_idx; mvif->sta.wcid.hw_key_idx = -1; mvif->sta.wcid.tx_info |= MT_WCID_TX_INFO_SET; mt76_wcid_init(&mvif->sta.wcid); @@ -326,7 +326,7 @@ mt7921_add_interface(struct ieee80211_hw *hw, struct ieee80211_vif *vif) mt7921_mac_wtbl_update(dev, idx, MT_WTBL_UPDATE_ADM_COUNT_CLEAR); - ewma_rssi_init(&mvif->rssi); + ewma_rssi_init(&mvif->bss_conf.rssi); rcu_assign_pointer(dev->mt76.wcid[idx], &mvif->sta.wcid); if (vif->txq) { @@ -718,7 +718,7 @@ static void mt7921_bss_info_changed(struct ieee80211_hw *hw, if (changed & BSS_CHANGED_ARP_FILTER) { struct mt792x_vif *mvif = (struct mt792x_vif *)vif->drv_priv; - mt76_connac_mcu_update_arp_filter(&dev->mt76, &mvif->mt76, + mt76_connac_mcu_update_arp_filter(&dev->mt76, &mvif->bss_conf.mt76, info); } @@ -803,7 +803,7 @@ int mt7921_mac_sta_add(struct mt76_dev *mdev, struct ieee80211_vif *vif, msta->vif = mvif; msta->wcid.sta = 1; msta->wcid.idx = idx; - msta->wcid.phy_idx = mvif->mt76.band_idx; + msta->wcid.phy_idx = mvif->bss_conf.mt76.band_idx; msta->wcid.tx_info |= MT_WCID_TX_INFO_SET; msta->last_txs = jiffies; @@ -841,7 +841,7 @@ void mt7921_mac_sta_assoc(struct mt76_dev *mdev, struct ieee80211_vif *vif, if (vif->type == NL80211_IFTYPE_STATION && !sta->tdls) mt76_connac_mcu_uni_add_bss(&dev->mphy, vif, &mvif->sta.wcid, - true, mvif->mt76.ctx); + true, mvif->bss_conf.mt76.ctx); ewma_avg_signal_init(&msta->avg_ack_signal); @@ -872,11 +872,11 @@ void mt7921_mac_sta_remove(struct mt76_dev *mdev, struct ieee80211_vif *vif, struct mt792x_vif *mvif = (struct mt792x_vif *)vif->drv_priv; mvif->wep_sta = NULL; - ewma_rssi_init(&mvif->rssi); + ewma_rssi_init(&mvif->bss_conf.rssi); if (!sta->tdls) mt76_connac_mcu_uni_add_bss(&dev->mphy, vif, &mvif->sta.wcid, false, - mvif->mt76.ctx); + mvif->bss_conf.mt76.ctx); } spin_lock_bh(&dev->mt76.sta_poll_lock); @@ -1196,7 +1196,7 @@ static void mt7921_ipv6_addr_change(struct ieee80211_hw *hw, struct mt76_connac_arpns_tlv arpns; } req_hdr = { .hdr = { - .bss_idx = mvif->mt76.idx, + .bss_idx = mvif->bss_conf.mt76.idx, }, .arpns = { .tag = cpu_to_le16(UNI_OFFLOAD_OFFLOAD_ND), @@ -1295,7 +1295,7 @@ mt7921_start_ap(struct ieee80211_hw *hw, struct ieee80211_vif *vif, mt792x_mutex_acquire(dev); err = mt76_connac_mcu_uni_add_bss(phy->mt76, vif, &mvif->sta.wcid, - true, mvif->mt76.ctx); + true, mvif->bss_conf.mt76.ctx); if (err) goto out; @@ -1327,7 +1327,7 @@ mt7921_stop_ap(struct ieee80211_hw *hw, struct ieee80211_vif *vif, goto out; mt76_connac_mcu_uni_add_bss(phy->mt76, vif, &mvif->sta.wcid, false, - mvif->mt76.ctx); + mvif->bss_conf.mt76.ctx); out: mt792x_mutex_release(dev); @@ -1352,13 +1352,13 @@ static void mt7921_ctx_iter(void *priv, u8 *mac, struct mt792x_vif *mvif = (struct mt792x_vif *)vif->drv_priv; struct ieee80211_chanctx_conf *ctx = priv; - if (ctx != mvif->mt76.ctx) + if (ctx != mvif->bss_conf.mt76.ctx) return; if (vif->type == NL80211_IFTYPE_MONITOR) mt7921_mcu_config_sniffer(mvif, ctx); else - mt76_connac_mcu_uni_set_chctx(mvif->phy->mt76, &mvif->mt76, ctx); + mt76_connac_mcu_uni_set_chctx(mvif->phy->mt76, &mvif->bss_conf.mt76, ctx); } static void @@ -1385,7 +1385,7 @@ static void mt7921_mgd_prepare_tx(struct ieee80211_hw *hw, jiffies_to_msecs(HZ); mt792x_mutex_acquire(dev); - mt7921_set_roc(mvif->phy, mvif, mvif->mt76.ctx->def.chan, duration, + mt7921_set_roc(mvif->phy, mvif, mvif->bss_conf.mt76.ctx->def.chan, duration, MT7921_ROC_REQ_JOIN); mt792x_mutex_release(dev); } diff --git a/drivers/net/wireless/mediatek/mt76/mt7921/mcu.c b/drivers/net/wireless/mediatek/mt76/mt7921/mcu.c index bdd8b5f19b24..0453af012016 100644 --- a/drivers/net/wireless/mediatek/mt76/mt7921/mcu.c +++ b/drivers/net/wireless/mediatek/mt76/mt7921/mcu.c @@ -105,7 +105,7 @@ mt7921_mcu_set_ipv6_ns_filter(struct mt76_dev *dev, struct mt76_connac_arpns_tlv arpns; } req = { .hdr = { - .bss_idx = mvif->mt76.idx, + .bss_idx = mvif->bss_conf.mt76.idx, }, .arpns = { .tag = cpu_to_le16(UNI_OFFLOAD_OFFLOAD_ND), @@ -260,7 +260,7 @@ mt7921_mcu_rssi_monitor_iter(void *priv, u8 *mac, struct mt792x_vif *mvif = (struct mt792x_vif *)vif->drv_priv; struct mt76_connac_rssi_notify_event *event = priv; enum nl80211_cqm_rssi_threshold_event nl_event; - s32 rssi = le32_to_cpu(event->rssi[mvif->mt76.idx]); + s32 rssi = le32_to_cpu(event->rssi[mvif->bss_conf.mt76.idx]); if (!rssi) return; @@ -388,7 +388,7 @@ int mt7921_mcu_uni_tx_ba(struct mt792x_dev *dev, if (enable && !params->amsdu) msta->wcid.amsdu = false; - return mt76_connac_mcu_sta_ba(&dev->mt76, &msta->vif->mt76, params, + return mt76_connac_mcu_sta_ba(&dev->mt76, &msta->vif->bss_conf.mt76, params, MCU_UNI_CMD(STA_REC_UPDATE), enable, true); } @@ -399,7 +399,7 @@ int mt7921_mcu_uni_rx_ba(struct mt792x_dev *dev, { struct mt792x_sta *msta = (struct mt792x_sta *)params->sta->drv_priv; - return mt76_connac_mcu_sta_ba(&dev->mt76, &msta->vif->mt76, params, + return mt76_connac_mcu_sta_ba(&dev->mt76, &msta->vif->bss_conf.mt76, params, MCU_UNI_CMD(STA_REC_UPDATE), enable, false); } @@ -678,9 +678,9 @@ int mt7921_mcu_set_tx(struct mt792x_dev *dev, struct ieee80211_vif *vif) u8 wmm_idx; u8 pad; } __packed req = { - .bss_idx = mvif->mt76.idx, + .bss_idx = mvif->bss_conf.mt76.idx, .qos = vif->bss_conf.qos, - .wmm_idx = mvif->mt76.wmm_idx, + .wmm_idx = mvif->bss_conf.mt76.wmm_idx, }; struct mu_edca { u8 cw_min; @@ -701,15 +701,15 @@ int mt7921_mcu_set_tx(struct mt792x_dev *dev, struct ieee80211_vif *vif) struct mu_edca edca[IEEE80211_NUM_ACS]; u8 pad3[32]; } __packed req_mu = { - .bss_idx = mvif->mt76.idx, + .bss_idx = mvif->bss_conf.mt76.idx, .qos = vif->bss_conf.qos, - .wmm_idx = mvif->mt76.wmm_idx, + .wmm_idx = mvif->bss_conf.mt76.wmm_idx, }; static const int to_aci[] = { 1, 0, 2, 3 }; int ac, ret; for (ac = 0; ac < IEEE80211_NUM_ACS; ac++) { - struct ieee80211_tx_queue_params *q = &mvif->queue_params[ac]; + struct ieee80211_tx_queue_params *q = &mvif->bss_conf.queue_params[ac]; struct edca *e = &req.edca[to_aci[ac]]; e->aifs = cpu_to_le16(q->aifs); @@ -738,10 +738,10 @@ int mt7921_mcu_set_tx(struct mt792x_dev *dev, struct ieee80211_vif *vif) struct ieee80211_he_mu_edca_param_ac_rec *q; struct mu_edca *e; - if (!mvif->queue_params[ac].mu_edca) + if (!mvif->bss_conf.queue_params[ac].mu_edca) break; - q = &mvif->queue_params[ac].mu_edca_param_rec; + q = &mvif->bss_conf.queue_params[ac].mu_edca_param_rec; e = &(req_mu.edca[to_aci[ac]]); e->cw_min = q->ecw_min_max & 0xf; @@ -790,7 +790,7 @@ int mt7921_mcu_set_roc(struct mt792x_phy *phy, struct mt792x_vif *vif, .tokenid = token_id, .reqtype = type, .maxinterval = cpu_to_le32(duration), - .bss_idx = vif->mt76.idx, + .bss_idx = vif->bss_conf.mt76.idx, .control_channel = chan->hw_value, .bw = CMD_CBW_20MHZ, .bw_from_ap = CMD_CBW_20MHZ, @@ -842,7 +842,7 @@ int mt7921_mcu_abort_roc(struct mt792x_phy *phy, struct mt792x_vif *vif, .tag = cpu_to_le16(UNI_ROC_ABORT), .len = cpu_to_le16(sizeof(struct roc_abort_tlv)), .tokenid = token_id, - .bss_idx = vif->mt76.idx, + .bss_idx = vif->bss_conf.mt76.idx, .dbdcband = 0xff, /* auto*/ }, }; @@ -947,7 +947,7 @@ int mt7921_mcu_uni_bss_ps(struct mt792x_dev *dev, struct ieee80211_vif *vif) } __packed ps; } __packed ps_req = { .hdr = { - .bss_idx = mvif->mt76.idx, + .bss_idx = mvif->bss_conf.mt76.idx, }, .ps = { .tag = cpu_to_le16(UNI_BSS_INFO_PS), @@ -982,7 +982,7 @@ mt7921_mcu_uni_bss_bcnft(struct mt792x_dev *dev, struct ieee80211_vif *vif, } __packed bcnft; } __packed bcnft_req = { .hdr = { - .bss_idx = mvif->mt76.idx, + .bss_idx = mvif->bss_conf.mt76.idx, }, .bcnft = { .tag = cpu_to_le16(UNI_BSS_INFO_BCNFT), @@ -1015,7 +1015,7 @@ mt7921_mcu_set_bss_pm(struct mt792x_dev *dev, struct ieee80211_vif *vif, u8 bmc_triggered_ac; u8 pad; } req = { - .bss_idx = mvif->mt76.idx, + .bss_idx = mvif->bss_conf.mt76.idx, .aid = cpu_to_le16(vif->cfg.aid), .dtim_period = vif->bss_conf.dtim_period, .bcn_interval = cpu_to_le16(vif->bss_conf.beacon_int), @@ -1024,7 +1024,7 @@ mt7921_mcu_set_bss_pm(struct mt792x_dev *dev, struct ieee80211_vif *vif, u8 bss_idx; u8 pad[3]; } req_hdr = { - .bss_idx = mvif->mt76.idx, + .bss_idx = mvif->bss_conf.mt76.idx, }; int err; @@ -1042,7 +1042,7 @@ int mt7921_mcu_sta_update(struct mt792x_dev *dev, struct ieee80211_sta *sta, enum mt76_sta_info_state state) { struct mt792x_vif *mvif = (struct mt792x_vif *)vif->drv_priv; - int rssi = -ewma_rssi_read(&mvif->rssi); + int rssi = -ewma_rssi_read(&mvif->bss_conf.rssi); struct mt76_sta_cmd_info info = { .sta = sta, .vif = vif, @@ -1190,7 +1190,7 @@ int mt7921_mcu_config_sniffer(struct mt792x_vif *vif, } __packed tlv; } __packed req = { .hdr = { - .band_idx = vif->mt76.band_idx, + .band_idx = vif->bss_conf.mt76.band_idx, }, .tlv = { .tag = cpu_to_le16(1), @@ -1251,7 +1251,7 @@ mt7921_mcu_uni_add_beacon_offload(struct mt792x_dev *dev, } __packed beacon_tlv; } req = { .hdr = { - .bss_idx = mvif->mt76.idx, + .bss_idx = mvif->bss_conf.mt76.idx, }, .beacon_tlv = { .tag = cpu_to_le16(UNI_BSS_INFO_BCN_CONTENT), @@ -1460,7 +1460,7 @@ int mt7921_mcu_set_rssimonitor(struct mt792x_dev *dev, struct ieee80211_vif *vif .enable = vif->cfg.assoc, .cqm_rssi_high = vif->bss_conf.cqm_rssi_thold + vif->bss_conf.cqm_rssi_hyst, .cqm_rssi_low = vif->bss_conf.cqm_rssi_thold - vif->bss_conf.cqm_rssi_hyst, - .bss_idx = mvif->mt76.idx, + .bss_idx = mvif->bss_conf.mt76.idx, }; return mt76_mcu_send_msg(&dev->mt76, MCU_CE_CMD(RSSI_MONITOR), diff --git a/drivers/net/wireless/mediatek/mt76/mt7925/main.c b/drivers/net/wireless/mediatek/mt76/mt7925/main.c index 6179798a8845..dfc606cc9bdd 100644 --- a/drivers/net/wireless/mediatek/mt76/mt7925/main.c +++ b/drivers/net/wireless/mediatek/mt76/mt7925/main.c @@ -328,35 +328,35 @@ mt7925_add_interface(struct ieee80211_hw *hw, struct ieee80211_vif *vif) mt792x_mutex_acquire(dev); - mvif->mt76.idx = __ffs64(~dev->mt76.vif_mask); - if (mvif->mt76.idx >= MT792x_MAX_INTERFACES) { + mvif->bss_conf.mt76.idx = __ffs64(~dev->mt76.vif_mask); + if (mvif->bss_conf.mt76.idx >= MT792x_MAX_INTERFACES) { ret = -ENOSPC; goto out; } - mvif->mt76.omac_idx = mvif->mt76.idx; + mvif->bss_conf.mt76.omac_idx = mvif->bss_conf.mt76.idx; mvif->phy = phy; - mvif->mt76.band_idx = 0; - mvif->mt76.wmm_idx = mvif->mt76.idx % MT76_CONNAC_MAX_WMM_SETS; + mvif->bss_conf.mt76.band_idx = 0; + mvif->bss_conf.mt76.wmm_idx = mvif->bss_conf.mt76.idx % MT76_CONNAC_MAX_WMM_SETS; if (phy->mt76->chandef.chan->band != NL80211_BAND_2GHZ) - mvif->mt76.basic_rates_idx = MT792x_BASIC_RATES_TBL + 4; + mvif->bss_conf.mt76.basic_rates_idx = MT792x_BASIC_RATES_TBL + 4; else - mvif->mt76.basic_rates_idx = MT792x_BASIC_RATES_TBL; + mvif->bss_conf.mt76.basic_rates_idx = MT792x_BASIC_RATES_TBL; ret = mt76_connac_mcu_uni_add_dev(&dev->mphy, vif, &mvif->sta.wcid, true); if (ret) goto out; - dev->mt76.vif_mask |= BIT_ULL(mvif->mt76.idx); - phy->omac_mask |= BIT_ULL(mvif->mt76.omac_idx); + dev->mt76.vif_mask |= BIT_ULL(mvif->bss_conf.mt76.idx); + phy->omac_mask |= BIT_ULL(mvif->bss_conf.mt76.omac_idx); - idx = MT792x_WTBL_RESERVED - mvif->mt76.idx; + idx = MT792x_WTBL_RESERVED - mvif->bss_conf.mt76.idx; INIT_LIST_HEAD(&mvif->sta.wcid.poll_list); mvif->sta.wcid.idx = idx; - mvif->sta.wcid.phy_idx = mvif->mt76.band_idx; + mvif->sta.wcid.phy_idx = mvif->bss_conf.mt76.band_idx; mvif->sta.wcid.hw_key_idx = -1; mvif->sta.wcid.tx_info |= MT_WCID_TX_INFO_SET; mvif->sta.vif = mvif; @@ -365,7 +365,7 @@ mt7925_add_interface(struct ieee80211_hw *hw, struct ieee80211_vif *vif) mt7925_mac_wtbl_update(dev, idx, MT_WTBL_UPDATE_ADM_COUNT_CLEAR); - ewma_rssi_init(&mvif->rssi); + ewma_rssi_init(&mvif->bss_conf.rssi); rcu_assign_pointer(dev->mt76.wcid[idx], &mvif->sta.wcid); if (vif->txq) { @@ -524,11 +524,11 @@ static int mt7925_set_key(struct ieee80211_hw *hw, enum set_key_cmd cmd, mt792x_mutex_acquire(dev); - if (cmd == SET_KEY && !mvif->mt76.cipher) { + if (cmd == SET_KEY && !mvif->bss_conf.mt76.cipher) { struct mt792x_phy *phy = mt792x_hw_phy(hw); - mvif->mt76.cipher = mt7925_mcu_get_cipher(key->cipher); - mt7925_mcu_add_bss_info(phy, mvif->mt76.ctx, vif, sta, true); + mvif->bss_conf.mt76.cipher = mt7925_mcu_get_cipher(key->cipher); + mt7925_mcu_add_bss_info(phy, mvif->bss_conf.mt76.ctx, vif, sta, true); } if (cmd == SET_KEY) @@ -748,7 +748,7 @@ static void mt7925_bss_info_changed(struct ieee80211_hw *hw, if (changed & BSS_CHANGED_ARP_FILTER) { struct mt792x_vif *mvif = (struct mt792x_vif *)vif->drv_priv; - mt7925_mcu_update_arp_filter(&dev->mt76, &mvif->mt76, info); + mt7925_mcu_update_arp_filter(&dev->mt76, &mvif->bss_conf.mt76, info); } mt792x_mutex_release(dev); @@ -770,7 +770,7 @@ int mt7925_mac_sta_add(struct mt76_dev *mdev, struct ieee80211_vif *vif, msta->vif = mvif; msta->wcid.sta = 1; msta->wcid.idx = idx; - msta->wcid.phy_idx = mvif->mt76.band_idx; + msta->wcid.phy_idx = mvif->bss_conf.mt76.band_idx; msta->wcid.tx_info |= MT_WCID_TX_INFO_SET; msta->last_txs = jiffies; @@ -786,7 +786,7 @@ int mt7925_mac_sta_add(struct mt76_dev *mdev, struct ieee80211_vif *vif, /* should update bss info before STA add */ if (vif->type == NL80211_IFTYPE_STATION && !sta->tdls) - mt7925_mcu_add_bss_info(&dev->phy, mvif->mt76.ctx, vif, sta, + mt7925_mcu_add_bss_info(&dev->phy, mvif->bss_conf.mt76.ctx, vif, sta, false); ret = mt7925_mcu_sta_update(dev, sta, vif, true, @@ -810,7 +810,7 @@ void mt7925_mac_sta_assoc(struct mt76_dev *mdev, struct ieee80211_vif *vif, mt792x_mutex_acquire(dev); if (vif->type == NL80211_IFTYPE_STATION && !sta->tdls) - mt7925_mcu_add_bss_info(&dev->phy, mvif->mt76.ctx, vif, sta, + mt7925_mcu_add_bss_info(&dev->phy, mvif->bss_conf.mt76.ctx, vif, sta, true); ewma_avg_signal_init(&msta->avg_ack_signal); @@ -842,9 +842,9 @@ void mt7925_mac_sta_remove(struct mt76_dev *mdev, struct ieee80211_vif *vif, struct mt792x_vif *mvif = (struct mt792x_vif *)vif->drv_priv; mvif->wep_sta = NULL; - ewma_rssi_init(&mvif->rssi); + ewma_rssi_init(&mvif->bss_conf.rssi); if (!sta->tdls) - mt7925_mcu_add_bss_info(&dev->phy, mvif->mt76.ctx, vif, sta, + mt7925_mcu_add_bss_info(&dev->phy, mvif->bss_conf.mt76.ctx, vif, sta, false); } @@ -1190,7 +1190,7 @@ static void mt7925_ipv6_addr_change(struct ieee80211_hw *hw, struct in6_addr ns_addrs[IEEE80211_BSS_ARP_ADDR_LIST_LEN]; } req_hdr = { .hdr = { - .bss_idx = mvif->mt76.idx, + .bss_idx = mvif->bss_conf.mt76.idx, }, .arpns = { .tag = cpu_to_le16(UNI_OFFLOAD_OFFLOAD_ND), @@ -1288,7 +1288,7 @@ mt7925_conf_tx(struct ieee80211_hw *hw, struct ieee80211_vif *vif, }; /* firmware uses access class index */ - mvif->queue_params[mq_to_aci[queue]] = *params; + mvif->bss_conf.queue_params[mq_to_aci[queue]] = *params; return 0; } @@ -1303,7 +1303,7 @@ mt7925_start_ap(struct ieee80211_hw *hw, struct ieee80211_vif *vif, mt792x_mutex_acquire(dev); - err = mt7925_mcu_add_bss_info(&dev->phy, mvif->mt76.ctx, vif, NULL, + err = mt7925_mcu_add_bss_info(&dev->phy, mvif->bss_conf.mt76.ctx, vif, NULL, true); if (err) goto out; @@ -1334,7 +1334,7 @@ mt7925_stop_ap(struct ieee80211_hw *hw, struct ieee80211_vif *vif, if (err) goto out; - mt7925_mcu_add_bss_info(&dev->phy, mvif->mt76.ctx, vif, NULL, + mt7925_mcu_add_bss_info(&dev->phy, mvif->bss_conf.mt76.ctx, vif, NULL, false); out: @@ -1360,14 +1360,14 @@ static void mt7925_ctx_iter(void *priv, u8 *mac, struct mt792x_vif *mvif = (struct mt792x_vif *)vif->drv_priv; struct ieee80211_chanctx_conf *ctx = priv; - if (ctx != mvif->mt76.ctx) + if (ctx != mvif->bss_conf.mt76.ctx) return; if (vif->type == NL80211_IFTYPE_MONITOR) { mt7925_mcu_set_sniffer(mvif->phy->dev, vif, true); mt7925_mcu_config_sniffer(mvif, ctx); } else { - mt7925_mcu_set_chctx(mvif->phy->mt76, &mvif->mt76, ctx); + mt7925_mcu_set_chctx(mvif->phy->mt76, &mvif->bss_conf.mt76, ctx); } } @@ -1395,7 +1395,7 @@ static void mt7925_mgd_prepare_tx(struct ieee80211_hw *hw, jiffies_to_msecs(HZ); mt792x_mutex_acquire(dev); - mt7925_set_roc(mvif->phy, mvif, mvif->mt76.ctx->def.chan, duration, + mt7925_set_roc(mvif->phy, mvif, mvif->bss_conf.mt76.ctx->def.chan, duration, MT7925_ROC_REQ_JOIN); mt792x_mutex_release(dev); } diff --git a/drivers/net/wireless/mediatek/mt76/mt7925/mcu.c b/drivers/net/wireless/mediatek/mt76/mt7925/mcu.c index 652a9accc43c..c259aedb96e0 100644 --- a/drivers/net/wireless/mediatek/mt76/mt7925/mcu.c +++ b/drivers/net/wireless/mediatek/mt76/mt7925/mcu.c @@ -546,7 +546,7 @@ int mt7925_mcu_uni_tx_ba(struct mt792x_dev *dev, if (enable && !params->amsdu) msta->wcid.amsdu = false; - return mt7925_mcu_sta_ba(&dev->mt76, &mvif->mt76, params, + return mt7925_mcu_sta_ba(&dev->mt76, &mvif->bss_conf.mt76, params, enable, true); } @@ -557,7 +557,7 @@ int mt7925_mcu_uni_rx_ba(struct mt792x_dev *dev, struct mt792x_sta *msta = (struct mt792x_sta *)params->sta->drv_priv; struct mt792x_vif *mvif = msta->vif; - return mt7925_mcu_sta_ba(&dev->mt76, &mvif->mt76, params, + return mt7925_mcu_sta_ba(&dev->mt76, &mvif->bss_conf.mt76, params, enable, false); } @@ -889,7 +889,7 @@ int mt7925_mcu_wtbl_update_hdr_trans(struct mt792x_dev *dev, msta = sta ? (struct mt792x_sta *)sta->drv_priv : &mvif->sta; - skb = __mt76_connac_mcu_alloc_sta_req(&dev->mt76, &mvif->mt76, + skb = __mt76_connac_mcu_alloc_sta_req(&dev->mt76, &mvif->bss_conf.mt76, &msta->wcid, MT7925_STA_UPDATE_MAX_SIZE); if (IS_ERR(skb)) @@ -915,7 +915,7 @@ int mt7925_mcu_set_tx(struct mt792x_dev *dev, struct ieee80211_vif *vif) u8 bss_idx; u8 __rsv[3]; } __packed hdr = { - .bss_idx = mvif->mt76.idx, + .bss_idx = mvif->bss_conf.mt76.idx, }; struct sk_buff *skb; int len = sizeof(hdr) + IEEE80211_NUM_ACS * sizeof(struct edca); @@ -928,7 +928,7 @@ int mt7925_mcu_set_tx(struct mt792x_dev *dev, struct ieee80211_vif *vif) skb_put_data(skb, &hdr, sizeof(hdr)); for (ac = 0; ac < IEEE80211_NUM_ACS; ac++) { - struct ieee80211_tx_queue_params *q = &mvif->queue_params[ac]; + struct ieee80211_tx_queue_params *q = &mvif->bss_conf.queue_params[ac]; struct edca *e; struct tlv *tlv; @@ -976,7 +976,7 @@ mt7925_mcu_sta_key_tlv(struct mt76_wcid *wcid, tlv = mt76_connac_mcu_add_tlv(skb, STA_REC_KEY_V3, sizeof(*sec)); sec = (struct sta_rec_sec_uni *)tlv; - sec->bss_idx = mvif->mt76.idx; + sec->bss_idx = mvif->bss_conf.mt76.idx; sec->is_authenticator = 0; sec->mgmt_prot = 0; sec->wlan_idx = (u8)wcid->idx; @@ -1085,7 +1085,7 @@ int mt7925_mcu_set_roc(struct mt792x_phy *phy, struct mt792x_vif *vif, .tokenid = token_id, .reqtype = type, .maxinterval = cpu_to_le32(duration), - .bss_idx = vif->mt76.idx, + .bss_idx = vif->bss_conf.mt76.idx, .control_channel = chan->hw_value, .bw = CMD_CBW_20MHZ, .bw_from_ap = CMD_CBW_20MHZ, @@ -1137,7 +1137,7 @@ int mt7925_mcu_abort_roc(struct mt792x_phy *phy, struct mt792x_vif *vif, .tag = cpu_to_le16(UNI_ROC_ABORT), .len = cpu_to_le16(sizeof(struct roc_abort_tlv)), .tokenid = token_id, - .bss_idx = vif->mt76.idx, + .bss_idx = vif->bss_conf.mt76.idx, .dbdcband = 0xff, /* auto*/ }, }; @@ -1263,7 +1263,7 @@ int mt7925_mcu_uni_bss_ps(struct mt792x_dev *dev, struct ieee80211_vif *vif) } __packed ps; } __packed ps_req = { .hdr = { - .bss_idx = mvif->mt76.idx, + .bss_idx = mvif->bss_conf.mt76.idx, }, .ps = { .tag = cpu_to_le16(UNI_BSS_INFO_PS), @@ -1300,7 +1300,7 @@ mt7925_mcu_uni_bss_bcnft(struct mt792x_dev *dev, struct ieee80211_vif *vif, } __packed bcnft; } __packed bcnft_req = { .hdr = { - .bss_idx = mvif->mt76.idx, + .bss_idx = mvif->bss_conf.mt76.idx, }, .bcnft = { .tag = cpu_to_le16(UNI_BSS_INFO_BCNFT), @@ -1338,7 +1338,7 @@ mt7925_mcu_set_bss_pm(struct mt792x_dev *dev, struct ieee80211_vif *vif, } __packed enable; } req = { .hdr = { - .bss_idx = mvif->mt76.idx, + .bss_idx = mvif->bss_conf.mt76.idx, }, .enable = { .tag = cpu_to_le16(UNI_BSS_INFO_BCNFT), @@ -1358,7 +1358,7 @@ mt7925_mcu_set_bss_pm(struct mt792x_dev *dev, struct ieee80211_vif *vif, } __packed disable; } req1 = { .hdr = { - .bss_idx = mvif->mt76.idx, + .bss_idx = mvif->bss_conf.mt76.idx, }, .disable = { .tag = cpu_to_le16(UNI_BSS_INFO_PM_DISABLE), @@ -1502,7 +1502,7 @@ mt7925_mcu_sta_phy_tlv(struct sk_buff *skb, struct ieee80211_vif *vif, struct ieee80211_sta *sta) { struct mt792x_vif *mvif = (struct mt792x_vif *)vif->drv_priv; - struct cfg80211_chan_def *chandef = &mvif->mt76.ctx->def; + struct cfg80211_chan_def *chandef = &mvif->bss_conf.mt76.ctx->def; struct sta_rec_phy *phy; struct tlv *tlv; u8 af = 0, mm = 0; @@ -1569,7 +1569,7 @@ mt7925_mcu_sta_rate_ctrl_tlv(struct sk_buff *skb, struct ieee80211_vif *vif, struct ieee80211_sta *sta) { struct mt792x_vif *mvif = (struct mt792x_vif *)vif->drv_priv; - struct cfg80211_chan_def *chandef = &mvif->mt76.ctx->def; + struct cfg80211_chan_def *chandef = &mvif->bss_conf.mt76.ctx->def; enum nl80211_band band = chandef->chan->band; struct sta_rec_ra_info *ra_info; struct tlv *tlv; @@ -1655,7 +1655,7 @@ int mt7925_mcu_sta_update(struct mt792x_dev *dev, struct ieee80211_sta *sta, enum mt76_sta_info_state state) { struct mt792x_vif *mvif = (struct mt792x_vif *)vif->drv_priv; - int rssi = -ewma_rssi_read(&mvif->rssi); + int rssi = -ewma_rssi_read(&mvif->bss_conf.rssi); struct mt76_sta_cmd_info info = { .sta = sta, .vif = vif, @@ -1746,7 +1746,7 @@ int mt7925_mcu_set_sniffer(struct mt792x_dev *dev, struct ieee80211_vif *vif, } __packed enable; } __packed req = { .hdr = { - .band_idx = mvif->mt76.band_idx, + .band_idx = mvif->bss_conf.mt76.band_idx, }, .enable = { .tag = cpu_to_le16(UNI_SNIFFER_ENABLE), @@ -1805,7 +1805,7 @@ int mt7925_mcu_config_sniffer(struct mt792x_vif *vif, } __packed tlv; } __packed req = { .hdr = { - .band_idx = vif->mt76.band_idx, + .band_idx = vif->bss_conf.mt76.band_idx, }, .tlv = { .tag = cpu_to_le16(UNI_SNIFFER_CONFIG), @@ -1866,7 +1866,7 @@ mt7925_mcu_uni_add_beacon_offload(struct mt792x_dev *dev, } __packed beacon_tlv; } req = { .hdr = { - .bss_idx = mvif->mt76.idx, + .bss_idx = mvif->bss_conf.mt76.idx, }, .beacon_tlv = { .tag = cpu_to_le16(UNI_BSS_INFO_BCN_CONTENT), @@ -2080,8 +2080,8 @@ mt7925_mcu_bss_basic_tlv(struct sk_buff *skb, tlv = mt76_connac_mcu_add_tlv(skb, UNI_BSS_INFO_BASIC, sizeof(*basic_req)); basic_req = (struct mt76_connac_bss_basic_tlv *)tlv; - idx = mvif->mt76.omac_idx > EXT_BSSID_START ? HW_BSSID_0 : - mvif->mt76.omac_idx; + idx = mvif->bss_conf.mt76.omac_idx > EXT_BSSID_START ? HW_BSSID_0 : + mvif->bss_conf.mt76.omac_idx; basic_req->hw_bss_idx = idx; basic_req->phymode_ext = mt7925_get_phy_mode_ext(phy, vif, band, sta); @@ -2097,9 +2097,9 @@ mt7925_mcu_bss_basic_tlv(struct sk_buff *skb, basic_req->dtim_period = vif->bss_conf.dtim_period; basic_req->bmc_tx_wlan_idx = cpu_to_le16(wlan_idx); basic_req->sta_idx = cpu_to_le16(msta->wcid.idx); - basic_req->omac_idx = mvif->mt76.omac_idx; - basic_req->band_idx = mvif->mt76.band_idx; - basic_req->wmm_idx = mvif->mt76.wmm_idx; + basic_req->omac_idx = mvif->bss_conf.mt76.omac_idx; + basic_req->band_idx = mvif->bss_conf.mt76.band_idx; + basic_req->wmm_idx = mvif->bss_conf.mt76.wmm_idx; basic_req->conn_state = !enable; switch (vif->type) { @@ -2217,8 +2217,8 @@ mt7925_mcu_bss_mld_tlv(struct sk_buff *skb, mld = (struct bss_mld_tlv *)tlv; mld->link_id = sta ? (is_mld ? vif->bss_conf.link_id : 0) : 0xff; - mld->group_mld_id = is_mld ? mvif->mt76.idx : 0xff; - mld->own_mld_id = mvif->mt76.idx + 32; + mld->group_mld_id = is_mld ? mvif->bss_conf.mt76.idx : 0xff; + mld->own_mld_id = mvif->bss_conf.mt76.idx + 32; mld->remap_idx = 0xff; if (sta) @@ -2301,7 +2301,7 @@ int mt7925_mcu_set_timing(struct mt792x_phy *phy, struct mt792x_dev *dev = phy->dev; struct sk_buff *skb; - skb = __mt7925_mcu_alloc_bss_req(&dev->mt76, &mvif->mt76, + skb = __mt7925_mcu_alloc_bss_req(&dev->mt76, &mvif->bss_conf.mt76, MT7925_BSS_UPDATE_MAX_SIZE); if (IS_ERR(skb)) return PTR_ERR(skb); @@ -2323,7 +2323,7 @@ int mt7925_mcu_add_bss_info(struct mt792x_phy *phy, struct sk_buff *skb; int err; - skb = __mt7925_mcu_alloc_bss_req(&dev->mt76, &mvif->mt76, + skb = __mt7925_mcu_alloc_bss_req(&dev->mt76, &mvif->bss_conf.mt76, MT7925_BSS_UPDATE_MAX_SIZE); if (IS_ERR(skb)) return PTR_ERR(skb); @@ -2348,7 +2348,7 @@ int mt7925_mcu_add_bss_info(struct mt792x_phy *phy, if (err < 0) return err; - return mt7925_mcu_set_chctx(phy->mt76, &mvif->mt76, ctx); + return mt7925_mcu_set_chctx(phy->mt76, &mvif->bss_conf.mt76, ctx); } int mt7925_mcu_set_dbdc(struct mt76_phy *phy) diff --git a/drivers/net/wireless/mediatek/mt76/mt792x.h b/drivers/net/wireless/mediatek/mt76/mt792x.h index 4c14e2c5da5b..e377f8ea9782 100644 --- a/drivers/net/wireless/mediatek/mt76/mt792x.h +++ b/drivers/net/wireless/mediatek/mt76/mt792x.h @@ -96,17 +96,19 @@ struct mt792x_sta { DECLARE_EWMA(rssi, 10, 8); -struct mt792x_vif { +struct mt792x_bss_conf { struct mt76_vif mt76; /* must be first */ + struct ewma_rssi rssi; + struct ieee80211_tx_queue_params queue_params[IEEE80211_NUM_ACS]; +}; + +struct mt792x_vif { + struct mt792x_bss_conf bss_conf; /* must be first */ struct mt792x_sta sta; struct mt792x_sta *wep_sta; struct mt792x_phy *phy; - - struct ewma_rssi rssi; - - struct ieee80211_tx_queue_params queue_params[IEEE80211_NUM_ACS]; }; struct mt792x_phy { diff --git a/drivers/net/wireless/mediatek/mt76/mt792x_core.c b/drivers/net/wireless/mediatek/mt76/mt792x_core.c index a405af8d9052..4b4afc1add6e 100644 --- a/drivers/net/wireless/mediatek/mt76/mt792x_core.c +++ b/drivers/net/wireless/mediatek/mt76/mt792x_core.c @@ -128,8 +128,8 @@ void mt792x_remove_interface(struct ieee80211_hw *hw, rcu_assign_pointer(dev->mt76.wcid[idx], NULL); - dev->mt76.vif_mask &= ~BIT_ULL(mvif->mt76.idx); - phy->omac_mask &= ~BIT_ULL(mvif->mt76.omac_idx); + dev->mt76.vif_mask &= ~BIT_ULL(mvif->bss_conf.mt76.idx); + phy->omac_mask &= ~BIT_ULL(mvif->bss_conf.mt76.omac_idx); mt792x_mutex_release(dev); spin_lock_bh(&dev->mt76.sta_poll_lock); @@ -149,7 +149,7 @@ int mt792x_conf_tx(struct ieee80211_hw *hw, struct ieee80211_vif *vif, /* no need to update right away, we'll get BSS_CHANGED_QOS */ queue = mt76_connac_lmac_mapping(queue); - mvif->queue_params[queue] = *params; + mvif->bss_conf.queue_params[queue] = *params; return 0; } @@ -178,7 +178,7 @@ u64 mt792x_get_tsf(struct ieee80211_hw *hw, struct ieee80211_vif *vif) { struct mt792x_vif *mvif = (struct mt792x_vif *)vif->drv_priv; struct mt792x_dev *dev = mt792x_hw_dev(hw); - u8 omac_idx = mvif->mt76.omac_idx; + u8 omac_idx = mvif->bss_conf.mt76.omac_idx; union { u64 t64; u32 t32[2]; @@ -204,7 +204,7 @@ void mt792x_set_tsf(struct ieee80211_hw *hw, struct ieee80211_vif *vif, { struct mt792x_vif *mvif = (struct mt792x_vif *)vif->drv_priv; struct mt792x_dev *dev = mt792x_hw_dev(hw); - u8 omac_idx = mvif->mt76.omac_idx; + u8 omac_idx = mvif->bss_conf.mt76.omac_idx; union { u64 t64; u32 t32[2]; @@ -265,7 +265,7 @@ int mt792x_assign_vif_chanctx(struct ieee80211_hw *hw, struct mt792x_dev *dev = mt792x_hw_dev(hw); mutex_lock(&dev->mt76.mutex); - mvif->mt76.ctx = ctx; + mvif->bss_conf.mt76.ctx = ctx; mutex_unlock(&dev->mt76.mutex); return 0; @@ -281,7 +281,7 @@ void mt792x_unassign_vif_chanctx(struct ieee80211_hw *hw, struct mt792x_dev *dev = mt792x_hw_dev(hw); mutex_lock(&dev->mt76.mutex); - mvif->mt76.ctx = NULL; + mvif->bss_conf.mt76.ctx = NULL; mutex_unlock(&dev->mt76.mutex); } EXPORT_SYMBOL_GPL(mt792x_unassign_vif_chanctx); @@ -405,7 +405,7 @@ mt792x_ethtool_worker(void *wi_data, struct ieee80211_sta *sta) struct mt792x_sta *msta = (struct mt792x_sta *)sta->drv_priv; struct mt76_ethtool_worker_info *wi = wi_data; - if (msta->vif->mt76.idx != wi->idx) + if (msta->vif->bss_conf.mt76.idx != wi->idx) return; mt76_ethtool_worker(wi, &msta->wcid.stats, true); @@ -421,7 +421,7 @@ void mt792x_get_et_stats(struct ieee80211_hw *hw, struct ieee80211_vif *vif, struct mt76_mib_stats *mib = &phy->mib; struct mt76_ethtool_worker_info wi = { .data = data, - .idx = mvif->mt76.idx, + .idx = mvif->bss_conf.mt76.idx, }; int i, ei = 0; diff --git a/drivers/net/wireless/mediatek/mt76/mt792x_mac.c b/drivers/net/wireless/mediatek/mt76/mt792x_mac.c index eb29434abee1..45dd94ff386d 100644 --- a/drivers/net/wireless/mediatek/mt76/mt792x_mac.c +++ b/drivers/net/wireless/mediatek/mt76/mt792x_mac.c @@ -173,7 +173,7 @@ mt792x_mac_rssi_iter(void *priv, u8 *mac, struct ieee80211_vif *vif) if (!ether_addr_equal(vif->addr, hdr->addr1)) return; - ewma_rssi_add(&mvif->rssi, -status->signal); + ewma_rssi_add(&mvif->bss_conf.rssi, -status->signal); } void mt792x_mac_assoc_rssi(struct mt792x_dev *dev, struct sk_buff *skb) From patchwork Thu Jun 13 03:01:56 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Sean Wang X-Patchwork-Id: 13696036 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from bombadil.infradead.org (bombadil.infradead.org [198.137.202.133]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.lore.kernel.org (Postfix) with ESMTPS id 2607FC27C77 for ; Thu, 13 Jun 2024 03:03:00 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=lists.infradead.org; s=bombadil.20210309; h=Sender:List-Subscribe:List-Help :List-Post:List-Archive:List-Unsubscribe:List-Id:Content-Transfer-Encoding: MIME-Version:References:In-Reply-To:Message-Id:Date:Subject:Cc:To:From: Reply-To:Content-Type:Content-ID:Content-Description:Resent-Date:Resent-From: Resent-Sender:Resent-To:Resent-Cc:Resent-Message-ID:List-Owner; bh=OJs+pWA0FK/vqrreddQoIY2LJaLCDK8lojdOWHfMP+4=; b=PpjFkK1BbN/C1N8piG2+Jfhuru 7Z5Pjn/oWnepHKGjsH/5Qn6rS8m8uE05eUp69DXlkSJU95R/d76+ksCxQ+ei7ds9RPxS+uYpRVt7q ABFRdDdEA9ov73dJ/2gBCkLI7iowg8c5pPeqS13laf6yKc23nMoLsV8gLcwJL2xetWjoMkSPRdaVa vOI8T8jdIUVXtcSk9cth41bDRPYWsXuTXcQp4BXYNYaelxeUImtAQ7lG3NJ0upHBw8n9E5rlYrtjA ynipXv2yB0PjNQ6Kr9q0VOgX08OWEjl/JE3cQEJ5IgVkwK/HH4sjcNcuXU+3ayui/6eDi6hxwfuRK bjeOP4EQ==; Received: from localhost ([::1] helo=bombadil.infradead.org) by bombadil.infradead.org with esmtp (Exim 4.97.1 #2 (Red Hat Linux)) id 1sHajr-0000000EvWu-2l3m; Thu, 13 Jun 2024 03:02:59 +0000 Received: from mail-oo1-f50.google.com ([209.85.161.50]) by bombadil.infradead.org with esmtps (Exim 4.97.1 #2 (Red Hat Linux)) id 1sHajj-0000000EvTM-3z5M for linux-mediatek@lists.infradead.org; Thu, 13 Jun 2024 03:02:57 +0000 Received: by mail-oo1-f50.google.com with SMTP id 006d021491bc7-5bb33237b60so22123eaf.0 for ; Wed, 12 Jun 2024 20:02:51 -0700 (PDT) X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1718247771; x=1718852571; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:x-gm-message-state:from:to:cc :subject:date:message-id:reply-to; bh=OJs+pWA0FK/vqrreddQoIY2LJaLCDK8lojdOWHfMP+4=; b=BnESsDqydeF59zZNmmw6zWVVJo4UPskJsttJpIhXMeIgsV1QU/fgw8K4YpVuVwS4/D AVvZxpQ5v1uVUkoeqJd4qo9a8a8WzYIKTi4gKQAiLMlKYVCiiBR2dvBj7rG3vsirEqtA KLt36Bi1kaca1W507asD9YN22HacbNT7FgmDif/hYRkKRiXE5AEJQ2CMrYFtmpXCHjRW OIUOslce574Suhdw3AaOvCZEwdtScvhivsNMQ+yhiw9/XH/HIYkg6tUqOB/VmWwH5k0c Ggn0Z1iGHY+vbtzLPrLjDYaZMD5e5Svo3oRErN6Z6Y1q5GCaM4s/aXy4wioB1S84puvt k3wA== X-Forwarded-Encrypted: i=1; AJvYcCWtDdagdkLVMHoZqH5wAQgDN1XJwIO/R54VvzkZqtFJlW/Hb3p8aY2k0R9gdtQl4KJggdwoo4x8hM1YSsCECrEuNxHwZsaI2TzSjCJvjiTzF/Zy X-Gm-Message-State: AOJu0YxEvWVFzuHOe9G0eRRjH00GrfgutlAZcbEL2Ya91L+r5l7kpnq1 iWReMTy819BDXThrZkWtIRRRyJ2TGQG51QjKSKr5IO6TAF2rAQ/0 X-Google-Smtp-Source: AGHT+IGyiUOWNetC4oWMDxs3+zNOSXbCfx0lDtCFW5uxgzZE+dNIdDR+LHPiy/rQfzTY2iMgrx2oZw== X-Received: by 2002:a4a:3101:0:b0:5ba:ca8a:6598 with SMTP id 006d021491bc7-5bb3b7b972bmr3905843eaf.0.1718247770704; Wed, 12 Jun 2024 20:02:50 -0700 (PDT) Received: from sean-ThinkPad-T450s.lan ([207.191.35.252]) by smtp.gmail.com with ESMTPSA id 006d021491bc7-5bd629263c5sm67685eaf.46.2024.06.12.20.02.49 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Wed, 12 Jun 2024 20:02:50 -0700 (PDT) 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 02/47] wifi: mt76: mt792x: add struct mt792x_link_sta Date: Wed, 12 Jun 2024 20:01:56 -0700 Message-Id: <20240613030241.5771-3-sean.wang@kernel.org> X-Mailer: git-send-email 2.25.1 In-Reply-To: <20240613030241.5771-1-sean.wang@kernel.org> References: <20240613030241.5771-1-sean.wang@kernel.org> MIME-Version: 1.0 X-CRM114-Version: 20100106-BlameMichelson ( TRE 0.8.0 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20240612_200252_271952_BB446B14 X-CRM114-Status: GOOD ( 20.73 ) X-BeenThere: linux-mediatek@lists.infradead.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Sender: "Linux-mediatek" Errors-To: linux-mediatek-bounces+linux-mediatek=archiver.kernel.org@lists.infradead.org From: Deren Wu We are introducing a new structure, mt792x_link_sta, to manage per-link configurations in preparation for future station (STA) support of Multi-Link Operation (MLO). This patch only includes structural changes and does not involve any logic changes. We have moved relevant parameters, such as the wcid from the mt76_wcid structure, from the mt7921x_sta structure to the mt792x_link_sta structure. For current drivers that do not support MLO, there is only one link STA, and link information is accessed via the deflink member. However, we have not yet created the per-link BSS configuration indexed by link ID for Multi-Link Device (MLD) support in mt7921x_sta. This step needs to be completed before adding MLD support for STA mode. Co-developed-by: Sean Wang Signed-off-by: Sean Wang Signed-off-by: Deren Wu --- .../net/wireless/mediatek/mt76/mt7921/mac.c | 65 ++++++++-------- .../net/wireless/mediatek/mt76/mt7921/main.c | 76 +++++++++---------- .../net/wireless/mediatek/mt76/mt7921/mcu.c | 4 +- .../wireless/mediatek/mt76/mt7921/pci_mac.c | 4 +- .../net/wireless/mediatek/mt76/mt7925/mac.c | 66 ++++++++-------- .../net/wireless/mediatek/mt76/mt7925/main.c | 66 ++++++++-------- .../net/wireless/mediatek/mt76/mt7925/mcu.c | 17 +++-- .../wireless/mediatek/mt76/mt7925/pci_mac.c | 4 +- drivers/net/wireless/mediatek/mt76/mt792x.h | 10 ++- .../net/wireless/mediatek/mt76/mt792x_core.c | 28 +++---- .../net/wireless/mediatek/mt76/mt792x_mac.c | 6 +- 11 files changed, 180 insertions(+), 166 deletions(-) diff --git a/drivers/net/wireless/mediatek/mt76/mt7921/mac.c b/drivers/net/wireless/mediatek/mt76/mt7921/mac.c index 867e14f6b93a..5ea01c39e2e1 100644 --- a/drivers/net/wireless/mediatek/mt76/mt7921/mac.c +++ b/drivers/net/wireless/mediatek/mt76/mt7921/mac.c @@ -39,6 +39,7 @@ static void mt7921_mac_sta_poll(struct mt792x_dev *dev) }; struct ieee80211_sta *sta; struct mt792x_sta *msta; + struct mt792x_link_sta *mlink; u32 tx_time[IEEE80211_NUM_ACS], rx_time[IEEE80211_NUM_ACS]; LIST_HEAD(sta_poll_list); struct rate_info *rate; @@ -60,23 +61,25 @@ static void mt7921_mac_sta_poll(struct mt792x_dev *dev) spin_unlock_bh(&dev->mt76.sta_poll_lock); break; } - msta = list_first_entry(&sta_poll_list, - struct mt792x_sta, wcid.poll_list); - list_del_init(&msta->wcid.poll_list); + mlink = list_first_entry(&sta_poll_list, + struct mt792x_link_sta, + wcid.poll_list); + msta = container_of(mlink, struct mt792x_sta, deflink); + list_del_init(&mlink->wcid.poll_list); spin_unlock_bh(&dev->mt76.sta_poll_lock); - idx = msta->wcid.idx; + idx = mlink->wcid.idx; addr = mt7921_mac_wtbl_lmac_addr(idx, MT_WTBL_AC0_CTT_OFFSET); for (i = 0; i < IEEE80211_NUM_ACS; i++) { - u32 tx_last = msta->airtime_ac[i]; - u32 rx_last = msta->airtime_ac[i + 4]; + u32 tx_last = mlink->airtime_ac[i]; + u32 rx_last = mlink->airtime_ac[i + 4]; - msta->airtime_ac[i] = mt76_rr(dev, addr); - msta->airtime_ac[i + 4] = mt76_rr(dev, addr + 4); + mlink->airtime_ac[i] = mt76_rr(dev, addr); + mlink->airtime_ac[i + 4] = mt76_rr(dev, addr + 4); - tx_time[i] = msta->airtime_ac[i] - tx_last; - rx_time[i] = msta->airtime_ac[i + 4] - rx_last; + tx_time[i] = mlink->airtime_ac[i] - tx_last; + rx_time[i] = mlink->airtime_ac[i + 4] - rx_last; if ((tx_last | rx_last) & BIT(30)) clear = true; @@ -87,10 +90,10 @@ static void mt7921_mac_sta_poll(struct mt792x_dev *dev) if (clear) { mt7921_mac_wtbl_update(dev, idx, MT_WTBL_UPDATE_ADM_COUNT_CLEAR); - memset(msta->airtime_ac, 0, sizeof(msta->airtime_ac)); + memset(mlink->airtime_ac, 0, sizeof(mlink->airtime_ac)); } - if (!msta->wcid.sta) + if (!mlink->wcid.sta) continue; sta = container_of((void *)msta, struct ieee80211_sta, @@ -113,7 +116,7 @@ static void mt7921_mac_sta_poll(struct mt792x_dev *dev) * we need to make sure that flags match so polling GI * from per-sta counters directly. */ - rate = &msta->wcid.rate; + rate = &mlink->wcid.rate; addr = mt7921_mac_wtbl_lmac_addr(idx, MT_WTBL_TXRX_CAP_RATE_OFFSET); val = mt76_rr(dev, addr); @@ -154,10 +157,10 @@ static void mt7921_mac_sta_poll(struct mt792x_dev *dev) rssi[2] = to_rssi(GENMASK(23, 16), val); rssi[3] = to_rssi(GENMASK(31, 14), val); - msta->ack_signal = + mlink->ack_signal = mt76_rx_signal(msta->vif->phy->mt76->antenna_mask, rssi); - ewma_avg_signal_add(&msta->avg_ack_signal, -msta->ack_signal); + ewma_avg_signal_add(&mlink->avg_ack_signal, -mlink->ack_signal); } } @@ -180,6 +183,7 @@ mt7921_mac_fill_rx(struct mt792x_dev *dev, struct sk_buff *skb) u32 rxd3 = le32_to_cpu(rxd[3]); u32 rxd4 = le32_to_cpu(rxd[4]); struct mt792x_sta *msta = NULL; + struct mt792x_link_sta *mlink; u16 seq_ctrl = 0; __le16 fc = 0; u8 mode = 0; @@ -210,10 +214,11 @@ mt7921_mac_fill_rx(struct mt792x_dev *dev, struct sk_buff *skb) status->wcid = mt792x_rx_get_wcid(dev, idx, unicast); if (status->wcid) { - msta = container_of(status->wcid, struct mt792x_sta, wcid); + mlink = container_of(status->wcid, struct mt792x_link_sta, wcid); + msta = container_of(mlink, struct mt792x_sta, deflink); spin_lock_bh(&dev->mt76.sta_poll_lock); - if (list_empty(&msta->wcid.poll_list)) - list_add_tail(&msta->wcid.poll_list, + if (list_empty(&mlink->wcid.poll_list)) + list_add_tail(&mlink->wcid.poll_list, &dev->mt76.sta_poll_list); spin_unlock_bh(&dev->mt76.sta_poll_lock); } @@ -444,7 +449,7 @@ mt7921_mac_fill_rx(struct mt792x_dev *dev, struct sk_buff *skb) void mt7921_mac_add_txs(struct mt792x_dev *dev, void *data) { - struct mt792x_sta *msta = NULL; + struct mt792x_link_sta *mlink; struct mt76_wcid *wcid; __le32 *txs_data = data; u16 wcidx; @@ -468,15 +473,15 @@ void mt7921_mac_add_txs(struct mt792x_dev *dev, void *data) if (!wcid) goto out; - msta = container_of(wcid, struct mt792x_sta, wcid); + mlink = container_of(wcid, struct mt792x_link_sta, wcid); mt76_connac2_mac_add_txs_skb(&dev->mt76, wcid, pid, txs_data); if (!wcid->sta) goto out; spin_lock_bh(&dev->mt76.sta_poll_lock); - if (list_empty(&msta->wcid.poll_list)) - list_add_tail(&msta->wcid.poll_list, &dev->mt76.sta_poll_list); + if (list_empty(&mlink->wcid.poll_list)) + list_add_tail(&mlink->wcid.poll_list, &dev->mt76.sta_poll_list); spin_unlock_bh(&dev->mt76.sta_poll_lock); out: @@ -513,7 +518,7 @@ static void mt7921_mac_tx_free(struct mt792x_dev *dev, void *data, int len) * 1'b0: msdu_id with the same 'wcid pair' as above. */ if (info & MT_TX_FREE_PAIR) { - struct mt792x_sta *msta; + struct mt792x_link_sta *mlink; u16 idx; count++; @@ -523,10 +528,10 @@ static void mt7921_mac_tx_free(struct mt792x_dev *dev, void *data, int len) if (!sta) continue; - msta = container_of(wcid, struct mt792x_sta, wcid); + mlink = container_of(wcid, struct mt792x_link_sta, wcid); spin_lock_bh(&mdev->sta_poll_lock); - if (list_empty(&msta->wcid.poll_list)) - list_add_tail(&msta->wcid.poll_list, + if (list_empty(&mlink->wcid.poll_list)) + list_add_tail(&mlink->wcid.poll_list, &mdev->sta_poll_list); spin_unlock_bh(&mdev->sta_poll_lock); continue; @@ -641,11 +646,11 @@ mt7921_vif_connect_iter(void *priv, u8 *mac, if (vif->type == NL80211_IFTYPE_STATION) ieee80211_disconnect(vif, true); - mt76_connac_mcu_uni_add_dev(&dev->mphy, vif, &mvif->sta.wcid, true); + mt76_connac_mcu_uni_add_dev(&dev->mphy, vif, &mvif->sta.deflink.wcid, true); mt7921_mcu_set_tx(dev, vif); if (vif->type == NL80211_IFTYPE_AP) { - mt76_connac_mcu_uni_add_bss(dev->phy.mt76, vif, &mvif->sta.wcid, + mt76_connac_mcu_uni_add_bss(dev->phy.mt76, vif, &mvif->sta.deflink.wcid, true, NULL); mt7921_mcu_sta_update(dev, NULL, vif, true, MT76_STA_INFO_STATE_NONE); @@ -784,9 +789,9 @@ int mt7921_usb_sdio_tx_prepare_skb(struct mt76_dev *mdev, void *txwi_ptr, if (sta) { struct mt792x_sta *msta = (struct mt792x_sta *)sta->drv_priv; - if (time_after(jiffies, msta->last_txs + HZ / 4)) { + if (time_after(jiffies, msta->deflink.last_txs + HZ / 4)) { info->flags |= IEEE80211_TX_CTL_REQ_TX_STATUS; - msta->last_txs = jiffies; + msta->deflink.last_txs = jiffies; } } diff --git a/drivers/net/wireless/mediatek/mt76/mt7921/main.c b/drivers/net/wireless/mediatek/mt76/mt7921/main.c index 2752e1735575..3141807ec54b 100644 --- a/drivers/net/wireless/mediatek/mt76/mt7921/main.c +++ b/drivers/net/wireless/mediatek/mt76/mt7921/main.c @@ -306,7 +306,7 @@ mt7921_add_interface(struct ieee80211_hw *hw, struct ieee80211_vif *vif) mvif->bss_conf.mt76.band_idx = 0; mvif->bss_conf.mt76.wmm_idx = mvif->bss_conf.mt76.idx % MT76_CONNAC_MAX_WMM_SETS; - ret = mt76_connac_mcu_uni_add_dev(&dev->mphy, vif, &mvif->sta.wcid, + ret = mt76_connac_mcu_uni_add_dev(&dev->mphy, vif, &mvif->sta.deflink.wcid, true); if (ret) goto out; @@ -316,19 +316,19 @@ mt7921_add_interface(struct ieee80211_hw *hw, struct ieee80211_vif *vif) idx = MT792x_WTBL_RESERVED - mvif->bss_conf.mt76.idx; - INIT_LIST_HEAD(&mvif->sta.wcid.poll_list); - mvif->sta.wcid.idx = idx; - mvif->sta.wcid.phy_idx = mvif->bss_conf.mt76.band_idx; - mvif->sta.wcid.hw_key_idx = -1; - mvif->sta.wcid.tx_info |= MT_WCID_TX_INFO_SET; - mt76_wcid_init(&mvif->sta.wcid); + INIT_LIST_HEAD(&mvif->sta.deflink.wcid.poll_list); + mvif->sta.deflink.wcid.idx = idx; + mvif->sta.deflink.wcid.phy_idx = mvif->bss_conf.mt76.band_idx; + mvif->sta.deflink.wcid.hw_key_idx = -1; + mvif->sta.deflink.wcid.tx_info |= MT_WCID_TX_INFO_SET; + mt76_wcid_init(&mvif->sta.deflink.wcid); mt7921_mac_wtbl_update(dev, idx, MT_WTBL_UPDATE_ADM_COUNT_CLEAR); ewma_rssi_init(&mvif->bss_conf.rssi); - rcu_assign_pointer(dev->mt76.wcid[idx], &mvif->sta.wcid); + rcu_assign_pointer(dev->mt76.wcid[idx], &mvif->sta.deflink.wcid); if (vif->txq) { mtxq = (struct mt76_txq *)vif->txq->drv_priv; mtxq->wcid = idx; @@ -494,7 +494,7 @@ static int mt7921_set_key(struct ieee80211_hw *hw, enum set_key_cmd cmd, struct mt792x_vif *mvif = (struct mt792x_vif *)vif->drv_priv; struct mt792x_sta *msta = sta ? (struct mt792x_sta *)sta->drv_priv : &mvif->sta; - struct mt76_wcid *wcid = &msta->wcid; + struct mt76_wcid *wcid = &msta->deflink.wcid; u8 *wcid_keyidx = &wcid->hw_key_idx; int idx = key->keyidx, err = 0; @@ -541,18 +541,18 @@ static int mt7921_set_key(struct ieee80211_hw *hw, enum set_key_cmd cmd, } mt76_wcid_key_setup(&dev->mt76, wcid, key); - err = mt76_connac_mcu_add_key(&dev->mt76, vif, &msta->bip, + err = mt76_connac_mcu_add_key(&dev->mt76, vif, &msta->deflink.bip, key, MCU_UNI_CMD(STA_REC_UPDATE), - &msta->wcid, cmd); + &msta->deflink.wcid, cmd); if (err) goto out; if (key->cipher == WLAN_CIPHER_SUITE_WEP104 || key->cipher == WLAN_CIPHER_SUITE_WEP40) err = mt76_connac_mcu_add_key(&dev->mt76, vif, - &mvif->wep_sta->bip, + &mvif->wep_sta->deflink.bip, key, MCU_UNI_CMD(STA_REC_UPDATE), - &mvif->wep_sta->wcid, cmd); + &mvif->wep_sta->deflink.wcid, cmd); out: mt792x_mutex_release(dev); @@ -799,13 +799,13 @@ int mt7921_mac_sta_add(struct mt76_dev *mdev, struct ieee80211_vif *vif, if (idx < 0) return -ENOSPC; - INIT_LIST_HEAD(&msta->wcid.poll_list); + INIT_LIST_HEAD(&msta->deflink.wcid.poll_list); msta->vif = mvif; - msta->wcid.sta = 1; - msta->wcid.idx = idx; - msta->wcid.phy_idx = mvif->bss_conf.mt76.band_idx; - msta->wcid.tx_info |= MT_WCID_TX_INFO_SET; - msta->last_txs = jiffies; + msta->deflink.wcid.sta = 1; + msta->deflink.wcid.idx = idx; + msta->deflink.wcid.phy_idx = mvif->bss_conf.mt76.band_idx; + msta->deflink.wcid.tx_info |= MT_WCID_TX_INFO_SET; + msta->deflink.last_txs = jiffies; ret = mt76_connac_pm_wake(&dev->mphy, &dev->pm); if (ret) @@ -840,14 +840,14 @@ void mt7921_mac_sta_assoc(struct mt76_dev *mdev, struct ieee80211_vif *vif, mt792x_mutex_acquire(dev); if (vif->type == NL80211_IFTYPE_STATION && !sta->tdls) - mt76_connac_mcu_uni_add_bss(&dev->mphy, vif, &mvif->sta.wcid, + mt76_connac_mcu_uni_add_bss(&dev->mphy, vif, &mvif->sta.deflink.wcid, true, mvif->bss_conf.mt76.ctx); - ewma_avg_signal_init(&msta->avg_ack_signal); + ewma_avg_signal_init(&msta->deflink.avg_ack_signal); - mt7921_mac_wtbl_update(dev, msta->wcid.idx, + mt7921_mac_wtbl_update(dev, msta->deflink.wcid.idx, MT_WTBL_UPDATE_ADM_COUNT_CLEAR); - memset(msta->airtime_ac, 0, sizeof(msta->airtime_ac)); + memset(msta->deflink.airtime_ac, 0, sizeof(msta->deflink.airtime_ac)); mt7921_mcu_sta_update(dev, sta, vif, true, MT76_STA_INFO_STATE_ASSOC); @@ -861,11 +861,11 @@ void mt7921_mac_sta_remove(struct mt76_dev *mdev, struct ieee80211_vif *vif, struct mt792x_dev *dev = container_of(mdev, struct mt792x_dev, mt76); struct mt792x_sta *msta = (struct mt792x_sta *)sta->drv_priv; - mt76_connac_free_pending_tx_skbs(&dev->pm, &msta->wcid); + mt76_connac_free_pending_tx_skbs(&dev->pm, &msta->deflink.wcid); mt76_connac_pm_wake(&dev->mphy, &dev->pm); mt7921_mcu_sta_update(dev, sta, vif, false, MT76_STA_INFO_STATE_NONE); - mt7921_mac_wtbl_update(dev, msta->wcid.idx, + mt7921_mac_wtbl_update(dev, msta->deflink.wcid.idx, MT_WTBL_UPDATE_ADM_COUNT_CLEAR); if (vif->type == NL80211_IFTYPE_STATION) { @@ -875,13 +875,13 @@ void mt7921_mac_sta_remove(struct mt76_dev *mdev, struct ieee80211_vif *vif, ewma_rssi_init(&mvif->bss_conf.rssi); if (!sta->tdls) mt76_connac_mcu_uni_add_bss(&dev->mphy, vif, - &mvif->sta.wcid, false, + &mvif->sta.deflink.wcid, false, mvif->bss_conf.mt76.ctx); } spin_lock_bh(&dev->mt76.sta_poll_lock); - if (!list_empty(&msta->wcid.poll_list)) - list_del_init(&msta->wcid.poll_list); + if (!list_empty(&msta->deflink.wcid.poll_list)) + list_del_init(&msta->deflink.wcid.poll_list); spin_unlock_bh(&dev->mt76.sta_poll_lock); mt7921_regd_set_6ghz_power_type(vif, false); @@ -923,12 +923,12 @@ mt7921_ampdu_action(struct ieee80211_hw *hw, struct ieee80211_vif *vif, mt792x_mutex_acquire(dev); switch (action) { case IEEE80211_AMPDU_RX_START: - mt76_rx_aggr_start(&dev->mt76, &msta->wcid, tid, ssn, + mt76_rx_aggr_start(&dev->mt76, &msta->deflink.wcid, tid, ssn, params->buf_size); mt7921_mcu_uni_rx_ba(dev, params, true); break; case IEEE80211_AMPDU_RX_STOP: - mt76_rx_aggr_stop(&dev->mt76, &msta->wcid, tid); + mt76_rx_aggr_stop(&dev->mt76, &msta->deflink.wcid, tid); mt7921_mcu_uni_rx_ba(dev, params, false); break; case IEEE80211_AMPDU_TX_OPERATIONAL: @@ -939,16 +939,16 @@ mt7921_ampdu_action(struct ieee80211_hw *hw, struct ieee80211_vif *vif, case IEEE80211_AMPDU_TX_STOP_FLUSH: case IEEE80211_AMPDU_TX_STOP_FLUSH_CONT: mtxq->aggr = false; - clear_bit(tid, &msta->wcid.ampdu_state); + clear_bit(tid, &msta->deflink.wcid.ampdu_state); mt7921_mcu_uni_tx_ba(dev, params, false); break; case IEEE80211_AMPDU_TX_START: - set_bit(tid, &msta->wcid.ampdu_state); + set_bit(tid, &msta->deflink.wcid.ampdu_state); ret = IEEE80211_AMPDU_TX_START_IMMEDIATE; break; case IEEE80211_AMPDU_TX_STOP_CONT: mtxq->aggr = false; - clear_bit(tid, &msta->wcid.ampdu_state); + clear_bit(tid, &msta->deflink.wcid.ampdu_state); mt7921_mcu_uni_tx_ba(dev, params, false); ieee80211_stop_tx_ba_cb_irqsafe(vif, sta->addr, tid); break; @@ -1166,11 +1166,11 @@ static void mt7921_sta_set_decap_offload(struct ieee80211_hw *hw, mt792x_mutex_acquire(dev); if (enabled) - set_bit(MT_WCID_FLAG_HDR_TRANS, &msta->wcid.flags); + set_bit(MT_WCID_FLAG_HDR_TRANS, &msta->deflink.wcid.flags); else - clear_bit(MT_WCID_FLAG_HDR_TRANS, &msta->wcid.flags); + clear_bit(MT_WCID_FLAG_HDR_TRANS, &msta->deflink.wcid.flags); - mt76_connac_mcu_sta_update_hdr_trans(&dev->mt76, vif, &msta->wcid, + mt76_connac_mcu_sta_update_hdr_trans(&dev->mt76, vif, &msta->deflink.wcid, MCU_UNI_CMD(STA_REC_UPDATE)); mt792x_mutex_release(dev); @@ -1294,7 +1294,7 @@ mt7921_start_ap(struct ieee80211_hw *hw, struct ieee80211_vif *vif, mt792x_mutex_acquire(dev); - err = mt76_connac_mcu_uni_add_bss(phy->mt76, vif, &mvif->sta.wcid, + err = mt76_connac_mcu_uni_add_bss(phy->mt76, vif, &mvif->sta.deflink.wcid, true, mvif->bss_conf.mt76.ctx); if (err) goto out; @@ -1326,7 +1326,7 @@ mt7921_stop_ap(struct ieee80211_hw *hw, struct ieee80211_vif *vif, if (err) goto out; - mt76_connac_mcu_uni_add_bss(phy->mt76, vif, &mvif->sta.wcid, false, + mt76_connac_mcu_uni_add_bss(phy->mt76, vif, &mvif->sta.deflink.wcid, false, mvif->bss_conf.mt76.ctx); out: diff --git a/drivers/net/wireless/mediatek/mt76/mt7921/mcu.c b/drivers/net/wireless/mediatek/mt76/mt7921/mcu.c index 0453af012016..394fcd799345 100644 --- a/drivers/net/wireless/mediatek/mt76/mt7921/mcu.c +++ b/drivers/net/wireless/mediatek/mt76/mt7921/mcu.c @@ -386,7 +386,7 @@ int mt7921_mcu_uni_tx_ba(struct mt792x_dev *dev, struct mt792x_sta *msta = (struct mt792x_sta *)params->sta->drv_priv; if (enable && !params->amsdu) - msta->wcid.amsdu = false; + msta->deflink.wcid.amsdu = false; return mt76_connac_mcu_sta_ba(&dev->mt76, &msta->vif->bss_conf.mt76, params, MCU_UNI_CMD(STA_REC_UPDATE), @@ -1055,7 +1055,7 @@ int mt7921_mcu_sta_update(struct mt792x_dev *dev, struct ieee80211_sta *sta, struct mt792x_sta *msta; msta = sta ? (struct mt792x_sta *)sta->drv_priv : NULL; - info.wcid = msta ? &msta->wcid : &mvif->sta.wcid; + info.wcid = msta ? &msta->deflink.wcid : &mvif->sta.deflink.wcid; info.newly = msta ? state != MT76_STA_INFO_STATE_ASSOC : true; return mt76_connac_mcu_sta_cmd(&dev->mphy, &info); diff --git a/drivers/net/wireless/mediatek/mt76/mt7921/pci_mac.c b/drivers/net/wireless/mediatek/mt76/mt7921/pci_mac.c index c866144ff061..a0c19e861ce1 100644 --- a/drivers/net/wireless/mediatek/mt76/mt7921/pci_mac.c +++ b/drivers/net/wireless/mediatek/mt76/mt7921/pci_mac.c @@ -34,9 +34,9 @@ int mt7921e_tx_prepare_skb(struct mt76_dev *mdev, void *txwi_ptr, if (sta) { struct mt792x_sta *msta = (struct mt792x_sta *)sta->drv_priv; - if (time_after(jiffies, msta->last_txs + HZ / 4)) { + if (time_after(jiffies, msta->deflink.last_txs + HZ / 4)) { info->flags |= IEEE80211_TX_CTL_REQ_TX_STATUS; - msta->last_txs = jiffies; + msta->deflink.last_txs = jiffies; } } diff --git a/drivers/net/wireless/mediatek/mt76/mt7925/mac.c b/drivers/net/wireless/mediatek/mt76/mt7925/mac.c index c2460ef4993d..88e7b2ff4593 100644 --- a/drivers/net/wireless/mediatek/mt76/mt7925/mac.c +++ b/drivers/net/wireless/mediatek/mt76/mt7925/mac.c @@ -28,6 +28,7 @@ static void mt7925_mac_sta_poll(struct mt792x_dev *dev) }; struct ieee80211_sta *sta; struct mt792x_sta *msta; + struct mt792x_link_sta *mlink; u32 tx_time[IEEE80211_NUM_ACS], rx_time[IEEE80211_NUM_ACS]; LIST_HEAD(sta_poll_list); struct rate_info *rate; @@ -46,24 +47,25 @@ static void mt7925_mac_sta_poll(struct mt792x_dev *dev) if (list_empty(&sta_poll_list)) break; - msta = list_first_entry(&sta_poll_list, - struct mt792x_sta, wcid.poll_list); + mlink = list_first_entry(&sta_poll_list, + struct mt792x_link_sta, wcid.poll_list); + msta = container_of(mlink, struct mt792x_sta, deflink); spin_lock_bh(&dev->mt76.sta_poll_lock); - list_del_init(&msta->wcid.poll_list); + list_del_init(&mlink->wcid.poll_list); spin_unlock_bh(&dev->mt76.sta_poll_lock); - idx = msta->wcid.idx; + idx = mlink->wcid.idx; addr = mt7925_mac_wtbl_lmac_addr(dev, idx, MT_WTBL_AC0_CTT_OFFSET); for (i = 0; i < IEEE80211_NUM_ACS; i++) { - u32 tx_last = msta->airtime_ac[i]; - u32 rx_last = msta->airtime_ac[i + 4]; + u32 tx_last = mlink->airtime_ac[i]; + u32 rx_last = mlink->airtime_ac[i + 4]; - msta->airtime_ac[i] = mt76_rr(dev, addr); - msta->airtime_ac[i + 4] = mt76_rr(dev, addr + 4); + mlink->airtime_ac[i] = mt76_rr(dev, addr); + mlink->airtime_ac[i + 4] = mt76_rr(dev, addr + 4); - tx_time[i] = msta->airtime_ac[i] - tx_last; - rx_time[i] = msta->airtime_ac[i + 4] - rx_last; + tx_time[i] = mlink->airtime_ac[i] - tx_last; + rx_time[i] = mlink->airtime_ac[i + 4] - rx_last; if ((tx_last | rx_last) & BIT(30)) clear = true; @@ -74,10 +76,10 @@ static void mt7925_mac_sta_poll(struct mt792x_dev *dev) if (clear) { mt7925_mac_wtbl_update(dev, idx, MT_WTBL_UPDATE_ADM_COUNT_CLEAR); - memset(msta->airtime_ac, 0, sizeof(msta->airtime_ac)); + memset(mlink->airtime_ac, 0, sizeof(mlink->airtime_ac)); } - if (!msta->wcid.sta) + if (!mlink->wcid.sta) continue; sta = container_of((void *)msta, struct ieee80211_sta, @@ -100,7 +102,7 @@ static void mt7925_mac_sta_poll(struct mt792x_dev *dev) * we need to make sure that flags match so polling GI * from per-sta counters directly. */ - rate = &msta->wcid.rate; + rate = &mlink->wcid.rate; switch (rate->bw) { case RATE_INFO_BW_160: @@ -144,10 +146,10 @@ static void mt7925_mac_sta_poll(struct mt792x_dev *dev) rssi[2] = to_rssi(GENMASK(23, 16), val); rssi[3] = to_rssi(GENMASK(31, 14), val); - msta->ack_signal = + mlink->ack_signal = mt76_rx_signal(msta->vif->phy->mt76->antenna_mask, rssi); - ewma_avg_signal_add(&msta->avg_ack_signal, -msta->ack_signal); + ewma_avg_signal_add(&mlink->avg_ack_signal, -mlink->ack_signal); } } @@ -365,7 +367,7 @@ mt7925_mac_fill_rx(struct mt792x_dev *dev, struct sk_buff *skb) u32 rxd2 = le32_to_cpu(rxd[2]); u32 rxd3 = le32_to_cpu(rxd[3]); u32 rxd4 = le32_to_cpu(rxd[4]); - struct mt792x_sta *msta = NULL; + struct mt792x_link_sta *mlink; u8 mode = 0; /* , band_idx; */ u16 seq_ctrl = 0; __le16 fc = 0; @@ -393,10 +395,10 @@ mt7925_mac_fill_rx(struct mt792x_dev *dev, struct sk_buff *skb) status->wcid = mt792x_rx_get_wcid(dev, idx, unicast); if (status->wcid) { - msta = container_of(status->wcid, struct mt792x_sta, wcid); + mlink = container_of(status->wcid, struct mt792x_link_sta, wcid); spin_lock_bh(&dev->mt76.sta_poll_lock); - if (list_empty(&msta->wcid.poll_list)) - list_add_tail(&msta->wcid.poll_list, + if (list_empty(&mlink->wcid.poll_list)) + list_add_tail(&mlink->wcid.poll_list, &dev->mt76.sta_poll_list); spin_unlock_bh(&dev->mt76.sta_poll_lock); } @@ -851,7 +853,7 @@ static void mt7925_tx_check_aggr(struct ieee80211_sta *sta, __le32 *txwi) return; msta = (struct mt792x_sta *)sta->drv_priv; - if (!test_and_set_bit(tid, &msta->wcid.ampdu_state)) + if (!test_and_set_bit(tid, &msta->deflink.wcid.ampdu_state)) ieee80211_start_tx_ba_session(sta, tid, 0); } @@ -991,7 +993,7 @@ mt7925_mac_add_txs_skb(struct mt792x_dev *dev, struct mt76_wcid *wcid, void mt7925_mac_add_txs(struct mt792x_dev *dev, void *data) { - struct mt792x_sta *msta = NULL; + struct mt792x_link_sta *mlink = NULL; struct mt76_wcid *wcid; __le32 *txs_data = data; u16 wcidx; @@ -1015,15 +1017,15 @@ void mt7925_mac_add_txs(struct mt792x_dev *dev, void *data) if (!wcid) goto out; - msta = container_of(wcid, struct mt792x_sta, wcid); + mlink = container_of(wcid, struct mt792x_link_sta, wcid); mt7925_mac_add_txs_skb(dev, wcid, pid, txs_data); if (!wcid->sta) goto out; spin_lock_bh(&dev->mt76.sta_poll_lock); - if (list_empty(&msta->wcid.poll_list)) - list_add_tail(&msta->wcid.poll_list, &dev->mt76.sta_poll_list); + if (list_empty(&mlink->wcid.poll_list)) + list_add_tail(&mlink->wcid.poll_list, &dev->mt76.sta_poll_list); spin_unlock_bh(&dev->mt76.sta_poll_lock); out: @@ -1094,7 +1096,7 @@ mt7925_mac_tx_free(struct mt792x_dev *dev, void *data, int len) */ info = le32_to_cpu(*cur_info); if (info & MT_TXFREE_INFO_PAIR) { - struct mt792x_sta *msta; + struct mt792x_link_sta *mlink; u16 idx; idx = FIELD_GET(MT_TXFREE_INFO_WLAN_ID, info); @@ -1103,10 +1105,10 @@ mt7925_mac_tx_free(struct mt792x_dev *dev, void *data, int len) if (!sta) continue; - msta = container_of(wcid, struct mt792x_sta, wcid); + mlink = container_of(wcid, struct mt792x_link_sta, wcid); spin_lock_bh(&mdev->sta_poll_lock); - if (list_empty(&msta->wcid.poll_list)) - list_add_tail(&msta->wcid.poll_list, + if (list_empty(&mlink->wcid.poll_list)) + list_add_tail(&mlink->wcid.poll_list, &mdev->sta_poll_list); spin_unlock_bh(&mdev->sta_poll_lock); continue; @@ -1241,11 +1243,11 @@ mt7925_vif_connect_iter(void *priv, u8 *mac, if (vif->type == NL80211_IFTYPE_STATION) ieee80211_disconnect(vif, true); - mt76_connac_mcu_uni_add_dev(&dev->mphy, vif, &mvif->sta.wcid, true); + mt76_connac_mcu_uni_add_dev(&dev->mphy, vif, &mvif->sta.deflink.wcid, true); mt7925_mcu_set_tx(dev, vif); if (vif->type == NL80211_IFTYPE_AP) { - mt76_connac_mcu_uni_add_bss(dev->phy.mt76, vif, &mvif->sta.wcid, + mt76_connac_mcu_uni_add_bss(dev->phy.mt76, vif, &mvif->sta.deflink.wcid, true, NULL); mt7925_mcu_sta_update(dev, NULL, vif, true, MT76_STA_INFO_STATE_NONE); @@ -1380,9 +1382,9 @@ int mt7925_usb_sdio_tx_prepare_skb(struct mt76_dev *mdev, void *txwi_ptr, if (sta) { struct mt792x_sta *msta = (struct mt792x_sta *)sta->drv_priv; - if (time_after(jiffies, msta->last_txs + HZ / 4)) { + if (time_after(jiffies, msta->deflink.last_txs + HZ / 4)) { info->flags |= IEEE80211_TX_CTL_REQ_TX_STATUS; - msta->last_txs = jiffies; + msta->deflink.last_txs = jiffies; } } diff --git a/drivers/net/wireless/mediatek/mt76/mt7925/main.c b/drivers/net/wireless/mediatek/mt76/mt7925/main.c index dfc606cc9bdd..504c2ecc3845 100644 --- a/drivers/net/wireless/mediatek/mt76/mt7925/main.c +++ b/drivers/net/wireless/mediatek/mt76/mt7925/main.c @@ -344,7 +344,7 @@ mt7925_add_interface(struct ieee80211_hw *hw, struct ieee80211_vif *vif) else mvif->bss_conf.mt76.basic_rates_idx = MT792x_BASIC_RATES_TBL; - ret = mt76_connac_mcu_uni_add_dev(&dev->mphy, vif, &mvif->sta.wcid, + ret = mt76_connac_mcu_uni_add_dev(&dev->mphy, vif, &mvif->sta.deflink.wcid, true); if (ret) goto out; @@ -354,20 +354,20 @@ mt7925_add_interface(struct ieee80211_hw *hw, struct ieee80211_vif *vif) idx = MT792x_WTBL_RESERVED - mvif->bss_conf.mt76.idx; - INIT_LIST_HEAD(&mvif->sta.wcid.poll_list); - mvif->sta.wcid.idx = idx; - mvif->sta.wcid.phy_idx = mvif->bss_conf.mt76.band_idx; - mvif->sta.wcid.hw_key_idx = -1; - mvif->sta.wcid.tx_info |= MT_WCID_TX_INFO_SET; + INIT_LIST_HEAD(&mvif->sta.deflink.wcid.poll_list); + mvif->sta.deflink.wcid.idx = idx; + mvif->sta.deflink.wcid.phy_idx = mvif->bss_conf.mt76.band_idx; + mvif->sta.deflink.wcid.hw_key_idx = -1; + mvif->sta.deflink.wcid.tx_info |= MT_WCID_TX_INFO_SET; mvif->sta.vif = mvif; - mt76_wcid_init(&mvif->sta.wcid); + mt76_wcid_init(&mvif->sta.deflink.wcid); mt7925_mac_wtbl_update(dev, idx, MT_WTBL_UPDATE_ADM_COUNT_CLEAR); ewma_rssi_init(&mvif->bss_conf.rssi); - rcu_assign_pointer(dev->mt76.wcid[idx], &mvif->sta.wcid); + rcu_assign_pointer(dev->mt76.wcid[idx], &mvif->sta.deflink.wcid); if (vif->txq) { mtxq = (struct mt76_txq *)vif->txq->drv_priv; mtxq->wcid = idx; @@ -486,7 +486,7 @@ static int mt7925_set_key(struct ieee80211_hw *hw, enum set_key_cmd cmd, struct mt792x_vif *mvif = (struct mt792x_vif *)vif->drv_priv; struct mt792x_sta *msta = sta ? (struct mt792x_sta *)sta->drv_priv : &mvif->sta; - struct mt76_wcid *wcid = &msta->wcid; + struct mt76_wcid *wcid = &msta->deflink.wcid; u8 *wcid_keyidx = &wcid->hw_key_idx; int idx = key->keyidx, err = 0; @@ -541,18 +541,18 @@ static int mt7925_set_key(struct ieee80211_hw *hw, enum set_key_cmd cmd, mt76_wcid_key_setup(&dev->mt76, wcid, cmd == SET_KEY ? key : NULL); - err = mt7925_mcu_add_key(&dev->mt76, vif, &msta->bip, + err = mt7925_mcu_add_key(&dev->mt76, vif, &msta->deflink.bip, key, MCU_UNI_CMD(STA_REC_UPDATE), - &msta->wcid, cmd); + &msta->deflink.wcid, cmd); if (err) goto out; if (key->cipher == WLAN_CIPHER_SUITE_WEP104 || key->cipher == WLAN_CIPHER_SUITE_WEP40) - err = mt7925_mcu_add_key(&dev->mt76, vif, &mvif->wep_sta->bip, + err = mt7925_mcu_add_key(&dev->mt76, vif, &mvif->wep_sta->deflink.bip, key, MCU_WMWA_UNI_CMD(STA_REC_UPDATE), - &mvif->wep_sta->wcid, cmd); + &mvif->wep_sta->deflink.wcid, cmd); out: mt792x_mutex_release(dev); @@ -766,13 +766,13 @@ int mt7925_mac_sta_add(struct mt76_dev *mdev, struct ieee80211_vif *vif, if (idx < 0) return -ENOSPC; - INIT_LIST_HEAD(&msta->wcid.poll_list); + INIT_LIST_HEAD(&msta->deflink.wcid.poll_list); msta->vif = mvif; - msta->wcid.sta = 1; - msta->wcid.idx = idx; - msta->wcid.phy_idx = mvif->bss_conf.mt76.band_idx; - msta->wcid.tx_info |= MT_WCID_TX_INFO_SET; - msta->last_txs = jiffies; + msta->deflink.wcid.sta = 1; + msta->deflink.wcid.idx = idx; + msta->deflink.wcid.phy_idx = mvif->bss_conf.mt76.band_idx; + msta->deflink.wcid.tx_info |= MT_WCID_TX_INFO_SET; + msta->deflink.last_txs = jiffies; ret = mt76_connac_pm_wake(&dev->mphy, &dev->pm); if (ret) @@ -813,11 +813,11 @@ void mt7925_mac_sta_assoc(struct mt76_dev *mdev, struct ieee80211_vif *vif, mt7925_mcu_add_bss_info(&dev->phy, mvif->bss_conf.mt76.ctx, vif, sta, true); - ewma_avg_signal_init(&msta->avg_ack_signal); + ewma_avg_signal_init(&msta->deflink.avg_ack_signal); - mt7925_mac_wtbl_update(dev, msta->wcid.idx, + mt7925_mac_wtbl_update(dev, msta->deflink.wcid.idx, MT_WTBL_UPDATE_ADM_COUNT_CLEAR); - memset(msta->airtime_ac, 0, sizeof(msta->airtime_ac)); + memset(msta->deflink.airtime_ac, 0, sizeof(msta->deflink.airtime_ac)); mt7925_mcu_sta_update(dev, sta, vif, true, MT76_STA_INFO_STATE_ASSOC); @@ -831,11 +831,11 @@ void mt7925_mac_sta_remove(struct mt76_dev *mdev, struct ieee80211_vif *vif, struct mt792x_dev *dev = container_of(mdev, struct mt792x_dev, mt76); struct mt792x_sta *msta = (struct mt792x_sta *)sta->drv_priv; - mt76_connac_free_pending_tx_skbs(&dev->pm, &msta->wcid); + mt76_connac_free_pending_tx_skbs(&dev->pm, &msta->deflink.wcid); mt76_connac_pm_wake(&dev->mphy, &dev->pm); mt7925_mcu_sta_update(dev, sta, vif, false, MT76_STA_INFO_STATE_NONE); - mt7925_mac_wtbl_update(dev, msta->wcid.idx, + mt7925_mac_wtbl_update(dev, msta->deflink.wcid.idx, MT_WTBL_UPDATE_ADM_COUNT_CLEAR); if (vif->type == NL80211_IFTYPE_STATION) { @@ -849,8 +849,8 @@ void mt7925_mac_sta_remove(struct mt76_dev *mdev, struct ieee80211_vif *vif, } spin_lock_bh(&mdev->sta_poll_lock); - if (!list_empty(&msta->wcid.poll_list)) - list_del_init(&msta->wcid.poll_list); + if (!list_empty(&msta->deflink.wcid.poll_list)) + list_del_init(&msta->deflink.wcid.poll_list); spin_unlock_bh(&mdev->sta_poll_lock); mt76_connac_power_save_sched(&dev->mphy, &dev->pm); @@ -890,12 +890,12 @@ mt7925_ampdu_action(struct ieee80211_hw *hw, struct ieee80211_vif *vif, mt792x_mutex_acquire(dev); switch (action) { case IEEE80211_AMPDU_RX_START: - mt76_rx_aggr_start(&dev->mt76, &msta->wcid, tid, ssn, + mt76_rx_aggr_start(&dev->mt76, &msta->deflink.wcid, tid, ssn, params->buf_size); mt7925_mcu_uni_rx_ba(dev, params, true); break; case IEEE80211_AMPDU_RX_STOP: - mt76_rx_aggr_stop(&dev->mt76, &msta->wcid, tid); + mt76_rx_aggr_stop(&dev->mt76, &msta->deflink.wcid, tid); mt7925_mcu_uni_rx_ba(dev, params, false); break; case IEEE80211_AMPDU_TX_OPERATIONAL: @@ -906,16 +906,16 @@ mt7925_ampdu_action(struct ieee80211_hw *hw, struct ieee80211_vif *vif, case IEEE80211_AMPDU_TX_STOP_FLUSH: case IEEE80211_AMPDU_TX_STOP_FLUSH_CONT: mtxq->aggr = false; - clear_bit(tid, &msta->wcid.ampdu_state); + clear_bit(tid, &msta->deflink.wcid.ampdu_state); mt7925_mcu_uni_tx_ba(dev, params, false); break; case IEEE80211_AMPDU_TX_START: - set_bit(tid, &msta->wcid.ampdu_state); + set_bit(tid, &msta->deflink.wcid.ampdu_state); ret = IEEE80211_AMPDU_TX_START_IMMEDIATE; break; case IEEE80211_AMPDU_TX_STOP_CONT: mtxq->aggr = false; - clear_bit(tid, &msta->wcid.ampdu_state); + clear_bit(tid, &msta->deflink.wcid.ampdu_state); mt7925_mcu_uni_tx_ba(dev, params, false); ieee80211_stop_tx_ba_cb_irqsafe(vif, sta->addr, tid); break; @@ -1161,9 +1161,9 @@ static void mt7925_sta_set_decap_offload(struct ieee80211_hw *hw, mt792x_mutex_acquire(dev); if (enabled) - set_bit(MT_WCID_FLAG_HDR_TRANS, &msta->wcid.flags); + set_bit(MT_WCID_FLAG_HDR_TRANS, &msta->deflink.wcid.flags); else - clear_bit(MT_WCID_FLAG_HDR_TRANS, &msta->wcid.flags); + clear_bit(MT_WCID_FLAG_HDR_TRANS, &msta->deflink.wcid.flags); mt7925_mcu_wtbl_update_hdr_trans(dev, vif, sta); diff --git a/drivers/net/wireless/mediatek/mt76/mt7925/mcu.c b/drivers/net/wireless/mediatek/mt76/mt7925/mcu.c index c259aedb96e0..67c05f785190 100644 --- a/drivers/net/wireless/mediatek/mt76/mt7925/mcu.c +++ b/drivers/net/wireless/mediatek/mt76/mt7925/mcu.c @@ -544,7 +544,7 @@ int mt7925_mcu_uni_tx_ba(struct mt792x_dev *dev, struct mt792x_vif *mvif = msta->vif; if (enable && !params->amsdu) - msta->wcid.amsdu = false; + msta->deflink.wcid.amsdu = false; return mt7925_mcu_sta_ba(&dev->mt76, &mvif->bss_conf.mt76, params, enable, true); @@ -867,7 +867,7 @@ mt7925_mcu_sta_hdr_trans_tlv(struct sk_buff *skb, if (sta) wcid = (struct mt76_wcid *)sta->drv_priv; else - wcid = &mvif->sta.wcid; + wcid = &mvif->sta.deflink.wcid; if (!wcid) return; @@ -890,7 +890,7 @@ int mt7925_mcu_wtbl_update_hdr_trans(struct mt792x_dev *dev, msta = sta ? (struct mt792x_sta *)sta->drv_priv : &mvif->sta; skb = __mt76_connac_mcu_alloc_sta_req(&dev->mt76, &mvif->bss_conf.mt76, - &msta->wcid, + &msta->deflink.wcid, MT7925_STA_UPDATE_MAX_SIZE); if (IS_ERR(skb)) return PTR_ERR(skb); @@ -962,7 +962,8 @@ mt7925_mcu_sta_key_tlv(struct mt76_wcid *wcid, struct ieee80211_key_conf *key, enum set_key_cmd cmd) { - struct mt792x_sta *msta = container_of(wcid, struct mt792x_sta, wcid); + struct mt792x_link_sta *mlink = container_of(wcid, struct mt792x_link_sta, wcid); + struct mt792x_sta *msta = container_of(mlink, struct mt792x_sta, deflink); struct sta_rec_sec_uni *sec; struct mt792x_vif *mvif = msta->vif; struct ieee80211_sta *sta; @@ -1480,7 +1481,7 @@ mt7925_mcu_sta_amsdu_tlv(struct sk_buff *skb, amsdu = (struct sta_rec_amsdu *)tlv; amsdu->max_amsdu_num = 8; amsdu->amsdu_en = true; - msta->wcid.amsdu = true; + msta->deflink.wcid.amsdu = true; switch (sta->deflink.agg.max_amsdu_len) { case IEEE80211_MAX_MPDU_LEN_VHT_11454: @@ -1668,7 +1669,7 @@ int mt7925_mcu_sta_update(struct mt792x_dev *dev, struct ieee80211_sta *sta, struct mt792x_sta *msta; msta = sta ? (struct mt792x_sta *)sta->drv_priv : NULL; - info.wcid = msta ? &msta->wcid : &mvif->sta.wcid; + info.wcid = msta ? &msta->deflink.wcid : &mvif->sta.deflink.wcid; info.newly = msta ? state != MT76_STA_INFO_STATE_ASSOC : true; return mt7925_mcu_sta_cmd(&dev->mphy, &info); @@ -2096,7 +2097,7 @@ mt7925_mcu_bss_basic_tlv(struct sk_buff *skb, basic_req->bcn_interval = cpu_to_le16(vif->bss_conf.beacon_int); basic_req->dtim_period = vif->bss_conf.dtim_period; basic_req->bmc_tx_wlan_idx = cpu_to_le16(wlan_idx); - basic_req->sta_idx = cpu_to_le16(msta->wcid.idx); + basic_req->sta_idx = cpu_to_le16(msta->deflink.wcid.idx); basic_req->omac_idx = mvif->bss_conf.mt76.omac_idx; basic_req->band_idx = mvif->bss_conf.mt76.band_idx; basic_req->wmm_idx = mvif->bss_conf.mt76.wmm_idx; @@ -2330,7 +2331,7 @@ int mt7925_mcu_add_bss_info(struct mt792x_phy *phy, /* bss_basic must be first */ mt7925_mcu_bss_basic_tlv(skb, vif, sta, ctx, phy->mt76, - mvif->sta.wcid.idx, enable); + mvif->sta.deflink.wcid.idx, enable); mt7925_mcu_bss_sec_tlv(skb, vif); mt7925_mcu_bss_bmc_tlv(skb, phy, ctx, vif, sta); diff --git a/drivers/net/wireless/mediatek/mt76/mt7925/pci_mac.c b/drivers/net/wireless/mediatek/mt76/mt7925/pci_mac.c index 9fca887977d2..ef631a68005d 100644 --- a/drivers/net/wireless/mediatek/mt76/mt7925/pci_mac.c +++ b/drivers/net/wireless/mediatek/mt76/mt7925/pci_mac.c @@ -34,9 +34,9 @@ int mt7925e_tx_prepare_skb(struct mt76_dev *mdev, void *txwi_ptr, if (sta) { struct mt792x_sta *msta = (struct mt792x_sta *)sta->drv_priv; - if (time_after(jiffies, msta->last_txs + HZ / 4)) { + if (time_after(jiffies, msta->deflink.last_txs + HZ / 4)) { info->flags |= IEEE80211_TX_CTL_REQ_TX_STATUS; - msta->last_txs = jiffies; + msta->deflink.last_txs = jiffies; } } diff --git a/drivers/net/wireless/mediatek/mt76/mt792x.h b/drivers/net/wireless/mediatek/mt76/mt792x.h index e377f8ea9782..cb0bb06bef80 100644 --- a/drivers/net/wireless/mediatek/mt76/mt792x.h +++ b/drivers/net/wireless/mediatek/mt76/mt792x.h @@ -79,11 +79,9 @@ enum mt792x_reg_power_type { DECLARE_EWMA(avg_signal, 10, 8) -struct mt792x_sta { +struct mt792x_link_sta { struct mt76_wcid wcid; /* must be first */ - struct mt792x_vif *vif; - u32 airtime_ac[8]; int ack_signal; @@ -94,6 +92,12 @@ struct mt792x_sta { struct mt76_connac_sta_key_conf bip; }; +struct mt792x_sta { + struct mt792x_link_sta deflink; /* must be first */ + + struct mt792x_vif *vif; +}; + DECLARE_EWMA(rssi, 10, 8); struct mt792x_bss_conf { diff --git a/drivers/net/wireless/mediatek/mt76/mt792x_core.c b/drivers/net/wireless/mediatek/mt76/mt792x_core.c index 4b4afc1add6e..ae21a2829c9c 100644 --- a/drivers/net/wireless/mediatek/mt76/mt792x_core.c +++ b/drivers/net/wireless/mediatek/mt76/mt792x_core.c @@ -65,14 +65,14 @@ void mt792x_tx(struct ieee80211_hw *hw, struct ieee80211_tx_control *control, struct mt792x_sta *sta; sta = (struct mt792x_sta *)control->sta->drv_priv; - wcid = &sta->wcid; + wcid = &sta->deflink.wcid; } if (vif && !control->sta) { struct mt792x_vif *mvif; mvif = (struct mt792x_vif *)vif->drv_priv; - wcid = &mvif->sta.wcid; + wcid = &mvif->sta.deflink.wcid; } if (mt76_connac_pm_ref(mphy, &dev->pm)) { @@ -120,11 +120,11 @@ void mt792x_remove_interface(struct ieee80211_hw *hw, struct mt792x_sta *msta = &mvif->sta; struct mt792x_dev *dev = mt792x_hw_dev(hw); struct mt792x_phy *phy = mt792x_hw_phy(hw); - int idx = msta->wcid.idx; + int idx = msta->deflink.wcid.idx; mt792x_mutex_acquire(dev); - mt76_connac_free_pending_tx_skbs(&dev->pm, &msta->wcid); - mt76_connac_mcu_uni_add_dev(&dev->mphy, vif, &mvif->sta.wcid, false); + mt76_connac_free_pending_tx_skbs(&dev->pm, &msta->deflink.wcid); + mt76_connac_mcu_uni_add_dev(&dev->mphy, vif, &mvif->sta.deflink.wcid, false); rcu_assign_pointer(dev->mt76.wcid[idx], NULL); @@ -133,11 +133,11 @@ void mt792x_remove_interface(struct ieee80211_hw *hw, mt792x_mutex_release(dev); spin_lock_bh(&dev->mt76.sta_poll_lock); - if (!list_empty(&msta->wcid.poll_list)) - list_del_init(&msta->wcid.poll_list); + if (!list_empty(&msta->deflink.wcid.poll_list)) + list_del_init(&msta->deflink.wcid.poll_list); spin_unlock_bh(&dev->mt76.sta_poll_lock); - mt76_wcid_cleanup(&dev->mt76, &msta->wcid); + mt76_wcid_cleanup(&dev->mt76, &msta->deflink.wcid); } EXPORT_SYMBOL_GPL(mt792x_remove_interface); @@ -408,7 +408,7 @@ mt792x_ethtool_worker(void *wi_data, struct ieee80211_sta *sta) if (msta->vif->bss_conf.mt76.idx != wi->idx) return; - mt76_ethtool_worker(wi, &msta->wcid.stats, true); + mt76_ethtool_worker(wi, &msta->deflink.wcid.stats, true); } void mt792x_get_et_stats(struct ieee80211_hw *hw, struct ieee80211_vif *vif, @@ -487,7 +487,7 @@ void mt792x_sta_statistics(struct ieee80211_hw *hw, struct station_info *sinfo) { struct mt792x_sta *msta = (struct mt792x_sta *)sta->drv_priv; - struct rate_info *txrate = &msta->wcid.rate; + struct rate_info *txrate = &msta->deflink.wcid.rate; if (!txrate->legacy && !txrate->flags) return; @@ -502,19 +502,19 @@ void mt792x_sta_statistics(struct ieee80211_hw *hw, sinfo->txrate.he_dcm = txrate->he_dcm; sinfo->txrate.he_ru_alloc = txrate->he_ru_alloc; } - sinfo->tx_failed = msta->wcid.stats.tx_failed; + sinfo->tx_failed = msta->deflink.wcid.stats.tx_failed; sinfo->filled |= BIT_ULL(NL80211_STA_INFO_TX_FAILED); - sinfo->tx_retries = msta->wcid.stats.tx_retries; + sinfo->tx_retries = msta->deflink.wcid.stats.tx_retries; sinfo->filled |= BIT_ULL(NL80211_STA_INFO_TX_RETRIES); sinfo->txrate.flags = txrate->flags; sinfo->filled |= BIT_ULL(NL80211_STA_INFO_TX_BITRATE); - sinfo->ack_signal = (s8)msta->ack_signal; + sinfo->ack_signal = (s8)msta->deflink.ack_signal; sinfo->filled |= BIT_ULL(NL80211_STA_INFO_ACK_SIGNAL); - sinfo->avg_ack_signal = -(s8)ewma_avg_signal_read(&msta->avg_ack_signal); + sinfo->avg_ack_signal = -(s8)ewma_avg_signal_read(&msta->deflink.avg_ack_signal); sinfo->filled |= BIT_ULL(NL80211_STA_INFO_ACK_SIGNAL_AVG); } EXPORT_SYMBOL_GPL(mt792x_sta_statistics); diff --git a/drivers/net/wireless/mediatek/mt76/mt792x_mac.c b/drivers/net/wireless/mediatek/mt76/mt792x_mac.c index 45dd94ff386d..106273935b26 100644 --- a/drivers/net/wireless/mediatek/mt76/mt792x_mac.c +++ b/drivers/net/wireless/mediatek/mt76/mt792x_mac.c @@ -138,6 +138,7 @@ EXPORT_SYMBOL_GPL(mt792x_mac_update_mib_stats); struct mt76_wcid *mt792x_rx_get_wcid(struct mt792x_dev *dev, u16 idx, bool unicast) { + struct mt792x_link_sta *link; struct mt792x_sta *sta; struct mt76_wcid *wcid; @@ -151,11 +152,12 @@ struct mt76_wcid *mt792x_rx_get_wcid(struct mt792x_dev *dev, u16 idx, if (!wcid->sta) return NULL; - sta = container_of(wcid, struct mt792x_sta, wcid); + link = container_of(wcid, struct mt792x_link_sta, wcid); + sta = container_of(link, struct mt792x_sta, deflink); if (!sta->vif) return NULL; - return &sta->vif->sta.wcid; + return &sta->vif->sta.deflink.wcid; } EXPORT_SYMBOL_GPL(mt792x_rx_get_wcid); From patchwork Thu Jun 13 03:01:57 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Sean Wang X-Patchwork-Id: 13696035 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from bombadil.infradead.org (bombadil.infradead.org [198.137.202.133]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.lore.kernel.org (Postfix) with ESMTPS id 9BF36C27C53 for ; Thu, 13 Jun 2024 03:02:59 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=lists.infradead.org; s=bombadil.20210309; h=Sender:List-Subscribe:List-Help :List-Post:List-Archive:List-Unsubscribe:List-Id:Content-Transfer-Encoding: MIME-Version:References:In-Reply-To:Message-Id:Date:Subject:Cc:To:From: Reply-To:Content-Type:Content-ID:Content-Description:Resent-Date:Resent-From: Resent-Sender:Resent-To:Resent-Cc:Resent-Message-ID:List-Owner; bh=Nvb5AJFmYUTVY3+9AzIQTo1J8qEy+Vm/mbwCjCAQx2E=; b=UH24iYoI6ESWe8jQwgfWrRTOTY 0Lg0zEE8qHG5FS64kmkNOUmJBURzkYG9S0OCMCbETjbLrXNoP+O+7HeQjFXhl8jLWfroC58VCF/Xh MnIilqJ0SfgOdWNCsOy+nc4rkU2pca1Ve5y1wNr5kSSQEZgk11uVHbXwwFpm2QJ5fWDq2Iad4p4hf hjfIAAqRbnWK7aeUFlPdU+lNISzlR9mfW4uoHu+KjpcBznDWDOYcM9V8K+w7VL9B9MF7RYI8UOV4P xt9zLB6HfqXQgMpL8JAfXnMaA0Lb344+/tZv5HO6VtO8G9JtNUK9xcyu1UsWFJ+Te9bylSHZwSVh/ /GNZ5HgA==; Received: from localhost ([::1] helo=bombadil.infradead.org) by bombadil.infradead.org with esmtp (Exim 4.97.1 #2 (Red Hat Linux)) id 1sHajr-0000000EvWZ-1IIg; Thu, 13 Jun 2024 03:02:59 +0000 Received: from mail-oo1-f43.google.com ([209.85.161.43]) by bombadil.infradead.org with esmtps (Exim 4.97.1 #2 (Red Hat Linux)) id 1sHajn-0000000EvUG-0Juw for linux-mediatek@lists.infradead.org; Thu, 13 Jun 2024 03:02:57 +0000 Received: by mail-oo1-f43.google.com with SMTP id 006d021491bc7-5bad4e45863so24355eaf.3 for ; Wed, 12 Jun 2024 20:02:54 -0700 (PDT) X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1718247774; x=1718852574; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:x-gm-message-state:from:to:cc :subject:date:message-id:reply-to; bh=Nvb5AJFmYUTVY3+9AzIQTo1J8qEy+Vm/mbwCjCAQx2E=; b=iu2n8FFevimvkelTUyBIV2k8NxXTNZEp4FUvIvuKZICLAPZgD43ATMY84V11nuU+a/ 5qe6Iz1j1JVPpSgtR3xlNFDjqU5X7VjPESAZexwSAHa5hLXArzzqGzu92ADVcYZvC9ID dQ2rbGdzwjhfp5JfqOu/viz3XjaZFOz9NJ9tnxBhCwwIvQrOn8cNQxrgsWg1lN1/p3ey sNL8pmZjE26ZGV7xwjjv4Y6BdDJn8cTdNMtRILTO8ykSuzHdWZaSTcFX82h5QFMucYau EdfT2feaqKwDJUQhRZEwX8y24gxasDouvKrXpK3ZUDwJpZXViwVhvLSLWWR+LYGqMfcu vsBw== X-Forwarded-Encrypted: i=1; AJvYcCUeR3o6ndN1ESGOhKuTa863+6Hxq8CEuXuo3bKr5osqGMcrFi7ivQXhBjZJqxTERc4XPx0ItECrETEAEkanWw==@lists.infradead.org X-Gm-Message-State: AOJu0YwV0IX7ONSDnY25mOounlUQTYohkXaLjy4Y5YJ3iEkttFfbn8Da uJ8sUGJ/bHO7qPg0SLt/3YzqV/rOI6BPQRZpXaxnYlKHG18/WLxsfB2yV/QhzP4= X-Google-Smtp-Source: AGHT+IHzWVQJdCK0UMaB6vy18L88HksO71wTbhM59p53AnVFBNdYc8aDnqYc1k+Ee4AqA8mHWuc+ng== X-Received: by 2002:a05:6820:2c86:b0:5aa:3e4f:f01e with SMTP id 006d021491bc7-5bb3b9c614cmr3867544eaf.1.1718247773727; Wed, 12 Jun 2024 20:02:53 -0700 (PDT) Received: from sean-ThinkPad-T450s.lan ([207.191.35.252]) by smtp.gmail.com with ESMTPSA id 006d021491bc7-5bd629263c5sm67685eaf.46.2024.06.12.20.02.50 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Wed, 12 Jun 2024 20:02:51 -0700 (PDT) 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 03/47] wifi: mt76: mt792x: add struct mt792x_chanctx Date: Wed, 12 Jun 2024 20:01:57 -0700 Message-Id: <20240613030241.5771-4-sean.wang@kernel.org> X-Mailer: git-send-email 2.25.1 In-Reply-To: <20240613030241.5771-1-sean.wang@kernel.org> References: <20240613030241.5771-1-sean.wang@kernel.org> MIME-Version: 1.0 X-CRM114-Version: 20100106-BlameMichelson ( TRE 0.8.0 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20240612_200255_196158_83983FB1 X-CRM114-Status: GOOD ( 14.36 ) X-BeenThere: linux-mediatek@lists.infradead.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Sender: "Linux-mediatek" Errors-To: linux-mediatek-bounces+linux-mediatek=archiver.kernel.org@lists.infradead.org From: Deren Wu We are introducing a new structure, mt792x_chanctx, to quickly identify the linked BSS it is working on. This eliminates the need to search in mt7921_ctx_iter() or mt7925_ctx_iter() when the channel context changes. Co-developed-by: Sean Wang Signed-off-by: Sean Wang Signed-off-by: Deren Wu --- .../net/wireless/mediatek/mt76/mt7921/main.c | 31 ++++++++----------- .../net/wireless/mediatek/mt76/mt7925/main.c | 31 ++++++++----------- drivers/net/wireless/mediatek/mt76/mt792x.h | 4 +++ .../net/wireless/mediatek/mt76/mt792x_core.c | 5 +++ 4 files changed, 35 insertions(+), 36 deletions(-) diff --git a/drivers/net/wireless/mediatek/mt76/mt7921/main.c b/drivers/net/wireless/mediatek/mt76/mt7921/main.c index 3141807ec54b..89d47cce9e8b 100644 --- a/drivers/net/wireless/mediatek/mt76/mt7921/main.c +++ b/drivers/net/wireless/mediatek/mt76/mt7921/main.c @@ -1346,32 +1346,27 @@ mt7921_remove_chanctx(struct ieee80211_hw *hw, { } -static void mt7921_ctx_iter(void *priv, u8 *mac, - struct ieee80211_vif *vif) -{ - struct mt792x_vif *mvif = (struct mt792x_vif *)vif->drv_priv; - struct ieee80211_chanctx_conf *ctx = priv; - - if (ctx != mvif->bss_conf.mt76.ctx) - return; - - if (vif->type == NL80211_IFTYPE_MONITOR) - mt7921_mcu_config_sniffer(mvif, ctx); - else - mt76_connac_mcu_uni_set_chctx(mvif->phy->mt76, &mvif->bss_conf.mt76, ctx); -} - static void mt7921_change_chanctx(struct ieee80211_hw *hw, struct ieee80211_chanctx_conf *ctx, u32 changed) { + struct mt792x_chanctx *mctx = (struct mt792x_chanctx *)ctx->drv_priv; struct mt792x_phy *phy = mt792x_hw_phy(hw); + struct ieee80211_vif *vif; + struct mt792x_vif *mvif; + + if (!mctx->bss_conf) + return; + + mvif = container_of(mctx->bss_conf, struct mt792x_vif, bss_conf); + vif = container_of((void *)mvif, struct ieee80211_vif, drv_priv); mt792x_mutex_acquire(phy->dev); - ieee80211_iterate_active_interfaces(phy->mt76->hw, - IEEE80211_IFACE_ITER_ACTIVE, - mt7921_ctx_iter, ctx); + if (vif->type == NL80211_IFTYPE_MONITOR) + mt7921_mcu_config_sniffer(mvif, ctx); + else + mt76_connac_mcu_uni_set_chctx(mvif->phy->mt76, &mvif->bss_conf.mt76, ctx); mt792x_mutex_release(phy->dev); } diff --git a/drivers/net/wireless/mediatek/mt76/mt7925/main.c b/drivers/net/wireless/mediatek/mt76/mt7925/main.c index 504c2ecc3845..91edbe076c22 100644 --- a/drivers/net/wireless/mediatek/mt76/mt7925/main.c +++ b/drivers/net/wireless/mediatek/mt76/mt7925/main.c @@ -1354,34 +1354,29 @@ mt7925_remove_chanctx(struct ieee80211_hw *hw, { } -static void mt7925_ctx_iter(void *priv, u8 *mac, - struct ieee80211_vif *vif) +static void +mt7925_change_chanctx(struct ieee80211_hw *hw, + struct ieee80211_chanctx_conf *ctx, + u32 changed) { - struct mt792x_vif *mvif = (struct mt792x_vif *)vif->drv_priv; - struct ieee80211_chanctx_conf *ctx = priv; + struct mt792x_chanctx *mctx = (struct mt792x_chanctx *)ctx->drv_priv; + struct mt792x_phy *phy = mt792x_hw_phy(hw); + struct ieee80211_vif *vif; + struct mt792x_vif *mvif; - if (ctx != mvif->bss_conf.mt76.ctx) + if (!mctx->bss_conf) return; + mvif = container_of(mctx->bss_conf, struct mt792x_vif, bss_conf); + vif = container_of((void *)mvif, struct ieee80211_vif, drv_priv); + + mt792x_mutex_acquire(phy->dev); if (vif->type == NL80211_IFTYPE_MONITOR) { mt7925_mcu_set_sniffer(mvif->phy->dev, vif, true); mt7925_mcu_config_sniffer(mvif, ctx); } else { mt7925_mcu_set_chctx(mvif->phy->mt76, &mvif->bss_conf.mt76, ctx); } -} - -static void -mt7925_change_chanctx(struct ieee80211_hw *hw, - struct ieee80211_chanctx_conf *ctx, - u32 changed) -{ - struct mt792x_phy *phy = mt792x_hw_phy(hw); - - mt792x_mutex_acquire(phy->dev); - ieee80211_iterate_active_interfaces(phy->mt76->hw, - IEEE80211_IFACE_ITER_ACTIVE, - mt7925_ctx_iter, ctx); mt792x_mutex_release(phy->dev); } diff --git a/drivers/net/wireless/mediatek/mt76/mt792x.h b/drivers/net/wireless/mediatek/mt76/mt792x.h index cb0bb06bef80..b5eb574e8548 100644 --- a/drivers/net/wireless/mediatek/mt76/mt792x.h +++ b/drivers/net/wireless/mediatek/mt76/mt792x.h @@ -100,6 +100,10 @@ struct mt792x_sta { DECLARE_EWMA(rssi, 10, 8); +struct mt792x_chanctx { + struct mt792x_bss_conf *bss_conf; +}; + struct mt792x_bss_conf { struct mt76_vif mt76; /* must be first */ struct ewma_rssi rssi; diff --git a/drivers/net/wireless/mediatek/mt76/mt792x_core.c b/drivers/net/wireless/mediatek/mt76/mt792x_core.c index ae21a2829c9c..a189ae38f2d0 100644 --- a/drivers/net/wireless/mediatek/mt76/mt792x_core.c +++ b/drivers/net/wireless/mediatek/mt76/mt792x_core.c @@ -261,11 +261,13 @@ int mt792x_assign_vif_chanctx(struct ieee80211_hw *hw, struct ieee80211_bss_conf *link_conf, struct ieee80211_chanctx_conf *ctx) { + struct mt792x_chanctx *mctx = (struct mt792x_chanctx *)ctx->drv_priv; struct mt792x_vif *mvif = (struct mt792x_vif *)vif->drv_priv; struct mt792x_dev *dev = mt792x_hw_dev(hw); mutex_lock(&dev->mt76.mutex); mvif->bss_conf.mt76.ctx = ctx; + mctx->bss_conf = &mvif->bss_conf; mutex_unlock(&dev->mt76.mutex); return 0; @@ -277,10 +279,12 @@ void mt792x_unassign_vif_chanctx(struct ieee80211_hw *hw, struct ieee80211_bss_conf *link_conf, struct ieee80211_chanctx_conf *ctx) { + struct mt792x_chanctx *mctx = (struct mt792x_chanctx *)ctx->drv_priv; struct mt792x_vif *mvif = (struct mt792x_vif *)vif->drv_priv; struct mt792x_dev *dev = mt792x_hw_dev(hw); mutex_lock(&dev->mt76.mutex); + mctx->bss_conf = NULL; mvif->bss_conf.mt76.ctx = NULL; mutex_unlock(&dev->mt76.mutex); } @@ -556,6 +560,7 @@ int mt792x_init_wiphy(struct ieee80211_hw *hw) hw->sta_data_size = sizeof(struct mt792x_sta); hw->vif_data_size = sizeof(struct mt792x_vif); + hw->chanctx_data_size = sizeof(struct mt792x_chanctx); if (dev->fw_features & MT792x_FW_CAP_CNM) { wiphy->flags |= WIPHY_FLAG_HAS_REMAIN_ON_CHANNEL; From patchwork Thu Jun 13 03:01:58 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Sean Wang X-Patchwork-Id: 13696037 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from bombadil.infradead.org (bombadil.infradead.org [198.137.202.133]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.lore.kernel.org (Postfix) with ESMTPS id 82B9AC27C77 for ; Thu, 13 Jun 2024 03:03:06 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=lists.infradead.org; s=bombadil.20210309; h=Sender:List-Subscribe:List-Help :List-Post:List-Archive:List-Unsubscribe:List-Id:Content-Transfer-Encoding: MIME-Version:References:In-Reply-To:Message-Id:Date:Subject:Cc:To:From: Reply-To:Content-Type:Content-ID:Content-Description:Resent-Date:Resent-From: Resent-Sender:Resent-To:Resent-Cc:Resent-Message-ID:List-Owner; bh=rTbknuCcxBFM/pXAboNibD22DPmvjD+qglC+dC8qFos=; b=CkMHXAX8+/BClakFCEhxBGfWe1 EbIVjojr0ZZjRnWAOdl71wDdWmj+Fma0p5hWm50u5f78sk/C8Fy7zTBCiFwxT77nGuqTAChkUMHPr ctG/CyaviHzGy54/A6OgbeO1vHzGogr9+3nuAw2WuqlMhmdbL2qyisjBm1oT2UxpPXV6X0LXyt5PQ h7PkfTJxW0+GWAzDMPK5FyHdeQRlwGDyiiV/W58s0Fi/YNA090oCTmDJgNw0sw8twUQGzDLyGV8Ta cwfwedgyA2ucdVPZL/kbAZ6+jvaYcEA8E7C8v59HKBIqun1cUf20QOoEmUA4Y4F/sNtATbCo1VjWZ t7bBwh0A==; Received: from localhost ([::1] helo=bombadil.infradead.org) by bombadil.infradead.org with esmtp (Exim 4.97.1 #2 (Red Hat Linux)) id 1sHajy-0000000Evag-0LKI; Thu, 13 Jun 2024 03:03:06 +0000 Received: from mail-oa1-f52.google.com ([209.85.160.52]) by bombadil.infradead.org with esmtps (Exim 4.97.1 #2 (Red Hat Linux)) id 1sHajs-0000000EvVI-2j5V for linux-mediatek@lists.infradead.org; Thu, 13 Jun 2024 03:03:03 +0000 Received: by mail-oa1-f52.google.com with SMTP id 586e51a60fabf-25496e90cf5so70031fac.1 for ; Wed, 12 Jun 2024 20:02:56 -0700 (PDT) X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1718247776; x=1718852576; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:x-gm-message-state:from:to:cc :subject:date:message-id:reply-to; bh=rTbknuCcxBFM/pXAboNibD22DPmvjD+qglC+dC8qFos=; b=poVE8Y7ilBJoxTqoo33A+SNQ1Bk1rrTFZq/Y7D1FPj2L5vtAo6mVF8R9Z9SMA+NDuc LS9Sb7hs9P0EgoVOOdFd2zlb3YuxFuEuk6ZoCKVShoUCP/X+gNgrPyzJuenKn4TH0lU0 VWmA2o2yiIwPFsg5+qpukTHAm/6+AoAh/frhlkc8ltbdh8wTcRLin0x7ywvxQwiVzfjC FCbJGN9hvNunwiyWoawjjgZY98xYcwVuc3rJ1WzMowsrg7SSo0MEBgQZRGczEDKY/n3/ o7YrzDxN20FGL7ZDWY/KgYZwAsATWwrb6rU4m8rv4RKVDL+dat/sUxJUOxA5Z89VDLRu Eg/w== X-Forwarded-Encrypted: i=1; AJvYcCW3CxseDGqIA6pk4tQgQBkjq02xdtLUR0Nvm0Za4LL8ZzT0kR47o/ZE6NmUaRey+2dPObYYT89gGE/0ND4jiQ==@lists.infradead.org X-Gm-Message-State: AOJu0YxYXX3jJbHNig8OIpPcD6QyBDrP/ltlxVsy8BV9p8gCfoKKFeW6 pd81ogfiE/ngqtL9ggL+e1EWzioHmF/z/sS6ojL5G2d/9eFGKL+0T3VupSy19pU= X-Google-Smtp-Source: AGHT+IFXaJzQHaYoUlzxItiYvtpBTUQMFf3XYeOAf7nO9GCdpTZw/Q9Zwh7hHRn5kHY1RrUgGCKcaQ== X-Received: by 2002:a05:6820:2c86:b0:5aa:3e4f:f01e with SMTP id 006d021491bc7-5bb3b9c614cmr3867601eaf.1.1718247775640; Wed, 12 Jun 2024 20:02:55 -0700 (PDT) Received: from sean-ThinkPad-T450s.lan ([207.191.35.252]) by smtp.gmail.com with ESMTPSA id 006d021491bc7-5bd629263c5sm67685eaf.46.2024.06.12.20.02.53 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Wed, 12 Jun 2024 20:02:54 -0700 (PDT) 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 04/47] wifi: mt76: mt7925: support for split bss_info_changed method Date: Wed, 12 Jun 2024 20:01:58 -0700 Message-Id: <20240613030241.5771-5-sean.wang@kernel.org> X-Mailer: git-send-email 2.25.1 In-Reply-To: <20240613030241.5771-1-sean.wang@kernel.org> References: <20240613030241.5771-1-sean.wang@kernel.org> MIME-Version: 1.0 X-CRM114-Version: 20100106-BlameMichelson ( TRE 0.8.0 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20240612_200300_808112_C2C67A86 X-CRM114-Status: GOOD ( 14.16 ) X-BeenThere: linux-mediatek@lists.infradead.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Sender: "Linux-mediatek" Errors-To: linux-mediatek-bounces+linux-mediatek=archiver.kernel.org@lists.infradead.org From: Deren Wu The .bss_info_changed method is being split into .vif_cfg_changed and .link_info_changed to support MLD devices, but it will still support non-MLD devices. Co-developed-by: Sean Wang Signed-off-by: Sean Wang Signed-off-by: Deren Wu --- .../net/wireless/mediatek/mt76/mt7925/main.c | 132 ++++++++++-------- .../net/wireless/mediatek/mt76/mt7925/mcu.c | 7 +- .../net/wireless/mediatek/mt76/mt7925/mcu.h | 3 +- 3 files changed, 76 insertions(+), 66 deletions(-) diff --git a/drivers/net/wireless/mediatek/mt76/mt7925/main.c b/drivers/net/wireless/mediatek/mt76/mt7925/main.c index 91edbe076c22..397776ddf01a 100644 --- a/drivers/net/wireless/mediatek/mt76/mt7925/main.c +++ b/drivers/net/wireless/mediatek/mt76/mt7925/main.c @@ -695,65 +695,6 @@ mt7925_get_rates_table(struct ieee80211_hw *hw, struct ieee80211_vif *vif, return mvif->basic_rates_idx; } -static void mt7925_bss_info_changed(struct ieee80211_hw *hw, - struct ieee80211_vif *vif, - struct ieee80211_bss_conf *info, - u64 changed) -{ - struct mt76_vif *mvif = (struct mt76_vif *)vif->drv_priv; - struct mt792x_phy *phy = mt792x_hw_phy(hw); - struct mt792x_dev *dev = mt792x_hw_dev(hw); - - mt792x_mutex_acquire(dev); - - if (changed & BSS_CHANGED_ERP_SLOT) { - int slottime = info->use_short_slot ? 9 : 20; - - if (slottime != phy->slottime) { - phy->slottime = slottime; - mt7925_mcu_set_timing(phy, vif); - } - } - - if (changed & BSS_CHANGED_MCAST_RATE) - mvif->mcast_rates_idx = - mt7925_get_rates_table(hw, vif, false, true); - - if (changed & BSS_CHANGED_BASIC_RATES) - mvif->basic_rates_idx = - mt7925_get_rates_table(hw, vif, false, false); - - if (changed & (BSS_CHANGED_BEACON | - BSS_CHANGED_BEACON_ENABLED)) { - mvif->beacon_rates_idx = - mt7925_get_rates_table(hw, vif, true, false); - - mt7925_mcu_uni_add_beacon_offload(dev, hw, vif, - info->enable_beacon); - } - - /* ensure that enable txcmd_mode after bss_info */ - if (changed & (BSS_CHANGED_QOS | BSS_CHANGED_BEACON_ENABLED)) - mt7925_mcu_set_tx(dev, vif); - - if (changed & BSS_CHANGED_PS) - mt7925_mcu_uni_bss_ps(dev, vif); - - if (changed & BSS_CHANGED_ASSOC) { - mt7925_mcu_sta_update(dev, NULL, vif, true, - MT76_STA_INFO_STATE_ASSOC); - mt7925_mcu_set_beacon_filter(dev, vif, vif->cfg.assoc); - } - - if (changed & BSS_CHANGED_ARP_FILTER) { - struct mt792x_vif *mvif = (struct mt792x_vif *)vif->drv_priv; - - mt7925_mcu_update_arp_filter(&dev->mt76, &mvif->bss_conf.mt76, info); - } - - mt792x_mutex_release(dev); -} - int mt7925_mac_sta_add(struct mt76_dev *mdev, struct ieee80211_vif *vif, struct ieee80211_sta *sta) { @@ -1404,6 +1345,76 @@ static void mt7925_mgd_complete_tx(struct ieee80211_hw *hw, mt7925_abort_roc(mvif->phy, mvif); } +static void mt7925_vif_cfg_changed(struct ieee80211_hw *hw, + struct ieee80211_vif *vif, + u64 changed) +{ + struct mt792x_dev *dev = mt792x_hw_dev(hw); + + mt792x_mutex_acquire(dev); + + if (changed & BSS_CHANGED_ASSOC) { + mt7925_mcu_sta_update(dev, NULL, vif, true, + MT76_STA_INFO_STATE_ASSOC); + mt7925_mcu_set_beacon_filter(dev, vif, vif->cfg.assoc); + } + + if (changed & BSS_CHANGED_ARP_FILTER) { + struct mt792x_vif *mvif = (struct mt792x_vif *)vif->drv_priv; + + mt7925_mcu_update_arp_filter(&dev->mt76, &mvif->bss_conf.mt76); + } + + if (changed & BSS_CHANGED_PS) + mt7925_mcu_uni_bss_ps(dev, vif); + + mt792x_mutex_release(dev); +} + +static void mt7925_link_info_changed(struct ieee80211_hw *hw, + struct ieee80211_vif *vif, + struct ieee80211_bss_conf *info, + u64 changed) +{ + struct mt76_vif *mvif = (struct mt76_vif *)vif->drv_priv; + struct mt792x_phy *phy = mt792x_hw_phy(hw); + struct mt792x_dev *dev = mt792x_hw_dev(hw); + + mt792x_mutex_acquire(dev); + + if (changed & BSS_CHANGED_ERP_SLOT) { + int slottime = info->use_short_slot ? 9 : 20; + + if (slottime != phy->slottime) { + phy->slottime = slottime; + mt7925_mcu_set_timing(phy, vif); + } + } + + if (changed & BSS_CHANGED_MCAST_RATE) + mvif->mcast_rates_idx = + mt7925_get_rates_table(hw, vif, false, true); + + if (changed & BSS_CHANGED_BASIC_RATES) + mvif->basic_rates_idx = + mt7925_get_rates_table(hw, vif, false, false); + + if (changed & (BSS_CHANGED_BEACON | + BSS_CHANGED_BEACON_ENABLED)) { + mvif->beacon_rates_idx = + mt7925_get_rates_table(hw, vif, true, false); + + mt7925_mcu_uni_add_beacon_offload(dev, hw, vif, + info->enable_beacon); + } + + /* ensure that enable txcmd_mode after bss_info */ + if (changed & (BSS_CHANGED_QOS | BSS_CHANGED_BEACON_ENABLED)) + mt7925_mcu_set_tx(dev, vif); + + mt792x_mutex_release(dev); +} + const struct ieee80211_ops mt7925_ops = { .tx = mt792x_tx, .start = mt7925_start, @@ -1413,7 +1424,6 @@ const struct ieee80211_ops mt7925_ops = { .config = mt7925_config, .conf_tx = mt7925_conf_tx, .configure_filter = mt7925_configure_filter, - .bss_info_changed = mt7925_bss_info_changed, .start_ap = mt7925_start_ap, .stop_ap = mt7925_stop_ap, .sta_state = mt76_sta_state, @@ -1461,6 +1471,8 @@ const struct ieee80211_ops mt7925_ops = { .unassign_vif_chanctx = mt792x_unassign_vif_chanctx, .mgd_prepare_tx = mt7925_mgd_prepare_tx, .mgd_complete_tx = mt7925_mgd_complete_tx, + .vif_cfg_changed = mt7925_vif_cfg_changed, + .link_info_changed = mt7925_link_info_changed, }; EXPORT_SYMBOL_GPL(mt7925_ops); diff --git a/drivers/net/wireless/mediatek/mt76/mt7925/mcu.c b/drivers/net/wireless/mediatek/mt76/mt7925/mcu.c index 67c05f785190..5e72f7278e8b 100644 --- a/drivers/net/wireless/mediatek/mt76/mt7925/mcu.c +++ b/drivers/net/wireless/mediatek/mt76/mt7925/mcu.c @@ -121,11 +121,10 @@ int mt7925_mcu_regval(struct mt792x_dev *dev, u32 regidx, u32 *val, bool set) EXPORT_SYMBOL_GPL(mt7925_mcu_regval); int mt7925_mcu_update_arp_filter(struct mt76_dev *dev, - struct mt76_vif *vif, - struct ieee80211_bss_conf *info) + struct mt76_vif *vif) { - struct ieee80211_vif *mvif = container_of(info, struct ieee80211_vif, - bss_conf); + struct ieee80211_vif *mvif = container_of((void *)vif, struct ieee80211_vif, + drv_priv); struct sk_buff *skb; int i, len = min_t(int, mvif->cfg.arp_addr_cnt, IEEE80211_BSS_ARP_ADDR_LIST_LEN); diff --git a/drivers/net/wireless/mediatek/mt76/mt7925/mcu.h b/drivers/net/wireless/mediatek/mt76/mt7925/mcu.h index b8315a89f4a9..b499b1d0531a 100644 --- a/drivers/net/wireless/mediatek/mt76/mt7925/mcu.h +++ b/drivers/net/wireless/mediatek/mt76/mt7925/mcu.h @@ -590,6 +590,5 @@ int mt7925_mcu_set_chctx(struct mt76_phy *phy, struct mt76_vif *mvif, struct ieee80211_chanctx_conf *ctx); int mt7925_mcu_set_rate_txpower(struct mt76_phy *phy); int mt7925_mcu_update_arp_filter(struct mt76_dev *dev, - struct mt76_vif *vif, - struct ieee80211_bss_conf *info); + struct mt76_vif *vif); #endif From patchwork Thu Jun 13 03:01:59 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Sean Wang X-Patchwork-Id: 13696038 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from bombadil.infradead.org (bombadil.infradead.org [198.137.202.133]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.lore.kernel.org (Postfix) with ESMTPS id 0C94AC27C53 for ; Thu, 13 Jun 2024 03:03:06 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=lists.infradead.org; s=bombadil.20210309; h=Sender:List-Subscribe:List-Help :List-Post:List-Archive:List-Unsubscribe:List-Id:Content-Transfer-Encoding: MIME-Version:References:In-Reply-To:Message-Id:Date:Subject:Cc:To:From: Reply-To:Content-Type:Content-ID:Content-Description:Resent-Date:Resent-From: Resent-Sender:Resent-To:Resent-Cc:Resent-Message-ID:List-Owner; bh=uSypuI4+csB/kfi/nwHBZLhLbLNyIXH/lXGa6Of3zO4=; b=1JuWKtGzwOiqPCKb+mPACOXzO8 SvwTIP4qrcoc1V4mRteoP1jAedBqGsRZ9vn5ayrm4df/tYrELVb3OHnMRxagqUYMq2kZn0wbFTgLT GtEQHF6KdaWOcRAAWqm4G4MTwATSS3hxWTzUhmnwB68f//K8KdioCttZxNx13WdbczQhrkBjTfipQ CsN4rExNwbtQtmpugNzEiTKFOFjuVU9athB32svA+n1ClzBdXNb+xIz757lN8DcqXf/EuL9lc14Hh ReeMpiXwaNmcnnR/dgvoFlUFLPzUIriGIOr94Ae2CoPvGhYm9wADq9NUt/ykof6rcCqHhL23TKUb+ hupvYIVA==; Received: from localhost ([::1] helo=bombadil.infradead.org) by bombadil.infradead.org with esmtp (Exim 4.97.1 #2 (Red Hat Linux)) id 1sHajx-0000000Eva8-2def; Thu, 13 Jun 2024 03:03:05 +0000 Received: from mail-oa1-f43.google.com ([209.85.160.43]) by bombadil.infradead.org with esmtps (Exim 4.97.1 #2 (Red Hat Linux)) id 1sHajt-0000000EvWT-0035 for linux-mediatek@lists.infradead.org; Thu, 13 Jun 2024 03:03:03 +0000 Received: by mail-oa1-f43.google.com with SMTP id 586e51a60fabf-25496e90cf5so70041fac.1 for ; Wed, 12 Jun 2024 20:02:58 -0700 (PDT) X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1718247778; x=1718852578; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:x-gm-message-state:from:to:cc :subject:date:message-id:reply-to; bh=uSypuI4+csB/kfi/nwHBZLhLbLNyIXH/lXGa6Of3zO4=; b=VAn7KvwOBDBrhvG+iACBdpn4lrBlvc5EABm0QSM9us2LP5IIU5PxK8ctkqEx5j3zTS +8TSzZ1RcqKUE5iZgLZxo/3vbP7lnJ+UM3gDyGc44y4alaqTDxWws677ptTXnRJjMN1k G3VXrQa8phW9FDxqUv5TNfKL85Jp6Xe6KY/60vz/NxWReqaQymcEmFVNGNOERV4SpFaX CAkBI6INDS/cpqvB+4ADxZtM+tdkFf0/W4LGxh+9lV5PBAgMrhKsDnrMW12WatU74zgN OBh3iaGTM/yvYmNvlp+KryLmw64a7RaAGAsXJIwEACt19priVNPhtp6LS8QBIHrXIZul ellg== X-Forwarded-Encrypted: i=1; AJvYcCXxe/mEKD2jAML3m6UAsay/HEucrlI5XAwL63FxaDse+ZjcXNbbsfMLQpg6RyOq2KaVplxjrSW+qQQdzV7mUg==@lists.infradead.org X-Gm-Message-State: AOJu0YzV4IGoXqYGAljafv68tjovh8zD8YjGHskxPppBI5p0kb4h9tY7 +VeRykC7B+BhVjvwOmgKx3nPBFjXOvYZXMVZZ3YC3nMuIwcAM/IR X-Google-Smtp-Source: AGHT+IEKah+J8c/h93DZRB0D9q1CdSrxG9zXcATvCRSvT1+vntCbU71Uc6a/3IEC3f2hU2EaOJ8DJw== X-Received: by 2002:a05:6820:b0b:b0:5ba:c4ed:ee98 with SMTP id 006d021491bc7-5bb3b7a4c51mr3589055eaf.0.1718247778215; Wed, 12 Jun 2024 20:02:58 -0700 (PDT) Received: from sean-ThinkPad-T450s.lan ([207.191.35.252]) by smtp.gmail.com with ESMTPSA id 006d021491bc7-5bd629263c5sm67685eaf.46.2024.06.12.20.02.55 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Wed, 12 Jun 2024 20:02:56 -0700 (PDT) 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 05/47] wifi: mt76: mt792x: extend mt76_connac_mcu_uni_add_dev for per-link BSS Date: Wed, 12 Jun 2024 20:01:59 -0700 Message-Id: <20240613030241.5771-6-sean.wang@kernel.org> X-Mailer: git-send-email 2.25.1 In-Reply-To: <20240613030241.5771-1-sean.wang@kernel.org> References: <20240613030241.5771-1-sean.wang@kernel.org> MIME-Version: 1.0 X-CRM114-Version: 20100106-BlameMichelson ( TRE 0.8.0 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20240612_200301_096225_4D5DAFA7 X-CRM114-Status: GOOD ( 16.80 ) X-BeenThere: linux-mediatek@lists.infradead.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Sender: "Linux-mediatek" Errors-To: linux-mediatek-bounces+linux-mediatek=archiver.kernel.org@lists.infradead.org From: Sean Wang Extend mt76_connac_mcu_uni_add_dev with 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. We also extend link_idx field in mt76_connac_bss_basic_tlv for the firmware to able to identify the link index in the MLO mode that is not harmful for the current non-MLO mode. Signed-off-by: Sean Wang --- drivers/net/wireless/mediatek/mt76/mt7615/mcu.c | 4 ++-- drivers/net/wireless/mediatek/mt76/mt76_connac_mcu.c | 12 +++++++----- drivers/net/wireless/mediatek/mt76/mt76_connac_mcu.h | 4 ++-- drivers/net/wireless/mediatek/mt76/mt7921/mac.c | 3 ++- drivers/net/wireless/mediatek/mt76/mt7921/main.c | 4 ++-- drivers/net/wireless/mediatek/mt76/mt7925/mac.c | 3 ++- drivers/net/wireless/mediatek/mt76/mt7925/main.c | 4 ++-- drivers/net/wireless/mediatek/mt76/mt792x_core.c | 2 +- 8 files changed, 20 insertions(+), 16 deletions(-) diff --git a/drivers/net/wireless/mediatek/mt76/mt7615/mcu.c b/drivers/net/wireless/mediatek/mt76/mt7615/mcu.c index c807bd8d928d..792ae41f7c69 100644 --- a/drivers/net/wireless/mediatek/mt76/mt7615/mcu.c +++ b/drivers/net/wireless/mediatek/mt76/mt7615/mcu.c @@ -1109,8 +1109,8 @@ mt7615_mcu_uni_add_dev(struct mt7615_phy *phy, struct ieee80211_vif *vif, { struct mt7615_vif *mvif = (struct mt7615_vif *)vif->drv_priv; - return mt76_connac_mcu_uni_add_dev(phy->mt76, vif, &mvif->sta.wcid, - enable); + return mt76_connac_mcu_uni_add_dev(phy->mt76, &vif->bss_conf, + &mvif->sta.wcid, enable); } static int diff --git a/drivers/net/wireless/mediatek/mt76/mt76_connac_mcu.c b/drivers/net/wireless/mediatek/mt76/mt76_connac_mcu.c index fb8bd50eb7de..87f918461051 100644 --- a/drivers/net/wireless/mediatek/mt76/mt76_connac_mcu.c +++ b/drivers/net/wireless/mediatek/mt76/mt76_connac_mcu.c @@ -1125,11 +1125,11 @@ void mt76_connac_mcu_wtbl_ba_tlv(struct mt76_dev *dev, struct sk_buff *skb, EXPORT_SYMBOL_GPL(mt76_connac_mcu_wtbl_ba_tlv); int mt76_connac_mcu_uni_add_dev(struct mt76_phy *phy, - struct ieee80211_vif *vif, + struct ieee80211_bss_conf *bss_conf, struct mt76_wcid *wcid, bool enable) { - struct mt76_vif *mvif = (struct mt76_vif *)vif->drv_priv; + struct mt76_vif *mvif = (struct mt76_vif *)bss_conf->vif->drv_priv; struct mt76_dev *dev = phy->dev; struct { struct { @@ -1141,7 +1141,7 @@ int mt76_connac_mcu_uni_add_dev(struct mt76_phy *phy, __le16 tag; __le16 len; u8 active; - u8 pad; + u8 link_idx; /* not link_id */ u8 omac_addr[ETH_ALEN]; } __packed tlv; } dev_req = { @@ -1153,6 +1153,7 @@ int mt76_connac_mcu_uni_add_dev(struct mt76_phy *phy, .tag = cpu_to_le16(DEV_INFO_ACTIVE), .len = cpu_to_le16(sizeof(struct req_tlv)), .active = enable, + .link_idx = mvif->idx, }, }; struct { @@ -1175,12 +1176,13 @@ int mt76_connac_mcu_uni_add_dev(struct mt76_phy *phy, .bmc_tx_wlan_idx = cpu_to_le16(wcid->idx), .sta_idx = cpu_to_le16(wcid->idx), .conn_state = 1, + .link_idx = mvif->idx, }, }; int err, idx, cmd, len; void *data; - switch (vif->type) { + switch (bss_conf->vif->type) { case NL80211_IFTYPE_MESH_POINT: case NL80211_IFTYPE_MONITOR: case NL80211_IFTYPE_AP: @@ -1200,7 +1202,7 @@ int mt76_connac_mcu_uni_add_dev(struct mt76_phy *phy, idx = mvif->omac_idx > EXT_BSSID_START ? HW_BSSID_0 : mvif->omac_idx; basic_req.basic.hw_bss_idx = idx; - memcpy(dev_req.tlv.omac_addr, vif->addr, ETH_ALEN); + memcpy(dev_req.tlv.omac_addr, bss_conf->vif->addr, ETH_ALEN); cmd = enable ? MCU_UNI_CMD(DEV_INFO_UPDATE) : MCU_UNI_CMD(BSS_INFO_UPDATE); data = enable ? (void *)&dev_req : (void *)&basic_req; diff --git a/drivers/net/wireless/mediatek/mt76/mt76_connac_mcu.h b/drivers/net/wireless/mediatek/mt76/mt76_connac_mcu.h index 4d83ec2a0f9a..e6e8824c828e 100644 --- a/drivers/net/wireless/mediatek/mt76/mt76_connac_mcu.h +++ b/drivers/net/wireless/mediatek/mt76/mt76_connac_mcu.h @@ -1436,7 +1436,7 @@ struct mt76_connac_bss_basic_tlv { __le16 sta_idx; __le16 nonht_basic_phy; u8 phymode_ext; /* bit(0) AX_6G */ - u8 pad[1]; + u8 link_idx; } __packed; struct mt76_connac_bss_qos_tlv { @@ -1910,7 +1910,7 @@ void mt76_connac_mcu_sta_ba_tlv(struct sk_buff *skb, struct ieee80211_ampdu_params *params, bool enable, bool tx); int mt76_connac_mcu_uni_add_dev(struct mt76_phy *phy, - struct ieee80211_vif *vif, + struct ieee80211_bss_conf *bss_conf, struct mt76_wcid *wcid, bool enable); int mt76_connac_mcu_sta_ba(struct mt76_dev *dev, struct mt76_vif *mvif, diff --git a/drivers/net/wireless/mediatek/mt76/mt7921/mac.c b/drivers/net/wireless/mediatek/mt76/mt7921/mac.c index 5ea01c39e2e1..101cac747f9f 100644 --- a/drivers/net/wireless/mediatek/mt76/mt7921/mac.c +++ b/drivers/net/wireless/mediatek/mt76/mt7921/mac.c @@ -646,7 +646,8 @@ mt7921_vif_connect_iter(void *priv, u8 *mac, if (vif->type == NL80211_IFTYPE_STATION) ieee80211_disconnect(vif, true); - mt76_connac_mcu_uni_add_dev(&dev->mphy, vif, &mvif->sta.deflink.wcid, true); + mt76_connac_mcu_uni_add_dev(&dev->mphy, &vif->bss_conf, + &mvif->sta.deflink.wcid, true); mt7921_mcu_set_tx(dev, vif); if (vif->type == NL80211_IFTYPE_AP) { diff --git a/drivers/net/wireless/mediatek/mt76/mt7921/main.c b/drivers/net/wireless/mediatek/mt76/mt7921/main.c index 89d47cce9e8b..c7e71043c257 100644 --- a/drivers/net/wireless/mediatek/mt76/mt7921/main.c +++ b/drivers/net/wireless/mediatek/mt76/mt7921/main.c @@ -306,8 +306,8 @@ mt7921_add_interface(struct ieee80211_hw *hw, struct ieee80211_vif *vif) mvif->bss_conf.mt76.band_idx = 0; mvif->bss_conf.mt76.wmm_idx = mvif->bss_conf.mt76.idx % MT76_CONNAC_MAX_WMM_SETS; - ret = mt76_connac_mcu_uni_add_dev(&dev->mphy, vif, &mvif->sta.deflink.wcid, - true); + ret = mt76_connac_mcu_uni_add_dev(&dev->mphy, &vif->bss_conf, + &mvif->sta.deflink.wcid, true); if (ret) goto out; diff --git a/drivers/net/wireless/mediatek/mt76/mt7925/mac.c b/drivers/net/wireless/mediatek/mt76/mt7925/mac.c index 88e7b2ff4593..48425fc4e7fe 100644 --- a/drivers/net/wireless/mediatek/mt76/mt7925/mac.c +++ b/drivers/net/wireless/mediatek/mt76/mt7925/mac.c @@ -1243,7 +1243,8 @@ mt7925_vif_connect_iter(void *priv, u8 *mac, if (vif->type == NL80211_IFTYPE_STATION) ieee80211_disconnect(vif, true); - mt76_connac_mcu_uni_add_dev(&dev->mphy, vif, &mvif->sta.deflink.wcid, true); + mt76_connac_mcu_uni_add_dev(&dev->mphy, &vif->bss_conf, + &mvif->sta.deflink.wcid, true); mt7925_mcu_set_tx(dev, vif); if (vif->type == NL80211_IFTYPE_AP) { diff --git a/drivers/net/wireless/mediatek/mt76/mt7925/main.c b/drivers/net/wireless/mediatek/mt76/mt7925/main.c index 397776ddf01a..b0c8b090d2ce 100644 --- a/drivers/net/wireless/mediatek/mt76/mt7925/main.c +++ b/drivers/net/wireless/mediatek/mt76/mt7925/main.c @@ -344,8 +344,8 @@ mt7925_add_interface(struct ieee80211_hw *hw, struct ieee80211_vif *vif) else mvif->bss_conf.mt76.basic_rates_idx = MT792x_BASIC_RATES_TBL; - ret = mt76_connac_mcu_uni_add_dev(&dev->mphy, vif, &mvif->sta.deflink.wcid, - true); + ret = mt76_connac_mcu_uni_add_dev(&dev->mphy, &vif->bss_conf, + &mvif->sta.deflink.wcid, true); if (ret) goto out; diff --git a/drivers/net/wireless/mediatek/mt76/mt792x_core.c b/drivers/net/wireless/mediatek/mt76/mt792x_core.c index a189ae38f2d0..222204916b73 100644 --- a/drivers/net/wireless/mediatek/mt76/mt792x_core.c +++ b/drivers/net/wireless/mediatek/mt76/mt792x_core.c @@ -124,7 +124,7 @@ void mt792x_remove_interface(struct ieee80211_hw *hw, mt792x_mutex_acquire(dev); mt76_connac_free_pending_tx_skbs(&dev->pm, &msta->deflink.wcid); - mt76_connac_mcu_uni_add_dev(&dev->mphy, vif, &mvif->sta.deflink.wcid, false); + mt76_connac_mcu_uni_add_dev(&dev->mphy, &vif->bss_conf, &mvif->sta.deflink.wcid, false); rcu_assign_pointer(dev->mt76.wcid[idx], NULL); From patchwork Thu Jun 13 03:02:00 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Sean Wang X-Patchwork-Id: 13696040 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from bombadil.infradead.org (bombadil.infradead.org [198.137.202.133]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.lore.kernel.org (Postfix) with ESMTPS id 0EE63C27C6E for ; Thu, 13 Jun 2024 03:03:10 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=lists.infradead.org; s=bombadil.20210309; h=Sender:List-Subscribe:List-Help :List-Post:List-Archive:List-Unsubscribe:List-Id:Content-Transfer-Encoding: MIME-Version:References:In-Reply-To:Message-Id:Date:Subject:Cc:To:From: Reply-To:Content-Type:Content-ID:Content-Description:Resent-Date:Resent-From: Resent-Sender:Resent-To:Resent-Cc:Resent-Message-ID:List-Owner; bh=HNkelXTxxMMz4LGtUvEnp1jPMerysFzidVDadNvD4GE=; b=fivb1tU3C5GBmsxuSerV3WGAbv Bvo3Xmd6Q8AvwPFeMsqYqCQlSWM6WHbfx35kLnptGhmWgjCLGiGZS3lPhpjXa/jlag6syZ0jmOO3x 2nFWZszTOfrH2YfjQPXLpK5nlyOpmyaWB7u1a0oOQ4/7Qf3RmDUZ3Aqq92oJYDK82H7PamqEnSou9 gxE6T9GfrJT94zl7ZJsd6+hNXAg5VcTR3JS03CjDH6H2TFVjx4PGheH9mR62QB5TIMIKYat1rHlnf RArB2Dj/gHsGQeBOcYmpczdCTR+zqKkCeEyVoPJvu2MxkrjpcG8mXJecWfMyTUFJ5hX+VCHAY9afq 8NVc5zfQ==; Received: from localhost ([::1] helo=bombadil.infradead.org) by bombadil.infradead.org with esmtp (Exim 4.97.1 #2 (Red Hat Linux)) id 1sHak1-0000000Evcb-37AA; Thu, 13 Jun 2024 03:03:09 +0000 Received: from mail-oo1-f41.google.com ([209.85.161.41]) by bombadil.infradead.org with esmtps (Exim 4.97.1 #2 (Red Hat Linux)) id 1sHajt-0000000EvY6-3jAu for linux-mediatek@lists.infradead.org; Thu, 13 Jun 2024 03:03:05 +0000 Received: by mail-oo1-f41.google.com with SMTP id 006d021491bc7-5b99ba97d89so25543eaf.1 for ; Wed, 12 Jun 2024 20:03:01 -0700 (PDT) X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1718247781; x=1718852581; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:x-gm-message-state:from:to:cc :subject:date:message-id:reply-to; bh=HNkelXTxxMMz4LGtUvEnp1jPMerysFzidVDadNvD4GE=; b=kHFOV6AtnsGB0leKIspPlTLYoumj5Gd4IwOIqpJ17659Bk1abgaXpsa1BfOTyhtdzJ wYKhZTYY3mcC1e/YfMHPdSoo4ChoCr1MUfC6Xbz1o1r0iLzS4H7RjT7eHwujh8BSdCy3 BufJIErUeZmnox24noXShE1Xu283wMHxCPw3B8+6sIbu7yzO/509YB5C5Qi8yklebMpV t5iGKr7Ef7KthMiufp81qEmoQUFhv1zvu5doEW4Toukp/a7Cw7WcqTiK8HSSEP+I40Zl yU8QijiUSrB+lczzWFNJNsXln0Z5UuhCuDsp0BE1iceUz7qXcnUT2+Q9O7UlFwZ++Uet v32g== X-Forwarded-Encrypted: i=1; AJvYcCU+vix5ArvCZjJJg4F2onoUKfpWk70OoHvZkTzagaqNUG4yQN+QxKOseOh9ORVPuQcDtpQjpBMaFD/U3VNXqv01GV+J0UWMM3UQhLnOZ1u6hKmz X-Gm-Message-State: AOJu0YwpI3nug87lPGqrARBXPjYLaWidoFbWJKHKFqmaMrqYOARRR9Hz t8FoIcFrKjqEJ8YZkYdCy/Rr2PL3UhmrYysm3S4HMx1gQj91mTf4 X-Google-Smtp-Source: AGHT+IGop7lIhBPZfEfsSFi5dcAXixU7dZnIGAt4G4oXUA5mCgEPT9L0Hbz4YM8vhZF8LA0Cyhk0zA== X-Received: by 2002:a05:6820:d88:b0:5ba:ead2:c742 with SMTP id 006d021491bc7-5bb3b7a3d2bmr3670644eaf.0.1718247780534; Wed, 12 Jun 2024 20:03:00 -0700 (PDT) Received: from sean-ThinkPad-T450s.lan ([207.191.35.252]) by smtp.gmail.com with ESMTPSA id 006d021491bc7-5bd629263c5sm67685eaf.46.2024.06.12.20.02.58 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Wed, 12 Jun 2024 20:02:58 -0700 (PDT) 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 06/47] wifi: mt76: mt7925: extend mt7925_mcu_set_tx with for per-link BSS Date: Wed, 12 Jun 2024 20:02:00 -0700 Message-Id: <20240613030241.5771-7-sean.wang@kernel.org> X-Mailer: git-send-email 2.25.1 In-Reply-To: <20240613030241.5771-1-sean.wang@kernel.org> References: <20240613030241.5771-1-sean.wang@kernel.org> MIME-Version: 1.0 X-CRM114-Version: 20100106-BlameMichelson ( TRE 0.8.0 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20240612_200301_972597_1101A1D3 X-CRM114-Status: GOOD ( 15.71 ) X-BeenThere: linux-mediatek@lists.infradead.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Sender: "Linux-mediatek" Errors-To: linux-mediatek-bounces+linux-mediatek=archiver.kernel.org@lists.infradead.org From: Deren Wu Extend mt7925_mcu_set_tx with 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: Sean Wang Signed-off-by: Sean Wang Signed-off-by: Deren Wu --- .../net/wireless/mediatek/mt76/mt7925/mac.c | 2 +- .../net/wireless/mediatek/mt76/mt7925/main.c | 2 +- .../net/wireless/mediatek/mt76/mt7925/mcu.c | 9 ++++--- .../wireless/mediatek/mt76/mt7925/mt7925.h | 2 +- drivers/net/wireless/mediatek/mt76/mt792x.h | 25 +++++++++++++++++++ 5 files changed, 33 insertions(+), 7 deletions(-) diff --git a/drivers/net/wireless/mediatek/mt76/mt7925/mac.c b/drivers/net/wireless/mediatek/mt76/mt7925/mac.c index 48425fc4e7fe..2be2ab914411 100644 --- a/drivers/net/wireless/mediatek/mt76/mt7925/mac.c +++ b/drivers/net/wireless/mediatek/mt76/mt7925/mac.c @@ -1245,7 +1245,7 @@ mt7925_vif_connect_iter(void *priv, u8 *mac, mt76_connac_mcu_uni_add_dev(&dev->mphy, &vif->bss_conf, &mvif->sta.deflink.wcid, true); - mt7925_mcu_set_tx(dev, vif); + mt7925_mcu_set_tx(dev, &vif->bss_conf); if (vif->type == NL80211_IFTYPE_AP) { mt76_connac_mcu_uni_add_bss(dev->phy.mt76, vif, &mvif->sta.deflink.wcid, diff --git a/drivers/net/wireless/mediatek/mt76/mt7925/main.c b/drivers/net/wireless/mediatek/mt76/mt7925/main.c index b0c8b090d2ce..d11919688bae 100644 --- a/drivers/net/wireless/mediatek/mt76/mt7925/main.c +++ b/drivers/net/wireless/mediatek/mt76/mt7925/main.c @@ -1410,7 +1410,7 @@ static void mt7925_link_info_changed(struct ieee80211_hw *hw, /* ensure that enable txcmd_mode after bss_info */ if (changed & (BSS_CHANGED_QOS | BSS_CHANGED_BEACON_ENABLED)) - mt7925_mcu_set_tx(dev, vif); + mt7925_mcu_set_tx(dev, info); mt792x_mutex_release(dev); } diff --git a/drivers/net/wireless/mediatek/mt76/mt7925/mcu.c b/drivers/net/wireless/mediatek/mt76/mt7925/mcu.c index 5e72f7278e8b..1c262a024dc8 100644 --- a/drivers/net/wireless/mediatek/mt76/mt7925/mcu.c +++ b/drivers/net/wireless/mediatek/mt76/mt7925/mcu.c @@ -900,7 +900,8 @@ int mt7925_mcu_wtbl_update_hdr_trans(struct mt792x_dev *dev, MCU_WMWA_UNI_CMD(STA_REC_UPDATE), true); } -int mt7925_mcu_set_tx(struct mt792x_dev *dev, struct ieee80211_vif *vif) +int mt7925_mcu_set_tx(struct mt792x_dev *dev, + struct ieee80211_bss_conf *bss_conf) { #define MCU_EDCA_AC_PARAM 0 #define WMM_AIFS_SET BIT(0) @@ -909,12 +910,12 @@ int mt7925_mcu_set_tx(struct mt792x_dev *dev, struct ieee80211_vif *vif) #define WMM_TXOP_SET BIT(3) #define WMM_PARAM_SET (WMM_AIFS_SET | WMM_CW_MIN_SET | \ WMM_CW_MAX_SET | WMM_TXOP_SET) - struct mt792x_vif *mvif = (struct mt792x_vif *)vif->drv_priv; + struct mt792x_bss_conf *mconf = mt792x_link_conf_to_mconf(bss_conf); struct { u8 bss_idx; u8 __rsv[3]; } __packed hdr = { - .bss_idx = mvif->bss_conf.mt76.idx, + .bss_idx = mconf->mt76.idx, }; struct sk_buff *skb; int len = sizeof(hdr) + IEEE80211_NUM_ACS * sizeof(struct edca); @@ -927,7 +928,7 @@ int mt7925_mcu_set_tx(struct mt792x_dev *dev, struct ieee80211_vif *vif) skb_put_data(skb, &hdr, sizeof(hdr)); for (ac = 0; ac < IEEE80211_NUM_ACS; ac++) { - struct ieee80211_tx_queue_params *q = &mvif->bss_conf.queue_params[ac]; + struct ieee80211_tx_queue_params *q = &mconf->queue_params[ac]; struct edca *e; struct tlv *tlv; diff --git a/drivers/net/wireless/mediatek/mt76/mt7925/mt7925.h b/drivers/net/wireless/mediatek/mt76/mt7925/mt7925.h index 8a4a71f6bcb6..f689f7a359ea 100644 --- a/drivers/net/wireless/mediatek/mt76/mt7925/mt7925.h +++ b/drivers/net/wireless/mediatek/mt76/mt7925/mt7925.h @@ -198,7 +198,7 @@ int mt7925_mcu_sta_update(struct mt792x_dev *dev, struct ieee80211_sta *sta, struct ieee80211_vif *vif, bool enable, enum mt76_sta_info_state state); int mt7925_mcu_set_chan_info(struct mt792x_phy *phy, u16 tag); -int mt7925_mcu_set_tx(struct mt792x_dev *dev, struct ieee80211_vif *vif); +int mt7925_mcu_set_tx(struct mt792x_dev *dev, struct ieee80211_bss_conf *bss_conf); int mt7925_mcu_set_eeprom(struct mt792x_dev *dev); int mt7925_mcu_get_rx_rate(struct mt792x_phy *phy, struct ieee80211_vif *vif, struct ieee80211_sta *sta, struct rate_info *rate); diff --git a/drivers/net/wireless/mediatek/mt76/mt792x.h b/drivers/net/wireless/mediatek/mt76/mt792x.h index b5eb574e8548..4a7526322c30 100644 --- a/drivers/net/wireless/mediatek/mt76/mt792x.h +++ b/drivers/net/wireless/mediatek/mt76/mt792x.h @@ -112,6 +112,7 @@ struct mt792x_bss_conf { struct mt792x_vif { struct mt792x_bss_conf bss_conf; /* must be first */ + struct mt792x_bss_conf __rcu *link_conf[IEEE80211_MLD_MAX_NUM_LINKS]; struct mt792x_sta sta; struct mt792x_sta *wep_sta; @@ -219,6 +220,30 @@ struct mt792x_dev { u32 backup_l2; }; +static inline struct mt792x_bss_conf * +mt792x_vif_to_link(struct mt792x_vif *mvif, u8 link_id) +{ + struct ieee80211_vif *vif; + + vif = container_of((void *)mvif, struct ieee80211_vif, drv_priv); + + if (!ieee80211_vif_is_mld(vif) || + link_id >= IEEE80211_LINK_UNSPECIFIED) + return &mvif->bss_conf; + + return rcu_dereference_protected(mvif->link_conf[link_id], + lockdep_is_held(&mvif->phy->dev->mt76.mutex)); +} + +static inline struct mt792x_bss_conf * +mt792x_link_conf_to_mconf(struct ieee80211_bss_conf *link_conf) +{ + struct ieee80211_vif *vif = link_conf->vif; + struct mt792x_vif *mvif = (struct mt792x_vif *)vif->drv_priv; + + return mt792x_vif_to_link(mvif, link_conf->link_id); +} + static inline struct mt792x_dev * mt792x_hw_dev(struct ieee80211_hw *hw) { From patchwork Thu Jun 13 03:02:01 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Sean Wang X-Patchwork-Id: 13696039 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from bombadil.infradead.org (bombadil.infradead.org [198.137.202.133]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.lore.kernel.org (Postfix) with ESMTPS id 6AD2DC27C53 for ; Thu, 13 Jun 2024 03:03:10 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=lists.infradead.org; s=bombadil.20210309; h=Sender:List-Subscribe:List-Help :List-Post:List-Archive:List-Unsubscribe:List-Id:Content-Transfer-Encoding: MIME-Version:References:In-Reply-To:Message-Id:Date:Subject:Cc:To:From: Reply-To:Content-Type:Content-ID:Content-Description:Resent-Date:Resent-From: Resent-Sender:Resent-To:Resent-Cc:Resent-Message-ID:List-Owner; bh=vGyztoV59eBgCzUwmK/mPi8RZNmVgI7WAXgbEweQmNE=; b=plWmmJgBRXPoITF/yTX4xRcQOS q9wPMfccRoEKebtedAAGHUxWsEer5NvAUu+Dn6BBeEHMEtX/i8XZxJ4yL6Sk++VYkIiJ80C6ygjY7 Jj/8RqEhz1mPaxuKTwE1W8BgxiO1Uf7y0pTj8G9oBNGjx7iHqP543IU2CIIh6Sy4fQBxR+BMQUeEk sUQo/OftBD7exNcT1QQR5PA4jshBwJsS7uFtGXjlJlFRly9WFvHMTAEP+0ciGZTZuIEZid8oApL9D 1vOJ2yHsCQuqnKUx8wZAIWF2UqhDFOuKhkml/YiyC4uY5we4Dt6zMzGgffxiV3x3HNmdHRwWMxB6K Vwe8FjaQ==; Received: from localhost ([::1] helo=bombadil.infradead.org) by bombadil.infradead.org with esmtp (Exim 4.97.1 #2 (Red Hat Linux)) id 1sHak2-0000000Evd4-0Rm2; Thu, 13 Jun 2024 03:03:10 +0000 Received: from mail-oo1-f42.google.com ([209.85.161.42]) by bombadil.infradead.org with esmtps (Exim 4.97.1 #2 (Red Hat Linux)) id 1sHajv-0000000EvZ3-3TrW for linux-mediatek@lists.infradead.org; Thu, 13 Jun 2024 03:03:06 +0000 Received: by mail-oo1-f42.google.com with SMTP id 006d021491bc7-5bae827df63so40134eaf.3 for ; Wed, 12 Jun 2024 20:03:03 -0700 (PDT) X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1718247783; x=1718852583; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:x-gm-message-state:from:to:cc :subject:date:message-id:reply-to; bh=vGyztoV59eBgCzUwmK/mPi8RZNmVgI7WAXgbEweQmNE=; b=dKUA8ax5txScodX3Aryt3a0JHPIvspVdEZc1bCdGwlRYE9EMhHtnWubrai+QBOT9gC 8ceA6fZmenzzrGqr9ASIfxD4f1g1OvxQ8w7/kFgd8EyZmC3JD2m9NIyYAj9yxC4FSTK+ qeT9PpgexWdO+KSz7qP7sagsdlWxOY3h0IqYCHjC4ENhf62K8k0nJo+Rz9HTrm85c8hH SJQmwdbYq9+fo9/085Z157C+6RY25q98LJM0JKwF2NOimAZpiB3fvF4TSSe5luEXO++/ nCiHXAaSPHJZPWgfBtIGrPYQkEMLfOQyy9UTjzvPVyWnHaCml7+z/pcZgJyol1eBPqAm 2znw== X-Forwarded-Encrypted: i=1; AJvYcCXJSkWBOau5ic8U356g6aPqVNw/mRv5sesTQATSc6XGp6b/FE23XAm4irX3rmIN/BQPf4nhBSmfQXQn9enuYku3J5egTaGt20kGlWP5T+tO5Zhb X-Gm-Message-State: AOJu0YyA4QIIv0tocjOCqPlTyN2kApNPVkrtE8jfmr7GWGTiJ74NaMD1 kOh0fmGOdWQfyAma+L6zCVLsdnGHwzj9gsy1WYfUel1yPzr3UKwoqrjqgxXl3CE= X-Google-Smtp-Source: AGHT+IFrMv3xLHoSpDVd44dAULyXTz2vPfVhq0zPat0nnHQtgJfz3ZUt37AbIegOho4HaYLardyU/g== X-Received: by 2002:a4a:a5ca:0:b0:5ba:e11d:a2ae with SMTP id 006d021491bc7-5bb3b9f4ef7mr3670975eaf.1.1718247782656; Wed, 12 Jun 2024 20:03:02 -0700 (PDT) Received: from sean-ThinkPad-T450s.lan ([207.191.35.252]) by smtp.gmail.com with ESMTPSA id 006d021491bc7-5bd629263c5sm67685eaf.46.2024.06.12.20.03.00 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Wed, 12 Jun 2024 20:03:01 -0700 (PDT) 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 07/47] wifi: mt76: mt7925: extend mt7925_mcu_add_bss_info for per-link BSS Date: Wed, 12 Jun 2024 20:02:01 -0700 Message-Id: <20240613030241.5771-8-sean.wang@kernel.org> X-Mailer: git-send-email 2.25.1 In-Reply-To: <20240613030241.5771-1-sean.wang@kernel.org> References: <20240613030241.5771-1-sean.wang@kernel.org> MIME-Version: 1.0 X-CRM114-Version: 20100106-BlameMichelson ( TRE 0.8.0 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20240612_200303_995668_47B3F86E X-CRM114-Status: GOOD ( 17.13 ) X-BeenThere: linux-mediatek@lists.infradead.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Sender: "Linux-mediatek" Errors-To: linux-mediatek-bounces+linux-mediatek=archiver.kernel.org@lists.infradead.org From: Sean Wang Extend mt7925_mcu_add_bss_info with 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: Deren Wu Signed-off-by: Deren Wu Signed-off-by: Sean Wang --- .../net/wireless/mediatek/mt76/mt7925/main.c | 35 +++++++++++++------ .../net/wireless/mediatek/mt76/mt7925/mcu.c | 22 ++++++------ .../net/wireless/mediatek/mt76/mt7925/mcu.h | 2 +- drivers/net/wireless/mediatek/mt76/mt792x.h | 10 ++++++ 4 files changed, 46 insertions(+), 23 deletions(-) diff --git a/drivers/net/wireless/mediatek/mt76/mt7925/main.c b/drivers/net/wireless/mediatek/mt76/mt7925/main.c index d11919688bae..7b9deb586b34 100644 --- a/drivers/net/wireless/mediatek/mt76/mt7925/main.c +++ b/drivers/net/wireless/mediatek/mt76/mt7925/main.c @@ -487,9 +487,12 @@ static int mt7925_set_key(struct ieee80211_hw *hw, enum set_key_cmd cmd, struct mt792x_sta *msta = sta ? (struct mt792x_sta *)sta->drv_priv : &mvif->sta; struct mt76_wcid *wcid = &msta->deflink.wcid; + struct ieee80211_bss_conf *link_conf; u8 *wcid_keyidx = &wcid->hw_key_idx; int idx = key->keyidx, err = 0; + link_conf = mt792x_vif_to_bss_conf(vif, vif->bss_conf.link_id); + /* The hardware does not support per-STA RX GTK, fallback * to software mode for these. */ @@ -528,7 +531,8 @@ static int mt7925_set_key(struct ieee80211_hw *hw, enum set_key_cmd cmd, struct mt792x_phy *phy = mt792x_hw_phy(hw); mvif->bss_conf.mt76.cipher = mt7925_mcu_get_cipher(key->cipher); - mt7925_mcu_add_bss_info(phy, mvif->bss_conf.mt76.ctx, vif, sta, true); + mt7925_mcu_add_bss_info(phy, mvif->bss_conf.mt76.ctx, link_conf, + sta, true); } if (cmd == SET_KEY) @@ -701,6 +705,7 @@ int mt7925_mac_sta_add(struct mt76_dev *mdev, struct ieee80211_vif *vif, struct mt792x_dev *dev = container_of(mdev, struct mt792x_dev, mt76); struct mt792x_sta *msta = (struct mt792x_sta *)sta->drv_priv; struct mt792x_vif *mvif = (struct mt792x_vif *)vif->drv_priv; + struct ieee80211_bss_conf *link_conf; int ret, idx; idx = mt76_wcid_alloc(dev->mt76.wcid_mask, MT792x_WTBL_STA - 1); @@ -725,10 +730,12 @@ int mt7925_mac_sta_add(struct mt76_dev *mdev, struct ieee80211_vif *vif, mt7925_mac_wtbl_update(dev, idx, MT_WTBL_UPDATE_ADM_COUNT_CLEAR); + link_conf = mt792x_vif_to_bss_conf(vif, vif->bss_conf.link_id); + /* should update bss info before STA add */ if (vif->type == NL80211_IFTYPE_STATION && !sta->tdls) - mt7925_mcu_add_bss_info(&dev->phy, mvif->bss_conf.mt76.ctx, vif, sta, - false); + mt7925_mcu_add_bss_info(&dev->phy, mvif->bss_conf.mt76.ctx, + link_conf, sta, false); ret = mt7925_mcu_sta_update(dev, sta, vif, true, MT76_STA_INFO_STATE_NONE); @@ -747,12 +754,15 @@ void mt7925_mac_sta_assoc(struct mt76_dev *mdev, struct ieee80211_vif *vif, struct mt792x_dev *dev = container_of(mdev, struct mt792x_dev, mt76); struct mt792x_sta *msta = (struct mt792x_sta *)sta->drv_priv; struct mt792x_vif *mvif = (struct mt792x_vif *)vif->drv_priv; + struct ieee80211_bss_conf *link_conf; mt792x_mutex_acquire(dev); + link_conf = mt792x_vif_to_bss_conf(vif, vif->bss_conf.link_id); + if (vif->type == NL80211_IFTYPE_STATION && !sta->tdls) - mt7925_mcu_add_bss_info(&dev->phy, mvif->bss_conf.mt76.ctx, vif, sta, - true); + mt7925_mcu_add_bss_info(&dev->phy, mvif->bss_conf.mt76.ctx, + link_conf, sta, true); ewma_avg_signal_init(&msta->deflink.avg_ack_signal); @@ -771,6 +781,7 @@ void mt7925_mac_sta_remove(struct mt76_dev *mdev, struct ieee80211_vif *vif, { struct mt792x_dev *dev = container_of(mdev, struct mt792x_dev, mt76); struct mt792x_sta *msta = (struct mt792x_sta *)sta->drv_priv; + struct ieee80211_bss_conf *link_conf; mt76_connac_free_pending_tx_skbs(&dev->pm, &msta->deflink.wcid); mt76_connac_pm_wake(&dev->mphy, &dev->pm); @@ -779,14 +790,16 @@ void mt7925_mac_sta_remove(struct mt76_dev *mdev, struct ieee80211_vif *vif, mt7925_mac_wtbl_update(dev, msta->deflink.wcid.idx, MT_WTBL_UPDATE_ADM_COUNT_CLEAR); + link_conf = mt792x_vif_to_bss_conf(vif, vif->bss_conf.link_id); + if (vif->type == NL80211_IFTYPE_STATION) { struct mt792x_vif *mvif = (struct mt792x_vif *)vif->drv_priv; mvif->wep_sta = NULL; ewma_rssi_init(&mvif->bss_conf.rssi); if (!sta->tdls) - mt7925_mcu_add_bss_info(&dev->phy, mvif->bss_conf.mt76.ctx, vif, sta, - false); + mt7925_mcu_add_bss_info(&dev->phy, mvif->bss_conf.mt76.ctx, + link_conf, sta, false); } spin_lock_bh(&mdev->sta_poll_lock); @@ -1244,8 +1257,8 @@ mt7925_start_ap(struct ieee80211_hw *hw, struct ieee80211_vif *vif, mt792x_mutex_acquire(dev); - err = mt7925_mcu_add_bss_info(&dev->phy, mvif->bss_conf.mt76.ctx, vif, NULL, - true); + err = mt7925_mcu_add_bss_info(&dev->phy, mvif->bss_conf.mt76.ctx, + link_conf, NULL, true); if (err) goto out; @@ -1275,8 +1288,8 @@ mt7925_stop_ap(struct ieee80211_hw *hw, struct ieee80211_vif *vif, if (err) goto out; - mt7925_mcu_add_bss_info(&dev->phy, mvif->bss_conf.mt76.ctx, vif, NULL, - false); + mt7925_mcu_add_bss_info(&dev->phy, mvif->bss_conf.mt76.ctx, link_conf, + NULL, false); out: mt792x_mutex_release(dev); diff --git a/drivers/net/wireless/mediatek/mt76/mt7925/mcu.c b/drivers/net/wireless/mediatek/mt76/mt7925/mcu.c index 1c262a024dc8..fb261ee525be 100644 --- a/drivers/net/wireless/mediatek/mt76/mt7925/mcu.c +++ b/drivers/net/wireless/mediatek/mt76/mt7925/mcu.c @@ -2315,11 +2315,11 @@ int mt7925_mcu_set_timing(struct mt792x_phy *phy, int mt7925_mcu_add_bss_info(struct mt792x_phy *phy, struct ieee80211_chanctx_conf *ctx, - struct ieee80211_vif *vif, + struct ieee80211_bss_conf *link_conf, struct ieee80211_sta *sta, int enable) { - struct mt792x_vif *mvif = (struct mt792x_vif *)vif->drv_priv; + struct mt792x_vif *mvif = (struct mt792x_vif *)link_conf->vif->drv_priv; struct mt792x_dev *dev = phy->dev; struct sk_buff *skb; int err; @@ -2330,18 +2330,18 @@ int mt7925_mcu_add_bss_info(struct mt792x_phy *phy, return PTR_ERR(skb); /* bss_basic must be first */ - mt7925_mcu_bss_basic_tlv(skb, vif, sta, ctx, phy->mt76, + mt7925_mcu_bss_basic_tlv(skb, link_conf->vif, sta, ctx, phy->mt76, mvif->sta.deflink.wcid.idx, enable); - mt7925_mcu_bss_sec_tlv(skb, vif); + mt7925_mcu_bss_sec_tlv(skb, link_conf->vif); - mt7925_mcu_bss_bmc_tlv(skb, phy, ctx, vif, sta); - mt7925_mcu_bss_qos_tlv(skb, vif); - mt7925_mcu_bss_mld_tlv(skb, vif, sta); - mt7925_mcu_bss_ifs_tlv(skb, vif); + mt7925_mcu_bss_bmc_tlv(skb, phy, ctx, link_conf->vif, sta); + mt7925_mcu_bss_qos_tlv(skb, link_conf->vif); + mt7925_mcu_bss_mld_tlv(skb, link_conf->vif, sta); + mt7925_mcu_bss_ifs_tlv(skb, link_conf->vif); - if (vif->bss_conf.he_support) { - mt7925_mcu_bss_he_tlv(skb, vif, phy); - mt7925_mcu_bss_color_tlv(skb, vif, enable); + if (link_conf->he_support) { + mt7925_mcu_bss_he_tlv(skb, link_conf->vif, phy); + mt7925_mcu_bss_color_tlv(skb, link_conf->vif, enable); } err = mt76_mcu_skb_send_msg(&dev->mt76, skb, diff --git a/drivers/net/wireless/mediatek/mt76/mt7925/mcu.h b/drivers/net/wireless/mediatek/mt76/mt7925/mcu.h index b499b1d0531a..c692996e057c 100644 --- a/drivers/net/wireless/mediatek/mt76/mt7925/mcu.h +++ b/drivers/net/wireless/mediatek/mt76/mt7925/mcu.h @@ -578,7 +578,7 @@ int mt7925_mcu_sched_scan_enable(struct mt76_phy *phy, bool enable); int mt7925_mcu_add_bss_info(struct mt792x_phy *phy, struct ieee80211_chanctx_conf *ctx, - struct ieee80211_vif *vif, + struct ieee80211_bss_conf *link_conf, struct ieee80211_sta *sta, int enable); int mt7925_mcu_set_timing(struct mt792x_phy *phy, diff --git a/drivers/net/wireless/mediatek/mt76/mt792x.h b/drivers/net/wireless/mediatek/mt76/mt792x.h index 4a7526322c30..f675709f419a 100644 --- a/drivers/net/wireless/mediatek/mt76/mt792x.h +++ b/drivers/net/wireless/mediatek/mt76/mt792x.h @@ -244,6 +244,16 @@ mt792x_link_conf_to_mconf(struct ieee80211_bss_conf *link_conf) return mt792x_vif_to_link(mvif, link_conf->link_id); } +static inline struct ieee80211_bss_conf * +mt792x_vif_to_bss_conf(struct ieee80211_vif *vif, unsigned int link_id) +{ + if (!ieee80211_vif_is_mld(vif) || + link_id >= IEEE80211_LINK_UNSPECIFIED) + return &vif->bss_conf; + + return link_conf_dereference_protected(vif, link_id); +} + static inline struct mt792x_dev * mt792x_hw_dev(struct ieee80211_hw *hw) { From patchwork Thu Jun 13 03:02:02 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Sean Wang X-Patchwork-Id: 13696041 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from bombadil.infradead.org (bombadil.infradead.org [198.137.202.133]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.lore.kernel.org (Postfix) with ESMTPS id 82870C27C53 for ; Thu, 13 Jun 2024 03:03:13 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=lists.infradead.org; s=bombadil.20210309; h=Sender:List-Subscribe:List-Help :List-Post:List-Archive:List-Unsubscribe:List-Id:Content-Transfer-Encoding: MIME-Version:References:In-Reply-To:Message-Id:Date:Subject:Cc:To:From: Reply-To:Content-Type:Content-ID:Content-Description:Resent-Date:Resent-From: Resent-Sender:Resent-To:Resent-Cc:Resent-Message-ID:List-Owner; bh=tk2KfDSTIKehiWysrLk9gdpwiwyKzUSH27r7ZuD+Tno=; b=te88Q3pdnsapBxNW84WBpwTkFf Y5AOQtcjraN4igmX53152d6KwtTI9fiRjT70Zo5FL9deIhVXpGSgI2xd5Kw74WXiGs5JCXTqLVDkl K7u3WA/EgGqn8oSd+aiAY/kSDvwBZ4kbWK+KIMlckrZh1EsA00GEeIQwiSdl1DDYdjwmVkow9vkV5 GLKDSeX/x8/Ywe/Eg/dVjjS/YXMTSGT9QT3HvL28T2RuXSupFVYiQL2jzkfI5NWT1j1J2o0x+96Xg gGSVMn0hSyW48Z1SCTX2p9XA+dfzZa6apdz+nvCExOHpUC8CRf/3tMPzV1YYodTewujsfXcXBwZIE sjODvooQ==; Received: from localhost ([::1] helo=bombadil.infradead.org) by bombadil.infradead.org with esmtp (Exim 4.97.1 #2 (Red Hat Linux)) id 1sHak5-0000000Evf0-0Wwo; Thu, 13 Jun 2024 03:03:13 +0000 Received: from mail-oo1-f46.google.com ([209.85.161.46]) by bombadil.infradead.org with esmtps (Exim 4.97.1 #2 (Red Hat Linux)) id 1sHajx-0000000EvZt-2XdM for linux-mediatek@lists.infradead.org; Thu, 13 Jun 2024 03:03:08 +0000 Received: by mail-oo1-f46.google.com with SMTP id 006d021491bc7-5bb24436f72so14140eaf.2 for ; Wed, 12 Jun 2024 20:03:05 -0700 (PDT) X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1718247784; x=1718852584; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:x-gm-message-state:from:to:cc :subject:date:message-id:reply-to; bh=tk2KfDSTIKehiWysrLk9gdpwiwyKzUSH27r7ZuD+Tno=; b=Hr37yayd2GgDaN1CkgdpxAaZmwsEu32nZKYmlFLRX6iSd2XtvLoR72pTGZ+TBk55H4 NkqjiBnC9uBB3sSSBoLpHU9aJgehzW20VEDMqpOvefltwZeXWJS2SiAap//eeKcVnKx3 X1zjPHKLMscuPPzyahZDin0Sfmp6NWW2+wat0GauydS26Ymy3Huoy+m6ujY5AM/BlvJs W8Efa/zu9dKfkSLZkvKOJ7Sq2UX73MklfVAEVDK8WplQ3xXbyJyIzrhihxTVdMm22FJk OzPULA3iY4x9zbJnTYT1wZ9ixKR74pyyjehyRSHDOodL9ymyPVnjF35jmr3ucdiG0ZTq suLg== X-Forwarded-Encrypted: i=1; AJvYcCVvXjxHbNlJw/18ENR37IotHPpL9nXlRmCND2/qd180oC3QDntQnoCWvApUoAnFG2YncxteUfySegoE5ozuqHQ9dlhzQ+iYKRJwK1/3WNXwdTsg X-Gm-Message-State: AOJu0Yz+R13jvFkIRtxS3jNlOLTJHjbOBjNoxzNOYLYPMkC6yglC0Kon UVZrqXsh8ltEIJiXe3oMDC4VvWd1lL68DQ2Jeb4hW6mPBr9SRuKP X-Google-Smtp-Source: AGHT+IFcPqgYrGZI9GZ47JpULxLN3L/F/sHM2E8m7VjxRNFeYrHwyBz83/Oy9JZvqVrwfoiee4fkzw== X-Received: by 2002:a05:6820:d88:b0:5ba:ead2:c742 with SMTP id 006d021491bc7-5bb3b7a3d2bmr3670796eaf.0.1718247784338; Wed, 12 Jun 2024 20:03:04 -0700 (PDT) Received: from sean-ThinkPad-T450s.lan ([207.191.35.252]) by smtp.gmail.com with ESMTPSA id 006d021491bc7-5bd629263c5sm67685eaf.46.2024.06.12.20.03.02 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Wed, 12 Jun 2024 20:03:03 -0700 (PDT) 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 08/47] wifi: mt76: mt7925: extend mt7925_mcu_set_timing for per-link BSS Date: Wed, 12 Jun 2024 20:02:02 -0700 Message-Id: <20240613030241.5771-9-sean.wang@kernel.org> X-Mailer: git-send-email 2.25.1 In-Reply-To: <20240613030241.5771-1-sean.wang@kernel.org> References: <20240613030241.5771-1-sean.wang@kernel.org> MIME-Version: 1.0 X-CRM114-Version: 20100106-BlameMichelson ( TRE 0.8.0 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20240612_200305_741379_1099B2ED X-CRM114-Status: GOOD ( 13.80 ) X-BeenThere: linux-mediatek@lists.infradead.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Sender: "Linux-mediatek" Errors-To: linux-mediatek-bounces+linux-mediatek=archiver.kernel.org@lists.infradead.org From: Sean Wang Extend mt7925_mcu_set_timing with 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: Deren Wu Signed-off-by: Deren Wu Signed-off-by: Sean Wang --- drivers/net/wireless/mediatek/mt76/mt7925/main.c | 2 +- drivers/net/wireless/mediatek/mt76/mt7925/mcu.c | 6 +++--- drivers/net/wireless/mediatek/mt76/mt7925/mcu.h | 2 +- 3 files changed, 5 insertions(+), 5 deletions(-) diff --git a/drivers/net/wireless/mediatek/mt76/mt7925/main.c b/drivers/net/wireless/mediatek/mt76/mt7925/main.c index 7b9deb586b34..6a1afff92399 100644 --- a/drivers/net/wireless/mediatek/mt76/mt7925/main.c +++ b/drivers/net/wireless/mediatek/mt76/mt7925/main.c @@ -1400,7 +1400,7 @@ static void mt7925_link_info_changed(struct ieee80211_hw *hw, if (slottime != phy->slottime) { phy->slottime = slottime; - mt7925_mcu_set_timing(phy, vif); + mt7925_mcu_set_timing(phy, info); } } diff --git a/drivers/net/wireless/mediatek/mt76/mt7925/mcu.c b/drivers/net/wireless/mediatek/mt76/mt7925/mcu.c index fb261ee525be..b82cc1bd09b6 100644 --- a/drivers/net/wireless/mediatek/mt76/mt7925/mcu.c +++ b/drivers/net/wireless/mediatek/mt76/mt7925/mcu.c @@ -2296,9 +2296,9 @@ mt7925_mcu_bss_ifs_tlv(struct sk_buff *skb, struct ieee80211_vif *vif) } int mt7925_mcu_set_timing(struct mt792x_phy *phy, - struct ieee80211_vif *vif) + struct ieee80211_bss_conf *link_conf) { - struct mt792x_vif *mvif = (struct mt792x_vif *)vif->drv_priv; + struct mt792x_vif *mvif = (struct mt792x_vif *)link_conf->vif->drv_priv; struct mt792x_dev *dev = phy->dev; struct sk_buff *skb; @@ -2307,7 +2307,7 @@ int mt7925_mcu_set_timing(struct mt792x_phy *phy, if (IS_ERR(skb)) return PTR_ERR(skb); - mt7925_mcu_bss_ifs_tlv(skb, vif); + mt7925_mcu_bss_ifs_tlv(skb, link_conf->vif); return mt76_mcu_skb_send_msg(&dev->mt76, skb, MCU_UNI_CMD(BSS_INFO_UPDATE), true); diff --git a/drivers/net/wireless/mediatek/mt76/mt7925/mcu.h b/drivers/net/wireless/mediatek/mt76/mt7925/mcu.h index c692996e057c..d3584743c266 100644 --- a/drivers/net/wireless/mediatek/mt76/mt7925/mcu.h +++ b/drivers/net/wireless/mediatek/mt76/mt7925/mcu.h @@ -582,7 +582,7 @@ int mt7925_mcu_add_bss_info(struct mt792x_phy *phy, struct ieee80211_sta *sta, int enable); int mt7925_mcu_set_timing(struct mt792x_phy *phy, - struct ieee80211_vif *vif); + struct ieee80211_bss_conf *link_conf); int mt7925_mcu_set_deep_sleep(struct mt792x_dev *dev, bool enable); int mt7925_mcu_set_channel_domain(struct mt76_phy *phy); int mt7925_mcu_set_radio_en(struct mt792x_phy *phy, bool enable); From patchwork Thu Jun 13 03:02:03 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Sean Wang X-Patchwork-Id: 13696042 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from bombadil.infradead.org (bombadil.infradead.org [198.137.202.133]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.lore.kernel.org (Postfix) with ESMTPS id E3A1FC27C77 for ; Thu, 13 Jun 2024 03:03:14 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=lists.infradead.org; s=bombadil.20210309; h=Sender:List-Subscribe:List-Help :List-Post:List-Archive:List-Unsubscribe:List-Id:Content-Transfer-Encoding: MIME-Version:References:In-Reply-To:Message-Id:Date:Subject:Cc:To:From: Reply-To:Content-Type:Content-ID:Content-Description:Resent-Date:Resent-From: Resent-Sender:Resent-To:Resent-Cc:Resent-Message-ID:List-Owner; bh=6rafBksQtkYVoC/BWTavX7eiqg0TRwXU04Jibtu1TkE=; b=hgnp8nhegi7j0htxplJU5SV+eI VgA/OfP2NXM3hZ+Ll8NzvqIz30YK2Q8lbe4szPP6WBSxhUBR1OQNoN891XjhaQTqrK4i6jAZx2AMw 9Kyj4zFYIJ7hRl3spPzg9PAghHOnKW9U5dLX+jGhD7y48p2nvSiUsX8SHzUqIQ5nt1fWUwF3WCN36 PX5//2bBqjxXkjYPYmuh+RtmWaI5L4KhFAbkQ35PkbmICmm+BNugPMwYO7mqQTqB4BizQe73GcsPS Qo89w2VvAnW2OZoxI9w6atFeyWPOlH2OsAIbNMzkftWVi/c7wgEJIUB2zRQyf+j1fqt6s/GVQ18mv 9Kt+mgyw==; Received: from localhost ([::1] helo=bombadil.infradead.org) by bombadil.infradead.org with esmtp (Exim 4.97.1 #2 (Red Hat Linux)) id 1sHak6-0000000Evfv-2XDe; Thu, 13 Jun 2024 03:03:14 +0000 Received: from mail-oo1-f51.google.com ([209.85.161.51]) by bombadil.infradead.org with esmtps (Exim 4.97.1 #2 (Red Hat Linux)) id 1sHajz-0000000EvbN-2IdP for linux-mediatek@lists.infradead.org; Thu, 13 Jun 2024 03:03:12 +0000 Received: by mail-oo1-f51.google.com with SMTP id 006d021491bc7-5b3356fd4f3so38456eaf.1 for ; Wed, 12 Jun 2024 20:03:07 -0700 (PDT) X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1718247786; x=1718852586; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:x-gm-message-state:from:to:cc :subject:date:message-id:reply-to; bh=6rafBksQtkYVoC/BWTavX7eiqg0TRwXU04Jibtu1TkE=; b=ElzeoRIcdW3oK6ScDLDLbsD+WuCd3Vg2A8kVVs4fHglVRXXrBUOWf0ttPwO8UiC3Ye JXuwnuB7B2P6RMNKOq5bQ2tgZuOzJEF34Is+IXjfTvGHaplpR/Pi9X/yT1hPVES/0icx lUbGrzBBlHiP59SHYWCjWxvfnF1rgeBEAHsDxafaKctKQdSGlEkXfFnP5F4mAVx+2oeX DMsvSLx0QEgUv/Wt1WCXYUoQp2NXQ/Johjg0Nu/oLD5hOJEdHUTmycfCirJBZASd21Ax mj9myNJkvzLbSkzSsa6ptgRhB8bTQnWrtmQr4oD2RmG7e4EI0ccF3L2CjtqXX/loSvOe zhRg== X-Forwarded-Encrypted: i=1; AJvYcCUO0GGSlBJwIFjt4fHRr9liRjfVsB+9CD1JgwKzwpfTTr0FA2hYhIUZMf25zOtuWv1mUVc/U/KgWtY++GP38w==@lists.infradead.org X-Gm-Message-State: AOJu0YwDmPIkSgF+hWZy+PqCtqYA4rcNaMZFPTnfrVNqURBlO1jzvD1G dO/nHshxyvy4f73avuw421gr4sc+jvbC/bYhtyB34qvaqRIM6F69 X-Google-Smtp-Source: AGHT+IGwwyNIftQ14L3NdNPlplOU/t7cE5px2Mk4ncDXYt5dNmPrtoCQqI/UUXuRnSHlTazF+mKdpg== X-Received: by 2002:a4a:d196:0:b0:5bd:87a0:66d with SMTP id 006d021491bc7-5bd87a01b93mr285145eaf.1.1718247786634; Wed, 12 Jun 2024 20:03:06 -0700 (PDT) Received: from sean-ThinkPad-T450s.lan ([207.191.35.252]) by smtp.gmail.com with ESMTPSA id 006d021491bc7-5bd629263c5sm67685eaf.46.2024.06.12.20.03.04 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Wed, 12 Jun 2024 20:03:04 -0700 (PDT) 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 09/47] wifi: mt76: mt7925: extend mt7925_mcu_bss_ifs_tlv for per-link BSS Date: Wed, 12 Jun 2024 20:02:03 -0700 Message-Id: <20240613030241.5771-10-sean.wang@kernel.org> X-Mailer: git-send-email 2.25.1 In-Reply-To: <20240613030241.5771-1-sean.wang@kernel.org> References: <20240613030241.5771-1-sean.wang@kernel.org> MIME-Version: 1.0 X-CRM114-Version: 20100106-BlameMichelson ( TRE 0.8.0 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20240612_200308_036065_2F251841 X-CRM114-Status: GOOD ( 11.08 ) X-BeenThere: linux-mediatek@lists.infradead.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Sender: "Linux-mediatek" Errors-To: linux-mediatek-bounces+linux-mediatek=archiver.kernel.org@lists.infradead.org From: Sean Wang Extend mt7925_mcu_bss_ifs_tlv with 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: Deren Wu Signed-off-by: Deren Wu Signed-off-by: Sean Wang --- drivers/net/wireless/mediatek/mt76/mt7925/mcu.c | 9 +++++---- 1 file changed, 5 insertions(+), 4 deletions(-) diff --git a/drivers/net/wireless/mediatek/mt76/mt7925/mcu.c b/drivers/net/wireless/mediatek/mt76/mt7925/mcu.c index b82cc1bd09b6..7cde18e273d8 100644 --- a/drivers/net/wireless/mediatek/mt76/mt7925/mcu.c +++ b/drivers/net/wireless/mediatek/mt76/mt7925/mcu.c @@ -2282,9 +2282,10 @@ mt7925_mcu_bss_color_tlv(struct sk_buff *skb, struct ieee80211_vif *vif, } static void -mt7925_mcu_bss_ifs_tlv(struct sk_buff *skb, struct ieee80211_vif *vif) +mt7925_mcu_bss_ifs_tlv(struct sk_buff *skb, + struct ieee80211_bss_conf *link_conf) { - struct mt792x_vif *mvif = (struct mt792x_vif *)vif->drv_priv; + struct mt792x_vif *mvif = (struct mt792x_vif *)link_conf->vif->drv_priv; struct mt792x_phy *phy = mvif->phy; struct bss_ifs_time_tlv *ifs_time; struct tlv *tlv; @@ -2307,7 +2308,7 @@ int mt7925_mcu_set_timing(struct mt792x_phy *phy, if (IS_ERR(skb)) return PTR_ERR(skb); - mt7925_mcu_bss_ifs_tlv(skb, link_conf->vif); + mt7925_mcu_bss_ifs_tlv(skb, link_conf); return mt76_mcu_skb_send_msg(&dev->mt76, skb, MCU_UNI_CMD(BSS_INFO_UPDATE), true); @@ -2337,7 +2338,7 @@ int mt7925_mcu_add_bss_info(struct mt792x_phy *phy, mt7925_mcu_bss_bmc_tlv(skb, phy, ctx, link_conf->vif, sta); mt7925_mcu_bss_qos_tlv(skb, link_conf->vif); mt7925_mcu_bss_mld_tlv(skb, link_conf->vif, sta); - mt7925_mcu_bss_ifs_tlv(skb, link_conf->vif); + mt7925_mcu_bss_ifs_tlv(skb, link_conf); if (link_conf->he_support) { mt7925_mcu_bss_he_tlv(skb, link_conf->vif, phy); From patchwork Thu Jun 13 03:02:04 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Sean Wang X-Patchwork-Id: 13696043 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from bombadil.infradead.org (bombadil.infradead.org [198.137.202.133]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.lore.kernel.org (Postfix) with ESMTPS id 529B9C27C6E for ; Thu, 13 Jun 2024 03:03:15 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=lists.infradead.org; s=bombadil.20210309; h=Sender:List-Subscribe:List-Help :List-Post:List-Archive:List-Unsubscribe:List-Id:Content-Transfer-Encoding: MIME-Version:References:In-Reply-To:Message-Id:Date:Subject:Cc:To:From: Reply-To:Content-Type:Content-ID:Content-Description:Resent-Date:Resent-From: Resent-Sender:Resent-To:Resent-Cc:Resent-Message-ID:List-Owner; bh=G8wZ9LqPMT7Xzyb/TNy4z9TySRR4HAhftUt/beLfrpU=; b=p5cEsbo0zNBgqttvXJoU2vnw5G CELNNRMPfulRn/jIR/6g/4Vzq15SKQLO0MmqBv7/w5DZpiFpdHJPWLAUj/q3eeSjjtFgmPRsxoPig eCYh5O/ujzLK0zrtQy3y81Onkgka5hMJp5ji9M9aMMimGQ5MjUFTG5IbrZ/jBhgK8ytIg4sS9j6gU 9wU0uhigDO4nmw6oZkWMedANMMrs2kTxKzE6AcBJNnFe7N/uF4c4wDSiy7IitvFaYZtY9bFY4Uzsf 7YN2F7tNM/FcWpXx3p7xi3yakqYjDChjo4gGMcTGaMzo4jVgTPok7CnYix/ZOPc7kHaCtU3A2K6lG lKmDnc9A==; Received: from localhost ([::1] helo=bombadil.infradead.org) by bombadil.infradead.org with esmtp (Exim 4.97.1 #2 (Red Hat Linux)) id 1sHak6-0000000EvgE-459g; Thu, 13 Jun 2024 03:03:14 +0000 Received: from mail-oo1-f53.google.com ([209.85.161.53]) by bombadil.infradead.org with esmtps (Exim 4.97.1 #2 (Red Hat Linux)) id 1sHak2-0000000EvcZ-105H for linux-mediatek@lists.infradead.org; Thu, 13 Jun 2024 03:03:13 +0000 Received: by mail-oo1-f53.google.com with SMTP id 006d021491bc7-5b3356fd4f3so38459eaf.1 for ; Wed, 12 Jun 2024 20:03:09 -0700 (PDT) X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1718247789; x=1718852589; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:x-gm-message-state:from:to:cc :subject:date:message-id:reply-to; bh=G8wZ9LqPMT7Xzyb/TNy4z9TySRR4HAhftUt/beLfrpU=; b=qJ/DFSQX1/jGVkve6RDu3NJKdrrsoYjxW4ykjpbiYcaoPExMiQjTLbv+epYkDkWLIt +Ce2EFYL0DNW4VxPwlNJ632IhtP6jDtKphFEujqQapDv2jeop8j8s2daM0s8pal/oHgp +r2/QNak+qyc94UmzqqmsK45jDvZdGDCLhnkJkyBQmdQo2yWcW+hkAiZ0RVLU0+blHfT BL9sMFuhJmT6Du8hV61qZduiSAEkTbDVLIbJuWhB75p490BH7DxrmDMIPvSfGLZjRHvh Co+xJVlYy7/U+HWtA99WawiKfvWO5Qz2yqw6Csfm4ZSNcuvn9oQrlE6dipWqLkLPP33c 1H7A== X-Forwarded-Encrypted: i=1; AJvYcCWZpbdPFZJEEqJLP6hoo13sD1d3AvJiwuKLJ7UOWRVaONtC/QTEQSt5bn+maHi2YuajdXlr2wc36FIpHeFFSHPfQbP9UP9srDJYWDtzjYZd2A35 X-Gm-Message-State: AOJu0YzyAhF2POgvBpsRd4uPyJbwEsG8CdoAqsLMLPt8MWBybOCen49P ++MC0Qc9umxVuPM4WNS8870cFSNTi5f0mo+ZhhOqKXUvsYB89g6A X-Google-Smtp-Source: AGHT+IHqadgzrZGoLgoJFK/NJvS0x3ikV8MhU9hCl6gI/OhLxrrMkqmc1SPmCVhc+zJdhP2h5XcNqw== X-Received: by 2002:a4a:d196:0:b0:5bd:87a0:66d with SMTP id 006d021491bc7-5bd87a01b93mr285198eaf.1.1718247788980; Wed, 12 Jun 2024 20:03:08 -0700 (PDT) Received: from sean-ThinkPad-T450s.lan ([207.191.35.252]) by smtp.gmail.com with ESMTPSA id 006d021491bc7-5bd629263c5sm67685eaf.46.2024.06.12.20.03.06 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Wed, 12 Jun 2024 20:03:07 -0700 (PDT) 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 10/47] wifi: mt76: mt7925: extend mt7925_mcu_bss_color_tlv for per-link BSS Date: Wed, 12 Jun 2024 20:02:04 -0700 Message-Id: <20240613030241.5771-11-sean.wang@kernel.org> X-Mailer: git-send-email 2.25.1 In-Reply-To: <20240613030241.5771-1-sean.wang@kernel.org> References: <20240613030241.5771-1-sean.wang@kernel.org> MIME-Version: 1.0 X-CRM114-Version: 20100106-BlameMichelson ( TRE 0.8.0 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20240612_200310_334058_3395118A X-CRM114-Status: GOOD ( 10.93 ) X-BeenThere: linux-mediatek@lists.infradead.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Sender: "Linux-mediatek" Errors-To: linux-mediatek-bounces+linux-mediatek=archiver.kernel.org@lists.infradead.org From: Sean Wang Extend mt7925_mcu_bss_color_tlv with 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: Deren Wu Signed-off-by: Deren Wu Signed-off-by: Sean Wang --- drivers/net/wireless/mediatek/mt76/mt7925/mcu.c | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/drivers/net/wireless/mediatek/mt76/mt7925/mcu.c b/drivers/net/wireless/mediatek/mt76/mt7925/mcu.c index 7cde18e273d8..10e38637eb83 100644 --- a/drivers/net/wireless/mediatek/mt76/mt7925/mcu.c +++ b/drivers/net/wireless/mediatek/mt76/mt7925/mcu.c @@ -2266,7 +2266,7 @@ mt7925_mcu_bss_he_tlv(struct sk_buff *skb, struct ieee80211_vif *vif, } static void -mt7925_mcu_bss_color_tlv(struct sk_buff *skb, struct ieee80211_vif *vif, +mt7925_mcu_bss_color_tlv(struct sk_buff *skb, struct ieee80211_bss_conf *link_conf, bool enable) { struct bss_info_uni_bss_color *color; @@ -2276,9 +2276,9 @@ mt7925_mcu_bss_color_tlv(struct sk_buff *skb, struct ieee80211_vif *vif, color = (struct bss_info_uni_bss_color *)tlv; color->enable = enable ? - vif->bss_conf.he_bss_color.enabled : 0; + link_conf->he_bss_color.enabled : 0; color->bss_color = enable ? - vif->bss_conf.he_bss_color.color : 0; + link_conf->he_bss_color.color : 0; } static void @@ -2342,7 +2342,7 @@ int mt7925_mcu_add_bss_info(struct mt792x_phy *phy, if (link_conf->he_support) { mt7925_mcu_bss_he_tlv(skb, link_conf->vif, phy); - mt7925_mcu_bss_color_tlv(skb, link_conf->vif, enable); + mt7925_mcu_bss_color_tlv(skb, link_conf, enable); } err = mt76_mcu_skb_send_msg(&dev->mt76, skb, From patchwork Thu Jun 13 03:02:05 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Sean Wang X-Patchwork-Id: 13696044 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from bombadil.infradead.org (bombadil.infradead.org [198.137.202.133]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.lore.kernel.org (Postfix) with ESMTPS id C354DC27C53 for ; Thu, 13 Jun 2024 03:03:15 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=lists.infradead.org; s=bombadil.20210309; h=Sender:List-Subscribe:List-Help :List-Post:List-Archive:List-Unsubscribe:List-Id:Content-Transfer-Encoding: MIME-Version:References:In-Reply-To:Message-Id:Date:Subject:Cc:To:From: Reply-To:Content-Type:Content-ID:Content-Description:Resent-Date:Resent-From: Resent-Sender:Resent-To:Resent-Cc:Resent-Message-ID:List-Owner; bh=pQHpQNEsytBYs2FLiCmUpTPqTQTP3NJD/MKbmAcXuJk=; b=uw+/BbxQ0pWdQa+0IphvTY0cZR qg0lopwuQ3FrcP0lKk5AmxV+TEHtEtVCgCDszLFFVpADebb4S/txvUXtx0gt46PJR4p2TANJFtGTw 6Tr+hA9fpAzklmpfa2bigXNUb4WW1hO8+OHUna0BFq9Nl+Rtd9dHiC4u842bhD746E+L8BdBGqCSw OQgzt0/mXwmy6X7178XZHm0FvoO+VlioXwyUwoIT2xnViwzyVh6ZB7hMzDsnxZeDxCVNMQvgcUSHq cA/mvreB7V+U71+yBsBql0s3z0BKbOwCJvSvHxA74KSgn5n23U/EZPlQ6rUipsZ59G6XFiz2cWsHI ylWmj8PA==; Received: from localhost ([::1] helo=bombadil.infradead.org) by bombadil.infradead.org with esmtp (Exim 4.97.1 #2 (Red Hat Linux)) id 1sHak7-0000000Evgj-1STE; Thu, 13 Jun 2024 03:03:15 +0000 Received: from mail-oo1-f42.google.com ([209.85.161.42]) by bombadil.infradead.org with esmtps (Exim 4.97.1 #2 (Red Hat Linux)) id 1sHak3-0000000Evdz-3UwI for linux-mediatek@lists.infradead.org; Thu, 13 Jun 2024 03:03:13 +0000 Received: by mail-oo1-f42.google.com with SMTP id 006d021491bc7-5bb33237b60so22131eaf.0 for ; Wed, 12 Jun 2024 20:03:11 -0700 (PDT) X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1718247791; x=1718852591; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:x-gm-message-state:from:to:cc :subject:date:message-id:reply-to; bh=pQHpQNEsytBYs2FLiCmUpTPqTQTP3NJD/MKbmAcXuJk=; b=qjU3GhzESsb9ww7/3ZT3mXCo+sMXYq/cH4YtgDz7reWT9iO+9YU2oSzRjKKPsv/sQh hWMWJgpqkMOiRZ0YNlB8o+dGdbEQDT9soy66fo6VPmiofivmwyCHdNfPtA6bWw1eoIUp RfPrJxkS4bvxiGFNKZKQ6K+szC6lQjVEx0IPm2ZNMklUjzq2QCC5291iA5FVW0fWZ+nQ Nn9F01d0KoXrO4wCdSSMZxON5iF4bmNLZPpMtzMkM/rYiohGVBG5H7OpLYP0hY0kvjG1 CCqy4mdbYdxnL5n3iDy2WhFWKnAu/jNSAqhFX6anSVGbOi55eW05i2WN/Cr0ysjuYQWa yaQA== X-Forwarded-Encrypted: i=1; AJvYcCUB0dKPzY21xSR/kwPBzMlyB5EfANRztdqCeeU1cdmdSlicSrQS/7sxQ0ccNPWi73aAgxKIYhddbPvHD61gzpbdgebX0jZ/yXu3XSahjqHspsax X-Gm-Message-State: AOJu0Yy0LgYTxbZJztU5a59RP9YZ4USL+/e40xHGI5W0ktXVF2iBfBGa Z30OOh/Y0c4m4/D9/KdaoshSXFfjroMg3Pbia6VH5xRO1U7tgEnc X-Google-Smtp-Source: AGHT+IHRYjNKPC2FOi2+KaQtr+N2oUkVlnnJ0LtIy99g1YcK7m+ehh3yibeBWAa97dm0X9RUmo3A4w== X-Received: by 2002:a4a:a5ca:0:b0:5ba:e11d:a2ae with SMTP id 006d021491bc7-5bb3b9f4ef7mr3671269eaf.1.1718247790954; Wed, 12 Jun 2024 20:03:10 -0700 (PDT) Received: from sean-ThinkPad-T450s.lan ([207.191.35.252]) by smtp.gmail.com with ESMTPSA id 006d021491bc7-5bd629263c5sm67685eaf.46.2024.06.12.20.03.09 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Wed, 12 Jun 2024 20:03:09 -0700 (PDT) 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 11/47] wifi: mt76: mt7925: extend mt7925_mcu_bss_he_tlv for per-link BSS Date: Wed, 12 Jun 2024 20:02:05 -0700 Message-Id: <20240613030241.5771-12-sean.wang@kernel.org> X-Mailer: git-send-email 2.25.1 In-Reply-To: <20240613030241.5771-1-sean.wang@kernel.org> References: <20240613030241.5771-1-sean.wang@kernel.org> MIME-Version: 1.0 X-CRM114-Version: 20100106-BlameMichelson ( TRE 0.8.0 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20240612_200311_905330_8873D664 X-CRM114-Status: GOOD ( 12.36 ) X-BeenThere: linux-mediatek@lists.infradead.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Sender: "Linux-mediatek" Errors-To: linux-mediatek-bounces+linux-mediatek=archiver.kernel.org@lists.infradead.org From: Sean Wang Extend mt7925_mcu_bss_he_tlv with 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: Deren Wu Signed-off-by: Deren Wu Signed-off-by: Sean Wang --- drivers/net/wireless/mediatek/mt76/mt7925/mcu.c | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-) diff --git a/drivers/net/wireless/mediatek/mt76/mt7925/mcu.c b/drivers/net/wireless/mediatek/mt76/mt7925/mcu.c index 10e38637eb83..533214403008 100644 --- a/drivers/net/wireless/mediatek/mt76/mt7925/mcu.c +++ b/drivers/net/wireless/mediatek/mt76/mt7925/mcu.c @@ -2238,7 +2238,7 @@ mt7925_mcu_bss_qos_tlv(struct sk_buff *skb, struct ieee80211_vif *vif) } static void -mt7925_mcu_bss_he_tlv(struct sk_buff *skb, struct ieee80211_vif *vif, +mt7925_mcu_bss_he_tlv(struct sk_buff *skb, struct ieee80211_bss_conf *link_conf, struct mt792x_phy *phy) { #define DEFAULT_HE_PE_DURATION 4 @@ -2247,16 +2247,16 @@ mt7925_mcu_bss_he_tlv(struct sk_buff *skb, struct ieee80211_vif *vif, struct bss_info_uni_he *he; struct tlv *tlv; - cap = mt76_connac_get_he_phy_cap(phy->mt76, vif); + cap = mt76_connac_get_he_phy_cap(phy->mt76, link_conf->vif); tlv = mt76_connac_mcu_add_tlv(skb, UNI_BSS_INFO_HE_BASIC, sizeof(*he)); he = (struct bss_info_uni_he *)tlv; - he->he_pe_duration = vif->bss_conf.htc_trig_based_pkt_ext; + he->he_pe_duration = link_conf->htc_trig_based_pkt_ext; if (!he->he_pe_duration) he->he_pe_duration = DEFAULT_HE_PE_DURATION; - he->he_rts_thres = cpu_to_le16(vif->bss_conf.frame_time_rts_th); + he->he_rts_thres = cpu_to_le16(link_conf->frame_time_rts_th); if (!he->he_rts_thres) he->he_rts_thres = cpu_to_le16(DEFAULT_HE_DURATION_RTS_THRES); @@ -2341,7 +2341,7 @@ int mt7925_mcu_add_bss_info(struct mt792x_phy *phy, mt7925_mcu_bss_ifs_tlv(skb, link_conf); if (link_conf->he_support) { - mt7925_mcu_bss_he_tlv(skb, link_conf->vif, phy); + mt7925_mcu_bss_he_tlv(skb, link_conf, phy); mt7925_mcu_bss_color_tlv(skb, link_conf, enable); } From patchwork Thu Jun 13 03:02:06 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Sean Wang X-Patchwork-Id: 13696045 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from bombadil.infradead.org (bombadil.infradead.org [198.137.202.133]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.lore.kernel.org (Postfix) with ESMTPS id EB2D3C27C53 for ; Thu, 13 Jun 2024 03:03:19 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=lists.infradead.org; s=bombadil.20210309; h=Sender:List-Subscribe:List-Help :List-Post:List-Archive:List-Unsubscribe:List-Id:Content-Transfer-Encoding: MIME-Version:References:In-Reply-To:Message-Id:Date:Subject:Cc:To:From: Reply-To:Content-Type:Content-ID:Content-Description:Resent-Date:Resent-From: Resent-Sender:Resent-To:Resent-Cc:Resent-Message-ID:List-Owner; bh=YdCy5+kMixwBbPegp0qJ0hHaXxWnfbk8yzhAroU2gIE=; b=TgFDQFRhKmRZBoz3GNlrV/BftF gpcefdaNBo5h5MK0+dAnBnni6aX+zwkRjR40BHmzSTqqIo6/Og2Bx6RCk7qAXVqoOLb6O9miLm2Bc pBV0L28fLIjPssuJSxWbKkHQh6lzZ/LQfxP+BeCFE5TsqVkSUdEP2aZqXOj6wgCITe4OIxE0HzKWJ S2m7Da9746hnz4s7/SQdsmddst2AGM2vhW9+Rw8VqJWKNgTlke5nE1gSmrbdHpgdpJnEFh45K39fD hBePgV9YoFoougxm0WOLwc6eMscj5+sAYBtjbGa9CGjWvn9ml5ovNkHDkB3TkUEa0T+ONmLH/vArO cIF9jqXw==; Received: from localhost ([::1] helo=bombadil.infradead.org) by bombadil.infradead.org with esmtp (Exim 4.97.1 #2 (Red Hat Linux)) id 1sHakB-0000000Eviu-2ShO; Thu, 13 Jun 2024 03:03:19 +0000 Received: from mail-oo1-f47.google.com ([209.85.161.47]) by bombadil.infradead.org with esmtps (Exim 4.97.1 #2 (Red Hat Linux)) id 1sHak6-0000000Evf2-00pM for linux-mediatek@lists.infradead.org; Thu, 13 Jun 2024 03:03:16 +0000 Received: by mail-oo1-f47.google.com with SMTP id 006d021491bc7-5bad4e45863so24359eaf.3 for ; Wed, 12 Jun 2024 20:03:13 -0700 (PDT) X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1718247793; x=1718852593; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:x-gm-message-state:from:to:cc :subject:date:message-id:reply-to; bh=YdCy5+kMixwBbPegp0qJ0hHaXxWnfbk8yzhAroU2gIE=; b=VPqJLpSJ89xEY1uf1EdBRq6tTshhmqBTqGgSyW0Q4I/eMKrKGqqs4pD4uPfbYQEzz4 Ve717do50H983BNKJHBS5AldaoBc0Qu0JCpDZnmhD0t/AQd+A7uA+QDmbdxrrx4yiXB5 ogDhr0J4j3b/CVq4XZDrsHUbPaeP3csW39rGqP8Z+ywfkNyNYv+eKEZUV8qFRjFLMaf0 xfQ1V6QmasOyjkVWKRwK7np9Lftpkg3pGtvEuUeAjYNgFbYj11KUEdKx7jkycGsqDZY9 tJCnqBjX04ntBgdOWSu1Ip1GkXVo1Jdk2lUzccIhL6Y5fvTzI+8wlwxGkwUPNp+wPhXb 1GwQ== X-Forwarded-Encrypted: i=1; AJvYcCUYqNpmBGbghaP6FT0V4mFDQwepDCLjXKnYLiH+gqTsNQ+M8rcbRO7Sf62VqCUYqLWn7SYBjrSyhHPyxXNDhA==@lists.infradead.org X-Gm-Message-State: AOJu0YyTi4BioOAg76QqRgmQsIZ6SzpM1VdTHj394Dh5HwFv+Y8s/6me kzX9H/KFtkDxcu0wKYNglPzjx4q4Iql+ZfFoJrlgwtsXJiQzWmwA82d+Q2+nq6E= X-Google-Smtp-Source: AGHT+IGU09NrhHqyYkv/BhQS695UYCYhdc72/gkJHzuGqM75JEta2qBWPeccLaUVq7xGy2O10RRDWA== X-Received: by 2002:a05:6820:2c86:b0:5aa:3e4f:f01e with SMTP id 006d021491bc7-5bb3b9c614cmr3867976eaf.1.1718247792708; Wed, 12 Jun 2024 20:03:12 -0700 (PDT) Received: from sean-ThinkPad-T450s.lan ([207.191.35.252]) by smtp.gmail.com with ESMTPSA id 006d021491bc7-5bd629263c5sm67685eaf.46.2024.06.12.20.03.11 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Wed, 12 Jun 2024 20:03:11 -0700 (PDT) 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 12/47] wifi: mt76: mt7925: extend mt7925_mcu_bss_qos_tlv for per-link BSS Date: Wed, 12 Jun 2024 20:02:06 -0700 Message-Id: <20240613030241.5771-13-sean.wang@kernel.org> X-Mailer: git-send-email 2.25.1 In-Reply-To: <20240613030241.5771-1-sean.wang@kernel.org> References: <20240613030241.5771-1-sean.wang@kernel.org> MIME-Version: 1.0 X-CRM114-Version: 20100106-BlameMichelson ( TRE 0.8.0 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20240612_200314_153232_6EA703BD X-CRM114-Status: GOOD ( 11.73 ) X-BeenThere: linux-mediatek@lists.infradead.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Sender: "Linux-mediatek" Errors-To: linux-mediatek-bounces+linux-mediatek=archiver.kernel.org@lists.infradead.org From: Sean Wang Extend mt7925_mcu_bss_qos_tlv with 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: Deren Wu Signed-off-by: Deren Wu Signed-off-by: Sean Wang --- drivers/net/wireless/mediatek/mt76/mt7925/mcu.c | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/drivers/net/wireless/mediatek/mt76/mt7925/mcu.c b/drivers/net/wireless/mediatek/mt76/mt7925/mcu.c index 533214403008..d6a590061e36 100644 --- a/drivers/net/wireless/mediatek/mt76/mt7925/mcu.c +++ b/drivers/net/wireless/mediatek/mt76/mt7925/mcu.c @@ -2227,14 +2227,14 @@ mt7925_mcu_bss_mld_tlv(struct sk_buff *skb, } static void -mt7925_mcu_bss_qos_tlv(struct sk_buff *skb, struct ieee80211_vif *vif) +mt7925_mcu_bss_qos_tlv(struct sk_buff *skb, struct ieee80211_bss_conf *link_conf) { struct mt76_connac_bss_qos_tlv *qos; struct tlv *tlv; tlv = mt76_connac_mcu_add_tlv(skb, UNI_BSS_INFO_QBSS, sizeof(*qos)); qos = (struct mt76_connac_bss_qos_tlv *)tlv; - qos->qos = vif->bss_conf.qos; + qos->qos = link_conf->qos; } static void @@ -2336,7 +2336,7 @@ int mt7925_mcu_add_bss_info(struct mt792x_phy *phy, mt7925_mcu_bss_sec_tlv(skb, link_conf->vif); mt7925_mcu_bss_bmc_tlv(skb, phy, ctx, link_conf->vif, sta); - mt7925_mcu_bss_qos_tlv(skb, link_conf->vif); + mt7925_mcu_bss_qos_tlv(skb, link_conf); mt7925_mcu_bss_mld_tlv(skb, link_conf->vif, sta); mt7925_mcu_bss_ifs_tlv(skb, link_conf); From patchwork Thu Jun 13 03:02:07 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Sean Wang X-Patchwork-Id: 13696046 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from bombadil.infradead.org (bombadil.infradead.org [198.137.202.133]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.lore.kernel.org (Postfix) with ESMTPS id 7EF45C27C6E for ; Thu, 13 Jun 2024 03:03:21 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=lists.infradead.org; s=bombadil.20210309; h=Sender:List-Subscribe:List-Help :List-Post:List-Archive:List-Unsubscribe:List-Id:Content-Transfer-Encoding: MIME-Version:References:In-Reply-To:Message-Id:Date:Subject:Cc:To:From: Reply-To:Content-Type:Content-ID:Content-Description:Resent-Date:Resent-From: Resent-Sender:Resent-To:Resent-Cc:Resent-Message-ID:List-Owner; bh=FKy4Q0CaWzGta6AQsmEkVzO4cC46jn6FmQGCDe6kxjc=; b=o0VxKd1W+oMSA3PV5jNTxrR9nr zcY3522yxe+c/7j5IcFUhrsck6wssA2M7yDlZ8s43eYfYmx3Ss8fx7cdk02ZFyBtKsA+EY1hWm/GF R29IztbJp+z+0ZCfrUOoxj6yZYqiwFMnhpxvLlw89kAF7iOE04V3rX6XqnN1gPv2M09oNzyQcCxrG yej1avJnVt3OL6a/yQ7DNYxyuk8px4ofBl7/0b3LZR//caDhdSQP0TQTe4z8YSIGPAHLJU1FL7uDz RxYyWo553V0Rh8oae9WqyH0GVajxlRIvllzXK8mTNuuLOr/Y4oy6dS1bHu7w3BW8HyaZHtnotrlwS MKZ24WFw==; Received: from localhost ([::1] helo=bombadil.infradead.org) by bombadil.infradead.org with esmtp (Exim 4.97.1 #2 (Red Hat Linux)) id 1sHakD-0000000Evjf-0d5T; Thu, 13 Jun 2024 03:03:21 +0000 Received: from mail-oa1-f51.google.com ([209.85.160.51]) by bombadil.infradead.org with esmtps (Exim 4.97.1 #2 (Red Hat Linux)) id 1sHak8-0000000Evgu-1RoB for linux-mediatek@lists.infradead.org; Thu, 13 Jun 2024 03:03:19 +0000 Received: by mail-oa1-f51.google.com with SMTP id 586e51a60fabf-254976d3327so77652fac.1 for ; Wed, 12 Jun 2024 20:03:15 -0700 (PDT) X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1718247795; x=1718852595; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:x-gm-message-state:from:to:cc :subject:date:message-id:reply-to; bh=FKy4Q0CaWzGta6AQsmEkVzO4cC46jn6FmQGCDe6kxjc=; b=juQq4PqFkXC8WV6ZvGXzFRKHofumLocUdp0ayqMSzZkpKAOFeO1qme9Coe1/9pkkRH M69ohbq66pzBvfhyWEeh06MvbNsKpx5Lw14Efs214Ha7b4oJyRXIzlAdw+QSS2fMStYc O8WvEDIgLEepyX+4gjJccVPaqCsFXMtJ2yu3l0Ky6U0kM0P404beBK7Dq3do4jt+bFHD Z0AT8UlDwnPDc0kFdBpjTPV3jeqbWeEJ6X48yY4U9f9BXN4HmFSe+cPL3/QIpZRA5+Op C5RdCmBQoe5Pp39N9X69JvEKenZQEitgcUllqJhRWKpuGCBfZvFHNRpF6uIVCbVPFfBz JHVQ== X-Forwarded-Encrypted: i=1; AJvYcCVP6AouhissNZVL/D5QyEepsnA7W7PbdilTa0nl4mJtmPhKC5qXX7HT5fzPyXvYI78w15u2/P7EPuaH1lo3sH3w1xSccCX+r018uATWdzVbZha7 X-Gm-Message-State: AOJu0YxPj90WliZd1uteSR0P5FII3HWDbI2CloiOyZN4z9JuJloWA48O gEIZIsodTEQyPlJlJ5EofkCB0fknQVTevmJ1peekD3XcCCpP+OU1 X-Google-Smtp-Source: AGHT+IEXh4X1g1pv0SmYU/zclu0zjOlYL845YMFZJX7tNiyr8Vn0dBv54YcBpoycu/jPsHItinsd2w== X-Received: by 2002:a4a:d196:0:b0:5bd:87a0:66d with SMTP id 006d021491bc7-5bd87a01b93mr285392eaf.1.1718247795013; Wed, 12 Jun 2024 20:03:15 -0700 (PDT) Received: from sean-ThinkPad-T450s.lan ([207.191.35.252]) by smtp.gmail.com with ESMTPSA id 006d021491bc7-5bd629263c5sm67685eaf.46.2024.06.12.20.03.12 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Wed, 12 Jun 2024 20:03:13 -0700 (PDT) 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 13/47] wifi: mt76: mt7925: extend mt7925_mcu_bss_mld_tlv for per-link BSS Date: Wed, 12 Jun 2024 20:02:07 -0700 Message-Id: <20240613030241.5771-14-sean.wang@kernel.org> X-Mailer: git-send-email 2.25.1 In-Reply-To: <20240613030241.5771-1-sean.wang@kernel.org> References: <20240613030241.5771-1-sean.wang@kernel.org> MIME-Version: 1.0 X-CRM114-Version: 20100106-BlameMichelson ( TRE 0.8.0 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20240612_200316_566327_4B75D358 X-CRM114-Status: GOOD ( 11.78 ) X-BeenThere: linux-mediatek@lists.infradead.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Sender: "Linux-mediatek" Errors-To: linux-mediatek-bounces+linux-mediatek=archiver.kernel.org@lists.infradead.org From: Sean Wang Extend mt7925_mcu_bss_mld_tlv with 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: Deren Wu Signed-off-by: Deren Wu Signed-off-by: Sean Wang --- drivers/net/wireless/mediatek/mt76/mt7925/mcu.c | 14 +++++++------- 1 file changed, 7 insertions(+), 7 deletions(-) diff --git a/drivers/net/wireless/mediatek/mt76/mt7925/mcu.c b/drivers/net/wireless/mediatek/mt76/mt7925/mcu.c index d6a590061e36..93ce018a0801 100644 --- a/drivers/net/wireless/mediatek/mt76/mt7925/mcu.c +++ b/drivers/net/wireless/mediatek/mt76/mt7925/mcu.c @@ -2206,20 +2206,20 @@ mt7925_mcu_bss_bmc_tlv(struct sk_buff *skb, struct mt792x_phy *phy, static void mt7925_mcu_bss_mld_tlv(struct sk_buff *skb, - struct ieee80211_vif *vif, + struct ieee80211_bss_conf *link_conf, struct ieee80211_sta *sta) { - struct mt792x_vif *mvif = (struct mt792x_vif *)vif->drv_priv; - bool is_mld = ieee80211_vif_is_mld(vif); + struct mt792x_bss_conf *mconf = mt792x_link_conf_to_mconf(link_conf); + bool is_mld = ieee80211_vif_is_mld(link_conf->vif); struct bss_mld_tlv *mld; struct tlv *tlv; tlv = mt76_connac_mcu_add_tlv(skb, UNI_BSS_INFO_MLD, sizeof(*mld)); mld = (struct bss_mld_tlv *)tlv; - mld->link_id = sta ? (is_mld ? vif->bss_conf.link_id : 0) : 0xff; - mld->group_mld_id = is_mld ? mvif->bss_conf.mt76.idx : 0xff; - mld->own_mld_id = mvif->bss_conf.mt76.idx + 32; + mld->link_id = sta ? (is_mld ? link_conf->link_id : 0) : 0xff; + mld->group_mld_id = is_mld ? mconf->mt76.idx : 0xff; + mld->own_mld_id = mconf->mt76.idx + 32; mld->remap_idx = 0xff; if (sta) @@ -2337,7 +2337,7 @@ int mt7925_mcu_add_bss_info(struct mt792x_phy *phy, mt7925_mcu_bss_bmc_tlv(skb, phy, ctx, link_conf->vif, sta); mt7925_mcu_bss_qos_tlv(skb, link_conf); - mt7925_mcu_bss_mld_tlv(skb, link_conf->vif, sta); + mt7925_mcu_bss_mld_tlv(skb, link_conf, sta); mt7925_mcu_bss_ifs_tlv(skb, link_conf); if (link_conf->he_support) { From patchwork Thu Jun 13 03:02:08 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Sean Wang X-Patchwork-Id: 13696047 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from bombadil.infradead.org (bombadil.infradead.org [198.137.202.133]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.lore.kernel.org (Postfix) with ESMTPS id 1CAC2C27C53 for ; Thu, 13 Jun 2024 03:03:25 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=lists.infradead.org; s=bombadil.20210309; h=Sender:List-Subscribe:List-Help :List-Post:List-Archive:List-Unsubscribe:List-Id:Content-Transfer-Encoding: MIME-Version:References:In-Reply-To:Message-Id:Date:Subject:Cc:To:From: Reply-To:Content-Type:Content-ID:Content-Description:Resent-Date:Resent-From: Resent-Sender:Resent-To:Resent-Cc:Resent-Message-ID:List-Owner; bh=o7fyLN2eTcT5yVDs+Za/KLYWdVcVwhKyVQJ642fwgMc=; b=Cr6GP6APtKjYopfU37IN5Wn7ti w5Lzio6qeVWVwp9QlgxJzsats1JtQdv817BsQkFQ1bmdZnh8TUbVf7BJwzGwDpS3+izcN6+aLqfH/ rwttlUy+jjofbd4F2JlN5KWigRi0Dek/UiJHEwBJjVkLOo/7eBYUORoqGUgksrYUxLF06Nm9Pg+17 Anu05KsYYhLQ8IM45W6LOiAwDvDQRr+cpQ1f87Kb1eWBX+i4APb0qmZe9nzbR41dS8B8ogmtqdVqq CkEsPltBOn/uNSC9BuJaeCw6MuwiQGWNuWYJ2ZWSQ+0wd9bABTnInkoLNdcgN62FVDJekwCUeqpb6 prCsy9TQ==; Received: from localhost ([::1] helo=bombadil.infradead.org) by bombadil.infradead.org with esmtp (Exim 4.97.1 #2 (Red Hat Linux)) id 1sHakG-0000000Evlx-2tXL; Thu, 13 Jun 2024 03:03:24 +0000 Received: from mail-oo1-f54.google.com ([209.85.161.54]) by bombadil.infradead.org with esmtps (Exim 4.97.1 #2 (Red Hat Linux)) id 1sHakD-0000000EviN-1LZI for linux-mediatek@lists.infradead.org; Thu, 13 Jun 2024 03:03:23 +0000 Received: by mail-oo1-f54.google.com with SMTP id 006d021491bc7-5b3356fd4f3so38460eaf.1 for ; Wed, 12 Jun 2024 20:03:18 -0700 (PDT) X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1718247798; x=1718852598; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:x-gm-message-state:from:to:cc :subject:date:message-id:reply-to; bh=o7fyLN2eTcT5yVDs+Za/KLYWdVcVwhKyVQJ642fwgMc=; b=K+e81YwCxOl5SQxl6+heEUSUGQWkoGq/HEQnrNjUfZkZ5b2dLTWcekOFjUceXm+Drv 92q46bZetr3GNi6x38Tw1JhZSn7mZxr4Fs3P3y5tCk4LhWMs7zROi85hqSL4WsjDuHjW HRRMPFauNb95UqPRvM/7iGFgXzD6Cfz47ic6TEDWT8xk7jZ61Ysf3gUNUfmi6xfz3MBx kHSNkK1SbA7KYSDFaf146AmRxuOUbMUMXVfEMl4wzNAUgpwIc8LFGiixhQ3nYC6eYUmE m7UbZybqCDRgknyjr6dU9UzAG0E+PRT0bVSJdA72vWuFyhT5d3cyee3tpRhRhtHmHYgt t5LA== X-Forwarded-Encrypted: i=1; AJvYcCUGV42pudhNhidM23kAzVrJhOKfuDMfJ7UWQ5VnX+byTfiVcrlrZ10jbwVde681SBMlLWLZd/F3IqrPK12MUra3IzXMlnkG/jM/Pd6gzMvNYJ8d X-Gm-Message-State: AOJu0Yz1XQVI/8QG5qkNh7FhJGYuKmS9d3ehwlKRe3WTuxtLrYGho8FU +yb3Hhtr31y0McPM+U7wb5bQLF0If0aUWsGv7eyidiTy/xoQB9X6 X-Google-Smtp-Source: AGHT+IF3tKvAO7O2wwRJgNy6xEVfg8yq+WFBOGurkxFmdxTHX8HN8CopPZp2U0FN7ExMmIvLd10M3Q== X-Received: by 2002:a4a:8552:0:b0:5ba:ca86:a025 with SMTP id 006d021491bc7-5bb3b7a9135mr3996007eaf.0.1718247797718; Wed, 12 Jun 2024 20:03:17 -0700 (PDT) Received: from sean-ThinkPad-T450s.lan ([207.191.35.252]) by smtp.gmail.com with ESMTPSA id 006d021491bc7-5bd629263c5sm67685eaf.46.2024.06.12.20.03.15 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Wed, 12 Jun 2024 20:03:15 -0700 (PDT) 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 14/47] wifi: mt76: mt7925: extend mt7925_mcu_bss_bmc_tlv for per-link BSS Date: Wed, 12 Jun 2024 20:02:08 -0700 Message-Id: <20240613030241.5771-15-sean.wang@kernel.org> X-Mailer: git-send-email 2.25.1 In-Reply-To: <20240613030241.5771-1-sean.wang@kernel.org> References: <20240613030241.5771-1-sean.wang@kernel.org> MIME-Version: 1.0 X-CRM114-Version: 20100106-BlameMichelson ( TRE 0.8.0 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20240612_200321_440756_8CC15A53 X-CRM114-Status: GOOD ( 11.29 ) X-BeenThere: linux-mediatek@lists.infradead.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Sender: "Linux-mediatek" Errors-To: linux-mediatek-bounces+linux-mediatek=archiver.kernel.org@lists.infradead.org From: Sean Wang Extend mt7925_mcu_bss_bmc_tlv with 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: Deren Wu Signed-off-by: Deren Wu Signed-off-by: Sean Wang --- drivers/net/wireless/mediatek/mt76/mt7925/mcu.c | 7 ++++--- 1 file changed, 4 insertions(+), 3 deletions(-) diff --git a/drivers/net/wireless/mediatek/mt76/mt7925/mcu.c b/drivers/net/wireless/mediatek/mt76/mt7925/mcu.c index 93ce018a0801..48b157f42db9 100644 --- a/drivers/net/wireless/mediatek/mt76/mt7925/mcu.c +++ b/drivers/net/wireless/mediatek/mt76/mt7925/mcu.c @@ -2179,12 +2179,13 @@ mt7925_mcu_bss_sec_tlv(struct sk_buff *skb, struct ieee80211_vif *vif) static void mt7925_mcu_bss_bmc_tlv(struct sk_buff *skb, struct mt792x_phy *phy, struct ieee80211_chanctx_conf *ctx, - struct ieee80211_vif *vif, + struct ieee80211_bss_conf *link_conf, struct ieee80211_sta *sta) { struct cfg80211_chan_def *chandef = ctx ? &ctx->def : &phy->mt76->chandef; - struct mt76_vif *mvif = (struct mt76_vif *)vif->drv_priv; + struct mt792x_bss_conf *mconf = mt792x_link_conf_to_mconf(link_conf); enum nl80211_band band = chandef->chan->band; + struct mt76_vif *mvif = &mconf->mt76; struct bss_rate_tlv *bmc; struct tlv *tlv; u8 idx = mvif->mcast_rates_idx ? @@ -2335,7 +2336,7 @@ int mt7925_mcu_add_bss_info(struct mt792x_phy *phy, mvif->sta.deflink.wcid.idx, enable); mt7925_mcu_bss_sec_tlv(skb, link_conf->vif); - mt7925_mcu_bss_bmc_tlv(skb, phy, ctx, link_conf->vif, sta); + mt7925_mcu_bss_bmc_tlv(skb, phy, ctx, link_conf, sta); mt7925_mcu_bss_qos_tlv(skb, link_conf); mt7925_mcu_bss_mld_tlv(skb, link_conf, sta); mt7925_mcu_bss_ifs_tlv(skb, link_conf); From patchwork Thu Jun 13 03:02:09 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Sean Wang X-Patchwork-Id: 13696048 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from bombadil.infradead.org (bombadil.infradead.org [198.137.202.133]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.lore.kernel.org (Postfix) with ESMTPS id C805FC27C53 for ; Thu, 13 Jun 2024 03:03:27 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=lists.infradead.org; s=bombadil.20210309; h=Sender:List-Subscribe:List-Help :List-Post:List-Archive:List-Unsubscribe:List-Id:Content-Transfer-Encoding: MIME-Version:References:In-Reply-To:Message-Id:Date:Subject:Cc:To:From: Reply-To:Content-Type:Content-ID:Content-Description:Resent-Date:Resent-From: Resent-Sender:Resent-To:Resent-Cc:Resent-Message-ID:List-Owner; bh=4OvuOb7g6PHWvVqmxVZoF3CYcis25XY+U2z4bDuSQW8=; b=R5jCUlfxC1mOOj2kLyPYs+oVtx Ai+FQjdQbh+d/0UoZNLAEXatDNG3vIytOoVtOTrP73xBSkVVcLBh0NmiCzzHwhJaVHP+Fx43rsMwi ldZs/oz1q1Vnp/OD2lAmdVPrSUHhtzvI/ev84fcM4x8ZFMoR+GAXVS2bfzq9I949RC8SR8B+AoHyv 3IjRZNKP4N6xhtbdOWyw+fRnJx36MLN7w8ybnKQRVUY8BVN2AR2DqRFq5oAsbtDpoLNGcExBPqr+e e3jL1d9yPWK3OlDTT3bdJR8msb6xdFGKTYU7iWR5RzPWqSMUUEeBlq1SlPXxSaxJ6RdOoOmJkdAbM gjYTjGqw==; Received: from localhost ([::1] helo=bombadil.infradead.org) by bombadil.infradead.org with esmtp (Exim 4.97.1 #2 (Red Hat Linux)) id 1sHakJ-0000000Evne-1Wer; Thu, 13 Jun 2024 03:03:27 +0000 Received: from mail-oa1-f45.google.com ([209.85.160.45]) by bombadil.infradead.org with esmtps (Exim 4.97.1 #2 (Red Hat Linux)) id 1sHakD-0000000EvjW-2V9Y for linux-mediatek@lists.infradead.org; Thu, 13 Jun 2024 03:03:24 +0000 Received: by mail-oa1-f45.google.com with SMTP id 586e51a60fabf-25075f3f472so76603fac.2 for ; Wed, 12 Jun 2024 20:03:20 -0700 (PDT) X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1718247800; x=1718852600; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:x-gm-message-state:from:to:cc :subject:date:message-id:reply-to; bh=4OvuOb7g6PHWvVqmxVZoF3CYcis25XY+U2z4bDuSQW8=; b=jbSBjMP4wRzCR4dXCbJCeylhlTdEFmtmU33Yurz+UI1I7I1K+P6JnHY2B6bNHy2938 +TifPNyecaCsO3M6ACyOE8YOrJUHa3D/ER5onCpN6tjoomTvMaETsPjnI14ZcqLV08IJ 2MZqXn26FWDud5VAD3SfLUPsWNwAm5Oqfq+VxN0JKRZofKqvzVBgFYmiP1HBm2fTvwEP JSQw0BtI/FZPTd7M3qPlP01kosUaEHNJn+gUeI9VHLOIDwjUcnRq+zg/yKDXrXkjhb7N 0OTMctQcT0lIqU+OwiV4hSexyTptuzrr1SkWeQ16FUa+ems12BL9yVNmEXPXsk9Gaxen IyIA== X-Forwarded-Encrypted: i=1; AJvYcCVmK8P7FtXRN/qibHPBC0hsrSv+cD6x2+1MLOZOevBJ4Ndw3YjZHi3h5nZdBBH23ID1kH34GCxUdn1l4oGUUA==@lists.infradead.org X-Gm-Message-State: AOJu0YwGDWWO8w6HwpylOfpWjoETIeslJdfccJedtjWZYELhO6/ObvJp oYuYlStGsfqmGHnQS/Mll2a2ONsaOx3+kj5vQkGk9rN47xNd/inbWxuuWvkjIpI= X-Google-Smtp-Source: AGHT+IHRrb4EIDm+nWVphSoixLDxx5BWiL1BA/EQfsBEJnVtg8ibFG8+4rJ23JbIbOgSAveW47ZePQ== X-Received: by 2002:a05:6820:b0b:b0:5ba:c4ed:ee98 with SMTP id 006d021491bc7-5bb3b7a4c51mr3589617eaf.0.1718247800095; Wed, 12 Jun 2024 20:03:20 -0700 (PDT) Received: from sean-ThinkPad-T450s.lan ([207.191.35.252]) by smtp.gmail.com with ESMTPSA id 006d021491bc7-5bd629263c5sm67685eaf.46.2024.06.12.20.03.17 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Wed, 12 Jun 2024 20:03:18 -0700 (PDT) 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 15/47] wifi: mt76: mt7925: remove unused parameters in mt7925_mcu_bss_bmc_tlv Date: Wed, 12 Jun 2024 20:02:09 -0700 Message-Id: <20240613030241.5771-16-sean.wang@kernel.org> X-Mailer: git-send-email 2.25.1 In-Reply-To: <20240613030241.5771-1-sean.wang@kernel.org> References: <20240613030241.5771-1-sean.wang@kernel.org> MIME-Version: 1.0 X-CRM114-Version: 20100106-BlameMichelson ( TRE 0.8.0 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20240612_200321_701978_3234BD1B X-CRM114-Status: UNSURE ( 9.50 ) X-CRM114-Notice: Please train this message. X-BeenThere: linux-mediatek@lists.infradead.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Sender: "Linux-mediatek" Errors-To: linux-mediatek-bounces+linux-mediatek=archiver.kernel.org@lists.infradead.org From: Sean Wang remove unused parameters in mt7925_mcu_bss_bmc_tlv Co-developed-by: Deren Wu Signed-off-by: Deren Wu Signed-off-by: Sean Wang --- drivers/net/wireless/mediatek/mt76/mt7925/mcu.c | 5 ++--- 1 file changed, 2 insertions(+), 3 deletions(-) diff --git a/drivers/net/wireless/mediatek/mt76/mt7925/mcu.c b/drivers/net/wireless/mediatek/mt76/mt7925/mcu.c index 48b157f42db9..797d4c936fec 100644 --- a/drivers/net/wireless/mediatek/mt76/mt7925/mcu.c +++ b/drivers/net/wireless/mediatek/mt76/mt7925/mcu.c @@ -2179,8 +2179,7 @@ mt7925_mcu_bss_sec_tlv(struct sk_buff *skb, struct ieee80211_vif *vif) static void mt7925_mcu_bss_bmc_tlv(struct sk_buff *skb, struct mt792x_phy *phy, struct ieee80211_chanctx_conf *ctx, - struct ieee80211_bss_conf *link_conf, - struct ieee80211_sta *sta) + struct ieee80211_bss_conf *link_conf) { struct cfg80211_chan_def *chandef = ctx ? &ctx->def : &phy->mt76->chandef; struct mt792x_bss_conf *mconf = mt792x_link_conf_to_mconf(link_conf); @@ -2336,7 +2335,7 @@ int mt7925_mcu_add_bss_info(struct mt792x_phy *phy, mvif->sta.deflink.wcid.idx, enable); mt7925_mcu_bss_sec_tlv(skb, link_conf->vif); - mt7925_mcu_bss_bmc_tlv(skb, phy, ctx, link_conf, sta); + mt7925_mcu_bss_bmc_tlv(skb, phy, ctx, link_conf); mt7925_mcu_bss_qos_tlv(skb, link_conf); mt7925_mcu_bss_mld_tlv(skb, link_conf, sta); mt7925_mcu_bss_ifs_tlv(skb, link_conf); From patchwork Thu Jun 13 03:02:10 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Sean Wang X-Patchwork-Id: 13696050 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from bombadil.infradead.org (bombadil.infradead.org [198.137.202.133]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.lore.kernel.org (Postfix) with ESMTPS id 5E284C27C53 for ; Thu, 13 Jun 2024 03:03:30 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=lists.infradead.org; s=bombadil.20210309; h=Sender:List-Subscribe:List-Help :List-Post:List-Archive:List-Unsubscribe:List-Id:Content-Transfer-Encoding: MIME-Version:References:In-Reply-To:Message-Id:Date:Subject:Cc:To:From: Reply-To:Content-Type:Content-ID:Content-Description:Resent-Date:Resent-From: Resent-Sender:Resent-To:Resent-Cc:Resent-Message-ID:List-Owner; bh=C4ipyO6QmN5fpxt1fsns5qX+Z2OCd3HAfhcBpiCjpsI=; b=3zjasmsuPcke2jJx+2EdE8KyG3 eU9/HSOlFz7CrAcLif74I8vXJMOS0O89xf7tRIc8JMoVdn3iI4VENk979qj9PQYUbIFrYLcB/QDOi fBap1h4UvVXl1Md1vN/xl/bKWBbEt0xjRJ5rVDOQ//aO5AGj8ZPrNLKZpDOLVyjOXJjIkfaJKR42f agGW8m2KwavFVX5RR9EIjyu8oy1KL0xwo967p2Rgmv8nct1aDijdkQUQVJIq2HEanDrvF2wLhkr7g R4ZR14PrSeEROlbVZs34yALQ3Bdf163qEOtT2Z5yOdxdN1C147G1QhQosyZk1GIA6hLwd58Vue0TF tDQSMPig==; Received: from localhost ([::1] helo=bombadil.infradead.org) by bombadil.infradead.org with esmtp (Exim 4.97.1 #2 (Red Hat Linux)) id 1sHakL-0000000EvpB-3QDG; Thu, 13 Jun 2024 03:03:29 +0000 Received: from mail-oo1-f44.google.com ([209.85.161.44]) by bombadil.infradead.org with esmtps (Exim 4.97.1 #2 (Red Hat Linux)) id 1sHakF-0000000Evkt-2kVZ for linux-mediatek@lists.infradead.org; Thu, 13 Jun 2024 03:03:27 +0000 Received: by mail-oo1-f44.google.com with SMTP id 006d021491bc7-5b99ba97d89so25550eaf.1 for ; Wed, 12 Jun 2024 20:03:23 -0700 (PDT) X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1718247802; x=1718852602; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:x-gm-message-state:from:to:cc :subject:date:message-id:reply-to; bh=C4ipyO6QmN5fpxt1fsns5qX+Z2OCd3HAfhcBpiCjpsI=; b=UHoiMdbFw6ekgUVihtL1a+Q2PU5q18sbsIo9cBoAHWZ63mloEGWz5610X4x/NnHLZz o9zoEUsqCnYGAvFTTZ6eU4hYUJ4x9HpTuH5mq9zEjpVJcOzjnn8WeayWCveGp3TCNOrl Qur5siOeHpcRjuh/MyuEuvEjhk7n8kI6XJKDz1s84r5UR/YlGX5dOZbvNjicKkqvAaT+ baAWGsOphp4tl6vrVQ5Ty3q7CW3xrrQCLbBTOrtN9Xx2GPbCBC+SsFFVMEzm5DOphtEd tMK8AeTk7itLQSFVDkbp9NRnO/StmaRylM6GSsQtLrmV3T0dkHBiDX4PM5jAZSjXRIdP kLvA== X-Forwarded-Encrypted: i=1; AJvYcCV8Xd6kpjZUUqxTfguuVwxHkNYZM3kEB4mbfCiXT8zclHrUbMgC7DRYUCcHeUkSdLaSd3Y1yqwe3Ovdac5bOg/fwvcToQiVTmtuUMs8p8HpyOK4 X-Gm-Message-State: AOJu0Yw2rOWQiKxw+YKaDNnlrSKs7mFRNN/bzvnYMqocqeUkEMOk37TN bw0o4ID1QoK5Xb7kA+ZY92QLIX5CxVwrM4+t2BMwuq4435Z1t1YO9wjByVY/Et4= X-Google-Smtp-Source: AGHT+IFhWFellQ8sEWpUCo0Tcq9fcIuLBFa3mmXqjo9a9JvDP51OBREHjytgdBFwum1XIR64B6bkUg== X-Received: by 2002:a05:6820:d88:b0:5ba:ead2:c742 with SMTP id 006d021491bc7-5bb3b7a3d2bmr3671460eaf.0.1718247802154; Wed, 12 Jun 2024 20:03:22 -0700 (PDT) Received: from sean-ThinkPad-T450s.lan ([207.191.35.252]) by smtp.gmail.com with ESMTPSA id 006d021491bc7-5bd629263c5sm67685eaf.46.2024.06.12.20.03.20 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Wed, 12 Jun 2024 20:03:20 -0700 (PDT) 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 16/47] wifi: mt76: mt7925: extend mt7925_mcu_bss_sec_tlv for per-link BSS Date: Wed, 12 Jun 2024 20:02:10 -0700 Message-Id: <20240613030241.5771-17-sean.wang@kernel.org> X-Mailer: git-send-email 2.25.1 In-Reply-To: <20240613030241.5771-1-sean.wang@kernel.org> References: <20240613030241.5771-1-sean.wang@kernel.org> MIME-Version: 1.0 X-CRM114-Version: 20100106-BlameMichelson ( TRE 0.8.0 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20240612_200323_757073_BD4535C8 X-CRM114-Status: GOOD ( 11.05 ) X-BeenThere: linux-mediatek@lists.infradead.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Sender: "Linux-mediatek" Errors-To: linux-mediatek-bounces+linux-mediatek=archiver.kernel.org@lists.infradead.org From: Sean Wang Extend mt7925_mcu_bss_sec_tlv with 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: Deren Wu Signed-off-by: Deren Wu Signed-off-by: Sean Wang --- drivers/net/wireless/mediatek/mt76/mt7925/mcu.c | 8 +++++--- 1 file changed, 5 insertions(+), 3 deletions(-) diff --git a/drivers/net/wireless/mediatek/mt76/mt7925/mcu.c b/drivers/net/wireless/mediatek/mt76/mt7925/mcu.c index 797d4c936fec..028c94d8c21f 100644 --- a/drivers/net/wireless/mediatek/mt76/mt7925/mcu.c +++ b/drivers/net/wireless/mediatek/mt76/mt7925/mcu.c @@ -2132,9 +2132,11 @@ mt7925_mcu_bss_basic_tlv(struct sk_buff *skb, } static void -mt7925_mcu_bss_sec_tlv(struct sk_buff *skb, struct ieee80211_vif *vif) +mt7925_mcu_bss_sec_tlv(struct sk_buff *skb, + struct ieee80211_bss_conf *link_conf) { - struct mt76_vif *mvif = (struct mt76_vif *)vif->drv_priv; + struct mt792x_bss_conf *mconf = mt792x_link_conf_to_mconf(link_conf); + struct mt76_vif *mvif = &mconf->mt76; struct bss_sec_tlv { __le16 tag; __le16 len; @@ -2333,7 +2335,7 @@ int mt7925_mcu_add_bss_info(struct mt792x_phy *phy, /* bss_basic must be first */ mt7925_mcu_bss_basic_tlv(skb, link_conf->vif, sta, ctx, phy->mt76, mvif->sta.deflink.wcid.idx, enable); - mt7925_mcu_bss_sec_tlv(skb, link_conf->vif); + mt7925_mcu_bss_sec_tlv(skb, link_conf); mt7925_mcu_bss_bmc_tlv(skb, phy, ctx, link_conf); mt7925_mcu_bss_qos_tlv(skb, link_conf); From patchwork Thu Jun 13 03:02:11 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Sean Wang X-Patchwork-Id: 13696049 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from bombadil.infradead.org (bombadil.infradead.org [198.137.202.133]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.lore.kernel.org (Postfix) with ESMTPS id A2009C27C77 for ; Thu, 13 Jun 2024 03:03:29 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=lists.infradead.org; s=bombadil.20210309; h=Sender:List-Subscribe:List-Help :List-Post:List-Archive:List-Unsubscribe:List-Id:Content-Transfer-Encoding: MIME-Version:References:In-Reply-To:Message-Id:Date:Subject:Cc:To:From: Reply-To:Content-Type:Content-ID:Content-Description:Resent-Date:Resent-From: Resent-Sender:Resent-To:Resent-Cc:Resent-Message-ID:List-Owner; bh=vv6e/GvblL0RsnLWjjsfrvHkKEUobVf9bh+1TtsfTcE=; b=bV4/p4MZCvN7BQ+McCzPKMy8XH SfxJBIx2YERUoOC/7qqT+NOZ6CgaPUUX1XslqdUtN0euZVgo19rr9XBw0XVKg761rnGXCtsjiWxVi iD5gxeG402fCMxIe7TPpTaPsWFhorUMwgUYP7rw1Wqm7nQhBBYONcrUdKxlaGzq3fajLV2iJ7hNzJ J0EJUubD/5iL9KyqXS0ejynE8e7cfIOkBXDHyP5+MZFGNbQr7rJT/d95vwZEVgE9nC6hh7FtzICuC jjVovACHnDv+zGHN8lh2aZGw+Qh8sZD803NqrgN7tztbpJ/JubzKfgtsh2jTlUgAXW+bB3El0Gtip I5+cl41w==; Received: from localhost ([::1] helo=bombadil.infradead.org) by bombadil.infradead.org with esmtp (Exim 4.97.1 #2 (Red Hat Linux)) id 1sHakL-0000000EvoQ-0fAB; Thu, 13 Jun 2024 03:03:29 +0000 Received: from mail-oo1-f42.google.com ([209.85.161.42]) by bombadil.infradead.org with esmtps (Exim 4.97.1 #2 (Red Hat Linux)) id 1sHakH-0000000Evm1-0Kx9 for linux-mediatek@lists.infradead.org; Thu, 13 Jun 2024 03:03:27 +0000 Received: by mail-oo1-f42.google.com with SMTP id 006d021491bc7-5bad97708efso31437eaf.1 for ; Wed, 12 Jun 2024 20:03:24 -0700 (PDT) X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1718247804; x=1718852604; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:x-gm-message-state:from:to:cc :subject:date:message-id:reply-to; bh=vv6e/GvblL0RsnLWjjsfrvHkKEUobVf9bh+1TtsfTcE=; b=BsQX8Kevv3FQNKZAlKv/GV8lczFemoTsmJy1lOJAL9EsiwxN2ld5GDYpndR+3LndES V7Ff6gjApV4WdhTk+mCfyd2afxv3UxVmaFhtvsmHuLzt4cWsCQywT3I9EM3DuD5cHfnz 1CcFYpDMIMy8OIEVfYEU0l1KKGOav4SNVqcZSmYlYOSsdHnNTsF3GrMRmf+yeGSylug1 TF2/Kbx2gvGdgIn/fWfhKk0chcj36dn/AgU1Fjnewf7hvVloogOVJMAOQ1KSO/UFv1uE kBFMVXpAGNY3K2nF4IOL6eiKGjsWYfiDGb2oDbO8sxK0qAdUIWuD/pZpJGNTujbgsOr7 Ydgg== X-Forwarded-Encrypted: i=1; AJvYcCX/j7txUlx5eBK8eF08N6E5gmMKzWk6KTm9Be+LwQ8qqk+ihQ06d8S/f3jOcbrdH62zihn/RHXlpPzao0baF0sl0LmXV+qT2Zm5zLoKTszJXj2f X-Gm-Message-State: AOJu0YwIuxv9t+lcL+29g3J4m7DZrNlHH2pw+7dwfSkEG+zypPKFuiPb BRPuh/k87qZudg73yq9qM5PKjTkjm4CBDlpfFUT1cOns14vWAaKb X-Google-Smtp-Source: AGHT+IEKchg4RAPKv1w2iVq2otrOKx7P35BjC4n9Lr47n3pV1QU6C/eh0GgoM8TtNqpFehq/1WeJ3A== X-Received: by 2002:a4a:3101:0:b0:5ba:ca8a:6598 with SMTP id 006d021491bc7-5bb3b7b972bmr3906975eaf.0.1718247803868; Wed, 12 Jun 2024 20:03:23 -0700 (PDT) Received: from sean-ThinkPad-T450s.lan ([207.191.35.252]) by smtp.gmail.com with ESMTPSA id 006d021491bc7-5bd629263c5sm67685eaf.46.2024.06.12.20.03.22 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Wed, 12 Jun 2024 20:03:22 -0700 (PDT) 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 17/47] wifi: mt76: mt7925: extend mt7925_mcu_bss_basic_tlv for per-link BSS Date: Wed, 12 Jun 2024 20:02:11 -0700 Message-Id: <20240613030241.5771-18-sean.wang@kernel.org> X-Mailer: git-send-email 2.25.1 In-Reply-To: <20240613030241.5771-1-sean.wang@kernel.org> References: <20240613030241.5771-1-sean.wang@kernel.org> MIME-Version: 1.0 X-CRM114-Version: 20100106-BlameMichelson ( TRE 0.8.0 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20240612_200325_162161_29FB7252 X-CRM114-Status: GOOD ( 14.53 ) X-BeenThere: linux-mediatek@lists.infradead.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Sender: "Linux-mediatek" Errors-To: linux-mediatek-bounces+linux-mediatek=archiver.kernel.org@lists.infradead.org From: Sean Wang Extend mt7925_mcu_bss_basic_tlv with 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: Deren Wu Signed-off-by: Deren Wu Signed-off-by: Sean Wang --- .../net/wireless/mediatek/mt76/mt7925/main.c | 1 + .../net/wireless/mediatek/mt76/mt7925/mcu.c | 25 ++++++++++--------- drivers/net/wireless/mediatek/mt76/mt792x.h | 1 + 3 files changed, 15 insertions(+), 12 deletions(-) diff --git a/drivers/net/wireless/mediatek/mt76/mt7925/main.c b/drivers/net/wireless/mediatek/mt76/mt7925/main.c index 6a1afff92399..457e1fa2fde1 100644 --- a/drivers/net/wireless/mediatek/mt76/mt7925/main.c +++ b/drivers/net/wireless/mediatek/mt76/mt7925/main.c @@ -338,6 +338,7 @@ mt7925_add_interface(struct ieee80211_hw *hw, struct ieee80211_vif *vif) mvif->phy = phy; mvif->bss_conf.mt76.band_idx = 0; mvif->bss_conf.mt76.wmm_idx = mvif->bss_conf.mt76.idx % MT76_CONNAC_MAX_WMM_SETS; + mvif->bss_conf.vif = mvif; if (phy->mt76->chandef.chan->band != NL80211_BAND_2GHZ) mvif->bss_conf.mt76.basic_rates_idx = MT792x_BASIC_RATES_TBL + 4; diff --git a/drivers/net/wireless/mediatek/mt76/mt7925/mcu.c b/drivers/net/wireless/mediatek/mt76/mt7925/mcu.c index 028c94d8c21f..18e19ffdbb7e 100644 --- a/drivers/net/wireless/mediatek/mt76/mt7925/mcu.c +++ b/drivers/net/wireless/mediatek/mt76/mt7925/mcu.c @@ -2062,15 +2062,16 @@ mt7925_get_phy_mode_ext(struct mt76_phy *phy, struct ieee80211_vif *vif, static void mt7925_mcu_bss_basic_tlv(struct sk_buff *skb, - struct ieee80211_vif *vif, + struct ieee80211_bss_conf *link_conf, struct ieee80211_sta *sta, struct ieee80211_chanctx_conf *ctx, struct mt76_phy *phy, u16 wlan_idx, bool enable) { - struct mt792x_vif *mvif = (struct mt792x_vif *)vif->drv_priv; + struct ieee80211_vif *vif = link_conf->vif; + struct mt792x_bss_conf *mconf = mt792x_link_conf_to_mconf(link_conf); struct mt792x_sta *msta = sta ? (struct mt792x_sta *)sta->drv_priv : - &mvif->sta; + &mconf->vif->sta; struct cfg80211_chan_def *chandef = ctx ? &ctx->def : &phy->chandef; enum nl80211_band band = chandef->chan->band; struct mt76_connac_bss_basic_tlv *basic_req; @@ -2081,8 +2082,8 @@ mt7925_mcu_bss_basic_tlv(struct sk_buff *skb, tlv = mt76_connac_mcu_add_tlv(skb, UNI_BSS_INFO_BASIC, sizeof(*basic_req)); basic_req = (struct mt76_connac_bss_basic_tlv *)tlv; - idx = mvif->bss_conf.mt76.omac_idx > EXT_BSSID_START ? HW_BSSID_0 : - mvif->bss_conf.mt76.omac_idx; + idx = mconf->mt76.omac_idx > EXT_BSSID_START ? HW_BSSID_0 : + mconf->mt76.omac_idx; basic_req->hw_bss_idx = idx; basic_req->phymode_ext = mt7925_get_phy_mode_ext(phy, vif, band, sta); @@ -2092,15 +2093,15 @@ mt7925_mcu_bss_basic_tlv(struct sk_buff *skb, else basic_req->nonht_basic_phy = cpu_to_le16(PHY_TYPE_OFDM_INDEX); - memcpy(basic_req->bssid, vif->bss_conf.bssid, ETH_ALEN); + memcpy(basic_req->bssid, link_conf->bssid, ETH_ALEN); basic_req->phymode = mt76_connac_get_phy_mode(phy, vif, band, sta); - basic_req->bcn_interval = cpu_to_le16(vif->bss_conf.beacon_int); - basic_req->dtim_period = vif->bss_conf.dtim_period; + basic_req->bcn_interval = cpu_to_le16(link_conf->beacon_int); + basic_req->dtim_period = link_conf->dtim_period; basic_req->bmc_tx_wlan_idx = cpu_to_le16(wlan_idx); basic_req->sta_idx = cpu_to_le16(msta->deflink.wcid.idx); - basic_req->omac_idx = mvif->bss_conf.mt76.omac_idx; - basic_req->band_idx = mvif->bss_conf.mt76.band_idx; - basic_req->wmm_idx = mvif->bss_conf.mt76.wmm_idx; + basic_req->omac_idx = mconf->mt76.omac_idx; + basic_req->band_idx = mconf->mt76.band_idx; + basic_req->wmm_idx = mconf->mt76.wmm_idx; basic_req->conn_state = !enable; switch (vif->type) { @@ -2333,7 +2334,7 @@ int mt7925_mcu_add_bss_info(struct mt792x_phy *phy, return PTR_ERR(skb); /* bss_basic must be first */ - mt7925_mcu_bss_basic_tlv(skb, link_conf->vif, sta, ctx, phy->mt76, + mt7925_mcu_bss_basic_tlv(skb, link_conf, sta, ctx, phy->mt76, mvif->sta.deflink.wcid.idx, enable); mt7925_mcu_bss_sec_tlv(skb, link_conf); diff --git a/drivers/net/wireless/mediatek/mt76/mt792x.h b/drivers/net/wireless/mediatek/mt76/mt792x.h index f675709f419a..9452a3592950 100644 --- a/drivers/net/wireless/mediatek/mt76/mt792x.h +++ b/drivers/net/wireless/mediatek/mt76/mt792x.h @@ -106,6 +106,7 @@ struct mt792x_chanctx { struct mt792x_bss_conf { struct mt76_vif mt76; /* must be first */ + struct mt792x_vif *vif; struct ewma_rssi rssi; struct ieee80211_tx_queue_params queue_params[IEEE80211_NUM_ACS]; }; From patchwork Thu Jun 13 03:02:12 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Sean Wang X-Patchwork-Id: 13696051 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from bombadil.infradead.org (bombadil.infradead.org [198.137.202.133]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.lore.kernel.org (Postfix) with ESMTPS id DABE1C27C53 for ; Thu, 13 Jun 2024 03:03:32 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=lists.infradead.org; s=bombadil.20210309; h=Sender:List-Subscribe:List-Help :List-Post:List-Archive:List-Unsubscribe:List-Id:Content-Transfer-Encoding: MIME-Version:References:In-Reply-To:Message-Id:Date:Subject:Cc:To:From: Reply-To:Content-Type:Content-ID:Content-Description:Resent-Date:Resent-From: Resent-Sender:Resent-To:Resent-Cc:Resent-Message-ID:List-Owner; bh=i0dXcuhqd0lvvqm+NBo7m/RnwTDnBF6gybJXfOPI8oU=; b=YNKlBbnlW1rgwRgdO4qYFqAZMd 9ICJdUGrWSn6L3U+t0ra/Ld7jFt9TNj4rEP9FMFZ6ztDPRHmKd2DTdcVJOxzcyDUOt40bINhPsNCf +3EHW4fSI2iASNBDF3OcGBCcZy/yhtc3C7HMIX6oRwvRefUT6/gsCoTe6RucVWjOiTBU3TaHOI3JM GPpwUv1kLX5DTtetL17yLRbbDxahHvfO/IuL02WzDnV/V6AY+e40ZAuWfXEZJxc8mM28jOLl3YsBy 9S46jZZ+7x8hl/+h9H9lOgxraHtOjsvkRQE3CsAWok7BNV6KdSueLc3sEmBGrGxXbrGXrFi+xfCDx 61vt6hug==; Received: from localhost ([::1] helo=bombadil.infradead.org) by bombadil.infradead.org with esmtp (Exim 4.97.1 #2 (Red Hat Linux)) id 1sHakO-0000000Evqo-2EqU; Thu, 13 Jun 2024 03:03:32 +0000 Received: from mail-oa1-f49.google.com ([209.85.160.49]) by bombadil.infradead.org with esmtps (Exim 4.97.1 #2 (Red Hat Linux)) id 1sHakI-0000000Evml-1bTh for linux-mediatek@lists.infradead.org; Thu, 13 Jun 2024 03:03:29 +0000 Received: by mail-oa1-f49.google.com with SMTP id 586e51a60fabf-250aa23752dso56684fac.3 for ; Wed, 12 Jun 2024 20:03:25 -0700 (PDT) X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1718247805; x=1718852605; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:x-gm-message-state:from:to:cc :subject:date:message-id:reply-to; bh=i0dXcuhqd0lvvqm+NBo7m/RnwTDnBF6gybJXfOPI8oU=; b=BCEH3x5CH+Wp93a/KTALM9ffhCTQCCJ7tZ7NEj7Sd7eDYRa9MUHM/4mMDRc8gpGsBn 7ZK++wp7g5Iji0Fefv3vmLdY2T+oFNg92IUugGuar1HCfdcii5R7loCeFwUr1YxVgj02 bw0MxcrDMciTWNlmVNH2RhkBH3VqK0YdX7JZbtYr9YJzf53wSvoyJRASnioCdMlD4MjK janTAk04STJFECzXy0MLZzlGaKwX4zKCZXyW+DCXT0faLvU+xY9cZE/fsUiegHCMlvTL iHWiQPXJXyyGyNyyz3BGZ78q7Z5pE/l2sOzHmx5YUtiQ8FBn0b9+jwTrjVLppaxFQ+gF jeNA== X-Forwarded-Encrypted: i=1; AJvYcCXCnYbV3lbzZzfDGdJT/dgTPIgelgbqtr6ce7C4JjAWi62D3Qt1ciqQOmfommd3c9Qr6IMvyNh6eLqjBwjh6A==@lists.infradead.org X-Gm-Message-State: AOJu0Yx14IhcO18U6sTNojfzTNkWfozg4OtzZpTFNdBjmXbkzMgJeCtL G8xmeXc1VvpeUPuCtLg4Dkf+2YiBicAY774Yg+NXlIwXVEJsdYqt X-Google-Smtp-Source: AGHT+IHi7rQNTqoSwiFznMBjXn3k3B1PCO5vHCiG3wFDk2jnlRKV9q6PICtm0P8Y3Y5/9BSnjwQ0wQ== X-Received: by 2002:a05:6820:b0b:b0:5ba:c4ed:ee98 with SMTP id 006d021491bc7-5bb3b7a4c51mr3589757eaf.0.1718247805119; Wed, 12 Jun 2024 20:03:25 -0700 (PDT) Received: from sean-ThinkPad-T450s.lan ([207.191.35.252]) by smtp.gmail.com with ESMTPSA id 006d021491bc7-5bd629263c5sm67685eaf.46.2024.06.12.20.03.24 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Wed, 12 Jun 2024 20:03:24 -0700 (PDT) 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 18/47] wifi: mt76: mt7925: extend mt7925_mcu_set_bss_pm for per-link BSS Date: Wed, 12 Jun 2024 20:02:12 -0700 Message-Id: <20240613030241.5771-19-sean.wang@kernel.org> X-Mailer: git-send-email 2.25.1 In-Reply-To: <20240613030241.5771-1-sean.wang@kernel.org> References: <20240613030241.5771-1-sean.wang@kernel.org> MIME-Version: 1.0 X-CRM114-Version: 20100106-BlameMichelson ( TRE 0.8.0 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20240612_200326_449524_33BE4E04 X-CRM114-Status: GOOD ( 13.33 ) X-BeenThere: linux-mediatek@lists.infradead.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Sender: "Linux-mediatek" Errors-To: linux-mediatek-bounces+linux-mediatek=archiver.kernel.org@lists.infradead.org From: Sean Wang Extend mt7925_mcu_set_bss_pm with 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: Deren Wu Signed-off-by: Deren Wu Signed-off-by: Sean Wang --- drivers/net/wireless/mediatek/mt76/mt7925/main.c | 4 ++-- drivers/net/wireless/mediatek/mt76/mt7925/mcu.c | 15 ++++++++------- .../net/wireless/mediatek/mt76/mt7925/mt7925.h | 3 ++- 3 files changed, 12 insertions(+), 10 deletions(-) diff --git a/drivers/net/wireless/mediatek/mt76/mt7925/main.c b/drivers/net/wireless/mediatek/mt76/mt7925/main.c index 457e1fa2fde1..aeed2c777a20 100644 --- a/drivers/net/wireless/mediatek/mt76/mt7925/main.c +++ b/drivers/net/wireless/mediatek/mt76/mt7925/main.c @@ -1263,7 +1263,7 @@ mt7925_start_ap(struct ieee80211_hw *hw, struct ieee80211_vif *vif, if (err) goto out; - err = mt7925_mcu_set_bss_pm(dev, vif, true); + err = mt7925_mcu_set_bss_pm(dev, link_conf, true); if (err) goto out; @@ -1285,7 +1285,7 @@ mt7925_stop_ap(struct ieee80211_hw *hw, struct ieee80211_vif *vif, mt792x_mutex_acquire(dev); - err = mt7925_mcu_set_bss_pm(dev, vif, false); + err = mt7925_mcu_set_bss_pm(dev, link_conf, false); if (err) goto out; diff --git a/drivers/net/wireless/mediatek/mt76/mt7925/mcu.c b/drivers/net/wireless/mediatek/mt76/mt7925/mcu.c index 18e19ffdbb7e..0350f0e34690 100644 --- a/drivers/net/wireless/mediatek/mt76/mt7925/mcu.c +++ b/drivers/net/wireless/mediatek/mt76/mt7925/mcu.c @@ -1319,10 +1319,11 @@ mt7925_mcu_uni_bss_bcnft(struct mt792x_dev *dev, struct ieee80211_vif *vif, } int -mt7925_mcu_set_bss_pm(struct mt792x_dev *dev, struct ieee80211_vif *vif, +mt7925_mcu_set_bss_pm(struct mt792x_dev *dev, + struct ieee80211_bss_conf *link_conf, bool enable) { - struct mt792x_vif *mvif = (struct mt792x_vif *)vif->drv_priv; + struct mt792x_bss_conf *mconf = mt792x_link_conf_to_mconf(link_conf); struct { struct { u8 bss_idx; @@ -1339,13 +1340,13 @@ mt7925_mcu_set_bss_pm(struct mt792x_dev *dev, struct ieee80211_vif *vif, } __packed enable; } req = { .hdr = { - .bss_idx = mvif->bss_conf.mt76.idx, + .bss_idx = mconf->mt76.idx, }, .enable = { .tag = cpu_to_le16(UNI_BSS_INFO_BCNFT), .len = cpu_to_le16(sizeof(struct bcnft_tlv)), - .dtim_period = vif->bss_conf.dtim_period, - .bcn_interval = cpu_to_le16(vif->bss_conf.beacon_int), + .dtim_period = link_conf->dtim_period, + .bcn_interval = cpu_to_le16(link_conf->beacon_int), }, }; struct { @@ -1359,7 +1360,7 @@ mt7925_mcu_set_bss_pm(struct mt792x_dev *dev, struct ieee80211_vif *vif, } __packed disable; } req1 = { .hdr = { - .bss_idx = mvif->bss_conf.mt76.idx, + .bss_idx = mconf->mt76.idx, }, .disable = { .tag = cpu_to_le16(UNI_BSS_INFO_PM_DISABLE), @@ -1693,7 +1694,7 @@ int mt7925_mcu_set_beacon_filter(struct mt792x_dev *dev, MT_WF_RFCR_DROP_OTHER_BEACON); } - err = mt7925_mcu_set_bss_pm(dev, vif, false); + err = mt7925_mcu_set_bss_pm(dev, &vif->bss_conf, false); if (err) return err; diff --git a/drivers/net/wireless/mediatek/mt76/mt7925/mt7925.h b/drivers/net/wireless/mediatek/mt76/mt7925/mt7925.h index f689f7a359ea..07ea03195e4e 100644 --- a/drivers/net/wireless/mediatek/mt76/mt7925/mt7925.h +++ b/drivers/net/wireless/mediatek/mt76/mt7925/mt7925.h @@ -192,7 +192,8 @@ int __mt7925_start(struct mt792x_phy *phy); int mt7925_register_device(struct mt792x_dev *dev); void mt7925_unregister_device(struct mt792x_dev *dev); int mt7925_run_firmware(struct mt792x_dev *dev); -int mt7925_mcu_set_bss_pm(struct mt792x_dev *dev, struct ieee80211_vif *vif, +int mt7925_mcu_set_bss_pm(struct mt792x_dev *dev, + struct ieee80211_bss_conf *link_conf, bool enable); int mt7925_mcu_sta_update(struct mt792x_dev *dev, struct ieee80211_sta *sta, struct ieee80211_vif *vif, bool enable, From patchwork Thu Jun 13 03:02:13 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Sean Wang X-Patchwork-Id: 13696052 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from bombadil.infradead.org (bombadil.infradead.org [198.137.202.133]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.lore.kernel.org (Postfix) with ESMTPS id 9493FC27C77 for ; Thu, 13 Jun 2024 03:03:34 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=lists.infradead.org; s=bombadil.20210309; h=Sender:List-Subscribe:List-Help :List-Post:List-Archive:List-Unsubscribe:List-Id:Content-Transfer-Encoding: MIME-Version:References:In-Reply-To:Message-Id:Date:Subject:Cc:To:From: Reply-To:Content-Type:Content-ID:Content-Description:Resent-Date:Resent-From: Resent-Sender:Resent-To:Resent-Cc:Resent-Message-ID:List-Owner; bh=K5Ixihb5+/Ac4FqRSaORRJ9EOehUjft02rbomkCQY7Y=; b=o3VhvK4Gij6EaQoOmq7KkqteKx TTDsmMzD+RUM558wMvPra2p9PugXdaaU6pOYOWRVIHkk4a5FuBVo0ZWmLNUsAde1wBAq/YXc0axia 7Y4OB7vTjnxm7lFXb91JEQdZ8NrpUSycZjEZmQhEz4e5CeUMdKNSeGPFjoZKiMFS8OPsne9UcJihE qYNwvmnzkD24u+7skgJTRgKOVQLVQAgA4MFOFXlFDlAXZZp/caTDfRAs6RMlGF3tmu/FusX9+RK8V p6JIplKeqZgREvTDxME+r5/KrcIClIaHcTR5G+u/dfiKIsWyaAffluVV+oAABzh2wXbMFpXGH5Uec hmOJnSPw==; Received: from localhost ([::1] helo=bombadil.infradead.org) by bombadil.infradead.org with esmtp (Exim 4.97.1 #2 (Red Hat Linux)) id 1sHakP-0000000Evrk-3z5H; Thu, 13 Jun 2024 03:03:34 +0000 Received: from mail-oa1-f41.google.com ([209.85.160.41]) by bombadil.infradead.org with esmtps (Exim 4.97.1 #2 (Red Hat Linux)) id 1sHakL-0000000EvoG-0FY5 for linux-mediatek@lists.infradead.org; Thu, 13 Jun 2024 03:03:31 +0000 Received: by mail-oa1-f41.google.com with SMTP id 586e51a60fabf-24c5ec50da1so92030fac.3 for ; Wed, 12 Jun 2024 20:03:28 -0700 (PDT) X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1718247808; x=1718852608; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:x-gm-message-state:from:to:cc :subject:date:message-id:reply-to; bh=K5Ixihb5+/Ac4FqRSaORRJ9EOehUjft02rbomkCQY7Y=; b=Ui1GOtNWSTGT2z2veK90Y0bKfDorXM/V+V0qe2l+zdCN7ZxrVRWQo0ZlSw1/7ZDu3v iYYMkOurCQe6wetNBHMkpu5zx6prt9H0o7GXDxSoFtfpGhuFuF+icxRxm7R2VQfErVza 7d9mcczbSQwNKPmQIUaydrr3WdT5rM/ZpA9WH6W2OMwebDqaTdeYdZpoTFKPSLdb2geZ hs8bN8yszYgovJy5qLSRWW1rDozQqXm84I3rm38hyyGNniT2b3Cwj1j3s8Jiu1JDmXIZ UKDVicJ/i0WSTfMkqqzrSO1ACncs/WYjOM5c3Ou1LedunkrxamvfkcjMmqhwxZusEjNO cINQ== X-Forwarded-Encrypted: i=1; AJvYcCVOnmOKWaMGC7zrauSlKqGzXat1jGAOGW3Eg2Y0WnHXf9ovPet9YoZ7q5KN1kptAfgJN/NTtTU9993KbeJg//ZIMNPSlvo30PN2/0Ci9q8axuzU X-Gm-Message-State: AOJu0YxSq0qFUjAPTqHP3ErGNc2b7auGVUcQ+ztuKYU+t51FFYIrbKWz SIxI/bHcHW5zkt5PZ7dXfc8GCOWwIAuT0dOxcd+d62BZK3F/ufnm X-Google-Smtp-Source: AGHT+IGDTHOgtVT/95Hk2G2qO7v3gsdpwBALKEJ1QGY3fm1CGLY8vR3hjc+0x0gz/D/7VX5N0Zit7A== X-Received: by 2002:a4a:d196:0:b0:5bd:87a0:66d with SMTP id 006d021491bc7-5bd87a01b93mr285708eaf.1.1718247807616; Wed, 12 Jun 2024 20:03:27 -0700 (PDT) Received: from sean-ThinkPad-T450s.lan ([207.191.35.252]) by smtp.gmail.com with ESMTPSA id 006d021491bc7-5bd629263c5sm67685eaf.46.2024.06.12.20.03.25 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Wed, 12 Jun 2024 20:03:25 -0700 (PDT) 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 19/47] wifi: mt76: mt7925: extend mt7925_mcu_[abort, set]_roc for per-link BSS Date: Wed, 12 Jun 2024 20:02:13 -0700 Message-Id: <20240613030241.5771-20-sean.wang@kernel.org> X-Mailer: git-send-email 2.25.1 In-Reply-To: <20240613030241.5771-1-sean.wang@kernel.org> References: <20240613030241.5771-1-sean.wang@kernel.org> MIME-Version: 1.0 X-CRM114-Version: 20100106-BlameMichelson ( TRE 0.8.0 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20240612_200329_447998_FC927EB4 X-CRM114-Status: GOOD ( 14.71 ) X-BeenThere: linux-mediatek@lists.infradead.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Sender: "Linux-mediatek" Errors-To: linux-mediatek-bounces+linux-mediatek=archiver.kernel.org@lists.infradead.org From: Sean Wang 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: Deren Wu Signed-off-by: Deren Wu Signed-off-by: Sean Wang --- .../net/wireless/mediatek/mt76/mt7925/main.c | 23 +++++++++++-------- .../net/wireless/mediatek/mt76/mt7925/mcu.c | 8 +++---- .../wireless/mediatek/mt76/mt7925/mt7925.h | 4 ++-- 3 files changed, 19 insertions(+), 16 deletions(-) diff --git a/drivers/net/wireless/mediatek/mt76/mt7925/main.c b/drivers/net/wireless/mediatek/mt76/mt7925/main.c index aeed2c777a20..bba17e51a023 100644 --- a/drivers/net/wireless/mediatek/mt76/mt7925/main.c +++ b/drivers/net/wireless/mediatek/mt76/mt7925/main.c @@ -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_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) @@ -408,7 +408,8 @@ void mt7925_roc_work(struct work_struct *work) 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; @@ -417,14 +418,14 @@ static int mt7925_abort_roc(struct mt792x_phy *phy, struct mt792x_vif *vif) mt792x_mutex_acquire(phy->dev); 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); return err; } static int mt7925_set_roc(struct mt792x_phy *phy, - struct mt792x_vif *vif, + struct mt792x_bss_conf *mconf, struct ieee80211_channel *chan, int duration, enum mt7925_roc_req type) @@ -436,7 +437,7 @@ static int mt7925_set_roc(struct mt792x_phy *phy, 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); if (err < 0) { clear_bit(MT76_STATE_ROC, &phy->mt76->state); @@ -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)) { - 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); err = -ETIMEDOUT; } @@ -464,7 +465,8 @@ static int mt7925_remain_on_channel(struct ieee80211_hw *hw, int err; 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); return err; @@ -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_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, @@ -1345,7 +1347,8 @@ static void mt7925_mgd_prepare_tx(struct ieee80211_hw *hw, jiffies_to_msecs(HZ); 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); mt792x_mutex_release(dev); } @@ -1356,7 +1359,7 @@ static void mt7925_mgd_complete_tx(struct ieee80211_hw *hw, { 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, diff --git a/drivers/net/wireless/mediatek/mt76/mt7925/mcu.c b/drivers/net/wireless/mediatek/mt76/mt7925/mcu.c index 0350f0e34690..a40ad1578212 100644 --- a/drivers/net/wireless/mediatek/mt76/mt7925/mcu.c +++ b/drivers/net/wireless/mediatek/mt76/mt7925/mcu.c @@ -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); } -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, 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, .tokenid = token_id, .reqtype = type, .maxinterval = cpu_to_le32(duration), - .bss_idx = vif->bss_conf.mt76.idx, + .bss_idx = mconf->mt76.idx, .control_channel = chan->hw_value, .bw = 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, &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) { struct mt792x_dev *dev = phy->dev; @@ -1138,7 +1138,7 @@ int mt7925_mcu_abort_roc(struct mt792x_phy *phy, struct mt792x_vif *vif, .tag = cpu_to_le16(UNI_ROC_ABORT), .len = cpu_to_le16(sizeof(struct roc_abort_tlv)), .tokenid = token_id, - .bss_idx = vif->bss_conf.mt76.idx, + .bss_idx = mconf->mt76.idx, .dbdcband = 0xff, /* auto*/ }, }; diff --git a/drivers/net/wireless/mediatek/mt76/mt7925/mt7925.h b/drivers/net/wireless/mediatek/mt76/mt7925/mt7925.h index 07ea03195e4e..8ab2bb01ba73 100644 --- a/drivers/net/wireless/mediatek/mt76/mt7925/mt7925.h +++ b/drivers/net/wireless/mediatek/mt76/mt7925/mt7925.h @@ -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_set_clc(struct mt792x_dev *dev, u8 *alpha2, 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, 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); int mt7925_mcu_fill_message(struct mt76_dev *mdev, struct sk_buff *skb, int cmd, int *wait_seq); From patchwork Thu Jun 13 03:02:14 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Sean Wang X-Patchwork-Id: 13696053 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from bombadil.infradead.org (bombadil.infradead.org [198.137.202.133]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.lore.kernel.org (Postfix) with ESMTPS id E222AC27C53 for ; Thu, 13 Jun 2024 03:03:35 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=lists.infradead.org; s=bombadil.20210309; h=Sender:List-Subscribe:List-Help :List-Post:List-Archive:List-Unsubscribe:List-Id:Content-Transfer-Encoding: MIME-Version:References:In-Reply-To:Message-Id:Date:Subject:Cc:To:From: Reply-To:Content-Type:Content-ID:Content-Description:Resent-Date:Resent-From: Resent-Sender:Resent-To:Resent-Cc:Resent-Message-ID:List-Owner; bh=v5C4HXZ5Qn+NC0fHMwJmteg0sATZeShS/Ir1vuk6irI=; b=b9vaq+rCDzIu+9BdDgM+sMOwIy O/yt/hHCAPwl2EkWRGRo5qiuzuNOr/c+KN+vaf4jt8icPKgBfnNTmO5g4sms83728xGERgS6eokyZ 7zrr7EhBLGSlv+K7lnOpWBGk4F7CQe3cuAcwHj841fxoZ1is2GBraSFO0PuKjV7KDfYlraz4oKgEE XjXdcJ04OCsa9EvZxDQSnZrRWztXm2b+ehRxYvPE+Fbi/MKLa0E7Em9C8CGQlXK+u5jDeyHqXA2N4 WokIXlWiJUI6G96YbJ/CBi1k/QK2qd9ohTZCLR4t2ZBPf8v3vowTqL/HjaGqlcoA1yYpgrKIozlJF ucOeoH3A==; Received: from localhost ([::1] helo=bombadil.infradead.org) by bombadil.infradead.org with esmtp (Exim 4.97.1 #2 (Red Hat Linux)) id 1sHakR-0000000EvsP-0Iy2; Thu, 13 Jun 2024 03:03:35 +0000 Received: from mail-oo1-f49.google.com ([209.85.161.49]) by bombadil.infradead.org with esmtps (Exim 4.97.1 #2 (Red Hat Linux)) id 1sHakM-0000000EvpA-2VAb for linux-mediatek@lists.infradead.org; Thu, 13 Jun 2024 03:03:32 +0000 Received: by mail-oo1-f49.google.com with SMTP id 006d021491bc7-5bae827df63so40145eaf.3 for ; Wed, 12 Jun 2024 20:03:30 -0700 (PDT) X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1718247809; x=1718852609; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:x-gm-message-state:from:to:cc :subject:date:message-id:reply-to; bh=v5C4HXZ5Qn+NC0fHMwJmteg0sATZeShS/Ir1vuk6irI=; b=nh9yc1AwtjJiknZhfPABDIFUNvusx/RRcxEJYdBVv5xJ6bnDXJPeRRTxCOzGn+j6e6 an735uHd+xINfue8TIkjqFLXtk6G9SFSh4xLvRoKC7OKg4fLG5D1ioIgHuu+JGr7MZ/O opF72NaDi7UqgjXNtaV5OeYG8tAgHu1RDnBqbzB2PsWVleM32ILrUekMdMCrjpEjNy0f cI6vKJhyzX6wdhc3P4XYu6jBzX7x/ps5W3QWzACm3RsAU14JD2moHyYpXNmM0PoE6MlK xugNWS2AqD6f2XaIMU//75EdCKSU5dVNjmfEqqpkfjunSFdNZbamj7tRpZuxBmtTYvKu AKew== X-Forwarded-Encrypted: i=1; AJvYcCXH9ze8aW7V7Us+ahiBJFZepLov3nDlZQQ+79L7Kq9JqSIg68OYgFhxUBwf9tTjcgHH7X5L42w0tWEZKi4yNUOhIAe5fHuC03fDcYS8SnRuz19H X-Gm-Message-State: AOJu0Yy2voXo2ard6BB3SYnfvQ1i3ZcnlSKsyrptnFQjjp3GFAU+bH/y 6N9xuGrmWPWlC2mlSfC/FJdrZsQr9QWPMSaKF2dUsdmdRsigsqtJKNnH1vOSRiU= X-Google-Smtp-Source: AGHT+IEe4P0VHMNgBu8piViehq/J0PqaKqHtNs+BhhWQq35+u9yyXiLnME99TrmCwao0gjU3BjWkig== X-Received: by 2002:a4a:a5ca:0:b0:5ba:e11d:a2ae with SMTP id 006d021491bc7-5bb3b9f4ef7mr3671748eaf.1.1718247809367; Wed, 12 Jun 2024 20:03:29 -0700 (PDT) Received: from sean-ThinkPad-T450s.lan ([207.191.35.252]) by smtp.gmail.com with ESMTPSA id 006d021491bc7-5bd629263c5sm67685eaf.46.2024.06.12.20.03.27 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Wed, 12 Jun 2024 20:03:28 -0700 (PDT) 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 20/47] wifi: mt76: mt7925: extend mt7925_mcu_uni_bss_bcnft for per-link BSS Date: Wed, 12 Jun 2024 20:02:14 -0700 Message-Id: <20240613030241.5771-21-sean.wang@kernel.org> X-Mailer: git-send-email 2.25.1 In-Reply-To: <20240613030241.5771-1-sean.wang@kernel.org> References: <20240613030241.5771-1-sean.wang@kernel.org> MIME-Version: 1.0 X-CRM114-Version: 20100106-BlameMichelson ( TRE 0.8.0 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20240612_200330_780679_30EBEF08 X-CRM114-Status: GOOD ( 13.43 ) X-BeenThere: linux-mediatek@lists.infradead.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Sender: "Linux-mediatek" Errors-To: linux-mediatek-bounces+linux-mediatek=archiver.kernel.org@lists.infradead.org From: Sean Wang Extend mt7925_mcu_uni_bss_bcnft with 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: Deren Wu Signed-off-by: Deren Wu Signed-off-by: Sean Wang --- drivers/net/wireless/mediatek/mt76/mt7925/mcu.c | 16 ++++++++-------- 1 file changed, 8 insertions(+), 8 deletions(-) diff --git a/drivers/net/wireless/mediatek/mt76/mt7925/mcu.c b/drivers/net/wireless/mediatek/mt76/mt7925/mcu.c index a40ad1578212..8950df09a025 100644 --- a/drivers/net/wireless/mediatek/mt76/mt7925/mcu.c +++ b/drivers/net/wireless/mediatek/mt76/mt7925/mcu.c @@ -1281,10 +1281,10 @@ int mt7925_mcu_uni_bss_ps(struct mt792x_dev *dev, struct ieee80211_vif *vif) } static int -mt7925_mcu_uni_bss_bcnft(struct mt792x_dev *dev, struct ieee80211_vif *vif, - bool enable) +mt7925_mcu_uni_bss_bcnft(struct mt792x_dev *dev, + struct ieee80211_bss_conf *link_conf, bool enable) { - struct mt792x_vif *mvif = (struct mt792x_vif *)vif->drv_priv; + struct mt792x_bss_conf *mconf = mt792x_link_conf_to_mconf(link_conf); struct { struct { u8 bss_idx; @@ -1301,17 +1301,17 @@ mt7925_mcu_uni_bss_bcnft(struct mt792x_dev *dev, struct ieee80211_vif *vif, } __packed bcnft; } __packed bcnft_req = { .hdr = { - .bss_idx = mvif->bss_conf.mt76.idx, + .bss_idx = mconf->mt76.idx, }, .bcnft = { .tag = cpu_to_le16(UNI_BSS_INFO_BCNFT), .len = cpu_to_le16(sizeof(struct bcnft_tlv)), - .bcn_interval = cpu_to_le16(vif->bss_conf.beacon_int), - .dtim_period = vif->bss_conf.dtim_period, + .bcn_interval = cpu_to_le16(link_conf->beacon_int), + .dtim_period = link_conf->dtim_period, }, }; - if (vif->type != NL80211_IFTYPE_STATION) + if (link_conf->vif->type != NL80211_IFTYPE_STATION) return 0; return mt76_mcu_send_msg(&dev->mt76, MCU_UNI_CMD(BSS_INFO_UPDATE), @@ -1685,7 +1685,7 @@ int mt7925_mcu_set_beacon_filter(struct mt792x_dev *dev, int err = 0; if (enable) { - err = mt7925_mcu_uni_bss_bcnft(dev, vif, true); + err = mt7925_mcu_uni_bss_bcnft(dev, &vif->bss_conf, true); if (err) return err; From patchwork Thu Jun 13 03:02:15 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Sean Wang X-Patchwork-Id: 13696054 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from bombadil.infradead.org (bombadil.infradead.org [198.137.202.133]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.lore.kernel.org (Postfix) with ESMTPS id 14DB2C27C53 for ; Thu, 13 Jun 2024 03:03:39 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=lists.infradead.org; s=bombadil.20210309; h=Sender:List-Subscribe:List-Help :List-Post:List-Archive:List-Unsubscribe:List-Id:Content-Transfer-Encoding: MIME-Version:References:In-Reply-To:Message-Id:Date:Subject:Cc:To:From: Reply-To:Content-Type:Content-ID:Content-Description:Resent-Date:Resent-From: Resent-Sender:Resent-To:Resent-Cc:Resent-Message-ID:List-Owner; bh=7m5poBoCf/FKm4KBPm6gYtwcp9bMCiSU6fa4NfX9MgI=; b=DaWy/A30Iou4Rxr9lA8RRxW+pS pali15RvMWuU3WkQBl4NXXc5PcHZLdGB1AfedKZDfJn3EeFSMT8O+41lF6Eyg5CNcgWHWfs2aWsxk ll66+5dGXf5Bj1zqufjUrcmrwNqPZArQxcIPz7Q3eJvlD3q/rtTRGM7ZwlG/gGHMbiOgyf6qkUch2 dkcT96H+C8AjO0Py70voyuKaS8Ai1mWmpJJgJmO8f6tsZFJHJhodcnGuIP89iWGuN+Or+oJZgv/cv 8DRj7Lw907NIJKuEYkobVJ13of6Jxg5FKg1B61QGhEAL13bAYHwTKTy5g3HrLd2U1sbJWiQcZII50 czF6YEzg==; Received: from localhost ([::1] helo=bombadil.infradead.org) by bombadil.infradead.org with esmtp (Exim 4.97.1 #2 (Red Hat Linux)) id 1sHakU-0000000Evuw-2qAV; Thu, 13 Jun 2024 03:03:38 +0000 Received: from mail-oi1-f180.google.com ([209.85.167.180]) by bombadil.infradead.org with esmtps (Exim 4.97.1 #2 (Red Hat Linux)) id 1sHakP-0000000EvqY-0FST for linux-mediatek@lists.infradead.org; Thu, 13 Jun 2024 03:03:35 +0000 Received: by mail-oi1-f180.google.com with SMTP id 5614622812f47-3d1b8bacf67so76850b6e.2 for ; Wed, 12 Jun 2024 20:03:32 -0700 (PDT) X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1718247811; x=1718852611; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:x-gm-message-state:from:to:cc :subject:date:message-id:reply-to; bh=7m5poBoCf/FKm4KBPm6gYtwcp9bMCiSU6fa4NfX9MgI=; b=Zn0gbeNuJwyShveJuzCRXvpQfg4YR27UiXY79+Om2LOgO5Q3E+zAWz74IOnuihSpsU wHDT4J6bQCzg76l12iCeDadAt2Z8GIcmUaaTNIpYX6rZQ8j9l9rYye2jn++EMARK9xNC JARHSTAeX9BvAG2XROJ505fW4lWRDqzjN+yLqMsB18hIKSTCjxNwv2NolxZ4GYMX7GIX BU8PKa5mpV49qGSL/TsFfHzUO8cxrNcEcZ9p2MCsdZwLuITnYrb/vREJiLahBaxu8Aco zz/0ef7rT5OpsUHXYoXucxLP9O1q2q5Aj8mFco/coRuKOcc38OShQVEtYvrdzQJXjW4g +fXg== X-Forwarded-Encrypted: i=1; AJvYcCXa4sm/317mB7J+uyJfSWI2HHydGEieUmhI+vzufJTkY1fBELT0SCj8atGq4wSIodORVNAQgiFrl0PUU16YgvDCjF2fh1sCvl3mgs3M39il91Jm X-Gm-Message-State: AOJu0YzUwLoOQc1Pe2QUouqiCQph/SIjAKOMAlpFXay3wPvmxbvaxWd5 to4sJ25cVkVUFmSmAgEcKVbaQ5ulf+hEWXvPe1ZJv4tMgBkJjDJW X-Google-Smtp-Source: AGHT+IH3VdcAKYywuUVd8RSqNF5vSLpmMq9sWAa41UhcYYob9I0jkUAqyH169yOPlWKe5BmMi2s3rQ== X-Received: by 2002:a05:6820:d88:b0:5ba:ead2:c742 with SMTP id 006d021491bc7-5bb3b7a3d2bmr3671830eaf.0.1718247811382; Wed, 12 Jun 2024 20:03:31 -0700 (PDT) Received: from sean-ThinkPad-T450s.lan ([207.191.35.252]) by smtp.gmail.com with ESMTPSA id 006d021491bc7-5bd629263c5sm67685eaf.46.2024.06.12.20.03.29 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Wed, 12 Jun 2024 20:03:29 -0700 (PDT) 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 21/47] wifi: mt76: mt7925: extend mt7925_mcu_uni_bss_ps for per-link BSS Date: Wed, 12 Jun 2024 20:02:15 -0700 Message-Id: <20240613030241.5771-22-sean.wang@kernel.org> X-Mailer: git-send-email 2.25.1 In-Reply-To: <20240613030241.5771-1-sean.wang@kernel.org> References: <20240613030241.5771-1-sean.wang@kernel.org> MIME-Version: 1.0 X-CRM114-Version: 20100106-BlameMichelson ( TRE 0.8.0 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20240612_200333_151702_1307695A X-CRM114-Status: GOOD ( 12.84 ) X-BeenThere: linux-mediatek@lists.infradead.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Sender: "Linux-mediatek" Errors-To: linux-mediatek-bounces+linux-mediatek=archiver.kernel.org@lists.infradead.org From: Sean Wang Extend mt7925_mcu_uni_bss_ps with 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: Deren Wu Signed-off-by: Deren Wu Signed-off-by: Sean Wang --- drivers/net/wireless/mediatek/mt76/mt7925/main.c | 2 +- drivers/net/wireless/mediatek/mt76/mt7925/mcu.c | 11 ++++++----- drivers/net/wireless/mediatek/mt76/mt7925/mt7925.h | 3 ++- 3 files changed, 9 insertions(+), 7 deletions(-) diff --git a/drivers/net/wireless/mediatek/mt76/mt7925/main.c b/drivers/net/wireless/mediatek/mt76/mt7925/main.c index bba17e51a023..cd20b85109b9 100644 --- a/drivers/net/wireless/mediatek/mt76/mt7925/main.c +++ b/drivers/net/wireless/mediatek/mt76/mt7925/main.c @@ -1383,7 +1383,7 @@ static void mt7925_vif_cfg_changed(struct ieee80211_hw *hw, } if (changed & BSS_CHANGED_PS) - mt7925_mcu_uni_bss_ps(dev, vif); + mt7925_mcu_uni_bss_ps(dev, &vif->bss_conf); mt792x_mutex_release(dev); } diff --git a/drivers/net/wireless/mediatek/mt76/mt7925/mcu.c b/drivers/net/wireless/mediatek/mt76/mt7925/mcu.c index 8950df09a025..7624ec23e064 100644 --- a/drivers/net/wireless/mediatek/mt76/mt7925/mcu.c +++ b/drivers/net/wireless/mediatek/mt76/mt7925/mcu.c @@ -1243,9 +1243,10 @@ int mt7925_mcu_set_eeprom(struct mt792x_dev *dev) } EXPORT_SYMBOL_GPL(mt7925_mcu_set_eeprom); -int mt7925_mcu_uni_bss_ps(struct mt792x_dev *dev, struct ieee80211_vif *vif) +int mt7925_mcu_uni_bss_ps(struct mt792x_dev *dev, + struct ieee80211_bss_conf *link_conf) { - struct mt792x_vif *mvif = (struct mt792x_vif *)vif->drv_priv; + struct mt792x_bss_conf *mconf = mt792x_link_conf_to_mconf(link_conf); struct { struct { u8 bss_idx; @@ -1264,16 +1265,16 @@ int mt7925_mcu_uni_bss_ps(struct mt792x_dev *dev, struct ieee80211_vif *vif) } __packed ps; } __packed ps_req = { .hdr = { - .bss_idx = mvif->bss_conf.mt76.idx, + .bss_idx = mconf->mt76.idx, }, .ps = { .tag = cpu_to_le16(UNI_BSS_INFO_PS), .len = cpu_to_le16(sizeof(struct ps_tlv)), - .ps_state = vif->cfg.ps ? 2 : 0, + .ps_state = link_conf->vif->cfg.ps ? 2 : 0, }, }; - if (vif->type != NL80211_IFTYPE_STATION) + if (link_conf->vif->type != NL80211_IFTYPE_STATION) return -EOPNOTSUPP; return mt76_mcu_send_msg(&dev->mt76, MCU_UNI_CMD(BSS_INFO_UPDATE), diff --git a/drivers/net/wireless/mediatek/mt76/mt7925/mt7925.h b/drivers/net/wireless/mediatek/mt76/mt7925/mt7925.h index 8ab2bb01ba73..ef37951f69d5 100644 --- a/drivers/net/wireless/mediatek/mt76/mt7925/mt7925.h +++ b/drivers/net/wireless/mediatek/mt76/mt7925/mt7925.h @@ -242,7 +242,8 @@ int mt7925_mcu_uni_rx_ba(struct mt792x_dev *dev, bool enable); void mt7925_scan_work(struct work_struct *work); void mt7925_roc_work(struct work_struct *work); -int mt7925_mcu_uni_bss_ps(struct mt792x_dev *dev, struct ieee80211_vif *vif); +int mt7925_mcu_uni_bss_ps(struct mt792x_dev *dev, + struct ieee80211_bss_conf *link_conf); void mt7925_coredump_work(struct work_struct *work); int mt7925_get_txpwr_info(struct mt792x_dev *dev, u8 band_idx, struct mt7925_txpwr *txpwr); From patchwork Thu Jun 13 03:02:16 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Sean Wang X-Patchwork-Id: 13696055 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from bombadil.infradead.org (bombadil.infradead.org [198.137.202.133]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.lore.kernel.org (Postfix) with ESMTPS id B074BC27C6E for ; Thu, 13 Jun 2024 03:03:39 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=lists.infradead.org; s=bombadil.20210309; h=Sender:List-Subscribe:List-Help :List-Post:List-Archive:List-Unsubscribe:List-Id:Content-Transfer-Encoding: MIME-Version:References:In-Reply-To:Message-Id:Date:Subject:Cc:To:From: Reply-To:Content-Type:Content-ID:Content-Description:Resent-Date:Resent-From: Resent-Sender:Resent-To:Resent-Cc:Resent-Message-ID:List-Owner; bh=UGRn4/Wgu/vGKDWZbS0IzrBOwXTYDZC60PiS/4b5DP4=; b=T2B7NTkdakxUd4Sj9y05U/Wtpt NiAqcIGvVVbNelE3Z1DIi0iz1IYq59ZCLoMXqCe7fENsK4blUc9aK8qioEqB9QM5i8d9cIIDn+joF /r1e0T6eIWMcCYUIkekLn0bK9PjQ4FEDJzaeBBrUSmUfelkJqE5ih41VKPaFMK/dtrEbVi0AAEqVs 04ftdLefqyBoCqkhztZUtt6p9qahNm3Yk/6S8lORnxMrFLMbPUaGbW+cnND7N6Q+Lj02UfLTBKe0N 7qSrHBMO0JGy1dlj0WNQhf4mAMgvMK5Sotfo41XPRaeFVM22rGdDX45AraLwwOOZJ16gc5vOtkOk0 /D8dkxag==; Received: from localhost ([::1] helo=bombadil.infradead.org) by bombadil.infradead.org with esmtp (Exim 4.97.1 #2 (Red Hat Linux)) id 1sHakV-0000000EvvS-0QxI; Thu, 13 Jun 2024 03:03:39 +0000 Received: from mail-oo1-f45.google.com ([209.85.161.45]) by bombadil.infradead.org with esmtps (Exim 4.97.1 #2 (Red Hat Linux)) id 1sHakQ-0000000Evrm-3ipr for linux-mediatek@lists.infradead.org; Thu, 13 Jun 2024 03:03:37 +0000 Received: by mail-oo1-f45.google.com with SMTP id 006d021491bc7-5b99ba97d89so25552eaf.1 for ; Wed, 12 Jun 2024 20:03:34 -0700 (PDT) X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1718247813; x=1718852613; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:x-gm-message-state:from:to:cc :subject:date:message-id:reply-to; bh=UGRn4/Wgu/vGKDWZbS0IzrBOwXTYDZC60PiS/4b5DP4=; b=n0CfJP/gHQfQwaAxJvticn7dY+bg6KtV0Psujo+7960f6Zp2eJArv/6y8pLqEk+kjA p7gt6rLW2n3uRVCzAwm3wcalJuqc9/xSbNPzINHhXTJJFz2Rf+NcAarv7mZaGDprxSxe QvEr9Qx2fYXv96qqj0P1cC/hkrlAj9Afnhjh8GUeZWyAtQ9NEtXSg2sTAPOs1QBSaDC0 9N9ivfrSIHrjbl5viwypK9ZvSNmBmFgmUWmQ8yJ6TeNhViQZ8/ML2jx9YiKb34cd5f/t Y7FPv/Xozj/0rHwl74pGxOI3daUuZIVRt0jj4pyJ4i6DyyQ84Sq8PP7DaWAWe8IppW3+ PMJw== X-Forwarded-Encrypted: i=1; AJvYcCU/XKXJd+urKkpwzQOoxHNyk8nlSkzYSPAh5MFCRPCLqaKIDaHe1OL2UJs9ENBMYz2DpJS1fcIU18UJug5lh4Tbh0y8iSQ7oPHI+LDzCXJqkP84 X-Gm-Message-State: AOJu0YyGkHXOPbXnPY+DDO/Za76DRFve9jn37iUjxGOxEuMGmwh3DbSb HU3Tl4E6zI+z1YFTB7mbbaAsBDZ3giI5dBZa7hFYrQOqWuefQbxW X-Google-Smtp-Source: AGHT+IGZZIXSuAtLjTNDDqH8OylfxsZpnDgIc8G0PeqfW+LZ2/hJmFbjT3WLNdavwiiSKTjmqDC1FA== X-Received: by 2002:a05:6820:d88:b0:5ba:ead2:c742 with SMTP id 006d021491bc7-5bb3b7a3d2bmr3671924eaf.0.1718247813511; Wed, 12 Jun 2024 20:03:33 -0700 (PDT) Received: from sean-ThinkPad-T450s.lan ([207.191.35.252]) by smtp.gmail.com with ESMTPSA id 006d021491bc7-5bd629263c5sm67685eaf.46.2024.06.12.20.03.31 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Wed, 12 Jun 2024 20:03:31 -0700 (PDT) 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 Message-Id: <20240613030241.5771-23-sean.wang@kernel.org> X-Mailer: git-send-email 2.25.1 In-Reply-To: <20240613030241.5771-1-sean.wang@kernel.org> References: <20240613030241.5771-1-sean.wang@kernel.org> MIME-Version: 1.0 X-CRM114-Version: 20100106-BlameMichelson ( TRE 0.8.0 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20240612_200335_101522_A32B75B3 X-CRM114-Status: GOOD ( 14.73 ) X-BeenThere: linux-mediatek@lists.infradead.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Sender: "Linux-mediatek" Errors-To: linux-mediatek-bounces+linux-mediatek=archiver.kernel.org@lists.infradead.org From: Sean Wang 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 Signed-off-by: Ming Yen Hsieh Signed-off-by: Sean Wang --- .../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 From patchwork Thu Jun 13 03:02:17 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Sean Wang X-Patchwork-Id: 13696056 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from bombadil.infradead.org (bombadil.infradead.org [198.137.202.133]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.lore.kernel.org (Postfix) with ESMTPS id 3D547C27C53 for ; Thu, 13 Jun 2024 03:03:42 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=lists.infradead.org; s=bombadil.20210309; h=Sender:List-Subscribe:List-Help :List-Post:List-Archive:List-Unsubscribe:List-Id:Content-Transfer-Encoding: MIME-Version:References:In-Reply-To:Message-Id:Date:Subject:Cc:To:From: Reply-To:Content-Type:Content-ID:Content-Description:Resent-Date:Resent-From: Resent-Sender:Resent-To:Resent-Cc:Resent-Message-ID:List-Owner; bh=biE13+3PSSXUiakyN44C2L8O3X99s+HJgpD9eJi/PQg=; b=rYX8uK+88etsKDITlKR0HZyIQs MEpFRpSK0avH1BQ692AmbcRgOU/vHXbuWjgSeqsmBYxiVMATeXSREtMPLWR2sKaEb9y0kVzR/+u5V 0+L3798zP9gioIbQSYNGxIcGjedwnsOx1DMUadNWWHnmlutttQCXAODpELeQ/UxUpPK7jqCoLxOXA 0e3bAXDHVIrqTU/e/3onucyEm256mqMcn2MeFBwGVzVpsOkXpjC+kYlQGHiAHU5pu11pLZ0ppF9b2 62Y8cEkfuMef6g1QSlV30j5adfALbXuDNanpiM2lIgdD31Upg/IvrshoABmt9w6+kFolrlI4mgJMv Bx+gyPbg==; Received: from localhost ([::1] helo=bombadil.infradead.org) by bombadil.infradead.org with esmtp (Exim 4.97.1 #2 (Red Hat Linux)) id 1sHakX-0000000Evx5-3lXx; Thu, 13 Jun 2024 03:03:41 +0000 Received: from mail-oo1-f43.google.com ([209.85.161.43]) by bombadil.infradead.org with esmtps (Exim 4.97.1 #2 (Red Hat Linux)) id 1sHakS-0000000EvtR-2Kt7 for linux-mediatek@lists.infradead.org; Thu, 13 Jun 2024 03:03:40 +0000 Received: by mail-oo1-f43.google.com with SMTP id 006d021491bc7-5b3356fd4f3so38467eaf.1 for ; Wed, 12 Jun 2024 20:03:36 -0700 (PDT) X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1718247816; x=1718852616; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:x-gm-message-state:from:to:cc :subject:date:message-id:reply-to; bh=biE13+3PSSXUiakyN44C2L8O3X99s+HJgpD9eJi/PQg=; b=an7VpW4sZiRVNTfaQgLKlSomb/93y+i+D8EKw01il6vHMXpE5Fm2WmGMPDGp+3wFGZ C6ulzDV1t3VIFIW1jZl36m4oCrjBhC5tYi7eDoiV/3gksohELAgMWNhnQdQy1c9gGS1W 9y1Ejsm4R93+2PiOrgUcKFqWgV+UeMeiTRVsaCEqrZXnO72pP5RNF3CPXbBjhWsYCqJM iL5f7sjiM5Ozs5dgop+2KtF0YfDTH7+ox5WiBC3TnbbOqK7I2QrxSO5qEx4ky9sl50/j UPXtoAkcV7syZYigBInLIhyL8faaXdQXZnZB7jnl97VaIW4amPrZ9Z5DTvxxgn6BVU0P RYoQ== X-Forwarded-Encrypted: i=1; AJvYcCVXRL/paLyI//L6OViAuGqfBPAw2+hU+Ygn9yk2EqXTyAbNzivmjLep6vHosDJqAZt5/PqCagEVnjCrb5zs0Q==@lists.infradead.org X-Gm-Message-State: AOJu0Yz3ZwsWRKFh0BCl6Occ5q/im65pG7MYqTznvEjnRRpt2PCe81Tl 3bg51UPctB2VZGkMonQwPGKrwos138HwNtTiY3ao64h6J612vKFq X-Google-Smtp-Source: AGHT+IFkFw7WYMSBH32cZ5CQVdLeLQ+zq1uxq9mqpQa/H0Fd8SFtYYvVtzEcbAScavH1J1ZMgB2CvA== X-Received: by 2002:a4a:8552:0:b0:5ba:ca86:a025 with SMTP id 006d021491bc7-5bb3b7a9135mr3996561eaf.0.1718247815634; Wed, 12 Jun 2024 20:03:35 -0700 (PDT) Received: from sean-ThinkPad-T450s.lan ([207.191.35.252]) by smtp.gmail.com with ESMTPSA id 006d021491bc7-5bd629263c5sm67685eaf.46.2024.06.12.20.03.33 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Wed, 12 Jun 2024 20:03:34 -0700 (PDT) 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 23/47] wifi: mt76: mt7925: mt7925_mcu_set_chctx rely on mt7925_mcu_bss_rlm_tlv Date: Wed, 12 Jun 2024 20:02:17 -0700 Message-Id: <20240613030241.5771-24-sean.wang@kernel.org> X-Mailer: git-send-email 2.25.1 In-Reply-To: <20240613030241.5771-1-sean.wang@kernel.org> References: <20240613030241.5771-1-sean.wang@kernel.org> MIME-Version: 1.0 X-CRM114-Version: 20100106-BlameMichelson ( TRE 0.8.0 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20240612_200336_694212_4F413DAC X-CRM114-Status: GOOD ( 12.76 ) X-BeenThere: linux-mediatek@lists.infradead.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Sender: "Linux-mediatek" Errors-To: linux-mediatek-bounces+linux-mediatek=archiver.kernel.org@lists.infradead.org From: Sean Wang make mt7925_mcu_set_chctx rely on mt7925_mcu_bss_rlm_tlv to get rid of the redundant code. Signed-off-by: Sean Wang --- .../net/wireless/mediatek/mt76/mt7925/mcu.c | 95 ++++--------------- 1 file changed, 16 insertions(+), 79 deletions(-) diff --git a/drivers/net/wireless/mediatek/mt76/mt7925/mcu.c b/drivers/net/wireless/mediatek/mt76/mt7925/mcu.c index 96b7a9df17d8..9d56013b2f55 100644 --- a/drivers/net/wireless/mediatek/mt76/mt7925/mcu.c +++ b/drivers/net/wireless/mediatek/mt76/mt7925/mcu.c @@ -1974,85 +1974,6 @@ void mt7925_mcu_bss_rlm_tlv(struct sk_buff *skb, struct mt76_phy *phy, req->sco = 3; /* SCB */ } -int mt7925_mcu_set_chctx(struct mt76_phy *phy, struct mt76_vif *mvif, - 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 mt76_dev *mdev = phy->dev; - struct { - struct { - u8 bss_idx; - u8 pad[3]; - } __packed hdr; - struct 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 rlm; - } __packed rlm_req = { - .hdr = { - .bss_idx = mvif->idx, - }, - .rlm = { - .tag = cpu_to_le16(UNI_BSS_INFO_RLM), - .len = cpu_to_le16(sizeof(struct rlm_tlv)), - .control_channel = chandef->chan->hw_value, - .center_chan = ieee80211_frequency_to_channel(freq1), - .center_chan2 = ieee80211_frequency_to_channel(freq2), - .tx_streams = hweight8(phy->antenna_mask), - .ht_op_info = 4, /* set HT 40M allowed */ - .rx_streams = hweight8(phy->antenna_mask), - .band = band, - }, - }; - - switch (chandef->width) { - case NL80211_CHAN_WIDTH_40: - rlm_req.rlm.bw = CMD_CBW_40MHZ; - break; - case NL80211_CHAN_WIDTH_80: - rlm_req.rlm.bw = CMD_CBW_80MHZ; - break; - case NL80211_CHAN_WIDTH_80P80: - rlm_req.rlm.bw = CMD_CBW_8080MHZ; - break; - case NL80211_CHAN_WIDTH_160: - rlm_req.rlm.bw = CMD_CBW_160MHZ; - break; - case NL80211_CHAN_WIDTH_5: - rlm_req.rlm.bw = CMD_CBW_5MHZ; - break; - case NL80211_CHAN_WIDTH_10: - rlm_req.rlm.bw = CMD_CBW_10MHZ; - break; - case NL80211_CHAN_WIDTH_20_NOHT: - case NL80211_CHAN_WIDTH_20: - default: - rlm_req.rlm.bw = CMD_CBW_20MHZ; - rlm_req.rlm.ht_op_info = 0; - break; - } - - if (rlm_req.rlm.control_channel < rlm_req.rlm.center_chan) - rlm_req.rlm.sco = 1; /* SCA */ - else if (rlm_req.rlm.control_channel > rlm_req.rlm.center_chan) - rlm_req.rlm.sco = 3; /* SCB */ - - return mt76_mcu_send_msg(mdev, MCU_UNI_CMD(BSS_INFO_UPDATE), &rlm_req, - sizeof(rlm_req), true); -} - static struct sk_buff * __mt7925_mcu_alloc_bss_req(struct mt76_dev *dev, struct mt76_vif *mvif, int len) { @@ -2070,6 +1991,22 @@ __mt7925_mcu_alloc_bss_req(struct mt76_dev *dev, struct mt76_vif *mvif, int len) return skb; } +int mt7925_mcu_set_chctx(struct mt76_phy *phy, struct mt76_vif *mvif, + struct ieee80211_chanctx_conf *ctx) +{ + struct sk_buff *skb; + + skb = __mt7925_mcu_alloc_bss_req(phy->dev, mvif, + MT7925_BSS_UPDATE_MAX_SIZE); + if (IS_ERR(skb)) + return PTR_ERR(skb); + + mt7925_mcu_bss_rlm_tlv(skb, phy, ctx); + + return mt76_mcu_skb_send_msg(phy->dev, skb, + MCU_UNI_CMD(BSS_INFO_UPDATE), true); +} + static u8 mt7925_get_phy_mode_ext(struct mt76_phy *phy, struct ieee80211_vif *vif, enum nl80211_band band, struct ieee80211_sta *sta) From patchwork Thu Jun 13 03:02:18 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Sean Wang X-Patchwork-Id: 13696057 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from bombadil.infradead.org (bombadil.infradead.org [198.137.202.133]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.lore.kernel.org (Postfix) with ESMTPS id B0169C27C77 for ; Thu, 13 Jun 2024 03:03:44 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=lists.infradead.org; s=bombadil.20210309; h=Sender:List-Subscribe:List-Help :List-Post:List-Archive:List-Unsubscribe:List-Id:Content-Transfer-Encoding: MIME-Version:References:In-Reply-To:Message-Id:Date:Subject:Cc:To:From: Reply-To:Content-Type:Content-ID:Content-Description:Resent-Date:Resent-From: Resent-Sender:Resent-To:Resent-Cc:Resent-Message-ID:List-Owner; bh=Jvwi7Fx3xoxbV9NOG7xyDKaLAxBj0fbFHV1JoEAsvCs=; b=Xc5zFmqQ/NwVaBOTNad/5QkPZI kwDCFdErAcOXekhDG4Sc6na3qu7BcoGMEKj3zeNKEq1RCrxTAjrTeQdfmF5rOCGj2Rk3smSJvYPY8 aCCLzCJtmkIRl6p+t+oSWPY1w82iyvzr0caexXgyGTauQoDcvU3YiYxr3hpLnkAenHu1hlAM8Dtfa QwpcuVMEaU0ifVT/xobEfECiDsuRqCDjwvsq078zSyWMqh6KMIp6guShCE+WFsEXg2SVzw2kqtK6o YD7G3fDU1AxXtfFGFBYGIIIRoC1K/b+3zpJrsgxLmOQDzHYR47Cc2W3SDo1kANbJCohumWYhDfg2O LbI5Bkdg==; Received: from localhost ([::1] helo=bombadil.infradead.org) by bombadil.infradead.org with esmtp (Exim 4.97.1 #2 (Red Hat Linux)) id 1sHaka-0000000Evya-1QoJ; Thu, 13 Jun 2024 03:03:44 +0000 Received: from mail-oa1-f51.google.com ([209.85.160.51]) by bombadil.infradead.org with esmtps (Exim 4.97.1 #2 (Red Hat Linux)) id 1sHakU-0000000Evul-3TPc for linux-mediatek@lists.infradead.org; Thu, 13 Jun 2024 03:03:42 +0000 Received: by mail-oa1-f51.google.com with SMTP id 586e51a60fabf-254976d3327so77712fac.1 for ; Wed, 12 Jun 2024 20:03:38 -0700 (PDT) X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1718247818; x=1718852618; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:x-gm-message-state:from:to:cc :subject:date:message-id:reply-to; bh=Jvwi7Fx3xoxbV9NOG7xyDKaLAxBj0fbFHV1JoEAsvCs=; b=wrsGaQtG+i4nk0FXrCPBZpUqj3gYHxIVkNsVs/OyFb6z956vV3Naf7TyrwtXQxHeCk O9QYO4aV2DkO5Dzs5M3QEEfFPrtE0zcsTO4+NVQA+O8CjBBmxGPn/7Zj/pJrVn6qkdxS 9rOLBXduaRqMuLraF545CWYH0K20NwtcxFIrA519L65LqwzYgreRwe0IjiQsV4Af7b8j TykAkdlfW5nl/ZLB9C35vObX94330HsJwSS0puUsz/ZvbFFaB/AG0gOr9WP5FIZzPAej S7v9wuuWhZ3lnPmouKhDR0zhj4fqyYCa3G++hKUTWf00XAI03r4LOjGCqYgJKG2JNxDG EeFw== X-Forwarded-Encrypted: i=1; AJvYcCXE22dL6ry7VzwmrErl7cab7CetB6/r9vuC0fvEyzW46YPNTA8x6NEgJA6mBWWeo/k2PuyBngjE+tgUktbPuvzMecSWyP0ZNEzM8smVsOfBOGCT X-Gm-Message-State: AOJu0YxRaMT+TLbpgbohSvTI7NGquStPs2yw61WAIzIM2ezvIHPyBPvM fWistZnfo8bhwTgJMB7vKp55pvfm221Qa7NPb7XQgr8dn2BFvBku X-Google-Smtp-Source: AGHT+IGqKH/kAuaGnt4Ilmb7WN9NEAB6zcIR69b034yjIhxRh0d2jGBQAhKQh6F9jeIPASIXgtNNwg== X-Received: by 2002:a4a:8552:0:b0:5ba:ca86:a025 with SMTP id 006d021491bc7-5bb3b7a9135mr3996624eaf.0.1718247817902; Wed, 12 Jun 2024 20:03:37 -0700 (PDT) Received: from sean-ThinkPad-T450s.lan ([207.191.35.252]) by smtp.gmail.com with ESMTPSA id 006d021491bc7-5bd629263c5sm67685eaf.46.2024.06.12.20.03.35 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Wed, 12 Jun 2024 20:03:36 -0700 (PDT) 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 24/47] wifi: mt76: mt7925: extend mt7925_mcu_sta_update for per-link STA Date: Wed, 12 Jun 2024 20:02:18 -0700 Message-Id: <20240613030241.5771-25-sean.wang@kernel.org> X-Mailer: git-send-email 2.25.1 In-Reply-To: <20240613030241.5771-1-sean.wang@kernel.org> References: <20240613030241.5771-1-sean.wang@kernel.org> MIME-Version: 1.0 X-CRM114-Version: 20100106-BlameMichelson ( TRE 0.8.0 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20240612_200338_958650_4501F37E X-CRM114-Status: GOOD ( 15.23 ) X-BeenThere: linux-mediatek@lists.infradead.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Sender: "Linux-mediatek" Errors-To: linux-mediatek-bounces+linux-mediatek=archiver.kernel.org@lists.infradead.org From: Sean Wang Extend mt7925_mcu_sta_update with the per-link STA 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. Signed-off-by: Sean Wang --- .../wireless/mediatek/mt76/mt76_connac_mcu.h | 5 +- .../net/wireless/mediatek/mt76/mt7925/main.c | 6 +-- .../net/wireless/mediatek/mt76/mt7925/mcu.c | 53 +++++++++++-------- .../wireless/mediatek/mt76/mt7925/mt7925.h | 3 +- drivers/net/wireless/mediatek/mt76/mt792x.h | 16 ++++++ 5 files changed, 57 insertions(+), 26 deletions(-) diff --git a/drivers/net/wireless/mediatek/mt76/mt76_connac_mcu.h b/drivers/net/wireless/mediatek/mt76/mt76_connac_mcu.h index e6e8824c828e..2a858b1ca82e 100644 --- a/drivers/net/wireless/mediatek/mt76/mt76_connac_mcu.h +++ b/drivers/net/wireless/mediatek/mt76/mt76_connac_mcu.h @@ -1726,7 +1726,10 @@ enum mt76_sta_info_state { }; struct mt76_sta_cmd_info { - struct ieee80211_sta *sta; + union { + struct ieee80211_sta *sta; + struct ieee80211_link_sta *link_sta; + }; struct mt76_wcid *wcid; struct ieee80211_vif *vif; diff --git a/drivers/net/wireless/mediatek/mt76/mt7925/main.c b/drivers/net/wireless/mediatek/mt76/mt7925/main.c index cd20b85109b9..f3a32fe9a754 100644 --- a/drivers/net/wireless/mediatek/mt76/mt7925/main.c +++ b/drivers/net/wireless/mediatek/mt76/mt7925/main.c @@ -740,7 +740,7 @@ int mt7925_mac_sta_add(struct mt76_dev *mdev, struct ieee80211_vif *vif, mt7925_mcu_add_bss_info(&dev->phy, mvif->bss_conf.mt76.ctx, link_conf, sta, false); - ret = mt7925_mcu_sta_update(dev, sta, vif, true, + ret = mt7925_mcu_sta_update(dev, &sta->deflink, vif, true, MT76_STA_INFO_STATE_NONE); if (ret) return ret; @@ -773,7 +773,7 @@ void mt7925_mac_sta_assoc(struct mt76_dev *mdev, struct ieee80211_vif *vif, MT_WTBL_UPDATE_ADM_COUNT_CLEAR); memset(msta->deflink.airtime_ac, 0, sizeof(msta->deflink.airtime_ac)); - mt7925_mcu_sta_update(dev, sta, vif, true, MT76_STA_INFO_STATE_ASSOC); + mt7925_mcu_sta_update(dev, &sta->deflink, vif, true, MT76_STA_INFO_STATE_ASSOC); mt792x_mutex_release(dev); } @@ -789,7 +789,7 @@ void mt7925_mac_sta_remove(struct mt76_dev *mdev, struct ieee80211_vif *vif, mt76_connac_free_pending_tx_skbs(&dev->pm, &msta->deflink.wcid); mt76_connac_pm_wake(&dev->mphy, &dev->pm); - mt7925_mcu_sta_update(dev, sta, vif, false, MT76_STA_INFO_STATE_NONE); + mt7925_mcu_sta_update(dev, &sta->deflink, vif, false, MT76_STA_INFO_STATE_NONE); mt7925_mac_wtbl_update(dev, msta->deflink.wcid.idx, MT_WTBL_UPDATE_ADM_COUNT_CLEAR); diff --git a/drivers/net/wireless/mediatek/mt76/mt7925/mcu.c b/drivers/net/wireless/mediatek/mt76/mt7925/mcu.c index 9d56013b2f55..9b69b4b178de 100644 --- a/drivers/net/wireless/mediatek/mt76/mt7925/mcu.c +++ b/drivers/net/wireless/mediatek/mt76/mt7925/mcu.c @@ -1628,39 +1628,46 @@ mt7925_mcu_sta_cmd(struct mt76_phy *phy, if (IS_ERR(skb)) return PTR_ERR(skb); - if (info->sta || !info->offload_fw) - mt76_connac_mcu_sta_basic_tlv(dev, skb, info->vif, info->sta, + if (info->link_sta || !info->offload_fw) + mt76_connac_mcu_sta_basic_tlv(dev, skb, info->vif, + info->link_sta->sta, info->enable, info->newly); - if (info->sta && info->enable) { - mt7925_mcu_sta_phy_tlv(skb, info->vif, info->sta); - mt7925_mcu_sta_ht_tlv(skb, info->sta); - mt7925_mcu_sta_vht_tlv(skb, info->sta); - mt76_connac_mcu_sta_uapsd(skb, info->vif, info->sta); - mt7925_mcu_sta_amsdu_tlv(skb, info->vif, info->sta); - mt7925_mcu_sta_he_tlv(skb, info->sta); - mt7925_mcu_sta_he_6g_tlv(skb, info->sta); - mt7925_mcu_sta_eht_tlv(skb, info->sta); - mt7925_mcu_sta_rate_ctrl_tlv(skb, info->vif, info->sta); - mt7925_mcu_sta_state_v2_tlv(phy, skb, info->sta, + if (info->link_sta && info->enable) { + mt7925_mcu_sta_phy_tlv(skb, info->vif, info->link_sta->sta); + mt7925_mcu_sta_ht_tlv(skb, info->link_sta->sta); + mt7925_mcu_sta_vht_tlv(skb, info->link_sta->sta); + mt76_connac_mcu_sta_uapsd(skb, info->vif, info->link_sta->sta); + mt7925_mcu_sta_amsdu_tlv(skb, info->vif, info->link_sta->sta); + mt7925_mcu_sta_he_tlv(skb, info->link_sta->sta); + mt7925_mcu_sta_he_6g_tlv(skb, info->link_sta->sta); + mt7925_mcu_sta_eht_tlv(skb, info->link_sta->sta); + mt7925_mcu_sta_rate_ctrl_tlv(skb, info->vif, + info->link_sta->sta); + mt7925_mcu_sta_state_v2_tlv(phy, skb, info->link_sta->sta, info->vif, info->rcpi, info->state); - mt7925_mcu_sta_mld_tlv(skb, info->vif, info->sta); + 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->sta); + if (info->enable) { + struct ieee80211_sta *sta = info->link_sta ? + info->link_sta->sta : NULL; + + mt7925_mcu_sta_hdr_trans_tlv(skb, info->vif, sta); + } return mt76_mcu_skb_send_msg(dev, skb, info->cmd, true); } -int mt7925_mcu_sta_update(struct mt792x_dev *dev, struct ieee80211_sta *sta, +int mt7925_mcu_sta_update(struct mt792x_dev *dev, + struct ieee80211_link_sta *link_sta, struct ieee80211_vif *vif, bool enable, enum mt76_sta_info_state state) { struct mt792x_vif *mvif = (struct mt792x_vif *)vif->drv_priv; int rssi = -ewma_rssi_read(&mvif->bss_conf.rssi); struct mt76_sta_cmd_info info = { - .sta = sta, + .link_sta = link_sta, .vif = vif, .enable = enable, .cmd = MCU_UNI_CMD(STA_REC_UPDATE), @@ -1669,10 +1676,14 @@ int mt7925_mcu_sta_update(struct mt792x_dev *dev, struct ieee80211_sta *sta, .rcpi = to_rcpi(rssi), }; struct mt792x_sta *msta; + struct mt792x_link_sta *mlink; - msta = sta ? (struct mt792x_sta *)sta->drv_priv : NULL; - info.wcid = msta ? &msta->deflink.wcid : &mvif->sta.deflink.wcid; - info.newly = msta ? state != MT76_STA_INFO_STATE_ASSOC : true; + if (link_sta) { + msta = (struct mt792x_sta *)link_sta->sta->drv_priv; + mlink = mt792x_sta_to_link(msta, link_sta->link_id); + } + info.wcid = link_sta ? &mlink->wcid : &mvif->sta.deflink.wcid; + info.newly = link_sta ? state != MT76_STA_INFO_STATE_ASSOC : true; return mt7925_mcu_sta_cmd(&dev->mphy, &info); } diff --git a/drivers/net/wireless/mediatek/mt76/mt7925/mt7925.h b/drivers/net/wireless/mediatek/mt76/mt7925/mt7925.h index ef37951f69d5..8ec5a3a20202 100644 --- a/drivers/net/wireless/mediatek/mt76/mt7925/mt7925.h +++ b/drivers/net/wireless/mediatek/mt76/mt7925/mt7925.h @@ -195,7 +195,8 @@ int mt7925_run_firmware(struct mt792x_dev *dev); int mt7925_mcu_set_bss_pm(struct mt792x_dev *dev, struct ieee80211_bss_conf *link_conf, bool enable); -int mt7925_mcu_sta_update(struct mt792x_dev *dev, struct ieee80211_sta *sta, +int mt7925_mcu_sta_update(struct mt792x_dev *dev, + struct ieee80211_link_sta *link_sta, struct ieee80211_vif *vif, bool enable, enum mt76_sta_info_state state); int mt7925_mcu_set_chan_info(struct mt792x_phy *phy, u16 tag); diff --git a/drivers/net/wireless/mediatek/mt76/mt792x.h b/drivers/net/wireless/mediatek/mt76/mt792x.h index 9452a3592950..185d56a1db11 100644 --- a/drivers/net/wireless/mediatek/mt76/mt792x.h +++ b/drivers/net/wireless/mediatek/mt76/mt792x.h @@ -94,6 +94,7 @@ struct mt792x_link_sta { struct mt792x_sta { struct mt792x_link_sta deflink; /* must be first */ + struct mt792x_link_sta __rcu *link[IEEE80211_MLD_MAX_NUM_LINKS]; struct mt792x_vif *vif; }; @@ -236,6 +237,21 @@ mt792x_vif_to_link(struct mt792x_vif *mvif, u8 link_id) lockdep_is_held(&mvif->phy->dev->mt76.mutex)); } +static inline struct mt792x_link_sta * +mt792x_sta_to_link(struct mt792x_sta *msta, u8 link_id) +{ + struct ieee80211_vif *vif; + + vif = container_of((void *)msta->vif, struct ieee80211_vif, drv_priv); + + if (!ieee80211_vif_is_mld(vif) || + link_id >= IEEE80211_LINK_UNSPECIFIED) + return &msta->deflink; + + return rcu_dereference_protected(msta->link[link_id], + lockdep_is_held(&msta->vif->phy->dev->mt76.mutex)); +} + static inline struct mt792x_bss_conf * mt792x_link_conf_to_mconf(struct ieee80211_bss_conf *link_conf) { From patchwork Thu Jun 13 03:02:19 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Sean Wang X-Patchwork-Id: 13696058 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from bombadil.infradead.org (bombadil.infradead.org [198.137.202.133]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.lore.kernel.org (Postfix) with ESMTPS id A82D4C27C53 for ; Thu, 13 Jun 2024 03:03:46 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=lists.infradead.org; s=bombadil.20210309; h=Sender:List-Subscribe:List-Help :List-Post:List-Archive:List-Unsubscribe:List-Id:Content-Transfer-Encoding: MIME-Version:References:In-Reply-To:Message-Id:Date:Subject:Cc:To:From: Reply-To:Content-Type:Content-ID:Content-Description:Resent-Date:Resent-From: Resent-Sender:Resent-To:Resent-Cc:Resent-Message-ID:List-Owner; bh=dccZ5/3CuQxaIWTMPM2TCEJVGRDx3lSvYRxYcTANQJs=; b=XxrYV1qcyqE6m18oXLEj2eGjDV FHGv7zidkNEylRuAa20bSVRY726/NQ+AokwQ7/Sj6sMfzPrhVvLVfDSQWlWNGQ078AOS+ycu7Vhtf D3lo/pgVJ1E8GI91sEgQhO1/uuTDnHXocdCxlqOqE67Uli6ZDgL/PpSB2tkVjfCnP4P9jqbOi7lPa SG7eTnaT/KDY8+Zb/uzXJj9FoPeQx86i1vVEM17cGIQkQjwmAqSer2zyGOZNiLy+/Dne5YeJA2ob4 /7+fdWAKnPODEdyfKs5OA2KxFgUlnWTPzZogjiHgYXm9893g+Bny/C/LPPpH0u1OSLPjh5lES+EPq UxqnBbhQ==; Received: from localhost ([::1] helo=bombadil.infradead.org) by bombadil.infradead.org with esmtp (Exim 4.97.1 #2 (Red Hat Linux)) id 1sHakc-0000000Evzn-0oqP; Thu, 13 Jun 2024 03:03:46 +0000 Received: from mail-oo1-f48.google.com ([209.85.161.48]) by bombadil.infradead.org with esmtps (Exim 4.97.1 #2 (Red Hat Linux)) id 1sHakW-0000000Evw8-4BUR for linux-mediatek@lists.infradead.org; Thu, 13 Jun 2024 03:03:44 +0000 Received: by mail-oo1-f48.google.com with SMTP id 006d021491bc7-5bafec9ad2eso25676eaf.0 for ; Wed, 12 Jun 2024 20:03:40 -0700 (PDT) X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1718247820; x=1718852620; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:x-gm-message-state:from:to:cc :subject:date:message-id:reply-to; bh=dccZ5/3CuQxaIWTMPM2TCEJVGRDx3lSvYRxYcTANQJs=; b=ZVAjhBpDc0WbzrDpx+wrSdggMEYDTmSl/JxkEIft2AGv7o6qbDKN3Ava9mmfQ1Y0yG 1szU6DtIOEmMxGUWXsKi479sWvAPCx9RPE8bfWDNAUvfTlDaZMZ50sUWagCnAnV1Ys6W PDcecXqw1Ka/XriV0tN0hagbIjroQE3eJCXHn0YTZwheQmzVmhAQcS73i+9HqyMBFA3t 8daR8zCtrgDju0tOoH46auZVQUPvscpkSTKZX9eOA+ZRPlAIQ+6Dy5VgK0CyarqCKuUl OEg8zjMr8e0egGh0Gz5jWbAiOVCdovUJsFS0sZSwz8dI2RJOeyOESx8f11rihPAiUeLv DN5g== X-Forwarded-Encrypted: i=1; AJvYcCUdqihPz0HBV3QjHLHvIhxLZLp/FDV8MBaQXqr4k3reuLH9Hk1+C9vp2ZJRbRmu0HbmBWmSRH66Iz0fcUAjCbMLromSiVdDoyMlhN3HdRiPzAqg X-Gm-Message-State: AOJu0Ywu5zXCHUixCW0muuF0cKwv0h/1vw+pNdrv4CNBNb/MGj2qoqic ZPgCeq5ZfczKvO47ueEytw4sw/xRcK/1+c851Z07NUsg8Rl5ENBp X-Google-Smtp-Source: AGHT+IEGIjZCwi/Tk7NiS9kdq5f92ZDbUb6ejmQj6BfYAZAXPkv/6SLbnmuPZp8+YJRlocNp/L52eQ== X-Received: by 2002:a05:6820:f49:b0:5bb:815d:e2ab with SMTP id 006d021491bc7-5bb815de308mr3531890eaf.1.1718247819665; Wed, 12 Jun 2024 20:03:39 -0700 (PDT) Received: from sean-ThinkPad-T450s.lan ([207.191.35.252]) by smtp.gmail.com with ESMTPSA id 006d021491bc7-5bd629263c5sm67685eaf.46.2024.06.12.20.03.38 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Wed, 12 Jun 2024 20:03:38 -0700 (PDT) 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 25/47] wifi: mt76: mt7925: extend mt7925_mcu_sta_state_v2_tlv for per-link STA Date: Wed, 12 Jun 2024 20:02:19 -0700 Message-Id: <20240613030241.5771-26-sean.wang@kernel.org> X-Mailer: git-send-email 2.25.1 In-Reply-To: <20240613030241.5771-1-sean.wang@kernel.org> References: <20240613030241.5771-1-sean.wang@kernel.org> MIME-Version: 1.0 X-CRM114-Version: 20100106-BlameMichelson ( TRE 0.8.0 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20240612_200341_062891_3C42B706 X-CRM114-Status: GOOD ( 12.61 ) X-BeenThere: linux-mediatek@lists.infradead.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Sender: "Linux-mediatek" Errors-To: linux-mediatek-bounces+linux-mediatek=archiver.kernel.org@lists.infradead.org From: Sean Wang Extend mt7925_mcu_sta_state_v2_tlv with the per-link STA 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: Ming Yen Hsieh Signed-off-by: Ming Yen Hsieh Co-developed-by: Deren Wu Signed-off-by: Deren Wu Signed-off-by: Sean Wang --- drivers/net/wireless/mediatek/mt76/mt7925/mcu.c | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-) diff --git a/drivers/net/wireless/mediatek/mt76/mt7925/mcu.c b/drivers/net/wireless/mediatek/mt76/mt7925/mcu.c index 9b69b4b178de..45437603763e 100644 --- a/drivers/net/wireless/mediatek/mt76/mt7925/mcu.c +++ b/drivers/net/wireless/mediatek/mt76/mt7925/mcu.c @@ -1540,7 +1540,7 @@ mt7925_mcu_sta_phy_tlv(struct sk_buff *skb, static void mt7925_mcu_sta_state_v2_tlv(struct mt76_phy *mphy, struct sk_buff *skb, - struct ieee80211_sta *sta, + struct ieee80211_link_sta *link_sta, struct ieee80211_vif *vif, u8 rcpi, u8 sta_state) { @@ -1560,9 +1560,9 @@ mt7925_mcu_sta_state_v2_tlv(struct mt76_phy *mphy, struct sk_buff *skb, state = (struct sta_rec_state_v2 *)tlv; state->state = sta_state; - if (sta->deflink.vht_cap.vht_supported) { - state->vht_opmode = sta->deflink.bandwidth; - state->vht_opmode |= sta->deflink.rx_nss << + if (link_sta->vht_cap.vht_supported) { + state->vht_opmode = link_sta->bandwidth; + state->vht_opmode |= link_sta->rx_nss << IEEE80211_OPMODE_NOTIF_RX_NSS_SHIFT; } } @@ -1643,7 +1643,7 @@ mt7925_mcu_sta_cmd(struct mt76_phy *phy, mt7925_mcu_sta_eht_tlv(skb, info->link_sta->sta); mt7925_mcu_sta_rate_ctrl_tlv(skb, info->vif, info->link_sta->sta); - mt7925_mcu_sta_state_v2_tlv(phy, skb, info->link_sta->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); From patchwork Thu Jun 13 03:02:20 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Sean Wang X-Patchwork-Id: 13696059 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from bombadil.infradead.org (bombadil.infradead.org [198.137.202.133]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.lore.kernel.org (Postfix) with ESMTPS id 2ECF5C27C6E for ; Thu, 13 Jun 2024 03:03:49 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=lists.infradead.org; s=bombadil.20210309; h=Sender:List-Subscribe:List-Help :List-Post:List-Archive:List-Unsubscribe:List-Id:Content-Transfer-Encoding: MIME-Version:References:In-Reply-To:Message-Id:Date:Subject:Cc:To:From: Reply-To:Content-Type:Content-ID:Content-Description:Resent-Date:Resent-From: Resent-Sender:Resent-To:Resent-Cc:Resent-Message-ID:List-Owner; bh=fvAGAozLAf9+Dd5l/jq2X8brfnVJfxZN/757XdNNGMA=; b=uHS4WduShmlJzwcUOSciXb1PiA r+IUgBeLRv38Qflhx/cWoDgp357pH73uxSrqRu/rj6ZYXFK4g1AHAZAffkdfQEZe52UFaF9U1ahIN Xk7k3UHduS5PEKu2oySjSGDnmplpDcLgoH/X4fBgVG8oCDCjNamFPAm+S5AeNHjhCRBXCCbBz7T5G UL4ZPFryY9KNex0bYn2EWcmHOUwDrUvnW10EeLEscQPWYlqNIclijfPq9ILfN/b4nTUAfEFtD6GUW zDRKHN5CxxmzESIIRiBVkxnDPdLm3o0dvO7O/gkDa/uiAnHS5r194oRJqs/FnBeLpimhXjytjwiQl S2uMd5EA==; Received: from localhost ([::1] helo=bombadil.infradead.org) by bombadil.infradead.org with esmtp (Exim 4.97.1 #2 (Red Hat Linux)) id 1sHake-0000000Ew1J-3UlT; Thu, 13 Jun 2024 03:03:48 +0000 Received: from mail-oi1-f171.google.com ([209.85.167.171]) by bombadil.infradead.org with esmtps (Exim 4.97.1 #2 (Red Hat Linux)) id 1sHakZ-0000000EvxT-0a01 for linux-mediatek@lists.infradead.org; Thu, 13 Jun 2024 03:03:45 +0000 Received: by mail-oi1-f171.google.com with SMTP id 5614622812f47-3d21a80b8ceso76358b6e.3 for ; Wed, 12 Jun 2024 20:03:42 -0700 (PDT) X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1718247822; x=1718852622; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:x-gm-message-state:from:to:cc :subject:date:message-id:reply-to; bh=fvAGAozLAf9+Dd5l/jq2X8brfnVJfxZN/757XdNNGMA=; b=uSaELGjBdX8TZBxWrA5NDqlVX3Hff0BpFK1IaZpxf8M56B80Zoc7M8Rnytfu/MlyLQ gjeKhygxbnrsVjvuk1ypQiIkrFxlmkyK1aKjmogFHkZBxdTENLEgqekB+96YSoBMhyh6 csvv87dHzGw58bZROXcTMg0aN17dce+omA3FoX3aT6YgAs88dFyDE67ktwq7kPyICGxY pKB1NjybWsXdlGTF43HkykFQ11y4MQ1wifnYm4yzn+pJAE0b5QdnWItBN9aKp3Mm5FCM 9a06sZEwOW9mYAd7I4h5ql4h3O+nwboq1Brah/fKsXFiKtsABTdtvE9wIsiPoI2LzSy9 H9Og== X-Forwarded-Encrypted: i=1; AJvYcCVLNh1vglc3fK+QTeAF8VwbLMcAbPV+rtYjQQzpAk30uxkXov3SDT5I6Sztui9Z7ypaXcHsXmUUhA+NYHstsWCCXXt+FLO77FYlkqfYf1FJOoz7 X-Gm-Message-State: AOJu0YyCT7oQruW+MeHJPqPiK6blKLzQG6mXWgATi9qSQXv9RKXmIOZy boo5J3IlWb7CmCWKPadEBQlzEPLH2cCQleoKC4HP7j37EQONQzf1 X-Google-Smtp-Source: AGHT+IGpMQ5S/mhrKCSARUVCIn4Jo9kDC1V91P56i1wTQJz8siUBroHJtRJ4cj+F8W+b4BJC3NgdeA== X-Received: by 2002:a05:6820:f49:b0:5bb:815d:e2ab with SMTP id 006d021491bc7-5bb815de308mr3531966eaf.1.1718247821798; Wed, 12 Jun 2024 20:03:41 -0700 (PDT) Received: from sean-ThinkPad-T450s.lan ([207.191.35.252]) by smtp.gmail.com with ESMTPSA id 006d021491bc7-5bd629263c5sm67685eaf.46.2024.06.12.20.03.39 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Wed, 12 Jun 2024 20:03:40 -0700 (PDT) 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 26/47] wifi: mt76: mt7925: extend mt7925_mcu_sta_rate_ctrl_tlv with per-link STA Date: Wed, 12 Jun 2024 20:02:20 -0700 Message-Id: <20240613030241.5771-27-sean.wang@kernel.org> X-Mailer: git-send-email 2.25.1 In-Reply-To: <20240613030241.5771-1-sean.wang@kernel.org> References: <20240613030241.5771-1-sean.wang@kernel.org> MIME-Version: 1.0 X-CRM114-Version: 20100106-BlameMichelson ( TRE 0.8.0 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20240612_200343_262486_3193B547 X-CRM114-Status: GOOD ( 12.31 ) X-BeenThere: linux-mediatek@lists.infradead.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Sender: "Linux-mediatek" Errors-To: linux-mediatek-bounces+linux-mediatek=archiver.kernel.org@lists.infradead.org From: Sean Wang Extend mt7925_mcu_sta_rate_ctrl_tlv with the per-link STA 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: Ming Yen Hsieh Signed-off-by: Ming Yen Hsieh Co-developed-by: Deren Wu Signed-off-by: Deren Wu Signed-off-by: Sean Wang --- drivers/net/wireless/mediatek/mt76/mt7925/mcu.c | 11 ++++++----- 1 file changed, 6 insertions(+), 5 deletions(-) diff --git a/drivers/net/wireless/mediatek/mt76/mt7925/mcu.c b/drivers/net/wireless/mediatek/mt76/mt7925/mcu.c index 45437603763e..266010c0e00a 100644 --- a/drivers/net/wireless/mediatek/mt76/mt7925/mcu.c +++ b/drivers/net/wireless/mediatek/mt76/mt7925/mcu.c @@ -1569,7 +1569,8 @@ mt7925_mcu_sta_state_v2_tlv(struct mt76_phy *mphy, struct sk_buff *skb, static void mt7925_mcu_sta_rate_ctrl_tlv(struct sk_buff *skb, - struct ieee80211_vif *vif, struct ieee80211_sta *sta) + struct ieee80211_vif *vif, + struct ieee80211_link_sta *link_sta) { struct mt792x_vif *mvif = (struct mt792x_vif *)vif->drv_priv; struct cfg80211_chan_def *chandef = &mvif->bss_conf.mt76.ctx->def; @@ -1581,7 +1582,7 @@ mt7925_mcu_sta_rate_ctrl_tlv(struct sk_buff *skb, tlv = mt76_connac_mcu_add_tlv(skb, STA_REC_RA, sizeof(*ra_info)); ra_info = (struct sta_rec_ra_info *)tlv; - supp_rates = sta->deflink.supp_rates[band]; + supp_rates = link_sta->supp_rates[band]; if (band == NL80211_BAND_2GHZ) supp_rates = FIELD_PREP(RA_LEGACY_OFDM, supp_rates >> 4) | FIELD_PREP(RA_LEGACY_CCK, supp_rates & 0xf); @@ -1590,9 +1591,9 @@ mt7925_mcu_sta_rate_ctrl_tlv(struct sk_buff *skb, ra_info->legacy = cpu_to_le16(supp_rates); - if (sta->deflink.ht_cap.ht_supported) + if (link_sta->ht_cap.ht_supported) memcpy(ra_info->rx_mcs_bitmask, - sta->deflink.ht_cap.mcs.rx_mask, + link_sta->ht_cap.mcs.rx_mask, HT_MCS_MASK_NUM); } @@ -1642,7 +1643,7 @@ mt7925_mcu_sta_cmd(struct mt76_phy *phy, mt7925_mcu_sta_he_6g_tlv(skb, info->link_sta->sta); mt7925_mcu_sta_eht_tlv(skb, info->link_sta->sta); mt7925_mcu_sta_rate_ctrl_tlv(skb, info->vif, - info->link_sta->sta); + info->link_sta); mt7925_mcu_sta_state_v2_tlv(phy, skb, info->link_sta, info->vif, info->rcpi, info->state); From patchwork Thu Jun 13 03:02:21 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Sean Wang X-Patchwork-Id: 13696060 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from bombadil.infradead.org (bombadil.infradead.org [198.137.202.133]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.lore.kernel.org (Postfix) with ESMTPS id E57F0C27C53 for ; Thu, 13 Jun 2024 03:03:50 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=lists.infradead.org; s=bombadil.20210309; h=Sender:List-Subscribe:List-Help :List-Post:List-Archive:List-Unsubscribe:List-Id:Content-Transfer-Encoding: MIME-Version:References:In-Reply-To:Message-Id:Date:Subject:Cc:To:From: Reply-To:Content-Type:Content-ID:Content-Description:Resent-Date:Resent-From: Resent-Sender:Resent-To:Resent-Cc:Resent-Message-ID:List-Owner; bh=uQSrmyJur9VJtGLBvyCZFOXsDoRyiS3K1mbJIGVLmGY=; b=mOSQev5iSdvda2zqZK86MPCVRO 2d4HgRQHgjDXgYJkPd/8jo3p76Kx8W2QT/RnJUNa/4JmI0x2GSiRolZwzEGMFC8Cv41tskEhS26w8 9U3nFTeaVZ6Y5WcJoaJsx0iaikrJQggAnaTx7dC3Hk/D/MbYEMFKG5mluTVGutca8EZ0TLyGl/NsR PAW2Q79kaulXyhLuFxUCwzPKSMr3xem//JjTnvg/ocuvrUnqkYzHmX1zAIQPDe/bNWZjn1KPh8eJh sfOvlGbNoGR00KuUSbJxQXo7zSz5EjcCMH5h+wtAcq2JnoeXpPKZVlhAGtXqpV0v6gjkwWYG0vJnd 20R0Aw4A==; Received: from localhost ([::1] helo=bombadil.infradead.org) by bombadil.infradead.org with esmtp (Exim 4.97.1 #2 (Red Hat Linux)) id 1sHakg-0000000Ew2R-29bU; Thu, 13 Jun 2024 03:03:50 +0000 Received: from mail-oo1-f52.google.com ([209.85.161.52]) by bombadil.infradead.org with esmtps (Exim 4.97.1 #2 (Red Hat Linux)) id 1sHakb-0000000EvyY-1zV9 for linux-mediatek@lists.infradead.org; Thu, 13 Jun 2024 03:03:48 +0000 Received: by mail-oo1-f52.google.com with SMTP id 006d021491bc7-5b97f09cde3so43146eaf.0 for ; Wed, 12 Jun 2024 20:03:44 -0700 (PDT) X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1718247824; x=1718852624; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:x-gm-message-state:from:to:cc :subject:date:message-id:reply-to; bh=uQSrmyJur9VJtGLBvyCZFOXsDoRyiS3K1mbJIGVLmGY=; b=IXsPWF5lRROcGpRw0iquRLmpFxcmaNHIfD44Xa7KTqQecLH61LzlUR/3d63nfVNCv1 RhzeWBCPHfwHtsjPg5POoJqWk/+iXUDo6cIQn9HazlJXxfBvOUXUqrt1LelQD5pgwlty uwbrQtUcXUrrGKnXTu1AyqAJNMtAvojDWwlXjVkSApl7VgKs9SPLMfVulH96o3qcXv32 VuwUsLI+1jaElp4NAMYcY5Ex96ja7mONsp5yN3yrpwF+qohZlR8YGM0cz/IRWWKnPwY+ Wb86Gnh9tHxo7HUbeWCJQWmNM5vrrVHBvfElZw5TKj6w+8hZ9sI+FgXBc+y//NrOK6FH szYA== X-Forwarded-Encrypted: i=1; AJvYcCVwEGHSBgN4AMZjzHyS7HJg1vMzAlYr/yxjy2sD1PsLXbEuaPyL5fM9/NlXueAS+xC/1lKj0dHTdSAonGxiSDneNJu9ls2JhLrpqY5WZVRB/h69 X-Gm-Message-State: AOJu0YxyzVqsbc1kou/12bgcbWNx5ZsioA/zY4ZLRPLHjtbEdtZ0eiBG bnXTShRvvW2yWjRm48KQTW3BACOMJDGLCDqM8KVTmC8IkIxD/c70 X-Google-Smtp-Source: AGHT+IEQwqpW1E/BUpJ0H742faaHw0baC1m9x6eKJRhLlzj4oh0zMKhrV7eM1ZIuaJf1+DJyS56xTQ== X-Received: by 2002:a4a:d196:0:b0:5bd:87a0:66d with SMTP id 006d021491bc7-5bd87a01b93mr286160eaf.1.1718247823766; Wed, 12 Jun 2024 20:03:43 -0700 (PDT) Received: from sean-ThinkPad-T450s.lan ([207.191.35.252]) by smtp.gmail.com with ESMTPSA id 006d021491bc7-5bd629263c5sm67685eaf.46.2024.06.12.20.03.42 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Wed, 12 Jun 2024 20:03:42 -0700 (PDT) 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 27/47] wifi: mt76: mt7925: extend mt7925_mcu_sta_eht_tlv for per-link STA Date: Wed, 12 Jun 2024 20:02:21 -0700 Message-Id: <20240613030241.5771-28-sean.wang@kernel.org> X-Mailer: git-send-email 2.25.1 In-Reply-To: <20240613030241.5771-1-sean.wang@kernel.org> References: <20240613030241.5771-1-sean.wang@kernel.org> MIME-Version: 1.0 X-CRM114-Version: 20100106-BlameMichelson ( TRE 0.8.0 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20240612_200345_635685_B7327EA0 X-CRM114-Status: GOOD ( 11.86 ) X-BeenThere: linux-mediatek@lists.infradead.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Sender: "Linux-mediatek" Errors-To: linux-mediatek-bounces+linux-mediatek=archiver.kernel.org@lists.infradead.org From: Sean Wang Extend mt7925_mcu_sta_eht_tlv with the per-link STA 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: Ming Yen Hsieh Signed-off-by: Ming Yen Hsieh Co-developed-by: Deren Wu Signed-off-by: Deren Wu Signed-off-by: Sean Wang --- drivers/net/wireless/mediatek/mt76/mt7925/mcu.c | 12 ++++++------ 1 file changed, 6 insertions(+), 6 deletions(-) diff --git a/drivers/net/wireless/mediatek/mt76/mt7925/mcu.c b/drivers/net/wireless/mediatek/mt76/mt7925/mcu.c index 266010c0e00a..0c9cebd3ee71 100644 --- a/drivers/net/wireless/mediatek/mt76/mt7925/mcu.c +++ b/drivers/net/wireless/mediatek/mt76/mt7925/mcu.c @@ -1404,18 +1404,18 @@ mt7925_mcu_sta_he_6g_tlv(struct sk_buff *skb, struct ieee80211_sta *sta) } static void -mt7925_mcu_sta_eht_tlv(struct sk_buff *skb, struct ieee80211_sta *sta) +mt7925_mcu_sta_eht_tlv(struct sk_buff *skb, struct ieee80211_link_sta *link_sta) { struct ieee80211_eht_mcs_nss_supp *mcs_map; struct ieee80211_eht_cap_elem_fixed *elem; struct sta_rec_eht *eht; struct tlv *tlv; - if (!sta->deflink.eht_cap.has_eht) + if (!link_sta->eht_cap.has_eht) return; - mcs_map = &sta->deflink.eht_cap.eht_mcs_nss_supp; - elem = &sta->deflink.eht_cap.eht_cap_elem; + mcs_map = &link_sta->eht_cap.eht_mcs_nss_supp; + elem = &link_sta->eht_cap.eht_cap_elem; tlv = mt76_connac_mcu_add_tlv(skb, STA_REC_EHT, sizeof(*eht)); @@ -1425,7 +1425,7 @@ mt7925_mcu_sta_eht_tlv(struct sk_buff *skb, struct ieee80211_sta *sta) eht->phy_cap = cpu_to_le64(*(u64 *)elem->phy_cap_info); eht->phy_cap_ext = cpu_to_le64(elem->phy_cap_info[8]); - if (sta->deflink.bandwidth == IEEE80211_STA_RX_BW_20) + if (link_sta->bandwidth == IEEE80211_STA_RX_BW_20) memcpy(eht->mcs_map_bw20, &mcs_map->only_20mhz, sizeof(eht->mcs_map_bw20)); memcpy(eht->mcs_map_bw80, &mcs_map->bw._80, sizeof(eht->mcs_map_bw80)); memcpy(eht->mcs_map_bw160, &mcs_map->bw._160, sizeof(eht->mcs_map_bw160)); @@ -1641,7 +1641,7 @@ mt7925_mcu_sta_cmd(struct mt76_phy *phy, mt7925_mcu_sta_amsdu_tlv(skb, info->vif, info->link_sta->sta); mt7925_mcu_sta_he_tlv(skb, info->link_sta->sta); mt7925_mcu_sta_he_6g_tlv(skb, info->link_sta->sta); - mt7925_mcu_sta_eht_tlv(skb, info->link_sta->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, From patchwork Thu Jun 13 03:02:22 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Sean Wang X-Patchwork-Id: 13696061 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from bombadil.infradead.org (bombadil.infradead.org [198.137.202.133]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.lore.kernel.org (Postfix) with ESMTPS id 78FCEC27C6E for ; Thu, 13 Jun 2024 03:03:51 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=lists.infradead.org; s=bombadil.20210309; h=Sender:List-Subscribe:List-Help :List-Post:List-Archive:List-Unsubscribe:List-Id:Content-Transfer-Encoding: MIME-Version:References:In-Reply-To:Message-Id:Date:Subject:Cc:To:From: Reply-To:Content-Type:Content-ID:Content-Description:Resent-Date:Resent-From: Resent-Sender:Resent-To:Resent-Cc:Resent-Message-ID:List-Owner; bh=uoEs7B6T1gVNEXMq3665UB7KgLCGFV0A9uQvetVLP78=; b=oho3W4sYFZ0BeydslgXOrERGi/ PkbF9RpEUN3RYcs7ddd1Lfu9A50uwoePAB5La5nN/fI4Fm/NMgh8gV2w5B5fEipoMtgexO91qnDV9 /pLu9s8uLqmCoWWA6DazpNO9tTHkHOSsaOZVgzZk7mUbfj4AZRcPloLS7w6ZYeqjLb+/NITo7a3ur ymd73FCxFfWwEhOZQ4URHRIv1zuCHbz53VSVUae1/cKX77FGpya/lHUUTUUgGutWgy2QuooJZHNpD 2+hDGnDMlIYRtjCB4J/voKvg/az2H3bJGc6y1aA1E7OBxYQ0gT/czBIHi1UpyzjaNt4+HaP20q2kD eeKGgfRw==; Received: from localhost ([::1] helo=bombadil.infradead.org) by bombadil.infradead.org with esmtp (Exim 4.97.1 #2 (Red Hat Linux)) id 1sHakh-0000000Ew2s-04jJ; Thu, 13 Jun 2024 03:03:51 +0000 Received: from mail-oo1-f41.google.com ([209.85.161.41]) by bombadil.infradead.org with esmtps (Exim 4.97.1 #2 (Red Hat Linux)) id 1sHakc-0000000Ew00-2eQk for linux-mediatek@lists.infradead.org; Thu, 13 Jun 2024 03:03:49 +0000 Received: by mail-oo1-f41.google.com with SMTP id 006d021491bc7-5bb10cfe7daso36872eaf.2 for ; Wed, 12 Jun 2024 20:03:46 -0700 (PDT) X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1718247826; x=1718852626; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:x-gm-message-state:from:to:cc :subject:date:message-id:reply-to; bh=uoEs7B6T1gVNEXMq3665UB7KgLCGFV0A9uQvetVLP78=; b=Jb7CG0fZXao1W6JvNRotvMO8D2Yjy/XfEKyDVkQUJdGxuuhlMmlm5XiYjQHRAfvlB/ YFQyrvAikvvakXwZGA7zvZGa+v4g6goc8YwWVE8ut2Sn7FqY6YGvuSuN+aoJUA0rOXU4 VMO9+McAdGMnK22BGmMitwUusUIi0FOFk5gMRNBDCtz4aE03HuHTuKK3EWDmMwDLmI9g WQ0b8izQvsjJqysCcc6v+ieV1PvEMPjX1jbz4kEuxxBjQTobQnmQxnuCMA2e/qWOHGuj TtXBIkNdPxjViIBrXi2YGKVVqgDkvj/NVfek1QF1kXemACHhPutOK3D7UPbHVhdojP6K 02cQ== X-Forwarded-Encrypted: i=1; AJvYcCUrTcNSbcs0ki294DFNTT8L2oCjlF2+sz80KYIDFRvePm0MacCUpTsVO5agrmFu8Wc+Tl2d/jjl2oyw2Q/94k6b8nJ2PZNt7ETL53yzJQVfknq8 X-Gm-Message-State: AOJu0Ywx49T3IC5AD4+VVoWP24VNHMXoXw7wF/60zUMeXpIoWJ6tTKRf 5qInM4cFq/vJt0IWJva6YDlynj7Ta9OBbrUWsCSzgEXMxL7S6OLCOZw1jfLNHOk= X-Google-Smtp-Source: AGHT+IEN8+hwX0caiHOXoNsbUeCYOepGoMV0RHhVHb9esDQ1cKY7FqH5AHqh3LPL9I2YtyitVrYS3A== X-Received: by 2002:a4a:d196:0:b0:5bd:87a0:66d with SMTP id 006d021491bc7-5bd87a01b93mr286222eaf.1.1718247825880; Wed, 12 Jun 2024 20:03:45 -0700 (PDT) Received: from sean-ThinkPad-T450s.lan ([207.191.35.252]) by smtp.gmail.com with ESMTPSA id 006d021491bc7-5bd629263c5sm67685eaf.46.2024.06.12.20.03.43 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Wed, 12 Jun 2024 20:03:44 -0700 (PDT) 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 28/47] wifi: mt76: mt7925: extend mt7925_mcu_sta_he_6g_tlv for per-link STA Date: Wed, 12 Jun 2024 20:02:22 -0700 Message-Id: <20240613030241.5771-29-sean.wang@kernel.org> X-Mailer: git-send-email 2.25.1 In-Reply-To: <20240613030241.5771-1-sean.wang@kernel.org> References: <20240613030241.5771-1-sean.wang@kernel.org> MIME-Version: 1.0 X-CRM114-Version: 20100106-BlameMichelson ( TRE 0.8.0 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20240612_200346_708052_B3E3D832 X-CRM114-Status: GOOD ( 11.17 ) X-BeenThere: linux-mediatek@lists.infradead.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Sender: "Linux-mediatek" Errors-To: linux-mediatek-bounces+linux-mediatek=archiver.kernel.org@lists.infradead.org From: Sean Wang Extend mt7925_mcu_sta_he_6g_tlv with the per-link STA 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: Ming Yen Hsieh Signed-off-by: Ming Yen Hsieh Co-developed-by: Deren Wu Signed-off-by: Deren Wu Signed-off-by: Sean Wang --- drivers/net/wireless/mediatek/mt76/mt7925/mcu.c | 9 +++++---- 1 file changed, 5 insertions(+), 4 deletions(-) diff --git a/drivers/net/wireless/mediatek/mt76/mt7925/mcu.c b/drivers/net/wireless/mediatek/mt76/mt7925/mcu.c index 0c9cebd3ee71..e1dc8452468c 100644 --- a/drivers/net/wireless/mediatek/mt76/mt7925/mcu.c +++ b/drivers/net/wireless/mediatek/mt76/mt7925/mcu.c @@ -1389,18 +1389,19 @@ mt7925_mcu_sta_he_tlv(struct sk_buff *skb, struct ieee80211_sta *sta) } static void -mt7925_mcu_sta_he_6g_tlv(struct sk_buff *skb, struct ieee80211_sta *sta) +mt7925_mcu_sta_he_6g_tlv(struct sk_buff *skb, + struct ieee80211_link_sta *link_sta) { struct sta_rec_he_6g_capa *he_6g; struct tlv *tlv; - if (!sta->deflink.he_6ghz_capa.capa) + if (!link_sta->he_6ghz_capa.capa) return; tlv = mt76_connac_mcu_add_tlv(skb, STA_REC_HE_6G, sizeof(*he_6g)); he_6g = (struct sta_rec_he_6g_capa *)tlv; - he_6g->capa = sta->deflink.he_6ghz_capa.capa; + he_6g->capa = link_sta->he_6ghz_capa.capa; } static void @@ -1640,7 +1641,7 @@ mt7925_mcu_sta_cmd(struct mt76_phy *phy, mt76_connac_mcu_sta_uapsd(skb, info->vif, info->link_sta->sta); mt7925_mcu_sta_amsdu_tlv(skb, info->vif, info->link_sta->sta); mt7925_mcu_sta_he_tlv(skb, info->link_sta->sta); - mt7925_mcu_sta_he_6g_tlv(skb, info->link_sta->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); From patchwork Thu Jun 13 03:02:23 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Sean Wang X-Patchwork-Id: 13696062 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from bombadil.infradead.org (bombadil.infradead.org [198.137.202.133]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.lore.kernel.org (Postfix) with ESMTPS id F0DE7C27C53 for ; Thu, 13 Jun 2024 03:03:55 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=lists.infradead.org; s=bombadil.20210309; h=Sender:List-Subscribe:List-Help :List-Post:List-Archive:List-Unsubscribe:List-Id:Content-Transfer-Encoding: MIME-Version:References:In-Reply-To:Message-Id:Date:Subject:Cc:To:From: Reply-To:Content-Type:Content-ID:Content-Description:Resent-Date:Resent-From: Resent-Sender:Resent-To:Resent-Cc:Resent-Message-ID:List-Owner; bh=l4rId6s/qmy89OdkA2iSIQ271sV1Ry06U/w402v2yWU=; b=IlVLvDcTS+hQiYICD1CeYKueOq eOmzbqg3Uez9L4i3pccaP7TxL1uLWIAGKKz0BdloK0LgzR3C7tgMUkb31U99kOrCt30mhmEGQxB2s F+lIDOVO7RWTS1Ym0i8oX1Y952pd7UmE0fQ8trdI2ktVnNZNC+iyUiPVgNty0riftwBayDpDsXIlC bbjc9P11f3yRF7RZhG1lZD8nNAA3EpXwwg/Fr2+vI7e0ityVv8Uf1V5D7yU3IwQdGcbcmvvaMWz65 VjTFhzKhK0OqeljFOLGE4AwWbAHcieTRGw3e/VbEj1+6NEGIMkonxTwUC+Mp6tjjnXHYAaTWKZmO8 IgKguUeQ==; Received: from localhost ([::1] helo=bombadil.infradead.org) by bombadil.infradead.org with esmtp (Exim 4.97.1 #2 (Red Hat Linux)) id 1sHakl-0000000Ew5f-2A4a; Thu, 13 Jun 2024 03:03:55 +0000 Received: from mail-oi1-f179.google.com ([209.85.167.179]) by bombadil.infradead.org with esmtps (Exim 4.97.1 #2 (Red Hat Linux)) id 1sHake-0000000Ew11-3xL4 for linux-mediatek@lists.infradead.org; Thu, 13 Jun 2024 03:03:51 +0000 Received: by mail-oi1-f179.google.com with SMTP id 5614622812f47-3d21c5b48f5so75205b6e.0 for ; Wed, 12 Jun 2024 20:03:48 -0700 (PDT) X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1718247828; x=1718852628; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:x-gm-message-state:from:to:cc :subject:date:message-id:reply-to; bh=l4rId6s/qmy89OdkA2iSIQ271sV1Ry06U/w402v2yWU=; b=ACdU6b/iN7EvYmcFa53HMffw0fIeiIKaC4+iVyfY4OWsGatX/dvXH+gzFcsc23wTy1 oRCvDPeAxw8Hy3YPmfN8gxCBwewUudr8ROMVkvRFOKcQQ3C+bwsDJkUBnoH3fR4HGTDy GxX2T5GCGFCCsPSPSjqjm+eBf/3KlXJRU4TJ2yVMLy6LCSVrNXkCdZm7dpRnCGWMAzUz uqJW+t+gRk38+6h9VdKPYhU9DfIuYEMXcJqARZF0HkzBBUrZPKd6NsXsaj5ZJvD3tJ2R iy58rOnqzNieNyAgZTZbliTYJZaDwK1WPypubBCaLVRkh5WeiVMVkq7lgReMoI5/0TRC Mh+A== X-Forwarded-Encrypted: i=1; AJvYcCXTe//WshjsosTq/3VuDwIwavH5QCafurtsyG9OfoNa7cux8vKlqlb5x3g208oDuAepyI/1XUqgWQwmJcc3TKOgSchGKq84dN7WCqpjjDYG5xVz X-Gm-Message-State: AOJu0YzHVXixUFMeFrXLPHZb/911C5m6XKxwYik2i/0+HHqaOe5K5XTP hsEHowKXGPHntS/k3b2nPT80cu2sY4JIlA6b+LuSab+F6Mj0hRGd X-Google-Smtp-Source: AGHT+IEpyH6w/EK2iWtAObLb4d3oRuoEuMedN2czPvggkOCgAvhOzzTMDXr5KCZ9o4tV5qlS9hho0Q== X-Received: by 2002:a05:6820:d88:b0:5ba:ead2:c742 with SMTP id 006d021491bc7-5bb3b7a3d2bmr3672524eaf.0.1718247827596; Wed, 12 Jun 2024 20:03:47 -0700 (PDT) Received: from sean-ThinkPad-T450s.lan ([207.191.35.252]) by smtp.gmail.com with ESMTPSA id 006d021491bc7-5bd629263c5sm67685eaf.46.2024.06.12.20.03.46 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Wed, 12 Jun 2024 20:03:46 -0700 (PDT) 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 29/47] wifi: mt76: mt7925: extend mt7925_mcu_sta_he_tlv for per-link STA Date: Wed, 12 Jun 2024 20:02:23 -0700 Message-Id: <20240613030241.5771-30-sean.wang@kernel.org> X-Mailer: git-send-email 2.25.1 In-Reply-To: <20240613030241.5771-1-sean.wang@kernel.org> References: <20240613030241.5771-1-sean.wang@kernel.org> MIME-Version: 1.0 X-CRM114-Version: 20100106-BlameMichelson ( TRE 0.8.0 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20240612_200349_126692_FE9C4BAB X-CRM114-Status: GOOD ( 11.16 ) X-BeenThere: linux-mediatek@lists.infradead.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Sender: "Linux-mediatek" Errors-To: linux-mediatek-bounces+linux-mediatek=archiver.kernel.org@lists.infradead.org From: Sean Wang Extend mt7925_mcu_sta_he_tlv with the per-link STA 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: Ming Yen Hsieh Signed-off-by: Ming Yen Hsieh Co-developed-by: Deren Wu Signed-off-by: Deren Wu Signed-off-by: Sean Wang --- drivers/net/wireless/mediatek/mt76/mt7925/mcu.c | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/drivers/net/wireless/mediatek/mt76/mt7925/mcu.c b/drivers/net/wireless/mediatek/mt76/mt7925/mcu.c index e1dc8452468c..a57620aed63b 100644 --- a/drivers/net/wireless/mediatek/mt76/mt7925/mcu.c +++ b/drivers/net/wireless/mediatek/mt76/mt7925/mcu.c @@ -1380,12 +1380,12 @@ mt7925_mcu_set_bss_pm(struct mt792x_dev *dev, } static void -mt7925_mcu_sta_he_tlv(struct sk_buff *skb, struct ieee80211_sta *sta) +mt7925_mcu_sta_he_tlv(struct sk_buff *skb, struct ieee80211_link_sta *link_sta) { - if (!sta->deflink.he_cap.has_he) + if (!link_sta->he_cap.has_he) return; - mt76_connac_mcu_sta_he_tlv_v2(skb, sta); + mt76_connac_mcu_sta_he_tlv_v2(skb, link_sta->sta); } static void @@ -1640,7 +1640,7 @@ mt7925_mcu_sta_cmd(struct mt76_phy *phy, mt7925_mcu_sta_vht_tlv(skb, info->link_sta->sta); mt76_connac_mcu_sta_uapsd(skb, info->vif, info->link_sta->sta); mt7925_mcu_sta_amsdu_tlv(skb, info->vif, info->link_sta->sta); - mt7925_mcu_sta_he_tlv(skb, info->link_sta->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, From patchwork Thu Jun 13 03:02:24 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Sean Wang X-Patchwork-Id: 13696064 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from bombadil.infradead.org (bombadil.infradead.org [198.137.202.133]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.lore.kernel.org (Postfix) with ESMTPS id A207DC27C6E for ; Thu, 13 Jun 2024 03:03:58 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=lists.infradead.org; s=bombadil.20210309; h=Sender:List-Subscribe:List-Help :List-Post:List-Archive:List-Unsubscribe:List-Id:Content-Transfer-Encoding: MIME-Version:References:In-Reply-To:Message-Id:Date:Subject:Cc:To:From: Reply-To:Content-Type:Content-ID:Content-Description:Resent-Date:Resent-From: Resent-Sender:Resent-To:Resent-Cc:Resent-Message-ID:List-Owner; bh=sHk3C2PwpK+oygytSYiJpUDeuuAoM9zKNfmYXO0m1ZQ=; b=zSIL1XPy/dxWnRpOTkRiLNiEZx 6AG7yQCGMjQttbbfVRIHCSfSI7BtrsNjrESusRXaZXuPX1uVlCYmx9dqfjRxLPhEU5ZFI30Rmf8jx 17HI2JQO+OBJjk5ci9pwzzW3dZEiHDYRPRECs1m9sRZe8zkVFW55eqT3cP2F0elh8aLZDtpaKazx+ VXY4QwzrQuFgRIeJaxGHGkiFmXY0vTlNfS1Z1BCy9tQ+sudVPY32hQblSW2z8AFy24nXo+d/eJUeN tab2DToB+//poBgk8K1NK0Db/9vi/zbU3IK5szujJws+feDc25QFKwuvl8y+yc5AhJHfbax1Bjljh r5YY1fvA==; Received: from localhost ([::1] helo=bombadil.infradead.org) by bombadil.infradead.org with esmtp (Exim 4.97.1 #2 (Red Hat Linux)) id 1sHako-0000000Ew7M-13uX; Thu, 13 Jun 2024 03:03:58 +0000 Received: from mail-oi1-f181.google.com ([209.85.167.181]) by bombadil.infradead.org with esmtps (Exim 4.97.1 #2 (Red Hat Linux)) id 1sHakg-0000000Ew2I-3OTq for linux-mediatek@lists.infradead.org; Thu, 13 Jun 2024 03:03:56 +0000 Received: by mail-oi1-f181.google.com with SMTP id 5614622812f47-3d21c5b48f5so75208b6e.0 for ; Wed, 12 Jun 2024 20:03:50 -0700 (PDT) X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1718247829; x=1718852629; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:x-gm-message-state:from:to:cc :subject:date:message-id:reply-to; bh=sHk3C2PwpK+oygytSYiJpUDeuuAoM9zKNfmYXO0m1ZQ=; b=S4hL2PY+TRe6JUd1cysSQ+35BYt0hdkGDNIM7ao6hcChEmWkSZ41raVjI6PYiO7dYd Qbqtncw2aiwchSAspparW8YarK7pcwdnI/eIRxQ5hmyKcl+QcJ+IUVfF3ZQTFD7b5c+o s/KMirUw0m89Q2RWvSJ3YuuGb4CUBJXJC3Zh4657YWx/0/fx2lfIvvlw8g9rbUYzWtyL zW0dNzm5k+pU1NP7SxGU2V1mUBgilZLeYV4yeZ14BZrhZMIfBJYnTJJq7WkuMrcRgFr1 OKuP81Fg+rV6b4Cd+lKiONw8rH8iYfgOzbHXE0O4dMhyvhbw295yngbDTPBPHGvDGYYJ qoRA== X-Forwarded-Encrypted: i=1; AJvYcCWeJItbeqHYdOPxRei81Zp4BrdO3kZzKyqRTZQdSwGZHlJfwdqD2MyABA64hTkF+47/7pgc35KG71k+Ak5ZyuYiYfgrXDJ8KSAwvnYXq6OSlyRx X-Gm-Message-State: AOJu0Yw8BraaaI5WpGwgs4L+y3VthVchPXfdKzE+DMifm2hgnWn2AbkO vdGqJOoXUcfe5FxcIflxGtrmPbvpNfbQ48iJ1nEyZasvUiVrCupn X-Google-Smtp-Source: AGHT+IEOfTMldWJhfu6oE3jsE+ovd09HiMqJ50xG/cVQ1nKISjkL9wPBGCmp2S8krtzhzoEZy2hTyA== X-Received: by 2002:a05:6820:f49:b0:5bb:815d:e2ab with SMTP id 006d021491bc7-5bb815de308mr3532229eaf.1.1718247829399; Wed, 12 Jun 2024 20:03:49 -0700 (PDT) Received: from sean-ThinkPad-T450s.lan ([207.191.35.252]) by smtp.gmail.com with ESMTPSA id 006d021491bc7-5bd629263c5sm67685eaf.46.2024.06.12.20.03.47 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Wed, 12 Jun 2024 20:03:48 -0700 (PDT) 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 30/47] wifi: mt76: mt7925: extend mt7925_mcu_sta_amsdu_tlv for per-link STA Date: Wed, 12 Jun 2024 20:02:24 -0700 Message-Id: <20240613030241.5771-31-sean.wang@kernel.org> X-Mailer: git-send-email 2.25.1 In-Reply-To: <20240613030241.5771-1-sean.wang@kernel.org> References: <20240613030241.5771-1-sean.wang@kernel.org> MIME-Version: 1.0 X-CRM114-Version: 20100106-BlameMichelson ( TRE 0.8.0 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20240612_200351_057475_6BC1570E X-CRM114-Status: GOOD ( 12.22 ) X-BeenThere: linux-mediatek@lists.infradead.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Sender: "Linux-mediatek" Errors-To: linux-mediatek-bounces+linux-mediatek=archiver.kernel.org@lists.infradead.org From: Sean Wang Extend mt7925_mcu_sta_amsdu_tlv with the per-link STA 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: Ming Yen Hsieh Signed-off-by: Ming Yen Hsieh Co-developed-by: Deren Wu Signed-off-by: Deren Wu Signed-off-by: Sean Wang --- drivers/net/wireless/mediatek/mt76/mt7925/mcu.c | 16 ++++++++++------ 1 file changed, 10 insertions(+), 6 deletions(-) diff --git a/drivers/net/wireless/mediatek/mt76/mt7925/mcu.c b/drivers/net/wireless/mediatek/mt76/mt7925/mcu.c index a57620aed63b..57b89eca4e21 100644 --- a/drivers/net/wireless/mediatek/mt76/mt7925/mcu.c +++ b/drivers/net/wireless/mediatek/mt76/mt7925/mcu.c @@ -1467,9 +1467,11 @@ mt7925_mcu_sta_vht_tlv(struct sk_buff *skb, struct ieee80211_sta *sta) static void mt7925_mcu_sta_amsdu_tlv(struct sk_buff *skb, - struct ieee80211_vif *vif, struct ieee80211_sta *sta) + struct ieee80211_vif *vif, + struct ieee80211_link_sta *link_sta) { - struct mt792x_sta *msta = (struct mt792x_sta *)sta->drv_priv; + struct mt792x_sta *msta = (struct mt792x_sta *)link_sta->sta->drv_priv; + struct mt792x_link_sta *mlink; struct sta_rec_amsdu *amsdu; struct tlv *tlv; @@ -1477,16 +1479,18 @@ mt7925_mcu_sta_amsdu_tlv(struct sk_buff *skb, vif->type != NL80211_IFTYPE_AP) return; - if (!sta->deflink.agg.max_amsdu_len) + if (!link_sta->agg.max_amsdu_len) return; tlv = mt76_connac_mcu_add_tlv(skb, STA_REC_HW_AMSDU, sizeof(*amsdu)); amsdu = (struct sta_rec_amsdu *)tlv; amsdu->max_amsdu_num = 8; amsdu->amsdu_en = true; - msta->deflink.wcid.amsdu = true; - switch (sta->deflink.agg.max_amsdu_len) { + mlink = mt792x_sta_to_link(msta, link_sta->link_id); + mlink->wcid.amsdu = true; + + switch (link_sta->agg.max_amsdu_len) { case IEEE80211_MAX_MPDU_LEN_VHT_11454: amsdu->max_mpdu_size = IEEE80211_VHT_CAP_MAX_MPDU_LENGTH_11454; @@ -1639,7 +1643,7 @@ mt7925_mcu_sta_cmd(struct mt76_phy *phy, mt7925_mcu_sta_ht_tlv(skb, info->link_sta->sta); mt7925_mcu_sta_vht_tlv(skb, info->link_sta->sta); mt76_connac_mcu_sta_uapsd(skb, info->vif, info->link_sta->sta); - mt7925_mcu_sta_amsdu_tlv(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); From patchwork Thu Jun 13 03:02:25 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Sean Wang X-Patchwork-Id: 13696063 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from bombadil.infradead.org (bombadil.infradead.org [198.137.202.133]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.lore.kernel.org (Postfix) with ESMTPS id 195D2C27C53 for ; Thu, 13 Jun 2024 03:03:59 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=lists.infradead.org; s=bombadil.20210309; h=Sender:List-Subscribe:List-Help :List-Post:List-Archive:List-Unsubscribe:List-Id:Content-Transfer-Encoding: MIME-Version:References:In-Reply-To:Message-Id:Date:Subject:Cc:To:From: Reply-To:Content-Type:Content-ID:Content-Description:Resent-Date:Resent-From: Resent-Sender:Resent-To:Resent-Cc:Resent-Message-ID:List-Owner; bh=nOSh1Koddm2iaRVlRwReJq6F4ShEOJmpd3jAFp1dhAY=; b=3lvervYI7X9o5V5t/RaPXH+U8s YcZLK9qv0JGs4fIqtcVx5LXPflYXP0JJFFlf/lmRDKsTRzQneUrXW8vx69If/ret3nE5LfJKzNVva pKhVQ9iHPPKNM/pA3WtnAev3vQn+sgPx76Oipm6mqFBGTQnotLn0s/wc02PMgbpwN+ninlmN5swg3 kyNX3PdvKGwEUy9l0uFP9iBLtxFfKZ8Jwm6FRumjWkDbHtIPSZAko55kPpRQPnXtS14g5ifPG65q2 Elcj2ym+J1PfbhHiWxLo4izw5a03B+iNsleT9r/5I6RZ85w8bjbjwYK+GNyerVWbEEbXBgue+6m4Q wW9XMBbQ==; Received: from localhost ([::1] helo=bombadil.infradead.org) by bombadil.infradead.org with esmtp (Exim 4.97.1 #2 (Red Hat Linux)) id 1sHako-0000000Ew7p-2oCa; Thu, 13 Jun 2024 03:03:58 +0000 Received: from mail-oa1-f42.google.com ([209.85.160.42]) by bombadil.infradead.org with esmtps (Exim 4.97.1 #2 (Red Hat Linux)) id 1sHakj-0000000Ew44-09OS for linux-mediatek@lists.infradead.org; Thu, 13 Jun 2024 03:03:56 +0000 Received: by mail-oa1-f42.google.com with SMTP id 586e51a60fabf-254925e6472so70161fac.0 for ; Wed, 12 Jun 2024 20:03:52 -0700 (PDT) X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1718247832; x=1718852632; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:x-gm-message-state:from:to:cc :subject:date:message-id:reply-to; bh=nOSh1Koddm2iaRVlRwReJq6F4ShEOJmpd3jAFp1dhAY=; b=s99PNCHlfajh0KRZ0ZPrIAH+0r8ETLNLElteSICpV1sv4vta4qkD2viEScFE6b1ea4 Kk8U46CZj31gr9pZ6lRdTJxNKxThAhuG4weGl0OGYt4iIAg00aVE6QcE97MRfkkzf5Nc SWuzJ85Uq+ym/Xup7ooCR1sJDvwVqSWkTn9sfftH4inecu+jvu5g1XoJ70JCnI/j3VZ2 EjPYQf3f1Dn+HLUW84yJ2Nx0ofRu7PsEHBPWaKrEpQYElrjSsLj0GHetRVl8z2YP4TL9 RIH5FHCjI7TSuey41QdlHhnyhmeg+9J0fUXL1ufiiM8QEsGE4Stwze9HU8dqK+b9ny4R Fohg== X-Forwarded-Encrypted: i=1; AJvYcCULgHSMPbTdp3aWmn95N1EII2R1acgLYpJGpAArn3xevOStRtxeeG/2LKFzgDLD99p+/fFgO8VVIPCciQEsig==@lists.infradead.org X-Gm-Message-State: AOJu0Ywqoqi1Vmxj2CTZxhQnz2h0swPEqEZWRxBaZ+gIDqjr6UJmUuiW E4KH5lJ27ymp3HsbeXNAbggJ4dujho237qD4Z5MdnPc8jSC1LmDYcHPkmqyRVA8= X-Google-Smtp-Source: AGHT+IGYCITyDhyJlZeMrVfawcG1NciHKDp7xm3y+tBp9yG1rxv/rqOikcaa9EXWVR3TN44OA71leQ== X-Received: by 2002:a05:6820:b0b:b0:5ba:c4ed:ee98 with SMTP id 006d021491bc7-5bb3b7a4c51mr3590579eaf.0.1718247831716; Wed, 12 Jun 2024 20:03:51 -0700 (PDT) Received: from sean-ThinkPad-T450s.lan ([207.191.35.252]) by smtp.gmail.com with ESMTPSA id 006d021491bc7-5bd629263c5sm67685eaf.46.2024.06.12.20.03.49 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Wed, 12 Jun 2024 20:03:49 -0700 (PDT) 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 31/47] wifi: mt76: mt7925: extend mt7925_mcu_sta_vht_tlv for per-link STA Date: Wed, 12 Jun 2024 20:02:25 -0700 Message-Id: <20240613030241.5771-32-sean.wang@kernel.org> X-Mailer: git-send-email 2.25.1 In-Reply-To: <20240613030241.5771-1-sean.wang@kernel.org> References: <20240613030241.5771-1-sean.wang@kernel.org> MIME-Version: 1.0 X-CRM114-Version: 20100106-BlameMichelson ( TRE 0.8.0 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20240612_200354_183918_D59CCD22 X-CRM114-Status: GOOD ( 12.16 ) X-BeenThere: linux-mediatek@lists.infradead.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Sender: "Linux-mediatek" Errors-To: linux-mediatek-bounces+linux-mediatek=archiver.kernel.org@lists.infradead.org From: Sean Wang Extend mt7925_mcu_sta_vht_tlv with the per-link STA 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: Ming Yen Hsieh Signed-off-by: Ming Yen Hsieh Co-developed-by: Deren Wu Signed-off-by: Deren Wu Signed-off-by: Sean Wang --- drivers/net/wireless/mediatek/mt76/mt7925/mcu.c | 12 ++++++------ 1 file changed, 6 insertions(+), 6 deletions(-) diff --git a/drivers/net/wireless/mediatek/mt76/mt7925/mcu.c b/drivers/net/wireless/mediatek/mt76/mt7925/mcu.c index 57b89eca4e21..1b66dd26bd1e 100644 --- a/drivers/net/wireless/mediatek/mt76/mt7925/mcu.c +++ b/drivers/net/wireless/mediatek/mt76/mt7925/mcu.c @@ -1448,21 +1448,21 @@ mt7925_mcu_sta_ht_tlv(struct sk_buff *skb, struct ieee80211_sta *sta) } static void -mt7925_mcu_sta_vht_tlv(struct sk_buff *skb, struct ieee80211_sta *sta) +mt7925_mcu_sta_vht_tlv(struct sk_buff *skb, struct ieee80211_link_sta *link_sta) { struct sta_rec_vht *vht; struct tlv *tlv; /* For 6G band, this tlv is necessary to let hw work normally */ - if (!sta->deflink.he_6ghz_capa.capa && !sta->deflink.vht_cap.vht_supported) + if (!link_sta->he_6ghz_capa.capa && !link_sta->vht_cap.vht_supported) return; tlv = mt76_connac_mcu_add_tlv(skb, STA_REC_VHT, sizeof(*vht)); vht = (struct sta_rec_vht *)tlv; - vht->vht_cap = cpu_to_le32(sta->deflink.vht_cap.cap); - vht->vht_rx_mcs_map = sta->deflink.vht_cap.vht_mcs.rx_mcs_map; - vht->vht_tx_mcs_map = sta->deflink.vht_cap.vht_mcs.tx_mcs_map; + vht->vht_cap = cpu_to_le32(link_sta->vht_cap.cap); + vht->vht_rx_mcs_map = link_sta->vht_cap.vht_mcs.rx_mcs_map; + vht->vht_tx_mcs_map = link_sta->vht_cap.vht_mcs.tx_mcs_map; } static void @@ -1641,7 +1641,7 @@ mt7925_mcu_sta_cmd(struct mt76_phy *phy, if (info->link_sta && info->enable) { mt7925_mcu_sta_phy_tlv(skb, info->vif, info->link_sta->sta); mt7925_mcu_sta_ht_tlv(skb, info->link_sta->sta); - mt7925_mcu_sta_vht_tlv(skb, info->link_sta->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); From patchwork Thu Jun 13 03:02:26 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Sean Wang X-Patchwork-Id: 13696065 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from bombadil.infradead.org (bombadil.infradead.org [198.137.202.133]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.lore.kernel.org (Postfix) with ESMTPS id BF934C27C53 for ; Thu, 13 Jun 2024 03:04:02 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=lists.infradead.org; s=bombadil.20210309; h=Sender:List-Subscribe:List-Help :List-Post:List-Archive:List-Unsubscribe:List-Id:Content-Transfer-Encoding: MIME-Version:References:In-Reply-To:Message-Id:Date:Subject:Cc:To:From: Reply-To:Content-Type:Content-ID:Content-Description:Resent-Date:Resent-From: Resent-Sender:Resent-To:Resent-Cc:Resent-Message-ID:List-Owner; bh=h7OsvxRZu1eH3rdvc+37NIE+pK4g9A8AD+jv6tlQz/U=; b=soHDjUn6Rgd5yXlOmBBUi7sjyT mPmpp8wGmx7UsXSMy+yPxNMjduHEixqjnv4RuOQZBHB1LP5O2B2kSIh43/aYpAz2GvejTxwM6bZ/q iQN4FBmx5KGa41tAW+lrxBhdi6BqJ112korjHHtFudqHG6trzMra8GxpYEvwplGqZU9U8EaRc55dI xzItKkOlvOkeRvmyQHfE7zfa9WjxPcwKeIy9WuHvQ8LLY4INdtHK+MVkOXZbXsTDfxkgYJPXCINRW vs//eSv9u+eUQtUQeY1Yz81kUGIpgwEpPDHzZmYD+D84kdQ9WQKay6KJp0gUqjnFDvIQzNCmq3Ev/ R/iMdykQ==; Received: from localhost ([::1] helo=bombadil.infradead.org) by bombadil.infradead.org with esmtp (Exim 4.97.1 #2 (Red Hat Linux)) id 1sHaks-0000000EwA0-1C9Z; Thu, 13 Jun 2024 03:04:02 +0000 Received: from mail-oa1-f50.google.com ([209.85.160.50]) by bombadil.infradead.org with esmtps (Exim 4.97.1 #2 (Red Hat Linux)) id 1sHakl-0000000Ew5F-1O3R for linux-mediatek@lists.infradead.org; Thu, 13 Jun 2024 03:03:58 +0000 Received: by mail-oa1-f50.google.com with SMTP id 586e51a60fabf-24c5ec50da1so92087fac.3 for ; Wed, 12 Jun 2024 20:03:54 -0700 (PDT) X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1718247834; x=1718852634; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:x-gm-message-state:from:to:cc :subject:date:message-id:reply-to; bh=h7OsvxRZu1eH3rdvc+37NIE+pK4g9A8AD+jv6tlQz/U=; b=ume4VPkrKNu9hia8kB3FNDAt3FhIxJM6rEal9Av4K94zH+IVKuTcMLFjKkR+zaF32/ YSyh+dah76RfZBlgWm6n0iA46fUrkYeiwo6DCH5tibZKa+bfo7Q9pFpEbdq6OAuARgKS 0T8ZEHj/02sIkaKu3DXjx+UD/zWmABLmCrUASIWafvE8/N0VkiQJLfCCqYDoPvqyP8nP W3SHen6zvlpYG70+VkxDZxDXz0Is0GQBwjP/JyU2jgokViYbyOPIIeDzJgGkqfQKdKkI eoeBsyTxDMSSnFyzpdnnevrlk69LMgwyfZpgeI1tzd+26gxqjzzBevFwZBK/Yv/6Wya2 1wGg== X-Forwarded-Encrypted: i=1; AJvYcCW1CugMAkAjK0IW4TefSSRMdGVLVCAj/O8q0+NbSrmLvaCIpa2fqtJ4TyBrlaYp6N5qsZVAoipRBpYFPrKAHg==@lists.infradead.org X-Gm-Message-State: AOJu0Yy7EpKh1x0nUyFeasFGtMEkmdxZOVIg2uPViDtDSJF0227GJKGV H3wnk2zkUDKkp86jzb4KY1cilyC9mU+pv3Oqi91dX3f//yR3r1P8 X-Google-Smtp-Source: AGHT+IE5cSfFw0Tv8T3gXQeOhSzuuOvBA5v7PhZB9lPUmMjA6fWy7PnkWJW0q3qEHs38JHYZsnq3kw== X-Received: by 2002:a4a:d196:0:b0:5bd:87a0:66d with SMTP id 006d021491bc7-5bd87a01b93mr286464eaf.1.1718247833853; Wed, 12 Jun 2024 20:03:53 -0700 (PDT) Received: from sean-ThinkPad-T450s.lan ([207.191.35.252]) by smtp.gmail.com with ESMTPSA id 006d021491bc7-5bd629263c5sm67685eaf.46.2024.06.12.20.03.51 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Wed, 12 Jun 2024 20:03:52 -0700 (PDT) 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 32/47] wifi: mt76: mt7925: extend mt7925_mcu_sta_ht_tlv for per-link STA Date: Wed, 12 Jun 2024 20:02:26 -0700 Message-Id: <20240613030241.5771-33-sean.wang@kernel.org> X-Mailer: git-send-email 2.25.1 In-Reply-To: <20240613030241.5771-1-sean.wang@kernel.org> References: <20240613030241.5771-1-sean.wang@kernel.org> MIME-Version: 1.0 X-CRM114-Version: 20100106-BlameMichelson ( TRE 0.8.0 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20240612_200355_455380_81519F0C X-CRM114-Status: GOOD ( 11.61 ) X-BeenThere: linux-mediatek@lists.infradead.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Sender: "Linux-mediatek" Errors-To: linux-mediatek-bounces+linux-mediatek=archiver.kernel.org@lists.infradead.org From: Sean Wang Extend mt7925_mcu_sta_ht_tlv with the per-link STA 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: Ming Yen Hsieh Signed-off-by: Ming Yen Hsieh Co-developed-by: Deren Wu Signed-off-by: Deren Wu Signed-off-by: Sean Wang --- drivers/net/wireless/mediatek/mt76/mt7925/mcu.c | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/drivers/net/wireless/mediatek/mt76/mt7925/mcu.c b/drivers/net/wireless/mediatek/mt76/mt7925/mcu.c index 1b66dd26bd1e..66d45d676739 100644 --- a/drivers/net/wireless/mediatek/mt76/mt7925/mcu.c +++ b/drivers/net/wireless/mediatek/mt76/mt7925/mcu.c @@ -1433,18 +1433,18 @@ mt7925_mcu_sta_eht_tlv(struct sk_buff *skb, struct ieee80211_link_sta *link_sta) } static void -mt7925_mcu_sta_ht_tlv(struct sk_buff *skb, struct ieee80211_sta *sta) +mt7925_mcu_sta_ht_tlv(struct sk_buff *skb, struct ieee80211_link_sta *link_sta) { struct sta_rec_ht *ht; struct tlv *tlv; - if (!sta->deflink.ht_cap.ht_supported) + if (!link_sta->ht_cap.ht_supported) return; tlv = mt76_connac_mcu_add_tlv(skb, STA_REC_HT, sizeof(*ht)); ht = (struct sta_rec_ht *)tlv; - ht->ht_cap = cpu_to_le16(sta->deflink.ht_cap.cap); + ht->ht_cap = cpu_to_le16(link_sta->ht_cap.cap); } static void @@ -1640,7 +1640,7 @@ mt7925_mcu_sta_cmd(struct mt76_phy *phy, info->enable, info->newly); if (info->link_sta && info->enable) { mt7925_mcu_sta_phy_tlv(skb, info->vif, info->link_sta->sta); - mt7925_mcu_sta_ht_tlv(skb, info->link_sta->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); From patchwork Thu Jun 13 03:02:27 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Sean Wang X-Patchwork-Id: 13696066 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from bombadil.infradead.org (bombadil.infradead.org [198.137.202.133]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.lore.kernel.org (Postfix) with ESMTPS id 131D7C27C77 for ; Thu, 13 Jun 2024 03:04:03 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=lists.infradead.org; s=bombadil.20210309; h=Sender:List-Subscribe:List-Help :List-Post:List-Archive:List-Unsubscribe:List-Id:Content-Transfer-Encoding: MIME-Version:References:In-Reply-To:Message-Id:Date:Subject:Cc:To:From: Reply-To:Content-Type:Content-ID:Content-Description:Resent-Date:Resent-From: Resent-Sender:Resent-To:Resent-Cc:Resent-Message-ID:List-Owner; bh=nye+j/7qGy0YUA+JVCM3jZJLUrkoBzYEWb5GNp1RVTA=; b=Oa6kSH3agD3eg9uHKD+Ld07d7s YKnGr1Ds4Jaqlf2eum37vMJachLOKfZP+vne/oxOazMNU6A7zDg+fEkUUlB63mg5IR1+RwM1zrv+6 0IQM1uPr0vbxKvnNDcWgnIb8SHr1eBRFhRb6CFYQPzsm36vh/FrXXObY1XuYYhOo37GG77Hw55CpV YalE3W7YAxaDjlCjvXTKvhXBjMqH0/QLXNr4RjryAC5cdGLuSizs0Dk84xTADY2zgQYRQfrH9Ot5Z JMMva/h27tu+qxZU4gRkLFVAMScwQ+Jpt76kRcToatb3O2b4QQIpFQJQr362MHIIg5YCKXtTl4bVf hU9vmuxQ==; Received: from localhost ([::1] helo=bombadil.infradead.org) by bombadil.infradead.org with esmtp (Exim 4.97.1 #2 (Red Hat Linux)) id 1sHaks-0000000EwAN-2xIC; Thu, 13 Jun 2024 03:04:02 +0000 Received: from mail-oi1-f175.google.com ([209.85.167.175]) by bombadil.infradead.org with esmtps (Exim 4.97.1 #2 (Red Hat Linux)) id 1sHakm-0000000Ew6O-49ox for linux-mediatek@lists.infradead.org; Thu, 13 Jun 2024 03:03:59 +0000 Received: by mail-oi1-f175.google.com with SMTP id 5614622812f47-3d21c5b48f5so75220b6e.0 for ; Wed, 12 Jun 2024 20:03:56 -0700 (PDT) X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1718247836; x=1718852636; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:x-gm-message-state:from:to:cc :subject:date:message-id:reply-to; bh=nye+j/7qGy0YUA+JVCM3jZJLUrkoBzYEWb5GNp1RVTA=; b=iiYVUGaZkFsIJgcmSPDH1Qwl69y0mXE7e9Pa6DnjdQ/WEcew6ljcAc0VNlzy+LwsBL RJNVVDWzjfFftrcoh4pVXpcnu4QHqovARPfy/hZITAOO4PoMEyYgMMZI2MofpshadCcM 851N98FFXwUrQYbaCxiSBG71vseeMludmBNVuWJcNO3TPZYwJN51XUlaA3+1eV/cmu8y ck5PJN5kQ0XR9pKUNC+2OEmjGLdGGvb6OrmgXXT2UvOokuimedCECE1IDD+hGb+uwG0F lCpv6iYhz+JC62380bajZPqkvvjT3U8twD/nY6jIak976NT0iPsEdQBf52C0GMk+SX/S FGfg== X-Forwarded-Encrypted: i=1; AJvYcCUgJNvHZQaOuCGnv4mupZ8SMtZx8jbfwGaIr0bNy0SgefpMMkryRtT2LsGhktJ+M3CqvQ/XJkoFwcPtoIIxo7kR7zL+IV3hlMjFXj11+LEQlIwT X-Gm-Message-State: AOJu0YyEsYLNoDgFbozUWBCLKL3gX2jm9tu0ZFFaK2PiKPvlOvlFyRB7 /s2mm65Oc3+qgqBiTp2SiAdSHait8CWArjyD2d4mDsuKbTgayB89 X-Google-Smtp-Source: AGHT+IGqVf629ydu9/AlFHfkI+1bnq4OcapyfrCu+zhwMgh2RiZt82PM5g9cxvOIWlbsU+N3cPN4Bg== X-Received: by 2002:a05:6820:d88:b0:5ba:ead2:c742 with SMTP id 006d021491bc7-5bb3b7a3d2bmr3672840eaf.0.1718247835702; Wed, 12 Jun 2024 20:03:55 -0700 (PDT) Received: from sean-ThinkPad-T450s.lan ([207.191.35.252]) by smtp.gmail.com with ESMTPSA id 006d021491bc7-5bd629263c5sm67685eaf.46.2024.06.12.20.03.54 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Wed, 12 Jun 2024 20:03:54 -0700 (PDT) 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 33/47] wifi: mt76: mt7925: extend mt7925_mcu_sta_phy_tlv for per-link STA Date: Wed, 12 Jun 2024 20:02:27 -0700 Message-Id: <20240613030241.5771-34-sean.wang@kernel.org> X-Mailer: git-send-email 2.25.1 In-Reply-To: <20240613030241.5771-1-sean.wang@kernel.org> References: <20240613030241.5771-1-sean.wang@kernel.org> MIME-Version: 1.0 X-CRM114-Version: 20100106-BlameMichelson ( TRE 0.8.0 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20240612_200357_062474_C4950BD1 X-CRM114-Status: GOOD ( 12.44 ) X-BeenThere: linux-mediatek@lists.infradead.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Sender: "Linux-mediatek" Errors-To: linux-mediatek-bounces+linux-mediatek=archiver.kernel.org@lists.infradead.org From: Sean Wang Extend mt7925_mcu_sta_phy_tlv with per-link STA 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: Ming Yen Hsieh Signed-off-by: Ming Yen Hsieh Co-developed-by: Deren Wu Signed-off-by: Deren Wu Signed-off-by: Sean Wang --- .../net/wireless/mediatek/mt76/mt7925/mcu.c | 35 ++++++++++++------- 1 file changed, 22 insertions(+), 13 deletions(-) diff --git a/drivers/net/wireless/mediatek/mt76/mt7925/mcu.c b/drivers/net/wireless/mediatek/mt76/mt7925/mcu.c index 66d45d676739..a0fd02dd9551 100644 --- a/drivers/net/wireless/mediatek/mt76/mt7925/mcu.c +++ b/drivers/net/wireless/mediatek/mt76/mt7925/mcu.c @@ -1507,34 +1507,43 @@ mt7925_mcu_sta_amsdu_tlv(struct sk_buff *skb, static void mt7925_mcu_sta_phy_tlv(struct sk_buff *skb, - struct ieee80211_vif *vif, struct ieee80211_sta *sta) + struct ieee80211_vif *vif, + struct ieee80211_link_sta *link_sta) { struct mt792x_vif *mvif = (struct mt792x_vif *)vif->drv_priv; - struct cfg80211_chan_def *chandef = &mvif->bss_conf.mt76.ctx->def; + struct ieee80211_bss_conf *link_conf; + struct cfg80211_chan_def *chandef; + struct mt792x_bss_conf *mconf; struct sta_rec_phy *phy; struct tlv *tlv; u8 af = 0, mm = 0; + link_conf = mt792x_vif_to_bss_conf(vif, link_sta->link_id); + mconf = mt792x_vif_to_link(mvif, link_sta->link_id); + chandef = &mconf->mt76.ctx->def; + tlv = mt76_connac_mcu_add_tlv(skb, STA_REC_PHY, sizeof(*phy)); phy = (struct sta_rec_phy *)tlv; - phy->phy_type = mt76_connac_get_phy_mode_v2(mvif->phy->mt76, vif, chandef->chan->band, sta); - phy->basic_rate = cpu_to_le16((u16)vif->bss_conf.basic_rates); - if (sta->deflink.ht_cap.ht_supported) { - af = sta->deflink.ht_cap.ampdu_factor; - mm = sta->deflink.ht_cap.ampdu_density; + phy->phy_type = mt76_connac_get_phy_mode_v2(mvif->phy->mt76, vif, + chandef->chan->band, + link_sta->sta); + phy->basic_rate = cpu_to_le16((u16)link_conf->basic_rates); + if (link_sta->ht_cap.ht_supported) { + af = link_sta->ht_cap.ampdu_factor; + mm = link_sta->ht_cap.ampdu_density; } - if (sta->deflink.vht_cap.vht_supported) { + if (link_sta->vht_cap.vht_supported) { u8 vht_af = FIELD_GET(IEEE80211_VHT_CAP_MAX_A_MPDU_LENGTH_EXPONENT_MASK, - sta->deflink.vht_cap.cap); + link_sta->vht_cap.cap); af = max_t(u8, af, vht_af); } - if (sta->deflink.he_6ghz_capa.capa) { - af = le16_get_bits(sta->deflink.he_6ghz_capa.capa, + if (link_sta->he_6ghz_capa.capa) { + af = le16_get_bits(link_sta->he_6ghz_capa.capa, IEEE80211_HE_6GHZ_CAP_MAX_AMPDU_LEN_EXP); - mm = le16_get_bits(sta->deflink.he_6ghz_capa.capa, + mm = le16_get_bits(link_sta->he_6ghz_capa.capa, IEEE80211_HE_6GHZ_CAP_MIN_MPDU_START); } @@ -1639,7 +1648,7 @@ mt7925_mcu_sta_cmd(struct mt76_phy *phy, info->link_sta->sta, info->enable, info->newly); if (info->link_sta && info->enable) { - mt7925_mcu_sta_phy_tlv(skb, info->vif, info->link_sta->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); mt76_connac_mcu_sta_uapsd(skb, info->vif, info->link_sta->sta); From patchwork Thu Jun 13 03:02:28 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Sean Wang X-Patchwork-Id: 13696067 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from bombadil.infradead.org (bombadil.infradead.org [198.137.202.133]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.lore.kernel.org (Postfix) with ESMTPS id 04999C27C6E for ; Thu, 13 Jun 2024 03:04:06 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=lists.infradead.org; s=bombadil.20210309; h=Sender:List-Subscribe:List-Help :List-Post:List-Archive:List-Unsubscribe:List-Id:Content-Transfer-Encoding: MIME-Version:References:In-Reply-To:Message-Id:Date:Subject:Cc:To:From: Reply-To:Content-Type:Content-ID:Content-Description:Resent-Date:Resent-From: Resent-Sender:Resent-To:Resent-Cc:Resent-Message-ID:List-Owner; bh=DDdCS5wTSvZ4XBL7ZL9EjuprlNu9A2pnAl8ILdhp1NM=; b=sWDYJD8ZdiDYs8GHZZSehilvQw 1GFLz1mwiBo7JJOu0Z4ecrBkWk4/7xo+zqUDzCPjIKRw9k4AQXyuzT/8MV70eB6f7iY2zyVB3ST2U MgdQ2+WpYSm+XruYURO7aG5NfhmLrqpH/rOkBYqxAp4eGjUtd8nXYCHSiFzNZp7gnUj2XwEhgofQB gT/SUojcR/u2ECOaClKteQ5/sZM/TNEWxASLQbx7TJH54NGeppjeH2yxxQ1fPHtOEMMmHPNxENXPi ZfQf/K4MfB2rbYKO35dseYuvj3W2oz9gWgCSVCbtbPHkZGzKS+Eh2wtFnlTAT8A5Ed65U9pYQhRjf xDs3qCVg==; Received: from localhost ([::1] helo=bombadil.infradead.org) by bombadil.infradead.org with esmtp (Exim 4.97.1 #2 (Red Hat Linux)) id 1sHaku-0000000EwBl-2iAF; Thu, 13 Jun 2024 03:04:05 +0000 Received: from mail-oa1-f47.google.com ([209.85.160.47]) by bombadil.infradead.org with esmtps (Exim 4.97.1 #2 (Red Hat Linux)) id 1sHako-0000000Ew7D-3Cwt for linux-mediatek@lists.infradead.org; Thu, 13 Jun 2024 03:04:02 +0000 Received: by mail-oa1-f47.google.com with SMTP id 586e51a60fabf-254e7bdfac1so83257fac.0 for ; Wed, 12 Jun 2024 20:03:58 -0700 (PDT) X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1718247837; x=1718852637; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:x-gm-message-state:from:to:cc :subject:date:message-id:reply-to; bh=DDdCS5wTSvZ4XBL7ZL9EjuprlNu9A2pnAl8ILdhp1NM=; b=dMyjqWtJ1+tvr8Xbb+7GddxX1wW4OYt8D6/kWEh2jOPqndaMVYUjFTsv6/lU6jjJOQ HdZ3wAJ5KkeNpQOLYLF6Ajr1oDJOiwqLMJck4jwPxhgoN/t8Jvtn/Gb86z8oGoABfLE4 b6rGFHUJOZcy5hGzYOz/lpzFPDHoOJbwiuo4ekZV41X0Ot9POtRYTgi3zZS8ZI0UAKZI ITs/eBnK7L6h4eWskL3tfLIgSx/2g3Q/2ffNipBPBpoQaEIFYQIQ4rlbv1slR7mrz5Cy AvfWuTcUMcKw8KxXT+LBSUs7xDQcbn+mXE54TccQRC0QeDzzfFf2105T0be10gy7PbpY liPw== X-Forwarded-Encrypted: i=1; AJvYcCVA5XtXALZKSr2UT7bdTHGDFobZz1msrKLk/tnUemhTzAnu6U3liENlfcoRmJvqbjRm4cqNli7ylBwyfrO5QmtveyjPKPdaeM+oFw7RNu9PLC+A X-Gm-Message-State: AOJu0Yyuyak020Kq5QyAgiJ2nKppd2ne7OG4jFM+knhYjgfaAYO5B2v4 /9WAjJUQATGciUPi7qk+PrL2vfL0Tu7LecUQyLnLtaUYJYlv+aDC X-Google-Smtp-Source: AGHT+IGYteeIl0hbP50uC7mXetKY9ae07NNSA+90LC4OT/5TPcu7XyaM2tMVgvkcaDY43dbLLtudjA== X-Received: by 2002:a4a:8552:0:b0:5ba:ca86:a025 with SMTP id 006d021491bc7-5bb3b7a9135mr3997317eaf.0.1718247837460; Wed, 12 Jun 2024 20:03:57 -0700 (PDT) Received: from sean-ThinkPad-T450s.lan ([207.191.35.252]) by smtp.gmail.com with ESMTPSA id 006d021491bc7-5bd629263c5sm67685eaf.46.2024.06.12.20.03.55 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Wed, 12 Jun 2024 20:03:56 -0700 (PDT) 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 34/47] wifi: mt76: mt7925: extend mt7925_get_phy_mode_ext for per-link STA Date: Wed, 12 Jun 2024 20:02:28 -0700 Message-Id: <20240613030241.5771-35-sean.wang@kernel.org> X-Mailer: git-send-email 2.25.1 In-Reply-To: <20240613030241.5771-1-sean.wang@kernel.org> References: <20240613030241.5771-1-sean.wang@kernel.org> MIME-Version: 1.0 X-CRM114-Version: 20100106-BlameMichelson ( TRE 0.8.0 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20240612_200358_964727_FB3BF810 X-CRM114-Status: GOOD ( 12.02 ) X-BeenThere: linux-mediatek@lists.infradead.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Sender: "Linux-mediatek" Errors-To: linux-mediatek-bounces+linux-mediatek=archiver.kernel.org@lists.infradead.org From: Sean Wang Extend mt7925_get_phy_mode_ext with the per-link STA 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: Ming Yen Hsieh Signed-off-by: Ming Yen Hsieh Co-developed-by: Deren Wu Signed-off-by: Deren Wu Signed-off-by: Sean Wang --- drivers/net/wireless/mediatek/mt76/mt7925/mcu.c | 12 +++++++----- 1 file changed, 7 insertions(+), 5 deletions(-) diff --git a/drivers/net/wireless/mediatek/mt76/mt7925/mcu.c b/drivers/net/wireless/mediatek/mt76/mt7925/mcu.c index a0fd02dd9551..32ea71128280 100644 --- a/drivers/net/wireless/mediatek/mt76/mt7925/mcu.c +++ b/drivers/net/wireless/mediatek/mt76/mt7925/mcu.c @@ -2035,16 +2035,17 @@ int mt7925_mcu_set_chctx(struct mt76_phy *phy, struct mt76_vif *mvif, static u8 mt7925_get_phy_mode_ext(struct mt76_phy *phy, struct ieee80211_vif *vif, - enum nl80211_band band, struct ieee80211_sta *sta) + enum nl80211_band band, + struct ieee80211_link_sta *link_sta) { struct ieee80211_he_6ghz_capa *he_6ghz_capa; const struct ieee80211_sta_eht_cap *eht_cap; __le16 capa = 0; u8 mode = 0; - if (sta) { - he_6ghz_capa = &sta->deflink.he_6ghz_capa; - eht_cap = &sta->deflink.eht_cap; + if (link_sta) { + he_6ghz_capa = &link_sta->he_6ghz_capa; + eht_cap = &link_sta->eht_cap; } else { struct ieee80211_supported_band *sband; @@ -2104,7 +2105,8 @@ mt7925_mcu_bss_basic_tlv(struct sk_buff *skb, mconf->mt76.omac_idx; basic_req->hw_bss_idx = idx; - basic_req->phymode_ext = mt7925_get_phy_mode_ext(phy, vif, band, sta); + basic_req->phymode_ext = mt7925_get_phy_mode_ext(phy, vif, band, + &sta->deflink); if (band == NL80211_BAND_2GHZ) basic_req->nonht_basic_phy = cpu_to_le16(PHY_TYPE_ERP_INDEX); From patchwork Thu Jun 13 03:02:29 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Sean Wang X-Patchwork-Id: 13696068 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from bombadil.infradead.org (bombadil.infradead.org [198.137.202.133]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.lore.kernel.org (Postfix) with ESMTPS id B75D2C27C53 for ; Thu, 13 Jun 2024 03:04:06 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=lists.infradead.org; s=bombadil.20210309; h=Sender:List-Subscribe:List-Help :List-Post:List-Archive:List-Unsubscribe:List-Id:Content-Transfer-Encoding: MIME-Version:References:In-Reply-To:Message-Id:Date:Subject:Cc:To:From: Reply-To:Content-Type:Content-ID:Content-Description:Resent-Date:Resent-From: Resent-Sender:Resent-To:Resent-Cc:Resent-Message-ID:List-Owner; bh=0kqNpOQikz31Rvo98UCj21K+HMYQ5mjJ2R+HS/m16G4=; b=MBk3oenXva102K2zGtSqpnD9D5 rI0IHWwEiQdo5/D2h5u/04PO6Uva3o9ScNsWIbSOGUdZ0UUv2qS76ImdS9bJaxQ/jvZ3H5oCRe8Wu 9fimgVePV3e1DnvO95RAXjjS6aB4GJnaswxiGxhaUEr24CaCvkGa33A1dQhy3CYQY/SqFBm60MxaD hmK3DLj+ih6NuH5NO77OS7a5m2umpaD8QAmG73EaPXNhW8q9J15t0co11flYS5wTagYNAfsf32Kcv 4apjCI68nWSRXjRsdXX80emiRrycSEODFcB7+avslgMHE6heRRXA1+qP4HeN3iAOxnGrPPdrjUMmC dSQXGXYQ==; Received: from localhost ([::1] helo=bombadil.infradead.org) by bombadil.infradead.org with esmtp (Exim 4.97.1 #2 (Red Hat Linux)) id 1sHakw-0000000EwCy-0o0p; Thu, 13 Jun 2024 03:04:06 +0000 Received: from mail-oo1-f45.google.com ([209.85.161.45]) by bombadil.infradead.org with esmtps (Exim 4.97.1 #2 (Red Hat Linux)) id 1sHakq-0000000Ew8s-1ZQ5 for linux-mediatek@lists.infradead.org; Thu, 13 Jun 2024 03:04:02 +0000 Received: by mail-oo1-f45.google.com with SMTP id 006d021491bc7-5b97f09cde3so43154eaf.0 for ; Wed, 12 Jun 2024 20:04:00 -0700 (PDT) X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1718247839; x=1718852639; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:x-gm-message-state:from:to:cc :subject:date:message-id:reply-to; bh=0kqNpOQikz31Rvo98UCj21K+HMYQ5mjJ2R+HS/m16G4=; b=bTrNloSvZ0N1SuziB1uUhMWP8IOc55/MhMrVttaUO8IPk0gfwQn8msxy3ZDDUl84cZ RDPU+OhZ4L+KxRe0URYZdzw2ZOFA97+QP1hTOB2B2W95LJiv0Fq2VIpdPvbgx8tl2vRh VNQPE590EjCFEQtsJQ/lwuQDiow6SNy992PT7Cf/lQKqhkf22rP/6tDBTjKRt/mpEWMY DI9HtdBQLMdcldAWmlep0Cb8kytbXp1x6gGr8IfHT08M0iErNHPuwJvRpBlhRgfmTpyS PEr+hZzMM3GEigyjX61q0Dqdqcnkc9eZ/7z8lWhXMFDdIQ3EB/KHEKtJEaAedNOjKcA7 LKXw== X-Forwarded-Encrypted: i=1; AJvYcCWlGzPlxrCPB+6S3BJ+ff+Db84yXQOaHAgEOiwIxvH3z9IMCBA2JHIP+JS4jnINwwl1cGgW/e3UQEvcDe4Skg==@lists.infradead.org X-Gm-Message-State: AOJu0Yys7RsboUKZ64lJN9sVr6sY3oBLGZ/YAVsDa2hkbwhcNsyC8QJD eyv+1Zn34YjguYo4oNfwYJAWNC2jt8hYZDrfGA8K8izodWKqC+IZ X-Google-Smtp-Source: AGHT+IEtnVHuansGHURBC+LEKvMH3Jy7bWaeX+lPmpLCZZoarezi4l511KEJO27+VI+h1RFYRCfhew== X-Received: by 2002:a4a:8552:0:b0:5ba:ca86:a025 with SMTP id 006d021491bc7-5bb3b7a9135mr3997374eaf.0.1718247839547; Wed, 12 Jun 2024 20:03:59 -0700 (PDT) Received: from sean-ThinkPad-T450s.lan ([207.191.35.252]) by smtp.gmail.com with ESMTPSA id 006d021491bc7-5bd629263c5sm67685eaf.46.2024.06.12.20.03.57 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Wed, 12 Jun 2024 20:03:57 -0700 (PDT) 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 35/47] wifi: mt76: mt7925: extend mt7925_get_phy_mode for per-link STA Date: Wed, 12 Jun 2024 20:02:29 -0700 Message-Id: <20240613030241.5771-36-sean.wang@kernel.org> X-Mailer: git-send-email 2.25.1 In-Reply-To: <20240613030241.5771-1-sean.wang@kernel.org> References: <20240613030241.5771-1-sean.wang@kernel.org> MIME-Version: 1.0 X-CRM114-Version: 20100106-BlameMichelson ( TRE 0.8.0 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20240612_200400_571390_6AB18581 X-CRM114-Status: GOOD ( 13.37 ) X-BeenThere: linux-mediatek@lists.infradead.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Sender: "Linux-mediatek" Errors-To: linux-mediatek-bounces+linux-mediatek=archiver.kernel.org@lists.infradead.org From: Sean Wang Extend mt7925_get_phy_mode with the per-link STA 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: Ming Yen Hsieh Signed-off-by: Ming Yen Hsieh Co-developed-by: Deren Wu Signed-off-by: Deren Wu Signed-off-by: Sean Wang --- drivers/net/wireless/mediatek/mt76/mt76_connac_mcu.c | 11 ++++++----- drivers/net/wireless/mediatek/mt76/mt76_connac_mcu.h | 3 ++- drivers/net/wireless/mediatek/mt76/mt7915/mcu.c | 2 +- drivers/net/wireless/mediatek/mt76/mt7925/mcu.c | 3 ++- 4 files changed, 11 insertions(+), 8 deletions(-) diff --git a/drivers/net/wireless/mediatek/mt76/mt76_connac_mcu.c b/drivers/net/wireless/mediatek/mt76/mt76_connac_mcu.c index 87f918461051..f7ba3afb3ccf 100644 --- a/drivers/net/wireless/mediatek/mt76/mt76_connac_mcu.c +++ b/drivers/net/wireless/mediatek/mt76/mt76_connac_mcu.c @@ -1300,7 +1300,8 @@ int mt76_connac_mcu_sta_ba(struct mt76_dev *dev, struct mt76_vif *mvif, EXPORT_SYMBOL_GPL(mt76_connac_mcu_sta_ba); u8 mt76_connac_get_phy_mode(struct mt76_phy *phy, struct ieee80211_vif *vif, - enum nl80211_band band, struct ieee80211_sta *sta) + enum nl80211_band band, + struct ieee80211_link_sta *link_sta) { struct mt76_dev *dev = phy->dev; const struct ieee80211_sta_he_cap *he_cap; @@ -1311,10 +1312,10 @@ u8 mt76_connac_get_phy_mode(struct mt76_phy *phy, struct ieee80211_vif *vif, if (is_connac_v1(dev)) return 0x38; - if (sta) { - ht_cap = &sta->deflink.ht_cap; - vht_cap = &sta->deflink.vht_cap; - he_cap = &sta->deflink.he_cap; + if (link_sta) { + ht_cap = &link_sta->ht_cap; + vht_cap = &link_sta->vht_cap; + he_cap = &link_sta->he_cap; } else { struct ieee80211_supported_band *sband; diff --git a/drivers/net/wireless/mediatek/mt76/mt76_connac_mcu.h b/drivers/net/wireless/mediatek/mt76/mt76_connac_mcu.h index 2a858b1ca82e..5b40d51ee728 100644 --- a/drivers/net/wireless/mediatek/mt76/mt76_connac_mcu.h +++ b/drivers/net/wireless/mediatek/mt76/mt76_connac_mcu.h @@ -1988,7 +1988,8 @@ mt76_connac_get_he_phy_cap(struct mt76_phy *phy, struct ieee80211_vif *vif); const struct ieee80211_sta_eht_cap * mt76_connac_get_eht_phy_cap(struct mt76_phy *phy, struct ieee80211_vif *vif); u8 mt76_connac_get_phy_mode(struct mt76_phy *phy, struct ieee80211_vif *vif, - enum nl80211_band band, struct ieee80211_sta *sta); + enum nl80211_band band, + struct ieee80211_link_sta *sta); u8 mt76_connac_get_phy_mode_ext(struct mt76_phy *phy, struct ieee80211_vif *vif, enum nl80211_band band); diff --git a/drivers/net/wireless/mediatek/mt76/mt7915/mcu.c b/drivers/net/wireless/mediatek/mt76/mt7915/mcu.c index 2c95c69f395d..0f50c6659802 100644 --- a/drivers/net/wireless/mediatek/mt76/mt7915/mcu.c +++ b/drivers/net/wireless/mediatek/mt76/mt7915/mcu.c @@ -1503,7 +1503,7 @@ mt7915_mcu_sta_rate_ctrl_tlv(struct sk_buff *skb, struct mt7915_dev *dev, ra->valid = true; ra->auto_rate = true; - ra->phy_mode = mt76_connac_get_phy_mode(mphy, vif, band, sta); + ra->phy_mode = mt76_connac_get_phy_mode(mphy, vif, band, &sta->deflink); ra->channel = chandef->chan->hw_value; ra->bw = sta->deflink.bandwidth; ra->phy.bw = sta->deflink.bandwidth; diff --git a/drivers/net/wireless/mediatek/mt76/mt7925/mcu.c b/drivers/net/wireless/mediatek/mt76/mt7925/mcu.c index 32ea71128280..3cda538307b5 100644 --- a/drivers/net/wireless/mediatek/mt76/mt7925/mcu.c +++ b/drivers/net/wireless/mediatek/mt76/mt7925/mcu.c @@ -2114,7 +2114,8 @@ mt7925_mcu_bss_basic_tlv(struct sk_buff *skb, basic_req->nonht_basic_phy = cpu_to_le16(PHY_TYPE_OFDM_INDEX); memcpy(basic_req->bssid, link_conf->bssid, ETH_ALEN); - basic_req->phymode = mt76_connac_get_phy_mode(phy, vif, band, sta); + basic_req->phymode = mt76_connac_get_phy_mode(phy, vif, band, + &sta->deflink); basic_req->bcn_interval = cpu_to_le16(link_conf->beacon_int); basic_req->dtim_period = link_conf->dtim_period; basic_req->bmc_tx_wlan_idx = cpu_to_le16(wlan_idx); From patchwork Thu Jun 13 03:02:30 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Sean Wang X-Patchwork-Id: 13696069 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from bombadil.infradead.org (bombadil.infradead.org [198.137.202.133]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.lore.kernel.org (Postfix) with ESMTPS id 8D9ABC27C6E for ; Thu, 13 Jun 2024 03:04:10 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=lists.infradead.org; s=bombadil.20210309; h=Sender:List-Subscribe:List-Help :List-Post:List-Archive:List-Unsubscribe:List-Id:Content-Transfer-Encoding: MIME-Version:References:In-Reply-To:Message-Id:Date:Subject:Cc:To:From: Reply-To:Content-Type:Content-ID:Content-Description:Resent-Date:Resent-From: Resent-Sender:Resent-To:Resent-Cc:Resent-Message-ID:List-Owner; bh=hkHDBlOkDJ0JO9nw4+ATjhclLWfJKvnEvDbeM9MFnc4=; b=gbJ1N5zt3T/cyFqeGd4+YHK46P qAOK3fvmZaAg8yNG8b4Y+XFiuvZGmzV/yKfv661RZ7Sl5Z0VPBC8T5Yszc21MEAdgam6OSgU5V2uU colq5ooxzKBh/jcclmTZkoiOb5EQvOT3rT27KRWVIV+ReFkRFT+yZfz3ZXSal6C2whrNclEs5tSjL wfYvFeTKhDbvYRRXSHf05uaaWa3pQXi6W0jM4jbY7FRm5D7bjjFVWVwtBqpbQ1a0tVCY0a9ARGEJR PrDCbPFi7Yo0y31IyWAqqqFe/QFAgtQiCDpp03mZ6fcmvoF9I5jIQkAERp86XGw9aXfKOYLmBuFt4 gPv4wXow==; Received: from localhost ([::1] helo=bombadil.infradead.org) by bombadil.infradead.org with esmtp (Exim 4.97.1 #2 (Red Hat Linux)) id 1sHal0-0000000EwFq-0GGD; Thu, 13 Jun 2024 03:04:10 +0000 Received: from mail-oi1-f170.google.com ([209.85.167.170]) by bombadil.infradead.org with esmtps (Exim 4.97.1 #2 (Red Hat Linux)) id 1sHaku-0000000Ew9t-2hq2 for linux-mediatek@lists.infradead.org; Thu, 13 Jun 2024 03:04:08 +0000 Received: by mail-oi1-f170.google.com with SMTP id 5614622812f47-3d1b8bacf67so76912b6e.2 for ; Wed, 12 Jun 2024 20:04:02 -0700 (PDT) X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1718247842; x=1718852642; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:x-gm-message-state:from:to:cc :subject:date:message-id:reply-to; bh=hkHDBlOkDJ0JO9nw4+ATjhclLWfJKvnEvDbeM9MFnc4=; b=U4SgrkUW23FKRurhvO+bppcqyAstiO/3drt2/5CZbR9sb04aqYFf3qjwVP/qFIONuj kuAFWx9yeH6Ws/7eR7t+WmCPom6eLBI747km7VMi6SIckg3UBNkDp86YakoE+0baoYaW 3HsLBIn//jTeZmQWpw0BcY4CPCtDCpd7xeAnNbshTgEshDeqs5l6lZau3usAzKMkvqpL M9Hc0Sats6GFzXigNv+1OsrIxOU/rxgcch5nRh+KXX28hd8x5Epys6Y04DSly2P2acC+ SjWRDrqDwcEZKvB9mk/f3w2zxYaqaI06Io38Fgl62usFrhu/EolGSws1Zmy+Sg3ylH2B T0NA== X-Forwarded-Encrypted: i=1; AJvYcCVC1zGHTeo+VN0p6WrCFuXYwF6xpuxGlxgsOPmwOXyYdYrcpG6sYbdO62euO1nhLGls/x5xwPN2CnuLRV0lgolLQzMbeDTMqBhWespo+K2HGkXs X-Gm-Message-State: AOJu0YwxY0GyD2sMsFj5ZGHbJ4GecPTPaUPGakaWiv6eF/fBZ28kaDc6 bwpJfPWs/9MoLKNW2zFtwuYRRtGDJXy2ye9les1tiyJ2IZ7QrH+O X-Google-Smtp-Source: AGHT+IEC7RP+/DIV32Apb3dYvlXNUgZrif0a/bIJWXgUP/56rqQwGaQ3rLescw43Rs0OCodd5k4AZQ== X-Received: by 2002:a05:6820:d88:b0:5ba:ead2:c742 with SMTP id 006d021491bc7-5bb3b7a3d2bmr3673097eaf.0.1718247841693; Wed, 12 Jun 2024 20:04:01 -0700 (PDT) Received: from sean-ThinkPad-T450s.lan ([207.191.35.252]) by smtp.gmail.com with ESMTPSA id 006d021491bc7-5bd629263c5sm67685eaf.46.2024.06.12.20.03.59 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Wed, 12 Jun 2024 20:04:00 -0700 (PDT) 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 36/47] wifi: mt76: mt792x: extend mt76_connac_get_phy_mode_v2 for per-link STA Date: Wed, 12 Jun 2024 20:02:30 -0700 Message-Id: <20240613030241.5771-37-sean.wang@kernel.org> X-Mailer: git-send-email 2.25.1 In-Reply-To: <20240613030241.5771-1-sean.wang@kernel.org> References: <20240613030241.5771-1-sean.wang@kernel.org> MIME-Version: 1.0 X-CRM114-Version: 20100106-BlameMichelson ( TRE 0.8.0 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20240612_200405_355901_CF01F3F4 X-CRM114-Status: GOOD ( 13.05 ) X-BeenThere: linux-mediatek@lists.infradead.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Sender: "Linux-mediatek" Errors-To: linux-mediatek-bounces+linux-mediatek=archiver.kernel.org@lists.infradead.org From: Sean Wang Extend mt76_connac_get_phy_mode_v2 with the per-link STA 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. Signed-off-by: Sean Wang --- .../net/wireless/mediatek/mt76/mt76_connac_mcu.c | 16 +++++++++------- .../net/wireless/mediatek/mt76/mt76_connac_mcu.h | 3 ++- drivers/net/wireless/mediatek/mt76/mt7925/mcu.c | 2 +- 3 files changed, 12 insertions(+), 9 deletions(-) diff --git a/drivers/net/wireless/mediatek/mt76/mt76_connac_mcu.c b/drivers/net/wireless/mediatek/mt76/mt76_connac_mcu.c index f7ba3afb3ccf..294f79ab7ca6 100644 --- a/drivers/net/wireless/mediatek/mt76/mt76_connac_mcu.c +++ b/drivers/net/wireless/mediatek/mt76/mt76_connac_mcu.c @@ -786,7 +786,8 @@ EXPORT_SYMBOL_GPL(mt76_connac_mcu_sta_he_tlv_v2); u8 mt76_connac_get_phy_mode_v2(struct mt76_phy *mphy, struct ieee80211_vif *vif, - enum nl80211_band band, struct ieee80211_sta *sta) + enum nl80211_band band, + struct ieee80211_link_sta *link_sta) { struct ieee80211_sta_ht_cap *ht_cap; struct ieee80211_sta_vht_cap *vht_cap; @@ -794,11 +795,11 @@ mt76_connac_get_phy_mode_v2(struct mt76_phy *mphy, struct ieee80211_vif *vif, const struct ieee80211_sta_eht_cap *eht_cap; u8 mode = 0; - if (sta) { - ht_cap = &sta->deflink.ht_cap; - vht_cap = &sta->deflink.vht_cap; - he_cap = &sta->deflink.he_cap; - eht_cap = &sta->deflink.eht_cap; + if (link_sta) { + ht_cap = &link_sta->ht_cap; + vht_cap = &link_sta->vht_cap; + he_cap = &link_sta->he_cap; + eht_cap = &link_sta->eht_cap; } else { struct ieee80211_supported_band *sband; @@ -904,7 +905,8 @@ void mt76_connac_mcu_sta_tlv(struct mt76_phy *mphy, struct sk_buff *skb, tlv = mt76_connac_mcu_add_tlv(skb, STA_REC_PHY, sizeof(*phy)); phy = (struct sta_rec_phy *)tlv; - phy->phy_type = mt76_connac_get_phy_mode_v2(mphy, vif, band, sta); + phy->phy_type = mt76_connac_get_phy_mode_v2(mphy, vif, band, + &sta->deflink); phy->basic_rate = cpu_to_le16((u16)vif->bss_conf.basic_rates); phy->rcpi = rcpi; phy->ampdu = FIELD_PREP(IEEE80211_HT_AMPDU_PARM_FACTOR, diff --git a/drivers/net/wireless/mediatek/mt76/mt76_connac_mcu.h b/drivers/net/wireless/mediatek/mt76/mt76_connac_mcu.h index 5b40d51ee728..2c939468d141 100644 --- a/drivers/net/wireless/mediatek/mt76/mt76_connac_mcu.h +++ b/drivers/net/wireless/mediatek/mt76/mt76_connac_mcu.h @@ -1894,7 +1894,8 @@ int mt76_connac_mcu_sta_update_hdr_trans(struct mt76_dev *dev, struct mt76_wcid *wcid, int cmd); void mt76_connac_mcu_sta_he_tlv_v2(struct sk_buff *skb, struct ieee80211_sta *sta); u8 mt76_connac_get_phy_mode_v2(struct mt76_phy *mphy, struct ieee80211_vif *vif, - enum nl80211_band band, struct ieee80211_sta *sta); + enum nl80211_band band, + struct ieee80211_link_sta *link_sta); int mt76_connac_mcu_wtbl_update_hdr_trans(struct mt76_dev *dev, struct ieee80211_vif *vif, struct ieee80211_sta *sta); diff --git a/drivers/net/wireless/mediatek/mt76/mt7925/mcu.c b/drivers/net/wireless/mediatek/mt76/mt7925/mcu.c index 3cda538307b5..321a164a6e14 100644 --- a/drivers/net/wireless/mediatek/mt76/mt7925/mcu.c +++ b/drivers/net/wireless/mediatek/mt76/mt7925/mcu.c @@ -1526,7 +1526,7 @@ mt7925_mcu_sta_phy_tlv(struct sk_buff *skb, phy = (struct sta_rec_phy *)tlv; phy->phy_type = mt76_connac_get_phy_mode_v2(mvif->phy->mt76, vif, chandef->chan->band, - link_sta->sta); + link_sta); phy->basic_rate = cpu_to_le16((u16)link_conf->basic_rates); if (link_sta->ht_cap.ht_supported) { af = link_sta->ht_cap.ampdu_factor; From patchwork Thu Jun 13 03:02:31 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Sean Wang X-Patchwork-Id: 13696071 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from bombadil.infradead.org (bombadil.infradead.org [198.137.202.133]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.lore.kernel.org (Postfix) with ESMTPS id 0B1D0C27C6E for ; Thu, 13 Jun 2024 03:04:13 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=lists.infradead.org; s=bombadil.20210309; h=Sender:List-Subscribe:List-Help :List-Post:List-Archive:List-Unsubscribe:List-Id:Content-Transfer-Encoding: MIME-Version:References:In-Reply-To:Message-Id:Date:Subject:Cc:To:From: Reply-To:Content-Type:Content-ID:Content-Description:Resent-Date:Resent-From: Resent-Sender:Resent-To:Resent-Cc:Resent-Message-ID:List-Owner; bh=LdsOWdunEX8Yk5T3pweRV+cWYeKKmyqWhAt3rUAD9qE=; b=hF5mXFWYM3FVJLBuaHHQXq6mxl eKFLAfIGbP7476frjAomYUVMjcs1JVc+9oUtbpOEzCRF69cCo6wFJ7RpkvZdJOz0Jrc0M/ImDoEeW NW1CjzCpKNAprv2lSvNW6fDYLzpSWzyeaH5fjB09bPSLf2gkEEr95NYZlaog1+f8+7XIAD3vRqopB mnTkfDdFWxT3WacGjQyEih6NR0+3kQePqME/4zs23/yCp3WsCWTENrF7DFptQ5rCQD3nPGkYh14Rm 2WhrMMhAL0rsMqk82Xrs8wln815rXoJgEfZnyxBtCj6rMdbLBNPE2rXqNkIDYxq9FdHhogG6NYk2o JzlsvK+Q==; Received: from localhost ([::1] helo=bombadil.infradead.org) by bombadil.infradead.org with esmtp (Exim 4.97.1 #2 (Red Hat Linux)) id 1sHal2-0000000EwHc-2a61; Thu, 13 Jun 2024 03:04:12 +0000 Received: from mail-oo1-f51.google.com ([209.85.161.51]) by bombadil.infradead.org with esmtps (Exim 4.97.1 #2 (Red Hat Linux)) id 1sHakv-0000000EwBq-28bP for linux-mediatek@lists.infradead.org; Thu, 13 Jun 2024 03:04:10 +0000 Received: by mail-oo1-f51.google.com with SMTP id 006d021491bc7-5bad97708efso31452eaf.1 for ; Wed, 12 Jun 2024 20:04:05 -0700 (PDT) X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1718247844; x=1718852644; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:x-gm-message-state:from:to:cc :subject:date:message-id:reply-to; bh=LdsOWdunEX8Yk5T3pweRV+cWYeKKmyqWhAt3rUAD9qE=; b=hwcL3IiyWvCIlWkb/vx+btS9Cu0xx810l3y6e2XGL4yS8aKuSPy7kNIouZ1+uGPeQO SI6PxhcN99y16eC1Zk6Jh7R9Njj7eEzhTRS2IZh4np3SBtJy8j6WrOodlcrpNs2WgQYa xxgHewoIE0jNODkAEw0VT9XsOFgzQ0Iq7S/ojNeV9Mqbbbvpy21ULcMayTYjaPBsiCD0 6J9u/uF6UC4DDe8+0js9K4gcKcrTkPrV1kvTkOts+E8iXVP/8w7C5uEfnoA9V9mv1EDC GY0gI/Xui19bTlnlFyuoUujz+JgCO3vKliYhmB/e6FeV+rxkmiuCvvtCmKNmznZkQ429 TNgw== X-Forwarded-Encrypted: i=1; AJvYcCWnWUPsZ/Bbr3VT+1CrNF5W7gl8DMlnl0ar6UBE+ifLNxht05tQPab9yhSUF79qxf1I5YzTJMce4W4HtR5o9h15sVkEUnaPY3kHRYY7HO/MOSuG X-Gm-Message-State: AOJu0YztlCb71536g0AwhfgAtB4CHbOcKA6hPkwiLW24ZmpmQHxYokNa 2ctDJsAdkEv2VTP3WNpLm11izJlg31DeZG2KCzuJS2rvHAFtstm27wrCC6TOs2E= X-Google-Smtp-Source: AGHT+IF+ml4MUeGV/i5XQwGw5xQ+DdY5QC2s4B4v6GTVWptW20U5JH/pw2wtkJ+TOE2Qar4pevwQ5A== X-Received: by 2002:a4a:3101:0:b0:5ba:ca8a:6598 with SMTP id 006d021491bc7-5bb3b7b972bmr3908348eaf.0.1718247844497; Wed, 12 Jun 2024 20:04:04 -0700 (PDT) Received: from sean-ThinkPad-T450s.lan ([207.191.35.252]) by smtp.gmail.com with ESMTPSA id 006d021491bc7-5bd629263c5sm67685eaf.46.2024.06.12.20.04.01 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Wed, 12 Jun 2024 20:04:02 -0700 (PDT) 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 37/47] wifi: mt76: mt762x: extend mt76_connac_mcu_sta_basic_tlv for per-link STA Date: Wed, 12 Jun 2024 20:02:31 -0700 Message-Id: <20240613030241.5771-38-sean.wang@kernel.org> X-Mailer: git-send-email 2.25.1 In-Reply-To: <20240613030241.5771-1-sean.wang@kernel.org> References: <20240613030241.5771-1-sean.wang@kernel.org> MIME-Version: 1.0 X-CRM114-Version: 20100106-BlameMichelson ( TRE 0.8.0 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20240612_200406_017396_E3A28DD1 X-CRM114-Status: GOOD ( 14.36 ) X-BeenThere: linux-mediatek@lists.infradead.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Sender: "Linux-mediatek" Errors-To: linux-mediatek-bounces+linux-mediatek=archiver.kernel.org@lists.infradead.org From: Sean Wang Extend mt76_connac_mcu_sta_basic_tlv with the per-link STA 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: Ming Yen Hsieh Signed-off-by: Ming Yen Hsieh Co-developed-by: Deren Wu Signed-off-by: Deren Wu Signed-off-by: Sean Wang --- drivers/net/wireless/mediatek/mt76/mt7615/mcu.c | 4 ++-- .../wireless/mediatek/mt76/mt76_connac_mcu.c | 17 +++++++++-------- .../wireless/mediatek/mt76/mt76_connac_mcu.h | 4 ++-- drivers/net/wireless/mediatek/mt76/mt7915/mcu.c | 2 +- drivers/net/wireless/mediatek/mt76/mt7925/mcu.c | 2 +- drivers/net/wireless/mediatek/mt76/mt7996/mcu.c | 2 +- 6 files changed, 16 insertions(+), 15 deletions(-) diff --git a/drivers/net/wireless/mediatek/mt76/mt7615/mcu.c b/drivers/net/wireless/mediatek/mt76/mt7615/mcu.c index 792ae41f7c69..25670eeaecb4 100644 --- a/drivers/net/wireless/mediatek/mt76/mt7615/mcu.c +++ b/drivers/net/wireless/mediatek/mt76/mt7615/mcu.c @@ -861,8 +861,8 @@ mt7615_mcu_wtbl_sta_add(struct mt7615_phy *phy, struct ieee80211_vif *vif, else mvif->sta_added = true; } - mt76_connac_mcu_sta_basic_tlv(&dev->mt76, sskb, vif, sta, enable, - new_entry); + mt76_connac_mcu_sta_basic_tlv(&dev->mt76, sskb, vif, &sta->deflink, + enable, new_entry); if (enable && sta) mt76_connac_mcu_sta_tlv(phy->mt76, sskb, sta, vif, 0, MT76_STA_INFO_STATE_ASSOC); diff --git a/drivers/net/wireless/mediatek/mt76/mt76_connac_mcu.c b/drivers/net/wireless/mediatek/mt76/mt76_connac_mcu.c index 294f79ab7ca6..b8ad080ad2c3 100644 --- a/drivers/net/wireless/mediatek/mt76/mt76_connac_mcu.c +++ b/drivers/net/wireless/mediatek/mt76/mt76_connac_mcu.c @@ -370,7 +370,7 @@ EXPORT_SYMBOL_GPL(mt76_connac_mcu_bss_omac_tlv); void mt76_connac_mcu_sta_basic_tlv(struct mt76_dev *dev, struct sk_buff *skb, struct ieee80211_vif *vif, - struct ieee80211_sta *sta, + struct ieee80211_link_sta *link_sta, bool enable, bool newly) { struct sta_rec_basic *basic; @@ -390,7 +390,7 @@ void mt76_connac_mcu_sta_basic_tlv(struct mt76_dev *dev, struct sk_buff *skb, basic->conn_state = CONN_STATE_DISCONNECT; } - if (!sta) { + if (!link_sta) { basic->conn_type = cpu_to_le32(CONNECTION_INFRA_BC); eth_broadcast_addr(basic->peer_addr); return; @@ -404,7 +404,7 @@ void mt76_connac_mcu_sta_basic_tlv(struct mt76_dev *dev, struct sk_buff *skb, else conn_type = CONNECTION_INFRA_STA; basic->conn_type = cpu_to_le32(conn_type); - basic->aid = cpu_to_le16(sta->aid); + basic->aid = cpu_to_le16(link_sta->sta->aid); break; case NL80211_IFTYPE_STATION: if (vif->p2p && !is_mt7921(dev)) @@ -416,15 +416,15 @@ void mt76_connac_mcu_sta_basic_tlv(struct mt76_dev *dev, struct sk_buff *skb, break; case NL80211_IFTYPE_ADHOC: basic->conn_type = cpu_to_le32(CONNECTION_IBSS_ADHOC); - basic->aid = cpu_to_le16(sta->aid); + basic->aid = cpu_to_le16(link_sta->sta->aid); break; default: WARN_ON(1); break; } - memcpy(basic->peer_addr, sta->addr, ETH_ALEN); - basic->qos = sta->wme; + memcpy(basic->peer_addr, link_sta->addr, ETH_ALEN); + basic->qos = link_sta->sta->wme; } EXPORT_SYMBOL_GPL(mt76_connac_mcu_sta_basic_tlv); @@ -1049,8 +1049,9 @@ int mt76_connac_mcu_sta_cmd(struct mt76_phy *phy, return PTR_ERR(skb); if (info->sta || !info->offload_fw) - mt76_connac_mcu_sta_basic_tlv(dev, skb, info->vif, info->sta, - info->enable, info->newly); + mt76_connac_mcu_sta_basic_tlv(dev, skb, info->vif, + &info->sta->deflink, info->enable, + info->newly); if (info->sta && info->enable) mt76_connac_mcu_sta_tlv(phy, skb, info->sta, info->vif, info->rcpi, diff --git a/drivers/net/wireless/mediatek/mt76/mt76_connac_mcu.h b/drivers/net/wireless/mediatek/mt76/mt76_connac_mcu.h index 2c939468d141..4857c31cfb23 100644 --- a/drivers/net/wireless/mediatek/mt76/mt76_connac_mcu.h +++ b/drivers/net/wireless/mediatek/mt76/mt76_connac_mcu.h @@ -1879,8 +1879,8 @@ int mt76_connac_mcu_set_channel_domain(struct mt76_phy *phy); int mt76_connac_mcu_set_vif_ps(struct mt76_dev *dev, struct ieee80211_vif *vif); void mt76_connac_mcu_sta_basic_tlv(struct mt76_dev *dev, struct sk_buff *skb, struct ieee80211_vif *vif, - struct ieee80211_sta *sta, bool enable, - bool newly); + struct ieee80211_link_sta *link_sta, + bool enable, bool newly); void mt76_connac_mcu_wtbl_generic_tlv(struct mt76_dev *dev, struct sk_buff *skb, struct ieee80211_vif *vif, struct ieee80211_sta *sta, void *sta_wtbl, diff --git a/drivers/net/wireless/mediatek/mt76/mt7915/mcu.c b/drivers/net/wireless/mediatek/mt76/mt7915/mcu.c index 0f50c6659802..7204866437ce 100644 --- a/drivers/net/wireless/mediatek/mt76/mt7915/mcu.c +++ b/drivers/net/wireless/mediatek/mt76/mt7915/mcu.c @@ -1668,7 +1668,7 @@ int mt7915_mcu_add_sta(struct mt7915_dev *dev, struct ieee80211_vif *vif, return PTR_ERR(skb); /* starec basic */ - mt76_connac_mcu_sta_basic_tlv(&dev->mt76, skb, vif, sta, enable, + mt76_connac_mcu_sta_basic_tlv(&dev->mt76, skb, vif, &sta->deflink, enable, !rcu_access_pointer(dev->mt76.wcid[msta->wcid.idx])); if (!enable) goto out; diff --git a/drivers/net/wireless/mediatek/mt76/mt7925/mcu.c b/drivers/net/wireless/mediatek/mt76/mt7925/mcu.c index 321a164a6e14..5a40979c0bba 100644 --- a/drivers/net/wireless/mediatek/mt76/mt7925/mcu.c +++ b/drivers/net/wireless/mediatek/mt76/mt7925/mcu.c @@ -1645,7 +1645,7 @@ mt7925_mcu_sta_cmd(struct mt76_phy *phy, if (info->link_sta || !info->offload_fw) mt76_connac_mcu_sta_basic_tlv(dev, skb, info->vif, - info->link_sta->sta, + info->link_sta, info->enable, info->newly); if (info->link_sta && info->enable) { mt7925_mcu_sta_phy_tlv(skb, info->vif, info->link_sta); diff --git a/drivers/net/wireless/mediatek/mt76/mt7996/mcu.c b/drivers/net/wireless/mediatek/mt76/mt7996/mcu.c index f4c59eafb537..038c4a140ec8 100644 --- a/drivers/net/wireless/mediatek/mt76/mt7996/mcu.c +++ b/drivers/net/wireless/mediatek/mt76/mt7996/mcu.c @@ -2152,7 +2152,7 @@ int mt7996_mcu_add_sta(struct mt7996_dev *dev, struct ieee80211_vif *vif, return PTR_ERR(skb); /* starec basic */ - mt76_connac_mcu_sta_basic_tlv(&dev->mt76, skb, vif, sta, enable, + mt76_connac_mcu_sta_basic_tlv(&dev->mt76, skb, vif, &sta->deflink, enable, !rcu_access_pointer(dev->mt76.wcid[msta->wcid.idx])); if (!enable) goto out; From patchwork Thu Jun 13 03:02:32 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Sean Wang X-Patchwork-Id: 13696070 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from bombadil.infradead.org (bombadil.infradead.org [198.137.202.133]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.lore.kernel.org (Postfix) with ESMTPS id 8AC2DC27C53 for ; Thu, 13 Jun 2024 03:04:12 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=lists.infradead.org; s=bombadil.20210309; h=Sender:List-Subscribe:List-Help :List-Post:List-Archive:List-Unsubscribe:List-Id:Content-Transfer-Encoding: MIME-Version:References:In-Reply-To:Message-Id:Date:Subject:Cc:To:From: Reply-To:Content-Type:Content-ID:Content-Description:Resent-Date:Resent-From: Resent-Sender:Resent-To:Resent-Cc:Resent-Message-ID:List-Owner; bh=Nqt/BEDIeXN+7dTIp0cSPJgFi4w6MtNYqvkOIFy6ERA=; b=QDeW0PNuP4svKbkGcZEoNKTAPb B2PZkUIeiZ7DiK0B1FBAkb2jXBnu09RJcboi/uaEW+AgiwtxaVgbiobpZmFmorOHRLH+hIpzQTBtd gK/zXE4hWKK4eC+6CtIE0iU28SH9GOI+BWnDJsmAR9B2in2A/A8qDleegnVMd7EKi+wTYcD1VJhQY 2mwK5NTmutGKdBoUZdBIl4fKX83BCTf9g8CBt/Age0G57ktw7+qEuX1vnk73AIsz3EZmr9t2XWXVq BlJ25W+yJHYozkkEgyo8ciAPTB7AZGcqyu/ZIWXAi8d5vUD0AvuaO0mEzW4/EUpDnGHFLRJeyGJUA 0G3P/A9Q==; Received: from localhost ([::1] helo=bombadil.infradead.org) by bombadil.infradead.org with esmtp (Exim 4.97.1 #2 (Red Hat Linux)) id 1sHal2-0000000EwHJ-13xm; Thu, 13 Jun 2024 03:04:12 +0000 Received: from mail-oa1-f52.google.com ([209.85.160.52]) by bombadil.infradead.org with esmtps (Exim 4.97.1 #2 (Red Hat Linux)) id 1sHakx-0000000EwE8-3HPF for linux-mediatek@lists.infradead.org; Thu, 13 Jun 2024 03:04:09 +0000 Received: by mail-oa1-f52.google.com with SMTP id 586e51a60fabf-254f646b625so96470fac.0 for ; Wed, 12 Jun 2024 20:04:07 -0700 (PDT) X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1718247847; x=1718852647; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:x-gm-message-state:from:to:cc :subject:date:message-id:reply-to; bh=Nqt/BEDIeXN+7dTIp0cSPJgFi4w6MtNYqvkOIFy6ERA=; b=Sz/UUTwZzwOZGvyGZf18GDLd3WhIw4iBEJV8G+MEaVvzsahfRKkynyMwftv5kgDsx1 IiL1F+BWhMJ6Jc7WFbKUVdKQRYnZ4K3eaJR+cAE8vL++R0iEqj3emyri6hMhl9n00YS9 jwXCVtW3EL/CPp6FNaaKCzS00Zoq5Et8+UZdH8WJmHA5fVLdlQ/v0l/Wlbc4l+3f57QQ Hu4V8mnyIzNejNIHarZyqvrmN7v6J0lV+F6EDQ8zZalIvCa3ufzmzq3TtJZ+DsIvU2tH SG/kTA07hcXAlkA6OZUrx30+KKG0RG616yZqGQWPWnHAtdJNkoQKANtoPxZtXxpcW/7d eUQQ== X-Forwarded-Encrypted: i=1; AJvYcCXtbLbegoi56zxe0n0XmEeQFxbIT9UTxZclbVMQtKlambdraWzR/I5kC9Ua/GGRW2qjI7nSur1tcZ7I0RgjQ2BUmeL5ZToacTsfPRxOlX015hgv X-Gm-Message-State: AOJu0Yz58dHEVOiWIilfIF/K/wxuH54jzfGrU+gkNigGisGz+gDWeqUB /ze2Uo+hjrMsQjMht9SX/2A1vGj9P+dEl7vK1ivGjROGvBbkGe0r X-Google-Smtp-Source: AGHT+IHw7uKmZJqD7BB5NAXIQv9kZD1ke/Du0CzB7V5wqeMHLqU/91SdPlWac7kB2vk8CgeU5PaNCw== X-Received: by 2002:a4a:3101:0:b0:5ba:ca8a:6598 with SMTP id 006d021491bc7-5bb3b7b972bmr3908405eaf.0.1718247846756; Wed, 12 Jun 2024 20:04:06 -0700 (PDT) Received: from sean-ThinkPad-T450s.lan ([207.191.35.252]) by smtp.gmail.com with ESMTPSA id 006d021491bc7-5bd629263c5sm67685eaf.46.2024.06.12.20.04.04 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Wed, 12 Jun 2024 20:04:05 -0700 (PDT) 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 38/47] wifi: mt76: mt7925: extend mt7925_mcu_sta_hdr_trans_tlv for per-link STA Date: Wed, 12 Jun 2024 20:02:32 -0700 Message-Id: <20240613030241.5771-39-sean.wang@kernel.org> X-Mailer: git-send-email 2.25.1 In-Reply-To: <20240613030241.5771-1-sean.wang@kernel.org> References: <20240613030241.5771-1-sean.wang@kernel.org> MIME-Version: 1.0 X-CRM114-Version: 20100106-BlameMichelson ( TRE 0.8.0 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20240612_200407_905578_CB51014A X-CRM114-Status: GOOD ( 11.63 ) X-BeenThere: linux-mediatek@lists.infradead.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Sender: "Linux-mediatek" Errors-To: linux-mediatek-bounces+linux-mediatek=archiver.kernel.org@lists.infradead.org From: Sean Wang Extend mt7925_mcu_sta_hdr_trans_tlv with per-link STA 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: Ming Yen Hsieh Signed-off-by: Ming Yen Hsieh Co-developed-by: Deren Wu Signed-off-by: Deren Wu Signed-off-by: Sean Wang --- drivers/net/wireless/mediatek/mt76/mt7925/mcu.c | 16 ++++++---------- 1 file changed, 6 insertions(+), 10 deletions(-) diff --git a/drivers/net/wireless/mediatek/mt76/mt7925/mcu.c b/drivers/net/wireless/mediatek/mt76/mt7925/mcu.c index 5a40979c0bba..667ecd44392d 100644 --- a/drivers/net/wireless/mediatek/mt76/mt7925/mcu.c +++ b/drivers/net/wireless/mediatek/mt76/mt7925/mcu.c @@ -847,7 +847,7 @@ EXPORT_SYMBOL_GPL(mt7925_run_firmware); static void mt7925_mcu_sta_hdr_trans_tlv(struct sk_buff *skb, struct ieee80211_vif *vif, - struct ieee80211_sta *sta) + struct ieee80211_link_sta *link_sta) { struct mt792x_vif *mvif = (struct mt792x_vif *)vif->drv_priv; struct sta_rec_hdr_trans *hdr_trans; @@ -863,8 +863,8 @@ mt7925_mcu_sta_hdr_trans_tlv(struct sk_buff *skb, else hdr_trans->from_ds = true; - if (sta) - wcid = (struct mt76_wcid *)sta->drv_priv; + if (link_sta) + wcid = (struct mt76_wcid *)link_sta->sta->drv_priv; else wcid = &mvif->sta.deflink.wcid; @@ -895,7 +895,7 @@ int mt7925_mcu_wtbl_update_hdr_trans(struct mt792x_dev *dev, return PTR_ERR(skb); /* starec hdr trans */ - mt7925_mcu_sta_hdr_trans_tlv(skb, vif, sta); + mt7925_mcu_sta_hdr_trans_tlv(skb, vif, &sta->deflink); return mt76_mcu_skb_send_msg(&dev->mt76, skb, MCU_WMWA_UNI_CMD(STA_REC_UPDATE), true); } @@ -1664,12 +1664,8 @@ mt7925_mcu_sta_cmd(struct mt76_phy *phy, mt7925_mcu_sta_mld_tlv(skb, info->vif, info->link_sta->sta); } - if (info->enable) { - struct ieee80211_sta *sta = info->link_sta ? - info->link_sta->sta : NULL; - - mt7925_mcu_sta_hdr_trans_tlv(skb, info->vif, 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); } From patchwork Thu Jun 13 03:02:33 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Sean Wang X-Patchwork-Id: 13696072 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from bombadil.infradead.org (bombadil.infradead.org [198.137.202.133]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.lore.kernel.org (Postfix) with ESMTPS id B9BFAC27C79 for ; Thu, 13 Jun 2024 03:04:13 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=lists.infradead.org; s=bombadil.20210309; h=Sender:List-Subscribe:List-Help :List-Post:List-Archive:List-Unsubscribe:List-Id:Content-Transfer-Encoding: MIME-Version:References:In-Reply-To:Message-Id:Date:Subject:Cc:To:From: Reply-To:Content-Type:Content-ID:Content-Description:Resent-Date:Resent-From: Resent-Sender:Resent-To:Resent-Cc:Resent-Message-ID:List-Owner; bh=cpNMqJkAA2wzb/wI14GkcWcUpOPlO27N/TMsWpf1FR0=; b=1NmZ/CcJZUepa+KOd+kRbf4jtk o/BO8qr8v0DqfDrILslDeEOjpUZeXmCXmcxiiBvyHX8tESY77nYfHm/Qm+jtGiHGzf5lOuxEhvgSr kbAyhrBa1GXQz1U2h96I4r7rNr/Pl6uje3UOIay6P2+1SQxMuhz4smH2qQuhmQiyHvpCes6TPuwQZ pwIFvQCs8REU8OCRnZANFIQAoVBLrK5Zjb2t/u9oejtYGtZzBpNRLrhnR2cvjFE0qkgOmfrdeSQEx aeZlX3GaDwT4O9e+iJFw1tH2znfn4pUfchzr417L9dWlLIlkLZN94cAf1lWNmawwUmB6+8jA7ck7L LJqg9NYA==; Received: from localhost ([::1] helo=bombadil.infradead.org) by bombadil.infradead.org with esmtp (Exim 4.97.1 #2 (Red Hat Linux)) id 1sHal3-0000000EwID-08nv; Thu, 13 Jun 2024 03:04:13 +0000 Received: from mail-oo1-f52.google.com ([209.85.161.52]) by bombadil.infradead.org with esmtps (Exim 4.97.1 #2 (Red Hat Linux)) id 1sHaky-0000000EwEx-2ucI for linux-mediatek@lists.infradead.org; Thu, 13 Jun 2024 03:04:11 +0000 Received: by mail-oo1-f52.google.com with SMTP id 006d021491bc7-5b3356fd4f3so38475eaf.1 for ; Wed, 12 Jun 2024 20:04:08 -0700 (PDT) X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1718247848; x=1718852648; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:x-gm-message-state:from:to:cc :subject:date:message-id:reply-to; bh=cpNMqJkAA2wzb/wI14GkcWcUpOPlO27N/TMsWpf1FR0=; b=A/VVHcTyrloHXdrrjNoAASMb1oP2awmQA/U+rjqgmMzHuYiP+2FHWB0KmwbIO+TaDf oSSBLpRLRB9Z8vKcjSCKIF+09i/yIgATEYlr6uMUdhGLCJoIElnbxnyg5KdUY5r9pD39 cvd/pgu8+D8/PzlM4kTVgoPKF1b9Ej2gz6xCH76jgLssgTh2V1ak8Y5039CL98V0rjmJ Do6DODNAN90zfuOT7/vQHrDxnR+tCBia5IQYN1gvloyz2tMBOyOZH7PWYxQPVESlXT0M DisJOJJ/pcY/5ThHdJ/5j0fHLxzZl5M5/ezb+1YjMHCO10q9JzE+tlJaYljLZDB8KuCd SxRw== X-Forwarded-Encrypted: i=1; AJvYcCXK2MUDXQz/WiW4zeKolB2c1IOruBe/AMFOFu/SKvWCLI8io5B22DdRjUcIiA39+2aLwB5wI0PosDkv+bu3tQ==@lists.infradead.org X-Gm-Message-State: AOJu0Yx2VOFqIdV6IBdLAhMR4VmboBFuxMLrf/BBeT+/s1m0dqG2I7o3 Wp9ADJ4zEB1xw7M2parzNQRWREZYipn1Mc8L3Kj6oGYY4jv9c/Td/eDoowPZ7I8= X-Google-Smtp-Source: AGHT+IHYPct9Rt5bxYHHJDkUc4nkQhYW7M7rTF1uzIU6UJKM5FsSWXS7AnJkTQ26FXuJ+SfmYJE3IQ== X-Received: by 2002:a4a:d196:0:b0:5bd:87a0:66d with SMTP id 006d021491bc7-5bd87a01b93mr286829eaf.1.1718247847820; Wed, 12 Jun 2024 20:04:07 -0700 (PDT) Received: from sean-ThinkPad-T450s.lan ([207.191.35.252]) by smtp.gmail.com with ESMTPSA id 006d021491bc7-5bd629263c5sm67685eaf.46.2024.06.12.20.04.06 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Wed, 12 Jun 2024 20:04:07 -0700 (PDT) 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 39/47] wifi: mt76: mt7925: extend mt7925_mcu_add_bss_info for per-link STA Date: Wed, 12 Jun 2024 20:02:33 -0700 Message-Id: <20240613030241.5771-40-sean.wang@kernel.org> X-Mailer: git-send-email 2.25.1 In-Reply-To: <20240613030241.5771-1-sean.wang@kernel.org> References: <20240613030241.5771-1-sean.wang@kernel.org> MIME-Version: 1.0 X-CRM114-Version: 20100106-BlameMichelson ( TRE 0.8.0 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20240612_200408_779056_00C14C82 X-CRM114-Status: GOOD ( 13.88 ) X-BeenThere: linux-mediatek@lists.infradead.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Sender: "Linux-mediatek" Errors-To: linux-mediatek-bounces+linux-mediatek=archiver.kernel.org@lists.infradead.org From: Sean Wang Extend mt7925_mcu_add_bss_info with the per-link STA 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: Ming Yen Hsieh Signed-off-by: Ming Yen Hsieh Co-developed-by: Deren Wu Signed-off-by: Deren Wu Signed-off-by: Sean Wang --- drivers/net/wireless/mediatek/mt76/mt7925/main.c | 8 ++++---- drivers/net/wireless/mediatek/mt76/mt7925/mcu.c | 6 +++--- drivers/net/wireless/mediatek/mt76/mt7925/mcu.h | 2 +- 3 files changed, 8 insertions(+), 8 deletions(-) diff --git a/drivers/net/wireless/mediatek/mt76/mt7925/main.c b/drivers/net/wireless/mediatek/mt76/mt7925/main.c index f3a32fe9a754..b91992745462 100644 --- a/drivers/net/wireless/mediatek/mt76/mt7925/main.c +++ b/drivers/net/wireless/mediatek/mt76/mt7925/main.c @@ -535,7 +535,7 @@ static int mt7925_set_key(struct ieee80211_hw *hw, enum set_key_cmd cmd, mvif->bss_conf.mt76.cipher = mt7925_mcu_get_cipher(key->cipher); mt7925_mcu_add_bss_info(phy, mvif->bss_conf.mt76.ctx, link_conf, - sta, true); + &sta->deflink, true); } if (cmd == SET_KEY) @@ -738,7 +738,7 @@ int mt7925_mac_sta_add(struct mt76_dev *mdev, struct ieee80211_vif *vif, /* should update bss info before STA add */ if (vif->type == NL80211_IFTYPE_STATION && !sta->tdls) mt7925_mcu_add_bss_info(&dev->phy, mvif->bss_conf.mt76.ctx, - link_conf, sta, false); + link_conf, &sta->deflink, false); ret = mt7925_mcu_sta_update(dev, &sta->deflink, vif, true, MT76_STA_INFO_STATE_NONE); @@ -765,7 +765,7 @@ void mt7925_mac_sta_assoc(struct mt76_dev *mdev, struct ieee80211_vif *vif, if (vif->type == NL80211_IFTYPE_STATION && !sta->tdls) mt7925_mcu_add_bss_info(&dev->phy, mvif->bss_conf.mt76.ctx, - link_conf, sta, true); + link_conf, &sta->deflink, true); ewma_avg_signal_init(&msta->deflink.avg_ack_signal); @@ -802,7 +802,7 @@ void mt7925_mac_sta_remove(struct mt76_dev *mdev, struct ieee80211_vif *vif, ewma_rssi_init(&mvif->bss_conf.rssi); if (!sta->tdls) mt7925_mcu_add_bss_info(&dev->phy, mvif->bss_conf.mt76.ctx, - link_conf, sta, false); + link_conf, &sta->deflink, false); } spin_lock_bh(&mdev->sta_poll_lock); diff --git a/drivers/net/wireless/mediatek/mt76/mt7925/mcu.c b/drivers/net/wireless/mediatek/mt76/mt7925/mcu.c index 667ecd44392d..d5f94ee78623 100644 --- a/drivers/net/wireless/mediatek/mt76/mt7925/mcu.c +++ b/drivers/net/wireless/mediatek/mt76/mt7925/mcu.c @@ -2337,7 +2337,7 @@ int mt7925_mcu_set_timing(struct mt792x_phy *phy, int mt7925_mcu_add_bss_info(struct mt792x_phy *phy, struct ieee80211_chanctx_conf *ctx, struct ieee80211_bss_conf *link_conf, - struct ieee80211_sta *sta, + struct ieee80211_link_sta *link_sta, int enable) { struct mt792x_vif *mvif = (struct mt792x_vif *)link_conf->vif->drv_priv; @@ -2352,13 +2352,13 @@ int mt7925_mcu_add_bss_info(struct mt792x_phy *phy, return PTR_ERR(skb); /* bss_basic must be first */ - mt7925_mcu_bss_basic_tlv(skb, link_conf, sta, ctx, phy->mt76, + mt7925_mcu_bss_basic_tlv(skb, link_conf, link_sta->sta, ctx, phy->mt76, mvif->sta.deflink.wcid.idx, enable); mt7925_mcu_bss_sec_tlv(skb, link_conf); mt7925_mcu_bss_bmc_tlv(skb, phy, ctx, link_conf); mt7925_mcu_bss_qos_tlv(skb, link_conf); - mt7925_mcu_bss_mld_tlv(skb, link_conf, sta); + mt7925_mcu_bss_mld_tlv(skb, link_conf, link_sta->sta); mt7925_mcu_bss_ifs_tlv(skb, link_conf); if (link_conf->he_support) { diff --git a/drivers/net/wireless/mediatek/mt76/mt7925/mcu.h b/drivers/net/wireless/mediatek/mt76/mt7925/mcu.h index c5197577cdc8..da4e84f468d2 100644 --- a/drivers/net/wireless/mediatek/mt76/mt7925/mcu.h +++ b/drivers/net/wireless/mediatek/mt76/mt7925/mcu.h @@ -595,7 +595,7 @@ int mt7925_mcu_sched_scan_enable(struct mt76_phy *phy, int mt7925_mcu_add_bss_info(struct mt792x_phy *phy, struct ieee80211_chanctx_conf *ctx, struct ieee80211_bss_conf *link_conf, - struct ieee80211_sta *sta, + struct ieee80211_link_sta *link_sta, int enable); int mt7925_mcu_set_timing(struct mt792x_phy *phy, struct ieee80211_bss_conf *link_conf); From patchwork Thu Jun 13 03:02:34 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Sean Wang X-Patchwork-Id: 13696073 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from bombadil.infradead.org (bombadil.infradead.org [198.137.202.133]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.lore.kernel.org (Postfix) with ESMTPS id 402F6C27C53 for ; Thu, 13 Jun 2024 03:04:17 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=lists.infradead.org; s=bombadil.20210309; h=Sender:List-Subscribe:List-Help :List-Post:List-Archive:List-Unsubscribe:List-Id:Content-Transfer-Encoding: MIME-Version:References:In-Reply-To:Message-Id:Date:Subject:Cc:To:From: Reply-To:Content-Type:Content-ID:Content-Description:Resent-Date:Resent-From: Resent-Sender:Resent-To:Resent-Cc:Resent-Message-ID:List-Owner; bh=QluQbYsRthrq2TjY99xwQmJ0DyLFnyarxriaOvZB7dE=; b=uiwkX1vEQgYfONTuuhrvKqeHLj IffbT+ITIBO/so9Kt44Z5vC1F/qROaBbBKrRXHwR3rbyNYHys86fyapOmi4bF5XXjsT16XBxbvyhj /pspshP7B6Tqz7hlBUJnfHQ9/T1Wkp69vR/IsWaoFbOlnbllL5AUXpR5shA4x1UcEA1c6oardmHUh XppfOZU+lD17LwhnwZ0+BpdSuMcUwFWtOs+XUBFHJCplNAjVEJgL8MvgnzopIUU43NygxqlCPbrle q5e4GyZJTJYt7il0lhOBMZp1xeVYvWvBJRLbSj0AzDNhlCrPAOP7ABv1LvRA+LQxskqUzgNI2Kg4q MWkHYjgQ==; Received: from localhost ([::1] helo=bombadil.infradead.org) by bombadil.infradead.org with esmtp (Exim 4.97.1 #2 (Red Hat Linux)) id 1sHal6-0000000EwKw-3fmS; Thu, 13 Jun 2024 03:04:16 +0000 Received: from mail-oa1-f42.google.com ([209.85.160.42]) by bombadil.infradead.org with esmtps (Exim 4.97.1 #2 (Red Hat Linux)) id 1sHal0-0000000EwG6-3nZX for linux-mediatek@lists.infradead.org; Thu, 13 Jun 2024 03:04:13 +0000 Received: by mail-oa1-f42.google.com with SMTP id 586e51a60fabf-254f646b625so96475fac.0 for ; Wed, 12 Jun 2024 20:04:10 -0700 (PDT) X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1718247850; x=1718852650; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:x-gm-message-state:from:to:cc :subject:date:message-id:reply-to; bh=QluQbYsRthrq2TjY99xwQmJ0DyLFnyarxriaOvZB7dE=; b=S+l1F/nq+pQWgGCT3PFtuZbWH9N9V3RhkaSxwV1tTtWdB434ozq7lTHB0CUoK+LSUF yaiIlhowg2FnQnhVKLSVmwxXk4JKtSztFKfvewZHCBg+slan99vnKU+6C4VkJy1xFZ/F Ce5ie1LUtsMDnZWmo3OOy6VF+tqKGco6nueRY19i3xpz8BPCVWGQvopgy+wYsLCbPS44 wwEuDbEgTyNu3FSE30zV46df8xQX7J0kPGVf7/ZF/mYKDEp4gJzxt6UQVgjPUu6igVnT IDUjhjEmQ0/GcV8YNBKY++u/i7Yh71c0NmRhlxeSqb4SssCLMBA41KPoqWq6W4TdbRL1 aFhg== X-Forwarded-Encrypted: i=1; AJvYcCUhDhAS7xQi7mIaqZsIWj4CT6X7y59jZhtolpBwJC6koy4FcezlvhI+VcSDfrb1zONV2m7z0vgYn45nuDDmbiRuT7h5JFD7lVjnx3D3ZcitG4My X-Gm-Message-State: AOJu0YxGd5m+wDolZCKfAJd8U3zSRjpcH7cN/E5qV7wr4txkjXYs2mob cZT57QQmQr/jrVeIXiO1A9wIlwSK5OF0OMuKSLDX3BhRfHB3okmh X-Google-Smtp-Source: AGHT+IHHJAHArvkNLNdoaLuxrn6Rn+tkoIm65xYZGjX4Jf85vYwD0NOU2/HuFivJiJE18UYq80YE7A== X-Received: by 2002:a4a:3101:0:b0:5ba:ca8a:6598 with SMTP id 006d021491bc7-5bb3b7b972bmr3908503eaf.0.1718247849788; Wed, 12 Jun 2024 20:04:09 -0700 (PDT) Received: from sean-ThinkPad-T450s.lan ([207.191.35.252]) by smtp.gmail.com with ESMTPSA id 006d021491bc7-5bd629263c5sm67685eaf.46.2024.06.12.20.04.07 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Wed, 12 Jun 2024 20:04:08 -0700 (PDT) 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 40/47] wifi: mt76: mt7925: extend mt7925_mcu_bss_mld_tlv for per-link STA Date: Wed, 12 Jun 2024 20:02:34 -0700 Message-Id: <20240613030241.5771-41-sean.wang@kernel.org> X-Mailer: git-send-email 2.25.1 In-Reply-To: <20240613030241.5771-1-sean.wang@kernel.org> References: <20240613030241.5771-1-sean.wang@kernel.org> MIME-Version: 1.0 X-CRM114-Version: 20100106-BlameMichelson ( TRE 0.8.0 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20240612_200411_106986_83D4CA9F X-CRM114-Status: GOOD ( 10.76 ) X-BeenThere: linux-mediatek@lists.infradead.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Sender: "Linux-mediatek" Errors-To: linux-mediatek-bounces+linux-mediatek=archiver.kernel.org@lists.infradead.org From: Sean Wang Extend mt7925_mcu_bss_mld_tlv with the per-link STA configuration. Co-developed-by: Ming Yen Hsieh Signed-off-by: Ming Yen Hsieh Co-developed-by: Deren Wu Signed-off-by: Deren Wu Signed-off-by: Sean Wang --- drivers/net/wireless/mediatek/mt76/mt7925/mcu.c | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-) diff --git a/drivers/net/wireless/mediatek/mt76/mt7925/mcu.c b/drivers/net/wireless/mediatek/mt76/mt7925/mcu.c index d5f94ee78623..24966e614303 100644 --- a/drivers/net/wireless/mediatek/mt76/mt7925/mcu.c +++ b/drivers/net/wireless/mediatek/mt76/mt7925/mcu.c @@ -2227,7 +2227,7 @@ mt7925_mcu_bss_bmc_tlv(struct sk_buff *skb, struct mt792x_phy *phy, static void mt7925_mcu_bss_mld_tlv(struct sk_buff *skb, struct ieee80211_bss_conf *link_conf, - struct ieee80211_sta *sta) + struct ieee80211_link_sta *link_sta) { struct mt792x_bss_conf *mconf = mt792x_link_conf_to_mconf(link_conf); bool is_mld = ieee80211_vif_is_mld(link_conf->vif); @@ -2237,13 +2237,13 @@ mt7925_mcu_bss_mld_tlv(struct sk_buff *skb, tlv = mt76_connac_mcu_add_tlv(skb, UNI_BSS_INFO_MLD, sizeof(*mld)); mld = (struct bss_mld_tlv *)tlv; - mld->link_id = sta ? (is_mld ? link_conf->link_id : 0) : 0xff; + mld->link_id = link_sta ? (is_mld ? link_conf->link_id : 0) : 0xff; mld->group_mld_id = is_mld ? mconf->mt76.idx : 0xff; mld->own_mld_id = mconf->mt76.idx + 32; mld->remap_idx = 0xff; - if (sta) - memcpy(mld->mac_addr, sta->addr, ETH_ALEN); + if (link_sta) + memcpy(mld->mac_addr, link_sta->addr, ETH_ALEN); } static void @@ -2358,7 +2358,7 @@ int mt7925_mcu_add_bss_info(struct mt792x_phy *phy, mt7925_mcu_bss_bmc_tlv(skb, phy, ctx, link_conf); mt7925_mcu_bss_qos_tlv(skb, link_conf); - mt7925_mcu_bss_mld_tlv(skb, link_conf, link_sta->sta); + mt7925_mcu_bss_mld_tlv(skb, link_conf, link_sta); mt7925_mcu_bss_ifs_tlv(skb, link_conf); if (link_conf->he_support) { From patchwork Thu Jun 13 03:02:35 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Sean Wang X-Patchwork-Id: 13696074 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from bombadil.infradead.org (bombadil.infradead.org [198.137.202.133]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.lore.kernel.org (Postfix) with ESMTPS id A2B75C27C77 for ; Thu, 13 Jun 2024 03:04:17 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=lists.infradead.org; s=bombadil.20210309; h=Sender:List-Subscribe:List-Help :List-Post:List-Archive:List-Unsubscribe:List-Id:Content-Transfer-Encoding: MIME-Version:References:In-Reply-To:Message-Id:Date:Subject:Cc:To:From: Reply-To:Content-Type:Content-ID:Content-Description:Resent-Date:Resent-From: Resent-Sender:Resent-To:Resent-Cc:Resent-Message-ID:List-Owner; bh=OgMigc2VAhtdTb1uu0yJ7C/V9AuPVgLB5PjEnDvYkH8=; b=Mjh8sXyXZ2jZ3iN4wKpNxgtkrq rpweJ6P1x19mOCp1hQ+0pzP/QUyBvYFj1tC6uidQ5aHWvjYxr9LPCa3xnkJuYeLd+KNdnbBR37k6D v92VVqBSzKKxWW5Jg69mDbnl624brY7N36e1oXXHca3bjhO/7/fUXH4YAk8EL3w3Bs/y1SIqpkBVc y9knM0CQLtaFF60pFWounMECynQisx5r8a/4r7U7WcT2VdM4gu4i3pg8vKDDzMY884ti3d98u3JZJ 43hJS3LRNz2ZQUmAfJLhPwn78IKs4beF6niMj9dcr/vpTeBgUdCx+gBzCRzozz0CNgNhj9k2DIl9B GtFVTvFw==; Received: from localhost ([::1] helo=bombadil.infradead.org) by bombadil.infradead.org with esmtp (Exim 4.97.1 #2 (Red Hat Linux)) id 1sHal7-0000000EwLF-0tsE; Thu, 13 Jun 2024 03:04:17 +0000 Received: from mail-oo1-f46.google.com ([209.85.161.46]) by bombadil.infradead.org with esmtps (Exim 4.97.1 #2 (Red Hat Linux)) id 1sHal2-0000000EwH9-22Nf for linux-mediatek@lists.infradead.org; Thu, 13 Jun 2024 03:04:15 +0000 Received: by mail-oo1-f46.google.com with SMTP id 006d021491bc7-5bb10cfe7daso36900eaf.2 for ; Wed, 12 Jun 2024 20:04:12 -0700 (PDT) X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1718247851; x=1718852651; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:x-gm-message-state:from:to:cc :subject:date:message-id:reply-to; bh=OgMigc2VAhtdTb1uu0yJ7C/V9AuPVgLB5PjEnDvYkH8=; b=HH7B1qZZqFzyNXUEzSk6dqyOmfJjVY0EDJ1SOYL9z1vemK+veJfSlUv97jjFdOsB+P b/1UOM5UkeowEUP6xPFFwDiwaroes0A6XhirtzBaUHwA7A4g3BEW47tmW9KO8Pwar4WC +WLFbw64YoYToPl46ShhvGarFNFZW3YLETQIUdKWpcvr0cJtqpZ0ItcIpprn8C1LuVcZ 3xBmUEq0dDlDi2A63qHJIcJLEVXhIqVzvy7ai78k8nwLw/6uYWaj30LyP77tyUcDAQBx 1ifHC0XdTl8iqky/lJTu83mXayU9IJLPOPsrpxS35Y9vbE2ODZPVAyiJ2DSa9UzXdd+8 erhQ== X-Forwarded-Encrypted: i=1; AJvYcCXICxGt7i7a0hmspzj+G7uRIYteg5eKvpflK+LsF/bywx4zGkqADaC1ST2ZkHq79IzV/GCNsf4bFofgtd1Le14FLILzphhtfyy8DNLlbBrET6gP X-Gm-Message-State: AOJu0YwJ1trxcYgvbVbjuWfVAJPmhiTelOL7jEzKMs3zzbse+HQ02euR PrV8mhUMZEIYqJOGWs8WomfhaJCXYLgyhdcCrqsxzs1ua7l0eTaq X-Google-Smtp-Source: AGHT+IELnhgtggY4/ayU1vQAw9jcuSekNmvxXHACEAQ0mYwcUJ76ywNVecENM/8BKUBdyqxm5HkDdQ== X-Received: by 2002:a4a:d196:0:b0:5bd:87a0:66d with SMTP id 006d021491bc7-5bd87a01b93mr286964eaf.1.1718247851492; Wed, 12 Jun 2024 20:04:11 -0700 (PDT) Received: from sean-ThinkPad-T450s.lan ([207.191.35.252]) by smtp.gmail.com with ESMTPSA id 006d021491bc7-5bd629263c5sm67685eaf.46.2024.06.12.20.04.09 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Wed, 12 Jun 2024 20:04:10 -0700 (PDT) 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 41/47] wifi: mt76: mt7925: extend mt7925_mcu_bss_basic_tlv for per-link STA Date: Wed, 12 Jun 2024 20:02:35 -0700 Message-Id: <20240613030241.5771-42-sean.wang@kernel.org> X-Mailer: git-send-email 2.25.1 In-Reply-To: <20240613030241.5771-1-sean.wang@kernel.org> References: <20240613030241.5771-1-sean.wang@kernel.org> MIME-Version: 1.0 X-CRM114-Version: 20100106-BlameMichelson ( TRE 0.8.0 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20240612_200412_619972_C66966B3 X-CRM114-Status: GOOD ( 11.54 ) X-BeenThere: linux-mediatek@lists.infradead.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Sender: "Linux-mediatek" Errors-To: linux-mediatek-bounces+linux-mediatek=archiver.kernel.org@lists.infradead.org From: Sean Wang Extend mt7925_mcu_bss_basic_tlv with the per-link STA configuration. Co-developed-by: Ming Yen Hsieh Signed-off-by: Ming Yen Hsieh Co-developed-by: Deren Wu Signed-off-by: Deren Wu Signed-off-by: Sean Wang --- .../net/wireless/mediatek/mt76/mt7925/mcu.c | 25 +++++++++++++------ 1 file changed, 17 insertions(+), 8 deletions(-) diff --git a/drivers/net/wireless/mediatek/mt76/mt7925/mcu.c b/drivers/net/wireless/mediatek/mt76/mt7925/mcu.c index 24966e614303..7156ba092302 100644 --- a/drivers/net/wireless/mediatek/mt76/mt7925/mcu.c +++ b/drivers/net/wireless/mediatek/mt76/mt7925/mcu.c @@ -2078,18 +2078,17 @@ mt7925_get_phy_mode_ext(struct mt76_phy *phy, struct ieee80211_vif *vif, static void mt7925_mcu_bss_basic_tlv(struct sk_buff *skb, struct ieee80211_bss_conf *link_conf, - struct ieee80211_sta *sta, + struct ieee80211_link_sta *link_sta, struct ieee80211_chanctx_conf *ctx, struct mt76_phy *phy, u16 wlan_idx, bool enable) { struct ieee80211_vif *vif = link_conf->vif; struct mt792x_bss_conf *mconf = mt792x_link_conf_to_mconf(link_conf); - struct mt792x_sta *msta = sta ? (struct mt792x_sta *)sta->drv_priv : - &mconf->vif->sta; struct cfg80211_chan_def *chandef = ctx ? &ctx->def : &phy->chandef; enum nl80211_band band = chandef->chan->band; struct mt76_connac_bss_basic_tlv *basic_req; + struct mt792x_link_sta *mlink; struct tlv *tlv; int conn_type; u8 idx; @@ -2102,7 +2101,7 @@ mt7925_mcu_bss_basic_tlv(struct sk_buff *skb, basic_req->hw_bss_idx = idx; basic_req->phymode_ext = mt7925_get_phy_mode_ext(phy, vif, band, - &sta->deflink); + link_sta); if (band == NL80211_BAND_2GHZ) basic_req->nonht_basic_phy = cpu_to_le16(PHY_TYPE_ERP_INDEX); @@ -2110,12 +2109,22 @@ mt7925_mcu_bss_basic_tlv(struct sk_buff *skb, basic_req->nonht_basic_phy = cpu_to_le16(PHY_TYPE_OFDM_INDEX); memcpy(basic_req->bssid, link_conf->bssid, ETH_ALEN); - basic_req->phymode = mt76_connac_get_phy_mode(phy, vif, band, - &sta->deflink); + basic_req->phymode = mt76_connac_get_phy_mode(phy, vif, band, link_sta); basic_req->bcn_interval = cpu_to_le16(link_conf->beacon_int); basic_req->dtim_period = link_conf->dtim_period; basic_req->bmc_tx_wlan_idx = cpu_to_le16(wlan_idx); - basic_req->sta_idx = cpu_to_le16(msta->deflink.wcid.idx); + + if (link_sta) { + struct mt792x_sta *msta; + + msta = (struct mt792x_sta *)link_sta->sta->drv_priv; + mlink = mt792x_sta_to_link(msta, link_sta->link_id); + + } else { + mlink = &mconf->vif->sta.deflink; + } + + basic_req->sta_idx = cpu_to_le16(mlink->wcid.idx); basic_req->omac_idx = mconf->mt76.omac_idx; basic_req->band_idx = mconf->mt76.band_idx; basic_req->wmm_idx = mconf->mt76.wmm_idx; @@ -2352,7 +2361,7 @@ int mt7925_mcu_add_bss_info(struct mt792x_phy *phy, return PTR_ERR(skb); /* bss_basic must be first */ - mt7925_mcu_bss_basic_tlv(skb, link_conf, link_sta->sta, ctx, phy->mt76, + mt7925_mcu_bss_basic_tlv(skb, link_conf, link_sta, ctx, phy->mt76, mvif->sta.deflink.wcid.idx, enable); mt7925_mcu_bss_sec_tlv(skb, link_conf); From patchwork Thu Jun 13 03:02:36 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Sean Wang X-Patchwork-Id: 13696075 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from bombadil.infradead.org (bombadil.infradead.org [198.137.202.133]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.lore.kernel.org (Postfix) with ESMTPS id B6C9AC27C53 for ; Thu, 13 Jun 2024 03:04:19 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=lists.infradead.org; s=bombadil.20210309; h=Sender:List-Subscribe:List-Help :List-Post:List-Archive:List-Unsubscribe:List-Id:Content-Transfer-Encoding: MIME-Version:References:In-Reply-To:Message-Id:Date:Subject:Cc:To:From: Reply-To:Content-Type:Content-ID:Content-Description:Resent-Date:Resent-From: Resent-Sender:Resent-To:Resent-Cc:Resent-Message-ID:List-Owner; bh=8qaT8b7yGtuN3JUwjHPR4rGNkOaYwHk+6PNJhQjqaCo=; b=nHquJKNLNomv941SOAg4oRD/BD hgmYPq/+dpDq72XDEtrsgr5w/dS97o/E47hcV6CB9joxWf3tsQxZEd5EbcD4+hMxDr6SGf/v8dLAz DZih2wG3xKuh5IjMQtCVIzbW3O0ucYPsV7yBT9un2jcTOggAHrmx2MusJu1w/jsneuF2I+2+0nbNY g0XVMa18d4LVBTTo3MZsDoet388jx2nlWU7D2E2AhAE+BkutmBuLT22eRmmlwzM/eHm1CB0bTsr5n cNel2f8vQXaEJwVJj+iOuGHeHyHCQNT6OomWQ+vPvRoBv9DbXYg3dQct2Dv94i5sIWXqrzSwVy7t3 T9ta6c8g==; Received: from localhost ([::1] helo=bombadil.infradead.org) by bombadil.infradead.org with esmtp (Exim 4.97.1 #2 (Red Hat Linux)) id 1sHal9-0000000EwMx-1Vj1; Thu, 13 Jun 2024 03:04:19 +0000 Received: from mail-oa1-f52.google.com ([209.85.160.52]) by bombadil.infradead.org with esmtps (Exim 4.97.1 #2 (Red Hat Linux)) id 1sHal3-0000000EwIo-43hp for linux-mediatek@lists.infradead.org; Thu, 13 Jun 2024 03:04:16 +0000 Received: by mail-oa1-f52.google.com with SMTP id 586e51a60fabf-254925e6472so70203fac.0 for ; Wed, 12 Jun 2024 20:04:13 -0700 (PDT) X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1718247853; x=1718852653; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:x-gm-message-state:from:to:cc :subject:date:message-id:reply-to; bh=8qaT8b7yGtuN3JUwjHPR4rGNkOaYwHk+6PNJhQjqaCo=; b=LMu0AHQj3cGHJKuIB+DwPKEiTrgpqPkRr9M8vCmOF83aWbc3R8zb/4eFVnT3WCtwiG jA8JMXeYJs6ppmwNjBtv/3j/F6qKdkRa0pwAHL5tbeM4CZZmGO0lKskzhU/RcRA7yK7z 9+fLejcQ38wXJIPNYcuVV0j4EWr3525mxMr3vOry9CaXqOzxSjvwjKWFAkHEClGdiESA zoG2hb4Ilxl15sVIoS2w3IPpxPB7j9udP3dLAgbPRb2lqNN2FtHmeMkCqUC4sLMTvq1z JefHe3CfPfJbxImojLr5cqPdjLGAysi4/2xkLJyeCGpfFX9ZRDvBCO6XsiATQ9y0apMP ASXw== X-Forwarded-Encrypted: i=1; AJvYcCUfZKLpl2g2WmV3BN3kwcBApKnK+BdxanvE3kYO4QvUzJxHa3Ya5HYrcHxd5tm59dZywUggr9LZHXz+e/hP2A==@lists.infradead.org X-Gm-Message-State: AOJu0Yx8JXx7WlGEQ0kxIrsXmhBG8Zrwjosl+tJk+SV3VljYXWgk+7Ys Z/yz1eBM3EOa+xRpbYaWIeJl+876FKs31okqSZUm9L/GMVwl+RlB X-Google-Smtp-Source: AGHT+IEqhSHMsARTCevRepG4Bai6+yCrp4bNWqrV+fqylm24sKnywEbKk5XYKWvL19S43sQzF1dk/A== X-Received: by 2002:a05:6820:b0b:b0:5ba:c4ed:ee98 with SMTP id 006d021491bc7-5bb3b7a4c51mr3591290eaf.0.1718247853048; Wed, 12 Jun 2024 20:04:13 -0700 (PDT) Received: from sean-ThinkPad-T450s.lan ([207.191.35.252]) by smtp.gmail.com with ESMTPSA id 006d021491bc7-5bd629263c5sm67685eaf.46.2024.06.12.20.04.11 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Wed, 12 Jun 2024 20:04:11 -0700 (PDT) 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 42/47] wifi: mt76: mt7925: add mt7925_mac_link_sta_add to create per-link STA Date: Wed, 12 Jun 2024 20:02:36 -0700 Message-Id: <20240613030241.5771-43-sean.wang@kernel.org> X-Mailer: git-send-email 2.25.1 In-Reply-To: <20240613030241.5771-1-sean.wang@kernel.org> References: <20240613030241.5771-1-sean.wang@kernel.org> MIME-Version: 1.0 X-CRM114-Version: 20100106-BlameMichelson ( TRE 0.8.0 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20240612_200414_188489_F429643D X-CRM114-Status: GOOD ( 12.15 ) X-BeenThere: linux-mediatek@lists.infradead.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Sender: "Linux-mediatek" Errors-To: linux-mediatek-bounces+linux-mediatek=archiver.kernel.org@lists.infradead.org From: Sean Wang The mt7925_mac_link_sta_add function currently adds the per-link STA. We will extend this function when we implement the MLO functionality. This patch only includes structural changes and does not involve any logic changes. Signed-off-by: Sean Wang --- .../net/wireless/mediatek/mt76/mt7925/main.c | 47 ++++++++++++------- 1 file changed, 31 insertions(+), 16 deletions(-) diff --git a/drivers/net/wireless/mediatek/mt76/mt7925/main.c b/drivers/net/wireless/mediatek/mt76/mt7925/main.c index b91992745462..3911cf71462f 100644 --- a/drivers/net/wireless/mediatek/mt76/mt7925/main.c +++ b/drivers/net/wireless/mediatek/mt76/mt7925/main.c @@ -702,45 +702,46 @@ mt7925_get_rates_table(struct ieee80211_hw *hw, struct ieee80211_vif *vif, return mvif->basic_rates_idx; } -int mt7925_mac_sta_add(struct mt76_dev *mdev, struct ieee80211_vif *vif, - struct ieee80211_sta *sta) +static int mt7925_mac_link_sta_add(struct mt76_dev *mdev, + struct ieee80211_vif *vif, + struct ieee80211_link_sta *link_sta) { struct mt792x_dev *dev = container_of(mdev, struct mt792x_dev, mt76); - struct mt792x_sta *msta = (struct mt792x_sta *)sta->drv_priv; struct mt792x_vif *mvif = (struct mt792x_vif *)vif->drv_priv; struct ieee80211_bss_conf *link_conf; + struct mt792x_link_sta *mlink; + struct mt792x_sta *msta; int ret, idx; + msta = (struct mt792x_sta *)link_sta->sta->drv_priv; + mlink = mt792x_sta_to_link(msta, link_sta->link_id); + idx = mt76_wcid_alloc(dev->mt76.wcid_mask, MT792x_WTBL_STA - 1); if (idx < 0) return -ENOSPC; - INIT_LIST_HEAD(&msta->deflink.wcid.poll_list); - msta->vif = mvif; - msta->deflink.wcid.sta = 1; - msta->deflink.wcid.idx = idx; - msta->deflink.wcid.phy_idx = mvif->bss_conf.mt76.band_idx; - msta->deflink.wcid.tx_info |= MT_WCID_TX_INFO_SET; - msta->deflink.last_txs = jiffies; + INIT_LIST_HEAD(&mlink->wcid.poll_list); + mlink->wcid.sta = 1; + mlink->wcid.idx = idx; + mlink->wcid.phy_idx = mvif->bss_conf.mt76.band_idx; + mlink->wcid.tx_info |= MT_WCID_TX_INFO_SET; + mlink->last_txs = jiffies; ret = mt76_connac_pm_wake(&dev->mphy, &dev->pm); if (ret) return ret; - if (vif->type == NL80211_IFTYPE_STATION) - mvif->wep_sta = msta; - mt7925_mac_wtbl_update(dev, idx, MT_WTBL_UPDATE_ADM_COUNT_CLEAR); link_conf = mt792x_vif_to_bss_conf(vif, vif->bss_conf.link_id); /* should update bss info before STA add */ - if (vif->type == NL80211_IFTYPE_STATION && !sta->tdls) + if (vif->type == NL80211_IFTYPE_STATION && !link_sta->sta->tdls) mt7925_mcu_add_bss_info(&dev->phy, mvif->bss_conf.mt76.ctx, - link_conf, &sta->deflink, false); + link_conf, link_sta, false); - ret = mt7925_mcu_sta_update(dev, &sta->deflink, vif, true, + ret = mt7925_mcu_sta_update(dev, link_sta, vif, true, MT76_STA_INFO_STATE_NONE); if (ret) return ret; @@ -749,6 +750,20 @@ int mt7925_mac_sta_add(struct mt76_dev *mdev, struct ieee80211_vif *vif, return 0; } + +int mt7925_mac_sta_add(struct mt76_dev *mdev, struct ieee80211_vif *vif, + struct ieee80211_sta *sta) +{ + struct mt792x_vif *mvif = (struct mt792x_vif *)vif->drv_priv; + struct mt792x_sta *msta = (struct mt792x_sta *)sta->drv_priv; + + msta->vif = mvif; + + if (vif->type == NL80211_IFTYPE_STATION) + mvif->wep_sta = msta; + + return mt7925_mac_link_sta_add(mdev, vif, &sta->deflink); +} EXPORT_SYMBOL_GPL(mt7925_mac_sta_add); void mt7925_mac_sta_assoc(struct mt76_dev *mdev, struct ieee80211_vif *vif, From patchwork Thu Jun 13 03:02:37 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Sean Wang X-Patchwork-Id: 13696076 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from bombadil.infradead.org (bombadil.infradead.org [198.137.202.133]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.lore.kernel.org (Postfix) with ESMTPS id 4D351C27C79 for ; Thu, 13 Jun 2024 03:04:20 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=lists.infradead.org; s=bombadil.20210309; h=Sender:List-Subscribe:List-Help :List-Post:List-Archive:List-Unsubscribe:List-Id:Content-Transfer-Encoding: MIME-Version:References:In-Reply-To:Message-Id:Date:Subject:Cc:To:From: Reply-To:Content-Type:Content-ID:Content-Description:Resent-Date:Resent-From: Resent-Sender:Resent-To:Resent-Cc:Resent-Message-ID:List-Owner; bh=MnZF05g1ossfZRm0FvsZx86VQptBSn3TL85vtMAglhw=; b=vETn0wGLeh7u2AbIhIS3bcy0C1 CLCXcFwHJUZnOhlf8NZUjHFpdESETlNpX1BpFFYLQv/b7olniJKV2+A/oTtXUNIkjakiKbN2d5bzD zKyUBZUjgub50pu1ItvfPJb9/9WYfdTKrRoLeA4eMHmYZVvkTD6RNNxJqcNy5ZRUrBnex9zTb/uQU 71X9+qI2/vW+i6UvndqHUWf24W1IZORbsUOW67A3/+5urYLVdhYnepw1+mTpzOzoHjNTaQb7i/Q/d vo08ljhW9DQkYaUywL1cX49ubk8NehX02mftio2ok5R+SEmOZrQdF1zpmcg46uMRTZW1FEL0xbLEg KMB2R/+A==; Received: from localhost ([::1] helo=bombadil.infradead.org) by bombadil.infradead.org with esmtp (Exim 4.97.1 #2 (Red Hat Linux)) id 1sHal9-0000000EwNR-3gbc; Thu, 13 Jun 2024 03:04:19 +0000 Received: from mail-oo1-f49.google.com ([209.85.161.49]) by bombadil.infradead.org with esmtps (Exim 4.97.1 #2 (Red Hat Linux)) id 1sHal5-0000000EwJw-1tld for linux-mediatek@lists.infradead.org; Thu, 13 Jun 2024 03:04:18 +0000 Received: by mail-oo1-f49.google.com with SMTP id 006d021491bc7-5bb10cfe7daso36902eaf.2 for ; Wed, 12 Jun 2024 20:04:15 -0700 (PDT) X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1718247855; x=1718852655; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:x-gm-message-state:from:to:cc :subject:date:message-id:reply-to; bh=MnZF05g1ossfZRm0FvsZx86VQptBSn3TL85vtMAglhw=; b=AQaPu8FSarid4a1yCUk1MQV5VvjhjGfJHIvUGXwJwfsn0RbTpO/waA5x4tFNKxowr+ 87OLBGL33cNxozolge6BuVu286HZ+CO50CT1k/aQT0sQwEgOSyxLawFJzc+9X11mEy1W x8xz5Ikr9OEsbbfH0HJfHiA9KCMWS9MLSKpVXfA+79ieYlqVEgk+kCuOd/1ncXgYVqkK 1Ea0Nk3YhAzNaK7zCqdc2Qqy17ubWsbvnDW+Qbd893Tb/dVxE4fe6INyQN6Pvln6hJVY tpo3sSirD1Y+8Y/81tRjJ41PKQ0/RUPFT2aM9dv/i232tUOPCJrdZjgGlIVH/L5QvNzi sSPg== X-Forwarded-Encrypted: i=1; AJvYcCUAvXEXAOLrEiI20Sy82VCOUYQwl1GPHSY1Ot0cWBNFyd+FfzGQKKTlfwA1ODRnysbc2LPCa2FFxU5ilUB+LkKDM81yB0oRIyLp1A5PSTp5TJgv X-Gm-Message-State: AOJu0YxkVcu14jt40nPtVkGiP1LQR0sK8VWMhZ1dOAYK1PZTyMVRJ7VY 4+ht/DdELYYYcnXfCULURAdqyQTYz4w1fw8bxruGMHxlp9Be27HIJKH5u6KnkvU= X-Google-Smtp-Source: AGHT+IHws/ZWXRCtHHewDwSprWC4KLFzfUqKsSexiREanNejKeD2YkRsqQNuGYB5vQ2IxCcXbOwpiQ== X-Received: by 2002:a4a:d196:0:b0:5bd:87a0:66d with SMTP id 006d021491bc7-5bd87a01b93mr287086eaf.1.1718247854625; Wed, 12 Jun 2024 20:04:14 -0700 (PDT) Received: from sean-ThinkPad-T450s.lan ([207.191.35.252]) by smtp.gmail.com with ESMTPSA id 006d021491bc7-5bd629263c5sm67685eaf.46.2024.06.12.20.04.13 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Wed, 12 Jun 2024 20:04:13 -0700 (PDT) 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 43/47] wifi: mt76: mt7925: add mt7925_mac_link_sta_assoc to associate per-link STA Date: Wed, 12 Jun 2024 20:02:37 -0700 Message-Id: <20240613030241.5771-44-sean.wang@kernel.org> X-Mailer: git-send-email 2.25.1 In-Reply-To: <20240613030241.5771-1-sean.wang@kernel.org> References: <20240613030241.5771-1-sean.wang@kernel.org> MIME-Version: 1.0 X-CRM114-Version: 20100106-BlameMichelson ( TRE 0.8.0 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20240612_200415_914090_E26ECE02 X-CRM114-Status: GOOD ( 11.21 ) X-BeenThere: linux-mediatek@lists.infradead.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Sender: "Linux-mediatek" Errors-To: linux-mediatek-bounces+linux-mediatek=archiver.kernel.org@lists.infradead.org From: Sean Wang The mt7925_mac_link_sta_add function currently associates the per-link STA. We will extend this function when we implement the MLO functionality. This patch only includes structural changes and does not involve any logic changes. Signed-off-by: Sean Wang --- .../net/wireless/mediatek/mt76/mt7925/main.c | 29 +++++++++++++------ 1 file changed, 20 insertions(+), 9 deletions(-) diff --git a/drivers/net/wireless/mediatek/mt76/mt7925/main.c b/drivers/net/wireless/mediatek/mt76/mt7925/main.c index 3911cf71462f..b159d26303ca 100644 --- a/drivers/net/wireless/mediatek/mt76/mt7925/main.c +++ b/drivers/net/wireless/mediatek/mt76/mt7925/main.c @@ -766,32 +766,43 @@ int mt7925_mac_sta_add(struct mt76_dev *mdev, struct ieee80211_vif *vif, } EXPORT_SYMBOL_GPL(mt7925_mac_sta_add); -void mt7925_mac_sta_assoc(struct mt76_dev *mdev, struct ieee80211_vif *vif, - struct ieee80211_sta *sta) +static void mt7925_mac_link_sta_assoc(struct mt76_dev *mdev, + struct ieee80211_vif *vif, + struct ieee80211_link_sta *link_sta) { struct mt792x_dev *dev = container_of(mdev, struct mt792x_dev, mt76); - struct mt792x_sta *msta = (struct mt792x_sta *)sta->drv_priv; struct mt792x_vif *mvif = (struct mt792x_vif *)vif->drv_priv; struct ieee80211_bss_conf *link_conf; + struct mt792x_link_sta *mlink; + struct mt792x_sta *msta; + + msta = (struct mt792x_sta *)link_sta->sta->drv_priv; + mlink = mt792x_sta_to_link(msta, link_sta->link_id); mt792x_mutex_acquire(dev); link_conf = mt792x_vif_to_bss_conf(vif, vif->bss_conf.link_id); - if (vif->type == NL80211_IFTYPE_STATION && !sta->tdls) + if (vif->type == NL80211_IFTYPE_STATION && !link_sta->sta->tdls) mt7925_mcu_add_bss_info(&dev->phy, mvif->bss_conf.mt76.ctx, - link_conf, &sta->deflink, true); + link_conf, link_sta, true); - ewma_avg_signal_init(&msta->deflink.avg_ack_signal); + ewma_avg_signal_init(&mlink->avg_ack_signal); - mt7925_mac_wtbl_update(dev, msta->deflink.wcid.idx, + mt7925_mac_wtbl_update(dev, mlink->wcid.idx, MT_WTBL_UPDATE_ADM_COUNT_CLEAR); - memset(msta->deflink.airtime_ac, 0, sizeof(msta->deflink.airtime_ac)); + memset(mlink->airtime_ac, 0, sizeof(mlink->airtime_ac)); - mt7925_mcu_sta_update(dev, &sta->deflink, vif, true, MT76_STA_INFO_STATE_ASSOC); + mt7925_mcu_sta_update(dev, link_sta, vif, true, MT76_STA_INFO_STATE_ASSOC); mt792x_mutex_release(dev); } + +void mt7925_mac_sta_assoc(struct mt76_dev *mdev, struct ieee80211_vif *vif, + struct ieee80211_sta *sta) +{ + mt7925_mac_link_sta_assoc(mdev, vif, &sta->deflink); +} EXPORT_SYMBOL_GPL(mt7925_mac_sta_assoc); void mt7925_mac_sta_remove(struct mt76_dev *mdev, struct ieee80211_vif *vif, From patchwork Thu Jun 13 03:02:38 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Sean Wang X-Patchwork-Id: 13696077 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from bombadil.infradead.org (bombadil.infradead.org [198.137.202.133]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.lore.kernel.org (Postfix) with ESMTPS id D8C86C27C6E for ; Thu, 13 Jun 2024 03:04:22 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=lists.infradead.org; s=bombadil.20210309; h=Sender:List-Subscribe:List-Help :List-Post:List-Archive:List-Unsubscribe:List-Id:Content-Transfer-Encoding: MIME-Version:References:In-Reply-To:Message-Id:Date:Subject:Cc:To:From: Reply-To:Content-Type:Content-ID:Content-Description:Resent-Date:Resent-From: Resent-Sender:Resent-To:Resent-Cc:Resent-Message-ID:List-Owner; bh=Z9GNs6B5bu7pTah9Ud2+nU3M0TzPxJfZY98bb6SSuDs=; b=Yd3Pg7JFx9pRRYYZJnSCuN5UrU A9JoCUsxa4QvPGm1VT5vpoVIvcpDsl2YHG6yVHTRz0ncRPRUzQmiYuCyirNZiDZ2Kf8Q2Rsx6PoGG LxkkIVAcFKBgufyqayYZEMfAEE76D+rv3f25t1SxgnkZBMentqNlbBQfjEOeNF3Mpw+vjMzMyG9eE xVqeHpMF9SymF89wqoBfjGhFIQvvKm2r3eFSE6nvCxXSEY3Oxw93bvpLTHAJvolcTJ2L/Pt1VJpTa fgOrSLPjQjDH1CFDnvkjRul6mzP3mhEBJrAwRpHshOBQgrvtE9oFUQrOlCogamhsr5ltjbccnaCl0 bnjNWGIQ==; Received: from localhost ([::1] helo=bombadil.infradead.org) by bombadil.infradead.org with esmtp (Exim 4.97.1 #2 (Red Hat Linux)) id 1sHalC-0000000EwPr-25YG; Thu, 13 Jun 2024 03:04:22 +0000 Received: from mail-oo1-f53.google.com ([209.85.161.53]) by bombadil.infradead.org with esmtps (Exim 4.97.1 #2 (Red Hat Linux)) id 1sHal7-0000000EwKu-0vPs for linux-mediatek@lists.infradead.org; Thu, 13 Jun 2024 03:04:19 +0000 Received: by mail-oo1-f53.google.com with SMTP id 006d021491bc7-5bad97708efso31455eaf.1 for ; Wed, 12 Jun 2024 20:04:17 -0700 (PDT) X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1718247856; x=1718852656; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:x-gm-message-state:from:to:cc :subject:date:message-id:reply-to; bh=Z9GNs6B5bu7pTah9Ud2+nU3M0TzPxJfZY98bb6SSuDs=; b=JgGXdJOB4RpSKgS8tXMKZI0ZG+JuAYXWvDFBYXf9eqt3lqN0r/K7ys9LQuvnOYDcqi VH71EOTZxfEMapuyleAw4KI4R+TqIv3arn/SlYYTqvIiJ3YkCU+y8iBS7LhVv8V3uhX3 lNXu9Pj7h1PIcWi+tm/m2tPPCXhWIg0M/LnYAg6dFRF9REm/Cf61FwpElgipqGT4irCN OJYjWh4x8oM8kBvnSJScXPLI26v9mU8+4bryUrljCKrCA8SEeSOpehFyOUiiGm4wcVxE SnsGVj5SQF+oQqtY5UEYnEG0/vP/FAtSWxLkn9gtgGpKbbvc6kj8NOwpkJ99t50GHjUV hJDA== X-Forwarded-Encrypted: i=1; AJvYcCWpEBPrsMLC6fvzukL4kYQBO4mWj2rT+6c2j9mwE6ABD0YhqtpWgEPmDe//BgcbS67buBpBvzuI1lKn+GEO/12FQa7HaHkQqxxvanUo/Oz5eNoZ X-Gm-Message-State: AOJu0YyV13fWG13gJpHnhwddj0LRwUQJqoyFFIuldPDoJN+/aNL4Naup 7mIVFtnMNhkViVg8iSYUL7Z36KLyl+gin0U/q90job23HhLDky8F X-Google-Smtp-Source: AGHT+IFREIYX1Sd34i8E7irY+54INGBR1bLti4tXtswuJFCTubZVEPCyBjycPUyUsBH+7NegEAREQw== X-Received: by 2002:a4a:3101:0:b0:5ba:ca8a:6598 with SMTP id 006d021491bc7-5bb3b7b972bmr3908721eaf.0.1718247856207; Wed, 12 Jun 2024 20:04:16 -0700 (PDT) Received: from sean-ThinkPad-T450s.lan ([207.191.35.252]) by smtp.gmail.com with ESMTPSA id 006d021491bc7-5bd629263c5sm67685eaf.46.2024.06.12.20.04.14 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Wed, 12 Jun 2024 20:04:15 -0700 (PDT) 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 44/47] wifi: mt76: mt7925: add mt7925_mac_link_sta_remove to remove per-link STA Date: Wed, 12 Jun 2024 20:02:38 -0700 Message-Id: <20240613030241.5771-45-sean.wang@kernel.org> X-Mailer: git-send-email 2.25.1 In-Reply-To: <20240613030241.5771-1-sean.wang@kernel.org> References: <20240613030241.5771-1-sean.wang@kernel.org> MIME-Version: 1.0 X-CRM114-Version: 20100106-BlameMichelson ( TRE 0.8.0 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20240612_200417_361248_BC362C68 X-CRM114-Status: GOOD ( 12.18 ) X-BeenThere: linux-mediatek@lists.infradead.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Sender: "Linux-mediatek" Errors-To: linux-mediatek-bounces+linux-mediatek=archiver.kernel.org@lists.infradead.org From: Sean Wang The mt7925_mac_link_sta_remove function currently removes the per-link STA. We will extend this function when we implement the MLO functionality. This patch only includes structural changes and does not involve any logic changes. Signed-off-by: Sean Wang --- .../net/wireless/mediatek/mt76/mt7925/main.c | 46 +++++++++++++------ 1 file changed, 31 insertions(+), 15 deletions(-) diff --git a/drivers/net/wireless/mediatek/mt76/mt7925/main.c b/drivers/net/wireless/mediatek/mt76/mt7925/main.c index b159d26303ca..ce5379c4d55d 100644 --- a/drivers/net/wireless/mediatek/mt76/mt7925/main.c +++ b/drivers/net/wireless/mediatek/mt76/mt7925/main.c @@ -805,39 +805,55 @@ void mt7925_mac_sta_assoc(struct mt76_dev *mdev, struct ieee80211_vif *vif, } EXPORT_SYMBOL_GPL(mt7925_mac_sta_assoc); -void mt7925_mac_sta_remove(struct mt76_dev *mdev, struct ieee80211_vif *vif, - struct ieee80211_sta *sta) +static void mt7925_mac_link_sta_remove(struct mt76_dev *mdev, + struct ieee80211_vif *vif, + struct ieee80211_link_sta *link_sta) { struct mt792x_dev *dev = container_of(mdev, struct mt792x_dev, mt76); - struct mt792x_sta *msta = (struct mt792x_sta *)sta->drv_priv; struct ieee80211_bss_conf *link_conf; + struct mt792x_link_sta *mlink; + struct mt792x_sta *msta; - mt76_connac_free_pending_tx_skbs(&dev->pm, &msta->deflink.wcid); + msta = (struct mt792x_sta *)link_sta->sta->drv_priv; + mlink = mt792x_sta_to_link(msta, link_sta->link_id); + + mt76_connac_free_pending_tx_skbs(&dev->pm, &mlink->wcid); mt76_connac_pm_wake(&dev->mphy, &dev->pm); - mt7925_mcu_sta_update(dev, &sta->deflink, vif, false, MT76_STA_INFO_STATE_NONE); - mt7925_mac_wtbl_update(dev, msta->deflink.wcid.idx, + mt7925_mcu_sta_update(dev, link_sta, vif, false, + MT76_STA_INFO_STATE_NONE); + mt7925_mac_wtbl_update(dev, mlink->wcid.idx, MT_WTBL_UPDATE_ADM_COUNT_CLEAR); link_conf = mt792x_vif_to_bss_conf(vif, vif->bss_conf.link_id); - if (vif->type == NL80211_IFTYPE_STATION) { + if (vif->type == NL80211_IFTYPE_STATION && !link_sta->sta->tdls) { struct mt792x_vif *mvif = (struct mt792x_vif *)vif->drv_priv; - - mvif->wep_sta = NULL; - ewma_rssi_init(&mvif->bss_conf.rssi); - if (!sta->tdls) - mt7925_mcu_add_bss_info(&dev->phy, mvif->bss_conf.mt76.ctx, - link_conf, &sta->deflink, false); + mt7925_mcu_add_bss_info(&dev->phy, + mvif->bss_conf.mt76.ctx, link_conf, + link_sta, false); } spin_lock_bh(&mdev->sta_poll_lock); - if (!list_empty(&msta->deflink.wcid.poll_list)) - list_del_init(&msta->deflink.wcid.poll_list); + if (!list_empty(&mlink->wcid.poll_list)) + list_del_init(&mlink->wcid.poll_list); spin_unlock_bh(&mdev->sta_poll_lock); mt76_connac_power_save_sched(&dev->mphy, &dev->pm); } + +void mt7925_mac_sta_remove(struct mt76_dev *mdev, struct ieee80211_vif *vif, + struct ieee80211_sta *sta) +{ + mt7925_mac_link_sta_remove(mdev, vif, &sta->deflink); + + if (vif->type == NL80211_IFTYPE_STATION) { + struct mt792x_vif *mvif = (struct mt792x_vif *)vif->drv_priv; + + mvif->wep_sta = NULL; + ewma_rssi_init(&mvif->bss_conf.rssi); + } +} EXPORT_SYMBOL_GPL(mt7925_mac_sta_remove); static int mt7925_set_rts_threshold(struct ieee80211_hw *hw, u32 val) From patchwork Thu Jun 13 03:02:39 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Sean Wang X-Patchwork-Id: 13696079 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from bombadil.infradead.org (bombadil.infradead.org [198.137.202.133]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.lore.kernel.org (Postfix) with ESMTPS id 70527C27C77 for ; Thu, 13 Jun 2024 03:04:27 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=lists.infradead.org; s=bombadil.20210309; h=Sender:List-Subscribe:List-Help :List-Post:List-Archive:List-Unsubscribe:List-Id:Content-Transfer-Encoding: MIME-Version:References:In-Reply-To:Message-Id:Date:Subject:Cc:To:From: Reply-To:Content-Type:Content-ID:Content-Description:Resent-Date:Resent-From: Resent-Sender:Resent-To:Resent-Cc:Resent-Message-ID:List-Owner; bh=swP0wzm8P3kzjuujDDrTBhNy4O6CiQrkwdq/UWr+JT4=; b=pJdixx3Z4vaEt+4IB9upYdz3l9 OVYLC2vBtMIsSyY6Lxlf4kzjVtpEGRAMSMLHSbSmszOYzeJ/V++OvWVLyGwvgSpMOQT+aQM8Ax2f2 nij+tSi/9mZ1xs2+kCIlR0jXEaDmjuJbRYjwRIfHbD30fNjhnD4Xev0Sq/hlsXBE9kx0zTRKx32/Z KIH6ZrwDSKE+omy3DyFT774iAVGApvJySOuxMG6UiGA3T8F7r1/5qQiZwcIO3fu/ZRQ/0ThZBUAkn vDoO+UfB32kHxfCm5q0zyGqt8VvArjuZeHTsYa3s0M6HWrZvw1FAES98B6xs9M02xrOvXWh1wdcPb JK/fHEgw==; Received: from localhost ([::1] helo=bombadil.infradead.org) by bombadil.infradead.org with esmtp (Exim 4.97.1 #2 (Red Hat Linux)) id 1sHalH-0000000EwTN-0OhL; Thu, 13 Jun 2024 03:04:27 +0000 Received: from mail-oo1-f52.google.com ([209.85.161.52]) by bombadil.infradead.org with esmtps (Exim 4.97.1 #2 (Red Hat Linux)) id 1sHal8-0000000EwMV-2zqI for linux-mediatek@lists.infradead.org; Thu, 13 Jun 2024 03:04:23 +0000 Received: by mail-oo1-f52.google.com with SMTP id 006d021491bc7-5bb10cfe7daso36905eaf.2 for ; Wed, 12 Jun 2024 20:04:18 -0700 (PDT) X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1718247858; x=1718852658; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:x-gm-message-state:from:to:cc :subject:date:message-id:reply-to; bh=swP0wzm8P3kzjuujDDrTBhNy4O6CiQrkwdq/UWr+JT4=; b=BUfeUKu+rJ8PeVZVAuJTag7qR3CsfEXTBiOsGlpHLqcag6U71/SyXhCc9RQB2fbXCF 7y5fSmVqurbQop5WyPGJinWRyoEQSsC5Ggf2o4pevjUSK45JDS4NYSlH5Sx1PPfLDfGa Tu2mPedQz7hWdago3MdeK1fxOxSuufgE7ir7Q/MUsYA6neYnuOy7z7ghbArVfP9HJbvr jp4Iy39W4BocYf2J+paQ3Ox4Y5P7eXFqHMcTLjMlgv5X93X88TwGOWAo4QvqWBEiGMVt kWLHLaYKPrVT2Arq/5Agsp3+STyBH+Zz9yM4ABYsMzYsAZ5jW0HfWV4QfD61OFJBAIlP rv6A== X-Forwarded-Encrypted: i=1; AJvYcCVBK1RDbnbHYriXMxNDA1OyyT1+C7ZCqOWyadBfqw1CmfjdyA3wUTPWNy8Y7c1cWTW6gwtgXMceMvGPKkhRbQ==@lists.infradead.org X-Gm-Message-State: AOJu0YwBsB6PRSOXf4Wx0owIv3J77Mc/QSLR2izlFLN6Uc+G/7o1GJ7p 14sErMBbDPCdE0eKpYZnzoVV+99PmczDhiuwz//zuetXVzElyL0u X-Google-Smtp-Source: AGHT+IH3wUed9ixLi58tAQqUtbD8UtozGL9FegbZuRRfCfvGNhzx87amQWMcRaq7ZAbMt3fmnTPW1Q== X-Received: by 2002:a4a:8552:0:b0:5ba:ca86:a025 with SMTP id 006d021491bc7-5bb3b7a9135mr3998081eaf.0.1718247857771; Wed, 12 Jun 2024 20:04:17 -0700 (PDT) Received: from sean-ThinkPad-T450s.lan ([207.191.35.252]) by smtp.gmail.com with ESMTPSA id 006d021491bc7-5bd629263c5sm67685eaf.46.2024.06.12.20.04.16 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Wed, 12 Jun 2024 20:04:16 -0700 (PDT) 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 45/47] wifi: mt76: mt7925: add mt7925_mac_link_bss_add to create per-link BSS Date: Wed, 12 Jun 2024 20:02:39 -0700 Message-Id: <20240613030241.5771-46-sean.wang@kernel.org> X-Mailer: git-send-email 2.25.1 In-Reply-To: <20240613030241.5771-1-sean.wang@kernel.org> References: <20240613030241.5771-1-sean.wang@kernel.org> MIME-Version: 1.0 X-CRM114-Version: 20100106-BlameMichelson ( TRE 0.8.0 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20240612_200418_853416_99048105 X-CRM114-Status: GOOD ( 13.62 ) X-BeenThere: linux-mediatek@lists.infradead.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Sender: "Linux-mediatek" Errors-To: linux-mediatek-bounces+linux-mediatek=archiver.kernel.org@lists.infradead.org From: Sean Wang The mt7925_mac_link_bss_add function currently creates the per-link BSS. We will extend this function when we implement the MLO functionality. This patch only includes structural changes and does not involve any logic changes. Signed-off-by: Sean Wang --- .../net/wireless/mediatek/mt76/mt7925/main.c | 80 ++++++++++++------- 1 file changed, 49 insertions(+), 31 deletions(-) diff --git a/drivers/net/wireless/mediatek/mt76/mt7925/main.c b/drivers/net/wireless/mediatek/mt76/mt7925/main.c index ce5379c4d55d..611138acd16d 100644 --- a/drivers/net/wireless/mediatek/mt76/mt7925/main.c +++ b/drivers/net/wireless/mediatek/mt76/mt7925/main.c @@ -317,63 +317,81 @@ static int mt7925_start(struct ieee80211_hw *hw) return err; } -static int -mt7925_add_interface(struct ieee80211_hw *hw, struct ieee80211_vif *vif) +static int mt7925_mac_link_bss_add(struct mt792x_dev *dev, + struct ieee80211_bss_conf *link_conf, + struct mt792x_link_sta *mlink) { - struct mt792x_vif *mvif = (struct mt792x_vif *)vif->drv_priv; - struct mt792x_dev *dev = mt792x_hw_dev(hw); - struct mt792x_phy *phy = mt792x_hw_phy(hw); + struct mt792x_bss_conf *mconf = mt792x_link_conf_to_mconf(link_conf); + struct ieee80211_vif *vif = link_conf->vif; + struct mt792x_vif *mvif = mconf->vif; struct mt76_txq *mtxq; int idx, ret = 0; - mt792x_mutex_acquire(dev); - - mvif->bss_conf.mt76.idx = __ffs64(~dev->mt76.vif_mask); - if (mvif->bss_conf.mt76.idx >= MT792x_MAX_INTERFACES) { + mconf->mt76.idx = __ffs64(~dev->mt76.vif_mask); + if (mconf->mt76.idx >= MT792x_MAX_INTERFACES) { ret = -ENOSPC; goto out; } - mvif->bss_conf.mt76.omac_idx = mvif->bss_conf.mt76.idx; - mvif->phy = phy; - mvif->bss_conf.mt76.band_idx = 0; - mvif->bss_conf.mt76.wmm_idx = mvif->bss_conf.mt76.idx % MT76_CONNAC_MAX_WMM_SETS; - mvif->bss_conf.vif = mvif; + mconf->mt76.omac_idx = mconf->mt76.idx; + mconf->mt76.band_idx = 0; + mconf->mt76.wmm_idx = mconf->mt76.idx % MT76_CONNAC_MAX_WMM_SETS; - if (phy->mt76->chandef.chan->band != NL80211_BAND_2GHZ) - mvif->bss_conf.mt76.basic_rates_idx = MT792x_BASIC_RATES_TBL + 4; + if (mvif->phy->mt76->chandef.chan->band != NL80211_BAND_2GHZ) + mconf->mt76.basic_rates_idx = MT792x_BASIC_RATES_TBL + 4; else - mvif->bss_conf.mt76.basic_rates_idx = MT792x_BASIC_RATES_TBL; + mconf->mt76.basic_rates_idx = MT792x_BASIC_RATES_TBL; - ret = mt76_connac_mcu_uni_add_dev(&dev->mphy, &vif->bss_conf, - &mvif->sta.deflink.wcid, true); + ret = mt76_connac_mcu_uni_add_dev(&dev->mphy, link_conf, + &mlink->wcid, true); if (ret) goto out; - dev->mt76.vif_mask |= BIT_ULL(mvif->bss_conf.mt76.idx); - phy->omac_mask |= BIT_ULL(mvif->bss_conf.mt76.omac_idx); + dev->mt76.vif_mask |= BIT_ULL(mconf->mt76.idx); + mvif->phy->omac_mask |= BIT_ULL(mconf->mt76.omac_idx); - idx = MT792x_WTBL_RESERVED - mvif->bss_conf.mt76.idx; + idx = MT792x_WTBL_RESERVED - mconf->mt76.idx; - INIT_LIST_HEAD(&mvif->sta.deflink.wcid.poll_list); - mvif->sta.deflink.wcid.idx = idx; - mvif->sta.deflink.wcid.phy_idx = mvif->bss_conf.mt76.band_idx; - mvif->sta.deflink.wcid.hw_key_idx = -1; - mvif->sta.deflink.wcid.tx_info |= MT_WCID_TX_INFO_SET; - mvif->sta.vif = mvif; - mt76_wcid_init(&mvif->sta.deflink.wcid); + INIT_LIST_HEAD(&mlink->wcid.poll_list); + mlink->wcid.idx = idx; + mlink->wcid.phy_idx = mconf->mt76.band_idx; + mlink->wcid.hw_key_idx = -1; + mlink->wcid.tx_info |= MT_WCID_TX_INFO_SET; + mt76_wcid_init(&mlink->wcid); mt7925_mac_wtbl_update(dev, idx, MT_WTBL_UPDATE_ADM_COUNT_CLEAR); - ewma_rssi_init(&mvif->bss_conf.rssi); + ewma_rssi_init(&mconf->rssi); - rcu_assign_pointer(dev->mt76.wcid[idx], &mvif->sta.deflink.wcid); + rcu_assign_pointer(dev->mt76.wcid[idx], &mlink->wcid); if (vif->txq) { mtxq = (struct mt76_txq *)vif->txq->drv_priv; mtxq->wcid = idx; } +out: + return ret; +} + +static int +mt7925_add_interface(struct ieee80211_hw *hw, struct ieee80211_vif *vif) +{ + struct mt792x_vif *mvif = (struct mt792x_vif *)vif->drv_priv; + struct mt792x_dev *dev = mt792x_hw_dev(hw); + struct mt792x_phy *phy = mt792x_hw_phy(hw); + int ret = 0; + + mt792x_mutex_acquire(dev); + + mvif->phy = phy; + mvif->bss_conf.vif = mvif; + mvif->sta.vif = mvif; + + ret = mt7925_mac_link_bss_add(dev, &vif->bss_conf, &mvif->sta.deflink); + if (ret < 0) + goto out; + vif->driver_flags |= IEEE80211_VIF_BEACON_FILTER; out: mt792x_mutex_release(dev); From patchwork Thu Jun 13 03:02:40 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Sean Wang X-Patchwork-Id: 13696078 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from bombadil.infradead.org (bombadil.infradead.org [198.137.202.133]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.lore.kernel.org (Postfix) with ESMTPS id 0431AC27C53 for ; Thu, 13 Jun 2024 03:04:27 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=lists.infradead.org; s=bombadil.20210309; h=Sender:List-Subscribe:List-Help :List-Post:List-Archive:List-Unsubscribe:List-Id:Content-Transfer-Encoding: MIME-Version:References:In-Reply-To:Message-Id:Date:Subject:Cc:To:From: Reply-To:Content-Type:Content-ID:Content-Description:Resent-Date:Resent-From: Resent-Sender:Resent-To:Resent-Cc:Resent-Message-ID:List-Owner; bh=/qyCpY+byuISWjWQLZo5DP4pBOanX+F+FMRDfBJvu2s=; b=FY1TqrUlJ1Nu03WQE6RYtucPOA Cl8t8+UIiTS3s20ZItrlzEHyAf4cS5721Y+CHQ52iBCRrd+cWzVZu1vHaJh/q3IyYmxbE7om4RZbe KtouVyr0pWvB3M9pfa5gZs/w7AcCdQG4SbZa46BgLW8QP21PiDlBCaqdx6AD2bMzHWobgj1jSDUDx ewnOqUou6bB4Uz+JWZdIyGDl+eVIX/IPAR5SHh08gwvM4Q9wXpY1lbu6f1vgRTavLutamiDmN8Kzm OsOGuxBQv5EycTjVbewIuqFrdQAsMjueoJ2oFcWOsoZ9mLyEqyz1Q1T5XgjFIc2zKFUocD6RijZve fphn53rQ==; Received: from localhost ([::1] helo=bombadil.infradead.org) by bombadil.infradead.org with esmtp (Exim 4.97.1 #2 (Red Hat Linux)) id 1sHalF-0000000EwSO-1qHP; Thu, 13 Jun 2024 03:04:25 +0000 Received: from mail-oo1-f49.google.com ([209.85.161.49]) by bombadil.infradead.org with esmtps (Exim 4.97.1 #2 (Red Hat Linux)) id 1sHalA-0000000EwNz-3jYl for linux-mediatek@lists.infradead.org; Thu, 13 Jun 2024 03:04:23 +0000 Received: by mail-oo1-f49.google.com with SMTP id 006d021491bc7-5b3356fd4f3so38487eaf.1 for ; Wed, 12 Jun 2024 20:04:20 -0700 (PDT) X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1718247860; x=1718852660; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:x-gm-message-state:from:to:cc :subject:date:message-id:reply-to; bh=/qyCpY+byuISWjWQLZo5DP4pBOanX+F+FMRDfBJvu2s=; b=O7Utp0GSDlbgwSLkeOCEuoiWEF3NDSoL0jML+IiO0XW+gOYuewCU8WtsR6440hqgnL n0ZA/yut8G7Wu/5W4dJLxcWQ/R+RT41Z1nGsifx8bEzGL1Pal/NqVTUBpqraW20Jydfw Tq4wGqEmtqmgnn21U547/jMTc+Tjct9qDDSkPNVjxJhLpWv9/ifMMJpgdlpUPid5fjw0 25NL6rTjuFk+GMllSHMAA+y+EabWDFPTAHmkAk+S+ZDlUSi76dGhtrap/Pm1LCa90/Xp OjV7h+IHRDWgJbBktWgeQFGMtw9Wwll+7QyWDvmHUEDhO9K6uplJ/tgR2ssnFRvcdzMt a9gg== X-Forwarded-Encrypted: i=1; AJvYcCXOsaNeHpKs5zTZspz2jmhAzgA2QEmXriACh/FKyp7ONpKfYslkIjYK6pnBHCdD45KZMR7kpt6E8pNUxnaOIw==@lists.infradead.org X-Gm-Message-State: AOJu0YzzwSPYaRMJJ+oolpQupowRRPF9LPASX/4OKW9T1f76UjwJxrZ/ stqPVLR2+kJq2ngkreWD6bgRjcpp5GZydaRhiONkd+LuPHu3ws6j X-Google-Smtp-Source: AGHT+IESQ2jcgtgOmUDbQXdFBlFmVcT8fDwRZIVNyrs0Ci4sQ97lOJGCN79nGkpTnuurIm5NCcT95g== X-Received: by 2002:a4a:d196:0:b0:5bd:87a0:66d with SMTP id 006d021491bc7-5bd87a01b93mr287315eaf.1.1718247859993; Wed, 12 Jun 2024 20:04:19 -0700 (PDT) Received: from sean-ThinkPad-T450s.lan ([207.191.35.252]) by smtp.gmail.com with ESMTPSA id 006d021491bc7-5bd629263c5sm67685eaf.46.2024.06.12.20.04.17 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Wed, 12 Jun 2024 20:04:18 -0700 (PDT) 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 46/47] wifi: mt76: mt7925: add mt7925_mac_link_bss_remove to remove per-link BSS Date: Wed, 12 Jun 2024 20:02:40 -0700 Message-Id: <20240613030241.5771-47-sean.wang@kernel.org> X-Mailer: git-send-email 2.25.1 In-Reply-To: <20240613030241.5771-1-sean.wang@kernel.org> References: <20240613030241.5771-1-sean.wang@kernel.org> MIME-Version: 1.0 X-CRM114-Version: 20100106-BlameMichelson ( TRE 0.8.0 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20240612_200420_972083_7F8E0951 X-CRM114-Status: GOOD ( 11.22 ) X-BeenThere: linux-mediatek@lists.infradead.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Sender: "Linux-mediatek" Errors-To: linux-mediatek-bounces+linux-mediatek=archiver.kernel.org@lists.infradead.org From: Sean Wang The mt7925_mac_link_bss_remove function currently removes the per-link BSS. We will extend this function when we implement the MLO functionality. This patch only includes structural changes and does not involve any logic changes. Signed-off-by: Sean Wang --- .../net/wireless/mediatek/mt76/mt792x_core.c | 35 +++++++++++-------- 1 file changed, 21 insertions(+), 14 deletions(-) diff --git a/drivers/net/wireless/mediatek/mt76/mt792x_core.c b/drivers/net/wireless/mediatek/mt76/mt792x_core.c index 222204916b73..bec2c1eb5240 100644 --- a/drivers/net/wireless/mediatek/mt76/mt792x_core.c +++ b/drivers/net/wireless/mediatek/mt76/mt792x_core.c @@ -113,31 +113,38 @@ void mt792x_stop(struct ieee80211_hw *hw) } EXPORT_SYMBOL_GPL(mt792x_stop); -void mt792x_remove_interface(struct ieee80211_hw *hw, - struct ieee80211_vif *vif) +static void mt792x_mac_link_bss_remove(struct mt792x_dev *dev, + struct ieee80211_bss_conf *link_conf, + struct mt792x_link_sta *mlink) { - struct mt792x_vif *mvif = (struct mt792x_vif *)vif->drv_priv; - struct mt792x_sta *msta = &mvif->sta; - struct mt792x_dev *dev = mt792x_hw_dev(hw); - struct mt792x_phy *phy = mt792x_hw_phy(hw); - int idx = msta->deflink.wcid.idx; + struct mt792x_bss_conf *mconf = mt792x_link_conf_to_mconf(link_conf); + int idx = mlink->wcid.idx; mt792x_mutex_acquire(dev); - mt76_connac_free_pending_tx_skbs(&dev->pm, &msta->deflink.wcid); - mt76_connac_mcu_uni_add_dev(&dev->mphy, &vif->bss_conf, &mvif->sta.deflink.wcid, false); + mt76_connac_free_pending_tx_skbs(&dev->pm, &mlink->wcid); + mt76_connac_mcu_uni_add_dev(&dev->mphy, link_conf, &mlink->wcid, false); rcu_assign_pointer(dev->mt76.wcid[idx], NULL); - dev->mt76.vif_mask &= ~BIT_ULL(mvif->bss_conf.mt76.idx); - phy->omac_mask &= ~BIT_ULL(mvif->bss_conf.mt76.omac_idx); + dev->mt76.vif_mask &= ~BIT_ULL(mconf->mt76.idx); + mconf->vif->phy->omac_mask &= ~BIT_ULL(mconf->mt76.omac_idx); mt792x_mutex_release(dev); spin_lock_bh(&dev->mt76.sta_poll_lock); - if (!list_empty(&msta->deflink.wcid.poll_list)) - list_del_init(&msta->deflink.wcid.poll_list); + if (!list_empty(&mlink->wcid.poll_list)) + list_del_init(&mlink->wcid.poll_list); spin_unlock_bh(&dev->mt76.sta_poll_lock); - mt76_wcid_cleanup(&dev->mt76, &msta->deflink.wcid); + mt76_wcid_cleanup(&dev->mt76, &mlink->wcid); +} + +void mt792x_remove_interface(struct ieee80211_hw *hw, + struct ieee80211_vif *vif) +{ + struct mt792x_vif *mvif = (struct mt792x_vif *)vif->drv_priv; + struct mt792x_dev *dev = mt792x_hw_dev(hw); + + mt792x_mac_link_bss_remove(dev, &vif->bss_conf, &mvif->sta.deflink); } EXPORT_SYMBOL_GPL(mt792x_remove_interface); From patchwork Thu Jun 13 03:02:41 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Sean Wang X-Patchwork-Id: 13696080 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from bombadil.infradead.org (bombadil.infradead.org [198.137.202.133]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.lore.kernel.org (Postfix) with ESMTPS id D69BDC27C53 for ; Thu, 13 Jun 2024 03:04:29 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=lists.infradead.org; s=bombadil.20210309; h=Sender:List-Subscribe:List-Help :List-Post:List-Archive:List-Unsubscribe:List-Id:Content-Transfer-Encoding: MIME-Version:References:In-Reply-To:Message-Id:Date:Subject:Cc:To:From: Reply-To:Content-Type:Content-ID:Content-Description:Resent-Date:Resent-From: Resent-Sender:Resent-To:Resent-Cc:Resent-Message-ID:List-Owner; bh=8jO8Gc5RDctWw/ZhCBLlPB6OeGfOoPDaHWniwL5VRGE=; b=eG5EuJYDgSdaePSVksKr4qz4Kd worxt7ypD7R70MVaCpxqE95ij9DEkoJWLRcLwhkzrUGLIO4oJ+nz/u3Wgj0oM+wFF/BUwU6J9wik7 vPXtldN3pBq6XnfcMfdsDB0psGYLGC357jS6s2SIqmHeKiyNL2jpUqqqk5NG35gquSiwxwy98fgI+ srP02CKAbQHjvYzkiB9j0EvZBeRUqaaCb6scgSEHFTylSnwAx3o8F8Kaps9lOCEK17iTNb+kvEH0M 7aTZBtats77BpIRHCn/BAl3YewoJX5tTmJnSmvJ/Yuz8UTcL+8UOLcVak1et31ta9Sd5yw3xQ/VJG ANsInn/w==; Received: from localhost ([::1] helo=bombadil.infradead.org) by bombadil.infradead.org with esmtp (Exim 4.97.1 #2 (Red Hat Linux)) id 1sHalJ-0000000EwUK-2OnB; Thu, 13 Jun 2024 03:04:29 +0000 Received: from mail-oa1-f49.google.com ([209.85.160.49]) by bombadil.infradead.org with esmtps (Exim 4.97.1 #2 (Red Hat Linux)) id 1sHalC-0000000EwPs-3Wha for linux-mediatek@lists.infradead.org; Thu, 13 Jun 2024 03:04:24 +0000 Received: by mail-oa1-f49.google.com with SMTP id 586e51a60fabf-254976d3327so77814fac.1 for ; Wed, 12 Jun 2024 20:04:22 -0700 (PDT) X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1718247862; x=1718852662; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:x-gm-message-state:from:to:cc :subject:date:message-id:reply-to; bh=8jO8Gc5RDctWw/ZhCBLlPB6OeGfOoPDaHWniwL5VRGE=; b=vibuy2qLX//Z0YCoijldtKEsLUkH+RbNp4nuFmVsEr4dSjW7EdAq3t2ywP/sDgwC6q Th3ri6w34yhXv3zQMMQPl4nJi6CE4s0doghYTFGZ+mhCnhg4hnsOYodF7G3KJv6/84/X d9QRS3wuGCPX1J1yN3N6QqOz1ud+ug1kJxv2AcVgCEIKLOi80fyufMK0wUVuJW74WQIc C+Q8sMsNryP2R0aghGoSrPkZuEMJBn8K3UQut+DfIp4JYAnoPkeJy+H+lwy3lButWKFJ /9Nb56hKnQ6+RA41KpQnwtzWXLrsnvUhQ8XxudPks5O7sBU91D7oQCjM2sxWCMv+hXJl 7CVw== X-Forwarded-Encrypted: i=1; AJvYcCVIEqDG0TOdeiiq2xIK1yvFSKRZbWQCbXwJbYcE7zK2xUS16Fh1Tw545YrPLN1jmZGTFlwzis76yCuxjQijzA==@lists.infradead.org X-Gm-Message-State: AOJu0YzQHX2FeCeXVKixUaV0ADu5w7pS5ZZqrk9RlbeCtn6gPmtos7Ix MI0dl8Lkox21w+ZGQ+028AQIxkBhgjZtP9OEfV6Ac7kzPi96UFty X-Google-Smtp-Source: AGHT+IFGHgXP29zx8KF95nPLg6SntZXj7M9MxPR4qFdAyLnNZf/Wwbn8J1+lymEzEjIjt3HPXJT4lA== X-Received: by 2002:a4a:8552:0:b0:5ba:ca86:a025 with SMTP id 006d021491bc7-5bb3b7a9135mr3998243eaf.0.1718247862043; Wed, 12 Jun 2024 20:04:22 -0700 (PDT) Received: from sean-ThinkPad-T450s.lan ([207.191.35.252]) by smtp.gmail.com with ESMTPSA id 006d021491bc7-5bd629263c5sm67685eaf.46.2024.06.12.20.04.20 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Wed, 12 Jun 2024 20:04:20 -0700 (PDT) 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 47/47] wifi: mt76: mt7925: simpify mt7925_mcu_sta_cmd logic by removing fw_offload Date: Wed, 12 Jun 2024 20:02:41 -0700 Message-Id: <20240613030241.5771-48-sean.wang@kernel.org> X-Mailer: git-send-email 2.25.1 In-Reply-To: <20240613030241.5771-1-sean.wang@kernel.org> References: <20240613030241.5771-1-sean.wang@kernel.org> MIME-Version: 1.0 X-CRM114-Version: 20100106-BlameMichelson ( TRE 0.8.0 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20240612_200422_914937_B3E4F9F4 X-CRM114-Status: GOOD ( 10.94 ) X-BeenThere: linux-mediatek@lists.infradead.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Sender: "Linux-mediatek" Errors-To: linux-mediatek-bounces+linux-mediatek=archiver.kernel.org@lists.infradead.org From: Sean Wang The mt7925 only supports offload firmware making the fw_offload check redundant. This update simplifies the logic in "mt7925_mcu_sta_cmd" by removing the unnecessary check for fw_offoad. Signed-off-by: Sean Wang --- drivers/net/wireless/mediatek/mt76/mt7925/mcu.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/drivers/net/wireless/mediatek/mt76/mt7925/mcu.c b/drivers/net/wireless/mediatek/mt76/mt7925/mcu.c index 7156ba092302..c0b27d28a6d1 100644 --- a/drivers/net/wireless/mediatek/mt76/mt7925/mcu.c +++ b/drivers/net/wireless/mediatek/mt76/mt7925/mcu.c @@ -1643,7 +1643,7 @@ mt7925_mcu_sta_cmd(struct mt76_phy *phy, if (IS_ERR(skb)) return PTR_ERR(skb); - if (info->link_sta || !info->offload_fw) + if (info->link_sta) mt76_connac_mcu_sta_basic_tlv(dev, skb, info->vif, info->link_sta, info->enable, info->newly);