Commit 62ac3ce5 authored by Jonathan Cooper's avatar Jonathan Cooper Committed by David S. Miller

sfc: Remove netdev init from efx_init_struct

Move functionality involving the struct net_device out of
efx_init_struct so that we can initialise without a net dev
for VDPA operation.
Signed-off-by: default avatarJonathan Cooper <jonathan.s.cooper@amd.com>
Co-developed-by: default avatarMartin Habets <habetsm.xilinx@gmail.com>
Signed-off-by: default avatarMartin Habets <habetsm.xilinx@gmail.com>
Signed-off-by: default avatarDavid S. Miller <davem@davemloft.net>
parent 8b39db19
...@@ -469,10 +469,12 @@ static int ef100_pci_probe(struct pci_dev *pci_dev, ...@@ -469,10 +469,12 @@ static int ef100_pci_probe(struct pci_dev *pci_dev,
pci_set_drvdata(pci_dev, efx); pci_set_drvdata(pci_dev, efx);
SET_NETDEV_DEV(net_dev, &pci_dev->dev); SET_NETDEV_DEV(net_dev, &pci_dev->dev);
rc = efx_init_struct(efx, pci_dev, net_dev); efx->net_dev = net_dev;
rc = efx_init_struct(efx, pci_dev);
if (rc) if (rc)
goto fail; goto fail;
efx->mdio.dev = net_dev;
efx->vi_stride = EF100_DEFAULT_VI_STRIDE; efx->vi_stride = EF100_DEFAULT_VI_STRIDE;
netif_info(efx, probe, efx->net_dev, netif_info(efx, probe, efx->net_dev,
"Solarflare EF100 NIC detected\n"); "Solarflare EF100 NIC detected\n");
......
...@@ -1056,9 +1056,10 @@ static int efx_pci_probe(struct pci_dev *pci_dev, ...@@ -1056,9 +1056,10 @@ static int efx_pci_probe(struct pci_dev *pci_dev,
pci_set_drvdata(pci_dev, efx); pci_set_drvdata(pci_dev, efx);
SET_NETDEV_DEV(net_dev, &pci_dev->dev); SET_NETDEV_DEV(net_dev, &pci_dev->dev);
rc = efx_init_struct(efx, pci_dev, net_dev); rc = efx_init_struct(efx, pci_dev);
if (rc) if (rc)
goto fail1; goto fail1;
efx->mdio.dev = net_dev;
pci_info(pci_dev, "Solarflare NIC detected\n"); pci_info(pci_dev, "Solarflare NIC detected\n");
......
...@@ -978,8 +978,7 @@ void efx_port_dummy_op_void(struct efx_nic *efx) {} ...@@ -978,8 +978,7 @@ void efx_port_dummy_op_void(struct efx_nic *efx) {}
/* This zeroes out and then fills in the invariants in a struct /* This zeroes out and then fills in the invariants in a struct
* efx_nic (including all sub-structures). * efx_nic (including all sub-structures).
*/ */
int efx_init_struct(struct efx_nic *efx, int efx_init_struct(struct efx_nic *efx, struct pci_dev *pci_dev)
struct pci_dev *pci_dev, struct net_device *net_dev)
{ {
int rc = -ENOMEM; int rc = -ENOMEM;
...@@ -998,7 +997,6 @@ int efx_init_struct(struct efx_nic *efx, ...@@ -998,7 +997,6 @@ int efx_init_struct(struct efx_nic *efx,
efx->state = STATE_UNINIT; efx->state = STATE_UNINIT;
strlcpy(efx->name, pci_name(pci_dev), sizeof(efx->name)); strlcpy(efx->name, pci_name(pci_dev), sizeof(efx->name));
efx->net_dev = net_dev;
efx->rx_prefix_size = efx->type->rx_prefix_size; efx->rx_prefix_size = efx->type->rx_prefix_size;
efx->rx_ip_align = efx->rx_ip_align =
NET_IP_ALIGN ? (efx->rx_prefix_size + NET_IP_ALIGN) % 4 : 0; NET_IP_ALIGN ? (efx->rx_prefix_size + NET_IP_ALIGN) % 4 : 0;
...@@ -1023,7 +1021,6 @@ int efx_init_struct(struct efx_nic *efx, ...@@ -1023,7 +1021,6 @@ int efx_init_struct(struct efx_nic *efx,
efx->rps_hash_table = kcalloc(EFX_ARFS_HASH_TABLE_SIZE, efx->rps_hash_table = kcalloc(EFX_ARFS_HASH_TABLE_SIZE,
sizeof(*efx->rps_hash_table), GFP_KERNEL); sizeof(*efx->rps_hash_table), GFP_KERNEL);
#endif #endif
efx->mdio.dev = net_dev;
INIT_WORK(&efx->mac_work, efx_mac_work); INIT_WORK(&efx->mac_work, efx_mac_work);
init_waitqueue_head(&efx->flush_wq); init_waitqueue_head(&efx->flush_wq);
......
...@@ -14,8 +14,7 @@ ...@@ -14,8 +14,7 @@
int efx_init_io(struct efx_nic *efx, int bar, dma_addr_t dma_mask, int efx_init_io(struct efx_nic *efx, int bar, dma_addr_t dma_mask,
unsigned int mem_map_size); unsigned int mem_map_size);
void efx_fini_io(struct efx_nic *efx); void efx_fini_io(struct efx_nic *efx);
int efx_init_struct(struct efx_nic *efx, struct pci_dev *pci_dev, int efx_init_struct(struct efx_nic *efx, struct pci_dev *pci_dev);
struct net_device *net_dev);
void efx_fini_struct(struct efx_nic *efx); void efx_fini_struct(struct efx_nic *efx);
#define EFX_MAX_DMAQ_SIZE 4096UL #define EFX_MAX_DMAQ_SIZE 4096UL
......
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