Motivate delete() before update() in tutorial (#651)
authorPaul Chaignon <paul.chaignon@gmail.com>
Tue, 9 Aug 2016 16:38:05 +0000 (18:38 +0200)
committer4ast <alexei.starovoitov@gmail.com>
Tue, 9 Aug 2016 16:38:05 +0000 (09:38 -0700)
This delete() is required because of a kernel bug:
https://git.kernel.org/cgit/linux/kernel/git/davem/net.git/commit/?id=a6ed3ea65d9868fdf9eff84e6fe4f666b8d14b02

docs/tutorial_bcc_python_developer.md

index e26dcff..9cd5718 100644 (file)
@@ -162,7 +162,7 @@ Things to learn:
 1. ```BPF_HASH(last)```: Creates a BPF map object that is a hash (associative array), called "last". We didn't specify any further arguments, so it defaults to key and value types of u64.
 1. ```key = 0```: We'll only store one key/value pair in this hash, where the key is hardwired to zero.
 1. ```last.lookup(&key)```: Lookup the key in the hash, and return a pointer to its value if it exists, else NULL. We pass the key in as an address to a pointer.
-1. ```last.delete(&key)```: Delete the key from the hash.
+1. ```last.delete(&key)```: Delete the key from the hash. This is currently required because of [a kernel bug in `.update()`](https://git.kernel.org/cgit/linux/kernel/git/davem/net.git/commit/?id=a6ed3ea65d9868fdf9eff84e6fe4f666b8d14b02).
 1. ```last.update(&key)```: Set the key to equal the value in the 2nd argument. This records the timestamp.
 
 ### Lesson 5. sync_count.py