fm10k_vf.c 17 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590591592593594595596597
  1. /* Intel Ethernet Switch Host Interface Driver
  2. * Copyright(c) 2013 - 2015 Intel Corporation.
  3. *
  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. *
  8. * This program is distributed in the hope it will be useful, but WITHOUT
  9. * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
  10. * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for
  11. * more details.
  12. *
  13. * The full GNU General Public License is included in this distribution in
  14. * the file called "COPYING".
  15. *
  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 "fm10k_vf.h"
  21. /**
  22. * fm10k_stop_hw_vf - Stop Tx/Rx units
  23. * @hw: pointer to hardware structure
  24. *
  25. **/
  26. static s32 fm10k_stop_hw_vf(struct fm10k_hw *hw)
  27. {
  28. u8 *perm_addr = hw->mac.perm_addr;
  29. u32 bal = 0, bah = 0, tdlen;
  30. s32 err;
  31. u16 i;
  32. /* we need to disable the queues before taking further steps */
  33. err = fm10k_stop_hw_generic(hw);
  34. if (err)
  35. return err;
  36. /* If permanent address is set then we need to restore it */
  37. if (is_valid_ether_addr(perm_addr)) {
  38. bal = (((u32)perm_addr[3]) << 24) |
  39. (((u32)perm_addr[4]) << 16) |
  40. (((u32)perm_addr[5]) << 8);
  41. bah = (((u32)0xFF) << 24) |
  42. (((u32)perm_addr[0]) << 16) |
  43. (((u32)perm_addr[1]) << 8) |
  44. ((u32)perm_addr[2]);
  45. }
  46. /* restore default itr_scale for next VF initialization */
  47. tdlen = hw->mac.itr_scale << FM10K_TDLEN_ITR_SCALE_SHIFT;
  48. /* The queues have already been disabled so we just need to
  49. * update their base address registers
  50. */
  51. for (i = 0; i < hw->mac.max_queues; i++) {
  52. fm10k_write_reg(hw, FM10K_TDBAL(i), bal);
  53. fm10k_write_reg(hw, FM10K_TDBAH(i), bah);
  54. fm10k_write_reg(hw, FM10K_RDBAL(i), bal);
  55. fm10k_write_reg(hw, FM10K_RDBAH(i), bah);
  56. /* Restore ITR scale in software-defined mechanism in TDLEN
  57. * for next VF initialization. See definition of
  58. * FM10K_TDLEN_ITR_SCALE_SHIFT for more details on the use of
  59. * TDLEN here.
  60. */
  61. fm10k_write_reg(hw, FM10K_TDLEN(i), tdlen);
  62. }
  63. return 0;
  64. }
  65. /**
  66. * fm10k_reset_hw_vf - VF hardware reset
  67. * @hw: pointer to hardware structure
  68. *
  69. * This function should return the hardware to a state similar to the
  70. * one it is in after just being initialized.
  71. **/
  72. static s32 fm10k_reset_hw_vf(struct fm10k_hw *hw)
  73. {
  74. s32 err;
  75. /* shut down queues we own and reset DMA configuration */
  76. err = fm10k_stop_hw_vf(hw);
  77. if (err)
  78. return err;
  79. /* Inititate VF reset */
  80. fm10k_write_reg(hw, FM10K_VFCTRL, FM10K_VFCTRL_RST);
  81. /* Flush write and allow 100us for reset to complete */
  82. fm10k_write_flush(hw);
  83. udelay(FM10K_RESET_TIMEOUT);
  84. /* Clear reset bit and verify it was cleared */
  85. fm10k_write_reg(hw, FM10K_VFCTRL, 0);
  86. if (fm10k_read_reg(hw, FM10K_VFCTRL) & FM10K_VFCTRL_RST)
  87. err = FM10K_ERR_RESET_FAILED;
  88. return err;
  89. }
  90. /**
  91. * fm10k_init_hw_vf - VF hardware initialization
  92. * @hw: pointer to hardware structure
  93. *
  94. **/
  95. static s32 fm10k_init_hw_vf(struct fm10k_hw *hw)
  96. {
  97. u32 tqdloc, tqdloc0 = ~fm10k_read_reg(hw, FM10K_TQDLOC(0));
  98. s32 err;
  99. u16 i;
  100. /* verify we have at least 1 queue */
  101. if (!~fm10k_read_reg(hw, FM10K_TXQCTL(0)) ||
  102. !~fm10k_read_reg(hw, FM10K_RXQCTL(0))) {
  103. err = FM10K_ERR_NO_RESOURCES;
  104. goto reset_max_queues;
  105. }
  106. /* determine how many queues we have */
  107. for (i = 1; tqdloc0 && (i < FM10K_MAX_QUEUES_POOL); i++) {
  108. /* verify the Descriptor cache offsets are increasing */
  109. tqdloc = ~fm10k_read_reg(hw, FM10K_TQDLOC(i));
  110. if (!tqdloc || (tqdloc == tqdloc0))
  111. break;
  112. /* check to verify the PF doesn't own any of our queues */
  113. if (!~fm10k_read_reg(hw, FM10K_TXQCTL(i)) ||
  114. !~fm10k_read_reg(hw, FM10K_RXQCTL(i)))
  115. break;
  116. }
  117. /* shut down queues we own and reset DMA configuration */
  118. err = fm10k_disable_queues_generic(hw, i);
  119. if (err)
  120. goto reset_max_queues;
  121. /* record maximum queue count */
  122. hw->mac.max_queues = i;
  123. /* fetch default VLAN and ITR scale */
  124. hw->mac.default_vid = (fm10k_read_reg(hw, FM10K_TXQCTL(0)) &
  125. FM10K_TXQCTL_VID_MASK) >> FM10K_TXQCTL_VID_SHIFT;
  126. /* Read the ITR scale from TDLEN. See the definition of
  127. * FM10K_TDLEN_ITR_SCALE_SHIFT for more information about how TDLEN is
  128. * used here.
  129. */
  130. hw->mac.itr_scale = (fm10k_read_reg(hw, FM10K_TDLEN(0)) &
  131. FM10K_TDLEN_ITR_SCALE_MASK) >>
  132. FM10K_TDLEN_ITR_SCALE_SHIFT;
  133. return 0;
  134. reset_max_queues:
  135. hw->mac.max_queues = 0;
  136. return err;
  137. }
  138. /* This structure defines the attibutes to be parsed below */
  139. const struct fm10k_tlv_attr fm10k_mac_vlan_msg_attr[] = {
  140. FM10K_TLV_ATTR_U32(FM10K_MAC_VLAN_MSG_VLAN),
  141. FM10K_TLV_ATTR_BOOL(FM10K_MAC_VLAN_MSG_SET),
  142. FM10K_TLV_ATTR_MAC_ADDR(FM10K_MAC_VLAN_MSG_MAC),
  143. FM10K_TLV_ATTR_MAC_ADDR(FM10K_MAC_VLAN_MSG_DEFAULT_MAC),
  144. FM10K_TLV_ATTR_MAC_ADDR(FM10K_MAC_VLAN_MSG_MULTICAST),
  145. FM10K_TLV_ATTR_LAST
  146. };
  147. /**
  148. * fm10k_update_vlan_vf - Update status of VLAN ID in VLAN filter table
  149. * @hw: pointer to hardware structure
  150. * @vid: VLAN ID to add to table
  151. * @vsi: Reserved, should always be 0
  152. * @set: Indicates if this is a set or clear operation
  153. *
  154. * This function adds or removes the corresponding VLAN ID from the VLAN
  155. * filter table for this VF.
  156. **/
  157. static s32 fm10k_update_vlan_vf(struct fm10k_hw *hw, u32 vid, u8 vsi, bool set)
  158. {
  159. struct fm10k_mbx_info *mbx = &hw->mbx;
  160. u32 msg[4];
  161. /* verify the index is not set */
  162. if (vsi)
  163. return FM10K_ERR_PARAM;
  164. /* verify upper 4 bits of vid and length are 0 */
  165. if ((vid << 16 | vid) >> 28)
  166. return FM10K_ERR_PARAM;
  167. /* encode set bit into the VLAN ID */
  168. if (!set)
  169. vid |= FM10K_VLAN_CLEAR;
  170. /* generate VLAN request */
  171. fm10k_tlv_msg_init(msg, FM10K_VF_MSG_ID_MAC_VLAN);
  172. fm10k_tlv_attr_put_u32(msg, FM10K_MAC_VLAN_MSG_VLAN, vid);
  173. /* load onto outgoing mailbox */
  174. return mbx->ops.enqueue_tx(hw, mbx, msg);
  175. }
  176. /**
  177. * fm10k_msg_mac_vlan_vf - Read device MAC address from mailbox message
  178. * @hw: pointer to the HW structure
  179. * @results: Attributes for message
  180. * @mbx: unused mailbox data
  181. *
  182. * This function should determine the MAC address for the VF
  183. **/
  184. s32 fm10k_msg_mac_vlan_vf(struct fm10k_hw *hw, u32 **results,
  185. struct fm10k_mbx_info *mbx)
  186. {
  187. u8 perm_addr[ETH_ALEN];
  188. u16 vid;
  189. s32 err;
  190. /* record MAC address requested */
  191. err = fm10k_tlv_attr_get_mac_vlan(
  192. results[FM10K_MAC_VLAN_MSG_DEFAULT_MAC],
  193. perm_addr, &vid);
  194. if (err)
  195. return err;
  196. ether_addr_copy(hw->mac.perm_addr, perm_addr);
  197. hw->mac.default_vid = vid & (FM10K_VLAN_TABLE_VID_MAX - 1);
  198. hw->mac.vlan_override = !!(vid & FM10K_VLAN_CLEAR);
  199. return 0;
  200. }
  201. /**
  202. * fm10k_read_mac_addr_vf - Read device MAC address
  203. * @hw: pointer to the HW structure
  204. *
  205. * This function should determine the MAC address for the VF
  206. **/
  207. static s32 fm10k_read_mac_addr_vf(struct fm10k_hw *hw)
  208. {
  209. u8 perm_addr[ETH_ALEN];
  210. u32 base_addr;
  211. base_addr = fm10k_read_reg(hw, FM10K_TDBAL(0));
  212. /* last byte should be 0 */
  213. if (base_addr << 24)
  214. return FM10K_ERR_INVALID_MAC_ADDR;
  215. perm_addr[3] = (u8)(base_addr >> 24);
  216. perm_addr[4] = (u8)(base_addr >> 16);
  217. perm_addr[5] = (u8)(base_addr >> 8);
  218. base_addr = fm10k_read_reg(hw, FM10K_TDBAH(0));
  219. /* first byte should be all 1's */
  220. if ((~base_addr) >> 24)
  221. return FM10K_ERR_INVALID_MAC_ADDR;
  222. perm_addr[0] = (u8)(base_addr >> 16);
  223. perm_addr[1] = (u8)(base_addr >> 8);
  224. perm_addr[2] = (u8)(base_addr);
  225. ether_addr_copy(hw->mac.perm_addr, perm_addr);
  226. ether_addr_copy(hw->mac.addr, perm_addr);
  227. return 0;
  228. }
  229. /**
  230. * fm10k_update_uc_addr_vf - Update device unicast addresses
  231. * @hw: pointer to the HW structure
  232. * @glort: unused
  233. * @mac: MAC address to add/remove from table
  234. * @vid: VLAN ID to add/remove from table
  235. * @add: Indicates if this is an add or remove operation
  236. * @flags: flags field to indicate add and secure - unused
  237. *
  238. * This function is used to add or remove unicast MAC addresses for
  239. * the VF.
  240. **/
  241. static s32 fm10k_update_uc_addr_vf(struct fm10k_hw *hw, u16 glort,
  242. const u8 *mac, u16 vid, bool add, u8 flags)
  243. {
  244. struct fm10k_mbx_info *mbx = &hw->mbx;
  245. u32 msg[7];
  246. /* verify VLAN ID is valid */
  247. if (vid >= FM10K_VLAN_TABLE_VID_MAX)
  248. return FM10K_ERR_PARAM;
  249. /* verify MAC address is valid */
  250. if (!is_valid_ether_addr(mac))
  251. return FM10K_ERR_PARAM;
  252. /* verify we are not locked down on the MAC address */
  253. if (is_valid_ether_addr(hw->mac.perm_addr) &&
  254. !ether_addr_equal(hw->mac.perm_addr, mac))
  255. return FM10K_ERR_PARAM;
  256. /* add bit to notify us if this is a set or clear operation */
  257. if (!add)
  258. vid |= FM10K_VLAN_CLEAR;
  259. /* generate VLAN request */
  260. fm10k_tlv_msg_init(msg, FM10K_VF_MSG_ID_MAC_VLAN);
  261. fm10k_tlv_attr_put_mac_vlan(msg, FM10K_MAC_VLAN_MSG_MAC, mac, vid);
  262. /* load onto outgoing mailbox */
  263. return mbx->ops.enqueue_tx(hw, mbx, msg);
  264. }
  265. /**
  266. * fm10k_update_mc_addr_vf - Update device multicast addresses
  267. * @hw: pointer to the HW structure
  268. * @glort: unused
  269. * @mac: MAC address to add/remove from table
  270. * @vid: VLAN ID to add/remove from table
  271. * @add: Indicates if this is an add or remove operation
  272. *
  273. * This function is used to add or remove multicast MAC addresses for
  274. * the VF.
  275. **/
  276. static s32 fm10k_update_mc_addr_vf(struct fm10k_hw *hw, u16 glort,
  277. const u8 *mac, u16 vid, bool add)
  278. {
  279. struct fm10k_mbx_info *mbx = &hw->mbx;
  280. u32 msg[7];
  281. /* verify VLAN ID is valid */
  282. if (vid >= FM10K_VLAN_TABLE_VID_MAX)
  283. return FM10K_ERR_PARAM;
  284. /* verify multicast address is valid */
  285. if (!is_multicast_ether_addr(mac))
  286. return FM10K_ERR_PARAM;
  287. /* add bit to notify us if this is a set or clear operation */
  288. if (!add)
  289. vid |= FM10K_VLAN_CLEAR;
  290. /* generate VLAN request */
  291. fm10k_tlv_msg_init(msg, FM10K_VF_MSG_ID_MAC_VLAN);
  292. fm10k_tlv_attr_put_mac_vlan(msg, FM10K_MAC_VLAN_MSG_MULTICAST,
  293. mac, vid);
  294. /* load onto outgoing mailbox */
  295. return mbx->ops.enqueue_tx(hw, mbx, msg);
  296. }
  297. /**
  298. * fm10k_update_int_moderator_vf - Request update of interrupt moderator list
  299. * @hw: pointer to hardware structure
  300. *
  301. * This function will issue a request to the PF to rescan our MSI-X table
  302. * and to update the interrupt moderator linked list.
  303. **/
  304. static void fm10k_update_int_moderator_vf(struct fm10k_hw *hw)
  305. {
  306. struct fm10k_mbx_info *mbx = &hw->mbx;
  307. u32 msg[1];
  308. /* generate MSI-X request */
  309. fm10k_tlv_msg_init(msg, FM10K_VF_MSG_ID_MSIX);
  310. /* load onto outgoing mailbox */
  311. mbx->ops.enqueue_tx(hw, mbx, msg);
  312. }
  313. /* This structure defines the attibutes to be parsed below */
  314. const struct fm10k_tlv_attr fm10k_lport_state_msg_attr[] = {
  315. FM10K_TLV_ATTR_BOOL(FM10K_LPORT_STATE_MSG_DISABLE),
  316. FM10K_TLV_ATTR_U8(FM10K_LPORT_STATE_MSG_XCAST_MODE),
  317. FM10K_TLV_ATTR_BOOL(FM10K_LPORT_STATE_MSG_READY),
  318. FM10K_TLV_ATTR_LAST
  319. };
  320. /**
  321. * fm10k_msg_lport_state_vf - Message handler for lport_state message from PF
  322. * @hw: Pointer to hardware structure
  323. * @results: pointer array containing parsed data
  324. * @mbx: Pointer to mailbox information structure
  325. *
  326. * This handler is meant to capture the indication from the PF that we
  327. * are ready to bring up the interface.
  328. **/
  329. s32 fm10k_msg_lport_state_vf(struct fm10k_hw *hw, u32 **results,
  330. struct fm10k_mbx_info *mbx)
  331. {
  332. hw->mac.dglort_map = !results[FM10K_LPORT_STATE_MSG_READY] ?
  333. FM10K_DGLORTMAP_NONE : FM10K_DGLORTMAP_ZERO;
  334. return 0;
  335. }
  336. /**
  337. * fm10k_update_lport_state_vf - Update device state in lower device
  338. * @hw: pointer to the HW structure
  339. * @glort: unused
  340. * @count: number of logical ports to enable - unused (always 1)
  341. * @enable: boolean value indicating if this is an enable or disable request
  342. *
  343. * Notify the lower device of a state change. If the lower device is
  344. * enabled we can add filters, if it is disabled all filters for this
  345. * logical port are flushed.
  346. **/
  347. static s32 fm10k_update_lport_state_vf(struct fm10k_hw *hw, u16 glort,
  348. u16 count, bool enable)
  349. {
  350. struct fm10k_mbx_info *mbx = &hw->mbx;
  351. u32 msg[2];
  352. /* reset glort mask 0 as we have to wait to be enabled */
  353. hw->mac.dglort_map = FM10K_DGLORTMAP_NONE;
  354. /* generate port state request */
  355. fm10k_tlv_msg_init(msg, FM10K_VF_MSG_ID_LPORT_STATE);
  356. if (!enable)
  357. fm10k_tlv_attr_put_bool(msg, FM10K_LPORT_STATE_MSG_DISABLE);
  358. /* load onto outgoing mailbox */
  359. return mbx->ops.enqueue_tx(hw, mbx, msg);
  360. }
  361. /**
  362. * fm10k_update_xcast_mode_vf - Request update of multicast mode
  363. * @hw: pointer to hardware structure
  364. * @glort: unused
  365. * @mode: integer value indicating mode being requested
  366. *
  367. * This function will attempt to request a higher mode for the port
  368. * so that it can enable either multicast, multicast promiscuous, or
  369. * promiscuous mode of operation.
  370. **/
  371. static s32 fm10k_update_xcast_mode_vf(struct fm10k_hw *hw, u16 glort, u8 mode)
  372. {
  373. struct fm10k_mbx_info *mbx = &hw->mbx;
  374. u32 msg[3];
  375. if (mode > FM10K_XCAST_MODE_NONE)
  376. return FM10K_ERR_PARAM;
  377. /* generate message requesting to change xcast mode */
  378. fm10k_tlv_msg_init(msg, FM10K_VF_MSG_ID_LPORT_STATE);
  379. fm10k_tlv_attr_put_u8(msg, FM10K_LPORT_STATE_MSG_XCAST_MODE, mode);
  380. /* load onto outgoing mailbox */
  381. return mbx->ops.enqueue_tx(hw, mbx, msg);
  382. }
  383. const struct fm10k_tlv_attr fm10k_1588_msg_attr[] = {
  384. FM10K_TLV_ATTR_U64(FM10K_1588_MSG_TIMESTAMP),
  385. FM10K_TLV_ATTR_LAST
  386. };
  387. /* currently there is no shared 1588 timestamp handler */
  388. /**
  389. * fm10k_update_hw_stats_vf - Updates hardware related statistics of VF
  390. * @hw: pointer to hardware structure
  391. * @stats: pointer to statistics structure
  392. *
  393. * This function collects and aggregates per queue hardware statistics.
  394. **/
  395. static void fm10k_update_hw_stats_vf(struct fm10k_hw *hw,
  396. struct fm10k_hw_stats *stats)
  397. {
  398. fm10k_update_hw_stats_q(hw, stats->q, 0, hw->mac.max_queues);
  399. }
  400. /**
  401. * fm10k_rebind_hw_stats_vf - Resets base for hardware statistics of VF
  402. * @hw: pointer to hardware structure
  403. * @stats: pointer to the stats structure to update
  404. *
  405. * This function resets the base for queue hardware statistics.
  406. **/
  407. static void fm10k_rebind_hw_stats_vf(struct fm10k_hw *hw,
  408. struct fm10k_hw_stats *stats)
  409. {
  410. /* Unbind Queue Statistics */
  411. fm10k_unbind_hw_stats_q(stats->q, 0, hw->mac.max_queues);
  412. /* Reinitialize bases for all stats */
  413. fm10k_update_hw_stats_vf(hw, stats);
  414. }
  415. /**
  416. * fm10k_configure_dglort_map_vf - Configures GLORT entry and queues
  417. * @hw: pointer to hardware structure
  418. * @dglort: pointer to dglort configuration structure
  419. *
  420. * Reads the configuration structure contained in dglort_cfg and uses
  421. * that information to then populate a DGLORTMAP/DEC entry and the queues
  422. * to which it has been assigned.
  423. **/
  424. static s32 fm10k_configure_dglort_map_vf(struct fm10k_hw *hw,
  425. struct fm10k_dglort_cfg *dglort)
  426. {
  427. /* verify the dglort pointer */
  428. if (!dglort)
  429. return FM10K_ERR_PARAM;
  430. /* stub for now until we determine correct message for this */
  431. return 0;
  432. }
  433. /**
  434. * fm10k_adjust_systime_vf - Adjust systime frequency
  435. * @hw: pointer to hardware structure
  436. * @ppb: adjustment rate in parts per billion
  437. *
  438. * This function takes an adjustment rate in parts per billion and will
  439. * verify that this value is 0 as the VF cannot support adjusting the
  440. * systime clock.
  441. *
  442. * If the ppb value is non-zero the return is ERR_PARAM else success
  443. **/
  444. static s32 fm10k_adjust_systime_vf(struct fm10k_hw *hw, s32 ppb)
  445. {
  446. /* The VF cannot adjust the clock frequency, however it should
  447. * already have a syntonic clock with whichever host interface is
  448. * running as the master for the host interface clock domain so
  449. * there should be not frequency adjustment necessary.
  450. */
  451. return ppb ? FM10K_ERR_PARAM : 0;
  452. }
  453. /**
  454. * fm10k_read_systime_vf - Reads value of systime registers
  455. * @hw: pointer to the hardware structure
  456. *
  457. * Function reads the content of 2 registers, combined to represent a 64 bit
  458. * value measured in nanoseconds. In order to guarantee the value is accurate
  459. * we check the 32 most significant bits both before and after reading the
  460. * 32 least significant bits to verify they didn't change as we were reading
  461. * the registers.
  462. **/
  463. static u64 fm10k_read_systime_vf(struct fm10k_hw *hw)
  464. {
  465. u32 systime_l, systime_h, systime_tmp;
  466. systime_h = fm10k_read_reg(hw, FM10K_VFSYSTIME + 1);
  467. do {
  468. systime_tmp = systime_h;
  469. systime_l = fm10k_read_reg(hw, FM10K_VFSYSTIME);
  470. systime_h = fm10k_read_reg(hw, FM10K_VFSYSTIME + 1);
  471. } while (systime_tmp != systime_h);
  472. return ((u64)systime_h << 32) | systime_l;
  473. }
  474. static const struct fm10k_msg_data fm10k_msg_data_vf[] = {
  475. FM10K_TLV_MSG_TEST_HANDLER(fm10k_tlv_msg_test),
  476. FM10K_VF_MSG_MAC_VLAN_HANDLER(fm10k_msg_mac_vlan_vf),
  477. FM10K_VF_MSG_LPORT_STATE_HANDLER(fm10k_msg_lport_state_vf),
  478. FM10K_TLV_MSG_ERROR_HANDLER(fm10k_tlv_msg_error),
  479. };
  480. static const struct fm10k_mac_ops mac_ops_vf = {
  481. .get_bus_info = fm10k_get_bus_info_generic,
  482. .reset_hw = fm10k_reset_hw_vf,
  483. .init_hw = fm10k_init_hw_vf,
  484. .start_hw = fm10k_start_hw_generic,
  485. .stop_hw = fm10k_stop_hw_vf,
  486. .update_vlan = fm10k_update_vlan_vf,
  487. .read_mac_addr = fm10k_read_mac_addr_vf,
  488. .update_uc_addr = fm10k_update_uc_addr_vf,
  489. .update_mc_addr = fm10k_update_mc_addr_vf,
  490. .update_xcast_mode = fm10k_update_xcast_mode_vf,
  491. .update_int_moderator = fm10k_update_int_moderator_vf,
  492. .update_lport_state = fm10k_update_lport_state_vf,
  493. .update_hw_stats = fm10k_update_hw_stats_vf,
  494. .rebind_hw_stats = fm10k_rebind_hw_stats_vf,
  495. .configure_dglort_map = fm10k_configure_dglort_map_vf,
  496. .get_host_state = fm10k_get_host_state_generic,
  497. .adjust_systime = fm10k_adjust_systime_vf,
  498. .read_systime = fm10k_read_systime_vf,
  499. };
  500. static s32 fm10k_get_invariants_vf(struct fm10k_hw *hw)
  501. {
  502. fm10k_get_invariants_generic(hw);
  503. return fm10k_pfvf_mbx_init(hw, &hw->mbx, fm10k_msg_data_vf, 0);
  504. }
  505. const struct fm10k_info fm10k_vf_info = {
  506. .mac = fm10k_mac_vf,
  507. .get_invariants = fm10k_get_invariants_vf,
  508. .mac_ops = &mac_ops_vf,
  509. };