函数逻辑报告

Linux Kernel

v5.5.9

Brick Technologies Co., Ltd

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

函数名称:longest_prefix_match() - determine the longest prefix*@trie: The trie to get internal sizes from*@node: The node to operate on*@key: The key to compare to @node* Determine the longest prefix of @node that matches the bits in @key.

函数原型:static size_t longest_prefix_match(const struct lpm_trie *trie, const struct lpm_trie_node *node, const struct bpf_lpm_trie_key *key)

返回类型:size_t

参数:

类型参数名称
const struct lpm_trie *trie
const struct lpm_trie_node *node
const struct bpf_lpm_trie_key *key
168  limit等于两数取小(prefixlen, up to 32 for AF_INET, 128 for AF_INET6 )
169  prefixlen等于0, i等于0
171  BUILD_BUG_ON - break compile if a condition is true(offsetof(structlpm_trie_node, data) % sizeof(u32))
172  BUILD_BUG_ON - break compile if a condition is true(offsetof(structbpf_lpm_trie_key, data) % sizeof(u32))
192 data_size大于等于i加4循环
193  diff等于be32_to_cpu( * (__be32 * ) & data[i] ^ * (__be32 * ) & Arbitrary size [i])
196  prefixlen加等于32减ls - find last set bit in word*@x: the word to search* This is defined in a similar way as the libc and compiler builtin* ffs, but returns the position of the most significant set bit.* fls(value) returns 0 if value is 0 or the position of the last
197  如果prefixlen大于等于limit则返回:limit
199  如果diff则返回:prefixlen
201  i加等于4
204  如果data_size大于等于i加2则
205  diff等于be16_to_cpu( * (__be16 * ) & data[i] ^ * (__be16 * ) & Arbitrary size [i])
208  prefixlen加等于16减ls - find last set bit in word*@x: the word to search* This is defined in a similar way as the libc and compiler builtin* ffs, but returns the position of the most significant set bit.* fls(value) returns 0 if value is 0 or the position of the last
209  如果prefixlen大于等于limit则返回:limit
211  如果diff则返回:prefixlen
213  i加等于2
216  如果data_size大于等于i加1则
217  prefixlen加等于8减ls - find last set bit in word*@x: the word to search* This is defined in a similar way as the libc and compiler builtin* ffs, but returns the position of the most significant set bit.* fls(value) returns 0 if value is 0 or the position of the last
219  如果prefixlen大于等于limit则返回:limit
223  返回:prefixlen
调用者
名称描述
trie_lookup_elemCalled from syscall or from eBPF program
trie_update_elemCalled from syscall or from eBPF program
trie_delete_elemCalled from syscall or from eBPF program
trie_get_next_key