From patchwork Mon Dec 30 19:41:49 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Felix Fietkau X-Patchwork-Id: 854371 Received: from nbd.name (nbd.name [46.4.11.11]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id 14500EAD0 for ; Mon, 30 Dec 2024 19:42:10 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=46.4.11.11 ARC-Seal: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1735587734; cv=none; b=AJJj5++C0hz3Ivb8mkyN/yp9TWFK/GfZitGF+gXfIEVvHUKxU964EtXdiXYNd0WdGklthlF8/K97g7axgf2aiY9FT5qQGjoxnH4DjqZ/wwd6FD1QjakK09ggMssx6yJ6PSn6rqVrTZWEype9CiZMjWS+RK8kXTeNG+hGd1A87Ts= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1735587734; c=relaxed/simple; bh=cfF00UFwyD87wBF6ebvJtSDP17fno48kUalaR2qkYGw=; h=From:To:Subject:Date:Message-ID:MIME-Version; b=vGY0z7L3qy1MzkrjzJ8MrYwF+N5fO9JufVAouIW8/DzKCn9WWLfzjRQJVOMmuMz0Shmn7KSmEjpeEM4q57JS737Z+Gn9YwrEQWbd3yCHkRS3e8mgDU3y4CP1sL/GmFMKk3gW7X69nTIrrLF1bTUPjJFkvuN205lcRFiSUl/e23g= ARC-Authentication-Results: i=1; smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=nbd.name; spf=none smtp.mailfrom=nbd.name; dkim=pass (1024-bit key) header.d=nbd.name header.i=@nbd.name header.b=CW77xFYf; arc=none smtp.client-ip=46.4.11.11 Authentication-Results: smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=nbd.name Authentication-Results: smtp.subspace.kernel.org; spf=none smtp.mailfrom=nbd.name Authentication-Results: smtp.subspace.kernel.org; dkim=pass (1024-bit key) header.d=nbd.name header.i=@nbd.name header.b="CW77xFYf" DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=nbd.name; s=20160729; h=Content-Transfer-Encoding:MIME-Version:Message-ID:Date:Subject: To:From:Sender:Reply-To:Cc:Content-Type:Content-ID:Content-Description: Resent-Date:Resent-From:Resent-Sender:Resent-To:Resent-Cc:Resent-Message-ID: In-Reply-To:References:List-Id:List-Help:List-Unsubscribe:List-Subscribe: List-Post:List-Owner:List-Archive; bh=cwvSys7HlITzva1LpN8DG4b5Si8Q/BfcxICPb5nPogI=; b=CW77xFYfWjDg/5w3vfCwLJCBHs f5DZ6COd8VZO7mm7AuC3p1M4+m/6gASQsedWQhjQNB9SeyFFO2Q6XvmqYW3e4WszZChUW2iZO/azo 7RsH2fAc2gk3nWt4PYq09WK3VQHp7fb4VRcLSjzqMw1tm/NLOgd4boUR3bgkvT8k96tA=; Received: from p4ff13c5f.dip0.t-ipconnect.de ([79.241.60.95] helo=Maecks.lan) by ds12 with esmtpsa (TLS1.3) tls TLS_ECDHE_RSA_WITH_CHACHA20_POLY1305_SHA256 (Exim 4.96) (envelope-from ) id 1tSLeT-00GKzc-0m for linux-wireless@vger.kernel.org; Mon, 30 Dec 2024 20:42:09 +0100 From: Felix Fietkau To: linux-wireless@vger.kernel.org Subject: [PATCH 01/14] wifi: mt76: remove mt76_calculate_default_rate() Date: Mon, 30 Dec 2024 20:41:49 +0100 Message-ID: <20241230194202.95065-1-nbd@nbd.name> X-Mailer: git-send-email 2.47.1 Precedence: bulk X-Mailing-List: linux-wireless@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 It is only used in mt76_connac2_mac_tx_rate_val, inline it there. Signed-off-by: Felix Fietkau --- drivers/net/wireless/mediatek/mt76/mac80211.c | 24 ------------------- drivers/net/wireless/mediatek/mt76/mt76.h | 2 -- .../wireless/mediatek/mt76/mt76_connac_mac.c | 14 ++++++++++- 3 files changed, 13 insertions(+), 27 deletions(-) diff --git a/drivers/net/wireless/mediatek/mt76/mac80211.c b/drivers/net/wireless/mediatek/mt76/mac80211.c index 7fbce5e757df..57c7b681645a 100644 --- a/drivers/net/wireless/mediatek/mt76/mac80211.c +++ b/drivers/net/wireless/mediatek/mt76/mac80211.c @@ -1808,30 +1808,6 @@ mt76_init_queue(struct mt76_dev *dev, int qid, int idx, int n_desc, } EXPORT_SYMBOL_GPL(mt76_init_queue); -u16 mt76_calculate_default_rate(struct mt76_phy *phy, - struct ieee80211_vif *vif, int rateidx) -{ - struct mt76_vif *mvif = (struct mt76_vif *)vif->drv_priv; - struct cfg80211_chan_def *chandef = mvif->ctx ? - &mvif->ctx->def : - &phy->chandef; - int offset = 0; - - if (chandef->chan->band != NL80211_BAND_2GHZ) - offset = 4; - - /* pick the lowest rate for hidden nodes */ - if (rateidx < 0) - rateidx = 0; - - rateidx += offset; - if (rateidx >= ARRAY_SIZE(mt76_rates)) - rateidx = offset; - - return mt76_rates[rateidx].hw_value; -} -EXPORT_SYMBOL_GPL(mt76_calculate_default_rate); - void mt76_ethtool_worker(struct mt76_ethtool_worker_info *wi, struct mt76_sta_stats *stats, bool eht) { diff --git a/drivers/net/wireless/mediatek/mt76/mt76.h b/drivers/net/wireless/mediatek/mt76/mt76.h index 599123967af6..3bc591c14b65 100644 --- a/drivers/net/wireless/mediatek/mt76/mt76.h +++ b/drivers/net/wireless/mediatek/mt76/mt76.h @@ -1192,8 +1192,6 @@ int mt76_get_of_data_from_nvmem(struct mt76_dev *dev, void *eep, struct mt76_queue * mt76_init_queue(struct mt76_dev *dev, int qid, int idx, int n_desc, int ring_base, void *wed, u32 flags); -u16 mt76_calculate_default_rate(struct mt76_phy *phy, - struct ieee80211_vif *vif, int rateidx); static inline int mt76_init_tx_queue(struct mt76_phy *phy, int qid, int idx, int n_desc, int ring_base, void *wed, u32 flags) diff --git a/drivers/net/wireless/mediatek/mt76/mt76_connac_mac.c b/drivers/net/wireless/mediatek/mt76/mt76_connac_mac.c index a3db65254e37..a72551ba27e4 100644 --- a/drivers/net/wireless/mediatek/mt76/mt76_connac_mac.c +++ b/drivers/net/wireless/mediatek/mt76/mt76_connac_mac.c @@ -299,6 +299,7 @@ u16 mt76_connac2_mac_tx_rate_val(struct mt76_phy *mphy, &mvif->ctx->def : &mphy->chandef; u8 nss = 0, mode = 0, band = chandef->chan->band; int rateidx = 0, mcast_rate; + int offset = 0; if (!vif) goto legacy; @@ -330,7 +331,18 @@ u16 mt76_connac2_mac_tx_rate_val(struct mt76_phy *mphy, rateidx = ffs(vif->bss_conf.basic_rates) - 1; legacy: - rateidx = mt76_calculate_default_rate(mphy, vif, rateidx); + if (band != NL80211_BAND_2GHZ) + offset = 4; + + /* pick the lowest rate for hidden nodes */ + if (rateidx < 0) + rateidx = 0; + + rateidx += offset; + if (rateidx >= ARRAY_SIZE(mt76_rates)) + rateidx = offset; + + rateidx = mt76_rates[rateidx].hw_value; mode = rateidx >> 8; rateidx &= GENMASK(7, 0); out: From patchwork Mon Dec 30 19:41:50 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Felix Fietkau X-Patchwork-Id: 854587 Received: from nbd.name (nbd.name [46.4.11.11]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id 3B93118D656 for ; Mon, 30 Dec 2024 19:42:11 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=46.4.11.11 ARC-Seal: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1735587734; cv=none; b=I/Vj+48Uk5YOGokY6xcXQVbbejf+LMovVuctUDFwP0g7MbJ/qzSaeDTEsRrza4As9kP03M7HN+Y/gSoiC4FxoAGIj7TxqMa8LPnlcxDLzwOnAUQPaKEqvkn85R6HVxu9h0PXmYPPGIJ7b9rfrFR/tnslVAECujjTCd8ZgWlEr2s= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1735587734; c=relaxed/simple; bh=0iYBlH8jBQQOpbu8wV6zhaNa2Ctv6fFilnklGBsNEO8=; h=From:To:Subject:Date:Message-ID:In-Reply-To:References: MIME-Version; b=FMTQIrnCvYwv1Mmb0f3IaVABUI2c/HEzCM3oiNl9VJFNPAUkmd4S6hH6i/2ZCduVvQjP80WVSuG1vazuifZoRVWDZs5NVulP80B9027RBjwaInN/5VhVAlnYs2eTG+D93mbX0gAsCiaXE9VqgzkJ8vbE1dy++gEI0U+bHgV2yQM= ARC-Authentication-Results: i=1; smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=nbd.name; spf=none smtp.mailfrom=nbd.name; dkim=pass (1024-bit key) header.d=nbd.name header.i=@nbd.name header.b=Hfkwkh0o; arc=none smtp.client-ip=46.4.11.11 Authentication-Results: smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=nbd.name Authentication-Results: smtp.subspace.kernel.org; spf=none smtp.mailfrom=nbd.name Authentication-Results: smtp.subspace.kernel.org; dkim=pass (1024-bit key) header.d=nbd.name header.i=@nbd.name header.b="Hfkwkh0o" DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=nbd.name; s=20160729; h=Content-Transfer-Encoding:MIME-Version:References:In-Reply-To: Message-ID:Date:Subject:To:From:Sender:Reply-To:Cc:Content-Type:Content-ID: Content-Description:Resent-Date:Resent-From:Resent-Sender:Resent-To:Resent-Cc :Resent-Message-ID:List-Id:List-Help:List-Unsubscribe:List-Subscribe: List-Post:List-Owner:List-Archive; bh=4gljNVcrUtbVBPH9EWnWBHtPp140L95VnmXvYGBzuxA=; b=Hfkwkh0o4ioT+vebykj6KiIOXG W7Utg0gJjkkE61wJZgXAGgr9uW3XmI3P1LlbLQo9fpQZcuRumPf9UJDUc5WZmmpMj9dXtjJoaP6hv NZtWy1av5noG5YygLiMXsWnlTdD/W+iz+gPrL/hRbKrE+H3exoNqLgA96keTJOhmY2Co=; Received: from p4ff13c5f.dip0.t-ipconnect.de ([79.241.60.95] helo=Maecks.lan) by ds12 with esmtpsa (TLS1.3) tls TLS_ECDHE_RSA_WITH_CHACHA20_POLY1305_SHA256 (Exim 4.96) (envelope-from ) id 1tSLeT-00GKzc-1P for linux-wireless@vger.kernel.org; Mon, 30 Dec 2024 20:42:09 +0100 From: Felix Fietkau To: linux-wireless@vger.kernel.org Subject: [PATCH 02/14] wifi: mt76: mt7996: remove phy->monitor_vif Date: Mon, 30 Dec 2024 20:41:50 +0100 Message-ID: <20241230194202.95065-2-nbd@nbd.name> X-Mailer: git-send-email 2.47.1 In-Reply-To: <20241230194202.95065-1-nbd@nbd.name> References: <20241230194202.95065-1-nbd@nbd.name> Precedence: bulk X-Mailing-List: linux-wireless@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 It is unused Signed-off-by: Felix Fietkau --- drivers/net/wireless/mediatek/mt76/mt7996/main.c | 8 -------- drivers/net/wireless/mediatek/mt76/mt7996/mt7996.h | 2 -- 2 files changed, 10 deletions(-) diff --git a/drivers/net/wireless/mediatek/mt76/mt7996/main.c b/drivers/net/wireless/mediatek/mt76/mt7996/main.c index 2b34ae5e0cb5..eb2388f079d9 100644 --- a/drivers/net/wireless/mediatek/mt76/mt7996/main.c +++ b/drivers/net/wireless/mediatek/mt76/mt7996/main.c @@ -188,10 +188,6 @@ static int mt7996_add_interface(struct ieee80211_hw *hw, mutex_lock(&dev->mt76.mutex); - if (vif->type == NL80211_IFTYPE_MONITOR && - is_zero_ether_addr(vif->addr)) - phy->monitor_vif = vif; - mvif->mt76.idx = __ffs64(~dev->mt76.vif_mask); if (mvif->mt76.idx >= mt7996_max_interface_num(dev)) { ret = -ENOSPC; @@ -270,10 +266,6 @@ static void mt7996_remove_interface(struct ieee80211_hw *hw, mt7996_mcu_add_sta(dev, vif, NULL, false, false); mt7996_mcu_add_bss_info(phy, vif, false); - - if (vif == phy->monitor_vif) - phy->monitor_vif = NULL; - mt7996_mcu_add_dev_info(phy, vif, false); rcu_assign_pointer(dev->mt76.wcid[idx], NULL); diff --git a/drivers/net/wireless/mediatek/mt76/mt7996/mt7996.h b/drivers/net/wireless/mediatek/mt76/mt7996/mt7996.h index 9aec97dd81d9..ad10329d6b44 100644 --- a/drivers/net/wireless/mediatek/mt76/mt7996/mt7996.h +++ b/drivers/net/wireless/mediatek/mt76/mt7996/mt7996.h @@ -246,8 +246,6 @@ struct mt7996_phy { struct ieee80211_sband_iftype_data iftype[NUM_NL80211_BANDS][NUM_NL80211_IFTYPES]; - struct ieee80211_vif *monitor_vif; - struct thermal_cooling_device *cdev; u8 cdev_state; u8 throttle_state; From patchwork Mon Dec 30 19:41:51 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Felix Fietkau X-Patchwork-Id: 854590 Received: from nbd.name (nbd.name [46.4.11.11]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id 3B997191F74 for ; Mon, 30 Dec 2024 19:42:11 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=46.4.11.11 ARC-Seal: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1735587733; cv=none; b=HpwRKtd2IBRvhrMnre8cB+HFF8X8eNQso1jAHRRSSZLtzv0x29x2a9xvS7/Rw4ABu5Wit4WS+nQBPXT/QZw71PCZJViRMMFO3RlP7EkhMmZL3ruodu1aWXrjUVrHEKMhPuaY8jRMmkmeiHCnpZtAnnBB19E1Uk8yjPQO/Ob6gqw= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1735587733; c=relaxed/simple; bh=jntnnUTJmqpJWqAwpcqlgeTwV4Ma28sBQE8LMGLa9Os=; h=From:To:Subject:Date:Message-ID:In-Reply-To:References: MIME-Version; b=J9axLBxtDEeIGCwYlsGoFDQ2Nst8JjVE8yBLVAyjdnauYcTE22LYB9Ut7r7o6Fm/0t2LESf7fPYAWeBuZxdOrr1fZ/RW9c+2yzfK//rkl14vSMaqaiPkniT6rnHXeE62CBPc0rdCJ2fD0jzOUYOrgZB9Ij0mIBbTNsEfwx9l1oo= ARC-Authentication-Results: i=1; smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=nbd.name; spf=none smtp.mailfrom=nbd.name; dkim=pass (1024-bit key) header.d=nbd.name header.i=@nbd.name header.b=QIjsfXhi; arc=none smtp.client-ip=46.4.11.11 Authentication-Results: smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=nbd.name Authentication-Results: smtp.subspace.kernel.org; spf=none smtp.mailfrom=nbd.name Authentication-Results: smtp.subspace.kernel.org; dkim=pass (1024-bit key) header.d=nbd.name header.i=@nbd.name header.b="QIjsfXhi" DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=nbd.name; s=20160729; h=Content-Transfer-Encoding:MIME-Version:References:In-Reply-To: Message-ID:Date:Subject:To:From:Sender:Reply-To:Cc:Content-Type:Content-ID: Content-Description:Resent-Date:Resent-From:Resent-Sender:Resent-To:Resent-Cc :Resent-Message-ID:List-Id:List-Help:List-Unsubscribe:List-Subscribe: List-Post:List-Owner:List-Archive; bh=ZK+IUM4FCS6qnCBNU/j5ZloNC5CxklKIWH6xWiCPIh8=; b=QIjsfXhim1GtLotYeUVH/X4b5a 6DjJVsWRXGVpi0d5WnRPtpO+te/2pDQXv0qocl29XzTXUJIcjz3UGZcxoWhTIIxKxWDmbPc3aIkcI 2oSQf7MSOS0vwRrtOj38q/CB+x8F0rnyQUkuKgmUftKmgwkHqcQJMumtT5dyzefVzmjI=; Received: from p4ff13c5f.dip0.t-ipconnect.de ([79.241.60.95] helo=Maecks.lan) by ds12 with esmtpsa (TLS1.3) tls TLS_ECDHE_RSA_WITH_CHACHA20_POLY1305_SHA256 (Exim 4.96) (envelope-from ) id 1tSLeT-00GKzc-22 for linux-wireless@vger.kernel.org; Mon, 30 Dec 2024 20:42:09 +0100 From: Felix Fietkau To: linux-wireless@vger.kernel.org Subject: [PATCH 03/14] wifi: mt76: mt7915: fix slot time for 5/6GHz Date: Mon, 30 Dec 2024 20:41:51 +0100 Message-ID: <20241230194202.95065-3-nbd@nbd.name> X-Mailer: git-send-email 2.47.1 In-Reply-To: <20241230194202.95065-1-nbd@nbd.name> References: <20241230194202.95065-1-nbd@nbd.name> Precedence: bulk X-Mailing-List: linux-wireless@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 It should only be set to 20 for long slot time on 2.4 GHz Signed-off-by: Felix Fietkau --- drivers/net/wireless/mediatek/mt76/mt7915/main.c | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/drivers/net/wireless/mediatek/mt76/mt7915/main.c b/drivers/net/wireless/mediatek/mt76/mt7915/main.c index 351285daac99..2d4457fbb5ab 100644 --- a/drivers/net/wireless/mediatek/mt76/mt7915/main.c +++ b/drivers/net/wireless/mediatek/mt76/mt7915/main.c @@ -634,7 +634,11 @@ static void mt7915_bss_info_changed(struct ieee80211_hw *hw, mt7915_mac_enable_rtscts(dev, vif, info->use_cts_prot); if (changed & BSS_CHANGED_ERP_SLOT) { - int slottime = info->use_short_slot ? 9 : 20; + int slottime = 9; + + if (phy->mt76->chandef.chan->band == NL80211_BAND_2GHZ && + !info->use_short_slot) + slottime = 20; if (slottime != phy->slottime) { phy->slottime = slottime; From patchwork Mon Dec 30 19:41:52 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Felix Fietkau X-Patchwork-Id: 854374 Received: from nbd.name (nbd.name [46.4.11.11]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id 87C2D1925B3 for ; Mon, 30 Dec 2024 19:42:11 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=46.4.11.11 ARC-Seal: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1735587733; cv=none; b=DxE2U00CtAdVxJDC1t6jHUyCLdNERmym4+dLXUbdubBIz+6kIYdonnS7Shjdt+/RGeGCL7XIAqX/fXKuO9K0bWur1NSko2EendZ4MdLJMzmFSCKHq/Tl+DSa+Px1VtG+Ea8CwMog51L/wzFcN6QWHwRSSag++3d04omdIMEraMc= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1735587733; c=relaxed/simple; bh=9jjXJmWyONS82fS/biyImw6Cn2XX08OEaq1Ofh+fGZg=; h=From:To:Subject:Date:Message-ID:In-Reply-To:References: MIME-Version; b=T3OnLKtFfm27rUKrapRcRyKcz8MYYHEIKkoFs9vucMG7YurtESOyYLHma29lTWwdfwZenQjON1nOjYIp8rO7V9GOkJoVd61xKkWjvP8lJcFfN0wQlsPB6TL7PHHqtQGGbvWTyzOFAR/1295fmAvxzLB6hmIPzzKog9fkaNsTVSI= ARC-Authentication-Results: i=1; smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=nbd.name; spf=none smtp.mailfrom=nbd.name; dkim=pass (1024-bit key) header.d=nbd.name header.i=@nbd.name header.b=BmaC1sJD; arc=none smtp.client-ip=46.4.11.11 Authentication-Results: smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=nbd.name Authentication-Results: smtp.subspace.kernel.org; spf=none smtp.mailfrom=nbd.name Authentication-Results: smtp.subspace.kernel.org; dkim=pass (1024-bit key) header.d=nbd.name header.i=@nbd.name header.b="BmaC1sJD" DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=nbd.name; s=20160729; h=Content-Transfer-Encoding:MIME-Version:References:In-Reply-To: Message-ID:Date:Subject:To:From:Sender:Reply-To:Cc:Content-Type:Content-ID: Content-Description:Resent-Date:Resent-From:Resent-Sender:Resent-To:Resent-Cc :Resent-Message-ID:List-Id:List-Help:List-Unsubscribe:List-Subscribe: List-Post:List-Owner:List-Archive; bh=eK3mTxmlHNipzNKQKtbsluiT2BpiRpM9TEktoKBGdE4=; b=BmaC1sJDxFfvbCLBSckz7gHNaK +mt4iyJlmGAiyHmmeyiDN5IsGFvm1+/sWGintr0uNy94Ufayrb6sDQyXtEZ0MXAABLYOo43pycaVx AzLrI5/4YOAu+IpMQlpe4R75tuQVIioNJsCYBJ+rvsIN/oHV+8mbJnPDs531sejQS5Yo=; Received: from p4ff13c5f.dip0.t-ipconnect.de ([79.241.60.95] helo=Maecks.lan) by ds12 with esmtpsa (TLS1.3) tls TLS_ECDHE_RSA_WITH_CHACHA20_POLY1305_SHA256 (Exim 4.96) (envelope-from ) id 1tSLeT-00GKzc-2g for linux-wireless@vger.kernel.org; Mon, 30 Dec 2024 20:42:09 +0100 From: Felix Fietkau To: linux-wireless@vger.kernel.org Subject: [PATCH 04/14] wifi: mt76: mt7915: fix eifs value on older chipsets Date: Mon, 30 Dec 2024 20:41:52 +0100 Message-ID: <20241230194202.95065-4-nbd@nbd.name> X-Mailer: git-send-email 2.47.1 In-Reply-To: <20241230194202.95065-1-nbd@nbd.name> References: <20241230194202.95065-1-nbd@nbd.name> Precedence: bulk X-Mailing-List: linux-wireless@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 Use the default firmware values Signed-off-by: Felix Fietkau --- drivers/net/wireless/mediatek/mt76/mt7915/mac.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/drivers/net/wireless/mediatek/mt76/mt7915/mac.c b/drivers/net/wireless/mediatek/mt76/mt7915/mac.c index cf77ce0c8759..1b9dcdec142b 100644 --- a/drivers/net/wireless/mediatek/mt76/mt7915/mac.c +++ b/drivers/net/wireless/mediatek/mt76/mt7915/mac.c @@ -1163,7 +1163,7 @@ void mt7915_mac_set_timing(struct mt7915_phy *phy) u32 ofdm = FIELD_PREP(MT_TIMEOUT_VAL_PLCP, 60) | FIELD_PREP(MT_TIMEOUT_VAL_CCA, 28); u8 band = phy->mt76->band_idx; - int eifs_ofdm = 360, sifs = 10, offset; + int eifs_ofdm = 84, sifs = 10, offset; bool a_band = !(phy->mt76->chandef.chan->band == NL80211_BAND_2GHZ); if (!test_bit(MT76_STATE_RUNNING, &phy->mt76->state)) From patchwork Mon Dec 30 19:41:53 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Felix Fietkau X-Patchwork-Id: 854586 Received: from nbd.name (nbd.name [46.4.11.11]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id D6F0119885F for ; Mon, 30 Dec 2024 19:42:11 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=46.4.11.11 ARC-Seal: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1735587734; cv=none; b=IddDv4hncmMad9RvFUEXnkGPUO39UnGvy1urZRjqTuPvcwR+onEsmTG1Jr666WC8uN/qfDNcpNUjrsZfYsFf3JkXv9kDJ4usdiUk71ASi4Kz9sjofv8z9i/vQmmlEMpyCIKucrq/xiGWfHZia7C5kqqroAL+QMFYUmESzr725tA= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1735587734; c=relaxed/simple; bh=2XAlaVtEeUaLrDqXmLzNOtBkNmuFWjfktGnaW2CNDBc=; h=From:To:Subject:Date:Message-ID:In-Reply-To:References: MIME-Version; b=q9zSkGPomBf5GEGDgkWOSVLNzpmgg4v9xYxtlATeBUx+eIGthy35GMtksI/bhu6ZB/jmWkh4mSBkcrzapWalekD7cEu2MiEtXMCnu6Vw7cotdDVjn/dbM247Si+kp4OvDQZum8QtS3GqptTIMZLej3hknJGgmKn2cqCG4SY+0mc= ARC-Authentication-Results: i=1; smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=nbd.name; spf=none smtp.mailfrom=nbd.name; dkim=pass (1024-bit key) header.d=nbd.name header.i=@nbd.name header.b=FA4Gb1gE; arc=none smtp.client-ip=46.4.11.11 Authentication-Results: smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=nbd.name Authentication-Results: smtp.subspace.kernel.org; spf=none smtp.mailfrom=nbd.name Authentication-Results: smtp.subspace.kernel.org; dkim=pass (1024-bit key) header.d=nbd.name header.i=@nbd.name header.b="FA4Gb1gE" DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=nbd.name; s=20160729; h=Content-Transfer-Encoding:MIME-Version:References:In-Reply-To: Message-ID:Date:Subject:To:From:Sender:Reply-To:Cc:Content-Type:Content-ID: Content-Description:Resent-Date:Resent-From:Resent-Sender:Resent-To:Resent-Cc :Resent-Message-ID:List-Id:List-Help:List-Unsubscribe:List-Subscribe: List-Post:List-Owner:List-Archive; bh=cG1gs3YcTGF5QunWsC3tOlr1NjTswGIrIrK+2iSDAhs=; b=FA4Gb1gExGtz/zCtSyjN9Vgofl y0SRNKjWz1NkRFw0L/n04W3YEiZGPEC7VstzDdicUOjeUA55yKHfTnDcawQwyxc6xI7yuN96AwNXo 9NZPxrNX6a5MCZdmI/UZDpbqdruWctCJvP1PnIzYBjFT8qSdHPXK4zjKqi7huAuoJpmw=; Received: from p4ff13c5f.dip0.t-ipconnect.de ([79.241.60.95] helo=Maecks.lan) by ds12 with esmtpsa (TLS1.3) tls TLS_ECDHE_RSA_WITH_CHACHA20_POLY1305_SHA256 (Exim 4.96) (envelope-from ) id 1tSLeU-00GKzc-05 for linux-wireless@vger.kernel.org; Mon, 30 Dec 2024 20:42:10 +0100 From: Felix Fietkau To: linux-wireless@vger.kernel.org Subject: [PATCH 05/14] wifi: mt76: mt7996: fix rx filter setting for bfee functionality Date: Mon, 30 Dec 2024 20:41:53 +0100 Message-ID: <20241230194202.95065-5-nbd@nbd.name> X-Mailer: git-send-email 2.47.1 In-Reply-To: <20241230194202.95065-1-nbd@nbd.name> References: <20241230194202.95065-1-nbd@nbd.name> Precedence: bulk X-Mailing-List: linux-wireless@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 Fix rx filter setting to prevent dropping NDPA frames. Without this change, bfee functionality may behave abnormally. Fixes: 98686cd21624 ("wifi: mt76: mt7996: add driver for MediaTek Wi-Fi 7 (802.11be) devices") Signed-off-by: Felix Fietkau --- drivers/net/wireless/mediatek/mt76/mt7996/main.c | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) diff --git a/drivers/net/wireless/mediatek/mt76/mt7996/main.c b/drivers/net/wireless/mediatek/mt76/mt7996/main.c index eb2388f079d9..d76a9dcfd148 100644 --- a/drivers/net/wireless/mediatek/mt76/mt7996/main.c +++ b/drivers/net/wireless/mediatek/mt76/mt7996/main.c @@ -488,8 +488,7 @@ static void mt7996_configure_filter(struct ieee80211_hw *hw, MT76_FILTER(CONTROL, MT_WF_RFCR_DROP_CTS | MT_WF_RFCR_DROP_RTS | - MT_WF_RFCR_DROP_CTL_RSV | - MT_WF_RFCR_DROP_NDPA); + MT_WF_RFCR_DROP_CTL_RSV); *total_flags = flags; mt76_wr(dev, MT_WF_RFCR(phy->mt76->band_idx), phy->rxfilter); From patchwork Mon Dec 30 19:41:54 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Felix Fietkau X-Patchwork-Id: 854589 Received: from nbd.name (nbd.name [46.4.11.11]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id 1C267198A17 for ; Mon, 30 Dec 2024 19:42:11 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=46.4.11.11 ARC-Seal: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1735587733; cv=none; b=Lggz51TJFN9UbzDZ5n0vhjGBqAHeKx03WTphxyrH4Dpe2eSYNdR7bwzAA6X+WZxTL6ZXnSet7rtEfWIJXDEPiaHXo9e85f6JjehegPMg6y99ktXZDm+b2NN8n2XaqqDQaFN7rhVE5IElk4CRGFYYzcBRWCvnNMv+HUJXglJnW6A= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1735587733; c=relaxed/simple; bh=s9oWaN1ZwFpeFdXj4TqDX4ZwKkr1eYYMKAZq3tSENfE=; h=From:To:Subject:Date:Message-ID:In-Reply-To:References: MIME-Version; b=SnZd3vNwU565mCqcvFR09T0C0PKfOeGsZywP02gTZzC+i8VWqLbe8XJAvEcgF/QyAN75blgReFhuJ55K+r8I842kBlFKkDr0XyOtygSuM9v4Qk1a27Dsqw2WFP3YKGAESpT0BHwDZbdRy6emSX3O20JW0hepj5nxeaEEGVwIdJ8= ARC-Authentication-Results: i=1; smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=nbd.name; spf=none smtp.mailfrom=nbd.name; dkim=pass (1024-bit key) header.d=nbd.name header.i=@nbd.name header.b=hGnzdghx; arc=none smtp.client-ip=46.4.11.11 Authentication-Results: smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=nbd.name Authentication-Results: smtp.subspace.kernel.org; spf=none smtp.mailfrom=nbd.name Authentication-Results: smtp.subspace.kernel.org; dkim=pass (1024-bit key) header.d=nbd.name header.i=@nbd.name header.b="hGnzdghx" DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=nbd.name; s=20160729; h=Content-Transfer-Encoding:MIME-Version:References:In-Reply-To: Message-ID:Date:Subject:To:From:Sender:Reply-To:Cc:Content-Type:Content-ID: Content-Description:Resent-Date:Resent-From:Resent-Sender:Resent-To:Resent-Cc :Resent-Message-ID:List-Id:List-Help:List-Unsubscribe:List-Subscribe: List-Post:List-Owner:List-Archive; bh=LorxDXPTWmlSCLtd+TwpWSDm1Rw+g2ZJWZl35g40vew=; b=hGnzdghxTvCIlRSF4MrWJ6KdaX Zujt6tOYFUVf8yeWwJRdzHqMZjFOxmiRsSlllWN9J70XQCj47LR+3VcSTCKkYvy+wbaFhdTfPW0AP nMjOY66xRbFDYce4Rpqhcc63x2aos4HEmzVdyIx6vuXHoZd47wWUGc51d/hvNKIcQhv4=; Received: from p4ff13c5f.dip0.t-ipconnect.de ([79.241.60.95] helo=Maecks.lan) by ds12 with esmtpsa (TLS1.3) tls TLS_ECDHE_RSA_WITH_CHACHA20_POLY1305_SHA256 (Exim 4.96) (envelope-from ) id 1tSLeU-00GKzc-0j for linux-wireless@vger.kernel.org; Mon, 30 Dec 2024 20:42:10 +0100 From: Felix Fietkau To: linux-wireless@vger.kernel.org Subject: [PATCH 06/14] wifi: mt76: mt7915: reduce the number of command retries Date: Mon, 30 Dec 2024 20:41:54 +0100 Message-ID: <20241230194202.95065-6-nbd@nbd.name> X-Mailer: git-send-email 2.47.1 In-Reply-To: <20241230194202.95065-1-nbd@nbd.name> References: <20241230194202.95065-1-nbd@nbd.name> Precedence: bulk X-Mailing-List: linux-wireless@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 The need to retry a command is really uncommon. Reduce the retries to 1 to speed up recovery from firmware issues. Signed-off-by: Felix Fietkau --- drivers/net/wireless/mediatek/mt76/mt7915/mcu.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/drivers/net/wireless/mediatek/mt76/mt7915/mcu.c b/drivers/net/wireless/mediatek/mt76/mt7915/mcu.c index 35af41b5bad6..6efa1c95e953 100644 --- a/drivers/net/wireless/mediatek/mt76/mt7915/mcu.c +++ b/drivers/net/wireless/mediatek/mt76/mt7915/mcu.c @@ -2388,7 +2388,7 @@ int mt7915_mcu_init_firmware(struct mt7915_dev *dev) int mt7915_mcu_init(struct mt7915_dev *dev) { static const struct mt76_mcu_ops mt7915_mcu_ops = { - .max_retry = 3, + .max_retry = 1, .headroom = sizeof(struct mt76_connac2_mcu_txd), .mcu_skb_prepare_msg = mt76_connac2_mcu_fill_message, .mcu_skb_send_msg = mt7915_mcu_send_message, From patchwork Mon Dec 30 19:41:55 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Felix Fietkau X-Patchwork-Id: 854373 Received: from nbd.name (nbd.name [46.4.11.11]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id 36575198E7B for ; Mon, 30 Dec 2024 19:42:12 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=46.4.11.11 ARC-Seal: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1735587733; cv=none; b=hULO1cekL3e44mf6slSOXwNv3Bpn8mrVLT+Wizvz9YGDy3wvW8/Bau2nAls9rc+arrLhQQs1Q/nf5FeqcStpwvxRxwHZZ/gvWCu7Ul1Aw5b3Bwxe6ggzxpvCV/1hIpRqLlEXcxt73Q0dM4lFTXHT8GiVV1eyGtN6rlpPin//oHI= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1735587733; c=relaxed/simple; bh=vd9JiD/B3e8fjkfrC/RgEvOzdQUE6N2pK1Xmmc0sU1o=; h=From:To:Subject:Date:Message-ID:In-Reply-To:References: MIME-Version; b=oGbXbgNbz6KVbJoDdozC5laZhWNDlWjeNdXB4JKtTiFe0n85cpuS8OxRQTfXX463nPC+7n6JbAlLaxkWN3fph2F8M2vFInPAPoCTMu4j/SJdj7Ib2b9cZSYpr425vlM1hqx//ssXRI/stNuMJQVSGcbcTEVjqAElZgaPbHT1m30= ARC-Authentication-Results: i=1; smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=nbd.name; spf=none smtp.mailfrom=nbd.name; dkim=pass (1024-bit key) header.d=nbd.name header.i=@nbd.name header.b=iVnNJdR9; arc=none smtp.client-ip=46.4.11.11 Authentication-Results: smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=nbd.name Authentication-Results: smtp.subspace.kernel.org; spf=none smtp.mailfrom=nbd.name Authentication-Results: smtp.subspace.kernel.org; dkim=pass (1024-bit key) header.d=nbd.name header.i=@nbd.name header.b="iVnNJdR9" DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=nbd.name; s=20160729; h=Content-Transfer-Encoding:MIME-Version:References:In-Reply-To: Message-ID:Date:Subject:To:From:Sender:Reply-To:Cc:Content-Type:Content-ID: Content-Description:Resent-Date:Resent-From:Resent-Sender:Resent-To:Resent-Cc :Resent-Message-ID:List-Id:List-Help:List-Unsubscribe:List-Subscribe: List-Post:List-Owner:List-Archive; bh=P7dcwgYJvfEmpoDdeEwtA9iCJ7f8/wW3O7wo+gZKeZc=; b=iVnNJdR9uz4TB9X99jeGFJpG/H igqcmzCLqCVyCDSSig54CcVFDGNWfZeixZT+j7ngnBPWiLPOseQ58T23/Ef4sEz0zAR8XAXsqhZFp ERGXUvhpOK3VBLWXlesL3sRmXJJTLl9fiBtWcR/i/pfh2xlTyk/YJEeWPg77OV/Kfk38=; Received: from p4ff13c5f.dip0.t-ipconnect.de ([79.241.60.95] helo=Maecks.lan) by ds12 with esmtpsa (TLS1.3) tls TLS_ECDHE_RSA_WITH_CHACHA20_POLY1305_SHA256 (Exim 4.96) (envelope-from ) id 1tSLeU-00GKzc-1N for linux-wireless@vger.kernel.org; Mon, 30 Dec 2024 20:42:10 +0100 From: Felix Fietkau To: linux-wireless@vger.kernel.org Subject: [PATCH 07/14] wifi: mt76: mt7915: decrease timeout for commonly issued MCU commands Date: Mon, 30 Dec 2024 20:41:55 +0100 Message-ID: <20241230194202.95065-7-nbd@nbd.name> X-Mailer: git-send-email 2.47.1 In-Reply-To: <20241230194202.95065-1-nbd@nbd.name> References: <20241230194202.95065-1-nbd@nbd.name> Precedence: bulk X-Mailing-List: linux-wireless@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 This allows faster recovery from firmware issues Signed-off-by: Felix Fietkau --- .../net/wireless/mediatek/mt76/mt7915/mcu.c | 21 +++++++++++++++++++ 1 file changed, 21 insertions(+) diff --git a/drivers/net/wireless/mediatek/mt76/mt7915/mcu.c b/drivers/net/wireless/mediatek/mt76/mt7915/mcu.c index 6efa1c95e953..7115394f6bd6 100644 --- a/drivers/net/wireless/mediatek/mt76/mt7915/mcu.c +++ b/drivers/net/wireless/mediatek/mt76/mt7915/mcu.c @@ -194,6 +194,25 @@ mt7915_mcu_parse_response(struct mt76_dev *mdev, int cmd, return ret; } +static void +mt7915_mcu_set_timeout(struct mt76_dev *mdev, int cmd) +{ + if ((cmd & __MCU_CMD_FIELD_ID) != MCU_CMD_EXT_CID) + return; + + switch (FIELD_GET(__MCU_CMD_FIELD_EXT_ID, cmd)) { + case MCU_EXT_CMD_THERMAL_CTRL: + case MCU_EXT_CMD_GET_MIB_INFO: + case MCU_EXT_CMD_PHY_STAT_INFO: + case MCU_EXT_CMD_STA_REC_UPDATE: + case MCU_EXT_CMD_BSS_INFO_UPDATE: + mdev->mcu.timeout = 2 * HZ; + return; + default: + break; + } +} + static int mt7915_mcu_send_message(struct mt76_dev *mdev, struct sk_buff *skb, int cmd, int *wait_seq) @@ -208,6 +227,8 @@ mt7915_mcu_send_message(struct mt76_dev *mdev, struct sk_buff *skb, else qid = MT_MCUQ_WM; + mt7915_mcu_set_timeout(mdev, cmd); + return mt76_tx_queue_skb_raw(dev, mdev->q_mcu[qid], skb, 0); } From patchwork Mon Dec 30 19:41:56 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Felix Fietkau X-Patchwork-Id: 854588 Received: from nbd.name (nbd.name [46.4.11.11]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id 3651C198E6D for ; Mon, 30 Dec 2024 19:42:12 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=46.4.11.11 ARC-Seal: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1735587733; cv=none; b=sIcrNAfObC0zQIVyW9OhUgBzvIcogqMYWSRBCPxtP4uB8WZ4c6LLC+l1h/2kIMaCi86S3WzwIy40JBj16BOLaliuvjRFhbrtJuQOD08GbpO+Cavya9M+Wcq22juFS9IPnuW7Aq8dTMCLvWjEuCyu87YKvQuG0LPsN7DAWnMXUHo= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1735587733; c=relaxed/simple; bh=yyWn7vzP7uHwidWjyH5hDghERUeilGlOSCH9HzmBC0s=; h=From:To:Subject:Date:Message-ID:In-Reply-To:References: MIME-Version; b=OY0E24LNEnX7i13UmfMTlC70jQt9Qlz+TRYkNQi4DphNKFRE2wIwAMgB+NS1ObSB8EvqB4LTmRyjTkhqoQE5O6SHDOmeCbEf/YHf7lJ2F80Vc3Oz5H+dCu4TUOHFNJ+PBIUesDnncG0b9NMd+7PCzi/IEPa/5wlRJXfaiPdchbk= ARC-Authentication-Results: i=1; smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=nbd.name; spf=none smtp.mailfrom=nbd.name; dkim=pass (1024-bit key) header.d=nbd.name header.i=@nbd.name header.b=DPBspRar; arc=none smtp.client-ip=46.4.11.11 Authentication-Results: smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=nbd.name Authentication-Results: smtp.subspace.kernel.org; spf=none smtp.mailfrom=nbd.name Authentication-Results: smtp.subspace.kernel.org; dkim=pass (1024-bit key) header.d=nbd.name header.i=@nbd.name header.b="DPBspRar" DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=nbd.name; s=20160729; h=Content-Transfer-Encoding:MIME-Version:References:In-Reply-To: Message-ID:Date:Subject:To:From:Sender:Reply-To:Cc:Content-Type:Content-ID: Content-Description:Resent-Date:Resent-From:Resent-Sender:Resent-To:Resent-Cc :Resent-Message-ID:List-Id:List-Help:List-Unsubscribe:List-Subscribe: List-Post:List-Owner:List-Archive; bh=46Kq5Lrtw2pTBmv7OxuLvlzpXpk1LLc4pghEgVmdP44=; b=DPBspRarY+oj5+xSMEkEPiXlCg IxoyEnabr6vZdUKBnCD3S3aw0vSb6CcRS/YI3k5uc53JJsb91ycWHrdshILFqK/gF71xHpux+Qqgi 3EHlIOA/JK5PPYC76ykGvfpAx6GaVnXTWNUPYDDjPRJiLtZRT64EY3DEt7NFsTntS0T8=; Received: from p4ff13c5f.dip0.t-ipconnect.de ([79.241.60.95] helo=Maecks.lan) by ds12 with esmtpsa (TLS1.3) tls TLS_ECDHE_RSA_WITH_CHACHA20_POLY1305_SHA256 (Exim 4.96) (envelope-from ) id 1tSLeU-00GKzc-1z for linux-wireless@vger.kernel.org; Mon, 30 Dec 2024 20:42:10 +0100 From: Felix Fietkau To: linux-wireless@vger.kernel.org Subject: [PATCH 08/14] wifi: mt76: only enable tx worker after setting the channel Date: Mon, 30 Dec 2024 20:41:56 +0100 Message-ID: <20241230194202.95065-8-nbd@nbd.name> X-Mailer: git-send-email 2.47.1 In-Reply-To: <20241230194202.95065-1-nbd@nbd.name> References: <20241230194202.95065-1-nbd@nbd.name> Precedence: bulk X-Mailing-List: linux-wireless@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 Avoids sending packets too early Fixes: 0b3be9d1d34e ("wifi: mt76: add separate tx scheduling queue for off-channel tx") Signed-off-by: Felix Fietkau --- drivers/net/wireless/mediatek/mt76/mac80211.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/drivers/net/wireless/mediatek/mt76/mac80211.c b/drivers/net/wireless/mediatek/mt76/mac80211.c index 57c7b681645a..3642c490fa6d 100644 --- a/drivers/net/wireless/mediatek/mt76/mac80211.c +++ b/drivers/net/wireless/mediatek/mt76/mac80211.c @@ -958,11 +958,11 @@ int mt76_set_channel(struct mt76_phy *phy, struct cfg80211_chan_def *chandef, if (chandef->chan != phy->main_chan) memset(phy->chan_state, 0, sizeof(*phy->chan_state)); - mt76_worker_enable(&dev->tx_worker); ret = dev->drv->set_channel(phy); clear_bit(MT76_RESET, &phy->state); + mt76_worker_enable(&dev->tx_worker); mt76_worker_schedule(&dev->tx_worker); mutex_unlock(&dev->mutex); From patchwork Mon Dec 30 19:41:57 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Felix Fietkau X-Patchwork-Id: 854372 Received: from nbd.name (nbd.name [46.4.11.11]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id 7DB351991BF for ; Mon, 30 Dec 2024 19:42:12 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=46.4.11.11 ARC-Seal: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1735587734; cv=none; b=DZ8lMD6Frb/ZHpj4oZCL8eZwcf4pPmtI/PdBu0D1yTidyWQ2TeG1MgZyc1+rU1tvQBn5b669cv9PhB9o9Vhr2Y6TExHnzwO0ipdI9mZ1piVT7dEbyulNcQXCCzVfMCgw+IPmn+ElL87e84PCLkWwYB1XO+J4SwajKq0j+bX/aOo= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1735587734; c=relaxed/simple; bh=WsscW/3nELUKmY/+l2I/hqoIXHVmF/gN4+npd96N8Ms=; h=From:To:Subject:Date:Message-ID:In-Reply-To:References: MIME-Version; b=jMTN28WaxZqz9eZlxgAjS3LcYj0nBfeKRygKKnEoI/gXkbGL+xPc0CfeR1YImUVRVON2FP38x1kXJls1XI0B94F0uc6UgD1R2l2JAjqXzkyykIY1o5taHTHNRi3J4mkzrYooTW5SOTqmK4u83W1C1ZktEOmbEKTrrXQbBAtpXYk= ARC-Authentication-Results: i=1; smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=nbd.name; spf=none smtp.mailfrom=nbd.name; dkim=pass (1024-bit key) header.d=nbd.name header.i=@nbd.name header.b=bx5oLf0J; arc=none smtp.client-ip=46.4.11.11 Authentication-Results: smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=nbd.name Authentication-Results: smtp.subspace.kernel.org; spf=none smtp.mailfrom=nbd.name Authentication-Results: smtp.subspace.kernel.org; dkim=pass (1024-bit key) header.d=nbd.name header.i=@nbd.name header.b="bx5oLf0J" DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=nbd.name; s=20160729; h=Content-Transfer-Encoding:MIME-Version:References:In-Reply-To: Message-ID:Date:Subject:To:From:Sender:Reply-To:Cc:Content-Type:Content-ID: Content-Description:Resent-Date:Resent-From:Resent-Sender:Resent-To:Resent-Cc :Resent-Message-ID:List-Id:List-Help:List-Unsubscribe:List-Subscribe: List-Post:List-Owner:List-Archive; bh=cFAhxM8hwqKJsT6UDCNCvVdBG2oWL0m0pc2iTup7+IQ=; b=bx5oLf0Jl7dYl1A+UMXBxQJMsW FJF9wChAuThFh/4xDJ6OpWyMC3rkSEYu11zeq5q+P9YL224thjzrx57EPP+vo9XpzlYT1M5eK+rXd RI6laNripa0atMdgfW17n8j0qdtZd57pva3EnlINTZqRJqdRaLV+6L1q/9w5QQuYmz0w=; Received: from p4ff13c5f.dip0.t-ipconnect.de ([79.241.60.95] helo=Maecks.lan) by ds12 with esmtpsa (TLS1.3) tls TLS_ECDHE_RSA_WITH_CHACHA20_POLY1305_SHA256 (Exim 4.96) (envelope-from ) id 1tSLeU-00GKzc-2d for linux-wireless@vger.kernel.org; Mon, 30 Dec 2024 20:42:10 +0100 From: Felix Fietkau To: linux-wireless@vger.kernel.org Subject: [PATCH 09/14] wifi: mt76: mt7915: ensure that only one sta entry is active per mac address Date: Mon, 30 Dec 2024 20:41:57 +0100 Message-ID: <20241230194202.95065-9-nbd@nbd.name> X-Mailer: git-send-email 2.47.1 In-Reply-To: <20241230194202.95065-1-nbd@nbd.name> References: <20241230194202.95065-1-nbd@nbd.name> Precedence: bulk X-Mailing-List: linux-wireless@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 When a client is roaming to a different AP interface, a duplicate wtbl entry can be created. This can lead to lost packets or aggregation issues until the old entry expires. In order to fix this issue, delete any conflicting entries from WTBL whenever a station is authorized. Signed-off-by: Felix Fietkau --- .../net/wireless/mediatek/mt76/mt7915/main.c | 58 ++++++++++++++++++- 1 file changed, 57 insertions(+), 1 deletion(-) diff --git a/drivers/net/wireless/mediatek/mt76/mt7915/main.c b/drivers/net/wireless/mediatek/mt76/mt7915/main.c index 2d4457fbb5ab..fd337aede99e 100644 --- a/drivers/net/wireless/mediatek/mt76/mt7915/main.c +++ b/drivers/net/wireless/mediatek/mt76/mt7915/main.c @@ -368,8 +368,12 @@ static int mt7915_set_key(struct ieee80211_hw *hw, enum set_key_cmd cmd, int idx = key->keyidx; int err = 0; - if (sta && !wcid->sta) + if (sta && !wcid->sta) { + if (cmd != SET_KEY) + return 0; + return -EOPNOTSUPP; + } /* The hardware does not support per-STA RX GTK, fallback * to software mode for these. @@ -765,6 +769,57 @@ int mt7915_mac_sta_add(struct mt76_dev *mdev, struct ieee80211_vif *vif, return 0; } +struct drop_sta_iter { + struct mt7915_dev *dev; + struct ieee80211_hw *hw; + struct ieee80211_vif *vif; + u8 sta_addr[ETH_ALEN]; +}; + +static void +__mt7915_drop_sta(void *ptr, u8 *mac, struct ieee80211_vif *vif) +{ + struct drop_sta_iter *data = ptr; + struct ieee80211_sta *sta; + struct mt7915_sta *msta; + + if (vif == data->vif || vif->type != NL80211_IFTYPE_AP) + return; + + sta = ieee80211_find_sta_by_ifaddr(data->hw, data->sta_addr, mac); + if (!sta) + return; + + msta = (struct mt7915_sta *)sta->drv_priv; + mt7915_mcu_add_sta(data->dev, vif, sta, CONN_STATE_DISCONNECT, false); + msta->wcid.sta_disabled = 1; + msta->wcid.sta = 0; +} + +static void +mt7915_drop_other_sta(struct mt7915_dev *dev, struct ieee80211_vif *vif, + struct ieee80211_sta *sta) +{ + struct mt76_phy *ext_phy = dev->mt76.phys[MT_BAND1]; + struct drop_sta_iter data = { + .dev = dev, + .hw = dev->mphy.hw, + .vif = vif, + }; + + if (vif->type != NL80211_IFTYPE_AP) + return; + + memcpy(data.sta_addr, sta->addr, ETH_ALEN); + ieee80211_iterate_active_interfaces(data.hw, 0, __mt7915_drop_sta, &data); + + if (!ext_phy) + return; + + data.hw = ext_phy->hw; + ieee80211_iterate_active_interfaces(data.hw, 0, __mt7915_drop_sta, &data); +} + int mt7915_mac_sta_event(struct mt76_dev *mdev, struct ieee80211_vif *vif, struct ieee80211_sta *sta, enum mt76_sta_event ev) { @@ -793,6 +848,7 @@ int mt7915_mac_sta_event(struct mt76_dev *mdev, struct ieee80211_vif *vif, return 0; case MT76_STA_EVENT_AUTHORIZE: + mt7915_drop_other_sta(dev, vif, sta); return mt7915_mcu_add_sta(dev, vif, sta, CONN_STATE_PORT_SECURE, false); case MT76_STA_EVENT_DISASSOC: From patchwork Mon Dec 30 19:41:58 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Felix Fietkau X-Patchwork-Id: 854585 Received: from nbd.name (nbd.name [46.4.11.11]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id BF0B5199239 for ; Mon, 30 Dec 2024 19:42:12 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=46.4.11.11 ARC-Seal: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1735587734; cv=none; b=bo0YQBq8KXcXf0xzByWGNsu8ze8nSfPpJZi9MFrQLJkRisR68HDwf+tWp6Xzka7Lpl5kAa2OHLuGxXlclbPPZDfcZensIb6AS5MJJZChAfukXK8RAD8k4Zdm4NLjdJj3EqhIDPBjZGfy5jEZX8rerzklJpSU35WfSUTRElnasfI= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1735587734; c=relaxed/simple; bh=pTf9uhR1HwlZ+soMlkK38UIRVXh9fqs8tsLEkzaLZW8=; h=From:To:Subject:Date:Message-ID:In-Reply-To:References: MIME-Version; b=o2QNTAtt04DWrcjOy9C5z3JymR0pftKuHePzYW+WVaBQ24eTGKKyYF5rPFjL9B20EVV167PzK1zRKD5b8+dlG3fIdYt2g9OGS6ctWSWemC3ueNUi+I8oZSyPEECmrpp+ZWXqeG+QiHWbqoKRyCtVvMCGOYv77+KA/tZHtdXYQNE= ARC-Authentication-Results: i=1; smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=nbd.name; spf=none smtp.mailfrom=nbd.name; dkim=pass (1024-bit key) header.d=nbd.name header.i=@nbd.name header.b=Cg/8cN/L; arc=none smtp.client-ip=46.4.11.11 Authentication-Results: smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=nbd.name Authentication-Results: smtp.subspace.kernel.org; spf=none smtp.mailfrom=nbd.name Authentication-Results: smtp.subspace.kernel.org; dkim=pass (1024-bit key) header.d=nbd.name header.i=@nbd.name header.b="Cg/8cN/L" DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=nbd.name; s=20160729; h=Content-Transfer-Encoding:MIME-Version:References:In-Reply-To: Message-ID:Date:Subject:To:From:Sender:Reply-To:Cc:Content-Type:Content-ID: Content-Description:Resent-Date:Resent-From:Resent-Sender:Resent-To:Resent-Cc :Resent-Message-ID:List-Id:List-Help:List-Unsubscribe:List-Subscribe: List-Post:List-Owner:List-Archive; bh=WY6NKapy3IhvOS+IgMFpSYa19SNn9ZBnMgIOk5zBFec=; b=Cg/8cN/LG95eEwmck/Bg7/K37D h9hMxvmdwNWUvq53LAcLqS+ae5KtHLp3BxbB76AsbK3766GXp6RqwuoUBpd8r16DdWiSwaxFge4zH xQePn2aZOj/xUz+WDADqaNPAKYqZYypNNeYIItBDtSNyJOWfb8cgI1BmaEDwP8NfsNf4=; Received: from p4ff13c5f.dip0.t-ipconnect.de ([79.241.60.95] helo=Maecks.lan) by ds12 with esmtpsa (TLS1.3) tls TLS_ECDHE_RSA_WITH_CHACHA20_POLY1305_SHA256 (Exim 4.96) (envelope-from ) id 1tSLeV-00GKzc-05 for linux-wireless@vger.kernel.org; Mon, 30 Dec 2024 20:42:11 +0100 From: Felix Fietkau To: linux-wireless@vger.kernel.org Subject: [PATCH 10/14] wifi: mt76: mt7915: hold dev->mutex while interacting with the thermal state Date: Mon, 30 Dec 2024 20:41:58 +0100 Message-ID: <20241230194202.95065-10-nbd@nbd.name> X-Mailer: git-send-email 2.47.1 In-Reply-To: <20241230194202.95065-1-nbd@nbd.name> References: <20241230194202.95065-1-nbd@nbd.name> Precedence: bulk X-Mailing-List: linux-wireless@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 Avoid issuing MCU calls during a hardware restart Signed-off-by: Felix Fietkau --- drivers/net/wireless/mediatek/mt76/mt7915/init.c | 7 +++++-- 1 file changed, 5 insertions(+), 2 deletions(-) diff --git a/drivers/net/wireless/mediatek/mt76/mt7915/init.c b/drivers/net/wireless/mediatek/mt76/mt7915/init.c index 4282857d8ce9..c530435b19b5 100644 --- a/drivers/net/wireless/mediatek/mt76/mt7915/init.c +++ b/drivers/net/wireless/mediatek/mt76/mt7915/init.c @@ -53,7 +53,9 @@ static ssize_t mt7915_thermal_temp_show(struct device *dev, switch (i) { case 0: + mutex_lock(&phy->dev->mt76.mutex); temperature = mt7915_mcu_get_temperature(phy); + mutex_unlock(&phy->dev->mt76.mutex); if (temperature < 0) return temperature; /* display in millidegree celcius */ @@ -95,9 +97,8 @@ static ssize_t mt7915_thermal_temp_store(struct device *dev, } phy->throttle_temp[i - 1] = val; - mutex_unlock(&phy->dev->mt76.mutex); - ret = mt7915_mcu_set_thermal_protect(phy); + mutex_unlock(&phy->dev->mt76.mutex); if (ret) return ret; @@ -159,7 +160,9 @@ mt7915_thermal_set_cur_throttle_state(struct thermal_cooling_device *cdev, * cooling_device convention: 0 = no cooling, more = more cooling * mcu convention: 1 = max cooling, more = less cooling */ + mutex_lock(&phy->dev->mt76.mutex); ret = mt7915_mcu_set_thermal_throttling(phy, throttling); + mutex_unlock(&phy->dev->mt76.mutex); if (ret) return ret; From patchwork Mon Dec 30 19:41:59 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Felix Fietkau X-Patchwork-Id: 854369 Received: from nbd.name (nbd.name [46.4.11.11]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id 044DE199948 for ; Mon, 30 Dec 2024 19:42:12 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=46.4.11.11 ARC-Seal: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1735587734; cv=none; b=SUAAYCBBP3JrzBMsINH7YFx4gcp7fSL+0IdhcmZu19BuNunQN9yzjY2oNNlbPD0tWndsTej0DtwcPrXVfihcXxnICTWmYa095u1cOpz/0vkygEg9PXD+jO6MuTgQN/1IqON4NGqfKtjj6a3u4htWRu+uisSJMbwGkKicL36eN40= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1735587734; c=relaxed/simple; bh=NRNR2WIulWgduH6oGAUWLnQZ0jNlinGCTFOnM/6gsCo=; h=From:To:Subject:Date:Message-ID:In-Reply-To:References: MIME-Version; b=rw6vFTVS1fLc8/LnsZAuti1aeFgqnpEJFv33CHPMh2wHJtEtBZNmsz7Sn28M48e5i44TZULwTPDnRnVG6PQXpreJrGLG9auMbh21GWUpxvLHuEkx2u1NMwtKCN7DrnSWBJQ/TQWs2Muh7kMTlgLX9G4AG/nOVSCxBguc0btNq/o= ARC-Authentication-Results: i=1; smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=nbd.name; spf=none smtp.mailfrom=nbd.name; dkim=pass (1024-bit key) header.d=nbd.name header.i=@nbd.name header.b=Z97bWBYN; arc=none smtp.client-ip=46.4.11.11 Authentication-Results: smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=nbd.name Authentication-Results: smtp.subspace.kernel.org; spf=none smtp.mailfrom=nbd.name Authentication-Results: smtp.subspace.kernel.org; dkim=pass (1024-bit key) header.d=nbd.name header.i=@nbd.name header.b="Z97bWBYN" DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=nbd.name; s=20160729; h=Content-Transfer-Encoding:MIME-Version:References:In-Reply-To: Message-ID:Date:Subject:To:From:Sender:Reply-To:Cc:Content-Type:Content-ID: Content-Description:Resent-Date:Resent-From:Resent-Sender:Resent-To:Resent-Cc :Resent-Message-ID:List-Id:List-Help:List-Unsubscribe:List-Subscribe: List-Post:List-Owner:List-Archive; bh=iDAAUn/siem5nM/CSjqTtCJcwHPylgU8TPBYNDc2ViE=; b=Z97bWBYNGfJUn2GCSx+RA2YwM2 c7rxiuGJjxdEybncFKoSaC5KZx4EXG9X5dfRn6QJ5NcbwkLy/dDeXI+/co4C5h73OV8HjFKg8fUqk RV3mAxMYirzTj/UG76bVjkM89eQBy3hr3OggtfqYe4lAvLIwsWDBmptZ7jWNRLXAluV4=; Received: from p4ff13c5f.dip0.t-ipconnect.de ([79.241.60.95] helo=Maecks.lan) by ds12 with esmtpsa (TLS1.3) tls TLS_ECDHE_RSA_WITH_CHACHA20_POLY1305_SHA256 (Exim 4.96) (envelope-from ) id 1tSLeV-00GKzc-0h for linux-wireless@vger.kernel.org; Mon, 30 Dec 2024 20:42:11 +0100 From: Felix Fietkau To: linux-wireless@vger.kernel.org Subject: [PATCH 11/14] wifi: mt76: mt7915: firmware restart on devices with a second pcie link Date: Mon, 30 Dec 2024 20:41:59 +0100 Message-ID: <20241230194202.95065-11-nbd@nbd.name> X-Mailer: git-send-email 2.47.1 In-Reply-To: <20241230194202.95065-1-nbd@nbd.name> References: <20241230194202.95065-1-nbd@nbd.name> Precedence: bulk X-Mailing-List: linux-wireless@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 It seems that the firmware checks the register used for detecting matching PCIe links in order to figure out if a secondary PCIe link is enabled. Write the register again just before starting the firmware on hw reset, in order to fix an issue that left the second band unusable after restart. Fixes: 9093cfff72e3 ("mt76: mt7915: add support for using a secondary PCIe link for gen1") Signed-off-by: Felix Fietkau --- drivers/net/wireless/mediatek/mt76/mt7915/mac.c | 2 ++ drivers/net/wireless/mediatek/mt76/mt7915/mt7915.h | 1 + drivers/net/wireless/mediatek/mt76/mt7915/pci.c | 1 + 3 files changed, 4 insertions(+) diff --git a/drivers/net/wireless/mediatek/mt76/mt7915/mac.c b/drivers/net/wireless/mediatek/mt76/mt7915/mac.c index 1b9dcdec142b..9b9158fdd4d9 100644 --- a/drivers/net/wireless/mediatek/mt76/mt7915/mac.c +++ b/drivers/net/wireless/mediatek/mt76/mt7915/mac.c @@ -1388,6 +1388,8 @@ mt7915_mac_restart(struct mt7915_dev *dev) if (dev_is_pci(mdev->dev)) { mt76_wr(dev, MT_PCIE_MAC_INT_ENABLE, 0xff); if (dev->hif2) { + mt76_wr(dev, MT_PCIE_RECOG_ID, + dev->hif2->index | MT_PCIE_RECOG_ID_SEM); if (is_mt7915(mdev)) mt76_wr(dev, MT_PCIE1_MAC_INT_ENABLE, 0xff); else diff --git a/drivers/net/wireless/mediatek/mt76/mt7915/mt7915.h b/drivers/net/wireless/mediatek/mt76/mt7915/mt7915.h index ac0b1f0eb27c..5fe872ef2e93 100644 --- a/drivers/net/wireless/mediatek/mt76/mt7915/mt7915.h +++ b/drivers/net/wireless/mediatek/mt76/mt7915/mt7915.h @@ -191,6 +191,7 @@ struct mt7915_hif { struct device *dev; void __iomem *regs; int irq; + u32 index; }; struct mt7915_phy { diff --git a/drivers/net/wireless/mediatek/mt76/mt7915/pci.c b/drivers/net/wireless/mediatek/mt76/mt7915/pci.c index 39132894e8ea..07b0a5766eab 100644 --- a/drivers/net/wireless/mediatek/mt76/mt7915/pci.c +++ b/drivers/net/wireless/mediatek/mt76/mt7915/pci.c @@ -42,6 +42,7 @@ static struct mt7915_hif *mt7915_pci_get_hif2(u32 idx) continue; get_device(hif->dev); + hif->index = idx; goto out; } hif = NULL; From patchwork Mon Dec 30 19:42:00 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Felix Fietkau X-Patchwork-Id: 854370 Received: from nbd.name (nbd.name [46.4.11.11]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id 04556199E94 for ; Mon, 30 Dec 2024 19:42:12 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=46.4.11.11 ARC-Seal: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1735587734; cv=none; b=kyzy/MkU70Q+FS99QW48xYxg1Nx1Kx9K0WydN+p1UUUwVddsPOWcMjKbQxLtkXKA5raO/wGEbXtENMzro7MY91364wPNFX4vJo+dQu2v59/RJ2DGwGYVltHlRj/WjPT8URCr+8lbf4rw3KIMcI/cUuJKyJithcpi7r20X7t1HfQ= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1735587734; c=relaxed/simple; bh=jQ1iBkKkN16aclRCyCeHhUWRrvCHfV6rCRG++OY+Wr4=; h=From:To:Subject:Date:Message-ID:In-Reply-To:References: MIME-Version; b=fTtWFKHurtDEgxrj2TzeNrlmMhrQPslzQw2oA2qAnpFl+fnQn8/gGPF8SXZ6W98gcrXaD0MhNIuXOkQBFNORf7Pczn+QXjfP/finxyucl3O/9r+4fu7Oe0PQbnyDtD681dTZe5sBtS6lzJD9a0aMnPeNiGkU3bTAcgDCKbIdUYo= ARC-Authentication-Results: i=1; smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=nbd.name; spf=none smtp.mailfrom=nbd.name; dkim=pass (1024-bit key) header.d=nbd.name header.i=@nbd.name header.b=PkCv4kYL; arc=none smtp.client-ip=46.4.11.11 Authentication-Results: smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=nbd.name Authentication-Results: smtp.subspace.kernel.org; spf=none smtp.mailfrom=nbd.name Authentication-Results: smtp.subspace.kernel.org; dkim=pass (1024-bit key) header.d=nbd.name header.i=@nbd.name header.b="PkCv4kYL" DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=nbd.name; s=20160729; h=Content-Transfer-Encoding:MIME-Version:References:In-Reply-To: Message-ID:Date:Subject:To:From:Sender:Reply-To:Cc:Content-Type:Content-ID: Content-Description:Resent-Date:Resent-From:Resent-Sender:Resent-To:Resent-Cc :Resent-Message-ID:List-Id:List-Help:List-Unsubscribe:List-Subscribe: List-Post:List-Owner:List-Archive; bh=F29E93r78MUmG8XEyzaG65tuz9UUco8gUsGXqCDqQAA=; b=PkCv4kYLOAMHxVpJAaWkEDIRAN KjxvYt8LR5GNSMgTPcdAeVAJWOy5aCag1ZMwq8lHIAr+5OiirKBqHZpIpx6NKVH/iBQ0oo130go+p sAQnRG+FHmexndNsTQswMPc8WauPl/SdcrjfWgK0iOVCj3XI+ThHVWW8X2maQQ74ku/g=; Received: from p4ff13c5f.dip0.t-ipconnect.de ([79.241.60.95] helo=Maecks.lan) by ds12 with esmtpsa (TLS1.3) tls TLS_ECDHE_RSA_WITH_CHACHA20_POLY1305_SHA256 (Exim 4.96) (envelope-from ) id 1tSLeV-00GKzc-1K for linux-wireless@vger.kernel.org; Mon, 30 Dec 2024 20:42:11 +0100 From: Felix Fietkau To: linux-wireless@vger.kernel.org Subject: [PATCH 12/14] wifi: mt76: mt7915: fix omac index assignment after hardware reset Date: Mon, 30 Dec 2024 20:42:00 +0100 Message-ID: <20241230194202.95065-12-nbd@nbd.name> X-Mailer: git-send-email 2.47.1 In-Reply-To: <20241230194202.95065-1-nbd@nbd.name> References: <20241230194202.95065-1-nbd@nbd.name> Precedence: bulk X-Mailing-List: linux-wireless@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 Reset per-phy mac address slot mask in order to avoid leaking entries. Fixes: 8a55712d124f ("wifi: mt76: mt7915: enable full system reset support") Signed-off-by: Felix Fietkau --- drivers/net/wireless/mediatek/mt76/mt7915/mac.c | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/drivers/net/wireless/mediatek/mt76/mt7915/mac.c b/drivers/net/wireless/mediatek/mt76/mt7915/mac.c index 9b9158fdd4d9..e2693aea2e8e 100644 --- a/drivers/net/wireless/mediatek/mt76/mt7915/mac.c +++ b/drivers/net/wireless/mediatek/mt76/mt7915/mac.c @@ -1444,9 +1444,11 @@ static void mt7915_mac_full_reset(struct mt7915_dev *dev) { struct mt76_phy *ext_phy; + struct mt7915_phy *phy2; int i; ext_phy = dev->mt76.phys[MT_BAND1]; + phy2 = ext_phy ? ext_phy->priv : NULL; dev->recovery.hw_full_reset = true; @@ -1476,6 +1478,9 @@ mt7915_mac_full_reset(struct mt7915_dev *dev) memset(dev->mt76.wcid_mask, 0, sizeof(dev->mt76.wcid_mask)); dev->mt76.vif_mask = 0; + dev->phy.omac_mask = 0; + if (phy2) + phy2->omac_mask = 0; i = mt76_wcid_alloc(dev->mt76.wcid_mask, MT7915_WTBL_STA); dev->mt76.global_wcid.idx = i; From patchwork Mon Dec 30 19:42:01 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Felix Fietkau X-Patchwork-Id: 854584 Received: from nbd.name (nbd.name [46.4.11.11]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id 4E1F119ABA3 for ; Mon, 30 Dec 2024 19:42:13 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=46.4.11.11 ARC-Seal: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1735587735; cv=none; b=ANOJhlmJgxrwFX4R1N3c9+Z1INNu0xsoeBIGv/CE3gcfIMpBj0g8J4bQiSNy1fRMNyIdt2f46Mv0sfaoiA6As+fcSWwyFcQNSHLLgj+UyRC3/JghdillT/S5E51ElhdA2tt6TqO92A32tVc17UQcefeJh1vpAW/kk5znpYwxQ4A= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1735587735; c=relaxed/simple; bh=io7N2MmPWWcDg7fxr8+p2eGOIFzyDBNutco1dOZACOg=; h=From:To:Subject:Date:Message-ID:In-Reply-To:References: MIME-Version; b=pi3u6lGzEkOs8SldP7oLjac9gtKIknG4/jLgwObOB+FQpAzgdLPaRAG706r0v8P4Ht1YTlshd0gu5FHBkM7oE7bsJFsSZSKNqwGQTkPDbegVQmdwZbR3P3G1bjGhsx+21hifUTOWISS2jrj22/wEL4GrRVNba9CQdJTArbrw65s= ARC-Authentication-Results: i=1; smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=nbd.name; spf=none smtp.mailfrom=nbd.name; dkim=pass (1024-bit key) header.d=nbd.name header.i=@nbd.name header.b=gnBCp0nM; arc=none smtp.client-ip=46.4.11.11 Authentication-Results: smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=nbd.name Authentication-Results: smtp.subspace.kernel.org; spf=none smtp.mailfrom=nbd.name Authentication-Results: smtp.subspace.kernel.org; dkim=pass (1024-bit key) header.d=nbd.name header.i=@nbd.name header.b="gnBCp0nM" DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=nbd.name; s=20160729; h=Content-Transfer-Encoding:MIME-Version:References:In-Reply-To: Message-ID:Date:Subject:To:From:Sender:Reply-To:Cc:Content-Type:Content-ID: Content-Description:Resent-Date:Resent-From:Resent-Sender:Resent-To:Resent-Cc :Resent-Message-ID:List-Id:List-Help:List-Unsubscribe:List-Subscribe: List-Post:List-Owner:List-Archive; bh=iUi1I6JzvhVPgnA+V+11KUAcbmqf2+1Hp/JBd0dbOJY=; b=gnBCp0nMejsNmmjHF4ozpqXNw+ pLferni0JUFCbNqsE312tGWG466rf09X6f+6W+chZhH8cwt7g6k+2NkySgLIVU7ksgK7TABC1CrO7 1xr77kHaGU/qgf1eaQ3qcjx8XKH3DQxiloIvC1XgKL4qGMz+S6A1HZwlQFByXf7Szc6A=; Received: from p4ff13c5f.dip0.t-ipconnect.de ([79.241.60.95] helo=Maecks.lan) by ds12 with esmtpsa (TLS1.3) tls TLS_ECDHE_RSA_WITH_CHACHA20_POLY1305_SHA256 (Exim 4.96) (envelope-from ) id 1tSLeV-00GKzc-1w for linux-wireless@vger.kernel.org; Mon, 30 Dec 2024 20:42:11 +0100 From: Felix Fietkau To: linux-wireless@vger.kernel.org Subject: [PATCH 13/14] wifi: mt76: mt7996: use mac80211 .sta_state op Date: Mon, 30 Dec 2024 20:42:01 +0100 Message-ID: <20241230194202.95065-13-nbd@nbd.name> X-Mailer: git-send-email 2.47.1 In-Reply-To: <20241230194202.95065-1-nbd@nbd.name> References: <20241230194202.95065-1-nbd@nbd.name> Precedence: bulk X-Mailing-List: linux-wireless@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 Allows adding stations before assoc, though they are not passed to the firmware yet at that point. Signed-off-by: Felix Fietkau --- .../net/wireless/mediatek/mt76/mt7996/main.c | 89 ++++++++++++------- .../net/wireless/mediatek/mt76/mt7996/mcu.c | 6 +- .../net/wireless/mediatek/mt76/mt7996/mmio.c | 1 + .../wireless/mediatek/mt76/mt7996/mt7996.h | 4 +- 4 files changed, 61 insertions(+), 39 deletions(-) diff --git a/drivers/net/wireless/mediatek/mt76/mt7996/main.c b/drivers/net/wireless/mediatek/mt76/mt7996/main.c index d76a9dcfd148..a1f091dff26a 100644 --- a/drivers/net/wireless/mediatek/mt76/mt7996/main.c +++ b/drivers/net/wireless/mediatek/mt76/mt7996/main.c @@ -246,7 +246,7 @@ static int mt7996_add_interface(struct ieee80211_hw *hw, * interface, since firmware only records BSSID when the entry is new */ if (vif->type != NL80211_IFTYPE_STATION) - mt7996_mcu_add_sta(dev, vif, NULL, true, true); + mt7996_mcu_add_sta(dev, vif, NULL, CONN_STATE_PORT_SECURE, true); rcu_assign_pointer(dev->mt76.wcid[idx], &mvif->sta.wcid); out: @@ -264,7 +264,7 @@ static void mt7996_remove_interface(struct ieee80211_hw *hw, struct mt7996_phy *phy = mt7996_hw_phy(hw); int idx = msta->wcid.idx; - mt7996_mcu_add_sta(dev, vif, NULL, false, false); + mt7996_mcu_add_sta(dev, vif, NULL, CONN_STATE_DISCONNECT, false); mt7996_mcu_add_bss_info(phy, vif, false); mt7996_mcu_add_dev_info(phy, vif, false); @@ -333,6 +333,9 @@ static int mt7996_set_key(struct ieee80211_hw *hw, enum set_key_cmd cmd, !(key->flags & IEEE80211_KEY_FLAG_PAIRWISE)) return -EOPNOTSUPP; + if (sta && !wcid->sta) + return -EOPNOTSUPP; + /* fall back to sw encryption for unsupported ciphers */ switch (key->cipher) { case WLAN_CIPHER_SUITE_TKIP: @@ -592,7 +595,7 @@ static void mt7996_bss_info_changed(struct ieee80211_hw *hw, (changed & BSS_CHANGED_ASSOC && vif->cfg.assoc) || (changed & BSS_CHANGED_BEACON_ENABLED && info->enable_beacon)) { mt7996_mcu_add_bss_info(phy, vif, true); - mt7996_mcu_add_sta(dev, vif, NULL, true, + mt7996_mcu_add_sta(dev, vif, NULL, CONN_STATE_PORT_SECURE, !!(changed & BSS_CHANGED_BSSID)); } @@ -663,7 +666,7 @@ int mt7996_mac_sta_add(struct mt76_dev *mdev, struct ieee80211_vif *vif, struct mt7996_sta *msta = (struct mt7996_sta *)sta->drv_priv; struct mt7996_vif *mvif = (struct mt7996_vif *)vif->drv_priv; u8 band_idx = mvif->phy->mt76->band_idx; - int ret, idx; + int idx; idx = mt76_wcid_alloc(dev->mt76.wcid_mask, MT7996_WTBL_STA); if (idx < 0) @@ -675,18 +678,53 @@ int mt7996_mac_sta_add(struct mt76_dev *mdev, struct ieee80211_vif *vif, msta->wcid.sta = 1; msta->wcid.idx = idx; msta->wcid.phy_idx = band_idx; - msta->wcid.tx_info |= MT_WCID_TX_INFO_SET; ewma_avg_signal_init(&msta->avg_ack_signal); mt7996_mac_wtbl_update(dev, idx, MT_WTBL_UPDATE_ADM_COUNT_CLEAR); + mt7996_mcu_add_sta(dev, vif, sta, CONN_STATE_DISCONNECT, true); - ret = mt7996_mcu_add_sta(dev, vif, sta, true, true); - if (ret) - return ret; + return 0; +} - return mt7996_mcu_add_rate_ctrl(dev, vif, sta, false); +int mt7996_mac_sta_event(struct mt76_dev *mdev, struct ieee80211_vif *vif, + struct ieee80211_sta *sta, enum mt76_sta_event ev) +{ + struct mt7996_dev *dev = container_of(mdev, struct mt7996_dev, mt76); + struct mt7996_sta *msta = (struct mt7996_sta *)sta->drv_priv; + int i, ret; + + switch (ev) { + case MT76_STA_EVENT_ASSOC: + ret = mt7996_mcu_add_sta(dev, vif, sta, CONN_STATE_CONNECT, true); + if (ret) + return ret; + + ret = mt7996_mcu_add_rate_ctrl(dev, vif, sta, false); + if (ret) + return ret; + + msta->wcid.tx_info |= MT_WCID_TX_INFO_SET; + msta->wcid.sta = 1; + + return 0; + + case MT76_STA_EVENT_AUTHORIZE: + return mt7996_mcu_add_sta(dev, vif, sta, CONN_STATE_PORT_SECURE, false); + + case MT76_STA_EVENT_DISASSOC: + for (i = 0; i < ARRAY_SIZE(msta->twt.flow); i++) + mt7996_mac_twt_teardown_flow(dev, msta, i); + + mt7996_mcu_add_sta(dev, vif, sta, CONN_STATE_DISCONNECT, false); + msta->wcid.sta_disabled = 1; + msta->wcid.sta = 0; + + return 0; + } + + return 0; } void mt7996_mac_sta_remove(struct mt76_dev *mdev, struct ieee80211_vif *vif, @@ -694,16 +732,10 @@ void mt7996_mac_sta_remove(struct mt76_dev *mdev, struct ieee80211_vif *vif, { struct mt7996_dev *dev = container_of(mdev, struct mt7996_dev, mt76); struct mt7996_sta *msta = (struct mt7996_sta *)sta->drv_priv; - int i; - - mt7996_mcu_add_sta(dev, vif, sta, false, false); mt7996_mac_wtbl_update(dev, msta->wcid.idx, MT_WTBL_UPDATE_ADM_COUNT_CLEAR); - for (i = 0; i < ARRAY_SIZE(msta->twt.flow); i++) - mt7996_mac_twt_teardown_flow(dev, msta, i); - spin_lock_bh(&mdev->sta_poll_lock); if (!list_empty(&msta->wcid.poll_list)) list_del_init(&msta->wcid.poll_list); @@ -808,22 +840,6 @@ mt7996_ampdu_action(struct ieee80211_hw *hw, struct ieee80211_vif *vif, return ret; } -static int -mt7996_sta_add(struct ieee80211_hw *hw, struct ieee80211_vif *vif, - struct ieee80211_sta *sta) -{ - return mt76_sta_state(hw, vif, sta, IEEE80211_STA_NOTEXIST, - IEEE80211_STA_NONE); -} - -static int -mt7996_sta_remove(struct ieee80211_hw *hw, struct ieee80211_vif *vif, - struct ieee80211_sta *sta) -{ - return mt76_sta_state(hw, vif, sta, IEEE80211_STA_NONE, - IEEE80211_STA_NOTEXIST); -} - static int mt7996_get_stats(struct ieee80211_hw *hw, struct ieee80211_low_level_stats *stats) @@ -1100,6 +1116,9 @@ static void mt7996_sta_set_4addr(struct ieee80211_hw *hw, else clear_bit(MT_WCID_FLAG_4ADDR, &msta->wcid.flags); + if (!msta->wcid.sta) + return; + mt7996_mcu_wtbl_update_hdr_trans(dev, vif, sta); } @@ -1116,6 +1135,9 @@ static void mt7996_sta_set_decap_offload(struct ieee80211_hw *hw, else clear_bit(MT_WCID_FLAG_HDR_TRANS, &msta->wcid.flags); + if (!msta->wcid.sta) + return; + mt7996_mcu_wtbl_update_hdr_trans(dev, vif, sta); } @@ -1429,7 +1451,7 @@ mt7996_net_fill_forward_path(struct ieee80211_hw *hw, if (!mtk_wed_device_active(wed)) return -ENODEV; - if (msta->wcid.idx > MT7996_WTBL_STA) + if (!msta->wcid.sta || msta->wcid.idx > MT7996_WTBL_STA) return -EIO; path->type = DEV_PATH_MTK_WDMA; @@ -1461,8 +1483,7 @@ const struct ieee80211_ops mt7996_ops = { .conf_tx = mt7996_conf_tx, .configure_filter = mt7996_configure_filter, .bss_info_changed = mt7996_bss_info_changed, - .sta_add = mt7996_sta_add, - .sta_remove = mt7996_sta_remove, + .sta_state = mt76_sta_state, .sta_pre_rcu_remove = mt76_sta_pre_rcu_remove, .link_sta_rc_update = mt7996_sta_rc_update, .set_key = mt7996_set_key, diff --git a/drivers/net/wireless/mediatek/mt76/mt7996/mcu.c b/drivers/net/wireless/mediatek/mt76/mt7996/mcu.c index 29b6e0565868..b3c7f4196ab4 100644 --- a/drivers/net/wireless/mediatek/mt76/mt7996/mcu.c +++ b/drivers/net/wireless/mediatek/mt76/mt7996/mcu.c @@ -2169,13 +2169,12 @@ mt7996_mcu_add_group(struct mt7996_dev *dev, struct ieee80211_vif *vif, } int mt7996_mcu_add_sta(struct mt7996_dev *dev, struct ieee80211_vif *vif, - struct ieee80211_sta *sta, bool enable, bool newly) + struct ieee80211_sta *sta, int conn_state, bool newly) { struct mt7996_vif *mvif = (struct mt7996_vif *)vif->drv_priv; struct ieee80211_link_sta *link_sta; struct mt7996_sta *msta; struct sk_buff *skb; - int conn_state; int ret; msta = sta ? (struct mt7996_sta *)sta->drv_priv : &mvif->sta; @@ -2188,11 +2187,10 @@ int mt7996_mcu_add_sta(struct mt7996_dev *dev, struct ieee80211_vif *vif, return PTR_ERR(skb); /* starec basic */ - conn_state = enable ? CONN_STATE_PORT_SECURE : CONN_STATE_DISCONNECT; mt76_connac_mcu_sta_basic_tlv(&dev->mt76, skb, vif, link_sta, conn_state, newly); - if (!enable) + if (conn_state == CONN_STATE_DISCONNECT) goto out; /* starec hdr trans */ diff --git a/drivers/net/wireless/mediatek/mt76/mt7996/mmio.c b/drivers/net/wireless/mediatek/mt76/mt7996/mmio.c index 40e45fb2b626..f9aa12866a2e 100644 --- a/drivers/net/wireless/mediatek/mt76/mt7996/mmio.c +++ b/drivers/net/wireless/mediatek/mt76/mt7996/mmio.c @@ -618,6 +618,7 @@ struct mt7996_dev *mt7996_mmio_probe(struct device *pdev, .rx_check = mt7996_rx_check, .rx_poll_complete = mt7996_rx_poll_complete, .sta_add = mt7996_mac_sta_add, + .sta_event = mt7996_mac_sta_event, .sta_remove = mt7996_mac_sta_remove, .update_survey = mt7996_update_channel, .set_channel = mt7996_set_channel, diff --git a/drivers/net/wireless/mediatek/mt76/mt7996/mt7996.h b/drivers/net/wireless/mediatek/mt76/mt7996/mt7996.h index ad10329d6b44..d2bc96877797 100644 --- a/drivers/net/wireless/mediatek/mt76/mt7996/mt7996.h +++ b/drivers/net/wireless/mediatek/mt76/mt7996/mt7996.h @@ -502,7 +502,7 @@ int mt7996_mcu_add_dev_info(struct mt7996_phy *phy, int mt7996_mcu_add_bss_info(struct mt7996_phy *phy, struct ieee80211_vif *vif, int enable); int mt7996_mcu_add_sta(struct mt7996_dev *dev, struct ieee80211_vif *vif, - struct ieee80211_sta *sta, bool enable, bool newly); + struct ieee80211_sta *sta, int conn_state, bool newly); int mt7996_mcu_add_tx_ba(struct mt7996_dev *dev, struct ieee80211_ampdu_params *params, bool add); @@ -626,6 +626,8 @@ void mt7996_mac_write_txwi(struct mt7996_dev *dev, __le32 *txwi, void mt7996_mac_set_coverage_class(struct mt7996_phy *phy); int mt7996_mac_sta_add(struct mt76_dev *mdev, struct ieee80211_vif *vif, struct ieee80211_sta *sta); +int mt7996_mac_sta_event(struct mt76_dev *mdev, struct ieee80211_vif *vif, + struct ieee80211_sta *sta, enum mt76_sta_event ev); void mt7996_mac_sta_remove(struct mt76_dev *mdev, struct ieee80211_vif *vif, struct ieee80211_sta *sta); void mt7996_mac_work(struct work_struct *work); From patchwork Mon Dec 30 19:42:02 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Felix Fietkau X-Patchwork-Id: 854368 Received: from nbd.name (nbd.name [46.4.11.11]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id A32C619ADA4 for ; Mon, 30 Dec 2024 19:42:13 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=46.4.11.11 ARC-Seal: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1735587735; cv=none; b=gHQOmCqerIQ87LS+rRdqqGHUTdTnGd/o7b0l9hEDEBwdflgKa9zt0bFRhN1It8O9TSC7mL0CwEBVNx01tqHRmTvC36WCwKhPdQEUH3MHROibFldwqgCiNW8kFZrEuu0VzsOUt8BWcGe5diAsX5AU+WS0vGObRoMA/LkgYA/fpFM= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1735587735; c=relaxed/simple; bh=v3qbOXpgEum+0L51Yp8G1ReukbFiuMr4wXE/SkSz3KY=; h=From:To:Subject:Date:Message-ID:In-Reply-To:References: MIME-Version; b=EyZ8QZX9Doy/DLSlHrHO3VXKWepyjP9HTJm40R4UYRFZqYYDx37DnspPIQ/QwEDueIZb6811u88F/TqyZP6uEZumEJSXDPgoAuVN4RDhxwNDUMtzkIl+p8KU3WaXRTHwuG6ux4Fg1ypcJWzTWuiPyPDv2V4sr+seWlV6g1pSKlc= ARC-Authentication-Results: i=1; smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=nbd.name; spf=none smtp.mailfrom=nbd.name; dkim=pass (1024-bit key) header.d=nbd.name header.i=@nbd.name header.b=JUPrNXxb; arc=none smtp.client-ip=46.4.11.11 Authentication-Results: smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=nbd.name Authentication-Results: smtp.subspace.kernel.org; spf=none smtp.mailfrom=nbd.name Authentication-Results: smtp.subspace.kernel.org; dkim=pass (1024-bit key) header.d=nbd.name header.i=@nbd.name header.b="JUPrNXxb" DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=nbd.name; s=20160729; h=Content-Transfer-Encoding:MIME-Version:References:In-Reply-To: Message-ID:Date:Subject:To:From:Sender:Reply-To:Cc:Content-Type:Content-ID: Content-Description:Resent-Date:Resent-From:Resent-Sender:Resent-To:Resent-Cc :Resent-Message-ID:List-Id:List-Help:List-Unsubscribe:List-Subscribe: List-Post:List-Owner:List-Archive; bh=qoY2i8BoUdLuFv+4+eR0xHQSVSACGLYFbM6e1qsfWX8=; b=JUPrNXxbPJY8of1IUFMoY6ZaEK l/mEpD0cPOTdQH2RNLNh2rb1Kkfe2IjaN2E0W9T0LIWoKLHhJ4XmeT0g7VVz87AUmloCmow39oUgM 3Q7PnW81Y+nr1+l4Rkl4AMV4VksMHDsdOhJWg4ZHqf+BHKIqmiNTouISHdj5SnpNonPI=; Received: from p4ff13c5f.dip0.t-ipconnect.de ([79.241.60.95] helo=Maecks.lan) by ds12 with esmtpsa (TLS1.3) tls TLS_ECDHE_RSA_WITH_CHACHA20_POLY1305_SHA256 (Exim 4.96) (envelope-from ) id 1tSLeV-00GKzc-2c for linux-wireless@vger.kernel.org; Mon, 30 Dec 2024 20:42:11 +0100 From: Felix Fietkau To: linux-wireless@vger.kernel.org Subject: [PATCH 14/14] wifi: mt76: do not add wcid entries to sta poll list during MCU reset Date: Mon, 30 Dec 2024 20:42:02 +0100 Message-ID: <20241230194202.95065-14-nbd@nbd.name> X-Mailer: git-send-email 2.47.1 In-Reply-To: <20241230194202.95065-1-nbd@nbd.name> References: <20241230194202.95065-1-nbd@nbd.name> Precedence: bulk X-Mailing-List: linux-wireless@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 Fixes linked list management issues during restart, where sta entries can be recreated and reinitialized while still in the poll list, triggering kernel warnings. Signed-off-by: Felix Fietkau --- drivers/net/wireless/mediatek/mt76/mac80211.c | 12 ++++++++++++ drivers/net/wireless/mediatek/mt76/mt76.h | 1 + drivers/net/wireless/mediatek/mt76/mt7603/mac.c | 7 +------ drivers/net/wireless/mediatek/mt76/mt7615/mac.c | 12 ++---------- .../wireless/mediatek/mt76/mt76_connac_mac.c | 6 +----- drivers/net/wireless/mediatek/mt76/mt7915/mac.c | 17 +++-------------- drivers/net/wireless/mediatek/mt76/mt7921/mac.c | 17 +++-------------- drivers/net/wireless/mediatek/mt76/mt7925/mac.c | 17 +++-------------- drivers/net/wireless/mediatek/mt76/mt7996/mac.c | 17 +++-------------- 9 files changed, 29 insertions(+), 77 deletions(-) diff --git a/drivers/net/wireless/mediatek/mt76/mac80211.c b/drivers/net/wireless/mediatek/mt76/mac80211.c index 3642c490fa6d..6db59652be6e 100644 --- a/drivers/net/wireless/mediatek/mt76/mac80211.c +++ b/drivers/net/wireless/mediatek/mt76/mac80211.c @@ -1595,6 +1595,18 @@ void mt76_wcid_cleanup(struct mt76_dev *dev, struct mt76_wcid *wcid) } EXPORT_SYMBOL_GPL(mt76_wcid_cleanup); +void mt76_wcid_add_poll(struct mt76_dev *dev, struct mt76_wcid *wcid) +{ + if (test_bit(MT76_MCU_RESET, &dev->phy.state)) + return; + + spin_lock_bh(&dev->sta_poll_lock); + if (list_empty(&wcid->poll_list)) + list_add_tail(&wcid->poll_list, &dev->sta_poll_list); + spin_unlock_bh(&dev->sta_poll_lock); +} +EXPORT_SYMBOL_GPL(mt76_wcid_add_poll); + int mt76_get_txpower(struct ieee80211_hw *hw, struct ieee80211_vif *vif, unsigned int link_id, int *dbm) { diff --git a/drivers/net/wireless/mediatek/mt76/mt76.h b/drivers/net/wireless/mediatek/mt76/mt76.h index 3bc591c14b65..34b6b094b8eb 100644 --- a/drivers/net/wireless/mediatek/mt76/mt76.h +++ b/drivers/net/wireless/mediatek/mt76/mt76.h @@ -1735,5 +1735,6 @@ mt76_token_put(struct mt76_dev *dev, int token) void mt76_wcid_init(struct mt76_wcid *wcid); void mt76_wcid_cleanup(struct mt76_dev *dev, struct mt76_wcid *wcid); +void mt76_wcid_add_poll(struct mt76_dev *dev, struct mt76_wcid *wcid); #endif diff --git a/drivers/net/wireless/mediatek/mt76/mt7603/mac.c b/drivers/net/wireless/mediatek/mt76/mt7603/mac.c index dc8a77f0a1cc..dafa4b05f623 100644 --- a/drivers/net/wireless/mediatek/mt76/mt7603/mac.c +++ b/drivers/net/wireless/mediatek/mt76/mt7603/mac.c @@ -1277,12 +1277,7 @@ void mt7603_mac_add_txs(struct mt7603_dev *dev, void *data) msta = container_of(wcid, struct mt7603_sta, wcid); sta = wcid_to_sta(wcid); - - if (list_empty(&msta->wcid.poll_list)) { - spin_lock_bh(&dev->mt76.sta_poll_lock); - list_add_tail(&msta->wcid.poll_list, &dev->mt76.sta_poll_list); - spin_unlock_bh(&dev->mt76.sta_poll_lock); - } + mt76_wcid_add_poll(&dev->mt76, &msta->wcid); if (mt7603_mac_add_txs_skb(dev, msta, pid, txs_data)) goto out; diff --git a/drivers/net/wireless/mediatek/mt76/mt7615/mac.c b/drivers/net/wireless/mediatek/mt76/mt7615/mac.c index 7ba789834e8d..27c3857bcd7b 100644 --- a/drivers/net/wireless/mediatek/mt76/mt7615/mac.c +++ b/drivers/net/wireless/mediatek/mt76/mt7615/mac.c @@ -387,11 +387,7 @@ static int mt7615_mac_fill_rx(struct mt7615_dev *dev, struct sk_buff *skb) struct mt7615_sta *msta; msta = container_of(status->wcid, struct mt7615_sta, wcid); - spin_lock_bh(&dev->mt76.sta_poll_lock); - if (list_empty(&msta->wcid.poll_list)) - list_add_tail(&msta->wcid.poll_list, - &dev->mt76.sta_poll_list); - spin_unlock_bh(&dev->mt76.sta_poll_lock); + mt76_wcid_add_poll(&dev->mt76, &msta->wcid); } if (mt76_is_mmio(&dev->mt76) && (rxd0 & csum_mask) == csum_mask && @@ -1514,11 +1510,7 @@ static void mt7615_mac_add_txs(struct mt7615_dev *dev, void *data) msta = container_of(wcid, struct mt7615_sta, wcid); sta = wcid_to_sta(wcid); - - spin_lock_bh(&dev->mt76.sta_poll_lock); - if (list_empty(&msta->wcid.poll_list)) - list_add_tail(&msta->wcid.poll_list, &dev->mt76.sta_poll_list); - spin_unlock_bh(&dev->mt76.sta_poll_lock); + mt76_wcid_add_poll(&dev->mt76, &msta->wcid); if (mt7615_mac_add_txs_skb(dev, msta, pid, txs_data)) goto out; diff --git a/drivers/net/wireless/mediatek/mt76/mt76_connac_mac.c b/drivers/net/wireless/mediatek/mt76/mt76_connac_mac.c index a72551ba27e4..f719457e39b2 100644 --- a/drivers/net/wireless/mediatek/mt76/mt76_connac_mac.c +++ b/drivers/net/wireless/mediatek/mt76/mt76_connac_mac.c @@ -1174,11 +1174,7 @@ void mt76_connac2_txwi_free(struct mt76_dev *dev, struct mt76_txwi_cache *t, if (wcid && wcid->sta) { sta = container_of((void *)wcid, struct ieee80211_sta, drv_priv); - spin_lock_bh(&dev->sta_poll_lock); - if (list_empty(&wcid->poll_list)) - list_add_tail(&wcid->poll_list, - &dev->sta_poll_list); - spin_unlock_bh(&dev->sta_poll_lock); + mt76_wcid_add_poll(dev, wcid); } } diff --git a/drivers/net/wireless/mediatek/mt76/mt7915/mac.c b/drivers/net/wireless/mediatek/mt76/mt7915/mac.c index e2693aea2e8e..13bdc0a7174c 100644 --- a/drivers/net/wireless/mediatek/mt76/mt7915/mac.c +++ b/drivers/net/wireless/mediatek/mt76/mt7915/mac.c @@ -333,11 +333,7 @@ mt7915_mac_fill_rx(struct mt7915_dev *dev, struct sk_buff *skb, if (status->wcid) { msta = container_of(status->wcid, struct mt7915_sta, wcid); - spin_lock_bh(&dev->mt76.sta_poll_lock); - if (list_empty(&msta->wcid.poll_list)) - list_add_tail(&msta->wcid.poll_list, - &dev->mt76.sta_poll_list); - spin_unlock_bh(&dev->mt76.sta_poll_lock); + mt76_wcid_add_poll(&dev->mt76, &msta->wcid); } status->freq = mphy->chandef.chan->center_freq; @@ -927,11 +923,7 @@ mt7915_mac_tx_free(struct mt7915_dev *dev, void *data, int len) continue; msta = container_of(wcid, struct mt7915_sta, wcid); - spin_lock_bh(&mdev->sta_poll_lock); - if (list_empty(&msta->wcid.poll_list)) - list_add_tail(&msta->wcid.poll_list, - &mdev->sta_poll_list); - spin_unlock_bh(&mdev->sta_poll_lock); + mt76_wcid_add_poll(&dev->mt76, &msta->wcid); continue; } @@ -1040,10 +1032,7 @@ static void mt7915_mac_add_txs(struct mt7915_dev *dev, void *data) if (!wcid->sta) goto out; - spin_lock_bh(&dev->mt76.sta_poll_lock); - if (list_empty(&msta->wcid.poll_list)) - list_add_tail(&msta->wcid.poll_list, &dev->mt76.sta_poll_list); - spin_unlock_bh(&dev->mt76.sta_poll_lock); + mt76_wcid_add_poll(&dev->mt76, &msta->wcid); out: rcu_read_unlock(); diff --git a/drivers/net/wireless/mediatek/mt76/mt7921/mac.c b/drivers/net/wireless/mediatek/mt76/mt7921/mac.c index bd1455698ebe..5dd57de59f27 100644 --- a/drivers/net/wireless/mediatek/mt76/mt7921/mac.c +++ b/drivers/net/wireless/mediatek/mt76/mt7921/mac.c @@ -216,11 +216,7 @@ mt7921_mac_fill_rx(struct mt792x_dev *dev, struct sk_buff *skb) if (status->wcid) { mlink = container_of(status->wcid, struct mt792x_link_sta, wcid); msta = container_of(mlink, struct mt792x_sta, deflink); - spin_lock_bh(&dev->mt76.sta_poll_lock); - if (list_empty(&mlink->wcid.poll_list)) - list_add_tail(&mlink->wcid.poll_list, - &dev->mt76.sta_poll_list); - spin_unlock_bh(&dev->mt76.sta_poll_lock); + mt76_wcid_add_poll(&dev->mt76, &mlink->wcid); } mt792x_get_status_freq_info(status, chfreq); @@ -479,10 +475,7 @@ void mt7921_mac_add_txs(struct mt792x_dev *dev, void *data) if (!wcid->sta) goto out; - spin_lock_bh(&dev->mt76.sta_poll_lock); - if (list_empty(&mlink->wcid.poll_list)) - list_add_tail(&mlink->wcid.poll_list, &dev->mt76.sta_poll_list); - spin_unlock_bh(&dev->mt76.sta_poll_lock); + mt76_wcid_add_poll(&dev->mt76, &mlink->wcid); out: rcu_read_unlock(); @@ -529,11 +522,7 @@ static void mt7921_mac_tx_free(struct mt792x_dev *dev, void *data, int len) continue; mlink = container_of(wcid, struct mt792x_link_sta, wcid); - spin_lock_bh(&mdev->sta_poll_lock); - if (list_empty(&mlink->wcid.poll_list)) - list_add_tail(&mlink->wcid.poll_list, - &mdev->sta_poll_list); - spin_unlock_bh(&mdev->sta_poll_lock); + mt76_wcid_add_poll(&dev->mt76, &mlink->wcid); continue; } diff --git a/drivers/net/wireless/mediatek/mt76/mt7925/mac.c b/drivers/net/wireless/mediatek/mt76/mt7925/mac.c index a095fb31e391..187770537a1a 100644 --- a/drivers/net/wireless/mediatek/mt76/mt7925/mac.c +++ b/drivers/net/wireless/mediatek/mt76/mt7925/mac.c @@ -395,11 +395,7 @@ mt7925_mac_fill_rx(struct mt792x_dev *dev, struct sk_buff *skb) if (status->wcid) { mlink = container_of(status->wcid, struct mt792x_link_sta, wcid); - spin_lock_bh(&dev->mt76.sta_poll_lock); - if (list_empty(&mlink->wcid.poll_list)) - list_add_tail(&mlink->wcid.poll_list, - &dev->mt76.sta_poll_list); - spin_unlock_bh(&dev->mt76.sta_poll_lock); + mt76_wcid_add_poll(&dev->mt76, &mlink->wcid); } mt792x_get_status_freq_info(status, chfreq); @@ -1054,10 +1050,7 @@ void mt7925_mac_add_txs(struct mt792x_dev *dev, void *data) if (!wcid->sta) goto out; - spin_lock_bh(&dev->mt76.sta_poll_lock); - if (list_empty(&mlink->wcid.poll_list)) - list_add_tail(&mlink->wcid.poll_list, &dev->mt76.sta_poll_list); - spin_unlock_bh(&dev->mt76.sta_poll_lock); + mt76_wcid_add_poll(&dev->mt76, &mlink->wcid); out: rcu_read_unlock(); @@ -1135,11 +1128,7 @@ mt7925_mac_tx_free(struct mt792x_dev *dev, void *data, int len) continue; mlink = container_of(wcid, struct mt792x_link_sta, wcid); - spin_lock_bh(&mdev->sta_poll_lock); - if (list_empty(&mlink->wcid.poll_list)) - list_add_tail(&mlink->wcid.poll_list, - &mdev->sta_poll_list); - spin_unlock_bh(&mdev->sta_poll_lock); + mt76_wcid_add_poll(&dev->mt76, &mlink->wcid); continue; } diff --git a/drivers/net/wireless/mediatek/mt76/mt7996/mac.c b/drivers/net/wireless/mediatek/mt76/mt7996/mac.c index 4706ddefea9e..8e3620d8a7c8 100644 --- a/drivers/net/wireless/mediatek/mt76/mt7996/mac.c +++ b/drivers/net/wireless/mediatek/mt76/mt7996/mac.c @@ -478,11 +478,7 @@ mt7996_mac_fill_rx(struct mt7996_dev *dev, enum mt76_rxq_id q, if (status->wcid) { msta = container_of(status->wcid, struct mt7996_sta, wcid); - spin_lock_bh(&dev->mt76.sta_poll_lock); - if (list_empty(&msta->wcid.poll_list)) - list_add_tail(&msta->wcid.poll_list, - &dev->mt76.sta_poll_list); - spin_unlock_bh(&dev->mt76.sta_poll_lock); + mt76_wcid_add_poll(&dev->mt76, &msta->wcid); } status->freq = mphy->chandef.chan->center_freq; @@ -1149,11 +1145,7 @@ mt7996_mac_tx_free(struct mt7996_dev *dev, void *data, int len) continue; msta = container_of(wcid, struct mt7996_sta, wcid); - spin_lock_bh(&mdev->sta_poll_lock); - if (list_empty(&msta->wcid.poll_list)) - list_add_tail(&msta->wcid.poll_list, - &mdev->sta_poll_list); - spin_unlock_bh(&mdev->sta_poll_lock); + mt76_wcid_add_poll(&dev->mt76, &msta->wcid); continue; } else if (info & MT_TXFREE_INFO_HEADER) { u32 tx_retries = 0, tx_failed = 0; @@ -1379,10 +1371,7 @@ static void mt7996_mac_add_txs(struct mt7996_dev *dev, void *data) if (!wcid->sta) goto out; - spin_lock_bh(&dev->mt76.sta_poll_lock); - if (list_empty(&msta->wcid.poll_list)) - list_add_tail(&msta->wcid.poll_list, &dev->mt76.sta_poll_list); - spin_unlock_bh(&dev->mt76.sta_poll_lock); + mt76_wcid_add_poll(&dev->mt76, &msta->wcid); out: rcu_read_unlock();