Function report

Linux Kernel

v5.5.9

Brick Technologies Co., Ltd

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

Name:xsk_map_alloc

Proto:static struct bpf_map *xsk_map_alloc(union bpf_attr *attr)

Type:struct bpf_map

Parameter:

TypeParameterName
union bpf_attr *attr
79  If Not Check operation authority Then Return ERR_PTR( - EPERM)
82  If max number of entries in a map == 0 || size of key in bytes != 4 || size of value in bytes != 4 || BPF_MAP_CREATE related * flags defined above. & ~( Specify numa node during map creation | Flags for accessing BPF object from syscall side. | BPF_F_WRONLY) Then Return ERR_PTR( - EINVAL)
87  numa_node = bpf_map_attr_numa_node(attr)
88  size = struct_size() - Calculate size of structure with trailing array.*@p: Pointer to the structure.*@member: Name of the array member.*@n: Number of elements in the array.* Calculates size of memory needed for structure @p followed by an(m, xsk_map, max number of entries in a map )
89  cost = size + array_size() - Calculate size of 2-dimensional array.*@a: dimension one*@b: dimension two* Calculates size of 2-dimensional array: @a *@b.* Returns: number of bytes needed to represent the array or SIZE_MAX on* overflow.
91  err = bpf_map_charge_init( & mem, cost)
92  If err < 0 Then Return ERR_PTR(err)
95  m = bpf_map_area_alloc(size, numa_node)
96  If Not m Then
97  bpf_map_charge_finish( & mem)
98  Return ERR_PTR( - ENOMEM)
101  bpf_map_init_from_attr( & map, attr)
102  bpf_map_charge_move( & memory, & mem)
103  Process spin lock initialization( & Synchronize map updates )
105  flush_list = alloc_percpu(structlist_head)
106  If Not flush_list Then
107  bpf_map_charge_finish( & memory)
108  bpf_map_area_free(m)
109  Return ERR_PTR( - ENOMEM)
112  for_each_possible_cpu(cpu)
113  Initialization list head
115  Return map