Received: by 2002:a05:6a10:2726:0:0:0:0 with SMTP id ib38csp666469pxb; Tue, 5 Apr 2022 17:59:03 -0700 (PDT) X-Google-Smtp-Source: ABdhPJwizhpVnSkMUn8BBuuxMM88zNrNto73OMl5cNFmdbwUiokr4WkeYYAFAb9kTpF3ihIceQFB X-Received: by 2002:a17:907:3fa8:b0:6d3:477a:efe with SMTP id hr40-20020a1709073fa800b006d3477a0efemr6146407ejc.401.1649206661096; Tue, 05 Apr 2022 17:57:41 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1649206661; cv=none; d=google.com; s=arc-20160816; b=GeJ+G4x15TwdnOzxm0NixW9VGl7t/duFrHVf0C/eilzm/Ec6+rPcbGmss/Mlbz7M4u 0x0dgCODyoCkzTochIigeN9ncYSzDYnzH7n7L6wiC70i5sejiUaMc2/xYVKEcgpY3IcG y7FlhbF3NbvRIl22W2kmT3ccoEfFeVefllAQTpW0sWWV+5Dv3CAs8dSv2xB4lQpGc+ZF g4uig9jIldgPCZhLNsKnul/TvEt3o0AdOCaCeQYEr4PQfLG+gFl1Z8qFXIxykEjbITlb hqzwLtq9xq6h/GS8RBV+91axItI3J1f/kDaBmZqE10Fg31hZ8CCjFPrOFT1/rADNoseh m7fA== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:content-transfer-encoding:mime-version :user-agent:references:in-reply-to:message-id:date:subject:cc:to :from:dkim-signature; bh=yZ077NlURMMTCzF9Ec/iIhjJS/YXntY9LgrK/9iGP30=; b=MXHPcHb0UvpNpa1tchuc1/w2p1J338Dv+WZh7XGT7+Ze+aV0z5uP2qzkAWqdsJFNs3 SY5iSB38I9u1JIjKkPhDCDS5MuSHegbrDZ0rCeODKhWEVta4lcz9GamofEfuF6eCqUAe dWWOZEZA5cl1p63pcSXHfifWi6Y3017qMQM9y46ATV2DytOL2eCE1PsCvvYeuBtOXwf/ PzJswKxfAOnijDz8Cwg+hpn6xAd4OU6N33vslWL9Kvpj4fUf4k7rxRXWuHUi0UbdDEyV FVK4+Fz4ZGkg7NlBqMjgvXVeEO5XkiL+Kc9glWmzGCLbIZwIKNswZ3Nu8OtVU5EadMpt RJRQ== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linuxfoundation.org header.s=korg header.b=iTo95TRA; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linuxfoundation.org Return-Path: Received: from out1.vger.email (out1.vger.email. [2620:137:e000::1:20]) by mx.google.com with ESMTP id z9-20020a50da09000000b00418c2b5be18si9883155edj.250.2022.04.05.17.57.14; Tue, 05 Apr 2022 17:57:41 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) client-ip=2620:137:e000::1:20; Authentication-Results: mx.google.com; dkim=pass header.i=@linuxfoundation.org header.s=korg header.b=iTo95TRA; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linuxfoundation.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S240282AbiDEIp4 (ORCPT + 99 others); Tue, 5 Apr 2022 04:45:56 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:34434 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S233302AbiDEIFo (ORCPT ); Tue, 5 Apr 2022 04:05:44 -0400 Received: from ams.source.kernel.org (ams.source.kernel.org [IPv6:2604:1380:4601:e00::1]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 869A369721; Tue, 5 Apr 2022 01:01:40 -0700 (PDT) Received: from smtp.kernel.org (relay.kernel.org [52.25.139.140]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by ams.source.kernel.org (Postfix) with ESMTPS id 3C366B81BD2; Tue, 5 Apr 2022 08:01:39 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id 848C7C385A1; Tue, 5 Apr 2022 08:01:37 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1649145697; bh=+uT5Ye7XddJYP9EeU9g+A2Lu0fSDfDTC6tTo3V9nwb0=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=iTo95TRAduqF4+is/UOWFi1+27twp8qJv+DW4RGoQEdf4CRKxgApx7ZkOONl3mb3M e5lvAULahnb0NfAYRDV2OOTATkJEmZhr6/uI63jqye5pQcV47BAjUXZ/gcEypOjEDw RuxDJOvMMvK/jZ/l0MP0UYMymnfTdUPf/2+HpBRg= From: Greg Kroah-Hartman To: linux-kernel@vger.kernel.org Cc: Greg Kroah-Hartman , stable@vger.kernel.org, Sean Wang , Felix Fietkau , Sasha Levin Subject: [PATCH 5.17 0496/1126] mt76: mt7921: set EDCA parameters with the MCU CE command Date: Tue, 5 Apr 2022 09:20:43 +0200 Message-Id: <20220405070422.185983805@linuxfoundation.org> X-Mailer: git-send-email 2.35.1 In-Reply-To: <20220405070407.513532867@linuxfoundation.org> References: <20220405070407.513532867@linuxfoundation.org> User-Agent: quilt/0.66 MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-Spam-Status: No, score=-7.1 required=5.0 tests=BAYES_00,DKIMWL_WL_HIGH, DKIM_SIGNED,DKIM_VALID,DKIM_VALID_AU,DKIM_VALID_EF,RCVD_IN_DNSWL_HI, SPF_HELO_NONE,SPF_PASS,T_SCC_BODY_TEXT_LINE autolearn=ham autolearn_force=no version=3.4.6 X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on lindbergh.monkeyblade.net Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org From: Sean Wang [ Upstream commit 66ca1a7b2d5503f561b751abdd6ec6fa96343eb6 ] The command MCU_EXT_CMD_EDCA_UPDATE is not fully supported by the MT7921 firmware, so we apply CE command MCU_CE_CMD_SET_EDCA_PARAMS instead which is supported even in the oldest firmware to properly set up EDCA parameters for each AC. Fixes: 1c099ab44727 ("mt76: mt7921: add MCU support") Signed-off-by: Sean Wang Signed-off-by: Felix Fietkau Signed-off-by: Sasha Levin --- .../wireless/mediatek/mt76/mt76_connac_mcu.h | 1 + .../net/wireless/mediatek/mt76/mt7921/mcu.c | 49 ++++++++----------- 2 files changed, 22 insertions(+), 28 deletions(-) diff --git a/drivers/net/wireless/mediatek/mt76/mt76_connac_mcu.h b/drivers/net/wireless/mediatek/mt76/mt76_connac_mcu.h index 265d64e3ca8c..93c783a3af7c 100644 --- a/drivers/net/wireless/mediatek/mt76/mt76_connac_mcu.h +++ b/drivers/net/wireless/mediatek/mt76/mt76_connac_mcu.h @@ -997,6 +997,7 @@ enum { MCU_CE_CMD_SET_BSS_ABORT = 0x17, MCU_CE_CMD_CANCEL_HW_SCAN = 0x1b, MCU_CE_CMD_SET_ROC = 0x1c, + MCU_CE_CMD_SET_EDCA_PARMS = 0x1d, MCU_CE_CMD_SET_P2P_OPPPS = 0x33, MCU_CE_CMD_SET_RATE_TX_POWER = 0x5d, MCU_CE_CMD_SCHED_SCAN_ENABLE = 0x61, diff --git a/drivers/net/wireless/mediatek/mt76/mt7921/mcu.c b/drivers/net/wireless/mediatek/mt76/mt7921/mcu.c index ef1e1ef91611..152e7579f77d 100644 --- a/drivers/net/wireless/mediatek/mt76/mt7921/mcu.c +++ b/drivers/net/wireless/mediatek/mt76/mt7921/mcu.c @@ -920,33 +920,28 @@ EXPORT_SYMBOL_GPL(mt7921_mcu_exit); int mt7921_mcu_set_tx(struct mt7921_dev *dev, struct ieee80211_vif *vif) { -#define WMM_AIFS_SET BIT(0) -#define WMM_CW_MIN_SET BIT(1) -#define WMM_CW_MAX_SET BIT(2) -#define WMM_TXOP_SET BIT(3) -#define WMM_PARAM_SET GENMASK(3, 0) -#define TX_CMD_MODE 1 + struct mt7921_vif *mvif = (struct mt7921_vif *)vif->drv_priv; + struct edca { - u8 queue; - u8 set; - u8 aifs; - u8 cw_min; + __le16 cw_min; __le16 cw_max; __le16 txop; - }; + __le16 aifs; + u8 guardtime; + u8 acm; + } __packed; struct mt7921_mcu_tx { - u8 total; - u8 action; - u8 valid; - u8 mode; - struct edca edca[IEEE80211_NUM_ACS]; + u8 bss_idx; + u8 qos; + u8 wmm_idx; + u8 pad; } __packed req = { - .valid = true, - .mode = TX_CMD_MODE, - .total = IEEE80211_NUM_ACS, + .bss_idx = mvif->mt76.idx, + .qos = vif->bss_conf.qos, + .wmm_idx = mvif->mt76.wmm_idx, }; - struct mt7921_vif *mvif = (struct mt7921_vif *)vif->drv_priv; + struct mu_edca { u8 cw_min; u8 cw_max; @@ -970,30 +965,29 @@ int mt7921_mcu_set_tx(struct mt7921_dev *dev, struct ieee80211_vif *vif) .qos = vif->bss_conf.qos, .wmm_idx = mvif->mt76.wmm_idx, }; + int to_aci[] = {1, 0, 2, 3}; int ac, ret; for (ac = 0; ac < IEEE80211_NUM_ACS; ac++) { struct ieee80211_tx_queue_params *q = &mvif->queue_params[ac]; - struct edca *e = &req.edca[ac]; + struct edca *e = &req.edca[to_aci[ac]]; - e->set = WMM_PARAM_SET; - e->queue = ac + mvif->mt76.wmm_idx * MT7921_MAX_WMM_SETS; e->aifs = q->aifs; e->txop = cpu_to_le16(q->txop); if (q->cw_min) - e->cw_min = fls(q->cw_min); + e->cw_min = cpu_to_le16(q->cw_min); else e->cw_min = 5; if (q->cw_max) - e->cw_max = cpu_to_le16(fls(q->cw_max)); + e->cw_max = cpu_to_le16(q->cw_max); else e->cw_max = cpu_to_le16(10); } - ret = mt76_mcu_send_msg(&dev->mt76, MCU_EXT_CMD(EDCA_UPDATE), - &req, sizeof(req), true); + ret = mt76_mcu_send_msg(&dev->mt76, MCU_CE_CMD(SET_EDCA_PARMS), &req, + sizeof(req), false); if (ret) return ret; @@ -1003,7 +997,6 @@ int mt7921_mcu_set_tx(struct mt7921_dev *dev, struct ieee80211_vif *vif) for (ac = 0; ac < IEEE80211_NUM_ACS; ac++) { struct ieee80211_he_mu_edca_param_ac_rec *q; struct mu_edca *e; - int to_aci[] = {1, 0, 2, 3}; if (!mvif->queue_params[ac].mu_edca) break; -- 2.34.1