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