diff options
| author | Michael Brown | 2007-05-26 17:00:56 +0200 |
|---|---|---|
| committer | Michael Brown | 2007-05-26 17:00:56 +0200 |
| commit | 360110338147844bfa4612ae2d6351f1d1054626 (patch) | |
| tree | 2bee0111a128e36f3f958f0a19c311ec1cc1b912 /src/net | |
| parent | Free I/O buffers when we are finished with them! (diff) | |
| download | ipxe-360110338147844bfa4612ae2d6351f1d1054626.tar.gz ipxe-360110338147844bfa4612ae2d6351f1d1054626.tar.xz ipxe-360110338147844bfa4612ae2d6351f1d1054626.zip | |
Modify process semantics; rescheduling is now automatic.
Add reference-counting to processes.
Add timer_running() test.
Diffstat (limited to 'src/net')
| -rw-r--r-- | src/net/netdevice.c | 7 | ||||
| -rw-r--r-- | src/net/retry.c | 10 |
2 files changed, 6 insertions, 11 deletions
diff --git a/src/net/netdevice.c b/src/net/netdevice.c index c1ad5f68e..ddcb296f4 100644 --- a/src/net/netdevice.c +++ b/src/net/netdevice.c @@ -388,7 +388,7 @@ int net_rx ( struct io_buffer *iobuf, struct net_device *netdev, * This polls all interfaces for received packets, and processes * packets from the RX queue. */ -static void net_step ( struct process *process ) { +static void net_step ( struct process *process __unused ) { struct net_device *netdev; struct io_buffer *iobuf; @@ -410,9 +410,6 @@ static void net_step ( struct process *process ) { netdev->ll_protocol->rx ( iobuf, netdev ); } } - - /* Re-schedule ourself */ - schedule ( process ); } /** Networking stack process */ @@ -422,7 +419,7 @@ static struct process net_process = { /** Initialise the networking stack process */ static void init_net ( void ) { - schedule ( &net_process ); + process_add ( &net_process ); } INIT_FN ( INIT_PROCESS, init_net, NULL, NULL ); diff --git a/src/net/retry.c b/src/net/retry.c index cd683f5b7..f8c34b813 100644 --- a/src/net/retry.c +++ b/src/net/retry.c @@ -64,7 +64,7 @@ static LIST_HEAD ( timers ); * be stopped and the timer's callback function will be called. */ void start_timer ( struct retry_timer *timer ) { - if ( ! timer->start ) + if ( ! timer_running ( timer ) ) list_add ( &timer->list, &timers ); timer->start = currticks(); if ( timer->timeout < MIN_TIMEOUT ) @@ -86,7 +86,7 @@ void stop_timer ( struct retry_timer *timer ) { unsigned long runtime; /* If timer was already stopped, do nothing */ - if ( ! timer->start ) + if ( ! timer_running ( timer ) ) return; list_del ( &timer->list ); @@ -153,7 +153,7 @@ static void timer_expired ( struct retry_timer *timer ) { * * @v process Retry timer process */ -static void retry_step ( struct process *process ) { +static void retry_step ( struct process *process __unused ) { struct retry_timer *timer; struct retry_timer *tmp; unsigned long now = currticks(); @@ -164,8 +164,6 @@ static void retry_step ( struct process *process ) { if ( used >= timer->timeout ) timer_expired ( timer ); } - - schedule ( process ); } /** Retry timer process */ @@ -175,7 +173,7 @@ static struct process retry_process = { /** Initialise the retry timer module */ static void init_retry ( void ) { - schedule ( &retry_process ); + process_add ( &retry_process ); } INIT_FN ( INIT_PROCESS, init_retry, NULL, NULL ); |
