aboutsummaryrefslogtreecommitdiffstats
path: root/include
diff options
context:
space:
mode:
Diffstat (limited to 'include')
-rw-r--r--include/linux/Kbuild1
-rw-r--r--include/linux/bcma/bcma_driver_chipcommon.h85
-rw-r--r--include/linux/bcma/bcma_regs.h2
-rw-r--r--include/linux/hash.h10
-rw-r--r--include/linux/if_arp.h1
-rw-r--r--include/linux/if_team.h11
-rw-r--r--include/linux/if_tunnel.h3
-rw-r--r--include/linux/inetdevice.h11
-rw-r--r--include/linux/ip6_tunnel.h17
-rw-r--r--include/linux/jiffies.h6
-rw-r--r--include/linux/netdevice.h5
-rw-r--r--include/linux/packet_diag.h72
-rw-r--r--include/linux/skbuff.h9
-rw-r--r--include/linux/snmp.h12
-rw-r--r--include/linux/ssb/ssb_driver_chipcommon.h4
-rw-r--r--include/linux/tipc_config.h8
-rw-r--r--include/net/arp.h3
-rw-r--r--include/net/bluetooth/bluetooth.h10
-rw-r--r--include/net/bluetooth/hci.h11
-rw-r--r--include/net/bluetooth/hci_core.h22
-rw-r--r--include/net/bluetooth/l2cap.h17
-rw-r--r--include/net/bluetooth/smp.h8
-rw-r--r--include/net/dst.h10
-rw-r--r--include/net/ip6_tunnel.h41
-rw-r--r--include/net/ipv6.h1
-rw-r--r--include/net/ndisc.h3
-rw-r--r--include/net/neighbour.h14
-rw-r--r--include/net/net_namespace.h12
-rw-r--r--include/net/netlink.h98
-rw-r--r--include/net/netns/sctp.h131
-rw-r--r--include/net/sctp/sctp.h69
-rw-r--r--include/net/sctp/sm.h8
-rw-r--r--include/net/sctp/structs.h154
-rw-r--r--include/net/snmp.h10
-rw-r--r--include/net/xfrm.h2
35 files changed, 628 insertions, 253 deletions
diff --git a/include/linux/Kbuild b/include/linux/Kbuild
index fa217607c582..1f2c1c787f17 100644
--- a/include/linux/Kbuild
+++ b/include/linux/Kbuild
@@ -195,6 +195,7 @@ header-y += in_route.h
195header-y += sock_diag.h 195header-y += sock_diag.h
196header-y += inet_diag.h 196header-y += inet_diag.h
197header-y += unix_diag.h 197header-y += unix_diag.h
198header-y += packet_diag.h
198header-y += inotify.h 199header-y += inotify.h
199header-y += input.h 200header-y += input.h
200header-y += ioctl.h 201header-y += ioctl.h
diff --git a/include/linux/bcma/bcma_driver_chipcommon.h b/include/linux/bcma/bcma_driver_chipcommon.h
index d323a4b4143c..3fb8bbafe5e7 100644
--- a/include/linux/bcma/bcma_driver_chipcommon.h
+++ b/include/linux/bcma/bcma_driver_chipcommon.h
@@ -100,6 +100,7 @@
100#define BCMA_CC_CHIPST_4706_SFLASH_TYPE BIT(2) /* 0: 8b-p/ST-s flash, 1: 16b-p/Atmal-s flash */ 100#define BCMA_CC_CHIPST_4706_SFLASH_TYPE BIT(2) /* 0: 8b-p/ST-s flash, 1: 16b-p/Atmal-s flash */
101#define BCMA_CC_CHIPST_4706_MIPS_BENDIAN BIT(3) /* 0: little, 1: big endian */ 101#define BCMA_CC_CHIPST_4706_MIPS_BENDIAN BIT(3) /* 0: little, 1: big endian */
102#define BCMA_CC_CHIPST_4706_PCIE1_DISABLE BIT(5) /* PCIE1 enable strap pin */ 102#define BCMA_CC_CHIPST_4706_PCIE1_DISABLE BIT(5) /* PCIE1 enable strap pin */
103#define BCMA_CC_CHIPST_5357_NAND_BOOT BIT(4) /* NAND boot, valid for CC rev 38 and/or BCM5357 */
103#define BCMA_CC_JCMD 0x0030 /* Rev >= 10 only */ 104#define BCMA_CC_JCMD 0x0030 /* Rev >= 10 only */
104#define BCMA_CC_JCMD_START 0x80000000 105#define BCMA_CC_JCMD_START 0x80000000
105#define BCMA_CC_JCMD_BUSY 0x80000000 106#define BCMA_CC_JCMD_BUSY 0x80000000
@@ -266,6 +267,29 @@
266#define BCMA_CC_SROM_CONTROL_SIZE_16K 0x00000004 267#define BCMA_CC_SROM_CONTROL_SIZE_16K 0x00000004
267#define BCMA_CC_SROM_CONTROL_SIZE_SHIFT 1 268#define BCMA_CC_SROM_CONTROL_SIZE_SHIFT 1
268#define BCMA_CC_SROM_CONTROL_PRESENT 0x00000001 269#define BCMA_CC_SROM_CONTROL_PRESENT 0x00000001
270/* Block 0x140 - 0x190 registers are chipset specific */
271#define BCMA_CC_4706_FLASHSCFG 0x18C /* Flash struct configuration */
272#define BCMA_CC_4706_FLASHSCFG_MASK 0x000000ff
273#define BCMA_CC_4706_FLASHSCFG_SF1 0x00000001 /* 2nd serial flash present */
274#define BCMA_CC_4706_FLASHSCFG_PF1 0x00000002 /* 2nd parallel flash present */
275#define BCMA_CC_4706_FLASHSCFG_SF1_TYPE 0x00000004 /* 2nd serial flash type : 0 : ST, 1 : Atmel */
276#define BCMA_CC_4706_FLASHSCFG_NF1 0x00000008 /* 2nd NAND flash present */
277#define BCMA_CC_4706_FLASHSCFG_1ST_MADDR_SEG_MASK 0x000000f0
278#define BCMA_CC_4706_FLASHSCFG_1ST_MADDR_SEG_4MB 0x00000010 /* 4MB */
279#define BCMA_CC_4706_FLASHSCFG_1ST_MADDR_SEG_8MB 0x00000020 /* 8MB */
280#define BCMA_CC_4706_FLASHSCFG_1ST_MADDR_SEG_16MB 0x00000030 /* 16MB */
281#define BCMA_CC_4706_FLASHSCFG_1ST_MADDR_SEG_32MB 0x00000040 /* 32MB */
282#define BCMA_CC_4706_FLASHSCFG_1ST_MADDR_SEG_64MB 0x00000050 /* 64MB */
283#define BCMA_CC_4706_FLASHSCFG_1ST_MADDR_SEG_128MB 0x00000060 /* 128MB */
284#define BCMA_CC_4706_FLASHSCFG_1ST_MADDR_SEG_256MB 0x00000070 /* 256MB */
285/* NAND flash registers for BCM4706 (corerev = 31) */
286#define BCMA_CC_NFLASH_CTL 0x01A0
287#define BCMA_CC_NFLASH_CTL_ERR 0x08000000
288#define BCMA_CC_NFLASH_CONF 0x01A4
289#define BCMA_CC_NFLASH_COL_ADDR 0x01A8
290#define BCMA_CC_NFLASH_ROW_ADDR 0x01AC
291#define BCMA_CC_NFLASH_DATA 0x01B0
292#define BCMA_CC_NFLASH_WAITCNT0 0x01B4
269/* 0x1E0 is defined as shared BCMA_CLKCTLST */ 293/* 0x1E0 is defined as shared BCMA_CLKCTLST */
270#define BCMA_CC_HW_WORKAROUND 0x01E4 /* Hardware workaround (rev >= 20) */ 294#define BCMA_CC_HW_WORKAROUND 0x01E4 /* Hardware workaround (rev >= 20) */
271#define BCMA_CC_UART0_DATA 0x0300 295#define BCMA_CC_UART0_DATA 0x0300
@@ -325,6 +349,60 @@
325#define BCMA_CC_PLLCTL_ADDR 0x0660 349#define BCMA_CC_PLLCTL_ADDR 0x0660
326#define BCMA_CC_PLLCTL_DATA 0x0664 350#define BCMA_CC_PLLCTL_DATA 0x0664
327#define BCMA_CC_SPROM 0x0800 /* SPROM beginning */ 351#define BCMA_CC_SPROM 0x0800 /* SPROM beginning */
352/* NAND flash MLC controller registers (corerev >= 38) */
353#define BCMA_CC_NAND_REVISION 0x0C00
354#define BCMA_CC_NAND_CMD_START 0x0C04
355#define BCMA_CC_NAND_CMD_ADDR_X 0x0C08
356#define BCMA_CC_NAND_CMD_ADDR 0x0C0C
357#define BCMA_CC_NAND_CMD_END_ADDR 0x0C10
358#define BCMA_CC_NAND_CS_NAND_SELECT 0x0C14
359#define BCMA_CC_NAND_CS_NAND_XOR 0x0C18
360#define BCMA_CC_NAND_SPARE_RD0 0x0C20
361#define BCMA_CC_NAND_SPARE_RD4 0x0C24
362#define BCMA_CC_NAND_SPARE_RD8 0x0C28
363#define BCMA_CC_NAND_SPARE_RD12 0x0C2C
364#define BCMA_CC_NAND_SPARE_WR0 0x0C30
365#define BCMA_CC_NAND_SPARE_WR4 0x0C34
366#define BCMA_CC_NAND_SPARE_WR8 0x0C38
367#define BCMA_CC_NAND_SPARE_WR12 0x0C3C
368#define BCMA_CC_NAND_ACC_CONTROL 0x0C40
369#define BCMA_CC_NAND_CONFIG 0x0C48
370#define BCMA_CC_NAND_TIMING_1 0x0C50
371#define BCMA_CC_NAND_TIMING_2 0x0C54
372#define BCMA_CC_NAND_SEMAPHORE 0x0C58
373#define BCMA_CC_NAND_DEVID 0x0C60
374#define BCMA_CC_NAND_DEVID_X 0x0C64
375#define BCMA_CC_NAND_BLOCK_LOCK_STATUS 0x0C68
376#define BCMA_CC_NAND_INTFC_STATUS 0x0C6C
377#define BCMA_CC_NAND_ECC_CORR_ADDR_X 0x0C70
378#define BCMA_CC_NAND_ECC_CORR_ADDR 0x0C74
379#define BCMA_CC_NAND_ECC_UNC_ADDR_X 0x0C78
380#define BCMA_CC_NAND_ECC_UNC_ADDR 0x0C7C
381#define BCMA_CC_NAND_READ_ERROR_COUNT 0x0C80
382#define BCMA_CC_NAND_CORR_STAT_THRESHOLD 0x0C84
383#define BCMA_CC_NAND_READ_ADDR_X 0x0C90
384#define BCMA_CC_NAND_READ_ADDR 0x0C94
385#define BCMA_CC_NAND_PAGE_PROGRAM_ADDR_X 0x0C98
386#define BCMA_CC_NAND_PAGE_PROGRAM_ADDR 0x0C9C
387#define BCMA_CC_NAND_COPY_BACK_ADDR_X 0x0CA0
388#define BCMA_CC_NAND_COPY_BACK_ADDR 0x0CA4
389#define BCMA_CC_NAND_BLOCK_ERASE_ADDR_X 0x0CA8
390#define BCMA_CC_NAND_BLOCK_ERASE_ADDR 0x0CAC
391#define BCMA_CC_NAND_INV_READ_ADDR_X 0x0CB0
392#define BCMA_CC_NAND_INV_READ_ADDR 0x0CB4
393#define BCMA_CC_NAND_BLK_WR_PROTECT 0x0CC0
394#define BCMA_CC_NAND_ACC_CONTROL_CS1 0x0CD0
395#define BCMA_CC_NAND_CONFIG_CS1 0x0CD4
396#define BCMA_CC_NAND_TIMING_1_CS1 0x0CD8
397#define BCMA_CC_NAND_TIMING_2_CS1 0x0CDC
398#define BCMA_CC_NAND_SPARE_RD16 0x0D30
399#define BCMA_CC_NAND_SPARE_RD20 0x0D34
400#define BCMA_CC_NAND_SPARE_RD24 0x0D38
401#define BCMA_CC_NAND_SPARE_RD28 0x0D3C
402#define BCMA_CC_NAND_CACHE_ADDR 0x0D40
403#define BCMA_CC_NAND_CACHE_DATA 0x0D44
404#define BCMA_CC_NAND_CTRL_CONFIG 0x0D48
405#define BCMA_CC_NAND_CTRL_STATUS 0x0D4C
328 406
329/* Divider allocation in 4716/47162/5356 */ 407/* Divider allocation in 4716/47162/5356 */
330#define BCMA_CC_PMU5_MAINPLL_CPU 1 408#define BCMA_CC_PMU5_MAINPLL_CPU 1
@@ -415,6 +493,13 @@
415/* 4313 Chip specific ChipControl register bits */ 493/* 4313 Chip specific ChipControl register bits */
416#define BCMA_CCTRL_4313_12MA_LED_DRIVE 0x00000007 /* 12 mA drive strengh for later 4313 */ 494#define BCMA_CCTRL_4313_12MA_LED_DRIVE 0x00000007 /* 12 mA drive strengh for later 4313 */
417 495
496/* BCM5357 ChipControl register bits */
497#define BCMA_CHIPCTL_5357_EXTPA BIT(14)
498#define BCMA_CHIPCTL_5357_ANT_MUX_2O3 BIT(15)
499#define BCMA_CHIPCTL_5357_NFLASH BIT(16)
500#define BCMA_CHIPCTL_5357_I2S_PINS_ENABLE BIT(18)
501#define BCMA_CHIPCTL_5357_I2CSPI_PINS_ENABLE BIT(19)
502
418/* Data for the PMU, if available. 503/* Data for the PMU, if available.
419 * Check availability with ((struct bcma_chipcommon)->capabilities & BCMA_CC_CAP_PMU) 504 * Check availability with ((struct bcma_chipcommon)->capabilities & BCMA_CC_CAP_PMU)
420 */ 505 */
diff --git a/include/linux/bcma/bcma_regs.h b/include/linux/bcma/bcma_regs.h
index 5a71d5719640..a393e82bf7bf 100644
--- a/include/linux/bcma/bcma_regs.h
+++ b/include/linux/bcma/bcma_regs.h
@@ -11,11 +11,13 @@
11#define BCMA_CLKCTLST_HAVEHTREQ 0x00000010 /* HT available request */ 11#define BCMA_CLKCTLST_HAVEHTREQ 0x00000010 /* HT available request */
12#define BCMA_CLKCTLST_HWCROFF 0x00000020 /* Force HW clock request off */ 12#define BCMA_CLKCTLST_HWCROFF 0x00000020 /* Force HW clock request off */
13#define BCMA_CLKCTLST_EXTRESREQ 0x00000700 /* Mask of external resource requests */ 13#define BCMA_CLKCTLST_EXTRESREQ 0x00000700 /* Mask of external resource requests */
14#define BCMA_CLKCTLST_EXTRESREQ_SHIFT 8
14#define BCMA_CLKCTLST_HAVEALP 0x00010000 /* ALP available */ 15#define BCMA_CLKCTLST_HAVEALP 0x00010000 /* ALP available */
15#define BCMA_CLKCTLST_HAVEHT 0x00020000 /* HT available */ 16#define BCMA_CLKCTLST_HAVEHT 0x00020000 /* HT available */
16#define BCMA_CLKCTLST_BP_ON_ALP 0x00040000 /* RO: running on ALP clock */ 17#define BCMA_CLKCTLST_BP_ON_ALP 0x00040000 /* RO: running on ALP clock */
17#define BCMA_CLKCTLST_BP_ON_HT 0x00080000 /* RO: running on HT clock */ 18#define BCMA_CLKCTLST_BP_ON_HT 0x00080000 /* RO: running on HT clock */
18#define BCMA_CLKCTLST_EXTRESST 0x07000000 /* Mask of external resource status */ 19#define BCMA_CLKCTLST_EXTRESST 0x07000000 /* Mask of external resource status */
20#define BCMA_CLKCTLST_EXTRESST_SHIFT 24
19/* Is there any BCM4328 on BCMA bus? */ 21/* Is there any BCM4328 on BCMA bus? */
20#define BCMA_CLKCTLST_4328A0_HAVEHT 0x00010000 /* 4328a0 has reversed bits */ 22#define BCMA_CLKCTLST_4328A0_HAVEHT 0x00010000 /* 4328a0 has reversed bits */
21#define BCMA_CLKCTLST_4328A0_HAVEALP 0x00020000 /* 4328a0 has reversed bits */ 23#define BCMA_CLKCTLST_4328A0_HAVEALP 0x00020000 /* 4328a0 has reversed bits */
diff --git a/include/linux/hash.h b/include/linux/hash.h
index b80506bdd733..24df9e70406f 100644
--- a/include/linux/hash.h
+++ b/include/linux/hash.h
@@ -67,4 +67,14 @@ static inline unsigned long hash_ptr(const void *ptr, unsigned int bits)
67{ 67{
68 return hash_long((unsigned long)ptr, bits); 68 return hash_long((unsigned long)ptr, bits);
69} 69}
70
71static inline u32 hash32_ptr(const void *ptr)
72{
73 unsigned long val = (unsigned long)ptr;
74
75#if BITS_PER_LONG == 64
76 val ^= (val >> 32);
77#endif
78 return (u32)val;
79}
70#endif /* _LINUX_HASH_H */ 80#endif /* _LINUX_HASH_H */
diff --git a/include/linux/if_arp.h b/include/linux/if_arp.h
index f0e69c6e8208..9adcc29f084a 100644
--- a/include/linux/if_arp.h
+++ b/include/linux/if_arp.h
@@ -92,6 +92,7 @@
92#define ARPHRD_PHONET 820 /* PhoNet media type */ 92#define ARPHRD_PHONET 820 /* PhoNet media type */
93#define ARPHRD_PHONET_PIPE 821 /* PhoNet pipe header */ 93#define ARPHRD_PHONET_PIPE 821 /* PhoNet pipe header */
94#define ARPHRD_CAIF 822 /* CAIF media type */ 94#define ARPHRD_CAIF 822 /* CAIF media type */
95#define ARPHRD_IP6GRE 823 /* GRE over IPv6 */
95 96
96#define ARPHRD_VOID 0xFFFF /* Void type, nothing is known */ 97#define ARPHRD_VOID 0xFFFF /* Void type, nothing is known */
97#define ARPHRD_NONE 0xFFFE /* zero header length */ 98#define ARPHRD_NONE 0xFFFE /* zero header length */
diff --git a/include/linux/if_team.h b/include/linux/if_team.h
index aa2e167e1ef4..6d88a7f57680 100644
--- a/include/linux/if_team.h
+++ b/include/linux/if_team.h
@@ -67,6 +67,9 @@ struct team_port {
67 struct netpoll *np; 67 struct netpoll *np;
68#endif 68#endif
69 69
70 s32 priority; /* lower number ~ higher priority */
71 u16 queue_id;
72 struct list_head qom_list; /* node in queue override mapping list */
70 long mode_priv[0]; 73 long mode_priv[0];
71}; 74};
72 75
@@ -105,7 +108,7 @@ struct team_mode_ops {
105 bool (*transmit)(struct team *team, struct sk_buff *skb); 108 bool (*transmit)(struct team *team, struct sk_buff *skb);
106 int (*port_enter)(struct team *team, struct team_port *port); 109 int (*port_enter)(struct team *team, struct team_port *port);
107 void (*port_leave)(struct team *team, struct team_port *port); 110 void (*port_leave)(struct team *team, struct team_port *port);
108 void (*port_change_mac)(struct team *team, struct team_port *port); 111 void (*port_change_dev_addr)(struct team *team, struct team_port *port);
109 void (*port_enabled)(struct team *team, struct team_port *port); 112 void (*port_enabled)(struct team *team, struct team_port *port);
110 void (*port_disabled)(struct team *team, struct team_port *port); 113 void (*port_disabled)(struct team *team, struct team_port *port);
111}; 114};
@@ -115,6 +118,7 @@ enum team_option_type {
115 TEAM_OPTION_TYPE_STRING, 118 TEAM_OPTION_TYPE_STRING,
116 TEAM_OPTION_TYPE_BINARY, 119 TEAM_OPTION_TYPE_BINARY,
117 TEAM_OPTION_TYPE_BOOL, 120 TEAM_OPTION_TYPE_BOOL,
121 TEAM_OPTION_TYPE_S32,
118}; 122};
119 123
120struct team_option_inst_info { 124struct team_option_inst_info {
@@ -131,6 +135,7 @@ struct team_gsetter_ctx {
131 u32 len; 135 u32 len;
132 } bin_val; 136 } bin_val;
133 bool bool_val; 137 bool bool_val;
138 s32 s32_val;
134 } data; 139 } data;
135 struct team_option_inst_info *info; 140 struct team_option_inst_info *info;
136}; 141};
@@ -182,6 +187,8 @@ struct team {
182 187
183 const struct team_mode *mode; 188 const struct team_mode *mode;
184 struct team_mode_ops ops; 189 struct team_mode_ops ops;
190 bool queue_override_enabled;
191 struct list_head *qom_lists; /* array of queue override mapping lists */
185 long mode_priv[TEAM_MODE_PRIV_LONGS]; 192 long mode_priv[TEAM_MODE_PRIV_LONGS];
186}; 193};
187 194
@@ -231,7 +238,7 @@ static inline struct team_port *team_get_port_by_index_rcu(struct team *team,
231 return NULL; 238 return NULL;
232} 239}
233 240
234extern int team_port_set_team_mac(struct team_port *port); 241extern int team_port_set_team_dev_addr(struct team_port *port);
235extern int team_options_register(struct team *team, 242extern int team_options_register(struct team *team,
236 const struct team_option *option, 243 const struct team_option *option,
237 size_t option_count); 244 size_t option_count);
diff --git a/include/linux/if_tunnel.h b/include/linux/if_tunnel.h
index 5efff60b6f56..8c5035ac3142 100644
--- a/include/linux/if_tunnel.h
+++ b/include/linux/if_tunnel.h
@@ -75,6 +75,9 @@ enum {
75 IFLA_GRE_TTL, 75 IFLA_GRE_TTL,
76 IFLA_GRE_TOS, 76 IFLA_GRE_TOS,
77 IFLA_GRE_PMTUDISC, 77 IFLA_GRE_PMTUDISC,
78 IFLA_GRE_ENCAP_LIMIT,
79 IFLA_GRE_FLOWINFO,
80 IFLA_GRE_FLAGS,
78 __IFLA_GRE_MAX, 81 __IFLA_GRE_MAX,
79}; 82};
80 83
diff --git a/include/linux/inetdevice.h b/include/linux/inetdevice.h
index 67f9ddacb70c..d032780d0ce5 100644
--- a/include/linux/inetdevice.h
+++ b/include/linux/inetdevice.h
@@ -104,9 +104,14 @@ static inline void ipv4_devconf_setall(struct in_device *in_dev)
104#define IN_DEV_ANDCONF(in_dev, attr) \ 104#define IN_DEV_ANDCONF(in_dev, attr) \
105 (IPV4_DEVCONF_ALL(dev_net(in_dev->dev), attr) && \ 105 (IPV4_DEVCONF_ALL(dev_net(in_dev->dev), attr) && \
106 IN_DEV_CONF_GET((in_dev), attr)) 106 IN_DEV_CONF_GET((in_dev), attr))
107#define IN_DEV_ORCONF(in_dev, attr) \ 107
108 (IPV4_DEVCONF_ALL(dev_net(in_dev->dev), attr) || \ 108#define IN_DEV_NET_ORCONF(in_dev, net, attr) \
109 (IPV4_DEVCONF_ALL(net, attr) || \
109 IN_DEV_CONF_GET((in_dev), attr)) 110 IN_DEV_CONF_GET((in_dev), attr))
111
112#define IN_DEV_ORCONF(in_dev, attr) \
113 IN_DEV_NET_ORCONF(in_dev, dev_net(in_dev->dev), attr)
114
110#define IN_DEV_MAXCONF(in_dev, attr) \ 115#define IN_DEV_MAXCONF(in_dev, attr) \
111 (max(IPV4_DEVCONF_ALL(dev_net(in_dev->dev), attr), \ 116 (max(IPV4_DEVCONF_ALL(dev_net(in_dev->dev), attr), \
112 IN_DEV_CONF_GET((in_dev), attr))) 117 IN_DEV_CONF_GET((in_dev), attr)))
@@ -133,6 +138,8 @@ static inline void ipv4_devconf_setall(struct in_device *in_dev)
133 IN_DEV_ORCONF((in_dev), \ 138 IN_DEV_ORCONF((in_dev), \
134 PROMOTE_SECONDARIES) 139 PROMOTE_SECONDARIES)
135#define IN_DEV_ROUTE_LOCALNET(in_dev) IN_DEV_ORCONF(in_dev, ROUTE_LOCALNET) 140#define IN_DEV_ROUTE_LOCALNET(in_dev) IN_DEV_ORCONF(in_dev, ROUTE_LOCALNET)
141#define IN_DEV_NET_ROUTE_LOCALNET(in_dev, net) \
142 IN_DEV_NET_ORCONF(in_dev, net, ROUTE_LOCALNET)
136 143
137#define IN_DEV_RX_REDIRECTS(in_dev) \ 144#define IN_DEV_RX_REDIRECTS(in_dev) \
138 ((IN_DEV_FORWARD(in_dev) && \ 145 ((IN_DEV_FORWARD(in_dev) && \
diff --git a/include/linux/ip6_tunnel.h b/include/linux/ip6_tunnel.h
index bf22b0317902..48af63c9a48d 100644
--- a/include/linux/ip6_tunnel.h
+++ b/include/linux/ip6_tunnel.h
@@ -31,4 +31,21 @@ struct ip6_tnl_parm {
31 struct in6_addr raddr; /* remote tunnel end-point address */ 31 struct in6_addr raddr; /* remote tunnel end-point address */
32}; 32};
33 33
34struct ip6_tnl_parm2 {
35 char name[IFNAMSIZ]; /* name of tunnel device */
36 int link; /* ifindex of underlying L2 interface */
37 __u8 proto; /* tunnel protocol */
38 __u8 encap_limit; /* encapsulation limit for tunnel */
39 __u8 hop_limit; /* hop limit for tunnel */
40 __be32 flowinfo; /* traffic class and flowlabel for tunnel */
41 __u32 flags; /* tunnel flags */
42 struct in6_addr laddr; /* local tunnel end-point address */
43 struct in6_addr raddr; /* remote tunnel end-point address */
44
45 __be16 i_flags;
46 __be16 o_flags;
47 __be32 i_key;
48 __be32 o_key;
49};
50
34#endif 51#endif
diff --git a/include/linux/jiffies.h b/include/linux/jiffies.h
index 82680541576d..05e3c2c7a8cf 100644
--- a/include/linux/jiffies.h
+++ b/include/linux/jiffies.h
@@ -312,7 +312,13 @@ extern void jiffies_to_timespec(const unsigned long jiffies,
312extern unsigned long timeval_to_jiffies(const struct timeval *value); 312extern unsigned long timeval_to_jiffies(const struct timeval *value);
313extern void jiffies_to_timeval(const unsigned long jiffies, 313extern void jiffies_to_timeval(const unsigned long jiffies,
314 struct timeval *value); 314 struct timeval *value);
315
315extern clock_t jiffies_to_clock_t(unsigned long x); 316extern clock_t jiffies_to_clock_t(unsigned long x);
317static inline clock_t jiffies_delta_to_clock_t(long delta)
318{
319 return jiffies_to_clock_t(max(0L, delta));
320}
321
316extern unsigned long clock_t_to_jiffies(unsigned long x); 322extern unsigned long clock_t_to_jiffies(unsigned long x);
317extern u64 jiffies_64_to_clock_t(u64 x); 323extern u64 jiffies_64_to_clock_t(u64 x);
318extern u64 nsec_to_clock_t(u64 x); 324extern u64 nsec_to_clock_t(u64 x);
diff --git a/include/linux/netdevice.h b/include/linux/netdevice.h
index 59dc05f38247..4936f09a9333 100644
--- a/include/linux/netdevice.h
+++ b/include/linux/netdevice.h
@@ -2249,8 +2249,6 @@ extern void netif_carrier_on(struct net_device *dev);
2249 2249
2250extern void netif_carrier_off(struct net_device *dev); 2250extern void netif_carrier_off(struct net_device *dev);
2251 2251
2252extern void netif_notify_peers(struct net_device *dev);
2253
2254/** 2252/**
2255 * netif_dormant_on - mark device as dormant. 2253 * netif_dormant_on - mark device as dormant.
2256 * @dev: network device 2254 * @dev: network device
@@ -2599,8 +2597,7 @@ extern void __dev_set_rx_mode(struct net_device *dev);
2599extern int dev_set_promiscuity(struct net_device *dev, int inc); 2597extern int dev_set_promiscuity(struct net_device *dev, int inc);
2600extern int dev_set_allmulti(struct net_device *dev, int inc); 2598extern int dev_set_allmulti(struct net_device *dev, int inc);
2601extern void netdev_state_change(struct net_device *dev); 2599extern void netdev_state_change(struct net_device *dev);
2602extern int netdev_bonding_change(struct net_device *dev, 2600extern void netdev_notify_peers(struct net_device *dev);
2603 unsigned long event);
2604extern void netdev_features_change(struct net_device *dev); 2601extern void netdev_features_change(struct net_device *dev);
2605/* Load a device via the kmod */ 2602/* Load a device via the kmod */
2606extern void dev_load(struct net *net, const char *name); 2603extern void dev_load(struct net *net, const char *name);
diff --git a/include/linux/packet_diag.h b/include/linux/packet_diag.h
new file mode 100644
index 000000000000..93f5fa94a431
--- /dev/null
+++ b/include/linux/packet_diag.h
@@ -0,0 +1,72 @@
1#ifndef __PACKET_DIAG_H__
2#define __PACKET_DIAG_H__
3
4#include <linux/types.h>
5
6struct packet_diag_req {
7 __u8 sdiag_family;
8 __u8 sdiag_protocol;
9 __u16 pad;
10 __u32 pdiag_ino;
11 __u32 pdiag_show;
12 __u32 pdiag_cookie[2];
13};
14
15#define PACKET_SHOW_INFO 0x00000001 /* Basic packet_sk information */
16#define PACKET_SHOW_MCLIST 0x00000002 /* A set of packet_diag_mclist-s */
17#define PACKET_SHOW_RING_CFG 0x00000004 /* Rings configuration parameters */
18#define PACKET_SHOW_FANOUT 0x00000008
19
20struct packet_diag_msg {
21 __u8 pdiag_family;
22 __u8 pdiag_type;
23 __u16 pdiag_num;
24
25 __u32 pdiag_ino;
26 __u32 pdiag_cookie[2];
27};
28
29enum {
30 PACKET_DIAG_INFO,
31 PACKET_DIAG_MCLIST,
32 PACKET_DIAG_RX_RING,
33 PACKET_DIAG_TX_RING,
34 PACKET_DIAG_FANOUT,
35
36 PACKET_DIAG_MAX,
37};
38
39struct packet_diag_info {
40 __u32 pdi_index;
41 __u32 pdi_version;
42 __u32 pdi_reserve;
43 __u32 pdi_copy_thresh;
44 __u32 pdi_tstamp;
45 __u32 pdi_flags;
46
47#define PDI_RUNNING 0x1
48#define PDI_AUXDATA 0x2
49#define PDI_ORIGDEV 0x4
50#define PDI_VNETHDR 0x8
51#define PDI_LOSS 0x10
52};
53
54struct packet_diag_mclist {
55 __u32 pdmc_index;
56 __u32 pdmc_count;
57 __u16 pdmc_type;
58 __u16 pdmc_alen;
59 __u8 pdmc_addr[MAX_ADDR_LEN];
60};
61
62struct packet_diag_ring {
63 __u32 pdr_block_size;
64 __u32 pdr_block_nr;
65 __u32 pdr_frame_size;
66 __u32 pdr_frame_nr;
67 __u32 pdr_retire_tmo;
68 __u32 pdr_sizeof_priv;
69 __u32 pdr_features;
70};
71
72#endif
diff --git a/include/linux/skbuff.h b/include/linux/skbuff.h
index 7632c87da2c9..b33a3a1f205e 100644
--- a/include/linux/skbuff.h
+++ b/include/linux/skbuff.h
@@ -846,13 +846,16 @@ static inline int skb_shared(const struct sk_buff *skb)
846 * 846 *
847 * NULL is returned on a memory allocation failure. 847 * NULL is returned on a memory allocation failure.
848 */ 848 */
849static inline struct sk_buff *skb_share_check(struct sk_buff *skb, 849static inline struct sk_buff *skb_share_check(struct sk_buff *skb, gfp_t pri)
850 gfp_t pri)
851{ 850{
852 might_sleep_if(pri & __GFP_WAIT); 851 might_sleep_if(pri & __GFP_WAIT);
853 if (skb_shared(skb)) { 852 if (skb_shared(skb)) {
854 struct sk_buff *nskb = skb_clone(skb, pri); 853 struct sk_buff *nskb = skb_clone(skb, pri);
855 kfree_skb(skb); 854
855 if (likely(nskb))
856 consume_skb(skb);
857 else
858 kfree_skb(skb);
856 skb = nskb; 859 skb = nskb;
857 } 860 }
858 return skb; 861 return skb;
diff --git a/include/linux/snmp.h b/include/linux/snmp.h
index 00bc189cb395..ad6e3a6bf9fb 100644
--- a/include/linux/snmp.h
+++ b/include/linux/snmp.h
@@ -18,7 +18,14 @@
18enum 18enum
19{ 19{
20 IPSTATS_MIB_NUM = 0, 20 IPSTATS_MIB_NUM = 0,
21/* frequently written fields in fast path, kept in same cache line */
21 IPSTATS_MIB_INPKTS, /* InReceives */ 22 IPSTATS_MIB_INPKTS, /* InReceives */
23 IPSTATS_MIB_INOCTETS, /* InOctets */
24 IPSTATS_MIB_INDELIVERS, /* InDelivers */
25 IPSTATS_MIB_OUTFORWDATAGRAMS, /* OutForwDatagrams */
26 IPSTATS_MIB_OUTPKTS, /* OutRequests */
27 IPSTATS_MIB_OUTOCTETS, /* OutOctets */
28/* other fields */
22 IPSTATS_MIB_INHDRERRORS, /* InHdrErrors */ 29 IPSTATS_MIB_INHDRERRORS, /* InHdrErrors */
23 IPSTATS_MIB_INTOOBIGERRORS, /* InTooBigErrors */ 30 IPSTATS_MIB_INTOOBIGERRORS, /* InTooBigErrors */
24 IPSTATS_MIB_INNOROUTES, /* InNoRoutes */ 31 IPSTATS_MIB_INNOROUTES, /* InNoRoutes */
@@ -26,9 +33,6 @@ enum
26 IPSTATS_MIB_INUNKNOWNPROTOS, /* InUnknownProtos */ 33 IPSTATS_MIB_INUNKNOWNPROTOS, /* InUnknownProtos */
27 IPSTATS_MIB_INTRUNCATEDPKTS, /* InTruncatedPkts */ 34 IPSTATS_MIB_INTRUNCATEDPKTS, /* InTruncatedPkts */
28 IPSTATS_MIB_INDISCARDS, /* InDiscards */ 35 IPSTATS_MIB_INDISCARDS, /* InDiscards */
29 IPSTATS_MIB_INDELIVERS, /* InDelivers */
30 IPSTATS_MIB_OUTFORWDATAGRAMS, /* OutForwDatagrams */
31 IPSTATS_MIB_OUTPKTS, /* OutRequests */
32 IPSTATS_MIB_OUTDISCARDS, /* OutDiscards */ 36 IPSTATS_MIB_OUTDISCARDS, /* OutDiscards */
33 IPSTATS_MIB_OUTNOROUTES, /* OutNoRoutes */ 37 IPSTATS_MIB_OUTNOROUTES, /* OutNoRoutes */
34 IPSTATS_MIB_REASMTIMEOUT, /* ReasmTimeout */ 38 IPSTATS_MIB_REASMTIMEOUT, /* ReasmTimeout */
@@ -42,8 +46,6 @@ enum
42 IPSTATS_MIB_OUTMCASTPKTS, /* OutMcastPkts */ 46 IPSTATS_MIB_OUTMCASTPKTS, /* OutMcastPkts */
43 IPSTATS_MIB_INBCASTPKTS, /* InBcastPkts */ 47 IPSTATS_MIB_INBCASTPKTS, /* InBcastPkts */
44 IPSTATS_MIB_OUTBCASTPKTS, /* OutBcastPkts */ 48 IPSTATS_MIB_OUTBCASTPKTS, /* OutBcastPkts */
45 IPSTATS_MIB_INOCTETS, /* InOctets */
46 IPSTATS_MIB_OUTOCTETS, /* OutOctets */
47 IPSTATS_MIB_INMCASTOCTETS, /* InMcastOctets */ 49 IPSTATS_MIB_INMCASTOCTETS, /* InMcastOctets */
48 IPSTATS_MIB_OUTMCASTOCTETS, /* OutMcastOctets */ 50 IPSTATS_MIB_OUTMCASTOCTETS, /* OutMcastOctets */
49 IPSTATS_MIB_INBCASTOCTETS, /* InBcastOctets */ 51 IPSTATS_MIB_INBCASTOCTETS, /* InBcastOctets */
diff --git a/include/linux/ssb/ssb_driver_chipcommon.h b/include/linux/ssb/ssb_driver_chipcommon.h
index 1a6b0045b06b..c2b02a5c86ae 100644
--- a/include/linux/ssb/ssb_driver_chipcommon.h
+++ b/include/linux/ssb/ssb_driver_chipcommon.h
@@ -504,7 +504,9 @@
504#define SSB_CHIPCO_FLASHCTL_ST_SE 0x02D8 /* Sector Erase */ 504#define SSB_CHIPCO_FLASHCTL_ST_SE 0x02D8 /* Sector Erase */
505#define SSB_CHIPCO_FLASHCTL_ST_BE 0x00C7 /* Bulk Erase */ 505#define SSB_CHIPCO_FLASHCTL_ST_BE 0x00C7 /* Bulk Erase */
506#define SSB_CHIPCO_FLASHCTL_ST_DP 0x00B9 /* Deep Power-down */ 506#define SSB_CHIPCO_FLASHCTL_ST_DP 0x00B9 /* Deep Power-down */
507#define SSB_CHIPCO_FLASHCTL_ST_RSIG 0x03AB /* Read Electronic Signature */ 507#define SSB_CHIPCO_FLASHCTL_ST_RES 0x03AB /* Read Electronic Signature */
508#define SSB_CHIPCO_FLASHCTL_ST_CSA 0x1000 /* Keep chip select asserted */
509#define SSB_CHIPCO_FLASHCTL_ST_SSE 0x0220 /* Sub-sector Erase */
508 510
509/* Status register bits for ST flashes */ 511/* Status register bits for ST flashes */
510#define SSB_CHIPCO_FLASHSTA_ST_WIP 0x01 /* Write In Progress */ 512#define SSB_CHIPCO_FLASHSTA_ST_WIP 0x01 /* Write In Progress */
diff --git a/include/linux/tipc_config.h b/include/linux/tipc_config.h
index c98928420100..0b1e3f218a36 100644
--- a/include/linux/tipc_config.h
+++ b/include/linux/tipc_config.h
@@ -89,8 +89,8 @@
89 89
90#define TIPC_CMD_GET_REMOTE_MNG 0x4003 /* tx none, rx unsigned */ 90#define TIPC_CMD_GET_REMOTE_MNG 0x4003 /* tx none, rx unsigned */
91#define TIPC_CMD_GET_MAX_PORTS 0x4004 /* tx none, rx unsigned */ 91#define TIPC_CMD_GET_MAX_PORTS 0x4004 /* tx none, rx unsigned */
92#define TIPC_CMD_GET_MAX_PUBL 0x4005 /* tx none, rx unsigned */ 92#define TIPC_CMD_GET_MAX_PUBL 0x4005 /* obsoleted */
93#define TIPC_CMD_GET_MAX_SUBSCR 0x4006 /* tx none, rx unsigned */ 93#define TIPC_CMD_GET_MAX_SUBSCR 0x4006 /* obsoleted */
94#define TIPC_CMD_GET_MAX_ZONES 0x4007 /* obsoleted */ 94#define TIPC_CMD_GET_MAX_ZONES 0x4007 /* obsoleted */
95#define TIPC_CMD_GET_MAX_CLUSTERS 0x4008 /* obsoleted */ 95#define TIPC_CMD_GET_MAX_CLUSTERS 0x4008 /* obsoleted */
96#define TIPC_CMD_GET_MAX_NODES 0x4009 /* obsoleted */ 96#define TIPC_CMD_GET_MAX_NODES 0x4009 /* obsoleted */
@@ -115,8 +115,8 @@
115#define TIPC_CMD_SET_NODE_ADDR 0x8001 /* tx net_addr, rx none */ 115#define TIPC_CMD_SET_NODE_ADDR 0x8001 /* tx net_addr, rx none */
116#define TIPC_CMD_SET_REMOTE_MNG 0x8003 /* tx unsigned, rx none */ 116#define TIPC_CMD_SET_REMOTE_MNG 0x8003 /* tx unsigned, rx none */
117#define TIPC_CMD_SET_MAX_PORTS 0x8004 /* tx unsigned, rx none */ 117#define TIPC_CMD_SET_MAX_PORTS 0x8004 /* tx unsigned, rx none */
118#define TIPC_CMD_SET_MAX_PUBL 0x8005 /* tx unsigned, rx none */ 118#define TIPC_CMD_SET_MAX_PUBL 0x8005 /* obsoleted */
119#define TIPC_CMD_SET_MAX_SUBSCR 0x8006 /* tx unsigned, rx none */ 119#define TIPC_CMD_SET_MAX_SUBSCR 0x8006 /* obsoleted */
120#define TIPC_CMD_SET_MAX_ZONES 0x8007 /* obsoleted */ 120#define TIPC_CMD_SET_MAX_ZONES 0x8007 /* obsoleted */
121#define TIPC_CMD_SET_MAX_CLUSTERS 0x8008 /* obsoleted */ 121#define TIPC_CMD_SET_MAX_CLUSTERS 0x8008 /* obsoleted */
122#define TIPC_CMD_SET_MAX_NODES 0x8009 /* obsoleted */ 122#define TIPC_CMD_SET_MAX_NODES 0x8009 /* obsoleted */
diff --git a/include/net/arp.h b/include/net/arp.h
index 7f7df93f37cd..b630dae03411 100644
--- a/include/net/arp.h
+++ b/include/net/arp.h
@@ -3,6 +3,7 @@
3#define _ARP_H 3#define _ARP_H
4 4
5#include <linux/if_arp.h> 5#include <linux/if_arp.h>
6#include <linux/hash.h>
6#include <net/neighbour.h> 7#include <net/neighbour.h>
7 8
8 9
@@ -10,7 +11,7 @@ extern struct neigh_table arp_tbl;
10 11
11static inline u32 arp_hashfn(u32 key, const struct net_device *dev, u32 hash_rnd) 12static inline u32 arp_hashfn(u32 key, const struct net_device *dev, u32 hash_rnd)
12{ 13{
13 u32 val = key ^ dev->ifindex; 14 u32 val = key ^ hash32_ptr(dev);
14 15
15 return val * hash_rnd; 16 return val * hash_rnd;
16} 17}
diff --git a/include/net/bluetooth/bluetooth.h b/include/net/bluetooth/bluetooth.h
index 565d4bee1e49..ede036977ae8 100644
--- a/include/net/bluetooth/bluetooth.h
+++ b/include/net/bluetooth/bluetooth.h
@@ -27,6 +27,7 @@
27 27
28#include <linux/poll.h> 28#include <linux/poll.h>
29#include <net/sock.h> 29#include <net/sock.h>
30#include <linux/seq_file.h>
30 31
31#ifndef AF_BLUETOOTH 32#ifndef AF_BLUETOOTH
32#define AF_BLUETOOTH 31 33#define AF_BLUETOOTH 31
@@ -202,6 +203,10 @@ enum {
202struct bt_sock_list { 203struct bt_sock_list {
203 struct hlist_head head; 204 struct hlist_head head;
204 rwlock_t lock; 205 rwlock_t lock;
206#ifdef CONFIG_PROC_FS
207 struct file_operations fops;
208 int (* custom_seq_show)(struct seq_file *, void *);
209#endif
205}; 210};
206 211
207int bt_sock_register(int proto, const struct net_proto_family *ops); 212int bt_sock_register(int proto, const struct net_proto_family *ops);
@@ -292,6 +297,11 @@ extern void hci_sock_cleanup(void);
292extern int bt_sysfs_init(void); 297extern int bt_sysfs_init(void);
293extern void bt_sysfs_cleanup(void); 298extern void bt_sysfs_cleanup(void);
294 299
300extern int bt_procfs_init(struct module* module, struct net *net, const char *name,
301 struct bt_sock_list* sk_list,
302 int (* seq_show)(struct seq_file *, void *));
303extern void bt_procfs_cleanup(struct net *net, const char *name);
304
295extern struct dentry *bt_debugfs; 305extern struct dentry *bt_debugfs;
296 306
297int l2cap_init(void); 307int l2cap_init(void);
diff --git a/include/net/bluetooth/hci.h b/include/net/bluetooth/hci.h
index ccd723e0f783..23cf413e2acf 100644
--- a/include/net/bluetooth/hci.h
+++ b/include/net/bluetooth/hci.h
@@ -62,6 +62,15 @@
62/* First BR/EDR Controller shall have ID = 0 */ 62/* First BR/EDR Controller shall have ID = 0 */
63#define HCI_BREDR_ID 0 63#define HCI_BREDR_ID 0
64 64
65/* AMP controller status */
66#define AMP_CTRL_POWERED_DOWN 0x00
67#define AMP_CTRL_BLUETOOTH_ONLY 0x01
68#define AMP_CTRL_NO_CAPACITY 0x02
69#define AMP_CTRL_LOW_CAPACITY 0x03
70#define AMP_CTRL_MEDIUM_CAPACITY 0x04
71#define AMP_CTRL_HIGH_CAPACITY 0x05
72#define AMP_CTRL_FULL_CAPACITY 0x06
73
65/* HCI device quirks */ 74/* HCI device quirks */
66enum { 75enum {
67 HCI_QUIRK_RESET_ON_CLOSE, 76 HCI_QUIRK_RESET_ON_CLOSE,
@@ -1295,6 +1304,8 @@ struct hci_ev_num_comp_blocks {
1295} __packed; 1304} __packed;
1296 1305
1297/* Low energy meta events */ 1306/* Low energy meta events */
1307#define LE_CONN_ROLE_MASTER 0x00
1308
1298#define HCI_EV_LE_CONN_COMPLETE 0x01 1309#define HCI_EV_LE_CONN_COMPLETE 0x01
1299struct hci_ev_le_conn_complete { 1310struct hci_ev_le_conn_complete {
1300 __u8 status; 1311 __u8 status;
diff --git a/include/net/bluetooth/hci_core.h b/include/net/bluetooth/hci_core.h
index 475b8c04ba52..41d943926d2c 100644
--- a/include/net/bluetooth/hci_core.h
+++ b/include/net/bluetooth/hci_core.h
@@ -115,12 +115,6 @@ struct oob_data {
115 u8 randomizer[16]; 115 u8 randomizer[16];
116}; 116};
117 117
118struct adv_entry {
119 struct list_head list;
120 bdaddr_t bdaddr;
121 u8 bdaddr_type;
122};
123
124struct le_scan_params { 118struct le_scan_params {
125 u8 type; 119 u8 type;
126 u16 interval; 120 u16 interval;
@@ -356,16 +350,16 @@ extern rwlock_t hci_cb_list_lock;
356 350
357/* ----- HCI interface to upper protocols ----- */ 351/* ----- HCI interface to upper protocols ----- */
358extern int l2cap_connect_ind(struct hci_dev *hdev, bdaddr_t *bdaddr); 352extern int l2cap_connect_ind(struct hci_dev *hdev, bdaddr_t *bdaddr);
359extern int l2cap_connect_cfm(struct hci_conn *hcon, u8 status); 353extern void l2cap_connect_cfm(struct hci_conn *hcon, u8 status);
360extern int l2cap_disconn_ind(struct hci_conn *hcon); 354extern int l2cap_disconn_ind(struct hci_conn *hcon);
361extern int l2cap_disconn_cfm(struct hci_conn *hcon, u8 reason); 355extern void l2cap_disconn_cfm(struct hci_conn *hcon, u8 reason);
362extern int l2cap_security_cfm(struct hci_conn *hcon, u8 status, u8 encrypt); 356extern int l2cap_security_cfm(struct hci_conn *hcon, u8 status, u8 encrypt);
363extern int l2cap_recv_acldata(struct hci_conn *hcon, struct sk_buff *skb, 357extern int l2cap_recv_acldata(struct hci_conn *hcon, struct sk_buff *skb,
364 u16 flags); 358 u16 flags);
365 359
366extern int sco_connect_ind(struct hci_dev *hdev, bdaddr_t *bdaddr); 360extern int sco_connect_ind(struct hci_dev *hdev, bdaddr_t *bdaddr);
367extern int sco_connect_cfm(struct hci_conn *hcon, __u8 status); 361extern void sco_connect_cfm(struct hci_conn *hcon, __u8 status);
368extern int sco_disconn_cfm(struct hci_conn *hcon, __u8 reason); 362extern void sco_disconn_cfm(struct hci_conn *hcon, __u8 reason);
369extern int sco_recv_scodata(struct hci_conn *hcon, struct sk_buff *skb); 363extern int sco_recv_scodata(struct hci_conn *hcon, struct sk_buff *skb);
370 364
371/* ----- Inquiry cache ----- */ 365/* ----- Inquiry cache ----- */
@@ -587,8 +581,7 @@ void hci_conn_put_device(struct hci_conn *conn);
587 581
588static inline void hci_conn_hold(struct hci_conn *conn) 582static inline void hci_conn_hold(struct hci_conn *conn)
589{ 583{
590 BT_DBG("hcon %p refcnt %d -> %d", conn, atomic_read(&conn->refcnt), 584 BT_DBG("hcon %p orig refcnt %d", conn, atomic_read(&conn->refcnt));
591 atomic_read(&conn->refcnt) + 1);
592 585
593 atomic_inc(&conn->refcnt); 586 atomic_inc(&conn->refcnt);
594 cancel_delayed_work(&conn->disc_work); 587 cancel_delayed_work(&conn->disc_work);
@@ -596,8 +589,7 @@ static inline void hci_conn_hold(struct hci_conn *conn)
596 589
597static inline void hci_conn_put(struct hci_conn *conn) 590static inline void hci_conn_put(struct hci_conn *conn)
598{ 591{
599 BT_DBG("hcon %p refcnt %d -> %d", conn, atomic_read(&conn->refcnt), 592 BT_DBG("hcon %p orig refcnt %d", conn, atomic_read(&conn->refcnt));
600 atomic_read(&conn->refcnt) - 1);
601 593
602 if (atomic_dec_and_test(&conn->refcnt)) { 594 if (atomic_dec_and_test(&conn->refcnt)) {
603 unsigned long timeo; 595 unsigned long timeo;
@@ -1056,7 +1048,7 @@ int mgmt_discovering(struct hci_dev *hdev, u8 discovering);
1056int mgmt_interleaved_discovery(struct hci_dev *hdev); 1048int mgmt_interleaved_discovery(struct hci_dev *hdev);
1057int mgmt_device_blocked(struct hci_dev *hdev, bdaddr_t *bdaddr, u8 type); 1049int mgmt_device_blocked(struct hci_dev *hdev, bdaddr_t *bdaddr, u8 type);
1058int mgmt_device_unblocked(struct hci_dev *hdev, bdaddr_t *bdaddr, u8 type); 1050int mgmt_device_unblocked(struct hci_dev *hdev, bdaddr_t *bdaddr, u8 type);
1059 1051bool mgmt_valid_hdev(struct hci_dev *hdev);
1060int mgmt_new_ltk(struct hci_dev *hdev, struct smp_ltk *key, u8 persistent); 1052int mgmt_new_ltk(struct hci_dev *hdev, struct smp_ltk *key, u8 persistent);
1061 1053
1062/* HCI info for socket */ 1054/* HCI info for socket */
diff --git a/include/net/bluetooth/l2cap.h b/include/net/bluetooth/l2cap.h
index a7679f8913d2..d206296137e2 100644
--- a/include/net/bluetooth/l2cap.h
+++ b/include/net/bluetooth/l2cap.h
@@ -671,20 +671,8 @@ enum {
671 L2CAP_EV_RECV_FRAME, 671 L2CAP_EV_RECV_FRAME,
672}; 672};
673 673
674static inline void l2cap_chan_hold(struct l2cap_chan *c) 674void l2cap_chan_hold(struct l2cap_chan *c);
675{ 675void l2cap_chan_put(struct l2cap_chan *c);
676 BT_DBG("chan %p orig refcnt %d", c, atomic_read(&c->refcnt));
677
678 atomic_inc(&c->refcnt);
679}
680
681static inline void l2cap_chan_put(struct l2cap_chan *c)
682{
683 BT_DBG("chan %p orig refcnt %d", c, atomic_read(&c->refcnt));
684
685 if (atomic_dec_and_test(&c->refcnt))
686 kfree(c);
687}
688 676
689static inline void l2cap_chan_lock(struct l2cap_chan *chan) 677static inline void l2cap_chan_lock(struct l2cap_chan *chan)
690{ 678{
@@ -771,7 +759,6 @@ int l2cap_add_scid(struct l2cap_chan *chan, __u16 scid);
771 759
772struct l2cap_chan *l2cap_chan_create(void); 760struct l2cap_chan *l2cap_chan_create(void);
773void l2cap_chan_close(struct l2cap_chan *chan, int reason); 761void l2cap_chan_close(struct l2cap_chan *chan, int reason);
774void l2cap_chan_destroy(struct l2cap_chan *chan);
775int l2cap_chan_connect(struct l2cap_chan *chan, __le16 psm, u16 cid, 762int l2cap_chan_connect(struct l2cap_chan *chan, __le16 psm, u16 cid,
776 bdaddr_t *dst, u8 dst_type); 763 bdaddr_t *dst, u8 dst_type);
777int l2cap_chan_send(struct l2cap_chan *chan, struct msghdr *msg, size_t len, 764int l2cap_chan_send(struct l2cap_chan *chan, struct msghdr *msg, size_t len,
diff --git a/include/net/bluetooth/smp.h b/include/net/bluetooth/smp.h
index ca356a734920..50993a531d45 100644
--- a/include/net/bluetooth/smp.h
+++ b/include/net/bluetooth/smp.h
@@ -108,8 +108,8 @@ struct smp_cmd_security_req {
108#define SMP_CONFIRM_FAILED 0x04 108#define SMP_CONFIRM_FAILED 0x04
109#define SMP_PAIRING_NOTSUPP 0x05 109#define SMP_PAIRING_NOTSUPP 0x05
110#define SMP_ENC_KEY_SIZE 0x06 110#define SMP_ENC_KEY_SIZE 0x06
111#define SMP_CMD_NOTSUPP 0x07 111#define SMP_CMD_NOTSUPP 0x07
112#define SMP_UNSPECIFIED 0x08 112#define SMP_UNSPECIFIED 0x08
113#define SMP_REPEATED_ATTEMPTS 0x09 113#define SMP_REPEATED_ATTEMPTS 0x09
114 114
115#define SMP_MIN_ENC_KEY_SIZE 7 115#define SMP_MIN_ENC_KEY_SIZE 7
@@ -123,8 +123,8 @@ struct smp_chan {
123 struct l2cap_conn *conn; 123 struct l2cap_conn *conn;
124 u8 preq[7]; /* SMP Pairing Request */ 124 u8 preq[7]; /* SMP Pairing Request */
125 u8 prsp[7]; /* SMP Pairing Response */ 125 u8 prsp[7]; /* SMP Pairing Response */
126 u8 prnd[16]; /* SMP Pairing Random (local) */ 126 u8 prnd[16]; /* SMP Pairing Random (local) */
127 u8 rrnd[16]; /* SMP Pairing Random (remote) */ 127 u8 rrnd[16]; /* SMP Pairing Random (remote) */
128 u8 pcnf[16]; /* SMP Pairing Confirm */ 128 u8 pcnf[16]; /* SMP Pairing Confirm */
129 u8 tk[16]; /* SMP Temporary Key */ 129 u8 tk[16]; /* SMP Temporary Key */
130 u8 enc_key_size; 130 u8 enc_key_size;
diff --git a/include/net/dst.h b/include/net/dst.h
index 621e3513ef5e..9a7881066fb3 100644
--- a/include/net/dst.h
+++ b/include/net/dst.h
@@ -396,11 +396,15 @@ static inline void dst_confirm(struct dst_entry *dst)
396static inline int dst_neigh_output(struct dst_entry *dst, struct neighbour *n, 396static inline int dst_neigh_output(struct dst_entry *dst, struct neighbour *n,
397 struct sk_buff *skb) 397 struct sk_buff *skb)
398{ 398{
399 struct hh_cache *hh; 399 const struct hh_cache *hh;
400
401 if (dst->pending_confirm) {
402 unsigned long now = jiffies;
400 403
401 if (unlikely(dst->pending_confirm)) {
402 n->confirmed = jiffies;
403 dst->pending_confirm = 0; 404 dst->pending_confirm = 0;
405 /* avoid dirtying neighbour */
406 if (n->confirmed != now)
407 n->confirmed = now;
404 } 408 }
405 409
406 hh = &n->hh; 410 hh = &n->hh;
diff --git a/include/net/ip6_tunnel.h b/include/net/ip6_tunnel.h
index 358fb86f57eb..e03047f7090b 100644
--- a/include/net/ip6_tunnel.h
+++ b/include/net/ip6_tunnel.h
@@ -5,6 +5,8 @@
5#include <linux/netdevice.h> 5#include <linux/netdevice.h>
6#include <linux/ip6_tunnel.h> 6#include <linux/ip6_tunnel.h>
7 7
8#define IP6TUNNEL_ERR_TIMEO (30*HZ)
9
8/* capable of sending packets */ 10/* capable of sending packets */
9#define IP6_TNL_F_CAP_XMIT 0x10000 11#define IP6_TNL_F_CAP_XMIT 0x10000
10/* capable of receiving packets */ 12/* capable of receiving packets */
@@ -12,15 +14,40 @@
12/* determine capability on a per-packet basis */ 14/* determine capability on a per-packet basis */
13#define IP6_TNL_F_CAP_PER_PACKET 0x40000 15#define IP6_TNL_F_CAP_PER_PACKET 0x40000
14 16
15/* IPv6 tunnel */ 17struct __ip6_tnl_parm {
18 char name[IFNAMSIZ]; /* name of tunnel device */
19 int link; /* ifindex of underlying L2 interface */
20 __u8 proto; /* tunnel protocol */
21 __u8 encap_limit; /* encapsulation limit for tunnel */
22 __u8 hop_limit; /* hop limit for tunnel */
23 __be32 flowinfo; /* traffic class and flowlabel for tunnel */
24 __u32 flags; /* tunnel flags */
25 struct in6_addr laddr; /* local tunnel end-point address */
26 struct in6_addr raddr; /* remote tunnel end-point address */
27
28 __be16 i_flags;
29 __be16 o_flags;
30 __be32 i_key;
31 __be32 o_key;
32};
16 33
34/* IPv6 tunnel */
17struct ip6_tnl { 35struct ip6_tnl {
18 struct ip6_tnl __rcu *next; /* next tunnel in list */ 36 struct ip6_tnl __rcu *next; /* next tunnel in list */
19 struct net_device *dev; /* virtual device associated with tunnel */ 37 struct net_device *dev; /* virtual device associated with tunnel */
20 struct ip6_tnl_parm parms; /* tunnel configuration parameters */ 38 struct __ip6_tnl_parm parms; /* tunnel configuration parameters */
21 struct flowi fl; /* flowi template for xmit */ 39 struct flowi fl; /* flowi template for xmit */
22 struct dst_entry *dst_cache; /* cached dst */ 40 struct dst_entry *dst_cache; /* cached dst */
23 u32 dst_cookie; 41 u32 dst_cookie;
42
43 int err_count;
44 unsigned long err_time;
45
46 /* These fields used only by GRE */
47 __u32 i_seqno; /* The last seen seqno */
48 __u32 o_seqno; /* The last output seqno */
49 int hlen; /* Precalculated GRE header length */
50 int mlink;
24}; 51};
25 52
26/* Tunnel encapsulation limit destination sub-option */ 53/* Tunnel encapsulation limit destination sub-option */
@@ -31,4 +58,14 @@ struct ipv6_tlv_tnl_enc_lim {
31 __u8 encap_limit; /* tunnel encapsulation limit */ 58 __u8 encap_limit; /* tunnel encapsulation limit */
32} __packed; 59} __packed;
33 60
61struct dst_entry *ip6_tnl_dst_check(struct ip6_tnl *t);
62void ip6_tnl_dst_reset(struct ip6_tnl *t);
63void ip6_tnl_dst_store(struct ip6_tnl *t, struct dst_entry *dst);
64int ip6_tnl_rcv_ctl(struct ip6_tnl *t, const struct in6_addr *laddr,
65 const struct in6_addr *raddr);
66int ip6_tnl_xmit_ctl(struct ip6_tnl *t);
67__u16 ip6_tnl_parse_tlv_enc_lim(struct sk_buff *skb, __u8 *raw);
68__u32 ip6_tnl_get_cap(struct ip6_tnl *t, const struct in6_addr *laddr,
69 const struct in6_addr *raddr);
70
34#endif 71#endif
diff --git a/include/net/ipv6.h b/include/net/ipv6.h
index 01c34b363a34..6d01fb00ff2b 100644
--- a/include/net/ipv6.h
+++ b/include/net/ipv6.h
@@ -34,6 +34,7 @@
34#define NEXTHDR_IPV6 41 /* IPv6 in IPv6 */ 34#define NEXTHDR_IPV6 41 /* IPv6 in IPv6 */
35#define NEXTHDR_ROUTING 43 /* Routing header. */ 35#define NEXTHDR_ROUTING 43 /* Routing header. */
36#define NEXTHDR_FRAGMENT 44 /* Fragmentation/reassembly header. */ 36#define NEXTHDR_FRAGMENT 44 /* Fragmentation/reassembly header. */
37#define NEXTHDR_GRE 47 /* GRE header. */
37#define NEXTHDR_ESP 50 /* Encapsulating security payload. */ 38#define NEXTHDR_ESP 50 /* Encapsulating security payload. */
38#define NEXTHDR_AUTH 51 /* Authentication header. */ 39#define NEXTHDR_AUTH 51 /* Authentication header. */
39#define NEXTHDR_ICMP 58 /* ICMP for IPv6. */ 40#define NEXTHDR_ICMP 58 /* ICMP for IPv6. */
diff --git a/include/net/ndisc.h b/include/net/ndisc.h
index 96a3b5c03e37..980d263765cf 100644
--- a/include/net/ndisc.h
+++ b/include/net/ndisc.h
@@ -49,6 +49,7 @@ enum {
49#include <linux/types.h> 49#include <linux/types.h>
50#include <linux/if_arp.h> 50#include <linux/if_arp.h>
51#include <linux/netdevice.h> 51#include <linux/netdevice.h>
52#include <linux/hash.h>
52 53
53#include <net/neighbour.h> 54#include <net/neighbour.h>
54 55
@@ -134,7 +135,7 @@ static inline u32 ndisc_hashfn(const void *pkey, const struct net_device *dev, _
134{ 135{
135 const u32 *p32 = pkey; 136 const u32 *p32 = pkey;
136 137
137 return (((p32[0] ^ dev->ifindex) * hash_rnd[0]) + 138 return (((p32[0] ^ hash32_ptr(dev)) * hash_rnd[0]) +
138 (p32[1] * hash_rnd[1]) + 139 (p32[1] * hash_rnd[1]) +
139 (p32[2] * hash_rnd[2]) + 140 (p32[2] * hash_rnd[2]) +
140 (p32[3] * hash_rnd[3])); 141 (p32[3] * hash_rnd[3]));
diff --git a/include/net/neighbour.h b/include/net/neighbour.h
index 344d8988842a..0dab173e27da 100644
--- a/include/net/neighbour.h
+++ b/include/net/neighbour.h
@@ -334,18 +334,22 @@ static inline int neigh_hh_bridge(struct hh_cache *hh, struct sk_buff *skb)
334} 334}
335#endif 335#endif
336 336
337static inline int neigh_hh_output(struct hh_cache *hh, struct sk_buff *skb) 337static inline int neigh_hh_output(const struct hh_cache *hh, struct sk_buff *skb)
338{ 338{
339 unsigned int seq; 339 unsigned int seq;
340 int hh_len; 340 int hh_len;
341 341
342 do { 342 do {
343 int hh_alen;
344
345 seq = read_seqbegin(&hh->hh_lock); 343 seq = read_seqbegin(&hh->hh_lock);
346 hh_len = hh->hh_len; 344 hh_len = hh->hh_len;
347 hh_alen = HH_DATA_ALIGN(hh_len); 345 if (likely(hh_len <= HH_DATA_MOD)) {
348 memcpy(skb->data - hh_alen, hh->hh_data, hh_alen); 346 /* this is inlined by gcc */
347 memcpy(skb->data - HH_DATA_MOD, hh->hh_data, HH_DATA_MOD);
348 } else {
349 int hh_alen = HH_DATA_ALIGN(hh_len);
350
351 memcpy(skb->data - hh_alen, hh->hh_data, hh_alen);
352 }
349 } while (read_seqretry(&hh->hh_lock, seq)); 353 } while (read_seqretry(&hh->hh_lock, seq));
350 354
351 skb_push(skb, hh_len); 355 skb_push(skb, hh_len);
diff --git a/include/net/net_namespace.h b/include/net/net_namespace.h
index ae1cd6c9ba52..5ae57f1ab755 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/sctp.h>
18#include <net/netns/dccp.h> 19#include <net/netns/dccp.h>
19#include <net/netns/x_tables.h> 20#include <net/netns/x_tables.h>
20#if defined(CONFIG_NF_CONNTRACK) || defined(CONFIG_NF_CONNTRACK_MODULE) 21#if defined(CONFIG_NF_CONNTRACK) || defined(CONFIG_NF_CONNTRACK_MODULE)
@@ -66,6 +67,7 @@ struct net {
66 struct hlist_head *dev_name_head; 67 struct hlist_head *dev_name_head;
67 struct hlist_head *dev_index_head; 68 struct hlist_head *dev_index_head;
68 unsigned int dev_base_seq; /* protected by rtnl_mutex */ 69 unsigned int dev_base_seq; /* protected by rtnl_mutex */
70 int ifindex;
69 71
70 /* core fib_rules */ 72 /* core fib_rules */
71 struct list_head rules_ops; 73 struct list_head rules_ops;
@@ -80,6 +82,9 @@ struct net {
80#if IS_ENABLED(CONFIG_IPV6) 82#if IS_ENABLED(CONFIG_IPV6)
81 struct netns_ipv6 ipv6; 83 struct netns_ipv6 ipv6;
82#endif 84#endif
85#if defined(CONFIG_IP_SCTP) || defined(CONFIG_IP_SCTP_MODULE)
86 struct netns_sctp sctp;
87#endif
83#if defined(CONFIG_IP_DCCP) || defined(CONFIG_IP_DCCP_MODULE) 88#if defined(CONFIG_IP_DCCP) || defined(CONFIG_IP_DCCP_MODULE)
84 struct netns_dccp dccp; 89 struct netns_dccp dccp;
85#endif 90#endif
@@ -104,6 +109,13 @@ struct net {
104 struct sock *diag_nlsk; 109 struct sock *diag_nlsk;
105}; 110};
106 111
112/*
113 * ifindex generation is per-net namespace, and loopback is
114 * always the 1st device in ns (see net_dev_init), thus any
115 * loopback device should get ifindex 1
116 */
117
118#define LOOPBACK_IFINDEX 1
107 119
108#include <linux/seq_file_net.h> 120#include <linux/seq_file_net.h>
109 121
diff --git a/include/net/netlink.h b/include/net/netlink.h
index 785f37a3b44e..09175d5d1fbf 100644
--- a/include/net/netlink.h
+++ b/include/net/netlink.h
@@ -98,6 +98,10 @@
98 * nla_put_u16(skb, type, value) add u16 attribute to skb 98 * nla_put_u16(skb, type, value) add u16 attribute to skb
99 * nla_put_u32(skb, type, value) add u32 attribute to skb 99 * nla_put_u32(skb, type, value) add u32 attribute to skb
100 * nla_put_u64(skb, type, value) add u64 attribute to skb 100 * nla_put_u64(skb, type, value) add u64 attribute to skb
101 * nla_put_s8(skb, type, value) add s8 attribute to skb
102 * nla_put_s16(skb, type, value) add s16 attribute to skb
103 * nla_put_s32(skb, type, value) add s32 attribute to skb
104 * nla_put_s64(skb, type, value) add s64 attribute to skb
101 * nla_put_string(skb, type, str) add string attribute to skb 105 * nla_put_string(skb, type, str) add string attribute to skb
102 * nla_put_flag(skb, type) add flag attribute to skb 106 * nla_put_flag(skb, type) add flag attribute to skb
103 * nla_put_msecs(skb, type, jiffies) add msecs attribute to skb 107 * nla_put_msecs(skb, type, jiffies) add msecs attribute to skb
@@ -121,6 +125,10 @@
121 * nla_get_u16(nla) get payload for a u16 attribute 125 * nla_get_u16(nla) get payload for a u16 attribute
122 * nla_get_u32(nla) get payload for a u32 attribute 126 * nla_get_u32(nla) get payload for a u32 attribute
123 * nla_get_u64(nla) get payload for a u64 attribute 127 * nla_get_u64(nla) get payload for a u64 attribute
128 * nla_get_s8(nla) get payload for a s8 attribute
129 * nla_get_s16(nla) get payload for a s16 attribute
130 * nla_get_s32(nla) get payload for a s32 attribute
131 * nla_get_s64(nla) get payload for a s64 attribute
124 * nla_get_flag(nla) return 1 if flag is true 132 * nla_get_flag(nla) return 1 if flag is true
125 * nla_get_msecs(nla) get payload for a msecs attribute 133 * nla_get_msecs(nla) get payload for a msecs attribute
126 * 134 *
@@ -160,6 +168,10 @@ enum {
160 NLA_NESTED_COMPAT, 168 NLA_NESTED_COMPAT,
161 NLA_NUL_STRING, 169 NLA_NUL_STRING,
162 NLA_BINARY, 170 NLA_BINARY,
171 NLA_S8,
172 NLA_S16,
173 NLA_S32,
174 NLA_S64,
163 __NLA_TYPE_MAX, 175 __NLA_TYPE_MAX,
164}; 176};
165 177
@@ -183,6 +195,8 @@ enum {
183 * NLA_NESTED_COMPAT Minimum length of structure payload 195 * NLA_NESTED_COMPAT Minimum length of structure payload
184 * NLA_U8, NLA_U16, 196 * NLA_U8, NLA_U16,
185 * NLA_U32, NLA_U64, 197 * NLA_U32, NLA_U64,
198 * NLA_S8, NLA_S16,
199 * NLA_S32, NLA_S64,
186 * NLA_MSECS Leaving the length field zero will verify the 200 * NLA_MSECS Leaving the length field zero will verify the
187 * given type fits, using it verifies minimum length 201 * given type fits, using it verifies minimum length
188 * just like "All other" 202 * just like "All other"
@@ -879,6 +893,50 @@ static inline int nla_put_le64(struct sk_buff *skb, int attrtype, __le64 value)
879} 893}
880 894
881/** 895/**
896 * nla_put_s8 - Add a s8 netlink attribute to a socket buffer
897 * @skb: socket buffer to add attribute to
898 * @attrtype: attribute type
899 * @value: numeric value
900 */
901static inline int nla_put_s8(struct sk_buff *skb, int attrtype, s8 value)
902{
903 return nla_put(skb, attrtype, sizeof(s8), &value);
904}
905
906/**
907 * nla_put_s16 - Add a s16 netlink attribute to a socket buffer
908 * @skb: socket buffer to add attribute to
909 * @attrtype: attribute type
910 * @value: numeric value
911 */
912static inline int nla_put_s16(struct sk_buff *skb, int attrtype, s16 value)
913{
914 return nla_put(skb, attrtype, sizeof(s16), &value);
915}
916
917/**
918 * nla_put_s32 - Add a s32 netlink attribute to a socket buffer
919 * @skb: socket buffer to add attribute to
920 * @attrtype: attribute type
921 * @value: numeric value
922 */
923static inline int nla_put_s32(struct sk_buff *skb, int attrtype, s32 value)
924{
925 return nla_put(skb, attrtype, sizeof(s32), &value);
926}
927
928/**
929 * nla_put_s64 - Add a s64 netlink attribute to a socket buffer
930 * @skb: socket buffer to add attribute to
931 * @attrtype: attribute type
932 * @value: numeric value
933 */
934static inline int nla_put_s64(struct sk_buff *skb, int attrtype, s64 value)
935{
936 return nla_put(skb, attrtype, sizeof(s64), &value);
937}
938
939/**
882 * nla_put_string - Add a string netlink attribute to a socket buffer 940 * nla_put_string - Add a string netlink attribute to a socket buffer
883 * @skb: socket buffer to add attribute to 941 * @skb: socket buffer to add attribute to
884 * @attrtype: attribute type 942 * @attrtype: attribute type
@@ -994,6 +1052,46 @@ static inline __be64 nla_get_be64(const struct nlattr *nla)
994} 1052}
995 1053
996/** 1054/**
1055 * nla_get_s32 - return payload of s32 attribute
1056 * @nla: s32 netlink attribute
1057 */
1058static inline s32 nla_get_s32(const struct nlattr *nla)
1059{
1060 return *(s32 *) nla_data(nla);
1061}
1062
1063/**
1064 * nla_get_s16 - return payload of s16 attribute
1065 * @nla: s16 netlink attribute
1066 */
1067static inline s16 nla_get_s16(const struct nlattr *nla)
1068{
1069 return *(s16 *) nla_data(nla);
1070}
1071
1072/**
1073 * nla_get_s8 - return payload of s8 attribute
1074 * @nla: s8 netlink attribute
1075 */
1076static inline s8 nla_get_s8(const struct nlattr *nla)
1077{
1078 return *(s8 *) nla_data(nla);
1079}
1080
1081/**
1082 * nla_get_s64 - return payload of s64 attribute
1083 * @nla: s64 netlink attribute
1084 */
1085static inline s64 nla_get_s64(const struct nlattr *nla)
1086{
1087 s64 tmp;
1088
1089 nla_memcpy(&tmp, nla, sizeof(tmp));
1090
1091 return tmp;
1092}
1093
1094/**
997 * nla_get_flag - return payload of flag attribute 1095 * nla_get_flag - return payload of flag attribute
998 * @nla: flag netlink attribute 1096 * @nla: flag netlink attribute
999 */ 1097 */
diff --git a/include/net/netns/sctp.h b/include/net/netns/sctp.h
new file mode 100644
index 000000000000..5e5eb1f9f14b
--- /dev/null
+++ b/include/net/netns/sctp.h
@@ -0,0 +1,131 @@
1#ifndef __NETNS_SCTP_H__
2#define __NETNS_SCTP_H__
3
4struct sock;
5struct proc_dir_entry;
6struct sctp_mib;
7struct ctl_table_header;
8
9struct netns_sctp {
10 DEFINE_SNMP_STAT(struct sctp_mib, sctp_statistics);
11
12#ifdef CONFIG_PROC_FS
13 struct proc_dir_entry *proc_net_sctp;
14#endif
15#ifdef CONFIG_SYSCTL
16 struct ctl_table_header *sysctl_header;
17#endif
18 /* This is the global socket data structure used for responding to
19 * the Out-of-the-blue (OOTB) packets. A control sock will be created
20 * for this socket at the initialization time.
21 */
22 struct sock *ctl_sock;
23
24 /* This is the global local address list.
25 * We actively maintain this complete list of addresses on
26 * the system by catching address add/delete events.
27 *
28 * It is a list of sctp_sockaddr_entry.
29 */
30 struct list_head local_addr_list;
31 struct list_head addr_waitq;
32 struct timer_list addr_wq_timer;
33 struct list_head auto_asconf_splist;
34 spinlock_t addr_wq_lock;
35
36 /* Lock that protects the local_addr_list writers */
37 spinlock_t local_addr_lock;
38
39 /* RFC2960 Section 14. Suggested SCTP Protocol Parameter Values
40 *
41 * The following protocol parameters are RECOMMENDED:
42 *
43 * RTO.Initial - 3 seconds
44 * RTO.Min - 1 second
45 * RTO.Max - 60 seconds
46 * RTO.Alpha - 1/8 (3 when converted to right shifts.)
47 * RTO.Beta - 1/4 (2 when converted to right shifts.)
48 */
49 unsigned int rto_initial;
50 unsigned int rto_min;
51 unsigned int rto_max;
52
53 /* Note: rto_alpha and rto_beta are really defined as inverse
54 * powers of two to facilitate integer operations.
55 */
56 int rto_alpha;
57 int rto_beta;
58
59 /* Max.Burst - 4 */
60 int max_burst;
61
62 /* Whether Cookie Preservative is enabled(1) or not(0) */
63 int cookie_preserve_enable;
64
65 /* Valid.Cookie.Life - 60 seconds */
66 unsigned int valid_cookie_life;
67
68 /* Delayed SACK timeout 200ms default*/
69 unsigned int sack_timeout;
70
71 /* HB.interval - 30 seconds */
72 unsigned int hb_interval;
73
74 /* Association.Max.Retrans - 10 attempts
75 * Path.Max.Retrans - 5 attempts (per destination address)
76 * Max.Init.Retransmits - 8 attempts
77 */
78 int max_retrans_association;
79 int max_retrans_path;
80 int max_retrans_init;
81 /* Potentially-Failed.Max.Retrans sysctl value
82 * taken from:
83 * http://tools.ietf.org/html/draft-nishida-tsvwg-sctp-failover-05
84 */
85 int pf_retrans;
86
87 /*
88 * Policy for preforming sctp/socket accounting
89 * 0 - do socket level accounting, all assocs share sk_sndbuf
90 * 1 - do sctp accounting, each asoc may use sk_sndbuf bytes
91 */
92 int sndbuf_policy;
93
94 /*
95 * Policy for preforming sctp/socket accounting
96 * 0 - do socket level accounting, all assocs share sk_rcvbuf
97 * 1 - do sctp accounting, each asoc may use sk_rcvbuf bytes
98 */
99 int rcvbuf_policy;
100
101 int default_auto_asconf;
102
103 /* Flag to indicate if addip is enabled. */
104 int addip_enable;
105 int addip_noauth;
106
107 /* Flag to indicate if PR-SCTP is enabled. */
108 int prsctp_enable;
109
110 /* Flag to idicate if SCTP-AUTH is enabled */
111 int auth_enable;
112
113 /*
114 * Policy to control SCTP IPv4 address scoping
115 * 0 - Disable IPv4 address scoping
116 * 1 - Enable IPv4 address scoping
117 * 2 - Selectively allow only IPv4 private addresses
118 * 3 - Selectively allow only IPv4 link local address
119 */
120 int scope_policy;
121
122 /* Threshold for rwnd update SACKS. Receive buffer shifted this many
123 * bits is an indicator of when to send and window update SACK.
124 */
125 int rwnd_upd_shift;
126
127 /* Threshold for autoclose timeout, in seconds. */
128 unsigned long max_autoclose;
129};
130
131#endif /* __NETNS_SCTP_H__ */
diff --git a/include/net/sctp/sctp.h b/include/net/sctp/sctp.h
index ff499640528b..9c6414f553f9 100644
--- a/include/net/sctp/sctp.h
+++ b/include/net/sctp/sctp.h
@@ -114,13 +114,12 @@
114/* 114/*
115 * sctp/protocol.c 115 * sctp/protocol.c
116 */ 116 */
117extern struct sock *sctp_get_ctl_sock(void); 117extern int sctp_copy_local_addr_list(struct net *, struct sctp_bind_addr *,
118extern int sctp_copy_local_addr_list(struct sctp_bind_addr *,
119 sctp_scope_t, gfp_t gfp, 118 sctp_scope_t, gfp_t gfp,
120 int flags); 119 int flags);
121extern struct sctp_pf *sctp_get_pf_specific(sa_family_t family); 120extern struct sctp_pf *sctp_get_pf_specific(sa_family_t family);
122extern int sctp_register_pf(struct sctp_pf *, sa_family_t); 121extern int sctp_register_pf(struct sctp_pf *, sa_family_t);
123extern void sctp_addr_wq_mgmt(struct sctp_sockaddr_entry *, int); 122extern void sctp_addr_wq_mgmt(struct net *, struct sctp_sockaddr_entry *, int);
124 123
125/* 124/*
126 * sctp/socket.c 125 * sctp/socket.c
@@ -140,12 +139,12 @@ extern int sctp_asconf_mgmt(struct sctp_sock *, struct sctp_sockaddr_entry *);
140/* 139/*
141 * sctp/primitive.c 140 * sctp/primitive.c
142 */ 141 */
143int sctp_primitive_ASSOCIATE(struct sctp_association *, void *arg); 142int sctp_primitive_ASSOCIATE(struct net *, struct sctp_association *, void *arg);
144int sctp_primitive_SHUTDOWN(struct sctp_association *, void *arg); 143int sctp_primitive_SHUTDOWN(struct net *, struct sctp_association *, void *arg);
145int sctp_primitive_ABORT(struct sctp_association *, void *arg); 144int sctp_primitive_ABORT(struct net *, struct sctp_association *, void *arg);
146int sctp_primitive_SEND(struct sctp_association *, void *arg); 145int sctp_primitive_SEND(struct net *, struct sctp_association *, void *arg);
147int sctp_primitive_REQUESTHEARTBEAT(struct sctp_association *, void *arg); 146int sctp_primitive_REQUESTHEARTBEAT(struct net *, struct sctp_association *, void *arg);
148int sctp_primitive_ASCONF(struct sctp_association *, void *arg); 147int sctp_primitive_ASCONF(struct net *, struct sctp_association *, void *arg);
149 148
150/* 149/*
151 * sctp/input.c 150 * sctp/input.c
@@ -156,7 +155,7 @@ void sctp_hash_established(struct sctp_association *);
156void sctp_unhash_established(struct sctp_association *); 155void sctp_unhash_established(struct sctp_association *);
157void sctp_hash_endpoint(struct sctp_endpoint *); 156void sctp_hash_endpoint(struct sctp_endpoint *);
158void sctp_unhash_endpoint(struct sctp_endpoint *); 157void sctp_unhash_endpoint(struct sctp_endpoint *);
159struct sock *sctp_err_lookup(int family, struct sk_buff *, 158struct sock *sctp_err_lookup(struct net *net, int family, struct sk_buff *,
160 struct sctphdr *, struct sctp_association **, 159 struct sctphdr *, struct sctp_association **,
161 struct sctp_transport **); 160 struct sctp_transport **);
162void sctp_err_finish(struct sock *, struct sctp_association *); 161void sctp_err_finish(struct sock *, struct sctp_association *);
@@ -173,14 +172,14 @@ void sctp_backlog_migrate(struct sctp_association *assoc,
173/* 172/*
174 * sctp/proc.c 173 * sctp/proc.c
175 */ 174 */
176int sctp_snmp_proc_init(void); 175int sctp_snmp_proc_init(struct net *net);
177void sctp_snmp_proc_exit(void); 176void sctp_snmp_proc_exit(struct net *net);
178int sctp_eps_proc_init(void); 177int sctp_eps_proc_init(struct net *net);
179void sctp_eps_proc_exit(void); 178void sctp_eps_proc_exit(struct net *net);
180int sctp_assocs_proc_init(void); 179int sctp_assocs_proc_init(struct net *net);
181void sctp_assocs_proc_exit(void); 180void sctp_assocs_proc_exit(struct net *net);
182int sctp_remaddr_proc_init(void); 181int sctp_remaddr_proc_init(struct net *net);
183void sctp_remaddr_proc_exit(void); 182void sctp_remaddr_proc_exit(struct net *net);
184 183
185 184
186/* 185/*
@@ -222,11 +221,10 @@ extern struct kmem_cache *sctp_bucket_cachep __read_mostly;
222#define sctp_bh_unlock_sock(sk) bh_unlock_sock(sk) 221#define sctp_bh_unlock_sock(sk) bh_unlock_sock(sk)
223 222
224/* SCTP SNMP MIB stats handlers */ 223/* SCTP SNMP MIB stats handlers */
225DECLARE_SNMP_STAT(struct sctp_mib, sctp_statistics); 224#define SCTP_INC_STATS(net, field) SNMP_INC_STATS((net)->sctp.sctp_statistics, field)
226#define SCTP_INC_STATS(field) SNMP_INC_STATS(sctp_statistics, field) 225#define SCTP_INC_STATS_BH(net, field) SNMP_INC_STATS_BH((net)->sctp.sctp_statistics, field)
227#define SCTP_INC_STATS_BH(field) SNMP_INC_STATS_BH(sctp_statistics, field) 226#define SCTP_INC_STATS_USER(net, field) SNMP_INC_STATS_USER((net)->sctp.sctp_statistics, field)
228#define SCTP_INC_STATS_USER(field) SNMP_INC_STATS_USER(sctp_statistics, field) 227#define SCTP_DEC_STATS(net, field) SNMP_DEC_STATS((net)->sctp.sctp_statistics, field)
229#define SCTP_DEC_STATS(field) SNMP_DEC_STATS(sctp_statistics, field)
230 228
231#endif /* !TEST_FRAME */ 229#endif /* !TEST_FRAME */
232 230
@@ -361,25 +359,29 @@ atomic_t sctp_dbg_objcnt_## name = ATOMIC_INIT(0)
361#define SCTP_DBG_OBJCNT_ENTRY(name) \ 359#define SCTP_DBG_OBJCNT_ENTRY(name) \
362{.label= #name, .counter= &sctp_dbg_objcnt_## name} 360{.label= #name, .counter= &sctp_dbg_objcnt_## name}
363 361
364void sctp_dbg_objcnt_init(void); 362void sctp_dbg_objcnt_init(struct net *);
365void sctp_dbg_objcnt_exit(void); 363void sctp_dbg_objcnt_exit(struct net *);
366 364
367#else 365#else
368 366
369#define SCTP_DBG_OBJCNT_INC(name) 367#define SCTP_DBG_OBJCNT_INC(name)
370#define SCTP_DBG_OBJCNT_DEC(name) 368#define SCTP_DBG_OBJCNT_DEC(name)
371 369
372static inline void sctp_dbg_objcnt_init(void) { return; } 370static inline void sctp_dbg_objcnt_init(struct net *net) { return; }
373static inline void sctp_dbg_objcnt_exit(void) { return; } 371static inline void sctp_dbg_objcnt_exit(struct net *net) { return; }
374 372
375#endif /* CONFIG_SCTP_DBG_OBJCOUNT */ 373#endif /* CONFIG_SCTP_DBG_OBJCOUNT */
376 374
377#if defined CONFIG_SYSCTL 375#if defined CONFIG_SYSCTL
378void sctp_sysctl_register(void); 376void sctp_sysctl_register(void);
379void sctp_sysctl_unregister(void); 377void sctp_sysctl_unregister(void);
378int sctp_sysctl_net_register(struct net *net);
379void sctp_sysctl_net_unregister(struct net *net);
380#else 380#else
381static inline void sctp_sysctl_register(void) { return; } 381static inline void sctp_sysctl_register(void) { return; }
382static inline void sctp_sysctl_unregister(void) { return; } 382static inline void sctp_sysctl_unregister(void) { return; }
383static inline int sctp_sysctl_net_register(struct net *net) { return 0; }
384static inline void sctp_sysctl_net_unregister(struct net *net) { return; }
383#endif 385#endif
384 386
385/* Size of Supported Address Parameter for 'x' address types. */ 387/* Size of Supported Address Parameter for 'x' address types. */
@@ -586,7 +588,6 @@ for (pos = chunk->subh.fwdtsn_hdr->skip;\
586 588
587extern struct proto sctp_prot; 589extern struct proto sctp_prot;
588extern struct proto sctpv6_prot; 590extern struct proto sctpv6_prot;
589extern struct proc_dir_entry *proc_net_sctp;
590void sctp_put_port(struct sock *sk); 591void sctp_put_port(struct sock *sk);
591 592
592extern struct idr sctp_assocs_id; 593extern struct idr sctp_assocs_id;
@@ -632,21 +633,21 @@ static inline int sctp_sanity_check(void)
632 633
633/* Warning: The following hash functions assume a power of two 'size'. */ 634/* Warning: The following hash functions assume a power of two 'size'. */
634/* This is the hash function for the SCTP port hash table. */ 635/* This is the hash function for the SCTP port hash table. */
635static inline int sctp_phashfn(__u16 lport) 636static inline int sctp_phashfn(struct net *net, __u16 lport)
636{ 637{
637 return lport & (sctp_port_hashsize - 1); 638 return (net_hash_mix(net) + lport) & (sctp_port_hashsize - 1);
638} 639}
639 640
640/* This is the hash function for the endpoint hash table. */ 641/* This is the hash function for the endpoint hash table. */
641static inline int sctp_ep_hashfn(__u16 lport) 642static inline int sctp_ep_hashfn(struct net *net, __u16 lport)
642{ 643{
643 return lport & (sctp_ep_hashsize - 1); 644 return (net_hash_mix(net) + lport) & (sctp_ep_hashsize - 1);
644} 645}
645 646
646/* This is the hash function for the association hash table. */ 647/* This is the hash function for the association hash table. */
647static inline int sctp_assoc_hashfn(__u16 lport, __u16 rport) 648static inline int sctp_assoc_hashfn(struct net *net, __u16 lport, __u16 rport)
648{ 649{
649 int h = (lport << 16) + rport; 650 int h = (lport << 16) + rport + net_hash_mix(net);
650 h ^= h>>8; 651 h ^= h>>8;
651 return h & (sctp_assoc_hashsize - 1); 652 return h & (sctp_assoc_hashsize - 1);
652} 653}
diff --git a/include/net/sctp/sm.h b/include/net/sctp/sm.h
index 9148632b8204..b5887e1677e4 100644
--- a/include/net/sctp/sm.h
+++ b/include/net/sctp/sm.h
@@ -77,7 +77,8 @@ typedef struct {
77 int action; 77 int action;
78} sctp_sm_command_t; 78} sctp_sm_command_t;
79 79
80typedef sctp_disposition_t (sctp_state_fn_t) (const struct sctp_endpoint *, 80typedef sctp_disposition_t (sctp_state_fn_t) (struct net *,
81 const struct sctp_endpoint *,
81 const struct sctp_association *, 82 const struct sctp_association *,
82 const sctp_subtype_t type, 83 const sctp_subtype_t type,
83 void *arg, 84 void *arg,
@@ -178,7 +179,8 @@ sctp_state_fn_t sctp_sf_autoclose_timer_expire;
178 179
179/* Prototypes for utility support functions. */ 180/* Prototypes for utility support functions. */
180__u8 sctp_get_chunk_type(struct sctp_chunk *chunk); 181__u8 sctp_get_chunk_type(struct sctp_chunk *chunk);
181const sctp_sm_table_entry_t *sctp_sm_lookup_event(sctp_event_t, 182const sctp_sm_table_entry_t *sctp_sm_lookup_event(struct net *,
183 sctp_event_t,
182 sctp_state_t, 184 sctp_state_t,
183 sctp_subtype_t); 185 sctp_subtype_t);
184int sctp_chunk_iif(const struct sctp_chunk *); 186int sctp_chunk_iif(const struct sctp_chunk *);
@@ -268,7 +270,7 @@ void sctp_chunk_assign_ssn(struct sctp_chunk *);
268 270
269/* Prototypes for statetable processing. */ 271/* Prototypes for statetable processing. */
270 272
271int sctp_do_sm(sctp_event_t event_type, sctp_subtype_t subtype, 273int sctp_do_sm(struct net *net, sctp_event_t event_type, sctp_subtype_t subtype,
272 sctp_state_t state, 274 sctp_state_t state,
273 struct sctp_endpoint *, 275 struct sctp_endpoint *,
274 struct sctp_association *asoc, 276 struct sctp_association *asoc,
diff --git a/include/net/sctp/structs.h b/include/net/sctp/structs.h
index fc5e60016e37..0fef00f5d3ce 100644
--- a/include/net/sctp/structs.h
+++ b/include/net/sctp/structs.h
@@ -102,6 +102,7 @@ struct sctp_bind_bucket {
102 unsigned short fastreuse; 102 unsigned short fastreuse;
103 struct hlist_node node; 103 struct hlist_node node;
104 struct hlist_head owner; 104 struct hlist_head owner;
105 struct net *net;
105}; 106};
106 107
107struct sctp_bind_hashbucket { 108struct sctp_bind_hashbucket {
@@ -118,69 +119,6 @@ struct sctp_hashbucket {
118 119
119/* The SCTP globals structure. */ 120/* The SCTP globals structure. */
120extern struct sctp_globals { 121extern struct sctp_globals {
121 /* RFC2960 Section 14. Suggested SCTP Protocol Parameter Values
122 *
123 * The following protocol parameters are RECOMMENDED:
124 *
125 * RTO.Initial - 3 seconds
126 * RTO.Min - 1 second
127 * RTO.Max - 60 seconds
128 * RTO.Alpha - 1/8 (3 when converted to right shifts.)
129 * RTO.Beta - 1/4 (2 when converted to right shifts.)
130 */
131 unsigned int rto_initial;
132 unsigned int rto_min;
133 unsigned int rto_max;
134
135 /* Note: rto_alpha and rto_beta are really defined as inverse
136 * powers of two to facilitate integer operations.
137 */
138 int rto_alpha;
139 int rto_beta;
140
141 /* Max.Burst - 4 */
142 int max_burst;
143
144 /* Whether Cookie Preservative is enabled(1) or not(0) */
145 int cookie_preserve_enable;
146
147 /* Valid.Cookie.Life - 60 seconds */
148 unsigned int valid_cookie_life;
149
150 /* Delayed SACK timeout 200ms default*/
151 unsigned int sack_timeout;
152
153 /* HB.interval - 30 seconds */
154 unsigned int hb_interval;
155
156 /* Association.Max.Retrans - 10 attempts
157 * Path.Max.Retrans - 5 attempts (per destination address)
158 * Max.Init.Retransmits - 8 attempts
159 */
160 int max_retrans_association;
161 int max_retrans_path;
162 int max_retrans_init;
163
164 /* Potentially-Failed.Max.Retrans sysctl value
165 * taken from:
166 * http://tools.ietf.org/html/draft-nishida-tsvwg-sctp-failover-05
167 */
168 int pf_retrans;
169
170 /*
171 * Policy for preforming sctp/socket accounting
172 * 0 - do socket level accounting, all assocs share sk_sndbuf
173 * 1 - do sctp accounting, each asoc may use sk_sndbuf bytes
174 */
175 int sndbuf_policy;
176
177 /*
178 * Policy for preforming sctp/socket accounting
179 * 0 - do socket level accounting, all assocs share sk_rcvbuf
180 * 1 - do sctp accounting, each asoc may use sk_rcvbuf bytes
181 */
182 int rcvbuf_policy;
183
184 /* The following variables are implementation specific. */ 122 /* The following variables are implementation specific. */
185 123
186 /* Default initialization values to be applied to new associations. */ 124 /* Default initialization values to be applied to new associations. */
@@ -204,70 +142,11 @@ extern struct sctp_globals {
204 int port_hashsize; 142 int port_hashsize;
205 struct sctp_bind_hashbucket *port_hashtable; 143 struct sctp_bind_hashbucket *port_hashtable;
206 144
207 /* This is the global local address list.
208 * We actively maintain this complete list of addresses on
209 * the system by catching address add/delete events.
210 *
211 * It is a list of sctp_sockaddr_entry.
212 */
213 struct list_head local_addr_list;
214 int default_auto_asconf;
215 struct list_head addr_waitq;
216 struct timer_list addr_wq_timer;
217 struct list_head auto_asconf_splist;
218 spinlock_t addr_wq_lock;
219
220 /* Lock that protects the local_addr_list writers */
221 spinlock_t addr_list_lock;
222
223 /* Flag to indicate if addip is enabled. */
224 int addip_enable;
225 int addip_noauth_enable;
226
227 /* Flag to indicate if PR-SCTP is enabled. */
228 int prsctp_enable;
229
230 /* Flag to idicate if SCTP-AUTH is enabled */
231 int auth_enable;
232
233 /*
234 * Policy to control SCTP IPv4 address scoping
235 * 0 - Disable IPv4 address scoping
236 * 1 - Enable IPv4 address scoping
237 * 2 - Selectively allow only IPv4 private addresses
238 * 3 - Selectively allow only IPv4 link local address
239 */
240 int ipv4_scope_policy;
241
242 /* Flag to indicate whether computing and verifying checksum 145 /* Flag to indicate whether computing and verifying checksum
243 * is disabled. */ 146 * is disabled. */
244 bool checksum_disable; 147 bool checksum_disable;
245
246 /* Threshold for rwnd update SACKS. Receive buffer shifted this many
247 * bits is an indicator of when to send and window update SACK.
248 */
249 int rwnd_update_shift;
250
251 /* Threshold for autoclose timeout, in seconds. */
252 unsigned long max_autoclose;
253} sctp_globals; 148} sctp_globals;
254 149
255#define sctp_rto_initial (sctp_globals.rto_initial)
256#define sctp_rto_min (sctp_globals.rto_min)
257#define sctp_rto_max (sctp_globals.rto_max)
258#define sctp_rto_alpha (sctp_globals.rto_alpha)
259#define sctp_rto_beta (sctp_globals.rto_beta)
260#define sctp_max_burst (sctp_globals.max_burst)
261#define sctp_valid_cookie_life (sctp_globals.valid_cookie_life)
262#define sctp_cookie_preserve_enable (sctp_globals.cookie_preserve_enable)
263#define sctp_max_retrans_association (sctp_globals.max_retrans_association)
264#define sctp_sndbuf_policy (sctp_globals.sndbuf_policy)
265#define sctp_rcvbuf_policy (sctp_globals.rcvbuf_policy)
266#define sctp_max_retrans_path (sctp_globals.max_retrans_path)
267#define sctp_pf_retrans (sctp_globals.pf_retrans)
268#define sctp_max_retrans_init (sctp_globals.max_retrans_init)
269#define sctp_sack_timeout (sctp_globals.sack_timeout)
270#define sctp_hb_interval (sctp_globals.hb_interval)
271#define sctp_max_instreams (sctp_globals.max_instreams) 150#define sctp_max_instreams (sctp_globals.max_instreams)
272#define sctp_max_outstreams (sctp_globals.max_outstreams) 151#define sctp_max_outstreams (sctp_globals.max_outstreams)
273#define sctp_address_families (sctp_globals.address_families) 152#define sctp_address_families (sctp_globals.address_families)
@@ -277,21 +156,7 @@ extern struct sctp_globals {
277#define sctp_assoc_hashtable (sctp_globals.assoc_hashtable) 156#define sctp_assoc_hashtable (sctp_globals.assoc_hashtable)
278#define sctp_port_hashsize (sctp_globals.port_hashsize) 157#define sctp_port_hashsize (sctp_globals.port_hashsize)
279#define sctp_port_hashtable (sctp_globals.port_hashtable) 158#define sctp_port_hashtable (sctp_globals.port_hashtable)
280#define sctp_local_addr_list (sctp_globals.local_addr_list)
281#define sctp_local_addr_lock (sctp_globals.addr_list_lock)
282#define sctp_auto_asconf_splist (sctp_globals.auto_asconf_splist)
283#define sctp_addr_waitq (sctp_globals.addr_waitq)
284#define sctp_addr_wq_timer (sctp_globals.addr_wq_timer)
285#define sctp_addr_wq_lock (sctp_globals.addr_wq_lock)
286#define sctp_default_auto_asconf (sctp_globals.default_auto_asconf)
287#define sctp_scope_policy (sctp_globals.ipv4_scope_policy)
288#define sctp_addip_enable (sctp_globals.addip_enable)
289#define sctp_addip_noauth (sctp_globals.addip_noauth_enable)
290#define sctp_prsctp_enable (sctp_globals.prsctp_enable)
291#define sctp_auth_enable (sctp_globals.auth_enable)
292#define sctp_checksum_disable (sctp_globals.checksum_disable) 159#define sctp_checksum_disable (sctp_globals.checksum_disable)
293#define sctp_rwnd_upd_shift (sctp_globals.rwnd_update_shift)
294#define sctp_max_autoclose (sctp_globals.max_autoclose)
295 160
296/* SCTP Socket type: UDP or TCP style. */ 161/* SCTP Socket type: UDP or TCP style. */
297typedef enum { 162typedef enum {
@@ -1085,7 +950,7 @@ struct sctp_transport {
1085 __u64 hb_nonce; 950 __u64 hb_nonce;
1086}; 951};
1087 952
1088struct sctp_transport *sctp_transport_new(const union sctp_addr *, 953struct sctp_transport *sctp_transport_new(struct net *, const union sctp_addr *,
1089 gfp_t); 954 gfp_t);
1090void sctp_transport_set_owner(struct sctp_transport *, 955void sctp_transport_set_owner(struct sctp_transport *,
1091 struct sctp_association *); 956 struct sctp_association *);
@@ -1240,7 +1105,7 @@ struct sctp_bind_addr {
1240 1105
1241void sctp_bind_addr_init(struct sctp_bind_addr *, __u16 port); 1106void sctp_bind_addr_init(struct sctp_bind_addr *, __u16 port);
1242void sctp_bind_addr_free(struct sctp_bind_addr *); 1107void sctp_bind_addr_free(struct sctp_bind_addr *);
1243int sctp_bind_addr_copy(struct sctp_bind_addr *dest, 1108int sctp_bind_addr_copy(struct net *net, struct sctp_bind_addr *dest,
1244 const struct sctp_bind_addr *src, 1109 const struct sctp_bind_addr *src,
1245 sctp_scope_t scope, gfp_t gfp, 1110 sctp_scope_t scope, gfp_t gfp,
1246 int flags); 1111 int flags);
@@ -1267,7 +1132,7 @@ int sctp_raw_to_bind_addrs(struct sctp_bind_addr *bp, __u8 *raw, int len,
1267 __u16 port, gfp_t gfp); 1132 __u16 port, gfp_t gfp);
1268 1133
1269sctp_scope_t sctp_scope(const union sctp_addr *); 1134sctp_scope_t sctp_scope(const union sctp_addr *);
1270int sctp_in_scope(const union sctp_addr *addr, const sctp_scope_t scope); 1135int sctp_in_scope(struct net *net, const union sctp_addr *addr, const sctp_scope_t scope);
1271int sctp_is_any(struct sock *sk, const union sctp_addr *addr); 1136int sctp_is_any(struct sock *sk, const union sctp_addr *addr);
1272int sctp_addr_is_valid(const union sctp_addr *addr); 1137int sctp_addr_is_valid(const union sctp_addr *addr);
1273int sctp_is_ep_boundall(struct sock *sk); 1138int sctp_is_ep_boundall(struct sock *sk);
@@ -1425,13 +1290,13 @@ struct sctp_association *sctp_endpoint_lookup_assoc(
1425int sctp_endpoint_is_peeled_off(struct sctp_endpoint *, 1290int sctp_endpoint_is_peeled_off(struct sctp_endpoint *,
1426 const union sctp_addr *); 1291 const union sctp_addr *);
1427struct sctp_endpoint *sctp_endpoint_is_match(struct sctp_endpoint *, 1292struct sctp_endpoint *sctp_endpoint_is_match(struct sctp_endpoint *,
1428 const union sctp_addr *); 1293 struct net *, const union sctp_addr *);
1429int sctp_has_association(const union sctp_addr *laddr, 1294int sctp_has_association(struct net *net, const union sctp_addr *laddr,
1430 const union sctp_addr *paddr); 1295 const union sctp_addr *paddr);
1431 1296
1432int sctp_verify_init(const struct sctp_association *asoc, sctp_cid_t, 1297int sctp_verify_init(struct net *net, const struct sctp_association *asoc,
1433 sctp_init_chunk_t *peer_init, struct sctp_chunk *chunk, 1298 sctp_cid_t, sctp_init_chunk_t *peer_init,
1434 struct sctp_chunk **err_chunk); 1299 struct sctp_chunk *chunk, struct sctp_chunk **err_chunk);
1435int sctp_process_init(struct sctp_association *, struct sctp_chunk *chunk, 1300int sctp_process_init(struct sctp_association *, struct sctp_chunk *chunk,
1436 const union sctp_addr *peer, 1301 const union sctp_addr *peer,
1437 sctp_init_chunk_t *init, gfp_t gfp); 1302 sctp_init_chunk_t *init, gfp_t gfp);
@@ -2013,6 +1878,7 @@ void sctp_assoc_control_transport(struct sctp_association *,
2013 sctp_transport_cmd_t, sctp_sn_error_t); 1878 sctp_transport_cmd_t, sctp_sn_error_t);
2014struct sctp_transport *sctp_assoc_lookup_tsn(struct sctp_association *, __u32); 1879struct sctp_transport *sctp_assoc_lookup_tsn(struct sctp_association *, __u32);
2015struct sctp_transport *sctp_assoc_is_match(struct sctp_association *, 1880struct sctp_transport *sctp_assoc_is_match(struct sctp_association *,
1881 struct net *,
2016 const union sctp_addr *, 1882 const union sctp_addr *,
2017 const union sctp_addr *); 1883 const union sctp_addr *);
2018void sctp_assoc_migrate(struct sctp_association *, struct sock *); 1884void sctp_assoc_migrate(struct sctp_association *, struct sock *);
diff --git a/include/net/snmp.h b/include/net/snmp.h
index 0147b901e79c..71596261fa99 100644
--- a/include/net/snmp.h
+++ b/include/net/snmp.h
@@ -154,13 +154,15 @@ struct linux_xfrm_mib {
154 */ 154 */
155#define SNMP_UPD_PO_STATS(mib, basefield, addend) \ 155#define SNMP_UPD_PO_STATS(mib, basefield, addend) \
156 do { \ 156 do { \
157 this_cpu_inc(mib[0]->mibs[basefield##PKTS]); \ 157 __typeof__(*mib[0]->mibs) *ptr = mib[0]->mibs; \
158 this_cpu_add(mib[0]->mibs[basefield##OCTETS], addend); \ 158 this_cpu_inc(ptr[basefield##PKTS]); \
159 this_cpu_add(ptr[basefield##OCTETS], addend); \
159 } while (0) 160 } while (0)
160#define SNMP_UPD_PO_STATS_BH(mib, basefield, addend) \ 161#define SNMP_UPD_PO_STATS_BH(mib, basefield, addend) \
161 do { \ 162 do { \
162 __this_cpu_inc(mib[0]->mibs[basefield##PKTS]); \ 163 __typeof__(*mib[0]->mibs) *ptr = mib[0]->mibs; \
163 __this_cpu_add(mib[0]->mibs[basefield##OCTETS], addend); \ 164 __this_cpu_inc(ptr[basefield##PKTS]); \
165 __this_cpu_add(ptr[basefield##OCTETS], addend); \
164 } while (0) 166 } while (0)
165 167
166 168
diff --git a/include/net/xfrm.h b/include/net/xfrm.h
index 976a81abe1a2..36ad56ba648b 100644
--- a/include/net/xfrm.h
+++ b/include/net/xfrm.h
@@ -573,7 +573,7 @@ struct xfrm_mgr {
573 struct list_head list; 573 struct list_head list;
574 char *id; 574 char *id;
575 int (*notify)(struct xfrm_state *x, const struct km_event *c); 575 int (*notify)(struct xfrm_state *x, const struct km_event *c);
576 int (*acquire)(struct xfrm_state *x, struct xfrm_tmpl *, struct xfrm_policy *xp, int dir); 576 int (*acquire)(struct xfrm_state *x, struct xfrm_tmpl *, struct xfrm_policy *xp);
577 struct xfrm_policy *(*compile_policy)(struct sock *sk, int opt, u8 *data, int len, int *dir); 577 struct xfrm_policy *(*compile_policy)(struct sock *sk, int opt, u8 *data, int len, int *dir);
578 int (*new_mapping)(struct xfrm_state *x, xfrm_address_t *ipaddr, __be16 sport); 578 int (*new_mapping)(struct xfrm_state *x, xfrm_address_t *ipaddr, __be16 sport);
579 int (*notify_policy)(struct xfrm_policy *x, int dir, const struct km_event *c); 579 int (*notify_policy)(struct xfrm_policy *x, int dir, const struct km_event *c);