[dpdk-dev] [PATCH] common/mlx5: reduce size of netlink buffer

Slava Ovsiienko viacheslavo at mellanox.com
Tue Apr 28 11:34:06 CEST 2020


> -----Original Message-----
> From: dev <dev-bounces at dpdk.org> On Behalf Of Stephen Hemminger
> Sent: Thursday, April 23, 2020 1:30
> To: dev at dpdk.org
> Cc: Stephen Hemminger <stephen at networkplumber.org>; Nélio Laranjeiro
> <nelio.laranjeiro at 6wind.com>
> Subject: [dpdk-dev] [PATCH] common/mlx5: reduce size of netlink buffer
> 
> Since the driver is just using netlink to receive acknowledgements for
> command requests, having a large (32K) buffer is unnecessary.

Not for acknowledgements only, it is also used to get the dumps for the MAC
addresses and Infiniband device ports, as we know dump operations might
merge replies into one large message, smaller buffer might prevent the
dump receiving. What do you think about the buffer allocation  on the device
initialization and storing that somewhere in the device structure?

With best regards,
Slava

> Allocating large buffers on stack will break in application is using smaller per-
> thread stacks.
> 
> It looks like original code intended to use a smaller buffer for the read than
> the socket, so keep that set of defines.
> 
> Fixes: ccdcba53a3f4 ("net/mlx5: use Netlink to add/remove MAC addresses")
> Cc: nelio.laranjeiro at 6wind.com
> Signed-off-by: Stephen Hemminger <stephen at networkplumber.org>
> ---
>  drivers/common/mlx5/mlx5_nl.c | 4 ++--
>  1 file changed, 2 insertions(+), 2 deletions(-)
> 
> diff --git a/drivers/common/mlx5/mlx5_nl.c
> b/drivers/common/mlx5/mlx5_nl.c index d9f0d4129e35..847e78dbcea6
> 100644
> --- a/drivers/common/mlx5/mlx5_nl.c
> +++ b/drivers/common/mlx5/mlx5_nl.c
> @@ -28,7 +28,7 @@
> 
> 
>  /* Size of the buffer to receive kernel messages */ -#define
> MLX5_NL_BUF_SIZE (32 * 1024)
> +#define MLX5_NL_BUF_SIZE 4096
>  /* Send buffer size for the Netlink socket */  #define MLX5_SEND_BUF_SIZE
> 32768
>  /* Receive buffer size for the Netlink socket */ @@ -330,7 +330,7 @@
> mlx5_nl_recv(int nlsk_fd, uint32_t sn, int (*cb)(struct nlmsghdr *, void *arg),
>  	     void *arg)
>  {
>  	struct sockaddr_nl sa;
> -	char buf[MLX5_RECV_BUF_SIZE];
> +	char buf[MLX5_NL_BUF_SIZE];
>  	struct iovec iov = {
>  		.iov_base = buf,
>  		.iov_len = sizeof(buf),
> --
> 2.20.1



More information about the dev mailing list