2 * drivers/s390/net/ctcm_fsms.h
4 * Copyright IBM Corp. 2001, 2007
5 * Authors: Fritz Elfert (felfert@millenux.com)
6 * Peter Tiedemann (ptiedem@de.ibm.com)
8 * Belinda Thompson (belindat@us.ibm.com)
9 * Andy Richter (richtera@us.ibm.com)
14 #include <linux/module.h>
15 #include <linux/init.h>
16 #include <linux/kernel.h>
17 #include <linux/slab.h>
18 #include <linux/errno.h>
19 #include <linux/types.h>
20 #include <linux/interrupt.h>
21 #include <linux/timer.h>
22 #include <linux/bitops.h>
24 #include <linux/signal.h>
25 #include <linux/string.h>
28 #include <linux/if_arp.h>
29 #include <linux/tcp.h>
30 #include <linux/skbuff.h>
31 #include <linux/ctype.h>
35 #include <asm/ccwdev.h>
36 #include <asm/ccwgroup.h>
37 #include <linux/uaccess.h>
39 #include <asm/idals.h>
43 #include "ctcm_main.h"
46 * Definitions for the channel statemachine(s) for ctc and ctcmpc
48 * To allow better kerntyping, prefix-less definitions for channel states
49 * and channel events have been replaced :
50 * ch_event... -> ctc_ch_event...
51 * CH_EVENT... -> CTC_EVENT...
52 * ch_state... -> ctc_ch_state...
53 * CH_STATE... -> CTC_STATE...
56 * Events of the channel statemachine(s) for ctc and ctcmpc
60 * Events, representing return code of
61 * I/O operations (ccw_device_start, ccw_device_halt et al.)
72 * Events, representing unit-check
76 CTC_EVENT_UC_TXTIMEOUT,
77 CTC_EVENT_UC_TXPARITY,
79 CTC_EVENT_UC_RXPARITY,
83 * Events, representing subchannel-check
87 * Events, representing machine checks
92 * Event, representing normal IRQ
97 * Event, representing timer expiry.
101 * Events, representing commands from upper levels.
107 * additional MPC events
109 CTC_EVENT_SEND_XID = CTC_NR_EVENTS,
110 CTC_EVENT_RSWEEP_TIMER,
112 * MUST be always the last element!!
118 * States of the channel statemachine(s) for ctc and ctcmpc.
122 * Channel not assigned to any device,
123 * initial state, direction invalid
127 * Channel assigned but not operating
131 CTC_STATE_STARTRETRY,
144 CTC_NR_STATES, /* MUST be the last element of non-expanded states */
146 * additional MPC states
148 CH_XID0_PENDING = CTC_NR_STATES,
155 CTC_MPC_NR_STATES, /* MUST be the last element of expanded mpc states */
158 extern const char *ctc_ch_event_names[];
160 extern const char *ctc_ch_state_names[];
162 void ctcm_ccw_check_rc(struct channel *ch, int rc, char *msg);
163 void ctcm_purge_skb_queue(struct sk_buff_head *q);
164 void fsm_action_nop(fsm_instance *fi, int event, void *arg);
167 * ----- non-static actions for ctcm channel statemachine -----
170 void ctcm_chx_txidle(fsm_instance *fi, int event, void *arg);
173 * ----- FSM (state/event/action) of the ctcm channel statemachine -----
175 extern const fsm_node ch_fsm[];
176 extern int ch_fsm_len;
180 * ----- non-static actions for ctcmpc channel statemachine ----
184 void ctcm_chx_txidle(fsm_instance * fi, int event, void *arg);
186 void ctcmpc_chx_rxidle(fsm_instance *fi, int event, void *arg);
189 * ----- FSM (state/event/action) of the ctcmpc channel statemachine -----
191 extern const fsm_node ctcmpc_ch_fsm[];
192 extern int mpc_ch_fsm_len;
195 * Definitions for the device interface statemachine for ctc and mpc
199 * States of the device interface statemachine.
203 DEV_STATE_STARTWAIT_RXTX,
204 DEV_STATE_STARTWAIT_RX,
205 DEV_STATE_STARTWAIT_TX,
206 DEV_STATE_STOPWAIT_RXTX,
207 DEV_STATE_STOPWAIT_RX,
208 DEV_STATE_STOPWAIT_TX,
211 * MUST be always the last element!!
216 extern const char *dev_state_names[];
219 * Events of the device interface statemachine.
231 * MUST be always the last element!!
236 extern const char *dev_event_names[];
239 * Actions for the device interface statemachine.
243 static void dev_action_start(fsm_instance * fi, int event, void *arg);
244 static void dev_action_stop(fsm_instance * fi, int event, void *arg);
245 static void dev_action_restart(fsm_instance *fi, int event, void *arg);
246 static void dev_action_chup(fsm_instance * fi, int event, void *arg);
247 static void dev_action_chdown(fsm_instance * fi, int event, void *arg);
251 * The (state/event/action) fsm table of the device interface statemachine.
254 extern const fsm_node dev_fsm[];
255 extern int dev_fsm_len;
259 * Definitions for the MPC Group statemachine
263 * MPC Group Station FSM States
265 State Name When In This State
266 ====================== =======================================
267 MPCG_STATE_RESET Initial State When Driver Loaded
268 We receive and send NOTHING
270 MPCG_STATE_INOP INOP Received.
271 Group level non-recoverable error
273 MPCG_STATE_READY XID exchanges for at least 1 write and
274 1 read channel have completed.
275 Group is ready for data transfer.
277 States from ctc_mpc_alloc_channel
278 ==============================================================
279 MPCG_STATE_XID2INITW Awaiting XID2(0) Initiation
280 ATTN from other side will start
282 Y-side protocol only.
284 MPCG_STATE_XID2INITX XID2(0) negotiations are in progress.
285 At least 1, but not all, XID2(0)'s
286 have been received from partner.
288 MPCG_STATE_XID7INITW XID2(0) complete
289 No XID2(7)'s have yet been received.
290 XID2(7) negotiations pending.
292 MPCG_STATE_XID7INITX XID2(7) negotiations in progress.
293 At least 1, but not all, XID2(7)'s
294 have been received from partner.
296 MPCG_STATE_XID7INITF XID2(7) negotiations complete.
297 Transitioning to READY.
299 MPCG_STATE_READY Ready for Data Transfer.
302 States from ctc_mpc_establish_connectivity call
303 ==============================================================
304 MPCG_STATE_XID0IOWAIT Initiating XID2(0) negotiations.
305 X-side protocol only.
306 ATTN-BUSY from other side will convert
307 this to Y-side protocol and the
308 ctc_mpc_alloc_channel flow will begin.
310 MPCG_STATE_XID0IOWAIX XID2(0) negotiations are in progress.
311 At least 1, but not all, XID2(0)'s
312 have been received from partner.
314 MPCG_STATE_XID7INITI XID2(0) complete
315 No XID2(7)'s have yet been received.
316 XID2(7) negotiations pending.
318 MPCG_STATE_XID7INITZ XID2(7) negotiations in progress.
319 At least 1, but not all, XID2(7)'s
320 have been received from partner.
322 MPCG_STATE_XID7INITF XID2(7) negotiations complete.
323 Transitioning to READY.
325 MPCG_STATE_READY Ready for Data Transfer.
344 MPCG_STATE_XID2INITW,
345 MPCG_STATE_XID2INITX,
346 MPCG_STATE_XID7INITW,
347 MPCG_STATE_XID7INITX,
348 MPCG_STATE_XID0IOWAIT,
349 MPCG_STATE_XID0IOWAIX,
350 MPCG_STATE_XID7INITI,
351 MPCG_STATE_XID7INITZ,
352 MPCG_STATE_XID7INITF,
359 /* --- This is the END my friend --- */