Received: by 2002:a25:4158:0:0:0:0:0 with SMTP id o85csp538610yba; Mon, 1 Apr 2019 11:20:34 -0700 (PDT) X-Google-Smtp-Source: APXvYqwup5vqvfOob/8JB/AFL49uBK3hzxUsamxNtdF231UgZ4Q5QqXa+XC4F2ag7rE6bf6fFJXv X-Received: by 2002:a63:ff18:: with SMTP id k24mr63265651pgi.140.1554142834049; Mon, 01 Apr 2019 11:20:34 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1554142834; cv=none; d=google.com; s=arc-20160816; b=qk43SzgJmgHBXLqmXSSJMKx8mV3BfXRcsK+MH+F19VIjwKERD4cO1JMfqzhAqBYmRC xCZLs++5ueyxSwB5XFKVCDqWWlk+lTr+woRz5KdH7uakiIjsAjzGDCXIViU28M5255dC mpBDMrGKWxbEL7I6d+YZ8Vg8lyoBf0PWh7Cms6QbLkuxj+GzdSxpyvbHty14s+fXGnj0 ihUoW+hOXPkF9ETRH0FDiusPUsTO6aqxCVb+Qs/SyH3JprKOcVdAiZiHb4RVpau9UCwD 4K/0FobUR7TVsaeiDR52FIgGY3PMXS5lF6CZAIhNOVm3h2M3cYhSQtfTwQ1vGR9yxA+Q Zlmg== 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 :message-id:date:subject:cc:to:from:dkim-signature; bh=aWRNFvdzR7jDiIT2oYZIFzK8jYDZLuJ0sBRZxtB4YxY=; b=K+s1e+1vzLTrB0i+I5LllprQb6nueCeXxKM4PXaGcvliK4uJKTmcXhlISSG8rD2ti/ 9zFEF2maINxJgGvUXKKM8VClmJMFupFC06GE0PlBIWnR/6efxxZ3DVZ1791Bqup5WuY9 6FWvSlEOVzmNrF90ZqzfjukEmFPsCZEV+xkqCZ36FUwbwjBLa2kZRaQYr/gcirqp8UNr fspdiiuOLc8xl6ocdwjIoecz5voMREEkgE49rhJBOKTHpZpvxCFm5x5HpmUUB8emTztD rHI9zhShx1Hoqxo9GfrUwZXasn2obnyjF0+U7q07m2x4GqPOJaH4LZ7STx/CGY1tDSAt u4Rg== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@gmail.com header.s=20161025 header.b=tEzUwYCu; 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=QUARANTINE dis=NONE) header.from=gmail.com Return-Path: Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id m23si9431569pgc.550.2019.04.01.11.20.18; Mon, 01 Apr 2019 11:20:34 -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=@gmail.com header.s=20161025 header.b=tEzUwYCu; 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=QUARANTINE dis=NONE) header.from=gmail.com Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1729115AbfDASTg (ORCPT + 99 others); Mon, 1 Apr 2019 14:19:36 -0400 Received: from mail-wm1-f66.google.com ([209.85.128.66]:40747 "EHLO mail-wm1-f66.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1729038AbfDASTe (ORCPT ); Mon, 1 Apr 2019 14:19:34 -0400 Received: by mail-wm1-f66.google.com with SMTP id z24so448541wmi.5; Mon, 01 Apr 2019 11:19:32 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20161025; h=from:to:cc:subject:date:message-id:mime-version :content-transfer-encoding; bh=aWRNFvdzR7jDiIT2oYZIFzK8jYDZLuJ0sBRZxtB4YxY=; b=tEzUwYCuS8uIZZNlgV4lnDKQNisl8dgfXFS7zYDCaCsyH/WcrVcg1Pq2ZvjCYXikeO 7q8aAwJonlPzarUye6caYFZWeALhy0i0lZsDGjjgp+uaprcbb79QeTIjFkzaz7G2kOiS ThBjA+VdeOaoWdxkXOQ+0MqzAUzzHTlxILyN3LcvT32VB+qK++FxN+fFtCB+YErEmiCV IepHI+O76qE+1rhf09UuR7HuquuidKStd1jdHoqYwyyFMkM+VhnSnT0JSzl+or/wdG4P su8FLUFjyzlaG2uqTUYAVWj+1I//4QMV4SJ0O5+OQXG6+WqLvGhdpggQb3eHOv5kjRZe 0Qyw== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:from:to:cc:subject:date:message-id:mime-version :content-transfer-encoding; bh=aWRNFvdzR7jDiIT2oYZIFzK8jYDZLuJ0sBRZxtB4YxY=; b=fxT88j1up2g8iQTWBhbGnVpKLyfWdNjM5+ZX/Dx8pBHbSPXpRfyq/IFTBlFNCUke1i eIZCTOIoL8QMjNb4o1BWMBvfuHwTeyzpMaD5yOimJ9BYi4Mr/4LuXsDAroql4/G5Gjzn gq4xou0wgvrcytqw0uq3DGreU4pVUSAikIeshLRkEvLM5Q9UUPSqvFoERz7DQJToKbmy TjnMsYj4CJL2PxCq8+TgcKrG6arJbrszO8vz6kmYEx6ppoNeFV7EBKIcDUl9tWPNTkEx gcMHTUYWndKIpCNuMaUBKW9RqOpesGAwNtJNKHPJeBE6bs34/bq+vTKmKR8kJxepiQba 4uIg== X-Gm-Message-State: APjAAAWq+X48mEvNxx4sn5VMgObHeMTtA9nYLnCbw3lmV3ujxNzVySEg vWFD9uLPGo8qQnV6z7up+uQ= X-Received: by 2002:a1c:2087:: with SMTP id g129mr633929wmg.114.1554142772066; Mon, 01 Apr 2019 11:19:32 -0700 (PDT) Received: from X555LD.home ([2a02:85f:510:b900:c095:2934:58ba:cfa6]) by smtp.gmail.com with ESMTPSA id c20sm17876240wre.28.2019.04.01.11.19.30 (version=TLS1_2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Mon, 01 Apr 2019 11:19:31 -0700 (PDT) From: "Leonidas P. Papadakos" To: Maxime Coquelin , Alexandre Torgue , Heiko Stuebner Cc: Jose Abreu , netdev@vger.kernel.org, linux-arm-kernel@lists.infradead.org, linux-kernel@vger.kernel.org, "Leonidas P. Papadakos" Subject: [PATCH 1/2] stmmac: introduce flag to dynamically disable TX offload for rockchip devices Date: Mon, 1 Apr 2019 21:18:40 +0300 Message-Id: <20190401181840.31255-1-papadakospan@gmail.com> X-Mailer: git-send-email 2.21.0 MIME-Version: 1.0 Content-Transfer-Encoding: 8bit Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org From: =?UTF-8?q?Kamil=20Trzci=C5=84ski?= Some rockchip boards exhibit an issue where tx checksumming does not work with packets larger than 1498. This is bad for network stability. The previous approach was using force_thresh_dma_mode in the board dts, which does more than we need. Signed-off-by: Leonidas P. Papadakos --- drivers/net/ethernet/stmicro/stmmac/stmmac_main.c | 4 ++++ drivers/net/ethernet/stmicro/stmmac/stmmac_platform.c | 2 ++ include/linux/stmmac.h | 1 + 3 files changed, 7 insertions(+) diff --git a/drivers/net/ethernet/stmicro/stmmac/stmmac_main.c b/drivers/net/ethernet/stmicro/stmmac/stmmac_main.c index 6a2e1031a..4552147e9 100644 --- a/drivers/net/ethernet/stmicro/stmmac/stmmac_main.c +++ b/drivers/net/ethernet/stmicro/stmmac/stmmac_main.c @@ -3660,6 +3660,10 @@ static netdev_features_t stmmac_fix_features(struct net_device *dev, if (priv->plat->bugged_jumbo && (dev->mtu > ETH_DATA_LEN)) features &= ~NETIF_F_CSUM_MASK; + /* Including very small MTUs of 1498 for Rockchip devices */ + if (priv->plat->bugged_tx_coe && (dev->mtu > ETH_DATA_LEN - 2)) + features &= ~NETIF_F_CSUM_MASK; + /* Disable tso if asked by ethtool */ if ((priv->plat->tso_en) && (priv->dma_cap.tsoen)) { if (features & NETIF_F_TSO) diff --git a/drivers/net/ethernet/stmicro/stmmac/stmmac_platform.c b/drivers/net/ethernet/stmicro/stmmac/stmmac_platform.c index 3031f2bf1..807cf5826 100644 --- a/drivers/net/ethernet/stmicro/stmmac/stmmac_platform.c +++ b/drivers/net/ethernet/stmicro/stmmac/stmmac_platform.c @@ -519,6 +519,8 @@ stmmac_probe_config_dt(struct platform_device *pdev, const char **mac) pr_warn("force_sf_dma_mode is ignored if force_thresh_dma_mode is set."); } + plat->bugged_tx_coe = of_property_read_bool(np, "rockchip,bugged_tx_coe"); + of_property_read_u32(np, "snps,ps-speed", &plat->mac_port_sel_speed); plat->axi = stmmac_axi_setup(pdev); diff --git a/include/linux/stmmac.h b/include/linux/stmmac.h index 4335bd771..60c411f43 100644 --- a/include/linux/stmmac.h +++ b/include/linux/stmmac.h @@ -162,6 +162,7 @@ struct plat_stmmacenet_data { int pmt; int force_sf_dma_mode; int force_thresh_dma_mode; + int bugged_tx_coe; int riwt_off; int max_speed; int maxmtu; -- 2.21.0