UDP testing with G-NIC II

pmonta@halibut.imedia.com pmonta@halibut.imedia.com
Tue Jan 19 03:26:04 1999


David,

Thanks---it turns out I didn't see your message until today;
it would certainly have saved me some time.

> Incidentally I have had very close to 1GB/s from the cards using UDP and
> a permiscuos socket. The was verified using a gigabit router (Always
> assuming the counters are honest :-)).

That sounds good.  Have you by chance looked at the receive
end (the rate at which host packet loss drops to zero)?  I'm
also getting nearly 1 Gbit/sec transmit, but for receive it's
less, around 420 Mbit/sec with 1470-byte messages. (Strangely,
ttcp claims only a 65% receiver-CPU load, though I've yet to
verify this with something unambiguous like a soaker process.
But bumping up the rate even a little from this point causes
packet loss.)

Here's a patch for ttcp.c that allows a crude kind of rate
regulation.  A command-line argument of, say, "-w 1000" will
insert a busy wait of 1000 loops between every write().  Some
trial and error is needed to hit a particular rate, and of
course this wastes CPU, but not a big deal for testing.

Cheers,
Peter Monta

--- ttcp.c.orig	Tue Jan 19 00:20:42 1999
+++ ttcp.c	Tue Jan 19 00:16:50 1999
@@ -97,6 +97,8 @@
 				 *  m = megabits, M = megabytes, 
 				 *  g = gigabits, G = gigabytes */
 int touchdata = 0;		/* access data after reading */
+int busy_n = 0;
+int busy_sum;
 
 struct hostent *addr;
 extern int errno;
@@ -156,7 +158,7 @@
 
 	if (argc < 2) goto usage;
 
-	while ((c = getopt(argc, argv, "drstuvBDTb:f:l:n:p:A:O:")) != -1) {
+	while ((c = getopt(argc, argv, "drstuvBDTb:f:l:n:p:A:O:w:")) != -1) {
 		switch (c) {
 
 		case 'B':
@@ -217,6 +219,9 @@
 		case 'T':
 			touchdata = 1;
 			break;
+		case 'w':
+			busy_n = atoi(optarg);
+			break;
 
 		default:
 			goto usage;
@@ -368,8 +373,11 @@
 		if (trans)  {
 			pattern( buf, buflen );
 			if(udp)  (void)Nwrite( fd, buf, 4 ); /* rcvr start */
-			while (nbuf-- && Nwrite(fd,buf,buflen) == buflen)
+			while (nbuf-- && Nwrite(fd,buf,buflen) == buflen) {
+				int j;
+				for (j=0; j<busy_n; j++) busy_sum += j;
 				nbytes += buflen;
+			}
 			if(udp)  (void)Nwrite( fd, buf, 4 ); /* rcvr end */
 		} else {
 			if (udp) {
 | To unsubscribe, send mail to Majordomo@cesdis.gsfc.nasa.gov, and within the
 |  body of the mail, include only the text:
 |   unsubscribe this-list-name youraddress@wherever.org
 | You will be unsubscribed as speedily as possible.