From patchwork Tue Jan 14 02:07:07 2025 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Sean Wang X-Patchwork-Id: 13938292 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 8AEB9C02180 for ; Tue, 14 Jan 2025 02:08: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: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:In-Reply-To:References:List-Owner; bh=O7tVda83kgsvcWofCoQwXTUD8V5WuoqGzphevzyeA7k=; b=IB0VwDdKzaB4E7jpa06xNrkyjg NDJk/4Acdv2OG3/ZWJNqoX2UfLhROQHO8s1PFD1AHf61msO9eseAtJMCduuUoZzBJLOCC4hBtWiBr SFZO4+e3w8S7zU/+o8/Q2IkIpcWitEF8QH96TA4siKTYXuair3szeROFaQb4LC85ylOfiEq8bIuif QkkIOx6nwCA/K4Gzg1I4pfy/dRboIGKc7CRpK0gzoZv8UoWTzhwr4/qnmLzXm5dHpfgvowOilthRq Xq8AWSS9Lp5bNaXKe9AgOztNnS4rsbWuQYgDWaA3qxUyBcpjm7f1dNrYAk0kFD37VU0LbQrIO/ZXA m/P8m2ow==; Received: from localhost ([::1] helo=bombadil.infradead.org) by bombadil.infradead.org with esmtp (Exim 4.98 #2 (Red Hat Linux)) id 1tXWLg-00000007D2d-2ida; Tue, 14 Jan 2025 02:08:08 +0000 Received: from mail-oo1-f41.google.com ([209.85.161.41]) by bombadil.infradead.org with esmtps (Exim 4.98 #2 (Red Hat Linux)) id 1tXWKt-00000007CxI-1fQP for linux-mediatek@lists.infradead.org; Tue, 14 Jan 2025 02:07:20 +0000 Received: by mail-oo1-f41.google.com with SMTP id 006d021491bc7-5f32fab5de9so1278447eaf.2 for ; Mon, 13 Jan 2025 18:07:18 -0800 (PST) X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1736820438; x=1737425238; h=content-transfer-encoding:mime-version:message-id:date:subject:cc :to:from:x-gm-message-state:from:to:cc:subject:date:message-id :reply-to; bh=O7tVda83kgsvcWofCoQwXTUD8V5WuoqGzphevzyeA7k=; b=QazD0jXXibHFO7qUDo0MURAHAIH/Fy9BjF4EVl4MuriFXJaQdjwTHedlxQJvF/RRPM fpkandHIVH/djhstR1KAq00O0HsoVheZIqzQ161k3oZpoGgQ1UvfXbyQXUnU2au1Qo7T SUF1h7mjXcHOdjr8rx+npMOVLZVwqC2oQPkYNfGCGUwIesZTs5lwUrIjvHDeXwZleLk8 qqXveNuxK1JEA+T7ZiHeg/SC9fTIwdiI8GyuoMc9E0rR2YgGRZ5bEBowAW2UPK9319CG VmPsdJADNa58OWKv2bmuRZF68fRE5cTUx+GYs+y2kMjzaMu+xmePvgk8q40b9r9ySooG d/8Q== X-Forwarded-Encrypted: i=1; AJvYcCVIKhO4MA3qbMWpFbVMcDVxyHHPccHto32VmnygAFbh1jqprlxzg5jSjIrnH3Ke3A/ZSOGHqXlQRir1B5+kEw==@lists.infradead.org X-Gm-Message-State: AOJu0YxIJYq+7/wvB7XqY3gL6xEwL+VMyZMrYA0PdM5R3lrrY0+jhxvt w6bxy7iJtCA03UMpT31ObwL+NzGxdUGhpd2owiV7RF94WkHm3NKI X-Gm-Gg: ASbGncvv8SzHC15yQwvfSThBwQXOIKjPmzbC8Gia4ztQ49iQ7CP9gY6P/GV+MNEIiyf zDFjadZRyIX9gFhMJD+WmrHcIOuDmp0HdaxRj65eT2kp+RruXHnejttzDS8chbT96gNow53NM2s Lf+syWpt+ymJo2A5CEAJ1ieZQjU6qWwEiIvkB28OxeTydwTxMe95SgJUN9EEaX8E9k2CSa3/PHi hbDiQNvDXcnkV1TbEHHqCIHGxtcQZ64g0lT7glXt8DIl/MESgbjiWpJlNiVBXr+JUXunqo2QA== X-Google-Smtp-Source: AGHT+IFFsoFl8vMd43GjQz6AqSSIGc3fZpTQeUhKk2BElyCxz6X5aD74tmtuhUdgRnb6+idqpMQRNw== X-Received: by 2002:a05:6820:88b:b0:5f6:e337:9fd with SMTP id 006d021491bc7-5f7308e1a67mr14219984eaf.2.1736820437677; Mon, 13 Jan 2025 18:07:17 -0800 (PST) Received: from sean-ThinkPad-T450s.lan ([207.191.35.252]) by smtp.gmail.com with ESMTPSA id 006d021491bc7-5f882755172sm3915340eaf.27.2025.01.13.18.07.14 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Mon, 13 Jan 2025 18:07:16 -0800 (PST) From: sean.wang@kernel.org To: nbd@nbd.name, lorenzo.bianconi@redhat.com Cc: sean.wang@mediatek.com, deren.wu@mediatek.com, mingyen.hsieh@mediatek.com, linux-wireless@vger.kernel.org, linux-mediatek@lists.infradead.org Subject: [PATCH v2 1/6] Revert "wifi: mt76: mt7925: Update mt7925_mcu_uni_[tx,rx]_ba for MLO" Date: Mon, 13 Jan 2025 18:07:07 -0800 Message-Id: <20250114020712.704254-1-sean.wang@kernel.org> X-Mailer: git-send-email 2.25.1 MIME-Version: 1.0 X-CRM114-Version: 20100106-BlameMichelson ( TRE 0.8.0 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20250113_180719_440042_0F8E1458 X-CRM114-Status: GOOD ( 13.57 ) 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: Ming Yen Hsieh For MLO, mac80211 will send the BA action for each link to the driver, so the driver does not need to handle it itself. Therefore, revert this patch. Signed-off-by: Ming Yen Hsieh Signed-off-by: Sean Wang --- v2: 1) generate the patch based on the latest mt76 tree 2) update the commit message --- .../net/wireless/mediatek/mt76/mt7925/main.c | 10 ++-- .../net/wireless/mediatek/mt76/mt7925/mcu.c | 50 ++++--------------- .../wireless/mediatek/mt76/mt7925/mt7925.h | 2 - 3 files changed, 14 insertions(+), 48 deletions(-) diff --git a/drivers/net/wireless/mediatek/mt76/mt7925/main.c b/drivers/net/wireless/mediatek/mt76/mt7925/main.c index 99b4879d9a5d..2082e3904d76 100644 --- a/drivers/net/wireless/mediatek/mt76/mt7925/main.c +++ b/drivers/net/wireless/mediatek/mt76/mt7925/main.c @@ -1289,22 +1289,22 @@ mt7925_ampdu_action(struct ieee80211_hw *hw, struct ieee80211_vif *vif, case IEEE80211_AMPDU_RX_START: mt76_rx_aggr_start(&dev->mt76, &msta->deflink.wcid, tid, ssn, params->buf_size); - mt7925_mcu_uni_rx_ba(dev, vif, params, true); + mt7925_mcu_uni_rx_ba(dev, params, true); break; case IEEE80211_AMPDU_RX_STOP: mt76_rx_aggr_stop(&dev->mt76, &msta->deflink.wcid, tid); - mt7925_mcu_uni_rx_ba(dev, vif, params, false); + mt7925_mcu_uni_rx_ba(dev, params, false); break; case IEEE80211_AMPDU_TX_OPERATIONAL: mtxq->aggr = true; mtxq->send_bar = false; - mt7925_mcu_uni_tx_ba(dev, vif, params, true); + mt7925_mcu_uni_tx_ba(dev, params, true); break; case IEEE80211_AMPDU_TX_STOP_FLUSH: case IEEE80211_AMPDU_TX_STOP_FLUSH_CONT: mtxq->aggr = false; clear_bit(tid, &msta->deflink.wcid.ampdu_state); - mt7925_mcu_uni_tx_ba(dev, vif, params, false); + mt7925_mcu_uni_tx_ba(dev, params, false); break; case IEEE80211_AMPDU_TX_START: set_bit(tid, &msta->deflink.wcid.ampdu_state); @@ -1313,7 +1313,7 @@ mt7925_ampdu_action(struct ieee80211_hw *hw, struct ieee80211_vif *vif, case IEEE80211_AMPDU_TX_STOP_CONT: mtxq->aggr = false; clear_bit(tid, &msta->deflink.wcid.ampdu_state); - mt7925_mcu_uni_tx_ba(dev, vif, params, false); + mt7925_mcu_uni_tx_ba(dev, params, false); ieee80211_stop_tx_ba_cb_irqsafe(vif, sta->addr, tid); break; } diff --git a/drivers/net/wireless/mediatek/mt76/mt7925/mcu.c b/drivers/net/wireless/mediatek/mt76/mt7925/mcu.c index 15815ad84713..d1506ee977a4 100644 --- a/drivers/net/wireless/mediatek/mt76/mt7925/mcu.c +++ b/drivers/net/wireless/mediatek/mt76/mt7925/mcu.c @@ -576,10 +576,10 @@ void mt7925_mcu_rx_event(struct mt792x_dev *dev, struct sk_buff *skb) static int mt7925_mcu_sta_ba(struct mt76_dev *dev, struct mt76_vif_link *mvif, - struct mt76_wcid *wcid, struct ieee80211_ampdu_params *params, bool enable, bool tx) { + struct mt76_wcid *wcid = (struct mt76_wcid *)params->sta->drv_priv; struct sta_rec_ba_uni *ba; struct sk_buff *skb; struct tlv *tlv; @@ -607,60 +607,28 @@ mt7925_mcu_sta_ba(struct mt76_dev *dev, struct mt76_vif_link *mvif, /** starec & wtbl **/ int mt7925_mcu_uni_tx_ba(struct mt792x_dev *dev, - struct ieee80211_vif *vif, struct ieee80211_ampdu_params *params, bool enable) { struct mt792x_sta *msta = (struct mt792x_sta *)params->sta->drv_priv; - struct mt792x_vif *mvif = (struct mt792x_vif *)vif->drv_priv; - struct mt792x_link_sta *mlink; - struct mt792x_bss_conf *mconf; - unsigned long usable_links = ieee80211_vif_usable_links(vif); - struct mt76_wcid *wcid; - u8 link_id, ret; - - for_each_set_bit(link_id, &usable_links, IEEE80211_MLD_MAX_NUM_LINKS) { - mconf = mt792x_vif_to_link(mvif, link_id); - mlink = mt792x_sta_to_link(msta, link_id); - wcid = &mlink->wcid; - - if (enable && !params->amsdu) - mlink->wcid.amsdu = false; + struct mt792x_vif *mvif = msta->vif; - ret = mt7925_mcu_sta_ba(&dev->mt76, &mconf->mt76, wcid, params, - enable, true); - if (ret < 0) - break; - } + if (enable && !params->amsdu) + msta->deflink.wcid.amsdu = false; - return ret; + return mt7925_mcu_sta_ba(&dev->mt76, &mvif->bss_conf.mt76, params, + enable, true); } int mt7925_mcu_uni_rx_ba(struct mt792x_dev *dev, - struct ieee80211_vif *vif, struct ieee80211_ampdu_params *params, bool enable) { struct mt792x_sta *msta = (struct mt792x_sta *)params->sta->drv_priv; - struct mt792x_vif *mvif = (struct mt792x_vif *)vif->drv_priv; - struct mt792x_link_sta *mlink; - struct mt792x_bss_conf *mconf; - unsigned long usable_links = ieee80211_vif_usable_links(vif); - struct mt76_wcid *wcid; - u8 link_id, ret; - - for_each_set_bit(link_id, &usable_links, IEEE80211_MLD_MAX_NUM_LINKS) { - mconf = mt792x_vif_to_link(mvif, link_id); - mlink = mt792x_sta_to_link(msta, link_id); - wcid = &mlink->wcid; - - ret = mt7925_mcu_sta_ba(&dev->mt76, &mconf->mt76, wcid, params, - enable, false); - if (ret < 0) - break; - } + struct mt792x_vif *mvif = msta->vif; - return ret; + return mt7925_mcu_sta_ba(&dev->mt76, &mvif->bss_conf.mt76, params, + enable, false); } static int mt7925_load_clc(struct mt792x_dev *dev, const char *fw_name) diff --git a/drivers/net/wireless/mediatek/mt76/mt7925/mt7925.h b/drivers/net/wireless/mediatek/mt76/mt7925/mt7925.h index 8707b5d04743..fd5f9d4ea4a7 100644 --- a/drivers/net/wireless/mediatek/mt76/mt7925/mt7925.h +++ b/drivers/net/wireless/mediatek/mt76/mt7925/mt7925.h @@ -263,11 +263,9 @@ int mt7925_mcu_set_beacon_filter(struct mt792x_dev *dev, struct ieee80211_vif *vif, bool enable); int mt7925_mcu_uni_tx_ba(struct mt792x_dev *dev, - struct ieee80211_vif *vif, struct ieee80211_ampdu_params *params, bool enable); int mt7925_mcu_uni_rx_ba(struct mt792x_dev *dev, - struct ieee80211_vif *vif, struct ieee80211_ampdu_params *params, bool enable); void mt7925_scan_work(struct work_struct *work); From patchwork Tue Jan 14 02:07:08 2025 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Sean Wang X-Patchwork-Id: 13938293 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 DB0CCC02184 for ; Tue, 14 Jan 2025 02:08: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=YtFuvbzeBTNVOBWO3ySJleq1Z7QhqifLZ+UmNMZ8jrQ=; b=M6ZVVu0rM5d2QXgLIYkTpDvRWs T1KhCz3AbQVmUsmG/ibEeZIuwNsMqkRtymqikKaqcZyuWsgOyciLeueQt+wzSfLOu/lZVrtCULLf5 54NVVuTEnO32f+wt4bOW2imWXGrr+QEWwL45O2e/QTpVMNU3oWR+mFzmJqQ8CTZrR8RIqr7kSWCv/ PUSyryRDNAgE+6D2TAUwdkrzgRG8SrP9D95/byja9xNc31Yd+c1Ckz+P8Azb0tZpQ0lver6oiUayw ruwFrLfZz55w3s7e5aKuH4OpPKCady5JIl1b6NETSODupETcCQ5SOqHIfEMP2sN8DIEIXiyGknhes Zgoissew==; Received: from localhost ([::1] helo=bombadil.infradead.org) by bombadil.infradead.org with esmtp (Exim 4.98 #2 (Red Hat Linux)) id 1tXWLg-00000007D2n-466F; Tue, 14 Jan 2025 02:08:08 +0000 Received: from mail-ot1-f45.google.com ([209.85.210.45]) by bombadil.infradead.org with esmtps (Exim 4.98 #2 (Red Hat Linux)) id 1tXWKw-00000007Cxl-2RQr for linux-mediatek@lists.infradead.org; Tue, 14 Jan 2025 02:07:23 +0000 Received: by mail-ot1-f45.google.com with SMTP id 46e09a7af769-71e15d9629bso1533469a34.1 for ; Mon, 13 Jan 2025 18:07:22 -0800 (PST) X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1736820441; x=1737425241; 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=YtFuvbzeBTNVOBWO3ySJleq1Z7QhqifLZ+UmNMZ8jrQ=; b=EoqQofZ3vf3hEbWvWNj95qfSumBdFfP7AbhgI1heGbEUuPaGbXCSyLa9DcYHw7QY/D tEwSB5O6qyY6zqT2Eu7ulIpPSggkGhq4NqiGk6RMHHIBPXO3OlcxbSyfPIM0Ei+vQ7nm pCrHk4tcj3JEbEXxEINulrWYZY0WlAXjbdet1NFQKo7uCyOPTxI0ksZfaBGPXzcc82FB 2ugbuBo01U/lD84q4W8Y5mLJ5Wt8JjnU9wcjgQG6TwGw0aWIw4s65DO9wKhgNXEakCru unHQtKpqNGDValrhVkZmeibiP7G9Kupn2wB46v/bdpW1d1dIcOQSpAoUjDuwfNnX9mlB uYKA== X-Forwarded-Encrypted: i=1; AJvYcCX04reVGz6wDDUNs49V1/2QiGqmLeFC6DoG2b56VvqWsM0n1cL0GiS0zKTSggvI6ioZGbaA55I7W6iXI46laQ==@lists.infradead.org X-Gm-Message-State: AOJu0Ywbr9etpWNxr0cuCfJM/avKT4T2iBQgQIwB9NUAyVfprNJB2jYx Y1vtOVkF9mK+6VctMaI6Qo8QtAS7H5ys1IdXBGY+1r3vaTsfNH6k X-Gm-Gg: ASbGncuTwLnml+otVk3asjfFGtPyWLVZlCNs9o8+cQj6e2OsXlHacDJt/FhMc7Ky3hN MuQW3YQiKdnULx2fRIXzqgjMuGuKKWXAM8mJW6ICydBWDKufP5L0frEZHFPcXTUyQWrENo7iy2R NNOkBvOi6yqiicKWvHnvjyFyXQuqy9mwIkRxPnZRe8JLEv0DZqnJm2jSqed43gv1W4lNtmQ5a1p sWG6UFyKRSINh/xnjQf2yQPYTP7VhEnPhI/zo6/b2r5gVPBFRDnqERm++XK26mNp8S9B0RQ9A== X-Google-Smtp-Source: AGHT+IHd5Kld9d0+YVuyqDqLcd2oa2ia62Q6ta0zrOvMzrIgUFpRMWwtfoHQSwdMtTatTt9OkenVdA== X-Received: by 2002:a05:6830:61c2:b0:71d:5f22:aff5 with SMTP id 46e09a7af769-721e2e23192mr15792855a34.10.1736820441541; Mon, 13 Jan 2025 18:07:21 -0800 (PST) Received: from sean-ThinkPad-T450s.lan ([207.191.35.252]) by smtp.gmail.com with ESMTPSA id 006d021491bc7-5f882755172sm3915340eaf.27.2025.01.13.18.07.18 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Mon, 13 Jan 2025 18:07:20 -0800 (PST) From: sean.wang@kernel.org To: nbd@nbd.name, lorenzo.bianconi@redhat.com Cc: sean.wang@mediatek.com, deren.wu@mediatek.com, mingyen.hsieh@mediatek.com, linux-wireless@vger.kernel.org, linux-mediatek@lists.infradead.org Subject: [PATCH v2 2/6] wifi: mt76: mt7925: fix the wrong link_idx when has p2p_device Date: Mon, 13 Jan 2025 18:07:08 -0800 Message-Id: <20250114020712.704254-2-sean.wang@kernel.org> X-Mailer: git-send-email 2.25.1 In-Reply-To: <20250114020712.704254-1-sean.wang@kernel.org> References: <20250114020712.704254-1-sean.wang@kernel.org> MIME-Version: 1.0 X-CRM114-Version: 20100106-BlameMichelson ( TRE 0.8.0 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20250113_180722_622146_6BF96E9B X-CRM114-Status: GOOD ( 13.92 ) 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: Ming Yen Hsieh When the p2p device and MLO station concurrent, the p2p device will occupy the wrong link_idx when the MLO secondary link is added. Fixes: e38a82d25b08 ("wifi: mt76: connac: Extend mt76_connac_mcu_uni_add_dev for MLO") Signed-off-by: Ming Yen Hsieh Signed-off-by: Sean Wang --- v2: generate the patch based on the latest mt76 tree --- drivers/net/wireless/mediatek/mt76/mt76.h | 1 + .../net/wireless/mediatek/mt76/mt76_connac_mcu.c | 4 ++-- drivers/net/wireless/mediatek/mt76/mt7925/main.c | 14 ++++++++++---- 3 files changed, 13 insertions(+), 6 deletions(-) diff --git a/drivers/net/wireless/mediatek/mt76/mt76.h b/drivers/net/wireless/mediatek/mt76/mt76.h index 132148f7b107..05651efb549e 100644 --- a/drivers/net/wireless/mediatek/mt76/mt76.h +++ b/drivers/net/wireless/mediatek/mt76/mt76.h @@ -769,6 +769,7 @@ struct mt76_testmode_data { struct mt76_vif_link { u8 idx; + u8 link_idx; u8 omac_idx; u8 band_idx; u8 wmm_idx; diff --git a/drivers/net/wireless/mediatek/mt76/mt76_connac_mcu.c b/drivers/net/wireless/mediatek/mt76/mt76_connac_mcu.c index f30cf9e71610..d0e49d68c5db 100644 --- a/drivers/net/wireless/mediatek/mt76/mt76_connac_mcu.c +++ b/drivers/net/wireless/mediatek/mt76/mt76_connac_mcu.c @@ -1168,7 +1168,7 @@ int mt76_connac_mcu_uni_add_dev(struct mt76_phy *phy, .tag = cpu_to_le16(DEV_INFO_ACTIVE), .len = cpu_to_le16(sizeof(struct req_tlv)), .active = enable, - .link_idx = mvif->idx, + .link_idx = mvif->link_idx, }, }; struct { @@ -1191,7 +1191,7 @@ int mt76_connac_mcu_uni_add_dev(struct mt76_phy *phy, .bmc_tx_wlan_idx = cpu_to_le16(wcid->idx), .sta_idx = cpu_to_le16(wcid->idx), .conn_state = 1, - .link_idx = mvif->idx, + .link_idx = mvif->link_idx, }, }; int err, idx, cmd, len; diff --git a/drivers/net/wireless/mediatek/mt76/mt7925/main.c b/drivers/net/wireless/mediatek/mt76/mt7925/main.c index 2082e3904d76..502b76a40ca8 100644 --- a/drivers/net/wireless/mediatek/mt76/mt7925/main.c +++ b/drivers/net/wireless/mediatek/mt76/mt7925/main.c @@ -360,10 +360,15 @@ static int mt7925_mac_link_bss_add(struct mt792x_dev *dev, struct mt76_txq *mtxq; int idx, ret = 0; - mconf->mt76.idx = __ffs64(~dev->mt76.vif_mask); - if (mconf->mt76.idx >= MT792x_MAX_INTERFACES) { - ret = -ENOSPC; - goto out; + if (vif->type == NL80211_IFTYPE_P2P_DEVICE) { + mconf->mt76.idx = MT792x_MAX_INTERFACES; + } else { + mconf->mt76.idx = __ffs64(~dev->mt76.vif_mask); + + if (mconf->mt76.idx >= MT792x_MAX_INTERFACES) { + ret = -ENOSPC; + goto out; + } } mconf->mt76.omac_idx = ieee80211_vif_is_mld(vif) ? @@ -371,6 +376,7 @@ static int mt7925_mac_link_bss_add(struct mt792x_dev *dev, mconf->mt76.band_idx = 0xff; mconf->mt76.wmm_idx = ieee80211_vif_is_mld(vif) ? 0 : mconf->mt76.idx % MT76_CONNAC_MAX_WMM_SETS; + mconf->mt76.link_idx = hweight16(mvif->valid_links); if (mvif->phy->mt76->chandef.chan->band != NL80211_BAND_2GHZ) mconf->mt76.basic_rates_idx = MT792x_BASIC_RATES_TBL + 4; From patchwork Tue Jan 14 02:07:09 2025 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Sean Wang X-Patchwork-Id: 13938296 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 4502FC02183 for ; Tue, 14 Jan 2025 02:08:10 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=lists.infradead.org; s=bombadil.20210309; h=Sender:List-Subscribe:List-Help :List-Post:List-Archive:List-Unsubscribe:List-Id:Content-Transfer-Encoding: MIME-Version:References:In-Reply-To:Message-Id:Date:Subject:Cc:To:From: Reply-To:Content-Type:Content-ID:Content-Description:Resent-Date:Resent-From: Resent-Sender:Resent-To:Resent-Cc:Resent-Message-ID:List-Owner; bh=TA4T2KfU8+8ccT6HhlEqhwR53p9U01ROTAG7I7Ipyeg=; b=RfqhBJHyvwGHzNuWFhsKt303cT TpP+aJHPxiV0ptCkYcYSuhikb6Hlyg8JOmL6EC/K9eV1RwC+w9LFijMzX1R3FnzXCDOo+FNppzRZe 03SORV20Agb4FChfju0kLTiFmdw7msUtRpWNsc2K9q1aTMk+2zn4f79+sTkCNp9QJPgfiad1FBow3 48SdBVYXHEIpv6701wZQoxY1C+Zo5Oa9LDyy5S9eWC/SvC8Os/surheORSMi1g2vSzgRG+dSXW3RJ Qcjo3u2TsuOzaIVnlZJ4bi3TdU6Inm0SVaV6ROVisemi1jd9DCH1phSgWkLMpuji1T9duwKshGHBM z8EP2NeQ==; Received: from localhost ([::1] helo=bombadil.infradead.org) by bombadil.infradead.org with esmtp (Exim 4.98 #2 (Red Hat Linux)) id 1tXWLh-00000007D37-1MMC; Tue, 14 Jan 2025 02:08:09 +0000 Received: from mail-ot1-f41.google.com ([209.85.210.41]) by bombadil.infradead.org with esmtps (Exim 4.98 #2 (Red Hat Linux)) id 1tXWKy-00000007Cye-1j5N for linux-mediatek@lists.infradead.org; Tue, 14 Jan 2025 02:07:25 +0000 Received: by mail-ot1-f41.google.com with SMTP id 46e09a7af769-71e2bb84fe3so2688571a34.1 for ; Mon, 13 Jan 2025 18:07:24 -0800 (PST) X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1736820443; x=1737425243; 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=TA4T2KfU8+8ccT6HhlEqhwR53p9U01ROTAG7I7Ipyeg=; b=CY9QeC8Bm9yYo9niq7HHiLMteYdtxagxWAww6OM/9AGRkaJQjWDXfAgzhl+4So6h63 MeSqzC1iPtUAi3iHa2L6T5ADBN2kMHiMLCKuW+3OjZu3kvAAFMV8FBeAWoXSUrq26K8b mo5JMPL94WEg2UievRX9GaOX9oAULmR+gceisEja7EYJP0bOHwfe2iebqjLmM5rnCxh8 CnePghQNF3O1V5ltnCKGqP/OBjnzSMnZw0aUSjX9skFrm0mbUJzxHlDvSgZ9+EUv1X1+ RpElDNuJ+lpfbmIUfhEnThIZYUbq+lZwhnyAerl5Y24YdoKCF/zO5f2tXC5BtDZBjCVC W6Pw== X-Forwarded-Encrypted: i=1; AJvYcCWrpHeNVwB+GkiqROTZhS4t6CHL9pNiXBLd9w/7fc5Z2x+EbrzYkVgCNUJs93BnwNfE4t+RRC++UhHjVU3umg==@lists.infradead.org X-Gm-Message-State: AOJu0YzeeZxpKQZW1moJFMStLi5yjTxCqt6afjaG/PNFPC7nAkCn2d5C EYR6h3zH5VkVDwgX7V+P6TWDLco4NStaPAypdC3La8i+zbP0BSkj X-Gm-Gg: ASbGncsjXh1+PG1e9NXo6Taw1vBDMRJqXfCkfV+Wq5BilF/1E7fSgYy2CJcjo6F+vIW q4efOqX+qM+GgPT9ENRvzBzZfjfpZxggBtGCF7GDSJVhiDfMdTucdChY1jKUzoqu+uuG7TUHU2/ VXOm4mSdikGtEoYwHtSoT7h6KtXsf4Uwgf2nuCxWN4R//9a8nkUWmTmG5cmx4sHSUNiLI/K35fN 6C/N6WczgNOOUcw7u2au+SY61K+Kzj29gp96t/hKyQNHfbJDjiKLXFr6XSGdX5fptaaqj8j+g== X-Google-Smtp-Source: AGHT+IGFJEik2Ut15igezSRRJrQUvQBJOtShMMBcJALZhBQ9x7GaTRWakkwrOGbF5TScoAJnl3VflQ== X-Received: by 2002:a05:6830:3748:b0:71e:1b44:35c5 with SMTP id 46e09a7af769-721e2e7966bmr15611503a34.18.1736820443561; Mon, 13 Jan 2025 18:07:23 -0800 (PST) Received: from sean-ThinkPad-T450s.lan ([207.191.35.252]) by smtp.gmail.com with ESMTPSA id 006d021491bc7-5f882755172sm3915340eaf.27.2025.01.13.18.07.21 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Mon, 13 Jan 2025 18:07:22 -0800 (PST) From: sean.wang@kernel.org To: nbd@nbd.name, lorenzo.bianconi@redhat.com Cc: sean.wang@mediatek.com, deren.wu@mediatek.com, mingyen.hsieh@mediatek.com, linux-wireless@vger.kernel.org, linux-mediatek@lists.infradead.org Subject: [PATCH v2 3/6] wifi: mt76: mt7925: fix the wrong simultaneous cap for MLO Date: Mon, 13 Jan 2025 18:07:09 -0800 Message-Id: <20250114020712.704254-3-sean.wang@kernel.org> X-Mailer: git-send-email 2.25.1 In-Reply-To: <20250114020712.704254-1-sean.wang@kernel.org> References: <20250114020712.704254-1-sean.wang@kernel.org> MIME-Version: 1.0 X-CRM114-Version: 20100106-BlameMichelson ( TRE 0.8.0 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20250113_180724_449068_14E88D79 X-CRM114-Status: GOOD ( 10.46 ) 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: Ming Yen Hsieh The mt7925 chip is only support a single radio, so the maximum number of simultaneous should be 0. Fixes: 86c051f2c418 ("wifi: mt76: mt7925: enabling MLO when the firmware supports it") Signed-off-by: Ming Yen Hsieh Signed-off-by: Sean Wang --- v2: generate the patch based on the latest mt76 tree --- drivers/net/wireless/mediatek/mt76/mt7925/main.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/drivers/net/wireless/mediatek/mt76/mt7925/main.c b/drivers/net/wireless/mediatek/mt76/mt7925/main.c index 502b76a40ca8..90a6d62aa816 100644 --- a/drivers/net/wireless/mediatek/mt76/mt7925/main.c +++ b/drivers/net/wireless/mediatek/mt76/mt7925/main.c @@ -256,7 +256,7 @@ int mt7925_init_mlo_caps(struct mt792x_phy *phy) 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); + u16_encode_bits(0, IEEE80211_MLD_CAP_OP_MAX_SIMUL_LINKS); wiphy->flags |= WIPHY_FLAG_SUPPORTS_MLO; wiphy->iftype_ext_capab = ext_capab; From patchwork Tue Jan 14 02:07:10 2025 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Sean Wang X-Patchwork-Id: 13938295 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 862B9C02185 for ; Tue, 14 Jan 2025 02:08:10 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=lists.infradead.org; s=bombadil.20210309; h=Sender:List-Subscribe:List-Help :List-Post:List-Archive:List-Unsubscribe:List-Id:Content-Transfer-Encoding: MIME-Version:References:In-Reply-To:Message-Id:Date:Subject:Cc:To:From: Reply-To:Content-Type:Content-ID:Content-Description:Resent-Date:Resent-From: Resent-Sender:Resent-To:Resent-Cc:Resent-Message-ID:List-Owner; bh=8Z5nZ9Qy6TBKcXoruppicIm/anRrncBfElUKQXmiVQU=; b=znICQBrkL7Hpaweivh//YuXVUZ dnCjxmTmkDbZ2hgIlIoyKCnivk1dDVyYyGnDtgaWloV5kblaRjPXxv7SMHlN6AULjNMmJEz7mSNI6 0GmT4IJwB+gL7MheZ/buIvsFrm8KSmxch+aw/z8XWjv/xchBepOXSRVES2TnHUjwfPlD9YsukP/tE 6g69PAWMaCW1LOpSWe4S8yPpFepkhEYyh75S6E66uvQi40ow6Xhng56jqcPbSwi35afVsqL04SuZl X6B+uwZqNq9gmxy62QBvMKuDgGpnk8dkqVhbqrHiSnKFJyPNiVPJypeUbDi6qjasOn+/vtFVjlIK9 Me6rsZZw==; Received: from localhost ([::1] helo=bombadil.infradead.org) by bombadil.infradead.org with esmtp (Exim 4.98 #2 (Red Hat Linux)) id 1tXWLh-00000007D3Y-2h0o; Tue, 14 Jan 2025 02:08:09 +0000 Received: from mail-oi1-f171.google.com ([209.85.167.171]) by bombadil.infradead.org with esmtps (Exim 4.98 #2 (Red Hat Linux)) id 1tXWL2-00000007Cz8-0sRE for linux-mediatek@lists.infradead.org; Tue, 14 Jan 2025 02:07:29 +0000 Received: by mail-oi1-f171.google.com with SMTP id 5614622812f47-3eb7ecc3c54so2595476b6e.0 for ; Mon, 13 Jan 2025 18:07:27 -0800 (PST) X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1736820447; x=1737425247; 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=8Z5nZ9Qy6TBKcXoruppicIm/anRrncBfElUKQXmiVQU=; b=Rj+QRpPGdeHpiEHVaDhI+JWryakArjC1fLlMAYO/dnhU85atNuf3yroYeFi24dBBZz DW7zLeugE/E2sORmPlWNN7TUQTBQ8mYVFpFjdvuu8Kt2wFvyksie0soSiid87jL7JZv0 rmhq/xScOLE5byuIWGwmd5ZABiO3omDYH21ClibORjNLG98Fysb3cdofh+Sjaga8AMQZ Kxn74LGcBJAXBvwRhGc14Snvgh/v/O49hVtYS+BaZofnh6Nj+7xTxUXHi8yS0BeWp1uR UA3LG5rywXV9lYbw+1in5AuEVG1Viuh16VkpMPxNehR/wdUPrMOamABG+PWNv22l1VsH IYyA== X-Forwarded-Encrypted: i=1; AJvYcCWr4OL0U4f5WrJ2FBwRU1gzrc7WEgbdpIsauXfb/qMU3P7bORoxTq2K22dhM5VeLXC6AeUwjCDsvcYdsFt9AA==@lists.infradead.org X-Gm-Message-State: AOJu0YyKPqKnGwiGko+0RB8o+DSTafr+A/3JEs0jvVdUob1HXWIQBgPk E3bA2WLJyfxl4QOMYqt3DgNrKQXhn5RQaoXwOjVyMYjJ1+9CtFwIONzkzuri X-Gm-Gg: ASbGncuaAQCSigugw8mFbk6Xwrdo2LirhHfnlQONFbWVgh5EpM08YyAqTWCHBvoY/8F b34GVbJOUydXj0dRScYoHZZHAFPqziiwbNAKS4NaQsOpXpyMJbt7QFansEMFesdKDc083kb0s02 UoeIx5qYgO5TJp9pT3o15hQ+YEWd+y31ek5Zyqhb/OgX2UcsV6ImNTbaAs2WJ0GmYzUPIuGQQid vIiY9iA40/qgoKYoop3XLIApvAPPye5iMNemCYNTbFBIRzNf2ixDSkXKN6EsrzUqult0oAuvA== X-Google-Smtp-Source: AGHT+IFPnxxgbKjlJbwdgjkdDZ23zr97Zrq/9q+Ux+jFcDA4w58GsYGswXUPdk/KqYG0HgtKz1Q0yw== X-Received: by 2002:a05:6808:350b:b0:3e8:1f5d:b804 with SMTP id 5614622812f47-3ef2ec96cdcmr12856369b6e.15.1736820447188; Mon, 13 Jan 2025 18:07:27 -0800 (PST) Received: from sean-ThinkPad-T450s.lan ([207.191.35.252]) by smtp.gmail.com with ESMTPSA id 006d021491bc7-5f882755172sm3915340eaf.27.2025.01.13.18.07.24 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Mon, 13 Jan 2025 18:07:25 -0800 (PST) From: sean.wang@kernel.org To: nbd@nbd.name, lorenzo.bianconi@redhat.com Cc: sean.wang@mediatek.com, deren.wu@mediatek.com, mingyen.hsieh@mediatek.com, linux-wireless@vger.kernel.org, linux-mediatek@lists.infradead.org Subject: [PATCH v2 4/6] wifi: mt76: mt7925: adjust rm BSS flow to prevent next connection failure Date: Mon, 13 Jan 2025 18:07:10 -0800 Message-Id: <20250114020712.704254-4-sean.wang@kernel.org> X-Mailer: git-send-email 2.25.1 In-Reply-To: <20250114020712.704254-1-sean.wang@kernel.org> References: <20250114020712.704254-1-sean.wang@kernel.org> MIME-Version: 1.0 X-CRM114-Version: 20100106-BlameMichelson ( TRE 0.8.0 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20250113_180728_247683_8B98F374 X-CRM114-Status: GOOD ( 13.30 ) 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: Ming Yen Hsieh Removing BSS without removing STAREC first will cause firmware abnormal and next connection fail. Fixes: f8797298565e ("wifi: mt76: mt7925: Cleanup MLO settings post-disconnection") Signed-off-by: Ming Yen Hsieh Signed-off-by: Sean Wang --- v2: generate the patch based on the latest mt76 tree --- .../net/wireless/mediatek/mt76/mt7925/main.c | 45 +++++++++++++++---- 1 file changed, 36 insertions(+), 9 deletions(-) diff --git a/drivers/net/wireless/mediatek/mt76/mt7925/main.c b/drivers/net/wireless/mediatek/mt76/mt7925/main.c index 90a6d62aa816..07e5c1a6d5d5 100644 --- a/drivers/net/wireless/mediatek/mt76/mt7925/main.c +++ b/drivers/net/wireless/mediatek/mt76/mt7925/main.c @@ -1155,7 +1155,12 @@ static void mt7925_mac_link_sta_remove(struct mt76_dev *mdev, struct mt792x_bss_conf *mconf; mconf = mt792x_link_conf_to_mconf(link_conf); - mt792x_mac_link_bss_remove(dev, mconf, mlink); + + if (ieee80211_vif_is_mld(vif)) + mt792x_mac_link_bss_remove(dev, mconf, mlink); + else + mt7925_mcu_add_bss_info(&dev->phy, mconf->mt76.ctx, link_conf, + link_sta, false); } spin_lock_bh(&mdev->sta_poll_lock); @@ -1175,6 +1180,31 @@ mt7925_mac_sta_remove_links(struct mt792x_dev *dev, struct ieee80211_vif *vif, struct mt76_wcid *wcid; unsigned int link_id; + /* clean up bss before starec */ + for_each_set_bit(link_id, &old_links, IEEE80211_MLD_MAX_NUM_LINKS) { + struct ieee80211_link_sta *link_sta; + struct ieee80211_bss_conf *link_conf; + struct mt792x_bss_conf *mconf; + 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; + + link_conf = mt792x_vif_to_bss_conf(vif, link_id); + if (!link_conf) + continue; + + mconf = mt792x_link_conf_to_mconf(link_conf); + + mt7925_mcu_add_bss_info(&dev->phy, mconf->mt76.ctx, link_conf, + link_sta, false); + } + for_each_set_bit(link_id, &old_links, IEEE80211_MLD_MAX_NUM_LINKS) { struct ieee80211_link_sta *link_sta; struct mt792x_link_sta *mlink; @@ -1212,6 +1242,7 @@ void mt7925_mac_sta_remove(struct mt76_dev *mdev, struct ieee80211_vif *vif, { struct mt792x_dev *dev = container_of(mdev, struct mt792x_dev, mt76); struct mt792x_sta *msta = (struct mt792x_sta *)sta->drv_priv; + struct mt792x_vif *mvif = (struct mt792x_vif *)vif->drv_priv; struct { struct { u8 omac_idx; @@ -1242,14 +1273,10 @@ void mt7925_mac_sta_remove(struct mt76_dev *mdev, struct ieee80211_vif *vif, mt7925_mac_sta_remove_links(dev, vif, sta, rem); - if (ieee80211_vif_is_mld(vif)) { - mt7925_mcu_set_dbdc(&dev->mphy, false); - - /* recovery omac address for the legacy interface */ - memcpy(dev_req.tlv.omac_addr, vif->addr, ETH_ALEN); - mt76_mcu_send_msg(mdev, MCU_UNI_CMD(DEV_INFO_UPDATE), - &dev_req, sizeof(dev_req), true); - } + /* recovery omac address for the legacy interface */ + memcpy(dev_req.tlv.omac_addr, vif->addr, ETH_ALEN); + mt76_mcu_send_msg(mdev, MCU_UNI_CMD(DEV_INFO_UPDATE), + &dev_req, sizeof(dev_req), true); if (vif->type == NL80211_IFTYPE_STATION) { struct mt792x_vif *mvif = (struct mt792x_vif *)vif->drv_priv; From patchwork Tue Jan 14 02:07:11 2025 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Sean Wang X-Patchwork-Id: 13938294 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 E3957C02186 for ; Tue, 14 Jan 2025 02:08:10 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=lists.infradead.org; s=bombadil.20210309; h=Sender:List-Subscribe:List-Help :List-Post:List-Archive:List-Unsubscribe:List-Id:Content-Transfer-Encoding: MIME-Version:References:In-Reply-To:Message-Id:Date:Subject:Cc:To:From: Reply-To:Content-Type:Content-ID:Content-Description:Resent-Date:Resent-From: Resent-Sender:Resent-To:Resent-Cc:Resent-Message-ID:List-Owner; bh=IFXCH5TGHGDDGFUTwj/Hv5bd0CEyH7LmcN4nsFXhtFk=; b=VQwens93gVXeKBsCGxU4gZrsKf dqKbqe8HAPG1ngnBUGyB6A6jrk1bNt5mwrvDEgPbpTIJZFYpW1I5GGPEcBVG1qsLdT2F9GaD98irK 4IN+x63UOFULvklajC+ARrAvYhONFaJFC9HRUFyKdBewICuH9Vw9jMSvVumb7hI+4K0tmv9OIaGuk uzcBO9qIXPdBsK6dH89wk3kn6xgTHPjyxor4lITL8c4vnMdWh/Fp5h/NbS1PxYy/BEVZdLnlVE2ZX QNturgaz2W/t0DQ09bWnEGINfk/bzJMc6yAsg1QCJXq2v2k8YruYqC7VIrWQZ4IJHs49YXHVeucw5 aZy1WwaQ==; Received: from localhost ([::1] helo=bombadil.infradead.org) by bombadil.infradead.org with esmtp (Exim 4.98 #2 (Red Hat Linux)) id 1tXWLh-00000007D3z-44M1; Tue, 14 Jan 2025 02:08:09 +0000 Received: from mail-oo1-f41.google.com ([209.85.161.41]) by bombadil.infradead.org with esmtps (Exim 4.98 #2 (Red Hat Linux)) id 1tXWL5-00000007Czj-1wZ9 for linux-mediatek@lists.infradead.org; Tue, 14 Jan 2025 02:07:32 +0000 Received: by mail-oo1-f41.google.com with SMTP id 006d021491bc7-5f31841c6f6so2350835eaf.0 for ; Mon, 13 Jan 2025 18:07:31 -0800 (PST) X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1736820451; x=1737425251; 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=IFXCH5TGHGDDGFUTwj/Hv5bd0CEyH7LmcN4nsFXhtFk=; b=MmOsN5un7HTjvMqOYgzO6lbmT9S/RJQ0xXCm0dpb2ryzeuWVOlIVyK35ITdu7iZCSb 59sA3ko/36ZDbyojIw5Q/qjwqY0q9DVkhdmP4hgUCrQAbIjFpEGSdXtrlBKzoad0zRQD N8Ze0O3qc64UFzA/KQ/EqvAk8KIwNK8Y8ZL7GaBuG53uDQD20at1pb8lRWVf3aoTGQ/Q o+egASjZmuIp0V3Eu1ORsC/JWdRbczb6sIqFB9lp1UrQCdh65+hHvSvMdP5QBDYM9lF7 jdDPfvXWX7ZY1f85u2SzCKzFSkuKj4ZRsF05NppDRmNuzEqOfCKXMuQeJa449qUuF4FZ 3t3A== X-Forwarded-Encrypted: i=1; AJvYcCWdbPcDXHxu9sjMU3ng/Oj9ERFS2aq6tStxCawEs58r6kuHnBaXqwYyKIn+5wWuv5ZIsIpe+8SO/7/jK177zg==@lists.infradead.org X-Gm-Message-State: AOJu0YxlnJbBz9Kg78oepK+AtmpDYU3mUTW2NGHJKO84j4pi3znsY/E8 bRMHfIUlCU20JVhxgoMA48oaHo32EZ9oScGe+NH8GzEpjE6RVpS1wbB2KBAU X-Gm-Gg: ASbGnctnmhHrwY8F/hehYbcz0iDQI8eT45tuwc608UZiMglLG5VIL6keKTKvFS5sNvl bMcD3w1hM3WHrqjpSODsF+sGknpeRvialp2DordoqoKW29mWuNRDvABi6vxzgoPqyWnicXrjr4G n1Txrq6uhR1HK29yI8EIcccFsfUToEx26A5rUcQEcgkQntTVafWebIRnJtkqUedjTe5x1U78zYX 6IxpqIzsmEVQ0OpZodD+BKaMvQGyMsg2x1fMMHnmVfWlZ5winCHOxo8j0uySQ2EVYnIoB3A1Q== X-Google-Smtp-Source: AGHT+IHyBRGCjRrWK9gKiZPubfswmZcfYLk4XED6ZZc435DX/3BAuAAebMsGzbgjSLwJ+fCyZrcXjw== X-Received: by 2002:a05:6820:1b0d:b0:5f8:8917:b6fc with SMTP id 006d021491bc7-5f88917b7e3mr10727061eaf.1.1736820450742; Mon, 13 Jan 2025 18:07:30 -0800 (PST) Received: from sean-ThinkPad-T450s.lan ([207.191.35.252]) by smtp.gmail.com with ESMTPSA id 006d021491bc7-5f882755172sm3915340eaf.27.2025.01.13.18.07.28 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Mon, 13 Jan 2025 18:07:29 -0800 (PST) From: sean.wang@kernel.org To: nbd@nbd.name, lorenzo.bianconi@redhat.com Cc: sean.wang@mediatek.com, deren.wu@mediatek.com, mingyen.hsieh@mediatek.com, linux-wireless@vger.kernel.org, linux-mediatek@lists.infradead.org Subject: [PATCH v2 5/6] wifi: mt76: mt7925: integrate *mlo_sta_cmd and *sta_cmd Date: Mon, 13 Jan 2025 18:07:11 -0800 Message-Id: <20250114020712.704254-5-sean.wang@kernel.org> X-Mailer: git-send-email 2.25.1 In-Reply-To: <20250114020712.704254-1-sean.wang@kernel.org> References: <20250114020712.704254-1-sean.wang@kernel.org> MIME-Version: 1.0 X-CRM114-Version: 20100106-BlameMichelson ( TRE 0.8.0 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20250113_180731_500994_ADD9575A X-CRM114-Status: GOOD ( 11.22 ) X-BeenThere: linux-mediatek@lists.infradead.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Sender: "Linux-mediatek" Errors-To: linux-mediatek-bounces+linux-mediatek=archiver.kernel.org@lists.infradead.org From: Ming Yen Hsieh Integrate *mlo_sta_cmd and *sta_cmd for the MLO firmware. Fixes: 86c051f2c418 ("wifi: mt76: mt7925: enabling MLO when the firmware supports it") Signed-off-by: Ming Yen Hsieh igned-off-by: Sean Wang --- v2: generate the patch based on the latest mt76 tree --- .../net/wireless/mediatek/mt76/mt7925/mcu.c | 64 ++----------------- 1 file changed, 4 insertions(+), 60 deletions(-) diff --git a/drivers/net/wireless/mediatek/mt76/mt7925/mcu.c b/drivers/net/wireless/mediatek/mt76/mt7925/mcu.c index d1506ee977a4..38a29a1a1a66 100644 --- a/drivers/net/wireless/mediatek/mt76/mt7925/mcu.c +++ b/drivers/net/wireless/mediatek/mt76/mt7925/mcu.c @@ -1818,49 +1818,6 @@ mt7925_mcu_sta_mld_tlv(struct sk_buff *skb, } } -static int -mt7925_mcu_sta_cmd(struct mt76_phy *phy, - struct mt76_sta_cmd_info *info) -{ - struct mt76_vif_link *mvif = (struct mt76_vif_link *)info->vif->drv_priv; - struct mt76_dev *dev = phy->dev; - struct sk_buff *skb; - int conn_state; - - skb = __mt76_connac_mcu_alloc_sta_req(dev, mvif, info->wcid, - MT7925_STA_UPDATE_MAX_SIZE); - if (IS_ERR(skb)) - return PTR_ERR(skb); - - conn_state = info->enable ? CONN_STATE_PORT_SECURE : - CONN_STATE_DISCONNECT; - if (info->link_sta) - mt76_connac_mcu_sta_basic_tlv(dev, skb, info->link_conf, - info->link_sta, - conn_state, info->newly); - if (info->link_sta && info->enable) { - mt7925_mcu_sta_phy_tlv(skb, info->vif, info->link_sta); - mt7925_mcu_sta_ht_tlv(skb, info->link_sta); - mt7925_mcu_sta_vht_tlv(skb, info->link_sta); - mt76_connac_mcu_sta_uapsd(skb, info->vif, info->link_sta->sta); - mt7925_mcu_sta_amsdu_tlv(skb, info->vif, info->link_sta); - mt7925_mcu_sta_he_tlv(skb, info->link_sta); - mt7925_mcu_sta_he_6g_tlv(skb, info->link_sta); - mt7925_mcu_sta_eht_tlv(skb, info->link_sta); - mt7925_mcu_sta_rate_ctrl_tlv(skb, info->vif, - info->link_sta); - mt7925_mcu_sta_state_v2_tlv(phy, skb, info->link_sta, - info->vif, info->rcpi, - info->state); - mt7925_mcu_sta_mld_tlv(skb, info->vif, info->link_sta->sta); - } - - if (info->enable) - mt7925_mcu_sta_hdr_trans_tlv(skb, info->vif, info->link_sta); - - return mt76_mcu_skb_send_msg(dev, skb, info->cmd, true); -} - static void mt7925_mcu_sta_remove_tlv(struct sk_buff *skb) { @@ -1873,8 +1830,8 @@ mt7925_mcu_sta_remove_tlv(struct sk_buff *skb) } static int -mt7925_mcu_mlo_sta_cmd(struct mt76_phy *phy, - struct mt76_sta_cmd_info *info) +mt7925_mcu_sta_cmd(struct mt76_phy *phy, + struct mt76_sta_cmd_info *info) { struct mt792x_vif *mvif = (struct mt792x_vif *)info->vif->drv_priv; struct mt76_dev *dev = phy->dev; @@ -1888,12 +1845,10 @@ mt7925_mcu_mlo_sta_cmd(struct mt76_phy *phy, if (IS_ERR(skb)) return PTR_ERR(skb); - if (info->enable) + if (info->enable && info->link_sta) { mt76_connac_mcu_sta_basic_tlv(dev, skb, info->link_conf, info->link_sta, info->enable, info->newly); - - if (info->enable && info->link_sta) { mt7925_mcu_sta_phy_tlv(skb, info->vif, info->link_sta); mt7925_mcu_sta_ht_tlv(skb, info->link_sta); mt7925_mcu_sta_vht_tlv(skb, info->link_sta); @@ -1944,7 +1899,6 @@ int mt7925_mcu_sta_update(struct mt792x_dev *dev, }; struct mt792x_sta *msta; struct mt792x_link_sta *mlink; - int err; if (link_sta) { msta = (struct mt792x_sta *)link_sta->sta->drv_priv; @@ -1952,17 +1906,7 @@ int mt7925_mcu_sta_update(struct mt792x_dev *dev, } info.wcid = link_sta ? &mlink->wcid : &mvif->sta.deflink.wcid; - if (link_sta) - info.newly = state != MT76_STA_INFO_STATE_ASSOC; - else - info.newly = state == MT76_STA_INFO_STATE_ASSOC ? false : true; - - if (ieee80211_vif_is_mld(vif)) - err = mt7925_mcu_mlo_sta_cmd(&dev->mphy, &info); - else - err = mt7925_mcu_sta_cmd(&dev->mphy, &info); - - return err; + return mt7925_mcu_sta_cmd(&dev->mphy, &info); } int mt7925_mcu_set_beacon_filter(struct mt792x_dev *dev, From patchwork Tue Jan 14 02:07:12 2025 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Sean Wang X-Patchwork-Id: 13938297 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 4A110C02187 for ; Tue, 14 Jan 2025 02:08: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=qAFvRSI6KUOifB1Mi3IpomlOOrHuk58k3cEKclUqi60=; b=Imn++wg1p9O+RMbOUL9JCVR/2O M5UQu0+TMxpnA8qS+b9BY+fOWvGIk/6V+oRfrX8EW4d2GrXY5CQ+jHlfnA+M6LxrC5k267nMt0Fdg RSZx7xbXq0q3uQbvlN+3X/YUIzly+fB5FQr+K23sdvnitkXoiujIRVV6mGWbeB3rPDILHYaLNgmJL rJ7NmH5e084ZTJMd2zgy9rkLnjXWZyG1LhjqtSlpxfNMsqPcyfgmprYapykg3pqnFQst7udKClfMc KICnAHAKZr6f3p/x156Pvf7SAI78NGuV9ywOTiviC0I7BOWAUetOfOgxnaW1RAyk5kT7X/tL/B/ZH JnzNquZA==; Received: from localhost ([::1] helo=bombadil.infradead.org) by bombadil.infradead.org with esmtp (Exim 4.98 #2 (Red Hat Linux)) id 1tXWLi-00000007D4P-1KhP; Tue, 14 Jan 2025 02:08:10 +0000 Received: from mail-ot1-f51.google.com ([209.85.210.51]) by bombadil.infradead.org with esmtps (Exim 4.98 #2 (Red Hat Linux)) id 1tXWL9-00000007D0G-1Fnu for linux-mediatek@lists.infradead.org; Tue, 14 Jan 2025 02:07:36 +0000 Received: by mail-ot1-f51.google.com with SMTP id 46e09a7af769-71e1b1767b3so2662991a34.3 for ; Mon, 13 Jan 2025 18:07:35 -0800 (PST) X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1736820454; x=1737425254; 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=qAFvRSI6KUOifB1Mi3IpomlOOrHuk58k3cEKclUqi60=; b=EyZPQEiK6HMEuovOa1QqbMUfGnhx5Qc9YixCWUxxOOSzm4J2zhUL8a/hTkhIYpWCaU s87y21E1/GPdTVtTsczY46os8KOUG0iXvouU3m52FIwLT17jsSuSllf6P7HQxn09Z/eU K64iyY5b0zbBgy3+LoxR75aaOHlD/bOtFb82MGbj4grsTucIbPV+rS8wTRTslnN6acGD +BE8Jzk3K3/FfRfyIHqp7/FgS7pxA5FmpR/Gkso1+8CjwsykV08i8TyeSyu9+j7R/8qR hHZF13Q1Udgk2gsthYk42pNwDJfkeU1/UgpT41iiwaVDDQuFly0vesygfjWQpp21nK7j V77Q== X-Forwarded-Encrypted: i=1; AJvYcCVpxJBQ+hbC2jcA/UDUTu58O06eEd3NxFbQKIE2Q0ugnkNqhsIpGb+CJjgBphp12IOi+sPACHMuC60OaGw03g==@lists.infradead.org X-Gm-Message-State: AOJu0YyxCsXSfYIWatBBqrN/P424FvXr8pE8X+sNCjyFnbghVBqq4Jx2 QP7gS27dRhfwyJ1+8VG70eXO2Yiwh1lnt6cgnD6IVWwolOrSnMmA X-Gm-Gg: ASbGncs5dmg6Vs1oaAWH0zd2Jr+cDTNaXaj05SVEooYaC3OCWlySFKJ53wUvWM4cLBR xvxwS4FwmHaNZS3UKgqoXLW7UH2hZ6VjF9HaR35sf0cLGX3BQ39/f03Gzdtm455GvTXUIqna77d vT4LFiDJDypMmIo2DnAMGGEfXN8CsoDsYkxZ3a8T5LuK2oD880QLTCclENHe2kpjytEI7QaRAQH Srsxypur3rkNNtAqiH+jEJ00MZiGo5RAJgAbo0qDNWBnDO9E5PRivvv9CiD4OCGL47Gl+LE2g== X-Google-Smtp-Source: AGHT+IFjDi5J9hUEA72Jlvdihlar6QxaFWy8rUuil5dFauMav65dN9TFe89jrIIz7Uhr/G2MVCahhQ== X-Received: by 2002:a05:6830:6405:b0:71e:4fc:6ee1 with SMTP id 46e09a7af769-721e2e3a547mr16525548a34.9.1736820454411; Mon, 13 Jan 2025 18:07:34 -0800 (PST) Received: from sean-ThinkPad-T450s.lan ([207.191.35.252]) by smtp.gmail.com with ESMTPSA id 006d021491bc7-5f882755172sm3915340eaf.27.2025.01.13.18.07.31 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Mon, 13 Jan 2025 18:07:32 -0800 (PST) From: sean.wang@kernel.org To: nbd@nbd.name, lorenzo.bianconi@redhat.com Cc: sean.wang@mediatek.com, deren.wu@mediatek.com, mingyen.hsieh@mediatek.com, linux-wireless@vger.kernel.org, linux-mediatek@lists.infradead.org Subject: [PATCH v2 6/6] wifi: mt76: mt7925: update the power-saving flow Date: Mon, 13 Jan 2025 18:07:12 -0800 Message-Id: <20250114020712.704254-6-sean.wang@kernel.org> X-Mailer: git-send-email 2.25.1 In-Reply-To: <20250114020712.704254-1-sean.wang@kernel.org> References: <20250114020712.704254-1-sean.wang@kernel.org> MIME-Version: 1.0 X-CRM114-Version: 20100106-BlameMichelson ( TRE 0.8.0 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20250113_180735_339094_9D5DD61E X-CRM114-Status: GOOD ( 17.25 ) X-BeenThere: linux-mediatek@lists.infradead.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Sender: "Linux-mediatek" Errors-To: linux-mediatek-bounces+linux-mediatek=archiver.kernel.org@lists.infradead.org From: Ming Yen Hsieh After joining MLO, ensure that all links are setup before enabling power-saving. Fixes: 86c051f2c418 ("wifi: mt76: mt7925: enabling MLO when the firmware supports it") Signed-off-by: Ming Yen Hsieh Signed-off-by: Sean Wang --- v2: generate the patch based on the latest mt76 tree --- .../net/wireless/mediatek/mt76/mt7925/init.c | 1 + .../net/wireless/mediatek/mt76/mt7925/main.c | 65 ++++++++++++++++--- .../wireless/mediatek/mt76/mt7925/mt7925.h | 1 + drivers/net/wireless/mediatek/mt76/mt792x.h | 9 +++ 4 files changed, 67 insertions(+), 9 deletions(-) diff --git a/drivers/net/wireless/mediatek/mt76/mt7925/init.c b/drivers/net/wireless/mediatek/mt76/mt7925/init.c index f41ca4248497..a2bb36dab231 100644 --- a/drivers/net/wireless/mediatek/mt76/mt7925/init.c +++ b/drivers/net/wireless/mediatek/mt76/mt7925/init.c @@ -244,6 +244,7 @@ int mt7925_register_device(struct mt792x_dev *dev) dev->mt76.tx_worker.fn = mt792x_tx_worker; INIT_DELAYED_WORK(&dev->pm.ps_work, mt792x_pm_power_save_work); + INIT_DELAYED_WORK(&dev->mlo_pm_work, mt7925_mlo_pm_work); INIT_WORK(&dev->pm.wake_work, mt792x_pm_wake_work); spin_lock_init(&dev->pm.wake.lock); mutex_init(&dev->pm.mutex); diff --git a/drivers/net/wireless/mediatek/mt76/mt7925/main.c b/drivers/net/wireless/mediatek/mt76/mt7925/main.c index 07e5c1a6d5d5..4d8b4272e147 100644 --- a/drivers/net/wireless/mediatek/mt76/mt7925/main.c +++ b/drivers/net/wireless/mediatek/mt76/mt7925/main.c @@ -427,6 +427,7 @@ mt7925_add_interface(struct ieee80211_hw *hw, struct ieee80211_vif *vif) mvif->bss_conf.vif = mvif; mvif->sta.vif = mvif; mvif->deflink_id = IEEE80211_LINK_UNSPECIFIED; + mvif->mlo_pm_state = MT792x_MLO_LINK_DISASSOC; ret = mt7925_mac_link_bss_add(dev, &vif->bss_conf, &mvif->sta.deflink); if (ret < 0) @@ -1284,6 +1285,8 @@ void mt7925_mac_sta_remove(struct mt76_dev *mdev, struct ieee80211_vif *vif, mvif->wep_sta = NULL; ewma_rssi_init(&mvif->bss_conf.rssi); } + + mvif->mlo_pm_state = MT792x_MLO_LINK_DISASSOC; } EXPORT_SYMBOL_GPL(mt7925_mac_sta_remove); @@ -1355,6 +1358,38 @@ mt7925_ampdu_action(struct ieee80211_hw *hw, struct ieee80211_vif *vif, return ret; } +static void +mt7925_mlo_pm_iter(void *priv, u8 *mac, struct ieee80211_vif *vif) +{ + struct mt792x_dev *dev = priv; + struct mt792x_vif *mvif = (struct mt792x_vif *)vif->drv_priv; + unsigned long valid = ieee80211_vif_is_mld(vif) ? + mvif->valid_links : BIT(0); + struct ieee80211_bss_conf *bss_conf; + int i; + + if (mvif->mlo_pm_state != MT792x_MLO_CHANGED_PS) + return; + + mt792x_mutex_acquire(dev); + 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); +} + +void mt7925_mlo_pm_work(struct work_struct *work) +{ + struct mt792x_dev *dev = container_of(work, struct mt792x_dev, + mlo_pm_work.work); + struct ieee80211_hw *hw = mt76_hw(dev); + + ieee80211_iterate_active_interfaces(hw, + IEEE80211_IFACE_ITER_RESUME_ALL, + mt7925_mlo_pm_iter, dev); +} + static bool is_valid_alpha2(const char *alpha2) { if (!alpha2) @@ -1904,6 +1939,9 @@ static void mt7925_vif_cfg_changed(struct ieee80211_hw *hw, mt7925_mcu_sta_update(dev, NULL, vif, true, MT76_STA_INFO_STATE_ASSOC); mt7925_mcu_set_beacon_filter(dev, vif, vif->cfg.assoc); + + if (ieee80211_vif_is_mld(vif)) + mvif->mlo_pm_state = MT792x_MLO_LINK_ASSOC; } if (changed & BSS_CHANGED_ARP_FILTER) { @@ -1914,9 +1952,19 @@ static void mt7925_vif_cfg_changed(struct ieee80211_hw *hw, } if (changed & BSS_CHANGED_PS) { - for_each_set_bit(i, &valid, IEEE80211_MLD_MAX_NUM_LINKS) { - bss_conf = mt792x_vif_to_bss_conf(vif, i); + if (hweight16(mvif->valid_links) < 2) { + /* legacy */ + bss_conf = &vif->bss_conf; mt7925_mcu_uni_bss_ps(dev, bss_conf); + } else { + if (mvif->mlo_pm_state == MT792x_MLO_LINK_ASSOC) { + mvif->mlo_pm_state = MT792x_MLO_CHANGED_PS_PENDING; + } else if (mvif->mlo_pm_state == MT792x_MLO_CHANGED_PS) { + 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); + } + } } } @@ -1967,11 +2015,12 @@ static void mt7925_link_info_changed(struct ieee80211_hw *hw, if (changed & (BSS_CHANGED_QOS | BSS_CHANGED_BEACON_ENABLED)) mt7925_mcu_set_tx(dev, info); - if (changed & BSS_CHANGED_BSSID) { - if (ieee80211_vif_is_mld(vif) && - hweight16(mvif->valid_links) == 2) - /* Indicate the secondary setup done */ - mt7925_mcu_uni_bss_bcnft(dev, info, true); + if (mvif->mlo_pm_state == MT792x_MLO_CHANGED_PS_PENDING) { + /* Indicate the secondary setup done */ + mt7925_mcu_uni_bss_bcnft(dev, info, true); + + ieee80211_queue_delayed_work(hw, &dev->mlo_pm_work, 5 * HZ); + mvif->mlo_pm_state = MT792x_MLO_CHANGED_PS; } mt792x_mutex_release(dev); @@ -2055,8 +2104,6 @@ mt7925_change_vif_links(struct ieee80211_hw *hw, struct ieee80211_vif *vif, goto free; if (mconf != &mvif->bss_conf) { - mt7925_mcu_set_bss_pm(dev, link_conf, true); - err = mt7925_set_mlo_roc(phy, &mvif->bss_conf, vif->active_links); if (err < 0) diff --git a/drivers/net/wireless/mediatek/mt76/mt7925/mt7925.h b/drivers/net/wireless/mediatek/mt76/mt7925/mt7925.h index fd5f9d4ea4a7..cb7b1a49fbd1 100644 --- a/drivers/net/wireless/mediatek/mt76/mt7925/mt7925.h +++ b/drivers/net/wireless/mediatek/mt76/mt7925/mt7925.h @@ -268,6 +268,7 @@ int mt7925_mcu_uni_tx_ba(struct mt792x_dev *dev, int mt7925_mcu_uni_rx_ba(struct mt792x_dev *dev, struct ieee80211_ampdu_params *params, bool enable); +void mt7925_mlo_pm_work(struct work_struct *work); void mt7925_scan_work(struct work_struct *work); void mt7925_roc_work(struct work_struct *work); int mt7925_mcu_uni_bss_ps(struct mt792x_dev *dev, diff --git a/drivers/net/wireless/mediatek/mt76/mt792x.h b/drivers/net/wireless/mediatek/mt76/mt792x.h index 32ed01a96bf7..6e25a4421e12 100644 --- a/drivers/net/wireless/mediatek/mt76/mt792x.h +++ b/drivers/net/wireless/mediatek/mt76/mt792x.h @@ -81,6 +81,13 @@ enum mt792x_reg_power_type { MT_AP_VLP, }; +enum mt792x_mlo_pm_state { + MT792x_MLO_LINK_DISASSOC, + MT792x_MLO_LINK_ASSOC, + MT792x_MLO_CHANGED_PS_PENDING, + MT792x_MLO_CHANGED_PS, +}; + DECLARE_EWMA(avg_signal, 10, 8) struct mt792x_link_sta { @@ -134,6 +141,7 @@ struct mt792x_vif { struct mt792x_phy *phy; u16 valid_links; u8 deflink_id; + enum mt792x_mlo_pm_state mlo_pm_state; struct work_struct csa_work; struct timer_list csa_timer; @@ -239,6 +247,7 @@ struct mt792x_dev { const struct mt792x_irq_map *irq_map; struct work_struct ipv6_ns_work; + struct delayed_work mlo_pm_work; /* IPv6 addresses for WoWLAN */ struct sk_buff_head ipv6_ns_list;