Function report

Linux Kernel

v5.5.9

Brick Technologies Co., Ltd

Source Code:kernel\bpf\hashtab.c Create Date:2022-07-28 13:10:11
Last Modify:2022-05-23 09:15:29 Copyright©Brick
home page Tree
Annotation kernel can get tool activityDownload SCCTChinese

Name:__htab_lru_percpu_map_update_elem

Proto:static int __htab_lru_percpu_map_update_elem(struct bpf_map *map, void *key, void *value, u64 map_flags, bool onallcpus)

Type:int

Parameter:

TypeParameterName
struct bpf_map *map
void *key
void *value
u64map_flags
boolonallcpus
1032  htab = container_of - cast a member of a structure out to the containing structure*@ptr: the pointer to the member.*@type: the type of the container struct this is embedded in.*@member: the name of the member within the struct.(map, structbpf_htab, map)
1033  l_new = NULL
1040  If Value for the false possibility is greater at compile time(map_flags > update existing element ) Then Return -EINVAL
1044  WARN_ON_ONCE(!_read_lock_held() - might we be in RCU read-side critical section?* If CONFIG_DEBUG_LOCK_ALLOC is selected, returns nonzero iff in an RCU* read-side critical section)
1046  key_size = key_size
1048  hash = htab_map_hash(key, key_size, hashrnd)
1050  b = __select_bucket(htab, hash)
1051  head = head
1058  If map_flags != update existing element Then
1059  l_new = prealloc_lru_pop(htab, key, hash)
1060  If Not l_new Then Return -ENOMEM
1065  raw_spin_lock_irqsave( & lock, flags)
1067  l_old = his lookup function can only be called with bucket lock taken
1069  ret = check_flags(htab, l_old, map_flags)
1070  If ret Then Go to err
1073  If l_old Then
1074  bpf_lru_node_set_ref( & lru_node)
1077  pcpu_copy_value(htab, htab_elem_get_ptr(l_old, key_size), value, onallcpus)
1079  Else
1080  pcpu_copy_value(htab, htab_elem_get_ptr(l_new, key_size), value, onallcpus)
1082  hlist_nulls_add_head_rcu*@n: the element to add to the hash list
1083  l_new = NULL
1085  ret = 0
1086  err :
1087  raw_spin_unlock_irqrestore( & lock, flags)
1088  If l_new Then bpf_lru_push_free( & lru, & lru_node)
1090  Return ret
Caller
NameDescribe
htab_lru_percpu_map_update_elem
bpf_percpu_hash_update