diff options
Diffstat (limited to 'drivers/net/ethernet/cisco/enic')
-rw-r--r-- | drivers/net/ethernet/cisco/enic/enic.h | 2 | ||||
-rw-r--r-- | drivers/net/ethernet/cisco/enic/enic_main.c | 38 |
2 files changed, 23 insertions, 17 deletions
diff --git a/drivers/net/ethernet/cisco/enic/enic.h b/drivers/net/ethernet/cisco/enic/enic.h index fe0c29acdbe6..ee93a2087fe6 100644 --- a/drivers/net/ethernet/cisco/enic/enic.h +++ b/drivers/net/ethernet/cisco/enic/enic.h | |||
@@ -32,7 +32,7 @@ | |||
32 | 32 | ||
33 | #define DRV_NAME "enic" | 33 | #define DRV_NAME "enic" |
34 | #define DRV_DESCRIPTION "Cisco VIC Ethernet NIC Driver" | 34 | #define DRV_DESCRIPTION "Cisco VIC Ethernet NIC Driver" |
35 | #define DRV_VERSION "2.1.1.28" | 35 | #define DRV_VERSION "2.1.1.31" |
36 | #define DRV_COPYRIGHT "Copyright 2008-2011 Cisco Systems, Inc" | 36 | #define DRV_COPYRIGHT "Copyright 2008-2011 Cisco Systems, Inc" |
37 | 37 | ||
38 | #define ENIC_BARS_MAX 6 | 38 | #define ENIC_BARS_MAX 6 |
diff --git a/drivers/net/ethernet/cisco/enic/enic_main.c b/drivers/net/ethernet/cisco/enic/enic_main.c index 2fd9db4b1be5..ab3f67f980d8 100644 --- a/drivers/net/ethernet/cisco/enic/enic_main.c +++ b/drivers/net/ethernet/cisco/enic/enic_main.c | |||
@@ -57,11 +57,13 @@ | |||
57 | 57 | ||
58 | #define PCI_DEVICE_ID_CISCO_VIC_ENET 0x0043 /* ethernet vnic */ | 58 | #define PCI_DEVICE_ID_CISCO_VIC_ENET 0x0043 /* ethernet vnic */ |
59 | #define PCI_DEVICE_ID_CISCO_VIC_ENET_DYN 0x0044 /* enet dynamic vnic */ | 59 | #define PCI_DEVICE_ID_CISCO_VIC_ENET_DYN 0x0044 /* enet dynamic vnic */ |
60 | #define PCI_DEVICE_ID_CISCO_VIC_ENET_VF 0x0071 /* enet SRIOV VF */ | ||
60 | 61 | ||
61 | /* Supported devices */ | 62 | /* Supported devices */ |
62 | static DEFINE_PCI_DEVICE_TABLE(enic_id_table) = { | 63 | static DEFINE_PCI_DEVICE_TABLE(enic_id_table) = { |
63 | { PCI_VDEVICE(CISCO, PCI_DEVICE_ID_CISCO_VIC_ENET) }, | 64 | { PCI_VDEVICE(CISCO, PCI_DEVICE_ID_CISCO_VIC_ENET) }, |
64 | { PCI_VDEVICE(CISCO, PCI_DEVICE_ID_CISCO_VIC_ENET_DYN) }, | 65 | { PCI_VDEVICE(CISCO, PCI_DEVICE_ID_CISCO_VIC_ENET_DYN) }, |
66 | { PCI_VDEVICE(CISCO, PCI_DEVICE_ID_CISCO_VIC_ENET_VF) }, | ||
65 | { 0, } /* end of table */ | 67 | { 0, } /* end of table */ |
66 | }; | 68 | }; |
67 | 69 | ||
@@ -132,6 +134,11 @@ int enic_sriov_enabled(struct enic *enic) | |||
132 | return (enic->priv_flags & ENIC_SRIOV_ENABLED) ? 1 : 0; | 134 | return (enic->priv_flags & ENIC_SRIOV_ENABLED) ? 1 : 0; |
133 | } | 135 | } |
134 | 136 | ||
137 | static int enic_is_sriov_vf(struct enic *enic) | ||
138 | { | ||
139 | return enic->pdev->device == PCI_DEVICE_ID_CISCO_VIC_ENET_VF; | ||
140 | } | ||
141 | |||
135 | int enic_is_valid_vf(struct enic *enic, int vf) | 142 | int enic_is_valid_vf(struct enic *enic, int vf) |
136 | { | 143 | { |
137 | #ifdef CONFIG_PCI_IOV | 144 | #ifdef CONFIG_PCI_IOV |
@@ -437,7 +444,7 @@ static void enic_mtu_check(struct enic *enic) | |||
437 | 444 | ||
438 | if (mtu && mtu != enic->port_mtu) { | 445 | if (mtu && mtu != enic->port_mtu) { |
439 | enic->port_mtu = mtu; | 446 | enic->port_mtu = mtu; |
440 | if (enic_is_dynamic(enic)) { | 447 | if (enic_is_dynamic(enic) || enic_is_sriov_vf(enic)) { |
441 | mtu = max_t(int, ENIC_MIN_MTU, | 448 | mtu = max_t(int, ENIC_MIN_MTU, |
442 | min_t(int, ENIC_MAX_MTU, mtu)); | 449 | min_t(int, ENIC_MAX_MTU, mtu)); |
443 | if (mtu != netdev->mtu) | 450 | if (mtu != netdev->mtu) |
@@ -849,7 +856,7 @@ static int enic_set_mac_addr(struct net_device *netdev, char *addr) | |||
849 | { | 856 | { |
850 | struct enic *enic = netdev_priv(netdev); | 857 | struct enic *enic = netdev_priv(netdev); |
851 | 858 | ||
852 | if (enic_is_dynamic(enic)) { | 859 | if (enic_is_dynamic(enic) || enic_is_sriov_vf(enic)) { |
853 | if (!is_valid_ether_addr(addr) && !is_zero_ether_addr(addr)) | 860 | if (!is_valid_ether_addr(addr) && !is_zero_ether_addr(addr)) |
854 | return -EADDRNOTAVAIL; | 861 | return -EADDRNOTAVAIL; |
855 | } else { | 862 | } else { |
@@ -1608,7 +1615,7 @@ static int enic_open(struct net_device *netdev) | |||
1608 | for (i = 0; i < enic->rq_count; i++) | 1615 | for (i = 0; i < enic->rq_count; i++) |
1609 | vnic_rq_enable(&enic->rq[i]); | 1616 | vnic_rq_enable(&enic->rq[i]); |
1610 | 1617 | ||
1611 | if (!enic_is_dynamic(enic)) | 1618 | if (!enic_is_dynamic(enic) && !enic_is_sriov_vf(enic)) |
1612 | enic_dev_add_station_addr(enic); | 1619 | enic_dev_add_station_addr(enic); |
1613 | 1620 | ||
1614 | enic_set_rx_mode(netdev); | 1621 | enic_set_rx_mode(netdev); |
@@ -1659,7 +1666,7 @@ static int enic_stop(struct net_device *netdev) | |||
1659 | netif_carrier_off(netdev); | 1666 | netif_carrier_off(netdev); |
1660 | netif_tx_disable(netdev); | 1667 | netif_tx_disable(netdev); |
1661 | 1668 | ||
1662 | if (!enic_is_dynamic(enic)) | 1669 | if (!enic_is_dynamic(enic) && !enic_is_sriov_vf(enic)) |
1663 | enic_dev_del_station_addr(enic); | 1670 | enic_dev_del_station_addr(enic); |
1664 | 1671 | ||
1665 | for (i = 0; i < enic->wq_count; i++) { | 1672 | for (i = 0; i < enic->wq_count; i++) { |
@@ -1696,7 +1703,7 @@ static int enic_change_mtu(struct net_device *netdev, int new_mtu) | |||
1696 | if (new_mtu < ENIC_MIN_MTU || new_mtu > ENIC_MAX_MTU) | 1703 | if (new_mtu < ENIC_MIN_MTU || new_mtu > ENIC_MAX_MTU) |
1697 | return -EINVAL; | 1704 | return -EINVAL; |
1698 | 1705 | ||
1699 | if (enic_is_dynamic(enic)) | 1706 | if (enic_is_dynamic(enic) || enic_is_sriov_vf(enic)) |
1700 | return -EOPNOTSUPP; | 1707 | return -EOPNOTSUPP; |
1701 | 1708 | ||
1702 | if (running) | 1709 | if (running) |
@@ -2263,10 +2270,10 @@ static int __devinit enic_probe(struct pci_dev *pdev, | |||
2263 | int using_dac = 0; | 2270 | int using_dac = 0; |
2264 | unsigned int i; | 2271 | unsigned int i; |
2265 | int err; | 2272 | int err; |
2266 | int num_pps = 1; | ||
2267 | #ifdef CONFIG_PCI_IOV | 2273 | #ifdef CONFIG_PCI_IOV |
2268 | int pos = 0; | 2274 | int pos = 0; |
2269 | #endif | 2275 | #endif |
2276 | int num_pps = 1; | ||
2270 | 2277 | ||
2271 | /* Allocate net device structure and initialize. Private | 2278 | /* Allocate net device structure and initialize. Private |
2272 | * instance data is initialized to zero. | 2279 | * instance data is initialized to zero. |
@@ -2376,14 +2383,14 @@ static int __devinit enic_probe(struct pci_dev *pdev, | |||
2376 | num_pps = enic->num_vfs; | 2383 | num_pps = enic->num_vfs; |
2377 | } | 2384 | } |
2378 | } | 2385 | } |
2379 | |||
2380 | #endif | 2386 | #endif |
2387 | |||
2381 | /* Allocate structure for port profiles */ | 2388 | /* Allocate structure for port profiles */ |
2382 | enic->pp = kcalloc(num_pps, sizeof(*enic->pp), GFP_KERNEL); | 2389 | enic->pp = kcalloc(num_pps, sizeof(*enic->pp), GFP_KERNEL); |
2383 | if (!enic->pp) { | 2390 | if (!enic->pp) { |
2384 | pr_err("port profile alloc failed, aborting\n"); | 2391 | pr_err("port profile alloc failed, aborting\n"); |
2385 | err = -ENOMEM; | 2392 | err = -ENOMEM; |
2386 | goto err_out_disable_sriov; | 2393 | goto err_out_disable_sriov_pp; |
2387 | } | 2394 | } |
2388 | 2395 | ||
2389 | /* Issue device open to get device in known state | 2396 | /* Issue device open to get device in known state |
@@ -2392,7 +2399,7 @@ static int __devinit enic_probe(struct pci_dev *pdev, | |||
2392 | err = enic_dev_open(enic); | 2399 | err = enic_dev_open(enic); |
2393 | if (err) { | 2400 | if (err) { |
2394 | dev_err(dev, "vNIC dev open failed, aborting\n"); | 2401 | dev_err(dev, "vNIC dev open failed, aborting\n"); |
2395 | goto err_out_free_pp; | 2402 | goto err_out_disable_sriov; |
2396 | } | 2403 | } |
2397 | 2404 | ||
2398 | /* Setup devcmd lock | 2405 | /* Setup devcmd lock |
@@ -2426,7 +2433,7 @@ static int __devinit enic_probe(struct pci_dev *pdev, | |||
2426 | * called later by an upper layer. | 2433 | * called later by an upper layer. |
2427 | */ | 2434 | */ |
2428 | 2435 | ||
2429 | if (!enic_is_dynamic(enic)) { | 2436 | if (!enic_is_dynamic(enic) && !enic_is_sriov_vf(enic)) { |
2430 | err = vnic_dev_init(enic->vdev, 0); | 2437 | err = vnic_dev_init(enic->vdev, 0); |
2431 | if (err) { | 2438 | if (err) { |
2432 | dev_err(dev, "vNIC dev init failed, aborting\n"); | 2439 | dev_err(dev, "vNIC dev init failed, aborting\n"); |
@@ -2460,8 +2467,7 @@ static int __devinit enic_probe(struct pci_dev *pdev, | |||
2460 | (void)enic_change_mtu(netdev, enic->port_mtu); | 2467 | (void)enic_change_mtu(netdev, enic->port_mtu); |
2461 | 2468 | ||
2462 | #ifdef CONFIG_PCI_IOV | 2469 | #ifdef CONFIG_PCI_IOV |
2463 | if (enic_is_dynamic(enic) && pdev->is_virtfn && | 2470 | if (enic_is_sriov_vf(enic) && is_zero_ether_addr(enic->mac_addr)) |
2464 | is_zero_ether_addr(enic->mac_addr)) | ||
2465 | random_ether_addr(enic->mac_addr); | 2471 | random_ether_addr(enic->mac_addr); |
2466 | #endif | 2472 | #endif |
2467 | 2473 | ||
@@ -2474,7 +2480,7 @@ static int __devinit enic_probe(struct pci_dev *pdev, | |||
2474 | enic->tx_coalesce_usecs = enic->config.intr_timer_usec; | 2480 | enic->tx_coalesce_usecs = enic->config.intr_timer_usec; |
2475 | enic->rx_coalesce_usecs = enic->tx_coalesce_usecs; | 2481 | enic->rx_coalesce_usecs = enic->tx_coalesce_usecs; |
2476 | 2482 | ||
2477 | if (enic_is_dynamic(enic)) | 2483 | if (enic_is_dynamic(enic) || enic_is_sriov_vf(enic)) |
2478 | netdev->netdev_ops = &enic_netdev_dynamic_ops; | 2484 | netdev->netdev_ops = &enic_netdev_dynamic_ops; |
2479 | else | 2485 | else |
2480 | netdev->netdev_ops = &enic_netdev_ops; | 2486 | netdev->netdev_ops = &enic_netdev_ops; |
@@ -2516,17 +2522,17 @@ err_out_dev_deinit: | |||
2516 | enic_dev_deinit(enic); | 2522 | enic_dev_deinit(enic); |
2517 | err_out_dev_close: | 2523 | err_out_dev_close: |
2518 | vnic_dev_close(enic->vdev); | 2524 | vnic_dev_close(enic->vdev); |
2519 | err_out_free_pp: | ||
2520 | kfree(enic->pp); | ||
2521 | err_out_disable_sriov: | 2525 | err_out_disable_sriov: |
2526 | kfree(enic->pp); | ||
2527 | err_out_disable_sriov_pp: | ||
2522 | #ifdef CONFIG_PCI_IOV | 2528 | #ifdef CONFIG_PCI_IOV |
2523 | if (enic_sriov_enabled(enic)) { | 2529 | if (enic_sriov_enabled(enic)) { |
2524 | pci_disable_sriov(pdev); | 2530 | pci_disable_sriov(pdev); |
2525 | enic->priv_flags &= ~ENIC_SRIOV_ENABLED; | 2531 | enic->priv_flags &= ~ENIC_SRIOV_ENABLED; |
2526 | } | 2532 | } |
2527 | err_out_vnic_unregister: | 2533 | err_out_vnic_unregister: |
2528 | vnic_dev_unregister(enic->vdev); | ||
2529 | #endif | 2534 | #endif |
2535 | vnic_dev_unregister(enic->vdev); | ||
2530 | err_out_iounmap: | 2536 | err_out_iounmap: |
2531 | enic_iounmap(enic); | 2537 | enic_iounmap(enic); |
2532 | err_out_release_regions: | 2538 | err_out_release_regions: |