From patchwork Wed Feb 8 02:43:32 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Jason Xing X-Patchwork-Id: 13132306 X-Patchwork-Delegate: kuba@kernel.org Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by smtp.lore.kernel.org (Postfix) with ESMTP id DAAD0C636CD for ; Wed, 8 Feb 2023 02:44:04 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S229727AbjBHCoD (ORCPT ); Tue, 7 Feb 2023 21:44:03 -0500 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:53244 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S229557AbjBHCoB (ORCPT ); Tue, 7 Feb 2023 21:44:01 -0500 Received: from mail-pl1-x62d.google.com (mail-pl1-x62d.google.com [IPv6:2607:f8b0:4864:20::62d]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id E29ED2138; Tue, 7 Feb 2023 18:44:00 -0800 (PST) Received: by mail-pl1-x62d.google.com with SMTP id h15so10396457plk.12; Tue, 07 Feb 2023 18:44:00 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20210112; h=content-transfer-encoding:mime-version:message-id:date:subject:cc :to:from:from:to:cc:subject:date:message-id:reply-to; bh=La3OH/wxxUC+XGiTFrGm7IEcXqspoaqeInslaM1lK3o=; b=HcoAEA6t13WP2R5z5xB0i39ady4K0zU6k1HBKc6Dmim0YBCX2HkUXoIAWMAfq5F9Ug u5AhG+Cs6exh7j7jEl/Y3nNbsc9ZUBZTaXwjijYD1HNxbRSkiWYv+qYshRdbS+Fn+RAQ It6Gkapc18/oiepO/BZ2sF5RwvwaeHuWHm+q2v9UG3u/nFG6UIGHpmFr9RwHjD6ympPG YVyxh6ucWUj5OBbrPXHKt3kAMRAyshdidtpcBF8z7+HK9YcrVjBXkK7upIkvDqcenTv0 mVqcpBNaKF8wzGdE1+5A9CnjpsOvqy7WiYYPyXWKfXO1X3iOw8JaY8B7U7EHgc6Z7szK Pllw== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20210112; h=content-transfer-encoding:mime-version:message-id:date:subject:cc :to:from:x-gm-message-state:from:to:cc:subject:date:message-id :reply-to; bh=La3OH/wxxUC+XGiTFrGm7IEcXqspoaqeInslaM1lK3o=; b=zRfQNwM5d+Z3imZwgRBbOCDzD40ncMkEunOmZaW0GT64CLVHlwNsPtQrr/DK14lLiw dJqGoVW+5JWfl7tS2ln0Hg2bI0PxMpFe2Vpbm1MMtS0NY4anM1Hlixygo/Z+sxhYlCX1 lhy4EPSmmemEMbG1RMQE0k05VwZWjAbpTiQpCN9sUo6CzojQm2mLiuFnhkvooLyrDpRk Iv2rR8YxJo0JAzxnWo4ZMPvywnrNVzlkHoypsaiETY8qiQa+eMkaiuwmrL28/hwr+eSa tOE8cdYk9Uo6KcwBKMeo9qnjr6Ib792fud6Vw4UoA6IGRQCD8HWXGMeX+F6iYNzpQnzv o3kw== X-Gm-Message-State: AO0yUKXwrtwEIRxMUfEky/0MixJnvFMWKjihvrvbovltoT9l6bYRz2Pa KQrk9P9uuGlxBxPSN9Jyb7g= X-Google-Smtp-Source: AK7set+g6t0zpDw6cZ6u3Ejsod7XXE0VcvWokhkIB7GAN6au/Bx55Hahcu7ysmaoaUwaCydcafhm1A== X-Received: by 2002:a05:6a20:7d95:b0:bc:5f20:140d with SMTP id v21-20020a056a207d9500b000bc5f20140dmr6731933pzj.30.1675824240304; Tue, 07 Feb 2023 18:44:00 -0800 (PST) Received: from KERNELXING-MB0.tencent.com ([103.7.29.31]) by smtp.gmail.com with ESMTPSA id jk3-20020a170903330300b001960735c652sm9660835plb.169.2023.02.07.18.43.56 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Tue, 07 Feb 2023 18:43:59 -0800 (PST) From: Jason Xing To: jesse.brandeburg@intel.com, anthony.l.nguyen@intel.com, davem@davemloft.net, edumazet@google.com, kuba@kernel.org, pabeni@redhat.com, richardcochran@gmail.com, ast@kernel.org, daniel@iogearbox.net, hawk@kernel.org, john.fastabend@gmail.com, alexandr.lobakin@intel.com, maciej.fijalkowski@intel.com Cc: intel-wired-lan@lists.osuosl.org, netdev@vger.kernel.org, linux-kernel@vger.kernel.org, bpf@vger.kernel.org, kerneljasonxing@gmail.com, Jason Xing Subject: [PATCH net v4 1/3] ixgbe: allow to increase MTU to 3K with XDP enabled Date: Wed, 8 Feb 2023 10:43:32 +0800 Message-Id: <20230208024333.10465-1-kerneljasonxing@gmail.com> X-Mailer: git-send-email 2.33.0 MIME-Version: 1.0 Precedence: bulk List-ID: X-Mailing-List: netdev@vger.kernel.org X-Patchwork-Delegate: kuba@kernel.org From: Jason Xing Recently I encountered one case where I cannot increase the MTU size directly from 1500 to a much bigger value with XDP enabled if the server is equipped with IXGBE card, which happened on thousands of servers in production environment. After appling the current patch, we can set the maximum MTU size to 3K. This patch follows the behavior of changing MTU as i40e/ice does. Referrences: [1] commit 23b44513c3e6 ("ice: allow 3k MTU for XDP") [2] commit 0c8493d90b6b ("i40e: add XDP support for pass and drop actions") Fixes: fabf1bce103a ("ixgbe: Prevent unsupported configurations with XDP") Signed-off-by: Jason Xing Reviewed-by: Alexander Duyck Tested-by: Chandan Kumar Rout (A Contingent Worker at Intel) --- v4: 1) use ':' instead of '-' for kdoc v3: 1) modify the titile and body message. v2: 1) change the commit message. 2) modify the logic when changing MTU size suggested by Maciej and Alexander. --- drivers/net/ethernet/intel/ixgbe/ixgbe_main.c | 25 ++++++++++++------- 1 file changed, 16 insertions(+), 9 deletions(-) diff --git a/drivers/net/ethernet/intel/ixgbe/ixgbe_main.c b/drivers/net/ethernet/intel/ixgbe/ixgbe_main.c index ab8370c413f3..25ca329f7d3c 100644 --- a/drivers/net/ethernet/intel/ixgbe/ixgbe_main.c +++ b/drivers/net/ethernet/intel/ixgbe/ixgbe_main.c @@ -6777,6 +6777,18 @@ static void ixgbe_free_all_rx_resources(struct ixgbe_adapter *adapter) ixgbe_free_rx_resources(adapter->rx_ring[i]); } +/** + * ixgbe_max_xdp_frame_size - returns the maximum allowed frame size for XDP + * @adapter: device handle, pointer to adapter + */ +static int ixgbe_max_xdp_frame_size(struct ixgbe_adapter *adapter) +{ + if (PAGE_SIZE >= 8192 || adapter->flags2 & IXGBE_FLAG2_RX_LEGACY) + return IXGBE_RXBUFFER_2K; + else + return IXGBE_RXBUFFER_3K; +} + /** * ixgbe_change_mtu - Change the Maximum Transfer Unit * @netdev: network interface device structure @@ -6788,18 +6800,13 @@ static int ixgbe_change_mtu(struct net_device *netdev, int new_mtu) { struct ixgbe_adapter *adapter = netdev_priv(netdev); - if (adapter->xdp_prog) { + if (ixgbe_enabled_xdp_adapter(adapter)) { int new_frame_size = new_mtu + ETH_HLEN + ETH_FCS_LEN + VLAN_HLEN; - int i; - - for (i = 0; i < adapter->num_rx_queues; i++) { - struct ixgbe_ring *ring = adapter->rx_ring[i]; - if (new_frame_size > ixgbe_rx_bufsz(ring)) { - e_warn(probe, "Requested MTU size is not supported with XDP\n"); - return -EINVAL; - } + if (new_frame_size > ixgbe_max_xdp_frame_size(adapter)) { + e_warn(probe, "Requested MTU size is not supported with XDP\n"); + return -EINVAL; } } From patchwork Wed Feb 8 02:43:33 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Jason Xing X-Patchwork-Id: 13132307 X-Patchwork-Delegate: kuba@kernel.org Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by smtp.lore.kernel.org (Postfix) with ESMTP id DC109C64EC4 for ; Wed, 8 Feb 2023 02:44:18 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S230248AbjBHCoQ (ORCPT ); Tue, 7 Feb 2023 21:44:16 -0500 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:53422 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S230263AbjBHCoO (ORCPT ); Tue, 7 Feb 2023 21:44:14 -0500 Received: from mail-pj1-x1034.google.com (mail-pj1-x1034.google.com [IPv6:2607:f8b0:4864:20::1034]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id C5CA642BC3; Tue, 7 Feb 2023 18:44:12 -0800 (PST) Received: by mail-pj1-x1034.google.com with SMTP id bg10-20020a17090b0d8a00b00230c7f312d4so839346pjb.3; Tue, 07 Feb 2023 18:44:12 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20210112; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:from:to:cc:subject:date :message-id:reply-to; bh=VyqZcRW+GCugu4NS9vKOMBoBT0DqUhhKYXJJWlHHasM=; b=mp2V3kKaJjudKsbJwyzaBVBQhDL9Aqv6JEFZT6bcipjH6W83zFCNQbMombS4raOmgo djL3OSU7Pl1auFWMed2zIzkXR2YOce439ls0lXCMuOHGkEkBVbtbouC8YHRUbdglcqh2 nT441af3nzdyEZpLafy3zVNO3bS9e0ffV3wWpTQ6WZi3fJcwcZjdmTInTB8bZgCfUAJm K1/JCGsscz8L2MyJ8UfkcUztjZX4YyNZ+o0TasQQ5AENhRrwcwC9hnasnFrFTJXQDePX 9kiEarkcvkpxSnxE4guYS+j+bqk+awaEFyYEJZkN8ocH6VANoTTPx1CPbxprKia+3J7j qH8w== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20210112; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:x-gm-message-state:from:to:cc :subject:date:message-id:reply-to; bh=VyqZcRW+GCugu4NS9vKOMBoBT0DqUhhKYXJJWlHHasM=; b=IMRv7z7inF1uarlyBa7AiNI9nCUa+37th+1uJx++P+zFXvjMppvqN7zKY+wulcqAs5 UOznLZF09OGUhIq4r09fjV36TWLz4aYm9H4puY7tKTCxyArIK7ONKFviWPheZp9KQPfX 1H2q9GM0pk95YI38RQ3tKgJrWsjgolsS/vwgek/OuneP2ZTV1YTu1HU/shkq9OIzFA95 5fe5Nd7UD8O/PB8RPzVX9AHzgDlkUaumAqo+TGsSAfEvpsecHcK67KBCYRToubnCcyys l6SXC9PhkZsjf/bVydPuh2DA7SaK6CKrdGhwHPPXq+quUVcrg1WozxJ/H1v+qzthGE/b IbVg== X-Gm-Message-State: AO0yUKW2olEOLYRwi2aGGTOy9NqDzGCIx/xgBULLezsJFVZbDlr5CQOL MqRFri47C5ibA2CiBua9wyY= X-Google-Smtp-Source: AK7set/4oeTEli8Ax7aBRx/+c9c1lZQ8VN9xNA+XYH6H2dBDKz8nuyieM3SD3X+Z800o+WRlK8yd8g== X-Received: by 2002:a05:6a21:2c98:b0:b6:40ae:823e with SMTP id ua24-20020a056a212c9800b000b640ae823emr4795213pzb.5.1675824252275; Tue, 07 Feb 2023 18:44:12 -0800 (PST) Received: from KERNELXING-MB0.tencent.com ([103.7.29.31]) by smtp.gmail.com with ESMTPSA id jk3-20020a170903330300b001960735c652sm9660835plb.169.2023.02.07.18.44.08 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Tue, 07 Feb 2023 18:44:11 -0800 (PST) From: Jason Xing To: jesse.brandeburg@intel.com, anthony.l.nguyen@intel.com, davem@davemloft.net, edumazet@google.com, kuba@kernel.org, pabeni@redhat.com, richardcochran@gmail.com, ast@kernel.org, daniel@iogearbox.net, hawk@kernel.org, john.fastabend@gmail.com, alexandr.lobakin@intel.com, maciej.fijalkowski@intel.com Cc: intel-wired-lan@lists.osuosl.org, netdev@vger.kernel.org, linux-kernel@vger.kernel.org, bpf@vger.kernel.org, kerneljasonxing@gmail.com, Jason Xing Subject: [PATCH net v2 2/3] i40e: add double of VLAN header when computing the max MTU Date: Wed, 8 Feb 2023 10:43:33 +0800 Message-Id: <20230208024333.10465-2-kerneljasonxing@gmail.com> X-Mailer: git-send-email 2.33.0 In-Reply-To: <20230208024333.10465-1-kerneljasonxing@gmail.com> References: <20230208024333.10465-1-kerneljasonxing@gmail.com> MIME-Version: 1.0 Precedence: bulk List-ID: X-Mailing-List: netdev@vger.kernel.org X-Patchwork-Delegate: kuba@kernel.org From: Jason Xing Include the second VLAN HLEN into account when computing the maximum MTU size as other drivers do. Fixes: 0c8493d90b6b ("i40e: add XDP support for pass and drop actions") Signed-off-by: Jason Xing Reviewed-by: Alexander Duyck Tested-by: Chandan Kumar Rout (A Contingent Worker at Intel) --- v2: drop the duplicate definition --- drivers/net/ethernet/intel/i40e/i40e_main.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/drivers/net/ethernet/intel/i40e/i40e_main.c b/drivers/net/ethernet/intel/i40e/i40e_main.c index 53d0083e35da..d039928f3646 100644 --- a/drivers/net/ethernet/intel/i40e/i40e_main.c +++ b/drivers/net/ethernet/intel/i40e/i40e_main.c @@ -2921,7 +2921,7 @@ static int i40e_change_mtu(struct net_device *netdev, int new_mtu) struct i40e_pf *pf = vsi->back; if (i40e_enabled_xdp_vsi(vsi)) { - int frame_size = new_mtu + ETH_HLEN + ETH_FCS_LEN + VLAN_HLEN; + int frame_size = new_mtu + I40E_PACKET_HDR_PAD; if (frame_size > i40e_max_xdp_frame_size(vsi)) return -EINVAL;