Re: [PATCH] net/mlx4: tcp_drop replace of tcp_drop_new

From: Cong Wang
Date: Mon Aug 23 2021 - 15:07:14 EST


On Sat, Aug 21, 2021 at 8:55 AM jony-one <yan2228598786@xxxxxxxxx> wrote:
> @@ -4676,7 +4683,7 @@ static void tcp_ofo_queue(struct sock *sk)
> rb_erase(&skb->rbnode, &tp->out_of_order_queue);
>
> if (unlikely(!after(TCP_SKB_CB(skb)->end_seq, tp->rcv_nxt))) {
> - tcp_drop(sk, skb);
> + tcp_drop_new(sk, skb, __func__);

This is very similar to race_kfree_skb():

void kfree_skb(struct sk_buff *skb)
{
if (!skb_unref(skb))
return;

trace_kfree_skb(skb, __builtin_return_address(0));
__kfree_skb(skb);
}

So... why not something like this?

iff --git a/net/ipv4/tcp_input.c b/net/ipv4/tcp_input.c
index 3f7bd7ae7d7a..cc840e4552c9 100644
--- a/net/ipv4/tcp_input.c
+++ b/net/ipv4/tcp_input.c
@@ -4678,6 +4678,7 @@ static bool tcp_ooo_try_coalesce(struct sock *sk,
static void tcp_drop(struct sock *sk, struct sk_buff *skb)
{
sk_drops_add(sk, skb);
+ trace_kfree_skb(skb, __builtin_return_address(0));
__kfree_skb(skb);
}

Thanks.