Commit 9b0fff2a authored by Sucheta Chakraborty's avatar Sucheta Chakraborty Committed by David S. Miller

qlcnic: Refactor initialize nic code path.

o Change function name from qlcnic_83xx_register_nic_idc_func to
  qlcnic_83xx_initialize_nic
Signed-off-by: default avatarSucheta Chakraborty <sucheta.chakraborty@qlogic.com>
Signed-off-by: default avatarManish Chopra <manish.chopra@qlogic.com>
Signed-off-by: default avatarDavid S. Miller <davem@davemloft.net>
parent 3720bf79
...@@ -1518,8 +1518,7 @@ int qlcnic_83xx_set_led(struct net_device *netdev, ...@@ -1518,8 +1518,7 @@ int qlcnic_83xx_set_led(struct net_device *netdev,
return err; return err;
} }
void qlcnic_83xx_register_nic_idc_func(struct qlcnic_adapter *adapter, void qlcnic_83xx_initialize_nic(struct qlcnic_adapter *adapter, int enable)
int enable)
{ {
struct qlcnic_cmd_args cmd; struct qlcnic_cmd_args cmd;
int status; int status;
...@@ -1527,21 +1526,17 @@ void qlcnic_83xx_register_nic_idc_func(struct qlcnic_adapter *adapter, ...@@ -1527,21 +1526,17 @@ void qlcnic_83xx_register_nic_idc_func(struct qlcnic_adapter *adapter,
if (qlcnic_sriov_vf_check(adapter)) if (qlcnic_sriov_vf_check(adapter))
return; return;
if (enable) { if (enable)
status = qlcnic_alloc_mbx_args(&cmd, adapter, status = qlcnic_alloc_mbx_args(&cmd, adapter,
QLCNIC_CMD_INIT_NIC_FUNC); QLCNIC_CMD_INIT_NIC_FUNC);
if (status) else
return;
cmd.req.arg[1] = BIT_0 | BIT_31;
} else {
status = qlcnic_alloc_mbx_args(&cmd, adapter, status = qlcnic_alloc_mbx_args(&cmd, adapter,
QLCNIC_CMD_STOP_NIC_FUNC); QLCNIC_CMD_STOP_NIC_FUNC);
if (status)
return;
cmd.req.arg[1] = BIT_0 | BIT_31; if (status)
} return;
cmd.req.arg[1] = QLC_REGISTER_LB_IDC | QLC_INIT_FW_RESOURCES;
if (adapter->dcb) if (adapter->dcb)
cmd.req.arg[1] |= QLC_REGISTER_DCB_AEN; cmd.req.arg[1] |= QLC_REGISTER_DCB_AEN;
......
...@@ -520,6 +520,8 @@ enum qlc_83xx_ext_regs { ...@@ -520,6 +520,8 @@ enum qlc_83xx_ext_regs {
/* Initialize/Stop NIC command bit definitions */ /* Initialize/Stop NIC command bit definitions */
#define QLC_REGISTER_DCB_AEN BIT_1 #define QLC_REGISTER_DCB_AEN BIT_1
#define QLC_REGISTER_LB_IDC BIT_0
#define QLC_INIT_FW_RESOURCES BIT_31
/* 83xx funcitons */ /* 83xx funcitons */
int qlcnic_83xx_get_fw_version(struct qlcnic_adapter *); int qlcnic_83xx_get_fw_version(struct qlcnic_adapter *);
...@@ -545,7 +547,7 @@ int qlcnic_83xx_config_intr_coalesce(struct qlcnic_adapter *); ...@@ -545,7 +547,7 @@ int qlcnic_83xx_config_intr_coalesce(struct qlcnic_adapter *);
void qlcnic_83xx_change_l2_filter(struct qlcnic_adapter *, u64 *, u16); void qlcnic_83xx_change_l2_filter(struct qlcnic_adapter *, u64 *, u16);
int qlcnic_83xx_get_pci_info(struct qlcnic_adapter *, struct qlcnic_pci_info *); int qlcnic_83xx_get_pci_info(struct qlcnic_adapter *, struct qlcnic_pci_info *);
int qlcnic_83xx_set_nic_info(struct qlcnic_adapter *, struct qlcnic_info *); int qlcnic_83xx_set_nic_info(struct qlcnic_adapter *, struct qlcnic_info *);
void qlcnic_83xx_register_nic_idc_func(struct qlcnic_adapter *, int); void qlcnic_83xx_initialize_nic(struct qlcnic_adapter *, int);
int qlcnic_83xx_napi_add(struct qlcnic_adapter *, struct net_device *); int qlcnic_83xx_napi_add(struct qlcnic_adapter *, struct net_device *);
void qlcnic_83xx_napi_del(struct qlcnic_adapter *); void qlcnic_83xx_napi_del(struct qlcnic_adapter *);
......
...@@ -614,8 +614,7 @@ int qlcnic_83xx_idc_reattach_driver(struct qlcnic_adapter *adapter) ...@@ -614,8 +614,7 @@ int qlcnic_83xx_idc_reattach_driver(struct qlcnic_adapter *adapter)
qlcnic_83xx_reinit_mbx_work(adapter->ahw->mailbox); qlcnic_83xx_reinit_mbx_work(adapter->ahw->mailbox);
qlcnic_83xx_enable_mbx_interrupt(adapter); qlcnic_83xx_enable_mbx_interrupt(adapter);
/* register for NIC IDC AEN Events */ qlcnic_83xx_initialize_nic(adapter, 1);
qlcnic_83xx_register_nic_idc_func(adapter, 1);
err = qlcnic_sriov_pf_reinit(adapter); err = qlcnic_sriov_pf_reinit(adapter);
if (err) if (err)
...@@ -2249,8 +2248,7 @@ int qlcnic_83xx_init(struct qlcnic_adapter *adapter, int pci_using_dac) ...@@ -2249,8 +2248,7 @@ int qlcnic_83xx_init(struct qlcnic_adapter *adapter, int pci_using_dac)
INIT_DELAYED_WORK(&adapter->idc_aen_work, qlcnic_83xx_idc_aen_work); INIT_DELAYED_WORK(&adapter->idc_aen_work, qlcnic_83xx_idc_aen_work);
/* register for NIC IDC AEN Events */ qlcnic_83xx_initialize_nic(adapter, 1);
qlcnic_83xx_register_nic_idc_func(adapter, 1);
/* Configure default, SR-IOV or Virtual NIC mode of operation */ /* Configure default, SR-IOV or Virtual NIC mode of operation */
err = qlcnic_83xx_configure_opmode(adapter); err = qlcnic_83xx_configure_opmode(adapter);
...@@ -2293,7 +2291,7 @@ void qlcnic_83xx_aer_stop_poll_work(struct qlcnic_adapter *adapter) ...@@ -2293,7 +2291,7 @@ void qlcnic_83xx_aer_stop_poll_work(struct qlcnic_adapter *adapter)
qlcnic_83xx_disable_vnic_mode(adapter, 1); qlcnic_83xx_disable_vnic_mode(adapter, 1);
qlcnic_83xx_idc_detach_driver(adapter); qlcnic_83xx_idc_detach_driver(adapter);
qlcnic_83xx_register_nic_idc_func(adapter, 0); qlcnic_83xx_initialize_nic(adapter, 0);
cancel_delayed_work_sync(&adapter->idc_aen_work); cancel_delayed_work_sync(&adapter->idc_aen_work);
} }
......
...@@ -2501,7 +2501,7 @@ static void qlcnic_remove(struct pci_dev *pdev) ...@@ -2501,7 +2501,7 @@ static void qlcnic_remove(struct pci_dev *pdev)
qlcnic_sriov_cleanup(adapter); qlcnic_sriov_cleanup(adapter);
if (qlcnic_83xx_check(adapter)) { if (qlcnic_83xx_check(adapter)) {
qlcnic_83xx_register_nic_idc_func(adapter, 0); qlcnic_83xx_initialize_nic(adapter, 0);
cancel_delayed_work_sync(&adapter->idc_aen_work); cancel_delayed_work_sync(&adapter->idc_aen_work);
qlcnic_83xx_free_mbx_intr(adapter); qlcnic_83xx_free_mbx_intr(adapter);
qlcnic_83xx_detach_mailbox_work(adapter); qlcnic_83xx_detach_mailbox_work(adapter);
...@@ -3785,8 +3785,7 @@ int qlcnic_setup_rings(struct qlcnic_adapter *adapter, u8 rx_cnt, u8 tx_cnt) ...@@ -3785,8 +3785,7 @@ int qlcnic_setup_rings(struct qlcnic_adapter *adapter, u8 rx_cnt, u8 tx_cnt)
} }
if (qlcnic_83xx_check(adapter)) { if (qlcnic_83xx_check(adapter)) {
/* register for NIC IDC AEN Events */ qlcnic_83xx_initialize_nic(adapter, 1);
qlcnic_83xx_register_nic_idc_func(adapter, 1);
err = qlcnic_83xx_setup_mbx_intr(adapter); err = qlcnic_83xx_setup_mbx_intr(adapter);
qlcnic_83xx_disable_mbx_poll(adapter); qlcnic_83xx_disable_mbx_poll(adapter);
if (err) { if (err) {
......
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