Received: by 2002:ab2:6857:0:b0:1ef:ffd0:ce49 with SMTP id l23csp2593835lqp; Mon, 25 Mar 2024 03:58:06 -0700 (PDT) X-Forwarded-Encrypted: i=3; AJvYcCXlh15PPqMfxAbprm9ZPo7xsCEDrshlVm5pZfdcjIUBSwORBbNjJbBwMFv5DkUMAkbyx+dRdpG22LtGCoqNEE5l1D+WJe5tp3Jf3T6Xzw== X-Google-Smtp-Source: AGHT+IFsghbsKvO8lhgtFqalFtZyex52nYmdHFEeOiFiSloNGmjjXn1ecOLbkgaZoSFcslSdkd08 X-Received: by 2002:a05:6830:328d:b0:6e6:8bb5:4c86 with SMTP id m13-20020a056830328d00b006e68bb54c86mr8140885ott.3.1711364286654; Mon, 25 Mar 2024 03:58:06 -0700 (PDT) ARC-Seal: i=2; a=rsa-sha256; t=1711364286; cv=pass; d=google.com; s=arc-20160816; b=DSyPmofoJt0w/JDTznTXIpAXw0OP3jktFnCq8Tzrdo5+km+g0glYWM39zYjHfCpU+R iFoiPUebwpE3Fisqvq5nd3V7jBPE7nHxkCx10fVQBhi4+JQ7Q1noEoA5onwmNVZtdsyN IhVqsD4e1oBciAZzFFEoqWksWhDEnA7eQ+WZgx092MqfUDiaiUB7m1jif5h9874UiDPA knanazDNNVtAnlmTS0xXoQoOSSusYjMvrVmhTxc4gY2n5eYbeFZNKoehrOE7ZvCfRxIc Z3Lahq2/G+FabrYWpCsqdoidP7BAKfQoQ8HwhxpK/Si+0mKJ+DTJ/86kMTxNGBIAnIda v3iA== ARC-Message-Signature: i=2; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=content-transfer-encoding:mime-version:list-unsubscribe :list-subscribe:list-id:precedence:references:in-reply-to:message-id :date:subject:cc:to:from:dkim-signature; bh=HWsp9NPV2CM+U3uKFJ5x0AazklL0COpyB1eYmWrtSeQ=; fh=wpw9CwByh2VzBg2JAmzRLhCtTGmrj18ge7jA98j6Vjg=; b=No6zFzYDx45eIHqAhJrEY3m1J9Ydf3x58soCmbsBiym1P9PDX0NJ1C8KwJWw71am/u /bd6DRbZ0ynPH3LH1iuWtYatQbhT61aD9KLcMYHsEVNEqYyapklXdoMO5mpG7dUfP87X jnx6v/RqTG7BW1QvIRTPjE3jqyS0QRANjgTK2S56SlyusjjlKs4LgZhF0cTRJP+/pyrN hZcGeBbyas3rq9W6iE3B2DvybRl+VdQTYgRQqjdX7o+Uo9wzC7Ac5ZyJiAuPOAXAI0jI mV5/pb7aVWJBdZwHb1nwbe+XmTqlo2haV7Ya2AXZIrmi2iQ8fzLyfd/fKmYpxhjlTSQC B2qA==; dara=google.com ARC-Authentication-Results: i=2; mx.google.com; dkim=pass header.i=@kernel.org header.s=k20201202 header.b=BbVaYrrJ; arc=pass (i=1 dkim=pass dkdomain=kernel.org); spf=pass (google.com: domain of linux-kernel+bounces-115390-linux.lists.archive=gmail.com@vger.kernel.org designates 139.178.88.99 as permitted sender) smtp.mailfrom="linux-kernel+bounces-115390-linux.lists.archive=gmail.com@vger.kernel.org"; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=kernel.org Return-Path: Received: from sv.mirrors.kernel.org (sv.mirrors.kernel.org. [139.178.88.99]) by mx.google.com with ESMTPS id a37-20020a631a25000000b005ce021f4418si4226007pga.524.2024.03.25.03.58.06 for (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Mon, 25 Mar 2024 03:58:06 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel+bounces-115390-linux.lists.archive=gmail.com@vger.kernel.org designates 139.178.88.99 as permitted sender) client-ip=139.178.88.99; Authentication-Results: mx.google.com; dkim=pass header.i=@kernel.org header.s=k20201202 header.b=BbVaYrrJ; arc=pass (i=1 dkim=pass dkdomain=kernel.org); spf=pass (google.com: domain of linux-kernel+bounces-115390-linux.lists.archive=gmail.com@vger.kernel.org designates 139.178.88.99 as permitted sender) smtp.mailfrom="linux-kernel+bounces-115390-linux.lists.archive=gmail.com@vger.kernel.org"; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=kernel.org 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 sv.mirrors.kernel.org (Postfix) with ESMTPS id 275082C229D for ; Mon, 25 Mar 2024 10:48:52 +0000 (UTC) Received: from localhost.localdomain (localhost.localdomain [127.0.0.1]) by smtp.subspace.kernel.org (Postfix) with ESMTP id B4E451FC999; Mon, 25 Mar 2024 02:35:26 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=kernel.org header.i=@kernel.org header.b="BbVaYrrJ" Received: from smtp.kernel.org (aws-us-west-2-korg-mail-1.web.codeaurora.org [10.30.226.201]) (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 AFB5F8527B; Sun, 24 Mar 2024 22:51:05 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=10.30.226.201 ARC-Seal:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1711320665; cv=none; b=UK6f8lodqhgiAjZcEatiNXfHxmsdAM/Es7qZcDEI4sHUGj9S4RAkMtRoeK3Gkft5ke5a/YhcQrN/bvjKbxiZZW9sbJAKzAdIizu2v4Hl5WKsfPIvxEilSualdqKje+KThbXkjLpTifEuxfhF5znZ+t5JDPhKIp2q4ixlbIQl/PI= ARC-Message-Signature:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1711320665; c=relaxed/simple; bh=lzVnQlyO7tR3vPso14hf/vGA5Oj0nELSAcGLnpQb/UU=; h=From:To:Cc:Subject:Date:Message-ID:In-Reply-To:References: MIME-Version; b=M2Ar7RB8TUwqysSRURKC4uzbs8G73QXwF0cP7qXsUsYnIL+MaVtkuUgYTE5R6beH7wBwpJcboBtI96PVR9yLLFtgBv+graBUDHrS5TTTssCUwr3AvVmuUGWOnqwQAkLh/I4ErZEPH2pkVAfSYfaKNLzZIExDVxjO9EUMBv52ITg= ARC-Authentication-Results:i=1; smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=kernel.org header.i=@kernel.org header.b=BbVaYrrJ; arc=none smtp.client-ip=10.30.226.201 Received: by smtp.kernel.org (Postfix) with ESMTPSA id F0B13C433C7; Sun, 24 Mar 2024 22:51:04 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=k20201202; t=1711320665; bh=lzVnQlyO7tR3vPso14hf/vGA5Oj0nELSAcGLnpQb/UU=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=BbVaYrrJbN/6frJmUzVpxcnPr/sc7G0i/FTDT8Ln9LUte+QZnwS2lETbDzbs9ivh5 cj3U6ntXJExiKXz9Ot8CgD52xZ7+KbYyTciexVn3IBopIGUO5DMh0rXVNqyHlncf67 mYy0dGSkWic1lHmgjceUFNIEB/eKsXnLSex7i/R/6guyii2cNcvxjf2nHMO6GO5Wm9 GicViLQv5ZzPm6y1gW38vosiL+o/aLv/oE0V7G7i/f/QBbT0HpN6cdxBkaZDJSusn9 5H4EvtnE0Uus/N/iriVRzkl5Wfyctm2NGKGFbZqe7EkCZmwW0JT86crZ7kSx/2J62g 9tqR3C+06g9EA== From: Sasha Levin To: linux-kernel@vger.kernel.org, stable@vger.kernel.org Cc: Johannes Berg , Miri Korenblit , Sasha Levin Subject: [PATCH 6.7 228/713] wifi: iwlwifi: mvm: fix erroneous queue index mask Date: Sun, 24 Mar 2024 18:39:14 -0400 Message-ID: <20240324224720.1345309-229-sashal@kernel.org> X-Mailer: git-send-email 2.43.0 In-Reply-To: <20240324224720.1345309-1-sashal@kernel.org> References: <20240324224720.1345309-1-sashal@kernel.org> Precedence: bulk X-Mailing-List: linux-kernel@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 X-stable: review X-Patchwork-Hint: Ignore Content-Transfer-Encoding: 8bit From: Johannes Berg [ Upstream commit 2e0e766bd8a7f14f10c3e70b8203c4c1e6d9ec76 ] When retrieving the queue index ("SCD SSN") from the TX response, it's currently masked with 0xFFF. However, now that we have queues longer than 4k, that became wrong, so make the mask depend on the hardware family. This fixes an issue where if we get a single frame reclaim while in the top half of an 8k long queue, we'd reclaim-wrap the queue twice (once on this and then again on the next non-single reclaim) which at least triggers the WARN_ON_ONCE() in iwl_txq_reclaim(), but could have other negative side effects (such as unmapping a frame that wasn't transmitted yet, and then taking an IOMMU fault) as well. Fixes: 7b3e42ea2ead ("iwlwifi: support multiple tfd queue max sizes for different devices") Signed-off-by: Johannes Berg Signed-off-by: Miri Korenblit Link: https://msgid.link/20240205211151.4148a6ef54e0.I733a70f679c25f9f99097a8dcb3a1f8165da6997@changeid Signed-off-by: Johannes Berg Signed-off-by: Sasha Levin --- drivers/net/wireless/intel/iwlwifi/mvm/tx.c | 12 +++++++++--- 1 file changed, 9 insertions(+), 3 deletions(-) diff --git a/drivers/net/wireless/intel/iwlwifi/mvm/tx.c b/drivers/net/wireless/intel/iwlwifi/mvm/tx.c index 461f26d9214e4..930742e75c02a 100644 --- a/drivers/net/wireless/intel/iwlwifi/mvm/tx.c +++ b/drivers/net/wireless/intel/iwlwifi/mvm/tx.c @@ -1,6 +1,6 @@ // SPDX-License-Identifier: GPL-2.0 OR BSD-3-Clause /* - * Copyright (C) 2012-2014, 2018-2023 Intel Corporation + * Copyright (C) 2012-2014, 2018-2024 Intel Corporation * Copyright (C) 2013-2015 Intel Mobile Communications GmbH * Copyright (C) 2016-2017 Intel Deutschland GmbH */ @@ -1636,12 +1636,18 @@ static void iwl_mvm_tx_status_check_trigger(struct iwl_mvm *mvm, * of the batch. This is why the SSN of the SCD is written at the end of the * whole struct at a variable offset. This function knows how to cope with the * variable offset and returns the SSN of the SCD. + * + * For 22000-series and lower, this is just 12 bits. For later, 16 bits. */ static inline u32 iwl_mvm_get_scd_ssn(struct iwl_mvm *mvm, struct iwl_mvm_tx_resp *tx_resp) { - return le32_to_cpup((__le32 *)iwl_mvm_get_agg_status(mvm, tx_resp) + - tx_resp->frame_count) & 0xfff; + u32 val = le32_to_cpup((__le32 *)iwl_mvm_get_agg_status(mvm, tx_resp) + + tx_resp->frame_count); + + if (mvm->trans->trans_cfg->device_family >= IWL_DEVICE_FAMILY_AX210) + return val & 0xFFFF; + return val & 0xFFF; } static void iwl_mvm_rx_tx_cmd_single(struct iwl_mvm *mvm, -- 2.43.0