Function report

Linux Kernel

v5.5.9

Brick Technologies Co., Ltd

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

Name:bpf_prog_offload_init

Proto:int bpf_prog_offload_init(struct bpf_prog *prog, union bpf_attr *attr)

Type:int

Parameter:

TypeParameterName
struct bpf_prog *prog
union bpf_attr *attr
86  If one of enum bpf_prog_type != BPF_PROG_TYPE_SCHED_CLS && one of enum bpf_prog_type != BPF_PROG_TYPE_XDP Then Return -EINVAL
90  If prog_flags Then Return -EINVAL
93  offload = 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).
94  If Not offload Then Return -ENOMEM
97  prog = prog
99  netdev = find a device by its ifindex
101  err = bpf_dev_offload_check(netdev)
102  If err Then Go to err_maybe_put
105  lock for writing
106  ondev = bpf_offload_find_netdev(netdev)
107  If Not ondev Then
108  err = -EINVAL
109  Go to err_unlock
111  offdev = offdev
112  offload = offload
113  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.
114  dev_put - release reference to device*@dev: network device* Release reference to device to allow it to be freed.
115  lease a write lock
117  Return 0
118  err_unlock :
119  lease a write lock
120  err_maybe_put :
121  If netdev Then dev_put - release reference to device*@dev: network device* Release reference to device to allow it to be freed.
123  kfree(offload)
124  Return err
Caller
NameDescribe
bpf_prog_load