* [Patch 2.5.65+] missing SNMP stats
@ 2003-04-07 20:53 Nivedita Singhvi
2003-04-08 5:02 ` David S. Miller
0 siblings, 1 reply; 2+ messages in thread
From: Nivedita Singhvi @ 2003-04-07 20:53 UTC (permalink / raw)
To: David Miller; +Cc: netdev, Randy Dunlap
This patch provides support for those SNMP TCP
counters currently not supported:
RtoAlgorithm
RtoMin
RtoMax
MaxConn
EstabResets
Randy (Dunlap) worked up his own patch and this is
a merge of his and mine which I had done a while
back with Mark Price which I had cleaned up but
not resubmitted yet. (Thanks, Randy)
thanks,
Nivedita
diff -urN linux-2.5.65/include/net/tcp.h linux-2.5.65mibp/include/net/tcp.h
--- linux-2.5.65/include/net/tcp.h Mon Mar 17 13:43:41 2003
+++ linux-2.5.65mibp/include/net/tcp.h Fri Apr 4 12:04:59 2003
@@ -31,6 +31,7 @@
#include <linux/percpu.h>
#include <net/checksum.h>
#include <net/sock.h>
+#include <net/snmp.h>
#if defined(CONFIG_IPV6) || defined (CONFIG_IPV6_MODULE)
#include <linux/ipv6.h>
#endif
@@ -639,6 +640,8 @@
#define TCP_INC_STATS_BH(field) SNMP_INC_STATS_BH(tcp_statistics, field)
#define TCP_INC_STATS_USER(field) SNMP_INC_STATS_USER(tcp_statistics, field)
#define TCP_DEC_STATS(field) SNMP_DEC_STATS(tcp_statistics, field)
+#define TCP_ADD_STATS_BH(field, val) SNMP_ADD_STATS_BH(tcp_statistics, field, val)
+#define TCP_ADD_STATS_USER(field, val) SNMP_ADD_STATS_USER(tcp_statistics, field, val)
extern __inline__ void tcp_put_port(struct sock *sk);
extern void tcp_inherit_port(struct sock *sk, struct sock *child);
@@ -1397,6 +1400,9 @@
break;
case TCP_CLOSE:
+ if (oldstate == TCP_CLOSE_WAIT || oldstate == TCP_ESTABLISHED)
+ TCP_INC_STATS(TcpEstabResets);
+
sk->prot->unhash(sk);
if (sk->prev && !(sk->userlocks&SOCK_BINDPORT_LOCK))
tcp_put_port(sk);
@@ -1877,4 +1883,13 @@
tp->snd_una + tp->snd_wnd));
}
+static inline void tcp_mib_init(void)
+{
+ /* See RFC 2012 */
+ TCP_ADD_STATS_USER(TcpRtoAlgorithm, 1);
+ TCP_ADD_STATS_USER(TcpRtoMin, TCP_RTO_MIN*1000/HZ);
+ TCP_ADD_STATS_USER(TcpRtoMax, TCP_RTO_MAX*1000/HZ);
+ TCP_ADD_STATS_USER(TcpMaxConn, -1);
+}
+
#endif /* _TCP_H */
diff -urN linux-2.5.65/net/ipv4/af_inet.c linux-2.5.65mibp/net/ipv4/af_inet.c
--- linux-2.5.65/net/ipv4/af_inet.c Mon Mar 17 13:43:42 2003
+++ linux-2.5.65mibp/net/ipv4/af_inet.c Fri Apr 4 11:34:38 2003
@@ -1110,6 +1110,8 @@
}
}
+ (void) tcp_mib_init();
+
return 0;
}
diff -urN linux-2.5.65/net/ipv4/proc.c linux-2.5.65mibp/net/ipv4/proc.c
--- linux-2.5.65/net/ipv4/proc.c Fri Apr 4 12:27:06 2003
+++ linux-2.5.65mibp/net/ipv4/proc.c Mon Apr 7 10:26:34 2003
@@ -143,9 +143,15 @@
"InSegs OutSegs RetransSegs InErrs OutRsts\nTcp:");
for (i = 0;
- i < offsetof(struct tcp_mib, __pad) / sizeof(unsigned long); i++)
- seq_printf(seq, " %lu",
- fold_field((void **) tcp_statistics, i));
+ i < offsetof(struct tcp_mib, __pad) / sizeof(unsigned long); i++) {
+ if (i == (offsetof(struct tcp_mib, TcpMaxConn) / sizeof(unsigned long)))
+ /* MaxConn field is negative, RFC 2012 */
+ seq_printf(seq, " %ld",
+ fold_field((void **) tcp_statistics, i));
+ else
+ seq_printf(seq, " %lu",
+ fold_field((void **) tcp_statistics, i));
+ }
seq_printf(seq, "\nUdp: InDatagrams NoPorts InErrors OutDatagrams\n"
"Udp:");
^ permalink raw reply [flat|nested] 2+ messages in thread
* Re: [Patch 2.5.65+] missing SNMP stats
2003-04-07 20:53 [Patch 2.5.65+] missing SNMP stats Nivedita Singhvi
@ 2003-04-08 5:02 ` David S. Miller
0 siblings, 0 replies; 2+ messages in thread
From: David S. Miller @ 2003-04-08 5:02 UTC (permalink / raw)
To: niv; +Cc: netdev, rddunlap
From: Nivedita Singhvi <niv@us.ibm.com>
Date: Mon, 7 Apr 2003 13:53:16 -0700 (PDT)
This patch provides support for those SNMP TCP
counters currently not supported:
Applied, thanks a lot.
Could one of you two be so kind as to submit a 2.4.x variant
of this patch? This fix belongs in 2.4.x
^ permalink raw reply [flat|nested] 2+ messages in thread
end of thread, other threads:[~2003-04-08 5:02 UTC | newest]
Thread overview: 2+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2003-04-07 20:53 [Patch 2.5.65+] missing SNMP stats Nivedita Singhvi
2003-04-08 5:02 ` 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).