Received: by 2002:a25:8b91:0:0:0:0:0 with SMTP id j17csp1952288ybl; Sun, 19 Jan 2020 15:20:16 -0800 (PST) X-Google-Smtp-Source: APXvYqyB6EHYCTEEUc8X4OVstZJm4f2r2YtvOsCuOiCW5arNEWF9nNt0/NTGD+oaGeGiEVdWw4uz X-Received: by 2002:a9d:7b50:: with SMTP id f16mr14260683oto.18.1579476016346; Sun, 19 Jan 2020 15:20:16 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1579476016; cv=none; d=google.com; s=arc-20160816; b=GJovy1tQLYahbmiV82Bh2wpRKl7MBmDOG+iMSWdNC2Ejj5/HIt/uKr7xYFI54qMqYg hdiJmzDCGftcZIBFmrUOo6226MpvLAvEH1MiwEIG//gERnbBGnqspYs2Ne8scJMTf/GP 9Rr5ir4nTQNbVZVBdAjNq6mHVkCgVDrRpzpyr0b+FMNBanD/HVpT0ZcLEbKinTaU8u4k 4Q2uokeXFLRXbSXKecIQ0RHYUz1hYeoTWzmx9P8VPsARVkFku/Lt1LhHHqjdqFw6roGv 8ynHMqmICG85dq//mKdeS/EkUm0qrcUK/sNBrIq6kQshKyzYrCo9/frb1KKDOrrDceZg za1g== 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=X12hlSzK89PR4tKU7jLgOPassu6SytkSpEsEgzrzu4o=; b=U2KP27NHmT0i0gca2erFfKRIZVhUIxoPoqmpO0LjqtiCWZBi/0ISkK9FrSlZtUfiMe Q1HBp5jAngLXxm1ldCcwFvNJPiVCBQ7BOpFGRQjzokgE5j4WjX2+rNRqHmMxWBVmfev6 7NmdJl+GaEh4mkDLiHmnlPCUTVQC65HGyueci5zP6TlzfJJscgRQi/4mVQnWwcQgb3yy CbXs7WnvI3cZ3JgUA8ou/unq4b0PfbB8H2eB/+tRfSZkq+/CWpc/ndlDg7chkdssIY/x O8bzYGPG1qYYZmPSUrAyrPE6kHKkLDruXxPXvQuNAzRHpFkxVyfH6TsTr+J9HwOVZyNW CEQQ== 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 a128si16348574oib.142.2020.01.19.15.20.05; Sun, 19 Jan 2020 15:20:16 -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 S1729015AbgASXQc (ORCPT + 99 others); Sun, 19 Jan 2020 18:16:32 -0500 Received: from kvm5.telegraphics.com.au ([98.124.60.144]:49724 "EHLO kvm5.telegraphics.com.au" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1728886AbgASXQb (ORCPT ); Sun, 19 Jan 2020 18:16:31 -0500 Received: by kvm5.telegraphics.com.au (Postfix, from userid 502) id C34032991A; Sun, 19 Jan 2020 18:16:30 -0500 (EST) To: "David S. Miller" Cc: Thomas Bogendoerfer , Chris Zankel , Laurent Vivier , netdev@vger.kernel.org, linux-kernel@vger.kernel.org Message-Id: <5057d7da0f23a99fb0945bb26e2a0100e7031e75.1579474569.git.fthain@telegraphics.com.au> In-Reply-To: References: From: Finn Thain Subject: [PATCH net 02/19] net/sonic: Remove redundant next_tx variable Date: Mon, 20 Jan 2020 09:56:09 +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 | 10 ++++++---- drivers/net/ethernet/natsemi/sonic.h | 1 - 2 files changed, 6 insertions(+), 5 deletions(-) diff --git a/drivers/net/ethernet/natsemi/sonic.c b/drivers/net/ethernet/natsemi/sonic.c index 657b5327baf9..f31cb19ded50 100644 --- a/drivers/net/ethernet/natsemi/sonic.c +++ b/drivers/net/ethernet/natsemi/sonic.c @@ -215,7 +215,7 @@ static int sonic_send_packet(struct sk_buff *skb, struct net_device *dev) struct sonic_local *lp = netdev_priv(dev); dma_addr_t laddr; int length; - int entry = lp->next_tx; + int entry; netif_dbg(lp, tx_queued, dev, "%s: skb=%p\n", __func__, skb); @@ -237,6 +237,8 @@ static int sonic_send_packet(struct sk_buff *skb, struct net_device *dev) return NETDEV_TX_OK; } + 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 */ sonic_tda_put(dev, entry, SONIC_TD_PKTSIZE, length); /* length of packet */ @@ -260,8 +262,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); @@ -684,7 +686,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 2b27f7049acb..e402dc29d2aa 100644 --- a/drivers/net/ethernet/natsemi/sonic.h +++ b/drivers/net/ethernet/natsemi/sonic.h @@ -318,7 +318,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