t3_cpl.h 35 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970717273747576777879808182838485868788899091929394959697989910010110210310410510610710810911011111211311411511611711811912012112212312412512612712812913013113213313413513613713813914014114214314414514614714814915015115215315415515615715815916016116216316416516616716816917017117217317417517617717817918018118218318418518618718818919019119219319419519619719819920020120220320420520620720820921021121221321421521621721821922022122222322422522622722822923023123223323423523623723823924024124224324424524624724824925025125225325425525625725825926026126226326426526626726826927027127227327427527627727827928028128228328428528628728828929029129229329429529629729829930030130230330430530630730830931031131231331431531631731831932032132232332432532632732832933033133233333433533633733833934034134234334434534634734834935035135235335435535635735835936036136236336436536636736836937037137237337437537637737837938038138238338438538638738838939039139239339439539639739839940040140240340440540640740840941041141241341441541641741841942042142242342442542642742842943043143243343443543643743843944044144244344444544644744844945045145245345445545645745845946046146246346446546646746846947047147247347447547647747847948048148248348448548648748848949049149249349449549649749849950050150250350450550650750850951051151251351451551651751851952052152252352452552652752852953053153253353453553653753853954054154254354454554654754854955055155255355455555655755855956056156256356456556656756856957057157257357457557657757857958058158258358458558658758858959059159259359459559659759859960060160260360460560660760860961061161261361461561661761861962062162262362462562662762862963063163263363463563663763863964064164264364464564664764864965065165265365465565665765865966066166266366466566666766866967067167267367467567667767867968068168268368468568668768868969069169269369469569669769869970070170270370470570670770870971071171271371471571671771871972072172272372472572672772872973073173273373473573673773873974074174274374474574674774874975075175275375475575675775875976076176276376476576676776876977077177277377477577677777877978078178278378478578678778878979079179279379479579679779879980080180280380480580680780880981081181281381481581681781881982082182282382482582682782882983083183283383483583683783883984084184284384484584684784884985085185285385485585685785885986086186286386486586686786886987087187287387487587687787887988088188288388488588688788888989089189289389489589689789889990090190290390490590690790890991091191291391491591691791891992092192292392492592692792892993093193293393493593693793893994094194294394494594694794894995095195295395495595695795895996096196296396496596696796896997097197297397497597697797897998098198298398498598698798898999099199299399499599699799899910001001100210031004100510061007100810091010101110121013101410151016101710181019102010211022102310241025102610271028102910301031103210331034103510361037103810391040104110421043104410451046104710481049105010511052105310541055105610571058105910601061106210631064106510661067106810691070107110721073107410751076107710781079108010811082108310841085108610871088108910901091109210931094109510961097109810991100110111021103110411051106110711081109111011111112111311141115111611171118111911201121112211231124112511261127112811291130113111321133113411351136113711381139114011411142114311441145114611471148114911501151115211531154115511561157115811591160116111621163116411651166116711681169117011711172117311741175117611771178117911801181118211831184118511861187118811891190119111921193119411951196119711981199120012011202120312041205120612071208120912101211121212131214121512161217121812191220122112221223122412251226122712281229123012311232123312341235123612371238123912401241124212431244124512461247124812491250125112521253125412551256125712581259126012611262126312641265126612671268126912701271127212731274127512761277127812791280128112821283128412851286128712881289129012911292129312941295129612971298129913001301130213031304130513061307130813091310131113121313131413151316131713181319132013211322132313241325132613271328132913301331133213331334133513361337133813391340134113421343134413451346134713481349135013511352135313541355135613571358135913601361136213631364136513661367136813691370137113721373137413751376137713781379138013811382138313841385138613871388138913901391139213931394139513961397139813991400140114021403140414051406140714081409141014111412141314141415141614171418141914201421142214231424142514261427142814291430143114321433143414351436143714381439144014411442144314441445144614471448144914501451145214531454145514561457145814591460146114621463146414651466146714681469147014711472147314741475147614771478147914801481148214831484148514861487148814891490149114921493149414951496
  1. /*
  2. * Copyright (c) 2004-2008 Chelsio, Inc. All rights reserved.
  3. *
  4. * This software is available to you under a choice of one of two
  5. * licenses. You may choose to be licensed under the terms of the GNU
  6. * General Public License (GPL) Version 2, available from the file
  7. * COPYING in the main directory of this source tree, or the
  8. * OpenIB.org BSD license below:
  9. *
  10. * Redistribution and use in source and binary forms, with or
  11. * without modification, are permitted provided that the following
  12. * conditions are met:
  13. *
  14. * - Redistributions of source code must retain the above
  15. * copyright notice, this list of conditions and the following
  16. * disclaimer.
  17. *
  18. * - Redistributions in binary form must reproduce the above
  19. * copyright notice, this list of conditions and the following
  20. * disclaimer in the documentation and/or other materials
  21. * provided with the distribution.
  22. *
  23. * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
  24. * EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
  25. * MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
  26. * NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS
  27. * BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN
  28. * ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN
  29. * CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
  30. * SOFTWARE.
  31. */
  32. #ifndef T3_CPL_H
  33. #define T3_CPL_H
  34. #if !defined(__LITTLE_ENDIAN_BITFIELD) && !defined(__BIG_ENDIAN_BITFIELD)
  35. # include <asm/byteorder.h>
  36. #endif
  37. enum CPL_opcode {
  38. CPL_PASS_OPEN_REQ = 0x1,
  39. CPL_PASS_ACCEPT_RPL = 0x2,
  40. CPL_ACT_OPEN_REQ = 0x3,
  41. CPL_SET_TCB = 0x4,
  42. CPL_SET_TCB_FIELD = 0x5,
  43. CPL_GET_TCB = 0x6,
  44. CPL_PCMD = 0x7,
  45. CPL_CLOSE_CON_REQ = 0x8,
  46. CPL_CLOSE_LISTSRV_REQ = 0x9,
  47. CPL_ABORT_REQ = 0xA,
  48. CPL_ABORT_RPL = 0xB,
  49. CPL_TX_DATA = 0xC,
  50. CPL_RX_DATA_ACK = 0xD,
  51. CPL_TX_PKT = 0xE,
  52. CPL_RTE_DELETE_REQ = 0xF,
  53. CPL_RTE_WRITE_REQ = 0x10,
  54. CPL_RTE_READ_REQ = 0x11,
  55. CPL_L2T_WRITE_REQ = 0x12,
  56. CPL_L2T_READ_REQ = 0x13,
  57. CPL_SMT_WRITE_REQ = 0x14,
  58. CPL_SMT_READ_REQ = 0x15,
  59. CPL_TX_PKT_LSO = 0x16,
  60. CPL_PCMD_READ = 0x17,
  61. CPL_BARRIER = 0x18,
  62. CPL_TID_RELEASE = 0x1A,
  63. CPL_CLOSE_LISTSRV_RPL = 0x20,
  64. CPL_ERROR = 0x21,
  65. CPL_GET_TCB_RPL = 0x22,
  66. CPL_L2T_WRITE_RPL = 0x23,
  67. CPL_PCMD_READ_RPL = 0x24,
  68. CPL_PCMD_RPL = 0x25,
  69. CPL_PEER_CLOSE = 0x26,
  70. CPL_RTE_DELETE_RPL = 0x27,
  71. CPL_RTE_WRITE_RPL = 0x28,
  72. CPL_RX_DDP_COMPLETE = 0x29,
  73. CPL_RX_PHYS_ADDR = 0x2A,
  74. CPL_RX_PKT = 0x2B,
  75. CPL_RX_URG_NOTIFY = 0x2C,
  76. CPL_SET_TCB_RPL = 0x2D,
  77. CPL_SMT_WRITE_RPL = 0x2E,
  78. CPL_TX_DATA_ACK = 0x2F,
  79. CPL_ABORT_REQ_RSS = 0x30,
  80. CPL_ABORT_RPL_RSS = 0x31,
  81. CPL_CLOSE_CON_RPL = 0x32,
  82. CPL_ISCSI_HDR = 0x33,
  83. CPL_L2T_READ_RPL = 0x34,
  84. CPL_RDMA_CQE = 0x35,
  85. CPL_RDMA_CQE_READ_RSP = 0x36,
  86. CPL_RDMA_CQE_ERR = 0x37,
  87. CPL_RTE_READ_RPL = 0x38,
  88. CPL_RX_DATA = 0x39,
  89. CPL_ACT_OPEN_RPL = 0x40,
  90. CPL_PASS_OPEN_RPL = 0x41,
  91. CPL_RX_DATA_DDP = 0x42,
  92. CPL_SMT_READ_RPL = 0x43,
  93. CPL_ACT_ESTABLISH = 0x50,
  94. CPL_PASS_ESTABLISH = 0x51,
  95. CPL_PASS_ACCEPT_REQ = 0x70,
  96. CPL_ASYNC_NOTIF = 0x80, /* fake opcode for async notifications */
  97. CPL_TX_DMA_ACK = 0xA0,
  98. CPL_RDMA_READ_REQ = 0xA1,
  99. CPL_RDMA_TERMINATE = 0xA2,
  100. CPL_TRACE_PKT = 0xA3,
  101. CPL_RDMA_EC_STATUS = 0xA5,
  102. NUM_CPL_CMDS /* must be last and previous entries must be sorted */
  103. };
  104. enum CPL_error {
  105. CPL_ERR_NONE = 0,
  106. CPL_ERR_TCAM_PARITY = 1,
  107. CPL_ERR_TCAM_FULL = 3,
  108. CPL_ERR_CONN_RESET = 20,
  109. CPL_ERR_CONN_EXIST = 22,
  110. CPL_ERR_ARP_MISS = 23,
  111. CPL_ERR_BAD_SYN = 24,
  112. CPL_ERR_CONN_TIMEDOUT = 30,
  113. CPL_ERR_XMIT_TIMEDOUT = 31,
  114. CPL_ERR_PERSIST_TIMEDOUT = 32,
  115. CPL_ERR_FINWAIT2_TIMEDOUT = 33,
  116. CPL_ERR_KEEPALIVE_TIMEDOUT = 34,
  117. CPL_ERR_RTX_NEG_ADVICE = 35,
  118. CPL_ERR_PERSIST_NEG_ADVICE = 36,
  119. CPL_ERR_ABORT_FAILED = 42,
  120. CPL_ERR_GENERAL = 99
  121. };
  122. enum {
  123. CPL_CONN_POLICY_AUTO = 0,
  124. CPL_CONN_POLICY_ASK = 1,
  125. CPL_CONN_POLICY_DENY = 3
  126. };
  127. enum {
  128. ULP_MODE_NONE = 0,
  129. ULP_MODE_ISCSI = 2,
  130. ULP_MODE_RDMA = 4,
  131. ULP_MODE_TCPDDP = 5
  132. };
  133. enum {
  134. ULP_CRC_HEADER = 1 << 0,
  135. ULP_CRC_DATA = 1 << 1
  136. };
  137. enum {
  138. CPL_PASS_OPEN_ACCEPT,
  139. CPL_PASS_OPEN_REJECT
  140. };
  141. enum {
  142. CPL_ABORT_SEND_RST = 0,
  143. CPL_ABORT_NO_RST,
  144. CPL_ABORT_POST_CLOSE_REQ = 2
  145. };
  146. enum { /* TX_PKT_LSO ethernet types */
  147. CPL_ETH_II,
  148. CPL_ETH_II_VLAN,
  149. CPL_ETH_802_3,
  150. CPL_ETH_802_3_VLAN
  151. };
  152. enum { /* TCP congestion control algorithms */
  153. CONG_ALG_RENO,
  154. CONG_ALG_TAHOE,
  155. CONG_ALG_NEWRENO,
  156. CONG_ALG_HIGHSPEED
  157. };
  158. enum { /* RSS hash type */
  159. RSS_HASH_NONE = 0,
  160. RSS_HASH_2_TUPLE = 1,
  161. RSS_HASH_4_TUPLE = 2,
  162. RSS_HASH_TCPV6 = 3
  163. };
  164. union opcode_tid {
  165. __be32 opcode_tid;
  166. __u8 opcode;
  167. };
  168. #define S_OPCODE 24
  169. #define V_OPCODE(x) ((x) << S_OPCODE)
  170. #define G_OPCODE(x) (((x) >> S_OPCODE) & 0xFF)
  171. #define G_TID(x) ((x) & 0xFFFFFF)
  172. #define S_QNUM 0
  173. #define G_QNUM(x) (((x) >> S_QNUM) & 0xFFFF)
  174. #define S_HASHTYPE 22
  175. #define M_HASHTYPE 0x3
  176. #define G_HASHTYPE(x) (((x) >> S_HASHTYPE) & M_HASHTYPE)
  177. /* tid is assumed to be 24-bits */
  178. #define MK_OPCODE_TID(opcode, tid) (V_OPCODE(opcode) | (tid))
  179. #define OPCODE_TID(cmd) ((cmd)->ot.opcode_tid)
  180. /* extract the TID from a CPL command */
  181. #define GET_TID(cmd) (G_TID(ntohl(OPCODE_TID(cmd))))
  182. struct tcp_options {
  183. __be16 mss;
  184. __u8 wsf;
  185. #if defined(__LITTLE_ENDIAN_BITFIELD)
  186. __u8:5;
  187. __u8 ecn:1;
  188. __u8 sack:1;
  189. __u8 tstamp:1;
  190. #else
  191. __u8 tstamp:1;
  192. __u8 sack:1;
  193. __u8 ecn:1;
  194. __u8:5;
  195. #endif
  196. };
  197. struct rss_header {
  198. __u8 opcode;
  199. #if defined(__LITTLE_ENDIAN_BITFIELD)
  200. __u8 cpu_idx:6;
  201. __u8 hash_type:2;
  202. #else
  203. __u8 hash_type:2;
  204. __u8 cpu_idx:6;
  205. #endif
  206. __be16 cq_idx;
  207. __be32 rss_hash_val;
  208. };
  209. #ifndef CHELSIO_FW
  210. struct work_request_hdr {
  211. __be32 wr_hi;
  212. __be32 wr_lo;
  213. };
  214. /* wr_hi fields */
  215. #define S_WR_SGE_CREDITS 0
  216. #define M_WR_SGE_CREDITS 0xFF
  217. #define V_WR_SGE_CREDITS(x) ((x) << S_WR_SGE_CREDITS)
  218. #define G_WR_SGE_CREDITS(x) (((x) >> S_WR_SGE_CREDITS) & M_WR_SGE_CREDITS)
  219. #define S_WR_SGLSFLT 8
  220. #define M_WR_SGLSFLT 0xFF
  221. #define V_WR_SGLSFLT(x) ((x) << S_WR_SGLSFLT)
  222. #define G_WR_SGLSFLT(x) (((x) >> S_WR_SGLSFLT) & M_WR_SGLSFLT)
  223. #define S_WR_BCNTLFLT 16
  224. #define M_WR_BCNTLFLT 0xF
  225. #define V_WR_BCNTLFLT(x) ((x) << S_WR_BCNTLFLT)
  226. #define G_WR_BCNTLFLT(x) (((x) >> S_WR_BCNTLFLT) & M_WR_BCNTLFLT)
  227. #define S_WR_DATATYPE 20
  228. #define V_WR_DATATYPE(x) ((x) << S_WR_DATATYPE)
  229. #define F_WR_DATATYPE V_WR_DATATYPE(1U)
  230. #define S_WR_COMPL 21
  231. #define V_WR_COMPL(x) ((x) << S_WR_COMPL)
  232. #define F_WR_COMPL V_WR_COMPL(1U)
  233. #define S_WR_EOP 22
  234. #define V_WR_EOP(x) ((x) << S_WR_EOP)
  235. #define F_WR_EOP V_WR_EOP(1U)
  236. #define S_WR_SOP 23
  237. #define V_WR_SOP(x) ((x) << S_WR_SOP)
  238. #define F_WR_SOP V_WR_SOP(1U)
  239. #define S_WR_OP 24
  240. #define M_WR_OP 0xFF
  241. #define V_WR_OP(x) ((x) << S_WR_OP)
  242. #define G_WR_OP(x) (((x) >> S_WR_OP) & M_WR_OP)
  243. /* wr_lo fields */
  244. #define S_WR_LEN 0
  245. #define M_WR_LEN 0xFF
  246. #define V_WR_LEN(x) ((x) << S_WR_LEN)
  247. #define G_WR_LEN(x) (((x) >> S_WR_LEN) & M_WR_LEN)
  248. #define S_WR_TID 8
  249. #define M_WR_TID 0xFFFFF
  250. #define V_WR_TID(x) ((x) << S_WR_TID)
  251. #define G_WR_TID(x) (((x) >> S_WR_TID) & M_WR_TID)
  252. #define S_WR_CR_FLUSH 30
  253. #define V_WR_CR_FLUSH(x) ((x) << S_WR_CR_FLUSH)
  254. #define F_WR_CR_FLUSH V_WR_CR_FLUSH(1U)
  255. #define S_WR_GEN 31
  256. #define V_WR_GEN(x) ((x) << S_WR_GEN)
  257. #define F_WR_GEN V_WR_GEN(1U)
  258. # define WR_HDR struct work_request_hdr wr
  259. # define RSS_HDR
  260. #else
  261. # define WR_HDR
  262. # define RSS_HDR struct rss_header rss_hdr;
  263. #endif
  264. /* option 0 lower-half fields */
  265. #define S_CPL_STATUS 0
  266. #define M_CPL_STATUS 0xFF
  267. #define V_CPL_STATUS(x) ((x) << S_CPL_STATUS)
  268. #define G_CPL_STATUS(x) (((x) >> S_CPL_STATUS) & M_CPL_STATUS)
  269. #define S_INJECT_TIMER 6
  270. #define V_INJECT_TIMER(x) ((x) << S_INJECT_TIMER)
  271. #define F_INJECT_TIMER V_INJECT_TIMER(1U)
  272. #define S_NO_OFFLOAD 7
  273. #define V_NO_OFFLOAD(x) ((x) << S_NO_OFFLOAD)
  274. #define F_NO_OFFLOAD V_NO_OFFLOAD(1U)
  275. #define S_ULP_MODE 8
  276. #define M_ULP_MODE 0xF
  277. #define V_ULP_MODE(x) ((x) << S_ULP_MODE)
  278. #define G_ULP_MODE(x) (((x) >> S_ULP_MODE) & M_ULP_MODE)
  279. #define S_RCV_BUFSIZ 12
  280. #define M_RCV_BUFSIZ 0x3FFF
  281. #define V_RCV_BUFSIZ(x) ((x) << S_RCV_BUFSIZ)
  282. #define G_RCV_BUFSIZ(x) (((x) >> S_RCV_BUFSIZ) & M_RCV_BUFSIZ)
  283. #define S_TOS 26
  284. #define M_TOS 0x3F
  285. #define V_TOS(x) ((x) << S_TOS)
  286. #define G_TOS(x) (((x) >> S_TOS) & M_TOS)
  287. /* option 0 upper-half fields */
  288. #define S_DELACK 0
  289. #define V_DELACK(x) ((x) << S_DELACK)
  290. #define F_DELACK V_DELACK(1U)
  291. #define S_NO_CONG 1
  292. #define V_NO_CONG(x) ((x) << S_NO_CONG)
  293. #define F_NO_CONG V_NO_CONG(1U)
  294. #define S_SRC_MAC_SEL 2
  295. #define M_SRC_MAC_SEL 0x3
  296. #define V_SRC_MAC_SEL(x) ((x) << S_SRC_MAC_SEL)
  297. #define G_SRC_MAC_SEL(x) (((x) >> S_SRC_MAC_SEL) & M_SRC_MAC_SEL)
  298. #define S_L2T_IDX 4
  299. #define M_L2T_IDX 0x7FF
  300. #define V_L2T_IDX(x) ((x) << S_L2T_IDX)
  301. #define G_L2T_IDX(x) (((x) >> S_L2T_IDX) & M_L2T_IDX)
  302. #define S_TX_CHANNEL 15
  303. #define V_TX_CHANNEL(x) ((x) << S_TX_CHANNEL)
  304. #define F_TX_CHANNEL V_TX_CHANNEL(1U)
  305. #define S_TCAM_BYPASS 16
  306. #define V_TCAM_BYPASS(x) ((x) << S_TCAM_BYPASS)
  307. #define F_TCAM_BYPASS V_TCAM_BYPASS(1U)
  308. #define S_NAGLE 17
  309. #define V_NAGLE(x) ((x) << S_NAGLE)
  310. #define F_NAGLE V_NAGLE(1U)
  311. #define S_WND_SCALE 18
  312. #define M_WND_SCALE 0xF
  313. #define V_WND_SCALE(x) ((x) << S_WND_SCALE)
  314. #define G_WND_SCALE(x) (((x) >> S_WND_SCALE) & M_WND_SCALE)
  315. #define S_KEEP_ALIVE 22
  316. #define V_KEEP_ALIVE(x) ((x) << S_KEEP_ALIVE)
  317. #define F_KEEP_ALIVE V_KEEP_ALIVE(1U)
  318. #define S_MAX_RETRANS 23
  319. #define M_MAX_RETRANS 0xF
  320. #define V_MAX_RETRANS(x) ((x) << S_MAX_RETRANS)
  321. #define G_MAX_RETRANS(x) (((x) >> S_MAX_RETRANS) & M_MAX_RETRANS)
  322. #define S_MAX_RETRANS_OVERRIDE 27
  323. #define V_MAX_RETRANS_OVERRIDE(x) ((x) << S_MAX_RETRANS_OVERRIDE)
  324. #define F_MAX_RETRANS_OVERRIDE V_MAX_RETRANS_OVERRIDE(1U)
  325. #define S_MSS_IDX 28
  326. #define M_MSS_IDX 0xF
  327. #define V_MSS_IDX(x) ((x) << S_MSS_IDX)
  328. #define G_MSS_IDX(x) (((x) >> S_MSS_IDX) & M_MSS_IDX)
  329. /* option 1 fields */
  330. #define S_RSS_ENABLE 0
  331. #define V_RSS_ENABLE(x) ((x) << S_RSS_ENABLE)
  332. #define F_RSS_ENABLE V_RSS_ENABLE(1U)
  333. #define S_RSS_MASK_LEN 1
  334. #define M_RSS_MASK_LEN 0x7
  335. #define V_RSS_MASK_LEN(x) ((x) << S_RSS_MASK_LEN)
  336. #define G_RSS_MASK_LEN(x) (((x) >> S_RSS_MASK_LEN) & M_RSS_MASK_LEN)
  337. #define S_CPU_IDX 4
  338. #define M_CPU_IDX 0x3F
  339. #define V_CPU_IDX(x) ((x) << S_CPU_IDX)
  340. #define G_CPU_IDX(x) (((x) >> S_CPU_IDX) & M_CPU_IDX)
  341. #define S_MAC_MATCH_VALID 18
  342. #define V_MAC_MATCH_VALID(x) ((x) << S_MAC_MATCH_VALID)
  343. #define F_MAC_MATCH_VALID V_MAC_MATCH_VALID(1U)
  344. #define S_CONN_POLICY 19
  345. #define M_CONN_POLICY 0x3
  346. #define V_CONN_POLICY(x) ((x) << S_CONN_POLICY)
  347. #define G_CONN_POLICY(x) (((x) >> S_CONN_POLICY) & M_CONN_POLICY)
  348. #define S_SYN_DEFENSE 21
  349. #define V_SYN_DEFENSE(x) ((x) << S_SYN_DEFENSE)
  350. #define F_SYN_DEFENSE V_SYN_DEFENSE(1U)
  351. #define S_VLAN_PRI 22
  352. #define M_VLAN_PRI 0x3
  353. #define V_VLAN_PRI(x) ((x) << S_VLAN_PRI)
  354. #define G_VLAN_PRI(x) (((x) >> S_VLAN_PRI) & M_VLAN_PRI)
  355. #define S_VLAN_PRI_VALID 24
  356. #define V_VLAN_PRI_VALID(x) ((x) << S_VLAN_PRI_VALID)
  357. #define F_VLAN_PRI_VALID V_VLAN_PRI_VALID(1U)
  358. #define S_PKT_TYPE 25
  359. #define M_PKT_TYPE 0x3
  360. #define V_PKT_TYPE(x) ((x) << S_PKT_TYPE)
  361. #define G_PKT_TYPE(x) (((x) >> S_PKT_TYPE) & M_PKT_TYPE)
  362. #define S_MAC_MATCH 27
  363. #define M_MAC_MATCH 0x1F
  364. #define V_MAC_MATCH(x) ((x) << S_MAC_MATCH)
  365. #define G_MAC_MATCH(x) (((x) >> S_MAC_MATCH) & M_MAC_MATCH)
  366. /* option 2 fields */
  367. #define S_CPU_INDEX 0
  368. #define M_CPU_INDEX 0x7F
  369. #define V_CPU_INDEX(x) ((x) << S_CPU_INDEX)
  370. #define G_CPU_INDEX(x) (((x) >> S_CPU_INDEX) & M_CPU_INDEX)
  371. #define S_CPU_INDEX_VALID 7
  372. #define V_CPU_INDEX_VALID(x) ((x) << S_CPU_INDEX_VALID)
  373. #define F_CPU_INDEX_VALID V_CPU_INDEX_VALID(1U)
  374. #define S_RX_COALESCE 8
  375. #define M_RX_COALESCE 0x3
  376. #define V_RX_COALESCE(x) ((x) << S_RX_COALESCE)
  377. #define G_RX_COALESCE(x) (((x) >> S_RX_COALESCE) & M_RX_COALESCE)
  378. #define S_RX_COALESCE_VALID 10
  379. #define V_RX_COALESCE_VALID(x) ((x) << S_RX_COALESCE_VALID)
  380. #define F_RX_COALESCE_VALID V_RX_COALESCE_VALID(1U)
  381. #define S_CONG_CONTROL_FLAVOR 11
  382. #define M_CONG_CONTROL_FLAVOR 0x3
  383. #define V_CONG_CONTROL_FLAVOR(x) ((x) << S_CONG_CONTROL_FLAVOR)
  384. #define G_CONG_CONTROL_FLAVOR(x) (((x) >> S_CONG_CONTROL_FLAVOR) & M_CONG_CONTROL_FLAVOR)
  385. #define S_PACING_FLAVOR 13
  386. #define M_PACING_FLAVOR 0x3
  387. #define V_PACING_FLAVOR(x) ((x) << S_PACING_FLAVOR)
  388. #define G_PACING_FLAVOR(x) (((x) >> S_PACING_FLAVOR) & M_PACING_FLAVOR)
  389. #define S_FLAVORS_VALID 15
  390. #define V_FLAVORS_VALID(x) ((x) << S_FLAVORS_VALID)
  391. #define F_FLAVORS_VALID V_FLAVORS_VALID(1U)
  392. #define S_RX_FC_DISABLE 16
  393. #define V_RX_FC_DISABLE(x) ((x) << S_RX_FC_DISABLE)
  394. #define F_RX_FC_DISABLE V_RX_FC_DISABLE(1U)
  395. #define S_RX_FC_VALID 17
  396. #define V_RX_FC_VALID(x) ((x) << S_RX_FC_VALID)
  397. #define F_RX_FC_VALID V_RX_FC_VALID(1U)
  398. struct cpl_pass_open_req {
  399. WR_HDR;
  400. union opcode_tid ot;
  401. __be16 local_port;
  402. __be16 peer_port;
  403. __be32 local_ip;
  404. __be32 peer_ip;
  405. __be32 opt0h;
  406. __be32 opt0l;
  407. __be32 peer_netmask;
  408. __be32 opt1;
  409. };
  410. struct cpl_pass_open_rpl {
  411. RSS_HDR union opcode_tid ot;
  412. __be16 local_port;
  413. __be16 peer_port;
  414. __be32 local_ip;
  415. __be32 peer_ip;
  416. __u8 resvd[7];
  417. __u8 status;
  418. };
  419. struct cpl_pass_establish {
  420. RSS_HDR union opcode_tid ot;
  421. __be16 local_port;
  422. __be16 peer_port;
  423. __be32 local_ip;
  424. __be32 peer_ip;
  425. __be32 tos_tid;
  426. __be16 l2t_idx;
  427. __be16 tcp_opt;
  428. __be32 snd_isn;
  429. __be32 rcv_isn;
  430. };
  431. /* cpl_pass_establish.tos_tid fields */
  432. #define S_PASS_OPEN_TID 0
  433. #define M_PASS_OPEN_TID 0xFFFFFF
  434. #define V_PASS_OPEN_TID(x) ((x) << S_PASS_OPEN_TID)
  435. #define G_PASS_OPEN_TID(x) (((x) >> S_PASS_OPEN_TID) & M_PASS_OPEN_TID)
  436. #define S_PASS_OPEN_TOS 24
  437. #define M_PASS_OPEN_TOS 0xFF
  438. #define V_PASS_OPEN_TOS(x) ((x) << S_PASS_OPEN_TOS)
  439. #define G_PASS_OPEN_TOS(x) (((x) >> S_PASS_OPEN_TOS) & M_PASS_OPEN_TOS)
  440. /* cpl_pass_establish.l2t_idx fields */
  441. #define S_L2T_IDX16 5
  442. #define M_L2T_IDX16 0x7FF
  443. #define V_L2T_IDX16(x) ((x) << S_L2T_IDX16)
  444. #define G_L2T_IDX16(x) (((x) >> S_L2T_IDX16) & M_L2T_IDX16)
  445. /* cpl_pass_establish.tcp_opt fields (also applies act_open_establish) */
  446. #define G_TCPOPT_WSCALE_OK(x) (((x) >> 5) & 1)
  447. #define G_TCPOPT_SACK(x) (((x) >> 6) & 1)
  448. #define G_TCPOPT_TSTAMP(x) (((x) >> 7) & 1)
  449. #define G_TCPOPT_SND_WSCALE(x) (((x) >> 8) & 0xf)
  450. #define G_TCPOPT_MSS(x) (((x) >> 12) & 0xf)
  451. struct cpl_pass_accept_req {
  452. RSS_HDR union opcode_tid ot;
  453. __be16 local_port;
  454. __be16 peer_port;
  455. __be32 local_ip;
  456. __be32 peer_ip;
  457. __be32 tos_tid;
  458. struct tcp_options tcp_options;
  459. __u8 dst_mac[6];
  460. __be16 vlan_tag;
  461. __u8 src_mac[6];
  462. #if defined(__LITTLE_ENDIAN_BITFIELD)
  463. __u8:3;
  464. __u8 addr_idx:3;
  465. __u8 port_idx:1;
  466. __u8 exact_match:1;
  467. #else
  468. __u8 exact_match:1;
  469. __u8 port_idx:1;
  470. __u8 addr_idx:3;
  471. __u8:3;
  472. #endif
  473. __u8 rsvd;
  474. __be32 rcv_isn;
  475. __be32 rsvd2;
  476. };
  477. struct cpl_pass_accept_rpl {
  478. WR_HDR;
  479. union opcode_tid ot;
  480. __be32 opt2;
  481. __be32 rsvd;
  482. __be32 peer_ip;
  483. __be32 opt0h;
  484. __be32 opt0l_status;
  485. };
  486. struct cpl_act_open_req {
  487. WR_HDR;
  488. union opcode_tid ot;
  489. __be16 local_port;
  490. __be16 peer_port;
  491. __be32 local_ip;
  492. __be32 peer_ip;
  493. __be32 opt0h;
  494. __be32 opt0l;
  495. __be32 params;
  496. __be32 opt2;
  497. };
  498. /* cpl_act_open_req.params fields */
  499. #define S_AOPEN_VLAN_PRI 9
  500. #define M_AOPEN_VLAN_PRI 0x3
  501. #define V_AOPEN_VLAN_PRI(x) ((x) << S_AOPEN_VLAN_PRI)
  502. #define G_AOPEN_VLAN_PRI(x) (((x) >> S_AOPEN_VLAN_PRI) & M_AOPEN_VLAN_PRI)
  503. #define S_AOPEN_VLAN_PRI_VALID 11
  504. #define V_AOPEN_VLAN_PRI_VALID(x) ((x) << S_AOPEN_VLAN_PRI_VALID)
  505. #define F_AOPEN_VLAN_PRI_VALID V_AOPEN_VLAN_PRI_VALID(1U)
  506. #define S_AOPEN_PKT_TYPE 12
  507. #define M_AOPEN_PKT_TYPE 0x3
  508. #define V_AOPEN_PKT_TYPE(x) ((x) << S_AOPEN_PKT_TYPE)
  509. #define G_AOPEN_PKT_TYPE(x) (((x) >> S_AOPEN_PKT_TYPE) & M_AOPEN_PKT_TYPE)
  510. #define S_AOPEN_MAC_MATCH 14
  511. #define M_AOPEN_MAC_MATCH 0x1F
  512. #define V_AOPEN_MAC_MATCH(x) ((x) << S_AOPEN_MAC_MATCH)
  513. #define G_AOPEN_MAC_MATCH(x) (((x) >> S_AOPEN_MAC_MATCH) & M_AOPEN_MAC_MATCH)
  514. #define S_AOPEN_MAC_MATCH_VALID 19
  515. #define V_AOPEN_MAC_MATCH_VALID(x) ((x) << S_AOPEN_MAC_MATCH_VALID)
  516. #define F_AOPEN_MAC_MATCH_VALID V_AOPEN_MAC_MATCH_VALID(1U)
  517. #define S_AOPEN_IFF_VLAN 20
  518. #define M_AOPEN_IFF_VLAN 0xFFF
  519. #define V_AOPEN_IFF_VLAN(x) ((x) << S_AOPEN_IFF_VLAN)
  520. #define G_AOPEN_IFF_VLAN(x) (((x) >> S_AOPEN_IFF_VLAN) & M_AOPEN_IFF_VLAN)
  521. struct cpl_act_open_rpl {
  522. RSS_HDR union opcode_tid ot;
  523. __be16 local_port;
  524. __be16 peer_port;
  525. __be32 local_ip;
  526. __be32 peer_ip;
  527. __be32 atid;
  528. __u8 rsvd[3];
  529. __u8 status;
  530. };
  531. struct cpl_act_establish {
  532. RSS_HDR union opcode_tid ot;
  533. __be16 local_port;
  534. __be16 peer_port;
  535. __be32 local_ip;
  536. __be32 peer_ip;
  537. __be32 tos_tid;
  538. __be16 l2t_idx;
  539. __be16 tcp_opt;
  540. __be32 snd_isn;
  541. __be32 rcv_isn;
  542. };
  543. struct cpl_get_tcb {
  544. WR_HDR;
  545. union opcode_tid ot;
  546. __be16 cpuno;
  547. __be16 rsvd;
  548. };
  549. struct cpl_get_tcb_rpl {
  550. RSS_HDR union opcode_tid ot;
  551. __u8 rsvd;
  552. __u8 status;
  553. __be16 len;
  554. };
  555. struct cpl_set_tcb {
  556. WR_HDR;
  557. union opcode_tid ot;
  558. __u8 reply;
  559. __u8 cpu_idx;
  560. __be16 len;
  561. };
  562. /* cpl_set_tcb.reply fields */
  563. #define S_NO_REPLY 7
  564. #define V_NO_REPLY(x) ((x) << S_NO_REPLY)
  565. #define F_NO_REPLY V_NO_REPLY(1U)
  566. struct cpl_set_tcb_field {
  567. WR_HDR;
  568. union opcode_tid ot;
  569. __u8 reply;
  570. __u8 cpu_idx;
  571. __be16 word;
  572. __be64 mask;
  573. __be64 val;
  574. };
  575. struct cpl_set_tcb_rpl {
  576. RSS_HDR union opcode_tid ot;
  577. __u8 rsvd[3];
  578. __u8 status;
  579. };
  580. struct cpl_pcmd {
  581. WR_HDR;
  582. union opcode_tid ot;
  583. __u8 rsvd[3];
  584. #if defined(__LITTLE_ENDIAN_BITFIELD)
  585. __u8 src:1;
  586. __u8 bundle:1;
  587. __u8 channel:1;
  588. __u8:5;
  589. #else
  590. __u8:5;
  591. __u8 channel:1;
  592. __u8 bundle:1;
  593. __u8 src:1;
  594. #endif
  595. __be32 pcmd_parm[2];
  596. };
  597. struct cpl_pcmd_reply {
  598. RSS_HDR union opcode_tid ot;
  599. __u8 status;
  600. __u8 rsvd;
  601. __be16 len;
  602. };
  603. struct cpl_close_con_req {
  604. WR_HDR;
  605. union opcode_tid ot;
  606. __be32 rsvd;
  607. };
  608. struct cpl_close_con_rpl {
  609. RSS_HDR union opcode_tid ot;
  610. __u8 rsvd[3];
  611. __u8 status;
  612. __be32 snd_nxt;
  613. __be32 rcv_nxt;
  614. };
  615. struct cpl_close_listserv_req {
  616. WR_HDR;
  617. union opcode_tid ot;
  618. __u8 rsvd0;
  619. __u8 cpu_idx;
  620. __be16 rsvd1;
  621. };
  622. struct cpl_close_listserv_rpl {
  623. RSS_HDR union opcode_tid ot;
  624. __u8 rsvd[3];
  625. __u8 status;
  626. };
  627. struct cpl_abort_req_rss {
  628. RSS_HDR union opcode_tid ot;
  629. __be32 rsvd0;
  630. __u8 rsvd1;
  631. __u8 status;
  632. __u8 rsvd2[6];
  633. };
  634. struct cpl_abort_req {
  635. WR_HDR;
  636. union opcode_tid ot;
  637. __be32 rsvd0;
  638. __u8 rsvd1;
  639. __u8 cmd;
  640. __u8 rsvd2[6];
  641. };
  642. struct cpl_abort_rpl_rss {
  643. RSS_HDR union opcode_tid ot;
  644. __be32 rsvd0;
  645. __u8 rsvd1;
  646. __u8 status;
  647. __u8 rsvd2[6];
  648. };
  649. struct cpl_abort_rpl {
  650. WR_HDR;
  651. union opcode_tid ot;
  652. __be32 rsvd0;
  653. __u8 rsvd1;
  654. __u8 cmd;
  655. __u8 rsvd2[6];
  656. };
  657. struct cpl_peer_close {
  658. RSS_HDR union opcode_tid ot;
  659. __be32 rcv_nxt;
  660. };
  661. struct tx_data_wr {
  662. __be32 wr_hi;
  663. __be32 wr_lo;
  664. __be32 len;
  665. __be32 flags;
  666. __be32 sndseq;
  667. __be32 param;
  668. };
  669. /* tx_data_wr.flags fields */
  670. #define S_TX_ACK_PAGES 21
  671. #define M_TX_ACK_PAGES 0x7
  672. #define V_TX_ACK_PAGES(x) ((x) << S_TX_ACK_PAGES)
  673. #define G_TX_ACK_PAGES(x) (((x) >> S_TX_ACK_PAGES) & M_TX_ACK_PAGES)
  674. /* tx_data_wr.param fields */
  675. #define S_TX_PORT 0
  676. #define M_TX_PORT 0x7
  677. #define V_TX_PORT(x) ((x) << S_TX_PORT)
  678. #define G_TX_PORT(x) (((x) >> S_TX_PORT) & M_TX_PORT)
  679. #define S_TX_MSS 4
  680. #define M_TX_MSS 0xF
  681. #define V_TX_MSS(x) ((x) << S_TX_MSS)
  682. #define G_TX_MSS(x) (((x) >> S_TX_MSS) & M_TX_MSS)
  683. #define S_TX_QOS 8
  684. #define M_TX_QOS 0xFF
  685. #define V_TX_QOS(x) ((x) << S_TX_QOS)
  686. #define G_TX_QOS(x) (((x) >> S_TX_QOS) & M_TX_QOS)
  687. #define S_TX_SNDBUF 16
  688. #define M_TX_SNDBUF 0xFFFF
  689. #define V_TX_SNDBUF(x) ((x) << S_TX_SNDBUF)
  690. #define G_TX_SNDBUF(x) (((x) >> S_TX_SNDBUF) & M_TX_SNDBUF)
  691. struct cpl_tx_data {
  692. union opcode_tid ot;
  693. __be32 len;
  694. __be32 rsvd;
  695. __be16 urg;
  696. __be16 flags;
  697. };
  698. /* cpl_tx_data.flags fields */
  699. #define S_TX_ULP_SUBMODE 6
  700. #define M_TX_ULP_SUBMODE 0xF
  701. #define V_TX_ULP_SUBMODE(x) ((x) << S_TX_ULP_SUBMODE)
  702. #define G_TX_ULP_SUBMODE(x) (((x) >> S_TX_ULP_SUBMODE) & M_TX_ULP_SUBMODE)
  703. #define S_TX_ULP_MODE 10
  704. #define M_TX_ULP_MODE 0xF
  705. #define V_TX_ULP_MODE(x) ((x) << S_TX_ULP_MODE)
  706. #define G_TX_ULP_MODE(x) (((x) >> S_TX_ULP_MODE) & M_TX_ULP_MODE)
  707. #define S_TX_SHOVE 14
  708. #define V_TX_SHOVE(x) ((x) << S_TX_SHOVE)
  709. #define F_TX_SHOVE V_TX_SHOVE(1U)
  710. #define S_TX_MORE 15
  711. #define V_TX_MORE(x) ((x) << S_TX_MORE)
  712. #define F_TX_MORE V_TX_MORE(1U)
  713. /* additional tx_data_wr.flags fields */
  714. #define S_TX_CPU_IDX 0
  715. #define M_TX_CPU_IDX 0x3F
  716. #define V_TX_CPU_IDX(x) ((x) << S_TX_CPU_IDX)
  717. #define G_TX_CPU_IDX(x) (((x) >> S_TX_CPU_IDX) & M_TX_CPU_IDX)
  718. #define S_TX_URG 16
  719. #define V_TX_URG(x) ((x) << S_TX_URG)
  720. #define F_TX_URG V_TX_URG(1U)
  721. #define S_TX_CLOSE 17
  722. #define V_TX_CLOSE(x) ((x) << S_TX_CLOSE)
  723. #define F_TX_CLOSE V_TX_CLOSE(1U)
  724. #define S_TX_INIT 18
  725. #define V_TX_INIT(x) ((x) << S_TX_INIT)
  726. #define F_TX_INIT V_TX_INIT(1U)
  727. #define S_TX_IMM_ACK 19
  728. #define V_TX_IMM_ACK(x) ((x) << S_TX_IMM_ACK)
  729. #define F_TX_IMM_ACK V_TX_IMM_ACK(1U)
  730. #define S_TX_IMM_DMA 20
  731. #define V_TX_IMM_DMA(x) ((x) << S_TX_IMM_DMA)
  732. #define F_TX_IMM_DMA V_TX_IMM_DMA(1U)
  733. struct cpl_tx_data_ack {
  734. RSS_HDR union opcode_tid ot;
  735. __be32 ack_seq;
  736. };
  737. struct cpl_wr_ack {
  738. RSS_HDR union opcode_tid ot;
  739. __be16 credits;
  740. __be16 rsvd;
  741. __be32 snd_nxt;
  742. __be32 snd_una;
  743. };
  744. struct cpl_rdma_ec_status {
  745. RSS_HDR union opcode_tid ot;
  746. __u8 rsvd[3];
  747. __u8 status;
  748. };
  749. struct mngt_pktsched_wr {
  750. __be32 wr_hi;
  751. __be32 wr_lo;
  752. __u8 mngt_opcode;
  753. __u8 rsvd[7];
  754. __u8 sched;
  755. __u8 idx;
  756. __u8 min;
  757. __u8 max;
  758. __u8 binding;
  759. __u8 rsvd1[3];
  760. };
  761. struct cpl_iscsi_hdr {
  762. RSS_HDR union opcode_tid ot;
  763. __be16 pdu_len_ddp;
  764. __be16 len;
  765. __be32 seq;
  766. __be16 urg;
  767. __u8 rsvd;
  768. __u8 status;
  769. };
  770. /* cpl_iscsi_hdr.pdu_len_ddp fields */
  771. #define S_ISCSI_PDU_LEN 0
  772. #define M_ISCSI_PDU_LEN 0x7FFF
  773. #define V_ISCSI_PDU_LEN(x) ((x) << S_ISCSI_PDU_LEN)
  774. #define G_ISCSI_PDU_LEN(x) (((x) >> S_ISCSI_PDU_LEN) & M_ISCSI_PDU_LEN)
  775. #define S_ISCSI_DDP 15
  776. #define V_ISCSI_DDP(x) ((x) << S_ISCSI_DDP)
  777. #define F_ISCSI_DDP V_ISCSI_DDP(1U)
  778. struct cpl_rx_data {
  779. RSS_HDR union opcode_tid ot;
  780. __be16 rsvd;
  781. __be16 len;
  782. __be32 seq;
  783. __be16 urg;
  784. #if defined(__LITTLE_ENDIAN_BITFIELD)
  785. __u8 dack_mode:2;
  786. __u8 psh:1;
  787. __u8 heartbeat:1;
  788. __u8:4;
  789. #else
  790. __u8:4;
  791. __u8 heartbeat:1;
  792. __u8 psh:1;
  793. __u8 dack_mode:2;
  794. #endif
  795. __u8 status;
  796. };
  797. struct cpl_rx_data_ack {
  798. WR_HDR;
  799. union opcode_tid ot;
  800. __be32 credit_dack;
  801. };
  802. /* cpl_rx_data_ack.ack_seq fields */
  803. #define S_RX_CREDITS 0
  804. #define M_RX_CREDITS 0x7FFFFFF
  805. #define V_RX_CREDITS(x) ((x) << S_RX_CREDITS)
  806. #define G_RX_CREDITS(x) (((x) >> S_RX_CREDITS) & M_RX_CREDITS)
  807. #define S_RX_MODULATE 27
  808. #define V_RX_MODULATE(x) ((x) << S_RX_MODULATE)
  809. #define F_RX_MODULATE V_RX_MODULATE(1U)
  810. #define S_RX_FORCE_ACK 28
  811. #define V_RX_FORCE_ACK(x) ((x) << S_RX_FORCE_ACK)
  812. #define F_RX_FORCE_ACK V_RX_FORCE_ACK(1U)
  813. #define S_RX_DACK_MODE 29
  814. #define M_RX_DACK_MODE 0x3
  815. #define V_RX_DACK_MODE(x) ((x) << S_RX_DACK_MODE)
  816. #define G_RX_DACK_MODE(x) (((x) >> S_RX_DACK_MODE) & M_RX_DACK_MODE)
  817. #define S_RX_DACK_CHANGE 31
  818. #define V_RX_DACK_CHANGE(x) ((x) << S_RX_DACK_CHANGE)
  819. #define F_RX_DACK_CHANGE V_RX_DACK_CHANGE(1U)
  820. struct cpl_rx_urg_notify {
  821. RSS_HDR union opcode_tid ot;
  822. __be32 seq;
  823. };
  824. struct cpl_rx_ddp_complete {
  825. RSS_HDR union opcode_tid ot;
  826. __be32 ddp_report;
  827. };
  828. struct cpl_rx_data_ddp {
  829. RSS_HDR union opcode_tid ot;
  830. __be16 urg;
  831. __be16 len;
  832. __be32 seq;
  833. union {
  834. __be32 nxt_seq;
  835. __be32 ddp_report;
  836. };
  837. __be32 ulp_crc;
  838. __be32 ddpvld_status;
  839. };
  840. /* cpl_rx_data_ddp.ddpvld_status fields */
  841. #define S_DDP_STATUS 0
  842. #define M_DDP_STATUS 0xFF
  843. #define V_DDP_STATUS(x) ((x) << S_DDP_STATUS)
  844. #define G_DDP_STATUS(x) (((x) >> S_DDP_STATUS) & M_DDP_STATUS)
  845. #define S_DDP_VALID 15
  846. #define M_DDP_VALID 0x1FFFF
  847. #define V_DDP_VALID(x) ((x) << S_DDP_VALID)
  848. #define G_DDP_VALID(x) (((x) >> S_DDP_VALID) & M_DDP_VALID)
  849. #define S_DDP_PPOD_MISMATCH 15
  850. #define V_DDP_PPOD_MISMATCH(x) ((x) << S_DDP_PPOD_MISMATCH)
  851. #define F_DDP_PPOD_MISMATCH V_DDP_PPOD_MISMATCH(1U)
  852. #define S_DDP_PDU 16
  853. #define V_DDP_PDU(x) ((x) << S_DDP_PDU)
  854. #define F_DDP_PDU V_DDP_PDU(1U)
  855. #define S_DDP_LLIMIT_ERR 17
  856. #define V_DDP_LLIMIT_ERR(x) ((x) << S_DDP_LLIMIT_ERR)
  857. #define F_DDP_LLIMIT_ERR V_DDP_LLIMIT_ERR(1U)
  858. #define S_DDP_PPOD_PARITY_ERR 18
  859. #define V_DDP_PPOD_PARITY_ERR(x) ((x) << S_DDP_PPOD_PARITY_ERR)
  860. #define F_DDP_PPOD_PARITY_ERR V_DDP_PPOD_PARITY_ERR(1U)
  861. #define S_DDP_PADDING_ERR 19
  862. #define V_DDP_PADDING_ERR(x) ((x) << S_DDP_PADDING_ERR)
  863. #define F_DDP_PADDING_ERR V_DDP_PADDING_ERR(1U)
  864. #define S_DDP_HDRCRC_ERR 20
  865. #define V_DDP_HDRCRC_ERR(x) ((x) << S_DDP_HDRCRC_ERR)
  866. #define F_DDP_HDRCRC_ERR V_DDP_HDRCRC_ERR(1U)
  867. #define S_DDP_DATACRC_ERR 21
  868. #define V_DDP_DATACRC_ERR(x) ((x) << S_DDP_DATACRC_ERR)
  869. #define F_DDP_DATACRC_ERR V_DDP_DATACRC_ERR(1U)
  870. #define S_DDP_INVALID_TAG 22
  871. #define V_DDP_INVALID_TAG(x) ((x) << S_DDP_INVALID_TAG)
  872. #define F_DDP_INVALID_TAG V_DDP_INVALID_TAG(1U)
  873. #define S_DDP_ULIMIT_ERR 23
  874. #define V_DDP_ULIMIT_ERR(x) ((x) << S_DDP_ULIMIT_ERR)
  875. #define F_DDP_ULIMIT_ERR V_DDP_ULIMIT_ERR(1U)
  876. #define S_DDP_OFFSET_ERR 24
  877. #define V_DDP_OFFSET_ERR(x) ((x) << S_DDP_OFFSET_ERR)
  878. #define F_DDP_OFFSET_ERR V_DDP_OFFSET_ERR(1U)
  879. #define S_DDP_COLOR_ERR 25
  880. #define V_DDP_COLOR_ERR(x) ((x) << S_DDP_COLOR_ERR)
  881. #define F_DDP_COLOR_ERR V_DDP_COLOR_ERR(1U)
  882. #define S_DDP_TID_MISMATCH 26
  883. #define V_DDP_TID_MISMATCH(x) ((x) << S_DDP_TID_MISMATCH)
  884. #define F_DDP_TID_MISMATCH V_DDP_TID_MISMATCH(1U)
  885. #define S_DDP_INVALID_PPOD 27
  886. #define V_DDP_INVALID_PPOD(x) ((x) << S_DDP_INVALID_PPOD)
  887. #define F_DDP_INVALID_PPOD V_DDP_INVALID_PPOD(1U)
  888. #define S_DDP_ULP_MODE 28
  889. #define M_DDP_ULP_MODE 0xF
  890. #define V_DDP_ULP_MODE(x) ((x) << S_DDP_ULP_MODE)
  891. #define G_DDP_ULP_MODE(x) (((x) >> S_DDP_ULP_MODE) & M_DDP_ULP_MODE)
  892. /* cpl_rx_data_ddp.ddp_report fields */
  893. #define S_DDP_OFFSET 0
  894. #define M_DDP_OFFSET 0x3FFFFF
  895. #define V_DDP_OFFSET(x) ((x) << S_DDP_OFFSET)
  896. #define G_DDP_OFFSET(x) (((x) >> S_DDP_OFFSET) & M_DDP_OFFSET)
  897. #define S_DDP_URG 24
  898. #define V_DDP_URG(x) ((x) << S_DDP_URG)
  899. #define F_DDP_URG V_DDP_URG(1U)
  900. #define S_DDP_PSH 25
  901. #define V_DDP_PSH(x) ((x) << S_DDP_PSH)
  902. #define F_DDP_PSH V_DDP_PSH(1U)
  903. #define S_DDP_BUF_COMPLETE 26
  904. #define V_DDP_BUF_COMPLETE(x) ((x) << S_DDP_BUF_COMPLETE)
  905. #define F_DDP_BUF_COMPLETE V_DDP_BUF_COMPLETE(1U)
  906. #define S_DDP_BUF_TIMED_OUT 27
  907. #define V_DDP_BUF_TIMED_OUT(x) ((x) << S_DDP_BUF_TIMED_OUT)
  908. #define F_DDP_BUF_TIMED_OUT V_DDP_BUF_TIMED_OUT(1U)
  909. #define S_DDP_BUF_IDX 28
  910. #define V_DDP_BUF_IDX(x) ((x) << S_DDP_BUF_IDX)
  911. #define F_DDP_BUF_IDX V_DDP_BUF_IDX(1U)
  912. struct cpl_tx_pkt {
  913. WR_HDR;
  914. __be32 cntrl;
  915. __be32 len;
  916. };
  917. struct cpl_tx_pkt_lso {
  918. WR_HDR;
  919. __be32 cntrl;
  920. __be32 len;
  921. __be32 rsvd;
  922. __be32 lso_info;
  923. };
  924. /* cpl_tx_pkt*.cntrl fields */
  925. #define S_TXPKT_VLAN 0
  926. #define M_TXPKT_VLAN 0xFFFF
  927. #define V_TXPKT_VLAN(x) ((x) << S_TXPKT_VLAN)
  928. #define G_TXPKT_VLAN(x) (((x) >> S_TXPKT_VLAN) & M_TXPKT_VLAN)
  929. #define S_TXPKT_INTF 16
  930. #define M_TXPKT_INTF 0xF
  931. #define V_TXPKT_INTF(x) ((x) << S_TXPKT_INTF)
  932. #define G_TXPKT_INTF(x) (((x) >> S_TXPKT_INTF) & M_TXPKT_INTF)
  933. #define S_TXPKT_IPCSUM_DIS 20
  934. #define V_TXPKT_IPCSUM_DIS(x) ((x) << S_TXPKT_IPCSUM_DIS)
  935. #define F_TXPKT_IPCSUM_DIS V_TXPKT_IPCSUM_DIS(1U)
  936. #define S_TXPKT_L4CSUM_DIS 21
  937. #define V_TXPKT_L4CSUM_DIS(x) ((x) << S_TXPKT_L4CSUM_DIS)
  938. #define F_TXPKT_L4CSUM_DIS V_TXPKT_L4CSUM_DIS(1U)
  939. #define S_TXPKT_VLAN_VLD 22
  940. #define V_TXPKT_VLAN_VLD(x) ((x) << S_TXPKT_VLAN_VLD)
  941. #define F_TXPKT_VLAN_VLD V_TXPKT_VLAN_VLD(1U)
  942. #define S_TXPKT_LOOPBACK 23
  943. #define V_TXPKT_LOOPBACK(x) ((x) << S_TXPKT_LOOPBACK)
  944. #define F_TXPKT_LOOPBACK V_TXPKT_LOOPBACK(1U)
  945. #define S_TXPKT_OPCODE 24
  946. #define M_TXPKT_OPCODE 0xFF
  947. #define V_TXPKT_OPCODE(x) ((x) << S_TXPKT_OPCODE)
  948. #define G_TXPKT_OPCODE(x) (((x) >> S_TXPKT_OPCODE) & M_TXPKT_OPCODE)
  949. /* cpl_tx_pkt_lso.lso_info fields */
  950. #define S_LSO_MSS 0
  951. #define M_LSO_MSS 0x3FFF
  952. #define V_LSO_MSS(x) ((x) << S_LSO_MSS)
  953. #define G_LSO_MSS(x) (((x) >> S_LSO_MSS) & M_LSO_MSS)
  954. #define S_LSO_ETH_TYPE 14
  955. #define M_LSO_ETH_TYPE 0x3
  956. #define V_LSO_ETH_TYPE(x) ((x) << S_LSO_ETH_TYPE)
  957. #define G_LSO_ETH_TYPE(x) (((x) >> S_LSO_ETH_TYPE) & M_LSO_ETH_TYPE)
  958. #define S_LSO_TCPHDR_WORDS 16
  959. #define M_LSO_TCPHDR_WORDS 0xF
  960. #define V_LSO_TCPHDR_WORDS(x) ((x) << S_LSO_TCPHDR_WORDS)
  961. #define G_LSO_TCPHDR_WORDS(x) (((x) >> S_LSO_TCPHDR_WORDS) & M_LSO_TCPHDR_WORDS)
  962. #define S_LSO_IPHDR_WORDS 20
  963. #define M_LSO_IPHDR_WORDS 0xF
  964. #define V_LSO_IPHDR_WORDS(x) ((x) << S_LSO_IPHDR_WORDS)
  965. #define G_LSO_IPHDR_WORDS(x) (((x) >> S_LSO_IPHDR_WORDS) & M_LSO_IPHDR_WORDS)
  966. #define S_LSO_IPV6 24
  967. #define V_LSO_IPV6(x) ((x) << S_LSO_IPV6)
  968. #define F_LSO_IPV6 V_LSO_IPV6(1U)
  969. struct cpl_trace_pkt {
  970. #ifdef CHELSIO_FW
  971. __u8 rss_opcode;
  972. #if defined(__LITTLE_ENDIAN_BITFIELD)
  973. __u8 err:1;
  974. __u8:7;
  975. #else
  976. __u8:7;
  977. __u8 err:1;
  978. #endif
  979. __u8 rsvd0;
  980. #if defined(__LITTLE_ENDIAN_BITFIELD)
  981. __u8 qid:4;
  982. __u8:4;
  983. #else
  984. __u8:4;
  985. __u8 qid:4;
  986. #endif
  987. __be32 tstamp;
  988. #endif /* CHELSIO_FW */
  989. __u8 opcode;
  990. #if defined(__LITTLE_ENDIAN_BITFIELD)
  991. __u8 iff:4;
  992. __u8:4;
  993. #else
  994. __u8:4;
  995. __u8 iff:4;
  996. #endif
  997. __u8 rsvd[4];
  998. __be16 len;
  999. };
  1000. struct cpl_rx_pkt {
  1001. RSS_HDR __u8 opcode;
  1002. #if defined(__LITTLE_ENDIAN_BITFIELD)
  1003. __u8 iff:4;
  1004. __u8 csum_valid:1;
  1005. __u8 ipmi_pkt:1;
  1006. __u8 vlan_valid:1;
  1007. __u8 fragment:1;
  1008. #else
  1009. __u8 fragment:1;
  1010. __u8 vlan_valid:1;
  1011. __u8 ipmi_pkt:1;
  1012. __u8 csum_valid:1;
  1013. __u8 iff:4;
  1014. #endif
  1015. __be16 csum;
  1016. __be16 vlan;
  1017. __be16 len;
  1018. };
  1019. struct cpl_l2t_write_req {
  1020. WR_HDR;
  1021. union opcode_tid ot;
  1022. __be32 params;
  1023. __u8 rsvd[2];
  1024. __u8 dst_mac[6];
  1025. };
  1026. /* cpl_l2t_write_req.params fields */
  1027. #define S_L2T_W_IDX 0
  1028. #define M_L2T_W_IDX 0x7FF
  1029. #define V_L2T_W_IDX(x) ((x) << S_L2T_W_IDX)
  1030. #define G_L2T_W_IDX(x) (((x) >> S_L2T_W_IDX) & M_L2T_W_IDX)
  1031. #define S_L2T_W_VLAN 11
  1032. #define M_L2T_W_VLAN 0xFFF
  1033. #define V_L2T_W_VLAN(x) ((x) << S_L2T_W_VLAN)
  1034. #define G_L2T_W_VLAN(x) (((x) >> S_L2T_W_VLAN) & M_L2T_W_VLAN)
  1035. #define S_L2T_W_IFF 23
  1036. #define M_L2T_W_IFF 0xF
  1037. #define V_L2T_W_IFF(x) ((x) << S_L2T_W_IFF)
  1038. #define G_L2T_W_IFF(x) (((x) >> S_L2T_W_IFF) & M_L2T_W_IFF)
  1039. #define S_L2T_W_PRIO 27
  1040. #define M_L2T_W_PRIO 0x7
  1041. #define V_L2T_W_PRIO(x) ((x) << S_L2T_W_PRIO)
  1042. #define G_L2T_W_PRIO(x) (((x) >> S_L2T_W_PRIO) & M_L2T_W_PRIO)
  1043. struct cpl_l2t_write_rpl {
  1044. RSS_HDR union opcode_tid ot;
  1045. __u8 status;
  1046. __u8 rsvd[3];
  1047. };
  1048. struct cpl_l2t_read_req {
  1049. WR_HDR;
  1050. union opcode_tid ot;
  1051. __be16 rsvd;
  1052. __be16 l2t_idx;
  1053. };
  1054. struct cpl_l2t_read_rpl {
  1055. RSS_HDR union opcode_tid ot;
  1056. __be32 params;
  1057. __u8 rsvd[2];
  1058. __u8 dst_mac[6];
  1059. };
  1060. /* cpl_l2t_read_rpl.params fields */
  1061. #define S_L2T_R_PRIO 0
  1062. #define M_L2T_R_PRIO 0x7
  1063. #define V_L2T_R_PRIO(x) ((x) << S_L2T_R_PRIO)
  1064. #define G_L2T_R_PRIO(x) (((x) >> S_L2T_R_PRIO) & M_L2T_R_PRIO)
  1065. #define S_L2T_R_VLAN 8
  1066. #define M_L2T_R_VLAN 0xFFF
  1067. #define V_L2T_R_VLAN(x) ((x) << S_L2T_R_VLAN)
  1068. #define G_L2T_R_VLAN(x) (((x) >> S_L2T_R_VLAN) & M_L2T_R_VLAN)
  1069. #define S_L2T_R_IFF 20
  1070. #define M_L2T_R_IFF 0xF
  1071. #define V_L2T_R_IFF(x) ((x) << S_L2T_R_IFF)
  1072. #define G_L2T_R_IFF(x) (((x) >> S_L2T_R_IFF) & M_L2T_R_IFF)
  1073. #define S_L2T_STATUS 24
  1074. #define M_L2T_STATUS 0xFF
  1075. #define V_L2T_STATUS(x) ((x) << S_L2T_STATUS)
  1076. #define G_L2T_STATUS(x) (((x) >> S_L2T_STATUS) & M_L2T_STATUS)
  1077. struct cpl_smt_write_req {
  1078. WR_HDR;
  1079. union opcode_tid ot;
  1080. __u8 rsvd0;
  1081. #if defined(__LITTLE_ENDIAN_BITFIELD)
  1082. __u8 mtu_idx:4;
  1083. __u8 iff:4;
  1084. #else
  1085. __u8 iff:4;
  1086. __u8 mtu_idx:4;
  1087. #endif
  1088. __be16 rsvd2;
  1089. __be16 rsvd3;
  1090. __u8 src_mac1[6];
  1091. __be16 rsvd4;
  1092. __u8 src_mac0[6];
  1093. };
  1094. struct cpl_smt_write_rpl {
  1095. RSS_HDR union opcode_tid ot;
  1096. __u8 status;
  1097. __u8 rsvd[3];
  1098. };
  1099. struct cpl_smt_read_req {
  1100. WR_HDR;
  1101. union opcode_tid ot;
  1102. __u8 rsvd0;
  1103. #if defined(__LITTLE_ENDIAN_BITFIELD)
  1104. __u8:4;
  1105. __u8 iff:4;
  1106. #else
  1107. __u8 iff:4;
  1108. __u8:4;
  1109. #endif
  1110. __be16 rsvd2;
  1111. };
  1112. struct cpl_smt_read_rpl {
  1113. RSS_HDR union opcode_tid ot;
  1114. __u8 status;
  1115. #if defined(__LITTLE_ENDIAN_BITFIELD)
  1116. __u8 mtu_idx:4;
  1117. __u8:4;
  1118. #else
  1119. __u8:4;
  1120. __u8 mtu_idx:4;
  1121. #endif
  1122. __be16 rsvd2;
  1123. __be16 rsvd3;
  1124. __u8 src_mac1[6];
  1125. __be16 rsvd4;
  1126. __u8 src_mac0[6];
  1127. };
  1128. struct cpl_rte_delete_req {
  1129. WR_HDR;
  1130. union opcode_tid ot;
  1131. __be32 params;
  1132. };
  1133. /* { cpl_rte_delete_req, cpl_rte_read_req }.params fields */
  1134. #define S_RTE_REQ_LUT_IX 8
  1135. #define M_RTE_REQ_LUT_IX 0x7FF
  1136. #define V_RTE_REQ_LUT_IX(x) ((x) << S_RTE_REQ_LUT_IX)
  1137. #define G_RTE_REQ_LUT_IX(x) (((x) >> S_RTE_REQ_LUT_IX) & M_RTE_REQ_LUT_IX)
  1138. #define S_RTE_REQ_LUT_BASE 19
  1139. #define M_RTE_REQ_LUT_BASE 0x7FF
  1140. #define V_RTE_REQ_LUT_BASE(x) ((x) << S_RTE_REQ_LUT_BASE)
  1141. #define G_RTE_REQ_LUT_BASE(x) (((x) >> S_RTE_REQ_LUT_BASE) & M_RTE_REQ_LUT_BASE)
  1142. #define S_RTE_READ_REQ_SELECT 31
  1143. #define V_RTE_READ_REQ_SELECT(x) ((x) << S_RTE_READ_REQ_SELECT)
  1144. #define F_RTE_READ_REQ_SELECT V_RTE_READ_REQ_SELECT(1U)
  1145. struct cpl_rte_delete_rpl {
  1146. RSS_HDR union opcode_tid ot;
  1147. __u8 status;
  1148. __u8 rsvd[3];
  1149. };
  1150. struct cpl_rte_write_req {
  1151. WR_HDR;
  1152. union opcode_tid ot;
  1153. #if defined(__LITTLE_ENDIAN_BITFIELD)
  1154. __u8:6;
  1155. __u8 write_tcam:1;
  1156. __u8 write_l2t_lut:1;
  1157. #else
  1158. __u8 write_l2t_lut:1;
  1159. __u8 write_tcam:1;
  1160. __u8:6;
  1161. #endif
  1162. __u8 rsvd[3];
  1163. __be32 lut_params;
  1164. __be16 rsvd2;
  1165. __be16 l2t_idx;
  1166. __be32 netmask;
  1167. __be32 faddr;
  1168. };
  1169. /* cpl_rte_write_req.lut_params fields */
  1170. #define S_RTE_WRITE_REQ_LUT_IX 10
  1171. #define M_RTE_WRITE_REQ_LUT_IX 0x7FF
  1172. #define V_RTE_WRITE_REQ_LUT_IX(x) ((x) << S_RTE_WRITE_REQ_LUT_IX)
  1173. #define G_RTE_WRITE_REQ_LUT_IX(x) (((x) >> S_RTE_WRITE_REQ_LUT_IX) & M_RTE_WRITE_REQ_LUT_IX)
  1174. #define S_RTE_WRITE_REQ_LUT_BASE 21
  1175. #define M_RTE_WRITE_REQ_LUT_BASE 0x7FF
  1176. #define V_RTE_WRITE_REQ_LUT_BASE(x) ((x) << S_RTE_WRITE_REQ_LUT_BASE)
  1177. #define G_RTE_WRITE_REQ_LUT_BASE(x) (((x) >> S_RTE_WRITE_REQ_LUT_BASE) & M_RTE_WRITE_REQ_LUT_BASE)
  1178. struct cpl_rte_write_rpl {
  1179. RSS_HDR union opcode_tid ot;
  1180. __u8 status;
  1181. __u8 rsvd[3];
  1182. };
  1183. struct cpl_rte_read_req {
  1184. WR_HDR;
  1185. union opcode_tid ot;
  1186. __be32 params;
  1187. };
  1188. struct cpl_rte_read_rpl {
  1189. RSS_HDR union opcode_tid ot;
  1190. __u8 status;
  1191. __u8 rsvd0;
  1192. __be16 l2t_idx;
  1193. #if defined(__LITTLE_ENDIAN_BITFIELD)
  1194. __u8:7;
  1195. __u8 select:1;
  1196. #else
  1197. __u8 select:1;
  1198. __u8:7;
  1199. #endif
  1200. __u8 rsvd2[3];
  1201. __be32 addr;
  1202. };
  1203. struct cpl_tid_release {
  1204. WR_HDR;
  1205. union opcode_tid ot;
  1206. __be32 rsvd;
  1207. };
  1208. struct cpl_barrier {
  1209. WR_HDR;
  1210. __u8 opcode;
  1211. __u8 rsvd[7];
  1212. };
  1213. struct cpl_rdma_read_req {
  1214. __u8 opcode;
  1215. __u8 rsvd[15];
  1216. };
  1217. struct cpl_rdma_terminate {
  1218. #ifdef CHELSIO_FW
  1219. __u8 opcode;
  1220. __u8 rsvd[2];
  1221. #if defined(__LITTLE_ENDIAN_BITFIELD)
  1222. __u8 rspq:3;
  1223. __u8:5;
  1224. #else
  1225. __u8:5;
  1226. __u8 rspq:3;
  1227. #endif
  1228. __be32 tid_len;
  1229. #endif
  1230. __be32 msn;
  1231. __be32 mo;
  1232. __u8 data[0];
  1233. };
  1234. /* cpl_rdma_terminate.tid_len fields */
  1235. #define S_FLIT_CNT 0
  1236. #define M_FLIT_CNT 0xFF
  1237. #define V_FLIT_CNT(x) ((x) << S_FLIT_CNT)
  1238. #define G_FLIT_CNT(x) (((x) >> S_FLIT_CNT) & M_FLIT_CNT)
  1239. #define S_TERM_TID 8
  1240. #define M_TERM_TID 0xFFFFF
  1241. #define V_TERM_TID(x) ((x) << S_TERM_TID)
  1242. #define G_TERM_TID(x) (((x) >> S_TERM_TID) & M_TERM_TID)
  1243. /* ULP_TX opcodes */
  1244. enum { ULP_MEM_READ = 2, ULP_MEM_WRITE = 3, ULP_TXPKT = 4 };
  1245. #define S_ULPTX_CMD 28
  1246. #define M_ULPTX_CMD 0xF
  1247. #define V_ULPTX_CMD(x) ((x) << S_ULPTX_CMD)
  1248. #define S_ULPTX_NFLITS 0
  1249. #define M_ULPTX_NFLITS 0xFF
  1250. #define V_ULPTX_NFLITS(x) ((x) << S_ULPTX_NFLITS)
  1251. struct ulp_mem_io {
  1252. WR_HDR;
  1253. __be32 cmd_lock_addr;
  1254. __be32 len;
  1255. };
  1256. /* ulp_mem_io.cmd_lock_addr fields */
  1257. #define S_ULP_MEMIO_ADDR 0
  1258. #define M_ULP_MEMIO_ADDR 0x7FFFFFF
  1259. #define V_ULP_MEMIO_ADDR(x) ((x) << S_ULP_MEMIO_ADDR)
  1260. #define S_ULP_MEMIO_LOCK 27
  1261. #define V_ULP_MEMIO_LOCK(x) ((x) << S_ULP_MEMIO_LOCK)
  1262. #define F_ULP_MEMIO_LOCK V_ULP_MEMIO_LOCK(1U)
  1263. /* ulp_mem_io.len fields */
  1264. #define S_ULP_MEMIO_DATA_LEN 28
  1265. #define M_ULP_MEMIO_DATA_LEN 0xF
  1266. #define V_ULP_MEMIO_DATA_LEN(x) ((x) << S_ULP_MEMIO_DATA_LEN)
  1267. #endif /* T3_CPL_H */