tech-net archive

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index][Old Index]

Re: BPF_MISC+BPF_COP and BPF_COPX (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


Home | Main Index | Thread Index | Old Index