From patchwork Fri Oct 18 14:40:22 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: 11198609 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 CA7DF913 for ; Fri, 18 Oct 2019 14:40:37 +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 A848F222C3 for ; Fri, 18 Oct 2019 14:40:37 +0000 (UTC) Authentication-Results: mail.kernel.org; dkim=pass (2048-bit key) header.d=lists.infradead.org header.i=@lists.infradead.org header.b="pUh9un4B"; dkim=fail reason="signature verification failed" (1024-bit key) header.d=redhat.com header.i=@redhat.com header.b="WF0VE5pD" DMARC-Filter: OpenDMARC Filter v1.3.2 mail.kernel.org A848F222C3 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:References:In-Reply-To: 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: List-Owner; bh=w6xrTaxZya1/ZnjLHd01FFfD4OaHWhhM2zlIx9cgB20=; b=pUh9un4Bi8HPJ3 B+aSX/bM7hFY98PlSVaoX4FSaVG8bVx87KcCRWDErJV9rSIC0ugdmZg4+xvCOuQSxrPJlxUMRHIl7 Ktxtvd7QMAHXe4LmR3lPQ+fOyX8+magnCFnPUyHrdG1Npy/RWpbWOIjlyv99qZY4Nl9rLIQdjtI21 JtKdafOkPC1GdpfzmmkU7lCcSIvyuT7FzZyA2q9dfXTJBA2ZpPQPSS3vXuSF0CRW1zWL0KZPW8MIs hdESFOoawrCg/WvNxeFMKhCUdR8QRFJKWnRgsxIjaFYYf1F7kvdIBt/o8vmREmZ5Pq2Vsz2r90mGn atF5MNRbiczUJLBqYZKQ==; 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 1iLTQe-0008Le-Ge; Fri, 18 Oct 2019 14:40:32 +0000 Received: from us-smtp-delivery-1.mimecast.com ([205.139.110.120] helo=us-smtp-1.mimecast.com) by bombadil.infradead.org with esmtps (Exim 4.92.3 #3 (Red Hat Linux)) id 1iLTQb-0008Kg-DX for ath10k@lists.infradead.org; Fri, 18 Oct 2019 14:40:31 +0000 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1571409628; 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: in-reply-to:in-reply-to:references:references; bh=Eg6GWygKeYzqmkq+LDj844ZOc9L0SpguuNdAt7HOGwI=; b=WF0VE5pDTKhVlx+hp8oIwnMV/cdWjYBD/fMxKLzFAE+jow64diVZ33pHL72iVgAUVSEWO5 Ru/q80SNXSGQNgXQnyCsc4sMHlJodSJEinGjLXzMi8vrTC/ETdtNlsrO2CWfyF+nKmSN9q r6ATF8lCv9bkzX3iM8+I03P58US483c= Received: from mail-lj1-f199.google.com (mail-lj1-f199.google.com [209.85.208.199]) (Using TLS) by relay.mimecast.com with ESMTP id us-mta-324-3eeoMgJfO0-_5QnXV5w7DQ-1; Fri, 18 Oct 2019 10:40:25 -0400 Received: by mail-lj1-f199.google.com with SMTP id p18so1129006ljn.1 for ; Fri, 18 Oct 2019 07:40:24 -0700 (PDT) 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:in-reply-to :references:user-agent:mime-version:content-transfer-encoding; bh=gQX28cV4kR5e8hFv0Sv15bTp7rYQDznh9B4z2Gx6gas=; b=PobBsxQRTqSHUi9A/u6p1F5abHs03le2zmBUdiHi4idZy6IDAToEiNeBxQu3udN0cA 7SN7qOEsBKPcrf7PDR11uOCBBFIm+WX4k5HUJF6QiThj4RniZpA5ZtuOKzAkkxpcUvlT CBS1KyHzDqkD4St8UhF+4+/YwWBMCrhgW1Dd/0qoCo10Uvmg8vDhqh7zHEQx9NKXU620 pQfxaWqP+ue0S5APyLAqKyZ85vCiEsS5IZSGXk+uc+iFENvQI1L0XrGD2g/Swb/uzCwc /rORbtSd+X723It0ZNKt/fVVfkqFCThqk+QiFbnkp2UkNiPDLIPakmQnuz6DjkRRxZW1 Diow== X-Gm-Message-State: APjAAAWN8aqYYHDdklwdCbr5o4dzTjgsKg5wVkoPX9z3WhLroZkbuFw5 2WZUtTQQIhNz2+c1FTBuglFjSkfE9ctTfuGIzRyaacLq2ql7lDtWGpToJnCYRtT03cC/ntbLRrJ OahWp8lYuddPAVQK+9Y9fpQ== X-Received: by 2002:a2e:b17b:: with SMTP id a27mr6357131ljm.7.1571409623702; Fri, 18 Oct 2019 07:40:23 -0700 (PDT) X-Google-Smtp-Source: APXvYqx1YvkIc2YHpk1/SSCOw+Ds7+tH99z4j9/nltzLAYUnxbi1nOpFOFqviaE5EgAWL5eFjRejZw== X-Received: by 2002:a2e:b17b:: with SMTP id a27mr6357117ljm.7.1571409623508; Fri, 18 Oct 2019 07:40:23 -0700 (PDT) Received: from alrua-x1.borgediget.toke.dk (borgediget.toke.dk. [85.204.121.218]) by smtp.gmail.com with ESMTPSA id k13sm2644724ljc.96.2019.10.18.07.40.22 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Fri, 18 Oct 2019 07:40:22 -0700 (PDT) Received: by alrua-x1.borgediget.toke.dk (Postfix, from userid 1000) id 20DE21804C9; Fri, 18 Oct 2019 16:40:22 +0200 (CEST) Subject: [PATCH v3 1/4] mac80211: Shrink the size of ack_frame_id to make room for tx_time_est From: =?utf-8?q?Toke_H=C3=B8iland-J=C3=B8rgensen?= To: Johannes Berg Date: Fri, 18 Oct 2019 16:40:22 +0200 Message-ID: <157140962205.2866668.16480110695725359529.stgit@toke.dk> In-Reply-To: <157140962094.2866668.3383184317264069493.stgit@toke.dk> References: <157140962094.2866668.3383184317264069493.stgit@toke.dk> User-Agent: StGit/0.20 MIME-Version: 1.0 X-MC-Unique: 3eeoMgJfO0-_5QnXV5w7DQ-1 X-Mimecast-Spam-Score: 0 X-CRM114-Version: 20100106-BlameMichelson ( TRE 0.8.0 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20191018_074029_692479_5934EBAF X-CRM114-Status: GOOD ( 12.09 ) 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 [205.139.110.120 listed in list.dnswl.org] 0.0 SPF_HELO_NONE SPF: HELO does not publish an SPF Record -0.0 SPF_PASS SPF: sender matches SPF record -0.1 DKIM_VALID_EF Message has a valid DKIM or DK signature from envelope-from domain -0.1 DKIM_VALID_AU Message has a valid DKIM or DK signature from author's domain 0.1 DKIM_SIGNED Message has a DKIM or DK signature, not necessarily valid -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 From: Toke Høiland-Jørgensen To implement airtime queue limiting, we need to keep a running account of the estimated airtime of all skbs queued into the device. Do to this correctly, we need to store the airtime estimate into the skb so we can decrease the outstanding balance when the skb is freed. This means that the time estimate must be stored somewhere that will survive for the lifetime of the skb. To get this, decrease the size of the ack_frame_id field to 6 bits, and lower the size of the ID space accordingly. This leaves 10 bits for use for tx_time_est, which is enough to store a maximum of 4096 us, if we shift the values so they become units of 4us. Signed-off-by: Toke Høiland-Jørgensen --- include/net/mac80211.h | 4 +++- net/mac80211/cfg.c | 2 +- net/mac80211/tx.c | 2 +- 3 files changed, 5 insertions(+), 3 deletions(-) diff --git a/include/net/mac80211.h b/include/net/mac80211.h index d69081c38788..4288ace72c2b 100644 --- a/include/net/mac80211.h +++ b/include/net/mac80211.h @@ -967,6 +967,7 @@ ieee80211_rate_get_vht_nss(const struct ieee80211_tx_rate *rate) * @band: the band to transmit on (use for checking for races) * @hw_queue: HW queue to put the frame on, skb_get_queue_mapping() gives the AC * @ack_frame_id: internal frame ID for TX status, used internally + * @tx_time_est: TX time estimate in units of 4us, used internally * @control: union part for control data * @control.rates: TX rates array to try * @control.rts_cts_rate_idx: rate for RTS or CTS @@ -1007,7 +1008,8 @@ struct ieee80211_tx_info { u8 hw_queue; - u16 ack_frame_id; + u16 ack_frame_id:6; + u16 tx_time_est:10; union { struct { diff --git a/net/mac80211/cfg.c b/net/mac80211/cfg.c index 70739e746c13..4fb7f1f12109 100644 --- a/net/mac80211/cfg.c +++ b/net/mac80211/cfg.c @@ -3428,7 +3428,7 @@ int ieee80211_attach_ack_skb(struct ieee80211_local *local, struct sk_buff *skb, spin_lock_irqsave(&local->ack_status_lock, spin_flags); id = idr_alloc(&local->ack_status_frames, ack_skb, - 1, 0x10000, GFP_ATOMIC); + 1, 0x40, GFP_ATOMIC); spin_unlock_irqrestore(&local->ack_status_lock, spin_flags); if (id < 0) { diff --git a/net/mac80211/tx.c b/net/mac80211/tx.c index 938c10f7955b..a16c2f863702 100644 --- a/net/mac80211/tx.c +++ b/net/mac80211/tx.c @@ -2719,7 +2719,7 @@ static struct sk_buff *ieee80211_build_hdr(struct ieee80211_sub_if_data *sdata, spin_lock_irqsave(&local->ack_status_lock, flags); id = idr_alloc(&local->ack_status_frames, ack_skb, - 1, 0x10000, GFP_ATOMIC); + 1, 0x40, GFP_ATOMIC); spin_unlock_irqrestore(&local->ack_status_lock, flags); if (id >= 0) {