[dpdk-dev] [PATCH 1/2] ixgbe: VF supports mailbox interruption for PF link up/down
Wu, Jingjing
jingjing.wu at intel.com
Fri May 27 10:31:07 CEST 2016
> +static void ixgbevf_mbx_process(struct rte_eth_dev *dev) {
> + struct ixgbe_hw *hw = IXGBE_DEV_PRIVATE_TO_HW(dev->data-
> >dev_private);
> + u32 in_msg = 0;
> +
> + if (ixgbe_read_mbx(hw, &in_msg, 1, 0))
> + return;
> +
> + /* PF reset VF event */
> + if (in_msg == IXGBE_PF_CONTROL_MSG)
> + _rte_eth_dev_callback_process(dev,
> RTE_ETH_EVENT_INTR_RESET); }
> +
RTE_ETH_EVENT_INTR_RESET is used for PF reset event reporting,
and this patch is to support PF link change. Maybe
RTE_ETH_EVENT_INTR_LSC should be used here instead.
Or you need to distinguish which control message is coming from PF.
> +static int
> +ixgbevf_dev_interrupt_get_status(struct rte_eth_dev *dev) {
> + uint32_t eicr;
> + struct ixgbe_hw *hw = IXGBE_DEV_PRIVATE_TO_HW(dev->data-
> >dev_private);
> + struct ixgbe_interrupt *intr =
> + IXGBE_DEV_PRIVATE_TO_INTR(dev->data->dev_private);
> + ixgbevf_intr_disable(hw);
> +
> + /* read-on-clear nic registers here */
> + eicr = IXGBE_READ_REG(hw, IXGBE_VTEICR);
> + intr->flags = 0;
> +
> + /* only one misc vector supported - mailbox */
> + eicr &= IXGBE_VTEICR_MASK;
> + if (eicr == IXGBE_MISC_VEC_ID)
> + intr->flags |= IXGBE_FLAG_MAILBOX;
> +
> + return 0;
> +}
> +
> +static int
> +ixgbevf_dev_interrupt_action(struct rte_eth_dev *dev) {
> + struct ixgbe_hw *hw = IXGBE_DEV_PRIVATE_TO_HW(dev->data-
> >dev_private);
> + struct ixgbe_interrupt *intr =
> + IXGBE_DEV_PRIVATE_TO_INTR(dev->data->dev_private);
> +
> + if (intr->flags & IXGBE_FLAG_MAILBOX) {
> + ixgbevf_mbx_process(dev);
> + intr->flags &= ~IXGBE_FLAG_MAILBOX;
> + }
> +
> + ixgbevf_intr_enable(hw);
> +
> + return 0;
> +}
For the readability, it's better to put ixgbevf_intr_disable and ixgbevf_intr_enable
in the same function, for example, at the beginning and ending of
ixgbevf_dev_interrupt_handler.
Thanks
Jingjing
More information about the dev
mailing list