From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from mga07.intel.com (mga07.intel.com [134.134.136.100]) by dpdk.org (Postfix) with ESMTP id 6025C1B3E5 for ; Fri, 22 Dec 2017 16:41:22 +0100 (CET) X-Amp-Result: SKIPPED(no attachment in message) X-Amp-File-Uploaded: False Received: from orsmga007.jf.intel.com ([10.7.209.58]) by orsmga105.jf.intel.com with ESMTP/TLS/DHE-RSA-AES256-GCM-SHA384; 22 Dec 2017 07:41:20 -0800 X-ExtLoop1: 1 X-IronPort-AV: E=Sophos;i="5.45,441,1508828400"; d="scan'208";a="4814567" Received: from unknown (HELO dpdk98.sh.intel.com) ([10.67.111.140]) by orsmga007.jf.intel.com with ESMTP; 22 Dec 2017 07:41:18 -0800 From: Zhihong Wang To: dev@dpdk.org Cc: jianfeng.tan@intel.com, tiwei.bie@intel.com, maxime.coquelin@redhat.com, yliu@fridaylinux.org, cunming.liang@intel.com, xiao.w.wang@intel.com, dan.daly@intel.com Date: Fri, 22 Dec 2017 22:36:41 -0500 Message-Id: <1514000203-69699-1-git-send-email-zhihong.wang@intel.com> X-Mailer: git-send-email 2.7.5 Subject: [dpdk-dev] [PATCH RFC 0/2] vhost: support selective datapath X-BeenThere: dev@dpdk.org X-Mailman-Version: 2.1.15 Precedence: list List-Id: DPDK patches and discussions List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Fri, 22 Dec 2017 15:41:22 -0000 This patch set introduces support for selective datapath in DPDK vhost-user lib to enable acceleration. The default selection is the existing software implementation, while more options are available when more engines are present. vDPA stands for vhost Data Path Acceleration. The idea is to enable various types of devices to do data transfer with virtio driver directly. Design details ==== An engine is a group of devices support virtio datapath operations, like enqueue, dequeue, interrupt, doorbell. The definition of engine is as follows: struct rte_vdpa_eng_id { union { uint8_t __dummy[64]; struct { struct rte_pci_addr pci_addr; }; }; }; struct rte_vdpa_eng_attr { char name[MAX_VDPA_NAME_LEN]; struct rte_vdpa_eng_id *id; }; struct rte_vdpa_dev_ops { vdpa_dev_conf_t dev_conf; vdpa_dev_close_t dev_close; vdpa_vring_state_set_t vring_state_set; vdpa_migration_done_t migration_done; }; struct rte_vdpa_eng_ops { vdpa_eng_init_t eng_init; vdpa_eng_uninit_t eng_uninit; }; struct rte_vdpa_eng_driver { const char *name; struct rte_vdpa_eng_ops eng_ops; struct rte_vdpa_dev_ops dev_ops; } __rte_cache_aligned; struct rte_vdpa_engine { struct rte_vdpa_eng_attr eng_attr; struct rte_vdpa_eng_driver *eng_drv; } __rte_cache_aligned; Changes to the current vhost-user lib are: ==== 1. Make vhost device capabilities configurable to adopt various engines. Such capabilities include supported features, protocol features, queue number. APIs are introduced to let app configure these capabilities. 2. In addition to the existing vhost framework, a set of callbacks is added for vhost to call the driver for device operations at the right time: a. dev_conf: Called to configure the actual device when the virtio device becomes ready b. dev_close: Called to close the actual device when the virtio device is stopped c. vring_state_set: Called to change the state of the vring in the actual device when vring state changes d. migration_done: Called to allow the device to response to RARP sending 3. To make vhost aware of its own type, an engine id (eid) and a device id (did) are added into the vhost data structure, to index the actual device. APIs are introduced to let app configure it. Working process: ==== 1. Register driver during DPDK initialization. 2. Register engine with name and attributes, the name is used to match the right driver. 3. For each vhost device creation in app: a. Reserve device in the engine, so the eid and did are confirmed. b. Register vhost-user socket. c. Set capabilities of the vhost-user socket. d. Register vhost-user callbacks. e. Start to wait for connection. 4. When connection comes and virtio device data structure is created, set the eid and did in the new_device callback. Zhihong Wang (2): vhost: make capabilities configurable vhost: support selective datapath lib/librte_vhost/Makefile | 4 +- lib/librte_vhost/rte_vdpa.h | 126 ++++++++++++++++++++++++++++++++++++++++++ lib/librte_vhost/rte_vhost.h | 98 ++++++++++++++++++++++++++++++++ lib/librte_vhost/socket.c | 77 ++++++++++++++++++++++++++ lib/librte_vhost/vdpa.c | 122 ++++++++++++++++++++++++++++++++++++++++ lib/librte_vhost/vhost.c | 53 ++++++++++++++++++ lib/librte_vhost/vhost.h | 7 +++ lib/librte_vhost/vhost_user.c | 96 +++++++++++++++++++++++++++----- 8 files changed, 566 insertions(+), 17 deletions(-) create mode 100644 lib/librte_vhost/rte_vdpa.h create mode 100644 lib/librte_vhost/vdpa.c -- 2.7.5