From patchwork Thu Feb 3 01:51:26 2022 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Eric Dumazet X-Patchwork-Id: 12733730 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 8D7FCC433F5 for ; Thu, 3 Feb 2022 01:51:54 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1348882AbiBCBvw (ORCPT ); Wed, 2 Feb 2022 20:51:52 -0500 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:58054 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1348879AbiBCBvu (ORCPT ); Wed, 2 Feb 2022 20:51:50 -0500 Received: from mail-pl1-x636.google.com (mail-pl1-x636.google.com [IPv6:2607:f8b0:4864:20::636]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 5CCFEC06173B for ; Wed, 2 Feb 2022 17:51:50 -0800 (PST) Received: by mail-pl1-x636.google.com with SMTP id c9so850944plg.11 for ; Wed, 02 Feb 2022 17:51:50 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20210112; h=from:to:cc:subject:date:message-id:in-reply-to:references :mime-version:content-transfer-encoding; bh=oV0fi9GS3SaAqPwzk0bWOCbVQRtAVmVJxhvUNTGK350=; b=TraCUdNXgqS4FenbPHwXuPODP2OaK5EUXj+M5iHp1dgk+uoM/NxU5ncgup4bYmbUbn /V7uPRVZrZ5C5/tkjo0g2NK2w9wnBu9r4zvN40dNDg2vmOrt0P7ubQskhfATKLB3UcmA XCs+truRlYSqLx1he+YFNWzCZPSydIOwcG5f9dplzM6SJNaxiZyR1LSj1ywhTkCi//3E FWSNVEpyxlEAoWqbjRYvUk1zobzrUQW+kcFo6//O0oJZEFn3E4zqT+zrKViDmnn18gJ0 KsZpdo1NFu7CJAD+fo3iuxSw/YoXNJ9NDiJML7V7g5HNfX/Nn9AUsLyPqw31shoXQ4mA ECMQ== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20210112; h=x-gm-message-state:from:to:cc:subject:date:message-id:in-reply-to :references:mime-version:content-transfer-encoding; bh=oV0fi9GS3SaAqPwzk0bWOCbVQRtAVmVJxhvUNTGK350=; b=ZzVDGhCOokLp3sRLS8c6eLWnJGDcG4HqCmKFdZyCNUXM6YxUZ78inwtsAHJvRHohZZ PgRzXQgccqG5lHUqKIKk+Xpty/Jvycgxg/YPT5V/I2XEVZdwvBZ2jeAVaq2aYU2RYBgq OQ4L5NTk5Lac1fmhfmOV3GvC5NGO/xBLUDzO+13PN7eUKgdC4l/mtHHoybuhUTml2NHM o949I6kU9mxTCL5BMl1NMwczH3v7jOxYhzq2Ca4lIUeEm0r6/eGtx5xgOoYgR+tv6CAj GuUQebQXTI4KCgPex+NgiKCJSa3zLfDHv/HQlz3zLB0j/tjcos+EbLX07qrPNpIP0fe3 A+3w== X-Gm-Message-State: AOAM531DnoO0Ismv+p/MqJtOIt8OL8qXo17JEitzprYRO5iLIeFG3Tmq SyuE+6n8lIcRZPQdPKmAUBw= X-Google-Smtp-Source: ABdhPJxlg2rLy8ujq+p5Z0oroPvLWs426IFsTCuBGABqPqY/zuexmhJtnFNbVdMOUNLWIzPkAP3e3w== X-Received: by 2002:a17:902:dac9:: with SMTP id q9mr33692603plx.5.1643853109896; Wed, 02 Feb 2022 17:51:49 -0800 (PST) Received: from edumazet1.svl.corp.google.com ([2620:15c:2c4:201:697a:fa00:b793:ed3a]) by smtp.gmail.com with ESMTPSA id qe16sm509611pjb.22.2022.02.02.17.51.49 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Wed, 02 Feb 2022 17:51:49 -0800 (PST) From: Eric Dumazet To: "David S . Miller" , Jakub Kicinski Cc: netdev , Eric Dumazet , Coco Li , Eric Dumazet Subject: [PATCH net-next 01/15] net: add netdev->tso_ipv6_max_size attribute Date: Wed, 2 Feb 2022 17:51:26 -0800 Message-Id: <20220203015140.3022854-2-eric.dumazet@gmail.com> X-Mailer: git-send-email 2.35.0.rc2.247.g8bbb082509-goog In-Reply-To: <20220203015140.3022854-1-eric.dumazet@gmail.com> References: <20220203015140.3022854-1-eric.dumazet@gmail.com> MIME-Version: 1.0 Precedence: bulk List-ID: X-Mailing-List: netdev@vger.kernel.org X-Patchwork-Delegate: kuba@kernel.org From: Eric Dumazet Some NIC (or virtual devices) are LSOv2 compatible. BIG TCP plans using the large LSOv2 feature for IPv6. New netlink attribute IFLA_TSO_IPV6_MAX_SIZE is defined. Drivers should use netif_set_tso_ipv6_max_size() to advertize their limit. Unchanged drivers are not allowing big TSO packets to be sent. Signed-off-by: Eric Dumazet --- include/linux/netdevice.h | 10 ++++++++++ include/uapi/linux/if_link.h | 1 + net/core/dev.c | 2 ++ net/core/rtnetlink.c | 3 +++ tools/include/uapi/linux/if_link.h | 1 + 5 files changed, 17 insertions(+) diff --git a/include/linux/netdevice.h b/include/linux/netdevice.h index e490b84732d1654bf067b30f2bb0b0825f88dea9..b1f68df2b37bc4b623f61cc2c6f0c02ba2afbe02 100644 --- a/include/linux/netdevice.h +++ b/include/linux/netdevice.h @@ -1948,6 +1948,7 @@ enum netdev_ml_priv_type { * @dev_addr_shadow: Copy of @dev_addr to catch direct writes. * @linkwatch_dev_tracker: refcount tracker used by linkwatch. * @watchdog_dev_tracker: refcount tracker used by watchdog. + * @tso_ipv6_max_size: Maximum size of IPv6 TSO packets (driver/NIC limit) * * FIXME: cleanup struct net_device such that network protocol info * moves out. @@ -2282,6 +2283,7 @@ struct net_device { u8 dev_addr_shadow[MAX_ADDR_LEN]; netdevice_tracker linkwatch_dev_tracker; netdevice_tracker watchdog_dev_tracker; + unsigned int tso_ipv6_max_size; }; #define to_net_dev(d) container_of(d, struct net_device, dev) @@ -4818,6 +4820,14 @@ static inline void netif_set_gro_max_size(struct net_device *dev, WRITE_ONCE(dev->gro_max_size, size); } +/* Used by drivers to give their hardware/firmware limit for LSOv2 packets */ +static inline void netif_set_tso_ipv6_max_size(struct net_device *dev, + unsigned int size) +{ + dev->tso_ipv6_max_size = size; +} + + static inline void skb_gso_error_unwind(struct sk_buff *skb, __be16 protocol, int pulled_hlen, u16 mac_offset, int mac_len) diff --git a/include/uapi/linux/if_link.h b/include/uapi/linux/if_link.h index 6218f93f5c1a92b5765bc19dfb9d7583c3b9369b..79b9d399cd297a1f79dca5ce89762800c38ed4a8 100644 --- a/include/uapi/linux/if_link.h +++ b/include/uapi/linux/if_link.h @@ -348,6 +348,7 @@ enum { IFLA_PARENT_DEV_NAME, IFLA_PARENT_DEV_BUS_NAME, IFLA_GRO_MAX_SIZE, + IFLA_TSO_IPV6_MAX_SIZE, __IFLA_MAX }; diff --git a/net/core/dev.c b/net/core/dev.c index 1baab07820f65f9bcf88a6d73e2c9ff741d33c18..b6ca3c348d41a097baf210f2a5d966b71308c69b 100644 --- a/net/core/dev.c +++ b/net/core/dev.c @@ -10188,6 +10188,8 @@ struct net_device *alloc_netdev_mqs(int sizeof_priv, const char *name, dev->gso_max_size = GSO_MAX_SIZE; dev->gso_max_segs = GSO_MAX_SEGS; dev->gro_max_size = GRO_MAX_SIZE; + dev->tso_ipv6_max_size = GSO_MAX_SIZE; + dev->upper_level = 1; dev->lower_level = 1; #ifdef CONFIG_LOCKDEP diff --git a/net/core/rtnetlink.c b/net/core/rtnetlink.c index e476403231f00053e1a261f31a8760325c75c941..4cefa07195ba3b67e7b724194b5d729d395ba466 100644 --- a/net/core/rtnetlink.c +++ b/net/core/rtnetlink.c @@ -1027,6 +1027,7 @@ static noinline size_t if_nlmsg_size(const struct net_device *dev, + nla_total_size(4) /* IFLA_GSO_MAX_SEGS */ + nla_total_size(4) /* IFLA_GSO_MAX_SIZE */ + nla_total_size(4) /* IFLA_GRO_MAX_SIZE */ + + nla_total_size(4) /* IFLA_TSO_IPV6_MAX_SIZE */ + nla_total_size(1) /* IFLA_OPERSTATE */ + nla_total_size(1) /* IFLA_LINKMODE */ + nla_total_size(4) /* IFLA_CARRIER_CHANGES */ @@ -1730,6 +1731,7 @@ static int rtnl_fill_ifinfo(struct sk_buff *skb, nla_put_u32(skb, IFLA_GSO_MAX_SEGS, dev->gso_max_segs) || nla_put_u32(skb, IFLA_GSO_MAX_SIZE, dev->gso_max_size) || nla_put_u32(skb, IFLA_GRO_MAX_SIZE, dev->gro_max_size) || + nla_put_u32(skb, IFLA_TSO_IPV6_MAX_SIZE, dev->tso_ipv6_max_size) || #ifdef CONFIG_RPS nla_put_u32(skb, IFLA_NUM_RX_QUEUES, dev->num_rx_queues) || #endif @@ -1883,6 +1885,7 @@ static const struct nla_policy ifla_policy[IFLA_MAX+1] = { [IFLA_NEW_IFINDEX] = NLA_POLICY_MIN(NLA_S32, 1), [IFLA_PARENT_DEV_NAME] = { .type = NLA_NUL_STRING }, [IFLA_GRO_MAX_SIZE] = { .type = NLA_U32 }, + [IFLA_TSO_IPV6_MAX_SIZE] = { .type = NLA_U32 }, }; static const struct nla_policy ifla_info_policy[IFLA_INFO_MAX+1] = { diff --git a/tools/include/uapi/linux/if_link.h b/tools/include/uapi/linux/if_link.h index 6218f93f5c1a92b5765bc19dfb9d7583c3b9369b..79b9d399cd297a1f79dca5ce89762800c38ed4a8 100644 --- a/tools/include/uapi/linux/if_link.h +++ b/tools/include/uapi/linux/if_link.h @@ -348,6 +348,7 @@ enum { IFLA_PARENT_DEV_NAME, IFLA_PARENT_DEV_BUS_NAME, IFLA_GRO_MAX_SIZE, + IFLA_TSO_IPV6_MAX_SIZE, __IFLA_MAX }; From patchwork Thu Feb 3 01:51:27 2022 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Eric Dumazet X-Patchwork-Id: 12733731 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 6D015C433EF for ; Thu, 3 Feb 2022 01:51:57 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1348879AbiBCBvz (ORCPT ); Wed, 2 Feb 2022 20:51:55 -0500 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:58070 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1348884AbiBCBvx (ORCPT ); Wed, 2 Feb 2022 20:51:53 -0500 Received: from mail-pg1-x52d.google.com (mail-pg1-x52d.google.com [IPv6:2607:f8b0:4864:20::52d]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 53A99C061714 for ; Wed, 2 Feb 2022 17:51:53 -0800 (PST) Received: by mail-pg1-x52d.google.com with SMTP id 132so1020928pga.5 for ; Wed, 02 Feb 2022 17:51:53 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20210112; h=from:to:cc:subject:date:message-id:in-reply-to:references :mime-version:content-transfer-encoding; bh=T2yizJYKyp5DKiz2mhLs/cO5uDUOqJNGPWieyte672w=; b=oBmv1Mkl2V8VN5I8vEMmsZGTQ13E4zMgGS/gVMDjk1ljjuSlXvwXjrtIESG2wLmTos +wCAXJD1ezamJOwiy2/7fwu2oWlOvbWR+gFkt76Aa2N9Nq8se9xn64aw8i8ErRuBgMON hzNXMz5vkSjB5nmhnRcdyU6rA2RbJ8MmJUrpnAWBxRwNwPbGJD7RnjSeOoJ3idhFQyje js+N2P8UEIt/mpnbZjHzSPgiHlDpscbEBCh1bYK4cf7SYd2ixLYnptj3n5Gjf3W25E89 Ct8sO4Hh4JVvYqO3oZV/wBXbASTsherWt2yLqxpSDEpuTbx/gcTF8J55kWsJ50wVMRw7 vmHw== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20210112; h=x-gm-message-state:from:to:cc:subject:date:message-id:in-reply-to :references:mime-version:content-transfer-encoding; bh=T2yizJYKyp5DKiz2mhLs/cO5uDUOqJNGPWieyte672w=; b=H8Yz5Fg9gDEzDb/MHl3j2gfViDseP//B7vgTavNskil+mOYFZrh3Dr7kbPnS/3EoZR bFvigfdFirnRrsiylti4GIJeCWMmeWCHVySRZPoTeDhk69hSwwzjBJzpr7HkYym6cV0/ HhF9KUmaX/zWSIH1SX92OMSP7Ns0gpbwjiWYhgz2X9SOqQTSRhI7MCJF+Z3Pns0fD2Ld fOa0xA5YWdD7kAFzjDhtrK0yTOyw7pRpyAMCXj03No2L9blFbCqyfYo2nHTXS4VTzoph u2KJKBaR9qieBz+5rdifEkrhdOKYdAamcsvs8aE/ql7P5JXJGRfiJ69qH9yZNBo6R4/P jW9w== X-Gm-Message-State: AOAM532CbOcvXdnuaJ1CBufk3O8DD8+WSBPK0FkXyzO9GksT75fami4n C1uW4x3s9xHn8oHviQkETKw= X-Google-Smtp-Source: ABdhPJzAEba67WsGc6WsPNQEdcD6/xf9VYV0MRH2MEdicPZEEOAJP5IcEI0N6IOSoxpnsfA0gijLFw== X-Received: by 2002:a63:8a44:: with SMTP id y65mr26548928pgd.590.1643853112799; Wed, 02 Feb 2022 17:51:52 -0800 (PST) Received: from edumazet1.svl.corp.google.com ([2620:15c:2c4:201:697a:fa00:b793:ed3a]) by smtp.gmail.com with ESMTPSA id qe16sm509611pjb.22.2022.02.02.17.51.52 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Wed, 02 Feb 2022 17:51:52 -0800 (PST) From: Eric Dumazet To: "David S . Miller" , Jakub Kicinski Cc: netdev , Eric Dumazet , Coco Li , Eric Dumazet Subject: [PATCH net-next 02/15] ipv6: add dev->gso_ipv6_max_size Date: Wed, 2 Feb 2022 17:51:27 -0800 Message-Id: <20220203015140.3022854-3-eric.dumazet@gmail.com> X-Mailer: git-send-email 2.35.0.rc2.247.g8bbb082509-goog In-Reply-To: <20220203015140.3022854-1-eric.dumazet@gmail.com> References: <20220203015140.3022854-1-eric.dumazet@gmail.com> MIME-Version: 1.0 Precedence: bulk List-ID: X-Mailing-List: netdev@vger.kernel.org X-Patchwork-Delegate: kuba@kernel.org From: Eric Dumazet This enable TCP stack to build TSO packets bigger than 64KB if the driver is LSOv2 compatible. This patch introduces new variable gso_ipv6_max_size that is modifiable through ip link. ip link set dev eth0 gso_ipv6_max_size 185000 User input is capped by driver limit. Signed-off-by: Coco Li Signed-off-by: Eric Dumazet --- include/linux/netdevice.h | 12 ++++++++++++ include/uapi/linux/if_link.h | 1 + net/core/dev.c | 1 + net/core/rtnetlink.c | 15 +++++++++++++++ net/core/sock.c | 6 ++++++ tools/include/uapi/linux/if_link.h | 1 + 6 files changed, 36 insertions(+) diff --git a/include/linux/netdevice.h b/include/linux/netdevice.h index b1f68df2b37bc4b623f61cc2c6f0c02ba2afbe02..2a563869ba44f7d48095d36b1395e3fbd8cfff87 100644 --- a/include/linux/netdevice.h +++ b/include/linux/netdevice.h @@ -1949,6 +1949,7 @@ enum netdev_ml_priv_type { * @linkwatch_dev_tracker: refcount tracker used by linkwatch. * @watchdog_dev_tracker: refcount tracker used by watchdog. * @tso_ipv6_max_size: Maximum size of IPv6 TSO packets (driver/NIC limit) + * @gso_ipv6_max_size: Maximum size of IPv6 GSO packets (user/admin limit) * * FIXME: cleanup struct net_device such that network protocol info * moves out. @@ -2284,6 +2285,7 @@ struct net_device { netdevice_tracker linkwatch_dev_tracker; netdevice_tracker watchdog_dev_tracker; unsigned int tso_ipv6_max_size; + unsigned int gso_ipv6_max_size; }; #define to_net_dev(d) container_of(d, struct net_device, dev) @@ -4804,6 +4806,10 @@ static inline void netif_set_gso_max_size(struct net_device *dev, { /* dev->gso_max_size is read locklessly from sk_setup_caps() */ WRITE_ONCE(dev->gso_max_size, size); + + /* legacy drivers want to lower gso_max_size, regardless of family. */ + size = min(size, dev->gso_ipv6_max_size); + WRITE_ONCE(dev->gso_ipv6_max_size, size); } static inline void netif_set_gso_max_segs(struct net_device *dev, @@ -4827,6 +4833,12 @@ static inline void netif_set_tso_ipv6_max_size(struct net_device *dev, dev->tso_ipv6_max_size = size; } +static inline void netif_set_gso_ipv6_max_size(struct net_device *dev, + unsigned int size) +{ + size = min(size, dev->tso_ipv6_max_size); + WRITE_ONCE(dev->gso_ipv6_max_size, size); +} static inline void skb_gso_error_unwind(struct sk_buff *skb, __be16 protocol, int pulled_hlen, u16 mac_offset, diff --git a/include/uapi/linux/if_link.h b/include/uapi/linux/if_link.h index 79b9d399cd297a1f79dca5ce89762800c38ed4a8..024b3bd0467e1360917001dba6bcfd1f30391894 100644 --- a/include/uapi/linux/if_link.h +++ b/include/uapi/linux/if_link.h @@ -349,6 +349,7 @@ enum { IFLA_PARENT_DEV_BUS_NAME, IFLA_GRO_MAX_SIZE, IFLA_TSO_IPV6_MAX_SIZE, + IFLA_GSO_IPV6_MAX_SIZE, __IFLA_MAX }; diff --git a/net/core/dev.c b/net/core/dev.c index b6ca3c348d41a097baf210f2a5d966b71308c69b..53c947e6fdb7c47e6cc92fd4e38b71e9b90d921c 100644 --- a/net/core/dev.c +++ b/net/core/dev.c @@ -10189,6 +10189,7 @@ struct net_device *alloc_netdev_mqs(int sizeof_priv, const char *name, dev->gso_max_segs = GSO_MAX_SEGS; dev->gro_max_size = GRO_MAX_SIZE; dev->tso_ipv6_max_size = GSO_MAX_SIZE; + dev->gso_ipv6_max_size = GSO_MAX_SIZE; dev->upper_level = 1; dev->lower_level = 1; diff --git a/net/core/rtnetlink.c b/net/core/rtnetlink.c index 4cefa07195ba3b67e7b724194b5d729d395ba466..0a0b26261f6d9e4e40bf9cfbda31a29c1f2e3aaa 100644 --- a/net/core/rtnetlink.c +++ b/net/core/rtnetlink.c @@ -1028,6 +1028,7 @@ static noinline size_t if_nlmsg_size(const struct net_device *dev, + nla_total_size(4) /* IFLA_GSO_MAX_SIZE */ + nla_total_size(4) /* IFLA_GRO_MAX_SIZE */ + nla_total_size(4) /* IFLA_TSO_IPV6_MAX_SIZE */ + + nla_total_size(4) /* IFLA_GSO_IPV6_MAX_SIZE */ + nla_total_size(1) /* IFLA_OPERSTATE */ + nla_total_size(1) /* IFLA_LINKMODE */ + nla_total_size(4) /* IFLA_CARRIER_CHANGES */ @@ -1732,6 +1733,7 @@ static int rtnl_fill_ifinfo(struct sk_buff *skb, nla_put_u32(skb, IFLA_GSO_MAX_SIZE, dev->gso_max_size) || nla_put_u32(skb, IFLA_GRO_MAX_SIZE, dev->gro_max_size) || nla_put_u32(skb, IFLA_TSO_IPV6_MAX_SIZE, dev->tso_ipv6_max_size) || + nla_put_u32(skb, IFLA_GSO_IPV6_MAX_SIZE, dev->gso_ipv6_max_size) || #ifdef CONFIG_RPS nla_put_u32(skb, IFLA_NUM_RX_QUEUES, dev->num_rx_queues) || #endif @@ -1886,6 +1888,7 @@ static const struct nla_policy ifla_policy[IFLA_MAX+1] = { [IFLA_PARENT_DEV_NAME] = { .type = NLA_NUL_STRING }, [IFLA_GRO_MAX_SIZE] = { .type = NLA_U32 }, [IFLA_TSO_IPV6_MAX_SIZE] = { .type = NLA_U32 }, + [IFLA_GSO_IPV6_MAX_SIZE] = { .type = NLA_U32 }, }; static const struct nla_policy ifla_info_policy[IFLA_INFO_MAX+1] = { @@ -2772,6 +2775,15 @@ static int do_setlink(const struct sk_buff *skb, } } + if (tb[IFLA_GSO_IPV6_MAX_SIZE]) { + u32 max_size = nla_get_u32(tb[IFLA_GSO_IPV6_MAX_SIZE]); + + if (dev->gso_ipv6_max_size ^ max_size) { + netif_set_gso_ipv6_max_size(dev, max_size); + status |= DO_SETLINK_MODIFIED; + } + } + if (tb[IFLA_GSO_MAX_SEGS]) { u32 max_segs = nla_get_u32(tb[IFLA_GSO_MAX_SEGS]); @@ -3247,6 +3259,9 @@ struct net_device *rtnl_create_link(struct net *net, const char *ifname, netif_set_gso_max_segs(dev, nla_get_u32(tb[IFLA_GSO_MAX_SEGS])); if (tb[IFLA_GRO_MAX_SIZE]) netif_set_gro_max_size(dev, nla_get_u32(tb[IFLA_GRO_MAX_SIZE])); + if (tb[IFLA_GSO_IPV6_MAX_SIZE]) + netif_set_gso_ipv6_max_size(dev, + nla_get_u32(tb[IFLA_GSO_IPV6_MAX_SIZE])); return dev; } diff --git a/net/core/sock.c b/net/core/sock.c index 09d31a7dc68f88af42f75f3f445818fe273b04fb..aec1e156548ea0818f025fd8f448f5e353f79a3b 100644 --- a/net/core/sock.c +++ b/net/core/sock.c @@ -2279,6 +2279,12 @@ void sk_setup_caps(struct sock *sk, struct dst_entry *dst) sk->sk_route_caps |= NETIF_F_SG | NETIF_F_HW_CSUM; /* pairs with the WRITE_ONCE() in netif_set_gso_max_size() */ sk->sk_gso_max_size = READ_ONCE(dst->dev->gso_max_size); +#if IS_ENABLED(CONFIG_IPV6) + if (sk->sk_family == AF_INET6 && + sk_is_tcp(sk) && + !ipv6_addr_v4mapped(&sk->sk_v6_rcv_saddr)) + sk->sk_gso_max_size = READ_ONCE(dst->dev->gso_ipv6_max_size); +#endif sk->sk_gso_max_size -= (MAX_TCP_HEADER + 1); /* pairs with the WRITE_ONCE() in netif_set_gso_max_segs() */ max_segs = max_t(u32, READ_ONCE(dst->dev->gso_max_segs), 1); diff --git a/tools/include/uapi/linux/if_link.h b/tools/include/uapi/linux/if_link.h index 79b9d399cd297a1f79dca5ce89762800c38ed4a8..024b3bd0467e1360917001dba6bcfd1f30391894 100644 --- a/tools/include/uapi/linux/if_link.h +++ b/tools/include/uapi/linux/if_link.h @@ -349,6 +349,7 @@ enum { IFLA_PARENT_DEV_BUS_NAME, IFLA_GRO_MAX_SIZE, IFLA_TSO_IPV6_MAX_SIZE, + IFLA_GSO_IPV6_MAX_SIZE, __IFLA_MAX }; From patchwork Thu Feb 3 01:51:28 2022 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Eric Dumazet X-Patchwork-Id: 12733732 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 40A2FC433F5 for ; Thu, 3 Feb 2022 01:52:04 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1348885AbiBCBwD (ORCPT ); Wed, 2 Feb 2022 20:52:03 -0500 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:58088 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1348890AbiBCBv4 (ORCPT ); Wed, 2 Feb 2022 20:51:56 -0500 Received: from mail-pf1-x433.google.com (mail-pf1-x433.google.com [IPv6:2607:f8b0:4864:20::433]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 6C380C06173D for ; Wed, 2 Feb 2022 17:51:56 -0800 (PST) Received: by mail-pf1-x433.google.com with SMTP id i30so900081pfk.8 for ; Wed, 02 Feb 2022 17:51:56 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20210112; h=from:to:cc:subject:date:message-id:in-reply-to:references :mime-version:content-transfer-encoding; bh=3kQZX+vCZwOhXWjeBN6cg2olIO+FpuLDjmuSQhrA2Ag=; b=V6ltMruJMnrAnGA48O7b3CejJThV9Lu0sGPCVYa2uXWSCS1V87eMlu9eyoEbXCYwJb uVPr5kidRtrv8hTH9MeQLYve+hRhcvIcJi8p4m+ch7m8ANl98SQhx04bKppd0TPEk++T TXJODElduXOuu1a3tNfn9/kwG6XJNMk2NpzQiYR1+Jcyg8RqCYyl9txN7mdSAfc3XGE6 DaGmp9KZJ6rMg69R6qdvZ9npvmsLf2XOTrjUcaCvaVrxfWQ156SP323CZcEbvJgrEbNh 1bte7MePN4bcxBxyt/WQmGJ8sb/nKGdtYfvjjgaEDZw5NaTVleXEjgk2iAMGMpwPW1KZ AdBA== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20210112; h=x-gm-message-state:from:to:cc:subject:date:message-id:in-reply-to :references:mime-version:content-transfer-encoding; bh=3kQZX+vCZwOhXWjeBN6cg2olIO+FpuLDjmuSQhrA2Ag=; b=WPljLGN5M0f9n4Jt8NpkgVG5ESygzjPkJPjmUErpS1kmilFa2SRCk+ONNjvFOZB5h1 ge6dCS5hbyYA/RmA3HmKdeO7UPDyECQGZ1bafLusKuEcp9J2Jkbwq3Nt6+LOw+em9UhF 9gWp5F8TC1eJ+vJxOB1PDPETMYwR64Pk13ACgIylHs/oj3TkFaWZZaghDSQJXqwL+sAW vbrbLAmy0uxXqJxpW9hUn9jSEK/96ttbMb8+496GEYMPLXeR7IQyvCSTqObtCK/M2LG1 CW+eIqdsBXwehf61bTChpN2uhLxre/F7+PA5g+Bz+9Pl0Y84PPNSIcKoRenFuI4ThlOd mnTA== X-Gm-Message-State: AOAM532ol3Y0J2BCITgCLxbNi//ffObhQA1wXE92wKZ+PRaNwdfkMzig cezALvs/swij6zYjAg8qo7o= X-Google-Smtp-Source: ABdhPJxK8S3RDBskrcC0Y4g/xpCG2gAb6lh3+L3DgcY44ZFY7NmSwJy+HUDL2t3HaKfxSQko0ScGSw== X-Received: by 2002:a65:4286:: with SMTP id j6mr14009357pgp.619.1643853115796; Wed, 02 Feb 2022 17:51:55 -0800 (PST) Received: from edumazet1.svl.corp.google.com ([2620:15c:2c4:201:697a:fa00:b793:ed3a]) by smtp.gmail.com with ESMTPSA id qe16sm509611pjb.22.2022.02.02.17.51.55 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Wed, 02 Feb 2022 17:51:55 -0800 (PST) From: Eric Dumazet To: "David S . Miller" , Jakub Kicinski Cc: netdev , Eric Dumazet , Coco Li , Eric Dumazet Subject: [PATCH net-next 03/15] tcp_cubic: make hystart_ack_delay() aware of BIG TCP Date: Wed, 2 Feb 2022 17:51:28 -0800 Message-Id: <20220203015140.3022854-4-eric.dumazet@gmail.com> X-Mailer: git-send-email 2.35.0.rc2.247.g8bbb082509-goog In-Reply-To: <20220203015140.3022854-1-eric.dumazet@gmail.com> References: <20220203015140.3022854-1-eric.dumazet@gmail.com> MIME-Version: 1.0 Precedence: bulk List-ID: X-Mailing-List: netdev@vger.kernel.org X-Patchwork-Delegate: kuba@kernel.org From: Eric Dumazet hystart_ack_delay() had the assumption that a TSO packet would not be bigger than GSO_MAX_SIZE. This will no longer be true. We should use sk->sk_gso_max_size instead. This reduces chances of spurious Hystart ACK train detections. Signed-off-by: Eric Dumazet --- net/ipv4/tcp_cubic.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/net/ipv4/tcp_cubic.c b/net/ipv4/tcp_cubic.c index 24d562dd62254d6e50dd08236f8967400d81e1ea..dfc9dc951b7404776b2246c38273fbadf03c39fd 100644 --- a/net/ipv4/tcp_cubic.c +++ b/net/ipv4/tcp_cubic.c @@ -372,7 +372,7 @@ static void cubictcp_state(struct sock *sk, u8 new_state) * We apply another 100% factor because @rate is doubled at this point. * We cap the cushion to 1ms. */ -static u32 hystart_ack_delay(struct sock *sk) +static u32 hystart_ack_delay(const struct sock *sk) { unsigned long rate; @@ -380,7 +380,7 @@ static u32 hystart_ack_delay(struct sock *sk) if (!rate) return 0; return min_t(u64, USEC_PER_MSEC, - div64_ul((u64)GSO_MAX_SIZE * 4 * USEC_PER_SEC, rate)); + div64_ul((u64)sk->sk_gso_max_size * 4 * USEC_PER_SEC, rate)); } static void hystart_update(struct sock *sk, u32 delay) From patchwork Thu Feb 3 01:51:29 2022 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Eric Dumazet X-Patchwork-Id: 12733733 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 0E925C433EF for ; Thu, 3 Feb 2022 01:52:05 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1348889AbiBCBwD (ORCPT ); Wed, 2 Feb 2022 20:52:03 -0500 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:58098 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1348887AbiBCBv6 (ORCPT ); Wed, 2 Feb 2022 20:51:58 -0500 Received: from mail-pj1-x102e.google.com (mail-pj1-x102e.google.com [IPv6:2607:f8b0:4864:20::102e]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id C1F9FC06173E for ; Wed, 2 Feb 2022 17:51:58 -0800 (PST) Received: by mail-pj1-x102e.google.com with SMTP id o64so1052524pjo.2 for ; Wed, 02 Feb 2022 17:51:58 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20210112; h=from:to:cc:subject:date:message-id:in-reply-to:references :mime-version:content-transfer-encoding; bh=r/IHVe/4R9v1EiC6cO7H0ylsMmHAyBBTO/HRoWM1qoA=; b=jy3KOfbBAhLOGDlvvuiukYQhZ1L4ly64fFo4eK9j/oosW1p6pQYyK+XVZ3ZBhj3wYb ltpAK5habFxPnHxP6JdFRIuy+6Ob6g51+hq/M5TwZkIKq7QhrdtzPIz1xikEymutwgwq lAOWoeIHW2j2R42JtyCGVDH33gxpZTUB/ouqOzVCPb/l8QC3qenBDP+0HjKaCdPPKCWn M0Z2c3F5XWF7yrrJuTWqGSWjsmdONb8IjBSTuWg5kJnsZRenTpPdP0+I2eKfLzo0dT7Z l+VVhLFKc+8grenSCEFtBrEv/7B1mYN9mwVc1PAT9xh/J7AipvqpI5WaJUTB9XvryBJJ 8keg== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20210112; h=x-gm-message-state:from:to:cc:subject:date:message-id:in-reply-to :references:mime-version:content-transfer-encoding; bh=r/IHVe/4R9v1EiC6cO7H0ylsMmHAyBBTO/HRoWM1qoA=; b=n0B4j8nneBw4SdU5NMRuUi0fD35K3o4E+BMRQOewjGZjo+ZTBOdz1sRQI9LwLpJaik Yv7/jDfT7kw9b7aRJH7wY/GIHCEhuZvU1YsoHTFYR9rpPrYRfX55QqtrsTd0bp9ihDGT y5tLRovWg8B6XpMeBXKNG1EgYQwEfwWHjunN4l+bWETPSDcq0hVGNRwwAHZTpEA3TEJj dM8ID7SACiW+KT81n+dHn4916eL/wq1AzwQY/nnrYHDHvrgkPEfyo6JUQmtEKefqaHXI e5zgNGTOyivcNndv1y2zudUJ9r7TCEFTuGabS5s1U74s5DE2pTR8z6/+HHclMEcVk6RJ 69Fw== X-Gm-Message-State: AOAM533b0yyHCzwdj3ed6QFPCm4QjROdDtEd0gr07thYlrYZAwRpvpvz 2zO5NNMJigZTNFPhoHeyQ1KEDvc6fSI= X-Google-Smtp-Source: ABdhPJzaSyA7nIjDU9RKrsuzt9olmi/RLtYEqElw10kw4PLxSJJ/krfFTBJzAb+k4+9xu1nbZgr1SA== X-Received: by 2002:a17:90b:3ec4:: with SMTP id rm4mr6944140pjb.102.1643853118136; Wed, 02 Feb 2022 17:51:58 -0800 (PST) Received: from edumazet1.svl.corp.google.com ([2620:15c:2c4:201:697a:fa00:b793:ed3a]) by smtp.gmail.com with ESMTPSA id qe16sm509611pjb.22.2022.02.02.17.51.57 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Wed, 02 Feb 2022 17:51:57 -0800 (PST) From: Eric Dumazet To: "David S . Miller" , Jakub Kicinski Cc: netdev , Eric Dumazet , Coco Li , Eric Dumazet Subject: [PATCH net-next 04/15] ipv6: add struct hop_jumbo_hdr definition Date: Wed, 2 Feb 2022 17:51:29 -0800 Message-Id: <20220203015140.3022854-5-eric.dumazet@gmail.com> X-Mailer: git-send-email 2.35.0.rc2.247.g8bbb082509-goog In-Reply-To: <20220203015140.3022854-1-eric.dumazet@gmail.com> References: <20220203015140.3022854-1-eric.dumazet@gmail.com> MIME-Version: 1.0 Precedence: bulk List-ID: X-Mailing-List: netdev@vger.kernel.org X-Patchwork-Delegate: kuba@kernel.org From: Eric Dumazet Following patches will need to add and remove local IPv6 jumbogram options to enable BIG TCP. Signed-off-by: Eric Dumazet --- include/net/ipv6.h | 11 +++++++++++ 1 file changed, 11 insertions(+) diff --git a/include/net/ipv6.h b/include/net/ipv6.h index 082f30256f59fad18b78746b6650aee840932eba..ea2a4351b654f8bc96503aae2b9adcd478e1f8b2 100644 --- a/include/net/ipv6.h +++ b/include/net/ipv6.h @@ -151,6 +151,17 @@ struct frag_hdr { __be32 identification; }; +/* + * Jumbo payload option, as described in RFC 2676 2. + */ +struct hop_jumbo_hdr { + u8 nexthdr; + u8 hdrlen; + u8 tlv_type; /* IPV6_TLV_JUMBO, 0xC2 */ + u8 tlv_len; /* 4 */ + __be32 jumbo_payload_len; +}; + #define IP6_MF 0x0001 #define IP6_OFFSET 0xFFF8 From patchwork Thu Feb 3 01:51:30 2022 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Eric Dumazet X-Patchwork-Id: 12733734 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 3D4D5C433FE for ; Thu, 3 Feb 2022 01:52:06 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1348891AbiBCBwE (ORCPT ); Wed, 2 Feb 2022 20:52:04 -0500 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:58108 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1348894AbiBCBwA (ORCPT ); Wed, 2 Feb 2022 20:52:00 -0500 Received: from mail-pl1-x632.google.com (mail-pl1-x632.google.com [IPv6:2607:f8b0:4864:20::632]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id BB132C061401 for ; Wed, 2 Feb 2022 17:52:00 -0800 (PST) Received: by mail-pl1-x632.google.com with SMTP id c9so851201plg.11 for ; Wed, 02 Feb 2022 17:52:00 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20210112; h=from:to:cc:subject:date:message-id:in-reply-to:references :mime-version:content-transfer-encoding; bh=yKGkaktrCx/5DHxPDheliVbX84VuGZGwuAJO0WasO08=; b=nUHIFWDxBsTfeXtOjHfe9F1iZirVF2WDRO1uNASMkq9F2UOvqqv5hXOCsqn708aSB5 ih+L4Fn559a1UT9KHXKcPBwkxFSzdqB9c3PddCzv+dIV+1uuHT2k+c/Dj1yIcD3VZwUa m65pKcb7FF/WrbeAKu+UeSPJRpOuR4cfwHUdifPJqGMxUk8LW2o/buQTMp+wMLAG2nWy 4F+6qiOfla86zu0B1CPsc4XsymFXJUdIpz5BP/SSPU+xguavreQb6SezUs6Rb5VhufqJ YeFM3X0w9a/gph8H1FdGVBiZRrPazGul+gpf2n0gRGoZFK7Kkia9Jqr6gAu+a4JkUqdf z9Lg== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20210112; h=x-gm-message-state:from:to:cc:subject:date:message-id:in-reply-to :references:mime-version:content-transfer-encoding; bh=yKGkaktrCx/5DHxPDheliVbX84VuGZGwuAJO0WasO08=; b=QnxqA0dq77I5qGQP3bf9CTEQRRDc/ScvOFyI22HKfT/rnQAxkDM7m3TVWPQjW0UIIH zvZ2Pr3Atwcgs93cZCAgVgLMZjO5P8I+Ls7dMsJ5PV8KgPpdUYz569EGxwrnceQKUUGp bxMru/RqTKS6PCNumcr+IVuGEVW2zPArfTdZJXirNCim0PoxTY7IG0NXDzEip/T8MI1Y 0ULE7V7RX1GCzwhcatNW5rLShBqd5ZnIPJhQGg9NtRb7YXtZLSIepwon1Jx1wk1LsGVL WNrlD+A/uCiHMmnZ5Y8kHQoL10dyLRyLs/HnvTtDwABUT7a402+rL2veluo13vtVLvvn qB2w== X-Gm-Message-State: AOAM530JkIdk8cKisLoOnjFjgIoo846ePwyqmkuUbCBb4zm1E9+eH0e8 aZ58QmhTDIiZSCMBrE3nTUI= X-Google-Smtp-Source: ABdhPJz7SmRhASJETLI0wCW2hV24TT/w4fW/huxPImlVvdub7MORw/3/gUrfDWQgUV8T+OpIJlxNww== X-Received: by 2002:a17:90b:1e05:: with SMTP id pg5mr11295416pjb.86.1643853120305; Wed, 02 Feb 2022 17:52:00 -0800 (PST) Received: from edumazet1.svl.corp.google.com ([2620:15c:2c4:201:697a:fa00:b793:ed3a]) by smtp.gmail.com with ESMTPSA id qe16sm509611pjb.22.2022.02.02.17.51.59 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Wed, 02 Feb 2022 17:52:00 -0800 (PST) From: Eric Dumazet To: "David S . Miller" , Jakub Kicinski Cc: netdev , Eric Dumazet , Coco Li , Eric Dumazet Subject: [PATCH net-next 05/15] ipv6/gso: remove temporary HBH/jumbo header Date: Wed, 2 Feb 2022 17:51:30 -0800 Message-Id: <20220203015140.3022854-6-eric.dumazet@gmail.com> X-Mailer: git-send-email 2.35.0.rc2.247.g8bbb082509-goog In-Reply-To: <20220203015140.3022854-1-eric.dumazet@gmail.com> References: <20220203015140.3022854-1-eric.dumazet@gmail.com> MIME-Version: 1.0 Precedence: bulk List-ID: X-Mailing-List: netdev@vger.kernel.org X-Patchwork-Delegate: kuba@kernel.org From: Eric Dumazet ipv6 tcp and gro stacks will soon be able to build big TCP packets, with an added temporary Hop By Hop header. If GSO is involved for these large packets, we need to remove the temporary HBH header before segmentation happens. Signed-off-by: Eric Dumazet --- include/net/ipv6.h | 31 +++++++++++++++++++++++++++++++ net/core/skbuff.c | 21 ++++++++++++++++++++- 2 files changed, 51 insertions(+), 1 deletion(-) diff --git a/include/net/ipv6.h b/include/net/ipv6.h index ea2a4351b654f8bc96503aae2b9adcd478e1f8b2..96e916fb933c3e7d4288e86790fcb2bb1353a261 100644 --- a/include/net/ipv6.h +++ b/include/net/ipv6.h @@ -464,6 +464,37 @@ bool ipv6_opt_accepted(const struct sock *sk, const struct sk_buff *skb, struct ipv6_txoptions *ipv6_update_options(struct sock *sk, struct ipv6_txoptions *opt); +/* This helper is specialized for BIG TCP needs. + * It assumes the hop_jumbo_hdr will immediately follow the IPV6 header. + * It assumes headers are already in skb->head, thus the sk argument is only read. + */ +static inline bool ipv6_has_hopopt_jumbo(const struct sk_buff *skb) +{ + struct hop_jumbo_hdr *jhdr; + struct ipv6hdr *nhdr; + + if (likely(skb->len <= GRO_MAX_SIZE)) + return false; + + if (skb->protocol != htons(ETH_P_IPV6)) + return false; + + if (skb_network_offset(skb) + + sizeof(struct ipv6hdr) + + sizeof(struct hop_jumbo_hdr) > skb_headlen(skb)) + return false; + + nhdr = ipv6_hdr(skb); + + if (nhdr->nexthdr != NEXTHDR_HOP) + return false; + + jhdr = (struct hop_jumbo_hdr *) (nhdr + 1); + if (jhdr->tlv_type != IPV6_TLV_JUMBO || jhdr->hdrlen != 0) + return false; + return true; +} + static inline bool ipv6_accept_ra(struct inet6_dev *idev) { /* If forwarding is enabled, RA are not accepted unless the special diff --git a/net/core/skbuff.c b/net/core/skbuff.c index 0118f0afaa4fce8da167ddf39de4c9f3880ca05b..53f17c7392311e7123628fcab4617efc169905a1 100644 --- a/net/core/skbuff.c +++ b/net/core/skbuff.c @@ -3959,8 +3959,9 @@ struct sk_buff *skb_segment(struct sk_buff *head_skb, skb_frag_t *frag = skb_shinfo(head_skb)->frags; unsigned int mss = skb_shinfo(head_skb)->gso_size; unsigned int doffset = head_skb->data - skb_mac_header(head_skb); + int hophdr_len = sizeof(struct hop_jumbo_hdr); struct sk_buff *frag_skb = head_skb; - unsigned int offset = doffset; + unsigned int offset; unsigned int tnl_hlen = skb_tnl_header_len(head_skb); unsigned int partial_segs = 0; unsigned int headroom; @@ -3968,6 +3969,7 @@ struct sk_buff *skb_segment(struct sk_buff *head_skb, __be16 proto; bool csum, sg; int nfrags = skb_shinfo(head_skb)->nr_frags; + struct ipv6hdr *h6; int err = -ENOMEM; int i = 0; int pos; @@ -3992,6 +3994,23 @@ struct sk_buff *skb_segment(struct sk_buff *head_skb, } __skb_push(head_skb, doffset); + + if (ipv6_has_hopopt_jumbo(head_skb)) { + /* remove the HBH header. + * Layout: [Ethernet header][IPv6 header][HBH][TCP header] + */ + memmove(head_skb->data + hophdr_len, + head_skb->data, + ETH_HLEN + sizeof(struct ipv6hdr)); + head_skb->data += hophdr_len; + head_skb->len -= hophdr_len; + head_skb->network_header += hophdr_len; + head_skb->mac_header += hophdr_len; + doffset -= hophdr_len; + h6 = (struct ipv6hdr *)(head_skb->data + ETH_HLEN); + h6->nexthdr = IPPROTO_TCP; + } + offset = doffset; proto = skb_network_protocol(head_skb, NULL); if (unlikely(!proto)) return ERR_PTR(-EINVAL); From patchwork Thu Feb 3 01:51:31 2022 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Eric Dumazet X-Patchwork-Id: 12733735 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 D978EC433EF for ; Thu, 3 Feb 2022 01:52:06 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1348897AbiBCBwG (ORCPT ); Wed, 2 Feb 2022 20:52:06 -0500 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:58092 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1348855AbiBCBwD (ORCPT ); Wed, 2 Feb 2022 20:52:03 -0500 Received: from mail-pj1-x102d.google.com (mail-pj1-x102d.google.com [IPv6:2607:f8b0:4864:20::102d]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 203D4C06173B for ; Wed, 2 Feb 2022 17:52:02 -0800 (PST) Received: by mail-pj1-x102d.google.com with SMTP id v15-20020a17090a4ecf00b001b82db48754so1401845pjl.2 for ; Wed, 02 Feb 2022 17:52:02 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20210112; h=from:to:cc:subject:date:message-id:in-reply-to:references :mime-version:content-transfer-encoding; bh=M0CvqSum6+XdHivNp9h5db+obqXQFYnrbVFzkgyj3D8=; b=c+c35QzNIjvNmL/d9TQFDJYXEs7zf8v2yMbzjenSJlN/PLOOWZN4clo7WY6bokRSpw NE70Qm8oNiNH6j+UfAZDEdFUeF/mzEH+e11ElGwZmDWZPI7OBpm0wTBoh55fKvrxrobi a5IGYW5WXbUA5rmjAn1TysVsnL/1ljvv+Oc1zH0TI+xoqu/DyNNuEoOJO7bScKL3va7F 1jOJt3qXbgXTqubEtjXBg/DclTCLOZjtL3gZEJfRhQxe3FZ424ujIAut4ilkj2v/B+rZ +7GMm7PFKYI8aN65oQ06PASzRUFFSV1mqB7wGTrvsgBlwB0hfCi2gRTO1SQioog4Kwl3 z2mw== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20210112; h=x-gm-message-state:from:to:cc:subject:date:message-id:in-reply-to :references:mime-version:content-transfer-encoding; bh=M0CvqSum6+XdHivNp9h5db+obqXQFYnrbVFzkgyj3D8=; b=NW7EpJII1zPmVjIKY9kOK2GRsDT/qgYu1VFwLW8BuvLX9/TD9eJ0gE5876RZUNlNjW WDldFVMNR2oSIPTutOthMQuwyfku/C3usiIrBe1GlMJN2kzl814QuReCtO3BGu2e7rRC 8red/67z4nb691rrbz6U4R5N+dMU/3drTNPHXZvolpRtUs+AHaQea1p59fbhzA7o8SU+ IJgKmJwoflXU7z3xZxrZPXgnFscHsiX7yt1synpglLF53SNjoN0e092ohC+x4vFRka83 53J/CeS/SDQ2hRZg59aG+qikfW8k+h7vpvgBSsFd8UKmrtoc+Fej8WBJGjzooMCsq8ag wPsA== X-Gm-Message-State: AOAM533XpFoD7XPyqoFIUgltCd515RtDCQ3cfTnx4O69GnC6GnPP9ihE URRBfLOVUT8KpM9MjEWM7sgkDLtdSAU= X-Google-Smtp-Source: ABdhPJyLycfsZbMjxP54WK7ust51bS4ik8CLBRVrvarvL+72z9wOLBJ4GDqMciWQMubC7wvSrcZkjQ== X-Received: by 2002:a17:90b:4c04:: with SMTP id na4mr11094059pjb.62.1643853122532; Wed, 02 Feb 2022 17:52:02 -0800 (PST) Received: from edumazet1.svl.corp.google.com ([2620:15c:2c4:201:697a:fa00:b793:ed3a]) by smtp.gmail.com with ESMTPSA id qe16sm509611pjb.22.2022.02.02.17.52.01 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Wed, 02 Feb 2022 17:52:02 -0800 (PST) From: Eric Dumazet To: "David S . Miller" , Jakub Kicinski Cc: netdev , Eric Dumazet , Coco Li , Eric Dumazet Subject: [PATCH net-next 06/15] ipv6/gro: insert temporary HBH/jumbo header Date: Wed, 2 Feb 2022 17:51:31 -0800 Message-Id: <20220203015140.3022854-7-eric.dumazet@gmail.com> X-Mailer: git-send-email 2.35.0.rc2.247.g8bbb082509-goog In-Reply-To: <20220203015140.3022854-1-eric.dumazet@gmail.com> References: <20220203015140.3022854-1-eric.dumazet@gmail.com> MIME-Version: 1.0 Precedence: bulk List-ID: X-Mailing-List: netdev@vger.kernel.org X-Patchwork-Delegate: kuba@kernel.org From: Eric Dumazet Following patch will add GRO_IPV6_MAX_SIZE, allowing gro to build BIG TCP ipv6 packets (bigger than 64K). This patch changes ipv6_gro_complete() to insert a HBH/jumbo header so that resulting packet can go through IPv6/TCP stacks. Signed-off-by: Eric Dumazet --- net/ipv6/ip6_offload.c | 32 ++++++++++++++++++++++++++++++-- 1 file changed, 30 insertions(+), 2 deletions(-) diff --git a/net/ipv6/ip6_offload.c b/net/ipv6/ip6_offload.c index d37a79a8554e92a1dcaa6fd023cafe2114841ece..dac6f60436e167a3d979fef02f25fc039c6ed37d 100644 --- a/net/ipv6/ip6_offload.c +++ b/net/ipv6/ip6_offload.c @@ -318,15 +318,43 @@ static struct sk_buff *ip4ip6_gro_receive(struct list_head *head, INDIRECT_CALLABLE_SCOPE int ipv6_gro_complete(struct sk_buff *skb, int nhoff) { const struct net_offload *ops; - struct ipv6hdr *iph = (struct ipv6hdr *)(skb->data + nhoff); + struct ipv6hdr *iph; int err = -ENOSYS; + u32 payload_len; if (skb->encapsulation) { skb_set_inner_protocol(skb, cpu_to_be16(ETH_P_IPV6)); skb_set_inner_network_header(skb, nhoff); } - iph->payload_len = htons(skb->len - nhoff - sizeof(*iph)); + payload_len = skb->len - nhoff - sizeof(*iph); + if (unlikely(payload_len > IPV6_MAXPLEN)) { + struct hop_jumbo_hdr *hop_jumbo; + int hoplen = sizeof(*hop_jumbo); + + /* Move network header left */ + memmove(skb_mac_header(skb) - hoplen, skb_mac_header(skb), + skb->transport_header - skb->mac_header); + skb->data -= hoplen; + skb->len += hoplen; + skb->mac_header -= hoplen; + skb->network_header -= hoplen; + iph = (struct ipv6hdr *)(skb->data + nhoff); + hop_jumbo = (struct hop_jumbo_hdr *)(iph + 1); + + /* Build hop-by-hop options */ + hop_jumbo->nexthdr = iph->nexthdr; + hop_jumbo->hdrlen = 0; + hop_jumbo->tlv_type = IPV6_TLV_JUMBO; + hop_jumbo->tlv_len = 4; + hop_jumbo->jumbo_payload_len = htonl(payload_len + hoplen); + + iph->nexthdr = NEXTHDR_HOP; + iph->payload_len = 0; + } else { + iph = (struct ipv6hdr *)(skb->data + nhoff); + iph->payload_len = htons(payload_len); + } nhoff += sizeof(*iph) + ipv6_exthdrs_len(iph, &ops); if (WARN_ON(!ops || !ops->callbacks.gro_complete)) From patchwork Thu Feb 3 01:51:32 2022 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Eric Dumazet X-Patchwork-Id: 12733736 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 931C2C433F5 for ; Thu, 3 Feb 2022 01:52:12 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1348895AbiBCBwL (ORCPT ); Wed, 2 Feb 2022 20:52:11 -0500 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:58126 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1348894AbiBCBwF (ORCPT ); Wed, 2 Feb 2022 20:52:05 -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 30370C06173B for ; Wed, 2 Feb 2022 17:52:05 -0800 (PST) Received: by mail-pl1-x62d.google.com with SMTP id k17so921224plk.0 for ; Wed, 02 Feb 2022 17:52:05 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20210112; h=from:to:cc:subject:date:message-id:in-reply-to:references :mime-version:content-transfer-encoding; bh=SZhGDor8mFHJu+S5dB9PhXYmyk0M0buur4ZjoUX8rio=; b=EPqFbcXK7zwp1vCQd00wnv/3q3xPqHekyXMMfM3G3DRSI2zyUkoA6FFv51tNebQ1Cl tINJJtyNOopNlRwa0crY9XSRx5B797/Vz8xV3HV77V5kx36KEeo6p+WJwmag8MTBi0VB SwQhJTqhwXRC4ajDPsUV7v+Pgi1xZ+wpnCCqoRtZp22WiKUYys9r2W3wg84bQ1PaV9XA lE4UmIzbnPRVywrkXcpQcrKgtL1mbV6kPFoWpLZ0ePKdEpoVrHyu0YOIplZ+96RgMr5X ck/eywRfkQk4u80StcJ+FZxQVaZo6t1UJc7hJSYDJBRQ8vuDf3RhhsrB/nI8SYVl4+kI chOw== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20210112; h=x-gm-message-state:from:to:cc:subject:date:message-id:in-reply-to :references:mime-version:content-transfer-encoding; bh=SZhGDor8mFHJu+S5dB9PhXYmyk0M0buur4ZjoUX8rio=; b=E6EQlhcRE5rkMLcDxIJMayPM38IKEVSfYUSBcspY95gqyJQfKWTWgCgoRR7H0ENo2h r0Fd1+23bk273y+KcNps0ENlwMxvwrpIa8P0wrgYQT0g+tS9JkqPrXBvw/B8TMIilIlF x0cPkzyujthnkRoG2OwbE02etHrARLtiF2ua1Rby8G4vumaVzQnaWwjNQ7aa9AfU9R9H iNlLgblcOBAS9GPj/RL0dGteRVbUY7Sjp/dGipIV1KuqeAFOZWFvl9kwldjL210uFHJo SwGKMyxriPU7VXlYZicEfA6J0/ctT/e7GwREf+IRdqjlzQa00RjFfxsxMwOI50dkXzwv MiSg== X-Gm-Message-State: AOAM532eF8V6WfjoeETZI5jpqnDGcNzVBOsywIWZeyXoyC1Xr99dR4Cg IhcCj5poCijnRcIvcrS4DUxcQPrGHvc= X-Google-Smtp-Source: ABdhPJwXwmr6BbdO0ZmDDwLY4mahIP2biKAkIcn4kv5xcBwTXhx0iRvg6SL4ufUrCbHQj/vFkbX4gg== X-Received: by 2002:a17:902:e885:: with SMTP id w5mr33611617plg.155.1643853124684; Wed, 02 Feb 2022 17:52:04 -0800 (PST) Received: from edumazet1.svl.corp.google.com ([2620:15c:2c4:201:697a:fa00:b793:ed3a]) by smtp.gmail.com with ESMTPSA id qe16sm509611pjb.22.2022.02.02.17.52.03 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Wed, 02 Feb 2022 17:52:04 -0800 (PST) From: Eric Dumazet To: "David S . Miller" , Jakub Kicinski Cc: netdev , Eric Dumazet , Coco Li , Eric Dumazet Subject: [PATCH net-next 07/15] ipv6: add GRO_IPV6_MAX_SIZE Date: Wed, 2 Feb 2022 17:51:32 -0800 Message-Id: <20220203015140.3022854-8-eric.dumazet@gmail.com> X-Mailer: git-send-email 2.35.0.rc2.247.g8bbb082509-goog In-Reply-To: <20220203015140.3022854-1-eric.dumazet@gmail.com> References: <20220203015140.3022854-1-eric.dumazet@gmail.com> MIME-Version: 1.0 Precedence: bulk List-ID: X-Mailing-List: netdev@vger.kernel.org X-Patchwork-Delegate: kuba@kernel.org From: "Signed-off-by: Coco Li" Enable GRO to have IPv6 specific limit for max packet size. This patch introduces new dev->gro_ipv6_max_size that is modifiable through ip link. ip link set dev eth0 gro_ipv6_max_size 185000 Note that this value is only considered if bigger than gro_max_size, and for non encapsulated TCP/ipv6 packets. Signed-off-by: Coco Li Signed-off-by: Eric Dumazet --- include/linux/netdevice.h | 10 ++++++++++ include/uapi/linux/if_link.h | 1 + net/core/dev.c | 1 + net/core/gro.c | 20 ++++++++++++++++++-- net/core/rtnetlink.c | 15 +++++++++++++++ tools/include/uapi/linux/if_link.h | 1 + 6 files changed, 46 insertions(+), 2 deletions(-) diff --git a/include/linux/netdevice.h b/include/linux/netdevice.h index 2a563869ba44f7d48095d36b1395e3fbd8cfff87..a3a61cffd953add6f272a53f551a49a47d200c68 100644 --- a/include/linux/netdevice.h +++ b/include/linux/netdevice.h @@ -1944,6 +1944,8 @@ enum netdev_ml_priv_type { * keep a list of interfaces to be deleted. * @gro_max_size: Maximum size of aggregated packet in generic * receive offload (GRO) + * @gro_ipv6_max_size: Maximum size of aggregated packet in generic + * receive offload (GRO), for IPv6 * * @dev_addr_shadow: Copy of @dev_addr to catch direct writes. * @linkwatch_dev_tracker: refcount tracker used by linkwatch. @@ -2137,6 +2139,7 @@ struct net_device { int napi_defer_hard_irqs; #define GRO_MAX_SIZE 65536 unsigned int gro_max_size; + unsigned int gro_ipv6_max_size; rx_handler_func_t __rcu *rx_handler; void __rcu *rx_handler_data; @@ -4840,6 +4843,13 @@ static inline void netif_set_gso_ipv6_max_size(struct net_device *dev, WRITE_ONCE(dev->gso_ipv6_max_size, size); } +static inline void netif_set_gro_ipv6_max_size(struct net_device *dev, + unsigned int size) +{ + /* This pairs with the READ_ONCE() in skb_gro_receive() */ + WRITE_ONCE(dev->gro_ipv6_max_size, size); +} + static inline void skb_gso_error_unwind(struct sk_buff *skb, __be16 protocol, int pulled_hlen, u16 mac_offset, int mac_len) diff --git a/include/uapi/linux/if_link.h b/include/uapi/linux/if_link.h index 024b3bd0467e1360917001dba6bcfd1f30391894..48fe85bed4a629df0dd7cc0ee3a5139370e2c94d 100644 --- a/include/uapi/linux/if_link.h +++ b/include/uapi/linux/if_link.h @@ -350,6 +350,7 @@ enum { IFLA_GRO_MAX_SIZE, IFLA_TSO_IPV6_MAX_SIZE, IFLA_GSO_IPV6_MAX_SIZE, + IFLA_GRO_IPV6_MAX_SIZE, __IFLA_MAX }; diff --git a/net/core/dev.c b/net/core/dev.c index 53c947e6fdb7c47e6cc92fd4e38b71e9b90d921c..e7df5c3f53d6e96d01ff06d081cef77d0c6d9d29 100644 --- a/net/core/dev.c +++ b/net/core/dev.c @@ -10190,6 +10190,7 @@ struct net_device *alloc_netdev_mqs(int sizeof_priv, const char *name, dev->gro_max_size = GRO_MAX_SIZE; dev->tso_ipv6_max_size = GSO_MAX_SIZE; dev->gso_ipv6_max_size = GSO_MAX_SIZE; + dev->gro_ipv6_max_size = GRO_MAX_SIZE; dev->upper_level = 1; dev->lower_level = 1; diff --git a/net/core/gro.c b/net/core/gro.c index a11b286d149593827f1990fb8d06b0295fa72189..005a05468418f0373264e8019384e2daa13176eb 100644 --- a/net/core/gro.c +++ b/net/core/gro.c @@ -136,11 +136,27 @@ int skb_gro_receive(struct sk_buff *p, struct sk_buff *skb) unsigned int new_truesize; struct sk_buff *lp; + if (unlikely(NAPI_GRO_CB(skb)->flush)) + return -E2BIG; + /* pairs with WRITE_ONCE() in netif_set_gro_max_size() */ gro_max_size = READ_ONCE(p->dev->gro_max_size); - if (unlikely(p->len + len >= gro_max_size || NAPI_GRO_CB(skb)->flush)) - return -E2BIG; + if (unlikely(p->len + len >= gro_max_size)) { + /* pairs with WRITE_ONCE() in netif_set_gro_ipv6_max_size() */ + unsigned int gro6_max_size = READ_ONCE(p->dev->gro_ipv6_max_size); + + if (gro6_max_size > gro_max_size && + p->protocol == htons(ETH_P_IPV6) && + skb_headroom(p) >= sizeof(struct hop_jumbo_hdr) && + ipv6_hdr(p)->nexthdr == IPPROTO_TCP && + !p->encapsulation) + gro_max_size = gro6_max_size; + + if (p->len + len >= gro_max_size) + return -E2BIG; + } + lp = NAPI_GRO_CB(p)->last; pinfo = skb_shinfo(lp); diff --git a/net/core/rtnetlink.c b/net/core/rtnetlink.c index 0a0b26261f6d9e4e40bf9cfbda31a29c1f2e3aaa..cb552d99682ab8498613f79df9bd6fbaad8c2d59 100644 --- a/net/core/rtnetlink.c +++ b/net/core/rtnetlink.c @@ -1029,6 +1029,7 @@ static noinline size_t if_nlmsg_size(const struct net_device *dev, + nla_total_size(4) /* IFLA_GRO_MAX_SIZE */ + nla_total_size(4) /* IFLA_TSO_IPV6_MAX_SIZE */ + nla_total_size(4) /* IFLA_GSO_IPV6_MAX_SIZE */ + + nla_total_size(4) /* IFLA_GRO_IPV6_MAX_SIZE */ + nla_total_size(1) /* IFLA_OPERSTATE */ + nla_total_size(1) /* IFLA_LINKMODE */ + nla_total_size(4) /* IFLA_CARRIER_CHANGES */ @@ -1734,6 +1735,7 @@ static int rtnl_fill_ifinfo(struct sk_buff *skb, nla_put_u32(skb, IFLA_GRO_MAX_SIZE, dev->gro_max_size) || nla_put_u32(skb, IFLA_TSO_IPV6_MAX_SIZE, dev->tso_ipv6_max_size) || nla_put_u32(skb, IFLA_GSO_IPV6_MAX_SIZE, dev->gso_ipv6_max_size) || + nla_put_u32(skb, IFLA_GRO_IPV6_MAX_SIZE, dev->gro_ipv6_max_size) || #ifdef CONFIG_RPS nla_put_u32(skb, IFLA_NUM_RX_QUEUES, dev->num_rx_queues) || #endif @@ -1889,6 +1891,7 @@ static const struct nla_policy ifla_policy[IFLA_MAX+1] = { [IFLA_GRO_MAX_SIZE] = { .type = NLA_U32 }, [IFLA_TSO_IPV6_MAX_SIZE] = { .type = NLA_U32 }, [IFLA_GSO_IPV6_MAX_SIZE] = { .type = NLA_U32 }, + [IFLA_GRO_IPV6_MAX_SIZE] = { .type = NLA_U32 }, }; static const struct nla_policy ifla_info_policy[IFLA_INFO_MAX+1] = { @@ -2784,6 +2787,15 @@ static int do_setlink(const struct sk_buff *skb, } } + if (tb[IFLA_GRO_IPV6_MAX_SIZE]) { + u32 max_size = nla_get_u32(tb[IFLA_GRO_IPV6_MAX_SIZE]); + + if (dev->gro_ipv6_max_size ^ max_size) { + netif_set_gro_ipv6_max_size(dev, max_size); + status |= DO_SETLINK_MODIFIED; + } + } + if (tb[IFLA_GSO_MAX_SEGS]) { u32 max_segs = nla_get_u32(tb[IFLA_GSO_MAX_SEGS]); @@ -3262,6 +3274,9 @@ struct net_device *rtnl_create_link(struct net *net, const char *ifname, if (tb[IFLA_GSO_IPV6_MAX_SIZE]) netif_set_gso_ipv6_max_size(dev, nla_get_u32(tb[IFLA_GSO_IPV6_MAX_SIZE])); + if (tb[IFLA_GRO_IPV6_MAX_SIZE]) + netif_set_gro_ipv6_max_size(dev, + nla_get_u32(tb[IFLA_GRO_IPV6_MAX_SIZE])); return dev; } diff --git a/tools/include/uapi/linux/if_link.h b/tools/include/uapi/linux/if_link.h index 024b3bd0467e1360917001dba6bcfd1f30391894..48fe85bed4a629df0dd7cc0ee3a5139370e2c94d 100644 --- a/tools/include/uapi/linux/if_link.h +++ b/tools/include/uapi/linux/if_link.h @@ -350,6 +350,7 @@ enum { IFLA_GRO_MAX_SIZE, IFLA_TSO_IPV6_MAX_SIZE, IFLA_GSO_IPV6_MAX_SIZE, + IFLA_GRO_IPV6_MAX_SIZE, __IFLA_MAX }; From patchwork Thu Feb 3 01:51:33 2022 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Eric Dumazet X-Patchwork-Id: 12733737 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 7E4E7C433EF for ; Thu, 3 Feb 2022 01:52:15 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1348890AbiBCBwN (ORCPT ); Wed, 2 Feb 2022 20:52:13 -0500 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:58138 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1348901AbiBCBwH (ORCPT ); Wed, 2 Feb 2022 20:52:07 -0500 Received: from mail-pl1-x631.google.com (mail-pl1-x631.google.com [IPv6:2607:f8b0:4864:20::631]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 3EAD9C061401 for ; Wed, 2 Feb 2022 17:52:07 -0800 (PST) Received: by mail-pl1-x631.google.com with SMTP id h14so895426plf.1 for ; Wed, 02 Feb 2022 17:52:07 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20210112; h=from:to:cc:subject:date:message-id:in-reply-to:references :mime-version:content-transfer-encoding; bh=lS50yp83p+SNj0vDZeMAmBxyMqJlbsYaYv7jsnPoMd0=; b=j8tH7nnRNC6LIo/txtZGoRt/nMFML/wLtXtNsVPey1dePxRhpCqsi/juYBkV17nirL ucos68b0Ft1+FIDz3HcNX6iu35clWZ+Xg4tQ0eXXeEvp/AB77hYX8paXF5Ne4YVZ86IT AJoN1hirpFwWffSnUWdGm2VXqNVNLWXUqkzNKayab5N7uEQ/uAqOLAxkcg9Mg87uqhAN X9ZqAlmr49F6SBwvY1w9XG/OcUuWdjFhADNtkhFN47oyXGoPdl1DnFd3ZlZiZzm/IlkX FO1cFehyYDcxKDs6Uyi0SJWXAH/aMaame2rcnkgwMFY2zrb2jd9noDrHJzrePS0OqqVb pukQ== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20210112; h=x-gm-message-state:from:to:cc:subject:date:message-id:in-reply-to :references:mime-version:content-transfer-encoding; bh=lS50yp83p+SNj0vDZeMAmBxyMqJlbsYaYv7jsnPoMd0=; b=28oGExnPv42WFEOWGmIYvZTXtxPGrNQKb8I/VWH8AkuvTLTbTmiN1Ej21Epz2S6j8U 8OAmasFQ3P1vPTDwZoYlrDBgE/TV6twcV0hUW176PvjfgJJBuoZx4g+0u99CagnNJk5A rK7m1QxDl1/Mk5HhlmtBbQmF69Iz3AmtWXMwUULj674KxAje/RdoeaJzniXkbqd01vpE /eeGoGwx0p76llaOWlylqza6YVXEbIawactUoWc7AxQID/6/BjaxpOhMAUQ7GSMq4LF7 3loQ13Qdthifedja0bfkKc/qT9Af4nswfdpQ9Dc2Xd4sgxy85PXJFROQSc5PdUJJ/QYF q3XA== X-Gm-Message-State: AOAM5301jU4czoPolf5DxEOZKF0gj0Mjmdu/2p+oYF3HLIdkY172vnes l6W7l87v8mz8ve9a/XZwn34= X-Google-Smtp-Source: ABdhPJyDUfLrLqVScSpRRpjinb4s6AOW0iltZzEeyXnH5Yf9vGaY0urZDMd4hWjN9/41jauVGfe5Fw== X-Received: by 2002:a17:903:188:: with SMTP id z8mr32956020plg.61.1643853126806; Wed, 02 Feb 2022 17:52:06 -0800 (PST) Received: from edumazet1.svl.corp.google.com ([2620:15c:2c4:201:697a:fa00:b793:ed3a]) by smtp.gmail.com with ESMTPSA id qe16sm509611pjb.22.2022.02.02.17.52.06 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Wed, 02 Feb 2022 17:52:06 -0800 (PST) From: Eric Dumazet To: "David S . Miller" , Jakub Kicinski Cc: netdev , Eric Dumazet , Coco Li , Eric Dumazet Subject: [PATCH net-next 08/15] ipv6: Add hop-by-hop header to jumbograms in ip6_output Date: Wed, 2 Feb 2022 17:51:33 -0800 Message-Id: <20220203015140.3022854-9-eric.dumazet@gmail.com> X-Mailer: git-send-email 2.35.0.rc2.247.g8bbb082509-goog In-Reply-To: <20220203015140.3022854-1-eric.dumazet@gmail.com> References: <20220203015140.3022854-1-eric.dumazet@gmail.com> MIME-Version: 1.0 Precedence: bulk List-ID: X-Mailing-List: netdev@vger.kernel.org X-Patchwork-Delegate: kuba@kernel.org From: Coco Li Instead of simply forcing a 0 payload_len in IPv6 header, implement RFC 2675 and insert a custom extension header. Note that only TCP stack is currently potentially generating jumbograms, and that this extension header is purely local, it wont be sent on a physical link. This is needed so that packet capture (tcpdump and friends) can properly dissect these large packets. Signed-off-by: Coco Li Signed-off-by: Eric Dumazet --- include/linux/ipv6.h | 1 + net/ipv6/ip6_output.c | 22 ++++++++++++++++++++-- 2 files changed, 21 insertions(+), 2 deletions(-) diff --git a/include/linux/ipv6.h b/include/linux/ipv6.h index 1e0f8a31f3de175659dca9ecee9f97d8b01e2b68..d3fb87e1589997570cde9cb5d92b2222008a229d 100644 --- a/include/linux/ipv6.h +++ b/include/linux/ipv6.h @@ -144,6 +144,7 @@ struct inet6_skb_parm { #define IP6SKB_L3SLAVE 64 #define IP6SKB_JUMBOGRAM 128 #define IP6SKB_SEG6 256 +#define IP6SKB_FAKEJUMBO 512 }; #if defined(CONFIG_NET_L3_MASTER_DEV) diff --git a/net/ipv6/ip6_output.c b/net/ipv6/ip6_output.c index 0c6c971ce0a58b50f8a9349b8507dffac9c7818c..f78ba145620560e5d7cb25aaf16fec61ddd9ed40 100644 --- a/net/ipv6/ip6_output.c +++ b/net/ipv6/ip6_output.c @@ -180,7 +180,9 @@ static int __ip6_finish_output(struct net *net, struct sock *sk, struct sk_buff #endif mtu = ip6_skb_dst_mtu(skb); - if (skb_is_gso(skb) && !skb_gso_validate_network_len(skb, mtu)) + if (skb_is_gso(skb) && + !(IP6CB(skb)->flags & IP6SKB_FAKEJUMBO) && + !skb_gso_validate_network_len(skb, mtu)) return ip6_finish_output_gso_slowpath_drop(net, sk, skb, mtu); if ((skb->len > mtu && !skb_is_gso(skb)) || @@ -251,6 +253,8 @@ int ip6_xmit(const struct sock *sk, struct sk_buff *skb, struct flowi6 *fl6, struct dst_entry *dst = skb_dst(skb); struct net_device *dev = dst->dev; struct inet6_dev *idev = ip6_dst_idev(dst); + struct hop_jumbo_hdr *hop_jumbo; + int hoplen = sizeof(*hop_jumbo); unsigned int head_room; struct ipv6hdr *hdr; u8 proto = fl6->flowi6_proto; @@ -258,7 +262,7 @@ int ip6_xmit(const struct sock *sk, struct sk_buff *skb, struct flowi6 *fl6, int hlimit = -1; u32 mtu; - head_room = sizeof(struct ipv6hdr) + LL_RESERVED_SPACE(dev); + head_room = sizeof(struct ipv6hdr) + hoplen + LL_RESERVED_SPACE(dev); if (opt) head_room += opt->opt_nflen + opt->opt_flen; @@ -281,6 +285,20 @@ int ip6_xmit(const struct sock *sk, struct sk_buff *skb, struct flowi6 *fl6, &fl6->saddr); } + if (unlikely(seg_len > IPV6_MAXPLEN)) { + hop_jumbo = skb_push(skb, hoplen); + + hop_jumbo->nexthdr = proto; + hop_jumbo->hdrlen = 0; + hop_jumbo->tlv_type = IPV6_TLV_JUMBO; + hop_jumbo->tlv_len = 4; + hop_jumbo->jumbo_payload_len = htonl(seg_len + hoplen); + + proto = IPPROTO_HOPOPTS; + seg_len = 0; + IP6CB(skb)->flags |= IP6SKB_FAKEJUMBO; + } + skb_push(skb, sizeof(struct ipv6hdr)); skb_reset_network_header(skb); hdr = ipv6_hdr(skb); From patchwork Thu Feb 3 01:51:34 2022 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Eric Dumazet X-Patchwork-Id: 12733738 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 E8839C433EF for ; Thu, 3 Feb 2022 01:52:17 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1348904AbiBCBwO (ORCPT ); Wed, 2 Feb 2022 20:52:14 -0500 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:58154 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1348908AbiBCBwK (ORCPT ); Wed, 2 Feb 2022 20:52:10 -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 5F871C061748 for ; Wed, 2 Feb 2022 17:52:09 -0800 (PST) Received: by mail-pj1-x1029.google.com with SMTP id p12-20020a17090a2d8c00b001b833dec394so1443920pjd.0 for ; Wed, 02 Feb 2022 17:52:09 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20210112; h=from:to:cc:subject:date:message-id:in-reply-to:references :mime-version:content-transfer-encoding; bh=d/B0d3cGtclr+pLkrCyge6p5gEccpZdBGmC47ldZYSc=; b=kq8P73474SO0VbumbnofY4G5ocZu+s2760zWjGKmjwexSZeC0bEfFLuvfhyWLTo8E6 +VWjA3px8xU85iU8uKeXSTDJkdHiFToTTQlZlu/s9sQdmlUUmRsqdYg1S1yznlbd1L+Q fY0+Odifq47dHJCJgMK5ZgYYwnqN+ahr9UxCjt6TSet3tuqj+RPPlpgcyd5BK+p1GOlr EDC8JE8tXCsLB0IY/QJ0dbYRyf3jdVtfxhYrLji1SPmxvSfFH0bN8wwafOCv6gKj8Oe+ dEGxHok8iusMrQ9cbqK10cyGcpmJKOInNRQkBWErku+veY/TJwJQSpZYn9v8PIavfZhn 3ZcQ== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20210112; h=x-gm-message-state:from:to:cc:subject:date:message-id:in-reply-to :references:mime-version:content-transfer-encoding; bh=d/B0d3cGtclr+pLkrCyge6p5gEccpZdBGmC47ldZYSc=; b=DrI04tEIGjxMRcf0CnDtjdi5Imv368/ccs9c16TA5yymtGOFpydeolB7F4JQX5AK7w s7gMDP3c4bvt6B8kh7VdSwRJT/Uy+NNl2ih9OJQDhBRJIbPup/zS0mDlNEtqDNtbidPW ZGP/ZPefy05tpqsTG+kR+byWGCD2ZK6sVVK6s5ynPrQ5jweYsutZulcU7LUGpxyxSpyT wrVCjv+70g/x/GlTsewl8ruyxptDX0AIaIVW5Ykd5gLV2DE1d7W6PCOfvZ7HrEA4BT0H fbp4DxMzm4EjNIMHISToLuUFYNDc064Vbw/9Dwb29SNK4BzgM5YD8Vay3DhiU3UgO6Xi dMlw== X-Gm-Message-State: AOAM530f2nPiihdZlgTi+Em8Bnj75YuleaWA7v0GFtBNAk0RzC0X/D2e 21Y6SlARBvuXmsVRv4DHrvQ= X-Google-Smtp-Source: ABdhPJwbVljup/k4R/MRGAoU0NBZUOYBt+oNwgyfbn3DZMLy2yWQmgIQkE7Ql4VpN7r9v/xrmkC6rA== X-Received: by 2002:a17:902:ce81:: with SMTP id f1mr1715163plg.86.1643853128946; Wed, 02 Feb 2022 17:52:08 -0800 (PST) Received: from edumazet1.svl.corp.google.com ([2620:15c:2c4:201:697a:fa00:b793:ed3a]) by smtp.gmail.com with ESMTPSA id qe16sm509611pjb.22.2022.02.02.17.52.08 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Wed, 02 Feb 2022 17:52:08 -0800 (PST) From: Eric Dumazet To: "David S . Miller" , Jakub Kicinski Cc: netdev , Eric Dumazet , Coco Li , Eric Dumazet Subject: [PATCH net-next 09/15] net: increase MAX_SKB_FRAGS Date: Wed, 2 Feb 2022 17:51:34 -0800 Message-Id: <20220203015140.3022854-10-eric.dumazet@gmail.com> X-Mailer: git-send-email 2.35.0.rc2.247.g8bbb082509-goog In-Reply-To: <20220203015140.3022854-1-eric.dumazet@gmail.com> References: <20220203015140.3022854-1-eric.dumazet@gmail.com> MIME-Version: 1.0 Precedence: bulk List-ID: X-Mailing-List: netdev@vger.kernel.org X-Patchwork-Delegate: kuba@kernel.org From: Eric Dumazet Currently, MAX_SKB_FRAGS value is 17. For standard tcp sendmsg() traffic, no big deal because tcp_sendmsg() attempts order-3 allocations, stuffing 32768 bytes per frag. But with zero copy, we use order-0 pages. For BIG TCP to show its full potential, we increase MAX_SKB_FRAGS to be able to fit 45 segments per skb. This is also needed for BIG TCP rx zerocopy, as zerocopy currently does not support skbs with frag list. We have used this MAX_SKB_FRAGS value for years at Google before we deployed 4K MTU, with no adverse effect. Back then, goal was to be able to receive full size (64KB) GRO packets without the frag_list overhead. Signed-off-by: Eric Dumazet Reported-by: kernel test robot Reported-by: kernel test robot Reported-by: kernel test robot --- include/linux/skbuff.h | 14 ++------------ 1 file changed, 2 insertions(+), 12 deletions(-) diff --git a/include/linux/skbuff.h b/include/linux/skbuff.h index a27bcc4f7e9a92ea4f4f4f6e5f454bb4f8099f66..08c12c41c5a5907dccc7389f396394d8132d962e 100644 --- a/include/linux/skbuff.h +++ b/include/linux/skbuff.h @@ -323,18 +323,8 @@ enum skb_drop_reason { SKB_DROP_REASON_MAX, }; -/* To allow 64K frame to be packed as single skb without frag_list we - * require 64K/PAGE_SIZE pages plus 1 additional page to allow for - * buffers which do not start on a page boundary. - * - * Since GRO uses frags we allocate at least 16 regardless of page - * size. - */ -#if (65536/PAGE_SIZE + 1) < 16 -#define MAX_SKB_FRAGS 16UL -#else -#define MAX_SKB_FRAGS (65536/PAGE_SIZE + 1) -#endif +#define MAX_SKB_FRAGS 45UL + extern int sysctl_max_skb_frags; /* Set skb_shinfo(skb)->gso_size to this in case you want skb_segment to From patchwork Thu Feb 3 01:51:35 2022 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Eric Dumazet X-Patchwork-Id: 12733739 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 12A6CC433F5 for ; Thu, 3 Feb 2022 01:52:21 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1348912AbiBCBwT (ORCPT ); Wed, 2 Feb 2022 20:52:19 -0500 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:58164 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1348913AbiBCBwL (ORCPT ); Wed, 2 Feb 2022 20:52:11 -0500 Received: from mail-pl1-x630.google.com (mail-pl1-x630.google.com [IPv6:2607:f8b0:4864:20::630]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id C2659C061714 for ; Wed, 2 Feb 2022 17:52:11 -0800 (PST) Received: by mail-pl1-x630.google.com with SMTP id y17so868087plg.7 for ; Wed, 02 Feb 2022 17:52:11 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20210112; h=from:to:cc:subject:date:message-id:in-reply-to:references :mime-version:content-transfer-encoding; bh=YJi20HQbzfm86dsWjXJgpren2dWXrhVIdEL3wMBAbck=; b=CI9FD18VJ6wEKoiquYLUYWEHWra4NMRh3HeQQ0sV2U+dRCUNlaKfIVtIpA528CyRuq 58VW8inGCW/Ip+IE6Gdd3Bgqmy0Sj4O0yAtjKdf9Jl49qChFMvhPDS11e4uvmhSED/Vs 71ltIR0D9b0HiZFF4bd4+wy6255gO3p8eFLVNEZGmxpexnmjMxI+BasiV/IHv9/tOEci hpP6Ef10OH6BDch91Gmyw2xVPO+U/H6ZNL37PTuL+uhTqztfnIwc22c+L7xsVNP7UfDW debKcFNXzqgMcxZvRIh4IAK7UcmF+xVEKVPQJYUXrVlssoeqmqZ8SrEezMelDVK6k2VQ xwgQ== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20210112; h=x-gm-message-state:from:to:cc:subject:date:message-id:in-reply-to :references:mime-version:content-transfer-encoding; bh=YJi20HQbzfm86dsWjXJgpren2dWXrhVIdEL3wMBAbck=; b=g1RxQQfFKm3h8tSzRZXPrToXDapsuY1MLaqtGct9C2Q/+2pKVjtYO0DyjwBwZPnDzz cIG2Qf9HGx/dtKop2ZRYISo6p5/GM7nzds0j93XHXCy9/hEKu1Jkwf+NIx8isqA1exV2 tcq3w44EPNbNmt9CHVKyPJxepzDhlabj7h5+NvQ0vlEf/uBst9wFDQw5b4yahtmq5LN4 +Hr0+ztdNUb+asExlfZVukHl7CuKRgYhfV/IEDk0nIfnCXXONPOs8RTqgMIH6uqN5UEj uQypcaQR6qmSRz4wE+BxRBVxPk2GDNAGFmfRIc28HLYapoI8nlXyKQLU0NnI231WsqlY Kszg== X-Gm-Message-State: AOAM530itEHl+jKjbbWv+29yqop6dB7cTEqzECTAMWSUEYAZB3q46RNf tCXHbgMmDk23vJgprkRTWNQ= X-Google-Smtp-Source: ABdhPJys+iStG+5xPRgtbPJn+DhZBQqYavhgjqTusNzQncizZYHTqK1oMK0dE6KSkBeS8RRdDjSh/A== X-Received: by 2002:a17:903:124e:: with SMTP id u14mr34146902plh.57.1643853131367; Wed, 02 Feb 2022 17:52:11 -0800 (PST) Received: from edumazet1.svl.corp.google.com ([2620:15c:2c4:201:697a:fa00:b793:ed3a]) by smtp.gmail.com with ESMTPSA id qe16sm509611pjb.22.2022.02.02.17.52.10 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Wed, 02 Feb 2022 17:52:11 -0800 (PST) From: Eric Dumazet To: "David S . Miller" , Jakub Kicinski Cc: netdev , Eric Dumazet , Coco Li , Eric Dumazet Subject: [PATCH net-next 10/15] net: loopback: enable BIG TCP packets Date: Wed, 2 Feb 2022 17:51:35 -0800 Message-Id: <20220203015140.3022854-11-eric.dumazet@gmail.com> X-Mailer: git-send-email 2.35.0.rc2.247.g8bbb082509-goog In-Reply-To: <20220203015140.3022854-1-eric.dumazet@gmail.com> References: <20220203015140.3022854-1-eric.dumazet@gmail.com> MIME-Version: 1.0 Precedence: bulk List-ID: X-Mailing-List: netdev@vger.kernel.org X-Patchwork-Delegate: kuba@kernel.org From: Eric Dumazet Set the driver limit to 512 KB per TSO ipv6 packet. This allows the admin/user to set a GSO ipv6 limit up to this value. Tested: ip link set dev lo gso_ipv6_max_size 200000 netperf -H ::1 -t TCP_RR -l 100 -- -r 80000,80000 & tcpdump shows : 18:28:42.962116 IP6 ::1 > ::1: HBH 40051 > 63780: Flags [P.], seq 3626480001:3626560001, ack 3626560001, win 17743, options [nop,nop,TS val 3771179265 ecr 3771179265], length 80000 18:28:42.962138 IP6 ::1.63780 > ::1.40051: Flags [.], ack 3626560001, win 17743, options [nop,nop,TS val 3771179265 ecr 3771179265], length 0 18:28:42.962152 IP6 ::1 > ::1: HBH 63780 > 40051: Flags [P.], seq 3626560001:3626640001, ack 3626560001, win 17743, options [nop,nop,TS val 3771179265 ecr 3771179265], length 80000 18:28:42.962157 IP6 ::1.40051 > ::1.63780: Flags [.], ack 3626640001, win 17743, options [nop,nop,TS val 3771179265 ecr 3771179265], length 0 18:28:42.962180 IP6 ::1 > ::1: HBH 40051 > 63780: Flags [P.], seq 3626560001:3626640001, ack 3626640001, win 17743, options [nop,nop,TS val 3771179265 ecr 3771179265], length 80000 18:28:42.962214 IP6 ::1.63780 > ::1.40051: Flags [.], ack 3626640001, win 17743, options [nop,nop,TS val 3771179266 ecr 3771179265], length 0 18:28:42.962228 IP6 ::1 > ::1: HBH 63780 > 40051: Flags [P.], seq 3626640001:3626720001, ack 3626640001, win 17743, options [nop,nop,TS val 3771179266 ecr 3771179265], length 80000 18:28:42.962233 IP6 ::1.40051 > ::1.63780: Flags [.], ack 3626720001, win 17743, options [nop,nop,TS val 3771179266 ecr 3771179266], length 0 Signed-off-by: Eric Dumazet --- drivers/net/loopback.c | 2 ++ 1 file changed, 2 insertions(+) diff --git a/drivers/net/loopback.c b/drivers/net/loopback.c index ed0edf5884ef85bf49534ff85b7dca3d9c6aa3ab..0adb2eaaf6112d83ce067e49a4b62a28a67bfcf4 100644 --- a/drivers/net/loopback.c +++ b/drivers/net/loopback.c @@ -191,6 +191,8 @@ static void gen_lo_setup(struct net_device *dev, dev->netdev_ops = dev_ops; dev->needs_free_netdev = true; dev->priv_destructor = dev_destructor; + + netif_set_tso_ipv6_max_size(dev, 512 * 1024); } /* The loopback device is special. There is only one instance From patchwork Thu Feb 3 01:51:36 2022 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Eric Dumazet X-Patchwork-Id: 12733740 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 45AB2C433EF for ; Thu, 3 Feb 2022 01:52:22 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1348931AbiBCBwU (ORCPT ); Wed, 2 Feb 2022 20:52:20 -0500 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:58150 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1348900AbiBCBwN (ORCPT ); Wed, 2 Feb 2022 20:52:13 -0500 Received: from mail-pj1-x1031.google.com (mail-pj1-x1031.google.com [IPv6:2607:f8b0:4864:20::1031]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id C54BCC06173D for ; Wed, 2 Feb 2022 17:52:13 -0800 (PST) Received: by mail-pj1-x1031.google.com with SMTP id v15-20020a17090a4ecf00b001b82db48754so1402197pjl.2 for ; Wed, 02 Feb 2022 17:52:13 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20210112; h=from:to:cc:subject:date:message-id:in-reply-to:references :mime-version:content-transfer-encoding; bh=HzBw9wI4YOWb+xFcRynntKbTVdRkS0O/y9EKMzYz8AE=; b=ZkK2UIAswCt9BgvqHxc24iqHBPWD4CWvQ1gi/0PlijwpK/j+SWff7Bl+e1xY+LHAT0 dhBYOxhVPl8VwbvH02kUHUggQP+6tRcegBCzID8zG4tnpRIW7kpkFxxEcD6YuUkEcLVI 31GfN5pC5NHhx7qTCJXC8dEPRRWgFCCB5sJj37gpmJCAP7c4H87Hz2zbxw4Bk3vrLsir ceE8JAQScC60JPa6HAmuazIzVK2Q98FPuZwtLEnM7Wxb290l73GIU9Km9+nxlRpJYU70 wunf4+2eUBmjDRQW0mmv+EPYDLqKy8crC3xb3DnlziNG1GL96Bdzxak8NxuIkGzpmfp9 5yhQ== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20210112; h=x-gm-message-state:from:to:cc:subject:date:message-id:in-reply-to :references:mime-version:content-transfer-encoding; bh=HzBw9wI4YOWb+xFcRynntKbTVdRkS0O/y9EKMzYz8AE=; b=Vvz2EjtUJFsq+1pNbhem1kWDpDJw4w30b/pdJNw6e7ShiuxzfMotjmFOp5QOvl5TZF YeAOUcuKoXKNk4dkRuf+GCnJLLtUvzJterRrspLU9ZUIsjyLKucjJUI95z025AJrhi23 4h0RJ8RwNFIPpajL52BEy8R1aLwI3RY6/FwyChkVaDf+oxgGj9MIQpIneETQ2JZ4sqW9 hqVLJyB1j80voqfGASCX2JFb36L2LCfHHZbUx+HdLJOSBC7yqPMREX2dchD1XRavLk0g RLXvzz+BETiIn6Eo1GkmEdrdEedgQtWJE625gxTibmZvYeGoI6cW6SIvI7SE98q+bGzy eAIA== X-Gm-Message-State: AOAM532W7cq5jiipl32VlQO6NXZQ99t65dJ7DFAhnH5vWiuYQ9UJfGyi a55VakIPa/yBhp74BTjDoiI= X-Google-Smtp-Source: ABdhPJz5UUCi0WiJaNFjnZj4ldgqZ/eo37jSX0mU34OjQf4K09ESUXtvCtJuZT6EY7od9Hbo+TWLPQ== X-Received: by 2002:a17:902:bc83:: with SMTP id bb3mr34258798plb.172.1643853133382; Wed, 02 Feb 2022 17:52:13 -0800 (PST) Received: from edumazet1.svl.corp.google.com ([2620:15c:2c4:201:697a:fa00:b793:ed3a]) by smtp.gmail.com with ESMTPSA id qe16sm509611pjb.22.2022.02.02.17.52.12 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Wed, 02 Feb 2022 17:52:13 -0800 (PST) From: Eric Dumazet To: "David S . Miller" , Jakub Kicinski Cc: netdev , Eric Dumazet , Coco Li , Eric Dumazet Subject: [PATCH net-next 11/15] bonding: update dev->tso_ipv6_max_size Date: Wed, 2 Feb 2022 17:51:36 -0800 Message-Id: <20220203015140.3022854-12-eric.dumazet@gmail.com> X-Mailer: git-send-email 2.35.0.rc2.247.g8bbb082509-goog In-Reply-To: <20220203015140.3022854-1-eric.dumazet@gmail.com> References: <20220203015140.3022854-1-eric.dumazet@gmail.com> MIME-Version: 1.0 Precedence: bulk List-ID: X-Mailing-List: netdev@vger.kernel.org X-Patchwork-Delegate: kuba@kernel.org From: Eric Dumazet Use the minimal value found in the set of lower devices. Signed-off-by: Eric Dumazet --- drivers/net/bonding/bond_main.c | 3 +++ 1 file changed, 3 insertions(+) diff --git a/drivers/net/bonding/bond_main.c b/drivers/net/bonding/bond_main.c index 238b56d77c369d9595d55bc681c2191c49dd2905..053ade451ab1647dc099b7ce1cfd89c333c1b60f 100644 --- a/drivers/net/bonding/bond_main.c +++ b/drivers/net/bonding/bond_main.c @@ -1419,6 +1419,7 @@ static void bond_compute_features(struct bonding *bond) struct slave *slave; unsigned short max_hard_header_len = ETH_HLEN; unsigned int gso_max_size = GSO_MAX_SIZE; + unsigned int tso_ipv6_max_size = ~0U; u16 gso_max_segs = GSO_MAX_SEGS; if (!bond_has_slaves(bond)) @@ -1449,6 +1450,7 @@ static void bond_compute_features(struct bonding *bond) max_hard_header_len = slave->dev->hard_header_len; gso_max_size = min(gso_max_size, slave->dev->gso_max_size); + tso_ipv6_max_size = min(tso_ipv6_max_size, slave->dev->tso_ipv6_max_size); gso_max_segs = min(gso_max_segs, slave->dev->gso_max_segs); } bond_dev->hard_header_len = max_hard_header_len; @@ -1464,6 +1466,7 @@ static void bond_compute_features(struct bonding *bond) bond_dev->mpls_features = mpls_features; netif_set_gso_max_segs(bond_dev, gso_max_segs); netif_set_gso_max_size(bond_dev, gso_max_size); + netif_set_tso_ipv6_max_size(bond_dev, tso_ipv6_max_size); bond_dev->priv_flags &= ~IFF_XMIT_DST_RELEASE; if ((bond_dev->priv_flags & IFF_XMIT_DST_RELEASE_PERM) && From patchwork Thu Feb 3 01:51:37 2022 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Eric Dumazet X-Patchwork-Id: 12733741 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 02CECC433F5 for ; Thu, 3 Feb 2022 01:52:28 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1348915AbiBCBw1 (ORCPT ); Wed, 2 Feb 2022 20:52:27 -0500 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:58180 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1348916AbiBCBwP (ORCPT ); Wed, 2 Feb 2022 20:52:15 -0500 Received: from mail-pg1-x535.google.com (mail-pg1-x535.google.com [IPv6:2607:f8b0:4864:20::535]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id D9529C06173E for ; Wed, 2 Feb 2022 17:52:15 -0800 (PST) Received: by mail-pg1-x535.google.com with SMTP id 132so1021573pga.5 for ; Wed, 02 Feb 2022 17:52:15 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20210112; h=from:to:cc:subject:date:message-id:in-reply-to:references :mime-version:content-transfer-encoding; bh=T7BnMCw0EYKUlYx7XzC8BlravVnmyJaY2eHhNbmdLJU=; b=lWiHZiB6xZ8cLCn2P+J+hBrw+PJe7Kk15a0u+5U8aR8rY0F+2OA4RrUkC21W/sdWO9 RSfWgJTT4v0oaxuyJXllHmeUyBrzwO5UXrGeyfL/I19Yf1ekXZMNhxO57jvWhR13XtYV vv7VeBd5fKIAcs59RxyPzN4B/XXJDNtwAGj9rQjAqlXGvfbMPaVwl2Emumi/UtL9g9w9 SjRggFk15UzDP//tFSxkK5lYgcmmuRDbRtq5lr/MuOMEIeaReNctdo8QljxykaGMwi/K bHXNJTh4UdaDCyqIO7JPRmJTloroZk6T5LLYjR9Z05uaf8r9hzixLAJklku4X40yhIHV zTVg== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20210112; h=x-gm-message-state:from:to:cc:subject:date:message-id:in-reply-to :references:mime-version:content-transfer-encoding; bh=T7BnMCw0EYKUlYx7XzC8BlravVnmyJaY2eHhNbmdLJU=; b=fDURg31zdRbTw2aJurLPiQA8wnA9GrezxcR4wX7cBAo01LlEyKaXqQButlZuIAzpy6 Wz0CvohtHyZ8S6LzriRCAVsXQ2yYBLr2dUfj+PtFvQDpbzNRipjar02Ohg9NTBkymw1N 1FChSADyrWna47g++K+/FD/q5tLAfE+dATM5QMi7ZbdfqU00wv5cKfirxnoMrfJ/zpk3 5VuzR6s2WKzSO1hZ/PDQtbXPQoydSejTJYNLWuJWsGcaD5/dt23ZzQfO1rz0I42vFqnc YL+rHGZ7y5aNQAZfS0FNeo6KEgI2R0BL0RK8d0NFXCPINRYjuI0jDBikuaVXlcmoG0hX 02hw== X-Gm-Message-State: AOAM5305rpEolRljQOUNJs6XV0fOqULEcdfbczG7HFHKTFH0Nl+rD2/9 CFnfK9jUMDRIRHe5poLcDDk= X-Google-Smtp-Source: ABdhPJxNMMfabFO5UX0caLTpzuuZa3LhFtusekQrJKeuW8MZGEOghlLg1jbNkSm15CJHeLFACeCs2Q== X-Received: by 2002:a63:1cd:: with SMTP id 196mr5743737pgb.312.1643853135482; Wed, 02 Feb 2022 17:52:15 -0800 (PST) Received: from edumazet1.svl.corp.google.com ([2620:15c:2c4:201:697a:fa00:b793:ed3a]) by smtp.gmail.com with ESMTPSA id qe16sm509611pjb.22.2022.02.02.17.52.14 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Wed, 02 Feb 2022 17:52:15 -0800 (PST) From: Eric Dumazet To: "David S . Miller" , Jakub Kicinski Cc: netdev , Eric Dumazet , Coco Li , Eric Dumazet Subject: [PATCH net-next 12/15] macvlan: enable BIG TCP Packets Date: Wed, 2 Feb 2022 17:51:37 -0800 Message-Id: <20220203015140.3022854-13-eric.dumazet@gmail.com> X-Mailer: git-send-email 2.35.0.rc2.247.g8bbb082509-goog In-Reply-To: <20220203015140.3022854-1-eric.dumazet@gmail.com> References: <20220203015140.3022854-1-eric.dumazet@gmail.com> MIME-Version: 1.0 Precedence: bulk List-ID: X-Mailing-List: netdev@vger.kernel.org X-Patchwork-Delegate: kuba@kernel.org From: Eric Dumazet Inherit tso_ipv6_max_size from lower device. Signed-off-by: Eric Dumazet --- drivers/net/macvlan.c | 1 + 1 file changed, 1 insertion(+) diff --git a/drivers/net/macvlan.c b/drivers/net/macvlan.c index 6ef5f77be4d0ad49b2ef1282413fa30f12072b58..ca2e828de5b09a62ebc9cf1c10506e6ecef34330 100644 --- a/drivers/net/macvlan.c +++ b/drivers/net/macvlan.c @@ -902,6 +902,7 @@ static int macvlan_init(struct net_device *dev) dev->hw_enc_features |= dev->features; netif_set_gso_max_size(dev, lowerdev->gso_max_size); netif_set_gso_max_segs(dev, lowerdev->gso_max_segs); + netif_set_tso_ipv6_max_size(dev, lowerdev->tso_ipv6_max_size); dev->hard_header_len = lowerdev->hard_header_len; macvlan_set_lockdep_class(dev); From patchwork Thu Feb 3 01:51:38 2022 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Eric Dumazet X-Patchwork-Id: 12733742 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 8BDA5C433EF for ; Thu, 3 Feb 2022 01:52:28 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1348902AbiBCBw1 (ORCPT ); Wed, 2 Feb 2022 20:52:27 -0500 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:58194 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1348924AbiBCBwS (ORCPT ); Wed, 2 Feb 2022 20:52:18 -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 ACB80C061714 for ; Wed, 2 Feb 2022 17:52:17 -0800 (PST) Received: by mail-pl1-x62d.google.com with SMTP id d18so888345plg.2 for ; Wed, 02 Feb 2022 17:52:17 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20210112; h=from:to:cc:subject:date:message-id:in-reply-to:references :mime-version:content-transfer-encoding; bh=d73mP/tslGUDeg3cwjnVJvew+HRc4poPcwpop76ku2E=; b=p2cvVd1Bq8JDzMj7nRK1m8TyTOKk07eHzY0vK2JqaBcQNEwLSCHave8Mp6ULm5/Kfo a1sPocW2kXGbKbwFNnBinAkRoOiqF/x+ZC5XWA2QHHq7t/aXdiOun946ZmuhyzxpJeQR Ph0D5CnXBQpXarx4lIsgUNL7c+BXvKek+7JIEeBZO6+fM2Bt5XAIXKurpDSgHwuYypB5 PB3gmgWCTSVTMPqEaANcWieYDf7KomTrWLI3R61TEsFVPSNbl9ip/tGIHlRVbr//wbhd 4jaArfxFpWp8qWqwwAfB6f3H/qgcy47gif+WQqER6HryZwt97Mf2/wZk0bXZrKApMFKz 5ZvA== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20210112; h=x-gm-message-state:from:to:cc:subject:date:message-id:in-reply-to :references:mime-version:content-transfer-encoding; bh=d73mP/tslGUDeg3cwjnVJvew+HRc4poPcwpop76ku2E=; b=suzllBrN6IPWL8/1hKjAFxJ8itWzOtplJ64XFrsAy1JX9gp3Wh5Tm1hMn5r78x0p/6 kGsff/C76q5lBK/88NRZKEjBgsfeMbUCtef4+/rDeBMCC+uUcIMbkNcWyosy3gnhA3ce 3s8IekpRxutAMCGvSK91ZMfOywEAfYhjh4wkqEZ4wnDWCplMDYfwDY1L7ePbn70zV90Z MICV5QJnf4tuywPmrUM69VqtEkd4x2eBeu6xiRDZSqNqX65U2f07bAyxkm0kcbadVZRT KfbUreFM6UnB0sqV8m9LPLDuHZu++UXghY5iFhBmJrO2hQugF+VtcBjiRHug23Y5mPeH ft+w== X-Gm-Message-State: AOAM531xfK9TA2LxctzuePe1Zn3xMthUknnnYLy1FuYloMoHOMJ+2V7K KjM4909HsYvnwA/Sv+SYm6U= X-Google-Smtp-Source: ABdhPJxBZGVnFuxHx3JsChhC/FrML55DOgNHubtg2cbwDdilb7VWRiH9nZhTRnm+AApqkYYoOheIpg== X-Received: by 2002:a17:902:7c02:: with SMTP id x2mr32427558pll.47.1643853137296; Wed, 02 Feb 2022 17:52:17 -0800 (PST) Received: from edumazet1.svl.corp.google.com ([2620:15c:2c4:201:697a:fa00:b793:ed3a]) by smtp.gmail.com with ESMTPSA id qe16sm509611pjb.22.2022.02.02.17.52.16 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Wed, 02 Feb 2022 17:52:17 -0800 (PST) From: Eric Dumazet To: "David S . Miller" , Jakub Kicinski Cc: netdev , Eric Dumazet , Coco Li , Eric Dumazet Subject: [PATCH net-next 13/15] ipvlan: enable BIG TCP Packets Date: Wed, 2 Feb 2022 17:51:38 -0800 Message-Id: <20220203015140.3022854-14-eric.dumazet@gmail.com> X-Mailer: git-send-email 2.35.0.rc2.247.g8bbb082509-goog In-Reply-To: <20220203015140.3022854-1-eric.dumazet@gmail.com> References: <20220203015140.3022854-1-eric.dumazet@gmail.com> MIME-Version: 1.0 Precedence: bulk List-ID: X-Mailing-List: netdev@vger.kernel.org X-Patchwork-Delegate: kuba@kernel.org From: Coco Li Inherit tso_ipv6_max_size from physical device. Tested: eth0 tso_ipv6_max_size is set to 524288 ip link add link eth0 name ipvl1 type ipvlan ip -d link show ipvl1 10: ipvl1@eth0:... ipvlan mode l3 bridge addrgenmode eui64 numtxqueues 1 numrxqueues 1 gso_max_size 65536 gso_max_segs 65535 gro_max_size 65536 gso_ipv6_max_size 65535 tso_ipv6_max_size 524288 gro_ipv6_max_size 65536 Signed-off-by: Coco Li Signed-off-by: Eric Dumazet --- drivers/net/ipvlan/ipvlan_main.c | 1 + 1 file changed, 1 insertion(+) diff --git a/drivers/net/ipvlan/ipvlan_main.c b/drivers/net/ipvlan/ipvlan_main.c index 696e245f6d009d4d5d4a9c3523e4aa1e5d0f8bb6..4de30df25f19b32a78a06d18c99e94662307b7fb 100644 --- a/drivers/net/ipvlan/ipvlan_main.c +++ b/drivers/net/ipvlan/ipvlan_main.c @@ -141,6 +141,7 @@ static int ipvlan_init(struct net_device *dev) dev->hw_enc_features |= dev->features; netif_set_gso_max_size(dev, phy_dev->gso_max_size); netif_set_gso_max_segs(dev, phy_dev->gso_max_segs); + netif_set_tso_ipv6_max_size(dev, phy_dev->tso_ipv6_max_size); dev->hard_header_len = phy_dev->hard_header_len; netdev_lockdep_set_classes(dev); From patchwork Thu Feb 3 01:51:39 2022 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Eric Dumazet X-Patchwork-Id: 12733743 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 EA176C433FE for ; Thu, 3 Feb 2022 01:52:29 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S234221AbiBCBw2 (ORCPT ); Wed, 2 Feb 2022 20:52:28 -0500 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:58208 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1348899AbiBCBwT (ORCPT ); Wed, 2 Feb 2022 20:52:19 -0500 Received: from mail-pf1-x42e.google.com (mail-pf1-x42e.google.com [IPv6:2607:f8b0:4864:20::42e]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id CC9A0C06174E for ; Wed, 2 Feb 2022 17:52:19 -0800 (PST) Received: by mail-pf1-x42e.google.com with SMTP id e28so915682pfj.5 for ; Wed, 02 Feb 2022 17:52:19 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20210112; h=from:to:cc:subject:date:message-id:in-reply-to:references :mime-version:content-transfer-encoding; bh=Whx1xUX7BipnQyYzQ0qIm3Bt6BwvkXA771DSm71Btnc=; b=EPG5TwhVPZEFDquT32VSQdBWzl1Js7JsD/a/ge3gBDLjllB4Rk1puiQ6OzO+CvGw6u q2yUMR6Qr7mmZxtuQvoPXdUWPAQCBTlShNi6S7Z3u4LyIMDW1e/VwMa/EGMaiqG8GnPD Blwb/g8AE/h13+bJMKfgJNAq/9i9sBVHKhXCxAQ6q6ZCAwnI8SVhJIKKkyWSKPlK4uDh OAs82K9fc0ZAnwNoFucHCfrljFwfIZ64zrOVQdAUuSakqfplbh87xzilbCe3x4awKWgl zJbeXrKBVir6l7tQ1i0BhweuOqe1TooA1uvW1VaF3Mg5Sy8HVYaVSGhy1PplAzuF2jB0 yBzA== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20210112; h=x-gm-message-state:from:to:cc:subject:date:message-id:in-reply-to :references:mime-version:content-transfer-encoding; bh=Whx1xUX7BipnQyYzQ0qIm3Bt6BwvkXA771DSm71Btnc=; b=a7T805Z2gM+Z2u1YAQZ+6Rp/pUAjXrCm3sFCRKqqljyAkWwVm/D1qAzK55NcRddCEg z09IJ5IMVWmDh86pv5vUbaQthra+Y8X1h7SqWoPyVhaDiLLweYiOE4pzFp4/j1+XAF3a OzL/6k/zZfNofR5kHiFj1uvzYadwP/uL859UKuOeikGFxndiHlDDDUBzxZzpDGZBQ4ON Xkya0hssNr1hCw/0ziJyB08ofvV9QYmyojvN/NK14Qry9NCrMtf8rSRGdFd4ZmKD6WWo pWB9zUBwK8HGoKmylgWhN3KJz+6H2BB7N+vHR+z0AGAzWoEH1zwnrCfov7WjEiuxvGYa KxSA== X-Gm-Message-State: AOAM5325aKi1zXjgAP9Cyt4Ui60amaNLHtbbwG8aVckIne/wXtrQkUCN Ieukln1DlIguGkKslmn2Gk8= X-Google-Smtp-Source: ABdhPJz1cM/XAxMrfBZBRWK/w2LAb21hmEF+Ro+kfqMAgW0TAnZLOQobUkyqrHTxbAyKVa+0SuzIDQ== X-Received: by 2002:a63:9346:: with SMTP id w6mr26859362pgm.65.1643853139296; Wed, 02 Feb 2022 17:52:19 -0800 (PST) Received: from edumazet1.svl.corp.google.com ([2620:15c:2c4:201:697a:fa00:b793:ed3a]) by smtp.gmail.com with ESMTPSA id qe16sm509611pjb.22.2022.02.02.17.52.18 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Wed, 02 Feb 2022 17:52:19 -0800 (PST) From: Eric Dumazet To: "David S . Miller" , Jakub Kicinski Cc: netdev , Eric Dumazet , Coco Li , Eric Dumazet , Tariq Toukan Subject: [PATCH net-next 14/15] mlx4: support BIG TCP packets Date: Wed, 2 Feb 2022 17:51:39 -0800 Message-Id: <20220203015140.3022854-15-eric.dumazet@gmail.com> X-Mailer: git-send-email 2.35.0.rc2.247.g8bbb082509-goog In-Reply-To: <20220203015140.3022854-1-eric.dumazet@gmail.com> References: <20220203015140.3022854-1-eric.dumazet@gmail.com> MIME-Version: 1.0 Precedence: bulk List-ID: X-Mailing-List: netdev@vger.kernel.org X-Patchwork-Delegate: kuba@kernel.org From: Eric Dumazet mlx4 supports LSOv2 just fine. IPv6 stack inserts a temporary Hop-by-Hop header with JUMBO TLV for big packets. We need to ignore the HBH header when populating TX descriptor. Tested: Before: (not enabling bigger TSO/GRO packets) ip link set dev eth0 gso_ipv6_max_size 65536 gro_ipv6_max_size 65536 netperf -H lpaa18 -t TCP_RR -T2,2 -l 10 -Cc -- -r 70000,70000 MIGRATED TCP REQUEST/RESPONSE TEST from ::0 (::) port 0 AF_INET6 to lpaa18.prod.google.com () port 0 AF_INET6 : first burst 0 : cpu bind Local /Remote Socket Size Request Resp. Elapsed Trans. CPU CPU S.dem S.dem Send Recv Size Size Time Rate local remote local remote bytes bytes bytes bytes secs. per sec % S % S us/Tr us/Tr 262144 540000 70000 70000 10.00 6591.45 0.86 1.34 62.490 97.446 262144 540000 After: (enabling bigger TSO/GRO packets) ip link set dev eth0 gso_ipv6_max_size 185000 gro_ipv6_max_size 185000 netperf -H lpaa18 -t TCP_RR -T2,2 -l 10 -Cc -- -r 70000,70000 MIGRATED TCP REQUEST/RESPONSE TEST from ::0 (::) port 0 AF_INET6 to lpaa18.prod.google.com () port 0 AF_INET6 : first burst 0 : cpu bind Local /Remote Socket Size Request Resp. Elapsed Trans. CPU CPU S.dem S.dem Send Recv Size Size Time Rate local remote local remote bytes bytes bytes bytes secs. per sec % S % S us/Tr us/Tr 262144 540000 70000 70000 10.00 8383.95 0.95 1.01 54.432 57.584 262144 540000 Signed-off-by: Eric Dumazet Cc: Tariq Toukan --- .../net/ethernet/mellanox/mlx4/en_netdev.c | 3 ++ drivers/net/ethernet/mellanox/mlx4/en_tx.c | 47 +++++++++++++++---- 2 files changed, 41 insertions(+), 9 deletions(-) diff --git a/drivers/net/ethernet/mellanox/mlx4/en_netdev.c b/drivers/net/ethernet/mellanox/mlx4/en_netdev.c index c61dc7ae0c056a4dbcf24297549f6b1b5cc25d92..76cb93f5e5240c54f6f4c57e39739376206b4f34 100644 --- a/drivers/net/ethernet/mellanox/mlx4/en_netdev.c +++ b/drivers/net/ethernet/mellanox/mlx4/en_netdev.c @@ -3417,6 +3417,9 @@ int mlx4_en_init_netdev(struct mlx4_en_dev *mdev, int port, dev->min_mtu = ETH_MIN_MTU; dev->max_mtu = priv->max_mtu; + /* supports LSOv2 packets, 512KB limit has been tested. */ + netif_set_tso_ipv6_max_size(dev, 512 * 1024); + mdev->pndev[port] = dev; mdev->upper[port] = NULL; diff --git a/drivers/net/ethernet/mellanox/mlx4/en_tx.c b/drivers/net/ethernet/mellanox/mlx4/en_tx.c index 817f4154b86d599cd593876ec83529051d95fe2f..c89b3e8094e7d8cfb11aaa6cc4ad63bf3ad5934e 100644 --- a/drivers/net/ethernet/mellanox/mlx4/en_tx.c +++ b/drivers/net/ethernet/mellanox/mlx4/en_tx.c @@ -44,6 +44,7 @@ #include #include #include +#include #include "mlx4_en.h" @@ -635,19 +636,28 @@ static int get_real_size(const struct sk_buff *skb, struct net_device *dev, int *lso_header_size, bool *inline_ok, - void **pfrag) + void **pfrag, + int *hopbyhop) { struct mlx4_en_priv *priv = netdev_priv(dev); int real_size; if (shinfo->gso_size) { *inline_ok = false; - if (skb->encapsulation) + *hopbyhop = 0; + if (skb->encapsulation) { *lso_header_size = (skb_inner_transport_header(skb) - skb->data) + inner_tcp_hdrlen(skb); - else + } else { + /* Detects large IPV6 TCP packets and prepares for removal of + * HBH header that has been pushed by ip6_xmit(), + * mainly so that tcpdump can dissect them. + */ + if (ipv6_has_hopopt_jumbo(skb)) + *hopbyhop = sizeof(struct hop_jumbo_hdr); *lso_header_size = skb_transport_offset(skb) + tcp_hdrlen(skb); + } real_size = CTRL_SIZE + shinfo->nr_frags * DS_SIZE + - ALIGN(*lso_header_size + 4, DS_SIZE); + ALIGN(*lso_header_size - *hopbyhop + 4, DS_SIZE); if (unlikely(*lso_header_size != skb_headlen(skb))) { /* We add a segment for the skb linear buffer only if * it contains data */ @@ -874,6 +884,7 @@ netdev_tx_t mlx4_en_xmit(struct sk_buff *skb, struct net_device *dev) int desc_size; int real_size; u32 index, bf_index; + struct ipv6hdr *h6; __be32 op_own; int lso_header_size; void *fragptr = NULL; @@ -882,6 +893,7 @@ netdev_tx_t mlx4_en_xmit(struct sk_buff *skb, struct net_device *dev) bool stop_queue; bool inline_ok; u8 data_offset; + int hopbyhop; bool bf_ok; tx_ind = skb_get_queue_mapping(skb); @@ -891,7 +903,7 @@ netdev_tx_t mlx4_en_xmit(struct sk_buff *skb, struct net_device *dev) goto tx_drop; real_size = get_real_size(skb, shinfo, dev, &lso_header_size, - &inline_ok, &fragptr); + &inline_ok, &fragptr, &hopbyhop); if (unlikely(!real_size)) goto tx_drop_count; @@ -944,7 +956,7 @@ netdev_tx_t mlx4_en_xmit(struct sk_buff *skb, struct net_device *dev) data = &tx_desc->data; data_offset = offsetof(struct mlx4_en_tx_desc, data); } else { - int lso_align = ALIGN(lso_header_size + 4, DS_SIZE); + int lso_align = ALIGN(lso_header_size - hopbyhop + 4, DS_SIZE); data = (void *)&tx_desc->lso + lso_align; data_offset = offsetof(struct mlx4_en_tx_desc, lso) + lso_align; @@ -1009,14 +1021,31 @@ netdev_tx_t mlx4_en_xmit(struct sk_buff *skb, struct net_device *dev) ((ring->prod & ring->size) ? cpu_to_be32(MLX4_EN_BIT_DESC_OWN) : 0); + lso_header_size -= hopbyhop; /* Fill in the LSO prefix */ tx_desc->lso.mss_hdr_size = cpu_to_be32( shinfo->gso_size << 16 | lso_header_size); - /* Copy headers; - * note that we already verified that it is linear */ - memcpy(tx_desc->lso.header, skb->data, lso_header_size); + if (unlikely(hopbyhop)) { + /* remove the HBH header. + * Layout: [Ethernet header][IPv6 header][HBH][TCP header] + */ + memcpy(tx_desc->lso.header, skb->data, ETH_HLEN + sizeof(*h6)); + h6 = (struct ipv6hdr *)((char *)tx_desc->lso.header + ETH_HLEN); + h6->nexthdr = IPPROTO_TCP; + /* Copy the TCP header after the IPv6 one */ + memcpy(h6 + 1, + skb->data + ETH_HLEN + sizeof(*h6) + + sizeof(struct hop_jumbo_hdr), + tcp_hdrlen(skb)); + /* Leave ipv6 payload_len set to 0, as LSO v2 specs request. */ + } else { + /* Copy headers; + * note that we already verified that it is linear + */ + memcpy(tx_desc->lso.header, skb->data, lso_header_size); + } ring->tso_packets++; i = shinfo->gso_segs; From patchwork Thu Feb 3 01:51:40 2022 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Eric Dumazet X-Patchwork-Id: 12733744 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 888B3C433EF for ; Thu, 3 Feb 2022 01:52:31 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1348900AbiBCBw3 (ORCPT ); Wed, 2 Feb 2022 20:52:29 -0500 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:58186 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1348905AbiBCBwZ (ORCPT ); Wed, 2 Feb 2022 20:52:25 -0500 Received: from mail-pl1-x636.google.com (mail-pl1-x636.google.com [IPv6:2607:f8b0:4864:20::636]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 59C18C061755 for ; Wed, 2 Feb 2022 17:52:22 -0800 (PST) Received: by mail-pl1-x636.google.com with SMTP id x3so888603pll.3 for ; Wed, 02 Feb 2022 17:52:22 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20210112; h=from:to:cc:subject:date:message-id:in-reply-to:references :mime-version:content-transfer-encoding; bh=FvXKu1Uh+qJqTdWIkfDeiOqalxPYyigSWabWQAE5W2Y=; b=jpmjmCUZx5kE0ZD6593JBTX41Vh9D9oxQvB/UmpAwwjyAiJTTOzTfuyhvjJVEktpNu nPsNkD/MEDHDVFIvDDBtuw/+o3aaobXIMWwu7mVlB4ubGHJBCEUvanEFlQTBKIXtfyVn NuKiwpP6Srzmy6WuBX4eZ7fi0dDejHsmapdrSQnWcZEtGei0OOgojmSvhlIUWqiQFwqv XzjjhcgVGs3x1n+6H5R2fOa0IYhPP95roB5Sg5JFtwshgAa3aCJZFasujdJcE6K0Xz+l YHIY4s5K+YuMXjjTmqFpztc3GaFucobIaJdbafouCP2uCL+0+NiSXeIH0ubdue8Ck8LC ToIg== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20210112; h=x-gm-message-state:from:to:cc:subject:date:message-id:in-reply-to :references:mime-version:content-transfer-encoding; bh=FvXKu1Uh+qJqTdWIkfDeiOqalxPYyigSWabWQAE5W2Y=; b=N0Zw0f4Dt55BbkxSyHdQcDcPAMPPKocY5mpD2Uk+i1W7l5deruL2HOoSI4IGPx4Mi4 BwwnSuhlBRQa/ijqdzV08MMOKeL5pnJAozl2oKzAYiDf0MpBEOdTsM1+2ljMHVUHaNwn 01w3jz5LCXAnnTmf+kTnp4muvGMgl3BydZHCfs4Bc/UNmjzcN8BvecJSkNGPD/y3SWUf Q+T0411TQzG3Ow9kN/1FnGS5PSyG3CD3A8AthutvkWYhCXuC0vi2OIC67xkNDoaxmK9N 0ODPS1R2FVyjP6vUU0/ZPO7RDx2qznufRWmqmAqQm3OgHn+YVpJ+fwv3P2M4awC3Pmvf z/gg== X-Gm-Message-State: AOAM532IpKpIcM/q4PqfIeO7KsIaP6Yjw+lpAdTA8Mb8SY3/tiHDtCK7 qDnNmNgvJHo9EXx54IaJrII= X-Google-Smtp-Source: ABdhPJwn2eAzE7XJk9XyKJ2og0N0WrORIybUO8dcoHFFDArMvPhwC/LwA71lv9XjkvR39pwHPsnYUA== X-Received: by 2002:a17:90b:1d06:: with SMTP id on6mr11388238pjb.6.1643853141845; Wed, 02 Feb 2022 17:52:21 -0800 (PST) Received: from edumazet1.svl.corp.google.com ([2620:15c:2c4:201:697a:fa00:b793:ed3a]) by smtp.gmail.com with ESMTPSA id qe16sm509611pjb.22.2022.02.02.17.52.21 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Wed, 02 Feb 2022 17:52:21 -0800 (PST) From: Eric Dumazet To: "David S . Miller" , Jakub Kicinski Cc: netdev , Eric Dumazet , Coco Li , Eric Dumazet , Saeed Mahameed , Leon Romanovsky Subject: [PATCH net-next 15/15] mlx5: support BIG TCP packets Date: Wed, 2 Feb 2022 17:51:40 -0800 Message-Id: <20220203015140.3022854-16-eric.dumazet@gmail.com> X-Mailer: git-send-email 2.35.0.rc2.247.g8bbb082509-goog In-Reply-To: <20220203015140.3022854-1-eric.dumazet@gmail.com> References: <20220203015140.3022854-1-eric.dumazet@gmail.com> MIME-Version: 1.0 Precedence: bulk List-ID: X-Mailing-List: netdev@vger.kernel.org X-Patchwork-Delegate: kuba@kernel.org From: Coco Li mlx5 supports LSOv2. IPv6 gro/tcp stacks insert a temporary Hop-by-Hop header with JUMBO TLV for big packets. We need to ignore/skip this HBH header when populating TX descriptor. Signed-off-by: Coco Li Signed-off-by: Eric Dumazet Cc: Saeed Mahameed Cc: Leon Romanovsky Reported-by: kernel test robot --- .../net/ethernet/mellanox/mlx5/core/en_main.c | 1 + .../net/ethernet/mellanox/mlx5/core/en_tx.c | 81 +++++++++++++++---- 2 files changed, 65 insertions(+), 17 deletions(-) diff --git a/drivers/net/ethernet/mellanox/mlx5/core/en_main.c b/drivers/net/ethernet/mellanox/mlx5/core/en_main.c index bf80fb6124499fc4e6a0310ab92c91159b4ccbbb..1c4ce90e5d0f5186c402137b744258ff4ce6a348 100644 --- a/drivers/net/ethernet/mellanox/mlx5/core/en_main.c +++ b/drivers/net/ethernet/mellanox/mlx5/core/en_main.c @@ -4888,6 +4888,7 @@ static void mlx5e_build_nic_netdev(struct net_device *netdev) netdev->priv_flags |= IFF_UNICAST_FLT; + netif_set_tso_ipv6_max_size(netdev, 512 * 1024); mlx5e_set_netdev_dev_addr(netdev); mlx5e_ipsec_build_netdev(priv); mlx5e_tls_build_netdev(priv); diff --git a/drivers/net/ethernet/mellanox/mlx5/core/en_tx.c b/drivers/net/ethernet/mellanox/mlx5/core/en_tx.c index 7fd33b356cc8d191413e8259acd0b26b3ebd6ba9..fc945bd8219dcb69950b1840bb492649c8749976 100644 --- a/drivers/net/ethernet/mellanox/mlx5/core/en_tx.c +++ b/drivers/net/ethernet/mellanox/mlx5/core/en_tx.c @@ -40,6 +40,7 @@ #include "en_accel/en_accel.h" #include "en_accel/ipsec_rxtx.h" #include "en/ptp.h" +#include static void mlx5e_dma_unmap_wqe_err(struct mlx5e_txqsq *sq, u8 num_dma) { @@ -241,8 +242,11 @@ mlx5e_txwqe_build_eseg_csum(struct mlx5e_txqsq *sq, struct sk_buff *skb, sq->stats->csum_none++; } +/* Returns the number of header bytes that we plan + * to inline later in the transmit descriptor + */ static inline u16 -mlx5e_tx_get_gso_ihs(struct mlx5e_txqsq *sq, struct sk_buff *skb) +mlx5e_tx_get_gso_ihs(struct mlx5e_txqsq *sq, struct sk_buff *skb, int *hopbyhop) { struct mlx5e_sq_stats *stats = sq->stats; u16 ihs; @@ -252,15 +256,18 @@ mlx5e_tx_get_gso_ihs(struct mlx5e_txqsq *sq, struct sk_buff *skb) stats->tso_inner_packets++; stats->tso_inner_bytes += skb->len - ihs; } else { - if (skb_shinfo(skb)->gso_type & SKB_GSO_UDP_L4) + if (skb_shinfo(skb)->gso_type & SKB_GSO_UDP_L4) { ihs = skb_transport_offset(skb) + sizeof(struct udphdr); - else + } else { + if (ipv6_has_hopopt_jumbo(skb)) + *hopbyhop = sizeof(struct hop_jumbo_hdr); ihs = skb_transport_offset(skb) + tcp_hdrlen(skb); + } stats->tso_packets++; - stats->tso_bytes += skb->len - ihs; + stats->tso_bytes += skb->len - ihs - *hopbyhop; } - return ihs; + return ihs - *hopbyhop; } static inline int @@ -319,6 +326,7 @@ struct mlx5e_tx_attr { __be16 mss; u16 insz; u8 opcode; + u8 hopbyhop; }; struct mlx5e_tx_wqe_attr { @@ -355,14 +363,16 @@ static void mlx5e_sq_xmit_prepare(struct mlx5e_txqsq *sq, struct sk_buff *skb, struct mlx5e_sq_stats *stats = sq->stats; if (skb_is_gso(skb)) { - u16 ihs = mlx5e_tx_get_gso_ihs(sq, skb); + int hopbyhop; + u16 ihs = mlx5e_tx_get_gso_ihs(sq, skb, &hopbyhop); *attr = (struct mlx5e_tx_attr) { .opcode = MLX5_OPCODE_LSO, .mss = cpu_to_be16(skb_shinfo(skb)->gso_size), .ihs = ihs, .num_bytes = skb->len + (skb_shinfo(skb)->gso_segs - 1) * ihs, - .headlen = skb_headlen(skb) - ihs, + .headlen = skb_headlen(skb) - ihs - hopbyhop, + .hopbyhop = hopbyhop, }; stats->packets += skb_shinfo(skb)->gso_segs; @@ -476,7 +486,8 @@ mlx5e_sq_xmit_wqe(struct mlx5e_txqsq *sq, struct sk_buff *skb, struct mlx5_wqe_eth_seg *eseg; struct mlx5_wqe_data_seg *dseg; struct mlx5e_tx_wqe_info *wi; - + u16 ihs = attr->ihs; + struct ipv6hdr *h6; struct mlx5e_sq_stats *stats = sq->stats; int num_dma; @@ -490,15 +501,36 @@ mlx5e_sq_xmit_wqe(struct mlx5e_txqsq *sq, struct sk_buff *skb, eseg->mss = attr->mss; - if (attr->ihs) { - if (skb_vlan_tag_present(skb)) { - eseg->inline_hdr.sz |= cpu_to_be16(attr->ihs + VLAN_HLEN); - mlx5e_insert_vlan(eseg->inline_hdr.start, skb, attr->ihs); + if (ihs) { + u8 *start = eseg->inline_hdr.start; + + if (unlikely(attr->hopbyhop)) { + /* remove the HBH header. + * Layout: [Ethernet header][IPv6 header][HBH][TCP header] + */ + if (skb_vlan_tag_present(skb)) { + mlx5e_insert_vlan(start, skb, ETH_HLEN + sizeof(*h6)); + ihs += VLAN_HLEN; + h6 = (struct ipv6hdr *)(start + sizeof(struct vlan_ethhdr)); + } else { + memcpy(start, skb->data, ETH_HLEN + sizeof(*h6)); + h6 = (struct ipv6hdr *)(start + ETH_HLEN); + } + h6->nexthdr = IPPROTO_TCP; + /* Copy the TCP header after the IPv6 one */ + memcpy(h6 + 1, + skb->data + ETH_HLEN + sizeof(*h6) + + sizeof(struct hop_jumbo_hdr), + tcp_hdrlen(skb)); + /* Leave ipv6 payload_len set to 0, as LSO v2 specs request. */ + } else if (skb_vlan_tag_present(skb)) { + mlx5e_insert_vlan(start, skb, ihs); + ihs += VLAN_HLEN; stats->added_vlan_packets++; } else { - eseg->inline_hdr.sz |= cpu_to_be16(attr->ihs); - memcpy(eseg->inline_hdr.start, skb->data, attr->ihs); + memcpy(start, skb->data, ihs); } + eseg->inline_hdr.sz |= cpu_to_be16(ihs); dseg += wqe_attr->ds_cnt_inl; } else if (skb_vlan_tag_present(skb)) { eseg->insert.type = cpu_to_be16(MLX5_ETH_WQE_INSERT_VLAN); @@ -509,7 +541,7 @@ mlx5e_sq_xmit_wqe(struct mlx5e_txqsq *sq, struct sk_buff *skb, } dseg += wqe_attr->ds_cnt_ids; - num_dma = mlx5e_txwqe_build_dsegs(sq, skb, skb->data + attr->ihs, + num_dma = mlx5e_txwqe_build_dsegs(sq, skb, skb->data + attr->ihs + attr->hopbyhop, attr->headlen, dseg); if (unlikely(num_dma < 0)) goto err_drop; @@ -1016,12 +1048,27 @@ void mlx5i_sq_xmit(struct mlx5e_txqsq *sq, struct sk_buff *skb, eseg->mss = attr.mss; if (attr.ihs) { - memcpy(eseg->inline_hdr.start, skb->data, attr.ihs); + if (unlikely(attr.hopbyhop)) { + /* remove the HBH header. + * Layout: [Ethernet header][IPv6 header][HBH][TCP header] + */ + memcpy(eseg->inline_hdr.start, skb->data, ETH_HLEN + sizeof(*h6)); + h6 = (struct ipv6hdr *)((char *)eseg->inline_hdr.start + ETH_HLEN); + h6->nexthdr = IPPROTO_TCP; + /* Copy the TCP header after the IPv6 one */ + memcpy(h6 + 1, + skb->data + ETH_HLEN + sizeof(*h6) + + sizeof(struct hop_jumbo_hdr), + tcp_hdrlen(skb)); + /* Leave ipv6 payload_len set to 0, as LSO v2 specs request. */ + } else { + memcpy(eseg->inline_hdr.start, skb->data, attr.ihs); + } eseg->inline_hdr.sz = cpu_to_be16(attr.ihs); dseg += wqe_attr.ds_cnt_inl; } - num_dma = mlx5e_txwqe_build_dsegs(sq, skb, skb->data + attr.ihs, + num_dma = mlx5e_txwqe_build_dsegs(sq, skb, skb->data + attr.ihs + attr.hopbyhop, attr.headlen, dseg); if (unlikely(num_dma < 0)) goto err_drop;