From patchwork Sat Jan 21 08:55:21 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Jason Xing X-Patchwork-Id: 46788 Return-Path: Delivered-To: ouuuleilei@gmail.com Received: by 2002:adf:eb09:0:0:0:0:0 with SMTP id s9csp641481wrn; Sat, 21 Jan 2023 01:14:57 -0800 (PST) X-Google-Smtp-Source: AMrXdXtwBiVPHN+NClaNE7HUGxcfrXWaCaibEYQZjPk3rfPnB+Yukhe9waMz/UMcLdfOX6vZFtr4 X-Received: by 2002:a17:902:cf11:b0:185:441e:2d7a with SMTP id i17-20020a170902cf1100b00185441e2d7amr17333925plg.17.1674292497556; Sat, 21 Jan 2023 01:14:57 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1674292497; cv=none; d=google.com; s=arc-20160816; b=qxj2KY9VpO5rhh5ac75B6bs00pk1BHX0CKu6Z/OQZU1yUPr/q9nWw4NHJ6ugwnLMZP b/z5L9k6KSj6cUx9W+ytW6AtaQj4ma2XrqrynRpkF0Yu21xqpi7p2MkK1iCb90YKsEbY 8y3m3aS0GBpuS0LPNmT66e+jAJW2jjfN970Px6n8kYUYr4q04vvnpD+9nzUJe7nw5rZ7 5LrOKCntu6WdjVIh6YwmSSVVAC2fbzMy0pq/O5pee9864Qe+66j9epeTwZEbP+FFwOCz cz0W/0TuPmpNTvWy0kYXDbBVZ4mNHNcCs6PcnV6csKijL9aMPULop1NF1ZscdSX0cVN9 hI0Q== 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=PrnGpbTnMcSAdRfQebkBMLK0G9v/WsMM46OOzL4dzDA=; b=O+3iNC1lKsrqzuELGBsJdTD0o0ZYS3yWINviWG10Xo0gjm3cWHtMPOggSpUEeaLZh+ uMsEjWTyiylgmzWkB5wrQME299Se5o3/OCMb2Im88uSmqXIUuhQjLntykJkkQxJpbZRw Mu2kH+9aIh2j1wYiwwSKcQrufZvzkTTPfvSu3u5r8kzg1jiyyrPbQguF351vVQfGLiJ+ 7zFLhQj4rM3GRVyjuWHzcm025UxAF0FcE2wCqyl4cmvRvAEeeg89mIF7+pFHVk2V4Mzz YyF8AIyg0ZSC+2I4ysqYRP4hLzfuIcCZSlZ8uONbHFSiRkbv6+Anhf+RnjE2NJzgDbkV 1aag== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@gmail.com header.s=20210112 header.b=SDgmsuHE; 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 b4-20020a170902d50400b001928641c19fsi47769079plg.286.2023.01.21.01.14.41; Sat, 21 Jan 2023 01:14:57 -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=SDgmsuHE; 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 S229789AbjAUIzc (ORCPT + 99 others); Sat, 21 Jan 2023 03:55:32 -0500 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:39720 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S229735AbjAUIza (ORCPT ); Sat, 21 Jan 2023 03:55:30 -0500 Received: from mail-pg1-x532.google.com (mail-pg1-x532.google.com [IPv6:2607:f8b0:4864:20::532]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 8AD4965F00; Sat, 21 Jan 2023 00:55:29 -0800 (PST) Received: by mail-pg1-x532.google.com with SMTP id g68so5776958pgc.11; Sat, 21 Jan 2023 00:55:29 -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=PrnGpbTnMcSAdRfQebkBMLK0G9v/WsMM46OOzL4dzDA=; b=SDgmsuHEoebuFkYmBvrFkLKy8cp1wMRSw6dwPIcLHUVNjujn6pQvfS04Kd66UAr6jg gQHORYgc8k4DFh4N1th30dsYb4lEeIXxHlYylXeF+eWgTRB/YGd/LxJpoWSQQ48ftFmL WTlEIypkkTJgri1WauSjeLaTDPWocpJuCA/8x2lZ/VrUV9ireiy2Jba9WmKZxGWT3tYV X//7ZskP9FB8Vg8q68Axf0WsNxQzFpc/5ZLcVbVF4PeO0pACd5KaM1kPK364Sfg9HT3n cehY8/32fDbNBVNwZhkW9AKZLGNMEHTLnnXnsocO13r5AWLSKm4wU4B3EYK4YHbnTLpy o3uw== 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=PrnGpbTnMcSAdRfQebkBMLK0G9v/WsMM46OOzL4dzDA=; b=FGCAq+A/9G2nsSQTcXfzastImQFkALWLunpvV0y3leeabIpughZdcf8JmrJbBGRobP 2sk2dH7o8wDVTPMlJ6lQdxpPJE0dDs6vjlfYuIbQPEQIyINnd3K4SC+HdU7onkUyQ+xE Ycwxe5rmWrZhnvDi4o7ThY8r7ZRClXfladTwZdez7n1SB0vzaGl3Hb+i8AreuS26ddOp jr/H+0nbzEx4NkcHBSN/70nmpnD+Lenan+aVcvntsBiREIoFC8Mk8awJLqJsCeCQrFOk YzJPZiaetNvsfNmGuzo0HmWjDfRkWMgu9rjvx/pTumwmMDbMhCJopjSA9JxVuJOxjoJn GvzQ== X-Gm-Message-State: AFqh2kqPA8tfogde2FLOv3B06GdRNYNz3dLYIigT/pHX2AneI6clV5ic juiE3JBR0t/8JE9eg6c/nok= X-Received: by 2002:a62:148d:0:b0:58b:ca43:9c05 with SMTP id 135-20020a62148d000000b0058bca439c05mr16399291pfu.16.1674291328948; Sat, 21 Jan 2023 00:55:28 -0800 (PST) Received: from KERNELXING-MB0.tencent.com ([114.253.32.172]) by smtp.gmail.com with ESMTPSA id z4-20020aa79484000000b005823b7da05asm11927073pfk.122.2023.01.21.00.55.24 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Sat, 21 Jan 2023 00:55:28 -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.co 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] ixgbe: allow to increase MTU to some extent with XDP enalbed Date: Sat, 21 Jan 2023 16:55:21 +0800 Message-Id: <20230121085521.9566-1-kerneljasonxing@gmail.com> X-Mailer: git-send-email 2.33.0 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?1755622929945738302?= X-GMAIL-MSGID: =?utf-8?q?1755622929945738302?= From: Jason Xing I encountered one case where I cannot increase the MTU size with XDP enabled if the server is equipped with IXGBE card, which happened on thousands of servers. I noticed it was prohibited from 2017[1] and added size checks[2] if allowed soon after the previous patch. Interesting part goes like this: 1) Changing MTU directly from 1500 (default value) to 2000 doesn't work because the driver finds out that 'new_frame_size > ixgbe_rx_bufsz(ring)' in ixgbe_change_mtu() function. 2) However, if we change MTU to 1501 then change from 1501 to 2000, it does work, because the driver sets __IXGBE_RX_3K_BUFFER when MTU size is converted to 1501, which later size check policy allows. The default MTU value for most servers is 1500 which cannot be adjusted directly to the value larger than IXGBE_MAX_2K_FRAME_BUILD_SKB (1534 or 1536) if it loads XDP. After I do a quick study on the manner of i40E driver allowing two kinds of buffer size (one is 2048 while another is 3072) to support XDP mode in i40e_max_xdp_frame_size(), I believe the default MTU size is possibly not satisfied in XDP mode when IXGBE driver is in use, we sometimes need to insert a new header, say, vxlan header. So setting the 3K-buffer flag could solve the issue. [1] commit 38b7e7f8ae82 ("ixgbe: Do not allow LRO or MTU change with XDP") [2] commit fabf1bce103a ("ixgbe: Prevent unsupported configurations with XDP") Signed-off-by: Jason Xing --- drivers/net/ethernet/intel/ixgbe/ixgbe_main.c | 3 +++ 1 file changed, 3 insertions(+) diff --git a/drivers/net/ethernet/intel/ixgbe/ixgbe_main.c b/drivers/net/ethernet/intel/ixgbe/ixgbe_main.c index ab8370c413f3..dc016582f91e 100644 --- a/drivers/net/ethernet/intel/ixgbe/ixgbe_main.c +++ b/drivers/net/ethernet/intel/ixgbe/ixgbe_main.c @@ -4313,6 +4313,9 @@ static void ixgbe_set_rx_buffer_len(struct ixgbe_adapter *adapter) if (IXGBE_2K_TOO_SMALL_WITH_PADDING || (max_frame > (ETH_FRAME_LEN + ETH_FCS_LEN))) set_bit(__IXGBE_RX_3K_BUFFER, &rx_ring->state); + + if (ixgbe_enabled_xdp_adapter(adapter)) + set_bit(__IXGBE_RX_3K_BUFFER, &rx_ring->state); #endif } }