2 * drivers/s390/net/ctcm_mpc.h
4 * Copyright IBM Corp. 2007
5 * Authors: Peter Tiedemann (ptiedem@de.ibm.com)
8 * Belinda Thompson (belindat@us.ibm.com)
9 * Andy Richter (richtera@us.ibm.com)
15 #include <linux/interrupt.h>
16 #include <linux/skbuff.h>
20 * MPC external interface
21 * Note that ctc_mpc_xyz are called with a lock on ................
24 /* port_number is the mpc device 0, 1, 2 etc mpc2 is port_number 2 */
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));
33 extern void ctc_mpc_dealloc_ch(int port);
34 extern void ctc_mpc_flow_control(int port, int flowc);
37 * other MPC Group prototypes and structures
40 #define ETH_P_SNA_DIX 0x80D5
43 * Declaration of an XID2
46 #define ALLZEROS 0x0000000000000000
51 #define XID2_WRITE_SIDE 0x04
52 #define XID2_READ_SIDE 0x05
75 char xid2_buffer[255 - (13 * sizeof(__u8) +
79 } __attribute__ ((packed));
81 #define XID2_LENGTH (sizeof(struct xid2))
86 #define TH_HAS_PDU 0xf0
87 #define TH_IS_XID 0x01
88 #define TH_SWEEP_REQ 0xfe
89 #define TH_SWEEP_RESP 0xff
91 #define TH_DATA_IS_XID 0x80
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 */
99 } __attribute__ ((packed));
104 } __attribute__ ((packed));
109 } __attribute__ ((packed));
111 #define TH_HEADER_LENGTH (sizeof(struct th_header))
112 #define TH_SWEEP_LENGTH (sizeof(struct th_sweep))
114 #define PDU_LAST 0x80
115 #define PDU_CNTL 0x40
116 #define PDU_FIRST 0x20
121 __u8 pdu_proto; /* 0x01 is APPN SNA */
123 } __attribute__ ((packed));
125 #define PDU_HEADER_LENGTH (sizeof(struct pdu))
129 #define QLLC_REQ 0xFF
130 #define QLLC_RESP 0x00
132 #define QLLC_DISCONNECT 0x53
133 #define QLLC_UNSEQACK 0x73
134 #define QLLC_SETMODE 0x93
135 #define QLLC_EXCHID 0xBF
136 } __attribute__ ((packed));
140 * Definition of one MPC group
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
155 struct th_sweep *sweep;
156 struct th_header *th;
160 struct tasklet_struct mpc_tasklet;
161 struct tasklet_struct mpc_tasklet2;
164 int channels_terminating;
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;
183 struct th_header *xid_th;
186 struct th_header *rcvd_xid_th;
187 struct sk_buff *rcvd_xid_skb;
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;
200 fsm_instance *fsm; /* group xid fsm */
204 void ctcmpc_dumpit(char *buf, int len);
206 static inline void ctcmpc_dumpit(char *buf, int len)
213 * Dump header and first 16 bytes of an sk_buff for debugging purposes.
215 * skb The struct sk_buff to dump.
216 * offset Offset relative to skb-data, where to start the dump.
218 void ctcmpc_dump_skb(struct sk_buff *skb, int offset);
220 static inline void ctcmpc_dump_skb(struct sk_buff *skb, int offset)
224 static inline void ctcmpc_dump32(char *buf, int len)
227 ctcmpc_dumpit(buf, len);
229 ctcmpc_dumpit(buf, 32);
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);
235 void mpc_channel_action(struct channel *ch, int direction, int action);
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);
240 /* --- This is the END my friend --- */