2003-07-21 21:52:02

by yi

[permalink] [raw]
Subject: TCP congestion window

Dear all,
First, I apologize you for posing this message although I'm not on the list.

I have some questions. I made the following system call for getting tcp
cwnd size of ongoing connection. However, I am always getting the value
of "2", which is the initial tcp cwnd size, I think. What I really want
to do is to trace tcp cwnd size when I download some big file using
"wget"'s http file downloader. For it, I added a new system call shown
below and modified the wget source code.

Please cc to me personally in reply. Thanks in advance.

Best Regards,
Yung Yi.

---------------------------------------------------------------------------
asmlinkage int sys_get_winsize(int sockfd)
{
struct socket *sock;
struct sock *sk;
int err;
sock = sockfd_lookup(sockfd, &err);

if (!sock)
return -1;

sk = sock->sk;
return sk->tp_pinfo.af_tcp.snd_cwnd;
}



2003-07-22 04:28:56

by Nagendra Singh Tomar

[permalink] [raw]
Subject: Re: TCP congestion window

Yi,
First of all networking related questions should go to
[email protected]. Now for ur question.
cwnd has got significance in the sending side of a TCP connection. Its the
sender that keeps changing the cwnd based on the ACKs recvd. If you are
using wget for downloading a file and you are expecting cwnd to change on
the wget side, then the answer is that since wget is *only* receiving
data, cwnd will not change on wget side. It will change on the other side.
If you are checking for cwnd on the other side then please ignore my
answer.

Thanx
tomar


On Tue, 22 Jul 2003, yi wrote:

> Dear all,
> First, I apologize you for posing this message although I'm not on the
> list.
>
> I have some questions. I made the following system call for getting tcp
> cwnd size of ongoing connection. However, I am always getting the value
> of "2", which is the initial tcp cwnd size, I think. What I really want
> to do is to trace tcp cwnd size when I download some big file using
> "wget"'s http file downloader. For it, I added a new system call shown
> below and modified the wget source code.
>
> Please cc to me personally in reply. Thanks in advance.
>
> Best Regards,
> Yung Yi.
>
> ------------------------------------------------------------------------
> ---
> asmlinkage int sys_get_winsize(int sockfd)
> {
> struct socket *sock;
> struct sock *sk;
> int err;
> sock = sockfd_lookup(sockfd, &err);
>
> if (!sock)
> return -1;
>
> sk = sock->sk;
> return sk->tp_pinfo.af_tcp.snd_cwnd;
> }
>
>
> -
> To unsubscribe from this list: send the line "unsubscribe linux-kernel"
> in
> the body of a message to [email protected]
> More majordomo info at http://vger.kernel.org/majordomo-info.html
> Please read the FAQ at http://www.tux.org/lkml/
>

2003-07-22 06:11:46

by Pekka Pietikainen

[permalink] [raw]
Subject: Re: TCP congestion window

On Mon, Jul 21, 2003 at 05:07:02PM -0500, yi wrote:
> I have some questions. I made the following system call for getting tcp
> cwnd size of ongoing connection. However, I am always getting the value
> of "2", which is the initial tcp cwnd size, I think. What I really want
> to do is to trace tcp cwnd size when I download some big file using
> "wget"'s http file downloader. For it, I added a new system call shown
> below and modified the wget source code.
Also what you want already exists, so no need to modify the kernel,
the TCP_INFO socket option (netinet/tcp.h should have the required
definitions in recent glibc)

struct tcp_info info;
int optlen=sizeof(struct tcp_info);
if(getsockopt(sk->fd,SOL_TCP,TCP_INFO,(void *)&info,&optlen) < 0)
return;
printf("unacked: %d sacked: %d lost: %d retrans: %d fackets: %d\n",
info.tcpi_unacked,info.tcpi_sacked,info.tcpi_lost,
info.tcpi_retrans,info.tcpi_fackets);
printf("pmtu: %d rcv_ssthresh: %d rtt: %d rttvar: %d snd_ssthresh:
%d\nsnd_cwnd: %d advmss: %d reordering: %d\n",info.tcpi_pmtu,info.tcpi_rcv_ssthresh,
info.tcpi_rtt,info.tcpi_rttvar,info.tcpi_snd_ssthresh,info.tcpi_snd_cwnd,info.tcpi_advmss,
info.tcpi_reordering)

There's a few more that I don't print there, see the header file.

--
Pekka Pietikainen




2003-07-22 06:23:37

by Glen Turner

[permalink] [raw]
Subject: Re: TCP congestion window

Pekka Pietikainen wrote:

> Also what you want already exists, so no need to modify the kernel,
> the TCP_INFO socket option (netinet/tcp.h should have the required
> definitions in recent glibc)

There's also the Web100 patches at http://www.web100.org/
which add full TCP instrumentation, complete with a nice
set of GUI diagnostic tools.