diff options
Diffstat (limited to 'drivers/infiniband/hw/nes/nes_hw.c')
-rw-r--r-- | drivers/infiniband/hw/nes/nes_hw.c | 60 |
1 files changed, 8 insertions, 52 deletions
diff --git a/drivers/infiniband/hw/nes/nes_hw.c b/drivers/infiniband/hw/nes/nes_hw.c index d3278f111ca7..80e486653ec9 100644 --- a/drivers/infiniband/hw/nes/nes_hw.c +++ b/drivers/infiniband/hw/nes/nes_hw.c | |||
@@ -2710,39 +2710,11 @@ static void nes_cqp_ce_handler(struct nes_device *nesdev, struct nes_hw_cq *cq) | |||
2710 | barrier(); | 2710 | barrier(); |
2711 | cqp_request->request_done = 1; | 2711 | cqp_request->request_done = 1; |
2712 | wake_up(&cqp_request->waitq); | 2712 | wake_up(&cqp_request->waitq); |
2713 | if (atomic_dec_and_test(&cqp_request->refcount)) { | 2713 | nes_put_cqp_request(nesdev, cqp_request); |
2714 | nes_debug(NES_DBG_CQP, "CQP request %p (opcode 0x%02X) freed.\n", | ||
2715 | cqp_request, | ||
2716 | le32_to_cpu(cqp_request->cqp_wqe.wqe_words[NES_CQP_WQE_OPCODE_IDX])&0x3f); | ||
2717 | if (cqp_request->dynamic) { | ||
2718 | kfree(cqp_request); | ||
2719 | } else { | ||
2720 | spin_lock_irqsave(&nesdev->cqp.lock, flags); | ||
2721 | list_add_tail(&cqp_request->list, &nesdev->cqp_avail_reqs); | ||
2722 | spin_unlock_irqrestore(&nesdev->cqp.lock, flags); | ||
2723 | } | ||
2724 | } | ||
2725 | } else if (cqp_request->callback) { | ||
2726 | /* Envoke the callback routine */ | ||
2727 | cqp_request->cqp_callback(nesdev, cqp_request); | ||
2728 | if (cqp_request->dynamic) { | ||
2729 | kfree(cqp_request); | ||
2730 | } else { | ||
2731 | spin_lock_irqsave(&nesdev->cqp.lock, flags); | ||
2732 | list_add_tail(&cqp_request->list, &nesdev->cqp_avail_reqs); | ||
2733 | spin_unlock_irqrestore(&nesdev->cqp.lock, flags); | ||
2734 | } | ||
2735 | } else { | 2714 | } else { |
2736 | nes_debug(NES_DBG_CQP, "CQP request %p (opcode 0x%02X) freed.\n", | 2715 | if (cqp_request->callback) |
2737 | cqp_request, | 2716 | cqp_request->cqp_callback(nesdev, cqp_request); |
2738 | le32_to_cpu(cqp_request->cqp_wqe.wqe_words[NES_CQP_WQE_OPCODE_IDX]) & 0x3f); | 2717 | nes_free_cqp_request(nesdev, cqp_request); |
2739 | if (cqp_request->dynamic) { | ||
2740 | kfree(cqp_request); | ||
2741 | } else { | ||
2742 | spin_lock_irqsave(&nesdev->cqp.lock, flags); | ||
2743 | list_add_tail(&cqp_request->list, &nesdev->cqp_avail_reqs); | ||
2744 | spin_unlock_irqrestore(&nesdev->cqp.lock, flags); | ||
2745 | } | ||
2746 | } | 2718 | } |
2747 | } else { | 2719 | } else { |
2748 | wake_up(&nesdev->cqp.waitq); | 2720 | wake_up(&nesdev->cqp.waitq); |
@@ -3149,7 +3121,6 @@ int nes_manage_apbvt(struct nes_vnic *nesvnic, u32 accel_local_port, | |||
3149 | { | 3121 | { |
3150 | struct nes_device *nesdev = nesvnic->nesdev; | 3122 | struct nes_device *nesdev = nesvnic->nesdev; |
3151 | struct nes_hw_cqp_wqe *cqp_wqe; | 3123 | struct nes_hw_cqp_wqe *cqp_wqe; |
3152 | unsigned long flags; | ||
3153 | struct nes_cqp_request *cqp_request; | 3124 | struct nes_cqp_request *cqp_request; |
3154 | int ret = 0; | 3125 | int ret = 0; |
3155 | u16 major_code; | 3126 | u16 major_code; |
@@ -3184,15 +3155,9 @@ int nes_manage_apbvt(struct nes_vnic *nesvnic, u32 accel_local_port, | |||
3184 | nes_debug(NES_DBG_QP, "Completed, ret=%u, CQP Major:Minor codes = 0x%04X:0x%04X\n", | 3155 | nes_debug(NES_DBG_QP, "Completed, ret=%u, CQP Major:Minor codes = 0x%04X:0x%04X\n", |
3185 | ret, cqp_request->major_code, cqp_request->minor_code); | 3156 | ret, cqp_request->major_code, cqp_request->minor_code); |
3186 | major_code = cqp_request->major_code; | 3157 | major_code = cqp_request->major_code; |
3187 | if (atomic_dec_and_test(&cqp_request->refcount)) { | 3158 | |
3188 | if (cqp_request->dynamic) { | 3159 | nes_put_cqp_request(nesdev, cqp_request); |
3189 | kfree(cqp_request); | 3160 | |
3190 | } else { | ||
3191 | spin_lock_irqsave(&nesdev->cqp.lock, flags); | ||
3192 | list_add_tail(&cqp_request->list, &nesdev->cqp_avail_reqs); | ||
3193 | spin_unlock_irqrestore(&nesdev->cqp.lock, flags); | ||
3194 | } | ||
3195 | } | ||
3196 | if (!ret) | 3161 | if (!ret) |
3197 | return -ETIME; | 3162 | return -ETIME; |
3198 | else if (major_code) | 3163 | else if (major_code) |
@@ -3262,7 +3227,6 @@ void nes_manage_arp_cache(struct net_device *netdev, unsigned char *mac_addr, | |||
3262 | void flush_wqes(struct nes_device *nesdev, struct nes_qp *nesqp, | 3227 | void flush_wqes(struct nes_device *nesdev, struct nes_qp *nesqp, |
3263 | u32 which_wq, u32 wait_completion) | 3228 | u32 which_wq, u32 wait_completion) |
3264 | { | 3229 | { |
3265 | unsigned long flags; | ||
3266 | struct nes_cqp_request *cqp_request; | 3230 | struct nes_cqp_request *cqp_request; |
3267 | struct nes_hw_cqp_wqe *cqp_wqe; | 3231 | struct nes_hw_cqp_wqe *cqp_wqe; |
3268 | int ret; | 3232 | int ret; |
@@ -3294,14 +3258,6 @@ void flush_wqes(struct nes_device *nesdev, struct nes_qp *nesqp, | |||
3294 | nes_debug(NES_DBG_QP, "Flush SQ QP WQEs completed, ret=%u," | 3258 | nes_debug(NES_DBG_QP, "Flush SQ QP WQEs completed, ret=%u," |
3295 | " CQP Major:Minor codes = 0x%04X:0x%04X\n", | 3259 | " CQP Major:Minor codes = 0x%04X:0x%04X\n", |
3296 | ret, cqp_request->major_code, cqp_request->minor_code); | 3260 | ret, cqp_request->major_code, cqp_request->minor_code); |
3297 | if (atomic_dec_and_test(&cqp_request->refcount)) { | 3261 | nes_put_cqp_request(nesdev, cqp_request); |
3298 | if (cqp_request->dynamic) { | ||
3299 | kfree(cqp_request); | ||
3300 | } else { | ||
3301 | spin_lock_irqsave(&nesdev->cqp.lock, flags); | ||
3302 | list_add_tail(&cqp_request->list, &nesdev->cqp_avail_reqs); | ||
3303 | spin_unlock_irqrestore(&nesdev->cqp.lock, flags); | ||
3304 | } | ||
3305 | } | ||
3306 | } | 3262 | } |
3307 | } | 3263 | } |