2 * linux/drivers/s390/net/qeth_mpc.h
4 * Linux on zSeries OSA Express and HiperSockets support
6 * Copyright 2000,2003 IBM Corporation
7 * Author(s): Utz Bacher <utz.bacher@de.ibm.com>
8 * Thomas Spatzier <tspat@de.ibm.com>
9 * Frank Pavlic <pavlic@de.ibm.com>
12 #ifndef __QETH_MPC_H__
13 #define __QETH_MPC_H__
17 #define VERSION_QETH_MPC_H "$Revision: 1.43 $"
19 extern const char *VERSION_QETH_MPC_C
;
21 #define IPA_PDU_HEADER_SIZE 0x40
22 #define QETH_IPA_PDU_LEN_TOTAL(buffer) (buffer+0x0e)
23 #define QETH_IPA_PDU_LEN_PDU1(buffer) (buffer+0x26)
24 #define QETH_IPA_PDU_LEN_PDU2(buffer) (buffer+0x2a)
25 #define QETH_IPA_PDU_LEN_PDU3(buffer) (buffer+0x3a)
27 extern unsigned char IPA_PDU_HEADER
[];
28 #define QETH_IPA_CMD_DEST_ADDR(buffer) (buffer+0x2c)
30 #define IPA_CMD_LENGTH (IPA_PDU_HEADER_SIZE + sizeof(struct qeth_ipa_cmd))
32 #define QETH_SEQ_NO_LENGTH 4
33 #define QETH_MPC_TOKEN_LENGTH 4
34 #define QETH_MCL_LENGTH 4
35 #define OSA_ADDR_LEN 6
37 #define QETH_TIMEOUT (10 * HZ)
38 #define QETH_IPA_TIMEOUT (45 * HZ)
39 #define QETH_IDX_COMMAND_SEQNO 0xffff0000
40 #define SR_INFO_LEN 16
42 #define QETH_CLEAR_CHANNEL_PARM -10
43 #define QETH_HALT_CHANNEL_PARM -11
45 /*****************************************************************************/
46 /* IP Assist related definitions */
47 /*****************************************************************************/
48 #define IPA_CMD_INITIATOR_HOST 0x00
49 #define IPA_CMD_INITIATOR_HYDRA 0x01
50 #define IPA_CMD_PRIM_VERSION_NO 0x01
52 enum qeth_card_types
{
53 QETH_CARD_TYPE_UNKNOWN
= 0,
54 QETH_CARD_TYPE_OSAE
= 10,
55 QETH_CARD_TYPE_IQD
= 1234,
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_10GBIT_ETH
= 0x10,
65 QETH_LINK_TYPE_LANE_ETH100
= 0x81,
66 QETH_LINK_TYPE_LANE_TR
= 0x82,
67 QETH_LINK_TYPE_LANE_ETH1000
= 0x83,
68 QETH_LINK_TYPE_LANE
= 0x88,
69 QETH_LINK_TYPE_ATM_NATIVE
= 0x90,
72 enum qeth_tr_macaddr_modes
{
73 QETH_TR_MACADDR_NONCANONICAL
= 0,
74 QETH_TR_MACADDR_CANONICAL
= 1,
77 enum qeth_tr_broadcast_modes
{
78 QETH_TR_BROADCAST_ALLRINGS
= 0,
79 QETH_TR_BROADCAST_LOCAL
= 1,
82 /* these values match CHECKSUM_* in include/linux/skbuff.h */
83 enum qeth_checksum_types
{
84 SW_CHECKSUMMING
= 0, /* TODO: set to bit flag used in IPA Command */
88 #define QETH_CHECKSUM_DEFAULT SW_CHECKSUMMING
93 #define RESET_ROUTING_FLAG 0x10 /* indicate that routing type shall be set */
94 enum qeth_routing_types
{
95 NO_ROUTER
= 0, /* TODO: set to bit flag used in IPA Command */
99 PRIMARY_CONNECTOR
= 4,
100 SECONDARY_CONNECTOR
= 5,
106 IPA_CMD_STARTLAN
= 0x01,
107 IPA_CMD_STOPLAN
= 0x02,
108 IPA_CMD_SETVMAC
= 0x21,
109 IPA_CMD_DELVMAC
= 0x22,
110 IPA_CMD_SETGMAC
= 0x23,
111 IPA_CMD_DELGMAC
= 0x24,
112 IPA_CMD_SETVLAN
= 0x25,
113 IPA_CMD_DELVLAN
= 0x26,
114 IPA_CMD_SETIP
= 0xb1,
115 IPA_CMD_DELIP
= 0xb7,
116 IPA_CMD_QIPASSIST
= 0xb2,
117 IPA_CMD_SETASSPARMS
= 0xb3,
118 IPA_CMD_SETIPM
= 0xb4,
119 IPA_CMD_DELIPM
= 0xb5,
120 IPA_CMD_SETRTG
= 0xb6,
121 IPA_CMD_SETADAPTERPARMS
= 0xb8,
122 IPA_CMD_IPFRAME
= 0xb9,
123 IPA_CMD_ADD_ADDR_ENTRY
= 0xc1,
124 IPA_CMD_DELETE_ADDR_ENTRY
= 0xc2,
125 IPA_CMD_CREATE_ADDR
= 0xc3,
126 IPA_CMD_DESTROY_ADDR
= 0xc4,
127 IPA_CMD_REGISTER_LOCAL_ADDR
= 0xd1,
128 IPA_CMD_UNREGISTER_LOCAL_ADDR
= 0xd2,
131 enum qeth_ip_ass_cmds
{
132 IPA_CMD_ASS_START
= 0x0001,
133 IPA_CMD_ASS_STOP
= 0x0002,
134 IPA_CMD_ASS_CONFIGURE
= 0x0003,
135 IPA_CMD_ASS_ENABLE
= 0x0004,
138 enum qeth_arp_process_subcmds
{
139 IPA_CMD_ASS_ARP_SET_NO_ENTRIES
= 0x0003,
140 IPA_CMD_ASS_ARP_QUERY_CACHE
= 0x0004,
141 IPA_CMD_ASS_ARP_ADD_ENTRY
= 0x0005,
142 IPA_CMD_ASS_ARP_REMOVE_ENTRY
= 0x0006,
143 IPA_CMD_ASS_ARP_FLUSH_CACHE
= 0x0007,
144 IPA_CMD_ASS_ARP_QUERY_INFO
= 0x0104,
145 IPA_CMD_ASS_ARP_QUERY_STATS
= 0x0204,
148 /* Return Codes for IPA Commands */
149 enum qeth_ipa_return_codes
{
150 IPA_RC_SUCCESS
= 0x0000,
151 IPA_RC_NOTSUPP
= 0x0001,
152 IPA_RC_NO_ACCESS
= 0x0002,
153 IPA_RC_FAILED
= 0x0003,
154 IPA_RC_DATA_MISMATCH
= 0xe001,
155 IPA_RC_INVALID_LAN_TYPE
= 0xe003,
156 IPA_RC_INVALID_LAN_NO
= 0xe004,
157 IPA_RC_IPADDR_ALREADY_REG
= 0xe005,
158 IPA_RC_IPADDR_TABLE_FULL
= 0xe006,
159 IPA_RC_IPADDR_ALREADY_USED
= 0xe00a,
160 IPA_RC_ASSNO_NOT_SUPP
= 0xe00d,
161 IPA_RC_ASSCMD_START_FAILED
= 0xe00e,
162 IPA_RC_ASSCMD_PART_SUCCESS
= 0xe00f,
163 IPA_RC_IPADDR_NOT_DEFINED
= 0xe010,
164 IPA_RC_LAN_OFFLINE
= 0xe080,
167 /* IPA function flags; each flag marks availability of respective function */
168 enum qeth_ipa_funcs
{
169 IPA_ARP_PROCESSING
= 0x00000001L
,
170 IPA_INBOUND_CHECKSUM
= 0x00000002L
,
171 IPA_OUTBOUND_CHECKSUM
= 0x00000004L
,
172 IPA_IP_FRAGMENTATION
= 0x00000008L
,
173 IPA_FILTERING
= 0x00000010L
,
174 IPA_IPV6
= 0x00000020L
,
175 IPA_MULTICASTING
= 0x00000040L
,
176 IPA_IP_REASSEMBLY
= 0x00000080L
,
177 IPA_QUERY_ARP_COUNTERS
= 0x00000100L
,
178 IPA_QUERY_ARP_ADDR_INFO
= 0x00000200L
,
179 IPA_SETADAPTERPARMS
= 0x00000400L
,
180 IPA_VLAN_PRIO
= 0x00000800L
,
181 IPA_PASSTHRU
= 0x00001000L
,
182 IPA_FULL_VLAN
= 0x00004000L
,
183 IPA_SOURCE_MAC
= 0x00010000L
,
184 IPA_OSA_MC_ROUTER
= 0x00020000L
,
185 IPA_QUERY_ARP_ASSIST
= 0x00040000L
,
186 IPA_INBOUND_TSO
= 0x00080000L
,
187 IPA_OUTBOUND_TSO
= 0x00100000L
,
190 /* SETIP/DELIP IPA Command: ***************************************************/
191 enum qeth_ipa_setdelip_flags
{
192 QETH_IPA_SETDELIP_DEFAULT
= 0x00L
, /* default */
193 QETH_IPA_SETIP_VIPA_FLAG
= 0x01L
, /* no grat. ARP */
194 QETH_IPA_SETIP_TAKEOVER_FLAG
= 0x02L
, /* nofail on grat. ARP */
195 QETH_IPA_DELIP_ADDR_2_B_TAKEN_OVER
= 0x20L
,
196 QETH_IPA_DELIP_VIPA_FLAG
= 0x40L
,
197 QETH_IPA_DELIP_ADDR_NEEDS_SETIP
= 0x80L
,
200 /* SETADAPTER IPA Command: ****************************************************/
201 enum qeth_ipa_setadp_cmd
{
202 IPA_SETADP_QUERY_COMMANDS_SUPPORTED
= 0x01,
203 IPA_SETADP_ALTER_MAC_ADDRESS
= 0x02,
204 IPA_SETADP_ADD_DELETE_GROUP_ADDRESS
= 0x04,
205 IPA_SETADP_ADD_DELETE_FUNCTIONAL_ADDR
= 0x08,
206 IPA_SETADP_SET_ADDRESSING_MODE
= 0x10,
207 IPA_SETADP_SET_CONFIG_PARMS
= 0x20,
208 IPA_SETADP_SET_CONFIG_PARMS_EXTENDED
= 0x40,
209 IPA_SETADP_SET_BROADCAST_MODE
= 0x80,
210 IPA_SETADP_SEND_OSA_MESSAGE
= 0x0100,
211 IPA_SETADP_SET_SNMP_CONTROL
= 0x0200,
212 IPA_SETADP_READ_SNMP_PARMS
= 0x0400,
213 IPA_SETADP_WRITE_SNMP_PARMS
= 0x0800,
214 IPA_SETADP_QUERY_CARD_INFO
= 0x1000,
216 enum qeth_ipa_mac_ops
{
217 CHANGE_ADDR_READ_MAC
= 0,
218 CHANGE_ADDR_REPLACE_MAC
= 1,
219 CHANGE_ADDR_ADD_MAC
= 2,
220 CHANGE_ADDR_DEL_MAC
= 4,
221 CHANGE_ADDR_RESET_MAC
= 8,
223 enum qeth_ipa_addr_ops
{
224 CHANGE_ADDR_READ_ADDR
= 0,
225 CHANGE_ADDR_ADD_ADDR
= 1,
226 CHANGE_ADDR_DEL_ADDR
= 2,
227 CHANGE_ADDR_FLUSH_ADDR_TABLE
= 4,
231 /* (SET)DELIP(M) IPA stuff ***************************************************/
232 struct qeth_ipacmd_setdelip4
{
236 } __attribute__ ((packed
));
238 struct qeth_ipacmd_setdelip6
{
242 } __attribute__ ((packed
));
244 struct qeth_ipacmd_setdelipm
{
249 } __attribute__ ((packed
));
251 struct qeth_ipacmd_layer2setdelmac
{
254 } __attribute__ ((packed
));
256 struct qeth_ipacmd_layer2setdelvlan
{
258 } __attribute__ ((packed
));
261 struct qeth_ipacmd_setassparms_hdr
{
266 __u8 number_of_replies
;
268 } __attribute__((packed
));
270 struct qeth_arp_query_data
{
275 } __attribute__((packed
));
277 /* used as parameter for arp_query reply */
278 struct qeth_arp_query_info
{
286 /* SETASSPARMS IPA Command: */
287 struct qeth_ipacmd_setassparms
{
288 struct qeth_ipacmd_setassparms_hdr hdr
;
291 struct qeth_arp_cache_entry add_arp_entry
;
292 struct qeth_arp_query_data query_arp
;
295 } __attribute__ ((packed
));
298 /* SETRTG IPA Command: ****************************************************/
299 struct qeth_set_routing
{
303 /* SETADAPTERPARMS IPA Command: *******************************************/
304 struct qeth_query_cmds_supp
{
305 __u32 no_lantypes_supp
;
308 __u32 supported_cmds
;
310 } __attribute__ ((packed
));
312 struct qeth_change_addr
{
316 __u8 addr
[OSA_ADDR_LEN
];
317 } __attribute__ ((packed
));
320 struct qeth_snmp_cmd
{
328 } __attribute__ ((packed
));
330 struct qeth_snmp_ureq_hdr
{
335 } __attribute__ ((packed
));
337 struct qeth_snmp_ureq
{
338 struct qeth_snmp_ureq_hdr hdr
;
339 struct qeth_snmp_cmd cmd
;
340 } __attribute__((packed
));
342 struct qeth_ipacmd_setadpparms_hdr
{
352 } __attribute__ ((packed
));
354 struct qeth_ipacmd_setadpparms
{
355 struct qeth_ipacmd_setadpparms_hdr hdr
;
357 struct qeth_query_cmds_supp query_cmds_supp
;
358 struct qeth_change_addr change_addr
;
359 struct qeth_snmp_cmd snmp
;
362 } __attribute__ ((packed
));
364 /* IPFRAME IPA Command: ***************************************************/
365 /* TODO: define in analogy to commands define above */
367 /* ADD_ADDR_ENTRY IPA Command: ********************************************/
368 /* TODO: define in analogy to commands define above */
370 /* DELETE_ADDR_ENTRY IPA Command: *****************************************/
371 /* TODO: define in analogy to commands define above */
373 /* CREATE_ADDR IPA Command: ***********************************************/
374 struct qeth_create_destroy_address
{
376 } __attribute__ ((packed
));
378 /* REGISTER_LOCAL_ADDR IPA Command: ***************************************/
379 /* TODO: define in analogy to commands define above */
381 /* UNREGISTER_LOCAL_ADDR IPA Command: *************************************/
382 /* TODO: define in analogy to commands define above */
384 /* Header for each IPA command */
385 struct qeth_ipacmd_hdr
{
392 __u8 prim_version_no
;
397 } __attribute__ ((packed
));
399 /* The IPA command itself */
400 struct qeth_ipa_cmd
{
401 struct qeth_ipacmd_hdr hdr
;
403 struct qeth_ipacmd_setdelip4 setdelip4
;
404 struct qeth_ipacmd_setdelip6 setdelip6
;
405 struct qeth_ipacmd_setdelipm setdelipm
;
406 struct qeth_ipacmd_setassparms setassparms
;
407 struct qeth_ipacmd_layer2setdelmac setdelmac
;
408 struct qeth_ipacmd_layer2setdelvlan setdelvlan
;
409 struct qeth_create_destroy_address create_destroy_addr
;
410 struct qeth_ipacmd_setadpparms setadapterparms
;
411 struct qeth_set_routing setrtg
;
413 } __attribute__ ((packed
));
416 * special command for ARP processing.
417 * this is not included in setassparms command before, because we get
418 * problem with the size of struct qeth_ipacmd_setassparms otherwise
420 enum qeth_ipa_arp_return_codes
{
421 QETH_IPA_ARP_RC_SUCCESS
= 0x0000,
422 QETH_IPA_ARP_RC_FAILED
= 0x0001,
423 QETH_IPA_ARP_RC_NOTSUPP
= 0x0002,
424 QETH_IPA_ARP_RC_OUT_OF_RANGE
= 0x0003,
425 QETH_IPA_ARP_RC_Q_NOTSUPP
= 0x0004,
426 QETH_IPA_ARP_RC_Q_NO_DATA
= 0x0008,
429 #define QETH_SETASS_BASE_LEN (sizeof(struct qeth_ipacmd_hdr) + \
430 sizeof(struct qeth_ipacmd_setassparms_hdr))
431 #define QETH_IPA_ARP_DATA_POS(buffer) (buffer + IPA_PDU_HEADER_SIZE + \
432 QETH_SETASS_BASE_LEN)
433 #define QETH_SETADP_BASE_LEN (sizeof(struct qeth_ipacmd_hdr) + \
434 sizeof(struct qeth_ipacmd_setadpparms_hdr))
435 #define QETH_SNMP_SETADP_CMDLENGTH 16
437 #define QETH_ARP_DATA_SIZE 3968
438 #define QETH_ARP_CMD_LEN (QETH_ARP_DATA_SIZE + 8)
439 /* Helper functions */
440 #define IS_IPA_REPLY(cmd) (cmd->hdr.initiator == IPA_CMD_INITIATOR_HOST)
442 /*****************************************************************************/
443 /* END OF IP Assist related definitions */
444 /*****************************************************************************/
447 extern unsigned char WRITE_CCW
[];
448 extern unsigned char READ_CCW
[];
450 extern unsigned char CM_ENABLE
[];
451 #define CM_ENABLE_SIZE 0x63
452 #define QETH_CM_ENABLE_ISSUER_RM_TOKEN(buffer) (buffer+0x2c)
453 #define QETH_CM_ENABLE_FILTER_TOKEN(buffer) (buffer+0x53)
454 #define QETH_CM_ENABLE_USER_DATA(buffer) (buffer+0x5b)
456 #define QETH_CM_ENABLE_RESP_FILTER_TOKEN(buffer) \
457 (PDU_ENCAPSULATION(buffer)+ 0x13)
460 extern unsigned char CM_SETUP
[];
461 #define CM_SETUP_SIZE 0x64
462 #define QETH_CM_SETUP_DEST_ADDR(buffer) (buffer+0x2c)
463 #define QETH_CM_SETUP_CONNECTION_TOKEN(buffer) (buffer+0x51)
464 #define QETH_CM_SETUP_FILTER_TOKEN(buffer) (buffer+0x5a)
466 #define QETH_CM_SETUP_RESP_DEST_ADDR(buffer) \
467 (PDU_ENCAPSULATION(buffer) + 0x1a)
469 extern unsigned char ULP_ENABLE
[];
470 #define ULP_ENABLE_SIZE 0x6b
471 #define QETH_ULP_ENABLE_LINKNUM(buffer) (buffer+0x61)
472 #define QETH_ULP_ENABLE_DEST_ADDR(buffer) (buffer+0x2c)
473 #define QETH_ULP_ENABLE_FILTER_TOKEN(buffer) (buffer+0x53)
474 #define QETH_ULP_ENABLE_PORTNAME_AND_LL(buffer) (buffer+0x62)
475 #define QETH_ULP_ENABLE_RESP_FILTER_TOKEN(buffer) \
476 (PDU_ENCAPSULATION(buffer) + 0x13)
477 #define QETH_ULP_ENABLE_RESP_MAX_MTU(buffer) \
478 (PDU_ENCAPSULATION(buffer)+ 0x1f)
479 #define QETH_ULP_ENABLE_RESP_DIFINFO_LEN(buffer) \
480 (PDU_ENCAPSULATION(buffer) + 0x17)
481 #define QETH_ULP_ENABLE_RESP_LINK_TYPE(buffer) \
482 (PDU_ENCAPSULATION(buffer)+ 0x2b)
483 /* Layer 2 defintions */
484 #define QETH_PROT_LAYER2 0x08
485 #define QETH_PROT_TCPIP 0x03
486 #define QETH_ULP_ENABLE_PROT_TYPE(buffer) (buffer+0x50)
487 #define QETH_IPA_CMD_PROT_TYPE(buffer) (buffer+0x19)
489 extern unsigned char ULP_SETUP
[];
490 #define ULP_SETUP_SIZE 0x6c
491 #define QETH_ULP_SETUP_DEST_ADDR(buffer) (buffer+0x2c)
492 #define QETH_ULP_SETUP_CONNECTION_TOKEN(buffer) (buffer+0x51)
493 #define QETH_ULP_SETUP_FILTER_TOKEN(buffer) (buffer+0x5a)
494 #define QETH_ULP_SETUP_CUA(buffer) (buffer+0x68)
495 #define QETH_ULP_SETUP_REAL_DEVADDR(buffer) (buffer+0x6a)
497 #define QETH_ULP_SETUP_RESP_CONNECTION_TOKEN(buffer) \
498 (PDU_ENCAPSULATION(buffer)+0x1a)
501 extern unsigned char DM_ACT
[];
502 #define DM_ACT_SIZE 0x55
503 #define QETH_DM_ACT_DEST_ADDR(buffer) (buffer+0x2c)
504 #define QETH_DM_ACT_CONNECTION_TOKEN(buffer) (buffer+0x51)
508 #define QETH_TRANSPORT_HEADER_SEQ_NO(buffer) (buffer+4)
509 #define QETH_PDU_HEADER_SEQ_NO(buffer) (buffer+0x1c)
510 #define QETH_PDU_HEADER_ACK_SEQ_NO(buffer) (buffer+0x20)
512 extern unsigned char IDX_ACTIVATE_READ
[];
513 extern unsigned char IDX_ACTIVATE_WRITE
[];
515 #define IDX_ACTIVATE_SIZE 0x22
516 #define QETH_IDX_ACT_ISSUER_RM_TOKEN(buffer) (buffer+0x0c)
517 #define QETH_IDX_NO_PORTNAME_REQUIRED(buffer) ((buffer)[0x0b]&0x80)
518 #define QETH_IDX_ACT_FUNC_LEVEL(buffer) (buffer+0x10)
519 #define QETH_IDX_ACT_DATASET_NAME(buffer) (buffer+0x16)
520 #define QETH_IDX_ACT_QDIO_DEV_CUA(buffer) (buffer+0x1e)
521 #define QETH_IDX_ACT_QDIO_DEV_REALADDR(buffer) (buffer+0x20)
522 #define QETH_IS_IDX_ACT_POS_REPLY(buffer) (((buffer)[0x08]&3)==2)
523 #define QETH_IDX_REPLY_LEVEL(buffer) (buffer+0x12)
525 #define PDU_ENCAPSULATION(buffer) \
526 (buffer + *(buffer + (*(buffer+0x0b)) + \
527 *(buffer + *(buffer+0x0b)+0x11) +0x07))
529 #define IS_IPA(buffer) \
531 ( *(buffer + ((*(buffer+0x0b))+4) )==0xc1) )
533 #define ADDR_FRAME_TYPE_DIX 1
534 #define ADDR_FRAME_TYPE_802_3 2
535 #define ADDR_FRAME_TYPE_TR_WITHOUT_SR 0x10
536 #define ADDR_FRAME_TYPE_TR_WITH_SR 0x20