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