From patchwork Tue Mar 5 17:55:35 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Chad Monroe X-Patchwork-Id: 13582821 X-Patchwork-Delegate: nbd@nbd.name Received: from mail-4317.proton.ch (mail-4317.proton.ch [185.70.43.17]) (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 91BCEDF5B for ; Tue, 5 Mar 2024 17:56:07 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=185.70.43.17 ARC-Seal: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1709661371; cv=none; b=rrREvUSOFc9Cq9bEL0ZqsWXzia56J6UUkpw+HM1SzMEu2QC8USSX74zXXz33NNDiY8Heg1pIb5ZtOEF1ZD2R09sK4s25Ft8gFKB5H2btOHr9EfhePUZmlTLCsAQI/aFgS/RRo8xhWRxEriMLmIXvbSiuF/feuAI5HZ+oaPyHBbY= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1709661371; c=relaxed/simple; bh=oDsOsTeiTrnHZ6Ml0OymUtjzxHBbtozFlOmA7lhZg3s=; h=Date:To:From:Cc:Subject:Message-ID:MIME-Version:Content-Type; b=e4SO+5q4lS4mZY4yIQ5Y5Qwq1ZlFi00hhN1a8qE+fLn8J/JZOJIx69Mht8LSoDZ5P9neUKyJcGIO6Q4sC/HiIrnciUXh4f5ZfxDclexkWpDw7u4UyzGSiyJdlrQqf6jAZcBu13q7DJuL016hKwqnjIieKfYGHiPhjooPfetll0k= ARC-Authentication-Results: i=1; smtp.subspace.kernel.org; dmarc=pass (p=quarantine dis=none) header.from=monroe.io; spf=pass smtp.mailfrom=monroe.io; dkim=pass (2048-bit key) header.d=monroe.io header.i=@monroe.io header.b=lYTe0B4H; arc=none smtp.client-ip=185.70.43.17 Authentication-Results: smtp.subspace.kernel.org; dmarc=pass (p=quarantine dis=none) header.from=monroe.io Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=monroe.io Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=monroe.io header.i=@monroe.io header.b="lYTe0B4H" DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=monroe.io; s=protonmail2; t=1709661359; x=1709920559; bh=LCfHSJif2IzTulfiAhxVZDIoy9aDonUR7qQ6uLz691o=; h=Date:To:From:Cc:Subject:Message-ID:Feedback-ID:From:To:Cc:Date: Subject:Reply-To:Feedback-ID:Message-ID:BIMI-Selector; b=lYTe0B4HlEQUx4SQEzJDZQaKmxugpsW4T4zNt82JJM8zaQoLmxHbfVyuopBecSDzJ nSvcOj7m58LPqiIvx5ByUIZRUXyiLYs0wzRevJoNdTylj9GBCTBZ6rG+C5tbwrm5WW M5ZrUnAJDVNlwrwPoG00sW7w5EALbtQde9WpGOUx5tCZDVlsgMjVetyc7nbbzi2y5W Qo0auFI7EVGvSuWESyom0ltI+YwK2OPWs6qoll+VJEBg73U/s1PZiGDrYfp2x8SePl oWH8DTrKabi7jhspVJWDTeCuCnNA6U3A02X85jrpeIhZEN6bnN3bAz+Xq1lXasEWK0 fbt4gFZf9nshQ== Date: Tue, 05 Mar 2024 17:55:35 +0000 To: Felix Fietkau , Johannes Berg From: Chad Monroe Cc: Lorenzo Bianconi , Shayne Chen , Evelyn Tsai , Ryder Lee , linux-wireless@vger.kernel.org, linux-mediatek@lists.infradead.org, Chad Monroe Subject: [PATCH] wifi: mt76: mt7996: fix size of txpower MCU command Message-ID: <301ef7cfecc47fa488fdf172596c9ed75719410e.1709657969.git.chad@monroe.io> Feedback-ID: 9731019:user:proton Precedence: bulk X-Mailing-List: linux-wireless@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 Fixes issues with scanning and low power output at some rates. Fixes: f75e4779d215 ("wifi: mt76: mt7996: add txpower setting support") Signed-off-by: Chad Monroe Signed-off-by: Ryder Lee --- drivers/net/wireless/mediatek/mt76/mt7996/mcu.c | 7 +++++-- drivers/net/wireless/mediatek/mt76/mt7996/mt7996.h | 1 + 2 files changed, 6 insertions(+), 2 deletions(-) diff --git a/drivers/net/wireless/mediatek/mt76/mt7996/mcu.c b/drivers/net/wireless/mediatek/mt76/mt7996/mcu.c index b44abe2acc81..cfb5a7d348eb 100644 --- a/drivers/net/wireless/mediatek/mt76/mt7996/mcu.c +++ b/drivers/net/wireless/mediatek/mt76/mt7996/mcu.c @@ -4464,7 +4464,7 @@ int mt7996_mcu_set_txpower_sku(struct mt7996_phy *phy) u8 band_idx; } __packed req = { .tag = cpu_to_le16(UNI_TXPOWER_POWER_LIMIT_TABLE_CTRL), - .len = cpu_to_le16(sizeof(req) + MT7996_SKU_RATE_NUM - 4), + .len = cpu_to_le16(sizeof(req) + MT7996_SKU_PATH_NUM - 4), .power_ctrl_id = UNI_TXPOWER_POWER_LIMIT_TABLE_CTRL, .power_limit_type = TX_POWER_LIMIT_TABLE_RATE, .band_idx = phy->mt76->band_idx, @@ -4479,7 +4479,7 @@ int mt7996_mcu_set_txpower_sku(struct mt7996_phy *phy) mphy->txpower_cur = tx_power; skb = mt76_mcu_msg_alloc(&dev->mt76, NULL, - sizeof(req) + MT7996_SKU_RATE_NUM); + sizeof(req) + MT7996_SKU_PATH_NUM); if (!skb) return -ENOMEM; @@ -4503,6 +4503,9 @@ int mt7996_mcu_set_txpower_sku(struct mt7996_phy *phy) /* eht */ skb_put_data(skb, &la.eht[0], sizeof(la.eht)); + /* padding */ + skb_put_zero(skb, MT7996_SKU_PATH_NUM - MT7996_SKU_RATE_NUM); + return mt76_mcu_skb_send_msg(&dev->mt76, skb, MCU_WM_UNI_CMD(TXPOWER), true); } diff --git a/drivers/net/wireless/mediatek/mt76/mt7996/mt7996.h b/drivers/net/wireless/mediatek/mt76/mt7996/mt7996.h index 36d1f247d55a..ddeb40d522c5 100644 --- a/drivers/net/wireless/mediatek/mt76/mt7996/mt7996.h +++ b/drivers/net/wireless/mediatek/mt76/mt7996/mt7996.h @@ -50,6 +50,7 @@ #define MT7996_CFEND_RATE_11B 0x03 /* 11B LP, 11M */ #define MT7996_SKU_RATE_NUM 417 +#define MT7996_SKU_PATH_NUM 494 #define MT7996_MAX_TWT_AGRT 16 #define MT7996_MAX_STA_TWT_AGRT 8