aboutsummaryrefslogtreecommitdiffstats
path: root/include/linux
diff options
context:
space:
mode:
Diffstat (limited to 'include/linux')
-rw-r--r--include/linux/bcma/bcma_regs.h5
-rw-r--r--include/linux/brcmphy.h135
-rw-r--r--include/linux/cycx_x25.h125
-rw-r--r--include/linux/etherdevice.h1
-rw-r--r--include/linux/ethtool.h4
-rw-r--r--include/linux/filter.h194
-rw-r--r--include/linux/i82593.h229
-rw-r--r--include/linux/ieee80211.h65
-rw-r--r--include/linux/igmp.h1
-rw-r--r--include/linux/mlx4/device.h14
-rw-r--r--include/linux/netdevice.h184
-rw-r--r--include/linux/netfilter/ipset/ip_set_list.h1
-rw-r--r--include/linux/phonedev.h25
-rw-r--r--include/linux/phy.h27
-rw-r--r--include/linux/phy_fixed.h17
-rw-r--r--include/linux/random.h4
-rw-r--r--include/linux/rhashtable.h2
-rw-r--r--include/linux/rtnetlink.h10
-rw-r--r--include/linux/skbuff.h159
-rw-r--r--include/linux/tcp.h2
-rw-r--r--include/linux/udp.h16
21 files changed, 656 insertions, 564 deletions
diff --git a/include/linux/bcma/bcma_regs.h b/include/linux/bcma/bcma_regs.h
index 917dcd7965e7..e64ae7bf80a1 100644
--- a/include/linux/bcma/bcma_regs.h
+++ b/include/linux/bcma/bcma_regs.h
@@ -39,6 +39,11 @@
39#define BCMA_RESET_CTL_RESET 0x0001 39#define BCMA_RESET_CTL_RESET 0x0001
40#define BCMA_RESET_ST 0x0804 40#define BCMA_RESET_ST 0x0804
41 41
42#define BCMA_NS_ROM_IOST_BOOT_DEV_MASK 0x0003
43#define BCMA_NS_ROM_IOST_BOOT_DEV_NOR 0x0000
44#define BCMA_NS_ROM_IOST_BOOT_DEV_NAND 0x0001
45#define BCMA_NS_ROM_IOST_BOOT_DEV_ROM 0x0002
46
42/* BCMA PCI config space registers. */ 47/* BCMA PCI config space registers. */
43#define BCMA_PCI_PMCSR 0x44 48#define BCMA_PCI_PMCSR 0x44
44#define BCMA_PCI_PE 0x100 49#define BCMA_PCI_PE 0x100
diff --git a/include/linux/brcmphy.h b/include/linux/brcmphy.h
index 61219b9b3445..3f626fe48c9a 100644
--- a/include/linux/brcmphy.h
+++ b/include/linux/brcmphy.h
@@ -13,6 +13,8 @@
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_BCM7250 0xae025280
17#define PHY_ID_BCM7364 0xae025260
16#define PHY_ID_BCM7366 0x600d8490 18#define PHY_ID_BCM7366 0x600d8490
17#define PHY_ID_BCM7439 0x600d8480 19#define PHY_ID_BCM7439 0x600d8480
18#define PHY_ID_BCM7445 0x600d8510 20#define PHY_ID_BCM7445 0x600d8510
@@ -21,9 +23,9 @@
21#define PHY_BCM_OUI_1 0x00206000 23#define PHY_BCM_OUI_1 0x00206000
22#define PHY_BCM_OUI_2 0x0143bc00 24#define PHY_BCM_OUI_2 0x0143bc00
23#define PHY_BCM_OUI_3 0x03625c00 25#define PHY_BCM_OUI_3 0x03625c00
24#define PHY_BCM_OUI_4 0x600d0000 26#define PHY_BCM_OUI_4 0x600d8400
25#define PHY_BCM_OUI_5 0x03625e00 27#define PHY_BCM_OUI_5 0x03625e00
26 28#define PHY_BCM_OUI_6 0xae025000
27 29
28#define PHY_BCM_FLAGS_MODE_COPPER 0x00000001 30#define PHY_BCM_FLAGS_MODE_COPPER 0x00000001
29#define PHY_BCM_FLAGS_MODE_1000BX 0x00000002 31#define PHY_BCM_FLAGS_MODE_1000BX 0x00000002
@@ -38,7 +40,8 @@
38#define PHY_BRCM_CLEAR_RGMII_MODE 0x00004000 40#define PHY_BRCM_CLEAR_RGMII_MODE 0x00004000
39#define PHY_BRCM_DIS_TXCRXC_NOENRGY 0x00008000 41#define PHY_BRCM_DIS_TXCRXC_NOENRGY 0x00008000
40/* Broadcom BCM7xxx specific workarounds */ 42/* Broadcom BCM7xxx specific workarounds */
41#define PHY_BRCM_100MBPS_WAR 0x00010000 43#define PHY_BRCM_7XXX_REV(x) (((x) >> 8) & 0xff)
44#define PHY_BRCM_7XXX_PATCH(x) ((x) & 0xff)
42#define PHY_BCM_FLAGS_VALID 0x80000000 45#define PHY_BCM_FLAGS_VALID 0x80000000
43 46
44/* Broadcom BCM54XX register definitions, common to most Broadcom PHYs */ 47/* Broadcom BCM54XX register definitions, common to most Broadcom PHYs */
@@ -92,4 +95,130 @@
92 95
93#define MII_BCM54XX_AUXCTL_SHDWSEL_AUXCTL 0x0000 96#define MII_BCM54XX_AUXCTL_SHDWSEL_AUXCTL 0x0000
94 97
98/*
99 * Broadcom LED source encodings. These are used in BCM5461, BCM5481,
100 * BCM5482, and possibly some others.
101 */
102#define BCM_LED_SRC_LINKSPD1 0x0
103#define BCM_LED_SRC_LINKSPD2 0x1
104#define BCM_LED_SRC_XMITLED 0x2
105#define BCM_LED_SRC_ACTIVITYLED 0x3
106#define BCM_LED_SRC_FDXLED 0x4
107#define BCM_LED_SRC_SLAVE 0x5
108#define BCM_LED_SRC_INTR 0x6
109#define BCM_LED_SRC_QUALITY 0x7
110#define BCM_LED_SRC_RCVLED 0x8
111#define BCM_LED_SRC_MULTICOLOR1 0xa
112#define BCM_LED_SRC_OPENSHORT 0xb
113#define BCM_LED_SRC_OFF 0xe /* Tied high */
114#define BCM_LED_SRC_ON 0xf /* Tied low */
115
116
117/*
118 * BCM5482: Shadow registers
119 * Shadow values go into bits [14:10] of register 0x1c to select a shadow
120 * register to access.
121 */
122/* 00101: Spare Control Register 3 */
123#define BCM54XX_SHD_SCR3 0x05
124#define BCM54XX_SHD_SCR3_DEF_CLK125 0x0001
125#define BCM54XX_SHD_SCR3_DLLAPD_DIS 0x0002
126#define BCM54XX_SHD_SCR3_TRDDAPD 0x0004
127
128/* 01010: Auto Power-Down */
129#define BCM54XX_SHD_APD 0x0a
130#define BCM54XX_SHD_APD_EN 0x0020
131
132#define BCM5482_SHD_LEDS1 0x0d /* 01101: LED Selector 1 */
133 /* LED3 / ~LINKSPD[2] selector */
134#define BCM5482_SHD_LEDS1_LED3(src) ((src & 0xf) << 4)
135 /* LED1 / ~LINKSPD[1] selector */
136#define BCM5482_SHD_LEDS1_LED1(src) ((src & 0xf) << 0)
137#define BCM54XX_SHD_RGMII_MODE 0x0b /* 01011: RGMII Mode Selector */
138#define BCM5482_SHD_SSD 0x14 /* 10100: Secondary SerDes control */
139#define BCM5482_SHD_SSD_LEDM 0x0008 /* SSD LED Mode enable */
140#define BCM5482_SHD_SSD_EN 0x0001 /* SSD enable */
141#define BCM5482_SHD_MODE 0x1f /* 11111: Mode Control Register */
142#define BCM5482_SHD_MODE_1000BX 0x0001 /* Enable 1000BASE-X registers */
143
144
145/*
146 * EXPANSION SHADOW ACCESS REGISTERS. (PHY REG 0x15, 0x16, and 0x17)
147 */
148#define MII_BCM54XX_EXP_AADJ1CH0 0x001f
149#define MII_BCM54XX_EXP_AADJ1CH0_SWP_ABCD_OEN 0x0200
150#define MII_BCM54XX_EXP_AADJ1CH0_SWSEL_THPF 0x0100
151#define MII_BCM54XX_EXP_AADJ1CH3 0x601f
152#define MII_BCM54XX_EXP_AADJ1CH3_ADCCKADJ 0x0002
153#define MII_BCM54XX_EXP_EXP08 0x0F08
154#define MII_BCM54XX_EXP_EXP08_RJCT_2MHZ 0x0001
155#define MII_BCM54XX_EXP_EXP08_EARLY_DAC_WAKE 0x0200
156#define MII_BCM54XX_EXP_EXP75 0x0f75
157#define MII_BCM54XX_EXP_EXP75_VDACCTRL 0x003c
158#define MII_BCM54XX_EXP_EXP75_CM_OSC 0x0001
159#define MII_BCM54XX_EXP_EXP96 0x0f96
160#define MII_BCM54XX_EXP_EXP96_MYST 0x0010
161#define MII_BCM54XX_EXP_EXP97 0x0f97
162#define MII_BCM54XX_EXP_EXP97_MYST 0x0c0c
163
164/*
165 * BCM5482: Secondary SerDes registers
166 */
167#define BCM5482_SSD_1000BX_CTL 0x00 /* 1000BASE-X Control */
168#define BCM5482_SSD_1000BX_CTL_PWRDOWN 0x0800 /* Power-down SSD */
169#define BCM5482_SSD_SGMII_SLAVE 0x15 /* SGMII Slave Register */
170#define BCM5482_SSD_SGMII_SLAVE_EN 0x0002 /* Slave mode enable */
171#define BCM5482_SSD_SGMII_SLAVE_AD 0x0001 /* Slave auto-detection */
172
173
174/*****************************************************************************/
175/* Fast Ethernet Transceiver definitions. */
176/*****************************************************************************/
177
178#define MII_BRCM_FET_INTREG 0x1a /* Interrupt register */
179#define MII_BRCM_FET_IR_MASK 0x0100 /* Mask all interrupts */
180#define MII_BRCM_FET_IR_LINK_EN 0x0200 /* Link status change enable */
181#define MII_BRCM_FET_IR_SPEED_EN 0x0400 /* Link speed change enable */
182#define MII_BRCM_FET_IR_DUPLEX_EN 0x0800 /* Duplex mode change enable */
183#define MII_BRCM_FET_IR_ENABLE 0x4000 /* Interrupt enable */
184
185#define MII_BRCM_FET_BRCMTEST 0x1f /* Brcm test register */
186#define MII_BRCM_FET_BT_SRE 0x0080 /* Shadow register enable */
187
188
189/*** Shadow register definitions ***/
190
191#define MII_BRCM_FET_SHDW_MISCCTRL 0x10 /* Shadow misc ctrl */
192#define MII_BRCM_FET_SHDW_MC_FAME 0x4000 /* Force Auto MDIX enable */
193
194#define MII_BRCM_FET_SHDW_AUXMODE4 0x1a /* Auxiliary mode 4 */
195#define MII_BRCM_FET_SHDW_AM4_LED_MASK 0x0003
196#define MII_BRCM_FET_SHDW_AM4_LED_MODE1 0x0001
197
198#define MII_BRCM_FET_SHDW_AUXSTAT2 0x1b /* Auxiliary status 2 */
199#define MII_BRCM_FET_SHDW_AS2_APDE 0x0020 /* Auto power down enable */
200
201/*
202 * Indirect register access functions for the 1000BASE-T/100BASE-TX/10BASE-T
203 * 0x1c shadow registers.
204 */
205static inline int bcm54xx_shadow_read(struct phy_device *phydev, u16 shadow)
206{
207 phy_write(phydev, MII_BCM54XX_SHD, MII_BCM54XX_SHD_VAL(shadow));
208 return MII_BCM54XX_SHD_DATA(phy_read(phydev, MII_BCM54XX_SHD));
209}
210
211static inline int bcm54xx_shadow_write(struct phy_device *phydev, u16 shadow,
212 u16 val)
213{
214 return phy_write(phydev, MII_BCM54XX_SHD,
215 MII_BCM54XX_SHD_WRITE |
216 MII_BCM54XX_SHD_VAL(shadow) |
217 MII_BCM54XX_SHD_DATA(val));
218}
219
220#define BRCM_CL45VEN_EEE_CONTROL 0x803d
221#define LPI_FEATURE_EN 0x8000
222#define LPI_FEATURE_EN_DIG1000X 0x4000
223
95#endif /* _LINUX_BRCMPHY_H */ 224#endif /* _LINUX_BRCMPHY_H */
diff --git a/include/linux/cycx_x25.h b/include/linux/cycx_x25.h
deleted file mode 100644
index 362bf19d6cf1..000000000000
--- a/include/linux/cycx_x25.h
+++ /dev/null
@@ -1,125 +0,0 @@
1#ifndef _CYCX_X25_H
2#define _CYCX_X25_H
3/*
4* cycx_x25.h Cyclom X.25 firmware API definitions.
5*
6* Author: Arnaldo Carvalho de Melo <acme@conectiva.com.br>
7*
8* Copyright: (c) 1998-2003 Arnaldo Carvalho de Melo
9*
10* Based on sdla_x25.h by Gene Kozin <74604.152@compuserve.com>
11*
12* This program is free software; you can redistribute it and/or
13* modify it under the terms of the GNU General Public License
14* as published by the Free Software Foundation; either version
15* 2 of the License, or (at your option) any later version.
16* ============================================================================
17* 2000/04/02 acme dprintk and cycx_debug
18* 1999/01/03 acme judicious use of data types
19* 1999/01/02 acme #define X25_ACK_N3 0x4411
20* 1998/12/28 acme cleanup: lot'o'things removed
21* commands listed,
22* TX25Cmd & TX25Config structs
23* typedef'ed
24*/
25#ifndef PACKED
26#define PACKED __attribute__((packed))
27#endif
28
29/* X.25 shared memory layout. */
30#define X25_MBOX_OFFS 0x300 /* general mailbox block */
31#define X25_RXMBOX_OFFS 0x340 /* receive mailbox */
32
33/* Debug */
34#define dprintk(level, format, a...) if (cycx_debug >= level) printk(format, ##a)
35
36extern unsigned int cycx_debug;
37
38/* Data Structures */
39/* X.25 Command Block. */
40struct cycx_x25_cmd {
41 u16 command;
42 u16 link; /* values: 0 or 1 */
43 u16 len; /* values: 0 thru 0x205 (517) */
44 u32 buf;
45} PACKED;
46
47/* Defines for the 'command' field. */
48#define X25_CONNECT_REQUEST 0x4401
49#define X25_CONNECT_RESPONSE 0x4402
50#define X25_DISCONNECT_REQUEST 0x4403
51#define X25_DISCONNECT_RESPONSE 0x4404
52#define X25_DATA_REQUEST 0x4405
53#define X25_ACK_TO_VC 0x4406
54#define X25_INTERRUPT_RESPONSE 0x4407
55#define X25_CONFIG 0x4408
56#define X25_CONNECT_INDICATION 0x4409
57#define X25_CONNECT_CONFIRM 0x440A
58#define X25_DISCONNECT_INDICATION 0x440B
59#define X25_DISCONNECT_CONFIRM 0x440C
60#define X25_DATA_INDICATION 0x440E
61#define X25_INTERRUPT_INDICATION 0x440F
62#define X25_ACK_FROM_VC 0x4410
63#define X25_ACK_N3 0x4411
64#define X25_CONNECT_COLLISION 0x4413
65#define X25_N3WIN 0x4414
66#define X25_LINE_ON 0x4415
67#define X25_LINE_OFF 0x4416
68#define X25_RESET_REQUEST 0x4417
69#define X25_LOG 0x4500
70#define X25_STATISTIC 0x4600
71#define X25_TRACE 0x4700
72#define X25_N2TRACEXC 0x4702
73#define X25_N3TRACEXC 0x4703
74
75/**
76 * struct cycx_x25_config - cyclom2x x25 firmware configuration
77 * @link - link number
78 * @speed - line speed
79 * @clock - internal/external
80 * @n2 - # of level 2 retransm.(values: 1 thru FF)
81 * @n2win - level 2 window (values: 1 thru 7)
82 * @n3win - level 3 window (values: 1 thru 7)
83 * @nvc - # of logical channels (values: 1 thru 64)
84 * @pktlen - level 3 packet length - log base 2 of size
85 * @locaddr - my address
86 * @remaddr - remote address
87 * @t1 - time, in seconds
88 * @t2 - time, in seconds
89 * @t21 - time, in seconds
90 * @npvc - # of permanent virt. circuits (1 thru nvc)
91 * @t23 - time, in seconds
92 * @flags - see dosx25.doc, in portuguese, for details
93 */
94struct cycx_x25_config {
95 u8 link;
96 u8 speed;
97 u8 clock;
98 u8 n2;
99 u8 n2win;
100 u8 n3win;
101 u8 nvc;
102 u8 pktlen;
103 u8 locaddr;
104 u8 remaddr;
105 u16 t1;
106 u16 t2;
107 u8 t21;
108 u8 npvc;
109 u8 t23;
110 u8 flags;
111} PACKED;
112
113struct cycx_x25_stats {
114 u16 rx_crc_errors;
115 u16 rx_over_errors;
116 u16 n2_tx_frames;
117 u16 n2_rx_frames;
118 u16 tx_timeouts;
119 u16 rx_timeouts;
120 u16 n3_tx_packets;
121 u16 n3_rx_packets;
122 u16 tx_aborts;
123 u16 rx_aborts;
124} PACKED;
125#endif /* _CYCX_X25_H */
diff --git a/include/linux/etherdevice.h b/include/linux/etherdevice.h
index 9c5529dc6d07..733980fce8e3 100644
--- a/include/linux/etherdevice.h
+++ b/include/linux/etherdevice.h
@@ -29,6 +29,7 @@
29#include <asm/bitsperlong.h> 29#include <asm/bitsperlong.h>
30 30
31#ifdef __KERNEL__ 31#ifdef __KERNEL__
32u32 eth_get_headlen(void *data, unsigned int max_len);
32__be16 eth_type_trans(struct sk_buff *skb, struct net_device *dev); 33__be16 eth_type_trans(struct sk_buff *skb, struct net_device *dev);
33extern const struct header_ops eth_header_ops; 34extern const struct header_ops eth_header_ops;
34 35
diff --git a/include/linux/ethtool.h b/include/linux/ethtool.h
index e658229fee39..c1a2d60dfb82 100644
--- a/include/linux/ethtool.h
+++ b/include/linux/ethtool.h
@@ -257,6 +257,10 @@ struct ethtool_ops {
257 struct ethtool_eeprom *, u8 *); 257 struct ethtool_eeprom *, u8 *);
258 int (*get_eee)(struct net_device *, struct ethtool_eee *); 258 int (*get_eee)(struct net_device *, struct ethtool_eee *);
259 int (*set_eee)(struct net_device *, struct ethtool_eee *); 259 int (*set_eee)(struct net_device *, struct ethtool_eee *);
260 int (*get_tunable)(struct net_device *,
261 const struct ethtool_tunable *, void *);
262 int (*set_tunable)(struct net_device *,
263 const struct ethtool_tunable *, const void *);
260 264
261 265
262}; 266};
diff --git a/include/linux/filter.h b/include/linux/filter.h
index a5227ab8ccb1..1a0bc6d134d7 100644
--- a/include/linux/filter.h
+++ b/include/linux/filter.h
@@ -4,58 +4,23 @@
4#ifndef __LINUX_FILTER_H__ 4#ifndef __LINUX_FILTER_H__
5#define __LINUX_FILTER_H__ 5#define __LINUX_FILTER_H__
6 6
7#include <stdarg.h>
8
7#include <linux/atomic.h> 9#include <linux/atomic.h>
8#include <linux/compat.h> 10#include <linux/compat.h>
9#include <linux/skbuff.h> 11#include <linux/skbuff.h>
12#include <linux/linkage.h>
13#include <linux/printk.h>
10#include <linux/workqueue.h> 14#include <linux/workqueue.h>
11#include <uapi/linux/filter.h>
12 15
13/* Internally used and optimized filter representation with extended 16#include <asm/cacheflush.h>
14 * instruction set based on top of classic BPF.
15 */
16 17
17/* instruction classes */ 18#include <uapi/linux/filter.h>
18#define BPF_ALU64 0x07 /* alu mode in double word width */ 19#include <uapi/linux/bpf.h>
19
20/* ld/ldx fields */
21#define BPF_DW 0x18 /* double word */
22#define BPF_XADD 0xc0 /* exclusive add */
23
24/* alu/jmp fields */
25#define BPF_MOV 0xb0 /* mov reg to reg */
26#define BPF_ARSH 0xc0 /* sign extending arithmetic shift right */
27
28/* change endianness of a register */
29#define BPF_END 0xd0 /* flags for endianness conversion: */
30#define BPF_TO_LE 0x00 /* convert to little-endian */
31#define BPF_TO_BE 0x08 /* convert to big-endian */
32#define BPF_FROM_LE BPF_TO_LE
33#define BPF_FROM_BE BPF_TO_BE
34
35#define BPF_JNE 0x50 /* jump != */
36#define BPF_JSGT 0x60 /* SGT is signed '>', GT in x86 */
37#define BPF_JSGE 0x70 /* SGE is signed '>=', GE in x86 */
38#define BPF_CALL 0x80 /* function call */
39#define BPF_EXIT 0x90 /* function return */
40
41/* Register numbers */
42enum {
43 BPF_REG_0 = 0,
44 BPF_REG_1,
45 BPF_REG_2,
46 BPF_REG_3,
47 BPF_REG_4,
48 BPF_REG_5,
49 BPF_REG_6,
50 BPF_REG_7,
51 BPF_REG_8,
52 BPF_REG_9,
53 BPF_REG_10,
54 __MAX_BPF_REG,
55};
56 20
57/* BPF has 10 general purpose 64-bit registers and stack frame. */ 21struct sk_buff;
58#define MAX_BPF_REG __MAX_BPF_REG 22struct sock;
23struct seccomp_data;
59 24
60/* ArgX, context and stack frame pointer register positions. Note, 25/* ArgX, context and stack frame pointer register positions. Note,
61 * Arg1, Arg2, Arg3, etc are used as argument mappings of function 26 * Arg1, Arg2, Arg3, etc are used as argument mappings of function
@@ -161,6 +126,24 @@ enum {
161 .off = 0, \ 126 .off = 0, \
162 .imm = IMM }) 127 .imm = IMM })
163 128
129/* BPF_LD_IMM64 macro encodes single 'load 64-bit immediate' insn */
130#define BPF_LD_IMM64(DST, IMM) \
131 BPF_LD_IMM64_RAW(DST, 0, IMM)
132
133#define BPF_LD_IMM64_RAW(DST, SRC, IMM) \
134 ((struct bpf_insn) { \
135 .code = BPF_LD | BPF_DW | BPF_IMM, \
136 .dst_reg = DST, \
137 .src_reg = SRC, \
138 .off = 0, \
139 .imm = (__u32) (IMM) }), \
140 ((struct bpf_insn) { \
141 .code = 0, /* zero is reserved opcode */ \
142 .dst_reg = 0, \
143 .src_reg = 0, \
144 .off = 0, \
145 .imm = ((__u64) (IMM)) >> 32 })
146
164/* Short form of mov based on type, BPF_X: dst_reg = src_reg, BPF_K: dst_reg = imm32 */ 147/* Short form of mov based on type, BPF_X: dst_reg = src_reg, BPF_K: dst_reg = imm32 */
165 148
166#define BPF_MOV64_RAW(TYPE, DST, SRC, IMM) \ 149#define BPF_MOV64_RAW(TYPE, DST, SRC, IMM) \
@@ -299,14 +282,6 @@ enum {
299#define SK_RUN_FILTER(filter, ctx) \ 282#define SK_RUN_FILTER(filter, ctx) \
300 (*filter->prog->bpf_func)(ctx, filter->prog->insnsi) 283 (*filter->prog->bpf_func)(ctx, filter->prog->insnsi)
301 284
302struct bpf_insn {
303 __u8 code; /* opcode */
304 __u8 dst_reg:4; /* dest register */
305 __u8 src_reg:4; /* source register */
306 __s16 off; /* signed offset */
307 __s32 imm; /* signed immediate constant */
308};
309
310#ifdef CONFIG_COMPAT 285#ifdef CONFIG_COMPAT
311/* A struct sock_filter is architecture independent. */ 286/* A struct sock_filter is architecture independent. */
312struct compat_sock_fprog { 287struct compat_sock_fprog {
@@ -320,20 +295,28 @@ struct sock_fprog_kern {
320 struct sock_filter *filter; 295 struct sock_filter *filter;
321}; 296};
322 297
323struct sk_buff; 298struct bpf_binary_header {
324struct sock; 299 unsigned int pages;
325struct seccomp_data; 300 u8 image[];
301};
302
303struct bpf_work_struct {
304 struct bpf_prog *prog;
305 struct work_struct work;
306};
326 307
327struct bpf_prog { 308struct bpf_prog {
328 u32 jited:1, /* Is our filter JIT'ed? */ 309 u16 pages; /* Number of allocated pages */
329 len:31; /* Number of filter blocks */ 310 bool jited; /* Is our filter JIT'ed? */
311 u32 len; /* Number of filter blocks */
330 struct sock_fprog_kern *orig_prog; /* Original BPF program */ 312 struct sock_fprog_kern *orig_prog; /* Original BPF program */
313 struct bpf_work_struct *work; /* Deferred free work struct */
331 unsigned int (*bpf_func)(const struct sk_buff *skb, 314 unsigned int (*bpf_func)(const struct sk_buff *skb,
332 const struct bpf_insn *filter); 315 const struct bpf_insn *filter);
316 /* Instructions for interpreter */
333 union { 317 union {
334 struct sock_filter insns[0]; 318 struct sock_filter insns[0];
335 struct bpf_insn insnsi[0]; 319 struct bpf_insn insnsi[0];
336 struct work_struct work;
337 }; 320 };
338}; 321};
339 322
@@ -353,6 +336,26 @@ static inline unsigned int bpf_prog_size(unsigned int proglen)
353 336
354#define bpf_classic_proglen(fprog) (fprog->len * sizeof(fprog->filter[0])) 337#define bpf_classic_proglen(fprog) (fprog->len * sizeof(fprog->filter[0]))
355 338
339#ifdef CONFIG_DEBUG_SET_MODULE_RONX
340static inline void bpf_prog_lock_ro(struct bpf_prog *fp)
341{
342 set_memory_ro((unsigned long)fp, fp->pages);
343}
344
345static inline void bpf_prog_unlock_ro(struct bpf_prog *fp)
346{
347 set_memory_rw((unsigned long)fp, fp->pages);
348}
349#else
350static inline void bpf_prog_lock_ro(struct bpf_prog *fp)
351{
352}
353
354static inline void bpf_prog_unlock_ro(struct bpf_prog *fp)
355{
356}
357#endif /* CONFIG_DEBUG_SET_MODULE_RONX */
358
356int sk_filter(struct sock *sk, struct sk_buff *skb); 359int sk_filter(struct sock *sk, struct sk_buff *skb);
357 360
358void bpf_prog_select_runtime(struct bpf_prog *fp); 361void bpf_prog_select_runtime(struct bpf_prog *fp);
@@ -361,6 +364,17 @@ void bpf_prog_free(struct bpf_prog *fp);
361int bpf_convert_filter(struct sock_filter *prog, int len, 364int bpf_convert_filter(struct sock_filter *prog, int len,
362 struct bpf_insn *new_prog, int *new_len); 365 struct bpf_insn *new_prog, int *new_len);
363 366
367struct bpf_prog *bpf_prog_alloc(unsigned int size, gfp_t gfp_extra_flags);
368struct bpf_prog *bpf_prog_realloc(struct bpf_prog *fp_old, unsigned int size,
369 gfp_t gfp_extra_flags);
370void __bpf_prog_free(struct bpf_prog *fp);
371
372static inline void bpf_prog_unlock_free(struct bpf_prog *fp)
373{
374 bpf_prog_unlock_ro(fp);
375 __bpf_prog_free(fp);
376}
377
364int bpf_prog_create(struct bpf_prog **pfp, struct sock_fprog_kern *fprog); 378int bpf_prog_create(struct bpf_prog **pfp, struct sock_fprog_kern *fprog);
365void bpf_prog_destroy(struct bpf_prog *fp); 379void bpf_prog_destroy(struct bpf_prog *fp);
366 380
@@ -377,6 +391,38 @@ void sk_filter_uncharge(struct sock *sk, struct sk_filter *fp);
377u64 __bpf_call_base(u64 r1, u64 r2, u64 r3, u64 r4, u64 r5); 391u64 __bpf_call_base(u64 r1, u64 r2, u64 r3, u64 r4, u64 r5);
378void bpf_int_jit_compile(struct bpf_prog *fp); 392void bpf_int_jit_compile(struct bpf_prog *fp);
379 393
394#ifdef CONFIG_BPF_JIT
395typedef void (*bpf_jit_fill_hole_t)(void *area, unsigned int size);
396
397struct bpf_binary_header *
398bpf_jit_binary_alloc(unsigned int proglen, u8 **image_ptr,
399 unsigned int alignment,
400 bpf_jit_fill_hole_t bpf_fill_ill_insns);
401void bpf_jit_binary_free(struct bpf_binary_header *hdr);
402
403void bpf_jit_compile(struct bpf_prog *fp);
404void bpf_jit_free(struct bpf_prog *fp);
405
406static inline void bpf_jit_dump(unsigned int flen, unsigned int proglen,
407 u32 pass, void *image)
408{
409 pr_err("flen=%u proglen=%u pass=%u image=%pK\n",
410 flen, proglen, pass, image);
411 if (image)
412 print_hex_dump(KERN_ERR, "JIT code: ", DUMP_PREFIX_OFFSET,
413 16, 1, image, proglen, false);
414}
415#else
416static inline void bpf_jit_compile(struct bpf_prog *fp)
417{
418}
419
420static inline void bpf_jit_free(struct bpf_prog *fp)
421{
422 bpf_prog_unlock_free(fp);
423}
424#endif /* CONFIG_BPF_JIT */
425
380#define BPF_ANC BIT(15) 426#define BPF_ANC BIT(15)
381 427
382static inline u16 bpf_anc_helper(const struct sock_filter *ftest) 428static inline u16 bpf_anc_helper(const struct sock_filter *ftest)
@@ -424,36 +470,6 @@ static inline void *bpf_load_pointer(const struct sk_buff *skb, int k,
424 return bpf_internal_load_pointer_neg_helper(skb, k, size); 470 return bpf_internal_load_pointer_neg_helper(skb, k, size);
425} 471}
426 472
427#ifdef CONFIG_BPF_JIT
428#include <stdarg.h>
429#include <linux/linkage.h>
430#include <linux/printk.h>
431
432void bpf_jit_compile(struct bpf_prog *fp);
433void bpf_jit_free(struct bpf_prog *fp);
434
435static inline void bpf_jit_dump(unsigned int flen, unsigned int proglen,
436 u32 pass, void *image)
437{
438 pr_err("flen=%u proglen=%u pass=%u image=%pK\n",
439 flen, proglen, pass, image);
440 if (image)
441 print_hex_dump(KERN_ERR, "JIT code: ", DUMP_PREFIX_OFFSET,
442 16, 1, image, proglen, false);
443}
444#else
445#include <linux/slab.h>
446
447static inline void bpf_jit_compile(struct bpf_prog *fp)
448{
449}
450
451static inline void bpf_jit_free(struct bpf_prog *fp)
452{
453 kfree(fp);
454}
455#endif /* CONFIG_BPF_JIT */
456
457static inline int bpf_tell_extensions(void) 473static inline int bpf_tell_extensions(void)
458{ 474{
459 return SKF_AD_MAX; 475 return SKF_AD_MAX;
diff --git a/include/linux/i82593.h b/include/linux/i82593.h
deleted file mode 100644
index afac5c7a323d..000000000000
--- a/include/linux/i82593.h
+++ /dev/null
@@ -1,229 +0,0 @@
1/*
2 * Definitions for Intel 82593 CSMA/CD Core LAN Controller
3 * The definitions are taken from the 1992 users manual with Intel
4 * order number 297125-001.
5 *
6 * /usr/src/pc/RCS/i82593.h,v 1.1 1996/07/17 15:23:12 root Exp
7 *
8 * Copyright 1994, Anders Klemets <klemets@it.kth.se>
9 *
10 * HISTORY
11 * i82593.h,v
12 * Revision 1.4 2005/11/4 09:15:00 baroniunas
13 * Modified copyright with permission of author as follows:
14 *
15 * "If I82539.H is the only file with my copyright statement
16 * that is included in the Source Forge project, then you have
17 * my approval to change the copyright statement to be a GPL
18 * license, in the way you proposed on October 10."
19 *
20 * Revision 1.1 1996/07/17 15:23:12 root
21 * Initial revision
22 *
23 * Revision 1.3 1995/04/05 15:13:58 adj
24 * Initial alpha release
25 *
26 * Revision 1.2 1994/06/16 23:57:31 klemets
27 * Mirrored all the fields in the configuration block.
28 *
29 * Revision 1.1 1994/06/02 20:25:34 klemets
30 * Initial revision
31 *
32 *
33 */
34#ifndef _I82593_H
35#define _I82593_H
36
37/* Intel 82593 CSMA/CD Core LAN Controller */
38
39/* Port 0 Command Register definitions */
40
41/* Execution operations */
42#define OP0_NOP 0 /* CHNL = 0 */
43#define OP0_SWIT_TO_PORT_1 0 /* CHNL = 1 */
44#define OP0_IA_SETUP 1
45#define OP0_CONFIGURE 2
46#define OP0_MC_SETUP 3
47#define OP0_TRANSMIT 4
48#define OP0_TDR 5
49#define OP0_DUMP 6
50#define OP0_DIAGNOSE 7
51#define OP0_TRANSMIT_NO_CRC 9
52#define OP0_RETRANSMIT 12
53#define OP0_ABORT 13
54/* Reception operations */
55#define OP0_RCV_ENABLE 8
56#define OP0_RCV_DISABLE 10
57#define OP0_STOP_RCV 11
58/* Status pointer control operations */
59#define OP0_FIX_PTR 15 /* CHNL = 1 */
60#define OP0_RLS_PTR 15 /* CHNL = 0 */
61#define OP0_RESET 14
62
63#define CR0_CHNL (1 << 4) /* 0=Channel 0, 1=Channel 1 */
64#define CR0_STATUS_0 0x00
65#define CR0_STATUS_1 0x20
66#define CR0_STATUS_2 0x40
67#define CR0_STATUS_3 0x60
68#define CR0_INT_ACK (1 << 7) /* 0=No ack, 1=acknowledge */
69
70/* Port 0 Status Register definitions */
71
72#define SR0_NO_RESULT 0 /* dummy */
73#define SR0_EVENT_MASK 0x0f
74#define SR0_IA_SETUP_DONE 1
75#define SR0_CONFIGURE_DONE 2
76#define SR0_MC_SETUP_DONE 3
77#define SR0_TRANSMIT_DONE 4
78#define SR0_TDR_DONE 5
79#define SR0_DUMP_DONE 6
80#define SR0_DIAGNOSE_PASSED 7
81#define SR0_TRANSMIT_NO_CRC_DONE 9
82#define SR0_RETRANSMIT_DONE 12
83#define SR0_EXECUTION_ABORTED 13
84#define SR0_END_OF_FRAME 8
85#define SR0_RECEPTION_ABORTED 10
86#define SR0_DIAGNOSE_FAILED 15
87#define SR0_STOP_REG_HIT 11
88
89#define SR0_CHNL (1 << 4)
90#define SR0_EXECUTION (1 << 5)
91#define SR0_RECEPTION (1 << 6)
92#define SR0_INTERRUPT (1 << 7)
93#define SR0_BOTH_RX_TX (SR0_EXECUTION | SR0_RECEPTION)
94
95#define SR3_EXEC_STATE_MASK 0x03
96#define SR3_EXEC_IDLE 0
97#define SR3_TX_ABORT_IN_PROGRESS 1
98#define SR3_EXEC_ACTIVE 2
99#define SR3_ABORT_IN_PROGRESS 3
100#define SR3_EXEC_CHNL (1 << 2)
101#define SR3_STP_ON_NO_RSRC (1 << 3)
102#define SR3_RCVING_NO_RSRC (1 << 4)
103#define SR3_RCV_STATE_MASK 0x60
104#define SR3_RCV_IDLE 0x00
105#define SR3_RCV_READY 0x20
106#define SR3_RCV_ACTIVE 0x40
107#define SR3_RCV_STOP_IN_PROG 0x60
108#define SR3_RCV_CHNL (1 << 7)
109
110/* Port 1 Command Register definitions */
111
112#define OP1_NOP 0
113#define OP1_SWIT_TO_PORT_0 1
114#define OP1_INT_DISABLE 2
115#define OP1_INT_ENABLE 3
116#define OP1_SET_TS 5
117#define OP1_RST_TS 7
118#define OP1_POWER_DOWN 8
119#define OP1_RESET_RING_MNGMT 11
120#define OP1_RESET 14
121#define OP1_SEL_RST 15
122
123#define CR1_STATUS_4 0x00
124#define CR1_STATUS_5 0x20
125#define CR1_STATUS_6 0x40
126#define CR1_STOP_REG_UPDATE (1 << 7)
127
128/* Receive frame status bits */
129
130#define RX_RCLD (1 << 0)
131#define RX_IA_MATCH (1 << 1)
132#define RX_NO_AD_MATCH (1 << 2)
133#define RX_NO_SFD (1 << 3)
134#define RX_SRT_FRM (1 << 7)
135#define RX_OVRRUN (1 << 8)
136#define RX_ALG_ERR (1 << 10)
137#define RX_CRC_ERR (1 << 11)
138#define RX_LEN_ERR (1 << 12)
139#define RX_RCV_OK (1 << 13)
140#define RX_TYP_LEN (1 << 15)
141
142/* Transmit status bits */
143
144#define TX_NCOL_MASK 0x0f
145#define TX_FRTL (1 << 4)
146#define TX_MAX_COL (1 << 5)
147#define TX_HRT_BEAT (1 << 6)
148#define TX_DEFER (1 << 7)
149#define TX_UND_RUN (1 << 8)
150#define TX_LOST_CTS (1 << 9)
151#define TX_LOST_CRS (1 << 10)
152#define TX_LTCOL (1 << 11)
153#define TX_OK (1 << 13)
154#define TX_COLL (1 << 15)
155
156struct i82593_conf_block {
157 u_char fifo_limit : 4,
158 forgnesi : 1,
159 fifo_32 : 1,
160 d6mod : 1,
161 throttle_enb : 1;
162 u_char throttle : 6,
163 cntrxint : 1,
164 contin : 1;
165 u_char addr_len : 3,
166 acloc : 1,
167 preamb_len : 2,
168 loopback : 2;
169 u_char lin_prio : 3,
170 tbofstop : 1,
171 exp_prio : 3,
172 bof_met : 1;
173 u_char : 4,
174 ifrm_spc : 4;
175 u_char : 5,
176 slottim_low : 3;
177 u_char slottim_hi : 3,
178 : 1,
179 max_retr : 4;
180 u_char prmisc : 1,
181 bc_dis : 1,
182 : 1,
183 crs_1 : 1,
184 nocrc_ins : 1,
185 crc_1632 : 1,
186 : 1,
187 crs_cdt : 1;
188 u_char cs_filter : 3,
189 crs_src : 1,
190 cd_filter : 3,
191 : 1;
192 u_char : 2,
193 min_fr_len : 6;
194 u_char lng_typ : 1,
195 lng_fld : 1,
196 rxcrc_xf : 1,
197 artx : 1,
198 sarec : 1,
199 tx_jabber : 1, /* why is this called max_len in the manual? */
200 hash_1 : 1,
201 lbpkpol : 1;
202 u_char : 6,
203 fdx : 1,
204 : 1;
205 u_char dummy_6 : 6, /* supposed to be ones */
206 mult_ia : 1,
207 dis_bof : 1;
208 u_char dummy_1 : 1, /* supposed to be one */
209 tx_ifs_retrig : 2,
210 mc_all : 1,
211 rcv_mon : 2,
212 frag_acpt : 1,
213 tstrttrs : 1;
214 u_char fretx : 1,
215 runt_eop : 1,
216 hw_sw_pin : 1,
217 big_endn : 1,
218 syncrqs : 1,
219 sttlen : 1,
220 tx_eop : 1,
221 rx_eop : 1;
222 u_char rbuf_size : 5,
223 rcvstop : 1,
224 : 2;
225};
226
227#define I82593_MAX_MULTICAST_ADDRESSES 128 /* Hardware hashed filter */
228
229#endif /* _I82593_H */
diff --git a/include/linux/ieee80211.h b/include/linux/ieee80211.h
index 63ab3873c5ed..8018c915ee63 100644
--- a/include/linux/ieee80211.h
+++ b/include/linux/ieee80211.h
@@ -838,6 +838,16 @@ enum ieee80211_vht_opmode_bits {
838 838
839#define WLAN_SA_QUERY_TR_ID_LEN 2 839#define WLAN_SA_QUERY_TR_ID_LEN 2
840 840
841/**
842 * struct ieee80211_tpc_report_ie
843 *
844 * This structure refers to "TPC Report element"
845 */
846struct ieee80211_tpc_report_ie {
847 u8 tx_power;
848 u8 link_margin;
849} __packed;
850
841struct ieee80211_mgmt { 851struct ieee80211_mgmt {
842 __le16 frame_control; 852 __le16 frame_control;
843 __le16 duration; 853 __le16 duration;
@@ -973,6 +983,13 @@ struct ieee80211_mgmt {
973 u8 action_code; 983 u8 action_code;
974 u8 operating_mode; 984 u8 operating_mode;
975 } __packed vht_opmode_notif; 985 } __packed vht_opmode_notif;
986 struct {
987 u8 action_code;
988 u8 dialog_token;
989 u8 tpc_elem_id;
990 u8 tpc_elem_length;
991 struct ieee80211_tpc_report_ie tpc;
992 } __packed tpc_report;
976 } u; 993 } u;
977 } __packed action; 994 } __packed action;
978 } u; 995 } u;
@@ -1865,6 +1882,7 @@ enum ieee80211_category {
1865 WLAN_CATEGORY_DLS = 2, 1882 WLAN_CATEGORY_DLS = 2,
1866 WLAN_CATEGORY_BACK = 3, 1883 WLAN_CATEGORY_BACK = 3,
1867 WLAN_CATEGORY_PUBLIC = 4, 1884 WLAN_CATEGORY_PUBLIC = 4,
1885 WLAN_CATEGORY_RADIO_MEASUREMENT = 5,
1868 WLAN_CATEGORY_HT = 7, 1886 WLAN_CATEGORY_HT = 7,
1869 WLAN_CATEGORY_SA_QUERY = 8, 1887 WLAN_CATEGORY_SA_QUERY = 8,
1870 WLAN_CATEGORY_PROTECTED_DUAL_OF_ACTION = 9, 1888 WLAN_CATEGORY_PROTECTED_DUAL_OF_ACTION = 9,
@@ -2378,4 +2396,51 @@ static inline bool ieee80211_check_tim(const struct ieee80211_tim_ie *tim,
2378#define TU_TO_JIFFIES(x) (usecs_to_jiffies((x) * 1024)) 2396#define TU_TO_JIFFIES(x) (usecs_to_jiffies((x) * 1024))
2379#define TU_TO_EXP_TIME(x) (jiffies + TU_TO_JIFFIES(x)) 2397#define TU_TO_EXP_TIME(x) (jiffies + TU_TO_JIFFIES(x))
2380 2398
2399/**
2400 * ieee80211_action_contains_tpc - checks if the frame contains TPC element
2401 * @skb: the skb containing the frame, length will be checked
2402 *
2403 * This function checks if it's either TPC report action frame or Link
2404 * Measurement report action frame as defined in IEEE Std. 802.11-2012 8.5.2.5
2405 * and 8.5.7.5 accordingly.
2406 */
2407static inline bool ieee80211_action_contains_tpc(struct sk_buff *skb)
2408{
2409 struct ieee80211_mgmt *mgmt = (void *)skb->data;
2410
2411 if (!ieee80211_is_action(mgmt->frame_control))
2412 return false;
2413
2414 if (skb->len < IEEE80211_MIN_ACTION_SIZE +
2415 sizeof(mgmt->u.action.u.tpc_report))
2416 return false;
2417
2418 /*
2419 * TPC report - check that:
2420 * category = 0 (Spectrum Management) or 5 (Radio Measurement)
2421 * spectrum management action = 3 (TPC/Link Measurement report)
2422 * TPC report EID = 35
2423 * TPC report element length = 2
2424 *
2425 * The spectrum management's tpc_report struct is used here both for
2426 * parsing tpc_report and radio measurement's link measurement report
2427 * frame, since the relevant part is identical in both frames.
2428 */
2429 if (mgmt->u.action.category != WLAN_CATEGORY_SPECTRUM_MGMT &&
2430 mgmt->u.action.category != WLAN_CATEGORY_RADIO_MEASUREMENT)
2431 return false;
2432
2433 /* both spectrum mgmt and link measurement have same action code */
2434 if (mgmt->u.action.u.tpc_report.action_code !=
2435 WLAN_ACTION_SPCT_TPC_RPRT)
2436 return false;
2437
2438 if (mgmt->u.action.u.tpc_report.tpc_elem_id != WLAN_EID_TPC_REPORT ||
2439 mgmt->u.action.u.tpc_report.tpc_elem_length !=
2440 sizeof(struct ieee80211_tpc_report_ie))
2441 return false;
2442
2443 return true;
2444}
2445
2381#endif /* LINUX_IEEE80211_H */ 2446#endif /* LINUX_IEEE80211_H */
diff --git a/include/linux/igmp.h b/include/linux/igmp.h
index f47550d75f85..2c677afeea47 100644
--- a/include/linux/igmp.h
+++ b/include/linux/igmp.h
@@ -39,6 +39,7 @@ static inline struct igmpv3_query *
39 39
40extern int sysctl_igmp_max_memberships; 40extern int sysctl_igmp_max_memberships;
41extern int sysctl_igmp_max_msf; 41extern int sysctl_igmp_max_msf;
42extern int sysctl_igmp_qrv;
42 43
43struct ip_sf_socklist { 44struct ip_sf_socklist {
44 unsigned int sl_max; 45 unsigned int sl_max;
diff --git a/include/linux/mlx4/device.h b/include/linux/mlx4/device.h
index a5b7d7cfcedf..03b5608a4329 100644
--- a/include/linux/mlx4/device.h
+++ b/include/linux/mlx4/device.h
@@ -38,6 +38,7 @@
38#include <linux/completion.h> 38#include <linux/completion.h>
39#include <linux/radix-tree.h> 39#include <linux/radix-tree.h>
40#include <linux/cpu_rmap.h> 40#include <linux/cpu_rmap.h>
41#include <linux/crash_dump.h>
41 42
42#include <linux/atomic.h> 43#include <linux/atomic.h>
43 44
@@ -184,19 +185,24 @@ enum {
184 MLX4_DEV_CAP_FLAG2_DMFS_IPOIB = 1LL << 9, 185 MLX4_DEV_CAP_FLAG2_DMFS_IPOIB = 1LL << 9,
185 MLX4_DEV_CAP_FLAG2_VXLAN_OFFLOADS = 1LL << 10, 186 MLX4_DEV_CAP_FLAG2_VXLAN_OFFLOADS = 1LL << 10,
186 MLX4_DEV_CAP_FLAG2_MAD_DEMUX = 1LL << 11, 187 MLX4_DEV_CAP_FLAG2_MAD_DEMUX = 1LL << 11,
188 MLX4_DEV_CAP_FLAG2_CQE_STRIDE = 1LL << 12,
189 MLX4_DEV_CAP_FLAG2_EQE_STRIDE = 1LL << 13
187}; 190};
188 191
189enum { 192enum {
190 MLX4_DEV_CAP_64B_EQE_ENABLED = 1LL << 0, 193 MLX4_DEV_CAP_64B_EQE_ENABLED = 1LL << 0,
191 MLX4_DEV_CAP_64B_CQE_ENABLED = 1LL << 1 194 MLX4_DEV_CAP_64B_CQE_ENABLED = 1LL << 1,
195 MLX4_DEV_CAP_CQE_STRIDE_ENABLED = 1LL << 2,
196 MLX4_DEV_CAP_EQE_STRIDE_ENABLED = 1LL << 3
192}; 197};
193 198
194enum { 199enum {
195 MLX4_USER_DEV_CAP_64B_CQE = 1L << 0 200 MLX4_USER_DEV_CAP_LARGE_CQE = 1L << 0
196}; 201};
197 202
198enum { 203enum {
199 MLX4_FUNC_CAP_64B_EQE_CQE = 1L << 0 204 MLX4_FUNC_CAP_64B_EQE_CQE = 1L << 0,
205 MLX4_FUNC_CAP_EQE_CQE_STRIDE = 1L << 1
200}; 206};
201 207
202 208
@@ -1279,7 +1285,7 @@ int mlx4_mr_rereg_mem_write(struct mlx4_dev *dev, struct mlx4_mr *mr,
1279/* Returns true if running in low memory profile (kdump kernel) */ 1285/* Returns true if running in low memory profile (kdump kernel) */
1280static inline bool mlx4_low_memory_profile(void) 1286static inline bool mlx4_low_memory_profile(void)
1281{ 1287{
1282 return reset_devices; 1288 return is_kdump_kernel();
1283} 1289}
1284 1290
1285#endif /* MLX4_DEVICE_H */ 1291#endif /* MLX4_DEVICE_H */
diff --git a/include/linux/netdevice.h b/include/linux/netdevice.h
index c8e388e5fccc..4354b4307e37 100644
--- a/include/linux/netdevice.h
+++ b/include/linux/netdevice.h
@@ -543,7 +543,7 @@ struct netdev_queue {
543 * read mostly part 543 * read mostly part
544 */ 544 */
545 struct net_device *dev; 545 struct net_device *dev;
546 struct Qdisc *qdisc; 546 struct Qdisc __rcu *qdisc;
547 struct Qdisc *qdisc_sleeping; 547 struct Qdisc *qdisc_sleeping;
548#ifdef CONFIG_SYSFS 548#ifdef CONFIG_SYSFS
549 struct kobject kobj; 549 struct kobject kobj;
@@ -1747,6 +1747,12 @@ struct netdev_queue *netdev_get_tx_queue(const struct net_device *dev,
1747 return &dev->_tx[index]; 1747 return &dev->_tx[index];
1748} 1748}
1749 1749
1750static inline struct netdev_queue *skb_get_tx_queue(const struct net_device *dev,
1751 const struct sk_buff *skb)
1752{
1753 return netdev_get_tx_queue(dev, skb_get_queue_mapping(skb));
1754}
1755
1750static inline void netdev_for_each_tx_queue(struct net_device *dev, 1756static inline void netdev_for_each_tx_queue(struct net_device *dev,
1751 void (*f)(struct net_device *, 1757 void (*f)(struct net_device *,
1752 struct netdev_queue *, 1758 struct netdev_queue *,
@@ -1781,24 +1787,13 @@ void dev_net_set(struct net_device *dev, struct net *net)
1781#endif 1787#endif
1782} 1788}
1783 1789
1784static inline bool netdev_uses_dsa_tags(struct net_device *dev) 1790static inline bool netdev_uses_dsa(struct net_device *dev)
1785{
1786#ifdef CONFIG_NET_DSA_TAG_DSA
1787 if (dev->dsa_ptr != NULL)
1788 return dsa_uses_dsa_tags(dev->dsa_ptr);
1789#endif
1790
1791 return 0;
1792}
1793
1794static inline bool netdev_uses_trailer_tags(struct net_device *dev)
1795{ 1791{
1796#ifdef CONFIG_NET_DSA_TAG_TRAILER 1792#if IS_ENABLED(CONFIG_NET_DSA)
1797 if (dev->dsa_ptr != NULL) 1793 if (dev->dsa_ptr != NULL)
1798 return dsa_uses_trailer_tags(dev->dsa_ptr); 1794 return dsa_uses_tagged_protocol(dev->dsa_ptr);
1799#endif 1795#endif
1800 1796 return false;
1801 return 0;
1802} 1797}
1803 1798
1804/** 1799/**
@@ -1879,11 +1874,17 @@ struct napi_gro_cb {
1879 /* jiffies when first packet was created/queued */ 1874 /* jiffies when first packet was created/queued */
1880 unsigned long age; 1875 unsigned long age;
1881 1876
1882 /* Used in ipv6_gro_receive() */ 1877 /* Used in ipv6_gro_receive() and foo-over-udp */
1883 u16 proto; 1878 u16 proto;
1884 1879
1885 /* Used in udp_gro_receive */ 1880 /* Used in udp_gro_receive */
1886 u16 udp_mark; 1881 u8 udp_mark:1;
1882
1883 /* GRO checksum is valid */
1884 u8 csum_valid:1;
1885
1886 /* Number of checksums via CHECKSUM_UNNECESSARY */
1887 u8 csum_cnt:3;
1887 1888
1888 /* used to support CHECKSUM_COMPLETE for tunneling protocols */ 1889 /* used to support CHECKSUM_COMPLETE for tunneling protocols */
1889 __wsum csum; 1890 __wsum csum;
@@ -1924,6 +1925,7 @@ struct packet_offload {
1924 1925
1925struct udp_offload { 1926struct udp_offload {
1926 __be16 port; 1927 __be16 port;
1928 u8 ipproto;
1927 struct offload_callbacks callbacks; 1929 struct offload_callbacks callbacks;
1928}; 1930};
1929 1931
@@ -1982,6 +1984,7 @@ struct pcpu_sw_netstats {
1982#define NETDEV_CHANGEUPPER 0x0015 1984#define NETDEV_CHANGEUPPER 0x0015
1983#define NETDEV_RESEND_IGMP 0x0016 1985#define NETDEV_RESEND_IGMP 0x0016
1984#define NETDEV_PRECHANGEMTU 0x0017 /* notify before mtu change happened */ 1986#define NETDEV_PRECHANGEMTU 0x0017 /* notify before mtu change happened */
1987#define NETDEV_CHANGEINFODATA 0x0018
1985 1988
1986int register_netdevice_notifier(struct notifier_block *nb); 1989int register_netdevice_notifier(struct notifier_block *nb);
1987int unregister_netdevice_notifier(struct notifier_block *nb); 1990int unregister_netdevice_notifier(struct notifier_block *nb);
@@ -2074,8 +2077,8 @@ void __dev_remove_pack(struct packet_type *pt);
2074void dev_add_offload(struct packet_offload *po); 2077void dev_add_offload(struct packet_offload *po);
2075void dev_remove_offload(struct packet_offload *po); 2078void dev_remove_offload(struct packet_offload *po);
2076 2079
2077struct net_device *dev_get_by_flags_rcu(struct net *net, unsigned short flags, 2080struct net_device *__dev_get_by_flags(struct net *net, unsigned short flags,
2078 unsigned short mask); 2081 unsigned short mask);
2079struct net_device *dev_get_by_name(struct net *net, const char *name); 2082struct net_device *dev_get_by_name(struct net *net, const char *name);
2080struct net_device *dev_get_by_name_rcu(struct net *net, const char *name); 2083struct net_device *dev_get_by_name_rcu(struct net *net, const char *name);
2081struct net_device *__dev_get_by_name(struct net *net, const char *name); 2084struct net_device *__dev_get_by_name(struct net *net, const char *name);
@@ -2153,11 +2156,97 @@ static inline void *skb_gro_network_header(struct sk_buff *skb)
2153static inline void skb_gro_postpull_rcsum(struct sk_buff *skb, 2156static inline void skb_gro_postpull_rcsum(struct sk_buff *skb,
2154 const void *start, unsigned int len) 2157 const void *start, unsigned int len)
2155{ 2158{
2156 if (skb->ip_summed == CHECKSUM_COMPLETE) 2159 if (NAPI_GRO_CB(skb)->csum_valid)
2157 NAPI_GRO_CB(skb)->csum = csum_sub(NAPI_GRO_CB(skb)->csum, 2160 NAPI_GRO_CB(skb)->csum = csum_sub(NAPI_GRO_CB(skb)->csum,
2158 csum_partial(start, len, 0)); 2161 csum_partial(start, len, 0));
2159} 2162}
2160 2163
2164/* GRO checksum functions. These are logical equivalents of the normal
2165 * checksum functions (in skbuff.h) except that they operate on the GRO
2166 * offsets and fields in sk_buff.
2167 */
2168
2169__sum16 __skb_gro_checksum_complete(struct sk_buff *skb);
2170
2171static inline bool __skb_gro_checksum_validate_needed(struct sk_buff *skb,
2172 bool zero_okay,
2173 __sum16 check)
2174{
2175 return (skb->ip_summed != CHECKSUM_PARTIAL &&
2176 NAPI_GRO_CB(skb)->csum_cnt == 0 &&
2177 (!zero_okay || check));
2178}
2179
2180static inline __sum16 __skb_gro_checksum_validate_complete(struct sk_buff *skb,
2181 __wsum psum)
2182{
2183 if (NAPI_GRO_CB(skb)->csum_valid &&
2184 !csum_fold(csum_add(psum, NAPI_GRO_CB(skb)->csum)))
2185 return 0;
2186
2187 NAPI_GRO_CB(skb)->csum = psum;
2188
2189 return __skb_gro_checksum_complete(skb);
2190}
2191
2192static inline void skb_gro_incr_csum_unnecessary(struct sk_buff *skb)
2193{
2194 if (NAPI_GRO_CB(skb)->csum_cnt > 0) {
2195 /* Consume a checksum from CHECKSUM_UNNECESSARY */
2196 NAPI_GRO_CB(skb)->csum_cnt--;
2197 } else {
2198 /* Update skb for CHECKSUM_UNNECESSARY and csum_level when we
2199 * verified a new top level checksum or an encapsulated one
2200 * during GRO. This saves work if we fallback to normal path.
2201 */
2202 __skb_incr_checksum_unnecessary(skb);
2203 }
2204}
2205
2206#define __skb_gro_checksum_validate(skb, proto, zero_okay, check, \
2207 compute_pseudo) \
2208({ \
2209 __sum16 __ret = 0; \
2210 if (__skb_gro_checksum_validate_needed(skb, zero_okay, check)) \
2211 __ret = __skb_gro_checksum_validate_complete(skb, \
2212 compute_pseudo(skb, proto)); \
2213 if (__ret) \
2214 __skb_mark_checksum_bad(skb); \
2215 else \
2216 skb_gro_incr_csum_unnecessary(skb); \
2217 __ret; \
2218})
2219
2220#define skb_gro_checksum_validate(skb, proto, compute_pseudo) \
2221 __skb_gro_checksum_validate(skb, proto, false, 0, compute_pseudo)
2222
2223#define skb_gro_checksum_validate_zero_check(skb, proto, check, \
2224 compute_pseudo) \
2225 __skb_gro_checksum_validate(skb, proto, true, check, compute_pseudo)
2226
2227#define skb_gro_checksum_simple_validate(skb) \
2228 __skb_gro_checksum_validate(skb, 0, false, 0, null_compute_pseudo)
2229
2230static inline bool __skb_gro_checksum_convert_check(struct sk_buff *skb)
2231{
2232 return (NAPI_GRO_CB(skb)->csum_cnt == 0 &&
2233 !NAPI_GRO_CB(skb)->csum_valid);
2234}
2235
2236static inline void __skb_gro_checksum_convert(struct sk_buff *skb,
2237 __sum16 check, __wsum pseudo)
2238{
2239 NAPI_GRO_CB(skb)->csum = ~pseudo;
2240 NAPI_GRO_CB(skb)->csum_valid = 1;
2241}
2242
2243#define skb_gro_checksum_try_convert(skb, proto, check, compute_pseudo) \
2244do { \
2245 if (__skb_gro_checksum_convert_check(skb)) \
2246 __skb_gro_checksum_convert(skb, check, \
2247 compute_pseudo(skb, proto)); \
2248} while (0)
2249
2161static inline int dev_hard_header(struct sk_buff *skb, struct net_device *dev, 2250static inline int dev_hard_header(struct sk_buff *skb, struct net_device *dev,
2162 unsigned short type, 2251 unsigned short type,
2163 const void *daddr, const void *saddr, 2252 const void *daddr, const void *saddr,
@@ -2261,12 +2350,7 @@ static inline void input_queue_tail_incr_save(struct softnet_data *sd,
2261DECLARE_PER_CPU_ALIGNED(struct softnet_data, softnet_data); 2350DECLARE_PER_CPU_ALIGNED(struct softnet_data, softnet_data);
2262 2351
2263void __netif_schedule(struct Qdisc *q); 2352void __netif_schedule(struct Qdisc *q);
2264 2353void netif_schedule_queue(struct netdev_queue *txq);
2265static inline void netif_schedule_queue(struct netdev_queue *txq)
2266{
2267 if (!(txq->state & QUEUE_STATE_ANY_XOFF))
2268 __netif_schedule(txq->qdisc);
2269}
2270 2354
2271static inline void netif_tx_schedule_all(struct net_device *dev) 2355static inline void netif_tx_schedule_all(struct net_device *dev)
2272{ 2356{
@@ -2302,11 +2386,7 @@ static inline void netif_tx_start_all_queues(struct net_device *dev)
2302 } 2386 }
2303} 2387}
2304 2388
2305static inline void netif_tx_wake_queue(struct netdev_queue *dev_queue) 2389void netif_tx_wake_queue(struct netdev_queue *dev_queue);
2306{
2307 if (test_and_clear_bit(__QUEUE_STATE_DRV_XOFF, &dev_queue->state))
2308 __netif_schedule(dev_queue->qdisc);
2309}
2310 2390
2311/** 2391/**
2312 * netif_wake_queue - restart transmit 2392 * netif_wake_queue - restart transmit
@@ -2578,19 +2658,7 @@ static inline bool netif_subqueue_stopped(const struct net_device *dev,
2578 return __netif_subqueue_stopped(dev, skb_get_queue_mapping(skb)); 2658 return __netif_subqueue_stopped(dev, skb_get_queue_mapping(skb));
2579} 2659}
2580 2660
2581/** 2661void netif_wake_subqueue(struct net_device *dev, u16 queue_index);
2582 * netif_wake_subqueue - allow sending packets on subqueue
2583 * @dev: network device
2584 * @queue_index: sub queue index
2585 *
2586 * Resume individual transmit queue of a device with multiple transmit queues.
2587 */
2588static inline void netif_wake_subqueue(struct net_device *dev, u16 queue_index)
2589{
2590 struct netdev_queue *txq = netdev_get_tx_queue(dev, queue_index);
2591 if (test_and_clear_bit(__QUEUE_STATE_DRV_XOFF, &txq->state))
2592 __netif_schedule(txq->qdisc);
2593}
2594 2662
2595#ifdef CONFIG_XPS 2663#ifdef CONFIG_XPS
2596int netif_set_xps_queue(struct net_device *dev, const struct cpumask *mask, 2664int netif_set_xps_queue(struct net_device *dev, const struct cpumask *mask,
@@ -2754,8 +2822,9 @@ int dev_set_mac_address(struct net_device *, struct sockaddr *);
2754int dev_change_carrier(struct net_device *, bool new_carrier); 2822int dev_change_carrier(struct net_device *, bool new_carrier);
2755int dev_get_phys_port_id(struct net_device *dev, 2823int dev_get_phys_port_id(struct net_device *dev,
2756 struct netdev_phys_port_id *ppid); 2824 struct netdev_phys_port_id *ppid);
2757int dev_hard_start_xmit(struct sk_buff *skb, struct net_device *dev, 2825struct sk_buff *validate_xmit_skb(struct sk_buff *skb, struct net_device *dev);
2758 struct netdev_queue *txq); 2826struct sk_buff *dev_hard_start_xmit(struct sk_buff *skb, struct net_device *dev,
2827 struct netdev_queue *txq, int *ret);
2759int __dev_forward_skb(struct net_device *dev, struct sk_buff *skb); 2828int __dev_forward_skb(struct net_device *dev, struct sk_buff *skb);
2760int dev_forward_skb(struct net_device *dev, struct sk_buff *skb); 2829int dev_forward_skb(struct net_device *dev, struct sk_buff *skb);
2761bool is_skb_forwardable(struct net_device *dev, struct sk_buff *skb); 2830bool is_skb_forwardable(struct net_device *dev, struct sk_buff *skb);
@@ -3357,6 +3426,27 @@ int __init dev_proc_init(void);
3357#define dev_proc_init() 0 3426#define dev_proc_init() 0
3358#endif 3427#endif
3359 3428
3429static inline netdev_tx_t __netdev_start_xmit(const struct net_device_ops *ops,
3430 struct sk_buff *skb, struct net_device *dev,
3431 bool more)
3432{
3433 skb->xmit_more = more ? 1 : 0;
3434 return ops->ndo_start_xmit(skb, dev);
3435}
3436
3437static inline netdev_tx_t netdev_start_xmit(struct sk_buff *skb, struct net_device *dev,
3438 struct netdev_queue *txq, bool more)
3439{
3440 const struct net_device_ops *ops = dev->netdev_ops;
3441 int rc;
3442
3443 rc = __netdev_start_xmit(ops, skb, dev, more);
3444 if (rc == NETDEV_TX_OK)
3445 txq_trans_update(txq);
3446
3447 return rc;
3448}
3449
3360int netdev_class_create_file_ns(struct class_attribute *class_attr, 3450int netdev_class_create_file_ns(struct class_attribute *class_attr,
3361 const void *ns); 3451 const void *ns);
3362void netdev_class_remove_file_ns(struct class_attribute *class_attr, 3452void netdev_class_remove_file_ns(struct class_attribute *class_attr,
diff --git a/include/linux/netfilter/ipset/ip_set_list.h b/include/linux/netfilter/ipset/ip_set_list.h
index 68c2aea897f5..fe2622a00151 100644
--- a/include/linux/netfilter/ipset/ip_set_list.h
+++ b/include/linux/netfilter/ipset/ip_set_list.h
@@ -6,5 +6,6 @@
6 6
7#define IP_SET_LIST_DEFAULT_SIZE 8 7#define IP_SET_LIST_DEFAULT_SIZE 8
8#define IP_SET_LIST_MIN_SIZE 4 8#define IP_SET_LIST_MIN_SIZE 4
9#define IP_SET_LIST_MAX_SIZE 65536
9 10
10#endif /* __IP_SET_LIST_H */ 11#endif /* __IP_SET_LIST_H */
diff --git a/include/linux/phonedev.h b/include/linux/phonedev.h
deleted file mode 100644
index 4269de99e320..000000000000
--- a/include/linux/phonedev.h
+++ /dev/null
@@ -1,25 +0,0 @@
1#ifndef __LINUX_PHONEDEV_H
2#define __LINUX_PHONEDEV_H
3
4#include <linux/types.h>
5
6#ifdef __KERNEL__
7
8#include <linux/poll.h>
9
10struct phone_device {
11 struct phone_device *next;
12 const struct file_operations *f_op;
13 int (*open) (struct phone_device *, struct file *);
14 int board; /* Device private index */
15 int minor;
16};
17
18extern int phonedev_init(void);
19#define PHONE_MAJOR 100
20extern int phone_register_device(struct phone_device *, int unit);
21#define PHONE_UNIT_ANY -1
22extern void phone_unregister_device(struct phone_device *);
23
24#endif
25#endif
diff --git a/include/linux/phy.h b/include/linux/phy.h
index ed39956b5613..d090cfcaa167 100644
--- a/include/linux/phy.h
+++ b/include/linux/phy.h
@@ -598,6 +598,19 @@ static inline int phy_read_mmd(struct phy_device *phydev, int devad, u32 regnum)
598} 598}
599 599
600/** 600/**
601 * phy_read_mmd_indirect - reads data from the MMD registers
602 * @phydev: The PHY device bus
603 * @prtad: MMD Address
604 * @devad: MMD DEVAD
605 * @addr: PHY address on the MII bus
606 *
607 * Description: it reads data from the MMD registers (clause 22 to access to
608 * clause 45) of the specified phy address.
609 */
610int phy_read_mmd_indirect(struct phy_device *phydev, int prtad,
611 int devad, int addr);
612
613/**
601 * phy_read - Convenience function for reading a given PHY register 614 * phy_read - Convenience function for reading a given PHY register
602 * @phydev: the phy_device struct 615 * @phydev: the phy_device struct
603 * @regnum: register number to read 616 * @regnum: register number to read
@@ -668,6 +681,20 @@ static inline int phy_write_mmd(struct phy_device *phydev, int devad,
668 return mdiobus_write(phydev->bus, phydev->addr, regnum, val); 681 return mdiobus_write(phydev->bus, phydev->addr, regnum, val);
669} 682}
670 683
684/**
685 * phy_write_mmd_indirect - writes data to the MMD registers
686 * @phydev: The PHY device
687 * @prtad: MMD Address
688 * @devad: MMD DEVAD
689 * @addr: PHY address on the MII bus
690 * @data: data to write in the MMD register
691 *
692 * Description: Write data from the MMD registers of the specified
693 * phy address.
694 */
695void phy_write_mmd_indirect(struct phy_device *phydev, int prtad,
696 int devad, int addr, u32 data);
697
671struct phy_device *phy_device_create(struct mii_bus *bus, int addr, int phy_id, 698struct phy_device *phy_device_create(struct mii_bus *bus, int addr, int phy_id,
672 bool is_c45, 699 bool is_c45,
673 struct phy_c45_device_ids *c45_ids); 700 struct phy_c45_device_ids *c45_ids);
diff --git a/include/linux/phy_fixed.h b/include/linux/phy_fixed.h
index ae612acebb53..941138664c1d 100644
--- a/include/linux/phy_fixed.h
+++ b/include/linux/phy_fixed.h
@@ -18,6 +18,9 @@ extern int fixed_phy_register(unsigned int irq,
18 struct fixed_phy_status *status, 18 struct fixed_phy_status *status,
19 struct device_node *np); 19 struct device_node *np);
20extern void fixed_phy_del(int phy_addr); 20extern void fixed_phy_del(int phy_addr);
21extern int fixed_phy_set_link_update(struct phy_device *phydev,
22 int (*link_update)(struct net_device *,
23 struct fixed_phy_status *));
21#else 24#else
22static inline int fixed_phy_add(unsigned int irq, int phy_id, 25static inline int fixed_phy_add(unsigned int irq, int phy_id,
23 struct fixed_phy_status *status) 26 struct fixed_phy_status *status)
@@ -34,14 +37,12 @@ static inline int fixed_phy_del(int phy_addr)
34{ 37{
35 return -ENODEV; 38 return -ENODEV;
36} 39}
37#endif /* CONFIG_FIXED_PHY */ 40static inline int fixed_phy_set_link_update(struct phy_device *phydev,
38
39/*
40 * This function issued only by fixed_phy-aware drivers, no need
41 * protect it with #ifdef
42 */
43extern int fixed_phy_set_link_update(struct phy_device *phydev,
44 int (*link_update)(struct net_device *, 41 int (*link_update)(struct net_device *,
45 struct fixed_phy_status *)); 42 struct fixed_phy_status *))
43{
44 return -ENODEV;
45}
46#endif /* CONFIG_FIXED_PHY */
46 47
47#endif /* __PHY_FIXED_H */ 48#endif /* __PHY_FIXED_H */
diff --git a/include/linux/random.h b/include/linux/random.h
index 57fbbffd77a0..b05856e16b75 100644
--- a/include/linux/random.h
+++ b/include/linux/random.h
@@ -26,7 +26,7 @@ unsigned int get_random_int(void);
26unsigned long randomize_range(unsigned long start, unsigned long end, unsigned long len); 26unsigned long randomize_range(unsigned long start, unsigned long end, unsigned long len);
27 27
28u32 prandom_u32(void); 28u32 prandom_u32(void);
29void prandom_bytes(void *buf, int nbytes); 29void prandom_bytes(void *buf, size_t nbytes);
30void prandom_seed(u32 seed); 30void prandom_seed(u32 seed);
31void prandom_reseed_late(void); 31void prandom_reseed_late(void);
32 32
@@ -35,7 +35,7 @@ struct rnd_state {
35}; 35};
36 36
37u32 prandom_u32_state(struct rnd_state *state); 37u32 prandom_u32_state(struct rnd_state *state);
38void prandom_bytes_state(struct rnd_state *state, void *buf, int nbytes); 38void prandom_bytes_state(struct rnd_state *state, void *buf, size_t nbytes);
39 39
40/** 40/**
41 * prandom_u32_max - returns a pseudo-random number in interval [0, ep_ro) 41 * prandom_u32_max - returns a pseudo-random number in interval [0, ep_ro)
diff --git a/include/linux/rhashtable.h b/include/linux/rhashtable.h
index 36826c0166c5..fb298e9d6d3a 100644
--- a/include/linux/rhashtable.h
+++ b/include/linux/rhashtable.h
@@ -44,6 +44,7 @@ struct rhashtable;
44 * @head_offset: Offset of rhash_head in struct to be hashed 44 * @head_offset: Offset of rhash_head in struct to be hashed
45 * @hash_rnd: Seed to use while hashing 45 * @hash_rnd: Seed to use while hashing
46 * @max_shift: Maximum number of shifts while expanding 46 * @max_shift: Maximum number of shifts while expanding
47 * @min_shift: Minimum number of shifts while shrinking
47 * @hashfn: Function to hash key 48 * @hashfn: Function to hash key
48 * @obj_hashfn: Function to hash object 49 * @obj_hashfn: Function to hash object
49 * @grow_decision: If defined, may return true if table should expand 50 * @grow_decision: If defined, may return true if table should expand
@@ -57,6 +58,7 @@ struct rhashtable_params {
57 size_t head_offset; 58 size_t head_offset;
58 u32 hash_rnd; 59 u32 hash_rnd;
59 size_t max_shift; 60 size_t max_shift;
61 size_t min_shift;
60 rht_hashfn_t hashfn; 62 rht_hashfn_t hashfn;
61 rht_obj_hashfn_t obj_hashfn; 63 rht_obj_hashfn_t obj_hashfn;
62 bool (*grow_decision)(const struct rhashtable *ht, 64 bool (*grow_decision)(const struct rhashtable *ht,
diff --git a/include/linux/rtnetlink.h b/include/linux/rtnetlink.h
index 167bae7bdfa4..6cacbce1a06c 100644
--- a/include/linux/rtnetlink.h
+++ b/include/linux/rtnetlink.h
@@ -47,6 +47,16 @@ static inline int lockdep_rtnl_is_held(void)
47 rcu_dereference_check(p, lockdep_rtnl_is_held()) 47 rcu_dereference_check(p, lockdep_rtnl_is_held())
48 48
49/** 49/**
50 * rcu_dereference_bh_rtnl - rcu_dereference_bh with debug checking
51 * @p: The pointer to read, prior to dereference
52 *
53 * Do an rcu_dereference_bh(p), but check caller either holds rcu_read_lock_bh()
54 * or RTNL. Note : Please prefer rtnl_dereference() or rcu_dereference_bh()
55 */
56#define rcu_dereference_bh_rtnl(p) \
57 rcu_dereference_bh_check(p, lockdep_rtnl_is_held())
58
59/**
50 * rtnl_dereference - fetch RCU pointer when updates are prevented by RTNL 60 * rtnl_dereference - fetch RCU pointer when updates are prevented by RTNL
51 * @p: The pointer to read, prior to dereferencing 61 * @p: The pointer to read, prior to dereferencing
52 * 62 *
diff --git a/include/linux/skbuff.h b/include/linux/skbuff.h
index abde271c18ae..f1bfa3781c75 100644
--- a/include/linux/skbuff.h
+++ b/include/linux/skbuff.h
@@ -47,11 +47,29 @@
47 * 47 *
48 * The hardware you're dealing with doesn't calculate the full checksum 48 * The hardware you're dealing with doesn't calculate the full checksum
49 * (as in CHECKSUM_COMPLETE), but it does parse headers and verify checksums 49 * (as in CHECKSUM_COMPLETE), but it does parse headers and verify checksums
50 * for specific protocols e.g. TCP/UDP/SCTP, then, for such packets it will 50 * for specific protocols. For such packets it will set CHECKSUM_UNNECESSARY
51 * set CHECKSUM_UNNECESSARY if their checksums are okay. skb->csum is still 51 * if their checksums are okay. skb->csum is still undefined in this case
52 * undefined in this case though. It is a bad option, but, unfortunately, 52 * though. It is a bad option, but, unfortunately, nowadays most vendors do
53 * nowadays most vendors do this. Apparently with the secret goal to sell 53 * this. Apparently with the secret goal to sell you new devices, when you
54 * you new devices, when you will add new protocol to your host, f.e. IPv6 8) 54 * will add new protocol to your host, f.e. IPv6 8)
55 *
56 * CHECKSUM_UNNECESSARY is applicable to following protocols:
57 * TCP: IPv6 and IPv4.
58 * UDP: IPv4 and IPv6. A device may apply CHECKSUM_UNNECESSARY to a
59 * zero UDP checksum for either IPv4 or IPv6, the networking stack
60 * may perform further validation in this case.
61 * GRE: only if the checksum is present in the header.
62 * SCTP: indicates the CRC in SCTP header has been validated.
63 *
64 * skb->csum_level indicates the number of consecutive checksums found in
65 * the packet minus one that have been verified as CHECKSUM_UNNECESSARY.
66 * For instance if a device receives an IPv6->UDP->GRE->IPv4->TCP packet
67 * and a device is able to verify the checksums for UDP (possibly zero),
68 * GRE (checksum flag is set), and TCP-- skb->csum_level would be set to
69 * two. If the device were only able to verify the UDP checksum and not
70 * GRE, either because it doesn't support GRE checksum of because GRE
71 * checksum is bad, skb->csum_level would be set to zero (TCP checksum is
72 * not considered in this case).
55 * 73 *
56 * CHECKSUM_COMPLETE: 74 * CHECKSUM_COMPLETE:
57 * 75 *
@@ -112,6 +130,9 @@
112#define CHECKSUM_COMPLETE 2 130#define CHECKSUM_COMPLETE 2
113#define CHECKSUM_PARTIAL 3 131#define CHECKSUM_PARTIAL 3
114 132
133/* Maximum value in skb->csum_level */
134#define SKB_MAX_CSUM_LEVEL 3
135
115#define SKB_DATA_ALIGN(X) ALIGN(X, SMP_CACHE_BYTES) 136#define SKB_DATA_ALIGN(X) ALIGN(X, SMP_CACHE_BYTES)
116#define SKB_WITH_OVERHEAD(X) \ 137#define SKB_WITH_OVERHEAD(X) \
117 ((X) - SKB_DATA_ALIGN(sizeof(struct skb_shared_info))) 138 ((X) - SKB_DATA_ALIGN(sizeof(struct skb_shared_info)))
@@ -452,6 +473,7 @@ static inline u32 skb_mstamp_us_delta(const struct skb_mstamp *t1,
452 * @tc_verd: traffic control verdict 473 * @tc_verd: traffic control verdict
453 * @hash: the packet hash 474 * @hash: the packet hash
454 * @queue_mapping: Queue mapping for multiqueue devices 475 * @queue_mapping: Queue mapping for multiqueue devices
476 * @xmit_more: More SKBs are pending for this queue
455 * @ndisc_nodetype: router type (from link layer) 477 * @ndisc_nodetype: router type (from link layer)
456 * @ooo_okay: allow the mapping of a socket to a queue to be changed 478 * @ooo_okay: allow the mapping of a socket to a queue to be changed
457 * @l4_hash: indicate hash is a canonical 4-tuple hash over transport 479 * @l4_hash: indicate hash is a canonical 4-tuple hash over transport
@@ -526,6 +548,16 @@ struct sk_buff {
526 ip_summed:2, 548 ip_summed:2,
527 nohdr:1, 549 nohdr:1,
528 nfctinfo:3; 550 nfctinfo:3;
551
552/* if you move pkt_type around you also must adapt those constants */
553#ifdef __BIG_ENDIAN_BITFIELD
554#define PKT_TYPE_MAX (7 << 5)
555#else
556#define PKT_TYPE_MAX 7
557#endif
558#define PKT_TYPE_OFFSET() offsetof(struct sk_buff, __pkt_type_offset)
559
560 __u8 __pkt_type_offset[0];
529 __u8 pkt_type:3, 561 __u8 pkt_type:3,
530 fclone:2, 562 fclone:2,
531 ipvs_property:1, 563 ipvs_property:1,
@@ -558,6 +590,7 @@ struct sk_buff {
558 590
559 __u16 queue_mapping; 591 __u16 queue_mapping;
560 kmemcheck_bitfield_begin(flags2); 592 kmemcheck_bitfield_begin(flags2);
593 __u8 xmit_more:1;
561#ifdef CONFIG_IPV6_NDISC_NODETYPE 594#ifdef CONFIG_IPV6_NDISC_NODETYPE
562 __u8 ndisc_nodetype:2; 595 __u8 ndisc_nodetype:2;
563#endif 596#endif
@@ -569,16 +602,12 @@ struct sk_buff {
569 __u8 wifi_acked:1; 602 __u8 wifi_acked:1;
570 __u8 no_fcs:1; 603 __u8 no_fcs:1;
571 __u8 head_frag:1; 604 __u8 head_frag:1;
572 /* Encapsulation protocol and NIC drivers should use 605 /* Indicates the inner headers are valid in the skbuff. */
573 * this flag to indicate to each other if the skb contains
574 * encapsulated packet or not and maybe use the inner packet
575 * headers if needed
576 */
577 __u8 encapsulation:1; 606 __u8 encapsulation:1;
578 __u8 encap_hdr_csum:1; 607 __u8 encap_hdr_csum:1;
579 __u8 csum_valid:1; 608 __u8 csum_valid:1;
580 __u8 csum_complete_sw:1; 609 __u8 csum_complete_sw:1;
581 /* 2/4 bit hole (depending on ndisc_nodetype presence) */ 610 /* 1/3 bit hole (depending on ndisc_nodetype presence) */
582 kmemcheck_bitfield_end(flags2); 611 kmemcheck_bitfield_end(flags2);
583 612
584#if defined CONFIG_NET_DMA || defined CONFIG_NET_RX_BUSY_POLL 613#if defined CONFIG_NET_DMA || defined CONFIG_NET_RX_BUSY_POLL
@@ -596,6 +625,12 @@ struct sk_buff {
596 __u32 reserved_tailroom; 625 __u32 reserved_tailroom;
597 }; 626 };
598 627
628 kmemcheck_bitfield_begin(flags3);
629 __u8 csum_level:2;
630 __u8 csum_bad:1;
631 /* 13 bit hole */
632 kmemcheck_bitfield_end(flags3);
633
599 __be16 inner_protocol; 634 __be16 inner_protocol;
600 __u16 inner_transport_header; 635 __u16 inner_transport_header;
601 __u16 inner_network_header; 636 __u16 inner_network_header;
@@ -734,6 +769,12 @@ static inline struct sk_buff *alloc_skb(unsigned int size,
734 return __alloc_skb(size, priority, 0, NUMA_NO_NODE); 769 return __alloc_skb(size, priority, 0, NUMA_NO_NODE);
735} 770}
736 771
772struct sk_buff *alloc_skb_with_frags(unsigned long header_len,
773 unsigned long data_len,
774 int max_page_order,
775 int *errcode,
776 gfp_t gfp_mask);
777
737static inline struct sk_buff *alloc_skb_fclone(unsigned int size, 778static inline struct sk_buff *alloc_skb_fclone(unsigned int size,
738 gfp_t priority) 779 gfp_t priority)
739{ 780{
@@ -1860,18 +1901,6 @@ static inline int pskb_network_may_pull(struct sk_buff *skb, unsigned int len)
1860 return pskb_may_pull(skb, skb_network_offset(skb) + len); 1901 return pskb_may_pull(skb, skb_network_offset(skb) + len);
1861} 1902}
1862 1903
1863static inline void skb_pop_rcv_encapsulation(struct sk_buff *skb)
1864{
1865 /* Only continue with checksum unnecessary if device indicated
1866 * it is valid across encapsulation (skb->encapsulation was set).
1867 */
1868 if (skb->ip_summed == CHECKSUM_UNNECESSARY && !skb->encapsulation)
1869 skb->ip_summed = CHECKSUM_NONE;
1870
1871 skb->encapsulation = 0;
1872 skb->csum_valid = 0;
1873}
1874
1875/* 1904/*
1876 * CPUs often take a performance hit when accessing unaligned memory 1905 * CPUs often take a performance hit when accessing unaligned memory
1877 * locations. The actual performance hit varies, it can be small if the 1906 * locations. The actual performance hit varies, it can be small if the
@@ -2567,20 +2596,26 @@ __wsum __skb_checksum(const struct sk_buff *skb, int offset, int len,
2567__wsum skb_checksum(const struct sk_buff *skb, int offset, int len, 2596__wsum skb_checksum(const struct sk_buff *skb, int offset, int len,
2568 __wsum csum); 2597 __wsum csum);
2569 2598
2570static inline void *skb_header_pointer(const struct sk_buff *skb, int offset, 2599static inline void *__skb_header_pointer(const struct sk_buff *skb, int offset,
2571 int len, void *buffer) 2600 int len, void *data, int hlen, void *buffer)
2572{ 2601{
2573 int hlen = skb_headlen(skb);
2574
2575 if (hlen - offset >= len) 2602 if (hlen - offset >= len)
2576 return skb->data + offset; 2603 return data + offset;
2577 2604
2578 if (skb_copy_bits(skb, offset, buffer, len) < 0) 2605 if (!skb ||
2606 skb_copy_bits(skb, offset, buffer, len) < 0)
2579 return NULL; 2607 return NULL;
2580 2608
2581 return buffer; 2609 return buffer;
2582} 2610}
2583 2611
2612static inline void *skb_header_pointer(const struct sk_buff *skb, int offset,
2613 int len, void *buffer)
2614{
2615 return __skb_header_pointer(skb, offset, len, skb->data,
2616 skb_headlen(skb), buffer);
2617}
2618
2584/** 2619/**
2585 * skb_needs_linearize - check if we need to linearize a given skb 2620 * skb_needs_linearize - check if we need to linearize a given skb
2586 * depending on the given device features. 2621 * depending on the given device features.
@@ -2671,6 +2706,8 @@ static inline ktime_t net_invalid_timestamp(void)
2671 return ktime_set(0, 0); 2706 return ktime_set(0, 0);
2672} 2707}
2673 2708
2709struct sk_buff *skb_clone_sk(struct sk_buff *skb);
2710
2674#ifdef CONFIG_NETWORK_PHY_TIMESTAMPING 2711#ifdef CONFIG_NETWORK_PHY_TIMESTAMPING
2675 2712
2676void skb_clone_tx_timestamp(struct sk_buff *skb); 2713void skb_clone_tx_timestamp(struct sk_buff *skb);
@@ -2786,6 +2823,42 @@ static inline __sum16 skb_checksum_complete(struct sk_buff *skb)
2786 0 : __skb_checksum_complete(skb); 2823 0 : __skb_checksum_complete(skb);
2787} 2824}
2788 2825
2826static inline void __skb_decr_checksum_unnecessary(struct sk_buff *skb)
2827{
2828 if (skb->ip_summed == CHECKSUM_UNNECESSARY) {
2829 if (skb->csum_level == 0)
2830 skb->ip_summed = CHECKSUM_NONE;
2831 else
2832 skb->csum_level--;
2833 }
2834}
2835
2836static inline void __skb_incr_checksum_unnecessary(struct sk_buff *skb)
2837{
2838 if (skb->ip_summed == CHECKSUM_UNNECESSARY) {
2839 if (skb->csum_level < SKB_MAX_CSUM_LEVEL)
2840 skb->csum_level++;
2841 } else if (skb->ip_summed == CHECKSUM_NONE) {
2842 skb->ip_summed = CHECKSUM_UNNECESSARY;
2843 skb->csum_level = 0;
2844 }
2845}
2846
2847static inline void __skb_mark_checksum_bad(struct sk_buff *skb)
2848{
2849 /* Mark current checksum as bad (typically called from GRO
2850 * path). In the case that ip_summed is CHECKSUM_NONE
2851 * this must be the first checksum encountered in the packet.
2852 * When ip_summed is CHECKSUM_UNNECESSARY, this is the first
2853 * checksum after the last one validated. For UDP, a zero
2854 * checksum can not be marked as bad.
2855 */
2856
2857 if (skb->ip_summed == CHECKSUM_NONE ||
2858 skb->ip_summed == CHECKSUM_UNNECESSARY)
2859 skb->csum_bad = 1;
2860}
2861
2789/* Check if we need to perform checksum complete validation. 2862/* Check if we need to perform checksum complete validation.
2790 * 2863 *
2791 * Returns true if checksum complete is needed, false otherwise 2864 * Returns true if checksum complete is needed, false otherwise
@@ -2797,6 +2870,7 @@ static inline bool __skb_checksum_validate_needed(struct sk_buff *skb,
2797{ 2870{
2798 if (skb_csum_unnecessary(skb) || (zero_okay && !check)) { 2871 if (skb_csum_unnecessary(skb) || (zero_okay && !check)) {
2799 skb->csum_valid = 1; 2872 skb->csum_valid = 1;
2873 __skb_decr_checksum_unnecessary(skb);
2800 return false; 2874 return false;
2801 } 2875 }
2802 2876
@@ -2826,6 +2900,9 @@ static inline __sum16 __skb_checksum_validate_complete(struct sk_buff *skb,
2826 skb->csum_valid = 1; 2900 skb->csum_valid = 1;
2827 return 0; 2901 return 0;
2828 } 2902 }
2903 } else if (skb->csum_bad) {
2904 /* ip_summed == CHECKSUM_NONE in this case */
2905 return 1;
2829 } 2906 }
2830 2907
2831 skb->csum = psum; 2908 skb->csum = psum;
@@ -2883,6 +2960,26 @@ static inline __wsum null_compute_pseudo(struct sk_buff *skb, int proto)
2883#define skb_checksum_simple_validate(skb) \ 2960#define skb_checksum_simple_validate(skb) \
2884 __skb_checksum_validate(skb, 0, true, false, 0, null_compute_pseudo) 2961 __skb_checksum_validate(skb, 0, true, false, 0, null_compute_pseudo)
2885 2962
2963static inline bool __skb_checksum_convert_check(struct sk_buff *skb)
2964{
2965 return (skb->ip_summed == CHECKSUM_NONE &&
2966 skb->csum_valid && !skb->csum_bad);
2967}
2968
2969static inline void __skb_checksum_convert(struct sk_buff *skb,
2970 __sum16 check, __wsum pseudo)
2971{
2972 skb->csum = ~pseudo;
2973 skb->ip_summed = CHECKSUM_COMPLETE;
2974}
2975
2976#define skb_checksum_try_convert(skb, proto, check, compute_pseudo) \
2977do { \
2978 if (__skb_checksum_convert_check(skb)) \
2979 __skb_checksum_convert(skb, check, \
2980 compute_pseudo(skb, proto)); \
2981} while (0)
2982
2886#if defined(CONFIG_NF_CONNTRACK) || defined(CONFIG_NF_CONNTRACK_MODULE) 2983#if defined(CONFIG_NF_CONNTRACK) || defined(CONFIG_NF_CONNTRACK_MODULE)
2887void nf_conntrack_destroy(struct nf_conntrack *nfct); 2984void nf_conntrack_destroy(struct nf_conntrack *nfct);
2888static inline void nf_conntrack_put(struct nf_conntrack *nfct) 2985static inline void nf_conntrack_put(struct nf_conntrack *nfct)
@@ -3137,7 +3234,9 @@ bool skb_partial_csum_set(struct sk_buff *skb, u16 start, u16 off);
3137 3234
3138int skb_checksum_setup(struct sk_buff *skb, bool recalculate); 3235int skb_checksum_setup(struct sk_buff *skb, bool recalculate);
3139 3236
3140u32 __skb_get_poff(const struct sk_buff *skb); 3237u32 skb_get_poff(const struct sk_buff *skb);
3238u32 __skb_get_poff(const struct sk_buff *skb, void *data,
3239 const struct flow_keys *keys, int hlen);
3141 3240
3142/** 3241/**
3143 * skb_head_is_locked - Determine if the skb->head is locked down 3242 * skb_head_is_locked - Determine if the skb->head is locked down
diff --git a/include/linux/tcp.h b/include/linux/tcp.h
index fa5258f322e7..e567f0dbf282 100644
--- a/include/linux/tcp.h
+++ b/include/linux/tcp.h
@@ -276,7 +276,7 @@ struct tcp_sock {
276 u32 retrans_stamp; /* Timestamp of the last retransmit, 276 u32 retrans_stamp; /* Timestamp of the last retransmit,
277 * also used in SYN-SENT to remember stamp of 277 * also used in SYN-SENT to remember stamp of
278 * the first SYN. */ 278 * the first SYN. */
279 u32 undo_marker; /* tracking retrans started here. */ 279 u32 undo_marker; /* snd_una upon a new recovery episode. */
280 int undo_retrans; /* number of undoable retransmissions. */ 280 int undo_retrans; /* number of undoable retransmissions. */
281 u32 total_retrans; /* Total retransmits for entire connection */ 281 u32 total_retrans; /* Total retransmits for entire connection */
282 282
diff --git a/include/linux/udp.h b/include/linux/udp.h
index 247cfdcc4b08..ee3277593222 100644
--- a/include/linux/udp.h
+++ b/include/linux/udp.h
@@ -49,7 +49,11 @@ struct udp_sock {
49 unsigned int corkflag; /* Cork is required */ 49 unsigned int corkflag; /* Cork is required */
50 __u8 encap_type; /* Is this an Encapsulation socket? */ 50 __u8 encap_type; /* Is this an Encapsulation socket? */
51 unsigned char no_check6_tx:1,/* Send zero UDP6 checksums on TX? */ 51 unsigned char no_check6_tx:1,/* Send zero UDP6 checksums on TX? */
52 no_check6_rx:1;/* Allow zero UDP6 checksums on RX? */ 52 no_check6_rx:1,/* Allow zero UDP6 checksums on RX? */
53 convert_csum:1;/* On receive, convert checksum
54 * unnecessary to checksum complete
55 * if possible.
56 */
53 /* 57 /*
54 * Following member retains the information to create a UDP header 58 * Following member retains the information to create a UDP header
55 * when the socket is uncorked. 59 * when the socket is uncorked.
@@ -98,6 +102,16 @@ static inline bool udp_get_no_check6_rx(struct sock *sk)
98 return udp_sk(sk)->no_check6_rx; 102 return udp_sk(sk)->no_check6_rx;
99} 103}
100 104
105static inline void udp_set_convert_csum(struct sock *sk, bool val)
106{
107 udp_sk(sk)->convert_csum = val;
108}
109
110static inline bool udp_get_convert_csum(struct sock *sk)
111{
112 return udp_sk(sk)->convert_csum;
113}
114
101#define udp_portaddr_for_each_entry(__sk, node, list) \ 115#define udp_portaddr_for_each_entry(__sk, node, list) \
102 hlist_nulls_for_each_entry(__sk, node, list, __sk_common.skc_portaddr_node) 116 hlist_nulls_for_each_entry(__sk, node, list, __sk_common.skc_portaddr_node)
103 117