qeth_mpc.h 17 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582
  1. /*
  2. * linux/drivers/s390/net/qeth_mpc.h
  3. *
  4. * Linux on zSeries OSA Express and HiperSockets support
  5. *
  6. * Copyright 2000,2003 IBM Corporation
  7. * Author(s): Utz Bacher <utz.bacher@de.ibm.com>
  8. * Thomas Spatzier <tspat@de.ibm.com>
  9. * Frank Pavlic <fpavlic@de.ibm.com>
  10. *
  11. */
  12. #ifndef __QETH_MPC_H__
  13. #define __QETH_MPC_H__
  14. #include <asm/qeth.h>
  15. #define IPA_PDU_HEADER_SIZE 0x40
  16. #define QETH_IPA_PDU_LEN_TOTAL(buffer) (buffer+0x0e)
  17. #define QETH_IPA_PDU_LEN_PDU1(buffer) (buffer+0x26)
  18. #define QETH_IPA_PDU_LEN_PDU2(buffer) (buffer+0x29)
  19. #define QETH_IPA_PDU_LEN_PDU3(buffer) (buffer+0x3a)
  20. extern unsigned char IPA_PDU_HEADER[];
  21. #define QETH_IPA_CMD_DEST_ADDR(buffer) (buffer+0x2c)
  22. #define IPA_CMD_LENGTH (IPA_PDU_HEADER_SIZE + sizeof(struct qeth_ipa_cmd))
  23. #define QETH_SEQ_NO_LENGTH 4
  24. #define QETH_MPC_TOKEN_LENGTH 4
  25. #define QETH_MCL_LENGTH 4
  26. #define OSA_ADDR_LEN 6
  27. #define QETH_TIMEOUT (10 * HZ)
  28. #define QETH_IPA_TIMEOUT (45 * HZ)
  29. #define QETH_IDX_COMMAND_SEQNO 0xffff0000
  30. #define SR_INFO_LEN 16
  31. #define QETH_CLEAR_CHANNEL_PARM -10
  32. #define QETH_HALT_CHANNEL_PARM -11
  33. #define QETH_RCD_PARM -12
  34. /*****************************************************************************/
  35. /* IP Assist related definitions */
  36. /*****************************************************************************/
  37. #define IPA_CMD_INITIATOR_HOST 0x00
  38. #define IPA_CMD_INITIATOR_OSA 0x01
  39. #define IPA_CMD_INITIATOR_HOST_REPLY 0x80
  40. #define IPA_CMD_INITIATOR_OSA_REPLY 0x81
  41. #define IPA_CMD_PRIM_VERSION_NO 0x01
  42. enum qeth_card_types {
  43. QETH_CARD_TYPE_UNKNOWN = 0,
  44. QETH_CARD_TYPE_OSAE = 10,
  45. QETH_CARD_TYPE_IQD = 1234,
  46. QETH_CARD_TYPE_OSN = 11,
  47. };
  48. #define QETH_MPC_DIFINFO_LEN_INDICATES_LINK_TYPE 0x18
  49. /* only the first two bytes are looked at in qeth_get_cardname_short */
  50. enum qeth_link_types {
  51. QETH_LINK_TYPE_FAST_ETH = 0x01,
  52. QETH_LINK_TYPE_HSTR = 0x02,
  53. QETH_LINK_TYPE_GBIT_ETH = 0x03,
  54. QETH_LINK_TYPE_OSN = 0x04,
  55. QETH_LINK_TYPE_10GBIT_ETH = 0x10,
  56. QETH_LINK_TYPE_LANE_ETH100 = 0x81,
  57. QETH_LINK_TYPE_LANE_TR = 0x82,
  58. QETH_LINK_TYPE_LANE_ETH1000 = 0x83,
  59. QETH_LINK_TYPE_LANE = 0x88,
  60. QETH_LINK_TYPE_ATM_NATIVE = 0x90,
  61. };
  62. enum qeth_tr_macaddr_modes {
  63. QETH_TR_MACADDR_NONCANONICAL = 0,
  64. QETH_TR_MACADDR_CANONICAL = 1,
  65. };
  66. enum qeth_tr_broadcast_modes {
  67. QETH_TR_BROADCAST_ALLRINGS = 0,
  68. QETH_TR_BROADCAST_LOCAL = 1,
  69. };
  70. /* these values match CHECKSUM_* in include/linux/skbuff.h */
  71. enum qeth_checksum_types {
  72. SW_CHECKSUMMING = 0, /* TODO: set to bit flag used in IPA Command */
  73. HW_CHECKSUMMING = 1,
  74. NO_CHECKSUMMING = 2,
  75. };
  76. #define QETH_CHECKSUM_DEFAULT SW_CHECKSUMMING
  77. /*
  78. * Routing stuff
  79. */
  80. #define RESET_ROUTING_FLAG 0x10 /* indicate that routing type shall be set */
  81. enum qeth_routing_types {
  82. NO_ROUTER = 0, /* TODO: set to bit flag used in IPA Command */
  83. PRIMARY_ROUTER = 1,
  84. SECONDARY_ROUTER = 2,
  85. MULTICAST_ROUTER = 3,
  86. PRIMARY_CONNECTOR = 4,
  87. SECONDARY_CONNECTOR = 5,
  88. };
  89. /* IPA Commands */
  90. enum qeth_ipa_cmds {
  91. IPA_CMD_STARTLAN = 0x01,
  92. IPA_CMD_STOPLAN = 0x02,
  93. IPA_CMD_SETVMAC = 0x21,
  94. IPA_CMD_DELVMAC = 0x22,
  95. IPA_CMD_SETGMAC = 0x23,
  96. IPA_CMD_DELGMAC = 0x24,
  97. IPA_CMD_SETVLAN = 0x25,
  98. IPA_CMD_DELVLAN = 0x26,
  99. IPA_CMD_SETCCID = 0x41,
  100. IPA_CMD_DELCCID = 0x42,
  101. IPA_CMD_MODCCID = 0x43,
  102. IPA_CMD_SETIP = 0xb1,
  103. IPA_CMD_QIPASSIST = 0xb2,
  104. IPA_CMD_SETASSPARMS = 0xb3,
  105. IPA_CMD_SETIPM = 0xb4,
  106. IPA_CMD_DELIPM = 0xb5,
  107. IPA_CMD_SETRTG = 0xb6,
  108. IPA_CMD_DELIP = 0xb7,
  109. IPA_CMD_SETADAPTERPARMS = 0xb8,
  110. IPA_CMD_SET_DIAG_ASS = 0xb9,
  111. IPA_CMD_CREATE_ADDR = 0xc3,
  112. IPA_CMD_DESTROY_ADDR = 0xc4,
  113. IPA_CMD_REGISTER_LOCAL_ADDR = 0xd1,
  114. IPA_CMD_UNREGISTER_LOCAL_ADDR = 0xd2,
  115. IPA_CMD_UNKNOWN = 0x00
  116. };
  117. enum qeth_ip_ass_cmds {
  118. IPA_CMD_ASS_START = 0x0001,
  119. IPA_CMD_ASS_STOP = 0x0002,
  120. IPA_CMD_ASS_CONFIGURE = 0x0003,
  121. IPA_CMD_ASS_ENABLE = 0x0004,
  122. };
  123. enum qeth_arp_process_subcmds {
  124. IPA_CMD_ASS_ARP_SET_NO_ENTRIES = 0x0003,
  125. IPA_CMD_ASS_ARP_QUERY_CACHE = 0x0004,
  126. IPA_CMD_ASS_ARP_ADD_ENTRY = 0x0005,
  127. IPA_CMD_ASS_ARP_REMOVE_ENTRY = 0x0006,
  128. IPA_CMD_ASS_ARP_FLUSH_CACHE = 0x0007,
  129. IPA_CMD_ASS_ARP_QUERY_INFO = 0x0104,
  130. IPA_CMD_ASS_ARP_QUERY_STATS = 0x0204,
  131. };
  132. /* Return Codes for IPA Commands
  133. * according to OSA card Specs */
  134. enum qeth_ipa_return_codes {
  135. IPA_RC_SUCCESS = 0x0000,
  136. IPA_RC_NOTSUPP = 0x0001,
  137. IPA_RC_IP_TABLE_FULL = 0x0002,
  138. IPA_RC_UNKNOWN_ERROR = 0x0003,
  139. IPA_RC_UNSUPPORTED_COMMAND = 0x0004,
  140. IPA_RC_DUP_IPV6_REMOTE = 0x0008,
  141. IPA_RC_DUP_IPV6_HOME = 0x0010,
  142. IPA_RC_UNREGISTERED_ADDR = 0x0011,
  143. IPA_RC_NO_ID_AVAILABLE = 0x0012,
  144. IPA_RC_ID_NOT_FOUND = 0x0013,
  145. IPA_RC_INVALID_IP_VERSION = 0x0020,
  146. IPA_RC_LAN_FRAME_MISMATCH = 0x0040,
  147. IPA_RC_L2_UNSUPPORTED_CMD = 0x2003,
  148. IPA_RC_L2_DUP_MAC = 0x2005,
  149. IPA_RC_L2_ADDR_TABLE_FULL = 0x2006,
  150. IPA_RC_L2_DUP_LAYER3_MAC = 0x200a,
  151. IPA_RC_L2_GMAC_NOT_FOUND = 0x200b,
  152. IPA_RC_L2_MAC_NOT_FOUND = 0x2010,
  153. IPA_RC_L2_INVALID_VLAN_ID = 0x2015,
  154. IPA_RC_L2_DUP_VLAN_ID = 0x2016,
  155. IPA_RC_L2_VLAN_ID_NOT_FOUND = 0x2017,
  156. IPA_RC_DATA_MISMATCH = 0xe001,
  157. IPA_RC_INVALID_MTU_SIZE = 0xe002,
  158. IPA_RC_INVALID_LANTYPE = 0xe003,
  159. IPA_RC_INVALID_LANNUM = 0xe004,
  160. IPA_RC_DUPLICATE_IP_ADDRESS = 0xe005,
  161. IPA_RC_IP_ADDR_TABLE_FULL = 0xe006,
  162. IPA_RC_LAN_PORT_STATE_ERROR = 0xe007,
  163. IPA_RC_SETIP_NO_STARTLAN = 0xe008,
  164. IPA_RC_SETIP_ALREADY_RECEIVED = 0xe009,
  165. IPA_RC_IP_ADDR_ALREADY_USED = 0xe00a,
  166. IPA_RC_MULTICAST_FULL = 0xe00b,
  167. IPA_RC_SETIP_INVALID_VERSION = 0xe00d,
  168. IPA_RC_UNSUPPORTED_SUBCMD = 0xe00e,
  169. IPA_RC_ARP_ASSIST_NO_ENABLE = 0xe00f,
  170. IPA_RC_PRIMARY_ALREADY_DEFINED = 0xe010,
  171. IPA_RC_SECOND_ALREADY_DEFINED = 0xe011,
  172. IPA_RC_INVALID_SETRTG_INDICATOR = 0xe012,
  173. IPA_RC_MC_ADDR_ALREADY_DEFINED = 0xe013,
  174. IPA_RC_LAN_OFFLINE = 0xe080,
  175. IPA_RC_INVALID_IP_VERSION2 = 0xf001,
  176. IPA_RC_FFFF = 0xffff
  177. };
  178. /* IPA function flags; each flag marks availability of respective function */
  179. enum qeth_ipa_funcs {
  180. IPA_ARP_PROCESSING = 0x00000001L,
  181. IPA_INBOUND_CHECKSUM = 0x00000002L,
  182. IPA_OUTBOUND_CHECKSUM = 0x00000004L,
  183. IPA_IP_FRAGMENTATION = 0x00000008L,
  184. IPA_FILTERING = 0x00000010L,
  185. IPA_IPV6 = 0x00000020L,
  186. IPA_MULTICASTING = 0x00000040L,
  187. IPA_IP_REASSEMBLY = 0x00000080L,
  188. IPA_QUERY_ARP_COUNTERS = 0x00000100L,
  189. IPA_QUERY_ARP_ADDR_INFO = 0x00000200L,
  190. IPA_SETADAPTERPARMS = 0x00000400L,
  191. IPA_VLAN_PRIO = 0x00000800L,
  192. IPA_PASSTHRU = 0x00001000L,
  193. IPA_FLUSH_ARP_SUPPORT = 0x00002000L,
  194. IPA_FULL_VLAN = 0x00004000L,
  195. IPA_INBOUND_PASSTHRU = 0x00008000L,
  196. IPA_SOURCE_MAC = 0x00010000L,
  197. IPA_OSA_MC_ROUTER = 0x00020000L,
  198. IPA_QUERY_ARP_ASSIST = 0x00040000L,
  199. IPA_INBOUND_TSO = 0x00080000L,
  200. IPA_OUTBOUND_TSO = 0x00100000L,
  201. };
  202. /* SETIP/DELIP IPA Command: ***************************************************/
  203. enum qeth_ipa_setdelip_flags {
  204. QETH_IPA_SETDELIP_DEFAULT = 0x00L, /* default */
  205. QETH_IPA_SETIP_VIPA_FLAG = 0x01L, /* no grat. ARP */
  206. QETH_IPA_SETIP_TAKEOVER_FLAG = 0x02L, /* nofail on grat. ARP */
  207. QETH_IPA_DELIP_ADDR_2_B_TAKEN_OVER = 0x20L,
  208. QETH_IPA_DELIP_VIPA_FLAG = 0x40L,
  209. QETH_IPA_DELIP_ADDR_NEEDS_SETIP = 0x80L,
  210. };
  211. /* SETADAPTER IPA Command: ****************************************************/
  212. enum qeth_ipa_setadp_cmd {
  213. IPA_SETADP_QUERY_COMMANDS_SUPPORTED = 0x01,
  214. IPA_SETADP_ALTER_MAC_ADDRESS = 0x02,
  215. IPA_SETADP_ADD_DELETE_GROUP_ADDRESS = 0x04,
  216. IPA_SETADP_ADD_DELETE_FUNCTIONAL_ADDR = 0x08,
  217. IPA_SETADP_SET_ADDRESSING_MODE = 0x10,
  218. IPA_SETADP_SET_CONFIG_PARMS = 0x20,
  219. IPA_SETADP_SET_CONFIG_PARMS_EXTENDED = 0x40,
  220. IPA_SETADP_SET_BROADCAST_MODE = 0x80,
  221. IPA_SETADP_SEND_OSA_MESSAGE = 0x0100,
  222. IPA_SETADP_SET_SNMP_CONTROL = 0x0200,
  223. IPA_SETADP_QUERY_CARD_INFO = 0x0400,
  224. IPA_SETADP_SET_PROMISC_MODE = 0x0800,
  225. };
  226. enum qeth_ipa_mac_ops {
  227. CHANGE_ADDR_READ_MAC = 0,
  228. CHANGE_ADDR_REPLACE_MAC = 1,
  229. CHANGE_ADDR_ADD_MAC = 2,
  230. CHANGE_ADDR_DEL_MAC = 4,
  231. CHANGE_ADDR_RESET_MAC = 8,
  232. };
  233. enum qeth_ipa_addr_ops {
  234. CHANGE_ADDR_READ_ADDR = 0,
  235. CHANGE_ADDR_ADD_ADDR = 1,
  236. CHANGE_ADDR_DEL_ADDR = 2,
  237. CHANGE_ADDR_FLUSH_ADDR_TABLE = 4,
  238. };
  239. enum qeth_ipa_promisc_modes {
  240. SET_PROMISC_MODE_OFF = 0,
  241. SET_PROMISC_MODE_ON = 1,
  242. };
  243. /* (SET)DELIP(M) IPA stuff ***************************************************/
  244. struct qeth_ipacmd_setdelip4 {
  245. __u8 ip_addr[4];
  246. __u8 mask[4];
  247. __u32 flags;
  248. } __attribute__ ((packed));
  249. struct qeth_ipacmd_setdelip6 {
  250. __u8 ip_addr[16];
  251. __u8 mask[16];
  252. __u32 flags;
  253. } __attribute__ ((packed));
  254. struct qeth_ipacmd_setdelipm {
  255. __u8 mac[6];
  256. __u8 padding[2];
  257. __u8 ip6[12];
  258. __u8 ip4[4];
  259. } __attribute__ ((packed));
  260. struct qeth_ipacmd_layer2setdelmac {
  261. __u32 mac_length;
  262. __u8 mac[6];
  263. } __attribute__ ((packed));
  264. struct qeth_ipacmd_layer2setdelvlan {
  265. __u16 vlan_id;
  266. } __attribute__ ((packed));
  267. struct qeth_ipacmd_setassparms_hdr {
  268. __u32 assist_no;
  269. __u16 length;
  270. __u16 command_code;
  271. __u16 return_code;
  272. __u8 number_of_replies;
  273. __u8 seq_no;
  274. } __attribute__((packed));
  275. struct qeth_arp_query_data {
  276. __u16 request_bits;
  277. __u16 reply_bits;
  278. __u32 no_entries;
  279. char data;
  280. } __attribute__((packed));
  281. /* used as parameter for arp_query reply */
  282. struct qeth_arp_query_info {
  283. __u32 udata_len;
  284. __u16 mask_bits;
  285. __u32 udata_offset;
  286. __u32 no_entries;
  287. char *udata;
  288. };
  289. /* SETASSPARMS IPA Command: */
  290. struct qeth_ipacmd_setassparms {
  291. struct qeth_ipacmd_setassparms_hdr hdr;
  292. union {
  293. __u32 flags_32bit;
  294. struct qeth_arp_cache_entry add_arp_entry;
  295. struct qeth_arp_query_data query_arp;
  296. __u8 ip[16];
  297. } data;
  298. } __attribute__ ((packed));
  299. /* SETRTG IPA Command: ****************************************************/
  300. struct qeth_set_routing {
  301. __u8 type;
  302. };
  303. /* SETADAPTERPARMS IPA Command: *******************************************/
  304. struct qeth_query_cmds_supp {
  305. __u32 no_lantypes_supp;
  306. __u8 lan_type;
  307. __u8 reserved1[3];
  308. __u32 supported_cmds;
  309. __u8 reserved2[8];
  310. } __attribute__ ((packed));
  311. struct qeth_change_addr {
  312. __u32 cmd;
  313. __u32 addr_size;
  314. __u32 no_macs;
  315. __u8 addr[OSA_ADDR_LEN];
  316. } __attribute__ ((packed));
  317. struct qeth_snmp_cmd {
  318. __u8 token[16];
  319. __u32 request;
  320. __u32 interface;
  321. __u32 returncode;
  322. __u32 firmwarelevel;
  323. __u32 seqno;
  324. __u8 data;
  325. } __attribute__ ((packed));
  326. struct qeth_snmp_ureq_hdr {
  327. __u32 data_len;
  328. __u32 req_len;
  329. __u32 reserved1;
  330. __u32 reserved2;
  331. } __attribute__ ((packed));
  332. struct qeth_snmp_ureq {
  333. struct qeth_snmp_ureq_hdr hdr;
  334. struct qeth_snmp_cmd cmd;
  335. } __attribute__((packed));
  336. struct qeth_ipacmd_setadpparms_hdr {
  337. __u32 supp_hw_cmds;
  338. __u32 reserved1;
  339. __u16 cmdlength;
  340. __u16 reserved2;
  341. __u32 command_code;
  342. __u16 return_code;
  343. __u8 used_total;
  344. __u8 seq_no;
  345. __u32 reserved3;
  346. } __attribute__ ((packed));
  347. struct qeth_ipacmd_setadpparms {
  348. struct qeth_ipacmd_setadpparms_hdr hdr;
  349. union {
  350. struct qeth_query_cmds_supp query_cmds_supp;
  351. struct qeth_change_addr change_addr;
  352. struct qeth_snmp_cmd snmp;
  353. __u32 mode;
  354. } data;
  355. } __attribute__ ((packed));
  356. /* IPFRAME IPA Command: ***************************************************/
  357. /* TODO: define in analogy to commands define above */
  358. /* ADD_ADDR_ENTRY IPA Command: ********************************************/
  359. /* TODO: define in analogy to commands define above */
  360. /* DELETE_ADDR_ENTRY IPA Command: *****************************************/
  361. /* TODO: define in analogy to commands define above */
  362. /* CREATE_ADDR IPA Command: ***********************************************/
  363. struct qeth_create_destroy_address {
  364. __u8 unique_id[8];
  365. } __attribute__ ((packed));
  366. /* REGISTER_LOCAL_ADDR IPA Command: ***************************************/
  367. /* TODO: define in analogy to commands define above */
  368. /* UNREGISTER_LOCAL_ADDR IPA Command: *************************************/
  369. /* TODO: define in analogy to commands define above */
  370. /* Header for each IPA command */
  371. struct qeth_ipacmd_hdr {
  372. __u8 command;
  373. __u8 initiator;
  374. __u16 seqno;
  375. __u16 return_code;
  376. __u8 adapter_type;
  377. __u8 rel_adapter_no;
  378. __u8 prim_version_no;
  379. __u8 param_count;
  380. __u16 prot_version;
  381. __u32 ipa_supported;
  382. __u32 ipa_enabled;
  383. } __attribute__ ((packed));
  384. /* The IPA command itself */
  385. struct qeth_ipa_cmd {
  386. struct qeth_ipacmd_hdr hdr;
  387. union {
  388. struct qeth_ipacmd_setdelip4 setdelip4;
  389. struct qeth_ipacmd_setdelip6 setdelip6;
  390. struct qeth_ipacmd_setdelipm setdelipm;
  391. struct qeth_ipacmd_setassparms setassparms;
  392. struct qeth_ipacmd_layer2setdelmac setdelmac;
  393. struct qeth_ipacmd_layer2setdelvlan setdelvlan;
  394. struct qeth_create_destroy_address create_destroy_addr;
  395. struct qeth_ipacmd_setadpparms setadapterparms;
  396. struct qeth_set_routing setrtg;
  397. } data;
  398. } __attribute__ ((packed));
  399. /*
  400. * special command for ARP processing.
  401. * this is not included in setassparms command before, because we get
  402. * problem with the size of struct qeth_ipacmd_setassparms otherwise
  403. */
  404. enum qeth_ipa_arp_return_codes {
  405. QETH_IPA_ARP_RC_SUCCESS = 0x0000,
  406. QETH_IPA_ARP_RC_FAILED = 0x0001,
  407. QETH_IPA_ARP_RC_NOTSUPP = 0x0002,
  408. QETH_IPA_ARP_RC_OUT_OF_RANGE = 0x0003,
  409. QETH_IPA_ARP_RC_Q_NOTSUPP = 0x0004,
  410. QETH_IPA_ARP_RC_Q_NO_DATA = 0x0008,
  411. };
  412. extern char *
  413. qeth_get_ipa_msg(enum qeth_ipa_return_codes rc);
  414. extern char *
  415. qeth_get_ipa_cmd_name(enum qeth_ipa_cmds cmd);
  416. #define QETH_SETASS_BASE_LEN (sizeof(struct qeth_ipacmd_hdr) + \
  417. sizeof(struct qeth_ipacmd_setassparms_hdr))
  418. #define QETH_IPA_ARP_DATA_POS(buffer) (buffer + IPA_PDU_HEADER_SIZE + \
  419. QETH_SETASS_BASE_LEN)
  420. #define QETH_SETADP_BASE_LEN (sizeof(struct qeth_ipacmd_hdr) + \
  421. sizeof(struct qeth_ipacmd_setadpparms_hdr))
  422. #define QETH_SNMP_SETADP_CMDLENGTH 16
  423. #define QETH_ARP_DATA_SIZE 3968
  424. #define QETH_ARP_CMD_LEN (QETH_ARP_DATA_SIZE + 8)
  425. /* Helper functions */
  426. #define IS_IPA_REPLY(cmd) ((cmd->hdr.initiator == IPA_CMD_INITIATOR_HOST) || \
  427. (cmd->hdr.initiator == IPA_CMD_INITIATOR_OSA_REPLY))
  428. /*****************************************************************************/
  429. /* END OF IP Assist related definitions */
  430. /*****************************************************************************/
  431. extern unsigned char WRITE_CCW[];
  432. extern unsigned char READ_CCW[];
  433. extern unsigned char CM_ENABLE[];
  434. #define CM_ENABLE_SIZE 0x63
  435. #define QETH_CM_ENABLE_ISSUER_RM_TOKEN(buffer) (buffer+0x2c)
  436. #define QETH_CM_ENABLE_FILTER_TOKEN(buffer) (buffer+0x53)
  437. #define QETH_CM_ENABLE_USER_DATA(buffer) (buffer+0x5b)
  438. #define QETH_CM_ENABLE_RESP_FILTER_TOKEN(buffer) \
  439. (PDU_ENCAPSULATION(buffer)+ 0x13)
  440. extern unsigned char CM_SETUP[];
  441. #define CM_SETUP_SIZE 0x64
  442. #define QETH_CM_SETUP_DEST_ADDR(buffer) (buffer+0x2c)
  443. #define QETH_CM_SETUP_CONNECTION_TOKEN(buffer) (buffer+0x51)
  444. #define QETH_CM_SETUP_FILTER_TOKEN(buffer) (buffer+0x5a)
  445. #define QETH_CM_SETUP_RESP_DEST_ADDR(buffer) \
  446. (PDU_ENCAPSULATION(buffer) + 0x1a)
  447. extern unsigned char ULP_ENABLE[];
  448. #define ULP_ENABLE_SIZE 0x6b
  449. #define QETH_ULP_ENABLE_LINKNUM(buffer) (buffer+0x61)
  450. #define QETH_ULP_ENABLE_DEST_ADDR(buffer) (buffer+0x2c)
  451. #define QETH_ULP_ENABLE_FILTER_TOKEN(buffer) (buffer+0x53)
  452. #define QETH_ULP_ENABLE_PORTNAME_AND_LL(buffer) (buffer+0x62)
  453. #define QETH_ULP_ENABLE_RESP_FILTER_TOKEN(buffer) \
  454. (PDU_ENCAPSULATION(buffer) + 0x13)
  455. #define QETH_ULP_ENABLE_RESP_MAX_MTU(buffer) \
  456. (PDU_ENCAPSULATION(buffer)+ 0x1f)
  457. #define QETH_ULP_ENABLE_RESP_DIFINFO_LEN(buffer) \
  458. (PDU_ENCAPSULATION(buffer) + 0x17)
  459. #define QETH_ULP_ENABLE_RESP_LINK_TYPE(buffer) \
  460. (PDU_ENCAPSULATION(buffer)+ 0x2b)
  461. /* Layer 2 defintions */
  462. #define QETH_PROT_LAYER2 0x08
  463. #define QETH_PROT_TCPIP 0x03
  464. #define QETH_PROT_OSN2 0x0a
  465. #define QETH_ULP_ENABLE_PROT_TYPE(buffer) (buffer+0x50)
  466. #define QETH_IPA_CMD_PROT_TYPE(buffer) (buffer+0x19)
  467. extern unsigned char ULP_SETUP[];
  468. #define ULP_SETUP_SIZE 0x6c
  469. #define QETH_ULP_SETUP_DEST_ADDR(buffer) (buffer+0x2c)
  470. #define QETH_ULP_SETUP_CONNECTION_TOKEN(buffer) (buffer+0x51)
  471. #define QETH_ULP_SETUP_FILTER_TOKEN(buffer) (buffer+0x5a)
  472. #define QETH_ULP_SETUP_CUA(buffer) (buffer+0x68)
  473. #define QETH_ULP_SETUP_REAL_DEVADDR(buffer) (buffer+0x6a)
  474. #define QETH_ULP_SETUP_RESP_CONNECTION_TOKEN(buffer) \
  475. (PDU_ENCAPSULATION(buffer)+0x1a)
  476. extern unsigned char DM_ACT[];
  477. #define DM_ACT_SIZE 0x55
  478. #define QETH_DM_ACT_DEST_ADDR(buffer) (buffer+0x2c)
  479. #define QETH_DM_ACT_CONNECTION_TOKEN(buffer) (buffer+0x51)
  480. #define QETH_TRANSPORT_HEADER_SEQ_NO(buffer) (buffer+4)
  481. #define QETH_PDU_HEADER_SEQ_NO(buffer) (buffer+0x1c)
  482. #define QETH_PDU_HEADER_ACK_SEQ_NO(buffer) (buffer+0x20)
  483. extern unsigned char IDX_ACTIVATE_READ[];
  484. extern unsigned char IDX_ACTIVATE_WRITE[];
  485. #define IDX_ACTIVATE_SIZE 0x22
  486. #define QETH_IDX_ACT_ISSUER_RM_TOKEN(buffer) (buffer+0x0c)
  487. #define QETH_IDX_NO_PORTNAME_REQUIRED(buffer) ((buffer)[0x0b]&0x80)
  488. #define QETH_IDX_ACT_FUNC_LEVEL(buffer) (buffer+0x10)
  489. #define QETH_IDX_ACT_DATASET_NAME(buffer) (buffer+0x16)
  490. #define QETH_IDX_ACT_QDIO_DEV_CUA(buffer) (buffer+0x1e)
  491. #define QETH_IDX_ACT_QDIO_DEV_REALADDR(buffer) (buffer+0x20)
  492. #define QETH_IS_IDX_ACT_POS_REPLY(buffer) (((buffer)[0x08]&3)==2)
  493. #define QETH_IDX_REPLY_LEVEL(buffer) (buffer+0x12)
  494. #define PDU_ENCAPSULATION(buffer) \
  495. (buffer + *(buffer + (*(buffer+0x0b)) + \
  496. *(buffer + *(buffer+0x0b)+0x11) +0x07))
  497. #define IS_IPA(buffer) \
  498. ((buffer) && \
  499. ( *(buffer + ((*(buffer+0x0b))+4) )==0xc1) )
  500. #define ADDR_FRAME_TYPE_DIX 1
  501. #define ADDR_FRAME_TYPE_802_3 2
  502. #define ADDR_FRAME_TYPE_TR_WITHOUT_SR 0x10
  503. #define ADDR_FRAME_TYPE_TR_WITH_SR 0x20
  504. #endif