From patchwork Wed Dec 7 22:54:34 2022 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Coco Li X-Patchwork-Id: 31084 Return-Path: Delivered-To: ouuuleilei@gmail.com Received: by 2002:adf:f944:0:0:0:0:0 with SMTP id q4csp444754wrr; Wed, 7 Dec 2022 14:57:21 -0800 (PST) X-Google-Smtp-Source: AA0mqf7REd40h7i2Lg7eyP8NfMz+xXvOvtHls/zuINMpewRTIzOmHZ/KtsfhGVlT2Ic/QkgdMi4l X-Received: by 2002:aa7:d1c5:0:b0:46b:a536:e8d0 with SMTP id g5-20020aa7d1c5000000b0046ba536e8d0mr31325556edp.261.1670453841633; Wed, 07 Dec 2022 14:57:21 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1670453841; cv=none; d=google.com; s=arc-20160816; b=C73jgOAAwcq8cEjnOb1iNOAf2ptyHoT8142zK01YVIO8SGuKzEqxBrJsCWFA6WkKC7 H1ufawB3cfBAPpbHrRnkQrrHSa7Z82rjbNOEWjTddcSQ+kc4vUuG+oKPwwb7ojP5AIN0 tNanCXvIO29zj020YFQV1Fx59ktusfdqu9aVIPsKtjdXhJX5L5lsLl/Rk/AWnWekz34A R8c2N/BYG7MLr98mhzgU11eMr0JkjM6ttO3U6Epr9iufwwn+e+Z33Wb8CLFpVpo16R4E ofBW8ybvF73kCldlFTiUBysLEmP1HrVsdmccjO4/XxHNyMxRg4r107CB6pKK+/9WnBe9 t0Ww== 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=2cCrJ2T3lsz5o645qE6JJwrkYwd4cRkkzCyLadpkJHU=; b=uyVNkF/6Tb5qQZODQPk8V551Aour3nm40Eozd3NYk4tUtd0+8+5S6V4NSm11OSKZ4L bHgS/Gy410DtVHU7lZiwf950UuM1NypdkodaepafxY3Vg4F15r6Tws0JINObiGfEBdy+ yV7rvX9erBklC1Mtu258sRST1JiLoBErQ1CnsTfEcatwGfhdX0CzvpWk/bWPa1rcBFVi etRKY0gBgQwD3mNC8xzNw3AHkUfjN4AeCS8ZeDT4hQUMd0IWbLAKNpJnNML3kO9S7GF4 JB6hYdHt3nYVTxCDeJHr8gY1gWUIav/ZB5SIHPnDQwunPSTviXflnLOw4DKGjvZdJfRb QO2g== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@google.com header.s=20210112 header.b=dJfLG8m0; 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 ne19-20020a1709077b9300b007c1063abf28si6420084ejc.179.2022.12.07.14.56.58; Wed, 07 Dec 2022 14:57:21 -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=dJfLG8m0; 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 S229894AbiLGWyo (ORCPT + 99 others); Wed, 7 Dec 2022 17:54:44 -0500 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:47550 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S229847AbiLGWyl (ORCPT ); Wed, 7 Dec 2022 17:54:41 -0500 Received: from mail-pj1-x1049.google.com (mail-pj1-x1049.google.com [IPv6:2607:f8b0:4864:20::1049]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 66DDB63DD for ; Wed, 7 Dec 2022 14:54:40 -0800 (PST) Received: by mail-pj1-x1049.google.com with SMTP id md9-20020a17090b23c900b00218fa3308a9so14500560pjb.8 for ; Wed, 07 Dec 2022 14:54:40 -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=2cCrJ2T3lsz5o645qE6JJwrkYwd4cRkkzCyLadpkJHU=; b=dJfLG8m04CTQ6CvoSKcsgLa31EDZGf97ccACDsHTBAWfJl6AuvowVlpYzBl74Vvb3o Jf/AqYw/vpJKlODPivcr2wm82oAWUYLxtnjGM4smoxLGSgJzCcvSWVCHMlgDAMl4Oq9H c6QF4Emmya8idJ+iZu99+vLXKrsjJKofoUBlzHIeatfZhxA4nPB4YAx/NWTyHZS2LebR hPQFW9TThLdmBN9t2HM66z8pRKTN6I+wso4Ok+otmt0Nj0rMUpHXWk1WYEHU4ZodlyBH jfEOBL9/A9v1eDScs1FkxIaIxhH4KQdNaZygarJWfKkYInDeeMotvGKCIeCpIo16S1Bt DHvw== 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=2cCrJ2T3lsz5o645qE6JJwrkYwd4cRkkzCyLadpkJHU=; b=aYOJ5onWPmcwasCfAg+J5qXbaTRDQV4RDIPP+bTO4nqHzsSiTfbrgFA2OKzeZlapEf lR8nmDNfpAtPOXzf6RhcnVJkeGh9dKgOLIpAYjXP+kEIjSPhK0waZyQqJOwzlFtvqmp5 1s6OrumXwnQVQwIuz29vACZWnTWwcZj25395OupEjNR24ZC3/Kci9eYbGTn9ILnPS++1 fvuN7VCzAGL6YQBOEeA+1aY90T24DQuTRPRM64Vu66z6urNXva6tE+eGGYp/hMVgt4Nf OHlvX/eP8R94bZY1Mmxk0iFRdWAeepXe2Wbiy8LCky+StaW35nfqN4FU3N5FrpZ8Q08A kIsQ== X-Gm-Message-State: ANoB5plNPTrybnXDw1bKLaV+UuE5aPV9sJY1oEFEVG/8SJaRHooneeZ5 +lT1SV+Zs8xL9newvLiWnZlQPqRB2ku+VM0= X-Received: from lixiaoyan-desktop.svl.corp.google.com ([2620:15c:2c4:201:4f64:90f:3bcd:e820]) (user=lixiaoyan job=sendgmr) by 2002:aa7:954d:0:b0:576:f9e2:a968 with SMTP id w13-20020aa7954d000000b00576f9e2a968mr15819671pfq.84.1670453679904; Wed, 07 Dec 2022 14:54:39 -0800 (PST) Date: Wed, 7 Dec 2022 14:54:34 -0800 Mime-Version: 1.0 X-Mailer: git-send-email 2.39.0.rc0.267.gcb52ba06e7-goog Message-ID: <20221207225435.1273226-1-lixiaoyan@google.com> Subject: [PATCH net-next v5 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?1751597807469469287?= X-GMAIL-MSGID: =?utf-8?q?1751597807469469287?= 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 | 36 ++++++++++++++++++++++++++++++++++++ net/ipv6/ip6_offload.c | 27 ++++----------------------- 2 files changed, 40 insertions(+), 23 deletions(-) diff --git a/include/net/ipv6.h b/include/net/ipv6.h index d383c895592a..6dcf93a1ec14 100644 --- a/include/net/ipv6.h +++ b/include/net/ipv6.h @@ -500,6 +500,42 @@ 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)); + + if (unlikely(!pskb_may_pull(skb, hophdr_len))) + return -1; + + __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 Wed Dec 7 22:54:35 2022 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Coco Li X-Patchwork-Id: 31085 Return-Path: Delivered-To: ouuuleilei@gmail.com Received: by 2002:adf:f944:0:0:0:0:0 with SMTP id q4csp445089wrr; Wed, 7 Dec 2022 14:58:24 -0800 (PST) X-Google-Smtp-Source: AA0mqf45sKuAJdee9e08AhHI+fWaZqbTUWwqy6I5c8W7/TTXjaa5fZ4tGZz1wyKaJxd9d1UW0v3b X-Received: by 2002:aa7:c1d0:0:b0:46b:431f:f2d4 with SMTP id d16-20020aa7c1d0000000b0046b431ff2d4mr15830240edp.198.1670453904385; Wed, 07 Dec 2022 14:58:24 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1670453904; cv=none; d=google.com; s=arc-20160816; b=xFR+duKGC2AlMWek+hPcSKiitwAW/vFRAwpqlUEMKsp7FckufB0DfS3tLF0k6YkUas UlNef1rGTx6VYgJoJbFO494jpNzfn+vBJ9xOenJG3mjPVBgjQ7MPH2J3LMld99UqPg+9 N7VshshepRJqS47oatDRJ5oHO98Jb7IsqMyWpn8C90ohlUv9sDmlVdM3CGD1dIPl7jWq 2EweSv8Ot8Pup7X+Ec86V1sY1rCkZOsJVSsqiDLXiLVvH3nvQd3vmL4ydU9Alc0VQxHi l4+sFE436pbjlgvXt+MoYRCpiKz8JrtnATTc2LU/yET0qMMV0M2AGTzi64IxWQK6AvqI siEg== 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=6eA6qqKwG6dZW9afQyr40lctIIKutYT4UeqLtVUnJPg=; b=Scha1zDrdQHe5rqcXWbONpLp5PNYiCTmTFYFdjq/YTUM2eVS3kp4puKEbbfaM3uo7g Wgq3fYLCS7f8gKdGfwye4m2mlLbbalubow+6hl/bXtPjaQhhT9TCb3VPRO8xbI0j2t/E dYWULUOFNTUG3It/KjVzAVKd4SG3QEukbq5otJhUJoJaMsLt9exAguyyi6wvZ3ptgFCw ehq716H10SeIaMMkZlGxXtifEAeom0DY1zaw8GwfRyi/okeufF1KEm2vIqd6Op6Hl/Qh gfg5sOHuC39FzUBFax2ddBAawvrYA8d7QXsjeiOqZwJ0IKDtYHFrK+J521DT7oZ0QmZn cU8g== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@google.com header.s=20210112 header.b=KdmkcfUs; 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 hd14-20020a170907968e00b00730936657d1si19828231ejc.552.2022.12.07.14.58.00; Wed, 07 Dec 2022 14:58:24 -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=KdmkcfUs; 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 S229928AbiLGWyt (ORCPT + 99 others); Wed, 7 Dec 2022 17:54:49 -0500 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:47630 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S229895AbiLGWyo (ORCPT ); Wed, 7 Dec 2022 17:54:44 -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 6D24321824 for ; Wed, 7 Dec 2022 14:54:43 -0800 (PST) Received: by mail-yw1-x1149.google.com with SMTP id 00721157ae682-352e29ff8c2so205395827b3.21 for ; Wed, 07 Dec 2022 14:54:43 -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=6eA6qqKwG6dZW9afQyr40lctIIKutYT4UeqLtVUnJPg=; b=KdmkcfUs9Wx8KNcQPfeWbYT7H7WWFrZ8Ml5GcijxSii2u2vUq6qwZ28Aob1squFjvs zHotApR1VCBqi4EO8uIZUCJlBgNPhVjfzX7NGehOXckHoCItsa0htlHiwmtTCl8v4FOI MrC5wx8Q3edQimJFQ4ZoitXRJe1MsNR9ftmTsYNHBdUpHKULp+MSHJj8Vp/zoKJqbhji tV1BjFxlEFkwlE1rkCyWrMft86K9UKk/E3rGVOC/6Ix3kKPg4+W4CuSkxSFH+9EmqyGl 5twRLqm7yvGf2dBzZA8RHM1vXXpvPxcbMJfNBMgNnPVQbThGUt2M0/D3RYBrZiOBZ6Tb OTZw== 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=6eA6qqKwG6dZW9afQyr40lctIIKutYT4UeqLtVUnJPg=; b=nvV+4Jfx8mQsErRk9di5rYvcDpvhG2Dd98ayig6OL7aKnKr4AKkHMk1sdMH6glCusG /YbmQ+CkNPFE3xzpxUQrbYn4c9shWs1PMMdStTYR2oYOu7aTg1NULSwMeGmLdq9KEF2M 0H4PfgSfKGLvv6K0iWYAPD6X8xsBlddJZ0DLijZJnVYxw1zY0DDR7gRGw+w/JEYwkejf 4SOTaE6g8x5WaC0zEbAaiB5uCH/wehvgcsJKx/iq2tEQ4OtbK0lz8e3vWNchVenWfRBb 5rzOi9oA5sFt3R1/cpG0JR/5qFBPQu/I4BE939qyFliGgl5x5cl7DlU6ZsMLtRn5TknI gvVA== X-Gm-Message-State: ANoB5plp+kEWRD2YsRLgjCZMLWPTFsP9T9lOSR6jpOsXv2tXyHDKX82w r4EOEJrNQq5LPWG/4//R1+P15UaHHyv6FyE= X-Received: from lixiaoyan-desktop.svl.corp.google.com ([2620:15c:2c4:201:4f64:90f:3bcd:e820]) (user=lixiaoyan job=sendgmr) by 2002:a05:690c:a84:b0:3ea:454d:d1ee with SMTP id ci4-20020a05690c0a8400b003ea454dd1eemr16167530ywb.27.1670453682703; Wed, 07 Dec 2022 14:54:42 -0800 (PST) Date: Wed, 7 Dec 2022 14:54:35 -0800 In-Reply-To: <20221207225435.1273226-1-lixiaoyan@google.com> Mime-Version: 1.0 References: <20221207225435.1273226-1-lixiaoyan@google.com> X-Mailer: git-send-email 2.39.0.rc0.267.gcb52ba06e7-goog Message-ID: <20221207225435.1273226-2-lixiaoyan@google.com> Subject: [RFC net-next v5 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?1751597872885858449?= X-GMAIL-MSGID: =?utf-8?q?1751597872885858449?= 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 path, 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. Big TCP functionality is tested by Michael, feature checks not yet. Tested by Michael: I've confirmed with our hardware team that this is supported by our chips, and I've tested it up to gso_max_size of 524280. Thanks. Tested-by: Michael Chan Reviewed-by: Michael Chan Signed-off-by: Coco Li --- 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 0fe164b42c5d..6ba1cd342a80 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; @@ -11315,6 +11318,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; @@ -11342,9 +11346,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 *)nexthdr; + 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 */ @@ -13657,6 +13679,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