can not run a dpdk test program on an installed machine

45 views Asked by At

I am using dpdk-21.11.5.tar.xz to run my own test program.

It runs well in my compiling environment, an then I made a tar.gz, and install it on an other machine, and I get an error:

EAL: Error - exiting with code: 1
  Cause: Interface "0000:02:02.0": No such device

dpdk-testpmd can run well:

[root@bogon bin]# ./dpdk-testpmd -- --forward-mode=rxonly -i
EAL: Detected CPU lcores: 2
EAL: Detected NUMA nodes: 1
EAL: Detected static linkage of DPDK
EAL: Multi-process socket /var/run/dpdk/rte/mp_socket
EAL: Selected IOVA mode 'PA'
EAL: No available 1048576 kB hugepages reported
EAL: Probe PCI driver: net_e1000_em (8086:100f) device: 0000:02:02.0 (socket 0)
Set rxonly packet forwarding mode
Interactive-mode selected
EAL: Error reading from file descriptor 19: Input/output error
testpmd: create a new mbuf pool <mb_pool_0>: n=155456, size=2176, socket=0
testpmd: preferred mempool ops selected: ring_mp_mc

Warning! port-topology=paired and odd forward ports number, the last port will pair with itself.

Configuring Port 0 (socket 0)
EAL: Error enabling interrupts for fd 19 (Input/output error)
Port 0: 00:0C:29:CE:18:C5
Checking link statuses...
Done
testpmd> start

I build dpdk using: meson -Dprefix=/usr/local/dpdk -Dexamples=all -Dmachine=corei7 build

my test program is as follow(only main):

int
main(int argc, char *argv[])
{
    struct rte_mempool *mbuf_pool;
    unsigned nb_ports = 1;
    uint16_t portid;

    char * dev_name = "0000:1a:00.2";
    //char * dev_name = "0000:02:02.0";
    printf("before rte_eal_init\n");
    /* Initialize the Environment Abstraction Layer (EAL). */
    int ret = rte_eal_init(argc, argv);
    if (ret < 0)
        rte_exit(EXIT_FAILURE, "Error with EAL initialization\n");
    printf("after rte_eal_init\n");

    argc -= ret;
    argv += ret;

    printf("before rte_eth_dev_get_port_by_name\n");
    ret = rte_eth_dev_get_port_by_name(dev_name, &portid);
    if(ret < 0) {
        rte_exit(EXIT_FAILURE, "Interface \"%s\": %s\n", dev_name, rte_strerror(-ret));
    }
    printf("devname:%s, portid:%d\n", dev_name, portid);
    
    /* Creates a new mempool in memory to hold the mbufs. */
    mbuf_pool = rte_pktmbuf_pool_create("MBUF_POOL", NUM_MBUFS * nb_ports,
        MBUF_CACHE_SIZE, 0, RTE_MBUF_DEFAULT_BUF_SIZE, rte_socket_id());

    if (mbuf_pool == NULL)
        rte_exit(EXIT_FAILURE, "Cannot create mbuf pool\n");

    /* Initialize all ports. */
    for (portid = 0; portid < nb_ports; portid++)
        if (port_init(portid, mbuf_pool) != 0)
            rte_exit(EXIT_FAILURE, "Cannot init port %"PRIu16 "\n",
                    portid);

    if (rte_lcore_count() > 1)
        printf("\nWARNING: Too many lcores enabled. Only 1 used.\n");

    /* Call lcore_main on the master core only. */
    lcore_main();

    return 0;
}

and the Makefile is:

PKGCONF = pkg-config

APP = dpdk-test

SRCS-y := dpdk-test.c

CFLAGS += -O3 $(shell $(PKGCONF) --cflags libdpdk)
LDFLAGS += $(shell $(PKGCONF) --libs libdpdk)

$(APP): $(SRCS-y) Makefile
                $(CC) $(CFLAGS) $(SRCS-y) -o $@ $(LDFLAGS)

my test program is dpdk-test, ldd is as follow:

[root@bogon ~]# ldd dpdk-test
        linux-vdso.so.1 (0x00007ffee46f3000)
        librte_ethdev.so.22 => /root/dpdk-install//dpdk/lib64/librte_ethdev.so.22 (0x00007f4c43c00000)
        librte_mbuf.so.22 => /root/dpdk-install//dpdk/lib64/librte_mbuf.so.22 (0x00007f4c43800000)
        librte_mempool.so.22 => /root/dpdk-install//dpdk/lib64/librte_mempool.so.22 (0x00007f4c43400000)
        librte_eal.so.22 => /root/dpdk-install//dpdk/lib64/librte_eal.so.22 (0x00007f4c43000000)
        libc.so.6 => /lib64/libc.so.6 (0x00007f4c42c00000)
        libm.so.6 => /lib64/libm.so.6 (0x00007f4c42800000)
        libdl.so.2 => /lib64/libdl.so.2 (0x00007f4c42400000)
        libnuma.so.1 => /lib64/libnuma.so.1 (0x00007f4c42000000)
        librte_kvargs.so.22 => /root/dpdk-install//dpdk/lib64/librte_kvargs.so.22 (0x00007f4c41c00000)
        librte_telemetry.so.22 => /root/dpdk-install//dpdk/lib64/librte_telemetry.so.22 (0x00007f4c41800000)
        librte_net.so.22 => /root/dpdk-install//dpdk/lib64/librte_net.so.22 (0x00007f4c41400000)
        librte_ring.so.22 => /root/dpdk-install//dpdk/lib64/librte_ring.so.22 (0x00007f4c41000000)
        librte_meter.so.22 => /root/dpdk-install//dpdk/lib64/librte_meter.so.22 (0x00007f4c40c00000)
        libpthread.so.0 => /lib64/libpthread.so.0 (0x00007f4c40800000)
        /lib64/ld-linux-x86-64.so.2 (0x00007f4c440a3000)

I have no idea what is wrong with it.

Can anyone help me? Thanks very much.

0

There are 0 answers