From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from mails.dpdk.org (mails.dpdk.org [217.70.189.124]) by inbox.dpdk.org (Postfix) with ESMTP id EE6FFA0A02; Thu, 14 Jan 2021 07:30:06 +0100 (CET) Received: from [217.70.189.124] (localhost [127.0.0.1]) by mails.dpdk.org (Postfix) with ESMTP id B6BD5140DE5; Thu, 14 Jan 2021 07:30:06 +0100 (CET) Received: from mga03.intel.com (mga03.intel.com [134.134.136.65]) by mails.dpdk.org (Postfix) with ESMTP id 802DF140D25 for ; Thu, 14 Jan 2021 07:30:05 +0100 (CET) IronPort-SDR: nngpOBRKmVIPyurCgKyZSEVxPjYcQJ8UZTb5jiMRj/yTgF9VDJC2DZYtAWXJCptTF9b26dYhej /0k0Wdf0hk0A== X-IronPort-AV: E=McAfee;i="6000,8403,9863"; a="178407152" X-IronPort-AV: E=Sophos;i="5.79,346,1602572400"; d="scan'208";a="178407152" Received: from fmsmga002.fm.intel.com ([10.253.24.26]) by orsmga103.jf.intel.com with ESMTP/TLS/ECDHE-RSA-AES256-GCM-SHA384; 13 Jan 2021 22:30:04 -0800 IronPort-SDR: YORD7U22j/S1paKiKKSccJZC/McnHTdK3wvLVJDh101g+LiXbDV3YrpM2duhAaKJLNLdJ/9Wlo YphrfzEuerCQ== X-ExtLoop1: 1 X-IronPort-AV: E=Sophos;i="5.79,346,1602572400"; d="scan'208";a="400799370" Received: from npg-dpdk-virtio-xiachenbo-nw.sh.intel.com ([10.67.119.123]) by fmsmga002.fm.intel.com with ESMTP; 13 Jan 2021 22:30:02 -0800 From: Chenbo Xia To: dev@dpdk.org, thomas@monjalon.net, david.marchand@redhat.com Cc: stephen@networkplumber.org, cunming.liang@intel.com, xiuchun.lu@intel.com, miao.li@intel.com, jingjing.wu@intel.com, beilei.xing@intel.com Date: Thu, 14 Jan 2021 14:25:04 +0800 Message-Id: <20210114062512.45462-1-chenbo.xia@intel.com> X-Mailer: git-send-email 2.17.1 In-Reply-To: <20201219062806.56477-1-chenbo.xia@intel.com> References: <20201219062806.56477-1-chenbo.xia@intel.com> Subject: [dpdk-dev] [PATCH v3 0/8] Introduce emudev library and iavf emudev driver X-BeenThere: dev@dpdk.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: DPDK patches and discussions List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: dev-bounces@dpdk.org Sender: "dev" This series introduces a new device abstraction called emudev for emulated devices. A new library (librte_emudev) is implemented. The first emudev driver is also introduced, which emulates Intel Adaptive Virtual Function (iavf) as a software network device. This series has a dependency on librte_vfio_user patch series: http://patchwork.dpdk.org/cover/86498/ Background & Motivation ----------------------- The disaggregated/multi-process QEMU is using VFIO-over-socket/vfio-user as the main transport mechanism to disaggregate IO services from QEMU. Therefore, librte_vfio_user is introduced in DPDK to accommodate emulated devices for high performance I/O. Although vfio-user library provides possibility of emulating devices in DPDK, DPDK does not have a device abstraction for emulated devices. A good device abstraction will be useful for applications or high performance data path driver. With this consideration, emudev library is designed and implemented. It also make it possbile to keep modular design on emulated devices by implementing data path related logic in a standalone driver (e.g., an ethdev driver) and keeps the unrelated logic in the emudev driver. Design overview --------------- +---------------------------------------+ | +---------------+ +-----------+ | | | iavf_emudev |<-->| data path | | | | driver | | driver | | | +---------------+ +-----------+ | | | | | --------------------------- VDEV BUS | | | | | +---------------+ | +--------------+ | | vdev: | | | +----------+ | | | /path/to/vfio | | | | Generic | | | +---------------+ | | | vfio-dev | | | | | | +----------+ | | | | | +----------+ | | +----------+ | | | vfio-user| | | | vfio-user| | | | client | |<---|----->| server | | | +----------+ | | +----------+ | | QEMU/DPDK | | DPDK | +--------------+ +---------------------------------------+ - Generic vfio-dev/vfio-user client/vfio-user server Above concepts are all introduced in librte_vfio_user patch series: http://patchwork.dpdk.org/cover/86498/ - vdev:/path/to/vfio. It binds to vdev bus driver. The vdev device is defined by DPDK applications through command line as '--vdev=emu_iavf, path=/path/to/socket' in iavf_emudev case. Parameters in command line include device name (emu_iavf) which is used to identify corresponding driver (in this case, iavf_emudev driver), path=/path/to/socket which is used to open the transport interface to vfio-user client in QEMU/DPDK. - data path driver. The data path handling is splited to another standalone driver for modular design. Why not rawdev for emulated device ---------------------------------- Instead of introducing new class emudev, emulated device could be presented as rawdev. However, existing rawdev APIs cannot meet the requirements of emulated device. There are three API categories for emudev. They are emudev device lifecycle management, backend facing APIs, and emudev device provider facing APIs respectively. Existing rawdev APIs could only cover lifecycle management APIs and some of backend facing APIs. Other APIs, even if added to rawdev API are not required by other rawdev applications. ---------------------------------- v3: - fix interrupt issue in iavf emudev driver (Jingjing) v2: - fix driver meson build file Chenbo Xia (8): lib: introduce emudev library doc: add emudev library guide emu: introduce emulated iavf driver emu/iavf: add vfio-user device register and unregister emu/iavf: add resource management and internal logic of iavf emu/iavf: add emudev operations to fit in emudev framework test/emudev: introduce functional test doc: update release notes for iavf emudev driver MAINTAINERS | 12 + app/test/meson.build | 5 +- app/test/test_emudev.c | 29 + doc/guides/prog_guide/emudev.rst | 122 +++ doc/guides/prog_guide/index.rst | 1 + doc/guides/rel_notes/release_21_02.rst | 16 + drivers/emu/iavf/iavf_emu.c | 262 ++++++ drivers/emu/iavf/iavf_emu_internal.h | 69 ++ drivers/emu/iavf/iavf_emu_test.c | 174 ++++ drivers/emu/iavf/iavf_emudev.c | 239 ++++++ drivers/emu/iavf/iavf_vfio_user.c | 1076 ++++++++++++++++++++++++ drivers/emu/iavf/iavf_vfio_user.h | 57 ++ drivers/emu/iavf/meson.build | 17 + drivers/emu/iavf/rte_iavf_emu.h | 119 +++ drivers/emu/iavf/version.map | 3 + drivers/emu/meson.build | 6 + drivers/meson.build | 1 + lib/librte_emudev/meson.build | 5 + lib/librte_emudev/rte_emudev.c | 502 +++++++++++ lib/librte_emudev/rte_emudev.h | 431 ++++++++++ lib/librte_emudev/rte_emudev_vdev.h | 53 ++ lib/librte_emudev/version.map | 27 + lib/meson.build | 2 +- 23 files changed, 3226 insertions(+), 2 deletions(-) create mode 100644 app/test/test_emudev.c create mode 100644 doc/guides/prog_guide/emudev.rst create mode 100644 drivers/emu/iavf/iavf_emu.c create mode 100644 drivers/emu/iavf/iavf_emu_internal.h create mode 100644 drivers/emu/iavf/iavf_emu_test.c create mode 100644 drivers/emu/iavf/iavf_emudev.c create mode 100644 drivers/emu/iavf/iavf_vfio_user.c create mode 100644 drivers/emu/iavf/iavf_vfio_user.h create mode 100644 drivers/emu/iavf/meson.build create mode 100644 drivers/emu/iavf/rte_iavf_emu.h create mode 100644 drivers/emu/iavf/version.map create mode 100644 drivers/emu/meson.build create mode 100644 lib/librte_emudev/meson.build create mode 100644 lib/librte_emudev/rte_emudev.c create mode 100644 lib/librte_emudev/rte_emudev.h create mode 100644 lib/librte_emudev/rte_emudev_vdev.h create mode 100644 lib/librte_emudev/version.map -- 2.17.1