From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from mail-pf0-f177.google.com (mail-pf0-f177.google.com [209.85.192.177]) by dpdk.org (Postfix) with ESMTP id 039F65A8C for ; Wed, 16 Dec 2015 09:37:50 +0100 (CET) Received: by mail-pf0-f177.google.com with SMTP id o64so8770065pfb.3 for ; Wed, 16 Dec 2015 00:37:49 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=igel-co-jp.20150623.gappssmtp.com; s=20150623; h=from:to:cc:subject:date:message-id:in-reply-to:references; bh=oviCMEbuabU5rLA3BBHfR54exqGtroL5rhPMrQ6doHU=; b=D0h4oOxIVf8GUOvWRZ9YU4+ZKBiBShw4vcNVjPN8pf/Ad+5w3IDRSnLxX8njNgzH5a 67x2uM6yGOiqmR4JqjB7w6IvVUmX92kGKq/h4lAZm8JdHiw3XPHeWc8+xXYO0H8zUb3t kUL3bjQHKK6AQG2PE+k//AA6Cc6hVgK/FvlGkBGYDTPBHx/i0oJGs4e+RoVT8atS2lxh j4tCLDpdGH6aDAjQCNUJDO9NM2NbvFEGaGggTUypmstdS62JhO4a/ihXTPcdzcgii7SK qvpo11U/JhDqWvl9E72TiHAbZcmHjHIkf3rxFPqW02QbWH3DeHghFZdh9ds6SwY80cMN Ljnw== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20130820; h=x-gm-message-state:from:to:cc:subject:date:message-id:in-reply-to :references; bh=oviCMEbuabU5rLA3BBHfR54exqGtroL5rhPMrQ6doHU=; b=eEptShUMmxoPzyWrELQba5EuFZlBeSD+t1TXa7F2Pj7KfQDJs2PpAx/DJzBdGR2H0s +NX7rKmbQBSqJxWEdwB9KpawaavKAkFk3zzOK2nFa1HYi5WLXM0f/Da0cpFrcfU7a59v 52fXkrDufMGtxKgMeROemKJCKpgVHMUiPHX3UB6gERQrP/Scvj1aq28DgtzTf7uK/VRT WboF9UQQ8Xaf9ACQadUJ33f9c4aDHp0UqQDshY6R04PMQc7i4qlNF6T315pQxUiod35+ UiZDym3jk3n0Ci3KeN4mSrKyDpAwa02rZZmTLPzOYp6nIJytb5s9gDUD6s7aFcDKhj0I c7Pw== X-Gm-Message-State: ALoCoQnQcy7mLJg8Cmj2cHGyEQzFwXlNrG6JdIaGHV3EXftZBM+PJBiSkHM+FCVYdHOTsV/2xDptOuu+vqc458hcbD85aK1IlQ== X-Received: by 10.98.14.29 with SMTP id w29mr914261pfi.26.1450255069384; Wed, 16 Dec 2015 00:37:49 -0800 (PST) Received: from localhost.localdomain (napt.igel.co.jp. [219.106.231.132]) by smtp.gmail.com with ESMTPSA id xz6sm7333462pab.42.2015.12.16.00.37.46 (version=TLS1_2 cipher=ECDHE-RSA-AES128-SHA bits=128/128); Wed, 16 Dec 2015 00:37:48 -0800 (PST) From: Tetsuya Mukawa To: dev@dpdk.org Date: Wed, 16 Dec 2015 17:37:27 +0900 Message-Id: <1450255049-2263-1-git-send-email-mukawa@igel.co.jp> X-Mailer: git-send-email 2.1.4 In-Reply-To: <1447930650-26023-2-git-send-email-mukawa@igel.co.jp> References: <1447930650-26023-2-git-send-email-mukawa@igel.co.jp> Cc: nakajima.yoshihiro@lab.ntt.co.jp, mst@redhat.com Subject: [dpdk-dev] [PATCH v1 0/2] Virtio-net PMD Extension to work on host X-BeenThere: dev@dpdk.org X-Mailman-Version: 2.1.15 Precedence: list List-Id: patches and discussions about DPDK List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Wed, 16 Dec 2015 08:37:50 -0000 [Change log] PATCH v1: (Just listing functionality changes and important bug fix) * Support virtio-net interrupt handling. (It means virtio-net PMD on host and guest have same virtio-net features) * Fix memory allocation method to allocate contiguous memory correctly. * Port Hotplug is supported. * Rebase on DPDK-2.2. [Abstraction] Normally, virtio-net PMD only works on VM, because there is no virtio-net device on host. This RFC patch extends 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 virtio-net PMD on host is fully compatible with the PMD on guest. We can use same functionalities, and connect to anywhere QEMU virtio-net device can. For example, the PMD can use virtio-net multi queues function. Also it 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] So far, we need QEMU patch to connect to vhost-user backend. See below patch. - http://patchwork.ozlabs.org/patch/552549/ To know how to use, check commit log. [Detailed Description] - virtio-net device implementation This host mode 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 "--contig-mem". If the option is specified, EAL will open a file and allocate memory from hugepages. 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 physical 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 physical address of it to virtio-net register, QEMU virtio-net device can understand it without calculating address offset.) [Known issues] - vhost-user So far, to use vhost-user, we need to apply a patch to QEMU. This is because, QEMU will not send memory information and file descriptor of ivshmem device to vhost-user backend. I have submitted the patch to QEMU. See "http://patchwork.ozlabs.org/patch/552549/". Also, we may have an issue in DPDK vhost library to handle kickfd and callfd. The patch for this issue is needed. I have a workaround patch, but let me check it more. If someone wants to check vhost-user behavior, I will describe it more in later email. Tetsuya Mukawa (2): EAL: Add new EAL "--contig-mem" option virtio: Extend virtio-net PMD to support container environment config/common_linuxapp | 1 + drivers/net/virtio/Makefile | 4 + drivers/net/virtio/qtest.c | 1107 ++++++++++++++++++++++++++++ drivers/net/virtio/virtio_ethdev.c | 341 ++++++++- drivers/net/virtio/virtio_ethdev.h | 12 + drivers/net/virtio/virtio_pci.h | 25 + lib/librte_eal/common/eal_common_options.c | 7 + lib/librte_eal/common/eal_internal_cfg.h | 1 + lib/librte_eal/common/eal_options.h | 2 + lib/librte_eal/linuxapp/eal/eal_memory.c | 77 +- 10 files changed, 1543 insertions(+), 34 deletions(-) create mode 100644 drivers/net/virtio/qtest.c -- 2.1.4