From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from mga09.intel.com (mga09.intel.com [134.134.136.24]) by dpdk.org (Postfix) with ESMTP id 2E19D1B690 for ; Tue, 3 Apr 2018 14:20:14 +0200 (CEST) X-Amp-Result: SKIPPED(no attachment in message) X-Amp-File-Uploaded: False Received: from fmsmga004.fm.intel.com ([10.253.24.48]) by orsmga102.jf.intel.com with ESMTP/TLS/DHE-RSA-AES256-GCM-SHA384; 03 Apr 2018 05:20:12 -0700 X-ExtLoop1: 1 X-IronPort-AV: E=Sophos;i="5.48,400,1517904000"; d="scan'208";a="43004813" Received: from dpdk9.bj.intel.com ([172.16.182.183]) by fmsmga004.fm.intel.com with ESMTP; 03 Apr 2018 05:20:10 -0700 From: zhiyong.yang@intel.com To: dev@dpdk.org Cc: maxime.coquelin@redhat.com, jianfeng.tan@intel.com, thomas@monjalon.net, zhihong.wang@intel.com, tiwei.bie@intel.com Date: Tue, 3 Apr 2018 20:20:08 +0800 Message-Id: <20180403122009.52876-1-zhiyong.yang@intel.com> X-Mailer: git-send-email 2.14.3 In-Reply-To: <20180321030343.64399-1-zhiyong.yang@intel.com> References: <20180321030343.64399-1-zhiyong.yang@intel.com> Subject: [dpdk-dev] [PATCH v4 0/1] server mode virtio-user 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: Tue, 03 Apr 2018 12:20:15 -0000 In a container environment if the vhost-user backend restarts, there's no way for it to reconnect to virtio-user currently. To address this, support for server mode is added. In this mode the socket file is created by virtio-user, which the backend connects to. This means that if the backend restarts, it can reconnect to virtio-user and continue communications. The series add support for the feature and target for 18.05 release. virtio-user adds support for server mode in this patch. Client mode vhost-user startup firstly, server mode virtio-user startups and creates the socket file to exchange vhost messages. If the connection is broken, client mode vhost-user can support to reconnect virtio-user. Server mode virtio-user supports many times' vhost-user reconnections with the same parameter configurations. Virtio-user supports only one connection at the same time in server/client mode. How to test? The following scripts are as reference. step1: ./x86_64-native-linuxapp-gcc/app/testpmd -c 0x3e000 -n 4 --socket-mem 256,0 \ --vdev 'net_vhost0,iface=/tmp/sock0,client=1,queues=1' -- -i --rxq=1 --txq=1 \ --nb-cores=1 --no-numa step2: ./x86_64-native-linuxapp-gcc/app/testpmd -c 0x3 -n 4 -m 256,0 --no-pci \ --file-prefix=testpmd0 --vdev=net_virtio_user0,mac=00:11:22:33:44:10, \ path=/tmp/sock0,server=1,queues=1 -- -i --rxq=1 --txq=1 --no-numa step3: at the virtio-user side, run "start" step4: at the vhost-user side, run "start tx_first 40000" Then you can get the numbers by running "show port stats all" at both sides. Vhost-user restarts (quit and startup again)and can reconnect virtio-user successfully again and continue communications. Changes in V4: 1. Don't create new pthread any more and use librte_eal interrupt thread. 2. virtio-user doesn't work in blocking mode any more for the first connection. Client mode vhost-user startups firstly, then server mode creates socket file and startups. Keep consistency with client mode virtio-user. Changes in V3: 1. use EAL epoll mechanism instead of vhost events. Cancel to export vhost event APIs. 2. rebase the code on top of dpdk-next-virtio Changes in V2: 1. split two patches 1/5 and 2/5 from v1 patchset to fix some existing issues which is not strongly related to support for server mode 2. move fdset related functions to librte_eal from librte_vhost exposed as new APIs. 3. release note is added in the patch 5/5. 4. squash data structure change patch into 4/5 according to Maxime's suggestion. Zhiyong Yang (1): net/virtio-user: add support for server mode doc/guides/rel_notes/release_18_05.rst | 6 ++ drivers/net/virtio/virtio_user/vhost_user.c | 64 ++++++++++++-- drivers/net/virtio/virtio_user/virtio_user_dev.c | 45 +++++++--- drivers/net/virtio/virtio_user/virtio_user_dev.h | 4 + drivers/net/virtio/virtio_user_ethdev.c | 103 +++++++++++++++++++++-- 5 files changed, 194 insertions(+), 28 deletions(-) -- 2.14.3