aboutsummaryrefslogtreecommitdiffstats
path: root/drivers/net/qlcnic
diff options
context:
space:
mode:
authorAnirban Chakraborty <anirban.chakraborty@qlogic.com>2010-07-13 16:33:35 -0400
committerDavid S. Miller <davem@davemloft.net>2010-07-14 16:54:17 -0400
commitcea8975e84409f01fc4cf92775d2d0028ccc1665 (patch)
tree583f5ef6be82b1d84f50c0e7fad49480c5e4d2e4 /drivers/net/qlcnic
parent451724c821c1fe5af076a0def72362f947e1b6a0 (diff)
qlcnic: restore NPAR config data after recovery
o NPAR configuration which is programmed in fw, need to restore after fw recovery. o Update version to 5.0.7 Signed-off-by: Anirban Chakraborty <anirban.chakraborty@qlogic.com> Signed-off-by: Rajesh Borundia <rajesh.borundia@qlogic.com> Signed-off-by: Amit Kumar Salecha <amit.salecha@qlogic.com> Signed-off-by: David S. Miller <davem@davemloft.net>
Diffstat (limited to 'drivers/net/qlcnic')
-rw-r--r--drivers/net/qlcnic/qlcnic.h7
-rw-r--r--drivers/net/qlcnic/qlcnic_ctx.c2
-rw-r--r--drivers/net/qlcnic/qlcnic_main.c86
3 files changed, 72 insertions, 23 deletions
diff --git a/drivers/net/qlcnic/qlcnic.h b/drivers/net/qlcnic/qlcnic.h
index 064464201cbb..e1894775e5aa 100644
--- a/drivers/net/qlcnic/qlcnic.h
+++ b/drivers/net/qlcnic/qlcnic.h
@@ -51,8 +51,8 @@
51 51
52#define _QLCNIC_LINUX_MAJOR 5 52#define _QLCNIC_LINUX_MAJOR 5
53#define _QLCNIC_LINUX_MINOR 0 53#define _QLCNIC_LINUX_MINOR 0
54#define _QLCNIC_LINUX_SUBVERSION 6 54#define _QLCNIC_LINUX_SUBVERSION 7
55#define QLCNIC_LINUX_VERSIONID "5.0.6" 55#define QLCNIC_LINUX_VERSIONID "5.0.7"
56#define QLCNIC_DRV_IDC_VER 0x01 56#define QLCNIC_DRV_IDC_VER 0x01
57 57
58#define QLCNIC_VERSION_CODE(a, b, c) (((a) << 24) + ((b) << 16) + (c)) 58#define QLCNIC_VERSION_CODE(a, b, c) (((a) << 24) + ((b) << 16) + (c))
@@ -949,7 +949,6 @@ struct qlcnic_adapter {
949 u8 has_link_events; 949 u8 has_link_events;
950 u8 fw_type; 950 u8 fw_type;
951 u16 tx_context_id; 951 u16 tx_context_id;
952 u16 mtu;
953 u16 is_up; 952 u16 is_up;
954 953
955 u16 link_speed; 954 u16 link_speed;
@@ -1044,6 +1043,8 @@ struct qlcnic_pci_info {
1044 1043
1045struct qlcnic_npar_info { 1044struct qlcnic_npar_info {
1046 u16 vlan_id; 1045 u16 vlan_id;
1046 u16 min_bw;
1047 u16 max_bw;
1047 u8 phy_port; 1048 u8 phy_port;
1048 u8 type; 1049 u8 type;
1049 u8 active; 1050 u8 active;
diff --git a/drivers/net/qlcnic/qlcnic_ctx.c b/drivers/net/qlcnic/qlcnic_ctx.c
index cdd44b4136ae..cc5d861d9a12 100644
--- a/drivers/net/qlcnic/qlcnic_ctx.c
+++ b/drivers/net/qlcnic/qlcnic_ctx.c
@@ -636,6 +636,8 @@ int qlcnic_get_nic_info(struct qlcnic_adapter *adapter,
636 QLCNIC_CDRP_CMD_GET_NIC_INFO); 636 QLCNIC_CDRP_CMD_GET_NIC_INFO);
637 637
638 if (err == QLCNIC_RCODE_SUCCESS) { 638 if (err == QLCNIC_RCODE_SUCCESS) {
639 npar_info->pci_func = le16_to_cpu(nic_info->pci_func);
640 npar_info->op_mode = le16_to_cpu(nic_info->op_mode);
639 npar_info->phys_port = le16_to_cpu(nic_info->phys_port); 641 npar_info->phys_port = le16_to_cpu(nic_info->phys_port);
640 npar_info->switch_mode = le16_to_cpu(nic_info->switch_mode); 642 npar_info->switch_mode = le16_to_cpu(nic_info->switch_mode);
641 npar_info->max_tx_ques = le16_to_cpu(nic_info->max_tx_ques); 643 npar_info->max_tx_ques = le16_to_cpu(nic_info->max_tx_ques);
diff --git a/drivers/net/qlcnic/qlcnic_main.c b/drivers/net/qlcnic/qlcnic_main.c
index d5c94a3364f7..8d2d62ff1a37 100644
--- a/drivers/net/qlcnic/qlcnic_main.c
+++ b/drivers/net/qlcnic/qlcnic_main.c
@@ -507,6 +507,8 @@ qlcnic_init_pci_info(struct qlcnic_adapter *adapter)
507 adapter->npars[pfn].type = pci_info[i].type; 507 adapter->npars[pfn].type = pci_info[i].type;
508 adapter->npars[pfn].phy_port = pci_info[i].default_port; 508 adapter->npars[pfn].phy_port = pci_info[i].default_port;
509 adapter->npars[pfn].mac_learning = DEFAULT_MAC_LEARN; 509 adapter->npars[pfn].mac_learning = DEFAULT_MAC_LEARN;
510 adapter->npars[pfn].min_bw = pci_info[i].tx_min_bw;
511 adapter->npars[pfn].max_bw = pci_info[i].tx_max_bw;
510 } 512 }
511 513
512 for (i = 0; i < QLCNIC_NIU_MAX_XG_PORTS; i++) 514 for (i = 0; i < QLCNIC_NIU_MAX_XG_PORTS; i++)
@@ -771,6 +773,50 @@ qlcnic_check_options(struct qlcnic_adapter *adapter)
771} 773}
772 774
773static int 775static int
776qlcnic_reset_npar_config(struct qlcnic_adapter *adapter)
777{
778 int i, err = 0;
779 struct qlcnic_npar_info *npar;
780 struct qlcnic_info nic_info;
781
782 if (!(adapter->flags & QLCNIC_ESWITCH_ENABLED) ||
783 !adapter->need_fw_reset)
784 return 0;
785
786 if (adapter->op_mode == QLCNIC_MGMT_FUNC) {
787 /* Set the NPAR config data after FW reset */
788 for (i = 0; i < QLCNIC_MAX_PCI_FUNC; i++) {
789 npar = &adapter->npars[i];
790 if (npar->type != QLCNIC_TYPE_NIC)
791 continue;
792 err = qlcnic_get_nic_info(adapter, &nic_info, i);
793 if (err)
794 goto err_out;
795 nic_info.min_tx_bw = npar->min_bw;
796 nic_info.max_tx_bw = npar->max_bw;
797 err = qlcnic_set_nic_info(adapter, &nic_info);
798 if (err)
799 goto err_out;
800
801 if (npar->enable_pm) {
802 err = qlcnic_config_port_mirroring(adapter,
803 npar->dest_npar, 1, i);
804 if (err)
805 goto err_out;
806
807 }
808 npar->mac_learning = DEFAULT_MAC_LEARN;
809 npar->host_vlan_tag = 0;
810 npar->promisc_mode = 0;
811 npar->discard_tagged = 0;
812 npar->vlan_id = 0;
813 }
814 }
815err_out:
816 return err;
817}
818
819static int
774qlcnic_start_firmware(struct qlcnic_adapter *adapter) 820qlcnic_start_firmware(struct qlcnic_adapter *adapter)
775{ 821{
776 int val, err, first_boot; 822 int val, err, first_boot;
@@ -834,10 +880,9 @@ wait_init:
834 qlcnic_idc_debug_info(adapter, 1); 880 qlcnic_idc_debug_info(adapter, 1);
835 881
836 qlcnic_check_options(adapter); 882 qlcnic_check_options(adapter);
837 883 if (qlcnic_reset_npar_config(adapter))
838 if (adapter->flags & QLCNIC_ESWITCH_ENABLED && 884 goto err_out;
839 adapter->op_mode != QLCNIC_NON_PRIV_FUNC) 885 qlcnic_dev_set_npar_ready(adapter);
840 qlcnic_dev_set_npar_ready(adapter);
841 886
842 adapter->need_fw_reset = 0; 887 adapter->need_fw_reset = 0;
843 888
@@ -2486,6 +2531,7 @@ qlcnic_dev_request_reset(struct qlcnic_adapter *adapter)
2486{ 2531{
2487 u32 state; 2532 u32 state;
2488 2533
2534 adapter->need_fw_reset = 1;
2489 if (qlcnic_api_lock(adapter)) 2535 if (qlcnic_api_lock(adapter))
2490 return; 2536 return;
2491 2537
@@ -2506,6 +2552,9 @@ qlcnic_dev_set_npar_ready(struct qlcnic_adapter *adapter)
2506{ 2552{
2507 u32 state; 2553 u32 state;
2508 2554
2555 if (!(adapter->flags & QLCNIC_ESWITCH_ENABLED) ||
2556 adapter->op_mode == QLCNIC_NON_PRIV_FUNC)
2557 return;
2509 if (qlcnic_api_lock(adapter)) 2558 if (qlcnic_api_lock(adapter))
2510 return; 2559 return;
2511 2560
@@ -3019,7 +3068,7 @@ static struct bin_attribute bin_attr_mem = {
3019 .write = qlcnic_sysfs_write_mem, 3068 .write = qlcnic_sysfs_write_mem,
3020}; 3069};
3021 3070
3022int 3071static int
3023validate_pm_config(struct qlcnic_adapter *adapter, 3072validate_pm_config(struct qlcnic_adapter *adapter,
3024 struct qlcnic_pm_func_cfg *pm_cfg, int count) 3073 struct qlcnic_pm_func_cfg *pm_cfg, int count)
3025{ 3074{
@@ -3118,7 +3167,7 @@ qlcnic_sysfs_read_pm_config(struct file *filp, struct kobject *kobj,
3118 return size; 3167 return size;
3119} 3168}
3120 3169
3121int 3170static int
3122validate_esw_config(struct qlcnic_adapter *adapter, 3171validate_esw_config(struct qlcnic_adapter *adapter,
3123 struct qlcnic_esw_func_cfg *esw_cfg, int count) 3172 struct qlcnic_esw_func_cfg *esw_cfg, int count)
3124{ 3173{
@@ -3154,9 +3203,8 @@ qlcnic_sysfs_write_esw_config(struct file *file, struct kobject *kobj,
3154 struct device *dev = container_of(kobj, struct device, kobj); 3203 struct device *dev = container_of(kobj, struct device, kobj);
3155 struct qlcnic_adapter *adapter = dev_get_drvdata(dev); 3204 struct qlcnic_adapter *adapter = dev_get_drvdata(dev);
3156 struct qlcnic_esw_func_cfg *esw_cfg; 3205 struct qlcnic_esw_func_cfg *esw_cfg;
3157 u8 id, discard_tagged, promsc_mode, mac_learn;
3158 u8 vlan_tagging, pci_func, vlan_id;
3159 int count, rem, i, ret; 3206 int count, rem, i, ret;
3207 u8 id, pci_func;
3160 3208
3161 count = size / sizeof(struct qlcnic_esw_func_cfg); 3209 count = size / sizeof(struct qlcnic_esw_func_cfg);
3162 rem = size % sizeof(struct qlcnic_esw_func_cfg); 3210 rem = size % sizeof(struct qlcnic_esw_func_cfg);
@@ -3171,17 +3219,13 @@ qlcnic_sysfs_write_esw_config(struct file *file, struct kobject *kobj,
3171 for (i = 0; i < count; i++) { 3219 for (i = 0; i < count; i++) {
3172 pci_func = esw_cfg[i].pci_func; 3220 pci_func = esw_cfg[i].pci_func;
3173 id = adapter->npars[pci_func].phy_port; 3221 id = adapter->npars[pci_func].phy_port;
3174 vlan_tagging = esw_cfg[i].host_vlan_tag; 3222 ret = qlcnic_config_switch_port(adapter, id,
3175 promsc_mode = esw_cfg[i].promisc_mode; 3223 esw_cfg[i].host_vlan_tag,
3176 mac_learn = esw_cfg[i].mac_learning; 3224 esw_cfg[i].discard_tagged,
3177 vlan_id = esw_cfg[i].vlan_id; 3225 esw_cfg[i].promisc_mode,
3178 discard_tagged = esw_cfg[i].discard_tagged; 3226 esw_cfg[i].mac_learning,
3179 ret = qlcnic_config_switch_port(adapter, id, vlan_tagging, 3227 esw_cfg[i].pci_func,
3180 discard_tagged, 3228 esw_cfg[i].vlan_id);
3181 promsc_mode,
3182 mac_learn,
3183 pci_func,
3184 vlan_id);
3185 if (ret) 3229 if (ret)
3186 return ret; 3230 return ret;
3187 } 3231 }
@@ -3227,7 +3271,7 @@ qlcnic_sysfs_read_esw_config(struct file *file, struct kobject *kobj,
3227 return size; 3271 return size;
3228} 3272}
3229 3273
3230int 3274static int
3231validate_npar_config(struct qlcnic_adapter *adapter, 3275validate_npar_config(struct qlcnic_adapter *adapter,
3232 struct qlcnic_npar_func_cfg *np_cfg, int count) 3276 struct qlcnic_npar_func_cfg *np_cfg, int count)
3233{ 3277{
@@ -3282,6 +3326,8 @@ qlcnic_sysfs_write_npar_config(struct file *file, struct kobject *kobj,
3282 ret = qlcnic_set_nic_info(adapter, &nic_info); 3326 ret = qlcnic_set_nic_info(adapter, &nic_info);
3283 if (ret) 3327 if (ret)
3284 return ret; 3328 return ret;
3329 adapter->npars[i].min_bw = nic_info.min_tx_bw;
3330 adapter->npars[i].max_bw = nic_info.max_tx_bw;
3285 } 3331 }
3286 3332
3287 return size; 3333 return size;