Function report

Linux Kernel

v5.5.9

Brick Technologies Co., Ltd

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

Name:bpf_map_offload_map_alloc

Proto:struct bpf_map *bpf_map_offload_map_alloc(union bpf_attr *attr)

Type:struct bpf_map

Parameter:

TypeParameterName
union bpf_attr *attr
364  net = net_ns
369  If Not Check operation authority Then Return ERR_PTR( - EPERM)
371  If one of enum bpf_map_type != BPF_MAP_TYPE_ARRAY && one of enum bpf_map_type != BPF_MAP_TYPE_HASH Then Return ERR_PTR( - EINVAL)
375  offmap = kzalloc - allocate memory. The memory is set to zero.*@size: how many bytes of memory are required.*@flags: the type of memory to allocate (see kmalloc).
376  If Not offmap Then Return ERR_PTR( - ENOMEM)
379  bpf_map_init_from_attr( & map, attr)
381  RTNL is used as a global lock for all changes to network configuration
382  lock for writing
383  netdev = find a device by its ifindex
384  err = bpf_dev_offload_check(netdev)
385  If err Then Go to err_unlock
388  ondev = bpf_offload_find_netdev(netdev)
389  If Not ondev Then
390  err = -EINVAL
391  Go to err_unlock
394  err = bpf_map_offload_ndo(offmap, BPF_OFFLOAD_MAP_ALLOC)
395  If err Then Go to err_unlock
398  list_add_tail - add a new entry*@new: new entry to be added*@head: list head to add it before* Insert a new entry before the specified head.* This is useful for implementing queues.
399  lease a write lock
400  rtnl_unlock()
402  Return map
404  err_unlock :
405  lease a write lock
406  rtnl_unlock()
407  kfree(offmap)
408  Return ERR_PTR(err)