From: Jiri Pirko <jiri@resnulli.us>
To: David Miller <davem@davemloft.net>
Cc: netdev@vger.kernel.org, jhs@mojatatu.com, dborkman@redhat.com,
ast@plumgrid.com, hannes@redhat.com
Subject: Re: [patch net-next v2] tc: add BPF based action
Date: Wed, 14 Jan 2015 10:09:10 +0100 [thread overview]
Message-ID: <20150114090910.GA1869@nanopsycho.orion> (raw)
In-Reply-To: <20150113.143633.1852338751965729543.davem@davemloft.net>
Tue, Jan 13, 2015 at 08:36:33PM CET, davem@davemloft.net wrote:
>From: Jiri Pirko <jiri@resnulli.us>
>Date: Mon, 12 Jan 2015 17:09:38 +0100
>
>> + bpf_len = nla_get_u16(tb[TCA_ACT_BPF_OPS_LEN]);
>> + if (bpf_len > BPF_MAXINSNS || bpf_len == 0)
>> + return -EINVAL;
>> +
>> + bpf_size = bpf_len * sizeof(*bpf_ops);
>
>When I see variables named 'len' and 'size', I expect them to be
>in unit bytes.
Size is bytes, len is number of instructions. This is the same as in
net/sched/cls_bpf.c line 182. I follow the same naming for consistency
>
>I think it's clearer to call bpf_len something like "bpf_num_insns",
>or "bpf_num_ops", or something like that.
I understand. I will change it in net/sched/cls_bpf.c as well.
>
>Also, is the OPS_LEN attribute really necessary? Can't you just
>figure this out using nla_len() on the OPS attribute? Or is that not
>always accurate due to alignment?
I guess that you could just use nla_len. Again, I followed cls_bpf for
consistency purposes. It has TCA_BPF_OPS_LEN as well.
Thanks for review!
Jiri
prev parent reply other threads:[~2015-01-14 9:09 UTC|newest]
Thread overview: 3+ messages / expand[flat|nested] mbox.gz Atom feed top
2015-01-12 16:09 [patch net-next v2] tc: add BPF based action Jiri Pirko
2015-01-13 19:36 ` David Miller
2015-01-14 9:09 ` Jiri Pirko [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=20150114090910.GA1869@nanopsycho.orion \
--to=jiri@resnulli.us \
--cc=ast@plumgrid.com \
--cc=davem@davemloft.net \
--cc=dborkman@redhat.com \
--cc=hannes@redhat.com \
--cc=jhs@mojatatu.com \
--cc=netdev@vger.kernel.org \
/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