All of lore.kernel.org
 help / color / mirror / Atom feed
From: Alexei Starovoitov <ast@plumgrid.com>
To: Daniel Borkmann <daniel@iogearbox.net>, davem@davemloft.net
Cc: jiri@resnulli.us, jhs@mojatatu.com, netdev@vger.kernel.org
Subject: Re: [PATCH net-next] act_bpf: properly support late binding of bpf action to a classifier
Date: Mon, 3 Aug 2015 09:36:04 -0700	[thread overview]
Message-ID: <55BF9874.4040504@plumgrid.com> (raw)
In-Reply-To: <8e2446e087041587d665a8ca2d105f164a8e0794.1438610179.git.daniel@iogearbox.net>

On 8/3/15 7:21 AM, Daniel Borkmann wrote:
> Since the introduction of the BPF action in d23b8ad8ab23 ("tc: add BPF
> based action"), late binding was not working as expected. I.e. setting
> the action part for a classifier only via 'bpf index <num>', where <num>
> is the index of an existing action, is being rejected by the kernel due
> to other missing parameters.
>
> It doesn't make sense to require these parameters such as BPF opcodes
> etc, as they are not going to be used anyway: in this case, they're just
> allocated/parsed and then freed again w/o doing anything meaningful.
>
> Instead, parse and verify the remaining parameters*after*  the test on
> tcf_hash_check(), when we really know that we're dealing with creation
> of a new action or replacement of an existing one and where late binding
> is thus irrelevant.
>
> After patch, test case is now working:
>
>    FOO="1,6 0 0 4294967295,"
>    tc actions add action bpf bytecode "$FOO"
>    tc filter add dev foo parent 1: bpf bytecode "$FOO" flowid 1:1 action bpf index 1
>    tc actions show action bpf
>      action order 0: bpf bytecode '1,6 0 0 4294967295' default-action pipe
>      index 1 ref 2 bind 1
>    tc filter show dev foo
>      filter protocol all pref 49152 bpf
>      filter protocol all pref 49152 bpf handle 0x1 flowid 1:1 bytecode '1,6 0 0 4294967295'
>      action order 1: bpf bytecode '1,6 0 0 4294967295' default-action pipe
>      index 1 ref 2 bind 1
>
> Late binding of a BPF action can be useful for preloading maps (e.g. before
> they hit traffic) in case of eBPF programs, or to share a single eBPF action
> with multiple classifiers.
>
> Signed-off-by: Daniel Borkmann<daniel@iogearbox.net>
> ---
>   This one was still in my queue of fixes, net-next is totally fine here.
>   Will push out minor iproute2 change afterwards.

All makes sense.
Acked-by: Alexei Starovoitov <ast@plumgrid.com>

  reply	other threads:[~2015-08-03 16:36 UTC|newest]

Thread overview: 3+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2015-08-03 14:21 [PATCH net-next] act_bpf: properly support late binding of bpf action to a classifier Daniel Borkmann
2015-08-03 16:36 ` Alexei Starovoitov [this message]
2015-08-03 23:06 ` David Miller

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=55BF9874.4040504@plumgrid.com \
    --to=ast@plumgrid.com \
    --cc=daniel@iogearbox.net \
    --cc=davem@davemloft.net \
    --cc=jhs@mojatatu.com \
    --cc=jiri@resnulli.us \
    --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 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.