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 A7E10A0C4C; Tue, 13 Jul 2021 19:02:36 +0200 (CEST) Received: from [217.70.189.124] (localhost [127.0.0.1]) by mails.dpdk.org (Postfix) with ESMTP id 26EF841257; Tue, 13 Jul 2021 19:02:36 +0200 (CEST) Received: from us-smtp-delivery-124.mimecast.com (us-smtp-delivery-124.mimecast.com [170.10.133.124]) by mails.dpdk.org (Postfix) with ESMTP id 42F6241238 for ; Tue, 13 Jul 2021 19:02:34 +0200 (CEST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1626195753; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:cc:mime-version:mime-version:content-type:content-type: content-transfer-encoding:content-transfer-encoding: in-reply-to:in-reply-to:references:references; bh=330whPmfdSe7xoNMhgkSKT35LNFRufuevUZ9zwLVb18=; b=EERDLcJ+P9n70vcW3TB1SbRjEN7hm+TqoDaLBO7IjY9e4nvs42wt2SIKOaN1pEVpNX/l40 ifRWUKgU7uEeIk07h0Qrzp7zhra/lZIJWjuCXh+Y0NgOBgDj4JUfUzy/ItIcOpBTDz68Y3 W1OTiRgVX7qsKQ5AmWIAV8OQvJ2LUQA= Received: from mimecast-mx01.redhat.com (mimecast-mx01.redhat.com [209.132.183.4]) (Using TLS) by relay.mimecast.com with ESMTP id us-mta-62-jJrOpEdVPLiQ9NyAeZzGJQ-1; Tue, 13 Jul 2021 13:02:32 -0400 X-MC-Unique: jJrOpEdVPLiQ9NyAeZzGJQ-1 Received: from smtp.corp.redhat.com (int-mx01.intmail.prod.int.phx2.redhat.com [10.5.11.11]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by mimecast-mx01.redhat.com (Postfix) with ESMTPS id 3DB6110A0C8C; Tue, 13 Jul 2021 17:01:58 +0000 (UTC) Received: from [10.36.110.39] (unknown [10.36.110.39]) by smtp.corp.redhat.com (Postfix) with ESMTPS id 1321C7E8CB; Tue, 13 Jul 2021 17:01:56 +0000 (UTC) To: Wenwu Ma , dev@dpdk.org Cc: chenbo.xia@intel.com, cheng1.jiang@intel.com, jiayu.hu@intel.com References: <20210602083110.5530-1-yuanx.wang@intel.com> <20210705181151.141752-1-wenwux.ma@intel.com> <20210705181151.141752-5-wenwux.ma@intel.com> From: Maxime Coquelin Message-ID: Date: Tue, 13 Jul 2021 19:01:55 +0200 User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:78.0) Gecko/20100101 Thunderbird/78.11.0 MIME-Version: 1.0 In-Reply-To: <20210705181151.141752-5-wenwux.ma@intel.com> X-Scanned-By: MIMEDefang 2.79 on 10.5.11.11 Authentication-Results: relay.mimecast.com; auth=pass smtp.auth=CUSA124A263 smtp.mailfrom=maxime.coquelin@redhat.com X-Mimecast-Spam-Score: 0 X-Mimecast-Originator: redhat.com Content-Type: text/plain; charset=utf-8 Content-Language: en-US Content-Transfer-Encoding: 8bit Subject: Re: [dpdk-dev] [PATCH v5 4/4] examples/vhost: support vhost async dequeue data path 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 Sender: "dev" On 7/5/21 8:11 PM, Wenwu Ma wrote: > This patch is to add vhost async dequeue data-path in vhost sample. > vswitch can leverage IOAT to accelerate vhost async dequeue data-path. " This patch adds support for async dequeue path to Vhost example. " > Signed-off-by: Wenwu Ma > --- > doc/guides/sample_app_ug/vhost.rst | 9 +- > examples/vhost/ioat.c | 61 ++++++++++--- > examples/vhost/ioat.h | 25 ++++++ > examples/vhost/main.c | 140 ++++++++++++++++++++--------- > 4 files changed, 177 insertions(+), 58 deletions(-) > > diff --git a/doc/guides/sample_app_ug/vhost.rst b/doc/guides/sample_app_ug/vhost.rst > index 9afde9c7f5..63dcf181e1 100644 > --- a/doc/guides/sample_app_ug/vhost.rst > +++ b/doc/guides/sample_app_ug/vhost.rst > @@ -169,9 +169,12 @@ demonstrates how to use the async vhost APIs. It's used in combination with dmas > **--dmas** > This parameter is used to specify the assigned DMA device of a vhost device. > Async vhost-user net driver will be used if --dmas is set. For example > ---dmas [txd0@00:04.0,txd1@00:04.1] means use DMA channel 00:04.0 for vhost > -device 0 enqueue operation and use DMA channel 00:04.1 for vhost device 1 > -enqueue operation. > +--dmas [txd0@00:04.0,txd1@00:04.1,rxd0@00:04.2,rxd1@00:04.3] means use > +DMA channel 00:04.0/00:04.2 for vhost device 0 enqueue/dequeue operation > +and use DMA channel 00:04.1/00:04.3 for vhost device 1 enqueue/dequeue > +operation. The index of the device corresponds to the socket file in order, > +that means vhost device 0 is created through the first socket file, vhost > +device 1 is created through the second socket file, and so on. > > Common Issues > ------------- > diff --git a/examples/vhost/ioat.c b/examples/vhost/ioat.c > index bf4e033bdb..a305100b47 100644 > --- a/examples/vhost/ioat.c > +++ b/examples/vhost/ioat.c > @@ -21,6 +21,8 @@ struct packet_tracker { > > struct packet_tracker cb_tracker[MAX_VHOST_DEVICE]; > > +int vid2socketid[MAX_VHOST_DEVICE]; > + > int > open_ioat(const char *value) > { > @@ -29,7 +31,7 @@ open_ioat(const char *value) > char *addrs = input; > char *ptrs[2]; > char *start, *end, *substr; > - int64_t vid, vring_id; > + int64_t socketid, vring_id; > struct rte_ioat_rawdev_config config; > struct rte_rawdev_info info = { .dev_private = &config }; > char name[32]; > @@ -60,6 +62,8 @@ open_ioat(const char *value) > goto out; > } > while (i < args_nr) { > + char *txd, *rxd; > + bool is_txd; > char *arg_temp = dma_arg[i]; > uint8_t sub_nr; > sub_nr = rte_strsplit(arg_temp, strlen(arg_temp), ptrs, 2, '@'); > @@ -68,27 +72,38 @@ open_ioat(const char *value) > goto out; > } > > - start = strstr(ptrs[0], "txd"); > - if (start == NULL) { > + int async_flag; > + txd = strstr(ptrs[0], "txd"); > + rxd = strstr(ptrs[0], "rxd"); > + if (txd == NULL && rxd == NULL) { > ret = -1; > goto out; > + } else if (txd) { > + is_txd = true; > + start = txd; > + async_flag = ASYNC_RX_VHOST; That's confusing to set ASYNC_RX_VHOST flag when txd is present. IIUC, this is about the enqueue path, so TX from Vhost point of view. So either name the flag ASYNC_TX_VHOST or ASYNV_ENQUEUE_VHOST? > + } else { > + is_txd = false; > + start = rxd; > + async_flag = ASYNC_TX_VHOST; > } What if both are set by the user? you might want to add a check.