Function report

Linux Kernel

v5.5.9

Brick Technologies Co., Ltd

Source Code:kernel\bpf\cpumap.c Create Date:2022-07-28 13:23:59
Last Modify:2020-03-12 14:18:49 Copyright©Brick
home page Tree
Annotation kernel can get tool activityDownload SCCTChinese

Name:cpu_map_update_elem

Proto:static int cpu_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
471  cmap = 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_cpu_map, map)
475  key_cpu = key
477  qsize = value
479  If Value for the false possibility is greater at compile time(map_flags > update existing element ) Then Return -EINVAL
481  If Value for the false possibility is greater at compile time(key_cpu >= max_entries) Then Return -E2BIG
483  If Value for the false possibility is greater at compile time(map_flags == create new element if it didn't exist ) Then Return -EEXIST
485  If Value for the false possibility is greater at compile time(qsize > 16384) Then Return -EOVERFLOW
489  If Not cpu_possible(key_cpu) Then Return -ENODEV
492  If qsize == 0 Then
493  rcpu = NULL
494  Else
496  rcpu = __cpu_map_entry_alloc(qsize, key_cpu, id)
497  If Not rcpu Then Return -ENOMEM
499  cmap = cmap
501  _read_lock() - mark the beginning of an RCU read-side critical section* When synchronize_rcu() is invoked on one CPU while other CPUs* are within RCU read-side critical sections, then the* synchronize_rcu() is guaranteed to block until after all the other
502  After xchg pointer to bpf_cpu_map_entry, use the call_rcu() to* ensure any driver rcu critical sections have completed, but this* does not guarantee a flush has happened yet. Because driver side* rcu_read_lock/unlock only protects the running XDP program
503  _read_unlock() - marks the end of an RCU read-side critical section.* In most situations, rcu_read_unlock() is immune from deadlock.* However, in kernels built with CONFIG_RCU_BOOST, rcu_read_unlock()
504  Return 0