From patchwork Sat Dec 10 04:16:45 2022 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Coco Li X-Patchwork-Id: 31969 Return-Path: Delivered-To: ouuuleilei@gmail.com Received: by 2002:adf:f944:0:0:0:0:0 with SMTP id q4csp1151545wrr; Fri, 9 Dec 2022 21:38:02 -0800 (PST) X-Google-Smtp-Source: AA0mqf4f/M2tTZKiqhGgeWQ4Rtq9pNsb6jeW4AR9vRi9JICt1t4VZ3yC4uDswyRpYR/PZJ3hfxg9 X-Received: by 2002:a17:906:face:b0:7c0:e98d:b27 with SMTP id lu14-20020a170906face00b007c0e98d0b27mr8650315ejb.58.1670650682137; Fri, 09 Dec 2022 21:38:02 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1670650682; cv=none; d=google.com; s=arc-20160816; b=sFW7TLXVlLYL2QLBEYz890x/QJ451vJQbapgFXLEaA2PjiRaTHsgVYamfyskgqhX28 LsCKpC06OEvNBYnETLHScORf15XEQb9ISoEwjHNasEZHQQIH8iU3y8KcSji2mdHcjQGy BzVC7q7ljkfUexbwM3yghRJE0JmTn1aYtZVIuYihtLEK/8x1lLPdyVkjDpr88keyamzd +ylhzRu3ixxTdnuhiAiiSVgQaxGuqx/54f6TpuWM7ESmFcqI+AciKXM0dxNbOtBAOcPM 6RNknF76/STDW5GjL+N8lGFxO1+NeubH7CW34MxPCirFb5ae3s6eE5ya+ZwczdhtGkQc Vgdw== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:cc:to:from:subject:message-id:mime-version:date :dkim-signature; bh=C6RTbmmSkPOFm902+mLMHGPXN9xcjb04HtLDqi+Zh0c=; b=Ou5p+XVzPhczMRcP8QIxXMzUp/JjQlUTEWwaZ54zMKW6SMdYX2Dk0h706vblm1ve/B 5R/a5pHaEwRhC4v2UUGCOu3t9j0SFFrTMGmHEQc6Ebp5vKUiaaDlRmguHw7ZYc2dgqKF G/LAQraMbrqPUIofayqEdbugQRZSMJxft43rDnzCfM7Hz44uUqsWiJUkICdy2llN6XCx Zrf33+AfgUOOJJAE3rD4mhy4FOxVlxe8wFtUJv+MWPmJ8QZZKTpdUyKcSA6DSYnMkAPw VORNxXrTYjpr/kaJ8l2gZ/kMBWFdXexCFZAdxXWFJ/s873EvntW2yfekeWNKQ5bQAw6m a9VQ== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@google.com header.s=20210112 header.b=BvO0Vvny; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=REJECT sp=REJECT dis=NONE) header.from=google.com Received: from out1.vger.email (out1.vger.email. [2620:137:e000::1:20]) by mx.google.com with ESMTP id oz37-20020a1709077da500b0073d9ea386d4si1502308ejc.983.2022.12.09.21.37.39; Fri, 09 Dec 2022 21:38:02 -0800 (PST) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) client-ip=2620:137:e000::1:20; Authentication-Results: mx.google.com; dkim=pass header.i=@google.com header.s=20210112 header.b=BvO0Vvny; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=REJECT sp=REJECT dis=NONE) header.from=google.com Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S229861AbiLJERe (ORCPT + 99 others); Fri, 9 Dec 2022 23:17:34 -0500 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:57958 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S229897AbiLJERK (ORCPT ); Fri, 9 Dec 2022 23:17:10 -0500 Received: from mail-pl1-x649.google.com (mail-pl1-x649.google.com [IPv6:2607:f8b0:4864:20::649]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 84E1076153 for ; Fri, 9 Dec 2022 20:16:50 -0800 (PST) Received: by mail-pl1-x649.google.com with SMTP id j18-20020a170902da9200b00189b3b16addso5740800plx.23 for ; Fri, 09 Dec 2022 20:16:50 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=20210112; h=cc:to:from:subject:message-id:mime-version:date:from:to:cc:subject :date:message-id:reply-to; bh=C6RTbmmSkPOFm902+mLMHGPXN9xcjb04HtLDqi+Zh0c=; b=BvO0Vvnynj96CFRnXCmTlxB2yUgmetu/LkyKo83qxWb7GC5KxrSYBwHscaynK6luPu sfvKOizMxzBtaEwMS0MrAG7ys4gWlbeE5d4PvbpEsoQCEGAnVrvs9UqIq1L3dvTrVmB4 sxsoQzAV/K+9upPPpNXGaO513a6HTYhNAxZE8pd+mI/YOhOvgCm+Vxajs5j72RwQw1dS n77gzfpXonUFXlPYp7Yw3hO3zxu6aAu/cA7uyc05gF7uVoanoRiL2iIvWzicf+NFB4cl rypFBaVwhkN3QK5DFXDvbUHguHVLeAwQNDU8aBKYG77ZN0udlOg8YJD3P/0p6ZWf6nS+ vNsA== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20210112; h=cc:to:from:subject:message-id:mime-version:date:x-gm-message-state :from:to:cc:subject:date:message-id:reply-to; bh=C6RTbmmSkPOFm902+mLMHGPXN9xcjb04HtLDqi+Zh0c=; b=CSAalrlxyLsOsrOYux5NjIZ7HNe7WmBXBy1atjokNpF0AvOw386+ifX/Jl9V34fea9 /XoMfTlDaXrj9j8tcKeMenCMaIonAGN2vRSSXPDZExI6BBVvL5wYW0AREKHcC2cBu1MK /106MpkgjPGTOoujwV+izkZZDfYMSFurmQS7NF6etbPXQ7MGi1W+on6MuLRnuzmg1GA8 uWtP/aNzls0Uje5vbNvcnEIoAiEs/bcooJJsTjrQuGeUJFGkLa9Ibe7MIZZlhL5UBTMi wlCQqDt6J/gzh07YvP04cnwdCm7YrfD9B7+JDTg7sIwZj+u/fTtlvCx4Aqvtg3DRG/K6 ej1Q== X-Gm-Message-State: ANoB5pnfjAYMCuSN9QrUjI0gy2lzhn4atsvRsOByhK4ko2QX4i6i2sMf iWh1aDWkfii4DV8gJ1We9wpNvJktaI+hEtU= X-Received: from coco0920.c.googlers.com ([fda3:e722:ac3:cc00:24:72f4:c0a8:5738]) (user=lixiaoyan job=sendgmr) by 2002:a17:90a:2a88:b0:220:1f03:129b with SMTP id j8-20020a17090a2a8800b002201f03129bmr28851pjd.0.1670645809623; Fri, 09 Dec 2022 20:16:49 -0800 (PST) Date: Sat, 10 Dec 2022 04:16:45 +0000 Mime-Version: 1.0 X-Mailer: git-send-email 2.39.0.rc1.256.g54fd8350bd-goog Message-ID: <20221210041646.3587757-1-lixiaoyan@google.com> Subject: [PATCH net-next v6 1/2] IPv6/GRO: generic helper to remove temporary HBH/jumbo header in driver From: Coco Li To: "David S . Miller" , Hideaki YOSHIFUJI , David Ahern , Eric Dumazet , Jakub Kicinski , Paolo Abeni , Michael Chan Cc: netdev@vger.kernel.org, linux-kernel@vger.kernel.org, Coco Li X-Spam-Status: No, score=-8.6 required=5.0 tests=BAYES_00,DKIMWL_WL_MED, DKIM_SIGNED,DKIM_VALID,DKIM_VALID_AU,DKIM_VALID_EF,HK_RANDOM_FROM, RCVD_IN_DNSWL_NONE,SPF_HELO_NONE,SPF_PASS,USER_IN_DEF_DKIM_WL autolearn=no autolearn_force=no version=3.4.6 X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on lindbergh.monkeyblade.net Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org X-getmail-retrieved-from-mailbox: =?utf-8?q?INBOX?= X-GMAIL-THRID: =?utf-8?q?1751804209829149002?= X-GMAIL-MSGID: =?utf-8?q?1751804209829149002?= IPv6/TCP and GRO stacks can build big TCP packets with an added temporary Hop By Hop header. Is GSO is not involved, then the temporary header needs to be removed in the driver. This patch provides a generic helper for drivers that need to modify their headers in place. Tested: Compiled and ran with ethtool -K eth1 tso off Could send Big TCP packets Signed-off-by: Coco Li --- include/net/ipv6.h | 33 +++++++++++++++++++++++++++++++++ net/ipv6/ip6_offload.c | 27 ++++----------------------- 2 files changed, 37 insertions(+), 23 deletions(-) diff --git a/include/net/ipv6.h b/include/net/ipv6.h index d383c895592a..03f3af02a9a6 100644 --- a/include/net/ipv6.h +++ b/include/net/ipv6.h @@ -500,6 +500,39 @@ static inline int ipv6_has_hopopt_jumbo(const struct sk_buff *skb) return jhdr->nexthdr; } +/* Return 0 if HBH header is successfully removed + * Or if HBH removal is unnecessary (packet is not big TCP) + * Return error to indicate dropping the packet + */ +static inline int ipv6_hopopt_jumbo_remove(struct sk_buff *skb) +{ + const int hophdr_len = sizeof(struct hop_jumbo_hdr); + int nexthdr = ipv6_has_hopopt_jumbo(skb); + struct ipv6hdr *h6; + + if (!nexthdr) + return 0; + + if (skb_cow_head(skb, 0)) + return -1; + + /* Remove the HBH header. + * Layout: [Ethernet header][IPv6 header][HBH][L4 Header] + */ + memmove(skb_mac_header(skb) + hophdr_len, skb_mac_header(skb), + skb_network_header(skb) - skb_mac_header(skb) + + sizeof(struct ipv6hdr)); + + __skb_pull(skb, hophdr_len); + skb->network_header += hophdr_len; + skb->mac_header += hophdr_len; + + h6 = ipv6_hdr(skb); + h6->nexthdr = nexthdr; + + return 0; +} + 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/ipv6/ip6_offload.c b/net/ipv6/ip6_offload.c index 3ee345672849..00dc2e3b0184 100644 --- a/net/ipv6/ip6_offload.c +++ b/net/ipv6/ip6_offload.c @@ -77,7 +77,7 @@ static struct sk_buff *ipv6_gso_segment(struct sk_buff *skb, struct sk_buff *segs = ERR_PTR(-EINVAL); struct ipv6hdr *ipv6h; const struct net_offload *ops; - int proto, nexthdr; + int proto, err; struct frag_hdr *fptr; unsigned int payload_len; u8 *prevhdr; @@ -87,28 +87,9 @@ static struct sk_buff *ipv6_gso_segment(struct sk_buff *skb, bool gso_partial; skb_reset_network_header(skb); - nexthdr = ipv6_has_hopopt_jumbo(skb); - if (nexthdr) { - const int hophdr_len = sizeof(struct hop_jumbo_hdr); - int err; - - err = skb_cow_head(skb, 0); - if (err < 0) - return ERR_PTR(err); - - /* remove the HBH header. - * Layout: [Ethernet header][IPv6 header][HBH][TCP header] - */ - memmove(skb_mac_header(skb) + hophdr_len, - skb_mac_header(skb), - ETH_HLEN + sizeof(struct ipv6hdr)); - skb->data += hophdr_len; - skb->len -= hophdr_len; - skb->network_header += hophdr_len; - skb->mac_header += hophdr_len; - ipv6h = (struct ipv6hdr *)skb->data; - ipv6h->nexthdr = nexthdr; - } + err = ipv6_hopopt_jumbo_remove(skb); + if (err) + return ERR_PTR(err); nhoff = skb_network_header(skb) - skb_mac_header(skb); if (unlikely(!pskb_may_pull(skb, sizeof(*ipv6h)))) goto out; From patchwork Sat Dec 10 04:16:46 2022 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Coco Li X-Patchwork-Id: 31968 Return-Path: Delivered-To: ouuuleilei@gmail.com Received: by 2002:adf:f944:0:0:0:0:0 with SMTP id q4csp1145484wrr; Fri, 9 Dec 2022 21:13:40 -0800 (PST) X-Google-Smtp-Source: AA0mqf4g4bGmqJhtSLJIpHe4dzpbO0i7/Ml4eq+rTXVBZq1NCq/bhSfA1hvbHudJH4HAk+V35DkZ X-Received: by 2002:a17:906:8456:b0:7c1:e78:1e2 with SMTP id e22-20020a170906845600b007c10e7801e2mr9964286ejy.11.1670649220397; Fri, 09 Dec 2022 21:13:40 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1670649220; cv=none; d=google.com; s=arc-20160816; b=M8uxaSCudMEfKYG/szEQs7HWQARHkwwpnIulfQ1ZslzTrhc6qPwFN5fifs0ImsJgvP 52GY6y+1vYDoCxaE4SMq1uMjtZWX3PdpkMD0zaFPSOl38eMxuZ6OR94SqCDl3T/rzopt zSl2khJbaQ4FjgH3rrHc8dWdCdGqtkbkizAVNPfQaJdenhVMU+go17TfBgHSIUnYZPfU KwCvI8Oa/7FFjbJlgDygvfcXemLwwP1yEQJbbGDIuPGsfy1B4sTBf/MmV6T1VIN1xWcv teTrfy48I/9vdKiRdveCynZJEkLhFm2ooMP/HTCgIOksp7CBpd+kZZpZyM1QzyzBO9HZ 04pA== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:cc:to:from:subject:message-id:references :mime-version:in-reply-to:date:dkim-signature; bh=3UTBim1uEt5vwLtdAODs9aBiC6oBtXfrCv1Q8xSciis=; b=maKAbycvlScxy0sKtAoH7GWIQa8CLWwgDXomv1E7Cy+myYXKjpEltOo/DzPhLVg5uO lxS0kgOVSSykMtkziNCx1yENRrXW/2Cf7R4esjr9FtYKpAcpkSRjlRsx7KgxS5JkpI3+ 5RIEKg7jeBAPSl6AttOpklo64+BeOCI7sFzm1V/qsqo9pwpvlFnM9cZNaL/HVb2i7KNs pkmMitn27sJdrs3ywU0S8IxnNpfBGk/c6b8B7IfCleC5e8wyrRx0Wf6yqOwuROKr2HdD Gf0pGWwl4R2dV5Oy4VvMSFqf39u9/bQXzhnFK6XO2Vbv4hcYxdFCff2evEfN02sm2Rmc 2BZg== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@google.com header.s=20210112 header.b=DuDJzLEw; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=REJECT sp=REJECT dis=NONE) header.from=google.com Received: from out1.vger.email (out1.vger.email. [2620:137:e000::1:20]) by mx.google.com with ESMTP id xb4-20020a170907070400b0078e1e77f443si1493654ejb.418.2022.12.09.21.13.02; Fri, 09 Dec 2022 21:13:40 -0800 (PST) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) client-ip=2620:137:e000::1:20; Authentication-Results: mx.google.com; dkim=pass header.i=@google.com header.s=20210112 header.b=DuDJzLEw; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=REJECT sp=REJECT dis=NONE) header.from=google.com Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S229957AbiLJERu (ORCPT + 99 others); Fri, 9 Dec 2022 23:17:50 -0500 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:57788 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S229810AbiLJERO (ORCPT ); Fri, 9 Dec 2022 23:17:14 -0500 Received: from mail-yw1-x1149.google.com (mail-yw1-x1149.google.com [IPv6:2607:f8b0:4864:20::1149]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 2BA917D048 for ; Fri, 9 Dec 2022 20:16:54 -0800 (PST) Received: by mail-yw1-x1149.google.com with SMTP id 00721157ae682-368994f4bc0so72605337b3.14 for ; Fri, 09 Dec 2022 20:16:54 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=20210112; h=cc:to:from:subject:message-id:references:mime-version:in-reply-to :date:from:to:cc:subject:date:message-id:reply-to; bh=3UTBim1uEt5vwLtdAODs9aBiC6oBtXfrCv1Q8xSciis=; b=DuDJzLEwS3xTDGNyqym6VVKk54sQ3nETwyWPzdzBcNrIf00cWsfHMR+/zaPff76MQz 79J4NxEyqJdt00Wg0n1HnbqNCm3oJXDd0v2/gyWdD7yrKQFs4jh+1wAnM8t6yjtn9+lL OkJWaZRoWZbvg6rW68weTAFLo6sZ9x9upeidKLIa6tGBUdrJ1GfqsxAFCVTJq049r9Z6 kud6/07RaSLYhwU9Fiaya9eVzSfKOpxmVLXu7ESnZuWsktIVQP6xQvZEGXxE4W+x0L7s K5hKgilMDhsZZGkg9JXF6NI/g23CkOck0yjE9uSulTQSMdl++bPg2qJqyKY3Tlzln0Mo ++Jg== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20210112; h=cc:to:from:subject:message-id:references:mime-version:in-reply-to :date:x-gm-message-state:from:to:cc:subject:date:message-id:reply-to; bh=3UTBim1uEt5vwLtdAODs9aBiC6oBtXfrCv1Q8xSciis=; b=xvBl2/48BKaX1H9J01IPqsU8vSSfyMttkY2Mtp0Wxzs1VCyMGDOh3ykRVy6pF8JHCC nYhXunQkHnEKfPux4iUBWqFzTnHyPRjadTT76N7TkjFxQNwXe1oaBLK4JJJtP7d4ctQd 9AmwhFeg98RXw0V9luuf5zqujSxQoZ1An44Gb3O75ZTyxCiEBKQkBU/p9Srxc96afg34 3NnSMafFiuY/m8L0LjV+BWTm+rRhwl5gJc5ktZSEidwH5hwlCHiO1jCUIRbV0GQes6vm aOWRf6FYJRiDigz25GCNfHdx0w9rNsuXdalUyGM86cXsEbgmX06vIUpYefM0MI9FLpiX oWWw== X-Gm-Message-State: ANoB5pnbbtR1b6nOjgxiBhZyvGA6zDA04NDPtKNi68UJsrgWfKpGp/bo rWupQmEc8T9Wl7WBEV7vlMvZnuuCp42Tcys= X-Received: from coco0920.c.googlers.com ([fda3:e722:ac3:cc00:24:72f4:c0a8:5738]) (user=lixiaoyan job=sendgmr) by 2002:a25:ad97:0:b0:6fa:bac8:c9c1 with SMTP id z23-20020a25ad97000000b006fabac8c9c1mr36779951ybi.477.1670645813372; Fri, 09 Dec 2022 20:16:53 -0800 (PST) Date: Sat, 10 Dec 2022 04:16:46 +0000 In-Reply-To: <20221210041646.3587757-1-lixiaoyan@google.com> Mime-Version: 1.0 References: <20221210041646.3587757-1-lixiaoyan@google.com> X-Mailer: git-send-email 2.39.0.rc1.256.g54fd8350bd-goog Message-ID: <20221210041646.3587757-2-lixiaoyan@google.com> Subject: [RFC net-next v6 2/2] bnxt: Use generic HBH removal helper in tx path From: Coco Li To: "David S . Miller" , Hideaki YOSHIFUJI , David Ahern , Eric Dumazet , Jakub Kicinski , Paolo Abeni , Michael Chan Cc: netdev@vger.kernel.org, linux-kernel@vger.kernel.org, Coco Li X-Spam-Status: No, score=-8.6 required=5.0 tests=BAYES_00,DKIMWL_WL_MED, DKIM_SIGNED,DKIM_VALID,DKIM_VALID_AU,DKIM_VALID_EF,HK_RANDOM_FROM, RCVD_IN_DNSWL_NONE,SPF_HELO_NONE,SPF_PASS,USER_IN_DEF_DKIM_WL autolearn=no autolearn_force=no version=3.4.6 X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on lindbergh.monkeyblade.net Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org X-getmail-retrieved-from-mailbox: =?utf-8?q?INBOX?= X-GMAIL-THRID: =?utf-8?q?1751802676957475729?= X-GMAIL-MSGID: =?utf-8?q?1751802676957475729?= Eric Dumazet implemented Big TCP that allowed bigger TSO/GRO packet sizes for IPv6 traffic. See patch series: 'commit 89527be8d8d6 ("net: add IFLA_TSO_{MAX_SIZE|SEGS} attributes")' This reduces the number of packets traversing the networking stack and should usually improves performance. However, it also inserts a temporary Hop-by-hop IPv6 extension header. Using the HBH header removal method in the previous patch, the extra header be removed in bnxt drivers to allow it to send big TCP packets (bigger TSO packets) as well. Tested: Compiled locally To further test functional correctness, update the GSO/GRO limit on the physical NIC: ip link set eth0 gso_max_size 181000 ip link set eth0 gro_max_size 181000 Note that if there are bonding or ipvan devices on top of the physical NIC, their GSO sizes need to be updated as well. Then, IPv6/TCP packets with sizes larger than 64k can be observed. Signed-off-by: Coco Li Reviewed-by: Michael Chan Tested-by: Michael Chan --- drivers/net/ethernet/broadcom/bnxt/bnxt.c | 26 ++++++++++++++++++++++- 1 file changed, 25 insertions(+), 1 deletion(-) diff --git a/drivers/net/ethernet/broadcom/bnxt/bnxt.c b/drivers/net/ethernet/broadcom/bnxt/bnxt.c index 9f8a6ce4b356..b281091a1b1d 100644 --- a/drivers/net/ethernet/broadcom/bnxt/bnxt.c +++ b/drivers/net/ethernet/broadcom/bnxt/bnxt.c @@ -389,6 +389,9 @@ static netdev_tx_t bnxt_start_xmit(struct sk_buff *skb, struct net_device *dev) return NETDEV_TX_BUSY; } + if (unlikely(ipv6_hopopt_jumbo_remove(skb))) + goto tx_free; + length = skb->len; len = skb_headlen(skb); last_frag = skb_shinfo(skb)->nr_frags; @@ -11283,6 +11286,7 @@ static bool bnxt_exthdr_check(struct bnxt *bp, struct sk_buff *skb, int nw_off, u8 **nextp) { struct ipv6hdr *ip6h = (struct ipv6hdr *)(skb->data + nw_off); + struct hop_jumbo_hdr *jhdr; int hdr_count = 0; u8 *nexthdr; int start; @@ -11310,9 +11314,27 @@ static bool bnxt_exthdr_check(struct bnxt *bp, struct sk_buff *skb, int nw_off, if (hdrlen > 64) return false; + + /* The ext header may be a hop-by-hop header inserted for + * big TCP purposes. This will be removed before sending + * from NIC, so do not count it. + */ + if (*nexthdr == NEXTHDR_HOP) { + if (likely(skb->len <= GRO_LEGACY_MAX_SIZE)) + goto increment_hdr; + + jhdr = (struct hop_jumbo_hdr *)hp; + if (jhdr->tlv_type != IPV6_TLV_JUMBO || jhdr->hdrlen != 0 || + jhdr->nexthdr != IPPROTO_TCP) + goto increment_hdr; + + goto next_hdr; + } +increment_hdr: + hdr_count++; +next_hdr: nexthdr = &hp->nexthdr; start += hdrlen; - hdr_count++; } if (nextp) { /* Caller will check inner protocol */ @@ -13633,6 +13655,8 @@ static int bnxt_init_one(struct pci_dev *pdev, const struct pci_device_id *ent) dev->features &= ~NETIF_F_LRO; dev->priv_flags |= IFF_UNICAST_FLT; + netif_set_tso_max_size(dev, GSO_MAX_SIZE); + #ifdef CONFIG_BNXT_SRIOV init_waitqueue_head(&bp->sriov_cfg_wait); #endif