aboutsummaryrefslogtreecommitdiffstats
path: root/drivers/net
diff options
context:
space:
mode:
authorRoopa Prabhu <roprabhu@cisco.com>2012-01-17 23:24:02 -0500
committerDavid S. Miller <davem@davemloft.net>2012-01-18 16:16:41 -0500
commit7335903cba523fc2fd801a178a0e4fcf8ccae756 (patch)
treef6b5673471dbf1b783d8b36410378aa2c71ed7e4 /drivers/net
parent3a4adef5c0adbbd0d898578e13ba1adbbdecbbd5 (diff)
enic: Add sriov vf device id checks in port profile code
This patch adds checks for sriov vf's in enic port profile handling code. sriov vf's are same as dynamic vnics but with a different device id. Signed-off-by: Roopa Prabhu <roprabhu@cisco.com> Signed-off-by: Christian Benvenuti <benve@cisco.com> Signed-off-by: Sujith Sankar <ssujith@cisco.com> Signed-off-by: David S. Miller <davem@davemloft.net>
Diffstat (limited to 'drivers/net')
-rw-r--r--drivers/net/ethernet/cisco/enic/enic_main.c17
1 files changed, 8 insertions, 9 deletions
diff --git a/drivers/net/ethernet/cisco/enic/enic_main.c b/drivers/net/ethernet/cisco/enic/enic_main.c
index a634f58976af..9f37d92fc76d 100644
--- a/drivers/net/ethernet/cisco/enic/enic_main.c
+++ b/drivers/net/ethernet/cisco/enic/enic_main.c
@@ -444,7 +444,7 @@ static void enic_mtu_check(struct enic *enic)
444 444
445 if (mtu && mtu != enic->port_mtu) { 445 if (mtu && mtu != enic->port_mtu) {
446 enic->port_mtu = mtu; 446 enic->port_mtu = mtu;
447 if (enic_is_dynamic(enic)) { 447 if (enic_is_dynamic(enic) || enic_is_sriov_vf(enic)) {
448 mtu = max_t(int, ENIC_MIN_MTU, 448 mtu = max_t(int, ENIC_MIN_MTU,
449 min_t(int, ENIC_MAX_MTU, mtu)); 449 min_t(int, ENIC_MAX_MTU, mtu));
450 if (mtu != netdev->mtu) 450 if (mtu != netdev->mtu)
@@ -856,7 +856,7 @@ static int enic_set_mac_addr(struct net_device *netdev, char *addr)
856{ 856{
857 struct enic *enic = netdev_priv(netdev); 857 struct enic *enic = netdev_priv(netdev);
858 858
859 if (enic_is_dynamic(enic)) { 859 if (enic_is_dynamic(enic) || enic_is_sriov_vf(enic)) {
860 if (!is_valid_ether_addr(addr) && !is_zero_ether_addr(addr)) 860 if (!is_valid_ether_addr(addr) && !is_zero_ether_addr(addr))
861 return -EADDRNOTAVAIL; 861 return -EADDRNOTAVAIL;
862 } else { 862 } else {
@@ -1615,7 +1615,7 @@ static int enic_open(struct net_device *netdev)
1615 for (i = 0; i < enic->rq_count; i++) 1615 for (i = 0; i < enic->rq_count; i++)
1616 vnic_rq_enable(&enic->rq[i]); 1616 vnic_rq_enable(&enic->rq[i]);
1617 1617
1618 if (!enic_is_dynamic(enic)) 1618 if (!enic_is_dynamic(enic) && !enic_is_sriov_vf(enic))
1619 enic_dev_add_station_addr(enic); 1619 enic_dev_add_station_addr(enic);
1620 1620
1621 enic_set_rx_mode(netdev); 1621 enic_set_rx_mode(netdev);
@@ -1666,7 +1666,7 @@ static int enic_stop(struct net_device *netdev)
1666 netif_carrier_off(netdev); 1666 netif_carrier_off(netdev);
1667 netif_tx_disable(netdev); 1667 netif_tx_disable(netdev);
1668 1668
1669 if (!enic_is_dynamic(enic)) 1669 if (!enic_is_dynamic(enic) && !enic_is_sriov_vf(enic))
1670 enic_dev_del_station_addr(enic); 1670 enic_dev_del_station_addr(enic);
1671 1671
1672 for (i = 0; i < enic->wq_count; i++) { 1672 for (i = 0; i < enic->wq_count; i++) {
@@ -1703,7 +1703,7 @@ static int enic_change_mtu(struct net_device *netdev, int new_mtu)
1703 if (new_mtu < ENIC_MIN_MTU || new_mtu > ENIC_MAX_MTU) 1703 if (new_mtu < ENIC_MIN_MTU || new_mtu > ENIC_MAX_MTU)
1704 return -EINVAL; 1704 return -EINVAL;
1705 1705
1706 if (enic_is_dynamic(enic)) 1706 if (enic_is_dynamic(enic) || enic_is_sriov_vf(enic))
1707 return -EOPNOTSUPP; 1707 return -EOPNOTSUPP;
1708 1708
1709 if (running) 1709 if (running)
@@ -2433,7 +2433,7 @@ static int __devinit enic_probe(struct pci_dev *pdev,
2433 * called later by an upper layer. 2433 * called later by an upper layer.
2434 */ 2434 */
2435 2435
2436 if (!enic_is_dynamic(enic)) { 2436 if (!enic_is_dynamic(enic) && !enic_is_sriov_vf(enic)) {
2437 err = vnic_dev_init(enic->vdev, 0); 2437 err = vnic_dev_init(enic->vdev, 0);
2438 if (err) { 2438 if (err) {
2439 dev_err(dev, "vNIC dev init failed, aborting\n"); 2439 dev_err(dev, "vNIC dev init failed, aborting\n");
@@ -2467,8 +2467,7 @@ static int __devinit enic_probe(struct pci_dev *pdev,
2467 (void)enic_change_mtu(netdev, enic->port_mtu); 2467 (void)enic_change_mtu(netdev, enic->port_mtu);
2468 2468
2469#ifdef CONFIG_PCI_IOV 2469#ifdef CONFIG_PCI_IOV
2470 if (enic_is_dynamic(enic) && pdev->is_virtfn && 2470 if (enic_is_sriov_vf(enic) && is_zero_ether_addr(enic->mac_addr))
2471 is_zero_ether_addr(enic->mac_addr))
2472 random_ether_addr(enic->mac_addr); 2471 random_ether_addr(enic->mac_addr);
2473#endif 2472#endif
2474 2473
@@ -2481,7 +2480,7 @@ static int __devinit enic_probe(struct pci_dev *pdev,
2481 enic->tx_coalesce_usecs = enic->config.intr_timer_usec; 2480 enic->tx_coalesce_usecs = enic->config.intr_timer_usec;
2482 enic->rx_coalesce_usecs = enic->tx_coalesce_usecs; 2481 enic->rx_coalesce_usecs = enic->tx_coalesce_usecs;
2483 2482
2484 if (enic_is_dynamic(enic)) 2483 if (enic_is_dynamic(enic) || enic_is_sriov_vf(enic))
2485 netdev->netdev_ops = &enic_netdev_dynamic_ops; 2484 netdev->netdev_ops = &enic_netdev_dynamic_ops;
2486 else 2485 else
2487 netdev->netdev_ops = &enic_netdev_ops; 2486 netdev->netdev_ops = &enic_netdev_ops;