[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <20190719205914.3fc786f6@cakuba>
Date: Fri, 19 Jul 2019 20:59:14 -0700
From: Jakub Kicinski <jakub.kicinski@...ronome.com>
To: Jiri Pirko <jiri@...nulli.us>
Cc: netdev@...r.kernel.org, davem@...emloft.net,
sthemmin@...rosoft.com, dsahern@...il.com, dcbw@...hat.com,
mkubecek@...e.cz, andrew@...n.ch, parav@...lanox.com,
saeedm@...lanox.com, mlxsw@...lanox.com
Subject: Re: [patch net-next rfc 4/7] net: rtnetlink: put alternative names
to getlink message
On Fri, 19 Jul 2019 13:00:26 +0200, Jiri Pirko wrote:
> diff --git a/net/core/rtnetlink.c b/net/core/rtnetlink.c
> index 7a2010b16e10..f11a2367037d 100644
> --- a/net/core/rtnetlink.c
> +++ b/net/core/rtnetlink.c
> @@ -980,6 +980,18 @@ static size_t rtnl_xdp_size(void)
> return xdp_size;
> }
>
> +static size_t rtnl_alt_ifname_list_size(const struct net_device *dev)
> +{
> + struct netdev_name_node *name_node;
> + size_t size = nla_total_size(0);
> +
> + if (list_empty(&dev->name_node->list))
> + return 0;
Nit: it would make the intent a tiny bit clearer if
size = nla_total_size(0);
was after this early return.
> + list_for_each_entry(name_node, &dev->name_node->list, list)
> + size += nla_total_size(ALTIFNAMSIZ);
Since we have the structure I wonder if it would be worthwhile to store
the exact size in it?
> + return size;
> +}
> +
Powered by blists - more mailing lists