Netdev List
 help / color / mirror / Atom feed
* [RFC: add openvswitch actions using BPF 0/2]
@ 2015-02-04 22:48 Andy Zhou
       [not found] ` <1423090122-19807-1-git-send-email-azhou-l0M0P4e3n4LQT0dZR+AlfA@public.gmane.org>
  0 siblings, 1 reply; 8+ messages in thread
From: Andy Zhou @ 2015-02-04 22:48 UTC (permalink / raw)
  To: dev-yBygre7rU0SM8Zsap4Y0gw; +Cc: netdev-u79uwXL29TY76Z2rM5mHXA

Joe and I have been experimenting with BPF and its application for OVS.
This patch shows our attempt to implement ovs actions using eBPF.

The kernel changes are against the 'net-next'. The corresponding
user space changes will be post next.

This patch set implements an BPF action, that has the same interface
as current OVS output action. Instead of sending out a packet, it
only generates a kernel message.

This feature is neither complete nor useful as is.  We are mostly
interested in comments on: The infrastructure changes to support
and running BPF functions, and suggestions on extensions beyond
those patches.

Andy Zhou (2):
  BPF: add a new BPF program type BPF_PROG_TYPE_OPENVSWITCH
  openvswitch: implements the BPF_PROG action in datapath

 include/linux/bpf.h              |  2 +-
 include/uapi/linux/bpf.h         |  1 +
 include/uapi/linux/openvswitch.h | 29 ++++++++++++-
 net/Makefile                     |  4 +-
 net/openvswitch/Makefile         |  2 +
 net/openvswitch/actions.c        | 30 +++++++++++++
 net/openvswitch/bpf.c            | 87 +++++++++++++++++++++++++++++++++++++
 net/openvswitch/datapath.c       |  6 ++-
 net/openvswitch/flow_netlink.c   | 92 +++++++++++++++++++++++++++++++++++++++-
 net/openvswitch/flow_netlink.h   |  8 ++++
 10 files changed, 254 insertions(+), 7 deletions(-)
 create mode 100644 net/openvswitch/bpf.c

-- 
1.9.1

_______________________________________________
dev mailing list
dev@openvswitch.org
http://openvswitch.org/mailman/listinfo/dev

^ permalink raw reply	[flat|nested] 8+ messages in thread
* Re: [ovs-dev] [RFC: add openvswitch actions using BPF 1/2] BPF: add a new BPF program type BPF_PROG_TYPE_OPENVSWITCH
@ 2015-02-05 20:30 Alexei Starovoitov
  0 siblings, 0 replies; 8+ messages in thread
From: Alexei Starovoitov @ 2015-02-05 20:30 UTC (permalink / raw)
  To: Andy Zhou; +Cc: Thomas Graf, dev@openvswitch.com, netdev@vger.kernel.org

On Thu, Feb 5, 2015 at 11:47 AM, Andy Zhou <azhou@nicira.com> wrote:
> On Thu, Feb 5, 2015 at 6:48 AM, Thomas Graf <tgraf@noironetworks.com> wrote:
>> On 02/04/15 at 02:48pm, Andy Zhou wrote:
>>>  struct bpf_verifier_ops {
>>>       /* return eBPF function prototype for verification */
>>> -     const struct bpf_func_proto *(*get_func_proto)(enum bpf_func_id func_id);
>>> +     const struct bpf_func_proto *(*get_func_proto)(int func_id);
>>
>> This change should maybe go in a separate commit.
> Agreed.  Ideally, each program type should have its own func_id space. Current
> registration does not allow this. Should this be added?
>
> In the interest of reusing common helper functions, should we also consider
> partition the func_id space into common ones and program type specific ones?
> For example, the prink like function can be specified the common func_id space.

I don't like per-program_type func_ids, since overlapping ids is
a debugging headache and it encourages hiding ids instead of
clearly adding them to uapi's enum bpf_func_id.
per-program type ids also make it impossible to share common helper ids
which is already the case between socket and tracing prog types.
Having one place and one enum for all ids helps to keep
exposed user helpers under control.

>>> +static const struct bpf_func_proto *ovs_func_proto(int func_id)
>>> +{
>>> +     switch (func_id) {
>>> +     case OVS_BPF_FUNC_output:
>>> +             return &bpf_helper_output_proto;
>>> +     default:
>>> +             return NULL;
>>> +     }
>>> +}
>>
>> You'd still want to use the map helpers so it seems like we should
>> change the bpf verified to verify against both a global and type
>> specific list unless we want to add all the map helpers to
>> ovs_func_proto as well.
>
> It is not clear what OVS can benefit from the map helpers.  Map provides
> a fixed sized array.  OVS data structure, such as flow, are more
> dynamic and non-contiguous in memory.

that's a misunderstanding.
maps can be different types including rhashtable type.
Actually I was waiting for rhashtable to stabilize
before adding it as new map type ;)
There is 'max_entries' limit that must be there for safety reasons,
but it doesn't mean that all entries are always allocated at
init time and never change.
contiguous vs non-contiguous is also internal detail of map
implementation.

^ permalink raw reply	[flat|nested] 8+ messages in thread

end of thread, other threads:[~2015-02-05 20:30 UTC | newest]

Thread overview: 8+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2015-02-04 22:48 [RFC: add openvswitch actions using BPF 0/2] Andy Zhou
     [not found] ` <1423090122-19807-1-git-send-email-azhou-l0M0P4e3n4LQT0dZR+AlfA@public.gmane.org>
2015-02-04 22:48   ` [RFC: add openvswitch actions using BPF 1/2] BPF: add a new BPF program type BPF_PROG_TYPE_OPENVSWITCH Andy Zhou
2015-02-05 14:48     ` [ovs-dev] " Thomas Graf
2015-02-05 19:47       ` Andy Zhou
2015-02-04 22:48   ` [RFC: add openvswitch actions using BPF 2/2] openvswitch: implements the BPF_PROG action in datapath Andy Zhou
2015-02-05 15:07     ` [ovs-dev] " Thomas Graf
2015-02-05 19:34       ` Andy Zhou
  -- strict thread matches above, loose matches on Subject: below --
2015-02-05 20:30 [ovs-dev] [RFC: add openvswitch actions using BPF 1/2] BPF: add a new BPF program type BPF_PROG_TYPE_OPENVSWITCH Alexei Starovoitov

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox