Received: by 2002:a05:6a10:f347:0:0:0:0 with SMTP id d7csp13178955pxu; Sun, 3 Jan 2021 05:10:00 -0800 (PST) X-Google-Smtp-Source: ABdhPJyD3yS28KUUKQ9H58rfVfuH1X8SEScSfSCbiyWvNylZangTqX+AZmI50h3MnoFtLRadh9F/ X-Received: by 2002:a17:907:d9e:: with SMTP id go30mr61397285ejc.488.1609679399785; Sun, 03 Jan 2021 05:09:59 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1609679399; cv=none; d=google.com; s=arc-20160816; b=dU9UDjPtmqCprqD4kAINSqtCb82at13OmbG3wYdhemKAkV6LpqnVD4xh6BcwAM+24+ DWi0tPoGeXzWXk6kNGwPCTc/y7cCrwF1zkWlyYh6pqoXuapAclGqryCIPZlbJsynvwZT tXr+8akAKr2cZceJPEV8C8I4Sa9NeDivago3Nkck3+rDdvBh+c3zKDKSGV5conws/9ZY aeqfup0Xb79u/I6iJQZUNTwpSd0UMpIOB+xWR0f7Qlj/Ixq3QN/0bp1h2Dtx2wqrH/uJ 2WaNZk5NCVqIXVLnY+ittqAWWWTSx+dM44W1OK/g3TfiZOiHISyuBc5EO2BrqWzBUOkl wFbg== 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 :references:in-reply-to:message-id:date:subject:cc:to:from :dkim-signature; bh=c55cmlwXHQPmT6rR9SsdbTZ4aoDHhuAFTbTtkTBkrgs=; b=j/il6HrWIuLuQ/VHxEe6dqHmK4hyMFUYlfZn5P0VxstEoYBqIBaKCXpKkIGKBqe0Ue /sUg38jDH7txnc140TiSPtAm1no2kxTJ0QSGUhe5rxq4h9AHaFsKCt9FBVjK58mg+lL1 IzET3++JJ82bwf1oS5NM5XjLNy9NC9UzK09iMmvbF5+la3qTq1/cHFhwJgHldmR9p6uv bls0oobHn8XHwnsAhJ+ahTlFIx7za/Cln0ETlQRyzZALD5ffe3QfioaCGtsXod5HO8MD o7VmEnOic783PdE9rR6gmbkBfFCk6ym93zZZOI7j/47G/BpGdjUDT/5MpTgmw6vHbnSf 8LJg== ARC-Authentication-Results: i=1; mx.google.com; dkim=fail header.i=@nbd.name header.s=20160729 header.b=pR3Z+yUF; spf=pass (google.com: domain of linux-wireless-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) smtp.mailfrom=linux-wireless-owner@vger.kernel.org Return-Path: Received: from vger.kernel.org (vger.kernel.org. [23.128.96.18]) by mx.google.com with ESMTP id c6si13645075ejb.666.2021.01.03.05.09.37; Sun, 03 Jan 2021 05:09:59 -0800 (PST) Received-SPF: pass (google.com: domain of linux-wireless-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) client-ip=23.128.96.18; Authentication-Results: mx.google.com; dkim=fail header.i=@nbd.name header.s=20160729 header.b=pR3Z+yUF; spf=pass (google.com: domain of linux-wireless-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) smtp.mailfrom=linux-wireless-owner@vger.kernel.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1726596AbhACLxX (ORCPT + 99 others); Sun, 3 Jan 2021 06:53:23 -0500 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:40078 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1726365AbhACLxW (ORCPT ); Sun, 3 Jan 2021 06:53:22 -0500 Received: from nbd.name (nbd.name [IPv6:2a01:4f8:221:3d45::2]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id E6CF7C06179E for ; Sun, 3 Jan 2021 03:51:45 -0800 (PST) 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:Cc:To:From:Sender:Reply-To: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=c55cmlwXHQPmT6rR9SsdbTZ4aoDHhuAFTbTtkTBkrgs=; b=pR3Z+yUFsmlxvhND/n/62HlqrC Lg0WLheoyISTwSD0PgE42NOmItI67VJjiSYZiKYrNldkyOYrqRcB5ZA8DZK/gMEP4OUfWnajFCn/B eITlsREvKOcNeXgIOFA+BPuQEeqnvnNKv8u+FDSwXZrSNmylTIFj30G018zMXztnsb6Y=; Received: from p54ae91f2.dip0.t-ipconnect.de ([84.174.145.242] helo=localhost.localdomain) by ds12 with esmtpsa (TLS1.2:ECDHE_RSA_AES_128_CBC_SHA1:128) (Exim 4.89) (envelope-from ) id 1kw1vC-0000gv-TU; Sun, 03 Jan 2021 12:51:42 +0100 From: Felix Fietkau To: linux-wireless@vger.kernel.org Cc: johannes@sipsolutions.net Subject: [PATCH v2 5/8] mac80211: minstrel_ht: improve ampdu length estimation Date: Sun, 3 Jan 2021 12:51:37 +0100 Message-Id: <20210103115140.18614-5-nbd@nbd.name> X-Mailer: git-send-email 2.28.0 In-Reply-To: <20210103115140.18614-1-nbd@nbd.name> References: <20210103115140.18614-1-nbd@nbd.name> MIME-Version: 1.0 Content-Transfer-Encoding: 8bit Precedence: bulk List-ID: X-Mailing-List: linux-wireless@vger.kernel.org If the driver does not report A-MPDU length, estimate it based on the rate. Signed-off-by: Felix Fietkau --- net/mac80211/rc80211_minstrel_ht.c | 38 +++++++++++++++++++++--------- 1 file changed, 27 insertions(+), 11 deletions(-) diff --git a/net/mac80211/rc80211_minstrel_ht.c b/net/mac80211/rc80211_minstrel_ht.c index 9280461ed3cc..5b20e17ec2e6 100644 --- a/net/mac80211/rc80211_minstrel_ht.c +++ b/net/mac80211/rc80211_minstrel_ht.c @@ -382,13 +382,37 @@ minstrel_get_ratestats(struct minstrel_ht_sta *mi, int index) return &mi->groups[index / MCS_GROUP_RATES].rates[index % MCS_GROUP_RATES]; } +static inline int +minstrel_get_duration(int index) +{ + const struct mcs_group *group = &minstrel_mcs_groups[index / MCS_GROUP_RATES]; + unsigned int duration = group->duration[index % MCS_GROUP_RATES]; + return duration << group->shift; +} + static unsigned int minstrel_ht_avg_ampdu_len(struct minstrel_ht_sta *mi) { - if (!mi->avg_ampdu_len) - return AVG_AMPDU_SIZE; + int duration; + + if (mi->avg_ampdu_len) + return MINSTREL_TRUNC(mi->avg_ampdu_len); + + if (minstrel_ht_is_legacy_group(mi->max_tp_rate[0] / MCS_GROUP_RATES)) + return 1; + + duration = minstrel_get_duration(mi->max_tp_rate[0]); - return MINSTREL_TRUNC(mi->avg_ampdu_len); + if (duration > 400 * 1000) + return 2; + + if (duration > 250 * 1000) + return 4; + + if (duration > 150 * 1000) + return 8; + + return 16; } /* @@ -588,14 +612,6 @@ minstrel_ht_prob_rate_reduce_streams(struct minstrel_ht_sta *mi) } } -static inline int -minstrel_get_duration(int index) -{ - const struct mcs_group *group = &minstrel_mcs_groups[index / MCS_GROUP_RATES]; - unsigned int duration = group->duration[index % MCS_GROUP_RATES]; - return duration << group->shift; -} - static bool minstrel_ht_probe_group(struct minstrel_ht_sta *mi, const struct mcs_group *tp_group, int tp_idx, const struct mcs_group *group) -- 2.28.0