Received: by 2002:ac0:a582:0:0:0:0:0 with SMTP id m2-v6csp3729971imm; Mon, 8 Oct 2018 08:37:26 -0700 (PDT) X-Google-Smtp-Source: ACcGV604XynxMy6s8GOws/UcCbThVYJHDlYRPoQCeL+z28SaiPPUXT1BZw3diNUVd2FIY7jGFGab X-Received: by 2002:a17:902:9b84:: with SMTP id y4-v6mr24830342plp.332.1539013046568; Mon, 08 Oct 2018 08:37:26 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1539013046; cv=none; d=google.com; s=arc-20160816; b=dpQZYvxvHywktpvFsymYb43eB4Srz1g16O0or1oPHYuQOGnlAQEJacVuYVlOIsIYQv bl5jRbfNTFTunGrOTGcl5YACKeK89aaL1yHvge6gzSIjfWsb0e5fCr4pPAfqfCMnnlQ1 Qu4WQQmrzF3S5uAscMTUn7kaq6Z6DTEBI8mfrvt1RyzucAIOwb0OQ7vazkWxcTi0l8jI qgK+16d/MzHSNYgHvK2YMe2QnP5W0g2JG8BDrtK+Tv4jJLxYsYGiZA615d6mQCykwcRl 3rc4nk77mb3rXpoHwBCoaS8AZkTRkyUA5T6tuNRkU2Xu/6etDQjvKl/oKcDy148lXLm2 Tftw== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:references:in-reply-to:message-id:date :subject:cc:to:from:dkim-signature; bh=dPBEJzmsPN2A6qOBi/sGVQNqQ4noYfiCxg+xZN7/owA=; b=Wlp7UUVbRmPLNHlzm05+lKbKejt25531wjcwKHGspYAOYDBPqBMqE4NXAKGbgsKP9H 10edcF1fiSXWUF23SaA+r4nXXDpZklUGtKy3/9u9bFLUWysD4uscZZuQ12OB1GCQy9a9 yFRp0uCxtSxHfArh4r7+BFJrlEChy9c8vtp52+PdvbVaRmumy3jB8f8n6f0lSpcAynKS 2Fi90AfVd4xsc9HlCeNReHXaQymRQT9QzSu67LDMFbG7FUoyeN/8vEXZxqM3u105wCRy S7wF/0pYrhRQJVQ9TvC2kjBJixU6dEaWro6za3wra73R5D4bkjuP3eQufSsS/DwQdztj /nBw== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@kernel.org header.s=default header.b=bqIIEVrL; 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; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=kernel.org Return-Path: Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id k29-v6si18983581pfk.194.2018.10.08.08.37.11; Mon, 08 Oct 2018 08:37:26 -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=bqIIEVrL; 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; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=kernel.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1727388AbeJHWiH (ORCPT + 99 others); Mon, 8 Oct 2018 18:38:07 -0400 Received: from mail.kernel.org ([198.145.29.99]:56418 "EHLO mail.kernel.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1727034AbeJHWiH (ORCPT ); Mon, 8 Oct 2018 18:38:07 -0400 Received: from sasha-vm.mshome.net (c-73-47-72-35.hsd1.nh.comcast.net [73.47.72.35]) (using TLSv1.2 with cipher ECDHE-RSA-AES128-GCM-SHA256 (128/128 bits)) (No client certificate requested) by mail.kernel.org (Postfix) with ESMTPSA id 775522089D; Mon, 8 Oct 2018 15:25:51 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=default; t=1539012352; bh=F+ECAOT6aYPdsOB/wj0MyeryCyaGuDke5UA2ORJDJVw=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=bqIIEVrLifdSkGD3yo1CWneWR9+kgQistfsNXzG+70YihCJgo/vNXc9iQVOBeMJ5x YXLPoP8zPbHsxRhHdkOHpb/0svWdB6kMZEdtc3+nB4eE+9hLsBmtvFsSDzNfU/5z6l ILVnHKdBNNgGPGF2fVCs3dAxZ1s1mSWKEnhAuCek= From: Sasha Levin To: stable@vger.kernel.org, linux-kernel@vger.kernel.org Cc: Jose Abreu , Jose Abreu , "David S . Miller" , Joao Pinto , Giuseppe Cavallaro , Alexandre Torgue , Sasha Levin Subject: [PATCH AUTOSEL 4.18 26/58] net: stmmac: Fixup the tail addr setting in xmit path Date: Mon, 8 Oct 2018 11:24:51 -0400 Message-Id: <20181008152523.70705-26-sashal@kernel.org> X-Mailer: git-send-email 2.17.1 In-Reply-To: <20181008152523.70705-1-sashal@kernel.org> References: <20181008152523.70705-1-sashal@kernel.org> Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org 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: Sasha Levin --- drivers/net/ethernet/stmicro/stmmac/stmmac_main.c | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/drivers/net/ethernet/stmicro/stmmac/stmmac_main.c b/drivers/net/ethernet/stmicro/stmmac/stmmac_main.c index 04de46601c87..1c6ba74e294b 100644 --- a/drivers/net/ethernet/stmicro/stmmac/stmmac_main.c +++ b/drivers/net/ethernet/stmicro/stmmac/stmmac_main.c @@ -2186,8 +2186,7 @@ static int stmmac_init_dma_engine(struct stmmac_priv *priv) stmmac_init_tx_chan(priv, priv->ioaddr, 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; stmmac_set_tx_tail_ptr(priv, priv->ioaddr, tx_q->tx_tail_addr, chan); } @@ -2982,6 +2981,7 @@ static netdev_tx_t stmmac_tso_xmit(struct sk_buff *skb, struct net_device *dev) 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)); stmmac_set_tx_tail_ptr(priv, priv->ioaddr, tx_q->tx_tail_addr, queue); return NETDEV_TX_OK; @@ -3189,6 +3189,7 @@ static netdev_tx_t stmmac_xmit(struct sk_buff *skb, struct net_device *dev) stmmac_enable_dma_transmission(priv, priv->ioaddr); + tx_q->tx_tail_addr = tx_q->dma_tx_phy + (tx_q->cur_tx * sizeof(*desc)); stmmac_set_tx_tail_ptr(priv, priv->ioaddr, tx_q->tx_tail_addr, queue); return NETDEV_TX_OK; -- 2.17.1