mtcp-stack / mtcp

mTCP: A Highly Scalable User-level TCP Stack for Multicore Systems
Other
1.99k stars 436 forks source link

Cause: No Ethernet port! when running mTCP on KVM VM with virtio driver #61

Closed vincentmli closed 6 years ago

vincentmli commented 8 years ago

Hi

I am not sure this is DPDK virtio pmd driver issue or mTCP io_module issue, I have KVM VM virtio bound to igb_uio as below:

./dpdk-16.04/tools/dpdk_nic_bind.py --status

Network devices using DPDK-compatible driver

0000:00:07.0 'Virtio network device' drv=igb_uio unused=

Network devices using kernel driver

0000:00:03.0 'Virtio network device' if= drv=virtio-pci unused=igb_uio

ifconfig

dpdk0 Link encap:Ethernet HWaddr 00:00:00:00:00:00 inet addr:10.0.0.1 Bcast:10.0.0.255 Mask:255.255.255.0 inet6 addr: fe80::200:ff:fe00:0/64 Scope:Link UP BROADCAST RUNNING MULTICAST MTU:1500 Metric:1 RX packets:24 errors:0 dropped:0 overruns:0 frame:0 TX packets:22 errors:0 dropped:0 overruns:0 carrier:0 collisions:0 txqueuelen:1000 RX bytes:17621 (17.6 KB) TX bytes:2303 (2.3 KB)

run epwget as below:

./apps/example/epwget 10.0.0.2 1

............... EAL: WARNING: cpu flags constant_tsc=yes nonstop_tsc=no -> using unreliable clock cycles ! EAL: Master lcore 0 is ready (tid=2985a900;cpuset=[0]) EAL: Error - exiting with code: 1 Cause: No Ethernet port! <============

it looks code in mtc/src/io_module.c detected no dpdk port

                /* give me the count of 'detected' ethernet ports */
                num_devices = rte_eth_dev_count();
                if (num_devices == 0) {
                        rte_exit(EXIT_FAILURE, "No Ethernet port!\n");
                }

but if I run the testpmd app from DPDK, it detects the dpdk port fine and works fine, so I am suspecting somehow the way mTCP interact with DPDK may trigger some unknown bug.

I could workaround/hack this issue by compile the DPDK as shared library and use '-d' to load the librte_pmd_virtio.so driver in mtcp/src/io_module.c

@@ -169,17 +187,23 @@ SetInterfaceInfo(char* dev_name_list)
                        exit(EXIT_FAILURE);
                }
                sprintf(mem_channels, "%d", CONFIG.num_mem_ch);
+               sprintf(whitelist, "%s", "0000:00:07.0");
+               sprintf(external_driver, "%s", "/home/dpdk/mtcp/librte_pmd_virtio.so");

                /* initialize the rte env first, what a waste of implementation effort!  */
                char *argv[] = {"",
                                "-c",
                                cpumaskbuf,
+                             "-d",
+                            external_driver,
+                               "-w",
+                               whitelist,
                                "-n",
                                mem_channels,
                                "--proc-type=auto",
                                ""
                };
-               const int argc = 6;
+               const int argc = 10;

but I really would like not to use this hack and instead let dpdk to probe the virtio and initiate virtio properly, any clue? I might need to seek help from DPDK community.

vincentmli commented 8 years ago

I resolved the issue, it turned out I need to add the '-lrte_pmd_virtio -Wl' in mtcp/app/example/Makefile for static build of DPDK. should the Makefile be patched ?

ajamshed commented 8 years ago

Yes. Thanks for notifying the issue. I have resolved this issue in the latest commit.

ppnaik1890 commented 6 years ago

Hi,

I am also facing a similar issue. Compiling my application with -lrte_pmd_virtio also did not help. Do I also to need to compile mTCP or DPDK with some different configuration? If yes, can you please help me out by providing the steps.

Thanks, Priyanka

vincentmli commented 6 days ago

time flies fast :) I think the commit below addressed the issue

commit 402d7f4f68d5f230c218c23c9b7b9c6df36e45df
Author: Asim Jamshed <ajamshed@ndsl.kaist.edu>
Date:   Sun May 15 02:07:45 2016 +0900

    - Resolves issue#: 61
    --> Thanks Vincent!