History

Merge git://git.kernel.org/pub/scm/linux/kernel/git/davem/net-next

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 ...

Linus Torvalds committed 7 years ago

Commit 80f23212 parents 82efe43 a9e41a51636 files · +126811 −26978Browse files

Showing the changes to include/linux (46 of 1636 files). Show all

Unified · Split

46 files
  1. include/linux/bpf-cgroup.h +21 −0
  2. include/linux/bpf.h +75 −9
  3. include/linux/bpf_types.h +3 −0
  4. include/linux/bpf_verifier.h +32 −0
  5. include/linux/btf.h +1 −0
  6. include/linux/dsa/8021q.h +76 −0
  7. include/linux/dsa/sja1105.h +40 −0
  8. include/linux/etherdevice.h +1 −1
  9. include/linux/filter.h +16 −0
  10. include/linux/genl_magic_func.h +2 −2
  11. include/linux/ieee80211.h +9 −5
  12. include/linux/if_bridge.h +0 −3
  13. include/linux/inetdevice.h +14 −0
  14. include/linux/jiffies.h +1 −0
  15. include/linux/marvell_phy.h +1 −0
  16. include/linux/mdio.h +2 −1
  17. include/linux/mlx5/cq.h +1 −1
  18. include/linux/mlx5/device.h +10 −1
  19. include/linux/mlx5/doorbell.h +9 −30
  20. include/linux/mlx5/driver.h +11 −2
  21. include/linux/mlx5/eswitch.h +1 −1
  22. include/linux/mlx5/fs.h +7 −0
  23. include/linux/mlx5/mlx5_ifc.h +167 −16
  24. include/linux/mlx5/port.h +1 −0
  25. include/linux/mlx5/qp.h +1 −0
  26. include/linux/mlx5/transobj.h +3 −0
  27. include/linux/mlx5/vport.h +0 −4
  28. include/linux/mmc/sdio_func.h +12 −0
  29. include/linux/mmc/sdio_ids.h +2 −0
  30. include/linux/net.h +2 −0
  31. include/linux/netdevice.h +48 −47
  32. include/linux/netfilter.h +17 −1
  33. include/linux/netfilter/ipset/ip_set.h +4 −7
  34. include/linux/netfilter/nfnetlink_osf.h +8 −3
  35. include/linux/netfilter/x_tables.h +0 −1
  36. include/linux/netfilter_ipv6.h +15 −0
  37. include/linux/packing.h +49 −0
  38. include/linux/phy.h +6 −8
  39. include/linux/platform_data/macb.h +0 −9
  40. include/linux/platform_data/mv88e6xxx.h +1 −0
  41. include/linux/platform_data/xilinx-ll-temac.h +32 −0
  42. include/linux/rhashtable-types.h +0 −2
  43. include/linux/rhashtable.h +235 −123
  44. include/linux/siphash.h +5 −0
  45. include/linux/skbuff.h +28 −20
  46. include/linux/tracepoint-defs.h +1 −0
include/linux/bpf-cgroup.h+21−0
@@ -17,6 +17,8 @@ struct bpf_map; · 16 unmodified lines
1717 struct bpf_prog;
1818 struct bpf_sock_ops_kern;
1919 struct bpf_cgroup_storage;
20+struct ctl_table;
21+struct ctl_table_header;
2022
2123 #ifdef CONFIG_CGROUP_BPF
2224
@@ -109,6 +111,12 @@ int __cgroup_bpf_run_filter_sock_ops(struct sock *sk, · 86 unmodified lines
109111 int __cgroup_bpf_check_dev_permission(short dev_type, u32 major, u32 minor,
110112 short access, enum bpf_attach_type type);
111113
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+
112120 static inline enum bpf_cgroup_storage_type cgroup_storage_type(
113121 struct bpf_map *map)
114122 {
@@ -253,6 +261,18 @@ int bpf_percpu_cgroup_storage_update(struct bpf_map *map, void *key, · 138 unmodified lines
253261 \
254262 __ret; \
255263 })
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+
256276 int cgroup_bpf_prog_attach(const union bpf_attr *attr,
257277 enum bpf_prog_type ptype, struct bpf_prog *prog);
258278 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
321341 #define BPF_CGROUP_RUN_PROG_UDP6_SENDMSG_LOCK(sk, uaddr, t_ctx) ({ 0; })
322342 #define BPF_CGROUP_RUN_PROG_SOCK_OPS(sock_ops) ({ 0; })
323343 #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; })
324345
325346 #define for_each_cgroup_storage_type(stype) for (; false; )
326347
include/linux/bpf.h+75−9
@@ -57,6 +57,12 @@ struct bpf_map_ops { · 56 unmodified lines
5757 const struct btf *btf,
5858 const struct btf_type *key_type,
5959 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);
6066 };
6167
6268 struct bpf_map {
@@ -81,7 +87,8 @@ struct bpf_map { · 18 unmodified lines
8187 struct btf *btf;
8288 u32 pages;
8389 bool unpriv_array;
84− /* 51 bytes hole */
90+ bool frozen; /* write-once */
91+ /* 48 bytes hole */
8592
8693 /* The 3rd and 4th cacheline with misc members to avoid false sharing
8794 * particularly with refcounting.
@@ -177,6 +184,7 @@ enum bpf_arg_type { · 89 unmodified lines
177184 ARG_PTR_TO_MAP_KEY, /* pointer to stack used as map key */
178185 ARG_PTR_TO_MAP_VALUE, /* pointer to stack used as map value */
179186 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 */
180188
181189 /* the following constraints used to prototype bpf_memcmp() and other
182190 * functions that access data on eBPF program stack
@@ -195,6 +203,9 @@ enum bpf_arg_type { · 12 unmodified lines
195203 ARG_ANYTHING, /* any (initialized) argument is ok */
196204 ARG_PTR_TO_SPIN_LOCK, /* pointer to bpf_spin_lock */
197205 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) */
198209 };
199210
200211 /* type of values returned from helper functions */
@@ -205,6 +216,7 @@ enum bpf_return_type { · 4 unmodified lines
205216 RET_PTR_TO_MAP_VALUE_OR_NULL, /* returns a pointer to map elem value or NULL */
206217 RET_PTR_TO_SOCKET_OR_NULL, /* returns a pointer to a socket or NULL */
207218 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 */
208220 };
209221
210222 /* eBPF function prototype used by verifier to allow BPF_CALLs from eBPF programs
@@ -262,6 +274,7 @@ enum bpf_reg_type { · 51 unmodified lines
262274 PTR_TO_SOCK_COMMON_OR_NULL, /* reg points to sock_common or NULL */
263275 PTR_TO_TCP_SOCK, /* reg points to struct tcp_sock */
264276 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 */
265278 };
266279
267280 /* The information passed from prog-specific *_is_valid_access
@@ -351,6 +364,7 @@ struct bpf_prog_aux { · 83 unmodified lines
351364 u32 used_map_cnt;
352365 u32 max_ctx_offset;
353366 u32 max_pkt_offset;
367+ u32 max_tp_access;
354368 u32 stack_depth;
355369 u32 id;
356370 u32 func_cnt; /* used by non-func prog as the number of func progs */
@@ -420,8 +434,38 @@ struct bpf_array { · 63 unmodified lines
420434 };
421435 };
422436
437+#define BPF_COMPLEXITY_LIMIT_INSNS 1000000 /* yes. 1M insns */
423438 #define MAX_TAIL_CALL_CNT 32
424439
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+
425469 struct bpf_event_entry {
426470 struct perf_event *event;
427471 struct file *perf_file;
@@ -445,14 +489,6 @@ typedef u32 (*bpf_convert_ctx_access_t)(enum bpf_access_type type, · 17 unmodified lines
445489 u64 bpf_event_output(struct bpf_map *map, u64 flags, void *meta, u64 meta_size,
446490 void *ctx, u64 ctx_size, bpf_ctx_copy_t ctx_copy);
447491
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−
456492 /* an array of programs to be executed under rcu_lock.
457493 *
458494 * Typical usage:
@@ -643,6 +679,13 @@ static inline int bpf_map_attr_numa_node(const union bpf_attr *attr) · 184 unmodified lines
643679 struct bpf_prog *bpf_prog_get_type_path(const char *name, enum bpf_prog_type type);
644680 int array_map_alloc_check(union bpf_attr *attr);
645681
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);
646689 #else /* !CONFIG_BPF_SYSCALL */
647690 static inline struct bpf_prog *bpf_prog_get(u32 ufd)
648691 {
@@ -754,6 +797,27 @@ static inline struct bpf_prog *bpf_prog_get_type_path(const char *name, · 105 unmodified lines
754797 {
755798 return ERR_PTR(-EOPNOTSUPP);
756799 }
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+}
757821 #endif /* CONFIG_BPF_SYSCALL */
758822
759823 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
929993 extern const struct bpf_func_proto bpf_spin_lock_proto;
930994 extern const struct bpf_func_proto bpf_spin_unlock_proto;
931995 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;
932998
933999 /* Shared helpers among cBPF and eBPF. */
9341000 void bpf_user_rnd_init_once(void);
include/linux/bpf_types.h+3−0
@@ -25,9 +25,11 @@ BPF_PROG_TYPE(BPF_PROG_TYPE_KPROBE, kprobe) · 24 unmodified lines
2525 BPF_PROG_TYPE(BPF_PROG_TYPE_TRACEPOINT, tracepoint)
2626 BPF_PROG_TYPE(BPF_PROG_TYPE_PERF_EVENT, perf_event)
2727 BPF_PROG_TYPE(BPF_PROG_TYPE_RAW_TRACEPOINT, raw_tracepoint)
28+BPF_PROG_TYPE(BPF_PROG_TYPE_RAW_TRACEPOINT_WRITABLE, raw_tracepoint_writable)
2829 #endif
2930 #ifdef CONFIG_CGROUP_BPF
3031 BPF_PROG_TYPE(BPF_PROG_TYPE_CGROUP_DEVICE, cg_dev)
32+BPF_PROG_TYPE(BPF_PROG_TYPE_CGROUP_SYSCTL, cg_sysctl)
3133 #endif
3234 #ifdef CONFIG_BPF_LIRC_MODE2
3335 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
5961 BPF_MAP_TYPE(BPF_MAP_TYPE_HASH_OF_MAPS, htab_of_maps_map_ops)
6062 #ifdef CONFIG_NET
6163 BPF_MAP_TYPE(BPF_MAP_TYPE_DEVMAP, dev_map_ops)
64+BPF_MAP_TYPE(BPF_MAP_TYPE_SK_STORAGE, sk_storage_map_ops)
6265 #if defined(CONFIG_BPF_STREAM_PARSER)
6366 BPF_MAP_TYPE(BPF_MAP_TYPE_SOCKMAP, sock_map_ops)
6467 BPF_MAP_TYPE(BPF_MAP_TYPE_SOCKHASH, sock_hash_ops)
include/linux/bpf_verifier.h+32−0
@@ -207,6 +207,7 @@ struct bpf_verifier_state { · 206 unmodified lines
207207 struct bpf_verifier_state_list {
208208 struct bpf_verifier_state state;
209209 struct bpf_verifier_state_list *next;
210+ int miss_cnt, hit_cnt;
210211 };
211212
212213 /* Possible states for alu_state member. */
@@ -223,6 +224,10 @@ struct bpf_insn_aux_data { · 10 unmodified lines
223224 unsigned long map_state; /* pointer/poison value for maps */
224225 s32 call_imm; /* saved imm field of call insn */
225226 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+ };
226231 };
227232 int ctx_field_size; /* the ctx field size for load insn, maybe 0 */
228233 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
248253 return log->len_used >= log->len_total - 1;
249254 }
250255
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+
251262 static inline bool bpf_verifier_log_needed(const struct bpf_verifier_log *log)
252263 {
253264 return log->level && log->ubuf && !bpf_verifier_log_full(log);
@@ -274,6 +285,7 @@ struct bpf_verifier_env { · 20 unmodified lines
274285 bool strict_alignment; /* perform strict pointer alignment checks */
275286 struct bpf_verifier_state *cur_state; /* current verifier state */
276287 struct bpf_verifier_state_list **explored_states; /* search pruning optimization */
288+ struct bpf_verifier_state_list *free_list;
277289 struct bpf_map *used_maps[MAX_USED_MAPS]; /* array of map's used by eBPF program */
278290 u32 used_map_cnt; /* number of used maps */
279291 u32 id_gen; /* used to generate unique reg IDs */
@@ -283,7 +295,27 @@ struct bpf_verifier_env { · 3 unmodified lines
283295 const struct bpf_line_info *prev_linfo;
284296 struct bpf_verifier_log log;
285297 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;
286303 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;
287319 };
288320
289321 __printf(2, 0) void bpf_verifier_vlog(struct bpf_verifier_log *log,
include/linux/btf.h+1−0
@@ -51,6 +51,7 @@ bool btf_member_is_reg_int(const struct btf *btf, const struct btf_type *s, · 50 unmodified lines
5151 const struct btf_member *m,
5252 u32 expected_offset, u32 expected_size);
5353 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);
5455
5556 #ifdef CONFIG_BPF_SYSCALL
5657 const struct btf_type *btf_type_by_id(const struct btf *btf, u32 type_id);
include/linux/dsa/8021q.h+76−0
@@ -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 */
include/linux/dsa/sja1105.h+40−0
@@ -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 */
include/linux/etherdevice.h+1−1
@@ -33,7 +33,7 @@ struct device; · 32 unmodified lines
3333 int eth_platform_get_mac_address(struct device *dev, u8 *mac_addr);
3434 unsigned char *arch_get_platform_mac_address(void);
3535 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);
3737 __be16 eth_type_trans(struct sk_buff *skb, struct net_device *dev);
3838 extern const struct header_ops eth_header_ops;
3939
include/linux/filter.h+16−0
@@ -34,6 +34,8 @@ struct bpf_prog_aux; · 33 unmodified lines
3434 struct xdp_rxq_info;
3535 struct xdp_buff;
3636 struct sock_reuseport;
37+struct ctl_table;
38+struct ctl_table_header;
3739
3840 /* ArgX, context and stack frame pointer register positions. Note,
3941 * Arg1, Arg2, Arg3, etc are used as argument mappings of function
@@ -1167,4 +1169,18 @@ struct bpf_sock_ops_kern { · 1127 unmodified lines
11671169 */
11681170 };
11691171
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+
11701186 #endif /* __LINUX_FILTER_H__ */
include/linux/genl_magic_func.h+2−2
@@ -233,7 +233,6 @@ const char *CONCAT_(GENL_MAGIC_FAMILY, _genl_cmd_to_str)(__u8 cmd) · 232 unmodified lines
233233 { \
234234 handler \
235235 .cmd = op_name, \
236− .policy = CONCAT_(GENL_MAGIC_FAMILY, _tla_nl_policy), \
237236 },
238237
239238 #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
290289 #ifdef GENL_MAGIC_FAMILY_HDRSZ
291290 .hdrsize = NLA_ALIGN(GENL_MAGIC_FAMILY_HDRSZ),
292291 #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),
294294 .ops = ZZZ_genl_ops,
295295 .n_ops = ARRAY_SIZE(ZZZ_genl_ops),
296296 .mcgrps = ZZZ_genl_mcgrps,
include/linux/ieee80211.h+9−5
@@ -1557,7 +1557,7 @@ struct ieee80211_vht_operation { · 1556 unmodified lines
15571557 * struct ieee80211_he_cap_elem - HE capabilities element
15581558 *
15591559 * 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
15611561 */
15621562 struct ieee80211_he_cap_elem {
15631563 u8 mac_cap_info[6];
@@ -1619,12 +1619,12 @@ struct ieee80211_he_mcs_nss_supp { · 55 unmodified lines
16191619 * struct ieee80211_he_operation - HE capabilities element
16201620 *
16211621 * 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
16231623 */
16241624 struct ieee80211_he_operation {
16251625 __le32 he_oper_params;
16261626 __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 */
16281628 u8 optional[0];
16291629 } __packed;
16301630
@@ -1632,7 +1632,7 @@ struct ieee80211_he_operation { · 1 unmodified line
16321632 * struct ieee80211_he_mu_edca_param_ac_rec - MU AC Parameter Record field
16331633 *
16341634 * 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
16361636 */
16371637 struct ieee80211_he_mu_edca_param_ac_rec {
16381638 u8 aifsn;
@@ -1644,7 +1644,7 @@ struct ieee80211_he_mu_edca_param_ac_rec { · 5 unmodified lines
16441644 * struct ieee80211_mu_edca_param_set - MU EDCA Parameter Set element
16451645 *
16461646 * 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
16481648 */
16491649 struct ieee80211_mu_edca_param_set {
16501650 u8 mu_qos_info;
@@ -2026,6 +2026,7 @@ ieee80211_he_ppe_size(u8 ppe_thres_hdr, const u8 *phy_cap_info) · 375 unmodified lines
20262026 #define IEEE80211_HE_OPERATION_VHT_OPER_INFO 0x00004000
20272027 #define IEEE80211_HE_OPERATION_CO_HOSTED_BSS 0x00008000
20282028 #define IEEE80211_HE_OPERATION_ER_SU_DISABLE 0x00010000
2029+#define IEEE80211_HE_OPERATION_6GHZ_OP_INFO 0x00020000
20292030 #define IEEE80211_HE_OPERATION_BSS_COLOR_MASK 0x3f000000
20302031 #define IEEE80211_HE_OPERATION_BSS_COLOR_OFFSET 24
20312032 #define IEEE80211_HE_OPERATION_PARTIAL_BSS_COLOR 0x40000000
@@ -2056,6 +2057,8 @@ ieee80211_he_oper_size(const u8 *he_oper_ie) · 24 unmodified lines
20562057 oper_len += 3;
20572058 if (he_oper_params & IEEE80211_HE_OPERATION_CO_HOSTED_BSS)
20582059 oper_len++;
2060+ if (he_oper_params & IEEE80211_HE_OPERATION_6GHZ_OP_INFO)
2061+ oper_len += 4;
20592062
20602063 /* Add the first byte (extension ID) to the total length */
20612064 oper_len++;
@@ -2487,6 +2490,7 @@ enum ieee80211_eid_ext { · 425 unmodified lines
24872490 WLAN_EID_EXT_HE_MU_EDCA = 38,
24882491 WLAN_EID_EXT_MAX_CHANNEL_SWITCH_TIME = 52,
24892492 WLAN_EID_EXT_MULTIPLE_BSSID_CONFIGURATION = 55,
2493+ WLAN_EID_EXT_NON_INHERITANCE = 56,
24902494 };
24912495
24922496 /* Action category code */
include/linux/if_bridge.h+0−3
@@ -56,9 +56,6 @@ struct br_ip_list { · 55 unmodified lines
5656
5757 extern void brioctl_set(int (*ioctl_hook)(struct net *, unsigned int, void __user *));
5858
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−
6259 #if IS_ENABLED(CONFIG_BRIDGE) && IS_ENABLED(CONFIG_BRIDGE_IGMP_SNOOPING)
6360 int br_multicast_list_adjacent(struct net_device *dev,
6461 struct list_head *br_ip_list);
include/linux/inetdevice.h+14−0
@@ -237,6 +237,20 @@ static inline struct in_device *__in_dev_get_rtnl(const struct net_device *dev) · 236 unmodified lines
237237 return rtnl_dereference(dev->ip_ptr);
238238 }
239239
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+
240254 static inline struct neigh_parms *__in_dev_arp_parms_get_rcu(const struct net_device *dev)
241255 {
242256 struct in_device *in_dev = __in_dev_get_rcu(dev);
include/linux/jiffies.h+1−0
@@ -297,6 +297,7 @@ static inline u64 jiffies_to_nsecs(const unsigned long j) · 296 unmodified lines
297297 }
298298
299299 extern u64 jiffies64_to_nsecs(u64 j);
300+extern u64 jiffies64_to_msecs(u64 j);
300301
301302 extern unsigned long __msecs_to_jiffies(const unsigned int m);
302303 #if HZ <= MSEC_PER_SEC && !(MSEC_PER_SEC % HZ)
include/linux/marvell_phy.h+1−0
@@ -34,5 +34,6 @@ · 33 unmodified lines
3434 /* struct phy_device dev_flags definitions */
3535 #define MARVELL_PHY_M1145_FLAGS_RESISTANCE 0x00000001
3636 #define MARVELL_PHY_M1118_DNS323_LEDS 0x00000002
37+#define MARVELL_PHY_LED0_LINK_LED1_ACTIVE 0x00000004
3738
3839 #endif /* _MARVELL_PHY_H */
include/linux/mdio.h+2−1
@@ -39,7 +39,8 @@ struct mdio_device { · 38 unmodified lines
3939 /* Bus address of the MDIO device (0-31) */
4040 int addr;
4141 int flags;
42− struct gpio_desc *reset;
42+ struct gpio_desc *reset_gpio;
43+ struct reset_control *reset_ctrl;
4344 unsigned int reset_assert_delay;
4445 unsigned int reset_deassert_delay;
4546 };
include/linux/mlx5/cq.h+1−1
@@ -170,7 +170,7 @@ static inline void mlx5_cq_arm(struct mlx5_core_cq *cq, u32 cmd, · 169 unmodified lines
170170 doorbell[0] = cpu_to_be32(sn << 28 | cmd | ci);
171171 doorbell[1] = cpu_to_be32(cq->cqn);
172172
173− mlx5_write64(doorbell, uar_page + MLX5_CQ_DOORBELL, NULL);
173+ mlx5_write64(doorbell, uar_page + MLX5_CQ_DOORBELL);
174174 }
175175
176176 static inline void mlx5_cq_hold(struct mlx5_core_cq *cq)
include/linux/mlx5/device.h+10−1
@@ -361,6 +361,7 @@ enum { · 360 unmodified lines
361361
362362 enum {
363363 MLX5_GENERAL_SUBTYPE_DELAY_DROP_TIMEOUT = 0x1,
364+ MLX5_GENERAL_SUBTYPE_PCI_POWER_CHANGE_EVENT = 0x5,
364365 };
365366
366367 enum {
@@ -1001,7 +1002,8 @@ enum { · 634 unmodified lines
10011002 MLX5_MATCH_OUTER_HEADERS = 1 << 0,
10021003 MLX5_MATCH_MISC_PARAMETERS = 1 << 1,
10031004 MLX5_MATCH_INNER_HEADERS = 1 << 2,
1004−
1005+ MLX5_MATCH_MISC_PARAMETERS_2 = 1 << 3,
1006+ MLX5_MATCH_MISC_PARAMETERS_3 = 1 << 4,
10051007 };
10061008
10071009 enum {
@@ -1045,6 +1047,7 @@ enum mlx5_mpls_supported_fields { · 37 unmodified lines
10451047 };
10461048
10471049 enum mlx5_flex_parser_protos {
1050+ MLX5_FLEX_PROTO_GENEVE = 1 << 3,
10481051 MLX5_FLEX_PROTO_CW_MPLS_GRE = 1 << 4,
10491052 MLX5_FLEX_PROTO_CW_MPLS_UDP = 1 << 5,
10501053 };
@@ -1166,6 +1169,12 @@ enum mlx5_qcam_feature_groups { · 115 unmodified lines
11661169 #define MLX5_CAP_FLOWTABLE_SNIFFER_TX_MAX(mdev, cap) \
11671170 MLX5_CAP_FLOWTABLE_MAX(mdev, flow_table_properties_nic_transmit_sniffer.cap)
11681171
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+
11691178 #define MLX5_CAP_ESW_FLOWTABLE(mdev, cap) \
11701179 MLX5_GET(flow_table_eswitch_cap, \
11711180 mdev->caps.hca_cur[MLX5_CAP_ESWITCH_FLOW_TABLE], cap)
include/linux/mlx5/doorbell.h+9−30
@@ -36,46 +36,25 @@ · 35 unmodified lines
3636 #define MLX5_BF_OFFSET 0x800
3737 #define MLX5_CQ_DOORBELL 0x20
3838
39−#if BITS_PER_LONG == 64
4039 /* Assume that we can just write a 64-bit doorbell atomically. s390
4140 * actually doesn't have writeq() but S/390 systems don't even have
4241 * 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()
4348 */
4449
45−#define MLX5_DECLARE_DOORBELL_LOCK(name)
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)
50+static inline void mlx5_write64(__be32 val[2], void __iomem *dest)
5151 {
52+#if BITS_PER_LONG == 64
5253 __raw_writeq(*(u64 *)val, dest);
53−}
54−
5554 #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);
7355 __raw_writel((__force u32) val[0], dest);
7456 __raw_writel((__force u32) val[1], dest + 4);
75− if (doorbell_lock)
76− spin_unlock_irqrestore(doorbell_lock, flags);
77−}
78−
7957 #endif
58+}
8059
8160 #endif /* MLX5_DOORBELL_H */
include/linux/mlx5/driver.h+11−2
@@ -56,7 +56,6 @@ · 55 unmodified lines
5656
5757 enum {
5858 MLX5_BOARD_ID_LEN = 64,
59− MLX5_MAX_NAME_LEN = 16,
6059 };
6160
6261 enum {
@@ -133,6 +132,7 @@ enum { · 70 unmodified lines
133132 MLX5_REG_MTRC_CONF = 0x9041,
134133 MLX5_REG_MTRC_STDB = 0x9042,
135134 MLX5_REG_MTRC_CTRL = 0x9043,
135+ MLX5_REG_MPEIN = 0x9050,
136136 MLX5_REG_MPCNT = 0x9051,
137137 MLX5_REG_MTPPS = 0x9053,
138138 MLX5_REG_MTPPSE = 0x9054,
@@ -512,8 +512,13 @@ struct mlx5_rl_table { · 373 unmodified lines
512512 struct mlx5_rl_entry *rl_entry;
513513 };
514514
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+
515521 struct mlx5_priv {
516− char name[MLX5_MAX_NAME_LEN];
517522 struct mlx5_eq_table *eq_table;
518523
519524 /* pages stuff */
@@ -566,6 +571,7 @@ struct mlx5_priv { · 46 unmodified lines
566571 struct mlx5_lag *lag;
567572 struct mlx5_devcom *devcom;
568573 unsigned long pci_dev_data;
574+ struct mlx5_core_roce roce;
569575 struct mlx5_fc_stats fc_stats;
570576 struct mlx5_rl_table rl_table;
571577
@@ -642,6 +648,7 @@ struct mlx5_fw_tracer; · 70 unmodified lines
642648 struct mlx5_vxlan;
643649
644650 struct mlx5_core_dev {
651+ struct device *device;
645652 struct pci_dev *pdev;
646653 /* sync pci state */
647654 struct mutex pci_status_mutex;
@@ -662,6 +669,7 @@ struct mlx5_core_dev { · 14 unmodified lines
662669 u64 sys_image_guid;
663670 phys_addr_t iseg_base;
664671 struct mlx5_init_seg __iomem *iseg;
672+ phys_addr_t bar_addr;
665673 enum mlx5_device_state state;
666674 /* sync interface state */
667675 struct mutex intf_state_mutex;
@@ -887,6 +895,7 @@ void mlx5_cmd_mbox_status(void *out, u8 *status, u32 *syndrome); · 219 unmodified lines
887895 int mlx5_core_get_caps(struct mlx5_core_dev *dev, enum mlx5_cap_type cap_type);
888896 int mlx5_cmd_alloc_uar(struct mlx5_core_dev *dev, u32 *uarn);
889897 int mlx5_cmd_free_uar(struct mlx5_core_dev *dev, u32 uarn);
898+void mlx5_health_flush(struct mlx5_core_dev *dev);
890899 void mlx5_health_cleanup(struct mlx5_core_dev *dev);
891900 int mlx5_health_init(struct mlx5_core_dev *dev);
892901 void mlx5_start_health_poll(struct mlx5_core_dev *dev);
include/linux/mlx5/eswitch.h+1−1
@@ -35,7 +35,7 @@ struct mlx5_eswitch_rep_if { · 34 unmodified lines
3535 void (*unload)(struct mlx5_eswitch_rep *rep);
3636 void *(*get_proto_dev)(struct mlx5_eswitch_rep *rep);
3737 void *priv;
38− u8 state;
38+ atomic_t state;
3939 };
4040
4141 struct mlx5_eswitch_rep {
include/linux/mlx5/fs.h+7−0
@@ -73,6 +73,13 @@ enum mlx5_flow_namespace_type { · 72 unmodified lines
7373 MLX5_FLOW_NAMESPACE_SNIFFER_RX,
7474 MLX5_FLOW_NAMESPACE_SNIFFER_TX,
7575 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,
7683 };
7784
7885 struct mlx5_flow_table;
include/linux/mlx5/mlx5_ifc.h+167−16
@@ -80,6 +80,19 @@ enum { · 79 unmodified lines
8080 MLX5_SHARED_RESOURCE_UID = 0xffff,
8181 };
8282
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+
8396 enum {
8497 MLX5_CMD_OP_QUERY_HCA_CAP = 0x100,
8598 MLX5_CMD_OP_QUERY_ADAPTER = 0x101,
@@ -299,7 +312,11 @@ struct mlx5_ifc_flow_table_fields_supported_bits { · 213 unmodified lines
299312 u8 outer_gre_protocol[0x1];
300313 u8 outer_gre_key[0x1];
301314 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];
303320 u8 source_eswitch_port[0x1];
304321
305322 u8 inner_dmac[0x1];
@@ -327,7 +344,8 @@ struct mlx5_ifc_flow_table_fields_supported_bits { · 21 unmodified lines
327344 u8 inner_tcp_flags[0x1];
328345 u8 reserved_at_37[0x9];
329346
330− u8 reserved_at_40[0x5];
347+ u8 geneve_tlv_option_0_data[0x1];
348+ u8 reserved_at_41[0x4];
331349 u8 outer_first_mpls_over_udp[0x4];
332350 u8 outer_first_mpls_over_gre[0x4];
333351 u8 inner_first_mpls[0x4];
@@ -357,11 +375,14 @@ struct mlx5_ifc_flow_table_prop_layout_bits { · 23 unmodified lines
357375 u8 pop_vlan_2[0x1];
358376 u8 push_vlan_2[0x1];
359377 u8 reformat_and_vlan_action[0x1];
360− u8 reserved_at_10[0x2];
378+ u8 reserved_at_10[0x1];
379+ u8 sw_owner[0x1];
361380 u8 reformat_l3_tunnel_to_l2[0x1];
362381 u8 reformat_l2_to_l3_tunnel[0x1];
363382 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];
365386 u8 reserved_at_20[0x2];
366387 u8 log_max_ft_size[0x6];
367388 u8 log_max_modify_header_context[0x8];
@@ -469,7 +490,9 @@ struct mlx5_ifc_fte_match_set_misc_bits { · 101 unmodified lines
469490 u8 vxlan_vni[0x18];
470491 u8 reserved_at_b8[0x8];
471492
472− u8 reserved_at_c0[0x20];
493+ u8 geneve_vni[0x18];
494+ u8 reserved_at_d8[0x7];
495+ u8 geneve_oam[0x1];
473496
474497 u8 reserved_at_e0[0xc];
475498 u8 outer_ipv6_flow_label[0x14];
@@ -477,7 +500,11 @@ struct mlx5_ifc_fte_match_set_misc_bits { · 1 unmodified line
477500 u8 reserved_at_100[0xc];
478501 u8 inner_ipv6_flow_label[0x14];
479502
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];
481508 u8 bth_dst_qp[0x18];
482509 u8 reserved_at_160[0x20];
483510 u8 outer_esp_spi[0x20];
@@ -507,6 +534,12 @@ struct mlx5_ifc_fte_match_set_misc2_bits { · 23 unmodified lines
507534 u8 reserved_at_1a0[0x60];
508535 };
509536
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+
510543 struct mlx5_ifc_cmd_pas_bits {
511544 u8 pa_h[0x20];
512545
@@ -589,7 +622,7 @@ struct mlx5_ifc_flow_table_nic_cap_bits { · 76 unmodified lines
589622
590623 struct mlx5_ifc_flow_table_prop_layout_bits flow_table_properties_nic_receive;
591624
592− u8 reserved_at_400[0x200];
625+ struct mlx5_ifc_flow_table_prop_layout_bits flow_table_properties_nic_receive_rdma;
593626
594627 struct mlx5_ifc_flow_table_prop_layout_bits flow_table_properties_nic_receive_sniffer;
595628
@@ -770,7 +803,19 @@ struct mlx5_ifc_device_mem_cap_bits { · 174 unmodified lines
770803
771804 u8 max_memic_size[0x20];
772805
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];
774819 };
775820
776821 enum {
@@ -919,6 +964,7 @@ enum { · 142 unmodified lines
919964
920965 enum {
921966 MLX5_UCTX_CAP_RAW_TX = 1UL << 0,
967+ MLX5_UCTX_CAP_INTERNAL_DEV_RES = 1UL << 1,
922968 };
923969
924970 struct mlx5_ifc_cmd_hca_cap_bits {
@@ -929,7 +975,9 @@ struct mlx5_ifc_cmd_hca_cap_bits { · 4 unmodified lines
929975
930976 u8 log_max_srq_sz[0x8];
931977 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];
933981 u8 log_max_qp[0x5];
934982
935983 u8 reserved_at_a0[0xb];
@@ -1211,7 +1259,11 @@ struct mlx5_ifc_cmd_hca_cap_bits { · 275 unmodified lines
12111259 u8 num_of_uars_per_page[0x20];
12121260
12131261 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];
12151267
12161268 u8 reserved_at_580[0x3c];
12171269 u8 mini_cqe_resp_stride_index[0x1];
@@ -1247,7 +1299,9 @@ struct mlx5_ifc_cmd_hca_cap_bits { · 29 unmodified lines
12471299
12481300 u8 uctx_cap[0x20];
12491301
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];
12511305 };
12521306
12531307 enum mlx5_flow_destination_type {
@@ -1260,6 +1314,12 @@ enum mlx5_flow_destination_type { · 6 unmodified lines
12601314 MLX5_FLOW_DESTINATION_TYPE_FLOW_TABLE_NUM = 0x101,
12611315 };
12621316
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+
12631323 struct mlx5_ifc_dest_format_struct_bits {
12641324 u8 destination_type[0x8];
12651325 u8 destination_id[0x18];
@@ -1299,7 +1359,9 @@ struct mlx5_ifc_fte_match_param_bits { · 33 unmodified lines
12991359
13001360 struct mlx5_ifc_fte_match_set_misc2_bits misc_parameters_2;
13011361
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];
13031365 };
13041366
13051367 enum {
@@ -2920,6 +2982,7 @@ enum { · 1614 unmodified lines
29202982 MLX5_MKC_ACCESS_MODE_MTT = 0x1,
29212983 MLX5_MKC_ACCESS_MODE_KLMS = 0x2,
29222984 MLX5_MKC_ACCESS_MODE_KSM = 0x3,
2985+ MLX5_MKC_ACCESS_MODE_SW_ICM = 0x4,
29232986 MLX5_MKC_ACCESS_MODE_MEMIC = 0x5,
29242987 };
29252988
@@ -4807,6 +4870,7 @@ enum { · 1881 unmodified lines
48074870 MLX5_QUERY_FLOW_GROUP_OUT_MATCH_CRITERIA_ENABLE_MISC_PARAMETERS = 0x1,
48084871 MLX5_QUERY_FLOW_GROUP_OUT_MATCH_CRITERIA_ENABLE_INNER_HEADERS = 0x2,
48094872 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,
48104874 };
48114875
48124876 struct mlx5_ifc_query_flow_group_out_bits {
@@ -5110,6 +5174,7 @@ enum { · 297 unmodified lines
51105174 MLX5_ACTION_IN_FIELD_OUT_DIPV6_31_0 = 0x14,
51115175 MLX5_ACTION_IN_FIELD_OUT_SIPV4 = 0x15,
51125176 MLX5_ACTION_IN_FIELD_OUT_DIPV4 = 0x16,
5177+ MLX5_ACTION_IN_FIELD_OUT_FIRST_VID = 0x17,
51135178 MLX5_ACTION_IN_FIELD_OUT_IPV6_HOPLIMIT = 0x47,
51145179 };
51155180
@@ -6874,14 +6939,14 @@ struct mlx5_ifc_create_tis_in_bits { · 1758 unmodified lines
68746939
68756940 struct mlx5_ifc_create_tir_out_bits {
68766941 u8 status[0x8];
6877− u8 reserved_at_8[0x18];
6942+ u8 icm_address_63_40[0x18];
68786943
68796944 u8 syndrome[0x20];
68806945
6881− u8 reserved_at_40[0x8];
6946+ u8 icm_address_39_32[0x8];
68826947 u8 tirn[0x18];
68836948
6884− u8 reserved_at_60[0x20];
6949+ u8 icm_address_31_0[0x20];
68856950 };
68866951
68876952 struct mlx5_ifc_create_tir_in_bits {
@@ -8026,6 +8091,52 @@ struct mlx5_ifc_ppcnt_reg_bits { · 1138 unmodified lines
80268091 union mlx5_ifc_eth_cntrs_grp_data_layout_auto_bits counter_set;
80278092 };
80288093
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+
80298140 struct mlx5_ifc_mpcnt_reg_bits {
80308141 u8 reserved_at_0[0x8];
80318142 u8 pcie_index[0x8];
@@ -8345,7 +8456,9 @@ struct mlx5_ifc_pcam_reg_bits { · 313 unmodified lines
83458456 };
83468457
83478458 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];
83498462 u8 mark_tx_action_cnp[0x1];
83508463 u8 mark_tx_action_cqe[0x1];
83518464 u8 dynamic_tx_overflow[0x1];
@@ -8953,6 +9066,7 @@ union mlx5_ifc_ports_control_registers_document_bits { · 601 unmodified lines
89539066 struct mlx5_ifc_pmtu_reg_bits pmtu_reg;
89549067 struct mlx5_ifc_ppad_reg_bits ppad_reg;
89559068 struct mlx5_ifc_ppcnt_reg_bits ppcnt_reg;
9069+ struct mlx5_ifc_mpein_reg_bits mpein_reg;
89569070 struct mlx5_ifc_mpcnt_reg_bits mpcnt_reg;
89579071 struct mlx5_ifc_pplm_reg_bits pplm_reg;
89589072 struct mlx5_ifc_pplr_reg_bits pplr_reg;
@@ -9442,6 +9556,33 @@ struct mlx5_ifc_uctx_bits { · 483 unmodified lines
94429556 u8 reserved_at_20[0x160];
94439557 };
94449558
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+
94459586 struct mlx5_ifc_create_umem_in_bits {
94469587 u8 opcode[0x10];
94479588 u8 uid[0x10];
@@ -9479,6 +9620,16 @@ struct mlx5_ifc_destroy_uctx_in_bits { · 31 unmodified lines
94799620 u8 reserved_at_60[0x20];
94809621 };
94819622
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+
94829633 struct mlx5_ifc_mtrc_string_db_param_bits {
94839634 u8 string_db_base_address[0x20];
94849635
include/linux/mlx5/port.h+1−0
@@ -60,6 +60,7 @@ enum mlx5_an_status { · 59 unmodified lines
6060 #define MLX5_I2C_ADDR_LOW 0x50
6161 #define MLX5_I2C_ADDR_HIGH 0x51
6262 #define MLX5_EEPROM_PAGE_LENGTH 256
63+#define MLX5_EEPROM_HIGH_PAGE_LENGTH 128
6364
6465 enum mlx5e_link_mode {
6566 MLX5E_1000BASE_CX_SGMII = 0,
include/linux/mlx5/qp.h+1−0
@@ -395,6 +395,7 @@ struct mlx5_wqe_signature_seg { · 394 unmodified lines
395395
396396 struct mlx5_wqe_inline_seg {
397397 __be32 byte_count;
398+ __be32 data[0];
398399 };
399400
400401 enum mlx5_sig_type {
include/linux/mlx5/transobj.h+3−0
@@ -50,6 +50,9 @@ int mlx5_core_query_sq(struct mlx5_core_dev *dev, u32 sqn, u32 *out); · 49 unmodified lines
5050 int mlx5_core_query_sq_state(struct mlx5_core_dev *dev, u32 sqn, u8 *state);
5151 int mlx5_core_create_tir(struct mlx5_core_dev *dev, u32 *in, int inlen,
5252 u32 *tirn);
53+int mlx5_core_create_tir_out(struct mlx5_core_dev *dev,
54+ u32 *in, int inlen,
55+ u32 *out, int outlen);
5356 int mlx5_core_modify_tir(struct mlx5_core_dev *dev, u32 tirn, u32 *in,
5457 int inlen);
5558 void mlx5_core_destroy_tir(struct mlx5_core_dev *dev, u32 tirn);
include/linux/mlx5/vport.h+0−4
@@ -118,10 +118,6 @@ int mlx5_modify_nic_vport_promisc(struct mlx5_core_dev *mdev, · 117 unmodified lines
118118 int promisc_uc,
119119 int promisc_mc,
120120 int promisc_all);
121−int mlx5_query_nic_vport_vlans(struct mlx5_core_dev *dev,
122− u16 vport,
123− u16 vlans[],
124− int *size);
125121 int mlx5_modify_nic_vport_vlans(struct mlx5_core_dev *dev,
126122 u16 vlans[],
127123 int list_size);
include/linux/mmc/sdio_func.h+12−0
@@ -111,6 +111,18 @@ struct sdio_driver { · 110 unmodified lines
111111 extern int sdio_register_driver(struct sdio_driver *);
112112 extern void sdio_unregister_driver(struct sdio_driver *);
113113
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+
114126 /*
115127 * SDIO I/O operations
116128 */
include/linux/mmc/sdio_ids.h+2−0
@@ -59,6 +59,8 @@ · 58 unmodified lines
5959 #define SDIO_DEVICE_ID_MARVELL_8797_F0 0x9128
6060 #define SDIO_DEVICE_ID_MARVELL_8887WLAN 0x9134
6161
62+#define SDIO_VENDOR_ID_MEDIATEK 0x037a
63+
6264 #define SDIO_VENDOR_ID_SIANO 0x039a
6365 #define SDIO_DEVICE_ID_SIANO_NOVA_B0 0x0201
6466 #define SDIO_DEVICE_ID_SIANO_NICE 0x0202
include/linux/net.h+2−0
@@ -161,6 +161,8 @@ struct proto_ops { · 160 unmodified lines
161161 int (*compat_ioctl) (struct socket *sock, unsigned int cmd,
162162 unsigned long arg);
163163 #endif
164+ int (*gettstamp) (struct socket *sock, void __user *userstamp,
165+ bool timeval, bool time32);
164166 int (*listen) (struct socket *sock, int len);
165167 int (*shutdown) (struct socket *sock, int flags);
166168 int (*setsockopt)(struct socket *sock, int level,
include/linux/netdevice.h+48−47
@@ -194,8 +194,8 @@ struct net_device_stats { · 193 unmodified lines
194194
195195 #ifdef CONFIG_RPS
196196 #include <linux/static_key.h>
197−extern struct static_key rps_needed;
198−extern struct static_key rfs_needed;
197+extern struct static_key_false rps_needed;
198+extern struct static_key_false rfs_needed;
199199 #endif
200200
201201 struct neighbour;
@@ -914,34 +914,13 @@ struct xfrmdev_ops { · 712 unmodified lines
914914 };
915915 #endif
916916
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−
939917 struct dev_ifalias {
940918 struct rcu_head rcuhead;
941919 char ifalias[];
942920 };
943921
944922 struct devlink;
923+struct tlsdev_ops;
945924
946925 /*
947926 * This structure defines the management hooks for network devices.
@@ -986,8 +965,7 @@ struct devlink; · 38 unmodified lines
986965 * those the driver believes to be appropriate.
987966 *
988967 * u16 (*ndo_select_queue)(struct net_device *dev, struct sk_buff *skb,
989− * struct net_device *sb_dev,
990− * select_queue_fallback_t fallback);
968+ * struct net_device *sb_dev);
991969 * Called to decide which queue to use when device supports multiple
992970 * transmit queues.
993971 *
@@ -1251,8 +1229,8 @@ struct devlink; · 257 unmodified lines
12511229 * that got dropped are freed/returned via xdp_return_frame().
12521230 * Returns negative number, means general error invoking ndo, meaning
12531231 * no frames were xmit'ed and core-caller will free all frames.
1254− * struct devlink *(*ndo_get_devlink)(struct net_device *dev);
1255− * Get devlink instance associated with a given netdev.
1232+ * struct devlink_port *(*ndo_get_devlink_port)(struct net_device *dev);
1233+ * Get devlink port instance associated with a given netdev.
12561234 * Called with a reference on the netdevice and devlink locks only,
12571235 * rtnl_lock is not held.
12581236 */
@@ -1268,8 +1246,7 @@ struct net_device_ops { · 9 unmodified lines
12681246 netdev_features_t features);
12691247 u16 (*ndo_select_queue)(struct net_device *dev,
12701248 struct sk_buff *skb,
1271− struct net_device *sb_dev,
1272− select_queue_fallback_t fallback);
1249+ struct net_device *sb_dev);
12731250 void (*ndo_change_rx_flags)(struct net_device *dev,
12741251 int flags);
12751252 void (*ndo_set_rx_mode)(struct net_device *dev);
@@ -1453,7 +1430,7 @@ struct net_device_ops { · 177 unmodified lines
14531430 u32 flags);
14541431 int (*ndo_xsk_async_xmit)(struct net_device *dev,
14551432 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);
14571434 };
14581435
14591436 /**
@@ -2155,9 +2132,11 @@ static inline void netdev_for_each_tx_queue(struct net_device *dev, · 695 unmodified lines
21552132 &qdisc_xmit_lock_key); \
21562133 }
21572134
2158−struct netdev_queue *netdev_pick_tx(struct net_device *dev,
2159− struct sk_buff *skb,
2160− struct net_device *sb_dev);
2135+u16 netdev_pick_tx(struct net_device *dev, struct sk_buff *skb,
2136+ 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);
21612140
21622141 /* returns the headroom that the master device needs to take in account
21632142 * when forwarding to this dev
@@ -2642,11 +2621,9 @@ void dev_close_many(struct list_head *head, bool unlink); · 478 unmodified lines
26422621 void dev_disable_lro(struct net_device *dev);
26432622 int dev_loopback_xmit(struct net *net, struct sock *sk, struct sk_buff *newskb);
26442623 u16 dev_pick_tx_zero(struct net_device *dev, struct sk_buff *skb,
2645− struct net_device *sb_dev,
2646− select_queue_fallback_t fallback);
2624+ struct net_device *sb_dev);
26472625 u16 dev_pick_tx_cpu_id(struct net_device *dev, struct sk_buff *skb,
2648− struct net_device *sb_dev,
2649− select_queue_fallback_t fallback);
2626+ struct net_device *sb_dev);
26502627 int dev_queue_xmit(struct sk_buff *skb);
26512628 int dev_queue_xmit_accel(struct sk_buff *skb, struct net_device *sb_dev);
26522629 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
26642641 void synchronize_net(void);
26652642 int init_dummy_netdev(struct net_device *dev);
26662643
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−
26752644 struct net_device *dev_get_by_index(struct net *net, int ifindex);
26762645 struct net_device *__dev_get_by_index(struct net *net, int ifindex);
26772646 struct net_device *dev_get_by_index_rcu(struct net *net, int ifindex);
@@ -3020,6 +2989,11 @@ struct softnet_data { · 342 unmodified lines
30202989 #ifdef CONFIG_XFRM_OFFLOAD
30212990 struct sk_buff_head xfrm_backlog;
30222991 #endif
2992+ /* written and read only by owning cpu: */
2993+ struct {
2994+ u16 recursion;
2995+ u8 more;
2996+ } xmit;
30232997 #ifdef CONFIG_RPS
30242998 /* input_queue_head should be written by cpu owning this struct,
30252999 * 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
30553029
30563030 DECLARE_PER_CPU_ALIGNED(struct softnet_data, softnet_data);
30573031
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+
30583054 void __netif_schedule(struct Qdisc *q);
30593055 void netif_schedule_queue(struct netdev_queue *txq);
30603056
@@ -4410,10 +4406,15 @@ static inline netdev_tx_t __netdev_start_xmit(const struct net_device_ops *ops, · 1349 unmodified lines
44104406 struct sk_buff *skb, struct net_device *dev,
44114407 bool more)
44124408 {
4413− skb->xmit_more = more ? 1 : 0;
4409+ __this_cpu_write(softnet_data.xmit.more, more);
44144410 return ops->ndo_start_xmit(skb, dev);
44154411 }
44164412
4413+static inline bool netdev_xmit_more(void)
4414+{
4415+ return __this_cpu_read(softnet_data.xmit.more);
4416+}
4417+
44174418 static inline netdev_tx_t netdev_start_xmit(struct sk_buff *skb, struct net_device *dev,
44184419 struct netdev_queue *txq, bool more)
44194420 {
include/linux/netfilter.h+17−1
@@ -24,20 +24,36 @@ static inline int NF_DROP_GETERR(int verdict) · 23 unmodified lines
2424 static inline int nf_inet_addr_cmp(const union nf_inet_addr *a1,
2525 const union nf_inet_addr *a2)
2626 {
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
2733 return a1->all[0] == a2->all[0] &&
2834 a1->all[1] == a2->all[1] &&
2935 a1->all[2] == a2->all[2] &&
3036 a1->all[3] == a2->all[3];
37+#endif
3138 }
3239
3340 static inline void nf_inet_addr_mask(const union nf_inet_addr *a1,
3441 union nf_inet_addr *result,
3542 const union nf_inet_addr *mask)
3643 {
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
3752 result->all[0] = a1->all[0] & mask->all[0];
3853 result->all[1] = a1->all[1] & mask->all[1];
3954 result->all[2] = a1->all[2] & mask->all[2];
4055 result->all[3] = a1->all[3] & mask->all[3];
56+#endif
4157 }
4258
4359 int netfilter_init(void);
@@ -360,7 +376,7 @@ extern struct nf_nat_hook __rcu *nf_nat_hook; · 316 unmodified lines
360376 static inline void
361377 nf_nat_decode_session(struct sk_buff *skb, struct flowi *fl, u_int8_t family)
362378 {
363−#ifdef CONFIG_NF_NAT_NEEDED
379+#if IS_ENABLED(CONFIG_NF_NAT)
364380 struct nf_nat_hook *nat_hook;
365381
366382 rcu_read_lock();
include/linux/netfilter/ipset/ip_set.h+4−7
@@ -401,33 +401,30 @@ ip_set_get_h16(const struct nlattr *attr) · 400 unmodified lines
401401 return ntohs(nla_get_be16(attr));
402402 }
403403
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−
407404 static inline int nla_put_ipaddr4(struct sk_buff *skb, int type, __be32 ipaddr)
408405 {
409− struct nlattr *__nested = ipset_nest_start(skb, type);
406+ struct nlattr *__nested = nla_nest_start(skb, type);
410407 int ret;
411408
412409 if (!__nested)
413410 return -EMSGSIZE;
414411 ret = nla_put_in_addr(skb, IPSET_ATTR_IPADDR_IPV4, ipaddr);
415412 if (!ret)
416− ipset_nest_end(skb, __nested);
413+ nla_nest_end(skb, __nested);
417414 return ret;
418415 }
419416
420417 static inline int nla_put_ipaddr6(struct sk_buff *skb, int type,
421418 const struct in6_addr *ipaddrptr)
422419 {
423− struct nlattr *__nested = ipset_nest_start(skb, type);
420+ struct nlattr *__nested = nla_nest_start(skb, type);
424421 int ret;
425422
426423 if (!__nested)
427424 return -EMSGSIZE;
428425 ret = nla_put_in6_addr(skb, IPSET_ATTR_IPADDR_IPV6, ipaddrptr);
429426 if (!ret)
430− ipset_nest_end(skb, __nested);
427+ nla_nest_end(skb, __nested);
431428 return ret;
432429 }
433430
include/linux/netfilter/nfnetlink_osf.h+8−3
@@ -21,13 +21,18 @@ struct nf_osf_finger { · 20 unmodified lines
2121 struct nf_osf_user_finger finger;
2222 };
2323
24+struct nf_osf_data {
25+ const char *genre;
26+ const char *version;
27+};
28+
2429 bool nf_osf_match(const struct sk_buff *skb, u_int8_t family,
2530 int hooknum, struct net_device *in, struct net_device *out,
2631 const struct nf_osf_info *info, struct net *net,
2732 const struct list_head *nf_osf_fingers);
2833
29−const char *nf_osf_find(const struct sk_buff *skb,
30− const struct list_head *nf_osf_fingers,
31− const int ttl_check);
34+bool nf_osf_find(const struct sk_buff *skb,
35+ const struct list_head *nf_osf_fingers,
36+ const int ttl_check, struct nf_osf_data *data);
3237
3338 #endif /* _NFOSF_H */
include/linux/netfilter/x_tables.h+0−1
@@ -317,7 +317,6 @@ struct xt_table_info *xt_replace_table(struct xt_table *table, · 316 unmodified lines
317317 int *error);
318318
319319 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);
321320 struct xt_match *xt_request_find_match(u8 af, const char *name, u8 revision);
322321 struct xt_target *xt_request_find_target(u8 af, const char *name, u8 revision);
323322 int xt_find_revision(u8 af, const char *name, u8 revision, int target,
include/linux/netfilter_ipv6.h+15−0
@@ -87,6 +87,21 @@ static inline int nf_ip6_route(struct net *net, struct dst_entry **dst, · 86 unmodified lines
8787 }
8888
8989 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+
90105 __sum16 nf_ip6_checksum(struct sk_buff *skb, unsigned int hook,
91106 unsigned int dataoff, u_int8_t protocol);
92107
include/linux/packing.h+49−0
@@ -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
include/linux/phy.h+6−8
@@ -308,13 +308,7 @@ struct phy_device *mdiobus_scan(struct mii_bus *bus, int addr); · 307 unmodified lines
308308 *
309309 * HALTED: PHY is up, but no polling or interrupts are done. Or
310310 * PHY is in an error state.
311− *
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
311+ * - phy_start moves to UP
318312 */
319313 enum phy_state {
320314 PHY_DOWN = 0,
@@ -324,7 +318,6 @@ enum phy_state { · 3 unmodified lines
324318 PHY_RUNNING,
325319 PHY_NOLINK,
326320 PHY_FORCING,
327− PHY_RESUMING
328321 };
329322
330323 /**
@@ -345,6 +338,7 @@ struct phy_c45_device_ids { · 14 unmodified lines
345338 * is_c45: Set to true if this phy uses clause 45 addressing.
346339 * is_internal: Set to true if this phy is internal to a MAC.
347340 * 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
348342 * has_fixups: Set to true if this phy has fixups/quirks.
349343 * suspended: Set to true if this phy has been suspended successfully.
350344 * sysfs_links: Internal boolean tracking sysfs symbolic links setup/removal.
@@ -382,6 +376,7 @@ struct phy_device { · 31 unmodified lines
382376 unsigned is_c45:1;
383377 unsigned is_internal:1;
384378 unsigned is_pseudo_fixed_link:1;
379+ unsigned is_gigabit_capable:1;
385380 unsigned has_fixups:1;
386381 unsigned suspended:1;
387382 unsigned sysfs_links:1;
@@ -390,6 +385,7 @@ struct phy_device { · 2 unmodified lines
390385 unsigned autoneg:1;
391386 /* The most recently read link state */
392387 unsigned link:1;
388+ unsigned autoneg_complete:1;
393389
394390 /* Interrupts are enabled */
395391 unsigned interrupts:1;
@@ -1075,6 +1071,7 @@ void phy_attached_info(struct phy_device *phydev); · 679 unmodified lines
10751071
10761072 /* Clause 22 PHY */
10771073 int genphy_config_init(struct phy_device *phydev);
1074+int genphy_read_abilities(struct phy_device *phydev);
10781075 int genphy_setup_forced(struct phy_device *phydev);
10791076 int genphy_restart_aneg(struct phy_device *phydev);
10801077 int genphy_config_eee_advert(struct phy_device *phydev);
@@ -1150,6 +1147,7 @@ void phy_request_interrupt(struct phy_device *phydev); · 69 unmodified lines
11501147 void phy_print_status(struct phy_device *phydev);
11511148 int phy_set_max_speed(struct phy_device *phydev, u32 max_speed);
11521149 void phy_remove_link_mode(struct phy_device *phydev, u32 link_mode);
1150+void phy_advertise_supported(struct phy_device *phydev);
11531151 void phy_support_sym_pause(struct phy_device *phydev);
11541152 void phy_support_asym_pause(struct phy_device *phydev);
11551153 void phy_set_sym_pause(struct phy_device *phydev, bool rx, bool tx,
include/linux/platform_data/macb.h+0−9
@@ -12,19 +12,10 @@ · 11 unmodified lines
1212
1313 /**
1414 * 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
2015 * @pclk: platform clock
2116 * @hclk: AHB clock
2217 */
2318 struct macb_platform_data {
24− u32 phy_mask;
25− int phy_irq_pin;
26− u8 is_rmii;
27− u8 rev_eth_addr;
2819 struct clk *pclk;
2920 struct clk *hclk;
3021 };
include/linux/platform_data/mv88e6xxx.h+1−0
@@ -13,6 +13,7 @@ struct dsa_mv88e6xxx_pdata { · 12 unmodified lines
1313 unsigned int enabled_ports;
1414 struct net_device *netdev;
1515 u32 eeprom_len;
16+ int irq;
1617 };
1718
1819 #endif
include/linux/platform_data/xilinx-ll-temac.h+32−0
@@ -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 */
include/linux/rhashtable-types.h+0−2
@@ -48,7 +48,6 @@ typedef int (*rht_obj_cmpfn_t)(struct rhashtable_compare_arg *arg, · 47 unmodified lines
4848 * @head_offset: Offset of rhash_head in struct to be hashed
4949 * @max_size: Maximum size while expanding
5050 * @min_size: Minimum size while shrinking
51− * @locks_mul: Number of bucket locks to allocate per cpu (default: 32)
5251 * @automatic_shrinking: Enable automatic shrinking of tables
5352 * @hashfn: Hash function (default: jhash2 if !(key_len % 4), or jhash)
5453 * @obj_hashfn: Function to hash object
@@ -62,7 +61,6 @@ struct rhashtable_params { · 7 unmodified lines
6261 unsigned int max_size;
6362 u16 min_size;
6463 bool automatic_shrinking;
65− u8 locks_mul;
6664 rht_hashfn_t hashfn;
6765 rht_obj_hashfn_t obj_hashfn;
6866 rht_obj_cmpfn_t obj_cmpfn;
include/linux/rhashtable.h+235−123
@@ -24,12 +24,27 @@ · 23 unmodified lines
2424 #include <linux/list_nulls.h>
2525 #include <linux/workqueue.h>
2626 #include <linux/rculist.h>
27+#include <linux/bit_spinlock.h>
2728
2829 #include <linux/rhashtable-types.h>
2930 /*
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.
3034 * 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.
3246 */
47+struct rhash_lock_head {};
3348
3449 /* Maximum chain length before rehash
3550 *
@@ -52,8 +67,6 @@ · 16 unmodified lines
5267 * @nest: Number of bits of first-level nested table.
5368 * @rehash: Current bucket being rehashed
5469 * @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
5770 * @walkers: List of active walkers
5871 * @rcu: RCU structure for freeing the table
5972 * @future_tbl: Table under construction during rehashing
@@ -63,31 +76,34 @@ · 3 unmodified lines
6376 struct bucket_table {
6477 unsigned int size;
6578 unsigned int nest;
66− unsigned int rehash;
6779 u32 hash_rnd;
68− unsigned int locks_mask;
69− spinlock_t *locks;
7080 struct list_head walkers;
7181 struct rcu_head rcu;
7282
7383 struct bucket_table __rcu *future_tbl;
7484
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;
7688 };
7789
7890 /*
7991 * NULLS_MARKER() expects a hash value with the low
8092 * bits mostly likely to be significant, and it discards
8193 * 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
8395 * always 0, and the msb might be significant.
8496 * So we shift the address down one bit to align with
8597 * 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
86102 */
87103 #define RHT_NULLS_MARKER(ptr) \
88104 ((void *)NULLS_MARKER(((unsigned long) (ptr)) >> 1))
89105 #define INIT_RHT_NULLS_HEAD(ptr) \
90− ((ptr) = RHT_NULLS_MARKER(&(ptr)))
106+ ((ptr) = NULL)
91107
92108 static inline bool rht_is_a_nulls(const struct rhash_head *ptr)
93109 {
@@ -207,25 +223,6 @@ static inline bool rht_grow_above_max(const struct rhashtable *ht, · 113 unmodified lines
207223 return atomic_read(&ht->nelems) >= ht->max_elems;
208224 }
209225
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−
229226 #ifdef CONFIG_PROVE_LOCKING
230227 int lockdep_rht_mutex_is_held(struct rhashtable *ht);
231228 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
264261 void *arg);
265262 void rhashtable_destroy(struct rhashtable *ht);
266263
267−struct rhash_head __rcu **rht_bucket_nested(const struct bucket_table *tbl,
268− unsigned int hash);
269−struct rhash_head __rcu **rht_bucket_nested_insert(struct rhashtable *ht,
270− struct bucket_table *tbl,
264+struct rhash_lock_head __rcu **rht_bucket_nested(const struct bucket_table *tbl,
265+ unsigned int hash);
266+struct rhash_lock_head __rcu **__rht_bucket_nested(const struct bucket_table *tbl,
271267 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);
272271
273272 #define rht_dereference(p, ht) \
274273 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
285284 #define rht_entry(tpos, pos, member) \
286285 ({ tpos = container_of(pos, typeof(*tpos), member); 1; })
287286
288−static inline struct rhash_head __rcu *const *rht_bucket(
287+static inline struct rhash_lock_head __rcu *const *rht_bucket(
289288 const struct bucket_table *tbl, unsigned int hash)
290289 {
291290 return unlikely(tbl->nest) ? rht_bucket_nested(tbl, hash) :
292291 &tbl->buckets[hash];
293292 }
294293
295−static inline struct rhash_head __rcu **rht_bucket_var(
294+static inline struct rhash_lock_head __rcu **rht_bucket_var(
296295 struct bucket_table *tbl, unsigned int hash)
297296 {
298− return unlikely(tbl->nest) ? rht_bucket_nested(tbl, hash) :
297+ return unlikely(tbl->nest) ? __rht_bucket_nested(tbl, hash) :
299298 &tbl->buckets[hash];
300299 }
301300
302−static inline struct rhash_head __rcu **rht_bucket_insert(
301+static inline struct rhash_lock_head __rcu **rht_bucket_insert(
303302 struct rhashtable *ht, struct bucket_table *tbl, unsigned int hash)
304303 {
305304 return unlikely(tbl->nest) ? rht_bucket_nested_insert(ht, tbl, hash) :
306305 &tbl->buckets[hash];
307306 }
308307
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+
309407 /**
310− * rht_for_each_continue - continue iterating over hash chain
408+ * rht_for_each_from - iterate over hash chain from given head
311409 * @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
313411 * @tbl: the &struct bucket_table
314412 * @hash: the hash value / bucket index
315413 */
316−#define rht_for_each_continue(pos, head, tbl, hash) \
317− for (pos = rht_dereference_bucket(head, tbl, hash); \
318− !rht_is_a_nulls(pos); \
414+#define rht_for_each_from(pos, head, tbl, hash) \
415+ for (pos = head; \
416+ !rht_is_a_nulls(pos); \
319417 pos = rht_dereference_bucket((pos)->next, tbl, hash))
320418
321419 /**
@@ -325,19 +423,20 @@ static inline struct rhash_head __rcu **rht_bucket_insert( · 3 unmodified lines
325423 * @hash: the hash value / bucket index
326424 */
327425 #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)
329428
330429 /**
331− * rht_for_each_entry_continue - continue iterating over hash chain
430+ * rht_for_each_entry_from - iterate over hash chain from given head
332431 * @tpos: the type * to use as a loop cursor.
333432 * @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
335434 * @tbl: the &struct bucket_table
336435 * @hash: the hash value / bucket index
337436 * @member: name of the &struct rhash_head within the hashable struct.
338437 */
339−#define rht_for_each_entry_continue(tpos, pos, head, tbl, hash, member) \
340− for (pos = rht_dereference_bucket(head, tbl, hash); \
438+#define rht_for_each_entry_from(tpos, pos, head, tbl, hash, member) \
439+ for (pos = head; \
341440 (!rht_is_a_nulls(pos)) && rht_entry(tpos, pos, member); \
342441 pos = rht_dereference_bucket((pos)->next, tbl, hash))
343442
@@ -350,8 +449,9 @@ static inline struct rhash_head __rcu **rht_bucket_insert( · 6 unmodified lines
350449 * @member: name of the &struct rhash_head within the hashable struct.
351450 */
352451 #define rht_for_each_entry(tpos, pos, tbl, hash, member) \
353− rht_for_each_entry_continue(tpos, pos, *rht_bucket(tbl, hash), \
354− tbl, hash, member)
452+ rht_for_each_entry_from(tpos, pos, \
453+ rht_ptr(rht_bucket(tbl, hash), tbl, hash), \
454+ tbl, hash, member)
355455
356456 /**
357457 * 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
366466 * remove the loop cursor from the list.
367467 */
368468 #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), \
370470 next = !rht_is_a_nulls(pos) ? \
371471 rht_dereference_bucket(pos->next, tbl, hash) : NULL; \
372472 (!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
375475 rht_dereference_bucket(pos->next, tbl, hash) : NULL)
376476
377477 /**
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
379479 * @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
381481 * @tbl: the &struct bucket_table
382482 * @hash: the hash value / bucket index
383483 *
@@ -385,9 +485,9 @@ static inline struct rhash_head __rcu **rht_bucket_insert( · 1 unmodified line
385485 * the _rcu mutation primitives such as rhashtable_insert() as long as the
386486 * traversal is guarded by rcu_read_lock().
387487 */
388−#define rht_for_each_rcu_continue(pos, head, tbl, hash) \
488+#define rht_for_each_rcu_from(pos, head, tbl, hash) \
389489 for (({barrier(); }), \
390− pos = rht_dereference_bucket_rcu(head, tbl, hash); \
490+ pos = head; \
391491 !rht_is_a_nulls(pos); \
392492 pos = rcu_dereference_raw(pos->next))
393493
@@ -401,14 +501,17 @@ static inline struct rhash_head __rcu **rht_bucket_insert( · 7 unmodified lines
401501 * the _rcu mutation primitives such as rhashtable_insert() as long as the
402502 * traversal is guarded by rcu_read_lock().
403503 */
404−#define rht_for_each_rcu(pos, tbl, hash) \
405− rht_for_each_rcu_continue(pos, *rht_bucket(tbl, hash), tbl, hash)
504+#define rht_for_each_rcu(pos, 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))
406509
407510 /**
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
409512 * @tpos: the type * to use as a loop cursor.
410513 * @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
412515 * @tbl: the &struct bucket_table
413516 * @hash: the hash value / bucket index
414517 * @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
417520 * the _rcu mutation primitives such as rhashtable_insert() as long as the
418521 * traversal is guarded by rcu_read_lock().
419522 */
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) \
421524 for (({barrier(); }), \
422− pos = rht_dereference_bucket_rcu(head, tbl, hash); \
525+ pos = head; \
423526 (!rht_is_a_nulls(pos)) && rht_entry(tpos, pos, member); \
424527 pos = rht_dereference_bucket_rcu(pos->next, tbl, hash))
425528
@@ -436,8 +539,10 @@ static inline struct rhash_head __rcu **rht_bucket_insert( · 10 unmodified lines
436539 * traversal is guarded by rcu_read_lock().
437540 */
438541 #define rht_for_each_entry_rcu(tpos, pos, tbl, hash, member) \
439− rht_for_each_entry_rcu_continue(tpos, pos, *rht_bucket(tbl, hash), \
440− tbl, hash, member)
542+ rht_for_each_entry_rcu_from(tpos, pos, \
543+ rht_ptr(rht_bucket(tbl, hash), \
544+ tbl, hash), \
545+ tbl, hash, member)
441546
442547 /**
443548 * rhl_for_each_rcu - iterate over rcu hash table list
@@ -482,7 +587,7 @@ static inline struct rhash_head *__rhashtable_lookup( · 38 unmodified lines
482587 .ht = ht,
483588 .key = key,
484589 };
485− struct rhash_head __rcu * const *head;
590+ struct rhash_lock_head __rcu * const *bkt;
486591 struct bucket_table *tbl;
487592 struct rhash_head *he;
488593 unsigned int hash;
@@ -490,9 +595,9 @@ static inline struct rhash_head *__rhashtable_lookup( · 1 unmodified line
490595 tbl = rht_dereference_rcu(ht->tbl, ht);
491596 restart:
492597 hash = rht_key_hashfn(ht, tbl, key, params);
493− head = rht_bucket(tbl, hash);
598+ bkt = rht_bucket(tbl, hash);
494599 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) {
496601 if (params.obj_cmpfn ?
497602 params.obj_cmpfn(&arg, rht_obj(ht, he)) :
498603 rhashtable_compare(&arg, rht_obj(ht, he)))
@@ -502,7 +607,7 @@ restart: · 3 unmodified lines
502607 /* An object might have been moved to a different hash chain,
503608 * while we walk along it - better check and retry.
504609 */
505− } while (he != RHT_NULLS_MARKER(head));
610+ } while (he != RHT_NULLS_MARKER(bkt));
506611
507612 /* Ensure we see any new tables. */
508613 smp_rmb();
@@ -598,10 +703,10 @@ static inline void *__rhashtable_insert_fast( · 89 unmodified lines
598703 .ht = ht,
599704 .key = key,
600705 };
706+ struct rhash_lock_head __rcu **bkt;
601707 struct rhash_head __rcu **pprev;
602708 struct bucket_table *tbl;
603709 struct rhash_head *head;
604− spinlock_t *lock;
605710 unsigned int hash;
606711 int elasticity;
607712 void *data;
@@ -610,23 +715,22 @@ static inline void *__rhashtable_insert_fast( · 2 unmodified lines
610715
611716 tbl = rht_dereference_rcu(ht->tbl, ht);
612717 hash = rht_head_hashfn(ht, tbl, obj, params);
613− lock = rht_bucket_lock(tbl, hash);
614− spin_lock_bh(lock);
718+ elasticity = RHT_ELASTICITY;
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);
615725
616726 if (unlikely(rcu_access_pointer(tbl->future_tbl))) {
617727 slow_path:
618− spin_unlock_bh(lock);
728+ rht_unlock(tbl, bkt);
619729 rcu_read_unlock();
620730 return rhashtable_insert_slow(ht, key, obj);
621731 }
622732
623− elasticity = RHT_ELASTICITY;
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) {
733+ rht_for_each_from(head, rht_ptr(bkt, tbl, hash), tbl, hash) {
630734 struct rhlist_head *plist;
631735 struct rhlist_head *list;
632736
@@ -642,7 +746,7 @@ slow_path: · 9 unmodified lines
642746 data = rht_obj(ht, head);
643747
644748 if (!rhlist)
645− goto out;
749+ goto out_unlock;
646750
647751
648752 list = container_of(obj, struct rhlist_head, rhead);
@@ -651,9 +755,13 @@ slow_path: · 2 unmodified lines
651755 RCU_INIT_POINTER(list->next, plist);
652756 head = rht_dereference_bucket(head->next, tbl, hash);
653757 RCU_INIT_POINTER(list->rhead.next, head);
654− rcu_assign_pointer(*pprev, obj);
655−
656− goto good;
758+ if (pprev) {
759+ rcu_assign_pointer(*pprev, obj);
760+ rht_unlock(tbl, bkt);
761+ } else
762+ rht_assign_unlock(tbl, bkt, obj);
763+ data = NULL;
764+ goto out;
657765 }
658766
659767 if (elasticity <= 0)
@@ -661,12 +769,13 @@ slow_path: · 1 unmodified line
661769
662770 data = ERR_PTR(-E2BIG);
663771 if (unlikely(rht_grow_above_max(ht, tbl)))
664− goto out;
772+ goto out_unlock;
665773
666774 if (unlikely(rht_grow_above_100(ht, tbl)))
667775 goto slow_path;
668776
669− head = rht_dereference_bucket(*pprev, tbl, hash);
777+ /* Inserting at head of list makes unlocking free. */
778+ head = rht_ptr(bkt, tbl, hash);
670779
671780 RCU_INIT_POINTER(obj->next, head);
672781 if (rhlist) {
@@ -676,20 +785,21 @@ slow_path: · 3 unmodified lines
676785 RCU_INIT_POINTER(list->next, NULL);
677786 }
678787
679− rcu_assign_pointer(*pprev, obj);
680−
681788 atomic_inc(&ht->nelems);
789+ rht_assign_unlock(tbl, bkt, obj);
790+
682791 if (rht_grow_above_75(ht, tbl))
683792 schedule_work(&ht->run_work);
684793
685−good:
686794 data = NULL;
687−
688795 out:
689− spin_unlock_bh(lock);
690796 rcu_read_unlock();
691797
692798 return data;
799+
800+out_unlock:
801+ rht_unlock(tbl, bkt);
802+ goto out;
693803 }
694804
695805 /**
@@ -698,9 +808,9 @@ out: · 2 unmodified lines
698808 * @obj: pointer to hash head inside object
699809 * @params: hash table parameters
700810 *
701− * Will take a per bucket spinlock to protect against mutual mutations
811+ * Will take the per bucket bitlock to protect against mutual mutations
702812 * 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.
704814 *
705815 * It is safe to call this function from atomic context.
706816 *
@@ -727,9 +837,9 @@ static inline int rhashtable_insert_fast( · 20 unmodified lines
727837 * @list: pointer to hash list head inside object
728838 * @params: hash table parameters
729839 *
730− * Will take a per bucket spinlock to protect against mutual mutations
840+ * Will take the per bucket bitlock to protect against mutual mutations
731841 * 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.
733843 *
734844 * It is safe to call this function from atomic context.
735845 *
@@ -750,9 +860,9 @@ static inline int rhltable_insert_key( · 14 unmodified lines
750860 * @list: pointer to hash list head inside object
751861 * @params: hash table parameters
752862 *
753− * Will take a per bucket spinlock to protect against mutual mutations
863+ * Will take the per bucket bitlock to protect against mutual mutations
754864 * 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.
756866 *
757867 * It is safe to call this function from atomic context.
758868 *
@@ -776,12 +886,6 @@ static inline int rhltable_insert( · 17 unmodified lines
776886 * @obj: pointer to hash head inside object
777887 * @params: hash table parameters
778888 *
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− *
785889 * This lookup function may only be used for fixed key hash table (key_len
786890 * parameter set). It will BUG() if used inappropriately.
787891 *
@@ -837,12 +941,6 @@ static inline void *rhashtable_lookup_get_insert_fast( · 49 unmodified lines
837941 * @obj: pointer to hash head inside object
838942 * @params: hash table parameters
839943 *
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− *
846944 * Lookups may occur in parallel with hashtable mutations and resizing.
847945 *
848946 * 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
891989 struct rhash_head *obj, const struct rhashtable_params params,
892990 bool rhlist)
893991 {
992+ struct rhash_lock_head __rcu **bkt;
894993 struct rhash_head __rcu **pprev;
895994 struct rhash_head *he;
896− spinlock_t * lock;
897995 unsigned int hash;
898996 int err = -ENOENT;
899997
900998 hash = rht_head_hashfn(ht, tbl, obj, params);
901− lock = rht_bucket_lock(tbl, hash);
902−
903− spin_lock_bh(lock);
999+ bkt = rht_bucket_var(tbl, hash);
1000+ if (!bkt)
1001+ return -ENOENT;
1002+ pprev = NULL;
1003+ rht_lock(tbl, bkt);
9041004
905− pprev = rht_bucket_var(tbl, hash);
906− rht_for_each_continue(he, *pprev, tbl, hash) {
1005+ rht_for_each_from(he, rht_ptr(bkt, tbl, hash), tbl, hash) {
9071006 struct rhlist_head *list;
9081007
9091008 list = container_of(he, struct rhlist_head, rhead);
@@ -943,12 +1042,17 @@ static inline int __rhashtable_remove_fast_one( · 33 unmodified lines
9431042 }
9441043 }
9451044
946− rcu_assign_pointer(*pprev, obj);
947− break;
1045+ if (pprev) {
1046+ rcu_assign_pointer(*pprev, obj);
1047+ rht_unlock(tbl, bkt);
1048+ } else {
1049+ rht_assign_unlock(tbl, bkt, obj);
1050+ }
1051+ goto unlocked;
9481052 }
9491053
950− spin_unlock_bh(lock);
951−
1054+ rht_unlock(tbl, bkt);
1055+unlocked:
9521056 if (err > 0) {
9531057 atomic_dec(&ht->nelems);
9541058 if (unlikely(ht->p.automatic_shrinking &&
@@ -1037,9 +1141,9 @@ static inline int __rhashtable_replace_fast( · 82 unmodified lines
10371141 struct rhash_head *obj_old, struct rhash_head *obj_new,
10381142 const struct rhashtable_params params)
10391143 {
1144+ struct rhash_lock_head __rcu **bkt;
10401145 struct rhash_head __rcu **pprev;
10411146 struct rhash_head *he;
1042− spinlock_t *lock;
10431147 unsigned int hash;
10441148 int err = -ENOENT;
10451149
@@ -1050,25 +1154,33 @@ static inline int __rhashtable_replace_fast( · 4 unmodified lines
10501154 if (hash != rht_head_hashfn(ht, tbl, obj_new, params))
10511155 return -EINVAL;
10521156
1053− lock = rht_bucket_lock(tbl, hash);
1157+ bkt = rht_bucket_var(tbl, hash);
1158+ if (!bkt)
1159+ return -ENOENT;
10541160
1055− spin_lock_bh(lock);
1161+ pprev = NULL;
1162+ rht_lock(tbl, bkt);
10561163
1057− pprev = rht_bucket_var(tbl, hash);
1058− rht_for_each_continue(he, *pprev, tbl, hash) {
1164+ rht_for_each_from(he, rht_ptr(bkt, tbl, hash), tbl, hash) {
10591165 if (he != obj_old) {
10601166 pprev = &he->next;
10611167 continue;
10621168 }
10631169
10641170 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+ }
10661177 err = 0;
1067− break;
1178+ goto unlocked;
10681179 }
10691180
1070− spin_unlock_bh(lock);
1181+ rht_unlock(tbl, bkt);
10711182
1183+unlocked:
10721184 return err;
10731185 }
10741186
include/linux/siphash.h+5−0
@@ -21,6 +21,11 @@ typedef struct { · 20 unmodified lines
2121 u64 key[2];
2222 } siphash_key_t;
2323
24+static inline bool siphash_key_is_zero(const siphash_key_t *key)
25+{
26+ return !(key->key[0] | key->key[1]);
27+}
28+
2429 u64 __siphash_aligned(const void *data, size_t len, const siphash_key_t *key);
2530 #ifndef CONFIG_HAVE_EFFICIENT_UNALIGNED_ACCESS
2631 u64 __siphash_unaligned(const void *data, size_t len, const siphash_key_t *key);
include/linux/skbuff.h+28−20
@@ -657,7 +657,6 @@ typedef unsigned char *sk_buff_data_t; · 656 unmodified lines
657657 * @tc_index: Traffic control index
658658 * @hash: the packet hash
659659 * @queue_mapping: Queue mapping for multiqueue devices
660− * @xmit_more: More SKBs are pending for this queue
661660 * @pfmemalloc: skbuff was allocated from PFMEMALLOC reserves
662661 * @active_extensions: active extensions (skb_ext_id types)
663662 * @ndisc_nodetype: router type (from link layer)
@@ -764,7 +763,6 @@ struct sk_buff { · 100 unmodified lines
764763 fclone:2,
765764 peeked:1,
766765 head_frag:1,
767− xmit_more:1,
768766 pfmemalloc:1;
769767 #ifdef CONFIG_SKB_EXTENSIONS
770768 __u8 active_extensions;
@@ -1044,6 +1042,8 @@ struct sk_buff *__alloc_skb(unsigned int size, gfp_t priority, int flags, · 273 unmodified lines
10441042 int node);
10451043 struct sk_buff *__build_skb(void *data, unsigned int frag_size);
10461044 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);
10471047
10481048 /**
10491049 * alloc_skb - allocate a network buffer
@@ -1258,11 +1258,19 @@ void skb_flow_dissector_init(struct flow_dissector *flow_dissector, · 208 unmodified lines
12581258 unsigned int key_count);
12591259
12601260 #ifdef CONFIG_NET
1261+int skb_flow_dissector_prog_query(const union bpf_attr *attr,
1262+ union bpf_attr __user *uattr);
12611263 int skb_flow_dissector_bpf_prog_attach(const union bpf_attr *attr,
12621264 struct bpf_prog *prog);
12631265
12641266 int skb_flow_dissector_bpf_prog_detach(const union bpf_attr *attr);
12651267 #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+
12661274 static inline int skb_flow_dissector_bpf_prog_attach(const union bpf_attr *attr,
12671275 struct bpf_prog *prog)
12681276 {
@@ -1275,12 +1283,12 @@ static inline int skb_flow_dissector_bpf_prog_detach(const union bpf_attr *attr) · 6 unmodified lines
12751283 }
12761284 #endif
12771285
1278−struct bpf_flow_keys;
1279−bool __skb_flow_bpf_dissect(struct bpf_prog *prog,
1280− const struct sk_buff *skb,
1281− struct flow_dissector *flow_dissector,
1282− struct bpf_flow_keys *flow_keys);
1283−bool __skb_flow_dissect(const struct sk_buff *skb,
1286+struct bpf_flow_dissector;
1287+bool bpf_flow_dissect(struct bpf_prog *prog, struct bpf_flow_dissector *ctx,
1288+ __be16 proto, int nhoff, int hlen);
1289+
1290+bool __skb_flow_dissect(const struct net *net,
1291+ const struct sk_buff *skb,
12841292 struct flow_dissector *flow_dissector,
12851293 void *target_container,
12861294 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
12901298 struct flow_dissector *flow_dissector,
12911299 void *target_container, unsigned int flags)
12921300 {
1293− return __skb_flow_dissect(skb, flow_dissector, target_container,
1294− NULL, 0, 0, 0, flags);
1301+ return __skb_flow_dissect(NULL, skb, flow_dissector,
1302+ target_container, NULL, 0, 0, 0, flags);
12951303 }
12961304
12971305 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
12991307 unsigned int flags)
13001308 {
13011309 memset(flow, 0, sizeof(*flow));
1302− return __skb_flow_dissect(skb, &flow_keys_dissector, flow,
1303− NULL, 0, 0, 0, flags);
1310+ return __skb_flow_dissect(NULL, skb, &flow_keys_dissector,
1311+ flow, NULL, 0, 0, 0, flags);
13041312 }
13051313
13061314 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,
13081317 struct flow_keys_basic *flow, void *data,
13091318 __be16 proto, int nhoff, int hlen,
13101319 unsigned int flags)
13111320 {
13121321 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,
13141323 data, proto, nhoff, hlen, flags);
13151324 }
13161325
@@ -2102,8 +2111,6 @@ void skb_add_rx_frag(struct sk_buff *skb, int i, struct page *page, int off, · 785 unmodified lines
21022111 void skb_coalesce_rx_frag(struct sk_buff *skb, int i, int size,
21032112 unsigned int truesize);
21042113
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))
21072114 #define SKB_LINEAR_ASSERT(skb) BUG_ON(skb_is_nonlinear(skb))
21082115
21092116 #ifdef NET_SKBUFF_DATA_USES_OFFSET
@@ -2490,7 +2497,8 @@ static inline void skb_probe_transport_header(struct sk_buff *skb) · 380 unmodified lines
24902497 if (skb_transport_header_was_set(skb))
24912498 return;
24922499
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))
24942502 skb_set_transport_header(skb, keys.control.thoff);
24952503 }
24962504
@@ -3372,17 +3380,17 @@ struct sk_buff *__skb_try_recv_from_queue(struct sock *sk, · 875 unmodified lines
33723380 unsigned int flags,
33733381 void (*destructor)(struct sock *sk,
33743382 struct sk_buff *skb),
3375− int *peeked, int *off, int *err,
3383+ int *off, int *err,
33763384 struct sk_buff **last);
33773385 struct sk_buff *__skb_try_recv_datagram(struct sock *sk, unsigned flags,
33783386 void (*destructor)(struct sock *sk,
33793387 struct sk_buff *skb),
3380− int *peeked, int *off, int *err,
3388+ int *off, int *err,
33813389 struct sk_buff **last);
33823390 struct sk_buff *__skb_recv_datagram(struct sock *sk, unsigned flags,
33833391 void (*destructor)(struct sock *sk,
33843392 struct sk_buff *skb),
3385− int *peeked, int *off, int *err);
3393+ int *off, int *err);
33863394 struct sk_buff *skb_recv_datagram(struct sock *sk, unsigned flags, int noblock,
33873395 int *err);
33883396 __poll_t datagram_poll(struct file *file, struct socket *sock,
include/linux/tracepoint-defs.h+1−0
@@ -45,6 +45,7 @@ struct bpf_raw_event_map { · 44 unmodified lines
4545 struct tracepoint *tp;
4646 void *bpf_func;
4747 u32 num_args;
48+ u32 writable_size;
4849 } __aligned(32);
4950
5051 #endif

Keyboard shortcuts

General

Show keyboard shortcuts
?
Focus the current search
/

Issues and pull requests

Open filters
f

Issues, pull requests and Inbox

Select next item
j↓
Select previous item
k↑
Open selected item
Enter
Dismiss filters or clear selection
Esc

Repository code

Go to file
t