aboutsummaryrefslogtreecommitdiffstats
path: root/include
diff options
context:
space:
mode:
authorLinus Torvalds <torvalds@linux-foundation.org>2016-01-12 21:57:02 -0500
committerLinus Torvalds <torvalds@linux-foundation.org>2016-01-12 21:57:02 -0500
commitaee3bfa3307cd0da2126bdc0ea359dabea5ee8f7 (patch)
tree3d35c69e8fa835098bb90f77f30abed120681651 /include
parentc597b6bcd5c624534afc3df65cdc42bb05173bca (diff)
parent415b6f19e87e350b13585591859d4fdf50772229 (diff)
Merge git://git.kernel.org/pub/scm/linux/kernel/git/davem/net-next
Pull networking updates from Davic Miller: 1) Support busy polling generically, for all NAPI drivers. From Eric Dumazet. 2) Add byte/packet counter support to nft_ct, from Floriani Westphal. 3) Add RSS/XPS support to mvneta driver, from Gregory Clement. 4) Implement IPV6_HDRINCL socket option for raw sockets, from Hannes Frederic Sowa. 5) Add support for T6 adapter to cxgb4 driver, from Hariprasad Shenai. 6) Add support for VLAN device bridging to mlxsw switch driver, from Ido Schimmel. 7) Add driver for Netronome NFP4000/NFP6000, from Jakub Kicinski. 8) Provide hwmon interface to mlxsw switch driver, from Jiri Pirko. 9) Reorganize wireless drivers into per-vendor directories just like we do for ethernet drivers. From Kalle Valo. 10) Provide a way for administrators "destroy" connected sockets via the SOCK_DESTROY socket netlink diag operation. From Lorenzo Colitti. 11) Add support to add/remove multicast routes via netlink, from Nikolay Aleksandrov. 12) Make TCP keepalive settings per-namespace, from Nikolay Borisov. 13) Add forwarding and packet duplication facilities to nf_tables, from Pablo Neira Ayuso. 14) Dead route support in MPLS, from Roopa Prabhu. 15) TSO support for thunderx chips, from Sunil Goutham. 16) Add driver for IBM's System i/p VNIC protocol, from Thomas Falcon. 17) Rationalize, consolidate, and more completely document the checksum offloading facilities in the networking stack. From Tom Herbert. 18) Support aborting an ongoing scan in mac80211/cfg80211, from Vidyullatha Kanchanapally. 19) Use per-bucket spinlock for bpf hash facility, from Tom Leiming. * git://git.kernel.org/pub/scm/linux/kernel/git/davem/net-next: (1375 commits) net: bnxt: always return values from _bnxt_get_max_rings net: bpf: reject invalid shifts phonet: properly unshare skbs in phonet_rcv() dwc_eth_qos: Fix dma address for multi-fragment skbs phy: remove an unneeded condition mdio: remove an unneed condition mdio_bus: NULL dereference on allocation error net: Fix typo in netdev_intersect_features net: freescale: mac-fec: Fix build error from phy_device API change net: freescale: ucc_geth: Fix build error from phy_device API change bonding: Prevent IPv6 link local address on enslaved devices IB/mlx5: Add flow steering support net/mlx5_core: Export flow steering API net/mlx5_core: Make ipv4/ipv6 location more clear net/mlx5_core: Enable flow steering support for the IB driver net/mlx5_core: Initialize namespaces only when supported by device net/mlx5_core: Set priority attributes net/mlx5_core: Connect flow tables net/mlx5_core: Introduce modify flow table command net/mlx5_core: Managing root flow table ...
Diffstat (limited to 'include')
-rw-r--r--include/linux/brcmphy.h1
-rw-r--r--include/linux/cgroup-defs.h126
-rw-r--r--include/linux/cgroup.h66
-rw-r--r--include/linux/etherdevice.h3
-rw-r--r--include/linux/filter.h41
-rw-r--r--include/linux/hashtable.h4
-rw-r--r--include/linux/hdlc.h2
-rw-r--r--include/linux/if_pppox.h1
-rw-r--r--include/linux/if_team.h1
-rw-r--r--include/linux/if_vlan.h4
-rw-r--r--include/linux/inet_diag.h9
-rw-r--r--include/linux/kernfs.h12
-rw-r--r--include/linux/mdio.h78
-rw-r--r--include/linux/mlx4/driver.h5
-rw-r--r--include/linux/mlx5/device.h66
-rw-r--r--include/linux/mlx5/driver.h30
-rw-r--r--include/linux/mlx5/flow_table.h54
-rw-r--r--include/linux/mlx5/fs.h111
-rw-r--r--include/linux/mlx5/mlx5_ifc.h311
-rw-r--r--include/linux/mlx5/vport.h37
-rw-r--r--include/linux/mroute.h76
-rw-r--r--include/linux/netdev_features.h14
-rw-r--r--include/linux/netdevice.h282
-rw-r--r--include/linux/netfilter/nf_conntrack_sctp.h13
-rw-r--r--include/linux/netfilter/nfnetlink.h12
-rw-r--r--include/linux/netlink.h2
-rw-r--r--include/linux/pci_ids.h2
-rw-r--r--include/linux/phy.h80
-rw-r--r--include/linux/pim.h5
-rw-r--r--include/linux/platform_data/microread.h2
-rw-r--r--include/linux/qed/qed_if.h17
-rw-r--r--include/linux/rhashtable.h82
-rw-r--r--include/linux/rtnetlink.h5
-rw-r--r--include/linux/sched.h1
-rw-r--r--include/linux/sh_eth.h2
-rw-r--r--include/linux/skbuff.h171
-rw-r--r--include/linux/soc/ti/knav_dma.h22
-rw-r--r--include/linux/sock_diag.h2
-rw-r--r--include/linux/ssb/ssb.h10
-rw-r--r--include/linux/wait.h21
-rw-r--r--include/net/6lowpan.h10
-rw-r--r--include/net/addrconf.h3
-rw-r--r--include/net/bluetooth/bluetooth.h25
-rw-r--r--include/net/bluetooth/hci.h4
-rw-r--r--include/net/bluetooth/hci_core.h62
-rw-r--r--include/net/bluetooth/hci_mon.h2
-rw-r--r--include/net/bluetooth/hci_sock.h1
-rw-r--r--include/net/bluetooth/mgmt.h15
-rw-r--r--include/net/bonding.h39
-rw-r--r--include/net/busy_poll.h45
-rw-r--r--include/net/cfg80211.h10
-rw-r--r--include/net/checksum.h3
-rw-r--r--include/net/cls_cgroup.h11
-rw-r--r--include/net/dsa.h20
-rw-r--r--include/net/genetlink.h2
-rw-r--r--include/net/geneve.h8
-rw-r--r--include/net/ieee802154_netdev.h2
-rw-r--r--include/net/ila.h18
-rw-r--r--include/net/inet_frag.h1
-rw-r--r--include/net/inet_sock.h14
-rw-r--r--include/net/ip6_tunnel.h19
-rw-r--r--include/net/ip_fib.h3
-rw-r--r--include/net/ip_tunnels.h28
-rw-r--r--include/net/ipv6.h15
-rw-r--r--include/net/l3mdev.h23
-rw-r--r--include/net/mac80211.h56
-rw-r--r--include/net/net_namespace.h3
-rw-r--r--include/net/netfilter/ipv6/nf_defrag_ipv6.h3
-rw-r--r--include/net/netfilter/nf_conntrack_timeout.h2
-rw-r--r--include/net/netfilter/nf_dup_netdev.h6
-rw-r--r--include/net/netfilter/nf_tables.h45
-rw-r--r--include/net/netfilter/nf_tables_core.h10
-rw-r--r--include/net/netfilter/nft_meta.h3
-rw-r--r--include/net/netns/ipv4.h7
-rw-r--r--include/net/netns/sctp.h7
-rw-r--r--include/net/netprio_cgroup.h16
-rw-r--r--include/net/nfc/nfc.h1
-rw-r--r--include/net/protocol.h2
-rw-r--r--include/net/request_sock.h2
-rw-r--r--include/net/sch_generic.h9
-rw-r--r--include/net/sctp/sctp.h32
-rw-r--r--include/net/sctp/structs.h10
-rw-r--r--include/net/sock.h44
-rw-r--r--include/net/sock_reuseport.h28
-rw-r--r--include/net/switchdev.h15
-rw-r--r--include/net/tcp.h29
-rw-r--r--include/net/udp.h7
-rw-r--r--include/net/udp_tunnel.h8
-rw-r--r--include/net/vxlan.h2
-rw-r--r--include/trace/events/fib6.h76
-rw-r--r--include/uapi/asm-generic/socket.h3
-rw-r--r--include/uapi/linux/bpf.h27
-rw-r--r--include/uapi/linux/ethtool.h3
-rw-r--r--include/uapi/linux/if_link.h4
-rw-r--r--include/uapi/linux/ila.h22
-rw-r--r--include/uapi/linux/in6.h1
-rw-r--r--include/uapi/linux/mroute.h59
-rw-r--r--include/uapi/linux/netfilter/ipset/ip_set_bitmap.h2
-rw-r--r--include/uapi/linux/netfilter/ipset/ip_set_hash.h2
-rw-r--r--include/uapi/linux/netfilter/ipset/ip_set_list.h2
-rw-r--r--include/uapi/linux/netfilter/nf_conntrack_sctp.h12
-rw-r--r--include/uapi/linux/netfilter/nf_conntrack_tuple_common.h3
-rw-r--r--include/uapi/linux/netfilter/nf_tables.h91
-rw-r--r--include/uapi/linux/netfilter/nfnetlink.h2
-rw-r--r--include/uapi/linux/netfilter/xt_HMARK.h1
-rw-r--r--include/uapi/linux/netfilter/xt_RATEEST.h1
-rw-r--r--include/uapi/linux/netfilter/xt_TEE.h2
-rw-r--r--include/uapi/linux/netfilter/xt_TPROXY.h1
-rw-r--r--include/uapi/linux/netfilter/xt_cgroup.h15
-rw-r--r--include/uapi/linux/netfilter/xt_hashlimit.h1
-rw-r--r--include/uapi/linux/netfilter/xt_ipvs.h1
-rw-r--r--include/uapi/linux/netfilter/xt_mac.h2
-rw-r--r--include/uapi/linux/netfilter/xt_osf.h2
-rw-r--r--include/uapi/linux/netfilter/xt_physdev.h2
-rw-r--r--include/uapi/linux/netfilter/xt_policy.h2
-rw-r--r--include/uapi/linux/netfilter/xt_rateest.h1
-rw-r--r--include/uapi/linux/netfilter/xt_recent.h1
-rw-r--r--include/uapi/linux/netfilter/xt_sctp.h12
-rw-r--r--include/uapi/linux/netfilter_arp/arp_tables.h1
-rw-r--r--include/uapi/linux/netfilter_bridge.h1
-rw-r--r--include/uapi/linux/netfilter_bridge/ebt_arp.h1
-rw-r--r--include/uapi/linux/netfilter_bridge/ebt_arpreply.h2
-rw-r--r--include/uapi/linux/netfilter_bridge/ebt_ip6.h1
-rw-r--r--include/uapi/linux/netfilter_bridge/ebt_nat.h2
-rw-r--r--include/uapi/linux/netfilter_bridge/ebtables.h6
-rw-r--r--include/uapi/linux/netfilter_ipv4/ip_tables.h1
-rw-r--r--include/uapi/linux/netfilter_ipv6/ip6_tables.h1
-rw-r--r--include/uapi/linux/netfilter_ipv6/ip6t_rt.h2
-rw-r--r--include/uapi/linux/nl80211.h11
-rw-r--r--include/uapi/linux/pkt_sched.h4
-rw-r--r--include/uapi/linux/rtnetlink.h1
-rw-r--r--include/uapi/linux/sock_diag.h1
-rw-r--r--include/uapi/linux/sockios.h2
133 files changed, 2341 insertions, 562 deletions
diff --git a/include/linux/brcmphy.h b/include/linux/brcmphy.h
index 59f4a7304419..f0ba9c2ec639 100644
--- a/include/linux/brcmphy.h
+++ b/include/linux/brcmphy.h
@@ -26,6 +26,7 @@
26#define PHY_ID_BCM7366 0x600d8490 26#define PHY_ID_BCM7366 0x600d8490
27#define PHY_ID_BCM7425 0x600d86b0 27#define PHY_ID_BCM7425 0x600d86b0
28#define PHY_ID_BCM7429 0x600d8730 28#define PHY_ID_BCM7429 0x600d8730
29#define PHY_ID_BCM7435 0x600d8750
29#define PHY_ID_BCM7439 0x600d8480 30#define PHY_ID_BCM7439 0x600d8480
30#define PHY_ID_BCM7439_2 0xae025080 31#define PHY_ID_BCM7439_2 0xae025080
31#define PHY_ID_BCM7445 0x600d8510 32#define PHY_ID_BCM7445 0x600d8510
diff --git a/include/linux/cgroup-defs.h b/include/linux/cgroup-defs.h
index 06b77f9dd3f2..e5f4164cbd99 100644
--- a/include/linux/cgroup-defs.h
+++ b/include/linux/cgroup-defs.h
@@ -231,6 +231,14 @@ struct cgroup {
231 int id; 231 int id;
232 232
233 /* 233 /*
234 * The depth this cgroup is at. The root is at depth zero and each
235 * step down the hierarchy increments the level. This along with
236 * ancestor_ids[] can determine whether a given cgroup is a
237 * descendant of another without traversing the hierarchy.
238 */
239 int level;
240
241 /*
234 * Each non-empty css_set associated with this cgroup contributes 242 * Each non-empty css_set associated with this cgroup contributes
235 * one to populated_cnt. All children with non-zero popuplated_cnt 243 * one to populated_cnt. All children with non-zero popuplated_cnt
236 * of their own contribute one. The count is zero iff there's no 244 * of their own contribute one. The count is zero iff there's no
@@ -285,6 +293,9 @@ struct cgroup {
285 293
286 /* used to schedule release agent */ 294 /* used to schedule release agent */
287 struct work_struct release_agent_work; 295 struct work_struct release_agent_work;
296
297 /* ids of the ancestors at each level including self */
298 int ancestor_ids[];
288}; 299};
289 300
290/* 301/*
@@ -304,6 +315,9 @@ struct cgroup_root {
304 /* The root cgroup. Root is destroyed on its release. */ 315 /* The root cgroup. Root is destroyed on its release. */
305 struct cgroup cgrp; 316 struct cgroup cgrp;
306 317
318 /* for cgrp->ancestor_ids[0] */
319 int cgrp_ancestor_id_storage;
320
307 /* Number of cgroups in the hierarchy, used only for /proc/cgroups */ 321 /* Number of cgroups in the hierarchy, used only for /proc/cgroups */
308 atomic_t nr_cgrps; 322 atomic_t nr_cgrps;
309 323
@@ -521,4 +535,116 @@ static inline void cgroup_threadgroup_change_end(struct task_struct *tsk) {}
521 535
522#endif /* CONFIG_CGROUPS */ 536#endif /* CONFIG_CGROUPS */
523 537
538#ifdef CONFIG_SOCK_CGROUP_DATA
539
540/*
541 * sock_cgroup_data is embedded at sock->sk_cgrp_data and contains
542 * per-socket cgroup information except for memcg association.
543 *
544 * On legacy hierarchies, net_prio and net_cls controllers directly set
545 * attributes on each sock which can then be tested by the network layer.
546 * On the default hierarchy, each sock is associated with the cgroup it was
547 * created in and the networking layer can match the cgroup directly.
548 *
549 * To avoid carrying all three cgroup related fields separately in sock,
550 * sock_cgroup_data overloads (prioidx, classid) and the cgroup pointer.
551 * On boot, sock_cgroup_data records the cgroup that the sock was created
552 * in so that cgroup2 matches can be made; however, once either net_prio or
553 * net_cls starts being used, the area is overriden to carry prioidx and/or
554 * classid. The two modes are distinguished by whether the lowest bit is
555 * set. Clear bit indicates cgroup pointer while set bit prioidx and
556 * classid.
557 *
558 * While userland may start using net_prio or net_cls at any time, once
559 * either is used, cgroup2 matching no longer works. There is no reason to
560 * mix the two and this is in line with how legacy and v2 compatibility is
561 * handled. On mode switch, cgroup references which are already being
562 * pointed to by socks may be leaked. While this can be remedied by adding
563 * synchronization around sock_cgroup_data, given that the number of leaked
564 * cgroups is bound and highly unlikely to be high, this seems to be the
565 * better trade-off.
566 */
567struct sock_cgroup_data {
568 union {
569#ifdef __LITTLE_ENDIAN
570 struct {
571 u8 is_data;
572 u8 padding;
573 u16 prioidx;
574 u32 classid;
575 } __packed;
576#else
577 struct {
578 u32 classid;
579 u16 prioidx;
580 u8 padding;
581 u8 is_data;
582 } __packed;
583#endif
584 u64 val;
585 };
586};
587
588/*
589 * There's a theoretical window where the following accessors race with
590 * updaters and return part of the previous pointer as the prioidx or
591 * classid. Such races are short-lived and the result isn't critical.
592 */
593static inline u16 sock_cgroup_prioidx(struct sock_cgroup_data *skcd)
594{
595 /* fallback to 1 which is always the ID of the root cgroup */
596 return (skcd->is_data & 1) ? skcd->prioidx : 1;
597}
598
599static inline u32 sock_cgroup_classid(struct sock_cgroup_data *skcd)
600{
601 /* fallback to 0 which is the unconfigured default classid */
602 return (skcd->is_data & 1) ? skcd->classid : 0;
603}
604
605/*
606 * If invoked concurrently, the updaters may clobber each other. The
607 * caller is responsible for synchronization.
608 */
609static inline void sock_cgroup_set_prioidx(struct sock_cgroup_data *skcd,
610 u16 prioidx)
611{
612 struct sock_cgroup_data skcd_buf = {{ .val = READ_ONCE(skcd->val) }};
613
614 if (sock_cgroup_prioidx(&skcd_buf) == prioidx)
615 return;
616
617 if (!(skcd_buf.is_data & 1)) {
618 skcd_buf.val = 0;
619 skcd_buf.is_data = 1;
620 }
621
622 skcd_buf.prioidx = prioidx;
623 WRITE_ONCE(skcd->val, skcd_buf.val); /* see sock_cgroup_ptr() */
624}
625
626static inline void sock_cgroup_set_classid(struct sock_cgroup_data *skcd,
627 u32 classid)
628{
629 struct sock_cgroup_data skcd_buf = {{ .val = READ_ONCE(skcd->val) }};
630
631 if (sock_cgroup_classid(&skcd_buf) == classid)
632 return;
633
634 if (!(skcd_buf.is_data & 1)) {
635 skcd_buf.val = 0;
636 skcd_buf.is_data = 1;
637 }
638
639 skcd_buf.classid = classid;
640 WRITE_ONCE(skcd->val, skcd_buf.val); /* see sock_cgroup_ptr() */
641}
642
643#else /* CONFIG_SOCK_CGROUP_DATA */
644
645struct sock_cgroup_data {
646};
647
648#endif /* CONFIG_SOCK_CGROUP_DATA */
649
524#endif /* _LINUX_CGROUP_DEFS_H */ 650#endif /* _LINUX_CGROUP_DEFS_H */
diff --git a/include/linux/cgroup.h b/include/linux/cgroup.h
index cb91b44f5f78..322a28482745 100644
--- a/include/linux/cgroup.h
+++ b/include/linux/cgroup.h
@@ -81,7 +81,8 @@ struct cgroup_subsys_state *cgroup_get_e_css(struct cgroup *cgroup,
81struct cgroup_subsys_state *css_tryget_online_from_dir(struct dentry *dentry, 81struct cgroup_subsys_state *css_tryget_online_from_dir(struct dentry *dentry,
82 struct cgroup_subsys *ss); 82 struct cgroup_subsys *ss);
83 83
84bool cgroup_is_descendant(struct cgroup *cgrp, struct cgroup *ancestor); 84struct cgroup *cgroup_get_from_path(const char *path);
85
85int cgroup_attach_task_all(struct task_struct *from, struct task_struct *); 86int cgroup_attach_task_all(struct task_struct *from, struct task_struct *);
86int cgroup_transfer_tasks(struct cgroup *to, struct cgroup *from); 87int cgroup_transfer_tasks(struct cgroup *to, struct cgroup *from);
87 88
@@ -364,6 +365,11 @@ static inline void css_put_many(struct cgroup_subsys_state *css, unsigned int n)
364 percpu_ref_put_many(&css->refcnt, n); 365 percpu_ref_put_many(&css->refcnt, n);
365} 366}
366 367
368static inline void cgroup_put(struct cgroup *cgrp)
369{
370 css_put(&cgrp->self);
371}
372
367/** 373/**
368 * task_css_set_check - obtain a task's css_set with extra access conditions 374 * task_css_set_check - obtain a task's css_set with extra access conditions
369 * @task: the task to obtain css_set for 375 * @task: the task to obtain css_set for
@@ -471,6 +477,23 @@ static inline struct cgroup *task_cgroup(struct task_struct *task,
471 return task_css(task, subsys_id)->cgroup; 477 return task_css(task, subsys_id)->cgroup;
472} 478}
473 479
480/**
481 * cgroup_is_descendant - test ancestry
482 * @cgrp: the cgroup to be tested
483 * @ancestor: possible ancestor of @cgrp
484 *
485 * Test whether @cgrp is a descendant of @ancestor. It also returns %true
486 * if @cgrp == @ancestor. This function is safe to call as long as @cgrp
487 * and @ancestor are accessible.
488 */
489static inline bool cgroup_is_descendant(struct cgroup *cgrp,
490 struct cgroup *ancestor)
491{
492 if (cgrp->root != ancestor->root || cgrp->level < ancestor->level)
493 return false;
494 return cgrp->ancestor_ids[ancestor->level] == ancestor->id;
495}
496
474/* no synchronization, the result can only be used as a hint */ 497/* no synchronization, the result can only be used as a hint */
475static inline bool cgroup_is_populated(struct cgroup *cgrp) 498static inline bool cgroup_is_populated(struct cgroup *cgrp)
476{ 499{
@@ -554,4 +577,45 @@ static inline int cgroup_init(void) { return 0; }
554 577
555#endif /* !CONFIG_CGROUPS */ 578#endif /* !CONFIG_CGROUPS */
556 579
580/*
581 * sock->sk_cgrp_data handling. For more info, see sock_cgroup_data
582 * definition in cgroup-defs.h.
583 */
584#ifdef CONFIG_SOCK_CGROUP_DATA
585
586#if defined(CONFIG_CGROUP_NET_PRIO) || defined(CONFIG_CGROUP_NET_CLASSID)
587extern spinlock_t cgroup_sk_update_lock;
588#endif
589
590void cgroup_sk_alloc_disable(void);
591void cgroup_sk_alloc(struct sock_cgroup_data *skcd);
592void cgroup_sk_free(struct sock_cgroup_data *skcd);
593
594static inline struct cgroup *sock_cgroup_ptr(struct sock_cgroup_data *skcd)
595{
596#if defined(CONFIG_CGROUP_NET_PRIO) || defined(CONFIG_CGROUP_NET_CLASSID)
597 unsigned long v;
598
599 /*
600 * @skcd->val is 64bit but the following is safe on 32bit too as we
601 * just need the lower ulong to be written and read atomically.
602 */
603 v = READ_ONCE(skcd->val);
604
605 if (v & 1)
606 return &cgrp_dfl_root.cgrp;
607
608 return (struct cgroup *)(unsigned long)v ?: &cgrp_dfl_root.cgrp;
609#else
610 return (struct cgroup *)(unsigned long)skcd->val;
611#endif
612}
613
614#else /* CONFIG_CGROUP_DATA */
615
616static inline void cgroup_sk_alloc(struct sock_cgroup_data *skcd) {}
617static inline void cgroup_sk_free(struct sock_cgroup_data *skcd) {}
618
619#endif /* CONFIG_CGROUP_DATA */
620
557#endif /* _LINUX_CGROUP_H */ 621#endif /* _LINUX_CGROUP_H */
diff --git a/include/linux/etherdevice.h b/include/linux/etherdevice.h
index eb049c622208..37ff4a6faa9a 100644
--- a/include/linux/etherdevice.h
+++ b/include/linux/etherdevice.h
@@ -29,6 +29,9 @@
29#include <asm/bitsperlong.h> 29#include <asm/bitsperlong.h>
30 30
31#ifdef __KERNEL__ 31#ifdef __KERNEL__
32struct device;
33int eth_platform_get_mac_address(struct device *dev, u8 *mac_addr);
34unsigned char *arch_get_platform_get_mac_address(void);
32u32 eth_get_headlen(void *data, unsigned int max_len); 35u32 eth_get_headlen(void *data, unsigned int max_len);
33__be16 eth_type_trans(struct sk_buff *skb, struct net_device *dev); 36__be16 eth_type_trans(struct sk_buff *skb, struct net_device *dev);
34extern const struct header_ops eth_header_ops; 37extern const struct header_ops eth_header_ops;
diff --git a/include/linux/filter.h b/include/linux/filter.h
index 5972ffe5719a..43aa1f8855c7 100644
--- a/include/linux/filter.h
+++ b/include/linux/filter.h
@@ -350,25 +350,43 @@ struct sk_filter {
350 350
351#define BPF_PROG_RUN(filter, ctx) (*filter->bpf_func)(ctx, filter->insnsi) 351#define BPF_PROG_RUN(filter, ctx) (*filter->bpf_func)(ctx, filter->insnsi)
352 352
353#define BPF_SKB_CB_LEN QDISC_CB_PRIV_LEN
354
355static inline u8 *bpf_skb_cb(struct sk_buff *skb)
356{
357 /* eBPF programs may read/write skb->cb[] area to transfer meta
358 * data between tail calls. Since this also needs to work with
359 * tc, that scratch memory is mapped to qdisc_skb_cb's data area.
360 *
361 * In some socket filter cases, the cb unfortunately needs to be
362 * saved/restored so that protocol specific skb->cb[] data won't
363 * be lost. In any case, due to unpriviledged eBPF programs
364 * attached to sockets, we need to clear the bpf_skb_cb() area
365 * to not leak previous contents to user space.
366 */
367 BUILD_BUG_ON(FIELD_SIZEOF(struct __sk_buff, cb) != BPF_SKB_CB_LEN);
368 BUILD_BUG_ON(FIELD_SIZEOF(struct __sk_buff, cb) !=
369 FIELD_SIZEOF(struct qdisc_skb_cb, data));
370
371 return qdisc_skb_cb(skb)->data;
372}
373
353static inline u32 bpf_prog_run_save_cb(const struct bpf_prog *prog, 374static inline u32 bpf_prog_run_save_cb(const struct bpf_prog *prog,
354 struct sk_buff *skb) 375 struct sk_buff *skb)
355{ 376{
356 u8 *cb_data = qdisc_skb_cb(skb)->data; 377 u8 *cb_data = bpf_skb_cb(skb);
357 u8 saved_cb[QDISC_CB_PRIV_LEN]; 378 u8 cb_saved[BPF_SKB_CB_LEN];
358 u32 res; 379 u32 res;
359 380
360 BUILD_BUG_ON(FIELD_SIZEOF(struct __sk_buff, cb) !=
361 QDISC_CB_PRIV_LEN);
362
363 if (unlikely(prog->cb_access)) { 381 if (unlikely(prog->cb_access)) {
364 memcpy(saved_cb, cb_data, sizeof(saved_cb)); 382 memcpy(cb_saved, cb_data, sizeof(cb_saved));
365 memset(cb_data, 0, sizeof(saved_cb)); 383 memset(cb_data, 0, sizeof(cb_saved));
366 } 384 }
367 385
368 res = BPF_PROG_RUN(prog, skb); 386 res = BPF_PROG_RUN(prog, skb);
369 387
370 if (unlikely(prog->cb_access)) 388 if (unlikely(prog->cb_access))
371 memcpy(cb_data, saved_cb, sizeof(saved_cb)); 389 memcpy(cb_data, cb_saved, sizeof(cb_saved));
372 390
373 return res; 391 return res;
374} 392}
@@ -376,10 +394,11 @@ static inline u32 bpf_prog_run_save_cb(const struct bpf_prog *prog,
376static inline u32 bpf_prog_run_clear_cb(const struct bpf_prog *prog, 394static inline u32 bpf_prog_run_clear_cb(const struct bpf_prog *prog,
377 struct sk_buff *skb) 395 struct sk_buff *skb)
378{ 396{
379 u8 *cb_data = qdisc_skb_cb(skb)->data; 397 u8 *cb_data = bpf_skb_cb(skb);
380 398
381 if (unlikely(prog->cb_access)) 399 if (unlikely(prog->cb_access))
382 memset(cb_data, 0, QDISC_CB_PRIV_LEN); 400 memset(cb_data, 0, BPF_SKB_CB_LEN);
401
383 return BPF_PROG_RUN(prog, skb); 402 return BPF_PROG_RUN(prog, skb);
384} 403}
385 404
@@ -447,6 +466,8 @@ void bpf_prog_destroy(struct bpf_prog *fp);
447 466
448int sk_attach_filter(struct sock_fprog *fprog, struct sock *sk); 467int sk_attach_filter(struct sock_fprog *fprog, struct sock *sk);
449int sk_attach_bpf(u32 ufd, struct sock *sk); 468int sk_attach_bpf(u32 ufd, struct sock *sk);
469int sk_reuseport_attach_filter(struct sock_fprog *fprog, struct sock *sk);
470int sk_reuseport_attach_bpf(u32 ufd, struct sock *sk);
450int sk_detach_filter(struct sock *sk); 471int sk_detach_filter(struct sock *sk);
451int sk_get_filter(struct sock *sk, struct sock_filter __user *filter, 472int sk_get_filter(struct sock *sk, struct sock_filter __user *filter,
452 unsigned int len); 473 unsigned int len);
diff --git a/include/linux/hashtable.h b/include/linux/hashtable.h
index 519b6e2d769e..661e5c2a8e2a 100644
--- a/include/linux/hashtable.h
+++ b/include/linux/hashtable.h
@@ -16,6 +16,10 @@
16 struct hlist_head name[1 << (bits)] = \ 16 struct hlist_head name[1 << (bits)] = \
17 { [0 ... ((1 << (bits)) - 1)] = HLIST_HEAD_INIT } 17 { [0 ... ((1 << (bits)) - 1)] = HLIST_HEAD_INIT }
18 18
19#define DEFINE_READ_MOSTLY_HASHTABLE(name, bits) \
20 struct hlist_head name[1 << (bits)] __read_mostly = \
21 { [0 ... ((1 << (bits)) - 1)] = HLIST_HEAD_INIT }
22
19#define DECLARE_HASHTABLE(name, bits) \ 23#define DECLARE_HASHTABLE(name, bits) \
20 struct hlist_head name[1 << (bits)] 24 struct hlist_head name[1 << (bits)]
21 25
diff --git a/include/linux/hdlc.h b/include/linux/hdlc.h
index 1acb1445e05f..e31bcd4c7859 100644
--- a/include/linux/hdlc.h
+++ b/include/linux/hdlc.h
@@ -101,7 +101,7 @@ netdev_tx_t hdlc_start_xmit(struct sk_buff *skb, struct net_device *dev);
101int attach_hdlc_protocol(struct net_device *dev, struct hdlc_proto *proto, 101int attach_hdlc_protocol(struct net_device *dev, struct hdlc_proto *proto,
102 size_t size); 102 size_t size);
103/* May be used by hardware driver to gain control over HDLC device */ 103/* May be used by hardware driver to gain control over HDLC device */
104void detach_hdlc_protocol(struct net_device *dev); 104int detach_hdlc_protocol(struct net_device *dev);
105 105
106static __inline__ __be16 hdlc_type_trans(struct sk_buff *skb, 106static __inline__ __be16 hdlc_type_trans(struct sk_buff *skb,
107 struct net_device *dev) 107 struct net_device *dev)
diff --git a/include/linux/if_pppox.h b/include/linux/if_pppox.h
index b49cf923becc..ba7a9b0c7c57 100644
--- a/include/linux/if_pppox.h
+++ b/include/linux/if_pppox.h
@@ -91,7 +91,6 @@ enum {
91 PPPOX_CONNECTED = 1, /* connection established ==TCP_ESTABLISHED */ 91 PPPOX_CONNECTED = 1, /* connection established ==TCP_ESTABLISHED */
92 PPPOX_BOUND = 2, /* bound to ppp device */ 92 PPPOX_BOUND = 2, /* bound to ppp device */
93 PPPOX_RELAY = 4, /* forwarding is enabled */ 93 PPPOX_RELAY = 4, /* forwarding is enabled */
94 PPPOX_ZOMBIE = 8, /* dead, but still bound to ppp device */
95 PPPOX_DEAD = 16 /* dead, useless, please clean me up!*/ 94 PPPOX_DEAD = 16 /* dead, useless, please clean me up!*/
96}; 95};
97 96
diff --git a/include/linux/if_team.h b/include/linux/if_team.h
index a6aa970758a2..b84e49c3a738 100644
--- a/include/linux/if_team.h
+++ b/include/linux/if_team.h
@@ -164,6 +164,7 @@ struct team_mode {
164 size_t priv_size; 164 size_t priv_size;
165 size_t port_priv_size; 165 size_t port_priv_size;
166 const struct team_mode_ops *ops; 166 const struct team_mode_ops *ops;
167 enum netdev_lag_tx_type lag_tx_type;
167}; 168};
168 169
169#define TEAM_PORT_HASHBITS 4 170#define TEAM_PORT_HASHBITS 4
diff --git a/include/linux/if_vlan.h b/include/linux/if_vlan.h
index 67ce5bd3b56a..a5f6ce6b578c 100644
--- a/include/linux/if_vlan.h
+++ b/include/linux/if_vlan.h
@@ -73,7 +73,7 @@ static inline struct vlan_ethhdr *vlan_eth_hdr(const struct sk_buff *skb)
73/* found in socket.c */ 73/* found in socket.c */
74extern void vlan_ioctl_set(int (*hook)(struct net *, void __user *)); 74extern void vlan_ioctl_set(int (*hook)(struct net *, void __user *));
75 75
76static inline bool is_vlan_dev(struct net_device *dev) 76static inline bool is_vlan_dev(const struct net_device *dev)
77{ 77{
78 return dev->priv_flags & IFF_802_1Q_VLAN; 78 return dev->priv_flags & IFF_802_1Q_VLAN;
79} 79}
@@ -621,7 +621,7 @@ static inline netdev_features_t vlan_features_check(const struct sk_buff *skb,
621 NETIF_F_SG | 621 NETIF_F_SG |
622 NETIF_F_HIGHDMA | 622 NETIF_F_HIGHDMA |
623 NETIF_F_FRAGLIST | 623 NETIF_F_FRAGLIST |
624 NETIF_F_GEN_CSUM | 624 NETIF_F_HW_CSUM |
625 NETIF_F_HW_VLAN_CTAG_TX | 625 NETIF_F_HW_VLAN_CTAG_TX |
626 NETIF_F_HW_VLAN_STAG_TX); 626 NETIF_F_HW_VLAN_STAG_TX);
627 627
diff --git a/include/linux/inet_diag.h b/include/linux/inet_diag.h
index 0e707f0c1a3e..7c27fa1030e8 100644
--- a/include/linux/inet_diag.h
+++ b/include/linux/inet_diag.h
@@ -3,6 +3,7 @@
3 3
4#include <uapi/linux/inet_diag.h> 4#include <uapi/linux/inet_diag.h>
5 5
6struct net;
6struct sock; 7struct sock;
7struct inet_hashinfo; 8struct inet_hashinfo;
8struct nlattr; 9struct nlattr;
@@ -23,6 +24,10 @@ struct inet_diag_handler {
23 void (*idiag_get_info)(struct sock *sk, 24 void (*idiag_get_info)(struct sock *sk,
24 struct inet_diag_msg *r, 25 struct inet_diag_msg *r,
25 void *info); 26 void *info);
27
28 int (*destroy)(struct sk_buff *in_skb,
29 const struct inet_diag_req_v2 *req);
30
26 __u16 idiag_type; 31 __u16 idiag_type;
27 __u16 idiag_info_size; 32 __u16 idiag_info_size;
28}; 33};
@@ -41,6 +46,10 @@ int inet_diag_dump_one_icsk(struct inet_hashinfo *hashinfo,
41 struct sk_buff *in_skb, const struct nlmsghdr *nlh, 46 struct sk_buff *in_skb, const struct nlmsghdr *nlh,
42 const struct inet_diag_req_v2 *req); 47 const struct inet_diag_req_v2 *req);
43 48
49struct sock *inet_diag_find_one_icsk(struct net *net,
50 struct inet_hashinfo *hashinfo,
51 const struct inet_diag_req_v2 *req);
52
44int inet_diag_bc_sk(const struct nlattr *_bc, struct sock *sk); 53int inet_diag_bc_sk(const struct nlattr *_bc, struct sock *sk);
45 54
46extern int inet_diag_register(const struct inet_diag_handler *handler); 55extern int inet_diag_register(const struct inet_diag_handler *handler);
diff --git a/include/linux/kernfs.h b/include/linux/kernfs.h
index 5d4e9c4b821d..af51df35d749 100644
--- a/include/linux/kernfs.h
+++ b/include/linux/kernfs.h
@@ -274,6 +274,8 @@ void pr_cont_kernfs_path(struct kernfs_node *kn);
274struct kernfs_node *kernfs_get_parent(struct kernfs_node *kn); 274struct kernfs_node *kernfs_get_parent(struct kernfs_node *kn);
275struct kernfs_node *kernfs_find_and_get_ns(struct kernfs_node *parent, 275struct kernfs_node *kernfs_find_and_get_ns(struct kernfs_node *parent,
276 const char *name, const void *ns); 276 const char *name, const void *ns);
277struct kernfs_node *kernfs_walk_and_get_ns(struct kernfs_node *parent,
278 const char *path, const void *ns);
277void kernfs_get(struct kernfs_node *kn); 279void kernfs_get(struct kernfs_node *kn);
278void kernfs_put(struct kernfs_node *kn); 280void kernfs_put(struct kernfs_node *kn);
279 281
@@ -350,6 +352,10 @@ static inline struct kernfs_node *
350kernfs_find_and_get_ns(struct kernfs_node *parent, const char *name, 352kernfs_find_and_get_ns(struct kernfs_node *parent, const char *name,
351 const void *ns) 353 const void *ns)
352{ return NULL; } 354{ return NULL; }
355static inline struct kernfs_node *
356kernfs_walk_and_get_ns(struct kernfs_node *parent, const char *path,
357 const void *ns)
358{ return NULL; }
353 359
354static inline void kernfs_get(struct kernfs_node *kn) { } 360static inline void kernfs_get(struct kernfs_node *kn) { }
355static inline void kernfs_put(struct kernfs_node *kn) { } 361static inline void kernfs_put(struct kernfs_node *kn) { }
@@ -431,6 +437,12 @@ kernfs_find_and_get(struct kernfs_node *kn, const char *name)
431} 437}
432 438
433static inline struct kernfs_node * 439static inline struct kernfs_node *
440kernfs_walk_and_get(struct kernfs_node *kn, const char *path)
441{
442 return kernfs_walk_and_get_ns(kn, path, NULL);
443}
444
445static inline struct kernfs_node *
434kernfs_create_dir(struct kernfs_node *parent, const char *name, umode_t mode, 446kernfs_create_dir(struct kernfs_node *parent, const char *name, umode_t mode,
435 void *priv) 447 void *priv)
436{ 448{
diff --git a/include/linux/mdio.h b/include/linux/mdio.h
index b42963bc81dd..5bfd99d1a40a 100644
--- a/include/linux/mdio.h
+++ b/include/linux/mdio.h
@@ -11,6 +11,55 @@
11 11
12#include <uapi/linux/mdio.h> 12#include <uapi/linux/mdio.h>
13 13
14struct mii_bus;
15
16struct mdio_device {
17 struct device dev;
18
19 const struct dev_pm_ops *pm_ops;
20 struct mii_bus *bus;
21
22 int (*bus_match)(struct device *dev, struct device_driver *drv);
23 void (*device_free)(struct mdio_device *mdiodev);
24 void (*device_remove)(struct mdio_device *mdiodev);
25
26 /* Bus address of the MDIO device (0-31) */
27 int addr;
28 int flags;
29};
30#define to_mdio_device(d) container_of(d, struct mdio_device, dev)
31
32/* struct mdio_driver_common: Common to all MDIO drivers */
33struct mdio_driver_common {
34 struct device_driver driver;
35 int flags;
36};
37#define MDIO_DEVICE_FLAG_PHY 1
38#define to_mdio_common_driver(d) \
39 container_of(d, struct mdio_driver_common, driver)
40
41/* struct mdio_driver: Generic MDIO driver */
42struct mdio_driver {
43 struct mdio_driver_common mdiodrv;
44
45 /*
46 * Called during discovery. Used to set
47 * up device-specific structures, if any
48 */
49 int (*probe)(struct mdio_device *mdiodev);
50
51 /* Clears up any memory if needed */
52 void (*remove)(struct mdio_device *mdiodev);
53};
54#define to_mdio_driver(d) \
55 container_of(to_mdio_common_driver(d), struct mdio_driver, mdiodrv)
56
57void mdio_device_free(struct mdio_device *mdiodev);
58struct mdio_device *mdio_device_create(struct mii_bus *bus, int addr);
59int mdio_device_register(struct mdio_device *mdiodev);
60void mdio_device_remove(struct mdio_device *mdiodev);
61int mdio_driver_register(struct mdio_driver *drv);
62void mdio_driver_unregister(struct mdio_driver *drv);
14 63
15static inline bool mdio_phy_id_is_c45(int phy_id) 64static inline bool mdio_phy_id_is_c45(int phy_id)
16{ 65{
@@ -173,4 +222,33 @@ static inline u16 ethtool_adv_to_mmd_eee_adv_t(u32 adv)
173 return reg; 222 return reg;
174} 223}
175 224
225int mdiobus_read(struct mii_bus *bus, int addr, u32 regnum);
226int mdiobus_read_nested(struct mii_bus *bus, int addr, u32 regnum);
227int mdiobus_write(struct mii_bus *bus, int addr, u32 regnum, u16 val);
228int mdiobus_write_nested(struct mii_bus *bus, int addr, u32 regnum, u16 val);
229
230int mdiobus_register_device(struct mdio_device *mdiodev);
231int mdiobus_unregister_device(struct mdio_device *mdiodev);
232bool mdiobus_is_registered_device(struct mii_bus *bus, int addr);
233struct phy_device *mdiobus_get_phy(struct mii_bus *bus, int addr);
234
235/**
236 * module_mdio_driver() - Helper macro for registering mdio drivers
237 *
238 * Helper macro for MDIO drivers which do not do anything special in module
239 * init/exit. Each module may only use this macro once, and calling it
240 * replaces module_init() and module_exit().
241 */
242#define mdio_module_driver(_mdio_driver) \
243static int __init mdio_module_init(void) \
244{ \
245 return mdio_driver_register(&_mdio_driver); \
246} \
247module_init(mdio_module_init); \
248static void __exit mdio_module_exit(void) \
249{ \
250 mdio_driver_unregister(&_mdio_driver); \
251} \
252module_exit(mdio_module_exit)
253
176#endif /* __LINUX_MDIO_H__ */ 254#endif /* __LINUX_MDIO_H__ */
diff --git a/include/linux/mlx4/driver.h b/include/linux/mlx4/driver.h
index 5a06d969338e..2e8af001c5da 100644
--- a/include/linux/mlx4/driver.h
+++ b/include/linux/mlx4/driver.h
@@ -75,6 +75,11 @@ static inline int mlx4_is_bonded(struct mlx4_dev *dev)
75 return !!(dev->flags & MLX4_FLAG_BONDED); 75 return !!(dev->flags & MLX4_FLAG_BONDED);
76} 76}
77 77
78static inline int mlx4_is_mf_bonded(struct mlx4_dev *dev)
79{
80 return (mlx4_is_bonded(dev) && mlx4_is_mfunc(dev));
81}
82
78struct mlx4_port_map { 83struct mlx4_port_map {
79 u8 port1; 84 u8 port1;
80 u8 port2; 85 u8 port2;
diff --git a/include/linux/mlx5/device.h b/include/linux/mlx5/device.h
index 0b473cbfa7ef..7be845e30689 100644
--- a/include/linux/mlx5/device.h
+++ b/include/linux/mlx5/device.h
@@ -251,6 +251,7 @@ enum mlx5_event {
251 MLX5_EVENT_TYPE_PAGE_REQUEST = 0xb, 251 MLX5_EVENT_TYPE_PAGE_REQUEST = 0xb,
252 252
253 MLX5_EVENT_TYPE_PAGE_FAULT = 0xc, 253 MLX5_EVENT_TYPE_PAGE_FAULT = 0xc,
254 MLX5_EVENT_TYPE_NIC_VPORT_CHANGE = 0xd,
254}; 255};
255 256
256enum { 257enum {
@@ -442,9 +443,12 @@ struct mlx5_init_seg {
442 __be32 rsvd1[120]; 443 __be32 rsvd1[120];
443 __be32 initializing; 444 __be32 initializing;
444 struct health_buffer health; 445 struct health_buffer health;
445 __be32 rsvd2[884]; 446 __be32 rsvd2[880];
447 __be32 internal_timer_h;
448 __be32 internal_timer_l;
449 __be32 rsrv3[2];
446 __be32 health_counter; 450 __be32 health_counter;
447 __be32 rsvd3[1019]; 451 __be32 rsvd4[1019];
448 __be64 ieee1588_clk; 452 __be64 ieee1588_clk;
449 __be32 ieee1588_clk_type; 453 __be32 ieee1588_clk_type;
450 __be32 clr_intx; 454 __be32 clr_intx;
@@ -520,6 +524,12 @@ struct mlx5_eqe_page_fault {
520 __be32 flags_qpn; 524 __be32 flags_qpn;
521} __packed; 525} __packed;
522 526
527struct mlx5_eqe_vport_change {
528 u8 rsvd0[2];
529 __be16 vport_num;
530 __be32 rsvd1[6];
531} __packed;
532
523union ev_data { 533union ev_data {
524 __be32 raw[7]; 534 __be32 raw[7];
525 struct mlx5_eqe_cmd cmd; 535 struct mlx5_eqe_cmd cmd;
@@ -532,6 +542,7 @@ union ev_data {
532 struct mlx5_eqe_stall_vl stall_vl; 542 struct mlx5_eqe_stall_vl stall_vl;
533 struct mlx5_eqe_page_req req_pages; 543 struct mlx5_eqe_page_req req_pages;
534 struct mlx5_eqe_page_fault page_fault; 544 struct mlx5_eqe_page_fault page_fault;
545 struct mlx5_eqe_vport_change vport_change;
535} __packed; 546} __packed;
536 547
537struct mlx5_eqe { 548struct mlx5_eqe {
@@ -593,7 +604,8 @@ struct mlx5_cqe64 {
593 __be32 imm_inval_pkey; 604 __be32 imm_inval_pkey;
594 u8 rsvd40[4]; 605 u8 rsvd40[4];
595 __be32 byte_cnt; 606 __be32 byte_cnt;
596 __be64 timestamp; 607 __be32 timestamp_h;
608 __be32 timestamp_l;
597 __be32 sop_drop_qpn; 609 __be32 sop_drop_qpn;
598 __be16 wqe_counter; 610 __be16 wqe_counter;
599 u8 signature; 611 u8 signature;
@@ -615,6 +627,16 @@ static inline int cqe_has_vlan(struct mlx5_cqe64 *cqe)
615 return !!(cqe->l4_hdr_type_etc & 0x1); 627 return !!(cqe->l4_hdr_type_etc & 0x1);
616} 628}
617 629
630static inline u64 get_cqe_ts(struct mlx5_cqe64 *cqe)
631{
632 u32 hi, lo;
633
634 hi = be32_to_cpu(cqe->timestamp_h);
635 lo = be32_to_cpu(cqe->timestamp_l);
636
637 return (u64)lo | ((u64)hi << 32);
638}
639
618enum { 640enum {
619 CQE_L4_HDR_TYPE_NONE = 0x0, 641 CQE_L4_HDR_TYPE_NONE = 0x0,
620 CQE_L4_HDR_TYPE_TCP_NO_ACK = 0x1, 642 CQE_L4_HDR_TYPE_TCP_NO_ACK = 0x1,
@@ -1067,6 +1089,12 @@ enum {
1067}; 1089};
1068 1090
1069enum { 1091enum {
1092 MLX5_ESW_VPORT_ADMIN_STATE_DOWN = 0x0,
1093 MLX5_ESW_VPORT_ADMIN_STATE_UP = 0x1,
1094 MLX5_ESW_VPORT_ADMIN_STATE_AUTO = 0x2,
1095};
1096
1097enum {
1070 MLX5_L3_PROT_TYPE_IPV4 = 0, 1098 MLX5_L3_PROT_TYPE_IPV4 = 0,
1071 MLX5_L3_PROT_TYPE_IPV6 = 1, 1099 MLX5_L3_PROT_TYPE_IPV6 = 1,
1072}; 1100};
@@ -1102,6 +1130,12 @@ enum {
1102 MLX5_FLOW_CONTEXT_DEST_TYPE_TIR = 2, 1130 MLX5_FLOW_CONTEXT_DEST_TYPE_TIR = 2,
1103}; 1131};
1104 1132
1133enum mlx5_list_type {
1134 MLX5_NVPRT_LIST_TYPE_UC = 0x0,
1135 MLX5_NVPRT_LIST_TYPE_MC = 0x1,
1136 MLX5_NVPRT_LIST_TYPE_VLAN = 0x2,
1137};
1138
1105enum { 1139enum {
1106 MLX5_RQC_RQ_TYPE_MEMORY_RQ_INLINE = 0x0, 1140 MLX5_RQC_RQ_TYPE_MEMORY_RQ_INLINE = 0x0,
1107 MLX5_RQC_RQ_TYPE_MEMORY_RQ_RPM = 0x1, 1141 MLX5_RQC_RQ_TYPE_MEMORY_RQ_RPM = 0x1,
@@ -1124,6 +1158,8 @@ enum mlx5_cap_type {
1124 MLX5_CAP_IPOIB_OFFLOADS, 1158 MLX5_CAP_IPOIB_OFFLOADS,
1125 MLX5_CAP_EOIB_OFFLOADS, 1159 MLX5_CAP_EOIB_OFFLOADS,
1126 MLX5_CAP_FLOW_TABLE, 1160 MLX5_CAP_FLOW_TABLE,
1161 MLX5_CAP_ESWITCH_FLOW_TABLE,
1162 MLX5_CAP_ESWITCH,
1127 /* NUM OF CAP Types */ 1163 /* NUM OF CAP Types */
1128 MLX5_CAP_NUM 1164 MLX5_CAP_NUM
1129}; 1165};
@@ -1161,6 +1197,28 @@ enum mlx5_cap_type {
1161#define MLX5_CAP_FLOWTABLE_MAX(mdev, cap) \ 1197#define MLX5_CAP_FLOWTABLE_MAX(mdev, cap) \
1162 MLX5_GET(flow_table_nic_cap, mdev->hca_caps_max[MLX5_CAP_FLOW_TABLE], cap) 1198 MLX5_GET(flow_table_nic_cap, mdev->hca_caps_max[MLX5_CAP_FLOW_TABLE], cap)
1163 1199
1200#define MLX5_CAP_ESW_FLOWTABLE(mdev, cap) \
1201 MLX5_GET(flow_table_eswitch_cap, \
1202 mdev->hca_caps_cur[MLX5_CAP_ESWITCH_FLOW_TABLE], cap)
1203
1204#define MLX5_CAP_ESW_FLOWTABLE_MAX(mdev, cap) \
1205 MLX5_GET(flow_table_eswitch_cap, \
1206 mdev->hca_caps_max[MLX5_CAP_ESWITCH_FLOW_TABLE], cap)
1207
1208#define MLX5_CAP_ESW_FLOWTABLE_FDB(mdev, cap) \
1209 MLX5_CAP_ESW_FLOWTABLE(mdev, flow_table_properties_nic_esw_fdb.cap)
1210
1211#define MLX5_CAP_ESW_FLOWTABLE_FDB_MAX(mdev, cap) \
1212 MLX5_CAP_ESW_FLOWTABLE_MAX(mdev, flow_table_properties_nic_esw_fdb.cap)
1213
1214#define MLX5_CAP_ESW(mdev, cap) \
1215 MLX5_GET(e_switch_cap, \
1216 mdev->hca_caps_cur[MLX5_CAP_ESWITCH], cap)
1217
1218#define MLX5_CAP_ESW_MAX(mdev, cap) \
1219 MLX5_GET(e_switch_cap, \
1220 mdev->hca_caps_max[MLX5_CAP_ESWITCH], cap)
1221
1164#define MLX5_CAP_ODP(mdev, cap)\ 1222#define MLX5_CAP_ODP(mdev, cap)\
1165 MLX5_GET(odp_cap, mdev->hca_caps_cur[MLX5_CAP_ODP], cap) 1223 MLX5_GET(odp_cap, mdev->hca_caps_cur[MLX5_CAP_ODP], cap)
1166 1224
@@ -1200,4 +1258,6 @@ static inline u16 mlx5_to_sw_pkey_sz(int pkey_sz)
1200 return MLX5_MIN_PKEY_TABLE_SIZE << pkey_sz; 1258 return MLX5_MIN_PKEY_TABLE_SIZE << pkey_sz;
1201} 1259}
1202 1260
1261#define MLX5_BY_PASS_NUM_PRIOS 9
1262
1203#endif /* MLX5_DEVICE_H */ 1263#endif /* MLX5_DEVICE_H */
diff --git a/include/linux/mlx5/driver.h b/include/linux/mlx5/driver.h
index 5c857f2a20d7..2fd7019f69db 100644
--- a/include/linux/mlx5/driver.h
+++ b/include/linux/mlx5/driver.h
@@ -426,11 +426,23 @@ struct mlx5_mr_table {
426 struct radix_tree_root tree; 426 struct radix_tree_root tree;
427}; 427};
428 428
429struct mlx5_vf_context {
430 int enabled;
431};
432
433struct mlx5_core_sriov {
434 struct mlx5_vf_context *vfs_ctx;
435 int num_vfs;
436 int enabled_vfs;
437};
438
429struct mlx5_irq_info { 439struct mlx5_irq_info {
430 cpumask_var_t mask; 440 cpumask_var_t mask;
431 char name[MLX5_MAX_IRQ_NAME]; 441 char name[MLX5_MAX_IRQ_NAME];
432}; 442};
433 443
444struct mlx5_eswitch;
445
434struct mlx5_priv { 446struct mlx5_priv {
435 char name[MLX5_MAX_NAME_LEN]; 447 char name[MLX5_MAX_NAME_LEN];
436 struct mlx5_eq_table eq_table; 448 struct mlx5_eq_table eq_table;
@@ -447,6 +459,7 @@ struct mlx5_priv {
447 int fw_pages; 459 int fw_pages;
448 atomic_t reg_pages; 460 atomic_t reg_pages;
449 struct list_head free_list; 461 struct list_head free_list;
462 int vfs_pages;
450 463
451 struct mlx5_core_health health; 464 struct mlx5_core_health health;
452 465
@@ -485,6 +498,12 @@ struct mlx5_priv {
485 struct list_head dev_list; 498 struct list_head dev_list;
486 struct list_head ctx_list; 499 struct list_head ctx_list;
487 spinlock_t ctx_lock; 500 spinlock_t ctx_lock;
501
502 struct mlx5_eswitch *eswitch;
503 struct mlx5_core_sriov sriov;
504 unsigned long pci_dev_data;
505 struct mlx5_flow_root_namespace *root_ns;
506 struct mlx5_flow_root_namespace *fdb_root_ns;
488}; 507};
489 508
490enum mlx5_device_state { 509enum mlx5_device_state {
@@ -739,6 +758,8 @@ void mlx5_pagealloc_init(struct mlx5_core_dev *dev);
739void mlx5_pagealloc_cleanup(struct mlx5_core_dev *dev); 758void mlx5_pagealloc_cleanup(struct mlx5_core_dev *dev);
740int mlx5_pagealloc_start(struct mlx5_core_dev *dev); 759int mlx5_pagealloc_start(struct mlx5_core_dev *dev);
741void mlx5_pagealloc_stop(struct mlx5_core_dev *dev); 760void mlx5_pagealloc_stop(struct mlx5_core_dev *dev);
761int mlx5_sriov_init(struct mlx5_core_dev *dev);
762int mlx5_sriov_cleanup(struct mlx5_core_dev *dev);
742void mlx5_core_req_pages_handler(struct mlx5_core_dev *dev, u16 func_id, 763void mlx5_core_req_pages_handler(struct mlx5_core_dev *dev, u16 func_id,
743 s32 npages); 764 s32 npages);
744int mlx5_satisfy_startup_pages(struct mlx5_core_dev *dev, int boot); 765int mlx5_satisfy_startup_pages(struct mlx5_core_dev *dev, int boot);
@@ -884,6 +905,15 @@ struct mlx5_profile {
884 } mr_cache[MAX_MR_CACHE_ENTRIES]; 905 } mr_cache[MAX_MR_CACHE_ENTRIES];
885}; 906};
886 907
908enum {
909 MLX5_PCI_DEV_IS_VF = 1 << 0,
910};
911
912static inline int mlx5_core_is_pf(struct mlx5_core_dev *dev)
913{
914 return !(dev->priv.pci_dev_data & MLX5_PCI_DEV_IS_VF);
915}
916
887static inline int mlx5_get_gid_table_len(u16 param) 917static inline int mlx5_get_gid_table_len(u16 param)
888{ 918{
889 if (param > 4) { 919 if (param > 4) {
diff --git a/include/linux/mlx5/flow_table.h b/include/linux/mlx5/flow_table.h
deleted file mode 100644
index 5f922c6d4fc2..000000000000
--- a/include/linux/mlx5/flow_table.h
+++ /dev/null
@@ -1,54 +0,0 @@
1/*
2 * Copyright (c) 2013-2015, Mellanox Technologies, Ltd. All rights reserved.
3 *
4 * This software is available to you under a choice of one of two
5 * licenses. You may choose to be licensed under the terms of the GNU
6 * General Public License (GPL) Version 2, available from the file
7 * COPYING in the main directory of this source tree, or the
8 * OpenIB.org BSD license below:
9 *
10 * Redistribution and use in source and binary forms, with or
11 * without modification, are permitted provided that the following
12 * conditions are met:
13 *
14 * - Redistributions of source code must retain the above
15 * copyright notice, this list of conditions and the following
16 * disclaimer.
17 *
18 * - Redistributions in binary form must reproduce the above
19 * copyright notice, this list of conditions and the following
20 * disclaimer in the documentation and/or other materials
21 * provided with the distribution.
22 *
23 * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
24 * EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
25 * MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
26 * NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS
27 * BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN
28 * ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN
29 * CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
30 * SOFTWARE.
31 */
32
33#ifndef MLX5_FLOW_TABLE_H
34#define MLX5_FLOW_TABLE_H
35
36#include <linux/mlx5/driver.h>
37
38struct mlx5_flow_table_group {
39 u8 log_sz;
40 u8 match_criteria_enable;
41 u32 match_criteria[MLX5_ST_SZ_DW(fte_match_param)];
42};
43
44void *mlx5_create_flow_table(struct mlx5_core_dev *dev, u8 level, u8 table_type,
45 u16 num_groups,
46 struct mlx5_flow_table_group *group);
47void mlx5_destroy_flow_table(void *flow_table);
48int mlx5_add_flow_table_entry(void *flow_table, u8 match_criteria_enable,
49 void *match_criteria, void *flow_context,
50 u32 *flow_index);
51void mlx5_del_flow_table_entry(void *flow_table, u32 flow_index);
52u32 mlx5_get_flow_table_id(void *flow_table);
53
54#endif /* MLX5_FLOW_TABLE_H */
diff --git a/include/linux/mlx5/fs.h b/include/linux/mlx5/fs.h
new file mode 100644
index 000000000000..8230caa3fb6e
--- /dev/null
+++ b/include/linux/mlx5/fs.h
@@ -0,0 +1,111 @@
1/*
2 * Copyright (c) 2015, Mellanox Technologies. All rights reserved.
3 *
4 * This software is available to you under a choice of one of two
5 * licenses. You may choose to be licensed under the terms of the GNU
6 * General Public License (GPL) Version 2, available from the file
7 * COPYING in the main directory of this source tree, or the
8 * OpenIB.org BSD license below:
9 *
10 * Redistribution and use in source and binary forms, with or
11 * without modification, are permitted provided that the following
12 * conditions are met:
13 *
14 * - Redistributions of source code must retain the above
15 * copyright notice, this list of conditions and the following
16 * disclaimer.
17 *
18 * - Redistributions in binary form must reproduce the above
19 * copyright notice, this list of conditions and the following
20 * disclaimer in the documentation and/or other materials
21 * provided with the distribution.
22 *
23 * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
24 * EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
25 * MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
26 * NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS
27 * BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN
28 * ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN
29 * CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
30 * SOFTWARE.
31 */
32
33#ifndef _MLX5_FS_
34#define _MLX5_FS_
35
36#include <linux/mlx5/driver.h>
37#include <linux/mlx5/mlx5_ifc.h>
38
39#define MLX5_FS_DEFAULT_FLOW_TAG 0x0
40
41#define LEFTOVERS_RULE_NUM 2
42static inline void build_leftovers_ft_param(int *priority,
43 int *n_ent,
44 int *n_grp)
45{
46 *priority = 0; /* Priority of leftovers_prio-0 */
47 *n_ent = LEFTOVERS_RULE_NUM;
48 *n_grp = LEFTOVERS_RULE_NUM;
49}
50
51enum mlx5_flow_namespace_type {
52 MLX5_FLOW_NAMESPACE_BYPASS,
53 MLX5_FLOW_NAMESPACE_KERNEL,
54 MLX5_FLOW_NAMESPACE_LEFTOVERS,
55 MLX5_FLOW_NAMESPACE_FDB,
56};
57
58struct mlx5_flow_table;
59struct mlx5_flow_group;
60struct mlx5_flow_rule;
61struct mlx5_flow_namespace;
62
63struct mlx5_flow_destination {
64 enum mlx5_flow_destination_type type;
65 union {
66 u32 tir_num;
67 struct mlx5_flow_table *ft;
68 u32 vport_num;
69 };
70};
71
72struct mlx5_flow_namespace *
73mlx5_get_flow_namespace(struct mlx5_core_dev *dev,
74 enum mlx5_flow_namespace_type type);
75
76struct mlx5_flow_table *
77mlx5_create_auto_grouped_flow_table(struct mlx5_flow_namespace *ns,
78 int prio,
79 int num_flow_table_entries,
80 int max_num_groups);
81
82struct mlx5_flow_table *
83mlx5_create_flow_table(struct mlx5_flow_namespace *ns,
84 int prio,
85 int num_flow_table_entries);
86int mlx5_destroy_flow_table(struct mlx5_flow_table *ft);
87
88/* inbox should be set with the following values:
89 * start_flow_index
90 * end_flow_index
91 * match_criteria_enable
92 * match_criteria
93 */
94struct mlx5_flow_group *
95mlx5_create_flow_group(struct mlx5_flow_table *ft, u32 *in);
96void mlx5_destroy_flow_group(struct mlx5_flow_group *fg);
97
98/* Single destination per rule.
99 * Group ID is implied by the match criteria.
100 */
101struct mlx5_flow_rule *
102mlx5_add_flow_rule(struct mlx5_flow_table *ft,
103 u8 match_criteria_enable,
104 u32 *match_criteria,
105 u32 *match_value,
106 u32 action,
107 u32 flow_tag,
108 struct mlx5_flow_destination *dest);
109void mlx5_del_flow_rule(struct mlx5_flow_rule *fr);
110
111#endif
diff --git a/include/linux/mlx5/mlx5_ifc.h b/include/linux/mlx5/mlx5_ifc.h
index 1565324eb620..68d73f82e009 100644
--- a/include/linux/mlx5/mlx5_ifc.h
+++ b/include/linux/mlx5/mlx5_ifc.h
@@ -185,6 +185,7 @@ enum {
185 MLX5_CMD_OP_MODIFY_RQT = 0x917, 185 MLX5_CMD_OP_MODIFY_RQT = 0x917,
186 MLX5_CMD_OP_DESTROY_RQT = 0x918, 186 MLX5_CMD_OP_DESTROY_RQT = 0x918,
187 MLX5_CMD_OP_QUERY_RQT = 0x919, 187 MLX5_CMD_OP_QUERY_RQT = 0x919,
188 MLX5_CMD_OP_SET_FLOW_TABLE_ROOT = 0x92f,
188 MLX5_CMD_OP_CREATE_FLOW_TABLE = 0x930, 189 MLX5_CMD_OP_CREATE_FLOW_TABLE = 0x930,
189 MLX5_CMD_OP_DESTROY_FLOW_TABLE = 0x931, 190 MLX5_CMD_OP_DESTROY_FLOW_TABLE = 0x931,
190 MLX5_CMD_OP_QUERY_FLOW_TABLE = 0x932, 191 MLX5_CMD_OP_QUERY_FLOW_TABLE = 0x932,
@@ -193,7 +194,8 @@ enum {
193 MLX5_CMD_OP_QUERY_FLOW_GROUP = 0x935, 194 MLX5_CMD_OP_QUERY_FLOW_GROUP = 0x935,
194 MLX5_CMD_OP_SET_FLOW_TABLE_ENTRY = 0x936, 195 MLX5_CMD_OP_SET_FLOW_TABLE_ENTRY = 0x936,
195 MLX5_CMD_OP_QUERY_FLOW_TABLE_ENTRY = 0x937, 196 MLX5_CMD_OP_QUERY_FLOW_TABLE_ENTRY = 0x937,
196 MLX5_CMD_OP_DELETE_FLOW_TABLE_ENTRY = 0x938 197 MLX5_CMD_OP_DELETE_FLOW_TABLE_ENTRY = 0x938,
198 MLX5_CMD_OP_MODIFY_FLOW_TABLE = 0x93c
197}; 199};
198 200
199struct mlx5_ifc_flow_table_fields_supported_bits { 201struct mlx5_ifc_flow_table_fields_supported_bits {
@@ -256,25 +258,30 @@ struct mlx5_ifc_flow_table_fields_supported_bits {
256 258
257struct mlx5_ifc_flow_table_prop_layout_bits { 259struct mlx5_ifc_flow_table_prop_layout_bits {
258 u8 ft_support[0x1]; 260 u8 ft_support[0x1];
259 u8 reserved_0[0x1f]; 261 u8 reserved_0[0x2];
262 u8 flow_modify_en[0x1];
263 u8 modify_root[0x1];
264 u8 identified_miss_table_mode[0x1];
265 u8 flow_table_modify[0x1];
266 u8 reserved_1[0x19];
260 267
261 u8 reserved_1[0x2]; 268 u8 reserved_2[0x2];
262 u8 log_max_ft_size[0x6]; 269 u8 log_max_ft_size[0x6];
263 u8 reserved_2[0x10]; 270 u8 reserved_3[0x10];
264 u8 max_ft_level[0x8]; 271 u8 max_ft_level[0x8];
265 272
266 u8 reserved_3[0x20]; 273 u8 reserved_4[0x20];
267 274
268 u8 reserved_4[0x18]; 275 u8 reserved_5[0x18];
269 u8 log_max_ft_num[0x8]; 276 u8 log_max_ft_num[0x8];
270 277
271 u8 reserved_5[0x18]; 278 u8 reserved_6[0x18];
272 u8 log_max_destination[0x8]; 279 u8 log_max_destination[0x8];
273 280
274 u8 reserved_6[0x18]; 281 u8 reserved_7[0x18];
275 u8 log_max_flow[0x8]; 282 u8 log_max_flow[0x8];
276 283
277 u8 reserved_7[0x40]; 284 u8 reserved_8[0x40];
278 285
279 struct mlx5_ifc_flow_table_fields_supported_bits ft_field_support; 286 struct mlx5_ifc_flow_table_fields_supported_bits ft_field_support;
280 287
@@ -291,6 +298,22 @@ struct mlx5_ifc_odp_per_transport_service_cap_bits {
291 u8 reserved_1[0x1a]; 298 u8 reserved_1[0x1a];
292}; 299};
293 300
301struct mlx5_ifc_ipv4_layout_bits {
302 u8 reserved_0[0x60];
303
304 u8 ipv4[0x20];
305};
306
307struct mlx5_ifc_ipv6_layout_bits {
308 u8 ipv6[16][0x8];
309};
310
311union mlx5_ifc_ipv6_layout_ipv4_layout_auto_bits {
312 struct mlx5_ifc_ipv6_layout_bits ipv6_layout;
313 struct mlx5_ifc_ipv4_layout_bits ipv4_layout;
314 u8 reserved_0[0x80];
315};
316
294struct mlx5_ifc_fte_match_set_lyr_2_4_bits { 317struct mlx5_ifc_fte_match_set_lyr_2_4_bits {
295 u8 smac_47_16[0x20]; 318 u8 smac_47_16[0x20];
296 319
@@ -321,9 +344,9 @@ struct mlx5_ifc_fte_match_set_lyr_2_4_bits {
321 u8 udp_sport[0x10]; 344 u8 udp_sport[0x10];
322 u8 udp_dport[0x10]; 345 u8 udp_dport[0x10];
323 346
324 u8 src_ip[4][0x20]; 347 union mlx5_ifc_ipv6_layout_ipv4_layout_auto_bits src_ipv4_src_ipv6;
325 348
326 u8 dst_ip[4][0x20]; 349 union mlx5_ifc_ipv6_layout_ipv4_layout_auto_bits dst_ipv4_dst_ipv6;
327}; 350};
328 351
329struct mlx5_ifc_fte_match_set_misc_bits { 352struct mlx5_ifc_fte_match_set_misc_bits {
@@ -447,6 +470,29 @@ struct mlx5_ifc_flow_table_nic_cap_bits {
447 u8 reserved_3[0x7200]; 470 u8 reserved_3[0x7200];
448}; 471};
449 472
473struct mlx5_ifc_flow_table_eswitch_cap_bits {
474 u8 reserved_0[0x200];
475
476 struct mlx5_ifc_flow_table_prop_layout_bits flow_table_properties_nic_esw_fdb;
477
478 struct mlx5_ifc_flow_table_prop_layout_bits flow_table_properties_esw_acl_ingress;
479
480 struct mlx5_ifc_flow_table_prop_layout_bits flow_table_properties_esw_acl_egress;
481
482 u8 reserved_1[0x7800];
483};
484
485struct mlx5_ifc_e_switch_cap_bits {
486 u8 vport_svlan_strip[0x1];
487 u8 vport_cvlan_strip[0x1];
488 u8 vport_svlan_insert[0x1];
489 u8 vport_cvlan_insert_if_not_exist[0x1];
490 u8 vport_cvlan_insert_overwrite[0x1];
491 u8 reserved_0[0x1b];
492
493 u8 reserved_1[0x7e0];
494};
495
450struct mlx5_ifc_per_protocol_networking_offload_caps_bits { 496struct mlx5_ifc_per_protocol_networking_offload_caps_bits {
451 u8 csum_cap[0x1]; 497 u8 csum_cap[0x1];
452 u8 vlan_cap[0x1]; 498 u8 vlan_cap[0x1];
@@ -665,7 +711,9 @@ struct mlx5_ifc_cmd_hca_cap_bits {
665 u8 reserved_17[0x1]; 711 u8 reserved_17[0x1];
666 u8 ets[0x1]; 712 u8 ets[0x1];
667 u8 nic_flow_table[0x1]; 713 u8 nic_flow_table[0x1];
668 u8 reserved_18[0x4]; 714 u8 eswitch_flow_table[0x1];
715 u8 early_vf_enable;
716 u8 reserved_18[0x2];
669 u8 local_ca_ack_delay[0x5]; 717 u8 local_ca_ack_delay[0x5];
670 u8 reserved_19[0x6]; 718 u8 reserved_19[0x6];
671 u8 port_type[0x2]; 719 u8 port_type[0x2];
@@ -787,27 +835,36 @@ struct mlx5_ifc_cmd_hca_cap_bits {
787 u8 reserved_60[0x1b]; 835 u8 reserved_60[0x1b];
788 u8 log_max_wq_sz[0x5]; 836 u8 log_max_wq_sz[0x5];
789 837
790 u8 reserved_61[0xa0]; 838 u8 nic_vport_change_event[0x1];
791 839 u8 reserved_61[0xa];
840 u8 log_max_vlan_list[0x5];
792 u8 reserved_62[0x3]; 841 u8 reserved_62[0x3];
842 u8 log_max_current_mc_list[0x5];
843 u8 reserved_63[0x3];
844 u8 log_max_current_uc_list[0x5];
845
846 u8 reserved_64[0x80];
847
848 u8 reserved_65[0x3];
793 u8 log_max_l2_table[0x5]; 849 u8 log_max_l2_table[0x5];
794 u8 reserved_63[0x8]; 850 u8 reserved_66[0x8];
795 u8 log_uar_page_sz[0x10]; 851 u8 log_uar_page_sz[0x10];
796 852
797 u8 reserved_64[0x100]; 853 u8 reserved_67[0x40];
798 854 u8 device_frequency_khz[0x20];
799 u8 reserved_65[0x1f]; 855 u8 reserved_68[0x5f];
800 u8 cqe_zip[0x1]; 856 u8 cqe_zip[0x1];
801 857
802 u8 cqe_zip_timeout[0x10]; 858 u8 cqe_zip_timeout[0x10];
803 u8 cqe_zip_max_num[0x10]; 859 u8 cqe_zip_max_num[0x10];
804 860
805 u8 reserved_66[0x220]; 861 u8 reserved_69[0x220];
806}; 862};
807 863
808enum { 864enum mlx5_flow_destination_type {
809 MLX5_DEST_FORMAT_STRUCT_DESTINATION_TYPE_FLOW_TABLE_ = 0x1, 865 MLX5_FLOW_DESTINATION_TYPE_VPORT = 0x0,
810 MLX5_DEST_FORMAT_STRUCT_DESTINATION_TYPE_TIR = 0x2, 866 MLX5_FLOW_DESTINATION_TYPE_FLOW_TABLE = 0x1,
867 MLX5_FLOW_DESTINATION_TYPE_TIR = 0x2,
811}; 868};
812 869
813struct mlx5_ifc_dest_format_struct_bits { 870struct mlx5_ifc_dest_format_struct_bits {
@@ -900,6 +957,13 @@ struct mlx5_ifc_mac_address_layout_bits {
900 u8 mac_addr_31_0[0x20]; 957 u8 mac_addr_31_0[0x20];
901}; 958};
902 959
960struct mlx5_ifc_vlan_layout_bits {
961 u8 reserved_0[0x14];
962 u8 vlan[0x0c];
963
964 u8 reserved_1[0x20];
965};
966
903struct mlx5_ifc_cong_control_r_roce_ecn_np_bits { 967struct mlx5_ifc_cong_control_r_roce_ecn_np_bits {
904 u8 reserved_0[0xa0]; 968 u8 reserved_0[0xa0];
905 969
@@ -1829,6 +1893,8 @@ union mlx5_ifc_hca_cap_union_bits {
1829 struct mlx5_ifc_roce_cap_bits roce_cap; 1893 struct mlx5_ifc_roce_cap_bits roce_cap;
1830 struct mlx5_ifc_per_protocol_networking_offload_caps_bits per_protocol_networking_offload_caps; 1894 struct mlx5_ifc_per_protocol_networking_offload_caps_bits per_protocol_networking_offload_caps;
1831 struct mlx5_ifc_flow_table_nic_cap_bits flow_table_nic_cap; 1895 struct mlx5_ifc_flow_table_nic_cap_bits flow_table_nic_cap;
1896 struct mlx5_ifc_flow_table_eswitch_cap_bits flow_table_eswitch_cap;
1897 struct mlx5_ifc_e_switch_cap_bits e_switch_cap;
1832 u8 reserved_0[0x8000]; 1898 u8 reserved_0[0x8000];
1833}; 1899};
1834 1900
@@ -2133,24 +2199,35 @@ struct mlx5_ifc_rmpc_bits {
2133 struct mlx5_ifc_wq_bits wq; 2199 struct mlx5_ifc_wq_bits wq;
2134}; 2200};
2135 2201
2136enum {
2137 MLX5_NIC_VPORT_CONTEXT_ALLOWED_LIST_TYPE_CURRENT_UC_MAC_ADDRESS = 0x0,
2138};
2139
2140struct mlx5_ifc_nic_vport_context_bits { 2202struct mlx5_ifc_nic_vport_context_bits {
2141 u8 reserved_0[0x1f]; 2203 u8 reserved_0[0x1f];
2142 u8 roce_en[0x1]; 2204 u8 roce_en[0x1];
2143 2205
2144 u8 reserved_1[0x760]; 2206 u8 arm_change_event[0x1];
2207 u8 reserved_1[0x1a];
2208 u8 event_on_mtu[0x1];
2209 u8 event_on_promisc_change[0x1];
2210 u8 event_on_vlan_change[0x1];
2211 u8 event_on_mc_address_change[0x1];
2212 u8 event_on_uc_address_change[0x1];
2145 2213
2146 u8 reserved_2[0x5]; 2214 u8 reserved_2[0xf0];
2215
2216 u8 mtu[0x10];
2217
2218 u8 reserved_3[0x640];
2219
2220 u8 promisc_uc[0x1];
2221 u8 promisc_mc[0x1];
2222 u8 promisc_all[0x1];
2223 u8 reserved_4[0x2];
2147 u8 allowed_list_type[0x3]; 2224 u8 allowed_list_type[0x3];
2148 u8 reserved_3[0xc]; 2225 u8 reserved_5[0xc];
2149 u8 allowed_list_size[0xc]; 2226 u8 allowed_list_size[0xc];
2150 2227
2151 struct mlx5_ifc_mac_address_layout_bits permanent_address; 2228 struct mlx5_ifc_mac_address_layout_bits permanent_address;
2152 2229
2153 u8 reserved_4[0x20]; 2230 u8 reserved_6[0x20];
2154 2231
2155 u8 current_uc_mac_address[0][0x40]; 2232 u8 current_uc_mac_address[0][0x40];
2156}; 2233};
@@ -2263,6 +2340,26 @@ struct mlx5_ifc_hca_vport_context_bits {
2263 u8 reserved_6[0xca0]; 2340 u8 reserved_6[0xca0];
2264}; 2341};
2265 2342
2343struct mlx5_ifc_esw_vport_context_bits {
2344 u8 reserved_0[0x3];
2345 u8 vport_svlan_strip[0x1];
2346 u8 vport_cvlan_strip[0x1];
2347 u8 vport_svlan_insert[0x1];
2348 u8 vport_cvlan_insert[0x2];
2349 u8 reserved_1[0x18];
2350
2351 u8 reserved_2[0x20];
2352
2353 u8 svlan_cfi[0x1];
2354 u8 svlan_pcp[0x3];
2355 u8 svlan_id[0xc];
2356 u8 cvlan_cfi[0x1];
2357 u8 cvlan_pcp[0x3];
2358 u8 cvlan_id[0xc];
2359
2360 u8 reserved_3[0x7a0];
2361};
2362
2266enum { 2363enum {
2267 MLX5_EQC_STATUS_OK = 0x0, 2364 MLX5_EQC_STATUS_OK = 0x0,
2268 MLX5_EQC_STATUS_EQ_WRITE_FAILURE = 0xa, 2365 MLX5_EQC_STATUS_EQ_WRITE_FAILURE = 0xa,
@@ -2769,6 +2866,13 @@ struct mlx5_ifc_set_hca_cap_in_bits {
2769 union mlx5_ifc_hca_cap_union_bits capability; 2866 union mlx5_ifc_hca_cap_union_bits capability;
2770}; 2867};
2771 2868
2869enum {
2870 MLX5_SET_FTE_MODIFY_ENABLE_MASK_ACTION = 0x0,
2871 MLX5_SET_FTE_MODIFY_ENABLE_MASK_FLOW_TAG = 0x1,
2872 MLX5_SET_FTE_MODIFY_ENABLE_MASK_DESTINATION_LIST = 0x2,
2873 MLX5_SET_FTE_MODIFY_ENABLE_MASK_FLOW_COUNTERS = 0x3
2874};
2875
2772struct mlx5_ifc_set_fte_out_bits { 2876struct mlx5_ifc_set_fte_out_bits {
2773 u8 status[0x8]; 2877 u8 status[0x8];
2774 u8 reserved_0[0x18]; 2878 u8 reserved_0[0x18];
@@ -2793,11 +2897,14 @@ struct mlx5_ifc_set_fte_in_bits {
2793 u8 reserved_4[0x8]; 2897 u8 reserved_4[0x8];
2794 u8 table_id[0x18]; 2898 u8 table_id[0x18];
2795 2899
2796 u8 reserved_5[0x40]; 2900 u8 reserved_5[0x18];
2901 u8 modify_enable_mask[0x8];
2902
2903 u8 reserved_6[0x20];
2797 2904
2798 u8 flow_index[0x20]; 2905 u8 flow_index[0x20];
2799 2906
2800 u8 reserved_6[0xe0]; 2907 u8 reserved_7[0xe0];
2801 2908
2802 struct mlx5_ifc_flow_context_bits flow_context; 2909 struct mlx5_ifc_flow_context_bits flow_context;
2803}; 2910};
@@ -2940,6 +3047,7 @@ struct mlx5_ifc_query_vport_state_out_bits {
2940 3047
2941enum { 3048enum {
2942 MLX5_QUERY_VPORT_STATE_IN_OP_MOD_VNIC_VPORT = 0x0, 3049 MLX5_QUERY_VPORT_STATE_IN_OP_MOD_VNIC_VPORT = 0x0,
3050 MLX5_QUERY_VPORT_STATE_IN_OP_MOD_ESW_VPORT = 0x1,
2943}; 3051};
2944 3052
2945struct mlx5_ifc_query_vport_state_in_bits { 3053struct mlx5_ifc_query_vport_state_in_bits {
@@ -3700,6 +3808,64 @@ struct mlx5_ifc_query_flow_group_in_bits {
3700 u8 reserved_5[0x120]; 3808 u8 reserved_5[0x120];
3701}; 3809};
3702 3810
3811struct mlx5_ifc_query_esw_vport_context_out_bits {
3812 u8 status[0x8];
3813 u8 reserved_0[0x18];
3814
3815 u8 syndrome[0x20];
3816
3817 u8 reserved_1[0x40];
3818
3819 struct mlx5_ifc_esw_vport_context_bits esw_vport_context;
3820};
3821
3822struct mlx5_ifc_query_esw_vport_context_in_bits {
3823 u8 opcode[0x10];
3824 u8 reserved_0[0x10];
3825
3826 u8 reserved_1[0x10];
3827 u8 op_mod[0x10];
3828
3829 u8 other_vport[0x1];
3830 u8 reserved_2[0xf];
3831 u8 vport_number[0x10];
3832
3833 u8 reserved_3[0x20];
3834};
3835
3836struct mlx5_ifc_modify_esw_vport_context_out_bits {
3837 u8 status[0x8];
3838 u8 reserved_0[0x18];
3839
3840 u8 syndrome[0x20];
3841
3842 u8 reserved_1[0x40];
3843};
3844
3845struct mlx5_ifc_esw_vport_context_fields_select_bits {
3846 u8 reserved[0x1c];
3847 u8 vport_cvlan_insert[0x1];
3848 u8 vport_svlan_insert[0x1];
3849 u8 vport_cvlan_strip[0x1];
3850 u8 vport_svlan_strip[0x1];
3851};
3852
3853struct mlx5_ifc_modify_esw_vport_context_in_bits {
3854 u8 opcode[0x10];
3855 u8 reserved_0[0x10];
3856
3857 u8 reserved_1[0x10];
3858 u8 op_mod[0x10];
3859
3860 u8 other_vport[0x1];
3861 u8 reserved_2[0xf];
3862 u8 vport_number[0x10];
3863
3864 struct mlx5_ifc_esw_vport_context_fields_select_bits field_select;
3865
3866 struct mlx5_ifc_esw_vport_context_bits esw_vport_context;
3867};
3868
3703struct mlx5_ifc_query_eq_out_bits { 3869struct mlx5_ifc_query_eq_out_bits {
3704 u8 status[0x8]; 3870 u8 status[0x8];
3705 u8 reserved_0[0x18]; 3871 u8 reserved_0[0x18];
@@ -4228,7 +4394,10 @@ struct mlx5_ifc_modify_nic_vport_context_out_bits {
4228}; 4394};
4229 4395
4230struct mlx5_ifc_modify_nic_vport_field_select_bits { 4396struct mlx5_ifc_modify_nic_vport_field_select_bits {
4231 u8 reserved_0[0x1c]; 4397 u8 reserved_0[0x19];
4398 u8 mtu[0x1];
4399 u8 change_event[0x1];
4400 u8 promisc[0x1];
4232 u8 permanent_address[0x1]; 4401 u8 permanent_address[0x1];
4233 u8 addresses_list[0x1]; 4402 u8 addresses_list[0x1];
4234 u8 roce_en[0x1]; 4403 u8 roce_en[0x1];
@@ -5519,12 +5688,16 @@ struct mlx5_ifc_create_flow_table_in_bits {
5519 5688
5520 u8 reserved_4[0x20]; 5689 u8 reserved_4[0x20];
5521 5690
5522 u8 reserved_5[0x8]; 5691 u8 reserved_5[0x4];
5692 u8 table_miss_mode[0x4];
5523 u8 level[0x8]; 5693 u8 level[0x8];
5524 u8 reserved_6[0x8]; 5694 u8 reserved_6[0x8];
5525 u8 log_size[0x8]; 5695 u8 log_size[0x8];
5526 5696
5527 u8 reserved_7[0x120]; 5697 u8 reserved_7[0x8];
5698 u8 table_miss_id[0x18];
5699
5700 u8 reserved_8[0x100];
5528}; 5701};
5529 5702
5530struct mlx5_ifc_create_flow_group_out_bits { 5703struct mlx5_ifc_create_flow_group_out_bits {
@@ -6798,4 +6971,72 @@ union mlx5_ifc_uplink_pci_interface_document_bits {
6798 u8 reserved_0[0x20060]; 6971 u8 reserved_0[0x20060];
6799}; 6972};
6800 6973
6974struct mlx5_ifc_set_flow_table_root_out_bits {
6975 u8 status[0x8];
6976 u8 reserved_0[0x18];
6977
6978 u8 syndrome[0x20];
6979
6980 u8 reserved_1[0x40];
6981};
6982
6983struct mlx5_ifc_set_flow_table_root_in_bits {
6984 u8 opcode[0x10];
6985 u8 reserved_0[0x10];
6986
6987 u8 reserved_1[0x10];
6988 u8 op_mod[0x10];
6989
6990 u8 reserved_2[0x40];
6991
6992 u8 table_type[0x8];
6993 u8 reserved_3[0x18];
6994
6995 u8 reserved_4[0x8];
6996 u8 table_id[0x18];
6997
6998 u8 reserved_5[0x140];
6999};
7000
7001enum {
7002 MLX5_MODIFY_FLOW_TABLE_MISS_TABLE_ID = 0x1,
7003};
7004
7005struct mlx5_ifc_modify_flow_table_out_bits {
7006 u8 status[0x8];
7007 u8 reserved_0[0x18];
7008
7009 u8 syndrome[0x20];
7010
7011 u8 reserved_1[0x40];
7012};
7013
7014struct mlx5_ifc_modify_flow_table_in_bits {
7015 u8 opcode[0x10];
7016 u8 reserved_0[0x10];
7017
7018 u8 reserved_1[0x10];
7019 u8 op_mod[0x10];
7020
7021 u8 reserved_2[0x20];
7022
7023 u8 reserved_3[0x10];
7024 u8 modify_field_select[0x10];
7025
7026 u8 table_type[0x8];
7027 u8 reserved_4[0x18];
7028
7029 u8 reserved_5[0x8];
7030 u8 table_id[0x18];
7031
7032 u8 reserved_6[0x4];
7033 u8 table_miss_mode[0x4];
7034 u8 reserved_7[0x18];
7035
7036 u8 reserved_8[0x8];
7037 u8 table_miss_id[0x18];
7038
7039 u8 reserved_9[0x100];
7040};
7041
6801#endif /* MLX5_IFC_H */ 7042#endif /* MLX5_IFC_H */
diff --git a/include/linux/mlx5/vport.h b/include/linux/mlx5/vport.h
index 967e0fd06e89..638f2ca7a527 100644
--- a/include/linux/mlx5/vport.h
+++ b/include/linux/mlx5/vport.h
@@ -34,9 +34,17 @@
34#define __MLX5_VPORT_H__ 34#define __MLX5_VPORT_H__
35 35
36#include <linux/mlx5/driver.h> 36#include <linux/mlx5/driver.h>
37#include <linux/mlx5/device.h>
37 38
38u8 mlx5_query_vport_state(struct mlx5_core_dev *mdev, u8 opmod); 39u8 mlx5_query_vport_state(struct mlx5_core_dev *mdev, u8 opmod, u16 vport);
39void mlx5_query_nic_vport_mac_address(struct mlx5_core_dev *mdev, u8 *addr); 40u8 mlx5_query_vport_admin_state(struct mlx5_core_dev *mdev, u8 opmod,
41 u16 vport);
42int mlx5_modify_vport_admin_state(struct mlx5_core_dev *mdev, u8 opmod,
43 u16 vport, u8 state);
44int mlx5_query_nic_vport_mac_address(struct mlx5_core_dev *mdev,
45 u16 vport, u8 *addr);
46int mlx5_modify_nic_vport_mac_address(struct mlx5_core_dev *dev,
47 u16 vport, u8 *addr);
40int mlx5_query_hca_vport_gid(struct mlx5_core_dev *dev, u8 other_vport, 48int mlx5_query_hca_vport_gid(struct mlx5_core_dev *dev, u8 other_vport,
41 u8 port_num, u16 vf_num, u16 gid_index, 49 u8 port_num, u16 vf_num, u16 gid_index,
42 union ib_gid *gid); 50 union ib_gid *gid);
@@ -51,5 +59,30 @@ int mlx5_query_hca_vport_system_image_guid(struct mlx5_core_dev *dev,
51 u64 *sys_image_guid); 59 u64 *sys_image_guid);
52int mlx5_query_hca_vport_node_guid(struct mlx5_core_dev *dev, 60int mlx5_query_hca_vport_node_guid(struct mlx5_core_dev *dev,
53 u64 *node_guid); 61 u64 *node_guid);
62int mlx5_query_nic_vport_mac_list(struct mlx5_core_dev *dev,
63 u32 vport,
64 enum mlx5_list_type list_type,
65 u8 addr_list[][ETH_ALEN],
66 int *list_size);
67int mlx5_modify_nic_vport_mac_list(struct mlx5_core_dev *dev,
68 enum mlx5_list_type list_type,
69 u8 addr_list[][ETH_ALEN],
70 int list_size);
71int mlx5_query_nic_vport_promisc(struct mlx5_core_dev *mdev,
72 u32 vport,
73 int *promisc_uc,
74 int *promisc_mc,
75 int *promisc_all);
76int mlx5_modify_nic_vport_promisc(struct mlx5_core_dev *mdev,
77 int promisc_uc,
78 int promisc_mc,
79 int promisc_all);
80int mlx5_query_nic_vport_vlans(struct mlx5_core_dev *dev,
81 u32 vport,
82 u16 vlans[],
83 int *size);
84int mlx5_modify_nic_vport_vlans(struct mlx5_core_dev *dev,
85 u16 vlans[],
86 int list_size);
54 87
55#endif /* __MLX5_VPORT_H__ */ 88#endif /* __MLX5_VPORT_H__ */
diff --git a/include/linux/mroute.h b/include/linux/mroute.h
index 79aaa9fc1a15..bf9b322cb0b0 100644
--- a/include/linux/mroute.h
+++ b/include/linux/mroute.h
@@ -9,38 +9,28 @@
9#ifdef CONFIG_IP_MROUTE 9#ifdef CONFIG_IP_MROUTE
10static inline int ip_mroute_opt(int opt) 10static inline int ip_mroute_opt(int opt)
11{ 11{
12 return (opt >= MRT_BASE) && (opt <= MRT_MAX); 12 return opt >= MRT_BASE && opt <= MRT_MAX;
13} 13}
14#else
15static inline int ip_mroute_opt(int opt)
16{
17 return 0;
18}
19#endif
20 14
21#ifdef CONFIG_IP_MROUTE 15int ip_mroute_setsockopt(struct sock *, int, char __user *, unsigned int);
22extern int ip_mroute_setsockopt(struct sock *, int, char __user *, unsigned int); 16int ip_mroute_getsockopt(struct sock *, int, char __user *, int __user *);
23extern int ip_mroute_getsockopt(struct sock *, int, char __user *, int __user *); 17int ipmr_ioctl(struct sock *sk, int cmd, void __user *arg);
24extern int ipmr_ioctl(struct sock *sk, int cmd, void __user *arg); 18int ipmr_compat_ioctl(struct sock *sk, unsigned int cmd, void __user *arg);
25extern int ipmr_compat_ioctl(struct sock *sk, unsigned int cmd, void __user *arg); 19int ip_mr_init(void);
26extern int ip_mr_init(void);
27#else 20#else
28static inline 21static inline int ip_mroute_setsockopt(struct sock *sock, int optname,
29int ip_mroute_setsockopt(struct sock *sock, 22 char __user *optval, unsigned int optlen)
30 int optname, char __user *optval, unsigned int optlen)
31{ 23{
32 return -ENOPROTOOPT; 24 return -ENOPROTOOPT;
33} 25}
34 26
35static inline 27static inline int ip_mroute_getsockopt(struct sock *sock, int optname,
36int ip_mroute_getsockopt(struct sock *sock, 28 char __user *optval, int __user *optlen)
37 int optname, char __user *optval, int __user *optlen)
38{ 29{
39 return -ENOPROTOOPT; 30 return -ENOPROTOOPT;
40} 31}
41 32
42static inline 33static inline int ipmr_ioctl(struct sock *sk, int cmd, void __user *arg)
43int ipmr_ioctl(struct sock *sk, int cmd, void __user *arg)
44{ 34{
45 return -ENOIOCTLCMD; 35 return -ENOIOCTLCMD;
46} 36}
@@ -49,6 +39,11 @@ static inline int ip_mr_init(void)
49{ 39{
50 return 0; 40 return 0;
51} 41}
42
43static inline int ip_mroute_opt(int opt)
44{
45 return 0;
46}
52#endif 47#endif
53 48
54struct vif_device { 49struct vif_device {
@@ -64,6 +59,32 @@ struct vif_device {
64 59
65#define VIFF_STATIC 0x8000 60#define VIFF_STATIC 0x8000
66 61
62#define VIF_EXISTS(_mrt, _idx) ((_mrt)->vif_table[_idx].dev != NULL)
63#define MFC_LINES 64
64
65struct mr_table {
66 struct list_head list;
67 possible_net_t net;
68 u32 id;
69 struct sock __rcu *mroute_sk;
70 struct timer_list ipmr_expire_timer;
71 struct list_head mfc_unres_queue;
72 struct list_head mfc_cache_array[MFC_LINES];
73 struct vif_device vif_table[MAXVIFS];
74 int maxvif;
75 atomic_t cache_resolve_queue_len;
76 bool mroute_do_assert;
77 bool mroute_do_pim;
78 int mroute_reg_vif_num;
79};
80
81/* mfc_flags:
82 * MFC_STATIC - the entry was added statically (not by a routing daemon)
83 */
84enum {
85 MFC_STATIC = BIT(0),
86};
87
67struct mfc_cache { 88struct mfc_cache {
68 struct list_head list; 89 struct list_head list;
69 __be32 mfc_mcastgrp; /* Group the entry belongs to */ 90 __be32 mfc_mcastgrp; /* Group the entry belongs to */
@@ -89,19 +110,14 @@ struct mfc_cache {
89 struct rcu_head rcu; 110 struct rcu_head rcu;
90}; 111};
91 112
92#define MFC_STATIC 1
93#define MFC_NOTIFY 2
94
95#define MFC_LINES 64
96
97#ifdef __BIG_ENDIAN 113#ifdef __BIG_ENDIAN
98#define MFC_HASH(a,b) (((((__force u32)(__be32)a)>>24)^(((__force u32)(__be32)b)>>26))&(MFC_LINES-1)) 114#define MFC_HASH(a,b) (((((__force u32)(__be32)a)>>24)^(((__force u32)(__be32)b)>>26))&(MFC_LINES-1))
99#else 115#else
100#define MFC_HASH(a,b) ((((__force u32)(__be32)a)^(((__force u32)(__be32)b)>>2))&(MFC_LINES-1)) 116#define MFC_HASH(a,b) ((((__force u32)(__be32)a)^(((__force u32)(__be32)b)>>2))&(MFC_LINES-1))
101#endif 117#endif
102 118
103struct rtmsg; 119struct rtmsg;
104extern int ipmr_get_route(struct net *net, struct sk_buff *skb, 120int ipmr_get_route(struct net *net, struct sk_buff *skb,
105 __be32 saddr, __be32 daddr, 121 __be32 saddr, __be32 daddr,
106 struct rtmsg *rtm, int nowait); 122 struct rtmsg *rtm, int nowait);
107#endif 123#endif
diff --git a/include/linux/netdev_features.h b/include/linux/netdev_features.h
index f0d87347df19..d9654f0eecb3 100644
--- a/include/linux/netdev_features.h
+++ b/include/linux/netdev_features.h
@@ -52,7 +52,7 @@ enum {
52 NETIF_F_GSO_TUNNEL_REMCSUM_BIT, 52 NETIF_F_GSO_TUNNEL_REMCSUM_BIT,
53 53
54 NETIF_F_FCOE_CRC_BIT, /* FCoE CRC32 */ 54 NETIF_F_FCOE_CRC_BIT, /* FCoE CRC32 */
55 NETIF_F_SCTP_CSUM_BIT, /* SCTP checksum offload */ 55 NETIF_F_SCTP_CRC_BIT, /* SCTP checksum offload */
56 NETIF_F_FCOE_MTU_BIT, /* Supports max FCoE MTU, 2158 bytes*/ 56 NETIF_F_FCOE_MTU_BIT, /* Supports max FCoE MTU, 2158 bytes*/
57 NETIF_F_NTUPLE_BIT, /* N-tuple filters supported */ 57 NETIF_F_NTUPLE_BIT, /* N-tuple filters supported */
58 NETIF_F_RXHASH_BIT, /* Receive hashing offload */ 58 NETIF_F_RXHASH_BIT, /* Receive hashing offload */
@@ -103,7 +103,7 @@ enum {
103#define NETIF_F_NTUPLE __NETIF_F(NTUPLE) 103#define NETIF_F_NTUPLE __NETIF_F(NTUPLE)
104#define NETIF_F_RXCSUM __NETIF_F(RXCSUM) 104#define NETIF_F_RXCSUM __NETIF_F(RXCSUM)
105#define NETIF_F_RXHASH __NETIF_F(RXHASH) 105#define NETIF_F_RXHASH __NETIF_F(RXHASH)
106#define NETIF_F_SCTP_CSUM __NETIF_F(SCTP_CSUM) 106#define NETIF_F_SCTP_CRC __NETIF_F(SCTP_CRC)
107#define NETIF_F_SG __NETIF_F(SG) 107#define NETIF_F_SG __NETIF_F(SG)
108#define NETIF_F_TSO6 __NETIF_F(TSO6) 108#define NETIF_F_TSO6 __NETIF_F(TSO6)
109#define NETIF_F_TSO_ECN __NETIF_F(TSO_ECN) 109#define NETIF_F_TSO_ECN __NETIF_F(TSO_ECN)
@@ -146,10 +146,12 @@ enum {
146#define NETIF_F_GSO_SOFTWARE (NETIF_F_TSO | NETIF_F_TSO_ECN | \ 146#define NETIF_F_GSO_SOFTWARE (NETIF_F_TSO | NETIF_F_TSO_ECN | \
147 NETIF_F_TSO6 | NETIF_F_UFO) 147 NETIF_F_TSO6 | NETIF_F_UFO)
148 148
149#define NETIF_F_GEN_CSUM NETIF_F_HW_CSUM 149/* List of IP checksum features. Note that NETIF_F_ HW_CSUM should not be
150#define NETIF_F_V4_CSUM (NETIF_F_GEN_CSUM | NETIF_F_IP_CSUM) 150 * set in features when NETIF_F_IP_CSUM or NETIF_F_IPV6_CSUM are set--
151#define NETIF_F_V6_CSUM (NETIF_F_GEN_CSUM | NETIF_F_IPV6_CSUM) 151 * this would be contradictory
152#define NETIF_F_ALL_CSUM (NETIF_F_V4_CSUM | NETIF_F_V6_CSUM) 152 */
153#define NETIF_F_CSUM_MASK (NETIF_F_IP_CSUM | NETIF_F_IPV6_CSUM | \
154 NETIF_F_HW_CSUM)
153 155
154#define NETIF_F_ALL_TSO (NETIF_F_TSO | NETIF_F_TSO6 | NETIF_F_TSO_ECN) 156#define NETIF_F_ALL_TSO (NETIF_F_TSO | NETIF_F_TSO6 | NETIF_F_TSO_ECN)
155 157
diff --git a/include/linux/netdevice.h b/include/linux/netdevice.h
index 3143c847bddb..5ac140dcb789 100644
--- a/include/linux/netdevice.h
+++ b/include/linux/netdevice.h
@@ -132,7 +132,9 @@ static inline bool dev_xmit_complete(int rc)
132 * used. 132 * used.
133 */ 133 */
134 134
135#if defined(CONFIG_WLAN) || IS_ENABLED(CONFIG_AX25) 135#if defined(CONFIG_HYPERV_NET)
136# define LL_MAX_HEADER 128
137#elif defined(CONFIG_WLAN) || IS_ENABLED(CONFIG_AX25)
136# if defined(CONFIG_MAC80211_MESH) 138# if defined(CONFIG_MAC80211_MESH)
137# define LL_MAX_HEADER 128 139# define LL_MAX_HEADER 128
138# else 140# else
@@ -326,7 +328,8 @@ enum {
326 NAPI_STATE_SCHED, /* Poll is scheduled */ 328 NAPI_STATE_SCHED, /* Poll is scheduled */
327 NAPI_STATE_DISABLE, /* Disable pending */ 329 NAPI_STATE_DISABLE, /* Disable pending */
328 NAPI_STATE_NPSVC, /* Netpoll - don't dequeue from poll_list */ 330 NAPI_STATE_NPSVC, /* Netpoll - don't dequeue from poll_list */
329 NAPI_STATE_HASHED, /* In NAPI hash */ 331 NAPI_STATE_HASHED, /* In NAPI hash (busy polling possible) */
332 NAPI_STATE_NO_BUSY_POLL,/* Do not add in napi_hash, no busy polling */
330}; 333};
331 334
332enum gro_result { 335enum gro_result {
@@ -461,19 +464,13 @@ static inline void napi_complete(struct napi_struct *n)
461} 464}
462 465
463/** 466/**
464 * napi_by_id - lookup a NAPI by napi_id
465 * @napi_id: hashed napi_id
466 *
467 * lookup @napi_id in napi_hash table
468 * must be called under rcu_read_lock()
469 */
470struct napi_struct *napi_by_id(unsigned int napi_id);
471
472/**
473 * napi_hash_add - add a NAPI to global hashtable 467 * napi_hash_add - add a NAPI to global hashtable
474 * @napi: napi context 468 * @napi: napi context
475 * 469 *
476 * generate a new napi_id and store a @napi under it in napi_hash 470 * generate a new napi_id and store a @napi under it in napi_hash
471 * Used for busy polling (CONFIG_NET_RX_BUSY_POLL)
472 * Note: This is normally automatically done from netif_napi_add(),
473 * so might disappear in a future linux version.
477 */ 474 */
478void napi_hash_add(struct napi_struct *napi); 475void napi_hash_add(struct napi_struct *napi);
479 476
@@ -482,9 +479,14 @@ void napi_hash_add(struct napi_struct *napi);
482 * @napi: napi context 479 * @napi: napi context
483 * 480 *
484 * Warning: caller must observe rcu grace period 481 * Warning: caller must observe rcu grace period
485 * before freeing memory containing @napi 482 * before freeing memory containing @napi, if
483 * this function returns true.
484 * Note: core networking stack automatically calls it
485 * from netif_napi_del()
486 * Drivers might want to call this helper to combine all
487 * the needed rcu grace periods into a single one.
486 */ 488 */
487void napi_hash_del(struct napi_struct *napi); 489bool napi_hash_del(struct napi_struct *napi);
488 490
489/** 491/**
490 * napi_disable - prevent NAPI from scheduling 492 * napi_disable - prevent NAPI from scheduling
@@ -810,6 +812,12 @@ typedef u16 (*select_queue_fallback_t)(struct net_device *dev,
810 * (can also return NETDEV_TX_LOCKED iff NETIF_F_LLTX) 812 * (can also return NETDEV_TX_LOCKED iff NETIF_F_LLTX)
811 * Required can not be NULL. 813 * Required can not be NULL.
812 * 814 *
815 * netdev_features_t (*ndo_fix_features)(struct net_device *dev,
816 * netdev_features_t features);
817 * Adjusts the requested feature flags according to device-specific
818 * constraints, and returns the resulting flags. Must not modify
819 * the device state.
820 *
813 * u16 (*ndo_select_queue)(struct net_device *dev, struct sk_buff *skb, 821 * u16 (*ndo_select_queue)(struct net_device *dev, struct sk_buff *skb,
814 * void *accel_priv, select_queue_fallback_t fallback); 822 * void *accel_priv, select_queue_fallback_t fallback);
815 * Called to decide which queue to when device supports multiple 823 * Called to decide which queue to when device supports multiple
@@ -957,12 +965,6 @@ typedef u16 (*select_queue_fallback_t)(struct net_device *dev,
957 * Called to release previously enslaved netdev. 965 * Called to release previously enslaved netdev.
958 * 966 *
959 * Feature/offload setting functions. 967 * Feature/offload setting functions.
960 * netdev_features_t (*ndo_fix_features)(struct net_device *dev,
961 * netdev_features_t features);
962 * Adjusts the requested feature flags according to device-specific
963 * constraints, and returns the resulting flags. Must not modify
964 * the device state.
965 *
966 * int (*ndo_set_features)(struct net_device *dev, netdev_features_t features); 968 * int (*ndo_set_features)(struct net_device *dev, netdev_features_t features);
967 * Called to update device configuration to new features. Passed 969 * Called to update device configuration to new features. Passed
968 * feature set might be less than what was returned by ndo_fix_features()). 970 * feature set might be less than what was returned by ndo_fix_features()).
@@ -1011,6 +1013,19 @@ typedef u16 (*select_queue_fallback_t)(struct net_device *dev,
1011 * a new port starts listening. The operation is protected by the 1013 * a new port starts listening. The operation is protected by the
1012 * vxlan_net->sock_lock. 1014 * vxlan_net->sock_lock.
1013 * 1015 *
1016 * void (*ndo_add_geneve_port)(struct net_device *dev,
1017 * sa_family_t sa_family, __be16 port);
1018 * Called by geneve to notify a driver about the UDP port and socket
1019 * address family that geneve is listnening to. It is called only when
1020 * a new port starts listening. The operation is protected by the
1021 * geneve_net->sock_lock.
1022 *
1023 * void (*ndo_del_geneve_port)(struct net_device *dev,
1024 * sa_family_t sa_family, __be16 port);
1025 * Called by geneve to notify the driver about a UDP port and socket
1026 * address family that geneve is not listening to anymore. The operation
1027 * is protected by the geneve_net->sock_lock.
1028 *
1014 * void (*ndo_del_vxlan_port)(struct net_device *dev, 1029 * void (*ndo_del_vxlan_port)(struct net_device *dev,
1015 * sa_family_t sa_family, __be16 port); 1030 * sa_family_t sa_family, __be16 port);
1016 * Called by vxlan to notify the driver about a UDP port and socket 1031 * Called by vxlan to notify the driver about a UDP port and socket
@@ -1066,8 +1081,11 @@ struct net_device_ops {
1066 void (*ndo_uninit)(struct net_device *dev); 1081 void (*ndo_uninit)(struct net_device *dev);
1067 int (*ndo_open)(struct net_device *dev); 1082 int (*ndo_open)(struct net_device *dev);
1068 int (*ndo_stop)(struct net_device *dev); 1083 int (*ndo_stop)(struct net_device *dev);
1069 netdev_tx_t (*ndo_start_xmit) (struct sk_buff *skb, 1084 netdev_tx_t (*ndo_start_xmit)(struct sk_buff *skb,
1070 struct net_device *dev); 1085 struct net_device *dev);
1086 netdev_features_t (*ndo_features_check)(struct sk_buff *skb,
1087 struct net_device *dev,
1088 netdev_features_t features);
1071 u16 (*ndo_select_queue)(struct net_device *dev, 1089 u16 (*ndo_select_queue)(struct net_device *dev,
1072 struct sk_buff *skb, 1090 struct sk_buff *skb,
1073 void *accel_priv, 1091 void *accel_priv,
@@ -1215,7 +1233,12 @@ struct net_device_ops {
1215 void (*ndo_del_vxlan_port)(struct net_device *dev, 1233 void (*ndo_del_vxlan_port)(struct net_device *dev,
1216 sa_family_t sa_family, 1234 sa_family_t sa_family,
1217 __be16 port); 1235 __be16 port);
1218 1236 void (*ndo_add_geneve_port)(struct net_device *dev,
1237 sa_family_t sa_family,
1238 __be16 port);
1239 void (*ndo_del_geneve_port)(struct net_device *dev,
1240 sa_family_t sa_family,
1241 __be16 port);
1219 void* (*ndo_dfwd_add_station)(struct net_device *pdev, 1242 void* (*ndo_dfwd_add_station)(struct net_device *pdev,
1220 struct net_device *dev); 1243 struct net_device *dev);
1221 void (*ndo_dfwd_del_station)(struct net_device *pdev, 1244 void (*ndo_dfwd_del_station)(struct net_device *pdev,
@@ -1225,9 +1248,6 @@ struct net_device_ops {
1225 struct net_device *dev, 1248 struct net_device *dev,
1226 void *priv); 1249 void *priv);
1227 int (*ndo_get_lock_subclass)(struct net_device *dev); 1250 int (*ndo_get_lock_subclass)(struct net_device *dev);
1228 netdev_features_t (*ndo_features_check) (struct sk_buff *skb,
1229 struct net_device *dev,
1230 netdev_features_t features);
1231 int (*ndo_set_tx_maxrate)(struct net_device *dev, 1251 int (*ndo_set_tx_maxrate)(struct net_device *dev,
1232 int queue_index, 1252 int queue_index,
1233 u32 maxrate); 1253 u32 maxrate);
@@ -1271,6 +1291,7 @@ struct net_device_ops {
1271 * @IFF_NO_QUEUE: device can run without qdisc attached 1291 * @IFF_NO_QUEUE: device can run without qdisc attached
1272 * @IFF_OPENVSWITCH: device is a Open vSwitch master 1292 * @IFF_OPENVSWITCH: device is a Open vSwitch master
1273 * @IFF_L3MDEV_SLAVE: device is enslaved to an L3 master device 1293 * @IFF_L3MDEV_SLAVE: device is enslaved to an L3 master device
1294 * @IFF_TEAM: device is a team device
1274 */ 1295 */
1275enum netdev_priv_flags { 1296enum netdev_priv_flags {
1276 IFF_802_1Q_VLAN = 1<<0, 1297 IFF_802_1Q_VLAN = 1<<0,
@@ -1297,6 +1318,7 @@ enum netdev_priv_flags {
1297 IFF_NO_QUEUE = 1<<21, 1318 IFF_NO_QUEUE = 1<<21,
1298 IFF_OPENVSWITCH = 1<<22, 1319 IFF_OPENVSWITCH = 1<<22,
1299 IFF_L3MDEV_SLAVE = 1<<23, 1320 IFF_L3MDEV_SLAVE = 1<<23,
1321 IFF_TEAM = 1<<24,
1300}; 1322};
1301 1323
1302#define IFF_802_1Q_VLAN IFF_802_1Q_VLAN 1324#define IFF_802_1Q_VLAN IFF_802_1Q_VLAN
@@ -1323,6 +1345,7 @@ enum netdev_priv_flags {
1323#define IFF_NO_QUEUE IFF_NO_QUEUE 1345#define IFF_NO_QUEUE IFF_NO_QUEUE
1324#define IFF_OPENVSWITCH IFF_OPENVSWITCH 1346#define IFF_OPENVSWITCH IFF_OPENVSWITCH
1325#define IFF_L3MDEV_SLAVE IFF_L3MDEV_SLAVE 1347#define IFF_L3MDEV_SLAVE IFF_L3MDEV_SLAVE
1348#define IFF_TEAM IFF_TEAM
1326 1349
1327/** 1350/**
1328 * struct net_device - The DEVICE structure. 1351 * struct net_device - The DEVICE structure.
@@ -1716,7 +1739,9 @@ struct net_device {
1716#ifdef CONFIG_XPS 1739#ifdef CONFIG_XPS
1717 struct xps_dev_maps __rcu *xps_maps; 1740 struct xps_dev_maps __rcu *xps_maps;
1718#endif 1741#endif
1719 1742#ifdef CONFIG_NET_CLS_ACT
1743 struct tcf_proto __rcu *egress_cl_list;
1744#endif
1720#ifdef CONFIG_NET_SWITCHDEV 1745#ifdef CONFIG_NET_SWITCHDEV
1721 u32 offload_fwd_mark; 1746 u32 offload_fwd_mark;
1722#endif 1747#endif
@@ -1949,6 +1974,26 @@ void netif_napi_add(struct net_device *dev, struct napi_struct *napi,
1949 int (*poll)(struct napi_struct *, int), int weight); 1974 int (*poll)(struct napi_struct *, int), int weight);
1950 1975
1951/** 1976/**
1977 * netif_tx_napi_add - initialize a napi context
1978 * @dev: network device
1979 * @napi: napi context
1980 * @poll: polling function
1981 * @weight: default weight
1982 *
1983 * This variant of netif_napi_add() should be used from drivers using NAPI
1984 * to exclusively poll a TX queue.
1985 * This will avoid we add it into napi_hash[], thus polluting this hash table.
1986 */
1987static inline void netif_tx_napi_add(struct net_device *dev,
1988 struct napi_struct *napi,
1989 int (*poll)(struct napi_struct *, int),
1990 int weight)
1991{
1992 set_bit(NAPI_STATE_NO_BUSY_POLL, &napi->state);
1993 netif_napi_add(dev, napi, poll, weight);
1994}
1995
1996/**
1952 * netif_napi_del - remove a napi context 1997 * netif_napi_del - remove a napi context
1953 * @napi: napi context 1998 * @napi: napi context
1954 * 1999 *
@@ -2086,6 +2131,24 @@ struct pcpu_sw_netstats {
2086#define netdev_alloc_pcpu_stats(type) \ 2131#define netdev_alloc_pcpu_stats(type) \
2087 __netdev_alloc_pcpu_stats(type, GFP_KERNEL) 2132 __netdev_alloc_pcpu_stats(type, GFP_KERNEL)
2088 2133
2134enum netdev_lag_tx_type {
2135 NETDEV_LAG_TX_TYPE_UNKNOWN,
2136 NETDEV_LAG_TX_TYPE_RANDOM,
2137 NETDEV_LAG_TX_TYPE_BROADCAST,
2138 NETDEV_LAG_TX_TYPE_ROUNDROBIN,
2139 NETDEV_LAG_TX_TYPE_ACTIVEBACKUP,
2140 NETDEV_LAG_TX_TYPE_HASH,
2141};
2142
2143struct netdev_lag_upper_info {
2144 enum netdev_lag_tx_type tx_type;
2145};
2146
2147struct netdev_lag_lower_state_info {
2148 u8 link_up : 1,
2149 tx_enabled : 1;
2150};
2151
2089#include <linux/notifier.h> 2152#include <linux/notifier.h>
2090 2153
2091/* netdevice notifier chain. Please remember to update the rtnetlink 2154/* netdevice notifier chain. Please remember to update the rtnetlink
@@ -2121,6 +2184,7 @@ struct pcpu_sw_netstats {
2121#define NETDEV_CHANGEINFODATA 0x0018 2184#define NETDEV_CHANGEINFODATA 0x0018
2122#define NETDEV_BONDING_INFO 0x0019 2185#define NETDEV_BONDING_INFO 0x0019
2123#define NETDEV_PRECHANGEUPPER 0x001A 2186#define NETDEV_PRECHANGEUPPER 0x001A
2187#define NETDEV_CHANGELOWERSTATE 0x001B
2124 2188
2125int register_netdevice_notifier(struct notifier_block *nb); 2189int register_netdevice_notifier(struct notifier_block *nb);
2126int unregister_netdevice_notifier(struct notifier_block *nb); 2190int unregister_netdevice_notifier(struct notifier_block *nb);
@@ -2139,6 +2203,12 @@ struct netdev_notifier_changeupper_info {
2139 struct net_device *upper_dev; /* new upper dev */ 2203 struct net_device *upper_dev; /* new upper dev */
2140 bool master; /* is upper dev master */ 2204 bool master; /* is upper dev master */
2141 bool linking; /* is the nofication for link or unlink */ 2205 bool linking; /* is the nofication for link or unlink */
2206 void *upper_info; /* upper dev info */
2207};
2208
2209struct netdev_notifier_changelowerstate_info {
2210 struct netdev_notifier_info info; /* must be first */
2211 void *lower_state_info; /* is lower dev state */
2142}; 2212};
2143 2213
2144static inline void netdev_notifier_info_init(struct netdev_notifier_info *info, 2214static inline void netdev_notifier_info_init(struct netdev_notifier_info *info,
@@ -2472,6 +2542,71 @@ static inline void skb_gro_remcsum_cleanup(struct sk_buff *skb,
2472 remcsum_unadjust((__sum16 *)ptr, grc->delta); 2542 remcsum_unadjust((__sum16 *)ptr, grc->delta);
2473} 2543}
2474 2544
2545struct skb_csum_offl_spec {
2546 __u16 ipv4_okay:1,
2547 ipv6_okay:1,
2548 encap_okay:1,
2549 ip_options_okay:1,
2550 ext_hdrs_okay:1,
2551 tcp_okay:1,
2552 udp_okay:1,
2553 sctp_okay:1,
2554 vlan_okay:1,
2555 no_encapped_ipv6:1,
2556 no_not_encapped:1;
2557};
2558
2559bool __skb_csum_offload_chk(struct sk_buff *skb,
2560 const struct skb_csum_offl_spec *spec,
2561 bool *csum_encapped,
2562 bool csum_help);
2563
2564static inline bool skb_csum_offload_chk(struct sk_buff *skb,
2565 const struct skb_csum_offl_spec *spec,
2566 bool *csum_encapped,
2567 bool csum_help)
2568{
2569 if (skb->ip_summed != CHECKSUM_PARTIAL)
2570 return false;
2571
2572 return __skb_csum_offload_chk(skb, spec, csum_encapped, csum_help);
2573}
2574
2575static inline bool skb_csum_offload_chk_help(struct sk_buff *skb,
2576 const struct skb_csum_offl_spec *spec)
2577{
2578 bool csum_encapped;
2579
2580 return skb_csum_offload_chk(skb, spec, &csum_encapped, true);
2581}
2582
2583static inline bool skb_csum_off_chk_help_cmn(struct sk_buff *skb)
2584{
2585 static const struct skb_csum_offl_spec csum_offl_spec = {
2586 .ipv4_okay = 1,
2587 .ip_options_okay = 1,
2588 .ipv6_okay = 1,
2589 .vlan_okay = 1,
2590 .tcp_okay = 1,
2591 .udp_okay = 1,
2592 };
2593
2594 return skb_csum_offload_chk_help(skb, &csum_offl_spec);
2595}
2596
2597static inline bool skb_csum_off_chk_help_cmn_v4_only(struct sk_buff *skb)
2598{
2599 static const struct skb_csum_offl_spec csum_offl_spec = {
2600 .ipv4_okay = 1,
2601 .ip_options_okay = 1,
2602 .tcp_okay = 1,
2603 .udp_okay = 1,
2604 .vlan_okay = 1,
2605 };
2606
2607 return skb_csum_offload_chk_help(skb, &csum_offl_spec);
2608}
2609
2475static inline int dev_hard_header(struct sk_buff *skb, struct net_device *dev, 2610static inline int dev_hard_header(struct sk_buff *skb, struct net_device *dev,
2476 unsigned short type, 2611 unsigned short type,
2477 const void *daddr, const void *saddr, 2612 const void *daddr, const void *saddr,
@@ -3595,15 +3730,15 @@ struct net_device *netdev_master_upper_dev_get(struct net_device *dev);
3595struct net_device *netdev_master_upper_dev_get_rcu(struct net_device *dev); 3730struct net_device *netdev_master_upper_dev_get_rcu(struct net_device *dev);
3596int netdev_upper_dev_link(struct net_device *dev, struct net_device *upper_dev); 3731int netdev_upper_dev_link(struct net_device *dev, struct net_device *upper_dev);
3597int netdev_master_upper_dev_link(struct net_device *dev, 3732int netdev_master_upper_dev_link(struct net_device *dev,
3598 struct net_device *upper_dev); 3733 struct net_device *upper_dev,
3599int netdev_master_upper_dev_link_private(struct net_device *dev, 3734 void *upper_priv, void *upper_info);
3600 struct net_device *upper_dev,
3601 void *private);
3602void netdev_upper_dev_unlink(struct net_device *dev, 3735void netdev_upper_dev_unlink(struct net_device *dev,
3603 struct net_device *upper_dev); 3736 struct net_device *upper_dev);
3604void netdev_adjacent_rename_links(struct net_device *dev, char *oldname); 3737void netdev_adjacent_rename_links(struct net_device *dev, char *oldname);
3605void *netdev_lower_dev_get_private(struct net_device *dev, 3738void *netdev_lower_dev_get_private(struct net_device *dev,
3606 struct net_device *lower_dev); 3739 struct net_device *lower_dev);
3740void netdev_lower_state_changed(struct net_device *lower_dev,
3741 void *lower_state_info);
3607 3742
3608/* RSS keys are 40 or 52 bytes long */ 3743/* RSS keys are 40 or 52 bytes long */
3609#define NETDEV_RSS_KEY_LEN 52 3744#define NETDEV_RSS_KEY_LEN 52
@@ -3611,7 +3746,7 @@ extern u8 netdev_rss_key[NETDEV_RSS_KEY_LEN];
3611void netdev_rss_key_fill(void *buffer, size_t len); 3746void netdev_rss_key_fill(void *buffer, size_t len);
3612 3747
3613int dev_get_nest_level(struct net_device *dev, 3748int dev_get_nest_level(struct net_device *dev,
3614 bool (*type_check)(struct net_device *dev)); 3749 bool (*type_check)(const struct net_device *dev));
3615int skb_checksum_help(struct sk_buff *skb); 3750int skb_checksum_help(struct sk_buff *skb);
3616struct sk_buff *__skb_gso_segment(struct sk_buff *skb, 3751struct sk_buff *__skb_gso_segment(struct sk_buff *skb,
3617 netdev_features_t features, bool tx_path); 3752 netdev_features_t features, bool tx_path);
@@ -3641,13 +3776,37 @@ __be16 skb_network_protocol(struct sk_buff *skb, int *depth);
3641static inline bool can_checksum_protocol(netdev_features_t features, 3776static inline bool can_checksum_protocol(netdev_features_t features,
3642 __be16 protocol) 3777 __be16 protocol)
3643{ 3778{
3644 return ((features & NETIF_F_GEN_CSUM) || 3779 if (protocol == htons(ETH_P_FCOE))
3645 ((features & NETIF_F_V4_CSUM) && 3780 return !!(features & NETIF_F_FCOE_CRC);
3646 protocol == htons(ETH_P_IP)) || 3781
3647 ((features & NETIF_F_V6_CSUM) && 3782 /* Assume this is an IP checksum (not SCTP CRC) */
3648 protocol == htons(ETH_P_IPV6)) || 3783
3649 ((features & NETIF_F_FCOE_CRC) && 3784 if (features & NETIF_F_HW_CSUM) {
3650 protocol == htons(ETH_P_FCOE))); 3785 /* Can checksum everything */
3786 return true;
3787 }
3788
3789 switch (protocol) {
3790 case htons(ETH_P_IP):
3791 return !!(features & NETIF_F_IP_CSUM);
3792 case htons(ETH_P_IPV6):
3793 return !!(features & NETIF_F_IPV6_CSUM);
3794 default:
3795 return false;
3796 }
3797}
3798
3799/* Map an ethertype into IP protocol if possible */
3800static inline int eproto_to_ipproto(int eproto)
3801{
3802 switch (eproto) {
3803 case htons(ETH_P_IP):
3804 return IPPROTO_IP;
3805 case htons(ETH_P_IPV6):
3806 return IPPROTO_IPV6;
3807 default:
3808 return -1;
3809 }
3651} 3810}
3652 3811
3653#ifdef CONFIG_BUG 3812#ifdef CONFIG_BUG
@@ -3712,15 +3871,14 @@ void linkwatch_run_queue(void);
3712static inline netdev_features_t netdev_intersect_features(netdev_features_t f1, 3871static inline netdev_features_t netdev_intersect_features(netdev_features_t f1,
3713 netdev_features_t f2) 3872 netdev_features_t f2)
3714{ 3873{
3715 if (f1 & NETIF_F_GEN_CSUM) 3874 if ((f1 ^ f2) & NETIF_F_HW_CSUM) {
3716 f1 |= (NETIF_F_ALL_CSUM & ~NETIF_F_GEN_CSUM); 3875 if (f1 & NETIF_F_HW_CSUM)
3717 if (f2 & NETIF_F_GEN_CSUM) 3876 f1 |= (NETIF_F_IP_CSUM|NETIF_F_IPV6_CSUM);
3718 f2 |= (NETIF_F_ALL_CSUM & ~NETIF_F_GEN_CSUM); 3877 else
3719 f1 &= f2; 3878 f2 |= (NETIF_F_IP_CSUM|NETIF_F_IPV6_CSUM);
3720 if (f1 & NETIF_F_GEN_CSUM) 3879 }
3721 f1 &= ~(NETIF_F_ALL_CSUM & ~NETIF_F_GEN_CSUM);
3722 3880
3723 return f1; 3881 return f1 & f2;
3724} 3882}
3725 3883
3726static inline netdev_features_t netdev_get_wanted_features( 3884static inline netdev_features_t netdev_get_wanted_features(
@@ -3808,32 +3966,32 @@ static inline void skb_gso_error_unwind(struct sk_buff *skb, __be16 protocol,
3808 skb->mac_len = mac_len; 3966 skb->mac_len = mac_len;
3809} 3967}
3810 3968
3811static inline bool netif_is_macvlan(struct net_device *dev) 3969static inline bool netif_is_macvlan(const struct net_device *dev)
3812{ 3970{
3813 return dev->priv_flags & IFF_MACVLAN; 3971 return dev->priv_flags & IFF_MACVLAN;
3814} 3972}
3815 3973
3816static inline bool netif_is_macvlan_port(struct net_device *dev) 3974static inline bool netif_is_macvlan_port(const struct net_device *dev)
3817{ 3975{
3818 return dev->priv_flags & IFF_MACVLAN_PORT; 3976 return dev->priv_flags & IFF_MACVLAN_PORT;
3819} 3977}
3820 3978
3821static inline bool netif_is_ipvlan(struct net_device *dev) 3979static inline bool netif_is_ipvlan(const struct net_device *dev)
3822{ 3980{
3823 return dev->priv_flags & IFF_IPVLAN_SLAVE; 3981 return dev->priv_flags & IFF_IPVLAN_SLAVE;
3824} 3982}
3825 3983
3826static inline bool netif_is_ipvlan_port(struct net_device *dev) 3984static inline bool netif_is_ipvlan_port(const struct net_device *dev)
3827{ 3985{
3828 return dev->priv_flags & IFF_IPVLAN_MASTER; 3986 return dev->priv_flags & IFF_IPVLAN_MASTER;
3829} 3987}
3830 3988
3831static inline bool netif_is_bond_master(struct net_device *dev) 3989static inline bool netif_is_bond_master(const struct net_device *dev)
3832{ 3990{
3833 return dev->flags & IFF_MASTER && dev->priv_flags & IFF_BONDING; 3991 return dev->flags & IFF_MASTER && dev->priv_flags & IFF_BONDING;
3834} 3992}
3835 3993
3836static inline bool netif_is_bond_slave(struct net_device *dev) 3994static inline bool netif_is_bond_slave(const struct net_device *dev)
3837{ 3995{
3838 return dev->flags & IFF_SLAVE && dev->priv_flags & IFF_BONDING; 3996 return dev->flags & IFF_SLAVE && dev->priv_flags & IFF_BONDING;
3839} 3997}
@@ -3868,6 +4026,26 @@ static inline bool netif_is_ovs_master(const struct net_device *dev)
3868 return dev->priv_flags & IFF_OPENVSWITCH; 4026 return dev->priv_flags & IFF_OPENVSWITCH;
3869} 4027}
3870 4028
4029static inline bool netif_is_team_master(const struct net_device *dev)
4030{
4031 return dev->priv_flags & IFF_TEAM;
4032}
4033
4034static inline bool netif_is_team_port(const struct net_device *dev)
4035{
4036 return dev->priv_flags & IFF_TEAM_PORT;
4037}
4038
4039static inline bool netif_is_lag_master(const struct net_device *dev)
4040{
4041 return netif_is_bond_master(dev) || netif_is_team_master(dev);
4042}
4043
4044static inline bool netif_is_lag_port(const struct net_device *dev)
4045{
4046 return netif_is_bond_slave(dev) || netif_is_team_port(dev);
4047}
4048
3871/* This device needs to keep skb dst for qdisc enqueue or ndo_start_xmit() */ 4049/* This device needs to keep skb dst for qdisc enqueue or ndo_start_xmit() */
3872static inline void netif_keep_dst(struct net_device *dev) 4050static inline void netif_keep_dst(struct net_device *dev)
3873{ 4051{
diff --git a/include/linux/netfilter/nf_conntrack_sctp.h b/include/linux/netfilter/nf_conntrack_sctp.h
new file mode 100644
index 000000000000..22a16a23cd8a
--- /dev/null
+++ b/include/linux/netfilter/nf_conntrack_sctp.h
@@ -0,0 +1,13 @@
1#ifndef _NF_CONNTRACK_SCTP_H
2#define _NF_CONNTRACK_SCTP_H
3/* SCTP tracking. */
4
5#include <uapi/linux/netfilter/nf_conntrack_sctp.h>
6
7struct ip_ct_sctp {
8 enum sctp_conntrack state;
9
10 __be32 vtag[IP_CT_DIR_MAX];
11};
12
13#endif /* _NF_CONNTRACK_SCTP_H */
diff --git a/include/linux/netfilter/nfnetlink.h b/include/linux/netfilter/nfnetlink.h
index 5646b24bfc64..ba0d9789eb6e 100644
--- a/include/linux/netfilter/nfnetlink.h
+++ b/include/linux/netfilter/nfnetlink.h
@@ -8,12 +8,12 @@
8#include <uapi/linux/netfilter/nfnetlink.h> 8#include <uapi/linux/netfilter/nfnetlink.h>
9 9
10struct nfnl_callback { 10struct nfnl_callback {
11 int (*call)(struct sock *nl, struct sk_buff *skb, 11 int (*call)(struct net *net, struct sock *nl, struct sk_buff *skb,
12 const struct nlmsghdr *nlh,
13 const struct nlattr * const cda[]);
14 int (*call_rcu)(struct sock *nl, struct sk_buff *skb,
15 const struct nlmsghdr *nlh, 12 const struct nlmsghdr *nlh,
16 const struct nlattr * const cda[]); 13 const struct nlattr * const cda[]);
14 int (*call_rcu)(struct net *net, struct sock *nl, struct sk_buff *skb,
15 const struct nlmsghdr *nlh,
16 const struct nlattr * const cda[]);
17 int (*call_batch)(struct net *net, struct sock *nl, struct sk_buff *skb, 17 int (*call_batch)(struct net *net, struct sock *nl, struct sk_buff *skb,
18 const struct nlmsghdr *nlh, 18 const struct nlmsghdr *nlh,
19 const struct nlattr * const cda[]); 19 const struct nlattr * const cda[]);
@@ -26,8 +26,8 @@ struct nfnetlink_subsystem {
26 __u8 subsys_id; /* nfnetlink subsystem ID */ 26 __u8 subsys_id; /* nfnetlink subsystem ID */
27 __u8 cb_count; /* number of callbacks */ 27 __u8 cb_count; /* number of callbacks */
28 const struct nfnl_callback *cb; /* callback for individual types */ 28 const struct nfnl_callback *cb; /* callback for individual types */
29 int (*commit)(struct sk_buff *skb); 29 int (*commit)(struct net *net, struct sk_buff *skb);
30 int (*abort)(struct sk_buff *skb); 30 int (*abort)(struct net *net, struct sk_buff *skb);
31}; 31};
32 32
33int nfnetlink_subsys_register(const struct nfnetlink_subsystem *n); 33int nfnetlink_subsys_register(const struct nfnetlink_subsystem *n);
diff --git a/include/linux/netlink.h b/include/linux/netlink.h
index 639e9b8b0e4d..0b41959aab9f 100644
--- a/include/linux/netlink.h
+++ b/include/linux/netlink.h
@@ -131,6 +131,7 @@ netlink_skb_clone(struct sk_buff *skb, gfp_t gfp_mask)
131struct netlink_callback { 131struct netlink_callback {
132 struct sk_buff *skb; 132 struct sk_buff *skb;
133 const struct nlmsghdr *nlh; 133 const struct nlmsghdr *nlh;
134 int (*start)(struct netlink_callback *);
134 int (*dump)(struct sk_buff * skb, 135 int (*dump)(struct sk_buff * skb,
135 struct netlink_callback *cb); 136 struct netlink_callback *cb);
136 int (*done)(struct netlink_callback *cb); 137 int (*done)(struct netlink_callback *cb);
@@ -153,6 +154,7 @@ struct nlmsghdr *
153__nlmsg_put(struct sk_buff *skb, u32 portid, u32 seq, int type, int len, int flags); 154__nlmsg_put(struct sk_buff *skb, u32 portid, u32 seq, int type, int len, int flags);
154 155
155struct netlink_dump_control { 156struct netlink_dump_control {
157 int (*start)(struct netlink_callback *);
156 int (*dump)(struct sk_buff *skb, struct netlink_callback *); 158 int (*dump)(struct sk_buff *skb, struct netlink_callback *);
157 int (*done)(struct netlink_callback *); 159 int (*done)(struct netlink_callback *);
158 void *data; 160 void *data;
diff --git a/include/linux/pci_ids.h b/include/linux/pci_ids.h
index d9ba49cedc5d..1acbefc4bbda 100644
--- a/include/linux/pci_ids.h
+++ b/include/linux/pci_ids.h
@@ -2495,6 +2495,8 @@
2495#define PCI_DEVICE_ID_KORENIX_JETCARDF2 0x1700 2495#define PCI_DEVICE_ID_KORENIX_JETCARDF2 0x1700
2496#define PCI_DEVICE_ID_KORENIX_JETCARDF3 0x17ff 2496#define PCI_DEVICE_ID_KORENIX_JETCARDF3 0x17ff
2497 2497
2498#define PCI_VENDOR_ID_NETRONOME 0x19ee
2499
2498#define PCI_VENDOR_ID_QMI 0x1a32 2500#define PCI_VENDOR_ID_QMI 0x1a32
2499 2501
2500#define PCI_VENDOR_ID_AZWAVE 0x1a3b 2502#define PCI_VENDOR_ID_AZWAVE 0x1a3b
diff --git a/include/linux/phy.h b/include/linux/phy.h
index 05fde31b6dc6..d6f3641e7933 100644
--- a/include/linux/phy.h
+++ b/include/linux/phy.h
@@ -16,8 +16,10 @@
16#ifndef __PHY_H 16#ifndef __PHY_H
17#define __PHY_H 17#define __PHY_H
18 18
19#include <linux/compiler.h>
19#include <linux/spinlock.h> 20#include <linux/spinlock.h>
20#include <linux/ethtool.h> 21#include <linux/ethtool.h>
22#include <linux/mdio.h>
21#include <linux/mii.h> 23#include <linux/mii.h>
22#include <linux/module.h> 24#include <linux/module.h>
23#include <linux/timer.h> 25#include <linux/timer.h>
@@ -58,6 +60,7 @@
58#define PHY_HAS_INTERRUPT 0x00000001 60#define PHY_HAS_INTERRUPT 0x00000001
59#define PHY_HAS_MAGICANEG 0x00000002 61#define PHY_HAS_MAGICANEG 0x00000002
60#define PHY_IS_INTERNAL 0x00000004 62#define PHY_IS_INTERNAL 0x00000004
63#define MDIO_DEVICE_IS_PHY 0x80000000
61 64
62/* Interface Mode definitions */ 65/* Interface Mode definitions */
63typedef enum { 66typedef enum {
@@ -158,8 +161,8 @@ struct mii_bus {
158 const char *name; 161 const char *name;
159 char id[MII_BUS_ID_SIZE]; 162 char id[MII_BUS_ID_SIZE];
160 void *priv; 163 void *priv;
161 int (*read)(struct mii_bus *bus, int phy_id, int regnum); 164 int (*read)(struct mii_bus *bus, int addr, int regnum);
162 int (*write)(struct mii_bus *bus, int phy_id, int regnum, u16 val); 165 int (*write)(struct mii_bus *bus, int addr, int regnum, u16 val);
163 int (*reset)(struct mii_bus *bus); 166 int (*reset)(struct mii_bus *bus);
164 167
165 /* 168 /*
@@ -178,7 +181,7 @@ struct mii_bus {
178 struct device dev; 181 struct device dev;
179 182
180 /* list of all PHYs on bus */ 183 /* list of all PHYs on bus */
181 struct phy_device *phy_map[PHY_MAX_ADDR]; 184 struct mdio_device *mdio_map[PHY_MAX_ADDR];
182 185
183 /* PHY addresses to be ignored when probing */ 186 /* PHY addresses to be ignored when probing */
184 u32 phy_mask; 187 u32 phy_mask;
@@ -187,10 +190,10 @@ struct mii_bus {
187 u32 phy_ignore_ta_mask; 190 u32 phy_ignore_ta_mask;
188 191
189 /* 192 /*
190 * Pointer to an array of interrupts, each PHY's 193 * An array of interrupts, each PHY's interrupt at the index
191 * interrupt at the index matching its address 194 * matching its address
192 */ 195 */
193 int *irq; 196 int irq[PHY_MAX_ADDR];
194}; 197};
195#define to_mii_bus(d) container_of(d, struct mii_bus, dev) 198#define to_mii_bus(d) container_of(d, struct mii_bus, dev)
196 199
@@ -212,11 +215,6 @@ static inline struct mii_bus *devm_mdiobus_alloc(struct device *dev)
212 215
213void devm_mdiobus_free(struct device *dev, struct mii_bus *bus); 216void devm_mdiobus_free(struct device *dev, struct mii_bus *bus);
214struct phy_device *mdiobus_scan(struct mii_bus *bus, int addr); 217struct phy_device *mdiobus_scan(struct mii_bus *bus, int addr);
215int mdiobus_read(struct mii_bus *bus, int addr, u32 regnum);
216int mdiobus_read_nested(struct mii_bus *bus, int addr, u32 regnum);
217int mdiobus_write(struct mii_bus *bus, int addr, u32 regnum, u16 val);
218int mdiobus_write_nested(struct mii_bus *bus, int addr, u32 regnum, u16 val);
219
220 218
221#define PHY_INTERRUPT_DISABLED 0x0 219#define PHY_INTERRUPT_DISABLED 0x0
222#define PHY_INTERRUPT_ENABLED 0x80000000 220#define PHY_INTERRUPT_ENABLED 0x80000000
@@ -361,14 +359,12 @@ struct phy_c45_device_ids {
361 * handling, as well as handling shifts in PHY hardware state 359 * handling, as well as handling shifts in PHY hardware state
362 */ 360 */
363struct phy_device { 361struct phy_device {
362 struct mdio_device mdio;
363
364 /* Information about the PHY type */ 364 /* Information about the PHY type */
365 /* And management functions */ 365 /* And management functions */
366 struct phy_driver *drv; 366 struct phy_driver *drv;
367 367
368 struct mii_bus *bus;
369
370 struct device dev;
371
372 u32 phy_id; 368 u32 phy_id;
373 369
374 struct phy_c45_device_ids c45_ids; 370 struct phy_c45_device_ids c45_ids;
@@ -384,9 +380,6 @@ struct phy_device {
384 380
385 phy_interface_t interface; 381 phy_interface_t interface;
386 382
387 /* Bus address of the PHY (0-31) */
388 int addr;
389
390 /* 383 /*
391 * forced speed & duplex (no autoneg) 384 * forced speed & duplex (no autoneg)
392 * partner speed & duplex & pause (autoneg) 385 * partner speed & duplex & pause (autoneg)
@@ -435,10 +428,12 @@ struct phy_device {
435 428
436 void (*adjust_link)(struct net_device *dev); 429 void (*adjust_link)(struct net_device *dev);
437}; 430};
438#define to_phy_device(d) container_of(d, struct phy_device, dev) 431#define to_phy_device(d) container_of(to_mdio_device(d), \
432 struct phy_device, mdio)
439 433
440/* struct phy_driver: Driver structure for a particular PHY type 434/* struct phy_driver: Driver structure for a particular PHY type
441 * 435 *
436 * driver_data: static driver data
442 * phy_id: The result of reading the UID registers of this PHY 437 * phy_id: The result of reading the UID registers of this PHY
443 * type, and ANDing them with the phy_id_mask. This driver 438 * type, and ANDing them with the phy_id_mask. This driver
444 * only works for PHYs with IDs which match this field 439 * only works for PHYs with IDs which match this field
@@ -448,7 +443,6 @@ struct phy_device {
448 * by this PHY 443 * by this PHY
449 * flags: A bitfield defining certain other features this PHY 444 * flags: A bitfield defining certain other features this PHY
450 * supports (like interrupts) 445 * supports (like interrupts)
451 * driver_data: static driver data
452 * 446 *
453 * The drivers must implement config_aneg and read_status. All 447 * The drivers must implement config_aneg and read_status. All
454 * other functions are optional. Note that none of these 448 * other functions are optional. Note that none of these
@@ -459,6 +453,7 @@ struct phy_device {
459 * supported in the driver). 453 * supported in the driver).
460 */ 454 */
461struct phy_driver { 455struct phy_driver {
456 struct mdio_driver_common mdiodrv;
462 u32 phy_id; 457 u32 phy_id;
463 char *name; 458 char *name;
464 unsigned int phy_id_mask; 459 unsigned int phy_id_mask;
@@ -589,9 +584,14 @@ struct phy_driver {
589 int (*module_eeprom)(struct phy_device *dev, 584 int (*module_eeprom)(struct phy_device *dev,
590 struct ethtool_eeprom *ee, u8 *data); 585 struct ethtool_eeprom *ee, u8 *data);
591 586
592 struct device_driver driver; 587 /* Get statistics from the phy using ethtool */
588 int (*get_sset_count)(struct phy_device *dev);
589 void (*get_strings)(struct phy_device *dev, u8 *data);
590 void (*get_stats)(struct phy_device *dev,
591 struct ethtool_stats *stats, u64 *data);
593}; 592};
594#define to_phy_driver(d) container_of(d, struct phy_driver, driver) 593#define to_phy_driver(d) container_of(to_mdio_common_driver(d), \
594 struct phy_driver, mdiodrv)
595 595
596#define PHY_ANY_ID "MATCH ANY PHY" 596#define PHY_ANY_ID "MATCH ANY PHY"
597#define PHY_ANY_UID 0xffffffff 597#define PHY_ANY_UID 0xffffffff
@@ -619,7 +619,7 @@ static inline int phy_read_mmd(struct phy_device *phydev, int devad, u32 regnum)
619 if (!phydev->is_c45) 619 if (!phydev->is_c45)
620 return -EOPNOTSUPP; 620 return -EOPNOTSUPP;
621 621
622 return mdiobus_read(phydev->bus, phydev->addr, 622 return mdiobus_read(phydev->mdio.bus, phydev->mdio.addr,
623 MII_ADDR_C45 | (devad << 16) | (regnum & 0xffff)); 623 MII_ADDR_C45 | (devad << 16) | (regnum & 0xffff));
624} 624}
625 625
@@ -627,14 +627,12 @@ static inline int phy_read_mmd(struct phy_device *phydev, int devad, u32 regnum)
627 * phy_read_mmd_indirect - reads data from the MMD registers 627 * phy_read_mmd_indirect - reads data from the MMD registers
628 * @phydev: The PHY device bus 628 * @phydev: The PHY device bus
629 * @prtad: MMD Address 629 * @prtad: MMD Address
630 * @devad: MMD DEVAD
631 * @addr: PHY address on the MII bus 630 * @addr: PHY address on the MII bus
632 * 631 *
633 * Description: it reads data from the MMD registers (clause 22 to access to 632 * Description: it reads data from the MMD registers (clause 22 to access to
634 * clause 45) of the specified phy address. 633 * clause 45) of the specified phy address.
635 */ 634 */
636int phy_read_mmd_indirect(struct phy_device *phydev, int prtad, 635int phy_read_mmd_indirect(struct phy_device *phydev, int prtad, int devad);
637 int devad, int addr);
638 636
639/** 637/**
640 * phy_read - Convenience function for reading a given PHY register 638 * phy_read - Convenience function for reading a given PHY register
@@ -647,7 +645,7 @@ int phy_read_mmd_indirect(struct phy_device *phydev, int prtad,
647 */ 645 */
648static inline int phy_read(struct phy_device *phydev, u32 regnum) 646static inline int phy_read(struct phy_device *phydev, u32 regnum)
649{ 647{
650 return mdiobus_read(phydev->bus, phydev->addr, regnum); 648 return mdiobus_read(phydev->mdio.bus, phydev->mdio.addr, regnum);
651} 649}
652 650
653/** 651/**
@@ -662,7 +660,7 @@ static inline int phy_read(struct phy_device *phydev, u32 regnum)
662 */ 660 */
663static inline int phy_write(struct phy_device *phydev, u32 regnum, u16 val) 661static inline int phy_write(struct phy_device *phydev, u32 regnum, u16 val)
664{ 662{
665 return mdiobus_write(phydev->bus, phydev->addr, regnum, val); 663 return mdiobus_write(phydev->mdio.bus, phydev->mdio.addr, regnum, val);
666} 664}
667 665
668/** 666/**
@@ -725,7 +723,7 @@ static inline int phy_write_mmd(struct phy_device *phydev, int devad,
725 723
726 regnum = MII_ADDR_C45 | ((devad & 0x1f) << 16) | (regnum & 0xffff); 724 regnum = MII_ADDR_C45 | ((devad & 0x1f) << 16) | (regnum & 0xffff);
727 725
728 return mdiobus_write(phydev->bus, phydev->addr, regnum, val); 726 return mdiobus_write(phydev->mdio.bus, phydev->mdio.addr, regnum, val);
729} 727}
730 728
731/** 729/**
@@ -733,14 +731,13 @@ static inline int phy_write_mmd(struct phy_device *phydev, int devad,
733 * @phydev: The PHY device 731 * @phydev: The PHY device
734 * @prtad: MMD Address 732 * @prtad: MMD Address
735 * @devad: MMD DEVAD 733 * @devad: MMD DEVAD
736 * @addr: PHY address on the MII bus
737 * @data: data to write in the MMD register 734 * @data: data to write in the MMD register
738 * 735 *
739 * Description: Write data from the MMD registers of the specified 736 * Description: Write data from the MMD registers of the specified
740 * phy address. 737 * phy address.
741 */ 738 */
742void phy_write_mmd_indirect(struct phy_device *phydev, int prtad, 739void phy_write_mmd_indirect(struct phy_device *phydev, int prtad,
743 int devad, int addr, u32 data); 740 int devad, u32 data);
744 741
745struct phy_device *phy_device_create(struct mii_bus *bus, int addr, int phy_id, 742struct phy_device *phy_device_create(struct mii_bus *bus, int addr, int phy_id,
746 bool is_c45, 743 bool is_c45,
@@ -775,6 +772,20 @@ static inline int phy_read_status(struct phy_device *phydev)
775 return phydev->drv->read_status(phydev); 772 return phydev->drv->read_status(phydev);
776} 773}
777 774
775#define phydev_err(_phydev, format, args...) \
776 dev_err(&_phydev->mdio.dev, format, ##args)
777
778#define phydev_dbg(_phydev, format, args...) \
779 dev_dbg(&_phydev->mdio.dev, format, ##args);
780
781static inline const char *phydev_name(const struct phy_device *phydev)
782{
783 return dev_name(&phydev->mdio.dev);
784}
785
786void phy_attached_print(struct phy_device *phydev, const char *fmt, ...)
787 __printf(2, 3);
788void phy_attached_info(struct phy_device *phydev);
778int genphy_config_init(struct phy_device *phydev); 789int genphy_config_init(struct phy_device *phydev);
779int genphy_setup_forced(struct phy_device *phydev); 790int genphy_setup_forced(struct phy_device *phydev);
780int genphy_restart_aneg(struct phy_device *phydev); 791int genphy_restart_aneg(struct phy_device *phydev);
@@ -787,8 +798,9 @@ int genphy_resume(struct phy_device *phydev);
787int genphy_soft_reset(struct phy_device *phydev); 798int genphy_soft_reset(struct phy_device *phydev);
788void phy_driver_unregister(struct phy_driver *drv); 799void phy_driver_unregister(struct phy_driver *drv);
789void phy_drivers_unregister(struct phy_driver *drv, int n); 800void phy_drivers_unregister(struct phy_driver *drv, int n);
790int phy_driver_register(struct phy_driver *new_driver); 801int phy_driver_register(struct phy_driver *new_driver, struct module *owner);
791int phy_drivers_register(struct phy_driver *new_driver, int n); 802int phy_drivers_register(struct phy_driver *new_driver, int n,
803 struct module *owner);
792void phy_state_machine(struct work_struct *work); 804void phy_state_machine(struct work_struct *work);
793void phy_change(struct work_struct *work); 805void phy_change(struct work_struct *work);
794void phy_mac_interrupt(struct phy_device *phydev, int new_link); 806void phy_mac_interrupt(struct phy_device *phydev, int new_link);
@@ -833,7 +845,7 @@ extern struct bus_type mdio_bus_type;
833#define phy_module_driver(__phy_drivers, __count) \ 845#define phy_module_driver(__phy_drivers, __count) \
834static int __init phy_module_init(void) \ 846static int __init phy_module_init(void) \
835{ \ 847{ \
836 return phy_drivers_register(__phy_drivers, __count); \ 848 return phy_drivers_register(__phy_drivers, __count, THIS_MODULE); \
837} \ 849} \
838module_init(phy_module_init); \ 850module_init(phy_module_init); \
839static void __exit phy_module_exit(void) \ 851static void __exit phy_module_exit(void) \
diff --git a/include/linux/pim.h b/include/linux/pim.h
index 252bf6644c51..e1d756f81348 100644
--- a/include/linux/pim.h
+++ b/include/linux/pim.h
@@ -13,6 +13,11 @@
13 13
14#define PIM_NULL_REGISTER cpu_to_be32(0x40000000) 14#define PIM_NULL_REGISTER cpu_to_be32(0x40000000)
15 15
16static inline bool ipmr_pimsm_enabled(void)
17{
18 return IS_BUILTIN(CONFIG_IP_PIMSM_V1) || IS_BUILTIN(CONFIG_IP_PIMSM_V2);
19}
20
16/* PIMv2 register message header layout (ietf-draft-idmr-pimvsm-v2-00.ps */ 21/* PIMv2 register message header layout (ietf-draft-idmr-pimvsm-v2-00.ps */
17struct pimreghdr 22struct pimreghdr
18{ 23{
diff --git a/include/linux/platform_data/microread.h b/include/linux/platform_data/microread.h
index cfda59b226ee..ca13992089b8 100644
--- a/include/linux/platform_data/microread.h
+++ b/include/linux/platform_data/microread.h
@@ -1,5 +1,5 @@
1/* 1/*
2 * Driver include for the PN544 NFC chip. 2 * Driver include for the Inside Secure microread NFC Chip.
3 * 3 *
4 * Copyright (C) 2011 Tieto Poland 4 * Copyright (C) 2011 Tieto Poland
5 * Copyright (C) 2012 Intel Corporation. All rights reserved. 5 * Copyright (C) 2012 Intel Corporation. All rights reserved.
diff --git a/include/linux/qed/qed_if.h b/include/linux/qed/qed_if.h
index dc9a1353f971..d4a32e878180 100644
--- a/include/linux/qed/qed_if.h
+++ b/include/linux/qed/qed_if.h
@@ -25,6 +25,12 @@
25#include <linux/qed/common_hsi.h> 25#include <linux/qed/common_hsi.h>
26#include <linux/qed/qed_chain.h> 26#include <linux/qed/qed_chain.h>
27 27
28enum qed_led_mode {
29 QED_LED_MODE_OFF,
30 QED_LED_MODE_ON,
31 QED_LED_MODE_RESTORE
32};
33
28#define DIRECT_REG_WR(reg_addr, val) writel((u32)val, \ 34#define DIRECT_REG_WR(reg_addr, val) writel((u32)val, \
29 (void __iomem *)(reg_addr)) 35 (void __iomem *)(reg_addr))
30 36
@@ -252,6 +258,17 @@ struct qed_common_ops {
252 258
253 void (*chain_free)(struct qed_dev *cdev, 259 void (*chain_free)(struct qed_dev *cdev,
254 struct qed_chain *p_chain); 260 struct qed_chain *p_chain);
261
262/**
263 * @brief set_led - Configure LED mode
264 *
265 * @param cdev
266 * @param mode - LED mode
267 *
268 * @return 0 on success, error otherwise.
269 */
270 int (*set_led)(struct qed_dev *cdev,
271 enum qed_led_mode mode);
255}; 272};
256 273
257/** 274/**
diff --git a/include/linux/rhashtable.h b/include/linux/rhashtable.h
index e50b31d18462..63bd7601b6de 100644
--- a/include/linux/rhashtable.h
+++ b/include/linux/rhashtable.h
@@ -823,4 +823,86 @@ out:
823 return err; 823 return err;
824} 824}
825 825
826/* Internal function, please use rhashtable_replace_fast() instead */
827static inline int __rhashtable_replace_fast(
828 struct rhashtable *ht, struct bucket_table *tbl,
829 struct rhash_head *obj_old, struct rhash_head *obj_new,
830 const struct rhashtable_params params)
831{
832 struct rhash_head __rcu **pprev;
833 struct rhash_head *he;
834 spinlock_t *lock;
835 unsigned int hash;
836 int err = -ENOENT;
837
838 /* Minimally, the old and new objects must have same hash
839 * (which should mean identifiers are the same).
840 */
841 hash = rht_head_hashfn(ht, tbl, obj_old, params);
842 if (hash != rht_head_hashfn(ht, tbl, obj_new, params))
843 return -EINVAL;
844
845 lock = rht_bucket_lock(tbl, hash);
846
847 spin_lock_bh(lock);
848
849 pprev = &tbl->buckets[hash];
850 rht_for_each(he, tbl, hash) {
851 if (he != obj_old) {
852 pprev = &he->next;
853 continue;
854 }
855
856 rcu_assign_pointer(obj_new->next, obj_old->next);
857 rcu_assign_pointer(*pprev, obj_new);
858 err = 0;
859 break;
860 }
861
862 spin_unlock_bh(lock);
863
864 return err;
865}
866
867/**
868 * rhashtable_replace_fast - replace an object in hash table
869 * @ht: hash table
870 * @obj_old: pointer to hash head inside object being replaced
871 * @obj_new: pointer to hash head inside object which is new
872 * @params: hash table parameters
873 *
874 * Replacing an object doesn't affect the number of elements in the hash table
875 * or bucket, so we don't need to worry about shrinking or expanding the
876 * table here.
877 *
878 * Returns zero on success, -ENOENT if the entry could not be found,
879 * -EINVAL if hash is not the same for the old and new objects.
880 */
881static inline int rhashtable_replace_fast(
882 struct rhashtable *ht, struct rhash_head *obj_old,
883 struct rhash_head *obj_new,
884 const struct rhashtable_params params)
885{
886 struct bucket_table *tbl;
887 int err;
888
889 rcu_read_lock();
890
891 tbl = rht_dereference_rcu(ht->tbl, ht);
892
893 /* Because we have already taken (and released) the bucket
894 * lock in old_tbl, if we find that future_tbl is not yet
895 * visible then that guarantees the entry to still be in
896 * the old tbl if it exists.
897 */
898 while ((err = __rhashtable_replace_fast(ht, tbl, obj_old,
899 obj_new, params)) &&
900 (tbl = rht_dereference_rcu(tbl->future_tbl, ht)))
901 ;
902
903 rcu_read_unlock();
904
905 return err;
906}
907
826#endif /* _LINUX_RHASHTABLE_H */ 908#endif /* _LINUX_RHASHTABLE_H */
diff --git a/include/linux/rtnetlink.h b/include/linux/rtnetlink.h
index 4be5048b1fbe..c006cc900c44 100644
--- a/include/linux/rtnetlink.h
+++ b/include/linux/rtnetlink.h
@@ -84,6 +84,11 @@ void net_inc_ingress_queue(void);
84void net_dec_ingress_queue(void); 84void net_dec_ingress_queue(void);
85#endif 85#endif
86 86
87#ifdef CONFIG_NET_EGRESS
88void net_inc_egress_queue(void);
89void net_dec_egress_queue(void);
90#endif
91
87extern void rtnetlink_init(void); 92extern void rtnetlink_init(void);
88extern void __rtnl_unlock(void); 93extern void __rtnl_unlock(void);
89 94
diff --git a/include/linux/sched.h b/include/linux/sched.h
index 4bae8ab3b893..61aa9bbea871 100644
--- a/include/linux/sched.h
+++ b/include/linux/sched.h
@@ -834,6 +834,7 @@ struct user_struct {
834 unsigned long mq_bytes; /* How many bytes can be allocated to mqueue? */ 834 unsigned long mq_bytes; /* How many bytes can be allocated to mqueue? */
835#endif 835#endif
836 unsigned long locked_shm; /* How many pages of mlocked shm ? */ 836 unsigned long locked_shm; /* How many pages of mlocked shm ? */
837 unsigned long unix_inflight; /* How many files in flight in unix sockets */
837 838
838#ifdef CONFIG_KEYS 839#ifdef CONFIG_KEYS
839 struct key *uid_keyring; /* UID specific keyring */ 840 struct key *uid_keyring; /* UID specific keyring */
diff --git a/include/linux/sh_eth.h b/include/linux/sh_eth.h
index 8c9131db2b25..f2e27e078362 100644
--- a/include/linux/sh_eth.h
+++ b/include/linux/sh_eth.h
@@ -4,7 +4,7 @@
4#include <linux/phy.h> 4#include <linux/phy.h>
5#include <linux/if_ether.h> 5#include <linux/if_ether.h>
6 6
7enum {EDMAC_LITTLE_ENDIAN, EDMAC_BIG_ENDIAN}; 7enum {EDMAC_LITTLE_ENDIAN};
8 8
9struct sh_eth_plat_data { 9struct sh_eth_plat_data {
10 int phy; 10 int phy;
diff --git a/include/linux/skbuff.h b/include/linux/skbuff.h
index 4355129fff91..07f9ccd28654 100644
--- a/include/linux/skbuff.h
+++ b/include/linux/skbuff.h
@@ -39,11 +39,55 @@
39#include <linux/in6.h> 39#include <linux/in6.h>
40#include <net/flow.h> 40#include <net/flow.h>
41 41
42/* A. Checksumming of received packets by device. 42/* The interface for checksum offload between the stack and networking drivers
43 * is as follows...
44 *
45 * A. IP checksum related features
46 *
47 * Drivers advertise checksum offload capabilities in the features of a device.
48 * From the stack's point of view these are capabilities offered by the driver,
49 * a driver typically only advertises features that it is capable of offloading
50 * to its device.
51 *
52 * The checksum related features are:
53 *
54 * NETIF_F_HW_CSUM - The driver (or its device) is able to compute one
55 * IP (one's complement) checksum for any combination
56 * of protocols or protocol layering. The checksum is
57 * computed and set in a packet per the CHECKSUM_PARTIAL
58 * interface (see below).
59 *
60 * NETIF_F_IP_CSUM - Driver (device) is only able to checksum plain
61 * TCP or UDP packets over IPv4. These are specifically
62 * unencapsulated packets of the form IPv4|TCP or
63 * IPv4|UDP where the Protocol field in the IPv4 header
64 * is TCP or UDP. The IPv4 header may contain IP options
65 * This feature cannot be set in features for a device
66 * with NETIF_F_HW_CSUM also set. This feature is being
67 * DEPRECATED (see below).
68 *
69 * NETIF_F_IPV6_CSUM - Driver (device) is only able to checksum plain
70 * TCP or UDP packets over IPv6. These are specifically
71 * unencapsulated packets of the form IPv6|TCP or
72 * IPv4|UDP where the Next Header field in the IPv6
73 * header is either TCP or UDP. IPv6 extension headers
74 * are not supported with this feature. This feature
75 * cannot be set in features for a device with
76 * NETIF_F_HW_CSUM also set. This feature is being
77 * DEPRECATED (see below).
78 *
79 * NETIF_F_RXCSUM - Driver (device) performs receive checksum offload.
80 * This flag is used only used to disable the RX checksum
81 * feature for a device. The stack will accept receive
82 * checksum indication in packets received on a device
83 * regardless of whether NETIF_F_RXCSUM is set.
84 *
85 * B. Checksumming of received packets by device. Indication of checksum
86 * verification is in set skb->ip_summed. Possible values are:
43 * 87 *
44 * CHECKSUM_NONE: 88 * CHECKSUM_NONE:
45 * 89 *
46 * Device failed to checksum this packet e.g. due to lack of capabilities. 90 * Device did not checksum this packet e.g. due to lack of capabilities.
47 * The packet contains full (though not verified) checksum in packet but 91 * The packet contains full (though not verified) checksum in packet but
48 * not in skb->csum. Thus, skb->csum is undefined in this case. 92 * not in skb->csum. Thus, skb->csum is undefined in this case.
49 * 93 *
@@ -53,9 +97,8 @@
53 * (as in CHECKSUM_COMPLETE), but it does parse headers and verify checksums 97 * (as in CHECKSUM_COMPLETE), but it does parse headers and verify checksums
54 * for specific protocols. For such packets it will set CHECKSUM_UNNECESSARY 98 * for specific protocols. For such packets it will set CHECKSUM_UNNECESSARY
55 * if their checksums are okay. skb->csum is still undefined in this case 99 * if their checksums are okay. skb->csum is still undefined in this case
56 * though. It is a bad option, but, unfortunately, nowadays most vendors do 100 * though. A driver or device must never modify the checksum field in the
57 * this. Apparently with the secret goal to sell you new devices, when you 101 * packet even if checksum is verified.
58 * will add new protocol to your host, f.e. IPv6 8)
59 * 102 *
60 * CHECKSUM_UNNECESSARY is applicable to following protocols: 103 * CHECKSUM_UNNECESSARY is applicable to following protocols:
61 * TCP: IPv6 and IPv4. 104 * TCP: IPv6 and IPv4.
@@ -96,40 +139,77 @@
96 * packet that are after the checksum being offloaded are not considered to 139 * packet that are after the checksum being offloaded are not considered to
97 * be verified. 140 * be verified.
98 * 141 *
99 * B. Checksumming on output. 142 * C. Checksumming on transmit for non-GSO. The stack requests checksum offload
100 * 143 * in the skb->ip_summed for a packet. Values are:
101 * CHECKSUM_NONE:
102 *
103 * The skb was already checksummed by the protocol, or a checksum is not
104 * required.
105 * 144 *
106 * CHECKSUM_PARTIAL: 145 * CHECKSUM_PARTIAL:
107 * 146 *
108 * The device is required to checksum the packet as seen by hard_start_xmit() 147 * The driver is required to checksum the packet as seen by hard_start_xmit()
109 * from skb->csum_start up to the end, and to record/write the checksum at 148 * from skb->csum_start up to the end, and to record/write the checksum at
110 * offset skb->csum_start + skb->csum_offset. 149 * offset skb->csum_start + skb->csum_offset. A driver may verify that the
150 * csum_start and csum_offset values are valid values given the length and
151 * offset of the packet, however they should not attempt to validate that the
152 * checksum refers to a legitimate transport layer checksum-- it is the
153 * purview of the stack to validate that csum_start and csum_offset are set
154 * correctly.
155 *
156 * When the stack requests checksum offload for a packet, the driver MUST
157 * ensure that the checksum is set correctly. A driver can either offload the
158 * checksum calculation to the device, or call skb_checksum_help (in the case
159 * that the device does not support offload for a particular checksum).
160 *
161 * NETIF_F_IP_CSUM and NETIF_F_IPV6_CSUM are being deprecated in favor of
162 * NETIF_F_HW_CSUM. New devices should use NETIF_F_HW_CSUM to indicate
163 * checksum offload capability. If a device has limited checksum capabilities
164 * (for instance can only perform NETIF_F_IP_CSUM or NETIF_F_IPV6_CSUM as
165 * described above) a helper function can be called to resolve
166 * CHECKSUM_PARTIAL. The helper functions are skb_csum_off_chk*. The helper
167 * function takes a spec argument that describes the protocol layer that is
168 * supported for checksum offload and can be called for each packet. If a
169 * packet does not match the specification for offload, skb_checksum_help
170 * is called to resolve the checksum.
111 * 171 *
112 * The device must show its capabilities in dev->features, set up at device 172 * CHECKSUM_NONE:
113 * setup time, e.g. netdev_features.h:
114 * 173 *
115 * NETIF_F_HW_CSUM - It's a clever device, it's able to checksum everything. 174 * The skb was already checksummed by the protocol, or a checksum is not
116 * NETIF_F_IP_CSUM - Device is dumb, it's able to checksum only TCP/UDP over 175 * required.
117 * IPv4. Sigh. Vendors like this way for an unknown reason.
118 * Though, see comment above about CHECKSUM_UNNECESSARY. 8)
119 * NETIF_F_IPV6_CSUM - About as dumb as the last one but does IPv6 instead.
120 * NETIF_F_... - Well, you get the picture.
121 * 176 *
122 * CHECKSUM_UNNECESSARY: 177 * CHECKSUM_UNNECESSARY:
123 * 178 *
124 * Normally, the device will do per protocol specific checksumming. Protocol 179 * This has the same meaning on as CHECKSUM_NONE for checksum offload on
125 * implementations that do not want the NIC to perform the checksum 180 * output.
126 * calculation should use this flag in their outgoing skbs.
127 *
128 * NETIF_F_FCOE_CRC - This indicates that the device can do FCoE FC CRC
129 * offload. Correspondingly, the FCoE protocol driver
130 * stack should use CHECKSUM_UNNECESSARY.
131 * 181 *
132 * Any questions? No questions, good. --ANK 182 * CHECKSUM_COMPLETE:
183 * Not used in checksum output. If a driver observes a packet with this value
184 * set in skbuff, if should treat as CHECKSUM_NONE being set.
185 *
186 * D. Non-IP checksum (CRC) offloads
187 *
188 * NETIF_F_SCTP_CRC - This feature indicates that a device is capable of
189 * offloading the SCTP CRC in a packet. To perform this offload the stack
190 * will set ip_summed to CHECKSUM_PARTIAL and set csum_start and csum_offset
191 * accordingly. Note the there is no indication in the skbuff that the
192 * CHECKSUM_PARTIAL refers to an SCTP checksum, a driver that supports
193 * both IP checksum offload and SCTP CRC offload must verify which offload
194 * is configured for a packet presumably by inspecting packet headers.
195 *
196 * NETIF_F_FCOE_CRC - This feature indicates that a device is capable of
197 * offloading the FCOE CRC in a packet. To perform this offload the stack
198 * will set ip_summed to CHECKSUM_PARTIAL and set csum_start and csum_offset
199 * accordingly. Note the there is no indication in the skbuff that the
200 * CHECKSUM_PARTIAL refers to an FCOE checksum, a driver that supports
201 * both IP checksum offload and FCOE CRC offload must verify which offload
202 * is configured for a packet presumably by inspecting packet headers.
203 *
204 * E. Checksumming on output with GSO.
205 *
206 * In the case of a GSO packet (skb_is_gso(skb) is true), checksum offload
207 * is implied by the SKB_GSO_* flags in gso_type. Most obviously, if the
208 * gso_type is SKB_GSO_TCPV4 or SKB_GSO_TCPV6, TCP checksum offload as
209 * part of the GSO operation is implied. If a checksum is being offloaded
210 * with GSO then ip_summed is CHECKSUM_PARTIAL, csum_start and csum_offset
211 * are set to refer to the outermost checksum being offload (two offloaded
212 * checksums are possible with UDP encapsulation).
133 */ 213 */
134 214
135/* Don't change this without changing skb_csum_unnecessary! */ 215/* Don't change this without changing skb_csum_unnecessary! */
@@ -833,7 +913,7 @@ struct sk_buff_fclones {
833 * skb_fclone_busy - check if fclone is busy 913 * skb_fclone_busy - check if fclone is busy
834 * @skb: buffer 914 * @skb: buffer
835 * 915 *
836 * Returns true is skb is a fast clone, and its clone is not freed. 916 * Returns true if skb is a fast clone, and its clone is not freed.
837 * Some drivers call skb_orphan() in their ndo_start_xmit(), 917 * Some drivers call skb_orphan() in their ndo_start_xmit(),
838 * so we also check that this didnt happen. 918 * so we also check that this didnt happen.
839 */ 919 */
@@ -1082,9 +1162,6 @@ static inline void skb_copy_hash(struct sk_buff *to, const struct sk_buff *from)
1082 1162
1083static inline void skb_sender_cpu_clear(struct sk_buff *skb) 1163static inline void skb_sender_cpu_clear(struct sk_buff *skb)
1084{ 1164{
1085#ifdef CONFIG_XPS
1086 skb->sender_cpu = 0;
1087#endif
1088} 1165}
1089 1166
1090#ifdef NET_SKBUFF_DATA_USES_OFFSET 1167#ifdef NET_SKBUFF_DATA_USES_OFFSET
@@ -1942,6 +2019,11 @@ static inline unsigned char *skb_inner_transport_header(const struct sk_buff
1942 return skb->head + skb->inner_transport_header; 2019 return skb->head + skb->inner_transport_header;
1943} 2020}
1944 2021
2022static inline int skb_inner_transport_offset(const struct sk_buff *skb)
2023{
2024 return skb_inner_transport_header(skb) - skb->data;
2025}
2026
1945static inline void skb_reset_inner_transport_header(struct sk_buff *skb) 2027static inline void skb_reset_inner_transport_header(struct sk_buff *skb)
1946{ 2028{
1947 skb->inner_transport_header = skb->data - skb->head; 2029 skb->inner_transport_header = skb->data - skb->head;
@@ -2723,6 +2805,23 @@ static inline void skb_postpull_rcsum(struct sk_buff *skb,
2723 2805
2724unsigned char *skb_pull_rcsum(struct sk_buff *skb, unsigned int len); 2806unsigned char *skb_pull_rcsum(struct sk_buff *skb, unsigned int len);
2725 2807
2808static inline void skb_postpush_rcsum(struct sk_buff *skb,
2809 const void *start, unsigned int len)
2810{
2811 /* For performing the reverse operation to skb_postpull_rcsum(),
2812 * we can instead of ...
2813 *
2814 * skb->csum = csum_add(skb->csum, csum_partial(start, len, 0));
2815 *
2816 * ... just use this equivalent version here to save a few
2817 * instructions. Feeding csum of 0 in csum_partial() and later
2818 * on adding skb->csum is equivalent to feed skb->csum in the
2819 * first place.
2820 */
2821 if (skb->ip_summed == CHECKSUM_COMPLETE)
2822 skb->csum = csum_partial(start, len, skb->csum);
2823}
2824
2726/** 2825/**
2727 * pskb_trim_rcsum - trim received skb and update checksum 2826 * pskb_trim_rcsum - trim received skb and update checksum
2728 * @skb: buffer to trim 2827 * @skb: buffer to trim
@@ -2788,6 +2887,12 @@ static inline void skb_frag_list_init(struct sk_buff *skb)
2788#define skb_walk_frags(skb, iter) \ 2887#define skb_walk_frags(skb, iter) \
2789 for (iter = skb_shinfo(skb)->frag_list; iter; iter = iter->next) 2888 for (iter = skb_shinfo(skb)->frag_list; iter; iter = iter->next)
2790 2889
2890
2891int __skb_wait_for_more_packets(struct sock *sk, int *err, long *timeo_p,
2892 const struct sk_buff *skb);
2893struct sk_buff *__skb_try_recv_datagram(struct sock *sk, unsigned flags,
2894 int *peeked, int *off, int *err,
2895 struct sk_buff **last);
2791struct sk_buff *__skb_recv_datagram(struct sock *sk, unsigned flags, 2896struct sk_buff *__skb_recv_datagram(struct sock *sk, unsigned flags,
2792 int *peeked, int *off, int *err); 2897 int *peeked, int *off, int *err);
2793struct sk_buff *skb_recv_datagram(struct sock *sk, unsigned flags, int noblock, 2898struct sk_buff *skb_recv_datagram(struct sock *sk, unsigned flags, int noblock,
diff --git a/include/linux/soc/ti/knav_dma.h b/include/linux/soc/ti/knav_dma.h
index dad035c16d94..343c13ac4f71 100644
--- a/include/linux/soc/ti/knav_dma.h
+++ b/include/linux/soc/ti/knav_dma.h
@@ -144,17 +144,17 @@ struct knav_dma_cfg {
144 * @psdata: Protocol specific 144 * @psdata: Protocol specific
145 */ 145 */
146struct knav_dma_desc { 146struct knav_dma_desc {
147 u32 desc_info; 147 __le32 desc_info;
148 u32 tag_info; 148 __le32 tag_info;
149 u32 packet_info; 149 __le32 packet_info;
150 u32 buff_len; 150 __le32 buff_len;
151 u32 buff; 151 __le32 buff;
152 u32 next_desc; 152 __le32 next_desc;
153 u32 orig_len; 153 __le32 orig_len;
154 u32 orig_buff; 154 __le32 orig_buff;
155 u32 epib[KNAV_DMA_NUM_EPIB_WORDS]; 155 __le32 epib[KNAV_DMA_NUM_EPIB_WORDS];
156 u32 psdata[KNAV_DMA_NUM_PS_WORDS]; 156 __le32 psdata[KNAV_DMA_NUM_PS_WORDS];
157 u32 pad[4]; 157 __le32 pad[4];
158} ____cacheline_aligned; 158} ____cacheline_aligned;
159 159
160#if IS_ENABLED(CONFIG_KEYSTONE_NAVIGATOR_DMA) 160#if IS_ENABLED(CONFIG_KEYSTONE_NAVIGATOR_DMA)
diff --git a/include/linux/sock_diag.h b/include/linux/sock_diag.h
index fddebc617469..4018b48f2b3b 100644
--- a/include/linux/sock_diag.h
+++ b/include/linux/sock_diag.h
@@ -15,6 +15,7 @@ struct sock_diag_handler {
15 __u8 family; 15 __u8 family;
16 int (*dump)(struct sk_buff *skb, struct nlmsghdr *nlh); 16 int (*dump)(struct sk_buff *skb, struct nlmsghdr *nlh);
17 int (*get_info)(struct sk_buff *skb, struct sock *sk); 17 int (*get_info)(struct sk_buff *skb, struct sock *sk);
18 int (*destroy)(struct sk_buff *skb, struct nlmsghdr *nlh);
18}; 19};
19 20
20int sock_diag_register(const struct sock_diag_handler *h); 21int sock_diag_register(const struct sock_diag_handler *h);
@@ -68,4 +69,5 @@ bool sock_diag_has_destroy_listeners(const struct sock *sk)
68} 69}
69void sock_diag_broadcast_destroy(struct sock *sk); 70void sock_diag_broadcast_destroy(struct sock *sk);
70 71
72int sock_diag_destroy(struct sock *sk, int err);
71#endif 73#endif
diff --git a/include/linux/ssb/ssb.h b/include/linux/ssb/ssb.h
index c3d1a525bacc..26a0b3c3ce5f 100644
--- a/include/linux/ssb/ssb.h
+++ b/include/linux/ssb/ssb.h
@@ -524,13 +524,9 @@ struct ssb_init_invariants {
524typedef int (*ssb_invariants_func_t)(struct ssb_bus *bus, 524typedef int (*ssb_invariants_func_t)(struct ssb_bus *bus,
525 struct ssb_init_invariants *iv); 525 struct ssb_init_invariants *iv);
526 526
527/* Register a SSB system bus. get_invariants() is called after the 527/* Register SoC bus. */
528 * basic system devices are initialized. 528extern int ssb_bus_host_soc_register(struct ssb_bus *bus,
529 * The invariants are usually fetched from some NVRAM. 529 unsigned long baseaddr);
530 * Put the invariants into the struct pointed to by iv. */
531extern int ssb_bus_ssbbus_register(struct ssb_bus *bus,
532 unsigned long baseaddr,
533 ssb_invariants_func_t get_invariants);
534#ifdef CONFIG_SSB_PCIHOST 530#ifdef CONFIG_SSB_PCIHOST
535extern int ssb_bus_pcibus_register(struct ssb_bus *bus, 531extern int ssb_bus_pcibus_register(struct ssb_bus *bus,
536 struct pci_dev *host_pci); 532 struct pci_dev *host_pci);
diff --git a/include/linux/wait.h b/include/linux/wait.h
index d2f4ec7dba7c..ae71a769b89e 100644
--- a/include/linux/wait.h
+++ b/include/linux/wait.h
@@ -137,6 +137,27 @@ static inline int waitqueue_active(wait_queue_head_t *q)
137 return !list_empty(&q->task_list); 137 return !list_empty(&q->task_list);
138} 138}
139 139
140/**
141 * wq_has_sleeper - check if there are any waiting processes
142 * @wq: wait queue head
143 *
144 * Returns true if wq has waiting processes
145 *
146 * Please refer to the comment for waitqueue_active.
147 */
148static inline bool wq_has_sleeper(wait_queue_head_t *wq)
149{
150 /*
151 * We need to be sure we are in sync with the
152 * add_wait_queue modifications to the wait queue.
153 *
154 * This memory barrier should be paired with one on the
155 * waiting side.
156 */
157 smp_mb();
158 return waitqueue_active(wq);
159}
160
140extern void add_wait_queue(wait_queue_head_t *q, wait_queue_t *wait); 161extern void add_wait_queue(wait_queue_head_t *q, wait_queue_t *wait);
141extern void add_wait_queue_exclusive(wait_queue_head_t *q, wait_queue_t *wait); 162extern void add_wait_queue_exclusive(wait_queue_head_t *q, wait_queue_t *wait);
142extern void remove_wait_queue(wait_queue_head_t *q, wait_queue_t *wait); 163extern void remove_wait_queue(wait_queue_head_t *q, wait_queue_t *wait);
diff --git a/include/net/6lowpan.h b/include/net/6lowpan.h
index cf3bc564ac03..2f6a3f2233ed 100644
--- a/include/net/6lowpan.h
+++ b/include/net/6lowpan.h
@@ -53,6 +53,8 @@
53#ifndef __6LOWPAN_H__ 53#ifndef __6LOWPAN_H__
54#define __6LOWPAN_H__ 54#define __6LOWPAN_H__
55 55
56#include <linux/debugfs.h>
57
56#include <net/ipv6.h> 58#include <net/ipv6.h>
57#include <net/net_namespace.h> 59#include <net/net_namespace.h>
58 60
@@ -98,6 +100,7 @@ enum lowpan_lltypes {
98 100
99struct lowpan_priv { 101struct lowpan_priv {
100 enum lowpan_lltypes lltype; 102 enum lowpan_lltypes lltype;
103 struct dentry *iface_debugfs;
101 104
102 /* must be last */ 105 /* must be last */
103 u8 priv[0] __aligned(sizeof(void *)); 106 u8 priv[0] __aligned(sizeof(void *));
@@ -185,7 +188,12 @@ static inline void lowpan_push_hc_data(u8 **hc_ptr, const void *data,
185 *hc_ptr += len; 188 *hc_ptr += len;
186} 189}
187 190
188void lowpan_netdev_setup(struct net_device *dev, enum lowpan_lltypes lltype); 191int lowpan_register_netdevice(struct net_device *dev,
192 enum lowpan_lltypes lltype);
193int lowpan_register_netdev(struct net_device *dev,
194 enum lowpan_lltypes lltype);
195void lowpan_unregister_netdevice(struct net_device *dev);
196void lowpan_unregister_netdev(struct net_device *dev);
189 197
190/** 198/**
191 * lowpan_header_decompress - replace 6LoWPAN header with IPv6 header 199 * lowpan_header_decompress - replace 6LoWPAN header with IPv6 header
diff --git a/include/net/addrconf.h b/include/net/addrconf.h
index 78003dfb8539..47f52d3cd8df 100644
--- a/include/net/addrconf.h
+++ b/include/net/addrconf.h
@@ -87,7 +87,8 @@ int __ipv6_get_lladdr(struct inet6_dev *idev, struct in6_addr *addr,
87 u32 banned_flags); 87 u32 banned_flags);
88int ipv6_get_lladdr(struct net_device *dev, struct in6_addr *addr, 88int ipv6_get_lladdr(struct net_device *dev, struct in6_addr *addr,
89 u32 banned_flags); 89 u32 banned_flags);
90int ipv6_rcv_saddr_equal(const struct sock *sk, const struct sock *sk2); 90int ipv6_rcv_saddr_equal(const struct sock *sk, const struct sock *sk2,
91 bool match_wildcard);
91void addrconf_join_solict(struct net_device *dev, const struct in6_addr *addr); 92void addrconf_join_solict(struct net_device *dev, const struct in6_addr *addr);
92void addrconf_leave_solict(struct inet6_dev *idev, const struct in6_addr *addr); 93void addrconf_leave_solict(struct inet6_dev *idev, const struct in6_addr *addr);
93 94
diff --git a/include/net/bluetooth/bluetooth.h b/include/net/bluetooth/bluetooth.h
index 42844d7b154a..bfd1590821d6 100644
--- a/include/net/bluetooth/bluetooth.h
+++ b/include/net/bluetooth/bluetooth.h
@@ -29,6 +29,8 @@
29#include <net/sock.h> 29#include <net/sock.h>
30#include <linux/seq_file.h> 30#include <linux/seq_file.h>
31 31
32#define BT_SUBSYS_VERSION "2.21"
33
32#ifndef AF_BLUETOOTH 34#ifndef AF_BLUETOOTH
33#define AF_BLUETOOTH 31 35#define AF_BLUETOOTH 31
34#define PF_BLUETOOTH AF_BLUETOOTH 36#define PF_BLUETOOTH AF_BLUETOOTH
@@ -296,12 +298,17 @@ typedef void (*hci_req_complete_t)(struct hci_dev *hdev, u8 status, u16 opcode);
296typedef void (*hci_req_complete_skb_t)(struct hci_dev *hdev, u8 status, 298typedef void (*hci_req_complete_skb_t)(struct hci_dev *hdev, u8 status,
297 u16 opcode, struct sk_buff *skb); 299 u16 opcode, struct sk_buff *skb);
298 300
301#define HCI_REQ_START BIT(0)
302#define HCI_REQ_SKB BIT(1)
303
299struct hci_ctrl { 304struct hci_ctrl {
300 __u16 opcode; 305 __u16 opcode;
301 bool req_start; 306 u8 req_flags;
302 u8 req_event; 307 u8 req_event;
303 hci_req_complete_t req_complete; 308 union {
304 hci_req_complete_skb_t req_complete_skb; 309 hci_req_complete_t req_complete;
310 hci_req_complete_skb_t req_complete_skb;
311 };
305}; 312};
306 313
307struct bt_skb_cb { 314struct bt_skb_cb {
@@ -316,15 +323,17 @@ struct bt_skb_cb {
316}; 323};
317#define bt_cb(skb) ((struct bt_skb_cb *)((skb)->cb)) 324#define bt_cb(skb) ((struct bt_skb_cb *)((skb)->cb))
318 325
326#define hci_skb_pkt_type(skb) bt_cb((skb))->pkt_type
327#define hci_skb_expect(skb) bt_cb((skb))->expect
328#define hci_skb_opcode(skb) bt_cb((skb))->hci.opcode
329
319static inline struct sk_buff *bt_skb_alloc(unsigned int len, gfp_t how) 330static inline struct sk_buff *bt_skb_alloc(unsigned int len, gfp_t how)
320{ 331{
321 struct sk_buff *skb; 332 struct sk_buff *skb;
322 333
323 skb = alloc_skb(len + BT_SKB_RESERVE, how); 334 skb = alloc_skb(len + BT_SKB_RESERVE, how);
324 if (skb) { 335 if (skb)
325 skb_reserve(skb, BT_SKB_RESERVE); 336 skb_reserve(skb, BT_SKB_RESERVE);
326 bt_cb(skb)->incoming = 0;
327 }
328 return skb; 337 return skb;
329} 338}
330 339
@@ -334,10 +343,8 @@ static inline struct sk_buff *bt_skb_send_alloc(struct sock *sk,
334 struct sk_buff *skb; 343 struct sk_buff *skb;
335 344
336 skb = sock_alloc_send_skb(sk, len + BT_SKB_RESERVE, nb, err); 345 skb = sock_alloc_send_skb(sk, len + BT_SKB_RESERVE, nb, err);
337 if (skb) { 346 if (skb)
338 skb_reserve(skb, BT_SKB_RESERVE); 347 skb_reserve(skb, BT_SKB_RESERVE);
339 bt_cb(skb)->incoming = 0;
340 }
341 348
342 if (!skb && *err) 349 if (!skb && *err)
343 return NULL; 350 return NULL;
diff --git a/include/net/bluetooth/hci.h b/include/net/bluetooth/hci.h
index 0205b80cc90b..339ea57be423 100644
--- a/include/net/bluetooth/hci.h
+++ b/include/net/bluetooth/hci.h
@@ -239,7 +239,6 @@ enum {
239 HCI_LE_ENABLED, 239 HCI_LE_ENABLED,
240 HCI_ADVERTISING, 240 HCI_ADVERTISING,
241 HCI_ADVERTISING_CONNECTABLE, 241 HCI_ADVERTISING_CONNECTABLE,
242 HCI_ADVERTISING_INSTANCE,
243 HCI_CONNECTABLE, 242 HCI_CONNECTABLE,
244 HCI_DISCOVERABLE, 243 HCI_DISCOVERABLE,
245 HCI_LIMITED_DISCOVERABLE, 244 HCI_LIMITED_DISCOVERABLE,
@@ -452,7 +451,8 @@ enum {
452#define HCI_ERROR_REMOTE_POWER_OFF 0x15 451#define HCI_ERROR_REMOTE_POWER_OFF 0x15
453#define HCI_ERROR_LOCAL_HOST_TERM 0x16 452#define HCI_ERROR_LOCAL_HOST_TERM 0x16
454#define HCI_ERROR_PAIRING_NOT_ALLOWED 0x18 453#define HCI_ERROR_PAIRING_NOT_ALLOWED 0x18
455#define HCI_ERROR_INVALID_LL_PARAMS 0x1E 454#define HCI_ERROR_INVALID_LL_PARAMS 0x1e
455#define HCI_ERROR_UNSPECIFIED 0x1f
456#define HCI_ERROR_ADVERTISING_TIMEOUT 0x3c 456#define HCI_ERROR_ADVERTISING_TIMEOUT 0x3c
457 457
458/* Flow control modes */ 458/* Flow control modes */
diff --git a/include/net/bluetooth/hci_core.h b/include/net/bluetooth/hci_core.h
index 1878d0a96333..d4f82edb5cff 100644
--- a/include/net/bluetooth/hci_core.h
+++ b/include/net/bluetooth/hci_core.h
@@ -77,6 +77,7 @@ struct discovery_state {
77 u8 last_adv_data_len; 77 u8 last_adv_data_len;
78 bool report_invalid_rssi; 78 bool report_invalid_rssi;
79 bool result_filtering; 79 bool result_filtering;
80 bool limited;
80 s8 rssi; 81 s8 rssi;
81 u16 uuid_count; 82 u16 uuid_count;
82 u8 (*uuids)[16]; 83 u8 (*uuids)[16];
@@ -327,6 +328,14 @@ struct hci_dev {
327 struct work_struct cmd_work; 328 struct work_struct cmd_work;
328 struct work_struct tx_work; 329 struct work_struct tx_work;
329 330
331 struct work_struct discov_update;
332 struct work_struct bg_scan_update;
333 struct work_struct scan_update;
334 struct work_struct connectable_update;
335 struct work_struct discoverable_update;
336 struct delayed_work le_scan_disable;
337 struct delayed_work le_scan_restart;
338
330 struct sk_buff_head rx_q; 339 struct sk_buff_head rx_q;
331 struct sk_buff_head raw_q; 340 struct sk_buff_head raw_q;
332 struct sk_buff_head cmd_q; 341 struct sk_buff_head cmd_q;
@@ -370,9 +379,6 @@ struct hci_dev {
370 379
371 DECLARE_BITMAP(dev_flags, __HCI_NUM_FLAGS); 380 DECLARE_BITMAP(dev_flags, __HCI_NUM_FLAGS);
372 381
373 struct delayed_work le_scan_disable;
374 struct delayed_work le_scan_restart;
375
376 __s8 adv_tx_power; 382 __s8 adv_tx_power;
377 __u8 adv_data[HCI_MAX_AD_LENGTH]; 383 __u8 adv_data[HCI_MAX_AD_LENGTH];
378 __u8 adv_data_len; 384 __u8 adv_data_len;
@@ -875,7 +881,7 @@ struct hci_chan *hci_chan_lookup_handle(struct hci_dev *hdev, __u16 handle);
875 881
876struct hci_conn *hci_connect_le_scan(struct hci_dev *hdev, bdaddr_t *dst, 882struct hci_conn *hci_connect_le_scan(struct hci_dev *hdev, bdaddr_t *dst,
877 u8 dst_type, u8 sec_level, 883 u8 dst_type, u8 sec_level,
878 u16 conn_timeout, u8 role); 884 u16 conn_timeout);
879struct hci_conn *hci_connect_le(struct hci_dev *hdev, bdaddr_t *dst, 885struct hci_conn *hci_connect_le(struct hci_dev *hdev, bdaddr_t *dst,
880 u8 dst_type, u8 sec_level, u16 conn_timeout, 886 u8 dst_type, u8 sec_level, u16 conn_timeout,
881 u8 role); 887 u8 role);
@@ -1036,7 +1042,6 @@ struct hci_conn_params *hci_conn_params_lookup(struct hci_dev *hdev,
1036struct hci_conn_params *hci_conn_params_add(struct hci_dev *hdev, 1042struct hci_conn_params *hci_conn_params_add(struct hci_dev *hdev,
1037 bdaddr_t *addr, u8 addr_type); 1043 bdaddr_t *addr, u8 addr_type);
1038void hci_conn_params_del(struct hci_dev *hdev, bdaddr_t *addr, u8 addr_type); 1044void hci_conn_params_del(struct hci_dev *hdev, bdaddr_t *addr, u8 addr_type);
1039void hci_conn_params_clear_all(struct hci_dev *hdev);
1040void hci_conn_params_clear_disabled(struct hci_dev *hdev); 1045void hci_conn_params_clear_disabled(struct hci_dev *hdev);
1041 1046
1042struct hci_conn_params *hci_pend_le_action_lookup(struct list_head *list, 1047struct hci_conn_params *hci_pend_le_action_lookup(struct list_head *list,
@@ -1279,31 +1284,41 @@ static inline void hci_role_switch_cfm(struct hci_conn *conn, __u8 status,
1279 mutex_unlock(&hci_cb_list_lock); 1284 mutex_unlock(&hci_cb_list_lock);
1280} 1285}
1281 1286
1282static inline bool eir_has_data_type(u8 *data, size_t data_len, u8 type) 1287static inline void *eir_get_data(u8 *eir, size_t eir_len, u8 type,
1288 size_t *data_len)
1283{ 1289{
1284 size_t parsed = 0; 1290 size_t parsed = 0;
1285 1291
1286 if (data_len < 2) 1292 if (eir_len < 2)
1287 return false; 1293 return NULL;
1288 1294
1289 while (parsed < data_len - 1) { 1295 while (parsed < eir_len - 1) {
1290 u8 field_len = data[0]; 1296 u8 field_len = eir[0];
1291 1297
1292 if (field_len == 0) 1298 if (field_len == 0)
1293 break; 1299 break;
1294 1300
1295 parsed += field_len + 1; 1301 parsed += field_len + 1;
1296 1302
1297 if (parsed > data_len) 1303 if (parsed > eir_len)
1298 break; 1304 break;
1299 1305
1300 if (data[1] == type) 1306 if (eir[1] != type) {
1301 return true; 1307 eir += field_len + 1;
1308 continue;
1309 }
1310
1311 /* Zero length data */
1312 if (field_len == 1)
1313 return NULL;
1302 1314
1303 data += field_len + 1; 1315 if (data_len)
1316 *data_len = field_len - 1;
1317
1318 return &eir[2];
1304 } 1319 }
1305 1320
1306 return false; 1321 return NULL;
1307} 1322}
1308 1323
1309static inline bool hci_bdaddr_is_rpa(bdaddr_t *bdaddr, u8 addr_type) 1324static inline bool hci_bdaddr_is_rpa(bdaddr_t *bdaddr, u8 addr_type)
@@ -1431,10 +1446,8 @@ int mgmt_new_settings(struct hci_dev *hdev);
1431void mgmt_index_added(struct hci_dev *hdev); 1446void mgmt_index_added(struct hci_dev *hdev);
1432void mgmt_index_removed(struct hci_dev *hdev); 1447void mgmt_index_removed(struct hci_dev *hdev);
1433void mgmt_set_powered_failed(struct hci_dev *hdev, int err); 1448void mgmt_set_powered_failed(struct hci_dev *hdev, int err);
1434int mgmt_powered(struct hci_dev *hdev, u8 powered); 1449void mgmt_power_on(struct hci_dev *hdev, int err);
1435int mgmt_update_adv_data(struct hci_dev *hdev); 1450void __mgmt_power_off(struct hci_dev *hdev);
1436void mgmt_discoverable_timeout(struct hci_dev *hdev);
1437void mgmt_adv_timeout_expired(struct hci_dev *hdev);
1438void mgmt_new_link_key(struct hci_dev *hdev, struct link_key *key, 1451void mgmt_new_link_key(struct hci_dev *hdev, struct link_key *key,
1439 bool persistent); 1452 bool persistent);
1440void mgmt_device_connected(struct hci_dev *hdev, struct hci_conn *conn, 1453void mgmt_device_connected(struct hci_dev *hdev, struct hci_conn *conn,
@@ -1473,6 +1486,8 @@ void mgmt_ssp_enable_complete(struct hci_dev *hdev, u8 enable, u8 status);
1473void mgmt_set_class_of_dev_complete(struct hci_dev *hdev, u8 *dev_class, 1486void mgmt_set_class_of_dev_complete(struct hci_dev *hdev, u8 *dev_class,
1474 u8 status); 1487 u8 status);
1475void mgmt_set_local_name_complete(struct hci_dev *hdev, u8 *name, u8 status); 1488void mgmt_set_local_name_complete(struct hci_dev *hdev, u8 *name, u8 status);
1489void mgmt_start_discovery_complete(struct hci_dev *hdev, u8 status);
1490void mgmt_stop_discovery_complete(struct hci_dev *hdev, u8 status);
1476void mgmt_device_found(struct hci_dev *hdev, bdaddr_t *bdaddr, u8 link_type, 1491void mgmt_device_found(struct hci_dev *hdev, bdaddr_t *bdaddr, u8 link_type,
1477 u8 addr_type, u8 *dev_class, s8 rssi, u32 flags, 1492 u8 addr_type, u8 *dev_class, s8 rssi, u32 flags,
1478 u8 *eir, u16 eir_len, u8 *scan_rsp, u8 scan_rsp_len); 1493 u8 *eir, u16 eir_len, u8 *scan_rsp, u8 scan_rsp_len);
@@ -1487,8 +1502,15 @@ void mgmt_new_csrk(struct hci_dev *hdev, struct smp_csrk *csrk,
1487void mgmt_new_conn_param(struct hci_dev *hdev, bdaddr_t *bdaddr, 1502void mgmt_new_conn_param(struct hci_dev *hdev, bdaddr_t *bdaddr,
1488 u8 bdaddr_type, u8 store_hint, u16 min_interval, 1503 u8 bdaddr_type, u8 store_hint, u16 min_interval,
1489 u16 max_interval, u16 latency, u16 timeout); 1504 u16 max_interval, u16 latency, u16 timeout);
1490void mgmt_reenable_advertising(struct hci_dev *hdev);
1491void mgmt_smp_complete(struct hci_conn *conn, bool complete); 1505void mgmt_smp_complete(struct hci_conn *conn, bool complete);
1506bool mgmt_get_connectable(struct hci_dev *hdev);
1507void mgmt_set_connectable_complete(struct hci_dev *hdev, u8 status);
1508void mgmt_set_discoverable_complete(struct hci_dev *hdev, u8 status);
1509u8 mgmt_get_adv_discov_flags(struct hci_dev *hdev);
1510void mgmt_advertising_added(struct sock *sk, struct hci_dev *hdev,
1511 u8 instance);
1512void mgmt_advertising_removed(struct sock *sk, struct hci_dev *hdev,
1513 u8 instance);
1492 1514
1493u8 hci_le_conn_update(struct hci_conn *conn, u16 min, u16 max, u16 latency, 1515u8 hci_le_conn_update(struct hci_conn *conn, u16 min, u16 max, u16 latency,
1494 u16 to_multiplier); 1516 u16 to_multiplier);
diff --git a/include/net/bluetooth/hci_mon.h b/include/net/bluetooth/hci_mon.h
index 2b67567cf28d..587d0131b349 100644
--- a/include/net/bluetooth/hci_mon.h
+++ b/include/net/bluetooth/hci_mon.h
@@ -43,6 +43,8 @@ struct hci_mon_hdr {
43#define HCI_MON_CLOSE_INDEX 9 43#define HCI_MON_CLOSE_INDEX 9
44#define HCI_MON_INDEX_INFO 10 44#define HCI_MON_INDEX_INFO 10
45#define HCI_MON_VENDOR_DIAG 11 45#define HCI_MON_VENDOR_DIAG 11
46#define HCI_MON_SYSTEM_NOTE 12
47#define HCI_MON_USER_LOGGING 13
46 48
47struct hci_mon_new_index { 49struct hci_mon_new_index {
48 __u8 type; 50 __u8 type;
diff --git a/include/net/bluetooth/hci_sock.h b/include/net/bluetooth/hci_sock.h
index 9a46d665c1b5..8e9138acdae1 100644
--- a/include/net/bluetooth/hci_sock.h
+++ b/include/net/bluetooth/hci_sock.h
@@ -45,6 +45,7 @@ struct sockaddr_hci {
45#define HCI_CHANNEL_USER 1 45#define HCI_CHANNEL_USER 1
46#define HCI_CHANNEL_MONITOR 2 46#define HCI_CHANNEL_MONITOR 2
47#define HCI_CHANNEL_CONTROL 3 47#define HCI_CHANNEL_CONTROL 3
48#define HCI_CHANNEL_LOGGING 4
48 49
49struct hci_filter { 50struct hci_filter {
50 unsigned long type_mask; 51 unsigned long type_mask;
diff --git a/include/net/bluetooth/mgmt.h b/include/net/bluetooth/mgmt.h
index b831242d48a4..ea73e0826aa7 100644
--- a/include/net/bluetooth/mgmt.h
+++ b/include/net/bluetooth/mgmt.h
@@ -571,6 +571,21 @@ struct mgmt_rp_remove_advertising {
571 __u8 instance; 571 __u8 instance;
572} __packed; 572} __packed;
573 573
574#define MGMT_OP_GET_ADV_SIZE_INFO 0x0040
575struct mgmt_cp_get_adv_size_info {
576 __u8 instance;
577 __le32 flags;
578} __packed;
579#define MGMT_GET_ADV_SIZE_INFO_SIZE 5
580struct mgmt_rp_get_adv_size_info {
581 __u8 instance;
582 __le32 flags;
583 __u8 max_adv_data_len;
584 __u8 max_scan_rsp_len;
585} __packed;
586
587#define MGMT_OP_START_LIMITED_DISCOVERY 0x0041
588
574#define MGMT_EV_CMD_COMPLETE 0x0001 589#define MGMT_EV_CMD_COMPLETE 0x0001
575struct mgmt_ev_cmd_complete { 590struct mgmt_ev_cmd_complete {
576 __le16 opcode; 591 __le16 opcode;
diff --git a/include/net/bonding.h b/include/net/bonding.h
index c1740a2794a3..ee6c52053aa3 100644
--- a/include/net/bonding.h
+++ b/include/net/bonding.h
@@ -165,7 +165,8 @@ struct slave {
165 u8 backup:1, /* indicates backup slave. Value corresponds with 165 u8 backup:1, /* indicates backup slave. Value corresponds with
166 BOND_STATE_ACTIVE and BOND_STATE_BACKUP */ 166 BOND_STATE_ACTIVE and BOND_STATE_BACKUP */
167 inactive:1, /* indicates inactive slave */ 167 inactive:1, /* indicates inactive slave */
168 should_notify:1; /* indicateds whether the state changed */ 168 should_notify:1, /* indicates whether the state changed */
169 should_notify_link:1; /* indicates whether the link changed */
169 u8 duplex; 170 u8 duplex;
170 u32 original_mtu; 171 u32 original_mtu;
171 u32 link_failure_count; 172 u32 link_failure_count;
@@ -246,6 +247,7 @@ struct bonding {
246 ((struct slave *) rtnl_dereference(dev->rx_handler_data)) 247 ((struct slave *) rtnl_dereference(dev->rx_handler_data))
247 248
248void bond_queue_slave_event(struct slave *slave); 249void bond_queue_slave_event(struct slave *slave);
250void bond_lower_state_changed(struct slave *slave);
249 251
250struct bond_vlan_tag { 252struct bond_vlan_tag {
251 __be16 vlan_proto; 253 __be16 vlan_proto;
@@ -327,6 +329,7 @@ static inline void bond_set_active_slave(struct slave *slave)
327 if (slave->backup) { 329 if (slave->backup) {
328 slave->backup = 0; 330 slave->backup = 0;
329 bond_queue_slave_event(slave); 331 bond_queue_slave_event(slave);
332 bond_lower_state_changed(slave);
330 rtmsg_ifinfo(RTM_NEWLINK, slave->dev, 0, GFP_ATOMIC); 333 rtmsg_ifinfo(RTM_NEWLINK, slave->dev, 0, GFP_ATOMIC);
331 } 334 }
332} 335}
@@ -336,6 +339,7 @@ static inline void bond_set_backup_slave(struct slave *slave)
336 if (!slave->backup) { 339 if (!slave->backup) {
337 slave->backup = 1; 340 slave->backup = 1;
338 bond_queue_slave_event(slave); 341 bond_queue_slave_event(slave);
342 bond_lower_state_changed(slave);
339 rtmsg_ifinfo(RTM_NEWLINK, slave->dev, 0, GFP_ATOMIC); 343 rtmsg_ifinfo(RTM_NEWLINK, slave->dev, 0, GFP_ATOMIC);
340 } 344 }
341} 345}
@@ -348,6 +352,7 @@ static inline void bond_set_slave_state(struct slave *slave,
348 352
349 slave->backup = slave_state; 353 slave->backup = slave_state;
350 if (notify) { 354 if (notify) {
355 bond_lower_state_changed(slave);
351 rtmsg_ifinfo(RTM_NEWLINK, slave->dev, 0, GFP_ATOMIC); 356 rtmsg_ifinfo(RTM_NEWLINK, slave->dev, 0, GFP_ATOMIC);
352 bond_queue_slave_event(slave); 357 bond_queue_slave_event(slave);
353 slave->should_notify = 0; 358 slave->should_notify = 0;
@@ -379,6 +384,7 @@ static inline void bond_slave_state_notify(struct bonding *bond)
379 384
380 bond_for_each_slave(bond, tmp, iter) { 385 bond_for_each_slave(bond, tmp, iter) {
381 if (tmp->should_notify) { 386 if (tmp->should_notify) {
387 bond_lower_state_changed(tmp);
382 rtmsg_ifinfo(RTM_NEWLINK, tmp->dev, 0, GFP_ATOMIC); 388 rtmsg_ifinfo(RTM_NEWLINK, tmp->dev, 0, GFP_ATOMIC);
383 tmp->should_notify = 0; 389 tmp->should_notify = 0;
384 } 390 }
@@ -504,10 +510,37 @@ static inline bool bond_is_slave_inactive(struct slave *slave)
504 return slave->inactive; 510 return slave->inactive;
505} 511}
506 512
507static inline void bond_set_slave_link_state(struct slave *slave, int state) 513static inline void bond_set_slave_link_state(struct slave *slave, int state,
514 bool notify)
508{ 515{
516 if (slave->link == state)
517 return;
518
509 slave->link = state; 519 slave->link = state;
510 bond_queue_slave_event(slave); 520 if (notify) {
521 bond_queue_slave_event(slave);
522 bond_lower_state_changed(slave);
523 slave->should_notify_link = 0;
524 } else {
525 if (slave->should_notify_link)
526 slave->should_notify_link = 0;
527 else
528 slave->should_notify_link = 1;
529 }
530}
531
532static inline void bond_slave_link_notify(struct bonding *bond)
533{
534 struct list_head *iter;
535 struct slave *tmp;
536
537 bond_for_each_slave(bond, tmp, iter) {
538 if (tmp->should_notify_link) {
539 bond_queue_slave_event(tmp);
540 bond_lower_state_changed(tmp);
541 tmp->should_notify_link = 0;
542 }
543 }
511} 544}
512 545
513static inline __be32 bond_confirm_addr(struct net_device *dev, __be32 dst, __be32 local) 546static inline __be32 bond_confirm_addr(struct net_device *dev, __be32 dst, __be32 local)
diff --git a/include/net/busy_poll.h b/include/net/busy_poll.h
index 1d67fb6b23a0..2fbeb1313c0f 100644
--- a/include/net/busy_poll.h
+++ b/include/net/busy_poll.h
@@ -72,50 +72,7 @@ static inline bool busy_loop_timeout(unsigned long end_time)
72 return time_after(now, end_time); 72 return time_after(now, end_time);
73} 73}
74 74
75/* when used in sock_poll() nonblock is known at compile time to be true 75bool sk_busy_loop(struct sock *sk, int nonblock);
76 * so the loop and end_time will be optimized out
77 */
78static inline bool sk_busy_loop(struct sock *sk, int nonblock)
79{
80 unsigned long end_time = !nonblock ? sk_busy_loop_end_time(sk) : 0;
81 const struct net_device_ops *ops;
82 struct napi_struct *napi;
83 int rc = false;
84
85 /*
86 * rcu read lock for napi hash
87 * bh so we don't race with net_rx_action
88 */
89 rcu_read_lock_bh();
90
91 napi = napi_by_id(sk->sk_napi_id);
92 if (!napi)
93 goto out;
94
95 ops = napi->dev->netdev_ops;
96 if (!ops->ndo_busy_poll)
97 goto out;
98
99 do {
100 rc = ops->ndo_busy_poll(napi);
101
102 if (rc == LL_FLUSH_FAILED)
103 break; /* permanent failure */
104
105 if (rc > 0)
106 /* local bh are disabled so it is ok to use _BH */
107 NET_ADD_STATS_BH(sock_net(sk),
108 LINUX_MIB_BUSYPOLLRXPACKETS, rc);
109 cpu_relax();
110
111 } while (!nonblock && skb_queue_empty(&sk->sk_receive_queue) &&
112 !need_resched() && !busy_loop_timeout(end_time));
113
114 rc = !skb_queue_empty(&sk->sk_receive_queue);
115out:
116 rcu_read_unlock_bh();
117 return rc;
118}
119 76
120/* used in the NIC receive handler to mark the skb */ 77/* used in the NIC receive handler to mark the skb */
121static inline void skb_mark_napi_id(struct sk_buff *skb, 78static inline void skb_mark_napi_id(struct sk_buff *skb,
diff --git a/include/net/cfg80211.h b/include/net/cfg80211.h
index 2c7bdb81d30c..9bcaaf7cd15a 100644
--- a/include/net/cfg80211.h
+++ b/include/net/cfg80211.h
@@ -2321,6 +2321,8 @@ struct cfg80211_qos_map {
2321 * the driver, and will be valid until passed to cfg80211_scan_done(). 2321 * the driver, and will be valid until passed to cfg80211_scan_done().
2322 * For scan results, call cfg80211_inform_bss(); you can call this outside 2322 * For scan results, call cfg80211_inform_bss(); you can call this outside
2323 * the scan/scan_done bracket too. 2323 * the scan/scan_done bracket too.
2324 * @abort_scan: Tell the driver to abort an ongoing scan. The driver shall
2325 * indicate the status of the scan through cfg80211_scan_done().
2324 * 2326 *
2325 * @auth: Request to authenticate with the specified peer 2327 * @auth: Request to authenticate with the specified peer
2326 * (invoked with the wireless_dev mutex held) 2328 * (invoked with the wireless_dev mutex held)
@@ -2593,6 +2595,7 @@ struct cfg80211_ops {
2593 2595
2594 int (*scan)(struct wiphy *wiphy, 2596 int (*scan)(struct wiphy *wiphy,
2595 struct cfg80211_scan_request *request); 2597 struct cfg80211_scan_request *request);
2598 void (*abort_scan)(struct wiphy *wiphy, struct wireless_dev *wdev);
2596 2599
2597 int (*auth)(struct wiphy *wiphy, struct net_device *dev, 2600 int (*auth)(struct wiphy *wiphy, struct net_device *dev,
2598 struct cfg80211_auth_request *req); 2601 struct cfg80211_auth_request *req);
@@ -5173,8 +5176,11 @@ size_t ieee80211_ie_split_ric(const u8 *ies, size_t ielen,
5173 * buffer starts, which may be @ielen if the entire (remainder) 5176 * buffer starts, which may be @ielen if the entire (remainder)
5174 * of the buffer should be used. 5177 * of the buffer should be used.
5175 */ 5178 */
5176size_t ieee80211_ie_split(const u8 *ies, size_t ielen, 5179static inline size_t ieee80211_ie_split(const u8 *ies, size_t ielen,
5177 const u8 *ids, int n_ids, size_t offset); 5180 const u8 *ids, int n_ids, size_t offset)
5181{
5182 return ieee80211_ie_split_ric(ies, ielen, ids, n_ids, NULL, 0, offset);
5183}
5178 5184
5179/** 5185/**
5180 * cfg80211_report_wowlan_wakeup - report wakeup from WoWLAN 5186 * cfg80211_report_wowlan_wakeup - report wakeup from WoWLAN
diff --git a/include/net/checksum.h b/include/net/checksum.h
index 9fcaedf994ee..10a16b5bd1c7 100644
--- a/include/net/checksum.h
+++ b/include/net/checksum.h
@@ -165,7 +165,8 @@ static inline __wsum remcsum_adjust(void *ptr, __wsum csum,
165 csum = csum_sub(csum, csum_partial(ptr, start, 0)); 165 csum = csum_sub(csum, csum_partial(ptr, start, 0));
166 166
167 /* Set derived checksum in packet */ 167 /* Set derived checksum in packet */
168 delta = csum_sub(csum_fold(csum), *psum); 168 delta = csum_sub((__force __wsum)csum_fold(csum),
169 (__force __wsum)*psum);
169 *psum = csum_fold(csum); 170 *psum = csum_fold(csum);
170 171
171 return delta; 172 return delta;
diff --git a/include/net/cls_cgroup.h b/include/net/cls_cgroup.h
index ccd6d8bffa4d..c0a92e2c286d 100644
--- a/include/net/cls_cgroup.h
+++ b/include/net/cls_cgroup.h
@@ -41,13 +41,12 @@ static inline u32 task_cls_classid(struct task_struct *p)
41 return classid; 41 return classid;
42} 42}
43 43
44static inline void sock_update_classid(struct sock *sk) 44static inline void sock_update_classid(struct sock_cgroup_data *skcd)
45{ 45{
46 u32 classid; 46 u32 classid;
47 47
48 classid = task_cls_classid(current); 48 classid = task_cls_classid(current);
49 if (classid != sk->sk_classid) 49 sock_cgroup_set_classid(skcd, classid);
50 sk->sk_classid = classid;
51} 50}
52 51
53static inline u32 task_get_classid(const struct sk_buff *skb) 52static inline u32 task_get_classid(const struct sk_buff *skb)
@@ -64,17 +63,17 @@ static inline u32 task_get_classid(const struct sk_buff *skb)
64 * softirqs always disables bh. 63 * softirqs always disables bh.
65 */ 64 */
66 if (in_serving_softirq()) { 65 if (in_serving_softirq()) {
67 /* If there is an sk_classid we'll use that. */ 66 /* If there is an sock_cgroup_classid we'll use that. */
68 if (!skb->sk) 67 if (!skb->sk)
69 return 0; 68 return 0;
70 69
71 classid = skb->sk->sk_classid; 70 classid = sock_cgroup_classid(&skb->sk->sk_cgrp_data);
72 } 71 }
73 72
74 return classid; 73 return classid;
75} 74}
76#else /* !CONFIG_CGROUP_NET_CLASSID */ 75#else /* !CONFIG_CGROUP_NET_CLASSID */
77static inline void sock_update_classid(struct sock *sk) 76static inline void sock_update_classid(struct sock_cgroup_data *skcd)
78{ 77{
79} 78}
80 79
diff --git a/include/net/dsa.h b/include/net/dsa.h
index 82a4c6011173..26a0e86e611e 100644
--- a/include/net/dsa.h
+++ b/include/net/dsa.h
@@ -16,6 +16,7 @@
16#include <linux/timer.h> 16#include <linux/timer.h>
17#include <linux/workqueue.h> 17#include <linux/workqueue.h>
18#include <linux/of.h> 18#include <linux/of.h>
19#include <linux/of_gpio.h>
19#include <linux/phy.h> 20#include <linux/phy.h>
20#include <linux/phy_fixed.h> 21#include <linux/phy_fixed.h>
21#include <linux/ethtool.h> 22#include <linux/ethtool.h>
@@ -64,6 +65,13 @@ struct dsa_chip_data {
64 * NULL if there is only one switch chip. 65 * NULL if there is only one switch chip.
65 */ 66 */
66 s8 *rtable; 67 s8 *rtable;
68
69 /*
70 * A switch may have a GPIO line tied to its reset pin. Parse
71 * this from the device tree, and use it before performing
72 * switch soft reset.
73 */
74 struct gpio_desc *reset;
67}; 75};
68 76
69struct dsa_platform_data { 77struct dsa_platform_data {
@@ -109,13 +117,6 @@ struct dsa_switch_tree {
109 s8 cpu_port; 117 s8 cpu_port;
110 118
111 /* 119 /*
112 * Link state polling.
113 */
114 int link_poll_needed;
115 struct work_struct link_poll_work;
116 struct timer_list link_poll_timer;
117
118 /*
119 * Data for the individual switch chips. 120 * Data for the individual switch chips.
120 */ 121 */
121 struct dsa_switch *ds[DSA_MAX_SWITCHES]; 122 struct dsa_switch *ds[DSA_MAX_SWITCHES];
@@ -224,11 +225,6 @@ struct dsa_switch_driver {
224 int regnum, u16 val); 225 int regnum, u16 val);
225 226
226 /* 227 /*
227 * Link state polling and IRQ handling.
228 */
229 void (*poll_link)(struct dsa_switch *ds);
230
231 /*
232 * Link state adjustment (called from libphy) 228 * Link state adjustment (called from libphy)
233 */ 229 */
234 void (*adjust_link)(struct dsa_switch *ds, int port, 230 void (*adjust_link)(struct dsa_switch *ds, int port,
diff --git a/include/net/genetlink.h b/include/net/genetlink.h
index 1b6b6dcb018d..43c0e771f417 100644
--- a/include/net/genetlink.h
+++ b/include/net/genetlink.h
@@ -114,6 +114,7 @@ static inline void genl_info_net_set(struct genl_info *info, struct net *net)
114 * @flags: flags 114 * @flags: flags
115 * @policy: attribute validation policy 115 * @policy: attribute validation policy
116 * @doit: standard command callback 116 * @doit: standard command callback
117 * @start: start callback for dumps
117 * @dumpit: callback for dumpers 118 * @dumpit: callback for dumpers
118 * @done: completion callback for dumps 119 * @done: completion callback for dumps
119 * @ops_list: operations list 120 * @ops_list: operations list
@@ -122,6 +123,7 @@ struct genl_ops {
122 const struct nla_policy *policy; 123 const struct nla_policy *policy;
123 int (*doit)(struct sk_buff *skb, 124 int (*doit)(struct sk_buff *skb,
124 struct genl_info *info); 125 struct genl_info *info);
126 int (*start)(struct netlink_callback *cb);
125 int (*dumpit)(struct sk_buff *skb, 127 int (*dumpit)(struct sk_buff *skb,
126 struct netlink_callback *cb); 128 struct netlink_callback *cb);
127 int (*done)(struct netlink_callback *cb); 129 int (*done)(struct netlink_callback *cb);
diff --git a/include/net/geneve.h b/include/net/geneve.h
index 3106ed6eae0d..e6c23dc765f7 100644
--- a/include/net/geneve.h
+++ b/include/net/geneve.h
@@ -62,6 +62,14 @@ struct genevehdr {
62 struct geneve_opt options[]; 62 struct geneve_opt options[];
63}; 63};
64 64
65#if IS_ENABLED(CONFIG_GENEVE)
66void geneve_get_rx_port(struct net_device *netdev);
67#else
68static inline void geneve_get_rx_port(struct net_device *netdev)
69{
70}
71#endif
72
65#ifdef CONFIG_INET 73#ifdef CONFIG_INET
66struct net_device *geneve_dev_create_fb(struct net *net, const char *name, 74struct net_device *geneve_dev_create_fb(struct net *net, const char *name,
67 u8 name_assign_type, u16 dst_port); 75 u8 name_assign_type, u16 dst_port);
diff --git a/include/net/ieee802154_netdev.h b/include/net/ieee802154_netdev.h
index a62a051a3a2f..c4b31601cd53 100644
--- a/include/net/ieee802154_netdev.h
+++ b/include/net/ieee802154_netdev.h
@@ -337,7 +337,7 @@ struct ieee802154_mlme_ops {
337 void (*get_mac_params)(struct net_device *dev, 337 void (*get_mac_params)(struct net_device *dev,
338 struct ieee802154_mac_params *params); 338 struct ieee802154_mac_params *params);
339 339
340 struct ieee802154_llsec_ops *llsec; 340 const struct ieee802154_llsec_ops *llsec;
341}; 341};
342 342
343static inline struct ieee802154_mlme_ops * 343static inline struct ieee802154_mlme_ops *
diff --git a/include/net/ila.h b/include/net/ila.h
new file mode 100644
index 000000000000..9f4f43e94ae4
--- /dev/null
+++ b/include/net/ila.h
@@ -0,0 +1,18 @@
1/*
2 * ILA kernel interface
3 *
4 * Copyright (c) 2015 Tom Herbert <tom@herbertland.com>
5 *
6 * This program is free software; you can redistribute it and/or
7 * modify it under the terms of the GNU General Public License as
8 * published by the Free Software Foundation; either version 2 of
9 * the License, or (at your option) any later version.
10 */
11
12#ifndef _NET_ILA_H
13#define _NET_ILA_H
14
15int ila_xlat_outgoing(struct sk_buff *skb);
16int ila_xlat_incoming(struct sk_buff *skb);
17
18#endif /* _NET_ILA_H */
diff --git a/include/net/inet_frag.h b/include/net/inet_frag.h
index ac42bbb37b2d..12aac0fd6ee7 100644
--- a/include/net/inet_frag.h
+++ b/include/net/inet_frag.h
@@ -99,7 +99,6 @@ struct inet_frags {
99 void (*constructor)(struct inet_frag_queue *q, 99 void (*constructor)(struct inet_frag_queue *q,
100 const void *arg); 100 const void *arg);
101 void (*destructor)(struct inet_frag_queue *); 101 void (*destructor)(struct inet_frag_queue *);
102 void (*skb_free)(struct sk_buff *);
103 void (*frag_expire)(unsigned long data); 102 void (*frag_expire)(unsigned long data);
104 struct kmem_cache *frags_cachep; 103 struct kmem_cache *frags_cachep;
105 const char *frags_cache_name; 104 const char *frags_cache_name;
diff --git a/include/net/inet_sock.h b/include/net/inet_sock.h
index 625bdf95d673..012b1f91f3ec 100644
--- a/include/net/inet_sock.h
+++ b/include/net/inet_sock.h
@@ -28,6 +28,7 @@
28#include <net/request_sock.h> 28#include <net/request_sock.h>
29#include <net/netns/hash.h> 29#include <net/netns/hash.h>
30#include <net/tcp_states.h> 30#include <net/tcp_states.h>
31#include <net/l3mdev.h>
31 32
32/** struct ip_options - IP Options 33/** struct ip_options - IP Options
33 * 34 *
@@ -113,6 +114,19 @@ static inline u32 inet_request_mark(const struct sock *sk, struct sk_buff *skb)
113 return sk->sk_mark; 114 return sk->sk_mark;
114} 115}
115 116
117static inline int inet_request_bound_dev_if(const struct sock *sk,
118 struct sk_buff *skb)
119{
120#ifdef CONFIG_NET_L3_MASTER_DEV
121 struct net *net = sock_net(sk);
122
123 if (!sk->sk_bound_dev_if && net->ipv4.sysctl_tcp_l3mdev_accept)
124 return l3mdev_master_ifindex_by_index(net, skb->skb_iif);
125#endif
126
127 return sk->sk_bound_dev_if;
128}
129
116struct inet_cork { 130struct inet_cork {
117 unsigned int flags; 131 unsigned int flags;
118 __be32 addr; 132 __be32 addr;
diff --git a/include/net/ip6_tunnel.h b/include/net/ip6_tunnel.h
index ff788b665277..0d0ce0b2d870 100644
--- a/include/net/ip6_tunnel.h
+++ b/include/net/ip6_tunnel.h
@@ -5,6 +5,7 @@
5#include <linux/netdevice.h> 5#include <linux/netdevice.h>
6#include <linux/if_tunnel.h> 6#include <linux/if_tunnel.h>
7#include <linux/ip6_tunnel.h> 7#include <linux/ip6_tunnel.h>
8#include <net/ip_tunnels.h>
8 9
9#define IP6TUNNEL_ERR_TIMEO (30*HZ) 10#define IP6TUNNEL_ERR_TIMEO (30*HZ)
10 11
@@ -80,25 +81,17 @@ __u32 ip6_tnl_get_cap(struct ip6_tnl *t, const struct in6_addr *laddr,
80struct net *ip6_tnl_get_link_net(const struct net_device *dev); 81struct net *ip6_tnl_get_link_net(const struct net_device *dev);
81int ip6_tnl_get_iflink(const struct net_device *dev); 82int ip6_tnl_get_iflink(const struct net_device *dev);
82 83
84#ifdef CONFIG_INET
83static inline void ip6tunnel_xmit(struct sock *sk, struct sk_buff *skb, 85static inline void ip6tunnel_xmit(struct sock *sk, struct sk_buff *skb,
84 struct net_device *dev) 86 struct net_device *dev)
85{ 87{
86 struct net_device_stats *stats = &dev->stats;
87 int pkt_len, err; 88 int pkt_len, err;
88 89
89 pkt_len = skb->len - skb_inner_network_offset(skb); 90 pkt_len = skb->len - skb_inner_network_offset(skb);
90 err = ip6_local_out(dev_net(skb_dst(skb)->dev), sk, skb); 91 err = ip6_local_out(dev_net(skb_dst(skb)->dev), sk, skb);
91 92 if (unlikely(net_xmit_eval(err)))
92 if (net_xmit_eval(err) == 0) { 93 pkt_len = -1;
93 struct pcpu_sw_netstats *tstats = get_cpu_ptr(dev->tstats); 94 iptunnel_xmit_stats(dev, pkt_len);
94 u64_stats_update_begin(&tstats->syncp);
95 tstats->tx_bytes += pkt_len;
96 tstats->tx_packets++;
97 u64_stats_update_end(&tstats->syncp);
98 put_cpu_ptr(tstats);
99 } else {
100 stats->tx_errors++;
101 stats->tx_aborted_errors++;
102 }
103} 95}
104#endif 96#endif
97#endif
diff --git a/include/net/ip_fib.h b/include/net/ip_fib.h
index 9f4df68105ab..7029527725dd 100644
--- a/include/net/ip_fib.h
+++ b/include/net/ip_fib.h
@@ -325,7 +325,8 @@ extern u32 fib_multipath_secret __read_mostly;
325 325
326static inline int fib_multipath_hash(__be32 saddr, __be32 daddr) 326static inline int fib_multipath_hash(__be32 saddr, __be32 daddr)
327{ 327{
328 return jhash_2words(saddr, daddr, fib_multipath_secret) >> 1; 328 return jhash_2words((__force u32)saddr, (__force u32)daddr,
329 fib_multipath_secret) >> 1;
329} 330}
330 331
331void fib_select_multipath(struct fib_result *res, int hash); 332void fib_select_multipath(struct fib_result *res, int hash);
diff --git a/include/net/ip_tunnels.h b/include/net/ip_tunnels.h
index 62a750a6a8f8..6db96ea0144f 100644
--- a/include/net/ip_tunnels.h
+++ b/include/net/ip_tunnels.h
@@ -273,32 +273,34 @@ static inline u8 ip_tunnel_ecn_encap(u8 tos, const struct iphdr *iph,
273} 273}
274 274
275int iptunnel_pull_header(struct sk_buff *skb, int hdr_len, __be16 inner_proto); 275int iptunnel_pull_header(struct sk_buff *skb, int hdr_len, __be16 inner_proto);
276int iptunnel_xmit(struct sock *sk, struct rtable *rt, struct sk_buff *skb, 276void iptunnel_xmit(struct sock *sk, struct rtable *rt, struct sk_buff *skb,
277 __be32 src, __be32 dst, u8 proto, 277 __be32 src, __be32 dst, u8 proto,
278 u8 tos, u8 ttl, __be16 df, bool xnet); 278 u8 tos, u8 ttl, __be16 df, bool xnet);
279struct metadata_dst *iptunnel_metadata_reply(struct metadata_dst *md, 279struct metadata_dst *iptunnel_metadata_reply(struct metadata_dst *md,
280 gfp_t flags); 280 gfp_t flags);
281 281
282struct sk_buff *iptunnel_handle_offloads(struct sk_buff *skb, bool gre_csum, 282struct sk_buff *iptunnel_handle_offloads(struct sk_buff *skb, bool gre_csum,
283 int gso_type_mask); 283 int gso_type_mask);
284 284
285static inline void iptunnel_xmit_stats(int err, 285static inline void iptunnel_xmit_stats(struct net_device *dev, int pkt_len)
286 struct net_device_stats *err_stats,
287 struct pcpu_sw_netstats __percpu *stats)
288{ 286{
289 if (err > 0) { 287 if (pkt_len > 0) {
290 struct pcpu_sw_netstats *tstats = get_cpu_ptr(stats); 288 struct pcpu_sw_netstats *tstats = get_cpu_ptr(dev->tstats);
291 289
292 u64_stats_update_begin(&tstats->syncp); 290 u64_stats_update_begin(&tstats->syncp);
293 tstats->tx_bytes += err; 291 tstats->tx_bytes += pkt_len;
294 tstats->tx_packets++; 292 tstats->tx_packets++;
295 u64_stats_update_end(&tstats->syncp); 293 u64_stats_update_end(&tstats->syncp);
296 put_cpu_ptr(tstats); 294 put_cpu_ptr(tstats);
297 } else if (err < 0) {
298 err_stats->tx_errors++;
299 err_stats->tx_aborted_errors++;
300 } else { 295 } else {
301 err_stats->tx_dropped++; 296 struct net_device_stats *err_stats = &dev->stats;
297
298 if (pkt_len < 0) {
299 err_stats->tx_errors++;
300 err_stats->tx_aborted_errors++;
301 } else {
302 err_stats->tx_dropped++;
303 }
302 } 304 }
303} 305}
304 306
diff --git a/include/net/ipv6.h b/include/net/ipv6.h
index 9a5c9f013784..6570f379aba2 100644
--- a/include/net/ipv6.h
+++ b/include/net/ipv6.h
@@ -401,6 +401,21 @@ static inline void ipv6_addr_prefix(struct in6_addr *pfx,
401 pfx->s6_addr[o] = addr->s6_addr[o] & (0xff00 >> b); 401 pfx->s6_addr[o] = addr->s6_addr[o] & (0xff00 >> b);
402} 402}
403 403
404static inline void ipv6_addr_prefix_copy(struct in6_addr *addr,
405 const struct in6_addr *pfx,
406 int plen)
407{
408 /* caller must guarantee 0 <= plen <= 128 */
409 int o = plen >> 3,
410 b = plen & 0x7;
411
412 memcpy(addr->s6_addr, pfx, o);
413 if (b != 0) {
414 addr->s6_addr[o] &= ~(0xff00 >> b);
415 addr->s6_addr[o] |= (pfx->s6_addr[o] & (0xff00 >> b));
416 }
417}
418
404static inline void __ipv6_addr_set_half(__be32 *addr, 419static inline void __ipv6_addr_set_half(__be32 *addr,
405 __be32 wh, __be32 wl) 420 __be32 wh, __be32 wl)
406{ 421{
diff --git a/include/net/l3mdev.h b/include/net/l3mdev.h
index 5689a0c749f7..5567d46b3cff 100644
--- a/include/net/l3mdev.h
+++ b/include/net/l3mdev.h
@@ -51,6 +51,24 @@ static inline int l3mdev_master_ifindex(struct net_device *dev)
51 return ifindex; 51 return ifindex;
52} 52}
53 53
54static inline int l3mdev_master_ifindex_by_index(struct net *net, int ifindex)
55{
56 struct net_device *dev;
57 int rc = 0;
58
59 if (likely(ifindex)) {
60 rcu_read_lock();
61
62 dev = dev_get_by_index_rcu(net, ifindex);
63 if (dev)
64 rc = l3mdev_master_ifindex_rcu(dev);
65
66 rcu_read_unlock();
67 }
68
69 return rc;
70}
71
54/* get index of an interface to use for FIB lookups. For devices 72/* get index of an interface to use for FIB lookups. For devices
55 * enslaved to an L3 master device FIB lookups are based on the 73 * enslaved to an L3 master device FIB lookups are based on the
56 * master index 74 * master index
@@ -170,6 +188,11 @@ static inline int l3mdev_master_ifindex(struct net_device *dev)
170 return 0; 188 return 0;
171} 189}
172 190
191static inline int l3mdev_master_ifindex_by_index(struct net *net, int ifindex)
192{
193 return 0;
194}
195
173static inline int l3mdev_fib_oif_rcu(struct net_device *dev) 196static inline int l3mdev_fib_oif_rcu(struct net_device *dev)
174{ 197{
175 return dev ? dev->ifindex : 0; 198 return dev ? dev->ifindex : 0;
diff --git a/include/net/mac80211.h b/include/net/mac80211.h
index 760bc4d5a2cf..7c30faff245f 100644
--- a/include/net/mac80211.h
+++ b/include/net/mac80211.h
@@ -1321,11 +1321,15 @@ struct ieee80211_channel_switch {
1321 * interface. This flag should be set during interface addition, 1321 * interface. This flag should be set during interface addition,
1322 * but may be set/cleared as late as authentication to an AP. It is 1322 * but may be set/cleared as late as authentication to an AP. It is
1323 * only valid for managed/station mode interfaces. 1323 * only valid for managed/station mode interfaces.
1324 * @IEEE80211_VIF_GET_NOA_UPDATE: request to handle NOA attributes
1325 * and send P2P_PS notification to the driver if NOA changed, even
1326 * this is not pure P2P vif.
1324 */ 1327 */
1325enum ieee80211_vif_flags { 1328enum ieee80211_vif_flags {
1326 IEEE80211_VIF_BEACON_FILTER = BIT(0), 1329 IEEE80211_VIF_BEACON_FILTER = BIT(0),
1327 IEEE80211_VIF_SUPPORTS_CQM_RSSI = BIT(1), 1330 IEEE80211_VIF_SUPPORTS_CQM_RSSI = BIT(1),
1328 IEEE80211_VIF_SUPPORTS_UAPSD = BIT(2), 1331 IEEE80211_VIF_SUPPORTS_UAPSD = BIT(2),
1332 IEEE80211_VIF_GET_NOA_UPDATE = BIT(3),
1329}; 1333};
1330 1334
1331/** 1335/**
@@ -1901,6 +1905,11 @@ struct ieee80211_txq {
1901 * @IEEE80211_HW_BEACON_TX_STATUS: The device/driver provides TX status 1905 * @IEEE80211_HW_BEACON_TX_STATUS: The device/driver provides TX status
1902 * for sent beacons. 1906 * for sent beacons.
1903 * 1907 *
1908 * @IEEE80211_HW_NEEDS_UNIQUE_STA_ADDR: Hardware (or driver) requires that each
1909 * station has a unique address, i.e. each station entry can be identified
1910 * by just its MAC address; this prevents, for example, the same station
1911 * from connecting to two virtual AP interfaces at the same time.
1912 *
1904 * @NUM_IEEE80211_HW_FLAGS: number of hardware flags, used for sizing arrays 1913 * @NUM_IEEE80211_HW_FLAGS: number of hardware flags, used for sizing arrays
1905 */ 1914 */
1906enum ieee80211_hw_flags { 1915enum ieee80211_hw_flags {
@@ -1936,6 +1945,7 @@ enum ieee80211_hw_flags {
1936 IEEE80211_HW_TDLS_WIDER_BW, 1945 IEEE80211_HW_TDLS_WIDER_BW,
1937 IEEE80211_HW_SUPPORTS_AMSDU_IN_AMPDU, 1946 IEEE80211_HW_SUPPORTS_AMSDU_IN_AMPDU,
1938 IEEE80211_HW_BEACON_TX_STATUS, 1947 IEEE80211_HW_BEACON_TX_STATUS,
1948 IEEE80211_HW_NEEDS_UNIQUE_STA_ADDR,
1939 1949
1940 /* keep last, obviously */ 1950 /* keep last, obviously */
1941 NUM_IEEE80211_HW_FLAGS 1951 NUM_IEEE80211_HW_FLAGS
@@ -4863,6 +4873,28 @@ void ieee80211_sta_block_awake(struct ieee80211_hw *hw,
4863void ieee80211_sta_eosp(struct ieee80211_sta *pubsta); 4873void ieee80211_sta_eosp(struct ieee80211_sta *pubsta);
4864 4874
4865/** 4875/**
4876 * ieee80211_send_eosp_nullfunc - ask mac80211 to send NDP with EOSP
4877 * @pubsta: the station
4878 * @tid: the tid of the NDP
4879 *
4880 * Sometimes the device understands that it needs to close
4881 * the Service Period unexpectedly. This can happen when
4882 * sending frames that are filling holes in the BA window.
4883 * In this case, the device can ask mac80211 to send a
4884 * Nullfunc frame with EOSP set. When that happens, the
4885 * driver must have called ieee80211_sta_set_buffered() to
4886 * let mac80211 know that there are no buffered frames any
4887 * more, otherwise mac80211 will get the more_data bit wrong.
4888 * The low level driver must have made sure that the frame
4889 * will be sent despite the station being in power-save.
4890 * Mac80211 won't call allow_buffered_frames().
4891 * Note that calling this function, doesn't exempt the driver
4892 * from closing the EOSP properly, it will still have to call
4893 * ieee80211_sta_eosp when the NDP is sent.
4894 */
4895void ieee80211_send_eosp_nullfunc(struct ieee80211_sta *pubsta, int tid);
4896
4897/**
4866 * ieee80211_iter_keys - iterate keys programmed into the device 4898 * ieee80211_iter_keys - iterate keys programmed into the device
4867 * @hw: pointer obtained from ieee80211_alloc_hw() 4899 * @hw: pointer obtained from ieee80211_alloc_hw()
4868 * @vif: virtual interface to iterate, may be %NULL for all 4900 * @vif: virtual interface to iterate, may be %NULL for all
@@ -4890,6 +4922,30 @@ void ieee80211_iter_keys(struct ieee80211_hw *hw,
4890 void *iter_data); 4922 void *iter_data);
4891 4923
4892/** 4924/**
4925 * ieee80211_iter_keys_rcu - iterate keys programmed into the device
4926 * @hw: pointer obtained from ieee80211_alloc_hw()
4927 * @vif: virtual interface to iterate, may be %NULL for all
4928 * @iter: iterator function that will be called for each key
4929 * @iter_data: custom data to pass to the iterator function
4930 *
4931 * This function can be used to iterate all the keys known to
4932 * mac80211, even those that weren't previously programmed into
4933 * the device. Note that due to locking reasons, keys of station
4934 * in removal process will be skipped.
4935 *
4936 * This function requires being called in an RCU critical section,
4937 * and thus iter must be atomic.
4938 */
4939void ieee80211_iter_keys_rcu(struct ieee80211_hw *hw,
4940 struct ieee80211_vif *vif,
4941 void (*iter)(struct ieee80211_hw *hw,
4942 struct ieee80211_vif *vif,
4943 struct ieee80211_sta *sta,
4944 struct ieee80211_key_conf *key,
4945 void *data),
4946 void *iter_data);
4947
4948/**
4893 * ieee80211_iter_chan_contexts_atomic - iterate channel contexts 4949 * ieee80211_iter_chan_contexts_atomic - iterate channel contexts
4894 * @hw: pointre obtained from ieee80211_alloc_hw(). 4950 * @hw: pointre obtained from ieee80211_alloc_hw().
4895 * @iter: iterator function 4951 * @iter: iterator function
diff --git a/include/net/net_namespace.h b/include/net/net_namespace.h
index 2dcea635ecce..4089abc6e9c0 100644
--- a/include/net/net_namespace.h
+++ b/include/net/net_namespace.h
@@ -121,6 +121,9 @@ struct net {
121#if IS_ENABLED(CONFIG_NETFILTER_NETLINK_ACCT) 121#if IS_ENABLED(CONFIG_NETFILTER_NETLINK_ACCT)
122 struct list_head nfnl_acct_list; 122 struct list_head nfnl_acct_list;
123#endif 123#endif
124#if IS_ENABLED(CONFIG_NF_CT_NETLINK_TIMEOUT)
125 struct list_head nfct_timeout_list;
126#endif
124#endif 127#endif
125#ifdef CONFIG_WEXT_CORE 128#ifdef CONFIG_WEXT_CORE
126 struct sk_buff_head wext_nlevents; 129 struct sk_buff_head wext_nlevents;
diff --git a/include/net/netfilter/ipv6/nf_defrag_ipv6.h b/include/net/netfilter/ipv6/nf_defrag_ipv6.h
index fb7da5bb76cc..ddf162f7966f 100644
--- a/include/net/netfilter/ipv6/nf_defrag_ipv6.h
+++ b/include/net/netfilter/ipv6/nf_defrag_ipv6.h
@@ -5,8 +5,7 @@ void nf_defrag_ipv6_enable(void);
5 5
6int nf_ct_frag6_init(void); 6int nf_ct_frag6_init(void);
7void nf_ct_frag6_cleanup(void); 7void nf_ct_frag6_cleanup(void);
8struct sk_buff *nf_ct_frag6_gather(struct net *net, struct sk_buff *skb, u32 user); 8int nf_ct_frag6_gather(struct net *net, struct sk_buff *skb, u32 user);
9void nf_ct_frag6_consume_orig(struct sk_buff *skb);
10 9
11struct inet_frags_ctl; 10struct inet_frags_ctl;
12 11
diff --git a/include/net/netfilter/nf_conntrack_timeout.h b/include/net/netfilter/nf_conntrack_timeout.h
index f72be38860a7..5cc5e9e6171a 100644
--- a/include/net/netfilter/nf_conntrack_timeout.h
+++ b/include/net/netfilter/nf_conntrack_timeout.h
@@ -104,7 +104,7 @@ static inline void nf_conntrack_timeout_fini(void)
104#endif /* CONFIG_NF_CONNTRACK_TIMEOUT */ 104#endif /* CONFIG_NF_CONNTRACK_TIMEOUT */
105 105
106#ifdef CONFIG_NF_CONNTRACK_TIMEOUT 106#ifdef CONFIG_NF_CONNTRACK_TIMEOUT
107extern struct ctnl_timeout *(*nf_ct_timeout_find_get_hook)(const char *name); 107extern struct ctnl_timeout *(*nf_ct_timeout_find_get_hook)(struct net *net, const char *name);
108extern void (*nf_ct_timeout_put_hook)(struct ctnl_timeout *timeout); 108extern void (*nf_ct_timeout_put_hook)(struct ctnl_timeout *timeout);
109#endif 109#endif
110 110
diff --git a/include/net/netfilter/nf_dup_netdev.h b/include/net/netfilter/nf_dup_netdev.h
new file mode 100644
index 000000000000..397dcae349f9
--- /dev/null
+++ b/include/net/netfilter/nf_dup_netdev.h
@@ -0,0 +1,6 @@
1#ifndef _NF_DUP_NETDEV_H_
2#define _NF_DUP_NETDEV_H_
3
4void nf_dup_netdev_egress(const struct nft_pktinfo *pkt, int oif);
5
6#endif
diff --git a/include/net/netfilter/nf_tables.h b/include/net/netfilter/nf_tables.h
index 4bd7508bedc9..f6b1daf2e698 100644
--- a/include/net/netfilter/nf_tables.h
+++ b/include/net/netfilter/nf_tables.h
@@ -19,8 +19,6 @@ struct nft_pktinfo {
19 const struct net_device *out; 19 const struct net_device *out;
20 u8 pf; 20 u8 pf;
21 u8 hook; 21 u8 hook;
22 u8 nhoff;
23 u8 thoff;
24 u8 tprot; 22 u8 tprot;
25 /* for x_tables compatibility */ 23 /* for x_tables compatibility */
26 struct xt_action_param xt; 24 struct xt_action_param xt;
@@ -293,6 +291,8 @@ void nft_unregister_set(struct nft_set_ops *ops);
293 * @timeout: default timeout value in msecs 291 * @timeout: default timeout value in msecs
294 * @gc_int: garbage collection interval in msecs 292 * @gc_int: garbage collection interval in msecs
295 * @policy: set parameterization (see enum nft_set_policies) 293 * @policy: set parameterization (see enum nft_set_policies)
294 * @udlen: user data length
295 * @udata: user data
296 * @ops: set ops 296 * @ops: set ops
297 * @pnet: network namespace 297 * @pnet: network namespace
298 * @flags: set flags 298 * @flags: set flags
@@ -312,6 +312,8 @@ struct nft_set {
312 u64 timeout; 312 u64 timeout;
313 u32 gc_int; 313 u32 gc_int;
314 u16 policy; 314 u16 policy;
315 u16 udlen;
316 unsigned char *udata;
315 /* runtime data below here */ 317 /* runtime data below here */
316 const struct nft_set_ops *ops ____cacheline_aligned; 318 const struct nft_set_ops *ops ____cacheline_aligned;
317 possible_net_t pnet; 319 possible_net_t pnet;
@@ -823,10 +825,7 @@ static inline struct nft_base_chain *nft_base_chain(const struct nft_chain *chai
823 return container_of(chain, struct nft_base_chain, chain); 825 return container_of(chain, struct nft_base_chain, chain);
824} 826}
825 827
826int nft_register_basechain(struct nft_base_chain *basechain, 828int __nft_release_basechain(struct nft_ctx *ctx);
827 unsigned int hook_nops);
828void nft_unregister_basechain(struct nft_base_chain *basechain,
829 unsigned int hook_nops);
830 829
831unsigned int nft_do_chain(struct nft_pktinfo *pkt, void *priv); 830unsigned int nft_do_chain(struct nft_pktinfo *pkt, void *priv);
832 831
@@ -882,7 +881,7 @@ struct nft_af_info {
882}; 881};
883 882
884int nft_register_afinfo(struct net *, struct nft_af_info *); 883int nft_register_afinfo(struct net *, struct nft_af_info *);
885void nft_unregister_afinfo(struct nft_af_info *); 884void nft_unregister_afinfo(struct net *, struct nft_af_info *);
886 885
887int nft_register_chain_type(const struct nf_chain_type *); 886int nft_register_chain_type(const struct nf_chain_type *);
888void nft_unregister_chain_type(const struct nf_chain_type *); 887void nft_unregister_chain_type(const struct nf_chain_type *);
@@ -890,6 +889,38 @@ void nft_unregister_chain_type(const struct nf_chain_type *);
890int nft_register_expr(struct nft_expr_type *); 889int nft_register_expr(struct nft_expr_type *);
891void nft_unregister_expr(struct nft_expr_type *); 890void nft_unregister_expr(struct nft_expr_type *);
892 891
892int nft_verdict_dump(struct sk_buff *skb, int type,
893 const struct nft_verdict *v);
894
895/**
896 * struct nft_traceinfo - nft tracing information and state
897 *
898 * @pkt: pktinfo currently processed
899 * @basechain: base chain currently processed
900 * @chain: chain currently processed
901 * @rule: rule that was evaluated
902 * @verdict: verdict given by rule
903 * @type: event type (enum nft_trace_types)
904 * @packet_dumped: packet headers sent in a previous traceinfo message
905 * @trace: other struct members are initialised
906 */
907struct nft_traceinfo {
908 const struct nft_pktinfo *pkt;
909 const struct nft_base_chain *basechain;
910 const struct nft_chain *chain;
911 const struct nft_rule *rule;
912 const struct nft_verdict *verdict;
913 enum nft_trace_types type;
914 bool packet_dumped;
915 bool trace;
916};
917
918void nft_trace_init(struct nft_traceinfo *info, const struct nft_pktinfo *pkt,
919 const struct nft_verdict *verdict,
920 const struct nft_chain *basechain);
921
922void nft_trace_notify(struct nft_traceinfo *info);
923
893#define nft_dereference(p) \ 924#define nft_dereference(p) \
894 nfnl_dereference(p, NFNL_SUBSYS_NFTABLES) 925 nfnl_dereference(p, NFNL_SUBSYS_NFTABLES)
895 926
diff --git a/include/net/netfilter/nf_tables_core.h b/include/net/netfilter/nf_tables_core.h
index c6f400cfaac8..a9060dd99db7 100644
--- a/include/net/netfilter/nf_tables_core.h
+++ b/include/net/netfilter/nf_tables_core.h
@@ -47,7 +47,17 @@ struct nft_payload {
47 enum nft_registers dreg:8; 47 enum nft_registers dreg:8;
48}; 48};
49 49
50struct nft_payload_set {
51 enum nft_payload_bases base:8;
52 u8 offset;
53 u8 len;
54 enum nft_registers sreg:8;
55 u8 csum_type;
56 u8 csum_offset;
57};
58
50extern const struct nft_expr_ops nft_payload_fast_ops; 59extern const struct nft_expr_ops nft_payload_fast_ops;
60extern struct static_key_false nft_trace_enabled;
51 61
52int nft_payload_module_init(void); 62int nft_payload_module_init(void);
53void nft_payload_module_exit(void); 63void nft_payload_module_exit(void);
diff --git a/include/net/netfilter/nft_meta.h b/include/net/netfilter/nft_meta.h
index 711887a09e91..d27588c8dbd9 100644
--- a/include/net/netfilter/nft_meta.h
+++ b/include/net/netfilter/nft_meta.h
@@ -33,4 +33,7 @@ void nft_meta_set_eval(const struct nft_expr *expr,
33 struct nft_regs *regs, 33 struct nft_regs *regs,
34 const struct nft_pktinfo *pkt); 34 const struct nft_pktinfo *pkt);
35 35
36void nft_meta_set_destroy(const struct nft_ctx *ctx,
37 const struct nft_expr *expr);
38
36#endif 39#endif
diff --git a/include/net/netns/ipv4.h b/include/net/netns/ipv4.h
index c68926b4899c..2b7907a35568 100644
--- a/include/net/netns/ipv4.h
+++ b/include/net/netns/ipv4.h
@@ -86,11 +86,18 @@ struct netns_ipv4 {
86 86
87 int sysctl_fwmark_reflect; 87 int sysctl_fwmark_reflect;
88 int sysctl_tcp_fwmark_accept; 88 int sysctl_tcp_fwmark_accept;
89#ifdef CONFIG_NET_L3_MASTER_DEV
90 int sysctl_tcp_l3mdev_accept;
91#endif
89 int sysctl_tcp_mtu_probing; 92 int sysctl_tcp_mtu_probing;
90 int sysctl_tcp_base_mss; 93 int sysctl_tcp_base_mss;
91 int sysctl_tcp_probe_threshold; 94 int sysctl_tcp_probe_threshold;
92 u32 sysctl_tcp_probe_interval; 95 u32 sysctl_tcp_probe_interval;
93 96
97 int sysctl_tcp_keepalive_time;
98 int sysctl_tcp_keepalive_probes;
99 int sysctl_tcp_keepalive_intvl;
100
94 struct ping_group_range ping_group_range; 101 struct ping_group_range ping_group_range;
95 102
96 atomic_t dev_addr_genid; 103 atomic_t dev_addr_genid;
diff --git a/include/net/netns/sctp.h b/include/net/netns/sctp.h
index 8ba379f9e467..c501d67172b1 100644
--- a/include/net/netns/sctp.h
+++ b/include/net/netns/sctp.h
@@ -89,6 +89,13 @@ struct netns_sctp {
89 int pf_retrans; 89 int pf_retrans;
90 90
91 /* 91 /*
92 * Disable Potentially-Failed feature, the feature is enabled by default
93 * pf_enable - 0 : disable pf
94 * - >0 : enable pf
95 */
96 int pf_enable;
97
98 /*
92 * Policy for preforming sctp/socket accounting 99 * Policy for preforming sctp/socket accounting
93 * 0 - do socket level accounting, all assocs share sk_sndbuf 100 * 0 - do socket level accounting, all assocs share sk_sndbuf
94 * 1 - do sctp accounting, each asoc may use sk_sndbuf bytes 101 * 1 - do sctp accounting, each asoc may use sk_sndbuf bytes
diff --git a/include/net/netprio_cgroup.h b/include/net/netprio_cgroup.h
index f2a9597ff53c..604190596cde 100644
--- a/include/net/netprio_cgroup.h
+++ b/include/net/netprio_cgroup.h
@@ -25,8 +25,6 @@ struct netprio_map {
25 u32 priomap[]; 25 u32 priomap[];
26}; 26};
27 27
28void sock_update_netprioidx(struct sock *sk);
29
30static inline u32 task_netprioidx(struct task_struct *p) 28static inline u32 task_netprioidx(struct task_struct *p)
31{ 29{
32 struct cgroup_subsys_state *css; 30 struct cgroup_subsys_state *css;
@@ -38,13 +36,25 @@ static inline u32 task_netprioidx(struct task_struct *p)
38 rcu_read_unlock(); 36 rcu_read_unlock();
39 return idx; 37 return idx;
40} 38}
39
40static inline void sock_update_netprioidx(struct sock_cgroup_data *skcd)
41{
42 if (in_interrupt())
43 return;
44
45 sock_cgroup_set_prioidx(skcd, task_netprioidx(current));
46}
47
41#else /* !CONFIG_CGROUP_NET_PRIO */ 48#else /* !CONFIG_CGROUP_NET_PRIO */
49
42static inline u32 task_netprioidx(struct task_struct *p) 50static inline u32 task_netprioidx(struct task_struct *p)
43{ 51{
44 return 0; 52 return 0;
45} 53}
46 54
47#define sock_update_netprioidx(sk) 55static inline void sock_update_netprioidx(struct sock_cgroup_data *skcd)
56{
57}
48 58
49#endif /* CONFIG_CGROUP_NET_PRIO */ 59#endif /* CONFIG_CGROUP_NET_PRIO */
50#endif /* _NET_CLS_CGROUP_H */ 60#endif /* _NET_CLS_CGROUP_H */
diff --git a/include/net/nfc/nfc.h b/include/net/nfc/nfc.h
index dcfcfc9c00bf..1a3de8b34ad2 100644
--- a/include/net/nfc/nfc.h
+++ b/include/net/nfc/nfc.h
@@ -299,6 +299,7 @@ void nfc_driver_failure(struct nfc_dev *dev, int err);
299 299
300int nfc_se_transaction(struct nfc_dev *dev, u8 se_idx, 300int nfc_se_transaction(struct nfc_dev *dev, u8 se_idx,
301 struct nfc_evt_transaction *evt_transaction); 301 struct nfc_evt_transaction *evt_transaction);
302int nfc_se_connectivity(struct nfc_dev *dev, u8 se_idx);
302int nfc_add_se(struct nfc_dev *dev, u32 se_idx, u16 type); 303int nfc_add_se(struct nfc_dev *dev, u32 se_idx, u16 type);
303int nfc_remove_se(struct nfc_dev *dev, u32 se_idx); 304int nfc_remove_se(struct nfc_dev *dev, u32 se_idx);
304struct nfc_se *nfc_find_se(struct nfc_dev *dev, u32 se_idx); 305struct nfc_se *nfc_find_se(struct nfc_dev *dev, u32 se_idx);
diff --git a/include/net/protocol.h b/include/net/protocol.h
index d6fcc1fcdb5b..da689f5432de 100644
--- a/include/net/protocol.h
+++ b/include/net/protocol.h
@@ -107,7 +107,7 @@ int inet_del_offload(const struct net_offload *prot, unsigned char num);
107void inet_register_protosw(struct inet_protosw *p); 107void inet_register_protosw(struct inet_protosw *p);
108void inet_unregister_protosw(struct inet_protosw *p); 108void inet_unregister_protosw(struct inet_protosw *p);
109 109
110int udp_add_offload(struct udp_offload *prot); 110int udp_add_offload(struct net *net, struct udp_offload *prot);
111void udp_del_offload(struct udp_offload *prot); 111void udp_del_offload(struct udp_offload *prot);
112 112
113#if IS_ENABLED(CONFIG_IPV6) 113#if IS_ENABLED(CONFIG_IPV6)
diff --git a/include/net/request_sock.h b/include/net/request_sock.h
index a0dde04eb178..f49759decb28 100644
--- a/include/net/request_sock.h
+++ b/include/net/request_sock.h
@@ -68,7 +68,7 @@ struct request_sock {
68 u32 peer_secid; 68 u32 peer_secid;
69}; 69};
70 70
71static inline struct request_sock *inet_reqsk(struct sock *sk) 71static inline struct request_sock *inet_reqsk(const struct sock *sk)
72{ 72{
73 return (struct request_sock *)sk; 73 return (struct request_sock *)sk;
74} 74}
diff --git a/include/net/sch_generic.h b/include/net/sch_generic.h
index b2a8e6338576..636a362a0e03 100644
--- a/include/net/sch_generic.h
+++ b/include/net/sch_generic.h
@@ -407,6 +407,15 @@ bool tcf_destroy(struct tcf_proto *tp, bool force);
407void tcf_destroy_chain(struct tcf_proto __rcu **fl); 407void tcf_destroy_chain(struct tcf_proto __rcu **fl);
408int skb_do_redirect(struct sk_buff *); 408int skb_do_redirect(struct sk_buff *);
409 409
410static inline bool skb_at_tc_ingress(const struct sk_buff *skb)
411{
412#ifdef CONFIG_NET_CLS_ACT
413 return G_TC_AT(skb->tc_verd) & AT_INGRESS;
414#else
415 return false;
416#endif
417}
418
410/* Reset all TX qdiscs greater then index of a device. */ 419/* Reset all TX qdiscs greater then index of a device. */
411static inline void qdisc_reset_all_tx_gt(struct net_device *dev, unsigned int i) 420static inline void qdisc_reset_all_tx_gt(struct net_device *dev, unsigned int i)
412{ 421{
diff --git a/include/net/sctp/sctp.h b/include/net/sctp/sctp.h
index ce13cf20f625..835aa2ed9870 100644
--- a/include/net/sctp/sctp.h
+++ b/include/net/sctp/sctp.h
@@ -126,8 +126,6 @@ int sctp_primitive_ASCONF(struct net *, struct sctp_association *, void *arg);
126 */ 126 */
127int sctp_rcv(struct sk_buff *skb); 127int sctp_rcv(struct sk_buff *skb);
128void sctp_v4_err(struct sk_buff *skb, u32 info); 128void sctp_v4_err(struct sk_buff *skb, u32 info);
129void sctp_hash_established(struct sctp_association *);
130void sctp_unhash_established(struct sctp_association *);
131void sctp_hash_endpoint(struct sctp_endpoint *); 129void sctp_hash_endpoint(struct sctp_endpoint *);
132void sctp_unhash_endpoint(struct sctp_endpoint *); 130void sctp_unhash_endpoint(struct sctp_endpoint *);
133struct sock *sctp_err_lookup(struct net *net, int family, struct sk_buff *, 131struct sock *sctp_err_lookup(struct net *net, int family, struct sk_buff *,
@@ -143,6 +141,17 @@ void sctp_icmp_proto_unreachable(struct sock *sk,
143 struct sctp_transport *t); 141 struct sctp_transport *t);
144void sctp_backlog_migrate(struct sctp_association *assoc, 142void sctp_backlog_migrate(struct sctp_association *assoc,
145 struct sock *oldsk, struct sock *newsk); 143 struct sock *oldsk, struct sock *newsk);
144int sctp_transport_hashtable_init(void);
145void sctp_transport_hashtable_destroy(void);
146void sctp_hash_transport(struct sctp_transport *t);
147void sctp_unhash_transport(struct sctp_transport *t);
148struct sctp_transport *sctp_addrs_lookup_transport(
149 struct net *net,
150 const union sctp_addr *laddr,
151 const union sctp_addr *paddr);
152struct sctp_transport *sctp_epaddr_lookup_transport(
153 const struct sctp_endpoint *ep,
154 const union sctp_addr *paddr);
146 155
147/* 156/*
148 * sctp/proc.c 157 * sctp/proc.c
@@ -519,25 +528,6 @@ static inline int sctp_ep_hashfn(struct net *net, __u16 lport)
519 return (net_hash_mix(net) + lport) & (sctp_ep_hashsize - 1); 528 return (net_hash_mix(net) + lport) & (sctp_ep_hashsize - 1);
520} 529}
521 530
522/* This is the hash function for the association hash table. */
523static inline int sctp_assoc_hashfn(struct net *net, __u16 lport, __u16 rport)
524{
525 int h = (lport << 16) + rport + net_hash_mix(net);
526 h ^= h>>8;
527 return h & (sctp_assoc_hashsize - 1);
528}
529
530/* This is the hash function for the association hash table. This is
531 * not used yet, but could be used as a better hash function when
532 * we have a vtag.
533 */
534static inline int sctp_vtag_hashfn(__u16 lport, __u16 rport, __u32 vtag)
535{
536 int h = (lport << 16) + rport;
537 h ^= vtag;
538 return h & (sctp_assoc_hashsize - 1);
539}
540
541#define sctp_for_each_hentry(epb, head) \ 531#define sctp_for_each_hentry(epb, head) \
542 hlist_for_each_entry(epb, head, node) 532 hlist_for_each_entry(epb, head, node)
543 533
diff --git a/include/net/sctp/structs.h b/include/net/sctp/structs.h
index eea9bdeecba2..20e72129be1c 100644
--- a/include/net/sctp/structs.h
+++ b/include/net/sctp/structs.h
@@ -48,6 +48,7 @@
48#define __sctp_structs_h__ 48#define __sctp_structs_h__
49 49
50#include <linux/ktime.h> 50#include <linux/ktime.h>
51#include <linux/rhashtable.h>
51#include <linux/socket.h> /* linux/in.h needs this!! */ 52#include <linux/socket.h> /* linux/in.h needs this!! */
52#include <linux/in.h> /* We get struct sockaddr_in. */ 53#include <linux/in.h> /* We get struct sockaddr_in. */
53#include <linux/in6.h> /* We get struct in6_addr */ 54#include <linux/in6.h> /* We get struct in6_addr */
@@ -119,14 +120,13 @@ extern struct sctp_globals {
119 120
120 /* This is the hash of all endpoints. */ 121 /* This is the hash of all endpoints. */
121 struct sctp_hashbucket *ep_hashtable; 122 struct sctp_hashbucket *ep_hashtable;
122 /* This is the hash of all associations. */
123 struct sctp_hashbucket *assoc_hashtable;
124 /* This is the sctp port control hash. */ 123 /* This is the sctp port control hash. */
125 struct sctp_bind_hashbucket *port_hashtable; 124 struct sctp_bind_hashbucket *port_hashtable;
125 /* This is the hash of all transports. */
126 struct rhashtable transport_hashtable;
126 127
127 /* Sizes of above hashtables. */ 128 /* Sizes of above hashtables. */
128 int ep_hashsize; 129 int ep_hashsize;
129 int assoc_hashsize;
130 int port_hashsize; 130 int port_hashsize;
131 131
132 /* Default initialization values to be applied to new associations. */ 132 /* Default initialization values to be applied to new associations. */
@@ -143,10 +143,9 @@ extern struct sctp_globals {
143#define sctp_address_families (sctp_globals.address_families) 143#define sctp_address_families (sctp_globals.address_families)
144#define sctp_ep_hashsize (sctp_globals.ep_hashsize) 144#define sctp_ep_hashsize (sctp_globals.ep_hashsize)
145#define sctp_ep_hashtable (sctp_globals.ep_hashtable) 145#define sctp_ep_hashtable (sctp_globals.ep_hashtable)
146#define sctp_assoc_hashsize (sctp_globals.assoc_hashsize)
147#define sctp_assoc_hashtable (sctp_globals.assoc_hashtable)
148#define sctp_port_hashsize (sctp_globals.port_hashsize) 146#define sctp_port_hashsize (sctp_globals.port_hashsize)
149#define sctp_port_hashtable (sctp_globals.port_hashtable) 147#define sctp_port_hashtable (sctp_globals.port_hashtable)
148#define sctp_transport_hashtable (sctp_globals.transport_hashtable)
150#define sctp_checksum_disable (sctp_globals.checksum_disable) 149#define sctp_checksum_disable (sctp_globals.checksum_disable)
151 150
152/* SCTP Socket type: UDP or TCP style. */ 151/* SCTP Socket type: UDP or TCP style. */
@@ -753,6 +752,7 @@ static inline int sctp_packet_empty(struct sctp_packet *packet)
753struct sctp_transport { 752struct sctp_transport {
754 /* A list of transports. */ 753 /* A list of transports. */
755 struct list_head transports; 754 struct list_head transports;
755 struct rhash_head node;
756 756
757 /* Reference counting. */ 757 /* Reference counting. */
758 atomic_t refcnt; 758 atomic_t refcnt;
diff --git a/include/net/sock.h b/include/net/sock.h
index 14d3c0734007..e830c1006935 100644
--- a/include/net/sock.h
+++ b/include/net/sock.h
@@ -58,6 +58,8 @@
58#include <linux/memcontrol.h> 58#include <linux/memcontrol.h>
59#include <linux/static_key.h> 59#include <linux/static_key.h>
60#include <linux/sched.h> 60#include <linux/sched.h>
61#include <linux/wait.h>
62#include <linux/cgroup-defs.h>
61 63
62#include <linux/filter.h> 64#include <linux/filter.h>
63#include <linux/rculist_nulls.h> 65#include <linux/rculist_nulls.h>
@@ -287,7 +289,6 @@ struct cg_proto;
287 * @sk_ack_backlog: current listen backlog 289 * @sk_ack_backlog: current listen backlog
288 * @sk_max_ack_backlog: listen backlog set in listen() 290 * @sk_max_ack_backlog: listen backlog set in listen()
289 * @sk_priority: %SO_PRIORITY setting 291 * @sk_priority: %SO_PRIORITY setting
290 * @sk_cgrp_prioidx: socket group's priority map index
291 * @sk_type: socket type (%SOCK_STREAM, etc) 292 * @sk_type: socket type (%SOCK_STREAM, etc)
292 * @sk_protocol: which protocol this socket belongs in this network family 293 * @sk_protocol: which protocol this socket belongs in this network family
293 * @sk_peer_pid: &struct pid for this socket's peer 294 * @sk_peer_pid: &struct pid for this socket's peer
@@ -308,7 +309,7 @@ struct cg_proto;
308 * @sk_send_head: front of stuff to transmit 309 * @sk_send_head: front of stuff to transmit
309 * @sk_security: used by security modules 310 * @sk_security: used by security modules
310 * @sk_mark: generic packet mark 311 * @sk_mark: generic packet mark
311 * @sk_classid: this socket's cgroup classid 312 * @sk_cgrp_data: cgroup data for this cgroup
312 * @sk_cgrp: this socket's cgroup-specific proto data 313 * @sk_cgrp: this socket's cgroup-specific proto data
313 * @sk_write_pending: a write to stream socket waits to start 314 * @sk_write_pending: a write to stream socket waits to start
314 * @sk_state_change: callback to indicate change in the state of the sock 315 * @sk_state_change: callback to indicate change in the state of the sock
@@ -317,6 +318,7 @@ struct cg_proto;
317 * @sk_error_report: callback to indicate errors (e.g. %MSG_ERRQUEUE) 318 * @sk_error_report: callback to indicate errors (e.g. %MSG_ERRQUEUE)
318 * @sk_backlog_rcv: callback to process the backlog 319 * @sk_backlog_rcv: callback to process the backlog
319 * @sk_destruct: called at sock freeing time, i.e. when all refcnt == 0 320 * @sk_destruct: called at sock freeing time, i.e. when all refcnt == 0
321 * @sk_reuseport_cb: reuseport group container
320 */ 322 */
321struct sock { 323struct sock {
322 /* 324 /*
@@ -425,9 +427,7 @@ struct sock {
425 u32 sk_ack_backlog; 427 u32 sk_ack_backlog;
426 u32 sk_max_ack_backlog; 428 u32 sk_max_ack_backlog;
427 __u32 sk_priority; 429 __u32 sk_priority;
428#if IS_ENABLED(CONFIG_CGROUP_NET_PRIO) 430 __u32 sk_mark;
429 __u32 sk_cgrp_prioidx;
430#endif
431 struct pid *sk_peer_pid; 431 struct pid *sk_peer_pid;
432 const struct cred *sk_peer_cred; 432 const struct cred *sk_peer_cred;
433 long sk_rcvtimeo; 433 long sk_rcvtimeo;
@@ -445,10 +445,7 @@ struct sock {
445#ifdef CONFIG_SECURITY 445#ifdef CONFIG_SECURITY
446 void *sk_security; 446 void *sk_security;
447#endif 447#endif
448 __u32 sk_mark; 448 struct sock_cgroup_data sk_cgrp_data;
449#ifdef CONFIG_CGROUP_NET_CLASSID
450 u32 sk_classid;
451#endif
452 struct cg_proto *sk_cgrp; 449 struct cg_proto *sk_cgrp;
453 void (*sk_state_change)(struct sock *sk); 450 void (*sk_state_change)(struct sock *sk);
454 void (*sk_data_ready)(struct sock *sk); 451 void (*sk_data_ready)(struct sock *sk);
@@ -457,6 +454,7 @@ struct sock {
457 int (*sk_backlog_rcv)(struct sock *sk, 454 int (*sk_backlog_rcv)(struct sock *sk,
458 struct sk_buff *skb); 455 struct sk_buff *skb);
459 void (*sk_destruct)(struct sock *sk); 456 void (*sk_destruct)(struct sock *sk);
457 struct sock_reuseport __rcu *sk_reuseport_cb;
460}; 458};
461 459
462#define __sk_user_data(sk) ((*((void __rcu **)&(sk)->sk_user_data))) 460#define __sk_user_data(sk) ((*((void __rcu **)&(sk)->sk_user_data)))
@@ -778,9 +776,9 @@ static inline int sk_memalloc_socks(void)
778 776
779#endif 777#endif
780 778
781static inline gfp_t sk_gfp_atomic(const struct sock *sk, gfp_t gfp_mask) 779static inline gfp_t sk_gfp_mask(const struct sock *sk, gfp_t gfp_mask)
782{ 780{
783 return GFP_ATOMIC | (sk->sk_allocation & __GFP_MEMALLOC); 781 return gfp_mask | (sk->sk_allocation & __GFP_MEMALLOC);
784} 782}
785 783
786static inline void sk_acceptq_removed(struct sock *sk) 784static inline void sk_acceptq_removed(struct sock *sk)
@@ -1067,6 +1065,7 @@ struct proto {
1067 void (*destroy_cgroup)(struct mem_cgroup *memcg); 1065 void (*destroy_cgroup)(struct mem_cgroup *memcg);
1068 struct cg_proto *(*proto_cgroup)(struct mem_cgroup *memcg); 1066 struct cg_proto *(*proto_cgroup)(struct mem_cgroup *memcg);
1069#endif 1067#endif
1068 int (*diag_destroy)(struct sock *sk, int err);
1070}; 1069};
1071 1070
1072int proto_register(struct proto *prot, int alloc_slab); 1071int proto_register(struct proto *prot, int alloc_slab);
@@ -1798,6 +1797,15 @@ static inline void sk_nocaps_add(struct sock *sk, netdev_features_t flags)
1798 sk->sk_route_caps &= ~flags; 1797 sk->sk_route_caps &= ~flags;
1799} 1798}
1800 1799
1800static inline bool sk_check_csum_caps(struct sock *sk)
1801{
1802 return (sk->sk_route_caps & NETIF_F_HW_CSUM) ||
1803 (sk->sk_family == PF_INET &&
1804 (sk->sk_route_caps & NETIF_F_IP_CSUM)) ||
1805 (sk->sk_family == PF_INET6 &&
1806 (sk->sk_route_caps & NETIF_F_IPV6_CSUM));
1807}
1808
1801static inline int skb_do_copy_data_nocache(struct sock *sk, struct sk_buff *skb, 1809static inline int skb_do_copy_data_nocache(struct sock *sk, struct sk_buff *skb,
1802 struct iov_iter *from, char *to, 1810 struct iov_iter *from, char *to,
1803 int copy, int offset) 1811 int copy, int offset)
@@ -1883,12 +1891,12 @@ static inline bool sk_has_allocations(const struct sock *sk)
1883} 1891}
1884 1892
1885/** 1893/**
1886 * wq_has_sleeper - check if there are any waiting processes 1894 * skwq_has_sleeper - check if there are any waiting processes
1887 * @wq: struct socket_wq 1895 * @wq: struct socket_wq
1888 * 1896 *
1889 * Returns true if socket_wq has waiting processes 1897 * Returns true if socket_wq has waiting processes
1890 * 1898 *
1891 * The purpose of the wq_has_sleeper and sock_poll_wait is to wrap the memory 1899 * The purpose of the skwq_has_sleeper and sock_poll_wait is to wrap the memory
1892 * barrier call. They were added due to the race found within the tcp code. 1900 * barrier call. They were added due to the race found within the tcp code.
1893 * 1901 *
1894 * Consider following tcp code paths: 1902 * Consider following tcp code paths:
@@ -1914,15 +1922,9 @@ static inline bool sk_has_allocations(const struct sock *sk)
1914 * data on the socket. 1922 * data on the socket.
1915 * 1923 *
1916 */ 1924 */
1917static inline bool wq_has_sleeper(struct socket_wq *wq) 1925static inline bool skwq_has_sleeper(struct socket_wq *wq)
1918{ 1926{
1919 /* We need to be sure we are in sync with the 1927 return wq && wq_has_sleeper(&wq->wait);
1920 * add_wait_queue modifications to the wait queue.
1921 *
1922 * This memory barrier is paired in the sock_poll_wait.
1923 */
1924 smp_mb();
1925 return wq && waitqueue_active(&wq->wait);
1926} 1928}
1927 1929
1928/** 1930/**
diff --git a/include/net/sock_reuseport.h b/include/net/sock_reuseport.h
new file mode 100644
index 000000000000..7dda3d7adba8
--- /dev/null
+++ b/include/net/sock_reuseport.h
@@ -0,0 +1,28 @@
1#ifndef _SOCK_REUSEPORT_H
2#define _SOCK_REUSEPORT_H
3
4#include <linux/filter.h>
5#include <linux/skbuff.h>
6#include <linux/types.h>
7#include <net/sock.h>
8
9struct sock_reuseport {
10 struct rcu_head rcu;
11
12 u16 max_socks; /* length of socks */
13 u16 num_socks; /* elements in socks */
14 struct bpf_prog __rcu *prog; /* optional BPF sock selector */
15 struct sock *socks[0]; /* array of sock pointers */
16};
17
18extern int reuseport_alloc(struct sock *sk);
19extern int reuseport_add_sock(struct sock *sk, const struct sock *sk2);
20extern void reuseport_detach_sock(struct sock *sk);
21extern struct sock *reuseport_select_sock(struct sock *sk,
22 u32 hash,
23 struct sk_buff *skb,
24 int hdr_len);
25extern struct bpf_prog *reuseport_attach_prog(struct sock *sk,
26 struct bpf_prog *prog);
27
28#endif /* _SOCK_REUSEPORT_H */
diff --git a/include/net/switchdev.h b/include/net/switchdev.h
index 1d22ce9f352e..d451122e8404 100644
--- a/include/net/switchdev.h
+++ b/include/net/switchdev.h
@@ -47,9 +47,11 @@ enum switchdev_attr_id {
47 SWITCHDEV_ATTR_ID_PORT_STP_STATE, 47 SWITCHDEV_ATTR_ID_PORT_STP_STATE,
48 SWITCHDEV_ATTR_ID_PORT_BRIDGE_FLAGS, 48 SWITCHDEV_ATTR_ID_PORT_BRIDGE_FLAGS,
49 SWITCHDEV_ATTR_ID_BRIDGE_AGEING_TIME, 49 SWITCHDEV_ATTR_ID_BRIDGE_AGEING_TIME,
50 SWITCHDEV_ATTR_ID_BRIDGE_VLAN_FILTERING,
50}; 51};
51 52
52struct switchdev_attr { 53struct switchdev_attr {
54 struct net_device *orig_dev;
53 enum switchdev_attr_id id; 55 enum switchdev_attr_id id;
54 u32 flags; 56 u32 flags;
55 union { 57 union {
@@ -57,6 +59,7 @@ struct switchdev_attr {
57 u8 stp_state; /* PORT_STP_STATE */ 59 u8 stp_state; /* PORT_STP_STATE */
58 unsigned long brport_flags; /* PORT_BRIDGE_FLAGS */ 60 unsigned long brport_flags; /* PORT_BRIDGE_FLAGS */
59 u32 ageing_time; /* BRIDGE_AGEING_TIME */ 61 u32 ageing_time; /* BRIDGE_AGEING_TIME */
62 bool vlan_filtering; /* BRIDGE_VLAN_FILTERING */
60 } u; 63 } u;
61}; 64};
62 65
@@ -65,9 +68,11 @@ enum switchdev_obj_id {
65 SWITCHDEV_OBJ_ID_PORT_VLAN, 68 SWITCHDEV_OBJ_ID_PORT_VLAN,
66 SWITCHDEV_OBJ_ID_IPV4_FIB, 69 SWITCHDEV_OBJ_ID_IPV4_FIB,
67 SWITCHDEV_OBJ_ID_PORT_FDB, 70 SWITCHDEV_OBJ_ID_PORT_FDB,
71 SWITCHDEV_OBJ_ID_PORT_MDB,
68}; 72};
69 73
70struct switchdev_obj { 74struct switchdev_obj {
75 struct net_device *orig_dev;
71 enum switchdev_obj_id id; 76 enum switchdev_obj_id id;
72 u32 flags; 77 u32 flags;
73}; 78};
@@ -109,6 +114,16 @@ struct switchdev_obj_port_fdb {
109#define SWITCHDEV_OBJ_PORT_FDB(obj) \ 114#define SWITCHDEV_OBJ_PORT_FDB(obj) \
110 container_of(obj, struct switchdev_obj_port_fdb, obj) 115 container_of(obj, struct switchdev_obj_port_fdb, obj)
111 116
117/* SWITCHDEV_OBJ_ID_PORT_MDB */
118struct switchdev_obj_port_mdb {
119 struct switchdev_obj obj;
120 unsigned char addr[ETH_ALEN];
121 u16 vid;
122};
123
124#define SWITCHDEV_OBJ_PORT_MDB(obj) \
125 container_of(obj, struct switchdev_obj_port_mdb, obj)
126
112void switchdev_trans_item_enqueue(struct switchdev_trans *trans, 127void switchdev_trans_item_enqueue(struct switchdev_trans *trans,
113 void *data, void (*destructor)(void const *), 128 void *data, void (*destructor)(void const *),
114 struct switchdev_trans_item *tritem); 129 struct switchdev_trans_item *tritem);
diff --git a/include/net/tcp.h b/include/net/tcp.h
index f80e74c5ad18..a80255f4ca33 100644
--- a/include/net/tcp.h
+++ b/include/net/tcp.h
@@ -240,9 +240,6 @@ extern int sysctl_tcp_timestamps;
240extern int sysctl_tcp_window_scaling; 240extern int sysctl_tcp_window_scaling;
241extern int sysctl_tcp_sack; 241extern int sysctl_tcp_sack;
242extern int sysctl_tcp_fin_timeout; 242extern int sysctl_tcp_fin_timeout;
243extern int sysctl_tcp_keepalive_time;
244extern int sysctl_tcp_keepalive_probes;
245extern int sysctl_tcp_keepalive_intvl;
246extern int sysctl_tcp_syn_retries; 243extern int sysctl_tcp_syn_retries;
247extern int sysctl_tcp_synack_retries; 244extern int sysctl_tcp_synack_retries;
248extern int sysctl_tcp_retries1; 245extern int sysctl_tcp_retries1;
@@ -1170,6 +1167,8 @@ void tcp_set_state(struct sock *sk, int state);
1170 1167
1171void tcp_done(struct sock *sk); 1168void tcp_done(struct sock *sk);
1172 1169
1170int tcp_abort(struct sock *sk, int err);
1171
1173static inline void tcp_sack_reset(struct tcp_options_received *rx_opt) 1172static inline void tcp_sack_reset(struct tcp_options_received *rx_opt)
1174{ 1173{
1175 rx_opt->dsack = 0; 1174 rx_opt->dsack = 0;
@@ -1223,17 +1222,23 @@ void tcp_enter_memory_pressure(struct sock *sk);
1223 1222
1224static inline int keepalive_intvl_when(const struct tcp_sock *tp) 1223static inline int keepalive_intvl_when(const struct tcp_sock *tp)
1225{ 1224{
1226 return tp->keepalive_intvl ? : sysctl_tcp_keepalive_intvl; 1225 struct net *net = sock_net((struct sock *)tp);
1226
1227 return tp->keepalive_intvl ? : net->ipv4.sysctl_tcp_keepalive_intvl;
1227} 1228}
1228 1229
1229static inline int keepalive_time_when(const struct tcp_sock *tp) 1230static inline int keepalive_time_when(const struct tcp_sock *tp)
1230{ 1231{
1231 return tp->keepalive_time ? : sysctl_tcp_keepalive_time; 1232 struct net *net = sock_net((struct sock *)tp);
1233
1234 return tp->keepalive_time ? : net->ipv4.sysctl_tcp_keepalive_time;
1232} 1235}
1233 1236
1234static inline int keepalive_probes(const struct tcp_sock *tp) 1237static inline int keepalive_probes(const struct tcp_sock *tp)
1235{ 1238{
1236 return tp->keepalive_probes ? : sysctl_tcp_keepalive_probes; 1239 struct net *net = sock_net((struct sock *)tp);
1240
1241 return tp->keepalive_probes ? : net->ipv4.sysctl_tcp_keepalive_probes;
1237} 1242}
1238 1243
1239static inline u32 keepalive_time_elapsed(const struct tcp_sock *tp) 1244static inline u32 keepalive_time_elapsed(const struct tcp_sock *tp)
@@ -1618,6 +1623,18 @@ static inline void tcp_highest_sack_combine(struct sock *sk,
1618 tcp_sk(sk)->highest_sack = new; 1623 tcp_sk(sk)->highest_sack = new;
1619} 1624}
1620 1625
1626/* This helper checks if socket has IP_TRANSPARENT set */
1627static inline bool inet_sk_transparent(const struct sock *sk)
1628{
1629 switch (sk->sk_state) {
1630 case TCP_TIME_WAIT:
1631 return inet_twsk(sk)->tw_transparent;
1632 case TCP_NEW_SYN_RECV:
1633 return inet_rsk(inet_reqsk(sk))->no_srccheck;
1634 }
1635 return inet_sk(sk)->transparent;
1636}
1637
1621/* Determines whether this is a thin stream (which may suffer from 1638/* Determines whether this is a thin stream (which may suffer from
1622 * increased latency). Used to trigger latency-reducing mechanisms. 1639 * increased latency). Used to trigger latency-reducing mechanisms.
1623 */ 1640 */
diff --git a/include/net/udp.h b/include/net/udp.h
index 6d4ed18e1427..2842541e28e7 100644
--- a/include/net/udp.h
+++ b/include/net/udp.h
@@ -191,7 +191,7 @@ static inline void udp_lib_close(struct sock *sk, long timeout)
191} 191}
192 192
193int udp_lib_get_port(struct sock *sk, unsigned short snum, 193int udp_lib_get_port(struct sock *sk, unsigned short snum,
194 int (*)(const struct sock *, const struct sock *), 194 int (*)(const struct sock *, const struct sock *, bool),
195 unsigned int hash2_nulladdr); 195 unsigned int hash2_nulladdr);
196 196
197u32 udp_flow_hashrnd(void); 197u32 udp_flow_hashrnd(void);
@@ -258,7 +258,7 @@ struct sock *udp4_lib_lookup(struct net *net, __be32 saddr, __be16 sport,
258 __be32 daddr, __be16 dport, int dif); 258 __be32 daddr, __be16 dport, int dif);
259struct sock *__udp4_lib_lookup(struct net *net, __be32 saddr, __be16 sport, 259struct sock *__udp4_lib_lookup(struct net *net, __be32 saddr, __be16 sport,
260 __be32 daddr, __be16 dport, int dif, 260 __be32 daddr, __be16 dport, int dif,
261 struct udp_table *tbl); 261 struct udp_table *tbl, struct sk_buff *skb);
262struct sock *udp6_lib_lookup(struct net *net, 262struct sock *udp6_lib_lookup(struct net *net,
263 const struct in6_addr *saddr, __be16 sport, 263 const struct in6_addr *saddr, __be16 sport,
264 const struct in6_addr *daddr, __be16 dport, 264 const struct in6_addr *daddr, __be16 dport,
@@ -266,7 +266,8 @@ struct sock *udp6_lib_lookup(struct net *net,
266struct sock *__udp6_lib_lookup(struct net *net, 266struct sock *__udp6_lib_lookup(struct net *net,
267 const struct in6_addr *saddr, __be16 sport, 267 const struct in6_addr *saddr, __be16 sport,
268 const struct in6_addr *daddr, __be16 dport, 268 const struct in6_addr *daddr, __be16 dport,
269 int dif, struct udp_table *tbl); 269 int dif, struct udp_table *tbl,
270 struct sk_buff *skb);
270 271
271/* 272/*
272 * SNMP statistics for UDP and UDP-Lite 273 * SNMP statistics for UDP and UDP-Lite
diff --git a/include/net/udp_tunnel.h b/include/net/udp_tunnel.h
index cb2f89f20f5c..cca2ad3082c3 100644
--- a/include/net/udp_tunnel.h
+++ b/include/net/udp_tunnel.h
@@ -78,10 +78,10 @@ void setup_udp_tunnel_sock(struct net *net, struct socket *sock,
78 struct udp_tunnel_sock_cfg *sock_cfg); 78 struct udp_tunnel_sock_cfg *sock_cfg);
79 79
80/* Transmit the skb using UDP encapsulation. */ 80/* Transmit the skb using UDP encapsulation. */
81int udp_tunnel_xmit_skb(struct rtable *rt, struct sock *sk, struct sk_buff *skb, 81void udp_tunnel_xmit_skb(struct rtable *rt, struct sock *sk, struct sk_buff *skb,
82 __be32 src, __be32 dst, __u8 tos, __u8 ttl, 82 __be32 src, __be32 dst, __u8 tos, __u8 ttl,
83 __be16 df, __be16 src_port, __be16 dst_port, 83 __be16 df, __be16 src_port, __be16 dst_port,
84 bool xnet, bool nocheck); 84 bool xnet, bool nocheck);
85 85
86#if IS_ENABLED(CONFIG_IPV6) 86#if IS_ENABLED(CONFIG_IPV6)
87int udp_tunnel6_xmit_skb(struct dst_entry *dst, struct sock *sk, 87int udp_tunnel6_xmit_skb(struct dst_entry *dst, struct sock *sk,
diff --git a/include/net/vxlan.h b/include/net/vxlan.h
index e289ada6adf6..0fb86442544b 100644
--- a/include/net/vxlan.h
+++ b/include/net/vxlan.h
@@ -232,7 +232,7 @@ static inline netdev_features_t vxlan_features_check(struct sk_buff *skb,
232 skb->inner_protocol != htons(ETH_P_TEB) || 232 skb->inner_protocol != htons(ETH_P_TEB) ||
233 (skb_inner_mac_header(skb) - skb_transport_header(skb) != 233 (skb_inner_mac_header(skb) - skb_transport_header(skb) !=
234 sizeof(struct udphdr) + sizeof(struct vxlanhdr)))) 234 sizeof(struct udphdr) + sizeof(struct vxlanhdr))))
235 return features & ~(NETIF_F_ALL_CSUM | NETIF_F_GSO_MASK); 235 return features & ~(NETIF_F_CSUM_MASK | NETIF_F_GSO_MASK);
236 236
237 return features; 237 return features;
238} 238}
diff --git a/include/trace/events/fib6.h b/include/trace/events/fib6.h
new file mode 100644
index 000000000000..4cf6bac4686d
--- /dev/null
+++ b/include/trace/events/fib6.h
@@ -0,0 +1,76 @@
1#undef TRACE_SYSTEM
2#define TRACE_SYSTEM fib6
3
4#if !defined(_TRACE_FIB6_H) || defined(TRACE_HEADER_MULTI_READ)
5#define _TRACE_FIB6_H
6
7#include <linux/in6.h>
8#include <net/flow.h>
9#include <net/ip6_fib.h>
10#include <linux/tracepoint.h>
11
12TRACE_EVENT(fib6_table_lookup,
13
14 TP_PROTO(const struct net *net, const struct rt6_info *rt,
15 u32 tb_id, const struct flowi6 *flp),
16
17 TP_ARGS(net, rt, tb_id, flp),
18
19 TP_STRUCT__entry(
20 __field( u32, tb_id )
21
22 __field( int, oif )
23 __field( int, iif )
24 __field( __u8, tos )
25 __field( __u8, scope )
26 __field( __u8, flags )
27 __array( __u8, src, 16 )
28 __array( __u8, dst, 16 )
29
30 __dynamic_array( char, name, IFNAMSIZ )
31 __array( __u8, gw, 16 )
32 ),
33
34 TP_fast_assign(
35 struct in6_addr *in6;
36
37 __entry->tb_id = tb_id;
38 __entry->oif = flp->flowi6_oif;
39 __entry->iif = flp->flowi6_iif;
40 __entry->tos = flp->flowi6_tos;
41 __entry->scope = flp->flowi6_scope;
42 __entry->flags = flp->flowi6_flags;
43
44 in6 = (struct in6_addr *)__entry->src;
45 *in6 = flp->saddr;
46
47 in6 = (struct in6_addr *)__entry->dst;
48 *in6 = flp->daddr;
49
50 if (rt->rt6i_idev) {
51 __assign_str(name, rt->rt6i_idev->dev->name);
52 } else {
53 __assign_str(name, "");
54 }
55 if (rt == net->ipv6.ip6_null_entry) {
56 struct in6_addr in6_zero = {};
57
58 in6 = (struct in6_addr *)__entry->gw;
59 *in6 = in6_zero;
60
61 } else if (rt) {
62 in6 = (struct in6_addr *)__entry->gw;
63 *in6 = rt->rt6i_gateway;
64 }
65 ),
66
67 TP_printk("table %3u oif %d iif %d src %pI6c dst %pI6c tos %d scope %d flags %x ==> dev %s gw %pI6c",
68 __entry->tb_id, __entry->oif, __entry->iif,
69 __entry->src, __entry->dst, __entry->tos, __entry->scope,
70 __entry->flags, __get_str(name), __entry->gw)
71);
72
73#endif /* _TRACE_FIB6_H */
74
75/* This part must be outside protection */
76#include <trace/define_trace.h>
diff --git a/include/uapi/asm-generic/socket.h b/include/uapi/asm-generic/socket.h
index 5c15c2a5c123..fb8a41668382 100644
--- a/include/uapi/asm-generic/socket.h
+++ b/include/uapi/asm-generic/socket.h
@@ -87,4 +87,7 @@
87#define SO_ATTACH_BPF 50 87#define SO_ATTACH_BPF 50
88#define SO_DETACH_BPF SO_DETACH_FILTER 88#define SO_DETACH_BPF SO_DETACH_FILTER
89 89
90#define SO_ATTACH_REUSEPORT_CBPF 51
91#define SO_ATTACH_REUSEPORT_EBPF 52
92
90#endif /* __ASM_GENERIC_SOCKET_H */ 93#endif /* __ASM_GENERIC_SOCKET_H */
diff --git a/include/uapi/linux/bpf.h b/include/uapi/linux/bpf.h
index 9ea2d22fa2cb..aa6f8571de13 100644
--- a/include/uapi/linux/bpf.h
+++ b/include/uapi/linux/bpf.h
@@ -269,9 +269,29 @@ enum bpf_func_id {
269 * Return: 0 on success 269 * Return: 0 on success
270 */ 270 */
271 BPF_FUNC_perf_event_output, 271 BPF_FUNC_perf_event_output,
272 BPF_FUNC_skb_load_bytes,
272 __BPF_FUNC_MAX_ID, 273 __BPF_FUNC_MAX_ID,
273}; 274};
274 275
276/* All flags used by eBPF helper functions, placed here. */
277
278/* BPF_FUNC_skb_store_bytes flags. */
279#define BPF_F_RECOMPUTE_CSUM (1ULL << 0)
280
281/* BPF_FUNC_l3_csum_replace and BPF_FUNC_l4_csum_replace flags.
282 * First 4 bits are for passing the header field size.
283 */
284#define BPF_F_HDR_FIELD_MASK 0xfULL
285
286/* BPF_FUNC_l4_csum_replace flags. */
287#define BPF_F_PSEUDO_HDR (1ULL << 4)
288
289/* BPF_FUNC_clone_redirect and BPF_FUNC_redirect flags. */
290#define BPF_F_INGRESS (1ULL << 0)
291
292/* BPF_FUNC_skb_set_tunnel_key and BPF_FUNC_skb_get_tunnel_key flags. */
293#define BPF_F_TUNINFO_IPV6 (1ULL << 0)
294
275/* user accessible mirror of in-kernel sk_buff. 295/* user accessible mirror of in-kernel sk_buff.
276 * new fields can only be added to the end of this structure 296 * new fields can only be added to the end of this structure
277 */ 297 */
@@ -295,7 +315,12 @@ struct __sk_buff {
295 315
296struct bpf_tunnel_key { 316struct bpf_tunnel_key {
297 __u32 tunnel_id; 317 __u32 tunnel_id;
298 __u32 remote_ipv4; 318 union {
319 __u32 remote_ipv4;
320 __u32 remote_ipv6[4];
321 };
322 __u8 tunnel_tos;
323 __u8 tunnel_ttl;
299}; 324};
300 325
301#endif /* _UAPI__LINUX_BPF_H__ */ 326#endif /* _UAPI__LINUX_BPF_H__ */
diff --git a/include/uapi/linux/ethtool.h b/include/uapi/linux/ethtool.h
index cd1629170103..57fa39005e79 100644
--- a/include/uapi/linux/ethtool.h
+++ b/include/uapi/linux/ethtool.h
@@ -542,6 +542,7 @@ struct ethtool_pauseparam {
542 * now deprecated 542 * now deprecated
543 * @ETH_SS_FEATURES: Device feature names 543 * @ETH_SS_FEATURES: Device feature names
544 * @ETH_SS_RSS_HASH_FUNCS: RSS hush function names 544 * @ETH_SS_RSS_HASH_FUNCS: RSS hush function names
545 * @ETH_SS_PHY_STATS: Statistic names, for use with %ETHTOOL_GPHYSTATS
545 */ 546 */
546enum ethtool_stringset { 547enum ethtool_stringset {
547 ETH_SS_TEST = 0, 548 ETH_SS_TEST = 0,
@@ -551,6 +552,7 @@ enum ethtool_stringset {
551 ETH_SS_FEATURES, 552 ETH_SS_FEATURES,
552 ETH_SS_RSS_HASH_FUNCS, 553 ETH_SS_RSS_HASH_FUNCS,
553 ETH_SS_TUNABLES, 554 ETH_SS_TUNABLES,
555 ETH_SS_PHY_STATS,
554}; 556};
555 557
556/** 558/**
@@ -1225,6 +1227,7 @@ enum ethtool_sfeatures_retval_bits {
1225#define ETHTOOL_SRSSH 0x00000047 /* Set RX flow hash configuration */ 1227#define ETHTOOL_SRSSH 0x00000047 /* Set RX flow hash configuration */
1226#define ETHTOOL_GTUNABLE 0x00000048 /* Get tunable configuration */ 1228#define ETHTOOL_GTUNABLE 0x00000048 /* Get tunable configuration */
1227#define ETHTOOL_STUNABLE 0x00000049 /* Set tunable configuration */ 1229#define ETHTOOL_STUNABLE 0x00000049 /* Set tunable configuration */
1230#define ETHTOOL_GPHYSTATS 0x0000004a /* get PHY-specific statistics */
1228 1231
1229/* compatibility with older code */ 1232/* compatibility with older code */
1230#define SPARC_ETH_GSET ETHTOOL_GSET 1233#define SPARC_ETH_GSET ETHTOOL_GSET
diff --git a/include/uapi/linux/if_link.h b/include/uapi/linux/if_link.h
index 5ad57375a99f..a30b78090594 100644
--- a/include/uapi/linux/if_link.h
+++ b/include/uapi/linux/if_link.h
@@ -218,6 +218,7 @@ enum in6_addr_gen_mode {
218 IN6_ADDR_GEN_MODE_EUI64, 218 IN6_ADDR_GEN_MODE_EUI64,
219 IN6_ADDR_GEN_MODE_NONE, 219 IN6_ADDR_GEN_MODE_NONE,
220 IN6_ADDR_GEN_MODE_STABLE_PRIVACY, 220 IN6_ADDR_GEN_MODE_STABLE_PRIVACY,
221 IN6_ADDR_GEN_MODE_RANDOM,
221}; 222};
222 223
223/* Bridge section */ 224/* Bridge section */
@@ -462,6 +463,9 @@ enum {
462 IFLA_GENEVE_PORT, /* destination port */ 463 IFLA_GENEVE_PORT, /* destination port */
463 IFLA_GENEVE_COLLECT_METADATA, 464 IFLA_GENEVE_COLLECT_METADATA,
464 IFLA_GENEVE_REMOTE6, 465 IFLA_GENEVE_REMOTE6,
466 IFLA_GENEVE_UDP_CSUM,
467 IFLA_GENEVE_UDP_ZERO_CSUM6_TX,
468 IFLA_GENEVE_UDP_ZERO_CSUM6_RX,
465 __IFLA_GENEVE_MAX 469 __IFLA_GENEVE_MAX
466}; 470};
467#define IFLA_GENEVE_MAX (__IFLA_GENEVE_MAX - 1) 471#define IFLA_GENEVE_MAX (__IFLA_GENEVE_MAX - 1)
diff --git a/include/uapi/linux/ila.h b/include/uapi/linux/ila.h
index 7ed9e670814e..abde7bbd6f3b 100644
--- a/include/uapi/linux/ila.h
+++ b/include/uapi/linux/ila.h
@@ -3,13 +3,35 @@
3#ifndef _UAPI_LINUX_ILA_H 3#ifndef _UAPI_LINUX_ILA_H
4#define _UAPI_LINUX_ILA_H 4#define _UAPI_LINUX_ILA_H
5 5
6/* NETLINK_GENERIC related info */
7#define ILA_GENL_NAME "ila"
8#define ILA_GENL_VERSION 0x1
9
6enum { 10enum {
7 ILA_ATTR_UNSPEC, 11 ILA_ATTR_UNSPEC,
8 ILA_ATTR_LOCATOR, /* u64 */ 12 ILA_ATTR_LOCATOR, /* u64 */
13 ILA_ATTR_IDENTIFIER, /* u64 */
14 ILA_ATTR_LOCATOR_MATCH, /* u64 */
15 ILA_ATTR_IFINDEX, /* s32 */
16 ILA_ATTR_DIR, /* u32 */
9 17
10 __ILA_ATTR_MAX, 18 __ILA_ATTR_MAX,
11}; 19};
12 20
13#define ILA_ATTR_MAX (__ILA_ATTR_MAX - 1) 21#define ILA_ATTR_MAX (__ILA_ATTR_MAX - 1)
14 22
23enum {
24 ILA_CMD_UNSPEC,
25 ILA_CMD_ADD,
26 ILA_CMD_DEL,
27 ILA_CMD_GET,
28
29 __ILA_CMD_MAX,
30};
31
32#define ILA_CMD_MAX (__ILA_CMD_MAX - 1)
33
34#define ILA_DIR_IN (1 << 0)
35#define ILA_DIR_OUT (1 << 1)
36
15#endif /* _UAPI_LINUX_ILA_H */ 37#endif /* _UAPI_LINUX_ILA_H */
diff --git a/include/uapi/linux/in6.h b/include/uapi/linux/in6.h
index 79b12b004ade..318a4828bf98 100644
--- a/include/uapi/linux/in6.h
+++ b/include/uapi/linux/in6.h
@@ -196,6 +196,7 @@ struct in6_flowlabel_req {
196 196
197#define IPV6_IPSEC_POLICY 34 197#define IPV6_IPSEC_POLICY 34
198#define IPV6_XFRM_POLICY 35 198#define IPV6_XFRM_POLICY 35
199#define IPV6_HDRINCL 36
199#endif 200#endif
200 201
201/* 202/*
diff --git a/include/uapi/linux/mroute.h b/include/uapi/linux/mroute.h
index a382d2c04a42..cf943016930f 100644
--- a/include/uapi/linux/mroute.h
+++ b/include/uapi/linux/mroute.h
@@ -4,15 +4,13 @@
4#include <linux/sockios.h> 4#include <linux/sockios.h>
5#include <linux/types.h> 5#include <linux/types.h>
6 6
7/* 7/* Based on the MROUTING 3.5 defines primarily to keep
8 * Based on the MROUTING 3.5 defines primarily to keep 8 * source compatibility with BSD.
9 * source compatibility with BSD.
10 * 9 *
11 * See the mrouted code for the original history. 10 * See the mrouted code for the original history.
12 *
13 * Protocol Independent Multicast (PIM) data structures included
14 * Carlos Picoto (cap@di.fc.ul.pt)
15 * 11 *
12 * Protocol Independent Multicast (PIM) data structures included
13 * Carlos Picoto (cap@di.fc.ul.pt)
16 */ 14 */
17 15
18#define MRT_BASE 200 16#define MRT_BASE 200
@@ -34,15 +32,13 @@
34#define SIOCGETSGCNT (SIOCPROTOPRIVATE+1) 32#define SIOCGETSGCNT (SIOCPROTOPRIVATE+1)
35#define SIOCGETRPF (SIOCPROTOPRIVATE+2) 33#define SIOCGETRPF (SIOCPROTOPRIVATE+2)
36 34
37#define MAXVIFS 32 35#define MAXVIFS 32
38typedef unsigned long vifbitmap_t; /* User mode code depends on this lot */ 36typedef unsigned long vifbitmap_t; /* User mode code depends on this lot */
39typedef unsigned short vifi_t; 37typedef unsigned short vifi_t;
40#define ALL_VIFS ((vifi_t)(-1)) 38#define ALL_VIFS ((vifi_t)(-1))
41 39
42/* 40/* Same idea as select */
43 * Same idea as select 41
44 */
45
46#define VIFM_SET(n,m) ((m)|=(1<<(n))) 42#define VIFM_SET(n,m) ((m)|=(1<<(n)))
47#define VIFM_CLR(n,m) ((m)&=~(1<<(n))) 43#define VIFM_CLR(n,m) ((m)&=~(1<<(n)))
48#define VIFM_ISSET(n,m) ((m)&(1<<(n))) 44#define VIFM_ISSET(n,m) ((m)&(1<<(n)))
@@ -50,11 +46,9 @@ typedef unsigned short vifi_t;
50#define VIFM_COPY(mfrom,mto) ((mto)=(mfrom)) 46#define VIFM_COPY(mfrom,mto) ((mto)=(mfrom))
51#define VIFM_SAME(m1,m2) ((m1)==(m2)) 47#define VIFM_SAME(m1,m2) ((m1)==(m2))
52 48
53/* 49/* Passed by mrouted for an MRT_ADD_VIF - again we use the
54 * Passed by mrouted for an MRT_ADD_VIF - again we use the 50 * mrouted 3.6 structures for compatibility
55 * mrouted 3.6 structures for compatibility
56 */ 51 */
57
58struct vifctl { 52struct vifctl {
59 vifi_t vifc_vifi; /* Index of VIF */ 53 vifi_t vifc_vifi; /* Index of VIF */
60 unsigned char vifc_flags; /* VIFF_ flags */ 54 unsigned char vifc_flags; /* VIFF_ flags */
@@ -73,10 +67,7 @@ struct vifctl {
73#define VIFF_USE_IFINDEX 0x8 /* use vifc_lcl_ifindex instead of 67#define VIFF_USE_IFINDEX 0x8 /* use vifc_lcl_ifindex instead of
74 vifc_lcl_addr to find an interface */ 68 vifc_lcl_addr to find an interface */
75 69
76/* 70/* Cache manipulation structures for mrouted and PIMd */
77 * Cache manipulation structures for mrouted and PIMd
78 */
79
80struct mfcctl { 71struct mfcctl {
81 struct in_addr mfcc_origin; /* Origin of mcast */ 72 struct in_addr mfcc_origin; /* Origin of mcast */
82 struct in_addr mfcc_mcastgrp; /* Group in question */ 73 struct in_addr mfcc_mcastgrp; /* Group in question */
@@ -88,10 +79,7 @@ struct mfcctl {
88 int mfcc_expire; 79 int mfcc_expire;
89}; 80};
90 81
91/* 82/* Group count retrieval for mrouted */
92 * Group count retrieval for mrouted
93 */
94
95struct sioc_sg_req { 83struct sioc_sg_req {
96 struct in_addr src; 84 struct in_addr src;
97 struct in_addr grp; 85 struct in_addr grp;
@@ -100,10 +88,7 @@ struct sioc_sg_req {
100 unsigned long wrong_if; 88 unsigned long wrong_if;
101}; 89};
102 90
103/* 91/* To get vif packet counts */
104 * To get vif packet counts
105 */
106
107struct sioc_vif_req { 92struct sioc_vif_req {
108 vifi_t vifi; /* Which iface */ 93 vifi_t vifi; /* Which iface */
109 unsigned long icount; /* In packets */ 94 unsigned long icount; /* In packets */
@@ -112,11 +97,9 @@ struct sioc_vif_req {
112 unsigned long obytes; /* Out bytes */ 97 unsigned long obytes; /* Out bytes */
113}; 98};
114 99
115/* 100/* This is the format the mroute daemon expects to see IGMP control
116 * This is the format the mroute daemon expects to see IGMP control 101 * data. Magically happens to be like an IP packet as per the original
117 * data. Magically happens to be like an IP packet as per the original
118 */ 102 */
119
120struct igmpmsg { 103struct igmpmsg {
121 __u32 unused1,unused2; 104 __u32 unused1,unused2;
122 unsigned char im_msgtype; /* What is this */ 105 unsigned char im_msgtype; /* What is this */
@@ -126,21 +109,13 @@ struct igmpmsg {
126 struct in_addr im_src,im_dst; 109 struct in_addr im_src,im_dst;
127}; 110};
128 111
129/* 112/* That's all usermode folks */
130 * That's all usermode folks
131 */
132
133
134 113
135#define MFC_ASSERT_THRESH (3*HZ) /* Maximal freq. of asserts */ 114#define MFC_ASSERT_THRESH (3*HZ) /* Maximal freq. of asserts */
136 115
137/* 116/* Pseudo messages used by mrouted */
138 * Pseudo messages used by mrouted
139 */
140
141#define IGMPMSG_NOCACHE 1 /* Kern cache fill request to mrouted */ 117#define IGMPMSG_NOCACHE 1 /* Kern cache fill request to mrouted */
142#define IGMPMSG_WRONGVIF 2 /* For PIM assert processing (unused) */ 118#define IGMPMSG_WRONGVIF 2 /* For PIM assert processing (unused) */
143#define IGMPMSG_WHOLEPKT 3 /* For PIM Register processing */ 119#define IGMPMSG_WHOLEPKT 3 /* For PIM Register processing */
144 120
145
146#endif /* _UAPI__LINUX_MROUTE_H */ 121#endif /* _UAPI__LINUX_MROUTE_H */
diff --git a/include/uapi/linux/netfilter/ipset/ip_set_bitmap.h b/include/uapi/linux/netfilter/ipset/ip_set_bitmap.h
index 6a2c038d1888..fd5024d26269 100644
--- a/include/uapi/linux/netfilter/ipset/ip_set_bitmap.h
+++ b/include/uapi/linux/netfilter/ipset/ip_set_bitmap.h
@@ -1,6 +1,8 @@
1#ifndef _UAPI__IP_SET_BITMAP_H 1#ifndef _UAPI__IP_SET_BITMAP_H
2#define _UAPI__IP_SET_BITMAP_H 2#define _UAPI__IP_SET_BITMAP_H
3 3
4#include <linux/netfilter/ipset/ip_set.h>
5
4/* Bitmap type specific error codes */ 6/* Bitmap type specific error codes */
5enum { 7enum {
6 /* The element is out of the range of the set */ 8 /* The element is out of the range of the set */
diff --git a/include/uapi/linux/netfilter/ipset/ip_set_hash.h b/include/uapi/linux/netfilter/ipset/ip_set_hash.h
index 352eeccdc7f2..82deeb883ac4 100644
--- a/include/uapi/linux/netfilter/ipset/ip_set_hash.h
+++ b/include/uapi/linux/netfilter/ipset/ip_set_hash.h
@@ -1,6 +1,8 @@
1#ifndef _UAPI__IP_SET_HASH_H 1#ifndef _UAPI__IP_SET_HASH_H
2#define _UAPI__IP_SET_HASH_H 2#define _UAPI__IP_SET_HASH_H
3 3
4#include <linux/netfilter/ipset/ip_set.h>
5
4/* Hash type specific error codes */ 6/* Hash type specific error codes */
5enum { 7enum {
6 /* Hash is full */ 8 /* Hash is full */
diff --git a/include/uapi/linux/netfilter/ipset/ip_set_list.h b/include/uapi/linux/netfilter/ipset/ip_set_list.h
index a44efaa98213..84d430368266 100644
--- a/include/uapi/linux/netfilter/ipset/ip_set_list.h
+++ b/include/uapi/linux/netfilter/ipset/ip_set_list.h
@@ -1,6 +1,8 @@
1#ifndef _UAPI__IP_SET_LIST_H 1#ifndef _UAPI__IP_SET_LIST_H
2#define _UAPI__IP_SET_LIST_H 2#define _UAPI__IP_SET_LIST_H
3 3
4#include <linux/netfilter/ipset/ip_set.h>
5
4/* List type specific error codes */ 6/* List type specific error codes */
5enum { 7enum {
6 /* Set name to be added/deleted/tested does not exist. */ 8 /* Set name to be added/deleted/tested does not exist. */
diff --git a/include/uapi/linux/netfilter/nf_conntrack_sctp.h b/include/uapi/linux/netfilter/nf_conntrack_sctp.h
index ed4e776e1242..2cbc366c3fb4 100644
--- a/include/uapi/linux/netfilter/nf_conntrack_sctp.h
+++ b/include/uapi/linux/netfilter/nf_conntrack_sctp.h
@@ -1,5 +1,5 @@
1#ifndef _NF_CONNTRACK_SCTP_H 1#ifndef _UAPI_NF_CONNTRACK_SCTP_H
2#define _NF_CONNTRACK_SCTP_H 2#define _UAPI_NF_CONNTRACK_SCTP_H
3/* SCTP tracking. */ 3/* SCTP tracking. */
4 4
5#include <linux/netfilter/nf_conntrack_tuple_common.h> 5#include <linux/netfilter/nf_conntrack_tuple_common.h>
@@ -18,10 +18,4 @@ enum sctp_conntrack {
18 SCTP_CONNTRACK_MAX 18 SCTP_CONNTRACK_MAX
19}; 19};
20 20
21struct ip_ct_sctp { 21#endif /* _UAPI_NF_CONNTRACK_SCTP_H */
22 enum sctp_conntrack state;
23
24 __be32 vtag[IP_CT_DIR_MAX];
25};
26
27#endif /* _NF_CONNTRACK_SCTP_H */
diff --git a/include/uapi/linux/netfilter/nf_conntrack_tuple_common.h b/include/uapi/linux/netfilter/nf_conntrack_tuple_common.h
index 2f6bbc5b8125..a9c3834abdd4 100644
--- a/include/uapi/linux/netfilter/nf_conntrack_tuple_common.h
+++ b/include/uapi/linux/netfilter/nf_conntrack_tuple_common.h
@@ -1,6 +1,9 @@
1#ifndef _NF_CONNTRACK_TUPLE_COMMON_H 1#ifndef _NF_CONNTRACK_TUPLE_COMMON_H
2#define _NF_CONNTRACK_TUPLE_COMMON_H 2#define _NF_CONNTRACK_TUPLE_COMMON_H
3 3
4#include <linux/types.h>
5#include <linux/netfilter.h>
6
4enum ip_conntrack_dir { 7enum ip_conntrack_dir {
5 IP_CT_DIR_ORIGINAL, 8 IP_CT_DIR_ORIGINAL,
6 IP_CT_DIR_REPLY, 9 IP_CT_DIR_REPLY,
diff --git a/include/uapi/linux/netfilter/nf_tables.h b/include/uapi/linux/netfilter/nf_tables.h
index d8c8a7c9d88a..be41ffc128b8 100644
--- a/include/uapi/linux/netfilter/nf_tables.h
+++ b/include/uapi/linux/netfilter/nf_tables.h
@@ -83,6 +83,7 @@ enum nft_verdicts {
83 * @NFT_MSG_DELSETELEM: delete a set element (enum nft_set_elem_attributes) 83 * @NFT_MSG_DELSETELEM: delete a set element (enum nft_set_elem_attributes)
84 * @NFT_MSG_NEWGEN: announce a new generation, only for events (enum nft_gen_attributes) 84 * @NFT_MSG_NEWGEN: announce a new generation, only for events (enum nft_gen_attributes)
85 * @NFT_MSG_GETGEN: get the rule-set generation (enum nft_gen_attributes) 85 * @NFT_MSG_GETGEN: get the rule-set generation (enum nft_gen_attributes)
86 * @NFT_MSG_TRACE: trace event (enum nft_trace_attributes)
86 */ 87 */
87enum nf_tables_msg_types { 88enum nf_tables_msg_types {
88 NFT_MSG_NEWTABLE, 89 NFT_MSG_NEWTABLE,
@@ -102,6 +103,7 @@ enum nf_tables_msg_types {
102 NFT_MSG_DELSETELEM, 103 NFT_MSG_DELSETELEM,
103 NFT_MSG_NEWGEN, 104 NFT_MSG_NEWGEN,
104 NFT_MSG_GETGEN, 105 NFT_MSG_GETGEN,
106 NFT_MSG_TRACE,
105 NFT_MSG_MAX, 107 NFT_MSG_MAX,
106}; 108};
107 109
@@ -289,6 +291,7 @@ enum nft_set_desc_attributes {
289 * @NFTA_SET_ID: uniquely identifies a set in a transaction (NLA_U32) 291 * @NFTA_SET_ID: uniquely identifies a set in a transaction (NLA_U32)
290 * @NFTA_SET_TIMEOUT: default timeout value (NLA_U64) 292 * @NFTA_SET_TIMEOUT: default timeout value (NLA_U64)
291 * @NFTA_SET_GC_INTERVAL: garbage collection interval (NLA_U32) 293 * @NFTA_SET_GC_INTERVAL: garbage collection interval (NLA_U32)
294 * @NFTA_SET_USERDATA: user data (NLA_BINARY)
292 */ 295 */
293enum nft_set_attributes { 296enum nft_set_attributes {
294 NFTA_SET_UNSPEC, 297 NFTA_SET_UNSPEC,
@@ -304,6 +307,7 @@ enum nft_set_attributes {
304 NFTA_SET_ID, 307 NFTA_SET_ID,
305 NFTA_SET_TIMEOUT, 308 NFTA_SET_TIMEOUT,
306 NFTA_SET_GC_INTERVAL, 309 NFTA_SET_GC_INTERVAL,
310 NFTA_SET_USERDATA,
307 __NFTA_SET_MAX 311 __NFTA_SET_MAX
308}; 312};
309#define NFTA_SET_MAX (__NFTA_SET_MAX - 1) 313#define NFTA_SET_MAX (__NFTA_SET_MAX - 1)
@@ -598,12 +602,26 @@ enum nft_payload_bases {
598}; 602};
599 603
600/** 604/**
605 * enum nft_payload_csum_types - nf_tables payload expression checksum types
606 *
607 * @NFT_PAYLOAD_CSUM_NONE: no checksumming
608 * @NFT_PAYLOAD_CSUM_INET: internet checksum (RFC 791)
609 */
610enum nft_payload_csum_types {
611 NFT_PAYLOAD_CSUM_NONE,
612 NFT_PAYLOAD_CSUM_INET,
613};
614
615/**
601 * enum nft_payload_attributes - nf_tables payload expression netlink attributes 616 * enum nft_payload_attributes - nf_tables payload expression netlink attributes
602 * 617 *
603 * @NFTA_PAYLOAD_DREG: destination register to load data into (NLA_U32: nft_registers) 618 * @NFTA_PAYLOAD_DREG: destination register to load data into (NLA_U32: nft_registers)
604 * @NFTA_PAYLOAD_BASE: payload base (NLA_U32: nft_payload_bases) 619 * @NFTA_PAYLOAD_BASE: payload base (NLA_U32: nft_payload_bases)
605 * @NFTA_PAYLOAD_OFFSET: payload offset relative to base (NLA_U32) 620 * @NFTA_PAYLOAD_OFFSET: payload offset relative to base (NLA_U32)
606 * @NFTA_PAYLOAD_LEN: payload length (NLA_U32) 621 * @NFTA_PAYLOAD_LEN: payload length (NLA_U32)
622 * @NFTA_PAYLOAD_SREG: source register to load data from (NLA_U32: nft_registers)
623 * @NFTA_PAYLOAD_CSUM_TYPE: checksum type (NLA_U32)
624 * @NFTA_PAYLOAD_CSUM_OFFSET: checksum offset relative to base (NLA_U32)
607 */ 625 */
608enum nft_payload_attributes { 626enum nft_payload_attributes {
609 NFTA_PAYLOAD_UNSPEC, 627 NFTA_PAYLOAD_UNSPEC,
@@ -611,6 +629,9 @@ enum nft_payload_attributes {
611 NFTA_PAYLOAD_BASE, 629 NFTA_PAYLOAD_BASE,
612 NFTA_PAYLOAD_OFFSET, 630 NFTA_PAYLOAD_OFFSET,
613 NFTA_PAYLOAD_LEN, 631 NFTA_PAYLOAD_LEN,
632 NFTA_PAYLOAD_SREG,
633 NFTA_PAYLOAD_CSUM_TYPE,
634 NFTA_PAYLOAD_CSUM_OFFSET,
614 __NFTA_PAYLOAD_MAX 635 __NFTA_PAYLOAD_MAX
615}; 636};
616#define NFTA_PAYLOAD_MAX (__NFTA_PAYLOAD_MAX - 1) 637#define NFTA_PAYLOAD_MAX (__NFTA_PAYLOAD_MAX - 1)
@@ -736,6 +757,8 @@ enum nft_ct_keys {
736 NFT_CT_PROTO_SRC, 757 NFT_CT_PROTO_SRC,
737 NFT_CT_PROTO_DST, 758 NFT_CT_PROTO_DST,
738 NFT_CT_LABELS, 759 NFT_CT_LABELS,
760 NFT_CT_PKTS,
761 NFT_CT_BYTES,
739}; 762};
740 763
741/** 764/**
@@ -761,6 +784,10 @@ enum nft_limit_type {
761 NFT_LIMIT_PKT_BYTES 784 NFT_LIMIT_PKT_BYTES
762}; 785};
763 786
787enum nft_limit_flags {
788 NFT_LIMIT_F_INV = (1 << 0),
789};
790
764/** 791/**
765 * enum nft_limit_attributes - nf_tables limit expression netlink attributes 792 * enum nft_limit_attributes - nf_tables limit expression netlink attributes
766 * 793 *
@@ -768,6 +795,7 @@ enum nft_limit_type {
768 * @NFTA_LIMIT_UNIT: refill unit (NLA_U64) 795 * @NFTA_LIMIT_UNIT: refill unit (NLA_U64)
769 * @NFTA_LIMIT_BURST: burst (NLA_U32) 796 * @NFTA_LIMIT_BURST: burst (NLA_U32)
770 * @NFTA_LIMIT_TYPE: type of limit (NLA_U32: enum nft_limit_type) 797 * @NFTA_LIMIT_TYPE: type of limit (NLA_U32: enum nft_limit_type)
798 * @NFTA_LIMIT_FLAGS: flags (NLA_U32: enum nft_limit_flags)
771 */ 799 */
772enum nft_limit_attributes { 800enum nft_limit_attributes {
773 NFTA_LIMIT_UNSPEC, 801 NFTA_LIMIT_UNSPEC,
@@ -775,6 +803,7 @@ enum nft_limit_attributes {
775 NFTA_LIMIT_UNIT, 803 NFTA_LIMIT_UNIT,
776 NFTA_LIMIT_BURST, 804 NFTA_LIMIT_BURST,
777 NFTA_LIMIT_TYPE, 805 NFTA_LIMIT_TYPE,
806 NFTA_LIMIT_FLAGS,
778 __NFTA_LIMIT_MAX 807 __NFTA_LIMIT_MAX
779}; 808};
780#define NFTA_LIMIT_MAX (__NFTA_LIMIT_MAX - 1) 809#define NFTA_LIMIT_MAX (__NFTA_LIMIT_MAX - 1)
@@ -959,6 +988,18 @@ enum nft_dup_attributes {
959#define NFTA_DUP_MAX (__NFTA_DUP_MAX - 1) 988#define NFTA_DUP_MAX (__NFTA_DUP_MAX - 1)
960 989
961/** 990/**
991 * enum nft_fwd_attributes - nf_tables fwd expression netlink attributes
992 *
993 * @NFTA_FWD_SREG_DEV: source register of output interface (NLA_U32: nft_register)
994 */
995enum nft_fwd_attributes {
996 NFTA_FWD_UNSPEC,
997 NFTA_FWD_SREG_DEV,
998 __NFTA_FWD_MAX
999};
1000#define NFTA_FWD_MAX (__NFTA_FWD_MAX - 1)
1001
1002/**
962 * enum nft_gen_attributes - nf_tables ruleset generation attributes 1003 * enum nft_gen_attributes - nf_tables ruleset generation attributes
963 * 1004 *
964 * @NFTA_GEN_ID: Ruleset generation ID (NLA_U32) 1005 * @NFTA_GEN_ID: Ruleset generation ID (NLA_U32)
@@ -970,4 +1011,54 @@ enum nft_gen_attributes {
970}; 1011};
971#define NFTA_GEN_MAX (__NFTA_GEN_MAX - 1) 1012#define NFTA_GEN_MAX (__NFTA_GEN_MAX - 1)
972 1013
1014/**
1015 * enum nft_trace_attributes - nf_tables trace netlink attributes
1016 *
1017 * @NFTA_TRACE_TABLE: name of the table (NLA_STRING)
1018 * @NFTA_TRACE_CHAIN: name of the chain (NLA_STRING)
1019 * @NFTA_TRACE_RULE_HANDLE: numeric handle of the rule (NLA_U64)
1020 * @NFTA_TRACE_TYPE: type of the event (NLA_U32: nft_trace_types)
1021 * @NFTA_TRACE_VERDICT: verdict returned by hook (NLA_NESTED: nft_verdicts)
1022 * @NFTA_TRACE_ID: pseudo-id, same for each skb traced (NLA_U32)
1023 * @NFTA_TRACE_LL_HEADER: linklayer header (NLA_BINARY)
1024 * @NFTA_TRACE_NETWORK_HEADER: network header (NLA_BINARY)
1025 * @NFTA_TRACE_TRANSPORT_HEADER: transport header (NLA_BINARY)
1026 * @NFTA_TRACE_IIF: indev ifindex (NLA_U32)
1027 * @NFTA_TRACE_IIFTYPE: netdev->type of indev (NLA_U16)
1028 * @NFTA_TRACE_OIF: outdev ifindex (NLA_U32)
1029 * @NFTA_TRACE_OIFTYPE: netdev->type of outdev (NLA_U16)
1030 * @NFTA_TRACE_MARK: nfmark (NLA_U32)
1031 * @NFTA_TRACE_NFPROTO: nf protocol processed (NLA_U32)
1032 * @NFTA_TRACE_POLICY: policy that decided fate of packet (NLA_U32)
1033 */
1034enum nft_trace_attibutes {
1035 NFTA_TRACE_UNSPEC,
1036 NFTA_TRACE_TABLE,
1037 NFTA_TRACE_CHAIN,
1038 NFTA_TRACE_RULE_HANDLE,
1039 NFTA_TRACE_TYPE,
1040 NFTA_TRACE_VERDICT,
1041 NFTA_TRACE_ID,
1042 NFTA_TRACE_LL_HEADER,
1043 NFTA_TRACE_NETWORK_HEADER,
1044 NFTA_TRACE_TRANSPORT_HEADER,
1045 NFTA_TRACE_IIF,
1046 NFTA_TRACE_IIFTYPE,
1047 NFTA_TRACE_OIF,
1048 NFTA_TRACE_OIFTYPE,
1049 NFTA_TRACE_MARK,
1050 NFTA_TRACE_NFPROTO,
1051 NFTA_TRACE_POLICY,
1052 __NFTA_TRACE_MAX
1053};
1054#define NFTA_TRACE_MAX (__NFTA_TRACE_MAX - 1)
1055
1056enum nft_trace_types {
1057 NFT_TRACETYPE_UNSPEC,
1058 NFT_TRACETYPE_POLICY,
1059 NFT_TRACETYPE_RETURN,
1060 NFT_TRACETYPE_RULE,
1061 __NFT_TRACETYPE_MAX
1062};
1063#define NFT_TRACETYPE_MAX (__NFT_TRACETYPE_MAX - 1)
973#endif /* _LINUX_NF_TABLES_H */ 1064#endif /* _LINUX_NF_TABLES_H */
diff --git a/include/uapi/linux/netfilter/nfnetlink.h b/include/uapi/linux/netfilter/nfnetlink.h
index 354a7e5e50f2..4bb8cb7730e7 100644
--- a/include/uapi/linux/netfilter/nfnetlink.h
+++ b/include/uapi/linux/netfilter/nfnetlink.h
@@ -22,6 +22,8 @@ enum nfnetlink_groups {
22#define NFNLGRP_NFTABLES NFNLGRP_NFTABLES 22#define NFNLGRP_NFTABLES NFNLGRP_NFTABLES
23 NFNLGRP_ACCT_QUOTA, 23 NFNLGRP_ACCT_QUOTA,
24#define NFNLGRP_ACCT_QUOTA NFNLGRP_ACCT_QUOTA 24#define NFNLGRP_ACCT_QUOTA NFNLGRP_ACCT_QUOTA
25 NFNLGRP_NFTRACE,
26#define NFNLGRP_NFTRACE NFNLGRP_NFTRACE
25 __NFNLGRP_MAX, 27 __NFNLGRP_MAX,
26}; 28};
27#define NFNLGRP_MAX (__NFNLGRP_MAX - 1) 29#define NFNLGRP_MAX (__NFNLGRP_MAX - 1)
diff --git a/include/uapi/linux/netfilter/xt_HMARK.h b/include/uapi/linux/netfilter/xt_HMARK.h
index 826fc5807577..3fb48c8d8d78 100644
--- a/include/uapi/linux/netfilter/xt_HMARK.h
+++ b/include/uapi/linux/netfilter/xt_HMARK.h
@@ -2,6 +2,7 @@
2#define XT_HMARK_H_ 2#define XT_HMARK_H_
3 3
4#include <linux/types.h> 4#include <linux/types.h>
5#include <linux/netfilter.h>
5 6
6enum { 7enum {
7 XT_HMARK_SADDR_MASK, 8 XT_HMARK_SADDR_MASK,
diff --git a/include/uapi/linux/netfilter/xt_RATEEST.h b/include/uapi/linux/netfilter/xt_RATEEST.h
index 6605e20ad8cf..ec1b57047e03 100644
--- a/include/uapi/linux/netfilter/xt_RATEEST.h
+++ b/include/uapi/linux/netfilter/xt_RATEEST.h
@@ -2,6 +2,7 @@
2#define _XT_RATEEST_TARGET_H 2#define _XT_RATEEST_TARGET_H
3 3
4#include <linux/types.h> 4#include <linux/types.h>
5#include <linux/if.h>
5 6
6struct xt_rateest_target_info { 7struct xt_rateest_target_info {
7 char name[IFNAMSIZ]; 8 char name[IFNAMSIZ];
diff --git a/include/uapi/linux/netfilter/xt_TEE.h b/include/uapi/linux/netfilter/xt_TEE.h
index 5c21d5c829af..01092023404b 100644
--- a/include/uapi/linux/netfilter/xt_TEE.h
+++ b/include/uapi/linux/netfilter/xt_TEE.h
@@ -1,6 +1,8 @@
1#ifndef _XT_TEE_TARGET_H 1#ifndef _XT_TEE_TARGET_H
2#define _XT_TEE_TARGET_H 2#define _XT_TEE_TARGET_H
3 3
4#include <linux/netfilter.h>
5
4struct xt_tee_tginfo { 6struct xt_tee_tginfo {
5 union nf_inet_addr gw; 7 union nf_inet_addr gw;
6 char oif[16]; 8 char oif[16];
diff --git a/include/uapi/linux/netfilter/xt_TPROXY.h b/include/uapi/linux/netfilter/xt_TPROXY.h
index 902043c2073f..8d693eefdc1f 100644
--- a/include/uapi/linux/netfilter/xt_TPROXY.h
+++ b/include/uapi/linux/netfilter/xt_TPROXY.h
@@ -2,6 +2,7 @@
2#define _XT_TPROXY_H 2#define _XT_TPROXY_H
3 3
4#include <linux/types.h> 4#include <linux/types.h>
5#include <linux/netfilter.h>
5 6
6/* TPROXY target is capable of marking the packet to perform 7/* TPROXY target is capable of marking the packet to perform
7 * redirection. We can get rid of that whenever we get support for 8 * redirection. We can get rid of that whenever we get support for
diff --git a/include/uapi/linux/netfilter/xt_cgroup.h b/include/uapi/linux/netfilter/xt_cgroup.h
index 43acb7e175f6..1e4b37b93bef 100644
--- a/include/uapi/linux/netfilter/xt_cgroup.h
+++ b/include/uapi/linux/netfilter/xt_cgroup.h
@@ -2,10 +2,23 @@
2#define _UAPI_XT_CGROUP_H 2#define _UAPI_XT_CGROUP_H
3 3
4#include <linux/types.h> 4#include <linux/types.h>
5#include <linux/limits.h>
5 6
6struct xt_cgroup_info { 7struct xt_cgroup_info_v0 {
7 __u32 id; 8 __u32 id;
8 __u32 invert; 9 __u32 invert;
9}; 10};
10 11
12struct xt_cgroup_info_v1 {
13 __u8 has_path;
14 __u8 has_classid;
15 __u8 invert_path;
16 __u8 invert_classid;
17 char path[PATH_MAX];
18 __u32 classid;
19
20 /* kernel internal data */
21 void *priv __attribute__((aligned(8)));
22};
23
11#endif /* _UAPI_XT_CGROUP_H */ 24#endif /* _UAPI_XT_CGROUP_H */
diff --git a/include/uapi/linux/netfilter/xt_hashlimit.h b/include/uapi/linux/netfilter/xt_hashlimit.h
index cbfc43d1af68..6db90372f09c 100644
--- a/include/uapi/linux/netfilter/xt_hashlimit.h
+++ b/include/uapi/linux/netfilter/xt_hashlimit.h
@@ -2,6 +2,7 @@
2#define _UAPI_XT_HASHLIMIT_H 2#define _UAPI_XT_HASHLIMIT_H
3 3
4#include <linux/types.h> 4#include <linux/types.h>
5#include <linux/if.h>
5 6
6/* timings are in milliseconds. */ 7/* timings are in milliseconds. */
7#define XT_HASHLIMIT_SCALE 10000 8#define XT_HASHLIMIT_SCALE 10000
diff --git a/include/uapi/linux/netfilter/xt_ipvs.h b/include/uapi/linux/netfilter/xt_ipvs.h
index eff34ac18808..e03b9c31a39d 100644
--- a/include/uapi/linux/netfilter/xt_ipvs.h
+++ b/include/uapi/linux/netfilter/xt_ipvs.h
@@ -2,6 +2,7 @@
2#define _XT_IPVS_H 2#define _XT_IPVS_H
3 3
4#include <linux/types.h> 4#include <linux/types.h>
5#include <linux/netfilter.h>
5 6
6enum { 7enum {
7 XT_IPVS_IPVS_PROPERTY = 1 << 0, /* all other options imply this one */ 8 XT_IPVS_IPVS_PROPERTY = 1 << 0, /* all other options imply this one */
diff --git a/include/uapi/linux/netfilter/xt_mac.h b/include/uapi/linux/netfilter/xt_mac.h
index b892cdc67e06..9a19a08a9181 100644
--- a/include/uapi/linux/netfilter/xt_mac.h
+++ b/include/uapi/linux/netfilter/xt_mac.h
@@ -1,6 +1,8 @@
1#ifndef _XT_MAC_H 1#ifndef _XT_MAC_H
2#define _XT_MAC_H 2#define _XT_MAC_H
3 3
4#include <linux/if_ether.h>
5
4struct xt_mac_info { 6struct xt_mac_info {
5 unsigned char srcaddr[ETH_ALEN]; 7 unsigned char srcaddr[ETH_ALEN];
6 int invert; 8 int invert;
diff --git a/include/uapi/linux/netfilter/xt_osf.h b/include/uapi/linux/netfilter/xt_osf.h
index 5d66caeba3ee..e6159958b2fb 100644
--- a/include/uapi/linux/netfilter/xt_osf.h
+++ b/include/uapi/linux/netfilter/xt_osf.h
@@ -20,6 +20,8 @@
20#define _XT_OSF_H 20#define _XT_OSF_H
21 21
22#include <linux/types.h> 22#include <linux/types.h>
23#include <linux/ip.h>
24#include <linux/tcp.h>
23 25
24#define MAXGENRELEN 32 26#define MAXGENRELEN 32
25 27
diff --git a/include/uapi/linux/netfilter/xt_physdev.h b/include/uapi/linux/netfilter/xt_physdev.h
index db7a2982e9c0..ccdde87da214 100644
--- a/include/uapi/linux/netfilter/xt_physdev.h
+++ b/include/uapi/linux/netfilter/xt_physdev.h
@@ -2,7 +2,7 @@
2#define _UAPI_XT_PHYSDEV_H 2#define _UAPI_XT_PHYSDEV_H
3 3
4#include <linux/types.h> 4#include <linux/types.h>
5 5#include <linux/if.h>
6 6
7#define XT_PHYSDEV_OP_IN 0x01 7#define XT_PHYSDEV_OP_IN 0x01
8#define XT_PHYSDEV_OP_OUT 0x02 8#define XT_PHYSDEV_OP_OUT 0x02
diff --git a/include/uapi/linux/netfilter/xt_policy.h b/include/uapi/linux/netfilter/xt_policy.h
index be8ead05c316..d8a9800dce61 100644
--- a/include/uapi/linux/netfilter/xt_policy.h
+++ b/include/uapi/linux/netfilter/xt_policy.h
@@ -2,6 +2,8 @@
2#define _XT_POLICY_H 2#define _XT_POLICY_H
3 3
4#include <linux/types.h> 4#include <linux/types.h>
5#include <linux/in.h>
6#include <linux/in6.h>
5 7
6#define XT_POLICY_MAX_ELEM 4 8#define XT_POLICY_MAX_ELEM 4
7 9
diff --git a/include/uapi/linux/netfilter/xt_rateest.h b/include/uapi/linux/netfilter/xt_rateest.h
index d40a6196842a..13fe50d4e4b3 100644
--- a/include/uapi/linux/netfilter/xt_rateest.h
+++ b/include/uapi/linux/netfilter/xt_rateest.h
@@ -2,6 +2,7 @@
2#define _XT_RATEEST_MATCH_H 2#define _XT_RATEEST_MATCH_H
3 3
4#include <linux/types.h> 4#include <linux/types.h>
5#include <linux/if.h>
5 6
6enum xt_rateest_match_flags { 7enum xt_rateest_match_flags {
7 XT_RATEEST_MATCH_INVERT = 1<<0, 8 XT_RATEEST_MATCH_INVERT = 1<<0,
diff --git a/include/uapi/linux/netfilter/xt_recent.h b/include/uapi/linux/netfilter/xt_recent.h
index 6ef36c113e89..955d562031cc 100644
--- a/include/uapi/linux/netfilter/xt_recent.h
+++ b/include/uapi/linux/netfilter/xt_recent.h
@@ -2,6 +2,7 @@
2#define _LINUX_NETFILTER_XT_RECENT_H 1 2#define _LINUX_NETFILTER_XT_RECENT_H 1
3 3
4#include <linux/types.h> 4#include <linux/types.h>
5#include <linux/netfilter.h>
5 6
6enum { 7enum {
7 XT_RECENT_CHECK = 1 << 0, 8 XT_RECENT_CHECK = 1 << 0,
diff --git a/include/uapi/linux/netfilter/xt_sctp.h b/include/uapi/linux/netfilter/xt_sctp.h
index 29287be696a2..58ffcfb7978e 100644
--- a/include/uapi/linux/netfilter/xt_sctp.h
+++ b/include/uapi/linux/netfilter/xt_sctp.h
@@ -66,26 +66,26 @@ struct xt_sctp_info {
66 66
67#define SCTP_CHUNKMAP_IS_CLEAR(chunkmap) \ 67#define SCTP_CHUNKMAP_IS_CLEAR(chunkmap) \
68 __sctp_chunkmap_is_clear((chunkmap), ARRAY_SIZE(chunkmap)) 68 __sctp_chunkmap_is_clear((chunkmap), ARRAY_SIZE(chunkmap))
69static inline bool 69static inline _Bool
70__sctp_chunkmap_is_clear(const __u32 *chunkmap, unsigned int n) 70__sctp_chunkmap_is_clear(const __u32 *chunkmap, unsigned int n)
71{ 71{
72 unsigned int i; 72 unsigned int i;
73 for (i = 0; i < n; ++i) 73 for (i = 0; i < n; ++i)
74 if (chunkmap[i]) 74 if (chunkmap[i])
75 return false; 75 return 0;
76 return true; 76 return 1;
77} 77}
78 78
79#define SCTP_CHUNKMAP_IS_ALL_SET(chunkmap) \ 79#define SCTP_CHUNKMAP_IS_ALL_SET(chunkmap) \
80 __sctp_chunkmap_is_all_set((chunkmap), ARRAY_SIZE(chunkmap)) 80 __sctp_chunkmap_is_all_set((chunkmap), ARRAY_SIZE(chunkmap))
81static inline bool 81static inline _Bool
82__sctp_chunkmap_is_all_set(const __u32 *chunkmap, unsigned int n) 82__sctp_chunkmap_is_all_set(const __u32 *chunkmap, unsigned int n)
83{ 83{
84 unsigned int i; 84 unsigned int i;
85 for (i = 0; i < n; ++i) 85 for (i = 0; i < n; ++i)
86 if (chunkmap[i] != ~0U) 86 if (chunkmap[i] != ~0U)
87 return false; 87 return 0;
88 return true; 88 return 1;
89} 89}
90 90
91#endif /* _XT_SCTP_H_ */ 91#endif /* _XT_SCTP_H_ */
diff --git a/include/uapi/linux/netfilter_arp/arp_tables.h b/include/uapi/linux/netfilter_arp/arp_tables.h
index a5a86a4db6b3..ece3ad4eecda 100644
--- a/include/uapi/linux/netfilter_arp/arp_tables.h
+++ b/include/uapi/linux/netfilter_arp/arp_tables.h
@@ -11,6 +11,7 @@
11 11
12#include <linux/types.h> 12#include <linux/types.h>
13#include <linux/compiler.h> 13#include <linux/compiler.h>
14#include <linux/if.h>
14#include <linux/netfilter_arp.h> 15#include <linux/netfilter_arp.h>
15 16
16#include <linux/netfilter/x_tables.h> 17#include <linux/netfilter/x_tables.h>
diff --git a/include/uapi/linux/netfilter_bridge.h b/include/uapi/linux/netfilter_bridge.h
index a5eda6db8d79..514519b47651 100644
--- a/include/uapi/linux/netfilter_bridge.h
+++ b/include/uapi/linux/netfilter_bridge.h
@@ -4,6 +4,7 @@
4/* bridge-specific defines for netfilter. 4/* bridge-specific defines for netfilter.
5 */ 5 */
6 6
7#include <linux/in.h>
7#include <linux/netfilter.h> 8#include <linux/netfilter.h>
8#include <linux/if_ether.h> 9#include <linux/if_ether.h>
9#include <linux/if_vlan.h> 10#include <linux/if_vlan.h>
diff --git a/include/uapi/linux/netfilter_bridge/ebt_arp.h b/include/uapi/linux/netfilter_bridge/ebt_arp.h
index 522f3e427f49..dd4df25330e8 100644
--- a/include/uapi/linux/netfilter_bridge/ebt_arp.h
+++ b/include/uapi/linux/netfilter_bridge/ebt_arp.h
@@ -2,6 +2,7 @@
2#define __LINUX_BRIDGE_EBT_ARP_H 2#define __LINUX_BRIDGE_EBT_ARP_H
3 3
4#include <linux/types.h> 4#include <linux/types.h>
5#include <linux/if_ether.h>
5 6
6#define EBT_ARP_OPCODE 0x01 7#define EBT_ARP_OPCODE 0x01
7#define EBT_ARP_HTYPE 0x02 8#define EBT_ARP_HTYPE 0x02
diff --git a/include/uapi/linux/netfilter_bridge/ebt_arpreply.h b/include/uapi/linux/netfilter_bridge/ebt_arpreply.h
index 7e77896e1fbf..6fee3402e307 100644
--- a/include/uapi/linux/netfilter_bridge/ebt_arpreply.h
+++ b/include/uapi/linux/netfilter_bridge/ebt_arpreply.h
@@ -1,6 +1,8 @@
1#ifndef __LINUX_BRIDGE_EBT_ARPREPLY_H 1#ifndef __LINUX_BRIDGE_EBT_ARPREPLY_H
2#define __LINUX_BRIDGE_EBT_ARPREPLY_H 2#define __LINUX_BRIDGE_EBT_ARPREPLY_H
3 3
4#include <linux/if_ether.h>
5
4struct ebt_arpreply_info { 6struct ebt_arpreply_info {
5 unsigned char mac[ETH_ALEN]; 7 unsigned char mac[ETH_ALEN];
6 int target; 8 int target;
diff --git a/include/uapi/linux/netfilter_bridge/ebt_ip6.h b/include/uapi/linux/netfilter_bridge/ebt_ip6.h
index 42b889682721..a062f0ce95f9 100644
--- a/include/uapi/linux/netfilter_bridge/ebt_ip6.h
+++ b/include/uapi/linux/netfilter_bridge/ebt_ip6.h
@@ -13,6 +13,7 @@
13#define __LINUX_BRIDGE_EBT_IP6_H 13#define __LINUX_BRIDGE_EBT_IP6_H
14 14
15#include <linux/types.h> 15#include <linux/types.h>
16#include <linux/in6.h>
16 17
17#define EBT_IP6_SOURCE 0x01 18#define EBT_IP6_SOURCE 0x01
18#define EBT_IP6_DEST 0x02 19#define EBT_IP6_DEST 0x02
diff --git a/include/uapi/linux/netfilter_bridge/ebt_nat.h b/include/uapi/linux/netfilter_bridge/ebt_nat.h
index 5e74e3b03bd6..c990d74ee966 100644
--- a/include/uapi/linux/netfilter_bridge/ebt_nat.h
+++ b/include/uapi/linux/netfilter_bridge/ebt_nat.h
@@ -1,6 +1,8 @@
1#ifndef __LINUX_BRIDGE_EBT_NAT_H 1#ifndef __LINUX_BRIDGE_EBT_NAT_H
2#define __LINUX_BRIDGE_EBT_NAT_H 2#define __LINUX_BRIDGE_EBT_NAT_H
3 3
4#include <linux/if_ether.h>
5
4#define NAT_ARP_BIT (0x00000010) 6#define NAT_ARP_BIT (0x00000010)
5struct ebt_nat_info { 7struct ebt_nat_info {
6 unsigned char mac[ETH_ALEN]; 8 unsigned char mac[ETH_ALEN];
diff --git a/include/uapi/linux/netfilter_bridge/ebtables.h b/include/uapi/linux/netfilter_bridge/ebtables.h
index fd2ee501726d..e3cdf9f1a259 100644
--- a/include/uapi/linux/netfilter_bridge/ebtables.h
+++ b/include/uapi/linux/netfilter_bridge/ebtables.h
@@ -12,6 +12,8 @@
12 12
13#ifndef _UAPI__LINUX_BRIDGE_EFF_H 13#ifndef _UAPI__LINUX_BRIDGE_EFF_H
14#define _UAPI__LINUX_BRIDGE_EFF_H 14#define _UAPI__LINUX_BRIDGE_EFF_H
15#include <linux/types.h>
16#include <linux/if.h>
15#include <linux/netfilter_bridge.h> 17#include <linux/netfilter_bridge.h>
16 18
17#define EBT_TABLE_MAXNAMELEN 32 19#define EBT_TABLE_MAXNAMELEN 32
@@ -33,8 +35,8 @@ struct xt_match;
33struct xt_target; 35struct xt_target;
34 36
35struct ebt_counter { 37struct ebt_counter {
36 uint64_t pcnt; 38 __u64 pcnt;
37 uint64_t bcnt; 39 __u64 bcnt;
38}; 40};
39 41
40struct ebt_replace { 42struct ebt_replace {
diff --git a/include/uapi/linux/netfilter_ipv4/ip_tables.h b/include/uapi/linux/netfilter_ipv4/ip_tables.h
index f1e6ef256034..d0da53d96d93 100644
--- a/include/uapi/linux/netfilter_ipv4/ip_tables.h
+++ b/include/uapi/linux/netfilter_ipv4/ip_tables.h
@@ -17,6 +17,7 @@
17 17
18#include <linux/types.h> 18#include <linux/types.h>
19#include <linux/compiler.h> 19#include <linux/compiler.h>
20#include <linux/if.h>
20#include <linux/netfilter_ipv4.h> 21#include <linux/netfilter_ipv4.h>
21 22
22#include <linux/netfilter/x_tables.h> 23#include <linux/netfilter/x_tables.h>
diff --git a/include/uapi/linux/netfilter_ipv6/ip6_tables.h b/include/uapi/linux/netfilter_ipv6/ip6_tables.h
index 649c68062dca..d1b22653daf2 100644
--- a/include/uapi/linux/netfilter_ipv6/ip6_tables.h
+++ b/include/uapi/linux/netfilter_ipv6/ip6_tables.h
@@ -17,6 +17,7 @@
17 17
18#include <linux/types.h> 18#include <linux/types.h>
19#include <linux/compiler.h> 19#include <linux/compiler.h>
20#include <linux/if.h>
20#include <linux/netfilter_ipv6.h> 21#include <linux/netfilter_ipv6.h>
21 22
22#include <linux/netfilter/x_tables.h> 23#include <linux/netfilter/x_tables.h>
diff --git a/include/uapi/linux/netfilter_ipv6/ip6t_rt.h b/include/uapi/linux/netfilter_ipv6/ip6t_rt.h
index 7605a5ff81cd..558f81e46fb9 100644
--- a/include/uapi/linux/netfilter_ipv6/ip6t_rt.h
+++ b/include/uapi/linux/netfilter_ipv6/ip6t_rt.h
@@ -2,7 +2,7 @@
2#define _IP6T_RT_H 2#define _IP6T_RT_H
3 3
4#include <linux/types.h> 4#include <linux/types.h>
5/*#include <linux/in6.h>*/ 5#include <linux/in6.h>
6 6
7#define IP6T_RT_HOPS 16 7#define IP6T_RT_HOPS 16
8 8
diff --git a/include/uapi/linux/nl80211.h b/include/uapi/linux/nl80211.h
index 1f0b4cf5dd03..5b7b5ebe7ca8 100644
--- a/include/uapi/linux/nl80211.h
+++ b/include/uapi/linux/nl80211.h
@@ -820,6 +820,10 @@
820 * as an event to indicate changes for devices with wiphy-specific regdom 820 * as an event to indicate changes for devices with wiphy-specific regdom
821 * management. 821 * management.
822 * 822 *
823 * @NL80211_CMD_ABORT_SCAN: Stop an ongoing scan. Returns -ENOENT if a scan is
824 * not running. The driver indicates the status of the scan through
825 * cfg80211_scan_done().
826 *
823 * @NL80211_CMD_MAX: highest used command number 827 * @NL80211_CMD_MAX: highest used command number
824 * @__NL80211_CMD_AFTER_LAST: internal use 828 * @__NL80211_CMD_AFTER_LAST: internal use
825 */ 829 */
@@ -1006,6 +1010,8 @@ enum nl80211_commands {
1006 1010
1007 NL80211_CMD_WIPHY_REG_CHANGE, 1011 NL80211_CMD_WIPHY_REG_CHANGE,
1008 1012
1013 NL80211_CMD_ABORT_SCAN,
1014
1009 /* add new commands above here */ 1015 /* add new commands above here */
1010 1016
1011 /* used to define NL80211_CMD_MAX below */ 1017 /* used to define NL80211_CMD_MAX below */
@@ -1764,8 +1770,9 @@ enum nl80211_commands {
1764 * over all channels. 1770 * over all channels.
1765 * 1771 *
1766 * @NL80211_ATTR_SCHED_SCAN_DELAY: delay before the first cycle of a 1772 * @NL80211_ATTR_SCHED_SCAN_DELAY: delay before the first cycle of a
1767 * scheduled scan (or a WoWLAN net-detect scan) is started, u32 1773 * scheduled scan is started. Or the delay before a WoWLAN
1768 * in seconds. 1774 * net-detect scan is started, counting from the moment the
1775 * system is suspended. This value is a u32, in seconds.
1769 1776
1770 * @NL80211_ATTR_REG_INDOOR: flag attribute, if set indicates that the device 1777 * @NL80211_ATTR_REG_INDOOR: flag attribute, if set indicates that the device
1771 * is operating in an indoor environment. 1778 * is operating in an indoor environment.
diff --git a/include/uapi/linux/pkt_sched.h b/include/uapi/linux/pkt_sched.h
index 8d2530daca9f..8cb18b44968e 100644
--- a/include/uapi/linux/pkt_sched.h
+++ b/include/uapi/linux/pkt_sched.h
@@ -72,6 +72,10 @@ struct tc_estimator {
72#define TC_H_UNSPEC (0U) 72#define TC_H_UNSPEC (0U)
73#define TC_H_ROOT (0xFFFFFFFFU) 73#define TC_H_ROOT (0xFFFFFFFFU)
74#define TC_H_INGRESS (0xFFFFFFF1U) 74#define TC_H_INGRESS (0xFFFFFFF1U)
75#define TC_H_CLSACT TC_H_INGRESS
76
77#define TC_H_MIN_INGRESS 0xFFF2U
78#define TC_H_MIN_EGRESS 0xFFF3U
75 79
76/* Need to corrospond to iproute2 tc/tc_core.h "enum link_layer" */ 80/* Need to corrospond to iproute2 tc/tc_core.h "enum link_layer" */
77enum tc_link_layer { 81enum tc_link_layer {
diff --git a/include/uapi/linux/rtnetlink.h b/include/uapi/linux/rtnetlink.h
index 123a5af4e8bb..ca764b5da86d 100644
--- a/include/uapi/linux/rtnetlink.h
+++ b/include/uapi/linux/rtnetlink.h
@@ -311,6 +311,7 @@ enum rtattr_type_t {
311 RTA_PREF, 311 RTA_PREF,
312 RTA_ENCAP_TYPE, 312 RTA_ENCAP_TYPE,
313 RTA_ENCAP, 313 RTA_ENCAP,
314 RTA_EXPIRES,
314 __RTA_MAX 315 __RTA_MAX
315}; 316};
316 317
diff --git a/include/uapi/linux/sock_diag.h b/include/uapi/linux/sock_diag.h
index 49230d36f9ce..bae2d80034d4 100644
--- a/include/uapi/linux/sock_diag.h
+++ b/include/uapi/linux/sock_diag.h
@@ -4,6 +4,7 @@
4#include <linux/types.h> 4#include <linux/types.h>
5 5
6#define SOCK_DIAG_BY_FAMILY 20 6#define SOCK_DIAG_BY_FAMILY 20
7#define SOCK_DESTROY 21
7 8
8struct sock_diag_req { 9struct sock_diag_req {
9 __u8 sdiag_family; 10 __u8 sdiag_family;
diff --git a/include/uapi/linux/sockios.h b/include/uapi/linux/sockios.h
index e888b1aed69f..8e7890b26d9a 100644
--- a/include/uapi/linux/sockios.h
+++ b/include/uapi/linux/sockios.h
@@ -27,7 +27,7 @@
27/* Routing table calls. */ 27/* Routing table calls. */
28#define SIOCADDRT 0x890B /* add routing table entry */ 28#define SIOCADDRT 0x890B /* add routing table entry */
29#define SIOCDELRT 0x890C /* delete routing table entry */ 29#define SIOCDELRT 0x890C /* delete routing table entry */
30#define SIOCRTMSG 0x890D /* call to routing system */ 30#define SIOCRTMSG 0x890D /* unused */
31 31
32/* Socket configuration controls. */ 32/* Socket configuration controls. */
33#define SIOCGIFNAME 0x8910 /* get iface name */ 33#define SIOCGIFNAME 0x8910 /* get iface name */