zoukankan      html  css  js  c++  java
  • dpdk disable 收发 interrupt + l3fwd-power

    rte_eth_dev_rx_intr_disable(uint16_t port_id,
                                uint16_t queue_id)
    {
            struct rte_eth_dev *dev;
    
            RTE_ETH_VALID_PORTID_OR_ERR_RET(port_id, -ENODEV);
    
            dev = &rte_eth_devices[port_id];
    
            RTE_FUNC_PTR_OR_ERR_RET(*dev->dev_ops->rx_queue_intr_disable, -ENOTSUP);
            return eth_err(port_id, (*dev->dev_ops->rx_queue_intr_disable)(dev,
                                                                    queue_id));
    }
    ixgbe_dev_rx_queue_intr_disable(struct rte_eth_dev *dev, uint16_t queue_id)
    {
            uint32_t mask;
            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 (queue_id < 16) {
                    ixgbe_disable_intr(hw);
                    intr->mask &= ~(1 << queue_id);
                    ixgbe_enable_intr(dev);
            } else if (queue_id < 32) {
                    mask = IXGBE_READ_REG(hw, IXGBE_EIMS_EX(0));
                    mask &= ~(1 << queue_id);
                    IXGBE_WRITE_REG(hw, IXGBE_EIMS_EX(0), mask);
            } else if (queue_id < 64) {
                    mask = IXGBE_READ_REG(hw, IXGBE_EIMS_EX(1));
                    mask &= ~(1 << (queue_id - 32));
                    IXGBE_WRITE_REG(hw, IXGBE_EIMS_EX(1), mask);
            }
    
            return 0;
    }
    l3fwd-power
    普通的DPDK是采用的PMD模式,也就是轮询模式,这种模式下无论是否有报文处理,都是采用的轮询也就是CPU占用率100%;
    L3FWD-power就是为了解决这个问题,当CPU根本就不需要处理报文的时候进入省电模式也就是中断模式;
    使用者可以根据自己的策略来决定于什么时候用轮询什么时候用中断模式;
    这种模式叫做DPDK的混合中断轮询机制,是基于UIO或者VFIO来实现的。
    
    流程:
    
    
    轮询模式实际上就是我们常常看到L2FWD这一类的PMD的例子。
    中断模式是采用了epoll的方式来实现的。
    通过rte_eth_dev_rx_intr_ctl_q注册事件回调;
    在rte_eal_init的时候创建一个中断线程。rte_eal_intr_init里面去创建一个epoll的线程;来实现的
    
    在L3FWD-power中关于power也就是中断模式的函数列表:
    rte_power_init
    event_register->rte_eth_dev_rx_intr_ctl_q
    power_idle_heuristic获取网卡状态数据1
    power_freq_scaleup_heuristic获取网卡状态数据2
    turn_on_intr->rte_eth_dev_rx_intr_enable
    sleep_until_rx_interrupt->rte_epoll_wait/rte_eth_dev_rx_intr_disable
  • 相关阅读:
    [js高手之路] html5新增的定时器requestAnimationFrame实战进度条
    [js高手之路] html5 canvas系列教程
    [js高手之路] html5 canvas系列教程
    [js高手之路] html5 canvas系列教程
    [js高手之路] html5 canvas系列教程
    [js高手之路] html5 canvas系列教程
    [js高手之路] html5 canvas系列教程
    [js高手之路] html5 canvas系列教程
    [js高手之路] html5 canvas系列教程
    [js高手之路] html5 canvas系列教程
  • 原文地址:https://www.cnblogs.com/dream397/p/13567340.html
Copyright © 2011-2022 走看看