cpl5_cmd.h 12 KB

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