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 <fpavlic@de.ibm.com>
12 #ifndef __QETH_MPC_H__
13 #define __QETH_MPC_H__
17 #define VERSION_QETH_MPC_H "$Revision: 1.46 $"
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+0x29)
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_OSA 0x01
50 #define IPA_CMD_INITIATOR_HOST_REPLY 0x80
51 #define IPA_CMD_INITIATOR_OSA_REPLY 0x81
52 #define IPA_CMD_PRIM_VERSION_NO 0x01
54 enum qeth_card_types
{
55 QETH_CARD_TYPE_UNKNOWN
= 0,
56 QETH_CARD_TYPE_OSAE
= 10,
57 QETH_CARD_TYPE_IQD
= 1234,
58 QETH_CARD_TYPE_OSN
= 11,
61 #define QETH_MPC_DIFINFO_LEN_INDICATES_LINK_TYPE 0x18
62 /* only the first two bytes are looked at in qeth_get_cardname_short */
63 enum qeth_link_types
{
64 QETH_LINK_TYPE_FAST_ETH
= 0x01,
65 QETH_LINK_TYPE_HSTR
= 0x02,
66 QETH_LINK_TYPE_GBIT_ETH
= 0x03,
67 QETH_LINK_TYPE_OSN
= 0x04,
68 QETH_LINK_TYPE_10GBIT_ETH
= 0x10,
69 QETH_LINK_TYPE_LANE_ETH100
= 0x81,
70 QETH_LINK_TYPE_LANE_TR
= 0x82,
71 QETH_LINK_TYPE_LANE_ETH1000
= 0x83,
72 QETH_LINK_TYPE_LANE
= 0x88,
73 QETH_LINK_TYPE_ATM_NATIVE
= 0x90,
76 enum qeth_tr_macaddr_modes
{
77 QETH_TR_MACADDR_NONCANONICAL
= 0,
78 QETH_TR_MACADDR_CANONICAL
= 1,
81 enum qeth_tr_broadcast_modes
{
82 QETH_TR_BROADCAST_ALLRINGS
= 0,
83 QETH_TR_BROADCAST_LOCAL
= 1,
86 /* these values match CHECKSUM_* in include/linux/skbuff.h */
87 enum qeth_checksum_types
{
88 SW_CHECKSUMMING
= 0, /* TODO: set to bit flag used in IPA Command */
92 #define QETH_CHECKSUM_DEFAULT SW_CHECKSUMMING
97 #define RESET_ROUTING_FLAG 0x10 /* indicate that routing type shall be set */
98 enum qeth_routing_types
{
99 NO_ROUTER
= 0, /* TODO: set to bit flag used in IPA Command */
101 SECONDARY_ROUTER
= 2,
102 MULTICAST_ROUTER
= 3,
103 PRIMARY_CONNECTOR
= 4,
104 SECONDARY_CONNECTOR
= 5,
110 IPA_CMD_STARTLAN
= 0x01,
111 IPA_CMD_STOPLAN
= 0x02,
112 IPA_CMD_SETVMAC
= 0x21,
113 IPA_CMD_DELVMAC
= 0x22,
114 IPA_CMD_SETGMAC
= 0x23,
115 IPA_CMD_DELGMAC
= 0x24,
116 IPA_CMD_SETVLAN
= 0x25,
117 IPA_CMD_DELVLAN
= 0x26,
118 IPA_CMD_SETCCID
= 0x41,
119 IPA_CMD_DELCCID
= 0x42,
120 IPA_CMD_MODCCID
= 0x43,
121 IPA_CMD_SETIP
= 0xb1,
122 IPA_CMD_DELIP
= 0xb7,
123 IPA_CMD_QIPASSIST
= 0xb2,
124 IPA_CMD_SETASSPARMS
= 0xb3,
125 IPA_CMD_SETIPM
= 0xb4,
126 IPA_CMD_DELIPM
= 0xb5,
127 IPA_CMD_SETRTG
= 0xb6,
128 IPA_CMD_SETADAPTERPARMS
= 0xb8,
129 IPA_CMD_IPFRAME
= 0xb9,
130 IPA_CMD_ADD_ADDR_ENTRY
= 0xc1,
131 IPA_CMD_DELETE_ADDR_ENTRY
= 0xc2,
132 IPA_CMD_CREATE_ADDR
= 0xc3,
133 IPA_CMD_DESTROY_ADDR
= 0xc4,
134 IPA_CMD_REGISTER_LOCAL_ADDR
= 0xd1,
135 IPA_CMD_UNREGISTER_LOCAL_ADDR
= 0xd2,
138 enum qeth_ip_ass_cmds
{
139 IPA_CMD_ASS_START
= 0x0001,
140 IPA_CMD_ASS_STOP
= 0x0002,
141 IPA_CMD_ASS_CONFIGURE
= 0x0003,
142 IPA_CMD_ASS_ENABLE
= 0x0004,
145 enum qeth_arp_process_subcmds
{
146 IPA_CMD_ASS_ARP_SET_NO_ENTRIES
= 0x0003,
147 IPA_CMD_ASS_ARP_QUERY_CACHE
= 0x0004,
148 IPA_CMD_ASS_ARP_ADD_ENTRY
= 0x0005,
149 IPA_CMD_ASS_ARP_REMOVE_ENTRY
= 0x0006,
150 IPA_CMD_ASS_ARP_FLUSH_CACHE
= 0x0007,
151 IPA_CMD_ASS_ARP_QUERY_INFO
= 0x0104,
152 IPA_CMD_ASS_ARP_QUERY_STATS
= 0x0204,
155 /* Return Codes for IPA Commands */
156 enum qeth_ipa_return_codes
{
157 IPA_RC_SUCCESS
= 0x0000,
158 IPA_RC_NOTSUPP
= 0x0001,
159 IPA_RC_NO_ACCESS
= 0x0002,
160 IPA_RC_FAILED
= 0x0003,
161 IPA_RC_DATA_MISMATCH
= 0xe001,
162 IPA_RC_INVALID_LAN_TYPE
= 0xe003,
163 IPA_RC_INVALID_LAN_NO
= 0xe004,
164 IPA_RC_IPADDR_ALREADY_REG
= 0xe005,
165 IPA_RC_IPADDR_TABLE_FULL
= 0xe006,
166 IPA_RC_IPADDR_ALREADY_USED
= 0xe00a,
167 IPA_RC_ASSNO_NOT_SUPP
= 0xe00d,
168 IPA_RC_ASSCMD_START_FAILED
= 0xe00e,
169 IPA_RC_ASSCMD_PART_SUCCESS
= 0xe00f,
170 IPA_RC_IPADDR_NOT_DEFINED
= 0xe010,
171 IPA_RC_LAN_OFFLINE
= 0xe080,
174 /* IPA function flags; each flag marks availability of respective function */
175 enum qeth_ipa_funcs
{
176 IPA_ARP_PROCESSING
= 0x00000001L
,
177 IPA_INBOUND_CHECKSUM
= 0x00000002L
,
178 IPA_OUTBOUND_CHECKSUM
= 0x00000004L
,
179 IPA_IP_FRAGMENTATION
= 0x00000008L
,
180 IPA_FILTERING
= 0x00000010L
,
181 IPA_IPV6
= 0x00000020L
,
182 IPA_MULTICASTING
= 0x00000040L
,
183 IPA_IP_REASSEMBLY
= 0x00000080L
,
184 IPA_QUERY_ARP_COUNTERS
= 0x00000100L
,
185 IPA_QUERY_ARP_ADDR_INFO
= 0x00000200L
,
186 IPA_SETADAPTERPARMS
= 0x00000400L
,
187 IPA_VLAN_PRIO
= 0x00000800L
,
188 IPA_PASSTHRU
= 0x00001000L
,
189 IPA_FULL_VLAN
= 0x00004000L
,
190 IPA_SOURCE_MAC
= 0x00010000L
,
191 IPA_OSA_MC_ROUTER
= 0x00020000L
,
192 IPA_QUERY_ARP_ASSIST
= 0x00040000L
,
193 IPA_INBOUND_TSO
= 0x00080000L
,
194 IPA_OUTBOUND_TSO
= 0x00100000L
,
197 /* SETIP/DELIP IPA Command: ***************************************************/
198 enum qeth_ipa_setdelip_flags
{
199 QETH_IPA_SETDELIP_DEFAULT
= 0x00L
, /* default */
200 QETH_IPA_SETIP_VIPA_FLAG
= 0x01L
, /* no grat. ARP */
201 QETH_IPA_SETIP_TAKEOVER_FLAG
= 0x02L
, /* nofail on grat. ARP */
202 QETH_IPA_DELIP_ADDR_2_B_TAKEN_OVER
= 0x20L
,
203 QETH_IPA_DELIP_VIPA_FLAG
= 0x40L
,
204 QETH_IPA_DELIP_ADDR_NEEDS_SETIP
= 0x80L
,
207 /* SETADAPTER IPA Command: ****************************************************/
208 enum qeth_ipa_setadp_cmd
{
209 IPA_SETADP_QUERY_COMMANDS_SUPPORTED
= 0x01,
210 IPA_SETADP_ALTER_MAC_ADDRESS
= 0x02,
211 IPA_SETADP_ADD_DELETE_GROUP_ADDRESS
= 0x04,
212 IPA_SETADP_ADD_DELETE_FUNCTIONAL_ADDR
= 0x08,
213 IPA_SETADP_SET_ADDRESSING_MODE
= 0x10,
214 IPA_SETADP_SET_CONFIG_PARMS
= 0x20,
215 IPA_SETADP_SET_CONFIG_PARMS_EXTENDED
= 0x40,
216 IPA_SETADP_SET_BROADCAST_MODE
= 0x80,
217 IPA_SETADP_SEND_OSA_MESSAGE
= 0x0100,
218 IPA_SETADP_SET_SNMP_CONTROL
= 0x0200,
219 IPA_SETADP_READ_SNMP_PARMS
= 0x0400,
220 IPA_SETADP_SET_PROMISC_MODE
= 0x0800,
221 IPA_SETADP_QUERY_CARD_INFO
= 0x1000,
223 enum qeth_ipa_mac_ops
{
224 CHANGE_ADDR_READ_MAC
= 0,
225 CHANGE_ADDR_REPLACE_MAC
= 1,
226 CHANGE_ADDR_ADD_MAC
= 2,
227 CHANGE_ADDR_DEL_MAC
= 4,
228 CHANGE_ADDR_RESET_MAC
= 8,
230 enum qeth_ipa_addr_ops
{
231 CHANGE_ADDR_READ_ADDR
= 0,
232 CHANGE_ADDR_ADD_ADDR
= 1,
233 CHANGE_ADDR_DEL_ADDR
= 2,
234 CHANGE_ADDR_FLUSH_ADDR_TABLE
= 4,
236 enum qeth_ipa_promisc_modes
{
237 SET_PROMISC_MODE_OFF
= 0,
238 SET_PROMISC_MODE_ON
= 1,
241 /* (SET)DELIP(M) IPA stuff ***************************************************/
242 struct qeth_ipacmd_setdelip4
{
246 } __attribute__ ((packed
));
248 struct qeth_ipacmd_setdelip6
{
252 } __attribute__ ((packed
));
254 struct qeth_ipacmd_setdelipm
{
259 } __attribute__ ((packed
));
261 struct qeth_ipacmd_layer2setdelmac
{
264 } __attribute__ ((packed
));
266 struct qeth_ipacmd_layer2setdelvlan
{
268 } __attribute__ ((packed
));
271 struct qeth_ipacmd_setassparms_hdr
{
276 __u8 number_of_replies
;
278 } __attribute__((packed
));
280 struct qeth_arp_query_data
{
285 } __attribute__((packed
));
287 /* used as parameter for arp_query reply */
288 struct qeth_arp_query_info
{
296 /* SETASSPARMS IPA Command: */
297 struct qeth_ipacmd_setassparms
{
298 struct qeth_ipacmd_setassparms_hdr hdr
;
301 struct qeth_arp_cache_entry add_arp_entry
;
302 struct qeth_arp_query_data query_arp
;
305 } __attribute__ ((packed
));
308 /* SETRTG IPA Command: ****************************************************/
309 struct qeth_set_routing
{
313 /* SETADAPTERPARMS IPA Command: *******************************************/
314 struct qeth_query_cmds_supp
{
315 __u32 no_lantypes_supp
;
318 __u32 supported_cmds
;
320 } __attribute__ ((packed
));
322 struct qeth_change_addr
{
326 __u8 addr
[OSA_ADDR_LEN
];
327 } __attribute__ ((packed
));
330 struct qeth_snmp_cmd
{
338 } __attribute__ ((packed
));
340 struct qeth_snmp_ureq_hdr
{
345 } __attribute__ ((packed
));
347 struct qeth_snmp_ureq
{
348 struct qeth_snmp_ureq_hdr hdr
;
349 struct qeth_snmp_cmd cmd
;
350 } __attribute__((packed
));
352 struct qeth_ipacmd_setadpparms_hdr
{
362 } __attribute__ ((packed
));
364 struct qeth_ipacmd_setadpparms
{
365 struct qeth_ipacmd_setadpparms_hdr hdr
;
367 struct qeth_query_cmds_supp query_cmds_supp
;
368 struct qeth_change_addr change_addr
;
369 struct qeth_snmp_cmd snmp
;
372 } __attribute__ ((packed
));
374 /* IPFRAME IPA Command: ***************************************************/
375 /* TODO: define in analogy to commands define above */
377 /* ADD_ADDR_ENTRY IPA Command: ********************************************/
378 /* TODO: define in analogy to commands define above */
380 /* DELETE_ADDR_ENTRY IPA Command: *****************************************/
381 /* TODO: define in analogy to commands define above */
383 /* CREATE_ADDR IPA Command: ***********************************************/
384 struct qeth_create_destroy_address
{
386 } __attribute__ ((packed
));
388 /* REGISTER_LOCAL_ADDR IPA Command: ***************************************/
389 /* TODO: define in analogy to commands define above */
391 /* UNREGISTER_LOCAL_ADDR IPA Command: *************************************/
392 /* TODO: define in analogy to commands define above */
394 /* Header for each IPA command */
395 struct qeth_ipacmd_hdr
{
402 __u8 prim_version_no
;
407 } __attribute__ ((packed
));
409 /* The IPA command itself */
410 struct qeth_ipa_cmd
{
411 struct qeth_ipacmd_hdr hdr
;
413 struct qeth_ipacmd_setdelip4 setdelip4
;
414 struct qeth_ipacmd_setdelip6 setdelip6
;
415 struct qeth_ipacmd_setdelipm setdelipm
;
416 struct qeth_ipacmd_setassparms setassparms
;
417 struct qeth_ipacmd_layer2setdelmac setdelmac
;
418 struct qeth_ipacmd_layer2setdelvlan setdelvlan
;
419 struct qeth_create_destroy_address create_destroy_addr
;
420 struct qeth_ipacmd_setadpparms setadapterparms
;
421 struct qeth_set_routing setrtg
;
423 } __attribute__ ((packed
));
426 * special command for ARP processing.
427 * this is not included in setassparms command before, because we get
428 * problem with the size of struct qeth_ipacmd_setassparms otherwise
430 enum qeth_ipa_arp_return_codes
{
431 QETH_IPA_ARP_RC_SUCCESS
= 0x0000,
432 QETH_IPA_ARP_RC_FAILED
= 0x0001,
433 QETH_IPA_ARP_RC_NOTSUPP
= 0x0002,
434 QETH_IPA_ARP_RC_OUT_OF_RANGE
= 0x0003,
435 QETH_IPA_ARP_RC_Q_NOTSUPP
= 0x0004,
436 QETH_IPA_ARP_RC_Q_NO_DATA
= 0x0008,
439 #define QETH_SETASS_BASE_LEN (sizeof(struct qeth_ipacmd_hdr) + \
440 sizeof(struct qeth_ipacmd_setassparms_hdr))
441 #define QETH_IPA_ARP_DATA_POS(buffer) (buffer + IPA_PDU_HEADER_SIZE + \
442 QETH_SETASS_BASE_LEN)
443 #define QETH_SETADP_BASE_LEN (sizeof(struct qeth_ipacmd_hdr) + \
444 sizeof(struct qeth_ipacmd_setadpparms_hdr))
445 #define QETH_SNMP_SETADP_CMDLENGTH 16
447 #define QETH_ARP_DATA_SIZE 3968
448 #define QETH_ARP_CMD_LEN (QETH_ARP_DATA_SIZE + 8)
449 /* Helper functions */
450 #define IS_IPA_REPLY(cmd) ((cmd->hdr.initiator == IPA_CMD_INITIATOR_HOST) || \
451 (cmd->hdr.initiator == IPA_CMD_INITIATOR_OSA_REPLY))
453 /*****************************************************************************/
454 /* END OF IP Assist related definitions */
455 /*****************************************************************************/
458 extern unsigned char WRITE_CCW
[];
459 extern unsigned char READ_CCW
[];
461 extern unsigned char CM_ENABLE
[];
462 #define CM_ENABLE_SIZE 0x63
463 #define QETH_CM_ENABLE_ISSUER_RM_TOKEN(buffer) (buffer+0x2c)
464 #define QETH_CM_ENABLE_FILTER_TOKEN(buffer) (buffer+0x53)
465 #define QETH_CM_ENABLE_USER_DATA(buffer) (buffer+0x5b)
467 #define QETH_CM_ENABLE_RESP_FILTER_TOKEN(buffer) \
468 (PDU_ENCAPSULATION(buffer)+ 0x13)
471 extern unsigned char CM_SETUP
[];
472 #define CM_SETUP_SIZE 0x64
473 #define QETH_CM_SETUP_DEST_ADDR(buffer) (buffer+0x2c)
474 #define QETH_CM_SETUP_CONNECTION_TOKEN(buffer) (buffer+0x51)
475 #define QETH_CM_SETUP_FILTER_TOKEN(buffer) (buffer+0x5a)
477 #define QETH_CM_SETUP_RESP_DEST_ADDR(buffer) \
478 (PDU_ENCAPSULATION(buffer) + 0x1a)
480 extern unsigned char ULP_ENABLE
[];
481 #define ULP_ENABLE_SIZE 0x6b
482 #define QETH_ULP_ENABLE_LINKNUM(buffer) (buffer+0x61)
483 #define QETH_ULP_ENABLE_DEST_ADDR(buffer) (buffer+0x2c)
484 #define QETH_ULP_ENABLE_FILTER_TOKEN(buffer) (buffer+0x53)
485 #define QETH_ULP_ENABLE_PORTNAME_AND_LL(buffer) (buffer+0x62)
486 #define QETH_ULP_ENABLE_RESP_FILTER_TOKEN(buffer) \
487 (PDU_ENCAPSULATION(buffer) + 0x13)
488 #define QETH_ULP_ENABLE_RESP_MAX_MTU(buffer) \
489 (PDU_ENCAPSULATION(buffer)+ 0x1f)
490 #define QETH_ULP_ENABLE_RESP_DIFINFO_LEN(buffer) \
491 (PDU_ENCAPSULATION(buffer) + 0x17)
492 #define QETH_ULP_ENABLE_RESP_LINK_TYPE(buffer) \
493 (PDU_ENCAPSULATION(buffer)+ 0x2b)
494 /* Layer 2 defintions */
495 #define QETH_PROT_LAYER2 0x08
496 #define QETH_PROT_TCPIP 0x03
497 #define QETH_PROT_OSN2 0x0a
498 #define QETH_ULP_ENABLE_PROT_TYPE(buffer) (buffer+0x50)
499 #define QETH_IPA_CMD_PROT_TYPE(buffer) (buffer+0x19)
501 extern unsigned char ULP_SETUP
[];
502 #define ULP_SETUP_SIZE 0x6c
503 #define QETH_ULP_SETUP_DEST_ADDR(buffer) (buffer+0x2c)
504 #define QETH_ULP_SETUP_CONNECTION_TOKEN(buffer) (buffer+0x51)
505 #define QETH_ULP_SETUP_FILTER_TOKEN(buffer) (buffer+0x5a)
506 #define QETH_ULP_SETUP_CUA(buffer) (buffer+0x68)
507 #define QETH_ULP_SETUP_REAL_DEVADDR(buffer) (buffer+0x6a)
509 #define QETH_ULP_SETUP_RESP_CONNECTION_TOKEN(buffer) \
510 (PDU_ENCAPSULATION(buffer)+0x1a)
513 extern unsigned char DM_ACT
[];
514 #define DM_ACT_SIZE 0x55
515 #define QETH_DM_ACT_DEST_ADDR(buffer) (buffer+0x2c)
516 #define QETH_DM_ACT_CONNECTION_TOKEN(buffer) (buffer+0x51)
520 #define QETH_TRANSPORT_HEADER_SEQ_NO(buffer) (buffer+4)
521 #define QETH_PDU_HEADER_SEQ_NO(buffer) (buffer+0x1c)
522 #define QETH_PDU_HEADER_ACK_SEQ_NO(buffer) (buffer+0x20)
524 extern unsigned char IDX_ACTIVATE_READ
[];
525 extern unsigned char IDX_ACTIVATE_WRITE
[];
527 #define IDX_ACTIVATE_SIZE 0x22
528 #define QETH_IDX_ACT_ISSUER_RM_TOKEN(buffer) (buffer+0x0c)
529 #define QETH_IDX_NO_PORTNAME_REQUIRED(buffer) ((buffer)[0x0b]&0x80)
530 #define QETH_IDX_ACT_FUNC_LEVEL(buffer) (buffer+0x10)
531 #define QETH_IDX_ACT_DATASET_NAME(buffer) (buffer+0x16)
532 #define QETH_IDX_ACT_QDIO_DEV_CUA(buffer) (buffer+0x1e)
533 #define QETH_IDX_ACT_QDIO_DEV_REALADDR(buffer) (buffer+0x20)
534 #define QETH_IS_IDX_ACT_POS_REPLY(buffer) (((buffer)[0x08]&3)==2)
535 #define QETH_IDX_REPLY_LEVEL(buffer) (buffer+0x12)
537 #define PDU_ENCAPSULATION(buffer) \
538 (buffer + *(buffer + (*(buffer+0x0b)) + \
539 *(buffer + *(buffer+0x0b)+0x11) +0x07))
541 #define IS_IPA(buffer) \
543 ( *(buffer + ((*(buffer+0x0b))+4) )==0xc1) )
545 #define ADDR_FRAME_TYPE_DIX 1
546 #define ADDR_FRAME_TYPE_802_3 2
547 #define ADDR_FRAME_TYPE_TR_WITHOUT_SR 0x10
548 #define ADDR_FRAME_TYPE_TR_WITH_SR 0x20