diff options
Diffstat (limited to 'drivers/net/ethernet/qlogic/qlcnic/qlcnic_sysfs.c')
-rw-r--r-- | drivers/net/ethernet/qlogic/qlcnic/qlcnic_sysfs.c | 31 |
1 files changed, 17 insertions, 14 deletions
diff --git a/drivers/net/ethernet/qlogic/qlcnic/qlcnic_sysfs.c b/drivers/net/ethernet/qlogic/qlcnic/qlcnic_sysfs.c index 448d156c3d08..cd346e27f2e1 100644 --- a/drivers/net/ethernet/qlogic/qlcnic/qlcnic_sysfs.c +++ b/drivers/net/ethernet/qlogic/qlcnic/qlcnic_sysfs.c | |||
@@ -354,7 +354,7 @@ int qlcnic_is_valid_nic_func(struct qlcnic_adapter *adapter, u8 pci_func) | |||
354 | { | 354 | { |
355 | int i; | 355 | int i; |
356 | 356 | ||
357 | for (i = 0; i < adapter->ahw->max_vnic_func; i++) { | 357 | for (i = 0; i < adapter->ahw->total_nic_func; i++) { |
358 | if (adapter->npars[i].pci_func == pci_func) | 358 | if (adapter->npars[i].pci_func == pci_func) |
359 | return i; | 359 | return i; |
360 | } | 360 | } |
@@ -720,6 +720,7 @@ static ssize_t qlcnic_sysfs_read_npar_config(struct file *file, | |||
720 | struct qlcnic_adapter *adapter = dev_get_drvdata(dev); | 720 | struct qlcnic_adapter *adapter = dev_get_drvdata(dev); |
721 | struct qlcnic_npar_func_cfg *np_cfg; | 721 | struct qlcnic_npar_func_cfg *np_cfg; |
722 | struct qlcnic_info nic_info; | 722 | struct qlcnic_info nic_info; |
723 | u8 pci_func; | ||
723 | int i, ret; | 724 | int i, ret; |
724 | u32 count; | 725 | u32 count; |
725 | 726 | ||
@@ -729,26 +730,28 @@ static ssize_t qlcnic_sysfs_read_npar_config(struct file *file, | |||
729 | 730 | ||
730 | count = size / sizeof(struct qlcnic_npar_func_cfg); | 731 | count = size / sizeof(struct qlcnic_npar_func_cfg); |
731 | for (i = 0; i < adapter->ahw->total_nic_func; i++) { | 732 | for (i = 0; i < adapter->ahw->total_nic_func; i++) { |
732 | if (qlcnic_is_valid_nic_func(adapter, i) < 0) | ||
733 | continue; | ||
734 | if (adapter->npars[i].pci_func >= count) { | 733 | if (adapter->npars[i].pci_func >= count) { |
735 | dev_dbg(dev, "%s: Total nic functions[%d], App sent function count[%d]\n", | 734 | dev_dbg(dev, "%s: Total nic functions[%d], App sent function count[%d]\n", |
736 | __func__, adapter->ahw->total_nic_func, count); | 735 | __func__, adapter->ahw->total_nic_func, count); |
737 | continue; | 736 | continue; |
738 | } | 737 | } |
739 | ret = qlcnic_get_nic_info(adapter, &nic_info, i); | ||
740 | if (ret) | ||
741 | return ret; | ||
742 | if (!adapter->npars[i].eswitch_status) | 738 | if (!adapter->npars[i].eswitch_status) |
743 | continue; | 739 | continue; |
744 | np_cfg[i].pci_func = i; | 740 | pci_func = adapter->npars[i].pci_func; |
745 | np_cfg[i].op_mode = (u8)nic_info.op_mode; | 741 | if (qlcnic_is_valid_nic_func(adapter, pci_func) < 0) |
746 | np_cfg[i].port_num = nic_info.phys_port; | 742 | continue; |
747 | np_cfg[i].fw_capab = nic_info.capabilities; | 743 | ret = qlcnic_get_nic_info(adapter, &nic_info, pci_func); |
748 | np_cfg[i].min_bw = nic_info.min_tx_bw; | 744 | if (ret) |
749 | np_cfg[i].max_bw = nic_info.max_tx_bw; | 745 | return ret; |
750 | np_cfg[i].max_tx_queues = nic_info.max_tx_ques; | 746 | |
751 | np_cfg[i].max_rx_queues = nic_info.max_rx_ques; | 747 | np_cfg[pci_func].pci_func = pci_func; |
748 | np_cfg[pci_func].op_mode = (u8)nic_info.op_mode; | ||
749 | np_cfg[pci_func].port_num = nic_info.phys_port; | ||
750 | np_cfg[pci_func].fw_capab = nic_info.capabilities; | ||
751 | np_cfg[pci_func].min_bw = nic_info.min_tx_bw; | ||
752 | np_cfg[pci_func].max_bw = nic_info.max_tx_bw; | ||
753 | np_cfg[pci_func].max_tx_queues = nic_info.max_tx_ques; | ||
754 | np_cfg[pci_func].max_rx_queues = nic_info.max_rx_ques; | ||
752 | } | 755 | } |
753 | return size; | 756 | return size; |
754 | } | 757 | } |