函数逻辑报告

Linux Kernel

v5.5.9

Brick Technologies Co., Ltd

Source Code:kernel\bpf\devmap.c Create Date:2022-07-27 14:40:18
Last Modify:2020-03-12 14:18:49 Copyright©Brick
首页 函数Tree
注解内核,赢得工具下载SCCTEnglish

函数名称:__dev_map_hash_update_elem

函数原型:static int __dev_map_hash_update_elem(struct net *net, struct bpf_map *map, void *key, void *value, u64 map_flags)

返回类型:int

参数:

类型参数名称
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  如果此条件成立可能性小(为编译器优化)(map_flags > update existing element || !ifindex)则返回:负EINVAL
677  spin_lock_irqsave( & index_lock, flags)
679  old_dev等于__dev_map_hash_lookup_elem(map, idx)
680  如果old_devmap_flags按位与create new element if it didn't exist 则转到:out_err
683  dev等于__dev_map_alloc_node(net, dtab, ifindex, idx)
684  如果是错误
685  err等于错误
686  转到:out_err
689  如果old_dev
690  删除哈希表中无需重新初始化的条目
691  否则
692  如果items大于等于max_entries
695  返回:负E2BIG
697  items自加
700  添加哈希记录
702  spin_unlock_irqrestore( & index_lock, flags)
704  如果old_devall_rcu() - Queue an RCU callback for invocation after a grace period
707  返回:0
709  out_err :
710  spin_unlock_irqrestore( & index_lock, flags)
711  返回:err
调用者
名称描述
dev_map_hash_update_elem