Message ID | 20230127122018.2839-1-kerneljasonxing@gmail.com |
---|---|
State | New |
Headers |
Return-Path: <linux-kernel-owner@vger.kernel.org> Delivered-To: ouuuleilei@gmail.com Received: by 2002:adf:eb09:0:0:0:0:0 with SMTP id s9csp809039wrn; Fri, 27 Jan 2023 04:35:34 -0800 (PST) X-Google-Smtp-Source: AMrXdXtDROvXXvMxMqgfSqFp64vWAy6GvxTgnhzFlZ4yQSMT8YbWhjY4xpmIaooSYXuXlLNSyWqb X-Received: by 2002:a17:903:1210:b0:195:e86b:948b with SMTP id l16-20020a170903121000b00195e86b948bmr34542002plh.50.1674822934700; Fri, 27 Jan 2023 04:35:34 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1674822934; cv=none; d=google.com; s=arc-20160816; b=OPFX2diUWRsMraBMf62gwmyzo24aEzsr3RwAieTlqARPrNiyjytdfscCVTHPvExhDu CbANPfrlNzAiabAAiaa1wwAHcNMJ0PRod2KlMCjo9pyGgx7H9LPFhHsyXre3Rp7Q0pYJ 3JwwnuQp5VFwiBoSJ8VhU1VoIB6Ln6jICBPJuZ+Z8b2ePgtWzfOJKV+7YIjJdw0eyTAD z1czS94BV7vRyDGkYw7ksdFO2QDWzu8Pc7BnVBgmVH8g7RB4eX0B6fpUpHRlf9xhbjcv qHW95fSydLEE4UU9c12R4tXRTfBWPAzTbn30UT+24K3SbN3683GAcogNDvRry/pWAltg 0EGQ== 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 :message-id:date:subject:cc:to:from:dkim-signature; bh=LLT1Nv3FsKGMyXLmpa+ThlcdDGK8ls8MWUnHvX54ufk=; b=egfhTJ2ZZs+hHoGvmme6JEQU3X2YTfXA3D3PpHupVBySne1/RfeO5LRYkJscrDD0Nn Tqr2MFAP6B28sz5CNpp3IW9FMcgNlqF0vAEsn/tYuu4/wcpn1mM0+j1DGOoJ3NO2F2g3 ex64cC4rPfliQSIFoh1FwidMk0MzErOmK0wMf5RoCmWoDlBxOqS3lppycs8Jwth03wDx xiCXVRBMAK7poDyMnCmBfdJGb5k2AbW+13OvFwICGam9Ck+f++W/2VJW6jY2VDu6cgSb a0voEJzqI5POiRn5D3bLSnKiG8P/0Jm+FaRh3q6dY3o/9e8ti08ot07OOF+jGZ7vI1dA feDg== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@gmail.com header.s=20210112 header.b="H/A/5YZo"; 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 y19-20020a170902e19300b00194c47de270si4176589pla.379.2023.01.27.04.35.21; Fri, 27 Jan 2023 04:35:34 -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="H/A/5YZo"; 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 S233742AbjA0MXO (ORCPT <rfc822;lekhanya01809@gmail.com> + 99 others); Fri, 27 Jan 2023 07:23:14 -0500 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:56168 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S234240AbjA0MWu (ORCPT <rfc822;linux-kernel@vger.kernel.org>); Fri, 27 Jan 2023 07:22:50 -0500 Received: from mail-pj1-x1036.google.com (mail-pj1-x1036.google.com [IPv6:2607:f8b0:4864:20::1036]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 6B6F87F693; Fri, 27 Jan 2023 04:20:26 -0800 (PST) Received: by mail-pj1-x1036.google.com with SMTP id m7-20020a17090a71c700b0022c0c070f2eso7773240pjs.4; Fri, 27 Jan 2023 04:20:26 -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=LLT1Nv3FsKGMyXLmpa+ThlcdDGK8ls8MWUnHvX54ufk=; b=H/A/5YZowQIRbQhn7LrdJgM3fSXHE4dLbYV2js9dGcDWk3J5c6Zmz4NIWQskDigE17 bw9Q1PyqorE4xx5Hm5CvkH3r77hNYlZJnjKM4Ikv1TeqZuPFO2AL2lUe5HDKu+EaYs9R zCuz5dx81flK7bivAKOoWzkIvGmqKOKyzY6RfDJBJbe7aSm5ThV+ltB4lBVbEYr1R5yS 6jI+PLuoqnxrNk6oCd9yexwPIwZd16pMS8Xc4WOhZUgHhV5ipd41qAJCdLteUdHyaVPQ G6Kf3o2QamOfmnhp/ch5ZeQhIcqcQl7SfOLEvfkniZrIaBP+Kik48xH1jgplegwrE3LR fIpQ== 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=LLT1Nv3FsKGMyXLmpa+ThlcdDGK8ls8MWUnHvX54ufk=; b=X+r7cirXA93CWqiLQ5IJbNnLnvRd70l74ViNlwN9+tIXenv2DaA6DBIVUSHc7Bzb2I 6Fwg60zG+TBHEztBWiu3eyI577Jy+fV1FU9ZxCZcpl8RYxwIjCTOB+x3kUZPdJ0n1ytJ C2ulMq5EJmsxlE0863qdCstMYfUHUa8u1sK3Pn0DO96vr/dv1COJ6w9awxMXiJsVrrv/ VhR0/qJZMb6+XzwGppI1wlxYJrPpvZ21ZcAWGrvlJR3jMdhtjLrL1WNNhc9QKt7+7Cpt 45N36zDHgadseBtKJa/MG+rIqUsi9sbcoV8d20sCYt3c14DyvaS0FW82D3h4Etn/uiat hwCg== X-Gm-Message-State: AO0yUKWw89Co7FLh7+9mxKh8/hjM9W/G2DCXWZEXCieYWwl6yEjFATk7 pbnDBTYQ3FzN79Ud1bQHZ0k= X-Received: by 2002:a17:903:2444:b0:196:15f6:bafc with SMTP id l4-20020a170903244400b0019615f6bafcmr13847684pls.47.1674822025876; Fri, 27 Jan 2023 04:20:25 -0800 (PST) Received: from KERNELXING-MB0.tencent.com ([114.253.32.172]) by smtp.gmail.com with ESMTPSA id d18-20020a170903231200b0019339f3368asm2762942plh.3.2023.01.27.04.20.21 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Fri, 27 Jan 2023 04:20:25 -0800 (PST) From: Jason Xing <kerneljasonxing@gmail.com> 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 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 <kernelxing@tencent.com> Subject: [PATCH v2 net] ixgbe: allow to increase MTU to some extent with XDP enabled Date: Fri, 27 Jan 2023 20:20:18 +0800 Message-Id: <20230127122018.2839-1-kerneljasonxing@gmail.com> X-Mailer: git-send-email 2.33.0 MIME-Version: 1.0 Content-Transfer-Encoding: 8bit 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: <linux-kernel.vger.kernel.org> X-Mailing-List: linux-kernel@vger.kernel.org X-getmail-retrieved-from-mailbox: =?utf-8?q?INBOX?= X-GMAIL-THRID: =?utf-8?q?1756179133816025132?= X-GMAIL-MSGID: =?utf-8?q?1756179133816025132?= |
Series |
[v2,net] ixgbe: allow to increase MTU to some extent with XDP enabled
|
|
Commit Message
Jason Xing
Jan. 27, 2023, 12:20 p.m. UTC
From: Jason Xing <kernelxing@tencent.com> I encountered one case where I cannot increase the MTU size directly from 1500 to 2000 with XDP enabled if the server is equipped with IXGBE card, which happened on thousands of servers in production environment. This patch follows the behavior of changing MTU as i40e/ice does. Referrences: commit 23b44513c3e6f ("ice: allow 3k MTU for XDP") commit 0c8493d90b6bb ("i40e: add XDP support for pass and drop actions") Link: https://lore.kernel.org/lkml/20230121085521.9566-1-kerneljasonxing@gmail.com/ Signed-off-by: Jason Xing <kernelxing@tencent.com> --- 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(-)
Comments
My bad. It's not that right. Please ignore the v2 patch. I need some time to do more studies and tests on this part. Thanks, Jason On Fri, Jan 27, 2023 at 8:20 PM Jason Xing <kerneljasonxing@gmail.com> wrote: > > From: Jason Xing <kernelxing@tencent.com> > > I encountered one case where I cannot increase the MTU size directly > from 1500 to 2000 with XDP enabled if the server is equipped with > IXGBE card, which happened on thousands of servers in production > environment. > > This patch follows the behavior of changing MTU as i40e/ice does. > > Referrences: > commit 23b44513c3e6f ("ice: allow 3k MTU for XDP") > commit 0c8493d90b6bb ("i40e: add XDP support for pass and drop actions") > > Link: https://lore.kernel.org/lkml/20230121085521.9566-1-kerneljasonxing@gmail.com/ > Signed-off-by: Jason Xing <kernelxing@tencent.com> > --- > 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; > } > } > > -- > 2.37.3 >
On Fri, Jan 27, 2023 at 10:54 PM Jason Xing <kerneljasonxing@gmail.com> wrote: > > My bad. It's not that right. Please ignore the v2 patch. I need some > time to do more studies and tests on this part. > In the meantime, any suggestions and help are appreciated :) I'm still working on it. > Thanks, > Jason > > On Fri, Jan 27, 2023 at 8:20 PM Jason Xing <kerneljasonxing@gmail.com> wrote: > > > > From: Jason Xing <kernelxing@tencent.com> > > > > I encountered one case where I cannot increase the MTU size directly > > from 1500 to 2000 with XDP enabled if the server is equipped with > > IXGBE card, which happened on thousands of servers in production > > environment. > > > > This patch follows the behavior of changing MTU as i40e/ice does. > > > > Referrences: > > commit 23b44513c3e6f ("ice: allow 3k MTU for XDP") > > commit 0c8493d90b6bb ("i40e: add XDP support for pass and drop actions") > > > > Link: https://lore.kernel.org/lkml/20230121085521.9566-1-kerneljasonxing@gmail.com/ > > Signed-off-by: Jason Xing <kernelxing@tencent.com> > > --- > > 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; > > } > > } > > > > -- > > 2.37.3 > >
On Fri, Jan 27, 2023 at 11:08 PM Jason Xing <kerneljasonxing@gmail.com> wrote: > > On Fri, Jan 27, 2023 at 10:54 PM Jason Xing <kerneljasonxing@gmail.com> wrote: > > > > My bad. It's not that right. Please ignore the v2 patch. I need some > > time to do more studies and tests on this part. > > > > In the meantime, any suggestions and help are appreciated :) I'm still > working on it. > Dear maintainers, after several tests I did during this time as much as possible, I couldn't find anything wrong though I am not that familiar with the whole ixgbe code. I decided to 'reopen' this patch v2. Please help me review the current patch. Thanks, Jason > > > Thanks, > > Jason > > > > On Fri, Jan 27, 2023 at 8:20 PM Jason Xing <kerneljasonxing@gmail.com> wrote: > > > > > > From: Jason Xing <kernelxing@tencent.com> > > > > > > I encountered one case where I cannot increase the MTU size directly > > > from 1500 to 2000 with XDP enabled if the server is equipped with > > > IXGBE card, which happened on thousands of servers in production > > > environment. > > > > > > This patch follows the behavior of changing MTU as i40e/ice does. > > > > > > Referrences: > > > commit 23b44513c3e6f ("ice: allow 3k MTU for XDP") > > > commit 0c8493d90b6bb ("i40e: add XDP support for pass and drop actions") > > > > > > Link: https://lore.kernel.org/lkml/20230121085521.9566-1-kerneljasonxing@gmail.com/ > > > Signed-off-by: Jason Xing <kernelxing@tencent.com> > > > --- > > > 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; > > > } > > > } > > > > > > -- > > > 2.37.3 > > >
On Fri, Jan 27, 2023 at 08:20:18PM +0800, Jason Xing wrote: > From: Jason Xing <kernelxing@tencent.com> > > I encountered one case where I cannot increase the MTU size directly > from 1500 to 2000 with XDP enabled if the server is equipped with > IXGBE card, which happened on thousands of servers in production > environment. You said in this thread that you've done several tests - what were they? Now that you're following logic from other drivers, have you tested 3k MTU against XDP? Because your commit msg still refer to 2k as your target. If 3k is fine then i would reflect that in the subject of the patch. > > This patch follows the behavior of changing MTU as i40e/ice does. > > Referrences: > commit 23b44513c3e6f ("ice: allow 3k MTU for XDP") > commit 0c8493d90b6bb ("i40e: add XDP support for pass and drop actions") > > Link: https://lore.kernel.org/lkml/20230121085521.9566-1-kerneljasonxing@gmail.com/ Why do you share a link to v1 here? You're also missing Fixes: tag, as you're targetting the net tree. > Signed-off-by: Jason Xing <kernelxing@tencent.com> > --- > 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; > } > } > > -- > 2.37.3 > > _______________________________________________ > Intel-wired-lan mailing list > Intel-wired-lan@osuosl.org > https://lists.osuosl.org/mailman/listinfo/intel-wired-lan
On Mon, Jan 30, 2023 at 11:09 PM Maciej Fijalkowski <maciej.fijalkowski@intel.com> wrote: > > On Fri, Jan 27, 2023 at 08:20:18PM +0800, Jason Xing wrote: > > From: Jason Xing <kernelxing@tencent.com> > > > > I encountered one case where I cannot increase the MTU size directly > > from 1500 to 2000 with XDP enabled if the server is equipped with > > IXGBE card, which happened on thousands of servers in production > > environment. > > You said in this thread that you've done several tests - what were they? Tests against XDP are running on the server side when MTU varies from 1500 to 3050 (not including ETH_HLEN, ETH_FCS_LEN and VLAN_HLEN) for a few days. I choose the iperf tool to test the maximum throughput and observe the behavior when the machines are under greater pressure. Also, I use netperf to send different size packets to the server side with different modes (TCP_RR/_STREAM) applied. > Now that you're following logic from other drivers, have you tested 3k MTU Sure, the maximum MTU size users could set is 3050 (which is 3072 - 14 - 4 - 4 in ixgbe_change_mtu() function). > against XDP? Because your commit msg still refer to 2k as your target. If > 3k is fine then i would reflect that in the subject of the patch. I will modify the title and body message both. > > > > > This patch follows the behavior of changing MTU as i40e/ice does. > > > > Referrences: > > commit 23b44513c3e6f ("ice: allow 3k MTU for XDP") > > commit 0c8493d90b6bb ("i40e: add XDP support for pass and drop actions") > > > > Link: https://lore.kernel.org/lkml/20230121085521.9566-1-kerneljasonxing@gmail.com/ > > Why do you share a link to v1 here? I originally intended to let maintainers trace the previous discussion. Well, I'm going to remove the link. > > You're also missing Fixes: tag, as you're targetting the net tree. > I'll do it in the v3 patch. Thanks, Jason > > Signed-off-by: Jason Xing <kernelxing@tencent.com> > > --- > > 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; > > } > > } > > > > -- > > 2.37.3 > > > > _______________________________________________ > > Intel-wired-lan mailing list > > Intel-wired-lan@osuosl.org > > https://lists.osuosl.org/mailman/listinfo/intel-wired-lan
From: Jason Xing <kerneljasonxing@gmail.com> Date: Tue, 31 Jan 2023 11:00:05 +0800 > On Mon, Jan 30, 2023 at 11:09 PM Maciej Fijalkowski > <maciej.fijalkowski@intel.com> wrote: >> >> On Fri, Jan 27, 2023 at 08:20:18PM +0800, Jason Xing wrote: >>> From: Jason Xing <kernelxing@tencent.com> >>> >>> I encountered one case where I cannot increase the MTU size directly >>> from 1500 to 2000 with XDP enabled if the server is equipped with >>> IXGBE card, which happened on thousands of servers in production >>> environment. >> > >> You said in this thread that you've done several tests - what were they? > > Tests against XDP are running on the server side when MTU varies from > 1500 to 3050 (not including ETH_HLEN, ETH_FCS_LEN and VLAN_HLEN) for a BTW, if ixgbe allows you to set MTU of 3050, it needs to be fixed. Intel drivers at some point didn't include the second VLAN tag into account, thus it was possible to trigger issues on Q-in-Q setups. AICS, not all of them were fixed. > few days. > I choose the iperf tool to test the maximum throughput and observe the > behavior when the machines are under greater pressure. Also, I use > netperf to send different size packets to the server side with > different modes (TCP_RR/_STREAM) applied. [...] Thanks, Olek
On Tue, Jan 31, 2023 at 7:08 PM Alexander Lobakin <alexandr.lobakin@intel.com> wrote: > > From: Jason Xing <kerneljasonxing@gmail.com> > Date: Tue, 31 Jan 2023 11:00:05 +0800 > > > On Mon, Jan 30, 2023 at 11:09 PM Maciej Fijalkowski > > <maciej.fijalkowski@intel.com> wrote: > >> > >> On Fri, Jan 27, 2023 at 08:20:18PM +0800, Jason Xing wrote: > >>> From: Jason Xing <kernelxing@tencent.com> > >>> > >>> I encountered one case where I cannot increase the MTU size directly > >>> from 1500 to 2000 with XDP enabled if the server is equipped with > >>> IXGBE card, which happened on thousands of servers in production > >>> environment. > >> > > > >> You said in this thread that you've done several tests - what were they? > > > > Tests against XDP are running on the server side when MTU varies from > > 1500 to 3050 (not including ETH_HLEN, ETH_FCS_LEN and VLAN_HLEN) for a > > BTW, if ixgbe allows you to set MTU of 3050, it needs to be fixed. Intel > drivers at some point didn't include the second VLAN tag into account, Yes, I noticed that. It should be like "int new_frame_size = new_mtu + ETH_HLEN + ETH_FCS_LEN + (VLAN_HLEN * 2)" instead of only one VLAN_HLEN, which is used to compute real size in ixgbe_change_mtu() function. I'm wondering if I could submit another patch to fix the issue you mentioned because the current patch tells a different issue. Does it make sense? If you're available, please help me review the v3 patch I've already sent to the mailing-list. Thanks anyway. The Link is https://lore.kernel.org/lkml/20230131032357.34029-1-kerneljasonxing@gmail.com/ . Thanks, Jason > thus it was possible to trigger issues on Q-in-Q setups. AICS, not all > of them were fixed. > > > few days. > > I choose the iperf tool to test the maximum throughput and observe the > > behavior when the machines are under greater pressure. Also, I use > > netperf to send different size packets to the server side with > > different modes (TCP_RR/_STREAM) applied. > [...] > > Thanks, > Olek
From: Jason Xing <kerneljasonxing@gmail.com> Date: Tue, 31 Jan 2023 19:23:59 +0800 > On Tue, Jan 31, 2023 at 7:08 PM Alexander Lobakin > <alexandr.lobakin@intel.com> wrote: [...] >>>> You said in this thread that you've done several tests - what were they? >>> >>> Tests against XDP are running on the server side when MTU varies from >>> 1500 to 3050 (not including ETH_HLEN, ETH_FCS_LEN and VLAN_HLEN) for a >> > >> BTW, if ixgbe allows you to set MTU of 3050, it needs to be fixed. Intel >> drivers at some point didn't include the second VLAN tag into account, > > Yes, I noticed that. > > It should be like "int new_frame_size = new_mtu + ETH_HLEN + > ETH_FCS_LEN + (VLAN_HLEN * 2)" instead of only one VLAN_HLEN, which is > used to compute real size in ixgbe_change_mtu() function. > I'm wondering if I could submit another patch to fix the issue you > mentioned because the current patch tells a different issue. Does it > make sense? Yes, please send as a separate patch. It's somewhat related to the topic, but better to keep commits atomic. > > If you're available, please help me review the v3 patch I've already > sent to the mailing-list. Thanks anyway. > The Link is https://lore.kernel.org/lkml/20230131032357.34029-1-kerneljasonxing@gmail.com/ > . > > Thanks, > Jason Thanks, Olek
On Wed, Feb 1, 2023 at 7:15 PM Alexander Lobakin <alexandr.lobakin@intel.com> wrote: > > From: Jason Xing <kerneljasonxing@gmail.com> > Date: Tue, 31 Jan 2023 19:23:59 +0800 > > > On Tue, Jan 31, 2023 at 7:08 PM Alexander Lobakin > > <alexandr.lobakin@intel.com> wrote: > > [...] > > >>>> You said in this thread that you've done several tests - what were they? > >>> > >>> Tests against XDP are running on the server side when MTU varies from > >>> 1500 to 3050 (not including ETH_HLEN, ETH_FCS_LEN and VLAN_HLEN) for a > >> > > > >> BTW, if ixgbe allows you to set MTU of 3050, it needs to be fixed. Intel > >> drivers at some point didn't include the second VLAN tag into account, > > > > Yes, I noticed that. > > > > It should be like "int new_frame_size = new_mtu + ETH_HLEN + > > ETH_FCS_LEN + (VLAN_HLEN * 2)" instead of only one VLAN_HLEN, which is > > used to compute real size in ixgbe_change_mtu() function. > > I'm wondering if I could submit another patch to fix the issue you > > mentioned because the current patch tells a different issue. Does it > > make sense? > > Yes, please send as a separate patch. It's somewhat related to the > topic, but better to keep commits atomic. > Roger that, I will write another patch with your suggestions (labeled 'suggested-by your email address'). Thanks, Jason > > > > If you're available, please help me review the v3 patch I've already > > sent to the mailing-list. Thanks anyway. > > The Link is https://lore.kernel.org/lkml/20230131032357.34029-1-kerneljasonxing@gmail.com/ > > . > > > > Thanks, > > Jason > > Thanks, > Olek >
On Wed, Feb 1, 2023 at 7:15 PM Alexander Lobakin <alexandr.lobakin@intel.com> wrote: > > From: Jason Xing <kerneljasonxing@gmail.com> > Date: Tue, 31 Jan 2023 19:23:59 +0800 > > > On Tue, Jan 31, 2023 at 7:08 PM Alexander Lobakin > > <alexandr.lobakin@intel.com> wrote: > > [...] > > >>>> You said in this thread that you've done several tests - what were they? > >>> > >>> Tests against XDP are running on the server side when MTU varies from > >>> 1500 to 3050 (not including ETH_HLEN, ETH_FCS_LEN and VLAN_HLEN) for a > >> > > > >> BTW, if ixgbe allows you to set MTU of 3050, it needs to be fixed. Intel > >> drivers at some point didn't include the second VLAN tag into account, > > > > Yes, I noticed that. > > > > It should be like "int new_frame_size = new_mtu + ETH_HLEN + > > ETH_FCS_LEN + (VLAN_HLEN * 2)" instead of only one VLAN_HLEN, which is > > used to compute real size in ixgbe_change_mtu() function. > > I'm wondering if I could submit another patch to fix the issue you > > mentioned because the current patch tells a different issue. Does it > > make sense? > > Yes, please send as a separate patch. It's somewhat related to the > topic, but better to keep commits atomic. Hi Alexander, I'm not sure if I should wait for the current patch to get reviewed, then I'll write the vlan related patch we talked about based on the current patch? Thanks, Jason > > > > > If you're available, please help me review the v3 patch I've already > > sent to the mailing-list. Thanks anyway. > > The Link is https://lore.kernel.org/lkml/20230131032357.34029-1-kerneljasonxing@gmail.com/ > > . > > > > Thanks, > > Jason > > Thanks, > Olek >
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; } }