Skip to contentSkip to conversation

Mcast packet loss 2.6.8.1 kernel

DISCUSSION Eric Dumazet 2 participants 2 messages Nov 16, 2007 – Dec 1, 2007 2 messages not in the archive

Subsystems (2)
lore
Share & tools
lore
#2 lore raw
In reply to a message not in the archive
Quoted 9 lines · On Fri, 16 Nov 2007 09:22:13 +0100 Bernd Eckenfels <[email protected]> wrote:
Quoted 2 lines · In article <[email protected]> you wrote:

output of netstat after startup and before tx of packets /flash/sbin/netstat -s

...

Quoted 1 line

error parsing /proc/net/snmp: Success

Could you sent me (net-tools maintainer) the output of netstat -V as well as the content of "cat /proc/net/snmp > dump" so i can see if this is a fixable problem?

Hello Bernd

I did some investigations on the "netstat -s" problem and one
fix is to change the size of char buf1[1024], buf2[1024];

(function process_fd(), file statistics.c)

from 1024 to say 2048, because one line of /proc/net/netstat exceeds 1024 chars in current kernels.

Thank you

BTW, a real usefull thing would be to force reads of various /proc files to use PAGE_SIZE buffers instead of standard 1024 ones.

This can speedup netstat by a four factor at least. (reading of /proc/net/tcp file is O(N^2))

netstat.c renamed from netstat.c.orig +18 -2
@@ -152,8 +152,24 @@
 
 FILE *procinfo;
 
+FILE *myfopen_r(const char *name)
+{
+	static char *buffer;
+	static size_t pagesz;
+	FILE *res = fopen(name, "r");
+
+	if (res != NULL) {
+		if (!buffer) {
+			pagesz = getpagesize();
+			buffer = malloc(pagesz);
+		}
+		setvbuf(res, buffer, _IOFBF, pagesz); 
+	}
+	return res;
+}
+
 #define INFO_GUTS1(file,name,proc)			\
-  procinfo = fopen((file), "r");			\
+  procinfo = myfopen_r((file));			\
   if (procinfo == NULL) {				\
     if (errno != ENOENT) {				\
       perror((file));					\
@@ -174,7 +190,7 @@
 #if HAVE_AFINET6
 #define INFO_GUTS2(file,proc)				\
   lnr = 0;						\
-  procinfo = fopen((file), "r");		       	\
+  procinfo = myfopen_r((file));		       	\
   if (procinfo != NULL) {				\
     do {						\
       if (fgets(buffer, sizeof(buffer), procinfo))	\
#3 lore raw
Quoted 4 lines · Eric Dumazet

Hello Bernd

I did some investigations on the "netstat -s" problem and one
fix is to change the size of char buf1[1024], buf2[1024];

I changed it now to 2048, and included your page aligend io buffer patch. It is available in net-tools HEAD (net-tools.berlios.de)

It would be good if I can get a few tests on different architectures.

Gruss
Bernd

Signature · 4 lines
  (OO)     -- Bernd_Eckenfels@Mörscher_Strasse_8.76185Karlsruhe.de --
 ( .. )    ecki@{inka.de,linux.de,debian.org}  http://www.eckes.org/
  o--o   1024D/E383CD7E  eckes@IRCNet  v:+497211603874  f:+49721151516129
(O____O)  When cryptography is outlawed, bayl bhgynjf jvyy unir cevinpl!