dpdk helloworld代码分析

来源:互联网 发布:php 接口文档管理系统 编辑:程序博客网 时间:2024/05/21 11:06
 
intmain(int argc, char **argv){        int ret;        unsigned lcore_id;        ret = rte_eal_init(argc, argv);        if (ret < 0)                rte_panic("Cannot init EAL\n");        /* call lcore_hello() on every slave lcore */        RTE_LCORE_FOREACH_SLAVE(lcore_id) {                rte_eal_remote_launch(lcore_hello, NULL, lcore_id);        }        /* call it on master lcore too */        lcore_hello(NULL);        rte_eal_mp_wait_lcore();        return 0;}
static intlcore_hello(__attribute__((unused)) void *arg){        unsigned lcore_id;        lcore_id = rte_lcore_id();        printf("hello from core %u\n", lcore_id);        return 0;}


image

代码首先初始化了Environment Abstraction Layer(EAL),EAL主要提供了以下功能

• Intel® DPDK loading and launching• Support for multi-process and multi-thread execution types• Core affinity/assignment procedures• System memory allocation/de-allocation• Atomic/lock operations• Time reference• PCI bus access• Trace and debug functions• CPU feature identification• Interrupt handling• Alarm operations


http://www.cnblogs.com/chanwai1219/p/3632263.html


0 0
原创粉丝点击