mirror of
https://github.com/joel16/android_kernel_sony_msm8994_rework.git
synced 2024-11-28 14:20:52 +00:00
RDMA/nes: Cleanup cqp_request list usage
Use nes_free_cqp_request() instead of open coding. Change some continue to break in nes_cm_timer_tick, because send_entry used to be a list processed in a loop (so continue went to the next item). Now it is a single item, so using break is correct. Signed-off-by: Faisal Latif <faisal.latif@intel.com> Signed-off-by: Chien Tung <chien.tin.tung@intel.com> Signed-off-by: Roland Dreier <rolandd@cisco.com>
This commit is contained in:
parent
061e41fdb5
commit
c5d321e5c9
@ -519,7 +519,7 @@ static void nes_cm_timer_tick(unsigned long pass)
|
|||||||
do {
|
do {
|
||||||
send_entry = cm_node->send_entry;
|
send_entry = cm_node->send_entry;
|
||||||
if (!send_entry)
|
if (!send_entry)
|
||||||
continue;
|
break;
|
||||||
if (time_after(send_entry->timetosend, jiffies)) {
|
if (time_after(send_entry->timetosend, jiffies)) {
|
||||||
if (cm_node->state != NES_CM_STATE_TSA) {
|
if (cm_node->state != NES_CM_STATE_TSA) {
|
||||||
if ((nexttimeout >
|
if ((nexttimeout >
|
||||||
@ -528,18 +528,18 @@ static void nes_cm_timer_tick(unsigned long pass)
|
|||||||
nexttimeout =
|
nexttimeout =
|
||||||
send_entry->timetosend;
|
send_entry->timetosend;
|
||||||
settimer = 1;
|
settimer = 1;
|
||||||
continue;
|
break;
|
||||||
}
|
}
|
||||||
} else {
|
} else {
|
||||||
free_retrans_entry(cm_node);
|
free_retrans_entry(cm_node);
|
||||||
continue;
|
break;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
if ((cm_node->state == NES_CM_STATE_TSA) ||
|
if ((cm_node->state == NES_CM_STATE_TSA) ||
|
||||||
(cm_node->state == NES_CM_STATE_CLOSED)) {
|
(cm_node->state == NES_CM_STATE_CLOSED)) {
|
||||||
free_retrans_entry(cm_node);
|
free_retrans_entry(cm_node);
|
||||||
continue;
|
break;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (!send_entry->retranscount ||
|
if (!send_entry->retranscount ||
|
||||||
@ -557,7 +557,7 @@ static void nes_cm_timer_tick(unsigned long pass)
|
|||||||
NES_CM_EVENT_ABORTED);
|
NES_CM_EVENT_ABORTED);
|
||||||
spin_lock_irqsave(&cm_node->retrans_list_lock,
|
spin_lock_irqsave(&cm_node->retrans_list_lock,
|
||||||
flags);
|
flags);
|
||||||
continue;
|
break;
|
||||||
}
|
}
|
||||||
atomic_inc(&send_entry->skb->users);
|
atomic_inc(&send_entry->skb->users);
|
||||||
cm_packets_retrans++;
|
cm_packets_retrans++;
|
||||||
@ -583,7 +583,7 @@ static void nes_cm_timer_tick(unsigned long pass)
|
|||||||
send_entry->retrycount--;
|
send_entry->retrycount--;
|
||||||
nexttimeout = jiffies + NES_SHORT_TIME;
|
nexttimeout = jiffies + NES_SHORT_TIME;
|
||||||
settimer = 1;
|
settimer = 1;
|
||||||
continue;
|
break;
|
||||||
} else {
|
} else {
|
||||||
cm_packets_sent++;
|
cm_packets_sent++;
|
||||||
}
|
}
|
||||||
|
@ -1695,13 +1695,8 @@ static struct ib_cq *nes_create_cq(struct ib_device *ibdev, int entries,
|
|||||||
/* use 4k pbl */
|
/* use 4k pbl */
|
||||||
nes_debug(NES_DBG_CQ, "pbl_entries=%u, use a 4k PBL\n", pbl_entries);
|
nes_debug(NES_DBG_CQ, "pbl_entries=%u, use a 4k PBL\n", pbl_entries);
|
||||||
if (nesadapter->free_4kpbl == 0) {
|
if (nesadapter->free_4kpbl == 0) {
|
||||||
if (cqp_request->dynamic) {
|
spin_unlock_irqrestore(&nesadapter->pbl_lock, flags);
|
||||||
spin_unlock_irqrestore(&nesadapter->pbl_lock, flags);
|
nes_free_cqp_request(nesdev, cqp_request);
|
||||||
kfree(cqp_request);
|
|
||||||
} else {
|
|
||||||
list_add_tail(&cqp_request->list, &nesdev->cqp_avail_reqs);
|
|
||||||
spin_unlock_irqrestore(&nesadapter->pbl_lock, flags);
|
|
||||||
}
|
|
||||||
if (!context)
|
if (!context)
|
||||||
pci_free_consistent(nesdev->pcidev, nescq->cq_mem_size, mem,
|
pci_free_consistent(nesdev->pcidev, nescq->cq_mem_size, mem,
|
||||||
nescq->hw_cq.cq_pbase);
|
nescq->hw_cq.cq_pbase);
|
||||||
@ -1717,13 +1712,8 @@ static struct ib_cq *nes_create_cq(struct ib_device *ibdev, int entries,
|
|||||||
/* use 256 byte pbl */
|
/* use 256 byte pbl */
|
||||||
nes_debug(NES_DBG_CQ, "pbl_entries=%u, use a 256 byte PBL\n", pbl_entries);
|
nes_debug(NES_DBG_CQ, "pbl_entries=%u, use a 256 byte PBL\n", pbl_entries);
|
||||||
if (nesadapter->free_256pbl == 0) {
|
if (nesadapter->free_256pbl == 0) {
|
||||||
if (cqp_request->dynamic) {
|
spin_unlock_irqrestore(&nesadapter->pbl_lock, flags);
|
||||||
spin_unlock_irqrestore(&nesadapter->pbl_lock, flags);
|
nes_free_cqp_request(nesdev, cqp_request);
|
||||||
kfree(cqp_request);
|
|
||||||
} else {
|
|
||||||
list_add_tail(&cqp_request->list, &nesdev->cqp_avail_reqs);
|
|
||||||
spin_unlock_irqrestore(&nesadapter->pbl_lock, flags);
|
|
||||||
}
|
|
||||||
if (!context)
|
if (!context)
|
||||||
pci_free_consistent(nesdev->pcidev, nescq->cq_mem_size, mem,
|
pci_free_consistent(nesdev->pcidev, nescq->cq_mem_size, mem,
|
||||||
nescq->hw_cq.cq_pbase);
|
nescq->hw_cq.cq_pbase);
|
||||||
@ -1928,13 +1918,8 @@ static int nes_reg_mr(struct nes_device *nesdev, struct nes_pd *nespd,
|
|||||||
/* Two level PBL */
|
/* Two level PBL */
|
||||||
if ((pbl_count+1) > nesadapter->free_4kpbl) {
|
if ((pbl_count+1) > nesadapter->free_4kpbl) {
|
||||||
nes_debug(NES_DBG_MR, "Out of 4KB Pbls for two level request.\n");
|
nes_debug(NES_DBG_MR, "Out of 4KB Pbls for two level request.\n");
|
||||||
if (cqp_request->dynamic) {
|
spin_unlock_irqrestore(&nesadapter->pbl_lock, flags);
|
||||||
spin_unlock_irqrestore(&nesadapter->pbl_lock, flags);
|
nes_free_cqp_request(nesdev, cqp_request);
|
||||||
kfree(cqp_request);
|
|
||||||
} else {
|
|
||||||
list_add_tail(&cqp_request->list, &nesdev->cqp_avail_reqs);
|
|
||||||
spin_unlock_irqrestore(&nesadapter->pbl_lock, flags);
|
|
||||||
}
|
|
||||||
return -ENOMEM;
|
return -ENOMEM;
|
||||||
} else {
|
} else {
|
||||||
nesadapter->free_4kpbl -= pbl_count+1;
|
nesadapter->free_4kpbl -= pbl_count+1;
|
||||||
@ -1942,13 +1927,8 @@ static int nes_reg_mr(struct nes_device *nesdev, struct nes_pd *nespd,
|
|||||||
} else if (residual_page_count > 32) {
|
} else if (residual_page_count > 32) {
|
||||||
if (pbl_count > nesadapter->free_4kpbl) {
|
if (pbl_count > nesadapter->free_4kpbl) {
|
||||||
nes_debug(NES_DBG_MR, "Out of 4KB Pbls.\n");
|
nes_debug(NES_DBG_MR, "Out of 4KB Pbls.\n");
|
||||||
if (cqp_request->dynamic) {
|
spin_unlock_irqrestore(&nesadapter->pbl_lock, flags);
|
||||||
spin_unlock_irqrestore(&nesadapter->pbl_lock, flags);
|
nes_free_cqp_request(nesdev, cqp_request);
|
||||||
kfree(cqp_request);
|
|
||||||
} else {
|
|
||||||
list_add_tail(&cqp_request->list, &nesdev->cqp_avail_reqs);
|
|
||||||
spin_unlock_irqrestore(&nesadapter->pbl_lock, flags);
|
|
||||||
}
|
|
||||||
return -ENOMEM;
|
return -ENOMEM;
|
||||||
} else {
|
} else {
|
||||||
nesadapter->free_4kpbl -= pbl_count;
|
nesadapter->free_4kpbl -= pbl_count;
|
||||||
@ -1956,13 +1936,8 @@ static int nes_reg_mr(struct nes_device *nesdev, struct nes_pd *nespd,
|
|||||||
} else {
|
} else {
|
||||||
if (pbl_count > nesadapter->free_256pbl) {
|
if (pbl_count > nesadapter->free_256pbl) {
|
||||||
nes_debug(NES_DBG_MR, "Out of 256B Pbls.\n");
|
nes_debug(NES_DBG_MR, "Out of 256B Pbls.\n");
|
||||||
if (cqp_request->dynamic) {
|
spin_unlock_irqrestore(&nesadapter->pbl_lock, flags);
|
||||||
spin_unlock_irqrestore(&nesadapter->pbl_lock, flags);
|
nes_free_cqp_request(nesdev, cqp_request);
|
||||||
kfree(cqp_request);
|
|
||||||
} else {
|
|
||||||
list_add_tail(&cqp_request->list, &nesdev->cqp_avail_reqs);
|
|
||||||
spin_unlock_irqrestore(&nesadapter->pbl_lock, flags);
|
|
||||||
}
|
|
||||||
return -ENOMEM;
|
return -ENOMEM;
|
||||||
} else {
|
} else {
|
||||||
nesadapter->free_256pbl -= pbl_count;
|
nesadapter->free_256pbl -= pbl_count;
|
||||||
|
Loading…
Reference in New Issue
Block a user