History

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

Pull networking updates from David Miller: "Highlights: 1) Support more Realtek wireless chips, from Jes Sorenson. 2) New BPF types for per-cpu hash and arrap maps, from Alexei Starovoitov. 3) Make several TCP sysctls per-namespace, from Nikolay Borisov. 4) Allow the use of SO_REUSEPORT in order to do per-thread processing of incoming TCP/UDP connections. The muxing can be done using a BPF program which hashes the incoming packet. From Craig Gallek. 5) Add a multiplexer for TCP streams, to provide a messaged based interface. BPF programs can be used to determine the message boundaries. From Tom Herbert. 6) Add 802.1AE MACSEC support, from Sabrina Dubroca. 7) Avoid factorial complexity when taking down an inetdev interface with lots of configured addresses. We were doing things like traversing the entire address less for each address removed, and flushing the entire netfilter conntrack table for every address as well. 8) Add and use SKB bulk free infrastructure, from Jesper Brouer. 9) Allow offloading u32 classifiers to hardware, and implement for ixgbe, from John Fastabend. 10) Allow configuring IRQ coalescing parameters on a per-queue basis, from Kan Liang. 11) Extend ethtool so that larger link mode masks can be supported. From David Decotigny. 12) Introduce devlink, which can be used to configure port link types (ethernet vs Infiniband, etc.), port splitting, and switch device level attributes as a whole. From Jiri Pirko. 13) Hardware offload support for flower classifiers, from Amir Vadai. 14) Add "Local Checksum Offload". Basically, for a tunneled packet the checksum of the outer header is 'constant' (because with the checksum field filled into the inner protocol header, the payload of the outer frame checksums to 'zero'), and we can take advantage of that in various ways. From Edward Cree" * git://git.kernel.org/pub/scm/linux/kernel/git/davem/net-next: (1548 commits) bonding: fix bond_get_stats() net: bcmgenet: fix dma api length mismatch net/mlx4_core: Fix backward compatibility on VFs phy: mdio-thunder: Fix some Kconfig typos lan78xx: add ndo_get_stats64 lan78xx: handle statistics counter rollover RDS: TCP: Remove unused constant RDS: TCP: Add sysctl tunables for sndbuf/rcvbuf on rds-tcp socket net: smc911x: convert pxa dma to dmaengine team: remove duplicate set of flag IFF_MULTICAST bonding: remove duplicate set of flag IFF_MULTICAST net: fix a comment typo ethernet: micrel: fix some error codes ip_tunnels, bpf: define IP_TUNNEL_OPTS_MAX and use it bpf, dst: add and use dst_tclassid helper bpf: make skb->tc_classid also readable net: mvneta: bm: clarify dependencies cls_bpf: reset class and reuse major in da ldmvsw: Checkpatch sunvnet.c and sunvnet_common.c ldmvsw: Add ldmvsw.c driver code ...

Linus Torvalds committed 10 years ago

Commit 1200b682 parents 6b5f04b fe309371281 files · +79030 −34010Browse files

Showing the changes to include/net (51 of 1281 files). Show all

Unified · Split

51 files
  1. include/net/6lowpan.h +32 −0
  2. include/net/act_api.h +63 −21
  3. include/net/addrconf.h +2 −0
  4. include/net/bluetooth/hci.h +1 −0
  5. include/net/bluetooth/hci_core.h +3 −0
  6. include/net/bond_3ad.h +1 −0
  7. include/net/bonding.h +1 −0
  8. include/net/cfg80211.h +8 −0
  9. include/net/checksum.h +11 −6
  10. include/net/codel.h +4 −0
  11. include/net/devlink.h +140 −0
  12. include/net/dsa.h +8 −7
  13. include/net/dst.h +12 −0
  14. include/net/dst_cache.h +97 −0
  15. include/net/dst_metadata.h +5 −1
  16. include/net/flow_dissector.h +13 −0
  17. include/net/genetlink.h +0 −4
  18. include/net/hwbm.h +28 −0
  19. include/net/inet6_hashtables.h +9 −4
  20. include/net/inet_frag.h +1 −0
  21. include/net/inet_hashtables.h +17 −8
  22. include/net/ip.h +2 −6
  23. include/net/ip6_checksum.h +1 −2
  24. include/net/ip6_tunnel.h +2 −12
  25. include/net/ip_tunnels.h +44 −11
  26. include/net/ip_vs.h +17 −0
  27. include/net/ipv6.h +6 −2
  28. include/net/kcm.h +226 −0
  29. include/net/l3mdev.h +2 −2
  30. include/net/lwtunnel.h +3 −1
  31. include/net/mac80211.h +152 −46
  32. include/net/mac802154.h +8 −7
  33. include/net/netfilter/nft_masq.h +3 −1
  34. include/net/netns/ipv4.h +19 −0
  35. include/net/netns/ipv6.h +3 −0
  36. include/net/phonet/phonet.h +1 −1
  37. include/net/ping.h +1 −1
  38. include/net/pkt_cls.h +65 −0
  39. include/net/raw.h +1 −1
  40. include/net/route.h +2 −3
  41. include/net/sch_generic.h +25 −1
  42. include/net/sctp/sm.h +1 −1
  43. include/net/sctp/structs.h +5 −6
  44. include/net/sock.h +3 −3
  45. include/net/tc_act/tc_gact.h +16 −0
  46. include/net/tc_act/tc_ife.h +61 −0
  47. include/net/tc_act/tc_skbedit.h +16 −0
  48. include/net/tcp.h +42 −11
  49. include/net/udp.h +2 −1
  50. include/net/udp_tunnel.h +3 −3
  51. include/net/vxlan.h +135 −52
include/net/6lowpan.h+32−0
@@ -75,6 +75,8 @@ · 74 unmodified lines
7575 #define LOWPAN_IPHC_MAX_HC_BUF_LEN (sizeof(struct ipv6hdr) + \
7676 LOWPAN_IPHC_MAX_HEADER_LEN + \
7777 LOWPAN_NHC_MAX_HDR_LEN)
78+/* SCI/DCI is 4 bit width, so we have maximum 16 entries */
79+#define LOWPAN_IPHC_CTX_TABLE_SIZE (1 << 4)
7880
7981 #define LOWPAN_DISPATCH_IPV6 0x41 /* 01000001 = 65 */
8082 #define LOWPAN_DISPATCH_IPHC 0x60 /* 011xxxxx = ... */
@@ -98,9 +100,39 @@ enum lowpan_lltypes { · 17 unmodified lines
98100 LOWPAN_LLTYPE_IEEE802154,
99101 };
100102
103+enum lowpan_iphc_ctx_flags {
104+ LOWPAN_IPHC_CTX_FLAG_ACTIVE,
105+ LOWPAN_IPHC_CTX_FLAG_COMPRESSION,
106+};
107+
108+struct lowpan_iphc_ctx {
109+ u8 id;
110+ struct in6_addr pfx;
111+ u8 plen;
112+ unsigned long flags;
113+};
114+
115+struct lowpan_iphc_ctx_table {
116+ spinlock_t lock;
117+ const struct lowpan_iphc_ctx_ops *ops;
118+ struct lowpan_iphc_ctx table[LOWPAN_IPHC_CTX_TABLE_SIZE];
119+};
120+
121+static inline bool lowpan_iphc_ctx_is_active(const struct lowpan_iphc_ctx *ctx)
122+{
123+ return test_bit(LOWPAN_IPHC_CTX_FLAG_ACTIVE, &ctx->flags);
124+}
125+
126+static inline bool
127+lowpan_iphc_ctx_is_compression(const struct lowpan_iphc_ctx *ctx)
128+{
129+ return test_bit(LOWPAN_IPHC_CTX_FLAG_COMPRESSION, &ctx->flags);
130+}
131+
101132 struct lowpan_priv {
102133 enum lowpan_lltypes lltype;
103134 struct dentry *iface_debugfs;
135+ struct lowpan_iphc_ctx_table ctx;
104136
105137 /* must be last */
106138 u8 priv[0] __aligned(sizeof(void *));
include/net/act_api.h+63−21
@@ -7,6 +7,8 @@ · 6 unmodified lines
77
88 #include <net/sch_generic.h>
99 #include <net/pkt_sched.h>
10+#include <net/net_namespace.h>
11+#include <net/netns/generic.h>
1012
1113 struct tcf_common {
1214 struct hlist_node tcfc_head;
@@ -65,11 +67,6 @@ static inline int tcf_hashinfo_init(struct tcf_hashinfo *hf, unsigned int mask) · 52 unmodified lines
6567 return 0;
6668 }
6769
68−static inline void tcf_hashinfo_destroy(struct tcf_hashinfo *hf)
69−{
70− kfree(hf->htab);
71−}
72−
7370 /* Update lastuse only if needed, to avoid dirtying a cache line.
7471 * We use a temp variable to avoid fetching jiffies twice.
7572 */
@@ -81,42 +78,76 @@ static inline void tcf_lastuse_update(struct tcf_t *tm) · 5 unmodified lines
8178 tm->lastuse = now;
8279 }
8380
84−#ifdef CONFIG_NET_CLS_ACT
85−
86−#define ACT_P_CREATED 1
87−#define ACT_P_DELETED 1
88−
8981 struct tc_action {
9082 void *priv;
9183 const struct tc_action_ops *ops;
9284 __u32 type; /* for backward compat(TCA_OLD_COMPAT) */
9385 __u32 order;
9486 struct list_head list;
87+ struct tcf_hashinfo *hinfo;
9588 };
9689
90+#ifdef CONFIG_NET_CLS_ACT
91+
92+#define ACT_P_CREATED 1
93+#define ACT_P_DELETED 1
94+
9795 struct tc_action_ops {
9896 struct list_head head;
99− struct tcf_hashinfo *hinfo;
10097 char kind[IFNAMSIZ];
10198 __u32 type; /* TBD to match kind */
10299 struct module *owner;
103100 int (*act)(struct sk_buff *, const struct tc_action *, struct tcf_result *);
104101 int (*dump)(struct sk_buff *, struct tc_action *, int, int);
105102 void (*cleanup)(struct tc_action *, int bind);
106− int (*lookup)(struct tc_action *, u32);
103+ int (*lookup)(struct net *, struct tc_action *, u32);
107104 int (*init)(struct net *net, struct nlattr *nla,
108105 struct nlattr *est, struct tc_action *act, int ovr,
109106 int bind);
110− int (*walk)(struct sk_buff *, struct netlink_callback *, int, struct tc_action *);
107+ int (*walk)(struct net *, struct sk_buff *,
108+ struct netlink_callback *, int, struct tc_action *);
109+};
110+
111+struct tc_action_net {
112+ struct tcf_hashinfo *hinfo;
113+ const struct tc_action_ops *ops;
111114 };
112115
113−int tcf_hash_search(struct tc_action *a, u32 index);
114−u32 tcf_hash_new_index(struct tcf_hashinfo *hinfo);
115−int tcf_hash_check(u32 index, struct tc_action *a, int bind);
116−int tcf_hash_create(u32 index, struct nlattr *est, struct tc_action *a,
117− int size, int bind, bool cpustats);
116+static inline
117+int tc_action_net_init(struct tc_action_net *tn, const struct tc_action_ops *ops,
118+ unsigned int mask)
119+{
120+ int err = 0;
121+
122+ tn->hinfo = kmalloc(sizeof(*tn->hinfo), GFP_KERNEL);
123+ if (!tn->hinfo)
124+ return -ENOMEM;
125+ tn->ops = ops;
126+ err = tcf_hashinfo_init(tn->hinfo, mask);
127+ if (err)
128+ kfree(tn->hinfo);
129+ return err;
130+}
131+
132+void tcf_hashinfo_destroy(const struct tc_action_ops *ops,
133+ struct tcf_hashinfo *hinfo);
134+
135+static inline void tc_action_net_exit(struct tc_action_net *tn)
136+{
137+ tcf_hashinfo_destroy(tn->ops, tn->hinfo);
138+}
139+
140+int tcf_generic_walker(struct tc_action_net *tn, struct sk_buff *skb,
141+ struct netlink_callback *cb, int type,
142+ struct tc_action *a);
143+int tcf_hash_search(struct tc_action_net *tn, struct tc_action *a, u32 index);
144+u32 tcf_hash_new_index(struct tc_action_net *tn);
145+int tcf_hash_check(struct tc_action_net *tn, u32 index, struct tc_action *a,
146+ int bind);
147+int tcf_hash_create(struct tc_action_net *tn, u32 index, struct nlattr *est,
148+ struct tc_action *a, int size, int bind, bool cpustats);
118149 void tcf_hash_cleanup(struct tc_action *a, struct nlattr *est);
119−void tcf_hash_insert(struct tc_action *a);
150+void tcf_hash_insert(struct tc_action_net *tn, struct tc_action *a);
120151
121152 int __tcf_hash_release(struct tc_action *a, bool bind, bool strict);
122153
@@ -125,8 +156,8 @@ static inline int tcf_hash_release(struct tc_action *a, bool bind) · 2 unmodified lines
125156 return __tcf_hash_release(a, bind, false);
126157 }
127158
128−int tcf_register_action(struct tc_action_ops *a, unsigned int mask);
129−int tcf_unregister_action(struct tc_action_ops *a);
159+int tcf_register_action(struct tc_action_ops *a, struct pernet_operations *ops);
160+int tcf_unregister_action(struct tc_action_ops *a, struct pernet_operations *ops);
130161 int tcf_action_destroy(struct list_head *actions, int bind);
131162 int tcf_action_exec(struct sk_buff *skb, const struct list_head *actions,
132163 struct tcf_result *res);
@@ -140,5 +171,16 @@ int tcf_action_dump(struct sk_buff *skb, struct list_head *, int, int); · 7 unmodified lines
140171 int tcf_action_dump_old(struct sk_buff *skb, struct tc_action *a, int, int);
141172 int tcf_action_dump_1(struct sk_buff *skb, struct tc_action *a, int, int);
142173 int tcf_action_copy_stats(struct sk_buff *, struct tc_action *, int);
174+
175+#define tc_no_actions(_exts) \
176+ (list_empty(&(_exts)->actions))
177+
178+#define tc_for_each_action(_a, _exts) \
179+ list_for_each_entry(a, &(_exts)->actions, list)
180+#else /* CONFIG_NET_CLS_ACT */
181+
182+#define tc_no_actions(_exts) true
183+#define tc_for_each_action(_a, _exts) while (0)
184+
143185 #endif /* CONFIG_NET_CLS_ACT */
144186 #endif
include/net/addrconf.h+2−0
@@ -87,6 +87,8 @@ int __ipv6_get_lladdr(struct inet6_dev *idev, struct in6_addr *addr, · 86 unmodified lines
8787 u32 banned_flags);
8888 int ipv6_get_lladdr(struct net_device *dev, struct in6_addr *addr,
8989 u32 banned_flags);
90+int ipv4_rcv_saddr_equal(const struct sock *sk, const struct sock *sk2,
91+ bool match_wildcard);
9092 int ipv6_rcv_saddr_equal(const struct sock *sk, const struct sock *sk2,
9193 bool match_wildcard);
9294 void addrconf_join_solict(struct net_device *dev, const struct in6_addr *addr);
include/net/bluetooth/hci.h+1−0
@@ -233,6 +233,7 @@ enum { · 232 unmodified lines
233233 HCI_SC_ENABLED,
234234 HCI_SC_ONLY,
235235 HCI_PRIVACY,
236+ HCI_LIMITED_PRIVACY,
236237 HCI_RPA_EXPIRED,
237238 HCI_RPA_RESOLVING,
238239 HCI_HS_ENABLED,
include/net/bluetooth/hci_core.h+3−0
@@ -25,6 +25,7 @@ · 24 unmodified lines
2525 #ifndef __HCI_CORE_H
2626 #define __HCI_CORE_H
2727
28+#include <linux/leds.h>
2829 #include <net/bluetooth/hci.h>
2930 #include <net/bluetooth/hci_sock.h>
3031
@@ -396,6 +397,8 @@ struct hci_dev { · 365 unmodified lines
396397 struct delayed_work rpa_expired;
397398 bdaddr_t rpa;
398399
400+ struct led_trigger *power_led;
401+
399402 int (*open)(struct hci_dev *hdev);
400403 int (*close)(struct hci_dev *hdev);
401404 int (*flush)(struct hci_dev *hdev);
include/net/bond_3ad.h+1−0
@@ -306,5 +306,6 @@ int bond_3ad_lacpdu_recv(const struct sk_buff *skb, struct bonding *bond, · 305 unmodified lines
306306 struct slave *slave);
307307 int bond_3ad_set_carrier(struct bonding *bond);
308308 void bond_3ad_update_lacp_rate(struct bonding *bond);
309+void bond_3ad_update_ad_actor_settings(struct bonding *bond);
309310 #endif /* _NET_BOND_3AD_H */
310311
include/net/bonding.h+1−0
@@ -215,6 +215,7 @@ struct bonding { · 214 unmodified lines
215215 * ALB mode (6) - to sync the use and modifications of its hash table
216216 */
217217 spinlock_t mode_lock;
218+ spinlock_t stats_lock;
218219 u8 send_peer_notif;
219220 u8 igmp_retrans;
220221 #ifdef CONFIG_PROC_FS
include/net/cfg80211.h+8−0
@@ -712,6 +712,8 @@ struct cfg80211_acl_data { · 711 unmodified lines
712712 * @p2p_opp_ps: P2P opportunistic PS
713713 * @acl: ACL configuration used by the drivers which has support for
714714 * MAC address based access control
715+ * @pbss: If set, start as a PCP instead of AP. Relevant for DMG
716+ * networks.
715717 */
716718 struct cfg80211_ap_settings {
717719 struct cfg80211_chan_def chandef;
@@ -730,6 +732,7 @@ struct cfg80211_ap_settings { · 12 unmodified lines
730732 u8 p2p_ctwindow;
731733 bool p2p_opp_ps;
732734 const struct cfg80211_acl_data *acl;
735+ bool pbss;
733736 };
734737
735738 /**
@@ -1888,6 +1891,8 @@ struct cfg80211_ibss_params { · 1152 unmodified lines
18881891 * @ht_capa_mask: The bits of ht_capa which are to be used.
18891892 * @vht_capa: VHT Capability overrides
18901893 * @vht_capa_mask: The bits of vht_capa which are to be used.
1894+ * @pbss: if set, connect to a PCP instead of AP. Valid for DMG
1895+ * networks.
18911896 */
18921897 struct cfg80211_connect_params {
18931898 struct ieee80211_channel *channel;
@@ -1910,6 +1915,7 @@ struct cfg80211_connect_params { · 16 unmodified lines
19101915 struct ieee80211_ht_cap ht_capa_mask;
19111916 struct ieee80211_vht_cap vht_capa;
19121917 struct ieee80211_vht_cap vht_capa_mask;
1918+ bool pbss;
19131919 };
19141920
19151921 /**
@@ -3489,6 +3495,7 @@ struct cfg80211_cached_keys; · 1573 unmodified lines
34893495 * registered for unexpected class 3 frames (AP mode)
34903496 * @conn: (private) cfg80211 software SME connection state machine data
34913497 * @connect_keys: (private) keys to set after connection is established
3498+ * @conn_bss_type: connecting/connected BSS type
34923499 * @ibss_fixed: (private) IBSS is using fixed BSSID
34933500 * @ibss_dfs_possible: (private) IBSS may change to a DFS channel
34943501 * @event_list: (private) list for internal event processing
@@ -3519,6 +3526,7 @@ struct wireless_dev { · 24 unmodified lines
35193526 u8 ssid_len, mesh_id_len, mesh_id_up_len;
35203527 struct cfg80211_conn *conn;
35213528 struct cfg80211_cached_keys *connect_keys;
3529+ enum ieee80211_bss_type conn_bss_type;
35223530
35233531 struct list_head event_list;
35243532 spinlock_t event_lock;
include/net/checksum.h+11−6
@@ -88,8 +88,11 @@ static inline __wsum · 87 unmodified lines
8888 csum_block_add(__wsum csum, __wsum csum2, int offset)
8989 {
9090 u32 sum = (__force u32)csum2;
91− if (offset&1)
92− sum = ((sum&0xFF00FF)<<8)+((sum>>8)&0xFF00FF);
91+
92+ /* rotate sum to align it with a 16b boundary */
93+ if (offset & 1)
94+ sum = ror32(sum, 8);
95+
9396 return csum_add(csum, (__force __wsum)sum);
9497 }
9598
@@ -102,10 +105,7 @@ csum_block_add_ext(__wsum csum, __wsum csum2, int offset, int len) · 6 unmodified lines
102105 static inline __wsum
103106 csum_block_sub(__wsum csum, __wsum csum2, int offset)
104107 {
105− u32 sum = (__force u32)csum2;
106− if (offset&1)
107− sum = ((sum&0xFF00FF)<<8)+((sum>>8)&0xFF00FF);
108− return csum_sub(csum, (__force __wsum)sum);
108+ return csum_block_add(csum, ~csum2, offset);
109109 }
110110
111111 static inline __wsum csum_unfold(__sum16 n)
@@ -120,6 +120,11 @@ static inline __wsum csum_partial_ext(const void *buff, int len, __wsum sum) · 8 unmodified lines
120120
121121 #define CSUM_MANGLED_0 ((__force __sum16)0xffff)
122122
123+static inline void csum_replace_by_diff(__sum16 *sum, __wsum diff)
124+{
125+ *sum = csum_fold(csum_add(diff, ~csum_unfold(*sum)));
126+}
127+
123128 static inline void csum_replace4(__sum16 *sum, __be32 from, __be32 to)
124129 {
125130 __wsum tmp = csum_sub(~csum_unfold(*sum), (__force __wsum)from);
include/net/codel.h+4−0
@@ -162,12 +162,14 @@ struct codel_vars { · 161 unmodified lines
162162 * struct codel_stats - contains codel shared variables and stats
163163 * @maxpacket: largest packet we've seen so far
164164 * @drop_count: temp count of dropped packets in dequeue()
165+ * @drop_len: bytes of dropped packets in dequeue()
165166 * ecn_mark: number of packets we ECN marked instead of dropping
166167 * ce_mark: number of packets CE marked because sojourn time was above ce_threshold
167168 */
168169 struct codel_stats {
169170 u32 maxpacket;
170171 u32 drop_count;
172+ u32 drop_len;
171173 u32 ecn_mark;
172174 u32 ce_mark;
173175 };
@@ -308,6 +310,7 @@ static struct sk_buff *codel_dequeue(struct Qdisc *sch, · 134 unmodified lines
308310 vars->rec_inv_sqrt);
309311 goto end;
310312 }
313+ stats->drop_len += qdisc_pkt_len(skb);
311314 qdisc_drop(skb, sch);
312315 stats->drop_count++;
313316 skb = dequeue_func(vars, sch);
@@ -330,6 +333,7 @@ static struct sk_buff *codel_dequeue(struct Qdisc *sch, · 16 unmodified lines
330333 if (params->ecn && INET_ECN_set_ce(skb)) {
331334 stats->ecn_mark++;
332335 } else {
336+ stats->drop_len += qdisc_pkt_len(skb);
333337 qdisc_drop(skb, sch);
334338 stats->drop_count++;
335339
include/net/devlink.h+140−0
@@ -0,0 +1,140 @@
1+/*
2+ * include/net/devlink.h - Network physical device Netlink interface
3+ * Copyright (c) 2016 Mellanox Technologies. All rights reserved.
4+ * Copyright (c) 2016 Jiri Pirko <jiri@mellanox.com>
5+ *
6+ * This program is free software; you can redistribute it and/or modify
7+ * it under the terms of the GNU General Public License as published by
8+ * the Free Software Foundation; either version 2 of the License, or
9+ * (at your option) any later version.
10+ */
11+#ifndef _NET_DEVLINK_H_
12+#define _NET_DEVLINK_H_
13+
14+#include <linux/device.h>
15+#include <linux/slab.h>
16+#include <linux/gfp.h>
17+#include <linux/list.h>
18+#include <linux/netdevice.h>
19+#include <net/net_namespace.h>
20+#include <uapi/linux/devlink.h>
21+
22+struct devlink_ops;
23+
24+struct devlink {
25+ struct list_head list;
26+ struct list_head port_list;
27+ const struct devlink_ops *ops;
28+ struct device *dev;
29+ possible_net_t _net;
30+ char priv[0] __aligned(NETDEV_ALIGN);
31+};
32+
33+struct devlink_port {
34+ struct list_head list;
35+ struct devlink *devlink;
36+ unsigned index;
37+ bool registered;
38+ enum devlink_port_type type;
39+ enum devlink_port_type desired_type;
40+ void *type_dev;
41+ bool split;
42+ u32 split_group;
43+};
44+
45+struct devlink_ops {
46+ size_t priv_size;
47+ int (*port_type_set)(struct devlink_port *devlink_port,
48+ enum devlink_port_type port_type);
49+ int (*port_split)(struct devlink *devlink, unsigned int port_index,
50+ unsigned int count);
51+ int (*port_unsplit)(struct devlink *devlink, unsigned int port_index);
52+};
53+
54+static inline void *devlink_priv(struct devlink *devlink)
55+{
56+ BUG_ON(!devlink);
57+ return &devlink->priv;
58+}
59+
60+static inline struct devlink *priv_to_devlink(void *priv)
61+{
62+ BUG_ON(!priv);
63+ return container_of(priv, struct devlink, priv);
64+}
65+
66+struct ib_device;
67+
68+#if IS_ENABLED(CONFIG_NET_DEVLINK)
69+
70+struct devlink *devlink_alloc(const struct devlink_ops *ops, size_t priv_size);
71+int devlink_register(struct devlink *devlink, struct device *dev);
72+void devlink_unregister(struct devlink *devlink);
73+void devlink_free(struct devlink *devlink);
74+int devlink_port_register(struct devlink *devlink,
75+ struct devlink_port *devlink_port,
76+ unsigned int port_index);
77+void devlink_port_unregister(struct devlink_port *devlink_port);
78+void devlink_port_type_eth_set(struct devlink_port *devlink_port,
79+ struct net_device *netdev);
80+void devlink_port_type_ib_set(struct devlink_port *devlink_port,
81+ struct ib_device *ibdev);
82+void devlink_port_type_clear(struct devlink_port *devlink_port);
83+void devlink_port_split_set(struct devlink_port *devlink_port,
84+ u32 split_group);
85+
86+#else
87+
88+static inline struct devlink *devlink_alloc(const struct devlink_ops *ops,
89+ size_t priv_size)
90+{
91+ return kzalloc(sizeof(struct devlink) + priv_size, GFP_KERNEL);
92+}
93+
94+static inline int devlink_register(struct devlink *devlink, struct device *dev)
95+{
96+ return 0;
97+}
98+
99+static inline void devlink_unregister(struct devlink *devlink)
100+{
101+}
102+
103+static inline void devlink_free(struct devlink *devlink)
104+{
105+ kfree(devlink);
106+}
107+
108+static inline int devlink_port_register(struct devlink *devlink,
109+ struct devlink_port *devlink_port,
110+ unsigned int port_index)
111+{
112+ return 0;
113+}
114+
115+static inline void devlink_port_unregister(struct devlink_port *devlink_port)
116+{
117+}
118+
119+static inline void devlink_port_type_eth_set(struct devlink_port *devlink_port,
120+ struct net_device *netdev)
121+{
122+}
123+
124+static inline void devlink_port_type_ib_set(struct devlink_port *devlink_port,
125+ struct ib_device *ibdev)
126+{
127+}
128+
129+static inline void devlink_port_type_clear(struct devlink_port *devlink_port)
130+{
131+}
132+
133+static inline void devlink_port_split_set(struct devlink_port *devlink_port,
134+ u32 split_group)
135+{
136+}
137+
138+#endif
139+
140+#endif /* _NET_DEVLINK_H_ */
include/net/dsa.h+8−7
@@ -296,16 +296,17 @@ struct dsa_switch_driver { · 295 unmodified lines
296296 /*
297297 * Bridge integration
298298 */
299− int (*port_join_bridge)(struct dsa_switch *ds, int port,
300− u32 br_port_mask);
301− int (*port_leave_bridge)(struct dsa_switch *ds, int port,
302− u32 br_port_mask);
299+ int (*port_bridge_join)(struct dsa_switch *ds, int port,
300+ struct net_device *bridge);
301+ void (*port_bridge_leave)(struct dsa_switch *ds, int port);
303302 int (*port_stp_update)(struct dsa_switch *ds, int port,
304303 u8 state);
305304
306305 /*
307306 * VLAN support
308307 */
308+ int (*port_vlan_filtering)(struct dsa_switch *ds, int port,
309+ bool vlan_filtering);
309310 int (*port_vlan_prepare)(struct dsa_switch *ds, int port,
310311 const struct switchdev_obj_port_vlan *vlan,
311312 struct switchdev_trans *trans);
@@ -314,9 +315,9 @@ struct dsa_switch_driver { · 2 unmodified lines
314315 struct switchdev_trans *trans);
315316 int (*port_vlan_del)(struct dsa_switch *ds, int port,
316317 const struct switchdev_obj_port_vlan *vlan);
317− int (*port_pvid_get)(struct dsa_switch *ds, int port, u16 *pvid);
318− int (*vlan_getnext)(struct dsa_switch *ds, u16 *vid,
319− unsigned long *ports, unsigned long *untagged);
318+ int (*port_vlan_dump)(struct dsa_switch *ds, int port,
319+ struct switchdev_obj_port_vlan *vlan,
320+ int (*cb)(struct switchdev_obj *obj));
320321
321322 /*
322323 * Forwarding database
include/net/dst.h+12−0
@@ -398,6 +398,18 @@ static inline void skb_tunnel_rx(struct sk_buff *skb, struct net_device *dev, · 397 unmodified lines
398398 __skb_tunnel_rx(skb, dev, net);
399399 }
400400
401+static inline u32 dst_tclassid(const struct sk_buff *skb)
402+{
403+#ifdef CONFIG_IP_ROUTE_CLASSID
404+ const struct dst_entry *dst;
405+
406+ dst = skb_dst(skb);
407+ if (dst)
408+ return dst->tclassid;
409+#endif
410+ return 0;
411+}
412+
401413 int dst_discard_out(struct net *net, struct sock *sk, struct sk_buff *skb);
402414 static inline int dst_discard(struct sk_buff *skb)
403415 {
include/net/dst_cache.h+97−0
@@ -0,0 +1,97 @@
1+#ifndef _NET_DST_CACHE_H
2+#define _NET_DST_CACHE_H
3+
4+#include <linux/jiffies.h>
5+#include <net/dst.h>
6+#if IS_ENABLED(CONFIG_IPV6)
7+#include <net/ip6_fib.h>
8+#endif
9+
10+struct dst_cache {
11+ struct dst_cache_pcpu __percpu *cache;
12+ unsigned long reset_ts;
13+};
14+
15+/**
16+ * dst_cache_get - perform cache lookup
17+ * @dst_cache: the cache
18+ *
19+ * The caller should use dst_cache_get_ip4() if it need to retrieve the
20+ * source address to be used when xmitting to the cached dst.
21+ * local BH must be disabled.
22+ */
23+struct dst_entry *dst_cache_get(struct dst_cache *dst_cache);
24+
25+/**
26+ * dst_cache_get_ip4 - perform cache lookup and fetch ipv4 source address
27+ * @dst_cache: the cache
28+ * @saddr: return value for the retrieved source address
29+ *
30+ * local BH must be disabled.
31+ */
32+struct rtable *dst_cache_get_ip4(struct dst_cache *dst_cache, __be32 *saddr);
33+
34+/**
35+ * dst_cache_set_ip4 - store the ipv4 dst into the cache
36+ * @dst_cache: the cache
37+ * @dst: the entry to be cached
38+ * @saddr: the source address to be stored inside the cache
39+ *
40+ * local BH must be disabled.
41+ */
42+void dst_cache_set_ip4(struct dst_cache *dst_cache, struct dst_entry *dst,
43+ __be32 saddr);
44+
45+#if IS_ENABLED(CONFIG_IPV6)
46+
47+/**
48+ * dst_cache_set_ip6 - store the ipv6 dst into the cache
49+ * @dst_cache: the cache
50+ * @dst: the entry to be cached
51+ * @saddr: the source address to be stored inside the cache
52+ *
53+ * local BH must be disabled.
54+ */
55+void dst_cache_set_ip6(struct dst_cache *dst_cache, struct dst_entry *dst,
56+ const struct in6_addr *addr);
57+
58+/**
59+ * dst_cache_get_ip6 - perform cache lookup and fetch ipv6 source address
60+ * @dst_cache: the cache
61+ * @saddr: return value for the retrieved source address
62+ *
63+ * local BH must be disabled.
64+ */
65+struct dst_entry *dst_cache_get_ip6(struct dst_cache *dst_cache,
66+ struct in6_addr *saddr);
67+#endif
68+
69+/**
70+ * dst_cache_reset - invalidate the cache contents
71+ * @dst_cache: the cache
72+ *
73+ * This do not free the cached dst to avoid races and contentions.
74+ * the dst will be freed on later cache lookup.
75+ */
76+static inline void dst_cache_reset(struct dst_cache *dst_cache)
77+{
78+ dst_cache->reset_ts = jiffies;
79+}
80+
81+/**
82+ * dst_cache_init - initialize the cache, allocating the required storage
83+ * @dst_cache: the cache
84+ * @gfp: allocation flags
85+ */
86+int dst_cache_init(struct dst_cache *dst_cache, gfp_t gfp);
87+
88+/**
89+ * dst_cache_destroy - empty the cache and free the allocated storage
90+ * @dst_cache: the cache
91+ *
92+ * No synchronization is enforced: it must be called only when the cache
93+ * is unsed.
94+ */
95+void dst_cache_destroy(struct dst_cache *dst_cache);
96+
97+#endif
include/net/dst_metadata.h+5−1
@@ -62,6 +62,7 @@ static inline int skb_metadata_dst_cmp(const struct sk_buff *skb_a, · 61 unmodified lines
6262 sizeof(a->u.tun_info) + a->u.tun_info.options_len);
6363 }
6464
65+void metadata_dst_free(struct metadata_dst *);
6566 struct metadata_dst *metadata_dst_alloc(u8 optslen, gfp_t flags);
6667 struct metadata_dst __percpu *metadata_dst_alloc_percpu(u8 optslen, gfp_t flags);
6768
@@ -125,7 +126,7 @@ static inline struct metadata_dst *ip_tun_rx_dst(struct sk_buff *skb, · 57 unmodified lines
125126
126127 ip_tunnel_key_init(&tun_dst->u.tun_info.key,
127128 iph->saddr, iph->daddr, iph->tos, iph->ttl,
128− 0, 0, tunnel_id, flags);
129+ 0, 0, 0, tunnel_id, flags);
129130 return tun_dst;
130131 }
131132
@@ -151,8 +152,11 @@ static inline struct metadata_dst *ipv6_tun_rx_dst(struct sk_buff *skb, · 19 unmodified lines
151152
152153 info->key.u.ipv6.src = ip6h->saddr;
153154 info->key.u.ipv6.dst = ip6h->daddr;
155+
154156 info->key.tos = ipv6_get_dsfield(ip6h);
155157 info->key.ttl = ip6h->hop_limit;
158+ info->key.label = ip6_flowlabel(ip6h);
159+
156160 return tun_dst;
157161 }
158162
include/net/flow_dissector.h+13−0
@@ -184,4 +184,17 @@ static inline bool flow_keys_have_l4(struct flow_keys *keys) · 183 unmodified lines
184184
185185 u32 flow_hash_from_keys(struct flow_keys *keys);
186186
187+static inline bool dissector_uses_key(const struct flow_dissector *flow_dissector,
188+ enum flow_dissector_key_id key_id)
189+{
190+ return flow_dissector->used_keys & (1 << key_id);
191+}
192+
193+static inline void *skb_flow_dissector_target(struct flow_dissector *flow_dissector,
194+ enum flow_dissector_key_id key_id,
195+ void *target_container)
196+{
197+ return ((char *)target_container) + flow_dissector->offset[key_id];
198+}
199+
187200 #endif
include/net/genetlink.h+0−4
@@ -83,7 +83,6 @@ struct genl_family { · 82 unmodified lines
8383 * @attrs: netlink attributes
8484 * @_net: network namespace
8585 * @user_ptr: user pointers
86− * @dst_sk: destination socket
8786 */
8887 struct genl_info {
8988 u32 snd_seq;
@@ -94,7 +93,6 @@ struct genl_info { · 4 unmodified lines
9493 struct nlattr ** attrs;
9594 possible_net_t _net;
9695 void * user_ptr[2];
97− struct sock * dst_sk;
9896 };
9997
10098 static inline struct net *genl_info_net(struct genl_info *info)
@@ -188,8 +186,6 @@ int genl_unregister_family(struct genl_family *family); · 87 unmodified lines
188186 void genl_notify(struct genl_family *family, struct sk_buff *skb,
189187 struct genl_info *info, u32 group, gfp_t flags);
190188
191−struct sk_buff *genlmsg_new_unicast(size_t payload, struct genl_info *info,
192− gfp_t flags);
193189 void *genlmsg_put(struct sk_buff *skb, u32 portid, u32 seq,
194190 struct genl_family *family, int flags, u8 cmd);
195191
include/net/hwbm.h+28−0
@@ -0,0 +1,28 @@
1+#ifndef _HWBM_H
2+#define _HWBM_H
3+
4+struct hwbm_pool {
5+ /* Capacity of the pool */
6+ int size;
7+ /* Size of the buffers managed */
8+ int frag_size;
9+ /* Number of buffers currently used by this pool */
10+ int buf_num;
11+ /* constructor called during alocation */
12+ int (*construct)(struct hwbm_pool *bm_pool, void *buf);
13+ /* protect acces to the buffer counter*/
14+ spinlock_t lock;
15+ /* private data */
16+ void *priv;
17+};
18+#ifdef CONFIG_HWBM
19+void hwbm_buf_free(struct hwbm_pool *bm_pool, void *buf);
20+int hwbm_pool_refill(struct hwbm_pool *bm_pool, gfp_t gfp);
21+int hwbm_pool_add(struct hwbm_pool *bm_pool, unsigned int buf_num, gfp_t gfp);
22+#else
23+void hwbm_buf_free(struct hwbm_pool *bm_pool, void *buf) {}
24+int hwbm_pool_refill(struct hwbm_pool *bm_pool, gfp_t gfp) { return 0; }
25+int hwbm_pool_add(struct hwbm_pool *bm_pool, unsigned int buf_num, gfp_t gfp)
26+{ return 0; }
27+#endif /* CONFIG_HWBM */
28+#endif /* _HWBM_H */
include/net/inet6_hashtables.h+9−4
@@ -53,6 +53,7 @@ struct sock *__inet6_lookup_established(struct net *net, · 52 unmodified lines
5353
5454 struct sock *inet6_lookup_listener(struct net *net,
5555 struct inet_hashinfo *hashinfo,
56+ struct sk_buff *skb, int doff,
5657 const struct in6_addr *saddr,
5758 const __be16 sport,
5859 const struct in6_addr *daddr,
@@ -60,6 +61,7 @@ struct sock *inet6_lookup_listener(struct net *net, · 1 unmodified line
6061
6162 static inline struct sock *__inet6_lookup(struct net *net,
6263 struct inet_hashinfo *hashinfo,
64+ struct sk_buff *skb, int doff,
6365 const struct in6_addr *saddr,
6466 const __be16 sport,
6567 const struct in6_addr *daddr,
@@ -71,12 +73,12 @@ static inline struct sock *__inet6_lookup(struct net *net, · 5 unmodified lines
7173 if (sk)
7274 return sk;
7375
74− return inet6_lookup_listener(net, hashinfo, saddr, sport,
76+ return inet6_lookup_listener(net, hashinfo, skb, doff, saddr, sport,
7577 daddr, hnum, dif);
7678 }
7779
7880 static inline struct sock *__inet6_lookup_skb(struct inet_hashinfo *hashinfo,
79− struct sk_buff *skb,
81+ struct sk_buff *skb, int doff,
8082 const __be16 sport,
8183 const __be16 dport,
8284 int iif)
@@ -86,16 +88,19 @@ static inline struct sock *__inet6_lookup_skb(struct inet_hashinfo *hashinfo, · 3 unmodified lines
8688 if (sk)
8789 return sk;
8890
89− return __inet6_lookup(dev_net(skb_dst(skb)->dev), hashinfo,
90− &ipv6_hdr(skb)->saddr, sport,
91+ return __inet6_lookup(dev_net(skb_dst(skb)->dev), hashinfo, skb,
92+ doff, &ipv6_hdr(skb)->saddr, sport,
9193 &ipv6_hdr(skb)->daddr, ntohs(dport),
9294 iif);
9395 }
9496
9597 struct sock *inet6_lookup(struct net *net, struct inet_hashinfo *hashinfo,
98+ struct sk_buff *skb, int doff,
9699 const struct in6_addr *saddr, const __be16 sport,
97100 const struct in6_addr *daddr, const __be16 dport,
98101 const int dif);
102+
103+int inet6_hash(struct sock *sk);
99104 #endif /* IS_ENABLED(CONFIG_IPV6) */
100105
101106 #define INET6_MATCH(__sk, __net, __saddr, __daddr, __ports, __dif) \
include/net/inet_frag.h+1−0
@@ -13,6 +13,7 @@ struct netns_frags { · 12 unmodified lines
1313 int timeout;
1414 int high_thresh;
1515 int low_thresh;
16+ int max_dist;
1617 };
1718
1819 /**
include/net/inet_hashtables.h+17−8
@@ -207,12 +207,16 @@ void inet_hashinfo_init(struct inet_hashinfo *h); · 206 unmodified lines
207207
208208 bool inet_ehash_insert(struct sock *sk, struct sock *osk);
209209 bool inet_ehash_nolisten(struct sock *sk, struct sock *osk);
210−void __inet_hash(struct sock *sk, struct sock *osk);
211−void inet_hash(struct sock *sk);
210+int __inet_hash(struct sock *sk, struct sock *osk,
211+ int (*saddr_same)(const struct sock *sk1,
212+ const struct sock *sk2,
213+ bool match_wildcard));
214+int inet_hash(struct sock *sk);
212215 void inet_unhash(struct sock *sk);
213216
214217 struct sock *__inet_lookup_listener(struct net *net,
215218 struct inet_hashinfo *hashinfo,
219+ struct sk_buff *skb, int doff,
216220 const __be32 saddr, const __be16 sport,
217221 const __be32 daddr,
218222 const unsigned short hnum,
@@ -220,10 +224,11 @@ struct sock *__inet_lookup_listener(struct net *net, · 1 unmodified line
220224
221225 static inline struct sock *inet_lookup_listener(struct net *net,
222226 struct inet_hashinfo *hashinfo,
227+ struct sk_buff *skb, int doff,
223228 __be32 saddr, __be16 sport,
224229 __be32 daddr, __be16 dport, int dif)
225230 {
226− return __inet_lookup_listener(net, hashinfo, saddr, sport,
231+ return __inet_lookup_listener(net, hashinfo, skb, doff, saddr, sport,
227232 daddr, ntohs(dport), dif);
228233 }
229234
@@ -299,6 +304,7 @@ static inline struct sock * · 69 unmodified lines
299304
300305 static inline struct sock *__inet_lookup(struct net *net,
301306 struct inet_hashinfo *hashinfo,
307+ struct sk_buff *skb, int doff,
302308 const __be32 saddr, const __be16 sport,
303309 const __be32 daddr, const __be16 dport,
304310 const int dif)
@@ -307,12 +313,13 @@ static inline struct sock *__inet_lookup(struct net *net, · 2 unmodified lines
307313 struct sock *sk = __inet_lookup_established(net, hashinfo,
308314 saddr, sport, daddr, hnum, dif);
309315
310− return sk ? : __inet_lookup_listener(net, hashinfo, saddr, sport,
311− daddr, hnum, dif);
316+ return sk ? : __inet_lookup_listener(net, hashinfo, skb, doff, saddr,
317+ sport, daddr, hnum, dif);
312318 }
313319
314320 static inline struct sock *inet_lookup(struct net *net,
315321 struct inet_hashinfo *hashinfo,
322+ struct sk_buff *skb, int doff,
316323 const __be32 saddr, const __be16 sport,
317324 const __be32 daddr, const __be16 dport,
318325 const int dif)
@@ -320,7 +327,8 @@ static inline struct sock *inet_lookup(struct net *net, · 1 unmodified line
320327 struct sock *sk;
321328
322329 local_bh_disable();
323− sk = __inet_lookup(net, hashinfo, saddr, sport, daddr, dport, dif);
330+ sk = __inet_lookup(net, hashinfo, skb, doff, saddr, sport, daddr,
331+ dport, dif);
324332 local_bh_enable();
325333
326334 return sk;
@@ -328,6 +336,7 @@ static inline struct sock *inet_lookup(struct net *net, · 1 unmodified line
328336
329337 static inline struct sock *__inet_lookup_skb(struct inet_hashinfo *hashinfo,
330338 struct sk_buff *skb,
339+ int doff,
331340 const __be16 sport,
332341 const __be16 dport)
333342 {
@@ -337,8 +346,8 @@ static inline struct sock *__inet_lookup_skb(struct inet_hashinfo *hashinfo, · 3 unmodified lines
337346 if (sk)
338347 return sk;
339348 else
340− return __inet_lookup(dev_net(skb_dst(skb)->dev), hashinfo,
341− iph->saddr, sport,
349+ return __inet_lookup(dev_net(skb_dst(skb)->dev), hashinfo, skb,
350+ doff, iph->saddr, sport,
342351 iph->daddr, dport, inet_iif(skb));
343352 }
344353
include/net/ip.h+2−6
@@ -240,17 +240,13 @@ static inline int inet_is_local_reserved_port(struct net *net, int port) · 239 unmodified lines
240240 }
241241 #endif
242242
243+__be32 inet_current_timestamp(void);
244+
243245 /* From inetpeer.c */
244246 extern int inet_peer_threshold;
245247 extern int inet_peer_minttl;
246248 extern int inet_peer_maxttl;
247249
248−/* From ip_input.c */
249−extern int sysctl_ip_early_demux;
250−
251−/* From ip_output.c */
252−extern int sysctl_ip_dynaddr;
253−
254250 void ipfrag_init(void);
255251
256252 void ip_static_sysctl_init(void);
include/net/ip6_checksum.h+1−2
@@ -37,8 +37,7 @@ · 36 unmodified lines
3737 #ifndef _HAVE_ARCH_IPV6_CSUM
3838 __sum16 csum_ipv6_magic(const struct in6_addr *saddr,
3939 const struct in6_addr *daddr,
40− __u32 len, unsigned short proto,
41− __wsum csum);
40+ __u32 len, __u8 proto, __wsum csum);
4241 #endif
4342
4443 static inline __wsum ip6_compute_pseudo(struct sk_buff *skb, int proto)
include/net/ip6_tunnel.h+2−12
@@ -6,6 +6,7 @@ · 5 unmodified lines
66 #include <linux/if_tunnel.h>
77 #include <linux/ip6_tunnel.h>
88 #include <net/ip_tunnels.h>
9+#include <net/dst_cache.h>
910
1011 #define IP6TUNNEL_ERR_TIMEO (30*HZ)
1112
@@ -33,12 +34,6 @@ struct __ip6_tnl_parm { · 21 unmodified lines
3334 __be32 o_key;
3435 };
3536
36−struct ip6_tnl_dst {
37− seqlock_t lock;
38− struct dst_entry __rcu *dst;
39− u32 cookie;
40−};
41−
4237 /* IPv6 tunnel */
4338 struct ip6_tnl {
4439 struct ip6_tnl __rcu *next; /* next tunnel in list */
@@ -46,7 +41,7 @@ struct ip6_tnl { · 1 unmodified line
4641 struct net *net; /* netns for packet i/o */
4742 struct __ip6_tnl_parm parms; /* tunnel configuration parameters */
4843 struct flowi fl; /* flowi template for xmit */
49− struct ip6_tnl_dst __percpu *dst_cache; /* cached dst */
44+ struct dst_cache dst_cache; /* cached dst */
5045
5146 int err_count;
5247 unsigned long err_time;
@@ -66,11 +61,6 @@ struct ipv6_tlv_tnl_enc_lim { · 13 unmodified lines
6661 __u8 encap_limit; /* tunnel encapsulation limit */
6762 } __packed;
6863
69−struct dst_entry *ip6_tnl_dst_get(struct ip6_tnl *t);
70−int ip6_tnl_dst_init(struct ip6_tnl *t);
71−void ip6_tnl_dst_destroy(struct ip6_tnl *t);
72−void ip6_tnl_dst_reset(struct ip6_tnl *t);
73−void ip6_tnl_dst_set(struct ip6_tnl *t, struct dst_entry *dst);
7464 int ip6_tnl_rcv_ctl(struct ip6_tnl *t, const struct in6_addr *laddr,
7565 const struct in6_addr *raddr);
7666 int ip6_tnl_xmit_ctl(struct ip6_tnl *t, const struct in6_addr *laddr,
include/net/ip_tunnels.h+44−11
@@ -7,12 +7,15 @@ · 6 unmodified lines
77 #include <linux/socket.h>
88 #include <linux/types.h>
99 #include <linux/u64_stats_sync.h>
10+#include <linux/bitops.h>
11+
1012 #include <net/dsfield.h>
1113 #include <net/gro_cells.h>
1214 #include <net/inet_ecn.h>
1315 #include <net/netns/generic.h>
1416 #include <net/rtnetlink.h>
1517 #include <net/lwtunnel.h>
18+#include <net/dst_cache.h>
1619
1720 #if IS_ENABLED(CONFIG_IPV6)
1821 #include <net/ipv6.h>
@@ -47,6 +50,7 @@ struct ip_tunnel_key { · 28 unmodified lines
4750 __be16 tun_flags;
4851 u8 tos; /* TOS for IPv4, TC for IPv6 */
4952 u8 ttl; /* TTL for IPv4, HL for IPv6 */
53+ __be32 label; /* Flow Label for IPv6 */
5054 __be16 tp_src;
5155 __be16 tp_dst;
5256 };
@@ -55,8 +59,16 @@ struct ip_tunnel_key { · 2 unmodified lines
5559 #define IP_TUNNEL_INFO_TX 0x01 /* represents tx tunnel parameters */
5660 #define IP_TUNNEL_INFO_IPV6 0x02 /* key contains IPv6 addresses */
5761
62+/* Maximum tunnel options length. */
63+#define IP_TUNNEL_OPTS_MAX \
64+ GENMASK((FIELD_SIZEOF(struct ip_tunnel_info, \
65+ options_len) * BITS_PER_BYTE) - 1, 0)
66+
5867 struct ip_tunnel_info {
5968 struct ip_tunnel_key key;
69+#ifdef CONFIG_DST_CACHE
70+ struct dst_cache dst_cache;
71+#endif
6072 u8 options_len;
6173 u8 mode;
6274 };
@@ -85,11 +97,6 @@ struct ip_tunnel_prl_entry { · 22 unmodified lines
8597 struct rcu_head rcu_head;
8698 };
8799
88−struct ip_tunnel_dst {
89− struct dst_entry __rcu *dst;
90− __be32 saddr;
91−};
92−
93100 struct metadata_dst;
94101
95102 struct ip_tunnel {
@@ -108,7 +115,7 @@ struct ip_tunnel { · 12 unmodified lines
108115 int tun_hlen; /* Precalculated header length */
109116 int mlink;
110117
111− struct ip_tunnel_dst __percpu *dst_cache;
118+ struct dst_cache dst_cache;
112119
113120 struct ip_tunnel_parm parms;
114121
@@ -141,6 +148,7 @@ struct ip_tunnel { · 26 unmodified lines
141148 #define TUNNEL_CRIT_OPT __cpu_to_be16(0x0400)
142149 #define TUNNEL_GENEVE_OPT __cpu_to_be16(0x0800)
143150 #define TUNNEL_VXLAN_OPT __cpu_to_be16(0x1000)
151+#define TUNNEL_NOCACHE __cpu_to_be16(0x2000)
144152
145153 #define TUNNEL_OPTIONS_PRESENT (TUNNEL_GENEVE_OPT | TUNNEL_VXLAN_OPT)
146154
@@ -181,7 +189,7 @@ int ip_tunnel_encap_del_ops(const struct ip_tunnel_encap_ops *op, · 34 unmodified lines
181189
182190 static inline void ip_tunnel_key_init(struct ip_tunnel_key *key,
183191 __be32 saddr, __be32 daddr,
184− u8 tos, u8 ttl,
192+ u8 tos, u8 ttl, __be32 label,
185193 __be16 tp_src, __be16 tp_dst,
186194 __be64 tun_id, __be16 tun_flags)
187195 {
@@ -192,6 +200,7 @@ static inline void ip_tunnel_key_init(struct ip_tunnel_key *key, · 4 unmodified lines
192200 0, IP_TUNNEL_KEY_IPV4_PAD_LEN);
193201 key->tos = tos;
194202 key->ttl = ttl;
203+ key->label = label;
195204 key->tun_flags = tun_flags;
196205
197206 /* For the tunnel types on the top of IPsec, the tp_src and tp_dst of
@@ -207,6 +216,20 @@ static inline void ip_tunnel_key_init(struct ip_tunnel_key *key, · 9 unmodified lines
207216 0, sizeof(*key) - IP_TUNNEL_KEY_SIZE);
208217 }
209218
219+static inline bool
220+ip_tunnel_dst_cache_usable(const struct sk_buff *skb,
221+ const struct ip_tunnel_info *info)
222+{
223+ if (skb->mark)
224+ return false;
225+ if (!info)
226+ return true;
227+ if (info->key.tun_flags & TUNNEL_NOCACHE)
228+ return false;
229+
230+ return true;
231+}
232+
210233 static inline unsigned short ip_tunnel_info_af(const struct ip_tunnel_info
211234 *tun_info)
212235 {
@@ -248,7 +271,6 @@ int ip_tunnel_changelink(struct net_device *dev, struct nlattr *tb[], · 35 unmodified lines
248271 int ip_tunnel_newlink(struct net_device *dev, struct nlattr *tb[],
249272 struct ip_tunnel_parm *p);
250273 void ip_tunnel_setup(struct net_device *dev, int net_id);
251−void ip_tunnel_dst_reset_all(struct ip_tunnel *t);
252274 int ip_tunnel_encap_setup(struct ip_tunnel *t,
253275 struct ip_tunnel_encap *ipencap);
254276
@@ -273,15 +295,15 @@ static inline u8 ip_tunnel_ecn_encap(u8 tos, const struct iphdr *iph, · 18 unmodified lines
273295 return INET_ECN_encapsulate(tos, inner);
274296 }
275297
276−int iptunnel_pull_header(struct sk_buff *skb, int hdr_len, __be16 inner_proto);
298+int iptunnel_pull_header(struct sk_buff *skb, int hdr_len, __be16 inner_proto,
299+ bool xnet);
277300 void iptunnel_xmit(struct sock *sk, struct rtable *rt, struct sk_buff *skb,
278301 __be32 src, __be32 dst, u8 proto,
279302 u8 tos, u8 ttl, __be16 df, bool xnet);
280303 struct metadata_dst *iptunnel_metadata_reply(struct metadata_dst *md,
281304 gfp_t flags);
282305
283−struct sk_buff *iptunnel_handle_offloads(struct sk_buff *skb, bool gre_csum,
284− int gso_type_mask);
306+struct sk_buff *iptunnel_handle_offloads(struct sk_buff *skb, int gso_type_mask);
285307
286308 static inline void iptunnel_xmit_stats(struct net_device *dev, int pkt_len)
287309 {
@@ -356,6 +378,17 @@ static inline void ip_tunnel_unneed_metadata(void) · 68 unmodified lines
356378 {
357379 }
358380
381+static inline void ip_tunnel_info_opts_get(void *to,
382+ const struct ip_tunnel_info *info)
383+{
384+}
385+
386+static inline void ip_tunnel_info_opts_set(struct ip_tunnel_info *info,
387+ const void *from, int len)
388+{
389+ info->options_len = 0;
390+}
391+
359392 #endif /* CONFIG_INET */
360393
361394 #endif /* __NET_IP_TUNNELS_H */
include/net/ip_vs.h+17−0
@@ -1588,6 +1588,23 @@ static inline void ip_vs_conn_drop_conntrack(struct ip_vs_conn *cp) · 1587 unmodified lines
15881588 }
15891589 #endif /* CONFIG_IP_VS_NFCT */
15901590
1591+/* Really using conntrack? */
1592+static inline bool ip_vs_conn_uses_conntrack(struct ip_vs_conn *cp,
1593+ struct sk_buff *skb)
1594+{
1595+#ifdef CONFIG_IP_VS_NFCT
1596+ enum ip_conntrack_info ctinfo;
1597+ struct nf_conn *ct;
1598+
1599+ if (!(cp->flags & IP_VS_CONN_F_NFCT))
1600+ return false;
1601+ ct = nf_ct_get(skb, &ctinfo);
1602+ if (ct && !nf_ct_is_untracked(ct))
1603+ return true;
1604+#endif
1605+ return false;
1606+}
1607+
15911608 static inline int
15921609 ip_vs_dest_conn_overhead(struct ip_vs_dest *dest)
15931610 {
include/net/ipv6.h+6−2
@@ -259,8 +259,12 @@ static inline struct ipv6_txoptions *txopt_get(const struct ipv6_pinfo *np) · 258 unmodified lines
259259
260260 rcu_read_lock();
261261 opt = rcu_dereference(np->opt);
262− if (opt && !atomic_inc_not_zero(&opt->refcnt))
263− opt = NULL;
262+ if (opt) {
263+ if (!atomic_inc_not_zero(&opt->refcnt))
264+ opt = NULL;
265+ else
266+ opt = rcu_pointer_handoff(opt);
267+ }
264268 rcu_read_unlock();
265269 return opt;
266270 }
include/net/kcm.h+226−0
@@ -0,0 +1,226 @@
1+/*
2+ * Kernel Connection Multiplexor
3+ *
4+ * Copyright (c) 2016 Tom Herbert <tom@herbertland.com>
5+ *
6+ * This program is free software; you can redistribute it and/or modify
7+ * it under the terms of the GNU General Public License version 2
8+ * as published by the Free Software Foundation.
9+ */
10+
11+#ifndef __NET_KCM_H_
12+#define __NET_KCM_H_
13+
14+#include <linux/skbuff.h>
15+#include <net/sock.h>
16+#include <uapi/linux/kcm.h>
17+
18+extern unsigned int kcm_net_id;
19+
20+#define KCM_STATS_ADD(stat, count) ((stat) += (count))
21+#define KCM_STATS_INCR(stat) ((stat)++)
22+
23+struct kcm_psock_stats {
24+ unsigned long long rx_msgs;
25+ unsigned long long rx_bytes;
26+ unsigned long long tx_msgs;
27+ unsigned long long tx_bytes;
28+ unsigned int rx_aborts;
29+ unsigned int rx_mem_fail;
30+ unsigned int rx_need_more_hdr;
31+ unsigned int rx_msg_too_big;
32+ unsigned int rx_msg_timeouts;
33+ unsigned int rx_bad_hdr_len;
34+ unsigned long long reserved;
35+ unsigned long long unreserved;
36+ unsigned int tx_aborts;
37+};
38+
39+struct kcm_mux_stats {
40+ unsigned long long rx_msgs;
41+ unsigned long long rx_bytes;
42+ unsigned long long tx_msgs;
43+ unsigned long long tx_bytes;
44+ unsigned int rx_ready_drops;
45+ unsigned int tx_retries;
46+ unsigned int psock_attach;
47+ unsigned int psock_unattach_rsvd;
48+ unsigned int psock_unattach;
49+};
50+
51+struct kcm_stats {
52+ unsigned long long rx_msgs;
53+ unsigned long long rx_bytes;
54+ unsigned long long tx_msgs;
55+ unsigned long long tx_bytes;
56+};
57+
58+struct kcm_tx_msg {
59+ unsigned int sent;
60+ unsigned int fragidx;
61+ unsigned int frag_offset;
62+ unsigned int msg_flags;
63+ struct sk_buff *frag_skb;
64+ struct sk_buff *last_skb;
65+};
66+
67+struct kcm_rx_msg {
68+ int full_len;
69+ int accum_len;
70+ int offset;
71+ int early_eaten;
72+};
73+
74+/* Socket structure for KCM client sockets */
75+struct kcm_sock {
76+ struct sock sk;
77+ struct kcm_mux *mux;
78+ struct list_head kcm_sock_list;
79+ int index;
80+ u32 done : 1;
81+ struct work_struct done_work;
82+
83+ struct kcm_stats stats;
84+
85+ /* Transmit */
86+ struct kcm_psock *tx_psock;
87+ struct work_struct tx_work;
88+ struct list_head wait_psock_list;
89+ struct sk_buff *seq_skb;
90+
91+ /* Don't use bit fields here, these are set under different locks */
92+ bool tx_wait;
93+ bool tx_wait_more;
94+
95+ /* Receive */
96+ struct kcm_psock *rx_psock;
97+ struct list_head wait_rx_list; /* KCMs waiting for receiving */
98+ bool rx_wait;
99+ u32 rx_disabled : 1;
100+};
101+
102+struct bpf_prog;
103+
104+/* Structure for an attached lower socket */
105+struct kcm_psock {
106+ struct sock *sk;
107+ struct kcm_mux *mux;
108+ int index;
109+
110+ u32 tx_stopped : 1;
111+ u32 rx_stopped : 1;
112+ u32 done : 1;
113+ u32 unattaching : 1;
114+
115+ void (*save_state_change)(struct sock *sk);
116+ void (*save_data_ready)(struct sock *sk);
117+ void (*save_write_space)(struct sock *sk);
118+
119+ struct list_head psock_list;
120+
121+ struct kcm_psock_stats stats;
122+
123+ /* Receive */
124+ struct sk_buff *rx_skb_head;
125+ struct sk_buff **rx_skb_nextp;
126+ struct sk_buff *ready_rx_msg;
127+ struct list_head psock_ready_list;
128+ struct work_struct rx_work;
129+ struct delayed_work rx_delayed_work;
130+ struct bpf_prog *bpf_prog;
131+ struct kcm_sock *rx_kcm;
132+ unsigned long long saved_rx_bytes;
133+ unsigned long long saved_rx_msgs;
134+ struct timer_list rx_msg_timer;
135+ unsigned int rx_need_bytes;
136+
137+ /* Transmit */
138+ struct kcm_sock *tx_kcm;
139+ struct list_head psock_avail_list;
140+ unsigned long long saved_tx_bytes;
141+ unsigned long long saved_tx_msgs;
142+};
143+
144+/* Per net MUX list */
145+struct kcm_net {
146+ struct mutex mutex;
147+ struct kcm_psock_stats aggregate_psock_stats;
148+ struct kcm_mux_stats aggregate_mux_stats;
149+ struct list_head mux_list;
150+ int count;
151+};
152+
153+/* Structure for a MUX */
154+struct kcm_mux {
155+ struct list_head kcm_mux_list;
156+ struct rcu_head rcu;
157+ struct kcm_net *knet;
158+
159+ struct list_head kcm_socks; /* All KCM sockets on MUX */
160+ int kcm_socks_cnt; /* Total KCM socket count for MUX */
161+ struct list_head psocks; /* List of all psocks on MUX */
162+ int psocks_cnt; /* Total attached sockets */
163+
164+ struct kcm_mux_stats stats;
165+ struct kcm_psock_stats aggregate_psock_stats;
166+
167+ /* Receive */
168+ spinlock_t rx_lock ____cacheline_aligned_in_smp;
169+ struct list_head kcm_rx_waiters; /* KCMs waiting for receiving */
170+ struct list_head psocks_ready; /* List of psocks with a msg ready */
171+ struct sk_buff_head rx_hold_queue;
172+
173+ /* Transmit */
174+ spinlock_t lock ____cacheline_aligned_in_smp; /* TX and mux locking */
175+ struct list_head psocks_avail; /* List of available psocks */
176+ struct list_head kcm_tx_waiters; /* KCMs waiting for a TX psock */
177+};
178+
179+#ifdef CONFIG_PROC_FS
180+int kcm_proc_init(void);
181+void kcm_proc_exit(void);
182+#else
183+static inline int kcm_proc_init(void) { return 0; }
184+static inline void kcm_proc_exit(void) { }
185+#endif
186+
187+static inline void aggregate_psock_stats(struct kcm_psock_stats *stats,
188+ struct kcm_psock_stats *agg_stats)
189+{
190+ /* Save psock statistics in the mux when psock is being unattached. */
191+
192+#define SAVE_PSOCK_STATS(_stat) (agg_stats->_stat += stats->_stat)
193+ SAVE_PSOCK_STATS(rx_msgs);
194+ SAVE_PSOCK_STATS(rx_bytes);
195+ SAVE_PSOCK_STATS(rx_aborts);
196+ SAVE_PSOCK_STATS(rx_mem_fail);
197+ SAVE_PSOCK_STATS(rx_need_more_hdr);
198+ SAVE_PSOCK_STATS(rx_msg_too_big);
199+ SAVE_PSOCK_STATS(rx_msg_timeouts);
200+ SAVE_PSOCK_STATS(rx_bad_hdr_len);
201+ SAVE_PSOCK_STATS(tx_msgs);
202+ SAVE_PSOCK_STATS(tx_bytes);
203+ SAVE_PSOCK_STATS(reserved);
204+ SAVE_PSOCK_STATS(unreserved);
205+ SAVE_PSOCK_STATS(tx_aborts);
206+#undef SAVE_PSOCK_STATS
207+}
208+
209+static inline void aggregate_mux_stats(struct kcm_mux_stats *stats,
210+ struct kcm_mux_stats *agg_stats)
211+{
212+ /* Save psock statistics in the mux when psock is being unattached. */
213+
214+#define SAVE_MUX_STATS(_stat) (agg_stats->_stat += stats->_stat)
215+ SAVE_MUX_STATS(rx_msgs);
216+ SAVE_MUX_STATS(rx_bytes);
217+ SAVE_MUX_STATS(tx_msgs);
218+ SAVE_MUX_STATS(tx_bytes);
219+ SAVE_MUX_STATS(rx_ready_drops);
220+ SAVE_MUX_STATS(psock_attach);
221+ SAVE_MUX_STATS(psock_unattach_rsvd);
222+ SAVE_MUX_STATS(psock_unattach);
223+#undef SAVE_MUX_STATS
224+}
225+
226+#endif /* __NET_KCM_H_ */
include/net/l3mdev.h+2−2
@@ -39,7 +39,7 @@ struct l3mdev_ops { · 38 unmodified lines
3939
4040 #ifdef CONFIG_NET_L3_MASTER_DEV
4141
42−int l3mdev_master_ifindex_rcu(struct net_device *dev);
42+int l3mdev_master_ifindex_rcu(const struct net_device *dev);
4343 static inline int l3mdev_master_ifindex(struct net_device *dev)
4444 {
4545 int ifindex;
@@ -179,7 +179,7 @@ struct dst_entry *l3mdev_rt6_dst_by_oif(struct net *net, · 133 unmodified lines
179179
180180 #else
181181
182−static inline int l3mdev_master_ifindex_rcu(struct net_device *dev)
182+static inline int l3mdev_master_ifindex_rcu(const struct net_device *dev)
183183 {
184184 return 0;
185185 }
include/net/lwtunnel.h+3−1
@@ -170,6 +170,8 @@ static inline int lwtunnel_input(struct sk_buff *skb) · 169 unmodified lines
170170 return -EOPNOTSUPP;
171171 }
172172
173−#endif
173+#endif /* CONFIG_LWTUNNEL */
174+
175+#define MODULE_ALIAS_RTNL_LWT(encap_type) MODULE_ALIAS("rtnl-lwt-" __stringify(encap_type))
174176
175177 #endif /* __NET_LWTUNNEL_H */
include/net/mac80211.h+152−46
@@ -5,7 +5,7 @@ · 4 unmodified lines
55 * Copyright 2006-2007 Jiri Benc <jbenc@suse.cz>
66 * Copyright 2007-2010 Johannes Berg <johannes@sipsolutions.net>
77 * Copyright 2013-2014 Intel Mobile Communications GmbH
8− * Copyright (C) 2015 Intel Deutschland GmbH
8+ * Copyright (C) 2015 - 2016 Intel Deutschland GmbH
99 *
1010 * This program is free software; you can redistribute it and/or modify
1111 * it under the terms of the GNU General Public License version 2 as
@@ -298,6 +298,7 @@ struct ieee80211_vif_chanctx_switch { · 286 unmodified lines
298298 * note that this is only called when it changes after the channel
299299 * context had been assigned.
300300 * @BSS_CHANGED_OCB: OCB join status changed
301+ * @BSS_CHANGED_MU_GROUPS: VHT MU-MIMO group id or user position changed
301302 */
302303 enum ieee80211_bss_change {
303304 BSS_CHANGED_ASSOC = 1<<0,
@@ -323,6 +324,7 @@ enum ieee80211_bss_change { · 19 unmodified lines
323324 BSS_CHANGED_BEACON_INFO = 1<<20,
324325 BSS_CHANGED_BANDWIDTH = 1<<21,
325326 BSS_CHANGED_OCB = 1<<22,
327+ BSS_CHANGED_MU_GROUPS = 1<<23,
326328
327329 /* when adding here, make sure to change ieee80211_reconfig */
328330 };
@@ -435,6 +437,19 @@ struct ieee80211_event { · 106 unmodified lines
435437 } u;
436438 };
437439
440+/**
441+ * struct ieee80211_mu_group_data - STA's VHT MU-MIMO group data
442+ *
443+ * This structure describes the group id data of VHT MU-MIMO
444+ *
445+ * @membership: 64 bits array - a bit is set if station is member of the group
446+ * @position: 2 bits per group id indicating the position in the group
447+ */
448+struct ieee80211_mu_group_data {
449+ u8 membership[WLAN_MEMBERSHIP_LEN];
450+ u8 position[WLAN_USER_POSITION_LEN];
451+};
452+
438453 /**
439454 * struct ieee80211_bss_conf - holds the BSS's changing parameters
440455 *
@@ -477,6 +492,7 @@ struct ieee80211_event { · 36 unmodified lines
477492 * @enable_beacon: whether beaconing should be enabled or not
478493 * @chandef: Channel definition for this BSS -- the hardware might be
479494 * configured a higher bandwidth than this BSS uses, for example.
495+ * @mu_group: VHT MU-MIMO group membership data
480496 * @ht_operation_mode: HT operation mode like in &struct ieee80211_ht_operation.
481497 * This field is only valid when the channel is a wide HT/VHT channel.
482498 * Note that with TDLS this can be the case (channel is HT, protection must
@@ -535,6 +551,7 @@ struct ieee80211_bss_conf { · 52 unmodified lines
535551 s32 cqm_rssi_thold;
536552 u32 cqm_rssi_hyst;
537553 struct cfg80211_chan_def chandef;
554+ struct ieee80211_mu_group_data mu_group;
538555 __be32 arp_addr_list[IEEE80211_BSS_ARP_ADDR_LIST_LEN];
539556 int arp_addr_cnt;
540557 bool qos;
@@ -691,12 +708,14 @@ enum mac80211_tx_info_flags { · 150 unmodified lines
691708 * protocol frame (e.g. EAP)
692709 * @IEEE80211_TX_CTRL_PS_RESPONSE: This frame is a response to a poll
693710 * frame (PS-Poll or uAPSD).
711+ * @IEEE80211_TX_CTRL_RATE_INJECT: This frame is injected with rate information
694712 *
695713 * These flags are used in tx_info->control.flags.
696714 */
697715 enum mac80211_tx_control_flags {
698716 IEEE80211_TX_CTRL_PORT_CTRL_PROTO = BIT(0),
699717 IEEE80211_TX_CTRL_PS_RESPONSE = BIT(1),
718+ IEEE80211_TX_CTRL_RATE_INJECT = BIT(2),
700719 };
701720
702721 /*
@@ -993,6 +1012,8 @@ ieee80211_tx_info_clear_status(struct ieee80211_tx_info *info) · 290 unmodified lines
9931012 * @RX_FLAG_MACTIME_END: The timestamp passed in the RX status (@mactime
9941013 * field) is valid and contains the time the last symbol of the MPDU
9951014 * (including FCS) was received.
1015+ * @RX_FLAG_MACTIME_PLCP_START: The timestamp passed in the RX status (@mactime
1016+ * field) is valid and contains the time the SYNC preamble was received.
9961017 * @RX_FLAG_SHORTPRE: Short preamble was used for this frame
9971018 * @RX_FLAG_HT: HT MCS was used and rate_idx is MCS index
9981019 * @RX_FLAG_VHT: VHT MCS was used and rate_index is MCS index
@@ -1014,6 +1035,14 @@ ieee80211_tx_info_clear_status(struct ieee80211_tx_info *info) · 15 unmodified lines
10141035 * @RX_FLAG_AMPDU_DELIM_CRC_KNOWN: The delimiter CRC field is known (the CRC
10151036 * is stored in the @ampdu_delimiter_crc field)
10161037 * @RX_FLAG_LDPC: LDPC was used
1038+ * @RX_FLAG_ONLY_MONITOR: Report frame only to monitor interfaces without
1039+ * processing it in any regular way.
1040+ * This is useful if drivers offload some frames but still want to report
1041+ * them for sniffing purposes.
1042+ * @RX_FLAG_SKIP_MONITOR: Process and report frame to all interfaces except
1043+ * monitor interfaces.
1044+ * This is useful if drivers offload some frames but still want to report
1045+ * them for sniffing purposes.
10171046 * @RX_FLAG_STBC_MASK: STBC 2 bit bitmask. 1 - Nss=1, 2 - Nss=2, 3 - Nss=3
10181047 * @RX_FLAG_10MHZ: 10 MHz (half channel) was used
10191048 * @RX_FLAG_5MHZ: 5 MHz (quarter channel) was used
@@ -1033,6 +1062,7 @@ ieee80211_tx_info_clear_status(struct ieee80211_tx_info *info) · 13 unmodified lines
10331062 enum mac80211_rx_flags {
10341063 RX_FLAG_MMIC_ERROR = BIT(0),
10351064 RX_FLAG_DECRYPTED = BIT(1),
1065+ RX_FLAG_MACTIME_PLCP_START = BIT(2),
10361066 RX_FLAG_MMIC_STRIPPED = BIT(3),
10371067 RX_FLAG_IV_STRIPPED = BIT(4),
10381068 RX_FLAG_FAILED_FCS_CRC = BIT(5),
@@ -1046,7 +1076,7 @@ enum mac80211_rx_flags { · 7 unmodified lines
10461076 RX_FLAG_HT_GF = BIT(13),
10471077 RX_FLAG_AMPDU_DETAILS = BIT(14),
10481078 RX_FLAG_PN_VALIDATED = BIT(15),
1049− /* bit 16 free */
1079+ RX_FLAG_DUP_VALIDATED = BIT(16),
10501080 RX_FLAG_AMPDU_LAST_KNOWN = BIT(17),
10511081 RX_FLAG_AMPDU_IS_LAST = BIT(18),
10521082 RX_FLAG_AMPDU_DELIM_CRC_ERROR = BIT(19),
@@ -1054,6 +1084,8 @@ enum mac80211_rx_flags { · 1 unmodified line
10541084 RX_FLAG_MACTIME_END = BIT(21),
10551085 RX_FLAG_VHT = BIT(22),
10561086 RX_FLAG_LDPC = BIT(23),
1087+ RX_FLAG_ONLY_MONITOR = BIT(24),
1088+ RX_FLAG_SKIP_MONITOR = BIT(25),
10571089 RX_FLAG_STBC_MASK = BIT(26) | BIT(27),
10581090 RX_FLAG_10MHZ = BIT(28),
10591091 RX_FLAG_5MHZ = BIT(29),
@@ -1072,6 +1104,7 @@ enum mac80211_rx_flags { · 12 unmodified lines
10721104 * @RX_VHT_FLAG_160MHZ: 160 MHz was used
10731105 * @RX_VHT_FLAG_BF: packet was beamformed
10741106 */
1107+
10751108 enum mac80211_rx_vht_flags {
10761109 RX_VHT_FLAG_80MHZ = BIT(0),
10771110 RX_VHT_FLAG_160MHZ = BIT(1),
@@ -1091,6 +1124,8 @@ enum mac80211_rx_vht_flags { · 13 unmodified lines
10911124 * it but can store it and pass it back to the driver for synchronisation
10921125 * @band: the active band when this frame was received
10931126 * @freq: frequency the radio was tuned to when receiving this frame, in MHz
1127+ * This field must be set for management frames, but isn't strictly needed
1128+ * for data (other) frames - for those it only affects radiotap reporting.
10941129 * @signal: signal strength when receiving this frame, either in dBm, in dB or
10951130 * unspecified depending on the hardware capabilities flags
10961131 * @IEEE80211_HW_SIGNAL_*
@@ -1347,6 +1382,7 @@ enum ieee80211_vif_flags { · 250 unmodified lines
13471382 * @csa_active: marks whether a channel switch is going on. Internally it is
13481383 * write-protected by sdata_lock and local->mtx so holding either is fine
13491384 * for read access.
1385+ * @mu_mimo_owner: indicates interface owns MU-MIMO capability
13501386 * @driver_flags: flags/capabilities the driver has for this interface,
13511387 * these need to be set (or cleared) when the interface is added
13521388 * or, if supported by the driver, the interface type is changed
@@ -1373,6 +1409,7 @@ struct ieee80211_vif { · 20 unmodified lines
13731409 u8 addr[ETH_ALEN];
13741410 bool p2p;
13751411 bool csa_active;
1412+ bool mu_mimo_owner;
13761413
13771414 u8 cab_queue;
13781415 u8 hw_queue[IEEE80211_NUM_ACS];
@@ -1486,9 +1523,8 @@ enum ieee80211_key_flags { · 107 unmodified lines
14861523 * wants to be given when a frame is transmitted and needs to be
14871524 * encrypted in hardware.
14881525 * @cipher: The key's cipher suite selector.
1489− * @tx_pn: PN used for TX on non-TKIP keys, may be used by the driver
1490− * as well if it needs to do software PN assignment by itself
1491− * (e.g. due to TSO)
1526+ * @tx_pn: PN used for TX keys, may be used by the driver as well if it
1527+ * needs to do software PN assignment by itself (e.g. due to TSO)
14921528 * @flags: key flags, see &enum ieee80211_key_flags.
14931529 * @keyidx: the key index (0-3)
14941530 * @keylen: key material length
@@ -1514,6 +1550,9 @@ struct ieee80211_key_conf { · 19 unmodified lines
15141550
15151551 #define IEEE80211_MAX_PN_LEN 16
15161552
1553+#define TKIP_PN_TO_IV16(pn) ((u16)(pn & 0xffff))
1554+#define TKIP_PN_TO_IV32(pn) ((u32)((pn >> 16) & 0xffffffff))
1555+
15171556 /**
15181557 * struct ieee80211_key_seq - key sequence counter
15191558 *
@@ -1684,6 +1723,18 @@ struct ieee80211_sta_rates { · 164 unmodified lines
16841723 * @tdls_initiator: indicates the STA is an initiator of the TDLS link. Only
16851724 * valid if the STA is a TDLS peer in the first place.
16861725 * @mfp: indicates whether the STA uses management frame protection or not.
1726+ * @max_amsdu_subframes: indicates the maximal number of MSDUs in a single
1727+ * A-MSDU. Taken from the Extended Capabilities element. 0 means
1728+ * unlimited.
1729+ * @max_amsdu_len: indicates the maximal length of an A-MSDU in bytes. This
1730+ * field is always valid for packets with a VHT preamble. For packets
1731+ * with a HT preamble, additional limits apply:
1732+ * + If the skb is transmitted as part of a BA agreement, the
1733+ * A-MSDU maximal size is min(max_amsdu_len, 4065) bytes.
1734+ * + If the skb is not part of a BA aggreement, the A-MSDU maximal
1735+ * size is min(max_amsdu_len, 7935) bytes.
1736+ * Both additional HT limits must be enforced by the low level driver.
1737+ * This is defined by the spec (IEEE 802.11-2012 section 8.3.2.2 NOTE 2).
16871738 * @txq: per-TID data TX queues (if driver uses the TXQ abstraction)
16881739 */
16891740 struct ieee80211_sta {
@@ -1702,6 +1753,8 @@ struct ieee80211_sta { · 12 unmodified lines
17021753 bool tdls;
17031754 bool tdls_initiator;
17041755 bool mfp;
1756+ u8 max_amsdu_subframes;
1757+ u16 max_amsdu_len;
17051758
17061759 struct ieee80211_txq *txq[IEEE80211_NUM_TIDS];
17071760
@@ -1910,6 +1963,11 @@ struct ieee80211_txq { · 202 unmodified lines
19101963 * by just its MAC address; this prevents, for example, the same station
19111964 * from connecting to two virtual AP interfaces at the same time.
19121965 *
1966+ * @IEEE80211_HW_SUPPORTS_REORDERING_BUFFER: Hardware (or driver) manages the
1967+ * reordering buffer internally, guaranteeing mac80211 receives frames in
1968+ * order and does not need to manage its own reorder buffer or BA session
1969+ * timeout.
1970+ *
19131971 * @NUM_IEEE80211_HW_FLAGS: number of hardware flags, used for sizing arrays
19141972 */
19151973 enum ieee80211_hw_flags {
@@ -1946,6 +2004,7 @@ enum ieee80211_hw_flags { · 30 unmodified lines
19462004 IEEE80211_HW_SUPPORTS_AMSDU_IN_AMPDU,
19472005 IEEE80211_HW_BEACON_TX_STATUS,
19482006 IEEE80211_HW_NEEDS_UNIQUE_STA_ADDR,
2007+ IEEE80211_HW_SUPPORTS_REORDERING_BUFFER,
19492008
19502009 /* keep last, obviously */
19512010 NUM_IEEE80211_HW_FLAGS
@@ -2167,7 +2226,7 @@ static inline void SET_IEEE80211_DEV(struct ieee80211_hw *hw, struct device *dev · 215 unmodified lines
21672226 * @hw: the &struct ieee80211_hw to set the MAC address for
21682227 * @addr: the address to set
21692228 */
2170−static inline void SET_IEEE80211_PERM_ADDR(struct ieee80211_hw *hw, u8 *addr)
2229+static inline void SET_IEEE80211_PERM_ADDR(struct ieee80211_hw *hw, const u8 *addr)
21712230 {
21722231 memcpy(hw->wiphy->perm_addr, addr, ETH_ALEN);
21732232 }
@@ -2683,6 +2742,33 @@ enum ieee80211_ampdu_mlme_action { · 509 unmodified lines
26832742 IEEE80211_AMPDU_TX_OPERATIONAL,
26842743 };
26852744
2745+/**
2746+ * struct ieee80211_ampdu_params - AMPDU action parameters
2747+ *
2748+ * @action: the ampdu action, value from %ieee80211_ampdu_mlme_action.
2749+ * @sta: peer of this AMPDU session
2750+ * @tid: tid of the BA session
2751+ * @ssn: start sequence number of the session. TX/RX_STOP can pass 0. When
2752+ * action is set to %IEEE80211_AMPDU_RX_START the driver passes back the
2753+ * actual ssn value used to start the session and writes the value here.
2754+ * @buf_size: reorder buffer size (number of subframes). Valid only when the
2755+ * action is set to %IEEE80211_AMPDU_RX_START or
2756+ * %IEEE80211_AMPDU_TX_OPERATIONAL
2757+ * @amsdu: indicates the peer's ability to receive A-MSDU within A-MPDU.
2758+ * valid when the action is set to %IEEE80211_AMPDU_TX_OPERATIONAL
2759+ * @timeout: BA session timeout. Valid only when the action is set to
2760+ * %IEEE80211_AMPDU_RX_START
2761+ */
2762+struct ieee80211_ampdu_params {
2763+ enum ieee80211_ampdu_mlme_action action;
2764+ struct ieee80211_sta *sta;
2765+ u16 tid;
2766+ u16 ssn;
2767+ u8 buf_size;
2768+ bool amsdu;
2769+ u16 timeout;
2770+};
2771+
26862772 /**
26872773 * enum ieee80211_frame_release_type - frame release reason
26882774 * @IEEE80211_FRAME_RELEASE_PSPOLL: frame released for PS-Poll
@@ -3027,13 +3113,9 @@ enum ieee80211_reconfig_type { · 338 unmodified lines
30273113 * @ampdu_action: Perform a certain A-MPDU action
30283114 * The RA/TID combination determines the destination and TID we want
30293115 * the ampdu action to be performed for. The action is defined through
3030− * ieee80211_ampdu_mlme_action. Starting sequence number (@ssn)
3031− * is the first frame we expect to perform the action on. Notice
3032− * that TX/RX_STOP can pass NULL for this parameter.
3033− * The @buf_size parameter is only valid when the action is set to
3034− * %IEEE80211_AMPDU_TX_OPERATIONAL and indicates the peer's reorder
3035− * buffer size (number of subframes) for this session -- the driver
3036− * may neither send aggregates containing more subframes than this
3116+ * ieee80211_ampdu_mlme_action.
3117+ * When the action is set to %IEEE80211_AMPDU_TX_OPERATIONAL the driver
3118+ * may neither send aggregates containing more subframes than @buf_size
30373119 * nor send aggregates in a way that lost frames would exceed the
30383120 * buffer size. If just limiting the aggregate size, this would be
30393121 * possible with a buf_size of 8:
@@ -3044,9 +3126,6 @@ enum ieee80211_reconfig_type { · 4 unmodified lines
30443126 * buffer size of 8. Correct ways to retransmit #1 would be:
30453127 * - TX: 1 or 18 or 81
30463128 * Even "189" would be wrong since 1 could be lost again.
3047− * The @amsdu parameter is valid when the action is set to
3048− * %IEEE80211_AMPDU_TX_OPERATIONAL and indicates the peer's ability
3049− * to receive A-MSDU within A-MPDU.
30503129 *
30513130 * Returns a negative error code on failure.
30523131 * The callback can sleep.
@@ -3388,9 +3467,7 @@ struct ieee80211_ops { · 335 unmodified lines
33883467 int (*tx_last_beacon)(struct ieee80211_hw *hw);
33893468 int (*ampdu_action)(struct ieee80211_hw *hw,
33903469 struct ieee80211_vif *vif,
3391− enum ieee80211_ampdu_mlme_action action,
3392− struct ieee80211_sta *sta, u16 tid, u16 *ssn,
3393− u8 buf_size, bool amsdu);
3470+ struct ieee80211_ampdu_params *params);
33943471 int (*get_survey)(struct ieee80211_hw *hw, int idx,
33953472 struct survey_info *survey);
33963473 void (*rfkill_poll)(struct ieee80211_hw *hw);
@@ -4374,21 +4451,19 @@ void ieee80211_get_tkip_p2k(struct ieee80211_key_conf *keyconf, · 977 unmodified lines
43744451 struct sk_buff *skb, u8 *p2k);
43754452
43764453 /**
4377− * ieee80211_get_key_tx_seq - get key TX sequence counter
4454+ * ieee80211_tkip_add_iv - write TKIP IV and Ext. IV to pos
43784455 *
4456+ * @pos: start of crypto header
43794457 * @keyconf: the parameter passed with the set key
4380− * @seq: buffer to receive the sequence data
4458+ * @pn: PN to add
43814459 *
4382− * This function allows a driver to retrieve the current TX IV/PN
4383− * for the given key. It must not be called if IV generation is
4384− * offloaded to the device.
4460+ * Returns: pointer to the octet following IVs (i.e. beginning of
4461+ * the packet payload)
43854462 *
4386− * Note that this function may only be called when no TX processing
4387− * can be done concurrently, for example when queues are stopped
4388− * and the stop has been synchronized.
4463+ * This function writes the tkip IV value to pos (which should
4464+ * point to the crypto header)
43894465 */
4390−void ieee80211_get_key_tx_seq(struct ieee80211_key_conf *keyconf,
4391− struct ieee80211_key_seq *seq);
4466+u8 *ieee80211_tkip_add_iv(u8 *pos, struct ieee80211_key_conf *keyconf, u64 pn);
43924467
43934468 /**
43944469 * ieee80211_get_key_rx_seq - get key RX sequence counter
@@ -4409,23 +4484,6 @@ void ieee80211_get_key_tx_seq(struct ieee80211_key_conf *keyconf, · 14 unmodified lines
44094484 void ieee80211_get_key_rx_seq(struct ieee80211_key_conf *keyconf,
44104485 int tid, struct ieee80211_key_seq *seq);
44114486
4412−/**
4413− * ieee80211_set_key_tx_seq - set key TX sequence counter
4414− *
4415− * @keyconf: the parameter passed with the set key
4416− * @seq: new sequence data
4417− *
4418− * This function allows a driver to set the current TX IV/PNs for the
4419− * given key. This is useful when resuming from WoWLAN sleep and the
4420− * device may have transmitted frames using the PTK, e.g. replies to
4421− * ARP requests.
4422− *
4423− * Note that this function may only be called when no TX processing
4424− * can be done concurrently.
4425− */
4426−void ieee80211_set_key_tx_seq(struct ieee80211_key_conf *keyconf,
4427− struct ieee80211_key_seq *seq);
4428−
44294487 /**
44304488 * ieee80211_set_key_rx_seq - set key RX sequence counter
44314489 *
@@ -5120,6 +5178,24 @@ void ieee80211_remain_on_channel_expired(struct ieee80211_hw *hw); · 688 unmodified lines
51205178 void ieee80211_stop_rx_ba_session(struct ieee80211_vif *vif, u16 ba_rx_bitmap,
51215179 const u8 *addr);
51225180
5181+/**
5182+ * ieee80211_mark_rx_ba_filtered_frames - move RX BA window and mark filtered
5183+ * @pubsta: station struct
5184+ * @tid: the session's TID
5185+ * @ssn: starting sequence number of the bitmap, all frames before this are
5186+ * assumed to be out of the window after the call
5187+ * @filtered: bitmap of filtered frames, BIT(0) is the @ssn entry etc.
5188+ * @received_mpdus: number of received mpdus in firmware
5189+ *
5190+ * This function moves the BA window and releases all frames before @ssn, and
5191+ * marks frames marked in the bitmap as having been filtered. Afterwards, it
5192+ * checks if any frames in the window starting from @ssn can now be released
5193+ * (in case they were only waiting for frames that were filtered.)
5194+ */
5195+void ieee80211_mark_rx_ba_filtered_frames(struct ieee80211_sta *pubsta, u8 tid,
5196+ u16 ssn, u64 filtered,
5197+ u16 received_mpdus);
5198+
51235199 /**
51245200 * ieee80211_send_bar - send a BlockAckReq frame
51255201 *
@@ -5371,6 +5447,21 @@ ieee80211_vif_type_p2p(struct ieee80211_vif *vif) · 245 unmodified lines
53715447 return ieee80211_iftype_p2p(vif->type, vif->p2p);
53725448 }
53735449
5450+/**
5451+ * ieee80211_update_mu_groups - set the VHT MU-MIMO groud data
5452+ *
5453+ * @vif: the specified virtual interface
5454+ * @membership: 64 bits array - a bit is set if station is member of the group
5455+ * @position: 2 bits per group id indicating the position in the group
5456+ *
5457+ * Note: This function assumes that the given vif is valid and the position and
5458+ * membership data is of the correct size and are in the same byte order as the
5459+ * matching GroupId management frame.
5460+ * Calls to this function need to be serialized with RX path.
5461+ */
5462+void ieee80211_update_mu_groups(struct ieee80211_vif *vif,
5463+ const u8 *membership, const u8 *position);
5464+
53745465 void ieee80211_enable_rssi_reports(struct ieee80211_vif *vif,
53755466 int rssi_min_thold,
53765467 int rssi_max_thold);
@@ -5523,4 +5614,19 @@ void ieee80211_unreserve_tid(struct ieee80211_sta *sta, u8 tid); · 146 unmodified lines
55235614 */
55245615 struct sk_buff *ieee80211_tx_dequeue(struct ieee80211_hw *hw,
55255616 struct ieee80211_txq *txq);
5617+
5618+/**
5619+ * ieee80211_txq_get_depth - get pending frame/byte count of given txq
5620+ *
5621+ * The values are not guaranteed to be coherent with regard to each other, i.e.
5622+ * txq state can change half-way of this function and the caller may end up
5623+ * with "new" frame_cnt and "old" byte_cnt or vice-versa.
5624+ *
5625+ * @txq: pointer obtained from station or virtual interface
5626+ * @frame_cnt: pointer to store frame count
5627+ * @byte_cnt: pointer to store byte count
5628+ */
5629+void ieee80211_txq_get_depth(struct ieee80211_txq *txq,
5630+ unsigned long *frame_cnt,
5631+ unsigned long *byte_cnt);
55265632 #endif /* MAC80211_H */
include/net/mac802154.h+8−7
@@ -16,10 +16,10 @@ · 15 unmodified lines
1616 #ifndef NET_MAC802154_H
1717 #define NET_MAC802154_H
1818
19+#include <asm/unaligned.h>
1920 #include <net/af_ieee802154.h>
2021 #include <linux/ieee802154.h>
2122 #include <linux/skbuff.h>
22−#include <linux/unaligned/memmove.h>
2323
2424 #include <net/cfg802154.h>
2525
@@ -247,13 +247,14 @@ struct ieee802154_ops { · 221 unmodified lines
247247 */
248248 static inline __le16 ieee802154_get_fc_from_skb(const struct sk_buff *skb)
249249 {
250− /* return some invalid fc on failure */
251− if (unlikely(skb->len < 2)) {
250+ /* check if we can fc at skb_mac_header of sk buffer */
251+ if (unlikely(!skb_mac_header_was_set(skb) ||
252+ (skb_tail_pointer(skb) - skb_mac_header(skb)) < 2)) {
252253 WARN_ON(1);
253254 return cpu_to_le16(0);
254255 }
255256
256− return (__force __le16)__get_unaligned_memmove16(skb_mac_header(skb));
257+ return get_unaligned_le16(skb_mac_header(skb));
257258 }
258259
259260 /**
@@ -263,7 +264,7 @@ static inline __le16 ieee802154_get_fc_from_skb(const struct sk_buff *skb) · 3 unmodified lines
263264 */
264265 static inline void ieee802154_be64_to_le64(void *le64_dst, const void *be64_src)
265266 {
266− __put_unaligned_memmove64(swab64p(be64_src), le64_dst);
267+ put_unaligned_le64(get_unaligned_be64(be64_src), le64_dst);
267268 }
268269
269270 /**
@@ -273,7 +274,7 @@ static inline void ieee802154_be64_to_le64(void *le64_dst, const void *be64_src) · 3 unmodified lines
273274 */
274275 static inline void ieee802154_le64_to_be64(void *be64_dst, const void *le64_src)
275276 {
276− __put_unaligned_memmove64(swab64p(le64_src), be64_dst);
277+ put_unaligned_be64(get_unaligned_le64(le64_src), be64_dst);
277278 }
278279
279280 /**
@@ -283,7 +284,7 @@ static inline void ieee802154_le64_to_be64(void *be64_dst, const void *le64_src) · 3 unmodified lines
283284 */
284285 static inline void ieee802154_le16_to_be16(void *be16_dst, const void *le16_src)
285286 {
286− __put_unaligned_memmove16(swab16p(le16_src), be16_dst);
287+ put_unaligned_be16(get_unaligned_le16(le16_src), be16_dst);
287288 }
288289
289290 /**
include/net/netfilter/nft_masq.h+3−1
@@ -2,7 +2,9 @@ · 1 unmodified line
22 #define _NFT_MASQ_H_
33
44 struct nft_masq {
5− u32 flags;
5+ u32 flags;
6+ enum nft_registers sreg_proto_min:8;
7+ enum nft_registers sreg_proto_max:8;
68 };
79
810 extern const struct nla_policy nft_masq_policy[];
include/net/netns/ipv4.h+19−0
@@ -80,9 +80,13 @@ struct netns_ipv4 { · 79 unmodified lines
8080 int sysctl_tcp_ecn;
8181 int sysctl_tcp_ecn_fallback;
8282
83+ int sysctl_ip_default_ttl;
8384 int sysctl_ip_no_pmtu_disc;
8485 int sysctl_ip_fwd_use_pmtu;
8586 int sysctl_ip_nonlocal_bind;
87+ /* Shall we try to damage output packets if routing dev changes? */
88+ int sysctl_ip_dynaddr;
89+ int sysctl_ip_early_demux;
8690
8791 int sysctl_fwmark_reflect;
8892 int sysctl_tcp_fwmark_accept;
@@ -98,6 +102,21 @@ struct netns_ipv4 { · 9 unmodified lines
98102 int sysctl_tcp_keepalive_probes;
99103 int sysctl_tcp_keepalive_intvl;
100104
105+ int sysctl_tcp_syn_retries;
106+ int sysctl_tcp_synack_retries;
107+ int sysctl_tcp_syncookies;
108+ int sysctl_tcp_reordering;
109+ int sysctl_tcp_retries1;
110+ int sysctl_tcp_retries2;
111+ int sysctl_tcp_orphan_retries;
112+ int sysctl_tcp_fin_timeout;
113+ unsigned int sysctl_tcp_notsent_lowat;
114+
115+ int sysctl_igmp_max_memberships;
116+ int sysctl_igmp_max_msf;
117+ int sysctl_igmp_llm_reports;
118+ int sysctl_igmp_qrv;
119+
101120 struct ping_group_range ping_group_range;
102121
103122 atomic_t dev_addr_genid;
include/net/netns/ipv6.h+3−0
@@ -58,7 +58,10 @@ struct netns_ipv6 { · 57 unmodified lines
5858 struct timer_list ip6_fib_timer;
5959 struct hlist_head *fib_table_hash;
6060 struct fib6_table *fib6_main_tbl;
61+ struct list_head fib6_walkers;
6162 struct dst_ops ip6_dst_ops;
63+ rwlock_t fib6_walker_lock;
64+ spinlock_t fib6_gc_lock;
6265 unsigned int ip6_rt_gc_expire;
6366 unsigned long ip6_rt_last_gc;
6467 #ifdef CONFIG_IPV6_MULTIPLE_TABLES
include/net/phonet/phonet.h+1−1
@@ -51,7 +51,7 @@ void pn_sock_init(void); · 50 unmodified lines
5151 struct sock *pn_find_sock_by_sa(struct net *net, const struct sockaddr_pn *sa);
5252 void pn_deliver_sock_broadcast(struct net *net, struct sk_buff *skb);
5353 void phonet_get_local_port_range(int *min, int *max);
54−void pn_sock_hash(struct sock *sk);
54+int pn_sock_hash(struct sock *sk);
5555 void pn_sock_unhash(struct sock *sk);
5656 int pn_sock_get_port(struct sock *sk, unsigned short sport);
5757
include/net/ping.h+1−1
@@ -65,7 +65,7 @@ struct pingfakehdr { · 64 unmodified lines
6565 };
6666
6767 int ping_get_port(struct sock *sk, unsigned short ident);
68−void ping_hash(struct sock *sk);
68+int ping_hash(struct sock *sk);
6969 void ping_unhash(struct sock *sk);
7070
7171 int ping_init_sock(struct sock *sk);
include/net/pkt_cls.h+65−0
@@ -358,4 +358,69 @@ tcf_match_indev(struct sk_buff *skb, int ifindex) · 357 unmodified lines
358358 }
359359 #endif /* CONFIG_NET_CLS_IND */
360360
361+struct tc_cls_u32_knode {
362+ struct tcf_exts *exts;
363+ struct tc_u32_sel *sel;
364+ u32 handle;
365+ u32 val;
366+ u32 mask;
367+ u32 link_handle;
368+ u8 fshift;
369+};
370+
371+struct tc_cls_u32_hnode {
372+ u32 handle;
373+ u32 prio;
374+ unsigned int divisor;
375+};
376+
377+enum tc_clsu32_command {
378+ TC_CLSU32_NEW_KNODE,
379+ TC_CLSU32_REPLACE_KNODE,
380+ TC_CLSU32_DELETE_KNODE,
381+ TC_CLSU32_NEW_HNODE,
382+ TC_CLSU32_REPLACE_HNODE,
383+ TC_CLSU32_DELETE_HNODE,
384+};
385+
386+struct tc_cls_u32_offload {
387+ /* knode values */
388+ enum tc_clsu32_command command;
389+ union {
390+ struct tc_cls_u32_knode knode;
391+ struct tc_cls_u32_hnode hnode;
392+ };
393+};
394+
395+/* tca flags definitions */
396+#define TCA_CLS_FLAGS_SKIP_HW 1
397+
398+static inline bool tc_should_offload(struct net_device *dev, u32 flags)
399+{
400+ if (!(dev->features & NETIF_F_HW_TC))
401+ return false;
402+
403+ if (flags & TCA_CLS_FLAGS_SKIP_HW)
404+ return false;
405+
406+ if (!dev->netdev_ops->ndo_setup_tc)
407+ return false;
408+
409+ return true;
410+}
411+
412+enum tc_fl_command {
413+ TC_CLSFLOWER_REPLACE,
414+ TC_CLSFLOWER_DESTROY,
415+};
416+
417+struct tc_cls_flower_offload {
418+ enum tc_fl_command command;
419+ unsigned long cookie;
420+ struct flow_dissector *dissector;
421+ struct fl_flow_key *mask;
422+ struct fl_flow_key *key;
423+ struct tcf_exts *exts;
424+};
425+
361426 #endif
include/net/raw.h+1−1
@@ -57,7 +57,7 @@ int raw_seq_open(struct inode *ino, struct file *file, · 56 unmodified lines
5757
5858 #endif
5959
60−void raw_hash_sk(struct sock *sk);
60+int raw_hash_sk(struct sock *sk);
6161 void raw_unhash_sk(struct sock *sk);
6262
6363 struct raw_sock {
include/net/route.h+2−3
@@ -329,14 +329,13 @@ static inline int inet_iif(const struct sk_buff *skb) · 328 unmodified lines
329329 return skb->skb_iif;
330330 }
331331
332−extern int sysctl_ip_default_ttl;
333−
334332 static inline int ip4_dst_hoplimit(const struct dst_entry *dst)
335333 {
336334 int hoplimit = dst_metric_raw(dst, RTAX_HOPLIMIT);
335+ struct net *net = dev_net(dst->dev);
337336
338337 if (hoplimit == 0)
339− hoplimit = sysctl_ip_default_ttl;
338+ hoplimit = net->ipv4.sysctl_ip_default_ttl;
340339 return hoplimit;
341340 }
342341
include/net/sch_generic.h+25−1
@@ -345,6 +345,12 @@ extern struct Qdisc_ops pfifo_fast_ops; · 344 unmodified lines
345345 extern struct Qdisc_ops mq_qdisc_ops;
346346 extern struct Qdisc_ops noqueue_qdisc_ops;
347347 extern const struct Qdisc_ops *default_qdisc_ops;
348+static inline const struct Qdisc_ops *
349+get_default_qdisc_ops(const struct net_device *dev, int ntx)
350+{
351+ return ntx < dev->real_num_tx_queues ?
352+ default_qdisc_ops : &pfifo_fast_ops;
353+}
348354
349355 struct Qdisc_class_common {
350356 u32 classid;
@@ -396,7 +402,8 @@ struct Qdisc *dev_graft_qdisc(struct netdev_queue *dev_queue, · 45 unmodified lines
396402 struct Qdisc *qdisc);
397403 void qdisc_reset(struct Qdisc *qdisc);
398404 void qdisc_destroy(struct Qdisc *qdisc);
399−void qdisc_tree_decrease_qlen(struct Qdisc *qdisc, unsigned int n);
405+void qdisc_tree_reduce_backlog(struct Qdisc *qdisc, unsigned int n,
406+ unsigned int len);
400407 struct Qdisc *qdisc_alloc(struct netdev_queue *dev_queue,
401408 const struct Qdisc_ops *ops);
402409 struct Qdisc *qdisc_create_dflt(struct netdev_queue *dev_queue,
@@ -707,6 +714,23 @@ static inline void qdisc_reset_queue(struct Qdisc *sch) · 304 unmodified lines
707714 sch->qstats.backlog = 0;
708715 }
709716
717+static inline struct Qdisc *qdisc_replace(struct Qdisc *sch, struct Qdisc *new,
718+ struct Qdisc **pold)
719+{
720+ struct Qdisc *old;
721+
722+ sch_tree_lock(sch);
723+ old = *pold;
724+ *pold = new;
725+ if (old != NULL) {
726+ qdisc_tree_reduce_backlog(old, old->q.qlen, old->qstats.backlog);
727+ qdisc_reset(old);
728+ }
729+ sch_tree_unlock(sch);
730+
731+ return old;
732+}
733+
710734 static inline unsigned int __qdisc_queue_drop(struct Qdisc *sch,
711735 struct sk_buff_head *list)
712736 {
include/net/sctp/sm.h+1−1
@@ -201,7 +201,7 @@ struct sctp_chunk *sctp_make_cwr(const struct sctp_association *, · 200 unmodified lines
201201 struct sctp_chunk * sctp_make_datafrag_empty(struct sctp_association *,
202202 const struct sctp_sndrcvinfo *sinfo,
203203 int len, const __u8 flags,
204− __u16 ssn);
204+ __u16 ssn, gfp_t gfp);
205205 struct sctp_chunk *sctp_make_ecne(const struct sctp_association *,
206206 const __u32);
207207 struct sctp_chunk *sctp_make_sack(const struct sctp_association *);
include/net/sctp/structs.h+5−6
@@ -535,7 +535,6 @@ struct sctp_datamsg { · 534 unmodified lines
535535 struct sctp_datamsg *sctp_datamsg_from_user(struct sctp_association *,
536536 struct sctp_sndrcvinfo *,
537537 struct iov_iter *);
538−void sctp_datamsg_free(struct sctp_datamsg *);
539538 void sctp_datamsg_put(struct sctp_datamsg *);
540539 void sctp_chunk_fail(struct sctp_chunk *, int error);
541540 int sctp_chunk_abandoned(struct sctp_chunk *);
@@ -656,7 +655,7 @@ void sctp_chunk_free(struct sctp_chunk *); · 114 unmodified lines
656655 void *sctp_addto_chunk(struct sctp_chunk *, int len, const void *data);
657656 struct sctp_chunk *sctp_chunkify(struct sk_buff *,
658657 const struct sctp_association *,
659− struct sock *);
658+ struct sock *, gfp_t gfp);
660659 void sctp_init_addrs(struct sctp_chunk *, union sctp_addr *,
661660 union sctp_addr *);
662661 const union sctp_addr *sctp_source(const struct sctp_chunk *chunk);
@@ -718,10 +717,10 @@ struct sctp_packet *sctp_packet_init(struct sctp_packet *, · 55 unmodified lines
718717 __u16 sport, __u16 dport);
719718 struct sctp_packet *sctp_packet_config(struct sctp_packet *, __u32 vtag, int);
720719 sctp_xmit_t sctp_packet_transmit_chunk(struct sctp_packet *,
721− struct sctp_chunk *, int);
720+ struct sctp_chunk *, int, gfp_t);
722721 sctp_xmit_t sctp_packet_append_chunk(struct sctp_packet *,
723722 struct sctp_chunk *);
724−int sctp_packet_transmit(struct sctp_packet *);
723+int sctp_packet_transmit(struct sctp_packet *, gfp_t);
725724 void sctp_packet_free(struct sctp_packet *);
726725
727726 static inline int sctp_packet_empty(struct sctp_packet *packet)
@@ -1054,7 +1053,7 @@ struct sctp_outq { · 326 unmodified lines
10541053 void sctp_outq_init(struct sctp_association *, struct sctp_outq *);
10551054 void sctp_outq_teardown(struct sctp_outq *);
10561055 void sctp_outq_free(struct sctp_outq*);
1057−int sctp_outq_tail(struct sctp_outq *, struct sctp_chunk *chunk);
1056+int sctp_outq_tail(struct sctp_outq *, struct sctp_chunk *chunk, gfp_t);
10581057 int sctp_outq_sack(struct sctp_outq *, struct sctp_chunk *);
10591058 int sctp_outq_is_empty(const struct sctp_outq *);
10601059 void sctp_outq_restart(struct sctp_outq *);
@@ -1062,7 +1061,7 @@ void sctp_outq_restart(struct sctp_outq *); · 1 unmodified line
10621061 void sctp_retransmit(struct sctp_outq *, struct sctp_transport *,
10631062 sctp_retransmit_reason_t);
10641063 void sctp_retransmit_mark(struct sctp_outq *, struct sctp_transport *, __u8);
1065−int sctp_outq_uncork(struct sctp_outq *);
1064+int sctp_outq_uncork(struct sctp_outq *, gfp_t gfp);
10661065 /* Uncork and flush an outqueue. */
10671066 static inline void sctp_outq_cork(struct sctp_outq *q)
10681067 {
include/net/sock.h+3−3
@@ -984,7 +984,7 @@ struct proto { · 983 unmodified lines
984984 void (*release_cb)(struct sock *sk);
985985
986986 /* Keeping track of sk's, looking them up, and port selection methods. */
987− void (*hash)(struct sock *sk);
987+ int (*hash)(struct sock *sk);
988988 void (*unhash)(struct sock *sk);
989989 void (*rehash)(struct sock *sk);
990990 int (*get_port)(struct sock *sk, unsigned short snum);
@@ -1194,10 +1194,10 @@ static inline void sock_prot_inuse_add(struct net *net, struct proto *prot, · 203 unmodified lines
11941194 /* With per-bucket locks this operation is not-atomic, so that
11951195 * this version is not worse.
11961196 */
1197−static inline void __sk_prot_rehash(struct sock *sk)
1197+static inline int __sk_prot_rehash(struct sock *sk)
11981198 {
11991199 sk->sk_prot->unhash(sk);
1200− sk->sk_prot->hash(sk);
1200+ return sk->sk_prot->hash(sk);
12011201 }
12021202
12031203 void sk_prot_clear_portaddr_nulls(struct sock *sk, int size);
include/net/tc_act/tc_gact.h+16−0
@@ -2,6 +2,7 @@ · 1 unmodified line
22 #define __NET_TC_GACT_H
33
44 #include <net/act_api.h>
5+#include <linux/tc_act/tc_gact.h>
56
67 struct tcf_gact {
78 struct tcf_common common;
@@ -15,4 +16,19 @@ struct tcf_gact { · 7 unmodified lines
1516 #define to_gact(a) \
1617 container_of(a->priv, struct tcf_gact, common)
1718
19+static inline bool is_tcf_gact_shot(const struct tc_action *a)
20+{
21+#ifdef CONFIG_NET_CLS_ACT
22+ struct tcf_gact *gact;
23+
24+ if (a->ops && a->ops->type != TCA_ACT_GACT)
25+ return false;
26+
27+ gact = a->priv;
28+ if (gact->tcf_action == TC_ACT_SHOT)
29+ return true;
30+
31+#endif
32+ return false;
33+}
1834 #endif /* __NET_TC_GACT_H */
include/net/tc_act/tc_ife.h+61−0
@@ -0,0 +1,61 @@
1+#ifndef __NET_TC_IFE_H
2+#define __NET_TC_IFE_H
3+
4+#include <net/act_api.h>
5+#include <linux/etherdevice.h>
6+#include <linux/rtnetlink.h>
7+#include <linux/module.h>
8+
9+#define IFE_METAHDRLEN 2
10+struct tcf_ife_info {
11+ struct tcf_common common;
12+ u8 eth_dst[ETH_ALEN];
13+ u8 eth_src[ETH_ALEN];
14+ u16 eth_type;
15+ u16 flags;
16+ /* list of metaids allowed */
17+ struct list_head metalist;
18+};
19+#define to_ife(a) \
20+ container_of(a->priv, struct tcf_ife_info, common)
21+
22+struct tcf_meta_info {
23+ const struct tcf_meta_ops *ops;
24+ void *metaval;
25+ u16 metaid;
26+ struct list_head metalist;
27+};
28+
29+struct tcf_meta_ops {
30+ u16 metaid; /*Maintainer provided ID */
31+ u16 metatype; /*netlink attribute type (look at net/netlink.h) */
32+ const char *name;
33+ const char *synopsis;
34+ struct list_head list;
35+ int (*check_presence)(struct sk_buff *, struct tcf_meta_info *);
36+ int (*encode)(struct sk_buff *, void *, struct tcf_meta_info *);
37+ int (*decode)(struct sk_buff *, void *, u16 len);
38+ int (*get)(struct sk_buff *skb, struct tcf_meta_info *mi);
39+ int (*alloc)(struct tcf_meta_info *, void *);
40+ void (*release)(struct tcf_meta_info *);
41+ int (*validate)(void *val, int len);
42+ struct module *owner;
43+};
44+
45+#define MODULE_ALIAS_IFE_META(metan) MODULE_ALIAS("ifemeta" __stringify_1(metan))
46+
47+int ife_get_meta_u32(struct sk_buff *skb, struct tcf_meta_info *mi);
48+int ife_get_meta_u16(struct sk_buff *skb, struct tcf_meta_info *mi);
49+int ife_tlv_meta_encode(void *skbdata, u16 attrtype, u16 dlen,
50+ const void *dval);
51+int ife_alloc_meta_u32(struct tcf_meta_info *mi, void *metaval);
52+int ife_alloc_meta_u16(struct tcf_meta_info *mi, void *metaval);
53+int ife_check_meta_u32(u32 metaval, struct tcf_meta_info *mi);
54+int ife_encode_meta_u32(u32 metaval, void *skbdata, struct tcf_meta_info *mi);
55+int ife_validate_meta_u32(void *val, int len);
56+int ife_validate_meta_u16(void *val, int len);
57+void ife_release_meta_gen(struct tcf_meta_info *mi);
58+int register_ife_op(struct tcf_meta_ops *mops);
59+int unregister_ife_op(struct tcf_meta_ops *mops);
60+
61+#endif /* __NET_TC_IFE_H */
include/net/tc_act/tc_skbedit.h+16−0
@@ -20,6 +20,7 @@ · 19 unmodified lines
2020 #define __NET_TC_SKBEDIT_H
2121
2222 #include <net/act_api.h>
23+#include <linux/tc_act/tc_skbedit.h>
2324
2425 struct tcf_skbedit {
2526 struct tcf_common common;
@@ -32,4 +33,19 @@ struct tcf_skbedit { · 6 unmodified lines
3233 #define to_skbedit(a) \
3334 container_of(a->priv, struct tcf_skbedit, common)
3435
36+/* Return true iff action is mark */
37+static inline bool is_tcf_skbedit_mark(const struct tc_action *a)
38+{
39+#ifdef CONFIG_NET_CLS_ACT
40+ if (a->ops && a->ops->type == TCA_ACT_SKBEDIT)
41+ return to_skbedit(a)->flags == SKBEDIT_F_MARK;
42+#endif
43+ return false;
44+}
45+
46+static inline u32 tcf_skbedit_mark(const struct tc_action *a)
47+{
48+ return to_skbedit(a)->mark;
49+}
50+
3551 #endif /* __NET_TC_SKBEDIT_H */
include/net/tcp.h+42−11
@@ -238,13 +238,6 @@ extern struct inet_timewait_death_row tcp_death_row; · 237 unmodified lines
238238 extern int sysctl_tcp_timestamps;
239239 extern int sysctl_tcp_window_scaling;
240240 extern int sysctl_tcp_sack;
241−extern int sysctl_tcp_fin_timeout;
242−extern int sysctl_tcp_syn_retries;
243−extern int sysctl_tcp_synack_retries;
244−extern int sysctl_tcp_retries1;
245−extern int sysctl_tcp_retries2;
246−extern int sysctl_tcp_orphan_retries;
247−extern int sysctl_tcp_syncookies;
248241 extern int sysctl_tcp_fastopen;
249242 extern int sysctl_tcp_retrans_collapse;
250243 extern int sysctl_tcp_stdurg;
@@ -273,7 +266,6 @@ extern int sysctl_tcp_thin_dupack; · 22 unmodified lines
273266 extern int sysctl_tcp_early_retrans;
274267 extern int sysctl_tcp_limit_output_bytes;
275268 extern int sysctl_tcp_challenge_ack_limit;
276−extern unsigned int sysctl_tcp_notsent_lowat;
277269 extern int sysctl_tcp_min_tso_segs;
278270 extern int sysctl_tcp_min_rtt_wlen;
279271 extern int sysctl_tcp_autocorking;
@@ -567,6 +559,7 @@ void tcp_rearm_rto(struct sock *sk); · 287 unmodified lines
567559 void tcp_synack_rtt_meas(struct sock *sk, struct request_sock *req);
568560 void tcp_reset(struct sock *sk);
569561 void tcp_skb_mark_lost_uncond_verify(struct tcp_sock *tp, struct sk_buff *skb);
562+void tcp_fin(struct sock *sk);
570563
571564 /* tcp_timer.c */
572565 void tcp_init_xmit_timers(struct sock *);
@@ -962,9 +955,11 @@ static inline void tcp_enable_fack(struct tcp_sock *tp) · 389 unmodified lines
962955 */
963956 static inline void tcp_enable_early_retrans(struct tcp_sock *tp)
964957 {
958+ struct net *net = sock_net((struct sock *)tp);
959+
965960 tp->do_early_retrans = sysctl_tcp_early_retrans &&
966961 sysctl_tcp_early_retrans < 4 && !sysctl_tcp_thin_dupack &&
967− sysctl_tcp_reordering == 3;
962+ net->ipv4.sysctl_tcp_reordering == 3;
968963 }
969964
970965 static inline void tcp_disable_early_retrans(struct tcp_sock *tp)
@@ -1251,7 +1246,7 @@ static inline u32 keepalive_time_elapsed(const struct tcp_sock *tp) · 280 unmodified lines
12511246
12521247 static inline int tcp_fin_time(const struct sock *sk)
12531248 {
1254− int fin_timeout = tcp_sk(sk)->linger2 ? : sysctl_tcp_fin_timeout;
1249+ int fin_timeout = tcp_sk(sk)->linger2 ? : sock_net(sk)->ipv4.sysctl_tcp_fin_timeout;
12551250 const int rto = inet_csk(sk)->icsk_rto;
12561251
12571252 if (fin_timeout < (rto << 2) - (rto >> 1))
@@ -1433,6 +1428,7 @@ void tcp_free_fastopen_req(struct tcp_sock *tp); · 175 unmodified lines
14331428
14341429 extern struct tcp_fastopen_context __rcu *tcp_fastopen_ctx;
14351430 int tcp_fastopen_reset_cipher(void *key, unsigned int len);
1431+void tcp_fastopen_add_skb(struct sock *sk, struct sk_buff *skb);
14361432 struct sock *tcp_try_fastopen(struct sock *sk, struct sk_buff *skb,
14371433 struct request_sock *req,
14381434 struct tcp_fastopen_cookie *foc,
@@ -1681,7 +1677,8 @@ void __tcp_v4_send_check(struct sk_buff *skb, __be32 saddr, __be32 daddr); · 242 unmodified lines
16811677
16821678 static inline u32 tcp_notsent_lowat(const struct tcp_sock *tp)
16831679 {
1684− return tp->notsent_lowat ?: sysctl_tcp_notsent_lowat;
1680+ struct net *net = sock_net((struct sock *)tp);
1681+ return tp->notsent_lowat ?: net->ipv4.sysctl_tcp_notsent_lowat;
16851682 }
16861683
16871684 static inline bool tcp_stream_memory_free(const struct sock *sk)
@@ -1815,4 +1812,38 @@ static inline void skb_set_tcp_pure_ack(struct sk_buff *skb) · 127 unmodified lines
18151812 skb->truesize = 2;
18161813 }
18171814
1815+static inline int tcp_inq(struct sock *sk)
1816+{
1817+ struct tcp_sock *tp = tcp_sk(sk);
1818+ int answ;
1819+
1820+ if ((1 << sk->sk_state) & (TCPF_SYN_SENT | TCPF_SYN_RECV)) {
1821+ answ = 0;
1822+ } else if (sock_flag(sk, SOCK_URGINLINE) ||
1823+ !tp->urg_data ||
1824+ before(tp->urg_seq, tp->copied_seq) ||
1825+ !before(tp->urg_seq, tp->rcv_nxt)) {
1826+
1827+ answ = tp->rcv_nxt - tp->copied_seq;
1828+
1829+ /* Subtract 1, if FIN was received */
1830+ if (answ && sock_flag(sk, SOCK_DONE))
1831+ answ--;
1832+ } else {
1833+ answ = tp->urg_seq - tp->copied_seq;
1834+ }
1835+
1836+ return answ;
1837+}
1838+
1839+static inline void tcp_segs_in(struct tcp_sock *tp, const struct sk_buff *skb)
1840+{
1841+ u16 segs_in;
1842+
1843+ segs_in = max_t(u16, 1, skb_shinfo(skb)->gso_segs);
1844+ tp->segs_in += segs_in;
1845+ if (skb->len > tcp_hdrlen(skb))
1846+ tp->data_segs_in += segs_in;
1847+}
1848+
18181849 #endif /* _TCP_H */
include/net/udp.h+2−1
@@ -177,9 +177,10 @@ static inline struct udphdr *udp_gro_udphdr(struct sk_buff *skb) · 176 unmodified lines
177177 }
178178
179179 /* hash routines shared between UDPv4/6 and UDP-Litev4/6 */
180−static inline void udp_lib_hash(struct sock *sk)
180+static inline int udp_lib_hash(struct sock *sk)
181181 {
182182 BUG();
183+ return 0;
183184 }
184185
185186 void udp_lib_unhash(struct sock *sk);
include/net/udp_tunnel.h+3−3
@@ -88,8 +88,8 @@ int udp_tunnel6_xmit_skb(struct dst_entry *dst, struct sock *sk, · 87 unmodified lines
8888 struct sk_buff *skb,
8989 struct net_device *dev, struct in6_addr *saddr,
9090 struct in6_addr *daddr,
91− __u8 prio, __u8 ttl, __be16 src_port,
92− __be16 dst_port, bool nocheck);
91+ __u8 prio, __u8 ttl, __be32 label,
92+ __be16 src_port, __be16 dst_port, bool nocheck);
9393 #endif
9494
9595 void udp_tunnel_sock_release(struct socket *sock);
@@ -103,7 +103,7 @@ static inline struct sk_buff *udp_tunnel_handle_offloads(struct sk_buff *skb, · 7 unmodified lines
103103 {
104104 int type = udp_csum ? SKB_GSO_UDP_TUNNEL_CSUM : SKB_GSO_UDP_TUNNEL;
105105
106− return iptunnel_handle_offloads(skb, udp_csum, type);
106+ return iptunnel_handle_offloads(skb, type);
107107 }
108108
109109 static inline void udp_tunnel_gro_complete(struct sk_buff *skb, int nhoff)
include/net/vxlan.h+135−52
@@ -9,17 +9,71 @@ · 8 unmodified lines
99 #include <linux/udp.h>
1010 #include <net/dst_metadata.h>
1111
12+/* VXLAN protocol (RFC 7348) header:
13+ * +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+
14+ * |R|R|R|R|I|R|R|R| Reserved |
15+ * +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+
16+ * | VXLAN Network Identifier (VNI) | Reserved |
17+ * +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+
18+ *
19+ * I = VXLAN Network Identifier (VNI) present.
20+ */
21+struct vxlanhdr {
22+ __be32 vx_flags;
23+ __be32 vx_vni;
24+};
25+
26+/* VXLAN header flags. */
27+#define VXLAN_HF_VNI cpu_to_be32(BIT(27))
28+
29+#define VXLAN_N_VID (1u << 24)
30+#define VXLAN_VID_MASK (VXLAN_N_VID - 1)
31+#define VXLAN_VNI_MASK cpu_to_be32(VXLAN_VID_MASK << 8)
32+#define VXLAN_HLEN (sizeof(struct udphdr) + sizeof(struct vxlanhdr))
33+
1234 #define VNI_HASH_BITS 10
1335 #define VNI_HASH_SIZE (1<<VNI_HASH_BITS)
36+#define FDB_HASH_BITS 8
37+#define FDB_HASH_SIZE (1<<FDB_HASH_BITS)
38+
39+/* Remote checksum offload for VXLAN (VXLAN_F_REMCSUM_[RT]X):
40+ * +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+
41+ * |R|R|R|R|I|R|R|R|R|R|C| Reserved |
42+ * +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+
43+ * | VXLAN Network Identifier (VNI) |O| Csum start |
44+ * +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+
45+ *
46+ * C = Remote checksum offload bit. When set indicates that the
47+ * remote checksum offload data is present.
48+ *
49+ * O = Offset bit. Indicates the checksum offset relative to
50+ * checksum start.
51+ *
52+ * Csum start = Checksum start divided by two.
53+ *
54+ * http://tools.ietf.org/html/draft-herbert-vxlan-rco
55+ */
56+
57+/* VXLAN-RCO header flags. */
58+#define VXLAN_HF_RCO cpu_to_be32(BIT(21))
59+
60+/* Remote checksum offload header option */
61+#define VXLAN_RCO_MASK cpu_to_be32(0x7f) /* Last byte of vni field */
62+#define VXLAN_RCO_UDP cpu_to_be32(0x80) /* Indicate UDP RCO (TCP when not set *) */
63+#define VXLAN_RCO_SHIFT 1 /* Left shift of start */
64+#define VXLAN_RCO_SHIFT_MASK ((1 << VXLAN_RCO_SHIFT) - 1)
65+#define VXLAN_MAX_REMCSUM_START (0x7f << VXLAN_RCO_SHIFT)
1466
1567 /*
16− * VXLAN Group Based Policy Extension:
68+ * VXLAN Group Based Policy Extension (VXLAN_F_GBP):
1769 * +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+
18− * |1|-|-|-|1|-|-|-|R|D|R|R|A|R|R|R| Group Policy ID |
70+ * |G|R|R|R|I|R|R|R|R|D|R|R|A|R|R|R| Group Policy ID |
1971 * +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+
2072 * | VXLAN Network Identifier (VNI) | Reserved |
2173 * +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+
2274 *
75+ * G = Group Policy ID present.
76+ *
2377 * D = Don't Learn bit. When set, this bit indicates that the egress
2478 * VTEP MUST NOT learn the source address of the encapsulated frame.
2579 *
@@ -27,18 +81,18 @@ · 1 unmodified line
2781 * this packet. Policies MUST NOT be applied by devices when the
2882 * A bit is set.
2983 *
30− * [0] https://tools.ietf.org/html/draft-smith-vxlan-group-policy
84+ * https://tools.ietf.org/html/draft-smith-vxlan-group-policy
3185 */
3286 struct vxlanhdr_gbp {
33− __u8 vx_flags;
87+ u8 vx_flags;
3488 #ifdef __LITTLE_ENDIAN_BITFIELD
35− __u8 reserved_flags1:3,
89+ u8 reserved_flags1:3,
3690 policy_applied:1,
3791 reserved_flags2:2,
3892 dont_learn:1,
3993 reserved_flags3:1;
4094 #elif defined(__BIG_ENDIAN_BITFIELD)
41− __u8 reserved_flags1:1,
95+ u8 reserved_flags1:1,
4296 dont_learn:1,
4397 reserved_flags2:2,
4498 policy_applied:1,
@@ -50,7 +104,10 @@ struct vxlanhdr_gbp { · 5 unmodified lines
50104 __be32 vx_vni;
51105 };
52106
53−#define VXLAN_GBP_USED_BITS (VXLAN_HF_GBP | 0xFFFFFF)
107+/* VXLAN-GBP header flags. */
108+#define VXLAN_HF_GBP cpu_to_be32(BIT(31))
109+
110+#define VXLAN_GBP_USED_BITS (VXLAN_HF_GBP | cpu_to_be32(0xFFFFFF))
54111
55112 /* skb->mark mapping
56113 *
@@ -62,44 +119,6 @@ struct vxlanhdr_gbp { · 5 unmodified lines
62119 #define VXLAN_GBP_POLICY_APPLIED (BIT(3) << 16)
63120 #define VXLAN_GBP_ID_MASK (0xFFFF)
64121
65−/* VXLAN protocol header:
66− * +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+
67− * |G|R|R|R|I|R|R|C| Reserved |
68− * +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+
69− * | VXLAN Network Identifier (VNI) | Reserved |
70− * +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+
71− *
72− * G = 1 Group Policy (VXLAN-GBP)
73− * I = 1 VXLAN Network Identifier (VNI) present
74− * C = 1 Remote checksum offload (RCO)
75− */
76−struct vxlanhdr {
77− __be32 vx_flags;
78− __be32 vx_vni;
79−};
80−
81−/* VXLAN header flags. */
82−#define VXLAN_HF_RCO BIT(21)
83−#define VXLAN_HF_VNI BIT(27)
84−#define VXLAN_HF_GBP BIT(31)
85−
86−/* Remote checksum offload header option */
87−#define VXLAN_RCO_MASK 0x7f /* Last byte of vni field */
88−#define VXLAN_RCO_UDP 0x80 /* Indicate UDP RCO (TCP when not set *) */
89−#define VXLAN_RCO_SHIFT 1 /* Left shift of start */
90−#define VXLAN_RCO_SHIFT_MASK ((1 << VXLAN_RCO_SHIFT) - 1)
91−#define VXLAN_MAX_REMCSUM_START (VXLAN_RCO_MASK << VXLAN_RCO_SHIFT)
92−
93−#define VXLAN_N_VID (1u << 24)
94−#define VXLAN_VID_MASK (VXLAN_N_VID - 1)
95−#define VXLAN_VNI_MASK (VXLAN_VID_MASK << 8)
96−#define VXLAN_HLEN (sizeof(struct udphdr) + sizeof(struct vxlanhdr))
97−
98−#define VNI_HASH_BITS 10
99−#define VNI_HASH_SIZE (1<<VNI_HASH_BITS)
100−#define FDB_HASH_BITS 8
101−#define FDB_HASH_SIZE (1<<FDB_HASH_BITS)
102−
103122 struct vxlan_metadata {
104123 u32 gbp;
105124 };
@@ -125,23 +144,25 @@ union vxlan_addr { · 19 unmodified lines
125144 struct vxlan_rdst {
126145 union vxlan_addr remote_ip;
127146 __be16 remote_port;
128− u32 remote_vni;
147+ __be32 remote_vni;
129148 u32 remote_ifindex;
130149 struct list_head list;
131150 struct rcu_head rcu;
151+ struct dst_cache dst_cache;
132152 };
133153
134154 struct vxlan_config {
135155 union vxlan_addr remote_ip;
136156 union vxlan_addr saddr;
137− u32 vni;
157+ __be32 vni;
138158 int remote_ifindex;
139159 int mtu;
140160 __be16 dst_port;
141− __u16 port_min;
142− __u16 port_max;
143− __u8 tos;
144− __u8 ttl;
161+ u16 port_min;
162+ u16 port_max;
163+ u8 tos;
164+ u8 ttl;
165+ __be32 label;
145166 u32 flags;
146167 unsigned long age_interval;
147168 unsigned int addrmax;
@@ -177,7 +198,7 @@ struct vxlan_dev { · 29 unmodified lines
177198 #define VXLAN_F_L2MISS 0x08
178199 #define VXLAN_F_L3MISS 0x10
179200 #define VXLAN_F_IPV6 0x20
180−#define VXLAN_F_UDP_CSUM 0x40
201+#define VXLAN_F_UDP_ZERO_CSUM_TX 0x40
181202 #define VXLAN_F_UDP_ZERO_CSUM6_TX 0x80
182203 #define VXLAN_F_UDP_ZERO_CSUM6_RX 0x100
183204 #define VXLAN_F_REMCSUM_TX 0x200
@@ -242,6 +263,68 @@ static inline netdev_features_t vxlan_features_check(struct sk_buff *skb, · 58 unmodified lines
242263 /* IPv6 header + UDP + VXLAN + Ethernet header */
243264 #define VXLAN6_HEADROOM (40 + 8 + 8 + 14)
244265
266+static inline struct vxlanhdr *vxlan_hdr(struct sk_buff *skb)
267+{
268+ return (struct vxlanhdr *)(udp_hdr(skb) + 1);
269+}
270+
271+static inline __be32 vxlan_vni(__be32 vni_field)
272+{
273+#if defined(__BIG_ENDIAN)
274+ return vni_field >> 8;
275+#else
276+ return (vni_field & VXLAN_VNI_MASK) << 8;
277+#endif
278+}
279+
280+static inline __be32 vxlan_vni_field(__be32 vni)
281+{
282+#if defined(__BIG_ENDIAN)
283+ return vni << 8;
284+#else
285+ return vni >> 8;
286+#endif
287+}
288+
289+static inline __be32 vxlan_tun_id_to_vni(__be64 tun_id)
290+{
291+#if defined(__BIG_ENDIAN)
292+ return tun_id;
293+#else
294+ return tun_id >> 32;
295+#endif
296+}
297+
298+static inline __be64 vxlan_vni_to_tun_id(__be32 vni)
299+{
300+#if defined(__BIG_ENDIAN)
301+ return (__be64)vni;
302+#else
303+ return (__be64)vni << 32;
304+#endif
305+}
306+
307+static inline size_t vxlan_rco_start(__be32 vni_field)
308+{
309+ return be32_to_cpu(vni_field & VXLAN_RCO_MASK) << VXLAN_RCO_SHIFT;
310+}
311+
312+static inline size_t vxlan_rco_offset(__be32 vni_field)
313+{
314+ return (vni_field & VXLAN_RCO_UDP) ?
315+ offsetof(struct udphdr, check) :
316+ offsetof(struct tcphdr, check);
317+}
318+
319+static inline __be32 vxlan_compute_rco(unsigned int start, unsigned int offset)
320+{
321+ __be32 vni_field = cpu_to_be32(start >> VXLAN_RCO_SHIFT);
322+
323+ if (offset == offsetof(struct udphdr, check))
324+ vni_field |= VXLAN_RCO_UDP;
325+ return vni_field;
326+}
327+
245328 #if IS_ENABLED(CONFIG_VXLAN)
246329 void vxlan_get_rx_port(struct net_device *netdev);
247330 #else