Received: by 2002:a05:6358:d09b:b0:dc:cd0c:909e with SMTP id jc27csp231504rwb; Wed, 7 Dec 2022 17:12:10 -0800 (PST) X-Google-Smtp-Source: AA0mqf4WZacN7HKWkjJqRse91FNU9rF2zERVGtqMu6oF+6xwUoYdXezcpUILtV+MlCBF9W4KoJa0 X-Received: by 2002:a63:4e4c:0:b0:46f:dc59:aab6 with SMTP id o12-20020a634e4c000000b0046fdc59aab6mr86185725pgl.35.1670461929958; Wed, 07 Dec 2022 17:12:09 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1670461929; cv=none; d=google.com; s=arc-20160816; b=zliSSjC/L/ktbVACe16ZjZLFUNoYLXVdHgKZ9zovfqnJQu8IiLIY7G+YNLoLZIddew 7/wuT2eru2Mq3QnCMl+PttWAVlxplGHnFsFVqYGFRMHUjIlEKAxKSfzeNouCeePT+vCh A8bQOKhQIN6rLHD8aBfQtAX5JOXRdDXLzMsf5ISLoznIK4TWS2bq6f3HUPHKgSYAC7Bj kEh7MoHgcGHDhr9jhcFG+tH3/ExE571azoMDI4odJmd1pN0w/fGm8vMyp/wRPIh7srcz HQimnDdR+yZOSwKX/BtlZ924cvmMMR3/rlm6nzSRmjJbhOunbi+hnvUCp+mOpt2ftaeC CwVg== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:in-reply-to:content-disposition:mime-version :references:message-id:subject:cc:to:from:date:dkim-signature; bh=ZDVDAT2ajS/uRGudbc+kYoOLXTrIxEnYcgLl4ZmfW/0=; b=THKncDQPfOPqi9N08BJYudXe///J3EXvlzBUECy4I24Wxf6zEtUO6PM22Dj7gHYGF6 KO65/CSmSSXcsP0yJTdCd7c+joW3+jrka+DoCKmzTVCKRX2NLe3q4clsSQS5gGU15cg1 3cKSjabYV6h5EaosYHSRIfubmmNvDJpKqOpgxD9UmEC/ig9o1nwbK2QmWSJAb7pirnjb /6MYozn820RrWeGQDvFahoAzYj6YiF/r3xsjzd8t1XsJ0A+Dhm8nNGTIJtWr+XBfICIB DLG8I8iVpGY4WdrTQpJ7BlngjlghLcveHwLSqxhPt/3+GUYwwhRMfEq4ZHUtOkRIBuay gGoA== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@kernel.org header.s=k20201202 header.b=Zd3BfIh7; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=kernel.org Return-Path: Received: from out1.vger.email (out1.vger.email. [2620:137:e000::1:20]) by mx.google.com with ESMTP id z36-20020a631924000000b0046f4d395e6dsi21638538pgl.573.2022.12.07.17.12.00; Wed, 07 Dec 2022 17:12:09 -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=@kernel.org header.s=k20201202 header.b=Zd3BfIh7; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=kernel.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S229514AbiLHAdG (ORCPT + 74 others); Wed, 7 Dec 2022 19:33:06 -0500 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:51456 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S229756AbiLHAdE (ORCPT ); Wed, 7 Dec 2022 19:33:04 -0500 Received: from ams.source.kernel.org (ams.source.kernel.org [145.40.68.75]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id B35378D65E; Wed, 7 Dec 2022 16:33:02 -0800 (PST) Received: from smtp.kernel.org (relay.kernel.org [52.25.139.140]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by ams.source.kernel.org (Postfix) with ESMTPS id 75E0DB81C57; Thu, 8 Dec 2022 00:33:01 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id F2499C433C1; Thu, 8 Dec 2022 00:32:59 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=k20201202; t=1670459580; bh=aERxJVK9LoSfFhjpfc9CEj7Hfvg3pTGFz3M0Px/sXYI=; h=Date:From:To:Cc:Subject:References:In-Reply-To:From; b=Zd3BfIh7CG0K8SLra+kRrexs7FTQsrK/eqrxe/Xv1h+gJkb8YrMbRuryCDeWLoxxo TVxBAa5CPdqVrtHrSny3XIFghSggD97vCducfp1P+q8RTemBt/5dASbyx/ZRHllhFq TgJcBL9fR6EwHLnBYm3+NJHBx1tV2fgdMVPh/qYnWur3hV1saA5aMKsIym4WdzGamc mIcqPscfHDVSObcE0Duezr3y5QRwKyO1UVnT1BLNDP0CmAqESH5Ad/pnbemJ70BSDm ZNrJOAYAuDwZ7tTI7o90PtgR/AD154vBaQQW9Kyj+HWz2fqY27l2wh/9G+YBMRM5c4 MQ1xphWsJQwWA== Date: Wed, 7 Dec 2022 16:32:58 -0800 From: Saeed Mahameed To: Coco Li Cc: "David S. Miller" , Hideaki YOSHIFUJI , David Ahern , Eric Dumazet , Jakub Kicinski , Paolo Abeni , Michael Chan , netdev@vger.kernel.org, linux-kernel@vger.kernel.org Subject: Re: [RFC net-next v5 2/2] bnxt: Use generic HBH removal helper in tx path Message-ID: References: <20221207225435.1273226-1-lixiaoyan@google.com> <20221207225435.1273226-2-lixiaoyan@google.com> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii; format=flowed Content-Disposition: inline In-Reply-To: <20221207225435.1273226-2-lixiaoyan@google.com> X-Spam-Status: No, score=-7.1 required=5.0 tests=BAYES_00,DKIMWL_WL_HIGH, DKIM_SIGNED,DKIM_VALID,DKIM_VALID_AU,DKIM_VALID_EF,RCVD_IN_DNSWL_HI, SPF_HELO_NONE,SPF_PASS autolearn=ham autolearn_force=no version=3.4.6 X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on lindbergh.monkeyblade.net Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On 07 Dec 14:54, Coco Li wrote: >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 ^ patch >be removed in bnxt drivers to allow it to send big TCP packets (bigger >TSO packets) as well. > I think Eric didn't expose this function because it isn't efficient for drivers who are already processing the headers separately from payload for LSO packets .. the trick is to have an optimized copy method depending on your driver xmit function, usually you would just memcpy the TCP header over the HBH exactly at the point you copy/process those headers into the HW descriptor. >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 >-- >2.39.0.rc0.267.gcb52ba06e7-goog >