RDMA/cxgb3: Don't allocate the SW queue for user mode CQs
Only kernel mode CQs need the SW queue memory allocated. The SW queue for user mode CQs is allocated in userspace by libcxgb3. Signed-off-by: Steve Wise <swise@opengridcomputing.com> Signed-off-by: Roland Dreier <rolandd@cisco.com>
This commit is contained in:
parent
9918b28d2b
commit
5279d3ac2d
|
@ -154,7 +154,7 @@ static int cxio_hal_clear_qp_ctx(struct cxio_rdev *rdev_p, u32 qpid)
|
||||||
return iwch_cxgb3_ofld_send(rdev_p->t3cdev_p, skb);
|
return iwch_cxgb3_ofld_send(rdev_p->t3cdev_p, skb);
|
||||||
}
|
}
|
||||||
|
|
||||||
int cxio_create_cq(struct cxio_rdev *rdev_p, struct t3_cq *cq)
|
int cxio_create_cq(struct cxio_rdev *rdev_p, struct t3_cq *cq, int kernel)
|
||||||
{
|
{
|
||||||
struct rdma_cq_setup setup;
|
struct rdma_cq_setup setup;
|
||||||
int size = (1UL << (cq->size_log2)) * sizeof(struct t3_cqe);
|
int size = (1UL << (cq->size_log2)) * sizeof(struct t3_cqe);
|
||||||
|
@ -162,12 +162,12 @@ int cxio_create_cq(struct cxio_rdev *rdev_p, struct t3_cq *cq)
|
||||||
cq->cqid = cxio_hal_get_cqid(rdev_p->rscp);
|
cq->cqid = cxio_hal_get_cqid(rdev_p->rscp);
|
||||||
if (!cq->cqid)
|
if (!cq->cqid)
|
||||||
return -ENOMEM;
|
return -ENOMEM;
|
||||||
cq->sw_queue = kzalloc(size, GFP_KERNEL);
|
if (kernel) {
|
||||||
if (!cq->sw_queue)
|
cq->sw_queue = kzalloc(size, GFP_KERNEL);
|
||||||
return -ENOMEM;
|
if (!cq->sw_queue)
|
||||||
cq->queue = dma_alloc_coherent(&(rdev_p->rnic_info.pdev->dev),
|
return -ENOMEM;
|
||||||
(1UL << (cq->size_log2)) *
|
}
|
||||||
sizeof(struct t3_cqe),
|
cq->queue = dma_alloc_coherent(&(rdev_p->rnic_info.pdev->dev), size,
|
||||||
&(cq->dma_addr), GFP_KERNEL);
|
&(cq->dma_addr), GFP_KERNEL);
|
||||||
if (!cq->queue) {
|
if (!cq->queue) {
|
||||||
kfree(cq->sw_queue);
|
kfree(cq->sw_queue);
|
||||||
|
|
|
@ -157,7 +157,7 @@ int cxio_rdev_open(struct cxio_rdev *rdev);
|
||||||
void cxio_rdev_close(struct cxio_rdev *rdev);
|
void cxio_rdev_close(struct cxio_rdev *rdev);
|
||||||
int cxio_hal_cq_op(struct cxio_rdev *rdev, struct t3_cq *cq,
|
int cxio_hal_cq_op(struct cxio_rdev *rdev, struct t3_cq *cq,
|
||||||
enum t3_cq_opcode op, u32 credit);
|
enum t3_cq_opcode op, u32 credit);
|
||||||
int cxio_create_cq(struct cxio_rdev *rdev, struct t3_cq *cq);
|
int cxio_create_cq(struct cxio_rdev *rdev, struct t3_cq *cq, int kernel);
|
||||||
int cxio_destroy_cq(struct cxio_rdev *rdev, struct t3_cq *cq);
|
int cxio_destroy_cq(struct cxio_rdev *rdev, struct t3_cq *cq);
|
||||||
int cxio_resize_cq(struct cxio_rdev *rdev, struct t3_cq *cq);
|
int cxio_resize_cq(struct cxio_rdev *rdev, struct t3_cq *cq);
|
||||||
void cxio_release_ucontext(struct cxio_rdev *rdev, struct cxio_ucontext *uctx);
|
void cxio_release_ucontext(struct cxio_rdev *rdev, struct cxio_ucontext *uctx);
|
||||||
|
|
|
@ -187,7 +187,7 @@ static struct ib_cq *iwch_create_cq(struct ib_device *ibdev, int entries, int ve
|
||||||
entries = roundup_pow_of_two(entries);
|
entries = roundup_pow_of_two(entries);
|
||||||
chp->cq.size_log2 = ilog2(entries);
|
chp->cq.size_log2 = ilog2(entries);
|
||||||
|
|
||||||
if (cxio_create_cq(&rhp->rdev, &chp->cq)) {
|
if (cxio_create_cq(&rhp->rdev, &chp->cq, !ucontext)) {
|
||||||
kfree(chp);
|
kfree(chp);
|
||||||
return ERR_PTR(-ENOMEM);
|
return ERR_PTR(-ENOMEM);
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in a new issue