netdev.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: Jiri Pirko <jiri@resnulli.us>
To: Jamal Hadi Salim <jhs@mojatatu.com>
Cc: davem@davemloft.net, netdev@vger.kernel.org,
	xiyou.wangcong@gmail.com, dsahern@gmail.com,
	eric.dumazet@gmail.com, mrv@mojatatu.com,
	simon.horman@netronome.com, alex.aring@gmail.com
Subject: Re: [PATCH net-next v11 3/4] net sched actions: dump more than TCA_ACT_MAX_PRIO actions per batch
Date: Tue, 25 Jul 2017 13:33:52 +0200	[thread overview]
Message-ID: <20170725113352.GA3186@nanopsycho> (raw)
In-Reply-To: <7057a692-7233-4632-4f66-2f57c98322ea@mojatatu.com>

Tue, Jul 25, 2017 at 01:22:44PM CEST, jhs@mojatatu.com wrote:
>On 17-07-24 07:27 AM, Jiri Pirko wrote:
>> Mon, Jul 24, 2017 at 03:35:45AM CEST, jhs@mojatatu.com wrote:
>> > From: Jamal Hadi Salim <jhs@mojatatu.com>
>[..]
>> 
>> This helper should be part of the previous patch.
>> 
>
>Will do next update.
>> 
>
>>> @@ -1157,8 +1164,18 @@ static int tc_dump_action(struct sk_buff *skb,
>struct netlink_callback *cb)
>>> 	struct tc_action_ops *a_o;
>>> 	int ret = 0;
>>> 	struct tcamsg *t = (struct tcamsg *) nlmsg_data(cb->nlh);
>>> -	struct nlattr *kind = find_dump_kind(cb->nlh);
>>> +	struct nla_bitfield_32 fb;
>>> +	struct nlattr *count_attr = NULL;
>>> +	struct nlattr *tb[TCA_ROOT_MAX + 1];
>>> +	struct nlattr *kind = NULL;
>>
>> Reverse christmas tree :D
>>
>
>There were already 2 christmas trees in place;->
>I will re-arrange this.
>
>> > 
>> > +	if (tb[TCA_ROOT_FLAGS])
>> > +		fb = nla_get_bitfield_32(tb[TCA_ROOT_FLAGS]);
>> 
>> fb? bf? nbf? Please make this synced within the patchset.
>> 
>> 
>
>Ok, what do you like best? ;->

"bf"


>
>> Don't you need to mask value with selector? In fact, I think that
>> nla_get_bitfield_32 could just return u32 which would be (value&selector).
>> The validation takes care of unsupported bits.
>
>For my use case I dont need any of the above since I dont need to
>unset things. In other use cases you will need both selector and
>value in case someone wants a bit to be set to 0.
>Infact I think i will rename that helper to "nla_get_bitvalue_32"
>to be more precise.

The getter should contain name of the type, so "nla_get_bitfield32_val"
is much better.

What if I pass val 0x1 and selector 0x0 from userspace. I don't have the
bit selected, so you should not process it in kernel, no?


>
>cheers,
>jamal

  reply	other threads:[~2017-07-25 11:33 UTC|newest]

Thread overview: 34+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2017-07-24  1:35 [PATCH net-next v11 0/4] net sched actions: improve dump performance Jamal Hadi Salim
2017-07-24  1:35 ` [PATCH net-next v11 1/4] net netlink: Add new type NLA_BITFIELD_32 Jamal Hadi Salim
2017-07-24 11:14   ` Jiri Pirko
2017-07-25 11:14     ` Jamal Hadi Salim
2017-07-24 11:18   ` Jiri Pirko
2017-07-25 11:15     ` Jamal Hadi Salim
2017-07-25 14:41   ` David Ahern
2017-07-28 13:51     ` Jamal Hadi Salim
2017-07-28 14:08       ` Jiri Pirko
2017-07-28 14:19       ` David Ahern
2017-07-28 14:55         ` Jiri Pirko
2017-07-28 15:04         ` Jamal Hadi Salim
2017-07-28 15:13           ` David Ahern
2017-07-28 21:55             ` Jamal Hadi Salim
2017-07-24  1:35 ` [PATCH net-next v11 2/4] net sched actions: Use proper root attribute table for actions Jamal Hadi Salim
2017-07-24  1:35 ` [PATCH net-next v11 3/4] net sched actions: dump more than TCA_ACT_MAX_PRIO actions per batch Jamal Hadi Salim
2017-07-24 11:27   ` Jiri Pirko
2017-07-25 11:22     ` Jamal Hadi Salim
2017-07-25 11:33       ` Jiri Pirko [this message]
2017-07-25 12:34         ` Jamal Hadi Salim
2017-07-25 12:37           ` Jiri Pirko
2017-07-28 13:41             ` Jamal Hadi Salim
2017-07-28 14:12               ` Jiri Pirko
2017-07-28 14:52                 ` Jamal Hadi Salim
2017-07-28 14:57                   ` Jiri Pirko
2017-07-28 15:08                   ` Jamal Hadi Salim
2017-07-28 15:45                     ` Jiri Pirko
2017-07-28 22:10                       ` Jamal Hadi Salim
2017-07-29  7:19                         ` Jiri Pirko
2017-07-29 11:21                           ` Jamal Hadi Salim
2017-07-24  1:35 ` [PATCH net-next v11 4/4] net sched actions: add time filter for action dumping Jamal Hadi Salim
2017-07-24 11:34   ` Jiri Pirko
2017-07-25 11:27     ` Jamal Hadi Salim
2017-07-25 11:34       ` Jiri Pirko

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=20170725113352.GA3186@nanopsycho \
    --to=jiri@resnulli.us \
    --cc=alex.aring@gmail.com \
    --cc=davem@davemloft.net \
    --cc=dsahern@gmail.com \
    --cc=eric.dumazet@gmail.com \
    --cc=jhs@mojatatu.com \
    --cc=mrv@mojatatu.com \
    --cc=netdev@vger.kernel.org \
    --cc=simon.horman@netronome.com \
    --cc=xiyou.wangcong@gmail.com \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
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;
as well as URLs for NNTP newsgroup(s).