t4_msg.h 16 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590591592593594595596597598599600601602603604605606607608609610611612613614615616617618619620621622623624625626627628629630631632633634635636637638639640641642643644645646647648649650651652653654655656657658659660661662663664665666667668669670671672673674675676677678679680681682683684685686687688689690691692693694695696697698699700701702703704705706707708709710711712713714715716717718719720721722723724725726727728729730731732733734735736737738739740741742743744745
  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_RDMA_READ_REQ = 0x60,
  72. CPL_PASS_OPEN_REQ6 = 0x81,
  73. CPL_ACT_OPEN_REQ6 = 0x83,
  74. CPL_RDMA_TERMINATE = 0xA2,
  75. CPL_RDMA_WRITE = 0xA4,
  76. CPL_SGE_EGR_UPDATE = 0xA5,
  77. CPL_TRACE_PKT = 0xB0,
  78. CPL_FW4_MSG = 0xC0,
  79. CPL_FW4_PLD = 0xC1,
  80. CPL_FW4_ACK = 0xC3,
  81. CPL_FW6_MSG = 0xE0,
  82. CPL_FW6_PLD = 0xE1,
  83. CPL_TX_PKT_LSO = 0xED,
  84. CPL_TX_PKT_XT = 0xEE,
  85. NUM_CPL_CMDS
  86. };
  87. enum CPL_error {
  88. CPL_ERR_NONE = 0,
  89. CPL_ERR_TCAM_FULL = 3,
  90. CPL_ERR_BAD_LENGTH = 15,
  91. CPL_ERR_BAD_ROUTE = 18,
  92. CPL_ERR_CONN_RESET = 20,
  93. CPL_ERR_CONN_EXIST_SYNRECV = 21,
  94. CPL_ERR_CONN_EXIST = 22,
  95. CPL_ERR_ARP_MISS = 23,
  96. CPL_ERR_BAD_SYN = 24,
  97. CPL_ERR_CONN_TIMEDOUT = 30,
  98. CPL_ERR_XMIT_TIMEDOUT = 31,
  99. CPL_ERR_PERSIST_TIMEDOUT = 32,
  100. CPL_ERR_FINWAIT2_TIMEDOUT = 33,
  101. CPL_ERR_KEEPALIVE_TIMEDOUT = 34,
  102. CPL_ERR_RTX_NEG_ADVICE = 35,
  103. CPL_ERR_PERSIST_NEG_ADVICE = 36,
  104. CPL_ERR_ABORT_FAILED = 42,
  105. CPL_ERR_IWARP_FLM = 50,
  106. };
  107. enum {
  108. ULP_MODE_NONE = 0,
  109. ULP_MODE_ISCSI = 2,
  110. ULP_MODE_RDMA = 4,
  111. ULP_MODE_TCPDDP = 5,
  112. ULP_MODE_FCOE = 6,
  113. };
  114. enum {
  115. ULP_CRC_HEADER = 1 << 0,
  116. ULP_CRC_DATA = 1 << 1
  117. };
  118. enum {
  119. CPL_ABORT_SEND_RST = 0,
  120. CPL_ABORT_NO_RST,
  121. };
  122. enum { /* TX_PKT_XT checksum types */
  123. TX_CSUM_TCP = 0,
  124. TX_CSUM_UDP = 1,
  125. TX_CSUM_CRC16 = 4,
  126. TX_CSUM_CRC32 = 5,
  127. TX_CSUM_CRC32C = 6,
  128. TX_CSUM_FCOE = 7,
  129. TX_CSUM_TCPIP = 8,
  130. TX_CSUM_UDPIP = 9,
  131. TX_CSUM_TCPIP6 = 10,
  132. TX_CSUM_UDPIP6 = 11,
  133. TX_CSUM_IP = 12,
  134. };
  135. union opcode_tid {
  136. __be32 opcode_tid;
  137. u8 opcode;
  138. };
  139. #define CPL_OPCODE(x) ((x) << 24)
  140. #define MK_OPCODE_TID(opcode, tid) (CPL_OPCODE(opcode) | (tid))
  141. #define OPCODE_TID(cmd) ((cmd)->ot.opcode_tid)
  142. #define GET_TID(cmd) (ntohl(OPCODE_TID(cmd)) & 0xFFFFFF)
  143. /* partitioning of TID fields that also carry a queue id */
  144. #define GET_TID_TID(x) ((x) & 0x3fff)
  145. #define GET_TID_QID(x) (((x) >> 14) & 0x3ff)
  146. #define TID_QID(x) ((x) << 14)
  147. struct rss_header {
  148. u8 opcode;
  149. #if defined(__LITTLE_ENDIAN_BITFIELD)
  150. u8 channel:2;
  151. u8 filter_hit:1;
  152. u8 filter_tid:1;
  153. u8 hash_type:2;
  154. u8 ipv6:1;
  155. u8 send2fw:1;
  156. #else
  157. u8 send2fw:1;
  158. u8 ipv6:1;
  159. u8 hash_type:2;
  160. u8 filter_tid:1;
  161. u8 filter_hit:1;
  162. u8 channel:2;
  163. #endif
  164. __be16 qid;
  165. __be32 hash_val;
  166. };
  167. struct work_request_hdr {
  168. __be32 wr_hi;
  169. __be32 wr_mid;
  170. __be64 wr_lo;
  171. };
  172. /* wr_hi fields */
  173. #define S_WR_OP 24
  174. #define V_WR_OP(x) ((__u64)(x) << S_WR_OP)
  175. #define WR_HDR struct work_request_hdr wr
  176. /* option 0 fields */
  177. #define S_MSS_IDX 60
  178. #define M_MSS_IDX 0xF
  179. #define V_MSS_IDX(x) ((__u64)(x) << S_MSS_IDX)
  180. #define G_MSS_IDX(x) (((x) >> S_MSS_IDX) & M_MSS_IDX)
  181. /* option 2 fields */
  182. #define S_RSS_QUEUE 0
  183. #define M_RSS_QUEUE 0x3FF
  184. #define V_RSS_QUEUE(x) ((x) << S_RSS_QUEUE)
  185. #define G_RSS_QUEUE(x) (((x) >> S_RSS_QUEUE) & M_RSS_QUEUE)
  186. struct cpl_pass_open_req {
  187. WR_HDR;
  188. union opcode_tid ot;
  189. __be16 local_port;
  190. __be16 peer_port;
  191. __be32 local_ip;
  192. __be32 peer_ip;
  193. __be64 opt0;
  194. #define TX_CHAN(x) ((x) << 2)
  195. #define NO_CONG(x) ((x) << 4)
  196. #define DELACK(x) ((x) << 5)
  197. #define ULP_MODE(x) ((x) << 8)
  198. #define RCV_BUFSIZ(x) ((x) << 12)
  199. #define DSCP(x) ((x) << 22)
  200. #define SMAC_SEL(x) ((u64)(x) << 28)
  201. #define L2T_IDX(x) ((u64)(x) << 36)
  202. #define TCAM_BYPASS(x) ((u64)(x) << 48)
  203. #define NAGLE(x) ((u64)(x) << 49)
  204. #define WND_SCALE(x) ((u64)(x) << 50)
  205. #define KEEP_ALIVE(x) ((u64)(x) << 54)
  206. #define MSS_IDX(x) ((u64)(x) << 60)
  207. __be64 opt1;
  208. #define SYN_RSS_ENABLE (1 << 0)
  209. #define SYN_RSS_QUEUE(x) ((x) << 2)
  210. #define CONN_POLICY_ASK (1 << 22)
  211. };
  212. struct cpl_pass_open_req6 {
  213. WR_HDR;
  214. union opcode_tid ot;
  215. __be16 local_port;
  216. __be16 peer_port;
  217. __be64 local_ip_hi;
  218. __be64 local_ip_lo;
  219. __be64 peer_ip_hi;
  220. __be64 peer_ip_lo;
  221. __be64 opt0;
  222. __be64 opt1;
  223. };
  224. struct cpl_pass_open_rpl {
  225. union opcode_tid ot;
  226. u8 rsvd[3];
  227. u8 status;
  228. };
  229. struct cpl_pass_accept_rpl {
  230. WR_HDR;
  231. union opcode_tid ot;
  232. __be32 opt2;
  233. #define RSS_QUEUE(x) ((x) << 0)
  234. #define RSS_QUEUE_VALID (1 << 10)
  235. #define RX_COALESCE_VALID(x) ((x) << 11)
  236. #define RX_COALESCE(x) ((x) << 12)
  237. #define PACE(x) ((x) << 16)
  238. #define TX_QUEUE(x) ((x) << 23)
  239. #define RX_CHANNEL(x) ((x) << 26)
  240. #define CCTRL_ECN(x) ((x) << 27)
  241. #define WND_SCALE_EN(x) ((x) << 28)
  242. #define TSTAMPS_EN(x) ((x) << 29)
  243. #define SACK_EN(x) ((x) << 30)
  244. __be64 opt0;
  245. };
  246. struct cpl_act_open_req {
  247. WR_HDR;
  248. union opcode_tid ot;
  249. __be16 local_port;
  250. __be16 peer_port;
  251. __be32 local_ip;
  252. __be32 peer_ip;
  253. __be64 opt0;
  254. __be32 params;
  255. __be32 opt2;
  256. };
  257. struct cpl_act_open_req6 {
  258. WR_HDR;
  259. union opcode_tid ot;
  260. __be16 local_port;
  261. __be16 peer_port;
  262. __be64 local_ip_hi;
  263. __be64 local_ip_lo;
  264. __be64 peer_ip_hi;
  265. __be64 peer_ip_lo;
  266. __be64 opt0;
  267. __be32 params;
  268. __be32 opt2;
  269. };
  270. struct cpl_act_open_rpl {
  271. union opcode_tid ot;
  272. __be32 atid_status;
  273. #define GET_AOPEN_STATUS(x) ((x) & 0xff)
  274. #define GET_AOPEN_ATID(x) (((x) >> 8) & 0xffffff)
  275. };
  276. struct cpl_pass_establish {
  277. union opcode_tid ot;
  278. __be32 rsvd;
  279. __be32 tos_stid;
  280. #define PASS_OPEN_TID(x) ((x) << 0)
  281. #define PASS_OPEN_TOS(x) ((x) << 24)
  282. #define GET_PASS_OPEN_TID(x) (((x) >> 0) & 0xFFFFFF)
  283. #define GET_POPEN_TID(x) ((x) & 0xffffff)
  284. #define GET_POPEN_TOS(x) (((x) >> 24) & 0xff)
  285. __be16 mac_idx;
  286. __be16 tcp_opt;
  287. #define GET_TCPOPT_WSCALE_OK(x) (((x) >> 5) & 1)
  288. #define GET_TCPOPT_SACK(x) (((x) >> 6) & 1)
  289. #define GET_TCPOPT_TSTAMP(x) (((x) >> 7) & 1)
  290. #define GET_TCPOPT_SND_WSCALE(x) (((x) >> 8) & 0xf)
  291. #define GET_TCPOPT_MSS(x) (((x) >> 12) & 0xf)
  292. __be32 snd_isn;
  293. __be32 rcv_isn;
  294. };
  295. struct cpl_act_establish {
  296. union opcode_tid ot;
  297. __be32 rsvd;
  298. __be32 tos_atid;
  299. __be16 mac_idx;
  300. __be16 tcp_opt;
  301. __be32 snd_isn;
  302. __be32 rcv_isn;
  303. };
  304. struct cpl_get_tcb {
  305. WR_HDR;
  306. union opcode_tid ot;
  307. __be16 reply_ctrl;
  308. #define QUEUENO(x) ((x) << 0)
  309. #define REPLY_CHAN(x) ((x) << 14)
  310. #define NO_REPLY(x) ((x) << 15)
  311. __be16 cookie;
  312. };
  313. struct cpl_set_tcb_field {
  314. WR_HDR;
  315. union opcode_tid ot;
  316. __be16 reply_ctrl;
  317. __be16 word_cookie;
  318. #define TCB_WORD(x) ((x) << 0)
  319. #define TCB_COOKIE(x) ((x) << 5)
  320. #define GET_TCB_COOKIE(x) (((x) >> 5) & 7)
  321. __be64 mask;
  322. __be64 val;
  323. };
  324. struct cpl_set_tcb_rpl {
  325. union opcode_tid ot;
  326. __be16 rsvd;
  327. u8 cookie;
  328. u8 status;
  329. __be64 oldval;
  330. };
  331. struct cpl_close_con_req {
  332. WR_HDR;
  333. union opcode_tid ot;
  334. __be32 rsvd;
  335. };
  336. struct cpl_close_con_rpl {
  337. union opcode_tid ot;
  338. u8 rsvd[3];
  339. u8 status;
  340. __be32 snd_nxt;
  341. __be32 rcv_nxt;
  342. };
  343. struct cpl_close_listsvr_req {
  344. WR_HDR;
  345. union opcode_tid ot;
  346. __be16 reply_ctrl;
  347. #define LISTSVR_IPV6 (1 << 14)
  348. __be16 rsvd;
  349. };
  350. struct cpl_close_listsvr_rpl {
  351. union opcode_tid ot;
  352. u8 rsvd[3];
  353. u8 status;
  354. };
  355. struct cpl_abort_req_rss {
  356. union opcode_tid ot;
  357. u8 rsvd[3];
  358. u8 status;
  359. };
  360. struct cpl_abort_req {
  361. WR_HDR;
  362. union opcode_tid ot;
  363. __be32 rsvd0;
  364. u8 rsvd1;
  365. u8 cmd;
  366. u8 rsvd2[6];
  367. };
  368. struct cpl_abort_rpl_rss {
  369. union opcode_tid ot;
  370. u8 rsvd[3];
  371. u8 status;
  372. };
  373. struct cpl_abort_rpl {
  374. WR_HDR;
  375. union opcode_tid ot;
  376. __be32 rsvd0;
  377. u8 rsvd1;
  378. u8 cmd;
  379. u8 rsvd2[6];
  380. };
  381. struct cpl_peer_close {
  382. union opcode_tid ot;
  383. __be32 rcv_nxt;
  384. };
  385. struct cpl_tid_release {
  386. WR_HDR;
  387. union opcode_tid ot;
  388. __be32 rsvd;
  389. };
  390. struct cpl_tx_pkt_core {
  391. __be32 ctrl0;
  392. #define TXPKT_VF(x) ((x) << 0)
  393. #define TXPKT_PF(x) ((x) << 8)
  394. #define TXPKT_VF_VLD (1 << 11)
  395. #define TXPKT_OVLAN_IDX(x) ((x) << 12)
  396. #define TXPKT_INTF(x) ((x) << 16)
  397. #define TXPKT_INS_OVLAN (1 << 21)
  398. #define TXPKT_OPCODE(x) ((x) << 24)
  399. __be16 pack;
  400. __be16 len;
  401. __be64 ctrl1;
  402. #define TXPKT_CSUM_END(x) ((x) << 12)
  403. #define TXPKT_CSUM_START(x) ((x) << 20)
  404. #define TXPKT_IPHDR_LEN(x) ((u64)(x) << 20)
  405. #define TXPKT_CSUM_LOC(x) ((u64)(x) << 30)
  406. #define TXPKT_ETHHDR_LEN(x) ((u64)(x) << 34)
  407. #define TXPKT_CSUM_TYPE(x) ((u64)(x) << 40)
  408. #define TXPKT_VLAN(x) ((u64)(x) << 44)
  409. #define TXPKT_VLAN_VLD (1ULL << 60)
  410. #define TXPKT_IPCSUM_DIS (1ULL << 62)
  411. #define TXPKT_L4CSUM_DIS (1ULL << 63)
  412. };
  413. struct cpl_tx_pkt {
  414. WR_HDR;
  415. struct cpl_tx_pkt_core c;
  416. };
  417. #define cpl_tx_pkt_xt cpl_tx_pkt
  418. struct cpl_tx_pkt_lso_core {
  419. __be32 lso_ctrl;
  420. #define LSO_TCPHDR_LEN(x) ((x) << 0)
  421. #define LSO_IPHDR_LEN(x) ((x) << 4)
  422. #define LSO_ETHHDR_LEN(x) ((x) << 16)
  423. #define LSO_IPV6(x) ((x) << 20)
  424. #define LSO_LAST_SLICE (1 << 22)
  425. #define LSO_FIRST_SLICE (1 << 23)
  426. #define LSO_OPCODE(x) ((x) << 24)
  427. __be16 ipid_ofst;
  428. __be16 mss;
  429. __be32 seqno_offset;
  430. __be32 len;
  431. /* encapsulated CPL (TX_PKT, TX_PKT_XT or TX_DATA) follows here */
  432. };
  433. struct cpl_tx_pkt_lso {
  434. WR_HDR;
  435. struct cpl_tx_pkt_lso_core c;
  436. /* encapsulated CPL (TX_PKT, TX_PKT_XT or TX_DATA) follows here */
  437. };
  438. struct cpl_iscsi_hdr {
  439. union opcode_tid ot;
  440. __be16 pdu_len_ddp;
  441. #define ISCSI_PDU_LEN(x) ((x) & 0x7FFF)
  442. #define ISCSI_DDP (1 << 15)
  443. __be16 len;
  444. __be32 seq;
  445. __be16 urg;
  446. u8 rsvd;
  447. u8 status;
  448. };
  449. struct cpl_rx_data {
  450. union opcode_tid ot;
  451. __be16 rsvd;
  452. __be16 len;
  453. __be32 seq;
  454. __be16 urg;
  455. #if defined(__LITTLE_ENDIAN_BITFIELD)
  456. u8 dack_mode:2;
  457. u8 psh:1;
  458. u8 heartbeat:1;
  459. u8 ddp_off:1;
  460. u8 :3;
  461. #else
  462. u8 :3;
  463. u8 ddp_off:1;
  464. u8 heartbeat:1;
  465. u8 psh:1;
  466. u8 dack_mode:2;
  467. #endif
  468. u8 status;
  469. };
  470. struct cpl_rx_data_ack {
  471. WR_HDR;
  472. union opcode_tid ot;
  473. __be32 credit_dack;
  474. #define RX_CREDITS(x) ((x) << 0)
  475. #define RX_FORCE_ACK(x) ((x) << 28)
  476. };
  477. struct cpl_rx_pkt {
  478. struct rss_header rsshdr;
  479. u8 opcode;
  480. #if defined(__LITTLE_ENDIAN_BITFIELD)
  481. u8 iff:4;
  482. u8 csum_calc:1;
  483. u8 ipmi_pkt:1;
  484. u8 vlan_ex:1;
  485. u8 ip_frag:1;
  486. #else
  487. u8 ip_frag:1;
  488. u8 vlan_ex:1;
  489. u8 ipmi_pkt:1;
  490. u8 csum_calc:1;
  491. u8 iff:4;
  492. #endif
  493. __be16 csum;
  494. __be16 vlan;
  495. __be16 len;
  496. __be32 l2info;
  497. #define RXF_UDP (1 << 22)
  498. #define RXF_TCP (1 << 23)
  499. #define RXF_IP (1 << 24)
  500. #define RXF_IP6 (1 << 25)
  501. __be16 hdr_len;
  502. __be16 err_vec;
  503. };
  504. /* rx_pkt.l2info fields */
  505. #define S_RX_ETHHDR_LEN 0
  506. #define M_RX_ETHHDR_LEN 0x1F
  507. #define V_RX_ETHHDR_LEN(x) ((x) << S_RX_ETHHDR_LEN)
  508. #define G_RX_ETHHDR_LEN(x) (((x) >> S_RX_ETHHDR_LEN) & M_RX_ETHHDR_LEN)
  509. #define S_RX_MACIDX 8
  510. #define M_RX_MACIDX 0x1FF
  511. #define V_RX_MACIDX(x) ((x) << S_RX_MACIDX)
  512. #define G_RX_MACIDX(x) (((x) >> S_RX_MACIDX) & M_RX_MACIDX)
  513. #define S_RXF_SYN 21
  514. #define V_RXF_SYN(x) ((x) << S_RXF_SYN)
  515. #define F_RXF_SYN V_RXF_SYN(1U)
  516. #define S_RX_CHAN 28
  517. #define M_RX_CHAN 0xF
  518. #define V_RX_CHAN(x) ((x) << S_RX_CHAN)
  519. #define G_RX_CHAN(x) (((x) >> S_RX_CHAN) & M_RX_CHAN)
  520. /* rx_pkt.hdr_len fields */
  521. #define S_RX_TCPHDR_LEN 0
  522. #define M_RX_TCPHDR_LEN 0x3F
  523. #define V_RX_TCPHDR_LEN(x) ((x) << S_RX_TCPHDR_LEN)
  524. #define G_RX_TCPHDR_LEN(x) (((x) >> S_RX_TCPHDR_LEN) & M_RX_TCPHDR_LEN)
  525. #define S_RX_IPHDR_LEN 6
  526. #define M_RX_IPHDR_LEN 0x3FF
  527. #define V_RX_IPHDR_LEN(x) ((x) << S_RX_IPHDR_LEN)
  528. #define G_RX_IPHDR_LEN(x) (((x) >> S_RX_IPHDR_LEN) & M_RX_IPHDR_LEN)
  529. struct cpl_trace_pkt {
  530. u8 opcode;
  531. u8 intf;
  532. #if defined(__LITTLE_ENDIAN_BITFIELD)
  533. u8 runt:4;
  534. u8 filter_hit:4;
  535. u8 :6;
  536. u8 err:1;
  537. u8 trunc:1;
  538. #else
  539. u8 filter_hit:4;
  540. u8 runt:4;
  541. u8 trunc:1;
  542. u8 err:1;
  543. u8 :6;
  544. #endif
  545. __be16 rsvd;
  546. __be16 len;
  547. __be64 tstamp;
  548. };
  549. struct cpl_l2t_write_req {
  550. WR_HDR;
  551. union opcode_tid ot;
  552. __be16 params;
  553. #define L2T_W_INFO(x) ((x) << 2)
  554. #define L2T_W_PORT(x) ((x) << 8)
  555. #define L2T_W_NOREPLY(x) ((x) << 15)
  556. __be16 l2t_idx;
  557. __be16 vlan;
  558. u8 dst_mac[6];
  559. };
  560. struct cpl_l2t_write_rpl {
  561. union opcode_tid ot;
  562. u8 status;
  563. u8 rsvd[3];
  564. };
  565. struct cpl_rdma_terminate {
  566. union opcode_tid ot;
  567. __be16 rsvd;
  568. __be16 len;
  569. };
  570. struct cpl_sge_egr_update {
  571. __be32 opcode_qid;
  572. #define EGR_QID(x) ((x) & 0x1FFFF)
  573. __be16 cidx;
  574. __be16 pidx;
  575. };
  576. struct cpl_fw4_pld {
  577. u8 opcode;
  578. u8 rsvd0[3];
  579. u8 type;
  580. u8 rsvd1;
  581. __be16 len;
  582. __be64 data;
  583. __be64 rsvd2;
  584. };
  585. struct cpl_fw6_pld {
  586. u8 opcode;
  587. u8 rsvd[5];
  588. __be16 len;
  589. __be64 data[4];
  590. };
  591. struct cpl_fw4_msg {
  592. u8 opcode;
  593. u8 type;
  594. __be16 rsvd0;
  595. __be32 rsvd1;
  596. __be64 data[2];
  597. };
  598. struct cpl_fw4_ack {
  599. union opcode_tid ot;
  600. u8 credits;
  601. u8 rsvd0[2];
  602. u8 seq_vld;
  603. __be32 snd_nxt;
  604. __be32 snd_una;
  605. __be64 rsvd1;
  606. };
  607. struct cpl_fw6_msg {
  608. u8 opcode;
  609. u8 type;
  610. __be16 rsvd0;
  611. __be32 rsvd1;
  612. __be64 data[4];
  613. };
  614. /* cpl_fw6_msg.type values */
  615. enum {
  616. FW6_TYPE_CMD_RPL = 0,
  617. FW6_TYPE_WR_RPL = 1,
  618. FW6_TYPE_CQE = 2,
  619. FW6_TYPE_OFLD_CONNECTION_WR_RPL = 3,
  620. };
  621. struct cpl_fw6_msg_ofld_connection_wr_rpl {
  622. __u64 cookie;
  623. __be32 tid; /* or atid in case of active failure */
  624. __u8 t_state;
  625. __u8 retval;
  626. __u8 rsvd[2];
  627. };
  628. enum {
  629. ULP_TX_MEM_READ = 2,
  630. ULP_TX_MEM_WRITE = 3,
  631. ULP_TX_PKT = 4
  632. };
  633. enum {
  634. ULP_TX_SC_NOOP = 0x80,
  635. ULP_TX_SC_IMM = 0x81,
  636. ULP_TX_SC_DSGL = 0x82,
  637. ULP_TX_SC_ISGL = 0x83
  638. };
  639. struct ulptx_sge_pair {
  640. __be32 len[2];
  641. __be64 addr[2];
  642. };
  643. struct ulptx_sgl {
  644. __be32 cmd_nsge;
  645. #define ULPTX_CMD(x) ((x) << 24)
  646. #define ULPTX_NSGE(x) ((x) << 0)
  647. #define ULPTX_MORE (1U << 23)
  648. __be32 len0;
  649. __be64 addr0;
  650. struct ulptx_sge_pair sge[0];
  651. };
  652. struct ulp_mem_io {
  653. WR_HDR;
  654. __be32 cmd;
  655. #define ULP_MEMIO_ORDER(x) ((x) << 23)
  656. __be32 len16; /* command length */
  657. __be32 dlen; /* data length in 32-byte units */
  658. #define ULP_MEMIO_DATA_LEN(x) ((x) << 0)
  659. __be32 lock_addr;
  660. #define ULP_MEMIO_ADDR(x) ((x) << 0)
  661. #define ULP_MEMIO_LOCK(x) ((x) << 31)
  662. };
  663. #endif /* __T4_MSG_H */