* [net-next-2.6 PATCH 1/4] enic: This patch adds pci id 0x71 for SRIOV VF's
2012-01-18 14:23 [net-next-2.6 PATCH 0/4] enic: updates to version 2.1.1.31 Roopa Prabhu
@ 2012-01-18 14:23 ` Roopa Prabhu
2012-01-18 14:24 ` [net-next-2.6 PATCH 2/4] enic: Add sriov vf device id checks in port profile code Roopa Prabhu
` (3 subsequent siblings)
4 siblings, 0 replies; 6+ messages in thread
From: Roopa Prabhu @ 2012-01-18 14:23 UTC (permalink / raw)
To: davem; +Cc: netdev
From: Roopa Prabhu <roprabhu@cisco.com>
This patch adds pci id 0x71 for sriov VF's.
Signed-off-by: Roopa Prabhu <roprabhu@cisco.com>
Signed-off-by: Christian Benvenuti <benve@cisco.com>
Signed-off-by: Sujith Sankar <ssujith@cisco.com>
---
drivers/net/ethernet/cisco/enic/enic.h | 2 +-
drivers/net/ethernet/cisco/enic/enic_main.c | 7 +++++++
2 files changed, 8 insertions(+), 1 deletions(-)
diff --git a/drivers/net/ethernet/cisco/enic/enic.h b/drivers/net/ethernet/cisco/enic/enic.h
index fe0c29a..ee93a20 100644
--- a/drivers/net/ethernet/cisco/enic/enic.h
+++ b/drivers/net/ethernet/cisco/enic/enic.h
@@ -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
diff --git a/drivers/net/ethernet/cisco/enic/enic_main.c b/drivers/net/ethernet/cisco/enic/enic_main.c
index 2fd9db4..a634f58 100644
--- a/drivers/net/ethernet/cisco/enic/enic_main.c
+++ b/drivers/net/ethernet/cisco/enic/enic_main.c
@@ -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
^ permalink raw reply related [flat|nested] 6+ messages in thread
* [net-next-2.6 PATCH 2/4] enic: Add sriov vf device id checks in port profile code
2012-01-18 14:23 [net-next-2.6 PATCH 0/4] enic: updates to version 2.1.1.31 Roopa Prabhu
2012-01-18 14:23 ` [net-next-2.6 PATCH 1/4] enic: This patch adds pci id 0x71 for SRIOV VF's Roopa Prabhu
@ 2012-01-18 14:24 ` Roopa Prabhu
2012-01-18 14:24 ` [net-next-2.6 PATCH 3/4] enic: rearrange some of the " Roopa Prabhu
` (2 subsequent siblings)
4 siblings, 0 replies; 6+ messages in thread
From: Roopa Prabhu @ 2012-01-18 14:24 UTC (permalink / raw)
To: davem; +Cc: netdev
From: Roopa Prabhu <roprabhu@cisco.com>
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>
---
drivers/net/ethernet/cisco/enic/enic_main.c | 17 ++++++++---------
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 a634f58..9f37d92 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)
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;
^ permalink raw reply related [flat|nested] 6+ messages in thread
* [net-next-2.6 PATCH 3/4] enic: rearrange some of the port profile code
2012-01-18 14:23 [net-next-2.6 PATCH 0/4] enic: updates to version 2.1.1.31 Roopa Prabhu
2012-01-18 14:23 ` [net-next-2.6 PATCH 1/4] enic: This patch adds pci id 0x71 for SRIOV VF's Roopa Prabhu
2012-01-18 14:24 ` [net-next-2.6 PATCH 2/4] enic: Add sriov vf device id checks in port profile code Roopa Prabhu
@ 2012-01-18 14:24 ` Roopa Prabhu
2012-01-18 14:24 ` [net-next-2.6 PATCH 4/4] enic: fix location of vnic dev unregister in enic_probe cleanup code Roopa Prabhu
2012-01-18 21:16 ` [net-next-2.6 PATCH 0/4] enic: updates to version 2.1.1.31 David Miller
4 siblings, 0 replies; 6+ messages in thread
From: Roopa Prabhu @ 2012-01-18 14:24 UTC (permalink / raw)
To: davem; +Cc: netdev
From: Roopa Prabhu <roprabhu@cisco.com>
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: Roopa Prabhu <roprabhu@cisco.com>
Signed-off-by: Christian Benvenuti <benve@cisco.com>
Signed-off-by: Sujith Sankar <ssujith@cisco.com>
---
drivers/net/ethernet/cisco/enic/enic_main.c | 14 +++++++-------
1 files changed, 7 insertions(+), 7 deletions(-)
diff --git a/drivers/net/ethernet/cisco/enic/enic_main.c b/drivers/net/ethernet/cisco/enic/enic_main.c
index 9f37d92..03b0577 100644
--- a/drivers/net/ethernet/cisco/enic/enic_main.c
+++ b/drivers/net/ethernet/cisco/enic/enic_main.c
@@ -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);
^ permalink raw reply related [flat|nested] 6+ messages in thread
* [net-next-2.6 PATCH 4/4] enic: fix location of vnic dev unregister in enic_probe cleanup code
2012-01-18 14:23 [net-next-2.6 PATCH 0/4] enic: updates to version 2.1.1.31 Roopa Prabhu
` (2 preceding siblings ...)
2012-01-18 14:24 ` [net-next-2.6 PATCH 3/4] enic: rearrange some of the " Roopa Prabhu
@ 2012-01-18 14:24 ` Roopa Prabhu
2012-01-18 21:16 ` [net-next-2.6 PATCH 0/4] enic: updates to version 2.1.1.31 David Miller
4 siblings, 0 replies; 6+ messages in thread
From: Roopa Prabhu @ 2012-01-18 14:24 UTC (permalink / raw)
To: davem; +Cc: netdev
From: Roopa Prabhu <roprabhu@cisco.com>
The vnic_dev_unregister is erroneously under CONFIG_PCI_IOV. This patch moves
it out of CONFIG_PCI_IOV
Signed-off-by: Roopa Prabhu <roprabhu@cisco.com>
Signed-off-by: Christian Benvenuti <benve@cisco.com>
Signed-off-by: Sujith Sankar <ssujith@cisco.com>
---
drivers/net/ethernet/cisco/enic/enic_main.c | 2 +-
1 files changed, 1 insertions(+), 1 deletions(-)
diff --git a/drivers/net/ethernet/cisco/enic/enic_main.c b/drivers/net/ethernet/cisco/enic/enic_main.c
index 03b0577..045c468 100644
--- a/drivers/net/ethernet/cisco/enic/enic_main.c
+++ b/drivers/net/ethernet/cisco/enic/enic_main.c
@@ -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:
^ permalink raw reply related [flat|nested] 6+ messages in thread
* Re: [net-next-2.6 PATCH 0/4] enic: updates to version 2.1.1.31
2012-01-18 14:23 [net-next-2.6 PATCH 0/4] enic: updates to version 2.1.1.31 Roopa Prabhu
` (3 preceding siblings ...)
2012-01-18 14:24 ` [net-next-2.6 PATCH 4/4] enic: fix location of vnic dev unregister in enic_probe cleanup code Roopa Prabhu
@ 2012-01-18 21:16 ` David Miller
4 siblings, 0 replies; 6+ messages in thread
From: David Miller @ 2012-01-18 21:16 UTC (permalink / raw)
To: roprabhu; +Cc: netdev
From: Roopa Prabhu <roprabhu@cisco.com>
Date: Wed, 18 Jan 2012 06:23:50 -0800
> 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
>
> Signed-off-by: Roopa Prabhu <roprabhu@cisco.com>
> Signed-off-by: Christian Benvenuti <benve@cisco.com>
> Signed-off-by: Sujith Sankar <ssujith@cisco.com>
All applied, thanks.
^ permalink raw reply [flat|nested] 6+ messages in thread