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

Function ixgbevf_get_queues

dpdk/drivers/net/ixgbe/base/ixgbe_vf.c:696–751  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

694}
695
696int ixgbevf_get_queues(struct ixgbe_hw *hw, unsigned int *num_tcs,
697 unsigned int *default_tc)
698{
699 int err;
700 u32 msg[5];
701
702 /* do nothing if API doesn't support ixgbevf_get_queues */
703 switch (hw->api_version) {
704 case ixgbe_mbox_api_11:
705 case ixgbe_mbox_api_12:
706 case ixgbe_mbox_api_13:
707 break;
708 default:
709 return 0;
710 }
711
712 /* Fetch queue configuration from the PF */
713 msg[0] = IXGBE_VF_GET_QUEUES;
714 msg[1] = msg[2] = msg[3] = msg[4] = 0;
715
716 err = ixgbevf_write_msg_read_ack(hw, msg, msg, 5);
717 if (!err) {
718 msg[0] &= ~IXGBE_VT_MSGTYPE_CTS;
719
720 /*
721 * if we we didn't get an ACK there must have been
722 * some sort of mailbox error so we should treat it
723 * as such
724 */
725 if (msg[0] != (IXGBE_VF_GET_QUEUES | IXGBE_VT_MSGTYPE_ACK))
726 return IXGBE_ERR_MBX;
727
728 /* record and validate values from message */
729 hw->mac.max_tx_queues = msg[IXGBE_VF_TX_QUEUES];
730 if (hw->mac.max_tx_queues == 0 ||
731 hw->mac.max_tx_queues > IXGBE_VF_MAX_TX_QUEUES)
732 hw->mac.max_tx_queues = IXGBE_VF_MAX_TX_QUEUES;
733
734 hw->mac.max_rx_queues = msg[IXGBE_VF_RX_QUEUES];
735 if (hw->mac.max_rx_queues == 0 ||
736 hw->mac.max_rx_queues > IXGBE_VF_MAX_RX_QUEUES)
737 hw->mac.max_rx_queues = IXGBE_VF_MAX_RX_QUEUES;
738
739 *num_tcs = msg[IXGBE_VF_TRANS_VLAN];
740 /* in case of unknown state assume we cannot tag frames */
741 if (*num_tcs > hw->mac.max_rx_queues)
742 *num_tcs = 1;
743
744 *default_tc = msg[IXGBE_VF_DEF_QUEUE];
745 /* default to queue 0 on out-of-bounds queue number */
746 if (*default_tc >= hw->mac.max_tx_queues)
747 *default_tc = 0;
748 }
749
750 return err;
751}

Callers 1

eth_ixgbevf_dev_initFunction · 0.85

Calls 1

Tested by

no test coverage detected