Commit c60fbb00 authored by Alexander Duyck's avatar Alexander Duyck Committed by Jeff Kirsher

ixgbe: move adapter into pci_dev driver data instead of netdev

This change moves an adapter pointer into the private portion of the
pci_dev instead of a pointer to the netdev. The reason for this change is
because in most cases we just want the adapter anyway. In addition as we
start moving toward multiple netdevs per port we may want to move the
adapter pointer out of the netdevs entirely.
Signed-off-by: default avatarAlexander Duyck <alexander.h.duyck@intel.com>
Tested-by: default avatarRoss Brattain <ross.b.brattain@intel.com>
Signed-off-by: default avatarJeff Kirsher <jeffrey.t.kirsher@intel.com>
parent 01fa7d90
...@@ -887,8 +887,7 @@ static void ixgbe_setup_dca(struct ixgbe_adapter *adapter) ...@@ -887,8 +887,7 @@ static void ixgbe_setup_dca(struct ixgbe_adapter *adapter)
static int __ixgbe_notify_dca(struct device *dev, void *data) static int __ixgbe_notify_dca(struct device *dev, void *data)
{ {
struct net_device *netdev = dev_get_drvdata(dev); struct ixgbe_adapter *adapter = dev_get_drvdata(dev);
struct ixgbe_adapter *adapter = netdev_priv(netdev);
unsigned long event = *(unsigned long *)data; unsigned long event = *(unsigned long *)data;
switch (event) { switch (event) {
...@@ -5255,8 +5254,8 @@ static int ixgbe_close(struct net_device *netdev) ...@@ -5255,8 +5254,8 @@ static int ixgbe_close(struct net_device *netdev)
#ifdef CONFIG_PM #ifdef CONFIG_PM
static int ixgbe_resume(struct pci_dev *pdev) static int ixgbe_resume(struct pci_dev *pdev)
{ {
struct net_device *netdev = pci_get_drvdata(pdev); struct ixgbe_adapter *adapter = pci_get_drvdata(pdev);
struct ixgbe_adapter *adapter = netdev_priv(netdev); struct net_device *netdev = adapter->netdev;
u32 err; u32 err;
pci_set_power_state(pdev, PCI_D0); pci_set_power_state(pdev, PCI_D0);
...@@ -5287,7 +5286,7 @@ static int ixgbe_resume(struct pci_dev *pdev) ...@@ -5287,7 +5286,7 @@ static int ixgbe_resume(struct pci_dev *pdev)
IXGBE_WRITE_REG(&adapter->hw, IXGBE_WUS, ~0); IXGBE_WRITE_REG(&adapter->hw, IXGBE_WUS, ~0);
if (netif_running(netdev)) { if (netif_running(netdev)) {
err = ixgbe_open(adapter->netdev); err = ixgbe_open(netdev);
if (err) if (err)
return err; return err;
} }
...@@ -5300,8 +5299,8 @@ static int ixgbe_resume(struct pci_dev *pdev) ...@@ -5300,8 +5299,8 @@ static int ixgbe_resume(struct pci_dev *pdev)
static int __ixgbe_shutdown(struct pci_dev *pdev, bool *enable_wake) static int __ixgbe_shutdown(struct pci_dev *pdev, bool *enable_wake)
{ {
struct net_device *netdev = pci_get_drvdata(pdev); struct ixgbe_adapter *adapter = pci_get_drvdata(pdev);
struct ixgbe_adapter *adapter = netdev_priv(netdev); struct net_device *netdev = adapter->netdev;
struct ixgbe_hw *hw = &adapter->hw; struct ixgbe_hw *hw = &adapter->hw;
u32 ctrl, fctrl; u32 ctrl, fctrl;
u32 wufc = adapter->wol; u32 wufc = adapter->wol;
...@@ -6762,8 +6761,8 @@ static int __devinit ixgbe_probe(struct pci_dev *pdev, ...@@ -6762,8 +6761,8 @@ static int __devinit ixgbe_probe(struct pci_dev *pdev,
SET_NETDEV_DEV(netdev, &pdev->dev); SET_NETDEV_DEV(netdev, &pdev->dev);
pci_set_drvdata(pdev, netdev);
adapter = netdev_priv(netdev); adapter = netdev_priv(netdev);
pci_set_drvdata(pdev, adapter);
adapter->netdev = netdev; adapter->netdev = netdev;
adapter->pdev = pdev; adapter->pdev = pdev;
...@@ -7086,8 +7085,8 @@ static int __devinit ixgbe_probe(struct pci_dev *pdev, ...@@ -7086,8 +7085,8 @@ static int __devinit ixgbe_probe(struct pci_dev *pdev,
**/ **/
static void __devexit ixgbe_remove(struct pci_dev *pdev) static void __devexit ixgbe_remove(struct pci_dev *pdev)
{ {
struct net_device *netdev = pci_get_drvdata(pdev); struct ixgbe_adapter *adapter = pci_get_drvdata(pdev);
struct ixgbe_adapter *adapter = netdev_priv(netdev); struct net_device *netdev = adapter->netdev;
set_bit(__IXGBE_DOWN, &adapter->state); set_bit(__IXGBE_DOWN, &adapter->state);
/* clear the module not found bit to make sure the worker won't /* clear the module not found bit to make sure the worker won't
...@@ -7157,8 +7156,8 @@ static void __devexit ixgbe_remove(struct pci_dev *pdev) ...@@ -7157,8 +7156,8 @@ static void __devexit ixgbe_remove(struct pci_dev *pdev)
static pci_ers_result_t ixgbe_io_error_detected(struct pci_dev *pdev, static pci_ers_result_t ixgbe_io_error_detected(struct pci_dev *pdev,
pci_channel_state_t state) pci_channel_state_t state)
{ {
struct net_device *netdev = pci_get_drvdata(pdev); struct ixgbe_adapter *adapter = pci_get_drvdata(pdev);
struct ixgbe_adapter *adapter = netdev_priv(netdev); struct net_device *netdev = adapter->netdev;
netif_device_detach(netdev); netif_device_detach(netdev);
...@@ -7181,8 +7180,7 @@ static pci_ers_result_t ixgbe_io_error_detected(struct pci_dev *pdev, ...@@ -7181,8 +7180,7 @@ static pci_ers_result_t ixgbe_io_error_detected(struct pci_dev *pdev,
*/ */
static pci_ers_result_t ixgbe_io_slot_reset(struct pci_dev *pdev) static pci_ers_result_t ixgbe_io_slot_reset(struct pci_dev *pdev)
{ {
struct net_device *netdev = pci_get_drvdata(pdev); struct ixgbe_adapter *adapter = pci_get_drvdata(pdev);
struct ixgbe_adapter *adapter = netdev_priv(netdev);
pci_ers_result_t result; pci_ers_result_t result;
int err; int err;
...@@ -7220,8 +7218,8 @@ static pci_ers_result_t ixgbe_io_slot_reset(struct pci_dev *pdev) ...@@ -7220,8 +7218,8 @@ static pci_ers_result_t ixgbe_io_slot_reset(struct pci_dev *pdev)
*/ */
static void ixgbe_io_resume(struct pci_dev *pdev) static void ixgbe_io_resume(struct pci_dev *pdev)
{ {
struct net_device *netdev = pci_get_drvdata(pdev); struct ixgbe_adapter *adapter = pci_get_drvdata(pdev);
struct ixgbe_adapter *adapter = netdev_priv(netdev); struct net_device *netdev = adapter->netdev;
if (netif_running(netdev)) { if (netif_running(netdev)) {
if (ixgbe_up(adapter)) { if (ixgbe_up(adapter)) {
......
...@@ -178,8 +178,7 @@ static int ixgbe_set_vf_mac(struct ixgbe_adapter *adapter, ...@@ -178,8 +178,7 @@ static int ixgbe_set_vf_mac(struct ixgbe_adapter *adapter,
int ixgbe_vf_configuration(struct pci_dev *pdev, unsigned int event_mask) int ixgbe_vf_configuration(struct pci_dev *pdev, unsigned int event_mask)
{ {
unsigned char vf_mac_addr[6]; unsigned char vf_mac_addr[6];
struct net_device *netdev = pci_get_drvdata(pdev); struct ixgbe_adapter *adapter = pci_get_drvdata(pdev);
struct ixgbe_adapter *adapter = netdev_priv(netdev);
unsigned int vfn = (event_mask & 0x3f); unsigned int vfn = (event_mask & 0x3f);
bool enable = ((event_mask & 0x10000000U) != 0); bool enable = ((event_mask & 0x10000000U) != 0);
......
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