From: David Ahern <dsahern@kernel.org>
To: Ido Schimmel <idosch@nvidia.com>, netdev@vger.kernel.org
Cc: davem@davemloft.net, kuba@kernel.org, pabeni@redhat.com,
edumazet@google.com, petrm@nvidia.com
Subject: Re: [PATCH net 2/3] nexthop: Make nexthop bucket dump more efficient
Date: Tue, 8 Aug 2023 08:53:48 -0600 [thread overview]
Message-ID: <81cc614c-901e-ff0b-6185-6fa898ddf39a@kernel.org> (raw)
In-Reply-To: <20230808075233.3337922-3-idosch@nvidia.com>
On 8/8/23 1:52 AM, Ido Schimmel wrote:
> rtm_dump_nexthop_bucket_nh() is used to dump nexthop buckets belonging
> to a specific resilient nexthop group. The function returns a positive
> return code (the skb length) upon both success and failure.
>
> The above behavior is problematic. When a complete nexthop bucket dump
> is requested, the function that walks the different nexthops treats the
> non-zero return code as an error. This causes buckets belonging to
> different resilient nexthop groups to be dumped using different buffers
> even if they can all fit in the same buffer:
>
> # ip link add name dummy1 up type dummy
> # ip nexthop add id 1 dev dummy1
> # ip nexthop add id 10 group 1 type resilient buckets 1
> # ip nexthop add id 20 group 1 type resilient buckets 1
> # strace -e recvmsg -s 0 ip nexthop bucket
> [...]
> recvmsg(3, {msg_name={sa_family=AF_NETLINK, nl_pid=0, nl_groups=00000000}, msg_namelen=12, msg_iov=[...], msg_iovlen=1, msg_controllen=0, msg_flags=0}, 0) = 64
> id 10 index 0 idle_time 10.27 nhid 1
> [...]
> recvmsg(3, {msg_name={sa_family=AF_NETLINK, nl_pid=0, nl_groups=00000000}, msg_namelen=12, msg_iov=[...], msg_iovlen=1, msg_controllen=0, msg_flags=0}, 0) = 64
> id 20 index 0 idle_time 6.44 nhid 1
> [...]
>
> Fix by only returning a non-zero return code when an error occurred and
> restarting the dump from the bucket index we failed to fill in. This
> allows buckets belonging to different resilient nexthop groups to be
> dumped using the same buffer:
>
> # ip link add name dummy1 up type dummy
> # ip nexthop add id 1 dev dummy1
> # ip nexthop add id 10 group 1 type resilient buckets 1
> # ip nexthop add id 20 group 1 type resilient buckets 1
> # strace -e recvmsg -s 0 ip nexthop bucket
> [...]
> recvmsg(3, {msg_name={sa_family=AF_NETLINK, nl_pid=0, nl_groups=00000000}, msg_namelen=12, msg_iov=[...], msg_iovlen=1, msg_controllen=0, msg_flags=0}, 0) = 128
> id 10 index 0 idle_time 30.21 nhid 1
> id 20 index 0 idle_time 26.7 nhid 1
> [...]
>
> While this change is more of a performance improvement change than an
> actual bug fix, it is a prerequisite for a subsequent patch that does
> fix a bug.
>
> Fixes: 8a1bbabb034d ("nexthop: Add netlink handlers for bucket dump")
> Signed-off-by: Ido Schimmel <idosch@nvidia.com>
> Reviewed-by: Petr Machata <petrm@nvidia.com>
> ---
> net/ipv4/nexthop.c | 16 +++++-----------
> 1 file changed, 5 insertions(+), 11 deletions(-)
>
Reviewed-by: David Ahern <dsahern@kernel.org>
next prev parent reply other threads:[~2023-08-08 14:53 UTC|newest]
Thread overview: 8+ messages / expand[flat|nested] mbox.gz Atom feed top
2023-08-08 7:52 [PATCH net 0/3] nexthop: Nexthop dump fixes Ido Schimmel
2023-08-08 7:52 ` [PATCH net 1/3] nexthop: Fix infinite nexthop dump when using maximum nexthop ID Ido Schimmel
2023-08-08 14:53 ` David Ahern
2023-08-08 7:52 ` [PATCH net 2/3] nexthop: Make nexthop bucket dump more efficient Ido Schimmel
2023-08-08 14:53 ` David Ahern [this message]
2023-08-08 7:52 ` [PATCH net 3/3] nexthop: Fix infinite nexthop bucket dump when using maximum nexthop ID Ido Schimmel
2023-08-08 14:54 ` David Ahern
2023-08-09 21:00 ` [PATCH net 0/3] nexthop: Nexthop dump fixes patchwork-bot+netdevbpf
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=81cc614c-901e-ff0b-6185-6fa898ddf39a@kernel.org \
--to=dsahern@kernel.org \
--cc=davem@davemloft.net \
--cc=edumazet@google.com \
--cc=idosch@nvidia.com \
--cc=kuba@kernel.org \
--cc=netdev@vger.kernel.org \
--cc=pabeni@redhat.com \
--cc=petrm@nvidia.com \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).