412 * @mbx_id: id of mailbox to write
413 *
414 * returns SUCCESS if it successfully copied message into the buffer
415 **/
416 static s32 ixgbe_write_mbx_vf(struct ixgbe_hw *hw, u32 *msg, u16 size,
417 u16 mbx_id)
418 {
419 s32 ret_val;
420 u16 i;
421
422 UNREFERENCED_1PARAMETER(mbx_id);
423
424 DEBUGFUNC("ixgbe_write_mbx_vf");
425
426 /* lock the mailbox to prevent pf/vf race condition */
427 ret_val = ixgbe_obtain_mbx_lock_vf(hw);
428 if (ret_val)
429 goto out_no_write;
430
431 /* flush msg and acks as we are overwriting the message buffer */
432 ixgbe_check_for_msg_vf(hw, 0);
433 ixgbe_check_for_ack_vf(hw, 0);
434
435 /* copy the caller specified message to the mailbox memory buffer */
436 for (i = 0; i < size; i++)
437 IXGBE_WRITE_REG_ARRAY(hw, IXGBE_VFMBMEM, i, msg[i]);
438
439 /* update stats */
440 hw->mbx.stats.msgs_tx++;
441
442 /* Drop VFU and interrupt the PF to tell it a message has been sent */
443 IXGBE_WRITE_REG(hw, IXGBE_VFMAILBOX, IXGBE_VFMAILBOX_REQ);
444
445 out_no_write:
446 return ret_val;
447 }
448
449 /**
450 * ixgbe_read_mbx_vf - Reads a message from the inbox intended for vf
451 * @hw: pointer to the HW structure
452 * @msg: The message buffer
453 * @size: Length of buffer
643 * @msg: The message buffer
644 * @size: Length of buffer
645 * @vf_number: the VF index
646 *
647 * returns SUCCESS if it successfully copied message into the buffer
648 **/
649 static s32 ixgbe_write_mbx_pf(struct ixgbe_hw *hw, u32 *msg, u16 size,
650 u16 vf_number)
651 {
652 s32 ret_val;
653 u16 i;
654
655 DEBUGFUNC("ixgbe_write_mbx_pf");
656
657 /* lock the mailbox to prevent pf/vf race condition */
658 ret_val = ixgbe_obtain_mbx_lock_pf(hw, vf_number);
659 if (ret_val)
660 goto out_no_write;
661
662 /* flush msg and acks as we are overwriting the message buffer */
663 ixgbe_check_for_msg_pf(hw, vf_number);
664 ixgbe_check_for_ack_pf(hw, vf_number);
665
666 /* copy the caller specified message to the mailbox memory buffer */
667 for (i = 0; i < size; i++)
668 IXGBE_WRITE_REG_ARRAY(hw, IXGBE_PFMBMEM(vf_number), i, msg[i]);
669
670 /* Interrupt VF to tell it a message has been sent and release buffer*/
671 IXGBE_WRITE_REG(hw, IXGBE_PFMAILBOX(vf_number), IXGBE_PFMAILBOX_STS);
672
673 /* update stats */
674 hw->mbx.stats.msgs_tx++;
675
676 out_no_write:
677 return ret_val;
678
679 }
680
681 /**
682 * ixgbe_read_mbx_pf - Read a message from the mailbox
683 * @hw: pointer to the HW structure
684 * @msg: The message buffer
|
412 * @mbx_id: id of mailbox to write
413 *
414 * returns SUCCESS if it successfully copied message into the buffer
415 **/
416 static s32 ixgbe_write_mbx_vf(struct ixgbe_hw *hw, u32 *msg, u16 size,
417 u16 mbx_id)
418 {
419 s32 ret_val;
420 u16 i;
421
422 UNREFERENCED_1PARAMETER(mbx_id);
423
424 DEBUGFUNC("ixgbe_write_mbx_vf");
425
426 /* lock the mailbox to prevent pf/vf race condition */
427 ret_val = ixgbe_obtain_mbx_lock_vf(hw);
428 if (ret_val)
429 goto out_no_write;
430
431 /* flush msg and acks as we are overwriting the message buffer */
432 ret_val = ixgbe_check_for_msg_vf(hw, 0);
433 if (ret_val)
434 goto out_no_write;
435 ret_val = ixgbe_check_for_ack_vf(hw, 0);
436 if (ret_val)
437 goto out_no_write;
438
439 /* copy the caller specified message to the mailbox memory buffer */
440 for (i = 0; i < size; i++)
441 IXGBE_WRITE_REG_ARRAY(hw, IXGBE_VFMBMEM, i, msg[i]);
442
443 /* update stats */
444 hw->mbx.stats.msgs_tx++;
445
446 /* Drop VFU and interrupt the PF to tell it a message has been sent */
447 IXGBE_WRITE_REG(hw, IXGBE_VFMAILBOX, IXGBE_VFMAILBOX_REQ);
448
449 out_no_write:
450 return ret_val;
451 }
452
453 /**
454 * ixgbe_read_mbx_vf - Reads a message from the inbox intended for vf
455 * @hw: pointer to the HW structure
456 * @msg: The message buffer
457 * @size: Length of buffer
647 * @msg: The message buffer
648 * @size: Length of buffer
649 * @vf_number: the VF index
650 *
651 * returns SUCCESS if it successfully copied message into the buffer
652 **/
653 static s32 ixgbe_write_mbx_pf(struct ixgbe_hw *hw, u32 *msg, u16 size,
654 u16 vf_number)
655 {
656 s32 ret_val;
657 u16 i;
658
659 DEBUGFUNC("ixgbe_write_mbx_pf");
660
661 /* lock the mailbox to prevent pf/vf race condition */
662 ret_val = ixgbe_obtain_mbx_lock_pf(hw, vf_number);
663 if (ret_val)
664 goto out_no_write;
665
666 /* flush msg and acks as we are overwriting the message buffer */
667 ret_val = ixgbe_check_for_msg_vf(hw, 0);
668 if (ret_val)
669 goto out_no_write;
670 ret_val = ixgbe_check_for_ack_vf(hw, 0);
671 if (ret_val)
672 goto out_no_write;
673
674 /* copy the caller specified message to the mailbox memory buffer */
675 for (i = 0; i < size; i++)
676 IXGBE_WRITE_REG_ARRAY(hw, IXGBE_PFMBMEM(vf_number), i, msg[i]);
677
678 /* Interrupt VF to tell it a message has been sent and release buffer*/
679 IXGBE_WRITE_REG(hw, IXGBE_PFMAILBOX(vf_number), IXGBE_PFMAILBOX_STS);
680
681 /* update stats */
682 hw->mbx.stats.msgs_tx++;
683
684 out_no_write:
685 return ret_val;
686
687 }
688
689 /**
690 * ixgbe_read_mbx_pf - Read a message from the mailbox
691 * @hw: pointer to the HW structure
692 * @msg: The message buffer
|