28 #include <linux/pci.h>
53 ret_val = mbx->
ops.read(hw, msg, size, mbx_id);
75 else if (mbx->
ops.write)
76 ret_val = mbx->
ops.write(hw, msg, size, mbx_id);
93 if (mbx->
ops.check_for_msg)
94 ret_val = mbx->
ops.check_for_msg(hw, mbx_id);
111 if (mbx->
ops.check_for_ack)
112 ret_val = mbx->
ops.check_for_ack(hw, mbx_id);
129 if (mbx->
ops.check_for_rst)
130 ret_val = mbx->
ops.check_for_rst(hw, mbx_id);
147 if (!countdown || !mbx->
ops.check_for_msg)
150 while (countdown && mbx->
ops.check_for_msg(hw, mbx_id)) {
173 if (!countdown || !mbx->
ops.check_for_ack)
176 while (countdown && mbx->
ops.check_for_ack(hw, mbx_id)) {
206 ret_val = ixgbe_poll_for_msg(hw, mbx_id);
210 ret_val = mbx->
ops.read(hw, msg, size, mbx_id);
236 ret_val = mbx->
ops.write(hw, msg, size, mbx_id);
240 ret_val = ixgbe_poll_for_ack(hw, mbx_id);
250 if (mbvficr & mask) {
265 static s32 ixgbe_check_for_msg_pf(
struct ixgbe_hw *hw,
u16 vf_number)
269 u32 vf_bit = vf_number % 16;
274 hw->
mbx.stats.reqs++;
287 static s32 ixgbe_check_for_ack_pf(
struct ixgbe_hw *hw,
u16 vf_number)
291 u32 vf_bit = vf_number % 16;
296 hw->
mbx.stats.acks++;
309 static s32 ixgbe_check_for_rst_pf(
struct ixgbe_hw *hw,
u16 vf_number)
311 u32 reg_offset = (vf_number < 32) ? 0 : 1;
312 u32 vf_shift = vf_number % 32;
316 switch (hw->
mac.type) {
327 if (vflre & (1 << vf_shift)) {
330 hw->
mbx.stats.rsts++;
343 static s32 ixgbe_obtain_mbx_lock_pf(
struct ixgbe_hw *hw,
u16 vf_number)
375 ret_val = ixgbe_obtain_mbx_lock_pf(hw, vf_number);
380 ixgbe_check_for_msg_pf(hw, vf_number);
381 ixgbe_check_for_ack_pf(hw, vf_number);
384 for (i = 0; i <
size; i++)
391 hw->
mbx.stats.msgs_tx++;
416 ret_val = ixgbe_obtain_mbx_lock_pf(hw, vf_number);
421 for (i = 0; i <
size; i++)
428 hw->
mbx.stats.msgs_rx++;
434 #ifdef CONFIG_PCI_IOV
441 void ixgbe_init_mbx_params_pf(
struct ixgbe_hw *hw)
452 mbx->
stats.msgs_tx = 0;
453 mbx->
stats.msgs_rx = 0;
463 .read = ixgbe_read_mbx_pf,
464 .write = ixgbe_write_mbx_pf,
465 .read_posted = ixgbe_read_posted_mbx,
466 .write_posted = ixgbe_write_posted_mbx,
467 .check_for_msg = ixgbe_check_for_msg_pf,
468 .check_for_ack = ixgbe_check_for_ack_pf,
469 .check_for_rst = ixgbe_check_for_rst_pf,