Received: by 2002:a25:c593:0:0:0:0:0 with SMTP id v141csp1033842ybe; Wed, 4 Sep 2019 11:28:32 -0700 (PDT) X-Google-Smtp-Source: APXvYqwtTW0mgvu2Nzyw+m5Is2/38dt7MFLljEFJwt8/HTvdfRvVFv9hnQXRs1Q4g9kfxohiQzFY X-Received: by 2002:aa7:8bc2:: with SMTP id s2mr24869815pfd.13.1567621712280; Wed, 04 Sep 2019 11:28:32 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1567621712; cv=none; d=google.com; s=arc-20160816; b=JN7rYW3Mwu8/XH4NG8ndYrvSW+EgJ5/FyiHRq1/h+VDpyiwlIjt9E77tFoEeyjyH+W ydxRw/PPXXFRXXGTPgZQyYD1P6bjfZe+l0ILRA+utVrGkbUKmgVXMTuJ4YkRtqudZCv1 FgMfN4qrDagmKlpo9kdggwp3KZxgiZHdRFtk7rlWOwU0DGjXiRk3is/wGoR9lHAZdQrM jxr9TpH8HC0UgAWYdgkwj3cuQ9gwn05RDMpF8T72sQJP18qgd4cU8sYwe6UiG1LZKm6Q NcSwrN3kmUHnIxGNjouso+4Fgoi74Y5oPjCSxbizLzoGKN8cZEnRXj7ry+djKL2EwmYM l3Nw== 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=nB5+RZ6XbeHETjPR/ETO0Q4t1tp7uM6dbooyye2TLVA=; b=XcPV2Bjmos3zhRD49MArHMzAqF2zUmvCoTRzKGOT3/NeTSdiExSMRS/7QV9espTk47 MVRQoqPg8kEV9oCzR/mTCMwCf0Txq3P15tDi0wNQV57//8LYEGQ7AvbZgVLec2tCyQuZ HUQyrDmcFaA4g0TMTJ7QgQrMk7ZfWLGFBoitmZH733merZHMdpHBSsZPWs3IsI8tZB8e A6RewIddTzMDYum02PlhuNB5mh0s9aLDpjEEQ3ALJ1hQevZQ39pxkQUoUzJQU59Hdsc3 010fSRe/qjJiiLhAFbS44u4oo65V3ry7gNevKE/obbQbGzeS8jiZkJA3m3N7iSaWyijm sBVA== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@kernel.org header.s=default header.b=as9PE2u5; 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 u190si17684129pgd.547.2019.09.04.11.28.16; Wed, 04 Sep 2019 11:28:32 -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=as9PE2u5; 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 S2388463AbfIDSZt (ORCPT + 99 others); Wed, 4 Sep 2019 14:25:49 -0400 Received: from mail.kernel.org ([198.145.29.99]:38222 "EHLO mail.kernel.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1733309AbfIDR7W (ORCPT ); Wed, 4 Sep 2019 13:59:22 -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 6339922CEA; Wed, 4 Sep 2019 17:59:21 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=default; t=1567619961; bh=HnfORa65omEf3PVNuM+1N1Dl3qOV6wAD00tUc5HBvgA=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=as9PE2u5Cdbpb7uQcj+6xy5amBUe7I85cJI7lNC8U0ZmyEMuMCTtLaVE35CaFcT47 efZE39g/M0SAnMdkC8j+vKijsFtvGV6VTykKobFmAUEuK/1KS+Y5P/vrePKGZy4FDZ 4seRvrX/jmb8VOHWBGfjWk5Q4XWhTJvml/w+TAlY= 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.9 21/83] net: hisilicon: fix hip04-xmit never return TX_BUSY Date: Wed, 4 Sep 2019 19:53:13 +0200 Message-Id: <20190904175305.739945720@linuxfoundation.org> X-Mailer: git-send-email 2.23.0 In-Reply-To: <20190904175303.488266791@linuxfoundation.org> References: <20190904175303.488266791@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 1fabbbd4544e7..c7e0b246cfdca 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