Linux Kernel  3.7.1
 All Data Structures Namespaces Files Functions Variables Typedefs Enumerations Enumerator Macros Groups Pages
qeth_core_mpc.h
Go to the documentation of this file.
1 /*
2  * Copyright IBM Corp. 2007
3  * Author(s): Frank Pavlic <[email protected]>,
4  * Thomas Spatzier <[email protected]>,
5  * Frank Blaschka <[email protected]>
6  */
7 
8 #ifndef __QETH_CORE_MPC_H__
9 #define __QETH_CORE_MPC_H__
10 
11 #include <asm/qeth.h>
12 
13 #define IPA_PDU_HEADER_SIZE 0x40
14 #define QETH_IPA_PDU_LEN_TOTAL(buffer) (buffer + 0x0e)
15 #define QETH_IPA_PDU_LEN_PDU1(buffer) (buffer + 0x26)
16 #define QETH_IPA_PDU_LEN_PDU2(buffer) (buffer + 0x29)
17 #define QETH_IPA_PDU_LEN_PDU3(buffer) (buffer + 0x3a)
18 
19 extern unsigned char IPA_PDU_HEADER[];
20 #define QETH_IPA_CMD_DEST_ADDR(buffer) (buffer + 0x2c)
21 
22 #define IPA_CMD_LENGTH (IPA_PDU_HEADER_SIZE + sizeof(struct qeth_ipa_cmd))
23 
24 #define QETH_SEQ_NO_LENGTH 4
25 #define QETH_MPC_TOKEN_LENGTH 4
26 #define QETH_MCL_LENGTH 4
27 #define OSA_ADDR_LEN 6
28 
29 #define QETH_TIMEOUT (10 * HZ)
30 #define QETH_IPA_TIMEOUT (45 * HZ)
31 #define QETH_IDX_COMMAND_SEQNO 0xffff0000
32 #define SR_INFO_LEN 16
33 
34 #define QETH_CLEAR_CHANNEL_PARM -10
35 #define QETH_HALT_CHANNEL_PARM -11
36 #define QETH_RCD_PARM -12
37 
38 /*****************************************************************************/
39 /* IP Assist related definitions */
40 /*****************************************************************************/
41 #define IPA_CMD_INITIATOR_HOST 0x00
42 #define IPA_CMD_INITIATOR_OSA 0x01
43 #define IPA_CMD_INITIATOR_HOST_REPLY 0x80
44 #define IPA_CMD_INITIATOR_OSA_REPLY 0x81
45 #define IPA_CMD_PRIM_VERSION_NO 0x01
46 
54 };
55 
56 #define QETH_MPC_DIFINFO_LEN_INDICATES_LINK_TYPE 0x18
57 /* only the first two bytes are looked at in qeth_get_cardname_short */
69 };
70 
71 /*
72  * Routing stuff
73  */
74 #define RESET_ROUTING_FLAG 0x10 /* indicate that routing type shall be set */
76  /* TODO: set to bit flag used in IPA Command */
77  NO_ROUTER = 0,
83 };
84 
85 /* IPA Commands */
98  IPA_CMD_SETIP = 0xb1,
112 };
113 
119 };
120 
129 };
130 
131 
132 /* Return Codes for IPA Commands
133  * according to OSA card Specs */
134 
136  IPA_RC_SUCCESS = 0x0000,
137  IPA_RC_NOTSUPP = 0x0001,
181  IPA_RC_ENOMEM = 0xfffe,
182  IPA_RC_FFFF = 0xffff
183 };
184 /* for DELIP */
185 #define IPA_RC_IP_ADDRESS_NOT_DEFINED IPA_RC_PRIMARY_ALREADY_DEFINED
186 /* for SET_DIAGNOSTIC_ASSIST */
187 #define IPA_RC_INVALID_SUBCMD IPA_RC_IP_TABLE_FULL
188 #define IPA_RC_HARDWARE_AUTH_ERROR IPA_RC_UNKNOWN_ERROR
189 
190 /* IPA function flags; each flag marks availability of respective function */
192  IPA_ARP_PROCESSING = 0x00000001L,
193  IPA_INBOUND_CHECKSUM = 0x00000002L,
195  IPA_IP_FRAGMENTATION = 0x00000008L,
196  IPA_FILTERING = 0x00000010L,
197  IPA_IPV6 = 0x00000020L,
198  IPA_MULTICASTING = 0x00000040L,
199  IPA_IP_REASSEMBLY = 0x00000080L,
202  IPA_SETADAPTERPARMS = 0x00000400L,
203  IPA_VLAN_PRIO = 0x00000800L,
204  IPA_PASSTHRU = 0x00001000L,
206  IPA_FULL_VLAN = 0x00004000L,
207  IPA_INBOUND_PASSTHRU = 0x00008000L,
208  IPA_SOURCE_MAC = 0x00010000L,
209  IPA_OSA_MC_ROUTER = 0x00020000L,
210  IPA_QUERY_ARP_ASSIST = 0x00040000L,
211  IPA_INBOUND_TSO = 0x00080000L,
212  IPA_OUTBOUND_TSO = 0x00100000L,
213 };
214 
215 /* SETIP/DELIP IPA Command: ***************************************************/
217  QETH_IPA_SETDELIP_DEFAULT = 0x00L, /* default */
218  QETH_IPA_SETIP_VIPA_FLAG = 0x01L, /* no grat. ARP */
219  QETH_IPA_SETIP_TAKEOVER_FLAG = 0x02L, /* nofail on grat. ARP */
223 };
224 
225 /* SETADAPTER IPA Command: ****************************************************/
241  IPA_SETADP_QUERY_OAT = 0x00080000L,
242 };
249 };
255 };
259 };
261  ISOLATION_MODE_NONE = 0x00000000L,
262  ISOLATION_MODE_FWD = 0x00000001L,
263  ISOLATION_MODE_DROP = 0x00000002L,
264 };
272 };
273 
274 
275 /* (SET)DELIP(M) IPA stuff ***************************************************/
278  __u8 mask[4];
280 } __attribute__ ((packed));
284  __u8 mask[16];
286 } __attribute__ ((packed));
287 
289  __u8 mac[6];
291  __u8 ip6[12];
292  __u8 ip4[4];
293 } __attribute__ ((packed));
297  __u8 mac[6];
298 } __attribute__ ((packed));
302 } __attribute__ ((packed));
304 
312 } __attribute__((packed));
318  char data; /* only for replies */
319 } __attribute__((packed));
321 /* used as parameter for arp_query reply */
327  char *udata;
328 };
329 
330 /* SETASSPARMS IPA Command: */
333  union {
337  __u8 ip[16];
338  } data;
339 } __attribute__ ((packed));
341 
342 /* SETRTG IPA Command: ****************************************************/
345 };
346 
347 /* SETADAPTERPARMS IPA Command: *******************************************/
354 } __attribute__ ((packed));
361 } __attribute__ ((packed));
365  __u8 token[16];
372 } __attribute__ ((packed));
379 } __attribute__ ((packed));
384 } __attribute__((packed));
385 
386 /* SET_ACCESS_CONTROL: same format for request and reply */
389 } __attribute__((packed));
394 } __packed;
395 
399  char *buffer;
400 };
401 
412 } __attribute__ ((packed));
416  union {
423  } data;
424 } __attribute__ ((packed));
425 
426 /* CREATE_ADDR IPA Command: ***********************************************/
429 } __attribute__ ((packed));
431 /* SET DIAGNOSTIC ASSIST IPA Command: *************************************/
439 };
440 
443 };
444 
451 };
452 
457 };
458 
461  __u32:32;
463  __u16:16;
469  __u8 cdata[64];
470 } __attribute__ ((packed));
472 /* Header for each IPA command */
485 } __attribute__ ((packed));
487 /* The IPA command itself */
488 struct qeth_ipa_cmd {
490  union {
501  } data;
502 } __attribute__ ((packed));
503 
504 /*
505  * special command for ARP processing.
506  * this is not included in setassparms command before, because we get
507  * problem with the size of struct qeth_ipacmd_setassparms otherwise
508  */
516 };
517 
518 extern char *qeth_get_ipa_msg(enum qeth_ipa_return_codes rc);
519 extern char *qeth_get_ipa_cmd_name(enum qeth_ipa_cmds cmd);
520 
521 #define QETH_SETASS_BASE_LEN (sizeof(struct qeth_ipacmd_hdr) + \
522  sizeof(struct qeth_ipacmd_setassparms_hdr))
523 #define QETH_IPA_ARP_DATA_POS(buffer) (buffer + IPA_PDU_HEADER_SIZE + \
524  QETH_SETASS_BASE_LEN)
525 #define QETH_SETADP_BASE_LEN (sizeof(struct qeth_ipacmd_hdr) + \
526  sizeof(struct qeth_ipacmd_setadpparms_hdr))
527 #define QETH_SNMP_SETADP_CMDLENGTH 16
528 
529 #define QETH_ARP_DATA_SIZE 3968
530 #define QETH_ARP_CMD_LEN (QETH_ARP_DATA_SIZE + 8)
531 /* Helper functions */
532 #define IS_IPA_REPLY(cmd) ((cmd->hdr.initiator == IPA_CMD_INITIATOR_HOST) || \
533  (cmd->hdr.initiator == IPA_CMD_INITIATOR_OSA_REPLY))
534 
535 /*****************************************************************************/
536 /* END OF IP Assist related definitions */
537 /*****************************************************************************/
538 
539 
540 extern unsigned char WRITE_CCW[];
541 extern unsigned char READ_CCW[];
542 
543 extern unsigned char CM_ENABLE[];
544 #define CM_ENABLE_SIZE 0x63
545 #define QETH_CM_ENABLE_ISSUER_RM_TOKEN(buffer) (buffer + 0x2c)
546 #define QETH_CM_ENABLE_FILTER_TOKEN(buffer) (buffer + 0x53)
547 #define QETH_CM_ENABLE_USER_DATA(buffer) (buffer + 0x5b)
548 
549 #define QETH_CM_ENABLE_RESP_FILTER_TOKEN(buffer) \
550  (PDU_ENCAPSULATION(buffer) + 0x13)
551 
552 
553 extern unsigned char CM_SETUP[];
554 #define CM_SETUP_SIZE 0x64
555 #define QETH_CM_SETUP_DEST_ADDR(buffer) (buffer + 0x2c)
556 #define QETH_CM_SETUP_CONNECTION_TOKEN(buffer) (buffer + 0x51)
557 #define QETH_CM_SETUP_FILTER_TOKEN(buffer) (buffer + 0x5a)
558 
559 #define QETH_CM_SETUP_RESP_DEST_ADDR(buffer) \
560  (PDU_ENCAPSULATION(buffer) + 0x1a)
561 
562 extern unsigned char ULP_ENABLE[];
563 #define ULP_ENABLE_SIZE 0x6b
564 #define QETH_ULP_ENABLE_LINKNUM(buffer) (buffer + 0x61)
565 #define QETH_ULP_ENABLE_DEST_ADDR(buffer) (buffer + 0x2c)
566 #define QETH_ULP_ENABLE_FILTER_TOKEN(buffer) (buffer + 0x53)
567 #define QETH_ULP_ENABLE_PORTNAME_AND_LL(buffer) (buffer + 0x62)
568 #define QETH_ULP_ENABLE_RESP_FILTER_TOKEN(buffer) \
569  (PDU_ENCAPSULATION(buffer) + 0x13)
570 #define QETH_ULP_ENABLE_RESP_MAX_MTU(buffer) \
571  (PDU_ENCAPSULATION(buffer) + 0x1f)
572 #define QETH_ULP_ENABLE_RESP_DIFINFO_LEN(buffer) \
573  (PDU_ENCAPSULATION(buffer) + 0x17)
574 #define QETH_ULP_ENABLE_RESP_LINK_TYPE(buffer) \
575  (PDU_ENCAPSULATION(buffer) + 0x2b)
576 /* Layer 2 definitions */
577 #define QETH_PROT_LAYER2 0x08
578 #define QETH_PROT_TCPIP 0x03
579 #define QETH_PROT_OSN2 0x0a
580 #define QETH_ULP_ENABLE_PROT_TYPE(buffer) (buffer + 0x50)
581 #define QETH_IPA_CMD_PROT_TYPE(buffer) (buffer + 0x19)
582 
583 extern unsigned char ULP_SETUP[];
584 #define ULP_SETUP_SIZE 0x6c
585 #define QETH_ULP_SETUP_DEST_ADDR(buffer) (buffer + 0x2c)
586 #define QETH_ULP_SETUP_CONNECTION_TOKEN(buffer) (buffer + 0x51)
587 #define QETH_ULP_SETUP_FILTER_TOKEN(buffer) (buffer + 0x5a)
588 #define QETH_ULP_SETUP_CUA(buffer) (buffer + 0x68)
589 #define QETH_ULP_SETUP_REAL_DEVADDR(buffer) (buffer + 0x6a)
590 
591 #define QETH_ULP_SETUP_RESP_CONNECTION_TOKEN(buffer) \
592  (PDU_ENCAPSULATION(buffer) + 0x1a)
593 
594 
595 extern unsigned char DM_ACT[];
596 #define DM_ACT_SIZE 0x55
597 #define QETH_DM_ACT_DEST_ADDR(buffer) (buffer + 0x2c)
598 #define QETH_DM_ACT_CONNECTION_TOKEN(buffer) (buffer + 0x51)
599 
600 
601 
602 #define QETH_TRANSPORT_HEADER_SEQ_NO(buffer) (buffer + 4)
603 #define QETH_PDU_HEADER_SEQ_NO(buffer) (buffer + 0x1c)
604 #define QETH_PDU_HEADER_ACK_SEQ_NO(buffer) (buffer + 0x20)
605 
606 extern unsigned char IDX_ACTIVATE_READ[];
607 extern unsigned char IDX_ACTIVATE_WRITE[];
608 
609 #define IDX_ACTIVATE_SIZE 0x22
610 #define QETH_IDX_ACT_PNO(buffer) (buffer+0x0b)
611 #define QETH_IDX_ACT_ISSUER_RM_TOKEN(buffer) (buffer + 0x0c)
612 #define QETH_IDX_NO_PORTNAME_REQUIRED(buffer) ((buffer)[0x0b] & 0x80)
613 #define QETH_IDX_ACT_FUNC_LEVEL(buffer) (buffer + 0x10)
614 #define QETH_IDX_ACT_DATASET_NAME(buffer) (buffer + 0x16)
615 #define QETH_IDX_ACT_QDIO_DEV_CUA(buffer) (buffer + 0x1e)
616 #define QETH_IDX_ACT_QDIO_DEV_REALADDR(buffer) (buffer + 0x20)
617 #define QETH_IS_IDX_ACT_POS_REPLY(buffer) (((buffer)[0x08] & 3) == 2)
618 #define QETH_IDX_REPLY_LEVEL(buffer) (buffer + 0x12)
619 #define QETH_IDX_ACT_CAUSE_CODE(buffer) (buffer)[0x09]
620 #define QETH_IDX_ACT_ERR_EXCL 0x19
621 #define QETH_IDX_ACT_ERR_AUTH 0x1E
622 #define QETH_IDX_ACT_ERR_AUTH_USER 0x20
623 
624 #define PDU_ENCAPSULATION(buffer) \
625  (buffer + *(buffer + (*(buffer + 0x0b)) + \
626  *(buffer + *(buffer + 0x0b) + 0x11) + 0x07))
627 
628 #define IS_IPA(buffer) \
629  ((buffer) && \
630  (*(buffer + ((*(buffer + 0x0b)) + 4)) == 0xc1))
631 
632 #define ADDR_FRAME_TYPE_DIX 1
633 #define ADDR_FRAME_TYPE_802_3 2
634 #define ADDR_FRAME_TYPE_TR_WITHOUT_SR 0x10
635 #define ADDR_FRAME_TYPE_TR_WITH_SR 0x20
636 
637 #endif