* [PATCH] (2/3) tcp diag info for 2.4
@ 2004-10-01 22:56 Stephen Hemminger
2004-10-03 21:53 ` David S. Miller
0 siblings, 1 reply; 2+ messages in thread
From: Stephen Hemminger @ 2004-10-01 22:56 UTC (permalink / raw)
To: Davem; +Cc: netdev
This adds vegas style bandwidth info to 2.4.
Also: makes 2.6 and 2.4 version of tcp_diag.h identical.
Signed-off-by: Stephen Hemminger <shemminger@osdl.org>
diff -Nru a/include/linux/tcp_diag.h b/include/linux/tcp_diag.h
--- a/include/linux/tcp_diag.h 2004-10-01 15:52:21 -07:00
+++ b/include/linux/tcp_diag.h 2004-10-01 15:52:21 -07:00
@@ -98,9 +98,10 @@
TCPDIAG_NONE,
TCPDIAG_MEMINFO,
TCPDIAG_INFO,
+ TCPDIAG_VEGASINFO,
};
-#define TCPDIAG_MAX TCPDIAG_INFO
+#define TCPDIAG_MAX TCPDIAG_VEGASINFO
/* TCPDIAG_MEM */
@@ -112,5 +113,15 @@
__u32 tcpdiag_fmem;
__u32 tcpdiag_tmem;
};
+
+/* TCPDIAG_VEGASINFO */
+
+struct tcpvegas_info {
+ __u32 tcpv_enabled;
+ __u32 tcpv_rttcnt;
+ __u32 tcpv_rtt;
+ __u32 tcpv_minrtt;
+};
+
#endif /* _TCP_DIAG_H_ */
diff -Nru a/net/ipv4/tcp_diag.c b/net/ipv4/tcp_diag.c
--- a/net/ipv4/tcp_diag.c 2004-10-01 15:52:21 -07:00
+++ b/net/ipv4/tcp_diag.c 2004-10-01 15:52:21 -07:00
@@ -49,6 +49,7 @@
struct nlmsghdr *nlh;
struct tcp_info *info = NULL;
struct tcpdiag_meminfo *minfo = NULL;
+ struct tcpvegas_info *vinfo = NULL;
unsigned char *b = skb->tail;
nlh = NLMSG_PUT(skb, pid, seq, TCPDIAG_GETSOCK, sizeof(*r));
@@ -58,6 +59,10 @@
minfo = TCPDIAG_PUT(skb, TCPDIAG_MEMINFO, sizeof(*minfo));
if (ext & (1<<(TCPDIAG_INFO-1)))
info = TCPDIAG_PUT(skb, TCPDIAG_INFO, sizeof(*info));
+
+ if ((tcp_is_westwood(tp) || tcp_is_vegas(tp))
+ && (ext & (1<<(TCPDIAG_VEGASINFO-1))))
+ vinfo = TCPDIAG_PUT(skb, TCPDIAG_VEGASINFO, sizeof(*vinfo));
}
r->tcpdiag_family = sk->family;
r->tcpdiag_state = sk->state;
@@ -184,6 +189,20 @@
info->tcpi_snd_cwnd = tp->snd_cwnd;
info->tcpi_advmss = tp->advmss;
info->tcpi_reordering = tp->reordering;
+ }
+
+ if (vinfo) {
+ if (tcp_is_vegas(tp)) {
+ vinfo->tcpv_enabled = tp->vegas.doing_vegas_now;
+ vinfo->tcpv_rttcnt = tp->vegas.cntRTT;
+ vinfo->tcpv_rtt = (1000000*tp->vegas.baseRTT)/HZ;
+ vinfo->tcpv_minrtt = (1000000*tp->vegas.minRTT)/HZ;
+ } else {
+ vinfo->tcpv_enabled = 0;
+ vinfo->tcpv_rttcnt = 0;
+ vinfo->tcpv_rtt = (1000000*tp->westwood.rtt)/HZ;
+ vinfo->tcpv_minrtt = (1000000*tp->westwood.rtt_min)/HZ;
+ }
}
nlh->nlmsg_len = skb->tail - b;
^ permalink raw reply [flat|nested] 2+ messages in thread
* Re: [PATCH] (2/3) tcp diag info for 2.4
2004-10-01 22:56 [PATCH] (2/3) tcp diag info for 2.4 Stephen Hemminger
@ 2004-10-03 21:53 ` David S. Miller
0 siblings, 0 replies; 2+ messages in thread
From: David S. Miller @ 2004-10-03 21:53 UTC (permalink / raw)
To: Stephen Hemminger; +Cc: Davem, netdev
On Fri, 1 Oct 2004 15:56:20 -0700
Stephen Hemminger <shemminger@osdl.org> wrote:
> This adds vegas style bandwidth info to 2.4.
> Also: makes 2.6 and 2.4 version of tcp_diag.h identical.
>
> Signed-off-by: Stephen Hemminger <shemminger@osdl.org>
Applied, thanks Stephen.
^ permalink raw reply [flat|nested] 2+ messages in thread
end of thread, other threads:[~2004-10-03 21:53 UTC | newest]
Thread overview: 2+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2004-10-01 22:56 [PATCH] (2/3) tcp diag info for 2.4 Stephen Hemminger
2004-10-03 21:53 ` David S. 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).