Received: by 2002:a25:8b12:0:0:0:0:0 with SMTP id i18csp5238128ybl; Tue, 27 Aug 2019 01:20:22 -0700 (PDT) X-Google-Smtp-Source: APXvYqwseDg3BwYT6Jqwunicq8bEg/k5W5Ph51Y93tf0HrFua9fEpBXBJ3FWhq6prHjiIbdFgTBo X-Received: by 2002:a62:764f:: with SMTP id r76mr24318115pfc.149.1566894021916; Tue, 27 Aug 2019 01:20:21 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1566894021; cv=none; d=google.com; s=arc-20160816; b=LfT8J3xIIr4cX5g/WRHFd80HgwcvT6cTmw0IT0okXUGG1lcN1Z2cLU8EdGauHfNSEO d1s9Wag/FG7aUF5Sy8bKWxeFWpfhnbZ+ogQBIwM6qwqEWEh/L3VUqdGwtApKuR8oeDmb Q3tEPh3We5ZPeQfPOIzQ8l6kvcJjkb2M/QO6gGHPHBBkuf1DQwlR/s8eNqVLPPBoYVZh kBBNiis4OSlIhNTZXW7DBq/cOm9tRtHUILA3WndJUGi7ksEdbkzzdktYsSZfvja9enPy WwqOol+o8a5DFJoaFQ1R3w2yYk7VyBoou3NvwLh+hd/wfmf5Lg1nwiV5kpvWk4EBuJA4 c4zw== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:content-transfer-encoding:mime-version :user-agent:references:in-reply-to:message-id:date:subject:cc:to :from:dkim-signature; bh=enYiuOSW9DYmMk6PRVIZwBJsZ2yzEbnmuTXf8ZAPHFQ=; b=UKv/95tcHJ6WODY04UGbUZM1HtYplqGvmsLDpD9kPbFfFuvC/cFPP8WptQZyekJhvI L9HIE/GkVaAyTjFxyYFx1Cu3HohWuQ4dKxc+in/8NHdsAmPZMXOUANq9Fsbl20mnhCuu xB1DCjUzaeuPfTfCTmmmBytTs+DPtEySWLKy03VNKPeEJZ2HFBW6W6jWNEm876m7M0eF 1hg51FhsQUIqYZNf/qSSz7QaxxlYuz598X5vV7FvvWVD0A40kQFUZRDGwRtF8PNfWmTl Fhb1AFGEMGvmYlFsl0vDoSWJpzTA/yJJc1ogwIGU78A/S30jTwia9BToQQJD8RBUgu/e ZmGQ== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@kernel.org header.s=default header.b=j8drBjgf; 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 t9si1904521pjy.47.2019.08.27.01.20.06; Tue, 27 Aug 2019 01:20:21 -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; dkim=pass header.i=@kernel.org header.s=default header.b=j8drBjgf; 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 S1729499AbfH0Hwg (ORCPT + 99 others); Tue, 27 Aug 2019 03:52:36 -0400 Received: from mail.kernel.org ([198.145.29.99]:43922 "EHLO mail.kernel.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1729433AbfH0Hwc (ORCPT ); Tue, 27 Aug 2019 03:52:32 -0400 Received: from localhost (83-86-89-107.cable.dynamic.v4.ziggo.nl [83.86.89.107]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by mail.kernel.org (Postfix) with ESMTPSA id 93155206BA; Tue, 27 Aug 2019 07:52:30 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=default; t=1566892351; bh=hBhas3GVFfsi+AHYvkMyLMZf4LS7PJ9FkZl7oEb0mmc=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=j8drBjgfBDsQOiw7S+z/kXYjAgIsi2unKPDD62X/fsE9pjW6O24CcW2jVkWNAz+WN ALJnPPqfjvAxR3/KQrK4gOSLN4wRv7GrK96ksosvjjkNVTyc4dQKbbwsrCQQxbrqF2 0q//IkXnSFxW82omNRXY1fYacgSYXlgJuc1nIC6k= From: Greg Kroah-Hartman To: linux-kernel@vger.kernel.org Cc: Greg Kroah-Hartman , stable@vger.kernel.org, Jiangfeng Xiao , "David S. Miller" , Sasha Levin Subject: [PATCH 4.14 26/62] net: hisilicon: fix hip04-xmit never return TX_BUSY Date: Tue, 27 Aug 2019 09:50:31 +0200 Message-Id: <20190827072701.978277279@linuxfoundation.org> X-Mailer: git-send-email 2.23.0 In-Reply-To: <20190827072659.803647352@linuxfoundation.org> References: <20190827072659.803647352@linuxfoundation.org> User-Agent: quilt/0.66 MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org [ Upstream commit f2243b82785942be519016067ee6c55a063bbfe2 ] 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 Signed-off-by: David S. Miller Signed-off-by: Sasha Levin --- 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 60ef6d40e4896..b04fb82d7fa3e 100644 --- a/drivers/net/ethernet/hisilicon/hip04_eth.c +++ b/drivers/net/ethernet/hisilicon/hip04_eth.c @@ -185,7 +185,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) -- 2.20.1