cxgbe/iw_cxgbe: Fail early in some callbacks when the RNIC is stopped.
Stop allocating new resources when the RNIC is stopped but continue to allow previously allocated resources to be freed. Note that t4_tom's uld_stop tears down all TOE connections, including those being used for iWARP, and that triggers the cleanup of iWARP resources. Fail post_send/post_recv early too to avoid the SQ doorbell. MFC after: 1 week Sponsored by: Chelsio Communications
This commit is contained in:
@@ -2602,6 +2602,8 @@ int c4iw_connect(struct iw_cm_id *cm_id, struct iw_cm_conn_param *conn_param)
|
||||
|
||||
CTR2(KTR_IW_CXGBE, "%s:ccB %p", __func__, cm_id);
|
||||
|
||||
if (__predict_false(c4iw_stopped(&dev->rdev)))
|
||||
return -EIO;
|
||||
|
||||
if ((conn_param->ord > c4iw_max_read_depth) ||
|
||||
(conn_param->ird > c4iw_max_read_depth)) {
|
||||
|
||||
@@ -106,6 +106,8 @@ create_cq(struct c4iw_rdev *rdev, struct t4_cq *cq,
|
||||
struct wrqe *wr;
|
||||
u64 cq_bar2_qoffset = 0;
|
||||
|
||||
if (__predict_false(c4iw_stopped(rdev)))
|
||||
return -EIO;
|
||||
cq->cqid = c4iw_get_cqid(rdev, uctx);
|
||||
if (!cq->cqid) {
|
||||
ret = -ENOMEM;
|
||||
@@ -1037,6 +1039,8 @@ int c4iw_arm_cq(struct ib_cq *ibcq, enum ib_cq_notify_flags flags)
|
||||
unsigned long flag;
|
||||
|
||||
chp = to_c4iw_cq(ibcq);
|
||||
if (__predict_false(c4iw_stopped(chp->cq.rdev)))
|
||||
return -EIO;
|
||||
spin_lock_irqsave(&chp->lock, flag);
|
||||
t4_arm_cq(&chp->cq,
|
||||
(flags & IB_CQ_SOLICITED_MASK) == IB_CQ_SOLICITED);
|
||||
|
||||
@@ -621,6 +621,9 @@ struct ib_mr *c4iw_alloc_mr(struct ib_pd *pd,
|
||||
php = to_c4iw_pd(pd);
|
||||
rhp = php->rhp;
|
||||
|
||||
if (__predict_false(c4iw_stopped(&rhp->rdev)))
|
||||
return ERR_PTR(-EIO);
|
||||
|
||||
if (mr_type != IB_MR_TYPE_MEM_REG ||
|
||||
max_num_sg > t4_max_fr_depth(&rhp->rdev, use_dsgl))
|
||||
return ERR_PTR(-EINVAL);
|
||||
|
||||
@@ -231,6 +231,8 @@ c4iw_allocate_pd(struct ib_pd *pd, struct ib_udata *udata)
|
||||
CTR4(KTR_IW_CXGBE, "%s: ibdev %p, pd %p, data %p", __func__, ibdev,
|
||||
pd, udata);
|
||||
rhp = (struct c4iw_dev *) ibdev;
|
||||
if (__predict_false(c4iw_stopped(&rhp->rdev)))
|
||||
return -EIO;
|
||||
pdid = c4iw_get_resource(&rhp->rdev.resource.pdid_table);
|
||||
if (!pdid)
|
||||
return -EINVAL;
|
||||
|
||||
@@ -138,6 +138,9 @@ static int create_qp(struct c4iw_rdev *rdev, struct t4_wq *wq,
|
||||
struct wrqe *wr;
|
||||
u64 sq_bar2_qoffset = 0, rq_bar2_qoffset = 0;
|
||||
|
||||
if (__predict_false(c4iw_stopped(rdev)))
|
||||
return -EIO;
|
||||
|
||||
wq->sq.qid = c4iw_get_qpid(rdev, uctx);
|
||||
if (!wq->sq.qid)
|
||||
return -ENOMEM;
|
||||
@@ -785,6 +788,8 @@ int c4iw_post_send(struct ib_qp *ibqp, const struct ib_send_wr *wr,
|
||||
|
||||
qhp = to_c4iw_qp(ibqp);
|
||||
rdev = &qhp->rhp->rdev;
|
||||
if (__predict_false(c4iw_stopped(rdev)))
|
||||
return -EIO;
|
||||
spin_lock_irqsave(&qhp->lock, flag);
|
||||
if (t4_wq_in_error(&qhp->wq)) {
|
||||
spin_unlock_irqrestore(&qhp->lock, flag);
|
||||
@@ -920,6 +925,8 @@ int c4iw_post_receive(struct ib_qp *ibqp, const struct ib_recv_wr *wr,
|
||||
u16 idx = 0;
|
||||
|
||||
qhp = to_c4iw_qp(ibqp);
|
||||
if (__predict_false(c4iw_stopped(&qhp->rhp->rdev)))
|
||||
return -EIO;
|
||||
spin_lock_irqsave(&qhp->lock, flag);
|
||||
if (t4_wq_in_error(&qhp->wq)) {
|
||||
spin_unlock_irqrestore(&qhp->lock, flag);
|
||||
|
||||
Reference in New Issue
Block a user