[dpdk-dev] [PATCH 2/9] vfio_user: implement lifecycle related APIs

Xing, Beilei beilei.xing at intel.com
Tue Jan 5 09:34:34 CET 2021



> -----Original Message-----
> From: dev <dev-bounces at dpdk.org> On Behalf Of Chenbo Xia
> Sent: Friday, December 18, 2020 3:39 PM
> To: dev at dpdk.org; thomas at monjalon.net; david.marchand at redhat.com
> Cc: stephen at networkplumber.org; Liang, Cunming
> <cunming.liang at intel.com>; Lu, Xiuchun <xiuchun.lu at intel.com>; Li, Miao
> <miao.li at intel.com>; Wu, Jingjing <jingjing.wu at intel.com>
> Subject: [dpdk-dev] [PATCH 2/9] vfio_user: implement lifecycle related APIs
> 
> This patch implements three lifecycle related APIs for vfio-user server, which
> are rte_vfio_user_register(), rte_vfio_user_unregister() and
> rte_vfio_user_start(). Socket an device management is implemented along
> with the API introduction.
> 
> Signed-off-by: Chenbo Xia <chenbo.xia at intel.com>
> Signed-off-by: Xiuchun Lu <xiuchun.lu at intel.com>
> ---
>  lib/librte_vfio_user/meson.build        |   3 +-
>  lib/librte_vfio_user/rte_vfio_user.h    |  51 ++
>  lib/librte_vfio_user/version.map        |   6 +
>  lib/librte_vfio_user/vfio_user_base.h   |   4 +
>  lib/librte_vfio_user/vfio_user_server.c | 690 ++++++++++++++++++++++++
> lib/librte_vfio_user/vfio_user_server.h |  55 ++
>  6 files changed, 808 insertions(+), 1 deletion(-)  create mode 100644
> lib/librte_vfio_user/rte_vfio_user.h
>  create mode 100644 lib/librte_vfio_user/vfio_user_server.c
>  create mode 100644 lib/librte_vfio_user/vfio_user_server.h
> 

<...>

> +static struct vfio_user_server_socket * find_vfio_user_socket(const

1. How about vfio_user_find_socket which is consistent with other function name?
2. According to the coding style, I think it's better to use such format:
static struct vfio_user_server_socket *
vfio_user_find_socket() {
}
And please also check all other functions. 


> +char *sock_addr) {
> +	uint32_t i;
> +
> +	if (sock_addr == NULL)
> +		return NULL;
> +
> +	for (i = 0; i < vfio_ep_sock.sock_num; i++) {
> +		struct vfio_user_server_socket *s = vfio_ep_sock.sock[i];
> +
> +		if (!strcmp(s->sock.sock_addr, sock_addr))
> +			return s;
> +	}
> +
> +	return NULL;
> +}
> +

<...>


> --
> 2.17.1



More information about the dev mailing list