From patchwork Wed Nov 22 18:56:46 2017 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Alexander H Duyck X-Patchwork-Id: 840496 X-Patchwork-Delegate: jeffrey.t.kirsher@intel.com Return-Path: X-Original-To: incoming@patchwork.ozlabs.org Delivered-To: patchwork-incoming@bilbo.ozlabs.org Authentication-Results: ozlabs.org; spf=pass (mailfrom) smtp.mailfrom=osuosl.org (client-ip=140.211.166.133; helo=hemlock.osuosl.org; envelope-from=intel-wired-lan-bounces@osuosl.org; receiver=) Authentication-Results: ozlabs.org; dkim=fail reason="signature verification failed" (2048-bit key; unprotected) header.d=gmail.com header.i=@gmail.com header.b="FHT/Wol9"; dkim-atps=neutral Received: from hemlock.osuosl.org (smtp2.osuosl.org [140.211.166.133]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by ozlabs.org (Postfix) with ESMTPS id 3yhssg5hhRz9s7B for ; Thu, 23 Nov 2017 06:27:19 +1100 (AEDT) Received: from localhost (localhost [127.0.0.1]) by hemlock.osuosl.org (Postfix) with ESMTP id 0943188713; Wed, 22 Nov 2017 19:27:18 +0000 (UTC) X-Virus-Scanned: amavisd-new at osuosl.org Received: from hemlock.osuosl.org ([127.0.0.1]) by localhost (.osuosl.org [127.0.0.1]) (amavisd-new, port 10024) with ESMTP id Iz9fRdU3H5Xx; Wed, 22 Nov 2017 19:27:14 +0000 (UTC) Received: from ash.osuosl.org (ash.osuosl.org [140.211.166.34]) by hemlock.osuosl.org (Postfix) with ESMTP id A13CE8845D; Wed, 22 Nov 2017 19:27:14 +0000 (UTC) X-Original-To: intel-wired-lan@lists.osuosl.org Delivered-To: intel-wired-lan@lists.osuosl.org Received: from silver.osuosl.org (smtp3.osuosl.org [140.211.166.136]) by ash.osuosl.org (Postfix) with ESMTP id 694F11C2272 for ; Wed, 22 Nov 2017 19:02:21 +0000 (UTC) Received: from localhost (localhost [127.0.0.1]) by silver.osuosl.org (Postfix) with ESMTP id 60EA32D00E for ; Wed, 22 Nov 2017 19:02:21 +0000 (UTC) X-Virus-Scanned: amavisd-new at osuosl.org Received: from silver.osuosl.org ([127.0.0.1]) by localhost (.osuosl.org [127.0.0.1]) (amavisd-new, port 10024) with ESMTP id YNd-8w8QuAvY for ; Wed, 22 Nov 2017 19:02:20 +0000 (UTC) X-Greylist: delayed 00:05:32 by SQLgrey-1.7.6 Received: from mail-pl0-f66.google.com (mail-pl0-f66.google.com [209.85.160.66]) by silver.osuosl.org (Postfix) with ESMTPS id C3C8E265B2 for ; Wed, 22 Nov 2017 19:02:20 +0000 (UTC) Received: by mail-pl0-f66.google.com with SMTP id k7so1255803pln.13 for ; Wed, 22 Nov 2017 11:02:20 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20161025; h=subject:from:to:date:message-id:in-reply-to:references:user-agent :mime-version:content-transfer-encoding; bh=vZWc+uGyyO4CYBFFLFeOKZrP4Z0y8fRj7PDprDGnPHg=; b=FHT/Wol9vLU0Th+hnZmCFFvfs6YxFaU5V6xyttFvhXIBreTyai7AlScAP216nIKSDJ rjtjcEbeCtOO9DRBdE8Hh9JW4DfX2aDnWbhVpiFjcs3VeA4cqOGE0Vk/zYXK1SuhH233 qeD3EiHghq5oYmUdmSTDCkX7tbDzx6OhY3SgDElvgq7B3SFxJnQiKfAxTWq1anBZvxoo gSuso2ToSCevWx7+yc0SiHnUFtmXjO6rFWhEDcIWEvC5rvTfYrhuQaGs5KxTkLK7lgK2 p6fnrTERT+faafidg6HJnIegQpiYHgjoV4khc7sSEumDzCLE+Lqs6gzAk7McOvrpX9Cr 0iyA== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:subject:from:to:date:message-id:in-reply-to :references:user-agent:mime-version:content-transfer-encoding; bh=vZWc+uGyyO4CYBFFLFeOKZrP4Z0y8fRj7PDprDGnPHg=; b=HpaSYO/J05+M5nsyHqs0USng3ZfWDjJa2Q0d5cP4zmY9x2TyT70ukiE5kGUTPPIv8k XVjPCYHs9VnSbdXvXeT95Yu/hRG7yN4/hnN4tN9BOy5hPHZyzB9MJT8a+q71jefesn++ kT91Ej+jny5Ma7+Zq5Cp6sqPbnIUO8QAmom8OojLnJ93lCk/LL5BKbmHyXZaU4JH7Gu4 f+AufXzsVs41yiRvejFM9/i9lQODh21bH1F8G4mFqMEQq3o+SS85cljmh1QmKJfxQIZv KyiOvRh1ENfLaqosk7nXRbjVx5qlEPLmtQf+f3rEzv5LDgpMn+uiqeCGEI8QUhKGY/rh bGGQ== X-Gm-Message-State: AJaThX6xgKqIM/qo1/AGamupf3L2xGRbItkk8C9foChVcHV/ZehUdHHt mdlYEn6MFvBhRc9ZsPzkZuJdGbwC X-Google-Smtp-Source: AGs4zMafiybAm67uYN/1/cRZZztOKfQW7rpMDXpzXzHAflNBE7c6OfAsjr0RoO/QxELJBpAQoK5Izw== X-Received: by 10.84.142.131 with SMTP id 3mr22190216plx.26.1511377007892; Wed, 22 Nov 2017 10:56:47 -0800 (PST) Received: from localhost.localdomain ([2001:470:b:9c3:9e5c:8eff:fe4f:f2d0]) by smtp.gmail.com with ESMTPSA id v81sm24975533pgb.51.2017.11.22.10.56.47 for (version=TLS1_2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Wed, 22 Nov 2017 10:56:47 -0800 (PST) From: Alexander Duyck To: intel-wired-lan@lists.osuosl.org Date: Wed, 22 Nov 2017 10:56:46 -0800 Message-ID: <20171122185646.29785.9424.stgit@localhost.localdomain> In-Reply-To: <20171122185256.29785.93548.stgit@localhost.localdomain> References: <20171122185256.29785.93548.stgit@localhost.localdomain> User-Agent: StGit/0.17.1-dirty MIME-Version: 1.0 Subject: [Intel-wired-lan] [jkirsher/next-queue PATCH 06/16] ixgbe: Use ring values to test for Tx pending X-BeenThere: intel-wired-lan@osuosl.org X-Mailman-Version: 2.1.24 Precedence: list List-Id: Intel Wired Ethernet Linux Kernel Driver Development List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: intel-wired-lan-bounces@osuosl.org Sender: "Intel-wired-lan" From: Alexander Duyck This patch simplifies the check for Tx pending traffic and makes it more holistic as there being any difference between next_to_use and next_to_clean is much more informative than if head and tail are equal, as it is possible for us to either not update tail, or not be notified of completed work in which case next_to_clean would not be equal to head. In addition the simplification makes it so that we don't have to read hardware which allows us to drop a number of variables that were previously being used in the call. Signed-off-by: Alexander Duyck Tested-by: Andrew Bowers --- drivers/net/ethernet/intel/ixgbe/ixgbe_main.c | 20 ++++---------------- 1 file changed, 4 insertions(+), 16 deletions(-) diff --git a/drivers/net/ethernet/intel/ixgbe/ixgbe_main.c b/drivers/net/ethernet/intel/ixgbe/ixgbe_main.c index 101b3521ab0b..69bababc0cf6 100644 --- a/drivers/net/ethernet/intel/ixgbe/ixgbe_main.c +++ b/drivers/net/ethernet/intel/ixgbe/ixgbe_main.c @@ -1064,24 +1064,12 @@ static u64 ixgbe_get_tx_completed(struct ixgbe_ring *ring) static u64 ixgbe_get_tx_pending(struct ixgbe_ring *ring) { - struct ixgbe_adapter *adapter; - struct ixgbe_hw *hw; - u32 head, tail; + unsigned int head, tail; - if (ring->l2_accel_priv) - adapter = ring->l2_accel_priv->real_adapter; - else - adapter = netdev_priv(ring->netdev); + head = ring->next_to_clean; + tail = ring->next_to_use; - hw = &adapter->hw; - head = IXGBE_READ_REG(hw, IXGBE_TDH(ring->reg_idx)); - tail = IXGBE_READ_REG(hw, IXGBE_TDT(ring->reg_idx)); - - if (head != tail) - return (head < tail) ? - tail - head : (tail + ring->count - head); - - return 0; + return ((head <= tail) ? tail : tail + ring->count) - head; } static inline bool ixgbe_check_tx_hang(struct ixgbe_ring *tx_ring)