SNMPv2 tcpOutSegs counter error
Subsystems (3)
I modified my patch by add a flag to sacked when retransmit, and it work well.
Quoted 9 lines · David Miller
From: Wei Yongjun <[email protected]>
Date: Thu, 06 Jul 2006 04:01:18 -0400This test is not accurate enough. For example, timer based retransmits will not set the
TCPCB_LOSTbit.I'm tempted to say to pass a flag to
tcp_transmit_skb()which says whether it is a retransmit or not, but that function already takes way too many arguments.
include/net/tcp.h +2 -0
@@ -550,6 +550,8 @@ struct tcp_skb_cb {#define TCPCB_URG 0x20/* Urgent pointer advanced here */ +#define TCPCB_TRANS 0x40 +#define TCPCB_AT_TAIL (TCPCB_URG)__u16 urg_ptr;/* Valid w/URG flags is set. */
net/ipv4/tcp_output.c +4 -1
@@ -462,7 +462,8 @@ static int tcp_transmit_skb(struct sockif (skb->len != tcp_header_size)tcp_event_data_sent (tp, skb, sk); -TCP_INC_STATS (TCP_MIB_OUTSEGS ); +if (!(tcb->sacked &TCPCB_TRANS )) +TCP_INC_STATS (TCP_MIB_OUTSEGS ); err = icsk->icsk_af_ops->queue_xmit (skb,0 );if (likely (err <=0 ))
@@ -1732,6 +1733,8 @@ int tcp_retransmit_skb(struct sock *sk,*/ TCP_SKB_CB (skb)->when = tcp_time_stamp; +TCP_SKB_CB (skb)->sacked |=TCPCB_TRANS ; + err =tcp_transmit_skb (sk, skb,1 ,GFP_ATOMIC );if (err ==0 ) {
David Miller
maintainerFrom: Wei Yongjun <[email protected]>
Date: Thu, 03 Aug 2006 11:46:58 -0400
Quoted 2 lines
I modified my patch by add a flag to sacked when retransmit, and it work well.
This is the most timing critical code path of the TCP stack output packet processing, and you're adding a read-modify-write operation just to get some statistics correct.
Let's look for a cheaper test, perhaps something like:
if (!before(TCP_SKB_CB(skb)->seq, tp->snd_nxt)) TCP_INC_STATS(TCP_MIB_OUTSEGS);
Would that work?
It should, because tp->snd_nxt always advances on new data via update_send_head().