MCPcopy Create free account
hub / github.com/F-Stack/f-stack / ngbe_rcv_msg_from_vf

Function ngbe_rcv_msg_from_vf

dpdk/drivers/net/ngbe/ngbe_pf.c:621–728  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

619}
620
621static int
622ngbe_rcv_msg_from_vf(struct rte_eth_dev *eth_dev, uint16_t vf)
623{
624 uint16_t mbx_size = NGBE_P2VMBX_SIZE;
625 uint16_t msg_size = NGBE_VF_MSG_SIZE_DEFAULT;
626 uint32_t msgbuf[NGBE_P2VMBX_SIZE];
627 int32_t retval;
628 struct ngbe_hw *hw = ngbe_dev_hw(eth_dev);
629 struct ngbe_vf_info *vfinfo = *NGBE_DEV_VFDATA(eth_dev);
630 struct ngbe_mb_event_param ret_param;
631
632 retval = ngbe_read_mbx(hw, msgbuf, mbx_size, vf);
633 if (retval) {
634 PMD_DRV_LOG(ERR, "Error mbx recv msg from VF %d", vf);
635 return retval;
636 }
637
638 /* do nothing with the message already been processed */
639 if (msgbuf[0] & (NGBE_VT_MSGTYPE_ACK | NGBE_VT_MSGTYPE_NACK))
640 return retval;
641
642 /* flush the ack before we write any messages back */
643 ngbe_flush(hw);
644
645 /**
646 * initialise structure to send to user application
647 * will return response from user in retval field
648 */
649 ret_param.retval = NGBE_MB_EVENT_PROCEED;
650 ret_param.vfid = vf;
651 ret_param.msg_type = msgbuf[0] & 0xFFFF;
652 ret_param.msg = (void *)msgbuf;
653
654 /* perform VF reset */
655 if (msgbuf[0] == NGBE_VF_RESET) {
656 int ret = ngbe_vf_reset(eth_dev, vf, msgbuf);
657
658 vfinfo[vf].clear_to_send = true;
659
660 /* notify application about VF reset */
661 rte_eth_dev_callback_process(eth_dev, RTE_ETH_EVENT_VF_MBOX,
662 &ret_param);
663 return ret;
664 }
665
666 /**
667 * ask user application if we allowed to perform those functions
668 * if we get ret_param.retval == RTE_PMD_COMPAT_MB_EVENT_PROCEED
669 * then business as usual,
670 * if 0, do nothing and send ACK to VF
671 * if ret_param.retval > 1, do nothing and send NAK to VF
672 */
673 rte_eth_dev_callback_process(eth_dev, RTE_ETH_EVENT_VF_MBOX,
674 &ret_param);
675
676 retval = ret_param.retval;
677
678 /* check & process VF to PF mailbox message */

Callers 1

ngbe_pf_mbx_processFunction · 0.85

Calls 13

ngbe_dev_hwFunction · 0.85
ngbe_read_mbxFunction · 0.85
ngbe_vf_resetFunction · 0.85
ngbe_vf_set_mac_addrFunction · 0.85
ngbe_vf_set_multicastFunction · 0.85
ngbe_set_vf_lpeFunction · 0.85
ngbe_vf_set_vlanFunction · 0.85
ngbe_negotiate_vf_apiFunction · 0.85
ngbe_get_vf_queuesFunction · 0.85
ngbe_set_vf_mc_promiscFunction · 0.85
ngbe_set_vf_macvlan_msgFunction · 0.85

Tested by

no test coverage detected