aboutsummaryrefslogtreecommitdiffstats
path: root/include
diff options
context:
space:
mode:
authorLinus Torvalds <torvalds@linux-foundation.org>2014-04-02 23:53:45 -0400
committerLinus Torvalds <torvalds@linux-foundation.org>2014-04-02 23:53:45 -0400
commitcd6362befe4cc7bf589a5236d2a780af2d47bcc9 (patch)
tree3bd4e13ec3f92a00dc4f6c3d65e820b54dbfe46e /include
parent0f1b1e6d73cb989ce2c071edc57deade3b084dfe (diff)
parentb1586f099ba897542ece36e8a23c1a62907261ef (diff)
Merge git://git.kernel.org/pub/scm/linux/kernel/git/davem/net-next
Pull networking updates from David Miller: "Here is my initial pull request for the networking subsystem during this merge window: 1) Support for ESN in AH (RFC 4302) from Fan Du. 2) Add full kernel doc for ethtool command structures, from Ben Hutchings. 3) Add BCM7xxx PHY driver, from Florian Fainelli. 4) Export computed TCP rate information in netlink socket dumps, from Eric Dumazet. 5) Allow IPSEC SA to be dumped partially using a filter, from Nicolas Dichtel. 6) Convert many drivers to pci_enable_msix_range(), from Alexander Gordeev. 7) Record SKB timestamps more efficiently, from Eric Dumazet. 8) Switch to microsecond resolution for TCP round trip times, also from Eric Dumazet. 9) Clean up and fix 6lowpan fragmentation handling by making use of the existing inet_frag api for it's implementation. 10) Add TX grant mapping to xen-netback driver, from Zoltan Kiss. 11) Auto size SKB lengths when composing netlink messages based upon past message sizes used, from Eric Dumazet. 12) qdisc dumps can take a long time, add a cond_resched(), From Eric Dumazet. 13) Sanitize netpoll core and drivers wrt. SKB handling semantics. Get rid of never-used-in-tree netpoll RX handling. From Eric W Biederman. 14) Support inter-address-family and namespace changing in VTI tunnel driver(s). From Steffen Klassert. 15) Add Altera TSE driver, from Vince Bridgers. 16) Optimizing csum_replace2() so that it doesn't adjust the checksum by checksumming the entire header, from Eric Dumazet. 17) Expand BPF internal implementation for faster interpreting, more direct translations into JIT'd code, and much cleaner uses of BPF filtering in non-socket ocntexts. From Daniel Borkmann and Alexei Starovoitov" * git://git.kernel.org/pub/scm/linux/kernel/git/davem/net-next: (1976 commits) netpoll: Use skb_irq_freeable to make zap_completion_queue safe. net: Add a test to see if a skb is freeable in irq context qlcnic: Fix build failure due to undefined reference to `vxlan_get_rx_port' net: ptp: move PTP classifier in its own file net: sxgbe: make "core_ops" static net: sxgbe: fix logical vs bitwise operation net: sxgbe: sxgbe_mdio_register() frees the bus Call efx_set_channels() before efx->type->dimension_resources() xen-netback: disable rogue vif in kthread context net/mlx4: Set proper build dependancy with vxlan be2net: fix build dependency on VxLAN mac802154: make csma/cca parameters per-wpan mac802154: allow only one WPAN to be up at any given time net: filter: minor: fix kdoc in __sk_run_filter netlink: don't compare the nul-termination in nla_strcmp can: c_can: Avoid led toggling for every packet. can: c_can: Simplify TX interrupt cleanup can: c_can: Store dlc private can: c_can: Reduce register access can: c_can: Make the code readable ...
Diffstat (limited to 'include')
-rw-r--r--include/linux/brcmphy.h60
-rw-r--r--include/linux/can/dev.h9
-rw-r--r--include/linux/ethtool.h3
-rw-r--r--include/linux/filter.h118
-rw-r--r--include/linux/ieee80211.h239
-rw-r--r--include/linux/if_vlan.h9
-rw-r--r--include/linux/isdn_ppp.h5
-rw-r--r--include/linux/miscdevice.h1
-rw-r--r--include/linux/mlx4/cmd.h8
-rw-r--r--include/linux/mlx4/device.h50
-rw-r--r--include/linux/mlx4/driver.h12
-rw-r--r--include/linux/mlx4/qp.h11
-rw-r--r--include/linux/mmc/sdio_ids.h1
-rw-r--r--include/linux/mpls.h6
-rw-r--r--include/linux/netdevice.h157
-rw-r--r--include/linux/netfilter/ipset/ip_set.h15
-rw-r--r--include/linux/netfilter/nfnetlink.h21
-rw-r--r--include/linux/netpoll.h71
-rw-r--r--include/linux/nl802154.h12
-rw-r--r--include/linux/phy.h56
-rw-r--r--include/linux/ptp_classify.h103
-rw-r--r--include/linux/ptp_clock_kernel.h33
-rw-r--r--include/linux/seccomp.h1
-rw-r--r--include/linux/skbuff.h104
-rw-r--r--include/linux/sxgbe_platform.h54
-rw-r--r--include/linux/tcp.h8
-rw-r--r--include/linux/tty.h6
-rw-r--r--include/linux/u64_stats_sync.h16
-rw-r--r--include/linux/usb/cdc_ncm.h1
-rw-r--r--include/linux/wl12xx.h24
-rw-r--r--include/net/6lowpan.h434
-rw-r--r--include/net/act_api.h22
-rw-r--r--include/net/addrconf.h6
-rw-r--r--include/net/af_ieee802154.h4
-rw-r--r--include/net/bluetooth/bluetooth.h1
-rw-r--r--include/net/bluetooth/hci.h76
-rw-r--r--include/net/bluetooth/hci_core.h209
-rw-r--r--include/net/bluetooth/l2cap.h8
-rw-r--r--include/net/bluetooth/mgmt.h63
-rw-r--r--include/net/bluetooth/rfcomm.h10
-rw-r--r--include/net/cfg80211.h90
-rw-r--r--include/net/checksum.h23
-rw-r--r--include/net/dst.h18
-rw-r--r--include/net/flow.h6
-rw-r--r--include/net/flowcache.h25
-rw-r--r--include/net/ieee80211_radiotap.h4
-rw-r--r--include/net/ieee802154.h28
-rw-r--r--include/net/ieee802154_netdev.h195
-rw-r--r--include/net/ip.h13
-rw-r--r--include/net/ip6_fib.h3
-rw-r--r--include/net/ip6_route.h14
-rw-r--r--include/net/mac80211.h101
-rw-r--r--include/net/mac802154.h41
-rw-r--r--include/net/net_namespace.h4
-rw-r--r--include/net/netfilter/nf_conntrack.h11
-rw-r--r--include/net/netfilter/nf_conntrack_core.h9
-rw-r--r--include/net/netfilter/nf_conntrack_labels.h4
-rw-r--r--include/net/netfilter/nf_tables.h28
-rw-r--r--include/net/netns/conntrack.h13
-rw-r--r--include/net/netns/ieee802154_6lowpan.h22
-rw-r--r--include/net/netns/xfrm.h11
-rw-r--r--include/net/nfc/digital.h7
-rw-r--r--include/net/nfc/nfc.h3
-rw-r--r--include/net/nl802154.h6
-rw-r--r--include/net/regulatory.h21
-rw-r--r--include/net/route.h1
-rw-r--r--include/net/rtnetlink.h2
-rw-r--r--include/net/sock.h39
-rw-r--r--include/net/tc_act/tc_csum.h4
-rw-r--r--include/net/tc_act/tc_defact.h4
-rw-r--r--include/net/tc_act/tc_gact.h4
-rw-r--r--include/net/tc_act/tc_ipt.h4
-rw-r--r--include/net/tc_act/tc_mirred.h4
-rw-r--r--include/net/tc_act/tc_nat.h4
-rw-r--r--include/net/tc_act/tc_pedit.h4
-rw-r--r--include/net/tc_act/tc_skbedit.h4
-rw-r--r--include/net/tcp.h13
-rw-r--r--include/net/wpan-phy.h19
-rw-r--r--include/net/xfrm.h128
-rw-r--r--include/trace/events/net.h12
-rw-r--r--include/uapi/linux/can.h32
-rw-r--r--include/uapi/linux/can/netlink.h3
-rw-r--r--include/uapi/linux/ethtool.h439
-rw-r--r--include/uapi/linux/if.h134
-rw-r--r--include/uapi/linux/if_ether.h6
-rw-r--r--include/uapi/linux/if_link.h1
-rw-r--r--include/uapi/linux/in.h4
-rw-r--r--include/uapi/linux/in6.h4
-rw-r--r--include/uapi/linux/mpls.h34
-rw-r--r--include/uapi/linux/netdevice.h6
-rw-r--r--include/uapi/linux/netfilter/ipset/ip_set.h12
-rw-r--r--include/uapi/linux/netfilter/nf_tables.h6
-rw-r--r--include/uapi/linux/nfc.h9
-rw-r--r--include/uapi/linux/nl80211.h92
-rw-r--r--include/uapi/linux/pfkeyv2.h15
-rw-r--r--include/uapi/linux/ptp_clock.h39
-rw-r--r--include/uapi/linux/snmp.h6
-rw-r--r--include/uapi/linux/tcp.h3
-rw-r--r--include/uapi/linux/tcp_metrics.h7
-rw-r--r--include/uapi/linux/usb/cdc.h12
-rw-r--r--include/uapi/linux/xfrm.h10
101 files changed, 3018 insertions, 849 deletions
diff --git a/include/linux/brcmphy.h b/include/linux/brcmphy.h
index 677b4f01b2d0..6f76277baf39 100644
--- a/include/linux/brcmphy.h
+++ b/include/linux/brcmphy.h
@@ -13,10 +13,17 @@
13#define PHY_ID_BCM5461 0x002060c0 13#define PHY_ID_BCM5461 0x002060c0
14#define PHY_ID_BCM57780 0x03625d90 14#define PHY_ID_BCM57780 0x03625d90
15 15
16#define PHY_ID_BCM7366 0x600d8490
17#define PHY_ID_BCM7439 0x600d8480
18#define PHY_ID_BCM7445 0x600d8510
19#define PHY_ID_BCM7XXX_28 0x600d8400
20
16#define PHY_BCM_OUI_MASK 0xfffffc00 21#define PHY_BCM_OUI_MASK 0xfffffc00
17#define PHY_BCM_OUI_1 0x00206000 22#define PHY_BCM_OUI_1 0x00206000
18#define PHY_BCM_OUI_2 0x0143bc00 23#define PHY_BCM_OUI_2 0x0143bc00
19#define PHY_BCM_OUI_3 0x03625c00 24#define PHY_BCM_OUI_3 0x03625c00
25#define PHY_BCM_OUI_4 0x600d0000
26#define PHY_BCM_OUI_5 0x03625e00
20 27
21 28
22#define PHY_BCM_FLAGS_MODE_COPPER 0x00000001 29#define PHY_BCM_FLAGS_MODE_COPPER 0x00000001
@@ -31,6 +38,59 @@
31#define PHY_BRCM_EXT_IBND_TX_ENABLE 0x00002000 38#define PHY_BRCM_EXT_IBND_TX_ENABLE 0x00002000
32#define PHY_BRCM_CLEAR_RGMII_MODE 0x00004000 39#define PHY_BRCM_CLEAR_RGMII_MODE 0x00004000
33#define PHY_BRCM_DIS_TXCRXC_NOENRGY 0x00008000 40#define PHY_BRCM_DIS_TXCRXC_NOENRGY 0x00008000
41/* Broadcom BCM7xxx specific workarounds */
42#define PHY_BRCM_100MBPS_WAR 0x00010000
34#define PHY_BCM_FLAGS_VALID 0x80000000 43#define PHY_BCM_FLAGS_VALID 0x80000000
35 44
45/* Broadcom BCM54XX register definitions, common to most Broadcom PHYs */
46#define MII_BCM54XX_ECR 0x10 /* BCM54xx extended control register */
47#define MII_BCM54XX_ECR_IM 0x1000 /* Interrupt mask */
48#define MII_BCM54XX_ECR_IF 0x0800 /* Interrupt force */
49
50#define MII_BCM54XX_ESR 0x11 /* BCM54xx extended status register */
51#define MII_BCM54XX_ESR_IS 0x1000 /* Interrupt status */
52
53#define MII_BCM54XX_EXP_DATA 0x15 /* Expansion register data */
54#define MII_BCM54XX_EXP_SEL 0x17 /* Expansion register select */
55#define MII_BCM54XX_EXP_SEL_SSD 0x0e00 /* Secondary SerDes select */
56#define MII_BCM54XX_EXP_SEL_ER 0x0f00 /* Expansion register select */
57
58#define MII_BCM54XX_AUX_CTL 0x18 /* Auxiliary control register */
59#define MII_BCM54XX_ISR 0x1a /* BCM54xx interrupt status register */
60#define MII_BCM54XX_IMR 0x1b /* BCM54xx interrupt mask register */
61#define MII_BCM54XX_INT_CRCERR 0x0001 /* CRC error */
62#define MII_BCM54XX_INT_LINK 0x0002 /* Link status changed */
63#define MII_BCM54XX_INT_SPEED 0x0004 /* Link speed change */
64#define MII_BCM54XX_INT_DUPLEX 0x0008 /* Duplex mode changed */
65#define MII_BCM54XX_INT_LRS 0x0010 /* Local receiver status changed */
66#define MII_BCM54XX_INT_RRS 0x0020 /* Remote receiver status changed */
67#define MII_BCM54XX_INT_SSERR 0x0040 /* Scrambler synchronization error */
68#define MII_BCM54XX_INT_UHCD 0x0080 /* Unsupported HCD negotiated */
69#define MII_BCM54XX_INT_NHCD 0x0100 /* No HCD */
70#define MII_BCM54XX_INT_NHCDL 0x0200 /* No HCD link */
71#define MII_BCM54XX_INT_ANPR 0x0400 /* Auto-negotiation page received */
72#define MII_BCM54XX_INT_LC 0x0800 /* All counters below 128 */
73#define MII_BCM54XX_INT_HC 0x1000 /* Counter above 32768 */
74#define MII_BCM54XX_INT_MDIX 0x2000 /* MDIX status change */
75#define MII_BCM54XX_INT_PSERR 0x4000 /* Pair swap error */
76
77#define MII_BCM54XX_SHD 0x1c /* 0x1c shadow registers */
78#define MII_BCM54XX_SHD_WRITE 0x8000
79#define MII_BCM54XX_SHD_VAL(x) ((x & 0x1f) << 10)
80#define MII_BCM54XX_SHD_DATA(x) ((x & 0x3ff) << 0)
81
82/*
83 * AUXILIARY CONTROL SHADOW ACCESS REGISTERS. (PHY REG 0x18)
84 */
85#define MII_BCM54XX_AUXCTL_SHDWSEL_AUXCTL 0x0000
86#define MII_BCM54XX_AUXCTL_ACTL_TX_6DB 0x0400
87#define MII_BCM54XX_AUXCTL_ACTL_SMDSP_ENA 0x0800
88
89#define MII_BCM54XX_AUXCTL_MISC_WREN 0x8000
90#define MII_BCM54XX_AUXCTL_MISC_FORCE_AMDIX 0x0200
91#define MII_BCM54XX_AUXCTL_MISC_RDSEL_MISC 0x7000
92#define MII_BCM54XX_AUXCTL_SHDWSEL_MISC 0x0007
93
94#define MII_BCM54XX_AUXCTL_SHDWSEL_AUXCTL 0x0000
95
36#endif /* _LINUX_BRCMPHY_H */ 96#endif /* _LINUX_BRCMPHY_H */
diff --git a/include/linux/can/dev.h b/include/linux/can/dev.h
index fb0ab651a041..3ce5e526525f 100644
--- a/include/linux/can/dev.h
+++ b/include/linux/can/dev.h
@@ -33,8 +33,9 @@ enum can_mode {
33struct can_priv { 33struct can_priv {
34 struct can_device_stats can_stats; 34 struct can_device_stats can_stats;
35 35
36 struct can_bittiming bittiming; 36 struct can_bittiming bittiming, data_bittiming;
37 const struct can_bittiming_const *bittiming_const; 37 const struct can_bittiming_const *bittiming_const,
38 *data_bittiming_const;
38 struct can_clock clock; 39 struct can_clock clock;
39 40
40 enum can_state state; 41 enum can_state state;
@@ -45,6 +46,7 @@ struct can_priv {
45 struct timer_list restart_timer; 46 struct timer_list restart_timer;
46 47
47 int (*do_set_bittiming)(struct net_device *dev); 48 int (*do_set_bittiming)(struct net_device *dev);
49 int (*do_set_data_bittiming)(struct net_device *dev);
48 int (*do_set_mode)(struct net_device *dev, enum can_mode mode); 50 int (*do_set_mode)(struct net_device *dev, enum can_mode mode);
49 int (*do_get_state)(const struct net_device *dev, 51 int (*do_get_state)(const struct net_device *dev,
50 enum can_state *state); 52 enum can_state *state);
@@ -111,6 +113,7 @@ struct can_priv *safe_candev_priv(struct net_device *dev);
111 113
112int open_candev(struct net_device *dev); 114int open_candev(struct net_device *dev);
113void close_candev(struct net_device *dev); 115void close_candev(struct net_device *dev);
116int can_change_mtu(struct net_device *dev, int new_mtu);
114 117
115int register_candev(struct net_device *dev); 118int register_candev(struct net_device *dev);
116void unregister_candev(struct net_device *dev); 119void unregister_candev(struct net_device *dev);
@@ -124,6 +127,8 @@ unsigned int can_get_echo_skb(struct net_device *dev, unsigned int idx);
124void can_free_echo_skb(struct net_device *dev, unsigned int idx); 127void can_free_echo_skb(struct net_device *dev, unsigned int idx);
125 128
126struct sk_buff *alloc_can_skb(struct net_device *dev, struct can_frame **cf); 129struct sk_buff *alloc_can_skb(struct net_device *dev, struct can_frame **cf);
130struct sk_buff *alloc_canfd_skb(struct net_device *dev,
131 struct canfd_frame **cfd);
127struct sk_buff *alloc_can_err_skb(struct net_device *dev, 132struct sk_buff *alloc_can_err_skb(struct net_device *dev,
128 struct can_frame **cf); 133 struct can_frame **cf);
129 134
diff --git a/include/linux/ethtool.h b/include/linux/ethtool.h
index c8e3e7e39c6b..0a114d05f68d 100644
--- a/include/linux/ethtool.h
+++ b/include/linux/ethtool.h
@@ -183,6 +183,9 @@ static inline u32 ethtool_rxfh_indir_default(u32 index, u32 n_rx_rings)
183 * hold the RTNL lock. 183 * hold the RTNL lock.
184 * 184 *
185 * See the structures used by these operations for further documentation. 185 * See the structures used by these operations for further documentation.
186 * Note that for all operations using a structure ending with a zero-
187 * length array, the array is allocated separately in the kernel and
188 * is passed to the driver as an additional parameter.
186 * 189 *
187 * See &struct net_device and &struct net_device_ops for documentation 190 * See &struct net_device and &struct net_device_ops for documentation
188 * of the generic netdev features interface. 191 * of the generic netdev features interface.
diff --git a/include/linux/filter.h b/include/linux/filter.h
index e568c8ef896b..262dcbb75ffe 100644
--- a/include/linux/filter.h
+++ b/include/linux/filter.h
@@ -9,28 +9,81 @@
9#include <linux/workqueue.h> 9#include <linux/workqueue.h>
10#include <uapi/linux/filter.h> 10#include <uapi/linux/filter.h>
11 11
12#ifdef CONFIG_COMPAT 12/* Internally used and optimized filter representation with extended
13/* 13 * instruction set based on top of classic BPF.
14 * A struct sock_filter is architecture independent.
15 */ 14 */
15
16/* instruction classes */
17#define BPF_ALU64 0x07 /* alu mode in double word width */
18
19/* ld/ldx fields */
20#define BPF_DW 0x18 /* double word */
21#define BPF_XADD 0xc0 /* exclusive add */
22
23/* alu/jmp fields */
24#define BPF_MOV 0xb0 /* mov reg to reg */
25#define BPF_ARSH 0xc0 /* sign extending arithmetic shift right */
26
27/* change endianness of a register */
28#define BPF_END 0xd0 /* flags for endianness conversion: */
29#define BPF_TO_LE 0x00 /* convert to little-endian */
30#define BPF_TO_BE 0x08 /* convert to big-endian */
31#define BPF_FROM_LE BPF_TO_LE
32#define BPF_FROM_BE BPF_TO_BE
33
34#define BPF_JNE 0x50 /* jump != */
35#define BPF_JSGT 0x60 /* SGT is signed '>', GT in x86 */
36#define BPF_JSGE 0x70 /* SGE is signed '>=', GE in x86 */
37#define BPF_CALL 0x80 /* function call */
38#define BPF_EXIT 0x90 /* function return */
39
40/* BPF has 10 general purpose 64-bit registers and stack frame. */
41#define MAX_BPF_REG 11
42
43/* BPF program can access up to 512 bytes of stack space. */
44#define MAX_BPF_STACK 512
45
46/* Arg1, context and stack frame pointer register positions. */
47#define ARG1_REG 1
48#define CTX_REG 6
49#define FP_REG 10
50
51struct sock_filter_int {
52 __u8 code; /* opcode */
53 __u8 a_reg:4; /* dest register */
54 __u8 x_reg:4; /* source register */
55 __s16 off; /* signed offset */
56 __s32 imm; /* signed immediate constant */
57};
58
59#ifdef CONFIG_COMPAT
60/* A struct sock_filter is architecture independent. */
16struct compat_sock_fprog { 61struct compat_sock_fprog {
17 u16 len; 62 u16 len;
18 compat_uptr_t filter; /* struct sock_filter * */ 63 compat_uptr_t filter; /* struct sock_filter * */
19}; 64};
20#endif 65#endif
21 66
67struct sock_fprog_kern {
68 u16 len;
69 struct sock_filter *filter;
70};
71
22struct sk_buff; 72struct sk_buff;
23struct sock; 73struct sock;
74struct seccomp_data;
24 75
25struct sk_filter 76struct sk_filter {
26{
27 atomic_t refcnt; 77 atomic_t refcnt;
28 unsigned int len; /* Number of filter blocks */ 78 u32 jited:1, /* Is our filter JIT'ed? */
79 len:31; /* Number of filter blocks */
80 struct sock_fprog_kern *orig_prog; /* Original BPF program */
29 struct rcu_head rcu; 81 struct rcu_head rcu;
30 unsigned int (*bpf_func)(const struct sk_buff *skb, 82 unsigned int (*bpf_func)(const struct sk_buff *skb,
31 const struct sock_filter *filter); 83 const struct sock_filter_int *filter);
32 union { 84 union {
33 struct sock_filter insns[0]; 85 struct sock_filter insns[0];
86 struct sock_filter_int insnsi[0];
34 struct work_struct work; 87 struct work_struct work;
35 }; 88 };
36}; 89};
@@ -41,25 +94,44 @@ static inline unsigned int sk_filter_size(unsigned int proglen)
41 offsetof(struct sk_filter, insns[proglen])); 94 offsetof(struct sk_filter, insns[proglen]));
42} 95}
43 96
44extern int sk_filter(struct sock *sk, struct sk_buff *skb); 97#define sk_filter_proglen(fprog) \
45extern unsigned int sk_run_filter(const struct sk_buff *skb, 98 (fprog->len * sizeof(fprog->filter[0]))
46 const struct sock_filter *filter); 99
47extern int sk_unattached_filter_create(struct sk_filter **pfp, 100#define SK_RUN_FILTER(filter, ctx) \
48 struct sock_fprog *fprog); 101 (*filter->bpf_func)(ctx, filter->insnsi)
49extern void sk_unattached_filter_destroy(struct sk_filter *fp); 102
50extern int sk_attach_filter(struct sock_fprog *fprog, struct sock *sk); 103int sk_filter(struct sock *sk, struct sk_buff *skb);
51extern int sk_detach_filter(struct sock *sk); 104
52extern int sk_chk_filter(struct sock_filter *filter, unsigned int flen); 105u32 sk_run_filter_int_seccomp(const struct seccomp_data *ctx,
53extern int sk_get_filter(struct sock *sk, struct sock_filter __user *filter, unsigned len); 106 const struct sock_filter_int *insni);
54extern void sk_decode_filter(struct sock_filter *filt, struct sock_filter *to); 107u32 sk_run_filter_int_skb(const struct sk_buff *ctx,
108 const struct sock_filter_int *insni);
109
110int sk_convert_filter(struct sock_filter *prog, int len,
111 struct sock_filter_int *new_prog, int *new_len);
112
113int sk_unattached_filter_create(struct sk_filter **pfp,
114 struct sock_fprog *fprog);
115void sk_unattached_filter_destroy(struct sk_filter *fp);
116
117int sk_attach_filter(struct sock_fprog *fprog, struct sock *sk);
118int sk_detach_filter(struct sock *sk);
119
120int sk_chk_filter(struct sock_filter *filter, unsigned int flen);
121int sk_get_filter(struct sock *sk, struct sock_filter __user *filter,
122 unsigned int len);
123void sk_decode_filter(struct sock_filter *filt, struct sock_filter *to);
124
125void sk_filter_charge(struct sock *sk, struct sk_filter *fp);
126void sk_filter_uncharge(struct sock *sk, struct sk_filter *fp);
55 127
56#ifdef CONFIG_BPF_JIT 128#ifdef CONFIG_BPF_JIT
57#include <stdarg.h> 129#include <stdarg.h>
58#include <linux/linkage.h> 130#include <linux/linkage.h>
59#include <linux/printk.h> 131#include <linux/printk.h>
60 132
61extern void bpf_jit_compile(struct sk_filter *fp); 133void bpf_jit_compile(struct sk_filter *fp);
62extern void bpf_jit_free(struct sk_filter *fp); 134void bpf_jit_free(struct sk_filter *fp);
63 135
64static inline void bpf_jit_dump(unsigned int flen, unsigned int proglen, 136static inline void bpf_jit_dump(unsigned int flen, unsigned int proglen,
65 u32 pass, void *image) 137 u32 pass, void *image)
@@ -70,7 +142,6 @@ static inline void bpf_jit_dump(unsigned int flen, unsigned int proglen,
70 print_hex_dump(KERN_ERR, "JIT code: ", DUMP_PREFIX_OFFSET, 142 print_hex_dump(KERN_ERR, "JIT code: ", DUMP_PREFIX_OFFSET,
71 16, 1, image, proglen, false); 143 16, 1, image, proglen, false);
72} 144}
73#define SK_RUN_FILTER(FILTER, SKB) (*FILTER->bpf_func)(SKB, FILTER->insns)
74#else 145#else
75#include <linux/slab.h> 146#include <linux/slab.h>
76static inline void bpf_jit_compile(struct sk_filter *fp) 147static inline void bpf_jit_compile(struct sk_filter *fp)
@@ -80,7 +151,6 @@ static inline void bpf_jit_free(struct sk_filter *fp)
80{ 151{
81 kfree(fp); 152 kfree(fp);
82} 153}
83#define SK_RUN_FILTER(FILTER, SKB) sk_run_filter(SKB, FILTER->insns)
84#endif 154#endif
85 155
86static inline int bpf_tell_extensions(void) 156static inline int bpf_tell_extensions(void)
diff --git a/include/linux/ieee80211.h b/include/linux/ieee80211.h
index e526a8cecb70..f194ccb8539c 100644
--- a/include/linux/ieee80211.h
+++ b/include/linux/ieee80211.h
@@ -154,6 +154,10 @@ static inline u16 ieee80211_sn_sub(u16 sn1, u16 sn2)
154 802.11e clarifies the figure in section 7.1.2. The frame body is 154 802.11e clarifies the figure in section 7.1.2. The frame body is
155 up to 2304 octets long (maximum MSDU size) plus any crypt overhead. */ 155 up to 2304 octets long (maximum MSDU size) plus any crypt overhead. */
156#define IEEE80211_MAX_DATA_LEN 2304 156#define IEEE80211_MAX_DATA_LEN 2304
157/* 802.11ad extends maximum MSDU size for DMG (freq > 40Ghz) networks
158 * to 7920 bytes, see 8.2.3 General frame format
159 */
160#define IEEE80211_MAX_DATA_LEN_DMG 7920
157/* 30 byte 4 addr hdr, 2 byte QoS, 2304 byte MSDU, 12 byte crypt, 4 byte FCS */ 161/* 30 byte 4 addr hdr, 2 byte QoS, 2304 byte MSDU, 12 byte crypt, 4 byte FCS */
158#define IEEE80211_MAX_FRAME_LEN 2352 162#define IEEE80211_MAX_FRAME_LEN 2352
159 163
@@ -597,6 +601,20 @@ static inline int ieee80211_is_qos_nullfunc(__le16 fc)
597} 601}
598 602
599/** 603/**
604 * ieee80211_is_bufferable_mmpdu - check if frame is bufferable MMPDU
605 * @fc: frame control field in little-endian byteorder
606 */
607static inline bool ieee80211_is_bufferable_mmpdu(__le16 fc)
608{
609 /* IEEE 802.11-2012, definition of "bufferable management frame";
610 * note that this ignores the IBSS special case. */
611 return ieee80211_is_mgmt(fc) &&
612 (ieee80211_is_action(fc) ||
613 ieee80211_is_disassoc(fc) ||
614 ieee80211_is_deauth(fc));
615}
616
617/**
600 * ieee80211_is_first_frag - check if IEEE80211_SCTL_FRAG is not set 618 * ieee80211_is_first_frag - check if IEEE80211_SCTL_FRAG is not set
601 * @seq_ctrl: frame sequence control bytes in little-endian byteorder 619 * @seq_ctrl: frame sequence control bytes in little-endian byteorder
602 */ 620 */
@@ -1636,51 +1654,22 @@ enum ieee80211_reasoncode {
1636enum ieee80211_eid { 1654enum ieee80211_eid {
1637 WLAN_EID_SSID = 0, 1655 WLAN_EID_SSID = 0,
1638 WLAN_EID_SUPP_RATES = 1, 1656 WLAN_EID_SUPP_RATES = 1,
1639 WLAN_EID_FH_PARAMS = 2, 1657 WLAN_EID_FH_PARAMS = 2, /* reserved now */
1640 WLAN_EID_DS_PARAMS = 3, 1658 WLAN_EID_DS_PARAMS = 3,
1641 WLAN_EID_CF_PARAMS = 4, 1659 WLAN_EID_CF_PARAMS = 4,
1642 WLAN_EID_TIM = 5, 1660 WLAN_EID_TIM = 5,
1643 WLAN_EID_IBSS_PARAMS = 6, 1661 WLAN_EID_IBSS_PARAMS = 6,
1644 WLAN_EID_CHALLENGE = 16,
1645
1646 WLAN_EID_COUNTRY = 7, 1662 WLAN_EID_COUNTRY = 7,
1647 WLAN_EID_HP_PARAMS = 8, 1663 WLAN_EID_HP_PARAMS = 8,
1648 WLAN_EID_HP_TABLE = 9, 1664 WLAN_EID_HP_TABLE = 9,
1649 WLAN_EID_REQUEST = 10, 1665 WLAN_EID_REQUEST = 10,
1650
1651 WLAN_EID_QBSS_LOAD = 11, 1666 WLAN_EID_QBSS_LOAD = 11,
1652 WLAN_EID_EDCA_PARAM_SET = 12, 1667 WLAN_EID_EDCA_PARAM_SET = 12,
1653 WLAN_EID_TSPEC = 13, 1668 WLAN_EID_TSPEC = 13,
1654 WLAN_EID_TCLAS = 14, 1669 WLAN_EID_TCLAS = 14,
1655 WLAN_EID_SCHEDULE = 15, 1670 WLAN_EID_SCHEDULE = 15,
1656 WLAN_EID_TS_DELAY = 43, 1671 WLAN_EID_CHALLENGE = 16,
1657 WLAN_EID_TCLAS_PROCESSING = 44, 1672 /* 17-31 reserved for challenge text extension */
1658 WLAN_EID_QOS_CAPA = 46,
1659 /* 802.11z */
1660 WLAN_EID_LINK_ID = 101,
1661 /* 802.11s */
1662 WLAN_EID_MESH_CONFIG = 113,
1663 WLAN_EID_MESH_ID = 114,
1664 WLAN_EID_LINK_METRIC_REPORT = 115,
1665 WLAN_EID_CONGESTION_NOTIFICATION = 116,
1666 WLAN_EID_PEER_MGMT = 117,
1667 WLAN_EID_CHAN_SWITCH_PARAM = 118,
1668 WLAN_EID_MESH_AWAKE_WINDOW = 119,
1669 WLAN_EID_BEACON_TIMING = 120,
1670 WLAN_EID_MCCAOP_SETUP_REQ = 121,
1671 WLAN_EID_MCCAOP_SETUP_RESP = 122,
1672 WLAN_EID_MCCAOP_ADVERT = 123,
1673 WLAN_EID_MCCAOP_TEARDOWN = 124,
1674 WLAN_EID_GANN = 125,
1675 WLAN_EID_RANN = 126,
1676 WLAN_EID_PREQ = 130,
1677 WLAN_EID_PREP = 131,
1678 WLAN_EID_PERR = 132,
1679 WLAN_EID_PXU = 137,
1680 WLAN_EID_PXUC = 138,
1681 WLAN_EID_AUTH_MESH_PEER_EXCH = 139,
1682 WLAN_EID_MIC = 140,
1683
1684 WLAN_EID_PWR_CONSTRAINT = 32, 1673 WLAN_EID_PWR_CONSTRAINT = 32,
1685 WLAN_EID_PWR_CAPABILITY = 33, 1674 WLAN_EID_PWR_CAPABILITY = 33,
1686 WLAN_EID_TPC_REQUEST = 34, 1675 WLAN_EID_TPC_REQUEST = 34,
@@ -1691,66 +1680,114 @@ enum ieee80211_eid {
1691 WLAN_EID_MEASURE_REPORT = 39, 1680 WLAN_EID_MEASURE_REPORT = 39,
1692 WLAN_EID_QUIET = 40, 1681 WLAN_EID_QUIET = 40,
1693 WLAN_EID_IBSS_DFS = 41, 1682 WLAN_EID_IBSS_DFS = 41,
1694
1695 WLAN_EID_ERP_INFO = 42, 1683 WLAN_EID_ERP_INFO = 42,
1696 WLAN_EID_EXT_SUPP_RATES = 50, 1684 WLAN_EID_TS_DELAY = 43,
1697 1685 WLAN_EID_TCLAS_PROCESSING = 44,
1698 WLAN_EID_HT_CAPABILITY = 45, 1686 WLAN_EID_HT_CAPABILITY = 45,
1699 WLAN_EID_HT_OPERATION = 61, 1687 WLAN_EID_QOS_CAPA = 46,
1700 WLAN_EID_SECONDARY_CHANNEL_OFFSET = 62, 1688 /* 47 reserved for Broadcom */
1701
1702 WLAN_EID_RSN = 48, 1689 WLAN_EID_RSN = 48,
1703 WLAN_EID_MMIE = 76, 1690 WLAN_EID_802_15_COEX = 49,
1704 WLAN_EID_VENDOR_SPECIFIC = 221, 1691 WLAN_EID_EXT_SUPP_RATES = 50,
1705 WLAN_EID_QOS_PARAMETER = 222,
1706
1707 WLAN_EID_AP_CHAN_REPORT = 51, 1692 WLAN_EID_AP_CHAN_REPORT = 51,
1708 WLAN_EID_NEIGHBOR_REPORT = 52, 1693 WLAN_EID_NEIGHBOR_REPORT = 52,
1709 WLAN_EID_RCPI = 53, 1694 WLAN_EID_RCPI = 53,
1695 WLAN_EID_MOBILITY_DOMAIN = 54,
1696 WLAN_EID_FAST_BSS_TRANSITION = 55,
1697 WLAN_EID_TIMEOUT_INTERVAL = 56,
1698 WLAN_EID_RIC_DATA = 57,
1699 WLAN_EID_DSE_REGISTERED_LOCATION = 58,
1700 WLAN_EID_SUPPORTED_REGULATORY_CLASSES = 59,
1701 WLAN_EID_EXT_CHANSWITCH_ANN = 60,
1702 WLAN_EID_HT_OPERATION = 61,
1703 WLAN_EID_SECONDARY_CHANNEL_OFFSET = 62,
1710 WLAN_EID_BSS_AVG_ACCESS_DELAY = 63, 1704 WLAN_EID_BSS_AVG_ACCESS_DELAY = 63,
1711 WLAN_EID_ANTENNA_INFO = 64, 1705 WLAN_EID_ANTENNA_INFO = 64,
1712 WLAN_EID_RSNI = 65, 1706 WLAN_EID_RSNI = 65,
1713 WLAN_EID_MEASUREMENT_PILOT_TX_INFO = 66, 1707 WLAN_EID_MEASUREMENT_PILOT_TX_INFO = 66,
1714 WLAN_EID_BSS_AVAILABLE_CAPACITY = 67, 1708 WLAN_EID_BSS_AVAILABLE_CAPACITY = 67,
1715 WLAN_EID_BSS_AC_ACCESS_DELAY = 68, 1709 WLAN_EID_BSS_AC_ACCESS_DELAY = 68,
1710 WLAN_EID_TIME_ADVERTISEMENT = 69,
1716 WLAN_EID_RRM_ENABLED_CAPABILITIES = 70, 1711 WLAN_EID_RRM_ENABLED_CAPABILITIES = 70,
1717 WLAN_EID_MULTIPLE_BSSID = 71, 1712 WLAN_EID_MULTIPLE_BSSID = 71,
1718 WLAN_EID_BSS_COEX_2040 = 72, 1713 WLAN_EID_BSS_COEX_2040 = 72,
1719 WLAN_EID_OVERLAP_BSS_SCAN_PARAM = 74, 1714 WLAN_EID_OVERLAP_BSS_SCAN_PARAM = 74,
1720 WLAN_EID_EXT_CAPABILITY = 127,
1721
1722 WLAN_EID_MOBILITY_DOMAIN = 54,
1723 WLAN_EID_FAST_BSS_TRANSITION = 55,
1724 WLAN_EID_TIMEOUT_INTERVAL = 56,
1725 WLAN_EID_RIC_DATA = 57,
1726 WLAN_EID_RIC_DESCRIPTOR = 75, 1715 WLAN_EID_RIC_DESCRIPTOR = 75,
1727 1716 WLAN_EID_MMIE = 76,
1728 WLAN_EID_DSE_REGISTERED_LOCATION = 58, 1717 WLAN_EID_ASSOC_COMEBACK_TIME = 77,
1729 WLAN_EID_SUPPORTED_REGULATORY_CLASSES = 59, 1718 WLAN_EID_EVENT_REQUEST = 78,
1730 WLAN_EID_EXT_CHANSWITCH_ANN = 60, 1719 WLAN_EID_EVENT_REPORT = 79,
1731 1720 WLAN_EID_DIAGNOSTIC_REQUEST = 80,
1732 WLAN_EID_VHT_CAPABILITY = 191, 1721 WLAN_EID_DIAGNOSTIC_REPORT = 81,
1733 WLAN_EID_VHT_OPERATION = 192, 1722 WLAN_EID_LOCATION_PARAMS = 82,
1734 WLAN_EID_OPMODE_NOTIF = 199,
1735 WLAN_EID_WIDE_BW_CHANNEL_SWITCH = 194,
1736 WLAN_EID_CHANNEL_SWITCH_WRAPPER = 196,
1737 WLAN_EID_EXTENDED_BSS_LOAD = 193,
1738 WLAN_EID_VHT_TX_POWER_ENVELOPE = 195,
1739 WLAN_EID_AID = 197,
1740 WLAN_EID_QUIET_CHANNEL = 198,
1741
1742 /* 802.11ad */
1743 WLAN_EID_NON_TX_BSSID_CAP = 83, 1723 WLAN_EID_NON_TX_BSSID_CAP = 83,
1724 WLAN_EID_SSID_LIST = 84,
1725 WLAN_EID_MULTI_BSSID_IDX = 85,
1726 WLAN_EID_FMS_DESCRIPTOR = 86,
1727 WLAN_EID_FMS_REQUEST = 87,
1728 WLAN_EID_FMS_RESPONSE = 88,
1729 WLAN_EID_QOS_TRAFFIC_CAPA = 89,
1730 WLAN_EID_BSS_MAX_IDLE_PERIOD = 90,
1731 WLAN_EID_TSF_REQUEST = 91,
1732 WLAN_EID_TSF_RESPOSNE = 92,
1733 WLAN_EID_WNM_SLEEP_MODE = 93,
1734 WLAN_EID_TIM_BCAST_REQ = 94,
1735 WLAN_EID_TIM_BCAST_RESP = 95,
1736 WLAN_EID_COLL_IF_REPORT = 96,
1737 WLAN_EID_CHANNEL_USAGE = 97,
1738 WLAN_EID_TIME_ZONE = 98,
1739 WLAN_EID_DMS_REQUEST = 99,
1740 WLAN_EID_DMS_RESPONSE = 100,
1741 WLAN_EID_LINK_ID = 101,
1742 WLAN_EID_WAKEUP_SCHEDUL = 102,
1743 /* 103 reserved */
1744 WLAN_EID_CHAN_SWITCH_TIMING = 104,
1745 WLAN_EID_PTI_CONTROL = 105,
1746 WLAN_EID_PU_BUFFER_STATUS = 106,
1747 WLAN_EID_INTERWORKING = 107,
1748 WLAN_EID_ADVERTISEMENT_PROTOCOL = 108,
1749 WLAN_EID_EXPEDITED_BW_REQ = 109,
1750 WLAN_EID_QOS_MAP_SET = 110,
1751 WLAN_EID_ROAMING_CONSORTIUM = 111,
1752 WLAN_EID_EMERGENCY_ALERT = 112,
1753 WLAN_EID_MESH_CONFIG = 113,
1754 WLAN_EID_MESH_ID = 114,
1755 WLAN_EID_LINK_METRIC_REPORT = 115,
1756 WLAN_EID_CONGESTION_NOTIFICATION = 116,
1757 WLAN_EID_PEER_MGMT = 117,
1758 WLAN_EID_CHAN_SWITCH_PARAM = 118,
1759 WLAN_EID_MESH_AWAKE_WINDOW = 119,
1760 WLAN_EID_BEACON_TIMING = 120,
1761 WLAN_EID_MCCAOP_SETUP_REQ = 121,
1762 WLAN_EID_MCCAOP_SETUP_RESP = 122,
1763 WLAN_EID_MCCAOP_ADVERT = 123,
1764 WLAN_EID_MCCAOP_TEARDOWN = 124,
1765 WLAN_EID_GANN = 125,
1766 WLAN_EID_RANN = 126,
1767 WLAN_EID_EXT_CAPABILITY = 127,
1768 /* 128, 129 reserved for Agere */
1769 WLAN_EID_PREQ = 130,
1770 WLAN_EID_PREP = 131,
1771 WLAN_EID_PERR = 132,
1772 /* 133-136 reserved for Cisco */
1773 WLAN_EID_PXU = 137,
1774 WLAN_EID_PXUC = 138,
1775 WLAN_EID_AUTH_MESH_PEER_EXCH = 139,
1776 WLAN_EID_MIC = 140,
1777 WLAN_EID_DESTINATION_URI = 141,
1778 WLAN_EID_UAPSD_COEX = 142,
1744 WLAN_EID_WAKEUP_SCHEDULE = 143, 1779 WLAN_EID_WAKEUP_SCHEDULE = 143,
1745 WLAN_EID_EXT_SCHEDULE = 144, 1780 WLAN_EID_EXT_SCHEDULE = 144,
1746 WLAN_EID_STA_AVAILABILITY = 145, 1781 WLAN_EID_STA_AVAILABILITY = 145,
1747 WLAN_EID_DMG_TSPEC = 146, 1782 WLAN_EID_DMG_TSPEC = 146,
1748 WLAN_EID_DMG_AT = 147, 1783 WLAN_EID_DMG_AT = 147,
1749 WLAN_EID_DMG_CAP = 148, 1784 WLAN_EID_DMG_CAP = 148,
1785 /* 149-150 reserved for Cisco */
1750 WLAN_EID_DMG_OPERATION = 151, 1786 WLAN_EID_DMG_OPERATION = 151,
1751 WLAN_EID_DMG_BSS_PARAM_CHANGE = 152, 1787 WLAN_EID_DMG_BSS_PARAM_CHANGE = 152,
1752 WLAN_EID_DMG_BEAM_REFINEMENT = 153, 1788 WLAN_EID_DMG_BEAM_REFINEMENT = 153,
1753 WLAN_EID_CHANNEL_MEASURE_FEEDBACK = 154, 1789 WLAN_EID_CHANNEL_MEASURE_FEEDBACK = 154,
1790 /* 155-156 reserved for Cisco */
1754 WLAN_EID_AWAKE_WINDOW = 157, 1791 WLAN_EID_AWAKE_WINDOW = 157,
1755 WLAN_EID_MULTI_BAND = 158, 1792 WLAN_EID_MULTI_BAND = 158,
1756 WLAN_EID_ADDBA_EXT = 159, 1793 WLAN_EID_ADDBA_EXT = 159,
@@ -1767,11 +1804,34 @@ enum ieee80211_eid {
1767 WLAN_EID_MULTIPLE_MAC_ADDR = 170, 1804 WLAN_EID_MULTIPLE_MAC_ADDR = 170,
1768 WLAN_EID_U_PID = 171, 1805 WLAN_EID_U_PID = 171,
1769 WLAN_EID_DMG_LINK_ADAPT_ACK = 172, 1806 WLAN_EID_DMG_LINK_ADAPT_ACK = 172,
1807 /* 173 reserved for Symbol */
1808 WLAN_EID_MCCAOP_ADV_OVERVIEW = 174,
1770 WLAN_EID_QUIET_PERIOD_REQ = 175, 1809 WLAN_EID_QUIET_PERIOD_REQ = 175,
1810 /* 176 reserved for Symbol */
1771 WLAN_EID_QUIET_PERIOD_RESP = 177, 1811 WLAN_EID_QUIET_PERIOD_RESP = 177,
1812 /* 178-179 reserved for Symbol */
1813 /* 180 reserved for ISO/IEC 20011 */
1772 WLAN_EID_EPAC_POLICY = 182, 1814 WLAN_EID_EPAC_POLICY = 182,
1773 WLAN_EID_CLISTER_TIME_OFF = 183, 1815 WLAN_EID_CLISTER_TIME_OFF = 183,
1816 WLAN_EID_INTER_AC_PRIO = 184,
1817 WLAN_EID_SCS_DESCRIPTOR = 185,
1818 WLAN_EID_QLOAD_REPORT = 186,
1819 WLAN_EID_HCCA_TXOP_UPDATE_COUNT = 187,
1820 WLAN_EID_HL_STREAM_ID = 188,
1821 WLAN_EID_GCR_GROUP_ADDR = 189,
1774 WLAN_EID_ANTENNA_SECTOR_ID_PATTERN = 190, 1822 WLAN_EID_ANTENNA_SECTOR_ID_PATTERN = 190,
1823 WLAN_EID_VHT_CAPABILITY = 191,
1824 WLAN_EID_VHT_OPERATION = 192,
1825 WLAN_EID_EXTENDED_BSS_LOAD = 193,
1826 WLAN_EID_WIDE_BW_CHANNEL_SWITCH = 194,
1827 WLAN_EID_VHT_TX_POWER_ENVELOPE = 195,
1828 WLAN_EID_CHANNEL_SWITCH_WRAPPER = 196,
1829 WLAN_EID_AID = 197,
1830 WLAN_EID_QUIET_CHANNEL = 198,
1831 WLAN_EID_OPMODE_NOTIF = 199,
1832
1833 WLAN_EID_VENDOR_SPECIFIC = 221,
1834 WLAN_EID_QOS_PARAMETER = 222,
1775}; 1835};
1776 1836
1777/* Action category code */ 1837/* Action category code */
@@ -2192,10 +2252,10 @@ static inline u8 *ieee80211_get_DA(struct ieee80211_hdr *hdr)
2192} 2252}
2193 2253
2194/** 2254/**
2195 * ieee80211_is_robust_mgmt_frame - check if frame is a robust management frame 2255 * _ieee80211_is_robust_mgmt_frame - check if frame is a robust management frame
2196 * @hdr: the frame (buffer must include at least the first octet of payload) 2256 * @hdr: the frame (buffer must include at least the first octet of payload)
2197 */ 2257 */
2198static inline bool ieee80211_is_robust_mgmt_frame(struct ieee80211_hdr *hdr) 2258static inline bool _ieee80211_is_robust_mgmt_frame(struct ieee80211_hdr *hdr)
2199{ 2259{
2200 if (ieee80211_is_disassoc(hdr->frame_control) || 2260 if (ieee80211_is_disassoc(hdr->frame_control) ||
2201 ieee80211_is_deauth(hdr->frame_control)) 2261 ieee80211_is_deauth(hdr->frame_control))
@@ -2224,6 +2284,17 @@ static inline bool ieee80211_is_robust_mgmt_frame(struct ieee80211_hdr *hdr)
2224} 2284}
2225 2285
2226/** 2286/**
2287 * ieee80211_is_robust_mgmt_frame - check if skb contains a robust mgmt frame
2288 * @skb: the skb containing the frame, length will be checked
2289 */
2290static inline bool ieee80211_is_robust_mgmt_frame(struct sk_buff *skb)
2291{
2292 if (skb->len < 25)
2293 return false;
2294 return _ieee80211_is_robust_mgmt_frame((void *)skb->data);
2295}
2296
2297/**
2227 * ieee80211_is_public_action - check if frame is a public action frame 2298 * ieee80211_is_public_action - check if frame is a public action frame
2228 * @hdr: the frame 2299 * @hdr: the frame
2229 * @len: length of the frame 2300 * @len: length of the frame
@@ -2241,42 +2312,6 @@ static inline bool ieee80211_is_public_action(struct ieee80211_hdr *hdr,
2241} 2312}
2242 2313
2243/** 2314/**
2244 * ieee80211_dsss_chan_to_freq - get channel center frequency
2245 * @channel: the DSSS channel
2246 *
2247 * Convert IEEE802.11 DSSS channel to the center frequency (MHz).
2248 * Ref IEEE 802.11-2007 section 15.6
2249 */
2250static inline int ieee80211_dsss_chan_to_freq(int channel)
2251{
2252 if ((channel > 0) && (channel < 14))
2253 return 2407 + (channel * 5);
2254 else if (channel == 14)
2255 return 2484;
2256 else
2257 return -1;
2258}
2259
2260/**
2261 * ieee80211_freq_to_dsss_chan - get channel
2262 * @freq: the frequency
2263 *
2264 * Convert frequency (MHz) to IEEE802.11 DSSS channel
2265 * Ref IEEE 802.11-2007 section 15.6
2266 *
2267 * This routine selects the channel with the closest center frequency.
2268 */
2269static inline int ieee80211_freq_to_dsss_chan(int freq)
2270{
2271 if ((freq >= 2410) && (freq < 2475))
2272 return (freq - 2405) / 5;
2273 else if ((freq >= 2482) && (freq < 2487))
2274 return 14;
2275 else
2276 return -1;
2277}
2278
2279/**
2280 * ieee80211_tu_to_usec - convert time units (TU) to microseconds 2315 * ieee80211_tu_to_usec - convert time units (TU) to microseconds
2281 * @tu: the TUs 2316 * @tu: the TUs
2282 */ 2317 */
diff --git a/include/linux/if_vlan.h b/include/linux/if_vlan.h
index bbedfb56bd66..13bbbde00e68 100644
--- a/include/linux/if_vlan.h
+++ b/include/linux/if_vlan.h
@@ -110,6 +110,7 @@ extern struct net_device *__vlan_find_dev_deep(struct net_device *real_dev,
110 __be16 vlan_proto, u16 vlan_id); 110 __be16 vlan_proto, u16 vlan_id);
111extern struct net_device *vlan_dev_real_dev(const struct net_device *dev); 111extern struct net_device *vlan_dev_real_dev(const struct net_device *dev);
112extern u16 vlan_dev_vlan_id(const struct net_device *dev); 112extern u16 vlan_dev_vlan_id(const struct net_device *dev);
113extern __be16 vlan_dev_vlan_proto(const struct net_device *dev);
113 114
114/** 115/**
115 * struct vlan_priority_tci_mapping - vlan egress priority mappings 116 * struct vlan_priority_tci_mapping - vlan egress priority mappings
@@ -216,6 +217,12 @@ static inline u16 vlan_dev_vlan_id(const struct net_device *dev)
216 return 0; 217 return 0;
217} 218}
218 219
220static inline __be16 vlan_dev_vlan_proto(const struct net_device *dev)
221{
222 BUG();
223 return 0;
224}
225
219static inline u16 vlan_dev_get_egress_qos_mask(struct net_device *dev, 226static inline u16 vlan_dev_get_egress_qos_mask(struct net_device *dev,
220 u32 skprio) 227 u32 skprio)
221{ 228{
@@ -288,7 +295,7 @@ static inline struct sk_buff *vlan_insert_tag(struct sk_buff *skb,
288 struct vlan_ethhdr *veth; 295 struct vlan_ethhdr *veth;
289 296
290 if (skb_cow_head(skb, VLAN_HLEN) < 0) { 297 if (skb_cow_head(skb, VLAN_HLEN) < 0) {
291 kfree_skb(skb); 298 dev_kfree_skb_any(skb);
292 return NULL; 299 return NULL;
293 } 300 }
294 veth = (struct vlan_ethhdr *)skb_push(skb, VLAN_HLEN); 301 veth = (struct vlan_ethhdr *)skb_push(skb, VLAN_HLEN);
diff --git a/include/linux/isdn_ppp.h b/include/linux/isdn_ppp.h
index d5f62bc5f4be..8e10f57f109f 100644
--- a/include/linux/isdn_ppp.h
+++ b/include/linux/isdn_ppp.h
@@ -180,9 +180,8 @@ struct ippp_struct {
180 struct slcompress *slcomp; 180 struct slcompress *slcomp;
181#endif 181#endif
182#ifdef CONFIG_IPPP_FILTER 182#ifdef CONFIG_IPPP_FILTER
183 struct sock_filter *pass_filter; /* filter for packets to pass */ 183 struct sk_filter *pass_filter; /* filter for packets to pass */
184 struct sock_filter *active_filter; /* filter for pkts to reset idle */ 184 struct sk_filter *active_filter; /* filter for pkts to reset idle */
185 unsigned pass_len, active_len;
186#endif 185#endif
187 unsigned long debug; 186 unsigned long debug;
188 struct isdn_ppp_compressor *compressor,*decompressor; 187 struct isdn_ppp_compressor *compressor,*decompressor;
diff --git a/include/linux/miscdevice.h b/include/linux/miscdevice.h
index 2cf1547096d9..51e26f3cd3b3 100644
--- a/include/linux/miscdevice.h
+++ b/include/linux/miscdevice.h
@@ -23,6 +23,7 @@
23#define TEMP_MINOR 131 /* Temperature Sensor */ 23#define TEMP_MINOR 131 /* Temperature Sensor */
24#define RTC_MINOR 135 24#define RTC_MINOR 135
25#define EFI_RTC_MINOR 136 /* EFI Time services */ 25#define EFI_RTC_MINOR 136 /* EFI Time services */
26#define VHCI_MINOR 137
26#define SUN_OPENPROM_MINOR 139 27#define SUN_OPENPROM_MINOR 139
27#define DMAPI_MINOR 140 /* unused */ 28#define DMAPI_MINOR 140 /* unused */
28#define NVRAM_MINOR 144 29#define NVRAM_MINOR 144
diff --git a/include/linux/mlx4/cmd.h b/include/linux/mlx4/cmd.h
index 79a347238168..c8450366c130 100644
--- a/include/linux/mlx4/cmd.h
+++ b/include/linux/mlx4/cmd.h
@@ -125,6 +125,7 @@ enum {
125 /* miscellaneous commands */ 125 /* miscellaneous commands */
126 MLX4_CMD_DIAG_RPRT = 0x30, 126 MLX4_CMD_DIAG_RPRT = 0x30,
127 MLX4_CMD_NOP = 0x31, 127 MLX4_CMD_NOP = 0x31,
128 MLX4_CMD_CONFIG_DEV = 0x3a,
128 MLX4_CMD_ACCESS_MEM = 0x2e, 129 MLX4_CMD_ACCESS_MEM = 0x2e,
129 MLX4_CMD_SET_VEP = 0x52, 130 MLX4_CMD_SET_VEP = 0x52,
130 131
@@ -240,6 +241,13 @@ int mlx4_set_vf_vlan(struct mlx4_dev *dev, int port, int vf, u16 vlan, u8 qos);
240int mlx4_set_vf_spoofchk(struct mlx4_dev *dev, int port, int vf, bool setting); 241int mlx4_set_vf_spoofchk(struct mlx4_dev *dev, int port, int vf, bool setting);
241int mlx4_get_vf_config(struct mlx4_dev *dev, int port, int vf, struct ifla_vf_info *ivf); 242int mlx4_get_vf_config(struct mlx4_dev *dev, int port, int vf, struct ifla_vf_info *ivf);
242int mlx4_set_vf_link_state(struct mlx4_dev *dev, int port, int vf, int link_state); 243int mlx4_set_vf_link_state(struct mlx4_dev *dev, int port, int vf, int link_state);
244/*
245 * mlx4_get_slave_default_vlan -
246 * return true if VST ( default vlan)
247 * if VST, will return vlan & qos (if not NULL)
248 */
249bool mlx4_get_slave_default_vlan(struct mlx4_dev *dev, int port, int slave,
250 u16 *vlan, u8 *qos);
243 251
244#define MLX4_COMM_GET_IF_REV(cmd_chan_ver) (u8)((cmd_chan_ver) >> 8) 252#define MLX4_COMM_GET_IF_REV(cmd_chan_ver) (u8)((cmd_chan_ver) >> 8)
245 253
diff --git a/include/linux/mlx4/device.h b/include/linux/mlx4/device.h
index 5edd2c68274d..ba87bd21295a 100644
--- a/include/linux/mlx4/device.h
+++ b/include/linux/mlx4/device.h
@@ -48,6 +48,9 @@
48#define MSIX_LEGACY_SZ 4 48#define MSIX_LEGACY_SZ 4
49#define MIN_MSIX_P_PORT 5 49#define MIN_MSIX_P_PORT 5
50 50
51#define MLX4_ROCE_MAX_GIDS 128
52#define MLX4_ROCE_PF_GIDS 16
53
51enum { 54enum {
52 MLX4_FLAG_MSI_X = 1 << 0, 55 MLX4_FLAG_MSI_X = 1 << 0,
53 MLX4_FLAG_OLD_PORT_CMDS = 1 << 1, 56 MLX4_FLAG_OLD_PORT_CMDS = 1 << 1,
@@ -81,6 +84,7 @@ enum {
81enum { 84enum {
82 MLX4_MAX_NUM_PF = 16, 85 MLX4_MAX_NUM_PF = 16,
83 MLX4_MAX_NUM_VF = 64, 86 MLX4_MAX_NUM_VF = 64,
87 MLX4_MAX_NUM_VF_P_PORT = 64,
84 MLX4_MFUNC_MAX = 80, 88 MLX4_MFUNC_MAX = 80,
85 MLX4_MAX_EQ_NUM = 1024, 89 MLX4_MAX_EQ_NUM = 1024,
86 MLX4_MFUNC_EQ_NUM = 4, 90 MLX4_MFUNC_EQ_NUM = 4,
@@ -629,7 +633,8 @@ struct mlx4_eth_av {
629 u8 hop_limit; 633 u8 hop_limit;
630 __be32 sl_tclass_flowlabel; 634 __be32 sl_tclass_flowlabel;
631 u8 dgid[16]; 635 u8 dgid[16];
632 u32 reserved4[2]; 636 u8 s_mac[6];
637 u8 reserved4[2];
633 __be16 vlan; 638 __be16 vlan;
634 u8 mac[ETH_ALEN]; 639 u8 mac[ETH_ALEN];
635}; 640};
@@ -660,6 +665,11 @@ struct mlx4_quotas {
660 int xrcd; 665 int xrcd;
661}; 666};
662 667
668struct mlx4_vf_dev {
669 u8 min_port;
670 u8 n_ports;
671};
672
663struct mlx4_dev { 673struct mlx4_dev {
664 struct pci_dev *pdev; 674 struct pci_dev *pdev;
665 unsigned long flags; 675 unsigned long flags;
@@ -675,6 +685,7 @@ struct mlx4_dev {
675 int oper_log_mgm_entry_size; 685 int oper_log_mgm_entry_size;
676 u64 regid_promisc_array[MLX4_MAX_PORTS + 1]; 686 u64 regid_promisc_array[MLX4_MAX_PORTS + 1];
677 u64 regid_allmulti_array[MLX4_MAX_PORTS + 1]; 687 u64 regid_allmulti_array[MLX4_MAX_PORTS + 1];
688 struct mlx4_vf_dev *dev_vfs;
678}; 689};
679 690
680struct mlx4_eqe { 691struct mlx4_eqe {
@@ -1131,7 +1142,7 @@ int mlx4_SET_PORT_qpn_calc(struct mlx4_dev *dev, u8 port, u32 base_qpn,
1131int mlx4_SET_PORT_PRIO2TC(struct mlx4_dev *dev, u8 port, u8 *prio2tc); 1142int mlx4_SET_PORT_PRIO2TC(struct mlx4_dev *dev, u8 port, u8 *prio2tc);
1132int mlx4_SET_PORT_SCHEDULER(struct mlx4_dev *dev, u8 port, u8 *tc_tx_bw, 1143int mlx4_SET_PORT_SCHEDULER(struct mlx4_dev *dev, u8 port, u8 *tc_tx_bw,
1133 u8 *pg, u16 *ratelimit); 1144 u8 *pg, u16 *ratelimit);
1134int mlx4_SET_PORT_VXLAN(struct mlx4_dev *dev, u8 port, u8 steering); 1145int mlx4_SET_PORT_VXLAN(struct mlx4_dev *dev, u8 port, u8 steering, int enable);
1135int mlx4_find_cached_mac(struct mlx4_dev *dev, u8 port, u64 mac, int *idx); 1146int mlx4_find_cached_mac(struct mlx4_dev *dev, u8 port, u64 mac, int *idx);
1136int mlx4_find_cached_vlan(struct mlx4_dev *dev, u8 port, u16 vid, int *idx); 1147int mlx4_find_cached_vlan(struct mlx4_dev *dev, u8 port, u16 vid, int *idx);
1137int mlx4_register_vlan(struct mlx4_dev *dev, u8 port, u16 vlan, int *index); 1148int mlx4_register_vlan(struct mlx4_dev *dev, u8 port, u16 vlan, int *index);
@@ -1183,9 +1194,44 @@ int set_and_calc_slave_port_state(struct mlx4_dev *dev, int slave, u8 port, int
1183void mlx4_put_slave_node_guid(struct mlx4_dev *dev, int slave, __be64 guid); 1194void mlx4_put_slave_node_guid(struct mlx4_dev *dev, int slave, __be64 guid);
1184__be64 mlx4_get_slave_node_guid(struct mlx4_dev *dev, int slave); 1195__be64 mlx4_get_slave_node_guid(struct mlx4_dev *dev, int slave);
1185 1196
1197int mlx4_get_slave_from_roce_gid(struct mlx4_dev *dev, int port, u8 *gid,
1198 int *slave_id);
1199int mlx4_get_roce_gid_from_slave(struct mlx4_dev *dev, int port, int slave_id,
1200 u8 *gid);
1201
1186int mlx4_FLOW_STEERING_IB_UC_QP_RANGE(struct mlx4_dev *dev, u32 min_range_qpn, 1202int mlx4_FLOW_STEERING_IB_UC_QP_RANGE(struct mlx4_dev *dev, u32 min_range_qpn,
1187 u32 max_range_qpn); 1203 u32 max_range_qpn);
1188 1204
1189cycle_t mlx4_read_clock(struct mlx4_dev *dev); 1205cycle_t mlx4_read_clock(struct mlx4_dev *dev);
1190 1206
1207struct mlx4_active_ports {
1208 DECLARE_BITMAP(ports, MLX4_MAX_PORTS);
1209};
1210/* Returns a bitmap of the physical ports which are assigned to slave */
1211struct mlx4_active_ports mlx4_get_active_ports(struct mlx4_dev *dev, int slave);
1212
1213/* Returns the physical port that represents the virtual port of the slave, */
1214/* or a value < 0 in case of an error. If a slave has 2 ports, the identity */
1215/* mapping is returned. */
1216int mlx4_slave_convert_port(struct mlx4_dev *dev, int slave, int port);
1217
1218struct mlx4_slaves_pport {
1219 DECLARE_BITMAP(slaves, MLX4_MFUNC_MAX);
1220};
1221/* Returns a bitmap of all slaves that are assigned to port. */
1222struct mlx4_slaves_pport mlx4_phys_to_slaves_pport(struct mlx4_dev *dev,
1223 int port);
1224
1225/* Returns a bitmap of all slaves that are assigned exactly to all the */
1226/* the ports that are set in crit_ports. */
1227struct mlx4_slaves_pport mlx4_phys_to_slaves_pport_actv(
1228 struct mlx4_dev *dev,
1229 const struct mlx4_active_ports *crit_ports);
1230
1231/* Returns the slave's virtual port that represents the physical port. */
1232int mlx4_phys_to_slave_port(struct mlx4_dev *dev, int slave, int port);
1233
1234int mlx4_get_base_gid_ix(struct mlx4_dev *dev, int slave, int port);
1235
1236int mlx4_config_vxlan_port(struct mlx4_dev *dev, __be16 udp_port);
1191#endif /* MLX4_DEVICE_H */ 1237#endif /* MLX4_DEVICE_H */
diff --git a/include/linux/mlx4/driver.h b/include/linux/mlx4/driver.h
index c257e1b211be..022055c8fb26 100644
--- a/include/linux/mlx4/driver.h
+++ b/include/linux/mlx4/driver.h
@@ -64,4 +64,16 @@ void mlx4_unregister_interface(struct mlx4_interface *intf);
64 64
65void *mlx4_get_protocol_dev(struct mlx4_dev *dev, enum mlx4_protocol proto, int port); 65void *mlx4_get_protocol_dev(struct mlx4_dev *dev, enum mlx4_protocol proto, int port);
66 66
67static inline u64 mlx4_mac_to_u64(u8 *addr)
68{
69 u64 mac = 0;
70 int i;
71
72 for (i = 0; i < ETH_ALEN; i++) {
73 mac <<= 8;
74 mac |= addr[i];
75 }
76 return mac;
77}
78
67#endif /* MLX4_DRIVER_H */ 79#endif /* MLX4_DRIVER_H */
diff --git a/include/linux/mlx4/qp.h b/include/linux/mlx4/qp.h
index 59f8ba84568b..b66e7610d4ee 100644
--- a/include/linux/mlx4/qp.h
+++ b/include/linux/mlx4/qp.h
@@ -270,9 +270,14 @@ enum {
270 270
271struct mlx4_wqe_ctrl_seg { 271struct mlx4_wqe_ctrl_seg {
272 __be32 owner_opcode; 272 __be32 owner_opcode;
273 __be16 vlan_tag; 273 union {
274 u8 ins_vlan; 274 struct {
275 u8 fence_size; 275 __be16 vlan_tag;
276 u8 ins_vlan;
277 u8 fence_size;
278 };
279 __be32 bf_qpn;
280 };
276 /* 281 /*
277 * High 24 bits are SRC remote buffer; low 8 bits are flags: 282 * High 24 bits are SRC remote buffer; low 8 bits are flags:
278 * [7] SO (strong ordering) 283 * [7] SO (strong ordering)
diff --git a/include/linux/mmc/sdio_ids.h b/include/linux/mmc/sdio_ids.h
index d8836623f36a..0f01fe065424 100644
--- a/include/linux/mmc/sdio_ids.h
+++ b/include/linux/mmc/sdio_ids.h
@@ -31,6 +31,7 @@
31#define SDIO_DEVICE_ID_BROADCOM_4334 0x4334 31#define SDIO_DEVICE_ID_BROADCOM_4334 0x4334
32#define SDIO_DEVICE_ID_BROADCOM_4335_4339 0x4335 32#define SDIO_DEVICE_ID_BROADCOM_4335_4339 0x4335
33#define SDIO_DEVICE_ID_BROADCOM_43362 43362 33#define SDIO_DEVICE_ID_BROADCOM_43362 43362
34#define SDIO_DEVICE_ID_BROADCOM_4354 0x4354
34 35
35#define SDIO_VENDOR_ID_INTEL 0x0089 36#define SDIO_VENDOR_ID_INTEL 0x0089
36#define SDIO_DEVICE_ID_INTEL_IWMC3200WIMAX 0x1402 37#define SDIO_DEVICE_ID_INTEL_IWMC3200WIMAX 0x1402
diff --git a/include/linux/mpls.h b/include/linux/mpls.h
new file mode 100644
index 000000000000..9999145bc190
--- /dev/null
+++ b/include/linux/mpls.h
@@ -0,0 +1,6 @@
1#ifndef _LINUX_MPLS_H
2#define _LINUX_MPLS_H
3
4#include <uapi/linux/mpls.h>
5
6#endif /* _LINUX_MPLS_H */
diff --git a/include/linux/netdevice.h b/include/linux/netdevice.h
index daafd9561cbc..775cc956ff78 100644
--- a/include/linux/netdevice.h
+++ b/include/linux/netdevice.h
@@ -63,13 +63,6 @@ struct wireless_dev;
63void netdev_set_default_ethtool_ops(struct net_device *dev, 63void netdev_set_default_ethtool_ops(struct net_device *dev,
64 const struct ethtool_ops *ops); 64 const struct ethtool_ops *ops);
65 65
66/* hardware address assignment types */
67#define NET_ADDR_PERM 0 /* address is permanent (default) */
68#define NET_ADDR_RANDOM 1 /* address is generated randomly */
69#define NET_ADDR_STOLEN 2 /* address is stolen from other device */
70#define NET_ADDR_SET 3 /* address is set using
71 * dev_set_mac_address() */
72
73/* Backlog congestion levels */ 66/* Backlog congestion levels */
74#define NET_RX_SUCCESS 0 /* keep 'em coming, baby */ 67#define NET_RX_SUCCESS 0 /* keep 'em coming, baby */
75#define NET_RX_DROP 1 /* packet dropped */ 68#define NET_RX_DROP 1 /* packet dropped */
@@ -1037,8 +1030,7 @@ struct net_device_ops {
1037#ifdef CONFIG_NET_POLL_CONTROLLER 1030#ifdef CONFIG_NET_POLL_CONTROLLER
1038 void (*ndo_poll_controller)(struct net_device *dev); 1031 void (*ndo_poll_controller)(struct net_device *dev);
1039 int (*ndo_netpoll_setup)(struct net_device *dev, 1032 int (*ndo_netpoll_setup)(struct net_device *dev,
1040 struct netpoll_info *info, 1033 struct netpoll_info *info);
1041 gfp_t gfp);
1042 void (*ndo_netpoll_cleanup)(struct net_device *dev); 1034 void (*ndo_netpoll_cleanup)(struct net_device *dev);
1043#endif 1035#endif
1044#ifdef CONFIG_NET_RX_BUSY_POLL 1036#ifdef CONFIG_NET_RX_BUSY_POLL
@@ -1147,6 +1139,89 @@ struct net_device_ops {
1147 void *priv); 1139 void *priv);
1148}; 1140};
1149 1141
1142/**
1143 * enum net_device_priv_flags - &struct net_device priv_flags
1144 *
1145 * These are the &struct net_device, they are only set internally
1146 * by drivers and used in the kernel. These flags are invisible to
1147 * userspace, this means that the order of these flags can change
1148 * during any kernel release.
1149 *
1150 * You should have a pretty good reason to be extending these flags.
1151 *
1152 * @IFF_802_1Q_VLAN: 802.1Q VLAN device
1153 * @IFF_EBRIDGE: Ethernet bridging device
1154 * @IFF_SLAVE_INACTIVE: bonding slave not the curr. active
1155 * @IFF_MASTER_8023AD: bonding master, 802.3ad
1156 * @IFF_MASTER_ALB: bonding master, balance-alb
1157 * @IFF_BONDING: bonding master or slave
1158 * @IFF_SLAVE_NEEDARP: need ARPs for validation
1159 * @IFF_ISATAP: ISATAP interface (RFC4214)
1160 * @IFF_MASTER_ARPMON: bonding master, ARP mon in use
1161 * @IFF_WAN_HDLC: WAN HDLC device
1162 * @IFF_XMIT_DST_RELEASE: dev_hard_start_xmit() is allowed to
1163 * release skb->dst
1164 * @IFF_DONT_BRIDGE: disallow bridging this ether dev
1165 * @IFF_DISABLE_NETPOLL: disable netpoll at run-time
1166 * @IFF_MACVLAN_PORT: device used as macvlan port
1167 * @IFF_BRIDGE_PORT: device used as bridge port
1168 * @IFF_OVS_DATAPATH: device used as Open vSwitch datapath port
1169 * @IFF_TX_SKB_SHARING: The interface supports sharing skbs on transmit
1170 * @IFF_UNICAST_FLT: Supports unicast filtering
1171 * @IFF_TEAM_PORT: device used as team port
1172 * @IFF_SUPP_NOFCS: device supports sending custom FCS
1173 * @IFF_LIVE_ADDR_CHANGE: device supports hardware address
1174 * change when it's running
1175 * @IFF_MACVLAN: Macvlan device
1176 */
1177enum netdev_priv_flags {
1178 IFF_802_1Q_VLAN = 1<<0,
1179 IFF_EBRIDGE = 1<<1,
1180 IFF_SLAVE_INACTIVE = 1<<2,
1181 IFF_MASTER_8023AD = 1<<3,
1182 IFF_MASTER_ALB = 1<<4,
1183 IFF_BONDING = 1<<5,
1184 IFF_SLAVE_NEEDARP = 1<<6,
1185 IFF_ISATAP = 1<<7,
1186 IFF_MASTER_ARPMON = 1<<8,
1187 IFF_WAN_HDLC = 1<<9,
1188 IFF_XMIT_DST_RELEASE = 1<<10,
1189 IFF_DONT_BRIDGE = 1<<11,
1190 IFF_DISABLE_NETPOLL = 1<<12,
1191 IFF_MACVLAN_PORT = 1<<13,
1192 IFF_BRIDGE_PORT = 1<<14,
1193 IFF_OVS_DATAPATH = 1<<15,
1194 IFF_TX_SKB_SHARING = 1<<16,
1195 IFF_UNICAST_FLT = 1<<17,
1196 IFF_TEAM_PORT = 1<<18,
1197 IFF_SUPP_NOFCS = 1<<19,
1198 IFF_LIVE_ADDR_CHANGE = 1<<20,
1199 IFF_MACVLAN = 1<<21,
1200};
1201
1202#define IFF_802_1Q_VLAN IFF_802_1Q_VLAN
1203#define IFF_EBRIDGE IFF_EBRIDGE
1204#define IFF_SLAVE_INACTIVE IFF_SLAVE_INACTIVE
1205#define IFF_MASTER_8023AD IFF_MASTER_8023AD
1206#define IFF_MASTER_ALB IFF_MASTER_ALB
1207#define IFF_BONDING IFF_BONDING
1208#define IFF_SLAVE_NEEDARP IFF_SLAVE_NEEDARP
1209#define IFF_ISATAP IFF_ISATAP
1210#define IFF_MASTER_ARPMON IFF_MASTER_ARPMON
1211#define IFF_WAN_HDLC IFF_WAN_HDLC
1212#define IFF_XMIT_DST_RELEASE IFF_XMIT_DST_RELEASE
1213#define IFF_DONT_BRIDGE IFF_DONT_BRIDGE
1214#define IFF_DISABLE_NETPOLL IFF_DISABLE_NETPOLL
1215#define IFF_MACVLAN_PORT IFF_MACVLAN_PORT
1216#define IFF_BRIDGE_PORT IFF_BRIDGE_PORT
1217#define IFF_OVS_DATAPATH IFF_OVS_DATAPATH
1218#define IFF_TX_SKB_SHARING IFF_TX_SKB_SHARING
1219#define IFF_UNICAST_FLT IFF_UNICAST_FLT
1220#define IFF_TEAM_PORT IFF_TEAM_PORT
1221#define IFF_SUPP_NOFCS IFF_SUPP_NOFCS
1222#define IFF_LIVE_ADDR_CHANGE IFF_LIVE_ADDR_CHANGE
1223#define IFF_MACVLAN IFF_MACVLAN
1224
1150/* 1225/*
1151 * The DEVICE structure. 1226 * The DEVICE structure.
1152 * Actually, this whole structure is a big mistake. It mixes I/O 1227 * Actually, this whole structure is a big mistake. It mixes I/O
@@ -1228,9 +1303,13 @@ struct net_device {
1228 int iflink; 1303 int iflink;
1229 1304
1230 struct net_device_stats stats; 1305 struct net_device_stats stats;
1231 atomic_long_t rx_dropped; /* dropped packets by core network 1306
1232 * Do not use this in drivers. 1307 /* dropped packets by core network, Do not use this in drivers */
1233 */ 1308 atomic_long_t rx_dropped;
1309 atomic_long_t tx_dropped;
1310
1311 /* Stats to monitor carrier on<->off transitions */
1312 atomic_t carrier_changes;
1234 1313
1235#ifdef CONFIG_WIRELESS_EXT 1314#ifdef CONFIG_WIRELESS_EXT
1236 /* List of functions to handle Wireless Extensions (instead of ioctl). 1315 /* List of functions to handle Wireless Extensions (instead of ioctl).
@@ -1279,6 +1358,10 @@ struct net_device {
1279 * that share the same link 1358 * that share the same link
1280 * layer address 1359 * layer address
1281 */ 1360 */
1361 unsigned short dev_port; /* Used to differentiate
1362 * devices that share the same
1363 * function
1364 */
1282 spinlock_t addr_list_lock; 1365 spinlock_t addr_list_lock;
1283 struct netdev_hw_addr_list uc; /* Unicast mac addresses */ 1366 struct netdev_hw_addr_list uc; /* Unicast mac addresses */
1284 struct netdev_hw_addr_list mc; /* Multicast mac addresses */ 1367 struct netdev_hw_addr_list mc; /* Multicast mac addresses */
@@ -1316,13 +1399,7 @@ struct net_device {
1316/* 1399/*
1317 * Cache lines mostly used on receive path (including eth_type_trans()) 1400 * Cache lines mostly used on receive path (including eth_type_trans())
1318 */ 1401 */
1319 unsigned long last_rx; /* Time of last Rx 1402 unsigned long last_rx; /* Time of last Rx */
1320 * This should not be set in
1321 * drivers, unless really needed,
1322 * because network stack (bonding)
1323 * use it if/when necessary, to
1324 * avoid dirtying this cache line.
1325 */
1326 1403
1327 /* Interface address info used in eth_type_trans() */ 1404 /* Interface address info used in eth_type_trans() */
1328 unsigned char *dev_addr; /* hw address, (before bcast 1405 unsigned char *dev_addr; /* hw address, (before bcast
@@ -1729,6 +1806,20 @@ struct pcpu_sw_netstats {
1729 struct u64_stats_sync syncp; 1806 struct u64_stats_sync syncp;
1730}; 1807};
1731 1808
1809#define netdev_alloc_pcpu_stats(type) \
1810({ \
1811 typeof(type) __percpu *pcpu_stats = alloc_percpu(type); \
1812 if (pcpu_stats) { \
1813 int i; \
1814 for_each_possible_cpu(i) { \
1815 typeof(type) *stat; \
1816 stat = per_cpu_ptr(pcpu_stats, i); \
1817 u64_stats_init(&stat->syncp); \
1818 } \
1819 } \
1820 pcpu_stats; \
1821})
1822
1732#include <linux/notifier.h> 1823#include <linux/notifier.h>
1733 1824
1734/* netdevice notifier chain. Please remember to update the rtnetlink 1825/* netdevice notifier chain. Please remember to update the rtnetlink
@@ -1884,9 +1975,6 @@ struct net_device *__dev_get_by_index(struct net *net, int ifindex);
1884struct net_device *dev_get_by_index_rcu(struct net *net, int ifindex); 1975struct net_device *dev_get_by_index_rcu(struct net *net, int ifindex);
1885int netdev_get_name(struct net *net, char *name, int ifindex); 1976int netdev_get_name(struct net *net, char *name, int ifindex);
1886int dev_restart(struct net_device *dev); 1977int dev_restart(struct net_device *dev);
1887#ifdef CONFIG_NETPOLL_TRAP
1888int netpoll_trap(void);
1889#endif
1890int skb_gro_receive(struct sk_buff **head, struct sk_buff *skb); 1978int skb_gro_receive(struct sk_buff **head, struct sk_buff *skb);
1891 1979
1892static inline unsigned int skb_gro_offset(const struct sk_buff *skb) 1980static inline unsigned int skb_gro_offset(const struct sk_buff *skb)
@@ -1926,11 +2014,6 @@ static inline void *skb_gro_header_slow(struct sk_buff *skb, unsigned int hlen,
1926 return skb->data + offset; 2014 return skb->data + offset;
1927} 2015}
1928 2016
1929static inline void *skb_gro_mac_header(struct sk_buff *skb)
1930{
1931 return NAPI_GRO_CB(skb)->frag0 ?: skb_mac_header(skb);
1932}
1933
1934static inline void *skb_gro_network_header(struct sk_buff *skb) 2017static inline void *skb_gro_network_header(struct sk_buff *skb)
1935{ 2018{
1936 return (NAPI_GRO_CB(skb)->frag0 ?: skb->data) + 2019 return (NAPI_GRO_CB(skb)->frag0 ?: skb->data) +
@@ -2091,12 +2174,6 @@ static inline void netif_tx_start_all_queues(struct net_device *dev)
2091 2174
2092static inline void netif_tx_wake_queue(struct netdev_queue *dev_queue) 2175static inline void netif_tx_wake_queue(struct netdev_queue *dev_queue)
2093{ 2176{
2094#ifdef CONFIG_NETPOLL_TRAP
2095 if (netpoll_trap()) {
2096 netif_tx_start_queue(dev_queue);
2097 return;
2098 }
2099#endif
2100 if (test_and_clear_bit(__QUEUE_STATE_DRV_XOFF, &dev_queue->state)) 2177 if (test_and_clear_bit(__QUEUE_STATE_DRV_XOFF, &dev_queue->state))
2101 __netif_schedule(dev_queue->qdisc); 2178 __netif_schedule(dev_queue->qdisc);
2102} 2179}
@@ -2340,10 +2417,6 @@ static inline void netif_start_subqueue(struct net_device *dev, u16 queue_index)
2340static inline void netif_stop_subqueue(struct net_device *dev, u16 queue_index) 2417static inline void netif_stop_subqueue(struct net_device *dev, u16 queue_index)
2341{ 2418{
2342 struct netdev_queue *txq = netdev_get_tx_queue(dev, queue_index); 2419 struct netdev_queue *txq = netdev_get_tx_queue(dev, queue_index);
2343#ifdef CONFIG_NETPOLL_TRAP
2344 if (netpoll_trap())
2345 return;
2346#endif
2347 netif_tx_stop_queue(txq); 2420 netif_tx_stop_queue(txq);
2348} 2421}
2349 2422
@@ -2378,10 +2451,6 @@ static inline bool netif_subqueue_stopped(const struct net_device *dev,
2378static inline void netif_wake_subqueue(struct net_device *dev, u16 queue_index) 2451static inline void netif_wake_subqueue(struct net_device *dev, u16 queue_index)
2379{ 2452{
2380 struct netdev_queue *txq = netdev_get_tx_queue(dev, queue_index); 2453 struct netdev_queue *txq = netdev_get_tx_queue(dev, queue_index);
2381#ifdef CONFIG_NETPOLL_TRAP
2382 if (netpoll_trap())
2383 return;
2384#endif
2385 if (test_and_clear_bit(__QUEUE_STATE_DRV_XOFF, &txq->state)) 2454 if (test_and_clear_bit(__QUEUE_STATE_DRV_XOFF, &txq->state))
2386 __netif_schedule(txq->qdisc); 2455 __netif_schedule(txq->qdisc);
2387} 2456}
@@ -2551,6 +2620,7 @@ int dev_get_phys_port_id(struct net_device *dev,
2551int dev_hard_start_xmit(struct sk_buff *skb, struct net_device *dev, 2620int dev_hard_start_xmit(struct sk_buff *skb, struct net_device *dev,
2552 struct netdev_queue *txq); 2621 struct netdev_queue *txq);
2553int dev_forward_skb(struct net_device *dev, struct sk_buff *skb); 2622int dev_forward_skb(struct net_device *dev, struct sk_buff *skb);
2623bool is_skb_forwardable(struct net_device *dev, struct sk_buff *skb);
2554 2624
2555extern int netdev_budget; 2625extern int netdev_budget;
2556 2626
@@ -2831,6 +2901,11 @@ static inline void netif_tx_unlock_bh(struct net_device *dev)
2831 } \ 2901 } \
2832} 2902}
2833 2903
2904#define HARD_TX_TRYLOCK(dev, txq) \
2905 (((dev->features & NETIF_F_LLTX) == 0) ? \
2906 __netif_tx_trylock(txq) : \
2907 true )
2908
2834#define HARD_TX_UNLOCK(dev, txq) { \ 2909#define HARD_TX_UNLOCK(dev, txq) { \
2835 if ((dev->features & NETIF_F_LLTX) == 0) { \ 2910 if ((dev->features & NETIF_F_LLTX) == 0) { \
2836 __netif_tx_unlock(txq); \ 2911 __netif_tx_unlock(txq); \
diff --git a/include/linux/netfilter/ipset/ip_set.h b/include/linux/netfilter/ipset/ip_set.h
index 0c7d01eae56c..96afc29184be 100644
--- a/include/linux/netfilter/ipset/ip_set.h
+++ b/include/linux/netfilter/ipset/ip_set.h
@@ -39,11 +39,13 @@ enum ip_set_feature {
39 IPSET_TYPE_NAME = (1 << IPSET_TYPE_NAME_FLAG), 39 IPSET_TYPE_NAME = (1 << IPSET_TYPE_NAME_FLAG),
40 IPSET_TYPE_IFACE_FLAG = 5, 40 IPSET_TYPE_IFACE_FLAG = 5,
41 IPSET_TYPE_IFACE = (1 << IPSET_TYPE_IFACE_FLAG), 41 IPSET_TYPE_IFACE = (1 << IPSET_TYPE_IFACE_FLAG),
42 IPSET_TYPE_NOMATCH_FLAG = 6, 42 IPSET_TYPE_MARK_FLAG = 6,
43 IPSET_TYPE_MARK = (1 << IPSET_TYPE_MARK_FLAG),
44 IPSET_TYPE_NOMATCH_FLAG = 7,
43 IPSET_TYPE_NOMATCH = (1 << IPSET_TYPE_NOMATCH_FLAG), 45 IPSET_TYPE_NOMATCH = (1 << IPSET_TYPE_NOMATCH_FLAG),
44 /* Strictly speaking not a feature, but a flag for dumping: 46 /* Strictly speaking not a feature, but a flag for dumping:
45 * this settype must be dumped last */ 47 * this settype must be dumped last */
46 IPSET_DUMP_LAST_FLAG = 7, 48 IPSET_DUMP_LAST_FLAG = 8,
47 IPSET_DUMP_LAST = (1 << IPSET_DUMP_LAST_FLAG), 49 IPSET_DUMP_LAST = (1 << IPSET_DUMP_LAST_FLAG),
48}; 50};
49 51
@@ -63,6 +65,7 @@ enum ip_set_extension {
63#define SET_WITH_TIMEOUT(s) ((s)->extensions & IPSET_EXT_TIMEOUT) 65#define SET_WITH_TIMEOUT(s) ((s)->extensions & IPSET_EXT_TIMEOUT)
64#define SET_WITH_COUNTER(s) ((s)->extensions & IPSET_EXT_COUNTER) 66#define SET_WITH_COUNTER(s) ((s)->extensions & IPSET_EXT_COUNTER)
65#define SET_WITH_COMMENT(s) ((s)->extensions & IPSET_EXT_COMMENT) 67#define SET_WITH_COMMENT(s) ((s)->extensions & IPSET_EXT_COMMENT)
68#define SET_WITH_FORCEADD(s) ((s)->flags & IPSET_CREATE_FLAG_FORCEADD)
66 69
67/* Extension id, in size order */ 70/* Extension id, in size order */
68enum ip_set_ext_id { 71enum ip_set_ext_id {
@@ -171,8 +174,6 @@ struct ip_set_type {
171 char name[IPSET_MAXNAMELEN]; 174 char name[IPSET_MAXNAMELEN];
172 /* Protocol version */ 175 /* Protocol version */
173 u8 protocol; 176 u8 protocol;
174 /* Set features to control swapping */
175 u8 features;
176 /* Set type dimension */ 177 /* Set type dimension */
177 u8 dimension; 178 u8 dimension;
178 /* 179 /*
@@ -182,6 +183,8 @@ struct ip_set_type {
182 u8 family; 183 u8 family;
183 /* Type revisions */ 184 /* Type revisions */
184 u8 revision_min, revision_max; 185 u8 revision_min, revision_max;
186 /* Set features to control swapping */
187 u16 features;
185 188
186 /* Create set */ 189 /* Create set */
187 int (*create)(struct net *net, struct ip_set *set, 190 int (*create)(struct net *net, struct ip_set *set,
@@ -217,6 +220,8 @@ struct ip_set {
217 u8 revision; 220 u8 revision;
218 /* Extensions */ 221 /* Extensions */
219 u8 extensions; 222 u8 extensions;
223 /* Create flags */
224 u8 flags;
220 /* Default timeout value, if enabled */ 225 /* Default timeout value, if enabled */
221 u32 timeout; 226 u32 timeout;
222 /* Element data size */ 227 /* Element data size */
@@ -251,6 +256,8 @@ ip_set_put_flags(struct sk_buff *skb, struct ip_set *set)
251 cadt_flags |= IPSET_FLAG_WITH_COUNTERS; 256 cadt_flags |= IPSET_FLAG_WITH_COUNTERS;
252 if (SET_WITH_COMMENT(set)) 257 if (SET_WITH_COMMENT(set))
253 cadt_flags |= IPSET_FLAG_WITH_COMMENT; 258 cadt_flags |= IPSET_FLAG_WITH_COMMENT;
259 if (SET_WITH_FORCEADD(set))
260 cadt_flags |= IPSET_FLAG_WITH_FORCEADD;
254 261
255 if (!cadt_flags) 262 if (!cadt_flags)
256 return 0; 263 return 0;
diff --git a/include/linux/netfilter/nfnetlink.h b/include/linux/netfilter/nfnetlink.h
index 28c74367e900..e955d4730625 100644
--- a/include/linux/netfilter/nfnetlink.h
+++ b/include/linux/netfilter/nfnetlink.h
@@ -44,6 +44,27 @@ int nfnetlink_unicast(struct sk_buff *skb, struct net *net, u32 portid,
44 44
45void nfnl_lock(__u8 subsys_id); 45void nfnl_lock(__u8 subsys_id);
46void nfnl_unlock(__u8 subsys_id); 46void nfnl_unlock(__u8 subsys_id);
47#ifdef CONFIG_PROVE_LOCKING
48int lockdep_nfnl_is_held(__u8 subsys_id);
49#else
50static inline int lockdep_nfnl_is_held(__u8 subsys_id)
51{
52 return 1;
53}
54#endif /* CONFIG_PROVE_LOCKING */
55
56/*
57 * nfnl_dereference - fetch RCU pointer when updates are prevented by subsys mutex
58 *
59 * @p: The pointer to read, prior to dereferencing
60 * @ss: The nfnetlink subsystem ID
61 *
62 * Return the value of the specified RCU-protected pointer, but omit
63 * both the smp_read_barrier_depends() and the ACCESS_ONCE(), because
64 * caller holds the NFNL subsystem mutex.
65 */
66#define nfnl_dereference(p, ss) \
67 rcu_dereference_protected(p, lockdep_nfnl_is_held(ss))
47 68
48#define MODULE_ALIAS_NFNL_SUBSYS(subsys) \ 69#define MODULE_ALIAS_NFNL_SUBSYS(subsys) \
49 MODULE_ALIAS("nfnetlink-subsys-" __stringify(subsys)) 70 MODULE_ALIAS("nfnetlink-subsys-" __stringify(subsys))
diff --git a/include/linux/netpoll.h b/include/linux/netpoll.h
index fbfdb9d8d3a7..b25ee9ffdbe6 100644
--- a/include/linux/netpoll.h
+++ b/include/linux/netpoll.h
@@ -24,27 +24,20 @@ struct netpoll {
24 struct net_device *dev; 24 struct net_device *dev;
25 char dev_name[IFNAMSIZ]; 25 char dev_name[IFNAMSIZ];
26 const char *name; 26 const char *name;
27 void (*rx_skb_hook)(struct netpoll *np, int source, struct sk_buff *skb,
28 int offset, int len);
29 27
30 union inet_addr local_ip, remote_ip; 28 union inet_addr local_ip, remote_ip;
31 bool ipv6; 29 bool ipv6;
32 u16 local_port, remote_port; 30 u16 local_port, remote_port;
33 u8 remote_mac[ETH_ALEN]; 31 u8 remote_mac[ETH_ALEN];
34 32
35 struct list_head rx; /* rx_np list element */
36 struct work_struct cleanup_work; 33 struct work_struct cleanup_work;
37}; 34};
38 35
39struct netpoll_info { 36struct netpoll_info {
40 atomic_t refcnt; 37 atomic_t refcnt;
41 38
42 unsigned long rx_flags;
43 spinlock_t rx_lock;
44 struct semaphore dev_lock; 39 struct semaphore dev_lock;
45 struct list_head rx_np; /* netpolls that registered an rx_skb_hook */
46 40
47 struct sk_buff_head neigh_tx; /* list of neigh requests to reply to */
48 struct sk_buff_head txq; 41 struct sk_buff_head txq;
49 42
50 struct delayed_work tx_work; 43 struct delayed_work tx_work;
@@ -54,24 +47,21 @@ struct netpoll_info {
54}; 47};
55 48
56#ifdef CONFIG_NETPOLL 49#ifdef CONFIG_NETPOLL
57extern void netpoll_rx_disable(struct net_device *dev); 50extern void netpoll_poll_disable(struct net_device *dev);
58extern void netpoll_rx_enable(struct net_device *dev); 51extern void netpoll_poll_enable(struct net_device *dev);
59#else 52#else
60static inline void netpoll_rx_disable(struct net_device *dev) { return; } 53static inline void netpoll_poll_disable(struct net_device *dev) { return; }
61static inline void netpoll_rx_enable(struct net_device *dev) { return; } 54static inline void netpoll_poll_enable(struct net_device *dev) { return; }
62#endif 55#endif
63 56
64void netpoll_send_udp(struct netpoll *np, const char *msg, int len); 57void netpoll_send_udp(struct netpoll *np, const char *msg, int len);
65void netpoll_print_options(struct netpoll *np); 58void netpoll_print_options(struct netpoll *np);
66int netpoll_parse_options(struct netpoll *np, char *opt); 59int netpoll_parse_options(struct netpoll *np, char *opt);
67int __netpoll_setup(struct netpoll *np, struct net_device *ndev, gfp_t gfp); 60int __netpoll_setup(struct netpoll *np, struct net_device *ndev);
68int netpoll_setup(struct netpoll *np); 61int netpoll_setup(struct netpoll *np);
69int netpoll_trap(void);
70void netpoll_set_trap(int trap);
71void __netpoll_cleanup(struct netpoll *np); 62void __netpoll_cleanup(struct netpoll *np);
72void __netpoll_free_async(struct netpoll *np); 63void __netpoll_free_async(struct netpoll *np);
73void netpoll_cleanup(struct netpoll *np); 64void netpoll_cleanup(struct netpoll *np);
74int __netpoll_rx(struct sk_buff *skb, struct netpoll_info *npinfo);
75void netpoll_send_skb_on_dev(struct netpoll *np, struct sk_buff *skb, 65void netpoll_send_skb_on_dev(struct netpoll *np, struct sk_buff *skb,
76 struct net_device *dev); 66 struct net_device *dev);
77static inline void netpoll_send_skb(struct netpoll *np, struct sk_buff *skb) 67static inline void netpoll_send_skb(struct netpoll *np, struct sk_buff *skb)
@@ -82,46 +72,7 @@ static inline void netpoll_send_skb(struct netpoll *np, struct sk_buff *skb)
82 local_irq_restore(flags); 72 local_irq_restore(flags);
83} 73}
84 74
85
86
87#ifdef CONFIG_NETPOLL 75#ifdef CONFIG_NETPOLL
88static inline bool netpoll_rx_on(struct sk_buff *skb)
89{
90 struct netpoll_info *npinfo = rcu_dereference_bh(skb->dev->npinfo);
91
92 return npinfo && (!list_empty(&npinfo->rx_np) || npinfo->rx_flags);
93}
94
95static inline bool netpoll_rx(struct sk_buff *skb)
96{
97 struct netpoll_info *npinfo;
98 unsigned long flags;
99 bool ret = false;
100
101 local_irq_save(flags);
102
103 if (!netpoll_rx_on(skb))
104 goto out;
105
106 npinfo = rcu_dereference_bh(skb->dev->npinfo);
107 spin_lock(&npinfo->rx_lock);
108 /* check rx_flags again with the lock held */
109 if (npinfo->rx_flags && __netpoll_rx(skb, npinfo))
110 ret = true;
111 spin_unlock(&npinfo->rx_lock);
112
113out:
114 local_irq_restore(flags);
115 return ret;
116}
117
118static inline int netpoll_receive_skb(struct sk_buff *skb)
119{
120 if (!list_empty(&skb->dev->napi_list))
121 return netpoll_rx(skb);
122 return 0;
123}
124
125static inline void *netpoll_poll_lock(struct napi_struct *napi) 76static inline void *netpoll_poll_lock(struct napi_struct *napi)
126{ 77{
127 struct net_device *dev = napi->dev; 78 struct net_device *dev = napi->dev;
@@ -150,18 +101,6 @@ static inline bool netpoll_tx_running(struct net_device *dev)
150} 101}
151 102
152#else 103#else
153static inline bool netpoll_rx(struct sk_buff *skb)
154{
155 return false;
156}
157static inline bool netpoll_rx_on(struct sk_buff *skb)
158{
159 return false;
160}
161static inline int netpoll_receive_skb(struct sk_buff *skb)
162{
163 return 0;
164}
165static inline void *netpoll_poll_lock(struct napi_struct *napi) 104static inline void *netpoll_poll_lock(struct napi_struct *napi)
166{ 105{
167 return NULL; 106 return NULL;
diff --git a/include/linux/nl802154.h b/include/linux/nl802154.h
index fd4f2d1cdf6c..c8d7f3965fff 100644
--- a/include/linux/nl802154.h
+++ b/include/linux/nl802154.h
@@ -70,6 +70,16 @@ enum {
70 IEEE802154_ATTR_PHY_NAME, 70 IEEE802154_ATTR_PHY_NAME,
71 IEEE802154_ATTR_DEV_TYPE, 71 IEEE802154_ATTR_DEV_TYPE,
72 72
73 IEEE802154_ATTR_TXPOWER,
74 IEEE802154_ATTR_LBT_ENABLED,
75 IEEE802154_ATTR_CCA_MODE,
76 IEEE802154_ATTR_CCA_ED_LEVEL,
77 IEEE802154_ATTR_CSMA_RETRIES,
78 IEEE802154_ATTR_CSMA_MIN_BE,
79 IEEE802154_ATTR_CSMA_MAX_BE,
80
81 IEEE802154_ATTR_FRAME_RETRIES,
82
73 __IEEE802154_ATTR_MAX, 83 __IEEE802154_ATTR_MAX,
74}; 84};
75 85
@@ -122,6 +132,8 @@ enum {
122 IEEE802154_ADD_IFACE, 132 IEEE802154_ADD_IFACE,
123 IEEE802154_DEL_IFACE, 133 IEEE802154_DEL_IFACE,
124 134
135 IEEE802154_SET_MACPARAMS,
136
125 __IEEE802154_CMD_MAX, 137 __IEEE802154_CMD_MAX,
126}; 138};
127 139
diff --git a/include/linux/phy.h b/include/linux/phy.h
index 565188ca328f..24126c4b27b5 100644
--- a/include/linux/phy.h
+++ b/include/linux/phy.h
@@ -74,8 +74,53 @@ typedef enum {
74 PHY_INTERFACE_MODE_RTBI, 74 PHY_INTERFACE_MODE_RTBI,
75 PHY_INTERFACE_MODE_SMII, 75 PHY_INTERFACE_MODE_SMII,
76 PHY_INTERFACE_MODE_XGMII, 76 PHY_INTERFACE_MODE_XGMII,
77 PHY_INTERFACE_MODE_MOCA,
78 PHY_INTERFACE_MODE_MAX,
77} phy_interface_t; 79} phy_interface_t;
78 80
81/**
82 * It maps 'enum phy_interface_t' found in include/linux/phy.h
83 * into the device tree binding of 'phy-mode', so that Ethernet
84 * device driver can get phy interface from device tree.
85 */
86static inline const char *phy_modes(phy_interface_t interface)
87{
88 switch (interface) {
89 case PHY_INTERFACE_MODE_NA:
90 return "";
91 case PHY_INTERFACE_MODE_MII:
92 return "mii";
93 case PHY_INTERFACE_MODE_GMII:
94 return "gmii";
95 case PHY_INTERFACE_MODE_SGMII:
96 return "sgmii";
97 case PHY_INTERFACE_MODE_TBI:
98 return "tbi";
99 case PHY_INTERFACE_MODE_REVMII:
100 return "rev-mii";
101 case PHY_INTERFACE_MODE_RMII:
102 return "rmii";
103 case PHY_INTERFACE_MODE_RGMII:
104 return "rgmii";
105 case PHY_INTERFACE_MODE_RGMII_ID:
106 return "rgmii-id";
107 case PHY_INTERFACE_MODE_RGMII_RXID:
108 return "rgmii-rxid";
109 case PHY_INTERFACE_MODE_RGMII_TXID:
110 return "rgmii-txid";
111 case PHY_INTERFACE_MODE_RTBI:
112 return "rtbi";
113 case PHY_INTERFACE_MODE_SMII:
114 return "smii";
115 case PHY_INTERFACE_MODE_XGMII:
116 return "xgmii";
117 case PHY_INTERFACE_MODE_MOCA:
118 return "moca";
119 default:
120 return "unknown";
121 }
122}
123
79 124
80#define PHY_INIT_TIMEOUT 100000 125#define PHY_INIT_TIMEOUT 100000
81#define PHY_STATE_TIME 1 126#define PHY_STATE_TIME 1
@@ -308,6 +353,7 @@ struct phy_device {
308 struct phy_c45_device_ids c45_ids; 353 struct phy_c45_device_ids c45_ids;
309 bool is_c45; 354 bool is_c45;
310 bool is_internal; 355 bool is_internal;
356 bool has_fixups;
311 357
312 enum phy_state state; 358 enum phy_state state;
313 359
@@ -394,6 +440,11 @@ struct phy_driver {
394 u32 flags; 440 u32 flags;
395 441
396 /* 442 /*
443 * Called to issue a PHY software reset
444 */
445 int (*soft_reset)(struct phy_device *phydev);
446
447 /*
397 * Called to initialize the PHY, 448 * Called to initialize the PHY,
398 * including after a reset 449 * including after a reset
399 */ 450 */
@@ -417,6 +468,9 @@ struct phy_driver {
417 */ 468 */
418 int (*config_aneg)(struct phy_device *phydev); 469 int (*config_aneg)(struct phy_device *phydev);
419 470
471 /* Determines the auto negotiation result */
472 int (*aneg_done)(struct phy_device *phydev);
473
420 /* Determines the negotiated speed and duplex */ 474 /* Determines the negotiated speed and duplex */
421 int (*read_status)(struct phy_device *phydev); 475 int (*read_status)(struct phy_device *phydev);
422 476
@@ -612,10 +666,12 @@ static inline int phy_read_status(struct phy_device *phydev)
612int genphy_setup_forced(struct phy_device *phydev); 666int genphy_setup_forced(struct phy_device *phydev);
613int genphy_restart_aneg(struct phy_device *phydev); 667int genphy_restart_aneg(struct phy_device *phydev);
614int genphy_config_aneg(struct phy_device *phydev); 668int genphy_config_aneg(struct phy_device *phydev);
669int genphy_aneg_done(struct phy_device *phydev);
615int genphy_update_link(struct phy_device *phydev); 670int genphy_update_link(struct phy_device *phydev);
616int genphy_read_status(struct phy_device *phydev); 671int genphy_read_status(struct phy_device *phydev);
617int genphy_suspend(struct phy_device *phydev); 672int genphy_suspend(struct phy_device *phydev);
618int genphy_resume(struct phy_device *phydev); 673int genphy_resume(struct phy_device *phydev);
674int genphy_soft_reset(struct phy_device *phydev);
619void phy_driver_unregister(struct phy_driver *drv); 675void phy_driver_unregister(struct phy_driver *drv);
620void phy_drivers_unregister(struct phy_driver *drv, int n); 676void phy_drivers_unregister(struct phy_driver *drv, int n);
621int phy_driver_register(struct phy_driver *new_driver); 677int phy_driver_register(struct phy_driver *new_driver);
diff --git a/include/linux/ptp_classify.h b/include/linux/ptp_classify.h
index 1dc420ba213a..7dfed71d76a6 100644
--- a/include/linux/ptp_classify.h
+++ b/include/linux/ptp_classify.h
@@ -23,15 +23,8 @@
23#ifndef _PTP_CLASSIFY_H_ 23#ifndef _PTP_CLASSIFY_H_
24#define _PTP_CLASSIFY_H_ 24#define _PTP_CLASSIFY_H_
25 25
26#include <linux/if_ether.h>
27#include <linux/if_vlan.h>
28#include <linux/ip.h> 26#include <linux/ip.h>
29#include <linux/filter.h> 27#include <linux/skbuff.h>
30#ifdef __KERNEL__
31#include <linux/in.h>
32#else
33#include <netinet/in.h>
34#endif
35 28
36#define PTP_CLASS_NONE 0x00 /* not a PTP event message */ 29#define PTP_CLASS_NONE 0x00 /* not a PTP event message */
37#define PTP_CLASS_V1 0x01 /* protocol version 1 */ 30#define PTP_CLASS_V1 0x01 /* protocol version 1 */
@@ -44,7 +37,7 @@
44#define PTP_CLASS_PMASK 0xf0 /* mask for the packet type field */ 37#define PTP_CLASS_PMASK 0xf0 /* mask for the packet type field */
45 38
46#define PTP_CLASS_V1_IPV4 (PTP_CLASS_V1 | PTP_CLASS_IPV4) 39#define PTP_CLASS_V1_IPV4 (PTP_CLASS_V1 | PTP_CLASS_IPV4)
47#define PTP_CLASS_V1_IPV6 (PTP_CLASS_V1 | PTP_CLASS_IPV6) /*probably DNE*/ 40#define PTP_CLASS_V1_IPV6 (PTP_CLASS_V1 | PTP_CLASS_IPV6) /* probably DNE */
48#define PTP_CLASS_V2_IPV4 (PTP_CLASS_V2 | PTP_CLASS_IPV4) 41#define PTP_CLASS_V2_IPV4 (PTP_CLASS_V2 | PTP_CLASS_IPV4)
49#define PTP_CLASS_V2_IPV6 (PTP_CLASS_V2 | PTP_CLASS_IPV6) 42#define PTP_CLASS_V2_IPV6 (PTP_CLASS_V2 | PTP_CLASS_IPV6)
50#define PTP_CLASS_V2_L2 (PTP_CLASS_V2 | PTP_CLASS_L2) 43#define PTP_CLASS_V2_L2 (PTP_CLASS_V2 | PTP_CLASS_L2)
@@ -53,88 +46,34 @@
53#define PTP_EV_PORT 319 46#define PTP_EV_PORT 319
54#define PTP_GEN_BIT 0x08 /* indicates general message, if set in message type */ 47#define PTP_GEN_BIT 0x08 /* indicates general message, if set in message type */
55 48
56#define OFF_ETYPE 12
57#define OFF_IHL 14
58#define OFF_FRAG 20
59#define OFF_PROTO4 23
60#define OFF_NEXT 6
61#define OFF_UDP_DST 2
62
63#define OFF_PTP_SOURCE_UUID 22 /* PTPv1 only */ 49#define OFF_PTP_SOURCE_UUID 22 /* PTPv1 only */
64#define OFF_PTP_SEQUENCE_ID 30 50#define OFF_PTP_SEQUENCE_ID 30
65#define OFF_PTP_CONTROL 32 /* PTPv1 only */ 51#define OFF_PTP_CONTROL 32 /* PTPv1 only */
66 52
67#define IPV4_HLEN(data) (((struct iphdr *)(data + OFF_IHL))->ihl << 2) 53/* Below defines should actually be removed at some point in time. */
68
69#define IP6_HLEN 40 54#define IP6_HLEN 40
70#define UDP_HLEN 8 55#define UDP_HLEN 8
71 56#define OFF_IHL 14
72#define RELOFF_DST4 (ETH_HLEN + OFF_UDP_DST)
73#define OFF_DST6 (ETH_HLEN + IP6_HLEN + OFF_UDP_DST)
74#define OFF_PTP6 (ETH_HLEN + IP6_HLEN + UDP_HLEN) 57#define OFF_PTP6 (ETH_HLEN + IP6_HLEN + UDP_HLEN)
58#define IPV4_HLEN(data) (((struct iphdr *)(data + OFF_IHL))->ihl << 2)
75 59
76#define OP_AND (BPF_ALU | BPF_AND | BPF_K) 60#if defined(CONFIG_NET_PTP_CLASSIFY)
77#define OP_JEQ (BPF_JMP | BPF_JEQ | BPF_K) 61/**
78#define OP_JSET (BPF_JMP | BPF_JSET | BPF_K) 62 * ptp_classify_raw - classify a PTP packet
79#define OP_LDB (BPF_LD | BPF_B | BPF_ABS) 63 * @skb: buffer
80#define OP_LDH (BPF_LD | BPF_H | BPF_ABS) 64 *
81#define OP_LDHI (BPF_LD | BPF_H | BPF_IND) 65 * Runs a minimal BPF dissector to classify a network packet to
82#define OP_LDX (BPF_LDX | BPF_B | BPF_MSH) 66 * determine the PTP class. In case the skb does not contain any
83#define OP_OR (BPF_ALU | BPF_OR | BPF_K) 67 * PTP protocol data, PTP_CLASS_NONE will be returned, otherwise
84#define OP_RETA (BPF_RET | BPF_A) 68 * PTP_CLASS_V1_IPV{4,6}, PTP_CLASS_V2_IPV{4,6} or
85#define OP_RETK (BPF_RET | BPF_K) 69 * PTP_CLASS_V2_{L2,VLAN}, depending on the packet content.
70 */
71unsigned int ptp_classify_raw(const struct sk_buff *skb);
86 72
87static inline int ptp_filter_init(struct sock_filter *f, int len) 73void __init ptp_classifier_init(void);
74#else
75static inline void ptp_classifier_init(void)
88{ 76{
89 if (OP_LDH == f[0].code)
90 return sk_chk_filter(f, len);
91 else
92 return 0;
93} 77}
94
95#define PTP_FILTER \
96 {OP_LDH, 0, 0, OFF_ETYPE }, /* */ \
97 {OP_JEQ, 0, 12, ETH_P_IP }, /* f goto L20 */ \
98 {OP_LDB, 0, 0, OFF_PROTO4 }, /* */ \
99 {OP_JEQ, 0, 9, IPPROTO_UDP }, /* f goto L10 */ \
100 {OP_LDH, 0, 0, OFF_FRAG }, /* */ \
101 {OP_JSET, 7, 0, 0x1fff }, /* t goto L11 */ \
102 {OP_LDX, 0, 0, OFF_IHL }, /* */ \
103 {OP_LDHI, 0, 0, RELOFF_DST4 }, /* */ \
104 {OP_JEQ, 0, 4, PTP_EV_PORT }, /* f goto L12 */ \
105 {OP_LDHI, 0, 0, ETH_HLEN + UDP_HLEN }, /* */ \
106 {OP_AND, 0, 0, PTP_CLASS_VMASK }, /* */ \
107 {OP_OR, 0, 0, PTP_CLASS_IPV4 }, /* */ \
108 {OP_RETA, 0, 0, 0 }, /* */ \
109/*L1x*/ {OP_RETK, 0, 0, PTP_CLASS_NONE }, /* */ \
110/*L20*/ {OP_JEQ, 0, 9, ETH_P_IPV6 }, /* f goto L40 */ \
111 {OP_LDB, 0, 0, ETH_HLEN + OFF_NEXT }, /* */ \
112 {OP_JEQ, 0, 6, IPPROTO_UDP }, /* f goto L30 */ \
113 {OP_LDH, 0, 0, OFF_DST6 }, /* */ \
114 {OP_JEQ, 0, 4, PTP_EV_PORT }, /* f goto L31 */ \
115 {OP_LDH, 0, 0, OFF_PTP6 }, /* */ \
116 {OP_AND, 0, 0, PTP_CLASS_VMASK }, /* */ \
117 {OP_OR, 0, 0, PTP_CLASS_IPV6 }, /* */ \
118 {OP_RETA, 0, 0, 0 }, /* */ \
119/*L3x*/ {OP_RETK, 0, 0, PTP_CLASS_NONE }, /* */ \
120/*L40*/ {OP_JEQ, 0, 9, ETH_P_8021Q }, /* f goto L50 */ \
121 {OP_LDH, 0, 0, OFF_ETYPE + 4 }, /* */ \
122 {OP_JEQ, 0, 15, ETH_P_1588 }, /* f goto L60 */ \
123 {OP_LDB, 0, 0, ETH_HLEN + VLAN_HLEN }, /* */ \
124 {OP_AND, 0, 0, PTP_GEN_BIT }, /* */ \
125 {OP_JEQ, 0, 12, 0 }, /* f goto L6x */ \
126 {OP_LDH, 0, 0, ETH_HLEN + VLAN_HLEN }, /* */ \
127 {OP_AND, 0, 0, PTP_CLASS_VMASK }, /* */ \
128 {OP_OR, 0, 0, PTP_CLASS_VLAN }, /* */ \
129 {OP_RETA, 0, 0, 0 }, /* */ \
130/*L50*/ {OP_JEQ, 0, 7, ETH_P_1588 }, /* f goto L61 */ \
131 {OP_LDB, 0, 0, ETH_HLEN }, /* */ \
132 {OP_AND, 0, 0, PTP_GEN_BIT }, /* */ \
133 {OP_JEQ, 0, 4, 0 }, /* f goto L6x */ \
134 {OP_LDH, 0, 0, ETH_HLEN }, /* */ \
135 {OP_AND, 0, 0, PTP_CLASS_VMASK }, /* */ \
136 {OP_OR, 0, 0, PTP_CLASS_L2 }, /* */ \
137 {OP_RETA, 0, 0, 0 }, /* */ \
138/*L6x*/ {OP_RETK, 0, 0, PTP_CLASS_NONE },
139
140#endif 78#endif
79#endif /* _PTP_CLASSIFY_H_ */
diff --git a/include/linux/ptp_clock_kernel.h b/include/linux/ptp_clock_kernel.h
index 38a993508327..0d8ff3fb84ba 100644
--- a/include/linux/ptp_clock_kernel.h
+++ b/include/linux/ptp_clock_kernel.h
@@ -49,7 +49,11 @@ struct ptp_clock_request {
49 * @n_alarm: The number of programmable alarms. 49 * @n_alarm: The number of programmable alarms.
50 * @n_ext_ts: The number of external time stamp channels. 50 * @n_ext_ts: The number of external time stamp channels.
51 * @n_per_out: The number of programmable periodic signals. 51 * @n_per_out: The number of programmable periodic signals.
52 * @n_pins: The number of programmable pins.
52 * @pps: Indicates whether the clock supports a PPS callback. 53 * @pps: Indicates whether the clock supports a PPS callback.
54 * @pin_config: Array of length 'n_pins'. If the number of
55 * programmable pins is nonzero, then drivers must
56 * allocate and initialize this array.
53 * 57 *
54 * clock operations 58 * clock operations
55 * 59 *
@@ -70,6 +74,18 @@ struct ptp_clock_request {
70 * parameter request: Desired resource to enable or disable. 74 * parameter request: Desired resource to enable or disable.
71 * parameter on: Caller passes one to enable or zero to disable. 75 * parameter on: Caller passes one to enable or zero to disable.
72 * 76 *
77 * @verify: Confirm that a pin can perform a given function. The PTP
78 * Hardware Clock subsystem maintains the 'pin_config'
79 * array on behalf of the drivers, but the PHC subsystem
80 * assumes that every pin can perform every function. This
81 * hook gives drivers a way of telling the core about
82 * limitations on specific pins. This function must return
83 * zero if the function can be assigned to this pin, and
84 * nonzero otherwise.
85 * parameter pin: index of the pin in question.
86 * parameter func: the desired function to use.
87 * parameter chan: the function channel index to use.
88 *
73 * Drivers should embed their ptp_clock_info within a private 89 * Drivers should embed their ptp_clock_info within a private
74 * structure, obtaining a reference to it using container_of(). 90 * structure, obtaining a reference to it using container_of().
75 * 91 *
@@ -83,13 +99,17 @@ struct ptp_clock_info {
83 int n_alarm; 99 int n_alarm;
84 int n_ext_ts; 100 int n_ext_ts;
85 int n_per_out; 101 int n_per_out;
102 int n_pins;
86 int pps; 103 int pps;
104 struct ptp_pin_desc *pin_config;
87 int (*adjfreq)(struct ptp_clock_info *ptp, s32 delta); 105 int (*adjfreq)(struct ptp_clock_info *ptp, s32 delta);
88 int (*adjtime)(struct ptp_clock_info *ptp, s64 delta); 106 int (*adjtime)(struct ptp_clock_info *ptp, s64 delta);
89 int (*gettime)(struct ptp_clock_info *ptp, struct timespec *ts); 107 int (*gettime)(struct ptp_clock_info *ptp, struct timespec *ts);
90 int (*settime)(struct ptp_clock_info *ptp, const struct timespec *ts); 108 int (*settime)(struct ptp_clock_info *ptp, const struct timespec *ts);
91 int (*enable)(struct ptp_clock_info *ptp, 109 int (*enable)(struct ptp_clock_info *ptp,
92 struct ptp_clock_request *request, int on); 110 struct ptp_clock_request *request, int on);
111 int (*verify)(struct ptp_clock_info *ptp, unsigned int pin,
112 enum ptp_pin_function func, unsigned int chan);
93}; 113};
94 114
95struct ptp_clock; 115struct ptp_clock;
@@ -156,4 +176,17 @@ extern void ptp_clock_event(struct ptp_clock *ptp,
156 176
157extern int ptp_clock_index(struct ptp_clock *ptp); 177extern int ptp_clock_index(struct ptp_clock *ptp);
158 178
179/**
180 * ptp_find_pin() - obtain the pin index of a given auxiliary function
181 *
182 * @ptp: The clock obtained from ptp_clock_register().
183 * @func: One of the ptp_pin_function enumerated values.
184 * @chan: The particular functional channel to find.
185 * Return: Pin index in the range of zero to ptp_clock_caps.n_pins - 1,
186 * or -1 if the auxiliary function cannot be found.
187 */
188
189int ptp_find_pin(struct ptp_clock *ptp,
190 enum ptp_pin_function func, unsigned int chan);
191
159#endif 192#endif
diff --git a/include/linux/seccomp.h b/include/linux/seccomp.h
index 6f19cfd1840e..4054b0994071 100644
--- a/include/linux/seccomp.h
+++ b/include/linux/seccomp.h
@@ -76,7 +76,6 @@ static inline int seccomp_mode(struct seccomp *s)
76#ifdef CONFIG_SECCOMP_FILTER 76#ifdef CONFIG_SECCOMP_FILTER
77extern void put_seccomp_filter(struct task_struct *tsk); 77extern void put_seccomp_filter(struct task_struct *tsk);
78extern void get_seccomp_filter(struct task_struct *tsk); 78extern void get_seccomp_filter(struct task_struct *tsk);
79extern u32 seccomp_bpf_load(int off);
80#else /* CONFIG_SECCOMP_FILTER */ 79#else /* CONFIG_SECCOMP_FILTER */
81static inline void put_seccomp_filter(struct task_struct *tsk) 80static inline void put_seccomp_filter(struct task_struct *tsk)
82{ 81{
diff --git a/include/linux/skbuff.h b/include/linux/skbuff.h
index 6b8466365fbd..08074a810164 100644
--- a/include/linux/skbuff.h
+++ b/include/linux/skbuff.h
@@ -32,6 +32,7 @@
32#include <linux/hrtimer.h> 32#include <linux/hrtimer.h>
33#include <linux/dma-mapping.h> 33#include <linux/dma-mapping.h>
34#include <linux/netdev_features.h> 34#include <linux/netdev_features.h>
35#include <linux/sched.h>
35#include <net/flow_keys.h> 36#include <net/flow_keys.h>
36 37
37/* A. Checksumming of received packets by device. 38/* A. Checksumming of received packets by device.
@@ -356,11 +357,62 @@ typedef unsigned int sk_buff_data_t;
356typedef unsigned char *sk_buff_data_t; 357typedef unsigned char *sk_buff_data_t;
357#endif 358#endif
358 359
360/**
361 * struct skb_mstamp - multi resolution time stamps
362 * @stamp_us: timestamp in us resolution
363 * @stamp_jiffies: timestamp in jiffies
364 */
365struct skb_mstamp {
366 union {
367 u64 v64;
368 struct {
369 u32 stamp_us;
370 u32 stamp_jiffies;
371 };
372 };
373};
374
375/**
376 * skb_mstamp_get - get current timestamp
377 * @cl: place to store timestamps
378 */
379static inline void skb_mstamp_get(struct skb_mstamp *cl)
380{
381 u64 val = local_clock();
382
383 do_div(val, NSEC_PER_USEC);
384 cl->stamp_us = (u32)val;
385 cl->stamp_jiffies = (u32)jiffies;
386}
387
388/**
389 * skb_mstamp_delta - compute the difference in usec between two skb_mstamp
390 * @t1: pointer to newest sample
391 * @t0: pointer to oldest sample
392 */
393static inline u32 skb_mstamp_us_delta(const struct skb_mstamp *t1,
394 const struct skb_mstamp *t0)
395{
396 s32 delta_us = t1->stamp_us - t0->stamp_us;
397 u32 delta_jiffies = t1->stamp_jiffies - t0->stamp_jiffies;
398
399 /* If delta_us is negative, this might be because interval is too big,
400 * or local_clock() drift is too big : fallback using jiffies.
401 */
402 if (delta_us <= 0 ||
403 delta_jiffies >= (INT_MAX / (USEC_PER_SEC / HZ)))
404
405 delta_us = jiffies_to_usecs(delta_jiffies);
406
407 return delta_us;
408}
409
410
359/** 411/**
360 * struct sk_buff - socket buffer 412 * struct sk_buff - socket buffer
361 * @next: Next buffer in list 413 * @next: Next buffer in list
362 * @prev: Previous buffer in list 414 * @prev: Previous buffer in list
363 * @tstamp: Time we arrived 415 * @tstamp: Time we arrived/left
364 * @sk: Socket we are owned by 416 * @sk: Socket we are owned by
365 * @dev: Device we arrived on/are leaving by 417 * @dev: Device we arrived on/are leaving by
366 * @cb: Control buffer. Free for use by every layer. Put private vars here 418 * @cb: Control buffer. Free for use by every layer. Put private vars here
@@ -392,11 +444,11 @@ typedef unsigned char *sk_buff_data_t;
392 * @skb_iif: ifindex of device we arrived on 444 * @skb_iif: ifindex of device we arrived on
393 * @tc_index: Traffic control index 445 * @tc_index: Traffic control index
394 * @tc_verd: traffic control verdict 446 * @tc_verd: traffic control verdict
395 * @rxhash: the packet hash computed on receive 447 * @hash: the packet hash
396 * @queue_mapping: Queue mapping for multiqueue devices 448 * @queue_mapping: Queue mapping for multiqueue devices
397 * @ndisc_nodetype: router type (from link layer) 449 * @ndisc_nodetype: router type (from link layer)
398 * @ooo_okay: allow the mapping of a socket to a queue to be changed 450 * @ooo_okay: allow the mapping of a socket to a queue to be changed
399 * @l4_rxhash: indicate rxhash is a canonical 4-tuple hash over transport 451 * @l4_hash: indicate hash is a canonical 4-tuple hash over transport
400 * ports. 452 * ports.
401 * @wifi_acked_valid: wifi_acked was set 453 * @wifi_acked_valid: wifi_acked was set
402 * @wifi_acked: whether frame was acked on wifi or not 454 * @wifi_acked: whether frame was acked on wifi or not
@@ -429,7 +481,10 @@ struct sk_buff {
429 struct sk_buff *next; 481 struct sk_buff *next;
430 struct sk_buff *prev; 482 struct sk_buff *prev;
431 483
432 ktime_t tstamp; 484 union {
485 ktime_t tstamp;
486 struct skb_mstamp skb_mstamp;
487 };
433 488
434 struct sock *sk; 489 struct sock *sk;
435 struct net_device *dev; 490 struct net_device *dev;
@@ -482,7 +537,7 @@ struct sk_buff {
482 537
483 int skb_iif; 538 int skb_iif;
484 539
485 __u32 rxhash; 540 __u32 hash;
486 541
487 __be16 vlan_proto; 542 __be16 vlan_proto;
488 __u16 vlan_tci; 543 __u16 vlan_tci;
@@ -501,7 +556,7 @@ struct sk_buff {
501#endif 556#endif
502 __u8 pfmemalloc:1; 557 __u8 pfmemalloc:1;
503 __u8 ooo_okay:1; 558 __u8 ooo_okay:1;
504 __u8 l4_rxhash:1; 559 __u8 l4_hash:1;
505 __u8 wifi_acked_valid:1; 560 __u8 wifi_acked_valid:1;
506 __u8 wifi_acked:1; 561 __u8 wifi_acked:1;
507 __u8 no_fcs:1; 562 __u8 no_fcs:1;
@@ -691,6 +746,8 @@ struct sk_buff *skb_realloc_headroom(struct sk_buff *skb,
691 unsigned int headroom); 746 unsigned int headroom);
692struct sk_buff *skb_copy_expand(const struct sk_buff *skb, int newheadroom, 747struct sk_buff *skb_copy_expand(const struct sk_buff *skb, int newheadroom,
693 int newtailroom, gfp_t priority); 748 int newtailroom, gfp_t priority);
749int skb_to_sgvec_nomark(struct sk_buff *skb, struct scatterlist *sg,
750 int offset, int len);
694int skb_to_sgvec(struct sk_buff *skb, struct scatterlist *sg, int offset, 751int skb_to_sgvec(struct sk_buff *skb, struct scatterlist *sg, int offset,
695 int len); 752 int len);
696int skb_cow_data(struct sk_buff *skb, int tailbits, struct sk_buff **trailer); 753int skb_cow_data(struct sk_buff *skb, int tailbits, struct sk_buff **trailer);
@@ -758,40 +815,40 @@ enum pkt_hash_types {
758static inline void 815static inline void
759skb_set_hash(struct sk_buff *skb, __u32 hash, enum pkt_hash_types type) 816skb_set_hash(struct sk_buff *skb, __u32 hash, enum pkt_hash_types type)
760{ 817{
761 skb->l4_rxhash = (type == PKT_HASH_TYPE_L4); 818 skb->l4_hash = (type == PKT_HASH_TYPE_L4);
762 skb->rxhash = hash; 819 skb->hash = hash;
763} 820}
764 821
765void __skb_get_hash(struct sk_buff *skb); 822void __skb_get_hash(struct sk_buff *skb);
766static inline __u32 skb_get_hash(struct sk_buff *skb) 823static inline __u32 skb_get_hash(struct sk_buff *skb)
767{ 824{
768 if (!skb->l4_rxhash) 825 if (!skb->l4_hash)
769 __skb_get_hash(skb); 826 __skb_get_hash(skb);
770 827
771 return skb->rxhash; 828 return skb->hash;
772} 829}
773 830
774static inline __u32 skb_get_hash_raw(const struct sk_buff *skb) 831static inline __u32 skb_get_hash_raw(const struct sk_buff *skb)
775{ 832{
776 return skb->rxhash; 833 return skb->hash;
777} 834}
778 835
779static inline void skb_clear_hash(struct sk_buff *skb) 836static inline void skb_clear_hash(struct sk_buff *skb)
780{ 837{
781 skb->rxhash = 0; 838 skb->hash = 0;
782 skb->l4_rxhash = 0; 839 skb->l4_hash = 0;
783} 840}
784 841
785static inline void skb_clear_hash_if_not_l4(struct sk_buff *skb) 842static inline void skb_clear_hash_if_not_l4(struct sk_buff *skb)
786{ 843{
787 if (!skb->l4_rxhash) 844 if (!skb->l4_hash)
788 skb_clear_hash(skb); 845 skb_clear_hash(skb);
789} 846}
790 847
791static inline void skb_copy_hash(struct sk_buff *to, const struct sk_buff *from) 848static inline void skb_copy_hash(struct sk_buff *to, const struct sk_buff *from)
792{ 849{
793 to->rxhash = from->rxhash; 850 to->hash = from->hash;
794 to->l4_rxhash = from->l4_rxhash; 851 to->l4_hash = from->l4_hash;
795}; 852};
796 853
797#ifdef NET_SKBUFF_DATA_USES_OFFSET 854#ifdef NET_SKBUFF_DATA_USES_OFFSET
@@ -2573,8 +2630,6 @@ static inline ktime_t net_invalid_timestamp(void)
2573 return ktime_set(0, 0); 2630 return ktime_set(0, 0);
2574} 2631}
2575 2632
2576void skb_timestamping_init(void);
2577
2578#ifdef CONFIG_NETWORK_PHY_TIMESTAMPING 2633#ifdef CONFIG_NETWORK_PHY_TIMESTAMPING
2579 2634
2580void skb_clone_tx_timestamp(struct sk_buff *skb); 2635void skb_clone_tx_timestamp(struct sk_buff *skb);
@@ -2776,6 +2831,19 @@ static inline void skb_init_secmark(struct sk_buff *skb)
2776{ } 2831{ }
2777#endif 2832#endif
2778 2833
2834static inline bool skb_irq_freeable(const struct sk_buff *skb)
2835{
2836 return !skb->destructor &&
2837#if IS_ENABLED(CONFIG_XFRM)
2838 !skb->sp &&
2839#endif
2840#if IS_ENABLED(CONFIG_NF_CONNTRACK)
2841 !skb->nfct &&
2842#endif
2843 !skb->_skb_refdst &&
2844 !skb_has_frag_list(skb);
2845}
2846
2779static inline void skb_set_queue_mapping(struct sk_buff *skb, u16 queue_mapping) 2847static inline void skb_set_queue_mapping(struct sk_buff *skb, u16 queue_mapping)
2780{ 2848{
2781 skb->queue_mapping = queue_mapping; 2849 skb->queue_mapping = queue_mapping;
diff --git a/include/linux/sxgbe_platform.h b/include/linux/sxgbe_platform.h
new file mode 100644
index 000000000000..a62442cf0037
--- /dev/null
+++ b/include/linux/sxgbe_platform.h
@@ -0,0 +1,54 @@
1/*
2 * 10G controller driver for Samsung EXYNOS SoCs
3 *
4 * Copyright (C) 2013 Samsung Electronics Co., Ltd.
5 * http://www.samsung.com
6 *
7 * Author: Siva Reddy Kallam <siva.kallam@samsung.com>
8 *
9 * This program is free software; you can redistribute it and/or modify
10 * it under the terms of the GNU General Public License version 2 as
11 * published by the Free Software Foundation.
12 */
13#ifndef __SXGBE_PLATFORM_H__
14#define __SXGBE_PLATFORM_H__
15
16/* MDC Clock Selection define*/
17#define SXGBE_CSR_100_150M 0x0 /* MDC = clk_scr_i/62 */
18#define SXGBE_CSR_150_250M 0x1 /* MDC = clk_scr_i/102 */
19#define SXGBE_CSR_250_300M 0x2 /* MDC = clk_scr_i/122 */
20#define SXGBE_CSR_300_350M 0x3 /* MDC = clk_scr_i/142 */
21#define SXGBE_CSR_350_400M 0x4 /* MDC = clk_scr_i/162 */
22#define SXGBE_CSR_400_500M 0x5 /* MDC = clk_scr_i/202 */
23
24/* Platfrom data for platform device structure's
25 * platform_data field
26 */
27struct sxgbe_mdio_bus_data {
28 unsigned int phy_mask;
29 int *irqs;
30 int probed_phy_irq;
31};
32
33struct sxgbe_dma_cfg {
34 int pbl;
35 int fixed_burst;
36 int burst_map;
37 int adv_addr_mode;
38};
39
40struct sxgbe_plat_data {
41 char *phy_bus_name;
42 int bus_id;
43 int phy_addr;
44 int interface;
45 struct sxgbe_mdio_bus_data *mdio_bus_data;
46 struct sxgbe_dma_cfg *dma_cfg;
47 int clk_csr;
48 int pmt;
49 int force_sf_dma_mode;
50 int force_thresh_dma_mode;
51 int riwt_off;
52};
53
54#endif /* __SXGBE_PLATFORM_H__ */
diff --git a/include/linux/tcp.h b/include/linux/tcp.h
index 4ad0706d40eb..239946868142 100644
--- a/include/linux/tcp.h
+++ b/include/linux/tcp.h
@@ -201,10 +201,10 @@ struct tcp_sock {
201 u32 tlp_high_seq; /* snd_nxt at the time of TLP retransmit. */ 201 u32 tlp_high_seq; /* snd_nxt at the time of TLP retransmit. */
202 202
203/* RTT measurement */ 203/* RTT measurement */
204 u32 srtt; /* smoothed round trip time << 3 */ 204 u32 srtt_us; /* smoothed round trip time << 3 in usecs */
205 u32 mdev; /* medium deviation */ 205 u32 mdev_us; /* medium deviation */
206 u32 mdev_max; /* maximal mdev for the last rtt period */ 206 u32 mdev_max_us; /* maximal mdev for the last rtt period */
207 u32 rttvar; /* smoothed mdev_max */ 207 u32 rttvar_us; /* smoothed mdev_max */
208 u32 rtt_seq; /* sequence number to update rttvar */ 208 u32 rtt_seq; /* sequence number to update rttvar */
209 209
210 u32 packets_out; /* Packets which are "in flight" */ 210 u32 packets_out; /* Packets which are "in flight" */
diff --git a/include/linux/tty.h b/include/linux/tty.h
index b90b5c221ff0..1c3316a47d7e 100644
--- a/include/linux/tty.h
+++ b/include/linux/tty.h
@@ -518,9 +518,9 @@ extern void tty_port_put(struct tty_port *port);
518 518
519static inline struct tty_port *tty_port_get(struct tty_port *port) 519static inline struct tty_port *tty_port_get(struct tty_port *port)
520{ 520{
521 if (port) 521 if (port && kref_get_unless_zero(&port->kref))
522 kref_get(&port->kref); 522 return port;
523 return port; 523 return NULL;
524} 524}
525 525
526/* If the cts flow control is enabled, return true. */ 526/* If the cts flow control is enabled, return true. */
diff --git a/include/linux/u64_stats_sync.h b/include/linux/u64_stats_sync.h
index 7bfabd20204c..4b4439e75f45 100644
--- a/include/linux/u64_stats_sync.h
+++ b/include/linux/u64_stats_sync.h
@@ -27,8 +27,8 @@
27 * (On UP, there is no seqcount_t protection, a reader allowing interrupts could 27 * (On UP, there is no seqcount_t protection, a reader allowing interrupts could
28 * read partial values) 28 * read partial values)
29 * 29 *
30 * 7) For softirq uses, readers can use u64_stats_fetch_begin_bh() and 30 * 7) For irq and softirq uses, readers can use u64_stats_fetch_begin_irq() and
31 * u64_stats_fetch_retry_bh() helpers 31 * u64_stats_fetch_retry_irq() helpers
32 * 32 *
33 * Usage : 33 * Usage :
34 * 34 *
@@ -114,31 +114,31 @@ static inline bool u64_stats_fetch_retry(const struct u64_stats_sync *syncp,
114} 114}
115 115
116/* 116/*
117 * In case softirq handlers can update u64 counters, readers can use following helpers 117 * In case irq handlers can update u64 counters, readers can use following helpers
118 * - SMP 32bit arches use seqcount protection, irq safe. 118 * - SMP 32bit arches use seqcount protection, irq safe.
119 * - UP 32bit must disable BH. 119 * - UP 32bit must disable irqs.
120 * - 64bit have no problem atomically reading u64 values, irq safe. 120 * - 64bit have no problem atomically reading u64 values, irq safe.
121 */ 121 */
122static inline unsigned int u64_stats_fetch_begin_bh(const struct u64_stats_sync *syncp) 122static inline unsigned int u64_stats_fetch_begin_irq(const struct u64_stats_sync *syncp)
123{ 123{
124#if BITS_PER_LONG==32 && defined(CONFIG_SMP) 124#if BITS_PER_LONG==32 && defined(CONFIG_SMP)
125 return read_seqcount_begin(&syncp->seq); 125 return read_seqcount_begin(&syncp->seq);
126#else 126#else
127#if BITS_PER_LONG==32 127#if BITS_PER_LONG==32
128 local_bh_disable(); 128 local_irq_disable();
129#endif 129#endif
130 return 0; 130 return 0;
131#endif 131#endif
132} 132}
133 133
134static inline bool u64_stats_fetch_retry_bh(const struct u64_stats_sync *syncp, 134static inline bool u64_stats_fetch_retry_irq(const struct u64_stats_sync *syncp,
135 unsigned int start) 135 unsigned int start)
136{ 136{
137#if BITS_PER_LONG==32 && defined(CONFIG_SMP) 137#if BITS_PER_LONG==32 && defined(CONFIG_SMP)
138 return read_seqcount_retry(&syncp->seq, start); 138 return read_seqcount_retry(&syncp->seq, start);
139#else 139#else
140#if BITS_PER_LONG==32 140#if BITS_PER_LONG==32
141 local_bh_enable(); 141 local_irq_enable();
142#endif 142#endif
143 return false; 143 return false;
144#endif 144#endif
diff --git a/include/linux/usb/cdc_ncm.h b/include/linux/usb/cdc_ncm.h
index 2c14d9cdd57a..44b38b92236a 100644
--- a/include/linux/usb/cdc_ncm.h
+++ b/include/linux/usb/cdc_ncm.h
@@ -94,6 +94,7 @@ struct cdc_ncm_ctx {
94 94
95 const struct usb_cdc_ncm_desc *func_desc; 95 const struct usb_cdc_ncm_desc *func_desc;
96 const struct usb_cdc_mbim_desc *mbim_desc; 96 const struct usb_cdc_mbim_desc *mbim_desc;
97 const struct usb_cdc_mbim_extended_desc *mbim_extended_desc;
97 const struct usb_cdc_ether_desc *ether_desc; 98 const struct usb_cdc_ether_desc *ether_desc;
98 99
99 struct usb_interface *control; 100 struct usb_interface *control;
diff --git a/include/linux/wl12xx.h b/include/linux/wl12xx.h
index a54fe82e704b..a9c723be1acf 100644
--- a/include/linux/wl12xx.h
+++ b/include/linux/wl12xx.h
@@ -48,11 +48,15 @@ enum {
48 WL12XX_TCXOCLOCK_33_6 = 7, /* 33.6 MHz */ 48 WL12XX_TCXOCLOCK_33_6 = 7, /* 33.6 MHz */
49}; 49};
50 50
51struct wl12xx_platform_data { 51struct wl1251_platform_data {
52 void (*set_power)(bool enable); 52 int power_gpio;
53 /* SDIO only: IRQ number if WLAN_IRQ line is used, 0 for SDIO IRQs */ 53 /* SDIO only: IRQ number if WLAN_IRQ line is used, 0 for SDIO IRQs */
54 int irq; 54 int irq;
55 bool use_eeprom; 55 bool use_eeprom;
56};
57
58struct wl12xx_platform_data {
59 int irq;
56 int board_ref_clock; 60 int board_ref_clock;
57 int board_tcxo_clock; 61 int board_tcxo_clock;
58 unsigned long platform_quirks; 62 unsigned long platform_quirks;
@@ -68,6 +72,10 @@ int wl12xx_set_platform_data(const struct wl12xx_platform_data *data);
68 72
69struct wl12xx_platform_data *wl12xx_get_platform_data(void); 73struct wl12xx_platform_data *wl12xx_get_platform_data(void);
70 74
75int wl1251_set_platform_data(const struct wl1251_platform_data *data);
76
77struct wl1251_platform_data *wl1251_get_platform_data(void);
78
71#else 79#else
72 80
73static inline 81static inline
@@ -82,6 +90,18 @@ struct wl12xx_platform_data *wl12xx_get_platform_data(void)
82 return ERR_PTR(-ENODATA); 90 return ERR_PTR(-ENODATA);
83} 91}
84 92
93static inline
94int wl1251_set_platform_data(const struct wl1251_platform_data *data)
95{
96 return -ENOSYS;
97}
98
99static inline
100struct wl1251_platform_data *wl1251_get_platform_data(void)
101{
102 return ERR_PTR(-ENODATA);
103}
104
85#endif 105#endif
86 106
87#endif 107#endif
diff --git a/include/net/6lowpan.h b/include/net/6lowpan.h
new file mode 100644
index 000000000000..f7d372b7d4ff
--- /dev/null
+++ b/include/net/6lowpan.h
@@ -0,0 +1,434 @@
1/*
2 * Copyright 2011, Siemens AG
3 * written by Alexander Smirnov <alex.bluesman.smirnov@gmail.com>
4 */
5
6/*
7 * Based on patches from Jon Smirl <jonsmirl@gmail.com>
8 * Copyright (c) 2011 Jon Smirl <jonsmirl@gmail.com>
9 *
10 * This program is free software; you can redistribute it and/or modify
11 * it under the terms of the GNU General Public License version 2
12 * as published by the Free Software Foundation.
13 *
14 * This program is distributed in the hope that it will be useful,
15 * but WITHOUT ANY WARRANTY; without even the implied warranty of
16 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
17 * GNU General Public License for more details.
18 *
19 * You should have received a copy of the GNU General Public License along
20 * with this program; if not, write to the Free Software Foundation, Inc.,
21 * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
22 */
23
24/* Jon's code is based on 6lowpan implementation for Contiki which is:
25 * Copyright (c) 2008, Swedish Institute of Computer Science.
26 * All rights reserved.
27 *
28 * Redistribution and use in source and binary forms, with or without
29 * modification, are permitted provided that the following conditions
30 * are met:
31 * 1. Redistributions of source code must retain the above copyright
32 * notice, this list of conditions and the following disclaimer.
33 * 2. Redistributions in binary form must reproduce the above copyright
34 * notice, this list of conditions and the following disclaimer in the
35 * documentation and/or other materials provided with the distribution.
36 * 3. Neither the name of the Institute nor the names of its contributors
37 * may be used to endorse or promote products derived from this software
38 * without specific prior written permission.
39 *
40 * THIS SOFTWARE IS PROVIDED BY THE INSTITUTE AND CONTRIBUTORS ``AS IS'' AND
41 * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
42 * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
43 * ARE DISCLAIMED. IN NO EVENT SHALL THE INSTITUTE OR CONTRIBUTORS BE LIABLE
44 * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
45 * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
46 * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
47 * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
48 * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
49 * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
50 * SUCH DAMAGE.
51 */
52
53#ifndef __6LOWPAN_H__
54#define __6LOWPAN_H__
55
56#include <net/ipv6.h>
57
58#define UIP_802154_SHORTADDR_LEN 2 /* compressed ipv6 address length */
59#define UIP_IPH_LEN 40 /* ipv6 fixed header size */
60#define UIP_PROTO_UDP 17 /* ipv6 next header value for UDP */
61#define UIP_FRAGH_LEN 8 /* ipv6 fragment header size */
62
63/*
64 * ipv6 address based on mac
65 * second bit-flip (Universe/Local) is done according RFC2464
66 */
67#define is_addr_mac_addr_based(a, m) \
68 ((((a)->s6_addr[8]) == (((m)[0]) ^ 0x02)) && \
69 (((a)->s6_addr[9]) == (m)[1]) && \
70 (((a)->s6_addr[10]) == (m)[2]) && \
71 (((a)->s6_addr[11]) == (m)[3]) && \
72 (((a)->s6_addr[12]) == (m)[4]) && \
73 (((a)->s6_addr[13]) == (m)[5]) && \
74 (((a)->s6_addr[14]) == (m)[6]) && \
75 (((a)->s6_addr[15]) == (m)[7]))
76
77/* ipv6 address is unspecified */
78#define is_addr_unspecified(a) \
79 ((((a)->s6_addr32[0]) == 0) && \
80 (((a)->s6_addr32[1]) == 0) && \
81 (((a)->s6_addr32[2]) == 0) && \
82 (((a)->s6_addr32[3]) == 0))
83
84/* compare ipv6 addresses prefixes */
85#define ipaddr_prefixcmp(addr1, addr2, length) \
86 (memcmp(addr1, addr2, length >> 3) == 0)
87
88/* local link, i.e. FE80::/10 */
89#define is_addr_link_local(a) (((a)->s6_addr16[0]) == htons(0xFE80))
90
91/*
92 * check whether we can compress the IID to 16 bits,
93 * it's possible for unicast adresses with first 49 bits are zero only.
94 */
95#define lowpan_is_iid_16_bit_compressable(a) \
96 ((((a)->s6_addr16[4]) == 0) && \
97 (((a)->s6_addr[10]) == 0) && \
98 (((a)->s6_addr[11]) == 0xff) && \
99 (((a)->s6_addr[12]) == 0xfe) && \
100 (((a)->s6_addr[13]) == 0))
101
102/* multicast address */
103#define is_addr_mcast(a) (((a)->s6_addr[0]) == 0xFF)
104
105/* check whether the 112-bit gid of the multicast address is mappable to: */
106
107/* 9 bits, for FF02::1 (all nodes) and FF02::2 (all routers) addresses only. */
108#define lowpan_is_mcast_addr_compressable(a) \
109 ((((a)->s6_addr16[1]) == 0) && \
110 (((a)->s6_addr16[2]) == 0) && \
111 (((a)->s6_addr16[3]) == 0) && \
112 (((a)->s6_addr16[4]) == 0) && \
113 (((a)->s6_addr16[5]) == 0) && \
114 (((a)->s6_addr16[6]) == 0) && \
115 (((a)->s6_addr[14]) == 0) && \
116 ((((a)->s6_addr[15]) == 1) || (((a)->s6_addr[15]) == 2)))
117
118/* 48 bits, FFXX::00XX:XXXX:XXXX */
119#define lowpan_is_mcast_addr_compressable48(a) \
120 ((((a)->s6_addr16[1]) == 0) && \
121 (((a)->s6_addr16[2]) == 0) && \
122 (((a)->s6_addr16[3]) == 0) && \
123 (((a)->s6_addr16[4]) == 0) && \
124 (((a)->s6_addr[10]) == 0))
125
126/* 32 bits, FFXX::00XX:XXXX */
127#define lowpan_is_mcast_addr_compressable32(a) \
128 ((((a)->s6_addr16[1]) == 0) && \
129 (((a)->s6_addr16[2]) == 0) && \
130 (((a)->s6_addr16[3]) == 0) && \
131 (((a)->s6_addr16[4]) == 0) && \
132 (((a)->s6_addr16[5]) == 0) && \
133 (((a)->s6_addr[12]) == 0))
134
135/* 8 bits, FF02::00XX */
136#define lowpan_is_mcast_addr_compressable8(a) \
137 ((((a)->s6_addr[1]) == 2) && \
138 (((a)->s6_addr16[1]) == 0) && \
139 (((a)->s6_addr16[2]) == 0) && \
140 (((a)->s6_addr16[3]) == 0) && \
141 (((a)->s6_addr16[4]) == 0) && \
142 (((a)->s6_addr16[5]) == 0) && \
143 (((a)->s6_addr16[6]) == 0) && \
144 (((a)->s6_addr[14]) == 0))
145
146#define lowpan_is_addr_broadcast(a) \
147 ((((a)[0]) == 0xFF) && \
148 (((a)[1]) == 0xFF) && \
149 (((a)[2]) == 0xFF) && \
150 (((a)[3]) == 0xFF) && \
151 (((a)[4]) == 0xFF) && \
152 (((a)[5]) == 0xFF) && \
153 (((a)[6]) == 0xFF) && \
154 (((a)[7]) == 0xFF))
155
156#define LOWPAN_DISPATCH_IPV6 0x41 /* 01000001 = 65 */
157#define LOWPAN_DISPATCH_HC1 0x42 /* 01000010 = 66 */
158#define LOWPAN_DISPATCH_IPHC 0x60 /* 011xxxxx = ... */
159#define LOWPAN_DISPATCH_FRAG1 0xc0 /* 11000xxx */
160#define LOWPAN_DISPATCH_FRAGN 0xe0 /* 11100xxx */
161
162#define LOWPAN_DISPATCH_MASK 0xf8 /* 11111000 */
163
164#define LOWPAN_FRAG_TIMEOUT (HZ * 60) /* time-out 60 sec */
165
166#define LOWPAN_FRAG1_HEAD_SIZE 0x4
167#define LOWPAN_FRAGN_HEAD_SIZE 0x5
168
169/*
170 * According IEEE802.15.4 standard:
171 * - MTU is 127 octets
172 * - maximum MHR size is 37 octets
173 * - MFR size is 2 octets
174 *
175 * so minimal payload size that we may guarantee is:
176 * MTU - MHR - MFR = 88 octets
177 */
178#define LOWPAN_FRAG_SIZE 88
179
180/*
181 * Values of fields within the IPHC encoding first byte
182 * (C stands for compressed and I for inline)
183 */
184#define LOWPAN_IPHC_TF 0x18
185
186#define LOWPAN_IPHC_FL_C 0x10
187#define LOWPAN_IPHC_TC_C 0x08
188#define LOWPAN_IPHC_NH_C 0x04
189#define LOWPAN_IPHC_TTL_1 0x01
190#define LOWPAN_IPHC_TTL_64 0x02
191#define LOWPAN_IPHC_TTL_255 0x03
192#define LOWPAN_IPHC_TTL_I 0x00
193
194
195/* Values of fields within the IPHC encoding second byte */
196#define LOWPAN_IPHC_CID 0x80
197
198#define LOWPAN_IPHC_ADDR_00 0x00
199#define LOWPAN_IPHC_ADDR_01 0x01
200#define LOWPAN_IPHC_ADDR_02 0x02
201#define LOWPAN_IPHC_ADDR_03 0x03
202
203#define LOWPAN_IPHC_SAC 0x40
204#define LOWPAN_IPHC_SAM 0x30
205
206#define LOWPAN_IPHC_SAM_BIT 4
207
208#define LOWPAN_IPHC_M 0x08
209#define LOWPAN_IPHC_DAC 0x04
210#define LOWPAN_IPHC_DAM_00 0x00
211#define LOWPAN_IPHC_DAM_01 0x01
212#define LOWPAN_IPHC_DAM_10 0x02
213#define LOWPAN_IPHC_DAM_11 0x03
214
215#define LOWPAN_IPHC_DAM_BIT 0
216/*
217 * LOWPAN_UDP encoding (works together with IPHC)
218 */
219#define LOWPAN_NHC_UDP_MASK 0xF8
220#define LOWPAN_NHC_UDP_ID 0xF0
221#define LOWPAN_NHC_UDP_CHECKSUMC 0x04
222#define LOWPAN_NHC_UDP_CHECKSUMI 0x00
223
224#define LOWPAN_NHC_UDP_4BIT_PORT 0xF0B0
225#define LOWPAN_NHC_UDP_4BIT_MASK 0xFFF0
226#define LOWPAN_NHC_UDP_8BIT_PORT 0xF000
227#define LOWPAN_NHC_UDP_8BIT_MASK 0xFF00
228
229/* values for port compression, _with checksum_ ie bit 5 set to 0 */
230#define LOWPAN_NHC_UDP_CS_P_00 0xF0 /* all inline */
231#define LOWPAN_NHC_UDP_CS_P_01 0xF1 /* source 16bit inline,
232 dest = 0xF0 + 8 bit inline */
233#define LOWPAN_NHC_UDP_CS_P_10 0xF2 /* source = 0xF0 + 8bit inline,
234 dest = 16 bit inline */
235#define LOWPAN_NHC_UDP_CS_P_11 0xF3 /* source & dest = 0xF0B + 4bit inline */
236#define LOWPAN_NHC_UDP_CS_C 0x04 /* checksum elided */
237
238#ifdef DEBUG
239/* print data in line */
240static inline void raw_dump_inline(const char *caller, char *msg,
241 unsigned char *buf, int len)
242{
243 if (msg)
244 pr_debug("%s():%s: ", caller, msg);
245
246 print_hex_dump_debug("", DUMP_PREFIX_NONE, 16, 1, buf, len, false);
247}
248
249/* print data in a table format:
250 *
251 * addr: xx xx xx xx xx xx
252 * addr: xx xx xx xx xx xx
253 * ...
254 */
255static inline void raw_dump_table(const char *caller, char *msg,
256 unsigned char *buf, int len)
257{
258 if (msg)
259 pr_debug("%s():%s:\n", caller, msg);
260
261 print_hex_dump_debug("\t", DUMP_PREFIX_OFFSET, 16, 1, buf, len, false);
262}
263#else
264static inline void raw_dump_table(const char *caller, char *msg,
265 unsigned char *buf, int len) { }
266static inline void raw_dump_inline(const char *caller, char *msg,
267 unsigned char *buf, int len) { }
268#endif
269
270static inline int lowpan_fetch_skb_u8(struct sk_buff *skb, u8 *val)
271{
272 if (unlikely(!pskb_may_pull(skb, 1)))
273 return -EINVAL;
274
275 *val = skb->data[0];
276 skb_pull(skb, 1);
277
278 return 0;
279}
280
281static inline int lowpan_fetch_skb_u16(struct sk_buff *skb, u16 *val)
282{
283 if (unlikely(!pskb_may_pull(skb, 2)))
284 return -EINVAL;
285
286 *val = (skb->data[0] << 8) | skb->data[1];
287 skb_pull(skb, 2);
288
289 return 0;
290}
291
292static inline bool lowpan_fetch_skb(struct sk_buff *skb,
293 void *data, const unsigned int len)
294{
295 if (unlikely(!pskb_may_pull(skb, len)))
296 return true;
297
298 skb_copy_from_linear_data(skb, data, len);
299 skb_pull(skb, len);
300
301 return false;
302}
303
304static inline void lowpan_push_hc_data(u8 **hc_ptr, const void *data,
305 const size_t len)
306{
307 memcpy(*hc_ptr, data, len);
308 *hc_ptr += len;
309}
310
311static inline u8 lowpan_addr_mode_size(const u8 addr_mode)
312{
313 static const u8 addr_sizes[] = {
314 [LOWPAN_IPHC_ADDR_00] = 16,
315 [LOWPAN_IPHC_ADDR_01] = 8,
316 [LOWPAN_IPHC_ADDR_02] = 2,
317 [LOWPAN_IPHC_ADDR_03] = 0,
318 };
319 return addr_sizes[addr_mode];
320}
321
322static inline u8 lowpan_next_hdr_size(const u8 h_enc, u16 *uncomp_header)
323{
324 u8 ret = 1;
325
326 if ((h_enc & LOWPAN_NHC_UDP_MASK) == LOWPAN_NHC_UDP_ID) {
327 *uncomp_header += sizeof(struct udphdr);
328
329 switch (h_enc & LOWPAN_NHC_UDP_CS_P_11) {
330 case LOWPAN_NHC_UDP_CS_P_00:
331 ret += 4;
332 break;
333 case LOWPAN_NHC_UDP_CS_P_01:
334 case LOWPAN_NHC_UDP_CS_P_10:
335 ret += 3;
336 break;
337 case LOWPAN_NHC_UDP_CS_P_11:
338 ret++;
339 break;
340 default:
341 break;
342 }
343
344 if (!(h_enc & LOWPAN_NHC_UDP_CS_C))
345 ret += 2;
346 }
347
348 return ret;
349}
350
351/**
352 * lowpan_uncompress_size - returns skb->len size with uncompressed header
353 * @skb: sk_buff with 6lowpan header inside
354 * @datagram_offset: optional to get the datagram_offset value
355 *
356 * Returns the skb->len with uncompressed header
357 */
358static inline u16
359lowpan_uncompress_size(const struct sk_buff *skb, u16 *dgram_offset)
360{
361 u16 ret = 2, uncomp_header = sizeof(struct ipv6hdr);
362 u8 iphc0, iphc1, h_enc;
363
364 iphc0 = skb_network_header(skb)[0];
365 iphc1 = skb_network_header(skb)[1];
366
367 switch ((iphc0 & LOWPAN_IPHC_TF) >> 3) {
368 case 0:
369 ret += 4;
370 break;
371 case 1:
372 ret += 3;
373 break;
374 case 2:
375 ret++;
376 break;
377 default:
378 break;
379 }
380
381 if (!(iphc0 & LOWPAN_IPHC_NH_C))
382 ret++;
383
384 if (!(iphc0 & 0x03))
385 ret++;
386
387 ret += lowpan_addr_mode_size((iphc1 & LOWPAN_IPHC_SAM) >>
388 LOWPAN_IPHC_SAM_BIT);
389
390 if (iphc1 & LOWPAN_IPHC_M) {
391 switch ((iphc1 & LOWPAN_IPHC_DAM_11) >>
392 LOWPAN_IPHC_DAM_BIT) {
393 case LOWPAN_IPHC_DAM_00:
394 ret += 16;
395 break;
396 case LOWPAN_IPHC_DAM_01:
397 ret += 6;
398 break;
399 case LOWPAN_IPHC_DAM_10:
400 ret += 4;
401 break;
402 case LOWPAN_IPHC_DAM_11:
403 ret++;
404 break;
405 default:
406 break;
407 }
408 } else {
409 ret += lowpan_addr_mode_size((iphc1 & LOWPAN_IPHC_DAM_11) >>
410 LOWPAN_IPHC_DAM_BIT);
411 }
412
413 if (iphc0 & LOWPAN_IPHC_NH_C) {
414 h_enc = skb_network_header(skb)[ret];
415 ret += lowpan_next_hdr_size(h_enc, &uncomp_header);
416 }
417
418 if (dgram_offset)
419 *dgram_offset = uncomp_header;
420
421 return skb->len + uncomp_header - ret;
422}
423
424typedef int (*skb_delivery_cb)(struct sk_buff *skb, struct net_device *dev);
425
426int lowpan_process_data(struct sk_buff *skb, struct net_device *dev,
427 const u8 *saddr, const u8 saddr_type, const u8 saddr_len,
428 const u8 *daddr, const u8 daddr_type, const u8 daddr_len,
429 u8 iphc0, u8 iphc1, skb_delivery_cb skb_deliver);
430int lowpan_header_compress(struct sk_buff *skb, struct net_device *dev,
431 unsigned short type, const void *_daddr,
432 const void *_saddr, unsigned int len);
433
434#endif /* __6LOWPAN_H__ */
diff --git a/include/net/act_api.h b/include/net/act_api.h
index 788d8378e587..3ee4c92afd1b 100644
--- a/include/net/act_api.h
+++ b/include/net/act_api.h
@@ -89,7 +89,7 @@ struct tc_action_ops {
89 struct module *owner; 89 struct module *owner;
90 int (*act)(struct sk_buff *, const struct tc_action *, struct tcf_result *); 90 int (*act)(struct sk_buff *, const struct tc_action *, struct tcf_result *);
91 int (*dump)(struct sk_buff *, struct tc_action *, int, int); 91 int (*dump)(struct sk_buff *, struct tc_action *, int, int);
92 int (*cleanup)(struct tc_action *, int bind); 92 void (*cleanup)(struct tc_action *, int bind);
93 int (*lookup)(struct tc_action *, u32); 93 int (*lookup)(struct tc_action *, u32);
94 int (*init)(struct net *net, struct nlattr *nla, 94 int (*init)(struct net *net, struct nlattr *nla,
95 struct nlattr *est, struct tc_action *act, int ovr, 95 struct nlattr *est, struct tc_action *act, int ovr,
@@ -98,20 +98,18 @@ struct tc_action_ops {
98}; 98};
99 99
100int tcf_hash_search(struct tc_action *a, u32 index); 100int tcf_hash_search(struct tc_action *a, u32 index);
101void tcf_hash_destroy(struct tcf_common *p, struct tcf_hashinfo *hinfo); 101void tcf_hash_destroy(struct tc_action *a);
102int tcf_hash_release(struct tcf_common *p, int bind, 102int tcf_hash_release(struct tc_action *a, int bind);
103 struct tcf_hashinfo *hinfo);
104u32 tcf_hash_new_index(struct tcf_hashinfo *hinfo); 103u32 tcf_hash_new_index(struct tcf_hashinfo *hinfo);
105struct tcf_common *tcf_hash_check(u32 index, struct tc_action *a, 104int tcf_hash_check(u32 index, struct tc_action *a, int bind);
106 int bind); 105int tcf_hash_create(u32 index, struct nlattr *est, struct tc_action *a,
107struct tcf_common *tcf_hash_create(u32 index, struct nlattr *est, 106 int size, int bind);
108 struct tc_action *a, int size, 107void tcf_hash_cleanup(struct tc_action *a, struct nlattr *est);
109 int bind); 108void tcf_hash_insert(struct tc_action *a);
110void tcf_hash_insert(struct tcf_common *p, struct tcf_hashinfo *hinfo);
111 109
112int tcf_register_action(struct tc_action_ops *a); 110int tcf_register_action(struct tc_action_ops *a, unsigned int mask);
113int tcf_unregister_action(struct tc_action_ops *a); 111int tcf_unregister_action(struct tc_action_ops *a);
114void tcf_action_destroy(struct list_head *actions, int bind); 112int tcf_action_destroy(struct list_head *actions, int bind);
115int tcf_action_exec(struct sk_buff *skb, const struct list_head *actions, 113int tcf_action_exec(struct sk_buff *skb, const struct list_head *actions,
116 struct tcf_result *res); 114 struct tcf_result *res);
117int tcf_action_init(struct net *net, struct nlattr *nla, 115int tcf_action_init(struct net *net, struct nlattr *nla,
diff --git a/include/net/addrconf.h b/include/net/addrconf.h
index 50e39a8822b4..933a9f22a05f 100644
--- a/include/net/addrconf.h
+++ b/include/net/addrconf.h
@@ -314,7 +314,7 @@ static inline bool ipv6_addr_is_multicast(const struct in6_addr *addr)
314static inline bool ipv6_addr_is_ll_all_nodes(const struct in6_addr *addr) 314static inline bool ipv6_addr_is_ll_all_nodes(const struct in6_addr *addr)
315{ 315{
316#if defined(CONFIG_HAVE_EFFICIENT_UNALIGNED_ACCESS) && BITS_PER_LONG == 64 316#if defined(CONFIG_HAVE_EFFICIENT_UNALIGNED_ACCESS) && BITS_PER_LONG == 64
317 __u64 *p = (__u64 *)addr; 317 __be64 *p = (__be64 *)addr;
318 return ((p[0] ^ cpu_to_be64(0xff02000000000000UL)) | (p[1] ^ cpu_to_be64(1))) == 0UL; 318 return ((p[0] ^ cpu_to_be64(0xff02000000000000UL)) | (p[1] ^ cpu_to_be64(1))) == 0UL;
319#else 319#else
320 return ((addr->s6_addr32[0] ^ htonl(0xff020000)) | 320 return ((addr->s6_addr32[0] ^ htonl(0xff020000)) |
@@ -326,7 +326,7 @@ static inline bool ipv6_addr_is_ll_all_nodes(const struct in6_addr *addr)
326static inline bool ipv6_addr_is_ll_all_routers(const struct in6_addr *addr) 326static inline bool ipv6_addr_is_ll_all_routers(const struct in6_addr *addr)
327{ 327{
328#if defined(CONFIG_HAVE_EFFICIENT_UNALIGNED_ACCESS) && BITS_PER_LONG == 64 328#if defined(CONFIG_HAVE_EFFICIENT_UNALIGNED_ACCESS) && BITS_PER_LONG == 64
329 __u64 *p = (__u64 *)addr; 329 __be64 *p = (__be64 *)addr;
330 return ((p[0] ^ cpu_to_be64(0xff02000000000000UL)) | (p[1] ^ cpu_to_be64(2))) == 0UL; 330 return ((p[0] ^ cpu_to_be64(0xff02000000000000UL)) | (p[1] ^ cpu_to_be64(2))) == 0UL;
331#else 331#else
332 return ((addr->s6_addr32[0] ^ htonl(0xff020000)) | 332 return ((addr->s6_addr32[0] ^ htonl(0xff020000)) |
@@ -343,7 +343,7 @@ static inline bool ipv6_addr_is_isatap(const struct in6_addr *addr)
343static inline bool ipv6_addr_is_solict_mult(const struct in6_addr *addr) 343static inline bool ipv6_addr_is_solict_mult(const struct in6_addr *addr)
344{ 344{
345#if defined(CONFIG_HAVE_EFFICIENT_UNALIGNED_ACCESS) && BITS_PER_LONG == 64 345#if defined(CONFIG_HAVE_EFFICIENT_UNALIGNED_ACCESS) && BITS_PER_LONG == 64
346 __u64 *p = (__u64 *)addr; 346 __be64 *p = (__be64 *)addr;
347 return ((p[0] ^ cpu_to_be64(0xff02000000000000UL)) | 347 return ((p[0] ^ cpu_to_be64(0xff02000000000000UL)) |
348 ((p[1] ^ cpu_to_be64(0x00000001ff000000UL)) & 348 ((p[1] ^ cpu_to_be64(0x00000001ff000000UL)) &
349 cpu_to_be64(0xffffffffff000000UL))) == 0UL; 349 cpu_to_be64(0xffffffffff000000UL))) == 0UL;
diff --git a/include/net/af_ieee802154.h b/include/net/af_ieee802154.h
index 75e64c7a2960..f79ae2aa76d6 100644
--- a/include/net/af_ieee802154.h
+++ b/include/net/af_ieee802154.h
@@ -36,7 +36,7 @@ enum {
36/* address length, octets */ 36/* address length, octets */
37#define IEEE802154_ADDR_LEN 8 37#define IEEE802154_ADDR_LEN 8
38 38
39struct ieee802154_addr { 39struct ieee802154_addr_sa {
40 int addr_type; 40 int addr_type;
41 u16 pan_id; 41 u16 pan_id;
42 union { 42 union {
@@ -51,7 +51,7 @@ struct ieee802154_addr {
51 51
52struct sockaddr_ieee802154 { 52struct sockaddr_ieee802154 {
53 sa_family_t family; /* AF_IEEE802154 */ 53 sa_family_t family; /* AF_IEEE802154 */
54 struct ieee802154_addr addr; 54 struct ieee802154_addr_sa addr;
55}; 55};
56 56
57/* get/setsockopt */ 57/* get/setsockopt */
diff --git a/include/net/bluetooth/bluetooth.h b/include/net/bluetooth/bluetooth.h
index f4f9ee466791..904777c1cd24 100644
--- a/include/net/bluetooth/bluetooth.h
+++ b/include/net/bluetooth/bluetooth.h
@@ -65,6 +65,7 @@ struct bt_security {
65#define BT_SECURITY_LOW 1 65#define BT_SECURITY_LOW 1
66#define BT_SECURITY_MEDIUM 2 66#define BT_SECURITY_MEDIUM 2
67#define BT_SECURITY_HIGH 3 67#define BT_SECURITY_HIGH 3
68#define BT_SECURITY_FIPS 4
68 69
69#define BT_DEFER_SETUP 7 70#define BT_DEFER_SETUP 7
70 71
diff --git a/include/net/bluetooth/hci.h b/include/net/bluetooth/hci.h
index 66c1cd87bfe7..be150cf8cd43 100644
--- a/include/net/bluetooth/hci.h
+++ b/include/net/bluetooth/hci.h
@@ -117,11 +117,18 @@ enum {
117 HCI_SERVICE_CACHE, 117 HCI_SERVICE_CACHE,
118 HCI_DEBUG_KEYS, 118 HCI_DEBUG_KEYS,
119 HCI_DUT_MODE, 119 HCI_DUT_MODE,
120 HCI_FORCE_SC,
121 HCI_FORCE_STATIC_ADDR,
120 HCI_UNREGISTER, 122 HCI_UNREGISTER,
121 HCI_USER_CHANNEL, 123 HCI_USER_CHANNEL,
122 124
123 HCI_LE_SCAN, 125 HCI_LE_SCAN,
124 HCI_SSP_ENABLED, 126 HCI_SSP_ENABLED,
127 HCI_SC_ENABLED,
128 HCI_SC_ONLY,
129 HCI_PRIVACY,
130 HCI_RPA_EXPIRED,
131 HCI_RPA_RESOLVING,
125 HCI_HS_ENABLED, 132 HCI_HS_ENABLED,
126 HCI_LE_ENABLED, 133 HCI_LE_ENABLED,
127 HCI_ADVERTISING, 134 HCI_ADVERTISING,
@@ -133,6 +140,7 @@ enum {
133 HCI_FAST_CONNECTABLE, 140 HCI_FAST_CONNECTABLE,
134 HCI_BREDR_ENABLED, 141 HCI_BREDR_ENABLED,
135 HCI_6LOWPAN_ENABLED, 142 HCI_6LOWPAN_ENABLED,
143 HCI_LE_SCAN_INTERRUPTED,
136}; 144};
137 145
138/* A mask for the flags that are supposed to remain when a reset happens 146/* A mask for the flags that are supposed to remain when a reset happens
@@ -175,6 +183,8 @@ enum {
175#define HCI_CMD_TIMEOUT msecs_to_jiffies(2000) /* 2 seconds */ 183#define HCI_CMD_TIMEOUT msecs_to_jiffies(2000) /* 2 seconds */
176#define HCI_ACL_TX_TIMEOUT msecs_to_jiffies(45000) /* 45 seconds */ 184#define HCI_ACL_TX_TIMEOUT msecs_to_jiffies(45000) /* 45 seconds */
177#define HCI_AUTO_OFF_TIMEOUT msecs_to_jiffies(2000) /* 2 seconds */ 185#define HCI_AUTO_OFF_TIMEOUT msecs_to_jiffies(2000) /* 2 seconds */
186#define HCI_POWER_OFF_TIMEOUT msecs_to_jiffies(5000) /* 5 seconds */
187#define HCI_LE_CONN_TIMEOUT msecs_to_jiffies(20000) /* 20 seconds */
178 188
179/* HCI data types */ 189/* HCI data types */
180#define HCI_COMMAND_PKT 0x01 190#define HCI_COMMAND_PKT 0x01
@@ -282,10 +292,14 @@ enum {
282#define LMP_SYNC_TRAIN 0x04 292#define LMP_SYNC_TRAIN 0x04
283#define LMP_SYNC_SCAN 0x08 293#define LMP_SYNC_SCAN 0x08
284 294
295#define LMP_SC 0x01
296#define LMP_PING 0x02
297
285/* Host features */ 298/* Host features */
286#define LMP_HOST_SSP 0x01 299#define LMP_HOST_SSP 0x01
287#define LMP_HOST_LE 0x02 300#define LMP_HOST_LE 0x02
288#define LMP_HOST_LE_BREDR 0x04 301#define LMP_HOST_LE_BREDR 0x04
302#define LMP_HOST_SC 0x08
289 303
290/* Connection modes */ 304/* Connection modes */
291#define HCI_CM_ACTIVE 0x0000 305#define HCI_CM_ACTIVE 0x0000
@@ -307,6 +321,7 @@ enum {
307#define HCI_LM_TRUSTED 0x0008 321#define HCI_LM_TRUSTED 0x0008
308#define HCI_LM_RELIABLE 0x0010 322#define HCI_LM_RELIABLE 0x0010
309#define HCI_LM_SECURE 0x0020 323#define HCI_LM_SECURE 0x0020
324#define HCI_LM_FIPS 0x0040
310 325
311/* Authentication types */ 326/* Authentication types */
312#define HCI_AT_NO_BONDING 0x00 327#define HCI_AT_NO_BONDING 0x00
@@ -327,17 +342,24 @@ enum {
327#define HCI_LK_LOCAL_UNIT 0x01 342#define HCI_LK_LOCAL_UNIT 0x01
328#define HCI_LK_REMOTE_UNIT 0x02 343#define HCI_LK_REMOTE_UNIT 0x02
329#define HCI_LK_DEBUG_COMBINATION 0x03 344#define HCI_LK_DEBUG_COMBINATION 0x03
330#define HCI_LK_UNAUTH_COMBINATION 0x04 345#define HCI_LK_UNAUTH_COMBINATION_P192 0x04
331#define HCI_LK_AUTH_COMBINATION 0x05 346#define HCI_LK_AUTH_COMBINATION_P192 0x05
332#define HCI_LK_CHANGED_COMBINATION 0x06 347#define HCI_LK_CHANGED_COMBINATION 0x06
348#define HCI_LK_UNAUTH_COMBINATION_P256 0x07
349#define HCI_LK_AUTH_COMBINATION_P256 0x08
333/* The spec doesn't define types for SMP keys, the _MASTER suffix is implied */ 350/* The spec doesn't define types for SMP keys, the _MASTER suffix is implied */
334#define HCI_SMP_STK 0x80 351#define HCI_SMP_STK 0x80
335#define HCI_SMP_STK_SLAVE 0x81 352#define HCI_SMP_STK_SLAVE 0x81
336#define HCI_SMP_LTK 0x82 353#define HCI_SMP_LTK 0x82
337#define HCI_SMP_LTK_SLAVE 0x83 354#define HCI_SMP_LTK_SLAVE 0x83
338 355
356/* Long Term Key types */
357#define HCI_LTK_UNAUTH 0x00
358#define HCI_LTK_AUTH 0x01
359
339/* ---- HCI Error Codes ---- */ 360/* ---- HCI Error Codes ---- */
340#define HCI_ERROR_AUTH_FAILURE 0x05 361#define HCI_ERROR_AUTH_FAILURE 0x05
362#define HCI_ERROR_MEMORY_EXCEEDED 0x07
341#define HCI_ERROR_CONNECTION_TIMEOUT 0x08 363#define HCI_ERROR_CONNECTION_TIMEOUT 0x08
342#define HCI_ERROR_REJ_BAD_ADDR 0x0f 364#define HCI_ERROR_REJ_BAD_ADDR 0x0f
343#define HCI_ERROR_REMOTE_USER_TERM 0x13 365#define HCI_ERROR_REMOTE_USER_TERM 0x13
@@ -660,6 +682,15 @@ struct hci_rp_set_csb {
660 682
661#define HCI_OP_START_SYNC_TRAIN 0x0443 683#define HCI_OP_START_SYNC_TRAIN 0x0443
662 684
685#define HCI_OP_REMOTE_OOB_EXT_DATA_REPLY 0x0445
686struct hci_cp_remote_oob_ext_data_reply {
687 bdaddr_t bdaddr;
688 __u8 hash192[16];
689 __u8 randomizer192[16];
690 __u8 hash256[16];
691 __u8 randomizer256[16];
692} __packed;
693
663#define HCI_OP_SNIFF_MODE 0x0803 694#define HCI_OP_SNIFF_MODE 0x0803
664struct hci_cp_sniff_mode { 695struct hci_cp_sniff_mode {
665 __le16 handle; 696 __le16 handle;
@@ -933,6 +964,26 @@ struct hci_rp_write_sync_train_params {
933 __le16 sync_train_int; 964 __le16 sync_train_int;
934} __packed; 965} __packed;
935 966
967#define HCI_OP_READ_SC_SUPPORT 0x0c79
968struct hci_rp_read_sc_support {
969 __u8 status;
970 __u8 support;
971} __packed;
972
973#define HCI_OP_WRITE_SC_SUPPORT 0x0c7a
974struct hci_cp_write_sc_support {
975 __u8 support;
976} __packed;
977
978#define HCI_OP_READ_LOCAL_OOB_EXT_DATA 0x0c7d
979struct hci_rp_read_local_oob_ext_data {
980 __u8 status;
981 __u8 hash192[16];
982 __u8 randomizer192[16];
983 __u8 hash256[16];
984 __u8 randomizer256[16];
985} __packed;
986
936#define HCI_OP_READ_LOCAL_VERSION 0x1001 987#define HCI_OP_READ_LOCAL_VERSION 0x1001
937struct hci_rp_read_local_version { 988struct hci_rp_read_local_version {
938 __u8 status; 989 __u8 status;
@@ -1133,6 +1184,9 @@ struct hci_cp_le_set_scan_enable {
1133 __u8 filter_dup; 1184 __u8 filter_dup;
1134} __packed; 1185} __packed;
1135 1186
1187#define HCI_LE_USE_PEER_ADDR 0x00
1188#define HCI_LE_USE_WHITELIST 0x01
1189
1136#define HCI_OP_LE_CREATE_CONN 0x200d 1190#define HCI_OP_LE_CREATE_CONN 0x200d
1137struct hci_cp_le_create_conn { 1191struct hci_cp_le_create_conn {
1138 __le16 scan_interval; 1192 __le16 scan_interval;
@@ -1157,6 +1211,20 @@ struct hci_rp_le_read_white_list_size {
1157 __u8 size; 1211 __u8 size;
1158} __packed; 1212} __packed;
1159 1213
1214#define HCI_OP_LE_CLEAR_WHITE_LIST 0x2010
1215
1216#define HCI_OP_LE_ADD_TO_WHITE_LIST 0x2011
1217struct hci_cp_le_add_to_white_list {
1218 __u8 bdaddr_type;
1219 bdaddr_t bdaddr;
1220} __packed;
1221
1222#define HCI_OP_LE_DEL_FROM_WHITE_LIST 0x2012
1223struct hci_cp_le_del_from_white_list {
1224 __u8 bdaddr_type;
1225 bdaddr_t bdaddr;
1226} __packed;
1227
1160#define HCI_OP_LE_CONN_UPDATE 0x2013 1228#define HCI_OP_LE_CONN_UPDATE 0x2013
1161struct hci_cp_le_conn_update { 1229struct hci_cp_le_conn_update {
1162 __le16 handle; 1230 __le16 handle;
@@ -1171,7 +1239,7 @@ struct hci_cp_le_conn_update {
1171#define HCI_OP_LE_START_ENC 0x2019 1239#define HCI_OP_LE_START_ENC 0x2019
1172struct hci_cp_le_start_enc { 1240struct hci_cp_le_start_enc {
1173 __le16 handle; 1241 __le16 handle;
1174 __u8 rand[8]; 1242 __le64 rand;
1175 __le16 ediv; 1243 __le16 ediv;
1176 __u8 ltk[16]; 1244 __u8 ltk[16];
1177} __packed; 1245} __packed;
@@ -1583,7 +1651,7 @@ struct hci_ev_le_conn_complete {
1583#define HCI_EV_LE_LTK_REQ 0x05 1651#define HCI_EV_LE_LTK_REQ 0x05
1584struct hci_ev_le_ltk_req { 1652struct hci_ev_le_ltk_req {
1585 __le16 handle; 1653 __le16 handle;
1586 __u8 random[8]; 1654 __le64 rand;
1587 __le16 ediv; 1655 __le16 ediv;
1588} __packed; 1656} __packed;
1589 1657
diff --git a/include/net/bluetooth/hci_core.h b/include/net/bluetooth/hci_core.h
index f2f0cf5865c4..5f8bc05694ac 100644
--- a/include/net/bluetooth/hci_core.h
+++ b/include/net/bluetooth/hci_core.h
@@ -91,6 +91,13 @@ struct bt_uuid {
91 u8 svc_hint; 91 u8 svc_hint;
92}; 92};
93 93
94struct smp_csrk {
95 bdaddr_t bdaddr;
96 u8 bdaddr_type;
97 u8 master;
98 u8 val[16];
99};
100
94struct smp_ltk { 101struct smp_ltk {
95 struct list_head list; 102 struct list_head list;
96 bdaddr_t bdaddr; 103 bdaddr_t bdaddr;
@@ -99,9 +106,17 @@ struct smp_ltk {
99 u8 type; 106 u8 type;
100 u8 enc_size; 107 u8 enc_size;
101 __le16 ediv; 108 __le16 ediv;
102 u8 rand[8]; 109 __le64 rand;
103 u8 val[16]; 110 u8 val[16];
104} __packed; 111};
112
113struct smp_irk {
114 struct list_head list;
115 bdaddr_t rpa;
116 bdaddr_t bdaddr;
117 u8 addr_type;
118 u8 val[16];
119};
105 120
106struct link_key { 121struct link_key {
107 struct list_head list; 122 struct list_head list;
@@ -114,12 +129,17 @@ struct link_key {
114struct oob_data { 129struct oob_data {
115 struct list_head list; 130 struct list_head list;
116 bdaddr_t bdaddr; 131 bdaddr_t bdaddr;
117 u8 hash[16]; 132 u8 hash192[16];
118 u8 randomizer[16]; 133 u8 randomizer192[16];
134 u8 hash256[16];
135 u8 randomizer256[16];
119}; 136};
120 137
121#define HCI_MAX_SHORT_NAME_LENGTH 10 138#define HCI_MAX_SHORT_NAME_LENGTH 10
122 139
140/* Default LE RPA expiry time, 15 minutes */
141#define HCI_DEFAULT_RPA_TIMEOUT (15 * 60)
142
123struct amp_assoc { 143struct amp_assoc {
124 __u16 len; 144 __u16 len;
125 __u16 offset; 145 __u16 offset;
@@ -141,8 +161,9 @@ struct hci_dev {
141 __u8 bus; 161 __u8 bus;
142 __u8 dev_type; 162 __u8 dev_type;
143 bdaddr_t bdaddr; 163 bdaddr_t bdaddr;
164 bdaddr_t random_addr;
144 bdaddr_t static_addr; 165 bdaddr_t static_addr;
145 __u8 own_addr_type; 166 __u8 adv_addr_type;
146 __u8 dev_name[HCI_MAX_NAME_LENGTH]; 167 __u8 dev_name[HCI_MAX_NAME_LENGTH];
147 __u8 short_name[HCI_MAX_SHORT_NAME_LENGTH]; 168 __u8 short_name[HCI_MAX_SHORT_NAME_LENGTH];
148 __u8 eir[HCI_MAX_EIR_LENGTH]; 169 __u8 eir[HCI_MAX_EIR_LENGTH];
@@ -167,6 +188,8 @@ struct hci_dev {
167 __u16 page_scan_interval; 188 __u16 page_scan_interval;
168 __u16 page_scan_window; 189 __u16 page_scan_window;
169 __u8 page_scan_type; 190 __u8 page_scan_type;
191 __u8 le_adv_channel_map;
192 __u8 le_scan_type;
170 __u16 le_scan_interval; 193 __u16 le_scan_interval;
171 __u16 le_scan_window; 194 __u16 le_scan_window;
172 __u16 le_conn_min_interval; 195 __u16 le_conn_min_interval;
@@ -257,19 +280,21 @@ struct hci_dev {
257 __u32 req_status; 280 __u32 req_status;
258 __u32 req_result; 281 __u32 req_result;
259 282
260 struct list_head mgmt_pending; 283 struct crypto_blkcipher *tfm_aes;
261 284
262 struct discovery_state discovery; 285 struct discovery_state discovery;
263 struct hci_conn_hash conn_hash; 286 struct hci_conn_hash conn_hash;
264 struct list_head blacklist;
265 287
288 struct list_head mgmt_pending;
289 struct list_head blacklist;
266 struct list_head uuids; 290 struct list_head uuids;
267
268 struct list_head link_keys; 291 struct list_head link_keys;
269
270 struct list_head long_term_keys; 292 struct list_head long_term_keys;
271 293 struct list_head identity_resolving_keys;
272 struct list_head remote_oob_data; 294 struct list_head remote_oob_data;
295 struct list_head le_white_list;
296 struct list_head le_conn_params;
297 struct list_head pend_le_conns;
273 298
274 struct hci_dev_stats stat; 299 struct hci_dev_stats stat;
275 300
@@ -291,6 +316,11 @@ struct hci_dev {
291 __u8 scan_rsp_data[HCI_MAX_AD_LENGTH]; 316 __u8 scan_rsp_data[HCI_MAX_AD_LENGTH];
292 __u8 scan_rsp_data_len; 317 __u8 scan_rsp_data_len;
293 318
319 __u8 irk[16];
320 __u32 rpa_timeout;
321 struct delayed_work rpa_expired;
322 bdaddr_t rpa;
323
294 int (*open)(struct hci_dev *hdev); 324 int (*open)(struct hci_dev *hdev);
295 int (*close)(struct hci_dev *hdev); 325 int (*close)(struct hci_dev *hdev);
296 int (*flush)(struct hci_dev *hdev); 326 int (*flush)(struct hci_dev *hdev);
@@ -310,6 +340,10 @@ struct hci_conn {
310 __u8 dst_type; 340 __u8 dst_type;
311 bdaddr_t src; 341 bdaddr_t src;
312 __u8 src_type; 342 __u8 src_type;
343 bdaddr_t init_addr;
344 __u8 init_addr_type;
345 bdaddr_t resp_addr;
346 __u8 resp_addr_type;
313 __u16 handle; 347 __u16 handle;
314 __u16 state; 348 __u16 state;
315 __u8 mode; 349 __u8 mode;
@@ -332,6 +366,8 @@ struct hci_conn {
332 __u8 passkey_entered; 366 __u8 passkey_entered;
333 __u16 disc_timeout; 367 __u16 disc_timeout;
334 __u16 setting; 368 __u16 setting;
369 __u16 le_conn_min_interval;
370 __u16 le_conn_max_interval;
335 unsigned long flags; 371 unsigned long flags;
336 372
337 __u8 remote_cap; 373 __u8 remote_cap;
@@ -347,6 +383,7 @@ struct hci_conn {
347 struct delayed_work disc_work; 383 struct delayed_work disc_work;
348 struct delayed_work auto_accept_work; 384 struct delayed_work auto_accept_work;
349 struct delayed_work idle_work; 385 struct delayed_work idle_work;
386 struct delayed_work le_conn_timeout;
350 387
351 struct device dev; 388 struct device dev;
352 389
@@ -372,6 +409,22 @@ struct hci_chan {
372 __u8 state; 409 __u8 state;
373}; 410};
374 411
412struct hci_conn_params {
413 struct list_head list;
414
415 bdaddr_t addr;
416 u8 addr_type;
417
418 u16 conn_min_interval;
419 u16 conn_max_interval;
420
421 enum {
422 HCI_AUTO_CONN_DISABLED,
423 HCI_AUTO_CONN_ALWAYS,
424 HCI_AUTO_CONN_LINK_LOSS,
425 } auto_connect;
426};
427
375extern struct list_head hci_dev_list; 428extern struct list_head hci_dev_list;
376extern struct list_head hci_cb_list; 429extern struct list_head hci_cb_list;
377extern rwlock_t hci_dev_list_lock; 430extern rwlock_t hci_dev_list_lock;
@@ -446,6 +499,8 @@ enum {
446 HCI_CONN_LE_SMP_PEND, 499 HCI_CONN_LE_SMP_PEND,
447 HCI_CONN_MGMT_CONNECTED, 500 HCI_CONN_MGMT_CONNECTED,
448 HCI_CONN_SSP_ENABLED, 501 HCI_CONN_SSP_ENABLED,
502 HCI_CONN_SC_ENABLED,
503 HCI_CONN_AES_CCM,
449 HCI_CONN_POWER_SAVE, 504 HCI_CONN_POWER_SAVE,
450 HCI_CONN_REMOTE_OOB, 505 HCI_CONN_REMOTE_OOB,
451 HCI_CONN_6LOWPAN, 506 HCI_CONN_6LOWPAN,
@@ -458,6 +513,13 @@ static inline bool hci_conn_ssp_enabled(struct hci_conn *conn)
458 test_bit(HCI_CONN_SSP_ENABLED, &conn->flags); 513 test_bit(HCI_CONN_SSP_ENABLED, &conn->flags);
459} 514}
460 515
516static inline bool hci_conn_sc_enabled(struct hci_conn *conn)
517{
518 struct hci_dev *hdev = conn->hdev;
519 return test_bit(HCI_SC_ENABLED, &hdev->dev_flags) &&
520 test_bit(HCI_CONN_SC_ENABLED, &conn->flags);
521}
522
461static inline void hci_conn_hash_add(struct hci_dev *hdev, struct hci_conn *c) 523static inline void hci_conn_hash_add(struct hci_dev *hdev, struct hci_conn *c)
462{ 524{
463 struct hci_conn_hash *h = &hdev->conn_hash; 525 struct hci_conn_hash *h = &hdev->conn_hash;
@@ -521,6 +583,13 @@ static inline unsigned int hci_conn_num(struct hci_dev *hdev, __u8 type)
521 } 583 }
522} 584}
523 585
586static inline unsigned int hci_conn_count(struct hci_dev *hdev)
587{
588 struct hci_conn_hash *c = &hdev->conn_hash;
589
590 return c->acl_num + c->amp_num + c->sco_num + c->le_num;
591}
592
524static inline struct hci_conn *hci_conn_hash_lookup_handle(struct hci_dev *hdev, 593static inline struct hci_conn *hci_conn_hash_lookup_handle(struct hci_dev *hdev,
525 __u16 handle) 594 __u16 handle)
526{ 595{
@@ -594,8 +663,10 @@ void hci_chan_del(struct hci_chan *chan);
594void hci_chan_list_flush(struct hci_conn *conn); 663void hci_chan_list_flush(struct hci_conn *conn);
595struct hci_chan *hci_chan_lookup_handle(struct hci_dev *hdev, __u16 handle); 664struct hci_chan *hci_chan_lookup_handle(struct hci_dev *hdev, __u16 handle);
596 665
597struct hci_conn *hci_connect(struct hci_dev *hdev, int type, bdaddr_t *dst, 666struct hci_conn *hci_connect_le(struct hci_dev *hdev, bdaddr_t *dst,
598 __u8 dst_type, __u8 sec_level, __u8 auth_type); 667 u8 dst_type, u8 sec_level, u8 auth_type);
668struct hci_conn *hci_connect_acl(struct hci_dev *hdev, bdaddr_t *dst,
669 u8 sec_level, u8 auth_type);
599struct hci_conn *hci_connect_sco(struct hci_dev *hdev, int type, bdaddr_t *dst, 670struct hci_conn *hci_connect_sco(struct hci_dev *hdev, int type, bdaddr_t *dst,
600 __u16 setting); 671 __u16 setting);
601int hci_conn_check_link_mode(struct hci_conn *conn); 672int hci_conn_check_link_mode(struct hci_conn *conn);
@@ -606,6 +677,8 @@ int hci_conn_switch_role(struct hci_conn *conn, __u8 role);
606 677
607void hci_conn_enter_active_mode(struct hci_conn *conn, __u8 force_active); 678void hci_conn_enter_active_mode(struct hci_conn *conn, __u8 force_active);
608 679
680void hci_le_conn_failed(struct hci_conn *conn, u8 status);
681
609/* 682/*
610 * hci_conn_get() and hci_conn_put() are used to control the life-time of an 683 * hci_conn_get() and hci_conn_put() are used to control the life-time of an
611 * "hci_conn" object. They do not guarantee that the hci_conn object is running, 684 * "hci_conn" object. They do not guarantee that the hci_conn object is running,
@@ -737,31 +810,64 @@ int hci_inquiry(void __user *arg);
737 810
738struct bdaddr_list *hci_blacklist_lookup(struct hci_dev *hdev, 811struct bdaddr_list *hci_blacklist_lookup(struct hci_dev *hdev,
739 bdaddr_t *bdaddr, u8 type); 812 bdaddr_t *bdaddr, u8 type);
740int hci_blacklist_clear(struct hci_dev *hdev);
741int hci_blacklist_add(struct hci_dev *hdev, bdaddr_t *bdaddr, u8 type); 813int hci_blacklist_add(struct hci_dev *hdev, bdaddr_t *bdaddr, u8 type);
742int hci_blacklist_del(struct hci_dev *hdev, bdaddr_t *bdaddr, u8 type); 814int hci_blacklist_del(struct hci_dev *hdev, bdaddr_t *bdaddr, u8 type);
743 815
744int hci_uuids_clear(struct hci_dev *hdev); 816struct bdaddr_list *hci_white_list_lookup(struct hci_dev *hdev,
817 bdaddr_t *bdaddr, u8 type);
818void hci_white_list_clear(struct hci_dev *hdev);
819int hci_white_list_add(struct hci_dev *hdev, bdaddr_t *bdaddr, u8 type);
820int hci_white_list_del(struct hci_dev *hdev, bdaddr_t *bdaddr, u8 type);
821
822struct hci_conn_params *hci_conn_params_lookup(struct hci_dev *hdev,
823 bdaddr_t *addr, u8 addr_type);
824int hci_conn_params_add(struct hci_dev *hdev, bdaddr_t *addr, u8 addr_type,
825 u8 auto_connect, u16 conn_min_interval,
826 u16 conn_max_interval);
827void hci_conn_params_del(struct hci_dev *hdev, bdaddr_t *addr, u8 addr_type);
828void hci_conn_params_clear(struct hci_dev *hdev);
829
830struct bdaddr_list *hci_pend_le_conn_lookup(struct hci_dev *hdev,
831 bdaddr_t *addr, u8 addr_type);
832void hci_pend_le_conn_add(struct hci_dev *hdev, bdaddr_t *addr, u8 addr_type);
833void hci_pend_le_conn_del(struct hci_dev *hdev, bdaddr_t *addr, u8 addr_type);
834void hci_pend_le_conns_clear(struct hci_dev *hdev);
835
836void hci_update_background_scan(struct hci_dev *hdev);
745 837
746int hci_link_keys_clear(struct hci_dev *hdev); 838void hci_uuids_clear(struct hci_dev *hdev);
839
840void hci_link_keys_clear(struct hci_dev *hdev);
747struct link_key *hci_find_link_key(struct hci_dev *hdev, bdaddr_t *bdaddr); 841struct link_key *hci_find_link_key(struct hci_dev *hdev, bdaddr_t *bdaddr);
748int hci_add_link_key(struct hci_dev *hdev, struct hci_conn *conn, int new_key, 842int hci_add_link_key(struct hci_dev *hdev, struct hci_conn *conn, int new_key,
749 bdaddr_t *bdaddr, u8 *val, u8 type, u8 pin_len); 843 bdaddr_t *bdaddr, u8 *val, u8 type, u8 pin_len);
750struct smp_ltk *hci_find_ltk(struct hci_dev *hdev, __le16 ediv, u8 rand[8]); 844struct smp_ltk *hci_find_ltk(struct hci_dev *hdev, __le16 ediv, __le64 rand,
751int hci_add_ltk(struct hci_dev *hdev, bdaddr_t *bdaddr, u8 addr_type, u8 type, 845 bool master);
752 int new_key, u8 authenticated, u8 tk[16], u8 enc_size, 846struct smp_ltk *hci_add_ltk(struct hci_dev *hdev, bdaddr_t *bdaddr,
753 __le16 ediv, u8 rand[8]); 847 u8 addr_type, u8 type, u8 authenticated,
848 u8 tk[16], u8 enc_size, __le16 ediv, __le64 rand);
754struct smp_ltk *hci_find_ltk_by_addr(struct hci_dev *hdev, bdaddr_t *bdaddr, 849struct smp_ltk *hci_find_ltk_by_addr(struct hci_dev *hdev, bdaddr_t *bdaddr,
755 u8 addr_type); 850 u8 addr_type, bool master);
756int hci_remove_ltk(struct hci_dev *hdev, bdaddr_t *bdaddr); 851int hci_remove_ltk(struct hci_dev *hdev, bdaddr_t *bdaddr, u8 bdaddr_type);
757int hci_smp_ltks_clear(struct hci_dev *hdev); 852void hci_smp_ltks_clear(struct hci_dev *hdev);
758int hci_remove_link_key(struct hci_dev *hdev, bdaddr_t *bdaddr); 853int hci_remove_link_key(struct hci_dev *hdev, bdaddr_t *bdaddr);
759 854
760int hci_remote_oob_data_clear(struct hci_dev *hdev); 855struct smp_irk *hci_find_irk_by_rpa(struct hci_dev *hdev, bdaddr_t *rpa);
856struct smp_irk *hci_find_irk_by_addr(struct hci_dev *hdev, bdaddr_t *bdaddr,
857 u8 addr_type);
858struct smp_irk *hci_add_irk(struct hci_dev *hdev, bdaddr_t *bdaddr,
859 u8 addr_type, u8 val[16], bdaddr_t *rpa);
860void hci_remove_irk(struct hci_dev *hdev, bdaddr_t *bdaddr, u8 addr_type);
861void hci_smp_irks_clear(struct hci_dev *hdev);
862
863void hci_remote_oob_data_clear(struct hci_dev *hdev);
761struct oob_data *hci_find_remote_oob_data(struct hci_dev *hdev, 864struct oob_data *hci_find_remote_oob_data(struct hci_dev *hdev,
762 bdaddr_t *bdaddr); 865 bdaddr_t *bdaddr);
763int hci_add_remote_oob_data(struct hci_dev *hdev, bdaddr_t *bdaddr, u8 *hash, 866int hci_add_remote_oob_data(struct hci_dev *hdev, bdaddr_t *bdaddr,
764 u8 *randomizer); 867 u8 *hash, u8 *randomizer);
868int hci_add_remote_oob_ext_data(struct hci_dev *hdev, bdaddr_t *bdaddr,
869 u8 *hash192, u8 *randomizer192,
870 u8 *hash256, u8 *randomizer256);
765int hci_remove_remote_oob_data(struct hci_dev *hdev, bdaddr_t *bdaddr); 871int hci_remove_remote_oob_data(struct hci_dev *hdev, bdaddr_t *bdaddr);
766 872
767void hci_event_packet(struct hci_dev *hdev, struct sk_buff *skb); 873void hci_event_packet(struct hci_dev *hdev, struct sk_buff *skb);
@@ -803,9 +909,12 @@ void hci_conn_del_sysfs(struct hci_conn *conn);
803#define lmp_csb_slave_capable(dev) ((dev)->features[2][0] & LMP_CSB_SLAVE) 909#define lmp_csb_slave_capable(dev) ((dev)->features[2][0] & LMP_CSB_SLAVE)
804#define lmp_sync_train_capable(dev) ((dev)->features[2][0] & LMP_SYNC_TRAIN) 910#define lmp_sync_train_capable(dev) ((dev)->features[2][0] & LMP_SYNC_TRAIN)
805#define lmp_sync_scan_capable(dev) ((dev)->features[2][0] & LMP_SYNC_SCAN) 911#define lmp_sync_scan_capable(dev) ((dev)->features[2][0] & LMP_SYNC_SCAN)
912#define lmp_sc_capable(dev) ((dev)->features[2][1] & LMP_SC)
913#define lmp_ping_capable(dev) ((dev)->features[2][1] & LMP_PING)
806 914
807/* ----- Host capabilities ----- */ 915/* ----- Host capabilities ----- */
808#define lmp_host_ssp_capable(dev) ((dev)->features[1][0] & LMP_HOST_SSP) 916#define lmp_host_ssp_capable(dev) ((dev)->features[1][0] & LMP_HOST_SSP)
917#define lmp_host_sc_capable(dev) ((dev)->features[1][0] & LMP_HOST_SC)
809#define lmp_host_le_capable(dev) (!!((dev)->features[1][0] & LMP_HOST_LE)) 918#define lmp_host_le_capable(dev) (!!((dev)->features[1][0] & LMP_HOST_LE))
810#define lmp_host_le_br_capable(dev) (!!((dev)->features[1][0] & LMP_HOST_LE_BREDR)) 919#define lmp_host_le_br_capable(dev) (!!((dev)->features[1][0] & LMP_HOST_LE_BREDR))
811 920
@@ -1019,6 +1128,26 @@ static inline bool eir_has_data_type(u8 *data, size_t data_len, u8 type)
1019 return false; 1128 return false;
1020} 1129}
1021 1130
1131static inline bool hci_bdaddr_is_rpa(bdaddr_t *bdaddr, u8 addr_type)
1132{
1133 if (addr_type != 0x01)
1134 return false;
1135
1136 if ((bdaddr->b[5] & 0xc0) == 0x40)
1137 return true;
1138
1139 return false;
1140}
1141
1142static inline struct smp_irk *hci_get_irk(struct hci_dev *hdev,
1143 bdaddr_t *bdaddr, u8 addr_type)
1144{
1145 if (!hci_bdaddr_is_rpa(bdaddr, addr_type))
1146 return NULL;
1147
1148 return hci_find_irk_by_rpa(hdev, bdaddr);
1149}
1150
1022int hci_register_cb(struct hci_cb *hcb); 1151int hci_register_cb(struct hci_cb *hcb);
1023int hci_unregister_cb(struct hci_cb *hcb); 1152int hci_unregister_cb(struct hci_cb *hcb);
1024 1153
@@ -1040,6 +1169,9 @@ void hci_req_add_ev(struct hci_request *req, u16 opcode, u32 plen,
1040 const void *param, u8 event); 1169 const void *param, u8 event);
1041void hci_req_cmd_complete(struct hci_dev *hdev, u16 opcode, u8 status); 1170void hci_req_cmd_complete(struct hci_dev *hdev, u16 opcode, u8 status);
1042 1171
1172void hci_req_add_le_scan_disable(struct hci_request *req);
1173void hci_req_add_le_passive_scan(struct hci_request *req);
1174
1043struct sk_buff *__hci_cmd_sync(struct hci_dev *hdev, u16 opcode, u32 plen, 1175struct sk_buff *__hci_cmd_sync(struct hci_dev *hdev, u16 opcode, u32 plen,
1044 const void *param, u32 timeout); 1176 const void *param, u32 timeout);
1045struct sk_buff *__hci_cmd_sync_ev(struct hci_dev *hdev, u16 opcode, u32 plen, 1177struct sk_buff *__hci_cmd_sync_ev(struct hci_dev *hdev, u16 opcode, u32 plen,
@@ -1085,6 +1217,7 @@ int mgmt_powered(struct hci_dev *hdev, u8 powered);
1085void mgmt_discoverable_timeout(struct hci_dev *hdev); 1217void mgmt_discoverable_timeout(struct hci_dev *hdev);
1086void mgmt_discoverable(struct hci_dev *hdev, u8 discoverable); 1218void mgmt_discoverable(struct hci_dev *hdev, u8 discoverable);
1087void mgmt_connectable(struct hci_dev *hdev, u8 connectable); 1219void mgmt_connectable(struct hci_dev *hdev, u8 connectable);
1220void mgmt_advertising(struct hci_dev *hdev, u8 advertising);
1088void mgmt_write_scan_failed(struct hci_dev *hdev, u8 scan, u8 status); 1221void mgmt_write_scan_failed(struct hci_dev *hdev, u8 scan, u8 status);
1089void mgmt_new_link_key(struct hci_dev *hdev, struct link_key *key, 1222void mgmt_new_link_key(struct hci_dev *hdev, struct link_key *key,
1090 bool persistent); 1223 bool persistent);
@@ -1092,7 +1225,8 @@ void mgmt_device_connected(struct hci_dev *hdev, bdaddr_t *bdaddr, u8 link_type,
1092 u8 addr_type, u32 flags, u8 *name, u8 name_len, 1225 u8 addr_type, u32 flags, u8 *name, u8 name_len,
1093 u8 *dev_class); 1226 u8 *dev_class);
1094void mgmt_device_disconnected(struct hci_dev *hdev, bdaddr_t *bdaddr, 1227void mgmt_device_disconnected(struct hci_dev *hdev, bdaddr_t *bdaddr,
1095 u8 link_type, u8 addr_type, u8 reason); 1228 u8 link_type, u8 addr_type, u8 reason,
1229 bool mgmt_connected);
1096void mgmt_disconnect_failed(struct hci_dev *hdev, bdaddr_t *bdaddr, 1230void mgmt_disconnect_failed(struct hci_dev *hdev, bdaddr_t *bdaddr,
1097 u8 link_type, u8 addr_type, u8 status); 1231 u8 link_type, u8 addr_type, u8 status);
1098void mgmt_connect_failed(struct hci_dev *hdev, bdaddr_t *bdaddr, u8 link_type, 1232void mgmt_connect_failed(struct hci_dev *hdev, bdaddr_t *bdaddr, u8 link_type,
@@ -1103,7 +1237,7 @@ void mgmt_pin_code_reply_complete(struct hci_dev *hdev, bdaddr_t *bdaddr,
1103void mgmt_pin_code_neg_reply_complete(struct hci_dev *hdev, bdaddr_t *bdaddr, 1237void mgmt_pin_code_neg_reply_complete(struct hci_dev *hdev, bdaddr_t *bdaddr,
1104 u8 status); 1238 u8 status);
1105int mgmt_user_confirm_request(struct hci_dev *hdev, bdaddr_t *bdaddr, 1239int mgmt_user_confirm_request(struct hci_dev *hdev, bdaddr_t *bdaddr,
1106 u8 link_type, u8 addr_type, __le32 value, 1240 u8 link_type, u8 addr_type, u32 value,
1107 u8 confirm_hint); 1241 u8 confirm_hint);
1108int mgmt_user_confirm_reply_complete(struct hci_dev *hdev, bdaddr_t *bdaddr, 1242int mgmt_user_confirm_reply_complete(struct hci_dev *hdev, bdaddr_t *bdaddr,
1109 u8 link_type, u8 addr_type, u8 status); 1243 u8 link_type, u8 addr_type, u8 status);
@@ -1122,11 +1256,13 @@ void mgmt_auth_failed(struct hci_dev *hdev, bdaddr_t *bdaddr, u8 link_type,
1122 u8 addr_type, u8 status); 1256 u8 addr_type, u8 status);
1123void mgmt_auth_enable_complete(struct hci_dev *hdev, u8 status); 1257void mgmt_auth_enable_complete(struct hci_dev *hdev, u8 status);
1124void mgmt_ssp_enable_complete(struct hci_dev *hdev, u8 enable, u8 status); 1258void mgmt_ssp_enable_complete(struct hci_dev *hdev, u8 enable, u8 status);
1259void mgmt_sc_enable_complete(struct hci_dev *hdev, u8 enable, u8 status);
1125void mgmt_set_class_of_dev_complete(struct hci_dev *hdev, u8 *dev_class, 1260void mgmt_set_class_of_dev_complete(struct hci_dev *hdev, u8 *dev_class,
1126 u8 status); 1261 u8 status);
1127void mgmt_set_local_name_complete(struct hci_dev *hdev, u8 *name, u8 status); 1262void mgmt_set_local_name_complete(struct hci_dev *hdev, u8 *name, u8 status);
1128void mgmt_read_local_oob_data_reply_complete(struct hci_dev *hdev, u8 *hash, 1263void mgmt_read_local_oob_data_complete(struct hci_dev *hdev, u8 *hash192,
1129 u8 *randomizer, u8 status); 1264 u8 *randomizer192, u8 *hash256,
1265 u8 *randomizer256, u8 status);
1130void mgmt_device_found(struct hci_dev *hdev, bdaddr_t *bdaddr, u8 link_type, 1266void mgmt_device_found(struct hci_dev *hdev, bdaddr_t *bdaddr, u8 link_type,
1131 u8 addr_type, u8 *dev_class, s8 rssi, u8 cfm_name, 1267 u8 addr_type, u8 *dev_class, s8 rssi, u8 cfm_name,
1132 u8 ssp, u8 *eir, u16 eir_len); 1268 u8 ssp, u8 *eir, u16 eir_len);
@@ -1135,8 +1271,12 @@ void mgmt_remote_name(struct hci_dev *hdev, bdaddr_t *bdaddr, u8 link_type,
1135void mgmt_discovering(struct hci_dev *hdev, u8 discovering); 1271void mgmt_discovering(struct hci_dev *hdev, u8 discovering);
1136int mgmt_device_blocked(struct hci_dev *hdev, bdaddr_t *bdaddr, u8 type); 1272int mgmt_device_blocked(struct hci_dev *hdev, bdaddr_t *bdaddr, u8 type);
1137int mgmt_device_unblocked(struct hci_dev *hdev, bdaddr_t *bdaddr, u8 type); 1273int mgmt_device_unblocked(struct hci_dev *hdev, bdaddr_t *bdaddr, u8 type);
1138void mgmt_new_ltk(struct hci_dev *hdev, struct smp_ltk *key, u8 persistent); 1274void mgmt_new_ltk(struct hci_dev *hdev, struct smp_ltk *key, bool persistent);
1275void mgmt_new_irk(struct hci_dev *hdev, struct smp_irk *irk);
1276void mgmt_new_csrk(struct hci_dev *hdev, struct smp_csrk *csrk,
1277 bool persistent);
1139void mgmt_reenable_advertising(struct hci_dev *hdev); 1278void mgmt_reenable_advertising(struct hci_dev *hdev);
1279void mgmt_smp_complete(struct hci_conn *conn, bool complete);
1140 1280
1141/* HCI info for socket */ 1281/* HCI info for socket */
1142#define hci_pi(sk) ((struct hci_pinfo *) sk) 1282#define hci_pi(sk) ((struct hci_pinfo *) sk)
@@ -1168,9 +1308,14 @@ struct hci_sec_filter {
1168 1308
1169void hci_le_conn_update(struct hci_conn *conn, u16 min, u16 max, 1309void hci_le_conn_update(struct hci_conn *conn, u16 min, u16 max,
1170 u16 latency, u16 to_multiplier); 1310 u16 latency, u16 to_multiplier);
1171void hci_le_start_enc(struct hci_conn *conn, __le16 ediv, __u8 rand[8], 1311void hci_le_start_enc(struct hci_conn *conn, __le16 ediv, __le64 rand,
1172 __u8 ltk[16]); 1312 __u8 ltk[16]);
1173 1313
1314int hci_update_random_address(struct hci_request *req, bool require_privacy,
1315 u8 *own_addr_type);
1316void hci_copy_identity_address(struct hci_dev *hdev, bdaddr_t *bdaddr,
1317 u8 *bdaddr_type);
1318
1174#define SCO_AIRMODE_MASK 0x0003 1319#define SCO_AIRMODE_MASK 0x0003
1175#define SCO_AIRMODE_CVSD 0x0000 1320#define SCO_AIRMODE_CVSD 0x0000
1176#define SCO_AIRMODE_TRANSP 0x0003 1321#define SCO_AIRMODE_TRANSP 0x0003
diff --git a/include/net/bluetooth/l2cap.h b/include/net/bluetooth/l2cap.h
index dbc4a89984ca..4abdcb220e3a 100644
--- a/include/net/bluetooth/l2cap.h
+++ b/include/net/bluetooth/l2cap.h
@@ -91,6 +91,7 @@ struct l2cap_conninfo {
91#define L2CAP_LM_TRUSTED 0x0008 91#define L2CAP_LM_TRUSTED 0x0008
92#define L2CAP_LM_RELIABLE 0x0010 92#define L2CAP_LM_RELIABLE 0x0010
93#define L2CAP_LM_SECURE 0x0020 93#define L2CAP_LM_SECURE 0x0020
94#define L2CAP_LM_FIPS 0x0040
94 95
95/* L2CAP command codes */ 96/* L2CAP command codes */
96#define L2CAP_COMMAND_REJ 0x01 97#define L2CAP_COMMAND_REJ 0x01
@@ -623,6 +624,9 @@ struct l2cap_conn {
623 __u32 rx_len; 624 __u32 rx_len;
624 __u8 tx_ident; 625 __u8 tx_ident;
625 626
627 struct sk_buff_head pending_rx;
628 struct work_struct pending_rx_work;
629
626 __u8 disc_reason; 630 __u8 disc_reason;
627 631
628 struct delayed_work security_timer; 632 struct delayed_work security_timer;
@@ -647,7 +651,7 @@ struct l2cap_user {
647#define L2CAP_CHAN_RAW 1 651#define L2CAP_CHAN_RAW 1
648#define L2CAP_CHAN_CONN_LESS 2 652#define L2CAP_CHAN_CONN_LESS 2
649#define L2CAP_CHAN_CONN_ORIENTED 3 653#define L2CAP_CHAN_CONN_ORIENTED 3
650#define L2CAP_CHAN_CONN_FIX_A2MP 4 654#define L2CAP_CHAN_FIXED 4
651 655
652/* ----- L2CAP socket info ----- */ 656/* ----- L2CAP socket info ----- */
653#define l2cap_pi(sk) ((struct l2cap_pinfo *) sk) 657#define l2cap_pi(sk) ((struct l2cap_pinfo *) sk)
@@ -853,7 +857,6 @@ static inline long l2cap_chan_no_get_sndtimeo(struct l2cap_chan *chan)
853} 857}
854 858
855extern bool disable_ertm; 859extern bool disable_ertm;
856extern bool enable_lecoc;
857 860
858int l2cap_init_sockets(void); 861int l2cap_init_sockets(void);
859void l2cap_cleanup_sockets(void); 862void l2cap_cleanup_sockets(void);
@@ -878,6 +881,7 @@ int l2cap_ertm_init(struct l2cap_chan *chan);
878void l2cap_chan_add(struct l2cap_conn *conn, struct l2cap_chan *chan); 881void l2cap_chan_add(struct l2cap_conn *conn, struct l2cap_chan *chan);
879void __l2cap_chan_add(struct l2cap_conn *conn, struct l2cap_chan *chan); 882void __l2cap_chan_add(struct l2cap_conn *conn, struct l2cap_chan *chan);
880void l2cap_chan_del(struct l2cap_chan *chan, int err); 883void l2cap_chan_del(struct l2cap_chan *chan, int err);
884void l2cap_conn_update_id_addr(struct hci_conn *hcon);
881void l2cap_send_conn_req(struct l2cap_chan *chan); 885void l2cap_send_conn_req(struct l2cap_chan *chan);
882void l2cap_move_start(struct l2cap_chan *chan); 886void l2cap_move_start(struct l2cap_chan *chan);
883void l2cap_logical_cfm(struct l2cap_chan *chan, struct hci_chan *hchan, 887void l2cap_logical_cfm(struct l2cap_chan *chan, struct hci_chan *hchan,
diff --git a/include/net/bluetooth/mgmt.h b/include/net/bluetooth/mgmt.h
index 518c5c84e39a..d4b571c2f9fd 100644
--- a/include/net/bluetooth/mgmt.h
+++ b/include/net/bluetooth/mgmt.h
@@ -94,6 +94,9 @@ struct mgmt_rp_read_index_list {
94#define MGMT_SETTING_HS 0x00000100 94#define MGMT_SETTING_HS 0x00000100
95#define MGMT_SETTING_LE 0x00000200 95#define MGMT_SETTING_LE 0x00000200
96#define MGMT_SETTING_ADVERTISING 0x00000400 96#define MGMT_SETTING_ADVERTISING 0x00000400
97#define MGMT_SETTING_SECURE_CONN 0x00000800
98#define MGMT_SETTING_DEBUG_KEYS 0x00001000
99#define MGMT_SETTING_PRIVACY 0x00002000
97 100
98#define MGMT_OP_READ_INFO 0x0004 101#define MGMT_OP_READ_INFO 0x0004
99#define MGMT_READ_INFO_SIZE 0 102#define MGMT_READ_INFO_SIZE 0
@@ -180,11 +183,11 @@ struct mgmt_cp_load_link_keys {
180 183
181struct mgmt_ltk_info { 184struct mgmt_ltk_info {
182 struct mgmt_addr_info addr; 185 struct mgmt_addr_info addr;
183 __u8 authenticated; 186 __u8 type;
184 __u8 master; 187 __u8 master;
185 __u8 enc_size; 188 __u8 enc_size;
186 __le16 ediv; 189 __le16 ediv;
187 __u8 rand[8]; 190 __le64 rand;
188 __u8 val[16]; 191 __u8 val[16];
189} __packed; 192} __packed;
190 193
@@ -294,6 +297,12 @@ struct mgmt_rp_read_local_oob_data {
294 __u8 hash[16]; 297 __u8 hash[16];
295 __u8 randomizer[16]; 298 __u8 randomizer[16];
296} __packed; 299} __packed;
300struct mgmt_rp_read_local_oob_ext_data {
301 __u8 hash192[16];
302 __u8 randomizer192[16];
303 __u8 hash256[16];
304 __u8 randomizer256[16];
305} __packed;
297 306
298#define MGMT_OP_ADD_REMOTE_OOB_DATA 0x0021 307#define MGMT_OP_ADD_REMOTE_OOB_DATA 0x0021
299struct mgmt_cp_add_remote_oob_data { 308struct mgmt_cp_add_remote_oob_data {
@@ -302,6 +311,14 @@ struct mgmt_cp_add_remote_oob_data {
302 __u8 randomizer[16]; 311 __u8 randomizer[16];
303} __packed; 312} __packed;
304#define MGMT_ADD_REMOTE_OOB_DATA_SIZE (MGMT_ADDR_INFO_SIZE + 32) 313#define MGMT_ADD_REMOTE_OOB_DATA_SIZE (MGMT_ADDR_INFO_SIZE + 32)
314struct mgmt_cp_add_remote_oob_ext_data {
315 struct mgmt_addr_info addr;
316 __u8 hash192[16];
317 __u8 randomizer192[16];
318 __u8 hash256[16];
319 __u8 randomizer256[16];
320} __packed;
321#define MGMT_ADD_REMOTE_OOB_EXT_DATA_SIZE (MGMT_ADDR_INFO_SIZE + 64)
305 322
306#define MGMT_OP_REMOVE_REMOTE_OOB_DATA 0x0022 323#define MGMT_OP_REMOVE_REMOTE_OOB_DATA 0x0022
307struct mgmt_cp_remove_remote_oob_data { 324struct mgmt_cp_remove_remote_oob_data {
@@ -369,6 +386,29 @@ struct mgmt_cp_set_scan_params {
369} __packed; 386} __packed;
370#define MGMT_SET_SCAN_PARAMS_SIZE 4 387#define MGMT_SET_SCAN_PARAMS_SIZE 4
371 388
389#define MGMT_OP_SET_SECURE_CONN 0x002D
390
391#define MGMT_OP_SET_DEBUG_KEYS 0x002E
392
393#define MGMT_OP_SET_PRIVACY 0x002F
394struct mgmt_cp_set_privacy {
395 __u8 privacy;
396 __u8 irk[16];
397} __packed;
398#define MGMT_SET_PRIVACY_SIZE 17
399
400struct mgmt_irk_info {
401 struct mgmt_addr_info addr;
402 __u8 val[16];
403} __packed;
404
405#define MGMT_OP_LOAD_IRKS 0x0030
406struct mgmt_cp_load_irks {
407 __le16 irk_count;
408 struct mgmt_irk_info irks[0];
409} __packed;
410#define MGMT_LOAD_IRKS_SIZE 2
411
372#define MGMT_EV_CMD_COMPLETE 0x0001 412#define MGMT_EV_CMD_COMPLETE 0x0001
373struct mgmt_ev_cmd_complete { 413struct mgmt_ev_cmd_complete {
374 __le16 opcode; 414 __le16 opcode;
@@ -504,3 +544,22 @@ struct mgmt_ev_passkey_notify {
504 __le32 passkey; 544 __le32 passkey;
505 __u8 entered; 545 __u8 entered;
506} __packed; 546} __packed;
547
548#define MGMT_EV_NEW_IRK 0x0018
549struct mgmt_ev_new_irk {
550 __u8 store_hint;
551 bdaddr_t rpa;
552 struct mgmt_irk_info irk;
553} __packed;
554
555struct mgmt_csrk_info {
556 struct mgmt_addr_info addr;
557 __u8 master;
558 __u8 val[16];
559} __packed;
560
561#define MGMT_EV_NEW_CSRK 0x0019
562struct mgmt_ev_new_csrk {
563 __u8 store_hint;
564 struct mgmt_csrk_info key;
565} __packed;
diff --git a/include/net/bluetooth/rfcomm.h b/include/net/bluetooth/rfcomm.h
index 486213a1aed8..2611cc389d7d 100644
--- a/include/net/bluetooth/rfcomm.h
+++ b/include/net/bluetooth/rfcomm.h
@@ -238,9 +238,11 @@ int rfcomm_dlc_open(struct rfcomm_dlc *d, bdaddr_t *src, bdaddr_t *dst,
238 u8 channel); 238 u8 channel);
239int rfcomm_dlc_close(struct rfcomm_dlc *d, int reason); 239int rfcomm_dlc_close(struct rfcomm_dlc *d, int reason);
240int rfcomm_dlc_send(struct rfcomm_dlc *d, struct sk_buff *skb); 240int rfcomm_dlc_send(struct rfcomm_dlc *d, struct sk_buff *skb);
241void rfcomm_dlc_send_noerror(struct rfcomm_dlc *d, struct sk_buff *skb);
241int rfcomm_dlc_set_modem_status(struct rfcomm_dlc *d, u8 v24_sig); 242int rfcomm_dlc_set_modem_status(struct rfcomm_dlc *d, u8 v24_sig);
242int rfcomm_dlc_get_modem_status(struct rfcomm_dlc *d, u8 *v24_sig); 243int rfcomm_dlc_get_modem_status(struct rfcomm_dlc *d, u8 *v24_sig);
243void rfcomm_dlc_accept(struct rfcomm_dlc *d); 244void rfcomm_dlc_accept(struct rfcomm_dlc *d);
245struct rfcomm_dlc *rfcomm_dlc_exists(bdaddr_t *src, bdaddr_t *dst, u8 channel);
244 246
245#define rfcomm_dlc_lock(d) spin_lock(&d->lock) 247#define rfcomm_dlc_lock(d) spin_lock(&d->lock)
246#define rfcomm_dlc_unlock(d) spin_unlock(&d->lock) 248#define rfcomm_dlc_unlock(d) spin_unlock(&d->lock)
@@ -295,6 +297,7 @@ struct rfcomm_conninfo {
295#define RFCOMM_LM_TRUSTED 0x0008 297#define RFCOMM_LM_TRUSTED 0x0008
296#define RFCOMM_LM_RELIABLE 0x0010 298#define RFCOMM_LM_RELIABLE 0x0010
297#define RFCOMM_LM_SECURE 0x0020 299#define RFCOMM_LM_SECURE 0x0020
300#define RFCOMM_LM_FIPS 0x0040
298 301
299#define rfcomm_pi(sk) ((struct rfcomm_pinfo *) sk) 302#define rfcomm_pi(sk) ((struct rfcomm_pinfo *) sk)
300 303
@@ -323,11 +326,16 @@ int rfcomm_connect_ind(struct rfcomm_session *s, u8 channel,
323#define RFCOMMGETDEVINFO _IOR('R', 211, int) 326#define RFCOMMGETDEVINFO _IOR('R', 211, int)
324#define RFCOMMSTEALDLC _IOW('R', 220, int) 327#define RFCOMMSTEALDLC _IOW('R', 220, int)
325 328
329/* rfcomm_dev.flags bit definitions */
326#define RFCOMM_REUSE_DLC 0 330#define RFCOMM_REUSE_DLC 0
327#define RFCOMM_RELEASE_ONHUP 1 331#define RFCOMM_RELEASE_ONHUP 1
328#define RFCOMM_HANGUP_NOW 2 332#define RFCOMM_HANGUP_NOW 2
329#define RFCOMM_TTY_ATTACHED 3 333#define RFCOMM_TTY_ATTACHED 3
330#define RFCOMM_TTY_RELEASED 4 334#define RFCOMM_DEFUNCT_BIT4 4 /* don't reuse this bit - userspace visible */
335
336/* rfcomm_dev.status bit definitions */
337#define RFCOMM_DEV_RELEASED 0
338#define RFCOMM_TTY_OWNED 1
331 339
332struct rfcomm_dev_req { 340struct rfcomm_dev_req {
333 s16 dev_id; 341 s16 dev_id;
diff --git a/include/net/cfg80211.h b/include/net/cfg80211.h
index b1f84b05c67e..f3539a15c411 100644
--- a/include/net/cfg80211.h
+++ b/include/net/cfg80211.h
@@ -151,6 +151,7 @@ enum ieee80211_channel_flags {
151 * @dfs_state: current state of this channel. Only relevant if radar is required 151 * @dfs_state: current state of this channel. Only relevant if radar is required
152 * on this channel. 152 * on this channel.
153 * @dfs_state_entered: timestamp (jiffies) when the dfs state was entered. 153 * @dfs_state_entered: timestamp (jiffies) when the dfs state was entered.
154 * @dfs_cac_ms: DFS CAC time in milliseconds, this is valid for DFS channels.
154 */ 155 */
155struct ieee80211_channel { 156struct ieee80211_channel {
156 enum ieee80211_band band; 157 enum ieee80211_band band;
@@ -165,6 +166,7 @@ struct ieee80211_channel {
165 int orig_mag, orig_mpwr; 166 int orig_mag, orig_mpwr;
166 enum nl80211_dfs_state dfs_state; 167 enum nl80211_dfs_state dfs_state;
167 unsigned long dfs_state_entered; 168 unsigned long dfs_state_entered;
169 unsigned int dfs_cac_ms;
168}; 170};
169 171
170/** 172/**
@@ -1394,10 +1396,12 @@ struct cfg80211_scan_request {
1394/** 1396/**
1395 * struct cfg80211_match_set - sets of attributes to match 1397 * struct cfg80211_match_set - sets of attributes to match
1396 * 1398 *
1397 * @ssid: SSID to be matched 1399 * @ssid: SSID to be matched; may be zero-length for no match (RSSI only)
1400 * @rssi_thold: don't report scan results below this threshold (in s32 dBm)
1398 */ 1401 */
1399struct cfg80211_match_set { 1402struct cfg80211_match_set {
1400 struct cfg80211_ssid ssid; 1403 struct cfg80211_ssid ssid;
1404 s32 rssi_thold;
1401}; 1405};
1402 1406
1403/** 1407/**
@@ -1420,7 +1424,8 @@ struct cfg80211_match_set {
1420 * @dev: the interface 1424 * @dev: the interface
1421 * @scan_start: start time of the scheduled scan 1425 * @scan_start: start time of the scheduled scan
1422 * @channels: channels to scan 1426 * @channels: channels to scan
1423 * @rssi_thold: don't report scan results below this threshold (in s32 dBm) 1427 * @min_rssi_thold: for drivers only supporting a single threshold, this
1428 * contains the minimum over all matchsets
1424 */ 1429 */
1425struct cfg80211_sched_scan_request { 1430struct cfg80211_sched_scan_request {
1426 struct cfg80211_ssid *ssids; 1431 struct cfg80211_ssid *ssids;
@@ -1433,7 +1438,7 @@ struct cfg80211_sched_scan_request {
1433 u32 flags; 1438 u32 flags;
1434 struct cfg80211_match_set *match_sets; 1439 struct cfg80211_match_set *match_sets;
1435 int n_match_sets; 1440 int n_match_sets;
1436 s32 rssi_thold; 1441 s32 min_rssi_thold;
1437 1442
1438 /* internal */ 1443 /* internal */
1439 struct wiphy *wiphy; 1444 struct wiphy *wiphy;
@@ -1701,8 +1706,14 @@ struct cfg80211_ibss_params {
1701 * 1706 *
1702 * @channel: The channel to use or %NULL if not specified (auto-select based 1707 * @channel: The channel to use or %NULL if not specified (auto-select based
1703 * on scan results) 1708 * on scan results)
1709 * @channel_hint: The channel of the recommended BSS for initial connection or
1710 * %NULL if not specified
1704 * @bssid: The AP BSSID or %NULL if not specified (auto-select based on scan 1711 * @bssid: The AP BSSID or %NULL if not specified (auto-select based on scan
1705 * results) 1712 * results)
1713 * @bssid_hint: The recommended AP BSSID for initial connection to the BSS or
1714 * %NULL if not specified. Unlike the @bssid parameter, the driver is
1715 * allowed to ignore this @bssid_hint if it has knowledge of a better BSS
1716 * to use.
1706 * @ssid: SSID 1717 * @ssid: SSID
1707 * @ssid_len: Length of ssid in octets 1718 * @ssid_len: Length of ssid in octets
1708 * @auth_type: Authentication type (algorithm) 1719 * @auth_type: Authentication type (algorithm)
@@ -1725,11 +1736,13 @@ struct cfg80211_ibss_params {
1725 */ 1736 */
1726struct cfg80211_connect_params { 1737struct cfg80211_connect_params {
1727 struct ieee80211_channel *channel; 1738 struct ieee80211_channel *channel;
1728 u8 *bssid; 1739 struct ieee80211_channel *channel_hint;
1729 u8 *ssid; 1740 const u8 *bssid;
1741 const u8 *bssid_hint;
1742 const u8 *ssid;
1730 size_t ssid_len; 1743 size_t ssid_len;
1731 enum nl80211_auth_type auth_type; 1744 enum nl80211_auth_type auth_type;
1732 u8 *ie; 1745 const u8 *ie;
1733 size_t ie_len; 1746 size_t ie_len;
1734 bool privacy; 1747 bool privacy;
1735 enum nl80211_mfp mfp; 1748 enum nl80211_mfp mfp;
@@ -1768,6 +1781,7 @@ struct cfg80211_bitrate_mask {
1768 u32 legacy; 1781 u32 legacy;
1769 u8 ht_mcs[IEEE80211_HT_MCS_MASK_LEN]; 1782 u8 ht_mcs[IEEE80211_HT_MCS_MASK_LEN];
1770 u16 vht_mcs[NL80211_VHT_NSS_MAX]; 1783 u16 vht_mcs[NL80211_VHT_NSS_MAX];
1784 enum nl80211_txrate_gi gi;
1771 } control[IEEE80211_NUM_BANDS]; 1785 } control[IEEE80211_NUM_BANDS];
1772}; 1786};
1773/** 1787/**
@@ -2194,7 +2208,12 @@ struct cfg80211_qos_map {
2194 * @set_cqm_txe_config: Configure connection quality monitor TX error 2208 * @set_cqm_txe_config: Configure connection quality monitor TX error
2195 * thresholds. 2209 * thresholds.
2196 * @sched_scan_start: Tell the driver to start a scheduled scan. 2210 * @sched_scan_start: Tell the driver to start a scheduled scan.
2197 * @sched_scan_stop: Tell the driver to stop an ongoing scheduled scan. 2211 * @sched_scan_stop: Tell the driver to stop an ongoing scheduled scan. This
2212 * call must stop the scheduled scan and be ready for starting a new one
2213 * before it returns, i.e. @sched_scan_start may be called immediately
2214 * after that again and should not fail in that case. The driver should
2215 * not call cfg80211_sched_scan_stopped() for a requested stop (when this
2216 * method returns 0.)
2198 * 2217 *
2199 * @mgmt_frame_register: Notify driver that a management frame type was 2218 * @mgmt_frame_register: Notify driver that a management frame type was
2200 * registered. Note that this callback may not sleep, and cannot run 2219 * registered. Note that this callback may not sleep, and cannot run
@@ -2453,7 +2472,8 @@ struct cfg80211_ops {
2453 2472
2454 int (*tdls_mgmt)(struct wiphy *wiphy, struct net_device *dev, 2473 int (*tdls_mgmt)(struct wiphy *wiphy, struct net_device *dev,
2455 u8 *peer, u8 action_code, u8 dialog_token, 2474 u8 *peer, u8 action_code, u8 dialog_token,
2456 u16 status_code, const u8 *buf, size_t len); 2475 u16 status_code, u32 peer_capability,
2476 const u8 *buf, size_t len);
2457 int (*tdls_oper)(struct wiphy *wiphy, struct net_device *dev, 2477 int (*tdls_oper)(struct wiphy *wiphy, struct net_device *dev,
2458 u8 *peer, enum nl80211_tdls_operation oper); 2478 u8 *peer, enum nl80211_tdls_operation oper);
2459 2479
@@ -2485,7 +2505,8 @@ struct cfg80211_ops {
2485 2505
2486 int (*start_radar_detection)(struct wiphy *wiphy, 2506 int (*start_radar_detection)(struct wiphy *wiphy,
2487 struct net_device *dev, 2507 struct net_device *dev,
2488 struct cfg80211_chan_def *chandef); 2508 struct cfg80211_chan_def *chandef,
2509 u32 cac_time_ms);
2489 int (*update_ft_ies)(struct wiphy *wiphy, struct net_device *dev, 2510 int (*update_ft_ies)(struct wiphy *wiphy, struct net_device *dev,
2490 struct cfg80211_update_ft_ies_params *ftie); 2511 struct cfg80211_update_ft_ies_params *ftie);
2491 int (*crit_proto_start)(struct wiphy *wiphy, 2512 int (*crit_proto_start)(struct wiphy *wiphy,
@@ -2598,9 +2619,12 @@ struct ieee80211_iface_limit {
2598 * only in special cases. 2619 * only in special cases.
2599 * @radar_detect_widths: bitmap of channel widths supported for radar detection 2620 * @radar_detect_widths: bitmap of channel widths supported for radar detection
2600 * 2621 *
2601 * These examples can be expressed as follows: 2622 * With this structure the driver can describe which interface
2623 * combinations it supports concurrently.
2624 *
2625 * Examples:
2602 * 2626 *
2603 * Allow #STA <= 1, #AP <= 1, matching BI, channels = 1, 2 total: 2627 * 1. Allow #STA <= 1, #AP <= 1, matching BI, channels = 1, 2 total:
2604 * 2628 *
2605 * struct ieee80211_iface_limit limits1[] = { 2629 * struct ieee80211_iface_limit limits1[] = {
2606 * { .max = 1, .types = BIT(NL80211_IFTYPE_STATION), }, 2630 * { .max = 1, .types = BIT(NL80211_IFTYPE_STATION), },
@@ -2614,7 +2638,7 @@ struct ieee80211_iface_limit {
2614 * }; 2638 * };
2615 * 2639 *
2616 * 2640 *
2617 * Allow #{AP, P2P-GO} <= 8, channels = 1, 8 total: 2641 * 2. Allow #{AP, P2P-GO} <= 8, channels = 1, 8 total:
2618 * 2642 *
2619 * struct ieee80211_iface_limit limits2[] = { 2643 * struct ieee80211_iface_limit limits2[] = {
2620 * { .max = 8, .types = BIT(NL80211_IFTYPE_AP) | 2644 * { .max = 8, .types = BIT(NL80211_IFTYPE_AP) |
@@ -2628,7 +2652,8 @@ struct ieee80211_iface_limit {
2628 * }; 2652 * };
2629 * 2653 *
2630 * 2654 *
2631 * Allow #STA <= 1, #{P2P-client,P2P-GO} <= 3 on two channels, 4 total. 2655 * 3. Allow #STA <= 1, #{P2P-client,P2P-GO} <= 3 on two channels, 4 total.
2656 *
2632 * This allows for an infrastructure connection and three P2P connections. 2657 * This allows for an infrastructure connection and three P2P connections.
2633 * 2658 *
2634 * struct ieee80211_iface_limit limits3[] = { 2659 * struct ieee80211_iface_limit limits3[] = {
@@ -2778,7 +2803,7 @@ struct wiphy_vendor_command {
2778 * @perm_addr: permanent MAC address of this device 2803 * @perm_addr: permanent MAC address of this device
2779 * @addr_mask: If the device supports multiple MAC addresses by masking, 2804 * @addr_mask: If the device supports multiple MAC addresses by masking,
2780 * set this to a mask with variable bits set to 1, e.g. if the last 2805 * set this to a mask with variable bits set to 1, e.g. if the last
2781 * four bits are variable then set it to 00:...:00:0f. The actual 2806 * four bits are variable then set it to 00-00-00-00-00-0f. The actual
2782 * variable bits shall be determined by the interfaces added, with 2807 * variable bits shall be determined by the interfaces added, with
2783 * interfaces not matching the mask being rejected to be brought up. 2808 * interfaces not matching the mask being rejected to be brought up.
2784 * @n_addresses: number of addresses in @addresses. 2809 * @n_addresses: number of addresses in @addresses.
@@ -2875,6 +2900,11 @@ struct wiphy_vendor_command {
2875 * @n_vendor_commands: number of vendor commands 2900 * @n_vendor_commands: number of vendor commands
2876 * @vendor_events: array of vendor events supported by the hardware 2901 * @vendor_events: array of vendor events supported by the hardware
2877 * @n_vendor_events: number of vendor events 2902 * @n_vendor_events: number of vendor events
2903 *
2904 * @max_ap_assoc_sta: maximum number of associated stations supported in AP mode
2905 * (including P2P GO) or 0 to indicate no such limit is advertised. The
2906 * driver is allowed to advertise a theoretical limit that it can reach in
2907 * some cases, but may not always reach.
2878 */ 2908 */
2879struct wiphy { 2909struct wiphy {
2880 /* assign these fields before you register the wiphy */ 2910 /* assign these fields before you register the wiphy */
@@ -2990,6 +3020,8 @@ struct wiphy {
2990 const struct nl80211_vendor_cmd_info *vendor_events; 3020 const struct nl80211_vendor_cmd_info *vendor_events;
2991 int n_vendor_commands, n_vendor_events; 3021 int n_vendor_commands, n_vendor_events;
2992 3022
3023 u16 max_ap_assoc_sta;
3024
2993 char priv[0] __aligned(NETDEV_ALIGN); 3025 char priv[0] __aligned(NETDEV_ALIGN);
2994}; 3026};
2995 3027
@@ -3127,8 +3159,8 @@ struct cfg80211_cached_keys;
3127 * @identifier: (private) Identifier used in nl80211 to identify this 3159 * @identifier: (private) Identifier used in nl80211 to identify this
3128 * wireless device if it has no netdev 3160 * wireless device if it has no netdev
3129 * @current_bss: (private) Used by the internal configuration code 3161 * @current_bss: (private) Used by the internal configuration code
3130 * @channel: (private) Used by the internal configuration code to track 3162 * @chandef: (private) Used by the internal configuration code to track
3131 * the user-set AP, monitor and WDS channel 3163 * the user-set channel definition.
3132 * @preset_chandef: (private) Used by the internal configuration code to 3164 * @preset_chandef: (private) Used by the internal configuration code to
3133 * track the channel to be used for AP later 3165 * track the channel to be used for AP later
3134 * @bssid: (private) Used by the internal configuration code 3166 * @bssid: (private) Used by the internal configuration code
@@ -3151,6 +3183,7 @@ struct cfg80211_cached_keys;
3151 * @p2p_started: true if this is a P2P Device that has been started 3183 * @p2p_started: true if this is a P2P Device that has been started
3152 * @cac_started: true if DFS channel availability check has been started 3184 * @cac_started: true if DFS channel availability check has been started
3153 * @cac_start_time: timestamp (jiffies) when the dfs state was entered. 3185 * @cac_start_time: timestamp (jiffies) when the dfs state was entered.
3186 * @cac_time_ms: CAC time in ms
3154 * @ps: powersave mode is enabled 3187 * @ps: powersave mode is enabled
3155 * @ps_timeout: dynamic powersave timeout 3188 * @ps_timeout: dynamic powersave timeout
3156 * @ap_unexpected_nlportid: (private) netlink port ID of application 3189 * @ap_unexpected_nlportid: (private) netlink port ID of application
@@ -3192,9 +3225,7 @@ struct wireless_dev {
3192 3225
3193 struct cfg80211_internal_bss *current_bss; /* associated / joined */ 3226 struct cfg80211_internal_bss *current_bss; /* associated / joined */
3194 struct cfg80211_chan_def preset_chandef; 3227 struct cfg80211_chan_def preset_chandef;
3195 3228 struct cfg80211_chan_def chandef;
3196 /* for AP and mesh channel tracking */
3197 struct ieee80211_channel *channel;
3198 3229
3199 bool ibss_fixed; 3230 bool ibss_fixed;
3200 bool ibss_dfs_possible; 3231 bool ibss_dfs_possible;
@@ -3208,6 +3239,7 @@ struct wireless_dev {
3208 3239
3209 bool cac_started; 3240 bool cac_started;
3210 unsigned long cac_start_time; 3241 unsigned long cac_start_time;
3242 unsigned int cac_time_ms;
3211 3243
3212#ifdef CONFIG_CFG80211_WEXT 3244#ifdef CONFIG_CFG80211_WEXT
3213 /* wext data */ 3245 /* wext data */
@@ -3640,7 +3672,7 @@ void cfg80211_sched_scan_stopped(struct wiphy *wiphy);
3640 * cfg80211_inform_bss_width_frame - inform cfg80211 of a received BSS frame 3672 * cfg80211_inform_bss_width_frame - inform cfg80211 of a received BSS frame
3641 * 3673 *
3642 * @wiphy: the wiphy reporting the BSS 3674 * @wiphy: the wiphy reporting the BSS
3643 * @channel: The channel the frame was received on 3675 * @rx_channel: The channel the frame was received on
3644 * @scan_width: width of the control channel 3676 * @scan_width: width of the control channel
3645 * @mgmt: the management frame (probe response or beacon) 3677 * @mgmt: the management frame (probe response or beacon)
3646 * @len: length of the management frame 3678 * @len: length of the management frame
@@ -3655,18 +3687,18 @@ void cfg80211_sched_scan_stopped(struct wiphy *wiphy);
3655 */ 3687 */
3656struct cfg80211_bss * __must_check 3688struct cfg80211_bss * __must_check
3657cfg80211_inform_bss_width_frame(struct wiphy *wiphy, 3689cfg80211_inform_bss_width_frame(struct wiphy *wiphy,
3658 struct ieee80211_channel *channel, 3690 struct ieee80211_channel *rx_channel,
3659 enum nl80211_bss_scan_width scan_width, 3691 enum nl80211_bss_scan_width scan_width,
3660 struct ieee80211_mgmt *mgmt, size_t len, 3692 struct ieee80211_mgmt *mgmt, size_t len,
3661 s32 signal, gfp_t gfp); 3693 s32 signal, gfp_t gfp);
3662 3694
3663static inline struct cfg80211_bss * __must_check 3695static inline struct cfg80211_bss * __must_check
3664cfg80211_inform_bss_frame(struct wiphy *wiphy, 3696cfg80211_inform_bss_frame(struct wiphy *wiphy,
3665 struct ieee80211_channel *channel, 3697 struct ieee80211_channel *rx_channel,
3666 struct ieee80211_mgmt *mgmt, size_t len, 3698 struct ieee80211_mgmt *mgmt, size_t len,
3667 s32 signal, gfp_t gfp) 3699 s32 signal, gfp_t gfp)
3668{ 3700{
3669 return cfg80211_inform_bss_width_frame(wiphy, channel, 3701 return cfg80211_inform_bss_width_frame(wiphy, rx_channel,
3670 NL80211_BSS_CHAN_WIDTH_20, 3702 NL80211_BSS_CHAN_WIDTH_20,
3671 mgmt, len, signal, gfp); 3703 mgmt, len, signal, gfp);
3672} 3704}
@@ -3675,7 +3707,7 @@ cfg80211_inform_bss_frame(struct wiphy *wiphy,
3675 * cfg80211_inform_bss - inform cfg80211 of a new BSS 3707 * cfg80211_inform_bss - inform cfg80211 of a new BSS
3676 * 3708 *
3677 * @wiphy: the wiphy reporting the BSS 3709 * @wiphy: the wiphy reporting the BSS
3678 * @channel: The channel the frame was received on 3710 * @rx_channel: The channel the frame was received on
3679 * @scan_width: width of the control channel 3711 * @scan_width: width of the control channel
3680 * @bssid: the BSSID of the BSS 3712 * @bssid: the BSSID of the BSS
3681 * @tsf: the TSF sent by the peer in the beacon/probe response (or 0) 3713 * @tsf: the TSF sent by the peer in the beacon/probe response (or 0)
@@ -3694,7 +3726,7 @@ cfg80211_inform_bss_frame(struct wiphy *wiphy,
3694 */ 3726 */
3695struct cfg80211_bss * __must_check 3727struct cfg80211_bss * __must_check
3696cfg80211_inform_bss_width(struct wiphy *wiphy, 3728cfg80211_inform_bss_width(struct wiphy *wiphy,
3697 struct ieee80211_channel *channel, 3729 struct ieee80211_channel *rx_channel,
3698 enum nl80211_bss_scan_width scan_width, 3730 enum nl80211_bss_scan_width scan_width,
3699 const u8 *bssid, u64 tsf, u16 capability, 3731 const u8 *bssid, u64 tsf, u16 capability,
3700 u16 beacon_interval, const u8 *ie, size_t ielen, 3732 u16 beacon_interval, const u8 *ie, size_t ielen,
@@ -3702,12 +3734,12 @@ cfg80211_inform_bss_width(struct wiphy *wiphy,
3702 3734
3703static inline struct cfg80211_bss * __must_check 3735static inline struct cfg80211_bss * __must_check
3704cfg80211_inform_bss(struct wiphy *wiphy, 3736cfg80211_inform_bss(struct wiphy *wiphy,
3705 struct ieee80211_channel *channel, 3737 struct ieee80211_channel *rx_channel,
3706 const u8 *bssid, u64 tsf, u16 capability, 3738 const u8 *bssid, u64 tsf, u16 capability,
3707 u16 beacon_interval, const u8 *ie, size_t ielen, 3739 u16 beacon_interval, const u8 *ie, size_t ielen,
3708 s32 signal, gfp_t gfp) 3740 s32 signal, gfp_t gfp)
3709{ 3741{
3710 return cfg80211_inform_bss_width(wiphy, channel, 3742 return cfg80211_inform_bss_width(wiphy, rx_channel,
3711 NL80211_BSS_CHAN_WIDTH_20, 3743 NL80211_BSS_CHAN_WIDTH_20,
3712 bssid, tsf, capability, 3744 bssid, tsf, capability,
3713 beacon_interval, ie, ielen, signal, 3745 beacon_interval, ie, ielen, signal,
@@ -3876,6 +3908,7 @@ void cfg80211_michael_mic_failure(struct net_device *dev, const u8 *addr,
3876 * 3908 *
3877 * @dev: network device 3909 * @dev: network device
3878 * @bssid: the BSSID of the IBSS joined 3910 * @bssid: the BSSID of the IBSS joined
3911 * @channel: the channel of the IBSS joined
3879 * @gfp: allocation flags 3912 * @gfp: allocation flags
3880 * 3913 *
3881 * This function notifies cfg80211 that the device joined an IBSS or 3914 * This function notifies cfg80211 that the device joined an IBSS or
@@ -3885,7 +3918,8 @@ void cfg80211_michael_mic_failure(struct net_device *dev, const u8 *addr,
3885 * with the locally generated beacon -- this guarantees that there is 3918 * with the locally generated beacon -- this guarantees that there is
3886 * always a scan result for this IBSS. cfg80211 will handle the rest. 3919 * always a scan result for this IBSS. cfg80211 will handle the rest.
3887 */ 3920 */
3888void cfg80211_ibss_joined(struct net_device *dev, const u8 *bssid, gfp_t gfp); 3921void cfg80211_ibss_joined(struct net_device *dev, const u8 *bssid,
3922 struct ieee80211_channel *channel, gfp_t gfp);
3889 3923
3890/** 3924/**
3891 * cfg80211_notify_new_candidate - notify cfg80211 of a new mesh peer candidate 3925 * cfg80211_notify_new_candidate - notify cfg80211 of a new mesh peer candidate
diff --git a/include/net/checksum.h b/include/net/checksum.h
index 37a0e24adbe7..a28f4e0f6251 100644
--- a/include/net/checksum.h
+++ b/include/net/checksum.h
@@ -69,6 +69,19 @@ static inline __wsum csum_sub(__wsum csum, __wsum addend)
69 return csum_add(csum, ~addend); 69 return csum_add(csum, ~addend);
70} 70}
71 71
72static inline __sum16 csum16_add(__sum16 csum, __be16 addend)
73{
74 u16 res = (__force u16)csum;
75
76 res += (__force u16)addend;
77 return (__force __sum16)(res + (res < (__force u16)addend));
78}
79
80static inline __sum16 csum16_sub(__sum16 csum, __be16 addend)
81{
82 return csum16_add(csum, ~addend);
83}
84
72static inline __wsum 85static inline __wsum
73csum_block_add(__wsum csum, __wsum csum2, int offset) 86csum_block_add(__wsum csum, __wsum csum2, int offset)
74{ 87{
@@ -112,9 +125,15 @@ static inline void csum_replace4(__sum16 *sum, __be32 from, __be32 to)
112 *sum = csum_fold(csum_partial(diff, sizeof(diff), ~csum_unfold(*sum))); 125 *sum = csum_fold(csum_partial(diff, sizeof(diff), ~csum_unfold(*sum)));
113} 126}
114 127
115static inline void csum_replace2(__sum16 *sum, __be16 from, __be16 to) 128/* Implements RFC 1624 (Incremental Internet Checksum)
129 * 3. Discussion states :
130 * HC' = ~(~HC + ~m + m')
131 * m : old value of a 16bit field
132 * m' : new value of a 16bit field
133 */
134static inline void csum_replace2(__sum16 *sum, __be16 old, __be16 new)
116{ 135{
117 csum_replace4(sum, (__force __be32)from, (__force __be32)to); 136 *sum = ~csum16_add(csum16_sub(~(*sum), old), new);
118} 137}
119 138
120struct sk_buff; 139struct sk_buff;
diff --git a/include/net/dst.h b/include/net/dst.h
index 77eb53fabfb0..46ed958e0c6e 100644
--- a/include/net/dst.h
+++ b/include/net/dst.h
@@ -54,10 +54,9 @@ struct dst_entry {
54#define DST_NOHASH 0x0008 54#define DST_NOHASH 0x0008
55#define DST_NOCACHE 0x0010 55#define DST_NOCACHE 0x0010
56#define DST_NOCOUNT 0x0020 56#define DST_NOCOUNT 0x0020
57#define DST_NOPEER 0x0040 57#define DST_FAKE_RTABLE 0x0040
58#define DST_FAKE_RTABLE 0x0080 58#define DST_XFRM_TUNNEL 0x0080
59#define DST_XFRM_TUNNEL 0x0100 59#define DST_XFRM_QUEUE 0x0100
60#define DST_XFRM_QUEUE 0x0200
61 60
62 unsigned short pending_confirm; 61 unsigned short pending_confirm;
63 62
@@ -109,9 +108,11 @@ struct dst_entry {
109u32 *dst_cow_metrics_generic(struct dst_entry *dst, unsigned long old); 108u32 *dst_cow_metrics_generic(struct dst_entry *dst, unsigned long old);
110extern const u32 dst_default_metrics[]; 109extern const u32 dst_default_metrics[];
111 110
112#define DST_METRICS_READ_ONLY 0x1UL 111#define DST_METRICS_READ_ONLY 0x1UL
112#define DST_METRICS_FORCE_OVERWRITE 0x2UL
113#define DST_METRICS_FLAGS 0x3UL
113#define __DST_METRICS_PTR(Y) \ 114#define __DST_METRICS_PTR(Y) \
114 ((u32 *)((Y) & ~DST_METRICS_READ_ONLY)) 115 ((u32 *)((Y) & ~DST_METRICS_FLAGS))
115#define DST_METRICS_PTR(X) __DST_METRICS_PTR((X)->_metrics) 116#define DST_METRICS_PTR(X) __DST_METRICS_PTR((X)->_metrics)
116 117
117static inline bool dst_metrics_read_only(const struct dst_entry *dst) 118static inline bool dst_metrics_read_only(const struct dst_entry *dst)
@@ -119,6 +120,11 @@ static inline bool dst_metrics_read_only(const struct dst_entry *dst)
119 return dst->_metrics & DST_METRICS_READ_ONLY; 120 return dst->_metrics & DST_METRICS_READ_ONLY;
120} 121}
121 122
123static inline void dst_metrics_set_force_overwrite(struct dst_entry *dst)
124{
125 dst->_metrics |= DST_METRICS_FORCE_OVERWRITE;
126}
127
122void __dst_destroy_metrics_generic(struct dst_entry *dst, unsigned long old); 128void __dst_destroy_metrics_generic(struct dst_entry *dst, unsigned long old);
123 129
124static inline void dst_destroy_metrics_generic(struct dst_entry *dst) 130static inline void dst_destroy_metrics_generic(struct dst_entry *dst)
diff --git a/include/net/flow.h b/include/net/flow.h
index d23e7fa2042e..64fd24836650 100644
--- a/include/net/flow.h
+++ b/include/net/flow.h
@@ -218,9 +218,11 @@ struct flow_cache_object *flow_cache_lookup(struct net *net,
218 const struct flowi *key, u16 family, 218 const struct flowi *key, u16 family,
219 u8 dir, flow_resolve_t resolver, 219 u8 dir, flow_resolve_t resolver,
220 void *ctx); 220 void *ctx);
221int flow_cache_init(struct net *net);
222void flow_cache_fini(struct net *net);
221 223
222void flow_cache_flush(void); 224void flow_cache_flush(struct net *net);
223void flow_cache_flush_deferred(void); 225void flow_cache_flush_deferred(struct net *net);
224extern atomic_t flow_cache_genid; 226extern atomic_t flow_cache_genid;
225 227
226#endif 228#endif
diff --git a/include/net/flowcache.h b/include/net/flowcache.h
new file mode 100644
index 000000000000..c8f665ec6e0d
--- /dev/null
+++ b/include/net/flowcache.h
@@ -0,0 +1,25 @@
1#ifndef _NET_FLOWCACHE_H
2#define _NET_FLOWCACHE_H
3
4#include <linux/interrupt.h>
5#include <linux/types.h>
6#include <linux/timer.h>
7#include <linux/notifier.h>
8
9struct flow_cache_percpu {
10 struct hlist_head *hash_table;
11 int hash_count;
12 u32 hash_rnd;
13 int hash_rnd_recalc;
14 struct tasklet_struct flush_tasklet;
15};
16
17struct flow_cache {
18 u32 hash_shift;
19 struct flow_cache_percpu __percpu *percpu;
20 struct notifier_block hotcpu_notifier;
21 int low_watermark;
22 int high_watermark;
23 struct timer_list rnd_timer;
24};
25#endif /* _NET_FLOWCACHE_H */
diff --git a/include/net/ieee80211_radiotap.h b/include/net/ieee80211_radiotap.h
index 8b5b71433297..b0fd9476c538 100644
--- a/include/net/ieee80211_radiotap.h
+++ b/include/net/ieee80211_radiotap.h
@@ -316,6 +316,10 @@ enum ieee80211_radiotap_type {
316#define IEEE80211_RADIOTAP_VHT_FLAG_LDPC_EXTRA_OFDM_SYM 0x10 316#define IEEE80211_RADIOTAP_VHT_FLAG_LDPC_EXTRA_OFDM_SYM 0x10
317#define IEEE80211_RADIOTAP_VHT_FLAG_BEAMFORMED 0x20 317#define IEEE80211_RADIOTAP_VHT_FLAG_BEAMFORMED 0x20
318 318
319#define IEEE80211_RADIOTAP_CODING_LDPC_USER0 0x01
320#define IEEE80211_RADIOTAP_CODING_LDPC_USER1 0x02
321#define IEEE80211_RADIOTAP_CODING_LDPC_USER2 0x04
322#define IEEE80211_RADIOTAP_CODING_LDPC_USER3 0x08
319 323
320/* helpers */ 324/* helpers */
321static inline int ieee80211_get_radiotap_len(unsigned char *data) 325static inline int ieee80211_get_radiotap_len(unsigned char *data)
diff --git a/include/net/ieee802154.h b/include/net/ieee802154.h
index ee59f8b188dd..c7ae0ac528dc 100644
--- a/include/net/ieee802154.h
+++ b/include/net/ieee802154.h
@@ -42,22 +42,42 @@
42 (((x) << IEEE802154_FC_TYPE_SHIFT) & IEEE802154_FC_TYPE_MASK)); \ 42 (((x) << IEEE802154_FC_TYPE_SHIFT) & IEEE802154_FC_TYPE_MASK)); \
43 } while (0) 43 } while (0)
44 44
45#define IEEE802154_FC_SECEN (1 << 3) 45#define IEEE802154_FC_SECEN_SHIFT 3
46#define IEEE802154_FC_FRPEND (1 << 4) 46#define IEEE802154_FC_SECEN (1 << IEEE802154_FC_SECEN_SHIFT)
47#define IEEE802154_FC_ACK_REQ (1 << 5) 47#define IEEE802154_FC_FRPEND_SHIFT 4
48#define IEEE802154_FC_INTRA_PAN (1 << 6) 48#define IEEE802154_FC_FRPEND (1 << IEEE802154_FC_FRPEND_SHIFT)
49#define IEEE802154_FC_ACK_REQ_SHIFT 5
50#define IEEE802154_FC_ACK_REQ (1 << IEEE802154_FC_ACK_REQ_SHIFT)
51#define IEEE802154_FC_INTRA_PAN_SHIFT 6
52#define IEEE802154_FC_INTRA_PAN (1 << IEEE802154_FC_INTRA_PAN_SHIFT)
49 53
50#define IEEE802154_FC_SAMODE_SHIFT 14 54#define IEEE802154_FC_SAMODE_SHIFT 14
51#define IEEE802154_FC_SAMODE_MASK (3 << IEEE802154_FC_SAMODE_SHIFT) 55#define IEEE802154_FC_SAMODE_MASK (3 << IEEE802154_FC_SAMODE_SHIFT)
52#define IEEE802154_FC_DAMODE_SHIFT 10 56#define IEEE802154_FC_DAMODE_SHIFT 10
53#define IEEE802154_FC_DAMODE_MASK (3 << IEEE802154_FC_DAMODE_SHIFT) 57#define IEEE802154_FC_DAMODE_MASK (3 << IEEE802154_FC_DAMODE_SHIFT)
54 58
59#define IEEE802154_FC_VERSION_SHIFT 12
60#define IEEE802154_FC_VERSION_MASK (3 << IEEE802154_FC_VERSION_SHIFT)
61#define IEEE802154_FC_VERSION(x) ((x & IEEE802154_FC_VERSION_MASK) >> IEEE802154_FC_VERSION_SHIFT)
62
55#define IEEE802154_FC_SAMODE(x) \ 63#define IEEE802154_FC_SAMODE(x) \
56 (((x) & IEEE802154_FC_SAMODE_MASK) >> IEEE802154_FC_SAMODE_SHIFT) 64 (((x) & IEEE802154_FC_SAMODE_MASK) >> IEEE802154_FC_SAMODE_SHIFT)
57 65
58#define IEEE802154_FC_DAMODE(x) \ 66#define IEEE802154_FC_DAMODE(x) \
59 (((x) & IEEE802154_FC_DAMODE_MASK) >> IEEE802154_FC_DAMODE_SHIFT) 67 (((x) & IEEE802154_FC_DAMODE_MASK) >> IEEE802154_FC_DAMODE_SHIFT)
60 68
69#define IEEE802154_SCF_SECLEVEL_MASK 7
70#define IEEE802154_SCF_SECLEVEL_SHIFT 0
71#define IEEE802154_SCF_SECLEVEL(x) (x & IEEE802154_SCF_SECLEVEL_MASK)
72#define IEEE802154_SCF_KEY_ID_MODE_SHIFT 3
73#define IEEE802154_SCF_KEY_ID_MODE_MASK (3 << IEEE802154_SCF_KEY_ID_MODE_SHIFT)
74#define IEEE802154_SCF_KEY_ID_MODE(x) \
75 ((x & IEEE802154_SCF_KEY_ID_MODE_MASK) >> IEEE802154_SCF_KEY_ID_MODE_SHIFT)
76
77#define IEEE802154_SCF_KEY_IMPLICIT 0
78#define IEEE802154_SCF_KEY_INDEX 1
79#define IEEE802154_SCF_KEY_SHORT_INDEX 2
80#define IEEE802154_SCF_KEY_HW_INDEX 3
61 81
62/* MAC footer size */ 82/* MAC footer size */
63#define IEEE802154_MFR_SIZE 2 /* 2 octets */ 83#define IEEE802154_MFR_SIZE 2 /* 2 octets */
diff --git a/include/net/ieee802154_netdev.h b/include/net/ieee802154_netdev.h
index 8196d5d40359..5a719ca892f4 100644
--- a/include/net/ieee802154_netdev.h
+++ b/include/net/ieee802154_netdev.h
@@ -28,6 +28,164 @@
28#define IEEE802154_NETDEVICE_H 28#define IEEE802154_NETDEVICE_H
29 29
30#include <net/af_ieee802154.h> 30#include <net/af_ieee802154.h>
31#include <linux/netdevice.h>
32#include <linux/skbuff.h>
33
34struct ieee802154_sechdr {
35#if defined(__LITTLE_ENDIAN_BITFIELD)
36 u8 level:3,
37 key_id_mode:2,
38 reserved:3;
39#elif defined(__BIG_ENDIAN_BITFIELD)
40 u8 reserved:3,
41 key_id_mode:2,
42 level:3;
43#else
44#error "Please fix <asm/byteorder.h>"
45#endif
46 u8 key_id;
47 __le32 frame_counter;
48 union {
49 __le32 short_src;
50 __le64 extended_src;
51 };
52};
53
54struct ieee802154_addr {
55 u8 mode;
56 __le16 pan_id;
57 union {
58 __le16 short_addr;
59 __le64 extended_addr;
60 };
61};
62
63struct ieee802154_hdr_fc {
64#if defined(__LITTLE_ENDIAN_BITFIELD)
65 u16 type:3,
66 security_enabled:1,
67 frame_pending:1,
68 ack_request:1,
69 intra_pan:1,
70 reserved:3,
71 dest_addr_mode:2,
72 version:2,
73 source_addr_mode:2;
74#elif defined(__BIG_ENDIAN_BITFIELD)
75 u16 reserved:1,
76 intra_pan:1,
77 ack_request:1,
78 frame_pending:1,
79 security_enabled:1,
80 type:3,
81 source_addr_mode:2,
82 version:2,
83 dest_addr_mode:2,
84 reserved2:2;
85#else
86#error "Please fix <asm/byteorder.h>"
87#endif
88};
89
90struct ieee802154_hdr {
91 struct ieee802154_hdr_fc fc;
92 u8 seq;
93 struct ieee802154_addr source;
94 struct ieee802154_addr dest;
95 struct ieee802154_sechdr sec;
96};
97
98/* pushes hdr onto the skb. fields of hdr->fc that can be calculated from
99 * the contents of hdr will be, and the actual value of those bits in
100 * hdr->fc will be ignored. this includes the INTRA_PAN bit and the frame
101 * version, if SECEN is set.
102 */
103int ieee802154_hdr_push(struct sk_buff *skb, const struct ieee802154_hdr *hdr);
104
105/* pulls the entire 802.15.4 header off of the skb, including the security
106 * header, and performs pan id decompression
107 */
108int ieee802154_hdr_pull(struct sk_buff *skb, struct ieee802154_hdr *hdr);
109
110/* parses the frame control, sequence number of address fields in a given skb
111 * and stores them into hdr, performing pan id decompression and length checks
112 * to be suitable for use in header_ops.parse
113 */
114int ieee802154_hdr_peek_addrs(const struct sk_buff *skb,
115 struct ieee802154_hdr *hdr);
116
117static inline int ieee802154_hdr_length(struct sk_buff *skb)
118{
119 struct ieee802154_hdr hdr;
120 int len = ieee802154_hdr_pull(skb, &hdr);
121
122 if (len > 0)
123 skb_push(skb, len);
124
125 return len;
126}
127
128static inline bool ieee802154_addr_equal(const struct ieee802154_addr *a1,
129 const struct ieee802154_addr *a2)
130{
131 if (a1->pan_id != a2->pan_id || a1->mode != a2->mode)
132 return false;
133
134 if ((a1->mode == IEEE802154_ADDR_LONG &&
135 a1->extended_addr != a2->extended_addr) ||
136 (a1->mode == IEEE802154_ADDR_SHORT &&
137 a1->short_addr != a2->short_addr))
138 return false;
139
140 return true;
141}
142
143static inline __le64 ieee802154_devaddr_from_raw(const void *raw)
144{
145 u64 temp;
146
147 memcpy(&temp, raw, IEEE802154_ADDR_LEN);
148 return (__force __le64)swab64(temp);
149}
150
151static inline void ieee802154_devaddr_to_raw(void *raw, __le64 addr)
152{
153 u64 temp = swab64((__force u64)addr);
154
155 memcpy(raw, &temp, IEEE802154_ADDR_LEN);
156}
157
158static inline void ieee802154_addr_from_sa(struct ieee802154_addr *a,
159 const struct ieee802154_addr_sa *sa)
160{
161 a->mode = sa->addr_type;
162 a->pan_id = cpu_to_le16(sa->pan_id);
163
164 switch (a->mode) {
165 case IEEE802154_ADDR_SHORT:
166 a->short_addr = cpu_to_le16(sa->short_addr);
167 break;
168 case IEEE802154_ADDR_LONG:
169 a->extended_addr = ieee802154_devaddr_from_raw(sa->hwaddr);
170 break;
171 }
172}
173
174static inline void ieee802154_addr_to_sa(struct ieee802154_addr_sa *sa,
175 const struct ieee802154_addr *a)
176{
177 sa->addr_type = a->mode;
178 sa->pan_id = le16_to_cpu(a->pan_id);
179
180 switch (a->mode) {
181 case IEEE802154_ADDR_SHORT:
182 sa->short_addr = le16_to_cpu(a->short_addr);
183 break;
184 case IEEE802154_ADDR_LONG:
185 ieee802154_devaddr_to_raw(sa->hwaddr, a->extended_addr);
186 break;
187 }
188}
31 189
32/* 190/*
33 * A control block of skb passed between the ARPHRD_IEEE802154 device 191 * A control block of skb passed between the ARPHRD_IEEE802154 device
@@ -35,10 +193,10 @@
35 */ 193 */
36struct ieee802154_mac_cb { 194struct ieee802154_mac_cb {
37 u8 lqi; 195 u8 lqi;
38 struct ieee802154_addr sa;
39 struct ieee802154_addr da;
40 u8 flags; 196 u8 flags;
41 u8 seq; 197 u8 seq;
198 struct ieee802154_addr source;
199 struct ieee802154_addr dest;
42}; 200};
43 201
44static inline struct ieee802154_mac_cb *mac_cb(struct sk_buff *skb) 202static inline struct ieee802154_mac_cb *mac_cb(struct sk_buff *skb)
@@ -50,23 +208,17 @@ static inline struct ieee802154_mac_cb *mac_cb(struct sk_buff *skb)
50 208
51#define MAC_CB_FLAG_ACKREQ (1 << 3) 209#define MAC_CB_FLAG_ACKREQ (1 << 3)
52#define MAC_CB_FLAG_SECEN (1 << 4) 210#define MAC_CB_FLAG_SECEN (1 << 4)
53#define MAC_CB_FLAG_INTRAPAN (1 << 5)
54 211
55static inline int mac_cb_is_ackreq(struct sk_buff *skb) 212static inline bool mac_cb_is_ackreq(struct sk_buff *skb)
56{ 213{
57 return mac_cb(skb)->flags & MAC_CB_FLAG_ACKREQ; 214 return mac_cb(skb)->flags & MAC_CB_FLAG_ACKREQ;
58} 215}
59 216
60static inline int mac_cb_is_secen(struct sk_buff *skb) 217static inline bool mac_cb_is_secen(struct sk_buff *skb)
61{ 218{
62 return mac_cb(skb)->flags & MAC_CB_FLAG_SECEN; 219 return mac_cb(skb)->flags & MAC_CB_FLAG_SECEN;
63} 220}
64 221
65static inline int mac_cb_is_intrapan(struct sk_buff *skb)
66{
67 return mac_cb(skb)->flags & MAC_CB_FLAG_INTRAPAN;
68}
69
70static inline int mac_cb_type(struct sk_buff *skb) 222static inline int mac_cb_type(struct sk_buff *skb)
71{ 223{
72 return mac_cb(skb)->flags & MAC_CB_FLAG_TYPEMASK; 224 return mac_cb(skb)->flags & MAC_CB_FLAG_TYPEMASK;
@@ -77,6 +229,18 @@ static inline int mac_cb_type(struct sk_buff *skb)
77#define IEEE802154_MAC_SCAN_PASSIVE 2 229#define IEEE802154_MAC_SCAN_PASSIVE 2
78#define IEEE802154_MAC_SCAN_ORPHAN 3 230#define IEEE802154_MAC_SCAN_ORPHAN 3
79 231
232struct ieee802154_mac_params {
233 s8 transmit_power;
234 u8 min_be;
235 u8 max_be;
236 u8 csma_retries;
237 s8 frame_retries;
238
239 bool lbt;
240 u8 cca_mode;
241 s32 cca_ed_level;
242};
243
80struct wpan_phy; 244struct wpan_phy;
81/* 245/*
82 * This should be located at net_device->ml_priv 246 * This should be located at net_device->ml_priv
@@ -92,7 +256,7 @@ struct ieee802154_mlme_ops {
92 u8 channel, u8 page, u8 cap); 256 u8 channel, u8 page, u8 cap);
93 int (*assoc_resp)(struct net_device *dev, 257 int (*assoc_resp)(struct net_device *dev,
94 struct ieee802154_addr *addr, 258 struct ieee802154_addr *addr,
95 u16 short_addr, u8 status); 259 __le16 short_addr, u8 status);
96 int (*disassoc_req)(struct net_device *dev, 260 int (*disassoc_req)(struct net_device *dev,
97 struct ieee802154_addr *addr, 261 struct ieee802154_addr *addr,
98 u8 reason); 262 u8 reason);
@@ -103,6 +267,11 @@ struct ieee802154_mlme_ops {
103 int (*scan_req)(struct net_device *dev, 267 int (*scan_req)(struct net_device *dev,
104 u8 type, u32 channels, u8 page, u8 duration); 268 u8 type, u32 channels, u8 page, u8 duration);
105 269
270 int (*set_mac_params)(struct net_device *dev,
271 const struct ieee802154_mac_params *params);
272 void (*get_mac_params)(struct net_device *dev,
273 struct ieee802154_mac_params *params);
274
106 /* The fields below are required. */ 275 /* The fields below are required. */
107 276
108 struct wpan_phy *(*get_phy)(const struct net_device *dev); 277 struct wpan_phy *(*get_phy)(const struct net_device *dev);
@@ -111,8 +280,8 @@ struct ieee802154_mlme_ops {
111 * FIXME: these should become the part of PIB/MIB interface. 280 * FIXME: these should become the part of PIB/MIB interface.
112 * However we still don't have IB interface of any kind 281 * However we still don't have IB interface of any kind
113 */ 282 */
114 u16 (*get_pan_id)(const struct net_device *dev); 283 __le16 (*get_pan_id)(const struct net_device *dev);
115 u16 (*get_short_addr)(const struct net_device *dev); 284 __le16 (*get_short_addr)(const struct net_device *dev);
116 u8 (*get_dsn)(const struct net_device *dev); 285 u8 (*get_dsn)(const struct net_device *dev);
117}; 286};
118 287
diff --git a/include/net/ip.h b/include/net/ip.h
index 23be0fd37937..25064c28e059 100644
--- a/include/net/ip.h
+++ b/include/net/ip.h
@@ -187,6 +187,7 @@ void ip_send_unicast_reply(struct net *net, struct sk_buff *skb, __be32 daddr,
187#define NET_INC_STATS(net, field) SNMP_INC_STATS((net)->mib.net_statistics, field) 187#define NET_INC_STATS(net, field) SNMP_INC_STATS((net)->mib.net_statistics, field)
188#define NET_INC_STATS_BH(net, field) SNMP_INC_STATS_BH((net)->mib.net_statistics, field) 188#define NET_INC_STATS_BH(net, field) SNMP_INC_STATS_BH((net)->mib.net_statistics, field)
189#define NET_INC_STATS_USER(net, field) SNMP_INC_STATS_USER((net)->mib.net_statistics, field) 189#define NET_INC_STATS_USER(net, field) SNMP_INC_STATS_USER((net)->mib.net_statistics, field)
190#define NET_ADD_STATS(net, field, adnd) SNMP_ADD_STATS((net)->mib.net_statistics, field, adnd)
190#define NET_ADD_STATS_BH(net, field, adnd) SNMP_ADD_STATS_BH((net)->mib.net_statistics, field, adnd) 191#define NET_ADD_STATS_BH(net, field, adnd) SNMP_ADD_STATS_BH((net)->mib.net_statistics, field, adnd)
191#define NET_ADD_STATS_USER(net, field, adnd) SNMP_ADD_STATS_USER((net)->mib.net_statistics, field, adnd) 192#define NET_ADD_STATS_USER(net, field, adnd) SNMP_ADD_STATS_USER((net)->mib.net_statistics, field, adnd)
192 193
@@ -266,7 +267,8 @@ int ip_dont_fragment(struct sock *sk, struct dst_entry *dst)
266 267
267static inline bool ip_sk_accept_pmtu(const struct sock *sk) 268static inline bool ip_sk_accept_pmtu(const struct sock *sk)
268{ 269{
269 return inet_sk(sk)->pmtudisc != IP_PMTUDISC_INTERFACE; 270 return inet_sk(sk)->pmtudisc != IP_PMTUDISC_INTERFACE &&
271 inet_sk(sk)->pmtudisc != IP_PMTUDISC_OMIT;
270} 272}
271 273
272static inline bool ip_sk_use_pmtu(const struct sock *sk) 274static inline bool ip_sk_use_pmtu(const struct sock *sk)
@@ -274,6 +276,12 @@ static inline bool ip_sk_use_pmtu(const struct sock *sk)
274 return inet_sk(sk)->pmtudisc < IP_PMTUDISC_PROBE; 276 return inet_sk(sk)->pmtudisc < IP_PMTUDISC_PROBE;
275} 277}
276 278
279static inline bool ip_sk_local_df(const struct sock *sk)
280{
281 return inet_sk(sk)->pmtudisc < IP_PMTUDISC_DO ||
282 inet_sk(sk)->pmtudisc == IP_PMTUDISC_OMIT;
283}
284
277static inline unsigned int ip_dst_mtu_maybe_forward(const struct dst_entry *dst, 285static inline unsigned int ip_dst_mtu_maybe_forward(const struct dst_entry *dst,
278 bool forwarding) 286 bool forwarding)
279{ 287{
@@ -489,7 +497,8 @@ int ip_options_rcv_srr(struct sk_buff *skb);
489 497
490void ipv4_pktinfo_prepare(const struct sock *sk, struct sk_buff *skb); 498void ipv4_pktinfo_prepare(const struct sock *sk, struct sk_buff *skb);
491void ip_cmsg_recv(struct msghdr *msg, struct sk_buff *skb); 499void ip_cmsg_recv(struct msghdr *msg, struct sk_buff *skb);
492int ip_cmsg_send(struct net *net, struct msghdr *msg, struct ipcm_cookie *ipc); 500int ip_cmsg_send(struct net *net, struct msghdr *msg,
501 struct ipcm_cookie *ipc, bool allow_ipv6);
493int ip_setsockopt(struct sock *sk, int level, int optname, char __user *optval, 502int ip_setsockopt(struct sock *sk, int level, int optname, char __user *optval,
494 unsigned int optlen); 503 unsigned int optlen);
495int ip_getsockopt(struct sock *sk, int level, int optname, char __user *optval, 504int ip_getsockopt(struct sock *sk, int level, int optname, char __user *optval,
diff --git a/include/net/ip6_fib.h b/include/net/ip6_fib.h
index aca0c2709fd6..9bcb220bd4ad 100644
--- a/include/net/ip6_fib.h
+++ b/include/net/ip6_fib.h
@@ -284,7 +284,8 @@ struct fib6_node *fib6_locate(struct fib6_node *root,
284void fib6_clean_all(struct net *net, int (*func)(struct rt6_info *, void *arg), 284void fib6_clean_all(struct net *net, int (*func)(struct rt6_info *, void *arg),
285 void *arg); 285 void *arg);
286 286
287int fib6_add(struct fib6_node *root, struct rt6_info *rt, struct nl_info *info); 287int fib6_add(struct fib6_node *root, struct rt6_info *rt, struct nl_info *info,
288 struct nlattr *mx, int mx_len);
288 289
289int fib6_del(struct rt6_info *rt, struct nl_info *info); 290int fib6_del(struct rt6_info *rt, struct nl_info *info);
290 291
diff --git a/include/net/ip6_route.h b/include/net/ip6_route.h
index 017badb1aec7..3c3bb184eb8f 100644
--- a/include/net/ip6_route.h
+++ b/include/net/ip6_route.h
@@ -51,6 +51,11 @@ static inline unsigned int rt6_flags2srcprefs(int flags)
51 return (flags >> 3) & 7; 51 return (flags >> 3) & 7;
52} 52}
53 53
54static inline bool rt6_need_strict(const struct in6_addr *daddr)
55{
56 return ipv6_addr_type(daddr) &
57 (IPV6_ADDR_MULTICAST | IPV6_ADDR_LINKLOCAL | IPV6_ADDR_LOOPBACK);
58}
54 59
55void ip6_route_input(struct sk_buff *skb); 60void ip6_route_input(struct sk_buff *skb);
56 61
@@ -171,7 +176,14 @@ static inline int ip6_skb_dst_mtu(struct sk_buff *skb)
171 176
172static inline bool ip6_sk_accept_pmtu(const struct sock *sk) 177static inline bool ip6_sk_accept_pmtu(const struct sock *sk)
173{ 178{
174 return inet6_sk(sk)->pmtudisc != IPV6_PMTUDISC_INTERFACE; 179 return inet6_sk(sk)->pmtudisc != IPV6_PMTUDISC_INTERFACE &&
180 inet6_sk(sk)->pmtudisc != IPV6_PMTUDISC_OMIT;
181}
182
183static inline bool ip6_sk_local_df(const struct sock *sk)
184{
185 return inet6_sk(sk)->pmtudisc < IPV6_PMTUDISC_DO ||
186 inet6_sk(sk)->pmtudisc == IPV6_PMTUDISC_OMIT;
175} 187}
176 188
177static inline struct in6_addr *rt6_nexthop(struct rt6_info *rt) 189static inline struct in6_addr *rt6_nexthop(struct rt6_info *rt)
diff --git a/include/net/mac80211.h b/include/net/mac80211.h
index 703b1f1456fc..8248e3909fdf 100644
--- a/include/net/mac80211.h
+++ b/include/net/mac80211.h
@@ -66,10 +66,6 @@
66 * 66 *
67 * Secondly, when the hardware handles fragmentation, the frame handed to 67 * Secondly, when the hardware handles fragmentation, the frame handed to
68 * the driver from mac80211 is the MSDU, not the MPDU. 68 * the driver from mac80211 is the MSDU, not the MPDU.
69 *
70 * Finally, for received frames, the driver is able to indicate that it has
71 * filled a radiotap header and put that in front of the frame; if it does
72 * not do so then mac80211 may add this under certain circumstances.
73 */ 69 */
74 70
75/** 71/**
@@ -701,11 +697,11 @@ struct ieee80211_tx_info {
701 } control; 697 } control;
702 struct { 698 struct {
703 struct ieee80211_tx_rate rates[IEEE80211_TX_MAX_RATES]; 699 struct ieee80211_tx_rate rates[IEEE80211_TX_MAX_RATES];
704 int ack_signal; 700 s32 ack_signal;
705 u8 ampdu_ack_len; 701 u8 ampdu_ack_len;
706 u8 ampdu_len; 702 u8 ampdu_len;
707 u8 antenna; 703 u8 antenna;
708 /* 21 bytes free */ 704 void *status_driver_data[21 / sizeof(void *)];
709 } status; 705 } status;
710 struct { 706 struct {
711 struct ieee80211_tx_rate driver_rates[ 707 struct ieee80211_tx_rate driver_rates[
@@ -808,9 +804,6 @@ ieee80211_tx_info_clear_status(struct ieee80211_tx_info *info)
808 * @RX_FLAG_HT: HT MCS was used and rate_idx is MCS index 804 * @RX_FLAG_HT: HT MCS was used and rate_idx is MCS index
809 * @RX_FLAG_VHT: VHT MCS was used and rate_index is MCS index 805 * @RX_FLAG_VHT: VHT MCS was used and rate_index is MCS index
810 * @RX_FLAG_40MHZ: HT40 (40 MHz) was used 806 * @RX_FLAG_40MHZ: HT40 (40 MHz) was used
811 * @RX_FLAG_80MHZ: 80 MHz was used
812 * @RX_FLAG_80P80MHZ: 80+80 MHz was used
813 * @RX_FLAG_160MHZ: 160 MHz was used
814 * @RX_FLAG_SHORT_GI: Short guard interval was used 807 * @RX_FLAG_SHORT_GI: Short guard interval was used
815 * @RX_FLAG_NO_SIGNAL_VAL: The signal strength value is not present. 808 * @RX_FLAG_NO_SIGNAL_VAL: The signal strength value is not present.
816 * Valid only for data frames (mainly A-MPDU) 809 * Valid only for data frames (mainly A-MPDU)
@@ -830,6 +823,7 @@ ieee80211_tx_info_clear_status(struct ieee80211_tx_info *info)
830 * on this subframe 823 * on this subframe
831 * @RX_FLAG_AMPDU_DELIM_CRC_KNOWN: The delimiter CRC field is known (the CRC 824 * @RX_FLAG_AMPDU_DELIM_CRC_KNOWN: The delimiter CRC field is known (the CRC
832 * is stored in the @ampdu_delimiter_crc field) 825 * is stored in the @ampdu_delimiter_crc field)
826 * @RX_FLAG_LDPC: LDPC was used
833 * @RX_FLAG_STBC_MASK: STBC 2 bit bitmask. 1 - Nss=1, 2 - Nss=2, 3 - Nss=3 827 * @RX_FLAG_STBC_MASK: STBC 2 bit bitmask. 1 - Nss=1, 2 - Nss=2, 3 - Nss=3
834 * @RX_FLAG_10MHZ: 10 MHz (half channel) was used 828 * @RX_FLAG_10MHZ: 10 MHz (half channel) was used
835 * @RX_FLAG_5MHZ: 5 MHz (quarter channel) was used 829 * @RX_FLAG_5MHZ: 5 MHz (quarter channel) was used
@@ -866,9 +860,7 @@ enum mac80211_rx_flags {
866 RX_FLAG_AMPDU_DELIM_CRC_KNOWN = BIT(20), 860 RX_FLAG_AMPDU_DELIM_CRC_KNOWN = BIT(20),
867 RX_FLAG_MACTIME_END = BIT(21), 861 RX_FLAG_MACTIME_END = BIT(21),
868 RX_FLAG_VHT = BIT(22), 862 RX_FLAG_VHT = BIT(22),
869 RX_FLAG_80MHZ = BIT(23), 863 RX_FLAG_LDPC = BIT(23),
870 RX_FLAG_80P80MHZ = BIT(24),
871 RX_FLAG_160MHZ = BIT(25),
872 RX_FLAG_STBC_MASK = BIT(26) | BIT(27), 864 RX_FLAG_STBC_MASK = BIT(26) | BIT(27),
873 RX_FLAG_10MHZ = BIT(28), 865 RX_FLAG_10MHZ = BIT(28),
874 RX_FLAG_5MHZ = BIT(29), 866 RX_FLAG_5MHZ = BIT(29),
@@ -878,6 +870,23 @@ enum mac80211_rx_flags {
878#define RX_FLAG_STBC_SHIFT 26 870#define RX_FLAG_STBC_SHIFT 26
879 871
880/** 872/**
873 * enum mac80211_rx_vht_flags - receive VHT flags
874 *
875 * These flags are used with the @vht_flag member of
876 * &struct ieee80211_rx_status.
877 * @RX_VHT_FLAG_80MHZ: 80 MHz was used
878 * @RX_VHT_FLAG_80P80MHZ: 80+80 MHz was used
879 * @RX_VHT_FLAG_160MHZ: 160 MHz was used
880 * @RX_VHT_FLAG_BF: packet was beamformed
881 */
882enum mac80211_rx_vht_flags {
883 RX_VHT_FLAG_80MHZ = BIT(0),
884 RX_VHT_FLAG_80P80MHZ = BIT(1),
885 RX_VHT_FLAG_160MHZ = BIT(2),
886 RX_VHT_FLAG_BF = BIT(3),
887};
888
889/**
881 * struct ieee80211_rx_status - receive status 890 * struct ieee80211_rx_status - receive status
882 * 891 *
883 * The low-level driver should provide this information (the subset 892 * The low-level driver should provide this information (the subset
@@ -902,26 +911,19 @@ enum mac80211_rx_flags {
902 * HT or VHT is used (%RX_FLAG_HT/%RX_FLAG_VHT) 911 * HT or VHT is used (%RX_FLAG_HT/%RX_FLAG_VHT)
903 * @vht_nss: number of streams (VHT only) 912 * @vht_nss: number of streams (VHT only)
904 * @flag: %RX_FLAG_* 913 * @flag: %RX_FLAG_*
914 * @vht_flag: %RX_VHT_FLAG_*
905 * @rx_flags: internal RX flags for mac80211 915 * @rx_flags: internal RX flags for mac80211
906 * @ampdu_reference: A-MPDU reference number, must be a different value for 916 * @ampdu_reference: A-MPDU reference number, must be a different value for
907 * each A-MPDU but the same for each subframe within one A-MPDU 917 * each A-MPDU but the same for each subframe within one A-MPDU
908 * @ampdu_delimiter_crc: A-MPDU delimiter CRC 918 * @ampdu_delimiter_crc: A-MPDU delimiter CRC
909 * @vendor_radiotap_bitmap: radiotap vendor namespace presence bitmap
910 * @vendor_radiotap_len: radiotap vendor namespace length
911 * @vendor_radiotap_align: radiotap vendor namespace alignment. Note
912 * that the actual data must be at the start of the SKB data
913 * already.
914 * @vendor_radiotap_oui: radiotap vendor namespace OUI
915 * @vendor_radiotap_subns: radiotap vendor sub namespace
916 */ 919 */
917struct ieee80211_rx_status { 920struct ieee80211_rx_status {
918 u64 mactime; 921 u64 mactime;
919 u32 device_timestamp; 922 u32 device_timestamp;
920 u32 ampdu_reference; 923 u32 ampdu_reference;
921 u32 flag; 924 u32 flag;
922 u32 vendor_radiotap_bitmap;
923 u16 vendor_radiotap_len;
924 u16 freq; 925 u16 freq;
926 u8 vht_flag;
925 u8 rate_idx; 927 u8 rate_idx;
926 u8 vht_nss; 928 u8 vht_nss;
927 u8 rx_flags; 929 u8 rx_flags;
@@ -931,9 +933,6 @@ struct ieee80211_rx_status {
931 u8 chains; 933 u8 chains;
932 s8 chain_signal[IEEE80211_MAX_CHAINS]; 934 s8 chain_signal[IEEE80211_MAX_CHAINS];
933 u8 ampdu_delimiter_crc; 935 u8 ampdu_delimiter_crc;
934 u8 vendor_radiotap_align;
935 u8 vendor_radiotap_oui[3];
936 u8 vendor_radiotap_subns;
937}; 936};
938 937
939/** 938/**
@@ -1506,8 +1505,6 @@ struct ieee80211_tx_control {
1506 * @IEEE80211_HW_CONNECTION_MONITOR: 1505 * @IEEE80211_HW_CONNECTION_MONITOR:
1507 * The hardware performs its own connection monitoring, including 1506 * The hardware performs its own connection monitoring, including
1508 * periodic keep-alives to the AP and probing the AP on beacon loss. 1507 * periodic keep-alives to the AP and probing the AP on beacon loss.
1509 * When this flag is set, signaling beacon-loss will cause an immediate
1510 * change to disassociated state.
1511 * 1508 *
1512 * @IEEE80211_HW_NEED_DTIM_BEFORE_ASSOC: 1509 * @IEEE80211_HW_NEED_DTIM_BEFORE_ASSOC:
1513 * This device needs to get data from beacon before association (i.e. 1510 * This device needs to get data from beacon before association (i.e.
@@ -1643,10 +1640,6 @@ enum ieee80211_hw_flags {
1643 * the hw can report back. 1640 * the hw can report back.
1644 * @max_rate_tries: maximum number of tries for each stage 1641 * @max_rate_tries: maximum number of tries for each stage
1645 * 1642 *
1646 * @napi_weight: weight used for NAPI polling. You must specify an
1647 * appropriate value here if a napi_poll operation is provided
1648 * by your driver.
1649 *
1650 * @max_rx_aggregation_subframes: maximum buffer size (number of 1643 * @max_rx_aggregation_subframes: maximum buffer size (number of
1651 * sub-frames) to be used for A-MPDU block ack receiver 1644 * sub-frames) to be used for A-MPDU block ack receiver
1652 * aggregation. 1645 * aggregation.
@@ -1700,7 +1693,6 @@ struct ieee80211_hw {
1700 int vif_data_size; 1693 int vif_data_size;
1701 int sta_data_size; 1694 int sta_data_size;
1702 int chanctx_data_size; 1695 int chanctx_data_size;
1703 int napi_weight;
1704 u16 queues; 1696 u16 queues;
1705 u16 max_listen_interval; 1697 u16 max_listen_interval;
1706 s8 max_signal; 1698 s8 max_signal;
@@ -2470,6 +2462,7 @@ enum ieee80211_roc_type {
2470 * This process will continue until sched_scan_stop is called. 2462 * This process will continue until sched_scan_stop is called.
2471 * 2463 *
2472 * @sched_scan_stop: Tell the hardware to stop an ongoing scheduled scan. 2464 * @sched_scan_stop: Tell the hardware to stop an ongoing scheduled scan.
2465 * In this case, ieee80211_sched_scan_stopped() must not be called.
2473 * 2466 *
2474 * @sw_scan_start: Notifier function that is called just before a software scan 2467 * @sw_scan_start: Notifier function that is called just before a software scan
2475 * is started. Can be NULL, if the driver doesn't need this notification. 2468 * is started. Can be NULL, if the driver doesn't need this notification.
@@ -2623,8 +2616,6 @@ enum ieee80211_roc_type {
2623 * callback. They must then call ieee80211_chswitch_done() to indicate 2616 * callback. They must then call ieee80211_chswitch_done() to indicate
2624 * completion of the channel switch. 2617 * completion of the channel switch.
2625 * 2618 *
2626 * @napi_poll: Poll Rx queue for incoming data frames.
2627 *
2628 * @set_antenna: Set antenna configuration (tx_ant, rx_ant) on the device. 2619 * @set_antenna: Set antenna configuration (tx_ant, rx_ant) on the device.
2629 * Parameters are bitmaps of allowed antennas to use for TX/RX. Drivers may 2620 * Parameters are bitmaps of allowed antennas to use for TX/RX. Drivers may
2630 * reject TX/RX mask combinations they cannot support by returning -EINVAL 2621 * reject TX/RX mask combinations they cannot support by returning -EINVAL
@@ -2750,11 +2741,13 @@ enum ieee80211_roc_type {
2750 * @channel_switch_beacon: Starts a channel switch to a new channel. 2741 * @channel_switch_beacon: Starts a channel switch to a new channel.
2751 * Beacons are modified to include CSA or ECSA IEs before calling this 2742 * Beacons are modified to include CSA or ECSA IEs before calling this
2752 * function. The corresponding count fields in these IEs must be 2743 * function. The corresponding count fields in these IEs must be
2753 * decremented, and when they reach zero the driver must call 2744 * decremented, and when they reach 1 the driver must call
2754 * ieee80211_csa_finish(). Drivers which use ieee80211_beacon_get() 2745 * ieee80211_csa_finish(). Drivers which use ieee80211_beacon_get()
2755 * get the csa counter decremented by mac80211, but must check if it is 2746 * get the csa counter decremented by mac80211, but must check if it is
2756 * zero using ieee80211_csa_is_complete() after the beacon has been 2747 * 1 using ieee80211_csa_is_complete() after the beacon has been
2757 * transmitted and then call ieee80211_csa_finish(). 2748 * transmitted and then call ieee80211_csa_finish().
2749 * If the CSA count starts as zero or 1, this function will not be called,
2750 * since there won't be any time to beacon before the switch anyway.
2758 * 2751 *
2759 * @join_ibss: Join an IBSS (on an IBSS interface); this is called after all 2752 * @join_ibss: Join an IBSS (on an IBSS interface); this is called after all
2760 * information in bss_conf is set up and the beacon can be retrieved. A 2753 * information in bss_conf is set up and the beacon can be retrieved. A
@@ -2817,7 +2810,7 @@ struct ieee80211_ops {
2817 struct ieee80211_vif *vif, 2810 struct ieee80211_vif *vif,
2818 struct cfg80211_sched_scan_request *req, 2811 struct cfg80211_sched_scan_request *req,
2819 struct ieee80211_sched_scan_ies *ies); 2812 struct ieee80211_sched_scan_ies *ies);
2820 void (*sched_scan_stop)(struct ieee80211_hw *hw, 2813 int (*sched_scan_stop)(struct ieee80211_hw *hw,
2821 struct ieee80211_vif *vif); 2814 struct ieee80211_vif *vif);
2822 void (*sw_scan_start)(struct ieee80211_hw *hw); 2815 void (*sw_scan_start)(struct ieee80211_hw *hw);
2823 void (*sw_scan_complete)(struct ieee80211_hw *hw); 2816 void (*sw_scan_complete)(struct ieee80211_hw *hw);
@@ -2881,7 +2874,6 @@ struct ieee80211_ops {
2881 void (*flush)(struct ieee80211_hw *hw, u32 queues, bool drop); 2874 void (*flush)(struct ieee80211_hw *hw, u32 queues, bool drop);
2882 void (*channel_switch)(struct ieee80211_hw *hw, 2875 void (*channel_switch)(struct ieee80211_hw *hw,
2883 struct ieee80211_channel_switch *ch_switch); 2876 struct ieee80211_channel_switch *ch_switch);
2884 int (*napi_poll)(struct ieee80211_hw *hw, int budget);
2885 int (*set_antenna)(struct ieee80211_hw *hw, u32 tx_ant, u32 rx_ant); 2877 int (*set_antenna)(struct ieee80211_hw *hw, u32 tx_ant, u32 rx_ant);
2886 int (*get_antenna)(struct ieee80211_hw *hw, u32 *tx_ant, u32 *rx_ant); 2878 int (*get_antenna)(struct ieee80211_hw *hw, u32 *tx_ant, u32 *rx_ant);
2887 2879
@@ -3163,21 +3155,21 @@ void ieee80211_free_hw(struct ieee80211_hw *hw);
3163 */ 3155 */
3164void ieee80211_restart_hw(struct ieee80211_hw *hw); 3156void ieee80211_restart_hw(struct ieee80211_hw *hw);
3165 3157
3166/** ieee80211_napi_schedule - schedule NAPI poll 3158/**
3167 * 3159 * ieee80211_napi_add - initialize mac80211 NAPI context
3168 * Use this function to schedule NAPI polling on a device. 3160 * @hw: the hardware to initialize the NAPI context on
3169 * 3161 * @napi: the NAPI context to initialize
3170 * @hw: the hardware to start polling 3162 * @napi_dev: dummy NAPI netdevice, here to not waste the space if the
3171 */ 3163 * driver doesn't use NAPI
3172void ieee80211_napi_schedule(struct ieee80211_hw *hw); 3164 * @poll: poll function
3173 3165 * @weight: default weight
3174/** ieee80211_napi_complete - complete NAPI polling
3175 *
3176 * Use this function to finish NAPI polling on a device.
3177 * 3166 *
3178 * @hw: the hardware to stop polling 3167 * See also netif_napi_add().
3179 */ 3168 */
3180void ieee80211_napi_complete(struct ieee80211_hw *hw); 3169void ieee80211_napi_add(struct ieee80211_hw *hw, struct napi_struct *napi,
3170 struct net_device *napi_dev,
3171 int (*poll)(struct napi_struct *, int),
3172 int weight);
3181 3173
3182/** 3174/**
3183 * ieee80211_rx - receive frame 3175 * ieee80211_rx - receive frame
@@ -3452,13 +3444,13 @@ static inline struct sk_buff *ieee80211_beacon_get(struct ieee80211_hw *hw,
3452 * @vif: &struct ieee80211_vif pointer from the add_interface callback. 3444 * @vif: &struct ieee80211_vif pointer from the add_interface callback.
3453 * 3445 *
3454 * After a channel switch announcement was scheduled and the counter in this 3446 * After a channel switch announcement was scheduled and the counter in this
3455 * announcement hit zero, this function must be called by the driver to 3447 * announcement hits 1, this function must be called by the driver to
3456 * notify mac80211 that the channel can be changed. 3448 * notify mac80211 that the channel can be changed.
3457 */ 3449 */
3458void ieee80211_csa_finish(struct ieee80211_vif *vif); 3450void ieee80211_csa_finish(struct ieee80211_vif *vif);
3459 3451
3460/** 3452/**
3461 * ieee80211_csa_is_complete - find out if counters reached zero 3453 * ieee80211_csa_is_complete - find out if counters reached 1
3462 * @vif: &struct ieee80211_vif pointer from the add_interface callback. 3454 * @vif: &struct ieee80211_vif pointer from the add_interface callback.
3463 * 3455 *
3464 * This function returns whether the channel switch counters reached zero. 3456 * This function returns whether the channel switch counters reached zero.
@@ -4451,7 +4443,6 @@ struct ieee80211_tx_rate_control {
4451}; 4443};
4452 4444
4453struct rate_control_ops { 4445struct rate_control_ops {
4454 struct module *module;
4455 const char *name; 4446 const char *name;
4456 void *(*alloc)(struct ieee80211_hw *hw, struct dentry *debugfsdir); 4447 void *(*alloc)(struct ieee80211_hw *hw, struct dentry *debugfsdir);
4457 void (*free)(void *priv); 4448 void (*free)(void *priv);
@@ -4553,8 +4544,8 @@ int rate_control_set_rates(struct ieee80211_hw *hw,
4553 struct ieee80211_sta *pubsta, 4544 struct ieee80211_sta *pubsta,
4554 struct ieee80211_sta_rates *rates); 4545 struct ieee80211_sta_rates *rates);
4555 4546
4556int ieee80211_rate_control_register(struct rate_control_ops *ops); 4547int ieee80211_rate_control_register(const struct rate_control_ops *ops);
4557void ieee80211_rate_control_unregister(struct rate_control_ops *ops); 4548void ieee80211_rate_control_unregister(const struct rate_control_ops *ops);
4558 4549
4559static inline bool 4550static inline bool
4560conf_is_ht20(struct ieee80211_conf *conf) 4551conf_is_ht20(struct ieee80211_conf *conf)
diff --git a/include/net/mac802154.h b/include/net/mac802154.h
index 807d6b7a943f..a591053cae63 100644
--- a/include/net/mac802154.h
+++ b/include/net/mac802154.h
@@ -20,6 +20,7 @@
20#define NET_MAC802154_H 20#define NET_MAC802154_H
21 21
22#include <net/af_ieee802154.h> 22#include <net/af_ieee802154.h>
23#include <linux/skbuff.h>
23 24
24/* General MAC frame format: 25/* General MAC frame format:
25 * 2 bytes: Frame Control 26 * 2 bytes: Frame Control
@@ -50,7 +51,7 @@ struct ieee802154_hw_addr_filt {
50 * devices across independent networks. 51 * devices across independent networks.
51 */ 52 */
52 __le16 short_addr; 53 __le16 short_addr;
53 u8 ieee_addr[IEEE802154_ADDR_LEN]; 54 __le64 ieee_addr;
54 u8 pan_coord; 55 u8 pan_coord;
55}; 56};
56 57
@@ -113,6 +114,32 @@ struct ieee802154_dev {
113 * Set radio for listening on specific address. 114 * Set radio for listening on specific address.
114 * Set the device for listening on specified address. 115 * Set the device for listening on specified address.
115 * Returns either zero, or negative errno. 116 * Returns either zero, or negative errno.
117 *
118 * set_txpower:
119 * Set radio transmit power in dB. Called with pib_lock held.
120 * Returns either zero, or negative errno.
121 *
122 * set_lbt
123 * Enables or disables listen before talk on the device. Called with
124 * pib_lock held.
125 * Returns either zero, or negative errno.
126 *
127 * set_cca_mode
128 * Sets the CCA mode used by the device. Called with pib_lock held.
129 * Returns either zero, or negative errno.
130 *
131 * set_cca_ed_level
132 * Sets the CCA energy detection threshold in dBm. Called with pib_lock
133 * held.
134 * Returns either zero, or negative errno.
135 *
136 * set_csma_params
137 * Sets the CSMA parameter set for the PHY. Called with pib_lock held.
138 * Returns either zero, or negative errno.
139 *
140 * set_frame_retries
141 * Sets the retransmission attempt limit. Called with pib_lock held.
142 * Returns either zero, or negative errno.
116 */ 143 */
117struct ieee802154_ops { 144struct ieee802154_ops {
118 struct module *owner; 145 struct module *owner;
@@ -127,8 +154,16 @@ struct ieee802154_ops {
127 int (*set_hw_addr_filt)(struct ieee802154_dev *dev, 154 int (*set_hw_addr_filt)(struct ieee802154_dev *dev,
128 struct ieee802154_hw_addr_filt *filt, 155 struct ieee802154_hw_addr_filt *filt,
129 unsigned long changed); 156 unsigned long changed);
130 int (*ieee_addr)(struct ieee802154_dev *dev, 157 int (*ieee_addr)(struct ieee802154_dev *dev, __le64 addr);
131 u8 addr[IEEE802154_ADDR_LEN]); 158 int (*set_txpower)(struct ieee802154_dev *dev, int db);
159 int (*set_lbt)(struct ieee802154_dev *dev, bool on);
160 int (*set_cca_mode)(struct ieee802154_dev *dev, u8 mode);
161 int (*set_cca_ed_level)(struct ieee802154_dev *dev,
162 s32 level);
163 int (*set_csma_params)(struct ieee802154_dev *dev,
164 u8 min_be, u8 max_be, u8 retries);
165 int (*set_frame_retries)(struct ieee802154_dev *dev,
166 s8 retries);
132}; 167};
133 168
134/* Basic interface to register ieee802154 device */ 169/* Basic interface to register ieee802154 device */
diff --git a/include/net/net_namespace.h b/include/net/net_namespace.h
index 991dcd94cbbf..79387f73f875 100644
--- a/include/net/net_namespace.h
+++ b/include/net/net_namespace.h
@@ -15,6 +15,7 @@
15#include <net/netns/packet.h> 15#include <net/netns/packet.h>
16#include <net/netns/ipv4.h> 16#include <net/netns/ipv4.h>
17#include <net/netns/ipv6.h> 17#include <net/netns/ipv6.h>
18#include <net/netns/ieee802154_6lowpan.h>
18#include <net/netns/sctp.h> 19#include <net/netns/sctp.h>
19#include <net/netns/dccp.h> 20#include <net/netns/dccp.h>
20#include <net/netns/netfilter.h> 21#include <net/netns/netfilter.h>
@@ -90,6 +91,9 @@ struct net {
90#if IS_ENABLED(CONFIG_IPV6) 91#if IS_ENABLED(CONFIG_IPV6)
91 struct netns_ipv6 ipv6; 92 struct netns_ipv6 ipv6;
92#endif 93#endif
94#if IS_ENABLED(CONFIG_IEEE802154_6LOWPAN)
95 struct netns_ieee802154_lowpan ieee802154_lowpan;
96#endif
93#if defined(CONFIG_IP_SCTP) || defined(CONFIG_IP_SCTP_MODULE) 97#if defined(CONFIG_IP_SCTP) || defined(CONFIG_IP_SCTP_MODULE)
94 struct netns_sctp sctp; 98 struct netns_sctp sctp;
95#endif 99#endif
diff --git a/include/net/netfilter/nf_conntrack.h b/include/net/netfilter/nf_conntrack.h
index b2ac6246b7e0..37252f71a380 100644
--- a/include/net/netfilter/nf_conntrack.h
+++ b/include/net/netfilter/nf_conntrack.h
@@ -73,10 +73,17 @@ struct nf_conn_help {
73 73
74struct nf_conn { 74struct nf_conn {
75 /* Usage count in here is 1 for hash table/destruct timer, 1 per skb, 75 /* Usage count in here is 1 for hash table/destruct timer, 1 per skb,
76 plus 1 for any connection(s) we are `master' for */ 76 * plus 1 for any connection(s) we are `master' for
77 *
78 * Hint, SKB address this struct and refcnt via skb->nfct and
79 * helpers nf_conntrack_get() and nf_conntrack_put().
80 * Helper nf_ct_put() equals nf_conntrack_put() by dec refcnt,
81 * beware nf_ct_get() is different and don't inc refcnt.
82 */
77 struct nf_conntrack ct_general; 83 struct nf_conntrack ct_general;
78 84
79 spinlock_t lock; 85 spinlock_t lock;
86 u16 cpu;
80 87
81 /* XXX should I move this to the tail ? - Y.K */ 88 /* XXX should I move this to the tail ? - Y.K */
82 /* These are my tuples; original and reply */ 89 /* These are my tuples; original and reply */
diff --git a/include/net/netfilter/nf_conntrack_core.h b/include/net/netfilter/nf_conntrack_core.h
index 15308b8eb5b5..cc0c18827602 100644
--- a/include/net/netfilter/nf_conntrack_core.h
+++ b/include/net/netfilter/nf_conntrack_core.h
@@ -77,6 +77,13 @@ print_tuple(struct seq_file *s, const struct nf_conntrack_tuple *tuple,
77 const struct nf_conntrack_l3proto *l3proto, 77 const struct nf_conntrack_l3proto *l3proto,
78 const struct nf_conntrack_l4proto *proto); 78 const struct nf_conntrack_l4proto *proto);
79 79
80extern spinlock_t nf_conntrack_lock ; 80#ifdef CONFIG_LOCKDEP
81# define CONNTRACK_LOCKS 8
82#else
83# define CONNTRACK_LOCKS 1024
84#endif
85extern spinlock_t nf_conntrack_locks[CONNTRACK_LOCKS];
86
87extern spinlock_t nf_conntrack_expect_lock;
81 88
82#endif /* _NF_CONNTRACK_CORE_H */ 89#endif /* _NF_CONNTRACK_CORE_H */
diff --git a/include/net/netfilter/nf_conntrack_labels.h b/include/net/netfilter/nf_conntrack_labels.h
index c985695283b3..dec6336bf850 100644
--- a/include/net/netfilter/nf_conntrack_labels.h
+++ b/include/net/netfilter/nf_conntrack_labels.h
@@ -7,6 +7,8 @@
7 7
8#include <uapi/linux/netfilter/xt_connlabel.h> 8#include <uapi/linux/netfilter/xt_connlabel.h>
9 9
10#define NF_CT_LABELS_MAX_SIZE ((XT_CONNLABEL_MAXBIT + 1) / BITS_PER_BYTE)
11
10struct nf_conn_labels { 12struct nf_conn_labels {
11 u8 words; 13 u8 words;
12 unsigned long bits[]; 14 unsigned long bits[];
@@ -29,7 +31,7 @@ static inline struct nf_conn_labels *nf_ct_labels_ext_add(struct nf_conn *ct)
29 u8 words; 31 u8 words;
30 32
31 words = ACCESS_ONCE(net->ct.label_words); 33 words = ACCESS_ONCE(net->ct.label_words);
32 if (words == 0 || WARN_ON_ONCE(words > 8)) 34 if (words == 0)
33 return NULL; 35 return NULL;
34 36
35 cl_ext = nf_ct_ext_add_length(ct, NF_CT_EXT_LABELS, 37 cl_ext = nf_ct_ext_add_length(ct, NF_CT_EXT_LABELS,
diff --git a/include/net/netfilter/nf_tables.h b/include/net/netfilter/nf_tables.h
index e7e14ffe0f6a..e6bc14d8fa9a 100644
--- a/include/net/netfilter/nf_tables.h
+++ b/include/net/netfilter/nf_tables.h
@@ -3,6 +3,7 @@
3 3
4#include <linux/list.h> 4#include <linux/list.h>
5#include <linux/netfilter.h> 5#include <linux/netfilter.h>
6#include <linux/netfilter/nfnetlink.h>
6#include <linux/netfilter/x_tables.h> 7#include <linux/netfilter/x_tables.h>
7#include <linux/netfilter/nf_tables.h> 8#include <linux/netfilter/nf_tables.h>
8#include <net/netlink.h> 9#include <net/netlink.h>
@@ -288,7 +289,8 @@ struct nft_expr_ops {
288 int (*init)(const struct nft_ctx *ctx, 289 int (*init)(const struct nft_ctx *ctx,
289 const struct nft_expr *expr, 290 const struct nft_expr *expr,
290 const struct nlattr * const tb[]); 291 const struct nlattr * const tb[]);
291 void (*destroy)(const struct nft_expr *expr); 292 void (*destroy)(const struct nft_ctx *ctx,
293 const struct nft_expr *expr);
292 int (*dump)(struct sk_buff *skb, 294 int (*dump)(struct sk_buff *skb,
293 const struct nft_expr *expr); 295 const struct nft_expr *expr);
294 int (*validate)(const struct nft_ctx *ctx, 296 int (*validate)(const struct nft_ctx *ctx,
@@ -325,13 +327,15 @@ static inline void *nft_expr_priv(const struct nft_expr *expr)
325 * @handle: rule handle 327 * @handle: rule handle
326 * @genmask: generation mask 328 * @genmask: generation mask
327 * @dlen: length of expression data 329 * @dlen: length of expression data
330 * @ulen: length of user data (used for comments)
328 * @data: expression data 331 * @data: expression data
329 */ 332 */
330struct nft_rule { 333struct nft_rule {
331 struct list_head list; 334 struct list_head list;
332 u64 handle:46, 335 u64 handle:42,
333 genmask:2, 336 genmask:2,
334 dlen:16; 337 dlen:12,
338 ulen:8;
335 unsigned char data[] 339 unsigned char data[]
336 __attribute__((aligned(__alignof__(struct nft_expr)))); 340 __attribute__((aligned(__alignof__(struct nft_expr))));
337}; 341};
@@ -340,19 +344,13 @@ struct nft_rule {
340 * struct nft_rule_trans - nf_tables rule update in transaction 344 * struct nft_rule_trans - nf_tables rule update in transaction
341 * 345 *
342 * @list: used internally 346 * @list: used internally
347 * @ctx: rule context
343 * @rule: rule that needs to be updated 348 * @rule: rule that needs to be updated
344 * @chain: chain that this rule belongs to
345 * @table: table for which this chain applies
346 * @nlh: netlink header of the message that contain this update
347 * @family: family expressesed as AF_*
348 */ 349 */
349struct nft_rule_trans { 350struct nft_rule_trans {
350 struct list_head list; 351 struct list_head list;
352 struct nft_ctx ctx;
351 struct nft_rule *rule; 353 struct nft_rule *rule;
352 const struct nft_chain *chain;
353 const struct nft_table *table;
354 const struct nlmsghdr *nlh;
355 u8 family;
356}; 354};
357 355
358static inline struct nft_expr *nft_expr_first(const struct nft_rule *rule) 356static inline struct nft_expr *nft_expr_first(const struct nft_rule *rule)
@@ -370,6 +368,11 @@ static inline struct nft_expr *nft_expr_last(const struct nft_rule *rule)
370 return (struct nft_expr *)&rule->data[rule->dlen]; 368 return (struct nft_expr *)&rule->data[rule->dlen];
371} 369}
372 370
371static inline void *nft_userdata(const struct nft_rule *rule)
372{
373 return (void *)&rule->data[rule->dlen];
374}
375
373/* 376/*
374 * The last pointer isn't really necessary, but the compiler isn't able to 377 * The last pointer isn't really necessary, but the compiler isn't able to
375 * determine that the result of nft_expr_last() is always the same since it 378 * determine that the result of nft_expr_last() is always the same since it
@@ -521,6 +524,9 @@ void nft_unregister_chain_type(const struct nf_chain_type *);
521int nft_register_expr(struct nft_expr_type *); 524int nft_register_expr(struct nft_expr_type *);
522void nft_unregister_expr(struct nft_expr_type *); 525void nft_unregister_expr(struct nft_expr_type *);
523 526
527#define nft_dereference(p) \
528 nfnl_dereference(p, NFNL_SUBSYS_NFTABLES)
529
524#define MODULE_ALIAS_NFT_FAMILY(family) \ 530#define MODULE_ALIAS_NFT_FAMILY(family) \
525 MODULE_ALIAS("nft-afinfo-" __stringify(family)) 531 MODULE_ALIAS("nft-afinfo-" __stringify(family))
526 532
diff --git a/include/net/netns/conntrack.h b/include/net/netns/conntrack.h
index fbcc7fa536dc..773cce308bc6 100644
--- a/include/net/netns/conntrack.h
+++ b/include/net/netns/conntrack.h
@@ -5,6 +5,7 @@
5#include <linux/list_nulls.h> 5#include <linux/list_nulls.h>
6#include <linux/atomic.h> 6#include <linux/atomic.h>
7#include <linux/netfilter/nf_conntrack_tcp.h> 7#include <linux/netfilter/nf_conntrack_tcp.h>
8#include <linux/seqlock.h>
8 9
9struct ctl_table_header; 10struct ctl_table_header;
10struct nf_conntrack_ecache; 11struct nf_conntrack_ecache;
@@ -62,6 +63,13 @@ struct nf_ip_net {
62#endif 63#endif
63}; 64};
64 65
66struct ct_pcpu {
67 spinlock_t lock;
68 struct hlist_nulls_head unconfirmed;
69 struct hlist_nulls_head dying;
70 struct hlist_nulls_head tmpl;
71};
72
65struct netns_ct { 73struct netns_ct {
66 atomic_t count; 74 atomic_t count;
67 unsigned int expect_count; 75 unsigned int expect_count;
@@ -83,12 +91,11 @@ struct netns_ct {
83 int sysctl_checksum; 91 int sysctl_checksum;
84 92
85 unsigned int htable_size; 93 unsigned int htable_size;
94 seqcount_t generation;
86 struct kmem_cache *nf_conntrack_cachep; 95 struct kmem_cache *nf_conntrack_cachep;
87 struct hlist_nulls_head *hash; 96 struct hlist_nulls_head *hash;
88 struct hlist_head *expect_hash; 97 struct hlist_head *expect_hash;
89 struct hlist_nulls_head unconfirmed; 98 struct ct_pcpu __percpu *pcpu_lists;
90 struct hlist_nulls_head dying;
91 struct hlist_nulls_head tmpl;
92 struct ip_conntrack_stat __percpu *stat; 99 struct ip_conntrack_stat __percpu *stat;
93 struct nf_ct_event_notifier __rcu *nf_conntrack_event_cb; 100 struct nf_ct_event_notifier __rcu *nf_conntrack_event_cb;
94 struct nf_exp_event_notifier __rcu *nf_expect_event_cb; 101 struct nf_exp_event_notifier __rcu *nf_expect_event_cb;
diff --git a/include/net/netns/ieee802154_6lowpan.h b/include/net/netns/ieee802154_6lowpan.h
new file mode 100644
index 000000000000..079030c853d8
--- /dev/null
+++ b/include/net/netns/ieee802154_6lowpan.h
@@ -0,0 +1,22 @@
1/*
2 * ieee802154 6lowpan in net namespaces
3 */
4
5#include <net/inet_frag.h>
6
7#ifndef __NETNS_IEEE802154_6LOWPAN_H__
8#define __NETNS_IEEE802154_6LOWPAN_H__
9
10struct netns_sysctl_lowpan {
11#ifdef CONFIG_SYSCTL
12 struct ctl_table_header *frags_hdr;
13#endif
14};
15
16struct netns_ieee802154_lowpan {
17 struct netns_sysctl_lowpan sysctl;
18 struct netns_frags frags;
19 u16 max_dsize;
20};
21
22#endif
diff --git a/include/net/netns/xfrm.h b/include/net/netns/xfrm.h
index 1006a265beb3..3492434baf88 100644
--- a/include/net/netns/xfrm.h
+++ b/include/net/netns/xfrm.h
@@ -6,6 +6,7 @@
6#include <linux/workqueue.h> 6#include <linux/workqueue.h>
7#include <linux/xfrm.h> 7#include <linux/xfrm.h>
8#include <net/dst_ops.h> 8#include <net/dst_ops.h>
9#include <net/flowcache.h>
9 10
10struct ctl_table_header; 11struct ctl_table_header;
11 12
@@ -58,9 +59,17 @@ struct netns_xfrm {
58 struct dst_ops xfrm6_dst_ops; 59 struct dst_ops xfrm6_dst_ops;
59#endif 60#endif
60 spinlock_t xfrm_state_lock; 61 spinlock_t xfrm_state_lock;
61 spinlock_t xfrm_policy_sk_bundle_lock;
62 rwlock_t xfrm_policy_lock; 62 rwlock_t xfrm_policy_lock;
63 struct mutex xfrm_cfg_mutex; 63 struct mutex xfrm_cfg_mutex;
64
65 /* flow cache part */
66 struct flow_cache flow_cache_global;
67 atomic_t flow_cache_genid;
68 struct list_head flow_cache_gc_list;
69 spinlock_t flow_cache_gc_lock;
70 struct work_struct flow_cache_gc_work;
71 struct work_struct flow_cache_flush_work;
72 struct mutex flow_flush_sem;
64}; 73};
65 74
66#endif 75#endif
diff --git a/include/net/nfc/digital.h b/include/net/nfc/digital.h
index 81af21e9bcd4..7655cfe27c34 100644
--- a/include/net/nfc/digital.h
+++ b/include/net/nfc/digital.h
@@ -35,6 +35,7 @@ enum {
35 NFC_DIGITAL_RF_TECH_106A = 0, 35 NFC_DIGITAL_RF_TECH_106A = 0,
36 NFC_DIGITAL_RF_TECH_212F, 36 NFC_DIGITAL_RF_TECH_212F,
37 NFC_DIGITAL_RF_TECH_424F, 37 NFC_DIGITAL_RF_TECH_424F,
38 NFC_DIGITAL_RF_TECH_ISO15693,
38 39
39 NFC_DIGITAL_RF_TECH_LAST, 40 NFC_DIGITAL_RF_TECH_LAST,
40}; 41};
@@ -50,6 +51,7 @@ enum {
50 51
51 NFC_DIGITAL_FRAMING_NFCA_T1T, 52 NFC_DIGITAL_FRAMING_NFCA_T1T,
52 NFC_DIGITAL_FRAMING_NFCA_T2T, 53 NFC_DIGITAL_FRAMING_NFCA_T2T,
54 NFC_DIGITAL_FRAMING_NFCA_T4T,
53 NFC_DIGITAL_FRAMING_NFCA_NFC_DEP, 55 NFC_DIGITAL_FRAMING_NFCA_NFC_DEP,
54 56
55 NFC_DIGITAL_FRAMING_NFCF, 57 NFC_DIGITAL_FRAMING_NFCF,
@@ -57,6 +59,9 @@ enum {
57 NFC_DIGITAL_FRAMING_NFCF_NFC_DEP, 59 NFC_DIGITAL_FRAMING_NFCF_NFC_DEP,
58 NFC_DIGITAL_FRAMING_NFC_DEP_ACTIVATED, 60 NFC_DIGITAL_FRAMING_NFC_DEP_ACTIVATED,
59 61
62 NFC_DIGITAL_FRAMING_ISO15693_INVENTORY,
63 NFC_DIGITAL_FRAMING_ISO15693_T5T,
64
60 NFC_DIGITAL_FRAMING_LAST, 65 NFC_DIGITAL_FRAMING_LAST,
61}; 66};
62 67
@@ -204,6 +209,8 @@ struct nfc_digital_dev {
204 u8 curr_rf_tech; 209 u8 curr_rf_tech;
205 u8 curr_nfc_dep_pni; 210 u8 curr_nfc_dep_pni;
206 211
212 u16 target_fsc;
213
207 int (*skb_check_crc)(struct sk_buff *skb); 214 int (*skb_check_crc)(struct sk_buff *skb);
208 void (*skb_add_crc)(struct sk_buff *skb); 215 void (*skb_add_crc)(struct sk_buff *skb);
209}; 216};
diff --git a/include/net/nfc/nfc.h b/include/net/nfc/nfc.h
index e80894bca1d0..2e8b40c16274 100644
--- a/include/net/nfc/nfc.h
+++ b/include/net/nfc/nfc.h
@@ -111,6 +111,9 @@ struct nfc_target {
111 u8 sensf_res[NFC_SENSF_RES_MAXSIZE]; 111 u8 sensf_res[NFC_SENSF_RES_MAXSIZE];
112 u8 hci_reader_gate; 112 u8 hci_reader_gate;
113 u8 logical_idx; 113 u8 logical_idx;
114 u8 is_iso15693;
115 u8 iso15693_dsfid;
116 u8 iso15693_uid[NFC_ISO15693_UID_MAXSIZE];
114}; 117};
115 118
116/** 119/**
diff --git a/include/net/nl802154.h b/include/net/nl802154.h
index 99d2ba1c7e03..b23548e04098 100644
--- a/include/net/nl802154.h
+++ b/include/net/nl802154.h
@@ -52,7 +52,7 @@ int ieee802154_nl_assoc_indic(struct net_device *dev,
52 * Note: This is in section 7.3.2 of the IEEE 802.15.4 document. 52 * Note: This is in section 7.3.2 of the IEEE 802.15.4 document.
53 */ 53 */
54int ieee802154_nl_assoc_confirm(struct net_device *dev, 54int ieee802154_nl_assoc_confirm(struct net_device *dev,
55 u16 short_addr, u8 status); 55 __le16 short_addr, u8 status);
56 56
57/** 57/**
58 * ieee802154_nl_disassoc_indic - Notify userland of disassociation. 58 * ieee802154_nl_disassoc_indic - Notify userland of disassociation.
@@ -111,8 +111,8 @@ int ieee802154_nl_scan_confirm(struct net_device *dev,
111 * Note: This API cannot indicate a beacon frame for a coordinator 111 * Note: This API cannot indicate a beacon frame for a coordinator
112 * operating in long addressing mode. 112 * operating in long addressing mode.
113 */ 113 */
114int ieee802154_nl_beacon_indic(struct net_device *dev, u16 panid, 114int ieee802154_nl_beacon_indic(struct net_device *dev, __le16 panid,
115 u16 coord_addr); 115 __le16 coord_addr);
116 116
117/** 117/**
118 * ieee802154_nl_start_confirm - Notify userland of completion of start. 118 * ieee802154_nl_start_confirm - Notify userland of completion of start.
diff --git a/include/net/regulatory.h b/include/net/regulatory.h
index b07cdc9fa454..75fc1f5a948d 100644
--- a/include/net/regulatory.h
+++ b/include/net/regulatory.h
@@ -155,6 +155,7 @@ struct ieee80211_reg_rule {
155 struct ieee80211_freq_range freq_range; 155 struct ieee80211_freq_range freq_range;
156 struct ieee80211_power_rule power_rule; 156 struct ieee80211_power_rule power_rule;
157 u32 flags; 157 u32 flags;
158 u32 dfs_cac_ms;
158}; 159};
159 160
160struct ieee80211_regdomain { 161struct ieee80211_regdomain {
@@ -172,14 +173,18 @@ struct ieee80211_regdomain {
172#define DBM_TO_MBM(gain) ((gain) * 100) 173#define DBM_TO_MBM(gain) ((gain) * 100)
173#define MBM_TO_DBM(gain) ((gain) / 100) 174#define MBM_TO_DBM(gain) ((gain) / 100)
174 175
175#define REG_RULE(start, end, bw, gain, eirp, reg_flags) \ 176#define REG_RULE_EXT(start, end, bw, gain, eirp, dfs_cac, reg_flags) \
176{ \ 177{ \
177 .freq_range.start_freq_khz = MHZ_TO_KHZ(start), \ 178 .freq_range.start_freq_khz = MHZ_TO_KHZ(start), \
178 .freq_range.end_freq_khz = MHZ_TO_KHZ(end), \ 179 .freq_range.end_freq_khz = MHZ_TO_KHZ(end), \
179 .freq_range.max_bandwidth_khz = MHZ_TO_KHZ(bw), \ 180 .freq_range.max_bandwidth_khz = MHZ_TO_KHZ(bw), \
180 .power_rule.max_antenna_gain = DBI_TO_MBI(gain),\ 181 .power_rule.max_antenna_gain = DBI_TO_MBI(gain), \
181 .power_rule.max_eirp = DBM_TO_MBM(eirp), \ 182 .power_rule.max_eirp = DBM_TO_MBM(eirp), \
182 .flags = reg_flags, \ 183 .flags = reg_flags, \
184 .dfs_cac_ms = dfs_cac, \
183} 185}
184 186
187#define REG_RULE(start, end, bw, gain, eirp, reg_flags) \
188 REG_RULE_EXT(start, end, bw, gain, eirp, 0, reg_flags)
189
185#endif 190#endif
diff --git a/include/net/route.h b/include/net/route.h
index 9d1f423d5944..b17cf28f996e 100644
--- a/include/net/route.h
+++ b/include/net/route.h
@@ -191,7 +191,6 @@ unsigned int inet_dev_addr_type(struct net *net, const struct net_device *dev,
191void ip_rt_multicast_event(struct in_device *); 191void ip_rt_multicast_event(struct in_device *);
192int ip_rt_ioctl(struct net *, unsigned int cmd, void __user *arg); 192int ip_rt_ioctl(struct net *, unsigned int cmd, void __user *arg);
193void ip_rt_get_source(u8 *src, struct sk_buff *skb, struct rtable *rt); 193void ip_rt_get_source(u8 *src, struct sk_buff *skb, struct rtable *rt);
194int ip_rt_dump(struct sk_buff *skb, struct netlink_callback *cb);
195 194
196struct in_ifaddr; 195struct in_ifaddr;
197void fib_add_ifaddr(struct in_ifaddr *); 196void fib_add_ifaddr(struct in_ifaddr *);
diff --git a/include/net/rtnetlink.h b/include/net/rtnetlink.h
index 661e45d38051..72240e5ac2c4 100644
--- a/include/net/rtnetlink.h
+++ b/include/net/rtnetlink.h
@@ -140,7 +140,7 @@ struct net_device *rtnl_create_link(struct net *net, char *ifname,
140 struct nlattr *tb[]); 140 struct nlattr *tb[]);
141int rtnl_configure_link(struct net_device *dev, const struct ifinfomsg *ifm); 141int rtnl_configure_link(struct net_device *dev, const struct ifinfomsg *ifm);
142 142
143extern const struct nla_policy ifla_policy[IFLA_MAX+1]; 143int rtnl_nla_parse_ifla(struct nlattr **tb, const struct nlattr *head, int len);
144 144
145#define MODULE_ALIAS_RTNL_LINK(kind) MODULE_ALIAS("rtnl-link-" kind) 145#define MODULE_ALIAS_RTNL_LINK(kind) MODULE_ALIAS("rtnl-link-" kind)
146 146
diff --git a/include/net/sock.h b/include/net/sock.h
index b9586a137cad..06a5668f05c9 100644
--- a/include/net/sock.h
+++ b/include/net/sock.h
@@ -862,9 +862,9 @@ static inline void sock_rps_save_rxhash(struct sock *sk,
862 const struct sk_buff *skb) 862 const struct sk_buff *skb)
863{ 863{
864#ifdef CONFIG_RPS 864#ifdef CONFIG_RPS
865 if (unlikely(sk->sk_rxhash != skb->rxhash)) { 865 if (unlikely(sk->sk_rxhash != skb->hash)) {
866 sock_rps_reset_flow(sk); 866 sock_rps_reset_flow(sk);
867 sk->sk_rxhash = skb->rxhash; 867 sk->sk_rxhash = skb->hash;
868 } 868 }
869#endif 869#endif
870} 870}
@@ -1621,33 +1621,6 @@ void sk_common_release(struct sock *sk);
1621/* Initialise core socket variables */ 1621/* Initialise core socket variables */
1622void sock_init_data(struct socket *sock, struct sock *sk); 1622void sock_init_data(struct socket *sock, struct sock *sk);
1623 1623
1624void sk_filter_release_rcu(struct rcu_head *rcu);
1625
1626/**
1627 * sk_filter_release - release a socket filter
1628 * @fp: filter to remove
1629 *
1630 * Remove a filter from a socket and release its resources.
1631 */
1632
1633static inline void sk_filter_release(struct sk_filter *fp)
1634{
1635 if (atomic_dec_and_test(&fp->refcnt))
1636 call_rcu(&fp->rcu, sk_filter_release_rcu);
1637}
1638
1639static inline void sk_filter_uncharge(struct sock *sk, struct sk_filter *fp)
1640{
1641 atomic_sub(sk_filter_size(fp->len), &sk->sk_omem_alloc);
1642 sk_filter_release(fp);
1643}
1644
1645static inline void sk_filter_charge(struct sock *sk, struct sk_filter *fp)
1646{
1647 atomic_inc(&fp->refcnt);
1648 atomic_add(sk_filter_size(fp->len), &sk->sk_omem_alloc);
1649}
1650
1651/* 1624/*
1652 * Socket reference counting postulates. 1625 * Socket reference counting postulates.
1653 * 1626 *
@@ -2256,8 +2229,12 @@ void sock_net_set(struct sock *sk, struct net *net)
2256 */ 2229 */
2257static inline void sk_change_net(struct sock *sk, struct net *net) 2230static inline void sk_change_net(struct sock *sk, struct net *net)
2258{ 2231{
2259 put_net(sock_net(sk)); 2232 struct net *current_net = sock_net(sk);
2260 sock_net_set(sk, hold_net(net)); 2233
2234 if (!net_eq(current_net, net)) {
2235 put_net(current_net);
2236 sock_net_set(sk, hold_net(net));
2237 }
2261} 2238}
2262 2239
2263static inline struct sock *skb_steal_sock(struct sk_buff *skb) 2240static inline struct sock *skb_steal_sock(struct sk_buff *skb)
diff --git a/include/net/tc_act/tc_csum.h b/include/net/tc_act/tc_csum.h
index 9e8710be7a04..fa8f5fac65e9 100644
--- a/include/net/tc_act/tc_csum.h
+++ b/include/net/tc_act/tc_csum.h
@@ -9,7 +9,7 @@ struct tcf_csum {
9 9
10 u32 update_flags; 10 u32 update_flags;
11}; 11};
12#define to_tcf_csum(pc) \ 12#define to_tcf_csum(a) \
13 container_of(pc,struct tcf_csum,common) 13 container_of(a->priv,struct tcf_csum,common)
14 14
15#endif /* __NET_TC_CSUM_H */ 15#endif /* __NET_TC_CSUM_H */
diff --git a/include/net/tc_act/tc_defact.h b/include/net/tc_act/tc_defact.h
index 65f024b80958..9763dcbb9bc3 100644
--- a/include/net/tc_act/tc_defact.h
+++ b/include/net/tc_act/tc_defact.h
@@ -8,7 +8,7 @@ struct tcf_defact {
8 u32 tcfd_datalen; 8 u32 tcfd_datalen;
9 void *tcfd_defdata; 9 void *tcfd_defdata;
10}; 10};
11#define to_defact(pc) \ 11#define to_defact(a) \
12 container_of(pc, struct tcf_defact, common) 12 container_of(a->priv, struct tcf_defact, common)
13 13
14#endif /* __NET_TC_DEF_H */ 14#endif /* __NET_TC_DEF_H */
diff --git a/include/net/tc_act/tc_gact.h b/include/net/tc_act/tc_gact.h
index 9e3f6767b80e..9fc9b578908a 100644
--- a/include/net/tc_act/tc_gact.h
+++ b/include/net/tc_act/tc_gact.h
@@ -11,7 +11,7 @@ struct tcf_gact {
11 int tcfg_paction; 11 int tcfg_paction;
12#endif 12#endif
13}; 13};
14#define to_gact(pc) \ 14#define to_gact(a) \
15 container_of(pc, struct tcf_gact, common) 15 container_of(a->priv, struct tcf_gact, common)
16 16
17#endif /* __NET_TC_GACT_H */ 17#endif /* __NET_TC_GACT_H */
diff --git a/include/net/tc_act/tc_ipt.h b/include/net/tc_act/tc_ipt.h
index f7d25dfcc4b7..c0f4193f432c 100644
--- a/include/net/tc_act/tc_ipt.h
+++ b/include/net/tc_act/tc_ipt.h
@@ -11,7 +11,7 @@ struct tcf_ipt {
11 char *tcfi_tname; 11 char *tcfi_tname;
12 struct xt_entry_target *tcfi_t; 12 struct xt_entry_target *tcfi_t;
13}; 13};
14#define to_ipt(pc) \ 14#define to_ipt(a) \
15 container_of(pc, struct tcf_ipt, common) 15 container_of(a->priv, struct tcf_ipt, common)
16 16
17#endif /* __NET_TC_IPT_H */ 17#endif /* __NET_TC_IPT_H */
diff --git a/include/net/tc_act/tc_mirred.h b/include/net/tc_act/tc_mirred.h
index cfe2943690ff..4dd77a1c106b 100644
--- a/include/net/tc_act/tc_mirred.h
+++ b/include/net/tc_act/tc_mirred.h
@@ -11,7 +11,7 @@ struct tcf_mirred {
11 struct net_device *tcfm_dev; 11 struct net_device *tcfm_dev;
12 struct list_head tcfm_list; 12 struct list_head tcfm_list;
13}; 13};
14#define to_mirred(pc) \ 14#define to_mirred(a) \
15 container_of(pc, struct tcf_mirred, common) 15 container_of(a->priv, struct tcf_mirred, common)
16 16
17#endif /* __NET_TC_MIR_H */ 17#endif /* __NET_TC_MIR_H */
diff --git a/include/net/tc_act/tc_nat.h b/include/net/tc_act/tc_nat.h
index 4a691f34d703..63d8e9ca9d99 100644
--- a/include/net/tc_act/tc_nat.h
+++ b/include/net/tc_act/tc_nat.h
@@ -13,9 +13,9 @@ struct tcf_nat {
13 u32 flags; 13 u32 flags;
14}; 14};
15 15
16static inline struct tcf_nat *to_tcf_nat(struct tcf_common *pc) 16static inline struct tcf_nat *to_tcf_nat(struct tc_action *a)
17{ 17{
18 return container_of(pc, struct tcf_nat, common); 18 return container_of(a->priv, struct tcf_nat, common);
19} 19}
20 20
21#endif /* __NET_TC_NAT_H */ 21#endif /* __NET_TC_NAT_H */
diff --git a/include/net/tc_act/tc_pedit.h b/include/net/tc_act/tc_pedit.h
index e6f6e15956f5..5b80998879c7 100644
--- a/include/net/tc_act/tc_pedit.h
+++ b/include/net/tc_act/tc_pedit.h
@@ -9,7 +9,7 @@ struct tcf_pedit {
9 unsigned char tcfp_flags; 9 unsigned char tcfp_flags;
10 struct tc_pedit_key *tcfp_keys; 10 struct tc_pedit_key *tcfp_keys;
11}; 11};
12#define to_pedit(pc) \ 12#define to_pedit(a) \
13 container_of(pc, struct tcf_pedit, common) 13 container_of(a->priv, struct tcf_pedit, common)
14 14
15#endif /* __NET_TC_PED_H */ 15#endif /* __NET_TC_PED_H */
diff --git a/include/net/tc_act/tc_skbedit.h b/include/net/tc_act/tc_skbedit.h
index dd5d86fab030..0df9a0db4a8e 100644
--- a/include/net/tc_act/tc_skbedit.h
+++ b/include/net/tc_act/tc_skbedit.h
@@ -29,7 +29,7 @@ struct tcf_skbedit {
29 u16 queue_mapping; 29 u16 queue_mapping;
30 /* XXX: 16-bit pad here? */ 30 /* XXX: 16-bit pad here? */
31}; 31};
32#define to_skbedit(pc) \ 32#define to_skbedit(a) \
33 container_of(pc, struct tcf_skbedit, common) 33 container_of(a->priv, struct tcf_skbedit, common)
34 34
35#endif /* __NET_TC_SKBEDIT_H */ 35#endif /* __NET_TC_SKBEDIT_H */
diff --git a/include/net/tcp.h b/include/net/tcp.h
index 743accec6c76..87d877408188 100644
--- a/include/net/tcp.h
+++ b/include/net/tcp.h
@@ -31,6 +31,7 @@
31#include <linux/crypto.h> 31#include <linux/crypto.h>
32#include <linux/cryptohash.h> 32#include <linux/cryptohash.h>
33#include <linux/kref.h> 33#include <linux/kref.h>
34#include <linux/ktime.h>
34 35
35#include <net/inet_connection_sock.h> 36#include <net/inet_connection_sock.h>
36#include <net/inet_timewait_sock.h> 37#include <net/inet_timewait_sock.h>
@@ -478,7 +479,6 @@ int __cookie_v4_check(const struct iphdr *iph, const struct tcphdr *th,
478struct sock *cookie_v4_check(struct sock *sk, struct sk_buff *skb, 479struct sock *cookie_v4_check(struct sock *sk, struct sk_buff *skb,
479 struct ip_options *opt); 480 struct ip_options *opt);
480#ifdef CONFIG_SYN_COOKIES 481#ifdef CONFIG_SYN_COOKIES
481#include <linux/ktime.h>
482 482
483/* Syncookies use a monotonic timer which increments every 60 seconds. 483/* Syncookies use a monotonic timer which increments every 60 seconds.
484 * This counter is used both as a hash input and partially encoded into 484 * This counter is used both as a hash input and partially encoded into
@@ -620,7 +620,7 @@ static inline void tcp_bound_rto(const struct sock *sk)
620 620
621static inline u32 __tcp_set_rto(const struct tcp_sock *tp) 621static inline u32 __tcp_set_rto(const struct tcp_sock *tp)
622{ 622{
623 return (tp->srtt >> 3) + tp->rttvar; 623 return usecs_to_jiffies((tp->srtt_us >> 3) + tp->rttvar_us);
624} 624}
625 625
626static inline void __tcp_fast_path_on(struct tcp_sock *tp, u32 snd_wnd) 626static inline void __tcp_fast_path_on(struct tcp_sock *tp, u32 snd_wnd)
@@ -657,6 +657,11 @@ static inline u32 tcp_rto_min(struct sock *sk)
657 return rto_min; 657 return rto_min;
658} 658}
659 659
660static inline u32 tcp_rto_min_us(struct sock *sk)
661{
662 return jiffies_to_usecs(tcp_rto_min(sk));
663}
664
660/* Compute the actual receive window we are currently advertising. 665/* Compute the actual receive window we are currently advertising.
661 * Rcv_nxt can be after the window if our peer push more data 666 * Rcv_nxt can be after the window if our peer push more data
662 * than the offered window. 667 * than the offered window.
@@ -779,7 +784,6 @@ enum tcp_ca_event {
779#define TCP_CA_BUF_MAX (TCP_CA_NAME_MAX*TCP_CA_MAX) 784#define TCP_CA_BUF_MAX (TCP_CA_NAME_MAX*TCP_CA_MAX)
780 785
781#define TCP_CONG_NON_RESTRICTED 0x1 786#define TCP_CONG_NON_RESTRICTED 0x1
782#define TCP_CONG_RTT_STAMP 0x2
783 787
784struct tcp_congestion_ops { 788struct tcp_congestion_ops {
785 struct list_head list; 789 struct list_head list;
@@ -792,8 +796,6 @@ struct tcp_congestion_ops {
792 796
793 /* return slow start threshold (required) */ 797 /* return slow start threshold (required) */
794 u32 (*ssthresh)(struct sock *sk); 798 u32 (*ssthresh)(struct sock *sk);
795 /* lower bound for congestion window (optional) */
796 u32 (*min_cwnd)(const struct sock *sk);
797 /* do new cwnd calculation (required) */ 799 /* do new cwnd calculation (required) */
798 void (*cong_avoid)(struct sock *sk, u32 ack, u32 acked, u32 in_flight); 800 void (*cong_avoid)(struct sock *sk, u32 ack, u32 acked, u32 in_flight);
799 /* call before changing ca_state (optional) */ 801 /* call before changing ca_state (optional) */
@@ -828,7 +830,6 @@ void tcp_cong_avoid_ai(struct tcp_sock *tp, u32 w);
828extern struct tcp_congestion_ops tcp_init_congestion_ops; 830extern struct tcp_congestion_ops tcp_init_congestion_ops;
829u32 tcp_reno_ssthresh(struct sock *sk); 831u32 tcp_reno_ssthresh(struct sock *sk);
830void tcp_reno_cong_avoid(struct sock *sk, u32 ack, u32 acked, u32 in_flight); 832void tcp_reno_cong_avoid(struct sock *sk, u32 ack, u32 acked, u32 in_flight);
831u32 tcp_reno_min_cwnd(const struct sock *sk);
832extern struct tcp_congestion_ops tcp_reno; 833extern struct tcp_congestion_ops tcp_reno;
833 834
834static inline void tcp_set_ca_state(struct sock *sk, const u8 ca_state) 835static inline void tcp_set_ca_state(struct sock *sk, const u8 ca_state)
diff --git a/include/net/wpan-phy.h b/include/net/wpan-phy.h
index b52bda8d13b1..10ab0fc6d4f7 100644
--- a/include/net/wpan-phy.h
+++ b/include/net/wpan-phy.h
@@ -37,15 +37,22 @@ struct wpan_phy {
37 struct mutex pib_lock; 37 struct mutex pib_lock;
38 38
39 /* 39 /*
40 * This is a PIB according to 802.15.4-2006. 40 * This is a PIB according to 802.15.4-2011.
41 * We do not provide timing-related variables, as they 41 * We do not provide timing-related variables, as they
42 * aren't used outside of driver 42 * aren't used outside of driver
43 */ 43 */
44 u8 current_channel; 44 u8 current_channel;
45 u8 current_page; 45 u8 current_page;
46 u32 channels_supported[32]; 46 u32 channels_supported[32];
47 u8 transmit_power; 47 s8 transmit_power;
48 u8 cca_mode; 48 u8 cca_mode;
49 u8 min_be;
50 u8 max_be;
51 u8 csma_retries;
52 s8 frame_retries;
53
54 bool lbt;
55 s32 cca_ed_level;
49 56
50 struct device dev; 57 struct device dev;
51 int idx; 58 int idx;
@@ -54,6 +61,14 @@ struct wpan_phy {
54 const char *name, int type); 61 const char *name, int type);
55 void (*del_iface)(struct wpan_phy *phy, struct net_device *dev); 62 void (*del_iface)(struct wpan_phy *phy, struct net_device *dev);
56 63
64 int (*set_txpower)(struct wpan_phy *phy, int db);
65 int (*set_lbt)(struct wpan_phy *phy, bool on);
66 int (*set_cca_mode)(struct wpan_phy *phy, u8 cca_mode);
67 int (*set_cca_ed_level)(struct wpan_phy *phy, int level);
68 int (*set_csma_params)(struct wpan_phy *phy, u8 min_be, u8 max_be,
69 u8 retries);
70 int (*set_frame_retries)(struct wpan_phy *phy, s8 retries);
71
57 char priv[0] __attribute__((__aligned__(NETDEV_ALIGN))); 72 char priv[0] __attribute__((__aligned__(NETDEV_ALIGN)));
58}; 73};
59 74
diff --git a/include/net/xfrm.h b/include/net/xfrm.h
index fb5654a8ca3c..32682ae47b3f 100644
--- a/include/net/xfrm.h
+++ b/include/net/xfrm.h
@@ -118,11 +118,10 @@
118struct xfrm_state_walk { 118struct xfrm_state_walk {
119 struct list_head all; 119 struct list_head all;
120 u8 state; 120 u8 state;
121 union { 121 u8 dying;
122 u8 dying; 122 u8 proto;
123 u8 proto;
124 };
125 u32 seq; 123 u32 seq;
124 struct xfrm_address_filter *filter;
126}; 125};
127 126
128/* Full description of state of transformer. */ 127/* Full description of state of transformer. */
@@ -350,6 +349,16 @@ int xfrm_state_unregister_afinfo(struct xfrm_state_afinfo *afinfo);
350struct xfrm_state_afinfo *xfrm_state_get_afinfo(unsigned int family); 349struct xfrm_state_afinfo *xfrm_state_get_afinfo(unsigned int family);
351void xfrm_state_put_afinfo(struct xfrm_state_afinfo *afinfo); 350void xfrm_state_put_afinfo(struct xfrm_state_afinfo *afinfo);
352 351
352struct xfrm_input_afinfo {
353 unsigned int family;
354 struct module *owner;
355 int (*callback)(struct sk_buff *skb, u8 protocol,
356 int err);
357};
358
359int xfrm_input_register_afinfo(struct xfrm_input_afinfo *afinfo);
360int xfrm_input_unregister_afinfo(struct xfrm_input_afinfo *afinfo);
361
353void xfrm_state_delete_tunnel(struct xfrm_state *x); 362void xfrm_state_delete_tunnel(struct xfrm_state *x);
354 363
355struct xfrm_type { 364struct xfrm_type {
@@ -594,21 +603,33 @@ struct xfrm_mgr {
594 const struct xfrm_migrate *m, 603 const struct xfrm_migrate *m,
595 int num_bundles, 604 int num_bundles,
596 const struct xfrm_kmaddress *k); 605 const struct xfrm_kmaddress *k);
606 bool (*is_alive)(const struct km_event *c);
597}; 607};
598 608
599int xfrm_register_km(struct xfrm_mgr *km); 609int xfrm_register_km(struct xfrm_mgr *km);
600int xfrm_unregister_km(struct xfrm_mgr *km); 610int xfrm_unregister_km(struct xfrm_mgr *km);
601 611
612struct xfrm_tunnel_skb_cb {
613 union {
614 struct inet_skb_parm h4;
615 struct inet6_skb_parm h6;
616 } header;
617
618 union {
619 struct ip_tunnel *ip4;
620 struct ip6_tnl *ip6;
621 } tunnel;
622};
623
624#define XFRM_TUNNEL_SKB_CB(__skb) ((struct xfrm_tunnel_skb_cb *)&((__skb)->cb[0]))
625
602/* 626/*
603 * This structure is used for the duration where packets are being 627 * This structure is used for the duration where packets are being
604 * transformed by IPsec. As soon as the packet leaves IPsec the 628 * transformed by IPsec. As soon as the packet leaves IPsec the
605 * area beyond the generic IP part may be overwritten. 629 * area beyond the generic IP part may be overwritten.
606 */ 630 */
607struct xfrm_skb_cb { 631struct xfrm_skb_cb {
608 union { 632 struct xfrm_tunnel_skb_cb header;
609 struct inet_skb_parm h4;
610 struct inet6_skb_parm h6;
611 } header;
612 633
613 /* Sequence number for replay protection. */ 634 /* Sequence number for replay protection. */
614 union { 635 union {
@@ -630,10 +651,7 @@ struct xfrm_skb_cb {
630 * to transmit header information to the mode input/output functions. 651 * to transmit header information to the mode input/output functions.
631 */ 652 */
632struct xfrm_mode_skb_cb { 653struct xfrm_mode_skb_cb {
633 union { 654 struct xfrm_tunnel_skb_cb header;
634 struct inet_skb_parm h4;
635 struct inet6_skb_parm h6;
636 } header;
637 655
638 /* Copied from header for IPv4, always set to zero and DF for IPv6. */ 656 /* Copied from header for IPv4, always set to zero and DF for IPv6. */
639 __be16 id; 657 __be16 id;
@@ -665,10 +683,7 @@ struct xfrm_mode_skb_cb {
665 * related information. 683 * related information.
666 */ 684 */
667struct xfrm_spi_skb_cb { 685struct xfrm_spi_skb_cb {
668 union { 686 struct xfrm_tunnel_skb_cb header;
669 struct inet_skb_parm h4;
670 struct inet6_skb_parm h6;
671 } header;
672 687
673 unsigned int daddroff; 688 unsigned int daddroff;
674 unsigned int family; 689 unsigned int family;
@@ -1347,18 +1362,34 @@ struct xfrm_algo_desc {
1347 struct sadb_alg desc; 1362 struct sadb_alg desc;
1348}; 1363};
1349 1364
1350/* XFRM tunnel handlers. */ 1365/* XFRM protocol handlers. */
1351struct xfrm_tunnel { 1366struct xfrm4_protocol {
1352 int (*handler)(struct sk_buff *skb); 1367 int (*handler)(struct sk_buff *skb);
1368 int (*input_handler)(struct sk_buff *skb, int nexthdr, __be32 spi,
1369 int encap_type);
1370 int (*cb_handler)(struct sk_buff *skb, int err);
1353 int (*err_handler)(struct sk_buff *skb, u32 info); 1371 int (*err_handler)(struct sk_buff *skb, u32 info);
1354 1372
1355 struct xfrm_tunnel __rcu *next; 1373 struct xfrm4_protocol __rcu *next;
1374 int priority;
1375};
1376
1377struct xfrm6_protocol {
1378 int (*handler)(struct sk_buff *skb);
1379 int (*cb_handler)(struct sk_buff *skb, int err);
1380 int (*err_handler)(struct sk_buff *skb, struct inet6_skb_parm *opt,
1381 u8 type, u8 code, int offset, __be32 info);
1382
1383 struct xfrm6_protocol __rcu *next;
1356 int priority; 1384 int priority;
1357}; 1385};
1358 1386
1359struct xfrm_tunnel_notifier { 1387/* XFRM tunnel handlers. */
1388struct xfrm_tunnel {
1360 int (*handler)(struct sk_buff *skb); 1389 int (*handler)(struct sk_buff *skb);
1361 struct xfrm_tunnel_notifier __rcu *next; 1390 int (*err_handler)(struct sk_buff *skb, u32 info);
1391
1392 struct xfrm_tunnel __rcu *next;
1362 int priority; 1393 int priority;
1363}; 1394};
1364 1395
@@ -1375,11 +1406,14 @@ void xfrm4_init(void);
1375int xfrm_state_init(struct net *net); 1406int xfrm_state_init(struct net *net);
1376void xfrm_state_fini(struct net *net); 1407void xfrm_state_fini(struct net *net);
1377void xfrm4_state_init(void); 1408void xfrm4_state_init(void);
1409void xfrm4_protocol_init(void);
1378#ifdef CONFIG_XFRM 1410#ifdef CONFIG_XFRM
1379int xfrm6_init(void); 1411int xfrm6_init(void);
1380void xfrm6_fini(void); 1412void xfrm6_fini(void);
1381int xfrm6_state_init(void); 1413int xfrm6_state_init(void);
1382void xfrm6_state_fini(void); 1414void xfrm6_state_fini(void);
1415int xfrm6_protocol_init(void);
1416void xfrm6_protocol_fini(void);
1383#else 1417#else
1384static inline int xfrm6_init(void) 1418static inline int xfrm6_init(void)
1385{ 1419{
@@ -1405,7 +1439,8 @@ static inline void xfrm_sysctl_fini(struct net *net)
1405} 1439}
1406#endif 1440#endif
1407 1441
1408void xfrm_state_walk_init(struct xfrm_state_walk *walk, u8 proto); 1442void xfrm_state_walk_init(struct xfrm_state_walk *walk, u8 proto,
1443 struct xfrm_address_filter *filter);
1409int xfrm_state_walk(struct net *net, struct xfrm_state_walk *walk, 1444int xfrm_state_walk(struct net *net, struct xfrm_state_walk *walk,
1410 int (*func)(struct xfrm_state *, int, void*), void *); 1445 int (*func)(struct xfrm_state *, int, void*), void *);
1411void xfrm_state_walk_done(struct xfrm_state_walk *walk, struct net *net); 1446void xfrm_state_walk_done(struct xfrm_state_walk *walk, struct net *net);
@@ -1497,20 +1532,22 @@ int xfrm4_rcv(struct sk_buff *skb);
1497 1532
1498static inline int xfrm4_rcv_spi(struct sk_buff *skb, int nexthdr, __be32 spi) 1533static inline int xfrm4_rcv_spi(struct sk_buff *skb, int nexthdr, __be32 spi)
1499{ 1534{
1500 return xfrm4_rcv_encap(skb, nexthdr, spi, 0); 1535 XFRM_TUNNEL_SKB_CB(skb)->tunnel.ip4 = NULL;
1536 XFRM_SPI_SKB_CB(skb)->family = AF_INET;
1537 XFRM_SPI_SKB_CB(skb)->daddroff = offsetof(struct iphdr, daddr);
1538 return xfrm_input(skb, nexthdr, spi, 0);
1501} 1539}
1502 1540
1503int xfrm4_extract_output(struct xfrm_state *x, struct sk_buff *skb); 1541int xfrm4_extract_output(struct xfrm_state *x, struct sk_buff *skb);
1504int xfrm4_prepare_output(struct xfrm_state *x, struct sk_buff *skb); 1542int xfrm4_prepare_output(struct xfrm_state *x, struct sk_buff *skb);
1505int xfrm4_output(struct sk_buff *skb); 1543int xfrm4_output(struct sk_buff *skb);
1506int xfrm4_output_finish(struct sk_buff *skb); 1544int xfrm4_output_finish(struct sk_buff *skb);
1545int xfrm4_rcv_cb(struct sk_buff *skb, u8 protocol, int err);
1546int xfrm4_protocol_register(struct xfrm4_protocol *handler, unsigned char protocol);
1547int xfrm4_protocol_deregister(struct xfrm4_protocol *handler, unsigned char protocol);
1507int xfrm4_tunnel_register(struct xfrm_tunnel *handler, unsigned short family); 1548int xfrm4_tunnel_register(struct xfrm_tunnel *handler, unsigned short family);
1508int xfrm4_tunnel_deregister(struct xfrm_tunnel *handler, unsigned short family); 1549int xfrm4_tunnel_deregister(struct xfrm_tunnel *handler, unsigned short family);
1509void xfrm4_local_error(struct sk_buff *skb, u32 mtu); 1550void xfrm4_local_error(struct sk_buff *skb, u32 mtu);
1510int xfrm4_mode_tunnel_input_register(struct xfrm_tunnel_notifier *handler);
1511int xfrm4_mode_tunnel_input_deregister(struct xfrm_tunnel_notifier *handler);
1512int xfrm6_mode_tunnel_input_register(struct xfrm_tunnel_notifier *handler);
1513int xfrm6_mode_tunnel_input_deregister(struct xfrm_tunnel_notifier *handler);
1514int xfrm6_extract_header(struct sk_buff *skb); 1551int xfrm6_extract_header(struct sk_buff *skb);
1515int xfrm6_extract_input(struct xfrm_state *x, struct sk_buff *skb); 1552int xfrm6_extract_input(struct xfrm_state *x, struct sk_buff *skb);
1516int xfrm6_rcv_spi(struct sk_buff *skb, int nexthdr, __be32 spi); 1553int xfrm6_rcv_spi(struct sk_buff *skb, int nexthdr, __be32 spi);
@@ -1519,6 +1556,9 @@ int xfrm6_rcv(struct sk_buff *skb);
1519int xfrm6_input_addr(struct sk_buff *skb, xfrm_address_t *daddr, 1556int xfrm6_input_addr(struct sk_buff *skb, xfrm_address_t *daddr,
1520 xfrm_address_t *saddr, u8 proto); 1557 xfrm_address_t *saddr, u8 proto);
1521void xfrm6_local_error(struct sk_buff *skb, u32 mtu); 1558void xfrm6_local_error(struct sk_buff *skb, u32 mtu);
1559int xfrm6_rcv_cb(struct sk_buff *skb, u8 protocol, int err);
1560int xfrm6_protocol_register(struct xfrm6_protocol *handler, unsigned char protocol);
1561int xfrm6_protocol_deregister(struct xfrm6_protocol *handler, unsigned char protocol);
1522int xfrm6_tunnel_register(struct xfrm6_tunnel *handler, unsigned short family); 1562int xfrm6_tunnel_register(struct xfrm6_tunnel *handler, unsigned short family);
1523int xfrm6_tunnel_deregister(struct xfrm6_tunnel *handler, unsigned short family); 1563int xfrm6_tunnel_deregister(struct xfrm6_tunnel *handler, unsigned short family);
1524__be32 xfrm6_tunnel_alloc_spi(struct net *net, xfrm_address_t *saddr); 1564__be32 xfrm6_tunnel_alloc_spi(struct net *net, xfrm_address_t *saddr);
@@ -1646,6 +1686,20 @@ static inline int xfrm_aevent_is_on(struct net *net)
1646 rcu_read_unlock(); 1686 rcu_read_unlock();
1647 return ret; 1687 return ret;
1648} 1688}
1689
1690static inline int xfrm_acquire_is_on(struct net *net)
1691{
1692 struct sock *nlsk;
1693 int ret = 0;
1694
1695 rcu_read_lock();
1696 nlsk = rcu_dereference(net->xfrm.nlsk);
1697 if (nlsk)
1698 ret = netlink_has_listeners(nlsk, XFRMNLGRP_ACQUIRE);
1699 rcu_read_unlock();
1700
1701 return ret;
1702}
1649#endif 1703#endif
1650 1704
1651static inline int aead_len(struct xfrm_algo_aead *alg) 1705static inline int aead_len(struct xfrm_algo_aead *alg)
@@ -1748,4 +1802,24 @@ static inline int xfrm_mark_put(struct sk_buff *skb, const struct xfrm_mark *m)
1748 return ret; 1802 return ret;
1749} 1803}
1750 1804
1805static inline int xfrm_tunnel_check(struct sk_buff *skb, struct xfrm_state *x,
1806 unsigned int family)
1807{
1808 bool tunnel = false;
1809
1810 switch(family) {
1811 case AF_INET:
1812 if (XFRM_TUNNEL_SKB_CB(skb)->tunnel.ip4)
1813 tunnel = true;
1814 break;
1815 case AF_INET6:
1816 if (XFRM_TUNNEL_SKB_CB(skb)->tunnel.ip6)
1817 tunnel = true;
1818 break;
1819 }
1820 if (tunnel && !(x->outer_mode->flags & XFRM_MODE_FLAG_TUNNEL))
1821 return -EINVAL;
1822
1823 return 0;
1824}
1751#endif /* _NET_XFRM_H */ 1825#endif /* _NET_XFRM_H */
diff --git a/include/trace/events/net.h b/include/trace/events/net.h
index a34f27b2e394..1de256b35807 100644
--- a/include/trace/events/net.h
+++ b/include/trace/events/net.h
@@ -153,8 +153,8 @@ DECLARE_EVENT_CLASS(net_dev_rx_verbose_template,
153 __field( u16, vlan_tci ) 153 __field( u16, vlan_tci )
154 __field( u16, protocol ) 154 __field( u16, protocol )
155 __field( u8, ip_summed ) 155 __field( u8, ip_summed )
156 __field( u32, rxhash ) 156 __field( u32, hash )
157 __field( bool, l4_rxhash ) 157 __field( bool, l4_hash )
158 __field( unsigned int, len ) 158 __field( unsigned int, len )
159 __field( unsigned int, data_len ) 159 __field( unsigned int, data_len )
160 __field( unsigned int, truesize ) 160 __field( unsigned int, truesize )
@@ -179,8 +179,8 @@ DECLARE_EVENT_CLASS(net_dev_rx_verbose_template,
179 __entry->vlan_tci = vlan_tx_tag_get(skb); 179 __entry->vlan_tci = vlan_tx_tag_get(skb);
180 __entry->protocol = ntohs(skb->protocol); 180 __entry->protocol = ntohs(skb->protocol);
181 __entry->ip_summed = skb->ip_summed; 181 __entry->ip_summed = skb->ip_summed;
182 __entry->rxhash = skb->rxhash; 182 __entry->hash = skb->hash;
183 __entry->l4_rxhash = skb->l4_rxhash; 183 __entry->l4_hash = skb->l4_hash;
184 __entry->len = skb->len; 184 __entry->len = skb->len;
185 __entry->data_len = skb->data_len; 185 __entry->data_len = skb->data_len;
186 __entry->truesize = skb->truesize; 186 __entry->truesize = skb->truesize;
@@ -191,11 +191,11 @@ DECLARE_EVENT_CLASS(net_dev_rx_verbose_template,
191 __entry->gso_type = skb_shinfo(skb)->gso_type; 191 __entry->gso_type = skb_shinfo(skb)->gso_type;
192 ), 192 ),
193 193
194 TP_printk("dev=%s napi_id=%#x queue_mapping=%u skbaddr=%p vlan_tagged=%d vlan_proto=0x%04x vlan_tci=0x%04x protocol=0x%04x ip_summed=%d rxhash=0x%08x l4_rxhash=%d len=%u data_len=%u truesize=%u mac_header_valid=%d mac_header=%d nr_frags=%d gso_size=%d gso_type=%#x", 194 TP_printk("dev=%s napi_id=%#x queue_mapping=%u skbaddr=%p vlan_tagged=%d vlan_proto=0x%04x vlan_tci=0x%04x protocol=0x%04x ip_summed=%d hash=0x%08x l4_hash=%d len=%u data_len=%u truesize=%u mac_header_valid=%d mac_header=%d nr_frags=%d gso_size=%d gso_type=%#x",
195 __get_str(name), __entry->napi_id, __entry->queue_mapping, 195 __get_str(name), __entry->napi_id, __entry->queue_mapping,
196 __entry->skbaddr, __entry->vlan_tagged, __entry->vlan_proto, 196 __entry->skbaddr, __entry->vlan_tagged, __entry->vlan_proto,
197 __entry->vlan_tci, __entry->protocol, __entry->ip_summed, 197 __entry->vlan_tci, __entry->protocol, __entry->ip_summed,
198 __entry->rxhash, __entry->l4_rxhash, __entry->len, 198 __entry->hash, __entry->l4_hash, __entry->len,
199 __entry->data_len, __entry->truesize, 199 __entry->data_len, __entry->truesize,
200 __entry->mac_header_valid, __entry->mac_header, 200 __entry->mac_header_valid, __entry->mac_header,
201 __entry->nr_frags, __entry->gso_size, __entry->gso_type) 201 __entry->nr_frags, __entry->gso_size, __entry->gso_type)
diff --git a/include/uapi/linux/can.h b/include/uapi/linux/can.h
index e52958d7c2d1..5d9d1d140718 100644
--- a/include/uapi/linux/can.h
+++ b/include/uapi/linux/can.h
@@ -8,6 +8,38 @@
8 * Copyright (c) 2002-2007 Volkswagen Group Electronic Research 8 * Copyright (c) 2002-2007 Volkswagen Group Electronic Research
9 * All rights reserved. 9 * All rights reserved.
10 * 10 *
11 * Redistribution and use in source and binary forms, with or without
12 * modification, are permitted provided that the following conditions
13 * are met:
14 * 1. Redistributions of source code must retain the above copyright
15 * notice, this list of conditions and the following disclaimer.
16 * 2. Redistributions in binary form must reproduce the above copyright
17 * notice, this list of conditions and the following disclaimer in the
18 * documentation and/or other materials provided with the distribution.
19 * 3. Neither the name of Volkswagen nor the names of its contributors
20 * may be used to endorse or promote products derived from this software
21 * without specific prior written permission.
22 *
23 * Alternatively, provided that this notice is retained in full, this
24 * software may be distributed under the terms of the GNU General
25 * Public License ("GPL") version 2, in which case the provisions of the
26 * GPL apply INSTEAD OF those given above.
27 *
28 * The provided data structures and external interfaces from this code
29 * are not restricted to be used by modules with a GPL compatible license.
30 *
31 * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
32 * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
33 * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
34 * A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
35 * OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
36 * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
37 * LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
38 * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
39 * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
40 * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
41 * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH
42 * DAMAGE.
11 */ 43 */
12 44
13#ifndef CAN_H 45#ifndef CAN_H
diff --git a/include/uapi/linux/can/netlink.h b/include/uapi/linux/can/netlink.h
index df944ed206a8..7e2e1863db16 100644
--- a/include/uapi/linux/can/netlink.h
+++ b/include/uapi/linux/can/netlink.h
@@ -96,6 +96,7 @@ struct can_ctrlmode {
96#define CAN_CTRLMODE_3_SAMPLES 0x04 /* Triple sampling mode */ 96#define CAN_CTRLMODE_3_SAMPLES 0x04 /* Triple sampling mode */
97#define CAN_CTRLMODE_ONE_SHOT 0x08 /* One-Shot mode */ 97#define CAN_CTRLMODE_ONE_SHOT 0x08 /* One-Shot mode */
98#define CAN_CTRLMODE_BERR_REPORTING 0x10 /* Bus-error reporting */ 98#define CAN_CTRLMODE_BERR_REPORTING 0x10 /* Bus-error reporting */
99#define CAN_CTRLMODE_FD 0x20 /* CAN FD mode */
99 100
100/* 101/*
101 * CAN device statistics 102 * CAN device statistics
@@ -122,6 +123,8 @@ enum {
122 IFLA_CAN_RESTART_MS, 123 IFLA_CAN_RESTART_MS,
123 IFLA_CAN_RESTART, 124 IFLA_CAN_RESTART,
124 IFLA_CAN_BERR_COUNTER, 125 IFLA_CAN_BERR_COUNTER,
126 IFLA_CAN_DATA_BITTIMING,
127 IFLA_CAN_DATA_BITTIMING_CONST,
125 __IFLA_CAN_MAX 128 __IFLA_CAN_MAX
126}; 129};
127 130
diff --git a/include/uapi/linux/ethtool.h b/include/uapi/linux/ethtool.h
index 38dbafaa5341..fd161e91b6d7 100644
--- a/include/uapi/linux/ethtool.h
+++ b/include/uapi/linux/ethtool.h
@@ -16,37 +16,97 @@
16#include <linux/types.h> 16#include <linux/types.h>
17#include <linux/if_ether.h> 17#include <linux/if_ether.h>
18 18
19/* This should work for both 32 and 64 bit userland. */ 19/* All structures exposed to userland should be defined such that they
20 * have the same layout for 32-bit and 64-bit userland.
21 */
22
23/**
24 * struct ethtool_cmd - link control and status
25 * @cmd: Command number = %ETHTOOL_GSET or %ETHTOOL_SSET
26 * @supported: Bitmask of %SUPPORTED_* flags for the link modes,
27 * physical connectors and other link features for which the
28 * interface supports autonegotiation or auto-detection.
29 * Read-only.
30 * @advertising: Bitmask of %ADVERTISED_* flags for the link modes,
31 * physical connectors and other link features that are
32 * advertised through autonegotiation or enabled for
33 * auto-detection.
34 * @speed: Low bits of the speed
35 * @duplex: Duplex mode; one of %DUPLEX_*
36 * @port: Physical connector type; one of %PORT_*
37 * @phy_address: MDIO address of PHY (transceiver); 0 or 255 if not
38 * applicable. For clause 45 PHYs this is the PRTAD.
39 * @transceiver: Historically used to distinguish different possible
40 * PHY types, but not in a consistent way. Deprecated.
41 * @autoneg: Enable/disable autonegotiation and auto-detection;
42 * either %AUTONEG_DISABLE or %AUTONEG_ENABLE
43 * @mdio_support: Bitmask of %ETH_MDIO_SUPPORTS_* flags for the MDIO
44 * protocols supported by the interface; 0 if unknown.
45 * Read-only.
46 * @maxtxpkt: Historically used to report TX IRQ coalescing; now
47 * obsoleted by &struct ethtool_coalesce. Read-only; deprecated.
48 * @maxrxpkt: Historically used to report RX IRQ coalescing; now
49 * obsoleted by &struct ethtool_coalesce. Read-only; deprecated.
50 * @speed_hi: High bits of the speed
51 * @eth_tp_mdix: Ethernet twisted-pair MDI(-X) status; one of
52 * %ETH_TP_MDI_*. If the status is unknown or not applicable, the
53 * value will be %ETH_TP_MDI_INVALID. Read-only.
54 * @eth_tp_mdix_ctrl: Ethernet twisted pair MDI(-X) control; one of
55 * %ETH_TP_MDI_*. If MDI(-X) control is not implemented, reads
56 * yield %ETH_TP_MDI_INVALID and writes may be ignored or rejected.
57 * When written successfully, the link should be renegotiated if
58 * necessary.
59 * @lp_advertising: Bitmask of %ADVERTISED_* flags for the link modes
60 * and other link features that the link partner advertised
61 * through autonegotiation; 0 if unknown or not applicable.
62 * Read-only.
63 *
64 * The link speed in Mbps is split between @speed and @speed_hi. Use
65 * the ethtool_cmd_speed() and ethtool_cmd_speed_set() functions to
66 * access it.
67 *
68 * If autonegotiation is disabled, the speed and @duplex represent the
69 * fixed link mode and are writable if the driver supports multiple
70 * link modes. If it is enabled then they are read-only; if the link
71 * is up they represent the negotiated link mode; if the link is down,
72 * the speed is 0, %SPEED_UNKNOWN or the highest enabled speed and
73 * @duplex is %DUPLEX_UNKNOWN or the best enabled duplex mode.
74 *
75 * Some hardware interfaces may have multiple PHYs and/or physical
76 * connectors fitted or do not allow the driver to detect which are
77 * fitted. For these interfaces @port and/or @phy_address may be
78 * writable, possibly dependent on @autoneg being %AUTONEG_DISABLE.
79 * Otherwise, attempts to write different values may be ignored or
80 * rejected.
81 *
82 * Users should assume that all fields not marked read-only are
83 * writable and subject to validation by the driver. They should use
84 * %ETHTOOL_GSET to get the current values before making specific
85 * changes and then applying them with %ETHTOOL_SSET.
86 *
87 * Drivers that implement set_settings() should validate all fields
88 * other than @cmd that are not described as read-only or deprecated,
89 * and must ignore all fields described as read-only.
90 *
91 * Deprecated fields should be ignored by both users and drivers.
92 */
20struct ethtool_cmd { 93struct ethtool_cmd {
21 __u32 cmd; 94 __u32 cmd;
22 __u32 supported; /* Features this interface supports */ 95 __u32 supported;
23 __u32 advertising; /* Features this interface advertises */ 96 __u32 advertising;
24 __u16 speed; /* The forced speed (lower bits) in 97 __u16 speed;
25 * Mbps. Please use 98 __u8 duplex;
26 * ethtool_cmd_speed()/_set() to 99 __u8 port;
27 * access it */ 100 __u8 phy_address;
28 __u8 duplex; /* Duplex, half or full */ 101 __u8 transceiver;
29 __u8 port; /* Which connector port */ 102 __u8 autoneg;
30 __u8 phy_address; /* MDIO PHY address (PRTAD for clause 45). 103 __u8 mdio_support;
31 * May be read-only or read-write 104 __u32 maxtxpkt;
32 * depending on the driver. 105 __u32 maxrxpkt;
33 */ 106 __u16 speed_hi;
34 __u8 transceiver; /* Which transceiver to use */ 107 __u8 eth_tp_mdix;
35 __u8 autoneg; /* Enable or disable autonegotiation */ 108 __u8 eth_tp_mdix_ctrl;
36 __u8 mdio_support; /* MDIO protocols supported. Read-only. 109 __u32 lp_advertising;
37 * Not set by all drivers.
38 */
39 __u32 maxtxpkt; /* Tx pkts before generating tx int */
40 __u32 maxrxpkt; /* Rx pkts before generating rx int */
41 __u16 speed_hi; /* The forced speed (upper
42 * bits) in Mbps. Please use
43 * ethtool_cmd_speed()/_set() to
44 * access it */
45 __u8 eth_tp_mdix; /* twisted pair MDI-X status */
46 __u8 eth_tp_mdix_ctrl; /* twisted pair MDI-X control, when set,
47 * link should be renegotiated if necessary
48 */
49 __u32 lp_advertising; /* Features the link partner advertises */
50 __u32 reserved[2]; 110 __u32 reserved[2];
51}; 111};
52 112
@@ -79,37 +139,68 @@ static inline __u32 ethtool_cmd_speed(const struct ethtool_cmd *ep)
79 139
80#define ETHTOOL_FWVERS_LEN 32 140#define ETHTOOL_FWVERS_LEN 32
81#define ETHTOOL_BUSINFO_LEN 32 141#define ETHTOOL_BUSINFO_LEN 32
82/* these strings are set to whatever the driver author decides... */ 142
143/**
144 * struct ethtool_drvinfo - general driver and device information
145 * @cmd: Command number = %ETHTOOL_GDRVINFO
146 * @driver: Driver short name. This should normally match the name
147 * in its bus driver structure (e.g. pci_driver::name). Must
148 * not be an empty string.
149 * @version: Driver version string; may be an empty string
150 * @fw_version: Firmware version string; may be an empty string
151 * @bus_info: Device bus address. This should match the dev_name()
152 * string for the underlying bus device, if there is one. May be
153 * an empty string.
154 * @n_priv_flags: Number of flags valid for %ETHTOOL_GPFLAGS and
155 * %ETHTOOL_SPFLAGS commands; also the number of strings in the
156 * %ETH_SS_PRIV_FLAGS set
157 * @n_stats: Number of u64 statistics returned by the %ETHTOOL_GSTATS
158 * command; also the number of strings in the %ETH_SS_STATS set
159 * @testinfo_len: Number of results returned by the %ETHTOOL_TEST
160 * command; also the number of strings in the %ETH_SS_TEST set
161 * @eedump_len: Size of EEPROM accessible through the %ETHTOOL_GEEPROM
162 * and %ETHTOOL_SEEPROM commands, in bytes
163 * @regdump_len: Size of register dump returned by the %ETHTOOL_GREGS
164 * command, in bytes
165 *
166 * Users can use the %ETHTOOL_GSSET_INFO command to get the number of
167 * strings in any string set (from Linux 2.6.34).
168 *
169 * Drivers should set at most @driver, @version, @fw_version and
170 * @bus_info in their get_drvinfo() implementation. The ethtool
171 * core fills in the other fields using other driver operations.
172 */
83struct ethtool_drvinfo { 173struct ethtool_drvinfo {
84 __u32 cmd; 174 __u32 cmd;
85 char driver[32]; /* driver short name, "tulip", "eepro100" */ 175 char driver[32];
86 char version[32]; /* driver version string */ 176 char version[32];
87 char fw_version[ETHTOOL_FWVERS_LEN]; /* firmware version string */ 177 char fw_version[ETHTOOL_FWVERS_LEN];
88 char bus_info[ETHTOOL_BUSINFO_LEN]; /* Bus info for this IF. */ 178 char bus_info[ETHTOOL_BUSINFO_LEN];
89 /* For PCI devices, use pci_name(pci_dev). */
90 char reserved1[32]; 179 char reserved1[32];
91 char reserved2[12]; 180 char reserved2[12];
92 /* 181 __u32 n_priv_flags;
93 * Some struct members below are filled in 182 __u32 n_stats;
94 * using ops->get_sset_count(). Obtaining
95 * this info from ethtool_drvinfo is now
96 * deprecated; Use ETHTOOL_GSSET_INFO
97 * instead.
98 */
99 __u32 n_priv_flags; /* number of flags valid in ETHTOOL_GPFLAGS */
100 __u32 n_stats; /* number of u64's from ETHTOOL_GSTATS */
101 __u32 testinfo_len; 183 __u32 testinfo_len;
102 __u32 eedump_len; /* Size of data from ETHTOOL_GEEPROM (bytes) */ 184 __u32 eedump_len;
103 __u32 regdump_len; /* Size of data from ETHTOOL_GREGS (bytes) */ 185 __u32 regdump_len;
104}; 186};
105 187
106#define SOPASS_MAX 6 188#define SOPASS_MAX 6
107/* wake-on-lan settings */ 189
190/**
191 * struct ethtool_wolinfo - Wake-On-Lan configuration
192 * @cmd: Command number = %ETHTOOL_GWOL or %ETHTOOL_SWOL
193 * @supported: Bitmask of %WAKE_* flags for supported Wake-On-Lan modes.
194 * Read-only.
195 * @wolopts: Bitmask of %WAKE_* flags for enabled Wake-On-Lan modes.
196 * @sopass: SecureOn(tm) password; meaningful only if %WAKE_MAGICSECURE
197 * is set in @wolopts.
198 */
108struct ethtool_wolinfo { 199struct ethtool_wolinfo {
109 __u32 cmd; 200 __u32 cmd;
110 __u32 supported; 201 __u32 supported;
111 __u32 wolopts; 202 __u32 wolopts;
112 __u8 sopass[SOPASS_MAX]; /* SecureOn(tm) password */ 203 __u8 sopass[SOPASS_MAX];
113}; 204};
114 205
115/* for passing single values */ 206/* for passing single values */
@@ -118,20 +209,51 @@ struct ethtool_value {
118 __u32 data; 209 __u32 data;
119}; 210};
120 211
121/* for passing big chunks of data */ 212/**
213 * struct ethtool_regs - hardware register dump
214 * @cmd: Command number = %ETHTOOL_GREGS
215 * @version: Dump format version. This is driver-specific and may
216 * distinguish different chips/revisions. Drivers must use new
217 * version numbers whenever the dump format changes in an
218 * incompatible way.
219 * @len: On entry, the real length of @data. On return, the number of
220 * bytes used.
221 * @data: Buffer for the register dump
222 *
223 * Users should use %ETHTOOL_GDRVINFO to find the maximum length of
224 * a register dump for the interface. They must allocate the buffer
225 * immediately following this structure.
226 */
122struct ethtool_regs { 227struct ethtool_regs {
123 __u32 cmd; 228 __u32 cmd;
124 __u32 version; /* driver-specific, indicates different chips/revs */ 229 __u32 version;
125 __u32 len; /* bytes */ 230 __u32 len;
126 __u8 data[0]; 231 __u8 data[0];
127}; 232};
128 233
129/* for passing EEPROM chunks */ 234/**
235 * struct ethtool_eeprom - EEPROM dump
236 * @cmd: Command number = %ETHTOOL_GEEPROM, %ETHTOOL_GMODULEEEPROM or
237 * %ETHTOOL_SEEPROM
238 * @magic: A 'magic cookie' value to guard against accidental changes.
239 * The value passed in to %ETHTOOL_SEEPROM must match the value
240 * returned by %ETHTOOL_GEEPROM for the same device. This is
241 * unused when @cmd is %ETHTOOL_GMODULEEEPROM.
242 * @offset: Offset within the EEPROM to begin reading/writing, in bytes
243 * @len: On entry, number of bytes to read/write. On successful
244 * return, number of bytes actually read/written. In case of
245 * error, this may indicate at what point the error occurred.
246 * @data: Buffer to read/write from
247 *
248 * Users may use %ETHTOOL_GDRVINFO or %ETHTOOL_GMODULEINFO to find
249 * the length of an on-board or module EEPROM, respectively. They
250 * must allocate the buffer immediately following this structure.
251 */
130struct ethtool_eeprom { 252struct ethtool_eeprom {
131 __u32 cmd; 253 __u32 cmd;
132 __u32 magic; 254 __u32 magic;
133 __u32 offset; /* in bytes */ 255 __u32 offset;
134 __u32 len; /* in bytes */ 256 __u32 len;
135 __u8 data[0]; 257 __u8 data[0];
136}; 258};
137 259
@@ -229,17 +351,18 @@ struct ethtool_modinfo {
229 * @rate_sample_interval: How often to do adaptive coalescing packet rate 351 * @rate_sample_interval: How often to do adaptive coalescing packet rate
230 * sampling, measured in seconds. Must not be zero. 352 * sampling, measured in seconds. Must not be zero.
231 * 353 *
232 * Each pair of (usecs, max_frames) fields specifies this exit 354 * Each pair of (usecs, max_frames) fields specifies that interrupts
233 * condition for interrupt coalescing: 355 * should be coalesced until
234 * (usecs > 0 && time_since_first_completion >= usecs) || 356 * (usecs > 0 && time_since_first_completion >= usecs) ||
235 * (max_frames > 0 && completed_frames >= max_frames) 357 * (max_frames > 0 && completed_frames >= max_frames)
358 *
236 * It is illegal to set both usecs and max_frames to zero as this 359 * It is illegal to set both usecs and max_frames to zero as this
237 * would cause interrupts to never be generated. To disable 360 * would cause interrupts to never be generated. To disable
238 * coalescing, set usecs = 0 and max_frames = 1. 361 * coalescing, set usecs = 0 and max_frames = 1.
239 * 362 *
240 * Some implementations ignore the value of max_frames and use the 363 * Some implementations ignore the value of max_frames and use the
241 * condition: 364 * condition time_since_first_completion >= usecs
242 * time_since_first_completion >= usecs 365 *
243 * This is deprecated. Drivers for hardware that does not support 366 * This is deprecated. Drivers for hardware that does not support
244 * counting completions should validate that max_frames == !rx_usecs. 367 * counting completions should validate that max_frames == !rx_usecs.
245 * 368 *
@@ -279,22 +402,37 @@ struct ethtool_coalesce {
279 __u32 rate_sample_interval; 402 __u32 rate_sample_interval;
280}; 403};
281 404
282/* for configuring RX/TX ring parameters */ 405/**
406 * struct ethtool_ringparam - RX/TX ring parameters
407 * @cmd: Command number = %ETHTOOL_GRINGPARAM or %ETHTOOL_SRINGPARAM
408 * @rx_max_pending: Maximum supported number of pending entries per
409 * RX ring. Read-only.
410 * @rx_mini_max_pending: Maximum supported number of pending entries
411 * per RX mini ring. Read-only.
412 * @rx_jumbo_max_pending: Maximum supported number of pending entries
413 * per RX jumbo ring. Read-only.
414 * @tx_max_pending: Maximum supported number of pending entries per
415 * TX ring. Read-only.
416 * @rx_pending: Current maximum number of pending entries per RX ring
417 * @rx_mini_pending: Current maximum number of pending entries per RX
418 * mini ring
419 * @rx_jumbo_pending: Current maximum number of pending entries per RX
420 * jumbo ring
421 * @tx_pending: Current maximum supported number of pending entries
422 * per TX ring
423 *
424 * If the interface does not have separate RX mini and/or jumbo rings,
425 * @rx_mini_max_pending and/or @rx_jumbo_max_pending will be 0.
426 *
427 * There may also be driver-dependent minimum values for the number
428 * of entries per ring.
429 */
283struct ethtool_ringparam { 430struct ethtool_ringparam {
284 __u32 cmd; /* ETHTOOL_{G,S}RINGPARAM */ 431 __u32 cmd;
285
286 /* Read only attributes. These indicate the maximum number
287 * of pending RX/TX ring entries the driver will allow the
288 * user to set.
289 */
290 __u32 rx_max_pending; 432 __u32 rx_max_pending;
291 __u32 rx_mini_max_pending; 433 __u32 rx_mini_max_pending;
292 __u32 rx_jumbo_max_pending; 434 __u32 rx_jumbo_max_pending;
293 __u32 tx_max_pending; 435 __u32 tx_max_pending;
294
295 /* Values changeable by the user. The valid values are
296 * in the range 1 to the "*_max_pending" counterpart above.
297 */
298 __u32 rx_pending; 436 __u32 rx_pending;
299 __u32 rx_mini_pending; 437 __u32 rx_mini_pending;
300 __u32 rx_jumbo_pending; 438 __u32 rx_jumbo_pending;
@@ -329,51 +467,96 @@ struct ethtool_channels {
329 __u32 combined_count; 467 __u32 combined_count;
330}; 468};
331 469
332/* for configuring link flow control parameters */ 470/**
471 * struct ethtool_pauseparam - Ethernet pause (flow control) parameters
472 * @cmd: Command number = %ETHTOOL_GPAUSEPARAM or %ETHTOOL_SPAUSEPARAM
473 * @autoneg: Flag to enable autonegotiation of pause frame use
474 * @rx_pause: Flag to enable reception of pause frames
475 * @tx_pause: Flag to enable transmission of pause frames
476 *
477 * Drivers should reject a non-zero setting of @autoneg when
478 * autoneogotiation is disabled (or not supported) for the link.
479 *
480 * If the link is autonegotiated, drivers should use
481 * mii_advertise_flowctrl() or similar code to set the advertised
482 * pause frame capabilities based on the @rx_pause and @tx_pause flags,
483 * even if @autoneg is zero. They should also allow the advertised
484 * pause frame capabilities to be controlled directly through the
485 * advertising field of &struct ethtool_cmd.
486 *
487 * If @autoneg is non-zero, the MAC is configured to send and/or
488 * receive pause frames according to the result of autonegotiation.
489 * Otherwise, it is configured directly based on the @rx_pause and
490 * @tx_pause flags.
491 */
333struct ethtool_pauseparam { 492struct ethtool_pauseparam {
334 __u32 cmd; /* ETHTOOL_{G,S}PAUSEPARAM */ 493 __u32 cmd;
335
336 /* If the link is being auto-negotiated (via ethtool_cmd.autoneg
337 * being true) the user may set 'autoneg' here non-zero to have the
338 * pause parameters be auto-negotiated too. In such a case, the
339 * {rx,tx}_pause values below determine what capabilities are
340 * advertised.
341 *
342 * If 'autoneg' is zero or the link is not being auto-negotiated,
343 * then {rx,tx}_pause force the driver to use/not-use pause
344 * flow control.
345 */
346 __u32 autoneg; 494 __u32 autoneg;
347 __u32 rx_pause; 495 __u32 rx_pause;
348 __u32 tx_pause; 496 __u32 tx_pause;
349}; 497};
350 498
351#define ETH_GSTRING_LEN 32 499#define ETH_GSTRING_LEN 32
500
501/**
502 * enum ethtool_stringset - string set ID
503 * @ETH_SS_TEST: Self-test result names, for use with %ETHTOOL_TEST
504 * @ETH_SS_STATS: Statistic names, for use with %ETHTOOL_GSTATS
505 * @ETH_SS_PRIV_FLAGS: Driver private flag names, for use with
506 * %ETHTOOL_GPFLAGS and %ETHTOOL_SPFLAGS
507 * @ETH_SS_NTUPLE_FILTERS: Previously used with %ETHTOOL_GRXNTUPLE;
508 * now deprecated
509 * @ETH_SS_FEATURES: Device feature names
510 */
352enum ethtool_stringset { 511enum ethtool_stringset {
353 ETH_SS_TEST = 0, 512 ETH_SS_TEST = 0,
354 ETH_SS_STATS, 513 ETH_SS_STATS,
355 ETH_SS_PRIV_FLAGS, 514 ETH_SS_PRIV_FLAGS,
356 ETH_SS_NTUPLE_FILTERS, /* Do not use, GRXNTUPLE is now deprecated */ 515 ETH_SS_NTUPLE_FILTERS,
357 ETH_SS_FEATURES, 516 ETH_SS_FEATURES,
358}; 517};
359 518
360/* for passing string sets for data tagging */ 519/**
520 * struct ethtool_gstrings - string set for data tagging
521 * @cmd: Command number = %ETHTOOL_GSTRINGS
522 * @string_set: String set ID; one of &enum ethtool_stringset
523 * @len: On return, the number of strings in the string set
524 * @data: Buffer for strings. Each string is null-padded to a size of
525 * %ETH_GSTRING_LEN.
526 *
527 * Users must use %ETHTOOL_GSSET_INFO to find the number of strings in
528 * the string set. They must allocate a buffer of the appropriate
529 * size immediately following this structure.
530 */
361struct ethtool_gstrings { 531struct ethtool_gstrings {
362 __u32 cmd; /* ETHTOOL_GSTRINGS */ 532 __u32 cmd;
363 __u32 string_set; /* string set id e.c. ETH_SS_TEST, etc*/ 533 __u32 string_set;
364 __u32 len; /* number of strings in the string set */ 534 __u32 len;
365 __u8 data[0]; 535 __u8 data[0];
366}; 536};
367 537
538/**
539 * struct ethtool_sset_info - string set information
540 * @cmd: Command number = %ETHTOOL_GSSET_INFO
541 * @sset_mask: On entry, a bitmask of string sets to query, with bits
542 * numbered according to &enum ethtool_stringset. On return, a
543 * bitmask of those string sets queried that are supported.
544 * @data: Buffer for string set sizes. On return, this contains the
545 * size of each string set that was queried and supported, in
546 * order of ID.
547 *
548 * Example: The user passes in @sset_mask = 0x7 (sets 0, 1, 2) and on
549 * return @sset_mask == 0x6 (sets 1, 2). Then @data[0] contains the
550 * size of set 1 and @data[1] contains the size of set 2.
551 *
552 * Users must allocate a buffer of the appropriate size (4 * number of
553 * sets queried) immediately following this structure.
554 */
368struct ethtool_sset_info { 555struct ethtool_sset_info {
369 __u32 cmd; /* ETHTOOL_GSSET_INFO */ 556 __u32 cmd;
370 __u32 reserved; 557 __u32 reserved;
371 __u64 sset_mask; /* input: each bit selects an sset to query */ 558 __u64 sset_mask;
372 /* output: each bit a returned sset */ 559 __u32 data[0];
373 __u32 data[0]; /* ETH_SS_xxx count, in order, based on bits
374 in sset_mask. One bit implies one
375 __u32, two bits implies two
376 __u32's, etc. */
377}; 560};
378 561
379/** 562/**
@@ -393,24 +576,58 @@ enum ethtool_test_flags {
393 ETH_TEST_FL_EXTERNAL_LB_DONE = (1 << 3), 576 ETH_TEST_FL_EXTERNAL_LB_DONE = (1 << 3),
394}; 577};
395 578
396/* for requesting NIC test and getting results*/ 579/**
580 * struct ethtool_test - device self-test invocation
581 * @cmd: Command number = %ETHTOOL_TEST
582 * @flags: A bitmask of flags from &enum ethtool_test_flags. Some
583 * flags may be set by the user on entry; others may be set by
584 * the driver on return.
585 * @len: On return, the number of test results
586 * @data: Array of test results
587 *
588 * Users must use %ETHTOOL_GSSET_INFO or %ETHTOOL_GDRVINFO to find the
589 * number of test results that will be returned. They must allocate a
590 * buffer of the appropriate size (8 * number of results) immediately
591 * following this structure.
592 */
397struct ethtool_test { 593struct ethtool_test {
398 __u32 cmd; /* ETHTOOL_TEST */ 594 __u32 cmd;
399 __u32 flags; /* ETH_TEST_FL_xxx */ 595 __u32 flags;
400 __u32 reserved; 596 __u32 reserved;
401 __u32 len; /* result length, in number of u64 elements */ 597 __u32 len;
402 __u64 data[0]; 598 __u64 data[0];
403}; 599};
404 600
405/* for dumping NIC-specific statistics */ 601/**
602 * struct ethtool_stats - device-specific statistics
603 * @cmd: Command number = %ETHTOOL_GSTATS
604 * @n_stats: On return, the number of statistics
605 * @data: Array of statistics
606 *
607 * Users must use %ETHTOOL_GSSET_INFO or %ETHTOOL_GDRVINFO to find the
608 * number of statistics that will be returned. They must allocate a
609 * buffer of the appropriate size (8 * number of statistics)
610 * immediately following this structure.
611 */
406struct ethtool_stats { 612struct ethtool_stats {
407 __u32 cmd; /* ETHTOOL_GSTATS */ 613 __u32 cmd;
408 __u32 n_stats; /* number of u64's being returned */ 614 __u32 n_stats;
409 __u64 data[0]; 615 __u64 data[0];
410}; 616};
411 617
618/**
619 * struct ethtool_perm_addr - permanent hardware address
620 * @cmd: Command number = %ETHTOOL_GPERMADDR
621 * @size: On entry, the size of the buffer. On return, the size of the
622 * address. The command fails if the buffer is too small.
623 * @data: Buffer for the address
624 *
625 * Users must allocate the buffer immediately following this structure.
626 * A buffer size of %MAX_ADDR_LEN should be sufficient for any address
627 * type.
628 */
412struct ethtool_perm_addr { 629struct ethtool_perm_addr {
413 __u32 cmd; /* ETHTOOL_GPERMADDR */ 630 __u32 cmd;
414 __u32 size; 631 __u32 size;
415 __u8 data[0]; 632 __u8 data[0];
416}; 633};
@@ -593,7 +810,7 @@ struct ethtool_rx_flow_spec {
593 * %ETHTOOL_SRXCLSRLINS may add the rule at any suitable unused 810 * %ETHTOOL_SRXCLSRLINS may add the rule at any suitable unused
594 * location, and may remove a rule at a later location (lower 811 * location, and may remove a rule at a later location (lower
595 * priority) that matches exactly the same set of flows. The special 812 * priority) that matches exactly the same set of flows. The special
596 * values are: %RX_CLS_LOC_ANY, selecting any location; 813 * values are %RX_CLS_LOC_ANY, selecting any location;
597 * %RX_CLS_LOC_FIRST, selecting the first suitable location (maximum 814 * %RX_CLS_LOC_FIRST, selecting the first suitable location (maximum
598 * priority); and %RX_CLS_LOC_LAST, selecting the last suitable 815 * priority); and %RX_CLS_LOC_LAST, selecting the last suitable
599 * location (minimum priority). Additional special values may be 816 * location (minimum priority). Additional special values may be
@@ -704,9 +921,6 @@ struct ethtool_flash {
704 * for %ETHTOOL_GET_DUMP_FLAG command 921 * for %ETHTOOL_GET_DUMP_FLAG command
705 * @data: data collected for get dump data operation 922 * @data: data collected for get dump data operation
706 */ 923 */
707
708#define ETH_FW_DUMP_DISABLE 0
709
710struct ethtool_dump { 924struct ethtool_dump {
711 __u32 cmd; 925 __u32 cmd;
712 __u32 version; 926 __u32 version;
@@ -715,6 +929,8 @@ struct ethtool_dump {
715 __u8 data[0]; 929 __u8 data[0];
716}; 930};
717 931
932#define ETH_FW_DUMP_DISABLE 0
933
718/* for returning and changing feature sets */ 934/* for returning and changing feature sets */
719 935
720/** 936/**
@@ -734,8 +950,9 @@ struct ethtool_get_features_block {
734/** 950/**
735 * struct ethtool_gfeatures - command to get state of device's features 951 * struct ethtool_gfeatures - command to get state of device's features
736 * @cmd: command number = %ETHTOOL_GFEATURES 952 * @cmd: command number = %ETHTOOL_GFEATURES
737 * @size: in: number of elements in the features[] array; 953 * @size: On entry, the number of elements in the features[] array;
738 * out: number of elements in features[] needed to hold all features 954 * on return, the number of elements in features[] needed to hold
955 * all features
739 * @features: state of features 956 * @features: state of features
740 */ 957 */
741struct ethtool_gfeatures { 958struct ethtool_gfeatures {
@@ -905,7 +1122,6 @@ enum ethtool_sfeatures_retval_bits {
905#define SPARC_ETH_GSET ETHTOOL_GSET 1122#define SPARC_ETH_GSET ETHTOOL_GSET
906#define SPARC_ETH_SSET ETHTOOL_SSET 1123#define SPARC_ETH_SSET ETHTOOL_SSET
907 1124
908/* Indicates what features are supported by the interface. */
909#define SUPPORTED_10baseT_Half (1 << 0) 1125#define SUPPORTED_10baseT_Half (1 << 0)
910#define SUPPORTED_10baseT_Full (1 << 1) 1126#define SUPPORTED_10baseT_Full (1 << 1)
911#define SUPPORTED_100baseT_Half (1 << 2) 1127#define SUPPORTED_100baseT_Half (1 << 2)
@@ -934,7 +1150,6 @@ enum ethtool_sfeatures_retval_bits {
934#define SUPPORTED_40000baseSR4_Full (1 << 25) 1150#define SUPPORTED_40000baseSR4_Full (1 << 25)
935#define SUPPORTED_40000baseLR4_Full (1 << 26) 1151#define SUPPORTED_40000baseLR4_Full (1 << 26)
936 1152
937/* Indicates what features are advertised by the interface. */
938#define ADVERTISED_10baseT_Half (1 << 0) 1153#define ADVERTISED_10baseT_Half (1 << 0)
939#define ADVERTISED_10baseT_Full (1 << 1) 1154#define ADVERTISED_10baseT_Full (1 << 1)
940#define ADVERTISED_100baseT_Half (1 << 2) 1155#define ADVERTISED_100baseT_Half (1 << 2)
@@ -999,9 +1214,7 @@ enum ethtool_sfeatures_retval_bits {
999#define XCVR_DUMMY2 0x03 1214#define XCVR_DUMMY2 0x03
1000#define XCVR_DUMMY3 0x04 1215#define XCVR_DUMMY3 0x04
1001 1216
1002/* Enable or disable autonegotiation. If this is set to enable, 1217/* Enable or disable autonegotiation. */
1003 * the forced link modes above are completely ignored.
1004 */
1005#define AUTONEG_DISABLE 0x00 1218#define AUTONEG_DISABLE 0x00
1006#define AUTONEG_ENABLE 0x01 1219#define AUTONEG_ENABLE 0x01
1007 1220
diff --git a/include/uapi/linux/if.h b/include/uapi/linux/if.h
index d758163b0e43..9cf2394f0bcf 100644
--- a/include/uapi/linux/if.h
+++ b/include/uapi/linux/if.h
@@ -27,65 +27,91 @@
27#define IFALIASZ 256 27#define IFALIASZ 256
28#include <linux/hdlc/ioctl.h> 28#include <linux/hdlc/ioctl.h>
29 29
30/* Standard interface flags (netdevice->flags). */ 30/**
31#define IFF_UP 0x1 /* interface is up */ 31 * enum net_device_flags - &struct net_device flags
32#define IFF_BROADCAST 0x2 /* broadcast address valid */ 32 *
33#define IFF_DEBUG 0x4 /* turn on debugging */ 33 * These are the &struct net_device flags, they can be set by drivers, the
34#define IFF_LOOPBACK 0x8 /* is a loopback net */ 34 * kernel and some can be triggered by userspace. Userspace can query and
35#define IFF_POINTOPOINT 0x10 /* interface is has p-p link */ 35 * set these flags using userspace utilities but there is also a sysfs
36#define IFF_NOTRAILERS 0x20 /* avoid use of trailers */ 36 * entry available for all dev flags which can be queried and set. These flags
37#define IFF_RUNNING 0x40 /* interface RFC2863 OPER_UP */ 37 * are shared for all types of net_devices. The sysfs entries are available
38#define IFF_NOARP 0x80 /* no ARP protocol */ 38 * via /sys/class/net/<dev>/flags. Flags which can be toggled through sysfs
39#define IFF_PROMISC 0x100 /* receive all packets */ 39 * are annotated below, note that only a few flags can be toggled and some
40#define IFF_ALLMULTI 0x200 /* receive all multicast packets*/ 40 * other flags are always always preserved from the original net_device flags
41 41 * even if you try to set them via sysfs. Flags which are always preserved
42#define IFF_MASTER 0x400 /* master of a load balancer */ 42 * are kept under the flag grouping @IFF_VOLATILE. Flags which are volatile
43#define IFF_SLAVE 0x800 /* slave of a load balancer */ 43 * are annotated below as such.
44 44 *
45#define IFF_MULTICAST 0x1000 /* Supports multicast */ 45 * You should have a pretty good reason to be extending these flags.
46 46 *
47#define IFF_PORTSEL 0x2000 /* can set media type */ 47 * @IFF_UP: interface is up. Can be toggled through sysfs.
48#define IFF_AUTOMEDIA 0x4000 /* auto media select active */ 48 * @IFF_BROADCAST: broadcast address valid. Volatile.
49#define IFF_DYNAMIC 0x8000 /* dialup device with changing addresses*/ 49 * @IFF_DEBUG: turn on debugging. Can be toggled through sysfs.
50 50 * @IFF_LOOPBACK: is a loopback net. Volatile.
51#define IFF_LOWER_UP 0x10000 /* driver signals L1 up */ 51 * @IFF_POINTOPOINT: interface is has p-p link. Volatile.
52#define IFF_DORMANT 0x20000 /* driver signals dormant */ 52 * @IFF_NOTRAILERS: avoid use of trailers. Can be toggled through sysfs.
53 * Volatile.
54 * @IFF_RUNNING: interface RFC2863 OPER_UP. Volatile.
55 * @IFF_NOARP: no ARP protocol. Can be toggled through sysfs. Volatile.
56 * @IFF_PROMISC: receive all packets. Can be toggled through sysfs.
57 * @IFF_ALLMULTI: receive all multicast packets. Can be toggled through
58 * sysfs.
59 * @IFF_MASTER: master of a load balancer. Volatile.
60 * @IFF_SLAVE: slave of a load balancer. Volatile.
61 * @IFF_MULTICAST: Supports multicast. Can be toggled through sysfs.
62 * @IFF_PORTSEL: can set media type. Can be toggled through sysfs.
63 * @IFF_AUTOMEDIA: auto media select active. Can be toggled through sysfs.
64 * @IFF_DYNAMIC: dialup device with changing addresses. Can be toggled
65 * through sysfs.
66 * @IFF_LOWER_UP: driver signals L1 up. Volatile.
67 * @IFF_DORMANT: driver signals dormant. Volatile.
68 * @IFF_ECHO: echo sent packets. Volatile.
69 */
70enum net_device_flags {
71 IFF_UP = 1<<0, /* sysfs */
72 IFF_BROADCAST = 1<<1, /* volatile */
73 IFF_DEBUG = 1<<2, /* sysfs */
74 IFF_LOOPBACK = 1<<3, /* volatile */
75 IFF_POINTOPOINT = 1<<4, /* volatile */
76 IFF_NOTRAILERS = 1<<5, /* sysfs */
77 IFF_RUNNING = 1<<6, /* volatile */
78 IFF_NOARP = 1<<7, /* sysfs */
79 IFF_PROMISC = 1<<8, /* sysfs */
80 IFF_ALLMULTI = 1<<9, /* sysfs */
81 IFF_MASTER = 1<<10, /* volatile */
82 IFF_SLAVE = 1<<11, /* volatile */
83 IFF_MULTICAST = 1<<12, /* sysfs */
84 IFF_PORTSEL = 1<<13, /* sysfs */
85 IFF_AUTOMEDIA = 1<<14, /* sysfs */
86 IFF_DYNAMIC = 1<<15, /* sysfs */
87 IFF_LOWER_UP = 1<<16, /* volatile */
88 IFF_DORMANT = 1<<17, /* volatile */
89 IFF_ECHO = 1<<18, /* volatile */
90};
53 91
54#define IFF_ECHO 0x40000 /* echo sent packets */ 92#define IFF_UP IFF_UP
93#define IFF_BROADCAST IFF_BROADCAST
94#define IFF_DEBUG IFF_DEBUG
95#define IFF_LOOPBACK IFF_LOOPBACK
96#define IFF_POINTOPOINT IFF_POINTOPOINT
97#define IFF_NOTRAILERS IFF_NOTRAILERS
98#define IFF_RUNNING IFF_RUNNING
99#define IFF_NOARP IFF_NOARP
100#define IFF_PROMISC IFF_PROMISC
101#define IFF_ALLMULTI IFF_ALLMULTI
102#define IFF_MASTER IFF_MASTER
103#define IFF_SLAVE IFF_SLAVE
104#define IFF_MULTICAST IFF_MULTICAST
105#define IFF_PORTSEL IFF_PORTSEL
106#define IFF_AUTOMEDIA IFF_AUTOMEDIA
107#define IFF_DYNAMIC IFF_DYNAMIC
108#define IFF_LOWER_UP IFF_LOWER_UP
109#define IFF_DORMANT IFF_DORMANT
110#define IFF_ECHO IFF_ECHO
55 111
56#define IFF_VOLATILE (IFF_LOOPBACK|IFF_POINTOPOINT|IFF_BROADCAST|IFF_ECHO|\ 112#define IFF_VOLATILE (IFF_LOOPBACK|IFF_POINTOPOINT|IFF_BROADCAST|IFF_ECHO|\
57 IFF_MASTER|IFF_SLAVE|IFF_RUNNING|IFF_LOWER_UP|IFF_DORMANT) 113 IFF_MASTER|IFF_SLAVE|IFF_RUNNING|IFF_LOWER_UP|IFF_DORMANT)
58 114
59/* Private (from user) interface flags (netdevice->priv_flags). */
60#define IFF_802_1Q_VLAN 0x1 /* 802.1Q VLAN device. */
61#define IFF_EBRIDGE 0x2 /* Ethernet bridging device. */
62#define IFF_SLAVE_INACTIVE 0x4 /* bonding slave not the curr. active */
63#define IFF_MASTER_8023AD 0x8 /* bonding master, 802.3ad. */
64#define IFF_MASTER_ALB 0x10 /* bonding master, balance-alb. */
65#define IFF_BONDING 0x20 /* bonding master or slave */
66#define IFF_SLAVE_NEEDARP 0x40 /* need ARPs for validation */
67#define IFF_ISATAP 0x80 /* ISATAP interface (RFC4214) */
68#define IFF_MASTER_ARPMON 0x100 /* bonding master, ARP mon in use */
69#define IFF_WAN_HDLC 0x200 /* WAN HDLC device */
70#define IFF_XMIT_DST_RELEASE 0x400 /* dev_hard_start_xmit() is allowed to
71 * release skb->dst
72 */
73#define IFF_DONT_BRIDGE 0x800 /* disallow bridging this ether dev */
74#define IFF_DISABLE_NETPOLL 0x1000 /* disable netpoll at run-time */
75#define IFF_MACVLAN_PORT 0x2000 /* device used as macvlan port */
76#define IFF_BRIDGE_PORT 0x4000 /* device used as bridge port */
77#define IFF_OVS_DATAPATH 0x8000 /* device used as Open vSwitch
78 * datapath port */
79#define IFF_TX_SKB_SHARING 0x10000 /* The interface supports sharing
80 * skbs on transmit */
81#define IFF_UNICAST_FLT 0x20000 /* Supports unicast filtering */
82#define IFF_TEAM_PORT 0x40000 /* device used as team port */
83#define IFF_SUPP_NOFCS 0x80000 /* device supports sending custom FCS */
84#define IFF_LIVE_ADDR_CHANGE 0x100000 /* device supports hardware address
85 * change when it's running */
86#define IFF_MACVLAN 0x200000 /* Macvlan device */
87
88
89#define IF_GET_IFACE 0x0001 /* for querying only */ 115#define IF_GET_IFACE 0x0001 /* for querying only */
90#define IF_GET_PROTO 0x0002 116#define IF_GET_PROTO 0x0002
91 117
diff --git a/include/uapi/linux/if_ether.h b/include/uapi/linux/if_ether.h
index 2ce0f6a78fa5..0f8210b8e0bc 100644
--- a/include/uapi/linux/if_ether.h
+++ b/include/uapi/linux/if_ether.h
@@ -68,11 +68,11 @@
68#define ETH_P_SLOW 0x8809 /* Slow Protocol. See 802.3ad 43B */ 68#define ETH_P_SLOW 0x8809 /* Slow Protocol. See 802.3ad 43B */
69#define ETH_P_WCCP 0x883E /* Web-cache coordination protocol 69#define ETH_P_WCCP 0x883E /* Web-cache coordination protocol
70 * defined in draft-wilson-wrec-wccp-v2-00.txt */ 70 * defined in draft-wilson-wrec-wccp-v2-00.txt */
71#define ETH_P_PPP_DISC 0x8863 /* PPPoE discovery messages */
72#define ETH_P_PPP_SES 0x8864 /* PPPoE session messages */
73#define ETH_P_MPLS_UC 0x8847 /* MPLS Unicast traffic */ 71#define ETH_P_MPLS_UC 0x8847 /* MPLS Unicast traffic */
74#define ETH_P_MPLS_MC 0x8848 /* MPLS Multicast traffic */ 72#define ETH_P_MPLS_MC 0x8848 /* MPLS Multicast traffic */
75#define ETH_P_ATMMPOA 0x884c /* MultiProtocol Over ATM */ 73#define ETH_P_ATMMPOA 0x884c /* MultiProtocol Over ATM */
74#define ETH_P_PPP_DISC 0x8863 /* PPPoE discovery messages */
75#define ETH_P_PPP_SES 0x8864 /* PPPoE session messages */
76#define ETH_P_LINK_CTL 0x886c /* HPNA, wlan link local tunnel */ 76#define ETH_P_LINK_CTL 0x886c /* HPNA, wlan link local tunnel */
77#define ETH_P_ATMFATE 0x8884 /* Frame-based ATM Transport 77#define ETH_P_ATMFATE 0x8884 /* Frame-based ATM Transport
78 * over Ethernet 78 * over Ethernet
@@ -89,6 +89,8 @@
89#define ETH_P_FCOE 0x8906 /* Fibre Channel over Ethernet */ 89#define ETH_P_FCOE 0x8906 /* Fibre Channel over Ethernet */
90#define ETH_P_TDLS 0x890D /* TDLS */ 90#define ETH_P_TDLS 0x890D /* TDLS */
91#define ETH_P_FIP 0x8914 /* FCoE Initialization Protocol */ 91#define ETH_P_FIP 0x8914 /* FCoE Initialization Protocol */
92#define ETH_P_80221 0x8917 /* IEEE 802.21 Media Independent Handover Protocol */
93#define ETH_P_LOOPBACK 0x9000 /* Ethernet loopback packet, per IEEE 802.3 */
92#define ETH_P_QINQ1 0x9100 /* deprecated QinQ VLAN [ NOT AN OFFICIALLY REGISTERED ID ] */ 94#define ETH_P_QINQ1 0x9100 /* deprecated QinQ VLAN [ NOT AN OFFICIALLY REGISTERED ID ] */
93#define ETH_P_QINQ2 0x9200 /* deprecated QinQ VLAN [ NOT AN OFFICIALLY REGISTERED ID ] */ 95#define ETH_P_QINQ2 0x9200 /* deprecated QinQ VLAN [ NOT AN OFFICIALLY REGISTERED ID ] */
94#define ETH_P_QINQ3 0x9300 /* deprecated QinQ VLAN [ NOT AN OFFICIALLY REGISTERED ID ] */ 96#define ETH_P_QINQ3 0x9300 /* deprecated QinQ VLAN [ NOT AN OFFICIALLY REGISTERED ID ] */
diff --git a/include/uapi/linux/if_link.h b/include/uapi/linux/if_link.h
index 16410b6e7819..9a7f7ace6649 100644
--- a/include/uapi/linux/if_link.h
+++ b/include/uapi/linux/if_link.h
@@ -144,6 +144,7 @@ enum {
144 IFLA_NUM_RX_QUEUES, 144 IFLA_NUM_RX_QUEUES,
145 IFLA_CARRIER, 145 IFLA_CARRIER,
146 IFLA_PHYS_PORT_ID, 146 IFLA_PHYS_PORT_ID,
147 IFLA_CARRIER_CHANGES,
147 __IFLA_MAX 148 __IFLA_MAX
148}; 149};
149 150
diff --git a/include/uapi/linux/in.h b/include/uapi/linux/in.h
index 393c5de09d42..c33a65e3d62c 100644
--- a/include/uapi/linux/in.h
+++ b/include/uapi/linux/in.h
@@ -120,6 +120,10 @@ struct in_addr {
120 * this socket to prevent accepting spoofed ones. 120 * this socket to prevent accepting spoofed ones.
121 */ 121 */
122#define IP_PMTUDISC_INTERFACE 4 122#define IP_PMTUDISC_INTERFACE 4
123/* weaker version of IP_PMTUDISC_INTERFACE, which allos packets to get
124 * fragmented if they exeed the interface mtu
125 */
126#define IP_PMTUDISC_OMIT 5
123 127
124#define IP_MULTICAST_IF 32 128#define IP_MULTICAST_IF 32
125#define IP_MULTICAST_TTL 33 129#define IP_MULTICAST_TTL 33
diff --git a/include/uapi/linux/in6.h b/include/uapi/linux/in6.h
index e9a1d2d973b6..0d8e0f0342dc 100644
--- a/include/uapi/linux/in6.h
+++ b/include/uapi/linux/in6.h
@@ -185,6 +185,10 @@ struct in6_flowlabel_req {
185 * also see comments on IP_PMTUDISC_INTERFACE 185 * also see comments on IP_PMTUDISC_INTERFACE
186 */ 186 */
187#define IPV6_PMTUDISC_INTERFACE 4 187#define IPV6_PMTUDISC_INTERFACE 4
188/* weaker version of IPV6_PMTUDISC_INTERFACE, which allows packets to
189 * get fragmented if they exceed the interface mtu
190 */
191#define IPV6_PMTUDISC_OMIT 5
188 192
189/* Flowlabel */ 193/* Flowlabel */
190#define IPV6_FLOWLABEL_MGR 32 194#define IPV6_FLOWLABEL_MGR 32
diff --git a/include/uapi/linux/mpls.h b/include/uapi/linux/mpls.h
new file mode 100644
index 000000000000..bc9abfe88c9a
--- /dev/null
+++ b/include/uapi/linux/mpls.h
@@ -0,0 +1,34 @@
1#ifndef _UAPI_MPLS_H
2#define _UAPI_MPLS_H
3
4#include <linux/types.h>
5#include <asm/byteorder.h>
6
7/* Reference: RFC 5462, RFC 3032
8 *
9 * 0 1 2 3
10 * 0 1 2 3 4 5 6 7 8 9 0 1 2 3 4 5 6 7 8 9 0 1 2 3 4 5 6 7 8 9 0 1
11 * +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+
12 * | Label | TC |S| TTL |
13 * +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+
14 *
15 * Label: Label Value, 20 bits
16 * TC: Traffic Class field, 3 bits
17 * S: Bottom of Stack, 1 bit
18 * TTL: Time to Live, 8 bits
19 */
20
21struct mpls_label {
22 __be32 entry;
23};
24
25#define MPLS_LS_LABEL_MASK 0xFFFFF000
26#define MPLS_LS_LABEL_SHIFT 12
27#define MPLS_LS_TC_MASK 0x00000E00
28#define MPLS_LS_TC_SHIFT 9
29#define MPLS_LS_S_MASK 0x00000100
30#define MPLS_LS_S_SHIFT 8
31#define MPLS_LS_TTL_MASK 0x000000FF
32#define MPLS_LS_TTL_SHIFT 0
33
34#endif /* _UAPI_MPLS_H */
diff --git a/include/uapi/linux/netdevice.h b/include/uapi/linux/netdevice.h
index 6b9500bc2d56..fdfbd1c17065 100644
--- a/include/uapi/linux/netdevice.h
+++ b/include/uapi/linux/netdevice.h
@@ -49,5 +49,11 @@ enum {
49 IF_PORT_100BASEFX 49 IF_PORT_100BASEFX
50}; 50};
51 51
52/* hardware address assignment types */
53#define NET_ADDR_PERM 0 /* address is permanent (default) */
54#define NET_ADDR_RANDOM 1 /* address is generated randomly */
55#define NET_ADDR_STOLEN 2 /* address is stolen from other device */
56#define NET_ADDR_SET 3 /* address is set using
57 * dev_set_mac_address() */
52 58
53#endif /* _UAPI_LINUX_NETDEVICE_H */ 59#endif /* _UAPI_LINUX_NETDEVICE_H */
diff --git a/include/uapi/linux/netfilter/ipset/ip_set.h b/include/uapi/linux/netfilter/ipset/ip_set.h
index 25d3b2f79c02..78c2f2e79920 100644
--- a/include/uapi/linux/netfilter/ipset/ip_set.h
+++ b/include/uapi/linux/netfilter/ipset/ip_set.h
@@ -82,6 +82,8 @@ enum {
82 IPSET_ATTR_PROTO, /* 7 */ 82 IPSET_ATTR_PROTO, /* 7 */
83 IPSET_ATTR_CADT_FLAGS, /* 8 */ 83 IPSET_ATTR_CADT_FLAGS, /* 8 */
84 IPSET_ATTR_CADT_LINENO = IPSET_ATTR_LINENO, /* 9 */ 84 IPSET_ATTR_CADT_LINENO = IPSET_ATTR_LINENO, /* 9 */
85 IPSET_ATTR_MARK, /* 10 */
86 IPSET_ATTR_MARKMASK, /* 11 */
85 /* Reserve empty slots */ 87 /* Reserve empty slots */
86 IPSET_ATTR_CADT_MAX = 16, 88 IPSET_ATTR_CADT_MAX = 16,
87 /* Create-only specific attributes */ 89 /* Create-only specific attributes */
@@ -144,6 +146,7 @@ enum ipset_errno {
144 IPSET_ERR_IPADDR_IPV6, 146 IPSET_ERR_IPADDR_IPV6,
145 IPSET_ERR_COUNTER, 147 IPSET_ERR_COUNTER,
146 IPSET_ERR_COMMENT, 148 IPSET_ERR_COMMENT,
149 IPSET_ERR_INVALID_MARKMASK,
147 150
148 /* Type specific error codes */ 151 /* Type specific error codes */
149 IPSET_ERR_TYPE_SPECIFIC = 4352, 152 IPSET_ERR_TYPE_SPECIFIC = 4352,
@@ -182,9 +185,18 @@ enum ipset_cadt_flags {
182 IPSET_FLAG_WITH_COUNTERS = (1 << IPSET_FLAG_BIT_WITH_COUNTERS), 185 IPSET_FLAG_WITH_COUNTERS = (1 << IPSET_FLAG_BIT_WITH_COUNTERS),
183 IPSET_FLAG_BIT_WITH_COMMENT = 4, 186 IPSET_FLAG_BIT_WITH_COMMENT = 4,
184 IPSET_FLAG_WITH_COMMENT = (1 << IPSET_FLAG_BIT_WITH_COMMENT), 187 IPSET_FLAG_WITH_COMMENT = (1 << IPSET_FLAG_BIT_WITH_COMMENT),
188 IPSET_FLAG_BIT_WITH_FORCEADD = 5,
189 IPSET_FLAG_WITH_FORCEADD = (1 << IPSET_FLAG_BIT_WITH_FORCEADD),
185 IPSET_FLAG_CADT_MAX = 15, 190 IPSET_FLAG_CADT_MAX = 15,
186}; 191};
187 192
193/* The flag bits which correspond to the non-extension create flags */
194enum ipset_create_flags {
195 IPSET_CREATE_FLAG_BIT_FORCEADD = 0,
196 IPSET_CREATE_FLAG_FORCEADD = (1 << IPSET_CREATE_FLAG_BIT_FORCEADD),
197 IPSET_CREATE_FLAG_BIT_MAX = 7,
198};
199
188/* Commands with settype-specific attributes */ 200/* Commands with settype-specific attributes */
189enum ipset_adt { 201enum ipset_adt {
190 IPSET_ADD, 202 IPSET_ADD,
diff --git a/include/uapi/linux/netfilter/nf_tables.h b/include/uapi/linux/netfilter/nf_tables.h
index 83c985a6170b..c88ccbfda5f1 100644
--- a/include/uapi/linux/netfilter/nf_tables.h
+++ b/include/uapi/linux/netfilter/nf_tables.h
@@ -1,7 +1,8 @@
1#ifndef _LINUX_NF_TABLES_H 1#ifndef _LINUX_NF_TABLES_H
2#define _LINUX_NF_TABLES_H 2#define _LINUX_NF_TABLES_H
3 3
4#define NFT_CHAIN_MAXNAMELEN 32 4#define NFT_CHAIN_MAXNAMELEN 32
5#define NFT_USERDATA_MAXLEN 256
5 6
6enum nft_registers { 7enum nft_registers {
7 NFT_REG_VERDICT, 8 NFT_REG_VERDICT,
@@ -156,6 +157,7 @@ enum nft_chain_attributes {
156 * @NFTA_RULE_EXPRESSIONS: list of expressions (NLA_NESTED: nft_expr_attributes) 157 * @NFTA_RULE_EXPRESSIONS: list of expressions (NLA_NESTED: nft_expr_attributes)
157 * @NFTA_RULE_COMPAT: compatibility specifications of the rule (NLA_NESTED: nft_rule_compat_attributes) 158 * @NFTA_RULE_COMPAT: compatibility specifications of the rule (NLA_NESTED: nft_rule_compat_attributes)
158 * @NFTA_RULE_POSITION: numeric handle of the previous rule (NLA_U64) 159 * @NFTA_RULE_POSITION: numeric handle of the previous rule (NLA_U64)
160 * @NFTA_RULE_USERDATA: user data (NLA_BINARY, NFT_USERDATA_MAXLEN)
159 */ 161 */
160enum nft_rule_attributes { 162enum nft_rule_attributes {
161 NFTA_RULE_UNSPEC, 163 NFTA_RULE_UNSPEC,
@@ -165,6 +167,7 @@ enum nft_rule_attributes {
165 NFTA_RULE_EXPRESSIONS, 167 NFTA_RULE_EXPRESSIONS,
166 NFTA_RULE_COMPAT, 168 NFTA_RULE_COMPAT,
167 NFTA_RULE_POSITION, 169 NFTA_RULE_POSITION,
170 NFTA_RULE_USERDATA,
168 __NFTA_RULE_MAX 171 __NFTA_RULE_MAX
169}; 172};
170#define NFTA_RULE_MAX (__NFTA_RULE_MAX - 1) 173#define NFTA_RULE_MAX (__NFTA_RULE_MAX - 1)
@@ -601,6 +604,7 @@ enum nft_ct_keys {
601 NFT_CT_PROTOCOL, 604 NFT_CT_PROTOCOL,
602 NFT_CT_PROTO_SRC, 605 NFT_CT_PROTO_SRC,
603 NFT_CT_PROTO_DST, 606 NFT_CT_PROTO_DST,
607 NFT_CT_LABELS,
604}; 608};
605 609
606/** 610/**
diff --git a/include/uapi/linux/nfc.h b/include/uapi/linux/nfc.h
index 6ad6cc03ccd3..9789dc95b6a8 100644
--- a/include/uapi/linux/nfc.h
+++ b/include/uapi/linux/nfc.h
@@ -150,6 +150,8 @@ enum nfc_commands {
150 * @NFC_ATTR_SE_TYPE: Secure element type (UICC or EMBEDDED) 150 * @NFC_ATTR_SE_TYPE: Secure element type (UICC or EMBEDDED)
151 * @NFC_ATTR_FIRMWARE_DOWNLOAD_STATUS: Firmware download operation status 151 * @NFC_ATTR_FIRMWARE_DOWNLOAD_STATUS: Firmware download operation status
152 * @NFC_ATTR_APDU: Secure element APDU 152 * @NFC_ATTR_APDU: Secure element APDU
153 * @NFC_ATTR_TARGET_ISO15693_DSFID: ISO 15693 Data Storage Format Identifier
154 * @NFC_ATTR_TARGET_ISO15693_UID: ISO 15693 Unique Identifier
153 */ 155 */
154enum nfc_attrs { 156enum nfc_attrs {
155 NFC_ATTR_UNSPEC, 157 NFC_ATTR_UNSPEC,
@@ -178,6 +180,8 @@ enum nfc_attrs {
178 NFC_ATTR_SE_AID, 180 NFC_ATTR_SE_AID,
179 NFC_ATTR_FIRMWARE_DOWNLOAD_STATUS, 181 NFC_ATTR_FIRMWARE_DOWNLOAD_STATUS,
180 NFC_ATTR_SE_APDU, 182 NFC_ATTR_SE_APDU,
183 NFC_ATTR_TARGET_ISO15693_DSFID,
184 NFC_ATTR_TARGET_ISO15693_UID,
181/* private: internal use only */ 185/* private: internal use only */
182 __NFC_ATTR_AFTER_LAST 186 __NFC_ATTR_AFTER_LAST
183}; 187};
@@ -200,6 +204,7 @@ enum nfc_sdp_attr {
200#define NFC_SENSF_RES_MAXSIZE 18 204#define NFC_SENSF_RES_MAXSIZE 18
201#define NFC_GB_MAXSIZE 48 205#define NFC_GB_MAXSIZE 48
202#define NFC_FIRMWARE_NAME_MAXSIZE 32 206#define NFC_FIRMWARE_NAME_MAXSIZE 32
207#define NFC_ISO15693_UID_MAXSIZE 8
203 208
204/* NFC protocols */ 209/* NFC protocols */
205#define NFC_PROTO_JEWEL 1 210#define NFC_PROTO_JEWEL 1
@@ -208,8 +213,9 @@ enum nfc_sdp_attr {
208#define NFC_PROTO_ISO14443 4 213#define NFC_PROTO_ISO14443 4
209#define NFC_PROTO_NFC_DEP 5 214#define NFC_PROTO_NFC_DEP 5
210#define NFC_PROTO_ISO14443_B 6 215#define NFC_PROTO_ISO14443_B 6
216#define NFC_PROTO_ISO15693 7
211 217
212#define NFC_PROTO_MAX 7 218#define NFC_PROTO_MAX 8
213 219
214/* NFC communication modes */ 220/* NFC communication modes */
215#define NFC_COMM_ACTIVE 0 221#define NFC_COMM_ACTIVE 0
@@ -227,6 +233,7 @@ enum nfc_sdp_attr {
227#define NFC_PROTO_ISO14443_MASK (1 << NFC_PROTO_ISO14443) 233#define NFC_PROTO_ISO14443_MASK (1 << NFC_PROTO_ISO14443)
228#define NFC_PROTO_NFC_DEP_MASK (1 << NFC_PROTO_NFC_DEP) 234#define NFC_PROTO_NFC_DEP_MASK (1 << NFC_PROTO_NFC_DEP)
229#define NFC_PROTO_ISO14443_B_MASK (1 << NFC_PROTO_ISO14443_B) 235#define NFC_PROTO_ISO14443_B_MASK (1 << NFC_PROTO_ISO14443_B)
236#define NFC_PROTO_ISO15693_MASK (1 << NFC_PROTO_ISO15693)
230 237
231/* NFC Secure Elements */ 238/* NFC Secure Elements */
232#define NFC_SE_UICC 0x1 239#define NFC_SE_UICC 0x1
diff --git a/include/uapi/linux/nl80211.h b/include/uapi/linux/nl80211.h
index 91054fd660e0..1ba9d626aa83 100644
--- a/include/uapi/linux/nl80211.h
+++ b/include/uapi/linux/nl80211.h
@@ -303,8 +303,9 @@
303 * passed, all channels allowed for the current regulatory domain 303 * passed, all channels allowed for the current regulatory domain
304 * are used. Extra IEs can also be passed from the userspace by 304 * are used. Extra IEs can also be passed from the userspace by
305 * using the %NL80211_ATTR_IE attribute. 305 * using the %NL80211_ATTR_IE attribute.
306 * @NL80211_CMD_STOP_SCHED_SCAN: stop a scheduled scan. Returns -ENOENT 306 * @NL80211_CMD_STOP_SCHED_SCAN: stop a scheduled scan. Returns -ENOENT if
307 * if scheduled scan is not running. 307 * scheduled scan is not running. The caller may assume that as soon
308 * as the call returns, it is safe to start a new scheduled scan again.
308 * @NL80211_CMD_SCHED_SCAN_RESULTS: indicates that there are scheduled scan 309 * @NL80211_CMD_SCHED_SCAN_RESULTS: indicates that there are scheduled scan
309 * results available. 310 * results available.
310 * @NL80211_CMD_SCHED_SCAN_STOPPED: indicates that the scheduled scan has 311 * @NL80211_CMD_SCHED_SCAN_STOPPED: indicates that the scheduled scan has
@@ -418,8 +419,18 @@
418 * %NL80211_ATTR_SSID attribute, and can optionally specify the association 419 * %NL80211_ATTR_SSID attribute, and can optionally specify the association
419 * IEs in %NL80211_ATTR_IE, %NL80211_ATTR_AUTH_TYPE, %NL80211_ATTR_USE_MFP, 420 * IEs in %NL80211_ATTR_IE, %NL80211_ATTR_AUTH_TYPE, %NL80211_ATTR_USE_MFP,
420 * %NL80211_ATTR_MAC, %NL80211_ATTR_WIPHY_FREQ, %NL80211_ATTR_CONTROL_PORT, 421 * %NL80211_ATTR_MAC, %NL80211_ATTR_WIPHY_FREQ, %NL80211_ATTR_CONTROL_PORT,
421 * %NL80211_ATTR_CONTROL_PORT_ETHERTYPE and 422 * %NL80211_ATTR_CONTROL_PORT_ETHERTYPE,
422 * %NL80211_ATTR_CONTROL_PORT_NO_ENCRYPT. 423 * %NL80211_ATTR_CONTROL_PORT_NO_ENCRYPT, %NL80211_ATTR_MAC_HINT, and
424 * %NL80211_ATTR_WIPHY_FREQ_HINT.
425 * If included, %NL80211_ATTR_MAC and %NL80211_ATTR_WIPHY_FREQ are
426 * restrictions on BSS selection, i.e., they effectively prevent roaming
427 * within the ESS. %NL80211_ATTR_MAC_HINT and %NL80211_ATTR_WIPHY_FREQ_HINT
428 * can be included to provide a recommendation of the initial BSS while
429 * allowing the driver to roam to other BSSes within the ESS and also to
430 * ignore this recommendation if the indicated BSS is not ideal. Only one
431 * set of BSSID,frequency parameters is used (i.e., either the enforcing
432 * %NL80211_ATTR_MAC,%NL80211_ATTR_WIPHY_FREQ or the less strict
433 * %NL80211_ATTR_MAC_HINT and %NL80211_ATTR_WIPHY_FREQ_HINT).
423 * Background scan period can optionally be 434 * Background scan period can optionally be
424 * specified in %NL80211_ATTR_BG_SCAN_PERIOD, 435 * specified in %NL80211_ATTR_BG_SCAN_PERIOD,
425 * if not specified default background scan configuration 436 * if not specified default background scan configuration
@@ -1555,6 +1566,19 @@ enum nl80211_commands {
1555 * data is in the format defined for the payload of the QoS Map Set element 1566 * data is in the format defined for the payload of the QoS Map Set element
1556 * in IEEE Std 802.11-2012, 8.4.2.97. 1567 * in IEEE Std 802.11-2012, 8.4.2.97.
1557 * 1568 *
1569 * @NL80211_ATTR_MAC_HINT: MAC address recommendation as initial BSS
1570 * @NL80211_ATTR_WIPHY_FREQ_HINT: frequency of the recommended initial BSS
1571 *
1572 * @NL80211_ATTR_MAX_AP_ASSOC_STA: Device attribute that indicates how many
1573 * associated stations are supported in AP mode (including P2P GO); u32.
1574 * Since drivers may not have a fixed limit on the maximum number (e.g.,
1575 * other concurrent operations may affect this), drivers are allowed to
1576 * advertise values that cannot always be met. In such cases, an attempt
1577 * to add a new station entry with @NL80211_CMD_NEW_STATION may fail.
1578 *
1579 * @NL80211_ATTR_TDLS_PEER_CAPABILITY: flags for TDLS peer capabilities, u32.
1580 * As specified in the &enum nl80211_tdls_peer_capability.
1581 *
1558 * @NL80211_ATTR_MAX: highest attribute number currently defined 1582 * @NL80211_ATTR_MAX: highest attribute number currently defined
1559 * @__NL80211_ATTR_AFTER_LAST: internal use 1583 * @__NL80211_ATTR_AFTER_LAST: internal use
1560 */ 1584 */
@@ -1883,6 +1907,13 @@ enum nl80211_attrs {
1883 1907
1884 NL80211_ATTR_QOS_MAP, 1908 NL80211_ATTR_QOS_MAP,
1885 1909
1910 NL80211_ATTR_MAC_HINT,
1911 NL80211_ATTR_WIPHY_FREQ_HINT,
1912
1913 NL80211_ATTR_MAX_AP_ASSOC_STA,
1914
1915 NL80211_ATTR_TDLS_PEER_CAPABILITY,
1916
1886 /* add attributes here, update the policy in nl80211.c */ 1917 /* add attributes here, update the policy in nl80211.c */
1887 1918
1888 __NL80211_ATTR_AFTER_LAST, 1919 __NL80211_ATTR_AFTER_LAST,
@@ -2304,6 +2335,7 @@ enum nl80211_band_attr {
2304 * @NL80211_FREQUENCY_ATTR_NO_160MHZ: any 160 MHz (but not 80+80) channel 2335 * @NL80211_FREQUENCY_ATTR_NO_160MHZ: any 160 MHz (but not 80+80) channel
2305 * using this channel as the primary or any of the secondary channels 2336 * using this channel as the primary or any of the secondary channels
2306 * isn't possible 2337 * isn't possible
2338 * @NL80211_FREQUENCY_ATTR_DFS_CAC_TIME: DFS CAC time in milliseconds.
2307 * @NL80211_FREQUENCY_ATTR_MAX: highest frequency attribute number 2339 * @NL80211_FREQUENCY_ATTR_MAX: highest frequency attribute number
2308 * currently defined 2340 * currently defined
2309 * @__NL80211_FREQUENCY_ATTR_AFTER_LAST: internal use 2341 * @__NL80211_FREQUENCY_ATTR_AFTER_LAST: internal use
@@ -2322,6 +2354,7 @@ enum nl80211_frequency_attr {
2322 NL80211_FREQUENCY_ATTR_NO_HT40_PLUS, 2354 NL80211_FREQUENCY_ATTR_NO_HT40_PLUS,
2323 NL80211_FREQUENCY_ATTR_NO_80MHZ, 2355 NL80211_FREQUENCY_ATTR_NO_80MHZ,
2324 NL80211_FREQUENCY_ATTR_NO_160MHZ, 2356 NL80211_FREQUENCY_ATTR_NO_160MHZ,
2357 NL80211_FREQUENCY_ATTR_DFS_CAC_TIME,
2325 2358
2326 /* keep last */ 2359 /* keep last */
2327 __NL80211_FREQUENCY_ATTR_AFTER_LAST, 2360 __NL80211_FREQUENCY_ATTR_AFTER_LAST,
@@ -2412,12 +2445,14 @@ enum nl80211_reg_type {
2412 * in KHz. This is not a center a frequency but an actual regulatory 2445 * in KHz. This is not a center a frequency but an actual regulatory
2413 * band edge. 2446 * band edge.
2414 * @NL80211_ATTR_FREQ_RANGE_MAX_BW: maximum allowed bandwidth for this 2447 * @NL80211_ATTR_FREQ_RANGE_MAX_BW: maximum allowed bandwidth for this
2415 * frequency range, in KHz. 2448 * frequency range, in KHz.
2416 * @NL80211_ATTR_POWER_RULE_MAX_ANT_GAIN: the maximum allowed antenna gain 2449 * @NL80211_ATTR_POWER_RULE_MAX_ANT_GAIN: the maximum allowed antenna gain
2417 * for a given frequency range. The value is in mBi (100 * dBi). 2450 * for a given frequency range. The value is in mBi (100 * dBi).
2418 * If you don't have one then don't send this. 2451 * If you don't have one then don't send this.
2419 * @NL80211_ATTR_POWER_RULE_MAX_EIRP: the maximum allowed EIRP for 2452 * @NL80211_ATTR_POWER_RULE_MAX_EIRP: the maximum allowed EIRP for
2420 * a given frequency range. The value is in mBm (100 * dBm). 2453 * a given frequency range. The value is in mBm (100 * dBm).
2454 * @NL80211_ATTR_DFS_CAC_TIME: DFS CAC time in milliseconds.
2455 * If not present or 0 default CAC time will be used.
2421 * @NL80211_REG_RULE_ATTR_MAX: highest regulatory rule attribute number 2456 * @NL80211_REG_RULE_ATTR_MAX: highest regulatory rule attribute number
2422 * currently defined 2457 * currently defined
2423 * @__NL80211_REG_RULE_ATTR_AFTER_LAST: internal use 2458 * @__NL80211_REG_RULE_ATTR_AFTER_LAST: internal use
@@ -2433,6 +2468,8 @@ enum nl80211_reg_rule_attr {
2433 NL80211_ATTR_POWER_RULE_MAX_ANT_GAIN, 2468 NL80211_ATTR_POWER_RULE_MAX_ANT_GAIN,
2434 NL80211_ATTR_POWER_RULE_MAX_EIRP, 2469 NL80211_ATTR_POWER_RULE_MAX_EIRP,
2435 2470
2471 NL80211_ATTR_DFS_CAC_TIME,
2472
2436 /* keep last */ 2473 /* keep last */
2437 __NL80211_REG_RULE_ATTR_AFTER_LAST, 2474 __NL80211_REG_RULE_ATTR_AFTER_LAST,
2438 NL80211_REG_RULE_ATTR_MAX = __NL80211_REG_RULE_ATTR_AFTER_LAST - 1 2475 NL80211_REG_RULE_ATTR_MAX = __NL80211_REG_RULE_ATTR_AFTER_LAST - 1
@@ -2442,9 +2479,15 @@ enum nl80211_reg_rule_attr {
2442 * enum nl80211_sched_scan_match_attr - scheduled scan match attributes 2479 * enum nl80211_sched_scan_match_attr - scheduled scan match attributes
2443 * @__NL80211_SCHED_SCAN_MATCH_ATTR_INVALID: attribute number 0 is reserved 2480 * @__NL80211_SCHED_SCAN_MATCH_ATTR_INVALID: attribute number 0 is reserved
2444 * @NL80211_SCHED_SCAN_MATCH_ATTR_SSID: SSID to be used for matching, 2481 * @NL80211_SCHED_SCAN_MATCH_ATTR_SSID: SSID to be used for matching,
2445 * only report BSS with matching SSID. 2482 * only report BSS with matching SSID.
2446 * @NL80211_SCHED_SCAN_MATCH_ATTR_RSSI: RSSI threshold (in dBm) for reporting a 2483 * @NL80211_SCHED_SCAN_MATCH_ATTR_RSSI: RSSI threshold (in dBm) for reporting a
2447 * BSS in scan results. Filtering is turned off if not specified. 2484 * BSS in scan results. Filtering is turned off if not specified. Note that
2485 * if this attribute is in a match set of its own, then it is treated as
2486 * the default value for all matchsets with an SSID, rather than being a
2487 * matchset of its own without an RSSI filter. This is due to problems with
2488 * how this API was implemented in the past. Also, due to the same problem,
2489 * the only way to create a matchset with only an RSSI filter (with this
2490 * attribute) is if there's only a single matchset with the RSSI attribute.
2448 * @NL80211_SCHED_SCAN_MATCH_ATTR_MAX: highest scheduled scan filter 2491 * @NL80211_SCHED_SCAN_MATCH_ATTR_MAX: highest scheduled scan filter
2449 * attribute number currently defined 2492 * attribute number currently defined
2450 * @__NL80211_SCHED_SCAN_MATCH_ATTR_AFTER_LAST: internal use 2493 * @__NL80211_SCHED_SCAN_MATCH_ATTR_AFTER_LAST: internal use
@@ -2477,6 +2520,9 @@ enum nl80211_sched_scan_match_attr {
2477 * @NL80211_RRF_NO_IR: no mechanisms that initiate radiation are allowed, 2520 * @NL80211_RRF_NO_IR: no mechanisms that initiate radiation are allowed,
2478 * this includes probe requests or modes of operation that require 2521 * this includes probe requests or modes of operation that require
2479 * beaconing. 2522 * beaconing.
2523 * @NL80211_RRF_AUTO_BW: maximum available bandwidth should be calculated
2524 * base on contiguous rules and wider channels will be allowed to cross
2525 * multiple contiguous/overlapping frequency ranges.
2480 */ 2526 */
2481enum nl80211_reg_rule_flags { 2527enum nl80211_reg_rule_flags {
2482 NL80211_RRF_NO_OFDM = 1<<0, 2528 NL80211_RRF_NO_OFDM = 1<<0,
@@ -2488,6 +2534,7 @@ enum nl80211_reg_rule_flags {
2488 NL80211_RRF_PTMP_ONLY = 1<<6, 2534 NL80211_RRF_PTMP_ONLY = 1<<6,
2489 NL80211_RRF_NO_IR = 1<<7, 2535 NL80211_RRF_NO_IR = 1<<7,
2490 __NL80211_RRF_NO_IBSS = 1<<8, 2536 __NL80211_RRF_NO_IBSS = 1<<8,
2537 NL80211_RRF_AUTO_BW = 1<<11,
2491}; 2538};
2492 2539
2493#define NL80211_RRF_PASSIVE_SCAN NL80211_RRF_NO_IR 2540#define NL80211_RRF_PASSIVE_SCAN NL80211_RRF_NO_IR
@@ -3131,6 +3178,7 @@ enum nl80211_key_attributes {
3131 * in an array of MCS numbers. 3178 * in an array of MCS numbers.
3132 * @NL80211_TXRATE_VHT: VHT rates allowed for TX rate selection, 3179 * @NL80211_TXRATE_VHT: VHT rates allowed for TX rate selection,
3133 * see &struct nl80211_txrate_vht 3180 * see &struct nl80211_txrate_vht
3181 * @NL80211_TXRATE_GI: configure GI, see &enum nl80211_txrate_gi
3134 * @__NL80211_TXRATE_AFTER_LAST: internal 3182 * @__NL80211_TXRATE_AFTER_LAST: internal
3135 * @NL80211_TXRATE_MAX: highest TX rate attribute 3183 * @NL80211_TXRATE_MAX: highest TX rate attribute
3136 */ 3184 */
@@ -3139,6 +3187,7 @@ enum nl80211_tx_rate_attributes {
3139 NL80211_TXRATE_LEGACY, 3187 NL80211_TXRATE_LEGACY,
3140 NL80211_TXRATE_HT, 3188 NL80211_TXRATE_HT,
3141 NL80211_TXRATE_VHT, 3189 NL80211_TXRATE_VHT,
3190 NL80211_TXRATE_GI,
3142 3191
3143 /* keep last */ 3192 /* keep last */
3144 __NL80211_TXRATE_AFTER_LAST, 3193 __NL80211_TXRATE_AFTER_LAST,
@@ -3156,6 +3205,12 @@ struct nl80211_txrate_vht {
3156 __u16 mcs[NL80211_VHT_NSS_MAX]; 3205 __u16 mcs[NL80211_VHT_NSS_MAX];
3157}; 3206};
3158 3207
3208enum nl80211_txrate_gi {
3209 NL80211_TXRATE_DEFAULT_GI,
3210 NL80211_TXRATE_FORCE_SGI,
3211 NL80211_TXRATE_FORCE_LGI,
3212};
3213
3159/** 3214/**
3160 * enum nl80211_band - Frequency band 3215 * enum nl80211_band - Frequency band
3161 * @NL80211_BAND_2GHZ: 2.4 GHz ISM band 3216 * @NL80211_BAND_2GHZ: 2.4 GHz ISM band
@@ -3801,11 +3856,6 @@ enum nl80211_ap_sme_features {
3801 * @NL80211_FEATURE_CELL_BASE_REG_HINTS: This driver has been tested 3856 * @NL80211_FEATURE_CELL_BASE_REG_HINTS: This driver has been tested
3802 * to work properly to suppport receiving regulatory hints from 3857 * to work properly to suppport receiving regulatory hints from
3803 * cellular base stations. 3858 * cellular base stations.
3804 * @NL80211_FEATURE_P2P_DEVICE_NEEDS_CHANNEL: If this is set, an active
3805 * P2P Device (%NL80211_IFTYPE_P2P_DEVICE) requires its own channel
3806 * in the interface combinations, even when it's only used for scan
3807 * and remain-on-channel. This could be due to, for example, the
3808 * remain-on-channel implementation requiring a channel context.
3809 * @NL80211_FEATURE_SAE: This driver supports simultaneous authentication of 3859 * @NL80211_FEATURE_SAE: This driver supports simultaneous authentication of
3810 * equals (SAE) with user space SME (NL80211_CMD_AUTHENTICATE) in station 3860 * equals (SAE) with user space SME (NL80211_CMD_AUTHENTICATE) in station
3811 * mode 3861 * mode
@@ -3847,7 +3897,7 @@ enum nl80211_feature_flags {
3847 NL80211_FEATURE_HT_IBSS = 1 << 1, 3897 NL80211_FEATURE_HT_IBSS = 1 << 1,
3848 NL80211_FEATURE_INACTIVITY_TIMER = 1 << 2, 3898 NL80211_FEATURE_INACTIVITY_TIMER = 1 << 2,
3849 NL80211_FEATURE_CELL_BASE_REG_HINTS = 1 << 3, 3899 NL80211_FEATURE_CELL_BASE_REG_HINTS = 1 << 3,
3850 NL80211_FEATURE_P2P_DEVICE_NEEDS_CHANNEL = 1 << 4, 3900 /* bit 4 is reserved - don't use */
3851 NL80211_FEATURE_SAE = 1 << 5, 3901 NL80211_FEATURE_SAE = 1 << 5,
3852 NL80211_FEATURE_LOW_PRIORITY_SCAN = 1 << 6, 3902 NL80211_FEATURE_LOW_PRIORITY_SCAN = 1 << 6,
3853 NL80211_FEATURE_SCAN_FLUSH = 1 << 7, 3903 NL80211_FEATURE_SCAN_FLUSH = 1 << 7,
@@ -4037,4 +4087,20 @@ struct nl80211_vendor_cmd_info {
4037 __u32 subcmd; 4087 __u32 subcmd;
4038}; 4088};
4039 4089
4090/**
4091 * enum nl80211_tdls_peer_capability - TDLS peer flags.
4092 *
4093 * Used by tdls_mgmt() to determine which conditional elements need
4094 * to be added to TDLS Setup frames.
4095 *
4096 * @NL80211_TDLS_PEER_HT: TDLS peer is HT capable.
4097 * @NL80211_TDLS_PEER_VHT: TDLS peer is VHT capable.
4098 * @NL80211_TDLS_PEER_WMM: TDLS peer is WMM capable.
4099 */
4100enum nl80211_tdls_peer_capability {
4101 NL80211_TDLS_PEER_HT = 1<<0,
4102 NL80211_TDLS_PEER_VHT = 1<<1,
4103 NL80211_TDLS_PEER_WMM = 1<<2,
4104};
4105
4040#endif /* __LINUX_NL80211_H */ 4106#endif /* __LINUX_NL80211_H */
diff --git a/include/uapi/linux/pfkeyv2.h b/include/uapi/linux/pfkeyv2.h
index 0b80c806631f..ada7f0171ccc 100644
--- a/include/uapi/linux/pfkeyv2.h
+++ b/include/uapi/linux/pfkeyv2.h
@@ -235,6 +235,18 @@ struct sadb_x_kmaddress {
235} __attribute__((packed)); 235} __attribute__((packed));
236/* sizeof(struct sadb_x_kmaddress) == 8 */ 236/* sizeof(struct sadb_x_kmaddress) == 8 */
237 237
238/* To specify the SA dump filter */
239struct sadb_x_filter {
240 __u16 sadb_x_filter_len;
241 __u16 sadb_x_filter_exttype;
242 __u32 sadb_x_filter_saddr[4];
243 __u32 sadb_x_filter_daddr[4];
244 __u16 sadb_x_filter_family;
245 __u8 sadb_x_filter_splen;
246 __u8 sadb_x_filter_dplen;
247} __attribute__((packed));
248/* sizeof(struct sadb_x_filter) == 40 */
249
238/* Message types */ 250/* Message types */
239#define SADB_RESERVED 0 251#define SADB_RESERVED 0
240#define SADB_GETSPI 1 252#define SADB_GETSPI 1
@@ -358,7 +370,8 @@ struct sadb_x_kmaddress {
358#define SADB_X_EXT_SEC_CTX 24 370#define SADB_X_EXT_SEC_CTX 24
359/* Used with MIGRATE to pass @ to IKE for negotiation */ 371/* Used with MIGRATE to pass @ to IKE for negotiation */
360#define SADB_X_EXT_KMADDRESS 25 372#define SADB_X_EXT_KMADDRESS 25
361#define SADB_EXT_MAX 25 373#define SADB_X_EXT_FILTER 26
374#define SADB_EXT_MAX 26
362 375
363/* Identity Extension values */ 376/* Identity Extension values */
364#define SADB_IDENTTYPE_RESERVED 0 377#define SADB_IDENTTYPE_RESERVED 0
diff --git a/include/uapi/linux/ptp_clock.h b/include/uapi/linux/ptp_clock.h
index b65c834f83e9..f0b7bfe5da92 100644
--- a/include/uapi/linux/ptp_clock.h
+++ b/include/uapi/linux/ptp_clock.h
@@ -50,7 +50,8 @@ struct ptp_clock_caps {
50 int n_ext_ts; /* Number of external time stamp channels. */ 50 int n_ext_ts; /* Number of external time stamp channels. */
51 int n_per_out; /* Number of programmable periodic signals. */ 51 int n_per_out; /* Number of programmable periodic signals. */
52 int pps; /* Whether the clock supports a PPS callback. */ 52 int pps; /* Whether the clock supports a PPS callback. */
53 int rsv[15]; /* Reserved for future use. */ 53 int n_pins; /* Number of input/output pins. */
54 int rsv[14]; /* Reserved for future use. */
54}; 55};
55 56
56struct ptp_extts_request { 57struct ptp_extts_request {
@@ -80,6 +81,40 @@ struct ptp_sys_offset {
80 struct ptp_clock_time ts[2 * PTP_MAX_SAMPLES + 1]; 81 struct ptp_clock_time ts[2 * PTP_MAX_SAMPLES + 1];
81}; 82};
82 83
84enum ptp_pin_function {
85 PTP_PF_NONE,
86 PTP_PF_EXTTS,
87 PTP_PF_PEROUT,
88 PTP_PF_PHYSYNC,
89};
90
91struct ptp_pin_desc {
92 /*
93 * Hardware specific human readable pin name. This field is
94 * set by the kernel during the PTP_PIN_GETFUNC ioctl and is
95 * ignored for the PTP_PIN_SETFUNC ioctl.
96 */
97 char name[64];
98 /*
99 * Pin index in the range of zero to ptp_clock_caps.n_pins - 1.
100 */
101 unsigned int index;
102 /*
103 * Which of the PTP_PF_xxx functions to use on this pin.
104 */
105 unsigned int func;
106 /*
107 * The specific channel to use for this function.
108 * This corresponds to the 'index' field of the
109 * PTP_EXTTS_REQUEST and PTP_PEROUT_REQUEST ioctls.
110 */
111 unsigned int chan;
112 /*
113 * Reserved for future use.
114 */
115 unsigned int rsv[5];
116};
117
83#define PTP_CLK_MAGIC '=' 118#define PTP_CLK_MAGIC '='
84 119
85#define PTP_CLOCK_GETCAPS _IOR(PTP_CLK_MAGIC, 1, struct ptp_clock_caps) 120#define PTP_CLOCK_GETCAPS _IOR(PTP_CLK_MAGIC, 1, struct ptp_clock_caps)
@@ -87,6 +122,8 @@ struct ptp_sys_offset {
87#define PTP_PEROUT_REQUEST _IOW(PTP_CLK_MAGIC, 3, struct ptp_perout_request) 122#define PTP_PEROUT_REQUEST _IOW(PTP_CLK_MAGIC, 3, struct ptp_perout_request)
88#define PTP_ENABLE_PPS _IOW(PTP_CLK_MAGIC, 4, int) 123#define PTP_ENABLE_PPS _IOW(PTP_CLK_MAGIC, 4, int)
89#define PTP_SYS_OFFSET _IOW(PTP_CLK_MAGIC, 5, struct ptp_sys_offset) 124#define PTP_SYS_OFFSET _IOW(PTP_CLK_MAGIC, 5, struct ptp_sys_offset)
125#define PTP_PIN_GETFUNC _IOWR(PTP_CLK_MAGIC, 6, struct ptp_pin_desc)
126#define PTP_PIN_SETFUNC _IOW(PTP_CLK_MAGIC, 7, struct ptp_pin_desc)
90 127
91struct ptp_extts_event { 128struct ptp_extts_event {
92 struct ptp_clock_time t; /* Time event occured. */ 129 struct ptp_clock_time t; /* Time event occured. */
diff --git a/include/uapi/linux/snmp.h b/include/uapi/linux/snmp.h
index bbaba22f2d1b..df40137f33dd 100644
--- a/include/uapi/linux/snmp.h
+++ b/include/uapi/linux/snmp.h
@@ -252,6 +252,7 @@ enum
252 LINUX_MIB_TCPCHALLENGEACK, /* TCPChallengeACK */ 252 LINUX_MIB_TCPCHALLENGEACK, /* TCPChallengeACK */
253 LINUX_MIB_TCPSYNCHALLENGE, /* TCPSYNChallenge */ 253 LINUX_MIB_TCPSYNCHALLENGE, /* TCPSYNChallenge */
254 LINUX_MIB_TCPFASTOPENACTIVE, /* TCPFastOpenActive */ 254 LINUX_MIB_TCPFASTOPENACTIVE, /* TCPFastOpenActive */
255 LINUX_MIB_TCPFASTOPENACTIVEFAIL, /* TCPFastOpenActiveFail */
255 LINUX_MIB_TCPFASTOPENPASSIVE, /* TCPFastOpenPassive*/ 256 LINUX_MIB_TCPFASTOPENPASSIVE, /* TCPFastOpenPassive*/
256 LINUX_MIB_TCPFASTOPENPASSIVEFAIL, /* TCPFastOpenPassiveFail */ 257 LINUX_MIB_TCPFASTOPENPASSIVEFAIL, /* TCPFastOpenPassiveFail */
257 LINUX_MIB_TCPFASTOPENLISTENOVERFLOW, /* TCPFastOpenListenOverflow */ 258 LINUX_MIB_TCPFASTOPENLISTENOVERFLOW, /* TCPFastOpenListenOverflow */
@@ -259,6 +260,11 @@ enum
259 LINUX_MIB_TCPSPURIOUS_RTX_HOSTQUEUES, /* TCPSpuriousRtxHostQueues */ 260 LINUX_MIB_TCPSPURIOUS_RTX_HOSTQUEUES, /* TCPSpuriousRtxHostQueues */
260 LINUX_MIB_BUSYPOLLRXPACKETS, /* BusyPollRxPackets */ 261 LINUX_MIB_BUSYPOLLRXPACKETS, /* BusyPollRxPackets */
261 LINUX_MIB_TCPAUTOCORKING, /* TCPAutoCorking */ 262 LINUX_MIB_TCPAUTOCORKING, /* TCPAutoCorking */
263 LINUX_MIB_TCPFROMZEROWINDOWADV, /* TCPFromZeroWindowAdv */
264 LINUX_MIB_TCPTOZEROWINDOWADV, /* TCPToZeroWindowAdv */
265 LINUX_MIB_TCPWANTZEROWINDOWADV, /* TCPWantZeroWindowAdv */
266 LINUX_MIB_TCPSYNRETRANS, /* TCPSynRetrans */
267 LINUX_MIB_TCPORIGDATASENT, /* TCPOrigDataSent */
262 __LINUX_MIB_MAX 268 __LINUX_MIB_MAX
263}; 269};
264 270
diff --git a/include/uapi/linux/tcp.h b/include/uapi/linux/tcp.h
index 377f1e59411d..3b9718328d8b 100644
--- a/include/uapi/linux/tcp.h
+++ b/include/uapi/linux/tcp.h
@@ -186,6 +186,9 @@ struct tcp_info {
186 __u32 tcpi_rcv_space; 186 __u32 tcpi_rcv_space;
187 187
188 __u32 tcpi_total_retrans; 188 __u32 tcpi_total_retrans;
189
190 __u64 tcpi_pacing_rate;
191 __u64 tcpi_max_pacing_rate;
189}; 192};
190 193
191/* for TCP_MD5SIG socket option */ 194/* for TCP_MD5SIG socket option */
diff --git a/include/uapi/linux/tcp_metrics.h b/include/uapi/linux/tcp_metrics.h
index 54a37b13f2c4..93533926035c 100644
--- a/include/uapi/linux/tcp_metrics.h
+++ b/include/uapi/linux/tcp_metrics.h
@@ -11,12 +11,15 @@
11#define TCP_METRICS_GENL_VERSION 0x1 11#define TCP_METRICS_GENL_VERSION 0x1
12 12
13enum tcp_metric_index { 13enum tcp_metric_index {
14 TCP_METRIC_RTT, 14 TCP_METRIC_RTT, /* in ms units */
15 TCP_METRIC_RTTVAR, 15 TCP_METRIC_RTTVAR, /* in ms units */
16 TCP_METRIC_SSTHRESH, 16 TCP_METRIC_SSTHRESH,
17 TCP_METRIC_CWND, 17 TCP_METRIC_CWND,
18 TCP_METRIC_REORDERING, 18 TCP_METRIC_REORDERING,
19 19
20 TCP_METRIC_RTT_US, /* in usec units */
21 TCP_METRIC_RTTVAR_US, /* in usec units */
22
20 /* Always last. */ 23 /* Always last. */
21 __TCP_METRIC_MAX, 24 __TCP_METRIC_MAX,
22}; 25};
diff --git a/include/uapi/linux/usb/cdc.h b/include/uapi/linux/usb/cdc.h
index f35aa0a338c7..b6a9cdd6e096 100644
--- a/include/uapi/linux/usb/cdc.h
+++ b/include/uapi/linux/usb/cdc.h
@@ -56,6 +56,7 @@
56#define USB_CDC_OBEX_TYPE 0x15 56#define USB_CDC_OBEX_TYPE 0x15
57#define USB_CDC_NCM_TYPE 0x1a 57#define USB_CDC_NCM_TYPE 0x1a
58#define USB_CDC_MBIM_TYPE 0x1b 58#define USB_CDC_MBIM_TYPE 0x1b
59#define USB_CDC_MBIM_EXTENDED_TYPE 0x1c
59 60
60/* "Header Functional Descriptor" from CDC spec 5.2.3.1 */ 61/* "Header Functional Descriptor" from CDC spec 5.2.3.1 */
61struct usb_cdc_header_desc { 62struct usb_cdc_header_desc {
@@ -205,6 +206,17 @@ struct usb_cdc_mbim_desc {
205 __u8 bmNetworkCapabilities; 206 __u8 bmNetworkCapabilities;
206} __attribute__ ((packed)); 207} __attribute__ ((packed));
207 208
209/* "MBIM Extended Functional Descriptor" from CDC MBIM spec 1.0 errata-1 */
210struct usb_cdc_mbim_extended_desc {
211 __u8 bLength;
212 __u8 bDescriptorType;
213 __u8 bDescriptorSubType;
214
215 __le16 bcdMBIMExtendedVersion;
216 __u8 bMaxOutstandingCommandMessages;
217 __le16 wMTU;
218} __attribute__ ((packed));
219
208/*-------------------------------------------------------------------------*/ 220/*-------------------------------------------------------------------------*/
209 221
210/* 222/*
diff --git a/include/uapi/linux/xfrm.h b/include/uapi/linux/xfrm.h
index a8cd6a4a2970..25e5dd916ba4 100644
--- a/include/uapi/linux/xfrm.h
+++ b/include/uapi/linux/xfrm.h
@@ -298,6 +298,8 @@ enum xfrm_attr_type_t {
298 XFRMA_TFCPAD, /* __u32 */ 298 XFRMA_TFCPAD, /* __u32 */
299 XFRMA_REPLAY_ESN_VAL, /* struct xfrm_replay_esn */ 299 XFRMA_REPLAY_ESN_VAL, /* struct xfrm_replay_esn */
300 XFRMA_SA_EXTRA_FLAGS, /* __u32 */ 300 XFRMA_SA_EXTRA_FLAGS, /* __u32 */
301 XFRMA_PROTO, /* __u8 */
302 XFRMA_ADDRESS_FILTER, /* struct xfrm_address_filter */
301 __XFRMA_MAX 303 __XFRMA_MAX
302 304
303#define XFRMA_MAX (__XFRMA_MAX - 1) 305#define XFRMA_MAX (__XFRMA_MAX - 1)
@@ -474,6 +476,14 @@ struct xfrm_user_mapping {
474 __be16 new_sport; 476 __be16 new_sport;
475}; 477};
476 478
479struct xfrm_address_filter {
480 xfrm_address_t saddr;
481 xfrm_address_t daddr;
482 __u16 family;
483 __u8 splen;
484 __u8 dplen;
485};
486
477#ifndef __KERNEL__ 487#ifndef __KERNEL__
478/* backwards compatibility for userspace */ 488/* backwards compatibility for userspace */
479#define XFRMGRP_ACQUIRE 1 489#define XFRMGRP_ACQUIRE 1