diff options
Diffstat (limited to 'sys/dev/cxgb/ulp/iw_cxgb/iw_cxgb_ev.c')
-rw-r--r-- | sys/dev/cxgb/ulp/iw_cxgb/iw_cxgb_ev.c | 55 |
1 files changed, 32 insertions, 23 deletions
diff --git a/sys/dev/cxgb/ulp/iw_cxgb/iw_cxgb_ev.c b/sys/dev/cxgb/ulp/iw_cxgb/iw_cxgb_ev.c index cf0891d7fe73..65b7a2d97dbc 100644 --- a/sys/dev/cxgb/ulp/iw_cxgb/iw_cxgb_ev.c +++ b/sys/dev/cxgb/ulp/iw_cxgb/iw_cxgb_ev.c @@ -29,11 +29,13 @@ POSSIBILITY OF SUCH DAMAGE. #include <sys/cdefs.h> __FBSDID("$FreeBSD$"); +#include "opt_inet.h" + +#ifdef TCP_OFFLOAD #include <sys/param.h> #include <sys/systm.h> #include <sys/kernel.h> #include <sys/bus.h> -#include <sys/module.h> #include <sys/pciio.h> #include <sys/conf.h> #include <machine/bus.h> @@ -59,9 +61,11 @@ __FBSDID("$FreeBSD$"); #include <netinet/in.h> -#include <contrib/rdma/ib_verbs.h> -#include <contrib/rdma/ib_umem.h> -#include <contrib/rdma/ib_user_verbs.h> +#include <rdma/ib_verbs.h> +#include <rdma/ib_umem.h> +#include <rdma/ib_user_verbs.h> +#include <linux/idr.h> +#include <ulp/iw_cxgb/iw_cxgb_ib_intfc.h> #include <cxgb_include.h> #include <ulp/iw_cxgb/iw_cxgb_wr.h> @@ -81,11 +85,22 @@ post_qp_event(struct iwch_dev *rnicp, struct iwch_qp *qhp, struct iwch_cq *chp, struct ib_event event; struct iwch_qp_attributes attrs; + mtx_lock(&rnicp->lock); + + if (!qhp) { + CTR3(KTR_IW_CXGB, "%s unaffiliated error 0x%x qpid 0x%x\n", + __func__, CQE_STATUS(rsp_msg->cqe), + CQE_QPID(rsp_msg->cqe)); + mtx_unlock(&rnicp->lock); + return; + } + if ((qhp->attr.state == IWCH_QP_STATE_ERROR) || (qhp->attr.state == IWCH_QP_STATE_TERMINATE)) { CTR4(KTR_IW_CXGB, "%s AE received after RTS - " "qp state %d qpid 0x%x status 0x%x", __FUNCTION__, qhp->attr.state, qhp->wq.qpid, CQE_STATUS(rsp_msg->cqe)); + mtx_unlock(&rnicp->lock); return; } @@ -95,6 +110,15 @@ post_qp_event(struct iwch_dev *rnicp, struct iwch_qp *qhp, struct iwch_cq *chp, CQE_STATUS(rsp_msg->cqe), CQE_TYPE(rsp_msg->cqe), CQE_WRID_HI(rsp_msg->cqe), CQE_WRID_LOW(rsp_msg->cqe)); + mtx_unlock(&rnicp->lock); + + if (qhp->attr.state == IWCH_QP_STATE_RTS) { + attrs.next_state = IWCH_QP_STATE_TERMINATE; + iwch_modify_qp(qhp->rhp, qhp, IWCH_QP_ATTR_NEXT_STATE, + &attrs, 1); + if (send_term) + iwch_post_terminate(qhp, rsp_msg); + } event.event = ib_event; event.device = chp->ibcq.device; @@ -106,25 +130,17 @@ post_qp_event(struct iwch_dev *rnicp, struct iwch_qp *qhp, struct iwch_cq *chp, if (qhp->ibqp.event_handler) (*qhp->ibqp.event_handler)(&event, qhp->ibqp.qp_context); - if (qhp->attr.state == IWCH_QP_STATE_RTS) { - attrs.next_state = IWCH_QP_STATE_TERMINATE; - iwch_modify_qp(qhp->rhp, qhp, IWCH_QP_ATTR_NEXT_STATE, - &attrs, 1); - if (send_term) - iwch_post_terminate(qhp, rsp_msg); - } + (*chp->ibcq.comp_handler)(&chp->ibcq, chp->ibcq.cq_context); } void -iwch_ev_dispatch(struct cxio_rdev *rdev_p, struct mbuf *m) +iwch_ev_dispatch(struct iwch_dev *rnicp, struct mbuf *m) { - struct iwch_dev *rnicp; struct respQ_msg_t *rsp_msg = (struct respQ_msg_t *) m->m_data; struct iwch_cq *chp; struct iwch_qp *qhp; u32 cqid = RSPQ_CQID(rsp_msg); - rnicp = (struct iwch_dev *) rdev_p->ulp; mtx_lock(&rnicp->lock); chp = get_chp(rnicp, cqid); qhp = get_qhp(rnicp, CQE_QPID(rsp_msg->cqe)); @@ -136,7 +152,7 @@ iwch_ev_dispatch(struct cxio_rdev *rdev_p, struct mbuf *m) CQE_TYPE(rsp_msg->cqe), CQE_WRID_HI(rsp_msg->cqe), CQE_WRID_LOW(rsp_msg->cqe)); mtx_unlock(&rnicp->lock); - goto out; + return; } iwch_qp_add_ref(&qhp->ibqp); mtx_lock(&chp->lock); @@ -200,12 +216,6 @@ iwch_ev_dispatch(struct cxio_rdev *rdev_p, struct mbuf *m) case TPT_ERR_BOUND: case TPT_ERR_INVALIDATE_SHARED_MR: case TPT_ERR_INVALIDATE_MR_WITH_MW_BOUND: - log(LOG_ERR, "%s - CQE Err qpid 0x%x opcode %d status 0x%x " - "type %d wrid.hi 0x%x wrid.lo 0x%x \n", __FUNCTION__, - CQE_QPID(rsp_msg->cqe), CQE_OPCODE(rsp_msg->cqe), - CQE_STATUS(rsp_msg->cqe), CQE_TYPE(rsp_msg->cqe), - CQE_WRID_HI(rsp_msg->cqe), CQE_WRID_LOW(rsp_msg->cqe)); - (*chp->ibcq.comp_handler)(&chp->ibcq, chp->ibcq.cq_context); post_qp_event(rnicp, qhp, chp, rsp_msg, IB_EVENT_QP_ACCESS_ERR, 1); break; @@ -248,6 +258,5 @@ done: wakeup(chp); mtx_unlock(&chp->lock); iwch_qp_rem_ref(&qhp->ibqp); -out: - m_free(m); } +#endif |