zoukankan      html  css  js  c++  java
  • rte_mempool_get与ring enqueue/dequeue

    rte_mempool_create
            if ((flags & MEMPOOL_F_SP_PUT) && (flags & MEMPOOL_F_SC_GET))
                    ret = rte_mempool_set_ops_byname(mp, "ring_sp_sc", NULL);
            else if (flags & MEMPOOL_F_SP_PUT)
                    ret = rte_mempool_set_ops_byname(mp, "ring_sp_mc", NULL);
            else if (flags & MEMPOOL_F_SC_GET)
                    ret = rte_mempool_set_ops_byname(mp, "ring_mp_sc", NULL);
            else
                    ret = rte_mempool_set_ops_byname(mp, "ring_mp_mc", NULL);
    
    rte_mempool_register_ops(const struct rte_mempool_ops *h)
    
    
    static const struct rte_mempool_ops ops_mp_mc = {
        .name = "ring_mp_mc", /* 多生产者多消费者 */
        .alloc = common_ring_alloc,
        .free = common_ring_free,
        .enqueue = common_ring_mp_enqueue,
        .dequeue = common_ring_mc_dequeue,
        .get_count = common_ring_get_count,
    };
     
    static const struct rte_mempool_ops ops_sp_sc = {
        .name = "ring_sp_sc", /* 单生产者单消费者 */
        .alloc = common_ring_alloc,
        .free = common_ring_free,
        .enqueue = common_ring_sp_enqueue,
        .dequeue = common_ring_sc_dequeue,
        .get_count = common_ring_get_count,
    };
      
    static const struct rte_mempool_ops ops_mp_sc = {
        .name = "ring_mp_sc", /* 多生产者单消费者 */
        .alloc = common_ring_alloc,
        .free = common_ring_free,
        .enqueue = common_ring_mp_enqueue,
        .dequeue = common_ring_sc_dequeue,
        .get_count = common_ring_get_count,
    };
     
    static const struct rte_mempool_ops ops_sp_mc = {
        .name = "ring_sp_mc", /* 单生产者多消费者 */
        .alloc = common_ring_alloc,
        .free = common_ring_free,
        .enqueue = common_ring_sp_enqueue,
        .dequeue = common_ring_mc_dequeue,
        .get_count = common_ring_get_count,
    };
     
    /* 注册以上 4 组 mempool 处理函数 */
    MEMPOOL_REGISTER_OPS(ops_mp_mc);
    MEMPOOL_REGISTER_OPS(ops_sp_sc);
    MEMPOOL_REGISTER_OPS(ops_mp_sc);
    MEMPOOL_REGISTER_OPS(ops_sp_mc);
    
    
    
    common_ring_mc_dequeue(struct rte_mempool *mp, void **obj_table, unsigned n)
    {
            return rte_ring_mc_dequeue_bulk(mp->pool_data,
                            obj_table, n, NULL) == 0 ? -ENOBUFS : 0;
    }
    
    rte_ring_mc_dequeue_bulk(struct rte_ring *r, void **obj_table,
                    unsigned int n, unsigned int *available)
    {
            return __rte_ring_do_dequeue(r, obj_table, n, RTE_RING_QUEUE_FIXED,
                            __IS_MC, available);
    }
    __mempool_generic_get
          rte_mempool_ops_dequeue_bulk
    
    rte_mempool_ops_dequeue_bulk(struct rte_mempool *mp,
                    void **obj_table, unsigned n)
    {
            struct rte_mempool_ops *ops;
    
            ops = rte_mempool_get_ops(mp->ops_index);
            return ops->dequeue(mp, obj_table, n);
    }
    
    static inline struct rte_mempool_ops *
    rte_mempool_get_ops(int ops_index)
    {
            RTE_VERIFY((ops_index >= 0) && (ops_index < RTE_MEMPOOL_MAX_OPS_IDX));
    
            return &rte_mempool_ops_table.ops[ops_index];
    }
  • 相关阅读:
    tomcat虚拟目录配置
    关于JS闭包
    数据列表里结合负边距做间隔线的技巧需注意的小细节
    前端优化技巧笔记
    浏览器工作原理相关笔记
    工作小心得(关于绝对定位元素)
    关于定位和溢出处理的一些小经历
    关于定位和z-index的一些小经历
    fullpage实现(-)
    移动端布局-实例
  • 原文地址:https://www.cnblogs.com/dream397/p/13667954.html
Copyright © 2011-2022 走看看