From: David Miller <davem@davemloft.net>
To: ast@plumgrid.com
Cc: chema@google.com, edumazet@google.com, dborkman@redhat.com,
netdev@vger.kernel.org
Subject: Re: [PATCH net-next] net: filter: cleanup A/X name usage
Date: Wed, 11 Jun 2014 00:13:38 -0700 (PDT) [thread overview]
Message-ID: <20140611.001338.216529368304427176.davem@davemloft.net> (raw)
In-Reply-To: <1402091166-5206-1-git-send-email-ast@plumgrid.com>
From: Alexei Starovoitov <ast@plumgrid.com>
Date: Fri, 6 Jun 2014 14:46:06 -0700
> The macro 'A' used in internal BPF interpreter:
> #define A regs[insn->a_reg]
> was easily confused with the name of classic BPF register 'A', since
> 'A' would mean two different things depending on context.
>
> This patch is trying to clean up the naming and clarify its usage in the
> following way:
>
> - A and X are names of two classic BPF registers
>
> - BPF_REG_A denotes internal BPF register R0 used to map classic register A
> in internal BPF programs generated from classic
>
> - BPF_REG_X denotes internal BPF register R7 used to map classic register X
> in internal BPF programs generated from classic
>
> - internal BPF instruction format:
> struct sock_filter_int {
> __u8 code; /* opcode */
> __u8 dst_reg:4; /* dest register */
> __u8 src_reg:4; /* source register */
> __s16 off; /* signed offset */
> __s32 imm; /* signed immediate constant */
> };
>
> - BPF_X/BPF_K is 1 bit used to encode source operand of instruction
> In classic:
> BPF_X - means use register X as source operand
> BPF_K - means use 32-bit immediate as source operand
> In internal:
> BPF_X - means use 'src_reg' register as source operand
> BPF_K - means use 32-bit immediate as source operand
>
> Suggested-by: Chema Gonzalez <chema@google.com>
> Signed-off-by: Alexei Starovoitov <ast@plumgrid.com>
Applied.
prev parent reply other threads:[~2014-06-11 7:13 UTC|newest]
Thread overview: 6+ messages / expand[flat|nested] mbox.gz Atom feed top
2014-06-06 21:46 [PATCH net-next] net: filter: cleanup A/X name usage Alexei Starovoitov
2014-06-08 20:21 ` Daniel Borkmann
2014-06-09 17:10 ` Chema Gonzalez
2014-06-09 19:25 ` Alexei Starovoitov
2014-06-10 7:29 ` Daniel Borkmann
2014-06-11 7:13 ` David Miller [this message]
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=20140611.001338.216529368304427176.davem@davemloft.net \
--to=davem@davemloft.net \
--cc=ast@plumgrid.com \
--cc=chema@google.com \
--cc=dborkman@redhat.com \
--cc=edumazet@google.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 an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.