> -----Original Message-----
> From: Hu, Jiayu <jiayu...@intel.com>
> Sent: Tuesday, March 17, 2020 5:36 PM
> To: Liu, Yong <yong....@intel.com>; dev@dpdk.org
> Cc: maxime.coque...@redhat.com; Ye, Xiaolong <xiaolong...@intel.com>;
> Wang, Zhihong <zhihong.w...@intel.com>
> Subject: RE: [dpdk-dev] [PATCH 2/4] net/vhost: setup vrings for DMA-
> accelerated datapath
>
> Hi Marvin,
>
> > -----Original Message-----
> > From: Liu, Yong <yong....@intel.com>
> > Sent: Tuesday, March 17, 2020 2:30 PM
> > To: Hu, Jiayu <jiayu...@intel.com>; dev@dpdk.org
> > Cc: maxime.coque...@redhat.com; Ye, Xiaolong <xiaolong...@intel.com>;
> > Wang, Zhihong <zhihong.w...@intel.com>; Hu, Jiayu
> <jiayu...@intel.com>
> > 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.
>
> 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 <sys/types.h>
> > > +#include <sys/stat.h>
> > > +#include <unistd.h>
> > > +
> > > +#include "internal.h"
> > > +
> > > +static uint64_t
> > > +get_blk_size(int fd)
> > > +{
> > > + struct stat stat;
> > > + int ret;
> > > +
> > > + ret = fstat(fd, &stat);
> > > + return ret == -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 library.
> Can
> > those functions be shared here?
>
> Do you think it's necessary to provide a API for translating GPA to HPA?
>
IMHO, these functions are common requirement for accelerators. It is worthy to
think about it.
> >
> > Thanks,
> > Marvin
> >