cpl5_cmd.h 12 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590591592593594595596597598599600601602603604605606607608609610611612613614615616617618619620621622623624625626627628629630631632633634635636637638639640
  1. /*****************************************************************************
  2. * *
  3. * File: cpl5_cmd.h *
  4. * $Revision: 1.6 $ *
  5. * $Date: 2005/06/21 18:29:47 $ *
  6. * Description: *
  7. * part of the Chelsio 10Gb Ethernet Driver. *
  8. * *
  9. * This program is free software; you can redistribute it and/or modify *
  10. * it under the terms of the GNU General Public License, version 2, as *
  11. * published by the Free Software Foundation. *
  12. * *
  13. * You should have received a copy of the GNU General Public License along *
  14. * with this program; if not, write to the Free Software Foundation, Inc., *
  15. * 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. *
  16. * *
  17. * THIS SOFTWARE IS PROVIDED ``AS IS'' AND WITHOUT ANY EXPRESS OR IMPLIED *
  18. * WARRANTIES, INCLUDING, WITHOUT LIMITATION, THE IMPLIED WARRANTIES OF *
  19. * MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE. *
  20. * *
  21. * http://www.chelsio.com *
  22. * *
  23. * Copyright (c) 2003 - 2005 Chelsio Communications, Inc. *
  24. * All rights reserved. *
  25. * *
  26. * Maintainers: maintainers@chelsio.com *
  27. * *
  28. * Authors: Dimitrios Michailidis <dm@chelsio.com> *
  29. * Tina Yang <tainay@chelsio.com> *
  30. * Felix Marti <felix@chelsio.com> *
  31. * Scott Bardone <sbardone@chelsio.com> *
  32. * Kurt Ottaway <kottaway@chelsio.com> *
  33. * Frank DiMambro <frank@chelsio.com> *
  34. * *
  35. * History: *
  36. * *
  37. ****************************************************************************/
  38. #ifndef _CXGB_CPL5_CMD_H_
  39. #define _CXGB_CPL5_CMD_H_
  40. #include <asm/byteorder.h>
  41. #if !defined(__LITTLE_ENDIAN_BITFIELD) && !defined(__BIG_ENDIAN_BITFIELD)
  42. #error "Adjust your <asm/byteorder.h> defines"
  43. #endif
  44. enum CPL_opcode {
  45. CPL_PASS_OPEN_REQ = 0x1,
  46. CPL_PASS_OPEN_RPL = 0x2,
  47. CPL_PASS_ESTABLISH = 0x3,
  48. CPL_PASS_ACCEPT_REQ = 0xE,
  49. CPL_PASS_ACCEPT_RPL = 0x4,
  50. CPL_ACT_OPEN_REQ = 0x5,
  51. CPL_ACT_OPEN_RPL = 0x6,
  52. CPL_CLOSE_CON_REQ = 0x7,
  53. CPL_CLOSE_CON_RPL = 0x8,
  54. CPL_CLOSE_LISTSRV_REQ = 0x9,
  55. CPL_CLOSE_LISTSRV_RPL = 0xA,
  56. CPL_ABORT_REQ = 0xB,
  57. CPL_ABORT_RPL = 0xC,
  58. CPL_PEER_CLOSE = 0xD,
  59. CPL_ACT_ESTABLISH = 0x17,
  60. CPL_GET_TCB = 0x24,
  61. CPL_GET_TCB_RPL = 0x25,
  62. CPL_SET_TCB = 0x26,
  63. CPL_SET_TCB_FIELD = 0x27,
  64. CPL_SET_TCB_RPL = 0x28,
  65. CPL_PCMD = 0x29,
  66. CPL_PCMD_READ = 0x31,
  67. CPL_PCMD_READ_RPL = 0x32,
  68. CPL_RX_DATA = 0xA0,
  69. CPL_RX_DATA_DDP = 0xA1,
  70. CPL_RX_DATA_ACK = 0xA3,
  71. CPL_RX_PKT = 0xAD,
  72. CPL_RX_ISCSI_HDR = 0xAF,
  73. CPL_TX_DATA_ACK = 0xB0,
  74. CPL_TX_DATA = 0xB1,
  75. CPL_TX_PKT = 0xB2,
  76. CPL_TX_PKT_LSO = 0xB6,
  77. CPL_RTE_DELETE_REQ = 0xC0,
  78. CPL_RTE_DELETE_RPL = 0xC1,
  79. CPL_RTE_WRITE_REQ = 0xC2,
  80. CPL_RTE_WRITE_RPL = 0xD3,
  81. CPL_RTE_READ_REQ = 0xC3,
  82. CPL_RTE_READ_RPL = 0xC4,
  83. CPL_L2T_WRITE_REQ = 0xC5,
  84. CPL_L2T_WRITE_RPL = 0xD4,
  85. CPL_L2T_READ_REQ = 0xC6,
  86. CPL_L2T_READ_RPL = 0xC7,
  87. CPL_SMT_WRITE_REQ = 0xC8,
  88. CPL_SMT_WRITE_RPL = 0xD5,
  89. CPL_SMT_READ_REQ = 0xC9,
  90. CPL_SMT_READ_RPL = 0xCA,
  91. CPL_ARP_MISS_REQ = 0xCD,
  92. CPL_ARP_MISS_RPL = 0xCE,
  93. CPL_MIGRATE_C2T_REQ = 0xDC,
  94. CPL_MIGRATE_C2T_RPL = 0xDD,
  95. CPL_ERROR = 0xD7,
  96. /* internal: driver -> TOM */
  97. CPL_MSS_CHANGE = 0xE1
  98. };
  99. #define NUM_CPL_CMDS 256
  100. enum CPL_error {
  101. CPL_ERR_NONE = 0,
  102. CPL_ERR_TCAM_PARITY = 1,
  103. CPL_ERR_TCAM_FULL = 3,
  104. CPL_ERR_CONN_RESET = 20,
  105. CPL_ERR_CONN_EXIST = 22,
  106. CPL_ERR_ARP_MISS = 23,
  107. CPL_ERR_BAD_SYN = 24,
  108. CPL_ERR_CONN_TIMEDOUT = 30,
  109. CPL_ERR_XMIT_TIMEDOUT = 31,
  110. CPL_ERR_PERSIST_TIMEDOUT = 32,
  111. CPL_ERR_FINWAIT2_TIMEDOUT = 33,
  112. CPL_ERR_KEEPALIVE_TIMEDOUT = 34,
  113. CPL_ERR_ABORT_FAILED = 42,
  114. CPL_ERR_GENERAL = 99
  115. };
  116. enum {
  117. CPL_CONN_POLICY_AUTO = 0,
  118. CPL_CONN_POLICY_ASK = 1,
  119. CPL_CONN_POLICY_DENY = 3
  120. };
  121. enum {
  122. ULP_MODE_NONE = 0,
  123. ULP_MODE_TCPDDP = 1,
  124. ULP_MODE_ISCSI = 2,
  125. ULP_MODE_IWARP = 3,
  126. ULP_MODE_SSL = 4
  127. };
  128. enum {
  129. CPL_PASS_OPEN_ACCEPT,
  130. CPL_PASS_OPEN_REJECT
  131. };
  132. enum {
  133. CPL_ABORT_SEND_RST = 0,
  134. CPL_ABORT_NO_RST,
  135. CPL_ABORT_POST_CLOSE_REQ = 2
  136. };
  137. enum { // TX_PKT_LSO ethernet types
  138. CPL_ETH_II,
  139. CPL_ETH_II_VLAN,
  140. CPL_ETH_802_3,
  141. CPL_ETH_802_3_VLAN
  142. };
  143. union opcode_tid {
  144. u32 opcode_tid;
  145. u8 opcode;
  146. };
  147. #define S_OPCODE 24
  148. #define V_OPCODE(x) ((x) << S_OPCODE)
  149. #define G_OPCODE(x) (((x) >> S_OPCODE) & 0xFF)
  150. #define G_TID(x) ((x) & 0xFFFFFF)
  151. /* tid is assumed to be 24-bits */
  152. #define MK_OPCODE_TID(opcode, tid) (V_OPCODE(opcode) | (tid))
  153. #define OPCODE_TID(cmd) ((cmd)->ot.opcode_tid)
  154. /* extract the TID from a CPL command */
  155. #define GET_TID(cmd) (G_TID(ntohl(OPCODE_TID(cmd))))
  156. struct tcp_options {
  157. u16 mss;
  158. u8 wsf;
  159. #if defined(__LITTLE_ENDIAN_BITFIELD)
  160. u8 rsvd:4;
  161. u8 ecn:1;
  162. u8 sack:1;
  163. u8 tstamp:1;
  164. #else
  165. u8 tstamp:1;
  166. u8 sack:1;
  167. u8 ecn:1;
  168. u8 rsvd:4;
  169. #endif
  170. };
  171. struct cpl_pass_open_req {
  172. union opcode_tid ot;
  173. u16 local_port;
  174. u16 peer_port;
  175. u32 local_ip;
  176. u32 peer_ip;
  177. u32 opt0h;
  178. u32 opt0l;
  179. u32 peer_netmask;
  180. u32 opt1;
  181. };
  182. struct cpl_pass_open_rpl {
  183. union opcode_tid ot;
  184. u16 local_port;
  185. u16 peer_port;
  186. u32 local_ip;
  187. u32 peer_ip;
  188. u8 resvd[7];
  189. u8 status;
  190. };
  191. struct cpl_pass_establish {
  192. union opcode_tid ot;
  193. u16 local_port;
  194. u16 peer_port;
  195. u32 local_ip;
  196. u32 peer_ip;
  197. u32 tos_tid;
  198. u8 l2t_idx;
  199. u8 rsvd[3];
  200. u32 snd_isn;
  201. u32 rcv_isn;
  202. };
  203. struct cpl_pass_accept_req {
  204. union opcode_tid ot;
  205. u16 local_port;
  206. u16 peer_port;
  207. u32 local_ip;
  208. u32 peer_ip;
  209. u32 tos_tid;
  210. struct tcp_options tcp_options;
  211. u8 dst_mac[6];
  212. u16 vlan_tag;
  213. u8 src_mac[6];
  214. u8 rsvd[2];
  215. u32 rcv_isn;
  216. u32 unknown_tcp_options;
  217. };
  218. struct cpl_pass_accept_rpl {
  219. union opcode_tid ot;
  220. u32 rsvd0;
  221. u32 rsvd1;
  222. u32 peer_ip;
  223. u32 opt0h;
  224. union {
  225. u32 opt0l;
  226. struct {
  227. u8 rsvd[3];
  228. u8 status;
  229. };
  230. };
  231. };
  232. struct cpl_act_open_req {
  233. union opcode_tid ot;
  234. u16 local_port;
  235. u16 peer_port;
  236. u32 local_ip;
  237. u32 peer_ip;
  238. u32 opt0h;
  239. u32 opt0l;
  240. u32 iff_vlantag;
  241. u32 rsvd;
  242. };
  243. struct cpl_act_open_rpl {
  244. union opcode_tid ot;
  245. u16 local_port;
  246. u16 peer_port;
  247. u32 local_ip;
  248. u32 peer_ip;
  249. u32 new_tid;
  250. u8 rsvd[3];
  251. u8 status;
  252. };
  253. struct cpl_act_establish {
  254. union opcode_tid ot;
  255. u16 local_port;
  256. u16 peer_port;
  257. u32 local_ip;
  258. u32 peer_ip;
  259. u32 tos_tid;
  260. u32 rsvd;
  261. u32 snd_isn;
  262. u32 rcv_isn;
  263. };
  264. struct cpl_get_tcb {
  265. union opcode_tid ot;
  266. u32 rsvd;
  267. };
  268. struct cpl_get_tcb_rpl {
  269. union opcode_tid ot;
  270. u16 len;
  271. u8 rsvd;
  272. u8 status;
  273. };
  274. struct cpl_set_tcb {
  275. union opcode_tid ot;
  276. u16 len;
  277. u16 rsvd;
  278. };
  279. struct cpl_set_tcb_field {
  280. union opcode_tid ot;
  281. u8 rsvd[3];
  282. u8 offset;
  283. u32 mask;
  284. u32 val;
  285. };
  286. struct cpl_set_tcb_rpl {
  287. union opcode_tid ot;
  288. u8 rsvd[3];
  289. u8 status;
  290. };
  291. struct cpl_pcmd {
  292. union opcode_tid ot;
  293. u16 dlen_in;
  294. u16 dlen_out;
  295. u32 pcmd_parm[2];
  296. };
  297. struct cpl_pcmd_read {
  298. union opcode_tid ot;
  299. u32 rsvd1;
  300. u16 rsvd2;
  301. u32 addr;
  302. u16 len;
  303. };
  304. struct cpl_pcmd_read_rpl {
  305. union opcode_tid ot;
  306. u16 len;
  307. };
  308. struct cpl_close_con_req {
  309. union opcode_tid ot;
  310. u32 rsvd;
  311. };
  312. struct cpl_close_con_rpl {
  313. union opcode_tid ot;
  314. u8 rsvd[3];
  315. u8 status;
  316. u32 snd_nxt;
  317. u32 rcv_nxt;
  318. };
  319. struct cpl_close_listserv_req {
  320. union opcode_tid ot;
  321. u32 rsvd;
  322. };
  323. struct cpl_close_listserv_rpl {
  324. union opcode_tid ot;
  325. u8 rsvd[3];
  326. u8 status;
  327. };
  328. struct cpl_abort_req {
  329. union opcode_tid ot;
  330. u32 rsvd0;
  331. u8 rsvd1;
  332. u8 cmd;
  333. u8 rsvd2[6];
  334. };
  335. struct cpl_abort_rpl {
  336. union opcode_tid ot;
  337. u32 rsvd0;
  338. u8 rsvd1;
  339. u8 status;
  340. u8 rsvd2[6];
  341. };
  342. struct cpl_peer_close {
  343. union opcode_tid ot;
  344. u32 rsvd;
  345. };
  346. struct cpl_tx_data {
  347. union opcode_tid ot;
  348. u32 len;
  349. u32 rsvd0;
  350. u16 urg;
  351. u16 flags;
  352. };
  353. struct cpl_tx_data_ack {
  354. union opcode_tid ot;
  355. u32 ack_seq;
  356. };
  357. struct cpl_rx_data {
  358. union opcode_tid ot;
  359. u32 len;
  360. u32 seq;
  361. u16 urg;
  362. u8 rsvd;
  363. u8 status;
  364. };
  365. struct cpl_rx_data_ack {
  366. union opcode_tid ot;
  367. u32 credit;
  368. };
  369. struct cpl_rx_data_ddp {
  370. union opcode_tid ot;
  371. u32 len;
  372. u32 seq;
  373. u32 nxt_seq;
  374. u32 ulp_crc;
  375. u16 ddp_status;
  376. u8 rsvd;
  377. u8 status;
  378. };
  379. /*
  380. * We want this header's alignment to be no more stringent than 2-byte aligned.
  381. * All fields are u8 or u16 except for the length. However that field is not
  382. * used so we break it into 2 16-bit parts to easily meet our alignment needs.
  383. */
  384. struct cpl_tx_pkt {
  385. u8 opcode;
  386. #if defined(__LITTLE_ENDIAN_BITFIELD)
  387. u8 iff:4;
  388. u8 ip_csum_dis:1;
  389. u8 l4_csum_dis:1;
  390. u8 vlan_valid:1;
  391. u8 rsvd:1;
  392. #else
  393. u8 rsvd:1;
  394. u8 vlan_valid:1;
  395. u8 l4_csum_dis:1;
  396. u8 ip_csum_dis:1;
  397. u8 iff:4;
  398. #endif
  399. u16 vlan;
  400. u16 len_hi;
  401. u16 len_lo;
  402. };
  403. struct cpl_tx_pkt_lso {
  404. u8 opcode;
  405. #if defined(__LITTLE_ENDIAN_BITFIELD)
  406. u8 iff:4;
  407. u8 ip_csum_dis:1;
  408. u8 l4_csum_dis:1;
  409. u8 vlan_valid:1;
  410. u8 :1;
  411. #else
  412. u8 :1;
  413. u8 vlan_valid:1;
  414. u8 l4_csum_dis:1;
  415. u8 ip_csum_dis:1;
  416. u8 iff:4;
  417. #endif
  418. u16 vlan;
  419. __be32 len;
  420. u8 rsvd[5];
  421. #if defined(__LITTLE_ENDIAN_BITFIELD)
  422. u8 tcp_hdr_words:4;
  423. u8 ip_hdr_words:4;
  424. #else
  425. u8 ip_hdr_words:4;
  426. u8 tcp_hdr_words:4;
  427. #endif
  428. __be16 eth_type_mss;
  429. };
  430. struct cpl_rx_pkt {
  431. u8 opcode;
  432. #if defined(__LITTLE_ENDIAN_BITFIELD)
  433. u8 iff:4;
  434. u8 csum_valid:1;
  435. u8 bad_pkt:1;
  436. u8 vlan_valid:1;
  437. u8 rsvd:1;
  438. #else
  439. u8 rsvd:1;
  440. u8 vlan_valid:1;
  441. u8 bad_pkt:1;
  442. u8 csum_valid:1;
  443. u8 iff:4;
  444. #endif
  445. u16 csum;
  446. u16 vlan;
  447. u16 len;
  448. };
  449. struct cpl_l2t_write_req {
  450. union opcode_tid ot;
  451. u32 params;
  452. u8 rsvd1[2];
  453. u8 dst_mac[6];
  454. };
  455. struct cpl_l2t_write_rpl {
  456. union opcode_tid ot;
  457. u8 status;
  458. u8 rsvd[3];
  459. };
  460. struct cpl_l2t_read_req {
  461. union opcode_tid ot;
  462. u8 rsvd[3];
  463. u8 l2t_idx;
  464. };
  465. struct cpl_l2t_read_rpl {
  466. union opcode_tid ot;
  467. u32 params;
  468. u8 rsvd1[2];
  469. u8 dst_mac[6];
  470. };
  471. struct cpl_smt_write_req {
  472. union opcode_tid ot;
  473. u8 rsvd0;
  474. #if defined(__LITTLE_ENDIAN_BITFIELD)
  475. u8 rsvd1:1;
  476. u8 mtu_idx:3;
  477. u8 iff:4;
  478. #else
  479. u8 iff:4;
  480. u8 mtu_idx:3;
  481. u8 rsvd1:1;
  482. #endif
  483. u16 rsvd2;
  484. u16 rsvd3;
  485. u8 src_mac1[6];
  486. u16 rsvd4;
  487. u8 src_mac0[6];
  488. };
  489. struct cpl_smt_write_rpl {
  490. union opcode_tid ot;
  491. u8 status;
  492. u8 rsvd[3];
  493. };
  494. struct cpl_smt_read_req {
  495. union opcode_tid ot;
  496. u8 rsvd0;
  497. #if defined(__LITTLE_ENDIAN_BITFIELD)
  498. u8 rsvd1:4;
  499. u8 iff:4;
  500. #else
  501. u8 iff:4;
  502. u8 rsvd1:4;
  503. #endif
  504. u16 rsvd2;
  505. };
  506. struct cpl_smt_read_rpl {
  507. union opcode_tid ot;
  508. u8 status;
  509. #if defined(__LITTLE_ENDIAN_BITFIELD)
  510. u8 rsvd1:1;
  511. u8 mtu_idx:3;
  512. u8 rsvd0:4;
  513. #else
  514. u8 rsvd0:4;
  515. u8 mtu_idx:3;
  516. u8 rsvd1:1;
  517. #endif
  518. u16 rsvd2;
  519. u16 rsvd3;
  520. u8 src_mac1[6];
  521. u16 rsvd4;
  522. u8 src_mac0[6];
  523. };
  524. struct cpl_rte_delete_req {
  525. union opcode_tid ot;
  526. u32 params;
  527. };
  528. struct cpl_rte_delete_rpl {
  529. union opcode_tid ot;
  530. u8 status;
  531. u8 rsvd[3];
  532. };
  533. struct cpl_rte_write_req {
  534. union opcode_tid ot;
  535. u32 params;
  536. u32 netmask;
  537. u32 faddr;
  538. };
  539. struct cpl_rte_write_rpl {
  540. union opcode_tid ot;
  541. u8 status;
  542. u8 rsvd[3];
  543. };
  544. struct cpl_rte_read_req {
  545. union opcode_tid ot;
  546. u32 params;
  547. };
  548. struct cpl_rte_read_rpl {
  549. union opcode_tid ot;
  550. u8 status;
  551. u8 rsvd0[2];
  552. u8 l2t_idx;
  553. #if defined(__LITTLE_ENDIAN_BITFIELD)
  554. u8 rsvd1:7;
  555. u8 select:1;
  556. #else
  557. u8 select:1;
  558. u8 rsvd1:7;
  559. #endif
  560. u8 rsvd2[3];
  561. u32 addr;
  562. };
  563. struct cpl_mss_change {
  564. union opcode_tid ot;
  565. u32 mss;
  566. };
  567. #endif /* _CXGB_CPL5_CMD_H_ */