From nobody Fri Dec 19 07:17:39 2025 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by smtp.lore.kernel.org (Postfix) with ESMTP id 1B973C07E9D for ; Mon, 26 Sep 2022 10:26:26 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S235411AbiIZK0X (ORCPT ); Mon, 26 Sep 2022 06:26:23 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:39412 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S235377AbiIZKXg (ORCPT ); Mon, 26 Sep 2022 06:23:36 -0400 Received: from sin.source.kernel.org (sin.source.kernel.org [IPv6:2604:1380:40e1:4800::1]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 82029A445; Mon, 26 Sep 2022 03:17:11 -0700 (PDT) Received: from smtp.kernel.org (relay.kernel.org [52.25.139.140]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by sin.source.kernel.org (Postfix) with ESMTPS id C75A7CE10EF; Mon, 26 Sep 2022 10:16:55 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id C4C67C433C1; Mon, 26 Sep 2022 10:16:53 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1664187414; bh=NF2yEGR/cg3o7JkyY9xNLjF8yNV2cbYWzgoZV0XD4is=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=STcNtzWNEJi1zLtN5rqFZLcJJdLb63mlPFeJBWeCcCBbseCJcnM/Ht0j6bPGtFIzm roGDqj0sloXPlKYHBbtc5VRGUAVJHxUdIJ94tKAQgHL3J0rbQcLwsKO4L+ATNr3ccJ mukFc8Rxxa3uYzsHSwIW04SmZ3gN7gDzuc2wc6bI= From: Greg Kroah-Hartman To: linux-kernel@vger.kernel.org Cc: Greg Kroah-Hartman , stable@vger.kernel.org, Brett Creeley , Norbert Zulinski , Mateusz Palczewski , Konrad Jankowski , Tony Nguyen , Sasha Levin Subject: [PATCH 4.14 26/40] iavf: Fix cached head and tail value for iavf_get_tx_pending Date: Mon, 26 Sep 2022 12:11:54 +0200 Message-Id: <20220926100739.281461099@linuxfoundation.org> X-Mailer: git-send-email 2.37.3 In-Reply-To: <20220926100738.148626940@linuxfoundation.org> References: <20220926100738.148626940@linuxfoundation.org> User-Agent: quilt/0.67 MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Content-Type: text/plain; charset="utf-8" From: Brett Creeley [ Upstream commit 809f23c0423a43266e47a7dc67e95b5cb4d1cbfc ] The underlying hardware may or may not allow reading of the head or tail registers and it really makes no difference if we use the software cached values. So, always used the software cached values. Fixes: 9c6c12595b73 ("i40e: Detection and recovery of TX queue hung logic m= oved to service_task from tx_timeout") Signed-off-by: Brett Creeley Co-developed-by: Norbert Zulinski Signed-off-by: Norbert Zulinski Signed-off-by: Mateusz Palczewski Tested-by: Konrad Jankowski Signed-off-by: Tony Nguyen Signed-off-by: Sasha Levin --- drivers/net/ethernet/intel/i40evf/i40e_txrx.c | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/drivers/net/ethernet/intel/i40evf/i40e_txrx.c b/drivers/net/et= hernet/intel/i40evf/i40e_txrx.c index 4afdabbe95e8..d74a307da8f1 100644 --- a/drivers/net/ethernet/intel/i40evf/i40e_txrx.c +++ b/drivers/net/ethernet/intel/i40evf/i40e_txrx.c @@ -138,8 +138,11 @@ u32 i40evf_get_tx_pending(struct i40e_ring *ring, bool= in_sw) { u32 head, tail; =20 + /* underlying hardware might not allow access and/or always return + * 0 for the head/tail registers so just use the cached values + */ head =3D ring->next_to_clean; - tail =3D readl(ring->tail); + tail =3D ring->next_to_use; =20 if (head !=3D tail) return (head < tail) ? --=20 2.35.1