Skip to content

Commit

Permalink
general-disable-mtu-validation(:1)
Browse files Browse the repository at this point in the history
Original-Subject: Disable MTU validation
This patch reverts: torvalds@eaf4fac

It works around following issues:
 - no way to change MTU (tx_fifo_size is reported as 0 for Rockchip's dwmac)

Signed-off-by: Piotr Szczepanik <piter75@gmail.com>
Signed-off-by: Igor Pecovnik <igor.pecovnik@gmail.com>
X-Armbian: Patch-File: general-disable-mtu-validation
X-Armbian: Patch-File-Counter: 1
X-Armbian: Patch-Rel-Directory: patch/kernel/archive/rockchip64-6.1
X-Armbian: Patch-Type: kernel
X-Armbian: Patch-Root-Type: core
X-Armbian: Patch-Sub-Type: common
X-Armbian: Original-Subject: Disable MTU validation
  • Loading branch information
igorpecovnik authored and Armbian AutoPatcher committed Jul 21, 2021
1 parent 63932b4 commit 6c3bff3
Showing 1 changed file with 0 additions and 12 deletions.
12 changes: 0 additions & 12 deletions drivers/net/ethernet/stmicro/stmmac/stmmac_main.c
Original file line number Diff line number Diff line change
Expand Up @@ -5557,27 +5557,15 @@ static void stmmac_set_rx_mode(struct net_device *dev)
static int stmmac_change_mtu(struct net_device *dev, int new_mtu)
{
struct stmmac_priv *priv = netdev_priv(dev);
int txfifosz = priv->plat->tx_fifo_size;
struct stmmac_dma_conf *dma_conf;
const int mtu = new_mtu;
int ret;

if (txfifosz == 0)
txfifosz = priv->dma_cap.tx_fifo_size;

txfifosz /= priv->plat->tx_queues_to_use;

if (stmmac_xdp_is_enabled(priv) && new_mtu > ETH_DATA_LEN) {
netdev_dbg(priv->dev, "Jumbo frames not supported for XDP\n");
return -EINVAL;
}

new_mtu = STMMAC_ALIGN(new_mtu);

/* If condition true, FIFO is too small or MTU too large */
if ((txfifosz < new_mtu) || (new_mtu > BUF_SIZE_16KiB))
return -EINVAL;

if (netif_running(dev)) {
netdev_dbg(priv->dev, "restarting interface to change its MTU\n");
/* Try to allocate the new DMA conf with the new mtu */
Expand Down

0 comments on commit 6c3bff3

Please sign in to comment.