From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from dpdk.org (dpdk.org [92.243.14.124]) by inbox.dpdk.org (Postfix) with ESMTP id 8CAA8A0559; Tue, 17 Mar 2020 10:36:04 +0100 (CET) Received: from [92.243.14.124] (localhost [127.0.0.1]) by dpdk.org (Postfix) with ESMTP id 1779B1C027; Tue, 17 Mar 2020 10:36:04 +0100 (CET) Received: from mga02.intel.com (mga02.intel.com [134.134.136.20]) by dpdk.org (Postfix) with ESMTP id 83BFB1C027 for ; Tue, 17 Mar 2020 10:35:57 +0100 (CET) IronPort-SDR: SueyDaaJCeAS56n74TCGsVaoCvCi7oK8KW6IXNCsS3azpvdUYHdIb74JoxZtvKzQlBKnfsBfez pzmz/GtJ74FQ== X-Amp-Result: SKIPPED(no attachment in message) X-Amp-File-Uploaded: False Received: from fmsmga004.fm.intel.com ([10.253.24.48]) by orsmga101.jf.intel.com with ESMTP/TLS/ECDHE-RSA-AES256-GCM-SHA384; 17 Mar 2020 02:35:55 -0700 IronPort-SDR: aJkf+QgId4yjaZnvXF8W2y4H6hK/yfOD+6NPP7E4TB/m2O1ClhKkBVOWtuEoo41eC6UgrKj9Ch 8XZQS3Gvin8A== X-ExtLoop1: 1 X-IronPort-AV: E=Sophos;i="5.70,563,1574150400"; d="scan'208";a="267902284" Received: from fmsmsx103.amr.corp.intel.com ([10.18.124.201]) by fmsmga004.fm.intel.com with ESMTP; 17 Mar 2020 02:35:55 -0700 Received: from shsmsx606.ccr.corp.intel.com (10.109.6.216) by FMSMSX103.amr.corp.intel.com (10.18.124.201) with Microsoft SMTP Server (TLS) id 14.3.439.0; Tue, 17 Mar 2020 02:35:54 -0700 Received: from shsmsx602.ccr.corp.intel.com (10.109.6.142) by SHSMSX606.ccr.corp.intel.com (10.109.6.216) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_128_GCM_SHA256) id 15.1.1713.5; Tue, 17 Mar 2020 17:35:52 +0800 Received: from shsmsx602.ccr.corp.intel.com ([10.109.6.142]) by SHSMSX602.ccr.corp.intel.com ([10.109.6.142]) with mapi id 15.01.1713.004; Tue, 17 Mar 2020 17:35:52 +0800 From: "Hu, Jiayu" To: "Liu, Yong" , "dev@dpdk.org" CC: "maxime.coquelin@redhat.com" , "Ye, Xiaolong" , "Wang, Zhihong" Thread-Topic: [dpdk-dev] [PATCH 2/4] net/vhost: setup vrings for DMA-accelerated datapath Thread-Index: AQHV/CVsUdwrf05ZlUOSa8Wdyrwb+qhMhXiw Date: Tue, 17 Mar 2020 09:35:52 +0000 Message-ID: <52aa242c93204fa9a23d53a60faa5e34@intel.com> References: <1584436885-18651-1-git-send-email-jiayu.hu@intel.com> <1584436885-18651-3-git-send-email-jiayu.hu@intel.com> <86228AFD5BCD8E4EBFD2B90117B5E81E6350B013@SHSMSX103.ccr.corp.intel.com> In-Reply-To: <86228AFD5BCD8E4EBFD2B90117B5E81E6350B013@SHSMSX103.ccr.corp.intel.com> Accept-Language: en-US Content-Language: en-US X-MS-Has-Attach: X-MS-TNEF-Correlator: dlp-reaction: no-action dlp-version: 11.2.0.6 dlp-product: dlpe-windows x-originating-ip: [10.239.127.36] Content-Type: text/plain; charset="us-ascii" Content-Transfer-Encoding: quoted-printable MIME-Version: 1.0 Subject: Re: [dpdk-dev] [PATCH 2/4] net/vhost: setup vrings for DMA-accelerated datapath 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" Hi Marvin, > -----Original Message----- > From: Liu, Yong > Sent: Tuesday, March 17, 2020 2:30 PM > To: Hu, Jiayu ; dev@dpdk.org > Cc: maxime.coquelin@redhat.com; Ye, Xiaolong ; > Wang, Zhihong ; Hu, Jiayu > Subject: RE: [dpdk-dev] [PATCH 2/4] net/vhost: setup vrings for DMA- > accelerated datapath >=20 >=20 >=20 > > + > > +struct guest_page { > > + uint64_t guest_phys_addr; > > + uint64_t host_phys_addr; > > + uint64_t size; > > +}; > > + > > +struct dma_vring { > > + struct rte_vhost_vring vr; > > + > > + uint16_t last_avail_idx; > > + uint16_t last_used_idx; > > + > > + /* the last used index that front end can consume */ > > + uint16_t copy_done_used; > > + > > + uint16_t signalled_used; > > + bool signalled_used_valid; > > + > > + struct vring_used_elem *shadow_used_split; > > + uint16_t shadow_used_idx; > > + > > + struct batch_copy_elem *batch_copy_elems; > > + uint16_t batch_copy_nb_elems; > > + > > + bool dma_enabled; > > + /** > > + * DMA ID. Currently, we only support I/OAT, > > + * so it's I/OAT rawdev ID. > > + */ > > + uint16_t dev_id; > > + /* DMA address */ > > + struct rte_pci_addr dma_addr; > > + /** > > + * the number of copy jobs that are submitted to the DMA > > + * but may not be completed. > > + */ > > + uint64_t nr_inflight; > > + int nr_batching; >=20 > Look like nr_batching can't be negative value, please changed to uint16_t= or > uint32_t. Thanks, will change it later. > > diff --git a/drivers/net/vhost/virtio_net.h b/drivers/net/vhost/virtio_= net.h > > new file mode 100644 > > index 0000000..7f99f1d > > --- /dev/null > > +++ b/drivers/net/vhost/virtio_net.h > > @@ -0,0 +1,168 @@ > > +/* SPDX-License-Identifier: BSD-3-Clause > > + * Copyright(c) 2020 Intel Corporation > > + */ > > +#ifndef _VIRTIO_NET_H_ > > +#define _VIRTIO_NET_H_ > > + > > +#ifdef __cplusplus > > +extern "C" { > > +#endif > > + > > +#include > > +#include > > +#include > > + > > +#include "internal.h" > > + > > +static uint64_t > > +get_blk_size(int fd) > > +{ > > + struct stat stat; > > + int ret; > > + > > + ret =3D fstat(fd, &stat); > > + return ret =3D=3D -1 ? (uint64_t)-1 : (uint64_t)stat.st_blksize; > > +} > > + > > +static __rte_always_inline int > > +add_one_guest_page(struct pmd_internal *dev, uint64_t > guest_phys_addr, > > + uint64_t host_phys_addr, uint64_t size) >=20 > Jiayu, > We have same set of functions for gpa to hpa translation in vhost library= . Can > those functions be shared here? Do you think it's necessary to provide a API for translating GPA to HPA? >=20 > Thanks, > Marvin >=20