t4_msg.h 16 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590591592593594595596597598599600601602603604605606607608609610611612613614615616617618619620621622623624625626627628629630631632633634635636637638639640641642643644645646647648649650651652653654655656657658659660661662663664665666667668669670671672673674675676677678679680681682683684685686687688689690691692693694695696697698699700701702703704705706707708709710711712713714715716717718719720721722723724725726727728729730731732733734735736737738739740741742743744745746747748749750751752753754755756757758759760761762763764765766767768769770771772773774775776777778779780781782783784785786787788789790
  1. /*
  2. * This file is part of the Chelsio T4 Ethernet driver for Linux.
  3. *
  4. * Copyright (c) 2003-2010 Chelsio Communications, Inc. All rights reserved.
  5. *
  6. * This software is available to you under a choice of one of two
  7. * licenses. You may choose to be licensed under the terms of the GNU
  8. * General Public License (GPL) Version 2, available from the file
  9. * COPYING in the main directory of this source tree, or the
  10. * OpenIB.org BSD license below:
  11. *
  12. * Redistribution and use in source and binary forms, with or
  13. * without modification, are permitted provided that the following
  14. * conditions are met:
  15. *
  16. * - Redistributions of source code must retain the above
  17. * copyright notice, this list of conditions and the following
  18. * disclaimer.
  19. *
  20. * - Redistributions in binary form must reproduce the above
  21. * copyright notice, this list of conditions and the following
  22. * disclaimer in the documentation and/or other materials
  23. * provided with the distribution.
  24. *
  25. * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
  26. * EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
  27. * MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
  28. * NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS
  29. * BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN
  30. * ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN
  31. * CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
  32. * SOFTWARE.
  33. */
  34. #ifndef __T4_MSG_H
  35. #define __T4_MSG_H
  36. #include <linux/types.h>
  37. enum {
  38. CPL_PASS_OPEN_REQ = 0x1,
  39. CPL_PASS_ACCEPT_RPL = 0x2,
  40. CPL_ACT_OPEN_REQ = 0x3,
  41. CPL_SET_TCB_FIELD = 0x5,
  42. CPL_GET_TCB = 0x6,
  43. CPL_CLOSE_CON_REQ = 0x8,
  44. CPL_CLOSE_LISTSRV_REQ = 0x9,
  45. CPL_ABORT_REQ = 0xA,
  46. CPL_ABORT_RPL = 0xB,
  47. CPL_RX_DATA_ACK = 0xD,
  48. CPL_TX_PKT = 0xE,
  49. CPL_L2T_WRITE_REQ = 0x12,
  50. CPL_TID_RELEASE = 0x1A,
  51. CPL_CLOSE_LISTSRV_RPL = 0x20,
  52. CPL_L2T_WRITE_RPL = 0x23,
  53. CPL_PASS_OPEN_RPL = 0x24,
  54. CPL_ACT_OPEN_RPL = 0x25,
  55. CPL_PEER_CLOSE = 0x26,
  56. CPL_ABORT_REQ_RSS = 0x2B,
  57. CPL_ABORT_RPL_RSS = 0x2D,
  58. CPL_CLOSE_CON_RPL = 0x32,
  59. CPL_ISCSI_HDR = 0x33,
  60. CPL_RDMA_CQE = 0x35,
  61. CPL_RDMA_CQE_READ_RSP = 0x36,
  62. CPL_RDMA_CQE_ERR = 0x37,
  63. CPL_RX_DATA = 0x39,
  64. CPL_SET_TCB_RPL = 0x3A,
  65. CPL_RX_PKT = 0x3B,
  66. CPL_RX_DDP_COMPLETE = 0x3F,
  67. CPL_ACT_ESTABLISH = 0x40,
  68. CPL_PASS_ESTABLISH = 0x41,
  69. CPL_RX_DATA_DDP = 0x42,
  70. CPL_PASS_ACCEPT_REQ = 0x44,
  71. CPL_TRACE_PKT_T5 = 0x48,
  72. CPL_RDMA_READ_REQ = 0x60,
  73. CPL_PASS_OPEN_REQ6 = 0x81,
  74. CPL_ACT_OPEN_REQ6 = 0x83,
  75. CPL_RDMA_TERMINATE = 0xA2,
  76. CPL_RDMA_WRITE = 0xA4,
  77. CPL_SGE_EGR_UPDATE = 0xA5,
  78. CPL_TRACE_PKT = 0xB0,
  79. CPL_FW4_MSG = 0xC0,
  80. CPL_FW4_PLD = 0xC1,
  81. CPL_FW4_ACK = 0xC3,
  82. CPL_FW6_MSG = 0xE0,
  83. CPL_FW6_PLD = 0xE1,
  84. CPL_TX_PKT_LSO = 0xED,
  85. CPL_TX_PKT_XT = 0xEE,
  86. NUM_CPL_CMDS
  87. };
  88. enum CPL_error {
  89. CPL_ERR_NONE = 0,
  90. CPL_ERR_TCAM_FULL = 3,
  91. CPL_ERR_BAD_LENGTH = 15,
  92. CPL_ERR_BAD_ROUTE = 18,
  93. CPL_ERR_CONN_RESET = 20,
  94. CPL_ERR_CONN_EXIST_SYNRECV = 21,
  95. CPL_ERR_CONN_EXIST = 22,
  96. CPL_ERR_ARP_MISS = 23,
  97. CPL_ERR_BAD_SYN = 24,
  98. CPL_ERR_CONN_TIMEDOUT = 30,
  99. CPL_ERR_XMIT_TIMEDOUT = 31,
  100. CPL_ERR_PERSIST_TIMEDOUT = 32,
  101. CPL_ERR_FINWAIT2_TIMEDOUT = 33,
  102. CPL_ERR_KEEPALIVE_TIMEDOUT = 34,
  103. CPL_ERR_RTX_NEG_ADVICE = 35,
  104. CPL_ERR_PERSIST_NEG_ADVICE = 36,
  105. CPL_ERR_ABORT_FAILED = 42,
  106. CPL_ERR_IWARP_FLM = 50,
  107. };
  108. enum {
  109. ULP_MODE_NONE = 0,
  110. ULP_MODE_ISCSI = 2,
  111. ULP_MODE_RDMA = 4,
  112. ULP_MODE_TCPDDP = 5,
  113. ULP_MODE_FCOE = 6,
  114. };
  115. enum {
  116. ULP_CRC_HEADER = 1 << 0,
  117. ULP_CRC_DATA = 1 << 1
  118. };
  119. enum {
  120. CPL_ABORT_SEND_RST = 0,
  121. CPL_ABORT_NO_RST,
  122. };
  123. enum { /* TX_PKT_XT checksum types */
  124. TX_CSUM_TCP = 0,
  125. TX_CSUM_UDP = 1,
  126. TX_CSUM_CRC16 = 4,
  127. TX_CSUM_CRC32 = 5,
  128. TX_CSUM_CRC32C = 6,
  129. TX_CSUM_FCOE = 7,
  130. TX_CSUM_TCPIP = 8,
  131. TX_CSUM_UDPIP = 9,
  132. TX_CSUM_TCPIP6 = 10,
  133. TX_CSUM_UDPIP6 = 11,
  134. TX_CSUM_IP = 12,
  135. };
  136. union opcode_tid {
  137. __be32 opcode_tid;
  138. u8 opcode;
  139. };
  140. #define CPL_OPCODE(x) ((x) << 24)
  141. #define MK_OPCODE_TID(opcode, tid) (CPL_OPCODE(opcode) | (tid))
  142. #define OPCODE_TID(cmd) ((cmd)->ot.opcode_tid)
  143. #define GET_TID(cmd) (ntohl(OPCODE_TID(cmd)) & 0xFFFFFF)
  144. /* partitioning of TID fields that also carry a queue id */
  145. #define GET_TID_TID(x) ((x) & 0x3fff)
  146. #define GET_TID_QID(x) (((x) >> 14) & 0x3ff)
  147. #define TID_QID(x) ((x) << 14)
  148. struct rss_header {
  149. u8 opcode;
  150. #if defined(__LITTLE_ENDIAN_BITFIELD)
  151. u8 channel:2;
  152. u8 filter_hit:1;
  153. u8 filter_tid:1;
  154. u8 hash_type:2;
  155. u8 ipv6:1;
  156. u8 send2fw:1;
  157. #else
  158. u8 send2fw:1;
  159. u8 ipv6:1;
  160. u8 hash_type:2;
  161. u8 filter_tid:1;
  162. u8 filter_hit:1;
  163. u8 channel:2;
  164. #endif
  165. __be16 qid;
  166. __be32 hash_val;
  167. };
  168. struct work_request_hdr {
  169. __be32 wr_hi;
  170. __be32 wr_mid;
  171. __be64 wr_lo;
  172. };
  173. /* wr_hi fields */
  174. #define S_WR_OP 24
  175. #define V_WR_OP(x) ((__u64)(x) << S_WR_OP)
  176. #define WR_HDR struct work_request_hdr wr
  177. /* option 0 fields */
  178. #define S_MSS_IDX 60
  179. #define M_MSS_IDX 0xF
  180. #define V_MSS_IDX(x) ((__u64)(x) << S_MSS_IDX)
  181. #define G_MSS_IDX(x) (((x) >> S_MSS_IDX) & M_MSS_IDX)
  182. /* option 2 fields */
  183. #define S_RSS_QUEUE 0
  184. #define M_RSS_QUEUE 0x3FF
  185. #define V_RSS_QUEUE(x) ((x) << S_RSS_QUEUE)
  186. #define G_RSS_QUEUE(x) (((x) >> S_RSS_QUEUE) & M_RSS_QUEUE)
  187. struct cpl_pass_open_req {
  188. WR_HDR;
  189. union opcode_tid ot;
  190. __be16 local_port;
  191. __be16 peer_port;
  192. __be32 local_ip;
  193. __be32 peer_ip;
  194. __be64 opt0;
  195. #define TX_CHAN(x) ((x) << 2)
  196. #define NO_CONG(x) ((x) << 4)
  197. #define DELACK(x) ((x) << 5)
  198. #define ULP_MODE(x) ((x) << 8)
  199. #define RCV_BUFSIZ(x) ((x) << 12)
  200. #define DSCP(x) ((x) << 22)
  201. #define SMAC_SEL(x) ((u64)(x) << 28)
  202. #define L2T_IDX(x) ((u64)(x) << 36)
  203. #define TCAM_BYPASS(x) ((u64)(x) << 48)
  204. #define NAGLE(x) ((u64)(x) << 49)
  205. #define WND_SCALE(x) ((u64)(x) << 50)
  206. #define KEEP_ALIVE(x) ((u64)(x) << 54)
  207. #define MSS_IDX(x) ((u64)(x) << 60)
  208. __be64 opt1;
  209. #define SYN_RSS_ENABLE (1 << 0)
  210. #define SYN_RSS_QUEUE(x) ((x) << 2)
  211. #define CONN_POLICY_ASK (1 << 22)
  212. };
  213. struct cpl_pass_open_req6 {
  214. WR_HDR;
  215. union opcode_tid ot;
  216. __be16 local_port;
  217. __be16 peer_port;
  218. __be64 local_ip_hi;
  219. __be64 local_ip_lo;
  220. __be64 peer_ip_hi;
  221. __be64 peer_ip_lo;
  222. __be64 opt0;
  223. __be64 opt1;
  224. };
  225. struct cpl_pass_open_rpl {
  226. union opcode_tid ot;
  227. u8 rsvd[3];
  228. u8 status;
  229. };
  230. struct cpl_pass_accept_rpl {
  231. WR_HDR;
  232. union opcode_tid ot;
  233. __be32 opt2;
  234. #define RSS_QUEUE(x) ((x) << 0)
  235. #define RSS_QUEUE_VALID (1 << 10)
  236. #define RX_COALESCE_VALID(x) ((x) << 11)
  237. #define RX_COALESCE(x) ((x) << 12)
  238. #define PACE(x) ((x) << 16)
  239. #define TX_QUEUE(x) ((x) << 23)
  240. #define RX_CHANNEL(x) ((x) << 26)
  241. #define CCTRL_ECN(x) ((x) << 27)
  242. #define WND_SCALE_EN(x) ((x) << 28)
  243. #define TSTAMPS_EN(x) ((x) << 29)
  244. #define SACK_EN(x) ((x) << 30)
  245. __be64 opt0;
  246. };
  247. struct cpl_act_open_req {
  248. WR_HDR;
  249. union opcode_tid ot;
  250. __be16 local_port;
  251. __be16 peer_port;
  252. __be32 local_ip;
  253. __be32 peer_ip;
  254. __be64 opt0;
  255. __be32 params;
  256. __be32 opt2;
  257. };
  258. #define S_FILTER_TUPLE 24
  259. #define M_FILTER_TUPLE 0xFFFFFFFFFF
  260. #define V_FILTER_TUPLE(x) ((x) << S_FILTER_TUPLE)
  261. #define G_FILTER_TUPLE(x) (((x) >> S_FILTER_TUPLE) & M_FILTER_TUPLE)
  262. struct cpl_t5_act_open_req {
  263. WR_HDR;
  264. union opcode_tid ot;
  265. __be16 local_port;
  266. __be16 peer_port;
  267. __be32 local_ip;
  268. __be32 peer_ip;
  269. __be64 opt0;
  270. __be32 rsvd;
  271. __be32 opt2;
  272. __be64 params;
  273. };
  274. struct cpl_act_open_req6 {
  275. WR_HDR;
  276. union opcode_tid ot;
  277. __be16 local_port;
  278. __be16 peer_port;
  279. __be64 local_ip_hi;
  280. __be64 local_ip_lo;
  281. __be64 peer_ip_hi;
  282. __be64 peer_ip_lo;
  283. __be64 opt0;
  284. __be32 params;
  285. __be32 opt2;
  286. };
  287. struct cpl_act_open_rpl {
  288. union opcode_tid ot;
  289. __be32 atid_status;
  290. #define GET_AOPEN_STATUS(x) ((x) & 0xff)
  291. #define GET_AOPEN_ATID(x) (((x) >> 8) & 0xffffff)
  292. };
  293. struct cpl_pass_establish {
  294. union opcode_tid ot;
  295. __be32 rsvd;
  296. __be32 tos_stid;
  297. #define PASS_OPEN_TID(x) ((x) << 0)
  298. #define PASS_OPEN_TOS(x) ((x) << 24)
  299. #define GET_PASS_OPEN_TID(x) (((x) >> 0) & 0xFFFFFF)
  300. #define GET_POPEN_TID(x) ((x) & 0xffffff)
  301. #define GET_POPEN_TOS(x) (((x) >> 24) & 0xff)
  302. __be16 mac_idx;
  303. __be16 tcp_opt;
  304. #define GET_TCPOPT_WSCALE_OK(x) (((x) >> 5) & 1)
  305. #define GET_TCPOPT_SACK(x) (((x) >> 6) & 1)
  306. #define GET_TCPOPT_TSTAMP(x) (((x) >> 7) & 1)
  307. #define GET_TCPOPT_SND_WSCALE(x) (((x) >> 8) & 0xf)
  308. #define GET_TCPOPT_MSS(x) (((x) >> 12) & 0xf)
  309. __be32 snd_isn;
  310. __be32 rcv_isn;
  311. };
  312. struct cpl_act_establish {
  313. union opcode_tid ot;
  314. __be32 rsvd;
  315. __be32 tos_atid;
  316. __be16 mac_idx;
  317. __be16 tcp_opt;
  318. __be32 snd_isn;
  319. __be32 rcv_isn;
  320. };
  321. struct cpl_get_tcb {
  322. WR_HDR;
  323. union opcode_tid ot;
  324. __be16 reply_ctrl;
  325. #define QUEUENO(x) ((x) << 0)
  326. #define REPLY_CHAN(x) ((x) << 14)
  327. #define NO_REPLY(x) ((x) << 15)
  328. __be16 cookie;
  329. };
  330. struct cpl_set_tcb_field {
  331. WR_HDR;
  332. union opcode_tid ot;
  333. __be16 reply_ctrl;
  334. __be16 word_cookie;
  335. #define TCB_WORD(x) ((x) << 0)
  336. #define TCB_COOKIE(x) ((x) << 5)
  337. #define GET_TCB_COOKIE(x) (((x) >> 5) & 7)
  338. __be64 mask;
  339. __be64 val;
  340. };
  341. struct cpl_set_tcb_rpl {
  342. union opcode_tid ot;
  343. __be16 rsvd;
  344. u8 cookie;
  345. u8 status;
  346. __be64 oldval;
  347. };
  348. struct cpl_close_con_req {
  349. WR_HDR;
  350. union opcode_tid ot;
  351. __be32 rsvd;
  352. };
  353. struct cpl_close_con_rpl {
  354. union opcode_tid ot;
  355. u8 rsvd[3];
  356. u8 status;
  357. __be32 snd_nxt;
  358. __be32 rcv_nxt;
  359. };
  360. struct cpl_close_listsvr_req {
  361. WR_HDR;
  362. union opcode_tid ot;
  363. __be16 reply_ctrl;
  364. #define LISTSVR_IPV6 (1 << 14)
  365. __be16 rsvd;
  366. };
  367. struct cpl_close_listsvr_rpl {
  368. union opcode_tid ot;
  369. u8 rsvd[3];
  370. u8 status;
  371. };
  372. struct cpl_abort_req_rss {
  373. union opcode_tid ot;
  374. u8 rsvd[3];
  375. u8 status;
  376. };
  377. struct cpl_abort_req {
  378. WR_HDR;
  379. union opcode_tid ot;
  380. __be32 rsvd0;
  381. u8 rsvd1;
  382. u8 cmd;
  383. u8 rsvd2[6];
  384. };
  385. struct cpl_abort_rpl_rss {
  386. union opcode_tid ot;
  387. u8 rsvd[3];
  388. u8 status;
  389. };
  390. struct cpl_abort_rpl {
  391. WR_HDR;
  392. union opcode_tid ot;
  393. __be32 rsvd0;
  394. u8 rsvd1;
  395. u8 cmd;
  396. u8 rsvd2[6];
  397. };
  398. struct cpl_peer_close {
  399. union opcode_tid ot;
  400. __be32 rcv_nxt;
  401. };
  402. struct cpl_tid_release {
  403. WR_HDR;
  404. union opcode_tid ot;
  405. __be32 rsvd;
  406. };
  407. struct cpl_tx_pkt_core {
  408. __be32 ctrl0;
  409. #define TXPKT_VF(x) ((x) << 0)
  410. #define TXPKT_PF(x) ((x) << 8)
  411. #define TXPKT_VF_VLD (1 << 11)
  412. #define TXPKT_OVLAN_IDX(x) ((x) << 12)
  413. #define TXPKT_INTF(x) ((x) << 16)
  414. #define TXPKT_INS_OVLAN (1 << 21)
  415. #define TXPKT_OPCODE(x) ((x) << 24)
  416. __be16 pack;
  417. __be16 len;
  418. __be64 ctrl1;
  419. #define TXPKT_CSUM_END(x) ((x) << 12)
  420. #define TXPKT_CSUM_START(x) ((x) << 20)
  421. #define TXPKT_IPHDR_LEN(x) ((u64)(x) << 20)
  422. #define TXPKT_CSUM_LOC(x) ((u64)(x) << 30)
  423. #define TXPKT_ETHHDR_LEN(x) ((u64)(x) << 34)
  424. #define TXPKT_CSUM_TYPE(x) ((u64)(x) << 40)
  425. #define TXPKT_VLAN(x) ((u64)(x) << 44)
  426. #define TXPKT_VLAN_VLD (1ULL << 60)
  427. #define TXPKT_IPCSUM_DIS (1ULL << 62)
  428. #define TXPKT_L4CSUM_DIS (1ULL << 63)
  429. };
  430. struct cpl_tx_pkt {
  431. WR_HDR;
  432. struct cpl_tx_pkt_core c;
  433. };
  434. #define cpl_tx_pkt_xt cpl_tx_pkt
  435. struct cpl_tx_pkt_lso_core {
  436. __be32 lso_ctrl;
  437. #define LSO_TCPHDR_LEN(x) ((x) << 0)
  438. #define LSO_IPHDR_LEN(x) ((x) << 4)
  439. #define LSO_ETHHDR_LEN(x) ((x) << 16)
  440. #define LSO_IPV6(x) ((x) << 20)
  441. #define LSO_LAST_SLICE (1 << 22)
  442. #define LSO_FIRST_SLICE (1 << 23)
  443. #define LSO_OPCODE(x) ((x) << 24)
  444. __be16 ipid_ofst;
  445. __be16 mss;
  446. __be32 seqno_offset;
  447. __be32 len;
  448. /* encapsulated CPL (TX_PKT, TX_PKT_XT or TX_DATA) follows here */
  449. };
  450. struct cpl_tx_pkt_lso {
  451. WR_HDR;
  452. struct cpl_tx_pkt_lso_core c;
  453. /* encapsulated CPL (TX_PKT, TX_PKT_XT or TX_DATA) follows here */
  454. };
  455. struct cpl_iscsi_hdr {
  456. union opcode_tid ot;
  457. __be16 pdu_len_ddp;
  458. #define ISCSI_PDU_LEN(x) ((x) & 0x7FFF)
  459. #define ISCSI_DDP (1 << 15)
  460. __be16 len;
  461. __be32 seq;
  462. __be16 urg;
  463. u8 rsvd;
  464. u8 status;
  465. };
  466. struct cpl_rx_data {
  467. union opcode_tid ot;
  468. __be16 rsvd;
  469. __be16 len;
  470. __be32 seq;
  471. __be16 urg;
  472. #if defined(__LITTLE_ENDIAN_BITFIELD)
  473. u8 dack_mode:2;
  474. u8 psh:1;
  475. u8 heartbeat:1;
  476. u8 ddp_off:1;
  477. u8 :3;
  478. #else
  479. u8 :3;
  480. u8 ddp_off:1;
  481. u8 heartbeat:1;
  482. u8 psh:1;
  483. u8 dack_mode:2;
  484. #endif
  485. u8 status;
  486. };
  487. struct cpl_rx_data_ack {
  488. WR_HDR;
  489. union opcode_tid ot;
  490. __be32 credit_dack;
  491. #define RX_CREDITS(x) ((x) << 0)
  492. #define RX_FORCE_ACK(x) ((x) << 28)
  493. };
  494. struct cpl_rx_pkt {
  495. struct rss_header rsshdr;
  496. u8 opcode;
  497. #if defined(__LITTLE_ENDIAN_BITFIELD)
  498. u8 iff:4;
  499. u8 csum_calc:1;
  500. u8 ipmi_pkt:1;
  501. u8 vlan_ex:1;
  502. u8 ip_frag:1;
  503. #else
  504. u8 ip_frag:1;
  505. u8 vlan_ex:1;
  506. u8 ipmi_pkt:1;
  507. u8 csum_calc:1;
  508. u8 iff:4;
  509. #endif
  510. __be16 csum;
  511. __be16 vlan;
  512. __be16 len;
  513. __be32 l2info;
  514. #define RXF_UDP (1 << 22)
  515. #define RXF_TCP (1 << 23)
  516. #define RXF_IP (1 << 24)
  517. #define RXF_IP6 (1 << 25)
  518. __be16 hdr_len;
  519. __be16 err_vec;
  520. };
  521. /* rx_pkt.l2info fields */
  522. #define S_RX_ETHHDR_LEN 0
  523. #define M_RX_ETHHDR_LEN 0x1F
  524. #define V_RX_ETHHDR_LEN(x) ((x) << S_RX_ETHHDR_LEN)
  525. #define G_RX_ETHHDR_LEN(x) (((x) >> S_RX_ETHHDR_LEN) & M_RX_ETHHDR_LEN)
  526. #define S_RX_T5_ETHHDR_LEN 0
  527. #define M_RX_T5_ETHHDR_LEN 0x3F
  528. #define V_RX_T5_ETHHDR_LEN(x) ((x) << S_RX_T5_ETHHDR_LEN)
  529. #define G_RX_T5_ETHHDR_LEN(x) (((x) >> S_RX_T5_ETHHDR_LEN) & M_RX_T5_ETHHDR_LEN)
  530. #define S_RX_MACIDX 8
  531. #define M_RX_MACIDX 0x1FF
  532. #define V_RX_MACIDX(x) ((x) << S_RX_MACIDX)
  533. #define G_RX_MACIDX(x) (((x) >> S_RX_MACIDX) & M_RX_MACIDX)
  534. #define S_RXF_SYN 21
  535. #define V_RXF_SYN(x) ((x) << S_RXF_SYN)
  536. #define F_RXF_SYN V_RXF_SYN(1U)
  537. #define S_RX_CHAN 28
  538. #define M_RX_CHAN 0xF
  539. #define V_RX_CHAN(x) ((x) << S_RX_CHAN)
  540. #define G_RX_CHAN(x) (((x) >> S_RX_CHAN) & M_RX_CHAN)
  541. /* rx_pkt.hdr_len fields */
  542. #define S_RX_TCPHDR_LEN 0
  543. #define M_RX_TCPHDR_LEN 0x3F
  544. #define V_RX_TCPHDR_LEN(x) ((x) << S_RX_TCPHDR_LEN)
  545. #define G_RX_TCPHDR_LEN(x) (((x) >> S_RX_TCPHDR_LEN) & M_RX_TCPHDR_LEN)
  546. #define S_RX_IPHDR_LEN 6
  547. #define M_RX_IPHDR_LEN 0x3FF
  548. #define V_RX_IPHDR_LEN(x) ((x) << S_RX_IPHDR_LEN)
  549. #define G_RX_IPHDR_LEN(x) (((x) >> S_RX_IPHDR_LEN) & M_RX_IPHDR_LEN)
  550. struct cpl_trace_pkt {
  551. u8 opcode;
  552. u8 intf;
  553. #if defined(__LITTLE_ENDIAN_BITFIELD)
  554. u8 runt:4;
  555. u8 filter_hit:4;
  556. u8 :6;
  557. u8 err:1;
  558. u8 trunc:1;
  559. #else
  560. u8 filter_hit:4;
  561. u8 runt:4;
  562. u8 trunc:1;
  563. u8 err:1;
  564. u8 :6;
  565. #endif
  566. __be16 rsvd;
  567. __be16 len;
  568. __be64 tstamp;
  569. };
  570. struct cpl_t5_trace_pkt {
  571. __u8 opcode;
  572. __u8 intf;
  573. #if defined(__LITTLE_ENDIAN_BITFIELD)
  574. __u8 runt:4;
  575. __u8 filter_hit:4;
  576. __u8:6;
  577. __u8 err:1;
  578. __u8 trunc:1;
  579. #else
  580. __u8 filter_hit:4;
  581. __u8 runt:4;
  582. __u8 trunc:1;
  583. __u8 err:1;
  584. __u8:6;
  585. #endif
  586. __be16 rsvd;
  587. __be16 len;
  588. __be64 tstamp;
  589. __be64 rsvd1;
  590. };
  591. struct cpl_l2t_write_req {
  592. WR_HDR;
  593. union opcode_tid ot;
  594. __be16 params;
  595. #define L2T_W_INFO(x) ((x) << 2)
  596. #define L2T_W_PORT(x) ((x) << 8)
  597. #define L2T_W_NOREPLY(x) ((x) << 15)
  598. __be16 l2t_idx;
  599. __be16 vlan;
  600. u8 dst_mac[6];
  601. };
  602. struct cpl_l2t_write_rpl {
  603. union opcode_tid ot;
  604. u8 status;
  605. u8 rsvd[3];
  606. };
  607. struct cpl_rdma_terminate {
  608. union opcode_tid ot;
  609. __be16 rsvd;
  610. __be16 len;
  611. };
  612. struct cpl_sge_egr_update {
  613. __be32 opcode_qid;
  614. #define EGR_QID(x) ((x) & 0x1FFFF)
  615. __be16 cidx;
  616. __be16 pidx;
  617. };
  618. struct cpl_fw4_pld {
  619. u8 opcode;
  620. u8 rsvd0[3];
  621. u8 type;
  622. u8 rsvd1;
  623. __be16 len;
  624. __be64 data;
  625. __be64 rsvd2;
  626. };
  627. struct cpl_fw6_pld {
  628. u8 opcode;
  629. u8 rsvd[5];
  630. __be16 len;
  631. __be64 data[4];
  632. };
  633. struct cpl_fw4_msg {
  634. u8 opcode;
  635. u8 type;
  636. __be16 rsvd0;
  637. __be32 rsvd1;
  638. __be64 data[2];
  639. };
  640. struct cpl_fw4_ack {
  641. union opcode_tid ot;
  642. u8 credits;
  643. u8 rsvd0[2];
  644. u8 seq_vld;
  645. __be32 snd_nxt;
  646. __be32 snd_una;
  647. __be64 rsvd1;
  648. };
  649. struct cpl_fw6_msg {
  650. u8 opcode;
  651. u8 type;
  652. __be16 rsvd0;
  653. __be32 rsvd1;
  654. __be64 data[4];
  655. };
  656. /* cpl_fw6_msg.type values */
  657. enum {
  658. FW6_TYPE_CMD_RPL = 0,
  659. FW6_TYPE_WR_RPL = 1,
  660. FW6_TYPE_CQE = 2,
  661. FW6_TYPE_OFLD_CONNECTION_WR_RPL = 3,
  662. };
  663. struct cpl_fw6_msg_ofld_connection_wr_rpl {
  664. __u64 cookie;
  665. __be32 tid; /* or atid in case of active failure */
  666. __u8 t_state;
  667. __u8 retval;
  668. __u8 rsvd[2];
  669. };
  670. enum {
  671. ULP_TX_MEM_READ = 2,
  672. ULP_TX_MEM_WRITE = 3,
  673. ULP_TX_PKT = 4
  674. };
  675. enum {
  676. ULP_TX_SC_NOOP = 0x80,
  677. ULP_TX_SC_IMM = 0x81,
  678. ULP_TX_SC_DSGL = 0x82,
  679. ULP_TX_SC_ISGL = 0x83
  680. };
  681. struct ulptx_sge_pair {
  682. __be32 len[2];
  683. __be64 addr[2];
  684. };
  685. struct ulptx_sgl {
  686. __be32 cmd_nsge;
  687. #define ULPTX_CMD(x) ((x) << 24)
  688. #define ULPTX_NSGE(x) ((x) << 0)
  689. #define ULPTX_MORE (1U << 23)
  690. __be32 len0;
  691. __be64 addr0;
  692. struct ulptx_sge_pair sge[0];
  693. };
  694. struct ulp_mem_io {
  695. WR_HDR;
  696. __be32 cmd;
  697. #define ULP_MEMIO_ORDER(x) ((x) << 23)
  698. __be32 len16; /* command length */
  699. __be32 dlen; /* data length in 32-byte units */
  700. #define ULP_MEMIO_DATA_LEN(x) ((x) << 0)
  701. __be32 lock_addr;
  702. #define ULP_MEMIO_ADDR(x) ((x) << 0)
  703. #define ULP_MEMIO_LOCK(x) ((x) << 31)
  704. };
  705. #endif /* __T4_MSG_H */