1 // SPDX-License-Identifier: GPL-2.0
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>
9 #include <linux/module.h>
11 #include "qeth_core_mpc.h"
13 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,
21 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,
29 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,
44 0x0c, 0x04, 0x02, 0xff, 0xff, 0xff, 0xff, 0xff,
48 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,
63 0x05, 0x05, 0x00, 0x00, 0x00, 0x00,
65 0x04, 0x06, 0xc8, 0x00
68 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,
83 0x14, 0x04, 0x0a, 0x00, 0x20, 0x00, 0x00, 0xff,
84 0xff, 0x00, 0x08, 0xc8, 0xe8, 0xc4, 0xf1, 0xc7,
88 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,
103 0x05, 0x05, 0x30, 0x01, 0x00, 0x00,
105 0x04, 0x06, 0x40, 0x00,
106 0x00, 0x08, 0x04, 0x0b,
107 0x00, 0x00, 0x00, 0x00
110 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
126 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,
138 enum qeth_ipa_return_codes rc
;
142 static const struct ipa_rc_msg qeth_ipa_rc_msg
[] = {
143 {IPA_RC_SUCCESS
, "success"},
144 {IPA_RC_NOTSUPP
, "Command not supported"},
145 {IPA_RC_IP_TABLE_FULL
, "Add Addr IP Table Full - ipv6"},
146 {IPA_RC_UNKNOWN_ERROR
, "IPA command failed - reason unknown"},
147 {IPA_RC_UNSUPPORTED_COMMAND
, "Command not supported"},
148 {IPA_RC_VNICC_OOSEQ
, "Command issued out of sequence"},
149 {IPA_RC_INVALID_FORMAT
, "invalid format or length"},
150 {IPA_RC_DUP_IPV6_REMOTE
, "ipv6 address already registered remote"},
151 {IPA_RC_SBP_IQD_NOT_CONFIGURED
, "Not configured for bridgeport"},
152 {IPA_RC_DUP_IPV6_HOME
, "ipv6 address already registered"},
153 {IPA_RC_UNREGISTERED_ADDR
, "Address not registered"},
154 {IPA_RC_NO_ID_AVAILABLE
, "No identifiers available"},
155 {IPA_RC_ID_NOT_FOUND
, "Identifier not found"},
156 {IPA_RC_SBP_IQD_ANO_DEV_PRIMARY
, "Primary bridgeport exists already"},
157 {IPA_RC_SBP_IQD_CURRENT_SECOND
, "Bridgeport is currently secondary"},
158 {IPA_RC_SBP_IQD_LIMIT_SECOND
, "Limit of secondary bridgeports reached"},
159 {IPA_RC_INVALID_IP_VERSION
, "IP version incorrect"},
160 {IPA_RC_SBP_IQD_CURRENT_PRIMARY
, "Bridgeport is currently primary"},
161 {IPA_RC_LAN_FRAME_MISMATCH
, "LAN and frame mismatch"},
162 {IPA_RC_SBP_IQD_NO_QDIO_QUEUES
, "QDIO queues not established"},
163 {IPA_RC_L2_UNSUPPORTED_CMD
, "Unsupported layer 2 command"},
164 {IPA_RC_L2_DUP_MAC
, "Duplicate MAC address"},
165 {IPA_RC_L2_ADDR_TABLE_FULL
, "Layer2 address table full"},
166 {IPA_RC_L2_DUP_LAYER3_MAC
, "Duplicate with layer 3 MAC"},
167 {IPA_RC_L2_GMAC_NOT_FOUND
, "GMAC not found"},
168 {IPA_RC_L2_MAC_NOT_AUTH_BY_HYP
, "L2 mac not authorized by hypervisor"},
169 {IPA_RC_L2_MAC_NOT_AUTH_BY_ADP
, "L2 mac not authorized by adapter"},
170 {IPA_RC_L2_MAC_NOT_FOUND
, "L2 mac address not found"},
171 {IPA_RC_L2_INVALID_VLAN_ID
, "L2 invalid vlan id"},
172 {IPA_RC_L2_DUP_VLAN_ID
, "L2 duplicate vlan id"},
173 {IPA_RC_L2_VLAN_ID_NOT_FOUND
, "L2 vlan id not found"},
174 {IPA_RC_VNICC_VNICBP
, "VNIC is BridgePort"},
175 {IPA_RC_SBP_OSA_NOT_CONFIGURED
, "Not configured for bridgeport"},
176 {IPA_RC_SBP_OSA_OS_MISMATCH
, "OS mismatch"},
177 {IPA_RC_SBP_OSA_ANO_DEV_PRIMARY
, "Primary bridgeport exists already"},
178 {IPA_RC_SBP_OSA_CURRENT_SECOND
, "Bridgeport is currently secondary"},
179 {IPA_RC_SBP_OSA_LIMIT_SECOND
, "Limit of secondary bridgeports reached"},
180 {IPA_RC_SBP_OSA_NOT_AUTHD_BY_ZMAN
, "Not authorized by zManager"},
181 {IPA_RC_SBP_OSA_CURRENT_PRIMARY
, "Bridgeport is currently primary"},
182 {IPA_RC_SBP_OSA_NO_QDIO_QUEUES
, "QDIO queues not established"},
183 {IPA_RC_DATA_MISMATCH
, "Data field mismatch (v4/v6 mixed)"},
184 {IPA_RC_INVALID_MTU_SIZE
, "Invalid MTU size"},
185 {IPA_RC_INVALID_LANTYPE
, "Invalid LAN type"},
186 {IPA_RC_INVALID_LANNUM
, "Invalid LAN num"},
187 {IPA_RC_DUPLICATE_IP_ADDRESS
, "Address already registered"},
188 {IPA_RC_IP_ADDR_TABLE_FULL
, "IP address table full"},
189 {IPA_RC_LAN_PORT_STATE_ERROR
, "LAN port state error"},
190 {IPA_RC_SETIP_NO_STARTLAN
, "Setip no startlan received"},
191 {IPA_RC_SETIP_ALREADY_RECEIVED
, "Setip already received"},
192 {IPA_RC_IP_ADDR_ALREADY_USED
, "IP address already in use on LAN"},
193 {IPA_RC_MC_ADDR_NOT_FOUND
, "Multicast address not found"},
194 {IPA_RC_SETIP_INVALID_VERSION
, "SETIP invalid IP version"},
195 {IPA_RC_UNSUPPORTED_SUBCMD
, "Unsupported assist subcommand"},
196 {IPA_RC_ARP_ASSIST_NO_ENABLE
, "Only partial success, no enable"},
197 {IPA_RC_PRIMARY_ALREADY_DEFINED
, "Primary already defined"},
198 {IPA_RC_SECOND_ALREADY_DEFINED
, "Secondary already defined"},
199 {IPA_RC_INVALID_SETRTG_INDICATOR
, "Invalid SETRTG indicator"},
200 {IPA_RC_MC_ADDR_ALREADY_DEFINED
, "Multicast address already defined"},
201 {IPA_RC_LAN_OFFLINE
, "STRTLAN_LAN_DISABLED - LAN offline"},
202 {IPA_RC_VEPA_TO_VEB_TRANSITION
, "Adj. switch disabled port mode RR"},
203 {IPA_RC_INVALID_IP_VERSION2
, "Invalid IP version"},
204 /* default for qeth_get_ipa_msg(): */
205 {IPA_RC_FFFF
, "Unknown Error"}
208 const char *qeth_get_ipa_msg(enum qeth_ipa_return_codes rc
)
212 for (x
= 0; x
< ARRAY_SIZE(qeth_ipa_rc_msg
) - 1; x
++)
213 if (qeth_ipa_rc_msg
[x
].rc
== rc
)
214 return qeth_ipa_rc_msg
[x
].msg
;
215 return qeth_ipa_rc_msg
[x
].msg
;
219 struct ipa_cmd_names
{
220 enum qeth_ipa_cmds cmd
;
224 static const struct ipa_cmd_names qeth_ipa_cmd_names
[] = {
225 {IPA_CMD_STARTLAN
, "startlan"},
226 {IPA_CMD_STOPLAN
, "stoplan"},
227 {IPA_CMD_SETVMAC
, "setvmac"},
228 {IPA_CMD_DELVMAC
, "delvmac"},
229 {IPA_CMD_SETGMAC
, "setgmac"},
230 {IPA_CMD_DELGMAC
, "delgmac"},
231 {IPA_CMD_SETVLAN
, "setvlan"},
232 {IPA_CMD_DELVLAN
, "delvlan"},
233 {IPA_CMD_VNICC
, "vnic_characteristics"},
234 {IPA_CMD_SETBRIDGEPORT_OSA
, "set_bridge_port(osa)"},
235 {IPA_CMD_SETCCID
, "setccid"},
236 {IPA_CMD_DELCCID
, "delccid"},
237 {IPA_CMD_MODCCID
, "modccid"},
238 {IPA_CMD_SETIP
, "setip"},
239 {IPA_CMD_QIPASSIST
, "qipassist"},
240 {IPA_CMD_SETASSPARMS
, "setassparms"},
241 {IPA_CMD_SETIPM
, "setipm"},
242 {IPA_CMD_DELIPM
, "delipm"},
243 {IPA_CMD_SETRTG
, "setrtg"},
244 {IPA_CMD_DELIP
, "delip"},
245 {IPA_CMD_SETADAPTERPARMS
, "setadapterparms"},
246 {IPA_CMD_SET_DIAG_ASS
, "set_diag_ass"},
247 {IPA_CMD_SETBRIDGEPORT_IQD
, "set_bridge_port(hs)"},
248 {IPA_CMD_CREATE_ADDR
, "create_addr"},
249 {IPA_CMD_DESTROY_ADDR
, "destroy_addr"},
250 {IPA_CMD_REGISTER_LOCAL_ADDR
, "register_local_addr"},
251 {IPA_CMD_UNREGISTER_LOCAL_ADDR
, "unregister_local_addr"},
252 {IPA_CMD_ADDRESS_CHANGE_NOTIF
, "address_change_notification"},
253 {IPA_CMD_UNKNOWN
, "unknown"},
256 const char *qeth_get_ipa_cmd_name(enum qeth_ipa_cmds cmd
)
260 for (x
= 0; x
< ARRAY_SIZE(qeth_ipa_cmd_names
) - 1; x
++)
261 if (qeth_ipa_cmd_names
[x
].cmd
== cmd
)
262 return qeth_ipa_cmd_names
[x
].name
;
263 return qeth_ipa_cmd_names
[x
].name
;