|
8 | 8 |
|
9 | 9 | #include <linux/skbuff.h> /* skb_shared_info */ |
10 | 10 | #include <uapi/linux/netdev.h> |
| 11 | +#include <linux/bitfield.h> |
11 | 12 |
|
12 | 13 | /** |
13 | 14 | * DOC: XDP RX-queue information |
@@ -425,6 +426,50 @@ XDP_METADATA_KFUNC_xxx |
425 | 426 | MAX_XDP_METADATA_KFUNC, |
426 | 427 | }; |
427 | 428 |
|
| 429 | +enum xdp_rss_hash_type { |
| 430 | + /* First part: Individual bits for L3/L4 types */ |
| 431 | + XDP_RSS_L3_IPV4 = BIT(0), |
| 432 | + XDP_RSS_L3_IPV6 = BIT(1), |
| 433 | + |
| 434 | + /* The fixed (L3) IPv4 and IPv6 headers can both be followed by |
| 435 | + * variable/dynamic headers, IPv4 called Options and IPv6 called |
| 436 | + * Extension Headers. HW RSS type can contain this info. |
| 437 | + */ |
| 438 | + XDP_RSS_L3_DYNHDR = BIT(2), |
| 439 | + |
| 440 | + /* When RSS hash covers L4 then drivers MUST set XDP_RSS_L4 bit in |
| 441 | + * addition to the protocol specific bit. This ease interaction with |
| 442 | + * SKBs and avoids reserving a fixed mask for future L4 protocol bits. |
| 443 | + */ |
| 444 | + XDP_RSS_L4 = BIT(3), /* L4 based hash, proto can be unknown */ |
| 445 | + XDP_RSS_L4_TCP = BIT(4), |
| 446 | + XDP_RSS_L4_UDP = BIT(5), |
| 447 | + XDP_RSS_L4_SCTP = BIT(6), |
| 448 | + XDP_RSS_L4_IPSEC = BIT(7), /* L4 based hash include IPSEC SPI */ |
| 449 | + |
| 450 | + /* Second part: RSS hash type combinations used for driver HW mapping */ |
| 451 | + XDP_RSS_TYPE_NONE = 0, |
| 452 | + XDP_RSS_TYPE_L2 = XDP_RSS_TYPE_NONE, |
| 453 | + |
| 454 | + XDP_RSS_TYPE_L3_IPV4 = XDP_RSS_L3_IPV4, |
| 455 | + XDP_RSS_TYPE_L3_IPV6 = XDP_RSS_L3_IPV6, |
| 456 | + XDP_RSS_TYPE_L3_IPV4_OPT = XDP_RSS_L3_IPV4 | XDP_RSS_L3_DYNHDR, |
| 457 | + XDP_RSS_TYPE_L3_IPV6_EX = XDP_RSS_L3_IPV6 | XDP_RSS_L3_DYNHDR, |
| 458 | + |
| 459 | + XDP_RSS_TYPE_L4_ANY = XDP_RSS_L4, |
| 460 | + XDP_RSS_TYPE_L4_IPV4_TCP = XDP_RSS_L3_IPV4 | XDP_RSS_L4 | XDP_RSS_L4_TCP, |
| 461 | + XDP_RSS_TYPE_L4_IPV4_UDP = XDP_RSS_L3_IPV4 | XDP_RSS_L4 | XDP_RSS_L4_UDP, |
| 462 | + XDP_RSS_TYPE_L4_IPV4_SCTP = XDP_RSS_L3_IPV4 | XDP_RSS_L4 | XDP_RSS_L4_SCTP, |
| 463 | + |
| 464 | + XDP_RSS_TYPE_L4_IPV6_TCP = XDP_RSS_L3_IPV6 | XDP_RSS_L4 | XDP_RSS_L4_TCP, |
| 465 | + XDP_RSS_TYPE_L4_IPV6_UDP = XDP_RSS_L3_IPV6 | XDP_RSS_L4 | XDP_RSS_L4_UDP, |
| 466 | + XDP_RSS_TYPE_L4_IPV6_SCTP = XDP_RSS_L3_IPV6 | XDP_RSS_L4 | XDP_RSS_L4_SCTP, |
| 467 | + |
| 468 | + XDP_RSS_TYPE_L4_IPV6_TCP_EX = XDP_RSS_TYPE_L4_IPV6_TCP | XDP_RSS_L3_DYNHDR, |
| 469 | + XDP_RSS_TYPE_L4_IPV6_UDP_EX = XDP_RSS_TYPE_L4_IPV6_UDP | XDP_RSS_L3_DYNHDR, |
| 470 | + XDP_RSS_TYPE_L4_IPV6_SCTP_EX = XDP_RSS_TYPE_L4_IPV6_SCTP | XDP_RSS_L3_DYNHDR, |
| 471 | +}; |
| 472 | + |
428 | 473 | #ifdef CONFIG_NET |
429 | 474 | u32 bpf_xdp_metadata_kfunc_id(int id); |
430 | 475 | bool bpf_dev_bound_kfunc_id(u32 btf_id); |
|
0 commit comments