aboutsummaryrefslogtreecommitdiffstats
path: root/drivers/infiniband/hw/cxgb3/cxio_wr.h
diff options
context:
space:
mode:
authorSteve Wise <swise@opengridcomputing.com>2008-07-15 02:48:45 -0400
committerRoland Dreier <rolandd@cisco.com>2008-07-15 02:48:45 -0400
commite7e55829999deaab3f43e201a087731c02c54cf9 (patch)
tree665f2ff291045af9469bbb929f99224e9707965b /drivers/infiniband/hw/cxgb3/cxio_wr.h
parent00f7ec36c9324928e4cd23f02e6d8550f30c32ca (diff)
RDMA/cxgb3: MEM_MGT_EXTENSIONS support
- set IB_DEVICE_MEM_MGT_EXTENSIONS capability bit if fw supports it. - set max_fast_reg_page_list_len device attribute. - add iwch_alloc_fast_reg_mr function. - add iwch_alloc_fastreg_pbl - add iwch_free_fastreg_pbl - adjust the WQ depth for kernel mode work queues to account for fastreg possibly taking 2 WR slots. - add fastreg_mr work request support. - add local_inv work request support. - add send_with_inv and send_with_se_inv work request support. - removed useless duplicate enums/defines for TPT/MW/MR stuff. Signed-off-by: Steve Wise <swise@opengridcomputing.com> Signed-off-by: Roland Dreier <rolandd@cisco.com>
Diffstat (limited to 'drivers/infiniband/hw/cxgb3/cxio_wr.h')
-rw-r--r--drivers/infiniband/hw/cxgb3/cxio_wr.h90
1 files changed, 70 insertions, 20 deletions
diff --git a/drivers/infiniband/hw/cxgb3/cxio_wr.h b/drivers/infiniband/hw/cxgb3/cxio_wr.h
index f1a25a821a45..de760e9f1cc6 100644
--- a/drivers/infiniband/hw/cxgb3/cxio_wr.h
+++ b/drivers/infiniband/hw/cxgb3/cxio_wr.h
@@ -72,7 +72,8 @@ enum t3_wr_opcode {
72 T3_WR_BIND = FW_WROPCODE_RI_BIND_MW, 72 T3_WR_BIND = FW_WROPCODE_RI_BIND_MW,
73 T3_WR_RCV = FW_WROPCODE_RI_RECEIVE, 73 T3_WR_RCV = FW_WROPCODE_RI_RECEIVE,
74 T3_WR_INIT = FW_WROPCODE_RI_RDMA_INIT, 74 T3_WR_INIT = FW_WROPCODE_RI_RDMA_INIT,
75 T3_WR_QP_MOD = FW_WROPCODE_RI_MODIFY_QP 75 T3_WR_QP_MOD = FW_WROPCODE_RI_MODIFY_QP,
76 T3_WR_FASTREG = FW_WROPCODE_RI_FASTREGISTER_MR
76} __attribute__ ((packed)); 77} __attribute__ ((packed));
77 78
78enum t3_rdma_opcode { 79enum t3_rdma_opcode {
@@ -89,7 +90,8 @@ enum t3_rdma_opcode {
89 T3_FAST_REGISTER, 90 T3_FAST_REGISTER,
90 T3_LOCAL_INV, 91 T3_LOCAL_INV,
91 T3_QP_MOD, 92 T3_QP_MOD,
92 T3_BYPASS 93 T3_BYPASS,
94 T3_RDMA_READ_REQ_WITH_INV,
93} __attribute__ ((packed)); 95} __attribute__ ((packed));
94 96
95static inline enum t3_rdma_opcode wr2opcode(enum t3_wr_opcode wrop) 97static inline enum t3_rdma_opcode wr2opcode(enum t3_wr_opcode wrop)
@@ -103,6 +105,7 @@ static inline enum t3_rdma_opcode wr2opcode(enum t3_wr_opcode wrop)
103 case T3_WR_BIND: return T3_BIND_MW; 105 case T3_WR_BIND: return T3_BIND_MW;
104 case T3_WR_INIT: return T3_RDMA_INIT; 106 case T3_WR_INIT: return T3_RDMA_INIT;
105 case T3_WR_QP_MOD: return T3_QP_MOD; 107 case T3_WR_QP_MOD: return T3_QP_MOD;
108 case T3_WR_FASTREG: return T3_FAST_REGISTER;
106 default: break; 109 default: break;
107 } 110 }
108 return -1; 111 return -1;
@@ -170,11 +173,54 @@ struct t3_send_wr {
170 struct t3_sge sgl[T3_MAX_SGE]; /* 4+ */ 173 struct t3_sge sgl[T3_MAX_SGE]; /* 4+ */
171}; 174};
172 175
176#define T3_MAX_FASTREG_DEPTH 24
177#define T3_MAX_FASTREG_FRAG 10
178
179struct t3_fastreg_wr {
180 struct fw_riwrh wrh; /* 0 */
181 union t3_wrid wrid; /* 1 */
182 __be32 stag; /* 2 */
183 __be32 len;
184 __be32 va_base_hi; /* 3 */
185 __be32 va_base_lo_fbo;
186 __be32 page_type_perms; /* 4 */
187 __be32 reserved1;
188 __be64 pbl_addrs[0]; /* 5+ */
189};
190
191/*
192 * If a fastreg wr spans multiple wqes, then the 2nd fragment look like this.
193 */
194struct t3_pbl_frag {
195 struct fw_riwrh wrh; /* 0 */
196 __be64 pbl_addrs[14]; /* 1..14 */
197};
198
199#define S_FR_PAGE_COUNT 24
200#define M_FR_PAGE_COUNT 0xff
201#define V_FR_PAGE_COUNT(x) ((x) << S_FR_PAGE_COUNT)
202#define G_FR_PAGE_COUNT(x) ((((x) >> S_FR_PAGE_COUNT)) & M_FR_PAGE_COUNT)
203
204#define S_FR_PAGE_SIZE 16
205#define M_FR_PAGE_SIZE 0x1f
206#define V_FR_PAGE_SIZE(x) ((x) << S_FR_PAGE_SIZE)
207#define G_FR_PAGE_SIZE(x) ((((x) >> S_FR_PAGE_SIZE)) & M_FR_PAGE_SIZE)
208
209#define S_FR_TYPE 8
210#define M_FR_TYPE 0x1
211#define V_FR_TYPE(x) ((x) << S_FR_TYPE)
212#define G_FR_TYPE(x) ((((x) >> S_FR_TYPE)) & M_FR_TYPE)
213
214#define S_FR_PERMS 0
215#define M_FR_PERMS 0xff
216#define V_FR_PERMS(x) ((x) << S_FR_PERMS)
217#define G_FR_PERMS(x) ((((x) >> S_FR_PERMS)) & M_FR_PERMS)
218
173struct t3_local_inv_wr { 219struct t3_local_inv_wr {
174 struct fw_riwrh wrh; /* 0 */ 220 struct fw_riwrh wrh; /* 0 */
175 union t3_wrid wrid; /* 1 */ 221 union t3_wrid wrid; /* 1 */
176 __be32 stag; /* 2 */ 222 __be32 stag; /* 2 */
177 __be32 reserved3; 223 __be32 reserved;
178}; 224};
179 225
180struct t3_rdma_write_wr { 226struct t3_rdma_write_wr {
@@ -193,7 +239,8 @@ struct t3_rdma_read_wr {
193 struct fw_riwrh wrh; /* 0 */ 239 struct fw_riwrh wrh; /* 0 */
194 union t3_wrid wrid; /* 1 */ 240 union t3_wrid wrid; /* 1 */
195 u8 rdmaop; /* 2 */ 241 u8 rdmaop; /* 2 */
196 u8 reserved[3]; 242 u8 local_inv;
243 u8 reserved[2];
197 __be32 rem_stag; 244 __be32 rem_stag;
198 __be64 rem_to; /* 3 */ 245 __be64 rem_to; /* 3 */
199 __be32 local_stag; /* 4 */ 246 __be32 local_stag; /* 4 */
@@ -201,18 +248,6 @@ struct t3_rdma_read_wr {
201 __be64 local_to; /* 5 */ 248 __be64 local_to; /* 5 */
202}; 249};
203 250
204enum t3_addr_type {
205 T3_VA_BASED_TO = 0x0,
206 T3_ZERO_BASED_TO = 0x1
207} __attribute__ ((packed));
208
209enum t3_mem_perms {
210 T3_MEM_ACCESS_LOCAL_READ = 0x1,
211 T3_MEM_ACCESS_LOCAL_WRITE = 0x2,
212 T3_MEM_ACCESS_REM_READ = 0x4,
213 T3_MEM_ACCESS_REM_WRITE = 0x8
214} __attribute__ ((packed));
215
216struct t3_bind_mw_wr { 251struct t3_bind_mw_wr {
217 struct fw_riwrh wrh; /* 0 */ 252 struct fw_riwrh wrh; /* 0 */
218 union t3_wrid wrid; /* 1 */ 253 union t3_wrid wrid; /* 1 */
@@ -336,6 +371,11 @@ struct t3_genbit {
336 __be64 genbit; 371 __be64 genbit;
337}; 372};
338 373
374struct t3_wq_in_err {
375 u64 flit[13];
376 u64 err;
377};
378
339enum rdma_init_wr_flags { 379enum rdma_init_wr_flags {
340 MPA_INITIATOR = (1<<0), 380 MPA_INITIATOR = (1<<0),
341 PRIV_QP = (1<<1), 381 PRIV_QP = (1<<1),
@@ -346,13 +386,16 @@ union t3_wr {
346 struct t3_rdma_write_wr write; 386 struct t3_rdma_write_wr write;
347 struct t3_rdma_read_wr read; 387 struct t3_rdma_read_wr read;
348 struct t3_receive_wr recv; 388 struct t3_receive_wr recv;
389 struct t3_fastreg_wr fastreg;
390 struct t3_pbl_frag pbl_frag;
349 struct t3_local_inv_wr local_inv; 391 struct t3_local_inv_wr local_inv;
350 struct t3_bind_mw_wr bind; 392 struct t3_bind_mw_wr bind;
351 struct t3_bypass_wr bypass; 393 struct t3_bypass_wr bypass;
352 struct t3_rdma_init_wr init; 394 struct t3_rdma_init_wr init;
353 struct t3_modify_qp_wr qp_mod; 395 struct t3_modify_qp_wr qp_mod;
354 struct t3_genbit genbit; 396 struct t3_genbit genbit;
355 u64 flit[16]; 397 struct t3_wq_in_err wq_in_err;
398 __be64 flit[16];
356}; 399};
357 400
358#define T3_SQ_CQE_FLIT 13 401#define T3_SQ_CQE_FLIT 13
@@ -366,12 +409,18 @@ static inline enum t3_wr_opcode fw_riwrh_opcode(struct fw_riwrh *wqe)
366 return G_FW_RIWR_OP(be32_to_cpu(wqe->op_seop_flags)); 409 return G_FW_RIWR_OP(be32_to_cpu(wqe->op_seop_flags));
367} 410}
368 411
412enum t3_wr_hdr_bits {
413 T3_EOP = 1,
414 T3_SOP = 2,
415 T3_SOPEOP = T3_EOP|T3_SOP,
416};
417
369static inline void build_fw_riwrh(struct fw_riwrh *wqe, enum t3_wr_opcode op, 418static inline void build_fw_riwrh(struct fw_riwrh *wqe, enum t3_wr_opcode op,
370 enum t3_wr_flags flags, u8 genbit, u32 tid, 419 enum t3_wr_flags flags, u8 genbit, u32 tid,
371 u8 len) 420 u8 len, u8 sopeop)
372{ 421{
373 wqe->op_seop_flags = cpu_to_be32(V_FW_RIWR_OP(op) | 422 wqe->op_seop_flags = cpu_to_be32(V_FW_RIWR_OP(op) |
374 V_FW_RIWR_SOPEOP(M_FW_RIWR_SOPEOP) | 423 V_FW_RIWR_SOPEOP(sopeop) |
375 V_FW_RIWR_FLAGS(flags)); 424 V_FW_RIWR_FLAGS(flags));
376 wmb(); 425 wmb();
377 wqe->gen_tid_len = cpu_to_be32(V_FW_RIWR_GEN(genbit) | 426 wqe->gen_tid_len = cpu_to_be32(V_FW_RIWR_GEN(genbit) |
@@ -404,6 +453,7 @@ enum tpt_addr_type {
404}; 453};
405 454
406enum tpt_mem_perm { 455enum tpt_mem_perm {
456 TPT_MW_BIND = 0x10,
407 TPT_LOCAL_READ = 0x8, 457 TPT_LOCAL_READ = 0x8,
408 TPT_LOCAL_WRITE = 0x4, 458 TPT_LOCAL_WRITE = 0x4,
409 TPT_REMOTE_READ = 0x2, 459 TPT_REMOTE_READ = 0x2,
@@ -659,7 +709,7 @@ struct t3_cq {
659 709
660static inline void cxio_set_wq_in_error(struct t3_wq *wq) 710static inline void cxio_set_wq_in_error(struct t3_wq *wq)
661{ 711{
662 wq->queue->flit[13] = 1; 712 wq->queue->wq_in_err.err = 1;
663} 713}
664 714
665static inline struct t3_cqe *cxio_next_hw_cqe(struct t3_cq *cq) 715static inline struct t3_cqe *cxio_next_hw_cqe(struct t3_cq *cq)