Received: by 2002:a05:6358:d09b:b0:dc:cd0c:909e with SMTP id jc27csp2390300rwb; Fri, 9 Dec 2022 01:15:47 -0800 (PST) X-Google-Smtp-Source: AA0mqf4FpyRrbAbCsp8T0KqClbaNEM25fuo0gTv4wFCdbD2I62Ddg/M28hZTNnTL8R/h6ZCSWRj+ X-Received: by 2002:a17:907:7621:b0:78d:f455:30ff with SMTP id jy1-20020a170907762100b0078df45530ffmr4179362ejc.39.1670577347545; Fri, 09 Dec 2022 01:15:47 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1670577347; cv=none; d=google.com; s=arc-20160816; b=a6GDHb3FB7mwLxx+JV5F6DpXaQB7Lxfi4nau/vhyFMZHzzwwgfhb4vVLs73EEuPGf8 xHNeQd37OEnvOcYppYg+h9mTpv6FteODiWDXlpCTliJZ8HlZO+xKO8e9oARc/CVskcsI 0nxjcZNFH17x+DPzIk+rMEg1Y74Rgy+p2nBh1k0aKGlIZxGpVfWjDkjAFQShZFzdaPba LoHZqr6qDBlxVtKHelt+fq64EW+NBAzXpd5/TzOEwFlYJ072g9KvAYzYpbZ4hvaKXBee gJaDCAkCuZ2jbN2Zmbn4GCqZfyICzLhmeMXPRQ+7941T0M/62jiRYWnNE3nI+TGqY2rA 6XFg== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:content-transfer-encoding:content-language :in-reply-to:mime-version:user-agent:date:message-id:from:references :cc:to:subject; bh=lwdzG5O84a5wPiNwBKs5HaQzNNrwkK0VFGcC5q94eF8=; b=vqCtnpXDE7eC/+G53nbkngiNpt7PKXzZHnOXvwXRRDMAdUEGTyHlXWJkZ3fQgZhfC1 WEvBdS2bmPLXZmYQpOXe/MNUnaATQJRbplNd/o7u4QfTy6QScOybeBByIWXOj+AJ6VTm 0KsaiZogBBxKwwmTHERwcOxdAhSV9TD9iBV9eU+U+93nfaE8qpqL82LmnYDzaamJ1uW5 WzYGPd0YmqPGcKGJsHBz5NgWvt8hHlU2fN8sQqtgn3EXGHyu/4FX6SqYO1kn09o4iAXw 8qzHl0LFCkvXGb5KzHImrQPaTljQoxaV7L28P2kI/GpHB4+8X3UdUfgsTDeVYJ9V+mZ+ TGTg== ARC-Authentication-Results: i=1; mx.google.com; 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=fail (p=QUARANTINE sp=QUARANTINE dis=NONE) header.from=huawei.com Return-Path: Received: from out1.vger.email (out1.vger.email. [2620:137:e000::1:20]) by mx.google.com with ESMTP id e5-20020a17090658c500b0073d8830e4c7si830590ejs.954.2022.12.09.01.15.29; Fri, 09 Dec 2022 01:15:47 -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; 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=fail (p=QUARANTINE sp=QUARANTINE dis=NONE) header.from=huawei.com Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S229851AbiLIItg (ORCPT + 74 others); Fri, 9 Dec 2022 03:49:36 -0500 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:52548 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S229460AbiLIIte (ORCPT ); Fri, 9 Dec 2022 03:49:34 -0500 Received: from szxga01-in.huawei.com (szxga01-in.huawei.com [45.249.212.187]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 1B440396FA; Fri, 9 Dec 2022 00:49:31 -0800 (PST) Received: from dggpemm500005.china.huawei.com (unknown [172.30.72.54]) by szxga01-in.huawei.com (SkyGuard) with ESMTP id 4NT4S471CVzmWWK; Fri, 9 Dec 2022 16:48:36 +0800 (CST) Received: from [10.69.30.204] (10.69.30.204) by dggpemm500005.china.huawei.com (7.185.36.74) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_128_GCM_SHA256) id 15.1.2375.31; Fri, 9 Dec 2022 16:48:57 +0800 Subject: Re: [PATCH net-next] net: tso: inline tso_count_descs() To: Jakub Kicinski CC: , , , , , , References: <20221208024303.11191-1-linyunsheng@huawei.com> <20221208195721.698f68b6@kernel.org> From: Yunsheng Lin Message-ID: Date: Fri, 9 Dec 2022 16:48:57 +0800 User-Agent: Mozilla/5.0 (Windows NT 10.0; WOW64; rv:52.0) Gecko/20100101 Thunderbird/52.2.0 MIME-Version: 1.0 In-Reply-To: <20221208195721.698f68b6@kernel.org> Content-Type: text/plain; charset="utf-8" Content-Language: en-US Content-Transfer-Encoding: 7bit X-Originating-IP: [10.69.30.204] X-ClientProxiedBy: dggems702-chm.china.huawei.com (10.3.19.179) To dggpemm500005.china.huawei.com (7.185.36.74) X-CFilter-Loop: Reflected X-Spam-Status: No, score=-4.5 required=5.0 tests=BAYES_00,NICE_REPLY_A, RCVD_IN_DNSWL_MED,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 2022/12/9 11:57, Jakub Kicinski wrote: > On Thu, 8 Dec 2022 10:43:03 +0800 Yunsheng Lin wrote: >> tso_count_descs() is a small function doing simple calculation, >> and tso_count_descs() is used in fast path, so inline it to >> reduce the overhead of calls. > > TSO frames are large, the overhead is fine. > I'm open to other opinions but I'd rather keep the code as is than > deal with the influx with similar sloppily automated changes. > >> diff --git a/include/net/tso.h b/include/net/tso.h >> index 62c98a9c60f1..ab6bbf56d984 100644 >> --- a/include/net/tso.h >> +++ b/include/net/tso.h >> @@ -16,7 +16,13 @@ struct tso_t { >> u32 tcp_seq; >> }; > > no include for skbuff.h here Do you mean including skbuff.h explicitly in tso.h? It seems ip.h included in tso.h has included skbuff.h. > >> -int tso_count_descs(const struct sk_buff *skb); >> +/* Calculate expected number of TX descriptors */ >> +static inline int tso_count_descs(const struct sk_buff *skb) >> +{ >> + /* The Marvell Way */ > > these comments should be rewritten as we move > the function clearly calculates the worst case buffer count Will change to below: /* Calculate the worst case buffer count */ > >> + return skb_shinfo(skb)->gso_segs * 2 + skb_shinfo(skb)->nr_frags; >> +} > . >