Re: [PATCH net-next] net: tso: inline tso_count_descs()

From: Jakub Kicinski
Date: Fri Dec 09 2022 - 17:35:36 EST


On Fri, 9 Dec 2022 16:48:57 +0800 Yunsheng Lin wrote:
> >> 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.

Yes, we need the definition of skb_shinfo() so let's include the header.
Let's not depend on second-order includes, it makes refactoring harder.

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

Thanks, you can replace the comment about the function with this
comment. No need to have two comments, and mentioning descriptors
is slightly confusing because descriptor is not always equivalent
to a buffer.