tcp: use SKB_DROP_REASON_SOCKET_RCVBUFF when over sk_rcvbuf

tcp_data_queue() and tcp_data_queue_ofo() use SKB_DROP_REASON_PROTO_MEM
for all packets that can not be queued, whether the socket is over its
receive buffer, or the protocol memory limits (tcp_mem) are reached.

Make tcp_try_rmem_schedule() return a drop reason:

- SKB_DROP_REASON_SOCKET_RCVBUFF when the socket is over sk_rcvbuf,
  as already used by UDP and sock_queue_rcv_skb().

- SKB_DROP_REASON_PROTO_MEM when sk_rmem_schedule() fails.

This helps to identify peers repeatedly sending segments that can not
be queued, with tools like drop monitor or perf.

Signed-off-by: Eric Dumazet <edumazet@kernel.org>
Reviewed-by: Kuniyuki Iwashima <kuniyu@google.com>
Link: https://patch.msgid.link/20261114155150.235743-4-edumazet@kernel.org
Signed-off-by: Jakub Kicinski <kuba@kernel.org>
1 file changed