From mboxrd@z Thu Jan  1 00:00:00 1970
Return-Path: <zhiyong.yang@intel.com>
Received: from mga14.intel.com (mga14.intel.com [192.55.52.115])
 by dpdk.org (Postfix) with ESMTP id 046527CC4
 for <dev@dpdk.org>; Wed, 21 Mar 2018 04:03:48 +0100 (CET)
X-Amp-Result: SKIPPED(no attachment in message)
X-Amp-File-Uploaded: False
Received: from orsmga002.jf.intel.com ([10.7.209.21])
 by fmsmga103.fm.intel.com with ESMTP/TLS/DHE-RSA-AES256-GCM-SHA384;
 20 Mar 2018 20:03:46 -0700
X-ExtLoop1: 1
X-IronPort-AV: E=Sophos;i="5.48,338,1517904000"; d="scan'208";a="43883949"
Received: from dpdk9.bj.intel.com ([172.16.182.183])
 by orsmga002.jf.intel.com with ESMTP; 20 Mar 2018 20:03:44 -0700
From: zhiyong.yang@intel.com
To: dev@dpdk.org
Cc: jianfeng.tan@intel.com, zhihong.wang@intel.com, maxime.coquelin@redhat.com,
 thomas@monjalon.net, dong1.wang@intel.com, tiwei.bie@intel.com
Date: Wed, 21 Mar 2018 11:03:39 +0800
Message-Id: <20180321030343.64399-1-zhiyong.yang@intel.com>
X-Mailer: git-send-email 2.14.3
In-Reply-To: <20180214145330.4679-1-zhiyong.yang@intel.com>
References: <20180214145330.4679-1-zhiyong.yang@intel.com>
Subject: [dpdk-dev] [PATCH v3 0/4] add support for virtio-user server mode
X-BeenThere: dev@dpdk.org
X-Mailman-Version: 2.1.15
Precedence: list
List-Id: DPDK patches and discussions <dev.dpdk.org>
List-Unsubscribe: <https://dpdk.org/ml/options/dev>,
 <mailto:dev-request@dpdk.org?subject=unsubscribe>
List-Archive: <http://dpdk.org/ml/archives/dev/>
List-Post: <mailto:dev@dpdk.org>
List-Help: <mailto:dev-request@dpdk.org?subject=help>
List-Subscribe: <https://dpdk.org/ml/listinfo/dev>,
 <mailto:dev-request@dpdk.org?subject=subscribe>
X-List-Received-Date: Wed, 21 Mar 2018 03:03:49 -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 then 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 with server mode creates socket file and then starts to wait for the
first connection from vhost user with client mode in blocking mode.

Virtio-user with server mode supports many times' vhost reconnections with the
same configurations. 

Virtio-user supports only one connection at the same time in server/client mode.

How to test?
The following scripts are as reference.

./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

./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

step1 : at the virtio-user side, run "start"
step2: 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.

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 according to Maxime's
comments.
2. move fdset related functions to librte_eal from librte_vhost exposed as
new APIs according to Thomas' comments.
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 (4):
  net/virtio: fix add pointer checking
  net/virtio: add checking for cvq
  net/virtio-user: add support for server mode
  net/vhost: add NULL pointer checking

 doc/guides/rel_notes/release_18_05.rst           |  7 ++
 drivers/net/vhost/rte_eth_vhost.c                |  9 +++
 drivers/net/virtio/virtio_ethdev.c               |  9 ++-
 drivers/net/virtio/virtio_user/vhost_user.c      | 96 ++++++++++++++++++++++--
 drivers/net/virtio/virtio_user/virtio_user_dev.c | 47 ++++++++----
 drivers/net/virtio/virtio_user/virtio_user_dev.h | 11 +++
 drivers/net/virtio/virtio_user_ethdev.c          | 83 +++++++++++++++++++-
 7 files changed, 238 insertions(+), 24 deletions(-)

-- 
2.14.3