[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-Id: <201011170806.oAH86AdI013337@www262.sakura.ne.jp>
Date: Wed, 17 Nov 2010 17:06:10 +0900
From: Tetsuo Handa <penguin-kernel@...ove.SAKURA.ne.jp>
To: eric.dumazet@...il.com
Cc: mjt@....msk.ru, davem@...emloft.net, drosenberg@...curity.com,
hagen@...u.net, xiaosuo@...il.com, netdev@...r.kernel.org
Subject: Re: [PATCH v3] filter: Optimize instruction revalidation code.
Eric Dumazet wrote:
> > > But how about this:
> > >
> > > enum {
> > > BPF_S_RET_K = 1,
> >
> > If BPF_S_* are only for kernel internal use, I think we don't need to translate
> > from the beginning because only net/core/filter.c uses BPF_S_*.
> >
> > BPF_S_* are exposed to userspace via /usr/include/linux/filter.h since 2.6.36.
> > Is it no problem to change?
>
> No problem, and Changli posted patch to move them to net/core/filter.c
> anyway.
> Please repost it when Changli patch is accepted by David
> (if accepted :)), to get rid of the "+ 1"
But if Changli's patch is accepted, we can remove BPF_S_* like below.
switch (fentry->code) {
- case BPF_S_ALU_ADD_X:
+ case BPF_ALU|BPF_ADD|BPF_X: /* BPF_S_ALU_ADD_X */
A += X;
continue;
- case BPF_S_ALU_ADD_K:
+ case BPF_ALU|BPF_ADD|BPF_K: /* BPF_S_ALU_ADD_K */
A += f_k;
continue;
- case BPF_S_ALU_SUB_X:
+ case BPF_ALU|BPF_SUB|BPF_X: /* BPF_S_ALU_SUB_X */
A -= X;
continue;
- case BPF_S_ALU_SUB_K:
+ case BPF_ALU|BPF_SUB|BPF_K: /* BPF_S_ALU_SUB_K */
A -= f_k;
continue;
If compilers can generate better code for continuous case values
than discontinuous case values, then keeping BPF_S_* makes sense.
--
To unsubscribe from this list: send the line "unsubscribe netdev" in
the body of a message to majordomo@...r.kernel.org
More majordomo info at http://vger.kernel.org/majordomo-info.html
Powered by blists - more mailing lists