Commit ca2b721d authored by Roopa Prabhu's avatar Roopa Prabhu Committed by David S. Miller

enic: rearrange some of the port profile code

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.
Signed-off-by: default avatarRoopa Prabhu <roprabhu@cisco.com>
Signed-off-by: default avatarChristian Benvenuti <benve@cisco.com>
Signed-off-by: default avatarSujith Sankar <ssujith@cisco.com>
Signed-off-by: default avatarDavid S. Miller <davem@davemloft.net>
parent 7335903c
...@@ -2270,10 +2270,10 @@ static int __devinit enic_probe(struct pci_dev *pdev, ...@@ -2270,10 +2270,10 @@ static int __devinit enic_probe(struct pci_dev *pdev,
int using_dac = 0; int using_dac = 0;
unsigned int i; unsigned int i;
int err; int err;
int num_pps = 1;
#ifdef CONFIG_PCI_IOV #ifdef CONFIG_PCI_IOV
int pos = 0; int pos = 0;
#endif #endif
int num_pps;
/* Allocate net device structure and initialize. Private /* Allocate net device structure and initialize. Private
* instance data is initialized to zero. * instance data is initialized to zero.
...@@ -2380,17 +2380,17 @@ static int __devinit enic_probe(struct pci_dev *pdev, ...@@ -2380,17 +2380,17 @@ static int __devinit enic_probe(struct pci_dev *pdev,
goto err_out_vnic_unregister; goto err_out_vnic_unregister;
} }
enic->priv_flags |= ENIC_SRIOV_ENABLED; enic->priv_flags |= ENIC_SRIOV_ENABLED;
num_pps = enic->num_vfs;
} }
} }
#endif #endif
num_pps = enic->num_vfs ? enic->num_vfs : 1;
/* Allocate structure for port profiles */ /* Allocate structure for port profiles */
enic->pp = kcalloc(num_pps, sizeof(*enic->pp), GFP_KERNEL); enic->pp = kcalloc(num_pps, sizeof(*enic->pp), GFP_KERNEL);
if (!enic->pp) { if (!enic->pp) {
pr_err("port profile alloc failed, aborting\n"); pr_err("port profile alloc failed, aborting\n");
err = -ENOMEM; err = -ENOMEM;
goto err_out_disable_sriov; goto err_out_disable_sriov_pp;
} }
/* Issue device open to get device in known state /* Issue device open to get device in known state
...@@ -2399,7 +2399,7 @@ static int __devinit enic_probe(struct pci_dev *pdev, ...@@ -2399,7 +2399,7 @@ static int __devinit enic_probe(struct pci_dev *pdev,
err = enic_dev_open(enic); err = enic_dev_open(enic);
if (err) { if (err) {
dev_err(dev, "vNIC dev open failed, aborting\n"); dev_err(dev, "vNIC dev open failed, aborting\n");
goto err_out_free_pp; goto err_out_disable_sriov;
} }
/* Setup devcmd lock /* Setup devcmd lock
...@@ -2522,9 +2522,9 @@ static int __devinit enic_probe(struct pci_dev *pdev, ...@@ -2522,9 +2522,9 @@ static int __devinit enic_probe(struct pci_dev *pdev,
enic_dev_deinit(enic); enic_dev_deinit(enic);
err_out_dev_close: err_out_dev_close:
vnic_dev_close(enic->vdev); vnic_dev_close(enic->vdev);
err_out_free_pp:
kfree(enic->pp);
err_out_disable_sriov: err_out_disable_sriov:
kfree(enic->pp);
err_out_disable_sriov_pp:
#ifdef CONFIG_PCI_IOV #ifdef CONFIG_PCI_IOV
if (enic_sriov_enabled(enic)) { if (enic_sriov_enabled(enic)) {
pci_disable_sriov(pdev); pci_disable_sriov(pdev);
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment