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