From patchwork Thu Apr 11 10:26:33 2019 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Matteo Croce X-Patchwork-Id: 10895631 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 B56D01708 for ; Thu, 11 Apr 2019 10:27:12 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id A02CC28B49 for ; Thu, 11 Apr 2019 10:27:12 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id 92F6728CD0; Thu, 11 Apr 2019 10:27:12 +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 4574428B49 for ; Thu, 11 Apr 2019 10:27:12 +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=4S3B5C5TH0bTndrZEdee0wxr9aDFj0aeUmbHK+pr2pk=; b=P3PF3FNE2H9PAj GqOn8u9mP2BDIICeuqczlQPQpTKskccroCEsWZHgU9Wu0zCrBhjRkET2T2310GvxZz41HrwSGUkWo RcfVGXz6Kdv8ANJgqBpHB4aypzb1TKndVyi+By2mB1yjYzD8BbEqA2msA4rhLrrNwnqZVHGuTMRmO ozd2XEIzESk+MMZhLtxiKs9rc4M6bzUFEWodDGt32F0skCTOxq8f0jY/GBGkW17f5DBBML7/BZ323 wfzcf/6hdcYf1T1tJFy3XkBKLqAOrU+nLdp57jIw3EuKUUTwcMmQ3/wdDDC1BERTr82S8MGZ9gXzm QxqLGxzG1IPXNnDtul4A==; 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 1hEWvD-000550-6M; Thu, 11 Apr 2019 10:27:07 +0000 Received: from mail-wm1-f67.google.com ([209.85.128.67]) by bombadil.infradead.org with esmtps (Exim 4.90_1 #2 (Red Hat Linux)) id 1hEWul-0004bU-RU for linux-arm-kernel@lists.infradead.org; Thu, 11 Apr 2019 10:26:41 +0000 Received: by mail-wm1-f67.google.com with SMTP id q16so6018873wmj.3 for ; Thu, 11 Apr 2019 03:26:39 -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=Gi3SOf8ZFfPE0FWhRc13sB95XG0PUYYR4jIgV6Oweg4=; b=bt0DPtfm06bqBRp+OaWgKJXRFBqebyBRlaQ91bHAkHPYYNlpWU2u6UAus1ZdPneteD QlvuIon8apcWP1LmNs65MAoFgTIGk8V9ZQJ+oiwEgW5GkSv7ghDNszeiOUmNgPmLL06V FBUF40uB0Ff0aLSvwolGXOdh7iEVc3T6kj0nfoddiZtl5yzApnksArnKyd7nOsAWLnGw OrLCiX6DfQH7cqIV74Y48FQx/9PizU92U0BRlM5fxf6EzGjqf0jrcc6PjMo0zCTkM7OD dGvuP3D+t1CsrvncYxRIRixOjXPZ9V5dWzxVmsb6lBOdw9lNsRS0uhWllnQokS9ti+zd gDXg== X-Gm-Message-State: APjAAAXk5dBhgJpL+B5c/BIV0pA8FfxrW0Fx1v/pp0/eVUmSO9tahUHS 4QZh6UmW7G8tcujdcUmfAliXxQ== X-Google-Smtp-Source: APXvYqy88040TxWxZ41cUacGsJ6l1tKbw3r1Ixd4i0FLCcUj1xFn8/py1a7gEPyCwm+h9/zlzieAxA== X-Received: by 2002:a05:600c:c4:: with SMTP id u4mr6328000wmm.80.1554978398248; Thu, 11 Apr 2019 03:26:38 -0700 (PDT) Received: from mcroce-redhat.mxp.redhat.com (nat-pool-mxp-t.redhat.com. [149.6.153.186]) by smtp.gmail.com with ESMTPSA id 204sm7681684wmc.1.2019.04.11.03.26.37 (version=TLS1_2 cipher=ECDHE-RSA-CHACHA20-POLY1305 bits=256/256); Thu, 11 Apr 2019 03:26:37 -0700 (PDT) From: Matteo Croce To: netdev@vger.kernel.org Subject: [PATCH v3 2/2] net: thunderx: don't allow jumbo frames with XDP Date: Thu, 11 Apr 2019 12:26:33 +0200 Message-Id: <20190411102633.3685-3-mcroce@redhat.com> X-Mailer: git-send-email 2.21.0 In-Reply-To: <20190411102633.3685-1-mcroce@redhat.com> References: <20190411102633.3685-1-mcroce@redhat.com> MIME-Version: 1.0 X-CRM114-Version: 20100106-BlameMichelson ( TRE 0.8.0 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20190411_032639_883725_53657FDC X-CRM114-Status: GOOD ( 12.13 ) 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 , Ilias Apalodimas , Jesper Dangaard Brouer , Sunil Goutham , David Miller , linux-arm-kernel@lists.infradead.org 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 Acked-by: Jesper Dangaard Brouer --- 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..c032bef1b776 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 headroom for VLAN, QinQ. + */ + if (nic->xdp_prog && new_mtu > MAX_XDP_MTU) { + netdev_warn(netdev, "Jumbo frames not yet supported with XDP, current MTU %d.\n", + netdev->mtu); + return -EINVAL; + } + netdev->mtu = new_mtu; if (!netif_running(netdev))