diff options
Diffstat (limited to 'drivers/infiniband/hw/nes/nes_hw.c')
-rw-r--r-- | drivers/infiniband/hw/nes/nes_hw.c | 68 |
1 files changed, 12 insertions, 56 deletions
diff --git a/drivers/infiniband/hw/nes/nes_hw.c b/drivers/infiniband/hw/nes/nes_hw.c index d3278f111ca7..85f26d19a32b 100644 --- a/drivers/infiniband/hw/nes/nes_hw.c +++ b/drivers/infiniband/hw/nes/nes_hw.c | |||
@@ -398,7 +398,7 @@ struct nes_adapter *nes_init_adapter(struct nes_device *nesdev, u8 hw_rev) { | |||
398 | nesadapter->base_pd = 1; | 398 | nesadapter->base_pd = 1; |
399 | 399 | ||
400 | nesadapter->device_cap_flags = | 400 | nesadapter->device_cap_flags = |
401 | IB_DEVICE_ZERO_STAG | IB_DEVICE_MEM_WINDOW; | 401 | IB_DEVICE_LOCAL_DMA_LKEY | IB_DEVICE_MEM_WINDOW; |
402 | 402 | ||
403 | nesadapter->allocated_qps = (unsigned long *)&(((unsigned char *)nesadapter) | 403 | nesadapter->allocated_qps = (unsigned long *)&(((unsigned char *)nesadapter) |
404 | [(sizeof(struct nes_adapter)+(sizeof(unsigned long)-1))&(~(sizeof(unsigned long)-1))]); | 404 | [(sizeof(struct nes_adapter)+(sizeof(unsigned long)-1))&(~(sizeof(unsigned long)-1))]); |
@@ -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; |
@@ -3176,7 +3147,7 @@ int nes_manage_apbvt(struct nes_vnic *nesvnic, u32 accel_local_port, | |||
3176 | nes_debug(NES_DBG_QP, "Waiting for CQP completion for APBVT.\n"); | 3147 | nes_debug(NES_DBG_QP, "Waiting for CQP completion for APBVT.\n"); |
3177 | 3148 | ||
3178 | atomic_set(&cqp_request->refcount, 2); | 3149 | atomic_set(&cqp_request->refcount, 2); |
3179 | nes_post_cqp_request(nesdev, cqp_request, NES_CQP_REQUEST_RING_DOORBELL); | 3150 | nes_post_cqp_request(nesdev, cqp_request); |
3180 | 3151 | ||
3181 | if (add_port == NES_MANAGE_APBVT_ADD) | 3152 | if (add_port == NES_MANAGE_APBVT_ADD) |
3182 | ret = wait_event_timeout(cqp_request->waitq, (cqp_request->request_done != 0), | 3153 | ret = wait_event_timeout(cqp_request->waitq, (cqp_request->request_done != 0), |
@@ -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) |
@@ -3252,7 +3217,7 @@ void nes_manage_arp_cache(struct net_device *netdev, unsigned char *mac_addr, | |||
3252 | nesdev->cqp.sq_head, nesdev->cqp.sq_tail); | 3217 | nesdev->cqp.sq_head, nesdev->cqp.sq_tail); |
3253 | 3218 | ||
3254 | atomic_set(&cqp_request->refcount, 1); | 3219 | atomic_set(&cqp_request->refcount, 1); |
3255 | nes_post_cqp_request(nesdev, cqp_request, NES_CQP_REQUEST_RING_DOORBELL); | 3220 | nes_post_cqp_request(nesdev, cqp_request); |
3256 | } | 3221 | } |
3257 | 3222 | ||
3258 | 3223 | ||
@@ -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; |
@@ -3285,7 +3249,7 @@ void flush_wqes(struct nes_device *nesdev, struct nes_qp *nesqp, | |||
3285 | cpu_to_le32(NES_CQP_FLUSH_WQES | which_wq); | 3249 | cpu_to_le32(NES_CQP_FLUSH_WQES | which_wq); |
3286 | cqp_wqe->wqe_words[NES_CQP_WQE_ID_IDX] = cpu_to_le32(nesqp->hwqp.qp_id); | 3250 | cqp_wqe->wqe_words[NES_CQP_WQE_ID_IDX] = cpu_to_le32(nesqp->hwqp.qp_id); |
3287 | 3251 | ||
3288 | nes_post_cqp_request(nesdev, cqp_request, NES_CQP_REQUEST_RING_DOORBELL); | 3252 | nes_post_cqp_request(nesdev, cqp_request); |
3289 | 3253 | ||
3290 | if (wait_completion) { | 3254 | if (wait_completion) { |
3291 | /* Wait for CQP */ | 3255 | /* Wait for CQP */ |
@@ -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 | } |