Received: by 2002:a25:8b91:0:0:0:0:0 with SMTP id j17csp5330365ybl; Tue, 10 Dec 2019 04:21:00 -0800 (PST) X-Google-Smtp-Source: APXvYqx+ldA2A9pCq1//rD6AHknGd2dv/6qOWGx5jx/Hj18odWqQfrRs5h+n0FOU8/4dXQAFE4ri X-Received: by 2002:aca:bd85:: with SMTP id n127mr3786414oif.136.1575980460402; Tue, 10 Dec 2019 04:21:00 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1575980460; cv=none; d=google.com; s=arc-20160816; b=CVH+onoUJm0rUgCDu7J1P5R2/uoNKeyNo5nnvKelJJPOu4GPVtzi5C9g8HLEgMsfI+ rehIiCUJ9p2NZbwqlM/qVwUAOJQiPUYEXn+ungyInLG9llqvBdc0l7mYW6J34SH4XIZW E7iC1dxD861OKDIiJpovCirSB0HmjOmIZ+PQNd0OyYIJF3G0tou7izFC2gSbioTxzJQR 5tJoC6QhDepl/w4KLYajfSonArx6GVZnYcbqxbD2RwVjeYucUN49GqQuyNWkS6+j76+V N1TKZ2PtfWAEtX1wpvXW/JN3z2YscxeG3VTR6oeJfk5Dj6REIHKwXKY0Cb3Zt+cWBRh0 CAqA== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:content-transfer-encoding:mime-version :message-id:date:subject:cc:to:from; bh=OSSkCFVxGumIJXvmrGhOqyzOm/W2okRzJ8gZANvph+g=; b=V3FGhWyMfCOFul1MtUm9LpJo0Wz7pCBkdWDcRLT+Yl3riAiZGnNo4DTPmxgwoVb/0m imNJjJ5QfFvG11X4J5WfZecru3hge5Y9bh+OVSvvg0FiO5bD1ZeKWAfn5MCPoPpNYUNY fAyjIsMT5v5NLh92zjRSf5q/+jGwIiPoQujJW3rEEUJGFgYg+5iGX4YaW3t0p6EO06Zo Ye414KLRwyItW+VVLy+prrnVOqxw+/PVzmV5fajU5Yce1EJToZ8GO8rJTjMBOLlmKmsl PkrTBotnF80pfa5KozInKigLX0EOVatZGX8/NcWld05ZxL2sdzVrt4fNWSbDa7Er6DIb AOYQ== ARC-Authentication-Results: i=1; mx.google.com; spf=pass (google.com: best guess record for domain of linux-wireless-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-wireless-owner@vger.kernel.org Return-Path: Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id m204si1776720oib.235.2019.12.10.04.20.42; Tue, 10 Dec 2019 04:21:00 -0800 (PST) Received-SPF: pass (google.com: best guess record for domain of linux-wireless-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) client-ip=209.132.180.67; Authentication-Results: mx.google.com; spf=pass (google.com: best guess record for domain of linux-wireless-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-wireless-owner@vger.kernel.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1727320AbfLJMUi (ORCPT + 99 others); Tue, 10 Dec 2019 07:20:38 -0500 Received: from smail.rz.tu-ilmenau.de ([141.24.186.67]:44268 "EHLO smail.rz.tu-ilmenau.de" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1727227AbfLJMUi (ORCPT ); Tue, 10 Dec 2019 07:20:38 -0500 Received: from isengard.tu-ilmenau.de (unknown [141.24.207.101]) (using TLSv1.2 with cipher ECDHE-RSA-AES128-GCM-SHA256 (128/128 bits)) (No client certificate requested) by smail.rz.tu-ilmenau.de (Postfix) with ESMTPSA id DD9A458006E; Tue, 10 Dec 2019 13:20:35 +0100 (CET) From: Markus Theil To: nbd@nbd.name Cc: linux-wireless@vger.kernel.org, lorenzo.bianconi@redhat.com, Stanislaw Gruszka , kvalo@codeaurora.org, Markus Theil Subject: [PATCH v3] mt76: use AC specific reorder timeout Date: Tue, 10 Dec 2019 13:20:05 +0100 Message-Id: <20191210122005.7504-1-markus.theil@tu-ilmenau.de> X-Mailer: git-send-email 2.24.0 MIME-Version: 1.0 Content-Transfer-Encoding: 8bit Sender: linux-wireless-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-wireless@vger.kernel.org Before this patch, mt76 handled rx traffic for all TIDs equally, when released from reorder buffer early. This patch uses an AC specific reorder timeout, in order to release partial aggregated frames for voice or video ACs earlier. For example, ath10k also uses AC specific reorder timeouts (reported by firmware in that case). Signed-off-by: Markus Theil --- v3: fix changelog v2: use static const mapping arrays drivers/net/wireless/mediatek/mt76/agg-rx.c | 30 ++++++++++++++++++--- drivers/net/wireless/mediatek/mt76/mt76.h | 2 ++ 2 files changed, 28 insertions(+), 4 deletions(-) diff --git a/drivers/net/wireless/mediatek/mt76/agg-rx.c b/drivers/net/wireless/mediatek/mt76/agg-rx.c index 53b5a4b2dcc5..572cf26b0fa1 100644 --- a/drivers/net/wireless/mediatek/mt76/agg-rx.c +++ b/drivers/net/wireless/mediatek/mt76/agg-rx.c @@ -4,7 +4,27 @@ */ #include "mt76.h" -#define REORDER_TIMEOUT (HZ / 10) +static unsigned long mt76_aggr_tid_to_timeo(u8 tidno) +{ + static const int ieee802_1d_to_ac[8] = { + IEEE80211_AC_BE, + IEEE80211_AC_BK, + IEEE80211_AC_BK, + IEEE80211_AC_BE, + IEEE80211_AC_VI, + IEEE80211_AC_VI, + IEEE80211_AC_VO, + IEEE80211_AC_VO + }; + static const int ac_to_timeout[] = { + [IEEE80211_AC_VO] = HZ / 30, + [IEEE80211_AC_VI] = HZ / 25, + [IEEE80211_AC_BE] = HZ / 10, + [IEEE80211_AC_BK] = HZ / 10 + }; + + return ac_to_timeout[ieee802_1d_to_ac[tidno & 7]]; +} static void mt76_aggr_release(struct mt76_rx_tid *tid, struct sk_buff_head *frames, int idx) @@ -71,7 +91,8 @@ mt76_rx_aggr_check_release(struct mt76_rx_tid *tid, struct sk_buff_head *frames) nframes--; status = (struct mt76_rx_status *)skb->cb; if (!time_after(jiffies, - status->reorder_time + REORDER_TIMEOUT)) + status->reorder_time + + mt76_aggr_tid_to_timeo(tid->num))) continue; mt76_rx_aggr_release_frames(tid, frames, status->seqno); @@ -101,7 +122,7 @@ mt76_rx_aggr_reorder_work(struct work_struct *work) if (nframes) ieee80211_queue_delayed_work(tid->dev->hw, &tid->reorder_work, - REORDER_TIMEOUT); + mt76_aggr_tid_to_timeo(tid->num)); mt76_rx_complete(dev, &frames, NULL); rcu_read_unlock(); @@ -225,7 +246,7 @@ void mt76_rx_aggr_reorder(struct sk_buff *skb, struct sk_buff_head *frames) mt76_rx_aggr_release_head(tid, frames); ieee80211_queue_delayed_work(tid->dev->hw, &tid->reorder_work, - REORDER_TIMEOUT); + mt76_aggr_tid_to_timeo(tid->num)); out: spin_unlock_bh(&tid->lock); @@ -245,6 +266,7 @@ int mt76_rx_aggr_start(struct mt76_dev *dev, struct mt76_wcid *wcid, u8 tidno, tid->dev = dev; tid->head = ssn; tid->size = size; + tid->num = tidno; INIT_DELAYED_WORK(&tid->reorder_work, mt76_rx_aggr_reorder_work); spin_lock_init(&tid->lock); diff --git a/drivers/net/wireless/mediatek/mt76/mt76.h b/drivers/net/wireless/mediatek/mt76/mt76.h index c268c3d76b3d..b604d8d5f0bc 100644 --- a/drivers/net/wireless/mediatek/mt76/mt76.h +++ b/drivers/net/wireless/mediatek/mt76/mt76.h @@ -237,6 +237,8 @@ struct mt76_rx_tid { u8 size; u8 nframes; + u8 num; + u8 started:1, stopped:1, timer_pending:1; struct sk_buff *reorder_buf[]; -- 2.24.0