RDMA/cxgb3: Make iwch_poll_cq_one() easier to analyze
Introduce the function __iwch_poll_cq_one() to make iwch_poll_cq_one() easier to analyze for static source code analyzers. This patch avoids that sparse reports the following: drivers/infiniband/hw/cxgb3/iwch_cq.c:187:9: warning: context imbalance in 'iwch_poll_cq_one' - different lock contexts for basic block Compile-tested only. Signed-off-by: Bart Van Assche <bart.vanassche@wdc.com> Cc: Steve Wise <swise@chelsio.com> Acked-by: Steve Wise <swise@opengridcomputing.com> Signed-off-by: Jason Gunthorpe <jgg@mellanox.com>
This commit is contained in:

committed by
Jason Gunthorpe

parent
2f229bcf25
commit
cbd8e988eb
@@ -32,38 +32,16 @@
|
|||||||
#include "iwch_provider.h"
|
#include "iwch_provider.h"
|
||||||
#include "iwch.h"
|
#include "iwch.h"
|
||||||
|
|
||||||
/*
|
static int __iwch_poll_cq_one(struct iwch_dev *rhp, struct iwch_cq *chp,
|
||||||
* Get one cq entry from cxio and map it to openib.
|
struct iwch_qp *qhp, struct ib_wc *wc)
|
||||||
*
|
|
||||||
* Returns:
|
|
||||||
* 0 EMPTY;
|
|
||||||
* 1 cqe returned
|
|
||||||
* -EAGAIN caller must try again
|
|
||||||
* any other -errno fatal error
|
|
||||||
*/
|
|
||||||
static int iwch_poll_cq_one(struct iwch_dev *rhp, struct iwch_cq *chp,
|
|
||||||
struct ib_wc *wc)
|
|
||||||
{
|
{
|
||||||
struct iwch_qp *qhp = NULL;
|
struct t3_wq *wq = qhp ? &qhp->wq : NULL;
|
||||||
struct t3_cqe cqe, *rd_cqe;
|
struct t3_cqe cqe;
|
||||||
struct t3_wq *wq;
|
|
||||||
u32 credit = 0;
|
u32 credit = 0;
|
||||||
u8 cqe_flushed;
|
u8 cqe_flushed;
|
||||||
u64 cookie;
|
u64 cookie;
|
||||||
int ret = 1;
|
int ret = 1;
|
||||||
|
|
||||||
rd_cqe = cxio_next_cqe(&chp->cq);
|
|
||||||
|
|
||||||
if (!rd_cqe)
|
|
||||||
return 0;
|
|
||||||
|
|
||||||
qhp = get_qhp(rhp, CQE_QPID(*rd_cqe));
|
|
||||||
if (!qhp)
|
|
||||||
wq = NULL;
|
|
||||||
else {
|
|
||||||
spin_lock(&qhp->lock);
|
|
||||||
wq = &(qhp->wq);
|
|
||||||
}
|
|
||||||
ret = cxio_poll_cq(wq, &(chp->cq), &cqe, &cqe_flushed, &cookie,
|
ret = cxio_poll_cq(wq, &(chp->cq), &cqe, &cqe_flushed, &cookie,
|
||||||
&credit);
|
&credit);
|
||||||
if (t3a_device(chp->rhp) && credit) {
|
if (t3a_device(chp->rhp) && credit) {
|
||||||
@@ -79,7 +57,7 @@ static int iwch_poll_cq_one(struct iwch_dev *rhp, struct iwch_cq *chp,
|
|||||||
ret = 1;
|
ret = 1;
|
||||||
|
|
||||||
wc->wr_id = cookie;
|
wc->wr_id = cookie;
|
||||||
wc->qp = &qhp->ibqp;
|
wc->qp = qhp ? &qhp->ibqp : NULL;
|
||||||
wc->vendor_err = CQE_STATUS(cqe);
|
wc->vendor_err = CQE_STATUS(cqe);
|
||||||
wc->wc_flags = 0;
|
wc->wc_flags = 0;
|
||||||
|
|
||||||
@@ -182,8 +160,38 @@ static int iwch_poll_cq_one(struct iwch_dev *rhp, struct iwch_cq *chp,
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
out:
|
out:
|
||||||
if (wq)
|
return ret;
|
||||||
|
}
|
||||||
|
|
||||||
|
/*
|
||||||
|
* Get one cq entry from cxio and map it to openib.
|
||||||
|
*
|
||||||
|
* Returns:
|
||||||
|
* 0 EMPTY;
|
||||||
|
* 1 cqe returned
|
||||||
|
* -EAGAIN caller must try again
|
||||||
|
* any other -errno fatal error
|
||||||
|
*/
|
||||||
|
static int iwch_poll_cq_one(struct iwch_dev *rhp, struct iwch_cq *chp,
|
||||||
|
struct ib_wc *wc)
|
||||||
|
{
|
||||||
|
struct iwch_qp *qhp;
|
||||||
|
struct t3_cqe *rd_cqe;
|
||||||
|
int ret;
|
||||||
|
|
||||||
|
rd_cqe = cxio_next_cqe(&chp->cq);
|
||||||
|
|
||||||
|
if (!rd_cqe)
|
||||||
|
return 0;
|
||||||
|
|
||||||
|
qhp = get_qhp(rhp, CQE_QPID(*rd_cqe));
|
||||||
|
if (qhp) {
|
||||||
|
spin_lock(&qhp->lock);
|
||||||
|
ret = __iwch_poll_cq_one(rhp, chp, qhp, wc);
|
||||||
spin_unlock(&qhp->lock);
|
spin_unlock(&qhp->lock);
|
||||||
|
} else {
|
||||||
|
ret = __iwch_poll_cq_one(rhp, chp, NULL, wc);
|
||||||
|
}
|
||||||
return ret;
|
return ret;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
Reference in New Issue
Block a user