Received: by 2002:ab2:6d45:0:b0:1fb:d597:ff75 with SMTP id d5csp215011lqr; Wed, 5 Jun 2024 04:05:41 -0700 (PDT) X-Forwarded-Encrypted: i=3; AJvYcCWyWXjrSMEZlJhKCrKN1cLG2LLPJy8GRyjbHOwbrFpR5Ntc7NgVhFC/mv8NcaU3G3v7JEFtZx93gcCWbAvB9SvF9G1u9ldami0veG5dnw== X-Google-Smtp-Source: AGHT+IFg/khtT//LWAnfXcmPxYAONpw5pCEUp2ZqPnMBotl9Diw+4qV2m0rAot+qGjhtH9Inmd5i X-Received: by 2002:a05:620a:2103:b0:795:232a:7227 with SMTP id af79cd13be357-79523d37d4fmr204615585a.27.1717585541350; Wed, 05 Jun 2024 04:05:41 -0700 (PDT) ARC-Seal: i=2; a=rsa-sha256; t=1717585541; cv=pass; d=google.com; s=arc-20160816; b=VvyEiWZl/+j7naPt5h5lXEYE2zcSB9B7I70rtWWV8YlhjCgImAkheMvbviIR3VhlDb PTjErlWZYahUJKCc+bAakYh3awmvR0m6y7s4XMbhDTcMG7/UKkkwXm9GzSiBtflPfHBC 4dzku7uXc2OeWdm5GiiEg96hOUZTDtjYkPvShq8IgWTLPN7HJI0G5+B/sgl/q6XWEwpc rR+VipDo1on/8khy5iIH2wsWzpIwtkcs5VXfTGPd4Ujlj2iKFeNQQpxbpm18nsHH8ZUT wgJfJlEPM41VajScVJbp3dqyQDl8Y4Cw0lRPMVO8n3kvUTPAvI+szPxWQqnYqJr4Pezf dCOg== ARC-Message-Signature: i=2; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=content-transfer-encoding:organization:mime-version :list-unsubscribe:list-subscribe:list-id:precedence:references :in-reply-to:message-id:date:subject:cc:to:from:dkim-signature; bh=S5ENsDphaA+Yi7VVgst4ug+q5sgq7hs9e/eLuQsmx8U=; fh=TquNsOiV+zNY1csTpltVB6A9QFW5SbuNs6JlqcKCQkw=; b=s1k0qWSipilbDXp74sCIoi+yNWzCtyhvSE1dlqwme7ZmX1LusRy47KG2G3iclZSCEu kGAUoTos5+6hIhZKprlAw2GNIQXW25ppn9JDQR7cLOIi3WJZnxTmsJ7jVO1vwhl2eyxe EE7VKyISYXnIh1z8TUMIrfOocslICsZFQeVKPxeERHeZmkEu47boY3vnb6OvP02qrqB7 zgUeMWeWEF4zcQ5A+tQzFDdmazj3Uu3yYnDAgI0HzlTrcOasnwl/gYYi+MOOicmSiO6c 1ZYtGOR5TQ8dcHj5uOQVlOYl/YJKXnzThsgA6v2JqRUa6oq2/D/WUtYwQKYzATNu9gN3 Y9Jg==; dara=google.com ARC-Authentication-Results: i=2; mx.google.com; dkim=pass header.i=@intel.com header.s=Intel header.b=bbJ4SOuH; arc=pass (i=1 spf=pass spfdomain=intel.com dkim=pass dkdomain=intel.com dmarc=pass fromdomain=intel.com); spf=pass (google.com: domain of linux-wireless+bounces-8539-linux.lists.archive=gmail.com@vger.kernel.org designates 147.75.199.223 as permitted sender) smtp.mailfrom="linux-wireless+bounces-8539-linux.lists.archive=gmail.com@vger.kernel.org"; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=intel.com Return-Path: Received: from ny.mirrors.kernel.org (ny.mirrors.kernel.org. [147.75.199.223]) by mx.google.com with ESMTPS id d75a77b69052e-43ff25b9332si476291cf.769.2024.06.05.04.05.41 for (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Wed, 05 Jun 2024 04:05:41 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-wireless+bounces-8539-linux.lists.archive=gmail.com@vger.kernel.org designates 147.75.199.223 as permitted sender) client-ip=147.75.199.223; Authentication-Results: mx.google.com; dkim=pass header.i=@intel.com header.s=Intel header.b=bbJ4SOuH; arc=pass (i=1 spf=pass spfdomain=intel.com dkim=pass dkdomain=intel.com dmarc=pass fromdomain=intel.com); spf=pass (google.com: domain of linux-wireless+bounces-8539-linux.lists.archive=gmail.com@vger.kernel.org designates 147.75.199.223 as permitted sender) smtp.mailfrom="linux-wireless+bounces-8539-linux.lists.archive=gmail.com@vger.kernel.org"; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=intel.com Received: from smtp.subspace.kernel.org (wormhole.subspace.kernel.org [52.25.139.140]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by ny.mirrors.kernel.org (Postfix) with ESMTPS id 19DF81C21C56 for ; Wed, 5 Jun 2024 11:05:41 +0000 (UTC) Received: from localhost.localdomain (localhost.localdomain [127.0.0.1]) by smtp.subspace.kernel.org (Postfix) with ESMTP id 6297C192B81; Wed, 5 Jun 2024 11:05:22 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=intel.com header.i=@intel.com header.b="bbJ4SOuH" X-Original-To: linux-wireless@vger.kernel.org Received: from mgamail.intel.com (mgamail.intel.com [192.198.163.14]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id D2831146017 for ; Wed, 5 Jun 2024 11:05:20 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=192.198.163.14 ARC-Seal:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1717585522; cv=none; b=bU810Of7rGwhc+WXFJ7TBBDRI1gUEKd+/p7pmua43SultRa8VwEBtQnpHB/hLORP0FQO7Tab9Hvw04udyhPf5eghV+w3IDh1PT8hfk9pG+PmWN5EOugwdgJKrFlzxxmUnpsiVpLGmicoccYRYHC+2p/dAS9u/LvPa1uHJrcUTTU= ARC-Message-Signature:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1717585522; c=relaxed/simple; bh=Vcr2EgBYhf9DK3AkDvPaEAU0S6EyS6XndQ5jVQ1Wsjs=; h=From:To:Cc:Subject:Date:Message-Id:In-Reply-To:References: MIME-Version; b=DPdhiF2ILifEPLJ9FHa+WmpFp0h6+qlw1BFKsg7894CBg3234Eio1j6T9eerVaFjiOS/U/oRDo8qOOdXTIlMUOu0OvDYYGi84cAclqgVb1nrNSSL6D5wBahMAmhM11hpmwNz+eGyBm7HW/OFd7LWgqrFOHIJ4ncf0w2zsdEmhxs= ARC-Authentication-Results:i=1; smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=intel.com; spf=pass smtp.mailfrom=intel.com; dkim=pass (2048-bit key) header.d=intel.com header.i=@intel.com header.b=bbJ4SOuH; arc=none smtp.client-ip=192.198.163.14 Authentication-Results: smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=intel.com Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=intel.com DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=intel.com; i=@intel.com; q=dns/txt; s=Intel; t=1717585521; x=1749121521; h=from:to:cc:subject:date:message-id:in-reply-to: references:mime-version:content-transfer-encoding; bh=Vcr2EgBYhf9DK3AkDvPaEAU0S6EyS6XndQ5jVQ1Wsjs=; b=bbJ4SOuHWi2iMGOag/x/KxBLYmxSL1KDI1pOOCk+/zdeeTiW3M8yekmA RWKg3qHra05eydXwL5z2UbVYAPbfPH6nKqSPozNdCH9bwV9tNc434/MaC JVAPrmyCW8j8ANCOMGzq1cLm6e5apb9YpP1IL3G3ii7BdeWHQKyS2a7tB xcolNtVQNGpuGpEmmtOj9u6K1ZlFW/kF3P2ISWqN4/Tm2fxvfULkT14BX RAxkb3XBNryFLSFJlzjhmsOlgy/1auRPp2miI9nWKHnvv0EeIZotaCtsR JtECfdYup54MocvzWFbKyHVXyv9ayC9CS34xVHI/gadX2M3xCGM71PbOA Q==; X-CSE-ConnectionGUID: 4p9IXRzNQA+UQeVJLMBrsg== X-CSE-MsgGUID: mMPTTv4cTd+7pBiGGUAvlA== X-IronPort-AV: E=McAfee;i="6600,9927,11093"; a="14402181" X-IronPort-AV: E=Sophos;i="6.08,216,1712646000"; d="scan'208";a="14402181" Received: from fmviesa003.fm.intel.com ([10.60.135.143]) by fmvoesa108.fm.intel.com with ESMTP/TLS/ECDHE-RSA-AES256-GCM-SHA384; 05 Jun 2024 04:05:20 -0700 X-CSE-ConnectionGUID: YVYmUr+ST6SLnP1PEl1xYA== X-CSE-MsgGUID: +vDtNmPGTPuJTOCdH4Kqbg== X-ExtLoop1: 1 X-IronPort-AV: E=Sophos;i="6.08,216,1712646000"; d="scan'208";a="41997360" Received: from weis0040.iil.intel.com ([10.12.217.108]) by fmviesa003-auth.fm.intel.com with ESMTP/TLS/ECDHE-RSA-AES256-GCM-SHA384; 05 Jun 2024 04:05:19 -0700 From: Miri Korenblit To: johannes@sipsolutions.net Cc: linux-wireless@vger.kernel.org, Johannes Berg Subject: [PATCH 04/11] wifi: iwlwifi: move TXQ bytecount limit to queue code Date: Wed, 5 Jun 2024 14:05:00 +0300 Message-Id: <20240605140327.000a0a1e807d.Ib822590d5aca76ff3168418ae2c139b3d43d81ed@changeid> X-Mailer: git-send-email 2.34.1 In-Reply-To: <20240605110507.2044059-1-miriam.rachel.korenblit@intel.com> References: <20240605110507.2044059-1-miriam.rachel.korenblit@intel.com> Precedence: bulk X-Mailing-List: linux-wireless@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 Organization: Intel Israel (74) Limited Content-Transfer-Encoding: 8bit From: Johannes Berg This really isn't correct to be in the opmode, do the clamping (and power-of-2 fixup that may be necessary due to this, or even otherwise) in the queue code. Also move down the retrying of the allocation, it should be after all the size fixups, but also it just makes sense, and avoids retrying same-size allocations in the case of the BZ-family A-step workaround. Signed-off-by: Johannes Berg Signed-off-by: Miri Korenblit --- drivers/net/wireless/intel/iwlwifi/mvm/sta.c | 27 +++++-------------- drivers/net/wireless/intel/iwlwifi/queue/tx.c | 22 +++++++++++++-- 2 files changed, 26 insertions(+), 23 deletions(-) diff --git a/drivers/net/wireless/intel/iwlwifi/mvm/sta.c b/drivers/net/wireless/intel/iwlwifi/mvm/sta.c index 276bcccb7a38..bf3a1f132382 100644 --- a/drivers/net/wireless/intel/iwlwifi/mvm/sta.c +++ b/drivers/net/wireless/intel/iwlwifi/mvm/sta.c @@ -857,12 +857,6 @@ int iwl_mvm_tvqm_enable_txq(struct iwl_mvm *mvm, size = iwl_mvm_get_queue_size(sta); } - /* take the min with bc tbl entries allowed */ - size = min_t(u32, size, mvm->trans->txqs.bc_tbl_size / sizeof(u16)); - - /* size needs to be power of 2 values for calculating read/write pointers */ - size = rounddown_pow_of_two(size); - if (sta) { struct iwl_mvm_sta *mvmsta = iwl_mvm_sta_from_mac80211(sta); struct ieee80211_link_sta *link_sta; @@ -887,22 +881,13 @@ int iwl_mvm_tvqm_enable_txq(struct iwl_mvm *mvm, if (!sta_mask) return -EINVAL; - do { - queue = iwl_trans_txq_alloc(mvm->trans, 0, sta_mask, - tid, size, timeout); - - if (queue < 0) - IWL_DEBUG_TX_QUEUES(mvm, - "Failed allocating TXQ of size %d for sta mask %x tid %d, ret: %d\n", - size, sta_mask, tid, queue); - size /= 2; - } while (queue < 0 && size >= 16); - - if (queue < 0) - return queue; + queue = iwl_trans_txq_alloc(mvm->trans, 0, sta_mask, + tid, size, timeout); - IWL_DEBUG_TX_QUEUES(mvm, "Enabling TXQ #%d for sta mask 0x%x tid %d\n", - queue, sta_mask, tid); + if (queue >= 0) + IWL_DEBUG_TX_QUEUES(mvm, + "Enabling TXQ #%d for sta mask 0x%x tid %d\n", + queue, sta_mask, tid); return queue; } diff --git a/drivers/net/wireless/intel/iwlwifi/queue/tx.c b/drivers/net/wireless/intel/iwlwifi/queue/tx.c index 6229c785c845..726035dfa5cd 100644 --- a/drivers/net/wireless/intel/iwlwifi/queue/tx.c +++ b/drivers/net/wireless/intel/iwlwifi/queue/tx.c @@ -1237,11 +1237,29 @@ int iwl_txq_dyn_alloc(struct iwl_trans *trans, u32 flags, u32 sta_mask, }; int ret; + /* take the min with bytecount table entries allowed */ + size = min_t(u32, size, trans->txqs.bc_tbl_size / sizeof(u16)); + /* but must be power of 2 values for calculating read/write pointers */ + size = rounddown_pow_of_two(size); + if (trans->trans_cfg->device_family == IWL_DEVICE_FAMILY_BZ && - trans->hw_rev_step == SILICON_A_STEP) + trans->hw_rev_step == SILICON_A_STEP) { size = 4096; + txq = iwl_txq_dyn_alloc_dma(trans, size, timeout); + } else { + do { + txq = iwl_txq_dyn_alloc_dma(trans, size, timeout); + if (!IS_ERR(txq)) + break; + + IWL_DEBUG_TX_QUEUES(trans, + "Failed allocating TXQ of size %d for sta mask %x tid %d, ret: %ld\n", + size, sta_mask, tid, + PTR_ERR(txq)); + size /= 2; + } while (size >= 16); + } - txq = iwl_txq_dyn_alloc_dma(trans, size, timeout); if (IS_ERR(txq)) return PTR_ERR(txq); -- 2.34.1