t4_msg.h 17 KB

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