[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <20190720071705.GH2230@nanopsycho>
Date: Sat, 20 Jul 2019 09:17:05 +0200
From: Jiri Pirko <jiri@...nulli.us>
To: Jakub Kicinski <jakub.kicinski@...ronome.com>
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
Sat, Jul 20, 2019 at 05:59:14AM CEST, jakub.kicinski@...ronome.com wrote:
>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.
Sure.
>
>> + 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
Which structure?
>the exact size in it?
>
>> + return size;
>> +}
>> +
Powered by blists - more mailing lists