Skip to content

Commit

Permalink
docs: bpf: Clarify BPF_CMPXCHG wording
Browse files Browse the repository at this point in the history
Based on [1], BPF_CMPXCHG should always load the old value into R0. The
phrasing in bpf.rst is somewhat ambiguous in this regard, improve it to
make this aspect crystal clear.

  [1] https://lore.kernel.org/bpf/CAADnVQJFcFwxEz=wnV=hkie-EDwa8s5JGbBQeFt1TGux1OihJw@mail.gmail.com/

Signed-off-by: Ilya Leoshkevich <iii@linux.ibm.com>
Signed-off-by: Alexei Starovoitov <ast@kernel.org>
Link: https://lore.kernel.org/bpf/20210210142853.82203-1-iii@linux.ibm.com
  • Loading branch information
Ilya Leoshkevich authored and Alexei Starovoitov committed Feb 12, 2021
1 parent 1336c66 commit 6a5df96
Showing 1 changed file with 2 additions and 2 deletions.
4 changes: 2 additions & 2 deletions Documentation/networking/filter.rst
Original file line number Diff line number Diff line change
Expand Up @@ -1076,8 +1076,8 @@ off``. ::
BPF_CMPXCHG

This atomically compares the value addressed by ``dst_reg + off`` with
``R0``. If they match it is replaced with ``src_reg``, The value that was there
before is loaded back to ``R0``.
``R0``. If they match it is replaced with ``src_reg``. In either case, the
value that was there before is zero-extended and loaded back to ``R0``.

Note that 1 and 2 byte atomic operations are not supported.

Expand Down

0 comments on commit 6a5df96

Please sign in to comment.