Received: by 2002:a25:1506:0:0:0:0:0 with SMTP id 6csp3182184ybv; Sat, 15 Feb 2020 13:18:52 -0800 (PST) X-Google-Smtp-Source: APXvYqy8S5jARVU9+Dw5NWCpLChPrDq1OqAAFg5+qNKcxiAxq2HktiTjPM7KOGg7XCQVvGyXe0V5 X-Received: by 2002:a9d:7489:: with SMTP id t9mr5350017otk.255.1581801531884; Sat, 15 Feb 2020 13:18:51 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1581801531; cv=none; d=google.com; s=arc-20160816; b=M0Lp9JCt3HSOoX4M6poahJoonYlGwB6k8pmtBQJ6NxJNnbsLJnOz0ErWvQmlnYXmiK dCXSt0GzMLlvNkogYllK+TksNKdjkMYFjeWNoGUuGBFw2NKUSEvNtuE8DLoWfzV1cjr2 DX4MU+GG1XYzRq7BA+SpsS1iEeYZTgGgir4jRNJQp8RDEa2Oyvxr6OFLtaiJtDfZ/BKy /X4RBCncgsQiKkj4bNqtVQgu49q397f879kkDNjpxuGuhz2YRcxjR2ELXQRyqZvQ4cVI I3VgNeF1lhXIlPni2IauJwwoVGFlZmScyBDtC5EVVlDaEf3evkOP6iH75tYY624xhhG8 h9bg== 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=vH8uYS8Mt/DSL6vyJe9nOVcQz9D8Gw0F1rpzItg+1AJq77LZ4PMZ1VrOH1t5XvAVm6 4dkXz6HFDiUyUdYlghiwqYLxqIoY/1LP8tf2yPsriq5cgfZI9qumqZNX1SZfsBoLsCE6 +rvtVw048Gj9FOnpiruhz6Inw8xFPxUbm+oVVi1bD1p9D5y6zzVON57bo/I8H9ctUkle /B9FtOV/Ivt5Fnd8eHiNP10yKHbRgbzahxivMQKXupxNOjutvj4RwzU1mUnkqMVUO4I7 +Ik/6QA6W39vfv3PQB3a4We1TCnX933KQ/VryiKWikfqK0RT5USwI8n61MTz9/hYqKDi JyhQ== 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 n24si3676065otf.58.2020.02.15.13.18.40; Sat, 15 Feb 2020 13:18:51 -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 S1727809AbgBOVSD (ORCPT + 99 others); Sat, 15 Feb 2020 16:18:03 -0500 Received: from kvm5.telegraphics.com.au ([98.124.60.144]:34904 "EHLO kvm5.telegraphics.com.au" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1726340AbgBOVSC (ORCPT ); Sat, 15 Feb 2020 16:18:02 -0500 Received: by kvm5.telegraphics.com.au (Postfix, from userid 502) id C667D29B2B; Sat, 15 Feb 2020 16:18:01 -0500 (EST) To: "David S. Miller" Cc: Thomas Bogendoerfer , Chris Zankel , netdev@vger.kernel.org, linux-kernel@vger.kernel.org Message-Id: <0adf9819ded56830f460cd1643e9ce013ed33f6d.1581800613.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: Sun, 16 Feb 2020 08:03:32 +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