xref: /openbmc/linux/drivers/s390/net/qeth_core_mpc.h (revision 1406f0f3)
1 /* SPDX-License-Identifier: GPL-2.0 */
2 /*
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>
7  */
8 
9 #ifndef __QETH_CORE_MPC_H__
10 #define __QETH_CORE_MPC_H__
11 
12 #include <asm/qeth.h>
13 #include <uapi/linux/if_ether.h>
14 #include <uapi/linux/in6.h>
15 
16 extern const unsigned char IPA_PDU_HEADER[];
17 #define IPA_PDU_HEADER_SIZE	0x40
18 #define QETH_IPA_PDU_LEN_TOTAL(buffer) (buffer + 0x0e)
19 #define QETH_IPA_PDU_LEN_PDU1(buffer) (buffer + 0x26)
20 #define QETH_IPA_PDU_LEN_PDU2(buffer) (buffer + 0x29)
21 #define QETH_IPA_PDU_LEN_PDU3(buffer) (buffer + 0x3a)
22 
23 #define QETH_IPA_CMD_DEST_ADDR(buffer) (buffer + 0x2c)
24 
25 #define QETH_SEQ_NO_LENGTH	4
26 #define QETH_MPC_TOKEN_LENGTH	4
27 #define QETH_MCL_LENGTH		4
28 
29 #define QETH_TIMEOUT		(10 * HZ)
30 #define QETH_IPA_TIMEOUT	(45 * HZ)
31 
32 /*****************************************************************************/
33 /* IP Assist related definitions                                             */
34 /*****************************************************************************/
35 #define IPA_CMD_INITIATOR_HOST  0x00
36 #define IPA_CMD_INITIATOR_OSA   0x01
37 #define IPA_CMD_INITIATOR_HOST_REPLY  0x80
38 #define IPA_CMD_INITIATOR_OSA_REPLY   0x81
39 #define IPA_CMD_PRIM_VERSION_NO 0x01
40 
41 struct qeth_ipa_caps {
42 	u32 supported;
43 	u32 enabled;
44 };
45 
46 static inline bool qeth_ipa_caps_supported(struct qeth_ipa_caps *caps, u32 mask)
47 {
48 	return (caps->supported & mask) == mask;
49 }
50 
51 static inline bool qeth_ipa_caps_enabled(struct qeth_ipa_caps *caps, u32 mask)
52 {
53 	return (caps->enabled & mask) == mask;
54 }
55 
56 #define qeth_adp_supported(c, f) \
57 	qeth_ipa_caps_supported(&c->options.adp, f)
58 #define qeth_is_supported(c, f) \
59 	qeth_ipa_caps_supported(&c->options.ipa4, f)
60 #define qeth_is_supported6(c, f) \
61 	qeth_ipa_caps_supported(&c->options.ipa6, f)
62 #define qeth_is_ipafunc_supported(c, prot, f) \
63 	 ((prot == QETH_PROT_IPV6) ? qeth_is_supported6(c, f) : \
64 				     qeth_is_supported(c, f))
65 
66 enum qeth_card_types {
67 	QETH_CARD_TYPE_OSD     = 1,
68 	QETH_CARD_TYPE_IQD     = 5,
69 	QETH_CARD_TYPE_OSN     = 6,
70 	QETH_CARD_TYPE_OSM     = 3,
71 	QETH_CARD_TYPE_OSX     = 2,
72 };
73 
74 #define IS_IQD(card)	((card)->info.type == QETH_CARD_TYPE_IQD)
75 #define IS_OSD(card)	((card)->info.type == QETH_CARD_TYPE_OSD)
76 #define IS_OSM(card)	((card)->info.type == QETH_CARD_TYPE_OSM)
77 
78 #ifdef CONFIG_QETH_OSN
79 #define IS_OSN(card)	((card)->info.type == QETH_CARD_TYPE_OSN)
80 #else
81 #define IS_OSN(card)	false
82 #endif
83 
84 #ifdef CONFIG_QETH_OSX
85 #define IS_OSX(card)	((card)->info.type == QETH_CARD_TYPE_OSX)
86 #else
87 #define IS_OSX(card)	false
88 #endif
89 
90 #define IS_VM_NIC(card)	((card)->info.is_vm_nic)
91 
92 #define QETH_MPC_DIFINFO_LEN_INDICATES_LINK_TYPE 0x18
93 /* only the first two bytes are looked at in qeth_get_cardname_short */
94 enum qeth_link_types {
95 	QETH_LINK_TYPE_FAST_ETH     = 0x01,
96 	QETH_LINK_TYPE_HSTR         = 0x02,
97 	QETH_LINK_TYPE_GBIT_ETH     = 0x03,
98 	QETH_LINK_TYPE_OSN          = 0x04,
99 	QETH_LINK_TYPE_10GBIT_ETH   = 0x10,
100 	QETH_LINK_TYPE_25GBIT_ETH   = 0x12,
101 	QETH_LINK_TYPE_LANE_ETH100  = 0x81,
102 	QETH_LINK_TYPE_LANE_TR      = 0x82,
103 	QETH_LINK_TYPE_LANE_ETH1000 = 0x83,
104 	QETH_LINK_TYPE_LANE         = 0x88,
105 };
106 
107 enum qeth_routing_types {
108 	/* TODO: set to bit flag used in IPA Command */
109 	NO_ROUTER		= 0,
110 	PRIMARY_ROUTER		= 1,
111 	SECONDARY_ROUTER	= 2,
112 	MULTICAST_ROUTER	= 3,
113 	PRIMARY_CONNECTOR	= 4,
114 	SECONDARY_CONNECTOR	= 5,
115 };
116 
117 /* IPA Commands */
118 enum qeth_ipa_cmds {
119 	IPA_CMD_STARTLAN		= 0x01,
120 	IPA_CMD_STOPLAN			= 0x02,
121 	IPA_CMD_SETVMAC			= 0x21,
122 	IPA_CMD_DELVMAC			= 0x22,
123 	IPA_CMD_SETGMAC			= 0x23,
124 	IPA_CMD_DELGMAC			= 0x24,
125 	IPA_CMD_SETVLAN			= 0x25,
126 	IPA_CMD_DELVLAN			= 0x26,
127 	IPA_CMD_VNICC			= 0x2a,
128 	IPA_CMD_SETBRIDGEPORT_OSA	= 0x2b,
129 	IPA_CMD_SETCCID			= 0x41,
130 	IPA_CMD_DELCCID			= 0x42,
131 	IPA_CMD_MODCCID			= 0x43,
132 	IPA_CMD_SETIP			= 0xb1,
133 	IPA_CMD_QIPASSIST		= 0xb2,
134 	IPA_CMD_SETASSPARMS		= 0xb3,
135 	IPA_CMD_SETIPM			= 0xb4,
136 	IPA_CMD_DELIPM			= 0xb5,
137 	IPA_CMD_SETRTG			= 0xb6,
138 	IPA_CMD_DELIP			= 0xb7,
139 	IPA_CMD_SETADAPTERPARMS		= 0xb8,
140 	IPA_CMD_SET_DIAG_ASS		= 0xb9,
141 	IPA_CMD_SETBRIDGEPORT_IQD	= 0xbe,
142 	IPA_CMD_CREATE_ADDR		= 0xc3,
143 	IPA_CMD_DESTROY_ADDR		= 0xc4,
144 	IPA_CMD_REGISTER_LOCAL_ADDR	= 0xd1,
145 	IPA_CMD_UNREGISTER_LOCAL_ADDR	= 0xd2,
146 	IPA_CMD_ADDRESS_CHANGE_NOTIF	= 0xd3,
147 	IPA_CMD_UNKNOWN			= 0x00
148 };
149 
150 enum qeth_ip_ass_cmds {
151 	IPA_CMD_ASS_START	= 0x0001,
152 	IPA_CMD_ASS_STOP	= 0x0002,
153 	IPA_CMD_ASS_CONFIGURE	= 0x0003,
154 	IPA_CMD_ASS_ENABLE	= 0x0004,
155 };
156 
157 enum qeth_arp_process_subcmds {
158 	IPA_CMD_ASS_ARP_SET_NO_ENTRIES	= 0x0003,
159 	IPA_CMD_ASS_ARP_QUERY_CACHE	= 0x0004,
160 	IPA_CMD_ASS_ARP_ADD_ENTRY	= 0x0005,
161 	IPA_CMD_ASS_ARP_REMOVE_ENTRY	= 0x0006,
162 	IPA_CMD_ASS_ARP_FLUSH_CACHE	= 0x0007,
163 	IPA_CMD_ASS_ARP_QUERY_INFO	= 0x0104,
164 	IPA_CMD_ASS_ARP_QUERY_STATS	= 0x0204,
165 };
166 
167 
168 /* Return Codes for IPA Commands
169  * according to OSA card Specs */
170 
171 enum qeth_ipa_return_codes {
172 	IPA_RC_SUCCESS			= 0x0000,
173 	IPA_RC_NOTSUPP			= 0x0001,
174 	IPA_RC_IP_TABLE_FULL		= 0x0002,
175 	IPA_RC_UNKNOWN_ERROR		= 0x0003,
176 	IPA_RC_UNSUPPORTED_COMMAND	= 0x0004,
177 	IPA_RC_TRACE_ALREADY_ACTIVE	= 0x0005,
178 	IPA_RC_INVALID_FORMAT		= 0x0006,
179 	IPA_RC_DUP_IPV6_REMOTE		= 0x0008,
180 	IPA_RC_SBP_IQD_NOT_CONFIGURED	= 0x000C,
181 	IPA_RC_DUP_IPV6_HOME		= 0x0010,
182 	IPA_RC_UNREGISTERED_ADDR	= 0x0011,
183 	IPA_RC_NO_ID_AVAILABLE		= 0x0012,
184 	IPA_RC_ID_NOT_FOUND		= 0x0013,
185 	IPA_RC_SBP_IQD_ANO_DEV_PRIMARY	= 0x0014,
186 	IPA_RC_SBP_IQD_CURRENT_SECOND	= 0x0018,
187 	IPA_RC_SBP_IQD_LIMIT_SECOND	= 0x001C,
188 	IPA_RC_INVALID_IP_VERSION	= 0x0020,
189 	IPA_RC_SBP_IQD_CURRENT_PRIMARY	= 0x0024,
190 	IPA_RC_LAN_FRAME_MISMATCH	= 0x0040,
191 	IPA_RC_SBP_IQD_NO_QDIO_QUEUES	= 0x00EB,
192 	IPA_RC_L2_UNSUPPORTED_CMD	= 0x2003,
193 	IPA_RC_L2_DUP_MAC		= 0x2005,
194 	IPA_RC_L2_ADDR_TABLE_FULL	= 0x2006,
195 	IPA_RC_L2_DUP_LAYER3_MAC	= 0x200a,
196 	IPA_RC_L2_GMAC_NOT_FOUND	= 0x200b,
197 	IPA_RC_L2_MAC_NOT_AUTH_BY_HYP	= 0x200c,
198 	IPA_RC_L2_MAC_NOT_AUTH_BY_ADP	= 0x200d,
199 	IPA_RC_L2_MAC_NOT_FOUND		= 0x2010,
200 	IPA_RC_L2_INVALID_VLAN_ID	= 0x2015,
201 	IPA_RC_L2_DUP_VLAN_ID		= 0x2016,
202 	IPA_RC_L2_VLAN_ID_NOT_FOUND	= 0x2017,
203 	IPA_RC_L2_VLAN_ID_NOT_ALLOWED	= 0x2050,
204 	IPA_RC_VNICC_VNICBP		= 0x20B0,
205 	IPA_RC_SBP_OSA_NOT_CONFIGURED	= 0x2B0C,
206 	IPA_RC_SBP_OSA_OS_MISMATCH	= 0x2B10,
207 	IPA_RC_SBP_OSA_ANO_DEV_PRIMARY	= 0x2B14,
208 	IPA_RC_SBP_OSA_CURRENT_SECOND	= 0x2B18,
209 	IPA_RC_SBP_OSA_LIMIT_SECOND	= 0x2B1C,
210 	IPA_RC_SBP_OSA_NOT_AUTHD_BY_ZMAN = 0x2B20,
211 	IPA_RC_SBP_OSA_CURRENT_PRIMARY	= 0x2B24,
212 	IPA_RC_SBP_OSA_NO_QDIO_QUEUES	= 0x2BEB,
213 	IPA_RC_DATA_MISMATCH		= 0xe001,
214 	IPA_RC_INVALID_MTU_SIZE		= 0xe002,
215 	IPA_RC_INVALID_LANTYPE		= 0xe003,
216 	IPA_RC_INVALID_LANNUM		= 0xe004,
217 	IPA_RC_DUPLICATE_IP_ADDRESS	= 0xe005,
218 	IPA_RC_IP_ADDR_TABLE_FULL	= 0xe006,
219 	IPA_RC_LAN_PORT_STATE_ERROR	= 0xe007,
220 	IPA_RC_SETIP_NO_STARTLAN	= 0xe008,
221 	IPA_RC_SETIP_ALREADY_RECEIVED	= 0xe009,
222 	IPA_RC_IP_ADDR_ALREADY_USED	= 0xe00a,
223 	IPA_RC_MC_ADDR_NOT_FOUND	= 0xe00b,
224 	IPA_RC_SETIP_INVALID_VERSION	= 0xe00d,
225 	IPA_RC_UNSUPPORTED_SUBCMD	= 0xe00e,
226 	IPA_RC_ARP_ASSIST_NO_ENABLE	= 0xe00f,
227 	IPA_RC_PRIMARY_ALREADY_DEFINED	= 0xe010,
228 	IPA_RC_SECOND_ALREADY_DEFINED	= 0xe011,
229 	IPA_RC_INVALID_SETRTG_INDICATOR	= 0xe012,
230 	IPA_RC_MC_ADDR_ALREADY_DEFINED	= 0xe013,
231 	IPA_RC_LAN_OFFLINE		= 0xe080,
232 	IPA_RC_VEPA_TO_VEB_TRANSITION	= 0xe090,
233 	IPA_RC_INVALID_IP_VERSION2	= 0xf001,
234 	IPA_RC_FFFF			= 0xffff
235 };
236 /* for VNIC Characteristics */
237 #define IPA_RC_VNICC_OOSEQ 0x0005
238 
239 /* for SET_DIAGNOSTIC_ASSIST */
240 #define IPA_RC_INVALID_SUBCMD		IPA_RC_IP_TABLE_FULL
241 #define IPA_RC_HARDWARE_AUTH_ERROR	IPA_RC_UNKNOWN_ERROR
242 
243 /* for SETBRIDGEPORT (double occupancies) */
244 #define IPA_RC_SBP_IQD_OS_MISMATCH	 IPA_RC_DUP_IPV6_HOME
245 #define IPA_RC_SBP_IQD_NOT_AUTHD_BY_ZMAN IPA_RC_INVALID_IP_VERSION
246 
247 /* IPA function flags; each flag marks availability of respective function */
248 enum qeth_ipa_funcs {
249 	IPA_ARP_PROCESSING      = 0x00000001L,
250 	IPA_INBOUND_CHECKSUM    = 0x00000002L,
251 	IPA_OUTBOUND_CHECKSUM   = 0x00000004L,
252 	/* RESERVED		= 0x00000008L,*/
253 	IPA_FILTERING           = 0x00000010L,
254 	IPA_IPV6                = 0x00000020L,
255 	IPA_MULTICASTING        = 0x00000040L,
256 	IPA_IP_REASSEMBLY       = 0x00000080L,
257 	IPA_QUERY_ARP_COUNTERS  = 0x00000100L,
258 	IPA_QUERY_ARP_ADDR_INFO = 0x00000200L,
259 	IPA_SETADAPTERPARMS     = 0x00000400L,
260 	IPA_VLAN_PRIO           = 0x00000800L,
261 	IPA_PASSTHRU            = 0x00001000L,
262 	IPA_FLUSH_ARP_SUPPORT   = 0x00002000L,
263 	IPA_FULL_VLAN           = 0x00004000L,
264 	IPA_INBOUND_PASSTHRU    = 0x00008000L,
265 	IPA_SOURCE_MAC          = 0x00010000L,
266 	IPA_OSA_MC_ROUTER       = 0x00020000L,
267 	IPA_QUERY_ARP_ASSIST	= 0x00040000L,
268 	IPA_INBOUND_TSO         = 0x00080000L,
269 	IPA_OUTBOUND_TSO        = 0x00100000L,
270 	IPA_INBOUND_CHECKSUM_V6 = 0x00400000L,
271 	IPA_OUTBOUND_CHECKSUM_V6 = 0x00800000L,
272 };
273 
274 /* SETIP/DELIP IPA Command: ***************************************************/
275 enum qeth_ipa_setdelip_flags {
276 	QETH_IPA_SETDELIP_DEFAULT          = 0x00L, /* default */
277 	QETH_IPA_SETIP_VIPA_FLAG           = 0x01L, /* no grat. ARP */
278 	QETH_IPA_SETIP_TAKEOVER_FLAG       = 0x02L, /* nofail on grat. ARP */
279 	QETH_IPA_DELIP_ADDR_2_B_TAKEN_OVER = 0x20L,
280 	QETH_IPA_DELIP_VIPA_FLAG           = 0x40L,
281 	QETH_IPA_DELIP_ADDR_NEEDS_SETIP    = 0x80L,
282 };
283 
284 /* SETADAPTER IPA Command: ****************************************************/
285 enum qeth_ipa_setadp_cmd {
286 	IPA_SETADP_QUERY_COMMANDS_SUPPORTED	= 0x00000001L,
287 	IPA_SETADP_ALTER_MAC_ADDRESS		= 0x00000002L,
288 	IPA_SETADP_ADD_DELETE_GROUP_ADDRESS	= 0x00000004L,
289 	IPA_SETADP_ADD_DELETE_FUNCTIONAL_ADDR	= 0x00000008L,
290 	IPA_SETADP_SET_ADDRESSING_MODE		= 0x00000010L,
291 	IPA_SETADP_SET_CONFIG_PARMS		= 0x00000020L,
292 	IPA_SETADP_SET_CONFIG_PARMS_EXTENDED	= 0x00000040L,
293 	IPA_SETADP_SET_BROADCAST_MODE		= 0x00000080L,
294 	IPA_SETADP_SEND_OSA_MESSAGE		= 0x00000100L,
295 	IPA_SETADP_SET_SNMP_CONTROL		= 0x00000200L,
296 	IPA_SETADP_QUERY_CARD_INFO		= 0x00000400L,
297 	IPA_SETADP_SET_PROMISC_MODE		= 0x00000800L,
298 	IPA_SETADP_SET_DIAG_ASSIST		= 0x00002000L,
299 	IPA_SETADP_SET_ACCESS_CONTROL		= 0x00010000L,
300 	IPA_SETADP_QUERY_OAT			= 0x00080000L,
301 	IPA_SETADP_QUERY_SWITCH_ATTRIBUTES	= 0x00100000L,
302 };
303 enum qeth_ipa_mac_ops {
304 	CHANGE_ADDR_READ_MAC		= 0,
305 	CHANGE_ADDR_REPLACE_MAC		= 1,
306 	CHANGE_ADDR_ADD_MAC		= 2,
307 	CHANGE_ADDR_DEL_MAC		= 4,
308 	CHANGE_ADDR_RESET_MAC		= 8,
309 };
310 enum qeth_ipa_addr_ops {
311 	CHANGE_ADDR_READ_ADDR		= 0,
312 	CHANGE_ADDR_ADD_ADDR		= 1,
313 	CHANGE_ADDR_DEL_ADDR		= 2,
314 	CHANGE_ADDR_FLUSH_ADDR_TABLE	= 4,
315 };
316 enum qeth_ipa_promisc_modes {
317 	SET_PROMISC_MODE_OFF		= 0,
318 	SET_PROMISC_MODE_ON		= 1,
319 };
320 enum qeth_ipa_isolation_modes {
321 	ISOLATION_MODE_NONE		= 0x00000000L,
322 	ISOLATION_MODE_FWD		= 0x00000001L,
323 	ISOLATION_MODE_DROP		= 0x00000002L,
324 };
325 enum qeth_ipa_set_access_mode_rc {
326 	SET_ACCESS_CTRL_RC_SUCCESS		= 0x0000,
327 	SET_ACCESS_CTRL_RC_NOT_SUPPORTED	= 0x0004,
328 	SET_ACCESS_CTRL_RC_ALREADY_NOT_ISOLATED	= 0x0008,
329 	SET_ACCESS_CTRL_RC_ALREADY_ISOLATED	= 0x0010,
330 	SET_ACCESS_CTRL_RC_NONE_SHARED_ADAPTER	= 0x0014,
331 	SET_ACCESS_CTRL_RC_ACTIVE_CHECKSUM_OFF	= 0x0018,
332 	SET_ACCESS_CTRL_RC_REFLREL_UNSUPPORTED	= 0x0022,
333 	SET_ACCESS_CTRL_RC_REFLREL_FAILED	= 0x0024,
334 	SET_ACCESS_CTRL_RC_REFLREL_DEACT_FAILED	= 0x0028,
335 };
336 enum qeth_card_info_card_type {
337 	CARD_INFO_TYPE_1G_COPPER_A	= 0x61,
338 	CARD_INFO_TYPE_1G_FIBRE_A	= 0x71,
339 	CARD_INFO_TYPE_10G_FIBRE_A	= 0x91,
340 	CARD_INFO_TYPE_1G_COPPER_B	= 0xb1,
341 	CARD_INFO_TYPE_1G_FIBRE_B	= 0xa1,
342 	CARD_INFO_TYPE_10G_FIBRE_B	= 0xc1,
343 };
344 enum qeth_card_info_port_mode {
345 	CARD_INFO_PORTM_HALFDUPLEX	= 0x0002,
346 	CARD_INFO_PORTM_FULLDUPLEX	= 0x0003,
347 };
348 enum qeth_card_info_port_speed {
349 	CARD_INFO_PORTS_10M		= 0x00000005,
350 	CARD_INFO_PORTS_100M		= 0x00000006,
351 	CARD_INFO_PORTS_1G		= 0x00000007,
352 	CARD_INFO_PORTS_10G		= 0x00000008,
353 	CARD_INFO_PORTS_25G		= 0x0000000A,
354 };
355 
356 /* (SET)DELIP(M) IPA stuff ***************************************************/
357 struct qeth_ipacmd_setdelip4 {
358 	__be32 addr;
359 	__be32 mask;
360 	__u32  flags;
361 } __attribute__ ((packed));
362 
363 struct qeth_ipacmd_setdelip6 {
364 	struct in6_addr addr;
365 	struct in6_addr prefix;
366 	__u32  flags;
367 } __attribute__ ((packed));
368 
369 struct qeth_ipacmd_setdelipm {
370 	__u8 mac[6];
371 	__u8 padding[2];
372 	struct in6_addr ip;
373 } __attribute__ ((packed));
374 
375 struct qeth_ipacmd_layer2setdelmac {
376 	__u32 mac_length;
377 	__u8 mac[6];
378 } __attribute__ ((packed));
379 
380 struct qeth_ipacmd_layer2setdelvlan {
381 	__u16 vlan_id;
382 } __attribute__ ((packed));
383 
384 struct qeth_ipacmd_setassparms_hdr {
385 	__u16 length;
386 	__u16 command_code;
387 	__u16 return_code;
388 	__u8 number_of_replies;
389 	__u8 seq_no;
390 } __attribute__((packed));
391 
392 struct qeth_arp_query_data {
393 	__u16 request_bits;
394 	__u16 reply_bits;
395 	__u32 no_entries;
396 	char data; /* only for replies */
397 } __attribute__((packed));
398 
399 /* used as parameter for arp_query reply */
400 struct qeth_arp_query_info {
401 	__u32 udata_len;
402 	__u16 mask_bits;
403 	__u32 udata_offset;
404 	__u32 no_entries;
405 	char *udata;
406 };
407 
408 /* IPA set assist segmentation bit definitions for receive and
409  * transmit checksum offloading.
410  */
411 enum qeth_ipa_checksum_bits {
412 	QETH_IPA_CHECKSUM_IP_HDR	= 0x0002,
413 	QETH_IPA_CHECKSUM_UDP		= 0x0008,
414 	QETH_IPA_CHECKSUM_TCP		= 0x0010,
415 	QETH_IPA_CHECKSUM_LP2LP		= 0x0020
416 };
417 
418 enum qeth_ipa_large_send_caps {
419 	QETH_IPA_LARGE_SEND_TCP		= 0x00000001,
420 };
421 
422 struct qeth_tso_start_data {
423 	u32 mss;
424 	u32 supported;
425 };
426 
427 /* SETASSPARMS IPA Command: */
428 struct qeth_ipacmd_setassparms {
429 	u32 assist_no;
430 	struct qeth_ipacmd_setassparms_hdr hdr;
431 	union {
432 		__u32 flags_32bit;
433 		struct qeth_ipa_caps caps;
434 		struct qeth_arp_cache_entry arp_entry;
435 		struct qeth_arp_query_data query_arp;
436 		struct qeth_tso_start_data tso;
437 	} data;
438 } __attribute__ ((packed));
439 
440 #define SETASS_DATA_SIZEOF(field) sizeof_field(struct qeth_ipacmd_setassparms,\
441 					       data.field)
442 
443 /* SETRTG IPA Command:    ****************************************************/
444 struct qeth_set_routing {
445 	__u8 type;
446 };
447 
448 /* SETADAPTERPARMS IPA Command:    *******************************************/
449 struct qeth_query_cmds_supp {
450 	__u32 no_lantypes_supp;
451 	__u8 lan_type;
452 	__u8 reserved1[3];
453 	__u32 supported_cmds;
454 	__u8 reserved2[8];
455 } __attribute__ ((packed));
456 
457 struct qeth_change_addr {
458 	u32 cmd;
459 	u32 addr_size;
460 	u32 no_macs;
461 	u8 addr[ETH_ALEN];
462 };
463 
464 struct qeth_snmp_cmd {
465 	__u8  token[16];
466 	__u32 request;
467 	__u32 interface;
468 	__u32 returncode;
469 	__u32 firmwarelevel;
470 	__u32 seqno;
471 	__u8  data;
472 } __attribute__ ((packed));
473 
474 struct qeth_snmp_ureq_hdr {
475 	__u32   data_len;
476 	__u32   req_len;
477 	__u32   reserved1;
478 	__u32   reserved2;
479 } __attribute__ ((packed));
480 
481 struct qeth_snmp_ureq {
482 	struct qeth_snmp_ureq_hdr hdr;
483 	struct qeth_snmp_cmd cmd;
484 } __attribute__((packed));
485 
486 /* SET_ACCESS_CONTROL: same format for request and reply */
487 struct qeth_set_access_ctrl {
488 	__u32 subcmd_code;
489 	__u8 reserved[8];
490 } __attribute__((packed));
491 
492 #define QETH_QOAT_PHYS_SPEED_UNKNOWN		0x00
493 #define QETH_QOAT_PHYS_SPEED_10M_HALF		0x01
494 #define QETH_QOAT_PHYS_SPEED_10M_FULL		0x02
495 #define QETH_QOAT_PHYS_SPEED_100M_HALF		0x03
496 #define QETH_QOAT_PHYS_SPEED_100M_FULL		0x04
497 #define QETH_QOAT_PHYS_SPEED_1000M_HALF		0x05
498 #define QETH_QOAT_PHYS_SPEED_1000M_FULL		0x06
499 // n/a						0x07
500 #define QETH_QOAT_PHYS_SPEED_10G_FULL		0x08
501 // n/a						0x09
502 #define QETH_QOAT_PHYS_SPEED_25G_FULL		0x0A
503 
504 #define QETH_QOAT_PHYS_MEDIA_COPPER		0x01
505 #define QETH_QOAT_PHYS_MEDIA_FIBRE_SHORT	0x02
506 #define QETH_QOAT_PHYS_MEDIA_FIBRE_LONG		0x04
507 
508 struct qeth_query_oat_physical_if {
509 	u8 res_head[33];
510 	u8 speed_duplex;
511 	u8 media_type;
512 	u8 res_tail[29];
513 };
514 
515 #define QETH_QOAT_REPLY_TYPE_PHYS_IF		0x0004
516 
517 struct qeth_query_oat_reply {
518 	u16 type;
519 	u16 length;
520 	u16 version;
521 	u8 res[10];
522 	struct qeth_query_oat_physical_if phys_if;
523 };
524 
525 #define QETH_QOAT_SCOPE_INTERFACE		0x00000001
526 
527 struct qeth_query_oat {
528 	u32 subcmd_code;
529 	u8 reserved[12];
530 	struct qeth_query_oat_reply reply[];
531 } __packed;
532 
533 struct qeth_qoat_priv {
534 	__u32 buffer_len;
535 	__u32 response_len;
536 	char *buffer;
537 };
538 
539 struct qeth_query_card_info {
540 	__u8	card_type;
541 	__u8	reserved1;
542 	__u16	port_mode;
543 	__u32	port_speed;
544 	__u32	reserved2;
545 };
546 
547 #define QETH_SWITCH_FORW_802_1		0x00000001
548 #define QETH_SWITCH_FORW_REFL_RELAY	0x00000002
549 #define QETH_SWITCH_CAP_RTE		0x00000004
550 #define QETH_SWITCH_CAP_ECP		0x00000008
551 #define QETH_SWITCH_CAP_VDP		0x00000010
552 
553 struct qeth_query_switch_attributes {
554 	__u8  version;
555 	__u8  reserved1;
556 	__u16 reserved2;
557 	__u32 capabilities;
558 	__u32 settings;
559 	__u8  reserved3[8];
560 };
561 
562 #define QETH_SETADP_FLAGS_VIRTUAL_MAC	0x80	/* for CHANGE_ADDR_READ_MAC */
563 
564 struct qeth_ipacmd_setadpparms_hdr {
565 	u16 cmdlength;
566 	u16 reserved2;
567 	u32 command_code;
568 	u16 return_code;
569 	u8 used_total;
570 	u8 seq_no;
571 	u8 flags;
572 	u8 reserved3[3];
573 };
574 
575 struct qeth_ipacmd_setadpparms {
576 	struct qeth_ipa_caps hw_cmds;
577 	struct qeth_ipacmd_setadpparms_hdr hdr;
578 	union {
579 		struct qeth_query_cmds_supp query_cmds_supp;
580 		struct qeth_change_addr change_addr;
581 		struct qeth_snmp_cmd snmp;
582 		struct qeth_set_access_ctrl set_access_ctrl;
583 		struct qeth_query_oat query_oat;
584 		struct qeth_query_card_info card_info;
585 		struct qeth_query_switch_attributes query_switch_attributes;
586 		__u32 mode;
587 	} data;
588 } __attribute__ ((packed));
589 
590 #define SETADP_DATA_SIZEOF(field) sizeof_field(struct qeth_ipacmd_setadpparms,\
591 					       data.field)
592 
593 /* CREATE_ADDR IPA Command:    ***********************************************/
594 struct qeth_create_destroy_address {
595 	u8 mac_addr[ETH_ALEN];
596 	u16 uid;
597 };
598 
599 /* SET DIAGNOSTIC ASSIST IPA Command:	 *************************************/
600 
601 enum qeth_diags_cmds {
602 	QETH_DIAGS_CMD_QUERY	= 0x0001,
603 	QETH_DIAGS_CMD_TRAP	= 0x0002,
604 	QETH_DIAGS_CMD_TRACE	= 0x0004,
605 	QETH_DIAGS_CMD_NOLOG	= 0x0008,
606 	QETH_DIAGS_CMD_DUMP	= 0x0010,
607 };
608 
609 enum qeth_diags_trace_types {
610 	QETH_DIAGS_TYPE_HIPERSOCKET	= 0x02,
611 };
612 
613 enum qeth_diags_trace_cmds {
614 	QETH_DIAGS_CMD_TRACE_ENABLE	= 0x0001,
615 	QETH_DIAGS_CMD_TRACE_DISABLE	= 0x0002,
616 	QETH_DIAGS_CMD_TRACE_MODIFY	= 0x0004,
617 	QETH_DIAGS_CMD_TRACE_REPLACE	= 0x0008,
618 	QETH_DIAGS_CMD_TRACE_QUERY	= 0x0010,
619 };
620 
621 enum qeth_diags_trap_action {
622 	QETH_DIAGS_TRAP_ARM	= 0x01,
623 	QETH_DIAGS_TRAP_DISARM	= 0x02,
624 	QETH_DIAGS_TRAP_CAPTURE = 0x04,
625 };
626 
627 struct qeth_ipacmd_diagass {
628 	__u32  host_tod2;
629 	__u32:32;
630 	__u16  subcmd_len;
631 	__u16:16;
632 	__u32  subcmd;
633 	__u8   type;
634 	__u8   action;
635 	__u16  options;
636 	__u32  ext;
637 	__u8   cdata[64];
638 } __attribute__ ((packed));
639 
640 #define DIAG_HDR_LEN		offsetofend(struct qeth_ipacmd_diagass, ext)
641 #define DIAG_SUB_HDR_LEN	(offsetofend(struct qeth_ipacmd_diagass, ext) -\
642 				 offsetof(struct qeth_ipacmd_diagass, \
643 					  subcmd_len))
644 
645 /* VNIC Characteristics IPA Command: *****************************************/
646 /* IPA commands/sub commands for VNICC */
647 #define IPA_VNICC_QUERY_CHARS		0x00000000L
648 #define IPA_VNICC_QUERY_CMDS		0x00000001L
649 #define IPA_VNICC_ENABLE		0x00000002L
650 #define IPA_VNICC_DISABLE		0x00000004L
651 #define IPA_VNICC_SET_TIMEOUT		0x00000008L
652 #define IPA_VNICC_GET_TIMEOUT		0x00000010L
653 
654 /* VNICC flags */
655 #define QETH_VNICC_FLOODING		0x80000000
656 #define QETH_VNICC_MCAST_FLOODING	0x40000000
657 #define QETH_VNICC_LEARNING		0x20000000
658 #define QETH_VNICC_TAKEOVER_SETVMAC	0x10000000
659 #define QETH_VNICC_TAKEOVER_LEARNING	0x08000000
660 #define QETH_VNICC_BRIDGE_INVISIBLE	0x04000000
661 #define QETH_VNICC_RX_BCAST		0x02000000
662 
663 /* VNICC default values */
664 #define QETH_VNICC_ALL			0xff000000
665 #define QETH_VNICC_DEFAULT		QETH_VNICC_RX_BCAST
666 /* default VNICC timeout in seconds */
667 #define QETH_VNICC_DEFAULT_TIMEOUT	600
668 
669 /* VNICC header */
670 struct qeth_ipacmd_vnicc_hdr {
671 	u16 data_length;
672 	u16 reserved;
673 	u32 sub_command;
674 };
675 
676 /* query supported commands for VNIC characteristic */
677 struct qeth_vnicc_query_cmds {
678 	u32 vnic_char;
679 	u32 sup_cmds;
680 };
681 
682 /* enable/disable VNIC characteristic */
683 struct qeth_vnicc_set_char {
684 	u32 vnic_char;
685 };
686 
687 /* get/set timeout for VNIC characteristic */
688 struct qeth_vnicc_getset_timeout {
689 	u32 vnic_char;
690 	u32 timeout;
691 };
692 
693 /* complete VNICC IPA command message */
694 struct qeth_ipacmd_vnicc {
695 	struct qeth_ipa_caps vnicc_cmds;
696 	struct qeth_ipacmd_vnicc_hdr hdr;
697 	union {
698 		struct qeth_vnicc_query_cmds query_cmds;
699 		struct qeth_vnicc_set_char set_char;
700 		struct qeth_vnicc_getset_timeout getset_timeout;
701 	} data;
702 };
703 
704 #define VNICC_DATA_SIZEOF(field)	sizeof_field(struct qeth_ipacmd_vnicc,\
705 						     data.field)
706 
707 /* SETBRIDGEPORT IPA Command:	 *********************************************/
708 enum qeth_ipa_sbp_cmd {
709 	IPA_SBP_QUERY_COMMANDS_SUPPORTED	= 0x00000000L,
710 	IPA_SBP_RESET_BRIDGE_PORT_ROLE		= 0x00000001L,
711 	IPA_SBP_SET_PRIMARY_BRIDGE_PORT		= 0x00000002L,
712 	IPA_SBP_SET_SECONDARY_BRIDGE_PORT	= 0x00000004L,
713 	IPA_SBP_QUERY_BRIDGE_PORTS		= 0x00000008L,
714 	IPA_SBP_BRIDGE_PORT_STATE_CHANGE	= 0x00000010L,
715 };
716 
717 struct net_if_token {
718 	__u16 devnum;
719 	__u8 cssid;
720 	__u8 iid;
721 	__u8 ssid;
722 	__u8 chpid;
723 	__u16 chid;
724 } __packed;
725 
726 struct mac_addr_lnid {
727 	__u8 mac[6];
728 	__u16 lnid;
729 } __packed;
730 
731 struct qeth_ipacmd_sbp_hdr {
732 	__u16 cmdlength;
733 	__u16 reserved1;
734 	__u32 command_code;
735 	__u16 return_code;
736 	__u8  used_total;
737 	__u8  seq_no;
738 	__u32 reserved2;
739 } __packed;
740 
741 struct qeth_sbp_query_cmds_supp {
742 	__u32 supported_cmds;
743 	__u32 reserved;
744 } __packed;
745 
746 struct qeth_sbp_set_primary {
747 	struct net_if_token token;
748 } __packed;
749 
750 struct qeth_sbp_port_entry {
751 		__u8 role;
752 		__u8 state;
753 		__u8 reserved1;
754 		__u8 reserved2;
755 		struct net_if_token token;
756 } __packed;
757 
758 /* For IPA_SBP_QUERY_BRIDGE_PORTS, IPA_SBP_BRIDGE_PORT_STATE_CHANGE */
759 struct qeth_sbp_port_data {
760 	__u8 primary_bp_supported;
761 	__u8 secondary_bp_supported;
762 	__u8 num_entries;
763 	__u8 entry_length;
764 	struct qeth_sbp_port_entry entry[];
765 } __packed;
766 
767 struct qeth_ipacmd_setbridgeport {
768 	struct qeth_ipa_caps sbp_cmds;
769 	struct qeth_ipacmd_sbp_hdr hdr;
770 	union {
771 		struct qeth_sbp_query_cmds_supp query_cmds_supp;
772 		struct qeth_sbp_set_primary set_primary;
773 		struct qeth_sbp_port_data port_data;
774 	} data;
775 } __packed;
776 
777 #define SBP_DATA_SIZEOF(field)	sizeof_field(struct qeth_ipacmd_setbridgeport,\
778 					     data.field)
779 
780 /* ADDRESS_CHANGE_NOTIFICATION adapter-initiated "command" *******************/
781 /* Bitmask for entry->change_code. Both bits may be raised.		     */
782 enum qeth_ipa_addr_change_code {
783 	IPA_ADDR_CHANGE_CODE_VLANID		= 0x01,
784 	IPA_ADDR_CHANGE_CODE_MACADDR		= 0x02,
785 	IPA_ADDR_CHANGE_CODE_REMOVAL		= 0x80,	/* else addition */
786 };
787 
788 struct qeth_ipacmd_addr_change_entry {
789 	struct net_if_token token;
790 	struct mac_addr_lnid addr_lnid;
791 	__u8 change_code;
792 	__u8 reserved1;
793 	__u16 reserved2;
794 } __packed;
795 
796 struct qeth_ipacmd_addr_change {
797 	__u8 lost_event_mask;
798 	__u8 reserved;
799 	__u16 num_entries;
800 	struct qeth_ipacmd_addr_change_entry entry[];
801 } __packed;
802 
803 /* [UN]REGISTER_LOCAL_ADDRESS notifications */
804 struct qeth_ipacmd_local_addr4 {
805 	__be32 addr;
806 	u32 flags;
807 };
808 
809 struct qeth_ipacmd_local_addrs4 {
810 	u32 count;
811 	u32 addr_length;
812 	struct qeth_ipacmd_local_addr4 addrs[];
813 };
814 
815 struct qeth_ipacmd_local_addr6 {
816 	struct in6_addr addr;
817 	u32 flags;
818 };
819 
820 struct qeth_ipacmd_local_addrs6 {
821 	u32 count;
822 	u32 addr_length;
823 	struct qeth_ipacmd_local_addr6 addrs[];
824 };
825 
826 /* Header for each IPA command */
827 struct qeth_ipacmd_hdr {
828 	__u8   command;
829 	__u8   initiator;
830 	__u16  seqno;
831 	__u16  return_code;
832 	__u8   adapter_type;
833 	__u8   rel_adapter_no;
834 	__u8   prim_version_no;
835 	__u8   param_count;
836 	__u16  prot_version;
837 	struct qeth_ipa_caps assists;
838 } __attribute__ ((packed));
839 
840 /* The IPA command itself */
841 struct qeth_ipa_cmd {
842 	struct qeth_ipacmd_hdr hdr;
843 	union {
844 		struct qeth_ipacmd_setdelip4		setdelip4;
845 		struct qeth_ipacmd_setdelip6		setdelip6;
846 		struct qeth_ipacmd_setdelipm		setdelipm;
847 		struct qeth_ipacmd_setassparms		setassparms;
848 		struct qeth_ipacmd_layer2setdelmac	setdelmac;
849 		struct qeth_ipacmd_layer2setdelvlan	setdelvlan;
850 		struct qeth_create_destroy_address	create_destroy_addr;
851 		struct qeth_ipacmd_setadpparms		setadapterparms;
852 		struct qeth_set_routing			setrtg;
853 		struct qeth_ipacmd_diagass		diagass;
854 		struct qeth_ipacmd_setbridgeport	sbp;
855 		struct qeth_ipacmd_addr_change		addrchange;
856 		struct qeth_ipacmd_vnicc		vnicc;
857 		struct qeth_ipacmd_local_addrs4		local_addrs4;
858 		struct qeth_ipacmd_local_addrs6		local_addrs6;
859 	} data;
860 } __attribute__ ((packed));
861 
862 #define IPA_DATA_SIZEOF(field)	sizeof_field(struct qeth_ipa_cmd, data.field)
863 
864 /*
865  * special command for ARP processing.
866  * this is not included in setassparms command before, because we get
867  * problem with the size of struct qeth_ipacmd_setassparms otherwise
868  */
869 enum qeth_ipa_arp_return_codes {
870 	QETH_IPA_ARP_RC_SUCCESS      = 0x0000,
871 	QETH_IPA_ARP_RC_FAILED       = 0x0001,
872 	QETH_IPA_ARP_RC_NOTSUPP      = 0x0002,
873 	QETH_IPA_ARP_RC_OUT_OF_RANGE = 0x0003,
874 	QETH_IPA_ARP_RC_Q_NOTSUPP    = 0x0004,
875 	QETH_IPA_ARP_RC_Q_NO_DATA    = 0x0008,
876 };
877 
878 extern const char *qeth_get_ipa_msg(enum qeth_ipa_return_codes rc);
879 extern const char *qeth_get_ipa_cmd_name(enum qeth_ipa_cmds cmd);
880 
881 /* Helper functions */
882 #define IS_IPA_REPLY(cmd) ((cmd->hdr.initiator == IPA_CMD_INITIATOR_HOST) || \
883 			   (cmd->hdr.initiator == IPA_CMD_INITIATOR_OSA_REPLY))
884 
885 /*****************************************************************************/
886 /* END OF   IP Assist related definitions                                    */
887 /*****************************************************************************/
888 
889 extern const unsigned char CM_ENABLE[];
890 #define CM_ENABLE_SIZE 0x63
891 #define QETH_CM_ENABLE_ISSUER_RM_TOKEN(buffer) (buffer + 0x2c)
892 #define QETH_CM_ENABLE_FILTER_TOKEN(buffer) (buffer + 0x53)
893 #define QETH_CM_ENABLE_USER_DATA(buffer) (buffer + 0x5b)
894 
895 #define QETH_CM_ENABLE_RESP_FILTER_TOKEN(buffer) \
896 		(PDU_ENCAPSULATION(buffer) + 0x13)
897 
898 
899 extern const unsigned char CM_SETUP[];
900 #define CM_SETUP_SIZE 0x64
901 #define QETH_CM_SETUP_DEST_ADDR(buffer) (buffer + 0x2c)
902 #define QETH_CM_SETUP_CONNECTION_TOKEN(buffer) (buffer + 0x51)
903 #define QETH_CM_SETUP_FILTER_TOKEN(buffer) (buffer + 0x5a)
904 
905 #define QETH_CM_SETUP_RESP_DEST_ADDR(buffer) \
906 		(PDU_ENCAPSULATION(buffer) + 0x1a)
907 
908 extern const unsigned char ULP_ENABLE[];
909 #define ULP_ENABLE_SIZE 0x6b
910 #define QETH_ULP_ENABLE_LINKNUM(buffer) (buffer + 0x61)
911 #define QETH_ULP_ENABLE_DEST_ADDR(buffer) (buffer + 0x2c)
912 #define QETH_ULP_ENABLE_FILTER_TOKEN(buffer) (buffer + 0x53)
913 #define QETH_ULP_ENABLE_PORTNAME_AND_LL(buffer) (buffer + 0x62)
914 #define QETH_ULP_ENABLE_RESP_FILTER_TOKEN(buffer) \
915 		(PDU_ENCAPSULATION(buffer) + 0x13)
916 #define QETH_ULP_ENABLE_RESP_MAX_MTU(buffer) \
917 		(PDU_ENCAPSULATION(buffer) + 0x1f)
918 #define QETH_ULP_ENABLE_RESP_DIFINFO_LEN(buffer) \
919 		(PDU_ENCAPSULATION(buffer) + 0x17)
920 #define QETH_ULP_ENABLE_RESP_LINK_TYPE(buffer) \
921 		(PDU_ENCAPSULATION(buffer) + 0x2b)
922 /* Layer 2 definitions */
923 #define QETH_PROT_LAYER2 0x08
924 #define QETH_PROT_TCPIP  0x03
925 #define QETH_PROT_OSN2   0x0a
926 #define QETH_ULP_ENABLE_PROT_TYPE(buffer) (buffer + 0x50)
927 #define QETH_IPA_CMD_PROT_TYPE(buffer) (buffer + 0x19)
928 
929 extern const unsigned char ULP_SETUP[];
930 #define ULP_SETUP_SIZE 0x6c
931 #define QETH_ULP_SETUP_DEST_ADDR(buffer) (buffer + 0x2c)
932 #define QETH_ULP_SETUP_CONNECTION_TOKEN(buffer) (buffer + 0x51)
933 #define QETH_ULP_SETUP_FILTER_TOKEN(buffer) (buffer + 0x5a)
934 #define QETH_ULP_SETUP_CUA(buffer) (buffer + 0x68)
935 #define QETH_ULP_SETUP_REAL_DEVADDR(buffer) (buffer + 0x6a)
936 
937 #define QETH_ULP_SETUP_RESP_CONNECTION_TOKEN(buffer) \
938 		(PDU_ENCAPSULATION(buffer) + 0x1a)
939 
940 
941 extern const unsigned char DM_ACT[];
942 #define DM_ACT_SIZE 0x55
943 #define QETH_DM_ACT_DEST_ADDR(buffer) (buffer + 0x2c)
944 #define QETH_DM_ACT_CONNECTION_TOKEN(buffer) (buffer + 0x51)
945 
946 
947 
948 #define QETH_TRANSPORT_HEADER_SEQ_NO(buffer) (buffer + 4)
949 #define QETH_PDU_HEADER_SEQ_NO(buffer) (buffer + 0x1c)
950 #define QETH_PDU_HEADER_ACK_SEQ_NO(buffer) (buffer + 0x20)
951 
952 extern const unsigned char IDX_ACTIVATE_READ[];
953 extern const unsigned char IDX_ACTIVATE_WRITE[];
954 #define IDX_ACTIVATE_SIZE	0x22
955 #define QETH_IDX_ACT_PNO(buffer) (buffer+0x0b)
956 #define QETH_IDX_ACT_ISSUER_RM_TOKEN(buffer) (buffer + 0x0c)
957 #define QETH_IDX_ACT_INVAL_FRAME	0x40
958 #define QETH_IDX_NO_PORTNAME_REQUIRED(buffer) ((buffer)[0x0b] & 0x80)
959 #define QETH_IDX_ACT_FUNC_LEVEL(buffer) (buffer + 0x10)
960 #define QETH_IDX_ACT_DATASET_NAME(buffer) (buffer + 0x16)
961 #define QETH_IDX_ACT_QDIO_DEV_CUA(buffer) (buffer + 0x1e)
962 #define QETH_IDX_ACT_QDIO_DEV_REALADDR(buffer) (buffer + 0x20)
963 #define QETH_IS_IDX_ACT_POS_REPLY(buffer) (((buffer)[0x08] & 3) == 2)
964 #define QETH_IDX_REPLY_LEVEL(buffer) (buffer + 0x12)
965 #define QETH_IDX_ACT_CAUSE_CODE(buffer) (buffer)[0x09]
966 #define QETH_IDX_ACT_ERR_EXCL		0x19
967 #define QETH_IDX_ACT_ERR_AUTH		0x1E
968 #define QETH_IDX_ACT_ERR_AUTH_USER	0x20
969 
970 #define QETH_IDX_TERMINATE		0xc0
971 #define QETH_IDX_TERMINATE_MASK		0xc0
972 #define QETH_IDX_TERM_BAD_TRANSPORT	0x41
973 #define QETH_IDX_TERM_BAD_TRANSPORT_VM	0xf6
974 
975 #define PDU_ENCAPSULATION(buffer) \
976 	(buffer + *(buffer + (*(buffer + 0x0b)) + \
977 	 *(buffer + *(buffer + 0x0b) + 0x11) + 0x07))
978 
979 #define IS_IPA(buffer) \
980 	((buffer) && \
981 	 (*(buffer + ((*(buffer + 0x0b)) + 4)) == 0xc1))
982 
983 #endif
984