Received: by 2002:a25:1506:0:0:0:0:0 with SMTP id 6csp4153709ybv; Mon, 10 Feb 2020 13:27:20 -0800 (PST) X-Google-Smtp-Source: APXvYqyBatNn3Uci8ATNxM6jn5gCFwwtu5sJAAaG+dyiIbmeaxmj5mH+TYt4ivz8H2vYw5fsWM5a X-Received: by 2002:a9d:6a2:: with SMTP id 31mr2587747otx.313.1581370040562; Mon, 10 Feb 2020 13:27:20 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1581370040; cv=none; d=google.com; s=arc-20160816; b=syerG1DF2xSOxGWJBIliJGySyJr7j7JRiZ1uAP9rCSwj65BGMvVinpepkiBx2bmvQ4 hYF13u9m7nonJUg+Zp0GCH9QSLWORXVo5WwmvXjn+4hFjK5iW6XOtP3nZNuGvuKeXKDQ zuRNsPM8smHzXYYub3kBstZbTSWp0QztXPmPK3aLi0G/lEK39C4HmbLOFE4oIVa3Eo9j 4hOsqKq+PnYoGwbE2VbAoYSnYBG6NwFSwNNRGMEk9ZzKQmYs9f4G05eUNIaZLrLSagLv GNR2jyY3PWb/zImpnCk7WkvF+bB0Te3D4ulCsdlRNXxl7ukky2BpDn6b9+ULVCAePOd8 st8g== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:date:subject:from:references:in-reply-to :message-id:cc:to; bh=GDgN+BSYGPPHqodUdlOl1F7aND8030zXtuB0bROPMfA=; b=RmxcAczgChueCfVzHD/4vuJrvjsJaq22iKOnWlWR5gSeML0UJ/Wh/EZ6/kMFtoHUxu mT062iIGs58TOFmrSTQ9ItotftgFXszkaY0TAX9Tzx4xWRmGyIAFoyHxZWlluFqc9rhX jCu/wvsZaF9LtCmExYozOAa+b52NXwoKOyVORFsZ70MiDRJxY3xf/KH+iqIJ0iNGgm8q XYC2QrTNFW4qaFmGNFIztZRumAo6XHCp6NeOEfEsxjRQex1DCNdhZgTs6AYyb5WM3Icq 1Hx3Hey+XBiXNaDdAp38Q4KBBOrNSYEIQCz3pWPqTCzdGoLW9PShois6FSj7l6qGsL2a lzHA== ARC-Authentication-Results: i=1; mx.google.com; spf=pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Return-Path: Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id z1si764902otp.70.2020.02.10.13.27.08; Mon, 10 Feb 2020 13:27:20 -0800 (PST) Received-SPF: pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) client-ip=209.132.180.67; Authentication-Results: mx.google.com; spf=pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1727636AbgBJV0u (ORCPT + 99 others); Mon, 10 Feb 2020 16:26:50 -0500 Received: from kvm5.telegraphics.com.au ([98.124.60.144]:59716 "EHLO kvm5.telegraphics.com.au" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1727414AbgBJV0t (ORCPT ); Mon, 10 Feb 2020 16:26:49 -0500 Received: by kvm5.telegraphics.com.au (Postfix, from userid 502) id 1350F29B4E; Mon, 10 Feb 2020 16:26:48 -0500 (EST) To: "David S. Miller" Cc: Thomas Bogendoerfer , Chris Zankel , netdev@vger.kernel.org, linux-kernel@vger.kernel.org Message-Id: <0adf9819ded56830f460cd1643e9ce013ed33f6d.1581369531.git.fthain@telegraphics.com.au> In-Reply-To: References: From: Finn Thain Subject: [PATCH net-next 3/7] net/sonic: Remove redundant next_tx variable Date: Tue, 11 Feb 2020 08:18:50 +1100 Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org The eol_tx variable is the one that matters to the tx algorithm because packets are always placed at the end of the list. The next_tx variable just confuses things so remove it. Tested-by: Stan Johnson Signed-off-by: Finn Thain --- drivers/net/ethernet/natsemi/sonic.c | 8 ++++---- drivers/net/ethernet/natsemi/sonic.h | 1 - 2 files changed, 4 insertions(+), 5 deletions(-) diff --git a/drivers/net/ethernet/natsemi/sonic.c b/drivers/net/ethernet/natsemi/sonic.c index c066510b348e..9ecdd67e1410 100644 --- a/drivers/net/ethernet/natsemi/sonic.c +++ b/drivers/net/ethernet/natsemi/sonic.c @@ -300,7 +300,7 @@ static int sonic_send_packet(struct sk_buff *skb, struct net_device *dev) spin_lock_irqsave(&lp->lock, flags); - entry = lp->next_tx; + entry = (lp->eol_tx + 1) & SONIC_TDS_MASK; sonic_tda_put(dev, entry, SONIC_TD_STATUS, 0); /* clear status */ sonic_tda_put(dev, entry, SONIC_TD_FRAG_COUNT, 1); /* single fragment */ @@ -321,8 +321,8 @@ static int sonic_send_packet(struct sk_buff *skb, struct net_device *dev) sonic_tda_get(dev, lp->eol_tx, SONIC_TD_LINK) & ~SONIC_EOL); lp->eol_tx = entry; - lp->next_tx = (entry + 1) & SONIC_TDS_MASK; - if (lp->tx_skb[lp->next_tx] != NULL) { + entry = (entry + 1) & SONIC_TDS_MASK; + if (lp->tx_skb[entry]) { /* The ring is full, the ISR has yet to process the next TD. */ netif_dbg(lp, tx_queued, dev, "%s: stopping queue\n", __func__); netif_stop_queue(dev); @@ -811,7 +811,7 @@ static int sonic_init(struct net_device *dev) SONIC_WRITE(SONIC_UTDA, lp->tda_laddr >> 16); SONIC_WRITE(SONIC_CTDA, lp->tda_laddr & 0xffff); - lp->cur_tx = lp->next_tx = 0; + lp->cur_tx = 0; lp->eol_tx = SONIC_NUM_TDS - 1; /* diff --git a/drivers/net/ethernet/natsemi/sonic.h b/drivers/net/ethernet/natsemi/sonic.h index 053f12f5cf4a..3cbb62c860c8 100644 --- a/drivers/net/ethernet/natsemi/sonic.h +++ b/drivers/net/ethernet/natsemi/sonic.h @@ -321,7 +321,6 @@ struct sonic_local { unsigned int cur_tx; /* first unacked transmit packet */ unsigned int eol_rx; unsigned int eol_tx; /* last unacked transmit packet */ - unsigned int next_tx; /* next free TD */ int msg_enable; struct device *device; /* generic device */ struct net_device_stats stats; -- 2.24.1