Linux Audio

Check our new training course

Loading...
v3.1
  1/*
  2 *  drivers/s390/net/qeth_core_mpc.c
  3 *
  4 *    Copyright IBM Corp. 2007
  5 *    Author(s): Frank Pavlic <fpavlic@de.ibm.com>,
  6 *		 Thomas Spatzier <tspat@de.ibm.com>,
  7 *		 Frank Blaschka <frank.blaschka@de.ibm.com>
  8 */
  9
 10#include <linux/module.h>
 11#include <asm/cio.h>
 12#include "qeth_core_mpc.h"
 13
 14unsigned char IDX_ACTIVATE_READ[] = {
 15	0x00, 0x00, 0x80, 0x00,  0x00, 0x00, 0x00, 0x00,
 16	0x19, 0x01, 0x01, 0x80,  0x00, 0x00, 0x00, 0x00,
 17	0x00, 0x00, 0x00, 0x00,  0x00, 0x00, 0xc8, 0xc1,
 18	0xd3, 0xd3, 0xd6, 0xd3,  0xc5, 0x40, 0x00, 0x00,
 19	0x00, 0x00
 20};
 21
 22unsigned char IDX_ACTIVATE_WRITE[] = {
 23	0x00, 0x00, 0x80, 0x00,  0x00, 0x00, 0x00, 0x00,
 24	0x15, 0x01, 0x01, 0x80,  0x00, 0x00, 0x00, 0x00,
 25	0xff, 0xff, 0x00, 0x00,  0x00, 0x00, 0xc8, 0xc1,
 26	0xd3, 0xd3, 0xd6, 0xd3,  0xc5, 0x40, 0x00, 0x00,
 27	0x00, 0x00
 28};
 29
 30unsigned char CM_ENABLE[] = {
 31	0x00, 0xe0, 0x00, 0x00,  0x00, 0x00, 0x00, 0x01,
 32	0x00, 0x00, 0x00, 0x14,  0x00, 0x00, 0x00, 0x63,
 33	0x10, 0x00, 0x00, 0x01,
 34	0x00, 0x00, 0x00, 0x00,
 35	0x81, 0x7e, 0x00, 0x01,  0x00, 0x00, 0x00, 0x00,
 36	0x00, 0x00, 0x00, 0x00,  0x00, 0x24, 0x00, 0x23,
 37	0x00, 0x00, 0x23, 0x05,  0x00, 0x00, 0x00, 0x00,
 38	0x00, 0x00, 0x00, 0x00,  0x00, 0x00, 0x00, 0x00,
 39	0x01, 0x00, 0x00, 0x23,  0x00, 0x00, 0x00, 0x40,
 40	0x00, 0x0c, 0x41, 0x02,  0x00, 0x17, 0x00, 0x00,
 41	0x00, 0x00, 0x00, 0x00,
 42	0x00, 0x0b, 0x04, 0x01,
 43	0x7e, 0x04, 0x05, 0x00,  0x01, 0x01, 0x0f,
 44	0x00,
 45	0x0c, 0x04, 0x02, 0xff,  0xff, 0xff, 0xff, 0xff,
 46	0xff, 0xff, 0xff
 47};
 48
 49unsigned char CM_SETUP[] = {
 50	0x00, 0xe0, 0x00, 0x00,  0x00, 0x00, 0x00, 0x02,
 51	0x00, 0x00, 0x00, 0x14,  0x00, 0x00, 0x00, 0x64,
 52	0x10, 0x00, 0x00, 0x01,
 53	0x00, 0x00, 0x00, 0x00,
 54	0x81, 0x7e, 0x00, 0x01,  0x00, 0x00, 0x00, 0x00,
 55	0x00, 0x00, 0x00, 0x00,  0x00, 0x24, 0x00, 0x24,
 56	0x00, 0x00, 0x24, 0x05,  0x00, 0x00, 0x00, 0x00,
 57	0x00, 0x00, 0x00, 0x00,  0x00, 0x00, 0x00, 0x00,
 58	0x01, 0x00, 0x00, 0x24,  0x00, 0x00, 0x00, 0x40,
 59	0x00, 0x0c, 0x41, 0x04,  0x00, 0x18, 0x00, 0x00,
 60	0x00, 0x00, 0x00, 0x00,
 61	0x00, 0x09, 0x04, 0x04,
 62	0x05, 0x00, 0x01, 0x01,  0x11,
 63	0x00, 0x09, 0x04,
 64	0x05, 0x05, 0x00, 0x00,  0x00, 0x00,
 65	0x00, 0x06,
 66	0x04, 0x06, 0xc8, 0x00
 67};
 68
 69unsigned char ULP_ENABLE[] = {
 70	0x00, 0xe0, 0x00, 0x00,  0x00, 0x00, 0x00, 0x03,
 71	0x00, 0x00, 0x00, 0x14,  0x00, 0x00, 0x00, 0x6b,
 72	0x10, 0x00, 0x00, 0x01,
 73	0x00, 0x00, 0x00, 0x00,
 74	0x41, 0x7e, 0x00, 0x01,  0x00, 0x00, 0x00, 0x01,
 75	0x00, 0x00, 0x00, 0x00,  0x00, 0x24, 0x00, 0x2b,
 76	0x00, 0x00, 0x2b, 0x05,  0x20, 0x01, 0x00, 0x00,
 77	0x00, 0x00, 0x00, 0x00,  0x00, 0x00, 0x00, 0x00,
 78	0x01, 0x00, 0x00, 0x2b,  0x00, 0x00, 0x00, 0x40,
 79	0x00, 0x0c, 0x41, 0x02,  0x00, 0x1f, 0x00, 0x00,
 80	0x00, 0x00, 0x00, 0x00,
 81	0x00, 0x0b, 0x04, 0x01,
 82	0x03, 0x04, 0x05, 0x00,  0x01, 0x01, 0x12,
 83	0x00,
 84	0x14, 0x04, 0x0a, 0x00,  0x20, 0x00, 0x00, 0xff,
 85	0xff, 0x00, 0x08, 0xc8,  0xe8, 0xc4, 0xf1, 0xc7,
 86	0xf1, 0x00, 0x00
 87};
 88
 89unsigned char ULP_SETUP[] = {
 90	0x00, 0xe0, 0x00, 0x00,  0x00, 0x00, 0x00, 0x04,
 91	0x00, 0x00, 0x00, 0x14,  0x00, 0x00, 0x00, 0x6c,
 92	0x10, 0x00, 0x00, 0x01,
 93	0x00, 0x00, 0x00, 0x00,
 94	0x41, 0x7e, 0x00, 0x01,  0x00, 0x00, 0x00, 0x02,
 95	0x00, 0x00, 0x00, 0x01,  0x00, 0x24, 0x00, 0x2c,
 96	0x00, 0x00, 0x2c, 0x05,  0x20, 0x01, 0x00, 0x00,
 97	0x00, 0x00, 0x00, 0x00,  0x00, 0x00, 0x00, 0x00,
 98	0x01, 0x00, 0x00, 0x2c,  0x00, 0x00, 0x00, 0x40,
 99	0x00, 0x0c, 0x41, 0x04,  0x00, 0x20, 0x00, 0x00,
100	0x00, 0x00, 0x00, 0x00,
101	0x00, 0x09, 0x04, 0x04,
102	0x05, 0x00, 0x01, 0x01,  0x14,
103	0x00, 0x09, 0x04,
104	0x05, 0x05, 0x30, 0x01,  0x00, 0x00,
105	0x00, 0x06,
106	0x04, 0x06, 0x40, 0x00,
107	0x00, 0x08, 0x04, 0x0b,
108	0x00, 0x00, 0x00, 0x00
109};
110
111unsigned char DM_ACT[] = {
112	0x00, 0xe0, 0x00, 0x00,  0x00, 0x00, 0x00, 0x05,
113	0x00, 0x00, 0x00, 0x14,  0x00, 0x00, 0x00, 0x55,
114	0x10, 0x00, 0x00, 0x01,
115	0x00, 0x00, 0x00, 0x00,
116	0x41, 0x7e, 0x00, 0x01,  0x00, 0x00, 0x00, 0x03,
117	0x00, 0x00, 0x00, 0x02,  0x00, 0x24, 0x00, 0x15,
118	0x00, 0x00, 0x2c, 0x05,  0x20, 0x01, 0x00, 0x00,
119	0x00, 0x00, 0x00, 0x00,  0x00, 0x00, 0x00, 0x00,
120	0x01, 0x00, 0x00, 0x15,  0x00, 0x00, 0x00, 0x40,
121	0x00, 0x0c, 0x43, 0x60,  0x00, 0x09, 0x00, 0x00,
122	0x00, 0x00, 0x00, 0x00,
123	0x00, 0x09, 0x04, 0x04,
124	0x05, 0x40, 0x01, 0x01,  0x00
125};
126
127unsigned char IPA_PDU_HEADER[] = {
128	0x00, 0xe0, 0x00, 0x00,  0x77, 0x77, 0x77, 0x77,
129	0x00, 0x00, 0x00, 0x14,  0x00, 0x00,
130		(IPA_PDU_HEADER_SIZE+sizeof(struct qeth_ipa_cmd)) / 256,
131		(IPA_PDU_HEADER_SIZE+sizeof(struct qeth_ipa_cmd)) % 256,
132	0x10, 0x00, 0x00, 0x01,  0x00, 0x00, 0x00, 0x00,
133	0xc1, 0x03, 0x00, 0x01,  0x00, 0x00, 0x00, 0x00,
134	0x00, 0x00, 0x00, 0x00,  0x00, 0x24,
135		sizeof(struct qeth_ipa_cmd) / 256,
136		sizeof(struct qeth_ipa_cmd) % 256,
137	0x00,
138		sizeof(struct qeth_ipa_cmd) / 256,
139		sizeof(struct qeth_ipa_cmd) % 256,
140	0x05,
141	0x77, 0x77, 0x77, 0x77,
142	0x00, 0x00, 0x00, 0x00,  0x00, 0x00, 0x00, 0x00,
143	0x01, 0x00,
144		sizeof(struct qeth_ipa_cmd) / 256,
145		sizeof(struct qeth_ipa_cmd) % 256,
146	0x00, 0x00, 0x00, 0x40,
147};
148EXPORT_SYMBOL_GPL(IPA_PDU_HEADER);
149
150unsigned char WRITE_CCW[] = {
151	0x01, CCW_FLAG_SLI, 0, 0,
152	0, 0, 0, 0
153};
154
155unsigned char READ_CCW[] = {
156	0x02, CCW_FLAG_SLI, 0, 0,
157	0, 0, 0, 0
158};
159
160
161struct ipa_rc_msg {
162	enum qeth_ipa_return_codes rc;
163	char *msg;
164};
165
166static struct ipa_rc_msg qeth_ipa_rc_msg[] = {
167	{IPA_RC_SUCCESS,		"success"},
168	{IPA_RC_NOTSUPP,		"Command not supported"},
169	{IPA_RC_IP_TABLE_FULL,		"Add Addr IP Table Full - ipv6"},
170	{IPA_RC_UNKNOWN_ERROR,		"IPA command failed - reason unknown"},
171	{IPA_RC_UNSUPPORTED_COMMAND,	"Command not supported"},
172	{IPA_RC_DUP_IPV6_REMOTE, "ipv6 address already registered remote"},
173	{IPA_RC_DUP_IPV6_HOME,		"ipv6 address already registered"},
174	{IPA_RC_UNREGISTERED_ADDR,	"Address not registered"},
175	{IPA_RC_NO_ID_AVAILABLE,	"No identifiers available"},
176	{IPA_RC_ID_NOT_FOUND,		"Identifier not found"},
177	{IPA_RC_INVALID_IP_VERSION,	"IP version incorrect"},
178	{IPA_RC_LAN_FRAME_MISMATCH,	"LAN and frame mismatch"},
179	{IPA_RC_L2_UNSUPPORTED_CMD,	"Unsupported layer 2 command"},
180	{IPA_RC_L2_DUP_MAC,		"Duplicate MAC address"},
181	{IPA_RC_L2_ADDR_TABLE_FULL,	"Layer2 address table full"},
182	{IPA_RC_L2_DUP_LAYER3_MAC,	"Duplicate with layer 3 MAC"},
183	{IPA_RC_L2_GMAC_NOT_FOUND,	"GMAC not found"},
184	{IPA_RC_L2_MAC_NOT_AUTH_BY_HYP,	"L2 mac not authorized by hypervisor"},
185	{IPA_RC_L2_MAC_NOT_AUTH_BY_ADP,	"L2 mac not authorized by adapter"},
186	{IPA_RC_L2_MAC_NOT_FOUND,	"L2 mac address not found"},
187	{IPA_RC_L2_INVALID_VLAN_ID,	"L2 invalid vlan id"},
188	{IPA_RC_L2_DUP_VLAN_ID,		"L2 duplicate vlan id"},
189	{IPA_RC_L2_VLAN_ID_NOT_FOUND,	"L2 vlan id not found"},
190	{IPA_RC_DATA_MISMATCH,		"Data field mismatch (v4/v6 mixed)"},
191	{IPA_RC_INVALID_MTU_SIZE,	"Invalid MTU size"},
192	{IPA_RC_INVALID_LANTYPE,	"Invalid LAN type"},
193	{IPA_RC_INVALID_LANNUM,		"Invalid LAN num"},
194	{IPA_RC_DUPLICATE_IP_ADDRESS,	"Address already registered"},
195	{IPA_RC_IP_ADDR_TABLE_FULL,	"IP address table full"},
196	{IPA_RC_LAN_PORT_STATE_ERROR,	"LAN port state error"},
197	{IPA_RC_SETIP_NO_STARTLAN,	"Setip no startlan received"},
198	{IPA_RC_SETIP_ALREADY_RECEIVED,	"Setip already received"},
199	{IPA_RC_IP_ADDR_ALREADY_USED,	"IP address already in use on LAN"},
200	{IPA_RC_MC_ADDR_NOT_FOUND,	"Multicast address not found"},
201	{IPA_RC_SETIP_INVALID_VERSION,	"SETIP invalid IP version"},
202	{IPA_RC_UNSUPPORTED_SUBCMD,	"Unsupported assist subcommand"},
203	{IPA_RC_ARP_ASSIST_NO_ENABLE,	"Only partial success, no enable"},
204	{IPA_RC_PRIMARY_ALREADY_DEFINED, "Primary already defined"},
205	{IPA_RC_SECOND_ALREADY_DEFINED,	"Secondary already defined"},
206	{IPA_RC_INVALID_SETRTG_INDICATOR, "Invalid SETRTG indicator"},
207	{IPA_RC_MC_ADDR_ALREADY_DEFINED, "Multicast address already defined"},
208	{IPA_RC_LAN_OFFLINE,		"STRTLAN_LAN_DISABLED - LAN offline"},
 
209	{IPA_RC_INVALID_IP_VERSION2,	"Invalid IP version"},
 
210	{IPA_RC_FFFF,			"Unknown Error"}
211};
212
213
214
215char *qeth_get_ipa_msg(enum qeth_ipa_return_codes rc)
216{
217	int x = 0;
218	qeth_ipa_rc_msg[sizeof(qeth_ipa_rc_msg) /
219			sizeof(struct ipa_rc_msg) - 1].rc = rc;
220	while (qeth_ipa_rc_msg[x].rc != rc)
221		x++;
222	return qeth_ipa_rc_msg[x].msg;
223}
224
225
226struct ipa_cmd_names {
227	enum qeth_ipa_cmds cmd;
228	char *name;
229};
230
231static struct ipa_cmd_names qeth_ipa_cmd_names[] = {
232	{IPA_CMD_STARTLAN,	"startlan"},
233	{IPA_CMD_STOPLAN,	"stoplan"},
234	{IPA_CMD_SETVMAC,	"setvmac"},
235	{IPA_CMD_DELVMAC,	"delvmac"},
236	{IPA_CMD_SETGMAC,	"setgmac"},
237	{IPA_CMD_DELGMAC,	"delgmac"},
238	{IPA_CMD_SETVLAN,	"setvlan"},
239	{IPA_CMD_DELVLAN,	"delvlan"},
 
240	{IPA_CMD_SETCCID,	"setccid"},
241	{IPA_CMD_DELCCID,	"delccid"},
242	{IPA_CMD_MODCCID,	"modccid"},
243	{IPA_CMD_SETIP,		"setip"},
244	{IPA_CMD_QIPASSIST,	"qipassist"},
245	{IPA_CMD_SETASSPARMS,	"setassparms"},
246	{IPA_CMD_SETIPM,	"setipm"},
247	{IPA_CMD_DELIPM,	"delipm"},
248	{IPA_CMD_SETRTG,	"setrtg"},
249	{IPA_CMD_DELIP,		"delip"},
250	{IPA_CMD_SETADAPTERPARMS, "setadapterparms"},
251	{IPA_CMD_SET_DIAG_ASS,	"set_diag_ass"},
 
252	{IPA_CMD_CREATE_ADDR,	"create_addr"},
253	{IPA_CMD_DESTROY_ADDR,	"destroy_addr"},
254	{IPA_CMD_REGISTER_LOCAL_ADDR,	"register_local_addr"},
255	{IPA_CMD_UNREGISTER_LOCAL_ADDR,	"unregister_local_addr"},
 
256	{IPA_CMD_UNKNOWN,	"unknown"},
257};
258
259char *qeth_get_ipa_cmd_name(enum qeth_ipa_cmds cmd)
260{
261	int x = 0;
262	qeth_ipa_cmd_names[
263		sizeof(qeth_ipa_cmd_names) /
264			sizeof(struct ipa_cmd_names)-1].cmd = cmd;
265	while (qeth_ipa_cmd_names[x].cmd != cmd)
266		x++;
267	return qeth_ipa_cmd_names[x].name;
268}
v4.10.11
  1/*
 
 
  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#include <linux/module.h>
  9#include <asm/cio.h>
 10#include "qeth_core_mpc.h"
 11
 12unsigned char IDX_ACTIVATE_READ[] = {
 13	0x00, 0x00, 0x80, 0x00,  0x00, 0x00, 0x00, 0x00,
 14	0x19, 0x01, 0x01, 0x80,  0x00, 0x00, 0x00, 0x00,
 15	0x00, 0x00, 0x00, 0x00,  0x00, 0x00, 0xc8, 0xc1,
 16	0xd3, 0xd3, 0xd6, 0xd3,  0xc5, 0x40, 0x00, 0x00,
 17	0x00, 0x00
 18};
 19
 20unsigned char IDX_ACTIVATE_WRITE[] = {
 21	0x00, 0x00, 0x80, 0x00,  0x00, 0x00, 0x00, 0x00,
 22	0x15, 0x01, 0x01, 0x80,  0x00, 0x00, 0x00, 0x00,
 23	0xff, 0xff, 0x00, 0x00,  0x00, 0x00, 0xc8, 0xc1,
 24	0xd3, 0xd3, 0xd6, 0xd3,  0xc5, 0x40, 0x00, 0x00,
 25	0x00, 0x00
 26};
 27
 28unsigned char CM_ENABLE[] = {
 29	0x00, 0xe0, 0x00, 0x00,  0x00, 0x00, 0x00, 0x01,
 30	0x00, 0x00, 0x00, 0x14,  0x00, 0x00, 0x00, 0x63,
 31	0x10, 0x00, 0x00, 0x01,
 32	0x00, 0x00, 0x00, 0x00,
 33	0x81, 0x7e, 0x00, 0x01,  0x00, 0x00, 0x00, 0x00,
 34	0x00, 0x00, 0x00, 0x00,  0x00, 0x24, 0x00, 0x23,
 35	0x00, 0x00, 0x23, 0x05,  0x00, 0x00, 0x00, 0x00,
 36	0x00, 0x00, 0x00, 0x00,  0x00, 0x00, 0x00, 0x00,
 37	0x01, 0x00, 0x00, 0x23,  0x00, 0x00, 0x00, 0x40,
 38	0x00, 0x0c, 0x41, 0x02,  0x00, 0x17, 0x00, 0x00,
 39	0x00, 0x00, 0x00, 0x00,
 40	0x00, 0x0b, 0x04, 0x01,
 41	0x7e, 0x04, 0x05, 0x00,  0x01, 0x01, 0x0f,
 42	0x00,
 43	0x0c, 0x04, 0x02, 0xff,  0xff, 0xff, 0xff, 0xff,
 44	0xff, 0xff, 0xff
 45};
 46
 47unsigned char CM_SETUP[] = {
 48	0x00, 0xe0, 0x00, 0x00,  0x00, 0x00, 0x00, 0x02,
 49	0x00, 0x00, 0x00, 0x14,  0x00, 0x00, 0x00, 0x64,
 50	0x10, 0x00, 0x00, 0x01,
 51	0x00, 0x00, 0x00, 0x00,
 52	0x81, 0x7e, 0x00, 0x01,  0x00, 0x00, 0x00, 0x00,
 53	0x00, 0x00, 0x00, 0x00,  0x00, 0x24, 0x00, 0x24,
 54	0x00, 0x00, 0x24, 0x05,  0x00, 0x00, 0x00, 0x00,
 55	0x00, 0x00, 0x00, 0x00,  0x00, 0x00, 0x00, 0x00,
 56	0x01, 0x00, 0x00, 0x24,  0x00, 0x00, 0x00, 0x40,
 57	0x00, 0x0c, 0x41, 0x04,  0x00, 0x18, 0x00, 0x00,
 58	0x00, 0x00, 0x00, 0x00,
 59	0x00, 0x09, 0x04, 0x04,
 60	0x05, 0x00, 0x01, 0x01,  0x11,
 61	0x00, 0x09, 0x04,
 62	0x05, 0x05, 0x00, 0x00,  0x00, 0x00,
 63	0x00, 0x06,
 64	0x04, 0x06, 0xc8, 0x00
 65};
 66
 67unsigned char ULP_ENABLE[] = {
 68	0x00, 0xe0, 0x00, 0x00,  0x00, 0x00, 0x00, 0x03,
 69	0x00, 0x00, 0x00, 0x14,  0x00, 0x00, 0x00, 0x6b,
 70	0x10, 0x00, 0x00, 0x01,
 71	0x00, 0x00, 0x00, 0x00,
 72	0x41, 0x7e, 0x00, 0x01,  0x00, 0x00, 0x00, 0x01,
 73	0x00, 0x00, 0x00, 0x00,  0x00, 0x24, 0x00, 0x2b,
 74	0x00, 0x00, 0x2b, 0x05,  0x20, 0x01, 0x00, 0x00,
 75	0x00, 0x00, 0x00, 0x00,  0x00, 0x00, 0x00, 0x00,
 76	0x01, 0x00, 0x00, 0x2b,  0x00, 0x00, 0x00, 0x40,
 77	0x00, 0x0c, 0x41, 0x02,  0x00, 0x1f, 0x00, 0x00,
 78	0x00, 0x00, 0x00, 0x00,
 79	0x00, 0x0b, 0x04, 0x01,
 80	0x03, 0x04, 0x05, 0x00,  0x01, 0x01, 0x12,
 81	0x00,
 82	0x14, 0x04, 0x0a, 0x00,  0x20, 0x00, 0x00, 0xff,
 83	0xff, 0x00, 0x08, 0xc8,  0xe8, 0xc4, 0xf1, 0xc7,
 84	0xf1, 0x00, 0x00
 85};
 86
 87unsigned char ULP_SETUP[] = {
 88	0x00, 0xe0, 0x00, 0x00,  0x00, 0x00, 0x00, 0x04,
 89	0x00, 0x00, 0x00, 0x14,  0x00, 0x00, 0x00, 0x6c,
 90	0x10, 0x00, 0x00, 0x01,
 91	0x00, 0x00, 0x00, 0x00,
 92	0x41, 0x7e, 0x00, 0x01,  0x00, 0x00, 0x00, 0x02,
 93	0x00, 0x00, 0x00, 0x01,  0x00, 0x24, 0x00, 0x2c,
 94	0x00, 0x00, 0x2c, 0x05,  0x20, 0x01, 0x00, 0x00,
 95	0x00, 0x00, 0x00, 0x00,  0x00, 0x00, 0x00, 0x00,
 96	0x01, 0x00, 0x00, 0x2c,  0x00, 0x00, 0x00, 0x40,
 97	0x00, 0x0c, 0x41, 0x04,  0x00, 0x20, 0x00, 0x00,
 98	0x00, 0x00, 0x00, 0x00,
 99	0x00, 0x09, 0x04, 0x04,
100	0x05, 0x00, 0x01, 0x01,  0x14,
101	0x00, 0x09, 0x04,
102	0x05, 0x05, 0x30, 0x01,  0x00, 0x00,
103	0x00, 0x06,
104	0x04, 0x06, 0x40, 0x00,
105	0x00, 0x08, 0x04, 0x0b,
106	0x00, 0x00, 0x00, 0x00
107};
108
109unsigned char DM_ACT[] = {
110	0x00, 0xe0, 0x00, 0x00,  0x00, 0x00, 0x00, 0x05,
111	0x00, 0x00, 0x00, 0x14,  0x00, 0x00, 0x00, 0x55,
112	0x10, 0x00, 0x00, 0x01,
113	0x00, 0x00, 0x00, 0x00,
114	0x41, 0x7e, 0x00, 0x01,  0x00, 0x00, 0x00, 0x03,
115	0x00, 0x00, 0x00, 0x02,  0x00, 0x24, 0x00, 0x15,
116	0x00, 0x00, 0x2c, 0x05,  0x20, 0x01, 0x00, 0x00,
117	0x00, 0x00, 0x00, 0x00,  0x00, 0x00, 0x00, 0x00,
118	0x01, 0x00, 0x00, 0x15,  0x00, 0x00, 0x00, 0x40,
119	0x00, 0x0c, 0x43, 0x60,  0x00, 0x09, 0x00, 0x00,
120	0x00, 0x00, 0x00, 0x00,
121	0x00, 0x09, 0x04, 0x04,
122	0x05, 0x40, 0x01, 0x01,  0x00
123};
124
125unsigned char IPA_PDU_HEADER[] = {
126	0x00, 0xe0, 0x00, 0x00,  0x77, 0x77, 0x77, 0x77,
127	0x00, 0x00, 0x00, 0x14,  0x00, 0x00,
128		(IPA_PDU_HEADER_SIZE+sizeof(struct qeth_ipa_cmd)) / 256,
129		(IPA_PDU_HEADER_SIZE+sizeof(struct qeth_ipa_cmd)) % 256,
130	0x10, 0x00, 0x00, 0x01,  0x00, 0x00, 0x00, 0x00,
131	0xc1, 0x03, 0x00, 0x01,  0x00, 0x00, 0x00, 0x00,
132	0x00, 0x00, 0x00, 0x00,  0x00, 0x24,
133		sizeof(struct qeth_ipa_cmd) / 256,
134		sizeof(struct qeth_ipa_cmd) % 256,
135	0x00,
136		sizeof(struct qeth_ipa_cmd) / 256,
137		sizeof(struct qeth_ipa_cmd) % 256,
138	0x05,
139	0x77, 0x77, 0x77, 0x77,
140	0x00, 0x00, 0x00, 0x00,  0x00, 0x00, 0x00, 0x00,
141	0x01, 0x00,
142		sizeof(struct qeth_ipa_cmd) / 256,
143		sizeof(struct qeth_ipa_cmd) % 256,
144	0x00, 0x00, 0x00, 0x40,
145};
146EXPORT_SYMBOL_GPL(IPA_PDU_HEADER);
147
148unsigned char WRITE_CCW[] = {
149	0x01, CCW_FLAG_SLI, 0, 0,
150	0, 0, 0, 0
151};
152
153unsigned char READ_CCW[] = {
154	0x02, CCW_FLAG_SLI, 0, 0,
155	0, 0, 0, 0
156};
157
158
159struct ipa_rc_msg {
160	enum qeth_ipa_return_codes rc;
161	char *msg;
162};
163
164static struct ipa_rc_msg qeth_ipa_rc_msg[] = {
165	{IPA_RC_SUCCESS,		"success"},
166	{IPA_RC_NOTSUPP,		"Command not supported"},
167	{IPA_RC_IP_TABLE_FULL,		"Add Addr IP Table Full - ipv6"},
168	{IPA_RC_UNKNOWN_ERROR,		"IPA command failed - reason unknown"},
169	{IPA_RC_UNSUPPORTED_COMMAND,	"Command not supported"},
170	{IPA_RC_DUP_IPV6_REMOTE, "ipv6 address already registered remote"},
171	{IPA_RC_DUP_IPV6_HOME,		"ipv6 address already registered"},
172	{IPA_RC_UNREGISTERED_ADDR,	"Address not registered"},
173	{IPA_RC_NO_ID_AVAILABLE,	"No identifiers available"},
174	{IPA_RC_ID_NOT_FOUND,		"Identifier not found"},
175	{IPA_RC_INVALID_IP_VERSION,	"IP version incorrect"},
176	{IPA_RC_LAN_FRAME_MISMATCH,	"LAN and frame mismatch"},
177	{IPA_RC_L2_UNSUPPORTED_CMD,	"Unsupported layer 2 command"},
178	{IPA_RC_L2_DUP_MAC,		"Duplicate MAC address"},
179	{IPA_RC_L2_ADDR_TABLE_FULL,	"Layer2 address table full"},
180	{IPA_RC_L2_DUP_LAYER3_MAC,	"Duplicate with layer 3 MAC"},
181	{IPA_RC_L2_GMAC_NOT_FOUND,	"GMAC not found"},
182	{IPA_RC_L2_MAC_NOT_AUTH_BY_HYP,	"L2 mac not authorized by hypervisor"},
183	{IPA_RC_L2_MAC_NOT_AUTH_BY_ADP,	"L2 mac not authorized by adapter"},
184	{IPA_RC_L2_MAC_NOT_FOUND,	"L2 mac address not found"},
185	{IPA_RC_L2_INVALID_VLAN_ID,	"L2 invalid vlan id"},
186	{IPA_RC_L2_DUP_VLAN_ID,		"L2 duplicate vlan id"},
187	{IPA_RC_L2_VLAN_ID_NOT_FOUND,	"L2 vlan id not found"},
188	{IPA_RC_DATA_MISMATCH,		"Data field mismatch (v4/v6 mixed)"},
189	{IPA_RC_INVALID_MTU_SIZE,	"Invalid MTU size"},
190	{IPA_RC_INVALID_LANTYPE,	"Invalid LAN type"},
191	{IPA_RC_INVALID_LANNUM,		"Invalid LAN num"},
192	{IPA_RC_DUPLICATE_IP_ADDRESS,	"Address already registered"},
193	{IPA_RC_IP_ADDR_TABLE_FULL,	"IP address table full"},
194	{IPA_RC_LAN_PORT_STATE_ERROR,	"LAN port state error"},
195	{IPA_RC_SETIP_NO_STARTLAN,	"Setip no startlan received"},
196	{IPA_RC_SETIP_ALREADY_RECEIVED,	"Setip already received"},
197	{IPA_RC_IP_ADDR_ALREADY_USED,	"IP address already in use on LAN"},
198	{IPA_RC_MC_ADDR_NOT_FOUND,	"Multicast address not found"},
199	{IPA_RC_SETIP_INVALID_VERSION,	"SETIP invalid IP version"},
200	{IPA_RC_UNSUPPORTED_SUBCMD,	"Unsupported assist subcommand"},
201	{IPA_RC_ARP_ASSIST_NO_ENABLE,	"Only partial success, no enable"},
202	{IPA_RC_PRIMARY_ALREADY_DEFINED, "Primary already defined"},
203	{IPA_RC_SECOND_ALREADY_DEFINED,	"Secondary already defined"},
204	{IPA_RC_INVALID_SETRTG_INDICATOR, "Invalid SETRTG indicator"},
205	{IPA_RC_MC_ADDR_ALREADY_DEFINED, "Multicast address already defined"},
206	{IPA_RC_LAN_OFFLINE,		"STRTLAN_LAN_DISABLED - LAN offline"},
207	{IPA_RC_VEPA_TO_VEB_TRANSITION,	"Adj. switch disabled port mode RR"},
208	{IPA_RC_INVALID_IP_VERSION2,	"Invalid IP version"},
209	{IPA_RC_ENOMEM,			"Memory problem"},
210	{IPA_RC_FFFF,			"Unknown Error"}
211};
212
213
214
215char *qeth_get_ipa_msg(enum qeth_ipa_return_codes rc)
216{
217	int x = 0;
218	qeth_ipa_rc_msg[sizeof(qeth_ipa_rc_msg) /
219			sizeof(struct ipa_rc_msg) - 1].rc = rc;
220	while (qeth_ipa_rc_msg[x].rc != rc)
221		x++;
222	return qeth_ipa_rc_msg[x].msg;
223}
224
225
226struct ipa_cmd_names {
227	enum qeth_ipa_cmds cmd;
228	char *name;
229};
230
231static struct ipa_cmd_names qeth_ipa_cmd_names[] = {
232	{IPA_CMD_STARTLAN,	"startlan"},
233	{IPA_CMD_STOPLAN,	"stoplan"},
234	{IPA_CMD_SETVMAC,	"setvmac"},
235	{IPA_CMD_DELVMAC,	"delvmac"},
236	{IPA_CMD_SETGMAC,	"setgmac"},
237	{IPA_CMD_DELGMAC,	"delgmac"},
238	{IPA_CMD_SETVLAN,	"setvlan"},
239	{IPA_CMD_DELVLAN,	"delvlan"},
240	{IPA_CMD_SETBRIDGEPORT_OSA,	"set_bridge_port(osa)"},
241	{IPA_CMD_SETCCID,	"setccid"},
242	{IPA_CMD_DELCCID,	"delccid"},
243	{IPA_CMD_MODCCID,	"modccid"},
244	{IPA_CMD_SETIP,		"setip"},
245	{IPA_CMD_QIPASSIST,	"qipassist"},
246	{IPA_CMD_SETASSPARMS,	"setassparms"},
247	{IPA_CMD_SETIPM,	"setipm"},
248	{IPA_CMD_DELIPM,	"delipm"},
249	{IPA_CMD_SETRTG,	"setrtg"},
250	{IPA_CMD_DELIP,		"delip"},
251	{IPA_CMD_SETADAPTERPARMS, "setadapterparms"},
252	{IPA_CMD_SET_DIAG_ASS,	"set_diag_ass"},
253	{IPA_CMD_SETBRIDGEPORT_IQD,	"set_bridge_port(hs)"},
254	{IPA_CMD_CREATE_ADDR,	"create_addr"},
255	{IPA_CMD_DESTROY_ADDR,	"destroy_addr"},
256	{IPA_CMD_REGISTER_LOCAL_ADDR,	"register_local_addr"},
257	{IPA_CMD_UNREGISTER_LOCAL_ADDR,	"unregister_local_addr"},
258	{IPA_CMD_ADDRESS_CHANGE_NOTIF, "address_change_notification"},
259	{IPA_CMD_UNKNOWN,	"unknown"},
260};
261
262char *qeth_get_ipa_cmd_name(enum qeth_ipa_cmds cmd)
263{
264	int x = 0;
265	qeth_ipa_cmd_names[
266		sizeof(qeth_ipa_cmd_names) /
267			sizeof(struct ipa_cmd_names)-1].cmd = cmd;
268	while (qeth_ipa_cmd_names[x].cmd != cmd)
269		x++;
270	return qeth_ipa_cmd_names[x].name;
271}