netdev.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* [Patch] net: export TCP send buffer size via netlink
@ 2010-02-01  7:59 Amerigo Wang
  2010-02-01  8:51 ` Eric Dumazet
  2010-02-01  9:58 ` David Miller
  0 siblings, 2 replies; 4+ messages in thread
From: Amerigo Wang @ 2010-02-01  7:59 UTC (permalink / raw)
  To: linux-kernel; +Cc: netdev, Amerigo Wang, David Miller


Currently, we can only get TCP send buffer size by
getsockopt (SO_SNDBUF or TCP_INFO), this is not enough
for the tools like netstat or ss to read.

Show TCP send buffer size via netlink NETLINK_INET_DIAG.

Signed-off-by: WANG Cong <amwang@redhat.com>
Cc: David Miller <davem@davemloft.net>

---
diff --git a/include/linux/tcp.h b/include/linux/tcp.h
index 7fee8a4..46768de 100644
--- a/include/linux/tcp.h
+++ b/include/linux/tcp.h
@@ -136,6 +136,7 @@ struct tcp_info {
 	__u32	tcpi_ato;
 	__u32	tcpi_snd_mss;
 	__u32	tcpi_rcv_mss;
+	__u32	tcpi_sndbuf;
 
 	__u32	tcpi_unacked;
 	__u32	tcpi_sacked;
diff --git a/net/ipv4/tcp.c b/net/ipv4/tcp.c
index b0a26bb..b3d6a62 100644
--- a/net/ipv4/tcp.c
+++ b/net/ipv4/tcp.c
@@ -2385,6 +2385,7 @@ void tcp_get_info(struct sock *sk, struct tcp_info *info)
 	info->tcpi_retransmits = icsk->icsk_retransmits;
 	info->tcpi_probes = icsk->icsk_probes_out;
 	info->tcpi_backoff = icsk->icsk_backoff;
+	info->tcpi_sndbuf = sk->sk_sndbuf;
 
 	if (tp->rx_opt.tstamp_ok)
 		info->tcpi_options |= TCPI_OPT_TIMESTAMPS;

^ permalink raw reply related	[flat|nested] 4+ messages in thread

* Re: [Patch] net: export TCP send buffer size via netlink
  2010-02-01  7:59 [Patch] net: export TCP send buffer size via netlink Amerigo Wang
@ 2010-02-01  8:51 ` Eric Dumazet
  2010-02-01  9:04   ` Cong Wang
  2010-02-01  9:58 ` David Miller
  1 sibling, 1 reply; 4+ messages in thread
From: Eric Dumazet @ 2010-02-01  8:51 UTC (permalink / raw)
  To: Amerigo Wang; +Cc: linux-kernel, netdev, David Miller

Le lundi 01 février 2010 à 02:59 -0500, Amerigo Wang a écrit :
> Currently, we can only get TCP send buffer size by
> getsockopt (SO_SNDBUF or TCP_INFO), this is not enough
> for the tools like netstat or ss to read.
> 
> Show TCP send buffer size via netlink NETLINK_INET_DIAG.
> 
> Signed-off-by: WANG Cong <amwang@redhat.com>
> Cc: David Miller <davem@davemloft.net>
> 
> ---
> diff --git a/include/linux/tcp.h b/include/linux/tcp.h
> index 7fee8a4..46768de 100644
> --- a/include/linux/tcp.h
> +++ b/include/linux/tcp.h
> @@ -136,6 +136,7 @@ struct tcp_info {
>  	__u32	tcpi_ato;
>  	__u32	tcpi_snd_mss;
>  	__u32	tcpi_rcv_mss;
> +	__u32	tcpi_sndbuf;
>  
>  	__u32	tcpi_unacked;
>  	__u32	tcpi_sacked;

You cannot change tcp_info like this, this structure is used by some
programs, and they are going to break badly.




^ permalink raw reply	[flat|nested] 4+ messages in thread

* Re: [Patch] net: export TCP send buffer size via netlink
  2010-02-01  8:51 ` Eric Dumazet
@ 2010-02-01  9:04   ` Cong Wang
  0 siblings, 0 replies; 4+ messages in thread
From: Cong Wang @ 2010-02-01  9:04 UTC (permalink / raw)
  To: Eric Dumazet; +Cc: linux-kernel, netdev, David Miller

Eric Dumazet wrote:
> Le lundi 01 février 2010 à 02:59 -0500, Amerigo Wang a écrit :
>> Currently, we can only get TCP send buffer size by
>> getsockopt (SO_SNDBUF or TCP_INFO), this is not enough
>> for the tools like netstat or ss to read.
>>
>> Show TCP send buffer size via netlink NETLINK_INET_DIAG.
>>
>> Signed-off-by: WANG Cong <amwang@redhat.com>
>> Cc: David Miller <davem@davemloft.net>
>>
>> ---
>> diff --git a/include/linux/tcp.h b/include/linux/tcp.h
>> index 7fee8a4..46768de 100644
>> --- a/include/linux/tcp.h
>> +++ b/include/linux/tcp.h
>> @@ -136,6 +136,7 @@ struct tcp_info {
>>  	__u32	tcpi_ato;
>>  	__u32	tcpi_snd_mss;
>>  	__u32	tcpi_rcv_mss;
>> +	__u32	tcpi_sndbuf;
>>  
>>  	__u32	tcpi_unacked;
>>  	__u32	tcpi_sacked;
> 
> You cannot change tcp_info like this, this structure is used by some
> programs, and they are going to break badly.
> 

Oh, right, I forgot the ABI compatibility...
I will append it to this structure.

Thanks!

^ permalink raw reply	[flat|nested] 4+ messages in thread

* Re: [Patch] net: export TCP send buffer size via netlink
  2010-02-01  7:59 [Patch] net: export TCP send buffer size via netlink Amerigo Wang
  2010-02-01  8:51 ` Eric Dumazet
@ 2010-02-01  9:58 ` David Miller
  1 sibling, 0 replies; 4+ messages in thread
From: David Miller @ 2010-02-01  9:58 UTC (permalink / raw)
  To: amwang; +Cc: linux-kernel, netdev

From: Amerigo Wang <amwang@redhat.com>
Date: Mon, 1 Feb 2010 02:59:32 -0500

> 
> Currently, we can only get TCP send buffer size by
> getsockopt (SO_SNDBUF or TCP_INFO), this is not enough
> for the tools like netstat or ss to read.
> 
> Show TCP send buffer size via netlink NETLINK_INET_DIAG.
> 
> Signed-off-by: WANG Cong <amwang@redhat.com>
> Cc: David Miller <davem@davemloft.net>

You can't change the layout of struct tcp_info, it's
hard coded into applications.

^ permalink raw reply	[flat|nested] 4+ messages in thread

end of thread, other threads:[~2010-02-01  9:58 UTC | newest]

Thread overview: 4+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2010-02-01  7:59 [Patch] net: export TCP send buffer size via netlink Amerigo Wang
2010-02-01  8:51 ` Eric Dumazet
2010-02-01  9:04   ` Cong Wang
2010-02-01  9:58 ` David Miller

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).