mirror of
https://gitee.com/bianbu-linux/linux-6.6
synced 2025-07-08 00:23:23 -04:00
bpf: add bpf_get_hash_recalc helper
If skb_clear_hash() was invoked due to mangling of relevant headers and BPF program needs skb->hash later on, we can add a helper to trigger hash recalculation via bpf_get_hash_recalc(). The helper will return the newly retrieved hash directly, but later access can also be done via skb context again through skb->hash directly (inline) without needing to call the helper once more. Signed-off-by: Daniel Borkmann <daniel@iogearbox.net> Acked-by: Alexei Starovoitov <ast@kernel.org> Signed-off-by: David S. Miller <davem@davemloft.net>
This commit is contained in:
parent
6fd980ac39
commit
13c5c240f7
2 changed files with 28 additions and 0 deletions
|
@ -348,6 +348,15 @@ enum bpf_func_id {
|
|||
* < 0 error
|
||||
*/
|
||||
BPF_FUNC_skb_in_cgroup,
|
||||
|
||||
/**
|
||||
* bpf_get_hash_recalc(skb)
|
||||
* Retrieve and possibly recalculate skb->hash.
|
||||
* @skb: pointer to skb
|
||||
* Return: hash
|
||||
*/
|
||||
BPF_FUNC_get_hash_recalc,
|
||||
|
||||
__BPF_FUNC_MAX_ID,
|
||||
};
|
||||
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue