From: Jesper Dangaard Brouer <brouer@redhat.com>
To: Matteo Croce <mcroce@redhat.com>
Cc: Robert Richter <rric@kernel.org>,
netdev@vger.kernel.org,
Ilias Apalodimas <ilias.apalodimas@linaro.org>,
brouer@redhat.com, Sunil Goutham <sgoutham@cavium.com>,
linux-arm-kernel@lists.infradead.org
Subject: Re: [PATCH net] net: thunderx: don't allow jumbo frames with XDP
Date: Wed, 3 Apr 2019 09:18:30 +0200 [thread overview]
Message-ID: <20190403091830.5fa867aa@carbon> (raw)
In-Reply-To: <20190402231136.15156-1-mcroce@redhat.com>
On Wed, 3 Apr 2019 01:11:36 +0200
Matteo Croce <mcroce@redhat.com> wrote:
> The thunderx driver forbids to load an eBPF program if the MTU is higher
> than 1500 bytes, but this can be circumvented by first loading the eBPF,
> and then raising the MTU.
>
> XDP assumes that SKBs are linear and fit in a single page, this can lead
> to undefined behaviours.
> Fix this by limiting the MTU to 1500 bytes if an eBPF program is loaded.
I find this 1500 bytes limit strange. While XDP does not support
frames that is split over multiple pages, it does support larger frames,
as long as it can fit within one (e.g 4K) page, minus XDP_PACKET_HEADROOM
(256B) and have tail-room for skb_shared_info (320 bytes), which is
4096-256-320 = 3520 bytes.
A quick look at this driver it seems you are limited to 2176 bytes
(RCV_FRAG_LEN=1536+64+320 + 256) based on how the dma mapping is done.
I think the drivers intent is to limit to 1536 bytes, but the DMA
mapping area include more. It seems rather suboptimal that the
skb_shared_info is included as part of the DMA mapping.
> Fixes: 05c773f52b96e ("net: thunderx: Add basic XDP support")
> Signed-off-by: Matteo Croce <mcroce@redhat.com>
> ---
> drivers/net/ethernet/cavium/thunder/nicvf_main.c | 7 +++++++
> 1 file changed, 7 insertions(+)
>
> diff --git a/drivers/net/ethernet/cavium/thunder/nicvf_main.c b/drivers/net/ethernet/cavium/thunder/nicvf_main.c
> index aa2be4807191..fe1d7513f01d 100644
> --- a/drivers/net/ethernet/cavium/thunder/nicvf_main.c
> +++ b/drivers/net/ethernet/cavium/thunder/nicvf_main.c
> @@ -1578,6 +1578,13 @@ static int nicvf_change_mtu(struct net_device *netdev, int new_mtu)
> struct nicvf *nic = netdev_priv(netdev);
> int orig_mtu = netdev->mtu;
>
> + /* For now just support only the usual MTU sized frames */
> + if (nic->xdp_prog && new_mtu > 1500) {
> + netdev_warn(netdev, "Jumbo frames not yet supported with XDP, current MTU %d.\n",
> + netdev->mtu);
> + return -EOPNOTSUPP;
> + }
> +
> netdev->mtu = new_mtu;
>
> if (!netif_running(netdev))
--
Best regards,
Jesper Dangaard Brouer
MSc.CS, Principal Kernel Engineer at Red Hat
LinkedIn: http://www.linkedin.com/in/brouer
_______________________________________________
linux-arm-kernel mailing list
linux-arm-kernel@lists.infradead.org
http://lists.infradead.org/mailman/listinfo/linux-arm-kernel
next prev parent reply other threads:[~2019-04-03 7:18 UTC|newest]
Thread overview: 6+ messages / expand[flat|nested] mbox.gz Atom feed top
2019-04-02 23:11 [PATCH net] net: thunderx: don't allow jumbo frames with XDP Matteo Croce
2019-04-03 7:18 ` Jesper Dangaard Brouer [this message]
2019-04-05 0:20 ` David Miller
2019-04-05 0:51 ` Matteo Croce
2019-04-05 15:45 ` Matteo Croce
2019-04-06 16:19 ` Jesper Dangaard Brouer
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=20190403091830.5fa867aa@carbon \
--to=brouer@redhat.com \
--cc=ilias.apalodimas@linaro.org \
--cc=linux-arm-kernel@lists.infradead.org \
--cc=mcroce@redhat.com \
--cc=netdev@vger.kernel.org \
--cc=rric@kernel.org \
--cc=sgoutham@cavium.com \
/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).