From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from mx1.redhat.com (mx1.redhat.com [209.132.183.28]) by dpdk.org (Postfix) with ESMTP id B96A51B38D for ; Fri, 19 Jan 2018 14:48:15 +0100 (CET) Received: from smtp.corp.redhat.com (int-mx04.intmail.prod.int.phx2.redhat.com [10.5.11.14]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by mx1.redhat.com (Postfix) with ESMTPS id 1C0C6C0567A2; Fri, 19 Jan 2018 13:48:15 +0000 (UTC) Received: from localhost (ovpn-116-254.ams2.redhat.com [10.36.116.254]) by smtp.corp.redhat.com (Postfix) with ESMTP id 152C07E0BA; Fri, 19 Jan 2018 13:48:07 +0000 (UTC) From: Stefan Hajnoczi To: dev@dpdk.org Cc: maxime.coquelin@redhat.com, Yuanhan Liu , wei.w.wang@intel.com, mst@redhat.com, zhiyong.yang@intel.com, jasowang@redhat.com, Stefan Hajnoczi Date: Fri, 19 Jan 2018 13:44:41 +0000 Message-Id: <20180119134444.24927-22-stefanha@redhat.com> In-Reply-To: <20180119134444.24927-1-stefanha@redhat.com> References: <20180119134444.24927-1-stefanha@redhat.com> X-Scanned-By: MIMEDefang 2.79 on 10.5.11.14 X-Greylist: Sender IP whitelisted, not delayed by milter-greylist-4.5.16 (mx1.redhat.com [10.5.110.32]); Fri, 19 Jan 2018 13:48:15 +0000 (UTC) Subject: [dpdk-dev] [RFC 21/24] examples/vhost_scsi: add virtio-vhost-user support 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, 19 Jan 2018 13:48:16 -0000 The new --virtio-vhost-user-pci command-line argument uses virtio-vhost-user instead of the default AF_UNIX transport. Signed-off-by: Stefan Hajnoczi --- examples/vhost_scsi/vhost_scsi.c | 14 +++++++++++--- 1 file changed, 11 insertions(+), 3 deletions(-) diff --git a/examples/vhost_scsi/vhost_scsi.c b/examples/vhost_scsi/vhost_scsi.c index 0a8302e02..61001cadb 100644 --- a/examples/vhost_scsi/vhost_scsi.c +++ b/examples/vhost_scsi/vhost_scsi.c @@ -28,6 +28,7 @@ /* Path to folder where character device will be created. Can be set by user. */ static char dev_pathname[PATH_MAX] = ""; +static uint64_t dev_flags; /* for rte_vhost_driver_register() */ static struct vhost_scsi_ctrlr *g_vhost_ctrlr; static int g_should_stop; @@ -365,7 +366,7 @@ vhost_scsi_ctrlr_construct(void) int ret; struct vhost_scsi_ctrlr *ctrlr; - if (rte_vhost_driver_register(dev_pathname, 0) != 0) { + if (rte_vhost_driver_register(dev_pathname, dev_flags) != 0) { fprintf(stderr, "socket %s already exists\n", dev_pathname); return NULL; } @@ -401,7 +402,8 @@ static void set_dev_pathname(const char *path) { if (dev_pathname[0]) - rte_exit(EXIT_FAILURE, "--socket-file can only be given once.\n"); + rte_exit(EXIT_FAILURE, "Only one of --socket-file or " + "--virtio-vhost-user-pci can be given.\n"); snprintf(dev_pathname, sizeof(dev_pathname), "%s", path); } @@ -410,7 +412,8 @@ static void vhost_scsi_usage(const char *prgname) { fprintf(stderr, "%s [EAL options] --\n" - " --socket-file PATH: The path of the UNIX domain socket\n", + " --socket-file PATH: The path of the UNIX domain socket\n" + " --virtio-vhost-user-pci DomBDF: PCI adapter address\n", prgname); } @@ -422,6 +425,7 @@ vhost_scsi_parse_args(int argc, char **argv) const char *prgname = argv[0]; static struct option long_option[] = { {"socket-file", required_argument, NULL, 0}, + {"virtio-vhost-user-pci", required_argument, NULL, 0}, {NULL, 0, 0, 0}, }; @@ -432,6 +436,10 @@ vhost_scsi_parse_args(int argc, char **argv) if (!strcmp(long_option[option_index].name, "socket-file")) { set_dev_pathname(optarg); + } else if (!strcmp(long_option[option_index].name, + "virtio-vhost-user-pci")) { + set_dev_pathname(optarg); + dev_flags = RTE_VHOST_USER_VIRTIO_TRANSPORT; } break; default: -- 2.14.3