lists.openwall.net   lists  /  announce  owl-users  owl-dev  john-users  john-dev  passwdqc-users  yescrypt  popa3d-users  /  oss-security  kernel-hardening  musl  sabotage  tlsify  passwords  /  crypt-dev  xvendor  /  Bugtraq  Full-Disclosure  linux-kernel  linux-netdev  linux-ext4  linux-hardening  linux-cve-announce  PHC 
Open Source and information security mailing list archives
 
Hash Suite: Windows password security audit tool. GUI, reports in PDF.
[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <248c85579656054de478ea29154aa40c7542009e.camel@mellanox.com>
Date:   Fri, 7 Jun 2019 18:09:06 +0000
From:   Saeed Mahameed <saeedm@...lanox.com>
To:     "netdev@...r.kernel.org" <netdev@...r.kernel.org>,
        "pabeni@...hat.com" <pabeni@...hat.com>
CC:     "davem@...emloft.net" <davem@...emloft.net>,
        "leon@...nel.org" <leon@...nel.org>
Subject: Re: [PATCH net-next v2 3/3] net/mlx5e: use indirect calls wrapper for
 the rx packet handler

On Thu, 2019-06-06 at 23:56 +0200, Paolo Abeni wrote:
> We can avoid another indirect call per packet wrapping the rx
> handler call with the proper helper.
> 
> To ensure that even the last listed direct call experience
> measurable gain, despite the additional conditionals we must
> traverse before reaching it, I tested reversing the order of the
> listed options, with performance differences below noise level.
> 
> Together with the previous indirect call patch, this gives
> ~6% performance improvement in raw UDP tput.
> 
> v1 -> v2:
>  - update the direct call list and use a macro to define it,
>    as per Saeed suggestion. An intermediated additional
>    macro is needed to allow arg list expansion
> 
> Signed-off-by: Paolo Abeni <pabeni@...hat.com>
> ---
>  drivers/net/ethernet/mellanox/mlx5/core/en.h    | 4 ++++
>  drivers/net/ethernet/mellanox/mlx5/core/en_rx.c | 5 ++++-
>  2 files changed, 8 insertions(+), 1 deletion(-)
> 
> diff --git a/drivers/net/ethernet/mellanox/mlx5/core/en.h
> b/drivers/net/ethernet/mellanox/mlx5/core/en.h
> index 3a183d690e23..52bcdc87cbe2 100644
> --- a/drivers/net/ethernet/mellanox/mlx5/core/en.h
> +++ b/drivers/net/ethernet/mellanox/mlx5/core/en.h
> @@ -148,6 +148,10 @@ struct page_pool;
>  
>  #define MLX5E_MSG_LEVEL			NETIF_MSG_LINK
>  
> +#define MLX5_RX_INDIRECT_CALL_LIST \
> +	mlx5e_handle_rx_cqe_mpwrq, mlx5e_handle_rx_cqe,
> mlx5i_handle_rx_cqe, \
> +	mlx5e_ipsec_handle_rx_cqe
> +
>  #define mlx5e_dbg(mlevel, priv, format, ...)                    \
>  do {                                                            \
>  	if (NETIF_MSG_##mlevel & (priv)->msglevel)              \
> diff --git a/drivers/net/ethernet/mellanox/mlx5/core/en_rx.c
> b/drivers/net/ethernet/mellanox/mlx5/core/en_rx.c
> index 0fe5f13d07cc..7faf643eb1b9 100644
> --- a/drivers/net/ethernet/mellanox/mlx5/core/en_rx.c
> +++ b/drivers/net/ethernet/mellanox/mlx5/core/en_rx.c
> @@ -1303,6 +1303,8 @@ void mlx5e_handle_rx_cqe_mpwrq(struct mlx5e_rq
> *rq, struct mlx5_cqe64 *cqe)
>  	mlx5_wq_ll_pop(wq, cqe->wqe_id, &wqe->next.next_wqe_index);
>  }
>  
> +#define INDIRECT_CALL_LIST(f, list, ...) INDIRECT_CALL_4(f, list,
> __VA_ARGS__)
> +

Hi Paolo, 

This patch produces some compiler errors:

Please note that mlx5e_ipsec_handle_rx_cqe is only defined when
CONFIG_MLX5_EN_IPSEC is enabled.

02:26:53 drivers/net/ethernet/mellanox/mlx5/core/en_rx.c: In function
'mlx5e_poll_rx_cq':
02:26:53 drivers/net/ethernet/mellanox/mlx5/core/en_rx.c:1300:42:
error: implicit declaration of function 'INDIRECT_CALL_4'; did you mean
'INDIRECT_CALL_LIST'? [-Werror=implicit-function-declaration]
02:26:53  #define INDIRECT_CALL_LIST(f, list, ...) INDIRECT_CALL_4(f,
list, __VA_ARGS__)
02:26:53                                           ^
02:26:53 drivers/net/ethernet/mellanox/mlx5/core/en_rx.c:1332:3: note:
in expansion of macro 'INDIRECT_CALL_LIST'
02:26:53    INDIRECT_CALL_LIST(rq->handle_rx_cqe,
02:26:53    ^~~~~~~~~~~~~~~~~~
02:26:53 drivers/net/ethernet/mellanox/mlx5/core/en.h:153:2: error:
'mlx5e_ipsec_handle_rx_cqe' undeclared (first use in this function);
did you mean 'mlx5e_fp_handle_rx_cqe'?
02:26:53   mlx5e_ipsec_handle_rx_cqe
02:26:53   ^
02:26:53 drivers/net/ethernet/mellanox/mlx5/core/en_rx.c:1300:61: note:
in definition of macro 'INDIRECT_CALL_LIST'
02:26:53  #define INDIRECT_CALL_LIST(f, list, ...) INDIRECT_CALL_4(f,
list, __VA_ARGS__)
02:26:53                                                              ^
~~~
02:26:53 drivers/net/ethernet/mellanox/mlx5/core/en_rx.c:1333:8: note:
in expansion of macro 'MLX5_RX_INDIRECT_CALL_LIST'
02:26:53         MLX5_RX_INDIRECT_CALL_LIST, rq, cqe);
02:26:53         ^~~~~~~~~~~~~~~~~~~~~~~~~~
02:26:53 drivers/net/ethernet/mellanox/mlx5/core/en.h:153:2: note: each
undeclared identifier is reported only once for each function it
appears in
02:26:53   mlx5e_ipsec_handle_rx_cqe
02:26:53   ^
02:26:53 drivers/net/ethernet/mellanox/mlx5/core/en_rx.c:1300:61: note:
in definition of macro 'INDIRECT_CALL_LIST'
02:26:53  #define INDIRECT_CALL_LIST(f, list, ...) INDIRECT_CALL_4(f,
list, __VA_ARGS__)
02:26:53                                                              ^
~~~
02:26:53 drivers/net/ethernet/mellanox/mlx5/core/en_rx.c:1333:8: note:
in expansion of macro 'MLX5_RX_INDIRECT_CALL_LIST'
02:26:53         MLX5_RX_INDIRECT_CALL_LIST, rq, cqe);
02:26:53         ^~~~~~~~~~~~~~~~~~~~~~~~~~


>  int mlx5e_poll_rx_cq(struct mlx5e_cq *cq, int budget)
>  {
>  	struct mlx5e_rq *rq = container_of(cq, struct mlx5e_rq, cq);
> @@ -1333,7 +1335,8 @@ int mlx5e_poll_rx_cq(struct mlx5e_cq *cq, int
> budget)
>  
>  		mlx5_cqwq_pop(cqwq);
>  
> -		rq->handle_rx_cqe(rq, cqe);
> +		INDIRECT_CALL_LIST(rq->handle_rx_cqe,
> +				   MLX5_RX_INDIRECT_CALL_LIST, rq,
> cqe);
>  	} while ((++work_done < budget) && (cqe =
> mlx5_cqwq_get_cqe(cqwq)));
>  
>  out:

Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ