From: Huawei Xie Date: Wed, 8 Oct 2014 18:54:48 +0000 (+0800) Subject: vhost: get internal ops when registering X-Git-Tag: spdx-start~10293 X-Git-Url: http://git.droids-corp.org/?a=commitdiff_plain;h=f7825769590b6688e33cc59798e39ec10f88879e;p=dpdk.git vhost: get internal ops when registering vhost_net_device_ops is internal implementation in vhost lib. register_cuse_device will be vhost driver register API. There is no need for it to know the internal vhost ops. Instead, that ops is retrieved in register_cuse_device through get_virtio_net_callbacks. Signed-off-by: Huawei Xie Acked-by: Changchun Ouyang --- diff --git a/lib/librte_vhost/rte_virtio_net.h b/lib/librte_vhost/rte_virtio_net.h index 0c9c716b62..0a38e4df69 100644 --- a/lib/librte_vhost/rte_virtio_net.h +++ b/lib/librte_vhost/rte_virtio_net.h @@ -122,8 +122,6 @@ struct virtio_net_device_ops { int init_virtio_net(struct virtio_net_device_ops const * const); int deinit_virtio_net(void); -struct vhost_net_device_ops const * get_virtio_net_callbacks(void); - /** * Function to convert guest physical addresses to vhost virtual addresses. * This is used to convert guest virtio buffer addresses. diff --git a/lib/librte_vhost/vhost-net-cdev.c b/lib/librte_vhost/vhost-net-cdev.c index 957f0c80b3..4eeb676f70 100644 --- a/lib/librte_vhost/vhost-net-cdev.c +++ b/lib/librte_vhost/vhost-net-cdev.c @@ -302,7 +302,7 @@ static const struct cuse_lowlevel_ops vhost_net_ops = { * also passed when the device is registered in main.c. */ int -register_cuse_device(const char *base_name, struct vhost_net_device_ops const * const pops) +register_cuse_device(const char *base_name) { struct cuse_info cuse_info; char device_name[PATH_MAX] = ""; @@ -339,7 +339,7 @@ register_cuse_device(const char *base_name, struct vhost_net_device_ops const * cuse_info.dev_info_argv = device_argv; cuse_info.flags = CUSE_UNRESTRICTED_IOCTL; - ops = pops; + ops = get_virtio_net_callbacks(); session = cuse_lowlevel_setup(3, fuse_argv, &cuse_info, &vhost_net_ops, 0, NULL); diff --git a/lib/librte_vhost/vhost-net-cdev.h b/lib/librte_vhost/vhost-net-cdev.h index 575daa9939..0db8f0a9af 100644 --- a/lib/librte_vhost/vhost-net-cdev.h +++ b/lib/librte_vhost/vhost-net-cdev.h @@ -80,4 +80,5 @@ struct vhost_net_device_ops { int register_cuse_device(const char *base_name, int index, struct vhost_net_device_ops const * const); int start_cuse_session_loop(void); +struct vhost_net_device_ops const *get_virtio_net_callbacks(void); #endif /* _VHOST_NET_CDEV_H_ */