This is the mail archive of the
ecos-patches@sources.redhat.com
mailing list for the eCos project.
RedBoot - Improve networking throughput
- From: Gary Thomas <gary at mlbassoc dot com>
- To: eCos patches <ecos-patches at sources dot redhat dot com>
- Date: 19 Aug 2003 11:25:40 -0600
- Subject: RedBoot - Improve networking throughput
- Organization: MLB Associates
By changing the internal timer handling and also by
reducing some delays built into the standalone network
driver. RedBoot download speed improvements of factors
of 100 (on fast connections) have been seen with these changes.
--
Gary Thomas <gary@mlbassoc.com>
MLB Associates
Index: io/eth/current/ChangeLog
===================================================================
RCS file: /misc/cvsfiles/ecos/packages/io/eth/current/ChangeLog,v
retrieving revision 1.44
diff -u -5 -p -r1.44 ChangeLog
--- io/eth/current/ChangeLog 23 Jul 2003 18:01:22 -0000 1.44
+++ io/eth/current/ChangeLog 19 Aug 2003 16:59:38 -0000
@@ -1,5 +1,11 @@
+2003-08-19 Gary Thomas <gary@mlbassoc.com>
+
+ * src/stand_alone/eth_drv.c:
+ * src/net/eth_drv.c: Improve network speeds by reducing some
+ overhead and also the delay when sending a packet.
+
2003-07-23 Nick Garnett <nickg@balti.calivar.com>
* include/eth_drv.h:
* src/net/eth_drv.c:
Added an ifndef to fix warnings about NBPFILTER not being
Index: io/eth/current/src/net/eth_drv.c
===================================================================
RCS file: /misc/cvsfiles/ecos/packages/io/eth/current/src/net/eth_drv.c,v
retrieving revision 1.28
diff -u -5 -p -r1.28 eth_drv.c
--- io/eth/current/src/net/eth_drv.c 23 Jul 2003 18:01:22 -0000 1.28
+++ io/eth/current/src/net/eth_drv.c 19 Aug 2003 16:58:57 -0000
@@ -7,11 +7,11 @@
//==========================================================================
//####ECOSGPLCOPYRIGHTBEGIN####
// -------------------------------------------
// This file is part of eCos, the Embedded Configurable Operating System.
// Copyright (C) 1998, 1999, 2000, 2001, 2002 Red Hat, Inc.
-// Copyright (C) 2002 Gary Thomas
+// Copyright (C) 2002, 2003 Gary Thomas
//
// eCos is free software; you can redistribute it and/or modify it under
// the terms of the GNU General Public License as published by the Free
// Software Foundation; either version 2 or (at your option) any later version.
//
@@ -645,10 +645,15 @@ eth_drv_send(struct ifnet *ifp)
if ((ifp->if_flags & IFF_RUNNING) != IFF_RUNNING) {
return;
}
+ // If nothing on the queue, no need to bother hardware
+ if (IF_IS_EMPTY(&ifp->if_snd)) {
+ return;
+ }
+
while ((sc->funs->can_send)(sc) > 0) {
IF_DEQUEUE(&ifp->if_snd, m0);
if (m0 == 0) {
break;
}
@@ -1025,11 +1030,13 @@ void eth_drv_tickle_devices( void )
// Try to dequeue a packet for this interface, if we can. This
// will call can_send() for active interfaces. It is calls to
// this function from tx_done() which normally provide
// continuous transmissions; otherwise we do not get control.
// This call fixes that.
- eth_drv_send(ifp);
+ if (!IF_IS_EMPTY(&ifp->if_snd)) {
+ eth_drv_send(ifp);
+ }
}
}
}
#endif // CYGPKG_NET_FAST_THREAD_TICKLE_DEVS
Index: io/eth/current/src/stand_alone/eth_drv.c
===================================================================
RCS file: /misc/cvsfiles/ecos/packages/io/eth/current/src/stand_alone/eth_drv.c,v
retrieving revision 1.18
diff -u -5 -p -r1.18 eth_drv.c
--- io/eth/current/src/stand_alone/eth_drv.c 11 Mar 2003 15:41:12 -0000 1.18
+++ io/eth/current/src/stand_alone/eth_drv.c 19 Aug 2003 16:59:39 -0000
@@ -7,10 +7,11 @@
//==========================================================================
//####ECOSGPLCOPYRIGHTBEGIN####
// -------------------------------------------
// This file is part of eCos, the Embedded Configurable Operating System.
// Copyright (C) 1998, 1999, 2000, 2001, 2002, 2003 Red Hat, Inc.
+// Copyright (C) 2003 Gary Thomas
//
// eCos is free software; you can redistribute it and/or modify it under
// the terms of the GNU General Public License as published by the Free
// Software Foundation; either version 2 or (at your option) any later version.
//
@@ -309,18 +310,18 @@ eth_drv_write(char *eth_hdr, char *buf,
}
#endif
(sc->funs->send)(sc, sg_list, sg_len, len+14, (CYG_ADDRWORD)&packet_sent);
- wait_time = 500;
+ wait_time = 50000;
while (1) {
(sc->funs->poll)(sc);
if(packet_sent)
break;
- CYGACC_CALL_IF_DELAY_US(2*1000);
+ CYGACC_CALL_IF_DELAY_US(2*10);
if (--wait_time <= 0)
goto reset_and_out; // Give up on sending packet
}
reset_and_out:
if (dbg) {
Index: redboot/current/ChangeLog
===================================================================
RCS file: /misc/cvsfiles/ecos/packages/redboot/current/ChangeLog,v
retrieving revision 1.122
diff -u -5 -p -r1.122 ChangeLog
--- redboot/current/ChangeLog 5 Aug 2003 03:25:23 -0000 1.122
+++ redboot/current/ChangeLog 19 Aug 2003 17:02:53 -0000
@@ -1,5 +1,14 @@
+2003-08-19 Gary Thomas <gary@mlbassoc.com>
+
+ * src/net/udp.c (__udp_recvfrom): Rework loop so delay only happens
+ if no packet is immediately available - improves network throughput.
+
+ * src/ticks.c:
+ * cdl/redboot.cdl: Add control over granularity of timers used
+ by RedBoot and the network stack.
+
2003-08-05 Jonathan Larmour <jifl@eCosCentric.com>
* doc/redboot_installing.sgml: Fix brain fart in last change to
AT91 instructions. Also clarify instructions a bit, including
documenting better for windows users.
Index: redboot/current/cdl/redboot.cdl
===================================================================
RCS file: /misc/cvsfiles/ecos/packages/redboot/current/cdl/redboot.cdl,v
retrieving revision 1.50
diff -u -5 -p -r1.50 redboot.cdl
--- redboot/current/cdl/redboot.cdl 1 Jul 2003 16:25:22 -0000 1.50
+++ redboot/current/cdl/redboot.cdl 19 Aug 2003 14:52:05 -0000
@@ -210,10 +210,23 @@ cdl_package CYGPKG_REDBOOT {
description "This option enables the building of the Redboot ELF image.
The image may require further relocation or symbol
stripping before being converted to a binary image.
This is handled by a rule in the target CDL."
+
+ cdl_option CYGDBG_REDBOOT_TICK_GRANULARITY {
+ display "Granularity of timer/ticks"
+ flavor data
+ legal_values { 50 100 250 500 1000 }
+ default_value 250
+ description "
+ This option controls the granularity of the timers.
+ Faster CPUs can afford higher granularity (lower values)
+ which should give higher network performance since the stack
+ is purely polled."
+ }
+
compile main.c
compile misc_funs.c io.c parse.c ticks.c syscall.c alias.c
compile -library=libextras.a load.c
make -priority 320 {
Index: redboot/current/src/flash.c
===================================================================
RCS file: /misc/cvsfiles/ecos/packages/redboot/current/src/flash.c,v
retrieving revision 1.47
diff -u -5 -p -r1.47 flash.c
--- redboot/current/src/flash.c 27 Jul 2003 10:13:24 -0000 1.47
+++ redboot/current/src/flash.c 19 Aug 2003 14:52:23 -0000
@@ -1517,11 +1517,11 @@ get_config(unsigned char *dp, char *titl
case CONFIG_NETPORT:
if (strlen(line) >= MAX_STRING_LENGTH || net_devindex(line) < 0) {
int index;
const char *name;
diag_printf("Sorry, Port name must be one of:\n");
- for (index = 0; name = net_devname(index); index++)
+ for (index = 0; (name = net_devname(index)) != NULL; index++)
diag_printf(" %s\n", name);
return CONFIG_BAD;
}
strcpy((unsigned char *)val_ptr, line);
break;
Index: redboot/current/src/ticks.c
===================================================================
RCS file: /misc/cvsfiles/ecos/packages/redboot/current/src/ticks.c,v
retrieving revision 1.4
diff -u -5 -p -r1.4 ticks.c
--- redboot/current/src/ticks.c 23 May 2002 23:08:32 -0000 1.4
+++ redboot/current/src/ticks.c 19 Aug 2003 17:01:40 -0000
@@ -7,10 +7,11 @@
//==========================================================================
//####ECOSGPLCOPYRIGHTBEGIN####
// -------------------------------------------
// This file is part of eCos, the Embedded Configurable Operating System.
// Copyright (C) 1998, 1999, 2000, 2001, 2002 Red Hat, Inc.
+// Copyright (C) 2003 Gary Thomas
//
// eCos is free software; you can redistribute it and/or modify it under
// the terms of the GNU General Public License as published by the Free
// Software Foundation; either version 2 or (at your option) any later version.
//
@@ -53,16 +54,22 @@
//==========================================================================
#include "redboot.h"
static unsigned long ticks = 0;
+static long elapsed = 0;
unsigned long
do_ms_tick(void)
{
- CYGACC_CALL_IF_DELAY_US(1000); // Wait for 1ms
- return ++ticks;
+ CYGACC_CALL_IF_DELAY_US(CYGDBG_REDBOOT_TICK_GRANULARITY);
+ elapsed += CYGDBG_REDBOOT_TICK_GRANULARITY;
+ if (elapsed >= 1000) {
+ elapsed = 0;
+ ticks++;
+ }
+ return ticks;
}
unsigned long
get_ms_ticks(void)
{
Index: redboot/current/src/net/udp.c
===================================================================
RCS file: /misc/cvsfiles/ecos/packages/redboot/current/src/net/udp.c,v
retrieving revision 1.9
diff -u -5 -p -r1.9 udp.c
--- redboot/current/src/net/udp.c 9 Jul 2002 20:23:48 -0000 1.9
+++ redboot/current/src/net/udp.c 19 Aug 2003 17:02:54 -0000
@@ -7,11 +7,11 @@
//==========================================================================
//####ECOSGPLCOPYRIGHTBEGIN####
// -------------------------------------------
// This file is part of eCos, the Embedded Configurable Operating System.
// Copyright (C) 1998, 1999, 2000, 2001, 2002 Red Hat, Inc.
-// Copyright (C) 2002 Gary Thomas
+// Copyright (C) 2002, 2003 Gary Thomas
//
// eCos is free software; you can redistribute it and/or modify it under
// the terms of the GNU General Public License as published by the Free
// Software Foundation; either version 2 or (at your option) any later version.
//
@@ -253,16 +253,16 @@ __udp_recvfrom(char *data, int len, stru
recvfrom_len = len;
recvfrom_server = server;
total_ms = (timo->tv_sec * 1000) + (timo->tv_usec / 1000);
start = MS_TICKS();
res = -1;
- while ((MS_TICKS_DELAY() - start) < total_ms) {
+ do {
__enet_poll(); // Handle the hardware
if (!recvfrom_buf) {
// Data have arrived
res = recvfrom_len;
break;
}
- }
+ } while ((MS_TICKS_DELAY() - start) < total_ms);
__udp_remove_listener(my_port);
return res;
}