Received: by 2002:a05:6359:c8b:b0:c7:702f:21d4 with SMTP id go11csp826642rwb; Mon, 26 Sep 2022 06:24:20 -0700 (PDT) X-Google-Smtp-Source: AMsMyM5L0AK9BvBA1XyQ7KOvLLsaPX4rUQdXqlczkqCvsScro8z9zEj5k8LxaLIDYGV9Eyv9ZbRK X-Received: by 2002:aa7:db58:0:b0:457:30ce:bcaa with SMTP id n24-20020aa7db58000000b0045730cebcaamr7304137edt.20.1664198660292; Mon, 26 Sep 2022 06:24:20 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1664198660; cv=none; d=google.com; s=arc-20160816; b=lqUPlcR1YEWUW/STfpsy1/BfqIp76ZwQk6pQbCenTT2KR5wUUG6mJab8gNZnXxbw2s 3XiruokdSS1PX0obxAU2eM90gc0AKlGnWIutNU5HE8sDrU+zUkV/su/zRn8WiKALMR2W eJ3lweU7qt14Rf2nOt41kSOI0ANx3YIuoAwQ+BipuQXcOJZBAu4gSmSNzUQX3pavhCjQ grHaaCRJzEjGKigF/OGnVNOdKg8hCZf1/MP8kLsepaM6hDeOAhmyItdV2fgqCNCBH96J R0pun0PqrqhA9cuM7Q9QaB7oLS6juFTw6gAEuuAKJ1SWj1rA90BYP7px3vieJW3x9/4W zu/Q== 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 :user-agent:references:in-reply-to:message-id:date:subject:cc:to :from:dkim-signature; bh=HyskS6sjv3pPr76mafVlxfAJrI5ajN45VQf6B+swCV0=; b=P1WKrAYwzgr6BM2lf7YPBDVpCMjAAVzs1ff64kKLAN2MGjDyUUDQDTj1iuLh42btEb CcM6cfzRWKGnCSjIH527fpz6Ygh3s3hTX1e8DdGxYNOSXItFLbG8RVSubFnRPiB2zhO4 RElw7cuP+QglDMFq5Cxb6nWP4UQcmtEVc846xebgJ0W4G6DwTb+6EzDav5H2LfbPxQWi e7IVaTJksHB+4rTF/D+9z3vxbQyVzMuR2LOMQ7K1pdzcpHk/P58c+UD34GowG1SwhBL4 Nm7S99I/3IJOPvnNWCaLTYZvyTm1RWr2r0LRZLtU2yIrUCKHBRRbYMgEHcJW4GN1YvDX rA/w== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linuxfoundation.org header.s=korg header.b=FYr4XsXe; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linuxfoundation.org Return-Path: Received: from out1.vger.email (out1.vger.email. [2620:137:e000::1:20]) by mx.google.com with ESMTP id wg7-20020a17090705c700b00782525053dbsi15207947ejb.699.2022.09.26.06.23.54; Mon, 26 Sep 2022 06:24:20 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel-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=pass header.i=@linuxfoundation.org header.s=korg header.b=FYr4XsXe; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linuxfoundation.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S236520AbiIZKqc (ORCPT + 99 others); Mon, 26 Sep 2022 06:46:32 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:42600 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S236552AbiIZKoB (ORCPT ); Mon, 26 Sep 2022 06:44:01 -0400 Received: from ams.source.kernel.org (ams.source.kernel.org [IPv6:2604:1380:4601:e00::1]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id C1E8A32DA4; Mon, 26 Sep 2022 03:25:12 -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 ams.source.kernel.org (Postfix) with ESMTPS id E81C6B80920; Mon, 26 Sep 2022 10:25:10 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id 4E9F7C433D7; Mon, 26 Sep 2022 10:25:09 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1664187909; bh=/WlxciwnRNUCW5MjxiZJbw8YecLX/8f6sOAW4c0RYOQ=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=FYr4XsXebiKTEra9k7bKHVKG+hGGVEQXJ8nkuahIB4nM9VSMq1V73PCX7WVGgIaUE 5exx8XadPZzk/uxuFULo08MsrP43nxjEsQFZpl3hPi8vBe4lyYHgKnCV/KdKMvuASn SB5Lcb35YBqz2QuOrkJvuuXyP2poX3jjTLpaHVpY= 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 5.4 072/120] iavf: Fix cached head and tail value for iavf_get_tx_pending Date: Mon, 26 Sep 2022 12:11:45 +0200 Message-Id: <20220926100753.624095049@linuxfoundation.org> X-Mailer: git-send-email 2.37.3 In-Reply-To: <20220926100750.519221159@linuxfoundation.org> References: <20220926100750.519221159@linuxfoundation.org> User-Agent: quilt/0.67 MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-Spam-Status: No, score=-7.2 required=5.0 tests=BAYES_00,DKIMWL_WL_HIGH, DKIM_SIGNED,DKIM_VALID,DKIM_VALID_AU,DKIM_VALID_EF,RCVD_IN_DNSWL_HI, SPF_HELO_NONE,SPF_PASS 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-kernel@vger.kernel.org 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 moved 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/iavf/iavf_txrx.c | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/drivers/net/ethernet/intel/iavf/iavf_txrx.c b/drivers/net/ethernet/intel/iavf/iavf_txrx.c index c6905d1b6182..ce2f6d1ca79f 100644 --- a/drivers/net/ethernet/intel/iavf/iavf_txrx.c +++ b/drivers/net/ethernet/intel/iavf/iavf_txrx.c @@ -114,8 +114,11 @@ u32 iavf_get_tx_pending(struct iavf_ring *ring, bool in_sw) { u32 head, tail; + /* underlying hardware might not allow access and/or always return + * 0 for the head/tail registers so just use the cached values + */ head = ring->next_to_clean; - tail = readl(ring->tail); + tail = ring->next_to_use; if (head != tail) return (head < tail) ? -- 2.35.1