aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorLinus Torvalds <torvalds@woody.linux-foundation.org>2008-02-29 11:28:46 -0500
committerLinus Torvalds <torvalds@woody.linux-foundation.org>2008-02-29 11:28:46 -0500
commit5ad587283cc15f71bb0e9cb9e0933dd8ebd66e1c (patch)
tree743564a6e48fa6bc3667ca01d9d12452ebbcffcf
parentf511d7edf53bd49c16131fce28b87428c16239ad (diff)
parent030f1b2f5d880c1ad3d7e0b71fc383f00f38f8f7 (diff)
Merge branch 'for-linus' of git://git.kernel.org/pub/scm/linux/kernel/git/roland/infiniband
* 'for-linus' of git://git.kernel.org/pub/scm/linux/kernel/git/roland/infiniband: MAINTAINERS: neteffect update RDMA/nes: Fix interrupt moderation low threshold RDMA/nes: Fix CRC endianness for RDMA connection establishment on big-endian RDMA/nes: Fix use-after-free in mini_cm_dec_refcnt_listen() RDMA/nes: Fix use-after-free in nes_create_cq() RDMA/nes: Fix a check-after-use in nes_probe() RDMA/nes: Fix a memory leak in schedule_nes_timer() RDMA/nes: Fix off-by-one RDMA/nes: Resurrect error path dead code RDMA/cxgb3: Fix shift calc in build_phys_page_list() for 1-entry page lists
-rw-r--r--MAINTAINERS2
-rw-r--r--drivers/infiniband/hw/cxgb3/iwch_mem.c10
-rw-r--r--drivers/infiniband/hw/nes/nes.c2
-rw-r--r--drivers/infiniband/hw/nes/nes.h15
-rw-r--r--drivers/infiniband/hw/nes/nes_cm.c15
-rw-r--r--drivers/infiniband/hw/nes/nes_hw.c13
-rw-r--r--drivers/infiniband/hw/nes/nes_hw.h2
-rw-r--r--drivers/infiniband/hw/nes/nes_verbs.c10
8 files changed, 39 insertions, 30 deletions
diff --git a/MAINTAINERS b/MAINTAINERS
index 36c7bc641dba..4fc5f0aee6a6 100644
--- a/MAINTAINERS
+++ b/MAINTAINERS
@@ -2744,6 +2744,8 @@ S: Maintained
2744NETEFFECT IWARP RNIC DRIVER (IW_NES) 2744NETEFFECT IWARP RNIC DRIVER (IW_NES)
2745P: Faisal Latif 2745P: Faisal Latif
2746M: flatif@neteffect.com 2746M: flatif@neteffect.com
2747P: Nishi Gupta
2748M: ngupta@neteffect.com
2747P: Glenn Streiff 2749P: Glenn Streiff
2748M: gstreiff@neteffect.com 2750M: gstreiff@neteffect.com
2749L: general@lists.openfabrics.org 2751L: general@lists.openfabrics.org
diff --git a/drivers/infiniband/hw/cxgb3/iwch_mem.c b/drivers/infiniband/hw/cxgb3/iwch_mem.c
index 73bfd1656f86..b8797c66676d 100644
--- a/drivers/infiniband/hw/cxgb3/iwch_mem.c
+++ b/drivers/infiniband/hw/cxgb3/iwch_mem.c
@@ -136,14 +136,8 @@ int build_phys_page_list(struct ib_phys_buf *buffer_list,
136 136
137 /* Find largest page shift we can use to cover buffers */ 137 /* Find largest page shift we can use to cover buffers */
138 for (*shift = PAGE_SHIFT; *shift < 27; ++(*shift)) 138 for (*shift = PAGE_SHIFT; *shift < 27; ++(*shift))
139 if (num_phys_buf > 1) { 139 if ((1ULL << *shift) & mask)
140 if ((1ULL << *shift) & mask) 140 break;
141 break;
142 } else
143 if (1ULL << *shift >=
144 buffer_list[0].size +
145 (buffer_list[0].addr & ((1ULL << *shift) - 1)))
146 break;
147 141
148 buffer_list[0].size += buffer_list[0].addr & ((1ULL << *shift) - 1); 142 buffer_list[0].size += buffer_list[0].addr & ((1ULL << *shift) - 1);
149 buffer_list[0].addr &= ~0ull << *shift; 143 buffer_list[0].addr &= ~0ull << *shift;
diff --git a/drivers/infiniband/hw/nes/nes.c b/drivers/infiniband/hw/nes/nes.c
index 7f8853b44ee1..b2112f5a422f 100644
--- a/drivers/infiniband/hw/nes/nes.c
+++ b/drivers/infiniband/hw/nes/nes.c
@@ -567,12 +567,12 @@ static int __devinit nes_probe(struct pci_dev *pcidev, const struct pci_device_i
567 567
568 /* Init the adapter */ 568 /* Init the adapter */
569 nesdev->nesadapter = nes_init_adapter(nesdev, hw_rev); 569 nesdev->nesadapter = nes_init_adapter(nesdev, hw_rev);
570 nesdev->nesadapter->et_rx_coalesce_usecs_irq = interrupt_mod_interval;
571 if (!nesdev->nesadapter) { 570 if (!nesdev->nesadapter) {
572 printk(KERN_ERR PFX "Unable to initialize adapter.\n"); 571 printk(KERN_ERR PFX "Unable to initialize adapter.\n");
573 ret = -ENOMEM; 572 ret = -ENOMEM;
574 goto bail5; 573 goto bail5;
575 } 574 }
575 nesdev->nesadapter->et_rx_coalesce_usecs_irq = interrupt_mod_interval;
576 576
577 /* nesdev->base_doorbell_index = 577 /* nesdev->base_doorbell_index =
578 nesdev->nesadapter->pd_config_base[PCI_FUNC(nesdev->pcidev->devfn)]; */ 578 nesdev->nesadapter->pd_config_base[PCI_FUNC(nesdev->pcidev->devfn)]; */
diff --git a/drivers/infiniband/hw/nes/nes.h b/drivers/infiniband/hw/nes/nes.h
index fd57e8a1582f..a48b288618ec 100644
--- a/drivers/infiniband/hw/nes/nes.h
+++ b/drivers/infiniband/hw/nes/nes.h
@@ -285,6 +285,21 @@ struct nes_device {
285}; 285};
286 286
287 287
288static inline __le32 get_crc_value(struct nes_v4_quad *nes_quad)
289{
290 u32 crc_value;
291 crc_value = crc32c(~0, (void *)nes_quad, sizeof (struct nes_v4_quad));
292
293 /*
294 * With commit ef19454b ("[LIB] crc32c: Keep intermediate crc
295 * state in cpu order"), behavior of crc32c changes on
296 * big-endian platforms. Our algorithm expects the previous
297 * behavior; otherwise we have RDMA connection establishment
298 * issue on big-endian.
299 */
300 return cpu_to_le32(crc_value);
301}
302
288static inline void 303static inline void
289set_wqe_64bit_value(__le32 *wqe_words, u32 index, u64 value) 304set_wqe_64bit_value(__le32 *wqe_words, u32 index, u64 value)
290{ 305{
diff --git a/drivers/infiniband/hw/nes/nes_cm.c b/drivers/infiniband/hw/nes/nes_cm.c
index bd5cfeaac203..39adb267fb15 100644
--- a/drivers/infiniband/hw/nes/nes_cm.c
+++ b/drivers/infiniband/hw/nes/nes_cm.c
@@ -370,11 +370,11 @@ int schedule_nes_timer(struct nes_cm_node *cm_node, struct sk_buff *skb,
370 int ret = 0; 370 int ret = 0;
371 u32 was_timer_set; 371 u32 was_timer_set;
372 372
373 if (!cm_node)
374 return -EINVAL;
373 new_send = kzalloc(sizeof(*new_send), GFP_ATOMIC); 375 new_send = kzalloc(sizeof(*new_send), GFP_ATOMIC);
374 if (!new_send) 376 if (!new_send)
375 return -1; 377 return -1;
376 if (!cm_node)
377 return -EINVAL;
378 378
379 /* new_send->timetosend = currenttime */ 379 /* new_send->timetosend = currenttime */
380 new_send->retrycount = NES_DEFAULT_RETRYS; 380 new_send->retrycount = NES_DEFAULT_RETRYS;
@@ -947,6 +947,7 @@ static int mini_cm_dec_refcnt_listen(struct nes_cm_core *cm_core,
947 nes_debug(NES_DBG_CM, "destroying listener (%p)\n", listener); 947 nes_debug(NES_DBG_CM, "destroying listener (%p)\n", listener);
948 948
949 kfree(listener); 949 kfree(listener);
950 listener = NULL;
950 ret = 0; 951 ret = 0;
951 cm_listens_destroyed++; 952 cm_listens_destroyed++;
952 } else { 953 } else {
@@ -2319,6 +2320,7 @@ int nes_accept(struct iw_cm_id *cm_id, struct iw_cm_conn_param *conn_param)
2319 struct iw_cm_event cm_event; 2320 struct iw_cm_event cm_event;
2320 struct nes_hw_qp_wqe *wqe; 2321 struct nes_hw_qp_wqe *wqe;
2321 struct nes_v4_quad nes_quad; 2322 struct nes_v4_quad nes_quad;
2323 u32 crc_value;
2322 int ret; 2324 int ret;
2323 2325
2324 ibqp = nes_get_qp(cm_id->device, conn_param->qpn); 2326 ibqp = nes_get_qp(cm_id->device, conn_param->qpn);
@@ -2435,8 +2437,8 @@ int nes_accept(struct iw_cm_id *cm_id, struct iw_cm_conn_param *conn_param)
2435 nes_quad.TcpPorts[1] = cm_id->local_addr.sin_port; 2437 nes_quad.TcpPorts[1] = cm_id->local_addr.sin_port;
2436 2438
2437 /* Produce hash key */ 2439 /* Produce hash key */
2438 nesqp->hte_index = cpu_to_be32( 2440 crc_value = get_crc_value(&nes_quad);
2439 crc32c(~0, (void *)&nes_quad, sizeof(nes_quad)) ^ 0xffffffff); 2441 nesqp->hte_index = cpu_to_be32(crc_value ^ 0xffffffff);
2440 nes_debug(NES_DBG_CM, "HTE Index = 0x%08X, CRC = 0x%08X\n", 2442 nes_debug(NES_DBG_CM, "HTE Index = 0x%08X, CRC = 0x%08X\n",
2441 nesqp->hte_index, nesqp->hte_index & adapter->hte_index_mask); 2443 nesqp->hte_index, nesqp->hte_index & adapter->hte_index_mask);
2442 2444
@@ -2750,6 +2752,7 @@ void cm_event_connected(struct nes_cm_event *event)
2750 struct iw_cm_event cm_event; 2752 struct iw_cm_event cm_event;
2751 struct nes_hw_qp_wqe *wqe; 2753 struct nes_hw_qp_wqe *wqe;
2752 struct nes_v4_quad nes_quad; 2754 struct nes_v4_quad nes_quad;
2755 u32 crc_value;
2753 int ret; 2756 int ret;
2754 2757
2755 /* get all our handles */ 2758 /* get all our handles */
@@ -2827,8 +2830,8 @@ void cm_event_connected(struct nes_cm_event *event)
2827 nes_quad.TcpPorts[1] = cm_id->local_addr.sin_port; 2830 nes_quad.TcpPorts[1] = cm_id->local_addr.sin_port;
2828 2831
2829 /* Produce hash key */ 2832 /* Produce hash key */
2830 nesqp->hte_index = cpu_to_be32( 2833 crc_value = get_crc_value(&nes_quad);
2831 crc32c(~0, (void *)&nes_quad, sizeof(nes_quad)) ^ 0xffffffff); 2834 nesqp->hte_index = cpu_to_be32(crc_value ^ 0xffffffff);
2832 nes_debug(NES_DBG_CM, "HTE Index = 0x%08X, After CRC = 0x%08X\n", 2835 nes_debug(NES_DBG_CM, "HTE Index = 0x%08X, After CRC = 0x%08X\n",
2833 nesqp->hte_index, nesqp->hte_index & nesadapter->hte_index_mask); 2836 nesqp->hte_index, nesqp->hte_index & nesadapter->hte_index_mask);
2834 2837
diff --git a/drivers/infiniband/hw/nes/nes_hw.c b/drivers/infiniband/hw/nes/nes_hw.c
index 7c4c0fbf0abd..49e53e4c1ebe 100644
--- a/drivers/infiniband/hw/nes/nes_hw.c
+++ b/drivers/infiniband/hw/nes/nes_hw.c
@@ -156,15 +156,14 @@ static void nes_nic_tune_timer(struct nes_device *nesdev)
156 156
157 spin_lock_irqsave(&nesadapter->periodic_timer_lock, flags); 157 spin_lock_irqsave(&nesadapter->periodic_timer_lock, flags);
158 158
159 if (shared_timer->cq_count_old < cq_count) { 159 if (shared_timer->cq_count_old <= cq_count)
160 if (cq_count > shared_timer->threshold_low) 160 shared_timer->cq_direction_downward = 0;
161 shared_timer->cq_direction_downward=0; 161 else
162 }
163 if (shared_timer->cq_count_old >= cq_count)
164 shared_timer->cq_direction_downward++; 162 shared_timer->cq_direction_downward++;
165 shared_timer->cq_count_old = cq_count; 163 shared_timer->cq_count_old = cq_count;
166 if (shared_timer->cq_direction_downward > NES_NIC_CQ_DOWNWARD_TREND) { 164 if (shared_timer->cq_direction_downward > NES_NIC_CQ_DOWNWARD_TREND) {
167 if (cq_count <= shared_timer->threshold_low) { 165 if (cq_count <= shared_timer->threshold_low &&
166 shared_timer->threshold_low > 4) {
168 shared_timer->threshold_low = shared_timer->threshold_low/2; 167 shared_timer->threshold_low = shared_timer->threshold_low/2;
169 shared_timer->cq_direction_downward=0; 168 shared_timer->cq_direction_downward=0;
170 nesdev->currcq_count = 0; 169 nesdev->currcq_count = 0;
@@ -1728,7 +1727,6 @@ int nes_napi_isr(struct nes_device *nesdev)
1728 nesdev->int_req &= ~NES_INT_TIMER; 1727 nesdev->int_req &= ~NES_INT_TIMER;
1729 nes_write32(nesdev->regs+NES_INTF_INT_MASK, ~(nesdev->intf_int_req)); 1728 nes_write32(nesdev->regs+NES_INTF_INT_MASK, ~(nesdev->intf_int_req));
1730 nes_write32(nesdev->regs+NES_INT_MASK, ~nesdev->int_req); 1729 nes_write32(nesdev->regs+NES_INT_MASK, ~nesdev->int_req);
1731 nesadapter->tune_timer.timer_in_use_old = 0;
1732 } 1730 }
1733 nesdev->deepcq_count = 0; 1731 nesdev->deepcq_count = 0;
1734 return 1; 1732 return 1;
@@ -1867,7 +1865,6 @@ void nes_dpc(unsigned long param)
1867 nesdev->int_req &= ~NES_INT_TIMER; 1865 nesdev->int_req &= ~NES_INT_TIMER;
1868 nes_write32(nesdev->regs + NES_INTF_INT_MASK, ~(nesdev->intf_int_req)); 1866 nes_write32(nesdev->regs + NES_INTF_INT_MASK, ~(nesdev->intf_int_req));
1869 nes_write32(nesdev->regs+NES_INT_MASK, ~nesdev->int_req); 1867 nes_write32(nesdev->regs+NES_INT_MASK, ~nesdev->int_req);
1870 nesdev->nesadapter->tune_timer.timer_in_use_old = 0;
1871 } else { 1868 } else {
1872 nes_write32(nesdev->regs+NES_INT_MASK, 0x0000ffff|(~nesdev->int_req)); 1869 nes_write32(nesdev->regs+NES_INT_MASK, 0x0000ffff|(~nesdev->int_req));
1873 } 1870 }
diff --git a/drivers/infiniband/hw/nes/nes_hw.h b/drivers/infiniband/hw/nes/nes_hw.h
index 1e10df550c9e..b7e2844f096b 100644
--- a/drivers/infiniband/hw/nes/nes_hw.h
+++ b/drivers/infiniband/hw/nes/nes_hw.h
@@ -962,7 +962,7 @@ struct nes_arp_entry {
962#define DEFAULT_JUMBO_NES_QL_LOW 12 962#define DEFAULT_JUMBO_NES_QL_LOW 12
963#define DEFAULT_JUMBO_NES_QL_TARGET 40 963#define DEFAULT_JUMBO_NES_QL_TARGET 40
964#define DEFAULT_JUMBO_NES_QL_HIGH 128 964#define DEFAULT_JUMBO_NES_QL_HIGH 128
965#define NES_NIC_CQ_DOWNWARD_TREND 8 965#define NES_NIC_CQ_DOWNWARD_TREND 16
966 966
967struct nes_hw_tune_timer { 967struct nes_hw_tune_timer {
968 //u16 cq_count; 968 //u16 cq_count;
diff --git a/drivers/infiniband/hw/nes/nes_verbs.c b/drivers/infiniband/hw/nes/nes_verbs.c
index 4dafbe16e82a..a651e9d9f0ef 100644
--- a/drivers/infiniband/hw/nes/nes_verbs.c
+++ b/drivers/infiniband/hw/nes/nes_verbs.c
@@ -929,7 +929,7 @@ static struct ib_pd *nes_alloc_pd(struct ib_device *ibdev,
929 NES_MAX_USER_DB_REGIONS, nesucontext->first_free_db); 929 NES_MAX_USER_DB_REGIONS, nesucontext->first_free_db);
930 nes_debug(NES_DBG_PD, "find_first_zero_biton doorbells returned %u, mapping pd_id %u.\n", 930 nes_debug(NES_DBG_PD, "find_first_zero_biton doorbells returned %u, mapping pd_id %u.\n",
931 nespd->mmap_db_index, nespd->pd_id); 931 nespd->mmap_db_index, nespd->pd_id);
932 if (nespd->mmap_db_index > NES_MAX_USER_DB_REGIONS) { 932 if (nespd->mmap_db_index >= NES_MAX_USER_DB_REGIONS) {
933 nes_debug(NES_DBG_PD, "mmap_db_index > MAX\n"); 933 nes_debug(NES_DBG_PD, "mmap_db_index > MAX\n");
934 nes_free_resource(nesadapter, nesadapter->allocated_pds, pd_num); 934 nes_free_resource(nesadapter, nesadapter->allocated_pds, pd_num);
935 kfree(nespd); 935 kfree(nespd);
@@ -1327,7 +1327,7 @@ static struct ib_qp *nes_create_qp(struct ib_pd *ibpd,
1327 (long long unsigned int)req.user_wqe_buffers); 1327 (long long unsigned int)req.user_wqe_buffers);
1328 nes_free_resource(nesadapter, nesadapter->allocated_qps, qp_num); 1328 nes_free_resource(nesadapter, nesadapter->allocated_qps, qp_num);
1329 kfree(nesqp->allocated_buffer); 1329 kfree(nesqp->allocated_buffer);
1330 return ERR_PTR(-ENOMEM); 1330 return ERR_PTR(-EFAULT);
1331 } 1331 }
1332 } 1332 }
1333 1333
@@ -1674,6 +1674,7 @@ static struct ib_cq *nes_create_cq(struct ib_device *ibdev, int entries,
1674 } 1674 }
1675 nes_debug(NES_DBG_CQ, "CQ Virtual Address = %08lX, size = %u.\n", 1675 nes_debug(NES_DBG_CQ, "CQ Virtual Address = %08lX, size = %u.\n",
1676 (unsigned long)req.user_cq_buffer, entries); 1676 (unsigned long)req.user_cq_buffer, entries);
1677 err = 1;
1677 list_for_each_entry(nespbl, &nes_ucontext->cq_reg_mem_list, list) { 1678 list_for_each_entry(nespbl, &nes_ucontext->cq_reg_mem_list, list) {
1678 if (nespbl->user_base == (unsigned long )req.user_cq_buffer) { 1679 if (nespbl->user_base == (unsigned long )req.user_cq_buffer) {
1679 list_del(&nespbl->list); 1680 list_del(&nespbl->list);
@@ -1686,7 +1687,7 @@ static struct ib_cq *nes_create_cq(struct ib_device *ibdev, int entries,
1686 if (err) { 1687 if (err) {
1687 nes_free_resource(nesadapter, nesadapter->allocated_cqs, cq_num); 1688 nes_free_resource(nesadapter, nesadapter->allocated_cqs, cq_num);
1688 kfree(nescq); 1689 kfree(nescq);
1689 return ERR_PTR(err); 1690 return ERR_PTR(-EFAULT);
1690 } 1691 }
1691 1692
1692 pbl_entries = nespbl->pbl_size >> 3; 1693 pbl_entries = nespbl->pbl_size >> 3;
@@ -1831,9 +1832,6 @@ static struct ib_cq *nes_create_cq(struct ib_device *ibdev, int entries,
1831 spin_unlock_irqrestore(&nesdev->cqp.lock, flags); 1832 spin_unlock_irqrestore(&nesdev->cqp.lock, flags);
1832 } 1833 }
1833 } 1834 }
1834 nes_debug(NES_DBG_CQ, "iWARP CQ%u create timeout expired, major code = 0x%04X,"
1835 " minor code = 0x%04X\n",
1836 nescq->hw_cq.cq_number, cqp_request->major_code, cqp_request->minor_code);
1837 if (!context) 1835 if (!context)
1838 pci_free_consistent(nesdev->pcidev, nescq->cq_mem_size, mem, 1836 pci_free_consistent(nesdev->pcidev, nescq->cq_mem_size, mem,
1839 nescq->hw_cq.cq_pbase); 1837 nescq->hw_cq.cq_pbase);