diff options
author | Linus Torvalds <torvalds@ppc970.osdl.org> | 2005-04-16 18:20:36 -0400 |
---|---|---|
committer | Linus Torvalds <torvalds@ppc970.osdl.org> | 2005-04-16 18:20:36 -0400 |
commit | 1da177e4c3f41524e886b7f1b8a0c1fc7321cac2 (patch) | |
tree | 0bba044c4ce775e45a88a51686b5d9f90697ea9d /drivers/net/sk98lin/skqueue.c |
Linux-2.6.12-rc2v2.6.12-rc2
Initial git repository build. I'm not bothering with the full history,
even though we have it. We can create a separate "historical" git
archive of that later if we want to, and in the meantime it's about
3.2GB when imported into git - space that would just make the early
git days unnecessarily complicated, when we don't have a lot of good
infrastructure for it.
Let it rip!
Diffstat (limited to 'drivers/net/sk98lin/skqueue.c')
-rw-r--r-- | drivers/net/sk98lin/skqueue.c | 179 |
1 files changed, 179 insertions, 0 deletions
diff --git a/drivers/net/sk98lin/skqueue.c b/drivers/net/sk98lin/skqueue.c new file mode 100644 index 000000000000..0275b4f71d9b --- /dev/null +++ b/drivers/net/sk98lin/skqueue.c | |||
@@ -0,0 +1,179 @@ | |||
1 | /****************************************************************************** | ||
2 | * | ||
3 | * Name: skqueue.c | ||
4 | * Project: Gigabit Ethernet Adapters, Event Scheduler Module | ||
5 | * Version: $Revision: 1.20 $ | ||
6 | * Date: $Date: 2003/09/16 13:44:00 $ | ||
7 | * Purpose: Management of an event queue. | ||
8 | * | ||
9 | ******************************************************************************/ | ||
10 | |||
11 | /****************************************************************************** | ||
12 | * | ||
13 | * (C)Copyright 1998-2002 SysKonnect GmbH. | ||
14 | * (C)Copyright 2002-2003 Marvell. | ||
15 | * | ||
16 | * This program is free software; you can redistribute it and/or modify | ||
17 | * it under the terms of the GNU General Public License as published by | ||
18 | * the Free Software Foundation; either version 2 of the License, or | ||
19 | * (at your option) any later version. | ||
20 | * | ||
21 | * The information in this file is provided "AS IS" without warranty. | ||
22 | * | ||
23 | ******************************************************************************/ | ||
24 | |||
25 | |||
26 | /* | ||
27 | * Event queue and dispatcher | ||
28 | */ | ||
29 | #if (defined(DEBUG) || ((!defined(LINT)) && (!defined(SK_SLIM)))) | ||
30 | static const char SysKonnectFileId[] = | ||
31 | "@(#) $Id: skqueue.c,v 1.20 2003/09/16 13:44:00 rschmidt Exp $ (C) Marvell."; | ||
32 | #endif | ||
33 | |||
34 | #include "h/skdrv1st.h" /* Driver Specific Definitions */ | ||
35 | #include "h/skqueue.h" /* Queue Definitions */ | ||
36 | #include "h/skdrv2nd.h" /* Adapter Control- and Driver specific Def. */ | ||
37 | |||
38 | #ifdef __C2MAN__ | ||
39 | /* | ||
40 | Event queue management. | ||
41 | |||
42 | General Description: | ||
43 | |||
44 | */ | ||
45 | intro() | ||
46 | {} | ||
47 | #endif | ||
48 | |||
49 | #define PRINTF(a,b,c) | ||
50 | |||
51 | /* | ||
52 | * init event queue management | ||
53 | * | ||
54 | * Must be called during init level 0. | ||
55 | */ | ||
56 | void SkEventInit( | ||
57 | SK_AC *pAC, /* Adapter context */ | ||
58 | SK_IOC Ioc, /* IO context */ | ||
59 | int Level) /* Init level */ | ||
60 | { | ||
61 | switch (Level) { | ||
62 | case SK_INIT_DATA: | ||
63 | pAC->Event.EvPut = pAC->Event.EvGet = pAC->Event.EvQueue; | ||
64 | break; | ||
65 | default: | ||
66 | break; | ||
67 | } | ||
68 | } | ||
69 | |||
70 | /* | ||
71 | * add event to queue | ||
72 | */ | ||
73 | void SkEventQueue( | ||
74 | SK_AC *pAC, /* Adapters context */ | ||
75 | SK_U32 Class, /* Event Class */ | ||
76 | SK_U32 Event, /* Event to be queued */ | ||
77 | SK_EVPARA Para) /* Event parameter */ | ||
78 | { | ||
79 | pAC->Event.EvPut->Class = Class; | ||
80 | pAC->Event.EvPut->Event = Event; | ||
81 | pAC->Event.EvPut->Para = Para; | ||
82 | |||
83 | if (++pAC->Event.EvPut == &pAC->Event.EvQueue[SK_MAX_EVENT]) | ||
84 | pAC->Event.EvPut = pAC->Event.EvQueue; | ||
85 | |||
86 | if (pAC->Event.EvPut == pAC->Event.EvGet) { | ||
87 | SK_ERR_LOG(pAC, SK_ERRCL_NORES, SKERR_Q_E001, SKERR_Q_E001MSG); | ||
88 | } | ||
89 | } | ||
90 | |||
91 | /* | ||
92 | * event dispatcher | ||
93 | * while event queue is not empty | ||
94 | * get event from queue | ||
95 | * send command to state machine | ||
96 | * end | ||
97 | * return error reported by individual Event function | ||
98 | * 0 if no error occured. | ||
99 | */ | ||
100 | int SkEventDispatcher( | ||
101 | SK_AC *pAC, /* Adapters Context */ | ||
102 | SK_IOC Ioc) /* Io context */ | ||
103 | { | ||
104 | SK_EVENTELEM *pEv; /* pointer into queue */ | ||
105 | SK_U32 Class; | ||
106 | int Rtv; | ||
107 | |||
108 | pEv = pAC->Event.EvGet; | ||
109 | |||
110 | PRINTF("dispatch get %x put %x\n", pEv, pAC->Event.ev_put); | ||
111 | |||
112 | while (pEv != pAC->Event.EvPut) { | ||
113 | PRINTF("dispatch Class %d Event %d\n", pEv->Class, pEv->Event); | ||
114 | |||
115 | switch (Class = pEv->Class) { | ||
116 | #ifndef SK_USE_LAC_EV | ||
117 | #ifndef SK_SLIM | ||
118 | case SKGE_RLMT: /* RLMT Event */ | ||
119 | Rtv = SkRlmtEvent(pAC, Ioc, pEv->Event, pEv->Para); | ||
120 | break; | ||
121 | case SKGE_I2C: /* I2C Event */ | ||
122 | Rtv = SkI2cEvent(pAC, Ioc, pEv->Event, pEv->Para); | ||
123 | break; | ||
124 | case SKGE_PNMI: /* PNMI Event */ | ||
125 | Rtv = SkPnmiEvent(pAC, Ioc, pEv->Event, pEv->Para); | ||
126 | break; | ||
127 | #endif /* not SK_SLIM */ | ||
128 | #endif /* not SK_USE_LAC_EV */ | ||
129 | case SKGE_DRV: /* Driver Event */ | ||
130 | Rtv = SkDrvEvent(pAC, Ioc, pEv->Event, pEv->Para); | ||
131 | break; | ||
132 | #ifndef SK_USE_SW_TIMER | ||
133 | case SKGE_HWAC: | ||
134 | Rtv = SkGeSirqEvent(pAC, Ioc, pEv->Event, pEv->Para); | ||
135 | break; | ||
136 | #else /* !SK_USE_SW_TIMER */ | ||
137 | case SKGE_SWT : | ||
138 | Rtv = SkSwtEvent(pAC, Ioc, pEv->Event, pEv->Para); | ||
139 | break; | ||
140 | #endif /* !SK_USE_SW_TIMER */ | ||
141 | #ifdef SK_USE_LAC_EV | ||
142 | case SKGE_LACP : | ||
143 | Rtv = SkLacpEvent(pAC, Ioc, pEv->Event, pEv->Para); | ||
144 | break; | ||
145 | case SKGE_RSF : | ||
146 | Rtv = SkRsfEvent(pAC, Ioc, pEv->Event, pEv->Para); | ||
147 | break; | ||
148 | case SKGE_MARKER : | ||
149 | Rtv = SkMarkerEvent(pAC, Ioc, pEv->Event, pEv->Para); | ||
150 | break; | ||
151 | case SKGE_FD : | ||
152 | Rtv = SkFdEvent(pAC, Ioc, pEv->Event, pEv->Para); | ||
153 | break; | ||
154 | #endif /* SK_USE_LAC_EV */ | ||
155 | #ifdef SK_USE_CSUM | ||
156 | case SKGE_CSUM : | ||
157 | Rtv = SkCsEvent(pAC, Ioc, pEv->Event, pEv->Para); | ||
158 | break; | ||
159 | #endif /* SK_USE_CSUM */ | ||
160 | default : | ||
161 | SK_ERR_LOG(pAC, SK_ERRCL_SW, SKERR_Q_E002, SKERR_Q_E002MSG); | ||
162 | Rtv = 0; | ||
163 | } | ||
164 | |||
165 | if (Rtv != 0) { | ||
166 | return(Rtv); | ||
167 | } | ||
168 | |||
169 | if (++pEv == &pAC->Event.EvQueue[SK_MAX_EVENT]) | ||
170 | pEv = pAC->Event.EvQueue; | ||
171 | |||
172 | /* Renew get: it is used in queue_events to detect overruns */ | ||
173 | pAC->Event.EvGet = pEv; | ||
174 | } | ||
175 | |||
176 | return(0); | ||
177 | } | ||
178 | |||
179 | /* End of file */ | ||