From patchwork Sat Jul 6 08:27: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: 13725756 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 BF4B6C41513 for ; Sat, 6 Jul 2024 08:28:28 +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=VBS3wbdRxNhopEBbNwl9R2AdLE3ypdIAsNxw00p9SqU=; b=ZVu3c49lzvwCncY2xa1kr+yRRa UPDhZBp7RTkVEYefVZ595wVKeAye+/H5j6HyfaFGH0p1M1YfuK4StSTZSPx6xtrzO8/PyLJVJfxgw 2CmyRZOxN31h+PgDNpAz5nsWui7eFgC38CMj75B7rtAmpI4ghqnSgteFH/gKzzNsEAYJZoGlLgbZ/ /kMF2WehwM7mJ1L0thxVHGnG89y0C1t/jSjFSlywlwzTo7d531u6RkDU9IeNE/1KvkLYlVnrYet5g 8hYlUT47X2GQ0XvwJhfw2IDJ/fSZevjOUyvQvVq9wI9LQGyWW6vx1BwZGedHgPS30/aCGqTA/+LuK rjg+Nl0Q==; Received: from localhost ([::1] helo=bombadil.infradead.org) by bombadil.infradead.org with esmtp (Exim 4.97.1 #2 (Red Hat Linux)) id 1sQ0mQ-0000000HXeu-0Bsi; Sat, 06 Jul 2024 08:28:26 +0000 Received: from mail-oa1-f53.google.com ([209.85.160.53]) by bombadil.infradead.org with esmtps (Exim 4.97.1 #2 (Red Hat Linux)) id 1sQ0mN-0000000HXe0-0g2m for linux-mediatek@lists.infradead.org; Sat, 06 Jul 2024 08:28:24 +0000 Received: by mail-oa1-f53.google.com with SMTP id 586e51a60fabf-25e19660ffeso38923fac.2 for ; Sat, 06 Jul 2024 01:28:22 -0700 (PDT) X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1720254502; x=1720859302; 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=VBS3wbdRxNhopEBbNwl9R2AdLE3ypdIAsNxw00p9SqU=; b=MLTMrg1TjJZ14okvYbEt95+/BYLXkAf27bRqtdNcZm71YEpK4MX02dmuZMFAm2CPvh xzfmJlDJKJi+ZKg5zwiOKx1hnTljxeMsgSX+WX9OFF3bmAXJlkokocV+Jkfg5F3IQn37 +Li0eNiWj/1Qa9gLe1DUofTKIpJw5RX/6yFqkh1TutYaXCdjRiCKrahIBedvY8VdPj/b nDpH9umhZpGxlVArur0JJBiwezVIcDAtlDxNKkkrXXLhftBk879DnQs1P9LkFJfMR7iv IYm70cseurjA+uY5FTUJ6rP872H2H+SxwHDq+eBQCtH1LZnKMbbTdEKyyuCLMmISLIGF 4oSg== X-Forwarded-Encrypted: i=1; AJvYcCUMVA6E0BPaeyWUaO7PHlOSdJERJ0/uxY3/hkKlH5CsXKMqQGFWInp338QaregL1/JYBXNbvnv7RfTN5igB09kZywYll4wiUljK4mdXEri7lZU0 X-Gm-Message-State: AOJu0Yw9+tTtn1DiILrjXM7rCd3RS/lp/bM1XrFn8wwOnFt8IGyjzd+E f5WoNtTVuUbcrEDBF+tMU84O/Oa14VyVb1OYpu4YN29vFyoJ7ZNI X-Google-Smtp-Source: AGHT+IEk6eY+anZuLZtshXs5jcY3ZABNoDdpwliXhfVBQqinwJqJUuK5I+eA1bn/Byd1GVaRQ7nPXQ== X-Received: by 2002:a05:6871:588c:b0:25e:2624:eb5f with SMTP id 586e51a60fabf-25e2b8cf269mr6539491fac.1.1720254502068; Sat, 06 Jul 2024 01:28:22 -0700 (PDT) Received: from sean-ThinkPad-T450s.attlocal.net ([2600:1702:5083:7610:1e13:57ab:ecc5:1fd4]) by smtp.gmail.com with ESMTPSA id 586e51a60fabf-25e71070ba1sm10744fac.34.2024.07.06.01.28.20 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Sat, 06 Jul 2024 01:28: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 v2 01/37] wifi: mt76: mt7925: update mt76_connac_mcu_uni_add_dev for MLO Date: Sat, 6 Jul 2024 01:27:41 -0700 Message-Id: <5c184808c54b4e71c6feec05828a9f1f5be9b14d.1720248331.git.sean.wang@kernel.org> X-Mailer: git-send-email 2.25.1 In-Reply-To: References: MIME-Version: 1.0 X-CRM114-Version: 20100106-BlameMichelson ( TRE 0.8.0 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20240706_012823_228271_6DAD026F X-CRM114-Status: GOOD ( 10.69 ) 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 Set OMAC address with the per-link BSS. The change remains compatible with the non-MLO mode and the older firmware. 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 | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/drivers/net/wireless/mediatek/mt76/mt76_connac_mcu.c b/drivers/net/wireless/mediatek/mt76/mt76_connac_mcu.c index 4e3c8af98fe7..18801aaf6764 100644 --- a/drivers/net/wireless/mediatek/mt76/mt76_connac_mcu.c +++ b/drivers/net/wireless/mediatek/mt76/mt76_connac_mcu.c @@ -4,6 +4,7 @@ #include #include "mt76_connac2_mac.h" #include "mt76_connac_mcu.h" +#include "mt792x.h" int mt76_connac_mcu_start_firmware(struct mt76_dev *dev, u32 addr, u32 option) { @@ -1141,7 +1142,8 @@ int mt76_connac_mcu_uni_add_dev(struct mt76_phy *phy, struct mt76_wcid *wcid, bool enable) { - struct mt76_vif *mvif = (struct mt76_vif *)bss_conf->vif->drv_priv; + struct mt792x_bss_conf *mconf = mt792x_link_conf_to_mconf(bss_conf); + struct mt76_vif *mvif = &mconf->mt76; struct mt76_dev *dev = phy->dev; struct { struct { @@ -1214,7 +1216,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, bss_conf->vif->addr, ETH_ALEN); + memcpy(dev_req.tlv.omac_addr, bss_conf->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; From patchwork Sat Jul 6 08:27:42 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Sean Wang X-Patchwork-Id: 13725758 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 23AA4C3DA40 for ; Sat, 6 Jul 2024 08:28: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=M0AqvqvX1XnawEbT1CZxbW1N0nw9RHpYcHRkl50qL/k=; b=Xnfop3VGcYm4tgK6J6Hkvf52uT unstcY6uNovT4caDF3AovdBHU8GNFqr+fAtrU/29Cmv4XWRIehbFAtWIezrvOQdhR6ALjJmGx6tkT NH1z3Gf07mUsIozDukw0zIACAbtbzSHEdbXhdwxEiVzii/h3CsKoJg2SEU8fIpLOnKnaWfYkUQeUB ngy12pvV7GZzH+EPIWbw81Xkdj1Nkbaj3V1a6E6ymFk9avRZBj/zwLMGT4qHpXG/ugevKVUBac3Lp KLt5o3l91jgRsTvACuwiKwa+m2QnPUkNhQrSGpDRQqMxmyHpTxQedAKyThTh88jPkBIAFkCty9tYo g9KxFK8w==; Received: from localhost ([::1] helo=bombadil.infradead.org) by bombadil.infradead.org with esmtp (Exim 4.97.1 #2 (Red Hat Linux)) id 1sQ0mS-0000000HXgT-3MII; Sat, 06 Jul 2024 08:28:28 +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 1sQ0mP-0000000HXeT-1U96 for linux-mediatek@lists.infradead.org; Sat, 06 Jul 2024 08:28:26 +0000 Received: by mail-oa1-f42.google.com with SMTP id 586e51a60fabf-25e19ad0050so386953fac.0 for ; Sat, 06 Jul 2024 01:28:25 -0700 (PDT) X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1720254504; x=1720859304; 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=M0AqvqvX1XnawEbT1CZxbW1N0nw9RHpYcHRkl50qL/k=; b=A/4nZiYLwIkCTyWSkGw0sO/ip/QtphHA++qAyUjkmFoYmSiz9XAzwD7VJr4RbtDh5f +XxGWoK78WSnlCoYdrf4Z8MP1CfUlvt4zdOAIBB6TazuL5W7/at712LffQazWB7Xtn2A xIXoMCYVMU3Hnn26lEYq4W7gZaHgTS5AGYgqcU2ydakvTJYV6iVV+7dObJpw6Yx0oJb3 8FQ/EnI0Nm7zQGXB8Flr+m8I7k+5NjhADpdYfBesJrG296v2Tnhi/6/ORQ0sz8v2Kmct zQeffAz1f1VVshSV5m7NXsUY8XXAIczZX3mykCNz7vpDJKKIe9Nd04Lw3Ua9F5OsmZLU pDSg== X-Forwarded-Encrypted: i=1; AJvYcCWaeRsbyv8hjTLriLzzSL3ouSJcHZrM5+/q0E3zsmuT6TCgvnohhErjUZLxr7gsxPMLISlduYdNcGCrGOdMijDKz/qVlogXcLG+VocXhupvN9bC X-Gm-Message-State: AOJu0YzwniW5qKStbSxInWIm67Z9Xjfa1R3bHGrToSJ1bYvfmzY05XWm 2j3OsmwTu4JaH9j9U1AOAakyInm4v5r3OI3I/ugdOU6ykXGuOApp X-Google-Smtp-Source: AGHT+IGNdZ/1sIor3R57hAlhxrzJbk4ui2gjH+E4YJ1N0eT/zRwXtj5JuC6ek9LLKjnf7JbaT/WYfg== X-Received: by 2002:a05:6870:eca3:b0:25e:c0b:82c5 with SMTP id 586e51a60fabf-25e2bf101admr6655751fac.3.1720254504111; Sat, 06 Jul 2024 01:28:24 -0700 (PDT) Received: from sean-ThinkPad-T450s.attlocal.net ([2600:1702:5083:7610:1e13:57ab:ecc5:1fd4]) by smtp.gmail.com with ESMTPSA id 586e51a60fabf-25e71070ba1sm10744fac.34.2024.07.06.01.28.22 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Sat, 06 Jul 2024 01:28: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 v2 02/37] wifi: mt76: mt7925: update mt7925_mac_link_sta_[add, assoc, remove] for MLO Date: Sat, 6 Jul 2024 01:27:42 -0700 Message-Id: <2410cc73eec3849c2185b5cfa613b7e903e68abb.1720248331.git.sean.wang@kernel.org> X-Mailer: git-send-email 2.25.1 In-Reply-To: References: MIME-Version: 1.0 X-CRM114-Version: 20100106-BlameMichelson ( TRE 0.8.0 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20240706_012825_422557_B9E1A308 X-CRM114-Status: GOOD ( 11.97 ) 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, assoc, remove] the per-link STA from the corresponding to per-link BSS with the same link id. The change remains compatible with the non-MLO mode. 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/main.c | 32 ++++++++++++------- 1 file changed, 20 insertions(+), 12 deletions(-) diff --git a/drivers/net/wireless/mediatek/mt76/mt7925/main.c b/drivers/net/wireless/mediatek/mt76/mt7925/main.c index 8b10b63bc98d..a043d93f3e1d 100644 --- a/drivers/net/wireless/mediatek/mt76/mt7925/main.c +++ b/drivers/net/wireless/mediatek/mt76/mt7925/main.c @@ -728,21 +728,24 @@ static int mt7925_mac_link_sta_add(struct mt76_dev *mdev, struct mt792x_dev *dev = container_of(mdev, struct mt792x_dev, mt76); struct mt792x_vif *mvif = (struct mt792x_vif *)vif->drv_priv; struct ieee80211_bss_conf *link_conf; + struct mt792x_bss_conf *mconf; + u8 link_id = link_sta->link_id; 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); + mlink = mt792x_sta_to_link(msta, link_id); idx = mt76_wcid_alloc(dev->mt76.wcid_mask, MT792x_WTBL_STA - 1); if (idx < 0) return -ENOSPC; + mconf = mt792x_vif_to_link(mvif, link_id); 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.phy_idx = mconf->mt76.band_idx; mlink->wcid.tx_info |= MT_WCID_TX_INFO_SET; mlink->last_txs = jiffies; @@ -753,11 +756,11 @@ static int mt7925_mac_link_sta_add(struct mt76_dev *mdev, 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); + link_conf = mt792x_vif_to_bss_conf(vif, link_id); /* should update bss info before STA add */ if (vif->type == NL80211_IFTYPE_STATION && !link_sta->sta->tdls) - mt7925_mcu_add_bss_info(&dev->phy, mvif->bss_conf.mt76.ctx, + mt7925_mcu_add_bss_info(&dev->phy, mconf->mt76.ctx, link_conf, link_sta, false); ret = mt7925_mcu_sta_update(dev, link_sta, vif, true, @@ -790,7 +793,6 @@ static void mt7925_mac_link_sta_assoc(struct mt76_dev *mdev, struct ieee80211_link_sta *link_sta) { struct mt792x_dev *dev = container_of(mdev, struct mt792x_dev, mt76); - 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; @@ -802,9 +804,13 @@ static void mt7925_mac_link_sta_assoc(struct mt76_dev *mdev, link_conf = mt792x_vif_to_bss_conf(vif, vif->bss_conf.link_id); - if (vif->type == NL80211_IFTYPE_STATION && !link_sta->sta->tdls) - mt7925_mcu_add_bss_info(&dev->phy, mvif->bss_conf.mt76.ctx, + if (vif->type == NL80211_IFTYPE_STATION && !link_sta->sta->tdls) { + struct mt792x_bss_conf *mconf; + + mconf = mt792x_link_conf_to_mconf(link_conf); + mt7925_mcu_add_bss_info(&dev->phy, mconf->mt76.ctx, link_conf, link_sta, true); + } ewma_avg_signal_init(&mlink->avg_ack_signal); @@ -830,11 +836,12 @@ static void mt7925_mac_link_sta_remove(struct mt76_dev *mdev, { struct mt792x_dev *dev = container_of(mdev, struct mt792x_dev, mt76); struct ieee80211_bss_conf *link_conf; + u8 link_id = link_sta->link_id; 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); + mlink = mt792x_sta_to_link(msta, link_id); mt76_connac_free_pending_tx_skbs(&dev->pm, &mlink->wcid); mt76_connac_pm_wake(&dev->mphy, &dev->pm); @@ -844,12 +851,13 @@ static void mt7925_mac_link_sta_remove(struct mt76_dev *mdev, 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); + link_conf = mt792x_vif_to_bss_conf(vif, link_id); if (vif->type == NL80211_IFTYPE_STATION && !link_sta->sta->tdls) { - struct mt792x_vif *mvif = (struct mt792x_vif *)vif->drv_priv; - mt7925_mcu_add_bss_info(&dev->phy, - mvif->bss_conf.mt76.ctx, link_conf, + struct mt792x_bss_conf *mconf; + + mconf = mt792x_link_conf_to_mconf(link_conf); + mt7925_mcu_add_bss_info(&dev->phy, mconf->mt76.ctx, link_conf, link_sta, false); } From patchwork Sat Jul 6 08:27:43 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Sean Wang X-Patchwork-Id: 13725757 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 9AE81C38150 for ; Sat, 6 Jul 2024 08:28: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=dNQtKh9bModTpWH38BJ8Wnv4gv4BE649XF4YBalyJck=; b=xQeoLKUdVLfoGkQoir5XyLah9k CwMUvIbOHyOKkkX6LHJsga/JAWRC/HZCQYHfYGBewCmObxKJTpOR8NyGi7F4KG71g251A1eSFoEnR dZXNvpi6NcCIs1NnPalAr0cZwi8MP4QDU/+6oJUrFvRwowLfSROqYPThGYvD5rpW255/EjcrKsWoe 963XhiHsifzf5ZX55HX1KzIToiTLOBC3567h7f6aTJfkCsCdrmMCx/kj+iPcMlad+chsFy2a1cdus 1nVKoIXcVK2DaLTprg72vYePmx51vAxEuVu/WErgHhmRgnvSdBCI+AxxhsYaRGHW++kkO7c6AeElz CftVDS5Q==; Received: from localhost ([::1] helo=bombadil.infradead.org) by bombadil.infradead.org with esmtp (Exim 4.97.1 #2 (Red Hat Linux)) id 1sQ0mT-0000000HXh3-0gJi; Sat, 06 Jul 2024 08:28:29 +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 1sQ0mR-0000000HXfD-0CJR for linux-mediatek@lists.infradead.org; Sat, 06 Jul 2024 08:28:28 +0000 Received: by mail-oa1-f43.google.com with SMTP id 586e51a60fabf-25075f3f472so367167fac.2 for ; Sat, 06 Jul 2024 01:28:26 -0700 (PDT) X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1720254506; x=1720859306; 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=dNQtKh9bModTpWH38BJ8Wnv4gv4BE649XF4YBalyJck=; b=wgHY+5TmlJCdlb+NhyyBPP/CkjCuKn3bFh8nMb2RIVxqo5jRqnoytwm3UPFQl95tl/ Ghfr4l2NkzkarRryd0/G0XkRsrYHOf09HWMRE55RIg4M6VjKMFLG/5U3BUTv96+Mlqpf zvWetIKfAvEv8Nv3JC7kHnoMq/LXxgiYI741f829s3oI79OTQGUVFa0rJo1fqZBrO0ot RY8XX77jLr29zXERV0L22HHdGtTz+KSR2RD5AApROY0SXKC+nD54+97QKQQ/uDVRY8Kv br1vBMWqA+ZNOgUNf+ISdA9GHTUg/Fkg7sf72EQ1P7GUh8Ph8K5NcjCUBfDhI8i2YDbz WBEA== X-Forwarded-Encrypted: i=1; AJvYcCXVL0EDOScArt5izNWB04xTGFklcDNREcKsjcM0ym8odyAF4LdpimNllvHD3qgd4Q/QgWLVfIGuKPtT60vdYStGgGFWnhFQDpZRZ/a78ZVrgo/8 X-Gm-Message-State: AOJu0YwEc7O5ikLj+/NpS8iuXmT2wyGvt3Mo0IyDNimSfcX5XO1LtSdO wwSpp9SqB5nORu8jYRsGeJ+cO2x3nXcdNsZ8N+98q5mQCh3nyvS+ X-Google-Smtp-Source: AGHT+IHN1M66NzqNwtknjegs1rT75zTFpJEy7wrGI7ifp6dtVEt/+v1/Wwqi9urwSqufR1oHldYTvA== X-Received: by 2002:a05:6870:5590:b0:25e:1817:e4a8 with SMTP id 586e51a60fabf-25e2bf93ebcmr7013302fac.4.1720254505963; Sat, 06 Jul 2024 01:28:25 -0700 (PDT) Received: from sean-ThinkPad-T450s.attlocal.net ([2600:1702:5083:7610:1e13:57ab:ecc5:1fd4]) by smtp.gmail.com with ESMTPSA id 586e51a60fabf-25e71070ba1sm10744fac.34.2024.07.06.01.28.24 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Sat, 06 Jul 2024 01:28: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 v2 03/37] wifi: mt76: mt7925: set Tx queue parameters according to link id Date: Sat, 6 Jul 2024 01:27:43 -0700 Message-Id: <84a401891b8942f66d1ffbd0a3f10866c94d1bc0.1720248331.git.sean.wang@kernel.org> X-Mailer: git-send-email 2.25.1 In-Reply-To: References: MIME-Version: 1.0 X-CRM114-Version: 20100106-BlameMichelson ( TRE 0.8.0 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20240706_012827_110720_60623D4C X-CRM114-Status: GOOD ( 10.95 ) 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 Configure TX queue parameters according to link id. 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 | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/drivers/net/wireless/mediatek/mt76/mt7925/main.c b/drivers/net/wireless/mediatek/mt76/mt7925/main.c index a043d93f3e1d..da70c203d618 100644 --- a/drivers/net/wireless/mediatek/mt76/mt7925/main.c +++ b/drivers/net/wireless/mediatek/mt76/mt7925/main.c @@ -1306,6 +1306,7 @@ mt7925_conf_tx(struct ieee80211_hw *hw, struct ieee80211_vif *vif, const struct ieee80211_tx_queue_params *params) { struct mt792x_vif *mvif = (struct mt792x_vif *)vif->drv_priv; + struct mt792x_bss_conf *mconf = mt792x_vif_to_link(mvif, link_id); static const u8 mq_to_aci[] = { [IEEE80211_AC_VO] = 3, [IEEE80211_AC_VI] = 2, @@ -1314,7 +1315,7 @@ mt7925_conf_tx(struct ieee80211_hw *hw, struct ieee80211_vif *vif, }; /* firmware uses access class index */ - mvif->bss_conf.queue_params[mq_to_aci[queue]] = *params; + mconf->queue_params[mq_to_aci[queue]] = *params; return 0; } From patchwork Sat Jul 6 08:27:44 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Sean Wang X-Patchwork-Id: 13725759 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 3516AC2BD09 for ; Sat, 6 Jul 2024 08:28: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=fB1JYRMFZwVbYt+IuaFt8+viDBKhrduPeNh84EEGi48=; b=AJ4cU3aZ3QD7liAuYf1YBzVgKQ 1pXfiSD33jHwG4qYPibHMMSqn9CgaW/fKTWZGGrx1O2ku+2K+DmKUjfFznsbSyIqGfuRMZvN0XnRr DeJbaCaJogfphERX/5lK3CNXvnvyGTAncnKYuMeSmeOh2JHvoZhgP/z0C9uqL93HMwmEKvRarOLzk lyjYfcOtQ0KurGFNXzhNuU753N/PfS3n+AIqMxwl5YZk2NU6ACzNCmv2/SMFGFRUh9qK2yM2vhOrH ZEkTCAVSAYDfaEBMFTP9EhcL8ng3qzN5FqTW26Q2jNoUzZQqz7fRjgEXKIN0m/V5wyV0257NWvEXd 1uBjvsJQ==; Received: from localhost ([::1] helo=bombadil.infradead.org) by bombadil.infradead.org with esmtp (Exim 4.97.1 #2 (Red Hat Linux)) id 1sQ0mV-0000000HXiV-2wG0; Sat, 06 Jul 2024 08:28:31 +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 1sQ0mS-0000000HXgK-3vFs for linux-mediatek@lists.infradead.org; Sat, 06 Jul 2024 08:28:30 +0000 Received: by mail-oa1-f42.google.com with SMTP id 586e51a60fabf-25cb5ee9d2dso294054fac.1 for ; Sat, 06 Jul 2024 01:28:28 -0700 (PDT) X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1720254508; x=1720859308; 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=fB1JYRMFZwVbYt+IuaFt8+viDBKhrduPeNh84EEGi48=; b=WtqHxBLgwPbr9NRFWpcz5NYlut9Zb8LC4QBQ3wWjtZxwVhlGLdTtXBDDy6y5QnQlB4 q7OEr5Aw/2LEGB2agqcPRmlcyvK7YkUgt+3/D4VHs0AHjhQFkMUsLyKZIHVYUYwslxsU 2uKP7TiJ/YMaDQpdbGZ6bvvazAQA7mSSzoiNdno68XwdxZvB/n8uD07t3Kw1h1F5vyvC +W5whqk2G0v+A0mlJpBad7IqmmCC8iZcb4Pe7POSM+hyayAYZX5jaZJbMeAR023PXr9U yJVQ3CkMKBPn598uaQeElTsvsk1F/Beel+geMlaPnF8tIYW0CVbCje6Ghms94QbPwRWx QRsQ== X-Forwarded-Encrypted: i=1; AJvYcCUbyDYhgnZg5rN/Q4gNO8gb+KnEeN7aZ8+eJMs/bY8vAifV7865huV0xk7CsFJciMFTNsoTuRkOYs+mzcKl2zgGlEX82tljYZgqh2TZXyTjgOA9 X-Gm-Message-State: AOJu0YyWmr13zhWkVUBputgEtS3b+s3gR6EJK5ahMvV8v0r5I9w1Vn3l JJPdrjyM8apt5nY3zdqNUK2vrn1HEdzu9jYu7LJoupVCQmeDL4qc X-Google-Smtp-Source: AGHT+IEbBxEgHVC8/DnYcOIvLg50uKhSw9Uz87I6Wzgf6jIzs0QbwsclZn2PRIJzSzOKM0fnme89Qw== X-Received: by 2002:a05:6871:24d7:b0:24f:e599:9168 with SMTP id 586e51a60fabf-25e2b8d0139mr7037870fac.1.1720254508050; Sat, 06 Jul 2024 01:28:28 -0700 (PDT) Received: from sean-ThinkPad-T450s.attlocal.net ([2600:1702:5083:7610:1e13:57ab:ecc5:1fd4]) by smtp.gmail.com with ESMTPSA id 586e51a60fabf-25e71070ba1sm10744fac.34.2024.07.06.01.28.26 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Sat, 06 Jul 2024 01:28:26 -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 v2 04/37] wifi: mt76: mt7925: set mt7925_mcu_sta_key_tlv according to link id Date: Sat, 6 Jul 2024 01:27:44 -0700 Message-Id: <16d65aae010113f9be3c4e6e759b4226d396a1be.1720248331.git.sean.wang@kernel.org> X-Mailer: git-send-email 2.25.1 In-Reply-To: References: MIME-Version: 1.0 X-CRM114-Version: 20100106-BlameMichelson ( TRE 0.8.0 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20240706_012829_041675_1FB5EE7B 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 configure mt7925_mcu_sta_key_tlv according to link id We created a link id field in the common structure mt76_wcid so that mt7925_mcu_sta_key_tlv can access per-link STA/BSS. Additionally, .link_id will be required when reporting the link information of Rx status to mac80211. We will submit the changes for reporting the Rx status in a separate patch. 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.h | 1 + drivers/net/wireless/mediatek/mt76/mt7925/main.c | 1 + drivers/net/wireless/mediatek/mt76/mt7925/mcu.c | 15 +++++++++++---- drivers/net/wireless/mediatek/mt76/mt792x.h | 11 +++++++++++ 4 files changed, 24 insertions(+), 4 deletions(-) diff --git a/drivers/net/wireless/mediatek/mt76/mt76.h b/drivers/net/wireless/mediatek/mt76/mt76.h index 15f83b5adac7..daf1e43e304e 100644 --- a/drivers/net/wireless/mediatek/mt76/mt76.h +++ b/drivers/net/wireless/mediatek/mt76/mt76.h @@ -349,6 +349,7 @@ struct mt76_wcid { u8 sta:1; u8 amsdu:1; u8 phy_idx:2; + u8 link_id:4; u8 rx_check_pn; u8 rx_key_pn[IEEE80211_NUM_TIDS + 1][6]; diff --git a/drivers/net/wireless/mediatek/mt76/mt7925/main.c b/drivers/net/wireless/mediatek/mt76/mt7925/main.c index da70c203d618..59b1e920bb4a 100644 --- a/drivers/net/wireless/mediatek/mt76/mt7925/main.c +++ b/drivers/net/wireless/mediatek/mt76/mt7925/main.c @@ -748,6 +748,7 @@ static int mt7925_mac_link_sta_add(struct mt76_dev *mdev, mlink->wcid.phy_idx = mconf->mt76.band_idx; mlink->wcid.tx_info |= MT_WCID_TX_INFO_SET; mlink->last_txs = jiffies; + mlink->wcid.link_id = link_sta->link_id; ret = mt76_connac_pm_wake(&dev->mphy, &dev->pm); if (ret) diff --git a/drivers/net/wireless/mediatek/mt76/mt7925/mcu.c b/drivers/net/wireless/mediatek/mt76/mt7925/mcu.c index a67d8dd6075f..ba91c8e37dff 100644 --- a/drivers/net/wireless/mediatek/mt76/mt7925/mcu.c +++ b/drivers/net/wireless/mediatek/mt76/mt7925/mcu.c @@ -967,6 +967,7 @@ mt7925_mcu_sta_key_tlv(struct mt76_wcid *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 mt792x_bss_conf *mconf = mt792x_vif_to_link(mvif, wcid->link_id); struct ieee80211_sta *sta; struct ieee80211_vif *vif; struct tlv *tlv; @@ -978,17 +979,23 @@ 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->bss_conf.mt76.idx; + sec->bss_idx = mconf->mt76.idx; sec->is_authenticator = 0; - sec->mgmt_prot = 0; + sec->mgmt_prot = 1; /* only used in MLO mode */ sec->wlan_idx = (u8)wcid->idx; if (sta) { + struct ieee80211_link_sta *link_sta; + sec->tx_key = 1; sec->key_type = 1; - memcpy(sec->peer_addr, sta->addr, ETH_ALEN); + link_sta = mt792x_sta_to_link_sta(vif, sta, wcid->link_id); + memcpy(sec->peer_addr, link_sta->addr, ETH_ALEN); } else { - memcpy(sec->peer_addr, vif->bss_conf.bssid, ETH_ALEN); + struct ieee80211_bss_conf *link_conf; + + link_conf = mt792x_vif_to_bss_conf(vif, wcid->link_id); + memcpy(sec->peer_addr, link_conf->bssid, ETH_ALEN); } if (cmd == SET_KEY) { diff --git a/drivers/net/wireless/mediatek/mt76/mt792x.h b/drivers/net/wireless/mediatek/mt76/mt792x.h index 69eb8dac0b70..fe5a6c932705 100644 --- a/drivers/net/wireless/mediatek/mt76/mt792x.h +++ b/drivers/net/wireless/mediatek/mt76/mt792x.h @@ -273,6 +273,17 @@ mt792x_vif_to_bss_conf(struct ieee80211_vif *vif, unsigned int link_id) return link_conf_dereference_protected(vif, link_id); } +static inline struct ieee80211_link_sta * +mt792x_sta_to_link_sta(struct ieee80211_vif *vif, struct ieee80211_sta *sta, + unsigned int link_id) +{ + if (!ieee80211_vif_is_mld(vif) || + link_id >= IEEE80211_LINK_UNSPECIFIED) + return &sta->deflink; + + return link_sta_dereference_protected(sta, link_id); +} + static inline struct mt792x_dev * mt792x_hw_dev(struct ieee80211_hw *hw) { From patchwork Sat Jul 6 08:27:45 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Sean Wang X-Patchwork-Id: 13725760 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 0D259C3DA42 for ; Sat, 6 Jul 2024 08:28: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=T1Y0KCWfIIgPouNmUpNwTith6gb3NivXxQnRCB1BWZk=; b=a4N2vYraaJju/DnzXHSRtVjJP7 3kDYuxrbLACSS1ONoSQbA0ZujkCOxnfn9c8B2yIfjnizA7vcz3D0E0clXTVy8ofWT3JubkJBsmCKa 0212+HJ95reNcUH3x5pgdNozztSly2k/XNDv0qUiSlmFSa1C1zuiTwsvg5WHA/O9f5dPIu/yL62aH /gH2Crq2QeuuH3J3LwWTI4lYLYYkUwQZrr2DXVoK0qtyTJvdDkwgsj2wxL01oSBDxBZrlYeEwvwZm kWUJCfzNSh+gB6YRo3MNBT6A6CHWQVk/XoJqKm5KV2nrNiPmyr2/7poULEqXPnqmEGcoh5trgD6FV ZAFDJirA==; Received: from localhost ([::1] helo=bombadil.infradead.org) by bombadil.infradead.org with esmtp (Exim 4.97.1 #2 (Red Hat Linux)) id 1sQ0mX-0000000HXjr-2rfn; Sat, 06 Jul 2024 08:28:33 +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 1sQ0mV-0000000HXhr-0G4U for linux-mediatek@lists.infradead.org; Sat, 06 Jul 2024 08:28:32 +0000 Received: by mail-oa1-f47.google.com with SMTP id 586e51a60fabf-254925e6472so364155fac.0 for ; Sat, 06 Jul 2024 01:28:30 -0700 (PDT) X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1720254510; x=1720859310; 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=T1Y0KCWfIIgPouNmUpNwTith6gb3NivXxQnRCB1BWZk=; b=CDNyaGMukrhKqpYjFpShn3qGQUHe146+9ziMjR7gk3TFfEMqhE6vzytQ8dvj2AmXkZ YkRERi8f7t7Ep5CCR/ghZwgLBoFCgWthZE3uNOkNS1M7fC0lRCtzt9kHBeAU6d25hcew halRrAh9VhUwqkdcs8ezCdlNHyQ62djl7JWEvV1p5gAj5pyG3zd2iH/8r58bTI0XXkns QkTLjPohI+/2OG5cCG3GWwP/Au1OtuTpGijPvvPPYpUIBJZ0oTjU4zBFfN+9Mvu9jiBx Va11bfBkyhrfGHcjEVg9x5L2joHXcfj6DFUJy7BAb2OeAI3iW/OR/P+N3VDU/6xHqeji qqAA== X-Forwarded-Encrypted: i=1; AJvYcCWZj01HImnrzuyPKtTVsunDt+Y5hNeN2Gwh/zrVOE4doZb1D7h6SCIMCOJTdppzSQgPqpu1ZvtuU7DJ5CfNUXKVCOb9g/NetNFGNQQs+f66tRUo X-Gm-Message-State: AOJu0Yzxgr1wNvaV828I2B5gyANEtPe75ieX29dZWdZfWd3jXTiUc2an 2PAxva4G5CHACP1UBAIRpTbts6B+reqzGhcniS8/IYlcTmOM/OF5QgdA7BKs X-Google-Smtp-Source: AGHT+IEQuqBNE4O9ygl1LhpCjiqP0kPykNMCGmW8fwh6NKVKSgPtHgb2U6ilu63Gjl43/x4WYAQ26A== X-Received: by 2002:a05:6870:5590:b0:25e:1817:e4a8 with SMTP id 586e51a60fabf-25e2bf93ebcmr7013356fac.4.1720254509830; Sat, 06 Jul 2024 01:28:29 -0700 (PDT) Received: from sean-ThinkPad-T450s.attlocal.net ([2600:1702:5083:7610:1e13:57ab:ecc5:1fd4]) by smtp.gmail.com with ESMTPSA id 586e51a60fabf-25e71070ba1sm10744fac.34.2024.07.06.01.28.28 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Sat, 06 Jul 2024 01:28: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 v2 05/37] wifi: mt76: mt7925: add mt7925_set_link_key Date: Sat, 6 Jul 2024 01:27:45 -0700 Message-Id: X-Mailer: git-send-email 2.25.1 In-Reply-To: References: MIME-Version: 1.0 X-CRM114-Version: 20100106-BlameMichelson ( TRE 0.8.0 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20240706_012831_152108_51B3DF64 X-CRM114-Status: GOOD ( 15.99 ) 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_set_link_key to set up the key according to the link id 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/main.c | 70 ++++++++++++------- .../net/wireless/mediatek/mt76/mt7925/mcu.c | 25 ++++--- .../wireless/mediatek/mt76/mt7925/mt7925.h | 3 +- 3 files changed, 61 insertions(+), 37 deletions(-) diff --git a/drivers/net/wireless/mediatek/mt76/mt7925/main.c b/drivers/net/wireless/mediatek/mt76/mt7925/main.c index 59b1e920bb4a..7c7452729710 100644 --- a/drivers/net/wireless/mediatek/mt76/mt7925/main.c +++ b/drivers/net/wireless/mediatek/mt76/mt7925/main.c @@ -499,31 +499,28 @@ static int mt7925_cancel_remain_on_channel(struct ieee80211_hw *hw, return mt7925_abort_roc(phy, &mvif->bss_conf); } -static int mt7925_set_key(struct ieee80211_hw *hw, enum set_key_cmd cmd, - struct ieee80211_vif *vif, struct ieee80211_sta *sta, - struct ieee80211_key_conf *key) +static int mt7925_set_link_key(struct ieee80211_hw *hw, enum set_key_cmd cmd, + struct ieee80211_vif *vif, struct ieee80211_sta *sta, + struct ieee80211_key_conf *key, int link_id) { struct mt792x_dev *dev = mt792x_hw_dev(hw); struct mt792x_vif *mvif = (struct mt792x_vif *)vif->drv_priv; struct mt792x_sta *msta = sta ? (struct mt792x_sta *)sta->drv_priv : &mvif->sta; - struct ieee80211_link_sta *link_sta = sta ? &sta->deflink : NULL; - struct mt76_wcid *wcid = &msta->deflink.wcid; struct ieee80211_bss_conf *link_conf; - u8 *wcid_keyidx = &wcid->hw_key_idx; + struct ieee80211_link_sta *link_sta; int idx = key->keyidx, err = 0; + struct mt792x_link_sta *mlink; + struct mt792x_bss_conf *mconf; + struct mt76_wcid *wcid; + u8 *wcid_keyidx; - 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. - */ - if ((vif->type == NL80211_IFTYPE_ADHOC || - vif->type == NL80211_IFTYPE_MESH_POINT) && - (key->cipher == WLAN_CIPHER_SUITE_TKIP || - key->cipher == WLAN_CIPHER_SUITE_CCMP) && - !(key->flags & IEEE80211_KEY_FLAG_PAIRWISE)) - return -EOPNOTSUPP; + link_conf = mt792x_vif_to_bss_conf(vif, link_id); + link_sta = sta ? mt792x_sta_to_link_sta(vif, sta, link_id) : NULL; + mconf = mt792x_vif_to_link(mvif, link_id); + mlink = mt792x_sta_to_link(msta, link_id); + wcid = &mlink->wcid; + wcid_keyidx = &wcid->hw_key_idx; /* fall back to sw encryption for unsupported ciphers */ switch (key->cipher) { @@ -547,13 +544,11 @@ static int mt7925_set_key(struct ieee80211_hw *hw, enum set_key_cmd cmd, return -EOPNOTSUPP; } - mt792x_mutex_acquire(dev); - - if (cmd == SET_KEY && !mvif->bss_conf.mt76.cipher) { + if (cmd == SET_KEY && !mconf->mt76.cipher) { 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, link_conf, + mconf->mt76.cipher = mt7925_mcu_get_cipher(key->cipher); + mt7925_mcu_add_bss_info(phy, mconf->mt76.ctx, link_conf, link_sta, true); } @@ -567,9 +562,9 @@ 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->deflink.bip, + err = mt7925_mcu_add_key(&dev->mt76, vif, &mlink->bip, key, MCU_UNI_CMD(STA_REC_UPDATE), - &msta->deflink.wcid, cmd); + &mlink->wcid, cmd, msta); if (err) goto out; @@ -578,9 +573,32 @@ static int mt7925_set_key(struct ieee80211_hw *hw, enum set_key_cmd cmd, key->cipher == WLAN_CIPHER_SUITE_WEP40) err = mt7925_mcu_add_key(&dev->mt76, vif, &mvif->wep_sta->deflink.bip, key, MCU_WMWA_UNI_CMD(STA_REC_UPDATE), - &mvif->wep_sta->deflink.wcid, cmd); - + &mvif->wep_sta->deflink.wcid, cmd, msta); out: + return err; +} + +static int mt7925_set_key(struct ieee80211_hw *hw, enum set_key_cmd cmd, + struct ieee80211_vif *vif, struct ieee80211_sta *sta, + struct ieee80211_key_conf *key) +{ + struct mt792x_dev *dev = mt792x_hw_dev(hw); + int err; + + /* The hardware does not support per-STA RX GTK, fallback + * to software mode for these. + */ + if ((vif->type == NL80211_IFTYPE_ADHOC || + vif->type == NL80211_IFTYPE_MESH_POINT) && + (key->cipher == WLAN_CIPHER_SUITE_TKIP || + key->cipher == WLAN_CIPHER_SUITE_CCMP) && + !(key->flags & IEEE80211_KEY_FLAG_PAIRWISE)) + return -EOPNOTSUPP; + + mt792x_mutex_acquire(dev); + + err = mt7925_set_link_key(hw, cmd, vif, sta, key, vif->bss_conf.link_id); + mt792x_mutex_release(dev); return err; diff --git a/drivers/net/wireless/mediatek/mt76/mt7925/mcu.c b/drivers/net/wireless/mediatek/mt76/mt7925/mcu.c index ba91c8e37dff..1db81cf4d71d 100644 --- a/drivers/net/wireless/mediatek/mt76/mt7925/mcu.c +++ b/drivers/net/wireless/mediatek/mt76/mt7925/mcu.c @@ -961,13 +961,12 @@ mt7925_mcu_sta_key_tlv(struct mt76_wcid *wcid, struct mt76_connac_sta_key_conf *sta_key_conf, struct sk_buff *skb, struct ieee80211_key_conf *key, - enum set_key_cmd cmd) + enum set_key_cmd cmd, + struct mt792x_sta *msta) { - 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 mt792x_bss_conf *mconf = mt792x_vif_to_link(mvif, wcid->link_id); + struct sta_rec_sec_uni *sec; struct ieee80211_sta *sta; struct ieee80211_vif *vif; struct tlv *tlv; @@ -990,12 +989,16 @@ mt7925_mcu_sta_key_tlv(struct mt76_wcid *wcid, sec->tx_key = 1; sec->key_type = 1; link_sta = mt792x_sta_to_link_sta(vif, sta, wcid->link_id); - memcpy(sec->peer_addr, link_sta->addr, ETH_ALEN); + + if (link_sta) + memcpy(sec->peer_addr, link_sta->addr, ETH_ALEN); } else { struct ieee80211_bss_conf *link_conf; link_conf = mt792x_vif_to_bss_conf(vif, wcid->link_id); - memcpy(sec->peer_addr, link_conf->bssid, ETH_ALEN); + + if (link_conf) + memcpy(sec->peer_addr, link_conf->bssid, ETH_ALEN); } if (cmd == SET_KEY) { @@ -1040,18 +1043,20 @@ mt7925_mcu_sta_key_tlv(struct mt76_wcid *wcid, int mt7925_mcu_add_key(struct mt76_dev *dev, struct ieee80211_vif *vif, struct mt76_connac_sta_key_conf *sta_key_conf, struct ieee80211_key_conf *key, int mcu_cmd, - struct mt76_wcid *wcid, enum set_key_cmd cmd) + struct mt76_wcid *wcid, enum set_key_cmd cmd, + struct mt792x_sta *msta) { - struct mt76_vif *mvif = (struct mt76_vif *)vif->drv_priv; + struct mt792x_vif *mvif = (struct mt792x_vif *)vif->drv_priv; + struct mt792x_bss_conf *mconf = mt792x_vif_to_link(mvif, wcid->link_id); struct sk_buff *skb; int ret; - skb = __mt76_connac_mcu_alloc_sta_req(dev, mvif, wcid, + skb = __mt76_connac_mcu_alloc_sta_req(dev, &mconf->mt76, wcid, MT7925_STA_UPDATE_MAX_SIZE); if (IS_ERR(skb)) return PTR_ERR(skb); - ret = mt7925_mcu_sta_key_tlv(wcid, sta_key_conf, skb, key, cmd); + ret = mt7925_mcu_sta_key_tlv(wcid, sta_key_conf, skb, key, cmd, msta); if (ret) return ret; diff --git a/drivers/net/wireless/mediatek/mt76/mt7925/mt7925.h b/drivers/net/wireless/mediatek/mt76/mt7925/mt7925.h index 8ec5a3a20202..7750049c42f2 100644 --- a/drivers/net/wireless/mediatek/mt76/mt7925/mt7925.h +++ b/drivers/net/wireless/mediatek/mt76/mt7925/mt7925.h @@ -304,7 +304,8 @@ int mt7925_mcu_fill_message(struct mt76_dev *mdev, struct sk_buff *skb, int mt7925_mcu_add_key(struct mt76_dev *dev, struct ieee80211_vif *vif, struct mt76_connac_sta_key_conf *sta_key_conf, struct ieee80211_key_conf *key, int mcu_cmd, - struct mt76_wcid *wcid, enum set_key_cmd cmd); + struct mt76_wcid *wcid, enum set_key_cmd cmd, + struct mt792x_sta *msta); int mt7925_mcu_set_rts_thresh(struct mt792x_phy *phy, u32 val); int mt7925_mcu_wtbl_update_hdr_trans(struct mt792x_dev *dev, struct ieee80211_vif *vif, From patchwork Sat Jul 6 08:27:46 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Sean Wang X-Patchwork-Id: 13725761 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 89440C2BD09 for ; Sat, 6 Jul 2024 08:28: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=z8HH5g9CrxDDIkevGDqVubZk3Zy2h11RIiM+NpG21nw=; b=dmvw3KerekgXIbHuWRzTO96Pse QRcLoM1U+kTxL4GYwbdVUDRQDupmB6E7XSf2z7Y1v142Z99uOIoxyJFQ6+KJ2eARaGjhtrgCAHw35 qYOizEVURVICWwd9piLhb9NKWmFXzKU2fXBU16Q/rdwjDF8pAxIIXMjoO4WgV62Jbv+0xOvPaWgBk YeSSV8hLGyZRXctlgSn4d8xav6nFvjCRDd2pJ6xdTqGaCqtASsWlgJz68UrsaRWpXVI/Cjwamtq6B WZlbcOGcAgWQInvwu5qUlf95DgPA0DQ2kkOsQ0OGjJPaHh5K+DnxeGdgQmRR/gy0xwpzPPvcsIcyf H2AITdAw==; Received: from localhost ([::1] helo=bombadil.infradead.org) by bombadil.infradead.org with esmtp (Exim 4.97.1 #2 (Red Hat Linux)) id 1sQ0mZ-0000000HXkc-0NeG; Sat, 06 Jul 2024 08:28:35 +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 1sQ0mX-0000000HXjD-05qH for linux-mediatek@lists.infradead.org; Sat, 06 Jul 2024 08:28:34 +0000 Received: by mail-oa1-f42.google.com with SMTP id 586e51a60fabf-25e19660ffeso38927fac.2 for ; Sat, 06 Jul 2024 01:28:32 -0700 (PDT) X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1720254512; x=1720859312; 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=z8HH5g9CrxDDIkevGDqVubZk3Zy2h11RIiM+NpG21nw=; b=TpNtmoCpIztsPi5ueDQU/F4Z4PtETiE5qI9zW+Hr7JBuprSWlNnjCrVkIBQZgofXJl feteAtIhxVFIWSlG6pHvPbJLcmXPLJh9XfkHGXwrFNRn3/hSzhF3B03ru3oB4pKMgaoR idxXUzYOdR/bjJZEWYr1FchlAQQD8jLqiE9Dyr/jH+yPullo9sV2IBCfJFdDUfDZly/L hwUv3WB/JkYNi4o2xRgfqqvWYI11igdU71zvRRmB0DP0fMbNkjeTj2OccsM4w5eA2pXK 2o61wBWLWADHG2NpNYqUrck7I0ZphXhUf7ZJdqFkmhwRgDfhD4Sn+rAK1bAfxRXE4ms3 nLMQ== X-Forwarded-Encrypted: i=1; AJvYcCV22nYf/2UsPJtXmmNOH6lnjT8P5ukNwJvuPVR6Ud5ESj8ozkdClmiTUCJ3nUlx4dMCszCLY8ncdYzoDGYnru4XysidHMErcbB9qoUjbBLZp0Gq X-Gm-Message-State: AOJu0YzzRJn9oSsLE50CNm41BSdwAz8Fa6R8aS8QEpZw5HZbBVagBYTk jLGVFihtVXl3cpt/2zlY5CtbHzuxVZBqUcc85g3WmZqGqJQkqgjZ X-Google-Smtp-Source: AGHT+IELUobtU/tVmxvpCBwgfoU9MuC47Dl1sziXTOJx86m3iSk+c4RQTj/vErvNnxbqtl3bSuUB6w== X-Received: by 2002:a05:6870:d892:b0:254:cae6:a812 with SMTP id 586e51a60fabf-25e2bf101a2mr6994918fac.3.1720254512168; Sat, 06 Jul 2024 01:28:32 -0700 (PDT) Received: from sean-ThinkPad-T450s.attlocal.net ([2600:1702:5083:7610:1e13:57ab:ecc5:1fd4]) by smtp.gmail.com with ESMTPSA id 586e51a60fabf-25e71070ba1sm10744fac.34.2024.07.06.01.28.30 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Sat, 06 Jul 2024 01:28:30 -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 v2 06/37] wifi: mt76: mt7925: extend mt7925_mcu_uni_roc_event Date: Sat, 6 Jul 2024 01:27:46 -0700 Message-Id: <4be7b34904034d521dab147883b898b5402fd29f.1720248331.git.sean.wang@kernel.org> X-Mailer: git-send-email 2.25.1 In-Reply-To: References: MIME-Version: 1.0 X-CRM114-Version: 20100106-BlameMichelson ( TRE 0.8.0 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20240706_012833_089832_656F6136 X-CRM114-Status: GOOD ( 13.00 ) 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 We extended the function to be able multiple pieces of information in a single event, supporting the future MLO-enabled firmware. 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 | 31 ++++++++++++++++--- .../wireless/mediatek/mt76/mt7925/mt7925.h | 1 + 2 files changed, 27 insertions(+), 5 deletions(-) diff --git a/drivers/net/wireless/mediatek/mt76/mt7925/mcu.c b/drivers/net/wireless/mediatek/mt76/mt7925/mcu.c index 1db81cf4d71d..8069b27ce61c 100644 --- a/drivers/net/wireless/mediatek/mt76/mt7925/mcu.c +++ b/drivers/net/wireless/mediatek/mt76/mt7925/mcu.c @@ -313,16 +313,14 @@ mt7925_mcu_roc_iter(void *priv, u8 *mac, struct ieee80211_vif *vif) mvif->band_idx = grant->dbdcband; } -static void -mt7925_mcu_uni_roc_event(struct mt792x_dev *dev, struct sk_buff *skb) +static void mt7925_mcu_roc_handle_grant(struct mt792x_dev *dev, + struct tlv *tlv) { struct ieee80211_hw *hw = dev->mt76.hw; struct mt7925_roc_grant_tlv *grant; - struct mt7925_mcu_rxd *rxd; int duration; - rxd = (struct mt7925_mcu_rxd *)skb->data; - grant = (struct mt7925_roc_grant_tlv *)(rxd->tlv + 4); + grant = (struct mt7925_roc_grant_tlv *)tlv; /* should never happen */ WARN_ON_ONCE((le16_to_cpu(grant->tag) != UNI_EVENT_ROC_GRANT)); @@ -340,6 +338,29 @@ mt7925_mcu_uni_roc_event(struct mt792x_dev *dev, struct sk_buff *skb) jiffies + msecs_to_jiffies(duration)); } +static void +mt7925_mcu_uni_roc_event(struct mt792x_dev *dev, struct sk_buff *skb) +{ + struct tlv *tlv; + int i = 0; + + skb_pull(skb, sizeof(struct mt7925_mcu_rxd) + 4); + + while (i < skb->len) { + tlv = (struct tlv *)(skb->data + i); + + switch (le16_to_cpu(tlv->tag)) { + case UNI_EVENT_ROC_GRANT: + mt7925_mcu_roc_handle_grant(dev, tlv); + break; + case UNI_EVENT_ROC_GRANT_SUB_LINK: + break; + } + + i += tlv->len; + } +} + static void mt7925_mcu_scan_event(struct mt792x_dev *dev, struct sk_buff *skb) { diff --git a/drivers/net/wireless/mediatek/mt76/mt7925/mt7925.h b/drivers/net/wireless/mediatek/mt76/mt7925/mt7925.h index 7750049c42f2..b7f8802b9cd6 100644 --- a/drivers/net/wireless/mediatek/mt76/mt7925/mt7925.h +++ b/drivers/net/wireless/mediatek/mt76/mt7925/mt7925.h @@ -41,6 +41,7 @@ enum mt7925_roc_req { enum { UNI_EVENT_ROC_GRANT = 0, + UNI_EVENT_ROC_GRANT_SUB_LINK = 4, UNI_EVENT_ROC_TAG_NUM }; From patchwork Sat Jul 6 08:27:47 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Sean Wang X-Patchwork-Id: 13725762 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 2F4D9C2BD09 for ; Sat, 6 Jul 2024 08:28: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=ETsdxoWBl1jlyH0mjXdSFYsrC9eRAMS+LPSgSNFgJW4=; b=FgKSIaR3P1069m6FSi6IqCjoV/ CnHTPhpmy47YfOz2ClkxcvsKt2sJBBkVnlqMmkK0fumQU9cI1pLd7ZgdoTGYq+ct9eKc+ccYh3R/j hHqWg9ceA7A2n+2Q4LXP+71xllBDd6h182UyS5NINWlExqDG9YaFaSMmiaFDs6VdI6GJbNFIoHpLw BrZmgcRwfmr8Bj9qA+/BFkco7sg0ZM6g3g7pJOgoncyyx/pBzzUWjewZ/7FqMREjF/WS4bd2qGbLa gPm2Rb0IilS9f+XBPXPG2x0gmJr/jcxTe4QjB0w4cjmfvq5Fd81b65/yI0CQoVsS/uCcDh1/TlR1j nbKm35ag==; Received: from localhost ([::1] helo=bombadil.infradead.org) by bombadil.infradead.org with esmtp (Exim 4.97.1 #2 (Red Hat Linux)) id 1sQ0mc-0000000HXmr-3IBR; Sat, 06 Jul 2024 08:28:38 +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 1sQ0mZ-0000000HXkU-28CN for linux-mediatek@lists.infradead.org; Sat, 06 Jul 2024 08:28:37 +0000 Received: by mail-oo1-f48.google.com with SMTP id 006d021491bc7-5c229104335so56198eaf.3 for ; Sat, 06 Jul 2024 01:28:34 -0700 (PDT) X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1720254514; x=1720859314; 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=ETsdxoWBl1jlyH0mjXdSFYsrC9eRAMS+LPSgSNFgJW4=; b=fDHtkAf338ZghMF3yTeiWLAhwf9x6deN9ovZpcXcUZrA2efbE7oUV2AO6A41hUD9k/ FowclJyyGFE3l4Hi86PsJQeSQI7ZCq310hVr9R/HRR2EyXDA8m7fQbvrmqQNxzTs5LfJ 2jSF90wai7XrnR3uRd9ZdqISB5gBKsG0VeKdiBpf5MD1JB6OVRHxITpzn1ZL3uA93IdF yAsnL9CnvU2Y+R25a/k7bxykdrL1PoDfXnrOTHF+7fkMT7qyQzOCCjikMJFa6m4UQmPa eWJxXjW2P7MY1bubxqZetM3Pw3MLT8EWaSmw4gV/GRW49f6PRQ7aAfJV513XXKJGWzl+ w9CQ== X-Forwarded-Encrypted: i=1; AJvYcCXME5PCsImbQbvq6YftvCyujvtQV020yBy3P/PDPYAkxw49beE33JKHIjEta/6jw894juVgx/J27pcfPmO6OfSCtrAJmUtCSnr76deAl0/gZvp4 X-Gm-Message-State: AOJu0Ywe1Vz8n8tQBSRPtCAyd+pwMu62sPIoDWeP8y3Xb9ezUhf1ODO3 KKaaGcLIq+YD+QcmwmV14Z5+0KgE5wMLSXTeow5hP1jMlsCjzRmK X-Google-Smtp-Source: AGHT+IEbAWvgIdd5Bl6W9MVse4dOntxuXQSSxiWbpOYDgcFt/ainUz2UCNVJ7up+xvGXjoPuW/55rw== X-Received: by 2002:a05:6871:24d9:b0:258:4ae8:4aec with SMTP id 586e51a60fabf-25e2bf90e00mr6557949fac.3.1720254513854; Sat, 06 Jul 2024 01:28:33 -0700 (PDT) Received: from sean-ThinkPad-T450s.attlocal.net ([2600:1702:5083:7610:1e13:57ab:ecc5:1fd4]) by smtp.gmail.com with ESMTPSA id 586e51a60fabf-25e71070ba1sm10744fac.34.2024.07.06.01.28.32 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Sat, 06 Jul 2024 01:28:32 -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 v2 07/37] wifi: mt76: mt7925: add mt7925_change_vif_links Date: Sat, 6 Jul 2024 01:27:47 -0700 Message-Id: <31c9de30c3a18592c8e100f909845383b66f8677.1720248331.git.sean.wang@kernel.org> X-Mailer: git-send-email 2.25.1 In-Reply-To: References: MIME-Version: 1.0 X-CRM114-Version: 20100106-BlameMichelson ( TRE 0.8.0 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20240706_012835_633787_AC09CF29 X-CRM114-Status: GOOD ( 21.97 ) 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_change_vif_links to change the valid links on an interface, supporting the MLO-enabled firmware. 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/main.c | 130 ++++++++++++++++++ .../net/wireless/mediatek/mt76/mt7925/mcu.c | 117 +++++++++++++--- .../net/wireless/mediatek/mt76/mt7925/mcu.h | 20 +++ .../wireless/mediatek/mt76/mt7925/mt7925.h | 6 + drivers/net/wireless/mediatek/mt76/mt792x.h | 5 + .../net/wireless/mediatek/mt76/mt792x_core.c | 23 +++- 6 files changed, 275 insertions(+), 26 deletions(-) diff --git a/drivers/net/wireless/mediatek/mt76/mt7925/main.c b/drivers/net/wireless/mediatek/mt76/mt7925/main.c index 7c7452729710..fcf7bd1a06bc 100644 --- a/drivers/net/wireless/mediatek/mt76/mt7925/main.c +++ b/drivers/net/wireless/mediatek/mt76/mt7925/main.c @@ -472,6 +472,33 @@ static int mt7925_set_roc(struct mt792x_phy *phy, return err; } +static int mt7925_set_mlo_roc(struct mt792x_phy *phy, + struct mt792x_bss_conf *mconf, + u16 sel_links) +{ + int err; + + if (WARN_ON_ONCE(test_and_set_bit(MT76_STATE_ROC, &phy->mt76->state))) + return -EBUSY; + + phy->roc_grant = false; + + err = mt7925_mcu_set_mlo_roc(mconf, sel_links, 5, ++phy->roc_token_id); + if (err < 0) { + clear_bit(MT76_STATE_ROC, &phy->mt76->state); + goto out; + } + + if (!wait_event_timeout(phy->roc_wait, phy->roc_grant, 4 * HZ)) { + mt7925_mcu_abort_roc(phy, mconf, phy->roc_token_id); + clear_bit(MT76_STATE_ROC, &phy->mt76->state); + err = -ETIMEDOUT; + } + +out: + return err; +} + static int mt7925_remain_on_channel(struct ieee80211_hw *hw, struct ieee80211_vif *vif, struct ieee80211_channel *chan, @@ -1521,6 +1548,108 @@ static void mt7925_link_info_changed(struct ieee80211_hw *hw, mt792x_mutex_release(dev); } +static int +mt7925_change_vif_links(struct ieee80211_hw *hw, struct ieee80211_vif *vif, + u16 old_links, u16 new_links, + struct ieee80211_bss_conf *old[IEEE80211_MLD_MAX_NUM_LINKS]) +{ + struct mt792x_bss_conf *mconfs[IEEE80211_MLD_MAX_NUM_LINKS] = {}, *mconf; + struct mt792x_link_sta *mlinks[IEEE80211_MLD_MAX_NUM_LINKS] = {}, *mlink; + struct mt792x_vif *mvif = (struct mt792x_vif *)vif->drv_priv; + unsigned long add = new_links & ~old_links; + unsigned long rem = old_links & ~new_links; + struct mt792x_dev *dev = mt792x_hw_dev(hw); + struct mt792x_phy *phy = mt792x_hw_phy(hw); + struct ieee80211_bss_conf *link_conf; + unsigned int link_id; + int err; + + if (old_links == new_links) + return 0; + + mt792x_mutex_acquire(dev); + + for_each_set_bit(link_id, &rem, IEEE80211_MLD_MAX_NUM_LINKS) { + mconf = mt792x_vif_to_link(mvif, link_id); + mlink = mt792x_sta_to_link(&mvif->sta, link_id); + + if (!mconf || !mlink) + continue; + + if (mconf != &mvif->bss_conf) { + mt792x_mac_link_bss_remove(dev, mconf, mlink); + devm_kfree(dev->mt76.dev, mconf); + devm_kfree(dev->mt76.dev, mlink); + } + + rcu_assign_pointer(mvif->link_conf[link_id], NULL); + rcu_assign_pointer(mvif->sta.link[link_id], NULL); + } + + for_each_set_bit(link_id, &add, IEEE80211_MLD_MAX_NUM_LINKS) { + if (!old_links) { + mconf = &mvif->bss_conf; + mlink = &mvif->sta.deflink; + } else { + mconf = devm_kzalloc(dev->mt76.dev, sizeof(*mconf), + GFP_KERNEL); + mlink = devm_kzalloc(dev->mt76.dev, sizeof(*mlink), + GFP_KERNEL); + } + + mconfs[link_id] = mconf; + mlinks[link_id] = mlink; + mconf->link_id = link_id; + mconf->vif = mvif; + mlink->wcid.link_id = link_id; + } + + if (hweight16(mvif->valid_links) == 0) + mt792x_mac_link_bss_remove(dev, &mvif->bss_conf, + &mvif->sta.deflink); + + for_each_set_bit(link_id, &add, IEEE80211_MLD_MAX_NUM_LINKS) { + mconf = mconfs[link_id]; + mlink = mlinks[link_id]; + link_conf = mt792x_vif_to_bss_conf(vif, link_id); + + rcu_assign_pointer(mvif->link_conf[link_id], mconf); + rcu_assign_pointer(mvif->sta.link[link_id], mlink); + + err = mt7925_mac_link_bss_add(dev, link_conf, mlink); + if (err < 0) + goto free; + + if (mconf != &mvif->bss_conf) { + err = mt7925_set_mlo_roc(phy, &mvif->bss_conf, + vif->active_links); + if (err < 0) + goto free; + } + } + + mvif->valid_links = new_links; + + mt792x_mutex_release(dev); + + return 0; + +free: + for_each_set_bit(link_id, &add, IEEE80211_MLD_MAX_NUM_LINKS) { + rcu_assign_pointer(mvif->link_conf[link_id], NULL); + rcu_assign_pointer(mvif->sta.link[link_id], NULL); + + if (mconf != &mvif->bss_conf) + devm_kfree(dev->mt76.dev, mconfs[link_id]); + if (mlink != &mvif->sta.deflink) + devm_kfree(dev->mt76.dev, mlinks[link_id]); + } + + mt792x_mutex_release(dev); + + return err; +} + const struct ieee80211_ops mt7925_ops = { .tx = mt792x_tx, .start = mt7925_start, @@ -1579,6 +1708,7 @@ const struct ieee80211_ops mt7925_ops = { .mgd_complete_tx = mt7925_mgd_complete_tx, .vif_cfg_changed = mt7925_vif_cfg_changed, .link_info_changed = mt7925_link_info_changed, + .change_vif_links = mt7925_change_vif_links, }; 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 8069b27ce61c..43c20fdb747c 100644 --- a/drivers/net/wireless/mediatek/mt76/mt7925/mcu.c +++ b/drivers/net/wireless/mediatek/mt76/mt7925/mcu.c @@ -307,6 +307,9 @@ mt7925_mcu_roc_iter(void *priv, u8 *mac, struct ieee80211_vif *vif) struct mt76_vif *mvif = (struct mt76_vif *)vif->drv_priv; struct mt7925_roc_grant_tlv *grant = priv; + if (ieee80211_vif_is_mld(vif) && vif->type == NL80211_IFTYPE_STATION) + return; + if (mvif->idx != grant->bss_idx) return; @@ -1084,6 +1087,100 @@ 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_mlo_roc(struct mt792x_bss_conf *mconf, u16 sel_links, + int duration, u8 token_id) +{ + struct mt792x_vif *mvif = mconf->vif; + struct ieee80211_vif *vif = container_of((void *)mvif, + struct ieee80211_vif, drv_priv); + struct ieee80211_bss_conf *link_conf; + struct ieee80211_channel *chan; + const u8 ch_band[] = { + [NL80211_BAND_2GHZ] = 1, + [NL80211_BAND_5GHZ] = 2, + [NL80211_BAND_6GHZ] = 3, + }; + enum mt7925_roc_req type; + int center_ch, i = 0; + bool is_AG_band = false; + struct { + u8 id; + u8 bss_idx; + u16 tag; + struct mt792x_bss_conf *mconf; + struct ieee80211_channel *chan; + } links[2]; + + struct { + struct { + u8 rsv[4]; + } __packed hdr; + struct roc_acquire_tlv roc[2]; + } __packed req; + + if (!mconf || hweight16(vif->valid_links) < 2 || + hweight16(sel_links) != 2) + return -EPERM; + + for (i = 0; i < ARRAY_SIZE(links); i++) { + links[i].id = i ? __ffs(~BIT(mconf->link_id) & sel_links) : + mconf->link_id; + link_conf = mt792x_vif_to_bss_conf(vif, links[i].id); + if (WARN_ON_ONCE(!link_conf)) + return -EPERM; + + links[i].chan = link_conf->chanreq.oper.chan; + if (WARN_ON_ONCE(!links[i].chan)) + return -EPERM; + + links[i].mconf = mt792x_vif_to_link(mvif, links[i].id); + links[i].tag = links[i].id == mconf->link_id ? + UNI_ROC_ACQUIRE : UNI_ROC_SUB_LINK; + + is_AG_band |= links[i].chan->band == NL80211_BAND_2GHZ; + } + + if (vif->cfg.eml_cap & IEEE80211_EML_CAP_EMLSR_SUPP) + type = is_AG_band ? MT7925_ROC_REQ_MLSR_AG : + MT7925_ROC_REQ_MLSR_AA; + else + type = MT7925_ROC_REQ_JOIN; + + for (i = 0; i < ARRAY_SIZE(links) && i < hweight16(vif->active_links); i++) { + if (WARN_ON_ONCE(!links[i].mconf || !links[i].chan)) + continue; + + chan = links[i].chan; + center_ch = ieee80211_frequency_to_channel(chan->center_freq); + req.roc[i].len = cpu_to_le16(sizeof(struct roc_acquire_tlv)); + req.roc[i].tag = cpu_to_le16(links[i].tag); + req.roc[i].tokenid = token_id; + req.roc[i].reqtype = type; + req.roc[i].maxinterval = cpu_to_le32(duration); + req.roc[i].bss_idx = links[i].mconf->mt76.idx; + req.roc[i].control_channel = chan->hw_value; + req.roc[i].bw = CMD_CBW_20MHZ; + req.roc[i].bw_from_ap = CMD_CBW_20MHZ; + req.roc[i].center_chan = center_ch; + req.roc[i].center_chan_from_ap = center_ch; + + /* STR : 0xfe indicates BAND_ALL with enabling DBDC + * EMLSR : 0xff indicates (BAND_AUTO) without DBDC + */ + req.roc[i].dbdcband = type == MT7925_ROC_REQ_JOIN ? 0xfe : 0xff; + + if (chan->hw_value < center_ch) + req.roc[i].sco = 1; /* SCA */ + else if (chan->hw_value > center_ch) + req.roc[i].sco = 3; /* SCB */ + + req.roc[i].band = ch_band[chan->band]; + } + + return mt76_mcu_send_msg(&mvif->phy->dev->mt76, MCU_UNI_CMD(ROC), + &req, sizeof(req), false); +} + 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) @@ -1094,25 +1191,7 @@ int mt7925_mcu_set_roc(struct mt792x_phy *phy, struct mt792x_bss_conf *mconf, struct { u8 rsv[4]; } __packed hdr; - struct roc_acquire_tlv { - __le16 tag; - __le16 len; - u8 bss_idx; - u8 tokenid; - u8 control_channel; - u8 sco; - u8 band; - u8 bw; - u8 center_chan; - u8 center_chan2; - u8 bw_from_ap; - u8 center_chan_from_ap; - u8 center_chan2_from_ap; - u8 reqtype; - __le32 maxinterval; - u8 dbdcband; - u8 rsv[3]; - } __packed roc; + struct roc_acquire_tlv roc; } __packed req = { .roc = { .tag = cpu_to_le16(UNI_ROC_ACQUIRE), diff --git a/drivers/net/wireless/mediatek/mt76/mt7925/mcu.h b/drivers/net/wireless/mediatek/mt76/mt7925/mcu.h index da4e84f468d2..fefb6ab384bb 100644 --- a/drivers/net/wireless/mediatek/mt76/mt7925/mcu.h +++ b/drivers/net/wireless/mediatek/mt76/mt7925/mcu.h @@ -554,6 +554,26 @@ struct mt7925_wow_pattern_tlv { u8 rsv[7]; } __packed; +struct roc_acquire_tlv { + __le16 tag; + __le16 len; + u8 bss_idx; + u8 tokenid; + u8 control_channel; + u8 sco; + u8 band; + u8 bw; + u8 center_chan; + u8 center_chan2; + u8 bw_from_ap; + u8 center_chan_from_ap; + u8 center_chan2_from_ap; + u8 reqtype; + __le32 maxinterval; + u8 dbdcband; + u8 rsv[3]; +} __packed; + static inline enum connac3_mcu_cipher_type mt7925_mcu_get_cipher(int cipher) { diff --git a/drivers/net/wireless/mediatek/mt76/mt7925/mt7925.h b/drivers/net/wireless/mediatek/mt76/mt7925/mt7925.h index b7f8802b9cd6..dbc9e3d426e9 100644 --- a/drivers/net/wireless/mediatek/mt76/mt7925/mt7925.h +++ b/drivers/net/wireless/mediatek/mt76/mt7925/mt7925.h @@ -30,12 +30,16 @@ enum { UNI_ROC_ACQUIRE, UNI_ROC_ABORT, + UNI_ROC_SUB_LINK = 3, UNI_ROC_NUM }; enum mt7925_roc_req { MT7925_ROC_REQ_JOIN, MT7925_ROC_REQ_ROC, + MT7925_ROC_REQ_SUB_LINK, + MT7925_ROC_REQ_MLSR_AG = 10, + MT7925_ROC_REQ_MLSR_AA, MT7925_ROC_REQ_NUM }; @@ -295,6 +299,8 @@ 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_mlo_roc(struct mt792x_bss_conf *mconf, u16 sel_links, + int duration, u8 token_id); 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); diff --git a/drivers/net/wireless/mediatek/mt76/mt792x.h b/drivers/net/wireless/mediatek/mt76/mt792x.h index fe5a6c932705..9a7443a8a951 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 *vif; struct ewma_rssi rssi; struct ieee80211_tx_queue_params queue_params[IEEE80211_NUM_ACS]; + unsigned int link_id; }; struct mt792x_vif { @@ -122,6 +123,7 @@ struct mt792x_vif { struct mt792x_sta *wep_sta; struct mt792x_phy *phy; + u16 valid_links; }; struct mt792x_phy { @@ -398,6 +400,9 @@ mt792x_get_mac80211_ops(struct device *dev, int mt792x_init_wcid(struct mt792x_dev *dev); int mt792x_mcu_drv_pmctrl(struct mt792x_dev *dev); int mt792x_mcu_fw_pmctrl(struct mt792x_dev *dev); +void mt792x_mac_link_bss_remove(struct mt792x_dev *dev, + struct mt792x_bss_conf *mconf, + struct mt792x_link_sta *mlink); static inline char *mt792x_ram_name(struct mt792x_dev *dev) { diff --git a/drivers/net/wireless/mediatek/mt76/mt792x_core.c b/drivers/net/wireless/mediatek/mt76/mt792x_core.c index 813296fad0ed..62f471b5498f 100644 --- a/drivers/net/wireless/mediatek/mt76/mt792x_core.c +++ b/drivers/net/wireless/mediatek/mt76/mt792x_core.c @@ -113,14 +113,17 @@ void mt792x_stop(struct ieee80211_hw *hw, bool suspend) } EXPORT_SYMBOL_GPL(mt792x_stop); -static void mt792x_mac_link_bss_remove(struct mt792x_dev *dev, - struct ieee80211_bss_conf *link_conf, - struct mt792x_link_sta *mlink) +void mt792x_mac_link_bss_remove(struct mt792x_dev *dev, + struct mt792x_bss_conf *mconf, + struct mt792x_link_sta *mlink) { - struct mt792x_bss_conf *mconf = mt792x_link_conf_to_mconf(link_conf); + struct ieee80211_vif *vif = container_of((void *)mconf->vif, + struct ieee80211_vif, drv_priv); + struct ieee80211_bss_conf *link_conf; int idx = mlink->wcid.idx; - mt792x_mutex_acquire(dev); + link_conf = mt792x_vif_to_bss_conf(vif, mconf->link_id); + mt76_connac_free_pending_tx_skbs(&dev->pm, &mlink->wcid); mt76_connac_mcu_uni_add_dev(&dev->mphy, link_conf, &mlink->wcid, false); @@ -128,7 +131,6 @@ static void mt792x_mac_link_bss_remove(struct mt792x_dev *dev, 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(&mlink->wcid.poll_list)) @@ -137,14 +139,21 @@ static void mt792x_mac_link_bss_remove(struct mt792x_dev *dev, mt76_wcid_cleanup(&dev->mt76, &mlink->wcid); } +EXPORT_SYMBOL_GPL(mt792x_mac_link_bss_remove); 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); + struct mt792x_bss_conf *mconf; - mt792x_mac_link_bss_remove(dev, &vif->bss_conf, &mvif->sta.deflink); + mt792x_mutex_acquire(dev); + + mconf = mt792x_link_conf_to_mconf(&vif->bss_conf); + mt792x_mac_link_bss_remove(dev, mconf, &mvif->sta.deflink); + + mt792x_mutex_release(dev); } EXPORT_SYMBOL_GPL(mt792x_remove_interface); From patchwork Sat Jul 6 08:27:48 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Sean Wang X-Patchwork-Id: 13725763 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 1CAC6C3DA40 for ; Sat, 6 Jul 2024 08:28:41 +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=d5dbXS4wTlPSU2CAE2pE+Qjua78xQ9zEerZ5yBNPnYA=; b=Cj8QUm3Csf9e5bTSXTopkHRTjf WkJpHWLYY+tva5/o2rNouT6ltGfLWyjgPiKREGuw1c4pjbCgW1DJNs4dfTwYzLtUAGCItp/vULnED j3+dpTqRjPMhooXb7QdERQ+6fscrUEIYSaTJHZpFRY+NmRQ8ppU4EofUTGiACJqeY/rKNeL71Mbzu P/mAjBS6kAUYJUr7lUEt5uuejusJj8jn+32SGSzbNmIPyvFvnXKZIWjHndKyWHob0aFdvLf84fJHT 1JSmYLCM+6cE18spp1iEY/qhlc+zNhxjchVYzn9Vrf6IpaFFnjmuzrUAqtPLtKKMNuuXHJC+az40D +QJNeCtg==; Received: from localhost ([::1] helo=bombadil.infradead.org) by bombadil.infradead.org with esmtp (Exim 4.97.1 #2 (Red Hat Linux)) id 1sQ0me-0000000HXoB-2yNj; Sat, 06 Jul 2024 08:28:40 +0000 Received: from mail-oi1-f169.google.com ([209.85.167.169]) by bombadil.infradead.org with esmtps (Exim 4.97.1 #2 (Red Hat Linux)) id 1sQ0mb-0000000HXlW-2iRf for linux-mediatek@lists.infradead.org; Sat, 06 Jul 2024 08:28:38 +0000 Received: by mail-oi1-f169.google.com with SMTP id 5614622812f47-3d56754a4ceso322074b6e.1 for ; Sat, 06 Jul 2024 01:28:36 -0700 (PDT) X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1720254516; x=1720859316; 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=d5dbXS4wTlPSU2CAE2pE+Qjua78xQ9zEerZ5yBNPnYA=; b=oNOr4PsbWMqvZ04EDt45xoXiLS9vri+L9P9KU6umdeeE1nbMSRgnQOOkOI8nYGcENH rDz7ntZLUHuD9EoF2uUxhH27Pqnx8GspXayqqzYStqYtJv1r0IwFw7obVLbNs1epmHem Cv/sCBKFyoMGsns1qFRDn6/4165yzrjcAIsB0t1xmqp1SUAuyImVZX7ltHVmgTB4Jp2l 0EBYPPpUpO3KEd46eytENGwZWInQhU3BPBAeNzk6AO5yls27vSRftEQKbzUhkXmpcCUA UpEuawndqVqdmSqBbBYcOVQzyBW8AclUoom/QD7KFpOcJ/aBQl5v2o0/pD+vROHarrRp U5dw== X-Forwarded-Encrypted: i=1; AJvYcCUx6rwy79J7xXwQr0mnO0wz2xey7mLtz1WatRiYak/E/LTW4Yk65miPHQd3kJBVtROoIi5j57vqWde71rtvyEV5vubNh9FVKSPhxejx+lX4J24T X-Gm-Message-State: AOJu0YzOx08iVfMxxBJuWJvjCe/WnMtYMJYfN7WSgRqqhkxobw/mL8UH R7mqye4eErOZekxrn0C0+NS7P5r5SMu0ZOjWIZBDlJlW/U8PRm0+ X-Google-Smtp-Source: AGHT+IGHxWVmEstv1MmXEbD4rINzqvMgcEmLY/LkqNO+kP/ZyG/UuExe/x6Ahvz/MsUpchRnf0C0Cw== X-Received: by 2002:a05:6870:7251:b0:25e:14d9:da27 with SMTP id 586e51a60fabf-25e2b59dcf7mr6914926fac.0.1720254515685; Sat, 06 Jul 2024 01:28:35 -0700 (PDT) Received: from sean-ThinkPad-T450s.attlocal.net ([2600:1702:5083:7610:1e13:57ab:ecc5:1fd4]) by smtp.gmail.com with ESMTPSA id 586e51a60fabf-25e71070ba1sm10744fac.34.2024.07.06.01.28.33 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Sat, 06 Jul 2024 01:28: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 v2 08/37] wifi: mt76: mt7925: add mt7925_change_sta_links Date: Sat, 6 Jul 2024 01:27:48 -0700 Message-Id: X-Mailer: git-send-email 2.25.1 In-Reply-To: References: MIME-Version: 1.0 X-CRM114-Version: 20100106-BlameMichelson ( TRE 0.8.0 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20240706_012837_743974_DC7C32F1 X-CRM114-Status: GOOD ( 17.45 ) 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_change_sta_links to change the valid links of a station, supporting the MLO-enabled firmware. 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/main.c | 142 +++++++++++++++++- drivers/net/wireless/mediatek/mt76/mt792x.h | 7 + 2 files changed, 145 insertions(+), 4 deletions(-) diff --git a/drivers/net/wireless/mediatek/mt76/mt7925/main.c b/drivers/net/wireless/mediatek/mt76/mt7925/main.c index fcf7bd1a06bc..afb58a9206b0 100644 --- a/drivers/net/wireless/mediatek/mt76/mt7925/main.c +++ b/drivers/net/wireless/mediatek/mt76/mt7925/main.c @@ -809,16 +809,79 @@ static int mt7925_mac_link_sta_add(struct mt76_dev *mdev, mt7925_mcu_add_bss_info(&dev->phy, mconf->mt76.ctx, link_conf, link_sta, false); - ret = mt7925_mcu_sta_update(dev, link_sta, vif, true, - MT76_STA_INFO_STATE_NONE); - if (ret) - return ret; + if (ieee80211_vif_is_mld(vif) && + link_sta == mlink->pri_link) { + ret = mt7925_mcu_sta_update(dev, link_sta, vif, true, + MT76_STA_INFO_STATE_NONE); + if (ret) + return ret; + } else if (ieee80211_vif_is_mld(vif) && + link_sta != mlink->pri_link) { + ret = mt7925_mcu_sta_update(dev, mlink->pri_link, vif, + true, MT76_STA_INFO_STATE_ASSOC); + if (ret) + return ret; + + ret = mt7925_mcu_sta_update(dev, link_sta, vif, true, + MT76_STA_INFO_STATE_ASSOC); + if (ret) + return ret; + } else { + ret = mt7925_mcu_sta_update(dev, link_sta, vif, true, + MT76_STA_INFO_STATE_NONE); + if (ret) + return ret; + } mt76_connac_power_save_sched(&dev->mphy, &dev->pm); return 0; } +static int +mt7925_mac_sta_add_links(struct mt792x_dev *dev, struct ieee80211_vif *vif, + struct ieee80211_sta *sta, unsigned long new_links) +{ + struct mt792x_sta *msta = (struct mt792x_sta *)sta->drv_priv; + struct mt76_wcid *wcid; + unsigned int link_id; + int err = 0; + + for_each_set_bit(link_id, &new_links, IEEE80211_MLD_MAX_NUM_LINKS) { + struct ieee80211_link_sta *link_sta; + struct mt792x_link_sta *mlink; + + if (msta->deflink_id == IEEE80211_LINK_UNSPECIFIED) { + mlink = &msta->deflink; + msta->deflink_id = link_id; + } else { + mlink = devm_kzalloc(dev->mt76.dev, sizeof(*mlink), GFP_KERNEL); + if (!mlink) { + err = -ENOMEM; + break; + } + + wcid = &mlink->wcid; + ewma_signal_init(&wcid->rssi); + rcu_assign_pointer(dev->mt76.wcid[wcid->idx], wcid); + mt76_wcid_init(wcid); + ewma_avg_signal_init(&mlink->avg_ack_signal); + memset(mlink->airtime_ac, 0, + sizeof(msta->deflink.airtime_ac)); + } + + msta->valid_links |= BIT(link_id); + rcu_assign_pointer(msta->link[link_id], mlink); + mlink->sta = msta; + mlink->pri_link = &sta->deflink; + + link_sta = mt792x_sta_to_link_sta(vif, sta, link_id); + mt7925_mac_link_sta_add(&dev->mt76, vif, link_sta); + } + + return err; +} + int mt7925_mac_sta_add(struct mt76_dev *mdev, struct ieee80211_vif *vif, struct ieee80211_sta *sta) { @@ -915,6 +978,48 @@ static void mt7925_mac_link_sta_remove(struct mt76_dev *mdev, mt76_connac_power_save_sched(&dev->mphy, &dev->pm); } +static int +mt7925_mac_sta_remove_links(struct mt792x_dev *dev, struct ieee80211_vif *vif, + struct ieee80211_sta *sta, unsigned long old_links) +{ + struct mt792x_sta *msta = (struct mt792x_sta *)sta->drv_priv; + struct mt76_dev *mdev = &dev->mt76; + struct mt76_wcid *wcid; + unsigned int link_id; + + for_each_set_bit(link_id, &old_links, IEEE80211_MLD_MAX_NUM_LINKS) { + struct ieee80211_link_sta *link_sta; + struct mt792x_link_sta *mlink; + + link_sta = mt792x_sta_to_link_sta(vif, sta, link_id); + if (!link_sta) + continue; + + mlink = mt792x_sta_to_link(msta, link_id); + if (!mlink) + continue; + + mt7925_mac_link_sta_remove(&dev->mt76, vif, link_sta); + + wcid = &mlink->wcid; + rcu_assign_pointer(msta->link[link_id], NULL); + msta->valid_links &= ~BIT(link_id); + mlink->sta = NULL; + mlink->pri_link = NULL; + + if (link_sta != mlink->pri_link) { + mt76_wcid_cleanup(mdev, wcid); + mt76_wcid_mask_clear(mdev->wcid_mask, wcid->idx); + mt76_wcid_mask_clear(mdev->wcid_phy_mask, wcid->idx); + } + + if (msta->deflink_id == link_id) + msta->deflink_id = IEEE80211_LINK_UNSPECIFIED; + } + + return 0; +} + void mt7925_mac_sta_remove(struct mt76_dev *mdev, struct ieee80211_vif *vif, struct ieee80211_sta *sta) { @@ -1650,6 +1755,34 @@ mt7925_change_vif_links(struct ieee80211_hw *hw, struct ieee80211_vif *vif, return err; } +static int +mt7925_change_sta_links(struct ieee80211_hw *hw, struct ieee80211_vif *vif, + struct ieee80211_sta *sta, u16 old_links, u16 new_links) +{ + unsigned long add = new_links & ~old_links; + unsigned long rem = old_links & ~new_links; + struct mt792x_dev *dev = mt792x_hw_dev(hw); + int err = 0; + + if (old_links == new_links) + return 0; + + mt792x_mutex_acquire(dev); + + err = mt7925_mac_sta_remove_links(dev, vif, sta, rem); + if (err < 0) + goto out; + + err = mt7925_mac_sta_add_links(dev, vif, sta, add); + if (err < 0) + goto out; + +out: + mt792x_mutex_release(dev); + + return err; +} + const struct ieee80211_ops mt7925_ops = { .tx = mt792x_tx, .start = mt7925_start, @@ -1709,6 +1842,7 @@ const struct ieee80211_ops mt7925_ops = { .vif_cfg_changed = mt7925_vif_cfg_changed, .link_info_changed = mt7925_link_info_changed, .change_vif_links = mt7925_change_vif_links, + .change_sta_links = mt7925_change_sta_links, }; EXPORT_SYMBOL_GPL(mt7925_ops); diff --git a/drivers/net/wireless/mediatek/mt76/mt792x.h b/drivers/net/wireless/mediatek/mt76/mt792x.h index 9a7443a8a951..af9a103dc7f4 100644 --- a/drivers/net/wireless/mediatek/mt76/mt792x.h +++ b/drivers/net/wireless/mediatek/mt76/mt792x.h @@ -92,6 +92,10 @@ struct mt792x_link_sta { unsigned long last_txs; struct mt76_connac_sta_key_conf bip; + + struct mt792x_sta *sta; + + struct ieee80211_link_sta *pri_link; }; struct mt792x_sta { @@ -99,6 +103,9 @@ struct mt792x_sta { struct mt792x_link_sta __rcu *link[IEEE80211_MLD_MAX_NUM_LINKS]; struct mt792x_vif *vif; + + u16 valid_links; + u8 deflink_id; }; DECLARE_EWMA(rssi, 10, 8); From patchwork Sat Jul 6 08:27:49 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Sean Wang X-Patchwork-Id: 13725764 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 7E33EC38150 for ; Sat, 6 Jul 2024 08:28:41 +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=FUKy5cLCtr2agTep0UNplkIZGNAtrmGpQ52zbOdfdDw=; b=BYTz6P9DlH4WLt/I/ABOE7BrXB GnafHpcRd6asdWQCkiZle0+7H2eEx3Cmrn1HmiSDTi9xBOlUlYILAFHnNRQEzeq2gsTBltHe4kURH qe2UxwtgBZFlRjiVArOAcXlPXWCWCYa+dYRJItaiTMMw1ZEoFIt49jdoB7JzfXGpU7eQQKL1fNvF1 3j0Ly9Ua7fMn1XrlaLL7RwR7ReGuGgiH4a4SmppQa68nGt9dZQSzkOuvPIX+9FsjoTzNXQc542wJR TArvpzQXhgonQFE7yn+kAOnm57RjIciRUbyVoh5h+NGpl6UjuXb4Sn09u3r6b6mIML2EPObcviJNk cL38HJ4Q==; Received: from localhost ([::1] helo=bombadil.infradead.org) by bombadil.infradead.org with esmtp (Exim 4.97.1 #2 (Red Hat Linux)) id 1sQ0mf-0000000HXog-0uEA; Sat, 06 Jul 2024 08:28:41 +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 1sQ0mc-0000000HXmL-1DMU for linux-mediatek@lists.infradead.org; Sat, 06 Jul 2024 08:28:39 +0000 Received: by mail-oa1-f42.google.com with SMTP id 586e51a60fabf-25075f3f472so367180fac.2 for ; Sat, 06 Jul 2024 01:28:38 -0700 (PDT) X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1720254517; x=1720859317; 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=FUKy5cLCtr2agTep0UNplkIZGNAtrmGpQ52zbOdfdDw=; b=VduYyj10eqA01N7WqZJH2Mkw5jCSWoaRB3UDGL9ji8FVILvLZt+psVeN7dEOHrigS7 ydthNRWDGIqaRkUkC2y/sQE/Wg7rsXakh8oYCDFIuqmhc1kGWMPoHspH5yIzZwnsPv0b OKAUOoo+3rd3m2GeuxdCPdrEC7OB6UuOdIGJRQ36o4gxWfa8PJEUpBZqEmcxaXHPs8O8 u5qfbgk1wOx1VUM/Wu56gLbSBvh2P9fEdEW5GC2OKabUxNW7DojXuxiSh7OmvRTy4iZf OCofh4QPFbw2J8vpTXIQLlbipYARfESjk2z3decGpQBbbd6frm3WnYnYvVfpMy94fLgB ob/w== X-Forwarded-Encrypted: i=1; AJvYcCWk7C0U9x4VGLspOFiNSl1dqxMvtQzYH+wQkGfDtE/3w++ZgtWo0lUSqXqKr2sJXZJpzfUI+kRAo4WNUC15nwRIGC8hiN6+uoQBcaIffWJ3F2dY X-Gm-Message-State: AOJu0YyYghBA8YP+8J37kI/KzSlzX4SBjXF9MGVQRuE6cNp62lNg9BRN ZR9HbAMCWLl+VVLDvSaKmHNWWs7BvqKEXbfiw2V6sWJ4rHCrq3iR X-Google-Smtp-Source: AGHT+IH+qa3dsDD4Mgin9v93sY0n2Sl8CBjgDZghzcyc5VZ/TSITDy7VrSRro0EJ1uJdtQEiTNmmgQ== X-Received: by 2002:a05:6871:24d9:b0:254:affe:5a08 with SMTP id 586e51a60fabf-25e2ba1b287mr6406811fac.2.1720254517608; Sat, 06 Jul 2024 01:28:37 -0700 (PDT) Received: from sean-ThinkPad-T450s.attlocal.net ([2600:1702:5083:7610:1e13:57ab:ecc5:1fd4]) by smtp.gmail.com with ESMTPSA id 586e51a60fabf-25e71070ba1sm10744fac.34.2024.07.06.01.28.35 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Sat, 06 Jul 2024 01:28: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 v2 09/37] wifi: mt76: mt7925: add link handling in mt7925_mac_sta_add Date: Sat, 6 Jul 2024 01:27:49 -0700 Message-Id: <632faefe8c82cd5609c2af00aabee15ccc9616ed.1720248331.git.sean.wang@kernel.org> X-Mailer: git-send-email 2.25.1 In-Reply-To: References: MIME-Version: 1.0 X-CRM114-Version: 20100106-BlameMichelson ( TRE 0.8.0 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20240706_012838_357432_F2CE945A X-CRM114-Status: GOOD ( 12.10 ) 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 Added link handling to mt7925_mac_sta_add to support MLD devices. 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 | 12 +++++++++++- 1 file changed, 11 insertions(+), 1 deletion(-) diff --git a/drivers/net/wireless/mediatek/mt76/mt7925/main.c b/drivers/net/wireless/mediatek/mt76/mt7925/main.c index afb58a9206b0..042c9fe5a2d9 100644 --- a/drivers/net/wireless/mediatek/mt76/mt7925/main.c +++ b/drivers/net/wireless/mediatek/mt76/mt7925/main.c @@ -885,15 +885,25 @@ mt7925_mac_sta_add_links(struct mt792x_dev *dev, struct ieee80211_vif *vif, int mt7925_mac_sta_add(struct mt76_dev *mdev, struct ieee80211_vif *vif, struct ieee80211_sta *sta) { + struct mt792x_dev *dev = container_of(mdev, struct mt792x_dev, mt76); struct mt792x_vif *mvif = (struct mt792x_vif *)vif->drv_priv; struct mt792x_sta *msta = (struct mt792x_sta *)sta->drv_priv; + int err; msta->vif = mvif; if (vif->type == NL80211_IFTYPE_STATION) mvif->wep_sta = msta; - return mt7925_mac_link_sta_add(mdev, vif, &sta->deflink); + if (ieee80211_vif_is_mld(vif)) { + msta->deflink_id = IEEE80211_LINK_UNSPECIFIED; + + err = mt7925_mac_sta_add_links(dev, vif, sta, sta->valid_links); + } else { + err = mt7925_mac_link_sta_add(mdev, vif, &sta->deflink); + } + + return err; } EXPORT_SYMBOL_GPL(mt7925_mac_sta_add); From patchwork Sat Jul 6 08:27:50 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Sean Wang X-Patchwork-Id: 13725765 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 11BC8C2BD09 for ; Sat, 6 Jul 2024 08:28:43 +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=DAjVZTnUhu0dIEUEUzrUR6KmfLF6doPnT97CAweb4kU=; b=s6apxnka67J/W9jBru000b5809 SZVDlnpY3FwxQmtI55PYq2R15jNe5TeJ6hwqpcEYq0BrQzaz0w5BUAe7AHzhYwhGF04tEP8UCWwBp lVISIlZpHZF2cCogcEdJXYtgcWgd456V0lmfbM1rIfYI6ZQlhJIUWO91kH0VrtmL8cs+HmNNEZaC5 6XPm7Qq2W9FBeX6leOYkiODTt0iItNms/4pAmpR977cpRcXqIfi3tvgRUgqljG4QSccoaXecaHhCX 09bNqvw3Z+xRzkf5BRTuyV2UbDPzOVKhVUP1r6Aiem9VFliLtOZiBAFSkkQoXLwZDF5hmKBw3L/cd gEYtFM8Q==; Received: from localhost ([::1] helo=bombadil.infradead.org) by bombadil.infradead.org with esmtp (Exim 4.97.1 #2 (Red Hat Linux)) id 1sQ0mg-0000000HXpu-2lcY; Sat, 06 Jul 2024 08:28:42 +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 1sQ0me-0000000HXnZ-1JWC for linux-mediatek@lists.infradead.org; Sat, 06 Jul 2024 08:28:41 +0000 Received: by mail-oi1-f180.google.com with SMTP id 5614622812f47-3d1b8bacf67so330228b6e.2 for ; Sat, 06 Jul 2024 01:28:40 -0700 (PDT) X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1720254519; x=1720859319; 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=DAjVZTnUhu0dIEUEUzrUR6KmfLF6doPnT97CAweb4kU=; b=EluwfYJiD7NcKTGFFcUZsbf12nnclQt5hz2R9ASOML/SOAVHrL8JKet1lzEvU6iZge w8jWd8Lh0QtZuqyuPKYiOYNc0++apqMZERk3oLj1whu90XLVS5RDghQ2Rd0DSa+Mf24O xQZPEutx2c1vcYLYf/7Pj46iZIY8ucLOlLsfvtPveT6GzI9gs7/K6686R+pwdDgylxrQ UIbrTR6YzEBJuRXjHsTFFBUUlvZLGomU4eqUiI268L5JgUCYZYeLcy4GQfgfKjYwivIX R/aXMe6IsmvgSAczLW7X830dsAV6RsV3hmQKuPrDehxVuZXlqJqOxYAVbjk78NYYZFqp N8vA== X-Forwarded-Encrypted: i=1; AJvYcCWAhikp3IdmpjAmxkaSlajxuq0xq3hloQc0ngx4L34iVHYk63+Sa5ampTc9b8CcJ5D9WM6rt0a2ftluf38Gll8sM/3p6J3cIPMLwJJlgW7KbyUe X-Gm-Message-State: AOJu0YxzlpzLl2Cj8IG2nzc9b4v56sm7/ks732bV492Lllf3tdd8LvUj rdYsjsQBxgGCYubffCh4rxVv758sFCvhZfqxrsay8in5mHKOkda7 X-Google-Smtp-Source: AGHT+IHCvWG8tRPJXCVddAO6FRMJQFPuKQrMHuZK7N8spyF4+hiGS/P8jKzoibHFGJWs2r6oJ9WKOA== X-Received: by 2002:a05:6871:588c:b0:25e:2624:eb5f with SMTP id 586e51a60fabf-25e2b8cf269mr6539703fac.1.1720254519351; Sat, 06 Jul 2024 01:28:39 -0700 (PDT) Received: from sean-ThinkPad-T450s.attlocal.net ([2600:1702:5083:7610:1e13:57ab:ecc5:1fd4]) by smtp.gmail.com with ESMTPSA id 586e51a60fabf-25e71070ba1sm10744fac.34.2024.07.06.01.28.37 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Sat, 06 Jul 2024 01:28: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 v2 10/37] wifi: mt76: mt7925: add link handling in mt7925_mac_sta_remove Date: Sat, 6 Jul 2024 01:27:50 -0700 Message-Id: <20d53511fe1f64984d893f4d3ec87cb9f87d3070.1720248331.git.sean.wang@kernel.org> X-Mailer: git-send-email 2.25.1 In-Reply-To: References: MIME-Version: 1.0 X-CRM114-Version: 20100106-BlameMichelson ( TRE 0.8.0 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20240706_012840_423867_EA9EEDEE X-CRM114-Status: GOOD ( 10.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 Added link handling to mt7925_mac_sta_remove, supporting the MLO-enabled firmware. The change remains comptabile with the non-MLO mode. 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 +++++++- 1 file changed, 7 insertions(+), 1 deletion(-) diff --git a/drivers/net/wireless/mediatek/mt76/mt7925/main.c b/drivers/net/wireless/mediatek/mt76/mt7925/main.c index 042c9fe5a2d9..79b43101237c 100644 --- a/drivers/net/wireless/mediatek/mt76/mt7925/main.c +++ b/drivers/net/wireless/mediatek/mt76/mt7925/main.c @@ -1033,7 +1033,13 @@ mt7925_mac_sta_remove_links(struct mt792x_dev *dev, struct ieee80211_vif *vif, 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); + struct mt792x_dev *dev = container_of(mdev, struct mt792x_dev, mt76); + struct mt792x_sta *msta = (struct mt792x_sta *)sta->drv_priv; + unsigned long rem; + + rem = ieee80211_vif_is_mld(vif) ? msta->valid_links : BIT(0); + + mt7925_mac_sta_remove_links(dev, vif, sta, rem); if (vif->type == NL80211_IFTYPE_STATION) { struct mt792x_vif *mvif = (struct mt792x_vif *)vif->drv_priv; From patchwork Sat Jul 6 08:27:51 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Sean Wang X-Patchwork-Id: 13725766 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 87CAEC38150 for ; Sat, 6 Jul 2024 08:28: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=6EEPHIPorQ9nGaiT0HOjyRcsXyquZCZmG1NVm4BqrTE=; b=LV6xaE3ovteIfVUfTa8d5Owixv oNF4K6hreeLF7WbYj8M8vPfDZMcgwCYsymMHcmhj9IxuCrjGUkiRrgC8XDqVvQVXGvP6fmHXQup7u p0vv2O3beTnoIPWTJHArxNHQ20mrnGXhwhg27NfppSIwPpCbOp8KfL9KsbNoazHX7j6R7lfGih9KI zX280YHAdtTn/NJutkZ6Jc5ndhoHTdvStDvQv9LdGtqMT9H9H8NUdW9hYQSVprXPLwsiJXAoUTcn/ mTi617Bo0TtEA6FbV/LLRF8rRQ4+0k/xX3/7zvhQGF6zEyD7xQSJx+O6MqNF7qHXWJ4KBZLI7YYi3 Rr41HLUA==; Received: from localhost ([::1] helo=bombadil.infradead.org) by bombadil.infradead.org with esmtp (Exim 4.97.1 #2 (Red Hat Linux)) id 1sQ0mi-0000000HXqv-0beA; Sat, 06 Jul 2024 08:28:44 +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 1sQ0mf-0000000HXp2-3nuy for linux-mediatek@lists.infradead.org; Sat, 06 Jul 2024 08:28:43 +0000 Received: by mail-oi1-f171.google.com with SMTP id 5614622812f47-3d56102f134so192312b6e.1 for ; Sat, 06 Jul 2024 01:28:41 -0700 (PDT) X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1720254521; x=1720859321; 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=6EEPHIPorQ9nGaiT0HOjyRcsXyquZCZmG1NVm4BqrTE=; b=psFCUN0JwtrX05/j542IyLpZgfiSMgpHgFvdm3+1+ipnK9Pafcj219W9Ke778QL0b4 2kA95OngrDr9G6uo0JbXk12il3CA607FvSSnumpFwTMI7Cj8iQyHBzv5E4fm6X2v58PG ne+5sQkwjgYgEEUYsKkw3M57kjUgGGcE4y3AOyfdaLNlOGPsj4fTxUKigIdsXCyMOhZc p5JqHyo7c6HmzhNgS2kFY//vdiE+CfbQbMkeEYRNvDPIx3ZsEgv+9ojoUtONsLTiq2AE fZeZEsrPJv1yvOkjhQ2rni6GYnXud+bOhUvChT7sCIZz/vAcrCmVX7g7WIc3yKrKRxDf klJw== X-Forwarded-Encrypted: i=1; AJvYcCVywI069IWJykjXttPqbYoVoGqRIGtj1pC4zMPVLRbbDIiHE/vTDvGMhEJgMrGkUu+zp4b8Q3zIQYPaYQohs8zpM+oYRdK19A8GG+WI8RIm5mYR X-Gm-Message-State: AOJu0YwpGzmTgmH9EeXy/QYE85UWS0ifkxpzJFvtugDEm/wuLkejwXqV 4TInvWtjdKKBXkywAU31o1HG50Z9IawxQewb4/gmGJs/vpXpfisw X-Google-Smtp-Source: AGHT+IFGruGjSYGcF0rQjezfDS/4IewsUW1utrN/aXSU0wtpByTzFbu7DhEZCK82MXReCqpKT+41hg== X-Received: by 2002:a05:6871:5229:b0:25e:dce:491b with SMTP id 586e51a60fabf-25e2b8b79abmr6843436fac.1.1720254520934; Sat, 06 Jul 2024 01:28:40 -0700 (PDT) Received: from sean-ThinkPad-T450s.attlocal.net ([2600:1702:5083:7610:1e13:57ab:ecc5:1fd4]) by smtp.gmail.com with ESMTPSA id 586e51a60fabf-25e71070ba1sm10744fac.34.2024.07.06.01.28.39 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Sat, 06 Jul 2024 01:28:39 -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 v2 11/37] wifi: mt76: mt7925: add link handling to txwi Date: Sat, 6 Jul 2024 01:27:51 -0700 Message-Id: X-Mailer: git-send-email 2.25.1 In-Reply-To: References: MIME-Version: 1.0 X-CRM114-Version: 20100106-BlameMichelson ( TRE 0.8.0 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20240706_012841_958666_4083DE34 X-CRM114-Status: GOOD ( 12.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 add link handling to mt792x_tx and writing txwi. 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/mac.c | 12 ++++++--- .../net/wireless/mediatek/mt76/mt792x_core.c | 26 +++++++++++++++++-- 2 files changed, 33 insertions(+), 5 deletions(-) diff --git a/drivers/net/wireless/mediatek/mt76/mt7925/mac.c b/drivers/net/wireless/mediatek/mt76/mt7925/mac.c index 2be2ab914411..6f5f2130420e 100644 --- a/drivers/net/wireless/mediatek/mt76/mt7925/mac.c +++ b/drivers/net/wireless/mediatek/mt76/mt7925/mac.c @@ -740,8 +740,12 @@ mt7925_mac_write_txwi(struct mt76_dev *dev, __le32 *txwi, BSS_CHANGED_BEACON_ENABLED)); bool inband_disc = !!(changed & (BSS_CHANGED_UNSOL_BCAST_PROBE_RESP | BSS_CHANGED_FILS_DISCOVERY)); + struct mt792x_bss_conf *mconf; + + mconf = vif ? mt792x_vif_to_link((struct mt792x_vif *)vif->drv_priv, + wcid->link_id) : NULL; + mvif = mconf ? (struct mt76_vif *)&mconf->mt76 : NULL; - mvif = vif ? (struct mt76_vif *)vif->drv_priv : NULL; if (mvif) { omac_idx = mvif->omac_idx; wmm_idx = mvif->wmm_idx; @@ -802,8 +806,10 @@ mt7925_mac_write_txwi(struct mt76_dev *dev, __le32 *txwi, txwi[5] = cpu_to_le32(val); - val = MT_TXD6_DIS_MAT | MT_TXD6_DAS | - FIELD_PREP(MT_TXD6_MSDU_CNT, 1); + val = MT_TXD6_DAS | FIELD_PREP(MT_TXD6_MSDU_CNT, 1); + if (!ieee80211_vif_is_mld(vif) || + (q_idx >= MT_LMAC_ALTX0 && q_idx <= MT_LMAC_BCN0)) + val |= MT_TXD6_DIS_MAT; txwi[6] = cpu_to_le32(val); txwi[7] = 0; diff --git a/drivers/net/wireless/mediatek/mt76/mt792x_core.c b/drivers/net/wireless/mediatek/mt76/mt792x_core.c index 62f471b5498f..ae2ac146a7f7 100644 --- a/drivers/net/wireless/mediatek/mt76/mt792x_core.c +++ b/drivers/net/wireless/mediatek/mt76/mt792x_core.c @@ -59,13 +59,17 @@ void mt792x_tx(struct ieee80211_hw *hw, struct ieee80211_tx_control *control, struct ieee80211_tx_info *info = IEEE80211_SKB_CB(skb); struct ieee80211_vif *vif = info->control.vif; struct mt76_wcid *wcid = &dev->mt76.global_wcid; + u8 link_id; int qid; if (control->sta) { + struct mt792x_link_sta *mlink; struct mt792x_sta *sta; - + link_id = u32_get_bits(info->control.flags, + IEEE80211_TX_CTRL_MLO_LINK); sta = (struct mt792x_sta *)control->sta->drv_priv; - wcid = &sta->deflink.wcid; + mlink = mt792x_sta_to_link(sta, link_id); + wcid = &mlink->wcid; } if (vif && !control->sta) { @@ -75,6 +79,24 @@ void mt792x_tx(struct ieee80211_hw *hw, struct ieee80211_tx_control *control, wcid = &mvif->sta.deflink.wcid; } + if (vif && control->sta && ieee80211_vif_is_mld(vif)) { + struct ieee80211_hdr *hdr = (struct ieee80211_hdr *)skb->data; + struct ieee80211_link_sta *link_sta; + struct ieee80211_bss_conf *conf; + + link_id = wcid->link_id; + rcu_read_lock(); + conf = rcu_dereference(vif->link_conf[link_id]); + memcpy(hdr->addr2, conf->addr, ETH_ALEN); + + link_sta = rcu_dereference(control->sta->link[link_id]); + memcpy(hdr->addr1, link_sta->addr, ETH_ALEN); + + if (vif->type == NL80211_IFTYPE_STATION) + memcpy(hdr->addr3, conf->bssid, ETH_ALEN); + rcu_read_unlock(); + } + if (mt76_connac_pm_ref(mphy, &dev->pm)) { mt76_tx(mphy, control->sta, wcid, skb); mt76_connac_pm_unref(mphy, &dev->pm); From patchwork Sat Jul 6 08:27:52 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Sean Wang X-Patchwork-Id: 13725767 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 37613C38150 for ; Sat, 6 Jul 2024 08:28:47 +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=zHXCbEjzxJHt6d9yCUkSCCwiOq2AKkZ8WtSCeFmtnbg=; b=y8eddCcrVBk4Jw3qo3N2gULpS2 qwL6Qg1uz0tMEDNC3GFRINMwdR82u7V+hw3HNJvlPx3P9OjOLgxmVGSLL/0ngBMThHEwi9w6Y9C/i D8i+/0vQKx6LRXI7byH5KjXZac68dSLCWNgLML8t5d3wg2PWqYFoCGdYhNuCz+emKiqUTjFL/Qsfp tTI7RgKV0lmpwrSQNHrC6gEU8GSgRChGgu7uJ70ah+cXLmkqfVMBt9LQ4D9q1nAIZyGoowTZUUSm9 PhdDww8sUNk3Na/vjTOmQgNXXlPUwnoPOQ5m6RWsb1q8F/ZNDX+zpiM/cUEuMOeBC9MXXr03TQJaq D0UDhULg==; Received: from localhost ([::1] helo=bombadil.infradead.org) by bombadil.infradead.org with esmtp (Exim 4.97.1 #2 (Red Hat Linux)) id 1sQ0mk-0000000HXsi-2mpr; Sat, 06 Jul 2024 08:28:46 +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 1sQ0mh-0000000HXqJ-3nTo for linux-mediatek@lists.infradead.org; Sat, 06 Jul 2024 08:28:45 +0000 Received: by mail-oo1-f41.google.com with SMTP id 006d021491bc7-5c229104335so56209eaf.3 for ; Sat, 06 Jul 2024 01:28:43 -0700 (PDT) X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1720254522; x=1720859322; 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=zHXCbEjzxJHt6d9yCUkSCCwiOq2AKkZ8WtSCeFmtnbg=; b=C34pMEmiJMnuNVUaCzfryeBtCeR3kyRH3gS40rFq3DCNNTANpd2m9Tp8yxpc2el4Cf 8UHXbF0xIExBu3ALpHh2wDOJeUb5HSkqpzl9Q1C9NbMD0hAPcftN7KmbWzBk+oQyAwfp kbFm1f8KqnJQ3yX1IGD6Xd06jV/dndFIwSV5XKK+AdSmd5jKAhAwpFTQsAm3xOIFvLpI O2Ci/6Dz7pu4oZ5vDfffW7MaLzIHbdUZGfFIo6sto+Ns01d3WTDztvuYhFSUqyMQnXfh LdzOs/S43AQj61hBu0oMCopEAC+hXU/NtCyrb8DN49m+tZYBLRS/UOiy49MFHX05SdNT nZsg== X-Forwarded-Encrypted: i=1; AJvYcCUqAuEPDCauxFro5gS/Lgy6l536IuUDISmxhkDtTjbV7UJhPEksoj3PpvlOK2qU6jre7f6GlrdCkxdRbqIgcIe5n/1GG/IWoxCvuLRx1oCJx+w/ X-Gm-Message-State: AOJu0YztW32vDj1/xV0+y+AcmVVDshYZNRMlsWGGjlmzxKJJ6m93IB9i NuIul/o2eL/M2xu+fMxeUFpxrztXE9Eqivpb8fUuJ+YJdGLRr+QY X-Google-Smtp-Source: AGHT+IG62pAdB+ysm+HXJY9D5Yk5oLHWN7dIsI7MbULc7deb19Ww0URCw72J1juBmJHNDg5OQtX0Lw== X-Received: by 2002:a05:6871:24d9:b0:258:4ae8:4aec with SMTP id 586e51a60fabf-25e2bf90e00mr6558049fac.3.1720254522586; Sat, 06 Jul 2024 01:28:42 -0700 (PDT) Received: from sean-ThinkPad-T450s.attlocal.net ([2600:1702:5083:7610:1e13:57ab:ecc5:1fd4]) by smtp.gmail.com with ESMTPSA id 586e51a60fabf-25e71070ba1sm10744fac.34.2024.07.06.01.28.41 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Sat, 06 Jul 2024 01:28:41 -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 v2 12/37] wifi: mt76: mt7925: add link handling in mt7925_set_key Date: Sat, 6 Jul 2024 01:27:52 -0700 Message-Id: <164608d96ce10a40e673bc6f252189c94bc48da7.1720248331.git.sean.wang@kernel.org> X-Mailer: git-send-email 2.25.1 In-Reply-To: References: MIME-Version: 1.0 X-CRM114-Version: 20100106-BlameMichelson ( TRE 0.8.0 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20240706_012844_147915_D2DD769F 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 add link handling in mt7925_set_key to support MLO-enabled firmware. 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/main.c | 18 +++++++++++++++++- 1 file changed, 17 insertions(+), 1 deletion(-) diff --git a/drivers/net/wireless/mediatek/mt76/mt7925/main.c b/drivers/net/wireless/mediatek/mt76/mt7925/main.c index 79b43101237c..a2cf05fdfc3a 100644 --- a/drivers/net/wireless/mediatek/mt76/mt7925/main.c +++ b/drivers/net/wireless/mediatek/mt76/mt7925/main.c @@ -610,6 +610,9 @@ static int mt7925_set_key(struct ieee80211_hw *hw, enum set_key_cmd cmd, struct ieee80211_key_conf *key) { struct mt792x_dev *dev = mt792x_hw_dev(hw); + struct mt792x_vif *mvif = (struct mt792x_vif *)vif->drv_priv; + struct mt792x_sta *msta = sta ? (struct mt792x_sta *)sta->drv_priv : + &mvif->sta; int err; /* The hardware does not support per-STA RX GTK, fallback @@ -624,7 +627,20 @@ static int mt7925_set_key(struct ieee80211_hw *hw, enum set_key_cmd cmd, mt792x_mutex_acquire(dev); - err = mt7925_set_link_key(hw, cmd, vif, sta, key, vif->bss_conf.link_id); + if (ieee80211_vif_is_mld(vif)) { + unsigned int link_id; + unsigned long add; + + add = key->link_id != -1 ? BIT(key->link_id) : msta->valid_links; + + for_each_set_bit(link_id, &add, IEEE80211_MLD_MAX_NUM_LINKS) { + err = mt7925_set_link_key(hw, cmd, vif, sta, key, link_id); + if (err < 0) + break; + } + } else { + err = mt7925_set_link_key(hw, cmd, vif, sta, key, vif->bss_conf.link_id); + } mt792x_mutex_release(dev); From patchwork Sat Jul 6 08:27:53 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Sean Wang X-Patchwork-Id: 13725768 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 1C15EC2BD09 for ; Sat, 6 Jul 2024 08:28: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=AtLrHZs5XXJ5T1iBD9wtN1TtAgoimSM4Q0D5cGIf2QM=; b=Z3Ua3SLd9u5+DCgvWNdgU9zBAo lURkhvqW1PMXRlRO/Iiiv3Xk+7PsQI40Kip45BDp8aF4643CH4gcmegHFa2vL26x2fJ8JLdiUXAxr vM5ZdDqupU5ktguH9zuaZMTFfqbhCRl5kop36d/FTIAY6WL3ocvSLkeGb1pYTzaH2SwjJPhePYcbQ udtAH6ibHOZ3vQp1J7JtjAK2J8GyPncO/lyF4IB0OnEOV2w3yidI3T0BBFD8knddUa9jAA0AxrOHB K2hyo6KaLI7gnW/4cXeWj6IsIva+a/pLUovaIYkdKHQtXBuU78pynkXd/G5xguXuQcu3F+IlnzYXO s1qL2xyQ==; Received: from localhost ([::1] helo=bombadil.infradead.org) by bombadil.infradead.org with esmtp (Exim 4.97.1 #2 (Red Hat Linux)) id 1sQ0mn-0000000HXug-31n9; Sat, 06 Jul 2024 08:28:49 +0000 Received: from mail-oa1-f46.google.com ([209.85.160.46]) by bombadil.infradead.org with esmtps (Exim 4.97.1 #2 (Red Hat Linux)) id 1sQ0mj-0000000HXrj-1O1M for linux-mediatek@lists.infradead.org; Sat, 06 Jul 2024 08:28:46 +0000 Received: by mail-oa1-f46.google.com with SMTP id 586e51a60fabf-254925e6472so364167fac.0 for ; Sat, 06 Jul 2024 01:28:45 -0700 (PDT) X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1720254524; x=1720859324; 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=AtLrHZs5XXJ5T1iBD9wtN1TtAgoimSM4Q0D5cGIf2QM=; b=kRaD4QPmztIhX4T4IVDV8s24XIe21hOxlCykiLnW12HK0cEtM1LARQbJgbesD85ybO LBHCOf1YVZAuBjpgA0JILSZzBPoHZLzXZOj0VHcX9BghGuZOrwUWnYnMsZmA1pkbEY7x RlUG/fwaB+XLnnZbvTVbtF46f/MN3EsvUpTFV5LVydAZrpsA1JPdQb0MqBuvf52bhIc0 nsa2O/OCidHP4eQxkHAsgYFmsb4/8WrLGJWU14lykAzUY5orV5dH/mV6MApR7vITnuxk dOHbGaifyFvx2kE8VTr6Tf8kvMqA2RIb65EFkqfHUECZdnuhH2q/ulSOzau+UD7ijBfW dYvg== X-Forwarded-Encrypted: i=1; AJvYcCWDpNKX7fL/6so+ticKnKI/MSPxeIHPiRt0fcKNhI4yjjgKjzXeCRzQCP3JrUp2t8XISXDJBZDOq8MNm9FIWkp3lTn4LOXfh1qKS2Lnt+b4XYT5 X-Gm-Message-State: AOJu0Yz6/2NIrLPMkk92peJijUaCvpGtpbK9iptE5dI60cYDQ33Sj8Sc F4ogSS//CqWdhTp5ApZDfh4vStXcACrYd5Uob1dqpXYpjVBruHlX X-Google-Smtp-Source: AGHT+IEXHNQhlSzAY8Tlzy3RmC8HaFoPtI9qwVs2TRhuyiPg31fh7q5+Usbvf2qGax22+0W9aOY6zw== X-Received: by 2002:a05:6871:24d9:b0:254:affe:5a08 with SMTP id 586e51a60fabf-25e2ba1b287mr6406885fac.2.1720254524275; Sat, 06 Jul 2024 01:28:44 -0700 (PDT) Received: from sean-ThinkPad-T450s.attlocal.net ([2600:1702:5083:7610:1e13:57ab:ecc5:1fd4]) by smtp.gmail.com with ESMTPSA id 586e51a60fabf-25e71070ba1sm10744fac.34.2024.07.06.01.28.42 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Sat, 06 Jul 2024 01:28:43 -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 v2 13/37] wifi: mt76: mt7925: add link handling to mt7925_change_chanctx Date: Sat, 6 Jul 2024 01:27:53 -0700 Message-Id: <49f2a2f8230979a4e123bc1dab70a8496875cc6c.1720248331.git.sean.wang@kernel.org> X-Mailer: git-send-email 2.25.1 In-Reply-To: References: MIME-Version: 1.0 X-CRM114-Version: 20100106-BlameMichelson ( TRE 0.8.0 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20240706_012845_405726_C513DE44 X-CRM114-Status: GOOD ( 11.70 ) 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 link handling to mt7925_change_chanctx 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/main.c | 22 +++++++++++++++++-- 1 file changed, 20 insertions(+), 2 deletions(-) diff --git a/drivers/net/wireless/mediatek/mt76/mt7925/main.c b/drivers/net/wireless/mediatek/mt76/mt7925/main.c index a2cf05fdfc3a..957e6bcaf9c1 100644 --- a/drivers/net/wireless/mediatek/mt76/mt7925/main.c +++ b/drivers/net/wireless/mediatek/mt76/mt7925/main.c @@ -1571,13 +1571,15 @@ mt7925_change_chanctx(struct ieee80211_hw *hw, { struct mt792x_chanctx *mctx = (struct mt792x_chanctx *)ctx->drv_priv; struct mt792x_phy *phy = mt792x_hw_phy(hw); + struct mt792x_bss_conf *mconf; struct ieee80211_vif *vif; struct mt792x_vif *mvif; if (!mctx->bss_conf) return; - mvif = container_of(mctx->bss_conf, struct mt792x_vif, bss_conf); + mconf = mctx->bss_conf; + mvif = mconf->vif; vif = container_of((void *)mvif, struct ieee80211_vif, drv_priv); mt792x_mutex_acquire(phy->dev); @@ -1585,8 +1587,24 @@ mt7925_change_chanctx(struct ieee80211_hw *hw, 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); + if (ieee80211_vif_is_mld(vif)) { + unsigned long valid = mvif->valid_links; + u8 i; + + for_each_set_bit(i, &valid, IEEE80211_MLD_MAX_NUM_LINKS) { + mconf = mt792x_vif_to_link(mvif, i); + if (mconf && mconf->mt76.ctx == ctx) + break; + } + + } else { + mconf = &mvif->bss_conf; + } + + if (mconf) + mt7925_mcu_set_chctx(mvif->phy->mt76, &mconf->mt76, ctx); } + mt792x_mutex_release(phy->dev); } From patchwork Sat Jul 6 08:27:54 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Sean Wang X-Patchwork-Id: 13725769 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 880D7C3DA40 for ; Sat, 6 Jul 2024 08:28: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=ZfyFCkyFCvgSR1kwXfpvvrzkz9hGipNgrPtLfbnBC/k=; b=I84g80zF9G5ac/G6d5AkrbKeD/ C6cvPUXbUehXkvn9KpMTs+tfPw5c8HxwEqXfO00U3ttg6qm3we65NkEnCQx6iQOwAG7EVOtdA0w/T uHKXCgiu6Ow1CvRWfnnMpAFQzhmSfffLRSrsPyNP+fZvc3+dnk3MrT4ddN5yVU/gKTjr7MNfOjmgS mSbv0wnolpLKcGWnW8/6d7ej6AwVH+5X+MiXDxQg5Fffiozm9onf8EUzA5kyxFj57eSLTLrq/AE/0 jRgGKUdm6cd433gWIYh52zueFlSSUd+lmi7j5QbUxLJhkW8HWAzUlWAJQZB6TAi0vxLMRfPlcUGp9 yh9vzf1A==; Received: from localhost ([::1] helo=bombadil.infradead.org) by bombadil.infradead.org with esmtp (Exim 4.97.1 #2 (Red Hat Linux)) id 1sQ0mp-0000000HXvk-0fko; Sat, 06 Jul 2024 08:28:51 +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 1sQ0mk-0000000HXsY-3Qxv for linux-mediatek@lists.infradead.org; Sat, 06 Jul 2024 08:28:49 +0000 Received: by mail-oa1-f43.google.com with SMTP id 586e51a60fabf-24c5ec50da1so284883fac.3 for ; Sat, 06 Jul 2024 01:28:46 -0700 (PDT) X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1720254526; x=1720859326; 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=ZfyFCkyFCvgSR1kwXfpvvrzkz9hGipNgrPtLfbnBC/k=; b=EBUfK7lDskKWZPfiL+hn68hl9Jtz/MI4oqm6J+Dq9/sfMRAh8Nf3ntzW1qICLae3yy m2ft3veV2Jvup1LWuiNLeI9W/EvClZ9MYHO898v4wAXuETouioPFWnuWCUgU8cVMC6uE kANY7c3ueKgeVw2548cXgle3V2JsYscu1r8N4YIljRTujPRyTP2SOadc84obWJtduZrp SGzoP8xz0XwMdNOVMVmzH7HL+tO2oDMyZm5fQSadY6oP4rp1cFoKjupvbH7ptOIPQqGI DrNg/cjjl8MuwqXj4ZTSXhOBBRzX+DjPLtf2M5dDIw9D1T0ns8ux9np0xvOZPYRyp2sq PooQ== X-Forwarded-Encrypted: i=1; AJvYcCU7ROsMRBxJshaBrx96Pas8Uga+pnBZ70QPkx3bpAse8W1aYSao2+ksqPEux4jez++BlTWibha4rSiccUOZenoHOvL0XvEbSCc0hFSqMqyJMAiF X-Gm-Message-State: AOJu0YxVkSB7vvrrOCPZ/oAtZENGbhMRYoiRXIgF3haGsUUfKjbt4GFx F0bZkiKaROftn2FHc84uAW5FDi+ilCV883RqDo5CjJVVFYXszah1 X-Google-Smtp-Source: AGHT+IGjXRH5F+dHX9ZUzRhbiIaHxUXVqCoRgBDTO6Urq55bjKtulj+29cunN0oxXn0STaCgcU/MpA== X-Received: by 2002:a05:6871:24d7:b0:24f:e599:9168 with SMTP id 586e51a60fabf-25e2b8d0139mr7038119fac.1.1720254526030; Sat, 06 Jul 2024 01:28:46 -0700 (PDT) Received: from sean-ThinkPad-T450s.attlocal.net ([2600:1702:5083:7610:1e13:57ab:ecc5:1fd4]) by smtp.gmail.com with ESMTPSA id 586e51a60fabf-25e71070ba1sm10744fac.34.2024.07.06.01.28.44 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Sat, 06 Jul 2024 01:28: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 v2 14/37] wifi: mt76: mt7925: add link handling in the BSS_CHANGED_PS handler Date: Sat, 6 Jul 2024 01:27:54 -0700 Message-Id: <542ca29261af0cac007d2cb821ed36284d51c679.1720248331.git.sean.wang@kernel.org> X-Mailer: git-send-email 2.25.1 In-Reply-To: References: MIME-Version: 1.0 X-CRM114-Version: 20100106-BlameMichelson ( TRE 0.8.0 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20240706_012846_910660_B7195927 X-CRM114-Status: GOOD ( 10.98 ) 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 Added link handling in the BSS_CHANGED_PS handler. 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 | 14 ++++++++++++-- 1 file changed, 12 insertions(+), 2 deletions(-) diff --git a/drivers/net/wireless/mediatek/mt76/mt7925/main.c b/drivers/net/wireless/mediatek/mt76/mt7925/main.c index 957e6bcaf9c1..938909ab8d1c 100644 --- a/drivers/net/wireless/mediatek/mt76/mt7925/main.c +++ b/drivers/net/wireless/mediatek/mt76/mt7925/main.c @@ -1637,6 +1637,7 @@ static void mt7925_vif_cfg_changed(struct ieee80211_hw *hw, struct ieee80211_vif *vif, u64 changed) { + struct mt792x_vif *mvif = (struct mt792x_vif *)vif->drv_priv; struct mt792x_dev *dev = mt792x_hw_dev(hw); mt792x_mutex_acquire(dev); @@ -1653,8 +1654,17 @@ static void mt7925_vif_cfg_changed(struct ieee80211_hw *hw, mt7925_mcu_update_arp_filter(&dev->mt76, &mvif->bss_conf.mt76); } - if (changed & BSS_CHANGED_PS) - mt7925_mcu_uni_bss_ps(dev, &vif->bss_conf); + if (changed & BSS_CHANGED_PS) { + unsigned long valid = ieee80211_vif_is_mld(vif) ? + mvif->valid_links : BIT(0); + struct ieee80211_bss_conf *bss_conf; + int i; + + for_each_set_bit(i, &valid, IEEE80211_MLD_MAX_NUM_LINKS) { + bss_conf = mt792x_vif_to_bss_conf(vif, i); + mt7925_mcu_uni_bss_ps(dev, bss_conf); + } + } mt792x_mutex_release(dev); } From patchwork Sat Jul 6 08:27: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: 13725770 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 0EC34C38150 for ; Sat, 6 Jul 2024 08:28:52 +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=OxHeMh4wlCaNsBAEaEhqWJP5pfcIdTUVwY854lC9UJQ=; b=VWBWPYpFquJWqcyvMMU/Wga1F9 S3f3xetR43IhmmfZiDTz1sDv/Z+trlLCthYcBUiWACa8b8XIwNcOZAhm5bDdjgsr0DruZn11Q17xI 2glApIkI+a7EYJUHFmX4UfSzcFJtwnxoTQPGxZxtOwBnLh88j3C1jUp3nflselpH/evmxo5nV1Fkr KsycM8Tv0V9/1CjXwzaz5SKGo+M62XDOPFKeELjz91QqOSy33c9Vl/O+cS7vVbU2ptNjxRSKvuR1X k2U7nl/RI+ttgLwddkmJ4EIjqBRewCebOjq1L+4bqVL/pfIX6IIk8EWwphAeADJVoi2QZD4rkyKEB zTp6mO7w==; Received: from localhost ([::1] helo=bombadil.infradead.org) by bombadil.infradead.org with esmtp (Exim 4.97.1 #2 (Red Hat Linux)) id 1sQ0mp-0000000HXw7-2HLg; Sat, 06 Jul 2024 08:28:51 +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 1sQ0mm-0000000HXth-3yUN for linux-mediatek@lists.infradead.org; Sat, 06 Jul 2024 08:28:50 +0000 Received: by mail-oo1-f48.google.com with SMTP id 006d021491bc7-5c223f2f97bso42500eaf.0 for ; Sat, 06 Jul 2024 01:28:48 -0700 (PDT) X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1720254528; x=1720859328; 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=OxHeMh4wlCaNsBAEaEhqWJP5pfcIdTUVwY854lC9UJQ=; b=NifV1E0QxzRAmOAqkXzShbBVw15jLyhZA3l1vndhTZ9W+8UWk++CYPFplF7tfpylqM 7CgJ8Y9Uy1ttT10T/+X1GNbaeBUbjMxI753w6b6UVGAZkOYWaMKWYWQDeQGiAvHNpHRg yEMKDa8by6XJ6DjDmFVMvClRN8aXjX6YMEuKbek5Yz9z5rjParT2yKGxGAluELwkippg N4iZjXDuJfwjBis+UDcyI7dv5VIvFG+B0mXs2GkwSIy9BYgPFgkgHuwWVtA2WxAvyrEf hnS/5dYL3Z+ToJCzHAPw2T7I6LmOribIEgtGLK+8+L2Mmz07Roh5DVT4g1VpGs9Fg3W/ 2ZdA== X-Forwarded-Encrypted: i=1; AJvYcCW9qsBVyCXNNKpPZysXwaYpEILMAU/lQUv+y268pTd+9dSxYSDnK8mjl6EjzgDo3NNmILm5DhCveXnPT5AtN4PQBY9zhmAP1yPwVmMpQGYtB/GY X-Gm-Message-State: AOJu0YxDdMnfynC+g4+xCr6vegCG2fmcbbZCmdEO259dZyYdtt2V9WOC gcigCiDMvFGGO/L8itCeHZxWDnnvbptQy+1mOrEPJ7QmaR1yNY/z X-Google-Smtp-Source: AGHT+IE97gP4q0ZkWnwJvWnniBVGYpKbvU3SGVfqlg+6uBeR4gYRI0sjUfKWO+BbR90ANYfMGNFWyg== X-Received: by 2002:a05:6871:5229:b0:25e:dce:491b with SMTP id 586e51a60fabf-25e2b8b79abmr6843594fac.1.1720254527757; Sat, 06 Jul 2024 01:28:47 -0700 (PDT) Received: from sean-ThinkPad-T450s.attlocal.net ([2600:1702:5083:7610:1e13:57ab:ecc5:1fd4]) by smtp.gmail.com with ESMTPSA id 586e51a60fabf-25e71070ba1sm10744fac.34.2024.07.06.01.28.46 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Sat, 06 Jul 2024 01:28: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 v2 15/37] wifi: mt76: mt7925: add link handling in mt7925_mcu_set_beacon_filter Date: Sat, 6 Jul 2024 01:27:55 -0700 Message-Id: X-Mailer: git-send-email 2.25.1 In-Reply-To: References: MIME-Version: 1.0 X-CRM114-Version: 20100106-BlameMichelson ( TRE 0.8.0 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20240706_012849_064023_FA0BA722 X-CRM114-Status: GOOD ( 10.65 ) 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 link handling in mt7925_mcu_set_beacon_filter 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 | 23 ++++++++++++++----- 1 file changed, 17 insertions(+), 6 deletions(-) diff --git a/drivers/net/wireless/mediatek/mt76/mt7925/mcu.c b/drivers/net/wireless/mediatek/mt76/mt7925/mcu.c index 43c20fdb747c..9a4dfe53da17 100644 --- a/drivers/net/wireless/mediatek/mt76/mt7925/mcu.c +++ b/drivers/net/wireless/mediatek/mt76/mt7925/mcu.c @@ -1818,21 +1818,32 @@ int mt7925_mcu_set_beacon_filter(struct mt792x_dev *dev, { #define MT7925_FIF_BIT_CLR BIT(1) #define MT7925_FIF_BIT_SET BIT(0) + struct mt792x_vif *mvif = (struct mt792x_vif *)vif->drv_priv; + unsigned long valid = ieee80211_vif_is_mld(vif) ? + mvif->valid_links : BIT(0); + struct ieee80211_bss_conf *bss_conf; int err = 0; + int i; if (enable) { - err = mt7925_mcu_uni_bss_bcnft(dev, &vif->bss_conf, true); - if (err) - return err; + for_each_set_bit(i, &valid, IEEE80211_MLD_MAX_NUM_LINKS) { + bss_conf = mt792x_vif_to_bss_conf(vif, i); + err = mt7925_mcu_uni_bss_bcnft(dev, bss_conf, true); + if (err < 0) + return err; + } return mt7925_mcu_set_rxfilter(dev, 0, MT7925_FIF_BIT_SET, MT_WF_RFCR_DROP_OTHER_BEACON); } - err = mt7925_mcu_set_bss_pm(dev, &vif->bss_conf, false); - if (err) - return err; + for_each_set_bit(i, &valid, IEEE80211_MLD_MAX_NUM_LINKS) { + bss_conf = mt792x_vif_to_bss_conf(vif, i); + err = mt7925_mcu_set_bss_pm(dev, bss_conf, false); + if (err) + return err; + } return mt7925_mcu_set_rxfilter(dev, 0, MT7925_FIF_BIT_CLR, From patchwork Sat Jul 6 08:27: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: 13725771 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 D149CC3DA40 for ; Sat, 6 Jul 2024 08:28:54 +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=FI2TnPxCSt+IPX/3LOylsuRUtyZmNywOOwGJZo4oaeY=; b=iPIEFiyTL8JNukiuJFhHgPtFTw aOUdzKIGdxzOT1tX0uCjZNnURiBslDbW02TC1eOHyWfkUeAgSxdLP7SMVyIzCmTdiGgX9EWCJT5O4 jFAP1VaMYFNltYr2GZsoMPPr284G+OCiQd+Gtu2cllE4J3XQVz8wQvYlZeXcExiSx6NsNRGdXqfUE uycVMhcQ1bvkAUfntxNPJiVWIkgHHGeP5KZTJJwJ3v4gpmLayh4S2jwWxG+CR8xSWbhF7XhmCJfMg mbL7S9xVFovqplytpQNXmas8XDxkXQCujyyiF+lvrHi9zahjiJmnJL1Ytq2dh2LcJSAU1PCJJxqKL rJgQL7zw==; Received: from localhost ([::1] helo=bombadil.infradead.org) by bombadil.infradead.org with esmtp (Exim 4.97.1 #2 (Red Hat Linux)) id 1sQ0ms-0000000HXxp-1TqZ; Sat, 06 Jul 2024 08:28:54 +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 1sQ0mo-0000000HXuy-1Jqv for linux-mediatek@lists.infradead.org; Sat, 06 Jul 2024 08:28:52 +0000 Received: by mail-oa1-f42.google.com with SMTP id 586e51a60fabf-25e23e0492dso341277fac.3 for ; Sat, 06 Jul 2024 01:28:50 -0700 (PDT) X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1720254529; x=1720859329; 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=FI2TnPxCSt+IPX/3LOylsuRUtyZmNywOOwGJZo4oaeY=; b=JGO8aPaJS2E+kiggLFBHhs0mH1XAN/QJN4WoL3LRSoC/BkujvoAR0UVkmf1uZKB1I3 Hp7TPilXGgKK/am/H1wv8OiT6NGkWbgvpsro9pMM+H+UL7UQ3Rft63QG8hH7iR5iIIII m3SuUthIfUpU2Nnz1tz28fM8Wa0UoYK5kLsBxDdAiU52NDp/GmPSrdigliNgFiAubNAl NBnRMgnWmxPsuK7D75y71ULwz42OaOu0ZjMU0OcNRYjkSpgHeoI49vT8m32lb1Hy4Md9 vpFVQ+wFnaDfe4L7vWg/tAlMZGMh6dGCQtpCI5XQMDhfe6qRWy33PIDfQ+qbW1H51/Gt cPvg== X-Forwarded-Encrypted: i=1; AJvYcCWtNqfiWboeVTyNhCunr6LRrRSChdDby5SZweBtfPScwk+cm/hYgmGB9DKo2HoXgZk3Rt2HgRAz/z9T9D7++VWpywpd5Ve7mTovpl0ly1YpJfnv X-Gm-Message-State: AOJu0YzKjAeBDTeTXJPdHC3nttJFY3RDJv21L1Zzm26IVgw0/2KjMFVc 8mr3S2AMMCvyE4kzvrAUU1Cexhp48Gmz5lZakxB2qvzvtJXLy1fz X-Google-Smtp-Source: AGHT+IEXpb8lA49aI/oP6Yv6S25n3obCNnYl2lfER1bVAUm/n7WmA4bCU2b5oIPzgS/Et3O0HlKWbw== X-Received: by 2002:a05:6871:798e:b0:25e:15e1:35c6 with SMTP id 586e51a60fabf-25e2b5af44dmr6351702fac.0.1720254529375; Sat, 06 Jul 2024 01:28:49 -0700 (PDT) Received: from sean-ThinkPad-T450s.attlocal.net ([2600:1702:5083:7610:1e13:57ab:ecc5:1fd4]) by smtp.gmail.com with ESMTPSA id 586e51a60fabf-25e71070ba1sm10744fac.34.2024.07.06.01.28.47 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Sat, 06 Jul 2024 01:28: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 v2 16/37] wifi: mt76: mt7925: add link handling in mt7925_txwi_free Date: Sat, 6 Jul 2024 01:27:56 -0700 Message-Id: X-Mailer: git-send-email 2.25.1 In-Reply-To: References: MIME-Version: 1.0 X-CRM114-Version: 20100106-BlameMichelson ( TRE 0.8.0 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20240706_012850_423735_B2677FFC X-CRM114-Status: GOOD ( 16.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 add link handling in mt7925_txwi_free. MT7996 should have the similar the logic, we try to copy from there to ensure consistency between both. 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/mac.c | 54 +++++++++++++------ .../wireless/mediatek/mt76/mt7925/mt7925.h | 2 +- 2 files changed, 40 insertions(+), 16 deletions(-) diff --git a/drivers/net/wireless/mediatek/mt76/mt7925/mac.c b/drivers/net/wireless/mediatek/mt76/mt7925/mac.c index 6f5f2130420e..0cb9031e9fdd 100644 --- a/drivers/net/wireless/mediatek/mt76/mt7925/mac.c +++ b/drivers/net/wireless/mediatek/mt76/mt7925/mac.c @@ -839,27 +839,53 @@ mt7925_mac_write_txwi(struct mt76_dev *dev, __le32 *txwi, } EXPORT_SYMBOL_GPL(mt7925_mac_write_txwi); -static void mt7925_tx_check_aggr(struct ieee80211_sta *sta, __le32 *txwi) +static void mt7925_tx_check_aggr(struct ieee80211_sta *sta, struct sk_buff *skb, + struct mt76_wcid *wcid) { + struct ieee80211_tx_info *info = IEEE80211_SKB_CB(skb); + struct ieee80211_link_sta *link_sta; + struct mt792x_link_sta *mlink; struct mt792x_sta *msta; + bool is_8023; u16 fc, tid; - u32 val; - if (!sta || !(sta->deflink.ht_cap.ht_supported || sta->deflink.he_cap.has_he)) + link_sta = rcu_dereference(sta->link[wcid->link_id]); + if (!link_sta) return; - tid = le32_get_bits(txwi[1], MT_TXD1_TID); - if (tid >= 6) /* skip VO queue */ + if (!sta || !(link_sta->ht_cap.ht_supported || link_sta->he_cap.has_he)) return; - val = le32_to_cpu(txwi[2]); - fc = FIELD_GET(MT_TXD2_FRAME_TYPE, val) << 2 | - FIELD_GET(MT_TXD2_SUB_TYPE, val) << 4; + tid = skb->priority & IEEE80211_QOS_CTL_TID_MASK; + is_8023 = info->flags & IEEE80211_TX_CTL_HW_80211_ENCAP; + + if (is_8023) { + fc = IEEE80211_FTYPE_DATA | + (sta->wme ? IEEE80211_STYPE_QOS_DATA : + IEEE80211_STYPE_DATA); + } else { + /* No need to get precise TID for Action/Management Frame, + * since it will not meet the following Frame Control + * condition anyway. + */ + + struct ieee80211_hdr *hdr = (struct ieee80211_hdr *)skb->data; + + fc = le16_to_cpu(hdr->frame_control) & + (IEEE80211_FCTL_FTYPE | IEEE80211_FCTL_STYPE); + } + if (unlikely(fc != (IEEE80211_FTYPE_DATA | IEEE80211_STYPE_QOS_DATA))) return; msta = (struct mt792x_sta *)sta->drv_priv; - if (!test_and_set_bit(tid, &msta->deflink.wcid.ampdu_state)) + + if (sta->mlo && msta->deflink_id != IEEE80211_LINK_UNSPECIFIED) + mlink = rcu_dereference(msta->link[msta->deflink_id]); + else + mlink = &msta->deflink; + + if (!test_and_set_bit(tid, &mlink->wcid.ampdu_state)) ieee80211_start_tx_ba_session(sta, tid, 0); } @@ -1039,7 +1065,7 @@ void mt7925_mac_add_txs(struct mt792x_dev *dev, void *data) } void mt7925_txwi_free(struct mt792x_dev *dev, struct mt76_txwi_cache *t, - struct ieee80211_sta *sta, bool clear_status, + struct ieee80211_sta *sta, struct mt76_wcid *wcid, struct list_head *free_list) { struct mt76_dev *mdev = &dev->mt76; @@ -1052,10 +1078,8 @@ void mt7925_txwi_free(struct mt792x_dev *dev, struct mt76_txwi_cache *t, txwi = (__le32 *)mt76_get_txwi_ptr(mdev, t); if (sta) { - struct mt76_wcid *wcid = (struct mt76_wcid *)sta->drv_priv; - if (likely(t->skb->protocol != cpu_to_be16(ETH_P_PAE))) - mt7925_tx_check_aggr(sta, txwi); + mt7925_tx_check_aggr(sta, t->skb, wcid); wcid_idx = wcid->idx; } else { @@ -1140,7 +1164,7 @@ mt7925_mac_tx_free(struct mt792x_dev *dev, void *data, int len) if (!txwi) continue; - mt7925_txwi_free(dev, txwi, sta, 0, &free_list); + mt7925_txwi_free(dev, txwi, sta, wcid, &free_list); } } @@ -1426,7 +1450,7 @@ void mt7925_usb_sdio_tx_complete_skb(struct mt76_dev *mdev, sta = wcid_to_sta(wcid); if (sta && likely(e->skb->protocol != cpu_to_be16(ETH_P_PAE))) - mt7925_tx_check_aggr(sta, txwi); + mt76_connac2_tx_check_aggr(sta, txwi); skb_pull(e->skb, headroom); mt76_tx_complete_skb(mdev, e->wcid, e->skb); diff --git a/drivers/net/wireless/mediatek/mt76/mt7925/mt7925.h b/drivers/net/wireless/mediatek/mt76/mt7925/mt7925.h index dbc9e3d426e9..bcf8541fa31d 100644 --- a/drivers/net/wireless/mediatek/mt76/mt7925/mt7925.h +++ b/drivers/net/wireless/mediatek/mt76/mt7925/mt7925.h @@ -260,7 +260,7 @@ void mt7925_mac_write_txwi(struct mt76_dev *dev, __le32 *txwi, struct ieee80211_key_conf *key, int pid, enum mt76_txq_id qid, u32 changed); void mt7925_txwi_free(struct mt792x_dev *dev, struct mt76_txwi_cache *t, - struct ieee80211_sta *sta, bool clear_status, + struct ieee80211_sta *sta, struct mt76_wcid *wcid, struct list_head *free_list); int mt7925_mcu_parse_response(struct mt76_dev *mdev, int cmd, struct sk_buff *skb, int seq); From patchwork Sat Jul 6 08:27: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: 13725772 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 AD6A8C2BD09 for ; Sat, 6 Jul 2024 08:28:56 +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=fF7dbw9hjOaq/kQruIH9Yh9VX6vhhlm/7O8Px4OouLw=; b=k45Z7Mh5HPwEeDBGQt/vdaldbL 6xoonWcIAKf6d0WTNnhtytqQD4Rsaic9IjdwiefpeOfo4wUojqIXCvvIFMz3nH/wEYVtHD9GOFRLZ avjv7N8ZvU+r0GTHNLerQ6ia0uSq4EXF9U3yySRJ/qB3V6Y//xPk2e08Cl2I5Bq2a7KWSzXHTJlBf C0mcfOXhexG3fdkJItWTZuWtS4SZwjeNGSaP5Ob6Q3MD/+5/YCITpfnMpnGSrORmULp33AIfjessb xP0q0SaD02P117ZnXUEosgwH45c9XR54iTYEj1NJHTS97JEqOmTGfAFwPUrPk0XtccZBgoZgRJ7yZ P2SDAEmg==; Received: from localhost ([::1] helo=bombadil.infradead.org) by bombadil.infradead.org with esmtp (Exim 4.97.1 #2 (Red Hat Linux)) id 1sQ0mu-0000000HXzP-1MjO; Sat, 06 Jul 2024 08:28:56 +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 1sQ0mq-0000000HXwI-1E9H for linux-mediatek@lists.infradead.org; Sat, 06 Jul 2024 08:28:54 +0000 Received: by mail-oa1-f49.google.com with SMTP id 586e51a60fabf-25e14bf05e5so95397fac.1 for ; Sat, 06 Jul 2024 01:28:52 -0700 (PDT) X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1720254531; x=1720859331; 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=fF7dbw9hjOaq/kQruIH9Yh9VX6vhhlm/7O8Px4OouLw=; b=hoGURgvufYzTw7mHp+g37k7Mcos+wy/UdUHrgiI0iVIUwI5KNRy5RNlfGo5LnwlwX9 EJRjjtkTrUfNM6DHsnT44YbQDZw73O7FyPrUrFEYuQVVABsPPt7XNivn0gKJ2g58obpr H1McL3K247tHJmSEYmtJl9Vy+EkMC3kXfgDcECiWFEx2t8mSNISnNf+7xxlDz8pZlHrc 2YkWwplj7k4aCCzbBxy7lpUm7A3V/9WfBrAmBMJl58o+xlHMxQHKvhkg49hV5czcedmW Phc7HglJGcm3YfjsDKmC5ri7fYHj2atJQhW25l72LSjZBicj4AcjyL9ABoQChdv3aHXH cAmQ== X-Forwarded-Encrypted: i=1; AJvYcCUawjPxGSH164eMrbOKySY4BQeHKOZvhsVnoQz72m5JBQ4JkyP44jDGMS6+1j+Qfye//zIkoXTXb67Re4dB/kIhaBlXpw9EyMJAxxgb1fu3FJPD X-Gm-Message-State: AOJu0YwYI/3Lxd0TblKgzjugDk01c8Cvg4P2LSK2RFw1YGofr2ZLBszM XcXT5u3m8ZAI5PsdyAEdxgS8rLqkqb8rlqIbFfTdGrA9FIq/0NBi X-Google-Smtp-Source: AGHT+IGew+8eYSM7buBCgaK0V/uYFNLE8/3ep31gfldrh3EPHm/63YOfwRDMIgjls83fwJRHMNMVmA== X-Received: by 2002:a05:6870:5590:b0:259:f03c:4e90 with SMTP id 586e51a60fabf-25e2bf93f31mr7368525fac.4.1720254531236; Sat, 06 Jul 2024 01:28:51 -0700 (PDT) Received: from sean-ThinkPad-T450s.attlocal.net ([2600:1702:5083:7610:1e13:57ab:ecc5:1fd4]) by smtp.gmail.com with ESMTPSA id 586e51a60fabf-25e71070ba1sm10744fac.34.2024.07.06.01.28.49 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Sat, 06 Jul 2024 01:28: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 v2 17/37] wifi: mt76: mt7925: add link handling in mt7925_mac_sta_assoc Date: Sat, 6 Jul 2024 01:27:57 -0700 Message-Id: <0ddf1834783b111d626b05d298478f520d7c0caa.1720248331.git.sean.wang@kernel.org> X-Mailer: git-send-email 2.25.1 In-Reply-To: References: MIME-Version: 1.0 X-CRM114-Version: 20100106-BlameMichelson ( TRE 0.8.0 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20240706_012852_885285_7D26E8BF X-CRM114-Status: GOOD ( 17.95 ) 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 links handling in mt7925_mac_sta_assoc 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/main.c | 104 +++++++++++++++++- drivers/net/wireless/mediatek/mt76/mt792x.h | 1 + 2 files changed, 103 insertions(+), 2 deletions(-) diff --git a/drivers/net/wireless/mediatek/mt76/mt7925/main.c b/drivers/net/wireless/mediatek/mt76/mt7925/main.c index 938909ab8d1c..669f28a916c5 100644 --- a/drivers/net/wireless/mediatek/mt76/mt7925/main.c +++ b/drivers/net/wireless/mediatek/mt76/mt7925/main.c @@ -387,6 +387,7 @@ mt7925_add_interface(struct ieee80211_hw *hw, struct ieee80211_vif *vif) mvif->phy = phy; mvif->bss_conf.vif = mvif; mvif->sta.vif = mvif; + mvif->deflink_id = IEEE80211_LINK_UNSPECIFIED; ret = mt7925_mac_link_bss_add(dev, &vif->bss_conf, &mvif->sta.deflink); if (ret < 0) @@ -923,6 +924,89 @@ int mt7925_mac_sta_add(struct mt76_dev *mdev, struct ieee80211_vif *vif, } EXPORT_SYMBOL_GPL(mt7925_mac_sta_add); +static u16 +mt7925_mac_select_links(struct mt76_dev *mdev, struct ieee80211_vif *vif) +{ + unsigned long usable_links = ieee80211_vif_usable_links(vif); + struct { + u8 link_id; + enum nl80211_band band; + } data[IEEE80211_MLD_MAX_NUM_LINKS]; + u8 link_id, i, j, n_data = 0; + u16 sel_links; + + if (!ieee80211_vif_is_mld(vif)) + return 0; + + if (vif->active_links == usable_links) + return vif->active_links; + + rcu_read_lock(); + for_each_set_bit(link_id, &usable_links, IEEE80211_MLD_MAX_NUM_LINKS) { + struct ieee80211_bss_conf *link_conf = + rcu_dereference(vif->link_conf[link_id]); + + if (WARN_ON_ONCE(!link_conf)) + continue; + + data[n_data].link_id = link_id; + data[n_data].band = link_conf->chanreq.oper.chan->band; + n_data++; + } + rcu_read_unlock(); + + for (i = 0; i < n_data; i++) { + if (!(BIT(data[i].link_id) & vif->active_links)) + continue; + + sel_links = BIT(data[i].link_id); + + for (j = 0; j < n_data; j++) { + if (data[i].band != data[j].band) { + sel_links |= BIT(data[j].link_id); + break; + } + } + + break; + } + + return sel_links; +} + +static void +mt7925_mac_set_links(struct mt76_dev *mdev, struct ieee80211_vif *vif) +{ + struct mt792x_dev *dev = container_of(mdev, struct mt792x_dev, mt76); + struct mt792x_vif *mvif = (struct mt792x_vif *)vif->drv_priv; + struct ieee80211_bss_conf *link_conf = + mt792x_vif_to_bss_conf(vif, mvif->deflink_id); + struct cfg80211_chan_def *chandef = &link_conf->chanreq.oper; + enum nl80211_band band = chandef->chan->band, secondary_band; + + u16 sel_links = mt7925_mac_select_links(mdev, vif); + u8 secondary_link_id = __ffs(~BIT(mvif->deflink_id) & sel_links); + + if (!ieee80211_vif_is_mld(vif) || hweight16(sel_links) < 2) + return; + + link_conf = mt792x_vif_to_bss_conf(vif, secondary_link_id); + secondary_band = link_conf->chanreq.oper.chan->band; + + if (band == NL80211_BAND_2GHZ || + (band == NL80211_BAND_5GHZ && secondary_band == NL80211_BAND_6GHZ)) { + mt7925_abort_roc(mvif->phy, &mvif->bss_conf); + + mt792x_mutex_acquire(dev); + + mt7925_set_mlo_roc(mvif->phy, &mvif->bss_conf, sel_links); + + mt792x_mutex_release(dev); + } + + ieee80211_set_active_links_async(vif, sel_links); +} + static void mt7925_mac_link_sta_assoc(struct mt76_dev *mdev, struct ieee80211_vif *vif, struct ieee80211_link_sta *link_sta) @@ -937,7 +1021,11 @@ static void mt7925_mac_link_sta_assoc(struct mt76_dev *mdev, mt792x_mutex_acquire(dev); - link_conf = mt792x_vif_to_bss_conf(vif, vif->bss_conf.link_id); + if (ieee80211_vif_is_mld(vif)) { + link_conf = mt792x_vif_to_bss_conf(vif, msta->deflink_id); + } else { + link_conf = mt792x_vif_to_bss_conf(vif, vif->bss_conf.link_id); + } if (vif->type == NL80211_IFTYPE_STATION && !link_sta->sta->tdls) { struct mt792x_bss_conf *mconf; @@ -961,7 +1049,18 @@ static void mt7925_mac_link_sta_assoc(struct mt76_dev *mdev, 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); + if (ieee80211_vif_is_mld(vif)) { + struct mt792x_sta *msta = (struct mt792x_sta *)sta->drv_priv; + struct ieee80211_link_sta *link_sta; + + link_sta = mt792x_sta_to_link_sta(vif, sta, msta->deflink_id); + + mt7925_mac_set_links(mdev, vif); + + mt7925_mac_link_sta_assoc(mdev, vif, link_sta); + } else { + mt7925_mac_link_sta_assoc(mdev, vif, &sta->deflink); + } } EXPORT_SYMBOL_GPL(mt7925_mac_sta_assoc); @@ -1753,6 +1852,7 @@ mt7925_change_vif_links(struct ieee80211_hw *hw, struct ieee80211_vif *vif, for_each_set_bit(link_id, &add, IEEE80211_MLD_MAX_NUM_LINKS) { if (!old_links) { + mvif->deflink_id = link_id; mconf = &mvif->bss_conf; mlink = &mvif->sta.deflink; } else { diff --git a/drivers/net/wireless/mediatek/mt76/mt792x.h b/drivers/net/wireless/mediatek/mt76/mt792x.h index af9a103dc7f4..5ede24116748 100644 --- a/drivers/net/wireless/mediatek/mt76/mt792x.h +++ b/drivers/net/wireless/mediatek/mt76/mt792x.h @@ -131,6 +131,7 @@ struct mt792x_vif { struct mt792x_phy *phy; u16 valid_links; + u8 deflink_id; }; struct mt792x_phy { From patchwork Sat Jul 6 08:27: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: 13725773 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 3677DC3DA42 for ; Sat, 6 Jul 2024 08:28:57 +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=YHGyXk+WAR8WXx4VibOug2pcg/d+aFy2gVyJKaP8IFg=; b=YAg4EuKTS3XIG1Wr21FfsTfCmS Sh8CCpBd5/X5+aiRy3Mwe2qkrQLrj4R0axzGlDvnza8mtis9utyJuWxw4itJ/Uq9RaaGBOvQox/87 GMoz7TwQMTeXMxFtL3tnoC1uvuXObvEtiqiHM5bDxMXZGE2s+fi8ByWBXEHy3fq8BJ3mxtimcv16p I+Bfe9174GrjUkqIfl/qUlrrPZMW4z8x99NhjOd7Wj9n4gu5ebv43AMXHb98RC3YVefj/J1WnB2Rx luFg+VegQ6e+zofuNb9eSORri+/H28hvSuU3yuOVX7T5wwmAkuKcfiiB8msIwAaKNDsKeXuK2oioW 6yaQpWCg==; Received: from localhost ([::1] helo=bombadil.infradead.org) by bombadil.infradead.org with esmtp (Exim 4.97.1 #2 (Red Hat Linux)) id 1sQ0mu-0000000HXzt-302P; Sat, 06 Jul 2024 08:28:56 +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 1sQ0mr-0000000HXxI-2odP for linux-mediatek@lists.infradead.org; Sat, 06 Jul 2024 08:28:55 +0000 Received: by mail-oa1-f51.google.com with SMTP id 586e51a60fabf-25075f3f472so367194fac.2 for ; Sat, 06 Jul 2024 01:28:53 -0700 (PDT) X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1720254533; x=1720859333; 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=YHGyXk+WAR8WXx4VibOug2pcg/d+aFy2gVyJKaP8IFg=; b=fUI/7Wn7Z+nqNrhkoAznaydnlXXqRBVvyRsEW5qQ856w9wJTPwsOkIsupS4Fkhi0S/ 2ELUORZ5GhjZN3dedaHxnmFAP2yZksS9VQ9vw6ahPdaTdf4a77TKi2LREy3Ah/S2Vad6 gYjIL2DOJNN/039ehNFqqNG/NUAsvtof1+WGuFo85RQH9cg6vdKUSiI2IgjhN543HbO2 wkcKthUBDkBStCNHNKkwbLh0svIgLy/e8jZZ7DoPgdPwhlOnnm/1dsPPw4EEpU/0isCV bemAMzCC25uwyi+NdPzplCC4HB2TxKaPBW244ExdR1KFlBhaNS+4fCXV+3e01Sm8bOCx MRRQ== X-Forwarded-Encrypted: i=1; AJvYcCWz4STAAaTlKEVZgeCp8PMOqvP33I5nMmrc/gmbh1G/1fvy7gJNjal1OTGRlRmvNx9vrusr6sDg9rYvruUY5pRYhAMHXMTj5/tRwCcMC5PS0Jnq X-Gm-Message-State: AOJu0YyVFBC4ZXx1rd5ijmNYVHNHo2NnEXYw5d0Blsaf3a+igRtW9/dB +iVWhEEGPjZXJO9G2uf8PmLmzpsIMQjIxH52x5wwHt0a/OYDELPLpv46vGbo X-Google-Smtp-Source: AGHT+IFDLJSexFdKlH1kAQdK5WdFbGIt4Pp8bOhD5gqac9cia3oXrg+IFO5ZRDdOCGyTsNIUUu4nHw== X-Received: by 2002:a05:6871:798e:b0:25e:15e1:35c6 with SMTP id 586e51a60fabf-25e2b5af44dmr6351746fac.0.1720254532685; Sat, 06 Jul 2024 01:28:52 -0700 (PDT) Received: from sean-ThinkPad-T450s.attlocal.net ([2600:1702:5083:7610:1e13:57ab:ecc5:1fd4]) by smtp.gmail.com with ESMTPSA id 586e51a60fabf-25e71070ba1sm10744fac.34.2024.07.06.01.28.51 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Sat, 06 Jul 2024 01:28: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 v2 18/37] wifi: mt76: mt7925: add link handling in mt7925_sta_set_decap_offload Date: Sat, 6 Jul 2024 01:27:58 -0700 Message-Id: X-Mailer: git-send-email 2.25.1 In-Reply-To: References: MIME-Version: 1.0 X-CRM114-Version: 20100106-BlameMichelson ( TRE 0.8.0 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20240706_012853_759445_08E196F2 X-CRM114-Status: GOOD ( 12.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 add link handling in mt7925_sta_set_decap_offload 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/main.c | 21 ++++++++++++---- .../net/wireless/mediatek/mt76/mt7925/mcu.c | 24 ++++++++++++++----- .../wireless/mediatek/mt76/mt7925/mt7925.h | 3 ++- 3 files changed, 36 insertions(+), 12 deletions(-) diff --git a/drivers/net/wireless/mediatek/mt76/mt7925/main.c b/drivers/net/wireless/mediatek/mt76/mt7925/main.c index 669f28a916c5..791e90f5760f 100644 --- a/drivers/net/wireless/mediatek/mt76/mt7925/main.c +++ b/drivers/net/wireless/mediatek/mt76/mt7925/main.c @@ -1464,16 +1464,27 @@ static void mt7925_sta_set_decap_offload(struct ieee80211_hw *hw, bool enabled) { struct mt792x_sta *msta = (struct mt792x_sta *)sta->drv_priv; + struct mt792x_vif *mvif = (struct mt792x_vif *)vif->drv_priv; struct mt792x_dev *dev = mt792x_hw_dev(hw); + unsigned long valid = mvif->valid_links; + u8 i; mt792x_mutex_acquire(dev); - if (enabled) - set_bit(MT_WCID_FLAG_HDR_TRANS, &msta->deflink.wcid.flags); - else - clear_bit(MT_WCID_FLAG_HDR_TRANS, &msta->deflink.wcid.flags); + valid = ieee80211_vif_is_mld(vif) ? mvif->valid_links : BIT(0); + + for_each_set_bit(i, &valid, IEEE80211_MLD_MAX_NUM_LINKS) { + struct mt792x_link_sta *mlink; - mt7925_mcu_wtbl_update_hdr_trans(dev, vif, sta); + mlink = mt792x_sta_to_link(msta, i); + + if (enabled) + set_bit(MT_WCID_FLAG_HDR_TRANS, &mlink->wcid.flags); + else + clear_bit(MT_WCID_FLAG_HDR_TRANS, &mlink->wcid.flags); + + mt7925_mcu_wtbl_update_hdr_trans(dev, vif, sta, i); + } 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 9a4dfe53da17..0991af877434 100644 --- a/drivers/net/wireless/mediatek/mt76/mt7925/mcu.c +++ b/drivers/net/wireless/mediatek/mt76/mt7925/mcu.c @@ -887,10 +887,15 @@ mt7925_mcu_sta_hdr_trans_tlv(struct sk_buff *skb, else hdr_trans->from_ds = true; - if (link_sta) - wcid = (struct mt76_wcid *)link_sta->sta->drv_priv; - else + if (link_sta) { + struct mt792x_sta *msta = (struct mt792x_sta *)link_sta->sta->drv_priv; + struct mt792x_link_sta *mlink; + + mlink = mt792x_sta_to_link(msta, link_sta->link_id); + wcid = &mlink->wcid; + } else { wcid = &mvif->sta.deflink.wcid; + } if (!wcid) return; @@ -904,17 +909,24 @@ mt7925_mcu_sta_hdr_trans_tlv(struct sk_buff *skb, int mt7925_mcu_wtbl_update_hdr_trans(struct mt792x_dev *dev, struct ieee80211_vif *vif, - struct ieee80211_sta *sta) + struct ieee80211_sta *sta, + int link_id) { struct mt792x_vif *mvif = (struct mt792x_vif *)vif->drv_priv; struct ieee80211_link_sta *link_sta = sta ? &sta->deflink : NULL; + struct mt792x_link_sta *mlink; + struct mt792x_bss_conf *mconf; struct mt792x_sta *msta; struct sk_buff *skb; msta = sta ? (struct mt792x_sta *)sta->drv_priv : &mvif->sta; - skb = __mt76_connac_mcu_alloc_sta_req(&dev->mt76, &mvif->bss_conf.mt76, - &msta->deflink.wcid, + mlink = mt792x_sta_to_link(msta, link_id); + link_sta = mt792x_sta_to_link_sta(vif, sta, link_id); + mconf = mt792x_vif_to_link(mvif, link_id); + + skb = __mt76_connac_mcu_alloc_sta_req(&dev->mt76, &mconf->mt76, + &mlink->wcid, MT7925_STA_UPDATE_MAX_SIZE); if (IS_ERR(skb)) return PTR_ERR(skb); diff --git a/drivers/net/wireless/mediatek/mt76/mt7925/mt7925.h b/drivers/net/wireless/mediatek/mt76/mt7925/mt7925.h index bcf8541fa31d..1ae66629e39f 100644 --- a/drivers/net/wireless/mediatek/mt76/mt7925/mt7925.h +++ b/drivers/net/wireless/mediatek/mt76/mt7925/mt7925.h @@ -316,6 +316,7 @@ int mt7925_mcu_add_key(struct mt76_dev *dev, struct ieee80211_vif *vif, int mt7925_mcu_set_rts_thresh(struct mt792x_phy *phy, u32 val); int mt7925_mcu_wtbl_update_hdr_trans(struct mt792x_dev *dev, struct ieee80211_vif *vif, - struct ieee80211_sta *sta); + struct ieee80211_sta *sta, + int link_id); #endif From patchwork Sat Jul 6 08:27: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: 13725774 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 E4F97C38150 for ; Sat, 6 Jul 2024 08:28: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=3S6mlsXmirTjv2z8akgtbzv3cHrQXWXD1zrwfiohz18=; b=XsCLGGU+OyYw3PwsXLMzaX7PvA NTqhmE5W/kCUlJochgZyhCQHEhJopx0FhPtoRqylj6G292ZNoy7cOnxlHK020ZgJq8lo/3imSJu6Y ZV50q1vXJH+XadBOcHhdP+7qXP+k03jZZLpOzsCQDYxQE6jWHTZ705IWrzCCveNK9bAdhuIS1bDzK NyhSRf2IuflrAUXJxDqnmqn8ZYwE+IpVrIkQA9fUJUndEcoQ4O8LvrFpNGCdrQbr0uA3h0tB5Ngb/ +Nl5O6omxm8eBGtm6Y6nFk3+1RwGOhZUg8d+8zPYG5NSP7OsPLMJ4DNU72x7WVanoRgHdpHmB8jlV pc5aLYmw==; Received: from localhost ([::1] helo=bombadil.infradead.org) by bombadil.infradead.org with esmtp (Exim 4.97.1 #2 (Red Hat Linux)) id 1sQ0mw-0000000HY1D-2OP0; Sat, 06 Jul 2024 08:28:58 +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 1sQ0mt-0000000HXyM-0QvM for linux-mediatek@lists.infradead.org; Sat, 06 Jul 2024 08:28:56 +0000 Received: by mail-oi1-f171.google.com with SMTP id 5614622812f47-3d55fa5dfecso121384b6e.0 for ; Sat, 06 Jul 2024 01:28:55 -0700 (PDT) X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1720254534; x=1720859334; 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=3S6mlsXmirTjv2z8akgtbzv3cHrQXWXD1zrwfiohz18=; b=sTlH29LINyZLws8eTHIfUtLJDTXs2+hkM01ge4pPKgF0guoTySrXRAcvcnvND/BWRH 1XzsdI3vzD4o4KIa16GRqJK+agK1WHRlLKFPc5XoINrs3Vq2mgx4amXIzBje66dNEdFu FUUlhSmzYeV37DbC8H8tY6kOAHC4VB4l1l1N9ztV99zUZkKoEP1mXiFD8mb5oG0cyRv+ RTcaK/HKuIu5JcMc5KGjmcfdTl1WkbK++reLf82K0KbcMBVl5udBAb8Mu4k+2qzTSfmP FeVW8mtogKl6dzzdrdE5030ihuPYrvubhEdHw+cKcjg5lZKClQe6ZCWs28eRkSg3DR9c RzKw== X-Forwarded-Encrypted: i=1; AJvYcCUGNZWPx5BMRxWrxqSNNvBzu9tDSp1g6vM1P3CLliOkvrIddYzn1f48dbnAJH01PrRN4MKOWDCZtRBl88nXnZ8r7QTI0aR+RWpatbG10b6ATDjU X-Gm-Message-State: AOJu0Yy0W8xyieb6rHU0ffp7NyI0Z8Vw4jbR8MjFAE9p8ojt0evWZOZ5 3Rxo9HjsphVI2v/6atBKNTVRDkvj/sBR53atiw1qAWOiz4s5JA/7 X-Google-Smtp-Source: AGHT+IHh2/AbUPDMj3Hmw3iHC21ScZt1IRJwxGj917xgQkf9TrsovD+xoY+j5YDE28M1gNQs9IHFbA== X-Received: by 2002:a05:6870:eca3:b0:25e:c0b:82c5 with SMTP id 586e51a60fabf-25e2bf101admr6656159fac.3.1720254534322; Sat, 06 Jul 2024 01:28:54 -0700 (PDT) Received: from sean-ThinkPad-T450s.attlocal.net ([2600:1702:5083:7610:1e13:57ab:ecc5:1fd4]) by smtp.gmail.com with ESMTPSA id 586e51a60fabf-25e71070ba1sm10744fac.34.2024.07.06.01.28.52 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Sat, 06 Jul 2024 01:28:53 -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 v2 19/37] wifi: mt76: mt7925: add link handling in mt7925_vif_connect_iter Date: Sat, 6 Jul 2024 01:27:59 -0700 Message-Id: X-Mailer: git-send-email 2.25.1 In-Reply-To: References: MIME-Version: 1.0 X-CRM114-Version: 20100106-BlameMichelson ( TRE 0.8.0 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20240706_012855_175297_A495A553 X-CRM114-Status: GOOD ( 10.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: Sean Wang add link handling in mt7925_vif_connect_iter 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/mac.c | 14 +++++++++++--- 1 file changed, 11 insertions(+), 3 deletions(-) diff --git a/drivers/net/wireless/mediatek/mt76/mt7925/mac.c b/drivers/net/wireless/mediatek/mt76/mt7925/mac.c index 0cb9031e9fdd..cf36750cf709 100644 --- a/drivers/net/wireless/mediatek/mt76/mt7925/mac.c +++ b/drivers/net/wireless/mediatek/mt76/mt7925/mac.c @@ -1267,15 +1267,23 @@ mt7925_vif_connect_iter(void *priv, u8 *mac, struct ieee80211_vif *vif) { struct mt792x_vif *mvif = (struct mt792x_vif *)vif->drv_priv; + unsigned long valid = ieee80211_vif_is_mld(vif) ? + mvif->valid_links : BIT(0); struct mt792x_dev *dev = mvif->phy->dev; struct ieee80211_hw *hw = mt76_hw(dev); + struct ieee80211_bss_conf *bss_conf; + int i; if (vif->type == NL80211_IFTYPE_STATION) ieee80211_disconnect(vif, true); - mt76_connac_mcu_uni_add_dev(&dev->mphy, &vif->bss_conf, - &mvif->sta.deflink.wcid, true); - mt7925_mcu_set_tx(dev, &vif->bss_conf); + for_each_set_bit(i, &valid, IEEE80211_MLD_MAX_NUM_LINKS) { + bss_conf = mt792x_vif_to_bss_conf(vif, i); + + mt76_connac_mcu_uni_add_dev(&dev->mphy, bss_conf, + &mvif->sta.deflink.wcid, true); + mt7925_mcu_set_tx(dev, bss_conf); + } if (vif->type == NL80211_IFTYPE_AP) { mt76_connac_mcu_uni_add_bss(dev->phy.mt76, vif, &mvif->sta.deflink.wcid, From patchwork Sat Jul 6 08:28: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: 13725775 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 429B6C2BD09 for ; Sat, 6 Jul 2024 08:29: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=DqUVQrvv47c1itp+tRv4q6cRbFuGM81+0GzeLk9XrrU=; b=Sk10UrYjNfPx2PMaS3lwq+1TMe p4VrjlRGoX1JgE690HbqRmJPvPgm0LtAkGB3Ed0bOgHVGEj9DlSJRUs3puTC8qBOIzm3TVPvjv0LZ Gbvr7Rvy0VMBKcGF7K81juc+r8ah+ivnpdXEFVSgtrbATHmc3IawO29GRZ8SkDqRLeUXb0BWhT82i Txqb2G+x6IeIPlnuNT0oBpXHpu6Yp4yZS6CtLia9yZ/3pA6E84TkHSjGE5wZHau7uNylcua4m8x6Y SVdW+nk3/9AS2CN3bW5tI0TSpmI8DfsEtsR4qB45msKwsc1N4gnbjKZ9CqMnirVb/ai9hKja0UQlS rcNG+6Bg==; Received: from localhost ([::1] helo=bombadil.infradead.org) by bombadil.infradead.org with esmtp (Exim 4.97.1 #2 (Red Hat Linux)) id 1sQ0mx-0000000HY2W-3yk0; Sat, 06 Jul 2024 08:28:59 +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 1sQ0mv-0000000HXzk-0tQ2 for linux-mediatek@lists.infradead.org; Sat, 06 Jul 2024 08:28:58 +0000 Received: by mail-oi1-f181.google.com with SMTP id 5614622812f47-3d1b5f32065so140336b6e.2 for ; Sat, 06 Jul 2024 01:28:56 -0700 (PDT) X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1720254536; x=1720859336; 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=DqUVQrvv47c1itp+tRv4q6cRbFuGM81+0GzeLk9XrrU=; b=MqN3fEs85+GJwZLXb3aALGhU9QNKxJpSNAd/gbaQ/yYXRYz3+zPwHMJJ0nbEmUOhlm cn6BTp3vsjbXCAmjHlcVQW44rS7Skz7ES1rR9s6h8vX/8RgLWJyyO2Op5jKIt3UUjLi/ 6TEGl/RR4EgV6AxTDuAlEU2lBF9KVoGfVtOfJ303ydL57QuyvRaXYQ9hUL0HQ1ry1d82 0U71K+KEwBnE5NBD9BjQPaR0QFA1BgOYXtApClt8V17gNQp8yiKaeSkZLtyBTKnBbh12 LPnI1I0mIud1IwchlWKZuZJF+ymfeeF+GPEcIPe5nQoR/GO/ddnF+zNACOr7BmHriQRd EdJg== X-Forwarded-Encrypted: i=1; AJvYcCU/mXHZ+7vFQObBoEzA8QtsUWrvhU1rqL5PMCci4+MJmfpDZ1ZqRNsU1/GheNWDB5Y1gRBrPUswfvKW6kw6Nqte2bmnUkZT5hGDBqdoivNkVarJ X-Gm-Message-State: AOJu0Yyp6JXJfimfk12DQJQ34liBT4wuPfXyKrg25nE+hkMM3y/UHoEt lEGeMGhk6hw3SygJxpXuWps/I/D4mmwkUHJXGYMROL24JPxUCM1W X-Google-Smtp-Source: AGHT+IHe1Y1PPxOR2nKL9g+jjNvFWNPedzbzTVhQiKhUAQYU+OXCr46RR8IQejk8rRcZT0GyuhU2lQ== X-Received: by 2002:a05:6870:eca3:b0:25e:c0b:82c5 with SMTP id 586e51a60fabf-25e2bf101admr6656181fac.3.1720254535992; Sat, 06 Jul 2024 01:28:55 -0700 (PDT) Received: from sean-ThinkPad-T450s.attlocal.net ([2600:1702:5083:7610:1e13:57ab:ecc5:1fd4]) by smtp.gmail.com with ESMTPSA id 586e51a60fabf-25e71070ba1sm10744fac.34.2024.07.06.01.28.54 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Sat, 06 Jul 2024 01:28: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 v2 20/37] wifi: mt76: mt7925: add link handling in the BSS_CHANGED_ARP_FILTER handler Date: Sat, 6 Jul 2024 01:28:00 -0700 Message-Id: <6e26e2ce253630ab29702693a7822f9961de6a18.1720248331.git.sean.wang@kernel.org> X-Mailer: git-send-email 2.25.1 In-Reply-To: References: MIME-Version: 1.0 X-CRM114-Version: 20100106-BlameMichelson ( TRE 0.8.0 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20240706_012857_428517_6B010186 X-CRM114-Status: GOOD ( 12.69 ) 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 link handling in the BSS_CHANGED_ARP_FILTER handler. 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 | 16 ++++++++-------- drivers/net/wireless/mediatek/mt76/mt7925/mcu.c | 8 +++++--- drivers/net/wireless/mediatek/mt76/mt7925/mcu.h | 2 +- 3 files changed, 14 insertions(+), 12 deletions(-) diff --git a/drivers/net/wireless/mediatek/mt76/mt7925/main.c b/drivers/net/wireless/mediatek/mt76/mt7925/main.c index 791e90f5760f..8acce16d88d6 100644 --- a/drivers/net/wireless/mediatek/mt76/mt7925/main.c +++ b/drivers/net/wireless/mediatek/mt76/mt7925/main.c @@ -1749,6 +1749,10 @@ static void mt7925_vif_cfg_changed(struct ieee80211_hw *hw, { struct mt792x_vif *mvif = (struct mt792x_vif *)vif->drv_priv; struct mt792x_dev *dev = mt792x_hw_dev(hw); + unsigned long valid = ieee80211_vif_is_mld(vif) ? + mvif->valid_links : BIT(0); + struct ieee80211_bss_conf *bss_conf; + int i; mt792x_mutex_acquire(dev); @@ -1759,17 +1763,13 @@ static void mt7925_vif_cfg_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->bss_conf.mt76); + for_each_set_bit(i, &valid, IEEE80211_MLD_MAX_NUM_LINKS) { + bss_conf = mt792x_vif_to_bss_conf(vif, i); + mt7925_mcu_update_arp_filter(&dev->mt76, bss_conf); + } } if (changed & BSS_CHANGED_PS) { - unsigned long valid = ieee80211_vif_is_mld(vif) ? - mvif->valid_links : BIT(0); - struct ieee80211_bss_conf *bss_conf; - int i; - for_each_set_bit(i, &valid, IEEE80211_MLD_MAX_NUM_LINKS) { bss_conf = mt792x_vif_to_bss_conf(vif, i); mt7925_mcu_uni_bss_ps(dev, bss_conf); diff --git a/drivers/net/wireless/mediatek/mt76/mt7925/mcu.c b/drivers/net/wireless/mediatek/mt76/mt7925/mcu.c index 0991af877434..3d5eaeb96047 100644 --- a/drivers/net/wireless/mediatek/mt76/mt7925/mcu.c +++ b/drivers/net/wireless/mediatek/mt76/mt7925/mcu.c @@ -121,10 +121,12 @@ 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 *link_conf) { - struct ieee80211_vif *mvif = container_of((void *)vif, struct ieee80211_vif, + struct ieee80211_vif *mvif = container_of((void *)link_conf->vif, + struct ieee80211_vif, drv_priv); + struct mt792x_bss_conf *mconf = mt792x_link_conf_to_mconf(link_conf); struct sk_buff *skb; int i, len = min_t(int, mvif->cfg.arp_addr_cnt, IEEE80211_BSS_ARP_ADDR_LIST_LEN); @@ -136,7 +138,7 @@ int mt7925_mcu_update_arp_filter(struct mt76_dev *dev, struct mt7925_arpns_tlv arp; } req = { .hdr = { - .bss_idx = vif->idx, + .bss_idx = mconf->mt76.idx, }, .arp = { .tag = cpu_to_le16(UNI_OFFLOAD_OFFLOAD_ARP), diff --git a/drivers/net/wireless/mediatek/mt76/mt7925/mcu.h b/drivers/net/wireless/mediatek/mt76/mt7925/mcu.h index fefb6ab384bb..7fb46cad9157 100644 --- a/drivers/net/wireless/mediatek/mt76/mt7925/mcu.h +++ b/drivers/net/wireless/mediatek/mt76/mt7925/mcu.h @@ -626,5 +626,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 *link_conf); #endif From patchwork Sat Jul 6 08:28: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: 13725776 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 2FC54C38150 for ; Sat, 6 Jul 2024 08:29: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=AmZqqZxko2JYQVXtVLRpulxVIyqXof1xyUbUxDuvHpQ=; b=AyspfN0k/Lhpd8d16Nyw0o3uoS G4bcszhBo7IXvIMV8Rexi1MikksukNJoomSRIqWUdHp0bENjXY4UzF+b+lmisxDgzd7zFOdGbUtTG TGc2qgGGn9+fsuvFhB2w+dq/0YaYWqMMWeusUQMP6cmWimW5sBIIoKqufozAUk6yg38tKC7LjxeGl I6CmC39tevNx09zP+MZr6ki1LlHqp+O5vtkNv6U7GJpXa1Kk1ASomqerNE5S263y0oQRgzGEOriB1 0UVFL7gEDICAeMXKVcsAHYg6JUywmgwOLqGrm3aIWAYSPHbiet6Ds0OnO7RY0LwUP46U4+MjaDUEK U6fxx5RQ==; Received: from localhost ([::1] helo=bombadil.infradead.org) by bombadil.infradead.org with esmtp (Exim 4.97.1 #2 (Red Hat Linux)) id 1sQ0mz-0000000HY40-3fX0; Sat, 06 Jul 2024 08:29:01 +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 1sQ0mx-0000000HY12-01j3 for linux-mediatek@lists.infradead.org; Sat, 06 Jul 2024 08:29:00 +0000 Received: by mail-oa1-f50.google.com with SMTP id 586e51a60fabf-25cb5ee9d2dso294079fac.1 for ; Sat, 06 Jul 2024 01:28:58 -0700 (PDT) X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1720254537; x=1720859337; 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=AmZqqZxko2JYQVXtVLRpulxVIyqXof1xyUbUxDuvHpQ=; b=T5kmdwpLSP5ZeQ/GnKK3H0EpuezDESA2iQLORtjnvx1eLKtO072tWLFszOsqcL5IEN hQk6FnbC14Eak/Th7eP/ho+oMJYGjNpfHne9V8Qgc4yxXcuUB6KdV6UpwF8eKULTJsG8 2ysTTZCMR2fyRdkKXhAQQozfF5rFK4GKw7hJ2UK2f/5RGrSp+XN8HeD+YV/jF6l9uZhM NUgTIW0cv1frw5R+BFEE9Mr5XYJXIVBkvqgNOu5NxVsnzW6xC6YTrwiMjAWlaNtcauRH iuzbUoYNFY3rZCuY9mn4TnTHArdiWWu69XRFxLASlkVMKbyTCN2xFSnNzpHDkhR/RgSy GZrQ== X-Forwarded-Encrypted: i=1; AJvYcCVEdsbMnDOF/ylSJjjA5NxJuiUM7invqUCH7rxVyq8GtcwKDkoW9+H2FhrAZL0OvWZx50UAJeLrKLoSUw60T3W7QQ4FAE5l/nCz+82QVO6DS+28 X-Gm-Message-State: AOJu0Yz6RL0PQxR1ZXUhTIq8iHW568mr3dfnRnZVNPWz5hK1UBxRbsJH c6eCa3PGenofjxvqQX1xIBhzoVfgTobtmAjH74/Lhv2iO8Mk6i7SpItDOAh/ X-Google-Smtp-Source: AGHT+IFwOST0MVMtQVt8L7b27qxOca8D10UEvbV6G/pxUhHNqHvSniuXGuirugc0in75BVkca56RgA== X-Received: by 2002:a05:6871:24d7:b0:24f:e599:9168 with SMTP id 586e51a60fabf-25e2b8d0139mr7038261fac.1.1720254537630; Sat, 06 Jul 2024 01:28:57 -0700 (PDT) Received: from sean-ThinkPad-T450s.attlocal.net ([2600:1702:5083:7610:1e13:57ab:ecc5:1fd4]) by smtp.gmail.com with ESMTPSA id 586e51a60fabf-25e71070ba1sm10744fac.34.2024.07.06.01.28.56 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Sat, 06 Jul 2024 01:28: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 v2 21/37] wifi: mt76: mt7925: add link handling in the mt7925_ipv6_addr_change Date: Sat, 6 Jul 2024 01:28:01 -0700 Message-Id: X-Mailer: git-send-email 2.25.1 In-Reply-To: References: MIME-Version: 1.0 X-CRM114-Version: 20100106-BlameMichelson ( TRE 0.8.0 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20240706_012859_103317_EB2C7744 X-CRM114-Status: GOOD ( 11.26 ) 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 link handling in the mt7925_ipv6_addr_change 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/main.c | 29 +++++++++++++++---- 1 file changed, 23 insertions(+), 6 deletions(-) diff --git a/drivers/net/wireless/mediatek/mt76/mt7925/main.c b/drivers/net/wireless/mediatek/mt76/mt7925/main.c index 8acce16d88d6..54479c2fc167 100644 --- a/drivers/net/wireless/mediatek/mt76/mt7925/main.c +++ b/drivers/net/wireless/mediatek/mt76/mt7925/main.c @@ -1490,12 +1490,12 @@ static void mt7925_sta_set_decap_offload(struct ieee80211_hw *hw, } #if IS_ENABLED(CONFIG_IPV6) -static void mt7925_ipv6_addr_change(struct ieee80211_hw *hw, - struct ieee80211_vif *vif, - struct inet6_dev *idev) +static void __mt7925_ipv6_addr_change(struct ieee80211_hw *hw, + struct ieee80211_bss_conf *link_conf, + struct inet6_dev *idev) { - struct mt792x_vif *mvif = (struct mt792x_vif *)vif->drv_priv; - struct mt792x_dev *dev = mvif->phy->dev; + struct mt792x_bss_conf *mconf = mt792x_link_conf_to_mconf(link_conf); + struct mt792x_dev *dev = mt792x_hw_dev(hw); struct inet6_ifaddr *ifa; struct sk_buff *skb; u8 idx = 0; @@ -1509,7 +1509,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->bss_conf.mt76.idx, + .bss_idx = mconf->mt76.idx, }, .arpns = { .tag = cpu_to_le16(UNI_OFFLOAD_OFFLOAD_ND), @@ -1544,6 +1544,23 @@ static void mt7925_ipv6_addr_change(struct ieee80211_hw *hw, ieee80211_queue_work(dev->mt76.hw, &dev->ipv6_ns_work); } + +static void mt7925_ipv6_addr_change(struct ieee80211_hw *hw, + struct ieee80211_vif *vif, + struct inet6_dev *idev) +{ + struct mt792x_vif *mvif = (struct mt792x_vif *)vif->drv_priv; + unsigned long valid = ieee80211_vif_is_mld(vif) ? + mvif->valid_links : BIT(0); + struct ieee80211_bss_conf *bss_conf; + int i; + + for_each_set_bit(i, &valid, IEEE80211_MLD_MAX_NUM_LINKS) { + bss_conf = mt792x_vif_to_bss_conf(vif, i); + __mt7925_ipv6_addr_change(hw, bss_conf, idev); + } +} + #endif int mt7925_set_tx_sar_pwr(struct ieee80211_hw *hw, From patchwork Sat Jul 6 08:28: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: 13725777 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 C4F07C2BD09 for ; Sat, 6 Jul 2024 08:29:04 +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=L17xDYgVdAfPX0dyJlUo8j3jUMWLwVqA5L7fwy5iAF4=; b=bd0GNW4R1UTuGMHYZvW8L5xm8z SLh/HJVq6C8K7nvDCI8c35qbNsDTkQYYV6sLkRpk48xXFmOYuu5tpKdPutTyMzgpA08WtCnFuXWAQ WA3/h3iU+fJLQGsIg6/wel2b9yPL39XLOjwqXHH9RqABTWt2kH2wrAB1h12uo1Zry8S3B1+E/O4aL IHjZhuyeH6apTZLV8NQOt/RWBDZeWJD1hjOp81GInMShdxwjg/DI5y412sSKjjaVrjOTomZudvwPL ebrPLDLRhnJNmlUtTqUKgWhoTCZsE9sLuiqsg0k80z7fLmWND5XHRUd4Mf/1c5eeGB10NWlTl+ubp hr+r455w==; Received: from localhost ([::1] helo=bombadil.infradead.org) by bombadil.infradead.org with esmtp (Exim 4.97.1 #2 (Red Hat Linux)) id 1sQ0n2-0000000HY5j-1Joo; Sat, 06 Jul 2024 08:29:04 +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 1sQ0my-0000000HY2U-0owk for linux-mediatek@lists.infradead.org; Sat, 06 Jul 2024 08:29:01 +0000 Received: by mail-oa1-f47.google.com with SMTP id 586e51a60fabf-254939503baso94605fac.0 for ; Sat, 06 Jul 2024 01:29:00 -0700 (PDT) X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1720254539; x=1720859339; 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=L17xDYgVdAfPX0dyJlUo8j3jUMWLwVqA5L7fwy5iAF4=; b=dbB+lsE1iPOEl6hnfXkJM5z2nYgyw+MqU0ecNywCQcCK8F2jwYmKWOgbyoMoZe8cz1 FYFc5F5lIR2mId3e09zeI42+tD6rLwjLUUA/Mxi8O2zb1dcmlnCF+DH7BiKF1/JXYjQg 9CS94UBFRBSZZvHimwGhE4I3f9zaxS240h/IoD6Bt+hiWxRt4Vf8/QcC82rYGNW9n9b2 L1JcJ6eusTMCCTnhlS4DE2I8muz+R+2qXe/7KKRtXF3JLHgEiMGY75rsoEsMVvxHiIi7 W90TmU79Q92vT0wCsIiML1ql/q7+lKRmC6VpPCHauYix+7PIvM6p0SG+m1AwnZXGQQCR +xIA== X-Forwarded-Encrypted: i=1; AJvYcCUN+/4nj5qZJcN9BeIkS30TixrtCnX8lUcJs3shVO4bYICmX1m317IOoRgR6PYRqeOZEENJnA9yIVAUpg7CPFmVzjuSWwvzDq0sAvFd2WN1Jqkx X-Gm-Message-State: AOJu0YwSajMHGPjepDJOHcb8znqsSqDSmgm15yW/NxQZbXzZLiLmfXJw +dkQ9cffw3S8L+wafnjgsqnG9z2FMn+Oo8Jd8DEPczNhO8UNs21P/EHGboz6 X-Google-Smtp-Source: AGHT+IGcPB4DMUSotfZxfYkuA3vtERCQ08CkirXCvIo6j47xA/pJmbNAaY+olGcoE1et+KNb9FBa9g== X-Received: by 2002:a05:6871:24ca:b0:254:ecbd:1815 with SMTP id 586e51a60fabf-25e2bffce48mr6346814fac.5.1720254539381; Sat, 06 Jul 2024 01:28:59 -0700 (PDT) Received: from sean-ThinkPad-T450s.attlocal.net ([2600:1702:5083:7610:1e13:57ab:ecc5:1fd4]) by smtp.gmail.com with ESMTPSA id 586e51a60fabf-25e71070ba1sm10744fac.34.2024.07.06.01.28.57 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Sat, 06 Jul 2024 01:28: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 v2 22/37] wifi: mt76: mt7925: update rate index according to link id Date: Sat, 6 Jul 2024 01:28:02 -0700 Message-Id: X-Mailer: git-send-email 2.25.1 In-Reply-To: References: MIME-Version: 1.0 X-CRM114-Version: 20100106-BlameMichelson ( TRE 0.8.0 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20240706_012900_316320_2D6D6FE0 X-CRM114-Status: UNSURE ( 9.19 ) 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 Update rate index according to link id. 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 | 11 +++++++---- 1 file changed, 7 insertions(+), 4 deletions(-) diff --git a/drivers/net/wireless/mediatek/mt76/mt7925/main.c b/drivers/net/wireless/mediatek/mt76/mt7925/main.c index 54479c2fc167..e1af5b4179b0 100644 --- a/drivers/net/wireless/mediatek/mt76/mt7925/main.c +++ b/drivers/net/wireless/mediatek/mt76/mt7925/main.c @@ -1801,9 +1801,12 @@ static void mt7925_link_info_changed(struct ieee80211_hw *hw, struct ieee80211_bss_conf *info, u64 changed) { - struct mt76_vif *mvif = (struct mt76_vif *)vif->drv_priv; + struct mt792x_vif *mvif = (struct mt792x_vif *)vif->drv_priv; struct mt792x_phy *phy = mt792x_hw_phy(hw); struct mt792x_dev *dev = mt792x_hw_dev(hw); + struct mt792x_bss_conf *mconf; + + mconf = mt792x_vif_to_link(mvif, info->link_id); mt792x_mutex_acquire(dev); @@ -1817,16 +1820,16 @@ static void mt7925_link_info_changed(struct ieee80211_hw *hw, } if (changed & BSS_CHANGED_MCAST_RATE) - mvif->mcast_rates_idx = + mconf->mt76.mcast_rates_idx = mt7925_get_rates_table(hw, vif, false, true); if (changed & BSS_CHANGED_BASIC_RATES) - mvif->basic_rates_idx = + mconf->mt76.basic_rates_idx = mt7925_get_rates_table(hw, vif, false, false); if (changed & (BSS_CHANGED_BEACON | BSS_CHANGED_BEACON_ENABLED)) { - mvif->beacon_rates_idx = + mconf->mt76.beacon_rates_idx = mt7925_get_rates_table(hw, vif, true, false); mt7925_mcu_uni_add_beacon_offload(dev, hw, vif, From patchwork Sat Jul 6 08:28: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: 13725778 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 36F0AC3DA40 for ; Sat, 6 Jul 2024 08:29: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=l6JgbGlLloDOsdCpCL/NF0E12c2AZhS/thZxd2FKNmc=; b=Qnuds9/hwvz8amw0QzqNHkrMTQ Ylfi+A6pGJsOzCrSsRbsk9DuCBjuSyaB0tpaZaNIojhEdyeIEk5TlatixpIwRmWK1AJIHEYG4EA5A lt2qjhdEJCed0hFQ/ztGorLK184xVlWH2+SQb6wp0gfVxAF0SeKK9J11C5if8vLfbO7hew8NuG5Br 7maX9BrqnhtMAkm5pzZ+fEmGOicSnE/0Jh6gXznqthQ7hhKO0AEwpP/1QSmeQ4s7eVfiyFgyS+Mvt uCyOjad30ytMcwmArfzE3/4FIfp4HrNH71o5OyvVLh6swPJR70+4+G+CMdlbGyP7lCvJzjIgBkUt7 Z7m5myyA==; Received: from localhost ([::1] helo=bombadil.infradead.org) by bombadil.infradead.org with esmtp (Exim 4.97.1 #2 (Red Hat Linux)) id 1sQ0n2-0000000HY64-3BSJ; Sat, 06 Jul 2024 08:29:05 +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 1sQ0n0-0000000HY3p-0ztL for linux-mediatek@lists.infradead.org; Sat, 06 Jul 2024 08:29:03 +0000 Received: by mail-oa1-f52.google.com with SMTP id 586e51a60fabf-24c5ec50da1so284893fac.3 for ; Sat, 06 Jul 2024 01:29:01 -0700 (PDT) X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1720254541; x=1720859341; 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=l6JgbGlLloDOsdCpCL/NF0E12c2AZhS/thZxd2FKNmc=; b=wFFdOsRA46ZraYWhh51LPlitBUeuz42wQp5JrWocs7V0GMjxjZeLj8Hgowp4J2AAOB nsQ58eewmTqtT3v+1dQd8jzjT++qnGhKCWMeJ/bZbjoooSEGb1ZlKK4zCKDkC20gn14v XfGbBEbGPtx/POasNJvBLE+GBUi+K0Rjx8Tq3xoWO1yEbKzCYhoMqjhtOF0kxMnF1ooz vo+Ex8Q9ot17p3ANDyHKoDcD2XasZNHFSmquqerotSr6I7emKYC9XyxBY3Qng6RaY8aQ ipYFGTY6e1bOHfZvqpfisK9AZNBdPw+lqXKkAVO7eIuk/3fx9bD+tOY4aQUSqoQ37h2Z NJtg== X-Forwarded-Encrypted: i=1; AJvYcCUK091af38ffD3m0ddOlliA4ewdsHI8r7BjpZprr5+9B7vdJtvJBz13FUvMx6PurT80uOSFVeTnkSyd6hY2xSRd17DJ8ufIXHz64EwhhkwoUgYj X-Gm-Message-State: AOJu0Yxmuc1TVakSIwUn5BWWbWXxBodOj6a/HX4PrtLHz1/AmEYtUrv/ Avj1HhCaiRe7oSr/SEeMlOoTW+VgjcIHOSnkafdWA0Kd8ThCXRhC7jvMW3p1 X-Google-Smtp-Source: AGHT+IEfuTTj9gDVp9lM/598TllXNNPv45c5rNz254+YfkdsEpTbczD8iLScDxGA1PCnoOpkitpzCw== X-Received: by 2002:a05:6871:54a:b0:25d:f237:e108 with SMTP id 586e51a60fabf-25e2b5a1bfcmr6904185fac.0.1720254541141; Sat, 06 Jul 2024 01:29:01 -0700 (PDT) Received: from sean-ThinkPad-T450s.attlocal.net ([2600:1702:5083:7610:1e13:57ab:ecc5:1fd4]) by smtp.gmail.com with ESMTPSA id 586e51a60fabf-25e71070ba1sm10744fac.34.2024.07.06.01.28.59 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Sat, 06 Jul 2024 01:28:59 -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 v2 23/37] wifi: mt76: mt7925: report link information in rx status Date: Sat, 6 Jul 2024 01:28:03 -0700 Message-Id: X-Mailer: git-send-email 2.25.1 In-Reply-To: References: MIME-Version: 1.0 X-CRM114-Version: 20100106-BlameMichelson ( TRE 0.8.0 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20240706_012902_328510_0E62F087 X-CRM114-Status: GOOD ( 10.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 report link information in rx status 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/mac80211.c | 5 +++++ drivers/net/wireless/mediatek/mt76/mt76.h | 1 + drivers/net/wireless/mediatek/mt76/mt7925/main.c | 2 ++ 3 files changed, 8 insertions(+) diff --git a/drivers/net/wireless/mediatek/mt76/mac80211.c b/drivers/net/wireless/mediatek/mt76/mac80211.c index e8ba2e4e8484..bb291fe314fb 100644 --- a/drivers/net/wireless/mediatek/mt76/mac80211.c +++ b/drivers/net/wireless/mediatek/mt76/mac80211.c @@ -1125,6 +1125,11 @@ mt76_rx_convert(struct mt76_dev *dev, struct sk_buff *skb, memcpy(status->chain_signal, mstat.chain_signal, sizeof(mstat.chain_signal)); + if (mstat.wcid) { + status->link_valid = mstat.wcid->link_valid; + status->link_id = mstat.wcid->link_id; + } + *sta = wcid_to_sta(mstat.wcid); *hw = mt76_phy_hw(dev, mstat.phy_idx); } diff --git a/drivers/net/wireless/mediatek/mt76/mt76.h b/drivers/net/wireless/mediatek/mt76/mt76.h index daf1e43e304e..e1d30326f5af 100644 --- a/drivers/net/wireless/mediatek/mt76/mt76.h +++ b/drivers/net/wireless/mediatek/mt76/mt76.h @@ -350,6 +350,7 @@ struct mt76_wcid { u8 amsdu:1; u8 phy_idx:2; u8 link_id:4; + bool link_valid; u8 rx_check_pn; u8 rx_key_pn[IEEE80211_NUM_TIDS + 1][6]; diff --git a/drivers/net/wireless/mediatek/mt76/mt7925/main.c b/drivers/net/wireless/mediatek/mt76/mt7925/main.c index e1af5b4179b0..1a6a0b56a23e 100644 --- a/drivers/net/wireless/mediatek/mt76/mt7925/main.c +++ b/drivers/net/wireless/mediatek/mt76/mt7925/main.c @@ -811,6 +811,7 @@ static int mt7925_mac_link_sta_add(struct mt76_dev *mdev, mlink->wcid.tx_info |= MT_WCID_TX_INFO_SET; mlink->last_txs = jiffies; mlink->wcid.link_id = link_sta->link_id; + mlink->wcid.link_valid = !!link_sta->sta->valid_links; ret = mt76_connac_pm_wake(&dev->mphy, &dev->pm); if (ret) @@ -1898,6 +1899,7 @@ mt7925_change_vif_links(struct ieee80211_hw *hw, struct ieee80211_vif *vif, mconf->link_id = link_id; mconf->vif = mvif; mlink->wcid.link_id = link_id; + mlink->wcid.link_valid = !!vif->valid_links; } if (hweight16(mvif->valid_links) == 0) From patchwork Sat Jul 6 08:28: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: 13725779 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 AE0D4C2BD09 for ; Sat, 6 Jul 2024 08:29:07 +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=eNbrfo87WUKSPAzqY+ihQ88l4268XCP8og2J9dUfydM=; b=lrPsB36ilLr/5vYtt+QHeV7axz Mn9spvyFeCf56qtVSC0XeLiv4X9PzG6XEG4Z+jxjHC7Q9ZVrua4R+/fj/+bwib+f3fV1FqOrQfEl3 BG5DQrSFTV+dxVzvCtbzp/FFQyA5onk/17kNmDIWKshRzyI5mEv53JDsGsCoaraYRehiDDJBej+y3 /IVDs7TDUngCR0grsNBHj3/c2J09WLcp+Uak4wnGudAetHs2xT8VRYBO31l0HGU1ifkA0YPNJUM7u 29LbqPZCC4O/fRAHpoiFaMrjKE3h7aSLXlF3rtFnwlQr/9yb+Nn21IWMwce21AqCjBGBD27fbwL4S DbbEAJGA==; Received: from localhost ([::1] helo=bombadil.infradead.org) by bombadil.infradead.org with esmtp (Exim 4.97.1 #2 (Red Hat Linux)) id 1sQ0n5-0000000HY7v-1Ncv; Sat, 06 Jul 2024 08:29:07 +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 1sQ0n1-0000000HY4y-3Mzc for linux-mediatek@lists.infradead.org; Sat, 06 Jul 2024 08:29:05 +0000 Received: by mail-oo1-f50.google.com with SMTP id 006d021491bc7-5c229104335so56222eaf.3 for ; Sat, 06 Jul 2024 01:29:03 -0700 (PDT) X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1720254543; x=1720859343; 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=eNbrfo87WUKSPAzqY+ihQ88l4268XCP8og2J9dUfydM=; b=SaiIN1j/JZduojChLXQSniH6YD324YnwE822olVLRdqTbpXgjrwIgBoEyCXIdNEaaR uHvn+BLlkiLmeYTvFMZWvJ3nCROdalTJU2Uv3FteQjnDFWfnPJ8+Wu5N2PTRyPvC2zHs xF6X1Ir8vShgmNdDBOc9ckPYsUuSTwkqIt3pnxo9jgH1psYvCyCxX1oAfoMUpEXqEsn0 kdr4LStsuamSpK/Pw8YumX+aVLSp8uBF2p3MY1qacs3XBy5/JTMThzfkUgyMyWFTLbLY 6Xs8ygKcghznB9zjFykbgrsSqqcF0gYOP2N6hU8+OuRmpbNqLxOGPLkLwMBKyAQsjXKo AdJg== X-Forwarded-Encrypted: i=1; AJvYcCWdzXSvMCduMj5Zi0j4vNqbVT/RTwqgzKmBPKJeXq/De8dJNt2L+lz2lTHwiZOrJQJB90BhA27Eu+D5ZVCjCHUroRSa4/gzcUumF09T3GcTTJ34 X-Gm-Message-State: AOJu0Yx+XYgZQCEnQGAX+J8ZjfoH/leG+x9+OlHCBXn28pwPYEseWYvi tp7r4pEPY5cmeQGhUWweT2LPO7474lW5r8yxR//f3geuj8ZeftMO X-Google-Smtp-Source: AGHT+IE4D1UPCBu4Iu6dQf7UbTChRc3rtaYw8RQe/rJ50IyYMe1udypfb6btw6+/ex9AYP2IIke5wQ== X-Received: by 2002:a05:6871:7988:b0:254:a7df:721b with SMTP id 586e51a60fabf-25e2c06c433mr6843442fac.5.1720254542869; Sat, 06 Jul 2024 01:29:02 -0700 (PDT) Received: from sean-ThinkPad-T450s.attlocal.net ([2600:1702:5083:7610:1e13:57ab:ecc5:1fd4]) by smtp.gmail.com with ESMTPSA id 586e51a60fabf-25e71070ba1sm10744fac.34.2024.07.06.01.29.01 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Sat, 06 Jul 2024 01:29: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 v2 24/37] wifi: mt76: add def_wcid to struct mt76_wcid Date: Sat, 6 Jul 2024 01:28:04 -0700 Message-Id: X-Mailer: git-send-email 2.25.1 In-Reply-To: References: MIME-Version: 1.0 X-CRM114-Version: 20100106-BlameMichelson ( TRE 0.8.0 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20240706_012903_878135_7111C868 X-CRM114-Status: GOOD ( 10.72 ) 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 def_wcid to struct mt76_wcid to allow per-link wcid to retrieve the struct ieee80211_sta structure. 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.h | 5 +++++ drivers/net/wireless/mediatek/mt76/mt7925/main.c | 2 ++ 2 files changed, 7 insertions(+) diff --git a/drivers/net/wireless/mediatek/mt76/mt76.h b/drivers/net/wireless/mediatek/mt76/mt76.h index e1d30326f5af..5f8773364d51 100644 --- a/drivers/net/wireless/mediatek/mt76/mt76.h +++ b/drivers/net/wireless/mediatek/mt76/mt76.h @@ -368,6 +368,8 @@ struct mt76_wcid { struct mt76_sta_stats stats; struct list_head poll_list; + + struct mt76_wcid *def_wcid; }; struct mt76_txq { @@ -1258,6 +1260,9 @@ wcid_to_sta(struct mt76_wcid *wcid) if (!wcid || !wcid->sta) return NULL; + if (wcid->def_wcid) + ptr = wcid->def_wcid; + return container_of(ptr, struct ieee80211_sta, drv_priv); } diff --git a/drivers/net/wireless/mediatek/mt76/mt7925/main.c b/drivers/net/wireless/mediatek/mt76/mt7925/main.c index 1a6a0b56a23e..dabfb8eca686 100644 --- a/drivers/net/wireless/mediatek/mt76/mt7925/main.c +++ b/drivers/net/wireless/mediatek/mt76/mt7925/main.c @@ -892,6 +892,7 @@ mt7925_mac_sta_add_links(struct mt792x_dev *dev, struct ieee80211_vif *vif, rcu_assign_pointer(msta->link[link_id], mlink); mlink->sta = msta; mlink->pri_link = &sta->deflink; + mlink->wcid.def_wcid = &msta->deflink.wcid; link_sta = mt792x_sta_to_link_sta(vif, sta, link_id); mt7925_mac_link_sta_add(&dev->mt76, vif, link_sta); @@ -1900,6 +1901,7 @@ mt7925_change_vif_links(struct ieee80211_hw *hw, struct ieee80211_vif *vif, mconf->vif = mvif; mlink->wcid.link_id = link_id; mlink->wcid.link_valid = !!vif->valid_links; + mlink->wcid.def_wcid = &mvif->sta.deflink.wcid; } if (hweight16(mvif->valid_links) == 0) From patchwork Sat Jul 6 08:28: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: 13725780 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 23A6CC3DA42 for ; Sat, 6 Jul 2024 08:29:08 +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=qypwLl0mwyWHqK5nU8Jdk8GJ4MWZIRMXr/vMXZfeI4o=; b=KMmAw6a+srY859ldXmicry8jsF kE1xzIr5lYoDqX21hzRtyPdy8tFQITe2RW4r5AEKIMvLmMh6rx4ITuaeziwtUbrrJFcCjlAerdZQ1 KW9JQMZwVV+gSH8R61nWDdFzJJinu5HyikJEWACO4T0M+ro8qclHtVwsVbRdH1pHM8a4hvjY7ECUv qUil5sWFnUqCXe6LNGflWg6omSVVyW8Zfdc+AZOHPS3mvWMcIh8U/o6Hj9D9PX3yx+3vEg8TeuAz7 ljP1QVV7AbUvNsnpXtmXpkVMheKn2bxc3fe700RkYc890jpIl4/R+GEWLrA5EkJQcqz/u70DGWzGD zj/Gy3pg==; Received: from localhost ([::1] helo=bombadil.infradead.org) by bombadil.infradead.org with esmtp (Exim 4.97.1 #2 (Red Hat Linux)) id 1sQ0n5-0000000HY8Q-32In; Sat, 06 Jul 2024 08:29:07 +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 1sQ0n3-0000000HY69-1hbV for linux-mediatek@lists.infradead.org; Sat, 06 Jul 2024 08:29:06 +0000 Received: by mail-oa1-f49.google.com with SMTP id 586e51a60fabf-254925e6472so364189fac.0 for ; Sat, 06 Jul 2024 01:29:05 -0700 (PDT) X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1720254544; x=1720859344; 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=qypwLl0mwyWHqK5nU8Jdk8GJ4MWZIRMXr/vMXZfeI4o=; b=eY3B4MtwZYW7zl0Bec+bMbtvHiEPFTxNeVLE0MpS4ZUYHpncEo/AxaIiKc89WXQwSf aJXWY9qdS45P/4vxDAILPTRwwUaecSD/R0maVpaBF84Q99ZtFB9ByodWgps+eJfE2Ld5 r2sH0qJ/SveO/stwVeR0nyZdYBusSge94TG/B+xnAzwrVFTBDRWX4L7iqEDLx4bGP7sf CbeiYfdJZmqoAsDrx00VdJl/NOq/RRCkkNar60dw2NUL6iRjl2NEOeA6HvVu9o6VmVc4 ob7Qr9lBv5Z2jRvcng9ffkdpy/KbHIJoUH83HixRNHs8K/zmDOEw4n9CkBVY9TQUFPC5 9Irw== X-Forwarded-Encrypted: i=1; AJvYcCX68y4kZH8m53orj559lghaa6JbLDVcSiQWYbRMMarNj+K5vVaUQHzW+7yqN27A+52xVcD/iSLyqgoxntzl69iRB4oSAkivhy9pSS8XTPE+FqUc X-Gm-Message-State: AOJu0YwneWvQz41ZLBaeJ3dATCb6c66ksYDqoVqurr+6XCVOSzVIdq63 21q8C1eyTcM5zxDwHdCc13QtuAB71sXlaPX/9zFlO9ZWffND02II X-Google-Smtp-Source: AGHT+IFAu8L9vVPgIY5YNB7KoDorB2YZHSKha+nUgCsbxCPIACTWoPEncAfPQH/TpDKqm/w6cbkeBg== X-Received: by 2002:a05:6871:24d9:b0:254:affe:5a08 with SMTP id 586e51a60fabf-25e2ba1b287mr6407103fac.2.1720254544551; Sat, 06 Jul 2024 01:29:04 -0700 (PDT) Received: from sean-ThinkPad-T450s.attlocal.net ([2600:1702:5083:7610:1e13:57ab:ecc5:1fd4]) by smtp.gmail.com with ESMTPSA id 586e51a60fabf-25e71070ba1sm10744fac.34.2024.07.06.01.29.02 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Sat, 06 Jul 2024 01:29: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 v2 25/37] wifi: mt76: mt7925: add mt7925_[assign,unassign]_vif_chanctx Date: Sat, 6 Jul 2024 01:28:05 -0700 Message-Id: <15261879a16cb12674d6dea7703410baa6883799.1720248331.git.sean.wang@kernel.org> X-Mailer: git-send-email 2.25.1 In-Reply-To: References: MIME-Version: 1.0 X-CRM114-Version: 20100106-BlameMichelson ( TRE 0.8.0 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20240706_012905_480896_16F127B2 X-CRM114-Status: GOOD ( 16.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: Sean Wang add mt7925_[assign,unassign]_vif_chanctx to assign and unassign chanctx to the specific link configuration. If the chctx is not pass in the parameter, we will look up the channel information from link_conf->chanreq.oper. 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/main.c | 75 ++++++++++++++++++- .../net/wireless/mediatek/mt76/mt7925/mcu.c | 17 +++-- .../net/wireless/mediatek/mt76/mt7925/mcu.h | 1 + 3 files changed, 82 insertions(+), 11 deletions(-) diff --git a/drivers/net/wireless/mediatek/mt76/mt7925/main.c b/drivers/net/wireless/mediatek/mt76/mt7925/main.c index dabfb8eca686..44d9da5aadd1 100644 --- a/drivers/net/wireless/mediatek/mt76/mt7925/main.c +++ b/drivers/net/wireless/mediatek/mt76/mt7925/main.c @@ -1730,8 +1730,13 @@ mt7925_change_chanctx(struct ieee80211_hw *hw, mconf = &mvif->bss_conf; } - if (mconf) - mt7925_mcu_set_chctx(mvif->phy->mt76, &mconf->mt76, ctx); + if (mconf) { + struct ieee80211_bss_conf *link_conf; + + link_conf = mt792x_vif_to_bss_conf(vif, mconf->link_id); + mt7925_mcu_set_chctx(mvif->phy->mt76, &mconf->mt76, + link_conf, ctx); + } } mt792x_mutex_release(phy->dev); @@ -1978,6 +1983,68 @@ mt7925_change_sta_links(struct ieee80211_hw *hw, struct ieee80211_vif *vif, return err; } +static int mt7925_assign_vif_chanctx(struct ieee80211_hw *hw, + struct ieee80211_vif *vif, + 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); + struct ieee80211_bss_conf *pri_link_conf; + struct mt792x_bss_conf *mconf; + + mutex_lock(&dev->mt76.mutex); + + if (ieee80211_vif_is_mld(vif)) { + mconf = mt792x_vif_to_link(mvif, link_conf->link_id); + pri_link_conf = mt792x_vif_to_bss_conf(vif, mvif->deflink_id); + + if (vif->type == NL80211_IFTYPE_STATION && + mconf == &mvif->bss_conf) + mt7925_mcu_add_bss_info(&dev->phy, NULL, pri_link_conf, + NULL, true); + } else { + mconf = &mvif->bss_conf; + } + + mconf->mt76.ctx = ctx; + mctx->bss_conf = mconf; + mutex_unlock(&dev->mt76.mutex); + + return 0; +} + +static void mt7925_unassign_vif_chanctx(struct ieee80211_hw *hw, + struct ieee80211_vif *vif, + 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); + struct ieee80211_bss_conf *pri_link_conf; + struct mt792x_bss_conf *mconf; + + mutex_lock(&dev->mt76.mutex); + + if (ieee80211_vif_is_mld(vif)) { + mconf = mt792x_vif_to_link(mvif, link_conf->link_id); + pri_link_conf = mt792x_vif_to_bss_conf(vif, mvif->deflink_id); + + if (vif->type == NL80211_IFTYPE_STATION && + mconf == &mvif->bss_conf) + mt7925_mcu_add_bss_info(&dev->phy, NULL, pri_link_conf, + NULL, false); + } else { + mconf = &mvif->bss_conf; + } + + mctx->bss_conf = NULL; + mconf->mt76.ctx = NULL; + mutex_unlock(&dev->mt76.mutex); +} + const struct ieee80211_ops mt7925_ops = { .tx = mt792x_tx, .start = mt7925_start, @@ -2030,8 +2097,8 @@ const struct ieee80211_ops mt7925_ops = { .add_chanctx = mt7925_add_chanctx, .remove_chanctx = mt7925_remove_chanctx, .change_chanctx = mt7925_change_chanctx, - .assign_vif_chanctx = mt792x_assign_vif_chanctx, - .unassign_vif_chanctx = mt792x_unassign_vif_chanctx, + .assign_vif_chanctx = mt7925_assign_vif_chanctx, + .unassign_vif_chanctx = mt7925_unassign_vif_chanctx, .mgd_prepare_tx = mt7925_mgd_prepare_tx, .mgd_complete_tx = mt7925_mgd_complete_tx, .vif_cfg_changed = mt7925_vif_cfg_changed, diff --git a/drivers/net/wireless/mediatek/mt76/mt7925/mcu.c b/drivers/net/wireless/mediatek/mt76/mt7925/mcu.c index 3d5eaeb96047..5979e47ec142 100644 --- a/drivers/net/wireless/mediatek/mt76/mt7925/mcu.c +++ b/drivers/net/wireless/mediatek/mt76/mt7925/mcu.c @@ -2083,9 +2083,11 @@ mt7925_mcu_uni_add_beacon_offload(struct mt792x_dev *dev, static void mt7925_mcu_bss_rlm_tlv(struct sk_buff *skb, struct mt76_phy *phy, + struct ieee80211_bss_conf *link_conf, struct ieee80211_chanctx_conf *ctx) { - struct cfg80211_chan_def *chandef = ctx ? &ctx->def : &phy->chandef; + struct cfg80211_chan_def *chandef = ctx ? &ctx->def : + &link_conf->chanreq.oper; int freq1 = chandef->center_freq1, freq2 = chandef->center_freq2; enum nl80211_band band = chandef->chan->band; struct bss_rlm_tlv *req; @@ -2152,6 +2154,7 @@ __mt7925_mcu_alloc_bss_req(struct mt76_dev *dev, struct mt76_vif *mvif, int len) } int mt7925_mcu_set_chctx(struct mt76_phy *phy, struct mt76_vif *mvif, + struct ieee80211_bss_conf *link_conf, struct ieee80211_chanctx_conf *ctx) { struct sk_buff *skb; @@ -2161,7 +2164,7 @@ int mt7925_mcu_set_chctx(struct mt76_phy *phy, struct mt76_vif *mvif, if (IS_ERR(skb)) return PTR_ERR(skb); - mt7925_mcu_bss_rlm_tlv(skb, phy, ctx); + mt7925_mcu_bss_rlm_tlv(skb, phy, link_conf, ctx); return mt76_mcu_skb_send_msg(phy->dev, skb, MCU_UNI_CMD(BSS_INFO_UPDATE), true); @@ -2223,7 +2226,8 @@ mt7925_mcu_bss_basic_tlv(struct sk_buff *skb, { struct ieee80211_vif *vif = link_conf->vif; struct mt792x_bss_conf *mconf = mt792x_link_conf_to_mconf(link_conf); - struct cfg80211_chan_def *chandef = ctx ? &ctx->def : &phy->chandef; + struct cfg80211_chan_def *chandef = ctx ? &ctx->def : + &link_conf->chanreq.oper; enum nl80211_band band = chandef->chan->band; struct mt76_connac_bss_basic_tlv *basic_req; struct mt792x_link_sta *mlink; @@ -2348,7 +2352,8 @@ 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 cfg80211_chan_def *chandef = ctx ? &ctx->def : &phy->mt76->chandef; + struct cfg80211_chan_def *chandef = ctx ? &ctx->def : + &link_conf->chanreq.oper; 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; @@ -2488,8 +2493,6 @@ 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; @@ -2513,7 +2516,7 @@ int mt7925_mcu_add_bss_info(struct mt792x_phy *phy, mt7925_mcu_bss_color_tlv(skb, link_conf, enable); } - mt7925_mcu_bss_rlm_tlv(skb, phy->mt76, mconf->mt76.ctx); + mt7925_mcu_bss_rlm_tlv(skb, phy->mt76, link_conf, ctx); 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 7fb46cad9157..6ae5286385d9 100644 --- a/drivers/net/wireless/mediatek/mt76/mt7925/mcu.h +++ b/drivers/net/wireless/mediatek/mt76/mt7925/mcu.h @@ -623,6 +623,7 @@ 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); int mt7925_mcu_set_chctx(struct mt76_phy *phy, struct mt76_vif *mvif, + struct ieee80211_bss_conf *link_conf, 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, From patchwork Sat Jul 6 08:28: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: 13725781 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 46B48C38150 for ; Sat, 6 Jul 2024 08:29:11 +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=qhnUBU60MyvNT6yMvKJrua9PvBBIIll209q9635BY68=; b=gperTmJuoYecQ0BZPcr4Rlu0x4 aGlOFW6pDsh5gE2Bio9id7W1yobPhxfKYhFTAJxueHXkQMNhejj1P7KIekraJcLN1ulT4kf7l3K/R QgXSRwNPx7ZPH5/m3FiqoUp4bQYo0pq3bTcK46fiydy1GwyDLvhYjNEhxlowVisxHTTfgfvGsIfKD asX7ayF9UoR80M/OTIEZXprGSh4sPUILSk8tArODk1AdH+P6w6opeq0FZoKtTzOeXW9sflFhYD7Zt qDv7oSowdcx3Wg4dIA7JtHZaIXVjZA6leK2i2bTo0JQzLCsg7y4Fbs/q8qKWFEqVsPlfO8uXskdRM 2eSSVhow==; Received: from localhost ([::1] helo=bombadil.infradead.org) by bombadil.infradead.org with esmtp (Exim 4.97.1 #2 (Red Hat Linux)) id 1sQ0n8-0000000HYAF-2Loq; Sat, 06 Jul 2024 08:29:10 +0000 Received: from mail-oa1-f48.google.com ([209.85.160.48]) by bombadil.infradead.org with esmtps (Exim 4.97.1 #2 (Red Hat Linux)) id 1sQ0n5-0000000HY7Y-0wwu for linux-mediatek@lists.infradead.org; Sat, 06 Jul 2024 08:29:08 +0000 Received: by mail-oa1-f48.google.com with SMTP id 586e51a60fabf-25075f3f472so367205fac.2 for ; Sat, 06 Jul 2024 01:29:07 -0700 (PDT) X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1720254546; x=1720859346; 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=qhnUBU60MyvNT6yMvKJrua9PvBBIIll209q9635BY68=; b=rS/OcCz8aBCMYUcOBjN7OZQcJmFhNuGQD0+tM9FO0prUe5/vQ3uaaCuF87qwdUVy5P lEQ2IcsqG9vAoPWDGkbIxAeuEeYVo86yWtqtb20AVrBfccEuC82tL+h4NArDrRURF++s sAzSuz4HbDS5tEIPM0/ay3KoqrM4O0joiflK0GRFdt01UIsLZacwVYeg7NVGwZURRGtD /FCiFTnxOXcIXy0pPVrbGhUTbJcQQqKg25SLUgiog5eUkddihlmdH6VuMOeffyxfqHnt qHjdNytLGywz5NcCcnGs1vXEzVC4STSKL0iNr/NZDSXJpVGD8tU8AgZxbXMHWPZyYjus 3G9w== X-Forwarded-Encrypted: i=1; AJvYcCUnEKja4O0XE4EhLW0EztAYs6Tj/8eAnnW+I5M1DmtoV7WSzoprHgquwZj7BlCXpJtMKkOI+4x7QmyybXlMCstAt+jCmLCZRlP/4K3ZpNxqM0WT X-Gm-Message-State: AOJu0Yz/EuLoCDXEBjJCGhkhhDt4FJP5MToINTTqX8SZ7zWZefoJlVDG nupF94TXUu9AG96Bda+UppMrU7pTE/R2jH0/cFr0rXgvGH4j2dxx X-Google-Smtp-Source: AGHT+IEyOyEgiWCFYHlQ8tMVIY3cVVU0h6WFWzQMhDKRCO3slBlIGxIzEP3u1EdVxFniuPB4ilWljg== X-Received: by 2002:a05:6871:798e:b0:25e:15e1:35c6 with SMTP id 586e51a60fabf-25e2b5af44dmr6351944fac.0.1720254546253; Sat, 06 Jul 2024 01:29:06 -0700 (PDT) Received: from sean-ThinkPad-T450s.attlocal.net ([2600:1702:5083:7610:1e13:57ab:ecc5:1fd4]) by smtp.gmail.com with ESMTPSA id 586e51a60fabf-25e71070ba1sm10744fac.34.2024.07.06.01.29.04 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Sat, 06 Jul 2024 01:29: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 v2 26/37] wifi: mt76: mt7925: update mt7925_mcu_sta_mld_tlv for MLO Date: Sat, 6 Jul 2024 01:28:06 -0700 Message-Id: <25ea3ffd3875083577ab440ec63f3dcd9dc233f4.1720248331.git.sean.wang@kernel.org> X-Mailer: git-send-email 2.25.1 In-Reply-To: References: MIME-Version: 1.0 X-CRM114-Version: 20100106-BlameMichelson ( TRE 0.8.0 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20240706_012907_355364_1C02087F 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 Update mt7925_mcu_sta_mld_tlv for the MLO-enabled firmware. 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 | 29 ++++++++++++++----- 1 file changed, 22 insertions(+), 7 deletions(-) diff --git a/drivers/net/wireless/mediatek/mt76/mt7925/mcu.c b/drivers/net/wireless/mediatek/mt76/mt7925/mcu.c index 5979e47ec142..38e2ac5efb6b 100644 --- a/drivers/net/wireless/mediatek/mt76/mt7925/mcu.c +++ b/drivers/net/wireless/mediatek/mt76/mt7925/mcu.c @@ -1742,19 +1742,34 @@ static void mt7925_mcu_sta_mld_tlv(struct sk_buff *skb, struct ieee80211_vif *vif, struct ieee80211_sta *sta) { - struct mt76_wcid *wcid = (struct mt76_wcid *)sta->drv_priv; + struct mt792x_vif *mvif = (struct mt792x_vif *)vif->drv_priv; + struct mt792x_sta *msta = (struct mt792x_sta *)sta->drv_priv; + unsigned long valid = mvif->valid_links; + struct mt792x_bss_conf *mconf; + struct mt792x_link_sta *mlink; struct sta_rec_mld *mld; struct tlv *tlv; + int i, cnt = 0; tlv = mt76_connac_mcu_add_tlv(skb, STA_REC_MLD, sizeof(*mld)); mld = (struct sta_rec_mld *)tlv; - memcpy(mld->mac_addr, vif->addr, ETH_ALEN); - mld->primary_id = cpu_to_le16(wcid->idx); - mld->wlan_id = cpu_to_le16(wcid->idx); + memcpy(mld->mac_addr, sta->addr, ETH_ALEN); + mld->primary_id = cpu_to_le16(msta->deflink.wcid.idx); + mld->wlan_id = cpu_to_le16(msta->deflink.wcid.idx); + mld->link_num = min_t(u8, hweight16(mvif->valid_links), 2); + + for_each_set_bit(i, &valid, IEEE80211_MLD_MAX_NUM_LINKS) { + if (cnt == mld->link_num) + break; - /* TODO: 0 means deflink only, add secondary link(1) later */ - mld->link_num = !!(hweight8(vif->active_links) > 1); - WARN_ON_ONCE(mld->link_num); + mconf = mt792x_vif_to_link(mvif, i); + mlink = mt792x_sta_to_link(msta, i); + mld->link[cnt].wlan_id = cpu_to_le16(mlink->wcid.idx); + mld->link[cnt++].bss_idx = cpu_to_le16(mconf->mt76.idx); + + if (mlink != &msta->deflink) + mld->secondary_id = cpu_to_le16(mlink->wcid.idx); + } } static int From patchwork Sat Jul 6 08:28: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: 13725782 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 66A3FC2BD09 for ; Sat, 6 Jul 2024 08:29: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=0SdoXLXIu+HvSjVwv2ngUt5gbyZnRN7Gqj36N7mgsJo=; b=mxI8bpqIhdUpJ0LjQ5s+YSI0Xs MSUq0xk/gAsUJwZIANgCpriYGjpcEaA7D0o3C9GNSaezqQQvES8P4eiGJrWj+z+ICxKpd44gJGTSo JFUMGyeILToUe1siboo1dmYCUjDAdelTXXE8IMIVPM6JTFNfH8Qm39sWWqilofttny4Lj2K1LVoFA Dj80AW+6ITg0Vljq3Bt7qJnecaRYPL+lY+SBc2PERY2x5YkHLBtg6XVb4cHQIU7L7bbS9Xu8Euu6g LIhxiCNpoJRulQZvxWvaeIsg7yArRuJuH+JvbLHtzEyDGEYkelXzj29yAYOOpT0bk9SiDuNP9pzjB Z+J8cxbA==; Received: from localhost ([::1] helo=bombadil.infradead.org) by bombadil.infradead.org with esmtp (Exim 4.97.1 #2 (Red Hat Linux)) id 1sQ0nB-0000000HYBz-0GX1; Sat, 06 Jul 2024 08:29:13 +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 1sQ0n7-0000000HY9K-243A for linux-mediatek@lists.infradead.org; Sat, 06 Jul 2024 08:29:11 +0000 Received: by mail-oo1-f53.google.com with SMTP id 006d021491bc7-5c66c4c30bfso4137eaf.2 for ; Sat, 06 Jul 2024 01:29:09 -0700 (PDT) X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1720254548; x=1720859348; 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=0SdoXLXIu+HvSjVwv2ngUt5gbyZnRN7Gqj36N7mgsJo=; b=f63tVS3OmXGrR6/jC03bshdbMeZwLV44MsqZs3AUab2RwivBQRLXYVFNg7g1L8RAQ7 fCG5EngcY0srjhHlHOAZvNNvrKibJ8Yk6iQKgdzgy763C6cM5dYI8GX/0B+zZgvqRr7p DeQX6dsP9kIrQPD809E/sV1HFic/rtLk+VplxXoSvTIIaRBSSfaIHTofuJ1qULKBMWwp 89UMCKYEbOiOchWJEANRCJOYKzfZ1I5n+SlcSiUvRX0RcjywAG3Ma/3DfxmhlTanm6Bh S/+ojwvqyGIoIwoG8ylGoCPh445r42HNuYCSoWzVpBnU6OmpqEIfxemKI5RSGxLY4WSu 1UAA== X-Forwarded-Encrypted: i=1; AJvYcCUdQ99Pnb/amxWsRloOS1MZ6TW6rp5er2rKuT4CAkmUHRhOeYokU4gEVuOkIP4kc0GzU9EIseGfUvKlQj29A+b5E2KyEemPbBuK1IgvsWqiN1Z/ X-Gm-Message-State: AOJu0YxSdAxgEF3Op4ikfnkiXtyTAiHbxoqIuuW5Fb/3VHYgsetsmzNn 7af9HICb8Jm9YauLK/ie/Aa8Uy55KtYbwjdx9q5c5vznSHUfPdeQ X-Google-Smtp-Source: AGHT+IFSM1KejwThfKI59psSqbCJd8hsVG0T4rGP3gosGe/XsVKfdWxA91fA4LN2yCedSML9ivzIVA== X-Received: by 2002:a4a:ead8:0:b0:5c6:6aae:b5f5 with SMTP id 006d021491bc7-5c66aaeb9e2mr305319eaf.0.1720254548387; Sat, 06 Jul 2024 01:29:08 -0700 (PDT) Received: from sean-ThinkPad-T450s.attlocal.net ([2600:1702:5083:7610:1e13:57ab:ecc5:1fd4]) by smtp.gmail.com with ESMTPSA id 586e51a60fabf-25e71070ba1sm10744fac.34.2024.07.06.01.29.06 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Sat, 06 Jul 2024 01:29:06 -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 v2 27/37] wifi: mt76: mt7925: update mt7925_mcu_bss_mld_tlv for MLO Date: Sat, 6 Jul 2024 01:28:07 -0700 Message-Id: <2d89b93bcfd92e7c6987aaa0a3c4637e605ac154.1720248331.git.sean.wang@kernel.org> X-Mailer: git-send-email 2.25.1 In-Reply-To: References: MIME-Version: 1.0 X-CRM114-Version: 20100106-BlameMichelson ( TRE 0.8.0 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20240706_012909_653813_51CB6F75 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 update mt7925_mcu_bss_mld_tlv for the MLO-enabled firmware, the change remains compatible with the non-MLO mode and the older firmware. 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 | 22 +++++++++++-------- .../net/wireless/mediatek/mt76/mt7925/mcu.h | 5 ++++- 2 files changed, 17 insertions(+), 10 deletions(-) diff --git a/drivers/net/wireless/mediatek/mt76/mt7925/mcu.c b/drivers/net/wireless/mediatek/mt76/mt7925/mcu.c index 38e2ac5efb6b..53228bbed2c6 100644 --- a/drivers/net/wireless/mediatek/mt76/mt7925/mcu.c +++ b/drivers/net/wireless/mediatek/mt76/mt7925/mcu.c @@ -2393,24 +2393,29 @@ 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_link_sta *link_sta) + struct ieee80211_bss_conf *link_conf) { struct mt792x_bss_conf *mconf = mt792x_link_conf_to_mconf(link_conf); - bool is_mld = ieee80211_vif_is_mld(link_conf->vif); + struct mt792x_vif *mvif = (struct mt792x_vif *)link_conf->vif->drv_priv; struct bss_mld_tlv *mld; struct tlv *tlv; + bool is_mld; + + is_mld = ieee80211_vif_is_mld(link_conf->vif) || + (hweight16(mvif->valid_links) > 1); tlv = mt76_connac_mcu_add_tlv(skb, UNI_BSS_INFO_MLD, sizeof(*mld)); mld = (struct bss_mld_tlv *)tlv; - mld->link_id = link_sta ? (is_mld ? link_conf->link_id : 0) : 0xff; - mld->group_mld_id = is_mld ? mconf->mt76.idx : 0xff; + mld->link_id = is_mld ? link_conf->link_id : 0xff; + /* apply the index of the primary link */ + mld->group_mld_id = is_mld ? mvif->bss_conf.mt76.idx : 0xff; mld->own_mld_id = mconf->mt76.idx + 32; mld->remap_idx = 0xff; + mld->eml_enable = !!(link_conf->vif->cfg.eml_cap & + IEEE80211_EML_CAP_EMLSR_SUPP); - if (link_sta) - memcpy(mld->mac_addr, link_sta->addr, ETH_ALEN); + memcpy(mld->mac_addr, link_conf->addr, ETH_ALEN); } static void @@ -2520,10 +2525,9 @@ int mt7925_mcu_add_bss_info(struct mt792x_phy *phy, 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); - 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); + mt7925_mcu_bss_mld_tlv(skb, link_conf); 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 6ae5286385d9..7b0c6937f918 100644 --- a/drivers/net/wireless/mediatek/mt76/mt7925/mcu.h +++ b/drivers/net/wireless/mediatek/mt76/mt7925/mcu.h @@ -366,7 +366,10 @@ struct bss_mld_tlv { u8 mac_addr[ETH_ALEN]; u8 remap_idx; u8 link_id; - u8 __rsv[2]; + u8 eml_enable; + u8 max_link_num; + u8 hybrid_mode; + u8 __rsv[3]; } __packed; struct sta_rec_ba_uni { From patchwork Sat Jul 6 08:28: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: 13725783 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 E1C03C3DA40 for ; Sat, 6 Jul 2024 08:29: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=6eCwn1bKaG54UOwYd5vhXMu34lcPREipp2grTwGDk8E=; b=Dw0nqckS1F9EIhEg2jC7aHivmM hG6mRK+h7k4CvX6wtAzO74MVO+/AqfbZ3pjRyryOlAJtFwk/p7D4yGg2ehtPCS5au3LHVvJUcG3oo XBHHiKYtHpQHSomnBQAxid93hh/zMdxCGiouQDzLFEz22MvbSw462iMma7/soHwma+kIaPfMqbVlW McQIpmDntS/DAbVUdNa86WT76RJGKwGceEKfRcussLRcOp94kPznNSK2LBZhRom1JzeKyG3xLSVB7 2fMESb12ohpXpMlW9Sig4LGhU66YuLHBX3smOVPSiy4hluCfzWS8fAA+UpEP55CifuOJUd544nPs/ Wp9JtgwA==; Received: from localhost ([::1] helo=bombadil.infradead.org) by bombadil.infradead.org with esmtp (Exim 4.97.1 #2 (Red Hat Linux)) id 1sQ0nB-0000000HYCK-1vCK; Sat, 06 Jul 2024 08:29:13 +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 1sQ0n9-0000000HYAH-12BP for linux-mediatek@lists.infradead.org; Sat, 06 Jul 2024 08:29:12 +0000 Received: by mail-oi1-f171.google.com with SMTP id 5614622812f47-3d92563bea4so14981b6e.3 for ; Sat, 06 Jul 2024 01:29:11 -0700 (PDT) X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1720254550; x=1720859350; 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=6eCwn1bKaG54UOwYd5vhXMu34lcPREipp2grTwGDk8E=; b=jMDdKUOqTN+Il1QyX5steacRsRQCMnHP/i9OFA8XrI2umLJMsdyPdAMMqiRZLUtV3X 2CxwXnmsqB7ynYq7pqUeTLYUUT/YOoAUAtLpRveQahDetmcLimN9gZG7Qa1RUP06nWGw kjoiA9cgenN6LCnZExXJrS+m6+HDXn1Ah3d0neQmvDC+w1+t3UkeN6sKF57kUYj/gYMI nUHN/9zwn5+tXF8ln6b3A7djTKMWJ6mTL5CFuV1px3mzTz46lou2m0ZaPoxPENiVl6ZK fp7GnHyl/GLY0OrJplBMCUPojBoYuD2Lmz65UDr6xtYG3Hby0qWmR2DLlu8A5+e2n6PC /3PQ== X-Forwarded-Encrypted: i=1; AJvYcCXGzhm3C5wO5Y5fQIze7zgGtZpQIugzDEVuXIhd+tRRjDYhq1lwh17aHnYch19t5hn5bWYZZuuI6Zo4ts+hoPDq2O77sdjr0jSjQPHOIeTJOFnY X-Gm-Message-State: AOJu0YypxPesSwL8Jgg1dZun43mH2dP80cXX0O/9Xgx9QoIGP4YW+jeD ozsmB5F5Xr1pgVqzFZzfiBuERU+ClDjzEQ+Oel425Mr6PLRVXvUt X-Google-Smtp-Source: AGHT+IFjkMIRk44IPW3cpLBvfOzwB/4c0UZ9v+0ZttSy9bIgMJdTO7220vFTAdeo69k/NcKoPjt8vA== X-Received: by 2002:a05:6871:54a:b0:25d:f237:e108 with SMTP id 586e51a60fabf-25e2b5a1bfcmr6904305fac.0.1720254549966; Sat, 06 Jul 2024 01:29:09 -0700 (PDT) Received: from sean-ThinkPad-T450s.attlocal.net ([2600:1702:5083:7610:1e13:57ab:ecc5:1fd4]) by smtp.gmail.com with ESMTPSA id 586e51a60fabf-25e71070ba1sm10744fac.34.2024.07.06.01.29.08 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Sat, 06 Jul 2024 01:29: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 v2 28/37] wifi: mt76: mt7925: update mt7925_mcu_add_bss_info for MLO Date: Sat, 6 Jul 2024 01:28:08 -0700 Message-Id: X-Mailer: git-send-email 2.25.1 In-Reply-To: References: MIME-Version: 1.0 X-CRM114-Version: 20100106-BlameMichelson ( TRE 0.8.0 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20240706_012911_313588_F4816A03 X-CRM114-Status: GOOD ( 10.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 Update mt7925_mcu_bss_mld_tlv for the MLO-enabled firmware The change remains compatible with the non-MLO mode and the older firmware. 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, 8 insertions(+), 3 deletions(-) diff --git a/drivers/net/wireless/mediatek/mt76/mt7925/mcu.c b/drivers/net/wireless/mediatek/mt76/mt7925/mcu.c index 53228bbed2c6..2ffd46f16921 100644 --- a/drivers/net/wireless/mediatek/mt76/mt7925/mcu.c +++ b/drivers/net/wireless/mediatek/mt76/mt7925/mcu.c @@ -2513,17 +2513,21 @@ 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_link_conf_to_mconf(link_conf); struct mt792x_dev *dev = phy->dev; + struct mt792x_link_sta *mlink_bc; struct sk_buff *skb; - skb = __mt7925_mcu_alloc_bss_req(&dev->mt76, &mvif->bss_conf.mt76, + skb = __mt7925_mcu_alloc_bss_req(&dev->mt76, &mconf->mt76, MT7925_BSS_UPDATE_MAX_SIZE); if (IS_ERR(skb)) return PTR_ERR(skb); + mlink_bc = mt792x_sta_to_link(&mvif->sta, mconf->link_id); + /* bss_basic must be first */ mt7925_mcu_bss_basic_tlv(skb, link_conf, link_sta, ctx, phy->mt76, - mvif->sta.deflink.wcid.idx, enable); + mlink_bc->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); @@ -2535,7 +2539,8 @@ int mt7925_mcu_add_bss_info(struct mt792x_phy *phy, mt7925_mcu_bss_color_tlv(skb, link_conf, enable); } - mt7925_mcu_bss_rlm_tlv(skb, phy->mt76, link_conf, ctx); + if (enable) + mt7925_mcu_bss_rlm_tlv(skb, phy->mt76, link_conf, ctx); return mt76_mcu_skb_send_msg(&dev->mt76, skb, MCU_UNI_CMD(BSS_INFO_UPDATE), true); From patchwork Sat Jul 6 08:28: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: 13725784 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 ABB68C2BD09 for ; Sat, 6 Jul 2024 08:29:16 +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=1+USdL7ArJsY57rZRvrCt0BwNw+zeRk0nzAefn/Xndk=; b=aqkU3LXLT6tWf72z6l5zNsK5nH 8QZQsp8Lq5jGvOqBprjykv8VxNj2ab9Bi9iJ/1GwNvvSlNscuAdnpRQsdH3K2gqOyQOmibzf/05JK VALQ5GS2Sw9B1dbQjUoqOClReghaXUNSAEZTQVfNkG607AYWuBknW/esg2KH8Oaa9p17XQ3SyQByD lA2DYgVGLc5B1Xo8XNvH6nZY576CskpIu//bm4hkygLtqcw7TOehtfEV8nZ9g4q3enxEEd031F4QR LUvnD4jlNIcCLLQDEgpaqyl1ejEZh1J8rf72i5j/CH9yxm65K+tdrGX5zMoHKw33FlpYlD02d9Y8H wKOMQ6ag==; Received: from localhost ([::1] helo=bombadil.infradead.org) by bombadil.infradead.org with esmtp (Exim 4.97.1 #2 (Red Hat Linux)) id 1sQ0nE-0000000HYE3-0Ac0; Sat, 06 Jul 2024 08:29:16 +0000 Received: from mail-oi1-f169.google.com ([209.85.167.169]) by bombadil.infradead.org with esmtps (Exim 4.97.1 #2 (Red Hat Linux)) id 1sQ0nA-0000000HYBS-2eqQ for linux-mediatek@lists.infradead.org; Sat, 06 Jul 2024 08:29:14 +0000 Received: by mail-oi1-f169.google.com with SMTP id 5614622812f47-3d926517363so7767b6e.3 for ; Sat, 06 Jul 2024 01:29:12 -0700 (PDT) X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1720254552; x=1720859352; 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=1+USdL7ArJsY57rZRvrCt0BwNw+zeRk0nzAefn/Xndk=; b=NcKBsY3YcpCpSFArtqx5ruMry03LRujRIweWA7xNbGhmsFeads7OMd/t6ExeAB9/xc 4V91sywc/c/hKyZsxmmGLw1Tzd/Rv0RGTT8M2ryzSj2cmBuo8K9CY0BAfWwAfhtmeFjV V0qGIWJfEz1v+4dX3JZxyBBiNynJ06LFVlhLjD6GWNZoVQzVRFF+2hFZYr1+TvTwrNYd ppbW6FD/vpxs0XbVcgkRjw8GtG/fOELPvYvhJ+aeRjnIc87DU5BiBalR+lRr9zNy2fBa vr39ZGTxGXM/zbW++z1J9ZqTVVg/ljkCve44sc9BbT+Mywj1OE8P0rl2yTSD/S96ZTb9 aaLw== X-Forwarded-Encrypted: i=1; AJvYcCXbEba6vBhqw1+PMx/PxU+/GY1cTv023VjqV3zcsiyagtTeeQ3GFQZHN5jYYqx9K4NxbFYYvvwQRYSYQIhVE0vaaJCjLq9AxqXx6Ynm76yYsVoA X-Gm-Message-State: AOJu0YzPrO72dEUUMoB5tJ+POTs5Jv28yLLsrPSYLiuGkmt2GDjWef26 P/kCno7SJdLLrkQD8pq/ITxa8D2gwlRPz7Zg38ErN9UmhBHEaJ2i X-Google-Smtp-Source: AGHT+IGP8iOYD5INfWsaL7Vr8mfVbnuHHO04NYvHLKOWfybrC1drsFZxus7lkGSvAzTF3rPmzj+Ipw== X-Received: by 2002:a05:6871:5229:b0:25e:dce:491b with SMTP id 586e51a60fabf-25e2b8b79abmr6843926fac.1.1720254551753; Sat, 06 Jul 2024 01:29:11 -0700 (PDT) Received: from sean-ThinkPad-T450s.attlocal.net ([2600:1702:5083:7610:1e13:57ab:ecc5:1fd4]) by smtp.gmail.com with ESMTPSA id 586e51a60fabf-25e71070ba1sm10744fac.34.2024.07.06.01.29.10 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Sat, 06 Jul 2024 01:29: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 v2 29/37] wifi: mt76: mt7925: update mt7925_mcu_sta_update for MLO Date: Sat, 6 Jul 2024 01:28:09 -0700 Message-Id: <2e25bfc2d8aa503ecd1ba8099c6e54dce0c27b99.1720248331.git.sean.wang@kernel.org> X-Mailer: git-send-email 2.25.1 In-Reply-To: References: MIME-Version: 1.0 X-CRM114-Version: 20100106-BlameMichelson ( TRE 0.8.0 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20240706_012912_741245_3244A573 X-CRM114-Status: GOOD ( 13.75 ) 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 update mt7925_mcu_sta_update for the MLO-enabled firmware. 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 --- .../wireless/mediatek/mt76/mt76_connac_mcu.h | 9 +++ .../net/wireless/mediatek/mt76/mt7925/mcu.c | 68 ++++++++++++++++++- .../net/wireless/mediatek/mt76/mt7925/mcu.h | 3 +- 3 files changed, 78 insertions(+), 2 deletions(-) diff --git a/drivers/net/wireless/mediatek/mt76/mt76_connac_mcu.h b/drivers/net/wireless/mediatek/mt76/mt76_connac_mcu.h index e636b033b87e..9329c959674f 100644 --- a/drivers/net/wireless/mediatek/mt76/mt76_connac_mcu.h +++ b/drivers/net/wireless/mediatek/mt76/mt76_connac_mcu.h @@ -545,6 +545,13 @@ struct sta_rec_muru { } mimo_ul; } __packed; +struct sta_rec_remove { + __le16 tag; + __le16 len; + u8 action; + u8 pad[3]; +} __packed; + struct sta_phy { u8 type; u8 flag; @@ -814,6 +821,8 @@ enum { STA_REC_HE_V2 = 0x19, STA_REC_MLD = 0x20, STA_REC_EHT = 0x22, + STA_REC_MLD_OFF = 0x23, + STA_REC_REMOVE = 0x25, STA_REC_PN_INFO = 0x26, STA_REC_KEY_V3 = 0x27, STA_REC_HDRT = 0x28, diff --git a/drivers/net/wireless/mediatek/mt76/mt7925/mcu.c b/drivers/net/wireless/mediatek/mt76/mt7925/mcu.c index 2ffd46f16921..28e974195be7 100644 --- a/drivers/net/wireless/mediatek/mt76/mt7925/mcu.c +++ b/drivers/net/wireless/mediatek/mt76/mt7925/mcu.c @@ -1812,6 +1812,66 @@ mt7925_mcu_sta_cmd(struct mt76_phy *phy, return mt76_mcu_skb_send_msg(dev, skb, info->cmd, true); } +static void +mt7925_mcu_sta_remove_tlv(struct sk_buff *skb) +{ + struct sta_rec_remove *rem; + struct tlv *tlv; + + tlv = mt76_connac_mcu_add_tlv(skb, 0x25, sizeof(*rem)); + rem = (struct sta_rec_remove *)tlv; + rem->action = 0; +} + +static int +mt7925_mcu_mlo_sta_cmd(struct mt76_phy *phy, + struct mt76_sta_cmd_info *info) +{ + struct mt792x_vif *mvif = (struct mt792x_vif *)info->vif->drv_priv; + struct mt76_dev *dev = phy->dev; + struct mt792x_bss_conf *mconf; + struct sk_buff *skb; + + mconf = mt792x_vif_to_link(mvif, info->wcid->link_id); + + skb = __mt76_connac_mcu_alloc_sta_req(dev, &mconf->mt76, info->wcid, + MT7925_STA_UPDATE_MAX_SIZE); + if (IS_ERR(skb)) + return PTR_ERR(skb); + + if (info->enable) + mt76_connac_mcu_sta_basic_tlv(dev, skb, info->vif, + info->link_sta, + info->enable, info->newly); + + if (info->enable && info->link_sta) { + mt7925_mcu_sta_phy_tlv(skb, info->vif, info->link_sta); + mt7925_mcu_sta_ht_tlv(skb, info->link_sta); + mt7925_mcu_sta_vht_tlv(skb, info->link_sta); + mt76_connac_mcu_sta_uapsd(skb, info->vif, info->link_sta->sta); + mt7925_mcu_sta_amsdu_tlv(skb, info->vif, info->link_sta); + mt7925_mcu_sta_he_tlv(skb, info->link_sta); + mt7925_mcu_sta_he_6g_tlv(skb, info->link_sta); + mt7925_mcu_sta_eht_tlv(skb, info->link_sta); + mt7925_mcu_sta_rate_ctrl_tlv(skb, info->vif, + info->link_sta); + mt7925_mcu_sta_state_v2_tlv(phy, skb, info->link_sta, + info->vif, info->rcpi, + info->state); + if (info->state != MT76_STA_INFO_STATE_NONE) + mt7925_mcu_sta_mld_tlv(skb, info->vif, info->link_sta->sta); + mt7925_mcu_sta_hdr_trans_tlv(skb, info->vif, info->link_sta); + } + + if (!info->enable) { + mt7925_mcu_sta_remove_tlv(skb); + mt76_connac_mcu_add_tlv(skb, STA_REC_MLD_OFF, + sizeof(struct tlv)); + } + + return mt76_mcu_skb_send_msg(dev, skb, info->cmd, true); +} + int mt7925_mcu_sta_update(struct mt792x_dev *dev, struct ieee80211_link_sta *link_sta, struct ieee80211_vif *vif, bool enable, @@ -1830,6 +1890,7 @@ int mt7925_mcu_sta_update(struct mt792x_dev *dev, }; struct mt792x_sta *msta; struct mt792x_link_sta *mlink; + int err; if (link_sta) { msta = (struct mt792x_sta *)link_sta->sta->drv_priv; @@ -1838,7 +1899,12 @@ int mt7925_mcu_sta_update(struct mt792x_dev *dev, 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); + if (ieee80211_vif_is_mld(vif)) + err = mt7925_mcu_mlo_sta_cmd(&dev->mphy, &info); + else + err = mt7925_mcu_sta_cmd(&dev->mphy, &info); + + return err; } int mt7925_mcu_set_beacon_filter(struct mt792x_dev *dev, diff --git a/drivers/net/wireless/mediatek/mt76/mt7925/mcu.h b/drivers/net/wireless/mediatek/mt76/mt7925/mcu.h index 7b0c6937f918..a97e5b539ab9 100644 --- a/drivers/net/wireless/mediatek/mt76/mt7925/mcu.h +++ b/drivers/net/wireless/mediatek/mt76/mt7925/mcu.h @@ -492,7 +492,8 @@ struct bss_rlm_tlv { sizeof(struct sta_rec_eht) + \ sizeof(struct sta_rec_hdr_trans) + \ sizeof(struct sta_rec_mld) + \ - sizeof(struct tlv)) + sizeof(struct tlv) * 2 + \ + sizeof(struct sta_rec_remove)) #define MT7925_BSS_UPDATE_MAX_SIZE (sizeof(struct bss_req_hdr) + \ sizeof(struct mt76_connac_bss_basic_tlv) + \ From patchwork Sat Jul 6 08:28: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: 13725785 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 37175C38150 for ; Sat, 6 Jul 2024 08:29:18 +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=hABRQwLJLR6OxmMGgOk958a22tboZU2bLLZXApf8UgE=; b=LyLxnb0L6XoSc6ce6neEpZQyK8 NrcLuz09hJZDS8XDSZVBUfEy3A9SkHxOaFR8eHBaVOyqZOoOiS7HNntfi1TsbTFTq07hTGhU9EMvr xcXVTouLF92MRh0K6If9OJJ4j2WG3nDpGn0pDDuVjgDixV+UDhkWmfMvd3Qs+lmjbLZHxcqnVIF/x /Pee+OHd33mlXdi1bv3fgy8lyyB0frKDHsq2Hmm7VBItsxLTHIGhPPQIcbLzC6vBHOcIr+1OMJanR HmZyohHLDZheuM/7limze8wUhF/FlwgbVcPfuZC/0uViuRSfJBE+06TEW41CFBXEebLh0zwn3Qnzh SM8w6fcA==; Received: from localhost ([::1] helo=bombadil.infradead.org) by bombadil.infradead.org with esmtp (Exim 4.97.1 #2 (Red Hat Linux)) id 1sQ0nF-0000000HYFQ-3ZoT; Sat, 06 Jul 2024 08:29:17 +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 1sQ0nC-0000000HYCu-3lTf for linux-mediatek@lists.infradead.org; Sat, 06 Jul 2024 08:29:16 +0000 Received: by mail-oa1-f41.google.com with SMTP id 586e51a60fabf-25e55d0f551so42865fac.0 for ; Sat, 06 Jul 2024 01:29:14 -0700 (PDT) X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1720254553; x=1720859353; 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=hABRQwLJLR6OxmMGgOk958a22tboZU2bLLZXApf8UgE=; b=iQmVBedR/Q9L05OSDCgbLv/iG8oVi5i75PYxosa1wzC83isUjmFSRDpcKtjaCn5f/H IU3PLpp6NhkqJ6nufQdDCKlE+oWX9xJUu19xQM+7OMg07ySBcQx77Kpo4Tv6gu7uBiNx fYT69eLk8sjsaPqy+PnRxfe2fIpQ9/6F4AvPA3gRHX93P7clVSADj77fSL8wNs9uB7Fn UQVCAI9ca7XWA86Vx95tXSzXLapQ5uSEQEJhNdzcP2fVfBDFJibboV3fguLPkir3Sk/o Ze+upkbR7OPsQL3cbJOd0JcKyDz9qJDD4EVfLdy9s0yu0U/P89/qW4863I+AZHb4QI/Y hJFw== X-Forwarded-Encrypted: i=1; AJvYcCUy9sReTOp8rS7R0ZhFar9MLitXSV2RbH8EsnK3yBWv5cE5sSyLUQK5azJOhS+sm4wtw/Dc2u5M+MRBwU9xLFFNgJGIskH3RtEdZ7F57U8EFuW7 X-Gm-Message-State: AOJu0YxLkVjveUY56aqWJswagcV1JvHEaBwtWTRQzXqJMvkwTJm4SbFe 4JGe1pJlH50rUpWXQU1liKjs5bZ9DZ2dS7uF0NjJL+jokobUODfF X-Google-Smtp-Source: AGHT+IFbH1Z2sSHmb2omoEiomfyOO8eR3oNEtCF75T2ElymMwSNPbM/yn0qrjMfkgoAwNd6Jb3/cMA== X-Received: by 2002:a05:6870:b52a:b0:254:d417:34ff with SMTP id 586e51a60fabf-25e2bfedaafmr5497019fac.4.1720254553490; Sat, 06 Jul 2024 01:29:13 -0700 (PDT) Received: from sean-ThinkPad-T450s.attlocal.net ([2600:1702:5083:7610:1e13:57ab:ecc5:1fd4]) by smtp.gmail.com with ESMTPSA id 586e51a60fabf-25e71070ba1sm10744fac.34.2024.07.06.01.29.11 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Sat, 06 Jul 2024 01:29:12 -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 v2 30/37] wifi: mt76: mt7925: add mt7925_mcu_sta_eht_mld_tlv for MLO Date: Sat, 6 Jul 2024 01:28:10 -0700 Message-Id: X-Mailer: git-send-email 2.25.1 In-Reply-To: References: MIME-Version: 1.0 X-CRM114-Version: 20100106-BlameMichelson ( TRE 0.8.0 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20240706_012915_028219_3651D9C9 X-CRM114-Status: GOOD ( 12.97 ) 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_sta_eht_mld_tlv for the MLO-enabled firmware. 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 --- .../wireless/mediatek/mt76/mt76_connac_mcu.h | 1 + .../net/wireless/mediatek/mt76/mt7925/mcu.c | 42 ++++++++++++++++++- .../net/wireless/mediatek/mt76/mt7925/mcu.h | 11 +++++ 3 files changed, 53 insertions(+), 1 deletion(-) diff --git a/drivers/net/wireless/mediatek/mt76/mt76_connac_mcu.h b/drivers/net/wireless/mediatek/mt76/mt76_connac_mcu.h index 9329c959674f..d6882c9fd6bc 100644 --- a/drivers/net/wireless/mediatek/mt76/mt76_connac_mcu.h +++ b/drivers/net/wireless/mediatek/mt76/mt76_connac_mcu.h @@ -820,6 +820,7 @@ enum { STA_REC_HE_6G = 0x17, STA_REC_HE_V2 = 0x19, STA_REC_MLD = 0x20, + STA_REC_EHT_MLD = 0x21, STA_REC_EHT = 0x22, STA_REC_MLD_OFF = 0x23, STA_REC_REMOVE = 0x25, diff --git a/drivers/net/wireless/mediatek/mt76/mt7925/mcu.c b/drivers/net/wireless/mediatek/mt76/mt7925/mcu.c index 28e974195be7..e6e57d11daf6 100644 --- a/drivers/net/wireless/mediatek/mt76/mt7925/mcu.c +++ b/drivers/net/wireless/mediatek/mt76/mt7925/mcu.c @@ -1738,6 +1738,42 @@ mt7925_mcu_sta_rate_ctrl_tlv(struct sk_buff *skb, HT_MCS_MASK_NUM); } +static void +mt7925_mcu_sta_eht_mld_tlv(struct sk_buff *skb, + struct ieee80211_vif *vif, struct ieee80211_sta *sta) +{ + struct mt792x_vif *mvif = (struct mt792x_vif *)vif->drv_priv; + struct wiphy *wiphy = mvif->phy->mt76->hw->wiphy; + const struct wiphy_iftype_ext_capab *ext_capa; + struct sta_rec_eht_mld *eht_mld; + struct tlv *tlv; + u16 eml_cap; + + tlv = mt76_connac_mcu_add_tlv(skb, STA_REC_EHT_MLD, sizeof(*eht_mld)); + eht_mld = (struct sta_rec_eht_mld *)tlv; + eht_mld->mld_type = 0xff; + + if (!ieee80211_vif_is_mld(vif)) + return; + + ext_capa = cfg80211_get_iftype_ext_capa(wiphy, + ieee80211_vif_type_p2p(vif)); + if (!ext_capa) + return; + + eml_cap = (vif->cfg.eml_cap & (IEEE80211_EML_CAP_EMLSR_SUPP | + IEEE80211_EML_CAP_TRANSITION_TIMEOUT)) | + (ext_capa->eml_capabilities & (IEEE80211_EML_CAP_EMLSR_PADDING_DELAY | + IEEE80211_EML_CAP_EMLSR_TRANSITION_DELAY)); + + if (eml_cap & IEEE80211_EML_CAP_EMLSR_SUPP) { + eht_mld->eml_cap[0] = u16_get_bits(eml_cap, GENMASK(7, 0)); + eht_mld->eml_cap[1] = u16_get_bits(eml_cap, GENMASK(15, 8)); + } else { + eht_mld->str_cap[0] = BIT(1); + } +} + static void mt7925_mcu_sta_mld_tlv(struct sk_buff *skb, struct ieee80211_vif *vif, struct ieee80211_sta *sta) @@ -1858,8 +1894,12 @@ mt7925_mcu_mlo_sta_cmd(struct mt76_phy *phy, mt7925_mcu_sta_state_v2_tlv(phy, skb, info->link_sta, info->vif, info->rcpi, info->state); - if (info->state != MT76_STA_INFO_STATE_NONE) + + if (info->state != MT76_STA_INFO_STATE_NONE) { mt7925_mcu_sta_mld_tlv(skb, info->vif, info->link_sta->sta); + mt7925_mcu_sta_eht_mld_tlv(skb, info->vif, info->link_sta->sta); + } + mt7925_mcu_sta_hdr_trans_tlv(skb, info->vif, info->link_sta); } diff --git a/drivers/net/wireless/mediatek/mt76/mt7925/mcu.h b/drivers/net/wireless/mediatek/mt76/mt7925/mcu.h index a97e5b539ab9..ac53bdc99332 100644 --- a/drivers/net/wireless/mediatek/mt76/mt7925/mcu.h +++ b/drivers/net/wireless/mediatek/mt76/mt7925/mcu.h @@ -443,6 +443,17 @@ struct sta_rec_mld { } __packed link[2]; } __packed; +struct sta_rec_eht_mld { + __le16 tag; + __le16 len; + u8 nsep; + u8 mld_type; + u8 __rsv1[1]; + u8 str_cap[3]; + u8 eml_cap[3]; + u8 __rsv2[3]; +} __packed; + struct bss_ifs_time_tlv { __le16 tag; __le16 len; From patchwork Sat Jul 6 08:28: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: 13725786 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 F1B3AC38150 for ; Sat, 6 Jul 2024 08:29: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=KwoTDp/PU6KVvsRx+iiZe0E2Jl8hFt5E3KQe6+2m5U4=; b=l5EyOTaXHOz0bzb2mDgXw50ret aczJoFZQe+d028bHATCDj5/UWd5G86HHqbLBxOHRh44uRYcTZFeP0v7LXaR8gFvvGm2GfqEIttoZL kbJJSl/FFYknRNBul3DAh9aNQYCC/PpQdbEZLvQBXdU820JS5C3VyFDZhnc8cX/Ec1BCZjEW187v+ lrRICzGbvaUrj82941yva4nJko/Bk5yOJGS+XRDnxqk65MLQdF2l9I7h3MoZ6pnbt/p053thk7TuQ aRI9gILwgDF+IF9KN9t7kOh9kaexi9A6cba2yyuwOm3XtMZ7mRKHn8xmoz043KC47ylF1gPrjH/vE Cou+7GsA==; Received: from localhost ([::1] helo=bombadil.infradead.org) by bombadil.infradead.org with esmtp (Exim 4.97.1 #2 (Red Hat Linux)) id 1sQ0nJ-0000000HYHV-20WM; Sat, 06 Jul 2024 08:29:21 +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 1sQ0nE-0000000HYDw-05gS for linux-mediatek@lists.infradead.org; Sat, 06 Jul 2024 08:29:17 +0000 Received: by mail-oi1-f181.google.com with SMTP id 5614622812f47-3d56754a4ceso322086b6e.1 for ; Sat, 06 Jul 2024 01:29:15 -0700 (PDT) X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1720254555; x=1720859355; 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=KwoTDp/PU6KVvsRx+iiZe0E2Jl8hFt5E3KQe6+2m5U4=; b=RKecNYGSj+1aT/OiczYVvodW4DkGflR9p53/5iR5mVKOQ9eHcCHbquJONZ/bsN/grr ba/laoirNuu1TlrZiFlRR0k39/DFEH7cdKniGiITuXCR0M/MikCppIhSrIapCIjB3+bg zRe1pG1pN2dA2kf1aEm7NWhvpSpvzVlrfTpOc6COkUw+qOJsmlq7qC4gDX7Oc8VIlDNP RTTNVQdLgOjpofra5A3yB6nviGscDW5XvUHJ2/27J95J0SijQKyQkbZ6x22GPIgsHVf2 i3UUtAMJAPrySCwi/LT5S2QRe2FWsiEN5x+mJgVy6KCCYUfX8NWlEo1iiArCkJo6dsQP NQ6Q== X-Forwarded-Encrypted: i=1; AJvYcCUiIeRXxrNn5BYhA4LLp4cWmZJRp9D+do8Gi/mGDyav7D49/e86huAl4r58zhIwptbNsj3yccnYUwtGnx7cz11+cuqJ9Mm9WxN5QQyWXLuOXHAI X-Gm-Message-State: AOJu0YzzW/wsRgA5gwwyivPVXe3NU78URA9Is6LlKoTJPMn1KhH5l4JR 8IQWL2JqAK7j4fKbcVUf7Q67pcE7BQxg9leCDJK6t7YsfaXWM/Y4 X-Google-Smtp-Source: AGHT+IFTMYR43GUbUUITrkSqP8yZGJMr9ngdJS6LdwW1lPHqmU+a7d3M3ltpxe9UxYBsSyTGUHu0jA== X-Received: by 2002:a05:6871:24ca:b0:254:ecbd:1815 with SMTP id 586e51a60fabf-25e2bffce48mr6347004fac.5.1720254555137; Sat, 06 Jul 2024 01:29:15 -0700 (PDT) Received: from sean-ThinkPad-T450s.attlocal.net ([2600:1702:5083:7610:1e13:57ab:ecc5:1fd4]) by smtp.gmail.com with ESMTPSA id 586e51a60fabf-25e71070ba1sm10744fac.34.2024.07.06.01.29.13 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Sat, 06 Jul 2024 01:29: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 v2 31/37] wifi: mt76: mt7925: update mt7925_mcu_sta_rate_ctrl_tlv for MLO Date: Sat, 6 Jul 2024 01:28:11 -0700 Message-Id: <4f6ca2d082627bb93f79d5a4df80dc08998ee5d2.1720248331.git.sean.wang@kernel.org> X-Mailer: git-send-email 2.25.1 In-Reply-To: References: MIME-Version: 1.0 X-CRM114-Version: 20100106-BlameMichelson ( TRE 0.8.0 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20240706_012916_092061_C13024F2 X-CRM114-Status: UNSURE ( 9.42 ) 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 Get band information from the per-link BSS. 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, 10 insertions(+), 2 deletions(-) diff --git a/drivers/net/wireless/mediatek/mt76/mt7925/mcu.c b/drivers/net/wireless/mediatek/mt76/mt7925/mcu.c index e6e57d11daf6..8fc75f9002d1 100644 --- a/drivers/net/wireless/mediatek/mt76/mt7925/mcu.c +++ b/drivers/net/wireless/mediatek/mt76/mt7925/mcu.c @@ -1714,12 +1714,20 @@ mt7925_mcu_sta_rate_ctrl_tlv(struct sk_buff *skb, 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; - enum nl80211_band band = chandef->chan->band; + struct ieee80211_bss_conf *link_conf; + struct cfg80211_chan_def *chandef; struct sta_rec_ra_info *ra_info; + struct mt792x_bss_conf *mconf; + enum nl80211_band band; struct tlv *tlv; u16 supp_rates; + 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 ? &mconf->mt76.ctx->def : + &link_conf->chanreq.oper; + band = chandef->chan->band; + tlv = mt76_connac_mcu_add_tlv(skb, STA_REC_RA, sizeof(*ra_info)); ra_info = (struct sta_rec_ra_info *)tlv; From patchwork Sat Jul 6 08:28: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: 13725787 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 5FC36C2BD09 for ; Sat, 6 Jul 2024 08:29: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=YlF2JywEe1cvvGSvZJRgqPG6ZVZ0CbkrViYHici5z68=; b=RocZ7VcKJCgOrBNSAjU/YWcIAP Q3ZD1KvjiMWHGmHOiE40KWAGhyIwtaZbTHrTPMy0GK4lZZBIb+7Vnn/kE+UdgMgw6cK+JCXJ3rr3/ mNeM2uvD5FJEO+fsL62Twb0KJfWcQGqwMh9FWRgng4+KyWMqdpSrU/KebRk+hBDMJG5x0ChVBLU3T HljYbf8DGXFn/tZ95JVI+DSwkL1kkAR7Ccw05e2IkxFAUv4RF5dHKeq+EU8Kc8BtIF6Bzyv1wN2Vh itg8wZ1VeZHi3rqEkAHFlPg9ifrLc8nPi2KOg884T1VVRYTH/uBaldGivNWQKxIGD5aE0DnZrjscU /ZoBlL/Q==; Received: from localhost ([::1] helo=bombadil.infradead.org) by bombadil.infradead.org with esmtp (Exim 4.97.1 #2 (Red Hat Linux)) id 1sQ0nJ-0000000HYHy-43h9; Sat, 06 Jul 2024 08:29:21 +0000 Received: from mail-oi1-f178.google.com ([209.85.167.178]) by bombadil.infradead.org with esmtps (Exim 4.97.1 #2 (Red Hat Linux)) id 1sQ0nG-0000000HYF4-00ZL for linux-mediatek@lists.infradead.org; Sat, 06 Jul 2024 08:29:19 +0000 Received: by mail-oi1-f178.google.com with SMTP id 5614622812f47-3d55fa5dfecso121392b6e.0 for ; Sat, 06 Jul 2024 01:29:17 -0700 (PDT) X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1720254557; x=1720859357; 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=YlF2JywEe1cvvGSvZJRgqPG6ZVZ0CbkrViYHici5z68=; b=vvUnkXwam7MDq3TE/wbTVx0hYL4TazarCtZS5CtMLCBGB7P8mVgsbUAW2YXRYwMSd2 zECqXafjuINQ1NsYGepRh28XLCgPMBqmONdEqCU61udZIjRZab7UEFQ8JBEmkGJfJg5p Qta+Rokxut+ZJdxK1Yt8ucaxc5ENToG/c98bDiBAVExxPzsRevcirOzq1kVza17lLu42 vWOIWJZAPF2mBEhsZytNhlX+AXhvZO4zQd1pZIfJG2k5M/WCYAGUYyMgrgkk1P9U0ESz kVhW6CeAFOtr2Ch0FTxUb7EymxYRRL5/kR6667VBpkpkDCLc1e0vDTObIWirrC+Vyb8J uPYw== X-Forwarded-Encrypted: i=1; AJvYcCXN4yL5oWi1mH3UIzhdYhaiS60y55lFQWJRtqGGXE06ZV04AM1uQ5fW6OfyP0qhMFkiQQYBshsCZJjcukacRI3rcWckqOXrI4CeVz5rLIbhKKVn X-Gm-Message-State: AOJu0YxfkyHQJXuzSb5iMgdB6sUPDaaf1XqWiTWyuE/8WjTl6dqr08mY F1M3ur+2BbCTuE8uOS0+IdVvVRVvUnBKUmrL1HSvBMCINUN4q/vO X-Google-Smtp-Source: AGHT+IEKaHR/MtADbJuaDJwOKkXRGJJxNlaYQ4FMc5RcMDq6t1884qf4ZfSK3ZmX34TiS+gD3C2FXQ== X-Received: by 2002:a05:6871:24c1:b0:25e:44b9:b2ee with SMTP id 586e51a60fabf-25e44b9d073mr3715643fac.2.1720254556954; Sat, 06 Jul 2024 01:29:16 -0700 (PDT) Received: from sean-ThinkPad-T450s.attlocal.net ([2600:1702:5083:7610:1e13:57ab:ecc5:1fd4]) by smtp.gmail.com with ESMTPSA id 586e51a60fabf-25e71070ba1sm10744fac.34.2024.07.06.01.29.15 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Sat, 06 Jul 2024 01:29: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 v2 32/37] wifi: mt76: mt7925: update mt7925_mcu_sta_phy_tlv for MLO Date: Sat, 6 Jul 2024 01:28:12 -0700 Message-Id: <6620e00fbeef686fb2041556deba346411eab0f1.1720248331.git.sean.wang@kernel.org> X-Mailer: git-send-email 2.25.1 In-Reply-To: References: MIME-Version: 1.0 X-CRM114-Version: 20100106-BlameMichelson ( TRE 0.8.0 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20240706_012918_147036_E5366B1C X-CRM114-Status: UNSURE ( 9.88 ) 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 when we serve MLO during the multiple-linked connection, the chanctx may be not available in the internal driver, we should get the proper the band information from link_conf for the MLO-enabled firmware. 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 | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/drivers/net/wireless/mediatek/mt76/mt7925/mcu.c b/drivers/net/wireless/mediatek/mt76/mt7925/mcu.c index 8fc75f9002d1..b005b5b8968c 100644 --- a/drivers/net/wireless/mediatek/mt76/mt7925/mcu.c +++ b/drivers/net/wireless/mediatek/mt76/mt7925/mcu.c @@ -1647,7 +1647,8 @@ mt7925_mcu_sta_phy_tlv(struct sk_buff *skb, 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; + chandef = mconf->mt76.ctx ? &mconf->mt76.ctx->def : + &link_conf->chanreq.oper; tlv = mt76_connac_mcu_add_tlv(skb, STA_REC_PHY, sizeof(*phy)); phy = (struct sta_rec_phy *)tlv; From patchwork Sat Jul 6 08:28: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: 13725788 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 0CC98C3DA40 for ; Sat, 6 Jul 2024 08:29:23 +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=XdHDwIbk/nKAta5fWk+n0tgyiwD0vWEsim4rkaQNjjk=; b=yYNh8Px7xYdY37D6L/GcEZuiU2 h8JebZ7ihy2vyoLjlkQfu/ZH0rOtTixm9HNfi286EYeXeVcZLQ9i9vCn20N2OYv6EE4KZjDt6tEZ7 1VO71Rqfg4+shhnxmoQnurYPHzy2QZkCVx1sEG/e31xmw9mC/LB0gSsBJ0j+I98dtxPHmvrIU79GS iIgGWCUxG6unhaPfY7JTGvw9bA82B96/0PzcTqRSc71hUHcvzJcowRyo+fFnWdOVzIjmz12ecJ+5A uHS8NRuoq4AiCOZsRFHYxb+yO30u/191UGe3tglqo/o1doWtm8JWqnrBHafF/rqW1+b/wTCN+ZN7d Sz/G0g4w==; Received: from localhost ([::1] helo=bombadil.infradead.org) by bombadil.infradead.org with esmtp (Exim 4.97.1 #2 (Red Hat Linux)) id 1sQ0nK-0000000HYIT-1XHY; Sat, 06 Jul 2024 08:29:22 +0000 Received: from mail-oa1-f44.google.com ([209.85.160.44]) by bombadil.infradead.org with esmtps (Exim 4.97.1 #2 (Red Hat Linux)) id 1sQ0nH-0000000HYGK-2WkY for linux-mediatek@lists.infradead.org; Sat, 06 Jul 2024 08:29:20 +0000 Received: by mail-oa1-f44.google.com with SMTP id 586e51a60fabf-24c5ec50da1so284901fac.3 for ; Sat, 06 Jul 2024 01:29:19 -0700 (PDT) X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1720254558; x=1720859358; 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=XdHDwIbk/nKAta5fWk+n0tgyiwD0vWEsim4rkaQNjjk=; b=G4WrgOEIZs9QqiAIujROAD3cM1VrNWHSjocnLvdM60/h24J5k6tOniZVRE9LWnOVWP MI2gTa6OT9e+0JsUksjO+A4FE+Lm9Bd4aVY5kLafFSm3LKg6B/ZdnwurtFFh/zcKDCgl esCHurOshsM0CmkswcL2Z4LUMi3AUdB5krg5+4RIAWY9sAWfnve/e4B4PB94prRZ+SQl x/6LXgNkdsy2iqWJPuOZpNS7IHGl7D6nvz1hgWzjYR8Y/lqFx5ES101rQofDIvi6zvxl SJg9hZh7xz2ohLdyC8V1HypXYKLyGoelu9T0aLoLnvxu8gIcp6bb3hnE4J8f4qjwvUeB Z8xg== X-Forwarded-Encrypted: i=1; AJvYcCU2LvkLlBIXBEB81p5BPH/RxHrAPnyvzFCWqhu0G0wSeAHSaAMQ/fz/ZzuKCy65H34HEUp9IqeF0aL13mmykZjFnftRzp5if9jESyyjkOxn6o/j X-Gm-Message-State: AOJu0Yz1uNHUe5bDt0frKjkrk7WLgxLnvaMkx/kzsq/HAKLxg965SwRo 7Nm8HVTuNaVE8r+H9/arX0qJwY+JUc9VxRGwZhY9nzncH8j7sXoS X-Google-Smtp-Source: AGHT+IH4oEdW8ND3MNXtHA0L4tW09xYHvChs0d6GbdEk6QyLI/uUTcRxtoJox7Z8cYwfB0tBpGQNXg== X-Received: by 2002:a05:6870:b250:b0:25e:180:9183 with SMTP id 586e51a60fabf-25e2bf95bc9mr5863911fac.4.1720254558671; Sat, 06 Jul 2024 01:29:18 -0700 (PDT) Received: from sean-ThinkPad-T450s.attlocal.net ([2600:1702:5083:7610:1e13:57ab:ecc5:1fd4]) by smtp.gmail.com with ESMTPSA id 586e51a60fabf-25e71070ba1sm10744fac.34.2024.07.06.01.29.17 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Sat, 06 Jul 2024 01:29:17 -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 v2 33/37] wifi: mt76: mt7925: update mt7925_mcu_set_timing for MLO Date: Sat, 6 Jul 2024 01:28:13 -0700 Message-Id: X-Mailer: git-send-email 2.25.1 In-Reply-To: References: MIME-Version: 1.0 X-CRM114-Version: 20100106-BlameMichelson ( TRE 0.8.0 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20240706_012919_666684_E942399C X-CRM114-Status: GOOD ( 11.52 ) 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 Set the BSS index from the per-linked BSS for the firmware to identify which link the command is operating on. 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 | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/drivers/net/wireless/mediatek/mt76/mt7925/mcu.c b/drivers/net/wireless/mediatek/mt76/mt7925/mcu.c index b005b5b8968c..908aed2eec11 100644 --- a/drivers/net/wireless/mediatek/mt76/mt7925/mcu.c +++ b/drivers/net/wireless/mediatek/mt76/mt7925/mcu.c @@ -2606,11 +2606,11 @@ mt7925_mcu_bss_ifs_tlv(struct sk_buff *skb, int mt7925_mcu_set_timing(struct mt792x_phy *phy, struct ieee80211_bss_conf *link_conf) { - struct mt792x_vif *mvif = (struct mt792x_vif *)link_conf->vif->drv_priv; + struct mt792x_bss_conf *mconf = mt792x_link_conf_to_mconf(link_conf); struct mt792x_dev *dev = phy->dev; struct sk_buff *skb; - skb = __mt7925_mcu_alloc_bss_req(&dev->mt76, &mvif->bss_conf.mt76, + skb = __mt7925_mcu_alloc_bss_req(&dev->mt76, &mconf->mt76, MT7925_BSS_UPDATE_MAX_SIZE); if (IS_ERR(skb)) return PTR_ERR(skb); From patchwork Sat Jul 6 08:28: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: 13725789 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 705AEC2BD09 for ; Sat, 6 Jul 2024 08:29: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=tSgiCYdbTZhBzsFtfZ0J5zrY/KOMVKy0kzRs5gp6JHE=; b=j8zi4BYBgdQox7B7/HrE0amhCK cYn2onAkoHgrbZY4tnykc4gmIkLOVz8Q8x5gskA+EhuzFewgIlyaZWfqZyXF5i9ZD4KdFypaVpMWS OOgfkz1DBNtYX9TRM3vpqzU3khYgcSj5cpwZlJoxmgGMn9X4IV0Zr2j8+NhVYxy+rd374I4UxXInn v9ssBKdPDEbwjclbc8sDa1sp9NqWvZz3ioT5iRp4zgXdlN5Kur0QBTc0cqTwtMLljLUkTMlrNQO8t /uQ7QxMfemR0Yw7yQ//14Na+G8f6JuBSl3bTAFevKMlxTyFmPs4A6ssRM81hn+doYCxp9lycnypUg OOxxW4Lg==; Received: from localhost ([::1] helo=bombadil.infradead.org) by bombadil.infradead.org with esmtp (Exim 4.97.1 #2 (Red Hat Linux)) id 1sQ0nN-0000000HYKD-0Pt5; Sat, 06 Jul 2024 08:29:25 +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 1sQ0nJ-0000000HYH6-0wM6 for linux-mediatek@lists.infradead.org; Sat, 06 Jul 2024 08:29:22 +0000 Received: by mail-oa1-f45.google.com with SMTP id 586e51a60fabf-25cb5ee9d2dso294094fac.1 for ; Sat, 06 Jul 2024 01:29:21 -0700 (PDT) X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1720254560; x=1720859360; 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=tSgiCYdbTZhBzsFtfZ0J5zrY/KOMVKy0kzRs5gp6JHE=; b=sG/mGpDvNXTdKQwS40zNdmQbmjST0ZqWPa0QoxF+VOO1ySDNmN8NA7TnEo7GxtSwbp SHwEnj16X1Nr5rVtcqbAdqG66u6aRPBfllIc52+W9re7WHVIdvtHMJgX42FY3+ihFqFi C3XoguhH/2F3qutq8pF390v7RYKrrN/dzfTy+m8zeuggedCiJoKY2PKObKkwnkP+tnDD pQiOkqnneIFBD8a/YKq4Twd0vy03VOMAz5JKVQDBa05Bz7U29Qmqo48aR9O8UQPEOov1 xZW5z47IhOzRnqfvKEc5Zkisn8stZlR9iIjJHGAiBZfWviWZddGlgrd8g2T+GpWpVUH9 ChzQ== X-Forwarded-Encrypted: i=1; AJvYcCVdgmDGpVS/PvXO1xS4tjh+cseRXxUEo9lnH14giEp3GLBnvXbLCh8dMAd1KXiAJ2XTPB3TV41/cFG3jXAM29kIOn+GdmvJwsVxtFTMzQox7BTa X-Gm-Message-State: AOJu0YwD8LiyCEaL5rkuFZHMo1ShZ+gOxYugJjshAWbR4l3BhdLhiYTy PGZxy9Bc44HbUboyvCU5XRFN/m1SH1Xy1jV4L9Y8CTk/lOAfIV8G X-Google-Smtp-Source: AGHT+IHhGg3iFxDo2Cp9FwlE6n+jfjMQJenn5uw1AfT1Dg/o0uAMM2XzXcgaZ5pmTtYm/eBBuFNP7Q== X-Received: by 2002:a05:6871:54a:b0:25d:f237:e108 with SMTP id 586e51a60fabf-25e2b5a1bfcmr6904431fac.0.1720254560270; Sat, 06 Jul 2024 01:29:20 -0700 (PDT) Received: from sean-ThinkPad-T450s.attlocal.net ([2600:1702:5083:7610:1e13:57ab:ecc5:1fd4]) by smtp.gmail.com with ESMTPSA id 586e51a60fabf-25e71070ba1sm10744fac.34.2024.07.06.01.29.18 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Sat, 06 Jul 2024 01:29:19 -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 v2 34/37] wifi: mt76: mt7925: update mt7925_mcu_bss_basic_tlv for MLO Date: Sat, 6 Jul 2024 01:28:14 -0700 Message-Id: <583a3ac10583cfef0028f9a0b5a4802fc4070b99.1720248331.git.sean.wang@kernel.org> X-Mailer: git-send-email 2.25.1 In-Reply-To: References: MIME-Version: 1.0 X-CRM114-Version: 20100106-BlameMichelson ( TRE 0.8.0 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20240706_012921_303444_C69515CC X-CRM114-Status: UNSURE ( 8.53 ) 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 update mt7925_mcu_bss_basic_tlv for the MLO-enabled firmware. The change remains compatible with the non-MLO mode and the older firmware. 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 | 1 + 1 file changed, 1 insertion(+) diff --git a/drivers/net/wireless/mediatek/mt76/mt7925/mcu.c b/drivers/net/wireless/mediatek/mt76/mt7925/mcu.c index 908aed2eec11..5f2f866e3ce7 100644 --- a/drivers/net/wireless/mediatek/mt76/mt7925/mcu.c +++ b/drivers/net/wireless/mediatek/mt76/mt7925/mcu.c @@ -2385,6 +2385,7 @@ mt7925_mcu_bss_basic_tlv(struct sk_buff *skb, 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->link_idx = mconf->mt76.idx; if (link_sta) { struct mt792x_sta *msta; From patchwork Sat Jul 6 08:28: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: 13725790 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 6BFD3C2BD09 for ; Sat, 6 Jul 2024 08:29:28 +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=rDWsadwt/xEY8QJ0HP1J0p9sCg8C+huC3dGYVm5QTrA=; b=3JNt2lc0JAYVkcjEtL2ESI4ppE 1tLXzW/RjfN7GZmsdUK8pOU0i65dUVecC9vCHyWC/5wJyBu1MSOzD0gO7Ly7RMztylTHbU+mrqwPY EDNLXgbTxwY19ZVScPj70MXmXnyeE/3J8ojskDqczfeLle08oQDupppBgCubChlEFbD0/FaaTfbXT IbO3i7YiUQsqRXCD9D5bVEM/cIX5Tgv48PUPiZQY8dip+JlObh32sNbS8u/jW0gAXnzDbBx8oSgA+ EYmvR9YmG/V+bwc9/seuFQnEMgDqe9RZuuICUzwbaHjV9mGQBm39nMPy3GQNeKLoot5WB1PvPPnIq uF+X/UCg==; Received: from localhost ([::1] helo=bombadil.infradead.org) by bombadil.infradead.org with esmtp (Exim 4.97.1 #2 (Red Hat Linux)) id 1sQ0nP-0000000HYLy-3svB; Sat, 06 Jul 2024 08:29:28 +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 1sQ0nL-0000000HYIc-0gGr for linux-mediatek@lists.infradead.org; Sat, 06 Jul 2024 08:29:24 +0000 Received: by mail-oo1-f42.google.com with SMTP id 006d021491bc7-5c229104335so56231eaf.3 for ; Sat, 06 Jul 2024 01:29:22 -0700 (PDT) X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1720254562; x=1720859362; 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=rDWsadwt/xEY8QJ0HP1J0p9sCg8C+huC3dGYVm5QTrA=; b=Q5uLuiXMSERRwSjyHi1TfEVPlZN/72YERtnGa2bOvRMInFa6NG4WDPkCkJ4bR4Qz1B B0Uc9JvBHQnOInwdW7pVKIV9nSgKvGWEzVCTM/cjXgcNyS0aP9hHGvosH44LQNCQDGNH 7hK3nXCpXWHFBym2nDbHpR3KA3zd769jXlOofkCIa0vq2zBuxDiTUB1fTm6K/eeKQCHc Hxs4SGJ3XhuDHsQjeVdytxsw4t0jn0YwT6nTT8g+RhMbMr0gjpB+1cgAi8xKeVjay2B/ HE96kTF2zSJRqksk0rpaBDHUSPzztIQRIiN5whsbHydIh6k61YyWl6xPX+ZbBqRA3TZx S5tQ== X-Forwarded-Encrypted: i=1; AJvYcCVFD7vLPYdUPW5joPmmyIPQOXA4mNY/VXT/41cHFj1vyvbF7QKvJuitKOixOtCJa/hETwg3DfQRSeN0sVdtAJRfd7ZjKoEbJ6yQchoHnnkD2IJ2 X-Gm-Message-State: AOJu0YzNsIhpVcDGkmmY2rAlFPbu+I1GnRkh9cVyCqGMg+ntuerR5Upl /RKHmrj/3ITiIGbVakGQOxGEUrYDdjWwSX9aA4unq7PB5YoIbXOx X-Google-Smtp-Source: AGHT+IGSmxnMYI6qyVOuKJhXuZQsvKS/iLknCxT8PYn3N4BOpFvg2ZPEwrqQXATr+hHCnmcdeoXbWg== X-Received: by 2002:a05:6871:24d5:b0:25c:f5f8:a80d with SMTP id 586e51a60fabf-25e2bb7606emr6642955fac.2.1720254562101; Sat, 06 Jul 2024 01:29:22 -0700 (PDT) Received: from sean-ThinkPad-T450s.attlocal.net ([2600:1702:5083:7610:1e13:57ab:ecc5:1fd4]) by smtp.gmail.com with ESMTPSA id 586e51a60fabf-25e71070ba1sm10744fac.34.2024.07.06.01.29.20 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Sat, 06 Jul 2024 01:29:21 -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 v2 35/37] wifi: mt76: mt7925: update mt7925_mac_link_bss_add for MLO Date: Sat, 6 Jul 2024 01:28:15 -0700 Message-Id: <37fcf3ea7b4883840d61f97231277b297e1b15a3.1720248331.git.sean.wang@kernel.org> X-Mailer: git-send-email 2.25.1 In-Reply-To: References: MIME-Version: 1.0 X-CRM114-Version: 20100106-BlameMichelson ( TRE 0.8.0 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20240706_012923_383940_7AB4D8F2 X-CRM114-Status: GOOD ( 10.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 Update band_idx in per-link BSS to be auto for the MLO-enabled firmware and the MLO-enabled firmware only supports omac index in 0. The change remains compatible with the non-MLO mode and the older firmware. 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 | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/drivers/net/wireless/mediatek/mt76/mt7925/main.c b/drivers/net/wireless/mediatek/mt76/mt7925/main.c index 44d9da5aadd1..0c4e106ae735 100644 --- a/drivers/net/wireless/mediatek/mt76/mt7925/main.c +++ b/drivers/net/wireless/mediatek/mt76/mt7925/main.c @@ -333,8 +333,9 @@ static int mt7925_mac_link_bss_add(struct mt792x_dev *dev, goto out; } - mconf->mt76.omac_idx = mconf->mt76.idx; - mconf->mt76.band_idx = 0; + mconf->mt76.omac_idx = ieee80211_vif_is_mld(vif) ? + 0 : mconf->mt76.idx; + mconf->mt76.band_idx = 0xff; mconf->mt76.wmm_idx = mconf->mt76.idx % MT76_CONNAC_MAX_WMM_SETS; if (mvif->phy->mt76->chandef.chan->band != NL80211_BAND_2GHZ) From patchwork Sat Jul 6 08:28: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: 13725791 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 BD146C38150 for ; Sat, 6 Jul 2024 08:29:28 +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=jPXD+qcLYIZlSplWWRhXiQpzkJn0MvNcUYDTnCW+WRA=; b=LYG6MGUhGhF2EgwwrIvNbkkU1A rCR//oojQq1RWPAYknKasVJuwo2ywRRS0TC9ZdOyBRZBIGuXji+ZQWEM7Z9wYCMUZ8SRuUysZBhoa g4HD9Z3hrJbBqJVgtUtOpum+L36zQzHH0WFoWFw+xN79WGBGJW8Kkj5ypreiRKKclhPRsAeRBWeJb b3KlXkBaDMK2VXBBt46rs/c0VT3ODraO5Lrj9ZjQ8vVO13Undxk72jL0aG0+5Kig1mOD+GVpWf3ja Ch9txM+gyWWnLwPCHHtu5BzZcb5BtE66sTobZyXub17epc10KrNKO/gbz4NBzmt2lbunWfG2Bs93x Z2FUrtcg==; Received: from localhost ([::1] helo=bombadil.infradead.org) by bombadil.infradead.org with esmtp (Exim 4.97.1 #2 (Red Hat Linux)) id 1sQ0nQ-0000000HYMH-1lSp; Sat, 06 Jul 2024 08:29:28 +0000 Received: from mail-oa1-f54.google.com ([209.85.160.54]) by bombadil.infradead.org with esmtps (Exim 4.97.1 #2 (Red Hat Linux)) id 1sQ0nM-0000000HYJa-2Hl7 for linux-mediatek@lists.infradead.org; Sat, 06 Jul 2024 08:29:25 +0000 Received: by mail-oa1-f54.google.com with SMTP id 586e51a60fabf-254939503baso94617fac.0 for ; Sat, 06 Jul 2024 01:29:24 -0700 (PDT) X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1720254563; x=1720859363; 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=jPXD+qcLYIZlSplWWRhXiQpzkJn0MvNcUYDTnCW+WRA=; b=otk0ibmwhJ7XggQfFdqgz4/OnZpVZFO0mYBGIoQYN3r4okRroPYR48P07UpI/id3EF HR5EzKLz6PyxMP4kbnHbMBCCLmJGutmYEFG4hmgB7jNx5Nr9eLOdxG0/yZaoVHWtRzDW V0f0HnQsgoGeBpPxzEi2aCf5u9gExH3Kor6qDI60jKY5vZKGEzhH0JGJyg7nNf2l7oA9 iHbJKBO49PoGw8RBPlFwbK1glPE/at17yeyqsUPOb2G9490tkfdy7NcrVxCniLka30r5 6vvr28dNXKDqgBsDcsBUk4lrS4OUJAONt84mL/lxlyjzX/yWXbZyl4yEY4tEM3j8k0Nx jfug== X-Forwarded-Encrypted: i=1; AJvYcCXu6GuxOWOvcQujbnefN+rH9EA9gWe2SpO90qCoZjE+SFP4msiVM3OQtKqCE8jPNOsonD+Uiu1XU4x9b/QUArkd9n4vgTS8uZA/G4rAJeCaC9pV X-Gm-Message-State: AOJu0YxyOQHADz2HhRxVjR8yc3n2cDgG3DexN7roDaFjbQ4wKXQ9lbvD EZN/yDsM7Tqo7Hsg/wUnrqZsFkl8/JYn9KVYieDr6Y0v5azXoSSM X-Google-Smtp-Source: AGHT+IGSumjq8WH2euzBlt3u6CQIhacQboPCctwrhsnbLP+bFEVWpWgi5grP+bQyszbsoNsnemKBbw== X-Received: by 2002:a05:6871:24ca:b0:254:ecbd:1815 with SMTP id 586e51a60fabf-25e2bffce48mr6347097fac.5.1720254563614; Sat, 06 Jul 2024 01:29:23 -0700 (PDT) Received: from sean-ThinkPad-T450s.attlocal.net ([2600:1702:5083:7610:1e13:57ab:ecc5:1fd4]) by smtp.gmail.com with ESMTPSA id 586e51a60fabf-25e71070ba1sm10744fac.34.2024.07.06.01.29.22 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Sat, 06 Jul 2024 01:29: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 v2 36/37] wifi: mt76: mt7925: remove the unused mt7925_mcu_set_chan_info Date: Sat, 6 Jul 2024 01:28:16 -0700 Message-Id: <0aa0abe7fc661380ae812c6bc879a7705de401b2.1720248331.git.sean.wang@kernel.org> X-Mailer: git-send-email 2.25.1 In-Reply-To: References: MIME-Version: 1.0 X-CRM114-Version: 20100106-BlameMichelson ( TRE 0.8.0 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20240706_012924_620587_9107185D X-CRM114-Status: UNSURE ( 9.77 ) 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 the unused function mt7925_mcu_set_chan_info 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 | 74 ------------------- 1 file changed, 74 deletions(-) diff --git a/drivers/net/wireless/mediatek/mt76/mt7925/mcu.c b/drivers/net/wireless/mediatek/mt76/mt7925/mcu.c index 5f2f866e3ce7..cb5c607b9260 100644 --- a/drivers/net/wireless/mediatek/mt76/mt7925/mcu.c +++ b/drivers/net/wireless/mediatek/mt76/mt7925/mcu.c @@ -1274,80 +1274,6 @@ int mt7925_mcu_abort_roc(struct mt792x_phy *phy, struct mt792x_bss_conf *mconf, &req, sizeof(req), false); } -int mt7925_mcu_set_chan_info(struct mt792x_phy *phy, u16 tag) -{ - static const u8 ch_band[] = { - [NL80211_BAND_2GHZ] = 0, - [NL80211_BAND_5GHZ] = 1, - [NL80211_BAND_6GHZ] = 2, - }; - struct mt792x_dev *dev = phy->dev; - struct cfg80211_chan_def *chandef = &phy->mt76->chandef; - int freq1 = chandef->center_freq1; - u8 band_idx = chandef->chan->band != NL80211_BAND_2GHZ; - struct { - /* fixed field */ - u8 __rsv[4]; - - __le16 tag; - __le16 len; - u8 control_ch; - u8 center_ch; - u8 bw; - u8 tx_path_num; - u8 rx_path; /* mask or num */ - u8 switch_reason; - u8 band_idx; - u8 center_ch2; /* for 80+80 only */ - __le16 cac_case; - u8 channel_band; - u8 rsv0; - __le32 outband_freq; - u8 txpower_drop; - u8 ap_bw; - u8 ap_center_ch; - u8 rsv1[53]; - } __packed req = { - .tag = cpu_to_le16(tag), - .len = cpu_to_le16(sizeof(req) - 4), - .control_ch = chandef->chan->hw_value, - .center_ch = ieee80211_frequency_to_channel(freq1), - .bw = mt76_connac_chan_bw(chandef), - .tx_path_num = hweight8(phy->mt76->antenna_mask), - .rx_path = phy->mt76->antenna_mask, - .band_idx = band_idx, - .channel_band = ch_band[chandef->chan->band], - }; - - if (chandef->chan->band == NL80211_BAND_6GHZ) - req.channel_band = 2; - else - req.channel_band = chandef->chan->band; - - if (tag == UNI_CHANNEL_RX_PATH || - dev->mt76.hw->conf.flags & IEEE80211_CONF_MONITOR) - req.switch_reason = CH_SWITCH_NORMAL; - else if (phy->mt76->hw->conf.flags & IEEE80211_CONF_OFFCHANNEL) - req.switch_reason = CH_SWITCH_SCAN_BYPASS_DPD; - else if (!cfg80211_reg_can_beacon(phy->mt76->hw->wiphy, chandef, - NL80211_IFTYPE_AP)) - req.switch_reason = CH_SWITCH_DFS; - else - req.switch_reason = CH_SWITCH_NORMAL; - - if (tag == UNI_CHANNEL_SWITCH) - req.rx_path = hweight8(req.rx_path); - - if (chandef->width == NL80211_CHAN_WIDTH_80P80) { - int freq2 = chandef->center_freq2; - - req.center_ch2 = ieee80211_frequency_to_channel(freq2); - } - - return mt76_mcu_send_msg(&dev->mt76, MCU_UNI_CMD(CHANNEL_SWITCH), - &req, sizeof(req), true); -} - int mt7925_mcu_set_eeprom(struct mt792x_dev *dev) { struct { From patchwork Sat Jul 6 08:28: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: 13725792 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 1FD18C3DA40 for ; Sat, 6 Jul 2024 08:29: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=OjLrFfQCCVnCNReIrv8FgOPJoGhFLKjOF2fw6M5UKFA=; b=QgaB8UynDIvSrQSHwwpgTSOVjV c9V4g1A2sAr1idrtnj9xALMlJv5tAwFFbFD+kr4rx7if6lW57M8WKckYjTKH1Vp47lzgZOQTVAAkx Sdmn/uqewP/D8HRZoXrE8zp0dwGTzAdu+JlDxhhzvrxf4eCstqL/SHVyS3n5p0C0kw0kHVw8wlCk/ hbr2eBOu6amSbfeRnWxQ4PkX/Bb7CvJS+Xxbxe6qvBF/LWFy214pFFYGtw3uPnjLfdNjnQ7gd+rXs UCLbmOHiMcppR5lbyG6yo51P8GtXoYgMFWkY7/DhSH7KZFs9cPd8WB5KkjTluecUj2/CMbf/PJDcY IbrPsG8A==; Received: from localhost ([::1] helo=bombadil.infradead.org) by bombadil.infradead.org with esmtp (Exim 4.97.1 #2 (Red Hat Linux)) id 1sQ0nQ-0000000HYMf-3Kla; Sat, 06 Jul 2024 08:29:28 +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 1sQ0nO-0000000HYKx-0gkk for linux-mediatek@lists.infradead.org; Sat, 06 Jul 2024 08:29:27 +0000 Received: by mail-oa1-f52.google.com with SMTP id 586e51a60fabf-24c5ec50da1so284908fac.3 for ; Sat, 06 Jul 2024 01:29:26 -0700 (PDT) X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1720254565; x=1720859365; 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=OjLrFfQCCVnCNReIrv8FgOPJoGhFLKjOF2fw6M5UKFA=; b=bTuabvz+EhWrEEmvVHIjWjWnXoSoTn+eggqj+wXMfiM68YwDKoVEmw/CezeKoo508/ KM7hHf9JrGSyghgqnHr/OvBZel8xVjYAkcBgDc2OTlMD8rAVGDbxeLU6aZC6E1N7WElK Msfk7JbH87hEqwENGYszTqawlDTYfIz6WWRzKxjGz4fKjmL62BReD+HxHoZQlQa3DRdO HJoCY0CgI77/rNciPWBNTGlLBbT5k7Cm6wSqminJnu6wyUKltTP0OVx8z4vdaW4pHAGQ aE1h5jxvF4ZBY+YA8g0QFktnqEzshpIbj/PkLre+L8/UgI5h33Gi8yPye8JKhQJNdAf8 usbg== X-Forwarded-Encrypted: i=1; AJvYcCX9slS9IvaATDkDWFc0Dmf33677k2AlOS/OGbfmCA6ZPXxrukOQ/S2DM/ydUNw4bmLqb+d7F1vxMBGIhjURGswZLQ7z8CQ0YFwDbMt27LAyksiW X-Gm-Message-State: AOJu0YwcDMrUzUXn+ABGU65sCOywYnajllQznSdaUk3HwPfEJl4bR7Sm Y9U6JXaiU7ojlojO7IsPjqVkCDZxz4C927fyzvM1h/yk9hu0JtotzuI6g8IA X-Google-Smtp-Source: AGHT+IEZYIH1kmad4nC0WoETgsT1zmYli5oIUph3ObeeImE7AAkcePYHQa7IFlYEjWurI4v3OK5eDg== X-Received: by 2002:a05:6870:a1a0:b0:254:7e18:7e1a with SMTP id 586e51a60fabf-25e2bff9792mr6813517fac.5.1720254565371; Sat, 06 Jul 2024 01:29:25 -0700 (PDT) Received: from sean-ThinkPad-T450s.attlocal.net ([2600:1702:5083:7610:1e13:57ab:ecc5:1fd4]) by smtp.gmail.com with ESMTPSA id 586e51a60fabf-25e71070ba1sm10744fac.34.2024.07.06.01.29.23 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Sat, 06 Jul 2024 01:29: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 v2 37/37] wifi: mt76: mt7925: enabling MLO when the firmware supports it Date: Sat, 6 Jul 2024 01:28:17 -0700 Message-Id: <49c796b101e792c84bc2c0d74753022b75fd3355.1720248331.git.sean.wang@kernel.org> X-Mailer: git-send-email 2.25.1 In-Reply-To: References: MIME-Version: 1.0 X-CRM114-Version: 20100106-BlameMichelson ( TRE 0.8.0 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20240706_012926_231562_0C7F9482 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 Register MLD capability for the firmware supporting MLO. 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 --- .../wireless/mediatek/mt76/mt76_connac_mcu.h | 1 + .../net/wireless/mediatek/mt76/mt7925/init.c | 6 ++++ .../net/wireless/mediatek/mt76/mt7925/main.c | 29 +++++++++++++++++++ .../net/wireless/mediatek/mt76/mt7925/mcu.c | 20 +++++++++++++ .../wireless/mediatek/mt76/mt7925/mt7925.h | 1 + drivers/net/wireless/mediatek/mt76/mt792x.h | 2 ++ 6 files changed, 59 insertions(+) diff --git a/drivers/net/wireless/mediatek/mt76/mt76_connac_mcu.h b/drivers/net/wireless/mediatek/mt76/mt76_connac_mcu.h index d6882c9fd6bc..4242d436de26 100644 --- a/drivers/net/wireless/mediatek/mt76/mt76_connac_mcu.h +++ b/drivers/net/wireless/mediatek/mt76/mt76_connac_mcu.h @@ -1402,6 +1402,7 @@ enum { MT_NIC_CAP_WFDMA_REALLOC, MT_NIC_CAP_6G, MT_NIC_CAP_CHIP_CAP = 0x20, + MT_NIC_CAP_EML_CAP = 0x22, }; #define UNI_WOW_DETECT_TYPE_MAGIC BIT(0) diff --git a/drivers/net/wireless/mediatek/mt76/mt7925/init.c b/drivers/net/wireless/mediatek/mt76/mt7925/init.c index c4cbc8976046..039949b344b9 100644 --- a/drivers/net/wireless/mediatek/mt76/mt7925/init.c +++ b/drivers/net/wireless/mediatek/mt76/mt7925/init.c @@ -179,6 +179,12 @@ static void mt7925_init_work(struct work_struct *work) mt76_set_stream_caps(&dev->mphy, true); mt7925_set_stream_he_eht_caps(&dev->phy); + ret = mt7925_init_mlo_caps(&dev->phy); + if (ret) { + dev_err(dev->mt76.dev, "MLO init failed\n"); + return; + } + ret = mt76_register_device(&dev->mt76, true, mt76_rates, ARRAY_SIZE(mt76_rates)); if (ret) { diff --git a/drivers/net/wireless/mediatek/mt76/mt7925/main.c b/drivers/net/wireless/mediatek/mt76/mt7925/main.c index 0c4e106ae735..b5dd4430f459 100644 --- a/drivers/net/wireless/mediatek/mt76/mt7925/main.c +++ b/drivers/net/wireless/mediatek/mt76/mt7925/main.c @@ -236,6 +236,35 @@ mt7925_init_eht_caps(struct mt792x_phy *phy, enum nl80211_band band, eht_nss->bw._160.rx_tx_mcs13_max_nss = val; } +int mt7925_init_mlo_caps(struct mt792x_phy *phy) +{ + struct wiphy *wiphy = phy->mt76->hw->wiphy; + static const u8 ext_capa_sta[] = { + [7] = WLAN_EXT_CAPA8_OPMODE_NOTIF, + }; + static struct wiphy_iftype_ext_capab ext_capab[] = { + { + .iftype = NL80211_IFTYPE_STATION, + .extended_capabilities = ext_capa_sta, + .extended_capabilities_mask = ext_capa_sta, + .extended_capabilities_len = sizeof(ext_capa_sta), + }, + }; + + if (!(phy->chip_cap & MT792x_CHIP_CAP_MLO_EVT_EN)) + return 0; + + ext_capab[0].eml_capabilities = phy->eml_cap; + ext_capab[0].mld_capa_and_ops = + u16_encode_bits(1, IEEE80211_MLD_CAP_OP_MAX_SIMUL_LINKS); + + wiphy->flags |= WIPHY_FLAG_SUPPORTS_MLO; + wiphy->iftype_ext_capab = ext_capab; + wiphy->num_iftype_ext_capab = ARRAY_SIZE(ext_capab); + + return 0; +} + static void __mt7925_set_stream_he_eht_caps(struct mt792x_phy *phy, struct ieee80211_supported_band *sband, diff --git a/drivers/net/wireless/mediatek/mt76/mt7925/mcu.c b/drivers/net/wireless/mediatek/mt76/mt7925/mcu.c index cb5c607b9260..ccc66c42c16c 100644 --- a/drivers/net/wireless/mediatek/mt76/mt7925/mcu.c +++ b/drivers/net/wireless/mediatek/mt76/mt7925/mcu.c @@ -751,6 +751,20 @@ mt7925_mcu_parse_phy_cap(struct mt792x_dev *dev, char *data) dev->has_eht = cap->eht; } +static void +mt7925_mcu_parse_eml_cap(struct mt792x_dev *dev, char *data) +{ + struct mt7925_mcu_eml_cap { + u8 rsv[4]; + __le16 eml_cap; + u8 rsv2[6]; + } __packed * cap; + + cap = (struct mt7925_mcu_eml_cap *)data; + + dev->phy.eml_cap = le16_to_cpu(cap->eml_cap); +} + static int mt7925_mcu_get_nic_capability(struct mt792x_dev *dev) { @@ -805,6 +819,12 @@ mt7925_mcu_get_nic_capability(struct mt792x_dev *dev) case MT_NIC_CAP_PHY: mt7925_mcu_parse_phy_cap(dev, tlv->data); break; + case MT_NIC_CAP_CHIP_CAP: + memcpy(&dev->phy.chip_cap, (void *)skb->data, sizeof(u64)); + break; + case MT_NIC_CAP_EML_CAP: + mt7925_mcu_parse_eml_cap(dev, tlv->data); + break; default: break; } diff --git a/drivers/net/wireless/mediatek/mt76/mt7925/mt7925.h b/drivers/net/wireless/mediatek/mt76/mt7925/mt7925.h index 1ae66629e39f..669f3a079d04 100644 --- a/drivers/net/wireless/mediatek/mt76/mt7925/mt7925.h +++ b/drivers/net/wireless/mediatek/mt76/mt7925/mt7925.h @@ -235,6 +235,7 @@ void mt7925_queue_rx_skb(struct mt76_dev *mdev, enum mt76_rxq_id q, struct sk_buff *skb, u32 *info); void mt7925_stats_work(struct work_struct *work); void mt7925_set_stream_he_eht_caps(struct mt792x_phy *phy); +int mt7925_init_mlo_caps(struct mt792x_phy *phy); int mt7925_init_debugfs(struct mt792x_dev *dev); int mt7925_mcu_set_beacon_filter(struct mt792x_dev *dev, diff --git a/drivers/net/wireless/mediatek/mt76/mt792x.h b/drivers/net/wireless/mediatek/mt76/mt792x.h index 5ede24116748..30635aeba363 100644 --- a/drivers/net/wireless/mediatek/mt76/mt792x.h +++ b/drivers/net/wireless/mediatek/mt76/mt792x.h @@ -27,6 +27,7 @@ #define MT792x_CHIP_CAP_CLC_EVT_EN BIT(0) #define MT792x_CHIP_CAP_RSSI_NOTIFY_EVT_EN BIT(1) +#define MT792x_CHIP_CAP_MLO_EVT_EN BIT(2) /* NOTE: used to map mt76_rates. idx may change if firmware expands table */ #define MT792x_BASIC_RATES_TBL 11 @@ -163,6 +164,7 @@ struct mt792x_phy { #endif void *clc[MT792x_CLC_MAX_NUM]; u64 chip_cap; + u16 eml_cap; struct work_struct roc_work; struct timer_list roc_timer;