From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-7.0 required=3.0 tests=DKIMWL_WL_HIGH,DKIM_SIGNED, DKIM_VALID,HEADER_FROM_DIFFERENT_DOMAINS,INCLUDES_PATCH,MAILING_LIST_MULTI, SIGNED_OFF_BY,SPF_PASS,URIBL_BLOCKED autolearn=unavailable autolearn_force=no version=3.4.0 Received: from mail.kernel.org (mail.kernel.org [198.145.29.99]) by smtp.lore.kernel.org (Postfix) with ESMTP id A0570C4360F for ; Wed, 3 Apr 2019 07:18:46 +0000 (UTC) Received: from bombadil.infradead.org (bombadil.infradead.org [198.137.202.133]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by mail.kernel.org (Postfix) with ESMTPS id 7105720830 for ; Wed, 3 Apr 2019 07:18:46 +0000 (UTC) Authentication-Results: mail.kernel.org; dkim=pass (2048-bit key) header.d=lists.infradead.org header.i=@lists.infradead.org header.b="tQzju5tx" DMARC-Filter: OpenDMARC Filter v1.3.2 mail.kernel.org 7105720830 Authentication-Results: mail.kernel.org; dmarc=fail (p=none dis=none) header.from=redhat.com Authentication-Results: mail.kernel.org; spf=none smtp.mailfrom=linux-arm-kernel-bounces+infradead-linux-arm-kernel=archiver.kernel.org@lists.infradead.org DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=lists.infradead.org; s=bombadil.20170209; h=Sender: Content-Transfer-Encoding:Content-Type:Cc:List-Subscribe:List-Help:List-Post: List-Archive:List-Unsubscribe:List-Id:MIME-Version:References:In-Reply-To: Message-ID:Subject:To:From:Date:Reply-To:Content-ID:Content-Description: Resent-Date:Resent-From:Resent-Sender:Resent-To:Resent-Cc:Resent-Message-ID: List-Owner; bh=bfaX2uY9+SZdYQq9MQmlWj4p7O71dG7Rw+p+JLio/60=; b=tQzju5txNxgZoU W6m1vB6HVnZqtKGFsc5lrn3SCGlMTeGDxuHgRCoit7kHH3KSjuly9GasiUlfb+S3ZcWHOD7aF7zAB ENnjI1LIaJq9BiQlaMA6dq+CEb1opMN66FU5mrbOMSxxoU0l30xqFRRKJp3kBwZIrxdO7tg3UOkAX RpHME4/kr4pWD56HdgKdnn3xvEYDxe9cemYyvBS+TzmQPH723CnM0CWMRxCaNJyqZSFKFE4Pm66CI 00fHNPZQQiHk8i2vFpFKpBxWaKgcv8QP04jYgj0wpgKiZnimcnDKHdlWgnclQK3okeGsykSPmc15w lzYkwfCm8e4HD2iqjgjQ==; Received: from localhost ([127.0.0.1] helo=bombadil.infradead.org) by bombadil.infradead.org with esmtp (Exim 4.90_1 #2 (Red Hat Linux)) id 1hBaAT-0005G2-N1; Wed, 03 Apr 2019 07:18:41 +0000 Received: from mx1.redhat.com ([209.132.183.28]) by bombadil.infradead.org with esmtps (Exim 4.90_1 #2 (Red Hat Linux)) id 1hBaAQ-0005FY-8n for linux-arm-kernel@lists.infradead.org; Wed, 03 Apr 2019 07:18:39 +0000 Received: from smtp.corp.redhat.com (int-mx01.intmail.prod.int.phx2.redhat.com [10.5.11.11]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by mx1.redhat.com (Postfix) with ESMTPS id 21BF6C0BFBBB; Wed, 3 Apr 2019 07:18:37 +0000 (UTC) Received: from carbon (ovpn-200-46.brq.redhat.com [10.40.200.46]) by smtp.corp.redhat.com (Postfix) with ESMTP id 91069600D4; Wed, 3 Apr 2019 07:18:32 +0000 (UTC) Date: Wed, 3 Apr 2019 09:18:30 +0200 From: Jesper Dangaard Brouer To: Matteo Croce Subject: Re: [PATCH net] net: thunderx: don't allow jumbo frames with XDP Message-ID: <20190403091830.5fa867aa@carbon> In-Reply-To: <20190402231136.15156-1-mcroce@redhat.com> References: <20190402231136.15156-1-mcroce@redhat.com> MIME-Version: 1.0 X-Scanned-By: MIMEDefang 2.79 on 10.5.11.11 X-Greylist: Sender IP whitelisted, not delayed by milter-greylist-4.5.16 (mx1.redhat.com [10.5.110.32]); Wed, 03 Apr 2019 07:18:37 +0000 (UTC) X-CRM114-Version: 20100106-BlameMichelson ( TRE 0.8.0 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20190403_001838_325421_10583766 X-CRM114-Status: GOOD ( 20.39 ) X-BeenThere: linux-arm-kernel@lists.infradead.org X-Mailman-Version: 2.1.21 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Cc: Robert Richter , netdev@vger.kernel.org, Ilias Apalodimas , brouer@redhat.com, Sunil Goutham , linux-arm-kernel@lists.infradead.org Content-Type: text/plain; charset="us-ascii" Content-Transfer-Encoding: 7bit Sender: "linux-arm-kernel" Errors-To: linux-arm-kernel-bounces+infradead-linux-arm-kernel=archiver.kernel.org@lists.infradead.org On Wed, 3 Apr 2019 01:11:36 +0200 Matteo Croce 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 > --- > 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