aboutsummaryrefslogtreecommitdiffstats
path: root/drivers/net/ethernet/emulex/benet
diff options
context:
space:
mode:
authorSathya Perla <sathya.perla@emulex.com>2015-02-23 04:20:16 -0500
committerDavid S. Miller <davem@davemloft.net>2015-02-23 15:08:32 -0500
commitf962f840f81f5b9f2df136dd44872f18a82def38 (patch)
tree6de637053be24bc6ab5d07bb0793a28c42b31435 /drivers/net/ethernet/emulex/benet
parent87ac1a5296291d557080fb544f445be3bce6c51f (diff)
be2net: move be_func_init() call inside be_setup()
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>
Diffstat (limited to 'drivers/net/ethernet/emulex/benet')
-rw-r--r--drivers/net/ethernet/emulex/benet/be_main.c88
1 files changed, 42 insertions, 46 deletions
diff --git a/drivers/net/ethernet/emulex/benet/be_main.c b/drivers/net/ethernet/emulex/benet/be_main.c
index 7aa1a4dd2df9..b2277a4c7ddf 100644
--- a/drivers/net/ethernet/emulex/benet/be_main.c
+++ b/drivers/net/ethernet/emulex/benet/be_main.c
@@ -3944,11 +3944,53 @@ static inline int fw_major_num(const char *fw_ver)
3944 return fw_major; 3944 return fw_major;
3945} 3945}
3946 3946
3947/* If any VFs are already enabled don't FLR the PF */
3948static bool be_reset_required(struct be_adapter *adapter)
3949{
3950 return pci_num_vf(adapter->pdev) ? false : true;
3951}
3952
3953/* Wait for the FW to be ready and perform the required initialization */
3954static int be_func_init(struct be_adapter *adapter)
3955{
3956 int status;
3957
3958 status = be_fw_wait_ready(adapter);
3959 if (status)
3960 return status;
3961
3962 if (be_reset_required(adapter)) {
3963 status = be_cmd_reset_function(adapter);
3964 if (status)
3965 return status;
3966
3967 /* Wait for interrupts to quiesce after an FLR */
3968 msleep(100);
3969
3970 /* We can clear all errors when function reset succeeds */
3971 be_clear_all_error(adapter);
3972 }
3973
3974 /* Tell FW we're ready to fire cmds */
3975 status = be_cmd_fw_init(adapter);
3976 if (status)
3977 return status;
3978
3979 /* Allow interrupts for other ULPs running on NIC function */
3980 be_intr_set(adapter, true);
3981
3982 return 0;
3983}
3984
3947static int be_setup(struct be_adapter *adapter) 3985static int be_setup(struct be_adapter *adapter)
3948{ 3986{
3949 struct device *dev = &adapter->pdev->dev; 3987 struct device *dev = &adapter->pdev->dev;
3950 int status; 3988 int status;
3951 3989
3990 status = be_func_init(adapter);
3991 if (status)
3992 return status;
3993
3952 be_setup_init(adapter); 3994 be_setup_init(adapter);
3953 3995
3954 if (!lancer_chip(adapter)) 3996 if (!lancer_chip(adapter))
@@ -4903,44 +4945,6 @@ static void be_netdev_init(struct net_device *netdev)
4903 netdev->ethtool_ops = &be_ethtool_ops; 4945 netdev->ethtool_ops = &be_ethtool_ops;
4904} 4946}
4905 4947
4906/* If any VFs are already enabled don't FLR the PF */
4907static bool be_reset_required(struct be_adapter *adapter)
4908{
4909 return pci_num_vf(adapter->pdev) ? false : true;
4910}
4911
4912/* Wait for the FW to be ready and perform the required initialization */
4913static int be_func_init(struct be_adapter *adapter)
4914{
4915 int status;
4916
4917 status = be_fw_wait_ready(adapter);
4918 if (status)
4919 return status;
4920
4921 if (be_reset_required(adapter)) {
4922 status = be_cmd_reset_function(adapter);
4923 if (status)
4924 return status;
4925
4926 /* Wait for interrupts to quiesce after an FLR */
4927 msleep(100);
4928
4929 /* We can clear all errors when function reset succeeds */
4930 be_clear_all_error(adapter);
4931 }
4932
4933 /* Tell FW we're ready to fire cmds */
4934 status = be_cmd_fw_init(adapter);
4935 if (status)
4936 return status;
4937
4938 /* Allow interrupts for other ULPs running on NIC function */
4939 be_intr_set(adapter, true);
4940
4941 return 0;
4942}
4943
4944static void be_cleanup(struct be_adapter *adapter) 4948static void be_cleanup(struct be_adapter *adapter)
4945{ 4949{
4946 struct net_device *netdev = adapter->netdev; 4950 struct net_device *netdev = adapter->netdev;
@@ -4959,10 +4963,6 @@ static int be_resume(struct be_adapter *adapter)
4959 struct net_device *netdev = adapter->netdev; 4963 struct net_device *netdev = adapter->netdev;
4960 int status; 4964 int status;
4961 4965
4962 status = be_func_init(adapter);
4963 if (status)
4964 return status;
4965
4966 status = be_setup(adapter); 4966 status = be_setup(adapter);
4967 if (status) 4967 if (status)
4968 return status; 4968 return status;
@@ -5365,10 +5365,6 @@ static int be_probe(struct pci_dev *pdev, const struct pci_device_id *pdev_id)
5365 if (status) 5365 if (status)
5366 goto unmap_bars; 5366 goto unmap_bars;
5367 5367
5368 status = be_func_init(adapter);
5369 if (status)
5370 goto drv_cleanup;
5371
5372 status = be_setup(adapter); 5368 status = be_setup(adapter);
5373 if (status) 5369 if (status)
5374 goto drv_cleanup; 5370 goto drv_cleanup;