Re: [PATCH net-next 2/9] net: tcp: add 'drop_reason' field to struct tcp_skb_cb

From: Menglong Dong
Date: Sun Oct 30 2022 - 23:08:42 EST


Hello,

On Sat, Oct 29, 2022 at 11:23 PM Eric Dumazet <edumazet@xxxxxxxxxx> wrote:
>
> On Sat, Oct 29, 2022 at 6:11 AM <menglong8.dong@xxxxxxxxx> wrote:
> >
> > From: Menglong Dong <imagedong@xxxxxxxxxxx>
> >
> > Because of the long call chain on processing skb in TCP protocol, it's
> > hard to pass the drop reason to the code where the skb is freed.
> >
> > Therefore, we can store the drop reason to skb->cb, and pass it to
> > kfree_skb_reason(). I'm lucky, the struct tcp_skb_cb still has 4 bytes
> > spare space for this purpose.
>
> No, we have needs for this space for future use.
>
> skb->cb[] purpose is to store semi-permanent info, for skbs that stay
> in a queue.
>

May I use it for a while? Or, can I make it a union with
some field, such as 'header'? As the 'drop_reason' field will
be set only if it is going to be freed.

> Here, you need a state stored only in the context of the current context.
> Stack variables are better.

It's hard to get the drop reason through stack variables,
especially some functions in TCP protocol, such as:

tcp_rcv_synsent_state_process
tcp_timewait_state_process
tcp_conn_request
tcp_rcv_state_process

And it will mess the code a little up, just like what
you comment in this series:

https://lore.kernel.org/netdev/20220617100514.7230-1-imagedong@xxxxxxxxxxx/

I hope to complete this part, or I think I can't move
ahead :/

Thanks!
Menglong Dong