From patchwork Thu Dec 8 02:43:03 2022 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Yunsheng Lin X-Patchwork-Id: 31120 Return-Path: Delivered-To: ouuuleilei@gmail.com Received: by 2002:adf:f944:0:0:0:0:0 with SMTP id q4csp525531wrr; Wed, 7 Dec 2022 18:45:17 -0800 (PST) X-Google-Smtp-Source: AA0mqf4Ul3HE5CSD4yZLi8yU1GP2NFngcnAYWv3sBGEfIz8HANKIL7SykxAZVShEEiUF8pB1xC4p X-Received: by 2002:a17:90a:5787:b0:218:8398:5846 with SMTP id g7-20020a17090a578700b0021883985846mr98857787pji.241.1670467517578; Wed, 07 Dec 2022 18:45:17 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1670467517; cv=none; d=google.com; s=arc-20160816; b=XPz9rWwx2p+E5vz6Q7dL3BzU0RJ6YxiF9zVxpOFw/toEgJik7vv1+ng+Oxj/4BICW0 I3wTod9xcyyELzN1B41by6KBV9MZyRWEK7SG2YM1TbWw3I/ewOFH2OC14p0qi3xosP/Z lL/fkGuxbBDYfX+z+d8dLNDocI8Yzl9Pej2u7PFyHe+l5oAku5FEMWj1qYiq7EGhWbDL szmPCnQiqFZGOSCafvgPnbPamNa1RhE5ZvkDNBKXGPdE3ljxvXE8eutmT8HMbPKuoGLj /jy85FPSj1T2dsWYFHO4LlvFVQdwXaN8KLpON0fxTxIeye3XhHwvCnV8aWxicpcF+E74 xD2g== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:content-transfer-encoding:mime-version :message-id:date:subject:cc:to:from; bh=WAme4aqDB8ORodtyGNky5I8CRm9/eZTEH18v0v1Bxf0=; b=a7fRRY5mJLoj9EPvpJjTivqriYz7UIUjMXyz72xaO+GcSnjHr9ixZbXZBbJ73DqD8g SHkOAzy04oijwdeVP1fkhRqW+PvVLRoctPDmrQYpKAPTTx3WG/8L9pkIVBArwmh8cM5e 8EUTioMJ9gMGJJO0Z/00M3tYbgQH4QSMBBnjnOsmnkYcINUD1mHheGWqxjusfQ8CUQIM kufAVEPQPNWdXzY30yOCR2LUPgYgffYlpZltUBD8YC8yC9iil/LBtzruOTMNwege6IdM oQSgvYmtKgbXPz9qbHlZo3lZ832QTtTmJHVumLeUnj/ofCh3JgxOexLSrEAIbM7T4TKQ xbvg== 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 Received: from out1.vger.email (out1.vger.email. [2620:137:e000::1:20]) by mx.google.com with ESMTP id t18-20020a1709028c9200b00186ba4ba494si20402608plo.475.2022.12.07.18.45.02; Wed, 07 Dec 2022 18:45:17 -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 S229812AbiLHCnA (ORCPT + 99 others); Wed, 7 Dec 2022 21:43:00 -0500 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:36300 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S229724AbiLHCm6 (ORCPT ); Wed, 7 Dec 2022 21:42:58 -0500 Received: from szxga02-in.huawei.com (szxga02-in.huawei.com [45.249.212.188]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 868E256566; Wed, 7 Dec 2022 18:42:56 -0800 (PST) Received: from dggpemm500005.china.huawei.com (unknown [172.30.72.53]) by szxga02-in.huawei.com (SkyGuard) with ESMTP id 4NSJMb1zzlzRprN; Thu, 8 Dec 2022 10:42:03 +0800 (CST) Received: from localhost.localdomain (10.69.192.56) 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; Thu, 8 Dec 2022 10:42:54 +0800 From: Yunsheng Lin To: , , , CC: , , Subject: [PATCH net-next] net: tso: inline tso_count_descs() Date: Thu, 8 Dec 2022 10:43:03 +0800 Message-ID: <20221208024303.11191-1-linyunsheng@huawei.com> X-Mailer: git-send-email 2.33.0 MIME-Version: 1.0 X-Originating-IP: [10.69.192.56] X-ClientProxiedBy: dggems704-chm.china.huawei.com (10.3.19.181) To dggpemm500005.china.huawei.com (7.185.36.74) X-CFilter-Loop: Reflected X-Spam-Status: No, score=-4.2 required=5.0 tests=BAYES_00,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 X-getmail-retrieved-from-mailbox: =?utf-8?q?INBOX?= X-GMAIL-THRID: =?utf-8?q?1751612147852380414?= X-GMAIL-MSGID: =?utf-8?q?1751612147852380414?= 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. Signed-off-by: Yunsheng Lin --- include/net/tso.h | 8 +++++++- net/core/tso.c | 8 -------- 2 files changed, 7 insertions(+), 9 deletions(-) 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; }; -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 */ + return skb_shinfo(skb)->gso_segs * 2 + skb_shinfo(skb)->nr_frags; +} + void tso_build_hdr(const struct sk_buff *skb, char *hdr, struct tso_t *tso, int size, bool is_last); void tso_build_data(const struct sk_buff *skb, struct tso_t *tso, int size); diff --git a/net/core/tso.c b/net/core/tso.c index 4148f6d48953..e00796e3b146 100644 --- a/net/core/tso.c +++ b/net/core/tso.c @@ -5,14 +5,6 @@ #include #include -/* Calculate expected number of TX descriptors */ -int tso_count_descs(const struct sk_buff *skb) -{ - /* The Marvell Way */ - return skb_shinfo(skb)->gso_segs * 2 + skb_shinfo(skb)->nr_frags; -} -EXPORT_SYMBOL(tso_count_descs); - void tso_build_hdr(const struct sk_buff *skb, char *hdr, struct tso_t *tso, int size, bool is_last) {