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().
Showing the changes to include/uapi/linux (1 of 3 files). Show all
Unified · Split
| @@ -513,6 +513,11 @@ union bpf_attr { · 512 unmodified lines | ||
| 513 | 513 | * Get the owner uid of the socket stored inside sk_buff. |
| 514 | 514 | * @skb: pointer to skb |
| 515 | 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 | 522 | #define __BPF_FUNC_MAPPER(FN) \ |
| 518 | 523 | FN(unspec), \ |
| @@ -562,7 +567,8 @@ union bpf_attr { · 43 unmodified lines | ||
| 562 | 567 | FN(xdp_adjust_head), \ |
| 563 | 568 | FN(probe_read_str), \ |
| 564 | 569 | FN(get_socket_cookie), \ |
| 565 | − FN(get_socket_uid), | |
| 570 | + FN(get_socket_uid), \ | |
| 571 | + FN(set_hash), | |
| 566 | 572 | |
| 567 | 573 | /* integer value in 'imm' field of BPF_CALL instruction selects which helper |
| 568 | 574 | * function eBPF program intends to call |