All of lore.kernel.org
 help / color / mirror / Atom feed
From: Vincent Li <vincent.mc.li@gmail.com>
To: dev@dpdk.org
Subject: virtio pmd failed in pci probing
Date: Thu, 12 May 2016 09:34:29 -0700	[thread overview]
Message-ID: <CAK3+h2wfpUgapGuAY9gaU6OGkKD75=bKaFAT0YyehQ54z=f-hA@mail.gmail.com> (raw)

Hi

I am testing mTCP https://github.com/eunyoung14/mtcp  with dpdk-16.04
on KVM guest and it appears the virtio pmd fail to load, detail info
below:


# ./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
0000:00:08.0 'Virtio network device' if= drv=virtio-pci unused=igb_uio

in mtcp/src/io_module.c, I have (I hard code the whiltelist to make it
easy to test for me):



               sprintf(whitelist, "%s", "0000:00:07.0");
               /* initialize the rte env first, what a waste of
implementation effort!  */
                char *argv[] = {"",
                                "-c",
                                cpumaskbuf,
                                "-w",
                                whitelist,
                                "-n",
                                mem_channels,
                                "--proc-type=auto",
                                ""
                };
                const int argc = 8;

                /*
                 * re-set getopt extern variable optind.
                 * this issue was a bitch to debug
                 * rte_eal_init() internally uses getopt() syscall
                 * mtcp applications that also use an `external' getopt
                 * will cause a violent crash if optind is not reset to zero
                 * prior to calling the func below...
                 * see man getopt(3) for more details
                 */
                optind = 0;

                /* initialize the dpdk eal env */
                ret = rte_eal_init(argc, argv);
                if (ret < 0)
                        rte_exit(EXIT_FAILURE, "Invalid EAL args!\n");
                /* 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");
                }

in dpdk-16.04/lib/librte_eal/common/eal_common_pci.c
rte_eal_pci_probe_one_driver, I added debug line below:

/*
 * If vendor/device ID match, call the devinit() function of the
 * driver.
 */
static int
rte_eal_pci_probe_one_driver(struct rte_pci_driver *dr, struct
rte_pci_device *dev)
{
        int ret;
        const struct rte_pci_id *id_table;

        RTE_LOG(DEBUG, EAL, "  dev->id.vendor_id:dev->id.device_id
dr->name %x:%x %s\n", dev->id.vendor_id,
                                dev->id.device_id, dr->name);


when I run mTCP app as below, it says "No Ethernet port!", please note
that the debug line did not show rte_virtio_pmd, why? is it because
virtio pmd lack of vendor_id/device_id implementation?


EAL: WARNING: cpu flags constant_tsc=yes nonstop_tsc=no -> using
unreliable clock cycles !
EAL: Master lcore 0 is ready (tid=dca0e900;cpuset=[0])
EAL:   dev->id.vendor_id:dev->id.device_id dr->name 1af4:1000 rte_vmxnet3_pmd
EAL:   dev->id.vendor_id:dev->id.device_id dr->name 1af4:1000 rte_i40e_pmd
EAL:   dev->id.vendor_id:dev->id.device_id dr->name 1af4:1000 rte_i40evf_pmd
EAL:   dev->id.vendor_id:dev->id.device_id dr->name 1af4:1000 rte_ixgbe_pmd
EAL:   dev->id.vendor_id:dev->id.device_id dr->name 1af4:1000 rte_ixgbevf_pmd
EAL:   dev->id.vendor_id:dev->id.device_id dr->name 1af4:1000 rte_igb_pmd
EAL:   dev->id.vendor_id:dev->id.device_id dr->name 1af4:1000 rte_igbvf_pmd
EAL:   dev->id.vendor_id:dev->id.device_id dr->name 1af4:1000 rte_em_pmd
pci_probe_all_drivers ret: 1 devargs not NULL and whitelisted
EAL: Error - exiting with code: 1
  Cause: No Ethernet port!


dpdk testpmd app detects the ethernet port fine, here is the testpmd
output (Note here the debug line shows rte_virtio_pmd):

./x86_64-native-linuxapp-gcc/app/testpmd -c 0xf -n 4  -w 0000:00:07.0 -- -i

EAL: Master lcore 0 is ready (tid=e9c98900;cpuset=[0])
EAL: lcore 3 is ready (tid=a69f6700;cpuset=[3])
EAL: lcore 2 is ready (tid=a71f7700;cpuset=[2])
EAL: lcore 1 is ready (tid=a79f8700;cpuset=[1])
EAL:   dev->id.vendor_id:dev->id.device_id dr->name 1af4:1000 rte_vmxnet3_pmd
EAL:   dev->id.vendor_id:dev->id.device_id dr->name 1af4:1000
rte_virtio_pmd
EAL: PCI device 0000:00:07.0 on NUMA socket -1
EAL:   probe driver: 1af4:1000 rte_virtio_pmd
EAL:   PCI memory mapped at 0x7fabe8a00000


I am able to workaround this by compiling dpdk as shared library for
mTCP and use '-d' to load librte_pmd_virtio.so explicitly.

it looks to me there isn't much difference between how testpmd and
mTCP invokes dpdk, it is straightforward rte_eal_init(argc, argv) and
rte_eth_dev_count()

is there any potential bug in the implementation of virtio pmd in pci probing ?

Thanks!

             reply	other threads:[~2016-05-12 16:34 UTC|newest]

Thread overview: 3+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2016-05-12 16:34 Vincent Li [this message]
2016-05-12 20:10 ` virtio pmd failed in pci probing Vincent Li
2016-05-13 17:18   ` Vincent Li

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to='CAK3+h2wfpUgapGuAY9gaU6OGkKD75=bKaFAT0YyehQ54z=f-hA@mail.gmail.com' \
    --to=vincent.mc.li@gmail.com \
    --cc=dev@dpdk.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.