Re: [PATCH 1/1] gro: decrease size of CB

From: Simon Horman
Date: Tue May 30 2023 - 08:00:12 EST


On Mon, May 29, 2023 at 06:12:42PM +0200, Richard Gobert wrote:
> The GRO control block (NAPI_GRO_CB) is currently at its maximum size.
> This commit reduces its size by putting two groups of fields that are
> used only at different times into a union.
>
> Specifically, the fields frag0 and frag0_len are the fields that make up
> the frag0 optimisation mechanism, which is used during the initial
> parsing of the SKB.
>
> The fields last and age are used after the initial parsing, while the
> SKB is stored in the GRO list, waiting for other packets to arrive.
>
> There was one location in dev_gro_receive that modified the frag0 fields
> after setting last and age. I changed this accordingly without altering
> the code behaviour.
>
> Signed-off-by: Richard Gobert <richardbgobert@xxxxxxxxx>

...

> diff --git a/net/core/gro.c b/net/core/gro.c
> index 2d84165cb4f1..91454176a6d8 100644
> --- a/net/core/gro.c
> +++ b/net/core/gro.c
> @@ -460,6 +460,14 @@ static void gro_pull_from_frag0(struct sk_buff *skb, int grow)
> }
> }
>
> +static inline void gro_try_pull_from_frag0(struct sk_buff *skb)

Hi Richard,

In general it is preferred not to use the inline keyword in C files,
but rather let the compiler do it's thing.

Unless you think the compiler isn't doing it's thing very well
in this case, please consider removing the inline keyword.

> +{
> + int grow = skb_gro_offset(skb) - skb_headlen(skb);
> +
> + if (grow > 0)
> + gro_pull_from_frag0(skb, grow);
> +}
> +
> static void gro_flush_oldest(struct napi_struct *napi, struct list_head *head)
> {
> struct sk_buff *oldest;

...