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;