aboutsummaryrefslogtreecommitdiffstats
path: root/drivers/infiniband/hw/nes
diff options
context:
space:
mode:
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 d42c9f435b1b..78e936dde773 100644
--- a/drivers/infiniband/hw/nes/nes_hw.c
+++ b/drivers/infiniband/hw/nes/nes_hw.c
@@ -3577,10 +3577,10 @@ static void nes_process_iwarp_aeqe(struct nes_device *nesdev,
3577 tcp_state = (aeq_info & NES_AEQE_TCP_STATE_MASK) >> NES_AEQE_TCP_STATE_SHIFT; 3577 tcp_state = (aeq_info & NES_AEQE_TCP_STATE_MASK) >> NES_AEQE_TCP_STATE_SHIFT;
3578 iwarp_state = (aeq_info & NES_AEQE_IWARP_STATE_MASK) >> NES_AEQE_IWARP_STATE_SHIFT; 3578 iwarp_state = (aeq_info & NES_AEQE_IWARP_STATE_MASK) >> NES_AEQE_IWARP_STATE_SHIFT;
3579 nes_debug(NES_DBG_AEQ, "aeid = 0x%04X, qp-cq id = %d, aeqe = %p," 3579 nes_debug(NES_DBG_AEQ, "aeid = 0x%04X, qp-cq id = %d, aeqe = %p,"
3580 " Tcp state = %s, iWARP state = %s\n", 3580 " Tcp state = %d, iWARP state = %d\n",
3581 async_event_id, 3581 async_event_id,
3582 le32_to_cpu(aeqe->aeqe_words[NES_AEQE_COMP_QP_CQ_ID_IDX]), aeqe, 3582 le32_to_cpu(aeqe->aeqe_words[NES_AEQE_COMP_QP_CQ_ID_IDX]), aeqe,
3583 nes_tcp_state_str[tcp_state], nes_iwarp_state_str[iwarp_state]); 3583 tcp_state, iwarp_state);
3584 3584
3585 aeqe_cq_id = le32_to_cpu(aeqe->aeqe_words[NES_AEQE_COMP_QP_CQ_ID_IDX]); 3585 aeqe_cq_id = le32_to_cpu(aeqe->aeqe_words[NES_AEQE_COMP_QP_CQ_ID_IDX]);
3586 if (aeq_info & NES_AEQE_QP) { 3586 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 f3a3ecf8d09e..d0391ac21d9b 100644
--- a/drivers/infiniband/hw/nes/nes_nic.c
+++ b/drivers/infiniband/hw/nes/nes_nic.c
@@ -385,24 +385,20 @@ static int nes_nic_send(struct sk_buff *skb, struct net_device *netdev)
385 /* bump past the vlan tag */ 385 /* bump past the vlan tag */
386 wqe_fragment_length++; 386 wqe_fragment_length++;
387 /* wqe_fragment_address = (u64 *)&nic_sqe->wqe_words[NES_NIC_SQ_WQE_FRAG0_LOW_IDX]; */ 387 /* wqe_fragment_address = (u64 *)&nic_sqe->wqe_words[NES_NIC_SQ_WQE_FRAG0_LOW_IDX]; */
388 wqe_misc |= NES_NIC_SQ_WQE_COMPLETION;
388 389
389 if (skb->ip_summed == CHECKSUM_PARTIAL) { 390 if (skb->ip_summed == CHECKSUM_PARTIAL) {
390 tcph = tcp_hdr(skb); 391 if (skb_is_gso(skb)) {
391 if (1) { 392 tcph = tcp_hdr(skb);
392 if (skb_is_gso(skb)) { 393 /* nes_debug(NES_DBG_NIC_TX, "%s: TSO request... is_gso = %u seg size = %u\n",
393 /* nes_debug(NES_DBG_NIC_TX, "%s: TSO request... seg size = %u\n", 394 netdev->name, skb_is_gso(skb), skb_shinfo(skb)->gso_size); */
394 netdev->name, skb_is_gso(skb)); */ 395 wqe_misc |= NES_NIC_SQ_WQE_LSO_ENABLE | (u16)skb_shinfo(skb)->gso_size;
395 wqe_misc |= NES_NIC_SQ_WQE_LSO_ENABLE | 396 set_wqe_32bit_value(nic_sqe->wqe_words, NES_NIC_SQ_WQE_LSO_INFO_IDX,
396 NES_NIC_SQ_WQE_COMPLETION | (u16)skb_is_gso(skb); 397 ((u32)tcph->doff) |
397 set_wqe_32bit_value(nic_sqe->wqe_words, NES_NIC_SQ_WQE_LSO_INFO_IDX, 398 (((u32)(((unsigned char *)tcph) - skb->data)) << 4));
398 ((u32)tcph->doff) |
399 (((u32)(((unsigned char *)tcph) - skb->data)) << 4));
400 } else {
401 wqe_misc |= NES_NIC_SQ_WQE_COMPLETION;
402 }
403 } 399 }
404 } else { /* CHECKSUM_HW */ 400 } else { /* CHECKSUM_HW */
405 wqe_misc |= NES_NIC_SQ_WQE_DISABLE_CHKSUM | NES_NIC_SQ_WQE_COMPLETION; 401 wqe_misc |= NES_NIC_SQ_WQE_DISABLE_CHKSUM;
406 } 402 }
407 403
408 set_wqe_32bit_value(nic_sqe->wqe_words, NES_NIC_SQ_WQE_TOTAL_LENGTH_IDX, 404 set_wqe_32bit_value(nic_sqe->wqe_words, NES_NIC_SQ_WQE_TOTAL_LENGTH_IDX,
@@ -597,10 +593,10 @@ tso_sq_no_longer_full:
597 nes_debug(NES_DBG_NIC_TX, "ERROR: SKB header too big, headlen=%u, FIRST_FRAG_SIZE=%u\n", 593 nes_debug(NES_DBG_NIC_TX, "ERROR: SKB header too big, headlen=%u, FIRST_FRAG_SIZE=%u\n",
598 original_first_length, NES_FIRST_FRAG_SIZE); 594 original_first_length, NES_FIRST_FRAG_SIZE);
599 nes_debug(NES_DBG_NIC_TX, "%s Request to tx NIC packet length %u, headlen %u," 595 nes_debug(NES_DBG_NIC_TX, "%s Request to tx NIC packet length %u, headlen %u,"
600 " (%u frags), tso_size=%u\n", 596 " (%u frags), is_gso = %u tso_size=%u\n",
601 netdev->name, 597 netdev->name,
602 skb->len, skb_headlen(skb), 598 skb->len, skb_headlen(skb),
603 skb_shinfo(skb)->nr_frags, skb_is_gso(skb)); 599 skb_shinfo(skb)->nr_frags, skb_is_gso(skb), skb_shinfo(skb)->gso_size);
604 } 600 }
605 memcpy(&nesnic->first_frag_vbase[nesnic->sq_head].buffer, 601 memcpy(&nesnic->first_frag_vbase[nesnic->sq_head].buffer,
606 skb->data, min(((unsigned int)NES_FIRST_FRAG_SIZE), 602 skb->data, min(((unsigned int)NES_FIRST_FRAG_SIZE),
@@ -652,8 +648,8 @@ tso_sq_no_longer_full:
652 } else { 648 } else {
653 nesnic->tx_skb[nesnic->sq_head] = NULL; 649 nesnic->tx_skb[nesnic->sq_head] = NULL;
654 } 650 }
655 wqe_misc |= NES_NIC_SQ_WQE_COMPLETION | (u16)skb_is_gso(skb); 651 wqe_misc |= NES_NIC_SQ_WQE_COMPLETION | (u16)skb_shinfo(skb)->gso_size;
656 if ((tso_wqe_length + original_first_length) > skb_is_gso(skb)) { 652 if ((tso_wqe_length + original_first_length) > skb_shinfo(skb)->gso_size) {
657 wqe_misc |= NES_NIC_SQ_WQE_LSO_ENABLE; 653 wqe_misc |= NES_NIC_SQ_WQE_LSO_ENABLE;
658 } else { 654 } else {
659 iph->tot_len = htons(tso_wqe_length + original_first_length - nhoffset); 655 iph->tot_len = htons(tso_wqe_length + original_first_length - nhoffset);
@@ -1679,12 +1675,10 @@ struct net_device *nes_netdev_init(struct nes_device *nesdev,
1679 netdev->hard_header_len = ETH_HLEN; 1675 netdev->hard_header_len = ETH_HLEN;
1680 netdev->addr_len = ETH_ALEN; 1676 netdev->addr_len = ETH_ALEN;
1681 netdev->type = ARPHRD_ETHER; 1677 netdev->type = ARPHRD_ETHER;
1682 netdev->features = NETIF_F_HIGHDMA;
1683 netdev->netdev_ops = &nes_netdev_ops; 1678 netdev->netdev_ops = &nes_netdev_ops;
1684 netdev->ethtool_ops = &nes_ethtool_ops; 1679 netdev->ethtool_ops = &nes_ethtool_ops;
1685 netif_napi_add(netdev, &nesvnic->napi, nes_netdev_poll, 128); 1680 netif_napi_add(netdev, &nesvnic->napi, nes_netdev_poll, 128);
1686 nes_debug(NES_DBG_INIT, "Enabling VLAN Insert/Delete.\n"); 1681 nes_debug(NES_DBG_INIT, "Enabling VLAN Insert/Delete.\n");
1687 netdev->features |= NETIF_F_HW_VLAN_TX;
1688 1682
1689 /* Fill in the port structure */ 1683 /* Fill in the port structure */
1690 nesvnic->netdev = netdev; 1684 nesvnic->netdev = netdev;
@@ -1711,11 +1705,11 @@ struct net_device *nes_netdev_init(struct nes_device *nesdev,
1711 netdev->dev_addr[5] = (u8)u64temp; 1705 netdev->dev_addr[5] = (u8)u64temp;
1712 memcpy(netdev->perm_addr, netdev->dev_addr, 6); 1706 memcpy(netdev->perm_addr, netdev->dev_addr, 6);
1713 1707
1714 netdev->hw_features = NETIF_F_RXCSUM | NETIF_F_SG | NETIF_F_IP_CSUM | 1708 netdev->hw_features = NETIF_F_SG | NETIF_F_IP_CSUM | NETIF_F_RXCSUM | NETIF_F_HW_VLAN_RX;
1715 NETIF_F_HW_VLAN_RX;
1716 if ((nesvnic->logical_port < 2) || (nesdev->nesadapter->hw_rev != NE020_REV)) 1709 if ((nesvnic->logical_port < 2) || (nesdev->nesadapter->hw_rev != NE020_REV))
1717 netdev->hw_features |= NETIF_F_TSO; 1710 netdev->hw_features |= NETIF_F_TSO;
1718 netdev->features |= netdev->hw_features; 1711
1712 netdev->features = netdev->hw_features | NETIF_F_HIGHDMA | NETIF_F_HW_VLAN_TX;
1719 netdev->hw_features |= NETIF_F_LRO; 1713 netdev->hw_features |= NETIF_F_LRO;
1720 1714
1721 nes_debug(NES_DBG_INIT, "nesvnic = %p, reported features = 0x%lX, QPid = %d," 1715 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);