| 1 |
// SPDX-License-Identifier: GPL-2.0 |
| 2 |
/* |
| 3 |
* Copyright IBM Corp. 2007 |
| 4 |
* Author(s): Frank Pavlic <[email protected]>, |
| 5 |
* Thomas Spatzier <[email protected]>, |
| 6 |
* Frank Blaschka <[email protected]> |
| 7 |
*/ |
| 8 |
|
| 9 |
#include <linux/module.h> |
| 10 |
#include <asm/cio.h> |
| 11 |
#include "qeth_core_mpc.h" |
| 12 |
|
| 13 |
const unsigned char IDX_ACTIVATE_READ[] = { |
| 14 |
0x00, 0x00, 0x80, 0x00, 0x00, 0x00, 0x00, 0x00, |
| 15 |
0x19, 0x01, 0x01, 0x80, 0x00, 0x00, 0x00, 0x00, |
| 16 |
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0xc8, 0xc1, |
| 17 |
0xd3, 0xd3, 0xd6, 0xd3, 0xc5, 0x40, 0x00, 0x00, |
| 18 |
0x00, 0x00 |
| 19 |
}; |
| 20 |
|
| 21 |
const unsigned char IDX_ACTIVATE_WRITE[] = { |
| 22 |
0x00, 0x00, 0x80, 0x00, 0x00, 0x00, 0x00, 0x00, |
| 23 |
0x15, 0x01, 0x01, 0x80, 0x00, 0x00, 0x00, 0x00, |
| 24 |
0xff, 0xff, 0x00, 0x00, 0x00, 0x00, 0xc8, 0xc1, |
| 25 |
0xd3, 0xd3, 0xd6, 0xd3, 0xc5, 0x40, 0x00, 0x00, |
| 26 |
0x00, 0x00 |
| 27 |
}; |
| 28 |
|
| 29 |
const unsigned char CM_ENABLE[] = { |
| 30 |
0x00, 0xe0, 0x00, 0x00, 0x00, 0x00, 0x00, 0x01, |
| 31 |
0x00, 0x00, 0x00, 0x14, 0x00, 0x00, 0x00, 0x63, |
| 32 |
0x10, 0x00, 0x00, 0x01, |
| 33 |
0x00, 0x00, 0x00, 0x00, |
| 34 |
0x81, 0x7e, 0x00, 0x01, 0x00, 0x00, 0x00, 0x00, |
| 35 |
0x00, 0x00, 0x00, 0x00, 0x00, 0x24, 0x00, 0x23, |
| 36 |
0x00, 0x00, 0x23, 0x05, 0x00, 0x00, 0x00, 0x00, |
| 37 |
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, |
| 38 |
0x01, 0x00, 0x00, 0x23, 0x00, 0x00, 0x00, 0x40, |
| 39 |
0x00, 0x0c, 0x41, 0x02, 0x00, 0x17, 0x00, 0x00, |
| 40 |
0x00, 0x00, 0x00, 0x00, |
| 41 |
0x00, 0x0b, 0x04, 0x01, |
| 42 |
0x7e, 0x04, 0x05, 0x00, 0x01, 0x01, 0x0f, |
| 43 |
0x00, |
| 44 |
0x0c, 0x04, 0x02, 0xff, 0xff, 0xff, 0xff, 0xff, |
| 45 |
0xff, 0xff, 0xff |
| 46 |
}; |
| 47 |
|
| 48 |
const unsigned char CM_SETUP[] = { |
| 49 |
0x00, 0xe0, 0x00, 0x00, 0x00, 0x00, 0x00, 0x02, |
| 50 |
0x00, 0x00, 0x00, 0x14, 0x00, 0x00, 0x00, 0x64, |
| 51 |
0x10, 0x00, 0x00, 0x01, |
| 52 |
0x00, 0x00, 0x00, 0x00, |
| 53 |
0x81, 0x7e, 0x00, 0x01, 0x00, 0x00, 0x00, 0x00, |
| 54 |
0x00, 0x00, 0x00, 0x00, 0x00, 0x24, 0x00, 0x24, |
| 55 |
0x00, 0x00, 0x24, 0x05, 0x00, 0x00, 0x00, 0x00, |
| 56 |
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, |
| 57 |
0x01, 0x00, 0x00, 0x24, 0x00, 0x00, 0x00, 0x40, |
| 58 |
0x00, 0x0c, 0x41, 0x04, 0x00, 0x18, 0x00, 0x00, |
| 59 |
0x00, 0x00, 0x00, 0x00, |
| 60 |
0x00, 0x09, 0x04, 0x04, |
| 61 |
0x05, 0x00, 0x01, 0x01, 0x11, |
| 62 |
0x00, 0x09, 0x04, |
| 63 |
0x05, 0x05, 0x00, 0x00, 0x00, 0x00, |
| 64 |
0x00, 0x06, |
| 65 |
0x04, 0x06, 0xc8, 0x00 |
| 66 |
}; |
| 67 |
|
| 68 |
const unsigned char ULP_ENABLE[] = { |
| 69 |
0x00, 0xe0, 0x00, 0x00, 0x00, 0x00, 0x00, 0x03, |
| 70 |
0x00, 0x00, 0x00, 0x14, 0x00, 0x00, 0x00, 0x6b, |
| 71 |
0x10, 0x00, 0x00, 0x01, |
| 72 |
0x00, 0x00, 0x00, 0x00, |
| 73 |
0x41, 0x7e, 0x00, 0x01, 0x00, 0x00, 0x00, 0x01, |
| 74 |
0x00, 0x00, 0x00, 0x00, 0x00, 0x24, 0x00, 0x2b, |
| 75 |
0x00, 0x00, 0x2b, 0x05, 0x20, 0x01, 0x00, 0x00, |
| 76 |
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, |
| 77 |
0x01, 0x00, 0x00, 0x2b, 0x00, 0x00, 0x00, 0x40, |
| 78 |
0x00, 0x0c, 0x41, 0x02, 0x00, 0x1f, 0x00, 0x00, |
| 79 |
0x00, 0x00, 0x00, 0x00, |
| 80 |
0x00, 0x0b, 0x04, 0x01, |
| 81 |
0x03, 0x04, 0x05, 0x00, 0x01, 0x01, 0x12, |
| 82 |
0x00, |
| 83 |
0x14, 0x04, 0x0a, 0x00, 0x20, 0x00, 0x00, 0xff, |
| 84 |
0xff, 0x00, 0x08, 0xc8, 0xe8, 0xc4, 0xf1, 0xc7, |
| 85 |
0xf1, 0x00, 0x00 |
| 86 |
}; |
| 87 |
|
| 88 |
const unsigned char ULP_SETUP[] = { |
| 89 |
0x00, 0xe0, 0x00, 0x00, 0x00, 0x00, 0x00, 0x04, |
| 90 |
0x00, 0x00, 0x00, 0x14, 0x00, 0x00, 0x00, 0x6c, |
| 91 |
0x10, 0x00, 0x00, 0x01, |
| 92 |
0x00, 0x00, 0x00, 0x00, |
| 93 |
0x41, 0x7e, 0x00, 0x01, 0x00, 0x00, 0x00, 0x02, |
| 94 |
0x00, 0x00, 0x00, 0x01, 0x00, 0x24, 0x00, 0x2c, |
| 95 |
0x00, 0x00, 0x2c, 0x05, 0x20, 0x01, 0x00, 0x00, |
| 96 |
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, |
| 97 |
0x01, 0x00, 0x00, 0x2c, 0x00, 0x00, 0x00, 0x40, |
| 98 |
0x00, 0x0c, 0x41, 0x04, 0x00, 0x20, 0x00, 0x00, |
| 99 |
0x00, 0x00, 0x00, 0x00, |
| 100 |
0x00, 0x09, 0x04, 0x04, |
| 101 |
0x05, 0x00, 0x01, 0x01, 0x14, |
| 102 |
0x00, 0x09, 0x04, |
| 103 |
0x05, 0x05, 0x30, 0x01, 0x00, 0x00, |
| 104 |
0x00, 0x06, |
| 105 |
0x04, 0x06, 0x40, 0x00, |
| 106 |
0x00, 0x08, 0x04, 0x0b, |
| 107 |
0x00, 0x00, 0x00, 0x00 |
| 108 |
}; |
| 109 |
|
| 110 |
const unsigned char DM_ACT[] = { |
| 111 |
0x00, 0xe0, 0x00, 0x00, 0x00, 0x00, 0x00, 0x05, |
| 112 |
0x00, 0x00, 0x00, 0x14, 0x00, 0x00, 0x00, 0x55, |
| 113 |
0x10, 0x00, 0x00, 0x01, |
| 114 |
0x00, 0x00, 0x00, 0x00, |
| 115 |
0x41, 0x7e, 0x00, 0x01, 0x00, 0x00, 0x00, 0x03, |
| 116 |
0x00, 0x00, 0x00, 0x02, 0x00, 0x24, 0x00, 0x15, |
| 117 |
0x00, 0x00, 0x2c, 0x05, 0x20, 0x01, 0x00, 0x00, |
| 118 |
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, |
| 119 |
0x01, 0x00, 0x00, 0x15, 0x00, 0x00, 0x00, 0x40, |
| 120 |
0x00, 0x0c, 0x43, 0x60, 0x00, 0x09, 0x00, 0x00, |
| 121 |
0x00, 0x00, 0x00, 0x00, |
| 122 |
0x00, 0x09, 0x04, 0x04, |
| 123 |
0x05, 0x40, 0x01, 0x01, 0x00 |
| 124 |
}; |
| 125 |
|
| 126 |
const unsigned char IPA_PDU_HEADER[] = { |
| 127 |
0x00, 0xe0, 0x00, 0x00, 0x77, 0x77, 0x77, 0x77, |
| 128 |
0x00, 0x00, 0x00, 0x14, 0x00, 0x00, 0x00, 0x00, |
| 129 |
0x10, 0x00, 0x00, 0x01, 0x00, 0x00, 0x00, 0x00, |
| 130 |
0xc1, 0x03, 0x00, 0x01, 0x00, 0x00, 0x00, 0x00, |
| 131 |
0x00, 0x00, 0x00, 0x00, 0x00, 0x24, 0x00, 0x00, |
| 132 |
0x00, 0x00, 0x00, 0x05, 0x77, 0x77, 0x77, 0x77, |
| 133 |
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, |
| 134 |
0x01, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x40, |
| 135 |
}; |
| 136 |
|
| 137 |
struct ipa_rc_msg { |
| 138 |
enum qeth_ipa_return_codes rc; |
| 139 |
const char *msg; |
| 140 |
}; |
| 141 |
|
| 142 |
static const struct ipa_rc_msg qeth_ipa_rc_def_msg[] = { |
| 143 |
{IPA_RC_SUCCESS, "success"}, |
| 144 |
{IPA_RC_NOTSUPP, "Command not supported"}, |
| 145 |
{IPA_RC_UNSUPPORTED_COMMAND, "Command not supported"}, |
| 146 |
{IPA_RC_DUP_IPV6_REMOTE, "ipv6 address already registered remote"}, |
| 147 |
{IPA_RC_DUP_IPV6_HOME, "ipv6 address already registered"}, |
| 148 |
{IPA_RC_UNREGISTERED_ADDR, "Address not registered"}, |
| 149 |
{IPA_RC_ID_NOT_FOUND, "Identifier not found"}, |
| 150 |
{IPA_RC_LAN_FRAME_MISMATCH, "LAN and frame mismatch"}, |
| 151 |
{IPA_RC_L2_UNSUPPORTED_CMD, "Unsupported layer 2 command"}, |
| 152 |
{IPA_RC_L2_ADDR_TABLE_FULL, "Layer2 address table full"}, |
| 153 |
{IPA_RC_L2_MAC_NOT_AUTH_BY_ADP, "L2 mac not authorized by adapter"}, |
| 154 |
{IPA_RC_DATA_MISMATCH, "Data field mismatch (v4/v6 mixed)"}, |
| 155 |
{IPA_RC_INVALID_MTU_SIZE, "Invalid MTU size"}, |
| 156 |
{IPA_RC_INVALID_LANTYPE, "Invalid LAN type"}, |
| 157 |
{IPA_RC_INVALID_LANNUM, "Invalid LAN num"}, |
| 158 |
{IPA_RC_LAN_PORT_STATE_ERROR, "LAN port state error"}, |
| 159 |
{IPA_RC_SETIP_NO_STARTLAN, "Setip no startlan received"}, |
| 160 |
{IPA_RC_SETIP_ALREADY_RECEIVED, "Setip already received"}, |
| 161 |
{IPA_RC_SETIP_INVALID_VERSION, "SETIP invalid IP version"}, |
| 162 |
{IPA_RC_UNSUPPORTED_SUBCMD, "Unsupported assist subcommand"}, |
| 163 |
{IPA_RC_ARP_ASSIST_NO_ENABLE, "Only partial success, no enable"}, |
| 164 |
{IPA_RC_INVALID_IP_VERSION2, "Invalid IP version"}, |
| 165 |
/* default for qeth_get_ipa_msg(): */ |
| 166 |
{IPA_RC_FFFF, "Unknown Error"} |
| 167 |
}; |
| 168 |
|
| 169 |
static const struct ipa_rc_msg qeth_ipa_rc_adp_parms_msg[] = { |
| 170 |
{IPA_RC_IP_TABLE_FULL, "Add Addr IP Table Full - ipv6"} |
| 171 |
}; |
| 172 |
|
| 173 |
static const struct ipa_rc_msg qeth_ipa_rc_diag_ass_msg[] = { |
| 174 |
{IPA_RC_INVALID_FORMAT, "invalid format or length"} |
| 175 |
}; |
| 176 |
|
| 177 |
static const struct ipa_rc_msg qeth_ipa_rc_addr_msg[] = { |
| 178 |
{IPA_RC_UNKNOWN_ERROR, "IPA command failed - reason unknown"}, |
| 179 |
{IPA_RC_NO_ID_AVAILABLE, "No identifiers available"}, |
| 180 |
{IPA_RC_INVALID_IP_VERSION, "IP version incorrect"} |
| 181 |
}; |
| 182 |
|
| 183 |
static const struct ipa_rc_msg qeth_ipa_rc_vnicc_msg[] = { |
| 184 |
{IPA_RC_VNICC_OOSEQ, "Command issued out of sequence"}, |
| 185 |
{IPA_RC_VNICC_VNICBP, "VNIC is BridgePort"} |
| 186 |
}; |
| 187 |
|
| 188 |
static const struct ipa_rc_msg qeth_ipa_rc_sbp_iqd_msg[] = { |
| 189 |
{IPA_RC_SBP_IQD_NOT_CONFIGURED, "Not configured for bridgeport"}, |
| 190 |
{IPA_RC_SBP_IQD_OS_MISMATCH, "OS mismatch"}, |
| 191 |
{IPA_RC_SBP_IQD_ANO_DEV_PRIMARY, "Primary bridgeport exists already"}, |
| 192 |
{IPA_RC_SBP_IQD_CURRENT_SECOND, "Bridgeport is currently secondary"}, |
| 193 |
{IPA_RC_SBP_IQD_LIMIT_SECOND, "Limit of secondary bridgeports reached"}, |
| 194 |
{IPA_RC_SBP_IQD_NOT_AUTHD_BY_ZMAN, "Not authorized by zManager"}, |
| 195 |
{IPA_RC_SBP_IQD_CURRENT_PRIMARY, "Bridgeport is currently primary"}, |
| 196 |
{IPA_RC_SBP_IQD_NO_QDIO_QUEUES, "QDIO queues not established"} |
| 197 |
}; |
| 198 |
|
| 199 |
static const struct ipa_rc_msg qeth_ipa_rc_sbp_osa_msg[] = { |
| 200 |
{IPA_RC_SBP_OSA_NOT_CONFIGURED, "Not configured for bridgeport"}, |
| 201 |
{IPA_RC_SBP_OSA_OS_MISMATCH, "OS mismatch"}, |
| 202 |
{IPA_RC_SBP_OSA_ANO_DEV_PRIMARY, "Primary bridgeport exists already"}, |
| 203 |
{IPA_RC_SBP_OSA_CURRENT_SECOND, "Bridgeport is currently secondary"}, |
| 204 |
{IPA_RC_SBP_OSA_LIMIT_SECOND, "Limit of secondary bridgeports reached"}, |
| 205 |
{IPA_RC_SBP_OSA_NOT_AUTHD_BY_ZMAN, "Not authorized by zManager"}, |
| 206 |
{IPA_RC_SBP_OSA_CURRENT_PRIMARY, "Bridgeport is currently primary"}, |
| 207 |
{IPA_RC_SBP_OSA_NO_QDIO_QUEUES, "QDIO queues not established"} |
| 208 |
}; |
| 209 |
|
| 210 |
static const struct ipa_rc_msg qeth_ipa_rc_mac_msg[] = { |
| 211 |
{IPA_RC_L2_DUP_MAC, "Duplicate MAC address"}, |
| 212 |
{IPA_RC_L2_DUP_LAYER3_MAC, "Duplicate with layer 3 MAC"}, |
| 213 |
{IPA_RC_L2_GMAC_NOT_FOUND, "GMAC not found"}, |
| 214 |
{IPA_RC_L2_MAC_NOT_AUTH_BY_HYP, "L2 mac not authorized by hypervisor"}, |
| 215 |
{IPA_RC_L2_MAC_NOT_FOUND, "L2 mac address not found"} |
| 216 |
}; |
| 217 |
|
| 218 |
static const struct ipa_rc_msg qeth_ipa_rc_ip_msg[] = { |
| 219 |
{IPA_RC_DUPLICATE_IP_ADDRESS, "Address already registered"}, |
| 220 |
{IPA_RC_IP_ADDR_TABLE_FULL, "IP address table full"}, |
| 221 |
{IPA_RC_IP_ADDR_ALREADY_USED, "IP address already in use on LAN"}, |
| 222 |
{IPA_RC_MC_ADDR_NOT_FOUND, "Multicast address not found"} |
| 223 |
}; |
| 224 |
|
| 225 |
static const struct ipa_rc_msg qeth_ipa_rc_lan_msg[] = { |
| 226 |
{IPA_RC_LAN_OFFLINE, "STRTLAN_LAN_DISABLED - LAN offline"}, |
| 227 |
{IPA_RC_VEPA_TO_VEB_TRANSITION, "Adj. switch disabled port mode RR"}, |
| 228 |
}; |
| 229 |
|
| 230 |
static const struct ipa_rc_msg qeth_ipa_rc_vlan_msg[] = { |
| 231 |
{IPA_RC_L2_INVALID_VLAN_ID, "L2 invalid vlan id"}, |
| 232 |
{IPA_RC_L2_DUP_VLAN_ID, "L2 duplicate vlan id"}, |
| 233 |
{IPA_RC_L2_VLAN_ID_NOT_FOUND, "L2 vlan id not found"} |
| 234 |
}; |
| 235 |
|
| 236 |
static const struct ipa_rc_msg qeth_ipa_rc_rtg_msg[] = { |
| 237 |
{IPA_RC_PRIMARY_ALREADY_DEFINED, "Primary already defined"}, |
| 238 |
{IPA_RC_SECOND_ALREADY_DEFINED, "Secondary already defined"}, |
| 239 |
{IPA_RC_INVALID_SETRTG_INDICATOR, "Invalid SETRTG indicator"}, |
| 240 |
{IPA_RC_MC_ADDR_ALREADY_DEFINED, "Multicast address already defined"} |
| 241 |
}; |
| 242 |
|
| 243 |
struct ipa_cmd_rc_map { |
| 244 |
enum qeth_ipa_cmds cmd; |
| 245 |
const struct ipa_rc_msg *msg_arr; |
| 246 |
const size_t arr_len; |
| 247 |
}; |
| 248 |
|
| 249 |
static const struct ipa_cmd_rc_map qeth_ipa_cmd_rc_map[] = { |
| 250 |
{ |
| 251 |
.cmd = IPA_CMD_SETADAPTERPARMS, |
| 252 |
.msg_arr = qeth_ipa_rc_adp_parms_msg, |
| 253 |
.arr_len = ARRAY_SIZE(qeth_ipa_rc_adp_parms_msg) |
| 254 |
}, |
| 255 |
{ |
| 256 |
.cmd = IPA_CMD_SET_DIAG_ASS, |
| 257 |
.msg_arr = qeth_ipa_rc_diag_ass_msg, |
| 258 |
.arr_len = ARRAY_SIZE(qeth_ipa_rc_diag_ass_msg) |
| 259 |
}, |
| 260 |
{ |
| 261 |
.cmd = IPA_CMD_CREATE_ADDR, |
| 262 |
.msg_arr = qeth_ipa_rc_addr_msg, |
| 263 |
.arr_len = ARRAY_SIZE(qeth_ipa_rc_addr_msg) |
| 264 |
}, |
| 265 |
{ |
| 266 |
.cmd = IPA_CMD_DESTROY_ADDR, |
| 267 |
.msg_arr = qeth_ipa_rc_addr_msg, |
| 268 |
.arr_len = ARRAY_SIZE(qeth_ipa_rc_addr_msg) |
| 269 |
}, |
| 270 |
{ |
| 271 |
.cmd = IPA_CMD_VNICC, |
| 272 |
.msg_arr = qeth_ipa_rc_vnicc_msg, |
| 273 |
.arr_len = ARRAY_SIZE(qeth_ipa_rc_vnicc_msg) |
| 274 |
}, |
| 275 |
{ |
| 276 |
.cmd = IPA_CMD_SETBRIDGEPORT_IQD, |
| 277 |
.msg_arr = qeth_ipa_rc_sbp_iqd_msg, |
| 278 |
.arr_len = ARRAY_SIZE(qeth_ipa_rc_sbp_iqd_msg) |
| 279 |
}, |
| 280 |
{ |
| 281 |
.cmd = IPA_CMD_SETBRIDGEPORT_OSA, |
| 282 |
.msg_arr = qeth_ipa_rc_sbp_osa_msg, |
| 283 |
.arr_len = ARRAY_SIZE(qeth_ipa_rc_sbp_osa_msg) |
| 284 |
}, |
| 285 |
{ |
| 286 |
.cmd = IPA_CMD_SETVMAC, |
| 287 |
.msg_arr = qeth_ipa_rc_mac_msg, |
| 288 |
.arr_len = ARRAY_SIZE(qeth_ipa_rc_mac_msg) |
| 289 |
}, |
| 290 |
{ |
| 291 |
.cmd = IPA_CMD_DELVMAC, |
| 292 |
.msg_arr = qeth_ipa_rc_mac_msg, |
| 293 |
.arr_len = ARRAY_SIZE(qeth_ipa_rc_mac_msg) |
| 294 |
}, |
| 295 |
{ |
| 296 |
.cmd = IPA_CMD_SETGMAC, |
| 297 |
.msg_arr = qeth_ipa_rc_mac_msg, |
| 298 |
.arr_len = ARRAY_SIZE(qeth_ipa_rc_mac_msg) |
| 299 |
}, |
| 300 |
{ |
| 301 |
.cmd = IPA_CMD_DELGMAC, |
| 302 |
.msg_arr = qeth_ipa_rc_mac_msg, |
| 303 |
.arr_len = ARRAY_SIZE(qeth_ipa_rc_mac_msg) |
| 304 |
}, |
| 305 |
{ |
| 306 |
.cmd = IPA_CMD_SETIP, |
| 307 |
.msg_arr = qeth_ipa_rc_ip_msg, |
| 308 |
.arr_len = ARRAY_SIZE(qeth_ipa_rc_ip_msg) |
| 309 |
}, |
| 310 |
{ |
| 311 |
.cmd = IPA_CMD_SETIPM, |
| 312 |
.msg_arr = qeth_ipa_rc_ip_msg, |
| 313 |
.arr_len = ARRAY_SIZE(qeth_ipa_rc_ip_msg) |
| 314 |
}, |
| 315 |
{ |
| 316 |
.cmd = IPA_CMD_DELIPM, |
| 317 |
.msg_arr = qeth_ipa_rc_ip_msg, |
| 318 |
.arr_len = ARRAY_SIZE(qeth_ipa_rc_ip_msg) |
| 319 |
}, |
| 320 |
{ |
| 321 |
.cmd = IPA_CMD_STARTLAN, |
| 322 |
.msg_arr = qeth_ipa_rc_lan_msg, |
| 323 |
.arr_len = ARRAY_SIZE(qeth_ipa_rc_lan_msg) |
| 324 |
}, |
| 325 |
{ |
| 326 |
.cmd = IPA_CMD_STOPLAN, |
| 327 |
.msg_arr = qeth_ipa_rc_lan_msg, |
| 328 |
.arr_len = ARRAY_SIZE(qeth_ipa_rc_lan_msg) |
| 329 |
}, |
| 330 |
{ |
| 331 |
.cmd = IPA_CMD_SETVLAN, |
| 332 |
.msg_arr = qeth_ipa_rc_vlan_msg, |
| 333 |
.arr_len = ARRAY_SIZE(qeth_ipa_rc_vlan_msg) |
| 334 |
}, |
| 335 |
{ |
| 336 |
.cmd = IPA_CMD_DELVLAN, |
| 337 |
.msg_arr = qeth_ipa_rc_vlan_msg, |
| 338 |
.arr_len = ARRAY_SIZE(qeth_ipa_rc_vlan_msg) |
| 339 |
}, |
| 340 |
{ |
| 341 |
.cmd = IPA_CMD_SETRTG, |
| 342 |
.msg_arr = qeth_ipa_rc_rtg_msg, |
| 343 |
.arr_len = ARRAY_SIZE(qeth_ipa_rc_rtg_msg) |
| 344 |
} |
| 345 |
}; |
| 346 |
|
| 347 |
const char *qeth_get_ipa_msg(enum qeth_ipa_cmds cmd, |
| 348 |
enum qeth_ipa_return_codes rc) |
| 349 |
{ |
| 350 |
int x; |
| 351 |
const struct ipa_rc_msg *msg_arr = NULL; |
| 352 |
size_t arr_len = 0; |
| 353 |
|
| 354 |
for (x = 0; x < ARRAY_SIZE(qeth_ipa_cmd_rc_map); x++) { |
| 355 |
if (qeth_ipa_cmd_rc_map[x].cmd == cmd) { |
| 356 |
msg_arr = qeth_ipa_cmd_rc_map[x].msg_arr; |
| 357 |
arr_len = qeth_ipa_cmd_rc_map[x].arr_len; |
| 358 |
break; |
| 359 |
} |
| 360 |
} |
| 361 |
|
| 362 |
for (x = 0; x < arr_len; x++) { |
| 363 |
if (msg_arr[x].rc == rc) |
| 364 |
return msg_arr[x].msg; |
| 365 |
} |
| 366 |
|
| 367 |
for (x = 0; x < ARRAY_SIZE(qeth_ipa_rc_def_msg) - 1; x++) { |
| 368 |
if (qeth_ipa_rc_def_msg[x].rc == rc) |
| 369 |
return qeth_ipa_rc_def_msg[x].msg; |
| 370 |
} |
| 371 |
return qeth_ipa_rc_def_msg[x].msg; |
| 372 |
} |
| 373 |
|
| 374 |
struct ipa_cmd_names { |
| 375 |
enum qeth_ipa_cmds cmd; |
| 376 |
const char *name; |
| 377 |
}; |
| 378 |
|
| 379 |
static const struct ipa_cmd_names qeth_ipa_cmd_names[] = { |
| 380 |
{IPA_CMD_STARTLAN, "startlan"}, |
| 381 |
{IPA_CMD_STOPLAN, "stoplan"}, |
| 382 |
{IPA_CMD_SETVMAC, "setvmac"}, |
| 383 |
{IPA_CMD_DELVMAC, "delvmac"}, |
| 384 |
{IPA_CMD_SETGMAC, "setgmac"}, |
| 385 |
{IPA_CMD_DELGMAC, "delgmac"}, |
| 386 |
{IPA_CMD_SETVLAN, "setvlan"}, |
| 387 |
{IPA_CMD_DELVLAN, "delvlan"}, |
| 388 |
{IPA_CMD_VNICC, "vnic_characteristics"}, |
| 389 |
{IPA_CMD_SETBRIDGEPORT_OSA, "set_bridge_port(osa)"}, |
| 390 |
{IPA_CMD_SETIP, "setip"}, |
| 391 |
{IPA_CMD_QIPASSIST, "qipassist"}, |
| 392 |
{IPA_CMD_SETASSPARMS, "setassparms"}, |
| 393 |
{IPA_CMD_SETIPM, "setipm"}, |
| 394 |
{IPA_CMD_DELIPM, "delipm"}, |
| 395 |
{IPA_CMD_SETRTG, "setrtg"}, |
| 396 |
{IPA_CMD_DELIP, "delip"}, |
| 397 |
{IPA_CMD_SETADAPTERPARMS, "setadapterparms"}, |
| 398 |
{IPA_CMD_SET_DIAG_ASS, "set_diag_ass"}, |
| 399 |
{IPA_CMD_SETBRIDGEPORT_IQD, "set_bridge_port(hs)"}, |
| 400 |
{IPA_CMD_CREATE_ADDR, "create_addr"}, |
| 401 |
{IPA_CMD_DESTROY_ADDR, "destroy_addr"}, |
| 402 |
{IPA_CMD_REGISTER_LOCAL_ADDR, "register_local_addr"}, |
| 403 |
{IPA_CMD_UNREGISTER_LOCAL_ADDR, "unregister_local_addr"}, |
| 404 |
{IPA_CMD_ADDRESS_CHANGE_NOTIF, "address_change_notification"}, |
| 405 |
{IPA_CMD_UNKNOWN, "unknown"}, |
| 406 |
}; |
| 407 |
|
| 408 |
const char *qeth_get_ipa_cmd_name(enum qeth_ipa_cmds cmd) |
| 409 |
{ |
| 410 |
int x; |
| 411 |
|
| 412 |
for (x = 0; x < ARRAY_SIZE(qeth_ipa_cmd_names) - 1; x++) |
| 413 |
if (qeth_ipa_cmd_names[x].cmd == cmd) |
| 414 |
return qeth_ipa_cmd_names[x].name; |
| 415 |
return qeth_ipa_cmd_names[x].name; |
| 416 |
} |