ixgbe_82599.c 47 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590591592593594595596597598599600601602603604605606607608609610611612613614615616617618619620621622623624625626627628629630631632633634635636637638639640641642643644645646647648649650651652653654655656657658659660661662663664665666667668669670671672673674675676677678679680681682683684685686687688689690691692693694695696697698699700701702703704705706707708709710711712713714715716717718719720721722723724725726727728729730731732733734735736737738739740741742743744745746747748749750751752753754755756757758759760761762763764765766767768769770771772773774775776777778779780781782783784785786787788789790791792793794795796797798799800801802803804805806807808809810811812813814815816817818819820821822823824825826827828829830831832833834835836837838839840841842843844845846847848849850851852853854855856857858859860861862863864865866867868869870871872873874875876877878879880881882883884885886887888889890891892893894895896897898899900901902903904905906907908909910911912913914915916917918919920921922923924925926927928929930931932933934935936937938939940941942943944945946947948949950951952953954955956957958959960961962963964965966967968969970971972973974975976977978979980981982983984985986987988989990991992993994995996997998999100010011002100310041005100610071008100910101011101210131014101510161017101810191020102110221023102410251026102710281029103010311032103310341035103610371038103910401041104210431044104510461047104810491050105110521053105410551056105710581059106010611062106310641065106610671068106910701071107210731074107510761077107810791080108110821083108410851086108710881089109010911092109310941095109610971098109911001101110211031104110511061107110811091110111111121113111411151116111711181119112011211122112311241125112611271128112911301131113211331134113511361137113811391140114111421143114411451146114711481149115011511152115311541155115611571158115911601161116211631164116511661167116811691170117111721173117411751176117711781179118011811182118311841185118611871188118911901191119211931194119511961197119811991200120112021203120412051206120712081209121012111212121312141215121612171218121912201221122212231224122512261227122812291230123112321233123412351236123712381239124012411242124312441245124612471248124912501251125212531254125512561257125812591260126112621263126412651266126712681269127012711272127312741275127612771278127912801281128212831284128512861287128812891290129112921293129412951296129712981299130013011302130313041305130613071308130913101311131213131314131513161317131813191320132113221323132413251326132713281329133013311332133313341335133613371338133913401341134213431344134513461347134813491350135113521353135413551356135713581359136013611362136313641365136613671368136913701371137213731374137513761377137813791380138113821383138413851386138713881389139013911392139313941395139613971398139914001401140214031404140514061407140814091410141114121413141414151416141714181419142014211422142314241425142614271428142914301431143214331434143514361437143814391440144114421443144414451446144714481449145014511452145314541455145614571458145914601461146214631464146514661467146814691470147114721473147414751476147714781479148014811482148314841485148614871488148914901491149214931494149514961497149814991500150115021503150415051506150715081509151015111512151315141515151615171518151915201521152215231524152515261527152815291530153115321533153415351536153715381539154015411542154315441545
  1. /*******************************************************************************
  2. Intel 10 Gigabit PCI Express Linux driver
  3. Copyright(c) 1999 - 2009 Intel Corporation.
  4. This program is free software; you can redistribute it and/or modify it
  5. under the terms and conditions of the GNU General Public License,
  6. version 2, as published by the Free Software Foundation.
  7. This program is distributed in the hope it will be useful, but WITHOUT
  8. ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
  9. FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for
  10. more details.
  11. You should have received a copy of the GNU General Public License along with
  12. this program; if not, write to the Free Software Foundation, Inc.,
  13. 51 Franklin St - Fifth Floor, Boston, MA 02110-1301 USA.
  14. The full GNU General Public License is included in this distribution in
  15. the file called "COPYING".
  16. Contact Information:
  17. e1000-devel Mailing List <e1000-devel@lists.sourceforge.net>
  18. Intel Corporation, 5200 N.E. Elam Young Parkway, Hillsboro, OR 97124-6497
  19. *******************************************************************************/
  20. #include <linux/pci.h>
  21. #include <linux/delay.h>
  22. #include <linux/sched.h>
  23. #include "ixgbe.h"
  24. #include "ixgbe_phy.h"
  25. #define IXGBE_82599_MAX_TX_QUEUES 128
  26. #define IXGBE_82599_MAX_RX_QUEUES 128
  27. #define IXGBE_82599_RAR_ENTRIES 128
  28. #define IXGBE_82599_MC_TBL_SIZE 128
  29. #define IXGBE_82599_VFT_TBL_SIZE 128
  30. s32 ixgbe_get_link_capabilities_82599(struct ixgbe_hw *hw,
  31. ixgbe_link_speed *speed,
  32. bool *autoneg);
  33. enum ixgbe_media_type ixgbe_get_media_type_82599(struct ixgbe_hw *hw);
  34. s32 ixgbe_setup_mac_link_multispeed_fiber(struct ixgbe_hw *hw);
  35. s32 ixgbe_setup_mac_link_speed_multispeed_fiber(struct ixgbe_hw *hw,
  36. ixgbe_link_speed speed, bool autoneg,
  37. bool autoneg_wait_to_complete);
  38. s32 ixgbe_setup_mac_link_82599(struct ixgbe_hw *hw);
  39. s32 ixgbe_check_mac_link_82599(struct ixgbe_hw *hw,
  40. ixgbe_link_speed *speed,
  41. bool *link_up, bool link_up_wait_to_complete);
  42. s32 ixgbe_setup_mac_link_speed_82599(struct ixgbe_hw *hw,
  43. ixgbe_link_speed speed,
  44. bool autoneg,
  45. bool autoneg_wait_to_complete);
  46. static s32 ixgbe_get_copper_link_capabilities_82599(struct ixgbe_hw *hw,
  47. ixgbe_link_speed *speed,
  48. bool *autoneg);
  49. static s32 ixgbe_setup_copper_link_82599(struct ixgbe_hw *hw);
  50. static s32 ixgbe_setup_copper_link_speed_82599(struct ixgbe_hw *hw,
  51. ixgbe_link_speed speed,
  52. bool autoneg,
  53. bool autoneg_wait_to_complete);
  54. s32 ixgbe_reset_hw_82599(struct ixgbe_hw *hw);
  55. s32 ixgbe_set_vmdq_82599(struct ixgbe_hw *hw, u32 rar, u32 vmdq);
  56. s32 ixgbe_clear_vmdq_82599(struct ixgbe_hw *hw, u32 rar, u32 vmdq);
  57. s32 ixgbe_set_vfta_82599(struct ixgbe_hw *hw, u32 vlan,
  58. u32 vind, bool vlan_on);
  59. s32 ixgbe_clear_vfta_82599(struct ixgbe_hw *hw);
  60. s32 ixgbe_init_uta_tables_82599(struct ixgbe_hw *hw);
  61. s32 ixgbe_read_analog_reg8_82599(struct ixgbe_hw *hw, u32 reg, u8 *val);
  62. s32 ixgbe_write_analog_reg8_82599(struct ixgbe_hw *hw, u32 reg, u8 val);
  63. s32 ixgbe_start_hw_rev_0_82599(struct ixgbe_hw *hw);
  64. s32 ixgbe_identify_phy_82599(struct ixgbe_hw *hw);
  65. s32 ixgbe_start_hw_82599(struct ixgbe_hw *hw);
  66. u32 ixgbe_get_supported_physical_layer_82599(struct ixgbe_hw *hw);
  67. void ixgbe_init_mac_link_ops_82599(struct ixgbe_hw *hw)
  68. {
  69. struct ixgbe_mac_info *mac = &hw->mac;
  70. if (hw->phy.multispeed_fiber) {
  71. /* Set up dual speed SFP+ support */
  72. mac->ops.setup_link =
  73. &ixgbe_setup_mac_link_multispeed_fiber;
  74. mac->ops.setup_link_speed =
  75. &ixgbe_setup_mac_link_speed_multispeed_fiber;
  76. } else {
  77. mac->ops.setup_link =
  78. &ixgbe_setup_mac_link_82599;
  79. mac->ops.setup_link_speed =
  80. &ixgbe_setup_mac_link_speed_82599;
  81. }
  82. }
  83. s32 ixgbe_setup_sfp_modules_82599(struct ixgbe_hw *hw)
  84. {
  85. s32 ret_val = 0;
  86. u16 list_offset, data_offset, data_value;
  87. if (hw->phy.sfp_type != ixgbe_sfp_type_unknown) {
  88. ixgbe_init_mac_link_ops_82599(hw);
  89. hw->phy.ops.reset = NULL;
  90. ret_val = ixgbe_get_sfp_init_sequence_offsets(hw, &list_offset,
  91. &data_offset);
  92. if (ret_val != 0)
  93. goto setup_sfp_out;
  94. /* PHY config will finish before releasing the semaphore */
  95. ret_val = ixgbe_acquire_swfw_sync(hw, IXGBE_GSSR_MAC_CSR_SM);
  96. if (ret_val != 0) {
  97. ret_val = IXGBE_ERR_SWFW_SYNC;
  98. goto setup_sfp_out;
  99. }
  100. hw->eeprom.ops.read(hw, ++data_offset, &data_value);
  101. while (data_value != 0xffff) {
  102. IXGBE_WRITE_REG(hw, IXGBE_CORECTL, data_value);
  103. IXGBE_WRITE_FLUSH(hw);
  104. hw->eeprom.ops.read(hw, ++data_offset, &data_value);
  105. }
  106. /* Now restart DSP by setting Restart_AN */
  107. IXGBE_WRITE_REG(hw, IXGBE_AUTOC,
  108. (IXGBE_READ_REG(hw, IXGBE_AUTOC) | IXGBE_AUTOC_AN_RESTART));
  109. /* Release the semaphore */
  110. ixgbe_release_swfw_sync(hw, IXGBE_GSSR_MAC_CSR_SM);
  111. /* Delay obtaining semaphore again to allow FW access */
  112. msleep(hw->eeprom.semaphore_delay);
  113. }
  114. setup_sfp_out:
  115. return ret_val;
  116. }
  117. /**
  118. * ixgbe_get_pcie_msix_count_82599 - Gets MSI-X vector count
  119. * @hw: pointer to hardware structure
  120. *
  121. * Read PCIe configuration space, and get the MSI-X vector count from
  122. * the capabilities table.
  123. **/
  124. u32 ixgbe_get_pcie_msix_count_82599(struct ixgbe_hw *hw)
  125. {
  126. struct ixgbe_adapter *adapter = hw->back;
  127. u16 msix_count;
  128. pci_read_config_word(adapter->pdev, IXGBE_PCIE_MSIX_82599_CAPS,
  129. &msix_count);
  130. msix_count &= IXGBE_PCIE_MSIX_TBL_SZ_MASK;
  131. /* MSI-X count is zero-based in HW, so increment to give proper value */
  132. msix_count++;
  133. return msix_count;
  134. }
  135. static s32 ixgbe_get_invariants_82599(struct ixgbe_hw *hw)
  136. {
  137. struct ixgbe_mac_info *mac = &hw->mac;
  138. ixgbe_init_mac_link_ops_82599(hw);
  139. mac->mcft_size = IXGBE_82599_MC_TBL_SIZE;
  140. mac->vft_size = IXGBE_82599_VFT_TBL_SIZE;
  141. mac->num_rar_entries = IXGBE_82599_RAR_ENTRIES;
  142. mac->max_rx_queues = IXGBE_82599_MAX_RX_QUEUES;
  143. mac->max_tx_queues = IXGBE_82599_MAX_TX_QUEUES;
  144. mac->max_msix_vectors = ixgbe_get_pcie_msix_count_82599(hw);
  145. return 0;
  146. }
  147. /**
  148. * ixgbe_init_phy_ops_82599 - PHY/SFP specific init
  149. * @hw: pointer to hardware structure
  150. *
  151. * Initialize any function pointers that were not able to be
  152. * set during get_invariants because the PHY/SFP type was
  153. * not known. Perform the SFP init if necessary.
  154. *
  155. **/
  156. s32 ixgbe_init_phy_ops_82599(struct ixgbe_hw *hw)
  157. {
  158. struct ixgbe_mac_info *mac = &hw->mac;
  159. struct ixgbe_phy_info *phy = &hw->phy;
  160. s32 ret_val = 0;
  161. /* Identify the PHY or SFP module */
  162. ret_val = phy->ops.identify(hw);
  163. /* Setup function pointers based on detected SFP module and speeds */
  164. ixgbe_init_mac_link_ops_82599(hw);
  165. /* If copper media, overwrite with copper function pointers */
  166. if (mac->ops.get_media_type(hw) == ixgbe_media_type_copper) {
  167. mac->ops.setup_link = &ixgbe_setup_copper_link_82599;
  168. mac->ops.setup_link_speed =
  169. &ixgbe_setup_copper_link_speed_82599;
  170. mac->ops.get_link_capabilities =
  171. &ixgbe_get_copper_link_capabilities_82599;
  172. }
  173. /* Set necessary function pointers based on phy type */
  174. switch (hw->phy.type) {
  175. case ixgbe_phy_tn:
  176. phy->ops.check_link = &ixgbe_check_phy_link_tnx;
  177. phy->ops.get_firmware_version =
  178. &ixgbe_get_phy_firmware_version_tnx;
  179. break;
  180. default:
  181. break;
  182. }
  183. return ret_val;
  184. }
  185. /**
  186. * ixgbe_get_link_capabilities_82599 - Determines link capabilities
  187. * @hw: pointer to hardware structure
  188. * @speed: pointer to link speed
  189. * @negotiation: true when autoneg or autotry is enabled
  190. *
  191. * Determines the link capabilities by reading the AUTOC register.
  192. **/
  193. s32 ixgbe_get_link_capabilities_82599(struct ixgbe_hw *hw,
  194. ixgbe_link_speed *speed,
  195. bool *negotiation)
  196. {
  197. s32 status = 0;
  198. u32 autoc = 0;
  199. /*
  200. * Determine link capabilities based on the stored value of AUTOC,
  201. * which represents EEPROM defaults. If AUTOC value has not been
  202. * stored, use the current register value.
  203. */
  204. if (hw->mac.orig_link_settings_stored)
  205. autoc = hw->mac.orig_autoc;
  206. else
  207. autoc = IXGBE_READ_REG(hw, IXGBE_AUTOC);
  208. switch (autoc & IXGBE_AUTOC_LMS_MASK) {
  209. case IXGBE_AUTOC_LMS_1G_LINK_NO_AN:
  210. *speed = IXGBE_LINK_SPEED_1GB_FULL;
  211. *negotiation = false;
  212. break;
  213. case IXGBE_AUTOC_LMS_10G_LINK_NO_AN:
  214. *speed = IXGBE_LINK_SPEED_10GB_FULL;
  215. *negotiation = false;
  216. break;
  217. case IXGBE_AUTOC_LMS_1G_AN:
  218. *speed = IXGBE_LINK_SPEED_1GB_FULL;
  219. *negotiation = true;
  220. break;
  221. case IXGBE_AUTOC_LMS_10G_SERIAL:
  222. *speed = IXGBE_LINK_SPEED_10GB_FULL;
  223. *negotiation = false;
  224. break;
  225. case IXGBE_AUTOC_LMS_KX4_KX_KR:
  226. case IXGBE_AUTOC_LMS_KX4_KX_KR_1G_AN:
  227. *speed = IXGBE_LINK_SPEED_UNKNOWN;
  228. if (autoc & IXGBE_AUTOC_KR_SUPP)
  229. *speed |= IXGBE_LINK_SPEED_10GB_FULL;
  230. if (autoc & IXGBE_AUTOC_KX4_SUPP)
  231. *speed |= IXGBE_LINK_SPEED_10GB_FULL;
  232. if (autoc & IXGBE_AUTOC_KX_SUPP)
  233. *speed |= IXGBE_LINK_SPEED_1GB_FULL;
  234. *negotiation = true;
  235. break;
  236. case IXGBE_AUTOC_LMS_KX4_KX_KR_SGMII:
  237. *speed = IXGBE_LINK_SPEED_100_FULL;
  238. if (autoc & IXGBE_AUTOC_KR_SUPP)
  239. *speed |= IXGBE_LINK_SPEED_10GB_FULL;
  240. if (autoc & IXGBE_AUTOC_KX4_SUPP)
  241. *speed |= IXGBE_LINK_SPEED_10GB_FULL;
  242. if (autoc & IXGBE_AUTOC_KX_SUPP)
  243. *speed |= IXGBE_LINK_SPEED_1GB_FULL;
  244. *negotiation = true;
  245. break;
  246. case IXGBE_AUTOC_LMS_SGMII_1G_100M:
  247. *speed = IXGBE_LINK_SPEED_1GB_FULL | IXGBE_LINK_SPEED_100_FULL;
  248. *negotiation = false;
  249. break;
  250. default:
  251. status = IXGBE_ERR_LINK_SETUP;
  252. goto out;
  253. break;
  254. }
  255. if (hw->phy.multispeed_fiber) {
  256. *speed |= IXGBE_LINK_SPEED_10GB_FULL |
  257. IXGBE_LINK_SPEED_1GB_FULL;
  258. *negotiation = true;
  259. }
  260. out:
  261. return status;
  262. }
  263. /**
  264. * ixgbe_get_copper_link_capabilities_82599 - Determines link capabilities
  265. * @hw: pointer to hardware structure
  266. * @speed: pointer to link speed
  267. * @autoneg: boolean auto-negotiation value
  268. *
  269. * Determines the link capabilities by reading the AUTOC register.
  270. **/
  271. static s32 ixgbe_get_copper_link_capabilities_82599(struct ixgbe_hw *hw,
  272. ixgbe_link_speed *speed,
  273. bool *autoneg)
  274. {
  275. s32 status = IXGBE_ERR_LINK_SETUP;
  276. u16 speed_ability;
  277. *speed = 0;
  278. *autoneg = true;
  279. status = hw->phy.ops.read_reg(hw, MDIO_SPEED, MDIO_MMD_PMAPMD,
  280. &speed_ability);
  281. if (status == 0) {
  282. if (speed_ability & MDIO_SPEED_10G)
  283. *speed |= IXGBE_LINK_SPEED_10GB_FULL;
  284. if (speed_ability & MDIO_PMA_SPEED_1000)
  285. *speed |= IXGBE_LINK_SPEED_1GB_FULL;
  286. }
  287. return status;
  288. }
  289. /**
  290. * ixgbe_get_media_type_82599 - Get media type
  291. * @hw: pointer to hardware structure
  292. *
  293. * Returns the media type (fiber, copper, backplane)
  294. **/
  295. enum ixgbe_media_type ixgbe_get_media_type_82599(struct ixgbe_hw *hw)
  296. {
  297. enum ixgbe_media_type media_type;
  298. /* Detect if there is a copper PHY attached. */
  299. if (hw->phy.type == ixgbe_phy_cu_unknown ||
  300. hw->phy.type == ixgbe_phy_tn) {
  301. media_type = ixgbe_media_type_copper;
  302. goto out;
  303. }
  304. switch (hw->device_id) {
  305. case IXGBE_DEV_ID_82599_KX4:
  306. case IXGBE_DEV_ID_82599_XAUI_LOM:
  307. /* Default device ID is mezzanine card KX/KX4 */
  308. media_type = ixgbe_media_type_backplane;
  309. break;
  310. case IXGBE_DEV_ID_82599_SFP:
  311. media_type = ixgbe_media_type_fiber;
  312. break;
  313. default:
  314. media_type = ixgbe_media_type_unknown;
  315. break;
  316. }
  317. out:
  318. return media_type;
  319. }
  320. /**
  321. * ixgbe_setup_mac_link_82599 - Setup MAC link settings
  322. * @hw: pointer to hardware structure
  323. *
  324. * Configures link settings based on values in the ixgbe_hw struct.
  325. * Restarts the link. Performs autonegotiation if needed.
  326. **/
  327. s32 ixgbe_setup_mac_link_82599(struct ixgbe_hw *hw)
  328. {
  329. u32 autoc_reg;
  330. u32 links_reg;
  331. u32 i;
  332. s32 status = 0;
  333. /* Restart link */
  334. autoc_reg = IXGBE_READ_REG(hw, IXGBE_AUTOC);
  335. autoc_reg |= IXGBE_AUTOC_AN_RESTART;
  336. IXGBE_WRITE_REG(hw, IXGBE_AUTOC, autoc_reg);
  337. /* Only poll for autoneg to complete if specified to do so */
  338. if (hw->phy.autoneg_wait_to_complete) {
  339. if ((autoc_reg & IXGBE_AUTOC_LMS_MASK) ==
  340. IXGBE_AUTOC_LMS_KX4_KX_KR ||
  341. (autoc_reg & IXGBE_AUTOC_LMS_MASK) ==
  342. IXGBE_AUTOC_LMS_KX4_KX_KR_1G_AN ||
  343. (autoc_reg & IXGBE_AUTOC_LMS_MASK) ==
  344. IXGBE_AUTOC_LMS_KX4_KX_KR_SGMII) {
  345. links_reg = 0; /* Just in case Autoneg time = 0 */
  346. for (i = 0; i < IXGBE_AUTO_NEG_TIME; i++) {
  347. links_reg = IXGBE_READ_REG(hw, IXGBE_LINKS);
  348. if (links_reg & IXGBE_LINKS_KX_AN_COMP)
  349. break;
  350. msleep(100);
  351. }
  352. if (!(links_reg & IXGBE_LINKS_KX_AN_COMP)) {
  353. status = IXGBE_ERR_AUTONEG_NOT_COMPLETE;
  354. hw_dbg(hw, "Autoneg did not complete.\n");
  355. }
  356. }
  357. }
  358. /* Add delay to filter out noises during initial link setup */
  359. msleep(50);
  360. return status;
  361. }
  362. /**
  363. * ixgbe_setup_mac_link_multispeed_fiber - Setup MAC link settings
  364. * @hw: pointer to hardware structure
  365. *
  366. * Configures link settings based on values in the ixgbe_hw struct.
  367. * Restarts the link for multi-speed fiber at 1G speed, if link
  368. * fails at 10G.
  369. * Performs autonegotiation if needed.
  370. **/
  371. s32 ixgbe_setup_mac_link_multispeed_fiber(struct ixgbe_hw *hw)
  372. {
  373. s32 status = 0;
  374. ixgbe_link_speed link_speed = IXGBE_LINK_SPEED_82599_AUTONEG;
  375. status = ixgbe_setup_mac_link_speed_multispeed_fiber(hw, link_speed,
  376. true, true);
  377. return status;
  378. }
  379. /**
  380. * ixgbe_setup_mac_link_speed_multispeed_fiber - Set MAC link speed
  381. * @hw: pointer to hardware structure
  382. * @speed: new link speed
  383. * @autoneg: true if autonegotiation enabled
  384. * @autoneg_wait_to_complete: true when waiting for completion is needed
  385. *
  386. * Set the link speed in the AUTOC register and restarts link.
  387. **/
  388. s32 ixgbe_setup_mac_link_speed_multispeed_fiber(struct ixgbe_hw *hw,
  389. ixgbe_link_speed speed,
  390. bool autoneg,
  391. bool autoneg_wait_to_complete)
  392. {
  393. s32 status = 0;
  394. ixgbe_link_speed phy_link_speed;
  395. ixgbe_link_speed highest_link_speed = IXGBE_LINK_SPEED_UNKNOWN;
  396. u32 speedcnt = 0;
  397. u32 esdp_reg = IXGBE_READ_REG(hw, IXGBE_ESDP);
  398. bool link_up = false;
  399. bool negotiation;
  400. int i;
  401. /* Mask off requested but non-supported speeds */
  402. hw->mac.ops.get_link_capabilities(hw, &phy_link_speed, &negotiation);
  403. speed &= phy_link_speed;
  404. /*
  405. * When the driver changes the link speeds that it can support,
  406. * it sets autotry_restart to true to indicate that we need to
  407. * initiate a new autotry session with the link partner. To do
  408. * so, we set the speed then disable and re-enable the tx laser, to
  409. * alert the link partner that it also needs to restart autotry on its
  410. * end. This is consistent with true clause 37 autoneg, which also
  411. * involves a loss of signal.
  412. */
  413. /*
  414. * Try each speed one by one, highest priority first. We do this in
  415. * software because 10gb fiber doesn't support speed autonegotiation.
  416. */
  417. if (speed & IXGBE_LINK_SPEED_10GB_FULL) {
  418. speedcnt++;
  419. highest_link_speed = IXGBE_LINK_SPEED_10GB_FULL;
  420. /* If we already have link at this speed, just jump out */
  421. hw->mac.ops.check_link(hw, &phy_link_speed, &link_up, false);
  422. if ((phy_link_speed == IXGBE_LINK_SPEED_10GB_FULL) && link_up)
  423. goto out;
  424. /* Set the module link speed */
  425. esdp_reg |= (IXGBE_ESDP_SDP5_DIR | IXGBE_ESDP_SDP5);
  426. IXGBE_WRITE_REG(hw, IXGBE_ESDP, esdp_reg);
  427. /* Allow module to change analog characteristics (1G->10G) */
  428. msleep(40);
  429. status = ixgbe_setup_mac_link_speed_82599(hw,
  430. IXGBE_LINK_SPEED_10GB_FULL,
  431. autoneg,
  432. autoneg_wait_to_complete);
  433. if (status != 0)
  434. goto out;
  435. /* Flap the tx laser if it has not already been done */
  436. if (hw->mac.autotry_restart) {
  437. /* Disable tx laser; allow 100us to go dark per spec */
  438. esdp_reg |= IXGBE_ESDP_SDP3;
  439. IXGBE_WRITE_REG(hw, IXGBE_ESDP, esdp_reg);
  440. udelay(100);
  441. /* Enable tx laser; allow 2ms to light up per spec */
  442. esdp_reg &= ~IXGBE_ESDP_SDP3;
  443. IXGBE_WRITE_REG(hw, IXGBE_ESDP, esdp_reg);
  444. msleep(2);
  445. hw->mac.autotry_restart = false;
  446. }
  447. /* The controller may take up to 500ms at 10g to acquire link */
  448. for (i = 0; i < 5; i++) {
  449. /* Wait for the link partner to also set speed */
  450. msleep(100);
  451. /* If we have link, just jump out */
  452. hw->mac.ops.check_link(hw, &phy_link_speed,
  453. &link_up, false);
  454. if (link_up)
  455. goto out;
  456. }
  457. }
  458. if (speed & IXGBE_LINK_SPEED_1GB_FULL) {
  459. speedcnt++;
  460. if (highest_link_speed == IXGBE_LINK_SPEED_UNKNOWN)
  461. highest_link_speed = IXGBE_LINK_SPEED_1GB_FULL;
  462. /* If we already have link at this speed, just jump out */
  463. hw->mac.ops.check_link(hw, &phy_link_speed, &link_up, false);
  464. if ((phy_link_speed == IXGBE_LINK_SPEED_1GB_FULL) && link_up)
  465. goto out;
  466. /* Set the module link speed */
  467. esdp_reg &= ~IXGBE_ESDP_SDP5;
  468. esdp_reg |= IXGBE_ESDP_SDP5_DIR;
  469. IXGBE_WRITE_REG(hw, IXGBE_ESDP, esdp_reg);
  470. /* Allow module to change analog characteristics (10G->1G) */
  471. msleep(40);
  472. status = ixgbe_setup_mac_link_speed_82599(hw,
  473. IXGBE_LINK_SPEED_1GB_FULL,
  474. autoneg,
  475. autoneg_wait_to_complete);
  476. if (status != 0)
  477. goto out;
  478. /* Flap the tx laser if it has not already been done */
  479. if (hw->mac.autotry_restart) {
  480. /* Disable tx laser; allow 100us to go dark per spec */
  481. esdp_reg |= IXGBE_ESDP_SDP3;
  482. IXGBE_WRITE_REG(hw, IXGBE_ESDP, esdp_reg);
  483. udelay(100);
  484. /* Enable tx laser; allow 2ms to light up per spec */
  485. esdp_reg &= ~IXGBE_ESDP_SDP3;
  486. IXGBE_WRITE_REG(hw, IXGBE_ESDP, esdp_reg);
  487. msleep(2);
  488. hw->mac.autotry_restart = false;
  489. }
  490. /* Wait for the link partner to also set speed */
  491. msleep(100);
  492. /* If we have link, just jump out */
  493. hw->mac.ops.check_link(hw, &phy_link_speed, &link_up, false);
  494. if (link_up)
  495. goto out;
  496. }
  497. /*
  498. * We didn't get link. Configure back to the highest speed we tried,
  499. * (if there was more than one). We call ourselves back with just the
  500. * single highest speed that the user requested.
  501. */
  502. if (speedcnt > 1)
  503. status = ixgbe_setup_mac_link_speed_multispeed_fiber(hw,
  504. highest_link_speed,
  505. autoneg,
  506. autoneg_wait_to_complete);
  507. out:
  508. return status;
  509. }
  510. /**
  511. * ixgbe_check_mac_link_82599 - Determine link and speed status
  512. * @hw: pointer to hardware structure
  513. * @speed: pointer to link speed
  514. * @link_up: true when link is up
  515. * @link_up_wait_to_complete: bool used to wait for link up or not
  516. *
  517. * Reads the links register to determine if link is up and the current speed
  518. **/
  519. s32 ixgbe_check_mac_link_82599(struct ixgbe_hw *hw, ixgbe_link_speed *speed,
  520. bool *link_up, bool link_up_wait_to_complete)
  521. {
  522. u32 links_reg;
  523. u32 i;
  524. links_reg = IXGBE_READ_REG(hw, IXGBE_LINKS);
  525. if (link_up_wait_to_complete) {
  526. for (i = 0; i < IXGBE_LINK_UP_TIME; i++) {
  527. if (links_reg & IXGBE_LINKS_UP) {
  528. *link_up = true;
  529. break;
  530. } else {
  531. *link_up = false;
  532. }
  533. msleep(100);
  534. links_reg = IXGBE_READ_REG(hw, IXGBE_LINKS);
  535. }
  536. } else {
  537. if (links_reg & IXGBE_LINKS_UP)
  538. *link_up = true;
  539. else
  540. *link_up = false;
  541. }
  542. if ((links_reg & IXGBE_LINKS_SPEED_82599) ==
  543. IXGBE_LINKS_SPEED_10G_82599)
  544. *speed = IXGBE_LINK_SPEED_10GB_FULL;
  545. else if ((links_reg & IXGBE_LINKS_SPEED_82599) ==
  546. IXGBE_LINKS_SPEED_1G_82599)
  547. *speed = IXGBE_LINK_SPEED_1GB_FULL;
  548. else
  549. *speed = IXGBE_LINK_SPEED_100_FULL;
  550. /* if link is down, zero out the current_mode */
  551. if (*link_up == false) {
  552. hw->fc.current_mode = ixgbe_fc_none;
  553. hw->fc.fc_was_autonegged = false;
  554. }
  555. return 0;
  556. }
  557. /**
  558. * ixgbe_setup_mac_link_speed_82599 - Set MAC link speed
  559. * @hw: pointer to hardware structure
  560. * @speed: new link speed
  561. * @autoneg: true if autonegotiation enabled
  562. * @autoneg_wait_to_complete: true when waiting for completion is needed
  563. *
  564. * Set the link speed in the AUTOC register and restarts link.
  565. **/
  566. s32 ixgbe_setup_mac_link_speed_82599(struct ixgbe_hw *hw,
  567. ixgbe_link_speed speed, bool autoneg,
  568. bool autoneg_wait_to_complete)
  569. {
  570. s32 status = 0;
  571. u32 autoc = IXGBE_READ_REG(hw, IXGBE_AUTOC);
  572. u32 autoc2 = IXGBE_READ_REG(hw, IXGBE_AUTOC2);
  573. u32 start_autoc = autoc;
  574. u32 orig_autoc = 0;
  575. u32 link_mode = autoc & IXGBE_AUTOC_LMS_MASK;
  576. u32 pma_pmd_1g = autoc & IXGBE_AUTOC_1G_PMA_PMD_MASK;
  577. u32 pma_pmd_10g_serial = autoc2 & IXGBE_AUTOC2_10G_SERIAL_PMA_PMD_MASK;
  578. u32 links_reg;
  579. u32 i;
  580. ixgbe_link_speed link_capabilities = IXGBE_LINK_SPEED_UNKNOWN;
  581. /* Check to see if speed passed in is supported. */
  582. hw->mac.ops.get_link_capabilities(hw, &link_capabilities, &autoneg);
  583. speed &= link_capabilities;
  584. if (speed == IXGBE_LINK_SPEED_UNKNOWN) {
  585. status = IXGBE_ERR_LINK_SETUP;
  586. goto out;
  587. }
  588. /* Use stored value (EEPROM defaults) of AUTOC to find KR/KX4 support*/
  589. if (hw->mac.orig_link_settings_stored)
  590. orig_autoc = hw->mac.orig_autoc;
  591. else
  592. orig_autoc = autoc;
  593. if (link_mode == IXGBE_AUTOC_LMS_KX4_KX_KR ||
  594. link_mode == IXGBE_AUTOC_LMS_KX4_KX_KR_1G_AN ||
  595. link_mode == IXGBE_AUTOC_LMS_KX4_KX_KR_SGMII) {
  596. /* Set KX4/KX/KR support according to speed requested */
  597. autoc &= ~(IXGBE_AUTOC_KX4_KX_SUPP_MASK | IXGBE_AUTOC_KR_SUPP);
  598. if (speed & IXGBE_LINK_SPEED_10GB_FULL)
  599. if (orig_autoc & IXGBE_AUTOC_KX4_SUPP)
  600. autoc |= IXGBE_AUTOC_KX4_SUPP;
  601. if (orig_autoc & IXGBE_AUTOC_KR_SUPP)
  602. autoc |= IXGBE_AUTOC_KR_SUPP;
  603. if (speed & IXGBE_LINK_SPEED_1GB_FULL)
  604. autoc |= IXGBE_AUTOC_KX_SUPP;
  605. } else if ((pma_pmd_1g == IXGBE_AUTOC_1G_SFI) &&
  606. (link_mode == IXGBE_AUTOC_LMS_1G_LINK_NO_AN ||
  607. link_mode == IXGBE_AUTOC_LMS_1G_AN)) {
  608. /* Switch from 1G SFI to 10G SFI if requested */
  609. if ((speed == IXGBE_LINK_SPEED_10GB_FULL) &&
  610. (pma_pmd_10g_serial == IXGBE_AUTOC2_10G_SFI)) {
  611. autoc &= ~IXGBE_AUTOC_LMS_MASK;
  612. autoc |= IXGBE_AUTOC_LMS_10G_SERIAL;
  613. }
  614. } else if ((pma_pmd_10g_serial == IXGBE_AUTOC2_10G_SFI) &&
  615. (link_mode == IXGBE_AUTOC_LMS_10G_SERIAL)) {
  616. /* Switch from 10G SFI to 1G SFI if requested */
  617. if ((speed == IXGBE_LINK_SPEED_1GB_FULL) &&
  618. (pma_pmd_1g == IXGBE_AUTOC_1G_SFI)) {
  619. autoc &= ~IXGBE_AUTOC_LMS_MASK;
  620. if (autoneg)
  621. autoc |= IXGBE_AUTOC_LMS_1G_AN;
  622. else
  623. autoc |= IXGBE_AUTOC_LMS_1G_LINK_NO_AN;
  624. }
  625. }
  626. if (autoc != start_autoc) {
  627. /* Restart link */
  628. autoc |= IXGBE_AUTOC_AN_RESTART;
  629. IXGBE_WRITE_REG(hw, IXGBE_AUTOC, autoc);
  630. /* Only poll for autoneg to complete if specified to do so */
  631. if (autoneg_wait_to_complete) {
  632. if (link_mode == IXGBE_AUTOC_LMS_KX4_KX_KR ||
  633. link_mode == IXGBE_AUTOC_LMS_KX4_KX_KR_1G_AN ||
  634. link_mode == IXGBE_AUTOC_LMS_KX4_KX_KR_SGMII) {
  635. links_reg = 0; /*Just in case Autoneg time=0*/
  636. for (i = 0; i < IXGBE_AUTO_NEG_TIME; i++) {
  637. links_reg =
  638. IXGBE_READ_REG(hw, IXGBE_LINKS);
  639. if (links_reg & IXGBE_LINKS_KX_AN_COMP)
  640. break;
  641. msleep(100);
  642. }
  643. if (!(links_reg & IXGBE_LINKS_KX_AN_COMP)) {
  644. status =
  645. IXGBE_ERR_AUTONEG_NOT_COMPLETE;
  646. hw_dbg(hw, "Autoneg did not "
  647. "complete.\n");
  648. }
  649. }
  650. }
  651. /* Add delay to filter out noises during initial link setup */
  652. msleep(50);
  653. }
  654. out:
  655. return status;
  656. }
  657. /**
  658. * ixgbe_setup_copper_link_82599 - Setup copper link settings
  659. * @hw: pointer to hardware structure
  660. *
  661. * Restarts the link on PHY and then MAC. Performs autonegotiation if needed.
  662. **/
  663. static s32 ixgbe_setup_copper_link_82599(struct ixgbe_hw *hw)
  664. {
  665. s32 status;
  666. /* Restart autonegotiation on PHY */
  667. status = hw->phy.ops.setup_link(hw);
  668. /* Set up MAC */
  669. ixgbe_setup_mac_link_82599(hw);
  670. return status;
  671. }
  672. /**
  673. * ixgbe_setup_copper_link_speed_82599 - Set the PHY autoneg advertised field
  674. * @hw: pointer to hardware structure
  675. * @speed: new link speed
  676. * @autoneg: true if autonegotiation enabled
  677. * @autoneg_wait_to_complete: true if waiting is needed to complete
  678. *
  679. * Restarts link on PHY and MAC based on settings passed in.
  680. **/
  681. static s32 ixgbe_setup_copper_link_speed_82599(struct ixgbe_hw *hw,
  682. ixgbe_link_speed speed,
  683. bool autoneg,
  684. bool autoneg_wait_to_complete)
  685. {
  686. s32 status;
  687. /* Setup the PHY according to input speed */
  688. status = hw->phy.ops.setup_link_speed(hw, speed, autoneg,
  689. autoneg_wait_to_complete);
  690. /* Set up MAC */
  691. ixgbe_setup_mac_link_82599(hw);
  692. return status;
  693. }
  694. /**
  695. * ixgbe_reset_hw_82599 - Perform hardware reset
  696. * @hw: pointer to hardware structure
  697. *
  698. * Resets the hardware by resetting the transmit and receive units, masks
  699. * and clears all interrupts, perform a PHY reset, and perform a link (MAC)
  700. * reset.
  701. **/
  702. s32 ixgbe_reset_hw_82599(struct ixgbe_hw *hw)
  703. {
  704. s32 status = 0;
  705. u32 ctrl, ctrl_ext;
  706. u32 i;
  707. u32 autoc;
  708. u32 autoc2;
  709. /* Call adapter stop to disable tx/rx and clear interrupts */
  710. hw->mac.ops.stop_adapter(hw);
  711. /* PHY ops must be identified and initialized prior to reset */
  712. /* Init PHY and function pointers, perform SFP setup */
  713. status = hw->phy.ops.init(hw);
  714. if (status == IXGBE_ERR_SFP_NOT_SUPPORTED)
  715. goto reset_hw_out;
  716. /* Setup SFP module if there is one present. */
  717. if (hw->phy.sfp_setup_needed) {
  718. status = hw->mac.ops.setup_sfp(hw);
  719. hw->phy.sfp_setup_needed = false;
  720. }
  721. /* Reset PHY */
  722. if (hw->phy.reset_disable == false && hw->phy.ops.reset != NULL)
  723. hw->phy.ops.reset(hw);
  724. /*
  725. * Prevent the PCI-E bus from from hanging by disabling PCI-E master
  726. * access and verify no pending requests before reset
  727. */
  728. status = ixgbe_disable_pcie_master(hw);
  729. if (status != 0) {
  730. status = IXGBE_ERR_MASTER_REQUESTS_PENDING;
  731. hw_dbg(hw, "PCI-E Master disable polling has failed.\n");
  732. }
  733. /*
  734. * Issue global reset to the MAC. This needs to be a SW reset.
  735. * If link reset is used, it might reset the MAC when mng is using it
  736. */
  737. ctrl = IXGBE_READ_REG(hw, IXGBE_CTRL);
  738. IXGBE_WRITE_REG(hw, IXGBE_CTRL, (ctrl | IXGBE_CTRL_RST));
  739. IXGBE_WRITE_FLUSH(hw);
  740. /* Poll for reset bit to self-clear indicating reset is complete */
  741. for (i = 0; i < 10; i++) {
  742. udelay(1);
  743. ctrl = IXGBE_READ_REG(hw, IXGBE_CTRL);
  744. if (!(ctrl & IXGBE_CTRL_RST))
  745. break;
  746. }
  747. if (ctrl & IXGBE_CTRL_RST) {
  748. status = IXGBE_ERR_RESET_FAILED;
  749. hw_dbg(hw, "Reset polling failed to complete.\n");
  750. }
  751. /* Clear PF Reset Done bit so PF/VF Mail Ops can work */
  752. ctrl_ext = IXGBE_READ_REG(hw, IXGBE_CTRL_EXT);
  753. ctrl_ext |= IXGBE_CTRL_EXT_PFRSTD;
  754. IXGBE_WRITE_REG(hw, IXGBE_CTRL_EXT, ctrl_ext);
  755. msleep(50);
  756. /*
  757. * Store the original AUTOC/AUTOC2 values if they have not been
  758. * stored off yet. Otherwise restore the stored original
  759. * values since the reset operation sets back to defaults.
  760. */
  761. autoc = IXGBE_READ_REG(hw, IXGBE_AUTOC);
  762. autoc2 = IXGBE_READ_REG(hw, IXGBE_AUTOC2);
  763. if (hw->mac.orig_link_settings_stored == false) {
  764. hw->mac.orig_autoc = autoc;
  765. hw->mac.orig_autoc2 = autoc2;
  766. hw->mac.orig_link_settings_stored = true;
  767. } else {
  768. if (autoc != hw->mac.orig_autoc)
  769. IXGBE_WRITE_REG(hw, IXGBE_AUTOC, (hw->mac.orig_autoc |
  770. IXGBE_AUTOC_AN_RESTART));
  771. if ((autoc2 & IXGBE_AUTOC2_UPPER_MASK) !=
  772. (hw->mac.orig_autoc2 & IXGBE_AUTOC2_UPPER_MASK)) {
  773. autoc2 &= ~IXGBE_AUTOC2_UPPER_MASK;
  774. autoc2 |= (hw->mac.orig_autoc2 &
  775. IXGBE_AUTOC2_UPPER_MASK);
  776. IXGBE_WRITE_REG(hw, IXGBE_AUTOC2, autoc2);
  777. }
  778. }
  779. /*
  780. * Store MAC address from RAR0, clear receive address registers, and
  781. * clear the multicast table. Also reset num_rar_entries to 128,
  782. * since we modify this value when programming the SAN MAC address.
  783. */
  784. hw->mac.num_rar_entries = 128;
  785. hw->mac.ops.init_rx_addrs(hw);
  786. /* Store the permanent mac address */
  787. hw->mac.ops.get_mac_addr(hw, hw->mac.perm_addr);
  788. /* Store the permanent SAN mac address */
  789. hw->mac.ops.get_san_mac_addr(hw, hw->mac.san_addr);
  790. /* Add the SAN MAC address to the RAR only if it's a valid address */
  791. if (ixgbe_validate_mac_addr(hw->mac.san_addr) == 0) {
  792. hw->mac.ops.set_rar(hw, hw->mac.num_rar_entries - 1,
  793. hw->mac.san_addr, 0, IXGBE_RAH_AV);
  794. /* Reserve the last RAR for the SAN MAC address */
  795. hw->mac.num_rar_entries--;
  796. }
  797. reset_hw_out:
  798. return status;
  799. }
  800. /**
  801. * ixgbe_clear_vmdq_82599 - Disassociate a VMDq pool index from a rx address
  802. * @hw: pointer to hardware struct
  803. * @rar: receive address register index to disassociate
  804. * @vmdq: VMDq pool index to remove from the rar
  805. **/
  806. s32 ixgbe_clear_vmdq_82599(struct ixgbe_hw *hw, u32 rar, u32 vmdq)
  807. {
  808. u32 mpsar_lo, mpsar_hi;
  809. u32 rar_entries = hw->mac.num_rar_entries;
  810. if (rar < rar_entries) {
  811. mpsar_lo = IXGBE_READ_REG(hw, IXGBE_MPSAR_LO(rar));
  812. mpsar_hi = IXGBE_READ_REG(hw, IXGBE_MPSAR_HI(rar));
  813. if (!mpsar_lo && !mpsar_hi)
  814. goto done;
  815. if (vmdq == IXGBE_CLEAR_VMDQ_ALL) {
  816. if (mpsar_lo) {
  817. IXGBE_WRITE_REG(hw, IXGBE_MPSAR_LO(rar), 0);
  818. mpsar_lo = 0;
  819. }
  820. if (mpsar_hi) {
  821. IXGBE_WRITE_REG(hw, IXGBE_MPSAR_HI(rar), 0);
  822. mpsar_hi = 0;
  823. }
  824. } else if (vmdq < 32) {
  825. mpsar_lo &= ~(1 << vmdq);
  826. IXGBE_WRITE_REG(hw, IXGBE_MPSAR_LO(rar), mpsar_lo);
  827. } else {
  828. mpsar_hi &= ~(1 << (vmdq - 32));
  829. IXGBE_WRITE_REG(hw, IXGBE_MPSAR_HI(rar), mpsar_hi);
  830. }
  831. /* was that the last pool using this rar? */
  832. if (mpsar_lo == 0 && mpsar_hi == 0 && rar != 0)
  833. hw->mac.ops.clear_rar(hw, rar);
  834. } else {
  835. hw_dbg(hw, "RAR index %d is out of range.\n", rar);
  836. }
  837. done:
  838. return 0;
  839. }
  840. /**
  841. * ixgbe_set_vmdq_82599 - Associate a VMDq pool index with a rx address
  842. * @hw: pointer to hardware struct
  843. * @rar: receive address register index to associate with a VMDq index
  844. * @vmdq: VMDq pool index
  845. **/
  846. s32 ixgbe_set_vmdq_82599(struct ixgbe_hw *hw, u32 rar, u32 vmdq)
  847. {
  848. u32 mpsar;
  849. u32 rar_entries = hw->mac.num_rar_entries;
  850. if (rar < rar_entries) {
  851. if (vmdq < 32) {
  852. mpsar = IXGBE_READ_REG(hw, IXGBE_MPSAR_LO(rar));
  853. mpsar |= 1 << vmdq;
  854. IXGBE_WRITE_REG(hw, IXGBE_MPSAR_LO(rar), mpsar);
  855. } else {
  856. mpsar = IXGBE_READ_REG(hw, IXGBE_MPSAR_HI(rar));
  857. mpsar |= 1 << (vmdq - 32);
  858. IXGBE_WRITE_REG(hw, IXGBE_MPSAR_HI(rar), mpsar);
  859. }
  860. } else {
  861. hw_dbg(hw, "RAR index %d is out of range.\n", rar);
  862. }
  863. return 0;
  864. }
  865. /**
  866. * ixgbe_set_vfta_82599 - Set VLAN filter table
  867. * @hw: pointer to hardware structure
  868. * @vlan: VLAN id to write to VLAN filter
  869. * @vind: VMDq output index that maps queue to VLAN id in VFVFB
  870. * @vlan_on: boolean flag to turn on/off VLAN in VFVF
  871. *
  872. * Turn on/off specified VLAN in the VLAN filter table.
  873. **/
  874. s32 ixgbe_set_vfta_82599(struct ixgbe_hw *hw, u32 vlan, u32 vind,
  875. bool vlan_on)
  876. {
  877. u32 regindex;
  878. u32 bitindex;
  879. u32 bits;
  880. u32 first_empty_slot;
  881. if (vlan > 4095)
  882. return IXGBE_ERR_PARAM;
  883. /*
  884. * this is a 2 part operation - first the VFTA, then the
  885. * VLVF and VLVFB if vind is set
  886. */
  887. /* Part 1
  888. * The VFTA is a bitstring made up of 128 32-bit registers
  889. * that enable the particular VLAN id, much like the MTA:
  890. * bits[11-5]: which register
  891. * bits[4-0]: which bit in the register
  892. */
  893. regindex = (vlan >> 5) & 0x7F;
  894. bitindex = vlan & 0x1F;
  895. bits = IXGBE_READ_REG(hw, IXGBE_VFTA(regindex));
  896. if (vlan_on)
  897. bits |= (1 << bitindex);
  898. else
  899. bits &= ~(1 << bitindex);
  900. IXGBE_WRITE_REG(hw, IXGBE_VFTA(regindex), bits);
  901. /* Part 2
  902. * If the vind is set
  903. * Either vlan_on
  904. * make sure the vlan is in VLVF
  905. * set the vind bit in the matching VLVFB
  906. * Or !vlan_on
  907. * clear the pool bit and possibly the vind
  908. */
  909. if (vind) {
  910. /* find the vlanid or the first empty slot */
  911. first_empty_slot = 0;
  912. for (regindex = 1; regindex < IXGBE_VLVF_ENTRIES; regindex++) {
  913. bits = IXGBE_READ_REG(hw, IXGBE_VLVF(regindex));
  914. if (!bits && !first_empty_slot)
  915. first_empty_slot = regindex;
  916. else if ((bits & 0x0FFF) == vlan)
  917. break;
  918. }
  919. if (regindex >= IXGBE_VLVF_ENTRIES) {
  920. if (first_empty_slot)
  921. regindex = first_empty_slot;
  922. else {
  923. hw_dbg(hw, "No space in VLVF.\n");
  924. goto out;
  925. }
  926. }
  927. if (vlan_on) {
  928. /* set the pool bit */
  929. if (vind < 32) {
  930. bits = IXGBE_READ_REG(hw,
  931. IXGBE_VLVFB(regindex * 2));
  932. bits |= (1 << vind);
  933. IXGBE_WRITE_REG(hw,
  934. IXGBE_VLVFB(regindex * 2), bits);
  935. } else {
  936. bits = IXGBE_READ_REG(hw,
  937. IXGBE_VLVFB((regindex * 2) + 1));
  938. bits |= (1 << vind);
  939. IXGBE_WRITE_REG(hw,
  940. IXGBE_VLVFB((regindex * 2) + 1), bits);
  941. }
  942. } else {
  943. /* clear the pool bit */
  944. if (vind < 32) {
  945. bits = IXGBE_READ_REG(hw,
  946. IXGBE_VLVFB(regindex * 2));
  947. bits &= ~(1 << vind);
  948. IXGBE_WRITE_REG(hw,
  949. IXGBE_VLVFB(regindex * 2), bits);
  950. bits |= IXGBE_READ_REG(hw,
  951. IXGBE_VLVFB((regindex * 2) + 1));
  952. } else {
  953. bits = IXGBE_READ_REG(hw,
  954. IXGBE_VLVFB((regindex * 2) + 1));
  955. bits &= ~(1 << vind);
  956. IXGBE_WRITE_REG(hw,
  957. IXGBE_VLVFB((regindex * 2) + 1), bits);
  958. bits |= IXGBE_READ_REG(hw,
  959. IXGBE_VLVFB(regindex * 2));
  960. }
  961. }
  962. if (bits)
  963. IXGBE_WRITE_REG(hw, IXGBE_VLVF(regindex),
  964. (IXGBE_VLVF_VIEN | vlan));
  965. else
  966. IXGBE_WRITE_REG(hw, IXGBE_VLVF(regindex), 0);
  967. }
  968. out:
  969. return 0;
  970. }
  971. /**
  972. * ixgbe_clear_vfta_82599 - Clear VLAN filter table
  973. * @hw: pointer to hardware structure
  974. *
  975. * Clears the VLAN filer table, and the VMDq index associated with the filter
  976. **/
  977. s32 ixgbe_clear_vfta_82599(struct ixgbe_hw *hw)
  978. {
  979. u32 offset;
  980. for (offset = 0; offset < hw->mac.vft_size; offset++)
  981. IXGBE_WRITE_REG(hw, IXGBE_VFTA(offset), 0);
  982. for (offset = 0; offset < IXGBE_VLVF_ENTRIES; offset++) {
  983. IXGBE_WRITE_REG(hw, IXGBE_VLVF(offset), 0);
  984. IXGBE_WRITE_REG(hw, IXGBE_VLVFB(offset * 2), 0);
  985. IXGBE_WRITE_REG(hw, IXGBE_VLVFB((offset * 2) + 1), 0);
  986. }
  987. return 0;
  988. }
  989. /**
  990. * ixgbe_init_uta_tables_82599 - Initialize the Unicast Table Array
  991. * @hw: pointer to hardware structure
  992. **/
  993. s32 ixgbe_init_uta_tables_82599(struct ixgbe_hw *hw)
  994. {
  995. int i;
  996. hw_dbg(hw, " Clearing UTA\n");
  997. for (i = 0; i < 128; i++)
  998. IXGBE_WRITE_REG(hw, IXGBE_UTA(i), 0);
  999. return 0;
  1000. }
  1001. /**
  1002. * ixgbe_read_analog_reg8_82599 - Reads 8 bit Omer analog register
  1003. * @hw: pointer to hardware structure
  1004. * @reg: analog register to read
  1005. * @val: read value
  1006. *
  1007. * Performs read operation to Omer analog register specified.
  1008. **/
  1009. s32 ixgbe_read_analog_reg8_82599(struct ixgbe_hw *hw, u32 reg, u8 *val)
  1010. {
  1011. u32 core_ctl;
  1012. IXGBE_WRITE_REG(hw, IXGBE_CORECTL, IXGBE_CORECTL_WRITE_CMD |
  1013. (reg << 8));
  1014. IXGBE_WRITE_FLUSH(hw);
  1015. udelay(10);
  1016. core_ctl = IXGBE_READ_REG(hw, IXGBE_CORECTL);
  1017. *val = (u8)core_ctl;
  1018. return 0;
  1019. }
  1020. /**
  1021. * ixgbe_write_analog_reg8_82599 - Writes 8 bit Omer analog register
  1022. * @hw: pointer to hardware structure
  1023. * @reg: atlas register to write
  1024. * @val: value to write
  1025. *
  1026. * Performs write operation to Omer analog register specified.
  1027. **/
  1028. s32 ixgbe_write_analog_reg8_82599(struct ixgbe_hw *hw, u32 reg, u8 val)
  1029. {
  1030. u32 core_ctl;
  1031. core_ctl = (reg << 8) | val;
  1032. IXGBE_WRITE_REG(hw, IXGBE_CORECTL, core_ctl);
  1033. IXGBE_WRITE_FLUSH(hw);
  1034. udelay(10);
  1035. return 0;
  1036. }
  1037. /**
  1038. * ixgbe_start_hw_82599 - Prepare hardware for Tx/Rx
  1039. * @hw: pointer to hardware structure
  1040. *
  1041. * Starts the hardware using the generic start_hw function.
  1042. * Then performs device-specific:
  1043. * Clears the rate limiter registers.
  1044. **/
  1045. s32 ixgbe_start_hw_82599(struct ixgbe_hw *hw)
  1046. {
  1047. u32 q_num;
  1048. ixgbe_start_hw_generic(hw);
  1049. /* Clear the rate limiters */
  1050. for (q_num = 0; q_num < hw->mac.max_tx_queues; q_num++) {
  1051. IXGBE_WRITE_REG(hw, IXGBE_RTTDQSEL, q_num);
  1052. IXGBE_WRITE_REG(hw, IXGBE_RTTBCNRC, 0);
  1053. }
  1054. IXGBE_WRITE_FLUSH(hw);
  1055. /* We need to run link autotry after the driver loads */
  1056. hw->mac.autotry_restart = true;
  1057. return 0;
  1058. }
  1059. /**
  1060. * ixgbe_identify_phy_82599 - Get physical layer module
  1061. * @hw: pointer to hardware structure
  1062. *
  1063. * Determines the physical layer module found on the current adapter.
  1064. **/
  1065. s32 ixgbe_identify_phy_82599(struct ixgbe_hw *hw)
  1066. {
  1067. s32 status = IXGBE_ERR_PHY_ADDR_INVALID;
  1068. status = ixgbe_identify_phy_generic(hw);
  1069. if (status != 0)
  1070. status = ixgbe_identify_sfp_module_generic(hw);
  1071. return status;
  1072. }
  1073. /**
  1074. * ixgbe_get_supported_physical_layer_82599 - Returns physical layer type
  1075. * @hw: pointer to hardware structure
  1076. *
  1077. * Determines physical layer capabilities of the current configuration.
  1078. **/
  1079. u32 ixgbe_get_supported_physical_layer_82599(struct ixgbe_hw *hw)
  1080. {
  1081. u32 physical_layer = IXGBE_PHYSICAL_LAYER_UNKNOWN;
  1082. u32 autoc = IXGBE_READ_REG(hw, IXGBE_AUTOC);
  1083. u32 autoc2 = IXGBE_READ_REG(hw, IXGBE_AUTOC2);
  1084. u32 pma_pmd_10g_serial = autoc2 & IXGBE_AUTOC2_10G_SERIAL_PMA_PMD_MASK;
  1085. u32 pma_pmd_10g_parallel = autoc & IXGBE_AUTOC_10G_PMA_PMD_MASK;
  1086. u32 pma_pmd_1g = autoc & IXGBE_AUTOC_1G_PMA_PMD_MASK;
  1087. u16 ext_ability = 0;
  1088. u8 comp_codes_10g = 0;
  1089. hw->phy.ops.identify(hw);
  1090. if (hw->phy.type == ixgbe_phy_tn ||
  1091. hw->phy.type == ixgbe_phy_cu_unknown) {
  1092. hw->phy.ops.read_reg(hw, MDIO_PMA_EXTABLE, MDIO_MMD_PMAPMD,
  1093. &ext_ability);
  1094. if (ext_ability & MDIO_PMA_EXTABLE_10GBT)
  1095. physical_layer |= IXGBE_PHYSICAL_LAYER_10GBASE_T;
  1096. if (ext_ability & MDIO_PMA_EXTABLE_1000BT)
  1097. physical_layer |= IXGBE_PHYSICAL_LAYER_1000BASE_T;
  1098. if (ext_ability & MDIO_PMA_EXTABLE_100BTX)
  1099. physical_layer |= IXGBE_PHYSICAL_LAYER_100BASE_TX;
  1100. goto out;
  1101. }
  1102. switch (autoc & IXGBE_AUTOC_LMS_MASK) {
  1103. case IXGBE_AUTOC_LMS_1G_AN:
  1104. case IXGBE_AUTOC_LMS_1G_LINK_NO_AN:
  1105. if (pma_pmd_1g == IXGBE_AUTOC_1G_KX_BX) {
  1106. physical_layer = IXGBE_PHYSICAL_LAYER_1000BASE_KX |
  1107. IXGBE_PHYSICAL_LAYER_1000BASE_BX;
  1108. goto out;
  1109. } else
  1110. /* SFI mode so read SFP module */
  1111. goto sfp_check;
  1112. break;
  1113. case IXGBE_AUTOC_LMS_10G_LINK_NO_AN:
  1114. if (pma_pmd_10g_parallel == IXGBE_AUTOC_10G_CX4)
  1115. physical_layer = IXGBE_PHYSICAL_LAYER_10GBASE_CX4;
  1116. else if (pma_pmd_10g_parallel == IXGBE_AUTOC_10G_KX4)
  1117. physical_layer = IXGBE_PHYSICAL_LAYER_10GBASE_KX4;
  1118. else if (pma_pmd_10g_parallel == IXGBE_AUTOC_10G_XAUI)
  1119. physical_layer = IXGBE_PHYSICAL_LAYER_10GBASE_XAUI;
  1120. goto out;
  1121. break;
  1122. case IXGBE_AUTOC_LMS_10G_SERIAL:
  1123. if (pma_pmd_10g_serial == IXGBE_AUTOC2_10G_KR) {
  1124. physical_layer = IXGBE_PHYSICAL_LAYER_10GBASE_KR;
  1125. goto out;
  1126. } else if (pma_pmd_10g_serial == IXGBE_AUTOC2_10G_SFI)
  1127. goto sfp_check;
  1128. break;
  1129. case IXGBE_AUTOC_LMS_KX4_KX_KR:
  1130. case IXGBE_AUTOC_LMS_KX4_KX_KR_1G_AN:
  1131. if (autoc & IXGBE_AUTOC_KX_SUPP)
  1132. physical_layer |= IXGBE_PHYSICAL_LAYER_1000BASE_KX;
  1133. if (autoc & IXGBE_AUTOC_KX4_SUPP)
  1134. physical_layer |= IXGBE_PHYSICAL_LAYER_10GBASE_KX4;
  1135. if (autoc & IXGBE_AUTOC_KR_SUPP)
  1136. physical_layer |= IXGBE_PHYSICAL_LAYER_10GBASE_KR;
  1137. goto out;
  1138. break;
  1139. default:
  1140. goto out;
  1141. break;
  1142. }
  1143. sfp_check:
  1144. /* SFP check must be done last since DA modules are sometimes used to
  1145. * test KR mode - we need to id KR mode correctly before SFP module.
  1146. * Call identify_sfp because the pluggable module may have changed */
  1147. hw->phy.ops.identify_sfp(hw);
  1148. if (hw->phy.sfp_type == ixgbe_sfp_type_not_present)
  1149. goto out;
  1150. switch (hw->phy.type) {
  1151. case ixgbe_phy_tw_tyco:
  1152. case ixgbe_phy_tw_unknown:
  1153. physical_layer = IXGBE_PHYSICAL_LAYER_SFP_PLUS_CU;
  1154. break;
  1155. case ixgbe_phy_sfp_avago:
  1156. case ixgbe_phy_sfp_ftl:
  1157. case ixgbe_phy_sfp_intel:
  1158. case ixgbe_phy_sfp_unknown:
  1159. hw->phy.ops.read_i2c_eeprom(hw,
  1160. IXGBE_SFF_10GBE_COMP_CODES, &comp_codes_10g);
  1161. if (comp_codes_10g & IXGBE_SFF_10GBASESR_CAPABLE)
  1162. physical_layer = IXGBE_PHYSICAL_LAYER_10GBASE_SR;
  1163. else if (comp_codes_10g & IXGBE_SFF_10GBASELR_CAPABLE)
  1164. physical_layer = IXGBE_PHYSICAL_LAYER_10GBASE_LR;
  1165. break;
  1166. default:
  1167. break;
  1168. }
  1169. out:
  1170. return physical_layer;
  1171. }
  1172. /**
  1173. * ixgbe_enable_rx_dma_82599 - Enable the Rx DMA unit on 82599
  1174. * @hw: pointer to hardware structure
  1175. * @regval: register value to write to RXCTRL
  1176. *
  1177. * Enables the Rx DMA unit for 82599
  1178. **/
  1179. s32 ixgbe_enable_rx_dma_82599(struct ixgbe_hw *hw, u32 regval)
  1180. {
  1181. #define IXGBE_MAX_SECRX_POLL 30
  1182. int i;
  1183. int secrxreg;
  1184. /*
  1185. * Workaround for 82599 silicon errata when enabling the Rx datapath.
  1186. * If traffic is incoming before we enable the Rx unit, it could hang
  1187. * the Rx DMA unit. Therefore, make sure the security engine is
  1188. * completely disabled prior to enabling the Rx unit.
  1189. */
  1190. secrxreg = IXGBE_READ_REG(hw, IXGBE_SECRXCTRL);
  1191. secrxreg |= IXGBE_SECRXCTRL_RX_DIS;
  1192. IXGBE_WRITE_REG(hw, IXGBE_SECRXCTRL, secrxreg);
  1193. for (i = 0; i < IXGBE_MAX_SECRX_POLL; i++) {
  1194. secrxreg = IXGBE_READ_REG(hw, IXGBE_SECRXSTAT);
  1195. if (secrxreg & IXGBE_SECRXSTAT_SECRX_RDY)
  1196. break;
  1197. else
  1198. udelay(10);
  1199. }
  1200. /* For informational purposes only */
  1201. if (i >= IXGBE_MAX_SECRX_POLL)
  1202. hw_dbg(hw, "Rx unit being enabled before security "
  1203. "path fully disabled. Continuing with init.\n");
  1204. IXGBE_WRITE_REG(hw, IXGBE_RXCTRL, regval);
  1205. secrxreg = IXGBE_READ_REG(hw, IXGBE_SECRXCTRL);
  1206. secrxreg &= ~IXGBE_SECRXCTRL_RX_DIS;
  1207. IXGBE_WRITE_REG(hw, IXGBE_SECRXCTRL, secrxreg);
  1208. IXGBE_WRITE_FLUSH(hw);
  1209. return 0;
  1210. }
  1211. /**
  1212. * ixgbe_get_device_caps_82599 - Get additional device capabilities
  1213. * @hw: pointer to hardware structure
  1214. * @device_caps: the EEPROM word with the extra device capabilities
  1215. *
  1216. * This function will read the EEPROM location for the device capabilities,
  1217. * and return the word through device_caps.
  1218. **/
  1219. s32 ixgbe_get_device_caps_82599(struct ixgbe_hw *hw, u16 *device_caps)
  1220. {
  1221. hw->eeprom.ops.read(hw, IXGBE_DEVICE_CAPS, device_caps);
  1222. return 0;
  1223. }
  1224. /**
  1225. * ixgbe_get_san_mac_addr_offset_82599 - SAN MAC address offset for 82599
  1226. * @hw: pointer to hardware structure
  1227. * @san_mac_offset: SAN MAC address offset
  1228. *
  1229. * This function will read the EEPROM location for the SAN MAC address
  1230. * pointer, and returns the value at that location. This is used in both
  1231. * get and set mac_addr routines.
  1232. **/
  1233. s32 ixgbe_get_san_mac_addr_offset_82599(struct ixgbe_hw *hw,
  1234. u16 *san_mac_offset)
  1235. {
  1236. /*
  1237. * First read the EEPROM pointer to see if the MAC addresses are
  1238. * available.
  1239. */
  1240. hw->eeprom.ops.read(hw, IXGBE_SAN_MAC_ADDR_PTR, san_mac_offset);
  1241. return 0;
  1242. }
  1243. /**
  1244. * ixgbe_get_san_mac_addr_82599 - SAN MAC address retrieval for 82599
  1245. * @hw: pointer to hardware structure
  1246. * @san_mac_addr: SAN MAC address
  1247. *
  1248. * Reads the SAN MAC address from the EEPROM, if it's available. This is
  1249. * per-port, so set_lan_id() must be called before reading the addresses.
  1250. * set_lan_id() is called by identify_sfp(), but this cannot be relied
  1251. * upon for non-SFP connections, so we must call it here.
  1252. **/
  1253. s32 ixgbe_get_san_mac_addr_82599(struct ixgbe_hw *hw, u8 *san_mac_addr)
  1254. {
  1255. u16 san_mac_data, san_mac_offset;
  1256. u8 i;
  1257. /*
  1258. * First read the EEPROM pointer to see if the MAC addresses are
  1259. * available. If they're not, no point in calling set_lan_id() here.
  1260. */
  1261. ixgbe_get_san_mac_addr_offset_82599(hw, &san_mac_offset);
  1262. if ((san_mac_offset == 0) || (san_mac_offset == 0xFFFF)) {
  1263. /*
  1264. * No addresses available in this EEPROM. It's not an
  1265. * error though, so just wipe the local address and return.
  1266. */
  1267. for (i = 0; i < 6; i++)
  1268. san_mac_addr[i] = 0xFF;
  1269. goto san_mac_addr_out;
  1270. }
  1271. /* make sure we know which port we need to program */
  1272. hw->mac.ops.set_lan_id(hw);
  1273. /* apply the port offset to the address offset */
  1274. (hw->bus.func) ? (san_mac_offset += IXGBE_SAN_MAC_ADDR_PORT1_OFFSET) :
  1275. (san_mac_offset += IXGBE_SAN_MAC_ADDR_PORT0_OFFSET);
  1276. for (i = 0; i < 3; i++) {
  1277. hw->eeprom.ops.read(hw, san_mac_offset, &san_mac_data);
  1278. san_mac_addr[i * 2] = (u8)(san_mac_data);
  1279. san_mac_addr[i * 2 + 1] = (u8)(san_mac_data >> 8);
  1280. san_mac_offset++;
  1281. }
  1282. san_mac_addr_out:
  1283. return 0;
  1284. }
  1285. static struct ixgbe_mac_operations mac_ops_82599 = {
  1286. .init_hw = &ixgbe_init_hw_generic,
  1287. .reset_hw = &ixgbe_reset_hw_82599,
  1288. .start_hw = &ixgbe_start_hw_82599,
  1289. .clear_hw_cntrs = &ixgbe_clear_hw_cntrs_generic,
  1290. .get_media_type = &ixgbe_get_media_type_82599,
  1291. .get_supported_physical_layer = &ixgbe_get_supported_physical_layer_82599,
  1292. .enable_rx_dma = &ixgbe_enable_rx_dma_82599,
  1293. .get_mac_addr = &ixgbe_get_mac_addr_generic,
  1294. .get_san_mac_addr = &ixgbe_get_san_mac_addr_82599,
  1295. .get_device_caps = &ixgbe_get_device_caps_82599,
  1296. .stop_adapter = &ixgbe_stop_adapter_generic,
  1297. .get_bus_info = &ixgbe_get_bus_info_generic,
  1298. .set_lan_id = &ixgbe_set_lan_id_multi_port_pcie,
  1299. .read_analog_reg8 = &ixgbe_read_analog_reg8_82599,
  1300. .write_analog_reg8 = &ixgbe_write_analog_reg8_82599,
  1301. .setup_link = &ixgbe_setup_mac_link_82599,
  1302. .setup_link_speed = &ixgbe_setup_mac_link_speed_82599,
  1303. .check_link = &ixgbe_check_mac_link_82599,
  1304. .get_link_capabilities = &ixgbe_get_link_capabilities_82599,
  1305. .led_on = &ixgbe_led_on_generic,
  1306. .led_off = &ixgbe_led_off_generic,
  1307. .blink_led_start = &ixgbe_blink_led_start_generic,
  1308. .blink_led_stop = &ixgbe_blink_led_stop_generic,
  1309. .set_rar = &ixgbe_set_rar_generic,
  1310. .clear_rar = &ixgbe_clear_rar_generic,
  1311. .set_vmdq = &ixgbe_set_vmdq_82599,
  1312. .clear_vmdq = &ixgbe_clear_vmdq_82599,
  1313. .init_rx_addrs = &ixgbe_init_rx_addrs_generic,
  1314. .update_uc_addr_list = &ixgbe_update_uc_addr_list_generic,
  1315. .update_mc_addr_list = &ixgbe_update_mc_addr_list_generic,
  1316. .enable_mc = &ixgbe_enable_mc_generic,
  1317. .disable_mc = &ixgbe_disable_mc_generic,
  1318. .clear_vfta = &ixgbe_clear_vfta_82599,
  1319. .set_vfta = &ixgbe_set_vfta_82599,
  1320. .fc_enable = &ixgbe_fc_enable_generic,
  1321. .init_uta_tables = &ixgbe_init_uta_tables_82599,
  1322. .setup_sfp = &ixgbe_setup_sfp_modules_82599,
  1323. };
  1324. static struct ixgbe_eeprom_operations eeprom_ops_82599 = {
  1325. .init_params = &ixgbe_init_eeprom_params_generic,
  1326. .read = &ixgbe_read_eeprom_generic,
  1327. .write = &ixgbe_write_eeprom_generic,
  1328. .validate_checksum = &ixgbe_validate_eeprom_checksum_generic,
  1329. .update_checksum = &ixgbe_update_eeprom_checksum_generic,
  1330. };
  1331. static struct ixgbe_phy_operations phy_ops_82599 = {
  1332. .identify = &ixgbe_identify_phy_82599,
  1333. .identify_sfp = &ixgbe_identify_sfp_module_generic,
  1334. .init = &ixgbe_init_phy_ops_82599,
  1335. .reset = &ixgbe_reset_phy_generic,
  1336. .read_reg = &ixgbe_read_phy_reg_generic,
  1337. .write_reg = &ixgbe_write_phy_reg_generic,
  1338. .setup_link = &ixgbe_setup_phy_link_generic,
  1339. .setup_link_speed = &ixgbe_setup_phy_link_speed_generic,
  1340. .read_i2c_byte = &ixgbe_read_i2c_byte_generic,
  1341. .write_i2c_byte = &ixgbe_write_i2c_byte_generic,
  1342. .read_i2c_eeprom = &ixgbe_read_i2c_eeprom_generic,
  1343. .write_i2c_eeprom = &ixgbe_write_i2c_eeprom_generic,
  1344. };
  1345. struct ixgbe_info ixgbe_82599_info = {
  1346. .mac = ixgbe_mac_82599EB,
  1347. .get_invariants = &ixgbe_get_invariants_82599,
  1348. .mac_ops = &mac_ops_82599,
  1349. .eeprom_ops = &eeprom_ops_82599,
  1350. .phy_ops = &phy_ops_82599,
  1351. };