]> CyberLeo.Net >> Repos - FreeBSD/FreeBSD.git/blob - 6/sys/dev/hfa/fore_timer.c
merge fix for boot-time hang on centos' xen
[FreeBSD/FreeBSD.git] / 6 / sys / dev / hfa / fore_timer.c
1 /*-
2  * ===================================
3  * HARP  |  Host ATM Research Platform
4  * ===================================
5  *
6  * This Host ATM Research Platform ("HARP") file (the "Software") is
7  * made available by Network Computing Services, Inc. ("NetworkCS")
8  * "AS IS".  NetworkCS does not provide maintenance, improvements or
9  * support of any kind.
10  *
11  * NETWORKCS MAKES NO WARRANTIES OR REPRESENTATIONS, EXPRESS OR IMPLIED,
12  * INCLUDING, BUT NOT LIMITED TO, IMPLIED WARRANTIES OF MERCHANTABILITY
13  * AND FITNESS FOR A PARTICULAR PURPOSE, AS TO ANY ELEMENT OF THE
14  * SOFTWARE OR ANY SUPPORT PROVIDED IN CONNECTION WITH THIS SOFTWARE.
15  * In no event shall NetworkCS be responsible for any damages, including
16  * but not limited to consequential damages, arising from or relating to
17  * any use of the Software or related support.
18  *
19  * Copyright 1994-1998 Network Computing Services, Inc.
20  *
21  * Copies of this Software may be made, however, the above copyright
22  * notice must be reproduced on all copies.
23  */
24
25 #include <sys/cdefs.h>
26 __FBSDID("$FreeBSD$");
27
28 /*
29  * FORE Systems 200-Series Adapter Support
30  * ---------------------------------------
31  *
32  * Timer processing
33  *
34  */
35
36 #include <sys/param.h>
37 #include <sys/systm.h>
38 #include <sys/socket.h>
39 #include <sys/socketvar.h>
40 #include <net/if.h>
41 #include <netatm/port.h>
42 #include <netatm/queue.h>
43 #include <netatm/atm.h>
44 #include <netatm/atm_sys.h>
45 #include <netatm/atm_sap.h>
46 #include <netatm/atm_cm.h>
47 #include <netatm/atm_if.h>
48 #include <netatm/atm_stack.h>
49 #include <netatm/atm_pcb.h>
50 #include <netatm/atm_var.h>
51 #include <dev/pci/pcivar.h>
52 #include <dev/hfa/fore.h>
53 #include <dev/hfa/fore_aali.h>
54 #include <dev/hfa/fore_slave.h>
55 #include <dev/hfa/fore_stats.h>
56 #include <dev/hfa/fore_var.h>
57 #include <dev/hfa/fore_include.h>
58
59 #ifndef lint
60 __RCSID("@(#) $FreeBSD$");
61 #endif
62
63
64 /*
65  * Process a Fore timer tick
66  * 
67  * This function is called every FORE_TIME_TICK seconds in order to update
68  * all of the unit watchdog timers.  
69  *
70  * Called at splnet.
71  *
72  * Arguments:
73  *      tip     pointer to fore timer control block
74  *
75  * Returns:
76  *      none
77  *
78  */
79 void
80 fore_timeout(tip)
81         struct atm_time *tip;
82 {
83         Fore_unit       *fup;
84         int             i;
85
86
87         /*
88          * Schedule next timeout
89          */
90         atm_timeout(&fore_timer, ATM_HZ * FORE_TIME_TICK, fore_timeout);
91
92         /*
93          * Run through all units, updating each active timer.
94          * If an expired timer is found, notify that unit.
95          */
96         for (i = 0; i < fore_nunits; i++) {
97
98                 if ((fup = fore_units[i]) == NULL)
99                         continue;
100
101                 /*
102                  * Decrement timer, if it's active
103                  */
104                 if (fup->fu_timer && (--fup->fu_timer == 0)) {
105
106                         /*
107                          * Timeout occurred - go check out the queues
108                          */
109                         ATM_DEBUG0("fore_timeout\n");
110                         DEVICE_LOCK((Cmn_unit *)fup);
111                         fore_watchdog(fup);
112                         DEVICE_UNLOCK((Cmn_unit *)fup);
113                 }
114         }
115 }
116