linux-renesas-soc.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: Geert Uytterhoeven <geert@linux-m68k.org>
To: Ulrich Hecht <uli+renesas@fpond.eu>
Cc: Linux-Renesas <linux-renesas-soc@vger.kernel.org>,
	netdev <netdev@vger.kernel.org>,
	"David S. Miller" <davem@davemloft.net>,
	"Sergei Shtylyov" <sergei.shtylyov@cogentembedded.com>,
	"Niklas Söderlund" <niklas.soderlund@ragnatech.se>,
	"Wolfram Sang" <wsa@the-dreams.de>,
	"Simon Horman" <horms@verge.net.au>,
	"Magnus Damm" <magnus.damm@gmail.com>
Subject: Re: [PATCH v4] ravb: implement MTU change while device is up
Date: Thu, 14 Nov 2019 11:26:31 +0100	[thread overview]
Message-ID: <CAMuHMdXZQpYwAU4DE-Odnm0=EZMUDJ+0WLJjeErbVZJ8PkC5Dg@mail.gmail.com> (raw)
In-Reply-To: <20191114014949.31057-1-uli+renesas@fpond.eu>

Hi Uli,

On Thu, Nov 14, 2019 at 2:50 AM Ulrich Hecht <uli+renesas@fpond.eu> 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@fpond.eu>

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@linux-m68k.org

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

  reply	other threads:[~2019-11-14 10:26 UTC|newest]

Thread overview: 7+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2019-10-16 14:30 [PATCH] clocksource/drivers/sh_mtu2: Do not loop using platform_get_irq_by_name() Geert Uytterhoeven
2019-10-16 15:06 ` Daniel Lezcano
2019-11-14  1:49 ` [PATCH v4] ravb: implement MTU change while device is up Ulrich Hecht
2019-11-14 10:26   ` Geert Uytterhoeven [this message]
2019-11-14 20:38   ` Sergei Shtylyov
2019-11-15  2:05   ` David Miller
2019-11-18  9:20   ` Patchwork summary for: linux-renesas-soc patchwork-bot+linux-renesas-soc

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='CAMuHMdXZQpYwAU4DE-Odnm0=EZMUDJ+0WLJjeErbVZJ8PkC5Dg@mail.gmail.com' \
    --to=geert@linux-m68k.org \
    --cc=davem@davemloft.net \
    --cc=horms@verge.net.au \
    --cc=linux-renesas-soc@vger.kernel.org \
    --cc=magnus.damm@gmail.com \
    --cc=netdev@vger.kernel.org \
    --cc=niklas.soderlund@ragnatech.se \
    --cc=sergei.shtylyov@cogentembedded.com \
    --cc=uli+renesas@fpond.eu \
    --cc=wsa@the-dreams.de \
    /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;
as well as URLs for NNTP newsgroup(s).