Function report

Linux Kernel

v5.5.9

Brick Technologies Co., Ltd

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

Name:__dev_map_hash_update_elem

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

Type:int

Parameter:

TypeParameterName
struct net *net
struct bpf_map *map
void *key
void *value
u64map_flags
667  dtab = 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_dtab, map)
669  ifindex = value
670  idx = key
672  err = -EEXIST
674  If Value for the false possibility is greater at compile time(map_flags > update existing element || !ifindex) Then Return -EINVAL
677  spin_lock_irqsave( & index_lock, flags)
679  old_dev = __dev_map_hash_lookup_elem(map, idx)
680  If old_dev && map_flags & create new element if it didn't exist Then Go to out_err
683  dev = __dev_map_alloc_node(net, dtab, ifindex, idx)
684  If IS_ERR(dev) Then
685  err = PTR_ERR(dev)
686  Go to out_err
689  If old_dev Then
690  hlist_del_rcu - deletes entry from hash list without re-initialization*@n: the element to delete from the hash list.* Note: list_unhashed() on entry does not return true after this,* the entry is in an undefined state. It is useful for RCU based
691  Else
692  If items >= max_entries Then
695  Return -E2BIG
697  items++
700  adds the specified element to the specified hlist
702  spin_unlock_irqrestore( & index_lock, flags)
704  If old_dev Then all_rcu() - Queue an RCU callback for invocation after a grace period
707  Return 0
709  out_err :
710  spin_unlock_irqrestore( & index_lock, flags)
711  Return err
Caller
NameDescribe
dev_map_hash_update_elem