Commit | Line | Data |
---|---|---|
293d984f PT |
1 | /* |
2 | * drivers/s390/net/ctcm_mpc.h | |
3 | * | |
4 | * Copyright IBM Corp. 2007 | |
5 | * Authors: Peter Tiedemann (ptiedem@de.ibm.com) | |
6 | * | |
7 | * MPC additions: | |
8 | * Belinda Thompson (belindat@us.ibm.com) | |
9 | * Andy Richter (richtera@us.ibm.com) | |
10 | */ | |
11 | ||
12 | #ifndef _CTC_MPC_H_ | |
13 | #define _CTC_MPC_H_ | |
14 | ||
a6b7a407 | 15 | #include <linux/interrupt.h> |
293d984f PT |
16 | #include <linux/skbuff.h> |
17 | #include "fsm.h" | |
18 | ||
19 | /* | |
20 | * MPC external interface | |
21 | * Note that ctc_mpc_xyz are called with a lock on ................ | |
22 | */ | |
23 | ||
24 | /* port_number is the mpc device 0, 1, 2 etc mpc2 is port_number 2 */ | |
25 | ||
26 | /* passive open Just wait for XID2 exchange */ | |
27 | extern int ctc_mpc_alloc_channel(int port, | |
28 | void (*callback)(int port_num, int max_write_size)); | |
29 | /* active open Alloc then send XID2 */ | |
30 | extern void ctc_mpc_establish_connectivity(int port, | |
31 | void (*callback)(int port_num, int rc, int max_write_size)); | |
32 | ||
33 | extern void ctc_mpc_dealloc_ch(int port); | |
34 | extern void ctc_mpc_flow_control(int port, int flowc); | |
35 | ||
36 | /* | |
37 | * other MPC Group prototypes and structures | |
38 | */ | |
39 | ||
40 | #define ETH_P_SNA_DIX 0x80D5 | |
41 | ||
42 | /* | |
43 | * Declaration of an XID2 | |
44 | * | |
45 | */ | |
46 | #define ALLZEROS 0x0000000000000000 | |
47 | ||
48 | #define XID_FM2 0x20 | |
49 | #define XID2_0 0x00 | |
50 | #define XID2_7 0x07 | |
51 | #define XID2_WRITE_SIDE 0x04 | |
52 | #define XID2_READ_SIDE 0x05 | |
53 | ||
54 | struct xid2 { | |
55 | __u8 xid2_type_id; | |
56 | __u8 xid2_len; | |
57 | __u32 xid2_adj_id; | |
58 | __u8 xid2_rlen; | |
59 | __u8 xid2_resv1; | |
60 | __u8 xid2_flag1; | |
61 | __u8 xid2_fmtt; | |
62 | __u8 xid2_flag4; | |
63 | __u16 xid2_resv2; | |
64 | __u8 xid2_tgnum; | |
65 | __u32 xid2_sender_id; | |
66 | __u8 xid2_flag2; | |
67 | __u8 xid2_option; | |
68 | char xid2_resv3[8]; | |
69 | __u16 xid2_resv4; | |
70 | __u8 xid2_dlc_type; | |
71 | __u16 xid2_resv5; | |
72 | __u8 xid2_mpc_flag; | |
73 | __u8 xid2_resv6; | |
74 | __u16 xid2_buf_len; | |
75 | char xid2_buffer[255 - (13 * sizeof(__u8) + | |
76 | 2 * sizeof(__u32) + | |
77 | 4 * sizeof(__u16) + | |
78 | 8 * sizeof(char))]; | |
79 | } __attribute__ ((packed)); | |
80 | ||
81 | #define XID2_LENGTH (sizeof(struct xid2)) | |
82 | ||
83 | struct th_header { | |
84 | __u8 th_seg; | |
85 | __u8 th_ch_flag; | |
86 | #define TH_HAS_PDU 0xf0 | |
87 | #define TH_IS_XID 0x01 | |
88 | #define TH_SWEEP_REQ 0xfe | |
89 | #define TH_SWEEP_RESP 0xff | |
90 | __u8 th_blk_flag; | |
91 | #define TH_DATA_IS_XID 0x80 | |
92 | #define TH_RETRY 0x40 | |
93 | #define TH_DISCONTACT 0xc0 | |
94 | #define TH_SEG_BLK 0x20 | |
95 | #define TH_LAST_SEG 0x10 | |
96 | #define TH_PDU_PART 0x08 | |
97 | __u8 th_is_xid; /* is 0x01 if this is XID */ | |
98 | __u32 th_seq_num; | |
99 | } __attribute__ ((packed)); | |
100 | ||
101 | struct th_addon { | |
102 | __u32 th_last_seq; | |
103 | __u32 th_resvd; | |
104 | } __attribute__ ((packed)); | |
105 | ||
106 | struct th_sweep { | |
107 | struct th_header th; | |
108 | struct th_addon sw; | |
109 | } __attribute__ ((packed)); | |
110 | ||
111 | #define TH_HEADER_LENGTH (sizeof(struct th_header)) | |
112 | #define TH_SWEEP_LENGTH (sizeof(struct th_sweep)) | |
113 | ||
114 | #define PDU_LAST 0x80 | |
115 | #define PDU_CNTL 0x40 | |
116 | #define PDU_FIRST 0x20 | |
117 | ||
118 | struct pdu { | |
119 | __u32 pdu_offset; | |
120 | __u8 pdu_flag; | |
121 | __u8 pdu_proto; /* 0x01 is APPN SNA */ | |
122 | __u16 pdu_seq; | |
123 | } __attribute__ ((packed)); | |
124 | ||
125 | #define PDU_HEADER_LENGTH (sizeof(struct pdu)) | |
126 | ||
127 | struct qllc { | |
128 | __u8 qllc_address; | |
129 | #define QLLC_REQ 0xFF | |
130 | #define QLLC_RESP 0x00 | |
131 | __u8 qllc_commands; | |
132 | #define QLLC_DISCONNECT 0x53 | |
133 | #define QLLC_UNSEQACK 0x73 | |
134 | #define QLLC_SETMODE 0x93 | |
135 | #define QLLC_EXCHID 0xBF | |
136 | } __attribute__ ((packed)); | |
137 | ||
138 | ||
139 | /* | |
140 | * Definition of one MPC group | |
141 | */ | |
142 | ||
143 | #define MAX_MPCGCHAN 10 | |
144 | #define MPC_XID_TIMEOUT_VALUE 10000 | |
145 | #define MPC_CHANNEL_ADD 0 | |
146 | #define MPC_CHANNEL_REMOVE 1 | |
147 | #define MPC_CHANNEL_ATTN 2 | |
148 | #define XSIDE 1 | |
149 | #define YSIDE 0 | |
150 | ||
151 | struct mpcg_info { | |
152 | struct sk_buff *skb; | |
153 | struct channel *ch; | |
154 | struct xid2 *xid; | |
155 | struct th_sweep *sweep; | |
156 | struct th_header *th; | |
157 | }; | |
158 | ||
159 | struct mpc_group { | |
160 | struct tasklet_struct mpc_tasklet; | |
161 | struct tasklet_struct mpc_tasklet2; | |
162 | int changed_side; | |
163 | int saved_state; | |
164 | int channels_terminating; | |
165 | int out_of_sequence; | |
166 | int flow_off_called; | |
167 | int port_num; | |
168 | int port_persist; | |
169 | int alloc_called; | |
170 | __u32 xid2_adj_id; | |
171 | __u8 xid2_tgnum; | |
172 | __u32 xid2_sender_id; | |
173 | int num_channel_paths; | |
174 | int active_channels[2]; | |
175 | __u16 group_max_buflen; | |
176 | int outstanding_xid2; | |
177 | int outstanding_xid7; | |
178 | int outstanding_xid7_p2; | |
179 | int sweep_req_pend_num; | |
180 | int sweep_rsp_pend_num; | |
181 | struct sk_buff *xid_skb; | |
182 | char *xid_skb_data; | |
183 | struct th_header *xid_th; | |
184 | struct xid2 *xid; | |
185 | char *xid_id; | |
186 | struct th_header *rcvd_xid_th; | |
187 | struct sk_buff *rcvd_xid_skb; | |
188 | char *rcvd_xid_data; | |
189 | __u8 in_sweep; | |
190 | __u8 roll; | |
191 | struct xid2 *saved_xid2; | |
192 | void (*allochanfunc)(int, int); | |
193 | int allocchan_callback_retries; | |
194 | void (*estconnfunc)(int, int, int); | |
195 | int estconn_callback_retries; | |
196 | int estconn_called; | |
197 | int xidnogood; | |
198 | int send_qllc_disc; | |
199 | fsm_timer timer; | |
200 | fsm_instance *fsm; /* group xid fsm */ | |
201 | }; | |
202 | ||
203 | #ifdef DEBUGDATA | |
204 | void ctcmpc_dumpit(char *buf, int len); | |
205 | #else | |
206 | static inline void ctcmpc_dumpit(char *buf, int len) | |
207 | { | |
208 | } | |
209 | #endif | |
210 | ||
211 | #ifdef DEBUGDATA | |
212 | /* | |
213 | * Dump header and first 16 bytes of an sk_buff for debugging purposes. | |
214 | * | |
215 | * skb The struct sk_buff to dump. | |
216 | * offset Offset relative to skb-data, where to start the dump. | |
217 | */ | |
218 | void ctcmpc_dump_skb(struct sk_buff *skb, int offset); | |
219 | #else | |
220 | static inline void ctcmpc_dump_skb(struct sk_buff *skb, int offset) | |
221 | {} | |
222 | #endif | |
223 | ||
224 | static inline void ctcmpc_dump32(char *buf, int len) | |
225 | { | |
226 | if (len < 32) | |
227 | ctcmpc_dumpit(buf, len); | |
228 | else | |
229 | ctcmpc_dumpit(buf, 32); | |
230 | } | |
231 | ||
232 | int ctcmpc_open(struct net_device *); | |
233 | void ctcm_ccw_check_rc(struct channel *, int, char *); | |
234 | void mpc_group_ready(unsigned long adev); | |
aa3f2cb6 | 235 | void mpc_channel_action(struct channel *ch, int direction, int action); |
293d984f PT |
236 | void mpc_action_send_discontact(unsigned long thischan); |
237 | void mpc_action_discontact(fsm_instance *fi, int event, void *arg); | |
238 | void ctcmpc_bh(unsigned long thischan); | |
239 | #endif | |
240 | /* --- This is the END my friend --- */ |