From patchwork Sat Feb 4 13:35: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: 52782 Return-Path: Delivered-To: ouuuleilei@gmail.com Received: by 2002:adf:eb09:0:0:0:0:0 with SMTP id s9csp1360294wrn; Sat, 4 Feb 2023 05:58:30 -0800 (PST) X-Google-Smtp-Source: AK7set/fbPwWjSpQJZgZ5IFlpWZWYNSgSD+3nuXtnthJrgDcKQljFOMQCz4BMTotx3Niny3sf/e8 X-Received: by 2002:a17:906:3f92:b0:88f:7d3b:b90 with SMTP id b18-20020a1709063f9200b0088f7d3b0b90mr8354483ejj.42.1675519110676; Sat, 04 Feb 2023 05:58:30 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1675519110; cv=none; d=google.com; s=arc-20160816; b=l93g3hoqECT0zXK63uSifF01d+EOo4YSUxIURjh2RzQgg0ZE8BUveQSJiITkrOj+S3 lVOo8S8TnMO5CxeV0PG13LdJe9vRS1YCOUZ81I4/VXuY9TPQB8eiv1c0VOhMC6fSitwm Rt82HpaMRBAW4ROaFIm8QAELuzQkoEPWlY6Bv56IPaX+BuvVPWCqy0DHCd+Jvv9DNI2E 9n5ZbDmH2Hw2o3jANEsZkDIbGk1MMBSxf9HazfJ2pRH8WnpXiVUarxEnYFvLA/ALTv/s bvpIJJCZ8ifoXZ1q9ooWK3vUCQCA99D5qppizfMnd2cNWmxRVKhV7oJc6DlBOLjANjOG +5EQ== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:content-transfer-encoding:mime-version :references:in-reply-to:message-id:date:subject:cc:to:from :dkim-signature; bh=I7aOuN0Z7cOy5dqAaUiuywFRmsjtA1MOUQCg+0SjNXU=; b=u5RXUoeXt5f8LcZcZt/aJUpej/JWr/HFuVcZ5C/Ko5xGLIipJiY9S6YPtpFzTBMrYe PR/bShQ0U8RzIeNgI2F1tHCGV44GeknNuWVlfag0ZzIpdGO7VXXnaeSHWQaAbNCBrSrt 7recwVTsKGub/2cSwu4ec0veNT7qpcJsoZnHltiPSL7akXuNUK9HtwY2tTmVy8lbYOKp wyvjnkKAzFE1cBrxbUA+sucldEu/NR5KbehJgRj1aFnAWYai7jrMb8dKqKf04PPt7aPD nsCduruJVUyhSSi1sB2ZA/SCwe/gN7L7s6ZMb20fP8fFZdMx2ENYK+zzSiP+g2sR9IFn 97pw== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@gmail.com header.s=20210112 header.b=hQQzKyaW; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=QUARANTINE dis=NONE) header.from=gmail.com Received: from out1.vger.email (out1.vger.email. [2620:137:e000::1:20]) by mx.google.com with ESMTP id fd19-20020a1709072a1300b0087bd78cd19csi5543469ejc.10.2023.02.04.05.58.07; Sat, 04 Feb 2023 05:58:30 -0800 (PST) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) client-ip=2620:137:e000::1:20; Authentication-Results: mx.google.com; dkim=pass header.i=@gmail.com header.s=20210112 header.b=hQQzKyaW; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=QUARANTINE dis=NONE) header.from=gmail.com Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S233098AbjBDNgx (ORCPT + 99 others); Sat, 4 Feb 2023 08:36:53 -0500 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:44414 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S233751AbjBDNgi (ORCPT ); Sat, 4 Feb 2023 08:36:38 -0500 Received: from mail-pj1-x1029.google.com (mail-pj1-x1029.google.com [IPv6:2607:f8b0:4864:20::1029]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id BC18619F1E; Sat, 4 Feb 2023 05:36:35 -0800 (PST) Received: by mail-pj1-x1029.google.com with SMTP id nm12-20020a17090b19cc00b0022c2155cc0bso7356217pjb.4; Sat, 04 Feb 2023 05:36:35 -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=I7aOuN0Z7cOy5dqAaUiuywFRmsjtA1MOUQCg+0SjNXU=; b=hQQzKyaWdvmDukB36qd0U5WCkp30kIycSrZRPaiYB6pruSWlSVqjbWe4IfTgeuB0yR utHtWsyC5FHYj7jhdKBwoJt7BJcbWiTGic0/xWP98GLBGRBUmJrzQzo/KYU9ov/g9x7z SLTd07Li+6rqmJAx/49QJH7roZibn/7/Wt+ZfNuTPScFP9Rv1IilK/PIPG030I+Uj/xt ZuOYv6p2oYQbemS0aDa1ua+ujhyIoUgMXaRhkM2aqtctNEEX87Su3XdzhhV/plrSKja+ k2QuO1K1OJfY+Rmy2lYd2MmOK9UB0vJ4LItB1FW0VW+t32TlgiRp63x4ucZQplmHA/Er eXIw== 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=I7aOuN0Z7cOy5dqAaUiuywFRmsjtA1MOUQCg+0SjNXU=; b=vwrzF7GdOdBFJJRrDFamJW77FAf4XpyKjfdMusdMcdsLNwbisjCTnZS14uyCC+LUr9 /gY+H+SijioAk1Fv71SpVHfNky/vFkB62JGAFT0sUNyoIdbm5sdo2I20LShn+QwgsbdR XquHGFmULtoxYq+y45lNHET8VrZbIzWUUDVHyMUJqYCI9no0jHnZ003K7GX5dEQFovK1 4wTI0B6A9LNYVn9esoAzYQgp4cXMQH0UjaUex5Yfk2y3J6M4KZl8hWu9mGsCNKvDFr5t NJ5fKDPUW5jO4t1DCARnJ9phjXk3/3BRv35saog348xHyZmkmYvwZBE5P71ceYp+LtcV KEKw== X-Gm-Message-State: AO0yUKWZP7hWqkuy1z4ZBRteNPSOpe19BLKba8Yz6lV7au8Lm4tnXYJa acNx1STOL1Jb3DfKg6H6qQE= X-Received: by 2002:a17:902:c792:b0:198:f13d:14d4 with SMTP id w18-20020a170902c79200b00198f13d14d4mr2096692pla.55.1675517795162; Sat, 04 Feb 2023 05:36:35 -0800 (PST) Received: from KERNELXING-MB0.tencent.com ([114.253.32.172]) by smtp.gmail.com with ESMTPSA id 21-20020a170902c25500b0019605a51d50sm3463575plg.61.2023.02.04.05.36.30 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Sat, 04 Feb 2023 05:36:34 -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 v3 1/3] ixgbe: allow to increase MTU to 3K with XDP enabled Date: Sat, 4 Feb 2023 21:35:33 +0800 Message-Id: <20230204133535.99921-2-kerneljasonxing@gmail.com> X-Mailer: git-send-email 2.33.0 In-Reply-To: <20230204133535.99921-1-kerneljasonxing@gmail.com> References: <20230204133535.99921-1-kerneljasonxing@gmail.com> MIME-Version: 1.0 X-Spam-Status: No, score=-2.1 required=5.0 tests=BAYES_00,DKIM_SIGNED, DKIM_VALID,DKIM_VALID_AU,DKIM_VALID_EF,FREEMAIL_FROM, RCVD_IN_DNSWL_NONE,SPF_HELO_NONE,SPF_PASS autolearn=ham autolearn_force=no version=3.4.6 X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on lindbergh.monkeyblade.net Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org X-getmail-retrieved-from-mailbox: =?utf-8?q?INBOX?= X-GMAIL-THRID: =?utf-8?q?1756909127072107283?= X-GMAIL-MSGID: =?utf-8?q?1756909127072107283?= 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 --- 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..2c1b6eb60436 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 Sat Feb 4 13:35:34 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Jason Xing X-Patchwork-Id: 52780 Return-Path: Delivered-To: ouuuleilei@gmail.com Received: by 2002:adf:eb09:0:0:0:0:0 with SMTP id s9csp1359898wrn; Sat, 4 Feb 2023 05:57:05 -0800 (PST) X-Google-Smtp-Source: AK7set/KRIl3vXIgEKmeziRooU5TbCEaSBsFBW5yQuytJOoxTAtF3QZ9a8S1WUhYCS4DYQV9NcZ8 X-Received: by 2002:a17:907:9d08:b0:870:58ae:842e with SMTP id kt8-20020a1709079d0800b0087058ae842emr16016297ejc.24.1675519025010; Sat, 04 Feb 2023 05:57:05 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1675519024; cv=none; d=google.com; s=arc-20160816; b=Ou2+WI5RsZZ8fu25hmfdh4ThMwZDFtX8Z6bX1t0n6KngSxG3vREWWs7spfuB2Ibona neF94VQQC1lUPDUmGNUHfD7FQcp5FJmH9w7gI6gg/mNaKzzi8CE9PZMYh1+Ij+tZBK16 w2qM3hXKval+223OFat5szovbr+6ytWcG5zwau3WKWZNuHZOtGodw0RQHU9LkLZdgBr0 vsJmjGmiI+1p+oYvXIR2BgtXNH0G8LJnlxzMhh3DKAB824s8c4WzEpiZisnKMjL3w7Wf 0n5dzZoDTU/n+A3vi0Q0UDOA+4GdCprbJE/I/pVYSMC0LD9JEdRsyUNGCSS9XY2VG/Eb LnOg== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:content-transfer-encoding:mime-version :references:in-reply-to:message-id:date:subject:cc:to:from :dkim-signature; bh=lV+jIwfpIfjlKMz7MBn8qE6oOOJOfnotd/kmF+jUhhM=; b=As6D9wUxbUG7VeKZ27jmlFCAZ+qoxn4ZasnQ1J7gnleyxLwPCVRmJhIPuNlFvh21er hQlEUKjd0yNFEVGSxpvgMo9C+YCScrPbWFhfkXWjp11UwvlPEaIeyy6VDyr3/nIWyi82 +xLVZeX1T3aiNx7MR/NlBYvWvHLU3b0adO49G6j0CBzH0EPosXfSMiYzPa4PDgr/RG2p Xvl7qYjGjWS+UvfXVcT+V1ujyrUDjH83YbYKaABxeUGT174X7qRnPhAOnIidysWd6jZ9 03i3XNx5UqxG3MWS8XfOW9YiHy+d+AwCOjE+twgkO+YeyIB/oVHSEvr/LP+9Eke1Rxq2 TpJw== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@gmail.com header.s=20210112 header.b=YMsRv2Wz; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=QUARANTINE dis=NONE) header.from=gmail.com Received: from out1.vger.email (out1.vger.email. [2620:137:e000::1:20]) by mx.google.com with ESMTP id gh16-20020a1709073c1000b00886de65e971si6040961ejc.698.2023.02.04.05.56.41; Sat, 04 Feb 2023 05:57:04 -0800 (PST) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) client-ip=2620:137:e000::1:20; Authentication-Results: mx.google.com; dkim=pass header.i=@gmail.com header.s=20210112 header.b=YMsRv2Wz; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=QUARANTINE dis=NONE) header.from=gmail.com Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S233798AbjBDNhG (ORCPT + 99 others); Sat, 4 Feb 2023 08:37:06 -0500 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:44782 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S233805AbjBDNgv (ORCPT ); Sat, 4 Feb 2023 08:36:51 -0500 Received: from mail-pl1-x62f.google.com (mail-pl1-x62f.google.com [IPv6:2607:f8b0:4864:20::62f]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 1A99DE07C; Sat, 4 Feb 2023 05:36:45 -0800 (PST) Received: by mail-pl1-x62f.google.com with SMTP id m2so7898624plg.4; Sat, 04 Feb 2023 05:36:45 -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=lV+jIwfpIfjlKMz7MBn8qE6oOOJOfnotd/kmF+jUhhM=; b=YMsRv2WzJABVcHWfB8CthUOP1a1+ON3dEke2uXaOnLUc5PxwEBjlYxxUOhUbMBv4/w MoIXr4LmyB0eW0YOrUDdpTz3uJIkcHcZCC33DA2Uc4y7YA4oGcJANHOjWGUi2x5y4LCf Qpdpgr0j1rufoSGJKF95bdhpEZA4Zc1GyZ+34QVVXG1uMllzmZiPmrBF449GeBU02JqY 1KsSq0OCVS+T0Cjhe/gVfgq2rKNYjbqk7uZDQJE4r9fqvsuPuO12NB945wFoNomj5gq3 9/056OPoMhJXdty2jtW0CEJeRPqBIzln/7Xejjk7Cm8zr2Pi1TURmlYe7/Sg+xwUEVpn 64Ag== 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=lV+jIwfpIfjlKMz7MBn8qE6oOOJOfnotd/kmF+jUhhM=; b=tSxn2o1DJ1f8IKnfinNLCS0T5yAJExLjvkF5CPDJ0mowDo4BD9gb5u9CTx5IU49WHU Df5uG9TwN7uQImYJg+OI0q+dilOV+z+QYKP/AJCATigZQIs8XADVEYN3MjX9wXKVUmuo dUurt4c5gnzBPbN2RN6lCaOVbnG3DA4secQGxh09hwOFygjrn1VgHXI0+Gm8DV2r4iOG nxR2LYIjmh448R0OKIzII9zJM6d4HILAyKn0MqTZSUiEhBTk2/Grs1mjhiN8XzNPt91G BH+aC7PVCQfoVZleAOpQRINZgYVlBwxhRtV3Nt+KGCC8jTOV7+xVCVUOtAAzw7gSXil3 2aaA== X-Gm-Message-State: AO0yUKXTu62Zb0rktEPE+Giq1lqpY1cAOfRDwcxFlCxBAGwegrBQ9Bw0 8JNZlOtVeAqySL58Su3frgIiAIYIa6KyNZwi X-Received: by 2002:a17:902:f243:b0:198:eaac:464a with SMTP id j3-20020a170902f24300b00198eaac464amr2858741plc.42.1675517804585; Sat, 04 Feb 2023 05:36:44 -0800 (PST) Received: from KERNELXING-MB0.tencent.com ([114.253.32.172]) by smtp.gmail.com with ESMTPSA id 21-20020a170902c25500b0019605a51d50sm3463575plg.61.2023.02.04.05.36.40 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Sat, 04 Feb 2023 05:36:44 -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 2/3] i40e: add double of VLAN header when computing the max MTU Date: Sat, 4 Feb 2023 21:35:34 +0800 Message-Id: <20230204133535.99921-3-kerneljasonxing@gmail.com> X-Mailer: git-send-email 2.33.0 In-Reply-To: <20230204133535.99921-1-kerneljasonxing@gmail.com> References: <20230204133535.99921-1-kerneljasonxing@gmail.com> MIME-Version: 1.0 X-Spam-Status: No, score=-2.1 required=5.0 tests=BAYES_00,DKIM_SIGNED, DKIM_VALID,DKIM_VALID_AU,DKIM_VALID_EF,FREEMAIL_FROM, RCVD_IN_DNSWL_NONE,SPF_HELO_NONE,SPF_PASS autolearn=ham autolearn_force=no version=3.4.6 X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on lindbergh.monkeyblade.net Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org X-getmail-retrieved-from-mailbox: =?utf-8?q?INBOX?= X-GMAIL-THRID: =?utf-8?q?1756909036818675503?= X-GMAIL-MSGID: =?utf-8?q?1756909036818675503?= 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 --- drivers/net/ethernet/intel/i40e/i40e.h | 2 ++ drivers/net/ethernet/intel/i40e/i40e_main.c | 2 +- 2 files changed, 3 insertions(+), 1 deletion(-) diff --git a/drivers/net/ethernet/intel/i40e/i40e.h b/drivers/net/ethernet/intel/i40e/i40e.h index 60e351665c70..e03853d3c706 100644 --- a/drivers/net/ethernet/intel/i40e/i40e.h +++ b/drivers/net/ethernet/intel/i40e/i40e.h @@ -107,6 +107,8 @@ #define I40E_BW_MBPS_DIVISOR 125000 /* rate / (1000000 / 8) Mbps */ #define I40E_MAX_BW_INACTIVE_ACCUM 4 /* accumulate 4 credits max */ +#define I40E_PACKET_HDR_PAD (ETH_HLEN + ETH_FCS_LEN + (VLAN_HLEN * 2)) + /* driver state flags */ enum i40e_state_t { __I40E_TESTING, 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; From patchwork Sat Feb 4 13:35:35 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Jason Xing X-Patchwork-Id: 52778 Return-Path: Delivered-To: ouuuleilei@gmail.com Received: by 2002:adf:eb09:0:0:0:0:0 with SMTP id s9csp1355518wrn; Sat, 4 Feb 2023 05:41:37 -0800 (PST) X-Google-Smtp-Source: AK7set/2dfari0WPY89HMF7CqQn3twD06pYkDmf+CGTbrCQK1j7DQWNFG8pEcB52ObmE7c/Yn3/4 X-Received: by 2002:a50:871b:0:b0:4aa:a504:3624 with SMTP id i27-20020a50871b000000b004aaa5043624mr153389edb.8.1675518097483; Sat, 04 Feb 2023 05:41:37 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1675518097; cv=none; d=google.com; s=arc-20160816; b=ww15RILKWBjF1TOBZp/ttZc4uExy4W8xEQ5EMEdInVNu4XPjcI5C6mMCH3w11BReN/ 1uOAMjak4hoxmV4et8NnNyhqBE9RTkqjyJ2mxL9+/AwuzytkyyC8sDvWNpRD2AkFjBc/ RJJI/9wXWXlWzFB/Po22YH5+pv5GmR296b+qlE/2hCNZKqdpdBh+qOZwDTENVVgy8WsA Zxk0bOpm0hjEERKijdZ+vSJ/diYTls2700S19mUUoRz7JYF+qLbgzeSQDjc6ueRZ8jJf Y45Ru+Yus8ivTctvKKRVcmIY/BSfAghyDmdywWWtYU2po8aiuEdBtLhW1eOQy0oD/w0I qJMQ== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:content-transfer-encoding:mime-version :references:in-reply-to:message-id:date:subject:cc:to:from :dkim-signature; bh=MWIPEpOQO7SVE2HbqMg/0fsvjNdObXiPOV4KlQDmpz8=; b=AFiX1u9Yd/9CmeqOHZq+fFe6mNndDTHOS7SIPwCd65zBfap/Lwj///gYWY3rVvtatb HRoPVKXVwri8qXvA3sQ2VKMgo1fZ/PIfOj6eSJOvHq8h8q8RF21Qzcjqc1VNcYtjqmNr E3IZuCQvovqyNFAxtahLQI2yoB5tMcSZVYzY4CKr7X1TPJewkRzrMTTgj2/TlX4VPMm7 E5Gu3jnRN98/7dN6R51bAqm5deLDRqXME58F+d5JcqHazBYkgaRyLYbF0msAc4/ZwbTN I1xTg3ASLiUs8GTkD1KrGFADEZcjtmZ6OxpjpE1pKoYM/Wnw9p1REiE07+CK/tuYTCNB fjrA== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@gmail.com header.s=20210112 header.b=I6V6IuAT; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=QUARANTINE dis=NONE) header.from=gmail.com Received: from out1.vger.email (out1.vger.email. [2620:137:e000::1:20]) by mx.google.com with ESMTP id ez18-20020a056402451200b004a0ab10b040si5586957edb.448.2023.02.04.05.41.10; Sat, 04 Feb 2023 05:41:37 -0800 (PST) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) client-ip=2620:137:e000::1:20; Authentication-Results: mx.google.com; dkim=pass header.i=@gmail.com header.s=20210112 header.b=I6V6IuAT; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=QUARANTINE dis=NONE) header.from=gmail.com Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S233836AbjBDNhP (ORCPT + 99 others); Sat, 4 Feb 2023 08:37:15 -0500 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:44808 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S233852AbjBDNgw (ORCPT ); Sat, 4 Feb 2023 08:36:52 -0500 Received: from mail-pj1-x102a.google.com (mail-pj1-x102a.google.com [IPv6:2607:f8b0:4864:20::102a]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 72F832125; Sat, 4 Feb 2023 05:36:51 -0800 (PST) Received: by mail-pj1-x102a.google.com with SMTP id v6-20020a17090ad58600b00229eec90a7fso10084125pju.0; Sat, 04 Feb 2023 05:36:51 -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=MWIPEpOQO7SVE2HbqMg/0fsvjNdObXiPOV4KlQDmpz8=; b=I6V6IuATguSQYK8Wpo+KJN/1xC0HuTYd+ZzuFWLnuV4E8BhVjKMaY9wDcMReQvVdPx KSmHl8UvkMvGKdbIBk60XhlHnBhyQivq0OANQaqUxAyXP5ISENVQvyivxC1oizmqtH3Z gJytAN5CWmQmZdJ6Soi74HDr7Blu6EzpYJnSRhNHIaFAZkDCOAE8vyAo1q7ncKpRlmoy PMNZffCmFzrGYLbY+BMcQstNoEo4glmuj9taR1FcpM+KPVw95CNn7zEPW76v+yFGJsK/ 6izCjdalZtSlwYUDd3PEpo++wcNqN4oO/GEzcma4qmtU68jzRF6axeRZqjEKTvCBL19P 3JVg== 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=MWIPEpOQO7SVE2HbqMg/0fsvjNdObXiPOV4KlQDmpz8=; b=LLzmnrEP4CCS2VBfT8El5oDQB2yrxggWaPhcu5lghas2zVFLNlijwL9dQ8DZ3Beb0w s52C8sjoJxUbkSIEnruK0hDG5Q8WlWkU6CGsB+Wo1e/Wztpq57eoXCr+58MiQ5GI0MeU 99ues0e6R0QYNFugKb8DrFlmnALcUtAkdz8UaaAlXeyBbiHuLwVmYbdBI54HKSoB9Zk+ yUWzZ5BNRYPkOVocYoGpPt0ewgYwb9wCm4nRduigG639H7SQytV7sK0h6Rh0NO4XzJPX 2MDfr5Kbisj9+m3Ig2QpAf2jPSnPBmNXpJP6p7KUaDwRxjFlWrsrP5AvwxrmK58vvRSO K6NA== X-Gm-Message-State: AO0yUKUiWtBDR0sKaZnlfBwq07g+ZHdzyfmnbdsE9wpV2J9T6K0+6j05 T5IRvu4+BcSAPIlfHWLZYLc= X-Received: by 2002:a17:902:dcc5:b0:199:29:4d54 with SMTP id t5-20020a170902dcc500b0019900294d54mr165161pll.59.1675517810989; Sat, 04 Feb 2023 05:36:50 -0800 (PST) Received: from KERNELXING-MB0.tencent.com ([114.253.32.172]) by smtp.gmail.com with ESMTPSA id 21-20020a170902c25500b0019605a51d50sm3463575plg.61.2023.02.04.05.36.46 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Sat, 04 Feb 2023 05:36:50 -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 3/3] ixgbe: add double of VLAN header when computing the max MTU Date: Sat, 4 Feb 2023 21:35:35 +0800 Message-Id: <20230204133535.99921-4-kerneljasonxing@gmail.com> X-Mailer: git-send-email 2.33.0 In-Reply-To: <20230204133535.99921-1-kerneljasonxing@gmail.com> References: <20230204133535.99921-1-kerneljasonxing@gmail.com> MIME-Version: 1.0 X-Spam-Status: No, score=-2.1 required=5.0 tests=BAYES_00,DKIM_SIGNED, DKIM_VALID,DKIM_VALID_AU,DKIM_VALID_EF,FREEMAIL_FROM, RCVD_IN_DNSWL_NONE,SPF_HELO_NONE,SPF_PASS autolearn=ham autolearn_force=no version=3.4.6 X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on lindbergh.monkeyblade.net Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org X-getmail-retrieved-from-mailbox: =?utf-8?q?INBOX?= X-GMAIL-THRID: =?utf-8?q?1756908064527065793?= X-GMAIL-MSGID: =?utf-8?q?1756908064527065793?= From: Jason Xing Include the second VLAN HLEN into account when computing the maximum MTU size as other drivers do. Fixes: fabf1bce103a ("ixgbe: Prevent unsupported configurations with XDP") Signed-off-by: Jason Xing Reviewed-by: Alexander Duyck --- drivers/net/ethernet/intel/ixgbe/ixgbe.h | 2 ++ drivers/net/ethernet/intel/ixgbe/ixgbe_main.c | 3 +-- 2 files changed, 3 insertions(+), 2 deletions(-) diff --git a/drivers/net/ethernet/intel/ixgbe/ixgbe.h b/drivers/net/ethernet/intel/ixgbe/ixgbe.h index bc68b8f2176d..8736ca4b2628 100644 --- a/drivers/net/ethernet/intel/ixgbe/ixgbe.h +++ b/drivers/net/ethernet/intel/ixgbe/ixgbe.h @@ -73,6 +73,8 @@ #define IXGBE_RXBUFFER_4K 4096 #define IXGBE_MAX_RXBUFFER 16384 /* largest size for a single descriptor */ +#define IXGBE_PKT_HDR_PAD (ETH_HLEN + ETH_FCS_LEN + (VLAN_HLEN * 2)) + /* Attempt to maximize the headroom available for incoming frames. We * use a 2K buffer for receives and need 1536/1534 to store the data for * the frame. This leaves us with 512 bytes of room. From that we need diff --git a/drivers/net/ethernet/intel/ixgbe/ixgbe_main.c b/drivers/net/ethernet/intel/ixgbe/ixgbe_main.c index 2c1b6eb60436..149f7baf40fe 100644 --- a/drivers/net/ethernet/intel/ixgbe/ixgbe_main.c +++ b/drivers/net/ethernet/intel/ixgbe/ixgbe_main.c @@ -6801,8 +6801,7 @@ static int ixgbe_change_mtu(struct net_device *netdev, int new_mtu) struct ixgbe_adapter *adapter = netdev_priv(netdev); if (ixgbe_enabled_xdp_adapter(adapter)) { - int new_frame_size = new_mtu + ETH_HLEN + ETH_FCS_LEN + - VLAN_HLEN; + int new_frame_size = new_mtu + IXGBE_PKT_HDR_PAD; if (new_frame_size > ixgbe_max_xdp_frame_size(adapter)) { e_warn(probe, "Requested MTU size is not supported with XDP\n");