Re: [PATCH] tcp: tcp_drop adds `SNMP` and `reason` parameter for tracing

From: Zhongya Yan
Date: Thu Sep 23 2021 - 01:31:42 EST


On Wed, 22 Sep 2021 23:08:15 -0400

Cong Wang <xiyou.wangcong@xxxxxxxxx> wrote:

> I think you fail to explain why only TCP needs it?

Thanks for the suggestion, I will rewrite the description document.

> This should be useful for all kinds of drops, not just TCP, therefore
> you should consider extending net/core/drop_monitor.c instead of
> just tcp_drop().

Currently, I'll look at the code in `net/core/drop_monitor.c` later

because it only extends tcp.

> Also, kernel does not have to explain it in strings, those SNMP
> counters are already available for user-space, so kernel could
> just use SNMP enums and let user-space interpret them. In many
> cases, you are just adding strings for those SNMP enums.
>
> Thanks.

Since these drops are hardly hot path, why not simply use a string ?
An ENUM will not really help grep games.
--Eric Dumazet

I think `Eric`s point is correct, so strings are used. SNMP is auxiliary,

I can remove it if you find it unfriendly