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 P. Papadakos" X-Patchwork-Id: 10880481 Return-Path: Received: from mail.wl.linuxfoundation.org (pdx-wl-mail.web.codeaurora.org [172.30.200.125]) by pdx-korg-patchwork-2.web.codeaurora.org (Postfix) with ESMTP id 25FB914DE for ; Mon, 1 Apr 2019 18:19:39 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id 0F41C2859A for ; Mon, 1 Apr 2019 18:19:39 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id 0D482286EE; Mon, 1 Apr 2019 18:19:39 +0000 (UTC) X-Spam-Checker-Version: SpamAssassin 3.3.1 (2010-03-16) on pdx-wl-mail.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-5.2 required=2.0 tests=BAYES_00,DKIM_ADSP_CUSTOM_MED, DKIM_SIGNED,DKIM_VALID,FREEMAIL_FROM,MAILING_LIST_MULTI,RCVD_IN_DNSWL_MED autolearn=ham version=3.3.1 Received: from bombadil.infradead.org (bombadil.infradead.org [198.137.202.133]) (using TLSv1.2 with cipher AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by mail.wl.linuxfoundation.org (Postfix) with ESMTPS id AA3DE2859A for ; Mon, 1 Apr 2019 18:19:38 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=lists.infradead.org; s=bombadil.20170209; h=Sender: Content-Transfer-Encoding:Content-Type:Cc:List-Subscribe:List-Help:List-Post: List-Archive:List-Unsubscribe:List-Id:MIME-Version:Message-Id:Date:Subject:To :From:Reply-To:Content-ID:Content-Description:Resent-Date:Resent-From: Resent-Sender:Resent-To:Resent-Cc:Resent-Message-ID:In-Reply-To:References: List-Owner; bh=OiftNKQoOBpg2gUauxZRH7J1NbUqaxknf/sMccvUat4=; b=SW78O1/zZM8i2y xzoYrQ5oaVQrq9/2c5oPpVgiZ3ApwxJipynwpPSEXwh+o84+YrTK6KVGn3oAkJdTItbkAhaFqdKrL XbGMx7JFt9YScpqjcjZQXsqlwg+NyO65gOT6A/ZnpLvi2fqZ4fAfXqesE4G1gpdk6pRoAEXR8w14w TK7TPTei2988fXeHWvWcJBCxd6sFYErdpDbYEf6Mb9DFdFFvqLuEkD5p73QVH2RJL9Fhcyqwe8pAU CzIYjcAXJuQA8UL3dOqY+9VRqqqznhc6vFnj0f990GXmi/ABxp3pHG/ey42h0yW/xRqRE67DiBEpC 2hlWgsSu8IkaBa3G6k4A==; Received: from localhost ([127.0.0.1] helo=bombadil.infradead.org) by bombadil.infradead.org with esmtp (Exim 4.90_1 #2 (Red Hat Linux)) id 1hB1Wz-0007Nb-J6; Mon, 01 Apr 2019 18:19:37 +0000 Received: from mail-wm1-x342.google.com ([2a00:1450:4864:20::342]) by bombadil.infradead.org with esmtps (Exim 4.90_1 #2 (Red Hat Linux)) id 1hB1Wv-0007MP-VQ for linux-arm-kernel@lists.infradead.org; Mon, 01 Apr 2019 18:19:35 +0000 Received: by mail-wm1-x342.google.com with SMTP id r186so571686wmf.1 for ; Mon, 01 Apr 2019 11:19:33 -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=ejRNq3E6QHUwb3n0zwde85LbD1dkSzyOZiI3Rwk7cVh4gb/vQDVUCsxsKgCyDGVs7N 5Ko9DLxzv9jz4Hb1nidvx+brVhIm6f02IgwHRk2nL/MIniAi4vgURUSGDhwrP+YcZ6+9 p4BauY6h8aV0o33wPj4jlado9+thoylM3YAevD4aWoyK/H18SGJitqNspzYG0bJAxGgg gNaHFBFrHKHue+LXSXB81O9kd4Q3opXBFlGU0TSW8xsfjQrJCCZ3mWV407V6P+wW0l82 nH7GVhbLJJ6bv15VrYN/duMAV3qRtSe+AdotYteVMRvUrd5/bvQ6i89BPDQYex5ivmiQ f39A== X-Gm-Message-State: APjAAAUvjR7QLTBvrxFNqIowOKPuwwob6/VaNaHNW9V0S2lcu2D3iuTU tYObQuvcnZp1YlvheomAL5c= 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 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 X-CRM114-Version: 20100106-BlameMichelson ( TRE 0.8.0 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20190401_111934_007513_1D1FD668 X-CRM114-Status: GOOD ( 11.64 ) X-BeenThere: linux-arm-kernel@lists.infradead.org X-Mailman-Version: 2.1.21 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Cc: "Leonidas P. Papadakos" , netdev@vger.kernel.org, Jose Abreu , linux-kernel@vger.kernel.org, linux-arm-kernel@lists.infradead.org Sender: "linux-arm-kernel" Errors-To: linux-arm-kernel-bounces+patchwork-linux-arm=patchwork.kernel.org@lists.infradead.org X-Virus-Scanned: ClamAV using ClamSMTP 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; From patchwork Mon Apr 1 18:20:29 2019 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: "Leonidas P. Papadakos" X-Patchwork-Id: 10880483 Return-Path: Received: from mail.wl.linuxfoundation.org (pdx-wl-mail.web.codeaurora.org [172.30.200.125]) by pdx-korg-patchwork-2.web.codeaurora.org (Postfix) with ESMTP id 16D5F14DE for ; Mon, 1 Apr 2019 18:20:55 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id EE5F1288B2 for ; Mon, 1 Apr 2019 18:20:54 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id EC9D1288B5; Mon, 1 Apr 2019 18:20:54 +0000 (UTC) X-Spam-Checker-Version: SpamAssassin 3.3.1 (2010-03-16) on pdx-wl-mail.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-5.2 required=2.0 tests=BAYES_00,DKIM_ADSP_CUSTOM_MED, DKIM_SIGNED,DKIM_VALID,FREEMAIL_FROM,MAILING_LIST_MULTI,RCVD_IN_DNSWL_MED autolearn=ham version=3.3.1 Received: from bombadil.infradead.org (bombadil.infradead.org [198.137.202.133]) (using TLSv1.2 with cipher AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by mail.wl.linuxfoundation.org (Postfix) with ESMTPS id 82FE6288BB for ; Mon, 1 Apr 2019 18:20:53 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=lists.infradead.org; s=bombadil.20170209; h=Sender: Content-Transfer-Encoding:Content-Type:Cc:List-Subscribe:List-Help:List-Post: List-Archive:List-Unsubscribe:List-Id:MIME-Version:Message-Id:Date:Subject:To :From:Reply-To:Content-ID:Content-Description:Resent-Date:Resent-From: Resent-Sender:Resent-To:Resent-Cc:Resent-Message-ID:In-Reply-To:References: List-Owner; bh=VPcQQGAlH+E4i+5jCHus8MEOpkz/5/gcq1JxBkn4r9g=; b=MxUvFHWGUexvWj 3rlw1jQaIJApXb0qNd8gLuIFmn6UvSbRJOIXLRhOMFxkf942+fPLEmLFYTqjUhVt9YWX4gk2SJVw8 mkQvXpJ2sPFKsqOaQPojlhyKAuVn+GhS+zzySx49BZD0ZnOlZg6V7CfFhBy2E9nve2TGBM/B5aX2K ImDUTp18rB2KXGIIU+EdugaxS8hKV7e/FaLP+S/5OqDmuQ0mI8MVthpguMLjo0sTIky2TlUHNqUm1 uGmzqmXUG7q3Wr3aUBKpU3nR77xhGc/jMsK7Hq0L0Ud1oCZTAUklwDAkvdklYKAJaB6cTdmzEIxni TZCSH0JhxXljdgVBZPMA==; Received: from localhost ([127.0.0.1] helo=bombadil.infradead.org) by bombadil.infradead.org with esmtp (Exim 4.90_1 #2 (Red Hat Linux)) id 1hB1YB-0000SN-No; Mon, 01 Apr 2019 18:20:51 +0000 Received: from mail-wm1-x344.google.com ([2a00:1450:4864:20::344]) by bombadil.infradead.org with esmtps (Exim 4.90_1 #2 (Red Hat Linux)) id 1hB1Y7-0000RV-Ky; Mon, 01 Apr 2019 18:20:48 +0000 Received: by mail-wm1-x344.google.com with SMTP id r186so573993wmf.1; Mon, 01 Apr 2019 11:20:44 -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=rSh5VVkG9WipijbhAmyfU9722WPS5gvQw5koNSuFkG0=; b=GYU6vlIcs5FpHcGpqJxeul7ekQGSiEZ7VXOdwyXb0idZrG2JOVbgtju4qj6U1sDp87 95cjAv3oUhfC8aw1Ae8UacYGOOoSMBLiw50ppzcLVU+Igslr0j0dPRYGzwmTnv+WXpAA BdI/kRI+4nPdg/a3A6w6f7EPcn8vgmVdhbTmdzI1WPqxd03FD+0rS7XavIWzmhphlH50 fgronN4aYU3U+9RjF5HH1jYL4Fh7iPJWiUyX+4iN/4hHHEV80TjRfSS4S3lPRk/jlWsI AFVr85takNEhloZPPgU3IdYvfi9SFEkg/Ghkbpm41twdkPzlKDzUigD9/9w59XzZjDbC raWw== 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=rSh5VVkG9WipijbhAmyfU9722WPS5gvQw5koNSuFkG0=; b=uFLiSoc6gKMp2oAs3BnHWnSJpEsMrgzOA7ORSaNQl7zj3/p1hUR6aRuL7iPaCpHyFY N7/wEn0YTiJ+ZptSUgZ9IY7ic49UBXAMdw/S7oXo7KRcdo4LJ+/+4dxcwRcaAz/xPcuU IJpkONqJjnG/jNIXyfOjEtaQ/DARDe8nFOqLBNRI07E8qi557unahqNv64Kp547wWENG QrjAogh8qrOIvYgdJFKWVVfGep/lVrUGa7M+EyNO60r7m0MbZk1ExreXT0Ep0v97Mwy/ jIu7sh1jus+Hldgh9qqEJuMDHhm+kklF4Y4vLOh4KBpYm9AWlcUOGAgbogZhRobOB6U2 WS+Q== X-Gm-Message-State: APjAAAVhprm5ZbtH5zB+UHS9DXKtJR4G49hS/yeUSihBq11gCkwqwMvH /dSJF6A11Vy8jnm9/yt3g8s= X-Google-Smtp-Source: APXvYqwqYh96HPZKMNxmRjyjD/n4AOfKDED/5Q2kVgud1+sGD68OWaS1ARWKzIACEEh9OYFpK6mK3w== X-Received: by 2002:a1c:a8d3:: with SMTP id r202mr670490wme.106.1554142843173; Mon, 01 Apr 2019 11:20:43 -0700 (PDT) Received: from X555LD.home ([2a02:85f:510:b900:c095:2934:58ba:cfa6]) by smtp.gmail.com with ESMTPSA id t15sm16353558wmt.2.2019.04.01.11.20.41 (version=TLS1_2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Mon, 01 Apr 2019 11:20:42 -0700 (PDT) From: "Leonidas P. Papadakos" To: Maxime Coquelin , Alexandre Torgue , Heiko Stuebner Subject: [PATCH 2/2] arm64: dts: rockchip: disable TX offload for mtu bigger than 1498 for some SoCs Date: Mon, 1 Apr 2019 21:20:29 +0300 Message-Id: <20190401182029.31362-1-papadakospan@gmail.com> X-Mailer: git-send-email 2.21.0 MIME-Version: 1.0 X-CRM114-Version: 20100106-BlameMichelson ( TRE 0.8.0 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20190401_112047_691704_DA3BCC94 X-CRM114-Status: GOOD ( 12.08 ) X-BeenThere: linux-arm-kernel@lists.infradead.org X-Mailman-Version: 2.1.21 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Cc: "Leonidas P. Papadakos" , linux-rockchip@lists.infradead.org, Rob Herring , linux-kernel@vger.kernel.org, linux-arm-kernel@lists.infradead.org Sender: "linux-arm-kernel" Errors-To: linux-arm-kernel-bounces+patchwork-linux-arm=patchwork.kernel.org@lists.infradead.org X-Virus-Scanned: ClamAV using ClamSMTP From: =?UTF-8?q?Kamil=20Trzci=C5=84ski?= Some rockchip boards (like the rock64, and the renegade) exhibit an issue where tx checksuming does not work with packets larger than 1498. This is bad for network stability. The previous approach was using force_thresh_dma_mode, which does more than disable TX offload, something we do not need this patch depends on patch: stmmac: introduce flag to dynamically disable TX offload for rockchip devices Signed-off-by: Leonidas P. Papadakos --- arch/arm64/boot/dts/rockchip/rk3328-roc-cc.dts | 2 +- arch/arm64/boot/dts/rockchip/rk3328-rock64.dts | 2 +- arch/arm64/boot/dts/rockchip/rk3399-rockpro64.dts | 1 + 3 files changed, 3 insertions(+), 2 deletions(-) diff --git a/arch/arm64/boot/dts/rockchip/rk3328-roc-cc.dts b/arch/arm64/boot/dts/rockchip/rk3328-roc-cc.dts index c213ad74d..16ced107d 100644 --- a/arch/arm64/boot/dts/rockchip/rk3328-roc-cc.dts +++ b/arch/arm64/boot/dts/rockchip/rk3328-roc-cc.dts @@ -136,7 +136,7 @@ phy-mode = "rgmii"; pinctrl-names = "default"; pinctrl-0 = <&rgmiim1_pins>; - snps,force_thresh_dma_mode; + rockchip,bugged_tx_coe; snps,reset-gpio = <&gpio1 RK_PC2 GPIO_ACTIVE_LOW>; snps,reset-active-low; snps,reset-delays-us = <0 10000 50000>; diff --git a/arch/arm64/boot/dts/rockchip/rk3328-rock64.dts b/arch/arm64/boot/dts/rockchip/rk3328-rock64.dts index 7cfd5ca6c..cab2e1da6 100644 --- a/arch/arm64/boot/dts/rockchip/rk3328-rock64.dts +++ b/arch/arm64/boot/dts/rockchip/rk3328-rock64.dts @@ -150,7 +150,7 @@ phy-mode = "rgmii"; pinctrl-names = "default"; pinctrl-0 = <&rgmiim1_pins>; - snps,force_thresh_dma_mode; + rockchip,bugged_tx_coe; snps,reset-gpio = <&gpio1 RK_PC2 GPIO_ACTIVE_LOW>; snps,reset-active-low; snps,reset-delays-us = <0 10000 50000>; diff --git a/arch/arm64/boot/dts/rockchip/rk3399-rockpro64.dts b/arch/arm64/boot/dts/rockchip/rk3399-rockpro64.dts index 791fb0ee9..a1221dca1 100644 --- a/arch/arm64/boot/dts/rockchip/rk3399-rockpro64.dts +++ b/arch/arm64/boot/dts/rockchip/rk3399-rockpro64.dts @@ -207,6 +207,7 @@ phy-mode = "rgmii"; pinctrl-names = "default"; pinctrl-0 = <&rgmii_pins>; + rockchip,bugged_tx_coe; snps,reset-gpio = <&gpio3 RK_PB7 GPIO_ACTIVE_LOW>; snps,reset-active-low; snps,reset-delays-us = <0 10000 50000>;