ixgbe_82598.c 34 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071727374757677787980818283848586878889909192939495969798991001011021031041051061071081091101111121131141151161171181191201211221231241251261271281291301311321331341351361371381391401411421431441451461471481491501511521531541551561571581591601611621631641651661671681691701711721731741751761771781791801811821831841851861871881891901911921931941951961971981992002012022032042052062072082092102112122132142152162172182192202212222232242252262272282292302312322332342352362372382392402412422432442452462472482492502512522532542552562572582592602612622632642652662672682692702712722732742752762772782792802812822832842852862872882892902912922932942952962972982993003013023033043053063073083093103113123133143153163173183193203213223233243253263273283293303313323333343353363373383393403413423433443453463473483493503513523533543553563573583593603613623633643653663673683693703713723733743753763773783793803813823833843853863873883893903913923933943953963973983994004014024034044054064074084094104114124134144154164174184194204214224234244254264274284294304314324334344354364374384394404414424434444454464474484494504514524534544554564574584594604614624634644654664674684694704714724734744754764774784794804814824834844854864874884894904914924934944954964974984995005015025035045055065075085095105115125135145155165175185195205215225235245255265275285295305315325335345355365375385395405415425435445455465475485495505515525535545555565575585595605615625635645655665675685695705715725735745755765775785795805815825835845855865875885895905915925935945955965975985996006016026036046056066076086096106116126136146156166176186196206216226236246256266276286296306316326336346356366376386396406416426436446456466476486496506516526536546556566576586596606616626636646656666676686696706716726736746756766776786796806816826836846856866876886896906916926936946956966976986997007017027037047057067077087097107117127137147157167177187197207217227237247257267277287297307317327337347357367377387397407417427437447457467477487497507517527537547557567577587597607617627637647657667677687697707717727737747757767777787797807817827837847857867877887897907917927937947957967977987998008018028038048058068078088098108118128138148158168178188198208218228238248258268278288298308318328338348358368378388398408418428438448458468478488498508518528538548558568578588598608618628638648658668678688698708718728738748758768778788798808818828838848858868878888898908918928938948958968978988999009019029039049059069079089099109119129139149159169179189199209219229239249259269279289299309319329339349359369379389399409419429439449459469479489499509519529539549559569579589599609619629639649659669679689699709719729739749759769779789799809819829839849859869879889899909919929939949959969979989991000100110021003100410051006100710081009101010111012101310141015101610171018101910201021102210231024102510261027102810291030103110321033103410351036103710381039104010411042104310441045104610471048104910501051105210531054105510561057105810591060106110621063106410651066106710681069107010711072107310741075107610771078107910801081108210831084108510861087108810891090109110921093109410951096109710981099110011011102110311041105110611071108110911101111111211131114111511161117111811191120112111221123112411251126112711281129113011311132113311341135113611371138113911401141114211431144114511461147
  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_82598_MAX_TX_QUEUES 32
  26. #define IXGBE_82598_MAX_RX_QUEUES 64
  27. #define IXGBE_82598_RAR_ENTRIES 16
  28. #define IXGBE_82598_MC_TBL_SIZE 128
  29. #define IXGBE_82598_VFT_TBL_SIZE 128
  30. static s32 ixgbe_get_copper_link_capabilities_82598(struct ixgbe_hw *hw,
  31. ixgbe_link_speed *speed,
  32. bool *autoneg);
  33. static s32 ixgbe_setup_copper_link_82598(struct ixgbe_hw *hw);
  34. static s32 ixgbe_setup_copper_link_speed_82598(struct ixgbe_hw *hw,
  35. ixgbe_link_speed speed,
  36. bool autoneg,
  37. bool autoneg_wait_to_complete);
  38. static s32 ixgbe_read_i2c_eeprom_82598(struct ixgbe_hw *hw, u8 byte_offset,
  39. u8 *eeprom_data);
  40. /**
  41. * ixgbe_get_pcie_msix_count_82598 - Gets MSI-X vector count
  42. * @hw: pointer to hardware structure
  43. *
  44. * Read PCIe configuration space, and get the MSI-X vector count from
  45. * the capabilities table.
  46. **/
  47. static u16 ixgbe_get_pcie_msix_count_82598(struct ixgbe_hw *hw)
  48. {
  49. struct ixgbe_adapter *adapter = hw->back;
  50. u16 msix_count;
  51. pci_read_config_word(adapter->pdev, IXGBE_PCIE_MSIX_82598_CAPS,
  52. &msix_count);
  53. msix_count &= IXGBE_PCIE_MSIX_TBL_SZ_MASK;
  54. /* MSI-X count is zero-based in HW, so increment to give proper value */
  55. msix_count++;
  56. return msix_count;
  57. }
  58. /**
  59. */
  60. static s32 ixgbe_get_invariants_82598(struct ixgbe_hw *hw)
  61. {
  62. struct ixgbe_mac_info *mac = &hw->mac;
  63. /* Call PHY identify routine to get the phy type */
  64. ixgbe_identify_phy_generic(hw);
  65. mac->mcft_size = IXGBE_82598_MC_TBL_SIZE;
  66. mac->vft_size = IXGBE_82598_VFT_TBL_SIZE;
  67. mac->num_rar_entries = IXGBE_82598_RAR_ENTRIES;
  68. mac->max_rx_queues = IXGBE_82598_MAX_RX_QUEUES;
  69. mac->max_tx_queues = IXGBE_82598_MAX_TX_QUEUES;
  70. mac->max_msix_vectors = ixgbe_get_pcie_msix_count_82598(hw);
  71. return 0;
  72. }
  73. /**
  74. * ixgbe_init_phy_ops_82598 - PHY/SFP specific init
  75. * @hw: pointer to hardware structure
  76. *
  77. * Initialize any function pointers that were not able to be
  78. * set during get_invariants because the PHY/SFP type was
  79. * not known. Perform the SFP init if necessary.
  80. *
  81. **/
  82. s32 ixgbe_init_phy_ops_82598(struct ixgbe_hw *hw)
  83. {
  84. struct ixgbe_mac_info *mac = &hw->mac;
  85. struct ixgbe_phy_info *phy = &hw->phy;
  86. s32 ret_val = 0;
  87. u16 list_offset, data_offset;
  88. /* Identify the PHY */
  89. phy->ops.identify(hw);
  90. /* Overwrite the link function pointers if copper PHY */
  91. if (mac->ops.get_media_type(hw) == ixgbe_media_type_copper) {
  92. mac->ops.setup_link = &ixgbe_setup_copper_link_82598;
  93. mac->ops.setup_link_speed =
  94. &ixgbe_setup_copper_link_speed_82598;
  95. mac->ops.get_link_capabilities =
  96. &ixgbe_get_copper_link_capabilities_82598;
  97. }
  98. switch (hw->phy.type) {
  99. case ixgbe_phy_tn:
  100. phy->ops.check_link = &ixgbe_check_phy_link_tnx;
  101. phy->ops.get_firmware_version =
  102. &ixgbe_get_phy_firmware_version_tnx;
  103. break;
  104. case ixgbe_phy_nl:
  105. phy->ops.reset = &ixgbe_reset_phy_nl;
  106. /* Call SFP+ identify routine to get the SFP+ module type */
  107. ret_val = phy->ops.identify_sfp(hw);
  108. if (ret_val != 0)
  109. goto out;
  110. else if (hw->phy.sfp_type == ixgbe_sfp_type_unknown) {
  111. ret_val = IXGBE_ERR_SFP_NOT_SUPPORTED;
  112. goto out;
  113. }
  114. /* Check to see if SFP+ module is supported */
  115. ret_val = ixgbe_get_sfp_init_sequence_offsets(hw,
  116. &list_offset,
  117. &data_offset);
  118. if (ret_val != 0) {
  119. ret_val = IXGBE_ERR_SFP_NOT_SUPPORTED;
  120. goto out;
  121. }
  122. break;
  123. default:
  124. break;
  125. }
  126. out:
  127. return ret_val;
  128. }
  129. /**
  130. * ixgbe_get_link_capabilities_82598 - Determines link capabilities
  131. * @hw: pointer to hardware structure
  132. * @speed: pointer to link speed
  133. * @autoneg: boolean auto-negotiation value
  134. *
  135. * Determines the link capabilities by reading the AUTOC register.
  136. **/
  137. static s32 ixgbe_get_link_capabilities_82598(struct ixgbe_hw *hw,
  138. ixgbe_link_speed *speed,
  139. bool *autoneg)
  140. {
  141. s32 status = 0;
  142. u32 autoc = 0;
  143. /*
  144. * Determine link capabilities based on the stored value of AUTOC,
  145. * which represents EEPROM defaults. If AUTOC value has not been
  146. * stored, use the current register value.
  147. */
  148. if (hw->mac.orig_link_settings_stored)
  149. autoc = hw->mac.orig_autoc;
  150. else
  151. autoc = IXGBE_READ_REG(hw, IXGBE_AUTOC);
  152. switch (autoc & IXGBE_AUTOC_LMS_MASK) {
  153. case IXGBE_AUTOC_LMS_1G_LINK_NO_AN:
  154. *speed = IXGBE_LINK_SPEED_1GB_FULL;
  155. *autoneg = false;
  156. break;
  157. case IXGBE_AUTOC_LMS_10G_LINK_NO_AN:
  158. *speed = IXGBE_LINK_SPEED_10GB_FULL;
  159. *autoneg = false;
  160. break;
  161. case IXGBE_AUTOC_LMS_1G_AN:
  162. *speed = IXGBE_LINK_SPEED_1GB_FULL;
  163. *autoneg = true;
  164. break;
  165. case IXGBE_AUTOC_LMS_KX4_AN:
  166. case IXGBE_AUTOC_LMS_KX4_AN_1G_AN:
  167. *speed = IXGBE_LINK_SPEED_UNKNOWN;
  168. if (autoc & IXGBE_AUTOC_KX4_SUPP)
  169. *speed |= IXGBE_LINK_SPEED_10GB_FULL;
  170. if (autoc & IXGBE_AUTOC_KX_SUPP)
  171. *speed |= IXGBE_LINK_SPEED_1GB_FULL;
  172. *autoneg = true;
  173. break;
  174. default:
  175. status = IXGBE_ERR_LINK_SETUP;
  176. break;
  177. }
  178. return status;
  179. }
  180. /**
  181. * ixgbe_get_copper_link_capabilities_82598 - Determines link capabilities
  182. * @hw: pointer to hardware structure
  183. * @speed: pointer to link speed
  184. * @autoneg: boolean auto-negotiation value
  185. *
  186. * Determines the link capabilities by reading the AUTOC register.
  187. **/
  188. static s32 ixgbe_get_copper_link_capabilities_82598(struct ixgbe_hw *hw,
  189. ixgbe_link_speed *speed,
  190. bool *autoneg)
  191. {
  192. s32 status = IXGBE_ERR_LINK_SETUP;
  193. u16 speed_ability;
  194. *speed = 0;
  195. *autoneg = true;
  196. status = hw->phy.ops.read_reg(hw, MDIO_SPEED, MDIO_MMD_PMAPMD,
  197. &speed_ability);
  198. if (status == 0) {
  199. if (speed_ability & MDIO_SPEED_10G)
  200. *speed |= IXGBE_LINK_SPEED_10GB_FULL;
  201. if (speed_ability & MDIO_PMA_SPEED_1000)
  202. *speed |= IXGBE_LINK_SPEED_1GB_FULL;
  203. }
  204. return status;
  205. }
  206. /**
  207. * ixgbe_get_media_type_82598 - Determines media type
  208. * @hw: pointer to hardware structure
  209. *
  210. * Returns the media type (fiber, copper, backplane)
  211. **/
  212. static enum ixgbe_media_type ixgbe_get_media_type_82598(struct ixgbe_hw *hw)
  213. {
  214. enum ixgbe_media_type media_type;
  215. /* Media type for I82598 is based on device ID */
  216. switch (hw->device_id) {
  217. case IXGBE_DEV_ID_82598:
  218. case IXGBE_DEV_ID_82598_BX:
  219. media_type = ixgbe_media_type_backplane;
  220. break;
  221. case IXGBE_DEV_ID_82598AF_DUAL_PORT:
  222. case IXGBE_DEV_ID_82598AF_SINGLE_PORT:
  223. case IXGBE_DEV_ID_82598EB_CX4:
  224. case IXGBE_DEV_ID_82598_CX4_DUAL_PORT:
  225. case IXGBE_DEV_ID_82598_DA_DUAL_PORT:
  226. case IXGBE_DEV_ID_82598_SR_DUAL_PORT_EM:
  227. case IXGBE_DEV_ID_82598EB_XF_LR:
  228. case IXGBE_DEV_ID_82598EB_SFP_LOM:
  229. media_type = ixgbe_media_type_fiber;
  230. break;
  231. case IXGBE_DEV_ID_82598AT:
  232. media_type = ixgbe_media_type_copper;
  233. break;
  234. default:
  235. media_type = ixgbe_media_type_unknown;
  236. break;
  237. }
  238. return media_type;
  239. }
  240. /**
  241. * ixgbe_fc_enable_82598 - Enable flow control
  242. * @hw: pointer to hardware structure
  243. * @packetbuf_num: packet buffer number (0-7)
  244. *
  245. * Enable flow control according to the current settings.
  246. **/
  247. static s32 ixgbe_fc_enable_82598(struct ixgbe_hw *hw, s32 packetbuf_num)
  248. {
  249. s32 ret_val = 0;
  250. u32 fctrl_reg;
  251. u32 rmcs_reg;
  252. u32 reg;
  253. #ifdef CONFIG_DCB
  254. if (hw->fc.requested_mode == ixgbe_fc_pfc)
  255. goto out;
  256. #endif /* CONFIG_DCB */
  257. /* Negotiate the fc mode to use */
  258. ret_val = ixgbe_fc_autoneg(hw);
  259. if (ret_val)
  260. goto out;
  261. /* Disable any previous flow control settings */
  262. fctrl_reg = IXGBE_READ_REG(hw, IXGBE_FCTRL);
  263. fctrl_reg &= ~(IXGBE_FCTRL_RFCE | IXGBE_FCTRL_RPFCE);
  264. rmcs_reg = IXGBE_READ_REG(hw, IXGBE_RMCS);
  265. rmcs_reg &= ~(IXGBE_RMCS_TFCE_PRIORITY | IXGBE_RMCS_TFCE_802_3X);
  266. /*
  267. * The possible values of fc.current_mode are:
  268. * 0: Flow control is completely disabled
  269. * 1: Rx flow control is enabled (we can receive pause frames,
  270. * but not send pause frames).
  271. * 2: Tx flow control is enabled (we can send pause frames but
  272. * we do not support receiving pause frames).
  273. * 3: Both Rx and Tx flow control (symmetric) are enabled.
  274. * other: Invalid.
  275. #ifdef CONFIG_DCB
  276. * 4: Priority Flow Control is enabled.
  277. #endif
  278. */
  279. switch (hw->fc.current_mode) {
  280. case ixgbe_fc_none:
  281. /*
  282. * Flow control is disabled by software override or autoneg.
  283. * The code below will actually disable it in the HW.
  284. */
  285. break;
  286. case ixgbe_fc_rx_pause:
  287. /*
  288. * Rx Flow control is enabled and Tx Flow control is
  289. * disabled by software override. Since there really
  290. * isn't a way to advertise that we are capable of RX
  291. * Pause ONLY, we will advertise that we support both
  292. * symmetric and asymmetric Rx PAUSE. Later, we will
  293. * disable the adapter's ability to send PAUSE frames.
  294. */
  295. fctrl_reg |= IXGBE_FCTRL_RFCE;
  296. break;
  297. case ixgbe_fc_tx_pause:
  298. /*
  299. * Tx Flow control is enabled, and Rx Flow control is
  300. * disabled by software override.
  301. */
  302. rmcs_reg |= IXGBE_RMCS_TFCE_802_3X;
  303. break;
  304. case ixgbe_fc_full:
  305. /* Flow control (both Rx and Tx) is enabled by SW override. */
  306. fctrl_reg |= IXGBE_FCTRL_RFCE;
  307. rmcs_reg |= IXGBE_RMCS_TFCE_802_3X;
  308. break;
  309. #ifdef CONFIG_DCB
  310. case ixgbe_fc_pfc:
  311. goto out;
  312. break;
  313. #endif /* CONFIG_DCB */
  314. default:
  315. hw_dbg(hw, "Flow control param set incorrectly\n");
  316. ret_val = -IXGBE_ERR_CONFIG;
  317. goto out;
  318. break;
  319. }
  320. /* Set 802.3x based flow control settings. */
  321. fctrl_reg |= IXGBE_FCTRL_DPF;
  322. IXGBE_WRITE_REG(hw, IXGBE_FCTRL, fctrl_reg);
  323. IXGBE_WRITE_REG(hw, IXGBE_RMCS, rmcs_reg);
  324. /* Set up and enable Rx high/low water mark thresholds, enable XON. */
  325. if (hw->fc.current_mode & ixgbe_fc_tx_pause) {
  326. if (hw->fc.send_xon) {
  327. IXGBE_WRITE_REG(hw, IXGBE_FCRTL(packetbuf_num),
  328. (hw->fc.low_water | IXGBE_FCRTL_XONE));
  329. } else {
  330. IXGBE_WRITE_REG(hw, IXGBE_FCRTL(packetbuf_num),
  331. hw->fc.low_water);
  332. }
  333. IXGBE_WRITE_REG(hw, IXGBE_FCRTH(packetbuf_num),
  334. (hw->fc.high_water | IXGBE_FCRTH_FCEN));
  335. }
  336. /* Configure pause time (2 TCs per register) */
  337. reg = IXGBE_READ_REG(hw, IXGBE_FCTTV(packetbuf_num / 2));
  338. if ((packetbuf_num & 1) == 0)
  339. reg = (reg & 0xFFFF0000) | hw->fc.pause_time;
  340. else
  341. reg = (reg & 0x0000FFFF) | (hw->fc.pause_time << 16);
  342. IXGBE_WRITE_REG(hw, IXGBE_FCTTV(packetbuf_num / 2), reg);
  343. IXGBE_WRITE_REG(hw, IXGBE_FCRTV, (hw->fc.pause_time >> 1));
  344. out:
  345. return ret_val;
  346. }
  347. /**
  348. * ixgbe_setup_mac_link_82598 - Configures MAC link settings
  349. * @hw: pointer to hardware structure
  350. *
  351. * Configures link settings based on values in the ixgbe_hw struct.
  352. * Restarts the link. Performs autonegotiation if needed.
  353. **/
  354. static s32 ixgbe_setup_mac_link_82598(struct ixgbe_hw *hw)
  355. {
  356. u32 autoc_reg;
  357. u32 links_reg;
  358. u32 i;
  359. s32 status = 0;
  360. /* Restart link */
  361. autoc_reg = IXGBE_READ_REG(hw, IXGBE_AUTOC);
  362. autoc_reg |= IXGBE_AUTOC_AN_RESTART;
  363. IXGBE_WRITE_REG(hw, IXGBE_AUTOC, autoc_reg);
  364. /* Only poll for autoneg to complete if specified to do so */
  365. if (hw->phy.autoneg_wait_to_complete) {
  366. if ((autoc_reg & IXGBE_AUTOC_LMS_MASK) ==
  367. IXGBE_AUTOC_LMS_KX4_AN ||
  368. (autoc_reg & IXGBE_AUTOC_LMS_MASK) ==
  369. IXGBE_AUTOC_LMS_KX4_AN_1G_AN) {
  370. links_reg = 0; /* Just in case Autoneg time = 0 */
  371. for (i = 0; i < IXGBE_AUTO_NEG_TIME; i++) {
  372. links_reg = IXGBE_READ_REG(hw, IXGBE_LINKS);
  373. if (links_reg & IXGBE_LINKS_KX_AN_COMP)
  374. break;
  375. msleep(100);
  376. }
  377. if (!(links_reg & IXGBE_LINKS_KX_AN_COMP)) {
  378. status = IXGBE_ERR_AUTONEG_NOT_COMPLETE;
  379. hw_dbg(hw, "Autonegotiation did not complete.\n");
  380. }
  381. }
  382. }
  383. /* Add delay to filter out noises during initial link setup */
  384. msleep(50);
  385. return status;
  386. }
  387. /**
  388. * ixgbe_check_mac_link_82598 - Get link/speed status
  389. * @hw: pointer to hardware structure
  390. * @speed: pointer to link speed
  391. * @link_up: true is link is up, false otherwise
  392. * @link_up_wait_to_complete: bool used to wait for link up or not
  393. *
  394. * Reads the links register to determine if link is up and the current speed
  395. **/
  396. static s32 ixgbe_check_mac_link_82598(struct ixgbe_hw *hw,
  397. ixgbe_link_speed *speed, bool *link_up,
  398. bool link_up_wait_to_complete)
  399. {
  400. u32 links_reg;
  401. u32 i;
  402. u16 link_reg, adapt_comp_reg;
  403. /*
  404. * SERDES PHY requires us to read link status from register 0xC79F.
  405. * Bit 0 set indicates link is up/ready; clear indicates link down.
  406. * 0xC00C is read to check that the XAUI lanes are active. Bit 0
  407. * clear indicates active; set indicates inactive.
  408. */
  409. if (hw->phy.type == ixgbe_phy_nl) {
  410. hw->phy.ops.read_reg(hw, 0xC79F, MDIO_MMD_PMAPMD, &link_reg);
  411. hw->phy.ops.read_reg(hw, 0xC79F, MDIO_MMD_PMAPMD, &link_reg);
  412. hw->phy.ops.read_reg(hw, 0xC00C, MDIO_MMD_PMAPMD,
  413. &adapt_comp_reg);
  414. if (link_up_wait_to_complete) {
  415. for (i = 0; i < IXGBE_LINK_UP_TIME; i++) {
  416. if ((link_reg & 1) &&
  417. ((adapt_comp_reg & 1) == 0)) {
  418. *link_up = true;
  419. break;
  420. } else {
  421. *link_up = false;
  422. }
  423. msleep(100);
  424. hw->phy.ops.read_reg(hw, 0xC79F,
  425. MDIO_MMD_PMAPMD,
  426. &link_reg);
  427. hw->phy.ops.read_reg(hw, 0xC00C,
  428. MDIO_MMD_PMAPMD,
  429. &adapt_comp_reg);
  430. }
  431. } else {
  432. if ((link_reg & 1) && ((adapt_comp_reg & 1) == 0))
  433. *link_up = true;
  434. else
  435. *link_up = false;
  436. }
  437. if (*link_up == false)
  438. goto out;
  439. }
  440. links_reg = IXGBE_READ_REG(hw, IXGBE_LINKS);
  441. if (link_up_wait_to_complete) {
  442. for (i = 0; i < IXGBE_LINK_UP_TIME; i++) {
  443. if (links_reg & IXGBE_LINKS_UP) {
  444. *link_up = true;
  445. break;
  446. } else {
  447. *link_up = false;
  448. }
  449. msleep(100);
  450. links_reg = IXGBE_READ_REG(hw, IXGBE_LINKS);
  451. }
  452. } else {
  453. if (links_reg & IXGBE_LINKS_UP)
  454. *link_up = true;
  455. else
  456. *link_up = false;
  457. }
  458. if (links_reg & IXGBE_LINKS_SPEED)
  459. *speed = IXGBE_LINK_SPEED_10GB_FULL;
  460. else
  461. *speed = IXGBE_LINK_SPEED_1GB_FULL;
  462. /* if link is down, zero out the current_mode */
  463. if (*link_up == false) {
  464. hw->fc.current_mode = ixgbe_fc_none;
  465. hw->fc.fc_was_autonegged = false;
  466. }
  467. out:
  468. return 0;
  469. }
  470. /**
  471. * ixgbe_setup_mac_link_speed_82598 - Set MAC link speed
  472. * @hw: pointer to hardware structure
  473. * @speed: new link speed
  474. * @autoneg: true if auto-negotiation enabled
  475. * @autoneg_wait_to_complete: true if waiting is needed to complete
  476. *
  477. * Set the link speed in the AUTOC register and restarts link.
  478. **/
  479. static s32 ixgbe_setup_mac_link_speed_82598(struct ixgbe_hw *hw,
  480. ixgbe_link_speed speed, bool autoneg,
  481. bool autoneg_wait_to_complete)
  482. {
  483. s32 status = 0;
  484. ixgbe_link_speed link_capabilities = IXGBE_LINK_SPEED_UNKNOWN;
  485. u32 curr_autoc = IXGBE_READ_REG(hw, IXGBE_AUTOC);
  486. u32 autoc = curr_autoc;
  487. u32 link_mode = autoc & IXGBE_AUTOC_LMS_MASK;
  488. /* Check to see if speed passed in is supported. */
  489. ixgbe_get_link_capabilities_82598(hw, &link_capabilities, &autoneg);
  490. speed &= link_capabilities;
  491. if (speed == IXGBE_LINK_SPEED_UNKNOWN)
  492. status = IXGBE_ERR_LINK_SETUP;
  493. /* Set KX4/KX support according to speed requested */
  494. else if (link_mode == IXGBE_AUTOC_LMS_KX4_AN ||
  495. link_mode == IXGBE_AUTOC_LMS_KX4_AN_1G_AN) {
  496. autoc &= ~IXGBE_AUTOC_KX4_KX_SUPP_MASK;
  497. if (speed & IXGBE_LINK_SPEED_10GB_FULL)
  498. autoc |= IXGBE_AUTOC_KX4_SUPP;
  499. if (speed & IXGBE_LINK_SPEED_1GB_FULL)
  500. autoc |= IXGBE_AUTOC_KX_SUPP;
  501. if (autoc != curr_autoc)
  502. IXGBE_WRITE_REG(hw, IXGBE_AUTOC, autoc);
  503. }
  504. if (status == 0) {
  505. hw->phy.autoneg_wait_to_complete = autoneg_wait_to_complete;
  506. /*
  507. * Setup and restart the link based on the new values in
  508. * ixgbe_hw This will write the AUTOC register based on the new
  509. * stored values
  510. */
  511. status = ixgbe_setup_mac_link_82598(hw);
  512. }
  513. return status;
  514. }
  515. /**
  516. * ixgbe_setup_copper_link_82598 - Setup copper link settings
  517. * @hw: pointer to hardware structure
  518. *
  519. * Configures link settings based on values in the ixgbe_hw struct.
  520. * Restarts the link. Performs autonegotiation if needed. Restart
  521. * phy and wait for autonegotiate to finish. Then synchronize the
  522. * MAC and PHY.
  523. **/
  524. static s32 ixgbe_setup_copper_link_82598(struct ixgbe_hw *hw)
  525. {
  526. s32 status;
  527. /* Restart autonegotiation on PHY */
  528. status = hw->phy.ops.setup_link(hw);
  529. /* Set up MAC */
  530. ixgbe_setup_mac_link_82598(hw);
  531. return status;
  532. }
  533. /**
  534. * ixgbe_setup_copper_link_speed_82598 - Set the PHY autoneg advertised field
  535. * @hw: pointer to hardware structure
  536. * @speed: new link speed
  537. * @autoneg: true if autonegotiation enabled
  538. * @autoneg_wait_to_complete: true if waiting is needed to complete
  539. *
  540. * Sets the link speed in the AUTOC register in the MAC and restarts link.
  541. **/
  542. static s32 ixgbe_setup_copper_link_speed_82598(struct ixgbe_hw *hw,
  543. ixgbe_link_speed speed,
  544. bool autoneg,
  545. bool autoneg_wait_to_complete)
  546. {
  547. s32 status;
  548. /* Setup the PHY according to input speed */
  549. status = hw->phy.ops.setup_link_speed(hw, speed, autoneg,
  550. autoneg_wait_to_complete);
  551. /* Set up MAC */
  552. ixgbe_setup_mac_link_82598(hw);
  553. return status;
  554. }
  555. /**
  556. * ixgbe_reset_hw_82598 - Performs hardware reset
  557. * @hw: pointer to hardware structure
  558. *
  559. * Resets the hardware by resetting the transmit and receive units, masks and
  560. * clears all interrupts, performing a PHY reset, and performing a link (MAC)
  561. * reset.
  562. **/
  563. static s32 ixgbe_reset_hw_82598(struct ixgbe_hw *hw)
  564. {
  565. s32 status = 0;
  566. s32 phy_status = 0;
  567. u32 ctrl;
  568. u32 gheccr;
  569. u32 i;
  570. u32 autoc;
  571. u8 analog_val;
  572. /* Call adapter stop to disable tx/rx and clear interrupts */
  573. hw->mac.ops.stop_adapter(hw);
  574. /*
  575. * Power up the Atlas Tx lanes if they are currently powered down.
  576. * Atlas Tx lanes are powered down for MAC loopback tests, but
  577. * they are not automatically restored on reset.
  578. */
  579. hw->mac.ops.read_analog_reg8(hw, IXGBE_ATLAS_PDN_LPBK, &analog_val);
  580. if (analog_val & IXGBE_ATLAS_PDN_TX_REG_EN) {
  581. /* Enable Tx Atlas so packets can be transmitted again */
  582. hw->mac.ops.read_analog_reg8(hw, IXGBE_ATLAS_PDN_LPBK,
  583. &analog_val);
  584. analog_val &= ~IXGBE_ATLAS_PDN_TX_REG_EN;
  585. hw->mac.ops.write_analog_reg8(hw, IXGBE_ATLAS_PDN_LPBK,
  586. analog_val);
  587. hw->mac.ops.read_analog_reg8(hw, IXGBE_ATLAS_PDN_10G,
  588. &analog_val);
  589. analog_val &= ~IXGBE_ATLAS_PDN_TX_10G_QL_ALL;
  590. hw->mac.ops.write_analog_reg8(hw, IXGBE_ATLAS_PDN_10G,
  591. analog_val);
  592. hw->mac.ops.read_analog_reg8(hw, IXGBE_ATLAS_PDN_1G,
  593. &analog_val);
  594. analog_val &= ~IXGBE_ATLAS_PDN_TX_1G_QL_ALL;
  595. hw->mac.ops.write_analog_reg8(hw, IXGBE_ATLAS_PDN_1G,
  596. analog_val);
  597. hw->mac.ops.read_analog_reg8(hw, IXGBE_ATLAS_PDN_AN,
  598. &analog_val);
  599. analog_val &= ~IXGBE_ATLAS_PDN_TX_AN_QL_ALL;
  600. hw->mac.ops.write_analog_reg8(hw, IXGBE_ATLAS_PDN_AN,
  601. analog_val);
  602. }
  603. /* Reset PHY */
  604. if (hw->phy.reset_disable == false) {
  605. /* PHY ops must be identified and initialized prior to reset */
  606. /* Init PHY and function pointers, perform SFP setup */
  607. phy_status = hw->phy.ops.init(hw);
  608. if (phy_status == IXGBE_ERR_SFP_NOT_SUPPORTED)
  609. goto reset_hw_out;
  610. else if (phy_status == IXGBE_ERR_SFP_NOT_PRESENT)
  611. goto no_phy_reset;
  612. hw->phy.ops.reset(hw);
  613. }
  614. no_phy_reset:
  615. /*
  616. * Prevent the PCI-E bus from from hanging by disabling PCI-E master
  617. * access and verify no pending requests before reset
  618. */
  619. status = ixgbe_disable_pcie_master(hw);
  620. if (status != 0) {
  621. status = IXGBE_ERR_MASTER_REQUESTS_PENDING;
  622. hw_dbg(hw, "PCI-E Master disable polling has failed.\n");
  623. }
  624. /*
  625. * Issue global reset to the MAC. This needs to be a SW reset.
  626. * If link reset is used, it might reset the MAC when mng is using it
  627. */
  628. ctrl = IXGBE_READ_REG(hw, IXGBE_CTRL);
  629. IXGBE_WRITE_REG(hw, IXGBE_CTRL, (ctrl | IXGBE_CTRL_RST));
  630. IXGBE_WRITE_FLUSH(hw);
  631. /* Poll for reset bit to self-clear indicating reset is complete */
  632. for (i = 0; i < 10; i++) {
  633. udelay(1);
  634. ctrl = IXGBE_READ_REG(hw, IXGBE_CTRL);
  635. if (!(ctrl & IXGBE_CTRL_RST))
  636. break;
  637. }
  638. if (ctrl & IXGBE_CTRL_RST) {
  639. status = IXGBE_ERR_RESET_FAILED;
  640. hw_dbg(hw, "Reset polling failed to complete.\n");
  641. }
  642. msleep(50);
  643. gheccr = IXGBE_READ_REG(hw, IXGBE_GHECCR);
  644. gheccr &= ~((1 << 21) | (1 << 18) | (1 << 9) | (1 << 6));
  645. IXGBE_WRITE_REG(hw, IXGBE_GHECCR, gheccr);
  646. /*
  647. * Store the original AUTOC value if it has not been
  648. * stored off yet. Otherwise restore the stored original
  649. * AUTOC value since the reset operation sets back to deaults.
  650. */
  651. autoc = IXGBE_READ_REG(hw, IXGBE_AUTOC);
  652. if (hw->mac.orig_link_settings_stored == false) {
  653. hw->mac.orig_autoc = autoc;
  654. hw->mac.orig_link_settings_stored = true;
  655. } else if (autoc != hw->mac.orig_autoc) {
  656. IXGBE_WRITE_REG(hw, IXGBE_AUTOC, hw->mac.orig_autoc);
  657. }
  658. /*
  659. * Store MAC address from RAR0, clear receive address registers, and
  660. * clear the multicast table
  661. */
  662. hw->mac.ops.init_rx_addrs(hw);
  663. /* Store the permanent mac address */
  664. hw->mac.ops.get_mac_addr(hw, hw->mac.perm_addr);
  665. reset_hw_out:
  666. if (phy_status)
  667. status = phy_status;
  668. return status;
  669. }
  670. /**
  671. * ixgbe_set_vmdq_82598 - Associate a VMDq set index with a rx address
  672. * @hw: pointer to hardware struct
  673. * @rar: receive address register index to associate with a VMDq index
  674. * @vmdq: VMDq set index
  675. **/
  676. static s32 ixgbe_set_vmdq_82598(struct ixgbe_hw *hw, u32 rar, u32 vmdq)
  677. {
  678. u32 rar_high;
  679. rar_high = IXGBE_READ_REG(hw, IXGBE_RAH(rar));
  680. rar_high &= ~IXGBE_RAH_VIND_MASK;
  681. rar_high |= ((vmdq << IXGBE_RAH_VIND_SHIFT) & IXGBE_RAH_VIND_MASK);
  682. IXGBE_WRITE_REG(hw, IXGBE_RAH(rar), rar_high);
  683. return 0;
  684. }
  685. /**
  686. * ixgbe_clear_vmdq_82598 - Disassociate a VMDq set index from an rx address
  687. * @hw: pointer to hardware struct
  688. * @rar: receive address register index to associate with a VMDq index
  689. * @vmdq: VMDq clear index (not used in 82598, but elsewhere)
  690. **/
  691. static s32 ixgbe_clear_vmdq_82598(struct ixgbe_hw *hw, u32 rar, u32 vmdq)
  692. {
  693. u32 rar_high;
  694. u32 rar_entries = hw->mac.num_rar_entries;
  695. if (rar < rar_entries) {
  696. rar_high = IXGBE_READ_REG(hw, IXGBE_RAH(rar));
  697. if (rar_high & IXGBE_RAH_VIND_MASK) {
  698. rar_high &= ~IXGBE_RAH_VIND_MASK;
  699. IXGBE_WRITE_REG(hw, IXGBE_RAH(rar), rar_high);
  700. }
  701. } else {
  702. hw_dbg(hw, "RAR index %d is out of range.\n", rar);
  703. }
  704. return 0;
  705. }
  706. /**
  707. * ixgbe_set_vfta_82598 - Set VLAN filter table
  708. * @hw: pointer to hardware structure
  709. * @vlan: VLAN id to write to VLAN filter
  710. * @vind: VMDq output index that maps queue to VLAN id in VFTA
  711. * @vlan_on: boolean flag to turn on/off VLAN in VFTA
  712. *
  713. * Turn on/off specified VLAN in the VLAN filter table.
  714. **/
  715. static s32 ixgbe_set_vfta_82598(struct ixgbe_hw *hw, u32 vlan, u32 vind,
  716. bool vlan_on)
  717. {
  718. u32 regindex;
  719. u32 bitindex;
  720. u32 bits;
  721. u32 vftabyte;
  722. if (vlan > 4095)
  723. return IXGBE_ERR_PARAM;
  724. /* Determine 32-bit word position in array */
  725. regindex = (vlan >> 5) & 0x7F; /* upper seven bits */
  726. /* Determine the location of the (VMD) queue index */
  727. vftabyte = ((vlan >> 3) & 0x03); /* bits (4:3) indicating byte array */
  728. bitindex = (vlan & 0x7) << 2; /* lower 3 bits indicate nibble */
  729. /* Set the nibble for VMD queue index */
  730. bits = IXGBE_READ_REG(hw, IXGBE_VFTAVIND(vftabyte, regindex));
  731. bits &= (~(0x0F << bitindex));
  732. bits |= (vind << bitindex);
  733. IXGBE_WRITE_REG(hw, IXGBE_VFTAVIND(vftabyte, regindex), bits);
  734. /* Determine the location of the bit for this VLAN id */
  735. bitindex = vlan & 0x1F; /* lower five bits */
  736. bits = IXGBE_READ_REG(hw, IXGBE_VFTA(regindex));
  737. if (vlan_on)
  738. /* Turn on this VLAN id */
  739. bits |= (1 << bitindex);
  740. else
  741. /* Turn off this VLAN id */
  742. bits &= ~(1 << bitindex);
  743. IXGBE_WRITE_REG(hw, IXGBE_VFTA(regindex), bits);
  744. return 0;
  745. }
  746. /**
  747. * ixgbe_clear_vfta_82598 - Clear VLAN filter table
  748. * @hw: pointer to hardware structure
  749. *
  750. * Clears the VLAN filer table, and the VMDq index associated with the filter
  751. **/
  752. static s32 ixgbe_clear_vfta_82598(struct ixgbe_hw *hw)
  753. {
  754. u32 offset;
  755. u32 vlanbyte;
  756. for (offset = 0; offset < hw->mac.vft_size; offset++)
  757. IXGBE_WRITE_REG(hw, IXGBE_VFTA(offset), 0);
  758. for (vlanbyte = 0; vlanbyte < 4; vlanbyte++)
  759. for (offset = 0; offset < hw->mac.vft_size; offset++)
  760. IXGBE_WRITE_REG(hw, IXGBE_VFTAVIND(vlanbyte, offset),
  761. 0);
  762. return 0;
  763. }
  764. /**
  765. * ixgbe_read_analog_reg8_82598 - Reads 8 bit Atlas analog register
  766. * @hw: pointer to hardware structure
  767. * @reg: analog register to read
  768. * @val: read value
  769. *
  770. * Performs read operation to Atlas analog register specified.
  771. **/
  772. static s32 ixgbe_read_analog_reg8_82598(struct ixgbe_hw *hw, u32 reg, u8 *val)
  773. {
  774. u32 atlas_ctl;
  775. IXGBE_WRITE_REG(hw, IXGBE_ATLASCTL,
  776. IXGBE_ATLASCTL_WRITE_CMD | (reg << 8));
  777. IXGBE_WRITE_FLUSH(hw);
  778. udelay(10);
  779. atlas_ctl = IXGBE_READ_REG(hw, IXGBE_ATLASCTL);
  780. *val = (u8)atlas_ctl;
  781. return 0;
  782. }
  783. /**
  784. * ixgbe_write_analog_reg8_82598 - Writes 8 bit Atlas analog register
  785. * @hw: pointer to hardware structure
  786. * @reg: atlas register to write
  787. * @val: value to write
  788. *
  789. * Performs write operation to Atlas analog register specified.
  790. **/
  791. static s32 ixgbe_write_analog_reg8_82598(struct ixgbe_hw *hw, u32 reg, u8 val)
  792. {
  793. u32 atlas_ctl;
  794. atlas_ctl = (reg << 8) | val;
  795. IXGBE_WRITE_REG(hw, IXGBE_ATLASCTL, atlas_ctl);
  796. IXGBE_WRITE_FLUSH(hw);
  797. udelay(10);
  798. return 0;
  799. }
  800. /**
  801. * ixgbe_read_i2c_eeprom_82598 - Read 8 bit EEPROM word of an SFP+ module
  802. * over I2C interface through an intermediate phy.
  803. * @hw: pointer to hardware structure
  804. * @byte_offset: EEPROM byte offset to read
  805. * @eeprom_data: value read
  806. *
  807. * Performs byte read operation to SFP module's EEPROM over I2C interface.
  808. **/
  809. static s32 ixgbe_read_i2c_eeprom_82598(struct ixgbe_hw *hw, u8 byte_offset,
  810. u8 *eeprom_data)
  811. {
  812. s32 status = 0;
  813. u16 sfp_addr = 0;
  814. u16 sfp_data = 0;
  815. u16 sfp_stat = 0;
  816. u32 i;
  817. if (hw->phy.type == ixgbe_phy_nl) {
  818. /*
  819. * phy SDA/SCL registers are at addresses 0xC30A to
  820. * 0xC30D. These registers are used to talk to the SFP+
  821. * module's EEPROM through the SDA/SCL (I2C) interface.
  822. */
  823. sfp_addr = (IXGBE_I2C_EEPROM_DEV_ADDR << 8) + byte_offset;
  824. sfp_addr = (sfp_addr | IXGBE_I2C_EEPROM_READ_MASK);
  825. hw->phy.ops.write_reg(hw,
  826. IXGBE_MDIO_PMA_PMD_SDA_SCL_ADDR,
  827. MDIO_MMD_PMAPMD,
  828. sfp_addr);
  829. /* Poll status */
  830. for (i = 0; i < 100; i++) {
  831. hw->phy.ops.read_reg(hw,
  832. IXGBE_MDIO_PMA_PMD_SDA_SCL_STAT,
  833. MDIO_MMD_PMAPMD,
  834. &sfp_stat);
  835. sfp_stat = sfp_stat & IXGBE_I2C_EEPROM_STATUS_MASK;
  836. if (sfp_stat != IXGBE_I2C_EEPROM_STATUS_IN_PROGRESS)
  837. break;
  838. msleep(10);
  839. }
  840. if (sfp_stat != IXGBE_I2C_EEPROM_STATUS_PASS) {
  841. hw_dbg(hw, "EEPROM read did not pass.\n");
  842. status = IXGBE_ERR_SFP_NOT_PRESENT;
  843. goto out;
  844. }
  845. /* Read data */
  846. hw->phy.ops.read_reg(hw, IXGBE_MDIO_PMA_PMD_SDA_SCL_DATA,
  847. MDIO_MMD_PMAPMD, &sfp_data);
  848. *eeprom_data = (u8)(sfp_data >> 8);
  849. } else {
  850. status = IXGBE_ERR_PHY;
  851. goto out;
  852. }
  853. out:
  854. return status;
  855. }
  856. /**
  857. * ixgbe_get_supported_physical_layer_82598 - Returns physical layer type
  858. * @hw: pointer to hardware structure
  859. *
  860. * Determines physical layer capabilities of the current configuration.
  861. **/
  862. static u32 ixgbe_get_supported_physical_layer_82598(struct ixgbe_hw *hw)
  863. {
  864. u32 physical_layer = IXGBE_PHYSICAL_LAYER_UNKNOWN;
  865. u32 autoc = IXGBE_READ_REG(hw, IXGBE_AUTOC);
  866. u32 pma_pmd_10g = autoc & IXGBE_AUTOC_10G_PMA_PMD_MASK;
  867. u32 pma_pmd_1g = autoc & IXGBE_AUTOC_1G_PMA_PMD_MASK;
  868. u16 ext_ability = 0;
  869. hw->phy.ops.identify(hw);
  870. /* Copper PHY must be checked before AUTOC LMS to determine correct
  871. * physical layer because 10GBase-T PHYs use LMS = KX4/KX */
  872. if (hw->phy.type == ixgbe_phy_tn ||
  873. hw->phy.type == ixgbe_phy_cu_unknown) {
  874. hw->phy.ops.read_reg(hw, MDIO_PMA_EXTABLE, MDIO_MMD_PMAPMD,
  875. &ext_ability);
  876. if (ext_ability & MDIO_PMA_EXTABLE_10GBT)
  877. physical_layer |= IXGBE_PHYSICAL_LAYER_10GBASE_T;
  878. if (ext_ability & MDIO_PMA_EXTABLE_1000BT)
  879. physical_layer |= IXGBE_PHYSICAL_LAYER_1000BASE_T;
  880. if (ext_ability & MDIO_PMA_EXTABLE_100BTX)
  881. physical_layer |= IXGBE_PHYSICAL_LAYER_100BASE_TX;
  882. goto out;
  883. }
  884. switch (autoc & IXGBE_AUTOC_LMS_MASK) {
  885. case IXGBE_AUTOC_LMS_1G_AN:
  886. case IXGBE_AUTOC_LMS_1G_LINK_NO_AN:
  887. if (pma_pmd_1g == IXGBE_AUTOC_1G_KX)
  888. physical_layer = IXGBE_PHYSICAL_LAYER_1000BASE_KX;
  889. else
  890. physical_layer = IXGBE_PHYSICAL_LAYER_1000BASE_BX;
  891. break;
  892. case IXGBE_AUTOC_LMS_10G_LINK_NO_AN:
  893. if (pma_pmd_10g == IXGBE_AUTOC_10G_CX4)
  894. physical_layer = IXGBE_PHYSICAL_LAYER_10GBASE_CX4;
  895. else if (pma_pmd_10g == IXGBE_AUTOC_10G_KX4)
  896. physical_layer = IXGBE_PHYSICAL_LAYER_10GBASE_KX4;
  897. else /* XAUI */
  898. physical_layer = IXGBE_PHYSICAL_LAYER_UNKNOWN;
  899. break;
  900. case IXGBE_AUTOC_LMS_KX4_AN:
  901. case IXGBE_AUTOC_LMS_KX4_AN_1G_AN:
  902. if (autoc & IXGBE_AUTOC_KX_SUPP)
  903. physical_layer |= IXGBE_PHYSICAL_LAYER_1000BASE_KX;
  904. if (autoc & IXGBE_AUTOC_KX4_SUPP)
  905. physical_layer |= IXGBE_PHYSICAL_LAYER_10GBASE_KX4;
  906. break;
  907. default:
  908. break;
  909. }
  910. if (hw->phy.type == ixgbe_phy_nl) {
  911. hw->phy.ops.identify_sfp(hw);
  912. switch (hw->phy.sfp_type) {
  913. case ixgbe_sfp_type_da_cu:
  914. physical_layer = IXGBE_PHYSICAL_LAYER_SFP_PLUS_CU;
  915. break;
  916. case ixgbe_sfp_type_sr:
  917. physical_layer = IXGBE_PHYSICAL_LAYER_10GBASE_SR;
  918. break;
  919. case ixgbe_sfp_type_lr:
  920. physical_layer = IXGBE_PHYSICAL_LAYER_10GBASE_LR;
  921. break;
  922. default:
  923. physical_layer = IXGBE_PHYSICAL_LAYER_UNKNOWN;
  924. break;
  925. }
  926. }
  927. switch (hw->device_id) {
  928. case IXGBE_DEV_ID_82598_DA_DUAL_PORT:
  929. physical_layer = IXGBE_PHYSICAL_LAYER_SFP_PLUS_CU;
  930. break;
  931. case IXGBE_DEV_ID_82598AF_DUAL_PORT:
  932. case IXGBE_DEV_ID_82598AF_SINGLE_PORT:
  933. case IXGBE_DEV_ID_82598_SR_DUAL_PORT_EM:
  934. physical_layer = IXGBE_PHYSICAL_LAYER_10GBASE_SR;
  935. break;
  936. case IXGBE_DEV_ID_82598EB_XF_LR:
  937. physical_layer = IXGBE_PHYSICAL_LAYER_10GBASE_LR;
  938. break;
  939. default:
  940. break;
  941. }
  942. out:
  943. return physical_layer;
  944. }
  945. static struct ixgbe_mac_operations mac_ops_82598 = {
  946. .init_hw = &ixgbe_init_hw_generic,
  947. .reset_hw = &ixgbe_reset_hw_82598,
  948. .start_hw = &ixgbe_start_hw_generic,
  949. .clear_hw_cntrs = &ixgbe_clear_hw_cntrs_generic,
  950. .get_media_type = &ixgbe_get_media_type_82598,
  951. .get_supported_physical_layer = &ixgbe_get_supported_physical_layer_82598,
  952. .enable_rx_dma = &ixgbe_enable_rx_dma_generic,
  953. .get_mac_addr = &ixgbe_get_mac_addr_generic,
  954. .stop_adapter = &ixgbe_stop_adapter_generic,
  955. .get_bus_info = &ixgbe_get_bus_info_generic,
  956. .set_lan_id = &ixgbe_set_lan_id_multi_port_pcie,
  957. .read_analog_reg8 = &ixgbe_read_analog_reg8_82598,
  958. .write_analog_reg8 = &ixgbe_write_analog_reg8_82598,
  959. .setup_link = &ixgbe_setup_mac_link_82598,
  960. .setup_link_speed = &ixgbe_setup_mac_link_speed_82598,
  961. .check_link = &ixgbe_check_mac_link_82598,
  962. .get_link_capabilities = &ixgbe_get_link_capabilities_82598,
  963. .led_on = &ixgbe_led_on_generic,
  964. .led_off = &ixgbe_led_off_generic,
  965. .blink_led_start = &ixgbe_blink_led_start_generic,
  966. .blink_led_stop = &ixgbe_blink_led_stop_generic,
  967. .set_rar = &ixgbe_set_rar_generic,
  968. .clear_rar = &ixgbe_clear_rar_generic,
  969. .set_vmdq = &ixgbe_set_vmdq_82598,
  970. .clear_vmdq = &ixgbe_clear_vmdq_82598,
  971. .init_rx_addrs = &ixgbe_init_rx_addrs_generic,
  972. .update_uc_addr_list = &ixgbe_update_uc_addr_list_generic,
  973. .update_mc_addr_list = &ixgbe_update_mc_addr_list_generic,
  974. .enable_mc = &ixgbe_enable_mc_generic,
  975. .disable_mc = &ixgbe_disable_mc_generic,
  976. .clear_vfta = &ixgbe_clear_vfta_82598,
  977. .set_vfta = &ixgbe_set_vfta_82598,
  978. .fc_enable = &ixgbe_fc_enable_82598,
  979. };
  980. static struct ixgbe_eeprom_operations eeprom_ops_82598 = {
  981. .init_params = &ixgbe_init_eeprom_params_generic,
  982. .read = &ixgbe_read_eeprom_generic,
  983. .validate_checksum = &ixgbe_validate_eeprom_checksum_generic,
  984. .update_checksum = &ixgbe_update_eeprom_checksum_generic,
  985. };
  986. static struct ixgbe_phy_operations phy_ops_82598 = {
  987. .identify = &ixgbe_identify_phy_generic,
  988. .identify_sfp = &ixgbe_identify_sfp_module_generic,
  989. .init = &ixgbe_init_phy_ops_82598,
  990. .reset = &ixgbe_reset_phy_generic,
  991. .read_reg = &ixgbe_read_phy_reg_generic,
  992. .write_reg = &ixgbe_write_phy_reg_generic,
  993. .setup_link = &ixgbe_setup_phy_link_generic,
  994. .setup_link_speed = &ixgbe_setup_phy_link_speed_generic,
  995. .read_i2c_eeprom = &ixgbe_read_i2c_eeprom_82598,
  996. };
  997. struct ixgbe_info ixgbe_82598_info = {
  998. .mac = ixgbe_mac_82598EB,
  999. .get_invariants = &ixgbe_get_invariants_82598,
  1000. .mac_ops = &mac_ops_82598,
  1001. .eeprom_ops = &eeprom_ops_82598,
  1002. .phy_ops = &phy_ops_82598,
  1003. };