DPDK patches and discussions
 help / color / mirror / Atom feed
From: Tetsuya Mukawa <mukawa@igel.co.jp>
To: dev@dpdk.org, jianfeng.tan@intel.com, huawei.xie@intel.com,
	yuanhan.liu@linux.intel.com
Subject: [dpdk-dev] [PATCH v4 00/12] Virtio-net PMD: QEMU QTest extension for container
Date: Wed,  9 Mar 2016 17:33:17 +0900	[thread overview]
Message-ID: <1457512409-24403-1-git-send-email-mukawa@igel.co.jp> (raw)
In-Reply-To: <1456129075-14909-4-git-send-email-mukawa@igel.co.jp>

The patches will work on below patch series.
 - [PATCH v2 0/5] virtio support for container

[Changes]
v4 changes:
 - Rebase on latest master.
 - Split patches.
 - To abstract qtest code more, change interface between current virtio
   code and qtest code.
 - Rename qtest.c to qtest_utils.c
 - Change implementation like below.
   - Set pci device information out of qtest abstraction, then pass it to
     qtest to initialize devices.
 - Remove redundant condition checking from qtest_raw_send/recv().
 - Fix return value of qtest_raw_send().

v3 changes:
 - Rebase on latest master.
 - remove "-qtest-virtio" option, then add "--range-virtaddr" and
   "--align-memsize" options.
 - Fix typos in qtest.c

v2 changes:
 - Rebase on above patch seiries.
 - Rebase on master
 - Add "--qtest-virtio" EAL option.
 - Fixes in qtest.c
  - Fix error handling for the case qtest connection is closed.
  - Use eventfd for interrupt messaging.
  - Use linux header for PCI register definitions.
  - Fix qtest_raw_send/recv to handle error correctly.
  - Fix bit mask of PCI_CONFIG_ADDR.
  - Describe memory and ioport usage of qtest guest in qtest.c
  - Remove loop that is for finding PCI devices.


[Abstraction]

Normally, virtio-net PMD only works on VM, because there is no virtio-net device on host.
This patches extend  virtio-net PMD to be able to work on host as virtual PMD.
But we didn't implement virtio-net device as a part of virtio-net PMD.
To prepare virtio-net device for the PMD, start QEMU process with special QTest mode, then connect it from virtio-net PMD through unix domain socket.

The PMD can connect to anywhere QEMU virtio-net device can.
For example, the PMD can connects to vhost-net kernel module and vhost-user backend application.
Similar to virtio-net PMD on QEMU, application memory that uses virtio-net PMD will be shared between vhost backend application.
But vhost backend application memory will not be shared.

Main target of this PMD is container like docker, rkt, lxc and etc.
We can isolate related processes(virtio-net PMD process, QEMU and vhost-user backend process) by container.
But, to communicate through unix domain socket, shared directory will be needed.


[How to use]

 Please use QEMU-2.5.1, or above.
 (So far, QEMU-2.5.1 hasn't been released yet, so please checkout master from QEMU repository)

 - Compile
 Set "CONFIG_RTE_VIRTIO_VDEV_QTEST=y" in config/common_linux.
 Then compile it.

 - Start QEMU like below.
 $ qemu-system-x86_64 \
              -machine pc-i440fx-1.4,accel=qtest \
              -display none -qtest-log /dev/null \
              -qtest unix:/tmp/socket,server \
              -netdev type=tap,script=/etc/qemu-ifup,id=net0,queues=1 \
              -device virtio-net-pci,netdev=net0,mq=on,disable-modern=false,addr=3 \
              -chardev socket,id=chr1,path=/tmp/ivshmem,server \
              -device ivshmem,size=1G,chardev=chr1,vectors=1,addr=4

 - Start DPDK application like below
 $ testpmd -c f -n 1 -m 1024 --no-pci --single-file --qtest-virtio \
             --vdev="eth_qtest_virtio0,qtest=/tmp/socket,ivshmem=/tmp/ivshmem"\
             -- --disable-hw-vlan --txqflags=0xf00 -i

(*1) Please Specify same memory size in QEMU and DPDK command line.
(*2) Should use qemu-2.5.1, or above.
(*3) QEMU process is needed per port.
(*4) virtio-1.0 device are only supported.
(*5) The vhost backends like vhost-net and vhost-user can be specified.
(*6) In most cases, just using above command is enough, but you can also
     specify other QEMU virtio-net options.
(*7) Only checked "pc-i440fx-1.4" machine, but may work with other
     machines. It depends on a machine has piix3 south bridge.
     If the machine doesn't have, virtio-net PMD cannot receive status
     changed interrupts.
(*8) Should not add "--enable-kvm" to QEMU command line.


[Detailed Description]

 - virtio-net device implementation
The PMD uses QEMU virtio-net device. To do that, QEMU QTest functionality is used.
QTest is a test framework of QEMU devices. It allows us to implement a device driver outside of QEMU.
With QTest, we can implement DPDK application and virtio-net PMD as standalone process on host.
When QEMU is invoked as QTest mode, any guest code will not run.
To know more about QTest, see below.
http://wiki.qemu.org/Features/QTest

 - probing devices
QTest provides a unix domain socket. Through this socket, driver process can access to I/O port and memory of QEMU virtual machine.
The PMD will send I/O port accesses to probe pci devices.
If we can find virtio-net and ivshmem device, initialize the devices.
Also, I/O port accesses of virtio-net PMD will be sent through socket, and virtio-net PMD can initialize vitio-net device on QEMU correctly.

 - ivshmem device to share memory
To share memory that virtio-net PMD process uses, ivshmem device will be used.
Because ivshmem device can only handle one file descriptor, shared memory should be consist of one file.
To allocate such a memory, EAL has new option called "--single-file".
Also, the hugepages should be mapped between "1 << 31" to "1 << 44".
To map like above, EAL has one more new option called "-qtest-virtio".
While initializing ivshmem device, we can set BAR(Base Address Register).
It represents which memory QEMU vcpu can access to this shared memory.
We will specify host virtual address of shared memory as this address.
It is very useful because we don't need to apply patch to QEMU to calculate address offset.
(For example, if virtio-net PMD process will allocate memory from shared memory, then specify the virtual address of it to virtio-net register, QEMU virtio-net device can understand it without calculating address offset.)


Tetsuya Mukawa (12):
  virtio: Retrieve driver name from eth_dev
  vhost: Add a function to check virtio device type
  EAL: Add a new "--range-virtaddr" option
  EAL: Add a new "--align-memsize" option
  virtio,qtest: Add QTest utility basic functions
  virtio,qtest: Add pci device initialization function to qtest utils
  virtio,qtest: Add functionality to share memory between QTest guest
  virtio,qtest: Add functionality to handle interrupt
  virtio,qtest: Add misc functions to handle pci information
  virtio: Add QTest support to vtpci abstraction
  virtio: Add QTest support for virtio-net PMD
  docs: add release note for qtest virtio container support

 config/common_base                         |    1 +
 doc/guides/rel_notes/release_16_04.rst     |    3 +
 drivers/net/virtio/Makefile                |    4 +
 drivers/net/virtio/qtest.h                 |   94 +++
 drivers/net/virtio/qtest_utils.c           | 1223 ++++++++++++++++++++++++++++
 drivers/net/virtio/qtest_utils.h           |  355 ++++++++
 drivers/net/virtio/virtio_ethdev.c         |  509 +++++++++++-
 drivers/net/virtio/virtio_ethdev.h         |   32 +
 drivers/net/virtio/virtio_pci.c            |  368 ++++++++-
 drivers/net/virtio/virtio_pci.h            |    9 +-
 lib/librte_eal/common/eal_common_options.c |   17 +
 lib/librte_eal/common/eal_internal_cfg.h   |    3 +
 lib/librte_eal/common/eal_options.h        |    4 +
 lib/librte_eal/linuxapp/eal/eal.c          |   43 +
 lib/librte_eal/linuxapp/eal/eal_memory.c   |   91 ++-
 15 files changed, 2687 insertions(+), 69 deletions(-)
 create mode 100644 drivers/net/virtio/qtest.h
 create mode 100644 drivers/net/virtio/qtest_utils.c
 create mode 100644 drivers/net/virtio/qtest_utils.h

-- 
2.1.4

  parent reply	other threads:[~2016-03-09  8:33 UTC|newest]

Thread overview: 120+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2016-01-18  9:13 [dpdk-dev] [PATCH 0/3] virtio: Add a new layer to abstract pci access method Tetsuya Mukawa
2016-01-18  9:13 ` [dpdk-dev] [PATCH 1/3] virtio: Change the parameter order of io_write8/16/32() Tetsuya Mukawa
2016-01-21 11:07   ` [dpdk-dev] [RFC PATCH 0/5] virtio: Add a new layer to abstract pci access method Tetsuya Mukawa
2016-01-21 11:10     ` Tetsuya Mukawa
2016-01-21 11:07   ` [dpdk-dev] [RFC PATCH 1/5] virtio: Change the parameter order of io_write8/16/32() Tetsuya Mukawa
2016-01-21 11:07   ` [dpdk-dev] [RFC PATCH 2/5] virtio: move rte_eal_pci_unmap_device() to virtio_pci.c Tetsuya Mukawa
2016-01-21 11:07   ` [dpdk-dev] [RFC PATCH 3/5] virtio: Add a new layer to abstract pci access method Tetsuya Mukawa
2016-01-22  7:26     ` Xie, Huawei
2016-01-22  7:35       ` Tetsuya Mukawa
2016-01-21 11:07   ` [dpdk-dev] [RFC PATCH 4/5] EAL: Add new EAL "--shm" option Tetsuya Mukawa
2016-01-22  1:43     ` Tan, Jianfeng
2016-01-22  2:07       ` Tan, Jianfeng
2016-01-22  3:23         ` Tetsuya Mukawa
2016-01-21 11:07   ` [dpdk-dev] [RFC PATCH 5/5] virtio: Extend virtio-net PMD to support container environment Tetsuya Mukawa
2016-01-22  8:14     ` Xie, Huawei
2016-01-22 10:37       ` Tetsuya Mukawa
2016-01-25 10:15         ` Xie, Huawei
2016-01-26  2:58           ` Tetsuya Mukawa
2016-01-27  9:39             ` Xie, Huawei
2016-01-28  2:33               ` Tetsuya Mukawa
2016-01-25 10:17     ` Xie, Huawei
2016-01-26  2:58       ` Tetsuya Mukawa
2016-01-25 10:29     ` Xie, Huawei
2016-01-26  2:58       ` Tetsuya Mukawa
2016-01-27 10:03     ` Xie, Huawei
2016-01-28  2:44       ` Tetsuya Mukawa
2016-01-29  8:56         ` Xie, Huawei
2016-01-27 15:58     ` Xie, Huawei
2016-01-28  2:47       ` Tetsuya Mukawa
2016-01-28  9:48         ` Xie, Huawei
2016-01-28  9:53           ` Tetsuya Mukawa
2016-01-27 16:45     ` Xie, Huawei
2016-01-28  2:47       ` Tetsuya Mukawa
2016-01-28  6:15         ` Xie, Huawei
2016-01-28  6:29           ` Tetsuya Mukawa
2016-01-29  8:57     ` Yuanhan Liu
2016-01-29  9:13       ` Yuanhan Liu
2016-02-01  1:49         ` Tetsuya Mukawa
2016-02-10  3:40     ` [dpdk-dev] [PATCH v2 0/5] Virtio-net PMD: QEMU QTest extension for container Tetsuya Mukawa
2016-02-10  3:40     ` [dpdk-dev] [PATCH v2 1/5] virtio: Retrieve driver name from eth_dev Tetsuya Mukawa
2016-02-10  3:40     ` [dpdk-dev] [PATCH v2 2/5] EAL: Add new EAL "--qtest-virtio" option Tetsuya Mukawa
2016-02-15  7:52       ` Tan, Jianfeng
2016-02-16  1:32         ` Tetsuya Mukawa
2016-02-16  5:53       ` David Marchand
2016-02-16 11:36         ` Tan, Jianfeng
2016-02-17  3:36           ` Tetsuya Mukawa
2016-02-22  8:17       ` [dpdk-dev] [PATCH v3 0/6] Virtio-net PMD: QEMU QTest extension for container Tetsuya Mukawa
2016-02-22  8:17       ` [dpdk-dev] [PATCH v3 1/6] virtio: Retrieve driver name from eth_dev Tetsuya Mukawa
2016-02-22  8:17       ` [dpdk-dev] [PATCH v3 2/6] vhost: Add a function to check virtio device type Tetsuya Mukawa
2016-02-22  8:17       ` [dpdk-dev] [PATCH v3 3/6] EAL: Add new EAL "--range-virtaddr" option Tetsuya Mukawa
2016-03-04  2:20         ` Tan, Jianfeng
2016-03-09  8:33         ` Tetsuya Mukawa [this message]
2016-03-09  8:33         ` [dpdk-dev] [PATCH v4 01/12] virtio: Retrieve driver name from eth_dev Tetsuya Mukawa
2016-03-09  8:33         ` [dpdk-dev] [PATCH v4 02/12] vhost: Add a function to check virtio device type Tetsuya Mukawa
2016-03-09  8:33         ` [dpdk-dev] [PATCH v4 03/12] EAL: Add a new "--range-virtaddr" option Tetsuya Mukawa
2016-03-09  8:33         ` [dpdk-dev] [PATCH v4 04/12] EAL: Add a new "--align-memsize" option Tetsuya Mukawa
2016-03-09  8:33         ` [dpdk-dev] [PATCH v4 05/12] virtio, qtest: Add QTest utility basic functions Tetsuya Mukawa
2016-03-09  8:33         ` [dpdk-dev] [PATCH v4 06/12] virtio, qtest: Add pci device initialization function to qtest utils Tetsuya Mukawa
2016-03-09  8:33         ` [dpdk-dev] [PATCH v4 07/12] virtio, qtest: Add functionality to share memory between QTest guest Tetsuya Mukawa
2016-03-09  8:33         ` [dpdk-dev] [PATCH v4 08/12] virtio, qtest: Add functionality to handle interrupt Tetsuya Mukawa
2016-03-09  8:33         ` [dpdk-dev] [PATCH v4 09/12] virtio, qtest: Add misc functions to handle pci information Tetsuya Mukawa
2016-03-09  8:33         ` [dpdk-dev] [PATCH v4 10/12] virtio: Add QTest support to vtpci abstraction Tetsuya Mukawa
2016-03-09  8:33         ` [dpdk-dev] [PATCH v4 11/12] virtio: Add QTest support for virtio-net PMD Tetsuya Mukawa
2016-06-02  3:29           ` [dpdk-dev] [PATCH v5 0/6] Virtio-net PMD: QEMU QTest extension for container Tetsuya Mukawa
2016-06-02  7:31             ` Yuanhan Liu
2016-06-02  9:30               ` Tetsuya Mukawa
2016-06-03  4:17                 ` Yuanhan Liu
2016-06-03 13:51                   ` Thomas Monjalon
2016-06-06  5:10                   ` Tetsuya Mukawa
2016-06-06  7:21                     ` Yuanhan Liu
2016-06-06  8:33                       ` Tetsuya Mukawa
2016-06-06  8:49                         ` Yuanhan Liu
2016-06-06  9:30                           ` Tetsuya Mukawa
2016-06-06  9:58                             ` Yuanhan Liu
2016-06-06 10:50                             ` Tan, Jianfeng
2016-06-07  7:12                               ` Tetsuya Mukawa
2016-06-07  7:33                                 ` Yuanhan Liu
2016-06-06  8:03                     ` Tan, Jianfeng
2016-06-06  9:28                       ` Tetsuya Mukawa
2016-06-06 10:35                         ` Tan, Jianfeng
2016-06-02  3:29           ` [dpdk-dev] [PATCH v5 1/6] virtio, qtest: Add QTest utility basic functions Tetsuya Mukawa
2016-06-02  3:29           ` [dpdk-dev] [PATCH v5 2/6] virtio, qtest: Add pci device initialization function to qtest utils Tetsuya Mukawa
2016-06-02  3:29           ` [dpdk-dev] [PATCH v5 3/6] virtio, qtest: Add functionality to share memory between QTest guest Tetsuya Mukawa
2016-06-02  3:29           ` [dpdk-dev] [PATCH v5 4/6] virtio, qtest: Add misc functions to handle pci information Tetsuya Mukawa
2016-06-02  3:29           ` [dpdk-dev] [PATCH v5 5/6] virtio: Add QTest support to vtpci abstraction Tetsuya Mukawa
2016-06-02  3:29           ` [dpdk-dev] [PATCH v5 6/6] virtio: Add QTest support for virtio-net PMD Tetsuya Mukawa
2016-06-02  3:30           ` [dpdk-dev] [PATCH v1 0/2] Supplement patches for virtio-qtest to support LSC interrupt Tetsuya Mukawa
2016-06-02  3:30           ` [dpdk-dev] [PATCH v1 1/2] virtio: Handle interrupt things under vtpci abstraction Tetsuya Mukawa
2016-06-02  3:30           ` [dpdk-dev] [PATCH v1 2/2] virtio, qtest: Add functionality to handle interrupt Tetsuya Mukawa
2016-03-09  8:33         ` [dpdk-dev] [PATCH v4 12/12] docs: add release note for qtest virtio container support Tetsuya Mukawa
2016-02-22  8:17       ` [dpdk-dev] [PATCH v3 4/6] EAL: Add a new "--align-memsize" option Tetsuya Mukawa
2016-02-22  8:17       ` [dpdk-dev] [PATCH v3 5/6] virtio: Add support for qtest virtio-net PMD Tetsuya Mukawa
2016-03-04  2:18         ` Tan, Jianfeng
2016-03-04  5:05           ` Tetsuya Mukawa
2016-03-04  6:10             ` Tan, Jianfeng
2016-03-04  9:53               ` Tetsuya Mukawa
2016-02-22  8:17       ` [dpdk-dev] [PATCH v3 6/6] docs: add release note for qtest virtio container support Tetsuya Mukawa
2016-02-22 15:40         ` Mcnamara, John
2016-02-23 10:28           ` Mcnamara, John
2016-02-24  1:20             ` Tetsuya Mukawa
2016-02-10  3:40     ` [dpdk-dev] [PATCH v2 3/5] vhost: Add a function to check virtio device type Tetsuya Mukawa
2016-02-10  3:40     ` [dpdk-dev] [PATCH v2 4/5] virtio: Add support for qtest virtio-net PMD Tetsuya Mukawa
2016-02-10  3:40     ` [dpdk-dev] [PATCH v2 5/5] docs: add release note for qtest virtio container support Tetsuya Mukawa
2016-01-28  9:33   ` [dpdk-dev] [PATCH v2 0/3] virtio: Add a new layer to abstract pci access method Tetsuya Mukawa
2016-01-28  9:33   ` [dpdk-dev] [PATCH v2 1/3] virtio: Change the parameter order of io_write8/16/32() Tetsuya Mukawa
2016-01-28  9:33   ` [dpdk-dev] [PATCH v2 2/3] virtio: move rte_eal_pci_unmap_device() to virtio_pci.c Tetsuya Mukawa
2016-01-28  9:33   ` [dpdk-dev] [PATCH v2 3/3] virtio: Add a new layer to abstract pci access method Tetsuya Mukawa
2016-01-29  9:17     ` Yuanhan Liu
2016-02-01  1:50       ` Tetsuya Mukawa
2016-02-01 13:15         ` Yuanhan Liu
2016-02-02  2:19           ` Tetsuya Mukawa
2016-02-02  2:45             ` Yuanhan Liu
2016-02-02  3:55               ` Tetsuya Mukawa
2016-01-18  9:13 ` [dpdk-dev] [PATCH 2/3] virtio: move rte_eal_pci_unmap_device() to virtio_pci.c Tetsuya Mukawa
2016-01-18  9:13 ` [dpdk-dev] [PATCH 3/3] virtio: Add a new layer to abstract pci access method Tetsuya Mukawa
2016-01-18 13:46   ` Yuanhan Liu
2016-01-19  1:22     ` Tetsuya Mukawa
2016-01-19  2:41     ` Xie, Huawei
2016-01-18 13:13 ` [dpdk-dev] [PATCH 0/3] " Tan, Jianfeng
2016-01-19  1:22   ` Tetsuya Mukawa

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=1457512409-24403-1-git-send-email-mukawa@igel.co.jp \
    --to=mukawa@igel.co.jp \
    --cc=dev@dpdk.org \
    --cc=huawei.xie@intel.com \
    --cc=jianfeng.tan@intel.com \
    --cc=yuanhan.liu@linux.intel.com \
    /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 a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).