Function report

Linux Kernel

v5.5.9

Brick Technologies Co., Ltd

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

Name:Called from syscall or from eBPF program

Proto:static int trie_delete_elem(struct bpf_map *map, void *_key)

Type:int

Parameter:

TypeParameterName
struct bpf_map *map
void *_key
433  trie = 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, structlpm_trie, map)
434  key = _key
435  __rcu * trim
439  matchlen = 0
440  ret = 0
442  If up to 32 for AF_INET, 128 for AF_INET6 > max_prefixlen Then Return -EINVAL
445  raw_spin_lock_irqsave( & lock, irq_flags)
453  trim = root
454  trim2 = trim
455  parent = NULL
456  When node = 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( * trim, lockdep_is_held( & lock)) cycle
458  matchlen = longest_prefix_match() - determine the longest prefix*@trie: The trie to get internal sizes from*@node: The node to operate on*@key: The key to compare to @node* Determine the longest prefix of @node that matches the bits in @key.
460  If prefixlen != matchlen || prefixlen == up to 32 for AF_INET, 128 for AF_INET6 Then Break
464  parent = node
465  trim2 = trim
466  next_bit = This trie implements a longest prefix match algorithm that can be used to* match IP addresses to a stored set of ranges.* Data stored in @data of struct bpf_lpm_key and struct lpm_trie_node is
467  trim = child[next_bit]
470  If Not node || prefixlen != up to 32 for AF_INET, 128 for AF_INET6 || prefixlen != matchlen || flags & Intermediate node Then
473  ret = -ENOENT
474  Go to out
477  n_entries--
482  If 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(child[0]) && 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(child[1]) Then
484  flags |= Intermediate node
485  Go to out
495  If parent && flags & Intermediate node && Not child[0] && Not child[1] Then
497  If node == 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(child[0]) Then 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( * trim2, 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(child[1]))
500  Else 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( * trim2, 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(child[0]))
503  kfree_rcu() - kfree an object after a grace period(parent, rcu)
504  kfree_rcu() - kfree an object after a grace period(node, rcu)
505  Go to out
512  If child[0] Then 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( * trim, 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(child[0]))
514  Else if child[1] Then 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( * trim, 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(child[1]))
516  Else RCU_INIT_POINTER() - initialize an RCU protected pointer*@p: The pointer to be initialized.*@v: The value to initialized the pointer to.* Initialize an RCU-protected pointer in special cases where readers( * trim, NULL)
518  kfree_rcu() - kfree an object after a grace period(node, rcu)
520  out :
521  raw_spin_unlock_irqrestore( & lock, irq_flags)
523  Return ret