Received: by 2002:a25:b794:0:0:0:0:0 with SMTP id n20csp1212190ybh; Sat, 3 Aug 2019 20:44:51 -0700 (PDT) X-Google-Smtp-Source: APXvYqz4tlhe6s9UvyUqCQeJln4wjpmB4IMJQI60rHfSww5hxxaDb7ks2pIVNDbj9rvXvZIyDy7p X-Received: by 2002:a17:902:3181:: with SMTP id x1mr135776808plb.135.1564890291475; Sat, 03 Aug 2019 20:44:51 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1564890291; cv=none; d=google.com; s=arc-20160816; b=i9TLK2RUmBeZrWOFSqZdXnZhgWMns52s8lAvVzJKrlKduCQq3Fc0Q0OVWRycRi57JK 1NxfDWd0CjNqOFEHEDB5aL1YVdFqAvxHYk6a2DdgfYRKFmWNhnoBD/BYXtP3mZRjYho1 ETg+otp/LGfIXXFDe4aY+XJvTssnqKiDrAa7EnaDeNs/f2bhEVjzdGCRVYbzar0L6TRB 7MPwNcmofXDQsw7g3Z833q61hGbOs8ZTbUpbE1/3QazXg1ryKhMmUgR3+3iqE1k7dAyu z0X9XFRnl/j2riwuFTex4bNplNM0AnXY+HUDpkaAWbMsw0EIkI/lNn7vs+eD2jALnelm PGxQ== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from; bh=17vqf7CjR4hvG7wBPhgcbiNwssSbZktIvV88okU1T5E=; b=o5/I0fks+znnq+ZQ3LxQkfjRdXaaPijiVmg3YbPbsLFBynF5IcqlXV6GKAQV6+i+Hs 7j57ki50LtltLmSTp42zBm+RpZWfRILqxasHu2DcHnIPYoLGx8KAgr9pWij/xQgyR+d3 2UJcv9E0V/AGtJ/+raVYq4AltmYHt0T6M4bRofuE4Dl7U5FutqpxYCqjOQzClfyd6Sv6 lxsaeOfcopD1NpBZXxZtPTirzUEVd+2L/wOqHaJVAEu3OX9uRHPrb8WK/Rl9a4/XFO6e z+tXGdSxsLKIHUCj1sC7uFv6KNCgAWLHzoIpRJ0B8Z2sSERL+hpikezt/6CR5mGAPONT 9AHg== 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 g4si39232412pgf.383.2019.08.03.20.44.36; Sat, 03 Aug 2019 20:44:51 -0700 (PDT) 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 S2390702AbfHCMcE (ORCPT + 99 others); Sat, 3 Aug 2019 08:32:04 -0400 Received: from szxga04-in.huawei.com ([45.249.212.190]:4165 "EHLO huawei.com" rhost-flags-OK-OK-OK-FAIL) by vger.kernel.org with ESMTP id S2389812AbfHCMcE (ORCPT ); Sat, 3 Aug 2019 08:32:04 -0400 Received: from DGGEMS403-HUB.china.huawei.com (unknown [172.30.72.59]) by Forcepoint Email with ESMTP id 8D35813640DAA1DA6A1F; Sat, 3 Aug 2019 20:31:58 +0800 (CST) Received: from huawei.com (10.67.189.167) by DGGEMS403-HUB.china.huawei.com (10.3.19.203) with Microsoft SMTP Server id 14.3.439.0; Sat, 3 Aug 2019 20:31:51 +0800 From: Jiangfeng Xiao To: , , , CC: , , , , Subject: [PATCH v1 2/3] net: hisilicon: fix hip04-xmit never return TX_BUSY Date: Sat, 3 Aug 2019 20:31:40 +0800 Message-ID: <1564835501-90257-3-git-send-email-xiaojiangfeng@huawei.com> X-Mailer: git-send-email 1.8.5.6 In-Reply-To: <1564835501-90257-1-git-send-email-xiaojiangfeng@huawei.com> References: <1564835501-90257-1-git-send-email-xiaojiangfeng@huawei.com> MIME-Version: 1.0 Content-Type: text/plain X-Originating-IP: [10.67.189.167] X-CFilter-Loop: Reflected Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org 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 --- 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