• Home
  • Line#
  • Scopes#
  • Navigate#
  • Raw
  • Download
1 /*
2  *  drivers/s390/net/qeth_core_mpc.h
3  *
4  *    Copyright IBM Corp. 2007
5  *    Author(s): Frank Pavlic <fpavlic@de.ibm.com>,
6  *		 Thomas Spatzier <tspat@de.ibm.com>,
7  *		 Frank Blaschka <frank.blaschka@de.ibm.com>
8  */
9 
10 #ifndef __QETH_CORE_MPC_H__
11 #define __QETH_CORE_MPC_H__
12 
13 #include <asm/qeth.h>
14 
15 #define IPA_PDU_HEADER_SIZE	0x40
16 #define QETH_IPA_PDU_LEN_TOTAL(buffer) (buffer + 0x0e)
17 #define QETH_IPA_PDU_LEN_PDU1(buffer) (buffer + 0x26)
18 #define QETH_IPA_PDU_LEN_PDU2(buffer) (buffer + 0x29)
19 #define QETH_IPA_PDU_LEN_PDU3(buffer) (buffer + 0x3a)
20 
21 extern unsigned char IPA_PDU_HEADER[];
22 #define QETH_IPA_CMD_DEST_ADDR(buffer) (buffer + 0x2c)
23 
24 #define IPA_CMD_LENGTH	(IPA_PDU_HEADER_SIZE + sizeof(struct qeth_ipa_cmd))
25 
26 #define QETH_SEQ_NO_LENGTH	4
27 #define QETH_MPC_TOKEN_LENGTH	4
28 #define QETH_MCL_LENGTH		4
29 #define OSA_ADDR_LEN		6
30 
31 #define QETH_TIMEOUT		(10 * HZ)
32 #define QETH_IPA_TIMEOUT	(45 * HZ)
33 #define QETH_IDX_COMMAND_SEQNO	0xffff0000
34 #define SR_INFO_LEN		16
35 
36 #define QETH_CLEAR_CHANNEL_PARM	-10
37 #define QETH_HALT_CHANNEL_PARM	-11
38 #define QETH_RCD_PARM -12
39 
40 /*****************************************************************************/
41 /* IP Assist related definitions                                             */
42 /*****************************************************************************/
43 #define IPA_CMD_INITIATOR_HOST  0x00
44 #define IPA_CMD_INITIATOR_OSA   0x01
45 #define IPA_CMD_INITIATOR_HOST_REPLY  0x80
46 #define IPA_CMD_INITIATOR_OSA_REPLY   0x81
47 #define IPA_CMD_PRIM_VERSION_NO 0x01
48 
49 enum qeth_card_types {
50 	QETH_CARD_TYPE_UNKNOWN = 0,
51 	QETH_CARD_TYPE_OSD     = 1,
52 	QETH_CARD_TYPE_IQD     = 5,
53 	QETH_CARD_TYPE_OSN     = 6,
54 	QETH_CARD_TYPE_OSM     = 3,
55 	QETH_CARD_TYPE_OSX     = 2,
56 };
57 
58 #define QETH_MPC_DIFINFO_LEN_INDICATES_LINK_TYPE 0x18
59 /* only the first two bytes are looked at in qeth_get_cardname_short */
60 enum qeth_link_types {
61 	QETH_LINK_TYPE_FAST_ETH     = 0x01,
62 	QETH_LINK_TYPE_HSTR         = 0x02,
63 	QETH_LINK_TYPE_GBIT_ETH     = 0x03,
64 	QETH_LINK_TYPE_OSN          = 0x04,
65 	QETH_LINK_TYPE_10GBIT_ETH   = 0x10,
66 	QETH_LINK_TYPE_LANE_ETH100  = 0x81,
67 	QETH_LINK_TYPE_LANE_TR      = 0x82,
68 	QETH_LINK_TYPE_LANE_ETH1000 = 0x83,
69 	QETH_LINK_TYPE_LANE         = 0x88,
70 	QETH_LINK_TYPE_ATM_NATIVE   = 0x90,
71 };
72 
73 enum qeth_tr_macaddr_modes {
74 	QETH_TR_MACADDR_NONCANONICAL = 0,
75 	QETH_TR_MACADDR_CANONICAL    = 1,
76 };
77 
78 enum qeth_tr_broadcast_modes {
79 	QETH_TR_BROADCAST_ALLRINGS = 0,
80 	QETH_TR_BROADCAST_LOCAL    = 1,
81 };
82 
83 /*
84  * Routing stuff
85  */
86 #define RESET_ROUTING_FLAG 0x10 /* indicate that routing type shall be set */
87 enum qeth_routing_types {
88 	/* TODO: set to bit flag used in IPA Command */
89 	NO_ROUTER		= 0,
90 	PRIMARY_ROUTER		= 1,
91 	SECONDARY_ROUTER	= 2,
92 	MULTICAST_ROUTER	= 3,
93 	PRIMARY_CONNECTOR	= 4,
94 	SECONDARY_CONNECTOR	= 5,
95 };
96 
97 /* IPA Commands */
98 enum qeth_ipa_cmds {
99 	IPA_CMD_STARTLAN		= 0x01,
100 	IPA_CMD_STOPLAN			= 0x02,
101 	IPA_CMD_SETVMAC			= 0x21,
102 	IPA_CMD_DELVMAC			= 0x22,
103 	IPA_CMD_SETGMAC			= 0x23,
104 	IPA_CMD_DELGMAC			= 0x24,
105 	IPA_CMD_SETVLAN			= 0x25,
106 	IPA_CMD_DELVLAN			= 0x26,
107 	IPA_CMD_SETCCID			= 0x41,
108 	IPA_CMD_DELCCID			= 0x42,
109 	IPA_CMD_MODCCID			= 0x43,
110 	IPA_CMD_SETIP			= 0xb1,
111 	IPA_CMD_QIPASSIST		= 0xb2,
112 	IPA_CMD_SETASSPARMS		= 0xb3,
113 	IPA_CMD_SETIPM			= 0xb4,
114 	IPA_CMD_DELIPM			= 0xb5,
115 	IPA_CMD_SETRTG			= 0xb6,
116 	IPA_CMD_DELIP			= 0xb7,
117 	IPA_CMD_SETADAPTERPARMS		= 0xb8,
118 	IPA_CMD_SET_DIAG_ASS		= 0xb9,
119 	IPA_CMD_CREATE_ADDR		= 0xc3,
120 	IPA_CMD_DESTROY_ADDR		= 0xc4,
121 	IPA_CMD_REGISTER_LOCAL_ADDR	= 0xd1,
122 	IPA_CMD_UNREGISTER_LOCAL_ADDR	= 0xd2,
123 	IPA_CMD_UNKNOWN			= 0x00
124 };
125 
126 enum qeth_ip_ass_cmds {
127 	IPA_CMD_ASS_START	= 0x0001,
128 	IPA_CMD_ASS_STOP	= 0x0002,
129 	IPA_CMD_ASS_CONFIGURE	= 0x0003,
130 	IPA_CMD_ASS_ENABLE	= 0x0004,
131 };
132 
133 enum qeth_arp_process_subcmds {
134 	IPA_CMD_ASS_ARP_SET_NO_ENTRIES	= 0x0003,
135 	IPA_CMD_ASS_ARP_QUERY_CACHE	= 0x0004,
136 	IPA_CMD_ASS_ARP_ADD_ENTRY	= 0x0005,
137 	IPA_CMD_ASS_ARP_REMOVE_ENTRY	= 0x0006,
138 	IPA_CMD_ASS_ARP_FLUSH_CACHE	= 0x0007,
139 	IPA_CMD_ASS_ARP_QUERY_INFO	= 0x0104,
140 	IPA_CMD_ASS_ARP_QUERY_STATS	= 0x0204,
141 };
142 
143 
144 /* Return Codes for IPA Commands
145  * according to OSA card Specs */
146 
147 enum qeth_ipa_return_codes {
148 	IPA_RC_SUCCESS			= 0x0000,
149 	IPA_RC_NOTSUPP			= 0x0001,
150 	IPA_RC_IP_TABLE_FULL		= 0x0002,
151 	IPA_RC_UNKNOWN_ERROR		= 0x0003,
152 	IPA_RC_UNSUPPORTED_COMMAND	= 0x0004,
153 	IPA_RC_TRACE_ALREADY_ACTIVE	= 0x0005,
154 	IPA_RC_INVALID_FORMAT		= 0x0006,
155 	IPA_RC_DUP_IPV6_REMOTE		= 0x0008,
156 	IPA_RC_DUP_IPV6_HOME		= 0x0010,
157 	IPA_RC_UNREGISTERED_ADDR	= 0x0011,
158 	IPA_RC_NO_ID_AVAILABLE		= 0x0012,
159 	IPA_RC_ID_NOT_FOUND		= 0x0013,
160 	IPA_RC_INVALID_IP_VERSION	= 0x0020,
161 	IPA_RC_LAN_FRAME_MISMATCH	= 0x0040,
162 	IPA_RC_L2_UNSUPPORTED_CMD	= 0x2003,
163 	IPA_RC_L2_DUP_MAC		= 0x2005,
164 	IPA_RC_L2_ADDR_TABLE_FULL	= 0x2006,
165 	IPA_RC_L2_DUP_LAYER3_MAC	= 0x200a,
166 	IPA_RC_L2_GMAC_NOT_FOUND	= 0x200b,
167 	IPA_RC_L2_MAC_NOT_AUTH_BY_HYP	= 0x200c,
168 	IPA_RC_L2_MAC_NOT_AUTH_BY_ADP	= 0x200d,
169 	IPA_RC_L2_MAC_NOT_FOUND		= 0x2010,
170 	IPA_RC_L2_INVALID_VLAN_ID	= 0x2015,
171 	IPA_RC_L2_DUP_VLAN_ID		= 0x2016,
172 	IPA_RC_L2_VLAN_ID_NOT_FOUND	= 0x2017,
173 	IPA_RC_DATA_MISMATCH		= 0xe001,
174 	IPA_RC_INVALID_MTU_SIZE		= 0xe002,
175 	IPA_RC_INVALID_LANTYPE		= 0xe003,
176 	IPA_RC_INVALID_LANNUM		= 0xe004,
177 	IPA_RC_DUPLICATE_IP_ADDRESS	= 0xe005,
178 	IPA_RC_IP_ADDR_TABLE_FULL	= 0xe006,
179 	IPA_RC_LAN_PORT_STATE_ERROR	= 0xe007,
180 	IPA_RC_SETIP_NO_STARTLAN	= 0xe008,
181 	IPA_RC_SETIP_ALREADY_RECEIVED	= 0xe009,
182 	IPA_RC_IP_ADDR_ALREADY_USED	= 0xe00a,
183 	IPA_RC_MC_ADDR_NOT_FOUND	= 0xe00b,
184 	IPA_RC_SETIP_INVALID_VERSION	= 0xe00d,
185 	IPA_RC_UNSUPPORTED_SUBCMD	= 0xe00e,
186 	IPA_RC_ARP_ASSIST_NO_ENABLE	= 0xe00f,
187 	IPA_RC_PRIMARY_ALREADY_DEFINED	= 0xe010,
188 	IPA_RC_SECOND_ALREADY_DEFINED	= 0xe011,
189 	IPA_RC_INVALID_SETRTG_INDICATOR	= 0xe012,
190 	IPA_RC_MC_ADDR_ALREADY_DEFINED	= 0xe013,
191 	IPA_RC_LAN_OFFLINE		= 0xe080,
192 	IPA_RC_INVALID_IP_VERSION2	= 0xf001,
193 	IPA_RC_ENOMEM			= 0xfffe,
194 	IPA_RC_FFFF			= 0xffff
195 };
196 /* for DELIP */
197 #define IPA_RC_IP_ADDRESS_NOT_DEFINED	IPA_RC_PRIMARY_ALREADY_DEFINED
198 /* for SET_DIAGNOSTIC_ASSIST */
199 #define IPA_RC_INVALID_SUBCMD		IPA_RC_IP_TABLE_FULL
200 #define IPA_RC_HARDWARE_AUTH_ERROR	IPA_RC_UNKNOWN_ERROR
201 
202 /* IPA function flags; each flag marks availability of respective function */
203 enum qeth_ipa_funcs {
204 	IPA_ARP_PROCESSING      = 0x00000001L,
205 	IPA_INBOUND_CHECKSUM    = 0x00000002L,
206 	IPA_OUTBOUND_CHECKSUM   = 0x00000004L,
207 	IPA_IP_FRAGMENTATION    = 0x00000008L,
208 	IPA_FILTERING           = 0x00000010L,
209 	IPA_IPV6                = 0x00000020L,
210 	IPA_MULTICASTING        = 0x00000040L,
211 	IPA_IP_REASSEMBLY       = 0x00000080L,
212 	IPA_QUERY_ARP_COUNTERS  = 0x00000100L,
213 	IPA_QUERY_ARP_ADDR_INFO = 0x00000200L,
214 	IPA_SETADAPTERPARMS     = 0x00000400L,
215 	IPA_VLAN_PRIO           = 0x00000800L,
216 	IPA_PASSTHRU            = 0x00001000L,
217 	IPA_FLUSH_ARP_SUPPORT   = 0x00002000L,
218 	IPA_FULL_VLAN           = 0x00004000L,
219 	IPA_INBOUND_PASSTHRU    = 0x00008000L,
220 	IPA_SOURCE_MAC          = 0x00010000L,
221 	IPA_OSA_MC_ROUTER       = 0x00020000L,
222 	IPA_QUERY_ARP_ASSIST	= 0x00040000L,
223 	IPA_INBOUND_TSO         = 0x00080000L,
224 	IPA_OUTBOUND_TSO        = 0x00100000L,
225 };
226 
227 /* SETIP/DELIP IPA Command: ***************************************************/
228 enum qeth_ipa_setdelip_flags {
229 	QETH_IPA_SETDELIP_DEFAULT          = 0x00L, /* default */
230 	QETH_IPA_SETIP_VIPA_FLAG           = 0x01L, /* no grat. ARP */
231 	QETH_IPA_SETIP_TAKEOVER_FLAG       = 0x02L, /* nofail on grat. ARP */
232 	QETH_IPA_DELIP_ADDR_2_B_TAKEN_OVER = 0x20L,
233 	QETH_IPA_DELIP_VIPA_FLAG           = 0x40L,
234 	QETH_IPA_DELIP_ADDR_NEEDS_SETIP    = 0x80L,
235 };
236 
237 /* SETADAPTER IPA Command: ****************************************************/
238 enum qeth_ipa_setadp_cmd {
239 	IPA_SETADP_QUERY_COMMANDS_SUPPORTED	= 0x00000001L,
240 	IPA_SETADP_ALTER_MAC_ADDRESS		= 0x00000002L,
241 	IPA_SETADP_ADD_DELETE_GROUP_ADDRESS	= 0x00000004L,
242 	IPA_SETADP_ADD_DELETE_FUNCTIONAL_ADDR	= 0x00000008L,
243 	IPA_SETADP_SET_ADDRESSING_MODE		= 0x00000010L,
244 	IPA_SETADP_SET_CONFIG_PARMS		= 0x00000020L,
245 	IPA_SETADP_SET_CONFIG_PARMS_EXTENDED	= 0x00000040L,
246 	IPA_SETADP_SET_BROADCAST_MODE		= 0x00000080L,
247 	IPA_SETADP_SEND_OSA_MESSAGE		= 0x00000100L,
248 	IPA_SETADP_SET_SNMP_CONTROL		= 0x00000200L,
249 	IPA_SETADP_QUERY_CARD_INFO		= 0x00000400L,
250 	IPA_SETADP_SET_PROMISC_MODE		= 0x00000800L,
251 	IPA_SETADP_SET_DIAG_ASSIST		= 0x00002000L,
252 	IPA_SETADP_SET_ACCESS_CONTROL		= 0x00010000L,
253 	IPA_SETADP_QUERY_OAT			= 0x00080000L,
254 };
255 enum qeth_ipa_mac_ops {
256 	CHANGE_ADDR_READ_MAC		= 0,
257 	CHANGE_ADDR_REPLACE_MAC		= 1,
258 	CHANGE_ADDR_ADD_MAC		= 2,
259 	CHANGE_ADDR_DEL_MAC		= 4,
260 	CHANGE_ADDR_RESET_MAC		= 8,
261 };
262 enum qeth_ipa_addr_ops {
263 	CHANGE_ADDR_READ_ADDR		= 0,
264 	CHANGE_ADDR_ADD_ADDR		= 1,
265 	CHANGE_ADDR_DEL_ADDR		= 2,
266 	CHANGE_ADDR_FLUSH_ADDR_TABLE	= 4,
267 };
268 enum qeth_ipa_promisc_modes {
269 	SET_PROMISC_MODE_OFF		= 0,
270 	SET_PROMISC_MODE_ON		= 1,
271 };
272 enum qeth_ipa_isolation_modes {
273 	ISOLATION_MODE_NONE		= 0x00000000L,
274 	ISOLATION_MODE_FWD		= 0x00000001L,
275 	ISOLATION_MODE_DROP		= 0x00000002L,
276 };
277 enum qeth_ipa_set_access_mode_rc {
278 	SET_ACCESS_CTRL_RC_SUCCESS		= 0x0000,
279 	SET_ACCESS_CTRL_RC_NOT_SUPPORTED	= 0x0004,
280 	SET_ACCESS_CTRL_RC_ALREADY_NOT_ISOLATED	= 0x0008,
281 	SET_ACCESS_CTRL_RC_ALREADY_ISOLATED	= 0x0010,
282 	SET_ACCESS_CTRL_RC_NONE_SHARED_ADAPTER	= 0x0014,
283 	SET_ACCESS_CTRL_RC_ACTIVE_CHECKSUM_OFF	= 0x0018,
284 };
285 
286 
287 /* (SET)DELIP(M) IPA stuff ***************************************************/
288 struct qeth_ipacmd_setdelip4 {
289 	__u8   ip_addr[4];
290 	__u8   mask[4];
291 	__u32  flags;
292 } __attribute__ ((packed));
293 
294 struct qeth_ipacmd_setdelip6 {
295 	__u8   ip_addr[16];
296 	__u8   mask[16];
297 	__u32  flags;
298 } __attribute__ ((packed));
299 
300 struct qeth_ipacmd_setdelipm {
301 	__u8 mac[6];
302 	__u8 padding[2];
303 	__u8 ip6[12];
304 	__u8 ip4[4];
305 } __attribute__ ((packed));
306 
307 struct qeth_ipacmd_layer2setdelmac {
308 	__u32 mac_length;
309 	__u8 mac[6];
310 } __attribute__ ((packed));
311 
312 struct qeth_ipacmd_layer2setdelvlan {
313 	__u16 vlan_id;
314 } __attribute__ ((packed));
315 
316 
317 struct qeth_ipacmd_setassparms_hdr {
318 	__u32 assist_no;
319 	__u16 length;
320 	__u16 command_code;
321 	__u16 return_code;
322 	__u8 number_of_replies;
323 	__u8 seq_no;
324 } __attribute__((packed));
325 
326 struct qeth_arp_query_data {
327 	__u16 request_bits;
328 	__u16 reply_bits;
329 	__u32 no_entries;
330 	char data; /* only for replies */
331 } __attribute__((packed));
332 
333 /* used as parameter for arp_query reply */
334 struct qeth_arp_query_info {
335 	__u32 udata_len;
336 	__u16 mask_bits;
337 	__u32 udata_offset;
338 	__u32 no_entries;
339 	char *udata;
340 };
341 
342 /* SETASSPARMS IPA Command: */
343 struct qeth_ipacmd_setassparms {
344 	struct qeth_ipacmd_setassparms_hdr hdr;
345 	union {
346 		__u32 flags_32bit;
347 		struct qeth_arp_cache_entry add_arp_entry;
348 		struct qeth_arp_query_data query_arp;
349 		__u8 ip[16];
350 	} data;
351 } __attribute__ ((packed));
352 
353 
354 /* SETRTG IPA Command:    ****************************************************/
355 struct qeth_set_routing {
356 	__u8 type;
357 };
358 
359 /* SETADAPTERPARMS IPA Command:    *******************************************/
360 struct qeth_query_cmds_supp {
361 	__u32 no_lantypes_supp;
362 	__u8 lan_type;
363 	__u8 reserved1[3];
364 	__u32 supported_cmds;
365 	__u8 reserved2[8];
366 } __attribute__ ((packed));
367 
368 struct qeth_change_addr {
369 	__u32 cmd;
370 	__u32 addr_size;
371 	__u32 no_macs;
372 	__u8 addr[OSA_ADDR_LEN];
373 } __attribute__ ((packed));
374 
375 
376 struct qeth_snmp_cmd {
377 	__u8  token[16];
378 	__u32 request;
379 	__u32 interface;
380 	__u32 returncode;
381 	__u32 firmwarelevel;
382 	__u32 seqno;
383 	__u8  data;
384 } __attribute__ ((packed));
385 
386 struct qeth_snmp_ureq_hdr {
387 	__u32   data_len;
388 	__u32   req_len;
389 	__u32   reserved1;
390 	__u32   reserved2;
391 } __attribute__ ((packed));
392 
393 struct qeth_snmp_ureq {
394 	struct qeth_snmp_ureq_hdr hdr;
395 	struct qeth_snmp_cmd cmd;
396 } __attribute__((packed));
397 
398 /* SET_ACCESS_CONTROL: same format for request and reply */
399 struct qeth_set_access_ctrl {
400 	__u32 subcmd_code;
401 } __attribute__((packed));
402 
403 struct qeth_query_oat {
404 	__u32 subcmd_code;
405 	__u8 reserved[12];
406 } __packed;
407 
408 struct qeth_qoat_priv {
409 	__u32 buffer_len;
410 	__u32 response_len;
411 	char *buffer;
412 };
413 
414 struct qeth_ipacmd_setadpparms_hdr {
415 	__u32 supp_hw_cmds;
416 	__u32 reserved1;
417 	__u16 cmdlength;
418 	__u16 reserved2;
419 	__u32 command_code;
420 	__u16 return_code;
421 	__u8  used_total;
422 	__u8  seq_no;
423 	__u32 reserved3;
424 } __attribute__ ((packed));
425 
426 struct qeth_ipacmd_setadpparms {
427 	struct qeth_ipacmd_setadpparms_hdr hdr;
428 	union {
429 		struct qeth_query_cmds_supp query_cmds_supp;
430 		struct qeth_change_addr change_addr;
431 		struct qeth_snmp_cmd snmp;
432 		struct qeth_set_access_ctrl set_access_ctrl;
433 		struct qeth_query_oat query_oat;
434 		__u32 mode;
435 	} data;
436 } __attribute__ ((packed));
437 
438 /* CREATE_ADDR IPA Command:    ***********************************************/
439 struct qeth_create_destroy_address {
440 	__u8 unique_id[8];
441 } __attribute__ ((packed));
442 
443 /* SET DIAGNOSTIC ASSIST IPA Command:	 *************************************/
444 
445 enum qeth_diags_cmds {
446 	QETH_DIAGS_CMD_QUERY	= 0x0001,
447 	QETH_DIAGS_CMD_TRAP	= 0x0002,
448 	QETH_DIAGS_CMD_TRACE	= 0x0004,
449 	QETH_DIAGS_CMD_NOLOG	= 0x0008,
450 	QETH_DIAGS_CMD_DUMP	= 0x0010,
451 };
452 
453 enum qeth_diags_trace_types {
454 	QETH_DIAGS_TYPE_HIPERSOCKET	= 0x02,
455 };
456 
457 enum qeth_diags_trace_cmds {
458 	QETH_DIAGS_CMD_TRACE_ENABLE	= 0x0001,
459 	QETH_DIAGS_CMD_TRACE_DISABLE	= 0x0002,
460 	QETH_DIAGS_CMD_TRACE_MODIFY	= 0x0004,
461 	QETH_DIAGS_CMD_TRACE_REPLACE	= 0x0008,
462 	QETH_DIAGS_CMD_TRACE_QUERY	= 0x0010,
463 };
464 
465 enum qeth_diags_trap_action {
466 	QETH_DIAGS_TRAP_ARM	= 0x01,
467 	QETH_DIAGS_TRAP_DISARM	= 0x02,
468 	QETH_DIAGS_TRAP_CAPTURE = 0x04,
469 };
470 
471 struct qeth_ipacmd_diagass {
472 	__u32  host_tod2;
473 	__u32:32;
474 	__u16  subcmd_len;
475 	__u16:16;
476 	__u32  subcmd;
477 	__u8   type;
478 	__u8   action;
479 	__u16  options;
480 	__u32  ext;
481 	__u8   cdata[64];
482 } __attribute__ ((packed));
483 
484 /* Header for each IPA command */
485 struct qeth_ipacmd_hdr {
486 	__u8   command;
487 	__u8   initiator;
488 	__u16  seqno;
489 	__u16  return_code;
490 	__u8   adapter_type;
491 	__u8   rel_adapter_no;
492 	__u8   prim_version_no;
493 	__u8   param_count;
494 	__u16  prot_version;
495 	__u32  ipa_supported;
496 	__u32  ipa_enabled;
497 } __attribute__ ((packed));
498 
499 /* The IPA command itself */
500 struct qeth_ipa_cmd {
501 	struct qeth_ipacmd_hdr hdr;
502 	union {
503 		struct qeth_ipacmd_setdelip4		setdelip4;
504 		struct qeth_ipacmd_setdelip6		setdelip6;
505 		struct qeth_ipacmd_setdelipm		setdelipm;
506 		struct qeth_ipacmd_setassparms		setassparms;
507 		struct qeth_ipacmd_layer2setdelmac	setdelmac;
508 		struct qeth_ipacmd_layer2setdelvlan	setdelvlan;
509 		struct qeth_create_destroy_address	create_destroy_addr;
510 		struct qeth_ipacmd_setadpparms		setadapterparms;
511 		struct qeth_set_routing			setrtg;
512 		struct qeth_ipacmd_diagass		diagass;
513 	} data;
514 } __attribute__ ((packed));
515 
516 /*
517  * special command for ARP processing.
518  * this is not included in setassparms command before, because we get
519  * problem with the size of struct qeth_ipacmd_setassparms otherwise
520  */
521 enum qeth_ipa_arp_return_codes {
522 	QETH_IPA_ARP_RC_SUCCESS      = 0x0000,
523 	QETH_IPA_ARP_RC_FAILED       = 0x0001,
524 	QETH_IPA_ARP_RC_NOTSUPP      = 0x0002,
525 	QETH_IPA_ARP_RC_OUT_OF_RANGE = 0x0003,
526 	QETH_IPA_ARP_RC_Q_NOTSUPP    = 0x0004,
527 	QETH_IPA_ARP_RC_Q_NO_DATA    = 0x0008,
528 };
529 
530 extern char *qeth_get_ipa_msg(enum qeth_ipa_return_codes rc);
531 extern char *qeth_get_ipa_cmd_name(enum qeth_ipa_cmds cmd);
532 
533 #define QETH_SETASS_BASE_LEN (sizeof(struct qeth_ipacmd_hdr) + \
534 			       sizeof(struct qeth_ipacmd_setassparms_hdr))
535 #define QETH_IPA_ARP_DATA_POS(buffer) (buffer + IPA_PDU_HEADER_SIZE + \
536 				       QETH_SETASS_BASE_LEN)
537 #define QETH_SETADP_BASE_LEN (sizeof(struct qeth_ipacmd_hdr) + \
538 			      sizeof(struct qeth_ipacmd_setadpparms_hdr))
539 #define QETH_SNMP_SETADP_CMDLENGTH 16
540 
541 #define QETH_ARP_DATA_SIZE 3968
542 #define QETH_ARP_CMD_LEN (QETH_ARP_DATA_SIZE + 8)
543 /* Helper functions */
544 #define IS_IPA_REPLY(cmd) ((cmd->hdr.initiator == IPA_CMD_INITIATOR_HOST) || \
545 			   (cmd->hdr.initiator == IPA_CMD_INITIATOR_OSA_REPLY))
546 
547 /*****************************************************************************/
548 /* END OF   IP Assist related definitions                                    */
549 /*****************************************************************************/
550 
551 
552 extern unsigned char WRITE_CCW[];
553 extern unsigned char READ_CCW[];
554 
555 extern unsigned char CM_ENABLE[];
556 #define CM_ENABLE_SIZE 0x63
557 #define QETH_CM_ENABLE_ISSUER_RM_TOKEN(buffer) (buffer + 0x2c)
558 #define QETH_CM_ENABLE_FILTER_TOKEN(buffer) (buffer + 0x53)
559 #define QETH_CM_ENABLE_USER_DATA(buffer) (buffer + 0x5b)
560 
561 #define QETH_CM_ENABLE_RESP_FILTER_TOKEN(buffer) \
562 		(PDU_ENCAPSULATION(buffer) + 0x13)
563 
564 
565 extern unsigned char CM_SETUP[];
566 #define CM_SETUP_SIZE 0x64
567 #define QETH_CM_SETUP_DEST_ADDR(buffer) (buffer + 0x2c)
568 #define QETH_CM_SETUP_CONNECTION_TOKEN(buffer) (buffer + 0x51)
569 #define QETH_CM_SETUP_FILTER_TOKEN(buffer) (buffer + 0x5a)
570 
571 #define QETH_CM_SETUP_RESP_DEST_ADDR(buffer) \
572 		(PDU_ENCAPSULATION(buffer) + 0x1a)
573 
574 extern unsigned char ULP_ENABLE[];
575 #define ULP_ENABLE_SIZE 0x6b
576 #define QETH_ULP_ENABLE_LINKNUM(buffer) (buffer + 0x61)
577 #define QETH_ULP_ENABLE_DEST_ADDR(buffer) (buffer + 0x2c)
578 #define QETH_ULP_ENABLE_FILTER_TOKEN(buffer) (buffer + 0x53)
579 #define QETH_ULP_ENABLE_PORTNAME_AND_LL(buffer) (buffer + 0x62)
580 #define QETH_ULP_ENABLE_RESP_FILTER_TOKEN(buffer) \
581 		(PDU_ENCAPSULATION(buffer) + 0x13)
582 #define QETH_ULP_ENABLE_RESP_MAX_MTU(buffer) \
583 		(PDU_ENCAPSULATION(buffer) + 0x1f)
584 #define QETH_ULP_ENABLE_RESP_DIFINFO_LEN(buffer) \
585 		(PDU_ENCAPSULATION(buffer) + 0x17)
586 #define QETH_ULP_ENABLE_RESP_LINK_TYPE(buffer) \
587 		(PDU_ENCAPSULATION(buffer) + 0x2b)
588 /* Layer 2 definitions */
589 #define QETH_PROT_LAYER2 0x08
590 #define QETH_PROT_TCPIP  0x03
591 #define QETH_PROT_OSN2   0x0a
592 #define QETH_ULP_ENABLE_PROT_TYPE(buffer) (buffer + 0x50)
593 #define QETH_IPA_CMD_PROT_TYPE(buffer) (buffer + 0x19)
594 
595 extern unsigned char ULP_SETUP[];
596 #define ULP_SETUP_SIZE 0x6c
597 #define QETH_ULP_SETUP_DEST_ADDR(buffer) (buffer + 0x2c)
598 #define QETH_ULP_SETUP_CONNECTION_TOKEN(buffer) (buffer + 0x51)
599 #define QETH_ULP_SETUP_FILTER_TOKEN(buffer) (buffer + 0x5a)
600 #define QETH_ULP_SETUP_CUA(buffer) (buffer + 0x68)
601 #define QETH_ULP_SETUP_REAL_DEVADDR(buffer) (buffer + 0x6a)
602 
603 #define QETH_ULP_SETUP_RESP_CONNECTION_TOKEN(buffer) \
604 		(PDU_ENCAPSULATION(buffer) + 0x1a)
605 
606 
607 extern unsigned char DM_ACT[];
608 #define DM_ACT_SIZE 0x55
609 #define QETH_DM_ACT_DEST_ADDR(buffer) (buffer + 0x2c)
610 #define QETH_DM_ACT_CONNECTION_TOKEN(buffer) (buffer + 0x51)
611 
612 
613 
614 #define QETH_TRANSPORT_HEADER_SEQ_NO(buffer) (buffer + 4)
615 #define QETH_PDU_HEADER_SEQ_NO(buffer) (buffer + 0x1c)
616 #define QETH_PDU_HEADER_ACK_SEQ_NO(buffer) (buffer + 0x20)
617 
618 extern unsigned char IDX_ACTIVATE_READ[];
619 extern unsigned char IDX_ACTIVATE_WRITE[];
620 
621 #define IDX_ACTIVATE_SIZE	0x22
622 #define QETH_IDX_ACT_PNO(buffer) (buffer+0x0b)
623 #define QETH_IDX_ACT_ISSUER_RM_TOKEN(buffer) (buffer + 0x0c)
624 #define QETH_IDX_NO_PORTNAME_REQUIRED(buffer) ((buffer)[0x0b] & 0x80)
625 #define QETH_IDX_ACT_FUNC_LEVEL(buffer) (buffer + 0x10)
626 #define QETH_IDX_ACT_DATASET_NAME(buffer) (buffer + 0x16)
627 #define QETH_IDX_ACT_QDIO_DEV_CUA(buffer) (buffer + 0x1e)
628 #define QETH_IDX_ACT_QDIO_DEV_REALADDR(buffer) (buffer + 0x20)
629 #define QETH_IS_IDX_ACT_POS_REPLY(buffer) (((buffer)[0x08] & 3) == 2)
630 #define QETH_IDX_REPLY_LEVEL(buffer) (buffer + 0x12)
631 #define QETH_IDX_ACT_CAUSE_CODE(buffer) (buffer)[0x09]
632 #define QETH_IDX_ACT_ERR_EXCL		0x19
633 #define QETH_IDX_ACT_ERR_AUTH		0x1E
634 #define QETH_IDX_ACT_ERR_AUTH_USER	0x20
635 
636 #define PDU_ENCAPSULATION(buffer) \
637 	(buffer + *(buffer + (*(buffer + 0x0b)) + \
638 	 *(buffer + *(buffer + 0x0b) + 0x11) + 0x07))
639 
640 #define IS_IPA(buffer) \
641 	((buffer) && \
642 	 (*(buffer + ((*(buffer + 0x0b)) + 4)) == 0xc1))
643 
644 #define ADDR_FRAME_TYPE_DIX 1
645 #define ADDR_FRAME_TYPE_802_3 2
646 #define ADDR_FRAME_TYPE_TR_WITHOUT_SR 0x10
647 #define ADDR_FRAME_TYPE_TR_WITH_SR 0x20
648 
649 #endif
650