From patchwork Tue May 2 05:06:34 2017 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: John Fastabend X-Patchwork-Id: 757384 X-Patchwork-Delegate: jeffrey.t.kirsher@intel.com Return-Path: X-Original-To: incoming@patchwork.ozlabs.org Delivered-To: patchwork-incoming@bilbo.ozlabs.org Received: from hemlock.osuosl.org (smtp2.osuosl.org [140.211.166.133]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by ozlabs.org (Postfix) with ESMTPS id 3wH8R13Kwpz9s7n for ; Tue, 2 May 2017 15:06:53 +1000 (AEST) Authentication-Results: ozlabs.org; dkim=fail reason="signature verification failed" (2048-bit key; unprotected) header.d=gmail.com header.i=@gmail.com header.b="B/T7T8Rm"; dkim-atps=neutral Received: from localhost (localhost [127.0.0.1]) by hemlock.osuosl.org (Postfix) with ESMTP id 8FEDF88D57; Tue, 2 May 2017 05:06:51 +0000 (UTC) X-Virus-Scanned: amavisd-new at osuosl.org Received: from hemlock.osuosl.org ([127.0.0.1]) by localhost (.osuosl.org [127.0.0.1]) (amavisd-new, port 10024) with ESMTP id 2Tm7zfJKFNxK; Tue, 2 May 2017 05:06:50 +0000 (UTC) Received: from ash.osuosl.org (ash.osuosl.org [140.211.166.34]) by hemlock.osuosl.org (Postfix) with ESMTP id 1420E88C5B; Tue, 2 May 2017 05:06:50 +0000 (UTC) X-Original-To: intel-wired-lan@lists.osuosl.org Delivered-To: intel-wired-lan@lists.osuosl.org Received: from whitealder.osuosl.org (smtp1.osuosl.org [140.211.166.138]) by ash.osuosl.org (Postfix) with ESMTP id 152B81BFBAD for ; Tue, 2 May 2017 05:06:48 +0000 (UTC) Received: from localhost (localhost [127.0.0.1]) by whitealder.osuosl.org (Postfix) with ESMTP id 10A30883F6 for ; Tue, 2 May 2017 05:06:48 +0000 (UTC) X-Virus-Scanned: amavisd-new at osuosl.org Received: from whitealder.osuosl.org ([127.0.0.1]) by localhost (.osuosl.org [127.0.0.1]) (amavisd-new, port 10024) with ESMTP id Nqgju6m+S2hW for ; Tue, 2 May 2017 05:06:47 +0000 (UTC) X-Greylist: domain auto-whitelisted by SQLgrey-1.7.6 Received: from mail-pf0-f193.google.com (mail-pf0-f193.google.com [209.85.192.193]) by whitealder.osuosl.org (Postfix) with ESMTPS id 3611387F86 for ; Tue, 2 May 2017 05:06:47 +0000 (UTC) Received: by mail-pf0-f193.google.com with SMTP id o68so11478362pfj.2 for ; Mon, 01 May 2017 22:06:47 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20161025; h=from:subject:to:cc:date:message-id:user-agent:mime-version :content-transfer-encoding; bh=sF84mJhqlyeJn5vIbLg3wr1MLOONKCRogw61t2dk5Ho=; b=B/T7T8RmMSNvwQprILA2dsVwzGBnGE2FYG7Qtf+9/ML6ue9XBrM3ItUFkI7j5/CiQj fKUrKh+tlh7JFXOSx9iO54+DJeKDGOKlGUMTFCI/LZzUjs6LfFuEiZ6It0+LkHZLmgfv Nd5mSMxlCNgBYT/0ZVCh7mZx/o7pXtnh2Ru5Dp5kac8HvBom28ZuFraIvkmsJMmLMnaO Fu89yRwtDpYPHETuolubaSK/Jm052axZ2iq4x1M5U6XT0ll6rkWHkuE88A6LUHKbDnDZ q0531fxI0PO5bcUmBJTf0NOY1xwWm8clRxgvnlZs+19OcY3jKVy2cZLmukZYz8bS7SDG fxlQ== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:from:subject:to:cc:date:message-id:user-agent :mime-version:content-transfer-encoding; bh=sF84mJhqlyeJn5vIbLg3wr1MLOONKCRogw61t2dk5Ho=; b=K9wGKmqoC0pW9adko744LIi26LoLaXiN4pz5UjKr88JDd30v8lqjNPTu5X2KuC06iM n2wubD80yL5RrAL3YJ/ii5w8TIj/tLqzfDKWxUMP00RLARzwFsvx0WHpUnJKSREU2VYi 4RBR2z9XAYjas+NHt/IMHofQEzf6Zg4sLsKJB6X2Mze+0HHbxgR5VLajluP+JeDO0bRO YX3sndVv2MszmKqq7wSP2+seto0tK1qosxZKkHIs1MFOyMl+p2ReKq2+GoXEF2SbC6r8 pbrxsP4vkHwZ9+YR8a9FfoCfIDSrO3qAwPyQw2fPd7jOxDxwyN3fnbQ4SnzYYBIRk0tD IFUw== X-Gm-Message-State: AN3rC/7ygkwUVDQ1H1gPbGgJawVKAr6QAoZGYY4wvIuV4MQGBY1yl5yb Krz+Ap+nTTu5Pg== X-Received: by 10.99.120.206 with SMTP id t197mr30794405pgc.184.1493701606874; Mon, 01 May 2017 22:06:46 -0700 (PDT) Received: from [127.0.1.1] ([72.168.145.102]) by smtp.gmail.com with ESMTPSA id u78sm7830582pfa.47.2017.05.01.22.06.42 (version=TLS1_2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Mon, 01 May 2017 22:06:46 -0700 (PDT) From: John Fastabend X-Google-Original-From: John Fastabend To: intel-wired-lan@lists.osuosl.org Date: Mon, 01 May 2017 22:06:34 -0700 Message-ID: <20170502050634.7459.50968.stgit@john-Precision-Tower-5810> User-Agent: StGit/0.17.1-dirty MIME-Version: 1.0 Subject: [Intel-wired-lan] [PATCH] ixgbe: prevent driver configuration changes while XDP is loaded X-BeenThere: intel-wired-lan@lists.osuosl.org X-Mailman-Version: 2.1.18-1 Precedence: list List-Id: Intel Wired Ethernet Linux Kernel Driver Development List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: intel-wired-lan-bounces@lists.osuosl.org Sender: "Intel-wired-lan" XDP checks to ensure the MTU is valid and LRO is disabled when it is loaded. But user configuration after XDP is loaded could change these and cause a misconfiguration. This patch adds checks to ensure config changes are valid. Signed-off-by: John Fastabend Signed-off-by: John Fastabend Tested-by: Andrew Bowers --- drivers/net/ethernet/intel/ixgbe/ixgbe_main.c | 17 +++++++++++++++++ 1 file changed, 17 insertions(+) diff --git a/drivers/net/ethernet/intel/ixgbe/ixgbe_main.c b/drivers/net/ethernet/intel/ixgbe/ixgbe_main.c index ee20a2b..156357e 100644 --- a/drivers/net/ethernet/intel/ixgbe/ixgbe_main.c +++ b/drivers/net/ethernet/intel/ixgbe/ixgbe_main.c @@ -6437,6 +6437,19 @@ static void ixgbe_free_all_rx_resources(struct ixgbe_adapter *adapter) static int ixgbe_change_mtu(struct net_device *netdev, int new_mtu) { struct ixgbe_adapter *adapter = netdev_priv(netdev); + int i, frame_size = new_mtu + ETH_HLEN + ETH_FCS_LEN + VLAN_HLEN; + + /* If XDP is running enforce MTU limitations */ + for (i = 0; i < adapter->num_rx_queues; i++) { + struct ixgbe_ring *ring = adapter->rx_ring[i]; + + if (frame_size > ixgbe_rx_bufsz(ring)) { + e_warn(probe, + "Setting MTU > %i with XDP is not supported\n", + ixgbe_rx_bufsz(ring)); + return -EINVAL; + } + } /* * For 82599EB we cannot allow legacy VFs to enable their receive @@ -9291,6 +9304,10 @@ static netdev_features_t ixgbe_fix_features(struct net_device *netdev, if (!(adapter->flags2 & IXGBE_FLAG2_RSC_CAPABLE)) features &= ~NETIF_F_LRO; + /* If XDP is enabled we can not enable LRO */ + if (adapter->xdp_prog) + features &= ~NETIF_F_LRO; + return features; }