From: Menglong Dong <imaged...@tencent.com>

Replace tcp_drop() used in tcp_data_queue_ofo with tcp_drop_reason().
Following drop reasons are introduced:

SKB_DROP_REASON_TCP_OFOMERGE

Reviewed-by: Mengen Sun <mengen...@tencent.com>
Reviewed-by: Hao Peng <flyingp...@tencent.com>
Signed-off-by: Menglong Dong <imaged...@tencent.com>
Reviewed-by: Eric Dumazet <eduma...@google.com>
Reviewed-by: David Ahern <dsah...@kernel.org>
Signed-off-by: David S. Miller <da...@davemloft.net>
Acked-by: Nikolay Borisov <nbori...@suse.com>
Signed-off-by: Nikolay Borisov <nikolay.bori...@virtuozzo.com>
---
 include/linux/skbuff.h     |  5 +++++
 include/trace/events/skb.h |  1 +
 net/ipv4/tcp_input.c       | 10 ++++++----
 3 files changed, 12 insertions(+), 4 deletions(-)

diff --git a/include/linux/skbuff.h b/include/linux/skbuff.h
index 680a6185219d..d3f79982e3f4 100644
--- a/include/linux/skbuff.h
+++ b/include/linux/skbuff.h
@@ -374,6 +374,11 @@ enum skb_drop_reason {
                                         * the right edges of receive
                                         * window
                                         */
+       SKB_DROP_REASON_TCP_OFOMERGE,   /* the data of skb is already in
+                                        * the ofo queue, corresponding to
+                                        * LINUX_MIB_TCPOFOMERGE
+                                        */
+
 
 
        SKB_DROP_REASON_MAX,
diff --git a/include/trace/events/skb.h b/include/trace/events/skb.h
index 0d9e1ad02228..c81b55e19d09 100644
--- a/include/trace/events/skb.h
+++ b/include/trace/events/skb.h
@@ -36,6 +36,7 @@
        EM(SKB_DROP_REASON_TCP_ZEROWINDOW, TCP_ZEROWINDOW)      \
        EM(SKB_DROP_REASON_TCP_OLD_DATA, TCP_OLD_DATA)          \
        EM(SKB_DROP_REASON_TCP_OVERWINDOW, TCP_OVERWINDOW)      \
+       EM(SKB_DROP_REASON_TCP_OFOMERGE, TCP_OFOMERGE)          \
 
        EMe(SKB_DROP_REASON_MAX, MAX)
 
diff --git a/net/ipv4/tcp_input.c b/net/ipv4/tcp_input.c
index 37df05cf5e35..a21a4b5602c0 100644
--- a/net/ipv4/tcp_input.c
+++ b/net/ipv4/tcp_input.c
@@ -4741,7 +4741,7 @@ static void tcp_data_queue_ofo(struct sock *sk, struct 
sk_buff *skb)
        if (unlikely(tcp_try_rmem_schedule(sk, skb, skb->truesize))) {
                NET_INC_STATS(sock_net(sk), LINUX_MIB_TCPOFODROP);
                sk->sk_data_ready(sk);
-               tcp_drop(sk, skb);
+               tcp_drop_reason(sk, skb, SKB_DROP_REASON_PROTO_MEM);
                return;
        }
 
@@ -4804,7 +4804,8 @@ static void tcp_data_queue_ofo(struct sock *sk, struct 
sk_buff *skb)
                                /* All the bits are present. Drop. */
                                NET_INC_STATS(sock_net(sk),
                                              LINUX_MIB_TCPOFOMERGE);
-                               tcp_drop(sk, skb);
+                               tcp_drop_reason(sk, skb,
+                                               SKB_DROP_REASON_TCP_OFOMERGE);
                                skb = NULL;
                                tcp_dsack_set(sk, seq, end_seq);
                                goto add_sack;
@@ -4823,7 +4824,8 @@ static void tcp_data_queue_ofo(struct sock *sk, struct 
sk_buff *skb)
                                                 TCP_SKB_CB(skb1)->end_seq);
                                NET_INC_STATS(sock_net(sk),
                                              LINUX_MIB_TCPOFOMERGE);
-                               tcp_drop(sk, skb1);
+                               tcp_drop_reason(sk, skb1,
+                                               SKB_DROP_REASON_TCP_OFOMERGE);
                                goto merge_right;
                        }
                } else if (tcp_ooo_try_coalesce(sk, skb1,
@@ -4851,7 +4853,7 @@ static void tcp_data_queue_ofo(struct sock *sk, struct 
sk_buff *skb)
                tcp_dsack_extend(sk, TCP_SKB_CB(skb1)->seq,
                                 TCP_SKB_CB(skb1)->end_seq);
                NET_INC_STATS(sock_net(sk), LINUX_MIB_TCPOFOMERGE);
-               tcp_drop(sk, skb1);
+               tcp_drop_reason(sk, skb1, SKB_DROP_REASON_TCP_OFOMERGE);
        }
        /* If there is no skb after us, we are the last_skb ! */
        if (!skb1)
-- 
2.34.1

_______________________________________________
Devel mailing list
Devel@openvz.org
https://lists.openvz.org/mailman/listinfo/devel

Reply via email to