Received: by 2002:a6b:fb09:0:0:0:0:0 with SMTP id h9csp1614657iog; Sat, 25 Jun 2022 14:27:25 -0700 (PDT) X-Google-Smtp-Source: AGRyM1v1eDQRo/SyF2DXwWR/AsdauE7dEjSsEgq70FEjkDLZqAAtQKnLVkpHY0TDCvNsDPJftvNQ X-Received: by 2002:a17:903:3253:b0:16a:23ec:75ff with SMTP id ji19-20020a170903325300b0016a23ec75ffmr5943445plb.33.1656192445737; Sat, 25 Jun 2022 14:27:25 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1656192445; cv=none; d=google.com; s=arc-20160816; b=w+XHom9NChZVhzbkJBlgpcRXYSf1Mmm83oLQDwzHN5q0KJ6AgOMUBKKEPmHChHf0BO DhxFvFIfPHWm3pGYAm4Awq3/g93ikCycPDEWJOb93qXLsUtgTI+biZb48vjaYnKHhwbP 1aT0I0zyh+fo+uR/0vehk9ot5CjE7CRNFRrLOX1BHkFj9WDSBoCwscCDOhvmzbrUGnLY uxB4tijpNAbkkWIeo4ncmLY+begBT988UiZl6PSMVnYUlgHjiaOMxyBJmVC2sHrKTb9A v5pTHy8EUxZGCDS84+7+nZV7wVZPrypNXr+cKUeB7JlQUUxhPvFt8tVr//RuBhx10gyv Ez5g== 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=bR2RUPUkWWAzbxL8eF6zc5illViuxH8B5Sbe3Rf7rn0=; b=bOMa3d/XShQK0Y8lzgZAyair7Hhyt7bcgKxpGBu5mwuPH2ozTLVjdnzem+cvWVY0dI GpnUbLmyBGZcWbNiTK2TIuRkWVoZflf5ubwf3UPRlgUi6fKoDYqehlyW8KKPne7hOalh rOsv8rvddYiTTHXNMtqhd1ujnDOzs3K+rbPMmoI7A2JHhd2OFw9+PtGECywu7kfOOeYu t9HD20T996JJ/P64PYY7Z3yYV2DTSAD/1NMOakDaSppHfi+uNmflHq0/kmbJ6NOg4SEb Ltw9BRk3/cnu5nycAHqpjThTlh2ZiSToKg6Qche15jqVDWB5E+lXg1eFIsor8nT3QMul vUew== ARC-Authentication-Results: i=1; mx.google.com; dkim=fail header.i=@nbd.name header.s=20160729 header.b=dxb03xaE; spf=pass (google.com: domain of linux-wireless-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-wireless-owner@vger.kernel.org Return-Path: Received: from out1.vger.email (out1.vger.email. [2620:137:e000::1:20]) by mx.google.com with ESMTP id u1-20020a632341000000b003fdc8b4d872si8015099pgm.602.2022.06.25.14.27.18; Sat, 25 Jun 2022 14:27:25 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-wireless-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=fail header.i=@nbd.name header.s=20160729 header.b=dxb03xaE; spf=pass (google.com: domain of linux-wireless-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-wireless-owner@vger.kernel.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S233520AbiFYVYW (ORCPT + 65 others); Sat, 25 Jun 2022 17:24:22 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:51340 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S233485AbiFYVYS (ORCPT ); Sat, 25 Jun 2022 17:24:18 -0400 Received: from nbd.name (nbd.name [IPv6:2a01:4f8:221:3d45::2]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 0DECA13F39 for ; Sat, 25 Jun 2022 14:24:16 -0700 (PDT) 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=bR2RUPUkWWAzbxL8eF6zc5illViuxH8B5Sbe3Rf7rn0=; b=dxb03xaE1GkK8AXZ2TfOAJ6fT7 VE6Lt28dEJSLy5wuRWf4CHiFVUeKJzoHKGjX24+aYOtcivFDxxlXDaSVExcDRCgSoQ4M9eDS40KN7 fmPk9M6Cq/top2OLbkNpQnR9x2lb3lh8BiM2mjkNNf2M+Or6VDwtzUmi18stJIbg+Ri8=; Received: from p200300daa733bc000d99dad39793d523.dip0.t-ipconnect.de ([2003:da:a733:bc00:d99:dad3:9793:d523] helo=localhost.localdomain) by ds12 with esmtpsa (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.89) (envelope-from ) id 1o5DGI-0003Vi-CB; Sat, 25 Jun 2022 23:24:14 +0200 From: Felix Fietkau To: linux-wireless@vger.kernel.org Cc: toke@kernel.org, johannes@sipsolutions.net Subject: [PATCH 7/7] mac80211: only accumulate airtime deficit for active clients Date: Sat, 25 Jun 2022 23:24:11 +0200 Message-Id: <20220625212411.36675-7-nbd@nbd.name> X-Mailer: git-send-email 2.36.1 In-Reply-To: <20220625212411.36675-1-nbd@nbd.name> References: <20220625212411.36675-1-nbd@nbd.name> MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Spam-Status: No, score=-2.1 required=5.0 tests=BAYES_00,DKIM_SIGNED, DKIM_VALID,DKIM_VALID_AU,DKIM_VALID_EF,SPF_HELO_NONE,SPF_NONE, 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-wireless@vger.kernel.org When a client does not generate any local tx activity, accumulating airtime deficit for the round-robin scheduler can be harmful. If this goes on for too long, the deficit could grow quite large, which might cause unreasonable initial latency once the client becomes active Signed-off-by: Felix Fietkau --- net/mac80211/sta_info.c | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-) diff --git a/net/mac80211/sta_info.c b/net/mac80211/sta_info.c index 28ab55a072c6..c9852f71e8e1 100644 --- a/net/mac80211/sta_info.c +++ b/net/mac80211/sta_info.c @@ -2046,6 +2046,7 @@ void ieee80211_sta_register_airtime(struct ieee80211_sta *pubsta, u8 tid, struct ieee80211_local *local = sta->sdata->local; u8 ac = ieee80211_ac_from_tid(tid); u32 airtime = 0; + u32 diff; if (sta->local->airtime_flags & AIRTIME_USE_TX) airtime += tx_airtime; @@ -2055,7 +2056,11 @@ void ieee80211_sta_register_airtime(struct ieee80211_sta *pubsta, u8 tid, spin_lock_bh(&local->active_txq_lock[ac]); sta->airtime[ac].tx_airtime += tx_airtime; sta->airtime[ac].rx_airtime += rx_airtime; - sta->airtime[ac].deficit -= airtime; + + diff = (u32)jiffies - sta->airtime[ac].last_active; + if (diff <= AIRTIME_ACTIVE_DURATION) + sta->airtime[ac].deficit -= airtime; + spin_unlock_bh(&local->active_txq_lock[ac]); } EXPORT_SYMBOL(ieee80211_sta_register_airtime); -- 2.36.1