diff options
Diffstat (limited to 'drivers')
-rw-r--r-- | drivers/infiniband/core/sysfs.c | 4 | ||||
-rw-r--r-- | drivers/infiniband/hw/nes/nes_nic.c | 62 | ||||
-rw-r--r-- | drivers/infiniband/hw/nes/nes_verbs.c | 2 |
3 files changed, 48 insertions, 20 deletions
diff --git a/drivers/infiniband/core/sysfs.c b/drivers/infiniband/core/sysfs.c index c864ef70fdf9..5a4b2e65534b 100644 --- a/drivers/infiniband/core/sysfs.c +++ b/drivers/infiniband/core/sysfs.c | |||
@@ -686,8 +686,10 @@ int ib_device_register_sysfs(struct ib_device *device) | |||
686 | 686 | ||
687 | device->ports_parent = kobject_create_and_add("ports", | 687 | device->ports_parent = kobject_create_and_add("ports", |
688 | kobject_get(&class_dev->kobj)); | 688 | kobject_get(&class_dev->kobj)); |
689 | if (!device->ports_parent) | 689 | if (!device->ports_parent) { |
690 | ret = -ENOMEM; | ||
690 | goto err_put; | 691 | goto err_put; |
692 | } | ||
691 | 693 | ||
692 | if (device->node_type == RDMA_NODE_IB_SWITCH) { | 694 | if (device->node_type == RDMA_NODE_IB_SWITCH) { |
693 | ret = add_port(device, 0); | 695 | ret = add_port(device, 0); |
diff --git a/drivers/infiniband/hw/nes/nes_nic.c b/drivers/infiniband/hw/nes/nes_nic.c index b6cc265aa9a4..eee77da61935 100644 --- a/drivers/infiniband/hw/nes/nes_nic.c +++ b/drivers/infiniband/hw/nes/nes_nic.c | |||
@@ -148,14 +148,15 @@ static int nes_netdev_open(struct net_device *netdev) | |||
148 | struct nes_device *nesdev = nesvnic->nesdev; | 148 | struct nes_device *nesdev = nesvnic->nesdev; |
149 | int ret; | 149 | int ret; |
150 | int i; | 150 | int i; |
151 | struct nes_vnic *first_nesvnic; | 151 | struct nes_vnic *first_nesvnic = NULL; |
152 | u32 nic_active_bit; | 152 | u32 nic_active_bit; |
153 | u32 nic_active; | 153 | u32 nic_active; |
154 | struct list_head *list_pos, *list_temp; | ||
154 | 155 | ||
155 | assert(nesdev != NULL); | 156 | assert(nesdev != NULL); |
156 | 157 | ||
157 | first_nesvnic = list_entry(nesdev->nesadapter->nesvnic_list[nesdev->mac_index].next, | 158 | if (nesvnic->netdev_open == 1) |
158 | struct nes_vnic, list); | 159 | return 0; |
159 | 160 | ||
160 | if (netif_msg_ifup(nesvnic)) | 161 | if (netif_msg_ifup(nesvnic)) |
161 | printk(KERN_INFO PFX "%s: enabling interface\n", netdev->name); | 162 | printk(KERN_INFO PFX "%s: enabling interface\n", netdev->name); |
@@ -225,7 +226,18 @@ static int nes_netdev_open(struct net_device *netdev) | |||
225 | nes_write32(nesdev->regs+NES_CQE_ALLOC, NES_CQE_ALLOC_NOTIFY_NEXT | | 226 | nes_write32(nesdev->regs+NES_CQE_ALLOC, NES_CQE_ALLOC_NOTIFY_NEXT | |
226 | nesvnic->nic_cq.cq_number); | 227 | nesvnic->nic_cq.cq_number); |
227 | nes_read32(nesdev->regs+NES_CQE_ALLOC); | 228 | nes_read32(nesdev->regs+NES_CQE_ALLOC); |
228 | 229 | list_for_each_safe(list_pos, list_temp, &nesdev->nesadapter->nesvnic_list[nesdev->mac_index]) { | |
230 | first_nesvnic = container_of(list_pos, struct nes_vnic, list); | ||
231 | if (first_nesvnic->netdev_open == 1) | ||
232 | break; | ||
233 | } | ||
234 | if (first_nesvnic->netdev_open == 0) { | ||
235 | nes_debug(NES_DBG_INIT, "Setting up MAC interrupt mask.\n"); | ||
236 | nes_write_indexed(nesdev, NES_IDX_MAC_INT_MASK + (0x200 * nesdev->mac_index), | ||
237 | ~(NES_MAC_INT_LINK_STAT_CHG | NES_MAC_INT_XGMII_EXT | | ||
238 | NES_MAC_INT_TX_UNDERFLOW | NES_MAC_INT_TX_ERROR)); | ||
239 | first_nesvnic = nesvnic; | ||
240 | } | ||
229 | if (first_nesvnic->linkup) { | 241 | if (first_nesvnic->linkup) { |
230 | /* Enable network packets */ | 242 | /* Enable network packets */ |
231 | nesvnic->linkup = 1; | 243 | nesvnic->linkup = 1; |
@@ -248,6 +260,8 @@ static int nes_netdev_stop(struct net_device *netdev) | |||
248 | struct nes_device *nesdev = nesvnic->nesdev; | 260 | struct nes_device *nesdev = nesvnic->nesdev; |
249 | u32 nic_active_mask; | 261 | u32 nic_active_mask; |
250 | u32 nic_active; | 262 | u32 nic_active; |
263 | struct nes_vnic *first_nesvnic = NULL; | ||
264 | struct list_head *list_pos, *list_temp; | ||
251 | 265 | ||
252 | nes_debug(NES_DBG_SHUTDOWN, "nesvnic=%p, nesdev=%p, netdev=%p %s\n", | 266 | nes_debug(NES_DBG_SHUTDOWN, "nesvnic=%p, nesdev=%p, netdev=%p %s\n", |
253 | nesvnic, nesdev, netdev, netdev->name); | 267 | nesvnic, nesdev, netdev, netdev->name); |
@@ -260,9 +274,20 @@ static int nes_netdev_stop(struct net_device *netdev) | |||
260 | /* Disable network packets */ | 274 | /* Disable network packets */ |
261 | napi_disable(&nesvnic->napi); | 275 | napi_disable(&nesvnic->napi); |
262 | netif_stop_queue(netdev); | 276 | netif_stop_queue(netdev); |
263 | if ((nesdev->netdev[0] == netdev) & (nesvnic->logical_port == nesdev->mac_index)) { | 277 | list_for_each_safe(list_pos, list_temp, &nesdev->nesadapter->nesvnic_list[nesdev->mac_index]) { |
264 | nes_write_indexed(nesdev, | 278 | first_nesvnic = container_of(list_pos, struct nes_vnic, list); |
265 | NES_IDX_MAC_INT_MASK+(0x200*nesdev->mac_index), 0xffffffff); | 279 | if ((first_nesvnic->netdev_open == 1) && (first_nesvnic != nesvnic)) |
280 | break; | ||
281 | } | ||
282 | |||
283 | if (first_nesvnic->netdev_open == 0) | ||
284 | nes_write_indexed(nesdev, NES_IDX_MAC_INT_MASK+(0x200*nesdev->mac_index), 0xffffffff); | ||
285 | else if ((first_nesvnic != nesvnic) && | ||
286 | (PCI_FUNC(first_nesvnic->nesdev->pcidev->devfn) != PCI_FUNC(nesvnic->nesdev->pcidev->devfn))) { | ||
287 | nes_write_indexed(nesdev, NES_IDX_MAC_INT_MASK + (0x200 * nesdev->mac_index), 0xffffffff); | ||
288 | nes_write_indexed(first_nesvnic->nesdev, NES_IDX_MAC_INT_MASK + (0x200 * first_nesvnic->nesdev->mac_index), | ||
289 | ~(NES_MAC_INT_LINK_STAT_CHG | NES_MAC_INT_XGMII_EXT | | ||
290 | NES_MAC_INT_TX_UNDERFLOW | NES_MAC_INT_TX_ERROR)); | ||
266 | } | 291 | } |
267 | 292 | ||
268 | nic_active_mask = ~((u32)(1 << nesvnic->nic_index)); | 293 | nic_active_mask = ~((u32)(1 << nesvnic->nic_index)); |
@@ -859,7 +884,6 @@ void nes_netdev_set_multicast_list(struct net_device *netdev) | |||
859 | for (mc_index=0; mc_index < NES_MULTICAST_PF_MAX; mc_index++) { | 884 | for (mc_index=0; mc_index < NES_MULTICAST_PF_MAX; mc_index++) { |
860 | while (multicast_addr && nesvnic->mcrq_mcast_filter && ((mc_nic_index = nesvnic->mcrq_mcast_filter(nesvnic, multicast_addr->dmi_addr)) == 0)) | 885 | while (multicast_addr && nesvnic->mcrq_mcast_filter && ((mc_nic_index = nesvnic->mcrq_mcast_filter(nesvnic, multicast_addr->dmi_addr)) == 0)) |
861 | multicast_addr = multicast_addr->next; | 886 | multicast_addr = multicast_addr->next; |
862 | |||
863 | if (mc_nic_index < 0) | 887 | if (mc_nic_index < 0) |
864 | mc_nic_index = nesvnic->nic_index; | 888 | mc_nic_index = nesvnic->nic_index; |
865 | if (multicast_addr) { | 889 | if (multicast_addr) { |
@@ -908,7 +932,7 @@ static int nes_netdev_change_mtu(struct net_device *netdev, int new_mtu) | |||
908 | return -EINVAL; | 932 | return -EINVAL; |
909 | 933 | ||
910 | netdev->mtu = new_mtu; | 934 | netdev->mtu = new_mtu; |
911 | nesvnic->max_frame_size = new_mtu+ETH_HLEN; | 935 | nesvnic->max_frame_size = new_mtu + VLAN_ETH_HLEN; |
912 | 936 | ||
913 | if (netdev->mtu > 1500) { | 937 | if (netdev->mtu > 1500) { |
914 | jumbomode=1; | 938 | jumbomode=1; |
@@ -1470,10 +1494,15 @@ static void nes_netdev_vlan_rx_register(struct net_device *netdev, struct vlan_g | |||
1470 | { | 1494 | { |
1471 | struct nes_vnic *nesvnic = netdev_priv(netdev); | 1495 | struct nes_vnic *nesvnic = netdev_priv(netdev); |
1472 | struct nes_device *nesdev = nesvnic->nesdev; | 1496 | struct nes_device *nesdev = nesvnic->nesdev; |
1497 | struct nes_adapter *nesadapter = nesdev->nesadapter; | ||
1473 | u32 u32temp; | 1498 | u32 u32temp; |
1499 | unsigned long flags; | ||
1474 | 1500 | ||
1501 | spin_lock_irqsave(&nesadapter->phy_lock, flags); | ||
1475 | nesvnic->vlan_grp = grp; | 1502 | nesvnic->vlan_grp = grp; |
1476 | 1503 | ||
1504 | nes_debug(NES_DBG_NETDEV, "%s: %s\n", __func__, netdev->name); | ||
1505 | |||
1477 | /* Enable/Disable VLAN Stripping */ | 1506 | /* Enable/Disable VLAN Stripping */ |
1478 | u32temp = nes_read_indexed(nesdev, NES_IDX_PCIX_DIAG); | 1507 | u32temp = nes_read_indexed(nesdev, NES_IDX_PCIX_DIAG); |
1479 | if (grp) | 1508 | if (grp) |
@@ -1482,6 +1511,7 @@ static void nes_netdev_vlan_rx_register(struct net_device *netdev, struct vlan_g | |||
1482 | u32temp |= 0x02000000; | 1511 | u32temp |= 0x02000000; |
1483 | 1512 | ||
1484 | nes_write_indexed(nesdev, NES_IDX_PCIX_DIAG, u32temp); | 1513 | nes_write_indexed(nesdev, NES_IDX_PCIX_DIAG, u32temp); |
1514 | spin_unlock_irqrestore(&nesadapter->phy_lock, flags); | ||
1485 | } | 1515 | } |
1486 | 1516 | ||
1487 | 1517 | ||
@@ -1540,7 +1570,7 @@ struct net_device *nes_netdev_init(struct nes_device *nesdev, | |||
1540 | nesvnic->msg_enable = netif_msg_init(debug, default_msg); | 1570 | nesvnic->msg_enable = netif_msg_init(debug, default_msg); |
1541 | nesvnic->netdev_index = nesdev->netdev_count; | 1571 | nesvnic->netdev_index = nesdev->netdev_count; |
1542 | nesvnic->perfect_filter_index = nesdev->nesadapter->netdev_count; | 1572 | nesvnic->perfect_filter_index = nesdev->nesadapter->netdev_count; |
1543 | nesvnic->max_frame_size = netdev->mtu+netdev->hard_header_len; | 1573 | nesvnic->max_frame_size = netdev->mtu + netdev->hard_header_len + VLAN_HLEN; |
1544 | 1574 | ||
1545 | curr_qp_map = nic_qp_mapping_per_function[PCI_FUNC(nesdev->pcidev->devfn)]; | 1575 | curr_qp_map = nic_qp_mapping_per_function[PCI_FUNC(nesdev->pcidev->devfn)]; |
1546 | nesvnic->nic.qp_id = curr_qp_map[nesdev->netdev_count].qpid; | 1576 | nesvnic->nic.qp_id = curr_qp_map[nesdev->netdev_count].qpid; |
@@ -1610,7 +1640,7 @@ struct net_device *nes_netdev_init(struct nes_device *nesdev, | |||
1610 | list_add_tail(&nesvnic->list, &nesdev->nesadapter->nesvnic_list[nesdev->mac_index]); | 1640 | list_add_tail(&nesvnic->list, &nesdev->nesadapter->nesvnic_list[nesdev->mac_index]); |
1611 | 1641 | ||
1612 | if ((nesdev->netdev_count == 0) && | 1642 | if ((nesdev->netdev_count == 0) && |
1613 | (PCI_FUNC(nesdev->pcidev->devfn) == nesdev->mac_index)) { | 1643 | (PCI_FUNC(nesdev->pcidev->devfn) == nesdev->mac_index)) { |
1614 | nes_debug(NES_DBG_INIT, "Setting up PHY interrupt mask. Using register index 0x%04X\n", | 1644 | nes_debug(NES_DBG_INIT, "Setting up PHY interrupt mask. Using register index 0x%04X\n", |
1615 | NES_IDX_PHY_PCS_CONTROL_STATUS0+(0x200*(nesvnic->logical_port&1))); | 1645 | NES_IDX_PHY_PCS_CONTROL_STATUS0+(0x200*(nesvnic->logical_port&1))); |
1616 | u32temp = nes_read_indexed(nesdev, NES_IDX_PHY_PCS_CONTROL_STATUS0 + | 1646 | u32temp = nes_read_indexed(nesdev, NES_IDX_PHY_PCS_CONTROL_STATUS0 + |
@@ -1648,18 +1678,14 @@ struct net_device *nes_netdev_init(struct nes_device *nesdev, | |||
1648 | nesvnic->linkup = 1; | 1678 | nesvnic->linkup = 1; |
1649 | } | 1679 | } |
1650 | } | 1680 | } |
1651 | nes_debug(NES_DBG_INIT, "Setting up MAC interrupt mask.\n"); | ||
1652 | /* clear the MAC interrupt status, assumes direct logical to physical mapping */ | 1681 | /* clear the MAC interrupt status, assumes direct logical to physical mapping */ |
1653 | u32temp = nes_read_indexed(nesdev, NES_IDX_MAC_INT_STATUS+(0x200*nesvnic->logical_port)); | 1682 | u32temp = nes_read_indexed(nesdev, NES_IDX_MAC_INT_STATUS + (0x200 * nesdev->mac_index)); |
1654 | nes_debug(NES_DBG_INIT, "Phy interrupt status = 0x%X.\n", u32temp); | 1683 | nes_debug(NES_DBG_INIT, "Phy interrupt status = 0x%X.\n", u32temp); |
1655 | nes_write_indexed(nesdev, NES_IDX_MAC_INT_STATUS+(0x200*nesvnic->logical_port), u32temp); | 1684 | nes_write_indexed(nesdev, NES_IDX_MAC_INT_STATUS + (0x200 * nesdev->mac_index), u32temp); |
1656 | 1685 | ||
1657 | if (nesdev->nesadapter->phy_type[nesvnic->logical_port] != NES_PHY_TYPE_IRIS) | 1686 | if (nesdev->nesadapter->phy_type[nesdev->mac_index] != NES_PHY_TYPE_IRIS) |
1658 | nes_init_phy(nesdev); | 1687 | nes_init_phy(nesdev); |
1659 | 1688 | ||
1660 | nes_write_indexed(nesdev, NES_IDX_MAC_INT_MASK+(0x200*nesvnic->logical_port), | ||
1661 | ~(NES_MAC_INT_LINK_STAT_CHG | NES_MAC_INT_XGMII_EXT | | ||
1662 | NES_MAC_INT_TX_UNDERFLOW | NES_MAC_INT_TX_ERROR)); | ||
1663 | } | 1689 | } |
1664 | 1690 | ||
1665 | return netdev; | 1691 | return netdev; |
diff --git a/drivers/infiniband/hw/nes/nes_verbs.c b/drivers/infiniband/hw/nes/nes_verbs.c index ffd4b425567f..4dafbe16e82a 100644 --- a/drivers/infiniband/hw/nes/nes_verbs.c +++ b/drivers/infiniband/hw/nes/nes_verbs.c | |||
@@ -1337,7 +1337,7 @@ static struct ib_qp *nes_create_qp(struct ib_pd *ibpd, | |||
1337 | NES_MAX_USER_WQ_REGIONS, nes_ucontext->first_free_wq); | 1337 | NES_MAX_USER_WQ_REGIONS, nes_ucontext->first_free_wq); |
1338 | /* nes_debug(NES_DBG_QP, "find_first_zero_biton wqs returned %u\n", | 1338 | /* nes_debug(NES_DBG_QP, "find_first_zero_biton wqs returned %u\n", |
1339 | nespd->mmap_db_index); */ | 1339 | nespd->mmap_db_index); */ |
1340 | if (nesqp->mmap_sq_db_index > NES_MAX_USER_WQ_REGIONS) { | 1340 | if (nesqp->mmap_sq_db_index >= NES_MAX_USER_WQ_REGIONS) { |
1341 | nes_debug(NES_DBG_QP, | 1341 | nes_debug(NES_DBG_QP, |
1342 | "db index > max user regions, failing create QP\n"); | 1342 | "db index > max user regions, failing create QP\n"); |
1343 | nes_free_resource(nesadapter, nesadapter->allocated_qps, qp_num); | 1343 | nes_free_resource(nesadapter, nesadapter->allocated_qps, qp_num); |