qlcnic: Refactor initialize nic code path.
authorSucheta Chakraborty <sucheta.chakraborty@qlogic.com>
Tue, 17 Dec 2013 14:01:51 +0000 (09:01 -0500)
committerDavid S. Miller <davem@davemloft.net>
Tue, 17 Dec 2013 22:09:43 +0000 (17:09 -0500)
o Change function name from qlcnic_83xx_register_nic_idc_func to
  qlcnic_83xx_initialize_nic

Signed-off-by: Sucheta Chakraborty <sucheta.chakraborty@qlogic.com>
Signed-off-by: Manish Chopra <manish.chopra@qlogic.com>
Signed-off-by: David S. Miller <davem@davemloft.net>
drivers/net/ethernet/qlogic/qlcnic/qlcnic_83xx_hw.c
drivers/net/ethernet/qlogic/qlcnic/qlcnic_83xx_hw.h
drivers/net/ethernet/qlogic/qlcnic/qlcnic_83xx_init.c
drivers/net/ethernet/qlogic/qlcnic/qlcnic_main.c

index 9edafa9c371edaa1155957f8d26c148e47a27159..406ab1b442699fce49d16042b8effe32dca5516a 100644 (file)
@@ -1518,8 +1518,7 @@ int  qlcnic_83xx_set_led(struct net_device *netdev,
        return err;
 }
 
-void qlcnic_83xx_register_nic_idc_func(struct qlcnic_adapter *adapter,
-                                      int enable)
+void qlcnic_83xx_initialize_nic(struct qlcnic_adapter *adapter, int enable)
 {
        struct qlcnic_cmd_args cmd;
        int status;
@@ -1527,21 +1526,17 @@ void qlcnic_83xx_register_nic_idc_func(struct qlcnic_adapter *adapter,
        if (qlcnic_sriov_vf_check(adapter))
                return;
 
-       if (enable) {
+       if (enable)
                status = qlcnic_alloc_mbx_args(&cmd, adapter,
                                               QLCNIC_CMD_INIT_NIC_FUNC);
-               if (status)
-                       return;
-
-               cmd.req.arg[1] = BIT_0 | BIT_31;
-       } else {
+       else
                status = qlcnic_alloc_mbx_args(&cmd, adapter,
                                               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)
                cmd.req.arg[1] |= QLC_REGISTER_DCB_AEN;
index ddc3b0ac516b2416dc31a0d92a54fea381e02d6f..2a0b06c4433b8164bdff570e361aaed3df43b528 100644 (file)
@@ -520,6 +520,8 @@ enum qlc_83xx_ext_regs {
 
 /* Initialize/Stop NIC command bit definitions */
 #define QLC_REGISTER_DCB_AEN           BIT_1
+#define QLC_REGISTER_LB_IDC            BIT_0
+#define QLC_INIT_FW_RESOURCES          BIT_31
 
 /* 83xx funcitons */
 int qlcnic_83xx_get_fw_version(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);
 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 *);
-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 *);
 void qlcnic_83xx_napi_del(struct qlcnic_adapter *);
index 8eb1288ca254767c73c3a270dfaf63704c4c08fc..70767c137c7aacb38338c91346d43ea7432dd8af 100644 (file)
@@ -614,8 +614,7 @@ int qlcnic_83xx_idc_reattach_driver(struct qlcnic_adapter *adapter)
        qlcnic_83xx_reinit_mbx_work(adapter->ahw->mailbox);
        qlcnic_83xx_enable_mbx_interrupt(adapter);
 
-       /* register for NIC IDC AEN Events */
-       qlcnic_83xx_register_nic_idc_func(adapter, 1);
+       qlcnic_83xx_initialize_nic(adapter, 1);
 
        err = qlcnic_sriov_pf_reinit(adapter);
        if (err)
@@ -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);
 
-       /* register for NIC IDC AEN Events */
-       qlcnic_83xx_register_nic_idc_func(adapter, 1);
+       qlcnic_83xx_initialize_nic(adapter, 1);
 
        /* Configure default, SR-IOV or Virtual NIC mode of operation */
        err = qlcnic_83xx_configure_opmode(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_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);
 }
index 484e0598620b55f3304da208cdaf0b4fec347b5f..45b1da15ce4762db32e0a51c450320bc9ec367a2 100644 (file)
@@ -2501,7 +2501,7 @@ static void qlcnic_remove(struct pci_dev *pdev)
        qlcnic_sriov_cleanup(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);
                qlcnic_83xx_free_mbx_intr(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)
        }
 
        if (qlcnic_83xx_check(adapter)) {
-               /* register for NIC IDC AEN Events */
-               qlcnic_83xx_register_nic_idc_func(adapter, 1);
+               qlcnic_83xx_initialize_nic(adapter, 1);
                err = qlcnic_83xx_setup_mbx_intr(adapter);
                qlcnic_83xx_disable_mbx_poll(adapter);
                if (err) {