Back to home page

OSCL-LXR

 
 

    


0001 // SPDX-License-Identifier: GPL-2.0
0002 /*
0003  *    Copyright IBM Corp. 2007
0004  *    Author(s): Frank Pavlic <fpavlic@de.ibm.com>,
0005  *       Thomas Spatzier <tspat@de.ibm.com>,
0006  *       Frank Blaschka <frank.blaschka@de.ibm.com>
0007  */
0008 
0009 #include <linux/module.h>
0010 #include <asm/cio.h>
0011 #include "qeth_core_mpc.h"
0012 
0013 const unsigned char IDX_ACTIVATE_READ[] = {
0014     0x00, 0x00, 0x80, 0x00,  0x00, 0x00, 0x00, 0x00,
0015     0x19, 0x01, 0x01, 0x80,  0x00, 0x00, 0x00, 0x00,
0016     0x00, 0x00, 0x00, 0x00,  0x00, 0x00, 0xc8, 0xc1,
0017     0xd3, 0xd3, 0xd6, 0xd3,  0xc5, 0x40, 0x00, 0x00,
0018     0x00, 0x00
0019 };
0020 
0021 const unsigned char IDX_ACTIVATE_WRITE[] = {
0022     0x00, 0x00, 0x80, 0x00,  0x00, 0x00, 0x00, 0x00,
0023     0x15, 0x01, 0x01, 0x80,  0x00, 0x00, 0x00, 0x00,
0024     0xff, 0xff, 0x00, 0x00,  0x00, 0x00, 0xc8, 0xc1,
0025     0xd3, 0xd3, 0xd6, 0xd3,  0xc5, 0x40, 0x00, 0x00,
0026     0x00, 0x00
0027 };
0028 
0029 const unsigned char CM_ENABLE[] = {
0030     0x00, 0xe0, 0x00, 0x00,  0x00, 0x00, 0x00, 0x01,
0031     0x00, 0x00, 0x00, 0x14,  0x00, 0x00, 0x00, 0x63,
0032     0x10, 0x00, 0x00, 0x01,
0033     0x00, 0x00, 0x00, 0x00,
0034     0x81, 0x7e, 0x00, 0x01,  0x00, 0x00, 0x00, 0x00,
0035     0x00, 0x00, 0x00, 0x00,  0x00, 0x24, 0x00, 0x23,
0036     0x00, 0x00, 0x23, 0x05,  0x00, 0x00, 0x00, 0x00,
0037     0x00, 0x00, 0x00, 0x00,  0x00, 0x00, 0x00, 0x00,
0038     0x01, 0x00, 0x00, 0x23,  0x00, 0x00, 0x00, 0x40,
0039     0x00, 0x0c, 0x41, 0x02,  0x00, 0x17, 0x00, 0x00,
0040     0x00, 0x00, 0x00, 0x00,
0041     0x00, 0x0b, 0x04, 0x01,
0042     0x7e, 0x04, 0x05, 0x00,  0x01, 0x01, 0x0f,
0043     0x00,
0044     0x0c, 0x04, 0x02, 0xff,  0xff, 0xff, 0xff, 0xff,
0045     0xff, 0xff, 0xff
0046 };
0047 
0048 const unsigned char CM_SETUP[] = {
0049     0x00, 0xe0, 0x00, 0x00,  0x00, 0x00, 0x00, 0x02,
0050     0x00, 0x00, 0x00, 0x14,  0x00, 0x00, 0x00, 0x64,
0051     0x10, 0x00, 0x00, 0x01,
0052     0x00, 0x00, 0x00, 0x00,
0053     0x81, 0x7e, 0x00, 0x01,  0x00, 0x00, 0x00, 0x00,
0054     0x00, 0x00, 0x00, 0x00,  0x00, 0x24, 0x00, 0x24,
0055     0x00, 0x00, 0x24, 0x05,  0x00, 0x00, 0x00, 0x00,
0056     0x00, 0x00, 0x00, 0x00,  0x00, 0x00, 0x00, 0x00,
0057     0x01, 0x00, 0x00, 0x24,  0x00, 0x00, 0x00, 0x40,
0058     0x00, 0x0c, 0x41, 0x04,  0x00, 0x18, 0x00, 0x00,
0059     0x00, 0x00, 0x00, 0x00,
0060     0x00, 0x09, 0x04, 0x04,
0061     0x05, 0x00, 0x01, 0x01,  0x11,
0062     0x00, 0x09, 0x04,
0063     0x05, 0x05, 0x00, 0x00,  0x00, 0x00,
0064     0x00, 0x06,
0065     0x04, 0x06, 0xc8, 0x00
0066 };
0067 
0068 const unsigned char ULP_ENABLE[] = {
0069     0x00, 0xe0, 0x00, 0x00,  0x00, 0x00, 0x00, 0x03,
0070     0x00, 0x00, 0x00, 0x14,  0x00, 0x00, 0x00, 0x6b,
0071     0x10, 0x00, 0x00, 0x01,
0072     0x00, 0x00, 0x00, 0x00,
0073     0x41, 0x7e, 0x00, 0x01,  0x00, 0x00, 0x00, 0x01,
0074     0x00, 0x00, 0x00, 0x00,  0x00, 0x24, 0x00, 0x2b,
0075     0x00, 0x00, 0x2b, 0x05,  0x20, 0x01, 0x00, 0x00,
0076     0x00, 0x00, 0x00, 0x00,  0x00, 0x00, 0x00, 0x00,
0077     0x01, 0x00, 0x00, 0x2b,  0x00, 0x00, 0x00, 0x40,
0078     0x00, 0x0c, 0x41, 0x02,  0x00, 0x1f, 0x00, 0x00,
0079     0x00, 0x00, 0x00, 0x00,
0080     0x00, 0x0b, 0x04, 0x01,
0081     0x03, 0x04, 0x05, 0x00,  0x01, 0x01, 0x12,
0082     0x00,
0083     0x14, 0x04, 0x0a, 0x00,  0x20, 0x00, 0x00, 0xff,
0084     0xff, 0x00, 0x08, 0xc8,  0xe8, 0xc4, 0xf1, 0xc7,
0085     0xf1, 0x00, 0x00
0086 };
0087 
0088 const unsigned char ULP_SETUP[] = {
0089     0x00, 0xe0, 0x00, 0x00,  0x00, 0x00, 0x00, 0x04,
0090     0x00, 0x00, 0x00, 0x14,  0x00, 0x00, 0x00, 0x6c,
0091     0x10, 0x00, 0x00, 0x01,
0092     0x00, 0x00, 0x00, 0x00,
0093     0x41, 0x7e, 0x00, 0x01,  0x00, 0x00, 0x00, 0x02,
0094     0x00, 0x00, 0x00, 0x01,  0x00, 0x24, 0x00, 0x2c,
0095     0x00, 0x00, 0x2c, 0x05,  0x20, 0x01, 0x00, 0x00,
0096     0x00, 0x00, 0x00, 0x00,  0x00, 0x00, 0x00, 0x00,
0097     0x01, 0x00, 0x00, 0x2c,  0x00, 0x00, 0x00, 0x40,
0098     0x00, 0x0c, 0x41, 0x04,  0x00, 0x20, 0x00, 0x00,
0099     0x00, 0x00, 0x00, 0x00,
0100     0x00, 0x09, 0x04, 0x04,
0101     0x05, 0x00, 0x01, 0x01,  0x14,
0102     0x00, 0x09, 0x04,
0103     0x05, 0x05, 0x30, 0x01,  0x00, 0x00,
0104     0x00, 0x06,
0105     0x04, 0x06, 0x40, 0x00,
0106     0x00, 0x08, 0x04, 0x0b,
0107     0x00, 0x00, 0x00, 0x00
0108 };
0109 
0110 const unsigned char DM_ACT[] = {
0111     0x00, 0xe0, 0x00, 0x00,  0x00, 0x00, 0x00, 0x05,
0112     0x00, 0x00, 0x00, 0x14,  0x00, 0x00, 0x00, 0x55,
0113     0x10, 0x00, 0x00, 0x01,
0114     0x00, 0x00, 0x00, 0x00,
0115     0x41, 0x7e, 0x00, 0x01,  0x00, 0x00, 0x00, 0x03,
0116     0x00, 0x00, 0x00, 0x02,  0x00, 0x24, 0x00, 0x15,
0117     0x00, 0x00, 0x2c, 0x05,  0x20, 0x01, 0x00, 0x00,
0118     0x00, 0x00, 0x00, 0x00,  0x00, 0x00, 0x00, 0x00,
0119     0x01, 0x00, 0x00, 0x15,  0x00, 0x00, 0x00, 0x40,
0120     0x00, 0x0c, 0x43, 0x60,  0x00, 0x09, 0x00, 0x00,
0121     0x00, 0x00, 0x00, 0x00,
0122     0x00, 0x09, 0x04, 0x04,
0123     0x05, 0x40, 0x01, 0x01,  0x00
0124 };
0125 
0126 const unsigned char IPA_PDU_HEADER[] = {
0127     0x00, 0xe0, 0x00, 0x00,  0x77, 0x77, 0x77, 0x77,
0128     0x00, 0x00, 0x00, 0x14,  0x00, 0x00, 0x00, 0x00,
0129     0x10, 0x00, 0x00, 0x01,  0x00, 0x00, 0x00, 0x00,
0130     0xc1, 0x03, 0x00, 0x01,  0x00, 0x00, 0x00, 0x00,
0131     0x00, 0x00, 0x00, 0x00,  0x00, 0x24, 0x00, 0x00,
0132     0x00, 0x00, 0x00, 0x05,  0x77, 0x77, 0x77, 0x77,
0133     0x00, 0x00, 0x00, 0x00,  0x00, 0x00, 0x00, 0x00,
0134     0x01, 0x00, 0x00, 0x00,  0x00, 0x00, 0x00, 0x40,
0135 };
0136 
0137 struct ipa_rc_msg {
0138     enum qeth_ipa_return_codes rc;
0139     const char *msg;
0140 };
0141 
0142 static const struct ipa_rc_msg qeth_ipa_rc_msg[] = {
0143     {IPA_RC_SUCCESS,        "success"},
0144     {IPA_RC_NOTSUPP,        "Command not supported"},
0145     {IPA_RC_IP_TABLE_FULL,      "Add Addr IP Table Full - ipv6"},
0146     {IPA_RC_UNKNOWN_ERROR,      "IPA command failed - reason unknown"},
0147     {IPA_RC_UNSUPPORTED_COMMAND,    "Command not supported"},
0148     {IPA_RC_VNICC_OOSEQ,        "Command issued out of sequence"},
0149     {IPA_RC_INVALID_FORMAT,     "invalid format or length"},
0150     {IPA_RC_DUP_IPV6_REMOTE, "ipv6 address already registered remote"},
0151     {IPA_RC_SBP_IQD_NOT_CONFIGURED, "Not configured for bridgeport"},
0152     {IPA_RC_DUP_IPV6_HOME,      "ipv6 address already registered"},
0153     {IPA_RC_UNREGISTERED_ADDR,  "Address not registered"},
0154     {IPA_RC_NO_ID_AVAILABLE,    "No identifiers available"},
0155     {IPA_RC_ID_NOT_FOUND,       "Identifier not found"},
0156     {IPA_RC_SBP_IQD_ANO_DEV_PRIMARY, "Primary bridgeport exists already"},
0157     {IPA_RC_SBP_IQD_CURRENT_SECOND, "Bridgeport is currently secondary"},
0158     {IPA_RC_SBP_IQD_LIMIT_SECOND, "Limit of secondary bridgeports reached"},
0159     {IPA_RC_INVALID_IP_VERSION, "IP version incorrect"},
0160     {IPA_RC_SBP_IQD_CURRENT_PRIMARY, "Bridgeport is currently primary"},
0161     {IPA_RC_LAN_FRAME_MISMATCH, "LAN and frame mismatch"},
0162     {IPA_RC_SBP_IQD_NO_QDIO_QUEUES, "QDIO queues not established"},
0163     {IPA_RC_L2_UNSUPPORTED_CMD, "Unsupported layer 2 command"},
0164     {IPA_RC_L2_DUP_MAC,     "Duplicate MAC address"},
0165     {IPA_RC_L2_ADDR_TABLE_FULL, "Layer2 address table full"},
0166     {IPA_RC_L2_DUP_LAYER3_MAC,  "Duplicate with layer 3 MAC"},
0167     {IPA_RC_L2_GMAC_NOT_FOUND,  "GMAC not found"},
0168     {IPA_RC_L2_MAC_NOT_AUTH_BY_HYP, "L2 mac not authorized by hypervisor"},
0169     {IPA_RC_L2_MAC_NOT_AUTH_BY_ADP, "L2 mac not authorized by adapter"},
0170     {IPA_RC_L2_MAC_NOT_FOUND,   "L2 mac address not found"},
0171     {IPA_RC_L2_INVALID_VLAN_ID, "L2 invalid vlan id"},
0172     {IPA_RC_L2_DUP_VLAN_ID,     "L2 duplicate vlan id"},
0173     {IPA_RC_L2_VLAN_ID_NOT_FOUND,   "L2 vlan id not found"},
0174     {IPA_RC_VNICC_VNICBP,       "VNIC is BridgePort"},
0175     {IPA_RC_SBP_OSA_NOT_CONFIGURED, "Not configured for bridgeport"},
0176     {IPA_RC_SBP_OSA_OS_MISMATCH,    "OS mismatch"},
0177     {IPA_RC_SBP_OSA_ANO_DEV_PRIMARY, "Primary bridgeport exists already"},
0178     {IPA_RC_SBP_OSA_CURRENT_SECOND, "Bridgeport is currently secondary"},
0179     {IPA_RC_SBP_OSA_LIMIT_SECOND, "Limit of secondary bridgeports reached"},
0180     {IPA_RC_SBP_OSA_NOT_AUTHD_BY_ZMAN, "Not authorized by zManager"},
0181     {IPA_RC_SBP_OSA_CURRENT_PRIMARY, "Bridgeport is currently primary"},
0182     {IPA_RC_SBP_OSA_NO_QDIO_QUEUES, "QDIO queues not established"},
0183     {IPA_RC_DATA_MISMATCH,      "Data field mismatch (v4/v6 mixed)"},
0184     {IPA_RC_INVALID_MTU_SIZE,   "Invalid MTU size"},
0185     {IPA_RC_INVALID_LANTYPE,    "Invalid LAN type"},
0186     {IPA_RC_INVALID_LANNUM,     "Invalid LAN num"},
0187     {IPA_RC_DUPLICATE_IP_ADDRESS,   "Address already registered"},
0188     {IPA_RC_IP_ADDR_TABLE_FULL, "IP address table full"},
0189     {IPA_RC_LAN_PORT_STATE_ERROR,   "LAN port state error"},
0190     {IPA_RC_SETIP_NO_STARTLAN,  "Setip no startlan received"},
0191     {IPA_RC_SETIP_ALREADY_RECEIVED, "Setip already received"},
0192     {IPA_RC_IP_ADDR_ALREADY_USED,   "IP address already in use on LAN"},
0193     {IPA_RC_MC_ADDR_NOT_FOUND,  "Multicast address not found"},
0194     {IPA_RC_SETIP_INVALID_VERSION,  "SETIP invalid IP version"},
0195     {IPA_RC_UNSUPPORTED_SUBCMD, "Unsupported assist subcommand"},
0196     {IPA_RC_ARP_ASSIST_NO_ENABLE,   "Only partial success, no enable"},
0197     {IPA_RC_PRIMARY_ALREADY_DEFINED, "Primary already defined"},
0198     {IPA_RC_SECOND_ALREADY_DEFINED, "Secondary already defined"},
0199     {IPA_RC_INVALID_SETRTG_INDICATOR, "Invalid SETRTG indicator"},
0200     {IPA_RC_MC_ADDR_ALREADY_DEFINED, "Multicast address already defined"},
0201     {IPA_RC_LAN_OFFLINE,        "STRTLAN_LAN_DISABLED - LAN offline"},
0202     {IPA_RC_VEPA_TO_VEB_TRANSITION, "Adj. switch disabled port mode RR"},
0203     {IPA_RC_INVALID_IP_VERSION2,    "Invalid IP version"},
0204     /* default for qeth_get_ipa_msg(): */
0205     {IPA_RC_FFFF,           "Unknown Error"}
0206 };
0207 
0208 const char *qeth_get_ipa_msg(enum qeth_ipa_return_codes rc)
0209 {
0210     int x;
0211 
0212     for (x = 0; x < ARRAY_SIZE(qeth_ipa_rc_msg) - 1; x++)
0213         if (qeth_ipa_rc_msg[x].rc == rc)
0214             return qeth_ipa_rc_msg[x].msg;
0215     return qeth_ipa_rc_msg[x].msg;
0216 }
0217 
0218 
0219 struct ipa_cmd_names {
0220     enum qeth_ipa_cmds cmd;
0221     const char *name;
0222 };
0223 
0224 static const struct ipa_cmd_names qeth_ipa_cmd_names[] = {
0225     {IPA_CMD_STARTLAN,  "startlan"},
0226     {IPA_CMD_STOPLAN,   "stoplan"},
0227     {IPA_CMD_SETVMAC,   "setvmac"},
0228     {IPA_CMD_DELVMAC,   "delvmac"},
0229     {IPA_CMD_SETGMAC,   "setgmac"},
0230     {IPA_CMD_DELGMAC,   "delgmac"},
0231     {IPA_CMD_SETVLAN,   "setvlan"},
0232     {IPA_CMD_DELVLAN,   "delvlan"},
0233     {IPA_CMD_VNICC,     "vnic_characteristics"},
0234     {IPA_CMD_SETBRIDGEPORT_OSA, "set_bridge_port(osa)"},
0235     {IPA_CMD_SETIP,     "setip"},
0236     {IPA_CMD_QIPASSIST, "qipassist"},
0237     {IPA_CMD_SETASSPARMS,   "setassparms"},
0238     {IPA_CMD_SETIPM,    "setipm"},
0239     {IPA_CMD_DELIPM,    "delipm"},
0240     {IPA_CMD_SETRTG,    "setrtg"},
0241     {IPA_CMD_DELIP,     "delip"},
0242     {IPA_CMD_SETADAPTERPARMS, "setadapterparms"},
0243     {IPA_CMD_SET_DIAG_ASS,  "set_diag_ass"},
0244     {IPA_CMD_SETBRIDGEPORT_IQD, "set_bridge_port(hs)"},
0245     {IPA_CMD_CREATE_ADDR,   "create_addr"},
0246     {IPA_CMD_DESTROY_ADDR,  "destroy_addr"},
0247     {IPA_CMD_REGISTER_LOCAL_ADDR,   "register_local_addr"},
0248     {IPA_CMD_UNREGISTER_LOCAL_ADDR, "unregister_local_addr"},
0249     {IPA_CMD_ADDRESS_CHANGE_NOTIF, "address_change_notification"},
0250     {IPA_CMD_UNKNOWN,   "unknown"},
0251 };
0252 
0253 const char *qeth_get_ipa_cmd_name(enum qeth_ipa_cmds cmd)
0254 {
0255     int x;
0256 
0257     for (x = 0; x < ARRAY_SIZE(qeth_ipa_cmd_names) - 1; x++)
0258         if (qeth_ipa_cmd_names[x].cmd == cmd)
0259             return qeth_ipa_cmd_names[x].name;
0260     return qeth_ipa_cmd_names[x].name;
0261 }