From patchwork Mon Apr 1 18:18:40 2019 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Leonidas-Panagiotis Papadakos X-Patchwork-Id: 1073106 X-Patchwork-Delegate: davem@davemloft.net Return-Path: X-Original-To: patchwork-incoming-netdev@ozlabs.org Delivered-To: patchwork-incoming-netdev@ozlabs.org Authentication-Results: ozlabs.org; spf=none (mailfrom) smtp.mailfrom=vger.kernel.org (client-ip=209.132.180.67; helo=vger.kernel.org; envelope-from=netdev-owner@vger.kernel.org; receiver=) Authentication-Results: ozlabs.org; dmarc=pass (p=none dis=none) header.from=gmail.com Authentication-Results: ozlabs.org; dkim=pass (2048-bit key; unprotected) header.d=gmail.com header.i=@gmail.com header.b="tEzUwYCu"; dkim-atps=neutral Received: from vger.kernel.org (vger.kernel.org [209.132.180.67]) by ozlabs.org (Postfix) with ESMTP id 44Y0x82WG6z9sRW for ; Tue, 2 Apr 2019 05:19:40 +1100 (AEDT) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1729098AbfDASTf (ORCPT ); Mon, 1 Apr 2019 14:19:35 -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-Google-Smtp-Source: APXvYqwmPPda028Rtjix9L9ptrWnnsTLQOL1dbrEgs1B3+9qwPZW/P0csJHRUpUD6HKXgxNOPeaL1Q== 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 Sender: netdev-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: netdev@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;