Skip to content

Commit 7b8943b

Browse files
tatyana-enjgunthorpe
authored andcommitted
RDMA/irdma: Flush iWARP QP if modified to ERR from RTR state
When connection establishment fails in iWARP mode, an app can drain the QPs and hang because flush isn't issued when the QP is modified from RTR state to error. Issue a flush in this case using function irdma_cm_disconn(). Update irdma_cm_disconn() to do flush when cm_id is NULL, which is the case when the QP is in RTR state and there is an error in the connection establishment. Fixes: b48c24c ("RDMA/irdma: Implement device supported verb APIs") Link: https://lore.kernel.org/r/20220425181703.1634-2-shiraz.saleem@intel.com Signed-off-by: Tatyana Nikolova <tatyana.e.nikolova@intel.com> Signed-off-by: Shiraz Saleem <shiraz.saleem@intel.com> Signed-off-by: Jason Gunthorpe <jgg@nvidia.com>
1 parent 570a4bf commit 7b8943b

2 files changed

Lines changed: 7 additions & 13 deletions

File tree

drivers/infiniband/hw/irdma/cm.c

Lines changed: 5 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -3462,12 +3462,6 @@ static void irdma_cm_disconn_true(struct irdma_qp *iwqp)
34623462
}
34633463

34643464
cm_id = iwqp->cm_id;
3465-
/* make sure we havent already closed this connection */
3466-
if (!cm_id) {
3467-
spin_unlock_irqrestore(&iwqp->lock, flags);
3468-
return;
3469-
}
3470-
34713465
original_hw_tcp_state = iwqp->hw_tcp_state;
34723466
original_ibqp_state = iwqp->ibqp_state;
34733467
last_ae = iwqp->last_aeq;
@@ -3489,11 +3483,11 @@ static void irdma_cm_disconn_true(struct irdma_qp *iwqp)
34893483
disconn_status = -ECONNRESET;
34903484
}
34913485

3492-
if ((original_hw_tcp_state == IRDMA_TCP_STATE_CLOSED ||
3493-
original_hw_tcp_state == IRDMA_TCP_STATE_TIME_WAIT ||
3494-
last_ae == IRDMA_AE_RDMAP_ROE_BAD_LLP_CLOSE ||
3495-
last_ae == IRDMA_AE_BAD_CLOSE ||
3496-
last_ae == IRDMA_AE_LLP_CONNECTION_RESET || iwdev->rf->reset)) {
3486+
if (original_hw_tcp_state == IRDMA_TCP_STATE_CLOSED ||
3487+
original_hw_tcp_state == IRDMA_TCP_STATE_TIME_WAIT ||
3488+
last_ae == IRDMA_AE_RDMAP_ROE_BAD_LLP_CLOSE ||
3489+
last_ae == IRDMA_AE_BAD_CLOSE ||
3490+
last_ae == IRDMA_AE_LLP_CONNECTION_RESET || iwdev->rf->reset || !cm_id) {
34973491
issue_close = 1;
34983492
iwqp->cm_id = NULL;
34993493
qp->term_flags = 0;

drivers/infiniband/hw/irdma/verbs.c

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1618,13 +1618,13 @@ int irdma_modify_qp(struct ib_qp *ibqp, struct ib_qp_attr *attr, int attr_mask,
16181618

16191619
if (issue_modify_qp && iwqp->ibqp_state > IB_QPS_RTS) {
16201620
if (dont_wait) {
1621-
if (iwqp->cm_id && iwqp->hw_tcp_state) {
1621+
if (iwqp->hw_tcp_state) {
16221622
spin_lock_irqsave(&iwqp->lock, flags);
16231623
iwqp->hw_tcp_state = IRDMA_TCP_STATE_CLOSED;
16241624
iwqp->last_aeq = IRDMA_AE_RESET_SENT;
16251625
spin_unlock_irqrestore(&iwqp->lock, flags);
1626-
irdma_cm_disconn(iwqp);
16271626
}
1627+
irdma_cm_disconn(iwqp);
16281628
} else {
16291629
int close_timer_started;
16301630

0 commit comments

Comments
 (0)