On 1/6/21 1:06 PM, Xia, Chenbo wrote:
> Hi Maxime,
>
>> -----Original Message-----
>> From: Maxime Coquelin <maxime.coque...@redhat.com>
>> Sent: Monday, December 21, 2020 5:14 AM
>> To: dev@dpdk.org; Xia, Chenbo <chenbo....@intel.com>; olivier.m...@6wind.com;
>> amore...@redhat.com; david.march...@redhat.com
>> Cc: Maxime Coquelin <maxime.coque...@redhat.com>
>> Subject: [PATCH 30/40] net/virtio: add Virtio-user vring address ops
>>
>> This patch introduces a new callback for setting
>> vrings addresses.
>>
>> Signed-off-by: Maxime Coquelin <maxime.coque...@redhat.com>
>> ---
>> drivers/net/virtio/virtio_user/vhost.h | 1 +
>> drivers/net/virtio/virtio_user/vhost_kernel.c | 32 +++++++++++++------
>> drivers/net/virtio/virtio_user/vhost_user.c | 29 +++++++++++++----
>> drivers/net/virtio/virtio_user/vhost_vdpa.c | 8 ++++-
>> .../net/virtio/virtio_user/virtio_user_dev.c | 2 +-
>> 5 files changed, 55 insertions(+), 17 deletions(-)
>>
>> diff --git a/drivers/net/virtio/virtio_user/vhost.h
>> b/drivers/net/virtio/virtio_user/vhost.h
>> index b296ee215d..956eb58728 100644
>> --- a/drivers/net/virtio/virtio_user/vhost.h
>> +++ b/drivers/net/virtio/virtio_user/vhost.h
>> @@ -113,6 +113,7 @@ struct virtio_user_backend_ops {
>> int (*get_vring_base)(struct virtio_user_dev *dev, struct
>> vhost_vring_state *state);
>> int (*set_vring_call)(struct virtio_user_dev *dev, struct
>> vhost_vring_file *file);
>> int (*set_vring_kick)(struct virtio_user_dev *dev, struct
>> vhost_vring_file *file);
>> + int (*set_vring_addr)(struct virtio_user_dev *dev, struct
>> vhost_vring_addr *addr);
>> int (*send_request)(struct virtio_user_dev *dev,
>> enum vhost_user_request req,
>> void *arg);
>> diff --git a/drivers/net/virtio/virtio_user/vhost_kernel.c
>> b/drivers/net/virtio/virtio_user/vhost_kernel.c
>> index 1805aee7f7..8cd86b72c6 100644
>> --- a/drivers/net/virtio/virtio_user/vhost_kernel.c
>> +++ b/drivers/net/virtio/virtio_user/vhost_kernel.c
>> @@ -294,9 +294,30 @@ vhost_kernel_set_vring_call(struct virtio_user_dev *dev,
>> struct vhost_vring_file
>> return vhost_kernel_set_vring_file(dev, VHOST_SET_VRING_KICK, file);
>> }
>>
>> +static int
>> +vhost_kernel_set_vring_addr(struct virtio_user_dev *dev, struct
>> vhost_vring_addr *addr)
>> +{
>> + int ret, fd;
>> + uint32_t index = addr->index;
>
> Better use 'unsigned int index' here? It can hardly cause problem but I think
> it's better to use the type in struct vhost_vring_addr.
Fixed, thanks.
Maxime
> Thanks,
> Chenbo
>