qlcnic: Remove redundant eSwitch enable commands
authorSony Chacko <sony.chacko@qlogic.com>
Fri, 18 Oct 2013 16:22:32 +0000 (12:22 -0400)
committerDavid S. Miller <davem@davemloft.net>
Fri, 18 Oct 2013 17:42:19 +0000 (13:42 -0400)
When more than one NIC physical functions are enabled on a port,
eSwitch on that port gets enabled automatically. Driver
need not explicitly enable the eSwitch.

Signed-off-by: Sony Chacko <sony.chacko@qlogic.com>
Signed-off-by: Himanshu Madhani <himanshu.madhani@qlogic.com>
Signed-off-by: David S. Miller <davem@davemloft.net>
drivers/net/ethernet/qlogic/qlcnic/qlcnic_83xx_hw.h
drivers/net/ethernet/qlogic/qlcnic/qlcnic_83xx_vnic.c
drivers/net/ethernet/qlogic/qlcnic/qlcnic_main.c

index 2883b57b20f688d38cc1e1d3407bd16e42db7b4f..9f4e4c4ab5214e2215b6cf061347f429c68ff5e6 100644 (file)
@@ -629,7 +629,7 @@ int qlcnic_83xx_config_vnic_opmode(struct qlcnic_adapter *);
 int qlcnic_83xx_get_vnic_vport_info(struct qlcnic_adapter *,
                                    struct qlcnic_info *, u8);
 int qlcnic_83xx_get_vnic_pf_info(struct qlcnic_adapter *, struct qlcnic_info *);
-int qlcnic_83xx_enable_port_eswitch(struct qlcnic_adapter *, int);
+int qlcnic_83xx_set_port_eswitch_status(struct qlcnic_adapter *, int, int *);
 
 void qlcnic_83xx_get_minidump_template(struct qlcnic_adapter *);
 void qlcnic_83xx_get_stats(struct qlcnic_adapter *adapter, u64 *data);
index 60a477f10f419e63a8dd3f6435aa61cf585369d2..734d28602ac3f335214ba9cc5f1c9d4408d6d554 100644 (file)
@@ -256,8 +256,8 @@ int qlcnic_83xx_check_vnic_state(struct qlcnic_adapter *adapter)
        return 0;
 }
 
-static int qlcnic_83xx_get_eswitch_port_info(struct qlcnic_adapter *adapter,
-                                            int func, int *port_id)
+int qlcnic_83xx_set_port_eswitch_status(struct qlcnic_adapter *adapter,
+                                       int func, int *port_id)
 {
        struct qlcnic_info nic_info;
        int err = 0;
@@ -273,23 +273,8 @@ static int qlcnic_83xx_get_eswitch_port_info(struct qlcnic_adapter *adapter,
        else
                err = -EIO;
 
-       return err;
-}
-
-int qlcnic_83xx_enable_port_eswitch(struct qlcnic_adapter *adapter, int func)
-{
-       int id, err = 0;
-
-       err = qlcnic_83xx_get_eswitch_port_info(adapter, func, &id);
-       if (err)
-               return err;
-
-       if (!(adapter->eswitch[id].flags & QLCNIC_SWITCH_ENABLE)) {
-               if (!qlcnic_enable_eswitch(adapter, id, 1))
-                       adapter->eswitch[id].flags |= QLCNIC_SWITCH_ENABLE;
-               else
-                       err = -EIO;
-       }
+       if (!err)
+               adapter->eswitch[*port_id].flags |= QLCNIC_SWITCH_ENABLE;
 
        return err;
 }
index 51959726369fca373f71ac77f7e94d07755bd9be..725d76fab0a4436d37e7b911ec14b0dbd3ee0142 100644 (file)
@@ -819,7 +819,7 @@ static bool qlcnic_port_eswitch_cfg_capability(struct qlcnic_adapter *adapter)
 int qlcnic_init_pci_info(struct qlcnic_adapter *adapter)
 {
        struct qlcnic_pci_info *pci_info;
-       int i, ret = 0, j = 0;
+       int i, id = 0, ret = 0, j = 0;
        u16 act_pci_func;
        u8 pfn;
 
@@ -860,7 +860,8 @@ int qlcnic_init_pci_info(struct qlcnic_adapter *adapter)
                        continue;
 
                if (qlcnic_port_eswitch_cfg_capability(adapter)) {
-                       if (!qlcnic_83xx_enable_port_eswitch(adapter, pfn))
+                       if (!qlcnic_83xx_set_port_eswitch_status(adapter, pfn,
+                                                                &id))
                                adapter->npars[j].eswitch_status = true;
                        else
                                continue;
@@ -879,12 +880,12 @@ int qlcnic_init_pci_info(struct qlcnic_adapter *adapter)
                j++;
        }
 
-       if (qlcnic_82xx_check(adapter)) {
+       /* Update eSwitch status for adapters without per port eSwitch
+        * configuration capability
+        */
+       if (!qlcnic_port_eswitch_cfg_capability(adapter)) {
                for (i = 0; i < QLCNIC_NIU_MAX_XG_PORTS; i++)
                        adapter->eswitch[i].flags |= QLCNIC_SWITCH_ENABLE;
-       } else if (!qlcnic_port_eswitch_cfg_capability(adapter)) {
-               for (i = 0; i < QLCNIC_NIU_MAX_XG_PORTS; i++)
-                       qlcnic_enable_eswitch(adapter, i, 1);
        }
 
        kfree(pci_info);