netdev.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: Jiri Pirko <jiri@resnulli.us>
To: Eric Dumazet <edumazet@google.com>
Cc: "David S . Miller" <davem@davemloft.net>,
	Jakub Kicinski <kuba@kernel.org>, Paolo Abeni <pabeni@redhat.com>,
	netdev@vger.kernel.org, eric.dumazet@gmail.com
Subject: Re: [PATCH net-next 12/13] rtnetlink: make rtnl_fill_link_ifmap() RCU ready
Date: Wed, 21 Feb 2024 19:22:37 +0100	[thread overview]
Message-ID: <ZdY_bci2rMpjKusw@nanopsycho> (raw)
In-Reply-To: <CANn89i+CvOVkaiXuO5vgggHdzVP17Yzw1WaiH93-fjf2cqnN_A@mail.gmail.com>

Wed, Feb 21, 2024 at 06:15:11PM CET, edumazet@google.com wrote:
>On Wed, Feb 21, 2024 at 5:03 PM Jiri Pirko <jiri@resnulli.us> wrote:
>>
>> Wed, Feb 21, 2024 at 11:59:14AM CET, edumazet@google.com wrote:
>> >Use READ_ONCE() to read the following device fields:
>> >
>> >       dev->mem_start
>> >       dev->mem_end
>> >       dev->base_addr
>> >       dev->irq
>> >       dev->dma
>> >       dev->if_port
>> >
>> >Provide IFLA_MAP attribute only if at least one of these fields
>> >is not zero. This saves some space in the output skb for most devices.
>> >
>> >Signed-off-by: Eric Dumazet <edumazet@google.com>
>> >---
>> > net/core/rtnetlink.c | 26 ++++++++++++++------------
>> > 1 file changed, 14 insertions(+), 12 deletions(-)
>> >
>> >diff --git a/net/core/rtnetlink.c b/net/core/rtnetlink.c
>> >index 1b26dfa5668d22fb2e30ceefbf143e98df13ae29..b91ec216c593aaebf97ea69aa0d2d265ab61c098 100644
>> >--- a/net/core/rtnetlink.c
>> >+++ b/net/core/rtnetlink.c
>> >@@ -1455,19 +1455,21 @@ static noinline_for_stack int rtnl_fill_vf(struct sk_buff *skb,
>> >       return 0;
>> > }
>> >
>> >-static int rtnl_fill_link_ifmap(struct sk_buff *skb, struct net_device *dev)
>> >+static int rtnl_fill_link_ifmap(struct sk_buff *skb,
>> >+                              const struct net_device *dev)
>> > {
>> >       struct rtnl_link_ifmap map;
>> >
>> >       memset(&map, 0, sizeof(map));
>> >-      map.mem_start   = dev->mem_start;
>> >-      map.mem_end     = dev->mem_end;
>> >-      map.base_addr   = dev->base_addr;
>> >-      map.irq         = dev->irq;
>> >-      map.dma         = dev->dma;
>> >-      map.port        = dev->if_port;
>> >-
>> >-      if (nla_put_64bit(skb, IFLA_MAP, sizeof(map), &map, IFLA_PAD))
>> >+      map.mem_start = READ_ONCE(dev->mem_start);
>> >+      map.mem_end   = READ_ONCE(dev->mem_end);
>> >+      map.base_addr = READ_ONCE(dev->base_addr);
>> >+      map.irq       = READ_ONCE(dev->irq);
>> >+      map.dma       = READ_ONCE(dev->dma);
>> >+      map.port      = READ_ONCE(dev->if_port);
>> >+      /* Only report non zero information. */
>> >+      if (memchr_inv(&map, 0, sizeof(map)) &&
>>
>> This check(optimization) is unrelated to the rest of the patch, correct?
>> If yes, could it be a separate patch?
>
>Sure thing. BTW, do you know which tool is using this ?
>
>I could not find IFLA_MAP being used in iproute2 or ethtool.

No clue. Never spotted it.

  reply	other threads:[~2024-02-21 18:22 UTC|newest]

Thread overview: 20+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2024-02-21 10:59 [PATCH net-next 00/13] rtnetlink: reduce RTNL pressure for dumps Eric Dumazet
2024-02-21 10:59 ` [PATCH net-next 01/13] rtnetlink: prepare nla_put_iflink() to run under RCU Eric Dumazet
2024-02-21 10:59 ` [PATCH net-next 02/13] ipv6: prepare inet6_fill_ifla6_attrs() for RCU Eric Dumazet
2024-02-21 10:59 ` [PATCH net-next 03/13] ipv6: prepare inet6_fill_ifinfo() for RCU protection Eric Dumazet
2024-02-21 10:59 ` [PATCH net-next 04/13] ipv6: use xarray iterator to implement inet6_dump_ifinfo() Eric Dumazet
2024-02-21 18:39   ` Ido Schimmel
2024-02-21 18:57     ` Eric Dumazet
2024-02-21 10:59 ` [PATCH net-next 05/13] netlink: fix netlink_diag_dump() return value Eric Dumazet
2024-02-21 10:59 ` [PATCH net-next 06/13] netlink: hold nlk->cb_mutex longer in __netlink_dump_start() Eric Dumazet
2024-02-21 10:59 ` [PATCH net-next 07/13] rtnetlink: change nlk->cb_mutex role Eric Dumazet
2024-02-21 10:59 ` [PATCH net-next 08/13] rtnetlink: add RTNL_FLAG_DUMP_UNLOCKED flag Eric Dumazet
2024-02-21 10:59 ` [PATCH net-next 09/13] ipv6: switch inet6_dump_ifinfo() to RCU protection Eric Dumazet
2024-02-21 10:59 ` [PATCH net-next 10/13] inet: allow ip_valid_fib_dump_req() to be called with RTNL or RCU Eric Dumazet
2024-02-21 10:59 ` [PATCH net-next 11/13] inet: switch inet_dump_fib() to RCU protection Eric Dumazet
2024-02-21 10:59 ` [PATCH net-next 12/13] rtnetlink: make rtnl_fill_link_ifmap() RCU ready Eric Dumazet
2024-02-21 16:02   ` Jiri Pirko
2024-02-21 17:15     ` Eric Dumazet
2024-02-21 18:22       ` Jiri Pirko [this message]
2024-02-21 18:56       ` Jakub Kicinski
2024-02-21 10:59 ` [PATCH net-next 13/13] rtnetlink: provide RCU protection to rtnl_fill_prop_list() Eric Dumazet

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=ZdY_bci2rMpjKusw@nanopsycho \
    --to=jiri@resnulli.us \
    --cc=davem@davemloft.net \
    --cc=edumazet@google.com \
    --cc=eric.dumazet@gmail.com \
    --cc=kuba@kernel.org \
    --cc=netdev@vger.kernel.org \
    --cc=pabeni@redhat.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).