aboutsummaryrefslogtreecommitdiffstats
path: root/drivers/infiniband/hw/nes
diff options
context:
space:
mode:
authorLinus Torvalds <torvalds@linux-foundation.org>2012-10-02 20:20:40 -0400
committerLinus Torvalds <torvalds@linux-foundation.org>2012-10-02 20:20:40 -0400
commit7a9a2970b5c1c2ce73d4bb84edaa7ebf13e0c841 (patch)
treebd4909abfcd759b376cfd2fab06281df366f6a0f /drivers/infiniband/hw/nes
parentfc47912d9cda50ae6bd9ca30e97e8c03de5b7b60 (diff)
parentd172f5a4ab151a952a0d898ba3b0ff6a020171a6 (diff)
Merge tag 'rdma-for-linus' of git://git.kernel.org/pub/scm/linux/kernel/git/roland/infiniband
Pull infiniband updates from Roland Dreier: "First batch of InfiniBand/RDMA changes for the 3.7 merge window: - mlx4 IB support for SR-IOV - A couple of SRP initiator fixes - Batch of nes hardware driver fixes - Fix for long-standing use-after-free crash in IPoIB - Other miscellaneous fixes" This merge also removes a new use of __cancel_delayed_work(), and replaces it with the regular cancel_delayed_work() that is now irq-safe thanks to the workqueue updates. That said, I suspect the sequence in question should probably use "mod_delayed_work()". I just did the minimal "don't use deprecated functions" fixup, though. * tag 'rdma-for-linus' of git://git.kernel.org/pub/scm/linux/kernel/git/roland/infiniband: (45 commits) IB/qib: Fix local access validation for user MRs mlx4_core: Disable SENSE_PORT for multifunction devices mlx4_core: Clean up enabling of SENSE_PORT for older (ConnectX-1/-2) HCAs mlx4_core: Stash PCI ID driver_data in mlx4_priv structure IB/srp: Avoid having aborted requests hang IB/srp: Fix use-after-free in srp_reset_req() IB/qib: Add a qib driver version RDMA/nes: Fix compilation error when nes_debug is enabled RDMA/nes: Print hardware resource type RDMA/nes: Fix for crash when TX checksum offload is off RDMA/nes: Cosmetic changes RDMA/nes: Fix for incorrect MSS when TSO is on RDMA/nes: Fix incorrect resolving of the loopback MAC address mlx4_core: Fix crash on uninitialized priv->cmd.slave_sem mlx4_core: Trivial cleanups to driver log messages mlx4_core: Trivial readability fix: "0X30" -> "0x30" IB/mlx4: Create paravirt contexts for VFs when master IB driver initializes mlx4: Modify proxy/tunnel QP mechanism so that guests do no calculations mlx4: Paravirtualize Node Guids for slaves mlx4: Activate SR-IOV mode for IB ...
Diffstat (limited to 'drivers/infiniband/hw/nes')
-rw-r--r--drivers/infiniband/hw/nes/nes.h15
-rw-r--r--drivers/infiniband/hw/nes/nes_cm.c34
-rw-r--r--drivers/infiniband/hw/nes/nes_hw.c4
-rw-r--r--drivers/infiniband/hw/nes/nes_nic.c40
-rw-r--r--drivers/infiniband/hw/nes/nes_utils.c2
-rw-r--r--drivers/infiniband/hw/nes/nes_verbs.c14
6 files changed, 48 insertions, 61 deletions
diff --git a/drivers/infiniband/hw/nes/nes.h b/drivers/infiniband/hw/nes/nes.h
index c438e4691b3c..0da62b904d00 100644
--- a/drivers/infiniband/hw/nes/nes.h
+++ b/drivers/infiniband/hw/nes/nes.h
@@ -399,11 +399,20 @@ static inline void nes_write8(void __iomem *addr, u8 val)
399 writeb(val, addr); 399 writeb(val, addr);
400} 400}
401 401
402 402enum nes_resource {
403 NES_RESOURCE_MW = 1,
404 NES_RESOURCE_FAST_MR,
405 NES_RESOURCE_PHYS_MR,
406 NES_RESOURCE_USER_MR,
407 NES_RESOURCE_PD,
408 NES_RESOURCE_QP,
409 NES_RESOURCE_CQ,
410 NES_RESOURCE_ARP
411};
403 412
404static inline int nes_alloc_resource(struct nes_adapter *nesadapter, 413static inline int nes_alloc_resource(struct nes_adapter *nesadapter,
405 unsigned long *resource_array, u32 max_resources, 414 unsigned long *resource_array, u32 max_resources,
406 u32 *req_resource_num, u32 *next) 415 u32 *req_resource_num, u32 *next, enum nes_resource resource_type)
407{ 416{
408 unsigned long flags; 417 unsigned long flags;
409 u32 resource_num; 418 u32 resource_num;
@@ -414,7 +423,7 @@ static inline int nes_alloc_resource(struct nes_adapter *nesadapter,
414 if (resource_num >= max_resources) { 423 if (resource_num >= max_resources) {
415 resource_num = find_first_zero_bit(resource_array, max_resources); 424 resource_num = find_first_zero_bit(resource_array, max_resources);
416 if (resource_num >= max_resources) { 425 if (resource_num >= max_resources) {
417 printk(KERN_ERR PFX "%s: No available resourcess.\n", __func__); 426 printk(KERN_ERR PFX "%s: No available resources [type=%u].\n", __func__, resource_type);
418 spin_unlock_irqrestore(&nesadapter->resource_lock, flags); 427 spin_unlock_irqrestore(&nesadapter->resource_lock, flags);
419 return -EMFILE; 428 return -EMFILE;
420 } 429 }
diff --git a/drivers/infiniband/hw/nes/nes_cm.c b/drivers/infiniband/hw/nes/nes_cm.c
index 020e95c4c4b9..cfaacaf6bf5f 100644
--- a/drivers/infiniband/hw/nes/nes_cm.c
+++ b/drivers/infiniband/hw/nes/nes_cm.c
@@ -430,6 +430,8 @@ static void form_cm_frame(struct sk_buff *skb,
430 buf += sizeof(*tcph); 430 buf += sizeof(*tcph);
431 431
432 skb->ip_summed = CHECKSUM_PARTIAL; 432 skb->ip_summed = CHECKSUM_PARTIAL;
433 if (!(cm_node->netdev->features & NETIF_F_IP_CSUM))
434 skb->ip_summed = CHECKSUM_NONE;
433 skb->protocol = htons(0x800); 435 skb->protocol = htons(0x800);
434 skb->data_len = 0; 436 skb->data_len = 0;
435 skb->mac_len = ETH_HLEN; 437 skb->mac_len = ETH_HLEN;
@@ -1356,7 +1358,7 @@ static int nes_addr_resolve_neigh(struct nes_vnic *nesvnic, u32 dst_ip, int arpi
1356 else 1358 else
1357 netdev = nesvnic->netdev; 1359 netdev = nesvnic->netdev;
1358 1360
1359 neigh = dst_neigh_lookup(&rt->dst, &dst_ip); 1361 neigh = neigh_lookup(&arp_tbl, &rt->rt_gateway, netdev);
1360 1362
1361 rcu_read_lock(); 1363 rcu_read_lock();
1362 if (neigh) { 1364 if (neigh) {
@@ -1465,12 +1467,8 @@ static struct nes_cm_node *make_cm_node(struct nes_cm_core *cm_core,
1465 cm_node->loopbackpartner = NULL; 1467 cm_node->loopbackpartner = NULL;
1466 1468
1467 /* get the mac addr for the remote node */ 1469 /* get the mac addr for the remote node */
1468 if (ipv4_is_loopback(htonl(cm_node->rem_addr))) { 1470 oldarpindex = nes_arp_table(nesdev, cm_node->rem_addr, NULL, NES_ARP_RESOLVE);
1469 arpindex = nes_arp_table(nesdev, ntohl(nesvnic->local_ipaddr), NULL, NES_ARP_RESOLVE); 1471 arpindex = nes_addr_resolve_neigh(nesvnic, cm_info->rem_addr, oldarpindex);
1470 } else {
1471 oldarpindex = nes_arp_table(nesdev, cm_node->rem_addr, NULL, NES_ARP_RESOLVE);
1472 arpindex = nes_addr_resolve_neigh(nesvnic, cm_info->rem_addr, oldarpindex);
1473 }
1474 if (arpindex < 0) { 1472 if (arpindex < 0) {
1475 kfree(cm_node); 1473 kfree(cm_node);
1476 return NULL; 1474 return NULL;
@@ -3153,11 +3151,7 @@ int nes_accept(struct iw_cm_id *cm_id, struct iw_cm_conn_param *conn_param)
3153 nesqp->nesqp_context->tcpPorts[1] = 3151 nesqp->nesqp_context->tcpPorts[1] =
3154 cpu_to_le16(ntohs(cm_id->remote_addr.sin_port)); 3152 cpu_to_le16(ntohs(cm_id->remote_addr.sin_port));
3155 3153
3156 if (ipv4_is_loopback(cm_id->remote_addr.sin_addr.s_addr)) 3154 nesqp->nesqp_context->ip0 =
3157 nesqp->nesqp_context->ip0 =
3158 cpu_to_le32(ntohl(nesvnic->local_ipaddr));
3159 else
3160 nesqp->nesqp_context->ip0 =
3161 cpu_to_le32(ntohl(cm_id->remote_addr.sin_addr.s_addr)); 3155 cpu_to_le32(ntohl(cm_id->remote_addr.sin_addr.s_addr));
3162 3156
3163 nesqp->nesqp_context->misc2 |= cpu_to_le32( 3157 nesqp->nesqp_context->misc2 |= cpu_to_le32(
@@ -3182,10 +3176,7 @@ int nes_accept(struct iw_cm_id *cm_id, struct iw_cm_conn_param *conn_param)
3182 memset(&nes_quad, 0, sizeof(nes_quad)); 3176 memset(&nes_quad, 0, sizeof(nes_quad));
3183 nes_quad.DstIpAdrIndex = 3177 nes_quad.DstIpAdrIndex =
3184 cpu_to_le32((u32)PCI_FUNC(nesdev->pcidev->devfn) << 24); 3178 cpu_to_le32((u32)PCI_FUNC(nesdev->pcidev->devfn) << 24);
3185 if (ipv4_is_loopback(cm_id->remote_addr.sin_addr.s_addr)) 3179 nes_quad.SrcIpadr = cm_id->remote_addr.sin_addr.s_addr;
3186 nes_quad.SrcIpadr = nesvnic->local_ipaddr;
3187 else
3188 nes_quad.SrcIpadr = cm_id->remote_addr.sin_addr.s_addr;
3189 nes_quad.TcpPorts[0] = cm_id->remote_addr.sin_port; 3180 nes_quad.TcpPorts[0] = cm_id->remote_addr.sin_port;
3190 nes_quad.TcpPorts[1] = cm_id->local_addr.sin_port; 3181 nes_quad.TcpPorts[1] = cm_id->local_addr.sin_port;
3191 3182
@@ -3538,11 +3529,7 @@ static void cm_event_connected(struct nes_cm_event *event)
3538 cpu_to_le16(ntohs(cm_id->local_addr.sin_port)); 3529 cpu_to_le16(ntohs(cm_id->local_addr.sin_port));
3539 nesqp->nesqp_context->tcpPorts[1] = 3530 nesqp->nesqp_context->tcpPorts[1] =
3540 cpu_to_le16(ntohs(cm_id->remote_addr.sin_port)); 3531 cpu_to_le16(ntohs(cm_id->remote_addr.sin_port));
3541 if (ipv4_is_loopback(cm_id->remote_addr.sin_addr.s_addr)) 3532 nesqp->nesqp_context->ip0 =
3542 nesqp->nesqp_context->ip0 =
3543 cpu_to_le32(ntohl(nesvnic->local_ipaddr));
3544 else
3545 nesqp->nesqp_context->ip0 =
3546 cpu_to_le32(ntohl(cm_id->remote_addr.sin_addr.s_addr)); 3533 cpu_to_le32(ntohl(cm_id->remote_addr.sin_addr.s_addr));
3547 3534
3548 nesqp->nesqp_context->misc2 |= cpu_to_le32( 3535 nesqp->nesqp_context->misc2 |= cpu_to_le32(
@@ -3571,10 +3558,7 @@ static void cm_event_connected(struct nes_cm_event *event)
3571 3558
3572 nes_quad.DstIpAdrIndex = 3559 nes_quad.DstIpAdrIndex =
3573 cpu_to_le32((u32)PCI_FUNC(nesdev->pcidev->devfn) << 24); 3560 cpu_to_le32((u32)PCI_FUNC(nesdev->pcidev->devfn) << 24);
3574 if (ipv4_is_loopback(cm_id->remote_addr.sin_addr.s_addr)) 3561 nes_quad.SrcIpadr = cm_id->remote_addr.sin_addr.s_addr;
3575 nes_quad.SrcIpadr = nesvnic->local_ipaddr;
3576 else
3577 nes_quad.SrcIpadr = cm_id->remote_addr.sin_addr.s_addr;
3578 nes_quad.TcpPorts[0] = cm_id->remote_addr.sin_port; 3562 nes_quad.TcpPorts[0] = cm_id->remote_addr.sin_port;
3579 nes_quad.TcpPorts[1] = cm_id->local_addr.sin_port; 3563 nes_quad.TcpPorts[1] = cm_id->local_addr.sin_port;
3580 3564
diff --git a/drivers/infiniband/hw/nes/nes_hw.c b/drivers/infiniband/hw/nes/nes_hw.c
index 9e0895b45eb8..fe7965ee4096 100644
--- a/drivers/infiniband/hw/nes/nes_hw.c
+++ b/drivers/infiniband/hw/nes/nes_hw.c
@@ -3575,10 +3575,10 @@ static void nes_process_iwarp_aeqe(struct nes_device *nesdev,
3575 tcp_state = (aeq_info & NES_AEQE_TCP_STATE_MASK) >> NES_AEQE_TCP_STATE_SHIFT; 3575 tcp_state = (aeq_info & NES_AEQE_TCP_STATE_MASK) >> NES_AEQE_TCP_STATE_SHIFT;
3576 iwarp_state = (aeq_info & NES_AEQE_IWARP_STATE_MASK) >> NES_AEQE_IWARP_STATE_SHIFT; 3576 iwarp_state = (aeq_info & NES_AEQE_IWARP_STATE_MASK) >> NES_AEQE_IWARP_STATE_SHIFT;
3577 nes_debug(NES_DBG_AEQ, "aeid = 0x%04X, qp-cq id = %d, aeqe = %p," 3577 nes_debug(NES_DBG_AEQ, "aeid = 0x%04X, qp-cq id = %d, aeqe = %p,"
3578 " Tcp state = %s, iWARP state = %s\n", 3578 " Tcp state = %d, iWARP state = %d\n",
3579 async_event_id, 3579 async_event_id,
3580 le32_to_cpu(aeqe->aeqe_words[NES_AEQE_COMP_QP_CQ_ID_IDX]), aeqe, 3580 le32_to_cpu(aeqe->aeqe_words[NES_AEQE_COMP_QP_CQ_ID_IDX]), aeqe,
3581 nes_tcp_state_str[tcp_state], nes_iwarp_state_str[iwarp_state]); 3581 tcp_state, iwarp_state);
3582 3582
3583 aeqe_cq_id = le32_to_cpu(aeqe->aeqe_words[NES_AEQE_COMP_QP_CQ_ID_IDX]); 3583 aeqe_cq_id = le32_to_cpu(aeqe->aeqe_words[NES_AEQE_COMP_QP_CQ_ID_IDX]);
3584 if (aeq_info & NES_AEQE_QP) { 3584 if (aeq_info & NES_AEQE_QP) {
diff --git a/drivers/infiniband/hw/nes/nes_nic.c b/drivers/infiniband/hw/nes/nes_nic.c
index e43f6e41a6bd..0564be757d82 100644
--- a/drivers/infiniband/hw/nes/nes_nic.c
+++ b/drivers/infiniband/hw/nes/nes_nic.c
@@ -384,24 +384,20 @@ static int nes_nic_send(struct sk_buff *skb, struct net_device *netdev)
384 /* bump past the vlan tag */ 384 /* bump past the vlan tag */
385 wqe_fragment_length++; 385 wqe_fragment_length++;
386 /* wqe_fragment_address = (u64 *)&nic_sqe->wqe_words[NES_NIC_SQ_WQE_FRAG0_LOW_IDX]; */ 386 /* wqe_fragment_address = (u64 *)&nic_sqe->wqe_words[NES_NIC_SQ_WQE_FRAG0_LOW_IDX]; */
387 wqe_misc |= NES_NIC_SQ_WQE_COMPLETION;
387 388
388 if (skb->ip_summed == CHECKSUM_PARTIAL) { 389 if (skb->ip_summed == CHECKSUM_PARTIAL) {
389 tcph = tcp_hdr(skb); 390 if (skb_is_gso(skb)) {
390 if (1) { 391 tcph = tcp_hdr(skb);
391 if (skb_is_gso(skb)) { 392 /* nes_debug(NES_DBG_NIC_TX, "%s: TSO request... is_gso = %u seg size = %u\n",
392 /* nes_debug(NES_DBG_NIC_TX, "%s: TSO request... seg size = %u\n", 393 netdev->name, skb_is_gso(skb), skb_shinfo(skb)->gso_size); */
393 netdev->name, skb_is_gso(skb)); */ 394 wqe_misc |= NES_NIC_SQ_WQE_LSO_ENABLE | (u16)skb_shinfo(skb)->gso_size;
394 wqe_misc |= NES_NIC_SQ_WQE_LSO_ENABLE | 395 set_wqe_32bit_value(nic_sqe->wqe_words, NES_NIC_SQ_WQE_LSO_INFO_IDX,
395 NES_NIC_SQ_WQE_COMPLETION | (u16)skb_is_gso(skb); 396 ((u32)tcph->doff) |
396 set_wqe_32bit_value(nic_sqe->wqe_words, NES_NIC_SQ_WQE_LSO_INFO_IDX, 397 (((u32)(((unsigned char *)tcph) - skb->data)) << 4));
397 ((u32)tcph->doff) |
398 (((u32)(((unsigned char *)tcph) - skb->data)) << 4));
399 } else {
400 wqe_misc |= NES_NIC_SQ_WQE_COMPLETION;
401 }
402 } 398 }
403 } else { /* CHECKSUM_HW */ 399 } else { /* CHECKSUM_HW */
404 wqe_misc |= NES_NIC_SQ_WQE_DISABLE_CHKSUM | NES_NIC_SQ_WQE_COMPLETION; 400 wqe_misc |= NES_NIC_SQ_WQE_DISABLE_CHKSUM;
405 } 401 }
406 402
407 set_wqe_32bit_value(nic_sqe->wqe_words, NES_NIC_SQ_WQE_TOTAL_LENGTH_IDX, 403 set_wqe_32bit_value(nic_sqe->wqe_words, NES_NIC_SQ_WQE_TOTAL_LENGTH_IDX,
@@ -596,10 +592,10 @@ tso_sq_no_longer_full:
596 nes_debug(NES_DBG_NIC_TX, "ERROR: SKB header too big, headlen=%u, FIRST_FRAG_SIZE=%u\n", 592 nes_debug(NES_DBG_NIC_TX, "ERROR: SKB header too big, headlen=%u, FIRST_FRAG_SIZE=%u\n",
597 original_first_length, NES_FIRST_FRAG_SIZE); 593 original_first_length, NES_FIRST_FRAG_SIZE);
598 nes_debug(NES_DBG_NIC_TX, "%s Request to tx NIC packet length %u, headlen %u," 594 nes_debug(NES_DBG_NIC_TX, "%s Request to tx NIC packet length %u, headlen %u,"
599 " (%u frags), tso_size=%u\n", 595 " (%u frags), is_gso = %u tso_size=%u\n",
600 netdev->name, 596 netdev->name,
601 skb->len, skb_headlen(skb), 597 skb->len, skb_headlen(skb),
602 skb_shinfo(skb)->nr_frags, skb_is_gso(skb)); 598 skb_shinfo(skb)->nr_frags, skb_is_gso(skb), skb_shinfo(skb)->gso_size);
603 } 599 }
604 memcpy(&nesnic->first_frag_vbase[nesnic->sq_head].buffer, 600 memcpy(&nesnic->first_frag_vbase[nesnic->sq_head].buffer,
605 skb->data, min(((unsigned int)NES_FIRST_FRAG_SIZE), 601 skb->data, min(((unsigned int)NES_FIRST_FRAG_SIZE),
@@ -651,8 +647,8 @@ tso_sq_no_longer_full:
651 } else { 647 } else {
652 nesnic->tx_skb[nesnic->sq_head] = NULL; 648 nesnic->tx_skb[nesnic->sq_head] = NULL;
653 } 649 }
654 wqe_misc |= NES_NIC_SQ_WQE_COMPLETION | (u16)skb_is_gso(skb); 650 wqe_misc |= NES_NIC_SQ_WQE_COMPLETION | (u16)skb_shinfo(skb)->gso_size;
655 if ((tso_wqe_length + original_first_length) > skb_is_gso(skb)) { 651 if ((tso_wqe_length + original_first_length) > skb_shinfo(skb)->gso_size) {
656 wqe_misc |= NES_NIC_SQ_WQE_LSO_ENABLE; 652 wqe_misc |= NES_NIC_SQ_WQE_LSO_ENABLE;
657 } else { 653 } else {
658 iph->tot_len = htons(tso_wqe_length + original_first_length - nhoffset); 654 iph->tot_len = htons(tso_wqe_length + original_first_length - nhoffset);
@@ -1678,12 +1674,10 @@ struct net_device *nes_netdev_init(struct nes_device *nesdev,
1678 netdev->hard_header_len = ETH_HLEN; 1674 netdev->hard_header_len = ETH_HLEN;
1679 netdev->addr_len = ETH_ALEN; 1675 netdev->addr_len = ETH_ALEN;
1680 netdev->type = ARPHRD_ETHER; 1676 netdev->type = ARPHRD_ETHER;
1681 netdev->features = NETIF_F_HIGHDMA;
1682 netdev->netdev_ops = &nes_netdev_ops; 1677 netdev->netdev_ops = &nes_netdev_ops;
1683 netdev->ethtool_ops = &nes_ethtool_ops; 1678 netdev->ethtool_ops = &nes_ethtool_ops;
1684 netif_napi_add(netdev, &nesvnic->napi, nes_netdev_poll, 128); 1679 netif_napi_add(netdev, &nesvnic->napi, nes_netdev_poll, 128);
1685 nes_debug(NES_DBG_INIT, "Enabling VLAN Insert/Delete.\n"); 1680 nes_debug(NES_DBG_INIT, "Enabling VLAN Insert/Delete.\n");
1686 netdev->features |= NETIF_F_HW_VLAN_TX;
1687 1681
1688 /* Fill in the port structure */ 1682 /* Fill in the port structure */
1689 nesvnic->netdev = netdev; 1683 nesvnic->netdev = netdev;
@@ -1710,11 +1704,11 @@ struct net_device *nes_netdev_init(struct nes_device *nesdev,
1710 netdev->dev_addr[5] = (u8)u64temp; 1704 netdev->dev_addr[5] = (u8)u64temp;
1711 memcpy(netdev->perm_addr, netdev->dev_addr, 6); 1705 memcpy(netdev->perm_addr, netdev->dev_addr, 6);
1712 1706
1713 netdev->hw_features = NETIF_F_RXCSUM | NETIF_F_SG | NETIF_F_IP_CSUM | 1707 netdev->hw_features = NETIF_F_SG | NETIF_F_IP_CSUM | NETIF_F_RXCSUM | NETIF_F_HW_VLAN_RX;
1714 NETIF_F_HW_VLAN_RX;
1715 if ((nesvnic->logical_port < 2) || (nesdev->nesadapter->hw_rev != NE020_REV)) 1708 if ((nesvnic->logical_port < 2) || (nesdev->nesadapter->hw_rev != NE020_REV))
1716 netdev->hw_features |= NETIF_F_TSO; 1709 netdev->hw_features |= NETIF_F_TSO;
1717 netdev->features |= netdev->hw_features; 1710
1711 netdev->features = netdev->hw_features | NETIF_F_HIGHDMA | NETIF_F_HW_VLAN_TX;
1718 netdev->hw_features |= NETIF_F_LRO; 1712 netdev->hw_features |= NETIF_F_LRO;
1719 1713
1720 nes_debug(NES_DBG_INIT, "nesvnic = %p, reported features = 0x%lX, QPid = %d," 1714 nes_debug(NES_DBG_INIT, "nesvnic = %p, reported features = 0x%lX, QPid = %d,"
diff --git a/drivers/infiniband/hw/nes/nes_utils.c b/drivers/infiniband/hw/nes/nes_utils.c
index e98f4fc0b768..2042c0f29759 100644
--- a/drivers/infiniband/hw/nes/nes_utils.c
+++ b/drivers/infiniband/hw/nes/nes_utils.c
@@ -699,7 +699,7 @@ int nes_arp_table(struct nes_device *nesdev, u32 ip_addr, u8 *mac_addr, u32 acti
699 699
700 arp_index = 0; 700 arp_index = 0;
701 err = nes_alloc_resource(nesadapter, nesadapter->allocated_arps, 701 err = nes_alloc_resource(nesadapter, nesadapter->allocated_arps,
702 nesadapter->arp_table_size, (u32 *)&arp_index, &nesadapter->next_arp_index); 702 nesadapter->arp_table_size, (u32 *)&arp_index, &nesadapter->next_arp_index, NES_RESOURCE_ARP);
703 if (err) { 703 if (err) {
704 nes_debug(NES_DBG_NETDEV, "nes_alloc_resource returned error = %u\n", err); 704 nes_debug(NES_DBG_NETDEV, "nes_alloc_resource returned error = %u\n", err);
705 return err; 705 return err;
diff --git a/drivers/infiniband/hw/nes/nes_verbs.c b/drivers/infiniband/hw/nes/nes_verbs.c
index 8b8812de4b5c..1dadcf388c02 100644
--- a/drivers/infiniband/hw/nes/nes_verbs.c
+++ b/drivers/infiniband/hw/nes/nes_verbs.c
@@ -80,7 +80,7 @@ static struct ib_mw *nes_alloc_mw(struct ib_pd *ibpd) {
80 next_stag_index %= nesadapter->max_mr; 80 next_stag_index %= nesadapter->max_mr;
81 81
82 ret = nes_alloc_resource(nesadapter, nesadapter->allocated_mrs, 82 ret = nes_alloc_resource(nesadapter, nesadapter->allocated_mrs,
83 nesadapter->max_mr, &stag_index, &next_stag_index); 83 nesadapter->max_mr, &stag_index, &next_stag_index, NES_RESOURCE_MW);
84 if (ret) { 84 if (ret) {
85 return ERR_PTR(ret); 85 return ERR_PTR(ret);
86 } 86 }
@@ -404,7 +404,7 @@ static struct ib_mr *nes_alloc_fast_reg_mr(struct ib_pd *ibpd, int max_page_list
404 404
405 err = nes_alloc_resource(nesadapter, nesadapter->allocated_mrs, 405 err = nes_alloc_resource(nesadapter, nesadapter->allocated_mrs,
406 nesadapter->max_mr, &stag_index, 406 nesadapter->max_mr, &stag_index,
407 &next_stag_index); 407 &next_stag_index, NES_RESOURCE_FAST_MR);
408 if (err) 408 if (err)
409 return ERR_PTR(err); 409 return ERR_PTR(err);
410 410
@@ -780,7 +780,7 @@ static struct ib_pd *nes_alloc_pd(struct ib_device *ibdev,
780 netdev_refcnt_read(nesvnic->netdev)); 780 netdev_refcnt_read(nesvnic->netdev));
781 781
782 err = nes_alloc_resource(nesadapter, nesadapter->allocated_pds, 782 err = nes_alloc_resource(nesadapter, nesadapter->allocated_pds,
783 nesadapter->max_pd, &pd_num, &nesadapter->next_pd); 783 nesadapter->max_pd, &pd_num, &nesadapter->next_pd, NES_RESOURCE_PD);
784 if (err) { 784 if (err) {
785 return ERR_PTR(err); 785 return ERR_PTR(err);
786 } 786 }
@@ -1157,7 +1157,7 @@ static struct ib_qp *nes_create_qp(struct ib_pd *ibpd,
1157 nes_debug(NES_DBG_QP, "RQ size=%u, SQ Size=%u\n", rq_size, sq_size); 1157 nes_debug(NES_DBG_QP, "RQ size=%u, SQ Size=%u\n", rq_size, sq_size);
1158 1158
1159 ret = nes_alloc_resource(nesadapter, nesadapter->allocated_qps, 1159 ret = nes_alloc_resource(nesadapter, nesadapter->allocated_qps,
1160 nesadapter->max_qp, &qp_num, &nesadapter->next_qp); 1160 nesadapter->max_qp, &qp_num, &nesadapter->next_qp, NES_RESOURCE_QP);
1161 if (ret) { 1161 if (ret) {
1162 return ERR_PTR(ret); 1162 return ERR_PTR(ret);
1163 } 1163 }
@@ -1546,7 +1546,7 @@ static struct ib_cq *nes_create_cq(struct ib_device *ibdev, int entries,
1546 return ERR_PTR(-EINVAL); 1546 return ERR_PTR(-EINVAL);
1547 1547
1548 err = nes_alloc_resource(nesadapter, nesadapter->allocated_cqs, 1548 err = nes_alloc_resource(nesadapter, nesadapter->allocated_cqs,
1549 nesadapter->max_cq, &cq_num, &nesadapter->next_cq); 1549 nesadapter->max_cq, &cq_num, &nesadapter->next_cq, NES_RESOURCE_CQ);
1550 if (err) { 1550 if (err) {
1551 return ERR_PTR(err); 1551 return ERR_PTR(err);
1552 } 1552 }
@@ -2129,7 +2129,7 @@ static struct ib_mr *nes_reg_phys_mr(struct ib_pd *ib_pd,
2129 return ERR_PTR(-EINVAL); 2129 return ERR_PTR(-EINVAL);
2130 2130
2131 err = nes_alloc_resource(nesadapter, nesadapter->allocated_mrs, nesadapter->max_mr, 2131 err = nes_alloc_resource(nesadapter, nesadapter->allocated_mrs, nesadapter->max_mr,
2132 &stag_index, &next_stag_index); 2132 &stag_index, &next_stag_index, NES_RESOURCE_PHYS_MR);
2133 if (err) { 2133 if (err) {
2134 return ERR_PTR(err); 2134 return ERR_PTR(err);
2135 } 2135 }
@@ -2360,7 +2360,7 @@ static struct ib_mr *nes_reg_user_mr(struct ib_pd *pd, u64 start, u64 length,
2360 next_stag_index %= nesadapter->max_mr; 2360 next_stag_index %= nesadapter->max_mr;
2361 2361
2362 err = nes_alloc_resource(nesadapter, nesadapter->allocated_mrs, 2362 err = nes_alloc_resource(nesadapter, nesadapter->allocated_mrs,
2363 nesadapter->max_mr, &stag_index, &next_stag_index); 2363 nesadapter->max_mr, &stag_index, &next_stag_index, NES_RESOURCE_USER_MR);
2364 if (err) { 2364 if (err) {
2365 ib_umem_release(region); 2365 ib_umem_release(region);
2366 return ERR_PTR(err); 2366 return ERR_PTR(err);