[dpdk-dev] [PATCH v1 2/8] net/mlx5: add mlx5 Linux specific file with getter functions

Ferruh Yigit ferruh.yigit at intel.com
Mon Jun 8 13:20:06 CEST 2020


On 6/3/2020 4:05 PM, Ophir Munk wrote:
> 'ctx' type (field in 'struct mlx5_ctx_shared') is changed from 'struct
> ibv_context *' to 'void *'.  'ctx' members which are verbs dependent
> (e.g. device_name) will be accessed through getter functions which are
> added to a new file under Linux directory: linux/mlx5_os.c.
> 
> Signed-off-by: Ophir Munk <ophirmu at mellanox.com>
> Acked-by: Matan Azrad <matan at mellanox.com>

<...>

> @@ -0,0 +1,87 @@
> +/* SPDX-License-Identifier: BSD-3-Clause
> + * Copyright 2015 6WIND S.A.
> + * Copyright 2020 Mellanox Technologies, Ltd
> + */

Just to double check if '6WIND' is copy/paste error in this new file?

<...>

> @@ -677,13 +677,14 @@ mlx5_dev_shared_handler_install(struct mlx5_dev_ctx_shared *sh)
>  	int flags;
>  
>  	sh->intr_handle.fd = -1;
> -	flags = fcntl(sh->ctx->async_fd, F_GETFL);
> -	ret = fcntl(sh->ctx->async_fd, F_SETFL, flags | O_NONBLOCK);
> +	flags = fcntl(((struct ibv_context *)sh->ctx)->async_fd, F_GETFL);
> +	ret = fcntl(((struct ibv_context *)sh->ctx)->async_fd,
> +		    F_SETFL, flags | O_NONBLOCK);

As far as I understand you are trying to remove to the dependency to ibverbs, at
least in root level, linux/x.c will have that dependency. (I assume this is for
Windows support)
The 'mlx5_os_get_ctx_device_path()' wrapper seems can work for it but what is
the point of above usage, that you explicitly cast "void *" to "(struct
ibv_context *)", so you still keep the ibv dependency?


More information about the dev mailing list