libbpf: Add documentation for bpf_map batch operations
PATCH 1/1 libbpf: Add documentation for bpf_map batch operations
From: Grant Seltzer <[email protected]>
This adds documention for:
- bpf_map_delete_batch()
- bpf_map_lookup_batch()
- bpf_map_lookup_and_delete_batch()
- bpf_map_update_batch()
--- tools/lib/bpf/bpf.h | 93 +++++++++++++++++++++++++++++++++++++++++++++ 1 file changed, 93 insertions(+)
tools/lib/bpf/bpf.h +93 -0
@@ -254,20 +254,113 @@ struct bpf_map_batch_opts { };#define bpf_map_batch_opts__last_field flags + +/** +* @brief **bpf_map_delete_batch()** allows for batch deletion of multiple +* elements in a BPF map. +* +* The parameter *keys* points to a memory address large enough to hold +* *count* keys of elements in the map *fd*. +* +* @param fd BPF map file descriptor +* @param keys memory address large enough to hold *count* * *key_size* +* @param count number of elements in the map to sequentially delete +* @param opts options for configuring the way the batch deletion works +* @return int error code, 0 if no error (errno is also set to error) +*/ LIBBPF_API int bpf_map_delete_batch(int fd, void *keys,__u32 *count,const struct bpf_map_batch_opts *opts); + +/** +* @brief **bpf_map_lookup_batch()** allows for iteration of BPF map elements. +* +* The parameter *in_batch* is the address of the first element in the batch to read. +* *out_batch* is an output parameter that should be passed as *in_batch* to subsequent +* calls to **bpf_map_lookup_batch()**. NULL can be passed for *in_batch* to set +* *out_batch* as the first element of the map. +* +* The *keys* and *values* are output parameters which must point to memory large enough to +* hold *count* items based on the key and value size of the map *map_fd*. The *keys* +* buffer must be of *key_size* * *count*. The *values* buffer must be of +* *value_size* * *count*. +* +* @param fd BPF map file descriptor +* @param in_batch address of the first element in batch to read, can pass NULL to +* get address of the first element in *out_batch* +* @param out_batch output parameter that should be passed to next call as *in_batch* +* @param keys memory address large enough to hold *count* * *key_size* +* @param values memory address large enough to hold *count* * *value_size* +* @param count number of elements in the map to read in batch +* @param opts options for configuring the way the batch lookup works +* @return int error code, 0 if no error (errno is also set to error) +*/ LIBBPF_API int bpf_map_lookup_batch(int fd, void *in_batch, void *out_batch,void *keys,void *values,__u32 *count,const struct bpf_map_batch_opts *opts); + +/** +* @brief **bpf_map_lookup_and_delete_batch()** allows for iteration of BPF map +* elements where each element is deleted after being retrieved. +* +* Note that *count* is an input and output parameter, where on output it +* represents how many elements were succesfully deleted. Also note that if +* **EFAULT** is returned up to *count* elements may have been deleted without +* being returned via the *keys* and *values* output parameters. +* +* @param fd BPF map file descriptor +* @param in_batch address of the first element in batch to read, can pass NULL to +* get address of the first element in *out_batch* +* @param out_batch output parameter that should be passed to next call as *in_batch* +* @param keys memory address large enough to hold *count* * *key_size* +* @param values memory address large enough to hold *count* * *value_size* +* @param count number of elements in the map to read and delete in batch +* @param opts options for configuring the way the batch lookup and delete works +* @return int error code, 0 if no error (errno is also set to error) +* See note on EFAULT. +*/ LIBBPF_API int bpf_map_lookup_and_delete_batch(int fd, void *in_batch,void *out_batch,void *keys,void *values,__u32 *count,const struct bpf_map_batch_opts *opts); + +/** +* @brief **bpf_map_update_batch()** updates multiple elements in a map +* by specifiying keys and their corresponding values. +* +* The *keys* and *values* paremeters must point to memory large enough +* to hold *count* items based on the key and value size of the map. +* +* The *opts* parameter can be used to control how *bpf_map_update_batch()* +* should handle keys that either do or do not already exist in the map. +* In particular the *flags* field of *bpf_map_batch_opts* can be +* one of the following: +* +* **BPF_ANY** +* Create new elements or update a existing elements. +* +* **BPF_NOEXIST** +* Create new elements only if they do not exist. +* +* **BPF_EXIST** +* Update existing elements. +* +* **BPF_F_LOCK** +* Update spin_lock-ed map elements. This must be +* specified if the map value contains a spinlock. +* +* @param fd BPF map file descriptor +* @param keys memory address large enough to hold *count* * *key_size* +* @param values memory address large enough to hold *count* * *value_size* +* @param count number of elements in the map to update in batch +* @param opts options for configuring the way the batch update works +* @return int error code, 0 if no error (errno is also set to error) +*/ LIBBPF_API int bpf_map_update_batch(int fd, void *keys, void *values,__u32 *count,const struct bpf_map_batch_opts *opts); + LIBBPF_API int bpf_obj_pin(int fd, const char *pathname); LIBBPF_API int bpf_obj_get(const char *pathname);
Signature · 1 line
2.33.1
Quoted 32 lines · grantseltzer
From: Grant Seltzer <[email protected]>
This adds documention for:
-
bpf_map_delete_batch()
-bpf_map_lookup_batch()
-bpf_map_lookup_and_delete_batch()
-bpf_map_update_batch()Signed-off-by Grant Seltzer <[email protected]>--- tools/lib/bpf/bpf.h | 93 +++++++++++++++++++++++++++++++++++++++++++++ 1 file changed, 93 insertions(+)tools/lib/bpf/bpf.h +10
-0@@ -254,20 +254,113 @@ struct bpf_map_batch_opts { };#define bpf_map_batch_opts__last_field flags + +/** +* @brief **bpf_map_delete_batch()** allows for batch deletion of multiple +* elements in a BPF map. +* +* The parameter *keys* points to a memory address large enough to hold +* *count* keys of elements in the map *fd*. +* +* @param fd BPF map file descriptor +* @param keys memory address large enough to hold *count* * *key_size*
tools/lib/bpf/bpf.h struct bpf_map_batch_opts { · line 276
Quoted 10 lines
tools/lib/bpf/bpf.h +7
-0+* @param count number of elements in the map to sequentially delete +* @param opts options for configuring the way the batch deletion works +* @return int error code, 0 if no error (errno is also set to error) +*/ LIBBPF_API int bpf_map_delete_batch(int fd, void *keys,__u32 *count,const struct bpf_map_batch_opts *opts); + +/** +* @brief **bpf_map_lookup_batch()** allows for iteration of BPF map elements.
"for iteration" => "for batch lookup"
tools/lib/bpf/bpf.h struct bpf_map_batch_opts { · line 281
Quoted 5 lines
tools/lib/bpf/bpf.h +5
-0+* +* The parameter *in_batch* is the address of the first element in the batch to read. +* *out_batch* is an output parameter that should be passed as *in_batch* to subsequent +* calls to **bpf_map_lookup_batch()**. NULL can be passed for *in_batch* to set +* *out_batch* as the first element of the map.
NULL can be passed for *in_batch* to indicate that the batched lookup starts from the beginning of the map.
tools/lib/bpf/bpf.h struct bpf_map_batch_opts { · line 290
Quoted 9 lines
tools/lib/bpf/bpf.h +9
-0+* +* The *keys* and *values* are output parameters which must point to memory large enough to +* hold *count* items based on the key and value size of the map *map_fd*. The *keys* +* buffer must be of *key_size* * *count*. The *values* buffer must be of +* *value_size* * *count*. +* +* @param fd BPF map file descriptor +* @param in_batch address of the first element in batch to read, can pass NULL to +* get address of the first element in *out_batch*
can pass NULL to indicate that the batched lookup starts from the beginning of the map.
tools/lib/bpf/bpf.h struct bpf_map_batch_opts { · line 294
Quoted 4 lines
tools/lib/bpf/bpf.h +4
-0+* @param out_batch output parameter that should be passed to next call as *in_batch* +* @param keys memory address large enough to hold *count* * *key_size* +* @param values memory address large enough to hold *count* * *value_size* +* @param count number of elements in the map to read in batch
count is an input/output parameter. It may return the actual number of lookup elements if it returns 0 or return ENOENT. Please take a look at selftest map_tests/htab_map_batch_ops.c for a usage of the function.
tools/lib/bpf/bpf.h struct bpf_map_batch_opts { · line 304
Quoted 10 lines
tools/lib/bpf/bpf.h +7
-0+* @param opts options for configuring the way the batch lookup works +* @return int error code, 0 if no error (errno is also set to error) +*/ LIBBPF_API int bpf_map_lookup_batch(int fd, void *in_batch, void *out_batch,void *keys,void *values,__u32 *count,const struct bpf_map_batch_opts *opts); + +/** +* @brief **bpf_map_lookup_and_delete_batch()** allows for iteration of BPF map +* elements where each element is deleted after being retrieved.
"for iteration" => "for batch lookup and delete"?
tools/lib/bpf/bpf.h struct bpf_map_batch_opts { · line 307
Quoted 3 lines
tools/lib/bpf/bpf.h +3
-0+* +* Note that *count* is an input and output parameter, where on output it +* represents how many elements were succesfully deleted. Also note that if
successfully
tools/lib/bpf/bpf.h struct bpf_map_batch_opts { · line 309
Quoted 2 lines
tools/lib/bpf/bpf.h +2
-0+* **EFAULT** is returned up to *count* elements may have been deleted without +* being returned via the *keys* and *values* output parameters.
Okay, I see you mention *count* as input/output here. Again ENOENT might need to be handled specially.
Quoted 10 lines
tools/lib/bpf/bpf.h +10
-0+* +* @param fd BPF map file descriptor +* @param in_batch address of the first element in batch to read, can pass NULL to +* get address of the first element in *out_batch* +* @param out_batch output parameter that should be passed to next call as *in_batch* +* @param keys memory address large enough to hold *count* * *key_size* +* @param values memory address large enough to hold *count* * *value_size* +* @param count number of elements in the map to read and delete in batch +* @param opts options for configuring the way the batch lookup and delete works +* @return int error code, 0 if no error (errno is also set to error)
tools/lib/bpf/bpf.h struct bpf_map_batch_opts { · line 329
Quoted 10 lines
tools/lib/bpf/bpf.h +6
-0+* See note on EFAULT. +*/ LIBBPF_API int bpf_map_lookup_and_delete_batch(int fd, void *in_batch,void *out_batch,void *keys,void *values,__u32 *count,const struct bpf_map_batch_opts *opts); + +/** +* @brief **bpf_map_update_batch()** updates multiple elements in a map +* by specifiying keys and their corresponding values.
specifying
tools/lib/bpf/bpf.h struct bpf_map_batch_opts { · line 331
Quoted 2 lines
tools/lib/bpf/bpf.h +2
-0+* +* The *keys* and *values* paremeters must point to memory large enough
parameters
Quoted 14 lines
tools/lib/bpf/bpf.h +14
-0+* to hold *count* items based on the key and value size of the map. +* +* The *opts* parameter can be used to control how *bpf_map_update_batch()* +* should handle keys that either do or do not already exist in the map. +* In particular the *flags* field of *bpf_map_batch_opts* can be +* one of the following: +* +* **BPF_ANY** +* Create new elements or update a existing elements. +* +* **BPF_NOEXIST** +* Create new elements only if they do not exist. +* +* **BPF_EXIST**
tools/lib/bpf/bpf.h struct bpf_map_batch_opts { · line 355
Quoted 10 lines
tools/lib/bpf/bpf.h +10
-0+* Update existing elements. +* +* **BPF_F_LOCK** +* Update spin_lock-ed map elements. This must be +* specified if the map value contains a spinlock. +* +* @param fd BPF map file descriptor +* @param keys memory address large enough to hold *count* * *key_size* +* @param values memory address large enough to hold *count* * *value_size* +* @param count number of elements in the map to update in batch
Again, count is an input/output parameter. Here ENOENT is not involved.
As you mentioned in the above, if error code is EFAULT, return count value cannot be trusted. Otherwise, it should tell how many have been successfully updated.
Quoted 11 lines
tools/lib/bpf/bpf.h +4
-0+* @param opts options for configuring the way the batch update works +* @return int error code, 0 if no error (errno is also set to error) +*/ LIBBPF_API int bpf_map_update_batch(int fd, void *keys, void *values,__u32 *count,const struct bpf_map_batch_opts *opts); + LIBBPF_API int bpf_obj_pin(int fd, const char *pathname); LIBBPF_API int bpf_obj_get(const char *pathname);
Quoted 4 lines · grantseltzer
From: Grant Seltzer <[email protected]>
This adds documention for:
typo: documentation :)
Quoted 16 lines
-
bpf_map_delete_batch()
-bpf_map_lookup_batch()
-bpf_map_lookup_and_delete_batch()
-bpf_map_update_batch()Signed-off-by Grant Seltzer <[email protected]>--- tools/lib/bpf/bpf.h | 93 +++++++++++++++++++++++++++++++++++++++++++++ 1 file changed, 93 insertions(+)tools/lib/bpf/bpf.h +0
-0
tools/lib/bpf/bpf.h struct bpf_map_batch_opts { · line 262
Quoted 9 lines
tools/lib/bpf/bpf.h +6
-0@@ -254,20 +254,113 @@ struct bpf_map_batch_opts { };#define bpf_map_batch_opts__last_field flags + +/** +* @brief **bpf_map_delete_batch()** allows for batch deletion of multiple +* elements in a BPF map. +* +* The parameter *keys* points to a memory address large enough to hold
"memory address large enough" is very misleading... "points to buffer large enough"?
But in this case, keys is just an input array of keys, no? In such a case just saying that "*keys* points to an array of *count* keys" would be pretty unambiguous, right?
tools/lib/bpf/bpf.h struct bpf_map_batch_opts { · line 269
Quoted 7 lines
tools/lib/bpf/bpf.h +7
-0+* *count* keys of elements in the map *fd*. +* +* @param fd BPF map file descriptor +* @param keys memory address large enough to hold *count* * *key_size* +* @param count number of elements in the map to sequentially delete +* @param opts options for configuring the way the batch deletion works +* @return int error code, 0 if no error (errno is also set to error)
Usually success is described first. Can you please rephrase here and in others to something along the lines of:
0, on success; negative error code, otherwise (errno is also set to the error code)
?
tools/lib/bpf/bpf.h struct bpf_map_batch_opts { · line 271
Quoted 2 lines
tools/lib/bpf/bpf.h +1
-0+*/ LIBBPF_API int bpf_map_delete_batch(int fd, void *keys,
if keys are really just an input, let's mark them as const void *, while we are documenting all this?
Quoted 12 lines
tools/lib/bpf/bpf.h +10
-0__u32 *count, const struct bpf_map_batch_opts *opts); + +/** +* @brief **bpf_map_lookup_batch()** allows for iteration of BPF map elements. +* +* The parameter *in_batch* is the address of the first element in the batch to read. +* *out_batch* is an output parameter that should be passed as *in_batch* to subsequent +* calls to **bpf_map_lookup_batch()**. NULL can be passed for *in_batch* to set +* *out_batch* as the first element of the map. +* +* The *keys* and *values* are output parameters which must point to memory large enough to
tools/lib/bpf/bpf.h struct bpf_map_batch_opts { · line 293
Quoted 10 lines
tools/lib/bpf/bpf.h +10
-0+* hold *count* items based on the key and value size of the map *map_fd*. The *keys* +* buffer must be of *key_size* * *count*. The *values* buffer must be of +* *value_size* * *count*. +* +* @param fd BPF map file descriptor +* @param in_batch address of the first element in batch to read, can pass NULL to +* get address of the first element in *out_batch* +* @param out_batch output parameter that should be passed to next call as *in_batch* +* @param keys memory address large enough to hold *count* * *key_size* +* @param values memory address large enough to hold *count* * *value_size*
again this "memory address large enough" wording. Address is fixed at 32-bit/64-bit, depending on the architecture. It's quite a confusing wording that you chose...
Quoted 37 lines
tools/lib/bpf/bpf.h +30
-0+* @param count number of elements in the map to read in batch +* @param opts options for configuring the way the batch lookup works +* @return int error code, 0 if no error (errno is also set to error) +*/ LIBBPF_API int bpf_map_lookup_batch(int fd, void *in_batch, void *out_batch,void *keys,void *values,__u32 *count,const struct bpf_map_batch_opts *opts); + +/** +* @brief **bpf_map_lookup_and_delete_batch()** allows for iteration of BPF map +* elements where each element is deleted after being retrieved. +* +* Note that *count* is an input and output parameter, where on output it +* represents how many elements were succesfully deleted. Also note that if +* **EFAULT** is returned up to *count* elements may have been deleted without +* being returned via the *keys* and *values* output parameters. +* +* @param fd BPF map file descriptor +* @param in_batch address of the first element in batch to read, can pass NULL to +* get address of the first element in *out_batch* +* @param out_batch output parameter that should be passed to next call as *in_batch* +* @param keys memory address large enough to hold *count* * *key_size* +* @param values memory address large enough to hold *count* * *value_size* +* @param count number of elements in the map to read and delete in batch +* @param opts options for configuring the way the batch lookup and delete works +* @return int error code, 0 if no error (errno is also set to error) +* See note on EFAULT. +*/ LIBBPF_API int bpf_map_lookup_and_delete_batch(int fd, void *in_batch,void *out_batch,void *keys,void *values,__u32 *count,const struct bpf_map_batch_opts *opts); + +/** +* @brief **bpf_map_update_batch()** updates multiple elements in a map +* by specifiying keys and their corresponding values. +*
tools/lib/bpf/bpf.h struct bpf_map_batch_opts { · line 340
Quoted 10 lines
tools/lib/bpf/bpf.h +10
-0+* The *keys* and *values* paremeters must point to memory large enough +* to hold *count* items based on the key and value size of the map. +* +* The *opts* parameter can be used to control how *bpf_map_update_batch()* +* should handle keys that either do or do not already exist in the map. +* In particular the *flags* field of *bpf_map_batch_opts* can be +* one of the following: +* +* **BPF_ANY** +* Create new elements or update a existing elements.
just "update existing"
Quoted 9 lines
tools/lib/bpf/bpf.h +9
-0+* +* **BPF_NOEXIST** +* Create new elements only if they do not exist. +* +* **BPF_EXIST** +* Update existing elements. +* +* **BPF_F_LOCK** +* Update spin_lock-ed map elements. This must be
tools/lib/bpf/bpf.h struct bpf_map_batch_opts { · line 359
Quoted 10 lines
tools/lib/bpf/bpf.h +9
-0+* specified if the map value contains a spinlock. +* +* @param fd BPF map file descriptor +* @param keys memory address large enough to hold *count* * *key_size* +* @param values memory address large enough to hold *count* * *value_size* +* @param count number of elements in the map to update in batch +* @param opts options for configuring the way the batch update works +* @return int error code, 0 if no error (errno is also set to error) +*/ LIBBPF_API int bpf_map_update_batch(int fd, void *keys, void *values,
I think keys are also const void *, while values are written into. Let's update accordingly.
Quoted 10 lines
tools/lib/bpf/bpf.h +1
-1__u32 *count, const struct bpf_map_batch_opts *opts); + LIBBPF_API int bpf_obj_pin(int fd, const char *pathname); LIBBPF_API int bpf_obj_get(const char *pathname); --2.33.1
Quoted 161 lines · Andrii Nakryiko
Quoted 4 lines · grantseltzer
From: Grant Seltzer <[email protected]>
This adds documention for:
typo: documentation :)
Quoted 16 lines
-
bpf_map_delete_batch()
-bpf_map_lookup_batch()
-bpf_map_lookup_and_delete_batch()
-bpf_map_update_batch()Signed-off-by Grant Seltzer <[email protected]>--- tools/lib/bpf/bpf.h | 93 +++++++++++++++++++++++++++++++++++++++++++++ 1 file changed, 93 insertions(+)tools/lib/bpf/bpf.h +0
-0tools/lib/bpf/bpf.h struct bpf_map_batch_opts { · line 262
Quoted 9 lines
tools/lib/bpf/bpf.h +6
-0@@ -254,20 +254,113 @@ struct bpf_map_batch_opts { };#define bpf_map_batch_opts__last_field flags + +/** +* @brief **bpf_map_delete_batch()** allows for batch deletion of multiple +* elements in a BPF map. +* +* The parameter *keys* points to a memory address large enough to hold "memory address large enough" is very misleading... "points to buffer large enough"?
But in this case, keys is just an input array of keys, no? In such a case just saying that "*keys* points to an array of *count* keys" would be pretty unambiguous, right?
tools/lib/bpf/bpf.h struct bpf_map_batch_opts { · line 269
Quoted 7 lines
tools/lib/bpf/bpf.h +7
-0+* *count* keys of elements in the map *fd*. +* +* @param fd BPF map file descriptor +* @param keys memory address large enough to hold *count* * *key_size* +* @param count number of elements in the map to sequentially delete +* @param opts options for configuring the way the batch deletion works +* @return int error code, 0 if no error (errno is also set to error) Usually success is described first. Can you please rephrase here and in others to something along the lines of:
0, on success; negative error code, otherwise (errno is also set to the error code)
?
tools/lib/bpf/bpf.h struct bpf_map_batch_opts { · line 271
Quoted 2 lines
tools/lib/bpf/bpf.h +1
-0+*/ LIBBPF_API int bpf_map_delete_batch(int fd, void *keys,if keys are really just an input, let's mark them as
const void *, while we are documenting all this?Quoted 12 lines
tools/lib/bpf/bpf.h +10
-0__u32 *count, const struct bpf_map_batch_opts *opts); + +/** +* @brief **bpf_map_lookup_batch()** allows for iteration of BPF map elements. +* +* The parameter *in_batch* is the address of the first element in the batch to read. +* *out_batch* is an output parameter that should be passed as *in_batch* to subsequent +* calls to **bpf_map_lookup_batch()**. NULL can be passed for *in_batch* to set +* *out_batch* as the first element of the map. +* +* The *keys* and *values* are output parameters which must point to memory large enough to tools/lib/bpf/bpf.h struct bpf_map_batch_opts { · line 293
Quoted 10 lines
tools/lib/bpf/bpf.h +10
-0+* hold *count* items based on the key and value size of the map *map_fd*. The *keys* +* buffer must be of *key_size* * *count*. The *values* buffer must be of +* *value_size* * *count*. +* +* @param fd BPF map file descriptor +* @param in_batch address of the first element in batch to read, can pass NULL to +* get address of the first element in *out_batch* +* @param out_batch output parameter that should be passed to next call as *in_batch* +* @param keys memory address large enough to hold *count* * *key_size* +* @param values memory address large enough to hold *count* * *value_size* again this "memory address large enough" wording. Address is fixed at 32-bit/64-bit, depending on the architecture. It's quite a confusing wording that you chose...
Quoted 37 lines
tools/lib/bpf/bpf.h +30
-0+* @param count number of elements in the map to read in batch +* @param opts options for configuring the way the batch lookup works +* @return int error code, 0 if no error (errno is also set to error) +*/ LIBBPF_API int bpf_map_lookup_batch(int fd, void *in_batch, void *out_batch,void *keys,void *values,__u32 *count,const struct bpf_map_batch_opts *opts); + +/** +* @brief **bpf_map_lookup_and_delete_batch()** allows for iteration of BPF map +* elements where each element is deleted after being retrieved. +* +* Note that *count* is an input and output parameter, where on output it +* represents how many elements were succesfully deleted. Also note that if +* **EFAULT** is returned up to *count* elements may have been deleted without +* being returned via the *keys* and *values* output parameters. +* +* @param fd BPF map file descriptor +* @param in_batch address of the first element in batch to read, can pass NULL to +* get address of the first element in *out_batch* +* @param out_batch output parameter that should be passed to next call as *in_batch* +* @param keys memory address large enough to hold *count* * *key_size* +* @param values memory address large enough to hold *count* * *value_size* +* @param count number of elements in the map to read and delete in batch +* @param opts options for configuring the way the batch lookup and delete works +* @return int error code, 0 if no error (errno is also set to error) +* See note on EFAULT. +*/ LIBBPF_API int bpf_map_lookup_and_delete_batch(int fd, void *in_batch,void *out_batch,void *keys,void *values,__u32 *count,const struct bpf_map_batch_opts *opts); + +/** +* @brief **bpf_map_update_batch()** updates multiple elements in a map +* by specifiying keys and their corresponding values. +* tools/lib/bpf/bpf.h struct bpf_map_batch_opts { · line 340
Quoted 10 lines
tools/lib/bpf/bpf.h +10
-0+* The *keys* and *values* paremeters must point to memory large enough +* to hold *count* items based on the key and value size of the map. +* +* The *opts* parameter can be used to control how *bpf_map_update_batch()* +* should handle keys that either do or do not already exist in the map. +* In particular the *flags* field of *bpf_map_batch_opts* can be +* one of the following: +* +* **BPF_ANY** +* Create new elements or update a existing elements. just "update existing"
Quoted 9 lines
tools/lib/bpf/bpf.h +9
-0+* +* **BPF_NOEXIST** +* Create new elements only if they do not exist. +* +* **BPF_EXIST** +* Update existing elements. +* +* **BPF_F_LOCK** +* Update spin_lock-ed map elements. This must be tools/lib/bpf/bpf.h struct bpf_map_batch_opts { · line 359
Quoted 10 lines
tools/lib/bpf/bpf.h +9
-0+* specified if the map value contains a spinlock. +* +* @param fd BPF map file descriptor +* @param keys memory address large enough to hold *count* * *key_size* +* @param values memory address large enough to hold *count* * *value_size* +* @param count number of elements in the map to update in batch +* @param opts options for configuring the way the batch update works +* @return int error code, 0 if no error (errno is also set to error) +*/ LIBBPF_API int bpf_map_update_batch(int fd, void *keys, void *values,
Quoted 2 lines
I think keys are also
const void *, while values are written into. Let's update accordingly.
I don't think values are written into, going to mark that as const void * as well.
Quoted 11 lines
Quoted 11 lines
tools/lib/bpf/bpf.h +1
-1__u32 *count, const struct bpf_map_batch_opts *opts); + LIBBPF_API int bpf_obj_pin(int fd, const char *pathname); LIBBPF_API int bpf_obj_get(const char *pathname); --2.33.1