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