Subject: Re: [PATCH net-next] net: filter: cleanup A/X name usage

From: Daniel Borkmann <[email-masked]>
Date: Tue, 10 Jun 2014 09:29:00 +0200

On 06/09/2014 09:25 PM, Alexei Starovoitov wrote:
...
> Point taken. Will do more thorough documentation patch to
> explain eBPF instruction set a bit better. Mainly to clarify encoding.
> eBPF tried to be as close as possible to classic BPF, since I thought
> it will make it easier to understand. That's why I reused A/X in names
> and bits in opcode encoding.
> In classic, A is accumulator and X is indeX. In eBPF I thought
> calling destination register 'a_reg' made sense, since it would
> indicate that this 'a_reg' is a register that is used as 'accumulator'
> in the instruction. Like in "bpf_add R2, 5", R2 is Accumulator.
> In "bpf_add R2, R3", R2  is Accumulator and R3 is indeX
> and BPF_X bit in opcode indicates whether 'x_reg' field of the
> instruction is used. Unfortunately that decision caused the whole
> A/X naming confusion, that this patch is addressing.
> src_reg and dst_reg are indeed better names.

I think both naming conventions (before/after) are fine, imho.