[dpdk-dev] [PATCH 1/4] vhost: handle VHOST_USER_SET_LOG_BASE request
Xie, Huawei
huawei.xie at intel.com
Tue Dec 8 06:57:54 CET 2015
On 12/2/2015 11:40 AM, Yuanhan Liu wrote:
[...]
> +
> + addr = mmap(0, size, PROT_READ | PROT_WRITE, MAP_SHARED, fd, off);
> + if (addr == MAP_FAILED) {
> + RTE_LOG(ERR, VHOST_CONFIG, "mmap log base failed!\n");
> + return -1;
> + }
Yuanhan:
mmap could fail with non-zero offset for huge page based mapping. Check
our workaround in user_set_mem_table.
I think you have done the validation, but i guess off is zero here.
> +
> + /* TODO: unmap on stop */
> + dev->log_base = addr;
> + dev->log_size = size;
> +
> + return 0;
> +}
> diff --git a/lib/librte_vhost/vhost_user/virtio-net-user.h b/lib/librte_vhost/vhost_user/virtio-net-user.h
> index b82108d..013cf38 100644
> --- a/lib/librte_vhost/vhost_user/virtio-net-user.h
> +++ b/lib/librte_vhost/vhost_user/virtio-net-user.h
> @@ -49,6 +49,7 @@ void user_set_vring_kick(struct vhost_device_ctx, struct VhostUserMsg *);
>
> void user_set_protocol_features(struct vhost_device_ctx ctx,
> uint64_t protocol_features);
> +int user_set_log_base(struct vhost_device_ctx ctx, struct VhostUserMsg *);
>
> int user_get_vring_base(struct vhost_device_ctx, struct vhost_vring_state *);
>
More information about the dev
mailing list