From patchwork Sat Nov 16 11:57:16 2019 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Patchwork-Submitter: =?utf-8?q?Toke_H=C3=B8iland-J=C3=B8rgensen?= X-Patchwork-Id: 11247547 Return-Path: Received: from mail.kernel.org (pdx-korg-mail-1.web.codeaurora.org [172.30.200.123]) by pdx-korg-patchwork-2.web.codeaurora.org (Postfix) with ESMTP id 3F0096C1 for ; Sat, 16 Nov 2019 11:57:30 +0000 (UTC) Received: from bombadil.infradead.org (bombadil.infradead.org [198.137.202.133]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by mail.kernel.org (Postfix) with ESMTPS id 19BA0206E6 for ; Sat, 16 Nov 2019 11:57:30 +0000 (UTC) Authentication-Results: mail.kernel.org; dkim=pass (2048-bit key) header.d=lists.infradead.org header.i=@lists.infradead.org header.b="EvwyQU58"; dkim=fail reason="signature verification failed" (1024-bit key) header.d=redhat.com header.i=@redhat.com header.b="NXidWViG" DMARC-Filter: OpenDMARC Filter v1.3.2 mail.kernel.org 19BA0206E6 Authentication-Results: mail.kernel.org; dmarc=fail (p=none dis=none) header.from=redhat.com Authentication-Results: mail.kernel.org; spf=none smtp.mailfrom=ath10k-bounces+patchwork-ath10k=patchwork.kernel.org@lists.infradead.org DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=lists.infradead.org; s=bombadil.20170209; h=Sender: Content-Transfer-Encoding:Content-Type:Cc:List-Subscribe:List-Help:List-Post: List-Archive:List-Unsubscribe:List-Id:MIME-Version:Message-ID:Date:To:From: Subject:Reply-To:Content-ID:Content-Description:Resent-Date:Resent-From: Resent-Sender:Resent-To:Resent-Cc:Resent-Message-ID:In-Reply-To:References: List-Owner; bh=mK4lBcW7IeR2af8+NfVsunVIi1Ld9/GnUwZD9umqYp4=; b=EvwyQU58cJvLMU yNMRDEaI6MQ/vrDtuhTwNGpbFabR8dcfOScfzq8L7oEJZREnlejCi1c8ukScpbrQmTUoPSZ35l2Yn 1Zyxf3HezIFwE6D0QZyvguvqx8D93ayv0PIthb/bRJsQHw2LhSE4Fw/zTrAGjf9RMwggULGNmQeRT KKMd67uNdejNKjoeXxPttM5ZwEP4/FtjO+VaYl64jYbcyujGa8I0FTiM7u5ePMLEY0GjogOIGwQL8 Pj070i+3wyWWn42IfsoZ0JCoLtyIgyMjXaPeH/wLz8/os3TYTXWJ9ij6CrMiCEubbhaGx0WTTBiiB ct8uZvFdTsDCk4WmfDcA==; Received: from localhost ([127.0.0.1] helo=bombadil.infradead.org) by bombadil.infradead.org with esmtp (Exim 4.92.3 #3 (Red Hat Linux)) id 1iVwhi-0006pJ-3q; Sat, 16 Nov 2019 11:57:26 +0000 Received: from us-smtp-1.mimecast.com ([207.211.31.81] helo=us-smtp-delivery-1.mimecast.com) by bombadil.infradead.org with esmtps (Exim 4.92.3 #3 (Red Hat Linux)) id 1iVwhf-0006of-QO for ath10k@lists.infradead.org; Sat, 16 Nov 2019 11:57:25 +0000 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1573905442; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:cc:mime-version:mime-version:content-type:content-type: content-transfer-encoding:content-transfer-encoding; bh=4HWnUEWPK5gwkihfyRUsMpaxZslmtaOtUE3W9X1WMoY=; b=NXidWViGL0x6FOtJtoYlFay7oO3fdtkw0mvgE3kDZCv6DSmjpk73Bl6kefIu+HfyDDjArl psHiK+nHHD4W+Mo/UFsgIvRSsY+fADkCDt0a8qBMPqCuteIE2NYnslsC1zgzRWlNW+7v0T BwKp+OHOX6YIaqsq85Ta8MXKgArZaTs= Received: from mail-lf1-f70.google.com (mail-lf1-f70.google.com [209.85.167.70]) (Using TLS) by relay.mimecast.com with ESMTP id us-mta-165-L1K1x8vVND2qxn0dlZMISA-1; Sat, 16 Nov 2019 06:57:20 -0500 Received: by mail-lf1-f70.google.com with SMTP id m2so3970938lfo.20 for ; Sat, 16 Nov 2019 03:57:20 -0800 (PST) X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:subject:from:to:cc:date:message-id:user-agent :mime-version:content-transfer-encoding; bh=xGmfCpzNCWtkinDzNO/MRj1kwSQ0zFMoREQi5LCL/+0=; b=JewonndTEQx8m3VTAk28kq2Aeih4ostvjiEY4/iaOX6q37ZSKGaFeZemCUZXdBGuX5 5dw26QmdNBHzyCfI9fbhFq5k6lipBHOy9H8AH2JzwZEiyhFbaFVxnDnfmLHbp+TgMb4h L+YuE//A0fAbh4TED3ZDOANfsbEGxniNa4/CE5/vT0qqzqrAXunjv7QsTqYieLDnhqg/ kpmJPkGDJE7Hi2mbfo6Y0WpgnjUpBLtn4bJ0xOvE+jsAx/3UaIPqy1jGRgDcxIHwTzF3 Y+ERMhq8CMOY4fVWzENAz94/FEQwbRNdJr0AAojXwk+6Nnm1CzQrHZFZFJlaMkGv1w7L kszA== X-Gm-Message-State: APjAAAXTMFry3VAQocWfjSx8+afqKBTesghc/UIKvFJzZhCYCXu6a0w7 Wx3H1Mkd8zYUgL8jzLIq9/GvwEs9FFwwTYM/heNjxkyb3iuW0iQsbXQ6f5DB5dzoBsQ++9yn1WY trWWfaJj6MWiygjyoBHr8dQ== X-Received: by 2002:ac2:5685:: with SMTP id 5mr2991268lfr.32.1573905439014; Sat, 16 Nov 2019 03:57:19 -0800 (PST) X-Google-Smtp-Source: APXvYqzzRBzAMxYEZHZsVAtvcDEJQdEDJ3P0ayzDpX+t+c91Igqa6iN1JaFun4iF1Kzjh2WJ+O8B4A== X-Received: by 2002:ac2:5685:: with SMTP id 5mr2991257lfr.32.1573905438787; Sat, 16 Nov 2019 03:57:18 -0800 (PST) Received: from alrua-x1.borgediget.toke.dk (borgediget.toke.dk. [85.204.121.218]) by smtp.gmail.com with ESMTPSA id 12sm5429980lju.55.2019.11.16.03.57.17 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Sat, 16 Nov 2019 03:57:17 -0800 (PST) Received: by alrua-x1.borgediget.toke.dk (Postfix, from userid 1000) id 01170181910; Sat, 16 Nov 2019 12:57:16 +0100 (CET) Subject: [PATCH v10 0/4] Add Airtime Queue Limits (AQL) to mac80211 From: =?utf-8?q?Toke_H=C3=B8iland-J=C3=B8rgensen?= To: Johannes Berg Date: Sat, 16 Nov 2019 12:57:16 +0100 Message-ID: <157390543688.662247.3735146484299260207.stgit@toke.dk> User-Agent: StGit/0.21 MIME-Version: 1.0 X-MC-Unique: L1K1x8vVND2qxn0dlZMISA-1 X-Mimecast-Spam-Score: 0 X-CRM114-Version: 20100106-BlameMichelson ( TRE 0.8.0 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20191116_035723_934535_E6BC1FE8 X-CRM114-Status: GOOD ( 13.77 ) X-Spam-Score: -2.5 (--) X-Spam-Report: SpamAssassin version 3.4.2 on bombadil.infradead.org summary: Content analysis details: (-2.5 points) pts rule name description ---- ---------------------- -------------------------------------------------- -2.3 RCVD_IN_DNSWL_MED RBL: Sender listed at https://www.dnswl.org/, medium trust [207.211.31.81 listed in list.dnswl.org] -0.0 SPF_PASS SPF: sender matches SPF record 0.0 SPF_HELO_NONE SPF: HELO does not publish an SPF Record -0.1 DKIM_VALID_EF Message has a valid DKIM or DK signature from envelope-from domain 0.1 DKIM_SIGNED Message has a DKIM or DK signature, not necessarily valid -0.1 DKIM_VALID_AU Message has a valid DKIM or DK signature from author's domain -0.1 DKIM_VALID Message has at least one valid DKIM or DK signature X-BeenThere: ath10k@lists.infradead.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Cc: Kan Yan , Rajkumar Manoharan , Kevin Hayes , make-wifi-fast@lists.bufferbloat.net, linux-wireless@vger.kernel.org, ath10k@lists.infradead.org, John Crispin , Lorenzo Bianconi , Felix Fietkau Sender: "ath10k" Errors-To: ath10k-bounces+patchwork-ath10k=patchwork.kernel.org@lists.infradead.org This series is a first attempt at porting the Airtime Queue Limits concept from the out-of-tree ath10k implementation[0] to mac80211. This version takes Kan's patch to do the throttling in mac80211, and replaces the driver API with the mechanism from the previous version of my series, which instead calculated the expected airtime at dequeue time inside mac80211, storing it in the SKB cb field. This series also imports Felix' airtime calculation code from mt76 into mac80211, adjusting the API so it can be used from TX dequeue, by extracting the latest TX rate from the tx_stats structure kept for each station. As before, I've only compile tested this (lacking the proper hardware to do more testing), but Kan has tested in on the QCA9984 platform. The series is also available in my git repo here: https://git.kernel.org/pub/scm/linux/kernel/git/toke/linux.git/log/?h=mac80211-aql-10 [0] https://chromium-review.googlesource.com/c/chromiumos/third_party/kernel/+/1703105/7 Changelog: v10: - Fix return value from ieee80211_info_set_tx_time_est() v9: - Use atomic_sub_return() instead of separate atomic_sub() and atomic_read() - Add getter/setter for tx_time_est - Use get_sta_info_by_addrs() to find the station in ieee80211_report_used_skb() - Integrate everything back into one series v8: - Includes Toke's v7 version of "mac80211: Import airtime calculation code from mt76" - Don't clobber sta's customized queue limit when configuring the default via debugfs - Fix a racing condition when reset aql_tx_pending. v7: - Fix aql_total_pending_airtime underflow due to insufficient locking. v6: - Fix sta lookup in ieee80211_report_used_skb(). - Move call to ieee80211_sta_update_pending_airtime() to a bit later in __ieee80211_tx_status() v5: - Add missing export of ieee80211_calc_rx_airtime() and make ieee80211_calc_tx_airtime_rate() static (kbuildbot). - Use skb_get_queue_mapping() to get the AC from the skb. - Take basic rate configuration for the BSS into account when calculating multicast rate. v4: - Fix calculation that clamps the maximum airtime to fit into 10 bits - Incorporate Rich Brown's nits for the commit message in Kan's patch - Add fewer local variables to ieee80211_tx_dequeue() v3: - Move the tx_time_est field so it's shared with ack_frame_id, and use units of 4us for the value stored in it. - Move the addition of the Ethernet header size into ieee80211_calc_expected_tx_airtime() v2: - Integrate Kan's approach to airtime throttling. - Hopefully fix the cb struct alignment on big-endian architectures. --- Kan Yan (1): mac80211: Implement Airtime-based Queue Limit (AQL) Toke Høiland-Jørgensen (3): mac80211: Add new sta_info getter by sta/vif addrs mac80211: Import airtime calculation code from mt76 mac80211: Use Airtime-based Queue Limits (AQL) on packet dequeue include/net/cfg80211.h | 7 + include/net/mac80211.h | 57 ++++ net/mac80211/Makefile | 3 net/mac80211/airtime.c | 597 ++++++++++++++++++++++++++++++++++++++++++++ net/mac80211/debugfs.c | 85 ++++++ net/mac80211/debugfs_sta.c | 43 ++- net/mac80211/ieee80211_i.h | 8 + net/mac80211/main.c | 10 + net/mac80211/sta_info.c | 58 ++++ net/mac80211/sta_info.h | 11 + net/mac80211/status.c | 36 ++- net/mac80211/tx.c | 65 +++++ 12 files changed, 957 insertions(+), 23 deletions(-) create mode 100644 net/mac80211/airtime.c