From patchwork Wed Jun 19 15:14:50 2019 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Nikos Dragazis X-Patchwork-Id: 54992 X-Patchwork-Delegate: maxime.coquelin@redhat.com Return-Path: X-Original-To: patchwork@dpdk.org Delivered-To: patchwork@dpdk.org Received: from [92.243.14.124] (localhost [127.0.0.1]) by dpdk.org (Postfix) with ESMTP id E759B1C44A; Wed, 19 Jun 2019 17:16:47 +0200 (CEST) Received: from mx0.arrikto.com (mx0.arrikto.com [212.71.252.59]) by dpdk.org (Postfix) with ESMTP id B09FC1C3A1 for ; Wed, 19 Jun 2019 17:15:47 +0200 (CEST) Received: from troi.prod.arr (mail.arr [10.99.0.5]) by mx0.arrikto.com (Postfix) with ESMTP id 8FF3118201D; Wed, 19 Jun 2019 18:15:47 +0300 (EEST) Received: from localhost.localdomain (unknown [10.89.50.133]) by troi.prod.arr (Postfix) with ESMTPSA id 1219C32C; Wed, 19 Jun 2019 18:15:47 +0300 (EEST) From: Nikos Dragazis To: dev@dpdk.org Cc: Maxime Coquelin , Tiwei Bie , Zhihong Wang , Stefan Hajnoczi , Wei Wang , Stojaczyk Dariusz , Vangelis Koukis Date: Wed, 19 Jun 2019 18:14:50 +0300 Message-Id: <1560957293-17294-26-git-send-email-ndragazis@arrikto.com> X-Mailer: git-send-email 2.7.4 In-Reply-To: <1560957293-17294-1-git-send-email-ndragazis@arrikto.com> References: <1560957293-17294-1-git-send-email-ndragazis@arrikto.com> Subject: [dpdk-dev] [PATCH 25/28] 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: , Errors-To: dev-bounces@dpdk.org Sender: "dev" From: Stefan Hajnoczi 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 d2d02fd..020f4a0 100644 --- a/examples/vhost_scsi/vhost_scsi.c +++ b/examples/vhost_scsi/vhost_scsi.c @@ -27,6 +27,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; @@ -408,7 +409,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; } @@ -444,7 +445,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); } @@ -453,7 +455,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); } @@ -465,6 +468,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}, }; @@ -475,6 +479,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: