Function report

Linux Kernel

v5.5.9

Brick Technologies Co., Ltd

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

Name:htab_lru_map_update_elem

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

Type:int

Parameter:

TypeParameterName
struct bpf_map *map
void *key
void *value
u64map_flags
914  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)
915  struct htab_elem * l_new, * l_old = NULL
922  If Value for the false possibility is greater at compile time(map_flags > update existing element ) Then Return -EINVAL
926  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)
928  key_size = key_size
930  hash = htab_map_hash(key, key_size, hashrnd)
932  b = __select_bucket(htab, hash)
933  head = head
940  l_new = prealloc_lru_pop(htab, key, hash)
941  If Not l_new Then Return -ENOMEM
943  No 3D Now!(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, value_size)
946  raw_spin_lock_irqsave( & lock, flags)
948  l_old = his lookup function can only be called with bucket lock taken
950  ret = check_flags(htab, l_old, map_flags)
951  If ret Then Go to err
957  hlist_nulls_add_head_rcu*@n: the element to add to the hash list
958  If l_old Then
959  bpf_lru_node_set_ref( & lru_node)
960  hlist_nulls_del_rcu - deletes entry from hash list without re-initialization*@n: the element to delete from the hash list.* Note: hlist_nulls_unhashed() on entry does not return true after this,* the entry is in an undefined state
962  ret = 0
964  err :
965  raw_spin_unlock_irqrestore( & lock, flags)
967  If ret Then bpf_lru_push_free( & lru, & lru_node)
969  Else if l_old Then bpf_lru_push_free( & lru, & lru_node)
972  Return ret