Received: by 2002:a25:4158:0:0:0:0:0 with SMTP id o85csp7367920yba; Thu, 2 May 2019 08:42:05 -0700 (PDT) X-Google-Smtp-Source: APXvYqwXiqV1nHv1ZkKvgBvRL3AnfEFhhpOxmV3IlcbPIQrfZ7c7EctetE6egzvqBRCrk7PEX/bm X-Received: by 2002:a62:4697:: with SMTP id o23mr4939193pfi.224.1556811725216; Thu, 02 May 2019 08:42:05 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1556811725; cv=none; d=google.com; s=arc-20160816; b=BsdHjmA0HuEfqakQSPFgdq8/Bti/JQbJ89ybVg6efwpIubX47UmV3emMO4X9e3SaKx erUJa6v1bCDjrHtMK0PwOHyi2TUf0tKjdqCoSS5HjQ7yhDkU4dxZlQlUXigdf45DyuC1 +dqbc9YbjTal7IAOnMMmoJukgOLBniTaOJ86n4jmt7rICeGWcpJH5Y+LxTUP+/oVLLrL TjSuI/8v4ghALrElpGd4tpZlFBb3irCSI2rpb2SGbZ7VlcoCXmIFtPFTq/qMivW756sy Ijqx8ysBnBm81CsUkY7GA/4qdWkthuQTyfe1+LYl9447O4Fck7NZbt1BVkt1mG5tWnFM bYrQ== 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=/6j15lPpQ5NhKYgDEbxiU3QW/k6MBcKH135ldGMvIv0=; b=XQo9ifY3xJgWd7/6mmLeAGlDZN+PVWOWKAULNyO1QjA1oATgW5jKbwUyIYzAiX6h7j bOvdHSJ664cgE6d/QeTEGU7Dlyo1e/loCnuLUHm8CGpsRlKsbr34TzIejmI3EqB8/n9j cF9DdJMiSU9J6oATmxzp4UYmiPkPXQBUXa0qvSb63K4c7QzDUOsBe10KEcX3wNXyRKDP 79fpRsrAespeZ2/LiDYdo5/678DcqW7KA1WImpV6DJCu6QC4PieG7cGOSly4DLn5P2r6 g5S5V/GXBDr9zsA0DMZsdoQGc+b8gasRA6NyASsNDG+KX2L8/oPYCbufRfBFGEUQbKd9 y51g== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@kernel.org header.s=default header.b="Q/v/paov"; 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 k10si43489815pls.327.2019.05.02.08.41.49; Thu, 02 May 2019 08:42:05 -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="Q/v/paov"; 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 S1727613AbfEBPkn (ORCPT + 99 others); Thu, 2 May 2019 11:40:43 -0400 Received: from mail.kernel.org ([198.145.29.99]:46634 "EHLO mail.kernel.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1728338AbfEBP3G (ORCPT ); Thu, 2 May 2019 11:29:06 -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 E36D120B7C; Thu, 2 May 2019 15:29:04 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=default; t=1556810945; bh=oOKUrr0Ez26leioFSInvPPnvZigoZ19MteDvUal0BX4=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=Q/v/paov/W2XXBt1AZRWgIrINpFsnBVYGwKg17W8QSwWhm36sfzzg7kmI8paZWZPU qh6jHLpXYo3GGARPWAzyCbjddkJWp0WH43wYT0Am+UKWgDuS8xEjHN6gGqlRcClTKp MdelJ2d7rDZVK764Exn5OjDPSWFXwNtbVxgjQGXc= From: Greg Kroah-Hartman To: linux-kernel@vger.kernel.org Cc: Greg Kroah-Hartman , stable@vger.kernel.org, Aaro Koskinen , Jose Abreu , "David S. Miller" , "Sasha Levin (Microsoft)" Subject: [PATCH 5.0 017/101] net: stmmac: dont set own bit too early for jumbo frames Date: Thu, 2 May 2019 17:20:19 +0200 Message-Id: <20190502143341.179623330@linuxfoundation.org> X-Mailer: git-send-email 2.21.0 In-Reply-To: <20190502143339.434882399@linuxfoundation.org> References: <20190502143339.434882399@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 80acbed9f8fca1db3fbe915540b756f048aa0fd7 ] Commit 0e80bdc9a72d ("stmmac: first frame prep at the end of xmit routine") overlooked jumbo frames when re-ordering the code, and as a result the own bit was not getting set anymore for the first jumbo frame descriptor. Commit 487e2e22ab79 ("net: stmmac: Set OWN bit for jumbo frames") tried to fix this, but now the bit is getting set too early and the DMA may start while we are still setting up the remaining descriptors. And with the chain mode the own bit remains still unset. Fix by setting the own bit at the end of xmit also with jumbo frames. Fixes: 0e80bdc9a72d ("stmmac: first frame prep at the end of xmit routine") Fixes: 487e2e22ab79 ("net: stmmac: Set OWN bit for jumbo frames") Signed-off-by: Aaro Koskinen Acked-by: Jose Abreu Signed-off-by: David S. Miller Signed-off-by: Sasha Levin (Microsoft) --- drivers/net/ethernet/stmicro/stmmac/ring_mode.c | 4 ++-- drivers/net/ethernet/stmicro/stmmac/stmmac_main.c | 14 ++++++++------ 2 files changed, 10 insertions(+), 8 deletions(-) diff --git a/drivers/net/ethernet/stmicro/stmmac/ring_mode.c b/drivers/net/ethernet/stmicro/stmmac/ring_mode.c index c0c75c111abb..afed0f0f4027 100644 --- a/drivers/net/ethernet/stmicro/stmmac/ring_mode.c +++ b/drivers/net/ethernet/stmicro/stmmac/ring_mode.c @@ -59,7 +59,7 @@ static int jumbo_frm(void *p, struct sk_buff *skb, int csum) desc->des3 = cpu_to_le32(des2 + BUF_SIZE_4KiB); stmmac_prepare_tx_desc(priv, desc, 1, bmax, csum, - STMMAC_RING_MODE, 1, false, skb->len); + STMMAC_RING_MODE, 0, false, skb->len); tx_q->tx_skbuff[entry] = NULL; entry = STMMAC_GET_ENTRY(entry, DMA_TX_SIZE); @@ -91,7 +91,7 @@ static int jumbo_frm(void *p, struct sk_buff *skb, int csum) tx_q->tx_skbuff_dma[entry].is_jumbo = true; desc->des3 = cpu_to_le32(des2 + BUF_SIZE_4KiB); stmmac_prepare_tx_desc(priv, desc, 1, nopaged_len, csum, - STMMAC_RING_MODE, 1, true, skb->len); + STMMAC_RING_MODE, 0, true, skb->len); } tx_q->cur_tx = entry; diff --git a/drivers/net/ethernet/stmicro/stmmac/stmmac_main.c b/drivers/net/ethernet/stmicro/stmmac/stmmac_main.c index 1d8d6f2ddfd6..0bc3632880b5 100644 --- a/drivers/net/ethernet/stmicro/stmmac/stmmac_main.c +++ b/drivers/net/ethernet/stmicro/stmmac/stmmac_main.c @@ -3190,14 +3190,16 @@ static netdev_tx_t stmmac_xmit(struct sk_buff *skb, struct net_device *dev) stmmac_prepare_tx_desc(priv, first, 1, nopaged_len, csum_insertion, priv->mode, 1, last_segment, skb->len); - - /* The own bit must be the latest setting done when prepare the - * descriptor and then barrier is needed to make sure that - * all is coherent before granting the DMA engine. - */ - wmb(); + } else { + stmmac_set_tx_owner(priv, first); } + /* The own bit must be the latest setting done when prepare the + * descriptor and then barrier is needed to make sure that + * all is coherent before granting the DMA engine. + */ + wmb(); + netdev_tx_sent_queue(netdev_get_tx_queue(dev, queue), skb->len); stmmac_enable_dma_transmission(priv, priv->ioaddr); -- 2.19.1