Subject: Re: [PATCH net-next] skb: make drop reason booleanable

From: Toke Høiland-Jørgensen <[email-masked]>
Date: Tue, 08 Mar 2022 14:57:51 +0100

Jakub Kicinski <[email-masked]> writes:

> We have a number of cases where function returns drop/no drop
> decision as a boolean. Now that we want to report the reason
> code as well we have to pass extra output arguments.
>
> We can make the reason code evaluate correctly as bool.
>
> I believe we're good to reorder the reasons as they are
> reported to user space as strings.
>
> Signed-off-by: Jakub Kicinski <[email-masked]>
> ---
> v2: use Eric's suggestion for the name, indeed better than mine
> ---
>  include/linux/skbuff.h |  1 +
>  include/net/tcp.h      | 21 +++++++++++----------
>  net/ipv4/tcp.c         | 21 +++++++++------------
>  net/ipv4/tcp_ipv4.c    | 12 +++++++-----
>  net/ipv6/tcp_ipv6.c    | 11 +++++++----
>  5 files changed, 35 insertions(+), 31 deletions(-)
>
> diff --git a/include/linux/skbuff.h b/include/linux/skbuff.h
> index 34f572271c0c..26538ceb4b01 100644
> --- a/include/linux/skbuff.h
> +++ b/include/linux/skbuff.h
> @@ -314,6 +314,7 @@ struct sk_buff;
>   * used to translate the reason to string.
>   */
>  enum skb_drop_reason {
> +	SKB_NOT_DROPPED_YET = 0,

Haha, nice! Even feels like this is touching on some deep philosophical
truth about the state of packets - the best they can hope for is to be
not dropped... yet! :D

-Toke