Lines Matching +full:hw +full:- +full:device +full:- +full:address

1 // SPDX-License-Identifier: GPL-2.0
2 /* Copyright(c) 2013 - 2019 Intel Corporation. */
8 * fm10k_stop_hw_vf - Stop Tx/Rx units
9 * @hw: pointer to hardware structure
12 static s32 fm10k_stop_hw_vf(struct fm10k_hw *hw) in fm10k_stop_hw_vf() argument
14 u8 *perm_addr = hw->mac.perm_addr; in fm10k_stop_hw_vf()
20 err = fm10k_stop_hw_generic(hw); in fm10k_stop_hw_vf()
24 /* If permanent address is set then we need to restore it */ in fm10k_stop_hw_vf()
36 tdlen = hw->mac.itr_scale << FM10K_TDLEN_ITR_SCALE_SHIFT; in fm10k_stop_hw_vf()
39 * update their base address registers in fm10k_stop_hw_vf()
41 for (i = 0; i < hw->mac.max_queues; i++) { in fm10k_stop_hw_vf()
42 fm10k_write_reg(hw, FM10K_TDBAL(i), bal); in fm10k_stop_hw_vf()
43 fm10k_write_reg(hw, FM10K_TDBAH(i), bah); in fm10k_stop_hw_vf()
44 fm10k_write_reg(hw, FM10K_RDBAL(i), bal); in fm10k_stop_hw_vf()
45 fm10k_write_reg(hw, FM10K_RDBAH(i), bah); in fm10k_stop_hw_vf()
46 /* Restore ITR scale in software-defined mechanism in TDLEN in fm10k_stop_hw_vf()
51 fm10k_write_reg(hw, FM10K_TDLEN(i), tdlen); in fm10k_stop_hw_vf()
58 * fm10k_reset_hw_vf - VF hardware reset
59 * @hw: pointer to hardware structure
64 static s32 fm10k_reset_hw_vf(struct fm10k_hw *hw) in fm10k_reset_hw_vf() argument
69 err = fm10k_stop_hw_vf(hw); in fm10k_reset_hw_vf()
71 hw->mac.reset_while_pending++; in fm10k_reset_hw_vf()
76 fm10k_write_reg(hw, FM10K_VFCTRL, FM10K_VFCTRL_RST); in fm10k_reset_hw_vf()
79 fm10k_write_flush(hw); in fm10k_reset_hw_vf()
83 fm10k_write_reg(hw, FM10K_VFCTRL, 0); in fm10k_reset_hw_vf()
84 if (fm10k_read_reg(hw, FM10K_VFCTRL) & FM10K_VFCTRL_RST) in fm10k_reset_hw_vf()
91 * fm10k_init_hw_vf - VF hardware initialization
92 * @hw: pointer to hardware structure
95 static s32 fm10k_init_hw_vf(struct fm10k_hw *hw) in fm10k_init_hw_vf() argument
97 u32 tqdloc, tqdloc0 = ~fm10k_read_reg(hw, FM10K_TQDLOC(0)); in fm10k_init_hw_vf()
102 if (!~fm10k_read_reg(hw, FM10K_TXQCTL(0)) || in fm10k_init_hw_vf()
103 !~fm10k_read_reg(hw, FM10K_RXQCTL(0))) { in fm10k_init_hw_vf()
111 tqdloc = ~fm10k_read_reg(hw, FM10K_TQDLOC(i)); in fm10k_init_hw_vf()
116 if (!~fm10k_read_reg(hw, FM10K_TXQCTL(i)) || in fm10k_init_hw_vf()
117 !~fm10k_read_reg(hw, FM10K_RXQCTL(i))) in fm10k_init_hw_vf()
122 err = fm10k_disable_queues_generic(hw, i); in fm10k_init_hw_vf()
127 hw->mac.max_queues = i; in fm10k_init_hw_vf()
130 hw->mac.default_vid = FIELD_GET(FM10K_TXQCTL_VID_MASK, in fm10k_init_hw_vf()
131 fm10k_read_reg(hw, FM10K_TXQCTL(0))); in fm10k_init_hw_vf()
136 hw->mac.itr_scale = FIELD_GET(FM10K_TDLEN_ITR_SCALE_MASK, in fm10k_init_hw_vf()
137 fm10k_read_reg(hw, FM10K_TDLEN(0))); in fm10k_init_hw_vf()
142 hw->mac.max_queues = 0; in fm10k_init_hw_vf()
158 * fm10k_update_vlan_vf - Update status of VLAN ID in VLAN filter table
159 * @hw: pointer to hardware structure
167 static s32 fm10k_update_vlan_vf(struct fm10k_hw *hw, u32 vid, u8 vsi, bool set) in fm10k_update_vlan_vf() argument
169 struct fm10k_mbx_info *mbx = &hw->mbx; in fm10k_update_vlan_vf()
189 return mbx->ops.enqueue_tx(hw, mbx, msg); in fm10k_update_vlan_vf()
193 * fm10k_msg_mac_vlan_vf - Read device MAC address from mailbox message
194 * @hw: pointer to the HW structure
198 * This function should determine the MAC address for the VF
200 s32 fm10k_msg_mac_vlan_vf(struct fm10k_hw *hw, u32 **results, in fm10k_msg_mac_vlan_vf() argument
207 /* record MAC address requested */ in fm10k_msg_mac_vlan_vf()
214 ether_addr_copy(hw->mac.perm_addr, perm_addr); in fm10k_msg_mac_vlan_vf()
215 hw->mac.default_vid = vid & (FM10K_VLAN_TABLE_VID_MAX - 1); in fm10k_msg_mac_vlan_vf()
216 hw->mac.vlan_override = !!(vid & FM10K_VLAN_OVERRIDE); in fm10k_msg_mac_vlan_vf()
222 * fm10k_read_mac_addr_vf - Read device MAC address
223 * @hw: pointer to the HW structure
225 * This function should determine the MAC address for the VF
227 static s32 fm10k_read_mac_addr_vf(struct fm10k_hw *hw) in fm10k_read_mac_addr_vf() argument
232 base_addr = fm10k_read_reg(hw, FM10K_TDBAL(0)); in fm10k_read_mac_addr_vf()
242 base_addr = fm10k_read_reg(hw, FM10K_TDBAH(0)); in fm10k_read_mac_addr_vf()
252 ether_addr_copy(hw->mac.perm_addr, perm_addr); in fm10k_read_mac_addr_vf()
253 ether_addr_copy(hw->mac.addr, perm_addr); in fm10k_read_mac_addr_vf()
259 * fm10k_update_uc_addr_vf - Update device unicast addresses
260 * @hw: pointer to the HW structure
262 * @mac: MAC address to add/remove from table
265 * @flags: flags field to indicate add and secure - unused
270 static s32 fm10k_update_uc_addr_vf(struct fm10k_hw *hw, in fm10k_update_uc_addr_vf() argument
275 struct fm10k_mbx_info *mbx = &hw->mbx; in fm10k_update_uc_addr_vf()
282 /* verify MAC address is valid */ in fm10k_update_uc_addr_vf()
286 /* verify we are not locked down on the MAC address */ in fm10k_update_uc_addr_vf()
287 if (is_valid_ether_addr(hw->mac.perm_addr) && in fm10k_update_uc_addr_vf()
288 !ether_addr_equal(hw->mac.perm_addr, mac)) in fm10k_update_uc_addr_vf()
300 return mbx->ops.enqueue_tx(hw, mbx, msg); in fm10k_update_uc_addr_vf()
304 * fm10k_update_mc_addr_vf - Update device multicast addresses
305 * @hw: pointer to the HW structure
307 * @mac: MAC address to add/remove from table
314 static s32 fm10k_update_mc_addr_vf(struct fm10k_hw *hw, in fm10k_update_mc_addr_vf() argument
318 struct fm10k_mbx_info *mbx = &hw->mbx; in fm10k_update_mc_addr_vf()
325 /* verify multicast address is valid */ in fm10k_update_mc_addr_vf()
339 return mbx->ops.enqueue_tx(hw, mbx, msg); in fm10k_update_mc_addr_vf()
343 * fm10k_update_int_moderator_vf - Request update of interrupt moderator list
344 * @hw: pointer to hardware structure
346 * This function will issue a request to the PF to rescan our MSI-X table
349 static void fm10k_update_int_moderator_vf(struct fm10k_hw *hw) in fm10k_update_int_moderator_vf() argument
351 struct fm10k_mbx_info *mbx = &hw->mbx; in fm10k_update_int_moderator_vf()
354 /* generate MSI-X request */ in fm10k_update_int_moderator_vf()
358 mbx->ops.enqueue_tx(hw, mbx, msg); in fm10k_update_int_moderator_vf()
370 * fm10k_msg_lport_state_vf - Message handler for lport_state message from PF
371 * @hw: Pointer to hardware structure
378 s32 fm10k_msg_lport_state_vf(struct fm10k_hw *hw, u32 **results, in fm10k_msg_lport_state_vf() argument
381 hw->mac.dglort_map = !results[FM10K_LPORT_STATE_MSG_READY] ? in fm10k_msg_lport_state_vf()
388 * fm10k_update_lport_state_vf - Update device state in lower device
389 * @hw: pointer to the HW structure
391 * @count: number of logical ports to enable - unused (always 1)
394 * Notify the lower device of a state change. If the lower device is
398 static s32 fm10k_update_lport_state_vf(struct fm10k_hw *hw, in fm10k_update_lport_state_vf() argument
402 struct fm10k_mbx_info *mbx = &hw->mbx; in fm10k_update_lport_state_vf()
406 hw->mac.dglort_map = FM10K_DGLORTMAP_NONE; in fm10k_update_lport_state_vf()
414 return mbx->ops.enqueue_tx(hw, mbx, msg); in fm10k_update_lport_state_vf()
418 * fm10k_update_xcast_mode_vf - Request update of multicast mode
419 * @hw: pointer to hardware structure
427 static s32 fm10k_update_xcast_mode_vf(struct fm10k_hw *hw, in fm10k_update_xcast_mode_vf() argument
430 struct fm10k_mbx_info *mbx = &hw->mbx; in fm10k_update_xcast_mode_vf()
441 return mbx->ops.enqueue_tx(hw, mbx, msg); in fm10k_update_xcast_mode_vf()
445 * fm10k_update_hw_stats_vf - Updates hardware related statistics of VF
446 * @hw: pointer to hardware structure
451 static void fm10k_update_hw_stats_vf(struct fm10k_hw *hw, in fm10k_update_hw_stats_vf() argument
454 fm10k_update_hw_stats_q(hw, stats->q, 0, hw->mac.max_queues); in fm10k_update_hw_stats_vf()
458 * fm10k_rebind_hw_stats_vf - Resets base for hardware statistics of VF
459 * @hw: pointer to hardware structure
464 static void fm10k_rebind_hw_stats_vf(struct fm10k_hw *hw, in fm10k_rebind_hw_stats_vf() argument
468 fm10k_unbind_hw_stats_q(stats->q, 0, hw->mac.max_queues); in fm10k_rebind_hw_stats_vf()
471 fm10k_update_hw_stats_vf(hw, stats); in fm10k_rebind_hw_stats_vf()
475 * fm10k_configure_dglort_map_vf - Configures GLORT entry and queues
476 * @hw: pointer to hardware structure
483 static s32 fm10k_configure_dglort_map_vf(struct fm10k_hw __always_unused *hw, in fm10k_configure_dglort_map_vf() argument
521 static s32 fm10k_get_invariants_vf(struct fm10k_hw *hw) in fm10k_get_invariants_vf() argument
523 fm10k_get_invariants_generic(hw); in fm10k_get_invariants_vf()
525 return fm10k_pfvf_mbx_init(hw, &hw->mbx, fm10k_msg_data_vf, 0); in fm10k_get_invariants_vf()