linux-kernel.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: Jiangfeng Xiao <xiaojiangfeng@huawei.com>
To: <davem@davemloft.net>, <yisen.zhuang@huawei.com>,
	<salil.mehta@huawei.com>, <xiaojiangfeng@huawei.com>
Cc: <netdev@vger.kernel.org>, <linux-kernel@vger.kernel.org>,
	<leeyou.li@huawei.com>, <xiaowei774@huawei.com>,
	<nixiaoming@huawei.com>
Subject: [PATCH v1 2/3] net: hisilicon: fix hip04-xmit never return TX_BUSY
Date: Sat, 3 Aug 2019 20:31:40 +0800	[thread overview]
Message-ID: <1564835501-90257-3-git-send-email-xiaojiangfeng@huawei.com> (raw)
In-Reply-To: <1564835501-90257-1-git-send-email-xiaojiangfeng@huawei.com>

TX_DESC_NUM is 256, in tx_count, the maximum value of
mod(TX_DESC_NUM - 1) is 254, the variable "count" in
the hip04_mac_start_xmit function is never equal to
(TX_DESC_NUM - 1), so hip04_mac_start_xmit never
return NETDEV_TX_BUSY.

tx_count is modified to mod(TX_DESC_NUM) so that
the maximum value of tx_count can reach
(TX_DESC_NUM - 1), then hip04_mac_start_xmit can reurn
NETDEV_TX_BUSY.

Signed-off-by: Jiangfeng Xiao <xiaojiangfeng@huawei.com>
---
 drivers/net/ethernet/hisilicon/hip04_eth.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/drivers/net/ethernet/hisilicon/hip04_eth.c b/drivers/net/ethernet/hisilicon/hip04_eth.c
index 1e1b154..d775b98 100644
--- a/drivers/net/ethernet/hisilicon/hip04_eth.c
+++ b/drivers/net/ethernet/hisilicon/hip04_eth.c
@@ -248,7 +248,7 @@ struct hip04_priv {
 
 static inline unsigned int tx_count(unsigned int head, unsigned int tail)
 {
-	return (head - tail) % (TX_DESC_NUM - 1);
+	return (head - tail) % TX_DESC_NUM;
 }
 
 static void hip04_config_port(struct net_device *ndev, u32 speed, u32 duplex)
-- 
1.8.5.6


  parent reply	other threads:[~2019-08-03 12:32 UTC|newest]

Thread overview: 8+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2019-08-03 12:31 [PATCH v1 0/3] net: hisilicon: Fix a few problems with hip04_eth Jiangfeng Xiao
2019-08-03 12:31 ` [PATCH v1 1/3] net: hisilicon: make hip04_tx_reclaim non-reentrant Jiangfeng Xiao
2019-08-06  0:46   ` Jakub Kicinski
2019-08-06  2:00     ` Jiangfeng Xiao
2019-08-06  3:05       ` Jakub Kicinski
2019-08-03 12:31 ` Jiangfeng Xiao [this message]
2019-08-03 12:31 ` [PATCH v1 3/3] net: hisilicon: Fix dma_map_single failed on arm64 Jiangfeng Xiao
2019-08-06 21:15 ` [PATCH v1 0/3] net: hisilicon: Fix a few problems with hip04_eth David Miller

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=1564835501-90257-3-git-send-email-xiaojiangfeng@huawei.com \
    --to=xiaojiangfeng@huawei.com \
    --cc=davem@davemloft.net \
    --cc=leeyou.li@huawei.com \
    --cc=linux-kernel@vger.kernel.org \
    --cc=netdev@vger.kernel.org \
    --cc=nixiaoming@huawei.com \
    --cc=salil.mehta@huawei.com \
    --cc=xiaowei774@huawei.com \
    --cc=yisen.zhuang@huawei.com \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).