From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from mails.dpdk.org (mails.dpdk.org [217.70.189.124]) by inbox.dpdk.org (Postfix) with ESMTP id D2E8CA034F for ; Wed, 11 Aug 2021 11:27:10 +0200 (CEST) Received: from [217.70.189.124] (localhost [127.0.0.1]) by mails.dpdk.org (Postfix) with ESMTP id A0EE040040; Wed, 11 Aug 2021 11:27:10 +0200 (CEST) Received: from smtp-relay-canonical-0.canonical.com (smtp-relay-canonical-0.canonical.com [185.125.188.120]) by mails.dpdk.org (Postfix) with ESMTP id 9B0AA40040 for ; Wed, 11 Aug 2021 11:27:09 +0200 (CEST) Received: from mail-qt1-f200.google.com (mail-qt1-f200.google.com [209.85.160.200]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (2048 bits) server-digest SHA256) (No client certificate requested) by smtp-relay-canonical-0.canonical.com (Postfix) with ESMTPS id 033BF3F04A for ; Wed, 11 Aug 2021 09:27:07 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=canonical.com; s=20210705; t=1628674027; bh=ZT7vpUjRtSzRQweCwB+mqDobt3HVUxBmHrEsQoWpaOI=; h=MIME-Version:References:In-Reply-To:From:Date:Message-ID:Subject: To:Cc:Content-Type; b=Wo++Ysey0ZetD4tutCEQd7zRZhYJLV0M322DlXYVLeYknL4GuB30Jhjkfte5/0PjY y8UJ2yC4Pu8rb8j8Ragopa06xKZoGcnEk3VphGI92mmsWzTGR4mtnLBbliYHBEc1o9 dTEaWAqm+4sudU0USBj7MqE4QBTuiuWoVFc8rpG+52j1KShOgfM8ZcxNPqzoqJQ0gp 3a4zF0Fdra7XOvZjiNzDdqeAcKHiVKK4Ed2yIVeKVdYFfbw/TcvWrU4X6FgV1TE8qC fkXsjdx+bnFRmAZPu8a0k/vHVAWIjhU8lag+4GspOr1kjE0Q0/2gi+C17UT+OebUFB dq6TmMMeBjpdQ== Received: by mail-qt1-f200.google.com with SMTP id j1-20020ac866410000b029028bef7ed9e1so990112qtp.11 for ; Wed, 11 Aug 2021 02:27:06 -0700 (PDT) X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:mime-version:references:in-reply-to:from:date :message-id:subject:to:cc; bh=ZT7vpUjRtSzRQweCwB+mqDobt3HVUxBmHrEsQoWpaOI=; b=onWC3+o8fRt4Nbd863kxG+RtPm6QYwhlsmRSQGgN0QGo3EPLbD/8UAKrsYs5RUK7FE p71wTe8xTcoEJeWUMylzx+/TDVg5LEcIN3CnVgRnp3DJZiIKrcnlegXj5+d2E6TfHTlO HvlAZwXshauv0sjyncfYOaIGE/0/st0QxjhVhNJvB6P5VoS3Ov12Wzjk7b4SWRJatFLQ xI7GGILrIVie88ag7+zXD0WdD7PH63/YQI8QoWxvJWp1cNdeYKT2mnsI++8ZL5LdkAZq b+i/Cu2rPQk2Bx+4QC8KIZqc5RzVe2HAlRT4obSnIbbrzG3+JMpoIuWlB9/WOOxx+C/6 Lirg== X-Gm-Message-State: AOAM533gR7RQIThWm8FqslGyowQ5KVGiT2jpWVr8ZNtlMBQG6zs4nQhB frYtHdO/o0NEJnQunG5+VUPk8HUTRgyrGBa0y1WolFKDe1hsCaPuQJ/n8kreIePbj5JmxLfWGQ0 SwBVuMMYUU+WwVsrTi8MR1ezUbIk1YFp5dKFa9l69 X-Received: by 2002:a05:622a:652:: with SMTP id a18mr10700612qtb.112.1628674026022; Wed, 11 Aug 2021 02:27:06 -0700 (PDT) X-Google-Smtp-Source: ABdhPJzvwGcXiUTkYkH30bFRlC0El/SbRfImTBrv2Exvw45H8OEQXKxyfbgLfTa+KYu7YDVISgmj3Jaz6ApbiBFSUr8= X-Received: by 2002:a05:622a:652:: with SMTP id a18mr10700599qtb.112.1628674025790; Wed, 11 Aug 2021 02:27:05 -0700 (PDT) MIME-Version: 1.0 References: <20210810154022.749358-1-christian.ehrhardt@canonical.com> <20210810154022.749358-54-christian.ehrhardt@canonical.com> In-Reply-To: <20210810154022.749358-54-christian.ehrhardt@canonical.com> From: Christian Ehrhardt Date: Wed, 11 Aug 2021 11:26:39 +0200 Message-ID: To: Viacheslav Ovsiienko Cc: dpdk stable Content-Type: text/plain; charset="UTF-8" Subject: Re: [dpdk-stable] patch 'common/mlx5: fix Netlink receive message buffer size' has been queued to stable release 19.11.10 X-BeenThere: stable@dpdk.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: patches for DPDK stable branches List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: stable-bounces@dpdk.org Sender: "stable" On Tue, Aug 10, 2021 at 5:43 PM wrote: > > Hi, > > FYI, your patch has been queued to stable release 19.11.10 Hi, while applying cleanly your patch caused build time failures like: /usr/bin/ld: drivers/libtmp_rte_pmd_mlx5.a.p/net_mlx5_mlx5_nl.c.o: in function `mlx5_nl_recv.constprop.0': mlx5_nl.c:(.text+0x504): undefined reference to `mlx5_free' /usr/bin/ld: mlx5_nl.c:(.text+0x517): undefined reference to `mlx5_malloc' /usr/bin/ld: drivers/libtmp_rte_pmd_mlx5.a.p/net_mlx5_mlx5_nl.c.o: in function `mlx5_nl_mac_addr_sync': mlx5_nl.c:(.text+0xfbb): undefined reference to `mlx5_free' /usr/bin/ld: mlx5_nl.c:(.text+0xfcd): undefined reference to `mlx5_malloc' /usr/bin/ld: drivers/libtmp_rte_pmd_mlx5.a.p/net_mlx5_mlx5_nl.c.o: in function `mlx5_nl_ifindex': mlx5_nl.c:(.text+0x1872): undefined reference to `mlx5_free' /usr/bin/ld: mlx5_nl.c:(.text+0x1884): undefined reference to `mlx5_malloc' /usr/bin/ld: mlx5_nl.c:(.text+0x1bd2): undefined reference to `mlx5_free' /usr/bin/ld: mlx5_nl.c:(.text+0x1be4): undefined reference to `mlx5_malloc' /usr/bin/ld: drivers/libtmp_rte_pmd_mlx5.a.p/net_mlx5_mlx5_nl.c.o: in function `mlx5_nl_portnum': mlx5_nl.c:(.text+0x1f6a): undefined reference to `mlx5_free' /usr/bin/ld: mlx5_nl.c:(.text+0x1f7c): undefined reference to `mlx5_malloc' /usr/bin/ld: drivers/libtmp_rte_pmd_mlx5.a.p/net_mlx5_mlx5_nl.c.o: in function `mlx5_nl_switch_info': mlx5_nl.c:(.text+0x2364): undefined reference to `mlx5_free' /usr/bin/ld: mlx5_nl.c:(.text+0x2377): undefined reference to `mlx5_malloc' collect2: error: ld returned 1 exit status Therefore the patch will be de-qeueud from the stable branch that shall become 19.11.10. Please consider having a look and providing a backport. A backport should contain a reference to the DPDK main branch commit in it's commit message in the following fashion: [ upstream commit ] For example: https://git.dpdk.org/dpdk-stable/commit/?h=18.11&id=d90e6ae6f936ecdc2fd3811ff9f26aec7f3c06eb When sending the backported patch, please indicate the target branch in the subject line, as we have multiple branches, for example: [PATCH 19.11] foo/bar: fix baz With git format-patch, this can be achieved by appending the parameter: --subject-prefix='PATCH 19.11' Send the backported patch to "stable@dpdk.org" but not "dev@dpdk.org". FYI, branch 19.11 is located at tree: https://git.dpdk.org/dpdk-stable Thanks in advance, Chrtistian > Note it hasn't been pushed to http://dpdk.org/browse/dpdk-stable yet. > It will be pushed if I get no objections before 08/12/21. So please > shout if anyone has objections. > > Also note that after the patch there's a diff of the upstream commit vs the > patch applied to the branch. This will indicate if there was any rebasing > needed to apply to the stable branch. If there were code changes for rebasing > (ie: not only metadata diffs), please double check that the rebase was > correctly done. > > Queued patches are on a temporary branch at: > https://github.com/cpaelzer/dpdk-stable-queue > > This queued commit can be viewed at: > https://github.com/cpaelzer/dpdk-stable-queue/commit/6af6af1640a7cd555e22dea6f12f497b82bb0761 > > Thanks. > > Christian Ehrhardt > > --- > From 6af6af1640a7cd555e22dea6f12f497b82bb0761 Mon Sep 17 00:00:00 2001 > From: Viacheslav Ovsiienko > Date: Thu, 1 Jul 2021 10:31:33 +0300 > Subject: [PATCH] common/mlx5: fix Netlink receive message buffer size > > [ upstream commit 32d1e4dbadba4bc3523d8b354458a4b979e5c2e6 ] > > If there are many VFs the Netlink message length sent by kernel > in reply to RTM_GETLINK request can be large. We should query > the size of message being received in advance and allocate > the large enough buffer to handle these large messages. > > Fixes: ccdcba53a3f4 ("net/mlx5: use Netlink to add/remove MAC addresses") > > Signed-off-by: Viacheslav Ovsiienko > --- > drivers/net/mlx5/mlx5_nl.c | 69 ++++++++++++++++++++++++++++++-------- > 1 file changed, 55 insertions(+), 14 deletions(-) > > diff --git a/drivers/net/mlx5/mlx5_nl.c b/drivers/net/mlx5/mlx5_nl.c > index 668affb0b1..8d5478d9f5 100644 > --- a/drivers/net/mlx5/mlx5_nl.c > +++ b/drivers/net/mlx5/mlx5_nl.c > @@ -128,8 +128,8 @@ int > mlx5_nl_init(int protocol) > { > int fd; > - int sndbuf_size = MLX5_SEND_BUF_SIZE; > - int rcvbuf_size = MLX5_RECV_BUF_SIZE; > + int buf_size; > + socklen_t opt_size; > struct sockaddr_nl local = { > .nl_family = AF_NETLINK, > }; > @@ -140,16 +140,36 @@ mlx5_nl_init(int protocol) > rte_errno = errno; > return -rte_errno; > } > - ret = setsockopt(fd, SOL_SOCKET, SO_SNDBUF, &sndbuf_size, sizeof(int)); > + opt_size = sizeof(buf_size); > + ret = getsockopt(fd, SOL_SOCKET, SO_SNDBUF, &buf_size, &opt_size); > if (ret == -1) { > rte_errno = errno; > goto error; > } > - ret = setsockopt(fd, SOL_SOCKET, SO_RCVBUF, &rcvbuf_size, sizeof(int)); > + DRV_LOG(DEBUG, "Netlink socket send buffer: %d", buf_size); > + if (buf_size < MLX5_SEND_BUF_SIZE) { > + ret = setsockopt(fd, SOL_SOCKET, SO_SNDBUF, > + &buf_size, sizeof(buf_size)); > + if (ret == -1) { > + rte_errno = errno; > + goto error; > + } > + } > + opt_size = sizeof(buf_size); > + ret = getsockopt(fd, SOL_SOCKET, SO_RCVBUF, &buf_size, &opt_size); > if (ret == -1) { > rte_errno = errno; > goto error; > } > + DRV_LOG(DEBUG, "Netlink socket recv buffer: %d", buf_size); > + if (buf_size < MLX5_RECV_BUF_SIZE) { > + ret = setsockopt(fd, SOL_SOCKET, SO_RCVBUF, > + &buf_size, sizeof(buf_size)); > + if (ret == -1) { > + rte_errno = errno; > + goto error; > + } > + } > ret = bind(fd, (struct sockaddr *)&local, sizeof(local)); > if (ret == -1) { > rte_errno = errno; > @@ -271,11 +291,7 @@ mlx5_nl_recv(int nlsk_fd, uint32_t sn, int (*cb)(struct nlmsghdr *, void *arg), > void *arg) > { > struct sockaddr_nl sa; > - void *buf = malloc(MLX5_RECV_BUF_SIZE); > - struct iovec iov = { > - .iov_base = buf, > - .iov_len = MLX5_RECV_BUF_SIZE, > - }; > + struct iovec iov; > struct msghdr msg = { > .msg_name = &sa, > .msg_namelen = sizeof(sa), > @@ -283,18 +299,43 @@ mlx5_nl_recv(int nlsk_fd, uint32_t sn, int (*cb)(struct nlmsghdr *, void *arg), > /* One message at a time */ > .msg_iovlen = 1, > }; > + void *buf = NULL; > int multipart = 0; > int ret = 0; > > - if (!buf) { > - rte_errno = ENOMEM; > - return -rte_errno; > - } > do { > struct nlmsghdr *nh; > - int recv_bytes = 0; > + int recv_bytes; > > do { > + /* Query length of incoming message. */ > + iov.iov_base = NULL; > + iov.iov_len = 0; > + recv_bytes = recvmsg(nlsk_fd, &msg, > + MSG_PEEK | MSG_TRUNC); > + if (recv_bytes < 0) { > + rte_errno = errno; > + ret = -rte_errno; > + goto exit; > + } > + if (recv_bytes == 0) { > + rte_errno = ENODATA; > + ret = -rte_errno; > + goto exit; > + } > + /* Allocate buffer to fetch the message. */ > + if (recv_bytes < MLX5_RECV_BUF_SIZE) > + recv_bytes = MLX5_RECV_BUF_SIZE; > + mlx5_free(buf); > + buf = mlx5_malloc(0, recv_bytes, 0, SOCKET_ID_ANY); > + if (!buf) { > + rte_errno = ENOMEM; > + ret = -rte_errno; > + goto exit; > + } > + /* Fetch the message. */ > + iov.iov_base = buf; > + iov.iov_len = recv_bytes; > recv_bytes = recvmsg(nlsk_fd, &msg, 0); > if (recv_bytes == -1) { > rte_errno = errno; > -- > 2.32.0 > > --- > Diff of the applied patch vs upstream commit (please double-check if non-empty: > --- > --- - 2021-08-10 15:11:15.121954386 +0200 > +++ 0054-common-mlx5-fix-Netlink-receive-message-buffer-size.patch 2021-08-10 15:11:13.038638243 +0200 > @@ -1 +1 @@ > -From 32d1e4dbadba4bc3523d8b354458a4b979e5c2e6 Mon Sep 17 00:00:00 2001 > +From 6af6af1640a7cd555e22dea6f12f497b82bb0761 Mon Sep 17 00:00:00 2001 > @@ -5,0 +6,2 @@ > +[ upstream commit 32d1e4dbadba4bc3523d8b354458a4b979e5c2e6 ] > + > @@ -12 +13,0 @@ > -Cc: stable@dpdk.org > @@ -16 +17 @@ > - drivers/common/mlx5/linux/mlx5_nl.c | 69 +++++++++++++++++++++++------ > + drivers/net/mlx5/mlx5_nl.c | 69 ++++++++++++++++++++++++++++++-------- > @@ -19,5 +20,5 @@ > -diff --git a/drivers/common/mlx5/linux/mlx5_nl.c b/drivers/common/mlx5/linux/mlx5_nl.c > -index 3f1912d078..dc8dafd0a8 100644 > ---- a/drivers/common/mlx5/linux/mlx5_nl.c > -+++ b/drivers/common/mlx5/linux/mlx5_nl.c > -@@ -189,8 +189,8 @@ int > +diff --git a/drivers/net/mlx5/mlx5_nl.c b/drivers/net/mlx5/mlx5_nl.c > +index 668affb0b1..8d5478d9f5 100644 > +--- a/drivers/net/mlx5/mlx5_nl.c > ++++ b/drivers/net/mlx5/mlx5_nl.c > +@@ -128,8 +128,8 @@ int > @@ -34 +35 @@ > -@@ -201,16 +201,36 @@ mlx5_nl_init(int protocol) > +@@ -140,16 +140,36 @@ mlx5_nl_init(int protocol) > @@ -73 +74 @@ > -@@ -332,11 +352,7 @@ mlx5_nl_recv(int nlsk_fd, uint32_t sn, int (*cb)(struct nlmsghdr *, void *arg), > +@@ -271,11 +291,7 @@ mlx5_nl_recv(int nlsk_fd, uint32_t sn, int (*cb)(struct nlmsghdr *, void *arg), > @@ -77 +78 @@ > -- void *buf = mlx5_malloc(0, MLX5_RECV_BUF_SIZE, 0, SOCKET_ID_ANY); > +- void *buf = malloc(MLX5_RECV_BUF_SIZE); > @@ -86 +87 @@ > -@@ -344,18 +360,43 @@ mlx5_nl_recv(int nlsk_fd, uint32_t sn, int (*cb)(struct nlmsghdr *, void *arg), > +@@ -283,18 +299,43 @@ mlx5_nl_recv(int nlsk_fd, uint32_t sn, int (*cb)(struct nlmsghdr *, void *arg), -- Christian Ehrhardt Staff Engineer, Ubuntu Server Canonical Ltd