From: Sergei Shtylyov <sergei.shtylyov@cogentembedded.com>
To: Daniel Borkmann <daniel@iogearbox.net>, stephen@networkplumber.org
Cc: ast@kernel.org, netdev@vger.kernel.org
Subject: Re: [PATCH iproute2 -next 1/5] {f,m}_bpf: make tail calls working
Date: Thu, 26 Nov 2015 16:10:44 +0300 [thread overview]
Message-ID: <565704D4.8070201@cogentembedded.com> (raw)
In-Reply-To: <88d074dcdf1469ea381e1d732852cc87fb1aba2c.1448541097.git.daniel@iogearbox.net>
Hello.
On 11/26/2015 3:58 PM, Daniel Borkmann wrote:
> Now that we have the possibility of sharing maps, it's time we get the
> ELF loader fully working with regards to tail calls. Since program array
> maps are pinned, we can keep them finally alive. I've noticed two bugs
> that are being fixed in bpf_fill_prog_arrays() with this patch. Example
> code comes as follow-up.
>
> Signed-off-by: Daniel Borkmann <daniel@iogearbox.net>
> Acked-by: Alexei Starovoitov <ast@kernel.org>
> ---
> tc/tc_bpf.c | 31 +++++++++++++++++++++++--------
> 1 file changed, 23 insertions(+), 8 deletions(-)
>
> diff --git a/tc/tc_bpf.c b/tc/tc_bpf.c
> index bc7bc9f..73a0f41 100644
> --- a/tc/tc_bpf.c
> +++ b/tc/tc_bpf.c
> @@ -1139,11 +1139,26 @@ static int bpf_fetch_prog_sec(struct bpf_elf_ctx *ctx, const char *section)
> return ret;
> }
>
> +static int bpf_find_map_by_id(struct bpf_elf_ctx *ctx, uint32_t id)
> +{
> + int i, ret = -1;
> +
> + for (i = 0; i < ARRAY_SIZE(ctx->map_fds); i++) {
> + if (ctx->map_fds[i] && ctx->maps[i].id == id &&
> + ctx->maps[i].type == BPF_MAP_TYPE_PROG_ARRAY) {
> + ret = i;
> + break;
Isn't just *return* i; simpler? That way, you don't need 'ret' at all.
> + }
> + }
> +
> + return ret;
> +}
> +
[...]
MBR, Sergei
next prev parent reply other threads:[~2015-11-26 13:10 UTC|newest]
Thread overview: 11+ messages / expand[flat|nested] mbox.gz Atom feed top
2015-11-26 12:58 [PATCH iproute2 -next 0/5] BPF updates Daniel Borkmann
2015-11-26 12:58 ` [PATCH iproute2 -next 1/5] {f,m}_bpf: make tail calls working Daniel Borkmann
2015-11-26 13:10 ` Sergei Shtylyov [this message]
2015-11-26 14:40 ` Daniel Borkmann
2015-11-26 12:58 ` [PATCH iproute2 -next 2/5] {f,m}_bpf: check map attributes when fetching as pinned Daniel Borkmann
2015-11-26 12:58 ` [PATCH iproute2 -next 3/5] {f,m}_bpf: allow for user-defined object pinnings Daniel Borkmann
2015-11-28 0:26 ` David Ahern
2015-11-28 1:41 ` Daniel Borkmann
2015-11-28 6:03 ` David Ahern
2015-11-26 12:58 ` [PATCH iproute2 -next 4/5] {f,m}_bpf: allow updates on program arrays Daniel Borkmann
2015-11-26 12:58 ` [PATCH iproute2 -next 5/5] {f,m}_bpf: add more example code Daniel Borkmann
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=565704D4.8070201@cogentembedded.com \
--to=sergei.shtylyov@cogentembedded.com \
--cc=ast@kernel.org \
--cc=daniel@iogearbox.net \
--cc=netdev@vger.kernel.org \
--cc=stephen@networkplumber.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 an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.