Re: [PATCH v4] ravb: implement MTU change while device is up

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



Hi Uli,

On Thu, Nov 14, 2019 at 2:50 AM Ulrich Hecht <uli+renesas@xxxxxxxx> wrote:
> Pre-allocates buffers sufficient for the maximum supported MTU (2026) in
> order to eliminate the possibility of resource exhaustion when changing the
> MTU while the device is up.
>
> Signed-off-by: Ulrich Hecht <uli+renesas@xxxxxxxx>

Thanks for your patch!

> --- a/drivers/net/ethernet/renesas/ravb_main.c
> +++ b/drivers/net/ethernet/renesas/ravb_main.c
> @@ -293,9 +293,9 @@ static void ravb_ring_format(struct net_device *ndev, int q)
>         for (i = 0; i < priv->num_rx_ring[q]; i++) {
>                 /* RX descriptor */
>                 rx_desc = &priv->rx_ring[q][i];
> -               rx_desc->ds_cc = cpu_to_le16(priv->rx_buf_sz);
> +               rx_desc->ds_cc = cpu_to_le16(RX_BUF_SZ);

So the RAVB hardware will always see the full buffer size.
Hence if it receives a frame that is larger than the configured MTU, it will
still happily pass it to the driver, and to the network stack, which will
reject it, presumably?

Note that the driver doesn't seem to configure the Reception Truncation
Configuration register, so it will never reject frames up to 4092 bytes (unless
the boot loader has changed that).

Gr{oetje,eeting}s,

                        Geert

-- 
Geert Uytterhoeven -- There's lots of Linux beyond ia32 -- geert@xxxxxxxxxxxxxx

In personal conversations with technical people, I call myself a hacker. But
when I'm talking to journalists I just say "programmer" or something like that.
                                -- Linus Torvalds



[Index of Archives]     [Linux Samsung SOC]     [Linux Wireless]     [Linux Kernel]     [ATH6KL]     [Linux Bluetooth]     [Linux Netdev]     [Kernel Newbies]     [IDE]     [Security]     [Git]     [Netfilter]     [Bugtraq]     [Yosemite News]     [MIPS Linux]     [ARM Linux]     [Linux Security]     [Linux RAID]     [Linux ATA RAID]     [Samba]     [Device Mapper]

  Powered by Linux