Function report

Linux Kernel

v5.5.9

Brick Technologies Co., Ltd

Source Code:lib\test_bpf.c Create Date:2022-07-28 06:27:51
Last Modify:2020-03-12 14:18:49 Copyright©Brick
home page Tree
Annotation kernel can get tool activityDownload SCCTChinese

Name:generate_filter

Proto:static struct bpf_prog *generate_filter(int which, int *err)

Type:struct bpf_prog

Parameter:

TypeParameterName
intwhich
int *err
6580  test_type = aux & TEST_TYPE_MASK
6581  flen = filter_length(which)
6582  fptr = filter_pointer(which)
6587  Case test_type == CLASSIC
6588  filter = fptr
6589  len = flen
6591  err = bpf_prog_create( & fp, & fprog)
6592  If aux & FLAG_EXPECTED_FAIL Then
6598  Else
6607  If err Then
6610  Return NULL
6612  Break
6614  Case test_type == INTERNAL
6615  fp = bpf_prog_alloc(bpf_prog_size(flen), 0)
6616  If (fp == NULL) Then
6618  err = -ENOMEM
6619  Return NULL
6622  Number of filter blocks = flen
6624  Type of BPF program = BPF_PROG_TYPE_SOCKET_FILTER
6625  No 3D Now!(insnsi, fptr, Number of filter blocks * sizeof(structbpf_insn))
6626  stack_depth = for eBPF only, since tests don't call verifier
6631  fp = pf_prog_select_runtime - select exec runtime for BPF program*@fp: bpf_prog populated with internal BPF program*@err: pointer to error variable* Try to JIT eBPF program, if JIT is not available, use interpreter.
6632  If err Then
6634  Return NULL
6636  Break
6639  err = 0
6640  Return fp
Caller
NameDescribe
test_bpf