aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--drivers/net/ixgbe/ixgbe_82598.c77
-rw-r--r--drivers/net/ixgbe/ixgbe_82599.c70
-rw-r--r--drivers/net/ixgbe/ixgbe_main.c9
-rw-r--r--drivers/net/ixgbe/ixgbe_type.h1
4 files changed, 107 insertions, 50 deletions
diff --git a/drivers/net/ixgbe/ixgbe_82598.c b/drivers/net/ixgbe/ixgbe_82598.c
index 1e1d8b79f9e3..a8151f25a4d0 100644
--- a/drivers/net/ixgbe/ixgbe_82598.c
+++ b/drivers/net/ixgbe/ixgbe_82598.c
@@ -75,18 +75,49 @@ static u16 ixgbe_get_pcie_msix_count_82598(struct ixgbe_hw *hw)
75static s32 ixgbe_get_invariants_82598(struct ixgbe_hw *hw) 75static s32 ixgbe_get_invariants_82598(struct ixgbe_hw *hw)
76{ 76{
77 struct ixgbe_mac_info *mac = &hw->mac; 77 struct ixgbe_mac_info *mac = &hw->mac;
78
79 /* Call PHY identify routine to get the phy type */
80 ixgbe_identify_phy_generic(hw);
81
82 mac->mcft_size = IXGBE_82598_MC_TBL_SIZE;
83 mac->vft_size = IXGBE_82598_VFT_TBL_SIZE;
84 mac->num_rar_entries = IXGBE_82598_RAR_ENTRIES;
85 mac->max_rx_queues = IXGBE_82598_MAX_RX_QUEUES;
86 mac->max_tx_queues = IXGBE_82598_MAX_TX_QUEUES;
87 mac->max_msix_vectors = ixgbe_get_pcie_msix_count_82598(hw);
88
89 return 0;
90}
91
92/**
93 * ixgbe_init_phy_ops_82598 - PHY/SFP specific init
94 * @hw: pointer to hardware structure
95 *
96 * Initialize any function pointers that were not able to be
97 * set during get_invariants because the PHY/SFP type was
98 * not known. Perform the SFP init if necessary.
99 *
100 **/
101s32 ixgbe_init_phy_ops_82598(struct ixgbe_hw *hw)
102{
103 struct ixgbe_mac_info *mac = &hw->mac;
78 struct ixgbe_phy_info *phy = &hw->phy; 104 struct ixgbe_phy_info *phy = &hw->phy;
79 s32 ret_val = 0; 105 s32 ret_val = 0;
80 u16 list_offset, data_offset; 106 u16 list_offset, data_offset;
81 107
82 /* Set the bus information prior to PHY identification */ 108 /* Identify the PHY */
83 mac->ops.get_bus_info(hw); 109 phy->ops.identify(hw);
84 110
85 /* Call PHY identify routine to get the phy type */ 111 /* Overwrite the link function pointers if copper PHY */
86 ixgbe_identify_phy_generic(hw); 112 if (mac->ops.get_media_type(hw) == ixgbe_media_type_copper) {
113 mac->ops.setup_link = &ixgbe_setup_copper_link_82598;
114 mac->ops.setup_link_speed =
115 &ixgbe_setup_copper_link_speed_82598;
116 mac->ops.get_link_capabilities =
117 &ixgbe_get_copper_link_capabilities_82598;
118 }
87 119
88 /* PHY Init */ 120 switch (hw->phy.type) {
89 switch (phy->type) {
90 case ixgbe_phy_tn: 121 case ixgbe_phy_tn:
91 phy->ops.check_link = &ixgbe_check_phy_link_tnx; 122 phy->ops.check_link = &ixgbe_check_phy_link_tnx;
92 phy->ops.get_firmware_version = 123 phy->ops.get_firmware_version =
@@ -106,8 +137,8 @@ static s32 ixgbe_get_invariants_82598(struct ixgbe_hw *hw)
106 137
107 /* Check to see if SFP+ module is supported */ 138 /* Check to see if SFP+ module is supported */
108 ret_val = ixgbe_get_sfp_init_sequence_offsets(hw, 139 ret_val = ixgbe_get_sfp_init_sequence_offsets(hw,
109 &list_offset, 140 &list_offset,
110 &data_offset); 141 &data_offset);
111 if (ret_val != 0) { 142 if (ret_val != 0) {
112 ret_val = IXGBE_ERR_SFP_NOT_SUPPORTED; 143 ret_val = IXGBE_ERR_SFP_NOT_SUPPORTED;
113 goto out; 144 goto out;
@@ -117,21 +148,6 @@ static s32 ixgbe_get_invariants_82598(struct ixgbe_hw *hw)
117 break; 148 break;
118 } 149 }
119 150
120 if (mac->ops.get_media_type(hw) == ixgbe_media_type_copper) {
121 mac->ops.setup_link = &ixgbe_setup_copper_link_82598;
122 mac->ops.setup_link_speed =
123 &ixgbe_setup_copper_link_speed_82598;
124 mac->ops.get_link_capabilities =
125 &ixgbe_get_copper_link_capabilities_82598;
126 }
127
128 mac->mcft_size = IXGBE_82598_MC_TBL_SIZE;
129 mac->vft_size = IXGBE_82598_VFT_TBL_SIZE;
130 mac->num_rar_entries = IXGBE_82598_RAR_ENTRIES;
131 mac->max_rx_queues = IXGBE_82598_MAX_RX_QUEUES;
132 mac->max_tx_queues = IXGBE_82598_MAX_TX_QUEUES;
133 mac->max_msix_vectors = ixgbe_get_pcie_msix_count_82598(hw);
134
135out: 151out:
136 return ret_val; 152 return ret_val;
137} 153}
@@ -719,14 +735,23 @@ static s32 ixgbe_reset_hw_82598(struct ixgbe_hw *hw)
719 } 735 }
720 736
721 /* Reset PHY */ 737 /* Reset PHY */
722 if (hw->phy.reset_disable == false) 738 if (hw->phy.reset_disable == false) {
739 /* PHY ops must be identified and initialized prior to reset */
740
741 /* Init PHY and function pointers, perform SFP setup */
742 status = hw->phy.ops.init(hw);
743 if (status == IXGBE_ERR_SFP_NOT_SUPPORTED)
744 goto reset_hw_out;
745
723 hw->phy.ops.reset(hw); 746 hw->phy.ops.reset(hw);
747 }
724 748
725 /* 749 /*
726 * Prevent the PCI-E bus from from hanging by disabling PCI-E master 750 * Prevent the PCI-E bus from from hanging by disabling PCI-E master
727 * access and verify no pending requests before reset 751 * access and verify no pending requests before reset
728 */ 752 */
729 if (ixgbe_disable_pcie_master(hw) != 0) { 753 status = ixgbe_disable_pcie_master(hw);
754 if (status != 0) {
730 status = IXGBE_ERR_MASTER_REQUESTS_PENDING; 755 status = IXGBE_ERR_MASTER_REQUESTS_PENDING;
731 hw_dbg(hw, "PCI-E Master disable polling has failed.\n"); 756 hw_dbg(hw, "PCI-E Master disable polling has failed.\n");
732 } 757 }
@@ -773,6 +798,7 @@ static s32 ixgbe_reset_hw_82598(struct ixgbe_hw *hw)
773 /* Store the permanent mac address */ 798 /* Store the permanent mac address */
774 hw->mac.ops.get_mac_addr(hw, hw->mac.perm_addr); 799 hw->mac.ops.get_mac_addr(hw, hw->mac.perm_addr);
775 800
801reset_hw_out:
776 return status; 802 return status;
777} 803}
778 804
@@ -1157,6 +1183,7 @@ static struct ixgbe_eeprom_operations eeprom_ops_82598 = {
1157static struct ixgbe_phy_operations phy_ops_82598 = { 1183static struct ixgbe_phy_operations phy_ops_82598 = {
1158 .identify = &ixgbe_identify_phy_generic, 1184 .identify = &ixgbe_identify_phy_generic,
1159 .identify_sfp = &ixgbe_identify_sfp_module_generic, 1185 .identify_sfp = &ixgbe_identify_sfp_module_generic,
1186 .init = &ixgbe_init_phy_ops_82598,
1160 .reset = &ixgbe_reset_phy_generic, 1187 .reset = &ixgbe_reset_phy_generic,
1161 .read_reg = &ixgbe_read_phy_reg_generic, 1188 .read_reg = &ixgbe_read_phy_reg_generic,
1162 .write_reg = &ixgbe_write_phy_reg_generic, 1189 .write_reg = &ixgbe_write_phy_reg_generic,
diff --git a/drivers/net/ixgbe/ixgbe_82599.c b/drivers/net/ixgbe/ixgbe_82599.c
index beae7e012609..9a9998985004 100644
--- a/drivers/net/ixgbe/ixgbe_82599.c
+++ b/drivers/net/ixgbe/ixgbe_82599.c
@@ -148,51 +148,60 @@ u32 ixgbe_get_pcie_msix_count_82599(struct ixgbe_hw *hw)
148static s32 ixgbe_get_invariants_82599(struct ixgbe_hw *hw) 148static s32 ixgbe_get_invariants_82599(struct ixgbe_hw *hw)
149{ 149{
150 struct ixgbe_mac_info *mac = &hw->mac; 150 struct ixgbe_mac_info *mac = &hw->mac;
151 struct ixgbe_phy_info *phy = &hw->phy;
152 s32 ret_val;
153 151
154 /* Set the bus information prior to PHY identification */ 152 ixgbe_init_mac_link_ops_82599(hw);
155 mac->ops.get_bus_info(hw);
156 153
157 /* Call PHY identify routine to get the Cu or SFI phy type */ 154 mac->mcft_size = IXGBE_82599_MC_TBL_SIZE;
158 ret_val = phy->ops.identify(hw); 155 mac->vft_size = IXGBE_82599_VFT_TBL_SIZE;
156 mac->num_rar_entries = IXGBE_82599_RAR_ENTRIES;
157 mac->max_rx_queues = IXGBE_82599_MAX_RX_QUEUES;
158 mac->max_tx_queues = IXGBE_82599_MAX_TX_QUEUES;
159 mac->max_msix_vectors = ixgbe_get_pcie_msix_count_82599(hw);
159 160
160 if (ret_val == IXGBE_ERR_SFP_NOT_SUPPORTED) 161 return 0;
161 goto get_invariants_out; 162}
162 163
163 ixgbe_init_mac_link_ops_82599(hw); 164/**
165 * ixgbe_init_phy_ops_82599 - PHY/SFP specific init
166 * @hw: pointer to hardware structure
167 *
168 * Initialize any function pointers that were not able to be
169 * set during get_invariants because the PHY/SFP type was
170 * not known. Perform the SFP init if necessary.
171 *
172 **/
173s32 ixgbe_init_phy_ops_82599(struct ixgbe_hw *hw)
174{
175 struct ixgbe_mac_info *mac = &hw->mac;
176 struct ixgbe_phy_info *phy = &hw->phy;
177 s32 ret_val = 0;
164 178
165 /* Setup SFP module if there is one present. */ 179 /* Identify the PHY or SFP module */
166 ret_val = mac->ops.setup_sfp(hw); 180 ret_val = phy->ops.identify(hw);
181
182 /* Setup function pointers based on detected SFP module and speeds */
183 ixgbe_init_mac_link_ops_82599(hw);
167 184
168 /* If copper media, overwrite with copper function pointers */ 185 /* If copper media, overwrite with copper function pointers */
169 if (mac->ops.get_media_type(hw) == ixgbe_media_type_copper) { 186 if (mac->ops.get_media_type(hw) == ixgbe_media_type_copper) {
170 mac->ops.setup_link = &ixgbe_setup_copper_link_82599; 187 mac->ops.setup_link = &ixgbe_setup_copper_link_82599;
171 mac->ops.setup_link_speed = 188 mac->ops.setup_link_speed =
172 &ixgbe_setup_copper_link_speed_82599; 189 &ixgbe_setup_copper_link_speed_82599;
173 mac->ops.get_link_capabilities = 190 mac->ops.get_link_capabilities =
174 &ixgbe_get_copper_link_capabilities_82599; 191 &ixgbe_get_copper_link_capabilities_82599;
175 } 192 }
176 193
177 /* PHY Init */ 194 /* Set necessary function pointers based on phy type */
178 switch (hw->phy.type) { 195 switch (hw->phy.type) {
179 case ixgbe_phy_tn: 196 case ixgbe_phy_tn:
180 phy->ops.check_link = &ixgbe_check_phy_link_tnx; 197 phy->ops.check_link = &ixgbe_check_phy_link_tnx;
181 phy->ops.get_firmware_version = 198 phy->ops.get_firmware_version =
182 &ixgbe_get_phy_firmware_version_tnx; 199 &ixgbe_get_phy_firmware_version_tnx;
183 break; 200 break;
184 default: 201 default:
185 break; 202 break;
186 } 203 }
187 204
188 mac->mcft_size = IXGBE_82599_MC_TBL_SIZE;
189 mac->vft_size = IXGBE_82599_VFT_TBL_SIZE;
190 mac->num_rar_entries = IXGBE_82599_RAR_ENTRIES;
191 mac->max_rx_queues = IXGBE_82599_MAX_RX_QUEUES;
192 mac->max_tx_queues = IXGBE_82599_MAX_TX_QUEUES;
193 mac->max_msix_vectors = ixgbe_get_pcie_msix_count_82599(hw);
194
195get_invariants_out:
196 return ret_val; 205 return ret_val;
197} 206}
198 207
@@ -708,13 +717,24 @@ s32 ixgbe_reset_hw_82599(struct ixgbe_hw *hw)
708 hw->mac.ops.stop_adapter(hw); 717 hw->mac.ops.stop_adapter(hw);
709 718
710 /* Reset PHY */ 719 /* Reset PHY */
711 hw->phy.ops.reset(hw); 720 if (hw->phy.reset_disable == false) {
721 /* PHY ops must be identified and initialized prior to reset */
722
723 /* Init PHY and function pointers, perform SFP setup */
724 status = hw->phy.ops.init(hw);
725
726 if (status == IXGBE_ERR_SFP_NOT_SUPPORTED)
727 goto reset_hw_out;
728
729 hw->phy.ops.reset(hw);
730 }
712 731
713 /* 732 /*
714 * Prevent the PCI-E bus from from hanging by disabling PCI-E master 733 * Prevent the PCI-E bus from from hanging by disabling PCI-E master
715 * access and verify no pending requests before reset 734 * access and verify no pending requests before reset
716 */ 735 */
717 if (ixgbe_disable_pcie_master(hw) != 0) { 736 status = ixgbe_disable_pcie_master(hw);
737 if (status != 0) {
718 status = IXGBE_ERR_MASTER_REQUESTS_PENDING; 738 status = IXGBE_ERR_MASTER_REQUESTS_PENDING;
719 hw_dbg(hw, "PCI-E Master disable polling has failed.\n"); 739 hw_dbg(hw, "PCI-E Master disable polling has failed.\n");
720 } 740 }
@@ -775,6 +795,7 @@ s32 ixgbe_reset_hw_82599(struct ixgbe_hw *hw)
775 /* Store the permanent mac address */ 795 /* Store the permanent mac address */
776 hw->mac.ops.get_mac_addr(hw, hw->mac.perm_addr); 796 hw->mac.ops.get_mac_addr(hw, hw->mac.perm_addr);
777 797
798reset_hw_out:
778 return status; 799 return status;
779} 800}
780 801
@@ -1272,6 +1293,7 @@ static struct ixgbe_eeprom_operations eeprom_ops_82599 = {
1272static struct ixgbe_phy_operations phy_ops_82599 = { 1293static struct ixgbe_phy_operations phy_ops_82599 = {
1273 .identify = &ixgbe_identify_phy_82599, 1294 .identify = &ixgbe_identify_phy_82599,
1274 .identify_sfp = &ixgbe_identify_sfp_module_generic, 1295 .identify_sfp = &ixgbe_identify_sfp_module_generic,
1296 .init = &ixgbe_init_phy_ops_82599,
1275 .reset = &ixgbe_reset_phy_generic, 1297 .reset = &ixgbe_reset_phy_generic,
1276 .read_reg = &ixgbe_read_phy_reg_generic, 1298 .read_reg = &ixgbe_read_phy_reg_generic,
1277 .write_reg = &ixgbe_write_phy_reg_generic, 1299 .write_reg = &ixgbe_write_phy_reg_generic,
diff --git a/drivers/net/ixgbe/ixgbe_main.c b/drivers/net/ixgbe/ixgbe_main.c
index 9ef128ae6458..936a3efb3621 100644
--- a/drivers/net/ixgbe/ixgbe_main.c
+++ b/drivers/net/ixgbe/ixgbe_main.c
@@ -4630,7 +4630,11 @@ static int __devinit ixgbe_probe(struct pci_dev *pdev,
4630 4630
4631 /* reset_hw fills in the perm_addr as well */ 4631 /* reset_hw fills in the perm_addr as well */
4632 err = hw->mac.ops.reset_hw(hw); 4632 err = hw->mac.ops.reset_hw(hw);
4633 if (err) { 4633 if (err == IXGBE_ERR_SFP_NOT_SUPPORTED) {
4634 dev_err(&adapter->pdev->dev, "failed to load because an "
4635 "unsupported SFP+ module type was detected.\n");
4636 goto err_sw_init;
4637 } else if (err) {
4634 dev_err(&adapter->pdev->dev, "HW Init failed: %d\n", err); 4638 dev_err(&adapter->pdev->dev, "HW Init failed: %d\n", err);
4635 goto err_sw_init; 4639 goto err_sw_init;
4636 } 4640 }
@@ -4703,6 +4707,9 @@ static int __devinit ixgbe_probe(struct pci_dev *pdev,
4703 device_init_wakeup(&adapter->pdev->dev, true); 4707 device_init_wakeup(&adapter->pdev->dev, true);
4704 device_set_wakeup_enable(&adapter->pdev->dev, adapter->wol); 4708 device_set_wakeup_enable(&adapter->pdev->dev, adapter->wol);
4705 4709
4710 /* pick up the PCI bus settings for reporting later */
4711 hw->mac.ops.get_bus_info(hw);
4712
4706 /* print bus type/speed/width info */ 4713 /* print bus type/speed/width info */
4707 dev_info(&pdev->dev, "(PCI Express:%s:%s) %pM\n", 4714 dev_info(&pdev->dev, "(PCI Express:%s:%s) %pM\n",
4708 ((hw->bus.speed == ixgbe_bus_speed_5000) ? "5.0Gb/s": 4715 ((hw->bus.speed == ixgbe_bus_speed_5000) ? "5.0Gb/s":
diff --git a/drivers/net/ixgbe/ixgbe_type.h b/drivers/net/ixgbe/ixgbe_type.h
index 96e15d010906..06d7e8ae6225 100644
--- a/drivers/net/ixgbe/ixgbe_type.h
+++ b/drivers/net/ixgbe/ixgbe_type.h
@@ -2150,6 +2150,7 @@ struct ixgbe_mac_operations {
2150struct ixgbe_phy_operations { 2150struct ixgbe_phy_operations {
2151 s32 (*identify)(struct ixgbe_hw *); 2151 s32 (*identify)(struct ixgbe_hw *);
2152 s32 (*identify_sfp)(struct ixgbe_hw *); 2152 s32 (*identify_sfp)(struct ixgbe_hw *);
2153 s32 (*init)(struct ixgbe_hw *);
2153 s32 (*reset)(struct ixgbe_hw *); 2154 s32 (*reset)(struct ixgbe_hw *);
2154 s32 (*read_reg)(struct ixgbe_hw *, u32, u32, u16 *); 2155 s32 (*read_reg)(struct ixgbe_hw *, u32, u32, u16 *);
2155 s32 (*write_reg)(struct ixgbe_hw *, u32, u32, u16); 2156 s32 (*write_reg)(struct ixgbe_hw *, u32, u32, u16);