Skip to content

Commit 0e280af

Browse files
edumazetdavem330
authored andcommitted
tcp: introduce TCPSpuriousRtxHostQueues SNMP counter
Host queues (Qdisc + NIC) can hold packets so long that TCP can eventually retransmit a packet before the first transmit even left the host. Its not clear right now if we could avoid this in the first place : - We could arm RTO timer not at the time we enqueue packets, but at the time we TX complete them (tcp_wfree()) - Cancel the sending of the new copy of the packet if prior one is still in queue. This patch adds instrumentation so that we can at least see how often this problem happens. TCPSpuriousRtxHostQueues SNMP counter is incremented every time we detect the fast clone is not yet freed in tcp_transmit_skb() Signed-off-by: Eric Dumazet <[email protected]> Cc: Yuchung Cheng <[email protected]> Cc: Neal Cardwell <[email protected]> Cc: Tom Herbert <[email protected]> Cc: Willem de Bruijn <[email protected]> Signed-off-by: David S. Miller <[email protected]>
1 parent 5a5967d commit 0e280af

File tree

3 files changed

+9
-0
lines changed

3 files changed

+9
-0
lines changed

include/uapi/linux/snmp.h

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -247,6 +247,7 @@ enum
247247
LINUX_MIB_TCPFASTOPENPASSIVEFAIL, /* TCPFastOpenPassiveFail */
248248
LINUX_MIB_TCPFASTOPENLISTENOVERFLOW, /* TCPFastOpenListenOverflow */
249249
LINUX_MIB_TCPFASTOPENCOOKIEREQD, /* TCPFastOpenCookieReqd */
250+
LINUX_MIB_TCPSPURIOUS_RTX_HOSTQUEUES, /* TCPSpuriousRtxHostQueues */
250251
__LINUX_MIB_MAX
251252
};
252253

net/ipv4/proc.c

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -269,6 +269,7 @@ static const struct snmp_mib snmp4_net_list[] = {
269269
SNMP_MIB_ITEM("TCPFastOpenPassiveFail", LINUX_MIB_TCPFASTOPENPASSIVEFAIL),
270270
SNMP_MIB_ITEM("TCPFastOpenListenOverflow", LINUX_MIB_TCPFASTOPENLISTENOVERFLOW),
271271
SNMP_MIB_ITEM("TCPFastOpenCookieReqd", LINUX_MIB_TCPFASTOPENCOOKIEREQD),
272+
SNMP_MIB_ITEM("TCPSpuriousRtxHostQueues", LINUX_MIB_TCPSPURIOUS_RTX_HOSTQUEUES),
272273
SNMP_MIB_SENTINEL
273274
};
274275

net/ipv4/tcp_output.c

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -846,6 +846,13 @@ static int tcp_transmit_skb(struct sock *sk, struct sk_buff *skb, int clone_it,
846846
__net_timestamp(skb);
847847

848848
if (likely(clone_it)) {
849+
const struct sk_buff *fclone = skb + 1;
850+
851+
if (unlikely(skb->fclone == SKB_FCLONE_ORIG &&
852+
fclone->fclone == SKB_FCLONE_CLONE))
853+
NET_INC_STATS_BH(sock_net(sk),
854+
LINUX_MIB_TCPSPURIOUS_RTX_HOSTQUEUES);
855+
849856
if (unlikely(skb_cloned(skb)))
850857
skb = pskb_copy(skb, gfp_mask);
851858
else

0 commit comments

Comments
 (0)