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 IPA_PDU_HEADER_SIZE 0x40
18 #define QETH_IPA_PDU_LEN_TOTAL(buffer) (buffer+0x0e)
19 #define QETH_IPA_PDU_LEN_PDU1(buffer) (buffer+0x26)
20 #define QETH_IPA_PDU_LEN_PDU2(buffer) (buffer+0x29)
21 #define QETH_IPA_PDU_LEN_PDU3(buffer) (buffer+0x3a)
23 extern unsigned char IPA_PDU_HEADER
[];
24 #define QETH_IPA_CMD_DEST_ADDR(buffer) (buffer+0x2c)
26 #define IPA_CMD_LENGTH (IPA_PDU_HEADER_SIZE + sizeof(struct qeth_ipa_cmd))
28 #define QETH_SEQ_NO_LENGTH 4
29 #define QETH_MPC_TOKEN_LENGTH 4
30 #define QETH_MCL_LENGTH 4
31 #define OSA_ADDR_LEN 6
33 #define QETH_TIMEOUT (10 * HZ)
34 #define QETH_IPA_TIMEOUT (45 * HZ)
35 #define QETH_IDX_COMMAND_SEQNO 0xffff0000
36 #define SR_INFO_LEN 16
38 #define QETH_CLEAR_CHANNEL_PARM -10
39 #define QETH_HALT_CHANNEL_PARM -11
41 /*****************************************************************************/
42 /* IP Assist related definitions */
43 /*****************************************************************************/
44 #define IPA_CMD_INITIATOR_HOST 0x00
45 #define IPA_CMD_INITIATOR_OSA 0x01
46 #define IPA_CMD_INITIATOR_HOST_REPLY 0x80
47 #define IPA_CMD_INITIATOR_OSA_REPLY 0x81
48 #define IPA_CMD_PRIM_VERSION_NO 0x01
50 enum qeth_card_types
{
51 QETH_CARD_TYPE_UNKNOWN
= 0,
52 QETH_CARD_TYPE_OSAE
= 10,
53 QETH_CARD_TYPE_IQD
= 1234,
54 QETH_CARD_TYPE_OSN
= 11,
57 #define QETH_MPC_DIFINFO_LEN_INDICATES_LINK_TYPE 0x18
58 /* only the first two bytes are looked at in qeth_get_cardname_short */
59 enum qeth_link_types
{
60 QETH_LINK_TYPE_FAST_ETH
= 0x01,
61 QETH_LINK_TYPE_HSTR
= 0x02,
62 QETH_LINK_TYPE_GBIT_ETH
= 0x03,
63 QETH_LINK_TYPE_OSN
= 0x04,
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_SETCCID
= 0x41,
115 IPA_CMD_DELCCID
= 0x42,
116 IPA_CMD_MODCCID
= 0x43,
117 IPA_CMD_SETIP
= 0xb1,
118 IPA_CMD_DELIP
= 0xb7,
119 IPA_CMD_QIPASSIST
= 0xb2,
120 IPA_CMD_SETASSPARMS
= 0xb3,
121 IPA_CMD_SETIPM
= 0xb4,
122 IPA_CMD_DELIPM
= 0xb5,
123 IPA_CMD_SETRTG
= 0xb6,
124 IPA_CMD_SETADAPTERPARMS
= 0xb8,
125 IPA_CMD_IPFRAME
= 0xb9,
126 IPA_CMD_ADD_ADDR_ENTRY
= 0xc1,
127 IPA_CMD_DELETE_ADDR_ENTRY
= 0xc2,
128 IPA_CMD_CREATE_ADDR
= 0xc3,
129 IPA_CMD_DESTROY_ADDR
= 0xc4,
130 IPA_CMD_REGISTER_LOCAL_ADDR
= 0xd1,
131 IPA_CMD_UNREGISTER_LOCAL_ADDR
= 0xd2,
134 enum qeth_ip_ass_cmds
{
135 IPA_CMD_ASS_START
= 0x0001,
136 IPA_CMD_ASS_STOP
= 0x0002,
137 IPA_CMD_ASS_CONFIGURE
= 0x0003,
138 IPA_CMD_ASS_ENABLE
= 0x0004,
141 enum qeth_arp_process_subcmds
{
142 IPA_CMD_ASS_ARP_SET_NO_ENTRIES
= 0x0003,
143 IPA_CMD_ASS_ARP_QUERY_CACHE
= 0x0004,
144 IPA_CMD_ASS_ARP_ADD_ENTRY
= 0x0005,
145 IPA_CMD_ASS_ARP_REMOVE_ENTRY
= 0x0006,
146 IPA_CMD_ASS_ARP_FLUSH_CACHE
= 0x0007,
147 IPA_CMD_ASS_ARP_QUERY_INFO
= 0x0104,
148 IPA_CMD_ASS_ARP_QUERY_STATS
= 0x0204,
151 /* Return Codes for IPA Commands */
152 enum qeth_ipa_return_codes
{
153 IPA_RC_SUCCESS
= 0x0000,
154 IPA_RC_NOTSUPP
= 0x0001,
155 IPA_RC_NO_ACCESS
= 0x0002,
156 IPA_RC_FAILED
= 0x0003,
157 IPA_RC_DATA_MISMATCH
= 0xe001,
158 IPA_RC_INVALID_LAN_TYPE
= 0xe003,
159 IPA_RC_INVALID_LAN_NO
= 0xe004,
160 IPA_RC_IPADDR_ALREADY_REG
= 0xe005,
161 IPA_RC_IPADDR_TABLE_FULL
= 0xe006,
162 IPA_RC_IPADDR_ALREADY_USED
= 0xe00a,
163 IPA_RC_ASSNO_NOT_SUPP
= 0xe00d,
164 IPA_RC_ASSCMD_START_FAILED
= 0xe00e,
165 IPA_RC_ASSCMD_PART_SUCCESS
= 0xe00f,
166 IPA_RC_IPADDR_NOT_DEFINED
= 0xe010,
167 IPA_RC_LAN_OFFLINE
= 0xe080,
170 /* IPA function flags; each flag marks availability of respective function */
171 enum qeth_ipa_funcs
{
172 IPA_ARP_PROCESSING
= 0x00000001L
,
173 IPA_INBOUND_CHECKSUM
= 0x00000002L
,
174 IPA_OUTBOUND_CHECKSUM
= 0x00000004L
,
175 IPA_IP_FRAGMENTATION
= 0x00000008L
,
176 IPA_FILTERING
= 0x00000010L
,
177 IPA_IPV6
= 0x00000020L
,
178 IPA_MULTICASTING
= 0x00000040L
,
179 IPA_IP_REASSEMBLY
= 0x00000080L
,
180 IPA_QUERY_ARP_COUNTERS
= 0x00000100L
,
181 IPA_QUERY_ARP_ADDR_INFO
= 0x00000200L
,
182 IPA_SETADAPTERPARMS
= 0x00000400L
,
183 IPA_VLAN_PRIO
= 0x00000800L
,
184 IPA_PASSTHRU
= 0x00001000L
,
185 IPA_FULL_VLAN
= 0x00004000L
,
186 IPA_SOURCE_MAC
= 0x00010000L
,
187 IPA_OSA_MC_ROUTER
= 0x00020000L
,
188 IPA_QUERY_ARP_ASSIST
= 0x00040000L
,
189 IPA_INBOUND_TSO
= 0x00080000L
,
190 IPA_OUTBOUND_TSO
= 0x00100000L
,
193 /* SETIP/DELIP IPA Command: ***************************************************/
194 enum qeth_ipa_setdelip_flags
{
195 QETH_IPA_SETDELIP_DEFAULT
= 0x00L
, /* default */
196 QETH_IPA_SETIP_VIPA_FLAG
= 0x01L
, /* no grat. ARP */
197 QETH_IPA_SETIP_TAKEOVER_FLAG
= 0x02L
, /* nofail on grat. ARP */
198 QETH_IPA_DELIP_ADDR_2_B_TAKEN_OVER
= 0x20L
,
199 QETH_IPA_DELIP_VIPA_FLAG
= 0x40L
,
200 QETH_IPA_DELIP_ADDR_NEEDS_SETIP
= 0x80L
,
203 /* SETADAPTER IPA Command: ****************************************************/
204 enum qeth_ipa_setadp_cmd
{
205 IPA_SETADP_QUERY_COMMANDS_SUPPORTED
= 0x01,
206 IPA_SETADP_ALTER_MAC_ADDRESS
= 0x02,
207 IPA_SETADP_ADD_DELETE_GROUP_ADDRESS
= 0x04,
208 IPA_SETADP_ADD_DELETE_FUNCTIONAL_ADDR
= 0x08,
209 IPA_SETADP_SET_ADDRESSING_MODE
= 0x10,
210 IPA_SETADP_SET_CONFIG_PARMS
= 0x20,
211 IPA_SETADP_SET_CONFIG_PARMS_EXTENDED
= 0x40,
212 IPA_SETADP_SET_BROADCAST_MODE
= 0x80,
213 IPA_SETADP_SEND_OSA_MESSAGE
= 0x0100,
214 IPA_SETADP_SET_SNMP_CONTROL
= 0x0200,
215 IPA_SETADP_READ_SNMP_PARMS
= 0x0400,
216 IPA_SETADP_SET_PROMISC_MODE
= 0x0800,
217 IPA_SETADP_QUERY_CARD_INFO
= 0x1000,
219 enum qeth_ipa_mac_ops
{
220 CHANGE_ADDR_READ_MAC
= 0,
221 CHANGE_ADDR_REPLACE_MAC
= 1,
222 CHANGE_ADDR_ADD_MAC
= 2,
223 CHANGE_ADDR_DEL_MAC
= 4,
224 CHANGE_ADDR_RESET_MAC
= 8,
226 enum qeth_ipa_addr_ops
{
227 CHANGE_ADDR_READ_ADDR
= 0,
228 CHANGE_ADDR_ADD_ADDR
= 1,
229 CHANGE_ADDR_DEL_ADDR
= 2,
230 CHANGE_ADDR_FLUSH_ADDR_TABLE
= 4,
232 enum qeth_ipa_promisc_modes
{
233 SET_PROMISC_MODE_OFF
= 0,
234 SET_PROMISC_MODE_ON
= 1,
237 /* (SET)DELIP(M) IPA stuff ***************************************************/
238 struct qeth_ipacmd_setdelip4
{
242 } __attribute__ ((packed
));
244 struct qeth_ipacmd_setdelip6
{
248 } __attribute__ ((packed
));
250 struct qeth_ipacmd_setdelipm
{
255 } __attribute__ ((packed
));
257 struct qeth_ipacmd_layer2setdelmac
{
260 } __attribute__ ((packed
));
262 struct qeth_ipacmd_layer2setdelvlan
{
264 } __attribute__ ((packed
));
267 struct qeth_ipacmd_setassparms_hdr
{
272 __u8 number_of_replies
;
274 } __attribute__((packed
));
276 struct qeth_arp_query_data
{
281 } __attribute__((packed
));
283 /* used as parameter for arp_query reply */
284 struct qeth_arp_query_info
{
292 /* SETASSPARMS IPA Command: */
293 struct qeth_ipacmd_setassparms
{
294 struct qeth_ipacmd_setassparms_hdr hdr
;
297 struct qeth_arp_cache_entry add_arp_entry
;
298 struct qeth_arp_query_data query_arp
;
301 } __attribute__ ((packed
));
304 /* SETRTG IPA Command: ****************************************************/
305 struct qeth_set_routing
{
309 /* SETADAPTERPARMS IPA Command: *******************************************/
310 struct qeth_query_cmds_supp
{
311 __u32 no_lantypes_supp
;
314 __u32 supported_cmds
;
316 } __attribute__ ((packed
));
318 struct qeth_change_addr
{
322 __u8 addr
[OSA_ADDR_LEN
];
323 } __attribute__ ((packed
));
326 struct qeth_snmp_cmd
{
334 } __attribute__ ((packed
));
336 struct qeth_snmp_ureq_hdr
{
341 } __attribute__ ((packed
));
343 struct qeth_snmp_ureq
{
344 struct qeth_snmp_ureq_hdr hdr
;
345 struct qeth_snmp_cmd cmd
;
346 } __attribute__((packed
));
348 struct qeth_ipacmd_setadpparms_hdr
{
358 } __attribute__ ((packed
));
360 struct qeth_ipacmd_setadpparms
{
361 struct qeth_ipacmd_setadpparms_hdr hdr
;
363 struct qeth_query_cmds_supp query_cmds_supp
;
364 struct qeth_change_addr change_addr
;
365 struct qeth_snmp_cmd snmp
;
368 } __attribute__ ((packed
));
370 /* IPFRAME IPA Command: ***************************************************/
371 /* TODO: define in analogy to commands define above */
373 /* ADD_ADDR_ENTRY IPA Command: ********************************************/
374 /* TODO: define in analogy to commands define above */
376 /* DELETE_ADDR_ENTRY IPA Command: *****************************************/
377 /* TODO: define in analogy to commands define above */
379 /* CREATE_ADDR IPA Command: ***********************************************/
380 struct qeth_create_destroy_address
{
382 } __attribute__ ((packed
));
384 /* REGISTER_LOCAL_ADDR IPA Command: ***************************************/
385 /* TODO: define in analogy to commands define above */
387 /* UNREGISTER_LOCAL_ADDR IPA Command: *************************************/
388 /* TODO: define in analogy to commands define above */
390 /* Header for each IPA command */
391 struct qeth_ipacmd_hdr
{
398 __u8 prim_version_no
;
403 } __attribute__ ((packed
));
405 /* The IPA command itself */
406 struct qeth_ipa_cmd
{
407 struct qeth_ipacmd_hdr hdr
;
409 struct qeth_ipacmd_setdelip4 setdelip4
;
410 struct qeth_ipacmd_setdelip6 setdelip6
;
411 struct qeth_ipacmd_setdelipm setdelipm
;
412 struct qeth_ipacmd_setassparms setassparms
;
413 struct qeth_ipacmd_layer2setdelmac setdelmac
;
414 struct qeth_ipacmd_layer2setdelvlan setdelvlan
;
415 struct qeth_create_destroy_address create_destroy_addr
;
416 struct qeth_ipacmd_setadpparms setadapterparms
;
417 struct qeth_set_routing setrtg
;
419 } __attribute__ ((packed
));
422 * special command for ARP processing.
423 * this is not included in setassparms command before, because we get
424 * problem with the size of struct qeth_ipacmd_setassparms otherwise
426 enum qeth_ipa_arp_return_codes
{
427 QETH_IPA_ARP_RC_SUCCESS
= 0x0000,
428 QETH_IPA_ARP_RC_FAILED
= 0x0001,
429 QETH_IPA_ARP_RC_NOTSUPP
= 0x0002,
430 QETH_IPA_ARP_RC_OUT_OF_RANGE
= 0x0003,
431 QETH_IPA_ARP_RC_Q_NOTSUPP
= 0x0004,
432 QETH_IPA_ARP_RC_Q_NO_DATA
= 0x0008,
435 #define QETH_SETASS_BASE_LEN (sizeof(struct qeth_ipacmd_hdr) + \
436 sizeof(struct qeth_ipacmd_setassparms_hdr))
437 #define QETH_IPA_ARP_DATA_POS(buffer) (buffer + IPA_PDU_HEADER_SIZE + \
438 QETH_SETASS_BASE_LEN)
439 #define QETH_SETADP_BASE_LEN (sizeof(struct qeth_ipacmd_hdr) + \
440 sizeof(struct qeth_ipacmd_setadpparms_hdr))
441 #define QETH_SNMP_SETADP_CMDLENGTH 16
443 #define QETH_ARP_DATA_SIZE 3968
444 #define QETH_ARP_CMD_LEN (QETH_ARP_DATA_SIZE + 8)
445 /* Helper functions */
446 #define IS_IPA_REPLY(cmd) ((cmd->hdr.initiator == IPA_CMD_INITIATOR_HOST) || \
447 (cmd->hdr.initiator == IPA_CMD_INITIATOR_OSA_REPLY))
449 /*****************************************************************************/
450 /* END OF IP Assist related definitions */
451 /*****************************************************************************/
454 extern unsigned char WRITE_CCW
[];
455 extern unsigned char READ_CCW
[];
457 extern unsigned char CM_ENABLE
[];
458 #define CM_ENABLE_SIZE 0x63
459 #define QETH_CM_ENABLE_ISSUER_RM_TOKEN(buffer) (buffer+0x2c)
460 #define QETH_CM_ENABLE_FILTER_TOKEN(buffer) (buffer+0x53)
461 #define QETH_CM_ENABLE_USER_DATA(buffer) (buffer+0x5b)
463 #define QETH_CM_ENABLE_RESP_FILTER_TOKEN(buffer) \
464 (PDU_ENCAPSULATION(buffer)+ 0x13)
467 extern unsigned char CM_SETUP
[];
468 #define CM_SETUP_SIZE 0x64
469 #define QETH_CM_SETUP_DEST_ADDR(buffer) (buffer+0x2c)
470 #define QETH_CM_SETUP_CONNECTION_TOKEN(buffer) (buffer+0x51)
471 #define QETH_CM_SETUP_FILTER_TOKEN(buffer) (buffer+0x5a)
473 #define QETH_CM_SETUP_RESP_DEST_ADDR(buffer) \
474 (PDU_ENCAPSULATION(buffer) + 0x1a)
476 extern unsigned char ULP_ENABLE
[];
477 #define ULP_ENABLE_SIZE 0x6b
478 #define QETH_ULP_ENABLE_LINKNUM(buffer) (buffer+0x61)
479 #define QETH_ULP_ENABLE_DEST_ADDR(buffer) (buffer+0x2c)
480 #define QETH_ULP_ENABLE_FILTER_TOKEN(buffer) (buffer+0x53)
481 #define QETH_ULP_ENABLE_PORTNAME_AND_LL(buffer) (buffer+0x62)
482 #define QETH_ULP_ENABLE_RESP_FILTER_TOKEN(buffer) \
483 (PDU_ENCAPSULATION(buffer) + 0x13)
484 #define QETH_ULP_ENABLE_RESP_MAX_MTU(buffer) \
485 (PDU_ENCAPSULATION(buffer)+ 0x1f)
486 #define QETH_ULP_ENABLE_RESP_DIFINFO_LEN(buffer) \
487 (PDU_ENCAPSULATION(buffer) + 0x17)
488 #define QETH_ULP_ENABLE_RESP_LINK_TYPE(buffer) \
489 (PDU_ENCAPSULATION(buffer)+ 0x2b)
490 /* Layer 2 defintions */
491 #define QETH_PROT_LAYER2 0x08
492 #define QETH_PROT_TCPIP 0x03
493 #define QETH_PROT_OSN2 0x0a
494 #define QETH_ULP_ENABLE_PROT_TYPE(buffer) (buffer+0x50)
495 #define QETH_IPA_CMD_PROT_TYPE(buffer) (buffer+0x19)
497 extern unsigned char ULP_SETUP
[];
498 #define ULP_SETUP_SIZE 0x6c
499 #define QETH_ULP_SETUP_DEST_ADDR(buffer) (buffer+0x2c)
500 #define QETH_ULP_SETUP_CONNECTION_TOKEN(buffer) (buffer+0x51)
501 #define QETH_ULP_SETUP_FILTER_TOKEN(buffer) (buffer+0x5a)
502 #define QETH_ULP_SETUP_CUA(buffer) (buffer+0x68)
503 #define QETH_ULP_SETUP_REAL_DEVADDR(buffer) (buffer+0x6a)
505 #define QETH_ULP_SETUP_RESP_CONNECTION_TOKEN(buffer) \
506 (PDU_ENCAPSULATION(buffer)+0x1a)
509 extern unsigned char DM_ACT
[];
510 #define DM_ACT_SIZE 0x55
511 #define QETH_DM_ACT_DEST_ADDR(buffer) (buffer+0x2c)
512 #define QETH_DM_ACT_CONNECTION_TOKEN(buffer) (buffer+0x51)
516 #define QETH_TRANSPORT_HEADER_SEQ_NO(buffer) (buffer+4)
517 #define QETH_PDU_HEADER_SEQ_NO(buffer) (buffer+0x1c)
518 #define QETH_PDU_HEADER_ACK_SEQ_NO(buffer) (buffer+0x20)
520 extern unsigned char IDX_ACTIVATE_READ
[];
521 extern unsigned char IDX_ACTIVATE_WRITE
[];
523 #define IDX_ACTIVATE_SIZE 0x22
524 #define QETH_IDX_ACT_ISSUER_RM_TOKEN(buffer) (buffer+0x0c)
525 #define QETH_IDX_NO_PORTNAME_REQUIRED(buffer) ((buffer)[0x0b]&0x80)
526 #define QETH_IDX_ACT_FUNC_LEVEL(buffer) (buffer+0x10)
527 #define QETH_IDX_ACT_DATASET_NAME(buffer) (buffer+0x16)
528 #define QETH_IDX_ACT_QDIO_DEV_CUA(buffer) (buffer+0x1e)
529 #define QETH_IDX_ACT_QDIO_DEV_REALADDR(buffer) (buffer+0x20)
530 #define QETH_IS_IDX_ACT_POS_REPLY(buffer) (((buffer)[0x08]&3)==2)
531 #define QETH_IDX_REPLY_LEVEL(buffer) (buffer+0x12)
533 #define PDU_ENCAPSULATION(buffer) \
534 (buffer + *(buffer + (*(buffer+0x0b)) + \
535 *(buffer + *(buffer+0x0b)+0x11) +0x07))
537 #define IS_IPA(buffer) \
539 ( *(buffer + ((*(buffer+0x0b))+4) )==0xc1) )
541 #define ADDR_FRAME_TYPE_DIX 1
542 #define ADDR_FRAME_TYPE_802_3 2
543 #define ADDR_FRAME_TYPE_TR_WITHOUT_SR 0x10
544 #define ADDR_FRAME_TYPE_TR_WITH_SR 0x20