aboutsummaryrefslogtreecommitdiffstats
path: root/drivers/net
diff options
context:
space:
mode:
authorSony Chacko <sony.chacko@qlogic.com>2013-10-18 12:22:32 -0400
committerDavid S. Miller <davem@davemloft.net>2013-10-18 13:42:19 -0400
commit4c776aad7453b6795d6d26200706e07ef261b8c9 (patch)
treea8e6a163ac8d8eb6c5bcc3c3b1424e2ecbe4508e /drivers/net
parent6177a95a93fe6eed2f59fa17720057988a81913c (diff)
qlcnic: Remove redundant eSwitch enable commands
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>
Diffstat (limited to 'drivers/net')
-rw-r--r--drivers/net/ethernet/qlogic/qlcnic/qlcnic_83xx_hw.h2
-rw-r--r--drivers/net/ethernet/qlogic/qlcnic/qlcnic_83xx_vnic.c23
-rw-r--r--drivers/net/ethernet/qlogic/qlcnic/qlcnic_main.c13
3 files changed, 12 insertions, 26 deletions
diff --git a/drivers/net/ethernet/qlogic/qlcnic/qlcnic_83xx_hw.h b/drivers/net/ethernet/qlogic/qlcnic/qlcnic_83xx_hw.h
index 2883b57b20f6..9f4e4c4ab521 100644
--- a/drivers/net/ethernet/qlogic/qlcnic/qlcnic_83xx_hw.h
+++ b/drivers/net/ethernet/qlogic/qlcnic/qlcnic_83xx_hw.h
@@ -629,7 +629,7 @@ int qlcnic_83xx_config_vnic_opmode(struct qlcnic_adapter *);
629int qlcnic_83xx_get_vnic_vport_info(struct qlcnic_adapter *, 629int qlcnic_83xx_get_vnic_vport_info(struct qlcnic_adapter *,
630 struct qlcnic_info *, u8); 630 struct qlcnic_info *, u8);
631int qlcnic_83xx_get_vnic_pf_info(struct qlcnic_adapter *, struct qlcnic_info *); 631int qlcnic_83xx_get_vnic_pf_info(struct qlcnic_adapter *, struct qlcnic_info *);
632int qlcnic_83xx_enable_port_eswitch(struct qlcnic_adapter *, int); 632int qlcnic_83xx_set_port_eswitch_status(struct qlcnic_adapter *, int, int *);
633 633
634void qlcnic_83xx_get_minidump_template(struct qlcnic_adapter *); 634void qlcnic_83xx_get_minidump_template(struct qlcnic_adapter *);
635void qlcnic_83xx_get_stats(struct qlcnic_adapter *adapter, u64 *data); 635void qlcnic_83xx_get_stats(struct qlcnic_adapter *adapter, u64 *data);
diff --git a/drivers/net/ethernet/qlogic/qlcnic/qlcnic_83xx_vnic.c b/drivers/net/ethernet/qlogic/qlcnic/qlcnic_83xx_vnic.c
index 60a477f10f41..734d28602ac3 100644
--- a/drivers/net/ethernet/qlogic/qlcnic/qlcnic_83xx_vnic.c
+++ b/drivers/net/ethernet/qlogic/qlcnic/qlcnic_83xx_vnic.c
@@ -256,8 +256,8 @@ int qlcnic_83xx_check_vnic_state(struct qlcnic_adapter *adapter)
256 return 0; 256 return 0;
257} 257}
258 258
259static int qlcnic_83xx_get_eswitch_port_info(struct qlcnic_adapter *adapter, 259int qlcnic_83xx_set_port_eswitch_status(struct qlcnic_adapter *adapter,
260 int func, int *port_id) 260 int func, int *port_id)
261{ 261{
262 struct qlcnic_info nic_info; 262 struct qlcnic_info nic_info;
263 int err = 0; 263 int err = 0;
@@ -273,23 +273,8 @@ static int qlcnic_83xx_get_eswitch_port_info(struct qlcnic_adapter *adapter,
273 else 273 else
274 err = -EIO; 274 err = -EIO;
275 275
276 return err; 276 if (!err)
277} 277 adapter->eswitch[*port_id].flags |= QLCNIC_SWITCH_ENABLE;
278
279int qlcnic_83xx_enable_port_eswitch(struct qlcnic_adapter *adapter, int func)
280{
281 int id, err = 0;
282
283 err = qlcnic_83xx_get_eswitch_port_info(adapter, func, &id);
284 if (err)
285 return err;
286
287 if (!(adapter->eswitch[id].flags & QLCNIC_SWITCH_ENABLE)) {
288 if (!qlcnic_enable_eswitch(adapter, id, 1))
289 adapter->eswitch[id].flags |= QLCNIC_SWITCH_ENABLE;
290 else
291 err = -EIO;
292 }
293 278
294 return err; 279 return err;
295} 280}
diff --git a/drivers/net/ethernet/qlogic/qlcnic/qlcnic_main.c b/drivers/net/ethernet/qlogic/qlcnic/qlcnic_main.c
index 51959726369f..725d76fab0a4 100644
--- a/drivers/net/ethernet/qlogic/qlcnic/qlcnic_main.c
+++ b/drivers/net/ethernet/qlogic/qlcnic/qlcnic_main.c
@@ -819,7 +819,7 @@ static bool qlcnic_port_eswitch_cfg_capability(struct qlcnic_adapter *adapter)
819int qlcnic_init_pci_info(struct qlcnic_adapter *adapter) 819int qlcnic_init_pci_info(struct qlcnic_adapter *adapter)
820{ 820{
821 struct qlcnic_pci_info *pci_info; 821 struct qlcnic_pci_info *pci_info;
822 int i, ret = 0, j = 0; 822 int i, id = 0, ret = 0, j = 0;
823 u16 act_pci_func; 823 u16 act_pci_func;
824 u8 pfn; 824 u8 pfn;
825 825
@@ -860,7 +860,8 @@ int qlcnic_init_pci_info(struct qlcnic_adapter *adapter)
860 continue; 860 continue;
861 861
862 if (qlcnic_port_eswitch_cfg_capability(adapter)) { 862 if (qlcnic_port_eswitch_cfg_capability(adapter)) {
863 if (!qlcnic_83xx_enable_port_eswitch(adapter, pfn)) 863 if (!qlcnic_83xx_set_port_eswitch_status(adapter, pfn,
864 &id))
864 adapter->npars[j].eswitch_status = true; 865 adapter->npars[j].eswitch_status = true;
865 else 866 else
866 continue; 867 continue;
@@ -879,12 +880,12 @@ int qlcnic_init_pci_info(struct qlcnic_adapter *adapter)
879 j++; 880 j++;
880 } 881 }
881 882
882 if (qlcnic_82xx_check(adapter)) { 883 /* Update eSwitch status for adapters without per port eSwitch
884 * configuration capability
885 */
886 if (!qlcnic_port_eswitch_cfg_capability(adapter)) {
883 for (i = 0; i < QLCNIC_NIU_MAX_XG_PORTS; i++) 887 for (i = 0; i < QLCNIC_NIU_MAX_XG_PORTS; i++)
884 adapter->eswitch[i].flags |= QLCNIC_SWITCH_ENABLE; 888 adapter->eswitch[i].flags |= QLCNIC_SWITCH_ENABLE;
885 } else if (!qlcnic_port_eswitch_cfg_capability(adapter)) {
886 for (i = 0; i < QLCNIC_NIU_MAX_XG_PORTS; i++)
887 qlcnic_enable_eswitch(adapter, i, 1);
888 } 889 }
889 890
890 kfree(pci_info); 891 kfree(pci_info);