public inbox for netdev@vger.kernel.org 
 help / color / mirror / Atom feed
From: roopa <roopa@cumulusnetworks•com>
To: Thomas Graf <tgraf@suug•ch>
Cc: netdev@vger•kernel.org, jhs@mojatatu•com, davem@davemloft•net
Subject: Re: [PATCH net-next v3 1/2] rtnetlink: add new RTM_GETSTATS message to query stats
Date: Sat, 16 Apr 2016 18:50:16 -0700	[thread overview]
Message-ID: <5712EBD8.2060100@cumulusnetworks.com> (raw)
In-Reply-To: <20160416074910.GA2486@pox.localdomain>

On 4/16/16, 12:49 AM, Thomas Graf wrote:
> On 04/15/16 at 08:28pm, Roopa Prabhu wrote:
>> +static u16 rtnl_stats_calcit(struct sk_buff *skb, struct nlmsghdr *nlh)
>> +{
>> +	struct net *net = sock_net(skb->sk);
>> +	struct net_device *dev;
>> +	u16 min_ifinfo_dump_size = 0;
>> +	struct if_stats_msg *ifsm;
>> +	u32 filter_mask;
>> +
>> +	ifsm = nlmsg_data(nlh);
>> +	filter_mask = ifsm->filter_mask;
>> +
>> +	/* traverse the list of net devices and compute the minimum
>> +	 * buffer size based upon the filter mask.
>> +	 */
>> +	list_for_each_entry(dev, &net->dev_base_head, dev_list) {
>> +		min_ifinfo_dump_size = max_t(u16, min_ifinfo_dump_size,
>> +					     if_nlmsg_stats_size(dev,
>> +								 filter_mask));
>> +	}
> Iterating over all net_devices in the namespace is quite an expensive
> operation and it would now be done twice.
>
> I understand that this code is taken over from rtnl_calcit() but there
> the cost is at least only paid if ext_filter_mask is actually set and
> the user opts into additional statistics.
>
> I wonder if we can reduce the cost for the stats interface as its
> purpose is to be minimal cost. I suggest we only add the loop once we
> have an extension which actually depends on it. We can then try and
> figure out to not require it.
ok, ack. Its not absolutely necessary right now with the one link filter stats
I am adding support for. We can bring it back later when we see a first instance
 which makes it necessary.

In which case, I am going to trim down the series to absolute minimal.
just rtnl link stats64. I want to drop the ipv6 patch anyways.
With it I will also drop the general af stats handling. Will get it back when we get to the first
proper af stats implementation (hopefully mpls).

With this, the calcit for RTM_GETSTATS will be NULL, until we add the implementation for the other
stats attributes.

      reply	other threads:[~2016-04-17  1:50 UTC|newest]

Thread overview: 3+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2016-04-16  3:28 [PATCH net-next v3 1/2] rtnetlink: add new RTM_GETSTATS message to query stats Roopa Prabhu
2016-04-16  7:49 ` Thomas Graf
2016-04-17  1:50   ` roopa [this message]

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=5712EBD8.2060100@cumulusnetworks.com \
    --to=roopa@cumulusnetworks$(echo .)com \
    --cc=davem@davemloft$(echo .)net \
    --cc=jhs@mojatatu$(echo .)com \
    --cc=netdev@vger$(echo .)kernel.org \
    --cc=tgraf@suug$(echo .)ch \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html
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