mirror of https://lore.kernel.org/lkml/
 help / color / mirror / Atom feed
From: "Leonidas P. Papadakos" <papadakospan@gmail.com>
To: Maxime Coquelin <mcoquelin.stm32@gmail.com>,
	Alexandre Torgue <alexandre.torgue@st.com>,
	Heiko Stuebner <heiko@sntech.de>
Cc: Jose Abreu <joabreu@synopsys.com>,
	netdev@vger.kernel.org, linux-arm-kernel@lists.infradead.org,
	linux-kernel@vger.kernel.org,
	"Leonidas P. Papadakos" <papadakospan@gmail.com>
Subject: [PATCH 1/2] stmmac: introduce flag to dynamically disable TX offload for rockchip devices
Date: Mon,  1 Apr 2019 21:18:40 +0300	[thread overview]
Message-ID: <20190401181840.31255-1-papadakospan@gmail.com> (raw)

From: =?UTF-8?q?Kamil=20Trzci=C5=84ski?= <ayufan@ayufan.eu>

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 <papadakospan@gmail.com>
---
 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


             reply	other threads:[~2019-04-01 18:19 UTC|newest]

Thread overview: 27+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2019-04-01 18:18 Leonidas P. Papadakos [this message]
2019-04-01 18:31 ` Heiko Stübner
2019-04-01 18:54 ` Robin Murphy
2019-04-01 19:06   ` Heiko Stübner
2019-04-01 19:12     ` Philipp Tomsich
2019-04-02  7:59       ` Jose Abreu
2019-04-02 11:49         ` Robin Murphy
2019-04-02 11:53           ` Jose Abreu
2019-04-02 22:08             ` Robin Murphy
2019-04-02 22:48               ` Leonidas P. Papadakos
2019-04-03  7:55                 ` Jose Abreu
2019-04-03 15:35                   ` Leonidas P. Papadakos
2019-04-03 15:55                     ` Leonidas P. Papadakos
2019-04-03 16:12                       ` Robin Murphy
2019-04-05 10:24                         ` Jose Abreu
2019-04-05 17:58                           ` Leonidas P. Papadakos
2019-04-05 18:14                           ` Leonidas P. Papadakos
2019-04-05 18:29                             ` Robin Murphy
2019-04-05 18:38                               ` Leonidas P. Papadakos
2019-04-11 21:09                                 ` Leonidas P. Papadakos
2019-04-12  7:35                                   ` Jose Abreu
2019-04-12 11:13                                     ` Leonidas P. Papadakos
2019-04-15  8:15                                       ` Jose Abreu
2019-04-15 21:45                                         ` Leonidas P. Papadakos
2019-04-15 22:19                                           ` Leonidas P. Papadakos
2019-04-16  8:01                                             ` Jose Abreu
2019-04-16 10:03                                               ` Leonidas P. Papadakos

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20190401181840.31255-1-papadakospan@gmail.com \
    --to=papadakospan@gmail.com \
    --cc=alexandre.torgue@st.com \
    --cc=heiko@sntech.de \
    --cc=joabreu@synopsys.com \
    --cc=linux-arm-kernel@lists.infradead.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=mcoquelin.stm32@gmail.com \
    --cc=netdev@vger.kernel.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox

all inboxes | Powered by JetHome®