aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorMike Marciniszyn <mike.marciniszyn@intel.com>2016-05-24 15:50:40 -0400
committerDoug Ledford <dledford@redhat.com>2016-05-26 12:21:10 -0400
commit8b103e9cdee5f381bc20a8a9f9bb5be11de8e68f (patch)
treed03f73e33c1ea5cfc9befbd34dd39a244a0da3d7
parent4c0b653335bbdfe62a5f4483c98cb5d581432917 (diff)
IB/rdamvt: Fix rdmavt s_ack_queue sizing
rdmavt allows the driver to specify the size of the ack queue, but only uses it for the modify QP limit testing for setting the atomic limit value. The driver dependent size is now used to size the s_ack_queue ring dynamicially. Since the driver knows its size, the driver will use its define for any ring size dependent code. Reviewed-by: Mitko Haralanov <mitko.haralanov@intel.com> Signed-off-by: Mike Marciniszyn <mike.marciniszyn@intel.com> Signed-off-by: Doug Ledford <dledford@redhat.com>
-rw-r--r--drivers/infiniband/sw/rdmavt/qp.c22
-rw-r--r--include/rdma/rdma_vt.h9
-rw-r--r--include/rdma/rdmavt_qp.h5
3 files changed, 30 insertions, 6 deletions
diff --git a/drivers/infiniband/sw/rdmavt/qp.c b/drivers/infiniband/sw/rdmavt/qp.c
index dd03b23a6a7c..5fa4d4d81ee0 100644
--- a/drivers/infiniband/sw/rdmavt/qp.c
+++ b/drivers/infiniband/sw/rdmavt/qp.c
@@ -397,6 +397,7 @@ static void free_qpn(struct rvt_qpn_table *qpt, u32 qpn)
397static void rvt_clear_mr_refs(struct rvt_qp *qp, int clr_sends) 397static void rvt_clear_mr_refs(struct rvt_qp *qp, int clr_sends)
398{ 398{
399 unsigned n; 399 unsigned n;
400 struct rvt_dev_info *rdi = ib_to_rvt(qp->ibqp.device);
400 401
401 if (test_and_clear_bit(RVT_R_REWIND_SGE, &qp->r_aflags)) 402 if (test_and_clear_bit(RVT_R_REWIND_SGE, &qp->r_aflags))
402 rvt_put_ss(&qp->s_rdma_read_sge); 403 rvt_put_ss(&qp->s_rdma_read_sge);
@@ -431,7 +432,7 @@ static void rvt_clear_mr_refs(struct rvt_qp *qp, int clr_sends)
431 if (qp->ibqp.qp_type != IB_QPT_RC) 432 if (qp->ibqp.qp_type != IB_QPT_RC)
432 return; 433 return;
433 434
434 for (n = 0; n < ARRAY_SIZE(qp->s_ack_queue); n++) { 435 for (n = 0; n < rvt_max_atomic(rdi); n++) {
435 struct rvt_ack_entry *e = &qp->s_ack_queue[n]; 436 struct rvt_ack_entry *e = &qp->s_ack_queue[n];
436 437
437 if (e->opcode == IB_OPCODE_RC_RDMA_READ_REQUEST && 438 if (e->opcode == IB_OPCODE_RC_RDMA_READ_REQUEST &&
@@ -569,7 +570,12 @@ static void rvt_reset_qp(struct rvt_dev_info *rdi, struct rvt_qp *qp,
569 qp->s_ssn = 1; 570 qp->s_ssn = 1;
570 qp->s_lsn = 0; 571 qp->s_lsn = 0;
571 qp->s_mig_state = IB_MIG_MIGRATED; 572 qp->s_mig_state = IB_MIG_MIGRATED;
572 memset(qp->s_ack_queue, 0, sizeof(qp->s_ack_queue)); 573 if (qp->s_ack_queue)
574 memset(
575 qp->s_ack_queue,
576 0,
577 rvt_max_atomic(rdi) *
578 sizeof(*qp->s_ack_queue));
573 qp->r_head_ack_queue = 0; 579 qp->r_head_ack_queue = 0;
574 qp->s_tail_ack_queue = 0; 580 qp->s_tail_ack_queue = 0;
575 qp->s_num_rd_atomic = 0; 581 qp->s_num_rd_atomic = 0;
@@ -677,6 +683,16 @@ struct ib_qp *rvt_create_qp(struct ib_pd *ibpd,
677 goto bail_swq; 683 goto bail_swq;
678 684
679 RCU_INIT_POINTER(qp->next, NULL); 685 RCU_INIT_POINTER(qp->next, NULL);
686 if (init_attr->qp_type == IB_QPT_RC) {
687 qp->s_ack_queue =
688 kzalloc_node(
689 sizeof(*qp->s_ack_queue) *
690 rvt_max_atomic(rdi),
691 gfp,
692 rdi->dparms.node);
693 if (!qp->s_ack_queue)
694 goto bail_qp;
695 }
680 696
681 /* 697 /*
682 * Driver needs to set up it's private QP structure and do any 698 * Driver needs to set up it's private QP structure and do any
@@ -857,6 +873,7 @@ bail_driver_priv:
857 rdi->driver_f.qp_priv_free(rdi, qp); 873 rdi->driver_f.qp_priv_free(rdi, qp);
858 874
859bail_qp: 875bail_qp:
876 kfree(qp->s_ack_queue);
860 kfree(qp); 877 kfree(qp);
861 878
862bail_swq: 879bail_swq:
@@ -1284,6 +1301,7 @@ int rvt_destroy_qp(struct ib_qp *ibqp)
1284 vfree(qp->r_rq.wq); 1301 vfree(qp->r_rq.wq);
1285 vfree(qp->s_wq); 1302 vfree(qp->s_wq);
1286 rdi->driver_f.qp_priv_free(rdi, qp); 1303 rdi->driver_f.qp_priv_free(rdi, qp);
1304 kfree(qp->s_ack_queue);
1287 kfree(qp); 1305 kfree(qp);
1288 return 0; 1306 return 0;
1289} 1307}
diff --git a/include/rdma/rdma_vt.h b/include/rdma/rdma_vt.h
index 3f12da9384a1..16274e2133cd 100644
--- a/include/rdma/rdma_vt.h
+++ b/include/rdma/rdma_vt.h
@@ -426,6 +426,15 @@ static inline unsigned rvt_get_npkeys(struct rvt_dev_info *rdi)
426} 426}
427 427
428/* 428/*
429 * Return the max atomic suitable for determining
430 * the size of the ack ring buffer in a QP.
431 */
432static inline unsigned int rvt_max_atomic(struct rvt_dev_info *rdi)
433{
434 return rdi->dparms.max_rdma_atomic + 1;
435}
436
437/*
429 * Return the indexed PKEY from the port PKEY table. 438 * Return the indexed PKEY from the port PKEY table.
430 */ 439 */
431static inline u16 rvt_get_pkey(struct rvt_dev_info *rdi, 440static inline u16 rvt_get_pkey(struct rvt_dev_info *rdi,
diff --git a/include/rdma/rdmavt_qp.h b/include/rdma/rdmavt_qp.h
index 0e1ff2abfe92..6d23b879416a 100644
--- a/include/rdma/rdmavt_qp.h
+++ b/include/rdma/rdmavt_qp.h
@@ -211,8 +211,6 @@ struct rvt_mmap_info {
211 unsigned size; 211 unsigned size;
212}; 212};
213 213
214#define RVT_MAX_RDMA_ATOMIC 16
215
216/* 214/*
217 * This structure holds the information that the send tasklet needs 215 * This structure holds the information that the send tasklet needs
218 * to send a RDMA read response or atomic operation. 216 * to send a RDMA read response or atomic operation.
@@ -282,8 +280,7 @@ struct rvt_qp {
282 atomic_t refcount ____cacheline_aligned_in_smp; 280 atomic_t refcount ____cacheline_aligned_in_smp;
283 wait_queue_head_t wait; 281 wait_queue_head_t wait;
284 282
285 struct rvt_ack_entry s_ack_queue[RVT_MAX_RDMA_ATOMIC + 1] 283 struct rvt_ack_entry *s_ack_queue;
286 ____cacheline_aligned_in_smp;
287 struct rvt_sge_state s_rdma_read_sge; 284 struct rvt_sge_state s_rdma_read_sge;
288 285
289 spinlock_t r_lock ____cacheline_aligned_in_smp; /* used for APM */ 286 spinlock_t r_lock ____cacheline_aligned_in_smp; /* used for APM */