0001
0002
0003
0004
0005
0006
0007
0008
0009
0010
0011 #ifndef _CTC_MPC_H_
0012 #define _CTC_MPC_H_
0013
0014 #include <linux/interrupt.h>
0015 #include <linux/skbuff.h>
0016 #include "fsm.h"
0017
0018
0019
0020
0021
0022
0023
0024
0025
0026 extern int ctc_mpc_alloc_channel(int port,
0027 void (*callback)(int port_num, int max_write_size));
0028
0029 extern void ctc_mpc_establish_connectivity(int port,
0030 void (*callback)(int port_num, int rc, int max_write_size));
0031
0032 extern void ctc_mpc_dealloc_ch(int port);
0033 extern void ctc_mpc_flow_control(int port, int flowc);
0034
0035
0036
0037
0038
0039 #define ETH_P_SNA_DIX 0x80D5
0040
0041
0042
0043
0044
0045 #define ALLZEROS 0x0000000000000000
0046
0047 #define XID_FM2 0x20
0048 #define XID2_0 0x00
0049 #define XID2_7 0x07
0050 #define XID2_WRITE_SIDE 0x04
0051 #define XID2_READ_SIDE 0x05
0052
0053 struct xid2 {
0054 __u8 xid2_type_id;
0055 __u8 xid2_len;
0056 __u32 xid2_adj_id;
0057 __u8 xid2_rlen;
0058 __u8 xid2_resv1;
0059 __u8 xid2_flag1;
0060 __u8 xid2_fmtt;
0061 __u8 xid2_flag4;
0062 __u16 xid2_resv2;
0063 __u8 xid2_tgnum;
0064 __u32 xid2_sender_id;
0065 __u8 xid2_flag2;
0066 __u8 xid2_option;
0067 char xid2_resv3[8];
0068 __u16 xid2_resv4;
0069 __u8 xid2_dlc_type;
0070 __u16 xid2_resv5;
0071 __u8 xid2_mpc_flag;
0072 __u8 xid2_resv6;
0073 __u16 xid2_buf_len;
0074 char xid2_buffer[255 - (13 * sizeof(__u8) +
0075 2 * sizeof(__u32) +
0076 4 * sizeof(__u16) +
0077 8 * sizeof(char))];
0078 } __attribute__ ((packed));
0079
0080 #define XID2_LENGTH (sizeof(struct xid2))
0081
0082 struct th_header {
0083 __u8 th_seg;
0084 __u8 th_ch_flag;
0085 #define TH_HAS_PDU 0xf0
0086 #define TH_IS_XID 0x01
0087 #define TH_SWEEP_REQ 0xfe
0088 #define TH_SWEEP_RESP 0xff
0089 __u8 th_blk_flag;
0090 #define TH_DATA_IS_XID 0x80
0091 #define TH_RETRY 0x40
0092 #define TH_DISCONTACT 0xc0
0093 #define TH_SEG_BLK 0x20
0094 #define TH_LAST_SEG 0x10
0095 #define TH_PDU_PART 0x08
0096 __u8 th_is_xid;
0097 __u32 th_seq_num;
0098 } __attribute__ ((packed));
0099
0100 struct th_addon {
0101 __u32 th_last_seq;
0102 __u32 th_resvd;
0103 } __attribute__ ((packed));
0104
0105 struct th_sweep {
0106 struct th_header th;
0107 struct th_addon sw;
0108 } __attribute__ ((packed));
0109
0110 #define TH_HEADER_LENGTH (sizeof(struct th_header))
0111 #define TH_SWEEP_LENGTH (sizeof(struct th_sweep))
0112
0113 #define PDU_LAST 0x80
0114 #define PDU_CNTL 0x40
0115 #define PDU_FIRST 0x20
0116
0117 struct pdu {
0118 __u32 pdu_offset;
0119 __u8 pdu_flag;
0120 __u8 pdu_proto;
0121 __u16 pdu_seq;
0122 } __attribute__ ((packed));
0123
0124 #define PDU_HEADER_LENGTH (sizeof(struct pdu))
0125
0126 struct qllc {
0127 __u8 qllc_address;
0128 #define QLLC_REQ 0xFF
0129 #define QLLC_RESP 0x00
0130 __u8 qllc_commands;
0131 #define QLLC_DISCONNECT 0x53
0132 #define QLLC_UNSEQACK 0x73
0133 #define QLLC_SETMODE 0x93
0134 #define QLLC_EXCHID 0xBF
0135 } __attribute__ ((packed));
0136
0137
0138
0139
0140
0141
0142 #define MAX_MPCGCHAN 10
0143 #define MPC_XID_TIMEOUT_VALUE 10000
0144 #define MPC_CHANNEL_ADD 0
0145 #define MPC_CHANNEL_REMOVE 1
0146 #define MPC_CHANNEL_ATTN 2
0147 #define XSIDE 1
0148 #define YSIDE 0
0149
0150 struct mpcg_info {
0151 struct sk_buff *skb;
0152 struct channel *ch;
0153 struct xid2 *xid;
0154 struct th_sweep *sweep;
0155 struct th_header *th;
0156 };
0157
0158 struct mpc_group {
0159 struct tasklet_struct mpc_tasklet;
0160 struct tasklet_struct mpc_tasklet2;
0161 int changed_side;
0162 int saved_state;
0163 int channels_terminating;
0164 int out_of_sequence;
0165 int flow_off_called;
0166 int port_num;
0167 int port_persist;
0168 int alloc_called;
0169 __u32 xid2_adj_id;
0170 __u8 xid2_tgnum;
0171 __u32 xid2_sender_id;
0172 int num_channel_paths;
0173 int active_channels[2];
0174 __u16 group_max_buflen;
0175 int outstanding_xid2;
0176 int outstanding_xid7;
0177 int outstanding_xid7_p2;
0178 int sweep_req_pend_num;
0179 int sweep_rsp_pend_num;
0180 struct sk_buff *xid_skb;
0181 char *xid_skb_data;
0182 struct th_header *xid_th;
0183 struct xid2 *xid;
0184 char *xid_id;
0185 struct th_header *rcvd_xid_th;
0186 struct sk_buff *rcvd_xid_skb;
0187 char *rcvd_xid_data;
0188 __u8 in_sweep;
0189 __u8 roll;
0190 struct xid2 *saved_xid2;
0191 void (*allochanfunc)(int, int);
0192 int allocchan_callback_retries;
0193 void (*estconnfunc)(int, int, int);
0194 int estconn_callback_retries;
0195 int estconn_called;
0196 int xidnogood;
0197 int send_qllc_disc;
0198 fsm_timer timer;
0199 fsm_instance *fsm;
0200 };
0201
0202 #ifdef DEBUGDATA
0203 void ctcmpc_dumpit(char *buf, int len);
0204 #else
0205 static inline void ctcmpc_dumpit(char *buf, int len)
0206 {
0207 }
0208 #endif
0209
0210 #ifdef DEBUGDATA
0211
0212
0213
0214
0215
0216
0217 void ctcmpc_dump_skb(struct sk_buff *skb, int offset);
0218 #else
0219 static inline void ctcmpc_dump_skb(struct sk_buff *skb, int offset)
0220 {}
0221 #endif
0222
0223 static inline void ctcmpc_dump32(char *buf, int len)
0224 {
0225 if (len < 32)
0226 ctcmpc_dumpit(buf, len);
0227 else
0228 ctcmpc_dumpit(buf, 32);
0229 }
0230
0231 void ctcm_ccw_check_rc(struct channel *, int, char *);
0232 void mpc_group_ready(unsigned long adev);
0233 void mpc_channel_action(struct channel *ch, int direction, int action);
0234 void mpc_action_send_discontact(unsigned long thischan);
0235 void mpc_action_discontact(fsm_instance *fi, int event, void *arg);
0236 void ctcmpc_bh(unsigned long thischan);
0237 #endif
0238