qeth_core_mpc.h 23 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590591592593594595596597598599600601602603604605606607608609610611612613614615616617618619620621622623624625626627628629630631632633634635636637638639640641642643644645646647648649650651652653654655656657658659660661662663664665666667668669670671672673674675676677678679680681682683684685686687688689690691692693694695696697698699700701702703704705706707708709710711712713714715716717718719720721722723724725726727728729730731732733734735736737738739740741742743744745746747748749750751752753754755756757758759760761762763764765766767768769770771772773774775776777778779780781782783784785786787788789790791792793794795796797798799800801802803804805806807808809
  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. #ifndef __QETH_CORE_MPC_H__
  8. #define __QETH_CORE_MPC_H__
  9. #include <asm/qeth.h>
  10. #define IPA_PDU_HEADER_SIZE 0x40
  11. #define QETH_IPA_PDU_LEN_TOTAL(buffer) (buffer + 0x0e)
  12. #define QETH_IPA_PDU_LEN_PDU1(buffer) (buffer + 0x26)
  13. #define QETH_IPA_PDU_LEN_PDU2(buffer) (buffer + 0x29)
  14. #define QETH_IPA_PDU_LEN_PDU3(buffer) (buffer + 0x3a)
  15. extern unsigned char IPA_PDU_HEADER[];
  16. #define QETH_IPA_CMD_DEST_ADDR(buffer) (buffer + 0x2c)
  17. #define IPA_CMD_LENGTH (IPA_PDU_HEADER_SIZE + sizeof(struct qeth_ipa_cmd))
  18. #define QETH_SEQ_NO_LENGTH 4
  19. #define QETH_MPC_TOKEN_LENGTH 4
  20. #define QETH_MCL_LENGTH 4
  21. #define OSA_ADDR_LEN 6
  22. #define QETH_TIMEOUT (10 * HZ)
  23. #define QETH_IPA_TIMEOUT (45 * HZ)
  24. #define QETH_IDX_COMMAND_SEQNO 0xffff0000
  25. #define SR_INFO_LEN 16
  26. #define QETH_CLEAR_CHANNEL_PARM -10
  27. #define QETH_HALT_CHANNEL_PARM -11
  28. #define QETH_RCD_PARM -12
  29. /*****************************************************************************/
  30. /* IP Assist related definitions */
  31. /*****************************************************************************/
  32. #define IPA_CMD_INITIATOR_HOST 0x00
  33. #define IPA_CMD_INITIATOR_OSA 0x01
  34. #define IPA_CMD_INITIATOR_HOST_REPLY 0x80
  35. #define IPA_CMD_INITIATOR_OSA_REPLY 0x81
  36. #define IPA_CMD_PRIM_VERSION_NO 0x01
  37. enum qeth_card_types {
  38. QETH_CARD_TYPE_UNKNOWN = 0,
  39. QETH_CARD_TYPE_OSD = 1,
  40. QETH_CARD_TYPE_IQD = 5,
  41. QETH_CARD_TYPE_OSN = 6,
  42. QETH_CARD_TYPE_OSM = 3,
  43. QETH_CARD_TYPE_OSX = 2,
  44. };
  45. #define QETH_MPC_DIFINFO_LEN_INDICATES_LINK_TYPE 0x18
  46. /* only the first two bytes are looked at in qeth_get_cardname_short */
  47. enum qeth_link_types {
  48. QETH_LINK_TYPE_FAST_ETH = 0x01,
  49. QETH_LINK_TYPE_HSTR = 0x02,
  50. QETH_LINK_TYPE_GBIT_ETH = 0x03,
  51. QETH_LINK_TYPE_OSN = 0x04,
  52. QETH_LINK_TYPE_10GBIT_ETH = 0x10,
  53. QETH_LINK_TYPE_LANE_ETH100 = 0x81,
  54. QETH_LINK_TYPE_LANE_TR = 0x82,
  55. QETH_LINK_TYPE_LANE_ETH1000 = 0x83,
  56. QETH_LINK_TYPE_LANE = 0x88,
  57. QETH_LINK_TYPE_ATM_NATIVE = 0x90,
  58. };
  59. /*
  60. * Routing stuff
  61. */
  62. #define RESET_ROUTING_FLAG 0x10 /* indicate that routing type shall be set */
  63. enum qeth_routing_types {
  64. /* TODO: set to bit flag used in IPA Command */
  65. NO_ROUTER = 0,
  66. PRIMARY_ROUTER = 1,
  67. SECONDARY_ROUTER = 2,
  68. MULTICAST_ROUTER = 3,
  69. PRIMARY_CONNECTOR = 4,
  70. SECONDARY_CONNECTOR = 5,
  71. };
  72. /* IPA Commands */
  73. enum qeth_ipa_cmds {
  74. IPA_CMD_STARTLAN = 0x01,
  75. IPA_CMD_STOPLAN = 0x02,
  76. IPA_CMD_SETVMAC = 0x21,
  77. IPA_CMD_DELVMAC = 0x22,
  78. IPA_CMD_SETGMAC = 0x23,
  79. IPA_CMD_DELGMAC = 0x24,
  80. IPA_CMD_SETVLAN = 0x25,
  81. IPA_CMD_DELVLAN = 0x26,
  82. IPA_CMD_SETBRIDGEPORT_OSA = 0x2b,
  83. IPA_CMD_SETCCID = 0x41,
  84. IPA_CMD_DELCCID = 0x42,
  85. IPA_CMD_MODCCID = 0x43,
  86. IPA_CMD_SETIP = 0xb1,
  87. IPA_CMD_QIPASSIST = 0xb2,
  88. IPA_CMD_SETASSPARMS = 0xb3,
  89. IPA_CMD_SETIPM = 0xb4,
  90. IPA_CMD_DELIPM = 0xb5,
  91. IPA_CMD_SETRTG = 0xb6,
  92. IPA_CMD_DELIP = 0xb7,
  93. IPA_CMD_SETADAPTERPARMS = 0xb8,
  94. IPA_CMD_SET_DIAG_ASS = 0xb9,
  95. IPA_CMD_SETBRIDGEPORT_IQD = 0xbe,
  96. IPA_CMD_CREATE_ADDR = 0xc3,
  97. IPA_CMD_DESTROY_ADDR = 0xc4,
  98. IPA_CMD_REGISTER_LOCAL_ADDR = 0xd1,
  99. IPA_CMD_UNREGISTER_LOCAL_ADDR = 0xd2,
  100. IPA_CMD_ADDRESS_CHANGE_NOTIF = 0xd3,
  101. IPA_CMD_UNKNOWN = 0x00
  102. };
  103. enum qeth_ip_ass_cmds {
  104. IPA_CMD_ASS_START = 0x0001,
  105. IPA_CMD_ASS_STOP = 0x0002,
  106. IPA_CMD_ASS_CONFIGURE = 0x0003,
  107. IPA_CMD_ASS_ENABLE = 0x0004,
  108. };
  109. enum qeth_arp_process_subcmds {
  110. IPA_CMD_ASS_ARP_SET_NO_ENTRIES = 0x0003,
  111. IPA_CMD_ASS_ARP_QUERY_CACHE = 0x0004,
  112. IPA_CMD_ASS_ARP_ADD_ENTRY = 0x0005,
  113. IPA_CMD_ASS_ARP_REMOVE_ENTRY = 0x0006,
  114. IPA_CMD_ASS_ARP_FLUSH_CACHE = 0x0007,
  115. IPA_CMD_ASS_ARP_QUERY_INFO = 0x0104,
  116. IPA_CMD_ASS_ARP_QUERY_STATS = 0x0204,
  117. };
  118. /* Return Codes for IPA Commands
  119. * according to OSA card Specs */
  120. enum qeth_ipa_return_codes {
  121. IPA_RC_SUCCESS = 0x0000,
  122. IPA_RC_NOTSUPP = 0x0001,
  123. IPA_RC_IP_TABLE_FULL = 0x0002,
  124. IPA_RC_UNKNOWN_ERROR = 0x0003,
  125. IPA_RC_UNSUPPORTED_COMMAND = 0x0004,
  126. IPA_RC_TRACE_ALREADY_ACTIVE = 0x0005,
  127. IPA_RC_INVALID_FORMAT = 0x0006,
  128. IPA_RC_DUP_IPV6_REMOTE = 0x0008,
  129. IPA_RC_DUP_IPV6_HOME = 0x0010,
  130. IPA_RC_UNREGISTERED_ADDR = 0x0011,
  131. IPA_RC_NO_ID_AVAILABLE = 0x0012,
  132. IPA_RC_ID_NOT_FOUND = 0x0013,
  133. IPA_RC_INVALID_IP_VERSION = 0x0020,
  134. IPA_RC_LAN_FRAME_MISMATCH = 0x0040,
  135. IPA_RC_L2_UNSUPPORTED_CMD = 0x2003,
  136. IPA_RC_L2_DUP_MAC = 0x2005,
  137. IPA_RC_L2_ADDR_TABLE_FULL = 0x2006,
  138. IPA_RC_L2_DUP_LAYER3_MAC = 0x200a,
  139. IPA_RC_L2_GMAC_NOT_FOUND = 0x200b,
  140. IPA_RC_L2_MAC_NOT_AUTH_BY_HYP = 0x200c,
  141. IPA_RC_L2_MAC_NOT_AUTH_BY_ADP = 0x200d,
  142. IPA_RC_L2_MAC_NOT_FOUND = 0x2010,
  143. IPA_RC_L2_INVALID_VLAN_ID = 0x2015,
  144. IPA_RC_L2_DUP_VLAN_ID = 0x2016,
  145. IPA_RC_L2_VLAN_ID_NOT_FOUND = 0x2017,
  146. IPA_RC_DATA_MISMATCH = 0xe001,
  147. IPA_RC_INVALID_MTU_SIZE = 0xe002,
  148. IPA_RC_INVALID_LANTYPE = 0xe003,
  149. IPA_RC_INVALID_LANNUM = 0xe004,
  150. IPA_RC_DUPLICATE_IP_ADDRESS = 0xe005,
  151. IPA_RC_IP_ADDR_TABLE_FULL = 0xe006,
  152. IPA_RC_LAN_PORT_STATE_ERROR = 0xe007,
  153. IPA_RC_SETIP_NO_STARTLAN = 0xe008,
  154. IPA_RC_SETIP_ALREADY_RECEIVED = 0xe009,
  155. IPA_RC_IP_ADDR_ALREADY_USED = 0xe00a,
  156. IPA_RC_MC_ADDR_NOT_FOUND = 0xe00b,
  157. IPA_RC_SETIP_INVALID_VERSION = 0xe00d,
  158. IPA_RC_UNSUPPORTED_SUBCMD = 0xe00e,
  159. IPA_RC_ARP_ASSIST_NO_ENABLE = 0xe00f,
  160. IPA_RC_PRIMARY_ALREADY_DEFINED = 0xe010,
  161. IPA_RC_SECOND_ALREADY_DEFINED = 0xe011,
  162. IPA_RC_INVALID_SETRTG_INDICATOR = 0xe012,
  163. IPA_RC_MC_ADDR_ALREADY_DEFINED = 0xe013,
  164. IPA_RC_LAN_OFFLINE = 0xe080,
  165. IPA_RC_VEPA_TO_VEB_TRANSITION = 0xe090,
  166. IPA_RC_INVALID_IP_VERSION2 = 0xf001,
  167. IPA_RC_ENOMEM = 0xfffe,
  168. IPA_RC_FFFF = 0xffff
  169. };
  170. /* for DELIP */
  171. #define IPA_RC_IP_ADDRESS_NOT_DEFINED IPA_RC_PRIMARY_ALREADY_DEFINED
  172. /* for SET_DIAGNOSTIC_ASSIST */
  173. #define IPA_RC_INVALID_SUBCMD IPA_RC_IP_TABLE_FULL
  174. #define IPA_RC_HARDWARE_AUTH_ERROR IPA_RC_UNKNOWN_ERROR
  175. /* IPA function flags; each flag marks availability of respective function */
  176. enum qeth_ipa_funcs {
  177. IPA_ARP_PROCESSING = 0x00000001L,
  178. IPA_INBOUND_CHECKSUM = 0x00000002L,
  179. IPA_OUTBOUND_CHECKSUM = 0x00000004L,
  180. IPA_IP_FRAGMENTATION = 0x00000008L,
  181. IPA_FILTERING = 0x00000010L,
  182. IPA_IPV6 = 0x00000020L,
  183. IPA_MULTICASTING = 0x00000040L,
  184. IPA_IP_REASSEMBLY = 0x00000080L,
  185. IPA_QUERY_ARP_COUNTERS = 0x00000100L,
  186. IPA_QUERY_ARP_ADDR_INFO = 0x00000200L,
  187. IPA_SETADAPTERPARMS = 0x00000400L,
  188. IPA_VLAN_PRIO = 0x00000800L,
  189. IPA_PASSTHRU = 0x00001000L,
  190. IPA_FLUSH_ARP_SUPPORT = 0x00002000L,
  191. IPA_FULL_VLAN = 0x00004000L,
  192. IPA_INBOUND_PASSTHRU = 0x00008000L,
  193. IPA_SOURCE_MAC = 0x00010000L,
  194. IPA_OSA_MC_ROUTER = 0x00020000L,
  195. IPA_QUERY_ARP_ASSIST = 0x00040000L,
  196. IPA_INBOUND_TSO = 0x00080000L,
  197. IPA_OUTBOUND_TSO = 0x00100000L,
  198. };
  199. /* SETIP/DELIP IPA Command: ***************************************************/
  200. enum qeth_ipa_setdelip_flags {
  201. QETH_IPA_SETDELIP_DEFAULT = 0x00L, /* default */
  202. QETH_IPA_SETIP_VIPA_FLAG = 0x01L, /* no grat. ARP */
  203. QETH_IPA_SETIP_TAKEOVER_FLAG = 0x02L, /* nofail on grat. ARP */
  204. QETH_IPA_DELIP_ADDR_2_B_TAKEN_OVER = 0x20L,
  205. QETH_IPA_DELIP_VIPA_FLAG = 0x40L,
  206. QETH_IPA_DELIP_ADDR_NEEDS_SETIP = 0x80L,
  207. };
  208. /* SETADAPTER IPA Command: ****************************************************/
  209. enum qeth_ipa_setadp_cmd {
  210. IPA_SETADP_QUERY_COMMANDS_SUPPORTED = 0x00000001L,
  211. IPA_SETADP_ALTER_MAC_ADDRESS = 0x00000002L,
  212. IPA_SETADP_ADD_DELETE_GROUP_ADDRESS = 0x00000004L,
  213. IPA_SETADP_ADD_DELETE_FUNCTIONAL_ADDR = 0x00000008L,
  214. IPA_SETADP_SET_ADDRESSING_MODE = 0x00000010L,
  215. IPA_SETADP_SET_CONFIG_PARMS = 0x00000020L,
  216. IPA_SETADP_SET_CONFIG_PARMS_EXTENDED = 0x00000040L,
  217. IPA_SETADP_SET_BROADCAST_MODE = 0x00000080L,
  218. IPA_SETADP_SEND_OSA_MESSAGE = 0x00000100L,
  219. IPA_SETADP_SET_SNMP_CONTROL = 0x00000200L,
  220. IPA_SETADP_QUERY_CARD_INFO = 0x00000400L,
  221. IPA_SETADP_SET_PROMISC_MODE = 0x00000800L,
  222. IPA_SETADP_SET_DIAG_ASSIST = 0x00002000L,
  223. IPA_SETADP_SET_ACCESS_CONTROL = 0x00010000L,
  224. IPA_SETADP_QUERY_OAT = 0x00080000L,
  225. IPA_SETADP_QUERY_SWITCH_ATTRIBUTES = 0x00100000L,
  226. };
  227. enum qeth_ipa_mac_ops {
  228. CHANGE_ADDR_READ_MAC = 0,
  229. CHANGE_ADDR_REPLACE_MAC = 1,
  230. CHANGE_ADDR_ADD_MAC = 2,
  231. CHANGE_ADDR_DEL_MAC = 4,
  232. CHANGE_ADDR_RESET_MAC = 8,
  233. };
  234. enum qeth_ipa_addr_ops {
  235. CHANGE_ADDR_READ_ADDR = 0,
  236. CHANGE_ADDR_ADD_ADDR = 1,
  237. CHANGE_ADDR_DEL_ADDR = 2,
  238. CHANGE_ADDR_FLUSH_ADDR_TABLE = 4,
  239. };
  240. enum qeth_ipa_promisc_modes {
  241. SET_PROMISC_MODE_OFF = 0,
  242. SET_PROMISC_MODE_ON = 1,
  243. };
  244. enum qeth_ipa_isolation_modes {
  245. ISOLATION_MODE_NONE = 0x00000000L,
  246. ISOLATION_MODE_FWD = 0x00000001L,
  247. ISOLATION_MODE_DROP = 0x00000002L,
  248. };
  249. enum qeth_ipa_set_access_mode_rc {
  250. SET_ACCESS_CTRL_RC_SUCCESS = 0x0000,
  251. SET_ACCESS_CTRL_RC_NOT_SUPPORTED = 0x0004,
  252. SET_ACCESS_CTRL_RC_ALREADY_NOT_ISOLATED = 0x0008,
  253. SET_ACCESS_CTRL_RC_ALREADY_ISOLATED = 0x0010,
  254. SET_ACCESS_CTRL_RC_NONE_SHARED_ADAPTER = 0x0014,
  255. SET_ACCESS_CTRL_RC_ACTIVE_CHECKSUM_OFF = 0x0018,
  256. SET_ACCESS_CTRL_RC_REFLREL_UNSUPPORTED = 0x0022,
  257. SET_ACCESS_CTRL_RC_REFLREL_FAILED = 0x0024,
  258. SET_ACCESS_CTRL_RC_REFLREL_DEACT_FAILED = 0x0028,
  259. };
  260. enum qeth_card_info_card_type {
  261. CARD_INFO_TYPE_1G_COPPER_A = 0x61,
  262. CARD_INFO_TYPE_1G_FIBRE_A = 0x71,
  263. CARD_INFO_TYPE_10G_FIBRE_A = 0x91,
  264. CARD_INFO_TYPE_1G_COPPER_B = 0xb1,
  265. CARD_INFO_TYPE_1G_FIBRE_B = 0xa1,
  266. CARD_INFO_TYPE_10G_FIBRE_B = 0xc1,
  267. };
  268. enum qeth_card_info_port_mode {
  269. CARD_INFO_PORTM_HALFDUPLEX = 0x0002,
  270. CARD_INFO_PORTM_FULLDUPLEX = 0x0003,
  271. };
  272. enum qeth_card_info_port_speed {
  273. CARD_INFO_PORTS_10M = 0x00000005,
  274. CARD_INFO_PORTS_100M = 0x00000006,
  275. CARD_INFO_PORTS_1G = 0x00000007,
  276. CARD_INFO_PORTS_10G = 0x00000008,
  277. };
  278. /* (SET)DELIP(M) IPA stuff ***************************************************/
  279. struct qeth_ipacmd_setdelip4 {
  280. __u8 ip_addr[4];
  281. __u8 mask[4];
  282. __u32 flags;
  283. } __attribute__ ((packed));
  284. struct qeth_ipacmd_setdelip6 {
  285. __u8 ip_addr[16];
  286. __u8 mask[16];
  287. __u32 flags;
  288. } __attribute__ ((packed));
  289. struct qeth_ipacmd_setdelipm {
  290. __u8 mac[6];
  291. __u8 padding[2];
  292. __u8 ip6[12];
  293. __u8 ip4[4];
  294. } __attribute__ ((packed));
  295. struct qeth_ipacmd_layer2setdelmac {
  296. __u32 mac_length;
  297. __u8 mac[6];
  298. } __attribute__ ((packed));
  299. struct qeth_ipacmd_layer2setdelvlan {
  300. __u16 vlan_id;
  301. } __attribute__ ((packed));
  302. struct qeth_ipacmd_setassparms_hdr {
  303. __u32 assist_no;
  304. __u16 length;
  305. __u16 command_code;
  306. __u16 return_code;
  307. __u8 number_of_replies;
  308. __u8 seq_no;
  309. } __attribute__((packed));
  310. struct qeth_arp_query_data {
  311. __u16 request_bits;
  312. __u16 reply_bits;
  313. __u32 no_entries;
  314. char data; /* only for replies */
  315. } __attribute__((packed));
  316. /* used as parameter for arp_query reply */
  317. struct qeth_arp_query_info {
  318. __u32 udata_len;
  319. __u16 mask_bits;
  320. __u32 udata_offset;
  321. __u32 no_entries;
  322. char *udata;
  323. };
  324. /* SETASSPARMS IPA Command: */
  325. struct qeth_ipacmd_setassparms {
  326. struct qeth_ipacmd_setassparms_hdr hdr;
  327. union {
  328. __u32 flags_32bit;
  329. struct qeth_arp_cache_entry add_arp_entry;
  330. struct qeth_arp_query_data query_arp;
  331. __u8 ip[16];
  332. } data;
  333. } __attribute__ ((packed));
  334. /* SETRTG IPA Command: ****************************************************/
  335. struct qeth_set_routing {
  336. __u8 type;
  337. };
  338. /* SETADAPTERPARMS IPA Command: *******************************************/
  339. struct qeth_query_cmds_supp {
  340. __u32 no_lantypes_supp;
  341. __u8 lan_type;
  342. __u8 reserved1[3];
  343. __u32 supported_cmds;
  344. __u8 reserved2[8];
  345. } __attribute__ ((packed));
  346. struct qeth_change_addr {
  347. __u32 cmd;
  348. __u32 addr_size;
  349. __u32 no_macs;
  350. __u8 addr[OSA_ADDR_LEN];
  351. } __attribute__ ((packed));
  352. struct qeth_snmp_cmd {
  353. __u8 token[16];
  354. __u32 request;
  355. __u32 interface;
  356. __u32 returncode;
  357. __u32 firmwarelevel;
  358. __u32 seqno;
  359. __u8 data;
  360. } __attribute__ ((packed));
  361. struct qeth_snmp_ureq_hdr {
  362. __u32 data_len;
  363. __u32 req_len;
  364. __u32 reserved1;
  365. __u32 reserved2;
  366. } __attribute__ ((packed));
  367. struct qeth_snmp_ureq {
  368. struct qeth_snmp_ureq_hdr hdr;
  369. struct qeth_snmp_cmd cmd;
  370. } __attribute__((packed));
  371. /* SET_ACCESS_CONTROL: same format for request and reply */
  372. struct qeth_set_access_ctrl {
  373. __u32 subcmd_code;
  374. __u8 reserved[8];
  375. } __attribute__((packed));
  376. struct qeth_query_oat {
  377. __u32 subcmd_code;
  378. __u8 reserved[12];
  379. } __packed;
  380. struct qeth_qoat_priv {
  381. __u32 buffer_len;
  382. __u32 response_len;
  383. char *buffer;
  384. };
  385. struct qeth_query_card_info {
  386. __u8 card_type;
  387. __u8 reserved1;
  388. __u16 port_mode;
  389. __u32 port_speed;
  390. __u32 reserved2;
  391. };
  392. #define QETH_SWITCH_FORW_802_1 0x00000001
  393. #define QETH_SWITCH_FORW_REFL_RELAY 0x00000002
  394. #define QETH_SWITCH_CAP_RTE 0x00000004
  395. #define QETH_SWITCH_CAP_ECP 0x00000008
  396. #define QETH_SWITCH_CAP_VDP 0x00000010
  397. struct qeth_query_switch_attributes {
  398. __u8 version;
  399. __u8 reserved1;
  400. __u16 reserved2;
  401. __u32 capabilities;
  402. __u32 settings;
  403. __u8 reserved3[8];
  404. };
  405. struct qeth_ipacmd_setadpparms_hdr {
  406. __u32 supp_hw_cmds;
  407. __u32 reserved1;
  408. __u16 cmdlength;
  409. __u16 reserved2;
  410. __u32 command_code;
  411. __u16 return_code;
  412. __u8 used_total;
  413. __u8 seq_no;
  414. __u32 reserved3;
  415. } __attribute__ ((packed));
  416. struct qeth_ipacmd_setadpparms {
  417. struct qeth_ipacmd_setadpparms_hdr hdr;
  418. union {
  419. struct qeth_query_cmds_supp query_cmds_supp;
  420. struct qeth_change_addr change_addr;
  421. struct qeth_snmp_cmd snmp;
  422. struct qeth_set_access_ctrl set_access_ctrl;
  423. struct qeth_query_oat query_oat;
  424. struct qeth_query_card_info card_info;
  425. struct qeth_query_switch_attributes query_switch_attributes;
  426. __u32 mode;
  427. } data;
  428. } __attribute__ ((packed));
  429. /* CREATE_ADDR IPA Command: ***********************************************/
  430. struct qeth_create_destroy_address {
  431. __u8 unique_id[8];
  432. } __attribute__ ((packed));
  433. /* SET DIAGNOSTIC ASSIST IPA Command: *************************************/
  434. enum qeth_diags_cmds {
  435. QETH_DIAGS_CMD_QUERY = 0x0001,
  436. QETH_DIAGS_CMD_TRAP = 0x0002,
  437. QETH_DIAGS_CMD_TRACE = 0x0004,
  438. QETH_DIAGS_CMD_NOLOG = 0x0008,
  439. QETH_DIAGS_CMD_DUMP = 0x0010,
  440. };
  441. enum qeth_diags_trace_types {
  442. QETH_DIAGS_TYPE_HIPERSOCKET = 0x02,
  443. };
  444. enum qeth_diags_trace_cmds {
  445. QETH_DIAGS_CMD_TRACE_ENABLE = 0x0001,
  446. QETH_DIAGS_CMD_TRACE_DISABLE = 0x0002,
  447. QETH_DIAGS_CMD_TRACE_MODIFY = 0x0004,
  448. QETH_DIAGS_CMD_TRACE_REPLACE = 0x0008,
  449. QETH_DIAGS_CMD_TRACE_QUERY = 0x0010,
  450. };
  451. enum qeth_diags_trap_action {
  452. QETH_DIAGS_TRAP_ARM = 0x01,
  453. QETH_DIAGS_TRAP_DISARM = 0x02,
  454. QETH_DIAGS_TRAP_CAPTURE = 0x04,
  455. };
  456. struct qeth_ipacmd_diagass {
  457. __u32 host_tod2;
  458. __u32:32;
  459. __u16 subcmd_len;
  460. __u16:16;
  461. __u32 subcmd;
  462. __u8 type;
  463. __u8 action;
  464. __u16 options;
  465. __u32 ext;
  466. __u8 cdata[64];
  467. } __attribute__ ((packed));
  468. /* SETBRIDGEPORT IPA Command: *********************************************/
  469. enum qeth_ipa_sbp_cmd {
  470. IPA_SBP_QUERY_COMMANDS_SUPPORTED = 0x00000000L,
  471. IPA_SBP_RESET_BRIDGE_PORT_ROLE = 0x00000001L,
  472. IPA_SBP_SET_PRIMARY_BRIDGE_PORT = 0x00000002L,
  473. IPA_SBP_SET_SECONDARY_BRIDGE_PORT = 0x00000004L,
  474. IPA_SBP_QUERY_BRIDGE_PORTS = 0x00000008L,
  475. IPA_SBP_BRIDGE_PORT_STATE_CHANGE = 0x00000010L,
  476. };
  477. struct net_if_token {
  478. __u16 devnum;
  479. __u8 cssid;
  480. __u8 iid;
  481. __u8 ssid;
  482. __u8 chpid;
  483. __u16 chid;
  484. } __packed;
  485. struct mac_addr_lnid {
  486. __u8 mac[6];
  487. __u16 lnid;
  488. } __packed;
  489. struct qeth_ipacmd_sbp_hdr {
  490. __u32 supported_sbp_cmds;
  491. __u32 enabled_sbp_cmds;
  492. __u16 cmdlength;
  493. __u16 reserved1;
  494. __u32 command_code;
  495. __u16 return_code;
  496. __u8 used_total;
  497. __u8 seq_no;
  498. __u32 reserved2;
  499. } __packed;
  500. struct qeth_sbp_query_cmds_supp {
  501. __u32 supported_cmds;
  502. __u32 reserved;
  503. } __packed;
  504. struct qeth_sbp_reset_role {
  505. } __packed;
  506. struct qeth_sbp_set_primary {
  507. struct net_if_token token;
  508. } __packed;
  509. struct qeth_sbp_set_secondary {
  510. } __packed;
  511. struct qeth_sbp_port_entry {
  512. __u8 role;
  513. __u8 state;
  514. __u8 reserved1;
  515. __u8 reserved2;
  516. struct net_if_token token;
  517. } __packed;
  518. struct qeth_sbp_query_ports {
  519. __u8 primary_bp_supported;
  520. __u8 secondary_bp_supported;
  521. __u8 num_entries;
  522. __u8 entry_length;
  523. struct qeth_sbp_port_entry entry[];
  524. } __packed;
  525. struct qeth_sbp_state_change {
  526. __u8 primary_bp_supported;
  527. __u8 secondary_bp_supported;
  528. __u8 num_entries;
  529. __u8 entry_length;
  530. struct qeth_sbp_port_entry entry[];
  531. } __packed;
  532. struct qeth_ipacmd_setbridgeport {
  533. struct qeth_ipacmd_sbp_hdr hdr;
  534. union {
  535. struct qeth_sbp_query_cmds_supp query_cmds_supp;
  536. struct qeth_sbp_reset_role reset_role;
  537. struct qeth_sbp_set_primary set_primary;
  538. struct qeth_sbp_set_secondary set_secondary;
  539. struct qeth_sbp_query_ports query_ports;
  540. struct qeth_sbp_state_change state_change;
  541. } data;
  542. } __packed;
  543. /* ADDRESS_CHANGE_NOTIFICATION adapter-initiated "command" *******************/
  544. /* Bitmask for entry->change_code. Both bits may be raised. */
  545. enum qeth_ipa_addr_change_code {
  546. IPA_ADDR_CHANGE_CODE_VLANID = 0x01,
  547. IPA_ADDR_CHANGE_CODE_MACADDR = 0x02,
  548. IPA_ADDR_CHANGE_CODE_REMOVAL = 0x80, /* else addition */
  549. };
  550. enum qeth_ipa_addr_change_retcode {
  551. IPA_ADDR_CHANGE_RETCODE_OK = 0x0000,
  552. IPA_ADDR_CHANGE_RETCODE_LOSTEVENTS = 0x0010,
  553. };
  554. enum qeth_ipa_addr_change_lostmask {
  555. IPA_ADDR_CHANGE_MASK_OVERFLOW = 0x01,
  556. IPA_ADDR_CHANGE_MASK_STATECHANGE = 0x02,
  557. };
  558. struct qeth_ipacmd_addr_change_entry {
  559. struct net_if_token token;
  560. struct mac_addr_lnid addr_lnid;
  561. __u8 change_code;
  562. __u8 reserved1;
  563. __u16 reserved2;
  564. } __packed;
  565. struct qeth_ipacmd_addr_change {
  566. __u8 lost_event_mask;
  567. __u8 reserved;
  568. __u16 num_entries;
  569. struct qeth_ipacmd_addr_change_entry entry[];
  570. } __packed;
  571. /* Header for each IPA command */
  572. struct qeth_ipacmd_hdr {
  573. __u8 command;
  574. __u8 initiator;
  575. __u16 seqno;
  576. __u16 return_code;
  577. __u8 adapter_type;
  578. __u8 rel_adapter_no;
  579. __u8 prim_version_no;
  580. __u8 param_count;
  581. __u16 prot_version;
  582. __u32 ipa_supported;
  583. __u32 ipa_enabled;
  584. } __attribute__ ((packed));
  585. /* The IPA command itself */
  586. struct qeth_ipa_cmd {
  587. struct qeth_ipacmd_hdr hdr;
  588. union {
  589. struct qeth_ipacmd_setdelip4 setdelip4;
  590. struct qeth_ipacmd_setdelip6 setdelip6;
  591. struct qeth_ipacmd_setdelipm setdelipm;
  592. struct qeth_ipacmd_setassparms setassparms;
  593. struct qeth_ipacmd_layer2setdelmac setdelmac;
  594. struct qeth_ipacmd_layer2setdelvlan setdelvlan;
  595. struct qeth_create_destroy_address create_destroy_addr;
  596. struct qeth_ipacmd_setadpparms setadapterparms;
  597. struct qeth_set_routing setrtg;
  598. struct qeth_ipacmd_diagass diagass;
  599. struct qeth_ipacmd_setbridgeport sbp;
  600. struct qeth_ipacmd_addr_change addrchange;
  601. } data;
  602. } __attribute__ ((packed));
  603. /*
  604. * special command for ARP processing.
  605. * this is not included in setassparms command before, because we get
  606. * problem with the size of struct qeth_ipacmd_setassparms otherwise
  607. */
  608. enum qeth_ipa_arp_return_codes {
  609. QETH_IPA_ARP_RC_SUCCESS = 0x0000,
  610. QETH_IPA_ARP_RC_FAILED = 0x0001,
  611. QETH_IPA_ARP_RC_NOTSUPP = 0x0002,
  612. QETH_IPA_ARP_RC_OUT_OF_RANGE = 0x0003,
  613. QETH_IPA_ARP_RC_Q_NOTSUPP = 0x0004,
  614. QETH_IPA_ARP_RC_Q_NO_DATA = 0x0008,
  615. };
  616. extern char *qeth_get_ipa_msg(enum qeth_ipa_return_codes rc);
  617. extern char *qeth_get_ipa_cmd_name(enum qeth_ipa_cmds cmd);
  618. #define QETH_SETASS_BASE_LEN (sizeof(struct qeth_ipacmd_hdr) + \
  619. sizeof(struct qeth_ipacmd_setassparms_hdr))
  620. #define QETH_IPA_ARP_DATA_POS(buffer) (buffer + IPA_PDU_HEADER_SIZE + \
  621. QETH_SETASS_BASE_LEN)
  622. #define QETH_SETADP_BASE_LEN (sizeof(struct qeth_ipacmd_hdr) + \
  623. sizeof(struct qeth_ipacmd_setadpparms_hdr))
  624. #define QETH_SNMP_SETADP_CMDLENGTH 16
  625. #define QETH_ARP_DATA_SIZE 3968
  626. #define QETH_ARP_CMD_LEN (QETH_ARP_DATA_SIZE + 8)
  627. /* Helper functions */
  628. #define IS_IPA_REPLY(cmd) ((cmd->hdr.initiator == IPA_CMD_INITIATOR_HOST) || \
  629. (cmd->hdr.initiator == IPA_CMD_INITIATOR_OSA_REPLY))
  630. /*****************************************************************************/
  631. /* END OF IP Assist related definitions */
  632. /*****************************************************************************/
  633. extern unsigned char WRITE_CCW[];
  634. extern unsigned char READ_CCW[];
  635. extern unsigned char CM_ENABLE[];
  636. #define CM_ENABLE_SIZE 0x63
  637. #define QETH_CM_ENABLE_ISSUER_RM_TOKEN(buffer) (buffer + 0x2c)
  638. #define QETH_CM_ENABLE_FILTER_TOKEN(buffer) (buffer + 0x53)
  639. #define QETH_CM_ENABLE_USER_DATA(buffer) (buffer + 0x5b)
  640. #define QETH_CM_ENABLE_RESP_FILTER_TOKEN(buffer) \
  641. (PDU_ENCAPSULATION(buffer) + 0x13)
  642. extern unsigned char CM_SETUP[];
  643. #define CM_SETUP_SIZE 0x64
  644. #define QETH_CM_SETUP_DEST_ADDR(buffer) (buffer + 0x2c)
  645. #define QETH_CM_SETUP_CONNECTION_TOKEN(buffer) (buffer + 0x51)
  646. #define QETH_CM_SETUP_FILTER_TOKEN(buffer) (buffer + 0x5a)
  647. #define QETH_CM_SETUP_RESP_DEST_ADDR(buffer) \
  648. (PDU_ENCAPSULATION(buffer) + 0x1a)
  649. extern unsigned char ULP_ENABLE[];
  650. #define ULP_ENABLE_SIZE 0x6b
  651. #define QETH_ULP_ENABLE_LINKNUM(buffer) (buffer + 0x61)
  652. #define QETH_ULP_ENABLE_DEST_ADDR(buffer) (buffer + 0x2c)
  653. #define QETH_ULP_ENABLE_FILTER_TOKEN(buffer) (buffer + 0x53)
  654. #define QETH_ULP_ENABLE_PORTNAME_AND_LL(buffer) (buffer + 0x62)
  655. #define QETH_ULP_ENABLE_RESP_FILTER_TOKEN(buffer) \
  656. (PDU_ENCAPSULATION(buffer) + 0x13)
  657. #define QETH_ULP_ENABLE_RESP_MAX_MTU(buffer) \
  658. (PDU_ENCAPSULATION(buffer) + 0x1f)
  659. #define QETH_ULP_ENABLE_RESP_DIFINFO_LEN(buffer) \
  660. (PDU_ENCAPSULATION(buffer) + 0x17)
  661. #define QETH_ULP_ENABLE_RESP_LINK_TYPE(buffer) \
  662. (PDU_ENCAPSULATION(buffer) + 0x2b)
  663. /* Layer 2 definitions */
  664. #define QETH_PROT_LAYER2 0x08
  665. #define QETH_PROT_TCPIP 0x03
  666. #define QETH_PROT_OSN2 0x0a
  667. #define QETH_ULP_ENABLE_PROT_TYPE(buffer) (buffer + 0x50)
  668. #define QETH_IPA_CMD_PROT_TYPE(buffer) (buffer + 0x19)
  669. extern unsigned char ULP_SETUP[];
  670. #define ULP_SETUP_SIZE 0x6c
  671. #define QETH_ULP_SETUP_DEST_ADDR(buffer) (buffer + 0x2c)
  672. #define QETH_ULP_SETUP_CONNECTION_TOKEN(buffer) (buffer + 0x51)
  673. #define QETH_ULP_SETUP_FILTER_TOKEN(buffer) (buffer + 0x5a)
  674. #define QETH_ULP_SETUP_CUA(buffer) (buffer + 0x68)
  675. #define QETH_ULP_SETUP_REAL_DEVADDR(buffer) (buffer + 0x6a)
  676. #define QETH_ULP_SETUP_RESP_CONNECTION_TOKEN(buffer) \
  677. (PDU_ENCAPSULATION(buffer) + 0x1a)
  678. extern unsigned char DM_ACT[];
  679. #define DM_ACT_SIZE 0x55
  680. #define QETH_DM_ACT_DEST_ADDR(buffer) (buffer + 0x2c)
  681. #define QETH_DM_ACT_CONNECTION_TOKEN(buffer) (buffer + 0x51)
  682. #define QETH_TRANSPORT_HEADER_SEQ_NO(buffer) (buffer + 4)
  683. #define QETH_PDU_HEADER_SEQ_NO(buffer) (buffer + 0x1c)
  684. #define QETH_PDU_HEADER_ACK_SEQ_NO(buffer) (buffer + 0x20)
  685. extern unsigned char IDX_ACTIVATE_READ[];
  686. extern unsigned char IDX_ACTIVATE_WRITE[];
  687. #define IDX_ACTIVATE_SIZE 0x22
  688. #define QETH_IDX_ACT_PNO(buffer) (buffer+0x0b)
  689. #define QETH_IDX_ACT_ISSUER_RM_TOKEN(buffer) (buffer + 0x0c)
  690. #define QETH_IDX_NO_PORTNAME_REQUIRED(buffer) ((buffer)[0x0b] & 0x80)
  691. #define QETH_IDX_ACT_FUNC_LEVEL(buffer) (buffer + 0x10)
  692. #define QETH_IDX_ACT_DATASET_NAME(buffer) (buffer + 0x16)
  693. #define QETH_IDX_ACT_QDIO_DEV_CUA(buffer) (buffer + 0x1e)
  694. #define QETH_IDX_ACT_QDIO_DEV_REALADDR(buffer) (buffer + 0x20)
  695. #define QETH_IS_IDX_ACT_POS_REPLY(buffer) (((buffer)[0x08] & 3) == 2)
  696. #define QETH_IDX_REPLY_LEVEL(buffer) (buffer + 0x12)
  697. #define QETH_IDX_ACT_CAUSE_CODE(buffer) (buffer)[0x09]
  698. #define QETH_IDX_ACT_ERR_EXCL 0x19
  699. #define QETH_IDX_ACT_ERR_AUTH 0x1E
  700. #define QETH_IDX_ACT_ERR_AUTH_USER 0x20
  701. #define PDU_ENCAPSULATION(buffer) \
  702. (buffer + *(buffer + (*(buffer + 0x0b)) + \
  703. *(buffer + *(buffer + 0x0b) + 0x11) + 0x07))
  704. #define IS_IPA(buffer) \
  705. ((buffer) && \
  706. (*(buffer + ((*(buffer + 0x0b)) + 4)) == 0xc1))
  707. #define ADDR_FRAME_TYPE_DIX 1
  708. #define ADDR_FRAME_TYPE_802_3 2
  709. #define ADDR_FRAME_TYPE_TR_WITHOUT_SR 0x10
  710. #define ADDR_FRAME_TYPE_TR_WITH_SR 0x20
  711. #endif