Skip to content

Commit

Permalink
be2net: move be_func_init() call inside be_setup()
Browse files Browse the repository at this point in the history
Every time be_setup() is called, the driver will have to wait for the
function/FW to be properly initialized. So, it make sense to move this call
inside be_setup().

Signed-off-by: Sathya Perla <sathya.perla@emulex.com>
Signed-off-by: Kalesh AP <kalesh.purayil@emulex.com>
Signed-off-by: David S. Miller <davem@davemloft.net>
  • Loading branch information
Sathya Perla authored and David S. Miller committed Feb 23, 2015
1 parent 87ac1a5 commit f962f84
Showing 1 changed file with 42 additions and 46 deletions.
88 changes: 42 additions & 46 deletions drivers/net/ethernet/emulex/benet/be_main.c
Original file line number Diff line number Diff line change
Expand Up @@ -3944,11 +3944,53 @@ static inline int fw_major_num(const char *fw_ver)
return fw_major;
}

/* If any VFs are already enabled don't FLR the PF */
static bool be_reset_required(struct be_adapter *adapter)
{
return pci_num_vf(adapter->pdev) ? false : true;
}

/* Wait for the FW to be ready and perform the required initialization */
static int be_func_init(struct be_adapter *adapter)
{
int status;

status = be_fw_wait_ready(adapter);
if (status)
return status;

if (be_reset_required(adapter)) {
status = be_cmd_reset_function(adapter);
if (status)
return status;

/* Wait for interrupts to quiesce after an FLR */
msleep(100);

/* We can clear all errors when function reset succeeds */
be_clear_all_error(adapter);
}

/* Tell FW we're ready to fire cmds */
status = be_cmd_fw_init(adapter);
if (status)
return status;

/* Allow interrupts for other ULPs running on NIC function */
be_intr_set(adapter, true);

return 0;
}

static int be_setup(struct be_adapter *adapter)
{
struct device *dev = &adapter->pdev->dev;
int status;

status = be_func_init(adapter);
if (status)
return status;

be_setup_init(adapter);

if (!lancer_chip(adapter))
Expand Down Expand Up @@ -4903,44 +4945,6 @@ static void be_netdev_init(struct net_device *netdev)
netdev->ethtool_ops = &be_ethtool_ops;
}

/* If any VFs are already enabled don't FLR the PF */
static bool be_reset_required(struct be_adapter *adapter)
{
return pci_num_vf(adapter->pdev) ? false : true;
}

/* Wait for the FW to be ready and perform the required initialization */
static int be_func_init(struct be_adapter *adapter)
{
int status;

status = be_fw_wait_ready(adapter);
if (status)
return status;

if (be_reset_required(adapter)) {
status = be_cmd_reset_function(adapter);
if (status)
return status;

/* Wait for interrupts to quiesce after an FLR */
msleep(100);

/* We can clear all errors when function reset succeeds */
be_clear_all_error(adapter);
}

/* Tell FW we're ready to fire cmds */
status = be_cmd_fw_init(adapter);
if (status)
return status;

/* Allow interrupts for other ULPs running on NIC function */
be_intr_set(adapter, true);

return 0;
}

static void be_cleanup(struct be_adapter *adapter)
{
struct net_device *netdev = adapter->netdev;
Expand All @@ -4959,10 +4963,6 @@ static int be_resume(struct be_adapter *adapter)
struct net_device *netdev = adapter->netdev;
int status;

status = be_func_init(adapter);
if (status)
return status;

status = be_setup(adapter);
if (status)
return status;
Expand Down Expand Up @@ -5365,10 +5365,6 @@ static int be_probe(struct pci_dev *pdev, const struct pci_device_id *pdev_id)
if (status)
goto unmap_bars;

status = be_func_init(adapter);
if (status)
goto drv_cleanup;

status = be_setup(adapter);
if (status)
goto drv_cleanup;
Expand Down

0 comments on commit f962f84

Please sign in to comment.