aboutsummaryrefslogtreecommitdiffstats
path: root/drivers/infiniband
diff options
context:
space:
mode:
authorSteve Wise <swise@opengridcomputing.com>2010-09-17 16:40:15 -0400
committerRoland Dreier <rolandd@cisco.com>2010-09-28 13:53:50 -0400
commit40dbf6ee381008e471d3c4a332971247b7799744 (patch)
tree6249fb3fd9cca9e2e42c01a798ef21b4f5a1e328 /drivers/infiniband
parent410ade4c26bdf256fea3246e968a12409eb08763 (diff)
RDMA/cxgb4: Fastreg NSMR fixes
- Remove dsgl support - doesn't work in T4. - Wrap the immediate PBL as needed when building it in the wr. - Adjust max pbl depth allowed based on ulptx alignment requirements. - Bump the slots per SQ to 5 to allow up to 128MB fast registers. - Advertise fastreg support by default. Signed-off-by: Steve Wise <swise@opengridcomputing.com> Signed-off-by: Roland Dreier <rolandd@cisco.com>
Diffstat (limited to 'drivers/infiniband')
-rw-r--r--drivers/infiniband/hw/cxgb4/provider.c4
-rw-r--r--drivers/infiniband/hw/cxgb4/qp.c52
-rw-r--r--drivers/infiniband/hw/cxgb4/t4.h4
3 files changed, 29 insertions, 31 deletions
diff --git a/drivers/infiniband/hw/cxgb4/provider.c b/drivers/infiniband/hw/cxgb4/provider.c
index a49a9c1275a3..81e127713675 100644
--- a/drivers/infiniband/hw/cxgb4/provider.c
+++ b/drivers/infiniband/hw/cxgb4/provider.c
@@ -54,9 +54,9 @@
54 54
55#include "iw_cxgb4.h" 55#include "iw_cxgb4.h"
56 56
57static int fastreg_support; 57static int fastreg_support = 1;
58module_param(fastreg_support, int, 0644); 58module_param(fastreg_support, int, 0644);
59MODULE_PARM_DESC(fastreg_support, "Advertise fastreg support (default=0)"); 59MODULE_PARM_DESC(fastreg_support, "Advertise fastreg support (default=1)");
60 60
61static int c4iw_modify_port(struct ib_device *ibdev, 61static int c4iw_modify_port(struct ib_device *ibdev,
62 u8 port, int port_modify_mask, 62 u8 port, int port_modify_mask,
diff --git a/drivers/infiniband/hw/cxgb4/qp.c b/drivers/infiniband/hw/cxgb4/qp.c
index ff04e5cc28ce..057cb2505ea1 100644
--- a/drivers/infiniband/hw/cxgb4/qp.c
+++ b/drivers/infiniband/hw/cxgb4/qp.c
@@ -505,13 +505,15 @@ static int build_rdma_recv(struct c4iw_qp *qhp, union t4_recv_wr *wqe,
505 return 0; 505 return 0;
506} 506}
507 507
508static int build_fastreg(union t4_wr *wqe, struct ib_send_wr *wr, u8 *len16) 508static int build_fastreg(struct t4_sq *sq, union t4_wr *wqe,
509 struct ib_send_wr *wr, u8 *len16)
509{ 510{
510 511
511 struct fw_ri_immd *imdp; 512 struct fw_ri_immd *imdp;
512 __be64 *p; 513 __be64 *p;
513 int i; 514 int i;
514 int pbllen = roundup(wr->wr.fast_reg.page_list_len * sizeof(u64), 32); 515 int pbllen = roundup(wr->wr.fast_reg.page_list_len * sizeof(u64), 32);
516 int rem;
515 517
516 if (wr->wr.fast_reg.page_list_len > T4_MAX_FR_DEPTH) 518 if (wr->wr.fast_reg.page_list_len > T4_MAX_FR_DEPTH)
517 return -EINVAL; 519 return -EINVAL;
@@ -526,32 +528,28 @@ static int build_fastreg(union t4_wr *wqe, struct ib_send_wr *wr, u8 *len16)
526 wqe->fr.va_hi = cpu_to_be32(wr->wr.fast_reg.iova_start >> 32); 528 wqe->fr.va_hi = cpu_to_be32(wr->wr.fast_reg.iova_start >> 32);
527 wqe->fr.va_lo_fbo = cpu_to_be32(wr->wr.fast_reg.iova_start & 529 wqe->fr.va_lo_fbo = cpu_to_be32(wr->wr.fast_reg.iova_start &
528 0xffffffff); 530 0xffffffff);
529 if (pbllen > T4_MAX_FR_IMMD) { 531 WARN_ON(pbllen > T4_MAX_FR_IMMD);
530 struct c4iw_fr_page_list *c4pl = 532 imdp = (struct fw_ri_immd *)(&wqe->fr + 1);
531 to_c4iw_fr_page_list(wr->wr.fast_reg.page_list); 533 imdp->op = FW_RI_DATA_IMMD;
532 struct fw_ri_dsgl *sglp; 534 imdp->r1 = 0;
533 535 imdp->r2 = 0;
534 sglp = (struct fw_ri_dsgl *)(&wqe->fr + 1); 536 imdp->immdlen = cpu_to_be32(pbllen);
535 sglp->op = FW_RI_DATA_DSGL; 537 p = (__be64 *)(imdp + 1);
536 sglp->r1 = 0; 538 rem = pbllen;
537 sglp->nsge = cpu_to_be16(1); 539 for (i = 0; i < wr->wr.fast_reg.page_list_len; i++) {
538 sglp->addr0 = cpu_to_be64(c4pl->dma_addr); 540 *p = cpu_to_be64((u64)wr->wr.fast_reg.page_list->page_list[i]);
539 sglp->len0 = cpu_to_be32(pbllen); 541 rem -= sizeof *p;
540 542 if (++p == (__be64 *)&sq->queue[sq->size])
541 *len16 = DIV_ROUND_UP(sizeof wqe->fr + sizeof *sglp, 16); 543 p = (__be64 *)sq->queue;
542 } else { 544 }
543 imdp = (struct fw_ri_immd *)(&wqe->fr + 1); 545 BUG_ON(rem < 0);
544 imdp->op = FW_RI_DATA_IMMD; 546 while (rem) {
545 imdp->r1 = 0; 547 *p = 0;
546 imdp->r2 = 0; 548 rem -= sizeof *p;
547 imdp->immdlen = cpu_to_be32(pbllen); 549 if (++p == (__be64 *)&sq->queue[sq->size])
548 p = (__be64 *)(imdp + 1); 550 p = (__be64 *)sq->queue;
549 for (i = 0; i < wr->wr.fast_reg.page_list_len; i++, p++)
550 *p = cpu_to_be64(
551 (u64)wr->wr.fast_reg.page_list->page_list[i]);
552 *len16 = DIV_ROUND_UP(sizeof wqe->fr + sizeof *imdp + pbllen,
553 16);
554 } 551 }
552 *len16 = DIV_ROUND_UP(sizeof wqe->fr + sizeof *imdp + pbllen, 16);
555 return 0; 553 return 0;
556} 554}
557 555
@@ -652,7 +650,7 @@ int c4iw_post_send(struct ib_qp *ibqp, struct ib_send_wr *wr,
652 case IB_WR_FAST_REG_MR: 650 case IB_WR_FAST_REG_MR:
653 fw_opcode = FW_RI_FR_NSMR_WR; 651 fw_opcode = FW_RI_FR_NSMR_WR;
654 swsqe->opcode = FW_RI_FAST_REGISTER; 652 swsqe->opcode = FW_RI_FAST_REGISTER;
655 err = build_fastreg(wqe, wr, &len16); 653 err = build_fastreg(&qhp->wq.sq, wqe, wr, &len16);
656 break; 654 break;
657 case IB_WR_LOCAL_INV: 655 case IB_WR_LOCAL_INV:
658 if (wr->send_flags & IB_SEND_FENCE) 656 if (wr->send_flags & IB_SEND_FENCE)
diff --git a/drivers/infiniband/hw/cxgb4/t4.h b/drivers/infiniband/hw/cxgb4/t4.h
index 17ea5fcb37e4..70004425d695 100644
--- a/drivers/infiniband/hw/cxgb4/t4.h
+++ b/drivers/infiniband/hw/cxgb4/t4.h
@@ -66,7 +66,7 @@ struct t4_status_page {
66 66
67#define T4_EQ_ENTRY_SIZE 64 67#define T4_EQ_ENTRY_SIZE 64
68 68
69#define T4_SQ_NUM_SLOTS 4 69#define T4_SQ_NUM_SLOTS 5
70#define T4_SQ_NUM_BYTES (T4_EQ_ENTRY_SIZE * T4_SQ_NUM_SLOTS) 70#define T4_SQ_NUM_BYTES (T4_EQ_ENTRY_SIZE * T4_SQ_NUM_SLOTS)
71#define T4_MAX_SEND_SGE ((T4_SQ_NUM_BYTES - sizeof(struct fw_ri_send_wr) - \ 71#define T4_MAX_SEND_SGE ((T4_SQ_NUM_BYTES - sizeof(struct fw_ri_send_wr) - \
72 sizeof(struct fw_ri_isgl)) / sizeof(struct fw_ri_sge)) 72 sizeof(struct fw_ri_isgl)) / sizeof(struct fw_ri_sge))
@@ -79,7 +79,7 @@ struct t4_status_page {
79 sizeof(struct fw_ri_rdma_write_wr) - \ 79 sizeof(struct fw_ri_rdma_write_wr) - \
80 sizeof(struct fw_ri_isgl)) / sizeof(struct fw_ri_sge)) 80 sizeof(struct fw_ri_isgl)) / sizeof(struct fw_ri_sge))
81#define T4_MAX_FR_IMMD ((T4_SQ_NUM_BYTES - sizeof(struct fw_ri_fr_nsmr_wr) - \ 81#define T4_MAX_FR_IMMD ((T4_SQ_NUM_BYTES - sizeof(struct fw_ri_fr_nsmr_wr) - \
82 sizeof(struct fw_ri_immd))) 82 sizeof(struct fw_ri_immd)) & ~31UL)
83#define T4_MAX_FR_DEPTH (T4_MAX_FR_IMMD / sizeof(u64)) 83#define T4_MAX_FR_DEPTH (T4_MAX_FR_IMMD / sizeof(u64))
84 84
85#define T4_RQ_NUM_SLOTS 2 85#define T4_RQ_NUM_SLOTS 2