public inbox for netdev@vger.kernel.org 
 help / color / mirror / Atom feed
From: Nikolay Aleksandrov <nikolay@cumulusnetworks•com>
To: Roopa Prabhu <roopa@cumulusnetworks•com>
Cc: netdev@vger•kernel.org, davem@davemloft•net,
	stephen@networkplumber•org, jhs@mojatatu•com
Subject: Re: [PATCH net-next 2/7] net: rtnetlink: allow only one idx saving stats attribute
Date: Thu, 28 Apr 2016 10:40:40 +0200	[thread overview]
Message-ID: <5721CC88.9000708@cumulusnetworks.com> (raw)
In-Reply-To: <57219D29.2080307@cumulusnetworks.com>

On 04/28/2016 07:18 AM, Roopa Prabhu wrote:
> On 4/27/16, 9:18 AM, Nikolay Aleksandrov wrote:
>> We can't allow more than one stats attribute which uses the local idx
>> since the result will be a mess. This is a simple check to make sure
>> only one is being used at a time. Later when the filter_mask's 32 bits
>> are over we can switch to a bitmap.
>>
>> Signed-off-by: Nikolay Aleksandrov <nikolay@cumulusnetworks•com>
>> ---
>>  include/net/rtnetlink.h |  6 ++++++
>>  net/core/rtnetlink.c    | 17 +++++++++++++++--
>>  2 files changed, 21 insertions(+), 2 deletions(-)
>>
[snip]
>> @@ -3570,6 +3578,11 @@ static int rtnl_stats_dump(struct sk_buff *skb, struct netlink_callback *cb)
>>  	if (!filter_mask)
>>  		return -EINVAL;
>>  
>> +	/* only one attribute which can save a local idx is allowed at a time */
>> +	lidx_filter = filter_mask & IFLA_STATS_IDX_ATTR_MASK;
>> +	if (lidx_filter && !is_power_of_2(lidx_filter))
>> +		return -EINVAL;
>> +
>>  	
> instead of introducing the restriction at this level, is it possible to use two args for this
> like below and avoid the restriction ?
> cb->args[2] = current filter being processed
> cb->args[3] = private filter idx (your lidx)
> 

So to allow having any number of idx saving callbacks ? I think this will introduce more complexity
as we'll have to differentiate between 3 types of filters now - non-idx saving, idx saving but passed
and current idx saving attribute. We will dump the non-idx saving on each call, but then skip some
and continue dumping..
I'll give it a try to see how it looks. :-)

Thanks,
 Nik

  reply	other threads:[~2016-04-28  8:40 UTC|newest]

Thread overview: 13+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2016-04-27 16:18 [PATCH net-next 0/7] bridge: per-vlan stats Nikolay Aleksandrov
2016-04-27 16:18 ` [PATCH net-next 1/7] net: rtnetlink: allow rtnl_fill_statsinfo to save private state counter Nikolay Aleksandrov
2016-04-27 16:18 ` [PATCH net-next 2/7] net: rtnetlink: allow only one idx saving stats attribute Nikolay Aleksandrov
2016-04-28  5:18   ` Roopa Prabhu
2016-04-28  8:40     ` Nikolay Aleksandrov [this message]
2016-04-27 16:18 ` [PATCH net-next 3/7] net: rtnetlink: add linkxstats callbacks and attribute Nikolay Aleksandrov
2016-04-27 16:18 ` [PATCH net-next 4/7] net: constify is_skb_forwardable's arguments Nikolay Aleksandrov
2016-04-27 16:18 ` [PATCH net-next 5/7] bridge: vlan: RCUify pvid Nikolay Aleksandrov
2016-04-27 16:18 ` [PATCH net-next 6/7] bridge: vlan: learn to count Nikolay Aleksandrov
2016-04-27 16:18 ` [PATCH net-next 7/7] bridge: netlink: export per-vlan stats Nikolay Aleksandrov
2016-04-27 17:06 ` [PATCH net-next 0/7] bridge: " Stephen Hemminger
2016-04-27 17:13   ` Nikolay Aleksandrov
2016-04-28  8:43 ` Nikolay Aleksandrov

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=5721CC88.9000708@cumulusnetworks.com \
    --to=nikolay@cumulusnetworks$(echo .)com \
    --cc=davem@davemloft$(echo .)net \
    --cc=jhs@mojatatu$(echo .)com \
    --cc=netdev@vger$(echo .)kernel.org \
    --cc=roopa@cumulusnetworks$(echo .)com \
    --cc=stephen@networkplumber$(echo .)org \
    /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