enic: updates to version 2.1.1.31
Subsystems (3)
cover enic: updates to version 2.1.1.31
This patch series implements the following enic driver sriov related updates:
01/4 - enic: This patch adds pci id 0x71 for SRIOV VF's
02/4 - enic: Add sriov vf device id checks in port profile code 03/4 - enic: rearrange some of the sriov port profile code
04/4 - enic: fix location of vnic dev unregister in enic_probe cleanup code
PATCH 1/4 enic: This patch adds pci id 0x71 for SRIOV VF's
From: Roopa Prabhu <[email protected]>
This patch adds pci id 0x71 for sriov VF's.
--- drivers/net/ethernet/cisco/enic/enic.h | 2 +- drivers/net/ethernet/cisco/enic/enic_main.c | 7 +++++++ 2 files changed, 8 insertions(+), 1 deletions(-)
drivers/net/ethernet/cisco/enic/enic.h +1 -1
@@ -32,7 +32,7 @@#define DRV_NAME "enic"#define DRV_DESCRIPTION "Cisco VIC Ethernet NIC Driver" -#define DRV_VERSION "2.1.1.28" +#define DRV_VERSION "2.1.1.31"#define DRV_COPYRIGHT "Copyright 2008-2011 Cisco Systems, Inc"#define ENIC_BARS_MAX 6
drivers/net/ethernet/cisco/enic/enic_main.c +7 -0
@@ -57,11 +57,13 @@#define PCI_DEVICE_ID_CISCO_VIC_ENET 0x0043/* ethernet vnic */ #define PCI_DEVICE_ID_CISCO_VIC_ENET_DYN 0x0044/* enet dynamic vnic */ +#define PCI_DEVICE_ID_CISCO_VIC_ENET_VF 0x0071/* enet SRIOV VF */ /* Supported devices */ static DEFINE_PCI_DEVICE_TABLE (enic_id_table) = { {PCI_VDEVICE (CISCO ,PCI_DEVICE_ID_CISCO_VIC_ENET ) }, {PCI_VDEVICE (CISCO ,PCI_DEVICE_ID_CISCO_VIC_ENET_DYN ) }, + {PCI_VDEVICE (CISCO ,PCI_DEVICE_ID_CISCO_VIC_ENET_VF ) }, {0 , }/* end of table */ };
@@ -132,6 +134,11 @@ int enic_sriov_enabled(struct enic *enic)return (enic->priv_flags &ENIC_SRIOV_ENABLED ) ?1 :0 ; } +static int enic_is_sriov_vf (struct enic *enic) +{ +return enic->pdev->device ==PCI_DEVICE_ID_CISCO_VIC_ENET_VF ; +} +int enic_is_valid_vf (struct enic *enic,int vf) {#ifdef CONFIG_PCI_IOV
PATCH 2/4 enic: Add sriov vf device id checks in port profile code
In reply to Roopa PrabhuFrom: Roopa Prabhu <[email protected]>
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.
--- drivers/net/ethernet/cisco/enic/enic_main.c | 17 ++++++++--------- 1 files changed, 8 insertions(+), 9 deletions(-)
drivers/net/ethernet/cisco/enic/enic_main.c +8 -9
@@ -444,7 +444,7 @@ static void enic_mtu_check(struct enic *enic)if (mtu && mtu != enic->port_mtu) { enic->port_mtu = mtu; -if (enic_is_dynamic (enic)) { +if (enic_is_dynamic (enic) ||enic_is_sriov_vf (enic)) { mtu =max_t (int,ENIC_MIN_MTU ,min_t (int,ENIC_MAX_MTU , mtu));if (mtu != netdev->mtu)
@@ -856,7 +856,7 @@ static int enic_set_mac_addr(struct net_device *netdev, char *addr) {struct enic *enic =netdev_priv (netdev); -if (enic_is_dynamic (enic)) { +if (enic_is_dynamic (enic) ||enic_is_sriov_vf (enic)) {if (!is_valid_ether_addr (addr) && !is_zero_ether_addr (addr))return -EADDRNOTAVAIL ; }else {
@@ -1615,7 +1615,7 @@ static int enic_open(struct net_device *netdev)for (i =0 ; i < enic->rq_count; i++)vnic_rq_enable (&enic->rq[i]); -if (!enic_is_dynamic (enic)) +if (!enic_is_dynamic (enic) && !enic_is_sriov_vf (enic))enic_dev_add_station_addr (enic);enic_set_rx_mode (netdev);
@@ -1666,7 +1666,7 @@ static int enic_stop(struct net_device *netdev)netif_carrier_off (netdev);netif_tx_disable (netdev); -if (!enic_is_dynamic (enic)) +if (!enic_is_dynamic (enic) && !enic_is_sriov_vf (enic))enic_dev_del_station_addr (enic);for (i =0 ; i < enic->wq_count; i++) {
@@ -1703,7 +1703,7 @@ static int enic_change_mtu(struct net_device *netdev, int new_mtu)if (new_mtu <ENIC_MIN_MTU || new_mtu >ENIC_MAX_MTU )return -EINVAL ; -if (enic_is_dynamic (enic)) +if (enic_is_dynamic (enic) ||enic_is_sriov_vf (enic))return -EOPNOTSUPP ;if (running)
@@ -2433,7 +2433,7 @@ static int __devinit enic_probe(struct pci_dev *pdev,* called later by an upper layer. */ -if (!enic_is_dynamic (enic)) { +if (!enic_is_dynamic (enic) && !enic_is_sriov_vf (enic)) { err =vnic_dev_init (enic->vdev,0 );if (err) {dev_err (dev,"vNIC dev init failed, aborting\n" );
@@ -2467,8 +2467,7 @@ static int __devinit enic_probe(struct pci_dev *pdev, (void )enic_change_mtu (netdev, enic->port_mtu);#ifdef CONFIG_PCI_IOV -if (enic_is_dynamic (enic) && pdev->is_virtfn && -is_zero_ether_addr (enic->mac_addr)) +if (enic_is_sriov_vf (enic) &&is_zero_ether_addr (enic->mac_addr))random_ether_addr (enic->mac_addr);#endif
@@ -2481,7 +2480,7 @@ static int __devinit enic_probe(struct pci_dev *pdev, enic->tx_coalesce_usecs = enic->config.intr_timer_usec; enic->rx_coalesce_usecs = enic->tx_coalesce_usecs; -if (enic_is_dynamic (enic)) +if (enic_is_dynamic (enic) ||enic_is_sriov_vf (enic)) netdev->netdev_ops = &enic_netdev_dynamic_ops;else netdev->netdev_ops = &enic_netdev_ops;
PATCH 3/4 enic: rearrange some of the port profile code
In reply to Roopa PrabhuFrom: Roopa Prabhu <[email protected]>
This patch rearranges some of the port profile code in enic_probe. It moves out some lines of port profile related code currently inside CONFIG_PCI_IOV. This is only done to move all port profile related code together so that it can help isolate the port profile handling code under a separate #ifdef in our internal build scripts.
--- drivers/net/ethernet/cisco/enic/enic_main.c | 14 +++++++------- 1 files changed, 7 insertions(+), 7 deletions(-)
drivers/net/ethernet/cisco/enic/enic_main.c +7 -7
@@ -2270,10 +2270,10 @@ static int __devinit enic_probe(struct pci_dev *pdev,int using_dac =0 ;unsigned int i;int err; -int num_pps =1 ;#ifdef CONFIG_PCI_IOV int pos =0 ;#endif +int num_pps;/* Allocate net device structure and initialize. Private * instance data is initialized to zero.
@@ -2380,17 +2380,17 @@ static int __devinit enic_probe(struct pci_dev *pdev, goto err_out_vnic_unregister; } enic->priv_flags |=ENIC_SRIOV_ENABLED ; - num_pps = enic->num_vfs; } } -#endif + + num_pps = enic->num_vfs ? enic->num_vfs :1 ;/* Allocate structure for port profiles */ enic->pp =kcalloc (num_pps,sizeof (*enic->pp),GFP_KERNEL );if (!enic->pp) {pr_err ("port profile alloc failed, aborting\n" ); err = -ENOMEM ; - goto err_out_disable_sriov; + goto err_out_disable_sriov_pp; }/* Issue device open to get device in known state
@@ -2399,7 +2399,7 @@ static int __devinit enic_probe(struct pci_dev *pdev, err =enic_dev_open (enic);if (err) {dev_err (dev,"vNIC dev open failed, aborting\n" ); - goto err_out_free_pp; + goto err_out_disable_sriov; }/* Setup devcmd lock
@@ -2522,9 +2522,9 @@ err_out_dev_deinit:enic_dev_deinit (enic); err_out_dev_close:vnic_dev_close (enic->vdev); -err_out_free_pp: -kfree (enic->pp); err_out_disable_sriov: +kfree (enic->pp); +err_out_disable_sriov_pp:#ifdef CONFIG_PCI_IOV if (enic_sriov_enabled (enic)) {pci_disable_sriov (pdev);
PATCH 4/4 enic: fix location of vnic dev unregister in enic_probe cleanup code
In reply to Roopa PrabhuFrom: Roopa Prabhu <[email protected]>
The vnic_dev_unregister is erroneously under CONFIG_PCI_IOV. This patch moves it out of CONFIG_PCI_IOV
--- drivers/net/ethernet/cisco/enic/enic_main.c | 2 +- 1 files changed, 1 insertions(+), 1 deletions(-)
drivers/net/ethernet/cisco/enic/enic_main.c +1 -1
@@ -2531,8 +2531,8 @@ err_out_disable_sriov_pp: enic->priv_flags &= ~ENIC_SRIOV_ENABLED ; } err_out_vnic_unregister: -vnic_dev_unregister (enic->vdev);#endif +vnic_dev_unregister (enic->vdev); err_out_iounmap:enic_iounmap (enic); err_out_release_regions:
David Miller
maintainerFrom: Roopa Prabhu <[email protected]>
Date: Wed, 18 Jan 2012 06:23:50 -0800
Quoted 10 lines
This patch series implements the following enic driver sriov related updates:
01/4 - enic: This patch adds pci id
0x71for SRIOV VF's
02/4 - enic: Add sriov vf device id checks in port profile code 03/4 - enic: rearrange some of the sriov port profile code
04/4 - enic: fix location of vnic dev unregister inenic_probecleanup codeSigned-off-by Roopa Prabhu <[email protected]>Signed-off-by Christian Benvenuti <[email protected]>Signed-off-by Sujith Sankar <[email protected]>
All applied, thanks.