From patchwork Wed Jan 17 11:01:27 2018 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Lorenzo Bianconi X-Patchwork-Id: 10169067 X-Patchwork-Delegate: kvalo@adurom.com Return-Path: Received: from mail.wl.linuxfoundation.org (pdx-wl-mail.web.codeaurora.org [172.30.200.125]) by pdx-korg-patchwork.web.codeaurora.org (Postfix) with ESMTP id A0C2A603ED for ; Wed, 17 Jan 2018 11:01:38 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id 8EFAD28534 for ; Wed, 17 Jan 2018 11:01:38 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id 816AC28536; Wed, 17 Jan 2018 11:01:38 +0000 (UTC) X-Spam-Checker-Version: SpamAssassin 3.3.1 (2010-03-16) on pdx-wl-mail.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-6.9 required=2.0 tests=BAYES_00,RCVD_IN_DNSWL_HI autolearn=ham version=3.3.1 Received: from vger.kernel.org (vger.kernel.org [209.132.180.67]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id 6B25628534 for ; Wed, 17 Jan 2018 11:01:37 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1750872AbeAQLBf (ORCPT ); Wed, 17 Jan 2018 06:01:35 -0500 Received: from mail-wm0-f66.google.com ([74.125.82.66]:43482 "EHLO mail-wm0-f66.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1750830AbeAQLBe (ORCPT ); Wed, 17 Jan 2018 06:01:34 -0500 Received: by mail-wm0-f66.google.com with SMTP id g1so14282627wmg.2 for ; Wed, 17 Jan 2018 03:01:33 -0800 (PST) X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:from:to:cc:subject:date:message-id:in-reply-to :references; bh=vkbHUSznFPCQM9LUmypnu/2G6QBeyDSSKMgegiSxV4I=; b=lQi9CRoVOSxWpKmMlQDiPSAbfHQ0CvPRqyfe/45e4FE9fV9V5+srAMIZ4+PDkB2UDM JZ+wpdtlwrDOkALHBrNXGq6hlb3OIvlWAtxRC0YPgzpbvRhZ1VWM0zlb0S4SAMMHku/y ljmrmrVaOnq5VfOdt5PpsxVfOMuHCjfUwTT6hfygqVa3NmLjrUil0GCHilT8S3mrd7nM S5x2Q0XdscFa/rzyDQRWuI8Rn2+OHKd+9jHQnjdGkqMnKXtUHlM3/0zm9qEavDOJ5cqR g7fZCAY9OOOn8a/XLRJEXxdapRMefXEyU25QjcxQ+u2dTyjLWDy/tEam9zexgBeZrgWD Ddkw== X-Gm-Message-State: AKwxytdiIjU5/Ods52c92QCthMctIdClCqfvDA7tcqHxlzpbGK3ctljp BI4AjSpQU/O8Bw7fkbONT/GYBg== X-Google-Smtp-Source: ACJfBosyVPoN4TmRiZWB6VMY2FWSJPwPggqrIhtMjtwwA3XWEe0LoESqwYmoZ3euzxfi9FfboTlEDw== X-Received: by 10.80.214.215 with SMTP id l23mr2405769edj.44.1516186893367; Wed, 17 Jan 2018 03:01:33 -0800 (PST) Received: from localhost.localdomain.com (nat-pool-mxp-t.redhat.com. [149.6.153.186]) by smtp.gmail.com with ESMTPSA id k90sm2677558edc.20.2018.01.17.03.01.32 (version=TLS1_2 cipher=ECDHE-RSA-CHACHA20-POLY1305 bits=256/256); Wed, 17 Jan 2018 03:01:32 -0800 (PST) From: Lorenzo Bianconi To: nbd@nbd.name Cc: linux-wireless@vger.kernel.org, gaetano.catalli@gmail.com Subject: [PATCH] mt76x2: fix WMM parameter configuration Date: Wed, 17 Jan 2018 12:01:27 +0100 Message-Id: <7554b3527fd55afa7561ffc89fb7f3bea1a902ed.1516186517.git.lorenzo.bianconi@redhat.com> X-Mailer: git-send-email 2.13.6 In-Reply-To: References: Sender: linux-wireless-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-wireless@vger.kernel.org X-Virus-Scanned: ClamAV using ClamSMTP Fix hw queue configuration since mt76x2 devices use a reverse queue enumeration respect to mac80211 one: - 0: AC_BE - 1: AC_BK - 2: AC_VI - 3: AC_VO The issue can be reproduced sending two concurrent flow using two separate queues: - VO: 20Mbps UDP traffic - BE: TCP traffic In this scenario the UDP traffic will be blocked by the TCP one. Fix it configuring properly WMM hw queue parameters Fixes: 7bc04215a66b ("mt76: add driver code for MT76x2e") Tested-by: Gaetano Catalli Signed-off-by: Gaetano Catalli Signed-off-by: Lorenzo Bianconi Acked-by: Felix Fietkau --- drivers/net/wireless/mediatek/mt76/mt76x2_dma.c | 1 + drivers/net/wireless/mediatek/mt76/mt76x2_main.c | 26 +++++++++++++----------- 2 files changed, 15 insertions(+), 12 deletions(-) diff --git a/drivers/net/wireless/mediatek/mt76/mt76x2_dma.c b/drivers/net/wireless/mediatek/mt76/mt76x2_dma.c index 0a3f729a7156..fd1ec4743e0b 100644 --- a/drivers/net/wireless/mediatek/mt76/mt76x2_dma.c +++ b/drivers/net/wireless/mediatek/mt76/mt76x2_dma.c @@ -55,6 +55,7 @@ mt76x2_init_tx_queue(struct mt76x2_dev *dev, struct mt76_queue *q, q->regs = dev->mt76.regs + MT_TX_RING_BASE + idx * MT_RING_SIZE; q->ndesc = n_desc; + q->hw_idx = idx; ret = mt76_queue_alloc(dev, q); if (ret) diff --git a/drivers/net/wireless/mediatek/mt76/mt76x2_main.c b/drivers/net/wireless/mediatek/mt76/mt76x2_main.c index 963aea9e8801..edaaa053c43c 100644 --- a/drivers/net/wireless/mediatek/mt76/mt76x2_main.c +++ b/drivers/net/wireless/mediatek/mt76/mt76x2_main.c @@ -380,9 +380,11 @@ mt76x2_conf_tx(struct ieee80211_hw *hw, struct ieee80211_vif *vif, u16 queue, const struct ieee80211_tx_queue_params *params) { struct mt76x2_dev *dev = hw->priv; - u8 cw_min = 5, cw_max = 10; + u8 cw_min = 5, cw_max = 10, qid; u32 val; + qid = dev->mt76.q_tx[queue].hw_idx; + if (params->cw_min) cw_min = fls(params->cw_min); if (params->cw_max) @@ -392,26 +394,26 @@ mt76x2_conf_tx(struct ieee80211_hw *hw, struct ieee80211_vif *vif, u16 queue, FIELD_PREP(MT_EDCA_CFG_AIFSN, params->aifs) | FIELD_PREP(MT_EDCA_CFG_CWMIN, cw_min) | FIELD_PREP(MT_EDCA_CFG_CWMAX, cw_max); - mt76_wr(dev, MT_EDCA_CFG_AC(queue), val); + mt76_wr(dev, MT_EDCA_CFG_AC(qid), val); - val = mt76_rr(dev, MT_WMM_TXOP(queue)); - val &= ~(MT_WMM_TXOP_MASK << MT_WMM_TXOP_SHIFT(queue)); - val |= params->txop << MT_WMM_TXOP_SHIFT(queue); - mt76_wr(dev, MT_WMM_TXOP(queue), val); + val = mt76_rr(dev, MT_WMM_TXOP(qid)); + val &= ~(MT_WMM_TXOP_MASK << MT_WMM_TXOP_SHIFT(qid)); + val |= params->txop << MT_WMM_TXOP_SHIFT(qid); + mt76_wr(dev, MT_WMM_TXOP(qid), val); val = mt76_rr(dev, MT_WMM_AIFSN); - val &= ~(MT_WMM_AIFSN_MASK << MT_WMM_AIFSN_SHIFT(queue)); - val |= params->aifs << MT_WMM_AIFSN_SHIFT(queue); + val &= ~(MT_WMM_AIFSN_MASK << MT_WMM_AIFSN_SHIFT(qid)); + val |= params->aifs << MT_WMM_AIFSN_SHIFT(qid); mt76_wr(dev, MT_WMM_AIFSN, val); val = mt76_rr(dev, MT_WMM_CWMIN); - val &= ~(MT_WMM_CWMIN_MASK << MT_WMM_CWMIN_SHIFT(queue)); - val |= cw_min << MT_WMM_CWMIN_SHIFT(queue); + val &= ~(MT_WMM_CWMIN_MASK << MT_WMM_CWMIN_SHIFT(qid)); + val |= cw_min << MT_WMM_CWMIN_SHIFT(qid); mt76_wr(dev, MT_WMM_CWMIN, val); val = mt76_rr(dev, MT_WMM_CWMAX); - val &= ~(MT_WMM_CWMAX_MASK << MT_WMM_CWMAX_SHIFT(queue)); - val |= cw_max << MT_WMM_CWMAX_SHIFT(queue); + val &= ~(MT_WMM_CWMAX_MASK << MT_WMM_CWMAX_SHIFT(qid)); + val |= cw_max << MT_WMM_CWMAX_SHIFT(qid); mt76_wr(dev, MT_WMM_CWMAX, val); return 0;