From: Jiri Pirko <jiri@resnulli.us>
To: Daniel Borkmann <daniel@iogearbox.net>
Cc: davem@davemloft.net, netdev@vger.kernel.org,
Alexei Starovoitov <ast@plumgrid.com>,
Jamal Hadi Salim <jhs@mojatatu.com>
Subject: Re: [PATCH net] act_bpf: allow non-default TC_ACT opcodes as BPF exec outcome
Date: Tue, 17 Mar 2015 23:27:53 +0100 [thread overview]
Message-ID: <20150317222753.GA2169@nanopsycho.orion> (raw)
In-Reply-To: <98364de656ad8034f008999121f57940af767b93.1426619298.git.daniel@iogearbox.net>
Tue, Mar 17, 2015 at 08:25:57PM CET, daniel@iogearbox.net wrote:
>Revisiting commit d23b8ad8ab23 ("tc: add BPF based action") with regards
>to eBPF support, I was thinking that it might be better to improve
>return semantics from a BPF program invoked through BPF_PROG_RUN().
>
>Currently, in case filter_res is 0, we overwrite the default action
>opcode with TC_ACT_SHOT. A default action opcode configured through tc's
>m_bpf can be: TC_ACT_RECLASSIFY, TC_ACT_PIPE, TC_ACT_SHOT, TC_ACT_UNSPEC,
>TC_ACT_OK.
>
>In cls_bpf, we have the possibility to overwrite the default class
>associated with the classifier in case filter_res is _not_ 0xffffffff
>(-1).
>
>That allows us to fold multiple [e]BPF programs into a single one, where
>they would otherwise need to be defined as a separate classifier with
>its own classid, needlessly redoing parsing work, etc.
>
>Similarly, we could do better in act_bpf: Since above TC_ACT* opcodes
>are exported to UAPI anyway, we reuse them for return-code-to-tc-opcode
>mapping, where we would allow above possibilities. Thus, like in cls_bpf,
>a filter_res of 0xffffffff (-1) means that the configured _default_ action
>is used. Any unkown return code from the BPF program would fail in
>tcf_bpf() with TC_ACT_UNSPEC.
>
>Should we one day want to make use of TC_ACT_STOLEN or TC_ACT_QUEUED,
>which both have the same semantics, we have the option to either use
>that as a default action (filter_res of 0xffffffff) or non-default BPF
>return code.
>
>All that will allow us to transparently use tcf_bpf() for both BPF
>flavours.
>
>Signed-off-by: Daniel Borkmann <daniel@iogearbox.net>
>Cc: Jiri Pirko <jiri@resnulli.us>
>Cc: Alexei Starovoitov <ast@plumgrid.com>
>Cc: Jamal Hadi Salim <jhs@mojatatu.com>
>---
> Note, act_bpf has not been officially released with 4.0, so we can
> still address it.
Thanks for taking care of this Daniel
Acked-by: Jiri Pirko <jiri@resnulli.us>
next prev parent reply other threads:[~2015-03-17 22:27 UTC|newest]
Thread overview: 5+ messages / expand[flat|nested] mbox.gz Atom feed top
2015-03-17 19:25 [PATCH net] act_bpf: allow non-default TC_ACT opcodes as BPF exec outcome Daniel Borkmann
2015-03-17 21:53 ` Cong Wang
2015-03-17 22:16 ` Alexei Starovoitov
2015-03-17 22:27 ` Jiri Pirko [this message]
2015-03-18 2:15 ` 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=20150317222753.GA2169@nanopsycho.orion \
--to=jiri@resnulli.us \
--cc=ast@plumgrid.com \
--cc=daniel@iogearbox.net \
--cc=davem@davemloft.net \
--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;
as well as URLs for NNTP newsgroup(s).