[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-Id: <20160512.115111.1092968654376249787.davem@davemloft.net>
Date: Thu, 12 May 2016 11:51:11 -0400 (EDT)
From: David Miller <davem@...emloft.net>
To: jiri@...nulli.us
Cc: netdev@...r.kernel.org, nogahf@...lanox.com, idosch@...lanox.com,
eladr@...lanox.com, yotamg@...lanox.com, ogerlitz@...lanox.com,
roopa@...ulusnetworks.com, nikolay@...ulusnetworks.com,
linville@...driver.com, tgraf@...g.ch, gospo@...ulusnetworks.com,
sfeldma@...il.com, sd@...asysnail.net, eranbe@...lanox.com,
ast@...mgrid.com, edumazet@...gle.com, hannes@...essinduktion.org
Subject: Re: [patch net-next 2/4] rtnetlink: add HW/SW stats distinction in
rtnl_fill_stats
From: Jiri Pirko <jiri@...nulli.us>
Date: Thu, 12 May 2016 13:48:48 +0200
> sp = nla_data(attr);
> dev_get_stats(dev, sp);
>
> + err = dev_get_sw_stats(dev, &sw_stats);
> + if (!err) {
> + attr = nla_reserve_64bit(skb, IFLA_SW_STATS64,
> + sizeof(struct rtnl_link_stats64),
> + IFLA_PAD);
> +
> + if (!attr)
> + return -EMSGSIZE;
> +
> + copy_rtnl_link_stats64(nla_data(attr), &sw_stats);
> + }
Jiri, the whole point of the 64-bit padding stuff is so that we don't
need to copy the stats twice, once onto an on-stack copy and then
again to the attribute.
The way this sw stats stuff is designed you can't do it right. It is
absolutely essential that the nla_reserve_64bits() call occur first,
and then you pass nla_data(attr) directly into the sw stats NDO operation.
Please rearrange this whole mechanism so that you can pass the NLA
attribute pointer down into the driver rather than doing all of these
copies.
Thanks.
Powered by blists - more mailing lists