Frank Blaschka | 4a71df5 | 2008-02-15 09:19:42 +0100 | [diff] [blame] | 1 | /* |
Frank Blaschka | 4a71df5 | 2008-02-15 09:19:42 +0100 | [diff] [blame] | 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, |
Ursula Braun | 5113fec | 2010-05-16 21:15:14 +0000 | [diff] [blame] | 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, |
Frank Blaschka | 4a71df5 | 2008-02-15 09:19:42 +0100 | [diff] [blame] | 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 | |
Frank Blaschka | 4a71df5 | 2008-02-15 09:19:42 +0100 | [diff] [blame] | 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_SETCCID = 0x41, |
| 96 | IPA_CMD_DELCCID = 0x42, |
| 97 | IPA_CMD_MODCCID = 0x43, |
| 98 | IPA_CMD_SETIP = 0xb1, |
| 99 | IPA_CMD_QIPASSIST = 0xb2, |
| 100 | IPA_CMD_SETASSPARMS = 0xb3, |
| 101 | IPA_CMD_SETIPM = 0xb4, |
| 102 | IPA_CMD_DELIPM = 0xb5, |
| 103 | IPA_CMD_SETRTG = 0xb6, |
| 104 | IPA_CMD_DELIP = 0xb7, |
| 105 | IPA_CMD_SETADAPTERPARMS = 0xb8, |
| 106 | IPA_CMD_SET_DIAG_ASS = 0xb9, |
| 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_UNKNOWN = 0x00 |
| 112 | }; |
| 113 | |
| 114 | enum qeth_ip_ass_cmds { |
| 115 | IPA_CMD_ASS_START = 0x0001, |
| 116 | IPA_CMD_ASS_STOP = 0x0002, |
| 117 | IPA_CMD_ASS_CONFIGURE = 0x0003, |
| 118 | IPA_CMD_ASS_ENABLE = 0x0004, |
| 119 | }; |
| 120 | |
| 121 | enum qeth_arp_process_subcmds { |
| 122 | IPA_CMD_ASS_ARP_SET_NO_ENTRIES = 0x0003, |
| 123 | IPA_CMD_ASS_ARP_QUERY_CACHE = 0x0004, |
| 124 | IPA_CMD_ASS_ARP_ADD_ENTRY = 0x0005, |
| 125 | IPA_CMD_ASS_ARP_REMOVE_ENTRY = 0x0006, |
| 126 | IPA_CMD_ASS_ARP_FLUSH_CACHE = 0x0007, |
| 127 | IPA_CMD_ASS_ARP_QUERY_INFO = 0x0104, |
| 128 | IPA_CMD_ASS_ARP_QUERY_STATS = 0x0204, |
| 129 | }; |
| 130 | |
| 131 | |
| 132 | /* Return Codes for IPA Commands |
| 133 | * according to OSA card Specs */ |
| 134 | |
| 135 | enum qeth_ipa_return_codes { |
| 136 | IPA_RC_SUCCESS = 0x0000, |
| 137 | IPA_RC_NOTSUPP = 0x0001, |
| 138 | IPA_RC_IP_TABLE_FULL = 0x0002, |
| 139 | IPA_RC_UNKNOWN_ERROR = 0x0003, |
| 140 | IPA_RC_UNSUPPORTED_COMMAND = 0x0004, |
Ursula Braun | 76b11f8 | 2010-01-11 02:50:50 +0000 | [diff] [blame] | 141 | IPA_RC_TRACE_ALREADY_ACTIVE = 0x0005, |
| 142 | IPA_RC_INVALID_FORMAT = 0x0006, |
Frank Blaschka | 4a71df5 | 2008-02-15 09:19:42 +0100 | [diff] [blame] | 143 | IPA_RC_DUP_IPV6_REMOTE = 0x0008, |
| 144 | IPA_RC_DUP_IPV6_HOME = 0x0010, |
| 145 | IPA_RC_UNREGISTERED_ADDR = 0x0011, |
| 146 | IPA_RC_NO_ID_AVAILABLE = 0x0012, |
| 147 | IPA_RC_ID_NOT_FOUND = 0x0013, |
| 148 | IPA_RC_INVALID_IP_VERSION = 0x0020, |
| 149 | IPA_RC_LAN_FRAME_MISMATCH = 0x0040, |
| 150 | IPA_RC_L2_UNSUPPORTED_CMD = 0x2003, |
| 151 | IPA_RC_L2_DUP_MAC = 0x2005, |
| 152 | IPA_RC_L2_ADDR_TABLE_FULL = 0x2006, |
| 153 | IPA_RC_L2_DUP_LAYER3_MAC = 0x200a, |
| 154 | IPA_RC_L2_GMAC_NOT_FOUND = 0x200b, |
Ursula Braun | 0666eb06 | 2009-05-19 21:38:39 +0000 | [diff] [blame] | 155 | IPA_RC_L2_MAC_NOT_AUTH_BY_HYP = 0x200c, |
| 156 | IPA_RC_L2_MAC_NOT_AUTH_BY_ADP = 0x200d, |
Frank Blaschka | 4a71df5 | 2008-02-15 09:19:42 +0100 | [diff] [blame] | 157 | IPA_RC_L2_MAC_NOT_FOUND = 0x2010, |
| 158 | IPA_RC_L2_INVALID_VLAN_ID = 0x2015, |
| 159 | IPA_RC_L2_DUP_VLAN_ID = 0x2016, |
| 160 | IPA_RC_L2_VLAN_ID_NOT_FOUND = 0x2017, |
| 161 | IPA_RC_DATA_MISMATCH = 0xe001, |
| 162 | IPA_RC_INVALID_MTU_SIZE = 0xe002, |
| 163 | IPA_RC_INVALID_LANTYPE = 0xe003, |
| 164 | IPA_RC_INVALID_LANNUM = 0xe004, |
| 165 | IPA_RC_DUPLICATE_IP_ADDRESS = 0xe005, |
| 166 | IPA_RC_IP_ADDR_TABLE_FULL = 0xe006, |
| 167 | IPA_RC_LAN_PORT_STATE_ERROR = 0xe007, |
| 168 | IPA_RC_SETIP_NO_STARTLAN = 0xe008, |
| 169 | IPA_RC_SETIP_ALREADY_RECEIVED = 0xe009, |
| 170 | IPA_RC_IP_ADDR_ALREADY_USED = 0xe00a, |
Ursula Braun | 2d921c3 | 2008-04-01 10:26:53 +0200 | [diff] [blame] | 171 | IPA_RC_MC_ADDR_NOT_FOUND = 0xe00b, |
Frank Blaschka | 4a71df5 | 2008-02-15 09:19:42 +0100 | [diff] [blame] | 172 | IPA_RC_SETIP_INVALID_VERSION = 0xe00d, |
| 173 | IPA_RC_UNSUPPORTED_SUBCMD = 0xe00e, |
| 174 | IPA_RC_ARP_ASSIST_NO_ENABLE = 0xe00f, |
| 175 | IPA_RC_PRIMARY_ALREADY_DEFINED = 0xe010, |
| 176 | IPA_RC_SECOND_ALREADY_DEFINED = 0xe011, |
| 177 | IPA_RC_INVALID_SETRTG_INDICATOR = 0xe012, |
| 178 | IPA_RC_MC_ADDR_ALREADY_DEFINED = 0xe013, |
| 179 | IPA_RC_LAN_OFFLINE = 0xe080, |
Stefan Raspl | 0f54761 | 2013-01-21 02:30:20 +0000 | [diff] [blame] | 180 | IPA_RC_VEPA_TO_VEB_TRANSITION = 0xe090, |
Frank Blaschka | 4a71df5 | 2008-02-15 09:19:42 +0100 | [diff] [blame] | 181 | IPA_RC_INVALID_IP_VERSION2 = 0xf001, |
Ursula Braun | e0a8114 | 2012-03-07 02:06:28 +0000 | [diff] [blame] | 182 | IPA_RC_ENOMEM = 0xfffe, |
Frank Blaschka | 4a71df5 | 2008-02-15 09:19:42 +0100 | [diff] [blame] | 183 | IPA_RC_FFFF = 0xffff |
| 184 | }; |
Ursula Braun | 76b11f8 | 2010-01-11 02:50:50 +0000 | [diff] [blame] | 185 | /* for DELIP */ |
| 186 | #define IPA_RC_IP_ADDRESS_NOT_DEFINED IPA_RC_PRIMARY_ALREADY_DEFINED |
| 187 | /* for SET_DIAGNOSTIC_ASSIST */ |
| 188 | #define IPA_RC_INVALID_SUBCMD IPA_RC_IP_TABLE_FULL |
| 189 | #define IPA_RC_HARDWARE_AUTH_ERROR IPA_RC_UNKNOWN_ERROR |
Frank Blaschka | 4a71df5 | 2008-02-15 09:19:42 +0100 | [diff] [blame] | 190 | |
| 191 | /* IPA function flags; each flag marks availability of respective function */ |
| 192 | enum qeth_ipa_funcs { |
| 193 | IPA_ARP_PROCESSING = 0x00000001L, |
| 194 | IPA_INBOUND_CHECKSUM = 0x00000002L, |
| 195 | IPA_OUTBOUND_CHECKSUM = 0x00000004L, |
| 196 | IPA_IP_FRAGMENTATION = 0x00000008L, |
| 197 | IPA_FILTERING = 0x00000010L, |
| 198 | IPA_IPV6 = 0x00000020L, |
| 199 | IPA_MULTICASTING = 0x00000040L, |
| 200 | IPA_IP_REASSEMBLY = 0x00000080L, |
| 201 | IPA_QUERY_ARP_COUNTERS = 0x00000100L, |
| 202 | IPA_QUERY_ARP_ADDR_INFO = 0x00000200L, |
| 203 | IPA_SETADAPTERPARMS = 0x00000400L, |
| 204 | IPA_VLAN_PRIO = 0x00000800L, |
| 205 | IPA_PASSTHRU = 0x00001000L, |
| 206 | IPA_FLUSH_ARP_SUPPORT = 0x00002000L, |
| 207 | IPA_FULL_VLAN = 0x00004000L, |
| 208 | IPA_INBOUND_PASSTHRU = 0x00008000L, |
| 209 | IPA_SOURCE_MAC = 0x00010000L, |
| 210 | IPA_OSA_MC_ROUTER = 0x00020000L, |
| 211 | IPA_QUERY_ARP_ASSIST = 0x00040000L, |
| 212 | IPA_INBOUND_TSO = 0x00080000L, |
| 213 | IPA_OUTBOUND_TSO = 0x00100000L, |
| 214 | }; |
| 215 | |
| 216 | /* SETIP/DELIP IPA Command: ***************************************************/ |
| 217 | enum qeth_ipa_setdelip_flags { |
| 218 | QETH_IPA_SETDELIP_DEFAULT = 0x00L, /* default */ |
| 219 | QETH_IPA_SETIP_VIPA_FLAG = 0x01L, /* no grat. ARP */ |
| 220 | QETH_IPA_SETIP_TAKEOVER_FLAG = 0x02L, /* nofail on grat. ARP */ |
| 221 | QETH_IPA_DELIP_ADDR_2_B_TAKEN_OVER = 0x20L, |
| 222 | QETH_IPA_DELIP_VIPA_FLAG = 0x40L, |
| 223 | QETH_IPA_DELIP_ADDR_NEEDS_SETIP = 0x80L, |
| 224 | }; |
| 225 | |
| 226 | /* SETADAPTER IPA Command: ****************************************************/ |
| 227 | enum qeth_ipa_setadp_cmd { |
Einar Lueck | d64ecc2 | 2009-11-12 00:11:41 +0000 | [diff] [blame] | 228 | IPA_SETADP_QUERY_COMMANDS_SUPPORTED = 0x00000001L, |
| 229 | IPA_SETADP_ALTER_MAC_ADDRESS = 0x00000002L, |
| 230 | IPA_SETADP_ADD_DELETE_GROUP_ADDRESS = 0x00000004L, |
| 231 | IPA_SETADP_ADD_DELETE_FUNCTIONAL_ADDR = 0x00000008L, |
| 232 | IPA_SETADP_SET_ADDRESSING_MODE = 0x00000010L, |
| 233 | IPA_SETADP_SET_CONFIG_PARMS = 0x00000020L, |
| 234 | IPA_SETADP_SET_CONFIG_PARMS_EXTENDED = 0x00000040L, |
| 235 | IPA_SETADP_SET_BROADCAST_MODE = 0x00000080L, |
| 236 | IPA_SETADP_SEND_OSA_MESSAGE = 0x00000100L, |
| 237 | IPA_SETADP_SET_SNMP_CONTROL = 0x00000200L, |
| 238 | IPA_SETADP_QUERY_CARD_INFO = 0x00000400L, |
| 239 | IPA_SETADP_SET_PROMISC_MODE = 0x00000800L, |
Ursula Braun | 76b11f8 | 2010-01-11 02:50:50 +0000 | [diff] [blame] | 240 | IPA_SETADP_SET_DIAG_ASSIST = 0x00002000L, |
Einar Lueck | d64ecc2 | 2009-11-12 00:11:41 +0000 | [diff] [blame] | 241 | IPA_SETADP_SET_ACCESS_CONTROL = 0x00010000L, |
Frank Blaschka | c3ab96f | 2012-02-08 00:19:49 +0000 | [diff] [blame] | 242 | IPA_SETADP_QUERY_OAT = 0x00080000L, |
Frank Blaschka | 4a71df5 | 2008-02-15 09:19:42 +0100 | [diff] [blame] | 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 | }; |
Einar Lueck | d64ecc2 | 2009-11-12 00:11:41 +0000 | [diff] [blame] | 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, |
Stefan Raspl | 0f54761 | 2013-01-21 02:30:20 +0000 | [diff] [blame] | 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, |
Einar Lueck | d64ecc2 | 2009-11-12 00:11:41 +0000 | [diff] [blame] | 276 | }; |
| 277 | |
Frank Blaschka | 4a71df5 | 2008-02-15 09:19:42 +0100 | [diff] [blame] | 278 | |
| 279 | /* (SET)DELIP(M) IPA stuff ***************************************************/ |
| 280 | struct qeth_ipacmd_setdelip4 { |
| 281 | __u8 ip_addr[4]; |
| 282 | __u8 mask[4]; |
| 283 | __u32 flags; |
| 284 | } __attribute__ ((packed)); |
| 285 | |
| 286 | struct qeth_ipacmd_setdelip6 { |
| 287 | __u8 ip_addr[16]; |
| 288 | __u8 mask[16]; |
| 289 | __u32 flags; |
| 290 | } __attribute__ ((packed)); |
| 291 | |
| 292 | struct qeth_ipacmd_setdelipm { |
| 293 | __u8 mac[6]; |
| 294 | __u8 padding[2]; |
| 295 | __u8 ip6[12]; |
| 296 | __u8 ip4[4]; |
| 297 | } __attribute__ ((packed)); |
| 298 | |
| 299 | struct qeth_ipacmd_layer2setdelmac { |
| 300 | __u32 mac_length; |
| 301 | __u8 mac[6]; |
| 302 | } __attribute__ ((packed)); |
| 303 | |
| 304 | struct qeth_ipacmd_layer2setdelvlan { |
| 305 | __u16 vlan_id; |
| 306 | } __attribute__ ((packed)); |
| 307 | |
| 308 | |
| 309 | struct qeth_ipacmd_setassparms_hdr { |
| 310 | __u32 assist_no; |
| 311 | __u16 length; |
| 312 | __u16 command_code; |
| 313 | __u16 return_code; |
| 314 | __u8 number_of_replies; |
| 315 | __u8 seq_no; |
| 316 | } __attribute__((packed)); |
| 317 | |
| 318 | struct qeth_arp_query_data { |
| 319 | __u16 request_bits; |
| 320 | __u16 reply_bits; |
| 321 | __u32 no_entries; |
Einar Lueck | d0ddf30f | 2010-12-08 02:57:58 +0000 | [diff] [blame] | 322 | char data; /* only for replies */ |
Frank Blaschka | 4a71df5 | 2008-02-15 09:19:42 +0100 | [diff] [blame] | 323 | } __attribute__((packed)); |
| 324 | |
| 325 | /* used as parameter for arp_query reply */ |
| 326 | struct qeth_arp_query_info { |
| 327 | __u32 udata_len; |
| 328 | __u16 mask_bits; |
| 329 | __u32 udata_offset; |
| 330 | __u32 no_entries; |
| 331 | char *udata; |
| 332 | }; |
| 333 | |
| 334 | /* SETASSPARMS IPA Command: */ |
| 335 | struct qeth_ipacmd_setassparms { |
| 336 | struct qeth_ipacmd_setassparms_hdr hdr; |
| 337 | union { |
| 338 | __u32 flags_32bit; |
| 339 | struct qeth_arp_cache_entry add_arp_entry; |
| 340 | struct qeth_arp_query_data query_arp; |
| 341 | __u8 ip[16]; |
| 342 | } data; |
| 343 | } __attribute__ ((packed)); |
| 344 | |
| 345 | |
| 346 | /* SETRTG IPA Command: ****************************************************/ |
| 347 | struct qeth_set_routing { |
| 348 | __u8 type; |
| 349 | }; |
| 350 | |
| 351 | /* SETADAPTERPARMS IPA Command: *******************************************/ |
| 352 | struct qeth_query_cmds_supp { |
| 353 | __u32 no_lantypes_supp; |
| 354 | __u8 lan_type; |
| 355 | __u8 reserved1[3]; |
| 356 | __u32 supported_cmds; |
| 357 | __u8 reserved2[8]; |
| 358 | } __attribute__ ((packed)); |
| 359 | |
| 360 | struct qeth_change_addr { |
| 361 | __u32 cmd; |
| 362 | __u32 addr_size; |
| 363 | __u32 no_macs; |
| 364 | __u8 addr[OSA_ADDR_LEN]; |
| 365 | } __attribute__ ((packed)); |
| 366 | |
| 367 | |
| 368 | struct qeth_snmp_cmd { |
| 369 | __u8 token[16]; |
| 370 | __u32 request; |
| 371 | __u32 interface; |
| 372 | __u32 returncode; |
| 373 | __u32 firmwarelevel; |
| 374 | __u32 seqno; |
| 375 | __u8 data; |
| 376 | } __attribute__ ((packed)); |
| 377 | |
| 378 | struct qeth_snmp_ureq_hdr { |
| 379 | __u32 data_len; |
| 380 | __u32 req_len; |
| 381 | __u32 reserved1; |
| 382 | __u32 reserved2; |
| 383 | } __attribute__ ((packed)); |
| 384 | |
| 385 | struct qeth_snmp_ureq { |
| 386 | struct qeth_snmp_ureq_hdr hdr; |
| 387 | struct qeth_snmp_cmd cmd; |
| 388 | } __attribute__((packed)); |
| 389 | |
Einar Lueck | d64ecc2 | 2009-11-12 00:11:41 +0000 | [diff] [blame] | 390 | /* SET_ACCESS_CONTROL: same format for request and reply */ |
| 391 | struct qeth_set_access_ctrl { |
| 392 | __u32 subcmd_code; |
Stefan Raspl | 0f54761 | 2013-01-21 02:30:20 +0000 | [diff] [blame] | 393 | __u8 reserved[8]; |
Einar Lueck | d64ecc2 | 2009-11-12 00:11:41 +0000 | [diff] [blame] | 394 | } __attribute__((packed)); |
| 395 | |
Frank Blaschka | c3ab96f | 2012-02-08 00:19:49 +0000 | [diff] [blame] | 396 | struct qeth_query_oat { |
| 397 | __u32 subcmd_code; |
| 398 | __u8 reserved[12]; |
| 399 | } __packed; |
| 400 | |
| 401 | struct qeth_qoat_priv { |
| 402 | __u32 buffer_len; |
| 403 | __u32 response_len; |
| 404 | char *buffer; |
| 405 | }; |
| 406 | |
Frank Blaschka | 4a71df5 | 2008-02-15 09:19:42 +0100 | [diff] [blame] | 407 | struct qeth_ipacmd_setadpparms_hdr { |
| 408 | __u32 supp_hw_cmds; |
| 409 | __u32 reserved1; |
| 410 | __u16 cmdlength; |
| 411 | __u16 reserved2; |
| 412 | __u32 command_code; |
| 413 | __u16 return_code; |
| 414 | __u8 used_total; |
| 415 | __u8 seq_no; |
| 416 | __u32 reserved3; |
| 417 | } __attribute__ ((packed)); |
| 418 | |
| 419 | struct qeth_ipacmd_setadpparms { |
| 420 | struct qeth_ipacmd_setadpparms_hdr hdr; |
| 421 | union { |
| 422 | struct qeth_query_cmds_supp query_cmds_supp; |
| 423 | struct qeth_change_addr change_addr; |
| 424 | struct qeth_snmp_cmd snmp; |
Einar Lueck | d64ecc2 | 2009-11-12 00:11:41 +0000 | [diff] [blame] | 425 | struct qeth_set_access_ctrl set_access_ctrl; |
Frank Blaschka | c3ab96f | 2012-02-08 00:19:49 +0000 | [diff] [blame] | 426 | struct qeth_query_oat query_oat; |
Frank Blaschka | 4a71df5 | 2008-02-15 09:19:42 +0100 | [diff] [blame] | 427 | __u32 mode; |
| 428 | } data; |
| 429 | } __attribute__ ((packed)); |
| 430 | |
| 431 | /* CREATE_ADDR IPA Command: ***********************************************/ |
| 432 | struct qeth_create_destroy_address { |
| 433 | __u8 unique_id[8]; |
| 434 | } __attribute__ ((packed)); |
| 435 | |
Ursula Braun | 76b11f8 | 2010-01-11 02:50:50 +0000 | [diff] [blame] | 436 | /* SET DIAGNOSTIC ASSIST IPA Command: *************************************/ |
| 437 | |
| 438 | enum qeth_diags_cmds { |
| 439 | QETH_DIAGS_CMD_QUERY = 0x0001, |
| 440 | QETH_DIAGS_CMD_TRAP = 0x0002, |
| 441 | QETH_DIAGS_CMD_TRACE = 0x0004, |
| 442 | QETH_DIAGS_CMD_NOLOG = 0x0008, |
| 443 | QETH_DIAGS_CMD_DUMP = 0x0010, |
| 444 | }; |
| 445 | |
| 446 | enum qeth_diags_trace_types { |
| 447 | QETH_DIAGS_TYPE_HIPERSOCKET = 0x02, |
| 448 | }; |
| 449 | |
| 450 | enum qeth_diags_trace_cmds { |
| 451 | QETH_DIAGS_CMD_TRACE_ENABLE = 0x0001, |
| 452 | QETH_DIAGS_CMD_TRACE_DISABLE = 0x0002, |
| 453 | QETH_DIAGS_CMD_TRACE_MODIFY = 0x0004, |
| 454 | QETH_DIAGS_CMD_TRACE_REPLACE = 0x0008, |
| 455 | QETH_DIAGS_CMD_TRACE_QUERY = 0x0010, |
| 456 | }; |
| 457 | |
Frank Blaschka | 1da74b1 | 2011-05-12 18:45:02 +0000 | [diff] [blame] | 458 | enum qeth_diags_trap_action { |
| 459 | QETH_DIAGS_TRAP_ARM = 0x01, |
| 460 | QETH_DIAGS_TRAP_DISARM = 0x02, |
| 461 | QETH_DIAGS_TRAP_CAPTURE = 0x04, |
| 462 | }; |
| 463 | |
Ursula Braun | 76b11f8 | 2010-01-11 02:50:50 +0000 | [diff] [blame] | 464 | struct qeth_ipacmd_diagass { |
| 465 | __u32 host_tod2; |
| 466 | __u32:32; |
| 467 | __u16 subcmd_len; |
| 468 | __u16:16; |
| 469 | __u32 subcmd; |
| 470 | __u8 type; |
| 471 | __u8 action; |
| 472 | __u16 options; |
Frank Blaschka | 1da74b1 | 2011-05-12 18:45:02 +0000 | [diff] [blame] | 473 | __u32 ext; |
| 474 | __u8 cdata[64]; |
Ursula Braun | 76b11f8 | 2010-01-11 02:50:50 +0000 | [diff] [blame] | 475 | } __attribute__ ((packed)); |
| 476 | |
Frank Blaschka | 4a71df5 | 2008-02-15 09:19:42 +0100 | [diff] [blame] | 477 | /* Header for each IPA command */ |
| 478 | struct qeth_ipacmd_hdr { |
| 479 | __u8 command; |
| 480 | __u8 initiator; |
| 481 | __u16 seqno; |
| 482 | __u16 return_code; |
| 483 | __u8 adapter_type; |
| 484 | __u8 rel_adapter_no; |
| 485 | __u8 prim_version_no; |
| 486 | __u8 param_count; |
| 487 | __u16 prot_version; |
| 488 | __u32 ipa_supported; |
| 489 | __u32 ipa_enabled; |
| 490 | } __attribute__ ((packed)); |
| 491 | |
| 492 | /* The IPA command itself */ |
| 493 | struct qeth_ipa_cmd { |
| 494 | struct qeth_ipacmd_hdr hdr; |
| 495 | union { |
| 496 | struct qeth_ipacmd_setdelip4 setdelip4; |
| 497 | struct qeth_ipacmd_setdelip6 setdelip6; |
| 498 | struct qeth_ipacmd_setdelipm setdelipm; |
| 499 | struct qeth_ipacmd_setassparms setassparms; |
| 500 | struct qeth_ipacmd_layer2setdelmac setdelmac; |
| 501 | struct qeth_ipacmd_layer2setdelvlan setdelvlan; |
| 502 | struct qeth_create_destroy_address create_destroy_addr; |
| 503 | struct qeth_ipacmd_setadpparms setadapterparms; |
| 504 | struct qeth_set_routing setrtg; |
Ursula Braun | 76b11f8 | 2010-01-11 02:50:50 +0000 | [diff] [blame] | 505 | struct qeth_ipacmd_diagass diagass; |
Frank Blaschka | 4a71df5 | 2008-02-15 09:19:42 +0100 | [diff] [blame] | 506 | } data; |
| 507 | } __attribute__ ((packed)); |
| 508 | |
| 509 | /* |
| 510 | * special command for ARP processing. |
| 511 | * this is not included in setassparms command before, because we get |
| 512 | * problem with the size of struct qeth_ipacmd_setassparms otherwise |
| 513 | */ |
| 514 | enum qeth_ipa_arp_return_codes { |
| 515 | QETH_IPA_ARP_RC_SUCCESS = 0x0000, |
| 516 | QETH_IPA_ARP_RC_FAILED = 0x0001, |
| 517 | QETH_IPA_ARP_RC_NOTSUPP = 0x0002, |
| 518 | QETH_IPA_ARP_RC_OUT_OF_RANGE = 0x0003, |
| 519 | QETH_IPA_ARP_RC_Q_NOTSUPP = 0x0004, |
| 520 | QETH_IPA_ARP_RC_Q_NO_DATA = 0x0008, |
| 521 | }; |
| 522 | |
Frank Blaschka | 4a71df5 | 2008-02-15 09:19:42 +0100 | [diff] [blame] | 523 | extern char *qeth_get_ipa_msg(enum qeth_ipa_return_codes rc); |
| 524 | extern char *qeth_get_ipa_cmd_name(enum qeth_ipa_cmds cmd); |
| 525 | |
| 526 | #define QETH_SETASS_BASE_LEN (sizeof(struct qeth_ipacmd_hdr) + \ |
| 527 | sizeof(struct qeth_ipacmd_setassparms_hdr)) |
| 528 | #define QETH_IPA_ARP_DATA_POS(buffer) (buffer + IPA_PDU_HEADER_SIZE + \ |
| 529 | QETH_SETASS_BASE_LEN) |
| 530 | #define QETH_SETADP_BASE_LEN (sizeof(struct qeth_ipacmd_hdr) + \ |
| 531 | sizeof(struct qeth_ipacmd_setadpparms_hdr)) |
| 532 | #define QETH_SNMP_SETADP_CMDLENGTH 16 |
| 533 | |
| 534 | #define QETH_ARP_DATA_SIZE 3968 |
| 535 | #define QETH_ARP_CMD_LEN (QETH_ARP_DATA_SIZE + 8) |
| 536 | /* Helper functions */ |
| 537 | #define IS_IPA_REPLY(cmd) ((cmd->hdr.initiator == IPA_CMD_INITIATOR_HOST) || \ |
| 538 | (cmd->hdr.initiator == IPA_CMD_INITIATOR_OSA_REPLY)) |
| 539 | |
| 540 | /*****************************************************************************/ |
| 541 | /* END OF IP Assist related definitions */ |
| 542 | /*****************************************************************************/ |
| 543 | |
| 544 | |
| 545 | extern unsigned char WRITE_CCW[]; |
| 546 | extern unsigned char READ_CCW[]; |
| 547 | |
| 548 | extern unsigned char CM_ENABLE[]; |
| 549 | #define CM_ENABLE_SIZE 0x63 |
| 550 | #define QETH_CM_ENABLE_ISSUER_RM_TOKEN(buffer) (buffer + 0x2c) |
| 551 | #define QETH_CM_ENABLE_FILTER_TOKEN(buffer) (buffer + 0x53) |
| 552 | #define QETH_CM_ENABLE_USER_DATA(buffer) (buffer + 0x5b) |
| 553 | |
| 554 | #define QETH_CM_ENABLE_RESP_FILTER_TOKEN(buffer) \ |
| 555 | (PDU_ENCAPSULATION(buffer) + 0x13) |
| 556 | |
| 557 | |
| 558 | extern unsigned char CM_SETUP[]; |
| 559 | #define CM_SETUP_SIZE 0x64 |
| 560 | #define QETH_CM_SETUP_DEST_ADDR(buffer) (buffer + 0x2c) |
| 561 | #define QETH_CM_SETUP_CONNECTION_TOKEN(buffer) (buffer + 0x51) |
| 562 | #define QETH_CM_SETUP_FILTER_TOKEN(buffer) (buffer + 0x5a) |
| 563 | |
| 564 | #define QETH_CM_SETUP_RESP_DEST_ADDR(buffer) \ |
| 565 | (PDU_ENCAPSULATION(buffer) + 0x1a) |
| 566 | |
| 567 | extern unsigned char ULP_ENABLE[]; |
| 568 | #define ULP_ENABLE_SIZE 0x6b |
| 569 | #define QETH_ULP_ENABLE_LINKNUM(buffer) (buffer + 0x61) |
| 570 | #define QETH_ULP_ENABLE_DEST_ADDR(buffer) (buffer + 0x2c) |
| 571 | #define QETH_ULP_ENABLE_FILTER_TOKEN(buffer) (buffer + 0x53) |
| 572 | #define QETH_ULP_ENABLE_PORTNAME_AND_LL(buffer) (buffer + 0x62) |
| 573 | #define QETH_ULP_ENABLE_RESP_FILTER_TOKEN(buffer) \ |
| 574 | (PDU_ENCAPSULATION(buffer) + 0x13) |
| 575 | #define QETH_ULP_ENABLE_RESP_MAX_MTU(buffer) \ |
| 576 | (PDU_ENCAPSULATION(buffer) + 0x1f) |
| 577 | #define QETH_ULP_ENABLE_RESP_DIFINFO_LEN(buffer) \ |
| 578 | (PDU_ENCAPSULATION(buffer) + 0x17) |
| 579 | #define QETH_ULP_ENABLE_RESP_LINK_TYPE(buffer) \ |
| 580 | (PDU_ENCAPSULATION(buffer) + 0x2b) |
Adam Buchbinder | 6070d81 | 2009-12-04 15:47:01 -0500 | [diff] [blame] | 581 | /* Layer 2 definitions */ |
Frank Blaschka | 4a71df5 | 2008-02-15 09:19:42 +0100 | [diff] [blame] | 582 | #define QETH_PROT_LAYER2 0x08 |
| 583 | #define QETH_PROT_TCPIP 0x03 |
| 584 | #define QETH_PROT_OSN2 0x0a |
| 585 | #define QETH_ULP_ENABLE_PROT_TYPE(buffer) (buffer + 0x50) |
| 586 | #define QETH_IPA_CMD_PROT_TYPE(buffer) (buffer + 0x19) |
| 587 | |
| 588 | extern unsigned char ULP_SETUP[]; |
| 589 | #define ULP_SETUP_SIZE 0x6c |
| 590 | #define QETH_ULP_SETUP_DEST_ADDR(buffer) (buffer + 0x2c) |
| 591 | #define QETH_ULP_SETUP_CONNECTION_TOKEN(buffer) (buffer + 0x51) |
| 592 | #define QETH_ULP_SETUP_FILTER_TOKEN(buffer) (buffer + 0x5a) |
| 593 | #define QETH_ULP_SETUP_CUA(buffer) (buffer + 0x68) |
| 594 | #define QETH_ULP_SETUP_REAL_DEVADDR(buffer) (buffer + 0x6a) |
| 595 | |
| 596 | #define QETH_ULP_SETUP_RESP_CONNECTION_TOKEN(buffer) \ |
| 597 | (PDU_ENCAPSULATION(buffer) + 0x1a) |
| 598 | |
| 599 | |
| 600 | extern unsigned char DM_ACT[]; |
| 601 | #define DM_ACT_SIZE 0x55 |
| 602 | #define QETH_DM_ACT_DEST_ADDR(buffer) (buffer + 0x2c) |
| 603 | #define QETH_DM_ACT_CONNECTION_TOKEN(buffer) (buffer + 0x51) |
| 604 | |
| 605 | |
| 606 | |
| 607 | #define QETH_TRANSPORT_HEADER_SEQ_NO(buffer) (buffer + 4) |
| 608 | #define QETH_PDU_HEADER_SEQ_NO(buffer) (buffer + 0x1c) |
| 609 | #define QETH_PDU_HEADER_ACK_SEQ_NO(buffer) (buffer + 0x20) |
| 610 | |
| 611 | extern unsigned char IDX_ACTIVATE_READ[]; |
| 612 | extern unsigned char IDX_ACTIVATE_WRITE[]; |
| 613 | |
| 614 | #define IDX_ACTIVATE_SIZE 0x22 |
| 615 | #define QETH_IDX_ACT_PNO(buffer) (buffer+0x0b) |
| 616 | #define QETH_IDX_ACT_ISSUER_RM_TOKEN(buffer) (buffer + 0x0c) |
| 617 | #define QETH_IDX_NO_PORTNAME_REQUIRED(buffer) ((buffer)[0x0b] & 0x80) |
| 618 | #define QETH_IDX_ACT_FUNC_LEVEL(buffer) (buffer + 0x10) |
| 619 | #define QETH_IDX_ACT_DATASET_NAME(buffer) (buffer + 0x16) |
| 620 | #define QETH_IDX_ACT_QDIO_DEV_CUA(buffer) (buffer + 0x1e) |
| 621 | #define QETH_IDX_ACT_QDIO_DEV_REALADDR(buffer) (buffer + 0x20) |
| 622 | #define QETH_IS_IDX_ACT_POS_REPLY(buffer) (((buffer)[0x08] & 3) == 2) |
| 623 | #define QETH_IDX_REPLY_LEVEL(buffer) (buffer + 0x12) |
| 624 | #define QETH_IDX_ACT_CAUSE_CODE(buffer) (buffer)[0x09] |
Ursula Braun | 01fc3e8 | 2010-06-21 22:57:12 +0000 | [diff] [blame] | 625 | #define QETH_IDX_ACT_ERR_EXCL 0x19 |
| 626 | #define QETH_IDX_ACT_ERR_AUTH 0x1E |
| 627 | #define QETH_IDX_ACT_ERR_AUTH_USER 0x20 |
Frank Blaschka | 4a71df5 | 2008-02-15 09:19:42 +0100 | [diff] [blame] | 628 | |
| 629 | #define PDU_ENCAPSULATION(buffer) \ |
| 630 | (buffer + *(buffer + (*(buffer + 0x0b)) + \ |
| 631 | *(buffer + *(buffer + 0x0b) + 0x11) + 0x07)) |
| 632 | |
| 633 | #define IS_IPA(buffer) \ |
| 634 | ((buffer) && \ |
| 635 | (*(buffer + ((*(buffer + 0x0b)) + 4)) == 0xc1)) |
| 636 | |
| 637 | #define ADDR_FRAME_TYPE_DIX 1 |
| 638 | #define ADDR_FRAME_TYPE_802_3 2 |
| 639 | #define ADDR_FRAME_TYPE_TR_WITHOUT_SR 0x10 |
| 640 | #define ADDR_FRAME_TYPE_TR_WITH_SR 0x20 |
| 641 | |
| 642 | #endif |