Skip to content

Commit d25e481

Browse files
menglongdongdavem330
authored andcommitted
net: tcp: use tcp_drop_reason() for tcp_data_queue_ofo()
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 <[email protected]> Reviewed-by: Hao Peng <[email protected]> Signed-off-by: Menglong Dong <[email protected]> Reviewed-by: Eric Dumazet <[email protected]> Reviewed-by: David Ahern <[email protected]> Signed-off-by: David S. Miller <[email protected]>
1 parent a7ec381 commit d25e481

File tree

3 files changed

+11
-4
lines changed

3 files changed

+11
-4
lines changed

include/linux/skbuff.h

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -376,6 +376,10 @@ enum skb_drop_reason {
376376
* the right edges of receive
377377
* window
378378
*/
379+
SKB_DROP_REASON_TCP_OFOMERGE, /* the data of skb is already in
380+
* the ofo queue, corresponding to
381+
* LINUX_MIB_TCPOFOMERGE
382+
*/
379383
SKB_DROP_REASON_MAX,
380384
};
381385

include/trace/events/skb.h

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -36,6 +36,7 @@
3636
EM(SKB_DROP_REASON_TCP_ZEROWINDOW, TCP_ZEROWINDOW) \
3737
EM(SKB_DROP_REASON_TCP_OLD_DATA, TCP_OLD_DATA) \
3838
EM(SKB_DROP_REASON_TCP_OVERWINDOW, TCP_OVERWINDOW) \
39+
EM(SKB_DROP_REASON_TCP_OFOMERGE, TCP_OFOMERGE) \
3940
EMe(SKB_DROP_REASON_MAX, MAX)
4041

4142
#undef EM

net/ipv4/tcp_input.c

Lines changed: 6 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -4779,7 +4779,7 @@ static void tcp_data_queue_ofo(struct sock *sk, struct sk_buff *skb)
47794779
if (unlikely(tcp_try_rmem_schedule(sk, skb, skb->truesize))) {
47804780
NET_INC_STATS(sock_net(sk), LINUX_MIB_TCPOFODROP);
47814781
sk->sk_data_ready(sk);
4782-
tcp_drop(sk, skb);
4782+
tcp_drop_reason(sk, skb, SKB_DROP_REASON_PROTO_MEM);
47834783
return;
47844784
}
47854785

@@ -4842,7 +4842,8 @@ static void tcp_data_queue_ofo(struct sock *sk, struct sk_buff *skb)
48424842
/* All the bits are present. Drop. */
48434843
NET_INC_STATS(sock_net(sk),
48444844
LINUX_MIB_TCPOFOMERGE);
4845-
tcp_drop(sk, skb);
4845+
tcp_drop_reason(sk, skb,
4846+
SKB_DROP_REASON_TCP_OFOMERGE);
48464847
skb = NULL;
48474848
tcp_dsack_set(sk, seq, end_seq);
48484849
goto add_sack;
@@ -4861,7 +4862,8 @@ static void tcp_data_queue_ofo(struct sock *sk, struct sk_buff *skb)
48614862
TCP_SKB_CB(skb1)->end_seq);
48624863
NET_INC_STATS(sock_net(sk),
48634864
LINUX_MIB_TCPOFOMERGE);
4864-
tcp_drop(sk, skb1);
4865+
tcp_drop_reason(sk, skb1,
4866+
SKB_DROP_REASON_TCP_OFOMERGE);
48654867
goto merge_right;
48664868
}
48674869
} else if (tcp_ooo_try_coalesce(sk, skb1,
@@ -4889,7 +4891,7 @@ static void tcp_data_queue_ofo(struct sock *sk, struct sk_buff *skb)
48894891
tcp_dsack_extend(sk, TCP_SKB_CB(skb1)->seq,
48904892
TCP_SKB_CB(skb1)->end_seq);
48914893
NET_INC_STATS(sock_net(sk), LINUX_MIB_TCPOFOMERGE);
4892-
tcp_drop(sk, skb1);
4894+
tcp_drop_reason(sk, skb1, SKB_DROP_REASON_TCP_OFOMERGE);
48934895
}
48944896
/* If there is no skb after us, we are the last_skb ! */
48954897
if (!skb1)

0 commit comments

Comments
 (0)