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 0D9F4A056A; Wed, 18 Mar 2020 02:17:59 +0100 (CET) Received: from [92.243.14.124] (localhost [127.0.0.1]) by dpdk.org (Postfix) with ESMTP id 630B21C038; Wed, 18 Mar 2020 02:17:59 +0100 (CET) Received: from mga17.intel.com (mga17.intel.com [192.55.52.151]) by dpdk.org (Postfix) with ESMTP id 1DBD01C025 for ; Wed, 18 Mar 2020 02:17:57 +0100 (CET) IronPort-SDR: 6iMmzaXl4ln2S/Tm/NJqbK++/rtWHY9obLVkOw8cVxTqfowUFpR22ECwSeF62PBYULZjIJ3fhd kkGE9UcDLt5g== X-Amp-Result: SKIPPED(no attachment in message) X-Amp-File-Uploaded: False Received: from orsmga004.jf.intel.com ([10.7.209.38]) by fmsmga107.fm.intel.com with ESMTP/TLS/ECDHE-RSA-AES256-GCM-SHA384; 17 Mar 2020 18:17:57 -0700 IronPort-SDR: vMji6ZrDfz20+UCpCw4ulq0Yvce9ry8n7KTrDvzzw8XkW37Etg/s4TaiWmmYuV5BJ421jnbXdC qziAdKmJpaBQ== X-ExtLoop1: 1 X-IronPort-AV: E=Sophos;i="5.70,565,1574150400"; d="scan'208";a="391272238" Received: from fmsmsx105.amr.corp.intel.com ([10.18.124.203]) by orsmga004.jf.intel.com with ESMTP; 17 Mar 2020 18:17:56 -0700 Received: from fmsmsx126.amr.corp.intel.com (10.18.125.43) by FMSMSX105.amr.corp.intel.com (10.18.124.203) with Microsoft SMTP Server (TLS) id 14.3.439.0; Tue, 17 Mar 2020 18:17:56 -0700 Received: from shsmsx153.ccr.corp.intel.com (10.239.6.53) by FMSMSX126.amr.corp.intel.com (10.18.125.43) with Microsoft SMTP Server (TLS) id 14.3.439.0; Tue, 17 Mar 2020 18:17:56 -0700 Received: from shsmsx103.ccr.corp.intel.com ([169.254.4.137]) by SHSMSX153.ccr.corp.intel.com ([169.254.12.96]) with mapi id 14.03.0439.000; Wed, 18 Mar 2020 09:17:53 +0800 From: "Liu, Yong" To: "Hu, Jiayu" , "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/AXc0JbTYtqDQ0KPdAURhxwcQqhMTaNQ//+zGwCAAYxdkA== Date: Wed, 18 Mar 2020 01:17:53 +0000 Message-ID: <86228AFD5BCD8E4EBFD2B90117B5E81E6350B761@SHSMSX103.ccr.corp.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> <52aa242c93204fa9a23d53a60faa5e34@intel.com> In-Reply-To: <52aa242c93204fa9a23d53a60faa5e34@intel.com> Accept-Language: zh-CN, en-US Content-Language: en-US X-MS-Has-Attach: X-MS-TNEF-Correlator: dlp-product: dlpe-windows dlp-version: 11.2.0.6 dlp-reaction: no-action x-originating-ip: [10.239.127.40] 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" > -----Original Message----- > From: Hu, Jiayu > Sent: Tuesday, March 17, 2020 5:36 PM > To: Liu, Yong ; dev@dpdk.org > Cc: maxime.coquelin@redhat.com; Ye, Xiaolong ; > Wang, Zhihong > Subject: RE: [dpdk-dev] [PATCH 2/4] net/vhost: setup vrings for DMA- > accelerated datapath >=20 > Hi Marvin, >=20 > > -----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 > > > > > > > > > + > > > +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; > > > > Look like nr_batching can't be negative value, please changed to uint16= _t > or > > uint32_t. >=20 > Thanks, will change it later. >=20 > > > 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) > > > > Jiayu, > > We have same set of functions for gpa to hpa translation in vhost libra= ry. > Can > > those functions be shared here? >=20 > Do you think it's necessary to provide a API for translating GPA to HPA? >=20 IMHO, these functions are common requirement for accelerators. It is worth= y to think about it. > > > > Thanks, > > Marvin > >