Received: by 2002:a6b:500f:0:0:0:0:0 with SMTP id e15csp4324166iob; Sun, 8 May 2022 09:15:27 -0700 (PDT) X-Google-Smtp-Source: ABdhPJyaPqYfxc3VACas59clq6ZLYWyad173nLmZmVa/T4FzCKvjMq8CFKuqgT48XDdlmtXZ2X05 X-Received: by 2002:a05:620a:993:b0:69f:d0fb:48a5 with SMTP id x19-20020a05620a099300b0069fd0fb48a5mr9102295qkx.562.1652026527048; Sun, 08 May 2022 09:15:27 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1652026527; cv=none; d=google.com; s=arc-20160816; b=QIZqCuufvLNJkAQRpTnA90r4dijdB69mgMh8tzXvpWw5N7+jEbfkum4PiQDOBMU/0f bPVkbTJXzkhtu0HYuqnRYtM7R9MQFpdpARCDdHl2gKv3tLgKzvxJRBd07coYu7u72FJX dkMPJ2DIAljNE5rXHyTEWY2wPoGFFqf/rL2jK5aXU1bxnqPiPoTE4z8YZZSdnNcc0qGv 1cTw2O6M+MZv1P8LvGOdpAyrvn8X1028ILwDg7xMCHQPO7XP7nu6PAlf5enaaI8SWGff +a9gKAlu3wR4tiYywkuoQust0IX8kdl5wCv0Qkzxb7zupFWFE5TjWNJ8Ou9FzZUZJQ5m I6Gg== 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:to:from :dkim-signature; bh=2QatfP3eiw2VHAziiwH2RFO5u0QCAIGlUJFocOR7D68=; b=yKBp2mk9LtiEaFoR9QhiTpHjz7jl5+D8/V1W8DaZ81eQhECMnKlFSX1hxosRhybZqU p4cgK1LPrTZkYWv03eqEkz+tn2ADRuJEtl+1gegbfncCF8lyvQWNJWqQ/2g44rZI53QX UX4mgGjpU/m0G6W206/+KskRpey3mkqdczYP1+KiimpmW60SD/CYcT/TzXeMfS++Mn7u WLPO6OSQA05q+49u8J2gfde1cGDi1r/JIZQbiSUW2VsSWGlMxtlbJdlxyxkqgD7fFRCW Klx6SdgfpxPLVoKSHDMTB7IUwqVqYQhknRQfqdU22U/0ydiRIZ2wnZvymBllGUQWS3fa 1v4Q== ARC-Authentication-Results: i=1; mx.google.com; dkim=fail header.i=@nbd.name header.s=20160729 header.b="LH/OzA7g"; 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 dw1-20020a0562140a0100b0045ab97d14d6si5475485qvb.275.2022.05.08.09.15.07; Sun, 08 May 2022 09:15:26 -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="LH/OzA7g"; 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 S1358195AbiEELlx (ORCPT + 68 others); Thu, 5 May 2022 07:41:53 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:44420 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1350382AbiEELlv (ORCPT ); Thu, 5 May 2022 07:41:51 -0400 Received: from nbd.name (nbd.name [IPv6:2a01:4f8:221:3d45::2]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 361A249922 for ; Thu, 5 May 2022 04:38:11 -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:To:From:Sender:Reply-To:Cc: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=2QatfP3eiw2VHAziiwH2RFO5u0QCAIGlUJFocOR7D68=; b=LH/OzA7gGaDTdSGSM+wNu0C71W d6gJ/Z0MRMvJC1qJ0nUW5DpX1VmnBMvT7vwQh6rClx/75JUx7qzKlQJCU7I2362U46zrjkv3rYQ5W /L9EXoobNERJSJu8WfsBTgMSrM9OhvtJFDkY2vQi+hhvgD/MMrp97CIphz/zpcwVa/Lk=; Received: from p200300daa70ef200412f484bca3869cd.dip0.t-ipconnect.de ([2003:da:a70e:f200:412f:484b:ca38:69cd] helo=localhost.localdomain) by ds12 with esmtpsa (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.89) (envelope-from ) id 1nmZo9-0007Ts-Io for linux-wireless@vger.kernel.org; Thu, 05 May 2022 13:38:09 +0200 From: Felix Fietkau To: linux-wireless@vger.kernel.org Subject: [PATCH 3/4] mt76: make number of tokens configurable dynamically Date: Thu, 5 May 2022 13:37:28 +0200 Message-Id: <20220505113729.50380-3-nbd@nbd.name> X-Mailer: git-send-email 2.35.1 In-Reply-To: <20220505113729.50380-1-nbd@nbd.name> References: <20220505113729.50380-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 Preparation for adding Wireless Ethernet Dispatch support Signed-off-by: Felix Fietkau --- drivers/net/wireless/mediatek/mt76/mac80211.c | 1 + drivers/net/wireless/mediatek/mt76/mt76.h | 6 +++--- drivers/net/wireless/mediatek/mt76/tx.c | 7 +++---- 3 files changed, 7 insertions(+), 7 deletions(-) diff --git a/drivers/net/wireless/mediatek/mt76/mac80211.c b/drivers/net/wireless/mediatek/mt76/mac80211.c index 41e59f34f02a..9056d09d6c33 100644 --- a/drivers/net/wireless/mediatek/mt76/mac80211.c +++ b/drivers/net/wireless/mediatek/mt76/mac80211.c @@ -580,6 +580,7 @@ mt76_alloc_device(struct device *pdev, unsigned int size, INIT_LIST_HEAD(&dev->wcid_list); INIT_LIST_HEAD(&dev->txwi_cache); + dev->token_size = dev->drv->token_size; for (i = 0; i < ARRAY_SIZE(dev->q_rx); i++) skb_queue_head_init(&dev->rx_skb[i]); diff --git a/drivers/net/wireless/mediatek/mt76/mt76.h b/drivers/net/wireless/mediatek/mt76/mt76.h index 9a2fc77243bf..dce86846e648 100644 --- a/drivers/net/wireless/mediatek/mt76/mt76.h +++ b/drivers/net/wireless/mediatek/mt76/mt76.h @@ -719,7 +719,8 @@ struct mt76_dev { spinlock_t token_lock; struct idr token; - int token_count; + u16 token_count; + u16 token_size; wait_queue_head_t tx_wait; /* spinclock used to protect wcid pktid linked list */ @@ -1381,8 +1382,7 @@ mt76_token_get(struct mt76_dev *dev, struct mt76_txwi_cache **ptxwi) int token; spin_lock_bh(&dev->token_lock); - token = idr_alloc(&dev->token, *ptxwi, 0, dev->drv->token_size, - GFP_ATOMIC); + token = idr_alloc(&dev->token, *ptxwi, 0, dev->token_size, GFP_ATOMIC); spin_unlock_bh(&dev->token_lock); return token; diff --git a/drivers/net/wireless/mediatek/mt76/tx.c b/drivers/net/wireless/mediatek/mt76/tx.c index d5a8456c108b..84fa922c977a 100644 --- a/drivers/net/wireless/mediatek/mt76/tx.c +++ b/drivers/net/wireless/mediatek/mt76/tx.c @@ -722,12 +722,11 @@ int mt76_token_consume(struct mt76_dev *dev, struct mt76_txwi_cache **ptxwi) spin_lock_bh(&dev->token_lock); - token = idr_alloc(&dev->token, *ptxwi, 0, dev->drv->token_size, - GFP_ATOMIC); + token = idr_alloc(&dev->token, *ptxwi, 0, dev->token_size, GFP_ATOMIC); if (token >= 0) dev->token_count++; - if (dev->token_count >= dev->drv->token_size - MT76_TOKEN_FREE_THR) + if (dev->token_count >= dev->token_size - MT76_TOKEN_FREE_THR) __mt76_set_tx_blocked(dev, true); spin_unlock_bh(&dev->token_lock); @@ -747,7 +746,7 @@ mt76_token_release(struct mt76_dev *dev, int token, bool *wake) if (txwi) dev->token_count--; - if (dev->token_count < dev->drv->token_size - MT76_TOKEN_FREE_THR && + if (dev->token_count < dev->token_size - MT76_TOKEN_FREE_THR && dev->phy.q_tx[0]->blocked) *wake = true; -- 2.35.1