From patchwork Mon Apr 8 21:06:47 2019 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Matteo Croce X-Patchwork-Id: 10890169 Return-Path: Received: from mail.wl.linuxfoundation.org (pdx-wl-mail.web.codeaurora.org [172.30.200.125]) by pdx-korg-patchwork-2.web.codeaurora.org (Postfix) with ESMTP id 37D2C13B5 for ; Mon, 8 Apr 2019 21:07:22 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id 1CCC5287E8 for ; Mon, 8 Apr 2019 21:07:22 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id 112ED287EA; Mon, 8 Apr 2019 21:07:22 +0000 (UTC) X-Spam-Checker-Version: SpamAssassin 3.3.1 (2010-03-16) on pdx-wl-mail.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-5.2 required=2.0 tests=BAYES_00,DKIM_SIGNED, DKIM_VALID,MAILING_LIST_MULTI,RCVD_IN_DNSWL_MED autolearn=ham version=3.3.1 Received: from bombadil.infradead.org (bombadil.infradead.org [198.137.202.133]) (using TLSv1.2 with cipher AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by mail.wl.linuxfoundation.org (Postfix) with ESMTPS id A5C10287E8 for ; Mon, 8 Apr 2019 21:07:21 +0000 (UTC) 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:Date:Subject:To:From:Reply-To:Content-ID:Content-Description: Resent-Date:Resent-From:Resent-Sender:Resent-To:Resent-Cc:Resent-Message-ID: List-Owner; bh=8pmbW1nHWohysluAO4o/UfZ4cCNFXWFXoMjQGv9f4RU=; b=hZTFoktSN9al/J vsBTJHSpbpLQsWgPmDW5Bq4Y8/xNgqH4nov6w2JfRHHma+UmVzLjzMEZt3QusYk6QUy/9CqB6N6dz yL1FIrvMrB97ldqrFK4vNcuvvdbp5stCGE/y0vybwBMAZaL/EbFNLhSsq2EGSTojB+2n0cNFJWjdR WxoEahSLxzrytVunZHgmPE76OVo2MlkVU1xRr/FWB4xHsqHozQ092fQJwyP54ES/PLQ/ZdVR9XrKQ dsNl6dJ30xzQ8/MyOisua380mKtnsScA8C1G0tPftOwnCeqGjKFP3H/8RtS+CtLwWaHspo3wuoKKq hPRDu+omWeni/kzGH6sQ==; 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 1hDbU7-0000HM-PD; Mon, 08 Apr 2019 21:07:19 +0000 Received: from mail-wr1-f65.google.com ([209.85.221.65]) by bombadil.infradead.org with esmtps (Exim 4.90_1 #2 (Red Hat Linux)) id 1hDbU1-0000As-9p for linux-arm-kernel@lists.infradead.org; Mon, 08 Apr 2019 21:07:18 +0000 Received: by mail-wr1-f65.google.com with SMTP id h4so18069355wre.7 for ; Mon, 08 Apr 2019 14:07:13 -0700 (PDT) X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:from:to:cc:subject:date:message-id:in-reply-to :references:mime-version:content-transfer-encoding; bh=8GFiHDRdwz++IbzXDeuG8PyZnYrnLyrpERHimmc0BIA=; b=JfjnHqQU10fZg/l5shwpSNIkVrLBpXPRwO6F2D9EiGRn7XcpQCgt/Zu4UD1o9ISsns Lt0ABxJAMxkjBZ4/vnLFegRG+LT5BYesJv0mbRIw6YUxkjuvJEaGtBXq7uDEeXfRjZcn oMeBoErscABb1bRSCaXok2BW2lyFt11NKDF8kJAzG/1mIieScNgmhkpv8pFkCdcm4dkT LH2psNog6FYw4XyBEbYPNNbtBlGY1O8kDhasYRqn0C6M4Tyt06YZ4IIiQdYplYoMVyI+ 1hxUzhqfLv/Rf9vHxUhr3UVjov3dXrR0MZt82n5mXnxQgvIpeaLz6zXGfHguUAVeRUFt XupQ== X-Gm-Message-State: APjAAAV+u/s4PjYhh7rWYUIjx/dlE931BOoH7UrEe5Nh03FCnj8NZA93 gGCOfRoHNc8aHtXdCjwNYXLMfg== X-Google-Smtp-Source: APXvYqx4g7ogtCH5cWFWThZmavqwS03uUnNA9BD+6D2SavUNdspWvKXzNgfENhKEGBD8n+5leDTnFg== X-Received: by 2002:a5d:4047:: with SMTP id w7mr21162042wrp.255.1554757631707; Mon, 08 Apr 2019 14:07:11 -0700 (PDT) Received: from raver.teknoraver.net (net-93-70-69-135.cust.vodafonedsl.it. [93.70.69.135]) by smtp.gmail.com with ESMTPSA id w16sm45041883wrt.84.2019.04.08.14.07.10 (version=TLS1_2 cipher=ECDHE-RSA-CHACHA20-POLY1305 bits=256/256); Mon, 08 Apr 2019 14:07:10 -0700 (PDT) From: Matteo Croce To: netdev@vger.kernel.org Subject: [PATCH net v2 2/2] net: thunderx: don't allow jumbo frames with XDP Date: Mon, 8 Apr 2019 23:06:47 +0200 Message-Id: <20190408210647.7385-3-mcroce@redhat.com> X-Mailer: git-send-email 2.21.0 In-Reply-To: <20190408210647.7385-1-mcroce@redhat.com> References: <20190408210647.7385-1-mcroce@redhat.com> MIME-Version: 1.0 X-CRM114-Version: 20100106-BlameMichelson ( TRE 0.8.0 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20190408_140713_563866_0AFB212F X-CRM114-Status: GOOD ( 12.19 ) 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: Ilias Apalodimas , Sunil Goutham , Robert Richter , linux-arm-kernel@lists.infradead.org, Jesper Dangaard Brouer Sender: "linux-arm-kernel" Errors-To: linux-arm-kernel-bounces+patchwork-linux-arm=patchwork.kernel.org@lists.infradead.org X-Virus-Scanned: ClamAV using ClamSMTP The thunderx driver forbids to load an eBPF program if the MTU is too high, but this can be circumvented by loading the eBPF, then raising the MTU. Fix this by limiting the MTU if an eBPF program is already loaded. Fixes: 05c773f52b96e ("net: thunderx: Add basic XDP support") Signed-off-by: Matteo Croce --- drivers/net/ethernet/cavium/thunder/nicvf_main.c | 9 +++++++++ 1 file changed, 9 insertions(+) diff --git a/drivers/net/ethernet/cavium/thunder/nicvf_main.c b/drivers/net/ethernet/cavium/thunder/nicvf_main.c index debc8c861c6b..a923a4daaa9e 100644 --- a/drivers/net/ethernet/cavium/thunder/nicvf_main.c +++ b/drivers/net/ethernet/cavium/thunder/nicvf_main.c @@ -1589,6 +1589,15 @@ 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, + * plus some header for VLAN, QinQ. + */ + if (nic->xdp_prog && new_mtu > MAX_XDP_MTU) { + netdev_warn(dev, "Jumbo frames not yet supported with XDP, current MTU %d.\n", + netdev->mtu); + return -EINVAL; + } + netdev->mtu = new_mtu; if (!netif_running(netdev))