[PATCH v2 3/4] net/mlx5: remove weak stub functions

Dmitry Kozlyuk dmitry.kozliuk at gmail.com
Mon Jan 23 20:42:12 CET 2023


2023-01-12 21:37 (UTC+0100), Thomas Monjalon:
> The vector Rx functions are conditionally compiled.
> Some stub functions were also always compiled with weak attribute.
> If there is no vector support, the weak functions were linked.
> 
> These weak functions are moved in a specific file
> which is compiled only if there is no vector support.
> This way it is simpler to understand,
> and the weak attributes can be removed.
> 
> This change helps to compile with MinGW GCC
> which has no support for weak functions.
> 
> Signed-off-by: Thomas Monjalon <thomas at monjalon.net>
> ---
>  drivers/net/mlx5/meson.build          | 13 +++++----
>  drivers/net/mlx5/mlx5_rx.c            | 35 ------------------------
>  drivers/net/mlx5/mlx5_rxtx_vec_null.c | 38 +++++++++++++++++++++++++++
>  3 files changed, 46 insertions(+), 40 deletions(-)
>  create mode 100644 drivers/net/mlx5/mlx5_rxtx_vec_null.c
> 
> diff --git a/drivers/net/mlx5/meson.build b/drivers/net/mlx5/meson.build
> index abd507bd88..dba911693e 100644
> --- a/drivers/net/mlx5/meson.build
> +++ b/drivers/net/mlx5/meson.build
> @@ -49,11 +49,14 @@ if is_linux
>              'mlx5_hws_cnt.c',
>              'mlx5_flow_verbs.c',
>      )
> -    if (dpdk_conf.has('RTE_ARCH_X86_64')
> -        or dpdk_conf.has('RTE_ARCH_ARM64')
> -        or dpdk_conf.has('RTE_ARCH_PPC_64'))
> -        sources += files('mlx5_rxtx_vec.c')
> -    endif
> +endif
> +
> +if is_linux and (dpdk_conf.has('RTE_ARCH_X86_64')
> +              or dpdk_conf.has('RTE_ARCH_ARM64')
> +              or dpdk_conf.has('RTE_ARCH_PPC_64'))
> +    sources += files('mlx5_rxtx_vec.c')
> +else
> +    sources += files('mlx5_rxtx_vec_null.c')
>  endif

Can "is_linux" be dropped now?
I suspect that vector routines were compiled only for Linux
to prevent linker errors from both weak and non-weak symbols present,
not because vector code is somehow Linux-specific.


More information about the dev mailing list