Pull networking updates from David Miller: "Highlights: 1) Support AES128-CCM ciphers in kTLS, from Vakul Garg. 2) Add fib_sync_mem to control the amount of dirty memory we allow to queue up between synchronize RCU calls, from David Ahern. 3) Make flow classifier more lockless, from Vlad Buslov. 4) Add PHY downshift support to aquantia driver, from Heiner Kallweit. 5) Add SKB cache for TCP rx and tx, from Eric Dumazet. This reduces contention on SLAB spinlocks in heavy RPC workloads. 6) Partial GSO offload support in XFRM, from Boris Pismenny. 7) Add fast link down support to ethtool, from Heiner Kallweit. 8) Use siphash for IP ID generator, from Eric Dumazet. 9) Pull nexthops even further out from ipv4/ipv6 routes and FIB entries, from David Ahern. 10) Move skb->xmit_more into a per-cpu variable, from Florian Westphal. 11) Improve eBPF verifier speed and increase maximum program size, from Alexei Starovoitov. 12) Eliminate per-bucket spinlocks in rhashtable, and instead use bit spinlocks. From Neil Brown. 13) Allow tunneling with GUE encap in ipvs, from Jacky Hu. 14) Improve link partner cap detection in generic PHY code, from Heiner Kallweit. 15) Add layer 2 encap support to bpf_skb_adjust_room(), from Alan Maguire. 16) Remove SKB list implementation assumptions in SCTP, your's truly. 17) Various cleanups, optimizations, and simplifications in r8169 driver. From Heiner Kallweit. 18) Add memory accounting on TX and RX path of SCTP, from Xin Long. 19) Switch PHY drivers over to use dynamic featue detection, from Heiner Kallweit. 20) Support flow steering without masking in dpaa2-eth, from Ioana Ciocoi. 21) Implement ndo_get_devlink_port in netdevsim driver, from Jiri Pirko. 22) Increase the strict parsing of current and future netlink attributes, also export such policies to userspace. From Johannes Berg. 23) Allow DSA tag drivers to be modular, from Andrew Lunn. 24) Remove legacy DSA probing support, also from Andrew Lunn. 25) Allow ll_temac driver to be used on non-x86 platforms, from Esben Haabendal. 26) Add a generic tracepoint for TX queue timeouts to ease debugging, from Cong Wang. 27) More indirect call optimizations, from Paolo Abeni" * git://git.kernel.org/pub/scm/linux/kernel/git/davem/net-next: (1763 commits) cxgb4: Fix error path in cxgb4_init_module net: phy: improve pause mode reporting in phy_print_status dt-bindings: net: Fix a typo in the phy-mode list for ethernet bindings net: macb: Change interrupt and napi enable order in open net: ll_temac: Improve error message on error IRQ net/sched: remove block pointer from common offload structure net: ethernet: support of_get_mac_address new ERR_PTR error net: usb: smsc: fix warning reported by kbuild test robot staging: octeon-ethernet: Fix of_get_mac_address ERR_PTR check net: dsa: support of_get_mac_address new ERR_PTR error net: dsa: sja1105: Fix status initialization in sja1105_get_ethtool_stats vrf: sit mtu should not be updated when vrf netdev is the link net: dsa: Fix error cleanup path in dsa_init_module l2tp: Fix possible NULL pointer dereference taprio: add null check on sched_nest to avoid potential null pointer dereference net: mvpp2: cls: fix less than zero check on a u32 variable net_sched: sch_fq: handle non connected flows net_sched: sch_fq: do not assume EDT packets are ordered net: hns3: use devm_kcalloc when allocating desc_cb net: hns3: some cleanup for struct hns3_enet_ring ...
Showing the changes to include/linux (46 of 1636 files). Show all
Unified · Split
| @@ -17,6 +17,8 @@ struct bpf_map; · 16 unmodified lines | |||
| 17 | struct bpf_prog; | 17 | struct bpf_prog; |
| 18 | struct bpf_sock_ops_kern; | 18 | struct bpf_sock_ops_kern; |
| 19 | struct bpf_cgroup_storage; | 19 | struct bpf_cgroup_storage; |
| 20 | struct ctl_table; | ||
| 21 | struct ctl_table_header; | ||
| 20 | 22 | ||
| 21 | #ifdef CONFIG_CGROUP_BPF | 23 | #ifdef CONFIG_CGROUP_BPF |
| 22 | 24 | ||
| @@ -109,6 +111,12 @@ int __cgroup_bpf_run_filter_sock_ops(struct sock *sk, · 86 unmodified lines | |||
| 109 | int __cgroup_bpf_check_dev_permission(short dev_type, u32 major, u32 minor, | 111 | int __cgroup_bpf_check_dev_permission(short dev_type, u32 major, u32 minor, |
| 110 | short access, enum bpf_attach_type type); | 112 | short access, enum bpf_attach_type type); |
| 111 | 113 | ||
| 114 | int __cgroup_bpf_run_filter_sysctl(struct ctl_table_header *head, | ||
| 115 | struct ctl_table *table, int write, | ||
| 116 | void __user *buf, size_t *pcount, | ||
| 117 | loff_t *ppos, void **new_buf, | ||
| 118 | enum bpf_attach_type type); | ||
| 119 | |||
| 112 | static inline enum bpf_cgroup_storage_type cgroup_storage_type( | 120 | static inline enum bpf_cgroup_storage_type cgroup_storage_type( |
| 113 | struct bpf_map *map) | 121 | struct bpf_map *map) |
| 114 | { | 122 | { |
| @@ -253,6 +261,18 @@ int bpf_percpu_cgroup_storage_update(struct bpf_map *map, void *key, · 138 unmodified lines | |||
| 253 | \ | 261 | \ |
| 254 | __ret; \ | 262 | __ret; \ |
| 255 | }) | 263 | }) |
| 264 | |||
| 265 | |||
| 266 | #define BPF_CGROUP_RUN_PROG_SYSCTL(head, table, write, buf, count, pos, nbuf) \ | ||
| 267 | ({ \ | ||
| 268 | int __ret = 0; \ | ||
| 269 | if (cgroup_bpf_enabled) \ | ||
| 270 | __ret = __cgroup_bpf_run_filter_sysctl(head, table, write, \ | ||
| 271 | buf, count, pos, nbuf, \ | ||
| 272 | BPF_CGROUP_SYSCTL); \ | ||
| 273 | __ret; \ | ||
| 274 | }) | ||
| 275 | |||
| 256 | int cgroup_bpf_prog_attach(const union bpf_attr *attr, | 276 | int cgroup_bpf_prog_attach(const union bpf_attr *attr, |
| 257 | enum bpf_prog_type ptype, struct bpf_prog *prog); | 277 | enum bpf_prog_type ptype, struct bpf_prog *prog); |
| 258 | int cgroup_bpf_prog_detach(const union bpf_attr *attr, | 278 | int cgroup_bpf_prog_detach(const union bpf_attr *attr, |
| @@ -321,6 +341,7 @@ static inline int bpf_percpu_cgroup_storage_update(struct bpf_map *map, · 62 unmodified lines | |||
| 321 | #define BPF_CGROUP_RUN_PROG_UDP6_SENDMSG_LOCK(sk, uaddr, t_ctx) ({ 0; }) | 341 | #define BPF_CGROUP_RUN_PROG_UDP6_SENDMSG_LOCK(sk, uaddr, t_ctx) ({ 0; }) |
| 322 | #define BPF_CGROUP_RUN_PROG_SOCK_OPS(sock_ops) ({ 0; }) | 342 | #define BPF_CGROUP_RUN_PROG_SOCK_OPS(sock_ops) ({ 0; }) |
| 323 | #define BPF_CGROUP_RUN_PROG_DEVICE_CGROUP(type,major,minor,access) ({ 0; }) | 343 | #define BPF_CGROUP_RUN_PROG_DEVICE_CGROUP(type,major,minor,access) ({ 0; }) |
| 344 | #define BPF_CGROUP_RUN_PROG_SYSCTL(head,table,write,buf,count,pos,nbuf) ({ 0; }) | ||
| 324 | 345 | ||
| 325 | #define for_each_cgroup_storage_type(stype) for (; false; ) | 346 | #define for_each_cgroup_storage_type(stype) for (; false; ) |
| 326 | 347 | ||
| @@ -57,6 +57,12 @@ struct bpf_map_ops { · 56 unmodified lines | |||
| 57 | const struct btf *btf, | 57 | const struct btf *btf, |
| 58 | const struct btf_type *key_type, | 58 | const struct btf_type *key_type, |
| 59 | const struct btf_type *value_type); | 59 | const struct btf_type *value_type); |
| 60 | |||
| 61 | /* Direct value access helpers. */ | ||
| 62 | int (*map_direct_value_addr)(const struct bpf_map *map, | ||
| 63 | u64 *imm, u32 off); | ||
| 64 | int (*map_direct_value_meta)(const struct bpf_map *map, | ||
| 65 | u64 imm, u32 *off); | ||
| 60 | }; | 66 | }; |
| 61 | 67 | ||
| 62 | struct bpf_map { | 68 | struct bpf_map { |
| @@ -81,7 +87,8 @@ struct bpf_map { · 18 unmodified lines | |||
| 81 | struct btf *btf; | 87 | struct btf *btf; |
| 82 | u32 pages; | 88 | u32 pages; |
| 83 | bool unpriv_array; | 89 | bool unpriv_array; |
| 84 | /* 51 bytes hole */ | 90 | bool frozen; /* write-once */ |
| 91 | /* 48 bytes hole */ | ||
| 85 | 92 | ||
| 86 | /* The 3rd and 4th cacheline with misc members to avoid false sharing | 93 | /* The 3rd and 4th cacheline with misc members to avoid false sharing |
| 87 | * particularly with refcounting. | 94 | * particularly with refcounting. |
| @@ -177,6 +184,7 @@ enum bpf_arg_type { · 89 unmodified lines | |||
| 177 | ARG_PTR_TO_MAP_KEY, /* pointer to stack used as map key */ | 184 | ARG_PTR_TO_MAP_KEY, /* pointer to stack used as map key */ |
| 178 | ARG_PTR_TO_MAP_VALUE, /* pointer to stack used as map value */ | 185 | ARG_PTR_TO_MAP_VALUE, /* pointer to stack used as map value */ |
| 179 | ARG_PTR_TO_UNINIT_MAP_VALUE, /* pointer to valid memory used to store a map value */ | 186 | ARG_PTR_TO_UNINIT_MAP_VALUE, /* pointer to valid memory used to store a map value */ |
| 187 | ARG_PTR_TO_MAP_VALUE_OR_NULL, /* pointer to stack used as map value or NULL */ | ||
| 180 | 188 | ||
| 181 | /* the following constraints used to prototype bpf_memcmp() and other | 189 | /* the following constraints used to prototype bpf_memcmp() and other |
| 182 | * functions that access data on eBPF program stack | 190 | * functions that access data on eBPF program stack |
| @@ -195,6 +203,9 @@ enum bpf_arg_type { · 12 unmodified lines | |||
| 195 | ARG_ANYTHING, /* any (initialized) argument is ok */ | 203 | ARG_ANYTHING, /* any (initialized) argument is ok */ |
| 196 | ARG_PTR_TO_SPIN_LOCK, /* pointer to bpf_spin_lock */ | 204 | ARG_PTR_TO_SPIN_LOCK, /* pointer to bpf_spin_lock */ |
| 197 | ARG_PTR_TO_SOCK_COMMON, /* pointer to sock_common */ | 205 | ARG_PTR_TO_SOCK_COMMON, /* pointer to sock_common */ |
| 206 | ARG_PTR_TO_INT, /* pointer to int */ | ||
| 207 | ARG_PTR_TO_LONG, /* pointer to long */ | ||
| 208 | ARG_PTR_TO_SOCKET, /* pointer to bpf_sock (fullsock) */ | ||
| 198 | }; | 209 | }; |
| 199 | 210 | ||
| 200 | /* type of values returned from helper functions */ | 211 | /* type of values returned from helper functions */ |
| @@ -205,6 +216,7 @@ enum bpf_return_type { · 4 unmodified lines | |||
| 205 | RET_PTR_TO_MAP_VALUE_OR_NULL, /* returns a pointer to map elem value or NULL */ | 216 | RET_PTR_TO_MAP_VALUE_OR_NULL, /* returns a pointer to map elem value or NULL */ |
| 206 | RET_PTR_TO_SOCKET_OR_NULL, /* returns a pointer to a socket or NULL */ | 217 | RET_PTR_TO_SOCKET_OR_NULL, /* returns a pointer to a socket or NULL */ |
| 207 | RET_PTR_TO_TCP_SOCK_OR_NULL, /* returns a pointer to a tcp_sock or NULL */ | 218 | RET_PTR_TO_TCP_SOCK_OR_NULL, /* returns a pointer to a tcp_sock or NULL */ |
| 219 | RET_PTR_TO_SOCK_COMMON_OR_NULL, /* returns a pointer to a sock_common or NULL */ | ||
| 208 | }; | 220 | }; |
| 209 | 221 | ||
| 210 | /* eBPF function prototype used by verifier to allow BPF_CALLs from eBPF programs | 222 | /* eBPF function prototype used by verifier to allow BPF_CALLs from eBPF programs |
| @@ -262,6 +274,7 @@ enum bpf_reg_type { · 51 unmodified lines | |||
| 262 | PTR_TO_SOCK_COMMON_OR_NULL, /* reg points to sock_common or NULL */ | 274 | PTR_TO_SOCK_COMMON_OR_NULL, /* reg points to sock_common or NULL */ |
| 263 | PTR_TO_TCP_SOCK, /* reg points to struct tcp_sock */ | 275 | PTR_TO_TCP_SOCK, /* reg points to struct tcp_sock */ |
| 264 | PTR_TO_TCP_SOCK_OR_NULL, /* reg points to struct tcp_sock or NULL */ | 276 | PTR_TO_TCP_SOCK_OR_NULL, /* reg points to struct tcp_sock or NULL */ |
| 277 | PTR_TO_TP_BUFFER, /* reg points to a writable raw tp's buffer */ | ||
| 265 | }; | 278 | }; |
| 266 | 279 | ||
| 267 | /* The information passed from prog-specific *_is_valid_access | 280 | /* The information passed from prog-specific *_is_valid_access |
| @@ -351,6 +364,7 @@ struct bpf_prog_aux { · 83 unmodified lines | |||
| 351 | u32 used_map_cnt; | 364 | u32 used_map_cnt; |
| 352 | u32 max_ctx_offset; | 365 | u32 max_ctx_offset; |
| 353 | u32 max_pkt_offset; | 366 | u32 max_pkt_offset; |
| 367 | u32 max_tp_access; | ||
| 354 | u32 stack_depth; | 368 | u32 stack_depth; |
| 355 | u32 id; | 369 | u32 id; |
| 356 | u32 func_cnt; /* used by non-func prog as the number of func progs */ | 370 | u32 func_cnt; /* used by non-func prog as the number of func progs */ |
| @@ -420,8 +434,38 @@ struct bpf_array { · 63 unmodified lines | |||
| 420 | }; | 434 | }; |
| 421 | }; | 435 | }; |
| 422 | 436 | ||
| 437 | #define BPF_COMPLEXITY_LIMIT_INSNS 1000000 /* yes. 1M insns */ | ||
| 423 | #define MAX_TAIL_CALL_CNT 32 | 438 | #define MAX_TAIL_CALL_CNT 32 |
| 424 | 439 | ||
| 440 | #define BPF_F_ACCESS_MASK (BPF_F_RDONLY | \ | ||
| 441 | BPF_F_RDONLY_PROG | \ | ||
| 442 | BPF_F_WRONLY | \ | ||
| 443 | BPF_F_WRONLY_PROG) | ||
| 444 | |||
| 445 | #define BPF_MAP_CAN_READ BIT(0) | ||
| 446 | #define BPF_MAP_CAN_WRITE BIT(1) | ||
| 447 | |||
| 448 | static inline u32 bpf_map_flags_to_cap(struct bpf_map *map) | ||
| 449 | { | ||
| 450 | u32 access_flags = map->map_flags & (BPF_F_RDONLY_PROG | BPF_F_WRONLY_PROG); | ||
| 451 | |||
| 452 | /* Combination of BPF_F_RDONLY_PROG | BPF_F_WRONLY_PROG is | ||
| 453 | * not possible. | ||
| 454 | */ | ||
| 455 | if (access_flags & BPF_F_RDONLY_PROG) | ||
| 456 | return BPF_MAP_CAN_READ; | ||
| 457 | else if (access_flags & BPF_F_WRONLY_PROG) | ||
| 458 | return BPF_MAP_CAN_WRITE; | ||
| 459 | else | ||
| 460 | return BPF_MAP_CAN_READ | BPF_MAP_CAN_WRITE; | ||
| 461 | } | ||
| 462 | |||
| 463 | static inline bool bpf_map_flags_access_ok(u32 access_flags) | ||
| 464 | { | ||
| 465 | return (access_flags & (BPF_F_RDONLY_PROG | BPF_F_WRONLY_PROG)) != | ||
| 466 | (BPF_F_RDONLY_PROG | BPF_F_WRONLY_PROG); | ||
| 467 | } | ||
| 468 | |||
| 425 | struct bpf_event_entry { | 469 | struct bpf_event_entry { |
| 426 | struct perf_event *event; | 470 | struct perf_event *event; |
| 427 | struct file *perf_file; | 471 | struct file *perf_file; |
| @@ -445,14 +489,6 @@ typedef u32 (*bpf_convert_ctx_access_t)(enum bpf_access_type type, · 17 unmodified lines | |||
| 445 | u64 bpf_event_output(struct bpf_map *map, u64 flags, void *meta, u64 meta_size, | 489 | u64 bpf_event_output(struct bpf_map *map, u64 flags, void *meta, u64 meta_size, |
| 446 | void *ctx, u64 ctx_size, bpf_ctx_copy_t ctx_copy); | 490 | void *ctx, u64 ctx_size, bpf_ctx_copy_t ctx_copy); |
| 447 | 491 | ||
| 448 | int bpf_prog_test_run_xdp(struct bpf_prog *prog, const union bpf_attr *kattr, | ||
| 449 | union bpf_attr __user *uattr); | ||
| 450 | int bpf_prog_test_run_skb(struct bpf_prog *prog, const union bpf_attr *kattr, | ||
| 451 | union bpf_attr __user *uattr); | ||
| 452 | int bpf_prog_test_run_flow_dissector(struct bpf_prog *prog, | ||
| 453 | const union bpf_attr *kattr, | ||
| 454 | union bpf_attr __user *uattr); | ||
| 455 | |||
| 456 | /* an array of programs to be executed under rcu_lock. | 492 | /* an array of programs to be executed under rcu_lock. |
| 457 | * | 493 | * |
| 458 | * Typical usage: | 494 | * Typical usage: |
| @@ -643,6 +679,13 @@ static inline int bpf_map_attr_numa_node(const union bpf_attr *attr) · 184 unmodified lines | |||
| 643 | struct bpf_prog *bpf_prog_get_type_path(const char *name, enum bpf_prog_type type); | 679 | struct bpf_prog *bpf_prog_get_type_path(const char *name, enum bpf_prog_type type); |
| 644 | int array_map_alloc_check(union bpf_attr *attr); | 680 | int array_map_alloc_check(union bpf_attr *attr); |
| 645 | 681 | ||
| 682 | int bpf_prog_test_run_xdp(struct bpf_prog *prog, const union bpf_attr *kattr, | ||
| 683 | union bpf_attr __user *uattr); | ||
| 684 | int bpf_prog_test_run_skb(struct bpf_prog *prog, const union bpf_attr *kattr, | ||
| 685 | union bpf_attr __user *uattr); | ||
| 686 | int bpf_prog_test_run_flow_dissector(struct bpf_prog *prog, | ||
| 687 | const union bpf_attr *kattr, | ||
| 688 | union bpf_attr __user *uattr); | ||
| 646 | #else /* !CONFIG_BPF_SYSCALL */ | 689 | #else /* !CONFIG_BPF_SYSCALL */ |
| 647 | static inline struct bpf_prog *bpf_prog_get(u32 ufd) | 690 | static inline struct bpf_prog *bpf_prog_get(u32 ufd) |
| 648 | { | 691 | { |
| @@ -754,6 +797,27 @@ static inline struct bpf_prog *bpf_prog_get_type_path(const char *name, · 105 unmodified lines | |||
| 754 | { | 797 | { |
| 755 | return ERR_PTR(-EOPNOTSUPP); | 798 | return ERR_PTR(-EOPNOTSUPP); |
| 756 | } | 799 | } |
| 800 | |||
| 801 | static inline int bpf_prog_test_run_xdp(struct bpf_prog *prog, | ||
| 802 | const union bpf_attr *kattr, | ||
| 803 | union bpf_attr __user *uattr) | ||
| 804 | { | ||
| 805 | return -ENOTSUPP; | ||
| 806 | } | ||
| 807 | |||
| 808 | static inline int bpf_prog_test_run_skb(struct bpf_prog *prog, | ||
| 809 | const union bpf_attr *kattr, | ||
| 810 | union bpf_attr __user *uattr) | ||
| 811 | { | ||
| 812 | return -ENOTSUPP; | ||
| 813 | } | ||
| 814 | |||
| 815 | static inline int bpf_prog_test_run_flow_dissector(struct bpf_prog *prog, | ||
| 816 | const union bpf_attr *kattr, | ||
| 817 | union bpf_attr __user *uattr) | ||
| 818 | { | ||
| 819 | return -ENOTSUPP; | ||
| 820 | } | ||
| 757 | #endif /* CONFIG_BPF_SYSCALL */ | 821 | #endif /* CONFIG_BPF_SYSCALL */ |
| 758 | 822 | ||
| 759 | static inline struct bpf_prog *bpf_prog_get_type(u32 ufd, | 823 | static inline struct bpf_prog *bpf_prog_get_type(u32 ufd, |
| @@ -929,6 +993,8 @@ extern const struct bpf_func_proto bpf_sk_redirect_map_proto; · 169 unmodified lines | |||
| 929 | extern const struct bpf_func_proto bpf_spin_lock_proto; | 993 | extern const struct bpf_func_proto bpf_spin_lock_proto; |
| 930 | extern const struct bpf_func_proto bpf_spin_unlock_proto; | 994 | extern const struct bpf_func_proto bpf_spin_unlock_proto; |
| 931 | extern const struct bpf_func_proto bpf_get_local_storage_proto; | 995 | extern const struct bpf_func_proto bpf_get_local_storage_proto; |
| 996 | extern const struct bpf_func_proto bpf_strtol_proto; | ||
| 997 | extern const struct bpf_func_proto bpf_strtoul_proto; | ||
| 932 | 998 | ||
| 933 | /* Shared helpers among cBPF and eBPF. */ | 999 | /* Shared helpers among cBPF and eBPF. */ |
| 934 | void bpf_user_rnd_init_once(void); | 1000 | void bpf_user_rnd_init_once(void); |
| @@ -25,9 +25,11 @@ BPF_PROG_TYPE(BPF_PROG_TYPE_KPROBE, kprobe) · 24 unmodified lines | |||
| 25 | BPF_PROG_TYPE(BPF_PROG_TYPE_TRACEPOINT, tracepoint) | 25 | BPF_PROG_TYPE(BPF_PROG_TYPE_TRACEPOINT, tracepoint) |
| 26 | BPF_PROG_TYPE(BPF_PROG_TYPE_PERF_EVENT, perf_event) | 26 | BPF_PROG_TYPE(BPF_PROG_TYPE_PERF_EVENT, perf_event) |
| 27 | BPF_PROG_TYPE(BPF_PROG_TYPE_RAW_TRACEPOINT, raw_tracepoint) | 27 | BPF_PROG_TYPE(BPF_PROG_TYPE_RAW_TRACEPOINT, raw_tracepoint) |
| 28 | BPF_PROG_TYPE(BPF_PROG_TYPE_RAW_TRACEPOINT_WRITABLE, raw_tracepoint_writable) | ||
| 28 | #endif | 29 | #endif |
| 29 | #ifdef CONFIG_CGROUP_BPF | 30 | #ifdef CONFIG_CGROUP_BPF |
| 30 | BPF_PROG_TYPE(BPF_PROG_TYPE_CGROUP_DEVICE, cg_dev) | 31 | BPF_PROG_TYPE(BPF_PROG_TYPE_CGROUP_DEVICE, cg_dev) |
| 32 | BPF_PROG_TYPE(BPF_PROG_TYPE_CGROUP_SYSCTL, cg_sysctl) | ||
| 31 | #endif | 33 | #endif |
| 32 | #ifdef CONFIG_BPF_LIRC_MODE2 | 34 | #ifdef CONFIG_BPF_LIRC_MODE2 |
| 33 | BPF_PROG_TYPE(BPF_PROG_TYPE_LIRC_MODE2, lirc_mode2) | 35 | BPF_PROG_TYPE(BPF_PROG_TYPE_LIRC_MODE2, lirc_mode2) |
| @@ -59,6 +61,7 @@ BPF_MAP_TYPE(BPF_MAP_TYPE_ARRAY_OF_MAPS, array_of_maps_map_ops) · 25 unmodified lines | |||
| 59 | BPF_MAP_TYPE(BPF_MAP_TYPE_HASH_OF_MAPS, htab_of_maps_map_ops) | 61 | BPF_MAP_TYPE(BPF_MAP_TYPE_HASH_OF_MAPS, htab_of_maps_map_ops) |
| 60 | #ifdef CONFIG_NET | 62 | #ifdef CONFIG_NET |
| 61 | BPF_MAP_TYPE(BPF_MAP_TYPE_DEVMAP, dev_map_ops) | 63 | BPF_MAP_TYPE(BPF_MAP_TYPE_DEVMAP, dev_map_ops) |
| 64 | BPF_MAP_TYPE(BPF_MAP_TYPE_SK_STORAGE, sk_storage_map_ops) | ||
| 62 | #if defined(CONFIG_BPF_STREAM_PARSER) | 65 | #if defined(CONFIG_BPF_STREAM_PARSER) |
| 63 | BPF_MAP_TYPE(BPF_MAP_TYPE_SOCKMAP, sock_map_ops) | 66 | BPF_MAP_TYPE(BPF_MAP_TYPE_SOCKMAP, sock_map_ops) |
| 64 | BPF_MAP_TYPE(BPF_MAP_TYPE_SOCKHASH, sock_hash_ops) | 67 | BPF_MAP_TYPE(BPF_MAP_TYPE_SOCKHASH, sock_hash_ops) |
| @@ -207,6 +207,7 @@ struct bpf_verifier_state { · 206 unmodified lines | |||
| 207 | struct bpf_verifier_state_list { | 207 | struct bpf_verifier_state_list { |
| 208 | struct bpf_verifier_state state; | 208 | struct bpf_verifier_state state; |
| 209 | struct bpf_verifier_state_list *next; | 209 | struct bpf_verifier_state_list *next; |
| 210 | int miss_cnt, hit_cnt; | ||
| 210 | }; | 211 | }; |
| 211 | 212 | ||
| 212 | /* Possible states for alu_state member. */ | 213 | /* Possible states for alu_state member. */ |
| @@ -223,6 +224,10 @@ struct bpf_insn_aux_data { · 10 unmodified lines | |||
| 223 | unsigned long map_state; /* pointer/poison value for maps */ | 224 | unsigned long map_state; /* pointer/poison value for maps */ |
| 224 | s32 call_imm; /* saved imm field of call insn */ | 225 | s32 call_imm; /* saved imm field of call insn */ |
| 225 | u32 alu_limit; /* limit for add/sub register with pointer */ | 226 | u32 alu_limit; /* limit for add/sub register with pointer */ |
| 227 | struct { | ||
| 228 | u32 map_index; /* index into used_maps[] */ | ||
| 229 | u32 map_off; /* offset from value base address */ | ||
| 230 | }; | ||
| 226 | }; | 231 | }; |
| 227 | int ctx_field_size; /* the ctx field size for load insn, maybe 0 */ | 232 | int ctx_field_size; /* the ctx field size for load insn, maybe 0 */ |
| 228 | int sanitize_stack_off; /* stack slot to be cleared */ | 233 | int sanitize_stack_off; /* stack slot to be cleared */ |
| @@ -248,6 +253,12 @@ static inline bool bpf_verifier_log_full(const struct bpf_verifier_log *log) · 19 unmodified lines | |||
| 248 | return log->len_used >= log->len_total - 1; | 253 | return log->len_used >= log->len_total - 1; |
| 249 | } | 254 | } |
| 250 | 255 | ||
| 256 | #define BPF_LOG_LEVEL1 1 | ||
| 257 | #define BPF_LOG_LEVEL2 2 | ||
| 258 | #define BPF_LOG_STATS 4 | ||
| 259 | #define BPF_LOG_LEVEL (BPF_LOG_LEVEL1 | BPF_LOG_LEVEL2) | ||
| 260 | #define BPF_LOG_MASK (BPF_LOG_LEVEL | BPF_LOG_STATS) | ||
| 261 | |||
| 251 | static inline bool bpf_verifier_log_needed(const struct bpf_verifier_log *log) | 262 | static inline bool bpf_verifier_log_needed(const struct bpf_verifier_log *log) |
| 252 | { | 263 | { |
| 253 | return log->level && log->ubuf && !bpf_verifier_log_full(log); | 264 | return log->level && log->ubuf && !bpf_verifier_log_full(log); |
| @@ -274,6 +285,7 @@ struct bpf_verifier_env { · 20 unmodified lines | |||
| 274 | bool strict_alignment; /* perform strict pointer alignment checks */ | 285 | bool strict_alignment; /* perform strict pointer alignment checks */ |
| 275 | struct bpf_verifier_state *cur_state; /* current verifier state */ | 286 | struct bpf_verifier_state *cur_state; /* current verifier state */ |
| 276 | struct bpf_verifier_state_list **explored_states; /* search pruning optimization */ | 287 | struct bpf_verifier_state_list **explored_states; /* search pruning optimization */ |
| 288 | struct bpf_verifier_state_list *free_list; | ||
| 277 | struct bpf_map *used_maps[MAX_USED_MAPS]; /* array of map's used by eBPF program */ | 289 | struct bpf_map *used_maps[MAX_USED_MAPS]; /* array of map's used by eBPF program */ |
| 278 | u32 used_map_cnt; /* number of used maps */ | 290 | u32 used_map_cnt; /* number of used maps */ |
| 279 | u32 id_gen; /* used to generate unique reg IDs */ | 291 | u32 id_gen; /* used to generate unique reg IDs */ |
| @@ -283,7 +295,27 @@ struct bpf_verifier_env { · 3 unmodified lines | |||
| 283 | const struct bpf_line_info *prev_linfo; | 295 | const struct bpf_line_info *prev_linfo; |
| 284 | struct bpf_verifier_log log; | 296 | struct bpf_verifier_log log; |
| 285 | struct bpf_subprog_info subprog_info[BPF_MAX_SUBPROGS + 1]; | 297 | struct bpf_subprog_info subprog_info[BPF_MAX_SUBPROGS + 1]; |
| 298 | struct { | ||
| 299 | int *insn_state; | ||
| 300 | int *insn_stack; | ||
| 301 | int cur_stack; | ||
| 302 | } cfg; | ||
| 286 | u32 subprog_cnt; | 303 | u32 subprog_cnt; |
| 304 | /* number of instructions analyzed by the verifier */ | ||
| 305 | u32 insn_processed; | ||
| 306 | /* total verification time */ | ||
| 307 | u64 verification_time; | ||
| 308 | /* maximum number of verifier states kept in 'branching' instructions */ | ||
| 309 | u32 max_states_per_insn; | ||
| 310 | /* total number of allocated verifier states */ | ||
| 311 | u32 total_states; | ||
| 312 | /* some states are freed during program analysis. | ||
| 313 | * this is peak number of states. this number dominates kernel | ||
| 314 | * memory consumption during verification | ||
| 315 | */ | ||
| 316 | u32 peak_states; | ||
| 317 | /* longest register parentage chain walked for liveness marking */ | ||
| 318 | u32 longest_mark_read_walk; | ||
| 287 | }; | 319 | }; |
| 288 | 320 | ||
| 289 | __printf(2, 0) void bpf_verifier_vlog(struct bpf_verifier_log *log, | 321 | __printf(2, 0) void bpf_verifier_vlog(struct bpf_verifier_log *log, |
| @@ -51,6 +51,7 @@ bool btf_member_is_reg_int(const struct btf *btf, const struct btf_type *s, · 50 unmodified lines | |||
| 51 | const struct btf_member *m, | 51 | const struct btf_member *m, |
| 52 | u32 expected_offset, u32 expected_size); | 52 | u32 expected_offset, u32 expected_size); |
| 53 | int btf_find_spin_lock(const struct btf *btf, const struct btf_type *t); | 53 | int btf_find_spin_lock(const struct btf *btf, const struct btf_type *t); |
| 54 | bool btf_type_is_void(const struct btf_type *t); | ||
| 54 | 55 | ||
| 55 | #ifdef CONFIG_BPF_SYSCALL | 56 | #ifdef CONFIG_BPF_SYSCALL |
| 56 | const struct btf_type *btf_type_by_id(const struct btf *btf, u32 type_id); | 57 | const struct btf_type *btf_type_by_id(const struct btf *btf, u32 type_id); |
| @@ -0,0 +1,76 @@ | |||
| 1 | /* SPDX-License-Identifier: GPL-2.0 | ||
| 2 | * Copyright (c) 2019, Vladimir Oltean <olteanv@gmail.com> | ||
| 3 | */ | ||
| 4 | |||
| 5 | #ifndef _NET_DSA_8021Q_H | ||
| 6 | #define _NET_DSA_8021Q_H | ||
| 7 | |||
| 8 | #include <linux/types.h> | ||
| 9 | |||
| 10 | struct dsa_switch; | ||
| 11 | struct sk_buff; | ||
| 12 | struct net_device; | ||
| 13 | struct packet_type; | ||
| 14 | |||
| 15 | #if IS_ENABLED(CONFIG_NET_DSA_TAG_8021Q) | ||
| 16 | |||
| 17 | int dsa_port_setup_8021q_tagging(struct dsa_switch *ds, int index, | ||
| 18 | bool enabled); | ||
| 19 | |||
| 20 | struct sk_buff *dsa_8021q_xmit(struct sk_buff *skb, struct net_device *netdev, | ||
| 21 | u16 tpid, u16 tci); | ||
| 22 | |||
| 23 | struct sk_buff *dsa_8021q_rcv(struct sk_buff *skb, struct net_device *netdev, | ||
| 24 | struct packet_type *pt, u16 *tpid, u16 *tci); | ||
| 25 | |||
| 26 | u16 dsa_8021q_tx_vid(struct dsa_switch *ds, int port); | ||
| 27 | |||
| 28 | u16 dsa_8021q_rx_vid(struct dsa_switch *ds, int port); | ||
| 29 | |||
| 30 | int dsa_8021q_rx_switch_id(u16 vid); | ||
| 31 | |||
| 32 | int dsa_8021q_rx_source_port(u16 vid); | ||
| 33 | |||
| 34 | #else | ||
| 35 | |||
| 36 | int dsa_port_setup_8021q_tagging(struct dsa_switch *ds, int index, | ||
| 37 | bool enabled) | ||
| 38 | { | ||
| 39 | return 0; | ||
| 40 | } | ||
| 41 | |||
| 42 | struct sk_buff *dsa_8021q_xmit(struct sk_buff *skb, struct net_device *netdev, | ||
| 43 | u16 tpid, u16 tci) | ||
| 44 | { | ||
| 45 | return NULL; | ||
| 46 | } | ||
| 47 | |||
| 48 | struct sk_buff *dsa_8021q_rcv(struct sk_buff *skb, struct net_device *netdev, | ||
| 49 | struct packet_type *pt, u16 *tpid, u16 *tci) | ||
| 50 | { | ||
| 51 | return NULL; | ||
| 52 | } | ||
| 53 | |||
| 54 | u16 dsa_8021q_tx_vid(struct dsa_switch *ds, int port) | ||
| 55 | { | ||
| 56 | return 0; | ||
| 57 | } | ||
| 58 | |||
| 59 | u16 dsa_8021q_rx_vid(struct dsa_switch *ds, int port) | ||
| 60 | { | ||
| 61 | return 0; | ||
| 62 | } | ||
| 63 | |||
| 64 | int dsa_8021q_rx_switch_id(u16 vid) | ||
| 65 | { | ||
| 66 | return 0; | ||
| 67 | } | ||
| 68 | |||
| 69 | int dsa_8021q_rx_source_port(u16 vid) | ||
| 70 | { | ||
| 71 | return 0; | ||
| 72 | } | ||
| 73 | |||
| 74 | #endif /* IS_ENABLED(CONFIG_NET_DSA_TAG_8021Q) */ | ||
| 75 | |||
| 76 | #endif /* _NET_DSA_8021Q_H */ | ||
| @@ -0,0 +1,40 @@ | |||
| 1 | /* SPDX-License-Identifier: GPL-2.0 | ||
| 2 | * Copyright (c) 2019, Vladimir Oltean <olteanv@gmail.com> | ||
| 3 | */ | ||
| 4 | |||
| 5 | /* Included by drivers/net/dsa/sja1105/sja1105.h and net/dsa/tag_sja1105.c */ | ||
| 6 | |||
| 7 | #ifndef _NET_DSA_SJA1105_H | ||
| 8 | #define _NET_DSA_SJA1105_H | ||
| 9 | |||
| 10 | #include <linux/skbuff.h> | ||
| 11 | #include <linux/etherdevice.h> | ||
| 12 | #include <net/dsa.h> | ||
| 13 | |||
| 14 | #define ETH_P_SJA1105 ETH_P_DSA_8021Q | ||
| 15 | |||
| 16 | /* IEEE 802.3 Annex 57A: Slow Protocols PDUs (01:80:C2:xx:xx:xx) */ | ||
| 17 | #define SJA1105_LINKLOCAL_FILTER_A 0x0180C2000000ull | ||
| 18 | #define SJA1105_LINKLOCAL_FILTER_A_MASK 0xFFFFFF000000ull | ||
| 19 | /* IEEE 1588 Annex F: Transport of PTP over Ethernet (01:1B:19:xx:xx:xx) */ | ||
| 20 | #define SJA1105_LINKLOCAL_FILTER_B 0x011B19000000ull | ||
| 21 | #define SJA1105_LINKLOCAL_FILTER_B_MASK 0xFFFFFF000000ull | ||
| 22 | |||
| 23 | enum sja1105_frame_type { | ||
| 24 | SJA1105_FRAME_TYPE_NORMAL = 0, | ||
| 25 | SJA1105_FRAME_TYPE_LINK_LOCAL, | ||
| 26 | }; | ||
| 27 | |||
| 28 | struct sja1105_skb_cb { | ||
| 29 | enum sja1105_frame_type type; | ||
| 30 | }; | ||
| 31 | |||
| 32 | #define SJA1105_SKB_CB(skb) \ | ||
| 33 | ((struct sja1105_skb_cb *)DSA_SKB_CB_PRIV(skb)) | ||
| 34 | |||
| 35 | struct sja1105_port { | ||
| 36 | struct dsa_port *dp; | ||
| 37 | int mgmt_slot; | ||
| 38 | }; | ||
| 39 | |||
| 40 | #endif /* _NET_DSA_SJA1105_H */ | ||
| @@ -33,7 +33,7 @@ struct device; · 32 unmodified lines | |||
| 33 | int eth_platform_get_mac_address(struct device *dev, u8 *mac_addr); | 33 | int eth_platform_get_mac_address(struct device *dev, u8 *mac_addr); |
| 34 | unsigned char *arch_get_platform_mac_address(void); | 34 | unsigned char *arch_get_platform_mac_address(void); |
| 35 | int nvmem_get_mac_address(struct device *dev, void *addrbuf); | 35 | int nvmem_get_mac_address(struct device *dev, void *addrbuf); |
| 36 | u32 eth_get_headlen(void *data, unsigned int max_len); | 36 | u32 eth_get_headlen(const struct net_device *dev, void *data, unsigned int len); |
| 37 | __be16 eth_type_trans(struct sk_buff *skb, struct net_device *dev); | 37 | __be16 eth_type_trans(struct sk_buff *skb, struct net_device *dev); |
| 38 | extern const struct header_ops eth_header_ops; | 38 | extern const struct header_ops eth_header_ops; |
| 39 | 39 | ||
| @@ -34,6 +34,8 @@ struct bpf_prog_aux; · 33 unmodified lines | |||
| 34 | struct xdp_rxq_info; | 34 | struct xdp_rxq_info; |
| 35 | struct xdp_buff; | 35 | struct xdp_buff; |
| 36 | struct sock_reuseport; | 36 | struct sock_reuseport; |
| 37 | struct ctl_table; | ||
| 38 | struct ctl_table_header; | ||
| 37 | 39 | ||
| 38 | /* ArgX, context and stack frame pointer register positions. Note, | 40 | /* ArgX, context and stack frame pointer register positions. Note, |
| 39 | * Arg1, Arg2, Arg3, etc are used as argument mappings of function | 41 | * Arg1, Arg2, Arg3, etc are used as argument mappings of function |
| @@ -1167,4 +1169,18 @@ struct bpf_sock_ops_kern { · 1127 unmodified lines | |||
| 1167 | */ | 1169 | */ |
| 1168 | }; | 1170 | }; |
| 1169 | 1171 | ||
| 1172 | struct bpf_sysctl_kern { | ||
| 1173 | struct ctl_table_header *head; | ||
| 1174 | struct ctl_table *table; | ||
| 1175 | void *cur_val; | ||
| 1176 | size_t cur_len; | ||
| 1177 | void *new_val; | ||
| 1178 | size_t new_len; | ||
| 1179 | int new_updated; | ||
| 1180 | int write; | ||
| 1181 | loff_t *ppos; | ||
| 1182 | /* Temporary "register" for indirect stores to ppos. */ | ||
| 1183 | u64 tmp_reg; | ||
| 1184 | }; | ||
| 1185 | |||
| 1170 | #endif /* __LINUX_FILTER_H__ */ | 1186 | #endif /* __LINUX_FILTER_H__ */ |
| @@ -233,7 +233,6 @@ const char *CONCAT_(GENL_MAGIC_FAMILY, _genl_cmd_to_str)(__u8 cmd) · 232 unmodified lines | |||
| 233 | { \ | 233 | { \ |
| 234 | handler \ | 234 | handler \ |
| 235 | .cmd = op_name, \ | 235 | .cmd = op_name, \ |
| 236 | .policy = CONCAT_(GENL_MAGIC_FAMILY, _tla_nl_policy), \ | ||
| 237 | }, | 236 | }, |
| 238 | 237 | ||
| 239 | #define ZZZ_genl_ops CONCAT_(GENL_MAGIC_FAMILY, _genl_ops) | 238 | #define ZZZ_genl_ops CONCAT_(GENL_MAGIC_FAMILY, _genl_ops) |
| @@ -290,7 +289,8 @@ static struct genl_family ZZZ_genl_family __ro_after_init = { · 50 unmodified lines | |||
| 290 | #ifdef GENL_MAGIC_FAMILY_HDRSZ | 289 | #ifdef GENL_MAGIC_FAMILY_HDRSZ |
| 291 | .hdrsize = NLA_ALIGN(GENL_MAGIC_FAMILY_HDRSZ), | 290 | .hdrsize = NLA_ALIGN(GENL_MAGIC_FAMILY_HDRSZ), |
| 292 | #endif | 291 | #endif |
| 293 | .maxattr = ARRAY_SIZE(drbd_tla_nl_policy)-1, | 292 | .maxattr = ARRAY_SIZE(CONCAT_(GENL_MAGIC_FAMILY, _tla_nl_policy))-1, |
| 293 | .policy = CONCAT_(GENL_MAGIC_FAMILY, _tla_nl_policy), | ||
| 294 | .ops = ZZZ_genl_ops, | 294 | .ops = ZZZ_genl_ops, |
| 295 | .n_ops = ARRAY_SIZE(ZZZ_genl_ops), | 295 | .n_ops = ARRAY_SIZE(ZZZ_genl_ops), |
| 296 | .mcgrps = ZZZ_genl_mcgrps, | 296 | .mcgrps = ZZZ_genl_mcgrps, |
| @@ -1557,7 +1557,7 @@ struct ieee80211_vht_operation { · 1556 unmodified lines | |||
| 1557 | * struct ieee80211_he_cap_elem - HE capabilities element | 1557 | * struct ieee80211_he_cap_elem - HE capabilities element |
| 1558 | * | 1558 | * |
| 1559 | * This structure is the "HE capabilities element" fixed fields as | 1559 | * This structure is the "HE capabilities element" fixed fields as |
| 1560 | * described in P802.11ax_D3.0 section 9.4.2.237.2 and 9.4.2.237.3 | 1560 | * described in P802.11ax_D4.0 section 9.4.2.242.2 and 9.4.2.242.3 |
| 1561 | */ | 1561 | */ |
| 1562 | struct ieee80211_he_cap_elem { | 1562 | struct ieee80211_he_cap_elem { |
| 1563 | u8 mac_cap_info[6]; | 1563 | u8 mac_cap_info[6]; |
| @@ -1619,12 +1619,12 @@ struct ieee80211_he_mcs_nss_supp { · 55 unmodified lines | |||
| 1619 | * struct ieee80211_he_operation - HE capabilities element | 1619 | * struct ieee80211_he_operation - HE capabilities element |
| 1620 | * | 1620 | * |
| 1621 | * This structure is the "HE operation element" fields as | 1621 | * This structure is the "HE operation element" fields as |
| 1622 | * described in P802.11ax_D3.0 section 9.4.2.238 | 1622 | * described in P802.11ax_D4.0 section 9.4.2.243 |
| 1623 | */ | 1623 | */ |
| 1624 | struct ieee80211_he_operation { | 1624 | struct ieee80211_he_operation { |
| 1625 | __le32 he_oper_params; | 1625 | __le32 he_oper_params; |
| 1626 | __le16 he_mcs_nss_set; | 1626 | __le16 he_mcs_nss_set; |
| 1627 | /* Optional 0,1,3 or 4 bytes: depends on @he_oper_params */ | 1627 | /* Optional 0,1,3,4,5,7 or 8 bytes: depends on @he_oper_params */ |
| 1628 | u8 optional[0]; | 1628 | u8 optional[0]; |
| 1629 | } __packed; | 1629 | } __packed; |
| 1630 | 1630 | ||
| @@ -1632,7 +1632,7 @@ struct ieee80211_he_operation { · 1 unmodified line | |||
| 1632 | * struct ieee80211_he_mu_edca_param_ac_rec - MU AC Parameter Record field | 1632 | * struct ieee80211_he_mu_edca_param_ac_rec - MU AC Parameter Record field |
| 1633 | * | 1633 | * |
| 1634 | * This structure is the "MU AC Parameter Record" fields as | 1634 | * This structure is the "MU AC Parameter Record" fields as |
| 1635 | * described in P802.11ax_D2.0 section 9.4.2.240 | 1635 | * described in P802.11ax_D4.0 section 9.4.2.245 |
| 1636 | */ | 1636 | */ |
| 1637 | struct ieee80211_he_mu_edca_param_ac_rec { | 1637 | struct ieee80211_he_mu_edca_param_ac_rec { |
| 1638 | u8 aifsn; | 1638 | u8 aifsn; |
| @@ -1644,7 +1644,7 @@ struct ieee80211_he_mu_edca_param_ac_rec { · 5 unmodified lines | |||
| 1644 | * struct ieee80211_mu_edca_param_set - MU EDCA Parameter Set element | 1644 | * struct ieee80211_mu_edca_param_set - MU EDCA Parameter Set element |
| 1645 | * | 1645 | * |
| 1646 | * This structure is the "MU EDCA Parameter Set element" fields as | 1646 | * This structure is the "MU EDCA Parameter Set element" fields as |
| 1647 | * described in P802.11ax_D2.0 section 9.4.2.240 | 1647 | * described in P802.11ax_D4.0 section 9.4.2.245 |
| 1648 | */ | 1648 | */ |
| 1649 | struct ieee80211_mu_edca_param_set { | 1649 | struct ieee80211_mu_edca_param_set { |
| 1650 | u8 mu_qos_info; | 1650 | u8 mu_qos_info; |
| @@ -2026,6 +2026,7 @@ ieee80211_he_ppe_size(u8 ppe_thres_hdr, const u8 *phy_cap_info) · 375 unmodified lines | |||
| 2026 | #define IEEE80211_HE_OPERATION_VHT_OPER_INFO 0x00004000 | 2026 | #define IEEE80211_HE_OPERATION_VHT_OPER_INFO 0x00004000 |
| 2027 | #define IEEE80211_HE_OPERATION_CO_HOSTED_BSS 0x00008000 | 2027 | #define IEEE80211_HE_OPERATION_CO_HOSTED_BSS 0x00008000 |
| 2028 | #define IEEE80211_HE_OPERATION_ER_SU_DISABLE 0x00010000 | 2028 | #define IEEE80211_HE_OPERATION_ER_SU_DISABLE 0x00010000 |
| 2029 | #define IEEE80211_HE_OPERATION_6GHZ_OP_INFO 0x00020000 | ||
| 2029 | #define IEEE80211_HE_OPERATION_BSS_COLOR_MASK 0x3f000000 | 2030 | #define IEEE80211_HE_OPERATION_BSS_COLOR_MASK 0x3f000000 |
| 2030 | #define IEEE80211_HE_OPERATION_BSS_COLOR_OFFSET 24 | 2031 | #define IEEE80211_HE_OPERATION_BSS_COLOR_OFFSET 24 |
| 2031 | #define IEEE80211_HE_OPERATION_PARTIAL_BSS_COLOR 0x40000000 | 2032 | #define IEEE80211_HE_OPERATION_PARTIAL_BSS_COLOR 0x40000000 |
| @@ -2056,6 +2057,8 @@ ieee80211_he_oper_size(const u8 *he_oper_ie) · 24 unmodified lines | |||
| 2056 | oper_len += 3; | 2057 | oper_len += 3; |
| 2057 | if (he_oper_params & IEEE80211_HE_OPERATION_CO_HOSTED_BSS) | 2058 | if (he_oper_params & IEEE80211_HE_OPERATION_CO_HOSTED_BSS) |
| 2058 | oper_len++; | 2059 | oper_len++; |
| 2060 | if (he_oper_params & IEEE80211_HE_OPERATION_6GHZ_OP_INFO) | ||
| 2061 | oper_len += 4; | ||
| 2059 | 2062 | ||
| 2060 | /* Add the first byte (extension ID) to the total length */ | 2063 | /* Add the first byte (extension ID) to the total length */ |
| 2061 | oper_len++; | 2064 | oper_len++; |
| @@ -2487,6 +2490,7 @@ enum ieee80211_eid_ext { · 425 unmodified lines | |||
| 2487 | WLAN_EID_EXT_HE_MU_EDCA = 38, | 2490 | WLAN_EID_EXT_HE_MU_EDCA = 38, |
| 2488 | WLAN_EID_EXT_MAX_CHANNEL_SWITCH_TIME = 52, | 2491 | WLAN_EID_EXT_MAX_CHANNEL_SWITCH_TIME = 52, |
| 2489 | WLAN_EID_EXT_MULTIPLE_BSSID_CONFIGURATION = 55, | 2492 | WLAN_EID_EXT_MULTIPLE_BSSID_CONFIGURATION = 55, |
| 2493 | WLAN_EID_EXT_NON_INHERITANCE = 56, | ||
| 2490 | }; | 2494 | }; |
| 2491 | 2495 | ||
| 2492 | /* Action category code */ | 2496 | /* Action category code */ |
| @@ -56,9 +56,6 @@ struct br_ip_list { · 55 unmodified lines | |||
| 56 | 56 | ||
| 57 | extern void brioctl_set(int (*ioctl_hook)(struct net *, unsigned int, void __user *)); | 57 | extern void brioctl_set(int (*ioctl_hook)(struct net *, unsigned int, void __user *)); |
| 58 | 58 | ||
| 59 | typedef int br_should_route_hook_t(struct sk_buff *skb); | ||
| 60 | extern br_should_route_hook_t __rcu *br_should_route_hook; | ||
| 61 | |||
| 62 | #if IS_ENABLED(CONFIG_BRIDGE) && IS_ENABLED(CONFIG_BRIDGE_IGMP_SNOOPING) | 59 | #if IS_ENABLED(CONFIG_BRIDGE) && IS_ENABLED(CONFIG_BRIDGE_IGMP_SNOOPING) |
| 63 | int br_multicast_list_adjacent(struct net_device *dev, | 60 | int br_multicast_list_adjacent(struct net_device *dev, |
| 64 | struct list_head *br_ip_list); | 61 | struct list_head *br_ip_list); |
| @@ -237,6 +237,20 @@ static inline struct in_device *__in_dev_get_rtnl(const struct net_device *dev) · 236 unmodified lines | |||
| 237 | return rtnl_dereference(dev->ip_ptr); | 237 | return rtnl_dereference(dev->ip_ptr); |
| 238 | } | 238 | } |
| 239 | 239 | ||
| 240 | /* called with rcu_read_lock or rtnl held */ | ||
| 241 | static inline bool ip_ignore_linkdown(const struct net_device *dev) | ||
| 242 | { | ||
| 243 | struct in_device *in_dev; | ||
| 244 | bool rc = false; | ||
| 245 | |||
| 246 | in_dev = rcu_dereference_rtnl(dev->ip_ptr); | ||
| 247 | if (in_dev && | ||
| 248 | IN_DEV_IGNORE_ROUTES_WITH_LINKDOWN(in_dev)) | ||
| 249 | rc = true; | ||
| 250 | |||
| 251 | return rc; | ||
| 252 | } | ||
| 253 | |||
| 240 | static inline struct neigh_parms *__in_dev_arp_parms_get_rcu(const struct net_device *dev) | 254 | static inline struct neigh_parms *__in_dev_arp_parms_get_rcu(const struct net_device *dev) |
| 241 | { | 255 | { |
| 242 | struct in_device *in_dev = __in_dev_get_rcu(dev); | 256 | struct in_device *in_dev = __in_dev_get_rcu(dev); |
| @@ -297,6 +297,7 @@ static inline u64 jiffies_to_nsecs(const unsigned long j) · 296 unmodified lines | |||
| 297 | } | 297 | } |
| 298 | 298 | ||
| 299 | extern u64 jiffies64_to_nsecs(u64 j); | 299 | extern u64 jiffies64_to_nsecs(u64 j); |
| 300 | extern u64 jiffies64_to_msecs(u64 j); | ||
| 300 | 301 | ||
| 301 | extern unsigned long __msecs_to_jiffies(const unsigned int m); | 302 | extern unsigned long __msecs_to_jiffies(const unsigned int m); |
| 302 | #if HZ <= MSEC_PER_SEC && !(MSEC_PER_SEC % HZ) | 303 | #if HZ <= MSEC_PER_SEC && !(MSEC_PER_SEC % HZ) |
| @@ -34,5 +34,6 @@ · 33 unmodified lines | |||
| 34 | /* struct phy_device dev_flags definitions */ | 34 | /* struct phy_device dev_flags definitions */ |
| 35 | #define MARVELL_PHY_M1145_FLAGS_RESISTANCE 0x00000001 | 35 | #define MARVELL_PHY_M1145_FLAGS_RESISTANCE 0x00000001 |
| 36 | #define MARVELL_PHY_M1118_DNS323_LEDS 0x00000002 | 36 | #define MARVELL_PHY_M1118_DNS323_LEDS 0x00000002 |
| 37 | #define MARVELL_PHY_LED0_LINK_LED1_ACTIVE 0x00000004 | ||
| 37 | 38 | ||
| 38 | #endif /* _MARVELL_PHY_H */ | 39 | #endif /* _MARVELL_PHY_H */ |
| @@ -39,7 +39,8 @@ struct mdio_device { · 38 unmodified lines | |||
| 39 | /* Bus address of the MDIO device (0-31) */ | 39 | /* Bus address of the MDIO device (0-31) */ |
| 40 | int addr; | 40 | int addr; |
| 41 | int flags; | 41 | int flags; |
| 42 | struct gpio_desc *reset; | 42 | struct gpio_desc *reset_gpio; |
| 43 | struct reset_control *reset_ctrl; | ||
| 43 | unsigned int reset_assert_delay; | 44 | unsigned int reset_assert_delay; |
| 44 | unsigned int reset_deassert_delay; | 45 | unsigned int reset_deassert_delay; |
| 45 | }; | 46 | }; |
| @@ -170,7 +170,7 @@ static inline void mlx5_cq_arm(struct mlx5_core_cq *cq, u32 cmd, · 169 unmodified lines | |||
| 170 | doorbell[0] = cpu_to_be32(sn << 28 | cmd | ci); | 170 | doorbell[0] = cpu_to_be32(sn << 28 | cmd | ci); |
| 171 | doorbell[1] = cpu_to_be32(cq->cqn); | 171 | doorbell[1] = cpu_to_be32(cq->cqn); |
| 172 | 172 | ||
| 173 | mlx5_write64(doorbell, uar_page + MLX5_CQ_DOORBELL, NULL); | 173 | mlx5_write64(doorbell, uar_page + MLX5_CQ_DOORBELL); |
| 174 | } | 174 | } |
| 175 | 175 | ||
| 176 | static inline void mlx5_cq_hold(struct mlx5_core_cq *cq) | 176 | static inline void mlx5_cq_hold(struct mlx5_core_cq *cq) |
| @@ -361,6 +361,7 @@ enum { · 360 unmodified lines | |||
| 361 | 361 | ||
| 362 | enum { | 362 | enum { |
| 363 | MLX5_GENERAL_SUBTYPE_DELAY_DROP_TIMEOUT = 0x1, | 363 | MLX5_GENERAL_SUBTYPE_DELAY_DROP_TIMEOUT = 0x1, |
| 364 | MLX5_GENERAL_SUBTYPE_PCI_POWER_CHANGE_EVENT = 0x5, | ||
| 364 | }; | 365 | }; |
| 365 | 366 | ||
| 366 | enum { | 367 | enum { |
| @@ -1001,7 +1002,8 @@ enum { · 634 unmodified lines | |||
| 1001 | MLX5_MATCH_OUTER_HEADERS = 1 << 0, | 1002 | MLX5_MATCH_OUTER_HEADERS = 1 << 0, |
| 1002 | MLX5_MATCH_MISC_PARAMETERS = 1 << 1, | 1003 | MLX5_MATCH_MISC_PARAMETERS = 1 << 1, |
| 1003 | MLX5_MATCH_INNER_HEADERS = 1 << 2, | 1004 | MLX5_MATCH_INNER_HEADERS = 1 << 2, |
| 1004 | 1005 | MLX5_MATCH_MISC_PARAMETERS_2 = 1 << 3, | |
| 1006 | MLX5_MATCH_MISC_PARAMETERS_3 = 1 << 4, | ||
| 1005 | }; | 1007 | }; |
| 1006 | 1008 | ||
| 1007 | enum { | 1009 | enum { |
| @@ -1045,6 +1047,7 @@ enum mlx5_mpls_supported_fields { · 37 unmodified lines | |||
| 1045 | }; | 1047 | }; |
| 1046 | 1048 | ||
| 1047 | enum mlx5_flex_parser_protos { | 1049 | enum mlx5_flex_parser_protos { |
| 1050 | MLX5_FLEX_PROTO_GENEVE = 1 << 3, | ||
| 1048 | MLX5_FLEX_PROTO_CW_MPLS_GRE = 1 << 4, | 1051 | MLX5_FLEX_PROTO_CW_MPLS_GRE = 1 << 4, |
| 1049 | MLX5_FLEX_PROTO_CW_MPLS_UDP = 1 << 5, | 1052 | MLX5_FLEX_PROTO_CW_MPLS_UDP = 1 << 5, |
| 1050 | }; | 1053 | }; |
| @@ -1166,6 +1169,12 @@ enum mlx5_qcam_feature_groups { · 115 unmodified lines | |||
| 1166 | #define MLX5_CAP_FLOWTABLE_SNIFFER_TX_MAX(mdev, cap) \ | 1169 | #define MLX5_CAP_FLOWTABLE_SNIFFER_TX_MAX(mdev, cap) \ |
| 1167 | MLX5_CAP_FLOWTABLE_MAX(mdev, flow_table_properties_nic_transmit_sniffer.cap) | 1170 | MLX5_CAP_FLOWTABLE_MAX(mdev, flow_table_properties_nic_transmit_sniffer.cap) |
| 1168 | 1171 | ||
| 1172 | #define MLX5_CAP_FLOWTABLE_RDMA_RX(mdev, cap) \ | ||
| 1173 | MLX5_CAP_FLOWTABLE(mdev, flow_table_properties_nic_receive_rdma.cap) | ||
| 1174 | |||
| 1175 | #define MLX5_CAP_FLOWTABLE_RDMA_RX_MAX(mdev, cap) \ | ||
| 1176 | MLX5_CAP_FLOWTABLE_MAX(mdev, flow_table_properties_nic_receive_rdma.cap) | ||
| 1177 | |||
| 1169 | #define MLX5_CAP_ESW_FLOWTABLE(mdev, cap) \ | 1178 | #define MLX5_CAP_ESW_FLOWTABLE(mdev, cap) \ |
| 1170 | MLX5_GET(flow_table_eswitch_cap, \ | 1179 | MLX5_GET(flow_table_eswitch_cap, \ |
| 1171 | mdev->caps.hca_cur[MLX5_CAP_ESWITCH_FLOW_TABLE], cap) | 1180 | mdev->caps.hca_cur[MLX5_CAP_ESWITCH_FLOW_TABLE], cap) |
| @@ -36,46 +36,25 @@ · 35 unmodified lines | |||
| 36 | #define MLX5_BF_OFFSET 0x800 | 36 | #define MLX5_BF_OFFSET 0x800 |
| 37 | #define MLX5_CQ_DOORBELL 0x20 | 37 | #define MLX5_CQ_DOORBELL 0x20 |
| 38 | 38 | ||
| 39 | #if BITS_PER_LONG == 64 | ||
| 40 | /* Assume that we can just write a 64-bit doorbell atomically. s390 | 39 | /* Assume that we can just write a 64-bit doorbell atomically. s390 |
| 41 | * actually doesn't have writeq() but S/390 systems don't even have | 40 | * actually doesn't have writeq() but S/390 systems don't even have |
| 42 | * PCI so we won't worry about it. | 41 | * PCI so we won't worry about it. |
| 42 | * | ||
| 43 | * Note that the write is not atomic on 32-bit systems! In contrast to 64-bit | ||
| 44 | * ones, it requires proper locking. mlx5_write64 doesn't do any locking, so use | ||
| 45 | * it at your own discretion, protected by some kind of lock on 32 bits. | ||
| 46 | * | ||
| 47 | * TODO: use write{q,l}_relaxed() | ||
| 43 | */ | 48 | */ |
| 44 | 49 | ||
| 45 | #define MLX5_DECLARE_DOORBELL_LOCK(name) | 50 | static inline void mlx5_write64(__be32 val[2], void __iomem *dest) |
| 46 | #define MLX5_INIT_DOORBELL_LOCK(ptr) do { } while (0) | ||
| 47 | #define MLX5_GET_DOORBELL_LOCK(ptr) (NULL) | ||
| 48 | |||
| 49 | static inline void mlx5_write64(__be32 val[2], void __iomem *dest, | ||
| 50 | spinlock_t *doorbell_lock) | ||
| 51 | { | 51 | { |
| 52 | #if BITS_PER_LONG == 64 | ||
| 52 | __raw_writeq(*(u64 *)val, dest); | 53 | __raw_writeq(*(u64 *)val, dest); |
| 53 | } | ||
| 54 | |||
| 55 | #else | 54 | #else |
| 56 | |||
| 57 | /* Just fall back to a spinlock to protect the doorbell if | ||
| 58 | * BITS_PER_LONG is 32 -- there's no portable way to do atomic 64-bit | ||
| 59 | * MMIO writes. | ||
| 60 | */ | ||
| 61 | |||
| 62 | #define MLX5_DECLARE_DOORBELL_LOCK(name) spinlock_t name; | ||
| 63 | #define MLX5_INIT_DOORBELL_LOCK(ptr) spin_lock_init(ptr) | ||
| 64 | #define MLX5_GET_DOORBELL_LOCK(ptr) (ptr) | ||
| 65 | |||
| 66 | static inline void mlx5_write64(__be32 val[2], void __iomem *dest, | ||
| 67 | spinlock_t *doorbell_lock) | ||
| 68 | { | ||
| 69 | unsigned long flags; | ||
| 70 | |||
| 71 | if (doorbell_lock) | ||
| 72 | spin_lock_irqsave(doorbell_lock, flags); | ||
| 73 | __raw_writel((__force u32) val[0], dest); | 55 | __raw_writel((__force u32) val[0], dest); |
| 74 | __raw_writel((__force u32) val[1], dest + 4); | 56 | __raw_writel((__force u32) val[1], dest + 4); |
| 75 | if (doorbell_lock) | ||
| 76 | spin_unlock_irqrestore(doorbell_lock, flags); | ||
| 77 | } | ||
| 78 | |||
| 79 | #endif | 57 | #endif |
| 58 | } | ||
| 80 | 59 | ||
| 81 | #endif /* MLX5_DOORBELL_H */ | 60 | #endif /* MLX5_DOORBELL_H */ |
| @@ -56,7 +56,6 @@ · 55 unmodified lines | |||
| 56 | 56 | ||
| 57 | enum { | 57 | enum { |
| 58 | MLX5_BOARD_ID_LEN = 64, | 58 | MLX5_BOARD_ID_LEN = 64, |
| 59 | MLX5_MAX_NAME_LEN = 16, | ||
| 60 | }; | 59 | }; |
| 61 | 60 | ||
| 62 | enum { | 61 | enum { |
| @@ -133,6 +132,7 @@ enum { · 70 unmodified lines | |||
| 133 | MLX5_REG_MTRC_CONF = 0x9041, | 132 | MLX5_REG_MTRC_CONF = 0x9041, |
| 134 | MLX5_REG_MTRC_STDB = 0x9042, | 133 | MLX5_REG_MTRC_STDB = 0x9042, |
| 135 | MLX5_REG_MTRC_CTRL = 0x9043, | 134 | MLX5_REG_MTRC_CTRL = 0x9043, |
| 135 | MLX5_REG_MPEIN = 0x9050, | ||
| 136 | MLX5_REG_MPCNT = 0x9051, | 136 | MLX5_REG_MPCNT = 0x9051, |
| 137 | MLX5_REG_MTPPS = 0x9053, | 137 | MLX5_REG_MTPPS = 0x9053, |
| 138 | MLX5_REG_MTPPSE = 0x9054, | 138 | MLX5_REG_MTPPSE = 0x9054, |
| @@ -512,8 +512,13 @@ struct mlx5_rl_table { · 373 unmodified lines | |||
| 512 | struct mlx5_rl_entry *rl_entry; | 512 | struct mlx5_rl_entry *rl_entry; |
| 513 | }; | 513 | }; |
| 514 | 514 | ||
| 515 | struct mlx5_core_roce { | ||
| 516 | struct mlx5_flow_table *ft; | ||
| 517 | struct mlx5_flow_group *fg; | ||
| 518 | struct mlx5_flow_handle *allow_rule; | ||
| 519 | }; | ||
| 520 | |||
| 515 | struct mlx5_priv { | 521 | struct mlx5_priv { |
| 516 | char name[MLX5_MAX_NAME_LEN]; | ||
| 517 | struct mlx5_eq_table *eq_table; | 522 | struct mlx5_eq_table *eq_table; |
| 518 | 523 | ||
| 519 | /* pages stuff */ | 524 | /* pages stuff */ |
| @@ -566,6 +571,7 @@ struct mlx5_priv { · 46 unmodified lines | |||
| 566 | struct mlx5_lag *lag; | 571 | struct mlx5_lag *lag; |
| 567 | struct mlx5_devcom *devcom; | 572 | struct mlx5_devcom *devcom; |
| 568 | unsigned long pci_dev_data; | 573 | unsigned long pci_dev_data; |
| 574 | struct mlx5_core_roce roce; | ||
| 569 | struct mlx5_fc_stats fc_stats; | 575 | struct mlx5_fc_stats fc_stats; |
| 570 | struct mlx5_rl_table rl_table; | 576 | struct mlx5_rl_table rl_table; |
| 571 | 577 | ||
| @@ -642,6 +648,7 @@ struct mlx5_fw_tracer; · 70 unmodified lines | |||
| 642 | struct mlx5_vxlan; | 648 | struct mlx5_vxlan; |
| 643 | 649 | ||
| 644 | struct mlx5_core_dev { | 650 | struct mlx5_core_dev { |
| 651 | struct device *device; | ||
| 645 | struct pci_dev *pdev; | 652 | struct pci_dev *pdev; |
| 646 | /* sync pci state */ | 653 | /* sync pci state */ |
| 647 | struct mutex pci_status_mutex; | 654 | struct mutex pci_status_mutex; |
| @@ -662,6 +669,7 @@ struct mlx5_core_dev { · 14 unmodified lines | |||
| 662 | u64 sys_image_guid; | 669 | u64 sys_image_guid; |
| 663 | phys_addr_t iseg_base; | 670 | phys_addr_t iseg_base; |
| 664 | struct mlx5_init_seg __iomem *iseg; | 671 | struct mlx5_init_seg __iomem *iseg; |
| 672 | phys_addr_t bar_addr; | ||
| 665 | enum mlx5_device_state state; | 673 | enum mlx5_device_state state; |
| 666 | /* sync interface state */ | 674 | /* sync interface state */ |
| 667 | struct mutex intf_state_mutex; | 675 | struct mutex intf_state_mutex; |
| @@ -887,6 +895,7 @@ void mlx5_cmd_mbox_status(void *out, u8 *status, u32 *syndrome); · 219 unmodified lines | |||
| 887 | int mlx5_core_get_caps(struct mlx5_core_dev *dev, enum mlx5_cap_type cap_type); | 895 | int mlx5_core_get_caps(struct mlx5_core_dev *dev, enum mlx5_cap_type cap_type); |
| 888 | int mlx5_cmd_alloc_uar(struct mlx5_core_dev *dev, u32 *uarn); | 896 | int mlx5_cmd_alloc_uar(struct mlx5_core_dev *dev, u32 *uarn); |
| 889 | int mlx5_cmd_free_uar(struct mlx5_core_dev *dev, u32 uarn); | 897 | int mlx5_cmd_free_uar(struct mlx5_core_dev *dev, u32 uarn); |
| 898 | void mlx5_health_flush(struct mlx5_core_dev *dev); | ||
| 890 | void mlx5_health_cleanup(struct mlx5_core_dev *dev); | 899 | void mlx5_health_cleanup(struct mlx5_core_dev *dev); |
| 891 | int mlx5_health_init(struct mlx5_core_dev *dev); | 900 | int mlx5_health_init(struct mlx5_core_dev *dev); |
| 892 | void mlx5_start_health_poll(struct mlx5_core_dev *dev); | 901 | void mlx5_start_health_poll(struct mlx5_core_dev *dev); |
| @@ -35,7 +35,7 @@ struct mlx5_eswitch_rep_if { · 34 unmodified lines | |||
| 35 | void (*unload)(struct mlx5_eswitch_rep *rep); | 35 | void (*unload)(struct mlx5_eswitch_rep *rep); |
| 36 | void *(*get_proto_dev)(struct mlx5_eswitch_rep *rep); | 36 | void *(*get_proto_dev)(struct mlx5_eswitch_rep *rep); |
| 37 | void *priv; | 37 | void *priv; |
| 38 | u8 state; | 38 | atomic_t state; |
| 39 | }; | 39 | }; |
| 40 | 40 | ||
| 41 | struct mlx5_eswitch_rep { | 41 | struct mlx5_eswitch_rep { |
| @@ -73,6 +73,13 @@ enum mlx5_flow_namespace_type { · 72 unmodified lines | |||
| 73 | MLX5_FLOW_NAMESPACE_SNIFFER_RX, | 73 | MLX5_FLOW_NAMESPACE_SNIFFER_RX, |
| 74 | MLX5_FLOW_NAMESPACE_SNIFFER_TX, | 74 | MLX5_FLOW_NAMESPACE_SNIFFER_TX, |
| 75 | MLX5_FLOW_NAMESPACE_EGRESS, | 75 | MLX5_FLOW_NAMESPACE_EGRESS, |
| 76 | MLX5_FLOW_NAMESPACE_RDMA_RX, | ||
| 77 | }; | ||
| 78 | |||
| 79 | enum { | ||
| 80 | FDB_BYPASS_PATH, | ||
| 81 | FDB_FAST_PATH, | ||
| 82 | FDB_SLOW_PATH, | ||
| 76 | }; | 83 | }; |
| 77 | 84 | ||
| 78 | struct mlx5_flow_table; | 85 | struct mlx5_flow_table; |
| @@ -80,6 +80,19 @@ enum { · 79 unmodified lines | |||
| 80 | MLX5_SHARED_RESOURCE_UID = 0xffff, | 80 | MLX5_SHARED_RESOURCE_UID = 0xffff, |
| 81 | }; | 81 | }; |
| 82 | 82 | ||
| 83 | enum { | ||
| 84 | MLX5_OBJ_TYPE_SW_ICM = 0x0008, | ||
| 85 | }; | ||
| 86 | |||
| 87 | enum { | ||
| 88 | MLX5_GENERAL_OBJ_TYPES_CAP_SW_ICM = (1ULL << MLX5_OBJ_TYPE_SW_ICM), | ||
| 89 | MLX5_GENERAL_OBJ_TYPES_CAP_GENEVE_TLV_OPT = (1ULL << 11), | ||
| 90 | }; | ||
| 91 | |||
| 92 | enum { | ||
| 93 | MLX5_OBJ_TYPE_GENEVE_TLV_OPT = 0x000b, | ||
| 94 | }; | ||
| 95 | |||
| 83 | enum { | 96 | enum { |
| 84 | MLX5_CMD_OP_QUERY_HCA_CAP = 0x100, | 97 | MLX5_CMD_OP_QUERY_HCA_CAP = 0x100, |
| 85 | MLX5_CMD_OP_QUERY_ADAPTER = 0x101, | 98 | MLX5_CMD_OP_QUERY_ADAPTER = 0x101, |
| @@ -299,7 +312,11 @@ struct mlx5_ifc_flow_table_fields_supported_bits { · 213 unmodified lines | |||
| 299 | u8 outer_gre_protocol[0x1]; | 312 | u8 outer_gre_protocol[0x1]; |
| 300 | u8 outer_gre_key[0x1]; | 313 | u8 outer_gre_key[0x1]; |
| 301 | u8 outer_vxlan_vni[0x1]; | 314 | u8 outer_vxlan_vni[0x1]; |
| 302 | u8 reserved_at_1a[0x5]; | 315 | u8 outer_geneve_vni[0x1]; |
| 316 | u8 outer_geneve_oam[0x1]; | ||
| 317 | u8 outer_geneve_protocol_type[0x1]; | ||
| 318 | u8 outer_geneve_opt_len[0x1]; | ||
| 319 | u8 reserved_at_1e[0x1]; | ||
| 303 | u8 source_eswitch_port[0x1]; | 320 | u8 source_eswitch_port[0x1]; |
| 304 | 321 | ||
| 305 | u8 inner_dmac[0x1]; | 322 | u8 inner_dmac[0x1]; |
| @@ -327,7 +344,8 @@ struct mlx5_ifc_flow_table_fields_supported_bits { · 21 unmodified lines | |||
| 327 | u8 inner_tcp_flags[0x1]; | 344 | u8 inner_tcp_flags[0x1]; |
| 328 | u8 reserved_at_37[0x9]; | 345 | u8 reserved_at_37[0x9]; |
| 329 | 346 | ||
| 330 | u8 reserved_at_40[0x5]; | 347 | u8 geneve_tlv_option_0_data[0x1]; |
| 348 | u8 reserved_at_41[0x4]; | ||
| 331 | u8 outer_first_mpls_over_udp[0x4]; | 349 | u8 outer_first_mpls_over_udp[0x4]; |
| 332 | u8 outer_first_mpls_over_gre[0x4]; | 350 | u8 outer_first_mpls_over_gre[0x4]; |
| 333 | u8 inner_first_mpls[0x4]; | 351 | u8 inner_first_mpls[0x4]; |
| @@ -357,11 +375,14 @@ struct mlx5_ifc_flow_table_prop_layout_bits { · 23 unmodified lines | |||
| 357 | u8 pop_vlan_2[0x1]; | 375 | u8 pop_vlan_2[0x1]; |
| 358 | u8 push_vlan_2[0x1]; | 376 | u8 push_vlan_2[0x1]; |
| 359 | u8 reformat_and_vlan_action[0x1]; | 377 | u8 reformat_and_vlan_action[0x1]; |
| 360 | u8 reserved_at_10[0x2]; | 378 | u8 reserved_at_10[0x1]; |
| 379 | u8 sw_owner[0x1]; | ||
| 361 | u8 reformat_l3_tunnel_to_l2[0x1]; | 380 | u8 reformat_l3_tunnel_to_l2[0x1]; |
| 362 | u8 reformat_l2_to_l3_tunnel[0x1]; | 381 | u8 reformat_l2_to_l3_tunnel[0x1]; |
| 363 | u8 reformat_and_modify_action[0x1]; | 382 | u8 reformat_and_modify_action[0x1]; |
| 364 | u8 reserved_at_15[0xb]; | 383 | u8 reserved_at_15[0x2]; |
| 384 | u8 table_miss_action_domain[0x1]; | ||
| 385 | u8 reserved_at_18[0x8]; | ||
| 365 | u8 reserved_at_20[0x2]; | 386 | u8 reserved_at_20[0x2]; |
| 366 | u8 log_max_ft_size[0x6]; | 387 | u8 log_max_ft_size[0x6]; |
| 367 | u8 log_max_modify_header_context[0x8]; | 388 | u8 log_max_modify_header_context[0x8]; |
| @@ -469,7 +490,9 @@ struct mlx5_ifc_fte_match_set_misc_bits { · 101 unmodified lines | |||
| 469 | u8 vxlan_vni[0x18]; | 490 | u8 vxlan_vni[0x18]; |
| 470 | u8 reserved_at_b8[0x8]; | 491 | u8 reserved_at_b8[0x8]; |
| 471 | 492 | ||
| 472 | u8 reserved_at_c0[0x20]; | 493 | u8 geneve_vni[0x18]; |
| 494 | u8 reserved_at_d8[0x7]; | ||
| 495 | u8 geneve_oam[0x1]; | ||
| 473 | 496 | ||
| 474 | u8 reserved_at_e0[0xc]; | 497 | u8 reserved_at_e0[0xc]; |
| 475 | u8 outer_ipv6_flow_label[0x14]; | 498 | u8 outer_ipv6_flow_label[0x14]; |
| @@ -477,7 +500,11 @@ struct mlx5_ifc_fte_match_set_misc_bits { · 1 unmodified line | |||
| 477 | u8 reserved_at_100[0xc]; | 500 | u8 reserved_at_100[0xc]; |
| 478 | u8 inner_ipv6_flow_label[0x14]; | 501 | u8 inner_ipv6_flow_label[0x14]; |
| 479 | 502 | ||
| 480 | u8 reserved_at_120[0x28]; | 503 | u8 reserved_at_120[0xa]; |
| 504 | u8 geneve_opt_len[0x6]; | ||
| 505 | u8 geneve_protocol_type[0x10]; | ||
| 506 | |||
| 507 | u8 reserved_at_140[0x8]; | ||
| 481 | u8 bth_dst_qp[0x18]; | 508 | u8 bth_dst_qp[0x18]; |
| 482 | u8 reserved_at_160[0x20]; | 509 | u8 reserved_at_160[0x20]; |
| 483 | u8 outer_esp_spi[0x20]; | 510 | u8 outer_esp_spi[0x20]; |
| @@ -507,6 +534,12 @@ struct mlx5_ifc_fte_match_set_misc2_bits { · 23 unmodified lines | |||
| 507 | u8 reserved_at_1a0[0x60]; | 534 | u8 reserved_at_1a0[0x60]; |
| 508 | }; | 535 | }; |
| 509 | 536 | ||
| 537 | struct mlx5_ifc_fte_match_set_misc3_bits { | ||
| 538 | u8 reserved_at_0[0x120]; | ||
| 539 | u8 geneve_tlv_option_0_data[0x20]; | ||
| 540 | u8 reserved_at_140[0xc0]; | ||
| 541 | }; | ||
| 542 | |||
| 510 | struct mlx5_ifc_cmd_pas_bits { | 543 | struct mlx5_ifc_cmd_pas_bits { |
| 511 | u8 pa_h[0x20]; | 544 | u8 pa_h[0x20]; |
| 512 | 545 | ||
| @@ -589,7 +622,7 @@ struct mlx5_ifc_flow_table_nic_cap_bits { · 76 unmodified lines | |||
| 589 | 622 | ||
| 590 | struct mlx5_ifc_flow_table_prop_layout_bits flow_table_properties_nic_receive; | 623 | struct mlx5_ifc_flow_table_prop_layout_bits flow_table_properties_nic_receive; |
| 591 | 624 | ||
| 592 | u8 reserved_at_400[0x200]; | 625 | struct mlx5_ifc_flow_table_prop_layout_bits flow_table_properties_nic_receive_rdma; |
| 593 | 626 | ||
| 594 | struct mlx5_ifc_flow_table_prop_layout_bits flow_table_properties_nic_receive_sniffer; | 627 | struct mlx5_ifc_flow_table_prop_layout_bits flow_table_properties_nic_receive_sniffer; |
| 595 | 628 | ||
| @@ -770,7 +803,19 @@ struct mlx5_ifc_device_mem_cap_bits { · 174 unmodified lines | |||
| 770 | 803 | ||
| 771 | u8 max_memic_size[0x20]; | 804 | u8 max_memic_size[0x20]; |
| 772 | 805 | ||
| 773 | u8 reserved_at_c0[0x740]; | 806 | u8 steering_sw_icm_start_address[0x40]; |
| 807 | |||
| 808 | u8 reserved_at_100[0x8]; | ||
| 809 | u8 log_header_modify_sw_icm_size[0x8]; | ||
| 810 | u8 reserved_at_110[0x2]; | ||
| 811 | u8 log_sw_icm_alloc_granularity[0x6]; | ||
| 812 | u8 log_steering_sw_icm_size[0x8]; | ||
| 813 | |||
| 814 | u8 reserved_at_120[0x20]; | ||
| 815 | |||
| 816 | u8 header_modify_sw_icm_start_address[0x40]; | ||
| 817 | |||
| 818 | u8 reserved_at_180[0x680]; | ||
| 774 | }; | 819 | }; |
| 775 | 820 | ||
| 776 | enum { | 821 | enum { |
| @@ -919,6 +964,7 @@ enum { · 142 unmodified lines | |||
| 919 | 964 | ||
| 920 | enum { | 965 | enum { |
| 921 | MLX5_UCTX_CAP_RAW_TX = 1UL << 0, | 966 | MLX5_UCTX_CAP_RAW_TX = 1UL << 0, |
| 967 | MLX5_UCTX_CAP_INTERNAL_DEV_RES = 1UL << 1, | ||
| 922 | }; | 968 | }; |
| 923 | 969 | ||
| 924 | struct mlx5_ifc_cmd_hca_cap_bits { | 970 | struct mlx5_ifc_cmd_hca_cap_bits { |
| @@ -929,7 +975,9 @@ struct mlx5_ifc_cmd_hca_cap_bits { · 4 unmodified lines | |||
| 929 | 975 | ||
| 930 | u8 log_max_srq_sz[0x8]; | 976 | u8 log_max_srq_sz[0x8]; |
| 931 | u8 log_max_qp_sz[0x8]; | 977 | u8 log_max_qp_sz[0x8]; |
| 932 | u8 reserved_at_90[0xb]; | 978 | u8 reserved_at_90[0x8]; |
| 979 | u8 prio_tag_required[0x1]; | ||
| 980 | u8 reserved_at_99[0x2]; | ||
| 933 | u8 log_max_qp[0x5]; | 981 | u8 log_max_qp[0x5]; |
| 934 | 982 | ||
| 935 | u8 reserved_at_a0[0xb]; | 983 | u8 reserved_at_a0[0xb]; |
| @@ -1211,7 +1259,11 @@ struct mlx5_ifc_cmd_hca_cap_bits { · 275 unmodified lines | |||
| 1211 | u8 num_of_uars_per_page[0x20]; | 1259 | u8 num_of_uars_per_page[0x20]; |
| 1212 | 1260 | ||
| 1213 | u8 flex_parser_protocols[0x20]; | 1261 | u8 flex_parser_protocols[0x20]; |
| 1214 | u8 reserved_at_560[0x20]; | 1262 | |
| 1263 | u8 max_geneve_tlv_options[0x8]; | ||
| 1264 | u8 reserved_at_568[0x3]; | ||
| 1265 | u8 max_geneve_tlv_option_data_len[0x5]; | ||
| 1266 | u8 reserved_at_570[0x10]; | ||
| 1215 | 1267 | ||
| 1216 | u8 reserved_at_580[0x3c]; | 1268 | u8 reserved_at_580[0x3c]; |
| 1217 | u8 mini_cqe_resp_stride_index[0x1]; | 1269 | u8 mini_cqe_resp_stride_index[0x1]; |
| @@ -1247,7 +1299,9 @@ struct mlx5_ifc_cmd_hca_cap_bits { · 29 unmodified lines | |||
| 1247 | 1299 | ||
| 1248 | u8 uctx_cap[0x20]; | 1300 | u8 uctx_cap[0x20]; |
| 1249 | 1301 | ||
| 1250 | u8 reserved_at_6c0[0x140]; | 1302 | u8 reserved_at_6c0[0x4]; |
| 1303 | u8 flex_parser_id_geneve_tlv_option_0[0x4]; | ||
| 1304 | u8 reserved_at_6c8[0x138]; | ||
| 1251 | }; | 1305 | }; |
| 1252 | 1306 | ||
| 1253 | enum mlx5_flow_destination_type { | 1307 | enum mlx5_flow_destination_type { |
| @@ -1260,6 +1314,12 @@ enum mlx5_flow_destination_type { · 6 unmodified lines | |||
| 1260 | MLX5_FLOW_DESTINATION_TYPE_FLOW_TABLE_NUM = 0x101, | 1314 | MLX5_FLOW_DESTINATION_TYPE_FLOW_TABLE_NUM = 0x101, |
| 1261 | }; | 1315 | }; |
| 1262 | 1316 | ||
| 1317 | enum mlx5_flow_table_miss_action { | ||
| 1318 | MLX5_FLOW_TABLE_MISS_ACTION_DEF, | ||
| 1319 | MLX5_FLOW_TABLE_MISS_ACTION_FWD, | ||
| 1320 | MLX5_FLOW_TABLE_MISS_ACTION_SWITCH_DOMAIN, | ||
| 1321 | }; | ||
| 1322 | |||
| 1263 | struct mlx5_ifc_dest_format_struct_bits { | 1323 | struct mlx5_ifc_dest_format_struct_bits { |
| 1264 | u8 destination_type[0x8]; | 1324 | u8 destination_type[0x8]; |
| 1265 | u8 destination_id[0x18]; | 1325 | u8 destination_id[0x18]; |
| @@ -1299,7 +1359,9 @@ struct mlx5_ifc_fte_match_param_bits { · 33 unmodified lines | |||
| 1299 | 1359 | ||
| 1300 | struct mlx5_ifc_fte_match_set_misc2_bits misc_parameters_2; | 1360 | struct mlx5_ifc_fte_match_set_misc2_bits misc_parameters_2; |
| 1301 | 1361 | ||
| 1302 | u8 reserved_at_800[0x800]; | 1362 | struct mlx5_ifc_fte_match_set_misc3_bits misc_parameters_3; |
| 1363 | |||
| 1364 | u8 reserved_at_a00[0x600]; | ||
| 1303 | }; | 1365 | }; |
| 1304 | 1366 | ||
| 1305 | enum { | 1367 | enum { |
| @@ -2920,6 +2982,7 @@ enum { · 1614 unmodified lines | |||
| 2920 | MLX5_MKC_ACCESS_MODE_MTT = 0x1, | 2982 | MLX5_MKC_ACCESS_MODE_MTT = 0x1, |
| 2921 | MLX5_MKC_ACCESS_MODE_KLMS = 0x2, | 2983 | MLX5_MKC_ACCESS_MODE_KLMS = 0x2, |
| 2922 | MLX5_MKC_ACCESS_MODE_KSM = 0x3, | 2984 | MLX5_MKC_ACCESS_MODE_KSM = 0x3, |
| 2985 | MLX5_MKC_ACCESS_MODE_SW_ICM = 0x4, | ||
| 2923 | MLX5_MKC_ACCESS_MODE_MEMIC = 0x5, | 2986 | MLX5_MKC_ACCESS_MODE_MEMIC = 0x5, |
| 2924 | }; | 2987 | }; |
| 2925 | 2988 | ||
| @@ -4807,6 +4870,7 @@ enum { · 1881 unmodified lines | |||
| 4807 | MLX5_QUERY_FLOW_GROUP_OUT_MATCH_CRITERIA_ENABLE_MISC_PARAMETERS = 0x1, | 4870 | MLX5_QUERY_FLOW_GROUP_OUT_MATCH_CRITERIA_ENABLE_MISC_PARAMETERS = 0x1, |
| 4808 | MLX5_QUERY_FLOW_GROUP_OUT_MATCH_CRITERIA_ENABLE_INNER_HEADERS = 0x2, | 4871 | MLX5_QUERY_FLOW_GROUP_OUT_MATCH_CRITERIA_ENABLE_INNER_HEADERS = 0x2, |
| 4809 | MLX5_QUERY_FLOW_GROUP_IN_MATCH_CRITERIA_ENABLE_MISC_PARAMETERS_2 = 0x3, | 4872 | MLX5_QUERY_FLOW_GROUP_IN_MATCH_CRITERIA_ENABLE_MISC_PARAMETERS_2 = 0x3, |
| 4873 | MLX5_QUERY_FLOW_GROUP_IN_MATCH_CRITERIA_ENABLE_MISC_PARAMETERS_3 = 0x4, | ||
| 4810 | }; | 4874 | }; |
| 4811 | 4875 | ||
| 4812 | struct mlx5_ifc_query_flow_group_out_bits { | 4876 | struct mlx5_ifc_query_flow_group_out_bits { |
| @@ -5110,6 +5174,7 @@ enum { · 297 unmodified lines | |||
| 5110 | MLX5_ACTION_IN_FIELD_OUT_DIPV6_31_0 = 0x14, | 5174 | MLX5_ACTION_IN_FIELD_OUT_DIPV6_31_0 = 0x14, |
| 5111 | MLX5_ACTION_IN_FIELD_OUT_SIPV4 = 0x15, | 5175 | MLX5_ACTION_IN_FIELD_OUT_SIPV4 = 0x15, |
| 5112 | MLX5_ACTION_IN_FIELD_OUT_DIPV4 = 0x16, | 5176 | MLX5_ACTION_IN_FIELD_OUT_DIPV4 = 0x16, |
| 5177 | MLX5_ACTION_IN_FIELD_OUT_FIRST_VID = 0x17, | ||
| 5113 | MLX5_ACTION_IN_FIELD_OUT_IPV6_HOPLIMIT = 0x47, | 5178 | MLX5_ACTION_IN_FIELD_OUT_IPV6_HOPLIMIT = 0x47, |
| 5114 | }; | 5179 | }; |
| 5115 | 5180 | ||
| @@ -6874,14 +6939,14 @@ struct mlx5_ifc_create_tis_in_bits { · 1758 unmodified lines | |||
| 6874 | 6939 | ||
| 6875 | struct mlx5_ifc_create_tir_out_bits { | 6940 | struct mlx5_ifc_create_tir_out_bits { |
| 6876 | u8 status[0x8]; | 6941 | u8 status[0x8]; |
| 6877 | u8 reserved_at_8[0x18]; | 6942 | u8 icm_address_63_40[0x18]; |
| 6878 | 6943 | ||
| 6879 | u8 syndrome[0x20]; | 6944 | u8 syndrome[0x20]; |
| 6880 | 6945 | ||
| 6881 | u8 reserved_at_40[0x8]; | 6946 | u8 icm_address_39_32[0x8]; |
| 6882 | u8 tirn[0x18]; | 6947 | u8 tirn[0x18]; |
| 6883 | 6948 | ||
| 6884 | u8 reserved_at_60[0x20]; | 6949 | u8 icm_address_31_0[0x20]; |
| 6885 | }; | 6950 | }; |
| 6886 | 6951 | ||
| 6887 | struct mlx5_ifc_create_tir_in_bits { | 6952 | struct mlx5_ifc_create_tir_in_bits { |
| @@ -8026,6 +8091,52 @@ struct mlx5_ifc_ppcnt_reg_bits { · 1138 unmodified lines | |||
| 8026 | union mlx5_ifc_eth_cntrs_grp_data_layout_auto_bits counter_set; | 8091 | union mlx5_ifc_eth_cntrs_grp_data_layout_auto_bits counter_set; |
| 8027 | }; | 8092 | }; |
| 8028 | 8093 | ||
| 8094 | struct mlx5_ifc_mpein_reg_bits { | ||
| 8095 | u8 reserved_at_0[0x2]; | ||
| 8096 | u8 depth[0x6]; | ||
| 8097 | u8 pcie_index[0x8]; | ||
| 8098 | u8 node[0x8]; | ||
| 8099 | u8 reserved_at_18[0x8]; | ||
| 8100 | |||
| 8101 | u8 capability_mask[0x20]; | ||
| 8102 | |||
| 8103 | u8 reserved_at_40[0x8]; | ||
| 8104 | u8 link_width_enabled[0x8]; | ||
| 8105 | u8 link_speed_enabled[0x10]; | ||
| 8106 | |||
| 8107 | u8 lane0_physical_position[0x8]; | ||
| 8108 | u8 link_width_active[0x8]; | ||
| 8109 | u8 link_speed_active[0x10]; | ||
| 8110 | |||
| 8111 | u8 num_of_pfs[0x10]; | ||
| 8112 | u8 num_of_vfs[0x10]; | ||
| 8113 | |||
| 8114 | u8 bdf0[0x10]; | ||
| 8115 | u8 reserved_at_b0[0x10]; | ||
| 8116 | |||
| 8117 | u8 max_read_request_size[0x4]; | ||
| 8118 | u8 max_payload_size[0x4]; | ||
| 8119 | u8 reserved_at_c8[0x5]; | ||
| 8120 | u8 pwr_status[0x3]; | ||
| 8121 | u8 port_type[0x4]; | ||
| 8122 | u8 reserved_at_d4[0xb]; | ||
| 8123 | u8 lane_reversal[0x1]; | ||
| 8124 | |||
| 8125 | u8 reserved_at_e0[0x14]; | ||
| 8126 | u8 pci_power[0xc]; | ||
| 8127 | |||
| 8128 | u8 reserved_at_100[0x20]; | ||
| 8129 | |||
| 8130 | u8 device_status[0x10]; | ||
| 8131 | u8 port_state[0x8]; | ||
| 8132 | u8 reserved_at_138[0x8]; | ||
| 8133 | |||
| 8134 | u8 reserved_at_140[0x10]; | ||
| 8135 | u8 receiver_detect_result[0x10]; | ||
| 8136 | |||
| 8137 | u8 reserved_at_160[0x20]; | ||
| 8138 | }; | ||
| 8139 | |||
| 8029 | struct mlx5_ifc_mpcnt_reg_bits { | 8140 | struct mlx5_ifc_mpcnt_reg_bits { |
| 8030 | u8 reserved_at_0[0x8]; | 8141 | u8 reserved_at_0[0x8]; |
| 8031 | u8 pcie_index[0x8]; | 8142 | u8 pcie_index[0x8]; |
| @@ -8345,7 +8456,9 @@ struct mlx5_ifc_pcam_reg_bits { · 313 unmodified lines | |||
| 8345 | }; | 8456 | }; |
| 8346 | 8457 | ||
| 8347 | struct mlx5_ifc_mcam_enhanced_features_bits { | 8458 | struct mlx5_ifc_mcam_enhanced_features_bits { |
| 8348 | u8 reserved_at_0[0x74]; | 8459 | u8 reserved_at_0[0x6e]; |
| 8460 | u8 pci_status_and_power[0x1]; | ||
| 8461 | u8 reserved_at_6f[0x5]; | ||
| 8349 | u8 mark_tx_action_cnp[0x1]; | 8462 | u8 mark_tx_action_cnp[0x1]; |
| 8350 | u8 mark_tx_action_cqe[0x1]; | 8463 | u8 mark_tx_action_cqe[0x1]; |
| 8351 | u8 dynamic_tx_overflow[0x1]; | 8464 | u8 dynamic_tx_overflow[0x1]; |
| @@ -8953,6 +9066,7 @@ union mlx5_ifc_ports_control_registers_document_bits { · 601 unmodified lines | |||
| 8953 | struct mlx5_ifc_pmtu_reg_bits pmtu_reg; | 9066 | struct mlx5_ifc_pmtu_reg_bits pmtu_reg; |
| 8954 | struct mlx5_ifc_ppad_reg_bits ppad_reg; | 9067 | struct mlx5_ifc_ppad_reg_bits ppad_reg; |
| 8955 | struct mlx5_ifc_ppcnt_reg_bits ppcnt_reg; | 9068 | struct mlx5_ifc_ppcnt_reg_bits ppcnt_reg; |
| 9069 | struct mlx5_ifc_mpein_reg_bits mpein_reg; | ||
| 8956 | struct mlx5_ifc_mpcnt_reg_bits mpcnt_reg; | 9070 | struct mlx5_ifc_mpcnt_reg_bits mpcnt_reg; |
| 8957 | struct mlx5_ifc_pplm_reg_bits pplm_reg; | 9071 | struct mlx5_ifc_pplm_reg_bits pplm_reg; |
| 8958 | struct mlx5_ifc_pplr_reg_bits pplr_reg; | 9072 | struct mlx5_ifc_pplr_reg_bits pplr_reg; |
| @@ -9442,6 +9556,33 @@ struct mlx5_ifc_uctx_bits { · 483 unmodified lines | |||
| 9442 | u8 reserved_at_20[0x160]; | 9556 | u8 reserved_at_20[0x160]; |
| 9443 | }; | 9557 | }; |
| 9444 | 9558 | ||
| 9559 | struct mlx5_ifc_sw_icm_bits { | ||
| 9560 | u8 modify_field_select[0x40]; | ||
| 9561 | |||
| 9562 | u8 reserved_at_40[0x18]; | ||
| 9563 | u8 log_sw_icm_size[0x8]; | ||
| 9564 | |||
| 9565 | u8 reserved_at_60[0x20]; | ||
| 9566 | |||
| 9567 | u8 sw_icm_start_addr[0x40]; | ||
| 9568 | |||
| 9569 | u8 reserved_at_c0[0x140]; | ||
| 9570 | }; | ||
| 9571 | |||
| 9572 | struct mlx5_ifc_geneve_tlv_option_bits { | ||
| 9573 | u8 modify_field_select[0x40]; | ||
| 9574 | |||
| 9575 | u8 reserved_at_40[0x18]; | ||
| 9576 | u8 geneve_option_fte_index[0x8]; | ||
| 9577 | |||
| 9578 | u8 option_class[0x10]; | ||
| 9579 | u8 option_type[0x8]; | ||
| 9580 | u8 reserved_at_78[0x3]; | ||
| 9581 | u8 option_data_length[0x5]; | ||
| 9582 | |||
| 9583 | u8 reserved_at_80[0x180]; | ||
| 9584 | }; | ||
| 9585 | |||
| 9445 | struct mlx5_ifc_create_umem_in_bits { | 9586 | struct mlx5_ifc_create_umem_in_bits { |
| 9446 | u8 opcode[0x10]; | 9587 | u8 opcode[0x10]; |
| 9447 | u8 uid[0x10]; | 9588 | u8 uid[0x10]; |
| @@ -9479,6 +9620,16 @@ struct mlx5_ifc_destroy_uctx_in_bits { · 31 unmodified lines | |||
| 9479 | u8 reserved_at_60[0x20]; | 9620 | u8 reserved_at_60[0x20]; |
| 9480 | }; | 9621 | }; |
| 9481 | 9622 | ||
| 9623 | struct mlx5_ifc_create_sw_icm_in_bits { | ||
| 9624 | struct mlx5_ifc_general_obj_in_cmd_hdr_bits hdr; | ||
| 9625 | struct mlx5_ifc_sw_icm_bits sw_icm; | ||
| 9626 | }; | ||
| 9627 | |||
| 9628 | struct mlx5_ifc_create_geneve_tlv_option_in_bits { | ||
| 9629 | struct mlx5_ifc_general_obj_in_cmd_hdr_bits hdr; | ||
| 9630 | struct mlx5_ifc_geneve_tlv_option_bits geneve_tlv_opt; | ||
| 9631 | }; | ||
| 9632 | |||
| 9482 | struct mlx5_ifc_mtrc_string_db_param_bits { | 9633 | struct mlx5_ifc_mtrc_string_db_param_bits { |
| 9483 | u8 string_db_base_address[0x20]; | 9634 | u8 string_db_base_address[0x20]; |
| 9484 | 9635 | ||
| @@ -60,6 +60,7 @@ enum mlx5_an_status { · 59 unmodified lines | |||
| 60 | #define MLX5_I2C_ADDR_LOW 0x50 | 60 | #define MLX5_I2C_ADDR_LOW 0x50 |
| 61 | #define MLX5_I2C_ADDR_HIGH 0x51 | 61 | #define MLX5_I2C_ADDR_HIGH 0x51 |
| 62 | #define MLX5_EEPROM_PAGE_LENGTH 256 | 62 | #define MLX5_EEPROM_PAGE_LENGTH 256 |
| 63 | #define MLX5_EEPROM_HIGH_PAGE_LENGTH 128 | ||
| 63 | 64 | ||
| 64 | enum mlx5e_link_mode { | 65 | enum mlx5e_link_mode { |
| 65 | MLX5E_1000BASE_CX_SGMII = 0, | 66 | MLX5E_1000BASE_CX_SGMII = 0, |
| @@ -395,6 +395,7 @@ struct mlx5_wqe_signature_seg { · 394 unmodified lines | |||
| 395 | 395 | ||
| 396 | struct mlx5_wqe_inline_seg { | 396 | struct mlx5_wqe_inline_seg { |
| 397 | __be32 byte_count; | 397 | __be32 byte_count; |
| 398 | __be32 data[0]; | ||
| 398 | }; | 399 | }; |
| 399 | 400 | ||
| 400 | enum mlx5_sig_type { | 401 | enum mlx5_sig_type { |
| @@ -50,6 +50,9 @@ int mlx5_core_query_sq(struct mlx5_core_dev *dev, u32 sqn, u32 *out); · 49 unmodified lines | |||
| 50 | int mlx5_core_query_sq_state(struct mlx5_core_dev *dev, u32 sqn, u8 *state); | 50 | int mlx5_core_query_sq_state(struct mlx5_core_dev *dev, u32 sqn, u8 *state); |
| 51 | int mlx5_core_create_tir(struct mlx5_core_dev *dev, u32 *in, int inlen, | 51 | int mlx5_core_create_tir(struct mlx5_core_dev *dev, u32 *in, int inlen, |
| 52 | u32 *tirn); | 52 | u32 *tirn); |
| 53 | int mlx5_core_create_tir_out(struct mlx5_core_dev *dev, | ||
| 54 | u32 *in, int inlen, | ||
| 55 | u32 *out, int outlen); | ||
| 53 | int mlx5_core_modify_tir(struct mlx5_core_dev *dev, u32 tirn, u32 *in, | 56 | int mlx5_core_modify_tir(struct mlx5_core_dev *dev, u32 tirn, u32 *in, |
| 54 | int inlen); | 57 | int inlen); |
| 55 | void mlx5_core_destroy_tir(struct mlx5_core_dev *dev, u32 tirn); | 58 | void mlx5_core_destroy_tir(struct mlx5_core_dev *dev, u32 tirn); |
| @@ -118,10 +118,6 @@ int mlx5_modify_nic_vport_promisc(struct mlx5_core_dev *mdev, · 117 unmodified lines | |||
| 118 | int promisc_uc, | 118 | int promisc_uc, |
| 119 | int promisc_mc, | 119 | int promisc_mc, |
| 120 | int promisc_all); | 120 | int promisc_all); |
| 121 | int mlx5_query_nic_vport_vlans(struct mlx5_core_dev *dev, | ||
| 122 | u16 vport, | ||
| 123 | u16 vlans[], | ||
| 124 | int *size); | ||
| 125 | int mlx5_modify_nic_vport_vlans(struct mlx5_core_dev *dev, | 121 | int mlx5_modify_nic_vport_vlans(struct mlx5_core_dev *dev, |
| 126 | u16 vlans[], | 122 | u16 vlans[], |
| 127 | int list_size); | 123 | int list_size); |
| @@ -111,6 +111,18 @@ struct sdio_driver { · 110 unmodified lines | |||
| 111 | extern int sdio_register_driver(struct sdio_driver *); | 111 | extern int sdio_register_driver(struct sdio_driver *); |
| 112 | extern void sdio_unregister_driver(struct sdio_driver *); | 112 | extern void sdio_unregister_driver(struct sdio_driver *); |
| 113 | 113 | ||
| 114 | /** | ||
| 115 | * module_sdio_driver() - Helper macro for registering a SDIO driver | ||
| 116 | * @__sdio_driver: sdio_driver struct | ||
| 117 | * | ||
| 118 | * Helper macro for SDIO drivers which do not do anything special in module | ||
| 119 | * init/exit. This eliminates a lot of boilerplate. Each module may only | ||
| 120 | * use this macro once, and calling it replaces module_init() and module_exit() | ||
| 121 | */ | ||
| 122 | #define module_sdio_driver(__sdio_driver) \ | ||
| 123 | module_driver(__sdio_driver, sdio_register_driver, \ | ||
| 124 | sdio_unregister_driver) | ||
| 125 | |||
| 114 | /* | 126 | /* |
| 115 | * SDIO I/O operations | 127 | * SDIO I/O operations |
| 116 | */ | 128 | */ |
| @@ -59,6 +59,8 @@ · 58 unmodified lines | |||
| 59 | #define SDIO_DEVICE_ID_MARVELL_8797_F0 0x9128 | 59 | #define SDIO_DEVICE_ID_MARVELL_8797_F0 0x9128 |
| 60 | #define SDIO_DEVICE_ID_MARVELL_8887WLAN 0x9134 | 60 | #define SDIO_DEVICE_ID_MARVELL_8887WLAN 0x9134 |
| 61 | 61 | ||
| 62 | #define SDIO_VENDOR_ID_MEDIATEK 0x037a | ||
| 63 | |||
| 62 | #define SDIO_VENDOR_ID_SIANO 0x039a | 64 | #define SDIO_VENDOR_ID_SIANO 0x039a |
| 63 | #define SDIO_DEVICE_ID_SIANO_NOVA_B0 0x0201 | 65 | #define SDIO_DEVICE_ID_SIANO_NOVA_B0 0x0201 |
| 64 | #define SDIO_DEVICE_ID_SIANO_NICE 0x0202 | 66 | #define SDIO_DEVICE_ID_SIANO_NICE 0x0202 |
| @@ -161,6 +161,8 @@ struct proto_ops { · 160 unmodified lines | |||
| 161 | int (*compat_ioctl) (struct socket *sock, unsigned int cmd, | 161 | int (*compat_ioctl) (struct socket *sock, unsigned int cmd, |
| 162 | unsigned long arg); | 162 | unsigned long arg); |
| 163 | #endif | 163 | #endif |
| 164 | int (*gettstamp) (struct socket *sock, void __user *userstamp, | ||
| 165 | bool timeval, bool time32); | ||
| 164 | int (*listen) (struct socket *sock, int len); | 166 | int (*listen) (struct socket *sock, int len); |
| 165 | int (*shutdown) (struct socket *sock, int flags); | 167 | int (*shutdown) (struct socket *sock, int flags); |
| 166 | int (*setsockopt)(struct socket *sock, int level, | 168 | int (*setsockopt)(struct socket *sock, int level, |
| @@ -194,8 +194,8 @@ struct net_device_stats { · 193 unmodified lines | |||
| 194 | 194 | ||
| 195 | #ifdef CONFIG_RPS | 195 | #ifdef CONFIG_RPS |
| 196 | #include <linux/static_key.h> | 196 | #include <linux/static_key.h> |
| 197 | extern struct static_key rps_needed; | 197 | extern struct static_key_false rps_needed; |
| 198 | extern struct static_key rfs_needed; | 198 | extern struct static_key_false rfs_needed; |
| 199 | #endif | 199 | #endif |
| 200 | 200 | ||
| 201 | struct neighbour; | 201 | struct neighbour; |
| @@ -914,34 +914,13 @@ struct xfrmdev_ops { · 712 unmodified lines | |||
| 914 | }; | 914 | }; |
| 915 | #endif | 915 | #endif |
| 916 | 916 | ||
| 917 | #if IS_ENABLED(CONFIG_TLS_DEVICE) | ||
| 918 | enum tls_offload_ctx_dir { | ||
| 919 | TLS_OFFLOAD_CTX_DIR_RX, | ||
| 920 | TLS_OFFLOAD_CTX_DIR_TX, | ||
| 921 | }; | ||
| 922 | |||
| 923 | struct tls_crypto_info; | ||
| 924 | struct tls_context; | ||
| 925 | |||
| 926 | struct tlsdev_ops { | ||
| 927 | int (*tls_dev_add)(struct net_device *netdev, struct sock *sk, | ||
| 928 | enum tls_offload_ctx_dir direction, | ||
| 929 | struct tls_crypto_info *crypto_info, | ||
| 930 | u32 start_offload_tcp_sn); | ||
| 931 | void (*tls_dev_del)(struct net_device *netdev, | ||
| 932 | struct tls_context *ctx, | ||
| 933 | enum tls_offload_ctx_dir direction); | ||
| 934 | void (*tls_dev_resync_rx)(struct net_device *netdev, | ||
| 935 | struct sock *sk, u32 seq, u64 rcd_sn); | ||
| 936 | }; | ||
| 937 | #endif | ||
| 938 | |||
| 939 | struct dev_ifalias { | 917 | struct dev_ifalias { |
| 940 | struct rcu_head rcuhead; | 918 | struct rcu_head rcuhead; |
| 941 | char ifalias[]; | 919 | char ifalias[]; |
| 942 | }; | 920 | }; |
| 943 | 921 | ||
| 944 | struct devlink; | 922 | struct devlink; |
| 923 | struct tlsdev_ops; | ||
| 945 | 924 | ||
| 946 | /* | 925 | /* |
| 947 | * This structure defines the management hooks for network devices. | 926 | * This structure defines the management hooks for network devices. |
| @@ -986,8 +965,7 @@ struct devlink; · 38 unmodified lines | |||
| 986 | * those the driver believes to be appropriate. | 965 | * those the driver believes to be appropriate. |
| 987 | * | 966 | * |
| 988 | * u16 (*ndo_select_queue)(struct net_device *dev, struct sk_buff *skb, | 967 | * u16 (*ndo_select_queue)(struct net_device *dev, struct sk_buff *skb, |
| 989 | * struct net_device *sb_dev, | 968 | * struct net_device *sb_dev); |
| 990 | * select_queue_fallback_t fallback); | ||
| 991 | * Called to decide which queue to use when device supports multiple | 969 | * Called to decide which queue to use when device supports multiple |
| 992 | * transmit queues. | 970 | * transmit queues. |
| 993 | * | 971 | * |
| @@ -1251,8 +1229,8 @@ struct devlink; · 257 unmodified lines | |||
| 1251 | * that got dropped are freed/returned via xdp_return_frame(). | 1229 | * that got dropped are freed/returned via xdp_return_frame(). |
| 1252 | * Returns negative number, means general error invoking ndo, meaning | 1230 | * Returns negative number, means general error invoking ndo, meaning |
| 1253 | * no frames were xmit'ed and core-caller will free all frames. | 1231 | * no frames were xmit'ed and core-caller will free all frames. |
| 1254 | * struct devlink *(*ndo_get_devlink)(struct net_device *dev); | 1232 | * struct devlink_port *(*ndo_get_devlink_port)(struct net_device *dev); |
| 1255 | * Get devlink instance associated with a given netdev. | 1233 | * Get devlink port instance associated with a given netdev. |
| 1256 | * Called with a reference on the netdevice and devlink locks only, | 1234 | * Called with a reference on the netdevice and devlink locks only, |
| 1257 | * rtnl_lock is not held. | 1235 | * rtnl_lock is not held. |
| 1258 | */ | 1236 | */ |
| @@ -1268,8 +1246,7 @@ struct net_device_ops { · 9 unmodified lines | |||
| 1268 | netdev_features_t features); | 1246 | netdev_features_t features); |
| 1269 | u16 (*ndo_select_queue)(struct net_device *dev, | 1247 | u16 (*ndo_select_queue)(struct net_device *dev, |
| 1270 | struct sk_buff *skb, | 1248 | struct sk_buff *skb, |
| 1271 | struct net_device *sb_dev, | 1249 | struct net_device *sb_dev); |
| 1272 | select_queue_fallback_t fallback); | ||
| 1273 | void (*ndo_change_rx_flags)(struct net_device *dev, | 1250 | void (*ndo_change_rx_flags)(struct net_device *dev, |
| 1274 | int flags); | 1251 | int flags); |
| 1275 | void (*ndo_set_rx_mode)(struct net_device *dev); | 1252 | void (*ndo_set_rx_mode)(struct net_device *dev); |
| @@ -1453,7 +1430,7 @@ struct net_device_ops { · 177 unmodified lines | |||
| 1453 | u32 flags); | 1430 | u32 flags); |
| 1454 | int (*ndo_xsk_async_xmit)(struct net_device *dev, | 1431 | int (*ndo_xsk_async_xmit)(struct net_device *dev, |
| 1455 | u32 queue_id); | 1432 | u32 queue_id); |
| 1456 | struct devlink * (*ndo_get_devlink)(struct net_device *dev); | 1433 | struct devlink_port * (*ndo_get_devlink_port)(struct net_device *dev); |
| 1457 | }; | 1434 | }; |
| 1458 | 1435 | ||
| 1459 | /** | 1436 | /** |
| @@ -2155,9 +2132,11 @@ static inline void netdev_for_each_tx_queue(struct net_device *dev, · 695 unmodified lines | |||
| 2155 | &qdisc_xmit_lock_key); \ | 2132 | &qdisc_xmit_lock_key); \ |
| 2156 | } | 2133 | } |
| 2157 | 2134 | ||
| 2158 | struct netdev_queue *netdev_pick_tx(struct net_device *dev, | 2135 | u16 netdev_pick_tx(struct net_device *dev, struct sk_buff *skb, |
| 2159 | struct sk_buff *skb, | 2136 | struct net_device *sb_dev); |
| 2160 | struct net_device *sb_dev); | 2137 | struct netdev_queue *netdev_core_pick_tx(struct net_device *dev, |
| 2138 | struct sk_buff *skb, | ||
| 2139 | struct net_device *sb_dev); | ||
| 2161 | 2140 | ||
| 2162 | /* returns the headroom that the master device needs to take in account | 2141 | /* returns the headroom that the master device needs to take in account |
| 2163 | * when forwarding to this dev | 2142 | * when forwarding to this dev |
| @@ -2642,11 +2621,9 @@ void dev_close_many(struct list_head *head, bool unlink); · 478 unmodified lines | |||
| 2642 | void dev_disable_lro(struct net_device *dev); | 2621 | void dev_disable_lro(struct net_device *dev); |
| 2643 | int dev_loopback_xmit(struct net *net, struct sock *sk, struct sk_buff *newskb); | 2622 | int dev_loopback_xmit(struct net *net, struct sock *sk, struct sk_buff *newskb); |
| 2644 | u16 dev_pick_tx_zero(struct net_device *dev, struct sk_buff *skb, | 2623 | u16 dev_pick_tx_zero(struct net_device *dev, struct sk_buff *skb, |
| 2645 | struct net_device *sb_dev, | 2624 | struct net_device *sb_dev); |
| 2646 | select_queue_fallback_t fallback); | ||
| 2647 | u16 dev_pick_tx_cpu_id(struct net_device *dev, struct sk_buff *skb, | 2625 | u16 dev_pick_tx_cpu_id(struct net_device *dev, struct sk_buff *skb, |
| 2648 | struct net_device *sb_dev, | 2626 | struct net_device *sb_dev); |
| 2649 | select_queue_fallback_t fallback); | ||
| 2650 | int dev_queue_xmit(struct sk_buff *skb); | 2627 | int dev_queue_xmit(struct sk_buff *skb); |
| 2651 | int dev_queue_xmit_accel(struct sk_buff *skb, struct net_device *sb_dev); | 2628 | int dev_queue_xmit_accel(struct sk_buff *skb, struct net_device *sb_dev); |
| 2652 | int dev_direct_xmit(struct sk_buff *skb, u16 queue_id); | 2629 | int dev_direct_xmit(struct sk_buff *skb, u16 queue_id); |
| @@ -2664,14 +2641,6 @@ void netdev_freemem(struct net_device *dev); · 11 unmodified lines | |||
| 2664 | void synchronize_net(void); | 2641 | void synchronize_net(void); |
| 2665 | int init_dummy_netdev(struct net_device *dev); | 2642 | int init_dummy_netdev(struct net_device *dev); |
| 2666 | 2643 | ||
| 2667 | DECLARE_PER_CPU(int, xmit_recursion); | ||
| 2668 | #define XMIT_RECURSION_LIMIT 10 | ||
| 2669 | |||
| 2670 | static inline int dev_recursion_level(void) | ||
| 2671 | { | ||
| 2672 | return this_cpu_read(xmit_recursion); | ||
| 2673 | } | ||
| 2674 | |||
| 2675 | struct net_device *dev_get_by_index(struct net *net, int ifindex); | 2644 | struct net_device *dev_get_by_index(struct net *net, int ifindex); |
| 2676 | struct net_device *__dev_get_by_index(struct net *net, int ifindex); | 2645 | struct net_device *__dev_get_by_index(struct net *net, int ifindex); |
| 2677 | struct net_device *dev_get_by_index_rcu(struct net *net, int ifindex); | 2646 | struct net_device *dev_get_by_index_rcu(struct net *net, int ifindex); |
| @@ -3020,6 +2989,11 @@ struct softnet_data { · 342 unmodified lines | |||
| 3020 | #ifdef CONFIG_XFRM_OFFLOAD | 2989 | #ifdef CONFIG_XFRM_OFFLOAD |
| 3021 | struct sk_buff_head xfrm_backlog; | 2990 | struct sk_buff_head xfrm_backlog; |
| 3022 | #endif | 2991 | #endif |
| 2992 | /* written and read only by owning cpu: */ | ||
| 2993 | struct { | ||
| 2994 | u16 recursion; | ||
| 2995 | u8 more; | ||
| 2996 | } xmit; | ||
| 3023 | #ifdef CONFIG_RPS | 2997 | #ifdef CONFIG_RPS |
| 3024 | /* input_queue_head should be written by cpu owning this struct, | 2998 | /* input_queue_head should be written by cpu owning this struct, |
| 3025 | * and only read by other cpus. Worth using a cache line. | 2999 | * and only read by other cpus. Worth using a cache line. |
| @@ -3055,6 +3029,28 @@ static inline void input_queue_tail_incr_save(struct softnet_data *sd, · 29 unmodified lines | |||
| 3055 | 3029 | ||
| 3056 | DECLARE_PER_CPU_ALIGNED(struct softnet_data, softnet_data); | 3030 | DECLARE_PER_CPU_ALIGNED(struct softnet_data, softnet_data); |
| 3057 | 3031 | ||
| 3032 | static inline int dev_recursion_level(void) | ||
| 3033 | { | ||
| 3034 | return this_cpu_read(softnet_data.xmit.recursion); | ||
| 3035 | } | ||
| 3036 | |||
| 3037 | #define XMIT_RECURSION_LIMIT 10 | ||
| 3038 | static inline bool dev_xmit_recursion(void) | ||
| 3039 | { | ||
| 3040 | return unlikely(__this_cpu_read(softnet_data.xmit.recursion) > | ||
| 3041 | XMIT_RECURSION_LIMIT); | ||
| 3042 | } | ||
| 3043 | |||
| 3044 | static inline void dev_xmit_recursion_inc(void) | ||
| 3045 | { | ||
| 3046 | __this_cpu_inc(softnet_data.xmit.recursion); | ||
| 3047 | } | ||
| 3048 | |||
| 3049 | static inline void dev_xmit_recursion_dec(void) | ||
| 3050 | { | ||
| 3051 | __this_cpu_dec(softnet_data.xmit.recursion); | ||
| 3052 | } | ||
| 3053 | |||
| 3058 | void __netif_schedule(struct Qdisc *q); | 3054 | void __netif_schedule(struct Qdisc *q); |
| 3059 | void netif_schedule_queue(struct netdev_queue *txq); | 3055 | void netif_schedule_queue(struct netdev_queue *txq); |
| 3060 | 3056 | ||
| @@ -4410,10 +4406,15 @@ static inline netdev_tx_t __netdev_start_xmit(const struct net_device_ops *ops, · 1349 unmodified lines | |||
| 4410 | struct sk_buff *skb, struct net_device *dev, | 4406 | struct sk_buff *skb, struct net_device *dev, |
| 4411 | bool more) | 4407 | bool more) |
| 4412 | { | 4408 | { |
| 4413 | skb->xmit_more = more ? 1 : 0; | 4409 | __this_cpu_write(softnet_data.xmit.more, more); |
| 4414 | return ops->ndo_start_xmit(skb, dev); | 4410 | return ops->ndo_start_xmit(skb, dev); |
| 4415 | } | 4411 | } |
| 4416 | 4412 | ||
| 4413 | static inline bool netdev_xmit_more(void) | ||
| 4414 | { | ||
| 4415 | return __this_cpu_read(softnet_data.xmit.more); | ||
| 4416 | } | ||
| 4417 | |||
| 4417 | static inline netdev_tx_t netdev_start_xmit(struct sk_buff *skb, struct net_device *dev, | 4418 | static inline netdev_tx_t netdev_start_xmit(struct sk_buff *skb, struct net_device *dev, |
| 4418 | struct netdev_queue *txq, bool more) | 4419 | struct netdev_queue *txq, bool more) |
| 4419 | { | 4420 | { |
| @@ -24,20 +24,36 @@ static inline int NF_DROP_GETERR(int verdict) · 23 unmodified lines | |||
| 24 | static inline int nf_inet_addr_cmp(const union nf_inet_addr *a1, | 24 | static inline int nf_inet_addr_cmp(const union nf_inet_addr *a1, |
| 25 | const union nf_inet_addr *a2) | 25 | const union nf_inet_addr *a2) |
| 26 | { | 26 | { |
| 27 | #if defined(CONFIG_HAVE_EFFICIENT_UNALIGNED_ACCESS) && BITS_PER_LONG == 64 | ||
| 28 | const unsigned long *ul1 = (const unsigned long *)a1; | ||
| 29 | const unsigned long *ul2 = (const unsigned long *)a2; | ||
| 30 | |||
| 31 | return ((ul1[0] ^ ul2[0]) | (ul1[1] ^ ul2[1])) == 0UL; | ||
| 32 | #else | ||
| 27 | return a1->all[0] == a2->all[0] && | 33 | return a1->all[0] == a2->all[0] && |
| 28 | a1->all[1] == a2->all[1] && | 34 | a1->all[1] == a2->all[1] && |
| 29 | a1->all[2] == a2->all[2] && | 35 | a1->all[2] == a2->all[2] && |
| 30 | a1->all[3] == a2->all[3]; | 36 | a1->all[3] == a2->all[3]; |
| 37 | #endif | ||
| 31 | } | 38 | } |
| 32 | 39 | ||
| 33 | static inline void nf_inet_addr_mask(const union nf_inet_addr *a1, | 40 | static inline void nf_inet_addr_mask(const union nf_inet_addr *a1, |
| 34 | union nf_inet_addr *result, | 41 | union nf_inet_addr *result, |
| 35 | const union nf_inet_addr *mask) | 42 | const union nf_inet_addr *mask) |
| 36 | { | 43 | { |
| 44 | #if defined(CONFIG_HAVE_EFFICIENT_UNALIGNED_ACCESS) && BITS_PER_LONG == 64 | ||
| 45 | const unsigned long *ua = (const unsigned long *)a1; | ||
| 46 | unsigned long *ur = (unsigned long *)result; | ||
| 47 | const unsigned long *um = (const unsigned long *)mask; | ||
| 48 | |||
| 49 | ur[0] = ua[0] & um[0]; | ||
| 50 | ur[1] = ua[1] & um[1]; | ||
| 51 | #else | ||
| 37 | result->all[0] = a1->all[0] & mask->all[0]; | 52 | result->all[0] = a1->all[0] & mask->all[0]; |
| 38 | result->all[1] = a1->all[1] & mask->all[1]; | 53 | result->all[1] = a1->all[1] & mask->all[1]; |
| 39 | result->all[2] = a1->all[2] & mask->all[2]; | 54 | result->all[2] = a1->all[2] & mask->all[2]; |
| 40 | result->all[3] = a1->all[3] & mask->all[3]; | 55 | result->all[3] = a1->all[3] & mask->all[3]; |
| 56 | #endif | ||
| 41 | } | 57 | } |
| 42 | 58 | ||
| 43 | int netfilter_init(void); | 59 | int netfilter_init(void); |
| @@ -360,7 +376,7 @@ extern struct nf_nat_hook __rcu *nf_nat_hook; · 316 unmodified lines | |||
| 360 | static inline void | 376 | static inline void |
| 361 | nf_nat_decode_session(struct sk_buff *skb, struct flowi *fl, u_int8_t family) | 377 | nf_nat_decode_session(struct sk_buff *skb, struct flowi *fl, u_int8_t family) |
| 362 | { | 378 | { |
| 363 | #ifdef CONFIG_NF_NAT_NEEDED | 379 | #if IS_ENABLED(CONFIG_NF_NAT) |
| 364 | struct nf_nat_hook *nat_hook; | 380 | struct nf_nat_hook *nat_hook; |
| 365 | 381 | ||
| 366 | rcu_read_lock(); | 382 | rcu_read_lock(); |
| @@ -401,33 +401,30 @@ ip_set_get_h16(const struct nlattr *attr) · 400 unmodified lines | |||
| 401 | return ntohs(nla_get_be16(attr)); | 401 | return ntohs(nla_get_be16(attr)); |
| 402 | } | 402 | } |
| 403 | 403 | ||
| 404 | #define ipset_nest_start(skb, attr) nla_nest_start(skb, attr | NLA_F_NESTED) | ||
| 405 | #define ipset_nest_end(skb, start) nla_nest_end(skb, start) | ||
| 406 | |||
| 407 | static inline int nla_put_ipaddr4(struct sk_buff *skb, int type, __be32 ipaddr) | 404 | static inline int nla_put_ipaddr4(struct sk_buff *skb, int type, __be32 ipaddr) |
| 408 | { | 405 | { |
| 409 | struct nlattr *__nested = ipset_nest_start(skb, type); | 406 | struct nlattr *__nested = nla_nest_start(skb, type); |
| 410 | int ret; | 407 | int ret; |
| 411 | 408 | ||
| 412 | if (!__nested) | 409 | if (!__nested) |
| 413 | return -EMSGSIZE; | 410 | return -EMSGSIZE; |
| 414 | ret = nla_put_in_addr(skb, IPSET_ATTR_IPADDR_IPV4, ipaddr); | 411 | ret = nla_put_in_addr(skb, IPSET_ATTR_IPADDR_IPV4, ipaddr); |
| 415 | if (!ret) | 412 | if (!ret) |
| 416 | ipset_nest_end(skb, __nested); | 413 | nla_nest_end(skb, __nested); |
| 417 | return ret; | 414 | return ret; |
| 418 | } | 415 | } |
| 419 | 416 | ||
| 420 | static inline int nla_put_ipaddr6(struct sk_buff *skb, int type, | 417 | static inline int nla_put_ipaddr6(struct sk_buff *skb, int type, |
| 421 | const struct in6_addr *ipaddrptr) | 418 | const struct in6_addr *ipaddrptr) |
| 422 | { | 419 | { |
| 423 | struct nlattr *__nested = ipset_nest_start(skb, type); | 420 | struct nlattr *__nested = nla_nest_start(skb, type); |
| 424 | int ret; | 421 | int ret; |
| 425 | 422 | ||
| 426 | if (!__nested) | 423 | if (!__nested) |
| 427 | return -EMSGSIZE; | 424 | return -EMSGSIZE; |
| 428 | ret = nla_put_in6_addr(skb, IPSET_ATTR_IPADDR_IPV6, ipaddrptr); | 425 | ret = nla_put_in6_addr(skb, IPSET_ATTR_IPADDR_IPV6, ipaddrptr); |
| 429 | if (!ret) | 426 | if (!ret) |
| 430 | ipset_nest_end(skb, __nested); | 427 | nla_nest_end(skb, __nested); |
| 431 | return ret; | 428 | return ret; |
| 432 | } | 429 | } |
| 433 | 430 | ||
| @@ -21,13 +21,18 @@ struct nf_osf_finger { · 20 unmodified lines | |||
| 21 | struct nf_osf_user_finger finger; | 21 | struct nf_osf_user_finger finger; |
| 22 | }; | 22 | }; |
| 23 | 23 | ||
| 24 | struct nf_osf_data { | ||
| 25 | const char *genre; | ||
| 26 | const char *version; | ||
| 27 | }; | ||
| 28 | |||
| 24 | bool nf_osf_match(const struct sk_buff *skb, u_int8_t family, | 29 | bool nf_osf_match(const struct sk_buff *skb, u_int8_t family, |
| 25 | int hooknum, struct net_device *in, struct net_device *out, | 30 | int hooknum, struct net_device *in, struct net_device *out, |
| 26 | const struct nf_osf_info *info, struct net *net, | 31 | const struct nf_osf_info *info, struct net *net, |
| 27 | const struct list_head *nf_osf_fingers); | 32 | const struct list_head *nf_osf_fingers); |
| 28 | 33 | ||
| 29 | const char *nf_osf_find(const struct sk_buff *skb, | 34 | bool nf_osf_find(const struct sk_buff *skb, |
| 30 | const struct list_head *nf_osf_fingers, | 35 | const struct list_head *nf_osf_fingers, |
| 31 | const int ttl_check); | 36 | const int ttl_check, struct nf_osf_data *data); |
| 32 | 37 | ||
| 33 | #endif /* _NFOSF_H */ | 38 | #endif /* _NFOSF_H */ |
| @@ -317,7 +317,6 @@ struct xt_table_info *xt_replace_table(struct xt_table *table, · 316 unmodified lines | |||
| 317 | int *error); | 317 | int *error); |
| 318 | 318 | ||
| 319 | struct xt_match *xt_find_match(u8 af, const char *name, u8 revision); | 319 | struct xt_match *xt_find_match(u8 af, const char *name, u8 revision); |
| 320 | struct xt_target *xt_find_target(u8 af, const char *name, u8 revision); | ||
| 321 | struct xt_match *xt_request_find_match(u8 af, const char *name, u8 revision); | 320 | struct xt_match *xt_request_find_match(u8 af, const char *name, u8 revision); |
| 322 | struct xt_target *xt_request_find_target(u8 af, const char *name, u8 revision); | 321 | struct xt_target *xt_request_find_target(u8 af, const char *name, u8 revision); |
| 323 | int xt_find_revision(u8 af, const char *name, u8 revision, int target, | 322 | int xt_find_revision(u8 af, const char *name, u8 revision, int target, |
| @@ -87,6 +87,21 @@ static inline int nf_ip6_route(struct net *net, struct dst_entry **dst, · 86 unmodified lines | |||
| 87 | } | 87 | } |
| 88 | 88 | ||
| 89 | int ip6_route_me_harder(struct net *net, struct sk_buff *skb); | 89 | int ip6_route_me_harder(struct net *net, struct sk_buff *skb); |
| 90 | |||
| 91 | static inline int nf_ip6_route_me_harder(struct net *net, struct sk_buff *skb) | ||
| 92 | { | ||
| 93 | #if IS_MODULE(CONFIG_IPV6) | ||
| 94 | const struct nf_ipv6_ops *v6_ops = nf_get_ipv6_ops(); | ||
| 95 | |||
| 96 | if (!v6_ops) | ||
| 97 | return -EHOSTUNREACH; | ||
| 98 | |||
| 99 | return v6_ops->route_me_harder(net, skb); | ||
| 100 | #else | ||
| 101 | return ip6_route_me_harder(net, skb); | ||
| 102 | #endif | ||
| 103 | } | ||
| 104 | |||
| 90 | __sum16 nf_ip6_checksum(struct sk_buff *skb, unsigned int hook, | 105 | __sum16 nf_ip6_checksum(struct sk_buff *skb, unsigned int hook, |
| 91 | unsigned int dataoff, u_int8_t protocol); | 106 | unsigned int dataoff, u_int8_t protocol); |
| 92 | 107 | ||
| @@ -0,0 +1,49 @@ | |||
| 1 | /* SPDX-License-Identifier: BSD-3-Clause | ||
| 2 | * Copyright (c) 2016-2018, NXP Semiconductors | ||
| 3 | * Copyright (c) 2018-2019, Vladimir Oltean <olteanv@gmail.com> | ||
| 4 | */ | ||
| 5 | #ifndef _LINUX_PACKING_H | ||
| 6 | #define _LINUX_PACKING_H | ||
| 7 | |||
| 8 | #include <linux/types.h> | ||
| 9 | #include <linux/bitops.h> | ||
| 10 | |||
| 11 | #define QUIRK_MSB_ON_THE_RIGHT BIT(0) | ||
| 12 | #define QUIRK_LITTLE_ENDIAN BIT(1) | ||
| 13 | #define QUIRK_LSW32_IS_FIRST BIT(2) | ||
| 14 | |||
| 15 | enum packing_op { | ||
| 16 | PACK, | ||
| 17 | UNPACK, | ||
| 18 | }; | ||
| 19 | |||
| 20 | /** | ||
| 21 | * packing - Convert numbers (currently u64) between a packed and an unpacked | ||
| 22 | * format. Unpacked means laid out in memory in the CPU's native | ||
| 23 | * understanding of integers, while packed means anything else that | ||
| 24 | * requires translation. | ||
| 25 | * | ||
| 26 | * @pbuf: Pointer to a buffer holding the packed value. | ||
| 27 | * @uval: Pointer to an u64 holding the unpacked value. | ||
| 28 | * @startbit: The index (in logical notation, compensated for quirks) where | ||
| 29 | * the packed value starts within pbuf. Must be larger than, or | ||
| 30 | * equal to, endbit. | ||
| 31 | * @endbit: The index (in logical notation, compensated for quirks) where | ||
| 32 | * the packed value ends within pbuf. Must be smaller than, or equal | ||
| 33 | * to, startbit. | ||
| 34 | * @op: If PACK, then uval will be treated as const pointer and copied (packed) | ||
| 35 | * into pbuf, between startbit and endbit. | ||
| 36 | * If UNPACK, then pbuf will be treated as const pointer and the logical | ||
| 37 | * value between startbit and endbit will be copied (unpacked) to uval. | ||
| 38 | * @quirks: A bit mask of QUIRK_LITTLE_ENDIAN, QUIRK_LSW32_IS_FIRST and | ||
| 39 | * QUIRK_MSB_ON_THE_RIGHT. | ||
| 40 | * | ||
| 41 | * Return: 0 on success, EINVAL or ERANGE if called incorrectly. Assuming | ||
| 42 | * correct usage, return code may be discarded. | ||
| 43 | * If op is PACK, pbuf is modified. | ||
| 44 | * If op is UNPACK, uval is modified. | ||
| 45 | */ | ||
| 46 | int packing(void *pbuf, u64 *uval, int startbit, int endbit, size_t pbuflen, | ||
| 47 | enum packing_op op, u8 quirks); | ||
| 48 | |||
| 49 | #endif | ||
| @@ -308,13 +308,7 @@ struct phy_device *mdiobus_scan(struct mii_bus *bus, int addr); · 307 unmodified lines | |||
| 308 | * | 308 | * |
| 309 | * HALTED: PHY is up, but no polling or interrupts are done. Or | 309 | * HALTED: PHY is up, but no polling or interrupts are done. Or |
| 310 | * PHY is in an error state. | 310 | * PHY is in an error state. |
| 311 | * | 311 | * - phy_start moves to UP |
| 312 | * - phy_start moves to RESUMING | ||
| 313 | * | ||
| 314 | * RESUMING: PHY was halted, but now wants to run again. | ||
| 315 | * - If we are forcing, or aneg is done, timer moves to RUNNING | ||
| 316 | * - If aneg is not done, timer moves to AN | ||
| 317 | * - phy_stop moves to HALTED | ||
| 318 | */ | 312 | */ |
| 319 | enum phy_state { | 313 | enum phy_state { |
| 320 | PHY_DOWN = 0, | 314 | PHY_DOWN = 0, |
| @@ -324,7 +318,6 @@ enum phy_state { · 3 unmodified lines | |||
| 324 | PHY_RUNNING, | 318 | PHY_RUNNING, |
| 325 | PHY_NOLINK, | 319 | PHY_NOLINK, |
| 326 | PHY_FORCING, | 320 | PHY_FORCING, |
| 327 | PHY_RESUMING | ||
| 328 | }; | 321 | }; |
| 329 | 322 | ||
| 330 | /** | 323 | /** |
| @@ -345,6 +338,7 @@ struct phy_c45_device_ids { · 14 unmodified lines | |||
| 345 | * is_c45: Set to true if this phy uses clause 45 addressing. | 338 | * is_c45: Set to true if this phy uses clause 45 addressing. |
| 346 | * is_internal: Set to true if this phy is internal to a MAC. | 339 | * is_internal: Set to true if this phy is internal to a MAC. |
| 347 | * is_pseudo_fixed_link: Set to true if this phy is an Ethernet switch, etc. | 340 | * is_pseudo_fixed_link: Set to true if this phy is an Ethernet switch, etc. |
| 341 | * is_gigabit_capable: Set to true if PHY supports 1000Mbps | ||
| 348 | * has_fixups: Set to true if this phy has fixups/quirks. | 342 | * has_fixups: Set to true if this phy has fixups/quirks. |
| 349 | * suspended: Set to true if this phy has been suspended successfully. | 343 | * suspended: Set to true if this phy has been suspended successfully. |
| 350 | * sysfs_links: Internal boolean tracking sysfs symbolic links setup/removal. | 344 | * sysfs_links: Internal boolean tracking sysfs symbolic links setup/removal. |
| @@ -382,6 +376,7 @@ struct phy_device { · 31 unmodified lines | |||
| 382 | unsigned is_c45:1; | 376 | unsigned is_c45:1; |
| 383 | unsigned is_internal:1; | 377 | unsigned is_internal:1; |
| 384 | unsigned is_pseudo_fixed_link:1; | 378 | unsigned is_pseudo_fixed_link:1; |
| 379 | unsigned is_gigabit_capable:1; | ||
| 385 | unsigned has_fixups:1; | 380 | unsigned has_fixups:1; |
| 386 | unsigned suspended:1; | 381 | unsigned suspended:1; |
| 387 | unsigned sysfs_links:1; | 382 | unsigned sysfs_links:1; |
| @@ -390,6 +385,7 @@ struct phy_device { · 2 unmodified lines | |||
| 390 | unsigned autoneg:1; | 385 | unsigned autoneg:1; |
| 391 | /* The most recently read link state */ | 386 | /* The most recently read link state */ |
| 392 | unsigned link:1; | 387 | unsigned link:1; |
| 388 | unsigned autoneg_complete:1; | ||
| 393 | 389 | ||
| 394 | /* Interrupts are enabled */ | 390 | /* Interrupts are enabled */ |
| 395 | unsigned interrupts:1; | 391 | unsigned interrupts:1; |
| @@ -1075,6 +1071,7 @@ void phy_attached_info(struct phy_device *phydev); · 679 unmodified lines | |||
| 1075 | 1071 | ||
| 1076 | /* Clause 22 PHY */ | 1072 | /* Clause 22 PHY */ |
| 1077 | int genphy_config_init(struct phy_device *phydev); | 1073 | int genphy_config_init(struct phy_device *phydev); |
| 1074 | int genphy_read_abilities(struct phy_device *phydev); | ||
| 1078 | int genphy_setup_forced(struct phy_device *phydev); | 1075 | int genphy_setup_forced(struct phy_device *phydev); |
| 1079 | int genphy_restart_aneg(struct phy_device *phydev); | 1076 | int genphy_restart_aneg(struct phy_device *phydev); |
| 1080 | int genphy_config_eee_advert(struct phy_device *phydev); | 1077 | int genphy_config_eee_advert(struct phy_device *phydev); |
| @@ -1150,6 +1147,7 @@ void phy_request_interrupt(struct phy_device *phydev); · 69 unmodified lines | |||
| 1150 | void phy_print_status(struct phy_device *phydev); | 1147 | void phy_print_status(struct phy_device *phydev); |
| 1151 | int phy_set_max_speed(struct phy_device *phydev, u32 max_speed); | 1148 | int phy_set_max_speed(struct phy_device *phydev, u32 max_speed); |
| 1152 | void phy_remove_link_mode(struct phy_device *phydev, u32 link_mode); | 1149 | void phy_remove_link_mode(struct phy_device *phydev, u32 link_mode); |
| 1150 | void phy_advertise_supported(struct phy_device *phydev); | ||
| 1153 | void phy_support_sym_pause(struct phy_device *phydev); | 1151 | void phy_support_sym_pause(struct phy_device *phydev); |
| 1154 | void phy_support_asym_pause(struct phy_device *phydev); | 1152 | void phy_support_asym_pause(struct phy_device *phydev); |
| 1155 | void phy_set_sym_pause(struct phy_device *phydev, bool rx, bool tx, | 1153 | void phy_set_sym_pause(struct phy_device *phydev, bool rx, bool tx, |
| @@ -12,19 +12,10 @@ · 11 unmodified lines | |||
| 12 | 12 | ||
| 13 | /** | 13 | /** |
| 14 | * struct macb_platform_data - platform data for MACB Ethernet | 14 | * struct macb_platform_data - platform data for MACB Ethernet |
| 15 | * @phy_mask: phy mask passed when register the MDIO bus | ||
| 16 | * within the driver | ||
| 17 | * @phy_irq_pin: PHY IRQ | ||
| 18 | * @is_rmii: using RMII interface? | ||
| 19 | * @rev_eth_addr: reverse Ethernet address byte order | ||
| 20 | * @pclk: platform clock | 15 | * @pclk: platform clock |
| 21 | * @hclk: AHB clock | 16 | * @hclk: AHB clock |
| 22 | */ | 17 | */ |
| 23 | struct macb_platform_data { | 18 | struct macb_platform_data { |
| 24 | u32 phy_mask; | ||
| 25 | int phy_irq_pin; | ||
| 26 | u8 is_rmii; | ||
| 27 | u8 rev_eth_addr; | ||
| 28 | struct clk *pclk; | 19 | struct clk *pclk; |
| 29 | struct clk *hclk; | 20 | struct clk *hclk; |
| 30 | }; | 21 | }; |
| @@ -13,6 +13,7 @@ struct dsa_mv88e6xxx_pdata { · 12 unmodified lines | |||
| 13 | unsigned int enabled_ports; | 13 | unsigned int enabled_ports; |
| 14 | struct net_device *netdev; | 14 | struct net_device *netdev; |
| 15 | u32 eeprom_len; | 15 | u32 eeprom_len; |
| 16 | int irq; | ||
| 16 | }; | 17 | }; |
| 17 | 18 | ||
| 18 | #endif | 19 | #endif |
| @@ -0,0 +1,32 @@ | |||
| 1 | /* SPDX-License-Identifier: GPL-2.0 */ | ||
| 2 | #ifndef __LINUX_XILINX_LL_TEMAC_H | ||
| 3 | #define __LINUX_XILINX_LL_TEMAC_H | ||
| 4 | |||
| 5 | #include <linux/if_ether.h> | ||
| 6 | #include <linux/phy.h> | ||
| 7 | |||
| 8 | struct ll_temac_platform_data { | ||
| 9 | bool txcsum; /* Enable/disable TX checksum */ | ||
| 10 | bool rxcsum; /* Enable/disable RX checksum */ | ||
| 11 | u8 mac_addr[ETH_ALEN]; /* MAC address (6 bytes) */ | ||
| 12 | /* Clock frequency for input to MDIO clock generator */ | ||
| 13 | u32 mdio_clk_freq; | ||
| 14 | unsigned long long mdio_bus_id; /* Unique id for MDIO bus */ | ||
| 15 | int phy_addr; /* Address of the PHY to connect to */ | ||
| 16 | phy_interface_t phy_interface; /* PHY interface mode */ | ||
| 17 | bool reg_little_endian; /* Little endian TEMAC register access */ | ||
| 18 | bool dma_little_endian; /* Little endian DMA register access */ | ||
| 19 | /* Pre-initialized mutex to use for synchronizing indirect | ||
| 20 | * register access. When using both interfaces of a single | ||
| 21 | * TEMAC IP block, the same mutex should be passed here, as | ||
| 22 | * they share the same DCR bus bridge. | ||
| 23 | */ | ||
| 24 | struct mutex *indirect_mutex; | ||
| 25 | /* DMA channel control setup */ | ||
| 26 | u8 tx_irq_timeout; /* TX Interrupt Delay Time-out */ | ||
| 27 | u8 tx_irq_count; /* TX Interrupt Coalescing Threshold Count */ | ||
| 28 | u8 rx_irq_timeout; /* RX Interrupt Delay Time-out */ | ||
| 29 | u8 rx_irq_count; /* RX Interrupt Coalescing Threshold Count */ | ||
| 30 | }; | ||
| 31 | |||
| 32 | #endif /* __LINUX_XILINX_LL_TEMAC_H */ | ||
| @@ -48,7 +48,6 @@ typedef int (*rht_obj_cmpfn_t)(struct rhashtable_compare_arg *arg, · 47 unmodified lines | |||
| 48 | * @head_offset: Offset of rhash_head in struct to be hashed | 48 | * @head_offset: Offset of rhash_head in struct to be hashed |
| 49 | * @max_size: Maximum size while expanding | 49 | * @max_size: Maximum size while expanding |
| 50 | * @min_size: Minimum size while shrinking | 50 | * @min_size: Minimum size while shrinking |
| 51 | * @locks_mul: Number of bucket locks to allocate per cpu (default: 32) | ||
| 52 | * @automatic_shrinking: Enable automatic shrinking of tables | 51 | * @automatic_shrinking: Enable automatic shrinking of tables |
| 53 | * @hashfn: Hash function (default: jhash2 if !(key_len % 4), or jhash) | 52 | * @hashfn: Hash function (default: jhash2 if !(key_len % 4), or jhash) |
| 54 | * @obj_hashfn: Function to hash object | 53 | * @obj_hashfn: Function to hash object |
| @@ -62,7 +61,6 @@ struct rhashtable_params { · 7 unmodified lines | |||
| 62 | unsigned int max_size; | 61 | unsigned int max_size; |
| 63 | u16 min_size; | 62 | u16 min_size; |
| 64 | bool automatic_shrinking; | 63 | bool automatic_shrinking; |
| 65 | u8 locks_mul; | ||
| 66 | rht_hashfn_t hashfn; | 64 | rht_hashfn_t hashfn; |
| 67 | rht_obj_hashfn_t obj_hashfn; | 65 | rht_obj_hashfn_t obj_hashfn; |
| 68 | rht_obj_cmpfn_t obj_cmpfn; | 66 | rht_obj_cmpfn_t obj_cmpfn; |
| @@ -24,12 +24,27 @@ · 23 unmodified lines | |||
| 24 | #include <linux/list_nulls.h> | 24 | #include <linux/list_nulls.h> |
| 25 | #include <linux/workqueue.h> | 25 | #include <linux/workqueue.h> |
| 26 | #include <linux/rculist.h> | 26 | #include <linux/rculist.h> |
| 27 | #include <linux/bit_spinlock.h> | ||
| 27 | 28 | ||
| 28 | #include <linux/rhashtable-types.h> | 29 | #include <linux/rhashtable-types.h> |
| 29 | /* | 30 | /* |
| 31 | * Objects in an rhashtable have an embedded struct rhash_head | ||
| 32 | * which is linked into as hash chain from the hash table - or one | ||
| 33 | * of two or more hash tables when the rhashtable is being resized. | ||
| 30 | * The end of the chain is marked with a special nulls marks which has | 34 | * The end of the chain is marked with a special nulls marks which has |
| 31 | * the least significant bit set. | 35 | * the least significant bit set but otherwise stores the address of |
| 36 | * the hash bucket. This allows us to be be sure we've found the end | ||
| 37 | * of the right list. | ||
| 38 | * The value stored in the hash bucket has BIT(0) used as a lock bit. | ||
| 39 | * This bit must be atomically set before any changes are made to | ||
| 40 | * the chain. To avoid dereferencing this pointer without clearing | ||
| 41 | * the bit first, we use an opaque 'struct rhash_lock_head *' for the | ||
| 42 | * pointer stored in the bucket. This struct needs to be defined so | ||
| 43 | * that rcu_dereference() works on it, but it has no content so a | ||
| 44 | * cast is needed for it to be useful. This ensures it isn't | ||
| 45 | * used by mistake with clearing the lock bit first. | ||
| 32 | */ | 46 | */ |
| 47 | struct rhash_lock_head {}; | ||
| 33 | 48 | ||
| 34 | /* Maximum chain length before rehash | 49 | /* Maximum chain length before rehash |
| 35 | * | 50 | * |
| @@ -52,8 +67,6 @@ · 16 unmodified lines | |||
| 52 | * @nest: Number of bits of first-level nested table. | 67 | * @nest: Number of bits of first-level nested table. |
| 53 | * @rehash: Current bucket being rehashed | 68 | * @rehash: Current bucket being rehashed |
| 54 | * @hash_rnd: Random seed to fold into hash | 69 | * @hash_rnd: Random seed to fold into hash |
| 55 | * @locks_mask: Mask to apply before accessing locks[] | ||
| 56 | * @locks: Array of spinlocks protecting individual buckets | ||
| 57 | * @walkers: List of active walkers | 70 | * @walkers: List of active walkers |
| 58 | * @rcu: RCU structure for freeing the table | 71 | * @rcu: RCU structure for freeing the table |
| 59 | * @future_tbl: Table under construction during rehashing | 72 | * @future_tbl: Table under construction during rehashing |
| @@ -63,31 +76,34 @@ · 3 unmodified lines | |||
| 63 | struct bucket_table { | 76 | struct bucket_table { |
| 64 | unsigned int size; | 77 | unsigned int size; |
| 65 | unsigned int nest; | 78 | unsigned int nest; |
| 66 | unsigned int rehash; | ||
| 67 | u32 hash_rnd; | 79 | u32 hash_rnd; |
| 68 | unsigned int locks_mask; | ||
| 69 | spinlock_t *locks; | ||
| 70 | struct list_head walkers; | 80 | struct list_head walkers; |
| 71 | struct rcu_head rcu; | 81 | struct rcu_head rcu; |
| 72 | 82 | ||
| 73 | struct bucket_table __rcu *future_tbl; | 83 | struct bucket_table __rcu *future_tbl; |
| 74 | 84 | ||
| 75 | struct rhash_head __rcu *buckets[] ____cacheline_aligned_in_smp; | 85 | struct lockdep_map dep_map; |
| 86 | |||
| 87 | struct rhash_lock_head __rcu *buckets[] ____cacheline_aligned_in_smp; | ||
| 76 | }; | 88 | }; |
| 77 | 89 | ||
| 78 | /* | 90 | /* |
| 79 | * NULLS_MARKER() expects a hash value with the low | 91 | * NULLS_MARKER() expects a hash value with the low |
| 80 | * bits mostly likely to be significant, and it discards | 92 | * bits mostly likely to be significant, and it discards |
| 81 | * the msb. | 93 | * the msb. |
| 82 | * We git it an address, in which the bottom 2 bits are | 94 | * We give it an address, in which the bottom bit is |
| 83 | * always 0, and the msb might be significant. | 95 | * always 0, and the msb might be significant. |
| 84 | * So we shift the address down one bit to align with | 96 | * So we shift the address down one bit to align with |
| 85 | * expectations and avoid losing a significant bit. | 97 | * expectations and avoid losing a significant bit. |
| 98 | * | ||
| 99 | * We never store the NULLS_MARKER in the hash table | ||
| 100 | * itself as we need the lsb for locking. | ||
| 101 | * Instead we store a NULL | ||
| 86 | */ | 102 | */ |
| 87 | #define RHT_NULLS_MARKER(ptr) \ | 103 | #define RHT_NULLS_MARKER(ptr) \ |
| 88 | ((void *)NULLS_MARKER(((unsigned long) (ptr)) >> 1)) | 104 | ((void *)NULLS_MARKER(((unsigned long) (ptr)) >> 1)) |
| 89 | #define INIT_RHT_NULLS_HEAD(ptr) \ | 105 | #define INIT_RHT_NULLS_HEAD(ptr) \ |
| 90 | ((ptr) = RHT_NULLS_MARKER(&(ptr))) | 106 | ((ptr) = NULL) |
| 91 | 107 | ||
| 92 | static inline bool rht_is_a_nulls(const struct rhash_head *ptr) | 108 | static inline bool rht_is_a_nulls(const struct rhash_head *ptr) |
| 93 | { | 109 | { |
| @@ -207,25 +223,6 @@ static inline bool rht_grow_above_max(const struct rhashtable *ht, · 113 unmodified lines | |||
| 207 | return atomic_read(&ht->nelems) >= ht->max_elems; | 223 | return atomic_read(&ht->nelems) >= ht->max_elems; |
| 208 | } | 224 | } |
| 209 | 225 | ||
| 210 | /* The bucket lock is selected based on the hash and protects mutations | ||
| 211 | * on a group of hash buckets. | ||
| 212 | * | ||
| 213 | * A maximum of tbl->size/2 bucket locks is allocated. This ensures that | ||
| 214 | * a single lock always covers both buckets which may both contains | ||
| 215 | * entries which link to the same bucket of the old table during resizing. | ||
| 216 | * This allows to simplify the locking as locking the bucket in both | ||
| 217 | * tables during resize always guarantee protection. | ||
| 218 | * | ||
| 219 | * IMPORTANT: When holding the bucket lock of both the old and new table | ||
| 220 | * during expansions and shrinking, the old bucket lock must always be | ||
| 221 | * acquired first. | ||
| 222 | */ | ||
| 223 | static inline spinlock_t *rht_bucket_lock(const struct bucket_table *tbl, | ||
| 224 | unsigned int hash) | ||
| 225 | { | ||
| 226 | return &tbl->locks[hash & tbl->locks_mask]; | ||
| 227 | } | ||
| 228 | |||
| 229 | #ifdef CONFIG_PROVE_LOCKING | 226 | #ifdef CONFIG_PROVE_LOCKING |
| 230 | int lockdep_rht_mutex_is_held(struct rhashtable *ht); | 227 | int lockdep_rht_mutex_is_held(struct rhashtable *ht); |
| 231 | int lockdep_rht_bucket_is_held(const struct bucket_table *tbl, u32 hash); | 228 | int lockdep_rht_bucket_is_held(const struct bucket_table *tbl, u32 hash); |
| @@ -264,11 +261,13 @@ void rhashtable_free_and_destroy(struct rhashtable *ht, · 32 unmodified lines | |||
| 264 | void *arg); | 261 | void *arg); |
| 265 | void rhashtable_destroy(struct rhashtable *ht); | 262 | void rhashtable_destroy(struct rhashtable *ht); |
| 266 | 263 | ||
| 267 | struct rhash_head __rcu **rht_bucket_nested(const struct bucket_table *tbl, | 264 | struct rhash_lock_head __rcu **rht_bucket_nested(const struct bucket_table *tbl, |
| 268 | unsigned int hash); | 265 | unsigned int hash); |
| 269 | struct rhash_head __rcu **rht_bucket_nested_insert(struct rhashtable *ht, | 266 | struct rhash_lock_head __rcu **__rht_bucket_nested(const struct bucket_table *tbl, |
| 270 | struct bucket_table *tbl, | ||
| 271 | unsigned int hash); | 267 | unsigned int hash); |
| 268 | struct rhash_lock_head __rcu **rht_bucket_nested_insert(struct rhashtable *ht, | ||
| 269 | struct bucket_table *tbl, | ||
| 270 | unsigned int hash); | ||
| 272 | 271 | ||
| 273 | #define rht_dereference(p, ht) \ | 272 | #define rht_dereference(p, ht) \ |
| 274 | rcu_dereference_protected(p, lockdep_rht_mutex_is_held(ht)) | 273 | rcu_dereference_protected(p, lockdep_rht_mutex_is_held(ht)) |
| @@ -285,37 +284,136 @@ struct rhash_head __rcu **rht_bucket_nested_insert(struct rhashtable *ht, · 10 unmodified lines | |||
| 285 | #define rht_entry(tpos, pos, member) \ | 284 | #define rht_entry(tpos, pos, member) \ |
| 286 | ({ tpos = container_of(pos, typeof(*tpos), member); 1; }) | 285 | ({ tpos = container_of(pos, typeof(*tpos), member); 1; }) |
| 287 | 286 | ||
| 288 | static inline struct rhash_head __rcu *const *rht_bucket( | 287 | static inline struct rhash_lock_head __rcu *const *rht_bucket( |
| 289 | const struct bucket_table *tbl, unsigned int hash) | 288 | const struct bucket_table *tbl, unsigned int hash) |
| 290 | { | 289 | { |
| 291 | return unlikely(tbl->nest) ? rht_bucket_nested(tbl, hash) : | 290 | return unlikely(tbl->nest) ? rht_bucket_nested(tbl, hash) : |
| 292 | &tbl->buckets[hash]; | 291 | &tbl->buckets[hash]; |
| 293 | } | 292 | } |
| 294 | 293 | ||
| 295 | static inline struct rhash_head __rcu **rht_bucket_var( | 294 | static inline struct rhash_lock_head __rcu **rht_bucket_var( |
| 296 | struct bucket_table *tbl, unsigned int hash) | 295 | struct bucket_table *tbl, unsigned int hash) |
| 297 | { | 296 | { |
| 298 | return unlikely(tbl->nest) ? rht_bucket_nested(tbl, hash) : | 297 | return unlikely(tbl->nest) ? __rht_bucket_nested(tbl, hash) : |
| 299 | &tbl->buckets[hash]; | 298 | &tbl->buckets[hash]; |
| 300 | } | 299 | } |
| 301 | 300 | ||
| 302 | static inline struct rhash_head __rcu **rht_bucket_insert( | 301 | static inline struct rhash_lock_head __rcu **rht_bucket_insert( |
| 303 | struct rhashtable *ht, struct bucket_table *tbl, unsigned int hash) | 302 | struct rhashtable *ht, struct bucket_table *tbl, unsigned int hash) |
| 304 | { | 303 | { |
| 305 | return unlikely(tbl->nest) ? rht_bucket_nested_insert(ht, tbl, hash) : | 304 | return unlikely(tbl->nest) ? rht_bucket_nested_insert(ht, tbl, hash) : |
| 306 | &tbl->buckets[hash]; | 305 | &tbl->buckets[hash]; |
| 307 | } | 306 | } |
| 308 | 307 | ||
| 308 | /* | ||
| 309 | * We lock a bucket by setting BIT(0) in the pointer - this is always | ||
| 310 | * zero in real pointers. The NULLS mark is never stored in the bucket, | ||
| 311 | * rather we store NULL if the bucket is empty. | ||
| 312 | * bit_spin_locks do not handle contention well, but the whole point | ||
| 313 | * of the hashtable design is to achieve minimum per-bucket contention. | ||
| 314 | * A nested hash table might not have a bucket pointer. In that case | ||
| 315 | * we cannot get a lock. For remove and replace the bucket cannot be | ||
| 316 | * interesting and doesn't need locking. | ||
| 317 | * For insert we allocate the bucket if this is the last bucket_table, | ||
| 318 | * and then take the lock. | ||
| 319 | * Sometimes we unlock a bucket by writing a new pointer there. In that | ||
| 320 | * case we don't need to unlock, but we do need to reset state such as | ||
| 321 | * local_bh. For that we have rht_assign_unlock(). As rcu_assign_pointer() | ||
| 322 | * provides the same release semantics that bit_spin_unlock() provides, | ||
| 323 | * this is safe. | ||
| 324 | * When we write to a bucket without unlocking, we use rht_assign_locked(). | ||
| 325 | */ | ||
| 326 | |||
| 327 | static inline void rht_lock(struct bucket_table *tbl, | ||
| 328 | struct rhash_lock_head **bkt) | ||
| 329 | { | ||
| 330 | local_bh_disable(); | ||
| 331 | bit_spin_lock(0, (unsigned long *)bkt); | ||
| 332 | lock_map_acquire(&tbl->dep_map); | ||
| 333 | } | ||
| 334 | |||
| 335 | static inline void rht_lock_nested(struct bucket_table *tbl, | ||
| 336 | struct rhash_lock_head **bucket, | ||
| 337 | unsigned int subclass) | ||
| 338 | { | ||
| 339 | local_bh_disable(); | ||
| 340 | bit_spin_lock(0, (unsigned long *)bucket); | ||
| 341 | lock_acquire_exclusive(&tbl->dep_map, subclass, 0, NULL, _THIS_IP_); | ||
| 342 | } | ||
| 343 | |||
| 344 | static inline void rht_unlock(struct bucket_table *tbl, | ||
| 345 | struct rhash_lock_head **bkt) | ||
| 346 | { | ||
| 347 | lock_map_release(&tbl->dep_map); | ||
| 348 | bit_spin_unlock(0, (unsigned long *)bkt); | ||
| 349 | local_bh_enable(); | ||
| 350 | } | ||
| 351 | |||
| 352 | /* | ||
| 353 | * Where 'bkt' is a bucket and might be locked: | ||
| 354 | * rht_ptr() dereferences that pointer and clears the lock bit. | ||
| 355 | * rht_ptr_exclusive() dereferences in a context where exclusive | ||
| 356 | * access is guaranteed, such as when destroying the table. | ||
| 357 | */ | ||
| 358 | static inline struct rhash_head *rht_ptr( | ||
| 359 | struct rhash_lock_head __rcu * const *bkt, | ||
| 360 | struct bucket_table *tbl, | ||
| 361 | unsigned int hash) | ||
| 362 | { | ||
| 363 | const struct rhash_lock_head *p = | ||
| 364 | rht_dereference_bucket_rcu(*bkt, tbl, hash); | ||
| 365 | |||
| 366 | if ((((unsigned long)p) & ~BIT(0)) == 0) | ||
| 367 | return RHT_NULLS_MARKER(bkt); | ||
| 368 | return (void *)(((unsigned long)p) & ~BIT(0)); | ||
| 369 | } | ||
| 370 | |||
| 371 | static inline struct rhash_head *rht_ptr_exclusive( | ||
| 372 | struct rhash_lock_head __rcu * const *bkt) | ||
| 373 | { | ||
| 374 | const struct rhash_lock_head *p = | ||
| 375 | rcu_dereference_protected(*bkt, 1); | ||
| 376 | |||
| 377 | if (!p) | ||
| 378 | return RHT_NULLS_MARKER(bkt); | ||
| 379 | return (void *)(((unsigned long)p) & ~BIT(0)); | ||
| 380 | } | ||
| 381 | |||
| 382 | static inline void rht_assign_locked(struct rhash_lock_head __rcu **bkt, | ||
| 383 | struct rhash_head *obj) | ||
| 384 | { | ||
| 385 | struct rhash_head __rcu **p = (struct rhash_head __rcu **)bkt; | ||
| 386 | |||
| 387 | if (rht_is_a_nulls(obj)) | ||
| 388 | obj = NULL; | ||
| 389 | rcu_assign_pointer(*p, (void *)((unsigned long)obj | BIT(0))); | ||
| 390 | } | ||
| 391 | |||
| 392 | static inline void rht_assign_unlock(struct bucket_table *tbl, | ||
| 393 | struct rhash_lock_head __rcu **bkt, | ||
| 394 | struct rhash_head *obj) | ||
| 395 | { | ||
| 396 | struct rhash_head __rcu **p = (struct rhash_head __rcu **)bkt; | ||
| 397 | |||
| 398 | if (rht_is_a_nulls(obj)) | ||
| 399 | obj = NULL; | ||
| 400 | lock_map_release(&tbl->dep_map); | ||
| 401 | rcu_assign_pointer(*p, obj); | ||
| 402 | preempt_enable(); | ||
| 403 | __release(bitlock); | ||
| 404 | local_bh_enable(); | ||
| 405 | } | ||
| 406 | |||
| 309 | /** | 407 | /** |
| 310 | * rht_for_each_continue - continue iterating over hash chain | 408 | * rht_for_each_from - iterate over hash chain from given head |
| 311 | * @pos: the &struct rhash_head to use as a loop cursor. | 409 | * @pos: the &struct rhash_head to use as a loop cursor. |
| 312 | * @head: the previous &struct rhash_head to continue from | 410 | * @head: the &struct rhash_head to start from |
| 313 | * @tbl: the &struct bucket_table | 411 | * @tbl: the &struct bucket_table |
| 314 | * @hash: the hash value / bucket index | 412 | * @hash: the hash value / bucket index |
| 315 | */ | 413 | */ |
| 316 | #define rht_for_each_continue(pos, head, tbl, hash) \ | 414 | #define rht_for_each_from(pos, head, tbl, hash) \ |
| 317 | for (pos = rht_dereference_bucket(head, tbl, hash); \ | 415 | for (pos = head; \ |
| 318 | !rht_is_a_nulls(pos); \ | 416 | !rht_is_a_nulls(pos); \ |
| 319 | pos = rht_dereference_bucket((pos)->next, tbl, hash)) | 417 | pos = rht_dereference_bucket((pos)->next, tbl, hash)) |
| 320 | 418 | ||
| 321 | /** | 419 | /** |
| @@ -325,19 +423,20 @@ static inline struct rhash_head __rcu **rht_bucket_insert( · 3 unmodified lines | |||
| 325 | * @hash: the hash value / bucket index | 423 | * @hash: the hash value / bucket index |
| 326 | */ | 424 | */ |
| 327 | #define rht_for_each(pos, tbl, hash) \ | 425 | #define rht_for_each(pos, tbl, hash) \ |
| 328 | rht_for_each_continue(pos, *rht_bucket(tbl, hash), tbl, hash) | 426 | rht_for_each_from(pos, rht_ptr(rht_bucket(tbl, hash), tbl, hash), \ |
| 427 | tbl, hash) | ||
| 329 | 428 | ||
| 330 | /** | 429 | /** |
| 331 | * rht_for_each_entry_continue - continue iterating over hash chain | 430 | * rht_for_each_entry_from - iterate over hash chain from given head |
| 332 | * @tpos: the type * to use as a loop cursor. | 431 | * @tpos: the type * to use as a loop cursor. |
| 333 | * @pos: the &struct rhash_head to use as a loop cursor. | 432 | * @pos: the &struct rhash_head to use as a loop cursor. |
| 334 | * @head: the previous &struct rhash_head to continue from | 433 | * @head: the &struct rhash_head to start from |
| 335 | * @tbl: the &struct bucket_table | 434 | * @tbl: the &struct bucket_table |
| 336 | * @hash: the hash value / bucket index | 435 | * @hash: the hash value / bucket index |
| 337 | * @member: name of the &struct rhash_head within the hashable struct. | 436 | * @member: name of the &struct rhash_head within the hashable struct. |
| 338 | */ | 437 | */ |
| 339 | #define rht_for_each_entry_continue(tpos, pos, head, tbl, hash, member) \ | 438 | #define rht_for_each_entry_from(tpos, pos, head, tbl, hash, member) \ |
| 340 | for (pos = rht_dereference_bucket(head, tbl, hash); \ | 439 | for (pos = head; \ |
| 341 | (!rht_is_a_nulls(pos)) && rht_entry(tpos, pos, member); \ | 440 | (!rht_is_a_nulls(pos)) && rht_entry(tpos, pos, member); \ |
| 342 | pos = rht_dereference_bucket((pos)->next, tbl, hash)) | 441 | pos = rht_dereference_bucket((pos)->next, tbl, hash)) |
| 343 | 442 | ||
| @@ -350,8 +449,9 @@ static inline struct rhash_head __rcu **rht_bucket_insert( · 6 unmodified lines | |||
| 350 | * @member: name of the &struct rhash_head within the hashable struct. | 449 | * @member: name of the &struct rhash_head within the hashable struct. |
| 351 | */ | 450 | */ |
| 352 | #define rht_for_each_entry(tpos, pos, tbl, hash, member) \ | 451 | #define rht_for_each_entry(tpos, pos, tbl, hash, member) \ |
| 353 | rht_for_each_entry_continue(tpos, pos, *rht_bucket(tbl, hash), \ | 452 | rht_for_each_entry_from(tpos, pos, \ |
| 354 | tbl, hash, member) | 453 | rht_ptr(rht_bucket(tbl, hash), tbl, hash), \ |
| 454 | tbl, hash, member) | ||
| 355 | 455 | ||
| 356 | /** | 456 | /** |
| 357 | * rht_for_each_entry_safe - safely iterate over hash chain of given type | 457 | * rht_for_each_entry_safe - safely iterate over hash chain of given type |
| @@ -366,7 +466,7 @@ static inline struct rhash_head __rcu **rht_bucket_insert( · 8 unmodified lines | |||
| 366 | * remove the loop cursor from the list. | 466 | * remove the loop cursor from the list. |
| 367 | */ | 467 | */ |
| 368 | #define rht_for_each_entry_safe(tpos, pos, next, tbl, hash, member) \ | 468 | #define rht_for_each_entry_safe(tpos, pos, next, tbl, hash, member) \ |
| 369 | for (pos = rht_dereference_bucket(*rht_bucket(tbl, hash), tbl, hash), \ | 469 | for (pos = rht_ptr(rht_bucket(tbl, hash), tbl, hash), \ |
| 370 | next = !rht_is_a_nulls(pos) ? \ | 470 | next = !rht_is_a_nulls(pos) ? \ |
| 371 | rht_dereference_bucket(pos->next, tbl, hash) : NULL; \ | 471 | rht_dereference_bucket(pos->next, tbl, hash) : NULL; \ |
| 372 | (!rht_is_a_nulls(pos)) && rht_entry(tpos, pos, member); \ | 472 | (!rht_is_a_nulls(pos)) && rht_entry(tpos, pos, member); \ |
| @@ -375,9 +475,9 @@ static inline struct rhash_head __rcu **rht_bucket_insert( · 2 unmodified lines | |||
| 375 | rht_dereference_bucket(pos->next, tbl, hash) : NULL) | 475 | rht_dereference_bucket(pos->next, tbl, hash) : NULL) |
| 376 | 476 | ||
| 377 | /** | 477 | /** |
| 378 | * rht_for_each_rcu_continue - continue iterating over rcu hash chain | 478 | * rht_for_each_rcu_from - iterate over rcu hash chain from given head |
| 379 | * @pos: the &struct rhash_head to use as a loop cursor. | 479 | * @pos: the &struct rhash_head to use as a loop cursor. |
| 380 | * @head: the previous &struct rhash_head to continue from | 480 | * @head: the &struct rhash_head to start from |
| 381 | * @tbl: the &struct bucket_table | 481 | * @tbl: the &struct bucket_table |
| 382 | * @hash: the hash value / bucket index | 482 | * @hash: the hash value / bucket index |
| 383 | * | 483 | * |
| @@ -385,9 +485,9 @@ static inline struct rhash_head __rcu **rht_bucket_insert( · 1 unmodified line | |||
| 385 | * the _rcu mutation primitives such as rhashtable_insert() as long as the | 485 | * the _rcu mutation primitives such as rhashtable_insert() as long as the |
| 386 | * traversal is guarded by rcu_read_lock(). | 486 | * traversal is guarded by rcu_read_lock(). |
| 387 | */ | 487 | */ |
| 388 | #define rht_for_each_rcu_continue(pos, head, tbl, hash) \ | 488 | #define rht_for_each_rcu_from(pos, head, tbl, hash) \ |
| 389 | for (({barrier(); }), \ | 489 | for (({barrier(); }), \ |
| 390 | pos = rht_dereference_bucket_rcu(head, tbl, hash); \ | 490 | pos = head; \ |
| 391 | !rht_is_a_nulls(pos); \ | 491 | !rht_is_a_nulls(pos); \ |
| 392 | pos = rcu_dereference_raw(pos->next)) | 492 | pos = rcu_dereference_raw(pos->next)) |
| 393 | 493 | ||
| @@ -401,14 +501,17 @@ static inline struct rhash_head __rcu **rht_bucket_insert( · 7 unmodified lines | |||
| 401 | * the _rcu mutation primitives such as rhashtable_insert() as long as the | 501 | * the _rcu mutation primitives such as rhashtable_insert() as long as the |
| 402 | * traversal is guarded by rcu_read_lock(). | 502 | * traversal is guarded by rcu_read_lock(). |
| 403 | */ | 503 | */ |
| 404 | #define rht_for_each_rcu(pos, tbl, hash) \ | 504 | #define rht_for_each_rcu(pos, tbl, hash) \ |
| 405 | rht_for_each_rcu_continue(pos, *rht_bucket(tbl, hash), tbl, hash) | 505 | for (({barrier(); }), \ |
| 506 | pos = rht_ptr(rht_bucket(tbl, hash), tbl, hash); \ | ||
| 507 | !rht_is_a_nulls(pos); \ | ||
| 508 | pos = rcu_dereference_raw(pos->next)) | ||
| 406 | 509 | ||
| 407 | /** | 510 | /** |
| 408 | * rht_for_each_entry_rcu_continue - continue iterating over rcu hash chain | 511 | * rht_for_each_entry_rcu_from - iterated over rcu hash chain from given head |
| 409 | * @tpos: the type * to use as a loop cursor. | 512 | * @tpos: the type * to use as a loop cursor. |
| 410 | * @pos: the &struct rhash_head to use as a loop cursor. | 513 | * @pos: the &struct rhash_head to use as a loop cursor. |
| 411 | * @head: the previous &struct rhash_head to continue from | 514 | * @head: the &struct rhash_head to start from |
| 412 | * @tbl: the &struct bucket_table | 515 | * @tbl: the &struct bucket_table |
| 413 | * @hash: the hash value / bucket index | 516 | * @hash: the hash value / bucket index |
| 414 | * @member: name of the &struct rhash_head within the hashable struct. | 517 | * @member: name of the &struct rhash_head within the hashable struct. |
| @@ -417,9 +520,9 @@ static inline struct rhash_head __rcu **rht_bucket_insert( · 2 unmodified lines | |||
| 417 | * the _rcu mutation primitives such as rhashtable_insert() as long as the | 520 | * the _rcu mutation primitives such as rhashtable_insert() as long as the |
| 418 | * traversal is guarded by rcu_read_lock(). | 521 | * traversal is guarded by rcu_read_lock(). |
| 419 | */ | 522 | */ |
| 420 | #define rht_for_each_entry_rcu_continue(tpos, pos, head, tbl, hash, member) \ | 523 | #define rht_for_each_entry_rcu_from(tpos, pos, head, tbl, hash, member) \ |
| 421 | for (({barrier(); }), \ | 524 | for (({barrier(); }), \ |
| 422 | pos = rht_dereference_bucket_rcu(head, tbl, hash); \ | 525 | pos = head; \ |
| 423 | (!rht_is_a_nulls(pos)) && rht_entry(tpos, pos, member); \ | 526 | (!rht_is_a_nulls(pos)) && rht_entry(tpos, pos, member); \ |
| 424 | pos = rht_dereference_bucket_rcu(pos->next, tbl, hash)) | 527 | pos = rht_dereference_bucket_rcu(pos->next, tbl, hash)) |
| 425 | 528 | ||
| @@ -436,8 +539,10 @@ static inline struct rhash_head __rcu **rht_bucket_insert( · 10 unmodified lines | |||
| 436 | * traversal is guarded by rcu_read_lock(). | 539 | * traversal is guarded by rcu_read_lock(). |
| 437 | */ | 540 | */ |
| 438 | #define rht_for_each_entry_rcu(tpos, pos, tbl, hash, member) \ | 541 | #define rht_for_each_entry_rcu(tpos, pos, tbl, hash, member) \ |
| 439 | rht_for_each_entry_rcu_continue(tpos, pos, *rht_bucket(tbl, hash), \ | 542 | rht_for_each_entry_rcu_from(tpos, pos, \ |
| 440 | tbl, hash, member) | 543 | rht_ptr(rht_bucket(tbl, hash), \ |
| 544 | tbl, hash), \ | ||
| 545 | tbl, hash, member) | ||
| 441 | 546 | ||
| 442 | /** | 547 | /** |
| 443 | * rhl_for_each_rcu - iterate over rcu hash table list | 548 | * rhl_for_each_rcu - iterate over rcu hash table list |
| @@ -482,7 +587,7 @@ static inline struct rhash_head *__rhashtable_lookup( · 38 unmodified lines | |||
| 482 | .ht = ht, | 587 | .ht = ht, |
| 483 | .key = key, | 588 | .key = key, |
| 484 | }; | 589 | }; |
| 485 | struct rhash_head __rcu * const *head; | 590 | struct rhash_lock_head __rcu * const *bkt; |
| 486 | struct bucket_table *tbl; | 591 | struct bucket_table *tbl; |
| 487 | struct rhash_head *he; | 592 | struct rhash_head *he; |
| 488 | unsigned int hash; | 593 | unsigned int hash; |
| @@ -490,9 +595,9 @@ static inline struct rhash_head *__rhashtable_lookup( · 1 unmodified line | |||
| 490 | tbl = rht_dereference_rcu(ht->tbl, ht); | 595 | tbl = rht_dereference_rcu(ht->tbl, ht); |
| 491 | restart: | 596 | restart: |
| 492 | hash = rht_key_hashfn(ht, tbl, key, params); | 597 | hash = rht_key_hashfn(ht, tbl, key, params); |
| 493 | head = rht_bucket(tbl, hash); | 598 | bkt = rht_bucket(tbl, hash); |
| 494 | do { | 599 | do { |
| 495 | rht_for_each_rcu_continue(he, *head, tbl, hash) { | 600 | rht_for_each_rcu_from(he, rht_ptr(bkt, tbl, hash), tbl, hash) { |
| 496 | if (params.obj_cmpfn ? | 601 | if (params.obj_cmpfn ? |
| 497 | params.obj_cmpfn(&arg, rht_obj(ht, he)) : | 602 | params.obj_cmpfn(&arg, rht_obj(ht, he)) : |
| 498 | rhashtable_compare(&arg, rht_obj(ht, he))) | 603 | rhashtable_compare(&arg, rht_obj(ht, he))) |
| @@ -502,7 +607,7 @@ restart: · 3 unmodified lines | |||
| 502 | /* An object might have been moved to a different hash chain, | 607 | /* An object might have been moved to a different hash chain, |
| 503 | * while we walk along it - better check and retry. | 608 | * while we walk along it - better check and retry. |
| 504 | */ | 609 | */ |
| 505 | } while (he != RHT_NULLS_MARKER(head)); | 610 | } while (he != RHT_NULLS_MARKER(bkt)); |
| 506 | 611 | ||
| 507 | /* Ensure we see any new tables. */ | 612 | /* Ensure we see any new tables. */ |
| 508 | smp_rmb(); | 613 | smp_rmb(); |
| @@ -598,10 +703,10 @@ static inline void *__rhashtable_insert_fast( · 89 unmodified lines | |||
| 598 | .ht = ht, | 703 | .ht = ht, |
| 599 | .key = key, | 704 | .key = key, |
| 600 | }; | 705 | }; |
| 706 | struct rhash_lock_head __rcu **bkt; | ||
| 601 | struct rhash_head __rcu **pprev; | 707 | struct rhash_head __rcu **pprev; |
| 602 | struct bucket_table *tbl; | 708 | struct bucket_table *tbl; |
| 603 | struct rhash_head *head; | 709 | struct rhash_head *head; |
| 604 | spinlock_t *lock; | ||
| 605 | unsigned int hash; | 710 | unsigned int hash; |
| 606 | int elasticity; | 711 | int elasticity; |
| 607 | void *data; | 712 | void *data; |
| @@ -610,23 +715,22 @@ static inline void *__rhashtable_insert_fast( · 2 unmodified lines | |||
| 610 | 715 | ||
| 611 | tbl = rht_dereference_rcu(ht->tbl, ht); | 716 | tbl = rht_dereference_rcu(ht->tbl, ht); |
| 612 | hash = rht_head_hashfn(ht, tbl, obj, params); | 717 | hash = rht_head_hashfn(ht, tbl, obj, params); |
| 613 | lock = rht_bucket_lock(tbl, hash); | 718 | elasticity = RHT_ELASTICITY; |
| 614 | spin_lock_bh(lock); | 719 | bkt = rht_bucket_insert(ht, tbl, hash); |
| 720 | data = ERR_PTR(-ENOMEM); | ||
| 721 | if (!bkt) | ||
| 722 | goto out; | ||
| 723 | pprev = NULL; | ||
| 724 | rht_lock(tbl, bkt); | ||
| 615 | 725 | ||
| 616 | if (unlikely(rcu_access_pointer(tbl->future_tbl))) { | 726 | if (unlikely(rcu_access_pointer(tbl->future_tbl))) { |
| 617 | slow_path: | 727 | slow_path: |
| 618 | spin_unlock_bh(lock); | 728 | rht_unlock(tbl, bkt); |
| 619 | rcu_read_unlock(); | 729 | rcu_read_unlock(); |
| 620 | return rhashtable_insert_slow(ht, key, obj); | 730 | return rhashtable_insert_slow(ht, key, obj); |
| 621 | } | 731 | } |
| 622 | 732 | ||
| 623 | elasticity = RHT_ELASTICITY; | 733 | rht_for_each_from(head, rht_ptr(bkt, tbl, hash), tbl, hash) { |
| 624 | pprev = rht_bucket_insert(ht, tbl, hash); | ||
| 625 | data = ERR_PTR(-ENOMEM); | ||
| 626 | if (!pprev) | ||
| 627 | goto out; | ||
| 628 | |||
| 629 | rht_for_each_continue(head, *pprev, tbl, hash) { | ||
| 630 | struct rhlist_head *plist; | 734 | struct rhlist_head *plist; |
| 631 | struct rhlist_head *list; | 735 | struct rhlist_head *list; |
| 632 | 736 | ||
| @@ -642,7 +746,7 @@ slow_path: · 9 unmodified lines | |||
| 642 | data = rht_obj(ht, head); | 746 | data = rht_obj(ht, head); |
| 643 | 747 | ||
| 644 | if (!rhlist) | 748 | if (!rhlist) |
| 645 | goto out; | 749 | goto out_unlock; |
| 646 | 750 | ||
| 647 | 751 | ||
| 648 | list = container_of(obj, struct rhlist_head, rhead); | 752 | list = container_of(obj, struct rhlist_head, rhead); |
| @@ -651,9 +755,13 @@ slow_path: · 2 unmodified lines | |||
| 651 | RCU_INIT_POINTER(list->next, plist); | 755 | RCU_INIT_POINTER(list->next, plist); |
| 652 | head = rht_dereference_bucket(head->next, tbl, hash); | 756 | head = rht_dereference_bucket(head->next, tbl, hash); |
| 653 | RCU_INIT_POINTER(list->rhead.next, head); | 757 | RCU_INIT_POINTER(list->rhead.next, head); |
| 654 | rcu_assign_pointer(*pprev, obj); | 758 | if (pprev) { |
| 655 | 759 | rcu_assign_pointer(*pprev, obj); | |
| 656 | goto good; | 760 | rht_unlock(tbl, bkt); |
| 761 | } else | ||
| 762 | rht_assign_unlock(tbl, bkt, obj); | ||
| 763 | data = NULL; | ||
| 764 | goto out; | ||
| 657 | } | 765 | } |
| 658 | 766 | ||
| 659 | if (elasticity <= 0) | 767 | if (elasticity <= 0) |
| @@ -661,12 +769,13 @@ slow_path: · 1 unmodified line | |||
| 661 | 769 | ||
| 662 | data = ERR_PTR(-E2BIG); | 770 | data = ERR_PTR(-E2BIG); |
| 663 | if (unlikely(rht_grow_above_max(ht, tbl))) | 771 | if (unlikely(rht_grow_above_max(ht, tbl))) |
| 664 | goto out; | 772 | goto out_unlock; |
| 665 | 773 | ||
| 666 | if (unlikely(rht_grow_above_100(ht, tbl))) | 774 | if (unlikely(rht_grow_above_100(ht, tbl))) |
| 667 | goto slow_path; | 775 | goto slow_path; |
| 668 | 776 | ||
| 669 | head = rht_dereference_bucket(*pprev, tbl, hash); | 777 | /* Inserting at head of list makes unlocking free. */ |
| 778 | head = rht_ptr(bkt, tbl, hash); | ||
| 670 | 779 | ||
| 671 | RCU_INIT_POINTER(obj->next, head); | 780 | RCU_INIT_POINTER(obj->next, head); |
| 672 | if (rhlist) { | 781 | if (rhlist) { |
| @@ -676,20 +785,21 @@ slow_path: · 3 unmodified lines | |||
| 676 | RCU_INIT_POINTER(list->next, NULL); | 785 | RCU_INIT_POINTER(list->next, NULL); |
| 677 | } | 786 | } |
| 678 | 787 | ||
| 679 | rcu_assign_pointer(*pprev, obj); | ||
| 680 | |||
| 681 | atomic_inc(&ht->nelems); | 788 | atomic_inc(&ht->nelems); |
| 789 | rht_assign_unlock(tbl, bkt, obj); | ||
| 790 | |||
| 682 | if (rht_grow_above_75(ht, tbl)) | 791 | if (rht_grow_above_75(ht, tbl)) |
| 683 | schedule_work(&ht->run_work); | 792 | schedule_work(&ht->run_work); |
| 684 | 793 | ||
| 685 | good: | ||
| 686 | data = NULL; | 794 | data = NULL; |
| 687 | |||
| 688 | out: | 795 | out: |
| 689 | spin_unlock_bh(lock); | ||
| 690 | rcu_read_unlock(); | 796 | rcu_read_unlock(); |
| 691 | 797 | ||
| 692 | return data; | 798 | return data; |
| 799 | |||
| 800 | out_unlock: | ||
| 801 | rht_unlock(tbl, bkt); | ||
| 802 | goto out; | ||
| 693 | } | 803 | } |
| 694 | 804 | ||
| 695 | /** | 805 | /** |
| @@ -698,9 +808,9 @@ out: · 2 unmodified lines | |||
| 698 | * @obj: pointer to hash head inside object | 808 | * @obj: pointer to hash head inside object |
| 699 | * @params: hash table parameters | 809 | * @params: hash table parameters |
| 700 | * | 810 | * |
| 701 | * Will take a per bucket spinlock to protect against mutual mutations | 811 | * Will take the per bucket bitlock to protect against mutual mutations |
| 702 | * on the same bucket. Multiple insertions may occur in parallel unless | 812 | * on the same bucket. Multiple insertions may occur in parallel unless |
| 703 | * they map to the same bucket lock. | 813 | * they map to the same bucket. |
| 704 | * | 814 | * |
| 705 | * It is safe to call this function from atomic context. | 815 | * It is safe to call this function from atomic context. |
| 706 | * | 816 | * |
| @@ -727,9 +837,9 @@ static inline int rhashtable_insert_fast( · 20 unmodified lines | |||
| 727 | * @list: pointer to hash list head inside object | 837 | * @list: pointer to hash list head inside object |
| 728 | * @params: hash table parameters | 838 | * @params: hash table parameters |
| 729 | * | 839 | * |
| 730 | * Will take a per bucket spinlock to protect against mutual mutations | 840 | * Will take the per bucket bitlock to protect against mutual mutations |
| 731 | * on the same bucket. Multiple insertions may occur in parallel unless | 841 | * on the same bucket. Multiple insertions may occur in parallel unless |
| 732 | * they map to the same bucket lock. | 842 | * they map to the same bucket. |
| 733 | * | 843 | * |
| 734 | * It is safe to call this function from atomic context. | 844 | * It is safe to call this function from atomic context. |
| 735 | * | 845 | * |
| @@ -750,9 +860,9 @@ static inline int rhltable_insert_key( · 14 unmodified lines | |||
| 750 | * @list: pointer to hash list head inside object | 860 | * @list: pointer to hash list head inside object |
| 751 | * @params: hash table parameters | 861 | * @params: hash table parameters |
| 752 | * | 862 | * |
| 753 | * Will take a per bucket spinlock to protect against mutual mutations | 863 | * Will take the per bucket bitlock to protect against mutual mutations |
| 754 | * on the same bucket. Multiple insertions may occur in parallel unless | 864 | * on the same bucket. Multiple insertions may occur in parallel unless |
| 755 | * they map to the same bucket lock. | 865 | * they map to the same bucket. |
| 756 | * | 866 | * |
| 757 | * It is safe to call this function from atomic context. | 867 | * It is safe to call this function from atomic context. |
| 758 | * | 868 | * |
| @@ -776,12 +886,6 @@ static inline int rhltable_insert( · 17 unmodified lines | |||
| 776 | * @obj: pointer to hash head inside object | 886 | * @obj: pointer to hash head inside object |
| 777 | * @params: hash table parameters | 887 | * @params: hash table parameters |
| 778 | * | 888 | * |
| 779 | * Locks down the bucket chain in both the old and new table if a resize | ||
| 780 | * is in progress to ensure that writers can't remove from the old table | ||
| 781 | * and can't insert to the new table during the atomic operation of search | ||
| 782 | * and insertion. Searches for duplicates in both the old and new table if | ||
| 783 | * a resize is in progress. | ||
| 784 | * | ||
| 785 | * This lookup function may only be used for fixed key hash table (key_len | 889 | * This lookup function may only be used for fixed key hash table (key_len |
| 786 | * parameter set). It will BUG() if used inappropriately. | 890 | * parameter set). It will BUG() if used inappropriately. |
| 787 | * | 891 | * |
| @@ -837,12 +941,6 @@ static inline void *rhashtable_lookup_get_insert_fast( · 49 unmodified lines | |||
| 837 | * @obj: pointer to hash head inside object | 941 | * @obj: pointer to hash head inside object |
| 838 | * @params: hash table parameters | 942 | * @params: hash table parameters |
| 839 | * | 943 | * |
| 840 | * Locks down the bucket chain in both the old and new table if a resize | ||
| 841 | * is in progress to ensure that writers can't remove from the old table | ||
| 842 | * and can't insert to the new table during the atomic operation of search | ||
| 843 | * and insertion. Searches for duplicates in both the old and new table if | ||
| 844 | * a resize is in progress. | ||
| 845 | * | ||
| 846 | * Lookups may occur in parallel with hashtable mutations and resizing. | 944 | * Lookups may occur in parallel with hashtable mutations and resizing. |
| 847 | * | 945 | * |
| 848 | * Will trigger an automatic deferred table resizing if residency in the | 946 | * Will trigger an automatic deferred table resizing if residency in the |
| @@ -891,19 +989,20 @@ static inline int __rhashtable_remove_fast_one( · 42 unmodified lines | |||
| 891 | struct rhash_head *obj, const struct rhashtable_params params, | 989 | struct rhash_head *obj, const struct rhashtable_params params, |
| 892 | bool rhlist) | 990 | bool rhlist) |
| 893 | { | 991 | { |
| 992 | struct rhash_lock_head __rcu **bkt; | ||
| 894 | struct rhash_head __rcu **pprev; | 993 | struct rhash_head __rcu **pprev; |
| 895 | struct rhash_head *he; | 994 | struct rhash_head *he; |
| 896 | spinlock_t * lock; | ||
| 897 | unsigned int hash; | 995 | unsigned int hash; |
| 898 | int err = -ENOENT; | 996 | int err = -ENOENT; |
| 899 | 997 | ||
| 900 | hash = rht_head_hashfn(ht, tbl, obj, params); | 998 | hash = rht_head_hashfn(ht, tbl, obj, params); |
| 901 | lock = rht_bucket_lock(tbl, hash); | 999 | bkt = rht_bucket_var(tbl, hash); |
| 902 | 1000 | if (!bkt) | |
| 903 | spin_lock_bh(lock); | 1001 | return -ENOENT; |
| 1002 | pprev = NULL; | ||
| 1003 | rht_lock(tbl, bkt); | ||
| 904 | 1004 | ||
| 905 | pprev = rht_bucket_var(tbl, hash); | 1005 | rht_for_each_from(he, rht_ptr(bkt, tbl, hash), tbl, hash) { |
| 906 | rht_for_each_continue(he, *pprev, tbl, hash) { | ||
| 907 | struct rhlist_head *list; | 1006 | struct rhlist_head *list; |
| 908 | 1007 | ||
| 909 | list = container_of(he, struct rhlist_head, rhead); | 1008 | list = container_of(he, struct rhlist_head, rhead); |
| @@ -943,12 +1042,17 @@ static inline int __rhashtable_remove_fast_one( · 33 unmodified lines | |||
| 943 | } | 1042 | } |
| 944 | } | 1043 | } |
| 945 | 1044 | ||
| 946 | rcu_assign_pointer(*pprev, obj); | 1045 | if (pprev) { |
| 947 | break; | 1046 | rcu_assign_pointer(*pprev, obj); |
| 1047 | rht_unlock(tbl, bkt); | ||
| 1048 | } else { | ||
| 1049 | rht_assign_unlock(tbl, bkt, obj); | ||
| 1050 | } | ||
| 1051 | goto unlocked; | ||
| 948 | } | 1052 | } |
| 949 | 1053 | ||
| 950 | spin_unlock_bh(lock); | 1054 | rht_unlock(tbl, bkt); |
| 951 | 1055 | unlocked: | |
| 952 | if (err > 0) { | 1056 | if (err > 0) { |
| 953 | atomic_dec(&ht->nelems); | 1057 | atomic_dec(&ht->nelems); |
| 954 | if (unlikely(ht->p.automatic_shrinking && | 1058 | if (unlikely(ht->p.automatic_shrinking && |
| @@ -1037,9 +1141,9 @@ static inline int __rhashtable_replace_fast( · 82 unmodified lines | |||
| 1037 | struct rhash_head *obj_old, struct rhash_head *obj_new, | 1141 | struct rhash_head *obj_old, struct rhash_head *obj_new, |
| 1038 | const struct rhashtable_params params) | 1142 | const struct rhashtable_params params) |
| 1039 | { | 1143 | { |
| 1144 | struct rhash_lock_head __rcu **bkt; | ||
| 1040 | struct rhash_head __rcu **pprev; | 1145 | struct rhash_head __rcu **pprev; |
| 1041 | struct rhash_head *he; | 1146 | struct rhash_head *he; |
| 1042 | spinlock_t *lock; | ||
| 1043 | unsigned int hash; | 1147 | unsigned int hash; |
| 1044 | int err = -ENOENT; | 1148 | int err = -ENOENT; |
| 1045 | 1149 | ||
| @@ -1050,25 +1154,33 @@ static inline int __rhashtable_replace_fast( · 4 unmodified lines | |||
| 1050 | if (hash != rht_head_hashfn(ht, tbl, obj_new, params)) | 1154 | if (hash != rht_head_hashfn(ht, tbl, obj_new, params)) |
| 1051 | return -EINVAL; | 1155 | return -EINVAL; |
| 1052 | 1156 | ||
| 1053 | lock = rht_bucket_lock(tbl, hash); | 1157 | bkt = rht_bucket_var(tbl, hash); |
| 1158 | if (!bkt) | ||
| 1159 | return -ENOENT; | ||
| 1054 | 1160 | ||
| 1055 | spin_lock_bh(lock); | 1161 | pprev = NULL; |
| 1162 | rht_lock(tbl, bkt); | ||
| 1056 | 1163 | ||
| 1057 | pprev = rht_bucket_var(tbl, hash); | 1164 | rht_for_each_from(he, rht_ptr(bkt, tbl, hash), tbl, hash) { |
| 1058 | rht_for_each_continue(he, *pprev, tbl, hash) { | ||
| 1059 | if (he != obj_old) { | 1165 | if (he != obj_old) { |
| 1060 | pprev = &he->next; | 1166 | pprev = &he->next; |
| 1061 | continue; | 1167 | continue; |
| 1062 | } | 1168 | } |
| 1063 | 1169 | ||
| 1064 | rcu_assign_pointer(obj_new->next, obj_old->next); | 1170 | rcu_assign_pointer(obj_new->next, obj_old->next); |
| 1065 | rcu_assign_pointer(*pprev, obj_new); | 1171 | if (pprev) { |
| 1172 | rcu_assign_pointer(*pprev, obj_new); | ||
| 1173 | rht_unlock(tbl, bkt); | ||
| 1174 | } else { | ||
| 1175 | rht_assign_unlock(tbl, bkt, obj_new); | ||
| 1176 | } | ||
| 1066 | err = 0; | 1177 | err = 0; |
| 1067 | break; | 1178 | goto unlocked; |
| 1068 | } | 1179 | } |
| 1069 | 1180 | ||
| 1070 | spin_unlock_bh(lock); | 1181 | rht_unlock(tbl, bkt); |
| 1071 | 1182 | ||
| 1183 | unlocked: | ||
| 1072 | return err; | 1184 | return err; |
| 1073 | } | 1185 | } |
| 1074 | 1186 | ||
| @@ -21,6 +21,11 @@ typedef struct { · 20 unmodified lines | |||
| 21 | u64 key[2]; | 21 | u64 key[2]; |
| 22 | } siphash_key_t; | 22 | } siphash_key_t; |
| 23 | 23 | ||
| 24 | static inline bool siphash_key_is_zero(const siphash_key_t *key) | ||
| 25 | { | ||
| 26 | return !(key->key[0] | key->key[1]); | ||
| 27 | } | ||
| 28 | |||
| 24 | u64 __siphash_aligned(const void *data, size_t len, const siphash_key_t *key); | 29 | u64 __siphash_aligned(const void *data, size_t len, const siphash_key_t *key); |
| 25 | #ifndef CONFIG_HAVE_EFFICIENT_UNALIGNED_ACCESS | 30 | #ifndef CONFIG_HAVE_EFFICIENT_UNALIGNED_ACCESS |
| 26 | u64 __siphash_unaligned(const void *data, size_t len, const siphash_key_t *key); | 31 | u64 __siphash_unaligned(const void *data, size_t len, const siphash_key_t *key); |
| @@ -657,7 +657,6 @@ typedef unsigned char *sk_buff_data_t; · 656 unmodified lines | |||
| 657 | * @tc_index: Traffic control index | 657 | * @tc_index: Traffic control index |
| 658 | * @hash: the packet hash | 658 | * @hash: the packet hash |
| 659 | * @queue_mapping: Queue mapping for multiqueue devices | 659 | * @queue_mapping: Queue mapping for multiqueue devices |
| 660 | * @xmit_more: More SKBs are pending for this queue | ||
| 661 | * @pfmemalloc: skbuff was allocated from PFMEMALLOC reserves | 660 | * @pfmemalloc: skbuff was allocated from PFMEMALLOC reserves |
| 662 | * @active_extensions: active extensions (skb_ext_id types) | 661 | * @active_extensions: active extensions (skb_ext_id types) |
| 663 | * @ndisc_nodetype: router type (from link layer) | 662 | * @ndisc_nodetype: router type (from link layer) |
| @@ -764,7 +763,6 @@ struct sk_buff { · 100 unmodified lines | |||
| 764 | fclone:2, | 763 | fclone:2, |
| 765 | peeked:1, | 764 | peeked:1, |
| 766 | head_frag:1, | 765 | head_frag:1, |
| 767 | xmit_more:1, | ||
| 768 | pfmemalloc:1; | 766 | pfmemalloc:1; |
| 769 | #ifdef CONFIG_SKB_EXTENSIONS | 767 | #ifdef CONFIG_SKB_EXTENSIONS |
| 770 | __u8 active_extensions; | 768 | __u8 active_extensions; |
| @@ -1044,6 +1042,8 @@ struct sk_buff *__alloc_skb(unsigned int size, gfp_t priority, int flags, · 273 unmodified lines | |||
| 1044 | int node); | 1042 | int node); |
| 1045 | struct sk_buff *__build_skb(void *data, unsigned int frag_size); | 1043 | struct sk_buff *__build_skb(void *data, unsigned int frag_size); |
| 1046 | struct sk_buff *build_skb(void *data, unsigned int frag_size); | 1044 | struct sk_buff *build_skb(void *data, unsigned int frag_size); |
| 1045 | struct sk_buff *build_skb_around(struct sk_buff *skb, | ||
| 1046 | void *data, unsigned int frag_size); | ||
| 1047 | 1047 | ||
| 1048 | /** | 1048 | /** |
| 1049 | * alloc_skb - allocate a network buffer | 1049 | * alloc_skb - allocate a network buffer |
| @@ -1258,11 +1258,19 @@ void skb_flow_dissector_init(struct flow_dissector *flow_dissector, · 208 unmodified lines | |||
| 1258 | unsigned int key_count); | 1258 | unsigned int key_count); |
| 1259 | 1259 | ||
| 1260 | #ifdef CONFIG_NET | 1260 | #ifdef CONFIG_NET |
| 1261 | int skb_flow_dissector_prog_query(const union bpf_attr *attr, | ||
| 1262 | union bpf_attr __user *uattr); | ||
| 1261 | int skb_flow_dissector_bpf_prog_attach(const union bpf_attr *attr, | 1263 | int skb_flow_dissector_bpf_prog_attach(const union bpf_attr *attr, |
| 1262 | struct bpf_prog *prog); | 1264 | struct bpf_prog *prog); |
| 1263 | 1265 | ||
| 1264 | int skb_flow_dissector_bpf_prog_detach(const union bpf_attr *attr); | 1266 | int skb_flow_dissector_bpf_prog_detach(const union bpf_attr *attr); |
| 1265 | #else | 1267 | #else |
| 1268 | static inline int skb_flow_dissector_prog_query(const union bpf_attr *attr, | ||
| 1269 | union bpf_attr __user *uattr) | ||
| 1270 | { | ||
| 1271 | return -EOPNOTSUPP; | ||
| 1272 | } | ||
| 1273 | |||
| 1266 | static inline int skb_flow_dissector_bpf_prog_attach(const union bpf_attr *attr, | 1274 | static inline int skb_flow_dissector_bpf_prog_attach(const union bpf_attr *attr, |
| 1267 | struct bpf_prog *prog) | 1275 | struct bpf_prog *prog) |
| 1268 | { | 1276 | { |
| @@ -1275,12 +1283,12 @@ static inline int skb_flow_dissector_bpf_prog_detach(const union bpf_attr *attr) · 6 unmodified lines | |||
| 1275 | } | 1283 | } |
| 1276 | #endif | 1284 | #endif |
| 1277 | 1285 | ||
| 1278 | struct bpf_flow_keys; | 1286 | struct bpf_flow_dissector; |
| 1279 | bool __skb_flow_bpf_dissect(struct bpf_prog *prog, | 1287 | bool bpf_flow_dissect(struct bpf_prog *prog, struct bpf_flow_dissector *ctx, |
| 1280 | const struct sk_buff *skb, | 1288 | __be16 proto, int nhoff, int hlen); |
| 1281 | struct flow_dissector *flow_dissector, | 1289 | |
| 1282 | struct bpf_flow_keys *flow_keys); | 1290 | bool __skb_flow_dissect(const struct net *net, |
| 1283 | bool __skb_flow_dissect(const struct sk_buff *skb, | 1291 | const struct sk_buff *skb, |
| 1284 | struct flow_dissector *flow_dissector, | 1292 | struct flow_dissector *flow_dissector, |
| 1285 | void *target_container, | 1293 | void *target_container, |
| 1286 | void *data, __be16 proto, int nhoff, int hlen, | 1294 | void *data, __be16 proto, int nhoff, int hlen, |
| @@ -1290,8 +1298,8 @@ static inline bool skb_flow_dissect(const struct sk_buff *skb, · 3 unmodified lines | |||
| 1290 | struct flow_dissector *flow_dissector, | 1298 | struct flow_dissector *flow_dissector, |
| 1291 | void *target_container, unsigned int flags) | 1299 | void *target_container, unsigned int flags) |
| 1292 | { | 1300 | { |
| 1293 | return __skb_flow_dissect(skb, flow_dissector, target_container, | 1301 | return __skb_flow_dissect(NULL, skb, flow_dissector, |
| 1294 | NULL, 0, 0, 0, flags); | 1302 | target_container, NULL, 0, 0, 0, flags); |
| 1295 | } | 1303 | } |
| 1296 | 1304 | ||
| 1297 | static inline bool skb_flow_dissect_flow_keys(const struct sk_buff *skb, | 1305 | static inline bool skb_flow_dissect_flow_keys(const struct sk_buff *skb, |
| @@ -1299,18 +1307,19 @@ static inline bool skb_flow_dissect_flow_keys(const struct sk_buff *skb, · 1 unmodified line | |||
| 1299 | unsigned int flags) | 1307 | unsigned int flags) |
| 1300 | { | 1308 | { |
| 1301 | memset(flow, 0, sizeof(*flow)); | 1309 | memset(flow, 0, sizeof(*flow)); |
| 1302 | return __skb_flow_dissect(skb, &flow_keys_dissector, flow, | 1310 | return __skb_flow_dissect(NULL, skb, &flow_keys_dissector, |
| 1303 | NULL, 0, 0, 0, flags); | 1311 | flow, NULL, 0, 0, 0, flags); |
| 1304 | } | 1312 | } |
| 1305 | 1313 | ||
| 1306 | static inline bool | 1314 | static inline bool |
| 1307 | skb_flow_dissect_flow_keys_basic(const struct sk_buff *skb, | 1315 | skb_flow_dissect_flow_keys_basic(const struct net *net, |
| 1316 | const struct sk_buff *skb, | ||
| 1308 | struct flow_keys_basic *flow, void *data, | 1317 | struct flow_keys_basic *flow, void *data, |
| 1309 | __be16 proto, int nhoff, int hlen, | 1318 | __be16 proto, int nhoff, int hlen, |
| 1310 | unsigned int flags) | 1319 | unsigned int flags) |
| 1311 | { | 1320 | { |
| 1312 | memset(flow, 0, sizeof(*flow)); | 1321 | memset(flow, 0, sizeof(*flow)); |
| 1313 | return __skb_flow_dissect(skb, &flow_keys_basic_dissector, flow, | 1322 | return __skb_flow_dissect(net, skb, &flow_keys_basic_dissector, flow, |
| 1314 | data, proto, nhoff, hlen, flags); | 1323 | data, proto, nhoff, hlen, flags); |
| 1315 | } | 1324 | } |
| 1316 | 1325 | ||
| @@ -2102,8 +2111,6 @@ void skb_add_rx_frag(struct sk_buff *skb, int i, struct page *page, int off, · 785 unmodified lines | |||
| 2102 | void skb_coalesce_rx_frag(struct sk_buff *skb, int i, int size, | 2111 | void skb_coalesce_rx_frag(struct sk_buff *skb, int i, int size, |
| 2103 | unsigned int truesize); | 2112 | unsigned int truesize); |
| 2104 | 2113 | ||
| 2105 | #define SKB_PAGE_ASSERT(skb) BUG_ON(skb_shinfo(skb)->nr_frags) | ||
| 2106 | #define SKB_FRAG_ASSERT(skb) BUG_ON(skb_has_frag_list(skb)) | ||
| 2107 | #define SKB_LINEAR_ASSERT(skb) BUG_ON(skb_is_nonlinear(skb)) | 2114 | #define SKB_LINEAR_ASSERT(skb) BUG_ON(skb_is_nonlinear(skb)) |
| 2108 | 2115 | ||
| 2109 | #ifdef NET_SKBUFF_DATA_USES_OFFSET | 2116 | #ifdef NET_SKBUFF_DATA_USES_OFFSET |
| @@ -2490,7 +2497,8 @@ static inline void skb_probe_transport_header(struct sk_buff *skb) · 380 unmodified lines | |||
| 2490 | if (skb_transport_header_was_set(skb)) | 2497 | if (skb_transport_header_was_set(skb)) |
| 2491 | return; | 2498 | return; |
| 2492 | 2499 | ||
| 2493 | if (skb_flow_dissect_flow_keys_basic(skb, &keys, NULL, 0, 0, 0, 0)) | 2500 | if (skb_flow_dissect_flow_keys_basic(NULL, skb, &keys, |
| 2501 | NULL, 0, 0, 0, 0)) | ||
| 2494 | skb_set_transport_header(skb, keys.control.thoff); | 2502 | skb_set_transport_header(skb, keys.control.thoff); |
| 2495 | } | 2503 | } |
| 2496 | 2504 | ||
| @@ -3372,17 +3380,17 @@ struct sk_buff *__skb_try_recv_from_queue(struct sock *sk, · 875 unmodified lines | |||
| 3372 | unsigned int flags, | 3380 | unsigned int flags, |
| 3373 | void (*destructor)(struct sock *sk, | 3381 | void (*destructor)(struct sock *sk, |
| 3374 | struct sk_buff *skb), | 3382 | struct sk_buff *skb), |
| 3375 | int *peeked, int *off, int *err, | 3383 | int *off, int *err, |
| 3376 | struct sk_buff **last); | 3384 | struct sk_buff **last); |
| 3377 | struct sk_buff *__skb_try_recv_datagram(struct sock *sk, unsigned flags, | 3385 | struct sk_buff *__skb_try_recv_datagram(struct sock *sk, unsigned flags, |
| 3378 | void (*destructor)(struct sock *sk, | 3386 | void (*destructor)(struct sock *sk, |
| 3379 | struct sk_buff *skb), | 3387 | struct sk_buff *skb), |
| 3380 | int *peeked, int *off, int *err, | 3388 | int *off, int *err, |
| 3381 | struct sk_buff **last); | 3389 | struct sk_buff **last); |
| 3382 | struct sk_buff *__skb_recv_datagram(struct sock *sk, unsigned flags, | 3390 | struct sk_buff *__skb_recv_datagram(struct sock *sk, unsigned flags, |
| 3383 | void (*destructor)(struct sock *sk, | 3391 | void (*destructor)(struct sock *sk, |
| 3384 | struct sk_buff *skb), | 3392 | struct sk_buff *skb), |
| 3385 | int *peeked, int *off, int *err); | 3393 | int *off, int *err); |
| 3386 | struct sk_buff *skb_recv_datagram(struct sock *sk, unsigned flags, int noblock, | 3394 | struct sk_buff *skb_recv_datagram(struct sock *sk, unsigned flags, int noblock, |
| 3387 | int *err); | 3395 | int *err); |
| 3388 | __poll_t datagram_poll(struct file *file, struct socket *sock, | 3396 | __poll_t datagram_poll(struct file *file, struct socket *sock, |
| @@ -45,6 +45,7 @@ struct bpf_raw_event_map { · 44 unmodified lines | |||
| 45 | struct tracepoint *tp; | 45 | struct tracepoint *tp; |
| 46 | void *bpf_func; | 46 | void *bpf_func; |
| 47 | u32 num_args; | 47 | u32 num_args; |
| 48 | u32 writable_size; | ||
| 48 | } __aligned(32); | 49 | } __aligned(32); |
| 49 | 50 | ||
| 50 | #endif | 51 | #endif |