Received: by 2002:ab2:6857:0:b0:1ef:ffd0:ce49 with SMTP id l23csp2370184lqp; Sun, 24 Mar 2024 16:13:42 -0700 (PDT) X-Forwarded-Encrypted: i=3; AJvYcCXvwUJCLmTxe1oulDSWnaEMfPcKgDy/+HQlcc5TxHtMdOrBv3rQElSwfeGTWu5c+ZyvehqfGu/QodTjJs9S+MK/CPCPByruC5mE/tzbyQ== X-Google-Smtp-Source: AGHT+IGuspCZVDGUHayDvro2IUdmWSt8umN7lGd7WgC3z26wdVDs4BXZmU74cGu0NlXepqC6T/DL X-Received: by 2002:ac8:5d86:0:b0:430:eefa:56a5 with SMTP id d6-20020ac85d86000000b00430eefa56a5mr6576822qtx.38.1711322021976; Sun, 24 Mar 2024 16:13:41 -0700 (PDT) ARC-Seal: i=2; a=rsa-sha256; t=1711322021; cv=pass; d=google.com; s=arc-20160816; b=oQXTNHwzxhcM/C+GIq/a69Ox+Ttx/Lqdm9gfDZ/5KxgMuU8QiM3FVQGGW/Ww4TY2ah OFAR4rXzBhhrfeNp1bD5F6qqGfdxWAC4wbFHknA5aPI4F7UpXCAEqeP5zBH08Lgjd72C jh9IYIcIK4od5gwqNtgXRF5Ve8zlMK0dtGls+8TWH4A6m+en2vMElSu67Eu5UabPdSF1 ovHY9LeENxf/C0bUX5l2iFqD+2Z1zj9y70N69mLbHrCtsgOZuZdrln46edPlYVY4/ayN Nl2Z0b6C7HkxRxu/7+kkUSVo6dQnW1xVNDi2TnwwYKrc3+ZwIgbTB4NYAauO4wgPKDY6 VeRQ== 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=JrRvJlVQdArMG5IWOzKJNbIrnJk2OB40m5gxiNTaCSG5MGidxEdcOqjC3SjYRnWd4S IDlxLeInqb7WVt1M6wGAZMMGnSz9xbR1a6pRIqQnnf5y3wTM0TS22lqPbDqk9Kgyqk4S NqbfdQKwziYLPyVyr3XG4sNncLNPTrhkwZpJ3efc1ysZAr+ceec00hsvpHyBcAh+iWse gb3vTRiqcef1YOnhwj12OO/+pAxxT69QAOb2jUjvoStLnHuqKJnjCjtrmuT4wylXznmG q7rXFgRw45itkjs/fi+GS6yg3ZdO5sBfjIKNt3As22MEWNbxhEWkcd+RsltFXxM9SfBo h8gA==; dara=google.com ARC-Authentication-Results: i=2; mx.google.com; dkim=pass header.i=@kernel.org header.s=k20201202 header.b="K/TPv3Zs"; arc=pass (i=1 dkim=pass dkdomain=kernel.org); spf=pass (google.com: domain of linux-kernel+bounces-113058-linux.lists.archive=gmail.com@vger.kernel.org designates 2604:1380:45d1:ec00::1 as permitted sender) smtp.mailfrom="linux-kernel+bounces-113058-linux.lists.archive=gmail.com@vger.kernel.org"; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=kernel.org Return-Path: Received: from ny.mirrors.kernel.org (ny.mirrors.kernel.org. [2604:1380:45d1:ec00::1]) by mx.google.com with ESMTPS id h3-20020a05622a170300b00431487e1b86si3035966qtk.113.2024.03.24.16.13.41 for (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Sun, 24 Mar 2024 16:13:41 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel+bounces-113058-linux.lists.archive=gmail.com@vger.kernel.org designates 2604:1380:45d1:ec00::1 as permitted sender) client-ip=2604:1380:45d1:ec00::1; Authentication-Results: mx.google.com; dkim=pass header.i=@kernel.org header.s=k20201202 header.b="K/TPv3Zs"; arc=pass (i=1 dkim=pass dkdomain=kernel.org); spf=pass (google.com: domain of linux-kernel+bounces-113058-linux.lists.archive=gmail.com@vger.kernel.org designates 2604:1380:45d1:ec00::1 as permitted sender) smtp.mailfrom="linux-kernel+bounces-113058-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 ny.mirrors.kernel.org (Postfix) with ESMTPS id 9028A1C214E6 for ; Sun, 24 Mar 2024 23:13:41 +0000 (UTC) Received: from localhost.localdomain (localhost.localdomain [127.0.0.1]) by smtp.subspace.kernel.org (Postfix) with ESMTP id A5698145FFB; Sun, 24 Mar 2024 22:37:47 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=kernel.org header.i=@kernel.org header.b="K/TPv3Zs" 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 B617F145B3C; Sun, 24 Mar 2024 22:37:46 +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=1711319866; cv=none; b=EzfBD1QU+mcaW/bxgltDOtaoCQMDfD/o5El0bEE4pbt331t/Z8qdxoGMxomZ89WrHSJRmSMDws2ZLsWFgOQXCaAuyECtu4zs4OtR+Q/gudUQWWetFx7a/NRWJXJxRCWdRRFmHzwqUESqlUaCK3vkavyunnmIVNDSNlO1yqaoxjM= ARC-Message-Signature:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1711319866; c=relaxed/simple; bh=lzVnQlyO7tR3vPso14hf/vGA5Oj0nELSAcGLnpQb/UU=; h=From:To:Cc:Subject:Date:Message-ID:In-Reply-To:References: MIME-Version; b=MeqyC+JT2Yo6tCroDGOBxKFljR1YtErfk35tfLCLPniEQjOgVPeMwXnUIlepyy0/1FVP4Vpo/SHKoW/v3bwGuSULw/rPzRRgRBNjb7f3q7cw7kFM7NNTyRIP5tnsneRnfaWMeFHXpi33+xrRirWgu6dp1K+yzOaiY2ROX5EFSts= ARC-Authentication-Results:i=1; smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=kernel.org header.i=@kernel.org header.b=K/TPv3Zs; arc=none smtp.client-ip=10.30.226.201 Received: by smtp.kernel.org (Postfix) with ESMTPSA id 0176FC43390; Sun, 24 Mar 2024 22:37:45 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=k20201202; t=1711319866; bh=lzVnQlyO7tR3vPso14hf/vGA5Oj0nELSAcGLnpQb/UU=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=K/TPv3ZsqfDyW0nK39bFykE34nZqzoiyRyvYXhG8y8tZ9j8m/EXT53NXqEpN2DDhG 1pb3z9XVcYbUeW2UPdn39jA41vUIYq1cIYywvB3lrS5852Xnc557LgsQI57j5gpf6V 988Y5rLVHOitL6YB5ytrrJGGmhVr6X6e72UZ8zyokrpaK9JVI5xipVi8PRH56QECJ7 Q6pOosdPqRUTZV3UC6Rva6fAGrWF9YMWgui9iHVPcO+3SkxGoE5K0FFchyB+X1gmZd flP4PRxkp2mOd4nyJOq3euaKqh77cRFrlDx605Sf253II21Az5Spymwn3/vwVAvNfo btVu+LCLuQYIQ== From: Sasha Levin To: linux-kernel@vger.kernel.org, stable@vger.kernel.org Cc: Johannes Berg , Miri Korenblit , Sasha Levin Subject: [PATCH 6.8 171/715] wifi: iwlwifi: mvm: fix erroneous queue index mask Date: Sun, 24 Mar 2024 18:25:50 -0400 Message-ID: <20240324223455.1342824-172-sashal@kernel.org> X-Mailer: git-send-email 2.43.0 In-Reply-To: <20240324223455.1342824-1-sashal@kernel.org> References: <20240324223455.1342824-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