Received: by 2002:ac0:a582:0:0:0:0:0 with SMTP id m2-v6csp5466921imm; Tue, 16 Oct 2018 10:39:48 -0700 (PDT) X-Google-Smtp-Source: ACcGV60zaU7pH4vN/uIj51IMsCp8OTMeYnUR+lZTplpXRVT500zRVIiCw3tweo8NBSC4k006YV3f X-Received: by 2002:a63:ac56:: with SMTP id z22-v6mr21218989pgn.444.1539711588247; Tue, 16 Oct 2018 10:39:48 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1539711588; cv=none; d=google.com; s=arc-20160816; b=DxvphpB4aCtuDy+R01qjtJrKKQyuC3kKumnikdNfRcuYc3iWei2KDhYlbjauP7m75c Vkeya1j8sk5UmHyKd8m9o/Jo1P7ucRGHFI7pNINhKlcZArUZczrsp4WcrnQb5+f0zPWH 5NKiMt3URf1bzlsfrAL2YnRHuY5Brzr+ti4nJnRwxAXcXMPCXM+43rnGvjW20gf4Wbx1 F+IAMsUd0JR+cQQBAJj3W2hdymAIo4mCUlXUw9Q92vZeox6fSs7rW4ugh5A/9JMuDLRE rQ3HA92c8wkKoCHsuF30o/Nh9DaVs04r7QphpTPPT9/KZNZHc1lNi1cK9WP5agC702g9 UIWw== 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=Vs4mnxfRBoPSmcO3E5ldh9lkzYGN489Ryi3hllnUhSc=; b=rJ2T70NtQaXCK1NVYJ0ZHxzYO5idTRE2xxJa/6LiKxkjz0U4Bfwby94d+tXcuPk1E5 Zm4wFqBaOHR94m0qyWG2FVKZA77IA73pMISpecZA/esdTIo5MirHTpgRCZpSbHEmePa1 c6zs729YkHg9IDjR5sUb0juprt7RbVbkT+5zLdkxkwqyqGpJU/Vus193hqqQEvJBDXKI kd0SxICl4oYYkI9INNOcwTni0bpwwDFPVK+Bn5pUFtHVuk1CWtVs4nroCHRBVYTkb4Sf 7dp5hoslfyGz3rD/+F45ilD3+kZ7p/xkTzLAD+xYB8SRJsMtodbvD8n+3ht4OyivqUAC ek7w== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@kernel.org header.s=default header.b=QBLOqQ07; 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 b1-v6si2653708pld.419.2018.10.16.10.39.32; Tue, 16 Oct 2018 10:39:48 -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=QBLOqQ07; 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 S1730046AbeJQBJZ (ORCPT + 99 others); Tue, 16 Oct 2018 21:09:25 -0400 Received: from mail.kernel.org ([198.145.29.99]:54230 "EHLO mail.kernel.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1728441AbeJQBJY (ORCPT ); Tue, 16 Oct 2018 21:09:24 -0400 Received: from localhost (ip-213-127-77-176.ip.prioritytelecom.net [213.127.77.176]) (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 BC0FA2089E; Tue, 16 Oct 2018 17:17:59 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=default; t=1539710280; bh=WuFK3JVrToevEogrBHPba/MZjBbua3kHCgtJU67UFW4=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=QBLOqQ07Vt034haOgo76m8ZWzTPtHnpnZOAOBjQFFsvFngPNXfNX+g8b8yLE5sVsU QhKhmDQUhOdpA7MGX+sthmPAGpGatE9mdekpjpoms+aYngtddpG0gv8u9FDNOU7DZj hz6oGEjW2YLuhKcWmm+qeG30uvvzdCCxhkjjCvT8= From: Greg Kroah-Hartman To: linux-kernel@vger.kernel.org Cc: Greg Kroah-Hartman , stable@vger.kernel.org, Jose Abreu , "David S. Miller" , Joao Pinto , Giuseppe Cavallaro , Alexandre Torgue Subject: [PATCH 4.14 026/109] net: stmmac: Fixup the tail addr setting in xmit path Date: Tue, 16 Oct 2018 19:04:54 +0200 Message-Id: <20181016170526.521519874@linuxfoundation.org> X-Mailer: git-send-email 2.19.1 In-Reply-To: <20181016170524.530541524@linuxfoundation.org> References: <20181016170524.530541524@linuxfoundation.org> User-Agent: quilt/0.65 X-stable: review 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 4.14-stable review patch. If anyone has any objections, please let me know. ------------------ From: Jose Abreu [ Upstream commit 0431100b3d82c509729ece1ab22ada2484e209c1 ] Currently we are always setting the tail address of descriptor list to the end of the pre-allocated list. According to databook this is not correct. Tail address should point to the last available descriptor + 1, which means we have to update the tail address everytime we call the xmit function. This should make no impact in older versions of MAC but in newer versions there are some DMA features which allows the IP to fetch descriptors in advance and in a non sequential order so its critical that we set the tail address correctly. Signed-off-by: Jose Abreu Fixes: f748be531d70 ("stmmac: support new GMAC4") Cc: David S. Miller Cc: Joao Pinto Cc: Giuseppe Cavallaro Cc: Alexandre Torgue Signed-off-by: David S. Miller Signed-off-by: Greg Kroah-Hartman --- drivers/net/ethernet/stmicro/stmmac/stmmac_main.c | 8 +++++--- 1 file changed, 5 insertions(+), 3 deletions(-) --- a/drivers/net/ethernet/stmicro/stmmac/stmmac_main.c +++ b/drivers/net/ethernet/stmicro/stmmac/stmmac_main.c @@ -2190,8 +2190,7 @@ static int stmmac_init_dma_engine(struct priv->plat->dma_cfg, tx_q->dma_tx_phy, chan); - tx_q->tx_tail_addr = tx_q->dma_tx_phy + - (DMA_TX_SIZE * sizeof(struct dma_desc)); + tx_q->tx_tail_addr = tx_q->dma_tx_phy; priv->hw->dma->set_tx_tail_ptr(priv->ioaddr, tx_q->tx_tail_addr, chan); @@ -2963,6 +2962,7 @@ static netdev_tx_t stmmac_tso_xmit(struc netdev_tx_sent_queue(netdev_get_tx_queue(dev, queue), skb->len); + tx_q->tx_tail_addr = tx_q->dma_tx_phy + (tx_q->cur_tx * sizeof(*desc)); priv->hw->dma->set_tx_tail_ptr(priv->ioaddr, tx_q->tx_tail_addr, queue); @@ -3178,9 +3178,11 @@ static netdev_tx_t stmmac_xmit(struct sk if (priv->synopsys_id < DWMAC_CORE_4_00) priv->hw->dma->enable_dma_transmission(priv->ioaddr); - else + else { + tx_q->tx_tail_addr = tx_q->dma_tx_phy + (tx_q->cur_tx * sizeof(*desc)); priv->hw->dma->set_tx_tail_ptr(priv->ioaddr, tx_q->tx_tail_addr, queue); + } return NETDEV_TX_OK;