aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorFaisal Latif <faisal.latif@intel.com>2008-11-21 21:50:38 -0500
committerRoland Dreier <rolandd@cisco.com>2008-12-05 13:59:53 -0500
commitc5d321e5c924384cf5b35f6288d69e9237490565 (patch)
tree46ac4732ce7cae568239ba0ae2c08a599f9e1179
parent061e41fdb5047b1fb161e89664057835935ca1d2 (diff)
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>
-rw-r--r--drivers/infiniband/hw/nes/nes_cm.c12
-rw-r--r--drivers/infiniband/hw/nes/nes_verbs.c45
2 files changed, 16 insertions, 41 deletions
diff --git a/drivers/infiniband/hw/nes/nes_cm.c b/drivers/infiniband/hw/nes/nes_cm.c
index 2caf9da81ad5..2a1d6c7f8d32 100644
--- a/drivers/infiniband/hw/nes/nes_cm.c
+++ b/drivers/infiniband/hw/nes/nes_cm.c
@@ -519,7 +519,7 @@ static void nes_cm_timer_tick(unsigned long pass)
519 do { 519 do {
520 send_entry = cm_node->send_entry; 520 send_entry = cm_node->send_entry;
521 if (!send_entry) 521 if (!send_entry)
522 continue; 522 break;
523 if (time_after(send_entry->timetosend, jiffies)) { 523 if (time_after(send_entry->timetosend, jiffies)) {
524 if (cm_node->state != NES_CM_STATE_TSA) { 524 if (cm_node->state != NES_CM_STATE_TSA) {
525 if ((nexttimeout > 525 if ((nexttimeout >
@@ -528,18 +528,18 @@ static void nes_cm_timer_tick(unsigned long pass)
528 nexttimeout = 528 nexttimeout =
529 send_entry->timetosend; 529 send_entry->timetosend;
530 settimer = 1; 530 settimer = 1;
531 continue; 531 break;
532 } 532 }
533 } else { 533 } else {
534 free_retrans_entry(cm_node); 534 free_retrans_entry(cm_node);
535 continue; 535 break;
536 } 536 }
537 } 537 }
538 538
539 if ((cm_node->state == NES_CM_STATE_TSA) || 539 if ((cm_node->state == NES_CM_STATE_TSA) ||
540 (cm_node->state == NES_CM_STATE_CLOSED)) { 540 (cm_node->state == NES_CM_STATE_CLOSED)) {
541 free_retrans_entry(cm_node); 541 free_retrans_entry(cm_node);
542 continue; 542 break;
543 } 543 }
544 544
545 if (!send_entry->retranscount || 545 if (!send_entry->retranscount ||
@@ -557,7 +557,7 @@ static void nes_cm_timer_tick(unsigned long pass)
557 NES_CM_EVENT_ABORTED); 557 NES_CM_EVENT_ABORTED);
558 spin_lock_irqsave(&cm_node->retrans_list_lock, 558 spin_lock_irqsave(&cm_node->retrans_list_lock,
559 flags); 559 flags);
560 continue; 560 break;
561 } 561 }
562 atomic_inc(&send_entry->skb->users); 562 atomic_inc(&send_entry->skb->users);
563 cm_packets_retrans++; 563 cm_packets_retrans++;
@@ -583,7 +583,7 @@ static void nes_cm_timer_tick(unsigned long pass)
583 send_entry->retrycount--; 583 send_entry->retrycount--;
584 nexttimeout = jiffies + NES_SHORT_TIME; 584 nexttimeout = jiffies + NES_SHORT_TIME;
585 settimer = 1; 585 settimer = 1;
586 continue; 586 break;
587 } else { 587 } else {
588 cm_packets_sent++; 588 cm_packets_sent++;
589 } 589 }
diff --git a/drivers/infiniband/hw/nes/nes_verbs.c b/drivers/infiniband/hw/nes/nes_verbs.c
index d36c9a0bf1bb..4fdb72454f94 100644
--- a/drivers/infiniband/hw/nes/nes_verbs.c
+++ b/drivers/infiniband/hw/nes/nes_verbs.c
@@ -1695,13 +1695,8 @@ static struct ib_cq *nes_create_cq(struct ib_device *ibdev, int entries,
1695 /* use 4k pbl */ 1695 /* use 4k pbl */
1696 nes_debug(NES_DBG_CQ, "pbl_entries=%u, use a 4k PBL\n", pbl_entries); 1696 nes_debug(NES_DBG_CQ, "pbl_entries=%u, use a 4k PBL\n", pbl_entries);
1697 if (nesadapter->free_4kpbl == 0) { 1697 if (nesadapter->free_4kpbl == 0) {
1698 if (cqp_request->dynamic) { 1698 spin_unlock_irqrestore(&nesadapter->pbl_lock, flags);
1699 spin_unlock_irqrestore(&nesadapter->pbl_lock, flags); 1699 nes_free_cqp_request(nesdev, cqp_request);
1700 kfree(cqp_request);
1701 } else {
1702 list_add_tail(&cqp_request->list, &nesdev->cqp_avail_reqs);
1703 spin_unlock_irqrestore(&nesadapter->pbl_lock, flags);
1704 }
1705 if (!context) 1700 if (!context)
1706 pci_free_consistent(nesdev->pcidev, nescq->cq_mem_size, mem, 1701 pci_free_consistent(nesdev->pcidev, nescq->cq_mem_size, mem,
1707 nescq->hw_cq.cq_pbase); 1702 nescq->hw_cq.cq_pbase);
@@ -1717,13 +1712,8 @@ static struct ib_cq *nes_create_cq(struct ib_device *ibdev, int entries,
1717 /* use 256 byte pbl */ 1712 /* use 256 byte pbl */
1718 nes_debug(NES_DBG_CQ, "pbl_entries=%u, use a 256 byte PBL\n", pbl_entries); 1713 nes_debug(NES_DBG_CQ, "pbl_entries=%u, use a 256 byte PBL\n", pbl_entries);
1719 if (nesadapter->free_256pbl == 0) { 1714 if (nesadapter->free_256pbl == 0) {
1720 if (cqp_request->dynamic) { 1715 spin_unlock_irqrestore(&nesadapter->pbl_lock, flags);
1721 spin_unlock_irqrestore(&nesadapter->pbl_lock, flags); 1716 nes_free_cqp_request(nesdev, cqp_request);
1722 kfree(cqp_request);
1723 } else {
1724 list_add_tail(&cqp_request->list, &nesdev->cqp_avail_reqs);
1725 spin_unlock_irqrestore(&nesadapter->pbl_lock, flags);
1726 }
1727 if (!context) 1717 if (!context)
1728 pci_free_consistent(nesdev->pcidev, nescq->cq_mem_size, mem, 1718 pci_free_consistent(nesdev->pcidev, nescq->cq_mem_size, mem,
1729 nescq->hw_cq.cq_pbase); 1719 nescq->hw_cq.cq_pbase);
@@ -1928,13 +1918,8 @@ static int nes_reg_mr(struct nes_device *nesdev, struct nes_pd *nespd,
1928 /* Two level PBL */ 1918 /* Two level PBL */
1929 if ((pbl_count+1) > nesadapter->free_4kpbl) { 1919 if ((pbl_count+1) > nesadapter->free_4kpbl) {
1930 nes_debug(NES_DBG_MR, "Out of 4KB Pbls for two level request.\n"); 1920 nes_debug(NES_DBG_MR, "Out of 4KB Pbls for two level request.\n");
1931 if (cqp_request->dynamic) { 1921 spin_unlock_irqrestore(&nesadapter->pbl_lock, flags);
1932 spin_unlock_irqrestore(&nesadapter->pbl_lock, flags); 1922 nes_free_cqp_request(nesdev, cqp_request);
1933 kfree(cqp_request);
1934 } else {
1935 list_add_tail(&cqp_request->list, &nesdev->cqp_avail_reqs);
1936 spin_unlock_irqrestore(&nesadapter->pbl_lock, flags);
1937 }
1938 return -ENOMEM; 1923 return -ENOMEM;
1939 } else { 1924 } else {
1940 nesadapter->free_4kpbl -= pbl_count+1; 1925 nesadapter->free_4kpbl -= pbl_count+1;
@@ -1942,13 +1927,8 @@ static int nes_reg_mr(struct nes_device *nesdev, struct nes_pd *nespd,
1942 } else if (residual_page_count > 32) { 1927 } else if (residual_page_count > 32) {
1943 if (pbl_count > nesadapter->free_4kpbl) { 1928 if (pbl_count > nesadapter->free_4kpbl) {
1944 nes_debug(NES_DBG_MR, "Out of 4KB Pbls.\n"); 1929 nes_debug(NES_DBG_MR, "Out of 4KB Pbls.\n");
1945 if (cqp_request->dynamic) { 1930 spin_unlock_irqrestore(&nesadapter->pbl_lock, flags);
1946 spin_unlock_irqrestore(&nesadapter->pbl_lock, flags); 1931 nes_free_cqp_request(nesdev, cqp_request);
1947 kfree(cqp_request);
1948 } else {
1949 list_add_tail(&cqp_request->list, &nesdev->cqp_avail_reqs);
1950 spin_unlock_irqrestore(&nesadapter->pbl_lock, flags);
1951 }
1952 return -ENOMEM; 1932 return -ENOMEM;
1953 } else { 1933 } else {
1954 nesadapter->free_4kpbl -= pbl_count; 1934 nesadapter->free_4kpbl -= pbl_count;
@@ -1956,13 +1936,8 @@ static int nes_reg_mr(struct nes_device *nesdev, struct nes_pd *nespd,
1956 } else { 1936 } else {
1957 if (pbl_count > nesadapter->free_256pbl) { 1937 if (pbl_count > nesadapter->free_256pbl) {
1958 nes_debug(NES_DBG_MR, "Out of 256B Pbls.\n"); 1938 nes_debug(NES_DBG_MR, "Out of 256B Pbls.\n");
1959 if (cqp_request->dynamic) { 1939 spin_unlock_irqrestore(&nesadapter->pbl_lock, flags);
1960 spin_unlock_irqrestore(&nesadapter->pbl_lock, flags); 1940 nes_free_cqp_request(nesdev, cqp_request);
1961 kfree(cqp_request);
1962 } else {
1963 list_add_tail(&cqp_request->list, &nesdev->cqp_avail_reqs);
1964 spin_unlock_irqrestore(&nesadapter->pbl_lock, flags);
1965 }
1966 return -ENOMEM; 1941 return -ENOMEM;
1967 } else { 1942 } else {
1968 nesadapter->free_256pbl -= pbl_count; 1943 nesadapter->free_256pbl -= pbl_count;