From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from mails.dpdk.org (mails.dpdk.org [217.70.189.124]) by inbox.dpdk.org (Postfix) with ESMTP id 2D544A0350; Fri, 31 Dec 2021 01:56:07 +0100 (CET) Received: from [217.70.189.124] (localhost [127.0.0.1]) by mails.dpdk.org (Postfix) with ESMTP id A67034069D; Fri, 31 Dec 2021 01:56:06 +0100 (CET) Received: from sender11-of-o51.zoho.eu (sender11-of-o51.zoho.eu [31.186.226.237]) by mails.dpdk.org (Postfix) with ESMTP id 2288C4067E for ; Fri, 31 Dec 2021 01:56:05 +0100 (CET) ARC-Seal: i=1; a=rsa-sha256; t=1640912161; cv=none; d=zohomail.eu; s=zohoarc; b=acYFWPdSUCsFv8PGRUACWbOcryED6qWJdJHwYq7CWBf8XtAy9Ogma5O7+5mkXnTomaqJuSMb6rElGcXPK95+HwQtKsAXry4GGfC0qtTpFUMVYoiTCFevgs3YDjF+exdFi4ZTbUVcz55Z+tOObDciEb2v7tUYtDYnf1VaYsoJaa4= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.eu; s=zohoarc; t=1640912161; h=Content-Type:Cc:Date:From:In-Reply-To:MIME-Version:Message-ID:References:Subject:To; bh=/WE0nuwULj6yaO+oPcBEjuUVJgp/A4PjV92sMnuOb2o=; b=cmGTWoDYQ8tXZebmnqSrniGytJJw9DE1/Z8UOXn2jSSyMRyOGgtmC1eP3AJf/T1GZfaHRy/50ZdpJwAQIACGPANbswGgqD881Brt957AH75yyoaiosMZzHhcujF4JxReid2wutqadcfxLbcQjKIP30lYzmziuMIT4SHTst3uWcM= ARC-Authentication-Results: i=1; mx.zohomail.eu; spf=pass smtp.mailfrom=liangma@liangbit.com; dmarc=pass header.from= Received: from DESKTOP-POQV63C.localdomain (cpc145956-finc19-2-0-cust124.4-2.cable.virginm.net [82.25.6.125]) by mx.zoho.eu with SMTPS id 1640912158860791.3565457350213; Fri, 31 Dec 2021 01:55:58 +0100 (CET) Date: Fri, 31 Dec 2021 00:55:54 +0000 From: Liang Ma To: Jiayu Hu Cc: dev@dpdk.org, maxime.coquelin@redhat.com, i.maximets@ovn.org, chenbo.xia@intel.com, bruce.richardson@intel.com, harry.van.haaren@intel.com, sunil.pai.g@intel.com, john.mcnamara@intel.com, xuan.ding@intel.com, cheng1.jiang@intel.com Subject: Re: [PATCH v1 1/1] vhost: integrate dmadev in asynchronous datapath Message-ID: <20211231005554.GA67@DESKTOP-POQV63C.localdomain> References: <20211122105437.3534231-1-jiayu.hu@intel.com> <20211230215505.329674-1-jiayu.hu@intel.com> <20211230215505.329674-2-jiayu.hu@intel.com> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <20211230215505.329674-2-jiayu.hu@intel.com> User-Agent: Mutt/1.9.4 (2018-02-28) X-ZohoMailClient: External X-BeenThere: dev@dpdk.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: DPDK patches and discussions List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: dev-bounces@dpdk.org On Thu, Dec 30, 2021 at 04:55:05PM -0500, Jiayu Hu wrote: > Since dmadev is introduced in 21.11, to avoid the overhead of vhost DMA > abstraction layer and simplify application logics, this patch integrates > dmadev in asynchronous data path. > > Signed-off-by: Jiayu Hu > Signed-off-by: Sunil Pai G > --- > doc/guides/prog_guide/vhost_lib.rst | 70 ++++----- > examples/vhost/Makefile | 2 +- > examples/vhost/ioat.c | 218 -------------------------- > examples/vhost/ioat.h | 63 -------- > examples/vhost/main.c | 230 +++++++++++++++++++++++----- > examples/vhost/main.h | 11 ++ > examples/vhost/meson.build | 6 +- > lib/vhost/meson.build | 3 +- > lib/vhost/rte_vhost_async.h | 121 +++++---------- > lib/vhost/version.map | 3 + > lib/vhost/vhost.c | 130 +++++++++++----- > lib/vhost/vhost.h | 53 ++++++- > lib/vhost/virtio_net.c | 206 +++++++++++++++++++------ > 13 files changed, 587 insertions(+), 529 deletions(-) > delete mode 100644 examples/vhost/ioat.c > delete mode 100644 examples/vhost/ioat.h > > diff --git a/examples/vhost/main.c b/examples/vhost/main.c > index 33d023aa39..44073499bc 100644 > --- a/examples/vhost/main.c > +++ b/examples/vhost/main.c > @@ -24,8 +24,9 @@ > #include > #include > #include > +#include > +#include > > -#include "ioat.h" > #include "main.h" > > #ifndef MAX_QUEUES > @@ -56,6 +57,14 @@ > #define RTE_TEST_TX_DESC_DEFAULT 512 > > #define INVALID_PORT_ID 0xFF > +#define INVALID_DMA_ID -1 > + > +#define MAX_VHOST_DEVICE 1024 > +#define DMA_RING_SIZE 4096 > + > +struct dma_for_vhost dma_bind[MAX_VHOST_DEVICE]; > +struct rte_vhost_async_dma_info dma_config[RTE_DMADEV_DEFAULT_MAX]; > +static int dma_count; > > /* mask of enabled ports */ > static uint32_t enabled_port_mask = 0; > @@ -96,8 +105,6 @@ static int builtin_net_driver; > > static int async_vhost_driver; > > -static char *dma_type; > - > /* Specify timeout (in useconds) between retries on RX. */ > static uint32_t burst_rx_delay_time = BURST_RX_WAIT_US; > /* Specify the number of retries on RX. */ > @@ -196,13 +203,134 @@ struct vhost_bufftable *vhost_txbuff[RTE_MAX_LCORE * MAX_VHOST_DEVICE]; > #define MBUF_TABLE_DRAIN_TSC ((rte_get_tsc_hz() + US_PER_S - 1) \ > / US_PER_S * BURST_TX_DRAIN_US) > > +static inline bool > +is_dma_configured(int16_t dev_id) > +{ > + int i; > + > + for (i = 0; i < dma_count; i++) { > + if (dma_config[i].dev_id == dev_id) { > + return true; > + } > + } > + return false; > +} > + > static inline int > open_dma(const char *value) > { > - if (dma_type != NULL && strncmp(dma_type, "ioat", 4) == 0) > - return open_ioat(value); > + struct dma_for_vhost *dma_info = dma_bind; > + char *input = strndup(value, strlen(value) + 1); > + char *addrs = input; > + char *ptrs[2]; > + char *start, *end, *substr; > + int64_t vid, vring_id; > + > + struct rte_dma_info info; > + struct rte_dma_conf dev_config = { .nb_vchans = 1 }; > + struct rte_dma_vchan_conf qconf = { > + .direction = RTE_DMA_DIR_MEM_TO_MEM, > + .nb_desc = DMA_RING_SIZE > + }; > + > + int dev_id; > + int ret = 0; > + uint16_t i = 0; > + char *dma_arg[MAX_VHOST_DEVICE]; > + int args_nr; > + > + while (isblank(*addrs)) > + addrs++; > + if (*addrs == '\0') { > + ret = -1; > + goto out; > + } > + > + /* process DMA devices within bracket. */ > + addrs++; > + substr = strtok(addrs, ";]"); > + if (!substr) { > + ret = -1; > + goto out; > + } > + > + args_nr = rte_strsplit(substr, strlen(substr), > + dma_arg, MAX_VHOST_DEVICE, ','); > + if (args_nr <= 0) { > + ret = -1; > + goto out; > + } > + > + while (i < args_nr) { > + char *arg_temp = dma_arg[i]; > + uint8_t sub_nr; > + > + sub_nr = rte_strsplit(arg_temp, strlen(arg_temp), ptrs, 2, '@'); > + if (sub_nr != 2) { > + ret = -1; > + goto out; > + } > + > + start = strstr(ptrs[0], "txd"); Hi JiaYu, it looks the parameter checking ignore the "rxd" case ? I think if the patch enable enqueue/dequeue at same time. rxd is needed for DMAS parameters. Regards Liang