diff options
Diffstat (limited to 'drivers/net/qlcnic/qlcnic_main.c')
-rw-r--r-- | drivers/net/qlcnic/qlcnic_main.c | 86 |
1 files changed, 66 insertions, 20 deletions
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 | ||
773 | static int | 775 | static int |
776 | qlcnic_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 | } | ||
815 | err_out: | ||
816 | return err; | ||
817 | } | ||
818 | |||
819 | static int | ||
774 | qlcnic_start_firmware(struct qlcnic_adapter *adapter) | 820 | qlcnic_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 | ||
3022 | int | 3071 | static int |
3023 | validate_pm_config(struct qlcnic_adapter *adapter, | 3072 | validate_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 | ||
3121 | int | 3170 | static int |
3122 | validate_esw_config(struct qlcnic_adapter *adapter, | 3171 | validate_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 | ||
3230 | int | 3274 | static int |
3231 | validate_npar_config(struct qlcnic_adapter *adapter, | 3275 | validate_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; |