From patchwork Wed Jul 3 21:42: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: 13722856 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 AB8C2C2BD09 for ; Wed, 3 Jul 2024 21:42: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=2ZTio5F8p35DlD4asDjPvybCMwGfLPum9VeO2lVI5Tw=; b=S9bDCkPOB1fBd4+JG6jgOd30sS ZR+uu6rBOJ41sEA+mT1BSBiUuWSvRvBVV+lcqyMLh0gfFYQnnHwjkn3cffRpxDtExuYBHCz5gozcx eUvHAUz8KxAjshVKvJM9RZ1K49FVq1bTpLPVrUgbOsiYugczexYIDHa/tQfACTAHn8+VUiObfd7k7 JaCJkr1zkGKtYzWp2vtB69p6eyVd5seFX2Mpe1eZeB0h0ot69k5X/nvq/kXtcF2fM6y4bziECxoct ed3fXccoZAeTfTkRGO30hLfLK30Egi6+ZdjIUsXOc3FLhD5WWKn3H44PX8sCu3tMgqNkIxgTTdqub MgDGEZKA==; Received: from localhost ([::1] helo=bombadil.infradead.org) by bombadil.infradead.org with esmtp (Exim 4.97.1 #2 (Red Hat Linux)) id 1sP7ka-0000000BWx7-0BUz; Wed, 03 Jul 2024 21:42:52 +0000 Received: from mail-ot1-f48.google.com ([209.85.210.48]) by bombadil.infradead.org with esmtps (Exim 4.97.1 #2 (Red Hat Linux)) id 1sP7kX-0000000BWwJ-0mZT for linux-mediatek@lists.infradead.org; Wed, 03 Jul 2024 21:42:50 +0000 Received: by mail-ot1-f48.google.com with SMTP id 46e09a7af769-700d58a3159so136359a34.0 for ; Wed, 03 Jul 2024 14:42:48 -0700 (PDT) X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1720042968; x=1720647768; 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=2ZTio5F8p35DlD4asDjPvybCMwGfLPum9VeO2lVI5Tw=; b=vGOuGmJlIYUV4qK0zYMenpR1qLOW5DGNYRcDbsJj0sch84Ho6ppdPC7ZhFPDW5UvcY JXd1gBgDNgA3J5E6o1IcOI4zFnwZAez7A1rRqyR8zB2OqmYkT15lPczDV2mPp5FJvH+9 4CETt2wlTy4HPf9SdC7mgy98m4dA9s1wN46z05rteCgIMLaif8qDL9qDZC2bw0Ba9ryr 2oi/J/SY1r3OgAs7f4jvamFc+tABhT7cWq3V1nfKpQq4OPMchBcUdOocZSU3y1VXo7s7 GkxdS4pxCmWS6h/H4TzMLoybjMKF2ZaEpkJ3qZH6oPbFwj7yCkGS9TVi/OiSP2mHqBEM mkEw== X-Forwarded-Encrypted: i=1; AJvYcCXf7LSjqmH42MqGIpZwi4N6QwT0zEklf11iSZVFluueQfs7DTD4DItx7/b6n8T2HhG1itd/fm/jenOdy/MCWRdPPXNfOTjvzFT570pqpXSPQlKc X-Gm-Message-State: AOJu0Yz/eVvPmzcPPHJ8EoyEnwAtj1Y2hvHuPJW766S/LiW6pODo0aHi zZXUF2CyBZN+ImvfUG1IFT2KxRKIR1K3tMdkTFZPsiDXS/UeRF3E X-Google-Smtp-Source: AGHT+IGRunLO6mFzSc2Jy3s5TzQ57XC4kIYZhicOz2t0jYUM6P5DBFc/NWlT3v1DejDwVVb0J3v/0g== X-Received: by 2002:a9d:6b15:0:b0:700:d428:1cd1 with SMTP id 46e09a7af769-702077756d3mr12771626a34.3.1720042968011; Wed, 03 Jul 2024 14:42:48 -0700 (PDT) Received: from sean-ThinkPad-T450s.lan ([207.191.35.252]) by smtp.gmail.com with ESMTPSA id 46e09a7af769-701f7b20953sm2111417a34.54.2024.07.03.14.42.45 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Wed, 03 Jul 2024 14:42:46 -0700 (PDT) From: sean.wang@kernel.org To: nbd@nbd.name, lorenzo.bianconi@redhat.com Cc: sean.wang@mediatek.com, deren.wu@mediatek.com, mingyen.hsieh@mediatek.com, linux-wireless@vger.kernel.org, linux-mediatek@lists.infradead.org Subject: [PATCH 01/29] wifi: mt76: mt7925: update mt76_connac_mcu_uni_add_dev for MLO Date: Wed, 3 Jul 2024 14:42:06 -0700 Message-Id: <6b2502d0c3a53093f83ae33329e9d782ba2465b3.1720042294.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-20240703_144249_248509_EE308A4D X-CRM114-Status: UNSURE ( 9.92 ) 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 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 | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/drivers/net/wireless/mediatek/mt76/mt76_connac_mcu.c b/drivers/net/wireless/mediatek/mt76/mt76_connac_mcu.c index 4e3c8af98fe7..4dce03ddbfa4 100644 --- a/drivers/net/wireless/mediatek/mt76/mt76_connac_mcu.c +++ b/drivers/net/wireless/mediatek/mt76/mt76_connac_mcu.c @@ -1214,7 +1214,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 Wed Jul 3 21:42: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: 13722858 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 BD3A1C31D97 for ; Wed, 3 Jul 2024 21:42: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=4D8GOqEYIjIhd4nO67HazbxOlKo7VMKVeEfzgJOHMfM=; b=1mnVMt6f0A57b50ri+PHkyx3Y5 Oru9km7qP8Qbzm5vlv/ETaOOPy9Pa7e6gTTJqA3uAvrcIhuB906k8aPk1fsaaH+06SvQfarhfIuVi 6HM959gp2MKWCQbn+uwS1e6MZqj92P2qDLVy9PjYfHK4B/IsDeBVGrRZeXhwYDQwbmnpKfl4/aT3o tNGdkWs7yxte1IG1T6OSbk1CcaAGrJd7NW33iVUbWjD4xl2jPIhUaYPjAgfTdnTGWRft/IvmKteKd bOQwspIUkgaR1sfR7WbXZnF3h4M0mDJV/GHI4GhP3SHjjBOGg0n7YyB9EuRx4bUxfm8Amo1BwGk4w ve2FQyxg==; Received: from localhost ([::1] helo=bombadil.infradead.org) by bombadil.infradead.org with esmtp (Exim 4.97.1 #2 (Red Hat Linux)) id 1sP7kc-0000000BWyE-1sJV; Wed, 03 Jul 2024 21:42:54 +0000 Received: from mail-ot1-f42.google.com ([209.85.210.42]) by bombadil.infradead.org with esmtps (Exim 4.97.1 #2 (Red Hat Linux)) id 1sP7kZ-0000000BWwo-3KC2 for linux-mediatek@lists.infradead.org; Wed, 03 Jul 2024 21:42:52 +0000 Received: by mail-ot1-f42.google.com with SMTP id 46e09a7af769-70204bcd5eeso80640a34.2 for ; Wed, 03 Jul 2024 14:42:51 -0700 (PDT) X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1720042971; x=1720647771; 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=4D8GOqEYIjIhd4nO67HazbxOlKo7VMKVeEfzgJOHMfM=; b=GM2r7yzqj5VXxmSXVdkAcB6UN3ySw8TUo/pZvqVy/k3Wy5BnKpbqJyn38rGkeTcFsw jCUw4I2gyp65fuQ7OTCMBg4bowxYBMQ9sJRnD2O6i9HIowLy99TMLM9GIhdYM9F2gIwI WdXgt5NMvQhfB5eLXDZHpnv+Uevh04kL6lN6PRPu7K81L+Ju2AxQmsmWtZoSJIeZWwcR ilW5fLXJagyASyHGzZ6joSc/6CaTPq4JT3qljQZncQoPlgYup1Qej6Agx2ut5tBMsUrJ ySSvo7EXBKsurRzF1DP5fJq6J7jMfwEv+D0dxhKMB2S74TAEQT4N4dJyOPbVrtkJjVCy xAEw== X-Forwarded-Encrypted: i=1; AJvYcCXHO2uHsMagTRs++byYIvrsyQgjO1KUUIvXYARItmza01pkVK5jFYBDoqIZB+hqlna19SA4q4htRcuQVZKMDX/Y8DfxUiqYRj89DKW+WczuUGfI X-Gm-Message-State: AOJu0YwFLRJFAP8cJvta6BNWg0/u4kIlaElJBdIiTR+LQXExlDpobnzk FmOJeFopSU0HFk6FpXClR7bW1uL8WR10o0Rr16FPuRaWfjYgWDYC X-Google-Smtp-Source: AGHT+IFEM8AtOC4VbrN1MHEZJ0NHJbO6KnrzFOQm439w+AkKKPB6yfmZQC83oKo5lnuyh8d2s8jkcQ== X-Received: by 2002:a05:6830:1bfb:b0:700:d064:36d3 with SMTP id 46e09a7af769-70207742e4bmr13770945a34.2.1720042970791; Wed, 03 Jul 2024 14:42:50 -0700 (PDT) Received: from sean-ThinkPad-T450s.lan ([207.191.35.252]) by smtp.gmail.com with ESMTPSA id 46e09a7af769-701f7b20953sm2111417a34.54.2024.07.03.14.42.48 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Wed, 03 Jul 2024 14:42: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 02/29] wifi: mt76: mt7925: update mt7925_mac_link_sta_[add, remove] for MLO Date: Wed, 3 Jul 2024 14:42:07 -0700 Message-Id: <0fce480ad67237ce4f65138fe5e45f8090ae08f2.1720042294.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-20240703_144251_857426_F05B4EFF X-CRM114-Status: GOOD ( 11.68 ) 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, 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 | 24 ++++++++++++------- 1 file changed, 16 insertions(+), 8 deletions(-) diff --git a/drivers/net/wireless/mediatek/mt76/mt7925/main.c b/drivers/net/wireless/mediatek/mt76/mt7925/main.c index 8b10b63bc98d..1c8a44789e51 100644 --- a/drivers/net/wireless/mediatek/mt76/mt7925/main.c +++ b/drivers/net/wireless/mediatek/mt76/mt7925/main.c @@ -728,12 +728,13 @@ 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; + 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) @@ -753,12 +754,16 @@ 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, + if (vif->type == NL80211_IFTYPE_STATION && !link_sta->sta->tdls) { + struct mt792x_bss_conf *mconf; + + mconf = mt792x_vif_to_link(mvif, link_id); + 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); @@ -830,11 +835,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 +850,14 @@ 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_vif_to_link(mvif, link_id); + mt7925_mcu_add_bss_info(&dev->phy, mconf->mt76.ctx, link_conf, link_sta, false); } From patchwork Wed Jul 3 21:42: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: 13722859 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 2839CC2BD09 for ; Wed, 3 Jul 2024 21:42: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=8K/G1mFnUqG5/XVm+Bjq0BOwIjr9NKGtmLZt5vb8yyo=; b=bNHabj4oCyC//nsAPfEI2GqjD9 7Q6cRRB9ZwQsgBaDIrmlY0l+n//hL2+uMZ8w5jPx6SpzolcCAlpzn6/MwqHPXupax3n82qyhiQvWq 0BULMC8NaHNdeY0CG9jwlyEf7ChZg9LQermcAiWonkiSjv6k57FK/9PoGzJR42bk41TjUVrQXJy/j 9wxIvacu03dIE+rK25FP8MU6mn1JrHJ43MiQRfzNm7zmRCroon2ItuWZ5Mf9sKv2kcXhj4w1nODoG HSmlFLbYRT5/3/XdwzBOrup5uZtnU8jbtFA9j41iyChNbh+PhV93Sx9AUtCrnSaGr46ZCTSfGrh89 cGYSupYg==; Received: from localhost ([::1] helo=bombadil.infradead.org) by bombadil.infradead.org with esmtp (Exim 4.97.1 #2 (Red Hat Linux)) id 1sP7ke-0000000BWz1-3YY6; Wed, 03 Jul 2024 21:42:56 +0000 Received: from mail-ot1-f48.google.com ([209.85.210.48]) by bombadil.infradead.org with esmtps (Exim 4.97.1 #2 (Red Hat Linux)) id 1sP7kb-0000000BWxs-39I9 for linux-mediatek@lists.infradead.org; Wed, 03 Jul 2024 21:42:54 +0000 Received: by mail-ot1-f48.google.com with SMTP id 46e09a7af769-700cf03febfso89111a34.3 for ; Wed, 03 Jul 2024 14:42:53 -0700 (PDT) X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1720042973; x=1720647773; 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=8K/G1mFnUqG5/XVm+Bjq0BOwIjr9NKGtmLZt5vb8yyo=; b=h65CQOhKgichz4JSo+FckRGxOsAP1cAVU2U0pOfzASHfnLsvV4I+Ne2TfIyv7KVcHV cqpa+tbZAuAZiirAsEUJZ+NKzLbCkpe1MfpR2n2CXcRqp6pkBOTooKJrIPpD0+rpr8vQ 57VSMQQVEX1mxMvL3YpyS8XmZ3a0eC0yiOqd6zo2dpl9gcieceH1KQ9a8tj2MSZK2jHU aKdHU1FpHn+DVTiSDA5c80ni4FaH3XxqU2UAj0T3xEkg7sonrTcaIo+cx+7AK4hJOGLw +h+wXyT6xX50eJx0rlF6To3ymSreFIuJYy/CrCmz6KR1W1qdUvUUC4w/g9B1VyOE65zg H05Q== X-Forwarded-Encrypted: i=1; AJvYcCWNQyA8IlycBpRBfnOVq1Sc8RoviLWnq5AA9aXX8089KcrixAVLtteANfZcqAX9lLz9VLUUb8zZKxZ5PioNFo+DhQtQJ67uzzGUzFJlG6OGVJ1/ X-Gm-Message-State: AOJu0Yx6G0laLolmnmxytBRXu7qv6NyGcglLn3h7FU+MzqQmwHbcQXHZ cfJ8rIF06GJEW6h6tEjYfotEEexiXdBD3+S/s1cQFkOgDhY8SUji X-Google-Smtp-Source: AGHT+IEneCCcR7ZDKxvEJ7/VqWpNOTdFJy5jMTeENZKYzVaf+ecNU+xe/U5qPtR6pGZa7/YqfGtU4g== X-Received: by 2002:a9d:7e8a:0:b0:700:e0e8:5e2 with SMTP id 46e09a7af769-70207560e89mr12823875a34.0.1720042973070; Wed, 03 Jul 2024 14:42:53 -0700 (PDT) Received: from sean-ThinkPad-T450s.lan ([207.191.35.252]) by smtp.gmail.com with ESMTPSA id 46e09a7af769-701f7b20953sm2111417a34.54.2024.07.03.14.42.50 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Wed, 03 Jul 2024 14:42:51 -0700 (PDT) From: sean.wang@kernel.org To: nbd@nbd.name, lorenzo.bianconi@redhat.com Cc: sean.wang@mediatek.com, deren.wu@mediatek.com, mingyen.hsieh@mediatek.com, linux-wireless@vger.kernel.org, linux-mediatek@lists.infradead.org Subject: [PATCH 03/29] wifi: mt76: mt7925: set Tx queue parameters according to link id Date: Wed, 3 Jul 2024 14:42: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-20240703_144253_813092_72E73D10 X-CRM114-Status: GOOD ( 10.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 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 1c8a44789e51..4e5868cd2a97 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 Wed Jul 3 21:42: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: 13722860 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 C2DE8C2BD09 for ; Wed, 3 Jul 2024 21:43: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=goXkALOp2QwxSb3F7DJoCuE/hHvbXbI8e1rMayLRwD8=; b=ENLyX/O92FRiSf3a+OFX3HnfxJ 0Vx7Uz1J/Fo3kZzs2C957WfiFhRtSRUX55CxszfcAE8ZnQvXHaP3jpHkIgidDOIeMmaOST2sAZZPc 8Bt9uZTNJyb+6J09g04aup8kGelQyIwViT4fb00PBHEgl0gx3PklPx5FLEYQ+LgBfYy8jfr5GLDa7 jRgdQWJIbxxZlJ8orAAUOmasoIya2Yq9+r7RMSHf8F1XZ5SUQV54A34QgtgqkKLZvuZmq6PTNDVDN 9tUL5wEl8uBDlZp8FzC35wFp9uvgnWwmKBc3nrtALT9MKtIikx5NmCrAjZjdP53G2muOuLyFUMZbZ tfs8Ps9w==; Received: from localhost ([::1] helo=bombadil.infradead.org) by bombadil.infradead.org with esmtp (Exim 4.97.1 #2 (Red Hat Linux)) id 1sP7kk-0000000BX0r-25eq; Wed, 03 Jul 2024 21:43:02 +0000 Received: from mail-ot1-f44.google.com ([209.85.210.44]) by bombadil.infradead.org with esmtps (Exim 4.97.1 #2 (Red Hat Linux)) id 1sP7kh-0000000BWzm-2RAx for linux-mediatek@lists.infradead.org; Wed, 03 Jul 2024 21:43:00 +0000 Received: by mail-ot1-f44.google.com with SMTP id 46e09a7af769-700caf4cc3bso113613a34.0 for ; Wed, 03 Jul 2024 14:42:59 -0700 (PDT) X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1720042978; x=1720647778; 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=goXkALOp2QwxSb3F7DJoCuE/hHvbXbI8e1rMayLRwD8=; b=JR4nwaad9fo5MMdlGk+y+sa9VPikSSCPBwB7ImVIj+sg/m8vfg3Nwf6LnYI1Zsl/LK r0wrz8dV7frhPGlEshrRIHw9vsgSoY/x+LsSGOSNB3Ejb7GAJlfLQlQEM5aZgr2KcO0t AgY4dnWoLiun0ogsOg5dKA9MsZjfDgvotZhh2y7urqy1J5lL/eQGoFugCeXPavB1frbd cfknMmzUpIeuhE5zyemfF0VfKNEK8mngd5qSOJDwSfs1NXjA4Woc6sYXOTG9LX7gV6l7 n+OsBUV20Qdz2dl53EdbZxJL95Wkl1ct7bEUF7UYkPsNFq7FQxG5Lq6BKPbmPXm2a1WL drlg== X-Forwarded-Encrypted: i=1; AJvYcCWL4HVareQWo3Zd/61qoXbSFFmrbrfggzVQtdfuc42pOKWMFgaF1Avy1rzyKvfhQ5BmwZantbRUxR7SDjtuhu5D+docO/+2WHuCXGIXrqIr7+QK X-Gm-Message-State: AOJu0YzuqwuH1rP7CPSrZE7pydv0VDyozq6pBQeNEfKGP4L3gB0eemyf gO20zb1st2BMlNAe+SBtRFPuXj72N2IN2KV4QPZbYF5LeXkrp2um X-Google-Smtp-Source: AGHT+IFuEHcrEkFGiG9Dyf8kec2Kt4DL7xC2+P5Vzquxj3GgGa3ypEjfwcD1TpMXK4x8XZb03jfDgw== X-Received: by 2002:a05:6830:1095:b0:701:f306:ad39 with SMTP id 46e09a7af769-7020768b4a0mr12292209a34.1.1720042977460; Wed, 03 Jul 2024 14:42:57 -0700 (PDT) Received: from sean-ThinkPad-T450s.lan ([207.191.35.252]) by smtp.gmail.com with ESMTPSA id 46e09a7af769-701f7b20953sm2111417a34.54.2024.07.03.14.42.53 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Wed, 03 Jul 2024 14:42: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 04/29] wifi: mt76: mt7925: set mt7925_mcu_sta_key_tlv according to link id Date: Wed, 3 Jul 2024 14:42:09 -0700 Message-Id: <2a6000f8e280ceacc4e19240ff41863426839776.1720042294.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-20240703_144259_648002_4C0523D5 X-CRM114-Status: GOOD ( 14.60 ) 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 11b9f22ca7f3..01646538087a 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 4e5868cd2a97..0b486afe9352 100644 --- a/drivers/net/wireless/mediatek/mt76/mt7925/main.c +++ b/drivers/net/wireless/mediatek/mt76/mt7925/main.c @@ -746,6 +746,7 @@ static int mt7925_mac_link_sta_add(struct mt76_dev *mdev, mlink->wcid.phy_idx = mvif->bss_conf.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 Wed Jul 3 21:42: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: 13722861 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 76164C3271E for ; Wed, 3 Jul 2024 21:43: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=W7PGupETUQJAUNPNhJLXB9UGMjXfuQAyAWBEVi1wM2c=; b=XYkjMPah6D/PtjA+FWDWyF1tnQ Zlb7AKIqTXASxba+DeNBBAaofQ1C8qQRz93eoM45uDRUlRBeySKBb+6rQnWl5JxUlMEFpyqEq6MEn j1Op14JC7zb0b8t7MKH6QqmofNGMEOon5E7F7ALgB9RQXW5l9UvpiSuaLKNPxm/tmXSSt0oKSwU48 eaaTWhHWjwxY7Np6qncZmTbIsy/GgW8f2+dRBGpuMmK95sNpUlT45j+F3Jej1+BNLt4eEXeNG+S8b +zCacV++qfo9J7iG0/ZEmDa0gwjCuJ9qIvqjgzcznX04/8EAw0itkOP8DAYeczCXTcwKyHXXEo4n5 V0L85iHQ==; Received: from localhost ([::1] helo=bombadil.infradead.org) by bombadil.infradead.org with esmtp (Exim 4.97.1 #2 (Red Hat Linux)) id 1sP7km-0000000BX1s-0jAL; Wed, 03 Jul 2024 21:43:04 +0000 Received: from mail-ot1-f41.google.com ([209.85.210.41]) by bombadil.infradead.org with esmtps (Exim 4.97.1 #2 (Red Hat Linux)) id 1sP7kj-0000000BX0T-2fEc for linux-mediatek@lists.infradead.org; Wed, 03 Jul 2024 21:43:03 +0000 Received: by mail-ot1-f41.google.com with SMTP id 46e09a7af769-700cd6afa3eso204786a34.1 for ; Wed, 03 Jul 2024 14:43:01 -0700 (PDT) X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1720042981; x=1720647781; 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=W7PGupETUQJAUNPNhJLXB9UGMjXfuQAyAWBEVi1wM2c=; b=q2M/8G16W1TbZ8uuKON9qMofTjvvA0dAUGCgTOS2sWsMUq2w/CwjcCF6eVlLMktGz8 ZsLp3ErTarkiK0QOfBZ3th9z823y83eUtZSrPp7HV3/9ZwYOpW+Eu9ce1ZDbAh7C3yaT ISOgMRZ+og3yWlUAyqfNZMmCrArF1uV6pE/BoXyxQJn63ykJuOKnU2EP+GZfbiAa6Lhl VJZ0OBQ9a20a47Y2j41pOa8xVOHNYOjw7x3itIHFFpcJaBB7+g/y90OpeMBM/D6p7WEi 2Eu9OWW2TbPOQDWyCyqeXVwvffR0yzZNhaC+5uCPSWkq2xZ+Qi+TJB7Pmv6f2fURJHRT rgNg== X-Forwarded-Encrypted: i=1; AJvYcCXtbduswJ7x4zQiXwnqhO9PEvRdZFP0yi0Hv6HeeT2TKBCa5WwAdz2XtGfyNX8EcbHKCHh0ICt2p16fPQ3ptBRGUZQPOdsI97LgEbD6nr97Z2W7 X-Gm-Message-State: AOJu0YxcCrG1debdkmUKbgwdSJx+gyGyqz4KxePR8z1iM9reF8iKzN/j 2qNYfopvb/anI14lEfpxmBT5xlxBYtnXEKgpw2uEqqMJsi98ze41 X-Google-Smtp-Source: AGHT+IFs8z5tFdp9iaiINsY/W0pW70iwOppFb6clHGmnsTdd61oxtC5rmZXGAMjMJWq4P01yGijDAg== X-Received: by 2002:a9d:5c89:0:b0:701:f366:71d7 with SMTP id 46e09a7af769-7020767ab30mr12877316a34.1.1720042980638; Wed, 03 Jul 2024 14:43:00 -0700 (PDT) Received: from sean-ThinkPad-T450s.lan ([207.191.35.252]) by smtp.gmail.com with ESMTPSA id 46e09a7af769-701f7b20953sm2111417a34.54.2024.07.03.14.42.58 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Wed, 03 Jul 2024 14:42: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 05/29] wifi: mt76: mt7925: add mt7925_set_link_key Date: Wed, 3 Jul 2024 14:42:10 -0700 Message-Id: <6526aeab0d71104fff8453e086f8afe0d5eec70c.1720042294.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-20240703_144301_709926_346C3B83 X-CRM114-Status: GOOD ( 13.84 ) X-BeenThere: linux-mediatek@lists.infradead.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Sender: "Linux-mediatek" Errors-To: linux-mediatek-bounces+linux-mediatek=archiver.kernel.org@lists.infradead.org From: Sean Wang 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 | 66 ++++++++++++------- 1 file changed, 42 insertions(+), 24 deletions(-) diff --git a/drivers/net/wireless/mediatek/mt76/mt7925/main.c b/drivers/net/wireless/mediatek/mt76/mt7925/main.c index 0b486afe9352..264517fd3bf7 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,12 +544,10 @@ 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); + mconf->mt76.cipher = mt7925_mcu_get_cipher(key->cipher); mt7925_mcu_add_bss_info(phy, mvif->bss_conf.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); if (err) goto out; @@ -579,8 +574,31 @@ static int mt7925_set_key(struct ieee80211_hw *hw, enum set_key_cmd cmd, 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); - 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; From patchwork Wed Jul 3 21:42: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: 13722862 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 F07E5C31D97 for ; Wed, 3 Jul 2024 21:43: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=t0BFel98EDVIGHnXe5DFOMwxtme8/0IpNqrQiHcZbZk=; b=xUdx+i4aY/T/wzQf4yqmdBlcGp uWNPBC7NeH80dJye3QSvhQ+ofjoOV5k0u1HZzC11EXubHGSwFevTiV1FravI1iJs1p9QnnTXnkn2W hHSpi0lAWnQY7i0V9OPsK1fdXDomdbPYc/Jgm8oFtJvK7KDgQBH91+IxmuoyqsVO0vO1zoegfr8JP GFwQ98XFpPiw79WmOlyBJ1cTPtQzvieX4Y/50Fc06vQODj1/KfhSghxABlyWzL2En/xSuIHZD5CG8 y2JFEPmKWLOhmP14OGz+gRmMvFtv/YQEkx2feg1rkdTQ4eeCGmZuzB6vYDGvIAySxz1wWJsrq4YoU EZV4QwBw==; Received: from localhost ([::1] helo=bombadil.infradead.org) by bombadil.infradead.org with esmtp (Exim 4.97.1 #2 (Red Hat Linux)) id 1sP7ko-0000000BX37-2X0k; Wed, 03 Jul 2024 21:43:06 +0000 Received: from mail-ot1-f44.google.com ([209.85.210.44]) by bombadil.infradead.org with esmtps (Exim 4.97.1 #2 (Red Hat Linux)) id 1sP7kl-0000000BX1R-2LKi for linux-mediatek@lists.infradead.org; Wed, 03 Jul 2024 21:43:04 +0000 Received: by mail-ot1-f44.google.com with SMTP id 46e09a7af769-700cd6afa3eso204790a34.1 for ; Wed, 03 Jul 2024 14:43:03 -0700 (PDT) X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1720042983; x=1720647783; 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=t0BFel98EDVIGHnXe5DFOMwxtme8/0IpNqrQiHcZbZk=; b=L1FgFZhYyucTj0XWCiYwB/JYP9vWCnkasqim0pED1EDcFmcoy5/4xE/jbqPyoEVk/m VzK6jdadLenr8A9aJrgrOD86durJ9T1PdB25zUw9E60wcChiE/TF3nrtyZTFBhEMPiUJ fFkCape+SO5BUWcwDQCH//ATFuECKgQ+zQKvO+2+plMbB5VAkE+ftjs2oZjDl2uBdIyw CRs4zSiNE7l+49NXepa498o7kIVII1wYZfULIz3wv1YwGq8Vod+u3o0PgfLmvHNBnRZt wFcM31uVt4NVVCMnzvZLCjhZ9mVCPRmMn8bowgg63PzG/Rp8hq8OKP4VXe75LcU+HROK YZqw== X-Forwarded-Encrypted: i=1; AJvYcCWUUiVRQdlRBzQ/SAkRLRy9Jq4ILqx7jB67ykeRJ/o6owsjPk45qN3vTtir+7rHat61e5fxLlll6UIN+j7wVAKIA3VAVhd3UfOi5hXtYTOUYVds X-Gm-Message-State: AOJu0YyEuywbs96XlKddI/hK/WfRuv3DTDxKvwT6oA9Wd6TveIZ7DX7u HF/B+Njvwjoid9bQpTM+nHKrzXFu0+0B2ZHPEAIY6P7ylP0g5a+Ku299YdEE X-Google-Smtp-Source: AGHT+IHIBPuhs8S/MmmkZNFJsi7Mj84zI6cdYeuYdxvyA0eRKWGxKSOxqLyhUH0gAs/hnQgh4qCzhw== X-Received: by 2002:a05:6830:4623:b0:700:ce5f:968c with SMTP id 46e09a7af769-702077496d6mr11309998a34.3.1720042982755; Wed, 03 Jul 2024 14:43:02 -0700 (PDT) Received: from sean-ThinkPad-T450s.lan ([207.191.35.252]) by smtp.gmail.com with ESMTPSA id 46e09a7af769-701f7b20953sm2111417a34.54.2024.07.03.14.43.00 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Wed, 03 Jul 2024 14:43: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 06/29] wifi: mt76: mt7925: extend mt7925_mcu_uni_roc_event Date: Wed, 3 Jul 2024 14:42:11 -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-20240703_144303_621094_FD3BBE0F X-CRM114-Status: GOOD ( 12.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 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 ba91c8e37dff..5693c21bfb4a 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 8ec5a3a20202..2de1e38689e7 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 Wed Jul 3 21:42: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: 13722863 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 6FDD4C2BD09 for ; Wed, 3 Jul 2024 21:43:09 +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=jnnFcNIlRLu9h3/UZWU/y9qWihK6R2k0jAbg00BAKDs=; b=eqk2BgOffhu+I2Uu1TU2/ZB6pg 4ViEo6X3V1B6uiR8gMMczvWoknfQUXSHgLHno/+SD06oo0m7ZqgXQhIqAXKLM3t88fCC3Bj4d7PHK 37Yhtwy1tCXJXPx4hqpOq1yQ46J6vjEJe3UhvVfNnXsoEGY3qwMQ3sugrVR/8qN/kHIs0qRrEubQ6 6vUZMF8FvolUyuiW7WCSJIWqxw5x4pfJWwP8uEqgLHKQ29FhEU6X4AFeGkSAUN2GuPA6cjfR/xFHg rP+r1cRle4biGa+FyT8kkvry+DlTdVJ8YH7ayoWuvjEVy3ce+wStCKkosDxrFVUMoTcLQNvDqmt8n 6C/Z+q6Q==; Received: from localhost ([::1] helo=bombadil.infradead.org) by bombadil.infradead.org with esmtp (Exim 4.97.1 #2 (Red Hat Linux)) id 1sP7kr-0000000BX4l-0TmW; Wed, 03 Jul 2024 21:43:09 +0000 Received: from mail-ot1-f47.google.com ([209.85.210.47]) by bombadil.infradead.org with esmtps (Exim 4.97.1 #2 (Red Hat Linux)) id 1sP7ko-0000000BX2m-2Fv4 for linux-mediatek@lists.infradead.org; Wed, 03 Jul 2024 21:43:08 +0000 Received: by mail-ot1-f47.google.com with SMTP id 46e09a7af769-700caf4cc3bso113616a34.0 for ; Wed, 03 Jul 2024 14:43:06 -0700 (PDT) X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1720042985; x=1720647785; 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=jnnFcNIlRLu9h3/UZWU/y9qWihK6R2k0jAbg00BAKDs=; b=bg1EaT6ytagvTJlgxaZJq+50Icdb53NxLrM0ZpdRBn87mBtgEZT6QX+ZuII1ofa2eX Yu7pIA+RUq1Y6rPIXR326dzPHu8824x22kE/pt6z+Allp15bcXSqF5xZIoOPKwaUHkmg 2zw2/CmvNp5APPzbtWBQ2XLxz9cQaxr5QcV4yf8+i1At07dsYCQJ2a+Qfytzpcz85DOQ qzg2aQgbH6BxWkCLIcYylP7sAwhQVxKD66zHp2ZcjuLd6iUmA77OVOFG4lTakt5GpExo K2SHnSd0oSYHM8NmKCneVnaKXDg1has0ReZYXw+bPEeb7uKbvjf8uPvvqEHUrkDreVnq Tp1Q== X-Forwarded-Encrypted: i=1; AJvYcCUmAnrF2JgXrLSsonGKU0hyWgAHdNyAC9yTZD1jg8ei+bff+sH9EnD3Az8Q0ljzs+1GqRuqRvoM/j3ji6evXcIi6DrdkhHsA9lDoYSNwVRXYyjJ X-Gm-Message-State: AOJu0Yx2fBaDxNonZ9lMAUPdUi28mKOauBVow/d+sbsgql5XWEHngI/n q632+6bOQvMOCcKviLomH7ngeNeHExWdiuxjqIWD1hY57fSEoS7g X-Google-Smtp-Source: AGHT+IFRSikQVc8FWQX6gO02PCmAbad71auZ/8T91RgSglqwFXC1GLz5+48snIR2vtKUFVtZ8rW8MQ== X-Received: by 2002:a9d:7e8a:0:b0:700:e0e8:5e2 with SMTP id 46e09a7af769-70207560e89mr12824234a34.0.1720042984959; Wed, 03 Jul 2024 14:43:04 -0700 (PDT) Received: from sean-ThinkPad-T450s.lan ([207.191.35.252]) by smtp.gmail.com with ESMTPSA id 46e09a7af769-701f7b20953sm2111417a34.54.2024.07.03.14.43.02 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Wed, 03 Jul 2024 14:43: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 07/29] wifi: mt76: mt7925: add mt7925_change_vif_links Date: Wed, 3 Jul 2024 14:42:12 -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-20240703_144306_652773_07D5B315 X-CRM114-Status: GOOD ( 22.02 ) X-BeenThere: linux-mediatek@lists.infradead.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Sender: "Linux-mediatek" Errors-To: linux-mediatek-bounces+linux-mediatek=archiver.kernel.org@lists.infradead.org From: Sean Wang 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 264517fd3bf7..c9119a222427 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 5693c21bfb4a..b62153671350 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; @@ -1079,6 +1082,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) @@ -1089,25 +1186,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 2de1e38689e7..54693624b182 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 Wed Jul 3 21:42: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: 13722864 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 40838C3271E for ; Wed, 3 Jul 2024 21:43: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=9TOWM2avYXo/xP6pN6yETRbPs1gdrDHvtIHr+R1SQlw=; b=ngecG5TEEIBqcVzSqED6ipXlxh HaMOGr2g4X9WdNIM+zWlWLbpNmXicA0HRFaf4skgOjFul19e7MkpQlZpbwwSr42f6mY/Niwn9recm +fYBooM35edmmUBsE9ip/LR47p1gW69mFuuxpl6a74cnh/UvYxIQWJ3vTyqiatiO0JPirC7fI61Tb iq+dt6FR9WdYg1GMdQ8u5kYy7n7tXXoTbIDEiuAdQQTAUrPUSoh/HVmKJX2ATxjLeVihy/bIwR3bA B9RIf04CetnDlVDbR4sdwywXXoVZ7diCjfUwjBzo2w1vQ4j1hQJ/0HaiZZQq7zXBTtEpPbobVftpt 67txpv8g==; Received: from localhost ([::1] helo=bombadil.infradead.org) by bombadil.infradead.org with esmtp (Exim 4.97.1 #2 (Red Hat Linux)) id 1sP7ks-0000000BX64-42QI; Wed, 03 Jul 2024 21:43:10 +0000 Received: from mail-ot1-f54.google.com ([209.85.210.54]) by bombadil.infradead.org with esmtps (Exim 4.97.1 #2 (Red Hat Linux)) id 1sP7kq-0000000BX48-1yOp for linux-mediatek@lists.infradead.org; Wed, 03 Jul 2024 21:43:09 +0000 Received: by mail-ot1-f54.google.com with SMTP id 46e09a7af769-700cf03febfso89118a34.3 for ; Wed, 03 Jul 2024 14:43:08 -0700 (PDT) X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1720042987; x=1720647787; 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=9TOWM2avYXo/xP6pN6yETRbPs1gdrDHvtIHr+R1SQlw=; b=gY6KG+wSSl2qNTReClWoQQBsuoujA+4J78OBUSYvRYTc0Sfk364z53SmiaP/YjwwOg 7OvfVJcFFV5jUSbqAf+mNJBqtA8QP+RcVb24Mjovbpy52+jyi6up1MkIq58IfR3tNJvI TXR0SnBA6rAKNYoc5VwQeOI4WwkRsKHgMkGiE8JbVTTQr00808QqitoMxsxq0Hv/kgwt 91IFuXdDv7Ee1qVc+Utia11i1Dk0a9fQZS0RrqP8nnLwOhhrmFk91hIC46x7l674b/vL PhbFVTkSq82MVfequ0GlCrLnzs5KtS8QIXYO5XccMFw23C6q3bs8X4BcoUzFNuxTvUlf gH0A== X-Forwarded-Encrypted: i=1; AJvYcCUr7+wkMh5GMsd+E+SjSEnqlY5ya27a4wkj/T8dDs5Z9FmIRle4q77XsgudNiYiyq3HA5ED0uz5EkvlxCUCOM3qlh5LxbdcALrd/nTCKwsub6az X-Gm-Message-State: AOJu0YyiorAX/9sxR17WsoeC2M2IpxcMCW+LTwoBJ5yapMy/fNNO7CIj le5HKvAhAb3+yRE6TkGl9ksAlxw4PihRcJY/SwLqmPJV7jgGjOnwNuRB3Syb X-Google-Smtp-Source: AGHT+IHB+8D92ICxDGrelbsO6+AY0q19flJoPxzsqBAYCuqHkQXeoHpWCeXCgy/9CJA3vEU2E60bXg== X-Received: by 2002:a05:6830:2007:b0:700:d1c1:e12d with SMTP id 46e09a7af769-7020775bef2mr12607744a34.3.1720042987444; Wed, 03 Jul 2024 14:43:07 -0700 (PDT) Received: from sean-ThinkPad-T450s.lan ([207.191.35.252]) by smtp.gmail.com with ESMTPSA id 46e09a7af769-701f7b20953sm2111417a34.54.2024.07.03.14.43.05 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Wed, 03 Jul 2024 14:43: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 08/29] wifi: mt76: mt7925: add mt7925_change_sta_links Date: Wed, 3 Jul 2024 14:42:13 -0700 Message-Id: <8003cfbdec2c1357fb9d7ac8ba93af5fd0b4ec5d.1720042294.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-20240703_144308_538411_6BD9B370 X-CRM114-Status: GOOD ( 17.29 ) X-BeenThere: linux-mediatek@lists.infradead.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Sender: "Linux-mediatek" Errors-To: linux-mediatek-bounces+linux-mediatek=archiver.kernel.org@lists.infradead.org From: Sean Wang 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 c9119a222427..0e554b21692e 100644 --- a/drivers/net/wireless/mediatek/mt76/mt7925/main.c +++ b/drivers/net/wireless/mediatek/mt76/mt7925/main.c @@ -811,16 +811,79 @@ static int mt7925_mac_link_sta_add(struct mt76_dev *mdev, 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 Wed Jul 3 21:42: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: 13722865 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 B1305C2BD09 for ; Wed, 3 Jul 2024 21:43: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=a5jt3ki0dxujpF+hrHkEF4OlQEJHlnIToDmNgU6Pwh8=; b=ZSUVCXYKfqX0A385yuFYR5ynMY w8IdLnlFinstjkGYANS/n+1emfBMhsmeY5HraoDJCMBCQO87Mh2iXUcUsvDVKlIUqrPfTxwfCF7lB cfh9sFwGdnr/QHZrnF4nOr+qLE1Cl+J8xeaOvuO/ZbEZ3xadAjjSCJiZvXjT6cJy962j+x6pEiIE0 dwjpPq0x0gmhZp6n5rsHPFZ7pCGoNuBGthQre4So5oXkPhSyr3ijzOyvFHAIzlBsXSzG39/mgo3Mf IBwlhX4ucBWlkQiOKZnE6MwZRcOuGIZwr/PU46B4waTubesRT7YdT40BKxhw0cpCt4DbZVDAVkA6k SCnfdF0Q==; Received: from localhost ([::1] helo=bombadil.infradead.org) by bombadil.infradead.org with esmtp (Exim 4.97.1 #2 (Red Hat Linux)) id 1sP7kv-0000000BX7W-1dU5; Wed, 03 Jul 2024 21:43:13 +0000 Received: from mail-ot1-f45.google.com ([209.85.210.45]) by bombadil.infradead.org with esmtps (Exim 4.97.1 #2 (Red Hat Linux)) id 1sP7ks-0000000BX5O-2MIG for linux-mediatek@lists.infradead.org; Wed, 03 Jul 2024 21:43:11 +0000 Received: by mail-ot1-f45.google.com with SMTP id 46e09a7af769-70218c133adso134074a34.2 for ; Wed, 03 Jul 2024 14:43:10 -0700 (PDT) X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1720042989; x=1720647789; 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=a5jt3ki0dxujpF+hrHkEF4OlQEJHlnIToDmNgU6Pwh8=; b=mQYRiGB4UoYBUjJzegXFN1m2HwWZ6zruMvXzF7SCERaxhqoU13YAEdeic68qQKUReH 9oJnkjBnlaMJAZXUslY4ubp8IiTpq37YWcea7rOc3QXQH2OslGhpcaIHBwR5pbwQ4NlN DjEhUgUa4iG+F9MtsAKrBPFtVMNjYpS/bU8d27gjOj0nljdgz6L1/ymOoSEPn9ZJbtWN o0zmDM+u8IHD/rwLL/Wmc9+u1wwS95DG4sssZR6tSkmlkcn5IUBtb5IP0Eub8L1LDk12 JPu3b0QDRa5rw3q9UNO80AweWpwClCNlzwrGVR0HbC+Hf3NTJbHfWFt/3nwSeLfiwDUt AN6A== X-Forwarded-Encrypted: i=1; AJvYcCUB+H3FmR2IePrewuSIy//EtBx1/4oAtb27L41IvTvpRBaTHMWnDWj0SngdyxOvPGqk2PQERaeNzMfnM5aGBN1fP/IK0jh5qHP226eHCM73KrP6 X-Gm-Message-State: AOJu0YwUkPar0+t64ShXSSXXEH0anuW9UiXkB87P7rfWI85lM3CCBaqh 6tqURGUvc3ubRd+u6u603FbxxxMEdIGKV198z3Gftkr20HZajPkptQvRT8Az X-Google-Smtp-Source: AGHT+IH+yhvRJNPDLOf155UX4LN+InGILwsLbUzzyWl2sYHJHsM69Z5/iy6EGQ/+WKVapU70TMpjBw== X-Received: by 2002:a05:6830:4623:b0:700:ce5f:968c with SMTP id 46e09a7af769-702077496d6mr11310220a34.3.1720042989603; Wed, 03 Jul 2024 14:43:09 -0700 (PDT) Received: from sean-ThinkPad-T450s.lan ([207.191.35.252]) by smtp.gmail.com with ESMTPSA id 46e09a7af769-701f7b20953sm2111417a34.54.2024.07.03.14.43.07 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Wed, 03 Jul 2024 14:43:07 -0700 (PDT) From: sean.wang@kernel.org To: nbd@nbd.name, lorenzo.bianconi@redhat.com Cc: sean.wang@mediatek.com, deren.wu@mediatek.com, mingyen.hsieh@mediatek.com, linux-wireless@vger.kernel.org, linux-mediatek@lists.infradead.org Subject: [PATCH 09/29] wifi: mt76: mt7925: add link handling in mt7925_mac_sta_add Date: Wed, 3 Jul 2024 14:42:14 -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-20240703_144310_634397_D33FD609 X-CRM114-Status: GOOD ( 11.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 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 0e554b21692e..82d16208764f 100644 --- a/drivers/net/wireless/mediatek/mt76/mt7925/main.c +++ b/drivers/net/wireless/mediatek/mt76/mt7925/main.c @@ -887,15 +887,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 Wed Jul 3 21:42: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: 13722866 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 6A455C2BD09 for ; Wed, 3 Jul 2024 21:43: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=xjjV9MoW6/GqqLbyBVNCqJec5vStgsiVvPCH52PPCaU=; b=oynclQIgUaHhq1IBmbN9cgwoRV 6w54CFltXgAXbxxN0CeoYYCyODs5yzy9l/HIxMJmJTLTrdmqKETZYdW8S/GXnzC6ciS6tcOaOrqTm E0Rcv4MCzzb+0rfaqvjugdZ5QBP4DfILInq/UsqK3QpAcNae/xVNHUJYk8GCkllOJMbEExyOCDs6d sKD6TTZkL16X0iUJgh9Zgl8m4aswznQAPZtWEeU2FF2TJ5Lz9640Fr5gvaVJN+ycMAYmCBGEqVU0R yu8OILhWzmWFJRZnObGUrhb02QI20IY1XS07YPzJOgQxdcXq/35qnuxPXpcX383BtIt8MjgjP+UJo djHo2WYw==; Received: from localhost ([::1] helo=bombadil.infradead.org) by bombadil.infradead.org with esmtp (Exim 4.97.1 #2 (Red Hat Linux)) id 1sP7ky-0000000BX8o-01y2; Wed, 03 Jul 2024 21:43:16 +0000 Received: from mail-ot1-f46.google.com ([209.85.210.46]) by bombadil.infradead.org with esmtps (Exim 4.97.1 #2 (Red Hat Linux)) id 1sP7ku-0000000BX6y-2YrX for linux-mediatek@lists.infradead.org; Wed, 03 Jul 2024 21:43:13 +0000 Received: by mail-ot1-f46.google.com with SMTP id 46e09a7af769-70218c133adso134075a34.2 for ; Wed, 03 Jul 2024 14:43:12 -0700 (PDT) X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1720042991; x=1720647791; 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=xjjV9MoW6/GqqLbyBVNCqJec5vStgsiVvPCH52PPCaU=; b=OnRdazTbPVVxPqe1JOOHlw1G8IisLD3IhxKf5bLk/RnqAnTPpMpz6vE07+YpV6sips wd99qtcPd17Zf0KDyTL+/96mfMO4o/yZEAJHtInxLdPyDzfUoehtL8qu/u4Au+phv4Jg Ma2+FzfRjNoSqM/QsoIC4mODTuDmj7bPx9aW2m4TEypk2P4cAQoZhVgxTDF0NwNnn34g miuphg30NBbDWotx2RDZCV7VRKIm6V1XzuDf0ISdlUbSX+cykvhcGDtGwuBhp8fWzRYY EeIW4iOmJ9vrXORw17Ozr9VZfBVKtbgA6GsHFudBe4SZEU3wXAR28VZp+eESpb3f8PpL xRpw== X-Forwarded-Encrypted: i=1; AJvYcCWUu6mq7nKrXHsLCCqFZTdYEzRWKix84zV1FWe+wHueEb15isNjh/eWmiUp+7HpIwLhDFAjVldD8wdWtFI2mb/9/Y/tDyUeXdQ0SQ1JA4D4Jfsp X-Gm-Message-State: AOJu0Yy+YxDpLGnlOXiHLxgNMNRnPuPAL0Z2PzQeVawI+iA44AcKy+zc QJgW/uXBJ3DoB0VwV1T55lYDd3E+ouR3c+iIvUxtP9xE4BrZ3hl5 X-Google-Smtp-Source: AGHT+IHzTUePuwQCPzYY/JacfKT/2WyEXRpG6nm5RKejU7QJGziRTmVQSCSVqAKa2hnz66ETj0H/8A== X-Received: by 2002:a9d:5c89:0:b0:701:f366:71d7 with SMTP id 46e09a7af769-7020767ab30mr12877677a34.1.1720042991623; Wed, 03 Jul 2024 14:43:11 -0700 (PDT) Received: from sean-ThinkPad-T450s.lan ([207.191.35.252]) by smtp.gmail.com with ESMTPSA id 46e09a7af769-701f7b20953sm2111417a34.54.2024.07.03.14.43.09 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Wed, 03 Jul 2024 14:43: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 10/29] wifi: mt76: mt7925: add link handling in mt7925_mac_sta_remove Date: Wed, 3 Jul 2024 14:42:15 -0700 Message-Id: <84e2ec56c995fdf562b1d3146dd1456ec5cd05af.1720042294.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-20240703_144312_671742_45365423 X-CRM114-Status: GOOD ( 10.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 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 82d16208764f..5360f8a71655 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 Wed Jul 3 21:42: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: 13722867 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 D1D84C31D97 for ; Wed, 3 Jul 2024 21:43: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=6EEPHIPorQ9nGaiT0HOjyRcsXyquZCZmG1NVm4BqrTE=; b=CmFIQgCtb4oZYAqpubt9yTG8LO Gv/NjIr+P28QwXDCJA3Es8+bZt7qcHuRqU98Cc9V0UaZvsnKjqL6hCS/ETySe/hyFOf37yBxfszQK GcAwac7vI2YV0PB8T27VoIGLwhyxbDAFjbTY61FFUOYWsfY4ciPZHjj2sMnTBLNy+FZdVEna+426W cUNFctm8JINnDs4gb2safDRVJPxC8ZC/hyJzo0+Ud/qKG8u1YH6lnqQFLXkDoP3KmWMbS00LLKKaP 9JmwVKXfewd8t+Q9w07LfBXzcVGp5QIv2iCu/psW2dPecMoxNHvv8PqFDSOGAHTu+EcrnL8MN4blI p/K8dUbg==; Received: from localhost ([::1] helo=bombadil.infradead.org) by bombadil.infradead.org with esmtp (Exim 4.97.1 #2 (Red Hat Linux)) id 1sP7ky-0000000BX96-1RjC; Wed, 03 Jul 2024 21:43:16 +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 1sP7kw-0000000BX7r-1brq for linux-mediatek@lists.infradead.org; Wed, 03 Jul 2024 21:43:15 +0000 Received: by mail-oa1-f43.google.com with SMTP id 586e51a60fabf-25e19ad0050so9207fac.0 for ; Wed, 03 Jul 2024 14:43:14 -0700 (PDT) X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1720042993; x=1720647793; 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=P8Jx1o5CSWdW0BCmNUoSnVgJMVEgzH1SsKJrF9KOOZi7xexNx3iGb5ZQjculdbNtnX iLiSOd2y9T+NzCfJbOn6UPAiinZsduxKJ9/XPbM9bSiyyYSkW6GVhbqkWm7EKWx85FAq KNXpdSm40kP0QFhb48KOqCpdGgpWITt9Hs1N9ES2jrmn5BZlrvcUCKdJhJAz65YkSrnj A2/SYX9BiNA+i5iePjhfamoMdMbe2L25cOD/mJB2aQzetOUZOHdCeyl/xOsuHebfOjU2 wUrtPFfvUWPS/cChQtA10016qv1nOKgXqgNTAKOd0JiB2zyT5by//vKdY371JJ5kOze0 KKLA== X-Forwarded-Encrypted: i=1; AJvYcCV26CzV/h7iXx6xwNtVyZwlbMYXnU6VePIy4aasU7pYixVdEifaHaEhdwFdP/n3JzGJfU1e3LNY+0zZwdkcMNPQZN6zCjhHOXRic7X99nLTfwjj X-Gm-Message-State: AOJu0YxAOPcXR8P99kqih+tBCW0Gp5vix61yRXRvqR9FCOeK61kB2G/9 avJ9eD4PEOo9261xXJ68q+eDhSnFGlqsrsmV6RALBmKawyhcrpEs X-Google-Smtp-Source: AGHT+IHggK4Kg30dd8NLdj3jI1DxXMyqkfqDw4O6ut1WvmHHhY2tP43NFyj/9iepNGjGPUI4kHOJCg== X-Received: by 2002:a9d:5c89:0:b0:701:f366:71d7 with SMTP id 46e09a7af769-7020767ab30mr12877738a34.1.1720042993253; Wed, 03 Jul 2024 14:43:13 -0700 (PDT) Received: from sean-ThinkPad-T450s.lan ([207.191.35.252]) by smtp.gmail.com with ESMTPSA id 46e09a7af769-701f7b20953sm2111417a34.54.2024.07.03.14.43.11 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Wed, 03 Jul 2024 14:43: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 11/29] wifi: mt76: mt7925: add link handling to txwi Date: Wed, 3 Jul 2024 14:42:16 -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-20240703_144314_450921_AC429DAB X-CRM114-Status: GOOD ( 13.09 ) 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 Wed Jul 3 21:42: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: 13722868 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 CAD43C31D97 for ; Wed, 3 Jul 2024 21:43:19 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=lists.infradead.org; s=bombadil.20210309; h=Sender:List-Subscribe:List-Help :List-Post:List-Archive:List-Unsubscribe:List-Id:Content-Transfer-Encoding: MIME-Version:References:In-Reply-To:Message-Id:Date:Subject:Cc:To:From: Reply-To:Content-Type:Content-ID:Content-Description:Resent-Date:Resent-From: Resent-Sender:Resent-To:Resent-Cc:Resent-Message-ID:List-Owner; bh=P9X2Ept/O0sdVjyMsMVTI9tmtIsMoebdCU/+EmBDr+w=; b=SW6e+cXKua51NEJakM1sK8e7eu oroDZDXsCxqvLMCWikx4fiymz8fHZYNz13349aPpf/RKTTx2uTmsNFGJ/lNmwJKBhSyiAMcbEQWfm 0PgaKdxnYIlrMGlakrbxOWPCEMFUEn4eRQXNC5Y8dnV7rBtpbXvvvrlA/lo+caXhiCRQ7N0Wrt0e3 sGu40DcCNelbm6F2y4gUtEveLspAujcZROVPncjqOjbzM25zUqxxLR6Ge3WfR3zpMfSFIzUyvPT00 MKTlF//pMNUuYvyB6e3NZVrQjvq6kBlq2vMsiiDXs3F6ya8hVjdP1fctf0Zd1x/KYLS7wV4jrynnl bWF2IK4Q==; Received: from localhost ([::1] helo=bombadil.infradead.org) by bombadil.infradead.org with esmtp (Exim 4.97.1 #2 (Red Hat Linux)) id 1sP7l1-0000000BXAz-25yu; Wed, 03 Jul 2024 21:43:19 +0000 Received: from mail-ot1-f52.google.com ([209.85.210.52]) by bombadil.infradead.org with esmtps (Exim 4.97.1 #2 (Red Hat Linux)) id 1sP7ky-0000000BX8j-26Rh for linux-mediatek@lists.infradead.org; Wed, 03 Jul 2024 21:43:17 +0000 Received: by mail-ot1-f52.google.com with SMTP id 46e09a7af769-702021fba9bso113276a34.1 for ; Wed, 03 Jul 2024 14:43:16 -0700 (PDT) X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1720042995; x=1720647795; 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=P9X2Ept/O0sdVjyMsMVTI9tmtIsMoebdCU/+EmBDr+w=; b=QJU12ELsMKMQ9ymhbfoLaSncFLSVj0F4PqnxymHba8QkHYODkaWeS1kAOD+Ivw/lAC YF6vKGulpJzv9bHPQgm3RTE6LA/VGHwkWtBE7EKxue444TSfRvVvkBKGO3257uaqU0/U HBFkz4Chw4c1JWAcMFR6ZtjvSq1cRPTvrKXH10ARpfVEssri1NyUi1a6tdkqcINfBGAr N3j2bvLQlgRzzeqY0nNWrd843oFWfZSSJqLG2yobfL2/+qotPQdql98f3pfnrrI48bbh iQ1+Wjt5B/yrkg61K1lMzXnmXo6DH2bJ14kk0lDzzh+uF/B+S+ont29LGQOrW3JC5yf2 KDEQ== X-Forwarded-Encrypted: i=1; AJvYcCXVESbbn4N62sQHILg/K6mXkg1/rMQm6zyGXXLTopUIebhtcUD/WkSZIAT/l4amdHmT+rg9HztvY3muW5kOISNQjXrlCByFMZqraknEoPsRe5iv X-Gm-Message-State: AOJu0YwW0HkyA0CVD93loZFsFuiltziSHbu+xpW2Q43wQhLI68Fu+Jbh 1/51d+Ff0bALggzYn4XPWdSL1HQdJYjvcMdvLyTEmcLY6iJGVne2 X-Google-Smtp-Source: AGHT+IGGHAjakzXvQuXS7WHahMXqf59L78wQDAu9H4Irc6qqb9rGmo15ve1Zm6DDdwZ7tNsGV/Gmdg== X-Received: by 2002:a05:6830:68cd:b0:700:d697:6ca7 with SMTP id 46e09a7af769-70207554355mr12585002a34.0.1720042995442; Wed, 03 Jul 2024 14:43:15 -0700 (PDT) Received: from sean-ThinkPad-T450s.lan ([207.191.35.252]) by smtp.gmail.com with ESMTPSA id 46e09a7af769-701f7b20953sm2111417a34.54.2024.07.03.14.43.13 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Wed, 03 Jul 2024 14:43: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 12/29] wifi: mt76: mt7925: add link handling in mt7925_set_key Date: Wed, 3 Jul 2024 14:42:17 -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-20240703_144316_623132_E1AC1BDC X-CRM114-Status: GOOD ( 12.39 ) 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 5360f8a71655..f85f7ea01f67 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 Wed Jul 3 21:42:18 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Sean Wang X-Patchwork-Id: 13722869 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 397F6C2BD09 for ; Wed, 3 Jul 2024 21:43: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=sDQgeUMdcNQThv6Pb9X0Ecyn9jvt1k59yxEbX8sQC7Q=; b=Zpjys2OGFFEVzkaG72m9lMsEYa t4nCpB2QA+dJs9CuJWS2bBQWV0Jv03wAMX50kuS69VlhcYb/9pju+E07CwwvCYtLwMSQ/LuGxYczH s3pBR9Nd2he1URGz320kW7dNvsEYKsQl+0hAJhcSUpnYR3/vH6Wp7PGsshRc/PT2O/hrSClUz8gXe 8oSBdat1x/owYEXHfnKD/fS78zv4QZzjS1rZLR7g8NbTNB2LndjGaHGkRRJL8cb2RUnPOOn4gGrLD wNtW0RIisqZcOOc9TzdL6hTIcfscPgcf7tzaKSbQlDoEUAGQWpoRHAh/ODwOWmYCjWfut1y2wfUfl rEF7JhMA==; Received: from localhost ([::1] helo=bombadil.infradead.org) by bombadil.infradead.org with esmtp (Exim 4.97.1 #2 (Red Hat Linux)) id 1sP7l2-0000000BXC4-3tbu; Wed, 03 Jul 2024 21:43:20 +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 1sP7l0-0000000BXAL-1BU7 for linux-mediatek@lists.infradead.org; Wed, 03 Jul 2024 21:43:19 +0000 Received: by mail-oa1-f50.google.com with SMTP id 586e51a60fabf-25cb5ee9d2dso4924fac.1 for ; Wed, 03 Jul 2024 14:43:18 -0700 (PDT) X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1720042997; x=1720647797; 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=sDQgeUMdcNQThv6Pb9X0Ecyn9jvt1k59yxEbX8sQC7Q=; b=Buja6tJJ2FoO8EEMdgBoZJHCDnHag2F+rfnsEbisa+OhU1zQoTW8C+OCGPCJdBFdTF vsS8x1x/oT90WYDyUxg7SpEI06sbmVtjTaWYFDYlIVQjplJgyUcRrbeSVZiJuU7Uk2BF g/xEL7CGBS61+oxR9UAba4LkpnJh6r0A000NJEKK4jOflZGrmKyFOw8vOOJ3B5BDdVRC DO8TG0GSp6uaBqo/epHatS6Emmw6FX1e6Wo36olmuW98cv7mW144Qi4IUMH7mwe2YTpp 1NM5LajBIgDBeQJViwNFLhyq/4stxINr5NBR6jm+WyToFrErod/JV/5vvg5RF/krF61/ WcgQ== X-Forwarded-Encrypted: i=1; AJvYcCWIYnV/HXxUYMO4Hisou7d7s+p13Xkiv0os11IJnRBc83Mbc+9wiqJQAcPT5DUI6VYZee4RhnlVf8cK4YJ/6pNX9heinCfgiZSOh4gvZTBrB0Tg X-Gm-Message-State: AOJu0Yy9EBQUqmeV27iw2MIhPBnWk6qEAqPGDQUHv4qvmiX+JN9xX6RZ sUCh/Em76W4ieA+b7eZdfRMTOFniTpTZssZe/xOeLCaAq7STKJBd X-Google-Smtp-Source: AGHT+IGyQO7IDv06Wu4jz/B8hpscCKFXRufWrE7Xm5ZF0rOGZnIDhXYzyXWDJbvg8U06ruakry8ojw== X-Received: by 2002:a05:6870:8192:b0:24f:e599:9168 with SMTP id 586e51a60fabf-25db33732ffmr13537211fac.1.1720042997561; Wed, 03 Jul 2024 14:43:17 -0700 (PDT) Received: from sean-ThinkPad-T450s.lan ([207.191.35.252]) by smtp.gmail.com with ESMTPSA id 46e09a7af769-701f7b20953sm2111417a34.54.2024.07.03.14.43.15 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Wed, 03 Jul 2024 14:43: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 13/29] wifi: mt76: mt7925: add link handling to mt7925_change_chanctx Date: Wed, 3 Jul 2024 14:42:18 -0700 Message-Id: <88c5887954b04849adb0597d9a1ced7e976af897.1720042294.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-20240703_144318_346727_749206A5 X-CRM114-Status: GOOD ( 11.16 ) X-BeenThere: linux-mediatek@lists.infradead.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Sender: "Linux-mediatek" Errors-To: linux-mediatek-bounces+linux-mediatek=archiver.kernel.org@lists.infradead.org From: Sean Wang 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 | 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 f85f7ea01f67..69849146610e 100644 --- a/drivers/net/wireless/mediatek/mt76/mt7925/main.c +++ b/drivers/net/wireless/mediatek/mt76/mt7925/main.c @@ -1571,6 +1571,7 @@ 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; @@ -1585,7 +1586,22 @@ 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 Wed Jul 3 21:42:19 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Sean Wang X-Patchwork-Id: 13722870 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 C5BAEC31D97 for ; Wed, 3 Jul 2024 21:43: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=4B3iA/wt292iPzlQ3NlN/3BkJe4Kss6jwJQvuDphHUk=; b=JpOnqffYX1Ep89fUi2l79kie6i n/U0++vKf3+IUcqNWKibzM8pL67arqDzcsrWwca0iUxa87qOcEddtKdkFywFRWJkAZCG55PxtBDAV dfHPT6TBEf46z4IW/WEACyuqLvxZkY4PzmOIahpUGR6CX2a04QOcUtWLpAPxRYQt0k9RGxvsfv7aT RbVOS/Hm2Sl1JGSmD58btfLvoGZNHuV6eof/ewrg43j8PGm+wcfnCTRQy4ouFOKNXW6ll4PwkVhEt f8YhXbwAoxnsRiAnVsTXtfjpp+9R/4bIzNF+cvT9CRrff6xCZn4JUJnU8gkWjJc4V0mxfGA4DH7jF 1UHPhjkw==; Received: from localhost ([::1] helo=bombadil.infradead.org) by bombadil.infradead.org with esmtp (Exim 4.97.1 #2 (Red Hat Linux)) id 1sP7l4-0000000BXD0-1EtD; Wed, 03 Jul 2024 21:43:22 +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 1sP7l2-0000000BXBI-0yX4 for linux-mediatek@lists.infradead.org; Wed, 03 Jul 2024 21:43:21 +0000 Received: by mail-oa1-f42.google.com with SMTP id 586e51a60fabf-25d0f8d79ebso8136fac.0 for ; Wed, 03 Jul 2024 14:43:20 -0700 (PDT) X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1720042999; x=1720647799; 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=4B3iA/wt292iPzlQ3NlN/3BkJe4Kss6jwJQvuDphHUk=; b=aawHtXiWV27hoOum2vjXCl8p6zKaW3FfSjDM9yQiA0CsKRLkbUvJMzMQ0MjItoLYs+ 0ZgOd9TDkamr7iG4pltO8Dx3yc0+tg73GyAYXJ+Z4Ak1bfgbpGdumqm+q1fx+wlx23DF I0gschFQz6dAWvv9kRxngbV1Zzl1y2ftnwAz976bUuI2Q4OWcH7oJqDmr3rKOGR2SGMK NIq3lvvEwsQCVsNdcGpys6jEWesRHYas+OC6SoFPJ0PIVcLTmgWBrE+tnM1Rc+LWl8wp GupIb17zos/aQDLJ00egHVsqG1LE+akBLP8sH0verjNwJEfagcwj+jb/FV7QgmPkJlUj LSOQ== X-Forwarded-Encrypted: i=1; AJvYcCUu6UWA91L+yEydAHSeJJ7cVKvhmM41JDWBGn5Bhz6DBm+cuJzMI0VvUE5jIgVFYzirdJi8Bni8hmRKimyYQNTMGSCz2wYiN2xGJWpuHyGbmydR X-Gm-Message-State: AOJu0Yzx5EXmRi8BdeY440XNHpsuqCdM7WRu88RrRnO/rhu7h6HGUUWD Kz9+WUdBanM9a/lER4dgguFqUEjkMj7zQt7WS0+2Fmynvcg/4G/2 X-Google-Smtp-Source: AGHT+IGagnQr9R2SqTk/ttCi+flx1eUf6vzlrnRL8I6wKE/xqEuIlzcLpsgBjl1PvNgCgA3Equ378w== X-Received: by 2002:a05:6870:55d4:b0:25e:dce:491b with SMTP id 586e51a60fabf-25e0dce4b4amr2524158fac.1.1720042999249; Wed, 03 Jul 2024 14:43:19 -0700 (PDT) Received: from sean-ThinkPad-T450s.lan ([207.191.35.252]) by smtp.gmail.com with ESMTPSA id 46e09a7af769-701f7b20953sm2111417a34.54.2024.07.03.14.43.17 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Wed, 03 Jul 2024 14:43:18 -0700 (PDT) From: sean.wang@kernel.org To: nbd@nbd.name, lorenzo.bianconi@redhat.com Cc: sean.wang@mediatek.com, deren.wu@mediatek.com, mingyen.hsieh@mediatek.com, linux-wireless@vger.kernel.org, linux-mediatek@lists.infradead.org Subject: [PATCH 14/29] wifi: mt76: mt7925: add link handling in the BSS_CHANGED_PS handler Date: Wed, 3 Jul 2024 14:42:19 -0700 Message-Id: <4e072a7ac17d2f7c97569ba724b74434ac414db3.1720042294.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-20240703_144320_310443_79227F26 X-CRM114-Status: GOOD ( 10.81 ) 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 69849146610e..46ce23c7ec27 100644 --- a/drivers/net/wireless/mediatek/mt76/mt7925/main.c +++ b/drivers/net/wireless/mediatek/mt76/mt7925/main.c @@ -1635,6 +1635,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); @@ -1651,8 +1652,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 Wed Jul 3 21:42:20 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Sean Wang X-Patchwork-Id: 13722871 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 66329C31D97 for ; Wed, 3 Jul 2024 21:43:26 +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=peHtFkucpkPBpD5rHx4xIXV2z8XQ+Jk1EN6IvhoGfSo=; b=pq0mvKdYa/lcKjiXUu4oAjUOi+ M9HdfrHEkqV/pmxdk++9Rs7Ol+SQ2Bb/ADEulUq5HjKKEduYKAGmJuvchnfOVmSiwFC2IE2GUa3PP v1fNKIMIqUgL1ubKD0QbJ29XulXgx160q+CDAR0G5YkkAk6+LwQdIFqcM9M4L/UeloypD2t8Z44Ww wPJfEMCT7HKepfGWPIi9AkGf2EzBMNmxDw2wGmYNVBgu2d7TE+ClhPFv6MiuiWH0tBiPW4YPgQpyu LbxhUlzvhT5ywCOmu/r+cx9jkjmXh60Aw2bflDN41UYCdjlxgYoewXh9L3lJF13Thn2y0NsDZ/cN1 Y/lfWEBw==; Received: from localhost ([::1] helo=bombadil.infradead.org) by bombadil.infradead.org with esmtp (Exim 4.97.1 #2 (Red Hat Linux)) id 1sP7l8-0000000BXF2-08cF; Wed, 03 Jul 2024 21:43:26 +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 1sP7l3-0000000BXCQ-2lL4 for linux-mediatek@lists.infradead.org; Wed, 03 Jul 2024 21:43:24 +0000 Received: by mail-oa1-f42.google.com with SMTP id 586e51a60fabf-25cd49906aeso3966fac.2 for ; Wed, 03 Jul 2024 14:43:21 -0700 (PDT) X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1720043001; x=1720647801; 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=peHtFkucpkPBpD5rHx4xIXV2z8XQ+Jk1EN6IvhoGfSo=; b=p2G8RqWIvh2WMLhe6SmTQY+EXqx6v+FffYJxWqEOIR4UhIO0EjZ5bgFqMK1XBScaFt AllsWwJohfK4/jyXFWt7sd6bkXDxP6/PpWhU+Bcur3MtBJcuNCfGPITyJfgXssbZZtCS t8gtGhdKlV21ZmVzQyrCZwYRvVYEfUouphIvNovcvomD4H1xQX3OIQP1VSIHazoAPMJa 3gudyhcCuYkq8hsQNx2yOH51WYkdsvyPPJFQehadP+NQROksFzsACiGQVI9t610xjSPM pG5AyfL9Wj8ulc21XTtUZuCc8UAQGRDw33O94BTG7GL3HJDDN9nZ3bymNRyrqd4SYOwq CXtA== X-Forwarded-Encrypted: i=1; AJvYcCW02cYNji8GQptjw+4eXU/c3p4BOEOi0u6vIP46FeTUbYRhNA15ujAuXI2El+vd2mbJxhy+T13KY1sCKGJO+BiCb1VoYPSzB2QlJyi14PiBxpD+ X-Gm-Message-State: AOJu0Yxr06o/cgcwsEdVN/iEq4AnOM0zRt6VvcEwBRSonNlGczLeu1MR iSnhMCwkqec7UxcdV4keOv35Ii9OQdUGoXZFcg3GwG0R6Rd1wvBJ X-Google-Smtp-Source: AGHT+IEqzeo8RoR6l2yEjD7P2xm5c7YuPu83j3lo5/VHbBcEZ6c8yqDGnp7kWYGmbvaY1rl3PlnIew== X-Received: by 2002:a05:6830:68cd:b0:700:d697:6ca7 with SMTP id 46e09a7af769-70207554355mr12585180a34.0.1720043000855; Wed, 03 Jul 2024 14:43:20 -0700 (PDT) Received: from sean-ThinkPad-T450s.lan ([207.191.35.252]) by smtp.gmail.com with ESMTPSA id 46e09a7af769-701f7b20953sm2111417a34.54.2024.07.03.14.43.19 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Wed, 03 Jul 2024 14:43: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 15/29] wifi: mt76: mt7925: add link handling in mt7925_mcu_set_beacon_filter Date: Wed, 3 Jul 2024 14:42:20 -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-20240703_144321_739188_5294B0BE X-CRM114-Status: GOOD ( 10.67 ) 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 --- drivers/net/wireless/mediatek/mt76/mt7925/mcu.c | 15 ++++++++++++--- 1 file changed, 12 insertions(+), 3 deletions(-) diff --git a/drivers/net/wireless/mediatek/mt76/mt7925/mcu.c b/drivers/net/wireless/mediatek/mt76/mt7925/mcu.c index b62153671350..cf0377d26752 100644 --- a/drivers/net/wireless/mediatek/mt76/mt7925/mcu.c +++ b/drivers/net/wireless/mediatek/mt76/mt7925/mcu.c @@ -1814,11 +1814,20 @@ int mt7925_mcu_set_beacon_filter(struct mt792x_dev *dev, #define MT7925_FIF_BIT_CLR BIT(1) #define MT7925_FIF_BIT_SET BIT(0) int err = 0; + int i; if (enable) { - err = mt7925_mcu_uni_bss_bcnft(dev, &vif->bss_conf, true); - if (err) - return err; + 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; + + 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, From patchwork Wed Jul 3 21:42:21 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Sean Wang X-Patchwork-Id: 13722872 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 1067BC2BD09 for ; Wed, 3 Jul 2024 21:43: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=wtG0qWg5QbR5VYZF/R9pSkSDu8jWaNi65JIbi2fadJs=; b=tyFEnJX8fFlXsKD37jfRAAjItX 4ulcpmdSpg2v1q5pMfnLyaJyoYGt6UsCYSMHbUWIjRoJ56vVlR1Jb1Fod8pCqnNsOkpcpHvTfyxPf x2SIbLjL9haTfr5WxB9CLbcDnScDEFP3VTum19LwbRKlO1CtRDHjRxvU0a9/t393u3KCeT7JhpvEL JlBbBPZRkut3G88miJvxC2wVAwKfB3o+CbJC+RAxkKvQQIqrejz+B3lmyjcn9IxKY7eS/Uszu1qtv uuI9VPtr6EcViYDM8PEuZykwWXmBBUK6gBkoqh+mvDoht7N3W85xHSoZ4yH5xK9aGwKzq+wJA6ID9 lGpSRknQ==; Received: from localhost ([::1] helo=bombadil.infradead.org) by bombadil.infradead.org with esmtp (Exim 4.97.1 #2 (Red Hat Linux)) id 1sP7l9-0000000BXFx-2z23; Wed, 03 Jul 2024 21:43:27 +0000 Received: from mail-oi1-f176.google.com ([209.85.167.176]) by bombadil.infradead.org with esmtps (Exim 4.97.1 #2 (Red Hat Linux)) id 1sP7l6-0000000BXDi-0Yii for linux-mediatek@lists.infradead.org; Wed, 03 Jul 2024 21:43:25 +0000 Received: by mail-oi1-f176.google.com with SMTP id 5614622812f47-3d1b8bacf67so3852b6e.2 for ; Wed, 03 Jul 2024 14:43:23 -0700 (PDT) X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1720043003; x=1720647803; 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=wtG0qWg5QbR5VYZF/R9pSkSDu8jWaNi65JIbi2fadJs=; b=uYO6QZDeQax14YUTvNAeu6U+tLDWbfQakSksDg5seoVU58H7kJKNiWJQZcjhJ1ruMV WvB1ODN5Kwnc0tkyeBwoUZpbxrElD9vNDEFuJLY47QOjS4zXn3r9xERVD36cc36g9I3v tHLMtO3vzTm8tURPPW8t1S3xqBH4xv8mQrWqGBBs98MncNM4UL8htuxD/aw3x8jg+k1O SkxrsDrZCQCca4e32i5U+9oLqGriSlXypQ35CwDxaH71Jq4Dy0rgH3uqNV9WZN1zsZey 1eS1jQnVTSE3uXQBPamidylPChDDauPUerecnrU05Y5afkIOhwb+ZQxX55wkEMR0ESZP FcxA== X-Forwarded-Encrypted: i=1; AJvYcCWMWzh3j7U0UlrDp+UueXO2nqRA6MbQR638AQnQvur85KUKaAUsS2F1L8RdhJlg9atZ8enukFwqy3Xi58/PojxVCi7XNQTCupw0f6CDkhkuJ1YC X-Gm-Message-State: AOJu0YwjkpubXS+NSqqJfkOtlLTINAuSx/pIxD+GiyGp2pcptcWAw1v8 rtqbcmnV5x96pJplNVBbGwRmvyJwTKy0OuqA3nf7+qc/GBWhihqE X-Google-Smtp-Source: AGHT+IHcOT2ePMPmXXvJS0IdwhfyVS1tVzOxF6uH1qeSR+V7tKTr7QafSgJ6K+RsYA6EQXkV3+UWow== X-Received: by 2002:a05:6870:a511:b0:259:f03c:4e90 with SMTP id 586e51a60fabf-25db36a52edmr13771890fac.4.1720043002793; Wed, 03 Jul 2024 14:43:22 -0700 (PDT) Received: from sean-ThinkPad-T450s.lan ([207.191.35.252]) by smtp.gmail.com with ESMTPSA id 46e09a7af769-701f7b20953sm2111417a34.54.2024.07.03.14.43.21 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Wed, 03 Jul 2024 14:43: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 16/29] wifi: mt76: mt7925: add link handling in mt7925_txwi_free Date: Wed, 3 Jul 2024 14:42:21 -0700 Message-Id: <2b70dccb2735f4ca02db102bb6bd02cdbd539c2f.1720042294.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-20240703_144324_241665_46886BA0 X-CRM114-Status: GOOD ( 16.68 ) 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 54693624b182..252d9de81d99 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 Wed Jul 3 21:42:22 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Sean Wang X-Patchwork-Id: 13722873 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 DDA74C31D97 for ; Wed, 3 Jul 2024 21:43: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=EDtWWoGxNXsA+VUrVMlH9NUVtfOdfQhzGFLU7KDEjg4=; b=sfZDbF8Kpqu+NqHlDv3Ak89WhU 9R/zeI/4tFqVIw8dA44mW9mdPPyrVSED6t+OEtWJEGtnLfSN9L1tM1/9VCzbDoZNEk8bMCIl8K/Mc N6KdGAC4qWTDPIKgunYdpC9fo3+HN1xMCLz3S/bu2AQEQJB16GJHjOF56AAuuMsa7F9K9hT56qrHd iHSzjbDdZZ5lc4yA6NpVTBo3hsURqzf3/D8bjkk7QNAKgG0g8l+jQWfesIJc+WkM6zZxFl4Qij+PB JGX6IZfhC5CmfyvTNPIRjl7clfy/07OCtvAlbdUlTLIt7IjarwY+NNeWw/S466qhwZbEZAu9r5IBe kWoeSLwA==; Received: from localhost ([::1] helo=bombadil.infradead.org) by bombadil.infradead.org with esmtp (Exim 4.97.1 #2 (Red Hat Linux)) id 1sP7lB-0000000BXHM-2S09; Wed, 03 Jul 2024 21:43:29 +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 1sP7l8-0000000BXEo-01WQ for linux-mediatek@lists.infradead.org; Wed, 03 Jul 2024 21:43:27 +0000 Received: by mail-oa1-f52.google.com with SMTP id 586e51a60fabf-25cd49906aeso3975fac.2 for ; Wed, 03 Jul 2024 14:43:25 -0700 (PDT) X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1720043005; x=1720647805; 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=EDtWWoGxNXsA+VUrVMlH9NUVtfOdfQhzGFLU7KDEjg4=; b=IHLLzbstoUUqnH4OhnF3yXZhruQ125Xqy78qIgnlPLQJCIpLtNo+SZY5SlLwN1CNy/ 3HJjQ+/Dd0rrE+GnpOReXW2qgek7rheHoX53B0U+TYBmVgjw+1heK2GYrja7jsiGwcsl fzRPnEQOWRvEq821jUtCysRsW9tVYMpxTORoORrZkubPZ9MMCd05mo7Gv206HySTPtsV JZjn53AXjBTs4KGmnqG1e0julFC9RwZ6qqLH3+nViGiPiehk3KzhsA39ZGrvx6Iju0oq eQomWYWC/hP9mVRwtWzirNn9M7NlC1AhQUr+MIARX8bGDhCphEjIkrWxtwGoiq8gUjcf t95A== X-Forwarded-Encrypted: i=1; AJvYcCUKDU7U/06+k+9XNtzs2HXvX/xzQKqgaBWSufIZfjFKn3bIflFjOLwrV40fJ+zPBnmeXpPlr4h7FXD+5HVc6sFhLwEO0nathC4gR1S4TlEWz/ZS X-Gm-Message-State: AOJu0Yy4VBDon+BaitlBhJDh2wKEyzKREj2gbnrAYFJq89axosYPQD0m dYf3oCxA13wNqb9Tjqtk29S+b9M2brHpHdYNp+IVtJ1v7mArXL5v X-Google-Smtp-Source: AGHT+IHHL00osxe9L6uV/ZIfVF6TzeBtZZdxa46wI52tc5jjTe51dQO8lcXzLe69OaHVmiNHiz2Wcw== X-Received: by 2002:a05:6870:55d4:b0:25e:dce:491b with SMTP id 586e51a60fabf-25e0dce4b4amr2524322fac.1.1720043005063; Wed, 03 Jul 2024 14:43:25 -0700 (PDT) Received: from sean-ThinkPad-T450s.lan ([207.191.35.252]) by smtp.gmail.com with ESMTPSA id 46e09a7af769-701f7b20953sm2111417a34.54.2024.07.03.14.43.22 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Wed, 03 Jul 2024 14:43:23 -0700 (PDT) From: sean.wang@kernel.org To: nbd@nbd.name, lorenzo.bianconi@redhat.com Cc: sean.wang@mediatek.com, deren.wu@mediatek.com, mingyen.hsieh@mediatek.com, linux-wireless@vger.kernel.org, linux-mediatek@lists.infradead.org Subject: [PATCH 17/29] wifi: mt76: mt7925: add link handling in mt7925_mac_sta_assoc Date: Wed, 3 Jul 2024 14:42:22 -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-20240703_144326_121228_89E9FC7F X-CRM114-Status: GOOD ( 16.18 ) X-BeenThere: linux-mediatek@lists.infradead.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Sender: "Linux-mediatek" Errors-To: linux-mediatek-bounces+linux-mediatek=archiver.kernel.org@lists.infradead.org From: Sean Wang 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 | 90 ++++++++++++++++++- drivers/net/wireless/mediatek/mt76/mt792x.h | 1 + 2 files changed, 89 insertions(+), 2 deletions(-) diff --git a/drivers/net/wireless/mediatek/mt76/mt7925/main.c b/drivers/net/wireless/mediatek/mt76/mt7925/main.c index 46ce23c7ec27..3a9d526f8085 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) @@ -925,6 +926,75 @@ 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 { + enum nl80211_band band; + } data[IEEE80211_MLD_MAX_NUM_LINKS]; + u16 sel_links = 0; + u8 link_id; + int i = -1; + + 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 (!link_conf) + continue; + + if (!(BIT(link_id) & vif->active_links)) + continue; + + if (i == -1 || data[i].band != link_conf->chanreq.oper.chan->band) { + i = i + 1; + data[i].band = link_conf->chanreq.oper.chan->band; + sel_links |= link_id; + } + } + rcu_read_unlock(); + + 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) @@ -940,7 +1010,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) mt7925_mcu_add_bss_info(&dev->phy, mvif->bss_conf.mt76.ctx, @@ -960,7 +1034,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); @@ -1751,6 +1836,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 Wed Jul 3 21:42:23 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Sean Wang X-Patchwork-Id: 13722874 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 646DCC2BD09 for ; Wed, 3 Jul 2024 21:43:31 +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=Erih5+NFArlq4U+QMfF/4G3Ja6X1QAPdgNncz1l2jKk=; b=tbmdMUW4hcPO7q0ew3IMlF2xbS ePIGVbTFAjREi1bMths6RAfAdywFw/H8m8jxD0t07/IwbD0J+SK2vlBw6ut0Lc0xnaDGaVyFeXOnO 5LacOMETv8FqfGVe8Cb2LHa18KKRdfhnt5B51MJoV6OgnLc+OBX/EOQEVt4JHwqYkG0Q4IA5dU0Hq 6hdyERnL9uDugC+umFx8ws/B+zlD2ACdaeivbeOIaasNtILLO8UX4oCL2TQSR7lqcYNgnJNrofZYY JKXMR9ItOQR50rs3/oi+0g2ywA0iBoaz5fHtn1mIzDuQG5jM7y3DtJAxTXZx1y+bkgR7yVqLSNXqK cqgW6gZA==; Received: from localhost ([::1] helo=bombadil.infradead.org) by bombadil.infradead.org with esmtp (Exim 4.97.1 #2 (Red Hat Linux)) id 1sP7lD-0000000BXID-02qj; Wed, 03 Jul 2024 21:43:31 +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 1sP7l9-0000000BXFy-3ouC for linux-mediatek@lists.infradead.org; Wed, 03 Jul 2024 21:43:29 +0000 Received: by mail-oa1-f50.google.com with SMTP id 586e51a60fabf-25d0f8d79ebso8161fac.0 for ; Wed, 03 Jul 2024 14:43:27 -0700 (PDT) X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1720043007; x=1720647807; 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=Erih5+NFArlq4U+QMfF/4G3Ja6X1QAPdgNncz1l2jKk=; b=gFxg30DpoqkHaRSxJGiyIdlzpDjXuH3TqXpjb5L3es/rMQZKBGRCrhnv+jFcONFT56 /4bf/JdaZ7TBjrGWqF4zlgK/w2Z8rTp5oofKo060mrEOSBucm/wmqKGDD9YmXM9nRS5+ IMxCa5rcVtyjS49vrjRTPQg5ffYQlBzJj+76pvicKNn7cDMS+CXTvBY1nJ2rvL/1dWDM gXHmdHkxw0Cuj/PSwohVl9FzGGgO1HqTZv/XzqkRNdKPBu6aa7SCJCAc96eeaL3KTsJM WtvGG/Q7n8ctPGMPlg0oOsJv1btVJcsHnT4PE6LVaLZq8W7euXbJGY8mM2TsMUsVlwVt 7ncA== X-Forwarded-Encrypted: i=1; AJvYcCWr32pFuub+iCBAxA2Cfq3BwIPOG5goYkLZ4v7w4uaid6eNPKsbFPI+nMeoQQOc31hEKcxqINeDKCXEbH7yp/QBFISd3V1MX7h8C8EoBwAISXJA X-Gm-Message-State: AOJu0YzOkC0tnIF8B3nz+gikttCXvECZDLQDeWR7IxL/SvRYaAwjXK8M lKj2JqLgcpm1L51vvWfv04ThYwB6IlwbQgy3KqiKWNzh2NniqsYv X-Google-Smtp-Source: AGHT+IE2XP0Wra+Ep1R6FhpkFyT7lT9uipofVy38SxEXErnDmraYC0MmGSBrSm4GRN8CBQxS8S2Wiw== X-Received: by 2002:a05:6808:1494:b0:3d5:618e:193f with SMTP id 5614622812f47-3d6b2935863mr14288644b6e.1.1720043007114; Wed, 03 Jul 2024 14:43:27 -0700 (PDT) Received: from sean-ThinkPad-T450s.lan ([207.191.35.252]) by smtp.gmail.com with ESMTPSA id 46e09a7af769-701f7b20953sm2111417a34.54.2024.07.03.14.43.25 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Wed, 03 Jul 2024 14:43:25 -0700 (PDT) From: sean.wang@kernel.org To: nbd@nbd.name, lorenzo.bianconi@redhat.com Cc: sean.wang@mediatek.com, deren.wu@mediatek.com, mingyen.hsieh@mediatek.com, linux-wireless@vger.kernel.org, linux-mediatek@lists.infradead.org Subject: [PATCH 18/29] wifi: mt76: mt7925: add link handling in mt7925_sta_set_decap_offload Date: Wed, 3 Jul 2024 14:42:23 -0700 Message-Id: <6e48351e9543d8225e09255f802732d635e533d0.1720042294.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-20240703_144328_036318_6BB60AD7 X-CRM114-Status: GOOD ( 12.19 ) 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 3a9d526f8085..265ef7ade6e4 100644 --- a/drivers/net/wireless/mediatek/mt76/mt7925/main.c +++ b/drivers/net/wireless/mediatek/mt76/mt7925/main.c @@ -1450,16 +1450,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 cf0377d26752..75149baab7e5 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 252d9de81d99..4c0ecae8e49b 100644 --- a/drivers/net/wireless/mediatek/mt76/mt7925/mt7925.h +++ b/drivers/net/wireless/mediatek/mt76/mt7925/mt7925.h @@ -315,6 +315,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 Wed Jul 3 21:42:24 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Sean Wang X-Patchwork-Id: 13722875 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 CF0C8C31D97 for ; Wed, 3 Jul 2024 21:43: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=WCSz8cUWGD3Jpbgh3b2PR3W+Co/hw9DDq4m/R/ZmJnU=; b=u2/g3l/o1e5aOrgtIBAqag12op Pd9+Qe8jMNToJAcW1ixJYdVM0hj9kb3JSktjWIfrHATfHpMGF3VGqvxcr2lB8BtMJN0je6mihRCNZ B1M7U5oIx0t6SHPPrEGbbWtBqtEdbLxcJFYtilpZRIlvDatpbQ/PruNb4FvBazfA785FpjPC+q5tE wpU/CmZSzfkp3e9TDcc4L/PvixbdilGH20BV6U27QTEVF2sAkE1DYtRoGz3bOsKvriEljiYB2FBuI 6NgmacOQFVFoeS4luc3A0JyiyqEcUIBtQ20ZS7QPXt0AuW9DUnKZAMAxsJawsSHcdTMpKhE3ebSW+ MkS78VFw==; Received: from localhost ([::1] helo=bombadil.infradead.org) by bombadil.infradead.org with esmtp (Exim 4.97.1 #2 (Red Hat Linux)) id 1sP7lE-0000000BXJ9-2Fcs; Wed, 03 Jul 2024 21:43:32 +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 1sP7lB-0000000BXHI-2cyo for linux-mediatek@lists.infradead.org; Wed, 03 Jul 2024 21:43:30 +0000 Received: by mail-oa1-f42.google.com with SMTP id 586e51a60fabf-25d0f8d79ebso8171fac.0 for ; Wed, 03 Jul 2024 14:43:29 -0700 (PDT) X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1720043009; x=1720647809; 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=WCSz8cUWGD3Jpbgh3b2PR3W+Co/hw9DDq4m/R/ZmJnU=; b=NatHqI7L4U+t+AtXJrZBMt2N+XV8Ztb8j8hnKFCEQ2ArdrwW9JQ1M5Lnrw5ke8AdMW TpAv+TC1yUg6wDxmqz/Y0hAI1D8JdWQXYlWdJDSL551x5fJ+Nw/86W+1gLfmACq6tdR6 mrRdSBnJTMFvfRCirfBzyXvgU3/bWhPSkUgyzXhcWStvSEGhNOFK3EYo02QW/1m8UtdB fnrQmj86M9UNIzvYejUzM3YAOHiq2CHSpNaF+qzYba/7FderzO8VzrmDHIJ9FKYvf82Q 2BkUb7qcwGjko1q55S1vFH+9gTMEQJSTp6SXzv9COq72SX0FGB2FECLTOVtW6ASEfBs2 FyGw== X-Forwarded-Encrypted: i=1; AJvYcCXlvuTw5jbVfMGz9T7+oj984rQ+ewPN6AQVX2zcEZdzCxM3l+EILyxQYnoLwpVgH7su2dxpxlBDLzqR+IWGnmFxMX59s3sQ2iyPkyN1WoX5niG/ X-Gm-Message-State: AOJu0Yz4nn3zQzgg8PN+MLzCinhCtRF+sfoI2fAlDNjwcKrhLiBwmQ02 WyiA7HlMEYiL1mrx9wNw1SKqo09n0dxfqYpA/n+/J1g7kfgRu2zF X-Google-Smtp-Source: AGHT+IHHdwjRum0Ixy2aektx2Alqi2y35iYb/E46T4+QqCxUIGi/GS+D5lOna7bDGqNjEWMqIfYCRA== X-Received: by 2002:a05:6830:68cd:b0:700:d697:6ca7 with SMTP id 46e09a7af769-70207554355mr12585381a34.0.1720043008866; Wed, 03 Jul 2024 14:43:28 -0700 (PDT) Received: from sean-ThinkPad-T450s.lan ([207.191.35.252]) by smtp.gmail.com with ESMTPSA id 46e09a7af769-701f7b20953sm2111417a34.54.2024.07.03.14.43.27 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Wed, 03 Jul 2024 14:43:27 -0700 (PDT) From: sean.wang@kernel.org To: nbd@nbd.name, lorenzo.bianconi@redhat.com Cc: sean.wang@mediatek.com, deren.wu@mediatek.com, mingyen.hsieh@mediatek.com, linux-wireless@vger.kernel.org, linux-mediatek@lists.infradead.org Subject: [PATCH 19/29] wifi: mt76: mt7925: update rate index according to link id Date: Wed, 3 Jul 2024 14:42:24 -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-20240703_144329_706322_238F38B9 X-CRM114-Status: UNSURE ( 9.46 ) 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 265ef7ade6e4..173934ec1e71 100644 --- a/drivers/net/wireless/mediatek/mt76/mt7925/main.c +++ b/drivers/net/wireless/mediatek/mt76/mt7925/main.c @@ -1768,9 +1768,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); @@ -1784,16 +1787,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 Wed Jul 3 21:42:25 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Sean Wang X-Patchwork-Id: 13722876 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 44549C2BD09 for ; Wed, 3 Jul 2024 21:43: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=ffWOmyzGdQmn/1ElFIgBjJf1v30KLPcOBR1pd24Nq7I=; b=A0WpAoSuGh9mrVuoB/H8+NSTOC ZDctrYsgwyzGEbiOcbbM+VTBCz0SB5PAej2Eu3pw2Z/iY5kTSSl3kNWXA00VB90X7WRpzjmjaBuYc RZ7bF8/8G0W5c7PVtLVbXFAoXOtCh8jxOY8TG/FzcUpubLIViN3FaUMgi5T5grXUPRMBNuVaTTQ3t 2aQX0UTt56xNK6ECsJUsVUgYB8yZcsYYYOiGp2tCXC7n+/0V+CWcdKvPYN8NDG3mJ6dHehI927iWC BYnIQfklJ2CqqvZvlwH1qOb7vTrx1jSCPcGo9w3Qc/6U66pq8ph6QhNSSf6DMtVVCAUw2rt664PZq 4AuTl4ng==; Received: from localhost ([::1] helo=bombadil.infradead.org) by bombadil.infradead.org with esmtp (Exim 4.97.1 #2 (Red Hat Linux)) id 1sP7lF-0000000BXK9-3tKS; Wed, 03 Jul 2024 21:43:33 +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 1sP7lD-0000000BXIE-24UN for linux-mediatek@lists.infradead.org; Wed, 03 Jul 2024 21:43:32 +0000 Received: by mail-oa1-f49.google.com with SMTP id 586e51a60fabf-25d0f8d79ebso8178fac.0 for ; Wed, 03 Jul 2024 14:43:31 -0700 (PDT) X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1720043010; x=1720647810; 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=ffWOmyzGdQmn/1ElFIgBjJf1v30KLPcOBR1pd24Nq7I=; b=a3I0r1mf6uNyM+mR57UOkjEJ1+7LzrS4FXxzFuQIClVwSPqMVZQ7u+tyXJ7gSUJDgc 2m7yNnnWODwqkFLqkKtUoJzRGp3lTOb/X/BKGPiPgz453JRN8ARuSnemiT7opbnO7w7m wtEbJpmbCebqKbDwuRl69Q1cCwPOtUKGJ9bd6zULiq8BaKMV70Uc2/OU96oB0Ho4Z2iL LTK9g7nVOBYniBeZGfxRFASwxNgU7uz06a5n221pF9PUWhGLLDVQtvR6Oqy4wHrgDEIA dG60RUFi8SNfgF5ZoQE7phOBbRdAvpyla3XbcZ5JIdZA+cA4eEh/SQ/uwxS8jBSvpB+Z 6MiA== X-Forwarded-Encrypted: i=1; AJvYcCW+QNRPO9fcOMkH4yL8iN/HRSkYJJAVDLudeV+U8nIczrAgIn6Mly98wBcKftz9vUyvB5Z8vhliuNuPZpjHLRtlXhGAHyJaASSo7StFMszJqvFb X-Gm-Message-State: AOJu0YyrxO0lWC//z3gceslxxvGm1DRMJLxijY2GYM/hkLwIvPXVbZEq MO2x02upHtglYVsGMIlZ4PrMV/dzJmxxt3P72S/1xsmkXz7aAeLV X-Google-Smtp-Source: AGHT+IEg9up3tNNH6BCf3a0LDbIZh3GhmduGK33TP3hQf2RrI2NvFjW6FtNxtHICn/l6idPmrPoZVw== X-Received: by 2002:a05:6830:8c5:b0:6f9:7373:9421 with SMTP id 46e09a7af769-7020774aa24mr11940398a34.3.1720043010569; Wed, 03 Jul 2024 14:43:30 -0700 (PDT) Received: from sean-ThinkPad-T450s.lan ([207.191.35.252]) by smtp.gmail.com with ESMTPSA id 46e09a7af769-701f7b20953sm2111417a34.54.2024.07.03.14.43.29 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Wed, 03 Jul 2024 14:43:29 -0700 (PDT) From: sean.wang@kernel.org To: nbd@nbd.name, lorenzo.bianconi@redhat.com Cc: sean.wang@mediatek.com, deren.wu@mediatek.com, mingyen.hsieh@mediatek.com, linux-wireless@vger.kernel.org, linux-mediatek@lists.infradead.org Subject: [PATCH 20/29] wifi: mt76: mt7925: report link information in rx status Date: Wed, 3 Jul 2024 14:42:25 -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-20240703_144331_573620_5B0D1AAC X-CRM114-Status: GOOD ( 10.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 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 01646538087a..c0e529d0b3ef 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 173934ec1e71..c3ce57d36168 100644 --- a/drivers/net/wireless/mediatek/mt76/mt7925/main.c +++ b/drivers/net/wireless/mediatek/mt76/mt7925/main.c @@ -809,6 +809,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) @@ -1865,6 +1866,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 Wed Jul 3 21:42:26 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Sean Wang X-Patchwork-Id: 13722877 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 3FA2AC2BD09 for ; Wed, 3 Jul 2024 21:43:37 +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=RxSmN3RyGqtOMcnaemjIRPhc3UORadWI0djDIJjxFRQ=; b=LlK369TuYsuipVKJL326YbQgwW Ayssx5AJRiuiY4xPdu9mvqYCLxPeLF3Fvwjo7fi5XDr+KjI4t50AD1Mol7fDjChT6fd++G3TZ0VhP /BfSJzp1yZftVm2BLVvf+jL7qlYj7EG1d+4S3uHIWmBLBtkxtXDYCQyXnArYIDndZX/5jIh5g9UKW CGvJPLcYpGaIHsVPRYWp+34dTYl15empUNzJE1pnTdRImxs5t8Je9OJ5xqZJxscN1GRtzZMxJdAXw HSazh7q1PX1j/jTcVsRf+Jgm99HBckYuHUikqBHmI7WXKcL5blFFtZGch4yWkzYjmmboxcIZMvnB2 OkiMj1fQ==; Received: from localhost ([::1] helo=bombadil.infradead.org) by bombadil.infradead.org with esmtp (Exim 4.97.1 #2 (Red Hat Linux)) id 1sP7lI-0000000BXM1-3VrI; Wed, 03 Jul 2024 21:43:36 +0000 Received: from mail-ot1-f43.google.com ([209.85.210.43]) by bombadil.infradead.org with esmtps (Exim 4.97.1 #2 (Red Hat Linux)) id 1sP7lF-0000000BXJ8-022K for linux-mediatek@lists.infradead.org; Wed, 03 Jul 2024 21:43:34 +0000 Received: by mail-ot1-f43.google.com with SMTP id 46e09a7af769-700d29f33a0so89050a34.1 for ; Wed, 03 Jul 2024 14:43:32 -0700 (PDT) X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1720043012; x=1720647812; 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=RxSmN3RyGqtOMcnaemjIRPhc3UORadWI0djDIJjxFRQ=; b=eWZJvYcNCPF8GPm9Ty2BmvMM+pxZ3jCow0XiKwDH9gBbGSa5yh1lDMnahVwSgOuCzh Ep900b5TbnD4QcXnWndIWgNp8yUfu7ezgeyDCVg6cwfYfFq1rdTT39suAGpkQ6lCctEy JThW+wIFWb3O2fnTjwULDSV9dgVtG3Mj7KXVXCmYOphtiIPc0+4R2Hw69hUsUUttEA2d MQUk5Lsnb93RKs0dJNog6JMOZisHUhUvJ1SOXs3eTX0s0QpGohaKsIwFMAv+WG4Soguj kc9tEGFp/1/AtrJvKiPxvER6KELfjto5nYkHDdYZHv4gtLIuoxgDz2a6NLgK3x1XVb05 TH4A== X-Forwarded-Encrypted: i=1; AJvYcCV6sVpWmJKYbjvppGc23c0af/innhvL+ygZFC8vXnWYrqkQ9adCEsTY0ROoB7NNI4buQ5bX2EpBxQkYZL4CMz1kn27FFY98768wuEYqZ871Zmlr X-Gm-Message-State: AOJu0YyAhd82TlzvedGNfkE2ehVvwHtvSisbYkBbHrBW3RwcRNB/aptx nHWdeyuF0gRES5SqOYKJdP4QK7Pdr0lW8lex6GrKHTdhcsgPsRUp X-Google-Smtp-Source: AGHT+IF/LGon8YWCTWFG30B8KA0KF181GSiy3MGe5Zpy91+M/CxwYtnXKl8o1WBcM0358pYIOT8lnw== X-Received: by 2002:a9d:7e8a:0:b0:700:e0e8:5e2 with SMTP id 46e09a7af769-70207560e89mr12825062a34.0.1720043012083; Wed, 03 Jul 2024 14:43:32 -0700 (PDT) Received: from sean-ThinkPad-T450s.lan ([207.191.35.252]) by smtp.gmail.com with ESMTPSA id 46e09a7af769-701f7b20953sm2111417a34.54.2024.07.03.14.43.30 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Wed, 03 Jul 2024 14:43:31 -0700 (PDT) From: sean.wang@kernel.org To: nbd@nbd.name, lorenzo.bianconi@redhat.com Cc: sean.wang@mediatek.com, deren.wu@mediatek.com, mingyen.hsieh@mediatek.com, linux-wireless@vger.kernel.org, linux-mediatek@lists.infradead.org Subject: [PATCH 21/29] wifi: mt76: add def_wcid to struct mt76_wcid Date: Wed, 3 Jul 2024 14:42:26 -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-20240703_144333_074423_ED5EC653 X-CRM114-Status: GOOD ( 10.77 ) 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 c0e529d0b3ef..f8431b889c78 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 c3ce57d36168..339888086076 100644 --- a/drivers/net/wireless/mediatek/mt76/mt7925/main.c +++ b/drivers/net/wireless/mediatek/mt76/mt7925/main.c @@ -894,6 +894,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); @@ -1867,6 +1868,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 Wed Jul 3 21:42:27 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Sean Wang X-Patchwork-Id: 13722878 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 04165C2BD09 for ; Wed, 3 Jul 2024 21:43:40 +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=S/u1Acf2UXke2/1kGXt/5Ovbf/IwEe45D/E6XFOOEDQ=; b=tkCUcW82f0JriBzZmoJ05KMyxt QRRkRVTrcrGK9DbfadGewiG26sav29HP7wpWn9luGoHUmhRkVOb5N7LLC+ff+nnvGdLZeNnx0Fvdx 0ZyGCSlz/R4x1S2QUUnCx/7RSOVusfz5U78qr2U4M/yWOQ26WTpm1UCm5zLd0y0WCtMpz3ixpT7X4 UBvUGUv1Z5tI5yWlFhmxOCAldQNYjwiyMEsprAY2lcbReBdcB8peU2Pm5U7CirDHqzs4VdpfZ0nqc ANIAJh2tWmbT3kjWDDxor6UGUr9n/VXzt3N5YBf37Xkvehq/iE5P5ILpNdJ18F4wXC1uy/79J4jUs AyhLnS3w==; Received: from localhost ([::1] helo=bombadil.infradead.org) by bombadil.infradead.org with esmtp (Exim 4.97.1 #2 (Red Hat Linux)) id 1sP7lL-0000000BXMr-1nb6; Wed, 03 Jul 2024 21:43:39 +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 1sP7lG-0000000BXKM-2luk for linux-mediatek@lists.infradead.org; Wed, 03 Jul 2024 21:43:36 +0000 Received: by mail-oi1-f181.google.com with SMTP id 5614622812f47-3d1b8bacf67so3871b6e.2 for ; Wed, 03 Jul 2024 14:43:34 -0700 (PDT) X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1720043014; x=1720647814; 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=S/u1Acf2UXke2/1kGXt/5Ovbf/IwEe45D/E6XFOOEDQ=; b=tNjZuQUFJW9vhFU1BKbePjJRQXPAhv8NYwPthRNIAKJZA6V3jqH088o7tTSvbRsrIx 1KO0SNEbPKjEe1XVPOJolExH1lE38Dsqyz1akiqh/7/pTDeYxuWtCrv2S6+3OjjTRtkw 4y0U7cmfTwrTuxg2QULmVIhH+P4cXXYNAUvXJ8ZQVn4CW1yweg9bBrBNAkce9eIMds1T oXDsNIEthYNI4wgldYKap0PKOQSvUazkPO9IAmwGsVS2XMHVXeUEF/Gi9pA9sEL58Xrg 6LCWUVcoKvizw4S5DKBMrcnvE+FM05h637xDvfpjQzHKr2wC+r2HPYRZc4XgOT5LBHbk CnJw== X-Forwarded-Encrypted: i=1; AJvYcCXE8JoJi4YYztQ3GF4MEEQeXClfJ+4Mgh8hMlckY/7EqMuQ6cY9s4zYuwpj49U0314kABxLWkIEBZdwy7CZQa0vef+nIDOvCl9mIvIY69P7sYeO X-Gm-Message-State: AOJu0Ywl36oI1kbwM/TB0Z2RWX840oxsGNaNPb3Y/DqucvQaTbNlH2Af Sgrn9NIF9QnSrsx439ZD7om1ytcIHKjpZgi4CzjU77CLXJ0YCaCt X-Google-Smtp-Source: AGHT+IGwBzpGzOI8UnmzyhZbE1IyHQCB/GWkLPI3zSldgtr6vXIrNvfGhEM715WnuXcqelbUbUaHDQ== X-Received: by 2002:a05:6830:100d:b0:702:1e62:8698 with SMTP id 46e09a7af769-7021e629011mr7518817a34.0.1720043013632; Wed, 03 Jul 2024 14:43:33 -0700 (PDT) Received: from sean-ThinkPad-T450s.lan ([207.191.35.252]) by smtp.gmail.com with ESMTPSA id 46e09a7af769-701f7b20953sm2111417a34.54.2024.07.03.14.43.32 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Wed, 03 Jul 2024 14:43: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 22/29] wifi: mt76: mt7925: add mt7925_[assign,unassign]_vif_chanctx Date: Wed, 3 Jul 2024 14:42:27 -0700 Message-Id: <1f856d6529a62f64be23e7c9fd5f255f1d9c0127.1720042294.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-20240703_144334_742431_5D7AADA6 X-CRM114-Status: GOOD ( 15.74 ) 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 339888086076..13b40032cd72 100644 --- a/drivers/net/wireless/mediatek/mt76/mt7925/main.c +++ b/drivers/net/wireless/mediatek/mt76/mt7925/main.c @@ -1698,8 +1698,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); } @@ -1945,6 +1950,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 = &mvif->bss_conf; + 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, @@ -1997,8 +2064,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 75149baab7e5..3f0ceebed2f8 100644 --- a/drivers/net/wireless/mediatek/mt76/mt7925/mcu.c +++ b/drivers/net/wireless/mediatek/mt76/mt7925/mcu.c @@ -2074,9 +2074,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; @@ -2143,6 +2145,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; @@ -2152,7 +2155,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); @@ -2214,7 +2217,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; @@ -2339,7 +2343,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; @@ -2479,8 +2484,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; @@ -2504,7 +2507,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 fefb6ab384bb..f0b890ad43e7 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 Wed Jul 3 21:42:28 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Sean Wang X-Patchwork-Id: 13722879 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 87DF7C3271E for ; Wed, 3 Jul 2024 21:43:40 +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=g37T4CjI6r9HOceV/Z2FL5pGlk5t0qMk/CEhDyaAnXw=; b=nw/j4GJu+VwYheYnZmNmYzyqIB g5YdPR/7qS4+MmDg9MJxJI2zDtfTONrYkDKYHddgdgVl/XFb2FnrK0o1WN0DNHPtKITdtXUt7OYBw XjkLA0lDPys1B1fMwqArxFVKfF+U476pK3/uk1Hyv4gToVv0FaqeQEp0C2tg4Qov6akpUnVx7Sdil mj+Yk/P/42tgPfuWMXOjSNt7MlivLPgMhXbUT5looUWarRyalmcYrJJbhe7zZ272d4Ji6WJQf7Ym4 SJpcEH9l19Bsk68i0mrHWc5QLRltbd4FMFBTLl4FK5Oou3CXjlEkMFJqck7btg8TSfJbztK9KVbFH Zl652x0w==; Received: from localhost ([::1] helo=bombadil.infradead.org) by bombadil.infradead.org with esmtp (Exim 4.97.1 #2 (Red Hat Linux)) id 1sP7lM-0000000BXNl-0OFc; Wed, 03 Jul 2024 21:43:40 +0000 Received: from mail-ot1-f41.google.com ([209.85.210.41]) by bombadil.infradead.org with esmtps (Exim 4.97.1 #2 (Red Hat Linux)) id 1sP7lI-0000000BXLP-04fR for linux-mediatek@lists.infradead.org; Wed, 03 Jul 2024 21:43:37 +0000 Received: by mail-ot1-f41.google.com with SMTP id 46e09a7af769-702021fba9bso113280a34.1 for ; Wed, 03 Jul 2024 14:43:35 -0700 (PDT) X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1720043015; x=1720647815; 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=g37T4CjI6r9HOceV/Z2FL5pGlk5t0qMk/CEhDyaAnXw=; b=GdoB1gwkmw79ZkcxCS5/nNDtL6GXaSOjIshcVhmzvZm0aLyxFJ5b4q5wEMStwOemdj 9kUAcZkh26lvXKQVBS3A7D0kM2g0EQ+KU19zoNmJ7WhWSZuP5W0SpkLfwz7lEAenepms ySR7OR7J6NzvtAfbffoQH6MjB9BborBnKeFB78Js8DdOBxDCp2JnQUv19lbffBnjRzeO gZ0+nU3RjxBRxlCClLN4ikZAkFclWZAYWkmeR/j0ItctRFFgEq8nvmGuenUcV+0Enuz8 PqLtUXqWpNp6MYyBtDIvEFhEzRgsPxg8dlUvxKwnr3kS0y+u5a768OZ3WmeXoaCXeKIQ IKyQ== X-Forwarded-Encrypted: i=1; AJvYcCV1Cqa6dbh4gjnF4tFYF9AU2Asz/kcE781/Vgn3e9bdNRhov0HHyDZggYV5HiAI8zB8rAQqlQ5NAhQ7uHw57iySTMUm3QqMdMERZe6b7MvkpIKA X-Gm-Message-State: AOJu0Ywk6NJ0O3218MSv6VN2RLfoHlVMOI1bFjrpOxgaSI4PqGQsAuNB zR3Jn1UXMra7ViqcFy0m0xK/O13GGU8V2NRmpj/yCUjQM12kzBva X-Google-Smtp-Source: AGHT+IGZQAxkdXIk+I8F4X/wcmiceJqFKgT51xCUKYrAA7cmb2oD4iG5Df3wtgYhrthp3Cx1CY5XHA== X-Received: by 2002:a9d:5c89:0:b0:700:ca11:1158 with SMTP id 46e09a7af769-702076766bcmr11947539a34.1.1720043015253; Wed, 03 Jul 2024 14:43:35 -0700 (PDT) Received: from sean-ThinkPad-T450s.lan ([207.191.35.252]) by smtp.gmail.com with ESMTPSA id 46e09a7af769-701f7b20953sm2111417a34.54.2024.07.03.14.43.33 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Wed, 03 Jul 2024 14:43:34 -0700 (PDT) From: sean.wang@kernel.org To: nbd@nbd.name, lorenzo.bianconi@redhat.com Cc: sean.wang@mediatek.com, deren.wu@mediatek.com, mingyen.hsieh@mediatek.com, linux-wireless@vger.kernel.org, linux-mediatek@lists.infradead.org Subject: [PATCH 23/29] wifi: mt76: mt7925: update mt7925_mcu_sta_mld_tlv for MLO Date: Wed, 3 Jul 2024 14:42:28 -0700 Message-Id: <99eac993f7020488f0debf972e2fc71f4bca36a4.1720042294.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-20240703_144336_081705_05B79B65 X-CRM114-Status: GOOD ( 11.35 ) 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 3f0ceebed2f8..71f1fb9fbe2f 100644 --- a/drivers/net/wireless/mediatek/mt76/mt7925/mcu.c +++ b/drivers/net/wireless/mediatek/mt76/mt7925/mcu.c @@ -1735,19 +1735,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); - /* TODO: 0 means deflink only, add secondary link(1) later */ - mld->link_num = !!(hweight8(vif->active_links) > 1); - WARN_ON_ONCE(mld->link_num); + for_each_set_bit(i, &valid, IEEE80211_MLD_MAX_NUM_LINKS) { + if (cnt == mld->link_num) + break; + + 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 Wed Jul 3 21:42:29 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Sean Wang X-Patchwork-Id: 13722880 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 04932C31D97 for ; Wed, 3 Jul 2024 21:43:42 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=lists.infradead.org; s=bombadil.20210309; h=Sender:List-Subscribe:List-Help :List-Post:List-Archive:List-Unsubscribe:List-Id:Content-Transfer-Encoding: MIME-Version:References:In-Reply-To:Message-Id:Date:Subject:Cc:To:From: Reply-To:Content-Type:Content-ID:Content-Description:Resent-Date:Resent-From: Resent-Sender:Resent-To:Resent-Cc:Resent-Message-ID:List-Owner; bh=sW7nAYSBD4glkIK9OSU6ZgZqDA0uvjteIHLwvRqU2zg=; b=1qllrxe0KWTO1GbaRxsMesZqGP GkNufRw89Px0s2ty+wp0KBXSPB0o0y/9ctrpliMHqsxeTd52DijyQYdXAqsYwEF+8ZmWHXpJNYmC9 1M4CnHX29Ud036uNtN8PBN0lj3tlZCkAPZvw7sonV4nebiK7cQioFQocoygI8mGYE7hBsOumwlta0 aYfXxPPz2PZ1LRmxxh7CtwlWPZR5RtNfMQUvF75WmG0mgluCXJgNljPbdwvFWG0+Gon2NJxk9C1cg we0Rg6HlI1F6TvmVA5z8WeJpAYOzINFhEJd7nhmL69n7AStmzgcfl5TfEAdtcPyojoaw4q94o7YQj s52scDeA==; Received: from localhost ([::1] helo=bombadil.infradead.org) by bombadil.infradead.org with esmtp (Exim 4.97.1 #2 (Red Hat Linux)) id 1sP7lN-0000000BXP0-2jOG; Wed, 03 Jul 2024 21:43:41 +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 1sP7lK-0000000BXMd-0hwJ for linux-mediatek@lists.infradead.org; Wed, 03 Jul 2024 21:43:41 +0000 Received: by mail-oa1-f46.google.com with SMTP id 586e51a60fabf-25cb5ee9d2dso4951fac.1 for ; Wed, 03 Jul 2024 14:43:37 -0700 (PDT) X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1720043017; x=1720647817; 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=sW7nAYSBD4glkIK9OSU6ZgZqDA0uvjteIHLwvRqU2zg=; b=phsmulIybN5I8Rz+LTOsCcx+f1pABxosmGzVUHYPoBMrDdKPdZmLjZTiR/Gzos9bc8 tEtY4b9IitqR1QNOGdJzubr66wzmY0cvh80iFRETwPIipVgrZEA6Kne6kZ6NI3orsyYe QAqQ6GBlxBgXAp1oy2qEcbYmD0gDZiuyirnsaAfugWg5nYNlSagVxyiMWaYzZSIYOwOe PNn+O4IY+wQb97e1E982o5VTCb8mUkdgJ+dhJ4YPGtrj6/wQPOti5947s/dkoqsFdbPJ UfVHdfHT6katbP9JH/GsgyqzRYN/WaBRdT02pi5toneLesECuvngyz8V2oLyCLGwiP6D ZY3Q== X-Forwarded-Encrypted: i=1; AJvYcCWe2tRkzMFG/+YIPJSne2gDX7USuqEDzy7h7OPrrf+uhHkvfz2aJbC1XPC75Vq8c9Cw0Zckmmp8DHm4pKpTRqAGexbaNp4YPUevJMcJxbIQyLQa X-Gm-Message-State: AOJu0YzX3nuB088fLmNbmNwiLBzyWNEn4L1E+74TqA6c6noOXCdY8Bc6 iDEZMj+onB3RsQXN8HW57U/iPfrce0VAp+c+U6Fku/KF3CiRVjQMgXN0yDml X-Google-Smtp-Source: AGHT+IH4XOZT62iIvZhEGPj3+iU/gi4uuYHksxIRuTmMEG197w45CPTYhpsRRPAJv8JVvFwYI78Ckg== X-Received: by 2002:a9d:6b12:0:b0:701:f9f0:73d8 with SMTP id 46e09a7af769-7020772bb17mr13165353a34.2.1720043017154; Wed, 03 Jul 2024 14:43:37 -0700 (PDT) Received: from sean-ThinkPad-T450s.lan ([207.191.35.252]) by smtp.gmail.com with ESMTPSA id 46e09a7af769-701f7b20953sm2111417a34.54.2024.07.03.14.43.35 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Wed, 03 Jul 2024 14:43:35 -0700 (PDT) From: sean.wang@kernel.org To: nbd@nbd.name, lorenzo.bianconi@redhat.com Cc: sean.wang@mediatek.com, deren.wu@mediatek.com, mingyen.hsieh@mediatek.com, linux-wireless@vger.kernel.org, linux-mediatek@lists.infradead.org Subject: [PATCH 24/29] wifi: mt76: mt7925: update mt7925_mcu_bss_mld_tlv for MLO Date: Wed, 3 Jul 2024 14:42:29 -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-20240703_144339_657299_70E9E45A X-CRM114-Status: GOOD ( 11.55 ) 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 | 19 +++++++++++-------- .../net/wireless/mediatek/mt76/mt7925/mcu.h | 5 ++++- 2 files changed, 15 insertions(+), 9 deletions(-) diff --git a/drivers/net/wireless/mediatek/mt76/mt7925/mcu.c b/drivers/net/wireless/mediatek/mt76/mt7925/mcu.c index 71f1fb9fbe2f..8e36fb211dcc 100644 --- a/drivers/net/wireless/mediatek/mt76/mt7925/mcu.c +++ b/drivers/net/wireless/mediatek/mt76/mt7925/mcu.c @@ -2384,24 +2384,28 @@ 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->link_id = is_mld ? link_conf->link_id : 0xff; mld->group_mld_id = is_mld ? mconf->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 @@ -2511,10 +2515,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 f0b890ad43e7..545f6b2d524c 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 Wed Jul 3 21:42:30 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Sean Wang X-Patchwork-Id: 13722881 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 E043AC3271E for ; Wed, 3 Jul 2024 21:43: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=bwqorZoTFFCKliGP8pRCTs9efMb53TYnGt4MRvbI/og=; b=dXcXeVtgowDYJtj/GFo9X3sqcM MHz6SFXpGtUDkRy0g5LudKC9J+BotL+VIP+GSftWOqzhviXy9dzEuj1PRNX2Qtvcj9CaC/EeeYkjq euGfzLqh/OQi2rmzvPEFzV4Epf8TDamgXHgzdbNxsakr84YVJKMuHlCmUlM7VtuMPa0g2SMMqMQlT PTezQA1VDz1mA/fb7K5rquyJOOiRdj3UlcZOWj1FPLqcsN9XPwLRRH0s6PSWsxA38g2dS3EoXKlhT qE0teCogcazOMV/6ZlMUPXBZX0drQXctAhxyK5uctvNQwvAYULj0pDvSo7w132rb++1y28SBAja3U cgMqgltg==; Received: from localhost ([::1] helo=bombadil.infradead.org) by bombadil.infradead.org with esmtp (Exim 4.97.1 #2 (Red Hat Linux)) id 1sP7lQ-0000000BXQV-2T0j; Wed, 03 Jul 2024 21:43:44 +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 1sP7lM-0000000BXMw-0VUq for linux-mediatek@lists.infradead.org; Wed, 03 Jul 2024 21:43:41 +0000 Received: by mail-oa1-f54.google.com with SMTP id 586e51a60fabf-24c5ec50da1so3627fac.3 for ; Wed, 03 Jul 2024 14:43:39 -0700 (PDT) X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1720043019; x=1720647819; 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=bwqorZoTFFCKliGP8pRCTs9efMb53TYnGt4MRvbI/og=; b=co/nzcxEURrQV9oRjyDaVV56iGK5LvAF5/Ru8lg7HjMeE7PPcWp1HRyYElb3hT9y7Z 3My5Y/NBKAAYaOHaVZdp8LF22UHDcZROORNVair0M3veKVcnUUF0S47wEf+lGLbNgzhp FvAYkGRA6gYEWU1NXkCKh095R+GvvXc8Cbd76utFZAaUG8QIvaKxZQBcVmDUKkJf9ftS hubweCdVHz4jbW36GPi/clOAJB3KTxmlckanXOKL9CcgD3OKqDc6JarYPvE204vLnx+S rqSvKCeawHyaNq0kc7FTgjSo9gGq7Vpo7JoW/um/Rwxr/5hmvaMzZ9BWQY6JJrLnG7nB 6rnA== X-Forwarded-Encrypted: i=1; AJvYcCVE6+8geO0Mizd1ixeyJUPizzdIKOOS0xSlwyTGEpeGsN5uIC7FLpEK+mw6yTMVsWiOTPsc6rUSyoc8J+bJjkuXYQ0a+DWOtmhAj2HB4Rd6RMFM X-Gm-Message-State: AOJu0YyKdQ9hv/5NS+P9cR9P8aZmzZCG2il9BSh8QolbGym7VAl6iepf RurVlRIKE+s+ZyJsZ4vZ17tqgHTpd1/GNmgfBVYexomy2oXbJq75 X-Google-Smtp-Source: AGHT+IHo1AAWxD+r1FVufqOGwJZIiBIJ5Fr19n7yL5Sc8XkDMXkfUza+KBsv5oIqzuNNAzCLC0jxKg== X-Received: by 2002:a9d:6b12:0:b0:701:f9f0:73d8 with SMTP id 46e09a7af769-7020772bb17mr13165401a34.2.1720043018979; Wed, 03 Jul 2024 14:43:38 -0700 (PDT) Received: from sean-ThinkPad-T450s.lan ([207.191.35.252]) by smtp.gmail.com with ESMTPSA id 46e09a7af769-701f7b20953sm2111417a34.54.2024.07.03.14.43.37 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Wed, 03 Jul 2024 14:43:37 -0700 (PDT) From: sean.wang@kernel.org To: nbd@nbd.name, lorenzo.bianconi@redhat.com Cc: sean.wang@mediatek.com, deren.wu@mediatek.com, mingyen.hsieh@mediatek.com, linux-wireless@vger.kernel.org, linux-mediatek@lists.infradead.org Subject: [PATCH 25/29] wifi: mt76: mt7925: update mt7925_mcu_add_bss_info for MLO Date: Wed, 3 Jul 2024 14:42:30 -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-20240703_144340_380534_673E5A0F X-CRM114-Status: UNSURE ( 9.28 ) 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_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 | 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 8e36fb211dcc..218efe543dbb 100644 --- a/drivers/net/wireless/mediatek/mt76/mt7925/mcu.c +++ b/drivers/net/wireless/mediatek/mt76/mt7925/mcu.c @@ -2525,7 +2525,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 Wed Jul 3 21:42:31 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Sean Wang X-Patchwork-Id: 13722882 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 63C6AC31D97 for ; Wed, 3 Jul 2024 21:43:48 +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=B6qob4+aEz9AnxDvyJPADamvZqFlBJwBhBj073zgKUw=; b=MXgxI8FqbLsWafc4GqJHr2jx/Q RSY4xQgbIZ63PrPCuioaJFTSz8NjgH95uKnZCpaD8mTuAVrbm7AverN7ucv/+jlVW10rNovK27o+O 22DV/x7tRXayFR5g2OJCTmRe412Qb0eELdkY4FLyMiR4Sp5qryiOBCSYtqWeF8HaTQ6FJaQ9wveDL nrudTR39wgQxAkST3UK9Rd02g7i9kSmMPfXMnJoScGxkUvhiOMnUmJKBUZo1jol/XTmhijNoF95re FXT+YTIEVl0zMha9q25xgP7H/WgJTnx8Cql0COXbpXHRj4h2bz8tBe2XXhm2zEbqr+bpbZTIg88cR acJkFusA==; Received: from localhost ([::1] helo=bombadil.infradead.org) by bombadil.infradead.org with esmtp (Exim 4.97.1 #2 (Red Hat Linux)) id 1sP7lU-0000000BXSK-02sj; Wed, 03 Jul 2024 21:43:48 +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 1sP7lQ-0000000BXQg-49T1 for linux-mediatek@lists.infradead.org; Wed, 03 Jul 2024 21:43:46 +0000 Received: by mail-oa1-f42.google.com with SMTP id 586e51a60fabf-25cd49906aeso4013fac.2 for ; Wed, 03 Jul 2024 14:43:44 -0700 (PDT) X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1720043024; x=1720647824; 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=B6qob4+aEz9AnxDvyJPADamvZqFlBJwBhBj073zgKUw=; b=aYS3XOtbXDI/scdQsIiTq5nKtZnjIAZEcahUaEmL4xJjD25LKa5xTRMXwdtKV7jun0 YmFhqdPH7/RNadBwZrssfxUf6exJMEjNKVyVkVNui5c5rFUWOrRVCP3iDzBJV5JgO0g7 SK4uq2uNP1FTxuXvxmu7gDBCR6duIxU/bgGUtac8dJ5LAr4ZcgzBwBEMlHMTfkDYdyEQ BHeUuO+hbPf47zDL6t93CjgmA47VJRYSAC7KnTe2yE6L1scBygCrE7XivPmkXslWFYmt kKrnu2RuX7Kp8gfOZHMAyURqqLer+fB6Q+dFFsnnO4Ez7MKax4Istg+3TIsypctphZgW klLQ== X-Forwarded-Encrypted: i=1; AJvYcCWSCEHK9xQYo8AQBDcGNNpkLOE1bYuoTBA/4WYKtvmSvQ9Jarhhf5lRmRm4HK/wZYVbtaZN32zh8okHV8KB+r17CoCikgOH0WfF2tgM+2QQZ1UF X-Gm-Message-State: AOJu0YxPkz1Qoelz8I3Dghs7JmnBLNKwJBqKYAymbXl95HbXEjv3PMk8 qXig31XqUv7lHteddaZTutCSB+64JHbIgvSa7cUNAXpig0kezB4P X-Google-Smtp-Source: AGHT+IFRqrqB0oJS3To8CcpUlTALffwBa/HcXjrOdTq70HVTagouqm9arBdBlmJYNrdzs27Y8+RfEA== X-Received: by 2002:a05:6830:68cd:b0:700:d697:6ca7 with SMTP id 46e09a7af769-70207554355mr12585737a34.0.1720043022162; Wed, 03 Jul 2024 14:43:42 -0700 (PDT) Received: from sean-ThinkPad-T450s.lan ([207.191.35.252]) by smtp.gmail.com with ESMTPSA id 46e09a7af769-701f7b20953sm2111417a34.54.2024.07.03.14.43.39 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Wed, 03 Jul 2024 14:43: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 26/29] wifi: mt76: mt7925: update mt7925_mcu_sta_update for MLO Date: Wed, 3 Jul 2024 14:42:31 -0700 Message-Id: <8b39975133d1c41ff724669562bd340eb2894617.1720042294.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-20240703_144345_058120_198872BF X-CRM114-Status: GOOD ( 13.82 ) 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 | 65 ++++++++++++++++++- .../net/wireless/mediatek/mt76/mt7925/mcu.h | 3 +- 3 files changed, 75 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 218efe543dbb..dcb8c506543b 100644 --- a/drivers/net/wireless/mediatek/mt76/mt7925/mcu.c +++ b/drivers/net/wireless/mediatek/mt76/mt7925/mcu.c @@ -1805,6 +1805,63 @@ 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 mt76_vif *mvif = (struct mt76_vif *)info->vif->drv_priv; + struct mt76_dev *dev = phy->dev; + struct sk_buff *skb; + + skb = __mt76_connac_mcu_alloc_sta_req(dev, mvif, 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, @@ -1823,6 +1880,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; @@ -1831,7 +1889,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 545f6b2d524c..8a0196699230 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 Wed Jul 3 21:42:32 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Sean Wang X-Patchwork-Id: 13722883 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 069EBC2BD09 for ; Wed, 3 Jul 2024 21:43: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=5Zm2u2GDuUR87ImOZGiIFmMyIIv/8lErTyscfyIFe+M=; b=un9mj4WfsuKHTTCwgKxY7Yr63V pUgeb0z/iDT7y1bKK1Erv10vLawN2VZlHvH57NqXWwtdE14gJL/m6t/aulmP6IqFc3iJX+ZI4t3ZT pzVj1jdVG99jMOgr9uEhC0BXdXWDh4PmzsxrrAo5z/7YRFAcWQ8VadsGBQupI/Zl0eWnx7l7cER23 fq/hRGkied7VkzXTnEQH4uu8uUse0eGUhTzlNN+wjQY6/INgXDWlayvWK2eQpCIx0MoTPrQAsiJkm 4rj6wk5QDaLFRxsqJs+6UDQEwjt7o3dpzEW5Wf9gLAZK3S1fkPziu1J2F8fLFEoFBWBA7kJ3K2men kS2pdQcg==; Received: from localhost ([::1] helo=bombadil.infradead.org) by bombadil.infradead.org with esmtp (Exim 4.97.1 #2 (Red Hat Linux)) id 1sP7lV-0000000BXTU-2dvF; Wed, 03 Jul 2024 21:43:49 +0000 Received: from mail-ot1-f54.google.com ([209.85.210.54]) by bombadil.infradead.org with esmtps (Exim 4.97.1 #2 (Red Hat Linux)) id 1sP7lT-0000000BXRl-0SEq for linux-mediatek@lists.infradead.org; Wed, 03 Jul 2024 21:43:48 +0000 Received: by mail-ot1-f54.google.com with SMTP id 46e09a7af769-70228a1af2eso45434a34.2 for ; Wed, 03 Jul 2024 14:43:47 -0700 (PDT) X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1720043026; x=1720647826; 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=5Zm2u2GDuUR87ImOZGiIFmMyIIv/8lErTyscfyIFe+M=; b=RWHmAZnv3R+RU+G1XEEDAWHkwLM4rzVd/xgX28Foow/wlHFOY4AcuLcFn/0QwcF6/j qJMQ7ztp/C7P1KITjpdytUdxzFpLJ1vZEklXikBZgjkPlki7R1rCrDj9QOgKCpZsT4xk K0yPc/7izV16Sy8rmBvmWXde2GJPnVT0wzm4yA51en2DMxCgXrI2WAzp6MQEC67TVt9Z FAEsL/88ympcJ8JZl4BsP4bbi0dUS4u4H8xuUSbIeBXCoohr7Dx2klAAIwYH2u5zu3e6 T4BiN/JrQWN8p/qpuP3cwgzWbpBseOoJgFkFO6esWkXAlf6xVhSN4RiJ3HkzhC4Rsuq/ S+EQ== X-Forwarded-Encrypted: i=1; AJvYcCUcFt7WJ+dLo4DvbDs8QQwd+FaQREkzwpHO8SdA8Xqqg+gt1yPaoAgvvAbmxZl2EVvDFe+xbcghCertArhUZQqX3UEQOR2bcQbBr2c4DiEPllzq X-Gm-Message-State: AOJu0YyORnKMB1UvcXSz94u4pOZUNyibz3rTsucpAonZ1XL1sTYMnWaY T7b6PETYOIAVBh/Jdhq9MLFfjdzI+plXehZRYXiF3W9OLm2FL90A X-Google-Smtp-Source: AGHT+IHOSLauwODbtAedsub0S622gbphfmI+pOTqu9GNMm9cAI1Tx7iKjETXO6xlPoYg3paWmDA2LQ== X-Received: by 2002:a9d:65c5:0:b0:700:ca13:30bc with SMTP id 46e09a7af769-70207763b58mr13703603a34.2.1720043026332; Wed, 03 Jul 2024 14:43:46 -0700 (PDT) Received: from sean-ThinkPad-T450s.lan ([207.191.35.252]) by smtp.gmail.com with ESMTPSA id 46e09a7af769-701f7b20953sm2111417a34.54.2024.07.03.14.43.44 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Wed, 03 Jul 2024 14:43: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 27/29] wifi: mt76: mt7925: add mt7925_mcu_sta_eht_mld_tlv for MLO Date: Wed, 3 Jul 2024 14:42:32 -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-20240703_144347_180467_5BFE5F7A X-CRM114-Status: GOOD ( 13.04 ) 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 dcb8c506543b..36ddc64ed7d6 100644 --- a/drivers/net/wireless/mediatek/mt76/mt7925/mcu.c +++ b/drivers/net/wireless/mediatek/mt76/mt7925/mcu.c @@ -1731,6 +1731,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) @@ -1848,8 +1884,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 8a0196699230..5703176056db 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 Wed Jul 3 21:42:33 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Sean Wang X-Patchwork-Id: 13722884 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 90510C3271E for ; Wed, 3 Jul 2024 21:43: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=2J9B7zhjK3f29ovrL4Llul+VWCgxd/DHWLce6tzebVg=; b=gu7/JCr/E7+hnFN4u4w/TlzZeM 1DJkH2KeI6JKymYTSpihEX9LjMP8x1J+YDW65hs7rQi5RI5VMPjK2bZhgZa4vSuLwXD5RuG6OVXfo 4JFy6B/dDfwvJfuQ5a/BJCQcWD3k70I515zlPDfaJDTwqRbh94Uv8eftuQyd2ie+gUUHmOiNcqfY+ vBA//Xvk2Z3Cbp4K8zhne4uduqZsgfcEsySaprTbz3s822LGs8ls4MRugsOeoI6EoMb3WoV+loZ+3 BRCsEYaNbMSJD2+AUNoO1hIyhYWmF8s//6LlOTaT4sjc/piEUH2B4O/vMlILxgWH7o+BVtpy3NkIZ A2AxRHLQ==; Received: from localhost ([::1] helo=bombadil.infradead.org) by bombadil.infradead.org with esmtp (Exim 4.97.1 #2 (Red Hat Linux)) id 1sP7lY-0000000BXV2-0QlG; Wed, 03 Jul 2024 21:43:52 +0000 Received: from mail-ot1-f42.google.com ([209.85.210.42]) by bombadil.infradead.org with esmtps (Exim 4.97.1 #2 (Red Hat Linux)) id 1sP7lV-0000000BXT4-0ppF for linux-mediatek@lists.infradead.org; Wed, 03 Jul 2024 21:43:50 +0000 Received: by mail-ot1-f42.google.com with SMTP id 46e09a7af769-70228a1af2eso45436a34.2 for ; Wed, 03 Jul 2024 14:43:49 -0700 (PDT) X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1720043028; x=1720647828; 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=2J9B7zhjK3f29ovrL4Llul+VWCgxd/DHWLce6tzebVg=; b=evlb74BWMfbr7yDKyFNOtqbQCnL8JugTPR9FJzt2HctNm2rZlwFyUeimAzqV/i24wO DpEDsJlBZk9tbZCAN/ZNTVpmkmjJzzPbnI11QJzM9fvkI0LSm6zs2t06/Cb7ty36+8gb JLUFJrEdWbSHYxLpqr42WiumIvx+3+a7wTou/SGOPmTHEE2yHtHJgXCiBNoO7rhcsWNU RF1JzzgeWEwdI8og2JTteNgkzz/e8SlXwwcESMeor4Fd6qlvCpzK3tuU4VVzwNfXq1RD MF44eZjhCixpnXWEsV5r9IReMhYzj8bZQ6iDA2aWS8C3LCv3ydbG9Lw7sfjgS2fez9RU BCcw== X-Forwarded-Encrypted: i=1; AJvYcCVDYWb3oFLbtrCt3jRJuLLm3pfmKw6UykWyhMGNVvO/dy8H0el7/sGPirhBdU/wdAbjrY9fmMZdsgMg9e+y13UkntIGx+Q4ms8b0i8HF4fOStHr X-Gm-Message-State: AOJu0Yx869eE6Vvls6T85bOH+Vgf0bplmfRD2ihliLhK9obkz2O/7mVq ZWjbHlJvRJjbrv/MGOdY876Ul4j0st0q2WpJX/qYvYIjoVrC8nft X-Google-Smtp-Source: AGHT+IGmS4lxO+9/5KpWC0FYHXRgQxAMPZY/PNjXZVYVqL4NuwCgC1ZKfvRFuBZHJYGD3zKGbvWLeg== X-Received: by 2002:a9d:65c5:0:b0:700:ca13:30bc with SMTP id 46e09a7af769-70207763b58mr13703664a34.2.1720043028356; Wed, 03 Jul 2024 14:43:48 -0700 (PDT) Received: from sean-ThinkPad-T450s.lan ([207.191.35.252]) by smtp.gmail.com with ESMTPSA id 46e09a7af769-701f7b20953sm2111417a34.54.2024.07.03.14.43.46 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Wed, 03 Jul 2024 14:43: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 28/29] wifi: mt76: mt7925: update mt7925_mcu_sta_rate_ctrl_tlv for MLO Date: Wed, 3 Jul 2024 14:42:33 -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-20240703_144349_267759_99AD0ED5 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 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 | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/drivers/net/wireless/mediatek/mt76/mt7925/mcu.c b/drivers/net/wireless/mediatek/mt76/mt7925/mcu.c index 36ddc64ed7d6..829d87d4eb95 100644 --- a/drivers/net/wireless/mediatek/mt76/mt7925/mcu.c +++ b/drivers/net/wireless/mediatek/mt76/mt7925/mcu.c @@ -1707,7 +1707,9 @@ 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; + struct mt792x_bss_conf *mconf = mt792x_vif_to_link(mvif, + link_sta->link_id); + struct cfg80211_chan_def *chandef = &mconf->mt76.ctx->def; enum nl80211_band band = chandef->chan->band; struct sta_rec_ra_info *ra_info; struct tlv *tlv; From patchwork Wed Jul 3 21:42:34 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Sean Wang X-Patchwork-Id: 13722885 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 5C292C2BD09 for ; Wed, 3 Jul 2024 21:43: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=I/n7VZ7fj0o/3ai4SZ3SKcdBS97sLOgxIRvgNtfo2Zc=; b=bHWBGdlvxeyKkxtfECTD6TCopQ 7b7ZesmNMiVYdjBQtPV7jZIrk26mqWotRwep1w61SPcVAIeKCgla8oN+cC1a1i46OalKpzsad4iCo pj9F0M8DETDj9immxRpVo14J8+pRFMi9MVtcFicxRwm4JN1LOXLDbiUtHVbcQst+RWLm+HZanoMr0 7GAIIrJceIi7K8/T4FpHl2uDNaTovZ0klWxNt4FSuCFwboab+/gnfa2anIuv7ulmhELHNwCdcu9HC nQvG8MwGflIdPwZZfvvgMyUaH6YyZFeG/X3fiIWZItWExm10nr++qaFei3iW9n6rRDJ2qiqdO1yS9 uhPCpr1Q==; Received: from localhost ([::1] helo=bombadil.infradead.org) by bombadil.infradead.org with esmtp (Exim 4.97.1 #2 (Red Hat Linux)) id 1sP7la-0000000BXWK-0DJA; Wed, 03 Jul 2024 21:43:54 +0000 Received: from mail-oi1-f179.google.com ([209.85.167.179]) by bombadil.infradead.org with esmtps (Exim 4.97.1 #2 (Red Hat Linux)) id 1sP7lX-0000000BXUb-1xVQ for linux-mediatek@lists.infradead.org; Wed, 03 Jul 2024 21:43:52 +0000 Received: by mail-oi1-f179.google.com with SMTP id 5614622812f47-3d565b869d9so8229b6e.0 for ; Wed, 03 Jul 2024 14:43:51 -0700 (PDT) X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1720043030; x=1720647830; 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=I/n7VZ7fj0o/3ai4SZ3SKcdBS97sLOgxIRvgNtfo2Zc=; b=j0z4EHp+/nhemO+Qz2wFE4uRguM8+xQwE5m2Ettry/irbK7D1bqcL8/bFNgMymEvaW MK/5J4PYZxWQv2J5jA0e1ShYxrb4vkHVzTBjkp4v2XGNEnu9PG6m4C8CZg0KsOYi/2pZ a/maKN41kzlxJBtdWNHkKnlFMZNz0z+Zitjrpyx38S6FZ00a2sH7x8O29yhd2sVktTA1 1v1W0LeQ4guhmTjJgS/y7lzoc4TDeJSBZDEyny/kxKL3l7akNpu+voNt+FnjS5y4aBQg MwajSu7HYeSjw8mw9QeQ6cM44M+bSexVWPS5kwfEbSUq+yuez9qS85l8SxMHUc4AnxS7 DhuQ== X-Forwarded-Encrypted: i=1; AJvYcCX6WSKjoZaOrkQU2S2UlA+geXhE0FXcJhnrDtn2wToOumkg+VGz4JftGm16WPnxvUrYqX4PFWWfEXF2GP2yIJZi+pkUsUUl8jjRUdcpwVI8HMRc X-Gm-Message-State: AOJu0YzAQ8I+wfFIjdJubK8nPS7F240dkkjKQ+i2pDUUX5/17UNVlo7+ 51ESTFuKLedPmtrEYc46rCtTm6Jt2NCNhWZLb6p8eWlbw7UtdtiGtEcMVq7X X-Google-Smtp-Source: AGHT+IE4LsxQwXh0EZDYiJMTt6PW30ChD/EOSWZ2xrYLO5k/bhg54hR3h6oqAdq7s9sb9spqCpytDg== X-Received: by 2002:a9d:65c5:0:b0:700:ca13:30bc with SMTP id 46e09a7af769-70207763b58mr13703746a34.2.1720043030407; Wed, 03 Jul 2024 14:43:50 -0700 (PDT) Received: from sean-ThinkPad-T450s.lan ([207.191.35.252]) by smtp.gmail.com with ESMTPSA id 46e09a7af769-701f7b20953sm2111417a34.54.2024.07.03.14.43.48 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Wed, 03 Jul 2024 14:43: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 29/29] wifi: mt76: mt7925: enabling MLO when the firmware supports it Date: Wed, 3 Jul 2024 14:42:34 -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-20240703_144351_536145_51F1E78B X-CRM114-Status: GOOD ( 15.40 ) 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 13b40032cd72..213331a92166 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 829d87d4eb95..d4b020b50be1 100644 --- a/drivers/net/wireless/mediatek/mt76/mt7925/mcu.c +++ b/drivers/net/wireless/mediatek/mt76/mt7925/mcu.c @@ -749,6 +749,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) { @@ -803,6 +817,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 4c0ecae8e49b..d51cc8a02b9e 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;