diff options
| -rw-r--r-- | drivers/infiniband/hw/nes/nes_hw.c | 88 |
1 files changed, 28 insertions, 60 deletions
diff --git a/drivers/infiniband/hw/nes/nes_hw.c b/drivers/infiniband/hw/nes/nes_hw.c index b1c2cbb88f09..310cc7cab396 100644 --- a/drivers/infiniband/hw/nes/nes_hw.c +++ b/drivers/infiniband/hw/nes/nes_hw.c | |||
| @@ -3352,8 +3352,6 @@ static void nes_process_iwarp_aeqe(struct nes_device *nesdev, | |||
| 3352 | u16 async_event_id; | 3352 | u16 async_event_id; |
| 3353 | u8 tcp_state; | 3353 | u8 tcp_state; |
| 3354 | u8 iwarp_state; | 3354 | u8 iwarp_state; |
| 3355 | int must_disconn = 1; | ||
| 3356 | int must_terminate = 0; | ||
| 3357 | struct ib_event ibevent; | 3355 | struct ib_event ibevent; |
| 3358 | 3356 | ||
| 3359 | nes_debug(NES_DBG_AEQ, "\n"); | 3357 | nes_debug(NES_DBG_AEQ, "\n"); |
| @@ -3367,6 +3365,8 @@ static void nes_process_iwarp_aeqe(struct nes_device *nesdev, | |||
| 3367 | BUG_ON(!context); | 3365 | BUG_ON(!context); |
| 3368 | } | 3366 | } |
| 3369 | 3367 | ||
| 3368 | /* context is nesqp unless async_event_id == CQ ERROR */ | ||
| 3369 | nesqp = (struct nes_qp *)(unsigned long)context; | ||
| 3370 | async_event_id = (u16)aeq_info; | 3370 | async_event_id = (u16)aeq_info; |
| 3371 | tcp_state = (aeq_info & NES_AEQE_TCP_STATE_MASK) >> NES_AEQE_TCP_STATE_SHIFT; | 3371 | tcp_state = (aeq_info & NES_AEQE_TCP_STATE_MASK) >> NES_AEQE_TCP_STATE_SHIFT; |
| 3372 | iwarp_state = (aeq_info & NES_AEQE_IWARP_STATE_MASK) >> NES_AEQE_IWARP_STATE_SHIFT; | 3372 | iwarp_state = (aeq_info & NES_AEQE_IWARP_STATE_MASK) >> NES_AEQE_IWARP_STATE_SHIFT; |
| @@ -3378,8 +3378,6 @@ static void nes_process_iwarp_aeqe(struct nes_device *nesdev, | |||
| 3378 | 3378 | ||
| 3379 | switch (async_event_id) { | 3379 | switch (async_event_id) { |
| 3380 | case NES_AEQE_AEID_LLP_FIN_RECEIVED: | 3380 | case NES_AEQE_AEID_LLP_FIN_RECEIVED: |
| 3381 | nesqp = (struct nes_qp *)(unsigned long)context; | ||
| 3382 | |||
| 3383 | if (nesqp->term_flags) | 3381 | if (nesqp->term_flags) |
| 3384 | return; /* Ignore it, wait for close complete */ | 3382 | return; /* Ignore it, wait for close complete */ |
| 3385 | 3383 | ||
| @@ -3394,79 +3392,48 @@ static void nes_process_iwarp_aeqe(struct nes_device *nesdev, | |||
| 3394 | async_event_id, nesqp->last_aeq, tcp_state); | 3392 | async_event_id, nesqp->last_aeq, tcp_state); |
| 3395 | } | 3393 | } |
| 3396 | 3394 | ||
| 3397 | if ((tcp_state != NES_AEQE_TCP_STATE_CLOSE_WAIT) || | 3395 | break; |
| 3398 | (nesqp->ibqp_state != IB_QPS_RTS)) { | ||
| 3399 | /* FIN Received but tcp state or IB state moved on, | ||
| 3400 | should expect a close complete */ | ||
| 3401 | return; | ||
| 3402 | } | ||
| 3403 | |||
| 3404 | case NES_AEQE_AEID_LLP_CLOSE_COMPLETE: | 3396 | case NES_AEQE_AEID_LLP_CLOSE_COMPLETE: |
| 3405 | nesqp = (struct nes_qp *)(unsigned long)context; | ||
| 3406 | if (nesqp->term_flags) { | 3397 | if (nesqp->term_flags) { |
| 3407 | nes_terminate_done(nesqp, 0); | 3398 | nes_terminate_done(nesqp, 0); |
| 3408 | return; | 3399 | return; |
| 3409 | } | 3400 | } |
| 3401 | spin_lock_irqsave(&nesqp->lock, flags); | ||
| 3402 | nesqp->hw_iwarp_state = NES_AEQE_IWARP_STATE_CLOSING; | ||
| 3403 | spin_unlock_irqrestore(&nesqp->lock, flags); | ||
| 3404 | nes_hw_modify_qp(nesdev, nesqp, NES_CQP_QP_IWARP_STATE_CLOSING, 0, 0); | ||
| 3405 | nes_cm_disconn(nesqp); | ||
| 3406 | break; | ||
| 3410 | 3407 | ||
| 3411 | case NES_AEQE_AEID_LLP_CONNECTION_RESET: | ||
| 3412 | case NES_AEQE_AEID_RESET_SENT: | 3408 | case NES_AEQE_AEID_RESET_SENT: |
| 3413 | nesqp = (struct nes_qp *)(unsigned long)context; | 3409 | tcp_state = NES_AEQE_TCP_STATE_CLOSED; |
| 3414 | if (async_event_id == NES_AEQE_AEID_RESET_SENT) { | ||
| 3415 | tcp_state = NES_AEQE_TCP_STATE_CLOSED; | ||
| 3416 | } | ||
| 3417 | spin_lock_irqsave(&nesqp->lock, flags); | 3410 | spin_lock_irqsave(&nesqp->lock, flags); |
| 3418 | nesqp->hw_iwarp_state = iwarp_state; | 3411 | nesqp->hw_iwarp_state = iwarp_state; |
| 3419 | nesqp->hw_tcp_state = tcp_state; | 3412 | nesqp->hw_tcp_state = tcp_state; |
| 3420 | nesqp->last_aeq = async_event_id; | 3413 | nesqp->last_aeq = async_event_id; |
| 3421 | 3414 | nesqp->hte_added = 0; | |
| 3422 | if ((tcp_state == NES_AEQE_TCP_STATE_CLOSED) || | ||
| 3423 | (tcp_state == NES_AEQE_TCP_STATE_TIME_WAIT)) { | ||
| 3424 | nesqp->hte_added = 0; | ||
| 3425 | next_iwarp_state = NES_CQP_QP_IWARP_STATE_ERROR | NES_CQP_QP_DEL_HTE; | ||
| 3426 | } | ||
| 3427 | |||
| 3428 | if ((nesqp->ibqp_state == IB_QPS_RTS) && | ||
| 3429 | ((tcp_state == NES_AEQE_TCP_STATE_CLOSE_WAIT) || | ||
| 3430 | (async_event_id == NES_AEQE_AEID_LLP_CONNECTION_RESET))) { | ||
| 3431 | switch (nesqp->hw_iwarp_state) { | ||
| 3432 | case NES_AEQE_IWARP_STATE_RTS: | ||
| 3433 | next_iwarp_state = NES_CQP_QP_IWARP_STATE_CLOSING; | ||
| 3434 | nesqp->hw_iwarp_state = NES_AEQE_IWARP_STATE_CLOSING; | ||
| 3435 | break; | ||
| 3436 | case NES_AEQE_IWARP_STATE_TERMINATE: | ||
| 3437 | must_disconn = 0; /* terminate path takes care of disconn */ | ||
| 3438 | if (nesqp->term_flags == 0) | ||
| 3439 | must_terminate = 1; | ||
| 3440 | break; | ||
| 3441 | } | ||
| 3442 | } else { | ||
| 3443 | if (async_event_id == NES_AEQE_AEID_LLP_FIN_RECEIVED) { | ||
| 3444 | /* FIN Received but ib state not RTS, | ||
| 3445 | close complete will be on its way */ | ||
| 3446 | must_disconn = 0; | ||
| 3447 | } | ||
| 3448 | } | ||
| 3449 | spin_unlock_irqrestore(&nesqp->lock, flags); | 3415 | spin_unlock_irqrestore(&nesqp->lock, flags); |
| 3416 | next_iwarp_state = NES_CQP_QP_IWARP_STATE_ERROR | NES_CQP_QP_DEL_HTE; | ||
| 3417 | nes_hw_modify_qp(nesdev, nesqp, next_iwarp_state, 0, 0); | ||
| 3418 | nes_cm_disconn(nesqp); | ||
| 3419 | break; | ||
| 3450 | 3420 | ||
| 3451 | if (must_terminate) | 3421 | case NES_AEQE_AEID_LLP_CONNECTION_RESET: |
| 3452 | nes_terminate_connection(nesdev, nesqp, aeqe, IB_EVENT_QP_FATAL); | 3422 | if (atomic_read(&nesqp->close_timer_started)) |
| 3453 | else if (must_disconn) { | 3423 | return; |
| 3454 | if (next_iwarp_state) { | 3424 | spin_lock_irqsave(&nesqp->lock, flags); |
| 3455 | nes_debug(NES_DBG_AEQ, "issuing hw modifyqp for QP%u. next state = 0x%08X\n", | 3425 | nesqp->hw_iwarp_state = iwarp_state; |
| 3456 | nesqp->hwqp.qp_id, next_iwarp_state); | 3426 | nesqp->hw_tcp_state = tcp_state; |
| 3457 | nes_hw_modify_qp(nesdev, nesqp, next_iwarp_state, 0, 0); | 3427 | nesqp->last_aeq = async_event_id; |
| 3458 | } | 3428 | spin_unlock_irqrestore(&nesqp->lock, flags); |
| 3459 | nes_cm_disconn(nesqp); | 3429 | nes_cm_disconn(nesqp); |
| 3460 | } | ||
| 3461 | break; | 3430 | break; |
| 3462 | 3431 | ||
| 3463 | case NES_AEQE_AEID_TERMINATE_SENT: | 3432 | case NES_AEQE_AEID_TERMINATE_SENT: |
| 3464 | nesqp = (struct nes_qp *)(unsigned long)context; | ||
| 3465 | nes_terminate_send_fin(nesdev, nesqp, aeqe); | 3433 | nes_terminate_send_fin(nesdev, nesqp, aeqe); |
| 3466 | break; | 3434 | break; |
| 3467 | 3435 | ||
| 3468 | case NES_AEQE_AEID_LLP_TERMINATE_RECEIVED: | 3436 | case NES_AEQE_AEID_LLP_TERMINATE_RECEIVED: |
| 3469 | nesqp = (struct nes_qp *)(unsigned long)context; | ||
| 3470 | nes_terminate_received(nesdev, nesqp, aeqe); | 3437 | nes_terminate_received(nesdev, nesqp, aeqe); |
| 3471 | break; | 3438 | break; |
| 3472 | 3439 | ||
| @@ -3480,7 +3447,8 @@ static void nes_process_iwarp_aeqe(struct nes_device *nesdev, | |||
| 3480 | case NES_AEQE_AEID_DDP_UBE_DDP_MESSAGE_TOO_LONG_FOR_AVAILABLE_BUFFER: | 3447 | case NES_AEQE_AEID_DDP_UBE_DDP_MESSAGE_TOO_LONG_FOR_AVAILABLE_BUFFER: |
| 3481 | case NES_AEQE_AEID_AMP_BOUNDS_VIOLATION: | 3448 | case NES_AEQE_AEID_AMP_BOUNDS_VIOLATION: |
| 3482 | case NES_AEQE_AEID_AMP_TO_WRAP: | 3449 | case NES_AEQE_AEID_AMP_TO_WRAP: |
| 3483 | nesqp = (struct nes_qp *)(unsigned long)context; | 3450 | printk(KERN_ERR PFX "QP[%u] async_event_id=0x%04X IB_EVENT_QP_ACCESS_ERR\n", |
| 3451 | nesqp->hwqp.qp_id, async_event_id); | ||
| 3484 | nes_terminate_connection(nesdev, nesqp, aeqe, IB_EVENT_QP_ACCESS_ERR); | 3452 | nes_terminate_connection(nesdev, nesqp, aeqe, IB_EVENT_QP_ACCESS_ERR); |
| 3485 | break; | 3453 | break; |
| 3486 | 3454 | ||
| @@ -3488,7 +3456,6 @@ static void nes_process_iwarp_aeqe(struct nes_device *nesdev, | |||
| 3488 | case NES_AEQE_AEID_LLP_SEGMENT_TOO_SMALL: | 3456 | case NES_AEQE_AEID_LLP_SEGMENT_TOO_SMALL: |
| 3489 | case NES_AEQE_AEID_DDP_UBE_INVALID_MO: | 3457 | case NES_AEQE_AEID_DDP_UBE_INVALID_MO: |
| 3490 | case NES_AEQE_AEID_DDP_UBE_INVALID_QN: | 3458 | case NES_AEQE_AEID_DDP_UBE_INVALID_QN: |
| 3491 | nesqp = (struct nes_qp *)(unsigned long)context; | ||
| 3492 | if (iwarp_opcode(nesqp, aeq_info) > IWARP_OPCODE_TERM) { | 3459 | if (iwarp_opcode(nesqp, aeq_info) > IWARP_OPCODE_TERM) { |
| 3493 | aeq_info &= 0xffff0000; | 3460 | aeq_info &= 0xffff0000; |
| 3494 | aeq_info |= NES_AEQE_AEID_RDMAP_ROE_UNEXPECTED_OPCODE; | 3461 | aeq_info |= NES_AEQE_AEID_RDMAP_ROE_UNEXPECTED_OPCODE; |
| @@ -3530,7 +3497,8 @@ static void nes_process_iwarp_aeqe(struct nes_device *nesdev, | |||
| 3530 | case NES_AEQE_AEID_STAG_ZERO_INVALID: | 3497 | case NES_AEQE_AEID_STAG_ZERO_INVALID: |
| 3531 | case NES_AEQE_AEID_ROE_INVALID_RDMA_READ_REQUEST: | 3498 | case NES_AEQE_AEID_ROE_INVALID_RDMA_READ_REQUEST: |
| 3532 | case NES_AEQE_AEID_ROE_INVALID_RDMA_WRITE_OR_READ_RESP: | 3499 | case NES_AEQE_AEID_ROE_INVALID_RDMA_WRITE_OR_READ_RESP: |
| 3533 | nesqp = (struct nes_qp *)(unsigned long)context; | 3500 | printk(KERN_ERR PFX "QP[%u] async_event_id=0x%04X IB_EVENT_QP_FATAL\n", |
| 3501 | nesqp->hwqp.qp_id, async_event_id); | ||
| 3534 | nes_terminate_connection(nesdev, nesqp, aeqe, IB_EVENT_QP_FATAL); | 3502 | nes_terminate_connection(nesdev, nesqp, aeqe, IB_EVENT_QP_FATAL); |
| 3535 | break; | 3503 | break; |
| 3536 | 3504 | ||
