ixgbe_82599.c 47 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590591592593594595596597598599600601602603604605606607608609610611612613614615616617618619620621622623624625626627628629630631632633634635636637638639640641642643644645646647648649650651652653654655656657658659660661662663664665666667668669670671672673674675676677678679680681682683684685686687688689690691692693694695696697698699700701702703704705706707708709710711712713714715716717718719720721722723724725726727728729730731732733734735736737738739740741742743744745746747748749750751752753754755756757758759760761762763764765766767768769770771772773774775776777778779780781782783784785786787788789790791792793794795796797798799800801802803804805806807808809810811812813814815816817818819820821822823824825826827828829830831832833834835836837838839840841842843844845846847848849850851852853854855856857858859860861862863864865866867868869870871872873874875876877878879880881882883884885886887888889890891892893894895896897898899900901902903904905906907908909910911912913914915916917918919920921922923924925926927928929930931932933934935936937938939940941942943944945946947948949950951952953954955956957958959960961962963964965966967968969970971972973974975976977978979980981982983984985986987988989990991992993994995996997998999100010011002100310041005100610071008100910101011101210131014101510161017101810191020102110221023102410251026102710281029103010311032103310341035103610371038103910401041104210431044104510461047104810491050105110521053105410551056105710581059106010611062106310641065106610671068106910701071107210731074107510761077107810791080108110821083108410851086108710881089109010911092109310941095109610971098109911001101110211031104110511061107110811091110111111121113111411151116111711181119112011211122112311241125112611271128112911301131113211331134113511361137113811391140114111421143114411451146114711481149115011511152115311541155115611571158115911601161116211631164116511661167116811691170117111721173117411751176117711781179118011811182118311841185118611871188118911901191119211931194119511961197119811991200120112021203120412051206120712081209121012111212121312141215121612171218121912201221122212231224122512261227122812291230123112321233123412351236123712381239124012411242124312441245124612471248124912501251125212531254125512561257125812591260126112621263126412651266126712681269127012711272127312741275127612771278127912801281128212831284128512861287128812891290129112921293129412951296129712981299130013011302130313041305130613071308130913101311131213131314131513161317131813191320132113221323132413251326132713281329133013311332133313341335133613371338133913401341134213431344134513461347134813491350135113521353135413551356135713581359136013611362136313641365136613671368136913701371137213731374137513761377137813791380138113821383138413851386138713881389139013911392139313941395139613971398139914001401140214031404140514061407140814091410141114121413141414151416141714181419142014211422142314241425142614271428142914301431143214331434143514361437143814391440144114421443144414451446144714481449145014511452145314541455145614571458145914601461146214631464146514661467146814691470147114721473147414751476147714781479148014811482148314841485148614871488148914901491149214931494149514961497149814991500150115021503150415051506150715081509151015111512151315141515151615171518151915201521152215231524152515261527152815291530153115321533153415351536153715381539154015411542154315441545154615471548154915501551155215531554
  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. /* Set autoneg_advertised value based on input link speed */
  405. hw->phy.autoneg_advertised = 0;
  406. if (speed & IXGBE_LINK_SPEED_10GB_FULL)
  407. hw->phy.autoneg_advertised |= IXGBE_LINK_SPEED_10GB_FULL;
  408. if (speed & IXGBE_LINK_SPEED_1GB_FULL)
  409. hw->phy.autoneg_advertised |= IXGBE_LINK_SPEED_1GB_FULL;
  410. /*
  411. * When the driver changes the link speeds that it can support,
  412. * it sets autotry_restart to true to indicate that we need to
  413. * initiate a new autotry session with the link partner. To do
  414. * so, we set the speed then disable and re-enable the tx laser, to
  415. * alert the link partner that it also needs to restart autotry on its
  416. * end. This is consistent with true clause 37 autoneg, which also
  417. * involves a loss of signal.
  418. */
  419. /*
  420. * Try each speed one by one, highest priority first. We do this in
  421. * software because 10gb fiber doesn't support speed autonegotiation.
  422. */
  423. if (speed & IXGBE_LINK_SPEED_10GB_FULL) {
  424. speedcnt++;
  425. highest_link_speed = IXGBE_LINK_SPEED_10GB_FULL;
  426. /* If we already have link at this speed, just jump out */
  427. hw->mac.ops.check_link(hw, &phy_link_speed, &link_up, false);
  428. if ((phy_link_speed == IXGBE_LINK_SPEED_10GB_FULL) && link_up)
  429. goto out;
  430. /* Set the module link speed */
  431. esdp_reg |= (IXGBE_ESDP_SDP5_DIR | IXGBE_ESDP_SDP5);
  432. IXGBE_WRITE_REG(hw, IXGBE_ESDP, esdp_reg);
  433. /* Allow module to change analog characteristics (1G->10G) */
  434. msleep(40);
  435. status = ixgbe_setup_mac_link_speed_82599(hw,
  436. IXGBE_LINK_SPEED_10GB_FULL,
  437. autoneg,
  438. autoneg_wait_to_complete);
  439. if (status != 0)
  440. goto out;
  441. /* Flap the tx laser if it has not already been done */
  442. if (hw->mac.autotry_restart) {
  443. /* Disable tx laser; allow 100us to go dark per spec */
  444. esdp_reg |= IXGBE_ESDP_SDP3;
  445. IXGBE_WRITE_REG(hw, IXGBE_ESDP, esdp_reg);
  446. udelay(100);
  447. /* Enable tx laser; allow 2ms to light up per spec */
  448. esdp_reg &= ~IXGBE_ESDP_SDP3;
  449. IXGBE_WRITE_REG(hw, IXGBE_ESDP, esdp_reg);
  450. msleep(2);
  451. hw->mac.autotry_restart = false;
  452. }
  453. /* The controller may take up to 500ms at 10g to acquire link */
  454. for (i = 0; i < 5; i++) {
  455. /* Wait for the link partner to also set speed */
  456. msleep(100);
  457. /* If we have link, just jump out */
  458. hw->mac.ops.check_link(hw, &phy_link_speed,
  459. &link_up, false);
  460. if (link_up)
  461. goto out;
  462. }
  463. }
  464. if (speed & IXGBE_LINK_SPEED_1GB_FULL) {
  465. speedcnt++;
  466. if (highest_link_speed == IXGBE_LINK_SPEED_UNKNOWN)
  467. highest_link_speed = IXGBE_LINK_SPEED_1GB_FULL;
  468. /* If we already have link at this speed, just jump out */
  469. hw->mac.ops.check_link(hw, &phy_link_speed, &link_up, false);
  470. if ((phy_link_speed == IXGBE_LINK_SPEED_1GB_FULL) && link_up)
  471. goto out;
  472. /* Set the module link speed */
  473. esdp_reg &= ~IXGBE_ESDP_SDP5;
  474. esdp_reg |= IXGBE_ESDP_SDP5_DIR;
  475. IXGBE_WRITE_REG(hw, IXGBE_ESDP, esdp_reg);
  476. /* Allow module to change analog characteristics (10G->1G) */
  477. msleep(40);
  478. status = ixgbe_setup_mac_link_speed_82599(hw,
  479. IXGBE_LINK_SPEED_1GB_FULL,
  480. autoneg,
  481. autoneg_wait_to_complete);
  482. if (status != 0)
  483. goto out;
  484. /* Flap the tx laser if it has not already been done */
  485. if (hw->mac.autotry_restart) {
  486. /* Disable tx laser; allow 100us to go dark per spec */
  487. esdp_reg |= IXGBE_ESDP_SDP3;
  488. IXGBE_WRITE_REG(hw, IXGBE_ESDP, esdp_reg);
  489. udelay(100);
  490. /* Enable tx laser; allow 2ms to light up per spec */
  491. esdp_reg &= ~IXGBE_ESDP_SDP3;
  492. IXGBE_WRITE_REG(hw, IXGBE_ESDP, esdp_reg);
  493. msleep(2);
  494. hw->mac.autotry_restart = false;
  495. }
  496. /* Wait for the link partner to also set speed */
  497. msleep(100);
  498. /* If we have link, just jump out */
  499. hw->mac.ops.check_link(hw, &phy_link_speed, &link_up, false);
  500. if (link_up)
  501. goto out;
  502. }
  503. /*
  504. * We didn't get link. Configure back to the highest speed we tried,
  505. * (if there was more than one). We call ourselves back with just the
  506. * single highest speed that the user requested.
  507. */
  508. if (speedcnt > 1)
  509. status = ixgbe_setup_mac_link_speed_multispeed_fiber(hw,
  510. highest_link_speed,
  511. autoneg,
  512. autoneg_wait_to_complete);
  513. out:
  514. return status;
  515. }
  516. /**
  517. * ixgbe_check_mac_link_82599 - Determine link and speed status
  518. * @hw: pointer to hardware structure
  519. * @speed: pointer to link speed
  520. * @link_up: true when link is up
  521. * @link_up_wait_to_complete: bool used to wait for link up or not
  522. *
  523. * Reads the links register to determine if link is up and the current speed
  524. **/
  525. s32 ixgbe_check_mac_link_82599(struct ixgbe_hw *hw, ixgbe_link_speed *speed,
  526. bool *link_up, bool link_up_wait_to_complete)
  527. {
  528. u32 links_reg;
  529. u32 i;
  530. links_reg = IXGBE_READ_REG(hw, IXGBE_LINKS);
  531. if (link_up_wait_to_complete) {
  532. for (i = 0; i < IXGBE_LINK_UP_TIME; i++) {
  533. if (links_reg & IXGBE_LINKS_UP) {
  534. *link_up = true;
  535. break;
  536. } else {
  537. *link_up = false;
  538. }
  539. msleep(100);
  540. links_reg = IXGBE_READ_REG(hw, IXGBE_LINKS);
  541. }
  542. } else {
  543. if (links_reg & IXGBE_LINKS_UP)
  544. *link_up = true;
  545. else
  546. *link_up = false;
  547. }
  548. if ((links_reg & IXGBE_LINKS_SPEED_82599) ==
  549. IXGBE_LINKS_SPEED_10G_82599)
  550. *speed = IXGBE_LINK_SPEED_10GB_FULL;
  551. else if ((links_reg & IXGBE_LINKS_SPEED_82599) ==
  552. IXGBE_LINKS_SPEED_1G_82599)
  553. *speed = IXGBE_LINK_SPEED_1GB_FULL;
  554. else
  555. *speed = IXGBE_LINK_SPEED_100_FULL;
  556. /* if link is down, zero out the current_mode */
  557. if (*link_up == false) {
  558. hw->fc.current_mode = ixgbe_fc_none;
  559. hw->fc.fc_was_autonegged = false;
  560. }
  561. return 0;
  562. }
  563. /**
  564. * ixgbe_setup_mac_link_speed_82599 - Set MAC link speed
  565. * @hw: pointer to hardware structure
  566. * @speed: new link speed
  567. * @autoneg: true if autonegotiation enabled
  568. * @autoneg_wait_to_complete: true when waiting for completion is needed
  569. *
  570. * Set the link speed in the AUTOC register and restarts link.
  571. **/
  572. s32 ixgbe_setup_mac_link_speed_82599(struct ixgbe_hw *hw,
  573. ixgbe_link_speed speed, bool autoneg,
  574. bool autoneg_wait_to_complete)
  575. {
  576. s32 status = 0;
  577. u32 autoc = IXGBE_READ_REG(hw, IXGBE_AUTOC);
  578. u32 autoc2 = IXGBE_READ_REG(hw, IXGBE_AUTOC2);
  579. u32 start_autoc = autoc;
  580. u32 orig_autoc = 0;
  581. u32 link_mode = autoc & IXGBE_AUTOC_LMS_MASK;
  582. u32 pma_pmd_1g = autoc & IXGBE_AUTOC_1G_PMA_PMD_MASK;
  583. u32 pma_pmd_10g_serial = autoc2 & IXGBE_AUTOC2_10G_SERIAL_PMA_PMD_MASK;
  584. u32 links_reg;
  585. u32 i;
  586. ixgbe_link_speed link_capabilities = IXGBE_LINK_SPEED_UNKNOWN;
  587. /* Check to see if speed passed in is supported. */
  588. hw->mac.ops.get_link_capabilities(hw, &link_capabilities, &autoneg);
  589. speed &= link_capabilities;
  590. if (speed == IXGBE_LINK_SPEED_UNKNOWN) {
  591. status = IXGBE_ERR_LINK_SETUP;
  592. goto out;
  593. }
  594. /* Use stored value (EEPROM defaults) of AUTOC to find KR/KX4 support*/
  595. if (hw->mac.orig_link_settings_stored)
  596. orig_autoc = hw->mac.orig_autoc;
  597. else
  598. orig_autoc = autoc;
  599. if (link_mode == IXGBE_AUTOC_LMS_KX4_KX_KR ||
  600. link_mode == IXGBE_AUTOC_LMS_KX4_KX_KR_1G_AN ||
  601. link_mode == IXGBE_AUTOC_LMS_KX4_KX_KR_SGMII) {
  602. /* Set KX4/KX/KR support according to speed requested */
  603. autoc &= ~(IXGBE_AUTOC_KX4_KX_SUPP_MASK | IXGBE_AUTOC_KR_SUPP);
  604. if (speed & IXGBE_LINK_SPEED_10GB_FULL)
  605. if (orig_autoc & IXGBE_AUTOC_KX4_SUPP)
  606. autoc |= IXGBE_AUTOC_KX4_SUPP;
  607. if (orig_autoc & IXGBE_AUTOC_KR_SUPP)
  608. autoc |= IXGBE_AUTOC_KR_SUPP;
  609. if (speed & IXGBE_LINK_SPEED_1GB_FULL)
  610. autoc |= IXGBE_AUTOC_KX_SUPP;
  611. } else if ((pma_pmd_1g == IXGBE_AUTOC_1G_SFI) &&
  612. (link_mode == IXGBE_AUTOC_LMS_1G_LINK_NO_AN ||
  613. link_mode == IXGBE_AUTOC_LMS_1G_AN)) {
  614. /* Switch from 1G SFI to 10G SFI if requested */
  615. if ((speed == IXGBE_LINK_SPEED_10GB_FULL) &&
  616. (pma_pmd_10g_serial == IXGBE_AUTOC2_10G_SFI)) {
  617. autoc &= ~IXGBE_AUTOC_LMS_MASK;
  618. autoc |= IXGBE_AUTOC_LMS_10G_SERIAL;
  619. }
  620. } else if ((pma_pmd_10g_serial == IXGBE_AUTOC2_10G_SFI) &&
  621. (link_mode == IXGBE_AUTOC_LMS_10G_SERIAL)) {
  622. /* Switch from 10G SFI to 1G SFI if requested */
  623. if ((speed == IXGBE_LINK_SPEED_1GB_FULL) &&
  624. (pma_pmd_1g == IXGBE_AUTOC_1G_SFI)) {
  625. autoc &= ~IXGBE_AUTOC_LMS_MASK;
  626. if (autoneg)
  627. autoc |= IXGBE_AUTOC_LMS_1G_AN;
  628. else
  629. autoc |= IXGBE_AUTOC_LMS_1G_LINK_NO_AN;
  630. }
  631. }
  632. if (autoc != start_autoc) {
  633. /* Restart link */
  634. autoc |= IXGBE_AUTOC_AN_RESTART;
  635. IXGBE_WRITE_REG(hw, IXGBE_AUTOC, autoc);
  636. /* Only poll for autoneg to complete if specified to do so */
  637. if (autoneg_wait_to_complete) {
  638. if (link_mode == IXGBE_AUTOC_LMS_KX4_KX_KR ||
  639. link_mode == IXGBE_AUTOC_LMS_KX4_KX_KR_1G_AN ||
  640. link_mode == IXGBE_AUTOC_LMS_KX4_KX_KR_SGMII) {
  641. links_reg = 0; /*Just in case Autoneg time=0*/
  642. for (i = 0; i < IXGBE_AUTO_NEG_TIME; i++) {
  643. links_reg =
  644. IXGBE_READ_REG(hw, IXGBE_LINKS);
  645. if (links_reg & IXGBE_LINKS_KX_AN_COMP)
  646. break;
  647. msleep(100);
  648. }
  649. if (!(links_reg & IXGBE_LINKS_KX_AN_COMP)) {
  650. status =
  651. IXGBE_ERR_AUTONEG_NOT_COMPLETE;
  652. hw_dbg(hw, "Autoneg did not "
  653. "complete.\n");
  654. }
  655. }
  656. }
  657. /* Add delay to filter out noises during initial link setup */
  658. msleep(50);
  659. }
  660. out:
  661. return status;
  662. }
  663. /**
  664. * ixgbe_setup_copper_link_82599 - Setup copper link settings
  665. * @hw: pointer to hardware structure
  666. *
  667. * Restarts the link on PHY and then MAC. Performs autonegotiation if needed.
  668. **/
  669. static s32 ixgbe_setup_copper_link_82599(struct ixgbe_hw *hw)
  670. {
  671. s32 status;
  672. /* Restart autonegotiation on PHY */
  673. status = hw->phy.ops.setup_link(hw);
  674. /* Set up MAC */
  675. ixgbe_setup_mac_link_82599(hw);
  676. return status;
  677. }
  678. /**
  679. * ixgbe_setup_copper_link_speed_82599 - Set the PHY autoneg advertised field
  680. * @hw: pointer to hardware structure
  681. * @speed: new link speed
  682. * @autoneg: true if autonegotiation enabled
  683. * @autoneg_wait_to_complete: true if waiting is needed to complete
  684. *
  685. * Restarts link on PHY and MAC based on settings passed in.
  686. **/
  687. static s32 ixgbe_setup_copper_link_speed_82599(struct ixgbe_hw *hw,
  688. ixgbe_link_speed speed,
  689. bool autoneg,
  690. bool autoneg_wait_to_complete)
  691. {
  692. s32 status;
  693. /* Setup the PHY according to input speed */
  694. status = hw->phy.ops.setup_link_speed(hw, speed, autoneg,
  695. autoneg_wait_to_complete);
  696. /* Set up MAC */
  697. ixgbe_setup_mac_link_82599(hw);
  698. return status;
  699. }
  700. /**
  701. * ixgbe_reset_hw_82599 - Perform hardware reset
  702. * @hw: pointer to hardware structure
  703. *
  704. * Resets the hardware by resetting the transmit and receive units, masks
  705. * and clears all interrupts, perform a PHY reset, and perform a link (MAC)
  706. * reset.
  707. **/
  708. s32 ixgbe_reset_hw_82599(struct ixgbe_hw *hw)
  709. {
  710. s32 status = 0;
  711. u32 ctrl, ctrl_ext;
  712. u32 i;
  713. u32 autoc;
  714. u32 autoc2;
  715. /* Call adapter stop to disable tx/rx and clear interrupts */
  716. hw->mac.ops.stop_adapter(hw);
  717. /* PHY ops must be identified and initialized prior to reset */
  718. /* Init PHY and function pointers, perform SFP setup */
  719. status = hw->phy.ops.init(hw);
  720. if (status == IXGBE_ERR_SFP_NOT_SUPPORTED)
  721. goto reset_hw_out;
  722. /* Setup SFP module if there is one present. */
  723. if (hw->phy.sfp_setup_needed) {
  724. status = hw->mac.ops.setup_sfp(hw);
  725. hw->phy.sfp_setup_needed = false;
  726. }
  727. /* Reset PHY */
  728. if (hw->phy.reset_disable == false && hw->phy.ops.reset != NULL)
  729. hw->phy.ops.reset(hw);
  730. /*
  731. * Prevent the PCI-E bus from from hanging by disabling PCI-E master
  732. * access and verify no pending requests before reset
  733. */
  734. status = ixgbe_disable_pcie_master(hw);
  735. if (status != 0) {
  736. status = IXGBE_ERR_MASTER_REQUESTS_PENDING;
  737. hw_dbg(hw, "PCI-E Master disable polling has failed.\n");
  738. }
  739. /*
  740. * Issue global reset to the MAC. This needs to be a SW reset.
  741. * If link reset is used, it might reset the MAC when mng is using it
  742. */
  743. ctrl = IXGBE_READ_REG(hw, IXGBE_CTRL);
  744. IXGBE_WRITE_REG(hw, IXGBE_CTRL, (ctrl | IXGBE_CTRL_RST));
  745. IXGBE_WRITE_FLUSH(hw);
  746. /* Poll for reset bit to self-clear indicating reset is complete */
  747. for (i = 0; i < 10; i++) {
  748. udelay(1);
  749. ctrl = IXGBE_READ_REG(hw, IXGBE_CTRL);
  750. if (!(ctrl & IXGBE_CTRL_RST))
  751. break;
  752. }
  753. if (ctrl & IXGBE_CTRL_RST) {
  754. status = IXGBE_ERR_RESET_FAILED;
  755. hw_dbg(hw, "Reset polling failed to complete.\n");
  756. }
  757. /* Clear PF Reset Done bit so PF/VF Mail Ops can work */
  758. ctrl_ext = IXGBE_READ_REG(hw, IXGBE_CTRL_EXT);
  759. ctrl_ext |= IXGBE_CTRL_EXT_PFRSTD;
  760. IXGBE_WRITE_REG(hw, IXGBE_CTRL_EXT, ctrl_ext);
  761. msleep(50);
  762. /*
  763. * Store the original AUTOC/AUTOC2 values if they have not been
  764. * stored off yet. Otherwise restore the stored original
  765. * values since the reset operation sets back to defaults.
  766. */
  767. autoc = IXGBE_READ_REG(hw, IXGBE_AUTOC);
  768. autoc2 = IXGBE_READ_REG(hw, IXGBE_AUTOC2);
  769. if (hw->mac.orig_link_settings_stored == false) {
  770. hw->mac.orig_autoc = autoc;
  771. hw->mac.orig_autoc2 = autoc2;
  772. hw->mac.orig_link_settings_stored = true;
  773. } else {
  774. if (autoc != hw->mac.orig_autoc)
  775. IXGBE_WRITE_REG(hw, IXGBE_AUTOC, (hw->mac.orig_autoc |
  776. IXGBE_AUTOC_AN_RESTART));
  777. if ((autoc2 & IXGBE_AUTOC2_UPPER_MASK) !=
  778. (hw->mac.orig_autoc2 & IXGBE_AUTOC2_UPPER_MASK)) {
  779. autoc2 &= ~IXGBE_AUTOC2_UPPER_MASK;
  780. autoc2 |= (hw->mac.orig_autoc2 &
  781. IXGBE_AUTOC2_UPPER_MASK);
  782. IXGBE_WRITE_REG(hw, IXGBE_AUTOC2, autoc2);
  783. }
  784. }
  785. /*
  786. * Store MAC address from RAR0, clear receive address registers, and
  787. * clear the multicast table. Also reset num_rar_entries to 128,
  788. * since we modify this value when programming the SAN MAC address.
  789. */
  790. hw->mac.num_rar_entries = 128;
  791. hw->mac.ops.init_rx_addrs(hw);
  792. /* Store the permanent mac address */
  793. hw->mac.ops.get_mac_addr(hw, hw->mac.perm_addr);
  794. /* Store the permanent SAN mac address */
  795. hw->mac.ops.get_san_mac_addr(hw, hw->mac.san_addr);
  796. /* Add the SAN MAC address to the RAR only if it's a valid address */
  797. if (ixgbe_validate_mac_addr(hw->mac.san_addr) == 0) {
  798. hw->mac.ops.set_rar(hw, hw->mac.num_rar_entries - 1,
  799. hw->mac.san_addr, 0, IXGBE_RAH_AV);
  800. /* Reserve the last RAR for the SAN MAC address */
  801. hw->mac.num_rar_entries--;
  802. }
  803. reset_hw_out:
  804. return status;
  805. }
  806. /**
  807. * ixgbe_clear_vmdq_82599 - Disassociate a VMDq pool index from a rx address
  808. * @hw: pointer to hardware struct
  809. * @rar: receive address register index to disassociate
  810. * @vmdq: VMDq pool index to remove from the rar
  811. **/
  812. s32 ixgbe_clear_vmdq_82599(struct ixgbe_hw *hw, u32 rar, u32 vmdq)
  813. {
  814. u32 mpsar_lo, mpsar_hi;
  815. u32 rar_entries = hw->mac.num_rar_entries;
  816. if (rar < rar_entries) {
  817. mpsar_lo = IXGBE_READ_REG(hw, IXGBE_MPSAR_LO(rar));
  818. mpsar_hi = IXGBE_READ_REG(hw, IXGBE_MPSAR_HI(rar));
  819. if (!mpsar_lo && !mpsar_hi)
  820. goto done;
  821. if (vmdq == IXGBE_CLEAR_VMDQ_ALL) {
  822. if (mpsar_lo) {
  823. IXGBE_WRITE_REG(hw, IXGBE_MPSAR_LO(rar), 0);
  824. mpsar_lo = 0;
  825. }
  826. if (mpsar_hi) {
  827. IXGBE_WRITE_REG(hw, IXGBE_MPSAR_HI(rar), 0);
  828. mpsar_hi = 0;
  829. }
  830. } else if (vmdq < 32) {
  831. mpsar_lo &= ~(1 << vmdq);
  832. IXGBE_WRITE_REG(hw, IXGBE_MPSAR_LO(rar), mpsar_lo);
  833. } else {
  834. mpsar_hi &= ~(1 << (vmdq - 32));
  835. IXGBE_WRITE_REG(hw, IXGBE_MPSAR_HI(rar), mpsar_hi);
  836. }
  837. /* was that the last pool using this rar? */
  838. if (mpsar_lo == 0 && mpsar_hi == 0 && rar != 0)
  839. hw->mac.ops.clear_rar(hw, rar);
  840. } else {
  841. hw_dbg(hw, "RAR index %d is out of range.\n", rar);
  842. }
  843. done:
  844. return 0;
  845. }
  846. /**
  847. * ixgbe_set_vmdq_82599 - Associate a VMDq pool index with a rx address
  848. * @hw: pointer to hardware struct
  849. * @rar: receive address register index to associate with a VMDq index
  850. * @vmdq: VMDq pool index
  851. **/
  852. s32 ixgbe_set_vmdq_82599(struct ixgbe_hw *hw, u32 rar, u32 vmdq)
  853. {
  854. u32 mpsar;
  855. u32 rar_entries = hw->mac.num_rar_entries;
  856. if (rar < rar_entries) {
  857. if (vmdq < 32) {
  858. mpsar = IXGBE_READ_REG(hw, IXGBE_MPSAR_LO(rar));
  859. mpsar |= 1 << vmdq;
  860. IXGBE_WRITE_REG(hw, IXGBE_MPSAR_LO(rar), mpsar);
  861. } else {
  862. mpsar = IXGBE_READ_REG(hw, IXGBE_MPSAR_HI(rar));
  863. mpsar |= 1 << (vmdq - 32);
  864. IXGBE_WRITE_REG(hw, IXGBE_MPSAR_HI(rar), mpsar);
  865. }
  866. } else {
  867. hw_dbg(hw, "RAR index %d is out of range.\n", rar);
  868. }
  869. return 0;
  870. }
  871. /**
  872. * ixgbe_set_vfta_82599 - Set VLAN filter table
  873. * @hw: pointer to hardware structure
  874. * @vlan: VLAN id to write to VLAN filter
  875. * @vind: VMDq output index that maps queue to VLAN id in VFVFB
  876. * @vlan_on: boolean flag to turn on/off VLAN in VFVF
  877. *
  878. * Turn on/off specified VLAN in the VLAN filter table.
  879. **/
  880. s32 ixgbe_set_vfta_82599(struct ixgbe_hw *hw, u32 vlan, u32 vind,
  881. bool vlan_on)
  882. {
  883. u32 regindex;
  884. u32 bitindex;
  885. u32 bits;
  886. u32 first_empty_slot;
  887. if (vlan > 4095)
  888. return IXGBE_ERR_PARAM;
  889. /*
  890. * this is a 2 part operation - first the VFTA, then the
  891. * VLVF and VLVFB if vind is set
  892. */
  893. /* Part 1
  894. * The VFTA is a bitstring made up of 128 32-bit registers
  895. * that enable the particular VLAN id, much like the MTA:
  896. * bits[11-5]: which register
  897. * bits[4-0]: which bit in the register
  898. */
  899. regindex = (vlan >> 5) & 0x7F;
  900. bitindex = vlan & 0x1F;
  901. bits = IXGBE_READ_REG(hw, IXGBE_VFTA(regindex));
  902. if (vlan_on)
  903. bits |= (1 << bitindex);
  904. else
  905. bits &= ~(1 << bitindex);
  906. IXGBE_WRITE_REG(hw, IXGBE_VFTA(regindex), bits);
  907. /* Part 2
  908. * If the vind is set
  909. * Either vlan_on
  910. * make sure the vlan is in VLVF
  911. * set the vind bit in the matching VLVFB
  912. * Or !vlan_on
  913. * clear the pool bit and possibly the vind
  914. */
  915. if (vind) {
  916. /* find the vlanid or the first empty slot */
  917. first_empty_slot = 0;
  918. for (regindex = 1; regindex < IXGBE_VLVF_ENTRIES; regindex++) {
  919. bits = IXGBE_READ_REG(hw, IXGBE_VLVF(regindex));
  920. if (!bits && !first_empty_slot)
  921. first_empty_slot = regindex;
  922. else if ((bits & 0x0FFF) == vlan)
  923. break;
  924. }
  925. if (regindex >= IXGBE_VLVF_ENTRIES) {
  926. if (first_empty_slot)
  927. regindex = first_empty_slot;
  928. else {
  929. hw_dbg(hw, "No space in VLVF.\n");
  930. goto out;
  931. }
  932. }
  933. if (vlan_on) {
  934. /* set the pool bit */
  935. if (vind < 32) {
  936. bits = IXGBE_READ_REG(hw,
  937. IXGBE_VLVFB(regindex * 2));
  938. bits |= (1 << vind);
  939. IXGBE_WRITE_REG(hw,
  940. IXGBE_VLVFB(regindex * 2), bits);
  941. } else {
  942. bits = IXGBE_READ_REG(hw,
  943. IXGBE_VLVFB((regindex * 2) + 1));
  944. bits |= (1 << vind);
  945. IXGBE_WRITE_REG(hw,
  946. IXGBE_VLVFB((regindex * 2) + 1), bits);
  947. }
  948. } else {
  949. /* clear the pool bit */
  950. if (vind < 32) {
  951. bits = IXGBE_READ_REG(hw,
  952. IXGBE_VLVFB(regindex * 2));
  953. bits &= ~(1 << vind);
  954. IXGBE_WRITE_REG(hw,
  955. IXGBE_VLVFB(regindex * 2), bits);
  956. bits |= IXGBE_READ_REG(hw,
  957. IXGBE_VLVFB((regindex * 2) + 1));
  958. } else {
  959. bits = IXGBE_READ_REG(hw,
  960. IXGBE_VLVFB((regindex * 2) + 1));
  961. bits &= ~(1 << vind);
  962. IXGBE_WRITE_REG(hw,
  963. IXGBE_VLVFB((regindex * 2) + 1), bits);
  964. bits |= IXGBE_READ_REG(hw,
  965. IXGBE_VLVFB(regindex * 2));
  966. }
  967. }
  968. if (bits)
  969. IXGBE_WRITE_REG(hw, IXGBE_VLVF(regindex),
  970. (IXGBE_VLVF_VIEN | vlan));
  971. else
  972. IXGBE_WRITE_REG(hw, IXGBE_VLVF(regindex), 0);
  973. }
  974. out:
  975. return 0;
  976. }
  977. /**
  978. * ixgbe_clear_vfta_82599 - Clear VLAN filter table
  979. * @hw: pointer to hardware structure
  980. *
  981. * Clears the VLAN filer table, and the VMDq index associated with the filter
  982. **/
  983. s32 ixgbe_clear_vfta_82599(struct ixgbe_hw *hw)
  984. {
  985. u32 offset;
  986. for (offset = 0; offset < hw->mac.vft_size; offset++)
  987. IXGBE_WRITE_REG(hw, IXGBE_VFTA(offset), 0);
  988. for (offset = 0; offset < IXGBE_VLVF_ENTRIES; offset++) {
  989. IXGBE_WRITE_REG(hw, IXGBE_VLVF(offset), 0);
  990. IXGBE_WRITE_REG(hw, IXGBE_VLVFB(offset * 2), 0);
  991. IXGBE_WRITE_REG(hw, IXGBE_VLVFB((offset * 2) + 1), 0);
  992. }
  993. return 0;
  994. }
  995. /**
  996. * ixgbe_init_uta_tables_82599 - Initialize the Unicast Table Array
  997. * @hw: pointer to hardware structure
  998. **/
  999. s32 ixgbe_init_uta_tables_82599(struct ixgbe_hw *hw)
  1000. {
  1001. int i;
  1002. hw_dbg(hw, " Clearing UTA\n");
  1003. for (i = 0; i < 128; i++)
  1004. IXGBE_WRITE_REG(hw, IXGBE_UTA(i), 0);
  1005. return 0;
  1006. }
  1007. /**
  1008. * ixgbe_read_analog_reg8_82599 - Reads 8 bit Omer analog register
  1009. * @hw: pointer to hardware structure
  1010. * @reg: analog register to read
  1011. * @val: read value
  1012. *
  1013. * Performs read operation to Omer analog register specified.
  1014. **/
  1015. s32 ixgbe_read_analog_reg8_82599(struct ixgbe_hw *hw, u32 reg, u8 *val)
  1016. {
  1017. u32 core_ctl;
  1018. IXGBE_WRITE_REG(hw, IXGBE_CORECTL, IXGBE_CORECTL_WRITE_CMD |
  1019. (reg << 8));
  1020. IXGBE_WRITE_FLUSH(hw);
  1021. udelay(10);
  1022. core_ctl = IXGBE_READ_REG(hw, IXGBE_CORECTL);
  1023. *val = (u8)core_ctl;
  1024. return 0;
  1025. }
  1026. /**
  1027. * ixgbe_write_analog_reg8_82599 - Writes 8 bit Omer analog register
  1028. * @hw: pointer to hardware structure
  1029. * @reg: atlas register to write
  1030. * @val: value to write
  1031. *
  1032. * Performs write operation to Omer analog register specified.
  1033. **/
  1034. s32 ixgbe_write_analog_reg8_82599(struct ixgbe_hw *hw, u32 reg, u8 val)
  1035. {
  1036. u32 core_ctl;
  1037. core_ctl = (reg << 8) | val;
  1038. IXGBE_WRITE_REG(hw, IXGBE_CORECTL, core_ctl);
  1039. IXGBE_WRITE_FLUSH(hw);
  1040. udelay(10);
  1041. return 0;
  1042. }
  1043. /**
  1044. * ixgbe_start_hw_82599 - Prepare hardware for Tx/Rx
  1045. * @hw: pointer to hardware structure
  1046. *
  1047. * Starts the hardware using the generic start_hw function.
  1048. * Then performs device-specific:
  1049. * Clears the rate limiter registers.
  1050. **/
  1051. s32 ixgbe_start_hw_82599(struct ixgbe_hw *hw)
  1052. {
  1053. u32 q_num;
  1054. ixgbe_start_hw_generic(hw);
  1055. /* Clear the rate limiters */
  1056. for (q_num = 0; q_num < hw->mac.max_tx_queues; q_num++) {
  1057. IXGBE_WRITE_REG(hw, IXGBE_RTTDQSEL, q_num);
  1058. IXGBE_WRITE_REG(hw, IXGBE_RTTBCNRC, 0);
  1059. }
  1060. IXGBE_WRITE_FLUSH(hw);
  1061. /* We need to run link autotry after the driver loads */
  1062. hw->mac.autotry_restart = true;
  1063. return 0;
  1064. }
  1065. /**
  1066. * ixgbe_identify_phy_82599 - Get physical layer module
  1067. * @hw: pointer to hardware structure
  1068. *
  1069. * Determines the physical layer module found on the current adapter.
  1070. **/
  1071. s32 ixgbe_identify_phy_82599(struct ixgbe_hw *hw)
  1072. {
  1073. s32 status = IXGBE_ERR_PHY_ADDR_INVALID;
  1074. status = ixgbe_identify_phy_generic(hw);
  1075. if (status != 0)
  1076. status = ixgbe_identify_sfp_module_generic(hw);
  1077. return status;
  1078. }
  1079. /**
  1080. * ixgbe_get_supported_physical_layer_82599 - Returns physical layer type
  1081. * @hw: pointer to hardware structure
  1082. *
  1083. * Determines physical layer capabilities of the current configuration.
  1084. **/
  1085. u32 ixgbe_get_supported_physical_layer_82599(struct ixgbe_hw *hw)
  1086. {
  1087. u32 physical_layer = IXGBE_PHYSICAL_LAYER_UNKNOWN;
  1088. u32 autoc = IXGBE_READ_REG(hw, IXGBE_AUTOC);
  1089. u32 autoc2 = IXGBE_READ_REG(hw, IXGBE_AUTOC2);
  1090. u32 pma_pmd_10g_serial = autoc2 & IXGBE_AUTOC2_10G_SERIAL_PMA_PMD_MASK;
  1091. u32 pma_pmd_10g_parallel = autoc & IXGBE_AUTOC_10G_PMA_PMD_MASK;
  1092. u32 pma_pmd_1g = autoc & IXGBE_AUTOC_1G_PMA_PMD_MASK;
  1093. u16 ext_ability = 0;
  1094. u8 comp_codes_10g = 0;
  1095. hw->phy.ops.identify(hw);
  1096. if (hw->phy.type == ixgbe_phy_tn ||
  1097. hw->phy.type == ixgbe_phy_cu_unknown) {
  1098. hw->phy.ops.read_reg(hw, MDIO_PMA_EXTABLE, MDIO_MMD_PMAPMD,
  1099. &ext_ability);
  1100. if (ext_ability & MDIO_PMA_EXTABLE_10GBT)
  1101. physical_layer |= IXGBE_PHYSICAL_LAYER_10GBASE_T;
  1102. if (ext_ability & MDIO_PMA_EXTABLE_1000BT)
  1103. physical_layer |= IXGBE_PHYSICAL_LAYER_1000BASE_T;
  1104. if (ext_ability & MDIO_PMA_EXTABLE_100BTX)
  1105. physical_layer |= IXGBE_PHYSICAL_LAYER_100BASE_TX;
  1106. goto out;
  1107. }
  1108. switch (autoc & IXGBE_AUTOC_LMS_MASK) {
  1109. case IXGBE_AUTOC_LMS_1G_AN:
  1110. case IXGBE_AUTOC_LMS_1G_LINK_NO_AN:
  1111. if (pma_pmd_1g == IXGBE_AUTOC_1G_KX_BX) {
  1112. physical_layer = IXGBE_PHYSICAL_LAYER_1000BASE_KX |
  1113. IXGBE_PHYSICAL_LAYER_1000BASE_BX;
  1114. goto out;
  1115. } else
  1116. /* SFI mode so read SFP module */
  1117. goto sfp_check;
  1118. break;
  1119. case IXGBE_AUTOC_LMS_10G_LINK_NO_AN:
  1120. if (pma_pmd_10g_parallel == IXGBE_AUTOC_10G_CX4)
  1121. physical_layer = IXGBE_PHYSICAL_LAYER_10GBASE_CX4;
  1122. else if (pma_pmd_10g_parallel == IXGBE_AUTOC_10G_KX4)
  1123. physical_layer = IXGBE_PHYSICAL_LAYER_10GBASE_KX4;
  1124. else if (pma_pmd_10g_parallel == IXGBE_AUTOC_10G_XAUI)
  1125. physical_layer = IXGBE_PHYSICAL_LAYER_10GBASE_XAUI;
  1126. goto out;
  1127. break;
  1128. case IXGBE_AUTOC_LMS_10G_SERIAL:
  1129. if (pma_pmd_10g_serial == IXGBE_AUTOC2_10G_KR) {
  1130. physical_layer = IXGBE_PHYSICAL_LAYER_10GBASE_KR;
  1131. goto out;
  1132. } else if (pma_pmd_10g_serial == IXGBE_AUTOC2_10G_SFI)
  1133. goto sfp_check;
  1134. break;
  1135. case IXGBE_AUTOC_LMS_KX4_KX_KR:
  1136. case IXGBE_AUTOC_LMS_KX4_KX_KR_1G_AN:
  1137. if (autoc & IXGBE_AUTOC_KX_SUPP)
  1138. physical_layer |= IXGBE_PHYSICAL_LAYER_1000BASE_KX;
  1139. if (autoc & IXGBE_AUTOC_KX4_SUPP)
  1140. physical_layer |= IXGBE_PHYSICAL_LAYER_10GBASE_KX4;
  1141. if (autoc & IXGBE_AUTOC_KR_SUPP)
  1142. physical_layer |= IXGBE_PHYSICAL_LAYER_10GBASE_KR;
  1143. goto out;
  1144. break;
  1145. default:
  1146. goto out;
  1147. break;
  1148. }
  1149. sfp_check:
  1150. /* SFP check must be done last since DA modules are sometimes used to
  1151. * test KR mode - we need to id KR mode correctly before SFP module.
  1152. * Call identify_sfp because the pluggable module may have changed */
  1153. hw->phy.ops.identify_sfp(hw);
  1154. if (hw->phy.sfp_type == ixgbe_sfp_type_not_present)
  1155. goto out;
  1156. switch (hw->phy.type) {
  1157. case ixgbe_phy_tw_tyco:
  1158. case ixgbe_phy_tw_unknown:
  1159. physical_layer = IXGBE_PHYSICAL_LAYER_SFP_PLUS_CU;
  1160. break;
  1161. case ixgbe_phy_sfp_avago:
  1162. case ixgbe_phy_sfp_ftl:
  1163. case ixgbe_phy_sfp_intel:
  1164. case ixgbe_phy_sfp_unknown:
  1165. hw->phy.ops.read_i2c_eeprom(hw,
  1166. IXGBE_SFF_10GBE_COMP_CODES, &comp_codes_10g);
  1167. if (comp_codes_10g & IXGBE_SFF_10GBASESR_CAPABLE)
  1168. physical_layer = IXGBE_PHYSICAL_LAYER_10GBASE_SR;
  1169. else if (comp_codes_10g & IXGBE_SFF_10GBASELR_CAPABLE)
  1170. physical_layer = IXGBE_PHYSICAL_LAYER_10GBASE_LR;
  1171. break;
  1172. default:
  1173. break;
  1174. }
  1175. out:
  1176. return physical_layer;
  1177. }
  1178. /**
  1179. * ixgbe_enable_rx_dma_82599 - Enable the Rx DMA unit on 82599
  1180. * @hw: pointer to hardware structure
  1181. * @regval: register value to write to RXCTRL
  1182. *
  1183. * Enables the Rx DMA unit for 82599
  1184. **/
  1185. s32 ixgbe_enable_rx_dma_82599(struct ixgbe_hw *hw, u32 regval)
  1186. {
  1187. #define IXGBE_MAX_SECRX_POLL 30
  1188. int i;
  1189. int secrxreg;
  1190. /*
  1191. * Workaround for 82599 silicon errata when enabling the Rx datapath.
  1192. * If traffic is incoming before we enable the Rx unit, it could hang
  1193. * the Rx DMA unit. Therefore, make sure the security engine is
  1194. * completely disabled prior to enabling the Rx unit.
  1195. */
  1196. secrxreg = IXGBE_READ_REG(hw, IXGBE_SECRXCTRL);
  1197. secrxreg |= IXGBE_SECRXCTRL_RX_DIS;
  1198. IXGBE_WRITE_REG(hw, IXGBE_SECRXCTRL, secrxreg);
  1199. for (i = 0; i < IXGBE_MAX_SECRX_POLL; i++) {
  1200. secrxreg = IXGBE_READ_REG(hw, IXGBE_SECRXSTAT);
  1201. if (secrxreg & IXGBE_SECRXSTAT_SECRX_RDY)
  1202. break;
  1203. else
  1204. udelay(10);
  1205. }
  1206. /* For informational purposes only */
  1207. if (i >= IXGBE_MAX_SECRX_POLL)
  1208. hw_dbg(hw, "Rx unit being enabled before security "
  1209. "path fully disabled. Continuing with init.\n");
  1210. IXGBE_WRITE_REG(hw, IXGBE_RXCTRL, regval);
  1211. secrxreg = IXGBE_READ_REG(hw, IXGBE_SECRXCTRL);
  1212. secrxreg &= ~IXGBE_SECRXCTRL_RX_DIS;
  1213. IXGBE_WRITE_REG(hw, IXGBE_SECRXCTRL, secrxreg);
  1214. IXGBE_WRITE_FLUSH(hw);
  1215. return 0;
  1216. }
  1217. /**
  1218. * ixgbe_get_device_caps_82599 - Get additional device capabilities
  1219. * @hw: pointer to hardware structure
  1220. * @device_caps: the EEPROM word with the extra device capabilities
  1221. *
  1222. * This function will read the EEPROM location for the device capabilities,
  1223. * and return the word through device_caps.
  1224. **/
  1225. s32 ixgbe_get_device_caps_82599(struct ixgbe_hw *hw, u16 *device_caps)
  1226. {
  1227. hw->eeprom.ops.read(hw, IXGBE_DEVICE_CAPS, device_caps);
  1228. return 0;
  1229. }
  1230. /**
  1231. * ixgbe_get_san_mac_addr_offset_82599 - SAN MAC address offset for 82599
  1232. * @hw: pointer to hardware structure
  1233. * @san_mac_offset: SAN MAC address offset
  1234. *
  1235. * This function will read the EEPROM location for the SAN MAC address
  1236. * pointer, and returns the value at that location. This is used in both
  1237. * get and set mac_addr routines.
  1238. **/
  1239. s32 ixgbe_get_san_mac_addr_offset_82599(struct ixgbe_hw *hw,
  1240. u16 *san_mac_offset)
  1241. {
  1242. /*
  1243. * First read the EEPROM pointer to see if the MAC addresses are
  1244. * available.
  1245. */
  1246. hw->eeprom.ops.read(hw, IXGBE_SAN_MAC_ADDR_PTR, san_mac_offset);
  1247. return 0;
  1248. }
  1249. /**
  1250. * ixgbe_get_san_mac_addr_82599 - SAN MAC address retrieval for 82599
  1251. * @hw: pointer to hardware structure
  1252. * @san_mac_addr: SAN MAC address
  1253. *
  1254. * Reads the SAN MAC address from the EEPROM, if it's available. This is
  1255. * per-port, so set_lan_id() must be called before reading the addresses.
  1256. * set_lan_id() is called by identify_sfp(), but this cannot be relied
  1257. * upon for non-SFP connections, so we must call it here.
  1258. **/
  1259. s32 ixgbe_get_san_mac_addr_82599(struct ixgbe_hw *hw, u8 *san_mac_addr)
  1260. {
  1261. u16 san_mac_data, san_mac_offset;
  1262. u8 i;
  1263. /*
  1264. * First read the EEPROM pointer to see if the MAC addresses are
  1265. * available. If they're not, no point in calling set_lan_id() here.
  1266. */
  1267. ixgbe_get_san_mac_addr_offset_82599(hw, &san_mac_offset);
  1268. if ((san_mac_offset == 0) || (san_mac_offset == 0xFFFF)) {
  1269. /*
  1270. * No addresses available in this EEPROM. It's not an
  1271. * error though, so just wipe the local address and return.
  1272. */
  1273. for (i = 0; i < 6; i++)
  1274. san_mac_addr[i] = 0xFF;
  1275. goto san_mac_addr_out;
  1276. }
  1277. /* make sure we know which port we need to program */
  1278. hw->mac.ops.set_lan_id(hw);
  1279. /* apply the port offset to the address offset */
  1280. (hw->bus.func) ? (san_mac_offset += IXGBE_SAN_MAC_ADDR_PORT1_OFFSET) :
  1281. (san_mac_offset += IXGBE_SAN_MAC_ADDR_PORT0_OFFSET);
  1282. for (i = 0; i < 3; i++) {
  1283. hw->eeprom.ops.read(hw, san_mac_offset, &san_mac_data);
  1284. san_mac_addr[i * 2] = (u8)(san_mac_data);
  1285. san_mac_addr[i * 2 + 1] = (u8)(san_mac_data >> 8);
  1286. san_mac_offset++;
  1287. }
  1288. san_mac_addr_out:
  1289. return 0;
  1290. }
  1291. static struct ixgbe_mac_operations mac_ops_82599 = {
  1292. .init_hw = &ixgbe_init_hw_generic,
  1293. .reset_hw = &ixgbe_reset_hw_82599,
  1294. .start_hw = &ixgbe_start_hw_82599,
  1295. .clear_hw_cntrs = &ixgbe_clear_hw_cntrs_generic,
  1296. .get_media_type = &ixgbe_get_media_type_82599,
  1297. .get_supported_physical_layer = &ixgbe_get_supported_physical_layer_82599,
  1298. .enable_rx_dma = &ixgbe_enable_rx_dma_82599,
  1299. .get_mac_addr = &ixgbe_get_mac_addr_generic,
  1300. .get_san_mac_addr = &ixgbe_get_san_mac_addr_82599,
  1301. .get_device_caps = &ixgbe_get_device_caps_82599,
  1302. .stop_adapter = &ixgbe_stop_adapter_generic,
  1303. .get_bus_info = &ixgbe_get_bus_info_generic,
  1304. .set_lan_id = &ixgbe_set_lan_id_multi_port_pcie,
  1305. .read_analog_reg8 = &ixgbe_read_analog_reg8_82599,
  1306. .write_analog_reg8 = &ixgbe_write_analog_reg8_82599,
  1307. .setup_link = &ixgbe_setup_mac_link_82599,
  1308. .setup_link_speed = &ixgbe_setup_mac_link_speed_82599,
  1309. .check_link = &ixgbe_check_mac_link_82599,
  1310. .get_link_capabilities = &ixgbe_get_link_capabilities_82599,
  1311. .led_on = &ixgbe_led_on_generic,
  1312. .led_off = &ixgbe_led_off_generic,
  1313. .blink_led_start = &ixgbe_blink_led_start_generic,
  1314. .blink_led_stop = &ixgbe_blink_led_stop_generic,
  1315. .set_rar = &ixgbe_set_rar_generic,
  1316. .clear_rar = &ixgbe_clear_rar_generic,
  1317. .set_vmdq = &ixgbe_set_vmdq_82599,
  1318. .clear_vmdq = &ixgbe_clear_vmdq_82599,
  1319. .init_rx_addrs = &ixgbe_init_rx_addrs_generic,
  1320. .update_uc_addr_list = &ixgbe_update_uc_addr_list_generic,
  1321. .update_mc_addr_list = &ixgbe_update_mc_addr_list_generic,
  1322. .enable_mc = &ixgbe_enable_mc_generic,
  1323. .disable_mc = &ixgbe_disable_mc_generic,
  1324. .clear_vfta = &ixgbe_clear_vfta_82599,
  1325. .set_vfta = &ixgbe_set_vfta_82599,
  1326. .fc_enable = &ixgbe_fc_enable_generic,
  1327. .init_uta_tables = &ixgbe_init_uta_tables_82599,
  1328. .setup_sfp = &ixgbe_setup_sfp_modules_82599,
  1329. };
  1330. static struct ixgbe_eeprom_operations eeprom_ops_82599 = {
  1331. .init_params = &ixgbe_init_eeprom_params_generic,
  1332. .read = &ixgbe_read_eeprom_generic,
  1333. .write = &ixgbe_write_eeprom_generic,
  1334. .validate_checksum = &ixgbe_validate_eeprom_checksum_generic,
  1335. .update_checksum = &ixgbe_update_eeprom_checksum_generic,
  1336. };
  1337. static struct ixgbe_phy_operations phy_ops_82599 = {
  1338. .identify = &ixgbe_identify_phy_82599,
  1339. .identify_sfp = &ixgbe_identify_sfp_module_generic,
  1340. .init = &ixgbe_init_phy_ops_82599,
  1341. .reset = &ixgbe_reset_phy_generic,
  1342. .read_reg = &ixgbe_read_phy_reg_generic,
  1343. .write_reg = &ixgbe_write_phy_reg_generic,
  1344. .setup_link = &ixgbe_setup_phy_link_generic,
  1345. .setup_link_speed = &ixgbe_setup_phy_link_speed_generic,
  1346. .read_i2c_byte = &ixgbe_read_i2c_byte_generic,
  1347. .write_i2c_byte = &ixgbe_write_i2c_byte_generic,
  1348. .read_i2c_eeprom = &ixgbe_read_i2c_eeprom_generic,
  1349. .write_i2c_eeprom = &ixgbe_write_i2c_eeprom_generic,
  1350. };
  1351. struct ixgbe_info ixgbe_82599_info = {
  1352. .mac = ixgbe_mac_82599EB,
  1353. .get_invariants = &ixgbe_get_invariants_82599,
  1354. .mac_ops = &mac_ops_82599,
  1355. .eeprom_ops = &eeprom_ops_82599,
  1356. .phy_ops = &phy_ops_82599,
  1357. };