| 822 | } |
| 823 | |
| 824 | static int |
| 825 | ixgbe_rcv_msg_from_vf(struct rte_eth_dev *dev, uint16_t vf) |
| 826 | { |
| 827 | uint16_t mbx_size = IXGBE_VFMAILBOX_SIZE; |
| 828 | uint16_t msg_size = IXGBE_VF_MSG_SIZE_DEFAULT; |
| 829 | uint32_t msgbuf[IXGBE_VFMAILBOX_SIZE]; |
| 830 | int32_t retval; |
| 831 | struct ixgbe_hw *hw = IXGBE_DEV_PRIVATE_TO_HW(dev->data->dev_private); |
| 832 | struct ixgbe_vf_info *vfinfo = |
| 833 | *IXGBE_DEV_PRIVATE_TO_P_VFDATA(dev->data->dev_private); |
| 834 | struct rte_pmd_ixgbe_mb_event_param ret_param; |
| 835 | |
| 836 | retval = ixgbe_read_mbx(hw, msgbuf, mbx_size, vf); |
| 837 | if (retval) { |
| 838 | PMD_DRV_LOG(ERR, "Error mbx recv msg from VF %d", vf); |
| 839 | return retval; |
| 840 | } |
| 841 | |
| 842 | /* do nothing with the message already been processed */ |
| 843 | if (msgbuf[0] & (IXGBE_VT_MSGTYPE_ACK | IXGBE_VT_MSGTYPE_NACK)) |
| 844 | return retval; |
| 845 | |
| 846 | /* flush the ack before we write any messages back */ |
| 847 | IXGBE_WRITE_FLUSH(hw); |
| 848 | |
| 849 | /** |
| 850 | * initialise structure to send to user application |
| 851 | * will return response from user in retval field |
| 852 | */ |
| 853 | ret_param.retval = RTE_PMD_IXGBE_MB_EVENT_PROCEED; |
| 854 | ret_param.vfid = vf; |
| 855 | ret_param.msg_type = msgbuf[0] & 0xFFFF; |
| 856 | ret_param.msg = (void *)msgbuf; |
| 857 | |
| 858 | /* perform VF reset */ |
| 859 | if (msgbuf[0] == IXGBE_VF_RESET) { |
| 860 | int ret = ixgbe_vf_reset(dev, vf, msgbuf); |
| 861 | |
| 862 | vfinfo[vf].clear_to_send = true; |
| 863 | |
| 864 | /* notify application about VF reset */ |
| 865 | rte_eth_dev_callback_process(dev, RTE_ETH_EVENT_VF_MBOX, |
| 866 | &ret_param); |
| 867 | return ret; |
| 868 | } |
| 869 | |
| 870 | /** |
| 871 | * ask user application if we allowed to perform those functions |
| 872 | * if we get ret_param.retval == RTE_PMD_IXGBE_MB_EVENT_PROCEED |
| 873 | * then business as usual, |
| 874 | * if 0, do nothing and send ACK to VF |
| 875 | * if ret_param.retval > 1, do nothing and send NAK to VF |
| 876 | */ |
| 877 | rte_eth_dev_callback_process(dev, RTE_ETH_EVENT_VF_MBOX, &ret_param); |
| 878 | |
| 879 | retval = ret_param.retval; |
| 880 | |
| 881 | /* check & process VF to PF mailbox message */ |
no test coverage detected