Function report

Linux Kernel

v5.5.9

Brick Technologies Co., Ltd

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

Name:Called from syscall only.* The "nsk" in the fd refcnt.* The "osk" and "reuse" are protected by reuseport_lock.

Proto:int bpf_fd_reuseport_array_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
251  array = reuseport_array(map)
252  free_osk = NULL
254  index = key
258  If map_flags > update existing element Then Return -EINVAL
261  If index >= max_entries Then Return -E2BIG
264  If value_size == sizeof(u64) Then
265  fd64 = value
267  If fd64 > S32_MAX Then Return -EINVAL
269  fd = fd64
270  Else
271  fd = value
274  socket = sockfd_lookup(fd, & err)
275  If Not socket Then Return err
278  nsk = sk
279  If Not nsk Then
280  err = -EINVAL
281  Go to put_file
285  err = reuseport_array_update_check(array, nsk, cu_access_pointer() - fetch RCU pointer with no dereferencing*@p: The pointer to read* Return the value of the specified RCU-protected pointer, but omit the* lockdep checks for being in an RCU read-side critical section(ptrs[index]), cu_access_pointer() - fetch RCU pointer with no dereferencing*@p: The pointer to read* Return the value of the specified RCU-protected pointer, but omit the* lockdep checks for being in an RCU read-side critical section(sk_reuseport_cb), map_flags)
289  If err Then Go to put_file
292  spin_lock_bh( & reuseport_lock)
298  write_lock_bh( & sk_callback_lock)
300  osk = cu_dereference_protected() - fetch RCU pointer when updates prevented*@p: The pointer to read, prior to dereferencing*@c: The conditions under which the dereference will take place* Return the value of the specified RCU-protected pointer, but omit(ptrs[index], lockdep_is_held( & reuseport_lock))
302  reuse = cu_dereference_protected() - fetch RCU pointer when updates prevented*@p: The pointer to read, prior to dereferencing*@c: The conditions under which the dereference will take place* Return the value of the specified RCU-protected pointer, but omit(sk_reuseport_cb, lockdep_is_held( & reuseport_lock))
304  err = reuseport_array_update_check(array, nsk, osk, reuse, map_flags)
305  If err Then Go to put_file_unlock
309  err = reuseport_get_id(reuse)
310  If err < 0 Then Go to put_file_unlock
313  WRITE_ONCE(sk_user_data, & ptrs[index])
314  cu_assign_pointer() - assign to RCU-protected pointer*@p: pointer to assign to*@v: value to assign (publish)* Assigns the specified value to the specified RCU-protected* pointer, ensuring that any concurrent RCU readers will see* any prior initialization(ptrs[index], nsk)
315  free_osk = osk
316  err = 0
318  put_file_unlock :
319  write_unlock_bh( & sk_callback_lock)
321  If free_osk Then
322  write_lock_bh( & sk_callback_lock)
323  WRITE_ONCE(sk_user_data, NULL)
324  write_unlock_bh( & sk_callback_lock)
327  spin_unlock_bh( & reuseport_lock)
328  put_file :
329  fput(file)
330  Return err
Caller
NameDescribe
map_update_elem