Skip to content

Commit

Permalink
ayufan: stmmac: disable TX offload for mtu bigger than 1498
Browse files Browse the repository at this point in the history
  • Loading branch information
ayufan committed Mar 8, 2019
1 parent 6ba42b5 commit 41eeb7c
Show file tree
Hide file tree
Showing 5 changed files with 9 additions and 2 deletions.
2 changes: 1 addition & 1 deletion arch/arm64/boot/dts/rockchip/rk3328-rock64.dts
Expand Up @@ -170,7 +170,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>;
Expand Down
2 changes: 1 addition & 1 deletion arch/arm64/boot/dts/rockchip/rk3399-rockpro64.dts
Expand Up @@ -265,7 +265,7 @@
phy-mode = "rgmii";
pinctrl-names = "default";
pinctrl-0 = <&rgmii_pins>;
snps,force_thresh_dma_mode;
rockchip,bugged_tx_coe;
snps,reset-gpio = <&gpio3 RK_PB7 GPIO_ACTIVE_LOW>;
snps,reset-active-low;
snps,reset-delays-us = <0 10000 50000>;
Expand Down
4 changes: 4 additions & 0 deletions drivers/net/ethernet/stmicro/stmmac/stmmac_main.c
Expand Up @@ -3629,6 +3629,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)
Expand Down
2 changes: 2 additions & 0 deletions drivers/net/ethernet/stmicro/stmmac/stmmac_platform.c
Expand Up @@ -516,6 +516,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);
Expand Down
1 change: 1 addition & 0 deletions include/linux/stmmac.h
Expand Up @@ -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;
Expand Down

2 comments on commit 41eeb7c

@jpegxguy
Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

If you submit this to mainline, could you add rockchip,bugged_tx_coe; to the rk3328-roc-cc.dts as well? Very similar board to the rock64

@jpegxguy
Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

There is an ongoing effort in mainline and a new approach to the network stability problem has been offered. Your knowledge on these boards would be very much appreciated! https://patchwork.kernel.org/patch/10846013/

Please sign in to comment.