History

bpf: add bpf_set_hash helper for tc progs

Allow for tc BPF programs to set a skb->hash, apart from clearing and triggering a recalc that we have right now. It allows for BPF to implement a custom hashing routine for skb_get_hash().

Daniel Borkmann committed 9 years ago

Commit ded092c1 parent 966789f3 files · +34 −2Browse files

Showing the changes to include/uapi/linux (1 of 3 files). Show all

Unified · Split

include/uapi/linux/bpf.h+7−1
@@ -513,6 +513,11 @@ union bpf_attr { · 512 unmodified lines
513 * Get the owner uid of the socket stored inside sk_buff.513 * Get the owner uid of the socket stored inside sk_buff.
514 * @skb: pointer to skb514 * @skb: pointer to skb
515 * Return: uid of the socket owner on success or overflowuid if failed.515 * Return: uid of the socket owner on success or overflowuid if failed.
516 *
517 * u32 bpf_set_hash(skb, hash)
518 * Set full skb->hash.
519 * @skb: pointer to skb
520 * @hash: hash to set
516 */521 */
517#define __BPF_FUNC_MAPPER(FN) \522#define __BPF_FUNC_MAPPER(FN) \
518 FN(unspec), \523 FN(unspec), \
@@ -562,7 +567,8 @@ union bpf_attr { · 43 unmodified lines
562 FN(xdp_adjust_head), \567 FN(xdp_adjust_head), \
563 FN(probe_read_str), \568 FN(probe_read_str), \
564 FN(get_socket_cookie), \569 FN(get_socket_cookie), \
565 FN(get_socket_uid),570 FN(get_socket_uid), \
571 FN(set_hash),
566 572
567/* integer value in 'imm' field of BPF_CALL instruction selects which helper573/* integer value in 'imm' field of BPF_CALL instruction selects which helper
568 * function eBPF program intends to call574 * function eBPF program intends to call