Subject: Re: [PATCH] SNMPv2 tcpOutSegs counter error

From: Wei Yongjun <[email-masked]>
Date: Fri, 04 Aug 2006 08:46:13 -0400

This always correct except when do active open in tcp client, which will
send a SYN, that segment will not be counted, even if it is not
restrained. Maybe I can do following to fix this:

int tcp_connect(struct sock *sk)
...
+	tp->snd_nxt = tp->write_seq;
	TCP_SKB_CB(buff)->seq = tp->write_seq++;
	TCP_SKB_CB(buff)->end_seq = tp->write_seq;
-	tp->snd_nxt = tp->write_seq;
-	tp->pushed_seq = tp->write_seq;

	tcp_transmit_skb(sk, buff, 1, GFP_KERNEL);
+	tp->snd_nxt = tp->write_seq;
+	tp->pushed_seq = tp->write_seq;
	TCP_INC_STATS(TCP_MIB_ACTIVEOPENS);

Do you agree with me? If It is correctly, I will send this patch soon.

On Thursday 03 August 2006 19:35, David Miller wrote:
> From: Wei Yongjun <[email-masked]>
> Date: Thu, 03 Aug 2006 11:46:58 -0400
>
> > 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().
> -
> To unsubscribe from this list: send the line "unsubscribe netdev" in
> the body of a message to [email-masked]
> More majordomo info at  http://vger.kernel.org/majordomo-info.html