This is the mail archive of the
ecos-patches@sources.redhat.com
mailing list for the eCos project.
timeout.c in bsd_tcpip
- From: Motoya Kurotsu <kurotsu at allied-telesis dot co dot jp>
- To: ecos-patches at sources dot redhat dot com
- Date: Thu, 8 May 2003 11:42:15 +0900
- Subject: timeout.c in bsd_tcpip
Hi all;
The attachment is the patch to fix the problem that some timers
such as pffasttimo, pfslowtimo, arptimer, etc. don't work
in freebsd net stack. This problem can be observed by enabling
TIMEOUT_DEBUG in timeout.c.
Motoya Kurotsu
Allied Telesis K.K.
diff -Nur -U 10 bsd_tcpip.orig/current/ChangeLog bsd_tcpip/current/ChangeLog
--- bsd_tcpip.orig/current/ChangeLog Wed Apr 23 17:54:13 2003
+++ bsd_tcpip/current/ChangeLog Thu May 8 11:33:20 2003
@@ -1,10 +1,18 @@
+2003-05-08 Motoya Kurotsu <kurotsu@allied-telesis.co.jp>
+
+ * src/ecos/timeout.c(do_timeout):
+ The head of the link to be traced is not _timeout but timeout.
+ * src/ecos/timeout.c(timeout, untimeout):
+ Do not trace on the link list but search on the alley(_timeout)
+ one by one to find the timeout entry.
+
2003-04-11 Michael Checky <Michael_Checky@Thermoking.com>
* cdl/freebsd_net.cdl: Deleted the 'CYGPKG_NET_FREEBSD_STACK_BUILD_TESTS'
component because these tests are in the net.cdl component
'CYGPKG_NET_BUILD_TESTS' and selecting this option in freebsd_net.cdl
causes build errors.
2003-04-05 Andrew Lunn <andrew.lunn@ascom.ch>
* src/ecos/support.c (_show_ifp): Now understands IPv6
diff -Nur -U 10 bsd_tcpip.orig/current/src/ecos/timeout.c bsd_tcpip/current/src/ecos/timeout.c
--- bsd_tcpip.orig/current/src/ecos/timeout.c Wed Nov 13 02:38:55 2002
+++ bsd_tcpip/current/src/ecos/timeout.c Thu May 8 10:53:54 2003
@@ -94,21 +94,21 @@
do_timeout(void)
{
cyg_int32 min_delta;
timeout_entry *e, *e_next;
CYG_ASSERT( 0 < last_delta, "last_delta underflow" );
min_delta = last_delta; // local copy
last_delta = -1; // flag recursive call underway
- e = _timeouts;
+ e = timeouts;
while (e) {
e_next = e->next; // Because this can change during processing
if (e->delta) {
#ifdef TIMEOUT_DEBUG
if ( !(e->delta >= min_delta)) {
diag_printf("Bad delta in timeout: %p, delta: %d, min: %d, last: %ld\n", e, e->delta, min_delta, last_set_time);
_show_timeouts();
}
#endif
// Note: this _can_ happen if timeouts are scheduled before the clock starts!
@@ -255,53 +255,55 @@
cyg_thread_resume(alarm_thread_handle); // Start it
}
// ------------------------------------------------------------------------
// EXPORTED API: SET A TIMEOUT
// This can be called from anywhere, including recursively from the timeout
// functions themselves.
cyg_uint32
timeout(timeout_fun *fun, void *arg, cyg_int32 delta)
{
+ int i;
timeout_entry *e;
cyg_uint32 stamp;
// this needs to be atomic - recursive calls from the alarm
// handler thread itself are allowed:
int spl = cyg_splinternal();
stamp = 0; // Assume no slots available
- for (e = _timeouts; e; e = e->next) {
+ for (e = _timeouts, i = 0; i < NTIMEOUTS; i++, e++) {
if ((e->flags & CALLOUT_PENDING) == 0) {
// Free entry
callout_init(e);
e->flags = CALLOUT_LOCAL;
callout_reset(e, delta, fun, arg);
stamp = (cyg_uint32)e;
break;
}
}
cyg_splx(spl);
return stamp;
}
// ------------------------------------------------------------------------
// EXPORTED API: CANCEL A TIMEOUT
// This can be called from anywhere, including recursively from the timeout
// functions themselves.
void
untimeout(timeout_fun *fun, void * arg)
{
+ int i;
timeout_entry *e;
int spl = cyg_splinternal();
- for (e = _timeouts; e; e = e->next) {
+ for (e = _timeouts, i = 0; i < NTIMEOUTS; i++, e++) {
if (e->delta && (e->fun == fun) && (e->arg == arg)) {
callout_stop(e);
break;
}
}
cyg_splx(spl);
}
void
callout_init(struct callout *c)