netdev.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: Jakub Kicinski <kuba@kernel.org>
To: Yunsheng Lin <linyunsheng@huawei.com>
Cc: <davem@davemloft.net>, <pabeni@redhat.com>, <edumazet@google.com>,
	<netdev@vger.kernel.org>, <linux-kernel@vger.kernel.org>,
	<linuxarm@openeuler.org>
Subject: Re: [PATCH net-next] net: tso: inline tso_count_descs()
Date: Thu, 8 Dec 2022 19:57:21 -0800	[thread overview]
Message-ID: <20221208195721.698f68b6@kernel.org> (raw)
In-Reply-To: <20221208024303.11191-1-linyunsheng@huawei.com>

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

> -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

> +	return skb_shinfo(skb)->gso_segs * 2 + skb_shinfo(skb)->nr_frags;
> +}

  reply	other threads:[~2022-12-09  3:57 UTC|newest]

Thread overview: 6+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2022-12-08  2:43 [PATCH net-next] net: tso: inline tso_count_descs() Yunsheng Lin
2022-12-09  3:57 ` Jakub Kicinski [this message]
2022-12-09  3:59   ` Jakub Kicinski
2022-12-09  8:56     ` Yunsheng Lin
2022-12-09  8:48   ` Yunsheng Lin
2022-12-09 22:35     ` Jakub Kicinski

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20221208195721.698f68b6@kernel.org \
    --to=kuba@kernel.org \
    --cc=davem@davemloft.net \
    --cc=edumazet@google.com \
    --cc=linux-kernel@vger.kernel.org \
    --cc=linuxarm@openeuler.org \
    --cc=linyunsheng@huawei.com \
    --cc=netdev@vger.kernel.org \
    --cc=pabeni@redhat.com \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).