This is the mail archive of the
ecos-patches@sources.redhat.com
mailing list for the eCos project.
stats_in_cksum
- From: Motoya Kurotsu <kurotsu at allied-telesis dot co dot jp>
- To: ecos-patches at sources dot redhat dot com
- Date: Mon, 31 Mar 2003 19:06:22 +0900
- Subject: stats_in_cksum
Hi all;
The attachment fixes some net timing statistics issues in both openbsd
and freebsd stacks in the following;
1) In freebsd stack, stats_in_cksum, which is refered from
show_net_stats(), isn't found.
2) In openbsd stack, stats_in_cksum is generated even if net timing
statistics is disabled.
In freebsd stack, I'm not sure whether I should distribute
(START|FINISH)_STATS into three functions, in_cksum(), in_cksum_skip()
and in_cksum_hdr() or integrate them into one function, in_cksumdata().
The patch is the former case.
3/31/03
Motoya Kurotsu
Allied Telesis K.K.
diff -Nur net.orig/bsd_tcpip/current/ChangeLog net/bsd_tcpip/current/ChangeLog
--- net.orig/bsd_tcpip/current/ChangeLog Mon Feb 24 23:29:17 2003
+++ net/bsd_tcpip/current/ChangeLog Mon Mar 31 18:36:47 2003
@@ -1,3 +1,7 @@
+2003-03-31 Motoya Kurotsu <kurotsu at allied-telesis dot co dot jp>
+
+ * src/sys/netinet/in_cksum.c: Add timing statistics; stats_in_cksum.
+
2003-02-24 Jonathan Larmour <jifl at eCosCentric dot com>
* cdl/freebsd_net.cdl: Fix doc link.
diff -Nur net.orig/bsd_tcpip/current/src/sys/netinet/in_cksum.c net/bsd_tcpip/current/src/sys/netinet/in_cksum.c
--- net.orig/bsd_tcpip/current/src/sys/netinet/in_cksum.c Wed Jul 31 23:02:18 2002
+++ net/bsd_tcpip/current/src/sys/netinet/in_cksum.c Mon Mar 31 18:32:08 2003
@@ -65,6 +65,10 @@
#include <netinet/in.h>
#include <netinet/ip.h>
+#ifdef CYGDBG_NET_TIMING_STATS
+struct net_stats stats_in_cksum;
+#endif
+
/*
* Checksum routine for Internet Protocol family headers
* (Portable Alpha version).
@@ -227,6 +231,8 @@
union q_util q_util;
union l_util l_util;
+ START_STATS();
+
for (; m && len; m = m->m_next) {
if (m->m_len == 0)
continue;
@@ -243,6 +249,9 @@
len -= mlen;
}
REDUCE16;
+
+ FINISH_STATS(stats_in_cksum);
+
return (~sum & 0xffff);
}
@@ -256,6 +265,8 @@
union q_util q_util;
union l_util l_util;
+ START_STATS();
+
len -= skip;
for (; skip && m; m = m->m_next) {
if (m->m_len > skip) {
@@ -284,14 +295,20 @@
len -= mlen;
}
REDUCE16;
+
+ FINISH_STATS(stats_in_cksum);
+
return (~sum & 0xffff);
}
u_int in_cksum_hdr(const struct ip *ip)
{
- u_int64_t sum = in_cksumdata((caddr_t) ip, sizeof(struct ip));
+ u_int64_t sum;
union q_util q_util;
union l_util l_util;
+ START_STATS();
+ sum = in_cksumdata((caddr_t) ip, sizeof(struct ip));
+ FINISH_STATS(stats_in_cksum);
REDUCE16;
return (~sum & 0xffff);
}
diff -Nur net.orig/tcpip/current/ChangeLog net/tcpip/current/ChangeLog
--- net.orig/tcpip/current/ChangeLog Mon Feb 24 23:31:58 2003
+++ net/tcpip/current/ChangeLog Mon Mar 31 18:37:46 2003
@@ -1,3 +1,8 @@
+2003-03-31 Motoya Kurotsu <kurotsu at allied-telesis dot co dot jp>
+
+ * src/sys/netinet/in_cksum.c: Generate stats_in_cksum only when
+ timing stats are enabled.
+
2003-02-24 Jonathan Larmour <jifl at eCosCentric dot com>
* cdl/openbsd_net.cdl: Improve doc links.
diff -Nur net.orig/tcpip/current/src/sys/netinet/in_cksum.c net/tcpip/current/src/sys/netinet/in_cksum.c
--- net.orig/tcpip/current/src/sys/netinet/in_cksum.c Tue May 21 07:25:21 2002
+++ net/tcpip/current/src/sys/netinet/in_cksum.c Mon Mar 31 17:44:55 2003
@@ -75,7 +75,9 @@
#endif
#include <netinet/in.h>
+#ifdef CYGDBG_NET_TIMING_STATS
struct net_stats stats_in_cksum;
+#endif
/*
* Checksum routine for Internet Protocol family headers (Portable Version).