Date: Mon, 5 Aug 2013 20:56:46 +0100 From: Mindaugas Rasiukevicius <rmind@netbsd.org> To: christos@astron.com (Christos Zoulas) Cc: tech-net@netbsd.org, freebsd-net@freebsd.org Subject: Re: BPF_MISC+BPF_COP and BPF_COPX Message-ID: <20130805195704.F276A14A1A7@mail.netbsd.org> In-Reply-To: <ktna5b$275$1@ger.gmane.org> References: <20130804191310.2FFBB14A152@mail.netbsd.org> <9813E50B-C557-4FE1-BADF-A2CFFCBB8BD7@felyko.com> <ktna5b$275$1@ger.gmane.org>
next in thread | previous in thread | raw e-mail | index | archive | help
christos@astron.com (Christos Zoulas) wrote: > >> <...> > >> > >> BPF_STMT(BPF_MISC+BPF_COP, 0), /* A <- funcs[0](...) */ > >> > >> typedef uint32_t(*bpf_copfunc_t)(struct mbuf *pkt, > >> uint32_t A, uint32_t *M); > >> > >> int bpf_set_cop(bpf_ctx_t *c, bpf_copfunc_t funcs[], size_t n); > >> > >> <...> > > Well, aside from the consideration that somehow bpf needs to understand > what memory locations the coproc function alters (so that it considers > them initialized), the bigger question is how does the code for those > functions gets loaded and unloaded, and which bpf programs have access to > those functions. This is not really for /dev/bpf. The user would be a kernel subsystem, which would call bpf_filter(9) on a packet (or whatever is stored in the mbuf) itself. As it would provide/control both the byte-code and the coprocessor functions, the calling convention (e.g. callee/caller words in the memory store) would be consistent. Hence the need to adjust bpf_filter() routine to accept struct bpf_ctx which would contain the coprocessor routines. While doing that, I would also like to add support for initialising the memory store words to a custom values. > > christos > -- Mindaugas
Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?20130805195704.F276A14A1A7>