Skip to contentSkip to conversation

docs: bpf: Clarify BPF_CMPXCHG wording

PATCH Applied Ilya Leoshkevich 2 participants 2 messages Feb 10, 2021 – Feb 12, 2021

Subsystems (3)
lore
Share & tools
lore
#0 lore raw

PATCH 1/1 docs: bpf: Clarify BPF_CMPXCHG wording

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/

---
 Documentation/networking/filter.rst | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)
Documentation/networking/filter.rst +2 -2
index b3f457802836..251c6bd73d15 100644
@@ -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.
 
Signature · 1 line
2.29.2