ixgbe_82598.c 33 KB

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