Commit 8b103e9c authored by Mike Marciniszyn's avatar Mike Marciniszyn Committed by Doug Ledford

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: default avatarMitko Haralanov <mitko.haralanov@intel.com>
Signed-off-by: default avatarMike Marciniszyn <mike.marciniszyn@intel.com>
Signed-off-by: default avatarDoug Ledford <dledford@redhat.com>
parent 4c0b6533
...@@ -397,6 +397,7 @@ static void free_qpn(struct rvt_qpn_table *qpt, u32 qpn) ...@@ -397,6 +397,7 @@ static void free_qpn(struct rvt_qpn_table *qpt, u32 qpn)
static void rvt_clear_mr_refs(struct rvt_qp *qp, int clr_sends) static void rvt_clear_mr_refs(struct rvt_qp *qp, int clr_sends)
{ {
unsigned n; unsigned n;
struct rvt_dev_info *rdi = ib_to_rvt(qp->ibqp.device);
if (test_and_clear_bit(RVT_R_REWIND_SGE, &qp->r_aflags)) if (test_and_clear_bit(RVT_R_REWIND_SGE, &qp->r_aflags))
rvt_put_ss(&qp->s_rdma_read_sge); 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,7 +432,7 @@ static void rvt_clear_mr_refs(struct rvt_qp *qp, int clr_sends)
if (qp->ibqp.qp_type != IB_QPT_RC) if (qp->ibqp.qp_type != IB_QPT_RC)
return; return;
for (n = 0; n < ARRAY_SIZE(qp->s_ack_queue); n++) { for (n = 0; n < rvt_max_atomic(rdi); n++) {
struct rvt_ack_entry *e = &qp->s_ack_queue[n]; struct rvt_ack_entry *e = &qp->s_ack_queue[n];
if (e->opcode == IB_OPCODE_RC_RDMA_READ_REQUEST && 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,7 +570,12 @@ static void rvt_reset_qp(struct rvt_dev_info *rdi, struct rvt_qp *qp,
qp->s_ssn = 1; qp->s_ssn = 1;
qp->s_lsn = 0; qp->s_lsn = 0;
qp->s_mig_state = IB_MIG_MIGRATED; qp->s_mig_state = IB_MIG_MIGRATED;
memset(qp->s_ack_queue, 0, sizeof(qp->s_ack_queue)); if (qp->s_ack_queue)
memset(
qp->s_ack_queue,
0,
rvt_max_atomic(rdi) *
sizeof(*qp->s_ack_queue));
qp->r_head_ack_queue = 0; qp->r_head_ack_queue = 0;
qp->s_tail_ack_queue = 0; qp->s_tail_ack_queue = 0;
qp->s_num_rd_atomic = 0; qp->s_num_rd_atomic = 0;
...@@ -677,6 +683,16 @@ struct ib_qp *rvt_create_qp(struct ib_pd *ibpd, ...@@ -677,6 +683,16 @@ struct ib_qp *rvt_create_qp(struct ib_pd *ibpd,
goto bail_swq; goto bail_swq;
RCU_INIT_POINTER(qp->next, NULL); RCU_INIT_POINTER(qp->next, NULL);
if (init_attr->qp_type == IB_QPT_RC) {
qp->s_ack_queue =
kzalloc_node(
sizeof(*qp->s_ack_queue) *
rvt_max_atomic(rdi),
gfp,
rdi->dparms.node);
if (!qp->s_ack_queue)
goto bail_qp;
}
/* /*
* Driver needs to set up it's private QP structure and do any * Driver needs to set up it's private QP structure and do any
...@@ -857,6 +873,7 @@ struct ib_qp *rvt_create_qp(struct ib_pd *ibpd, ...@@ -857,6 +873,7 @@ struct ib_qp *rvt_create_qp(struct ib_pd *ibpd,
rdi->driver_f.qp_priv_free(rdi, qp); rdi->driver_f.qp_priv_free(rdi, qp);
bail_qp: bail_qp:
kfree(qp->s_ack_queue);
kfree(qp); kfree(qp);
bail_swq: bail_swq:
...@@ -1284,6 +1301,7 @@ int rvt_destroy_qp(struct ib_qp *ibqp) ...@@ -1284,6 +1301,7 @@ int rvt_destroy_qp(struct ib_qp *ibqp)
vfree(qp->r_rq.wq); vfree(qp->r_rq.wq);
vfree(qp->s_wq); vfree(qp->s_wq);
rdi->driver_f.qp_priv_free(rdi, qp); rdi->driver_f.qp_priv_free(rdi, qp);
kfree(qp->s_ack_queue);
kfree(qp); kfree(qp);
return 0; return 0;
} }
......
...@@ -425,6 +425,15 @@ static inline unsigned rvt_get_npkeys(struct rvt_dev_info *rdi) ...@@ -425,6 +425,15 @@ static inline unsigned rvt_get_npkeys(struct rvt_dev_info *rdi)
return rdi->dparms.npkeys; return rdi->dparms.npkeys;
} }
/*
* Return the max atomic suitable for determining
* the size of the ack ring buffer in a QP.
*/
static inline unsigned int rvt_max_atomic(struct rvt_dev_info *rdi)
{
return rdi->dparms.max_rdma_atomic + 1;
}
/* /*
* Return the indexed PKEY from the port PKEY table. * Return the indexed PKEY from the port PKEY table.
*/ */
......
...@@ -211,8 +211,6 @@ struct rvt_mmap_info { ...@@ -211,8 +211,6 @@ struct rvt_mmap_info {
unsigned size; unsigned size;
}; };
#define RVT_MAX_RDMA_ATOMIC 16
/* /*
* This structure holds the information that the send tasklet needs * This structure holds the information that the send tasklet needs
* to send a RDMA read response or atomic operation. * to send a RDMA read response or atomic operation.
...@@ -282,8 +280,7 @@ struct rvt_qp { ...@@ -282,8 +280,7 @@ struct rvt_qp {
atomic_t refcount ____cacheline_aligned_in_smp; atomic_t refcount ____cacheline_aligned_in_smp;
wait_queue_head_t wait; wait_queue_head_t wait;
struct rvt_ack_entry s_ack_queue[RVT_MAX_RDMA_ATOMIC + 1] struct rvt_ack_entry *s_ack_queue;
____cacheline_aligned_in_smp;
struct rvt_sge_state s_rdma_read_sge; struct rvt_sge_state s_rdma_read_sge;
spinlock_t r_lock ____cacheline_aligned_in_smp; /* used for APM */ spinlock_t r_lock ____cacheline_aligned_in_smp; /* used for APM */
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment