netdev.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: Thomas Graf <tgraf@noironetworks.com>
To: Andy Zhou <azhou@nicira.com>
Cc: dev@openvswitch.com, netdev@vger.kernel.org
Subject: Re: [ovs-dev] [RFC: add openvswitch actions using BPF 1/2] BPF: add a new BPF program type BPF_PROG_TYPE_OPENVSWITCH
Date: Thu, 5 Feb 2015 15:48:28 +0100	[thread overview]
Message-ID: <20150205144828.GF5546@pox.localdomain> (raw)
In-Reply-To: <1423090122-19807-2-git-send-email-azhou@nicira.com>

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.

> +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.

> +static bool test_is_valid_access(int off, int size, enum bpf_access_type type)
> +{
> +	const struct bpf_context_access *access;
> +
> +	if (off < 0 || off >= ARRAY_SIZE(bpf_ctx_access))
> +		return false;
> +
> +	access = &bpf_ctx_access[off];
> +	if (access->size == size && (access->type & type))
> +		return true;
> +
> +	return false;
> +}

OK. I see why you kept ctxt simple at first ;-)

  reply	other threads:[~2015-02-05 14:48 UTC|newest]

Thread overview: 8+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
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     ` Thomas Graf [this message]
2015-02-05 19:47       ` [ovs-dev] " 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

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=20150205144828.GF5546@pox.localdomain \
    --to=tgraf@noironetworks.com \
    --cc=azhou@nicira.com \
    --cc=dev@openvswitch.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).