函数逻辑报告

Linux Kernel

v5.5.9

Brick Technologies Co., Ltd

Source Code:kernel\bpf\hashtab.c Create Date:2022-07-27 14:25:50
Last Modify:2022-05-23 09:15:29 Copyright©Brick
首页 函数Tree
注解内核,赢得工具下载SCCTEnglish

函数名称:alloc_htab_elem

函数原型:static struct htab_elem *alloc_htab_elem(struct bpf_htab *htab, void *key, void *value, u32 key_size, u32 hash, bool percpu, bool onallcpus, struct htab_elem *old_elem)

返回类型:struct htab_elem

参数:

类型参数名称
struct bpf_htab *htab
void *key
void *value
u32key_size
u32hash
boolpercpu
boolonallcpus
struct htab_elem *old_elem
726  size等于value_size
727  prealloc等于htab_is_prealloc(htab)
729  __percpupptr
731  如果prealloc
732  如果old_elem
737  l_new等于pl_new
738  pl_new等于old_elem
739  否则
742  l等于__pcpu_freelist_pop( & freelist)
743  如果非l则返回:错误号
747  否则
748  如果atomic_inc_return( & number of elements in this hashtable )大于max_entries则如果非old_elem
755  l_new等于错误号
756  转到:dec_count
758  l_new等于kmalloc_node( size of each element in bytes , DOC: Useful GFP flag combinations* Useful GFP flag combinations* ~~~~~~~~~~~~~~~~~~~~~~~~~~~~* Useful GFP flag combinations that are commonly used. It is recommended* that subsystems start with one of these combinations and then set/clear | DOC: Action modifiers* Action modifiers* ~~~~~~~~~~~~~~~~* %__GFP_NOWARN suppresses allocation failure reports.* %__GFP_COMP address compound page metadata.* %__GFP_ZERO returns a zeroed page on success., numa_node)
760  如果非l_new
761  l_new等于错误号
762  转到:dec_count
764  check_and_init_map_lock( & map, key + und_up - round up to next specified power of 2*@x: the value to round*@y: multiple to round up to (must be a power of 2)* Rounds @x up to next multiple of @y (which must be a power of 2).* To perform arbitrary rounding up, use roundup() below.(key_size, 8))
768  内存复制(key, key, key_size)
769  如果percpu
770  size等于und_up - round up to next specified power of 2*@x: the value to round*@y: multiple to round up to (must be a power of 2)* Rounds @x up to next multiple of @y (which must be a power of 2).* To perform arbitrary rounding up, use roundup() below.(size, 8)
771  如果prealloc
773  否则
777  如果非pptr
778  kfree(l_new)
779  l_new等于错误号
780  转到:dec_count
784  pcpu_copy_value(htab, pptr, value, onallcpus)
786  如果非preallochtab_elem_set_ptr(l_new, key_size, pptr)
788  否则如果fd_htab_map_needs_adjust(htab)则
789  size等于und_up - round up to next specified power of 2*@x: the value to round*@y: multiple to round up to (must be a power of 2)* Rounds @x up to next multiple of @y (which must be a power of 2).* To perform arbitrary rounding up, use roundup() below.(size, 8)
790  内存复制(key + und_up - round up to next specified power of 2*@x: the value to round*@y: multiple to round up to (must be a power of 2)* Rounds @x up to next multiple of @y (which must be a power of 2).* To perform arbitrary rounding up, use roundup() below.(key_size, 8), value, size)
791  否则
792  py everything but bpf_spin_lock
797  hash等于hash
798  返回:l_new
799  dec_count :
800  atomic_dec( & number of elements in this hashtable )
801  返回:l_new
调用者
名称描述
htab_map_update_elemCalled from syscall or from eBPF program
__htab_percpu_map_update_elem