diff options
Diffstat (limited to 'include')
131 files changed, 2832 insertions, 2508 deletions
diff --git a/include/linux/bcma/bcma.h b/include/linux/bcma/bcma.h index e0ce311011c0..f14a98a79c9d 100644 --- a/include/linux/bcma/bcma.h +++ b/include/linux/bcma/bcma.h | |||
| @@ -134,6 +134,7 @@ struct bcma_host_ops { | |||
| 134 | #define BCMA_CORE_I2S 0x834 | 134 | #define BCMA_CORE_I2S 0x834 |
| 135 | #define BCMA_CORE_SDR_DDR1_MEM_CTL 0x835 /* SDR/DDR1 memory controller core */ | 135 | #define BCMA_CORE_SDR_DDR1_MEM_CTL 0x835 /* SDR/DDR1 memory controller core */ |
| 136 | #define BCMA_CORE_SHIM 0x837 /* SHIM component in ubus/6362 */ | 136 | #define BCMA_CORE_SHIM 0x837 /* SHIM component in ubus/6362 */ |
| 137 | #define BCMA_CORE_ARM_CR4 0x83e | ||
| 137 | #define BCMA_CORE_DEFAULT 0xFFF | 138 | #define BCMA_CORE_DEFAULT 0xFFF |
| 138 | 139 | ||
| 139 | #define BCMA_MAX_NR_CORES 16 | 140 | #define BCMA_MAX_NR_CORES 16 |
| @@ -173,6 +174,60 @@ struct bcma_host_ops { | |||
| 173 | #define BCMA_CHIP_ID_BCM53572 53572 | 174 | #define BCMA_CHIP_ID_BCM53572 53572 |
| 174 | #define BCMA_PKG_ID_BCM47188 9 | 175 | #define BCMA_PKG_ID_BCM47188 9 |
| 175 | 176 | ||
| 177 | /* Board types (on PCI usually equals to the subsystem dev id) */ | ||
| 178 | /* BCM4313 */ | ||
| 179 | #define BCMA_BOARD_TYPE_BCM94313BU 0X050F | ||
| 180 | #define BCMA_BOARD_TYPE_BCM94313HM 0X0510 | ||
| 181 | #define BCMA_BOARD_TYPE_BCM94313EPA 0X0511 | ||
| 182 | #define BCMA_BOARD_TYPE_BCM94313HMG 0X051C | ||
| 183 | /* BCM4716 */ | ||
| 184 | #define BCMA_BOARD_TYPE_BCM94716NR2 0X04CD | ||
| 185 | /* BCM43224 */ | ||
| 186 | #define BCMA_BOARD_TYPE_BCM943224X21 0X056E | ||
| 187 | #define BCMA_BOARD_TYPE_BCM943224X21_FCC 0X00D1 | ||
| 188 | #define BCMA_BOARD_TYPE_BCM943224X21B 0X00E9 | ||
| 189 | #define BCMA_BOARD_TYPE_BCM943224M93 0X008B | ||
| 190 | #define BCMA_BOARD_TYPE_BCM943224M93A 0X0090 | ||
| 191 | #define BCMA_BOARD_TYPE_BCM943224X16 0X0093 | ||
| 192 | #define BCMA_BOARD_TYPE_BCM94322X9 0X008D | ||
| 193 | #define BCMA_BOARD_TYPE_BCM94322M35E 0X008E | ||
| 194 | /* BCM43228 */ | ||
| 195 | #define BCMA_BOARD_TYPE_BCM943228BU8 0X0540 | ||
| 196 | #define BCMA_BOARD_TYPE_BCM943228BU9 0X0541 | ||
| 197 | #define BCMA_BOARD_TYPE_BCM943228BU 0X0542 | ||
| 198 | #define BCMA_BOARD_TYPE_BCM943227HM4L 0X0543 | ||
| 199 | #define BCMA_BOARD_TYPE_BCM943227HMB 0X0544 | ||
| 200 | #define BCMA_BOARD_TYPE_BCM943228HM4L 0X0545 | ||
| 201 | #define BCMA_BOARD_TYPE_BCM943228SD 0X0573 | ||
| 202 | /* BCM4331 */ | ||
| 203 | #define BCMA_BOARD_TYPE_BCM94331X19 0X00D6 | ||
| 204 | #define BCMA_BOARD_TYPE_BCM94331X28 0X00E4 | ||
| 205 | #define BCMA_BOARD_TYPE_BCM94331X28B 0X010E | ||
| 206 | #define BCMA_BOARD_TYPE_BCM94331PCIEBT3AX 0X00E4 | ||
| 207 | #define BCMA_BOARD_TYPE_BCM94331X12_2G 0X00EC | ||
| 208 | #define BCMA_BOARD_TYPE_BCM94331X12_5G 0X00ED | ||
| 209 | #define BCMA_BOARD_TYPE_BCM94331X29B 0X00EF | ||
| 210 | #define BCMA_BOARD_TYPE_BCM94331CSAX 0X00EF | ||
| 211 | #define BCMA_BOARD_TYPE_BCM94331X19C 0X00F5 | ||
| 212 | #define BCMA_BOARD_TYPE_BCM94331X33 0X00F4 | ||
| 213 | #define BCMA_BOARD_TYPE_BCM94331BU 0X0523 | ||
| 214 | #define BCMA_BOARD_TYPE_BCM94331S9BU 0X0524 | ||
| 215 | #define BCMA_BOARD_TYPE_BCM94331MC 0X0525 | ||
| 216 | #define BCMA_BOARD_TYPE_BCM94331MCI 0X0526 | ||
| 217 | #define BCMA_BOARD_TYPE_BCM94331PCIEBT4 0X0527 | ||
| 218 | #define BCMA_BOARD_TYPE_BCM94331HM 0X0574 | ||
| 219 | #define BCMA_BOARD_TYPE_BCM94331PCIEDUAL 0X059B | ||
| 220 | #define BCMA_BOARD_TYPE_BCM94331MCH5 0X05A9 | ||
| 221 | #define BCMA_BOARD_TYPE_BCM94331CS 0X05C6 | ||
| 222 | #define BCMA_BOARD_TYPE_BCM94331CD 0X05DA | ||
| 223 | /* BCM53572 */ | ||
| 224 | #define BCMA_BOARD_TYPE_BCM953572BU 0X058D | ||
| 225 | #define BCMA_BOARD_TYPE_BCM953572NR2 0X058E | ||
| 226 | #define BCMA_BOARD_TYPE_BCM947188NR2 0X058F | ||
| 227 | #define BCMA_BOARD_TYPE_BCM953572SDRNR2 0X0590 | ||
| 228 | /* BCM43142 */ | ||
| 229 | #define BCMA_BOARD_TYPE_BCM943142HM 0X05E0 | ||
| 230 | |||
| 176 | struct bcma_device { | 231 | struct bcma_device { |
| 177 | struct bcma_bus *bus; | 232 | struct bcma_bus *bus; |
| 178 | struct bcma_device_id id; | 233 | struct bcma_device_id id; |
diff --git a/include/linux/bcma/bcma_driver_chipcommon.h b/include/linux/bcma/bcma_driver_chipcommon.h index 8390c474f69a..b8b09eac60a4 100644 --- a/include/linux/bcma/bcma_driver_chipcommon.h +++ b/include/linux/bcma/bcma_driver_chipcommon.h | |||
| @@ -104,6 +104,7 @@ | |||
| 104 | #define BCMA_CC_CHIPST_4706_MIPS_BENDIAN BIT(3) /* 0: little, 1: big endian */ | 104 | #define BCMA_CC_CHIPST_4706_MIPS_BENDIAN BIT(3) /* 0: little, 1: big endian */ |
| 105 | #define BCMA_CC_CHIPST_4706_PCIE1_DISABLE BIT(5) /* PCIE1 enable strap pin */ | 105 | #define BCMA_CC_CHIPST_4706_PCIE1_DISABLE BIT(5) /* PCIE1 enable strap pin */ |
| 106 | #define BCMA_CC_CHIPST_5357_NAND_BOOT BIT(4) /* NAND boot, valid for CC rev 38 and/or BCM5357 */ | 106 | #define BCMA_CC_CHIPST_5357_NAND_BOOT BIT(4) /* NAND boot, valid for CC rev 38 and/or BCM5357 */ |
| 107 | #define BCMA_CC_CHIPST_4360_XTAL_40MZ 0x00000001 | ||
| 107 | #define BCMA_CC_JCMD 0x0030 /* Rev >= 10 only */ | 108 | #define BCMA_CC_JCMD 0x0030 /* Rev >= 10 only */ |
| 108 | #define BCMA_CC_JCMD_START 0x80000000 | 109 | #define BCMA_CC_JCMD_START 0x80000000 |
| 109 | #define BCMA_CC_JCMD_BUSY 0x80000000 | 110 | #define BCMA_CC_JCMD_BUSY 0x80000000 |
| @@ -315,6 +316,9 @@ | |||
| 315 | #define BCMA_CC_PMU_CTL 0x0600 /* PMU control */ | 316 | #define BCMA_CC_PMU_CTL 0x0600 /* PMU control */ |
| 316 | #define BCMA_CC_PMU_CTL_ILP_DIV 0xFFFF0000 /* ILP div mask */ | 317 | #define BCMA_CC_PMU_CTL_ILP_DIV 0xFFFF0000 /* ILP div mask */ |
| 317 | #define BCMA_CC_PMU_CTL_ILP_DIV_SHIFT 16 | 318 | #define BCMA_CC_PMU_CTL_ILP_DIV_SHIFT 16 |
| 319 | #define BCMA_CC_PMU_CTL_RES 0x00006000 /* reset control mask */ | ||
| 320 | #define BCMA_CC_PMU_CTL_RES_SHIFT 13 | ||
| 321 | #define BCMA_CC_PMU_CTL_RES_RELOAD 0x2 /* reload POR values */ | ||
| 318 | #define BCMA_CC_PMU_CTL_PLL_UPD 0x00000400 | 322 | #define BCMA_CC_PMU_CTL_PLL_UPD 0x00000400 |
| 319 | #define BCMA_CC_PMU_CTL_NOILPONW 0x00000200 /* No ILP on wait */ | 323 | #define BCMA_CC_PMU_CTL_NOILPONW 0x00000200 /* No ILP on wait */ |
| 320 | #define BCMA_CC_PMU_CTL_HTREQEN 0x00000100 /* HT req enable */ | 324 | #define BCMA_CC_PMU_CTL_HTREQEN 0x00000100 /* HT req enable */ |
| @@ -607,6 +611,8 @@ void bcma_chipco_bcm4331_ext_pa_lines_ctl(struct bcma_drv_cc *cc, bool enable); | |||
| 607 | 611 | ||
| 608 | extern u32 bcma_chipco_watchdog_timer_set(struct bcma_drv_cc *cc, u32 ticks); | 612 | extern u32 bcma_chipco_watchdog_timer_set(struct bcma_drv_cc *cc, u32 ticks); |
| 609 | 613 | ||
| 614 | extern u32 bcma_chipco_get_alp_clock(struct bcma_drv_cc *cc); | ||
| 615 | |||
| 610 | void bcma_chipco_irq_mask(struct bcma_drv_cc *cc, u32 mask, u32 value); | 616 | void bcma_chipco_irq_mask(struct bcma_drv_cc *cc, u32 mask, u32 value); |
| 611 | 617 | ||
| 612 | u32 bcma_chipco_irq_status(struct bcma_drv_cc *cc, u32 mask); | 618 | u32 bcma_chipco_irq_status(struct bcma_drv_cc *cc, u32 mask); |
diff --git a/include/linux/bcma/bcma_regs.h b/include/linux/bcma/bcma_regs.h index 7e8104bb7a7e..917dcd7965e7 100644 --- a/include/linux/bcma/bcma_regs.h +++ b/include/linux/bcma/bcma_regs.h | |||
| @@ -37,6 +37,7 @@ | |||
| 37 | #define BCMA_IOST_BIST_DONE 0x8000 | 37 | #define BCMA_IOST_BIST_DONE 0x8000 |
| 38 | #define BCMA_RESET_CTL 0x0800 | 38 | #define BCMA_RESET_CTL 0x0800 |
| 39 | #define BCMA_RESET_CTL_RESET 0x0001 | 39 | #define BCMA_RESET_CTL_RESET 0x0001 |
| 40 | #define BCMA_RESET_ST 0x0804 | ||
| 40 | 41 | ||
| 41 | /* BCMA PCI config space registers. */ | 42 | /* BCMA PCI config space registers. */ |
| 42 | #define BCMA_PCI_PMCSR 0x44 | 43 | #define BCMA_PCI_PMCSR 0x44 |
diff --git a/include/linux/cn_proc.h b/include/linux/cn_proc.h index 2c1bc1ea04ee..1d5b02a96c46 100644 --- a/include/linux/cn_proc.h +++ b/include/linux/cn_proc.h | |||
| @@ -26,6 +26,7 @@ void proc_id_connector(struct task_struct *task, int which_id); | |||
| 26 | void proc_sid_connector(struct task_struct *task); | 26 | void proc_sid_connector(struct task_struct *task); |
| 27 | void proc_ptrace_connector(struct task_struct *task, int which_id); | 27 | void proc_ptrace_connector(struct task_struct *task, int which_id); |
| 28 | void proc_comm_connector(struct task_struct *task); | 28 | void proc_comm_connector(struct task_struct *task); |
| 29 | void proc_coredump_connector(struct task_struct *task); | ||
| 29 | void proc_exit_connector(struct task_struct *task); | 30 | void proc_exit_connector(struct task_struct *task); |
| 30 | #else | 31 | #else |
| 31 | static inline void proc_fork_connector(struct task_struct *task) | 32 | static inline void proc_fork_connector(struct task_struct *task) |
| @@ -48,6 +49,9 @@ static inline void proc_ptrace_connector(struct task_struct *task, | |||
| 48 | int ptrace_id) | 49 | int ptrace_id) |
| 49 | {} | 50 | {} |
| 50 | 51 | ||
| 52 | static inline void proc_coredump_connector(struct task_struct *task) | ||
| 53 | {} | ||
| 54 | |||
| 51 | static inline void proc_exit_connector(struct task_struct *task) | 55 | static inline void proc_exit_connector(struct task_struct *task) |
| 52 | {} | 56 | {} |
| 53 | #endif /* CONFIG_PROC_EVENTS */ | 57 | #endif /* CONFIG_PROC_EVENTS */ |
diff --git a/include/linux/filter.h b/include/linux/filter.h index c45eabc135e1..c050dcc322a4 100644 --- a/include/linux/filter.h +++ b/include/linux/filter.h | |||
| @@ -48,8 +48,22 @@ extern int sk_chk_filter(struct sock_filter *filter, unsigned int flen); | |||
| 48 | extern int sk_get_filter(struct sock *sk, struct sock_filter __user *filter, unsigned len); | 48 | extern int sk_get_filter(struct sock *sk, struct sock_filter __user *filter, unsigned len); |
| 49 | 49 | ||
| 50 | #ifdef CONFIG_BPF_JIT | 50 | #ifdef CONFIG_BPF_JIT |
| 51 | #include <stdarg.h> | ||
| 52 | #include <linux/linkage.h> | ||
| 53 | #include <linux/printk.h> | ||
| 54 | |||
| 51 | extern void bpf_jit_compile(struct sk_filter *fp); | 55 | extern void bpf_jit_compile(struct sk_filter *fp); |
| 52 | extern void bpf_jit_free(struct sk_filter *fp); | 56 | extern void bpf_jit_free(struct sk_filter *fp); |
| 57 | |||
| 58 | static inline void bpf_jit_dump(unsigned int flen, unsigned int proglen, | ||
| 59 | u32 pass, void *image) | ||
| 60 | { | ||
| 61 | pr_err("flen=%u proglen=%u pass=%u image=%p\n", | ||
| 62 | flen, proglen, pass, image); | ||
| 63 | if (image) | ||
| 64 | print_hex_dump(KERN_ERR, "JIT code: ", DUMP_PREFIX_ADDRESS, | ||
| 65 | 16, 1, image, proglen, false); | ||
| 66 | } | ||
| 53 | #define SK_RUN_FILTER(FILTER, SKB) (*FILTER->bpf_func)(SKB, FILTER->insns) | 67 | #define SK_RUN_FILTER(FILTER, SKB) (*FILTER->bpf_func)(SKB, FILTER->insns) |
| 54 | #else | 68 | #else |
| 55 | static inline void bpf_jit_compile(struct sk_filter *fp) | 69 | static inline void bpf_jit_compile(struct sk_filter *fp) |
| @@ -126,6 +140,7 @@ enum { | |||
| 126 | BPF_S_ANC_SECCOMP_LD_W, | 140 | BPF_S_ANC_SECCOMP_LD_W, |
| 127 | BPF_S_ANC_VLAN_TAG, | 141 | BPF_S_ANC_VLAN_TAG, |
| 128 | BPF_S_ANC_VLAN_TAG_PRESENT, | 142 | BPF_S_ANC_VLAN_TAG_PRESENT, |
| 143 | BPF_S_ANC_PAY_OFFSET, | ||
| 129 | }; | 144 | }; |
| 130 | 145 | ||
| 131 | #endif /* __LINUX_FILTER_H__ */ | 146 | #endif /* __LINUX_FILTER_H__ */ |
diff --git a/include/linux/icmpv6.h b/include/linux/icmpv6.h index b4f6c29caced..630f45335c73 100644 --- a/include/linux/icmpv6.h +++ b/include/linux/icmpv6.h | |||
| @@ -11,9 +11,21 @@ static inline struct icmp6hdr *icmp6_hdr(const struct sk_buff *skb) | |||
| 11 | 11 | ||
| 12 | #include <linux/netdevice.h> | 12 | #include <linux/netdevice.h> |
| 13 | 13 | ||
| 14 | extern void icmpv6_send(struct sk_buff *skb, | 14 | #if IS_ENABLED(CONFIG_IPV6) |
| 15 | u8 type, u8 code, | 15 | extern void icmpv6_send(struct sk_buff *skb, u8 type, u8 code, __u32 info); |
| 16 | __u32 info); | 16 | |
| 17 | typedef void ip6_icmp_send_t(struct sk_buff *skb, u8 type, u8 code, __u32 info); | ||
| 18 | extern int inet6_register_icmp_sender(ip6_icmp_send_t *fn); | ||
| 19 | extern int inet6_unregister_icmp_sender(ip6_icmp_send_t *fn); | ||
| 20 | |||
| 21 | #else | ||
| 22 | |||
| 23 | static inline void icmpv6_send(struct sk_buff *skb, | ||
| 24 | u8 type, u8 code, __u32 info) | ||
| 25 | { | ||
| 26 | |||
| 27 | } | ||
| 28 | #endif | ||
| 17 | 29 | ||
| 18 | extern int icmpv6_init(void); | 30 | extern int icmpv6_init(void); |
| 19 | extern int icmpv6_err_convert(u8 type, u8 code, | 31 | extern int icmpv6_err_convert(u8 type, u8 code, |
diff --git a/include/linux/ieee80211.h b/include/linux/ieee80211.h index 7e24fe0cfbcd..06b0ed0154a4 100644 --- a/include/linux/ieee80211.h +++ b/include/linux/ieee80211.h | |||
| @@ -113,6 +113,34 @@ | |||
| 113 | #define IEEE80211_CTL_EXT_SSW_FBACK 0x9000 | 113 | #define IEEE80211_CTL_EXT_SSW_FBACK 0x9000 |
| 114 | #define IEEE80211_CTL_EXT_SSW_ACK 0xa000 | 114 | #define IEEE80211_CTL_EXT_SSW_ACK 0xa000 |
| 115 | 115 | ||
| 116 | |||
| 117 | #define IEEE80211_SN_MASK ((IEEE80211_SCTL_SEQ) >> 4) | ||
| 118 | #define IEEE80211_MAX_SN IEEE80211_SN_MASK | ||
| 119 | #define IEEE80211_SN_MODULO (IEEE80211_MAX_SN + 1) | ||
| 120 | |||
| 121 | static inline int ieee80211_sn_less(u16 sn1, u16 sn2) | ||
| 122 | { | ||
| 123 | return ((sn1 - sn2) & IEEE80211_SN_MASK) > (IEEE80211_SN_MODULO >> 1); | ||
| 124 | } | ||
| 125 | |||
| 126 | static inline u16 ieee80211_sn_add(u16 sn1, u16 sn2) | ||
| 127 | { | ||
| 128 | return (sn1 + sn2) & IEEE80211_SN_MASK; | ||
| 129 | } | ||
| 130 | |||
| 131 | static inline u16 ieee80211_sn_inc(u16 sn) | ||
| 132 | { | ||
| 133 | return ieee80211_sn_add(sn, 1); | ||
| 134 | } | ||
| 135 | |||
| 136 | static inline u16 ieee80211_sn_sub(u16 sn1, u16 sn2) | ||
| 137 | { | ||
| 138 | return (sn1 - sn2) & IEEE80211_SN_MASK; | ||
| 139 | } | ||
| 140 | |||
| 141 | #define IEEE80211_SEQ_TO_SN(seq) (((seq) & IEEE80211_SCTL_SEQ) >> 4) | ||
| 142 | #define IEEE80211_SN_TO_SEQ(ssn) (((ssn) << 4) & IEEE80211_SCTL_SEQ) | ||
| 143 | |||
| 116 | /* miscellaneous IEEE 802.11 constants */ | 144 | /* miscellaneous IEEE 802.11 constants */ |
| 117 | #define IEEE80211_MAX_FRAG_THRESHOLD 2352 | 145 | #define IEEE80211_MAX_FRAG_THRESHOLD 2352 |
| 118 | #define IEEE80211_MAX_RTS_THRESHOLD 2353 | 146 | #define IEEE80211_MAX_RTS_THRESHOLD 2353 |
| @@ -185,7 +213,7 @@ struct ieee80211_hdr { | |||
| 185 | u8 addr3[6]; | 213 | u8 addr3[6]; |
| 186 | __le16 seq_ctrl; | 214 | __le16 seq_ctrl; |
| 187 | u8 addr4[6]; | 215 | u8 addr4[6]; |
| 188 | } __packed; | 216 | } __packed __aligned(2); |
| 189 | 217 | ||
| 190 | struct ieee80211_hdr_3addr { | 218 | struct ieee80211_hdr_3addr { |
| 191 | __le16 frame_control; | 219 | __le16 frame_control; |
| @@ -194,7 +222,7 @@ struct ieee80211_hdr_3addr { | |||
| 194 | u8 addr2[6]; | 222 | u8 addr2[6]; |
| 195 | u8 addr3[6]; | 223 | u8 addr3[6]; |
| 196 | __le16 seq_ctrl; | 224 | __le16 seq_ctrl; |
| 197 | } __packed; | 225 | } __packed __aligned(2); |
| 198 | 226 | ||
| 199 | struct ieee80211_qos_hdr { | 227 | struct ieee80211_qos_hdr { |
| 200 | __le16 frame_control; | 228 | __le16 frame_control; |
| @@ -204,7 +232,7 @@ struct ieee80211_qos_hdr { | |||
| 204 | u8 addr3[6]; | 232 | u8 addr3[6]; |
| 205 | __le16 seq_ctrl; | 233 | __le16 seq_ctrl; |
| 206 | __le16 qos_ctrl; | 234 | __le16 qos_ctrl; |
| 207 | } __packed; | 235 | } __packed __aligned(2); |
| 208 | 236 | ||
| 209 | /** | 237 | /** |
| 210 | * ieee80211_has_tods - check if IEEE80211_FCTL_TODS is set | 238 | * ieee80211_has_tods - check if IEEE80211_FCTL_TODS is set |
| @@ -581,7 +609,7 @@ struct ieee80211s_hdr { | |||
| 581 | __le32 seqnum; | 609 | __le32 seqnum; |
| 582 | u8 eaddr1[6]; | 610 | u8 eaddr1[6]; |
| 583 | u8 eaddr2[6]; | 611 | u8 eaddr2[6]; |
| 584 | } __packed; | 612 | } __packed __aligned(2); |
| 585 | 613 | ||
| 586 | /* Mesh flags */ | 614 | /* Mesh flags */ |
| 587 | #define MESH_FLAGS_AE_A4 0x1 | 615 | #define MESH_FLAGS_AE_A4 0x1 |
| @@ -645,6 +673,36 @@ struct ieee80211_channel_sw_ie { | |||
| 645 | } __packed; | 673 | } __packed; |
| 646 | 674 | ||
| 647 | /** | 675 | /** |
| 676 | * struct ieee80211_ext_chansw_ie | ||
| 677 | * | ||
| 678 | * This structure represents the "Extended Channel Switch Announcement element" | ||
| 679 | */ | ||
| 680 | struct ieee80211_ext_chansw_ie { | ||
| 681 | u8 mode; | ||
| 682 | u8 new_operating_class; | ||
| 683 | u8 new_ch_num; | ||
| 684 | u8 count; | ||
| 685 | } __packed; | ||
| 686 | |||
| 687 | /** | ||
| 688 | * struct ieee80211_sec_chan_offs_ie - secondary channel offset IE | ||
| 689 | * @sec_chan_offs: secondary channel offset, uses IEEE80211_HT_PARAM_CHA_SEC_* | ||
| 690 | * values here | ||
| 691 | * This structure represents the "Secondary Channel Offset element" | ||
| 692 | */ | ||
| 693 | struct ieee80211_sec_chan_offs_ie { | ||
| 694 | u8 sec_chan_offs; | ||
| 695 | } __packed; | ||
| 696 | |||
| 697 | /** | ||
| 698 | * struct ieee80211_wide_bw_chansw_ie - wide bandwidth channel switch IE | ||
| 699 | */ | ||
| 700 | struct ieee80211_wide_bw_chansw_ie { | ||
| 701 | u8 new_channel_width; | ||
| 702 | u8 new_center_freq_seg0, new_center_freq_seg1; | ||
| 703 | } __packed; | ||
| 704 | |||
| 705 | /** | ||
| 648 | * struct ieee80211_tim | 706 | * struct ieee80211_tim |
| 649 | * | 707 | * |
| 650 | * This structure refers to "Traffic Indication Map information element" | 708 | * This structure refers to "Traffic Indication Map information element" |
| @@ -812,12 +870,15 @@ struct ieee80211_mgmt { | |||
| 812 | } __packed wme_action; | 870 | } __packed wme_action; |
| 813 | struct{ | 871 | struct{ |
| 814 | u8 action_code; | 872 | u8 action_code; |
| 815 | u8 element_id; | 873 | u8 variable[0]; |
| 816 | u8 length; | ||
| 817 | struct ieee80211_channel_sw_ie sw_elem; | ||
| 818 | } __packed chan_switch; | 874 | } __packed chan_switch; |
| 819 | struct{ | 875 | struct{ |
| 820 | u8 action_code; | 876 | u8 action_code; |
| 877 | struct ieee80211_ext_chansw_ie data; | ||
| 878 | u8 variable[0]; | ||
| 879 | } __packed ext_chan_switch; | ||
| 880 | struct{ | ||
| 881 | u8 action_code; | ||
| 821 | u8 dialog_token; | 882 | u8 dialog_token; |
| 822 | u8 element_id; | 883 | u8 element_id; |
| 823 | u8 length; | 884 | u8 length; |
| @@ -875,7 +936,7 @@ struct ieee80211_mgmt { | |||
| 875 | } u; | 936 | } u; |
| 876 | } __packed action; | 937 | } __packed action; |
| 877 | } u; | 938 | } u; |
| 878 | } __packed; | 939 | } __packed __aligned(2); |
| 879 | 940 | ||
| 880 | /* Supported Rates value encodings in 802.11n-2009 7.3.2.2 */ | 941 | /* Supported Rates value encodings in 802.11n-2009 7.3.2.2 */ |
| 881 | #define BSS_MEMBERSHIP_SELECTOR_HT_PHY 127 | 942 | #define BSS_MEMBERSHIP_SELECTOR_HT_PHY 127 |
| @@ -906,20 +967,20 @@ struct ieee80211_rts { | |||
| 906 | __le16 duration; | 967 | __le16 duration; |
| 907 | u8 ra[6]; | 968 | u8 ra[6]; |
| 908 | u8 ta[6]; | 969 | u8 ta[6]; |
| 909 | } __packed; | 970 | } __packed __aligned(2); |
| 910 | 971 | ||
| 911 | struct ieee80211_cts { | 972 | struct ieee80211_cts { |
| 912 | __le16 frame_control; | 973 | __le16 frame_control; |
| 913 | __le16 duration; | 974 | __le16 duration; |
| 914 | u8 ra[6]; | 975 | u8 ra[6]; |
| 915 | } __packed; | 976 | } __packed __aligned(2); |
| 916 | 977 | ||
| 917 | struct ieee80211_pspoll { | 978 | struct ieee80211_pspoll { |
| 918 | __le16 frame_control; | 979 | __le16 frame_control; |
| 919 | __le16 aid; | 980 | __le16 aid; |
| 920 | u8 bssid[6]; | 981 | u8 bssid[6]; |
| 921 | u8 ta[6]; | 982 | u8 ta[6]; |
| 922 | } __packed; | 983 | } __packed __aligned(2); |
| 923 | 984 | ||
| 924 | /* TDLS */ | 985 | /* TDLS */ |
| 925 | 986 | ||
| @@ -999,6 +1060,26 @@ enum ieee80211_p2p_attr_id { | |||
| 999 | IEEE80211_P2P_ATTR_MAX | 1060 | IEEE80211_P2P_ATTR_MAX |
| 1000 | }; | 1061 | }; |
| 1001 | 1062 | ||
| 1063 | /* Notice of Absence attribute - described in P2P spec 4.1.14 */ | ||
| 1064 | /* Typical max value used here */ | ||
| 1065 | #define IEEE80211_P2P_NOA_DESC_MAX 4 | ||
| 1066 | |||
| 1067 | struct ieee80211_p2p_noa_desc { | ||
| 1068 | u8 count; | ||
| 1069 | __le32 duration; | ||
| 1070 | __le32 interval; | ||
| 1071 | __le32 start_time; | ||
| 1072 | } __packed; | ||
| 1073 | |||
| 1074 | struct ieee80211_p2p_noa_attr { | ||
| 1075 | u8 index; | ||
| 1076 | u8 oppps_ctwindow; | ||
| 1077 | struct ieee80211_p2p_noa_desc desc[IEEE80211_P2P_NOA_DESC_MAX]; | ||
| 1078 | } __packed; | ||
| 1079 | |||
| 1080 | #define IEEE80211_P2P_OPPPS_ENABLE_BIT BIT(7) | ||
| 1081 | #define IEEE80211_P2P_OPPPS_CTWINDOW_MASK 0x7F | ||
| 1082 | |||
| 1002 | /** | 1083 | /** |
| 1003 | * struct ieee80211_bar - HT Block Ack Request | 1084 | * struct ieee80211_bar - HT Block Ack Request |
| 1004 | * | 1085 | * |
| @@ -1290,11 +1371,6 @@ struct ieee80211_vht_operation { | |||
| 1290 | } __packed; | 1371 | } __packed; |
| 1291 | 1372 | ||
| 1292 | 1373 | ||
| 1293 | #define IEEE80211_VHT_MCS_ZERO_TO_SEVEN_SUPPORT 0 | ||
| 1294 | #define IEEE80211_VHT_MCS_ZERO_TO_EIGHT_SUPPORT 1 | ||
| 1295 | #define IEEE80211_VHT_MCS_ZERO_TO_NINE_SUPPORT 2 | ||
| 1296 | #define IEEE80211_VHT_MCS_NOT_SUPPORTED 3 | ||
| 1297 | |||
| 1298 | /* 802.11ac VHT Capabilities */ | 1374 | /* 802.11ac VHT Capabilities */ |
| 1299 | #define IEEE80211_VHT_CAP_MAX_MPDU_LENGTH_3895 0x00000000 | 1375 | #define IEEE80211_VHT_CAP_MAX_MPDU_LENGTH_3895 0x00000000 |
| 1300 | #define IEEE80211_VHT_CAP_MAX_MPDU_LENGTH_7991 0x00000001 | 1376 | #define IEEE80211_VHT_CAP_MAX_MPDU_LENGTH_7991 0x00000001 |
| @@ -1310,10 +1386,11 @@ struct ieee80211_vht_operation { | |||
| 1310 | #define IEEE80211_VHT_CAP_RXSTBC_2 0x00000200 | 1386 | #define IEEE80211_VHT_CAP_RXSTBC_2 0x00000200 |
| 1311 | #define IEEE80211_VHT_CAP_RXSTBC_3 0x00000300 | 1387 | #define IEEE80211_VHT_CAP_RXSTBC_3 0x00000300 |
| 1312 | #define IEEE80211_VHT_CAP_RXSTBC_4 0x00000400 | 1388 | #define IEEE80211_VHT_CAP_RXSTBC_4 0x00000400 |
| 1389 | #define IEEE80211_VHT_CAP_RXSTBC_MASK 0x00000700 | ||
| 1313 | #define IEEE80211_VHT_CAP_SU_BEAMFORMER_CAPABLE 0x00000800 | 1390 | #define IEEE80211_VHT_CAP_SU_BEAMFORMER_CAPABLE 0x00000800 |
| 1314 | #define IEEE80211_VHT_CAP_SU_BEAMFORMEE_CAPABLE 0x00001000 | 1391 | #define IEEE80211_VHT_CAP_SU_BEAMFORMEE_CAPABLE 0x00001000 |
| 1315 | #define IEEE80211_VHT_CAP_BEAMFORMER_ANTENNAS_MAX 0x00006000 | 1392 | #define IEEE80211_VHT_CAP_BEAMFORMER_ANTENNAS_MAX 0x00006000 |
| 1316 | #define IEEE80211_VHT_CAP_SOUNDING_DIMENTION_MAX 0x00030000 | 1393 | #define IEEE80211_VHT_CAP_SOUNDING_DIMENSIONS_MAX 0x00030000 |
| 1317 | #define IEEE80211_VHT_CAP_MU_BEAMFORMER_CAPABLE 0x00080000 | 1394 | #define IEEE80211_VHT_CAP_MU_BEAMFORMER_CAPABLE 0x00080000 |
| 1318 | #define IEEE80211_VHT_CAP_MU_BEAMFORMEE_CAPABLE 0x00100000 | 1395 | #define IEEE80211_VHT_CAP_MU_BEAMFORMEE_CAPABLE 0x00100000 |
| 1319 | #define IEEE80211_VHT_CAP_VHT_TXOP_PS 0x00200000 | 1396 | #define IEEE80211_VHT_CAP_VHT_TXOP_PS 0x00200000 |
| @@ -1594,6 +1671,7 @@ enum ieee80211_eid { | |||
| 1594 | 1671 | ||
| 1595 | WLAN_EID_HT_CAPABILITY = 45, | 1672 | WLAN_EID_HT_CAPABILITY = 45, |
| 1596 | WLAN_EID_HT_OPERATION = 61, | 1673 | WLAN_EID_HT_OPERATION = 61, |
| 1674 | WLAN_EID_SECONDARY_CHANNEL_OFFSET = 62, | ||
| 1597 | 1675 | ||
| 1598 | WLAN_EID_RSN = 48, | 1676 | WLAN_EID_RSN = 48, |
| 1599 | WLAN_EID_MMIE = 76, | 1677 | WLAN_EID_MMIE = 76, |
| @@ -1628,6 +1706,8 @@ enum ieee80211_eid { | |||
| 1628 | WLAN_EID_VHT_CAPABILITY = 191, | 1706 | WLAN_EID_VHT_CAPABILITY = 191, |
| 1629 | WLAN_EID_VHT_OPERATION = 192, | 1707 | WLAN_EID_VHT_OPERATION = 192, |
| 1630 | WLAN_EID_OPMODE_NOTIF = 199, | 1708 | WLAN_EID_OPMODE_NOTIF = 199, |
| 1709 | WLAN_EID_WIDE_BW_CHANNEL_SWITCH = 194, | ||
| 1710 | WLAN_EID_CHANNEL_SWITCH_WRAPPER = 196, | ||
| 1631 | 1711 | ||
| 1632 | /* 802.11ad */ | 1712 | /* 802.11ad */ |
| 1633 | WLAN_EID_NON_TX_BSSID_CAP = 83, | 1713 | WLAN_EID_NON_TX_BSSID_CAP = 83, |
| @@ -1751,6 +1831,7 @@ enum ieee80211_key_len { | |||
| 1751 | 1831 | ||
| 1752 | /* Public action codes */ | 1832 | /* Public action codes */ |
| 1753 | enum ieee80211_pub_actioncode { | 1833 | enum ieee80211_pub_actioncode { |
| 1834 | WLAN_PUB_ACTION_EXT_CHANSW_ANN = 4, | ||
| 1754 | WLAN_PUB_ACTION_TDLS_DISCOVER_RES = 14, | 1835 | WLAN_PUB_ACTION_TDLS_DISCOVER_RES = 14, |
| 1755 | }; | 1836 | }; |
| 1756 | 1837 | ||
| @@ -1911,6 +1992,16 @@ enum ieee80211_timeout_interval_type { | |||
| 1911 | WLAN_TIMEOUT_ASSOC_COMEBACK = 3 /* 802.11w */, | 1992 | WLAN_TIMEOUT_ASSOC_COMEBACK = 3 /* 802.11w */, |
| 1912 | }; | 1993 | }; |
| 1913 | 1994 | ||
| 1995 | /** | ||
| 1996 | * struct ieee80211_timeout_interval_ie - Timeout Interval element | ||
| 1997 | * @type: type, see &enum ieee80211_timeout_interval_type | ||
| 1998 | * @value: timeout interval value | ||
| 1999 | */ | ||
| 2000 | struct ieee80211_timeout_interval_ie { | ||
| 2001 | u8 type; | ||
| 2002 | __le32 value; | ||
| 2003 | } __packed; | ||
| 2004 | |||
| 1914 | /* BACK action code */ | 2005 | /* BACK action code */ |
| 1915 | enum ieee80211_back_actioncode { | 2006 | enum ieee80211_back_actioncode { |
| 1916 | WLAN_ACTION_ADDBA_REQ = 0, | 2007 | WLAN_ACTION_ADDBA_REQ = 0, |
diff --git a/include/linux/if_arp.h b/include/linux/if_arp.h index 89b4614a4722..f563907ed776 100644 --- a/include/linux/if_arp.h +++ b/include/linux/if_arp.h | |||
| @@ -33,7 +33,15 @@ static inline struct arphdr *arp_hdr(const struct sk_buff *skb) | |||
| 33 | 33 | ||
| 34 | static inline int arp_hdr_len(struct net_device *dev) | 34 | static inline int arp_hdr_len(struct net_device *dev) |
| 35 | { | 35 | { |
| 36 | /* ARP header, plus 2 device addresses, plus 2 IP addresses. */ | 36 | switch (dev->type) { |
| 37 | return sizeof(struct arphdr) + (dev->addr_len + sizeof(u32)) * 2; | 37 | #if IS_ENABLED(CONFIG_FIREWIRE_NET) |
| 38 | case ARPHRD_IEEE1394: | ||
| 39 | /* ARP header, device address and 2 IP addresses */ | ||
| 40 | return sizeof(struct arphdr) + dev->addr_len + sizeof(u32) * 2; | ||
| 41 | #endif | ||
| 42 | default: | ||
| 43 | /* ARP header, plus 2 device addresses, plus 2 IP addresses. */ | ||
| 44 | return sizeof(struct arphdr) + (dev->addr_len + sizeof(u32)) * 2; | ||
| 45 | } | ||
| 38 | } | 46 | } |
| 39 | #endif /* _LINUX_IF_ARP_H */ | 47 | #endif /* _LINUX_IF_ARP_H */ |
diff --git a/include/linux/if_team.h b/include/linux/if_team.h index cfd21e3d5506..4474557904f6 100644 --- a/include/linux/if_team.h +++ b/include/linux/if_team.h | |||
| @@ -112,6 +112,10 @@ struct team_mode_ops { | |||
| 112 | void (*port_disabled)(struct team *team, struct team_port *port); | 112 | void (*port_disabled)(struct team *team, struct team_port *port); |
| 113 | }; | 113 | }; |
| 114 | 114 | ||
| 115 | extern int team_modeop_port_enter(struct team *team, struct team_port *port); | ||
| 116 | extern void team_modeop_port_change_dev_addr(struct team *team, | ||
| 117 | struct team_port *port); | ||
| 118 | |||
| 115 | enum team_option_type { | 119 | enum team_option_type { |
| 116 | TEAM_OPTION_TYPE_U32, | 120 | TEAM_OPTION_TYPE_U32, |
| 117 | TEAM_OPTION_TYPE_STRING, | 121 | TEAM_OPTION_TYPE_STRING, |
| @@ -236,7 +240,26 @@ static inline struct team_port *team_get_port_by_index_rcu(struct team *team, | |||
| 236 | return NULL; | 240 | return NULL; |
| 237 | } | 241 | } |
| 238 | 242 | ||
| 239 | extern int team_port_set_team_dev_addr(struct team_port *port); | 243 | static inline struct team_port * |
| 244 | team_get_first_port_txable_rcu(struct team *team, struct team_port *port) | ||
| 245 | { | ||
| 246 | struct team_port *cur; | ||
| 247 | |||
| 248 | if (likely(team_port_txable(port))) | ||
| 249 | return port; | ||
| 250 | cur = port; | ||
| 251 | list_for_each_entry_continue_rcu(cur, &team->port_list, list) | ||
| 252 | if (team_port_txable(port)) | ||
| 253 | return cur; | ||
| 254 | list_for_each_entry_rcu(cur, &team->port_list, list) { | ||
| 255 | if (cur == port) | ||
| 256 | break; | ||
| 257 | if (team_port_txable(port)) | ||
| 258 | return cur; | ||
| 259 | } | ||
| 260 | return NULL; | ||
| 261 | } | ||
| 262 | |||
| 240 | extern int team_options_register(struct team *team, | 263 | extern int team_options_register(struct team *team, |
| 241 | const struct team_option *option, | 264 | const struct team_option *option, |
| 242 | size_t option_count); | 265 | size_t option_count); |
diff --git a/include/linux/if_vlan.h b/include/linux/if_vlan.h index 218a3b686d90..52bd03b38962 100644 --- a/include/linux/if_vlan.h +++ b/include/linux/if_vlan.h | |||
| @@ -86,15 +86,15 @@ static inline int is_vlan_dev(struct net_device *dev) | |||
| 86 | #if defined(CONFIG_VLAN_8021Q) || defined(CONFIG_VLAN_8021Q_MODULE) | 86 | #if defined(CONFIG_VLAN_8021Q) || defined(CONFIG_VLAN_8021Q_MODULE) |
| 87 | 87 | ||
| 88 | extern struct net_device *__vlan_find_dev_deep(struct net_device *real_dev, | 88 | extern struct net_device *__vlan_find_dev_deep(struct net_device *real_dev, |
| 89 | u16 vlan_id); | 89 | __be16 vlan_proto, u16 vlan_id); |
| 90 | extern struct net_device *vlan_dev_real_dev(const struct net_device *dev); | 90 | extern struct net_device *vlan_dev_real_dev(const struct net_device *dev); |
| 91 | extern u16 vlan_dev_vlan_id(const struct net_device *dev); | 91 | extern u16 vlan_dev_vlan_id(const struct net_device *dev); |
| 92 | 92 | ||
| 93 | extern bool vlan_do_receive(struct sk_buff **skb); | 93 | extern bool vlan_do_receive(struct sk_buff **skb); |
| 94 | extern struct sk_buff *vlan_untag(struct sk_buff *skb); | 94 | extern struct sk_buff *vlan_untag(struct sk_buff *skb); |
| 95 | 95 | ||
| 96 | extern int vlan_vid_add(struct net_device *dev, unsigned short vid); | 96 | extern int vlan_vid_add(struct net_device *dev, __be16 proto, u16 vid); |
| 97 | extern void vlan_vid_del(struct net_device *dev, unsigned short vid); | 97 | extern void vlan_vid_del(struct net_device *dev, __be16 proto, u16 vid); |
| 98 | 98 | ||
| 99 | extern int vlan_vids_add_by_dev(struct net_device *dev, | 99 | extern int vlan_vids_add_by_dev(struct net_device *dev, |
| 100 | const struct net_device *by_dev); | 100 | const struct net_device *by_dev); |
| @@ -104,7 +104,8 @@ extern void vlan_vids_del_by_dev(struct net_device *dev, | |||
| 104 | extern bool vlan_uses_dev(const struct net_device *dev); | 104 | extern bool vlan_uses_dev(const struct net_device *dev); |
| 105 | #else | 105 | #else |
| 106 | static inline struct net_device * | 106 | static inline struct net_device * |
| 107 | __vlan_find_dev_deep(struct net_device *real_dev, u16 vlan_id) | 107 | __vlan_find_dev_deep(struct net_device *real_dev, |
| 108 | __be16 vlan_proto, u16 vlan_id) | ||
| 108 | { | 109 | { |
| 109 | return NULL; | 110 | return NULL; |
| 110 | } | 111 | } |
| @@ -131,12 +132,12 @@ static inline struct sk_buff *vlan_untag(struct sk_buff *skb) | |||
| 131 | return skb; | 132 | return skb; |
| 132 | } | 133 | } |
| 133 | 134 | ||
| 134 | static inline int vlan_vid_add(struct net_device *dev, unsigned short vid) | 135 | static inline int vlan_vid_add(struct net_device *dev, __be16 proto, u16 vid) |
| 135 | { | 136 | { |
| 136 | return 0; | 137 | return 0; |
| 137 | } | 138 | } |
| 138 | 139 | ||
| 139 | static inline void vlan_vid_del(struct net_device *dev, unsigned short vid) | 140 | static inline void vlan_vid_del(struct net_device *dev, __be16 proto, u16 vid) |
| 140 | { | 141 | { |
| 141 | } | 142 | } |
| 142 | 143 | ||
| @@ -157,9 +158,20 @@ static inline bool vlan_uses_dev(const struct net_device *dev) | |||
| 157 | } | 158 | } |
| 158 | #endif | 159 | #endif |
| 159 | 160 | ||
| 161 | static inline bool vlan_hw_offload_capable(netdev_features_t features, | ||
| 162 | __be16 proto) | ||
| 163 | { | ||
| 164 | if (proto == htons(ETH_P_8021Q) && features & NETIF_F_HW_VLAN_CTAG_TX) | ||
| 165 | return true; | ||
| 166 | if (proto == htons(ETH_P_8021AD) && features & NETIF_F_HW_VLAN_STAG_TX) | ||
| 167 | return true; | ||
| 168 | return false; | ||
| 169 | } | ||
| 170 | |||
| 160 | /** | 171 | /** |
| 161 | * vlan_insert_tag - regular VLAN tag inserting | 172 | * vlan_insert_tag - regular VLAN tag inserting |
| 162 | * @skb: skbuff to tag | 173 | * @skb: skbuff to tag |
| 174 | * @vlan_proto: VLAN encapsulation protocol | ||
| 163 | * @vlan_tci: VLAN TCI to insert | 175 | * @vlan_tci: VLAN TCI to insert |
| 164 | * | 176 | * |
| 165 | * Inserts the VLAN tag into @skb as part of the payload | 177 | * Inserts the VLAN tag into @skb as part of the payload |
| @@ -170,7 +182,8 @@ static inline bool vlan_uses_dev(const struct net_device *dev) | |||
| 170 | * | 182 | * |
| 171 | * Does not change skb->protocol so this function can be used during receive. | 183 | * Does not change skb->protocol so this function can be used during receive. |
| 172 | */ | 184 | */ |
| 173 | static inline struct sk_buff *vlan_insert_tag(struct sk_buff *skb, u16 vlan_tci) | 185 | static inline struct sk_buff *vlan_insert_tag(struct sk_buff *skb, |
| 186 | __be16 vlan_proto, u16 vlan_tci) | ||
| 174 | { | 187 | { |
| 175 | struct vlan_ethhdr *veth; | 188 | struct vlan_ethhdr *veth; |
| 176 | 189 | ||
| @@ -185,7 +198,7 @@ static inline struct sk_buff *vlan_insert_tag(struct sk_buff *skb, u16 vlan_tci) | |||
| 185 | skb->mac_header -= VLAN_HLEN; | 198 | skb->mac_header -= VLAN_HLEN; |
| 186 | 199 | ||
| 187 | /* first, the ethernet type */ | 200 | /* first, the ethernet type */ |
| 188 | veth->h_vlan_proto = htons(ETH_P_8021Q); | 201 | veth->h_vlan_proto = vlan_proto; |
| 189 | 202 | ||
| 190 | /* now, the TCI */ | 203 | /* now, the TCI */ |
| 191 | veth->h_vlan_TCI = htons(vlan_tci); | 204 | veth->h_vlan_TCI = htons(vlan_tci); |
| @@ -204,24 +217,28 @@ static inline struct sk_buff *vlan_insert_tag(struct sk_buff *skb, u16 vlan_tci) | |||
| 204 | * Following the skb_unshare() example, in case of error, the calling function | 217 | * Following the skb_unshare() example, in case of error, the calling function |
| 205 | * doesn't have to worry about freeing the original skb. | 218 | * doesn't have to worry about freeing the original skb. |
| 206 | */ | 219 | */ |
| 207 | static inline struct sk_buff *__vlan_put_tag(struct sk_buff *skb, u16 vlan_tci) | 220 | static inline struct sk_buff *__vlan_put_tag(struct sk_buff *skb, |
| 221 | __be16 vlan_proto, u16 vlan_tci) | ||
| 208 | { | 222 | { |
| 209 | skb = vlan_insert_tag(skb, vlan_tci); | 223 | skb = vlan_insert_tag(skb, vlan_proto, vlan_tci); |
| 210 | if (skb) | 224 | if (skb) |
| 211 | skb->protocol = htons(ETH_P_8021Q); | 225 | skb->protocol = vlan_proto; |
| 212 | return skb; | 226 | return skb; |
| 213 | } | 227 | } |
| 214 | 228 | ||
| 215 | /** | 229 | /** |
| 216 | * __vlan_hwaccel_put_tag - hardware accelerated VLAN inserting | 230 | * __vlan_hwaccel_put_tag - hardware accelerated VLAN inserting |
| 217 | * @skb: skbuff to tag | 231 | * @skb: skbuff to tag |
| 232 | * @vlan_proto: VLAN encapsulation protocol | ||
| 218 | * @vlan_tci: VLAN TCI to insert | 233 | * @vlan_tci: VLAN TCI to insert |
| 219 | * | 234 | * |
| 220 | * Puts the VLAN TCI in @skb->vlan_tci and lets the device do the rest | 235 | * Puts the VLAN TCI in @skb->vlan_tci and lets the device do the rest |
| 221 | */ | 236 | */ |
| 222 | static inline struct sk_buff *__vlan_hwaccel_put_tag(struct sk_buff *skb, | 237 | static inline struct sk_buff *__vlan_hwaccel_put_tag(struct sk_buff *skb, |
| 238 | __be16 vlan_proto, | ||
| 223 | u16 vlan_tci) | 239 | u16 vlan_tci) |
| 224 | { | 240 | { |
| 241 | skb->vlan_proto = vlan_proto; | ||
| 225 | skb->vlan_tci = VLAN_TAG_PRESENT | vlan_tci; | 242 | skb->vlan_tci = VLAN_TAG_PRESENT | vlan_tci; |
| 226 | return skb; | 243 | return skb; |
| 227 | } | 244 | } |
| @@ -236,12 +253,13 @@ static inline struct sk_buff *__vlan_hwaccel_put_tag(struct sk_buff *skb, | |||
| 236 | * Assumes skb->dev is the target that will xmit this frame. | 253 | * Assumes skb->dev is the target that will xmit this frame. |
| 237 | * Returns a VLAN tagged skb. | 254 | * Returns a VLAN tagged skb. |
| 238 | */ | 255 | */ |
| 239 | static inline struct sk_buff *vlan_put_tag(struct sk_buff *skb, u16 vlan_tci) | 256 | static inline struct sk_buff *vlan_put_tag(struct sk_buff *skb, |
| 257 | __be16 vlan_proto, u16 vlan_tci) | ||
| 240 | { | 258 | { |
| 241 | if (skb->dev->features & NETIF_F_HW_VLAN_TX) { | 259 | if (vlan_hw_offload_capable(skb->dev->features, vlan_proto)) { |
| 242 | return __vlan_hwaccel_put_tag(skb, vlan_tci); | 260 | return __vlan_hwaccel_put_tag(skb, vlan_proto, vlan_tci); |
| 243 | } else { | 261 | } else { |
| 244 | return __vlan_put_tag(skb, vlan_tci); | 262 | return __vlan_put_tag(skb, vlan_proto, vlan_tci); |
| 245 | } | 263 | } |
| 246 | } | 264 | } |
| 247 | 265 | ||
| @@ -256,9 +274,9 @@ static inline int __vlan_get_tag(const struct sk_buff *skb, u16 *vlan_tci) | |||
| 256 | { | 274 | { |
| 257 | struct vlan_ethhdr *veth = (struct vlan_ethhdr *)skb->data; | 275 | struct vlan_ethhdr *veth = (struct vlan_ethhdr *)skb->data; |
| 258 | 276 | ||
| 259 | if (veth->h_vlan_proto != htons(ETH_P_8021Q)) { | 277 | if (veth->h_vlan_proto != htons(ETH_P_8021Q) && |
| 278 | veth->h_vlan_proto != htons(ETH_P_8021AD)) | ||
| 260 | return -EINVAL; | 279 | return -EINVAL; |
| 261 | } | ||
| 262 | 280 | ||
| 263 | *vlan_tci = ntohs(veth->h_vlan_TCI); | 281 | *vlan_tci = ntohs(veth->h_vlan_TCI); |
| 264 | return 0; | 282 | return 0; |
| @@ -294,7 +312,7 @@ static inline int __vlan_hwaccel_get_tag(const struct sk_buff *skb, | |||
| 294 | */ | 312 | */ |
| 295 | static inline int vlan_get_tag(const struct sk_buff *skb, u16 *vlan_tci) | 313 | static inline int vlan_get_tag(const struct sk_buff *skb, u16 *vlan_tci) |
| 296 | { | 314 | { |
| 297 | if (skb->dev->features & NETIF_F_HW_VLAN_TX) { | 315 | if (skb->dev->features & NETIF_F_HW_VLAN_CTAG_TX) { |
| 298 | return __vlan_hwaccel_get_tag(skb, vlan_tci); | 316 | return __vlan_hwaccel_get_tag(skb, vlan_tci); |
| 299 | } else { | 317 | } else { |
| 300 | return __vlan_get_tag(skb, vlan_tci); | 318 | return __vlan_get_tag(skb, vlan_tci); |
| @@ -339,7 +357,7 @@ static inline void vlan_set_encap_proto(struct sk_buff *skb, | |||
| 339 | */ | 357 | */ |
| 340 | 358 | ||
| 341 | proto = vhdr->h_vlan_encapsulated_proto; | 359 | proto = vhdr->h_vlan_encapsulated_proto; |
| 342 | if (ntohs(proto) >= 1536) { | 360 | if (ntohs(proto) >= ETH_P_802_3_MIN) { |
| 343 | skb->protocol = proto; | 361 | skb->protocol = proto; |
| 344 | return; | 362 | return; |
| 345 | } | 363 | } |
diff --git a/include/linux/ktime.h b/include/linux/ktime.h index e83512f63df5..bbca12804d12 100644 --- a/include/linux/ktime.h +++ b/include/linux/ktime.h | |||
| @@ -330,6 +330,24 @@ static inline ktime_t ktime_sub_us(const ktime_t kt, const u64 usec) | |||
| 330 | 330 | ||
| 331 | extern ktime_t ktime_add_safe(const ktime_t lhs, const ktime_t rhs); | 331 | extern ktime_t ktime_add_safe(const ktime_t lhs, const ktime_t rhs); |
| 332 | 332 | ||
| 333 | /** | ||
| 334 | * ktime_to_timespec_cond - convert a ktime_t variable to timespec | ||
| 335 | * format only if the variable contains data | ||
| 336 | * @kt: the ktime_t variable to convert | ||
| 337 | * @ts: the timespec variable to store the result in | ||
| 338 | * | ||
| 339 | * Returns true if there was a successful conversion, false if kt was 0. | ||
| 340 | */ | ||
| 341 | static inline bool ktime_to_timespec_cond(const ktime_t kt, struct timespec *ts) | ||
| 342 | { | ||
| 343 | if (kt.tv64) { | ||
| 344 | *ts = ktime_to_timespec(kt); | ||
| 345 | return true; | ||
| 346 | } else { | ||
| 347 | return false; | ||
| 348 | } | ||
| 349 | } | ||
| 350 | |||
| 333 | /* | 351 | /* |
| 334 | * The resolution of the clocks. The resolution value is returned in | 352 | * The resolution of the clocks. The resolution value is returned in |
| 335 | * the clock_getres() system call to give application programmers an | 353 | * the clock_getres() system call to give application programmers an |
diff --git a/include/linux/micrel_phy.h b/include/linux/micrel_phy.h index 9dbb41a4e250..8752dbbc6135 100644 --- a/include/linux/micrel_phy.h +++ b/include/linux/micrel_phy.h | |||
| @@ -19,6 +19,7 @@ | |||
| 19 | #define PHY_ID_KSZ9021 0x00221610 | 19 | #define PHY_ID_KSZ9021 0x00221610 |
| 20 | #define PHY_ID_KS8737 0x00221720 | 20 | #define PHY_ID_KS8737 0x00221720 |
| 21 | #define PHY_ID_KSZ8021 0x00221555 | 21 | #define PHY_ID_KSZ8021 0x00221555 |
| 22 | #define PHY_ID_KSZ8031 0x00221556 | ||
| 22 | #define PHY_ID_KSZ8041 0x00221510 | 23 | #define PHY_ID_KSZ8041 0x00221510 |
| 23 | #define PHY_ID_KSZ8051 0x00221550 | 24 | #define PHY_ID_KSZ8051 0x00221550 |
| 24 | /* same id: ks8001 Rev. A/B, and ks8721 Rev 3. */ | 25 | /* same id: ks8001 Rev. A/B, and ks8721 Rev 3. */ |
diff --git a/include/linux/mlx4/cmd.h b/include/linux/mlx4/cmd.h index 260695186256..adf6e0648f20 100644 --- a/include/linux/mlx4/cmd.h +++ b/include/linux/mlx4/cmd.h | |||
| @@ -34,6 +34,7 @@ | |||
| 34 | #define MLX4_CMD_H | 34 | #define MLX4_CMD_H |
| 35 | 35 | ||
| 36 | #include <linux/dma-mapping.h> | 36 | #include <linux/dma-mapping.h> |
| 37 | #include <linux/if_link.h> | ||
| 37 | 38 | ||
| 38 | enum { | 39 | enum { |
| 39 | /* initialization and general commands */ | 40 | /* initialization and general commands */ |
| @@ -232,6 +233,11 @@ struct mlx4_cmd_mailbox *mlx4_alloc_cmd_mailbox(struct mlx4_dev *dev); | |||
| 232 | void mlx4_free_cmd_mailbox(struct mlx4_dev *dev, struct mlx4_cmd_mailbox *mailbox); | 233 | void mlx4_free_cmd_mailbox(struct mlx4_dev *dev, struct mlx4_cmd_mailbox *mailbox); |
| 233 | 234 | ||
| 234 | u32 mlx4_comm_get_version(void); | 235 | u32 mlx4_comm_get_version(void); |
| 236 | int mlx4_set_vf_mac(struct mlx4_dev *dev, int port, int vf, u64 mac); | ||
| 237 | int mlx4_set_vf_vlan(struct mlx4_dev *dev, int port, int vf, u16 vlan, u8 qos); | ||
| 238 | int mlx4_set_vf_spoofchk(struct mlx4_dev *dev, int port, int vf, bool setting); | ||
| 239 | int mlx4_get_vf_config(struct mlx4_dev *dev, int port, int vf, struct ifla_vf_info *ivf); | ||
| 240 | |||
| 235 | 241 | ||
| 236 | #define MLX4_COMM_GET_IF_REV(cmd_chan_ver) (u8)((cmd_chan_ver) >> 8) | 242 | #define MLX4_COMM_GET_IF_REV(cmd_chan_ver) (u8)((cmd_chan_ver) >> 8) |
| 237 | 243 | ||
diff --git a/include/linux/mlx4/cq.h b/include/linux/mlx4/cq.h index 6f65b2c8bb89..98fa492cf406 100644 --- a/include/linux/mlx4/cq.h +++ b/include/linux/mlx4/cq.h | |||
| @@ -64,6 +64,22 @@ struct mlx4_err_cqe { | |||
| 64 | u8 owner_sr_opcode; | 64 | u8 owner_sr_opcode; |
| 65 | }; | 65 | }; |
| 66 | 66 | ||
| 67 | struct mlx4_ts_cqe { | ||
| 68 | __be32 vlan_my_qpn; | ||
| 69 | __be32 immed_rss_invalid; | ||
| 70 | __be32 g_mlpath_rqpn; | ||
| 71 | __be32 timestamp_hi; | ||
| 72 | __be16 status; | ||
| 73 | u8 ipv6_ext_mask; | ||
| 74 | u8 badfcs_enc; | ||
| 75 | __be32 byte_cnt; | ||
| 76 | __be16 wqe_index; | ||
| 77 | __be16 checksum; | ||
| 78 | u8 reserved; | ||
| 79 | __be16 timestamp_lo; | ||
| 80 | u8 owner_sr_opcode; | ||
| 81 | } __packed; | ||
| 82 | |||
| 67 | enum { | 83 | enum { |
| 68 | MLX4_CQE_VLAN_PRESENT_MASK = 1 << 29, | 84 | MLX4_CQE_VLAN_PRESENT_MASK = 1 << 29, |
| 69 | MLX4_CQE_QPN_MASK = 0xffffff, | 85 | MLX4_CQE_QPN_MASK = 0xffffff, |
diff --git a/include/linux/mlx4/device.h b/include/linux/mlx4/device.h index 811f91cf5e8c..53acaf64189f 100644 --- a/include/linux/mlx4/device.h +++ b/include/linux/mlx4/device.h | |||
| @@ -40,6 +40,8 @@ | |||
| 40 | 40 | ||
| 41 | #include <linux/atomic.h> | 41 | #include <linux/atomic.h> |
| 42 | 42 | ||
| 43 | #include <linux/clocksource.h> | ||
| 44 | |||
| 43 | #define MAX_MSIX_P_PORT 17 | 45 | #define MAX_MSIX_P_PORT 17 |
| 44 | #define MAX_MSIX 64 | 46 | #define MAX_MSIX 64 |
| 45 | #define MSIX_LEGACY_SZ 4 | 47 | #define MSIX_LEGACY_SZ 4 |
| @@ -140,6 +142,7 @@ enum { | |||
| 140 | MLX4_DEV_CAP_FLAG_VEP_UC_STEER = 1LL << 41, | 142 | MLX4_DEV_CAP_FLAG_VEP_UC_STEER = 1LL << 41, |
| 141 | MLX4_DEV_CAP_FLAG_VEP_MC_STEER = 1LL << 42, | 143 | MLX4_DEV_CAP_FLAG_VEP_MC_STEER = 1LL << 42, |
| 142 | MLX4_DEV_CAP_FLAG_COUNTERS = 1LL << 48, | 144 | MLX4_DEV_CAP_FLAG_COUNTERS = 1LL << 48, |
| 145 | MLX4_DEV_CAP_FLAG_SET_ETH_SCHED = 1LL << 53, | ||
| 143 | MLX4_DEV_CAP_FLAG_SENSE_SUPPORT = 1LL << 55, | 146 | MLX4_DEV_CAP_FLAG_SENSE_SUPPORT = 1LL << 55, |
| 144 | MLX4_DEV_CAP_FLAG_PORT_MNG_CHG_EV = 1LL << 59, | 147 | MLX4_DEV_CAP_FLAG_PORT_MNG_CHG_EV = 1LL << 59, |
| 145 | MLX4_DEV_CAP_FLAG_64B_EQE = 1LL << 61, | 148 | MLX4_DEV_CAP_FLAG_64B_EQE = 1LL << 61, |
| @@ -151,7 +154,10 @@ enum { | |||
| 151 | MLX4_DEV_CAP_FLAG2_RSS_TOP = 1LL << 1, | 154 | MLX4_DEV_CAP_FLAG2_RSS_TOP = 1LL << 1, |
| 152 | MLX4_DEV_CAP_FLAG2_RSS_XOR = 1LL << 2, | 155 | MLX4_DEV_CAP_FLAG2_RSS_XOR = 1LL << 2, |
| 153 | MLX4_DEV_CAP_FLAG2_FS_EN = 1LL << 3, | 156 | MLX4_DEV_CAP_FLAG2_FS_EN = 1LL << 3, |
| 154 | MLX4_DEV_CAP_FLAGS2_REASSIGN_MAC_EN = 1LL << 4 | 157 | MLX4_DEV_CAP_FLAGS2_REASSIGN_MAC_EN = 1LL << 4, |
| 158 | MLX4_DEV_CAP_FLAG2_TS = 1LL << 5, | ||
| 159 | MLX4_DEV_CAP_FLAG2_VLAN_CONTROL = 1LL << 6, | ||
| 160 | MLX4_DEV_CAP_FLAG2_FSM = 1LL << 7 | ||
| 155 | }; | 161 | }; |
| 156 | 162 | ||
| 157 | enum { | 163 | enum { |
| @@ -443,6 +449,7 @@ struct mlx4_caps { | |||
| 443 | u8 eqe_factor; | 449 | u8 eqe_factor; |
| 444 | u32 userspace_caps; /* userspace must be aware of these */ | 450 | u32 userspace_caps; /* userspace must be aware of these */ |
| 445 | u32 function_caps; /* VFs must be aware of these */ | 451 | u32 function_caps; /* VFs must be aware of these */ |
| 452 | u16 hca_core_clock; | ||
| 446 | }; | 453 | }; |
| 447 | 454 | ||
| 448 | struct mlx4_buf_list { | 455 | struct mlx4_buf_list { |
| @@ -837,7 +844,7 @@ void mlx4_free_hwq_res(struct mlx4_dev *mdev, struct mlx4_hwq_resources *wqres, | |||
| 837 | 844 | ||
| 838 | int mlx4_cq_alloc(struct mlx4_dev *dev, int nent, struct mlx4_mtt *mtt, | 845 | int mlx4_cq_alloc(struct mlx4_dev *dev, int nent, struct mlx4_mtt *mtt, |
| 839 | struct mlx4_uar *uar, u64 db_rec, struct mlx4_cq *cq, | 846 | struct mlx4_uar *uar, u64 db_rec, struct mlx4_cq *cq, |
| 840 | unsigned vector, int collapsed); | 847 | unsigned vector, int collapsed, int timestamp_en); |
| 841 | void mlx4_cq_free(struct mlx4_dev *dev, struct mlx4_cq *cq); | 848 | void mlx4_cq_free(struct mlx4_dev *dev, struct mlx4_cq *cq); |
| 842 | 849 | ||
| 843 | int mlx4_qp_reserve_range(struct mlx4_dev *dev, int cnt, int align, int *base); | 850 | int mlx4_qp_reserve_range(struct mlx4_dev *dev, int cnt, int align, int *base); |
| @@ -1028,4 +1035,6 @@ int set_and_calc_slave_port_state(struct mlx4_dev *dev, int slave, u8 port, int | |||
| 1028 | void mlx4_put_slave_node_guid(struct mlx4_dev *dev, int slave, __be64 guid); | 1035 | void mlx4_put_slave_node_guid(struct mlx4_dev *dev, int slave, __be64 guid); |
| 1029 | __be64 mlx4_get_slave_node_guid(struct mlx4_dev *dev, int slave); | 1036 | __be64 mlx4_get_slave_node_guid(struct mlx4_dev *dev, int slave); |
| 1030 | 1037 | ||
| 1038 | cycle_t mlx4_read_clock(struct mlx4_dev *dev); | ||
| 1039 | |||
| 1031 | #endif /* MLX4_DEVICE_H */ | 1040 | #endif /* MLX4_DEVICE_H */ |
diff --git a/include/linux/mv643xx_eth.h b/include/linux/mv643xx_eth.h index 49258e0ed1c6..141d395bbb5f 100644 --- a/include/linux/mv643xx_eth.h +++ b/include/linux/mv643xx_eth.h | |||
| @@ -19,7 +19,6 @@ | |||
| 19 | 19 | ||
| 20 | struct mv643xx_eth_shared_platform_data { | 20 | struct mv643xx_eth_shared_platform_data { |
| 21 | struct mbus_dram_target_info *dram; | 21 | struct mbus_dram_target_info *dram; |
| 22 | struct platform_device *shared_smi; | ||
| 23 | /* | 22 | /* |
| 24 | * Max packet size for Tx IP/Layer 4 checksum, when set to 0, default | 23 | * Max packet size for Tx IP/Layer 4 checksum, when set to 0, default |
| 25 | * limit of 9KiB will be used. | 24 | * limit of 9KiB will be used. |
diff --git a/include/linux/netdev_features.h b/include/linux/netdev_features.h index 3dd39340430e..cbaa027ef5a7 100644 --- a/include/linux/netdev_features.h +++ b/include/linux/netdev_features.h | |||
| @@ -22,9 +22,12 @@ enum { | |||
| 22 | NETIF_F_IPV6_CSUM_BIT, /* Can checksum TCP/UDP over IPV6 */ | 22 | NETIF_F_IPV6_CSUM_BIT, /* Can checksum TCP/UDP over IPV6 */ |
| 23 | NETIF_F_HIGHDMA_BIT, /* Can DMA to high memory. */ | 23 | NETIF_F_HIGHDMA_BIT, /* Can DMA to high memory. */ |
| 24 | NETIF_F_FRAGLIST_BIT, /* Scatter/gather IO. */ | 24 | NETIF_F_FRAGLIST_BIT, /* Scatter/gather IO. */ |
| 25 | NETIF_F_HW_VLAN_TX_BIT, /* Transmit VLAN hw acceleration */ | 25 | NETIF_F_HW_VLAN_CTAG_TX_BIT, /* Transmit VLAN CTAG HW acceleration */ |
| 26 | NETIF_F_HW_VLAN_RX_BIT, /* Receive VLAN hw acceleration */ | 26 | NETIF_F_HW_VLAN_CTAG_RX_BIT, /* Receive VLAN CTAG HW acceleration */ |
| 27 | NETIF_F_HW_VLAN_FILTER_BIT, /* Receive filtering on VLAN */ | 27 | NETIF_F_HW_VLAN_CTAG_FILTER_BIT,/* Receive filtering on VLAN CTAGs */ |
| 28 | NETIF_F_HW_VLAN_STAG_TX_BIT, /* Transmit VLAN STAG HW acceleration */ | ||
| 29 | NETIF_F_HW_VLAN_STAG_RX_BIT, /* Receive VLAN STAG HW acceleration */ | ||
| 30 | NETIF_F_HW_VLAN_STAG_FILTER_BIT,/* Receive filtering on VLAN STAGs */ | ||
| 28 | NETIF_F_VLAN_CHALLENGED_BIT, /* Device cannot handle VLAN packets */ | 31 | NETIF_F_VLAN_CHALLENGED_BIT, /* Device cannot handle VLAN packets */ |
| 29 | NETIF_F_GSO_BIT, /* Enable software GSO. */ | 32 | NETIF_F_GSO_BIT, /* Enable software GSO. */ |
| 30 | NETIF_F_LLTX_BIT, /* LockLess TX - deprecated. Please */ | 33 | NETIF_F_LLTX_BIT, /* LockLess TX - deprecated. Please */ |
| @@ -42,9 +45,9 @@ enum { | |||
| 42 | NETIF_F_TSO6_BIT, /* ... TCPv6 segmentation */ | 45 | NETIF_F_TSO6_BIT, /* ... TCPv6 segmentation */ |
| 43 | NETIF_F_FSO_BIT, /* ... FCoE segmentation */ | 46 | NETIF_F_FSO_BIT, /* ... FCoE segmentation */ |
| 44 | NETIF_F_GSO_GRE_BIT, /* ... GRE with TSO */ | 47 | NETIF_F_GSO_GRE_BIT, /* ... GRE with TSO */ |
| 45 | /**/NETIF_F_GSO_LAST, /* [can't be last bit, see GSO_MASK] */ | 48 | NETIF_F_GSO_UDP_TUNNEL_BIT, /* ... UDP TUNNEL with TSO */ |
| 46 | NETIF_F_GSO_RESERVED2 /* ... free (fill GSO_MASK to 8 bits) */ | 49 | /**/NETIF_F_GSO_LAST = /* last bit, see GSO_MASK */ |
| 47 | = NETIF_F_GSO_LAST, | 50 | NETIF_F_GSO_UDP_TUNNEL_BIT, |
| 48 | 51 | ||
| 49 | NETIF_F_FCOE_CRC_BIT, /* FCoE CRC32 */ | 52 | NETIF_F_FCOE_CRC_BIT, /* FCoE CRC32 */ |
| 50 | NETIF_F_SCTP_CSUM_BIT, /* SCTP checksum offload */ | 53 | NETIF_F_SCTP_CSUM_BIT, /* SCTP checksum offload */ |
| @@ -80,9 +83,12 @@ enum { | |||
| 80 | #define NETIF_F_GSO_ROBUST __NETIF_F(GSO_ROBUST) | 83 | #define NETIF_F_GSO_ROBUST __NETIF_F(GSO_ROBUST) |
| 81 | #define NETIF_F_HIGHDMA __NETIF_F(HIGHDMA) | 84 | #define NETIF_F_HIGHDMA __NETIF_F(HIGHDMA) |
| 82 | #define NETIF_F_HW_CSUM __NETIF_F(HW_CSUM) | 85 | #define NETIF_F_HW_CSUM __NETIF_F(HW_CSUM) |
| 83 | #define NETIF_F_HW_VLAN_FILTER __NETIF_F(HW_VLAN_FILTER) | 86 | #define NETIF_F_HW_VLAN_CTAG_FILTER __NETIF_F(HW_VLAN_CTAG_FILTER) |
| 84 | #define NETIF_F_HW_VLAN_RX __NETIF_F(HW_VLAN_RX) | 87 | #define NETIF_F_HW_VLAN_CTAG_RX __NETIF_F(HW_VLAN_CTAG_RX) |
| 85 | #define NETIF_F_HW_VLAN_TX __NETIF_F(HW_VLAN_TX) | 88 | #define NETIF_F_HW_VLAN_CTAG_TX __NETIF_F(HW_VLAN_CTAG_TX) |
| 89 | #define NETIF_F_HW_VLAN_STAG_FILTER __NETIF_F(HW_VLAN_STAG_FILTER) | ||
| 90 | #define NETIF_F_HW_VLAN_STAG_RX __NETIF_F(HW_VLAN_STAG_RX) | ||
| 91 | #define NETIF_F_HW_VLAN_STAG_TX __NETIF_F(HW_VLAN_STAG_TX) | ||
| 86 | #define NETIF_F_IP_CSUM __NETIF_F(IP_CSUM) | 92 | #define NETIF_F_IP_CSUM __NETIF_F(IP_CSUM) |
| 87 | #define NETIF_F_IPV6_CSUM __NETIF_F(IPV6_CSUM) | 93 | #define NETIF_F_IPV6_CSUM __NETIF_F(IPV6_CSUM) |
| 88 | #define NETIF_F_LLTX __NETIF_F(LLTX) | 94 | #define NETIF_F_LLTX __NETIF_F(LLTX) |
| @@ -102,7 +108,8 @@ enum { | |||
| 102 | #define NETIF_F_VLAN_CHALLENGED __NETIF_F(VLAN_CHALLENGED) | 108 | #define NETIF_F_VLAN_CHALLENGED __NETIF_F(VLAN_CHALLENGED) |
| 103 | #define NETIF_F_RXFCS __NETIF_F(RXFCS) | 109 | #define NETIF_F_RXFCS __NETIF_F(RXFCS) |
| 104 | #define NETIF_F_RXALL __NETIF_F(RXALL) | 110 | #define NETIF_F_RXALL __NETIF_F(RXALL) |
| 105 | #define NETIF_F_GRE_GSO __NETIF_F(GSO_GRE) | 111 | #define NETIF_F_GSO_GRE __NETIF_F(GSO_GRE) |
| 112 | #define NETIF_F_GSO_UDP_TUNNEL __NETIF_F(GSO_UDP_TUNNEL) | ||
| 106 | 113 | ||
| 107 | /* Features valid for ethtool to change */ | 114 | /* Features valid for ethtool to change */ |
| 108 | /* = all defined minus driver/device-class-related */ | 115 | /* = all defined minus driver/device-class-related */ |
diff --git a/include/linux/netdevice.h b/include/linux/netdevice.h index 6151e903eef0..f8898a435dc5 100644 --- a/include/linux/netdevice.h +++ b/include/linux/netdevice.h | |||
| @@ -144,8 +144,6 @@ static inline bool dev_xmit_complete(int rc) | |||
| 144 | # else | 144 | # else |
| 145 | # define LL_MAX_HEADER 96 | 145 | # define LL_MAX_HEADER 96 |
| 146 | # endif | 146 | # endif |
| 147 | #elif IS_ENABLED(CONFIG_TR) | ||
| 148 | # define LL_MAX_HEADER 48 | ||
| 149 | #else | 147 | #else |
| 150 | # define LL_MAX_HEADER 32 | 148 | # define LL_MAX_HEADER 32 |
| 151 | #endif | 149 | #endif |
| @@ -211,6 +209,7 @@ struct netdev_hw_addr { | |||
| 211 | #define NETDEV_HW_ADDR_T_UNICAST 4 | 209 | #define NETDEV_HW_ADDR_T_UNICAST 4 |
| 212 | #define NETDEV_HW_ADDR_T_MULTICAST 5 | 210 | #define NETDEV_HW_ADDR_T_MULTICAST 5 |
| 213 | bool global_use; | 211 | bool global_use; |
| 212 | int sync_cnt; | ||
| 214 | int refcount; | 213 | int refcount; |
| 215 | int synced; | 214 | int synced; |
| 216 | struct rcu_head rcu_head; | 215 | struct rcu_head rcu_head; |
| @@ -785,13 +784,13 @@ struct netdev_fcoe_hbainfo { | |||
| 785 | * 3. Update dev->stats asynchronously and atomically, and define | 784 | * 3. Update dev->stats asynchronously and atomically, and define |
| 786 | * neither operation. | 785 | * neither operation. |
| 787 | * | 786 | * |
| 788 | * int (*ndo_vlan_rx_add_vid)(struct net_device *dev, unsigned short vid); | 787 | * int (*ndo_vlan_rx_add_vid)(struct net_device *dev, __be16 proto, u16t vid); |
| 789 | * If device support VLAN filtering (dev->features & NETIF_F_HW_VLAN_FILTER) | 788 | * If device support VLAN filtering this function is called when a |
| 790 | * this function is called when a VLAN id is registered. | 789 | * VLAN id is registered. |
| 791 | * | 790 | * |
| 792 | * int (*ndo_vlan_rx_kill_vid)(struct net_device *dev, unsigned short vid); | 791 | * int (*ndo_vlan_rx_kill_vid)(struct net_device *dev, unsigned short vid); |
| 793 | * If device support VLAN filtering (dev->features & NETIF_F_HW_VLAN_FILTER) | 792 | * If device support VLAN filtering this function is called when a |
| 794 | * this function is called when a VLAN id is unregistered. | 793 | * VLAN id is unregistered. |
| 795 | * | 794 | * |
| 796 | * void (*ndo_poll_controller)(struct net_device *dev); | 795 | * void (*ndo_poll_controller)(struct net_device *dev); |
| 797 | * | 796 | * |
| @@ -935,9 +934,9 @@ struct net_device_ops { | |||
| 935 | struct net_device_stats* (*ndo_get_stats)(struct net_device *dev); | 934 | struct net_device_stats* (*ndo_get_stats)(struct net_device *dev); |
| 936 | 935 | ||
| 937 | int (*ndo_vlan_rx_add_vid)(struct net_device *dev, | 936 | int (*ndo_vlan_rx_add_vid)(struct net_device *dev, |
| 938 | unsigned short vid); | 937 | __be16 proto, u16 vid); |
| 939 | int (*ndo_vlan_rx_kill_vid)(struct net_device *dev, | 938 | int (*ndo_vlan_rx_kill_vid)(struct net_device *dev, |
| 940 | unsigned short vid); | 939 | __be16 proto, u16 vid); |
| 941 | #ifdef CONFIG_NET_POLL_CONTROLLER | 940 | #ifdef CONFIG_NET_POLL_CONTROLLER |
| 942 | void (*ndo_poll_controller)(struct net_device *dev); | 941 | void (*ndo_poll_controller)(struct net_device *dev); |
| 943 | int (*ndo_netpoll_setup)(struct net_device *dev, | 942 | int (*ndo_netpoll_setup)(struct net_device *dev, |
| @@ -1073,6 +1072,8 @@ struct net_device { | |||
| 1073 | struct list_head dev_list; | 1072 | struct list_head dev_list; |
| 1074 | struct list_head napi_list; | 1073 | struct list_head napi_list; |
| 1075 | struct list_head unreg_list; | 1074 | struct list_head unreg_list; |
| 1075 | struct list_head upper_dev_list; /* List of upper devices */ | ||
| 1076 | |||
| 1076 | 1077 | ||
| 1077 | /* currently active device features */ | 1078 | /* currently active device features */ |
| 1078 | netdev_features_t features; | 1079 | netdev_features_t features; |
| @@ -1145,6 +1146,13 @@ struct net_device { | |||
| 1145 | spinlock_t addr_list_lock; | 1146 | spinlock_t addr_list_lock; |
| 1146 | struct netdev_hw_addr_list uc; /* Unicast mac addresses */ | 1147 | struct netdev_hw_addr_list uc; /* Unicast mac addresses */ |
| 1147 | struct netdev_hw_addr_list mc; /* Multicast mac addresses */ | 1148 | struct netdev_hw_addr_list mc; /* Multicast mac addresses */ |
| 1149 | struct netdev_hw_addr_list dev_addrs; /* list of device | ||
| 1150 | * hw addresses | ||
| 1151 | */ | ||
| 1152 | #ifdef CONFIG_SYSFS | ||
| 1153 | struct kset *queues_kset; | ||
| 1154 | #endif | ||
| 1155 | |||
| 1148 | bool uc_promisc; | 1156 | bool uc_promisc; |
| 1149 | unsigned int promiscuity; | 1157 | unsigned int promiscuity; |
| 1150 | unsigned int allmulti; | 1158 | unsigned int allmulti; |
| @@ -1177,21 +1185,11 @@ struct net_device { | |||
| 1177 | * avoid dirtying this cache line. | 1185 | * avoid dirtying this cache line. |
| 1178 | */ | 1186 | */ |
| 1179 | 1187 | ||
| 1180 | struct list_head upper_dev_list; /* List of upper devices */ | ||
| 1181 | |||
| 1182 | /* Interface address info used in eth_type_trans() */ | 1188 | /* Interface address info used in eth_type_trans() */ |
| 1183 | unsigned char *dev_addr; /* hw address, (before bcast | 1189 | unsigned char *dev_addr; /* hw address, (before bcast |
| 1184 | because most packets are | 1190 | because most packets are |
| 1185 | unicast) */ | 1191 | unicast) */ |
| 1186 | 1192 | ||
| 1187 | struct netdev_hw_addr_list dev_addrs; /* list of device | ||
| 1188 | hw addresses */ | ||
| 1189 | |||
| 1190 | unsigned char broadcast[MAX_ADDR_LEN]; /* hw bcast add */ | ||
| 1191 | |||
| 1192 | #ifdef CONFIG_SYSFS | ||
| 1193 | struct kset *queues_kset; | ||
| 1194 | #endif | ||
| 1195 | 1193 | ||
| 1196 | #ifdef CONFIG_RPS | 1194 | #ifdef CONFIG_RPS |
| 1197 | struct netdev_rx_queue *_rx; | 1195 | struct netdev_rx_queue *_rx; |
| @@ -1202,18 +1200,14 @@ struct net_device { | |||
| 1202 | /* Number of RX queues currently active in device */ | 1200 | /* Number of RX queues currently active in device */ |
| 1203 | unsigned int real_num_rx_queues; | 1201 | unsigned int real_num_rx_queues; |
| 1204 | 1202 | ||
| 1205 | #ifdef CONFIG_RFS_ACCEL | ||
| 1206 | /* CPU reverse-mapping for RX completion interrupts, indexed | ||
| 1207 | * by RX queue number. Assigned by driver. This must only be | ||
| 1208 | * set if the ndo_rx_flow_steer operation is defined. */ | ||
| 1209 | struct cpu_rmap *rx_cpu_rmap; | ||
| 1210 | #endif | ||
| 1211 | #endif | 1203 | #endif |
| 1212 | 1204 | ||
| 1213 | rx_handler_func_t __rcu *rx_handler; | 1205 | rx_handler_func_t __rcu *rx_handler; |
| 1214 | void __rcu *rx_handler_data; | 1206 | void __rcu *rx_handler_data; |
| 1215 | 1207 | ||
| 1216 | struct netdev_queue __rcu *ingress_queue; | 1208 | struct netdev_queue __rcu *ingress_queue; |
| 1209 | unsigned char broadcast[MAX_ADDR_LEN]; /* hw bcast add */ | ||
| 1210 | |||
| 1217 | 1211 | ||
| 1218 | /* | 1212 | /* |
| 1219 | * Cache lines mostly used on transmit path | 1213 | * Cache lines mostly used on transmit path |
| @@ -1235,6 +1229,12 @@ struct net_device { | |||
| 1235 | #ifdef CONFIG_XPS | 1229 | #ifdef CONFIG_XPS |
| 1236 | struct xps_dev_maps __rcu *xps_maps; | 1230 | struct xps_dev_maps __rcu *xps_maps; |
| 1237 | #endif | 1231 | #endif |
| 1232 | #ifdef CONFIG_RFS_ACCEL | ||
| 1233 | /* CPU reverse-mapping for RX completion interrupts, indexed | ||
| 1234 | * by RX queue number. Assigned by driver. This must only be | ||
| 1235 | * set if the ndo_rx_flow_steer operation is defined. */ | ||
| 1236 | struct cpu_rmap *rx_cpu_rmap; | ||
| 1237 | #endif | ||
| 1238 | 1238 | ||
| 1239 | /* These may be needed for future network-power-down code. */ | 1239 | /* These may be needed for future network-power-down code. */ |
| 1240 | 1240 | ||
| @@ -1475,6 +1475,11 @@ static inline void *netdev_priv(const struct net_device *dev) | |||
| 1475 | */ | 1475 | */ |
| 1476 | #define SET_NETDEV_DEVTYPE(net, devtype) ((net)->dev.type = (devtype)) | 1476 | #define SET_NETDEV_DEVTYPE(net, devtype) ((net)->dev.type = (devtype)) |
| 1477 | 1477 | ||
| 1478 | /* Default NAPI poll() weight | ||
| 1479 | * Device drivers are strongly advised to not use bigger value | ||
| 1480 | */ | ||
| 1481 | #define NAPI_POLL_WEIGHT 64 | ||
| 1482 | |||
| 1478 | /** | 1483 | /** |
| 1479 | * netif_napi_add - initialize a napi context | 1484 | * netif_napi_add - initialize a napi context |
| 1480 | * @dev: network device | 1485 | * @dev: network device |
| @@ -1612,6 +1617,9 @@ extern seqcount_t devnet_rename_seq; /* Device rename seq */ | |||
| 1612 | list_for_each_entry_continue(d, &(net)->dev_base_head, dev_list) | 1617 | list_for_each_entry_continue(d, &(net)->dev_base_head, dev_list) |
| 1613 | #define for_each_netdev_continue_rcu(net, d) \ | 1618 | #define for_each_netdev_continue_rcu(net, d) \ |
| 1614 | list_for_each_entry_continue_rcu(d, &(net)->dev_base_head, dev_list) | 1619 | list_for_each_entry_continue_rcu(d, &(net)->dev_base_head, dev_list) |
| 1620 | #define for_each_netdev_in_bond_rcu(bond, slave) \ | ||
| 1621 | for_each_netdev_rcu(&init_net, slave) \ | ||
| 1622 | if (netdev_master_upper_dev_get_rcu(slave) == bond) | ||
| 1615 | #define net_device_entry(lh) list_entry(lh, struct net_device, dev_list) | 1623 | #define net_device_entry(lh) list_entry(lh, struct net_device, dev_list) |
| 1616 | 1624 | ||
| 1617 | static inline struct net_device *next_net_device(struct net_device *dev) | 1625 | static inline struct net_device *next_net_device(struct net_device *dev) |
| @@ -1684,7 +1692,6 @@ extern int netdev_refcnt_read(const struct net_device *dev); | |||
| 1684 | extern void free_netdev(struct net_device *dev); | 1692 | extern void free_netdev(struct net_device *dev); |
| 1685 | extern void synchronize_net(void); | 1693 | extern void synchronize_net(void); |
| 1686 | extern int init_dummy_netdev(struct net_device *dev); | 1694 | extern int init_dummy_netdev(struct net_device *dev); |
| 1687 | extern void netdev_resync_ops(struct net_device *dev); | ||
| 1688 | 1695 | ||
| 1689 | extern struct net_device *dev_get_by_index(struct net *net, int ifindex); | 1696 | extern struct net_device *dev_get_by_index(struct net *net, int ifindex); |
| 1690 | extern struct net_device *__dev_get_by_index(struct net *net, int ifindex); | 1697 | extern struct net_device *__dev_get_by_index(struct net *net, int ifindex); |
| @@ -2621,6 +2628,7 @@ extern int dev_uc_add(struct net_device *dev, const unsigned char *addr); | |||
| 2621 | extern int dev_uc_add_excl(struct net_device *dev, const unsigned char *addr); | 2628 | extern int dev_uc_add_excl(struct net_device *dev, const unsigned char *addr); |
| 2622 | extern int dev_uc_del(struct net_device *dev, const unsigned char *addr); | 2629 | extern int dev_uc_del(struct net_device *dev, const unsigned char *addr); |
| 2623 | extern int dev_uc_sync(struct net_device *to, struct net_device *from); | 2630 | extern int dev_uc_sync(struct net_device *to, struct net_device *from); |
| 2631 | extern int dev_uc_sync_multiple(struct net_device *to, struct net_device *from); | ||
| 2624 | extern void dev_uc_unsync(struct net_device *to, struct net_device *from); | 2632 | extern void dev_uc_unsync(struct net_device *to, struct net_device *from); |
| 2625 | extern void dev_uc_flush(struct net_device *dev); | 2633 | extern void dev_uc_flush(struct net_device *dev); |
| 2626 | extern void dev_uc_init(struct net_device *dev); | 2634 | extern void dev_uc_init(struct net_device *dev); |
| @@ -2632,6 +2640,7 @@ extern int dev_mc_add_excl(struct net_device *dev, const unsigned char *addr); | |||
| 2632 | extern int dev_mc_del(struct net_device *dev, const unsigned char *addr); | 2640 | extern int dev_mc_del(struct net_device *dev, const unsigned char *addr); |
| 2633 | extern int dev_mc_del_global(struct net_device *dev, const unsigned char *addr); | 2641 | extern int dev_mc_del_global(struct net_device *dev, const unsigned char *addr); |
| 2634 | extern int dev_mc_sync(struct net_device *to, struct net_device *from); | 2642 | extern int dev_mc_sync(struct net_device *to, struct net_device *from); |
| 2643 | extern int dev_mc_sync_multiple(struct net_device *to, struct net_device *from); | ||
| 2635 | extern void dev_mc_unsync(struct net_device *to, struct net_device *from); | 2644 | extern void dev_mc_unsync(struct net_device *to, struct net_device *from); |
| 2636 | extern void dev_mc_flush(struct net_device *dev); | 2645 | extern void dev_mc_flush(struct net_device *dev); |
| 2637 | extern void dev_mc_init(struct net_device *dev); | 2646 | extern void dev_mc_init(struct net_device *dev); |
| @@ -2678,6 +2687,19 @@ struct sk_buff *skb_gso_segment(struct sk_buff *skb, netdev_features_t features) | |||
| 2678 | { | 2687 | { |
| 2679 | return __skb_gso_segment(skb, features, true); | 2688 | return __skb_gso_segment(skb, features, true); |
| 2680 | } | 2689 | } |
| 2690 | __be16 skb_network_protocol(struct sk_buff *skb); | ||
| 2691 | |||
| 2692 | static inline bool can_checksum_protocol(netdev_features_t features, | ||
| 2693 | __be16 protocol) | ||
| 2694 | { | ||
| 2695 | return ((features & NETIF_F_GEN_CSUM) || | ||
| 2696 | ((features & NETIF_F_V4_CSUM) && | ||
| 2697 | protocol == htons(ETH_P_IP)) || | ||
| 2698 | ((features & NETIF_F_V6_CSUM) && | ||
| 2699 | protocol == htons(ETH_P_IPV6)) || | ||
| 2700 | ((features & NETIF_F_FCOE_CRC) && | ||
| 2701 | protocol == htons(ETH_P_FCOE))); | ||
| 2702 | } | ||
| 2681 | 2703 | ||
| 2682 | #ifdef CONFIG_BUG | 2704 | #ifdef CONFIG_BUG |
| 2683 | extern void netdev_rx_csum_fault(struct net_device *dev); | 2705 | extern void netdev_rx_csum_fault(struct net_device *dev); |
| @@ -2756,6 +2778,11 @@ static inline void netif_set_gso_max_size(struct net_device *dev, | |||
| 2756 | dev->gso_max_size = size; | 2778 | dev->gso_max_size = size; |
| 2757 | } | 2779 | } |
| 2758 | 2780 | ||
| 2781 | static inline bool netif_is_bond_master(struct net_device *dev) | ||
| 2782 | { | ||
| 2783 | return dev->flags & IFF_MASTER && dev->priv_flags & IFF_BONDING; | ||
| 2784 | } | ||
| 2785 | |||
| 2759 | static inline bool netif_is_bond_slave(struct net_device *dev) | 2786 | static inline bool netif_is_bond_slave(struct net_device *dev) |
| 2760 | { | 2787 | { |
| 2761 | return dev->flags & IFF_SLAVE && dev->priv_flags & IFF_BONDING; | 2788 | return dev->flags & IFF_SLAVE && dev->priv_flags & IFF_BONDING; |
diff --git a/include/linux/netfilter.h b/include/linux/netfilter.h index ee142846f56a..0060fde3160e 100644 --- a/include/linux/netfilter.h +++ b/include/linux/netfilter.h | |||
| @@ -289,11 +289,6 @@ nf_nat_decode_session(struct sk_buff *skb, struct flowi *fl, u_int8_t family) | |||
| 289 | #endif | 289 | #endif |
| 290 | } | 290 | } |
| 291 | 291 | ||
| 292 | #ifdef CONFIG_PROC_FS | ||
| 293 | #include <linux/proc_fs.h> | ||
| 294 | extern struct proc_dir_entry *proc_net_netfilter; | ||
| 295 | #endif | ||
| 296 | |||
| 297 | #else /* !CONFIG_NETFILTER */ | 292 | #else /* !CONFIG_NETFILTER */ |
| 298 | #define NF_HOOK(pf, hook, skb, indev, outdev, okfn) (okfn)(skb) | 293 | #define NF_HOOK(pf, hook, skb, indev, outdev, okfn) (okfn)(skb) |
| 299 | #define NF_HOOK_COND(pf, hook, skb, indev, outdev, okfn, cond) (okfn)(skb) | 294 | #define NF_HOOK_COND(pf, hook, skb, indev, outdev, okfn, cond) (okfn)(skb) |
diff --git a/include/linux/netfilter/ipset/ip_set.h b/include/linux/netfilter/ipset/ip_set.h index 7958e84a65af..d80e2753847c 100644 --- a/include/linux/netfilter/ipset/ip_set.h +++ b/include/linux/netfilter/ipset/ip_set.h | |||
| @@ -1,7 +1,7 @@ | |||
| 1 | /* Copyright (C) 2000-2002 Joakim Axelsson <gozem@linux.nu> | 1 | /* Copyright (C) 2000-2002 Joakim Axelsson <gozem@linux.nu> |
| 2 | * Patrick Schaaf <bof@bof.de> | 2 | * Patrick Schaaf <bof@bof.de> |
| 3 | * Martin Josefsson <gandalf@wlug.westbo.se> | 3 | * Martin Josefsson <gandalf@wlug.westbo.se> |
| 4 | * Copyright (C) 2003-2011 Jozsef Kadlecsik <kadlec@blackhole.kfki.hu> | 4 | * Copyright (C) 2003-2013 Jozsef Kadlecsik <kadlec@blackhole.kfki.hu> |
| 5 | * | 5 | * |
| 6 | * This program is free software; you can redistribute it and/or modify | 6 | * This program is free software; you can redistribute it and/or modify |
| 7 | * it under the terms of the GNU General Public License version 2 as | 7 | * it under the terms of the GNU General Public License version 2 as |
| @@ -47,10 +47,36 @@ enum ip_set_feature { | |||
| 47 | IPSET_DUMP_LAST = (1 << IPSET_DUMP_LAST_FLAG), | 47 | IPSET_DUMP_LAST = (1 << IPSET_DUMP_LAST_FLAG), |
| 48 | }; | 48 | }; |
| 49 | 49 | ||
| 50 | /* Set extensions */ | ||
| 51 | enum ip_set_extension { | ||
| 52 | IPSET_EXT_NONE = 0, | ||
| 53 | IPSET_EXT_BIT_TIMEOUT = 1, | ||
| 54 | IPSET_EXT_TIMEOUT = (1 << IPSET_EXT_BIT_TIMEOUT), | ||
| 55 | IPSET_EXT_BIT_COUNTER = 2, | ||
| 56 | IPSET_EXT_COUNTER = (1 << IPSET_EXT_BIT_COUNTER), | ||
| 57 | }; | ||
| 58 | |||
| 59 | /* Extension offsets */ | ||
| 60 | enum ip_set_offset { | ||
| 61 | IPSET_OFFSET_TIMEOUT = 0, | ||
| 62 | IPSET_OFFSET_COUNTER, | ||
| 63 | IPSET_OFFSET_MAX, | ||
| 64 | }; | ||
| 65 | |||
| 66 | #define SET_WITH_TIMEOUT(s) ((s)->extensions & IPSET_EXT_TIMEOUT) | ||
| 67 | #define SET_WITH_COUNTER(s) ((s)->extensions & IPSET_EXT_COUNTER) | ||
| 68 | |||
| 69 | struct ip_set_ext { | ||
| 70 | unsigned long timeout; | ||
| 71 | u64 packets; | ||
| 72 | u64 bytes; | ||
| 73 | }; | ||
| 74 | |||
| 50 | struct ip_set; | 75 | struct ip_set; |
| 51 | 76 | ||
| 52 | typedef int (*ipset_adtfn)(struct ip_set *set, void *value, | 77 | typedef int (*ipset_adtfn)(struct ip_set *set, void *value, |
| 53 | u32 timeout, u32 flags); | 78 | const struct ip_set_ext *ext, |
| 79 | struct ip_set_ext *mext, u32 cmdflags); | ||
| 54 | 80 | ||
| 55 | /* Kernel API function options */ | 81 | /* Kernel API function options */ |
| 56 | struct ip_set_adt_opt { | 82 | struct ip_set_adt_opt { |
| @@ -58,7 +84,7 @@ struct ip_set_adt_opt { | |||
| 58 | u8 dim; /* Dimension of match/target */ | 84 | u8 dim; /* Dimension of match/target */ |
| 59 | u8 flags; /* Direction and negation flags */ | 85 | u8 flags; /* Direction and negation flags */ |
| 60 | u32 cmdflags; /* Command-like flags */ | 86 | u32 cmdflags; /* Command-like flags */ |
| 61 | u32 timeout; /* Timeout value */ | 87 | struct ip_set_ext ext; /* Extensions */ |
| 62 | }; | 88 | }; |
| 63 | 89 | ||
| 64 | /* Set type, variant-specific part */ | 90 | /* Set type, variant-specific part */ |
| @@ -69,7 +95,7 @@ struct ip_set_type_variant { | |||
| 69 | * positive for matching element */ | 95 | * positive for matching element */ |
| 70 | int (*kadt)(struct ip_set *set, const struct sk_buff *skb, | 96 | int (*kadt)(struct ip_set *set, const struct sk_buff *skb, |
| 71 | const struct xt_action_param *par, | 97 | const struct xt_action_param *par, |
| 72 | enum ipset_adt adt, const struct ip_set_adt_opt *opt); | 98 | enum ipset_adt adt, struct ip_set_adt_opt *opt); |
| 73 | 99 | ||
| 74 | /* Userspace: test/add/del entries | 100 | /* Userspace: test/add/del entries |
| 75 | * returns negative error code, | 101 | * returns negative error code, |
| @@ -151,10 +177,76 @@ struct ip_set { | |||
| 151 | u8 family; | 177 | u8 family; |
| 152 | /* The type revision */ | 178 | /* The type revision */ |
| 153 | u8 revision; | 179 | u8 revision; |
| 180 | /* Extensions */ | ||
| 181 | u8 extensions; | ||
| 154 | /* The type specific data */ | 182 | /* The type specific data */ |
| 155 | void *data; | 183 | void *data; |
| 156 | }; | 184 | }; |
| 157 | 185 | ||
| 186 | struct ip_set_counter { | ||
| 187 | atomic64_t bytes; | ||
| 188 | atomic64_t packets; | ||
| 189 | }; | ||
| 190 | |||
| 191 | static inline void | ||
| 192 | ip_set_add_bytes(u64 bytes, struct ip_set_counter *counter) | ||
| 193 | { | ||
| 194 | atomic64_add((long long)bytes, &(counter)->bytes); | ||
| 195 | } | ||
| 196 | |||
| 197 | static inline void | ||
| 198 | ip_set_add_packets(u64 packets, struct ip_set_counter *counter) | ||
| 199 | { | ||
| 200 | atomic64_add((long long)packets, &(counter)->packets); | ||
| 201 | } | ||
| 202 | |||
| 203 | static inline u64 | ||
| 204 | ip_set_get_bytes(const struct ip_set_counter *counter) | ||
| 205 | { | ||
| 206 | return (u64)atomic64_read(&(counter)->bytes); | ||
| 207 | } | ||
| 208 | |||
| 209 | static inline u64 | ||
| 210 | ip_set_get_packets(const struct ip_set_counter *counter) | ||
| 211 | { | ||
| 212 | return (u64)atomic64_read(&(counter)->packets); | ||
| 213 | } | ||
| 214 | |||
| 215 | static inline void | ||
| 216 | ip_set_update_counter(struct ip_set_counter *counter, | ||
| 217 | const struct ip_set_ext *ext, | ||
| 218 | struct ip_set_ext *mext, u32 flags) | ||
| 219 | { | ||
| 220 | if (ext->packets != ULLONG_MAX && | ||
| 221 | !(flags & IPSET_FLAG_SKIP_COUNTER_UPDATE)) { | ||
| 222 | ip_set_add_bytes(ext->bytes, counter); | ||
| 223 | ip_set_add_packets(ext->packets, counter); | ||
| 224 | } | ||
| 225 | if (flags & IPSET_FLAG_MATCH_COUNTERS) { | ||
| 226 | mext->packets = ip_set_get_packets(counter); | ||
| 227 | mext->bytes = ip_set_get_bytes(counter); | ||
| 228 | } | ||
| 229 | } | ||
| 230 | |||
| 231 | static inline bool | ||
| 232 | ip_set_put_counter(struct sk_buff *skb, struct ip_set_counter *counter) | ||
| 233 | { | ||
| 234 | return nla_put_net64(skb, IPSET_ATTR_BYTES, | ||
| 235 | cpu_to_be64(ip_set_get_bytes(counter))) || | ||
| 236 | nla_put_net64(skb, IPSET_ATTR_PACKETS, | ||
| 237 | cpu_to_be64(ip_set_get_packets(counter))); | ||
| 238 | } | ||
| 239 | |||
| 240 | static inline void | ||
| 241 | ip_set_init_counter(struct ip_set_counter *counter, | ||
| 242 | const struct ip_set_ext *ext) | ||
| 243 | { | ||
| 244 | if (ext->bytes != ULLONG_MAX) | ||
| 245 | atomic64_set(&(counter)->bytes, (long long)(ext->bytes)); | ||
| 246 | if (ext->packets != ULLONG_MAX) | ||
| 247 | atomic64_set(&(counter)->packets, (long long)(ext->packets)); | ||
| 248 | } | ||
| 249 | |||
| 158 | /* register and unregister set references */ | 250 | /* register and unregister set references */ |
| 159 | extern ip_set_id_t ip_set_get_byname(const char *name, struct ip_set **set); | 251 | extern ip_set_id_t ip_set_get_byname(const char *name, struct ip_set **set); |
| 160 | extern void ip_set_put_byindex(ip_set_id_t index); | 252 | extern void ip_set_put_byindex(ip_set_id_t index); |
| @@ -167,19 +259,21 @@ extern void ip_set_nfnl_put(ip_set_id_t index); | |||
| 167 | 259 | ||
| 168 | extern int ip_set_add(ip_set_id_t id, const struct sk_buff *skb, | 260 | extern int ip_set_add(ip_set_id_t id, const struct sk_buff *skb, |
| 169 | const struct xt_action_param *par, | 261 | const struct xt_action_param *par, |
| 170 | const struct ip_set_adt_opt *opt); | 262 | struct ip_set_adt_opt *opt); |
| 171 | extern int ip_set_del(ip_set_id_t id, const struct sk_buff *skb, | 263 | extern int ip_set_del(ip_set_id_t id, const struct sk_buff *skb, |
| 172 | const struct xt_action_param *par, | 264 | const struct xt_action_param *par, |
| 173 | const struct ip_set_adt_opt *opt); | 265 | struct ip_set_adt_opt *opt); |
| 174 | extern int ip_set_test(ip_set_id_t id, const struct sk_buff *skb, | 266 | extern int ip_set_test(ip_set_id_t id, const struct sk_buff *skb, |
| 175 | const struct xt_action_param *par, | 267 | const struct xt_action_param *par, |
| 176 | const struct ip_set_adt_opt *opt); | 268 | struct ip_set_adt_opt *opt); |
| 177 | 269 | ||
| 178 | /* Utility functions */ | 270 | /* Utility functions */ |
| 179 | extern void *ip_set_alloc(size_t size); | 271 | extern void *ip_set_alloc(size_t size); |
| 180 | extern void ip_set_free(void *members); | 272 | extern void ip_set_free(void *members); |
| 181 | extern int ip_set_get_ipaddr4(struct nlattr *nla, __be32 *ipaddr); | 273 | extern int ip_set_get_ipaddr4(struct nlattr *nla, __be32 *ipaddr); |
| 182 | extern int ip_set_get_ipaddr6(struct nlattr *nla, union nf_inet_addr *ipaddr); | 274 | extern int ip_set_get_ipaddr6(struct nlattr *nla, union nf_inet_addr *ipaddr); |
| 275 | extern int ip_set_get_extensions(struct ip_set *set, struct nlattr *tb[], | ||
| 276 | struct ip_set_ext *ext); | ||
| 183 | 277 | ||
| 184 | static inline int | 278 | static inline int |
| 185 | ip_set_get_hostipaddr4(struct nlattr *nla, u32 *ipaddr) | 279 | ip_set_get_hostipaddr4(struct nlattr *nla, u32 *ipaddr) |
| @@ -200,6 +294,14 @@ ip_set_eexist(int ret, u32 flags) | |||
| 200 | return ret == -IPSET_ERR_EXIST && (flags & IPSET_FLAG_EXIST); | 294 | return ret == -IPSET_ERR_EXIST && (flags & IPSET_FLAG_EXIST); |
| 201 | } | 295 | } |
| 202 | 296 | ||
| 297 | /* Match elements marked with nomatch */ | ||
| 298 | static inline bool | ||
| 299 | ip_set_enomatch(int ret, u32 flags, enum ipset_adt adt) | ||
| 300 | { | ||
| 301 | return adt == IPSET_TEST && | ||
| 302 | ret == -ENOTEMPTY && ((flags >> 16) & IPSET_FLAG_NOMATCH); | ||
| 303 | } | ||
| 304 | |||
| 203 | /* Check the NLA_F_NET_BYTEORDER flag */ | 305 | /* Check the NLA_F_NET_BYTEORDER flag */ |
| 204 | static inline bool | 306 | static inline bool |
| 205 | ip_set_attr_netorder(struct nlattr *tb[], int type) | 307 | ip_set_attr_netorder(struct nlattr *tb[], int type) |
| @@ -284,4 +386,14 @@ bitmap_bytes(u32 a, u32 b) | |||
| 284 | return 4 * ((((b - a + 8) / 8) + 3) / 4); | 386 | return 4 * ((((b - a + 8) / 8) + 3) / 4); |
| 285 | } | 387 | } |
| 286 | 388 | ||
| 389 | #include <linux/netfilter/ipset/ip_set_timeout.h> | ||
| 390 | |||
| 391 | #define IP_SET_INIT_KEXT(skb, opt, map) \ | ||
| 392 | { .bytes = (skb)->len, .packets = 1, \ | ||
| 393 | .timeout = ip_set_adt_opt_timeout(opt, map) } | ||
| 394 | |||
| 395 | #define IP_SET_INIT_UEXT(map) \ | ||
| 396 | { .bytes = ULLONG_MAX, .packets = ULLONG_MAX, \ | ||
| 397 | .timeout = (map)->timeout } | ||
| 398 | |||
| 287 | #endif /*_IP_SET_H */ | 399 | #endif /*_IP_SET_H */ |
diff --git a/include/linux/netfilter/ipset/ip_set_ahash.h b/include/linux/netfilter/ipset/ip_set_ahash.h deleted file mode 100644 index 0214c4c146fa..000000000000 --- a/include/linux/netfilter/ipset/ip_set_ahash.h +++ /dev/null | |||
| @@ -1,1241 +0,0 @@ | |||
| 1 | #ifndef _IP_SET_AHASH_H | ||
| 2 | #define _IP_SET_AHASH_H | ||
| 3 | |||
| 4 | #include <linux/rcupdate.h> | ||
| 5 | #include <linux/jhash.h> | ||
| 6 | #include <linux/netfilter/ipset/ip_set_timeout.h> | ||
| 7 | |||
| 8 | #define CONCAT(a, b, c) a##b##c | ||
| 9 | #define TOKEN(a, b, c) CONCAT(a, b, c) | ||
| 10 | |||
| 11 | #define type_pf_next TOKEN(TYPE, PF, _elem) | ||
| 12 | |||
| 13 | /* Hashing which uses arrays to resolve clashing. The hash table is resized | ||
| 14 | * (doubled) when searching becomes too long. | ||
| 15 | * Internally jhash is used with the assumption that the size of the | ||
| 16 | * stored data is a multiple of sizeof(u32). If storage supports timeout, | ||
| 17 | * the timeout field must be the last one in the data structure - that field | ||
| 18 | * is ignored when computing the hash key. | ||
| 19 | * | ||
| 20 | * Readers and resizing | ||
| 21 | * | ||
| 22 | * Resizing can be triggered by userspace command only, and those | ||
| 23 | * are serialized by the nfnl mutex. During resizing the set is | ||
| 24 | * read-locked, so the only possible concurrent operations are | ||
| 25 | * the kernel side readers. Those must be protected by proper RCU locking. | ||
| 26 | */ | ||
| 27 | |||
| 28 | /* Number of elements to store in an initial array block */ | ||
| 29 | #define AHASH_INIT_SIZE 4 | ||
| 30 | /* Max number of elements to store in an array block */ | ||
| 31 | #define AHASH_MAX_SIZE (3*AHASH_INIT_SIZE) | ||
| 32 | |||
| 33 | /* Max number of elements can be tuned */ | ||
| 34 | #ifdef IP_SET_HASH_WITH_MULTI | ||
| 35 | #define AHASH_MAX(h) ((h)->ahash_max) | ||
| 36 | |||
| 37 | static inline u8 | ||
| 38 | tune_ahash_max(u8 curr, u32 multi) | ||
| 39 | { | ||
| 40 | u32 n; | ||
| 41 | |||
| 42 | if (multi < curr) | ||
| 43 | return curr; | ||
| 44 | |||
| 45 | n = curr + AHASH_INIT_SIZE; | ||
| 46 | /* Currently, at listing one hash bucket must fit into a message. | ||
| 47 | * Therefore we have a hard limit here. | ||
| 48 | */ | ||
| 49 | return n > curr && n <= 64 ? n : curr; | ||
| 50 | } | ||
| 51 | #define TUNE_AHASH_MAX(h, multi) \ | ||
| 52 | ((h)->ahash_max = tune_ahash_max((h)->ahash_max, multi)) | ||
| 53 | #else | ||
| 54 | #define AHASH_MAX(h) AHASH_MAX_SIZE | ||
| 55 | #define TUNE_AHASH_MAX(h, multi) | ||
| 56 | #endif | ||
| 57 | |||
| 58 | /* A hash bucket */ | ||
| 59 | struct hbucket { | ||
| 60 | void *value; /* the array of the values */ | ||
| 61 | u8 size; /* size of the array */ | ||
| 62 | u8 pos; /* position of the first free entry */ | ||
| 63 | }; | ||
| 64 | |||
| 65 | /* The hash table: the table size stored here in order to make resizing easy */ | ||
| 66 | struct htable { | ||
| 67 | u8 htable_bits; /* size of hash table == 2^htable_bits */ | ||
| 68 | struct hbucket bucket[0]; /* hashtable buckets */ | ||
| 69 | }; | ||
| 70 | |||
| 71 | #define hbucket(h, i) (&((h)->bucket[i])) | ||
| 72 | |||
| 73 | /* Book-keeping of the prefixes added to the set */ | ||
| 74 | struct ip_set_hash_nets { | ||
| 75 | u8 cidr; /* the different cidr values in the set */ | ||
| 76 | u32 nets; /* number of elements per cidr */ | ||
| 77 | }; | ||
| 78 | |||
| 79 | /* The generic ip_set hash structure */ | ||
| 80 | struct ip_set_hash { | ||
| 81 | struct htable *table; /* the hash table */ | ||
| 82 | u32 maxelem; /* max elements in the hash */ | ||
| 83 | u32 elements; /* current element (vs timeout) */ | ||
| 84 | u32 initval; /* random jhash init value */ | ||
| 85 | u32 timeout; /* timeout value, if enabled */ | ||
| 86 | struct timer_list gc; /* garbage collection when timeout enabled */ | ||
| 87 | struct type_pf_next next; /* temporary storage for uadd */ | ||
| 88 | #ifdef IP_SET_HASH_WITH_MULTI | ||
| 89 | u8 ahash_max; /* max elements in an array block */ | ||
| 90 | #endif | ||
| 91 | #ifdef IP_SET_HASH_WITH_NETMASK | ||
| 92 | u8 netmask; /* netmask value for subnets to store */ | ||
| 93 | #endif | ||
| 94 | #ifdef IP_SET_HASH_WITH_RBTREE | ||
| 95 | struct rb_root rbtree; | ||
| 96 | #endif | ||
| 97 | #ifdef IP_SET_HASH_WITH_NETS | ||
| 98 | struct ip_set_hash_nets nets[0]; /* book-keeping of prefixes */ | ||
| 99 | #endif | ||
| 100 | }; | ||
| 101 | |||
| 102 | static size_t | ||
| 103 | htable_size(u8 hbits) | ||
| 104 | { | ||
| 105 | size_t hsize; | ||
| 106 | |||
| 107 | /* We must fit both into u32 in jhash and size_t */ | ||
| 108 | if (hbits > 31) | ||
| 109 | return 0; | ||
| 110 | hsize = jhash_size(hbits); | ||
| 111 | if ((((size_t)-1) - sizeof(struct htable))/sizeof(struct hbucket) | ||
| 112 | < hsize) | ||
| 113 | return 0; | ||
| 114 | |||
| 115 | return hsize * sizeof(struct hbucket) + sizeof(struct htable); | ||
| 116 | } | ||
| 117 | |||
| 118 | /* Compute htable_bits from the user input parameter hashsize */ | ||
| 119 | static u8 | ||
| 120 | htable_bits(u32 hashsize) | ||
| 121 | { | ||
| 122 | /* Assume that hashsize == 2^htable_bits */ | ||
| 123 | u8 bits = fls(hashsize - 1); | ||
| 124 | if (jhash_size(bits) != hashsize) | ||
| 125 | /* Round up to the first 2^n value */ | ||
| 126 | bits = fls(hashsize); | ||
| 127 | |||
| 128 | return bits; | ||
| 129 | } | ||
| 130 | |||
| 131 | #ifdef IP_SET_HASH_WITH_NETS | ||
| 132 | #ifdef IP_SET_HASH_WITH_NETS_PACKED | ||
| 133 | /* When cidr is packed with nomatch, cidr - 1 is stored in the entry */ | ||
| 134 | #define CIDR(cidr) (cidr + 1) | ||
| 135 | #else | ||
| 136 | #define CIDR(cidr) (cidr) | ||
| 137 | #endif | ||
| 138 | |||
| 139 | #define SET_HOST_MASK(family) (family == AF_INET ? 32 : 128) | ||
| 140 | #ifdef IP_SET_HASH_WITH_MULTI | ||
| 141 | #define NETS_LENGTH(family) (SET_HOST_MASK(family) + 1) | ||
| 142 | #else | ||
| 143 | #define NETS_LENGTH(family) SET_HOST_MASK(family) | ||
| 144 | #endif | ||
| 145 | |||
| 146 | /* Network cidr size book keeping when the hash stores different | ||
| 147 | * sized networks */ | ||
| 148 | static void | ||
| 149 | add_cidr(struct ip_set_hash *h, u8 cidr, u8 nets_length) | ||
| 150 | { | ||
| 151 | int i, j; | ||
| 152 | |||
| 153 | /* Add in increasing prefix order, so larger cidr first */ | ||
| 154 | for (i = 0, j = -1; i < nets_length && h->nets[i].nets; i++) { | ||
| 155 | if (j != -1) | ||
| 156 | continue; | ||
| 157 | else if (h->nets[i].cidr < cidr) | ||
| 158 | j = i; | ||
| 159 | else if (h->nets[i].cidr == cidr) { | ||
| 160 | h->nets[i].nets++; | ||
| 161 | return; | ||
| 162 | } | ||
| 163 | } | ||
| 164 | if (j != -1) { | ||
| 165 | for (; i > j; i--) { | ||
| 166 | h->nets[i].cidr = h->nets[i - 1].cidr; | ||
| 167 | h->nets[i].nets = h->nets[i - 1].nets; | ||
| 168 | } | ||
| 169 | } | ||
| 170 | h->nets[i].cidr = cidr; | ||
| 171 | h->nets[i].nets = 1; | ||
| 172 | } | ||
| 173 | |||
| 174 | static void | ||
| 175 | del_cidr(struct ip_set_hash *h, u8 cidr, u8 nets_length) | ||
| 176 | { | ||
| 177 | u8 i, j; | ||
| 178 | |||
| 179 | for (i = 0; i < nets_length - 1 && h->nets[i].cidr != cidr; i++) | ||
| 180 | ; | ||
| 181 | h->nets[i].nets--; | ||
| 182 | |||
| 183 | if (h->nets[i].nets != 0) | ||
| 184 | return; | ||
| 185 | |||
| 186 | for (j = i; j < nets_length - 1 && h->nets[j].nets; j++) { | ||
| 187 | h->nets[j].cidr = h->nets[j + 1].cidr; | ||
| 188 | h->nets[j].nets = h->nets[j + 1].nets; | ||
| 189 | } | ||
| 190 | } | ||
| 191 | #else | ||
| 192 | #define NETS_LENGTH(family) 0 | ||
| 193 | #endif | ||
| 194 | |||
| 195 | /* Destroy the hashtable part of the set */ | ||
| 196 | static void | ||
| 197 | ahash_destroy(struct htable *t) | ||
| 198 | { | ||
| 199 | struct hbucket *n; | ||
| 200 | u32 i; | ||
| 201 | |||
| 202 | for (i = 0; i < jhash_size(t->htable_bits); i++) { | ||
| 203 | n = hbucket(t, i); | ||
| 204 | if (n->size) | ||
| 205 | /* FIXME: use slab cache */ | ||
| 206 | kfree(n->value); | ||
| 207 | } | ||
| 208 | |||
| 209 | ip_set_free(t); | ||
| 210 | } | ||
| 211 | |||
| 212 | /* Calculate the actual memory size of the set data */ | ||
| 213 | static size_t | ||
| 214 | ahash_memsize(const struct ip_set_hash *h, size_t dsize, u8 nets_length) | ||
| 215 | { | ||
| 216 | u32 i; | ||
| 217 | struct htable *t = h->table; | ||
| 218 | size_t memsize = sizeof(*h) | ||
| 219 | + sizeof(*t) | ||
| 220 | #ifdef IP_SET_HASH_WITH_NETS | ||
| 221 | + sizeof(struct ip_set_hash_nets) * nets_length | ||
| 222 | #endif | ||
| 223 | + jhash_size(t->htable_bits) * sizeof(struct hbucket); | ||
| 224 | |||
| 225 | for (i = 0; i < jhash_size(t->htable_bits); i++) | ||
| 226 | memsize += t->bucket[i].size * dsize; | ||
| 227 | |||
| 228 | return memsize; | ||
| 229 | } | ||
| 230 | |||
| 231 | /* Flush a hash type of set: destroy all elements */ | ||
| 232 | static void | ||
| 233 | ip_set_hash_flush(struct ip_set *set) | ||
| 234 | { | ||
| 235 | struct ip_set_hash *h = set->data; | ||
| 236 | struct htable *t = h->table; | ||
| 237 | struct hbucket *n; | ||
| 238 | u32 i; | ||
| 239 | |||
| 240 | for (i = 0; i < jhash_size(t->htable_bits); i++) { | ||
| 241 | n = hbucket(t, i); | ||
| 242 | if (n->size) { | ||
| 243 | n->size = n->pos = 0; | ||
| 244 | /* FIXME: use slab cache */ | ||
| 245 | kfree(n->value); | ||
| 246 | } | ||
| 247 | } | ||
| 248 | #ifdef IP_SET_HASH_WITH_NETS | ||
| 249 | memset(h->nets, 0, sizeof(struct ip_set_hash_nets) | ||
| 250 | * NETS_LENGTH(set->family)); | ||
| 251 | #endif | ||
| 252 | h->elements = 0; | ||
| 253 | } | ||
| 254 | |||
| 255 | /* Destroy a hash type of set */ | ||
| 256 | static void | ||
| 257 | ip_set_hash_destroy(struct ip_set *set) | ||
| 258 | { | ||
| 259 | struct ip_set_hash *h = set->data; | ||
| 260 | |||
| 261 | if (with_timeout(h->timeout)) | ||
| 262 | del_timer_sync(&h->gc); | ||
| 263 | |||
| 264 | ahash_destroy(h->table); | ||
| 265 | #ifdef IP_SET_HASH_WITH_RBTREE | ||
| 266 | rbtree_destroy(&h->rbtree); | ||
| 267 | #endif | ||
| 268 | kfree(h); | ||
| 269 | |||
| 270 | set->data = NULL; | ||
| 271 | } | ||
| 272 | |||
| 273 | #endif /* _IP_SET_AHASH_H */ | ||
| 274 | |||
| 275 | #ifndef HKEY_DATALEN | ||
| 276 | #define HKEY_DATALEN sizeof(struct type_pf_elem) | ||
| 277 | #endif | ||
| 278 | |||
| 279 | #define HKEY(data, initval, htable_bits) \ | ||
| 280 | (jhash2((u32 *)(data), HKEY_DATALEN/sizeof(u32), initval) \ | ||
| 281 | & jhash_mask(htable_bits)) | ||
| 282 | |||
| 283 | /* Type/family dependent function prototypes */ | ||
| 284 | |||
| 285 | #define type_pf_data_equal TOKEN(TYPE, PF, _data_equal) | ||
| 286 | #define type_pf_data_isnull TOKEN(TYPE, PF, _data_isnull) | ||
| 287 | #define type_pf_data_copy TOKEN(TYPE, PF, _data_copy) | ||
| 288 | #define type_pf_data_zero_out TOKEN(TYPE, PF, _data_zero_out) | ||
| 289 | #define type_pf_data_netmask TOKEN(TYPE, PF, _data_netmask) | ||
| 290 | #define type_pf_data_list TOKEN(TYPE, PF, _data_list) | ||
| 291 | #define type_pf_data_tlist TOKEN(TYPE, PF, _data_tlist) | ||
| 292 | #define type_pf_data_next TOKEN(TYPE, PF, _data_next) | ||
| 293 | #define type_pf_data_flags TOKEN(TYPE, PF, _data_flags) | ||
| 294 | #define type_pf_data_reset_flags TOKEN(TYPE, PF, _data_reset_flags) | ||
| 295 | #ifdef IP_SET_HASH_WITH_NETS | ||
| 296 | #define type_pf_data_match TOKEN(TYPE, PF, _data_match) | ||
| 297 | #else | ||
| 298 | #define type_pf_data_match(d) 1 | ||
| 299 | #endif | ||
| 300 | |||
| 301 | #define type_pf_elem TOKEN(TYPE, PF, _elem) | ||
| 302 | #define type_pf_telem TOKEN(TYPE, PF, _telem) | ||
| 303 | #define type_pf_data_timeout TOKEN(TYPE, PF, _data_timeout) | ||
| 304 | #define type_pf_data_expired TOKEN(TYPE, PF, _data_expired) | ||
| 305 | #define type_pf_data_timeout_set TOKEN(TYPE, PF, _data_timeout_set) | ||
| 306 | |||
| 307 | #define type_pf_elem_add TOKEN(TYPE, PF, _elem_add) | ||
| 308 | #define type_pf_add TOKEN(TYPE, PF, _add) | ||
| 309 | #define type_pf_del TOKEN(TYPE, PF, _del) | ||
| 310 | #define type_pf_test_cidrs TOKEN(TYPE, PF, _test_cidrs) | ||
| 311 | #define type_pf_test TOKEN(TYPE, PF, _test) | ||
| 312 | |||
| 313 | #define type_pf_elem_tadd TOKEN(TYPE, PF, _elem_tadd) | ||
| 314 | #define type_pf_del_telem TOKEN(TYPE, PF, _ahash_del_telem) | ||
| 315 | #define type_pf_expire TOKEN(TYPE, PF, _expire) | ||
| 316 | #define type_pf_tadd TOKEN(TYPE, PF, _tadd) | ||
| 317 | #define type_pf_tdel TOKEN(TYPE, PF, _tdel) | ||
| 318 | #define type_pf_ttest_cidrs TOKEN(TYPE, PF, _ahash_ttest_cidrs) | ||
| 319 | #define type_pf_ttest TOKEN(TYPE, PF, _ahash_ttest) | ||
| 320 | |||
| 321 | #define type_pf_resize TOKEN(TYPE, PF, _resize) | ||
| 322 | #define type_pf_tresize TOKEN(TYPE, PF, _tresize) | ||
| 323 | #define type_pf_flush ip_set_hash_flush | ||
| 324 | #define type_pf_destroy ip_set_hash_destroy | ||
| 325 | #define type_pf_head TOKEN(TYPE, PF, _head) | ||
| 326 | #define type_pf_list TOKEN(TYPE, PF, _list) | ||
| 327 | #define type_pf_tlist TOKEN(TYPE, PF, _tlist) | ||
| 328 | #define type_pf_same_set TOKEN(TYPE, PF, _same_set) | ||
| 329 | #define type_pf_kadt TOKEN(TYPE, PF, _kadt) | ||
| 330 | #define type_pf_uadt TOKEN(TYPE, PF, _uadt) | ||
| 331 | #define type_pf_gc TOKEN(TYPE, PF, _gc) | ||
| 332 | #define type_pf_gc_init TOKEN(TYPE, PF, _gc_init) | ||
| 333 | #define type_pf_variant TOKEN(TYPE, PF, _variant) | ||
| 334 | #define type_pf_tvariant TOKEN(TYPE, PF, _tvariant) | ||
| 335 | |||
| 336 | /* Flavour without timeout */ | ||
| 337 | |||
| 338 | /* Get the ith element from the array block n */ | ||
| 339 | #define ahash_data(n, i) \ | ||
| 340 | ((struct type_pf_elem *)((n)->value) + (i)) | ||
| 341 | |||
| 342 | /* Add an element to the hash table when resizing the set: | ||
| 343 | * we spare the maintenance of the internal counters. */ | ||
| 344 | static int | ||
| 345 | type_pf_elem_add(struct hbucket *n, const struct type_pf_elem *value, | ||
| 346 | u8 ahash_max, u32 cadt_flags) | ||
| 347 | { | ||
| 348 | struct type_pf_elem *data; | ||
| 349 | |||
| 350 | if (n->pos >= n->size) { | ||
| 351 | void *tmp; | ||
| 352 | |||
| 353 | if (n->size >= ahash_max) | ||
| 354 | /* Trigger rehashing */ | ||
| 355 | return -EAGAIN; | ||
| 356 | |||
| 357 | tmp = kzalloc((n->size + AHASH_INIT_SIZE) | ||
| 358 | * sizeof(struct type_pf_elem), | ||
| 359 | GFP_ATOMIC); | ||
| 360 | if (!tmp) | ||
| 361 | return -ENOMEM; | ||
| 362 | if (n->size) { | ||
| 363 | memcpy(tmp, n->value, | ||
| 364 | sizeof(struct type_pf_elem) * n->size); | ||
| 365 | kfree(n->value); | ||
| 366 | } | ||
| 367 | n->value = tmp; | ||
| 368 | n->size += AHASH_INIT_SIZE; | ||
| 369 | } | ||
| 370 | data = ahash_data(n, n->pos++); | ||
| 371 | type_pf_data_copy(data, value); | ||
| 372 | #ifdef IP_SET_HASH_WITH_NETS | ||
| 373 | /* Resizing won't overwrite stored flags */ | ||
| 374 | if (cadt_flags) | ||
| 375 | type_pf_data_flags(data, cadt_flags); | ||
| 376 | #endif | ||
| 377 | return 0; | ||
| 378 | } | ||
| 379 | |||
| 380 | /* Resize a hash: create a new hash table with doubling the hashsize | ||
| 381 | * and inserting the elements to it. Repeat until we succeed or | ||
| 382 | * fail due to memory pressures. */ | ||
| 383 | static int | ||
| 384 | type_pf_resize(struct ip_set *set, bool retried) | ||
| 385 | { | ||
| 386 | struct ip_set_hash *h = set->data; | ||
| 387 | struct htable *t, *orig = h->table; | ||
| 388 | u8 htable_bits = orig->htable_bits; | ||
| 389 | struct type_pf_elem *data; | ||
| 390 | struct hbucket *n, *m; | ||
| 391 | u32 i, j, flags = 0; | ||
| 392 | int ret; | ||
| 393 | |||
| 394 | retry: | ||
| 395 | ret = 0; | ||
| 396 | htable_bits++; | ||
| 397 | pr_debug("attempt to resize set %s from %u to %u, t %p\n", | ||
| 398 | set->name, orig->htable_bits, htable_bits, orig); | ||
| 399 | if (!htable_bits) { | ||
| 400 | /* In case we have plenty of memory :-) */ | ||
| 401 | pr_warning("Cannot increase the hashsize of set %s further\n", | ||
| 402 | set->name); | ||
| 403 | return -IPSET_ERR_HASH_FULL; | ||
| 404 | } | ||
| 405 | t = ip_set_alloc(sizeof(*t) | ||
| 406 | + jhash_size(htable_bits) * sizeof(struct hbucket)); | ||
| 407 | if (!t) | ||
| 408 | return -ENOMEM; | ||
| 409 | t->htable_bits = htable_bits; | ||
| 410 | |||
| 411 | read_lock_bh(&set->lock); | ||
| 412 | for (i = 0; i < jhash_size(orig->htable_bits); i++) { | ||
| 413 | n = hbucket(orig, i); | ||
| 414 | for (j = 0; j < n->pos; j++) { | ||
| 415 | data = ahash_data(n, j); | ||
| 416 | #ifdef IP_SET_HASH_WITH_NETS | ||
| 417 | flags = 0; | ||
| 418 | type_pf_data_reset_flags(data, &flags); | ||
| 419 | #endif | ||
| 420 | m = hbucket(t, HKEY(data, h->initval, htable_bits)); | ||
| 421 | ret = type_pf_elem_add(m, data, AHASH_MAX(h), flags); | ||
| 422 | if (ret < 0) { | ||
| 423 | #ifdef IP_SET_HASH_WITH_NETS | ||
| 424 | type_pf_data_flags(data, flags); | ||
| 425 | #endif | ||
| 426 | read_unlock_bh(&set->lock); | ||
| 427 | ahash_destroy(t); | ||
| 428 | if (ret == -EAGAIN) | ||
| 429 | goto retry; | ||
| 430 | return ret; | ||
| 431 | } | ||
| 432 | } | ||
| 433 | } | ||
| 434 | |||
| 435 | rcu_assign_pointer(h->table, t); | ||
| 436 | read_unlock_bh(&set->lock); | ||
| 437 | |||
| 438 | /* Give time to other readers of the set */ | ||
| 439 | synchronize_rcu_bh(); | ||
| 440 | |||
| 441 | pr_debug("set %s resized from %u (%p) to %u (%p)\n", set->name, | ||
| 442 | orig->htable_bits, orig, t->htable_bits, t); | ||
| 443 | ahash_destroy(orig); | ||
| 444 | |||
| 445 | return 0; | ||
| 446 | } | ||
| 447 | |||
| 448 | static inline void | ||
| 449 | type_pf_data_next(struct ip_set_hash *h, const struct type_pf_elem *d); | ||
| 450 | |||
| 451 | /* Add an element to a hash and update the internal counters when succeeded, | ||
| 452 | * otherwise report the proper error code. */ | ||
| 453 | static int | ||
| 454 | type_pf_add(struct ip_set *set, void *value, u32 timeout, u32 flags) | ||
| 455 | { | ||
| 456 | struct ip_set_hash *h = set->data; | ||
| 457 | struct htable *t; | ||
| 458 | const struct type_pf_elem *d = value; | ||
| 459 | struct hbucket *n; | ||
| 460 | int i, ret = 0; | ||
| 461 | u32 key, multi = 0; | ||
| 462 | u32 cadt_flags = flags >> 16; | ||
| 463 | |||
| 464 | if (h->elements >= h->maxelem) { | ||
| 465 | if (net_ratelimit()) | ||
| 466 | pr_warning("Set %s is full, maxelem %u reached\n", | ||
| 467 | set->name, h->maxelem); | ||
| 468 | return -IPSET_ERR_HASH_FULL; | ||
| 469 | } | ||
| 470 | |||
| 471 | rcu_read_lock_bh(); | ||
| 472 | t = rcu_dereference_bh(h->table); | ||
| 473 | key = HKEY(value, h->initval, t->htable_bits); | ||
| 474 | n = hbucket(t, key); | ||
| 475 | for (i = 0; i < n->pos; i++) | ||
| 476 | if (type_pf_data_equal(ahash_data(n, i), d, &multi)) { | ||
| 477 | #ifdef IP_SET_HASH_WITH_NETS | ||
| 478 | if (flags & IPSET_FLAG_EXIST) | ||
| 479 | /* Support overwriting just the flags */ | ||
| 480 | type_pf_data_flags(ahash_data(n, i), | ||
| 481 | cadt_flags); | ||
| 482 | #endif | ||
| 483 | ret = -IPSET_ERR_EXIST; | ||
| 484 | goto out; | ||
| 485 | } | ||
| 486 | TUNE_AHASH_MAX(h, multi); | ||
| 487 | ret = type_pf_elem_add(n, value, AHASH_MAX(h), cadt_flags); | ||
| 488 | if (ret != 0) { | ||
| 489 | if (ret == -EAGAIN) | ||
| 490 | type_pf_data_next(h, d); | ||
| 491 | goto out; | ||
| 492 | } | ||
| 493 | |||
| 494 | #ifdef IP_SET_HASH_WITH_NETS | ||
| 495 | add_cidr(h, CIDR(d->cidr), NETS_LENGTH(set->family)); | ||
| 496 | #endif | ||
| 497 | h->elements++; | ||
| 498 | out: | ||
| 499 | rcu_read_unlock_bh(); | ||
| 500 | return ret; | ||
| 501 | } | ||
| 502 | |||
| 503 | /* Delete an element from the hash: swap it with the last element | ||
| 504 | * and free up space if possible. | ||
| 505 | */ | ||
| 506 | static int | ||
| 507 | type_pf_del(struct ip_set *set, void *value, u32 timeout, u32 flags) | ||
| 508 | { | ||
| 509 | struct ip_set_hash *h = set->data; | ||
| 510 | struct htable *t = h->table; | ||
| 511 | const struct type_pf_elem *d = value; | ||
| 512 | struct hbucket *n; | ||
| 513 | int i; | ||
| 514 | struct type_pf_elem *data; | ||
| 515 | u32 key, multi = 0; | ||
| 516 | |||
| 517 | key = HKEY(value, h->initval, t->htable_bits); | ||
| 518 | n = hbucket(t, key); | ||
| 519 | for (i = 0; i < n->pos; i++) { | ||
| 520 | data = ahash_data(n, i); | ||
| 521 | if (!type_pf_data_equal(data, d, &multi)) | ||
| 522 | continue; | ||
| 523 | if (i != n->pos - 1) | ||
| 524 | /* Not last one */ | ||
| 525 | type_pf_data_copy(data, ahash_data(n, n->pos - 1)); | ||
| 526 | |||
| 527 | n->pos--; | ||
| 528 | h->elements--; | ||
| 529 | #ifdef IP_SET_HASH_WITH_NETS | ||
| 530 | del_cidr(h, CIDR(d->cidr), NETS_LENGTH(set->family)); | ||
| 531 | #endif | ||
| 532 | if (n->pos + AHASH_INIT_SIZE < n->size) { | ||
| 533 | void *tmp = kzalloc((n->size - AHASH_INIT_SIZE) | ||
| 534 | * sizeof(struct type_pf_elem), | ||
| 535 | GFP_ATOMIC); | ||
| 536 | if (!tmp) | ||
| 537 | return 0; | ||
| 538 | n->size -= AHASH_INIT_SIZE; | ||
| 539 | memcpy(tmp, n->value, | ||
| 540 | n->size * sizeof(struct type_pf_elem)); | ||
| 541 | kfree(n->value); | ||
| 542 | n->value = tmp; | ||
| 543 | } | ||
| 544 | return 0; | ||
| 545 | } | ||
| 546 | |||
| 547 | return -IPSET_ERR_EXIST; | ||
| 548 | } | ||
| 549 | |||
| 550 | #ifdef IP_SET_HASH_WITH_NETS | ||
| 551 | |||
| 552 | /* Special test function which takes into account the different network | ||
| 553 | * sizes added to the set */ | ||
| 554 | static int | ||
| 555 | type_pf_test_cidrs(struct ip_set *set, struct type_pf_elem *d, u32 timeout) | ||
| 556 | { | ||
| 557 | struct ip_set_hash *h = set->data; | ||
| 558 | struct htable *t = h->table; | ||
| 559 | struct hbucket *n; | ||
| 560 | const struct type_pf_elem *data; | ||
| 561 | int i, j = 0; | ||
| 562 | u32 key, multi = 0; | ||
| 563 | u8 nets_length = NETS_LENGTH(set->family); | ||
| 564 | |||
| 565 | pr_debug("test by nets\n"); | ||
| 566 | for (; j < nets_length && h->nets[j].nets && !multi; j++) { | ||
| 567 | type_pf_data_netmask(d, h->nets[j].cidr); | ||
| 568 | key = HKEY(d, h->initval, t->htable_bits); | ||
| 569 | n = hbucket(t, key); | ||
| 570 | for (i = 0; i < n->pos; i++) { | ||
| 571 | data = ahash_data(n, i); | ||
| 572 | if (type_pf_data_equal(data, d, &multi)) | ||
| 573 | return type_pf_data_match(data); | ||
| 574 | } | ||
| 575 | } | ||
| 576 | return 0; | ||
| 577 | } | ||
| 578 | #endif | ||
| 579 | |||
| 580 | /* Test whether the element is added to the set */ | ||
| 581 | static int | ||
| 582 | type_pf_test(struct ip_set *set, void *value, u32 timeout, u32 flags) | ||
| 583 | { | ||
| 584 | struct ip_set_hash *h = set->data; | ||
| 585 | struct htable *t = h->table; | ||
| 586 | struct type_pf_elem *d = value; | ||
| 587 | struct hbucket *n; | ||
| 588 | const struct type_pf_elem *data; | ||
| 589 | int i; | ||
| 590 | u32 key, multi = 0; | ||
| 591 | |||
| 592 | #ifdef IP_SET_HASH_WITH_NETS | ||
| 593 | /* If we test an IP address and not a network address, | ||
| 594 | * try all possible network sizes */ | ||
| 595 | if (CIDR(d->cidr) == SET_HOST_MASK(set->family)) | ||
| 596 | return type_pf_test_cidrs(set, d, timeout); | ||
| 597 | #endif | ||
| 598 | |||
| 599 | key = HKEY(d, h->initval, t->htable_bits); | ||
| 600 | n = hbucket(t, key); | ||
| 601 | for (i = 0; i < n->pos; i++) { | ||
| 602 | data = ahash_data(n, i); | ||
| 603 | if (type_pf_data_equal(data, d, &multi)) | ||
| 604 | return type_pf_data_match(data); | ||
| 605 | } | ||
| 606 | return 0; | ||
| 607 | } | ||
| 608 | |||
| 609 | /* Reply a HEADER request: fill out the header part of the set */ | ||
| 610 | static int | ||
| 611 | type_pf_head(struct ip_set *set, struct sk_buff *skb) | ||
| 612 | { | ||
| 613 | const struct ip_set_hash *h = set->data; | ||
| 614 | struct nlattr *nested; | ||
| 615 | size_t memsize; | ||
| 616 | |||
| 617 | read_lock_bh(&set->lock); | ||
| 618 | memsize = ahash_memsize(h, with_timeout(h->timeout) | ||
| 619 | ? sizeof(struct type_pf_telem) | ||
| 620 | : sizeof(struct type_pf_elem), | ||
| 621 | NETS_LENGTH(set->family)); | ||
| 622 | read_unlock_bh(&set->lock); | ||
| 623 | |||
| 624 | nested = ipset_nest_start(skb, IPSET_ATTR_DATA); | ||
| 625 | if (!nested) | ||
| 626 | goto nla_put_failure; | ||
| 627 | if (nla_put_net32(skb, IPSET_ATTR_HASHSIZE, | ||
| 628 | htonl(jhash_size(h->table->htable_bits))) || | ||
| 629 | nla_put_net32(skb, IPSET_ATTR_MAXELEM, htonl(h->maxelem))) | ||
| 630 | goto nla_put_failure; | ||
| 631 | #ifdef IP_SET_HASH_WITH_NETMASK | ||
| 632 | if (h->netmask != HOST_MASK && | ||
| 633 | nla_put_u8(skb, IPSET_ATTR_NETMASK, h->netmask)) | ||
| 634 | goto nla_put_failure; | ||
| 635 | #endif | ||
| 636 | if (nla_put_net32(skb, IPSET_ATTR_REFERENCES, htonl(set->ref - 1)) || | ||
| 637 | nla_put_net32(skb, IPSET_ATTR_MEMSIZE, htonl(memsize)) || | ||
| 638 | (with_timeout(h->timeout) && | ||
| 639 | nla_put_net32(skb, IPSET_ATTR_TIMEOUT, htonl(h->timeout)))) | ||
| 640 | goto nla_put_failure; | ||
| 641 | ipset_nest_end(skb, nested); | ||
| 642 | |||
| 643 | return 0; | ||
| 644 | nla_put_failure: | ||
| 645 | return -EMSGSIZE; | ||
| 646 | } | ||
| 647 | |||
| 648 | /* Reply a LIST/SAVE request: dump the elements of the specified set */ | ||
| 649 | static int | ||
| 650 | type_pf_list(const struct ip_set *set, | ||
| 651 | struct sk_buff *skb, struct netlink_callback *cb) | ||
| 652 | { | ||
| 653 | const struct ip_set_hash *h = set->data; | ||
| 654 | const struct htable *t = h->table; | ||
| 655 | struct nlattr *atd, *nested; | ||
| 656 | const struct hbucket *n; | ||
| 657 | const struct type_pf_elem *data; | ||
| 658 | u32 first = cb->args[2]; | ||
| 659 | /* We assume that one hash bucket fills into one page */ | ||
| 660 | void *incomplete; | ||
| 661 | int i; | ||
| 662 | |||
| 663 | atd = ipset_nest_start(skb, IPSET_ATTR_ADT); | ||
| 664 | if (!atd) | ||
| 665 | return -EMSGSIZE; | ||
| 666 | pr_debug("list hash set %s\n", set->name); | ||
| 667 | for (; cb->args[2] < jhash_size(t->htable_bits); cb->args[2]++) { | ||
| 668 | incomplete = skb_tail_pointer(skb); | ||
| 669 | n = hbucket(t, cb->args[2]); | ||
| 670 | pr_debug("cb->args[2]: %lu, t %p n %p\n", cb->args[2], t, n); | ||
| 671 | for (i = 0; i < n->pos; i++) { | ||
| 672 | data = ahash_data(n, i); | ||
| 673 | pr_debug("list hash %lu hbucket %p i %u, data %p\n", | ||
| 674 | cb->args[2], n, i, data); | ||
| 675 | nested = ipset_nest_start(skb, IPSET_ATTR_DATA); | ||
| 676 | if (!nested) { | ||
| 677 | if (cb->args[2] == first) { | ||
| 678 | nla_nest_cancel(skb, atd); | ||
| 679 | return -EMSGSIZE; | ||
| 680 | } else | ||
| 681 | goto nla_put_failure; | ||
| 682 | } | ||
| 683 | if (type_pf_data_list(skb, data)) | ||
| 684 | goto nla_put_failure; | ||
| 685 | ipset_nest_end(skb, nested); | ||
| 686 | } | ||
| 687 | } | ||
| 688 | ipset_nest_end(skb, atd); | ||
| 689 | /* Set listing finished */ | ||
| 690 | cb->args[2] = 0; | ||
| 691 | |||
| 692 | return 0; | ||
| 693 | |||
| 694 | nla_put_failure: | ||
| 695 | nlmsg_trim(skb, incomplete); | ||
| 696 | ipset_nest_end(skb, atd); | ||
| 697 | if (unlikely(first == cb->args[2])) { | ||
| 698 | pr_warning("Can't list set %s: one bucket does not fit into " | ||
| 699 | "a message. Please report it!\n", set->name); | ||
| 700 | cb->args[2] = 0; | ||
| 701 | return -EMSGSIZE; | ||
| 702 | } | ||
| 703 | return 0; | ||
| 704 | } | ||
| 705 | |||
| 706 | static int | ||
| 707 | type_pf_kadt(struct ip_set *set, const struct sk_buff *skb, | ||
| 708 | const struct xt_action_param *par, | ||
| 709 | enum ipset_adt adt, const struct ip_set_adt_opt *opt); | ||
| 710 | static int | ||
| 711 | type_pf_uadt(struct ip_set *set, struct nlattr *tb[], | ||
| 712 | enum ipset_adt adt, u32 *lineno, u32 flags, bool retried); | ||
| 713 | |||
| 714 | static const struct ip_set_type_variant type_pf_variant = { | ||
| 715 | .kadt = type_pf_kadt, | ||
| 716 | .uadt = type_pf_uadt, | ||
| 717 | .adt = { | ||
| 718 | [IPSET_ADD] = type_pf_add, | ||
| 719 | [IPSET_DEL] = type_pf_del, | ||
| 720 | [IPSET_TEST] = type_pf_test, | ||
| 721 | }, | ||
| 722 | .destroy = type_pf_destroy, | ||
| 723 | .flush = type_pf_flush, | ||
| 724 | .head = type_pf_head, | ||
| 725 | .list = type_pf_list, | ||
| 726 | .resize = type_pf_resize, | ||
| 727 | .same_set = type_pf_same_set, | ||
| 728 | }; | ||
| 729 | |||
| 730 | /* Flavour with timeout support */ | ||
| 731 | |||
| 732 | #define ahash_tdata(n, i) \ | ||
| 733 | (struct type_pf_elem *)((struct type_pf_telem *)((n)->value) + (i)) | ||
| 734 | |||
| 735 | static inline u32 | ||
| 736 | type_pf_data_timeout(const struct type_pf_elem *data) | ||
| 737 | { | ||
| 738 | const struct type_pf_telem *tdata = | ||
| 739 | (const struct type_pf_telem *) data; | ||
| 740 | |||
| 741 | return tdata->timeout; | ||
| 742 | } | ||
| 743 | |||
| 744 | static inline bool | ||
| 745 | type_pf_data_expired(const struct type_pf_elem *data) | ||
| 746 | { | ||
| 747 | const struct type_pf_telem *tdata = | ||
| 748 | (const struct type_pf_telem *) data; | ||
| 749 | |||
| 750 | return ip_set_timeout_expired(tdata->timeout); | ||
| 751 | } | ||
| 752 | |||
| 753 | static inline void | ||
| 754 | type_pf_data_timeout_set(struct type_pf_elem *data, u32 timeout) | ||
| 755 | { | ||
| 756 | struct type_pf_telem *tdata = (struct type_pf_telem *) data; | ||
| 757 | |||
| 758 | tdata->timeout = ip_set_timeout_set(timeout); | ||
| 759 | } | ||
| 760 | |||
| 761 | static int | ||
| 762 | type_pf_elem_tadd(struct hbucket *n, const struct type_pf_elem *value, | ||
| 763 | u8 ahash_max, u32 cadt_flags, u32 timeout) | ||
| 764 | { | ||
| 765 | struct type_pf_elem *data; | ||
| 766 | |||
| 767 | if (n->pos >= n->size) { | ||
| 768 | void *tmp; | ||
| 769 | |||
| 770 | if (n->size >= ahash_max) | ||
| 771 | /* Trigger rehashing */ | ||
| 772 | return -EAGAIN; | ||
| 773 | |||
| 774 | tmp = kzalloc((n->size + AHASH_INIT_SIZE) | ||
| 775 | * sizeof(struct type_pf_telem), | ||
| 776 | GFP_ATOMIC); | ||
| 777 | if (!tmp) | ||
| 778 | return -ENOMEM; | ||
| 779 | if (n->size) { | ||
| 780 | memcpy(tmp, n->value, | ||
| 781 | sizeof(struct type_pf_telem) * n->size); | ||
| 782 | kfree(n->value); | ||
| 783 | } | ||
| 784 | n->value = tmp; | ||
| 785 | n->size += AHASH_INIT_SIZE; | ||
| 786 | } | ||
| 787 | data = ahash_tdata(n, n->pos++); | ||
| 788 | type_pf_data_copy(data, value); | ||
| 789 | type_pf_data_timeout_set(data, timeout); | ||
| 790 | #ifdef IP_SET_HASH_WITH_NETS | ||
| 791 | /* Resizing won't overwrite stored flags */ | ||
| 792 | if (cadt_flags) | ||
| 793 | type_pf_data_flags(data, cadt_flags); | ||
| 794 | #endif | ||
| 795 | return 0; | ||
| 796 | } | ||
| 797 | |||
| 798 | /* Delete expired elements from the hashtable */ | ||
| 799 | static void | ||
| 800 | type_pf_expire(struct ip_set_hash *h, u8 nets_length) | ||
| 801 | { | ||
| 802 | struct htable *t = h->table; | ||
| 803 | struct hbucket *n; | ||
| 804 | struct type_pf_elem *data; | ||
| 805 | u32 i; | ||
| 806 | int j; | ||
| 807 | |||
| 808 | for (i = 0; i < jhash_size(t->htable_bits); i++) { | ||
| 809 | n = hbucket(t, i); | ||
| 810 | for (j = 0; j < n->pos; j++) { | ||
| 811 | data = ahash_tdata(n, j); | ||
| 812 | if (type_pf_data_expired(data)) { | ||
| 813 | pr_debug("expired %u/%u\n", i, j); | ||
| 814 | #ifdef IP_SET_HASH_WITH_NETS | ||
| 815 | del_cidr(h, CIDR(data->cidr), nets_length); | ||
| 816 | #endif | ||
| 817 | if (j != n->pos - 1) | ||
| 818 | /* Not last one */ | ||
| 819 | type_pf_data_copy(data, | ||
| 820 | ahash_tdata(n, n->pos - 1)); | ||
| 821 | n->pos--; | ||
| 822 | h->elements--; | ||
| 823 | } | ||
| 824 | } | ||
| 825 | if (n->pos + AHASH_INIT_SIZE < n->size) { | ||
| 826 | void *tmp = kzalloc((n->size - AHASH_INIT_SIZE) | ||
| 827 | * sizeof(struct type_pf_telem), | ||
| 828 | GFP_ATOMIC); | ||
| 829 | if (!tmp) | ||
| 830 | /* Still try to delete expired elements */ | ||
| 831 | continue; | ||
| 832 | n->size -= AHASH_INIT_SIZE; | ||
| 833 | memcpy(tmp, n->value, | ||
| 834 | n->size * sizeof(struct type_pf_telem)); | ||
| 835 | kfree(n->value); | ||
| 836 | n->value = tmp; | ||
| 837 | } | ||
| 838 | } | ||
| 839 | } | ||
| 840 | |||
| 841 | static int | ||
| 842 | type_pf_tresize(struct ip_set *set, bool retried) | ||
| 843 | { | ||
| 844 | struct ip_set_hash *h = set->data; | ||
| 845 | struct htable *t, *orig = h->table; | ||
| 846 | u8 htable_bits = orig->htable_bits; | ||
| 847 | struct type_pf_elem *data; | ||
| 848 | struct hbucket *n, *m; | ||
| 849 | u32 i, j, flags = 0; | ||
| 850 | int ret; | ||
| 851 | |||
| 852 | /* Try to cleanup once */ | ||
| 853 | if (!retried) { | ||
| 854 | i = h->elements; | ||
| 855 | write_lock_bh(&set->lock); | ||
| 856 | type_pf_expire(set->data, NETS_LENGTH(set->family)); | ||
| 857 | write_unlock_bh(&set->lock); | ||
| 858 | if (h->elements < i) | ||
| 859 | return 0; | ||
| 860 | } | ||
| 861 | |||
| 862 | retry: | ||
| 863 | ret = 0; | ||
| 864 | htable_bits++; | ||
| 865 | pr_debug("attempt to resize set %s from %u to %u, t %p\n", | ||
| 866 | set->name, orig->htable_bits, htable_bits, orig); | ||
| 867 | if (!htable_bits) { | ||
| 868 | /* In case we have plenty of memory :-) */ | ||
| 869 | pr_warning("Cannot increase the hashsize of set %s further\n", | ||
| 870 | set->name); | ||
| 871 | return -IPSET_ERR_HASH_FULL; | ||
| 872 | } | ||
| 873 | t = ip_set_alloc(sizeof(*t) | ||
| 874 | + jhash_size(htable_bits) * sizeof(struct hbucket)); | ||
| 875 | if (!t) | ||
| 876 | return -ENOMEM; | ||
| 877 | t->htable_bits = htable_bits; | ||
| 878 | |||
| 879 | read_lock_bh(&set->lock); | ||
| 880 | for (i = 0; i < jhash_size(orig->htable_bits); i++) { | ||
| 881 | n = hbucket(orig, i); | ||
| 882 | for (j = 0; j < n->pos; j++) { | ||
| 883 | data = ahash_tdata(n, j); | ||
| 884 | #ifdef IP_SET_HASH_WITH_NETS | ||
| 885 | flags = 0; | ||
| 886 | type_pf_data_reset_flags(data, &flags); | ||
| 887 | #endif | ||
| 888 | m = hbucket(t, HKEY(data, h->initval, htable_bits)); | ||
| 889 | ret = type_pf_elem_tadd(m, data, AHASH_MAX(h), flags, | ||
| 890 | ip_set_timeout_get(type_pf_data_timeout(data))); | ||
| 891 | if (ret < 0) { | ||
| 892 | #ifdef IP_SET_HASH_WITH_NETS | ||
| 893 | type_pf_data_flags(data, flags); | ||
| 894 | #endif | ||
| 895 | read_unlock_bh(&set->lock); | ||
| 896 | ahash_destroy(t); | ||
| 897 | if (ret == -EAGAIN) | ||
| 898 | goto retry; | ||
| 899 | return ret; | ||
| 900 | } | ||
| 901 | } | ||
| 902 | } | ||
| 903 | |||
| 904 | rcu_assign_pointer(h->table, t); | ||
| 905 | read_unlock_bh(&set->lock); | ||
| 906 | |||
| 907 | /* Give time to other readers of the set */ | ||
| 908 | synchronize_rcu_bh(); | ||
| 909 | |||
| 910 | ahash_destroy(orig); | ||
| 911 | |||
| 912 | return 0; | ||
| 913 | } | ||
| 914 | |||
| 915 | static int | ||
| 916 | type_pf_tadd(struct ip_set *set, void *value, u32 timeout, u32 flags) | ||
| 917 | { | ||
| 918 | struct ip_set_hash *h = set->data; | ||
| 919 | struct htable *t = h->table; | ||
| 920 | const struct type_pf_elem *d = value; | ||
| 921 | struct hbucket *n; | ||
| 922 | struct type_pf_elem *data; | ||
| 923 | int ret = 0, i, j = AHASH_MAX(h) + 1; | ||
| 924 | bool flag_exist = flags & IPSET_FLAG_EXIST; | ||
| 925 | u32 key, multi = 0; | ||
| 926 | u32 cadt_flags = flags >> 16; | ||
| 927 | |||
| 928 | if (h->elements >= h->maxelem) | ||
| 929 | /* FIXME: when set is full, we slow down here */ | ||
| 930 | type_pf_expire(h, NETS_LENGTH(set->family)); | ||
| 931 | if (h->elements >= h->maxelem) { | ||
| 932 | if (net_ratelimit()) | ||
| 933 | pr_warning("Set %s is full, maxelem %u reached\n", | ||
| 934 | set->name, h->maxelem); | ||
| 935 | return -IPSET_ERR_HASH_FULL; | ||
| 936 | } | ||
| 937 | |||
| 938 | rcu_read_lock_bh(); | ||
| 939 | t = rcu_dereference_bh(h->table); | ||
| 940 | key = HKEY(d, h->initval, t->htable_bits); | ||
| 941 | n = hbucket(t, key); | ||
| 942 | for (i = 0; i < n->pos; i++) { | ||
| 943 | data = ahash_tdata(n, i); | ||
| 944 | if (type_pf_data_equal(data, d, &multi)) { | ||
| 945 | if (type_pf_data_expired(data) || flag_exist) | ||
| 946 | /* Just timeout value may be updated */ | ||
| 947 | j = i; | ||
| 948 | else { | ||
| 949 | ret = -IPSET_ERR_EXIST; | ||
| 950 | goto out; | ||
| 951 | } | ||
| 952 | } else if (j == AHASH_MAX(h) + 1 && | ||
| 953 | type_pf_data_expired(data)) | ||
| 954 | j = i; | ||
| 955 | } | ||
| 956 | if (j != AHASH_MAX(h) + 1) { | ||
| 957 | data = ahash_tdata(n, j); | ||
| 958 | #ifdef IP_SET_HASH_WITH_NETS | ||
| 959 | del_cidr(h, CIDR(data->cidr), NETS_LENGTH(set->family)); | ||
| 960 | add_cidr(h, CIDR(d->cidr), NETS_LENGTH(set->family)); | ||
| 961 | #endif | ||
| 962 | type_pf_data_copy(data, d); | ||
| 963 | type_pf_data_timeout_set(data, timeout); | ||
| 964 | #ifdef IP_SET_HASH_WITH_NETS | ||
| 965 | type_pf_data_flags(data, cadt_flags); | ||
| 966 | #endif | ||
| 967 | goto out; | ||
| 968 | } | ||
| 969 | TUNE_AHASH_MAX(h, multi); | ||
| 970 | ret = type_pf_elem_tadd(n, d, AHASH_MAX(h), cadt_flags, timeout); | ||
| 971 | if (ret != 0) { | ||
| 972 | if (ret == -EAGAIN) | ||
| 973 | type_pf_data_next(h, d); | ||
| 974 | goto out; | ||
| 975 | } | ||
| 976 | |||
| 977 | #ifdef IP_SET_HASH_WITH_NETS | ||
| 978 | add_cidr(h, CIDR(d->cidr), NETS_LENGTH(set->family)); | ||
| 979 | #endif | ||
| 980 | h->elements++; | ||
| 981 | out: | ||
| 982 | rcu_read_unlock_bh(); | ||
| 983 | return ret; | ||
| 984 | } | ||
| 985 | |||
| 986 | static int | ||
| 987 | type_pf_tdel(struct ip_set *set, void *value, u32 timeout, u32 flags) | ||
| 988 | { | ||
| 989 | struct ip_set_hash *h = set->data; | ||
| 990 | struct htable *t = h->table; | ||
| 991 | const struct type_pf_elem *d = value; | ||
| 992 | struct hbucket *n; | ||
| 993 | int i; | ||
| 994 | struct type_pf_elem *data; | ||
| 995 | u32 key, multi = 0; | ||
| 996 | |||
| 997 | key = HKEY(value, h->initval, t->htable_bits); | ||
| 998 | n = hbucket(t, key); | ||
| 999 | for (i = 0; i < n->pos; i++) { | ||
| 1000 | data = ahash_tdata(n, i); | ||
| 1001 | if (!type_pf_data_equal(data, d, &multi)) | ||
| 1002 | continue; | ||
| 1003 | if (type_pf_data_expired(data)) | ||
| 1004 | return -IPSET_ERR_EXIST; | ||
| 1005 | if (i != n->pos - 1) | ||
| 1006 | /* Not last one */ | ||
| 1007 | type_pf_data_copy(data, ahash_tdata(n, n->pos - 1)); | ||
| 1008 | |||
| 1009 | n->pos--; | ||
| 1010 | h->elements--; | ||
| 1011 | #ifdef IP_SET_HASH_WITH_NETS | ||
| 1012 | del_cidr(h, CIDR(d->cidr), NETS_LENGTH(set->family)); | ||
| 1013 | #endif | ||
| 1014 | if (n->pos + AHASH_INIT_SIZE < n->size) { | ||
| 1015 | void *tmp = kzalloc((n->size - AHASH_INIT_SIZE) | ||
| 1016 | * sizeof(struct type_pf_telem), | ||
| 1017 | GFP_ATOMIC); | ||
| 1018 | if (!tmp) | ||
| 1019 | return 0; | ||
| 1020 | n->size -= AHASH_INIT_SIZE; | ||
| 1021 | memcpy(tmp, n->value, | ||
| 1022 | n->size * sizeof(struct type_pf_telem)); | ||
| 1023 | kfree(n->value); | ||
| 1024 | n->value = tmp; | ||
| 1025 | } | ||
| 1026 | return 0; | ||
| 1027 | } | ||
| 1028 | |||
| 1029 | return -IPSET_ERR_EXIST; | ||
| 1030 | } | ||
| 1031 | |||
| 1032 | #ifdef IP_SET_HASH_WITH_NETS | ||
| 1033 | static int | ||
| 1034 | type_pf_ttest_cidrs(struct ip_set *set, struct type_pf_elem *d, u32 timeout) | ||
| 1035 | { | ||
| 1036 | struct ip_set_hash *h = set->data; | ||
| 1037 | struct htable *t = h->table; | ||
| 1038 | struct type_pf_elem *data; | ||
| 1039 | struct hbucket *n; | ||
| 1040 | int i, j = 0; | ||
| 1041 | u32 key, multi = 0; | ||
| 1042 | u8 nets_length = NETS_LENGTH(set->family); | ||
| 1043 | |||
| 1044 | for (; j < nets_length && h->nets[j].nets && !multi; j++) { | ||
| 1045 | type_pf_data_netmask(d, h->nets[j].cidr); | ||
| 1046 | key = HKEY(d, h->initval, t->htable_bits); | ||
| 1047 | n = hbucket(t, key); | ||
| 1048 | for (i = 0; i < n->pos; i++) { | ||
| 1049 | data = ahash_tdata(n, i); | ||
| 1050 | #ifdef IP_SET_HASH_WITH_MULTI | ||
| 1051 | if (type_pf_data_equal(data, d, &multi)) { | ||
| 1052 | if (!type_pf_data_expired(data)) | ||
| 1053 | return type_pf_data_match(data); | ||
| 1054 | multi = 0; | ||
| 1055 | } | ||
| 1056 | #else | ||
| 1057 | if (type_pf_data_equal(data, d, &multi) && | ||
| 1058 | !type_pf_data_expired(data)) | ||
| 1059 | return type_pf_data_match(data); | ||
| 1060 | #endif | ||
| 1061 | } | ||
| 1062 | } | ||
| 1063 | return 0; | ||
| 1064 | } | ||
| 1065 | #endif | ||
| 1066 | |||
| 1067 | static int | ||
| 1068 | type_pf_ttest(struct ip_set *set, void *value, u32 timeout, u32 flags) | ||
| 1069 | { | ||
| 1070 | struct ip_set_hash *h = set->data; | ||
| 1071 | struct htable *t = h->table; | ||
| 1072 | struct type_pf_elem *data, *d = value; | ||
| 1073 | struct hbucket *n; | ||
| 1074 | int i; | ||
| 1075 | u32 key, multi = 0; | ||
| 1076 | |||
| 1077 | #ifdef IP_SET_HASH_WITH_NETS | ||
| 1078 | if (CIDR(d->cidr) == SET_HOST_MASK(set->family)) | ||
| 1079 | return type_pf_ttest_cidrs(set, d, timeout); | ||
| 1080 | #endif | ||
| 1081 | key = HKEY(d, h->initval, t->htable_bits); | ||
| 1082 | n = hbucket(t, key); | ||
| 1083 | for (i = 0; i < n->pos; i++) { | ||
| 1084 | data = ahash_tdata(n, i); | ||
| 1085 | if (type_pf_data_equal(data, d, &multi) && | ||
| 1086 | !type_pf_data_expired(data)) | ||
| 1087 | return type_pf_data_match(data); | ||
| 1088 | } | ||
| 1089 | return 0; | ||
| 1090 | } | ||
| 1091 | |||
| 1092 | static int | ||
| 1093 | type_pf_tlist(const struct ip_set *set, | ||
| 1094 | struct sk_buff *skb, struct netlink_callback *cb) | ||
| 1095 | { | ||
| 1096 | const struct ip_set_hash *h = set->data; | ||
| 1097 | const struct htable *t = h->table; | ||
| 1098 | struct nlattr *atd, *nested; | ||
| 1099 | const struct hbucket *n; | ||
| 1100 | const struct type_pf_elem *data; | ||
| 1101 | u32 first = cb->args[2]; | ||
| 1102 | /* We assume that one hash bucket fills into one page */ | ||
| 1103 | void *incomplete; | ||
| 1104 | int i; | ||
| 1105 | |||
| 1106 | atd = ipset_nest_start(skb, IPSET_ATTR_ADT); | ||
| 1107 | if (!atd) | ||
| 1108 | return -EMSGSIZE; | ||
| 1109 | for (; cb->args[2] < jhash_size(t->htable_bits); cb->args[2]++) { | ||
| 1110 | incomplete = skb_tail_pointer(skb); | ||
| 1111 | n = hbucket(t, cb->args[2]); | ||
| 1112 | for (i = 0; i < n->pos; i++) { | ||
| 1113 | data = ahash_tdata(n, i); | ||
| 1114 | pr_debug("list %p %u\n", n, i); | ||
| 1115 | if (type_pf_data_expired(data)) | ||
| 1116 | continue; | ||
| 1117 | pr_debug("do list %p %u\n", n, i); | ||
| 1118 | nested = ipset_nest_start(skb, IPSET_ATTR_DATA); | ||
| 1119 | if (!nested) { | ||
| 1120 | if (cb->args[2] == first) { | ||
| 1121 | nla_nest_cancel(skb, atd); | ||
| 1122 | return -EMSGSIZE; | ||
| 1123 | } else | ||
| 1124 | goto nla_put_failure; | ||
| 1125 | } | ||
| 1126 | if (type_pf_data_tlist(skb, data)) | ||
| 1127 | goto nla_put_failure; | ||
| 1128 | ipset_nest_end(skb, nested); | ||
| 1129 | } | ||
| 1130 | } | ||
| 1131 | ipset_nest_end(skb, atd); | ||
| 1132 | /* Set listing finished */ | ||
| 1133 | cb->args[2] = 0; | ||
| 1134 | |||
| 1135 | return 0; | ||
| 1136 | |||
| 1137 | nla_put_failure: | ||
| 1138 | nlmsg_trim(skb, incomplete); | ||
| 1139 | ipset_nest_end(skb, atd); | ||
| 1140 | if (unlikely(first == cb->args[2])) { | ||
| 1141 | pr_warning("Can't list set %s: one bucket does not fit into " | ||
| 1142 | "a message. Please report it!\n", set->name); | ||
| 1143 | cb->args[2] = 0; | ||
| 1144 | return -EMSGSIZE; | ||
| 1145 | } | ||
| 1146 | return 0; | ||
| 1147 | } | ||
| 1148 | |||
| 1149 | static const struct ip_set_type_variant type_pf_tvariant = { | ||
| 1150 | .kadt = type_pf_kadt, | ||
| 1151 | .uadt = type_pf_uadt, | ||
| 1152 | .adt = { | ||
| 1153 | [IPSET_ADD] = type_pf_tadd, | ||
| 1154 | [IPSET_DEL] = type_pf_tdel, | ||
| 1155 | [IPSET_TEST] = type_pf_ttest, | ||
| 1156 | }, | ||
| 1157 | .destroy = type_pf_destroy, | ||
| 1158 | .flush = type_pf_flush, | ||
| 1159 | .head = type_pf_head, | ||
| 1160 | .list = type_pf_tlist, | ||
| 1161 | .resize = type_pf_tresize, | ||
| 1162 | .same_set = type_pf_same_set, | ||
| 1163 | }; | ||
| 1164 | |||
| 1165 | static void | ||
| 1166 | type_pf_gc(unsigned long ul_set) | ||
| 1167 | { | ||
| 1168 | struct ip_set *set = (struct ip_set *) ul_set; | ||
| 1169 | struct ip_set_hash *h = set->data; | ||
| 1170 | |||
| 1171 | pr_debug("called\n"); | ||
| 1172 | write_lock_bh(&set->lock); | ||
| 1173 | type_pf_expire(h, NETS_LENGTH(set->family)); | ||
| 1174 | write_unlock_bh(&set->lock); | ||
| 1175 | |||
| 1176 | h->gc.expires = jiffies + IPSET_GC_PERIOD(h->timeout) * HZ; | ||
| 1177 | add_timer(&h->gc); | ||
| 1178 | } | ||
| 1179 | |||
| 1180 | static void | ||
| 1181 | type_pf_gc_init(struct ip_set *set) | ||
| 1182 | { | ||
| 1183 | struct ip_set_hash *h = set->data; | ||
| 1184 | |||
| 1185 | init_timer(&h->gc); | ||
| 1186 | h->gc.data = (unsigned long) set; | ||
| 1187 | h->gc.function = type_pf_gc; | ||
| 1188 | h->gc.expires = jiffies + IPSET_GC_PERIOD(h->timeout) * HZ; | ||
| 1189 | add_timer(&h->gc); | ||
| 1190 | pr_debug("gc initialized, run in every %u\n", | ||
| 1191 | IPSET_GC_PERIOD(h->timeout)); | ||
| 1192 | } | ||
| 1193 | |||
| 1194 | #undef HKEY_DATALEN | ||
| 1195 | #undef HKEY | ||
| 1196 | #undef type_pf_data_equal | ||
| 1197 | #undef type_pf_data_isnull | ||
| 1198 | #undef type_pf_data_copy | ||
| 1199 | #undef type_pf_data_zero_out | ||
| 1200 | #undef type_pf_data_netmask | ||
| 1201 | #undef type_pf_data_list | ||
| 1202 | #undef type_pf_data_tlist | ||
| 1203 | #undef type_pf_data_next | ||
| 1204 | #undef type_pf_data_flags | ||
| 1205 | #undef type_pf_data_reset_flags | ||
| 1206 | #undef type_pf_data_match | ||
| 1207 | |||
| 1208 | #undef type_pf_elem | ||
| 1209 | #undef type_pf_telem | ||
| 1210 | #undef type_pf_data_timeout | ||
| 1211 | #undef type_pf_data_expired | ||
| 1212 | #undef type_pf_data_timeout_set | ||
| 1213 | |||
| 1214 | #undef type_pf_elem_add | ||
| 1215 | #undef type_pf_add | ||
| 1216 | #undef type_pf_del | ||
| 1217 | #undef type_pf_test_cidrs | ||
| 1218 | #undef type_pf_test | ||
| 1219 | |||
| 1220 | #undef type_pf_elem_tadd | ||
| 1221 | #undef type_pf_del_telem | ||
| 1222 | #undef type_pf_expire | ||
| 1223 | #undef type_pf_tadd | ||
| 1224 | #undef type_pf_tdel | ||
| 1225 | #undef type_pf_ttest_cidrs | ||
| 1226 | #undef type_pf_ttest | ||
| 1227 | |||
| 1228 | #undef type_pf_resize | ||
| 1229 | #undef type_pf_tresize | ||
| 1230 | #undef type_pf_flush | ||
| 1231 | #undef type_pf_destroy | ||
| 1232 | #undef type_pf_head | ||
| 1233 | #undef type_pf_list | ||
| 1234 | #undef type_pf_tlist | ||
| 1235 | #undef type_pf_same_set | ||
| 1236 | #undef type_pf_kadt | ||
| 1237 | #undef type_pf_uadt | ||
| 1238 | #undef type_pf_gc | ||
| 1239 | #undef type_pf_gc_init | ||
| 1240 | #undef type_pf_variant | ||
| 1241 | #undef type_pf_tvariant | ||
diff --git a/include/linux/netfilter/ipset/ip_set_bitmap.h b/include/linux/netfilter/ipset/ip_set_bitmap.h index 1a30646d5be8..5e4662a71e01 100644 --- a/include/linux/netfilter/ipset/ip_set_bitmap.h +++ b/include/linux/netfilter/ipset/ip_set_bitmap.h | |||
| @@ -5,6 +5,12 @@ | |||
| 5 | 5 | ||
| 6 | #define IPSET_BITMAP_MAX_RANGE 0x0000FFFF | 6 | #define IPSET_BITMAP_MAX_RANGE 0x0000FFFF |
| 7 | 7 | ||
| 8 | enum { | ||
| 9 | IPSET_ADD_FAILED = 1, | ||
| 10 | IPSET_ADD_STORE_PLAIN_TIMEOUT, | ||
| 11 | IPSET_ADD_START_STORED_TIMEOUT, | ||
| 12 | }; | ||
| 13 | |||
| 8 | /* Common functions */ | 14 | /* Common functions */ |
| 9 | 15 | ||
| 10 | static inline u32 | 16 | static inline u32 |
diff --git a/include/linux/netfilter/ipset/ip_set_timeout.h b/include/linux/netfilter/ipset/ip_set_timeout.h index 41d9cfa08167..3aac04167ca7 100644 --- a/include/linux/netfilter/ipset/ip_set_timeout.h +++ b/include/linux/netfilter/ipset/ip_set_timeout.h | |||
| @@ -1,7 +1,7 @@ | |||
| 1 | #ifndef _IP_SET_TIMEOUT_H | 1 | #ifndef _IP_SET_TIMEOUT_H |
| 2 | #define _IP_SET_TIMEOUT_H | 2 | #define _IP_SET_TIMEOUT_H |
| 3 | 3 | ||
| 4 | /* Copyright (C) 2003-2011 Jozsef Kadlecsik <kadlec@blackhole.kfki.hu> | 4 | /* Copyright (C) 2003-2013 Jozsef Kadlecsik <kadlec@blackhole.kfki.hu> |
| 5 | * | 5 | * |
| 6 | * This program is free software; you can redistribute it and/or modify | 6 | * This program is free software; you can redistribute it and/or modify |
| 7 | * it under the terms of the GNU General Public License version 2 as | 7 | * it under the terms of the GNU General Public License version 2 as |
| @@ -17,13 +17,14 @@ | |||
| 17 | #define IPSET_GC_PERIOD(timeout) \ | 17 | #define IPSET_GC_PERIOD(timeout) \ |
| 18 | ((timeout/3) ? min_t(u32, (timeout)/3, IPSET_GC_TIME) : 1) | 18 | ((timeout/3) ? min_t(u32, (timeout)/3, IPSET_GC_TIME) : 1) |
| 19 | 19 | ||
| 20 | /* Set is defined without timeout support: timeout value may be 0 */ | 20 | /* Entry is set with no timeout value */ |
| 21 | #define IPSET_NO_TIMEOUT UINT_MAX | 21 | #define IPSET_ELEM_PERMANENT 0 |
| 22 | 22 | ||
| 23 | #define with_timeout(timeout) ((timeout) != IPSET_NO_TIMEOUT) | 23 | /* Set is defined with timeout support: timeout value may be 0 */ |
| 24 | #define IPSET_NO_TIMEOUT UINT_MAX | ||
| 24 | 25 | ||
| 25 | #define opt_timeout(opt, map) \ | 26 | #define ip_set_adt_opt_timeout(opt, map) \ |
| 26 | (with_timeout((opt)->timeout) ? (opt)->timeout : (map)->timeout) | 27 | ((opt)->ext.timeout != IPSET_NO_TIMEOUT ? (opt)->ext.timeout : (map)->timeout) |
| 27 | 28 | ||
| 28 | static inline unsigned int | 29 | static inline unsigned int |
| 29 | ip_set_timeout_uget(struct nlattr *tb) | 30 | ip_set_timeout_uget(struct nlattr *tb) |
| @@ -38,61 +39,6 @@ ip_set_timeout_uget(struct nlattr *tb) | |||
| 38 | return timeout == IPSET_NO_TIMEOUT ? IPSET_NO_TIMEOUT - 1 : timeout; | 39 | return timeout == IPSET_NO_TIMEOUT ? IPSET_NO_TIMEOUT - 1 : timeout; |
| 39 | } | 40 | } |
| 40 | 41 | ||
| 41 | #ifdef IP_SET_BITMAP_TIMEOUT | ||
| 42 | |||
| 43 | /* Bitmap specific timeout constants and macros for the entries */ | ||
| 44 | |||
| 45 | /* Bitmap entry is unset */ | ||
| 46 | #define IPSET_ELEM_UNSET 0 | ||
| 47 | /* Bitmap entry is set with no timeout value */ | ||
| 48 | #define IPSET_ELEM_PERMANENT (UINT_MAX/2) | ||
| 49 | |||
| 50 | static inline bool | ||
| 51 | ip_set_timeout_test(unsigned long timeout) | ||
| 52 | { | ||
| 53 | return timeout != IPSET_ELEM_UNSET && | ||
| 54 | (timeout == IPSET_ELEM_PERMANENT || | ||
| 55 | time_is_after_jiffies(timeout)); | ||
| 56 | } | ||
| 57 | |||
| 58 | static inline bool | ||
| 59 | ip_set_timeout_expired(unsigned long timeout) | ||
| 60 | { | ||
| 61 | return timeout != IPSET_ELEM_UNSET && | ||
| 62 | timeout != IPSET_ELEM_PERMANENT && | ||
| 63 | time_is_before_jiffies(timeout); | ||
| 64 | } | ||
| 65 | |||
| 66 | static inline unsigned long | ||
| 67 | ip_set_timeout_set(u32 timeout) | ||
| 68 | { | ||
| 69 | unsigned long t; | ||
| 70 | |||
| 71 | if (!timeout) | ||
| 72 | return IPSET_ELEM_PERMANENT; | ||
| 73 | |||
| 74 | t = msecs_to_jiffies(timeout * 1000) + jiffies; | ||
| 75 | if (t == IPSET_ELEM_UNSET || t == IPSET_ELEM_PERMANENT) | ||
| 76 | /* Bingo! */ | ||
| 77 | t++; | ||
| 78 | |||
| 79 | return t; | ||
| 80 | } | ||
| 81 | |||
| 82 | static inline u32 | ||
| 83 | ip_set_timeout_get(unsigned long timeout) | ||
| 84 | { | ||
| 85 | return timeout == IPSET_ELEM_PERMANENT ? 0 : | ||
| 86 | jiffies_to_msecs(timeout - jiffies)/1000; | ||
| 87 | } | ||
| 88 | |||
| 89 | #else | ||
| 90 | |||
| 91 | /* Hash specific timeout constants and macros for the entries */ | ||
| 92 | |||
| 93 | /* Hash entry is set with no timeout value */ | ||
| 94 | #define IPSET_ELEM_PERMANENT 0 | ||
| 95 | |||
| 96 | static inline bool | 42 | static inline bool |
| 97 | ip_set_timeout_test(unsigned long timeout) | 43 | ip_set_timeout_test(unsigned long timeout) |
| 98 | { | 44 | { |
| @@ -101,36 +47,32 @@ ip_set_timeout_test(unsigned long timeout) | |||
| 101 | } | 47 | } |
| 102 | 48 | ||
| 103 | static inline bool | 49 | static inline bool |
| 104 | ip_set_timeout_expired(unsigned long timeout) | 50 | ip_set_timeout_expired(unsigned long *timeout) |
| 105 | { | 51 | { |
| 106 | return timeout != IPSET_ELEM_PERMANENT && | 52 | return *timeout != IPSET_ELEM_PERMANENT && |
| 107 | time_is_before_jiffies(timeout); | 53 | time_is_before_jiffies(*timeout); |
| 108 | } | 54 | } |
| 109 | 55 | ||
| 110 | static inline unsigned long | 56 | static inline void |
| 111 | ip_set_timeout_set(u32 timeout) | 57 | ip_set_timeout_set(unsigned long *timeout, u32 t) |
| 112 | { | 58 | { |
| 113 | unsigned long t; | 59 | if (!t) { |
| 114 | 60 | *timeout = IPSET_ELEM_PERMANENT; | |
| 115 | if (!timeout) | 61 | return; |
| 116 | return IPSET_ELEM_PERMANENT; | 62 | } |
| 117 | 63 | ||
| 118 | t = msecs_to_jiffies(timeout * 1000) + jiffies; | 64 | *timeout = msecs_to_jiffies(t * 1000) + jiffies; |
| 119 | if (t == IPSET_ELEM_PERMANENT) | 65 | if (*timeout == IPSET_ELEM_PERMANENT) |
| 120 | /* Bingo! :-) */ | 66 | /* Bingo! :-) */ |
| 121 | t++; | 67 | (*timeout)--; |
| 122 | |||
| 123 | return t; | ||
| 124 | } | 68 | } |
| 125 | 69 | ||
| 126 | static inline u32 | 70 | static inline u32 |
| 127 | ip_set_timeout_get(unsigned long timeout) | 71 | ip_set_timeout_get(unsigned long *timeout) |
| 128 | { | 72 | { |
| 129 | return timeout == IPSET_ELEM_PERMANENT ? 0 : | 73 | return *timeout == IPSET_ELEM_PERMANENT ? 0 : |
| 130 | jiffies_to_msecs(timeout - jiffies)/1000; | 74 | jiffies_to_msecs(*timeout - jiffies)/1000; |
| 131 | } | 75 | } |
| 132 | #endif /* ! IP_SET_BITMAP_TIMEOUT */ | ||
| 133 | 76 | ||
| 134 | #endif /* __KERNEL__ */ | 77 | #endif /* __KERNEL__ */ |
| 135 | |||
| 136 | #endif /* _IP_SET_TIMEOUT_H */ | 78 | #endif /* _IP_SET_TIMEOUT_H */ |
diff --git a/include/linux/netfilter/ipset/pfxlen.h b/include/linux/netfilter/ipset/pfxlen.h index 199fd11fedc0..1afbb94b4b65 100644 --- a/include/linux/netfilter/ipset/pfxlen.h +++ b/include/linux/netfilter/ipset/pfxlen.h | |||
| @@ -41,4 +41,13 @@ do { \ | |||
| 41 | to = from | ~ip_set_hostmask(cidr); \ | 41 | to = from | ~ip_set_hostmask(cidr); \ |
| 42 | } while (0) | 42 | } while (0) |
| 43 | 43 | ||
| 44 | static inline void | ||
| 45 | ip6_netmask(union nf_inet_addr *ip, u8 prefix) | ||
| 46 | { | ||
| 47 | ip->ip6[0] &= ip_set_netmask6(prefix)[0]; | ||
| 48 | ip->ip6[1] &= ip_set_netmask6(prefix)[1]; | ||
| 49 | ip->ip6[2] &= ip_set_netmask6(prefix)[2]; | ||
| 50 | ip->ip6[3] &= ip_set_netmask6(prefix)[3]; | ||
| 51 | } | ||
| 52 | |||
| 44 | #endif /*_PFXLEN_H */ | 53 | #endif /*_PFXLEN_H */ |
diff --git a/include/linux/netfilter/nfnetlink.h b/include/linux/netfilter/nfnetlink.h index ecbb8e495912..cadb7402d7a7 100644 --- a/include/linux/netfilter/nfnetlink.h +++ b/include/linux/netfilter/nfnetlink.h | |||
| @@ -29,10 +29,13 @@ extern int nfnetlink_subsys_register(const struct nfnetlink_subsystem *n); | |||
| 29 | extern int nfnetlink_subsys_unregister(const struct nfnetlink_subsystem *n); | 29 | extern int nfnetlink_subsys_unregister(const struct nfnetlink_subsystem *n); |
| 30 | 30 | ||
| 31 | extern int nfnetlink_has_listeners(struct net *net, unsigned int group); | 31 | extern int nfnetlink_has_listeners(struct net *net, unsigned int group); |
| 32 | extern int nfnetlink_send(struct sk_buff *skb, struct net *net, u32 pid, unsigned int group, | 32 | extern struct sk_buff *nfnetlink_alloc_skb(struct net *net, unsigned int size, |
| 33 | int echo, gfp_t flags); | 33 | u32 dst_portid, gfp_t gfp_mask); |
| 34 | extern int nfnetlink_set_err(struct net *net, u32 pid, u32 group, int error); | 34 | extern int nfnetlink_send(struct sk_buff *skb, struct net *net, u32 portid, |
| 35 | extern int nfnetlink_unicast(struct sk_buff *skb, struct net *net, u_int32_t pid, int flags); | 35 | unsigned int group, int echo, gfp_t flags); |
| 36 | extern int nfnetlink_set_err(struct net *net, u32 portid, u32 group, int error); | ||
| 37 | extern int nfnetlink_unicast(struct sk_buff *skb, struct net *net, | ||
| 38 | u32 portid, int flags); | ||
| 36 | 39 | ||
| 37 | extern void nfnl_lock(__u8 subsys_id); | 40 | extern void nfnl_lock(__u8 subsys_id); |
| 38 | extern void nfnl_unlock(__u8 subsys_id); | 41 | extern void nfnl_unlock(__u8 subsys_id); |
diff --git a/include/linux/netlink.h b/include/linux/netlink.h index e0f746b7b95c..6358da5eeee8 100644 --- a/include/linux/netlink.h +++ b/include/linux/netlink.h | |||
| @@ -15,11 +15,18 @@ static inline struct nlmsghdr *nlmsg_hdr(const struct sk_buff *skb) | |||
| 15 | return (struct nlmsghdr *)skb->data; | 15 | return (struct nlmsghdr *)skb->data; |
| 16 | } | 16 | } |
| 17 | 17 | ||
| 18 | enum netlink_skb_flags { | ||
| 19 | NETLINK_SKB_MMAPED = 0x1, /* Packet data is mmaped */ | ||
| 20 | NETLINK_SKB_TX = 0x2, /* Packet was sent by userspace */ | ||
| 21 | NETLINK_SKB_DELIVERED = 0x4, /* Packet was delivered */ | ||
| 22 | }; | ||
| 23 | |||
| 18 | struct netlink_skb_parms { | 24 | struct netlink_skb_parms { |
| 19 | struct scm_creds creds; /* Skb credentials */ | 25 | struct scm_creds creds; /* Skb credentials */ |
| 20 | __u32 portid; | 26 | __u32 portid; |
| 21 | __u32 dst_group; | 27 | __u32 dst_group; |
| 22 | struct sock *ssk; | 28 | __u32 flags; |
| 29 | struct sock *sk; | ||
| 23 | }; | 30 | }; |
| 24 | 31 | ||
| 25 | #define NETLINK_CB(skb) (*(struct netlink_skb_parms*)&((skb)->cb)) | 32 | #define NETLINK_CB(skb) (*(struct netlink_skb_parms*)&((skb)->cb)) |
| @@ -57,6 +64,8 @@ extern void __netlink_clear_multicast_users(struct sock *sk, unsigned int group) | |||
| 57 | extern void netlink_clear_multicast_users(struct sock *sk, unsigned int group); | 64 | extern void netlink_clear_multicast_users(struct sock *sk, unsigned int group); |
| 58 | extern void netlink_ack(struct sk_buff *in_skb, struct nlmsghdr *nlh, int err); | 65 | extern void netlink_ack(struct sk_buff *in_skb, struct nlmsghdr *nlh, int err); |
| 59 | extern int netlink_has_listeners(struct sock *sk, unsigned int group); | 66 | extern int netlink_has_listeners(struct sock *sk, unsigned int group); |
| 67 | extern struct sk_buff *netlink_alloc_skb(struct sock *ssk, unsigned int size, | ||
| 68 | u32 dst_portid, gfp_t gfp_mask); | ||
| 60 | extern int netlink_unicast(struct sock *ssk, struct sk_buff *skb, __u32 portid, int nonblock); | 69 | extern int netlink_unicast(struct sock *ssk, struct sk_buff *skb, __u32 portid, int nonblock); |
| 61 | extern int netlink_broadcast(struct sock *ssk, struct sk_buff *skb, __u32 portid, | 70 | extern int netlink_broadcast(struct sock *ssk, struct sk_buff *skb, __u32 portid, |
| 62 | __u32 group, gfp_t allocation); | 71 | __u32 group, gfp_t allocation); |
diff --git a/include/linux/netpoll.h b/include/linux/netpoll.h index 9d7d8c64f7c8..fa2cb76a7029 100644 --- a/include/linux/netpoll.h +++ b/include/linux/netpoll.h | |||
| @@ -40,7 +40,7 @@ struct netpoll_info { | |||
| 40 | 40 | ||
| 41 | unsigned long rx_flags; | 41 | unsigned long rx_flags; |
| 42 | spinlock_t rx_lock; | 42 | spinlock_t rx_lock; |
| 43 | struct mutex dev_lock; | 43 | struct semaphore dev_lock; |
| 44 | struct list_head rx_np; /* netpolls that registered an rx_hook */ | 44 | struct list_head rx_np; /* netpolls that registered an rx_hook */ |
| 45 | 45 | ||
| 46 | struct sk_buff_head neigh_tx; /* list of neigh requests to reply to */ | 46 | struct sk_buff_head neigh_tx; /* list of neigh requests to reply to */ |
diff --git a/include/linux/of_net.h b/include/linux/of_net.h index f47464188710..61bf53b02779 100644 --- a/include/linux/of_net.h +++ b/include/linux/of_net.h | |||
| @@ -11,6 +11,16 @@ | |||
| 11 | #include <linux/of.h> | 11 | #include <linux/of.h> |
| 12 | extern const int of_get_phy_mode(struct device_node *np); | 12 | extern const int of_get_phy_mode(struct device_node *np); |
| 13 | extern const void *of_get_mac_address(struct device_node *np); | 13 | extern const void *of_get_mac_address(struct device_node *np); |
| 14 | #else | ||
| 15 | static inline const int of_get_phy_mode(struct device_node *np) | ||
| 16 | { | ||
| 17 | return -ENODEV; | ||
| 18 | } | ||
| 19 | |||
| 20 | static inline const void *of_get_mac_address(struct device_node *np) | ||
| 21 | { | ||
| 22 | return NULL; | ||
| 23 | } | ||
| 14 | #endif | 24 | #endif |
| 15 | 25 | ||
| 16 | #endif /* __LINUX_OF_NET_H */ | 26 | #endif /* __LINUX_OF_NET_H */ |
diff --git a/include/linux/openvswitch.h b/include/linux/openvswitch.h index d42e174bd0c8..e6b240b6196c 100644 --- a/include/linux/openvswitch.h +++ b/include/linux/openvswitch.h | |||
| @@ -19,435 +19,6 @@ | |||
| 19 | #ifndef _LINUX_OPENVSWITCH_H | 19 | #ifndef _LINUX_OPENVSWITCH_H |
| 20 | #define _LINUX_OPENVSWITCH_H 1 | 20 | #define _LINUX_OPENVSWITCH_H 1 |
| 21 | 21 | ||
| 22 | #include <linux/types.h> | 22 | #include <uapi/linux/openvswitch.h> |
| 23 | |||
| 24 | /** | ||
| 25 | * struct ovs_header - header for OVS Generic Netlink messages. | ||
| 26 | * @dp_ifindex: ifindex of local port for datapath (0 to make a request not | ||
| 27 | * specific to a datapath). | ||
| 28 | * | ||
| 29 | * Attributes following the header are specific to a particular OVS Generic | ||
| 30 | * Netlink family, but all of the OVS families use this header. | ||
| 31 | */ | ||
| 32 | |||
| 33 | struct ovs_header { | ||
| 34 | int dp_ifindex; | ||
| 35 | }; | ||
| 36 | |||
| 37 | /* Datapaths. */ | ||
| 38 | |||
| 39 | #define OVS_DATAPATH_FAMILY "ovs_datapath" | ||
| 40 | #define OVS_DATAPATH_MCGROUP "ovs_datapath" | ||
| 41 | #define OVS_DATAPATH_VERSION 0x1 | ||
| 42 | |||
| 43 | enum ovs_datapath_cmd { | ||
| 44 | OVS_DP_CMD_UNSPEC, | ||
| 45 | OVS_DP_CMD_NEW, | ||
| 46 | OVS_DP_CMD_DEL, | ||
| 47 | OVS_DP_CMD_GET, | ||
| 48 | OVS_DP_CMD_SET | ||
| 49 | }; | ||
| 50 | |||
| 51 | /** | ||
| 52 | * enum ovs_datapath_attr - attributes for %OVS_DP_* commands. | ||
| 53 | * @OVS_DP_ATTR_NAME: Name of the network device that serves as the "local | ||
| 54 | * port". This is the name of the network device whose dp_ifindex is given in | ||
| 55 | * the &struct ovs_header. Always present in notifications. Required in | ||
| 56 | * %OVS_DP_NEW requests. May be used as an alternative to specifying | ||
| 57 | * dp_ifindex in other requests (with a dp_ifindex of 0). | ||
| 58 | * @OVS_DP_ATTR_UPCALL_PID: The Netlink socket in userspace that is initially | ||
| 59 | * set on the datapath port (for OVS_ACTION_ATTR_MISS). Only valid on | ||
| 60 | * %OVS_DP_CMD_NEW requests. A value of zero indicates that upcalls should | ||
| 61 | * not be sent. | ||
| 62 | * @OVS_DP_ATTR_STATS: Statistics about packets that have passed through the | ||
| 63 | * datapath. Always present in notifications. | ||
| 64 | * | ||
| 65 | * These attributes follow the &struct ovs_header within the Generic Netlink | ||
| 66 | * payload for %OVS_DP_* commands. | ||
| 67 | */ | ||
| 68 | enum ovs_datapath_attr { | ||
| 69 | OVS_DP_ATTR_UNSPEC, | ||
| 70 | OVS_DP_ATTR_NAME, /* name of dp_ifindex netdev */ | ||
| 71 | OVS_DP_ATTR_UPCALL_PID, /* Netlink PID to receive upcalls */ | ||
| 72 | OVS_DP_ATTR_STATS, /* struct ovs_dp_stats */ | ||
| 73 | __OVS_DP_ATTR_MAX | ||
| 74 | }; | ||
| 75 | |||
| 76 | #define OVS_DP_ATTR_MAX (__OVS_DP_ATTR_MAX - 1) | ||
| 77 | |||
| 78 | struct ovs_dp_stats { | ||
| 79 | __u64 n_hit; /* Number of flow table matches. */ | ||
| 80 | __u64 n_missed; /* Number of flow table misses. */ | ||
| 81 | __u64 n_lost; /* Number of misses not sent to userspace. */ | ||
| 82 | __u64 n_flows; /* Number of flows present */ | ||
| 83 | }; | ||
| 84 | |||
| 85 | struct ovs_vport_stats { | ||
| 86 | __u64 rx_packets; /* total packets received */ | ||
| 87 | __u64 tx_packets; /* total packets transmitted */ | ||
| 88 | __u64 rx_bytes; /* total bytes received */ | ||
| 89 | __u64 tx_bytes; /* total bytes transmitted */ | ||
| 90 | __u64 rx_errors; /* bad packets received */ | ||
| 91 | __u64 tx_errors; /* packet transmit problems */ | ||
| 92 | __u64 rx_dropped; /* no space in linux buffers */ | ||
| 93 | __u64 tx_dropped; /* no space available in linux */ | ||
| 94 | }; | ||
| 95 | |||
| 96 | /* Fixed logical ports. */ | ||
| 97 | #define OVSP_LOCAL ((__u16)0) | ||
| 98 | |||
| 99 | /* Packet transfer. */ | ||
| 100 | |||
| 101 | #define OVS_PACKET_FAMILY "ovs_packet" | ||
| 102 | #define OVS_PACKET_VERSION 0x1 | ||
| 103 | |||
| 104 | enum ovs_packet_cmd { | ||
| 105 | OVS_PACKET_CMD_UNSPEC, | ||
| 106 | |||
| 107 | /* Kernel-to-user notifications. */ | ||
| 108 | OVS_PACKET_CMD_MISS, /* Flow table miss. */ | ||
| 109 | OVS_PACKET_CMD_ACTION, /* OVS_ACTION_ATTR_USERSPACE action. */ | ||
| 110 | |||
| 111 | /* Userspace commands. */ | ||
| 112 | OVS_PACKET_CMD_EXECUTE /* Apply actions to a packet. */ | ||
| 113 | }; | ||
| 114 | |||
| 115 | /** | ||
| 116 | * enum ovs_packet_attr - attributes for %OVS_PACKET_* commands. | ||
| 117 | * @OVS_PACKET_ATTR_PACKET: Present for all notifications. Contains the entire | ||
| 118 | * packet as received, from the start of the Ethernet header onward. For | ||
| 119 | * %OVS_PACKET_CMD_ACTION, %OVS_PACKET_ATTR_PACKET reflects changes made by | ||
| 120 | * actions preceding %OVS_ACTION_ATTR_USERSPACE, but %OVS_PACKET_ATTR_KEY is | ||
| 121 | * the flow key extracted from the packet as originally received. | ||
| 122 | * @OVS_PACKET_ATTR_KEY: Present for all notifications. Contains the flow key | ||
| 123 | * extracted from the packet as nested %OVS_KEY_ATTR_* attributes. This allows | ||
| 124 | * userspace to adapt its flow setup strategy by comparing its notion of the | ||
| 125 | * flow key against the kernel's. | ||
| 126 | * @OVS_PACKET_ATTR_ACTIONS: Contains actions for the packet. Used | ||
| 127 | * for %OVS_PACKET_CMD_EXECUTE. It has nested %OVS_ACTION_ATTR_* attributes. | ||
| 128 | * @OVS_PACKET_ATTR_USERDATA: Present for an %OVS_PACKET_CMD_ACTION | ||
| 129 | * notification if the %OVS_ACTION_ATTR_USERSPACE action specified an | ||
| 130 | * %OVS_USERSPACE_ATTR_USERDATA attribute. | ||
| 131 | * | ||
| 132 | * These attributes follow the &struct ovs_header within the Generic Netlink | ||
| 133 | * payload for %OVS_PACKET_* commands. | ||
| 134 | */ | ||
| 135 | enum ovs_packet_attr { | ||
| 136 | OVS_PACKET_ATTR_UNSPEC, | ||
| 137 | OVS_PACKET_ATTR_PACKET, /* Packet data. */ | ||
| 138 | OVS_PACKET_ATTR_KEY, /* Nested OVS_KEY_ATTR_* attributes. */ | ||
| 139 | OVS_PACKET_ATTR_ACTIONS, /* Nested OVS_ACTION_ATTR_* attributes. */ | ||
| 140 | OVS_PACKET_ATTR_USERDATA, /* u64 OVS_ACTION_ATTR_USERSPACE arg. */ | ||
| 141 | __OVS_PACKET_ATTR_MAX | ||
| 142 | }; | ||
| 143 | |||
| 144 | #define OVS_PACKET_ATTR_MAX (__OVS_PACKET_ATTR_MAX - 1) | ||
| 145 | |||
| 146 | /* Virtual ports. */ | ||
| 147 | |||
| 148 | #define OVS_VPORT_FAMILY "ovs_vport" | ||
| 149 | #define OVS_VPORT_MCGROUP "ovs_vport" | ||
| 150 | #define OVS_VPORT_VERSION 0x1 | ||
| 151 | |||
| 152 | enum ovs_vport_cmd { | ||
| 153 | OVS_VPORT_CMD_UNSPEC, | ||
| 154 | OVS_VPORT_CMD_NEW, | ||
| 155 | OVS_VPORT_CMD_DEL, | ||
| 156 | OVS_VPORT_CMD_GET, | ||
| 157 | OVS_VPORT_CMD_SET | ||
| 158 | }; | ||
| 159 | |||
| 160 | enum ovs_vport_type { | ||
| 161 | OVS_VPORT_TYPE_UNSPEC, | ||
| 162 | OVS_VPORT_TYPE_NETDEV, /* network device */ | ||
| 163 | OVS_VPORT_TYPE_INTERNAL, /* network device implemented by datapath */ | ||
| 164 | __OVS_VPORT_TYPE_MAX | ||
| 165 | }; | ||
| 166 | |||
| 167 | #define OVS_VPORT_TYPE_MAX (__OVS_VPORT_TYPE_MAX - 1) | ||
| 168 | |||
| 169 | /** | ||
| 170 | * enum ovs_vport_attr - attributes for %OVS_VPORT_* commands. | ||
| 171 | * @OVS_VPORT_ATTR_PORT_NO: 32-bit port number within datapath. | ||
| 172 | * @OVS_VPORT_ATTR_TYPE: 32-bit %OVS_VPORT_TYPE_* constant describing the type | ||
| 173 | * of vport. | ||
| 174 | * @OVS_VPORT_ATTR_NAME: Name of vport. For a vport based on a network device | ||
| 175 | * this is the name of the network device. Maximum length %IFNAMSIZ-1 bytes | ||
| 176 | * plus a null terminator. | ||
| 177 | * @OVS_VPORT_ATTR_OPTIONS: Vport-specific configuration information. | ||
| 178 | * @OVS_VPORT_ATTR_UPCALL_PID: The Netlink socket in userspace that | ||
| 179 | * OVS_PACKET_CMD_MISS upcalls will be directed to for packets received on | ||
| 180 | * this port. A value of zero indicates that upcalls should not be sent. | ||
| 181 | * @OVS_VPORT_ATTR_STATS: A &struct ovs_vport_stats giving statistics for | ||
| 182 | * packets sent or received through the vport. | ||
| 183 | * | ||
| 184 | * These attributes follow the &struct ovs_header within the Generic Netlink | ||
| 185 | * payload for %OVS_VPORT_* commands. | ||
| 186 | * | ||
| 187 | * For %OVS_VPORT_CMD_NEW requests, the %OVS_VPORT_ATTR_TYPE and | ||
| 188 | * %OVS_VPORT_ATTR_NAME attributes are required. %OVS_VPORT_ATTR_PORT_NO is | ||
| 189 | * optional; if not specified a free port number is automatically selected. | ||
| 190 | * Whether %OVS_VPORT_ATTR_OPTIONS is required or optional depends on the type | ||
| 191 | * of vport. | ||
| 192 | * and other attributes are ignored. | ||
| 193 | * | ||
| 194 | * For other requests, if %OVS_VPORT_ATTR_NAME is specified then it is used to | ||
| 195 | * look up the vport to operate on; otherwise dp_idx from the &struct | ||
| 196 | * ovs_header plus %OVS_VPORT_ATTR_PORT_NO determine the vport. | ||
| 197 | */ | ||
| 198 | enum ovs_vport_attr { | ||
| 199 | OVS_VPORT_ATTR_UNSPEC, | ||
| 200 | OVS_VPORT_ATTR_PORT_NO, /* u32 port number within datapath */ | ||
| 201 | OVS_VPORT_ATTR_TYPE, /* u32 OVS_VPORT_TYPE_* constant. */ | ||
| 202 | OVS_VPORT_ATTR_NAME, /* string name, up to IFNAMSIZ bytes long */ | ||
| 203 | OVS_VPORT_ATTR_OPTIONS, /* nested attributes, varies by vport type */ | ||
| 204 | OVS_VPORT_ATTR_UPCALL_PID, /* u32 Netlink PID to receive upcalls */ | ||
| 205 | OVS_VPORT_ATTR_STATS, /* struct ovs_vport_stats */ | ||
| 206 | __OVS_VPORT_ATTR_MAX | ||
| 207 | }; | ||
| 208 | |||
| 209 | #define OVS_VPORT_ATTR_MAX (__OVS_VPORT_ATTR_MAX - 1) | ||
| 210 | |||
| 211 | /* Flows. */ | ||
| 212 | |||
| 213 | #define OVS_FLOW_FAMILY "ovs_flow" | ||
| 214 | #define OVS_FLOW_MCGROUP "ovs_flow" | ||
| 215 | #define OVS_FLOW_VERSION 0x1 | ||
| 216 | |||
| 217 | enum ovs_flow_cmd { | ||
| 218 | OVS_FLOW_CMD_UNSPEC, | ||
| 219 | OVS_FLOW_CMD_NEW, | ||
| 220 | OVS_FLOW_CMD_DEL, | ||
| 221 | OVS_FLOW_CMD_GET, | ||
| 222 | OVS_FLOW_CMD_SET | ||
| 223 | }; | ||
| 224 | |||
| 225 | struct ovs_flow_stats { | ||
| 226 | __u64 n_packets; /* Number of matched packets. */ | ||
| 227 | __u64 n_bytes; /* Number of matched bytes. */ | ||
| 228 | }; | ||
| 229 | |||
| 230 | enum ovs_key_attr { | ||
| 231 | OVS_KEY_ATTR_UNSPEC, | ||
| 232 | OVS_KEY_ATTR_ENCAP, /* Nested set of encapsulated attributes. */ | ||
| 233 | OVS_KEY_ATTR_PRIORITY, /* u32 skb->priority */ | ||
| 234 | OVS_KEY_ATTR_IN_PORT, /* u32 OVS dp port number */ | ||
| 235 | OVS_KEY_ATTR_ETHERNET, /* struct ovs_key_ethernet */ | ||
| 236 | OVS_KEY_ATTR_VLAN, /* be16 VLAN TCI */ | ||
| 237 | OVS_KEY_ATTR_ETHERTYPE, /* be16 Ethernet type */ | ||
| 238 | OVS_KEY_ATTR_IPV4, /* struct ovs_key_ipv4 */ | ||
| 239 | OVS_KEY_ATTR_IPV6, /* struct ovs_key_ipv6 */ | ||
| 240 | OVS_KEY_ATTR_TCP, /* struct ovs_key_tcp */ | ||
| 241 | OVS_KEY_ATTR_UDP, /* struct ovs_key_udp */ | ||
| 242 | OVS_KEY_ATTR_ICMP, /* struct ovs_key_icmp */ | ||
| 243 | OVS_KEY_ATTR_ICMPV6, /* struct ovs_key_icmpv6 */ | ||
| 244 | OVS_KEY_ATTR_ARP, /* struct ovs_key_arp */ | ||
| 245 | OVS_KEY_ATTR_ND, /* struct ovs_key_nd */ | ||
| 246 | OVS_KEY_ATTR_SKB_MARK, /* u32 skb mark */ | ||
| 247 | __OVS_KEY_ATTR_MAX | ||
| 248 | }; | ||
| 249 | |||
| 250 | #define OVS_KEY_ATTR_MAX (__OVS_KEY_ATTR_MAX - 1) | ||
| 251 | |||
| 252 | /** | ||
| 253 | * enum ovs_frag_type - IPv4 and IPv6 fragment type | ||
| 254 | * @OVS_FRAG_TYPE_NONE: Packet is not a fragment. | ||
| 255 | * @OVS_FRAG_TYPE_FIRST: Packet is a fragment with offset 0. | ||
| 256 | * @OVS_FRAG_TYPE_LATER: Packet is a fragment with nonzero offset. | ||
| 257 | * | ||
| 258 | * Used as the @ipv4_frag in &struct ovs_key_ipv4 and as @ipv6_frag &struct | ||
| 259 | * ovs_key_ipv6. | ||
| 260 | */ | ||
| 261 | enum ovs_frag_type { | ||
| 262 | OVS_FRAG_TYPE_NONE, | ||
| 263 | OVS_FRAG_TYPE_FIRST, | ||
| 264 | OVS_FRAG_TYPE_LATER, | ||
| 265 | __OVS_FRAG_TYPE_MAX | ||
| 266 | }; | ||
| 267 | |||
| 268 | #define OVS_FRAG_TYPE_MAX (__OVS_FRAG_TYPE_MAX - 1) | ||
| 269 | |||
| 270 | struct ovs_key_ethernet { | ||
| 271 | __u8 eth_src[6]; | ||
| 272 | __u8 eth_dst[6]; | ||
| 273 | }; | ||
| 274 | |||
| 275 | struct ovs_key_ipv4 { | ||
| 276 | __be32 ipv4_src; | ||
| 277 | __be32 ipv4_dst; | ||
| 278 | __u8 ipv4_proto; | ||
| 279 | __u8 ipv4_tos; | ||
| 280 | __u8 ipv4_ttl; | ||
| 281 | __u8 ipv4_frag; /* One of OVS_FRAG_TYPE_*. */ | ||
| 282 | }; | ||
| 283 | |||
| 284 | struct ovs_key_ipv6 { | ||
| 285 | __be32 ipv6_src[4]; | ||
| 286 | __be32 ipv6_dst[4]; | ||
| 287 | __be32 ipv6_label; /* 20-bits in least-significant bits. */ | ||
| 288 | __u8 ipv6_proto; | ||
| 289 | __u8 ipv6_tclass; | ||
| 290 | __u8 ipv6_hlimit; | ||
| 291 | __u8 ipv6_frag; /* One of OVS_FRAG_TYPE_*. */ | ||
| 292 | }; | ||
| 293 | |||
| 294 | struct ovs_key_tcp { | ||
| 295 | __be16 tcp_src; | ||
| 296 | __be16 tcp_dst; | ||
| 297 | }; | ||
| 298 | |||
| 299 | struct ovs_key_udp { | ||
| 300 | __be16 udp_src; | ||
| 301 | __be16 udp_dst; | ||
| 302 | }; | ||
| 303 | |||
| 304 | struct ovs_key_icmp { | ||
| 305 | __u8 icmp_type; | ||
| 306 | __u8 icmp_code; | ||
| 307 | }; | ||
| 308 | |||
| 309 | struct ovs_key_icmpv6 { | ||
| 310 | __u8 icmpv6_type; | ||
| 311 | __u8 icmpv6_code; | ||
| 312 | }; | ||
| 313 | |||
| 314 | struct ovs_key_arp { | ||
| 315 | __be32 arp_sip; | ||
| 316 | __be32 arp_tip; | ||
| 317 | __be16 arp_op; | ||
| 318 | __u8 arp_sha[6]; | ||
| 319 | __u8 arp_tha[6]; | ||
| 320 | }; | ||
| 321 | |||
| 322 | struct ovs_key_nd { | ||
| 323 | __u32 nd_target[4]; | ||
| 324 | __u8 nd_sll[6]; | ||
| 325 | __u8 nd_tll[6]; | ||
| 326 | }; | ||
| 327 | |||
| 328 | /** | ||
| 329 | * enum ovs_flow_attr - attributes for %OVS_FLOW_* commands. | ||
| 330 | * @OVS_FLOW_ATTR_KEY: Nested %OVS_KEY_ATTR_* attributes specifying the flow | ||
| 331 | * key. Always present in notifications. Required for all requests (except | ||
| 332 | * dumps). | ||
| 333 | * @OVS_FLOW_ATTR_ACTIONS: Nested %OVS_ACTION_ATTR_* attributes specifying | ||
| 334 | * the actions to take for packets that match the key. Always present in | ||
| 335 | * notifications. Required for %OVS_FLOW_CMD_NEW requests, optional for | ||
| 336 | * %OVS_FLOW_CMD_SET requests. | ||
| 337 | * @OVS_FLOW_ATTR_STATS: &struct ovs_flow_stats giving statistics for this | ||
| 338 | * flow. Present in notifications if the stats would be nonzero. Ignored in | ||
| 339 | * requests. | ||
| 340 | * @OVS_FLOW_ATTR_TCP_FLAGS: An 8-bit value giving the OR'd value of all of the | ||
| 341 | * TCP flags seen on packets in this flow. Only present in notifications for | ||
| 342 | * TCP flows, and only if it would be nonzero. Ignored in requests. | ||
| 343 | * @OVS_FLOW_ATTR_USED: A 64-bit integer giving the time, in milliseconds on | ||
| 344 | * the system monotonic clock, at which a packet was last processed for this | ||
| 345 | * flow. Only present in notifications if a packet has been processed for this | ||
| 346 | * flow. Ignored in requests. | ||
| 347 | * @OVS_FLOW_ATTR_CLEAR: If present in a %OVS_FLOW_CMD_SET request, clears the | ||
| 348 | * last-used time, accumulated TCP flags, and statistics for this flow. | ||
| 349 | * Otherwise ignored in requests. Never present in notifications. | ||
| 350 | * | ||
| 351 | * These attributes follow the &struct ovs_header within the Generic Netlink | ||
| 352 | * payload for %OVS_FLOW_* commands. | ||
| 353 | */ | ||
| 354 | enum ovs_flow_attr { | ||
| 355 | OVS_FLOW_ATTR_UNSPEC, | ||
| 356 | OVS_FLOW_ATTR_KEY, /* Sequence of OVS_KEY_ATTR_* attributes. */ | ||
| 357 | OVS_FLOW_ATTR_ACTIONS, /* Nested OVS_ACTION_ATTR_* attributes. */ | ||
| 358 | OVS_FLOW_ATTR_STATS, /* struct ovs_flow_stats. */ | ||
| 359 | OVS_FLOW_ATTR_TCP_FLAGS, /* 8-bit OR'd TCP flags. */ | ||
| 360 | OVS_FLOW_ATTR_USED, /* u64 msecs last used in monotonic time. */ | ||
| 361 | OVS_FLOW_ATTR_CLEAR, /* Flag to clear stats, tcp_flags, used. */ | ||
| 362 | __OVS_FLOW_ATTR_MAX | ||
| 363 | }; | ||
| 364 | |||
| 365 | #define OVS_FLOW_ATTR_MAX (__OVS_FLOW_ATTR_MAX - 1) | ||
| 366 | |||
| 367 | /** | ||
| 368 | * enum ovs_sample_attr - Attributes for %OVS_ACTION_ATTR_SAMPLE action. | ||
| 369 | * @OVS_SAMPLE_ATTR_PROBABILITY: 32-bit fraction of packets to sample with | ||
| 370 | * @OVS_ACTION_ATTR_SAMPLE. A value of 0 samples no packets, a value of | ||
| 371 | * %UINT32_MAX samples all packets and intermediate values sample intermediate | ||
| 372 | * fractions of packets. | ||
| 373 | * @OVS_SAMPLE_ATTR_ACTIONS: Set of actions to execute in sampling event. | ||
| 374 | * Actions are passed as nested attributes. | ||
| 375 | * | ||
| 376 | * Executes the specified actions with the given probability on a per-packet | ||
| 377 | * basis. | ||
| 378 | */ | ||
| 379 | enum ovs_sample_attr { | ||
| 380 | OVS_SAMPLE_ATTR_UNSPEC, | ||
| 381 | OVS_SAMPLE_ATTR_PROBABILITY, /* u32 number */ | ||
| 382 | OVS_SAMPLE_ATTR_ACTIONS, /* Nested OVS_ACTION_ATTR_* attributes. */ | ||
| 383 | __OVS_SAMPLE_ATTR_MAX, | ||
| 384 | }; | ||
| 385 | |||
| 386 | #define OVS_SAMPLE_ATTR_MAX (__OVS_SAMPLE_ATTR_MAX - 1) | ||
| 387 | |||
| 388 | /** | ||
| 389 | * enum ovs_userspace_attr - Attributes for %OVS_ACTION_ATTR_USERSPACE action. | ||
| 390 | * @OVS_USERSPACE_ATTR_PID: u32 Netlink PID to which the %OVS_PACKET_CMD_ACTION | ||
| 391 | * message should be sent. Required. | ||
| 392 | * @OVS_USERSPACE_ATTR_USERDATA: If present, its u64 argument is copied to the | ||
| 393 | * %OVS_PACKET_CMD_ACTION message as %OVS_PACKET_ATTR_USERDATA, | ||
| 394 | */ | ||
| 395 | enum ovs_userspace_attr { | ||
| 396 | OVS_USERSPACE_ATTR_UNSPEC, | ||
| 397 | OVS_USERSPACE_ATTR_PID, /* u32 Netlink PID to receive upcalls. */ | ||
| 398 | OVS_USERSPACE_ATTR_USERDATA, /* u64 optional user-specified cookie. */ | ||
| 399 | __OVS_USERSPACE_ATTR_MAX | ||
| 400 | }; | ||
| 401 | |||
| 402 | #define OVS_USERSPACE_ATTR_MAX (__OVS_USERSPACE_ATTR_MAX - 1) | ||
| 403 | |||
| 404 | /** | ||
| 405 | * struct ovs_action_push_vlan - %OVS_ACTION_ATTR_PUSH_VLAN action argument. | ||
| 406 | * @vlan_tpid: Tag protocol identifier (TPID) to push. | ||
| 407 | * @vlan_tci: Tag control identifier (TCI) to push. The CFI bit must be set | ||
| 408 | * (but it will not be set in the 802.1Q header that is pushed). | ||
| 409 | * | ||
| 410 | * The @vlan_tpid value is typically %ETH_P_8021Q. The only acceptable TPID | ||
| 411 | * values are those that the kernel module also parses as 802.1Q headers, to | ||
| 412 | * prevent %OVS_ACTION_ATTR_PUSH_VLAN followed by %OVS_ACTION_ATTR_POP_VLAN | ||
| 413 | * from having surprising results. | ||
| 414 | */ | ||
| 415 | struct ovs_action_push_vlan { | ||
| 416 | __be16 vlan_tpid; /* 802.1Q TPID. */ | ||
| 417 | __be16 vlan_tci; /* 802.1Q TCI (VLAN ID and priority). */ | ||
| 418 | }; | ||
| 419 | |||
| 420 | /** | ||
| 421 | * enum ovs_action_attr - Action types. | ||
| 422 | * | ||
| 423 | * @OVS_ACTION_ATTR_OUTPUT: Output packet to port. | ||
| 424 | * @OVS_ACTION_ATTR_USERSPACE: Send packet to userspace according to nested | ||
| 425 | * %OVS_USERSPACE_ATTR_* attributes. | ||
| 426 | * @OVS_ACTION_ATTR_SET: Replaces the contents of an existing header. The | ||
| 427 | * single nested %OVS_KEY_ATTR_* attribute specifies a header to modify and its | ||
| 428 | * value. | ||
| 429 | * @OVS_ACTION_ATTR_PUSH_VLAN: Push a new outermost 802.1Q header onto the | ||
| 430 | * packet. | ||
| 431 | * @OVS_ACTION_ATTR_POP_VLAN: Pop the outermost 802.1Q header off the packet. | ||
| 432 | * @OVS_ACTION_ATTR_SAMPLE: Probabilitically executes actions, as specified in | ||
| 433 | * the nested %OVS_SAMPLE_ATTR_* attributes. | ||
| 434 | * | ||
| 435 | * Only a single header can be set with a single %OVS_ACTION_ATTR_SET. Not all | ||
| 436 | * fields within a header are modifiable, e.g. the IPv4 protocol and fragment | ||
| 437 | * type may not be changed. | ||
| 438 | */ | ||
| 439 | |||
| 440 | enum ovs_action_attr { | ||
| 441 | OVS_ACTION_ATTR_UNSPEC, | ||
| 442 | OVS_ACTION_ATTR_OUTPUT, /* u32 port number. */ | ||
| 443 | OVS_ACTION_ATTR_USERSPACE, /* Nested OVS_USERSPACE_ATTR_*. */ | ||
| 444 | OVS_ACTION_ATTR_SET, /* One nested OVS_KEY_ATTR_*. */ | ||
| 445 | OVS_ACTION_ATTR_PUSH_VLAN, /* struct ovs_action_push_vlan. */ | ||
| 446 | OVS_ACTION_ATTR_POP_VLAN, /* No argument. */ | ||
| 447 | OVS_ACTION_ATTR_SAMPLE, /* Nested OVS_SAMPLE_ATTR_*. */ | ||
| 448 | __OVS_ACTION_ATTR_MAX | ||
| 449 | }; | ||
| 450 | |||
| 451 | #define OVS_ACTION_ATTR_MAX (__OVS_ACTION_ATTR_MAX - 1) | ||
| 452 | 23 | ||
| 453 | #endif /* _LINUX_OPENVSWITCH_H */ | 24 | #endif /* _LINUX_OPENVSWITCH_H */ |
diff --git a/include/linux/pci.h b/include/linux/pci.h index e73dfa308b87..3a24e4ff3248 100644 --- a/include/linux/pci.h +++ b/include/linux/pci.h | |||
| @@ -1661,6 +1661,7 @@ int pci_enable_sriov(struct pci_dev *dev, int nr_virtfn); | |||
| 1661 | void pci_disable_sriov(struct pci_dev *dev); | 1661 | void pci_disable_sriov(struct pci_dev *dev); |
| 1662 | irqreturn_t pci_sriov_migration(struct pci_dev *dev); | 1662 | irqreturn_t pci_sriov_migration(struct pci_dev *dev); |
| 1663 | int pci_num_vf(struct pci_dev *dev); | 1663 | int pci_num_vf(struct pci_dev *dev); |
| 1664 | int pci_vfs_assigned(struct pci_dev *dev); | ||
| 1664 | int pci_sriov_set_totalvfs(struct pci_dev *dev, u16 numvfs); | 1665 | int pci_sriov_set_totalvfs(struct pci_dev *dev, u16 numvfs); |
| 1665 | int pci_sriov_get_totalvfs(struct pci_dev *dev); | 1666 | int pci_sriov_get_totalvfs(struct pci_dev *dev); |
| 1666 | #else | 1667 | #else |
| @@ -1679,6 +1680,10 @@ static inline int pci_num_vf(struct pci_dev *dev) | |||
| 1679 | { | 1680 | { |
| 1680 | return 0; | 1681 | return 0; |
| 1681 | } | 1682 | } |
| 1683 | static inline int pci_vfs_assigned(struct pci_dev *dev) | ||
| 1684 | { | ||
| 1685 | return 0; | ||
| 1686 | } | ||
| 1682 | static inline int pci_sriov_set_totalvfs(struct pci_dev *dev, u16 numvfs) | 1687 | static inline int pci_sriov_set_totalvfs(struct pci_dev *dev, u16 numvfs) |
| 1683 | { | 1688 | { |
| 1684 | return 0; | 1689 | return 0; |
diff --git a/include/linux/phy.h b/include/linux/phy.h index 33999adbf8c8..9e11039dd7a3 100644 --- a/include/linux/phy.h +++ b/include/linux/phy.h | |||
| @@ -455,6 +455,14 @@ struct phy_driver { | |||
| 455 | */ | 455 | */ |
| 456 | void (*txtstamp)(struct phy_device *dev, struct sk_buff *skb, int type); | 456 | void (*txtstamp)(struct phy_device *dev, struct sk_buff *skb, int type); |
| 457 | 457 | ||
| 458 | /* Some devices (e.g. qnap TS-119P II) require PHY register changes to | ||
| 459 | * enable Wake on LAN, so set_wol is provided to be called in the | ||
| 460 | * ethernet driver's set_wol function. */ | ||
| 461 | int (*set_wol)(struct phy_device *dev, struct ethtool_wolinfo *wol); | ||
| 462 | |||
| 463 | /* See set_wol, but for checking whether Wake on LAN is enabled. */ | ||
| 464 | void (*get_wol)(struct phy_device *dev, struct ethtool_wolinfo *wol); | ||
| 465 | |||
| 458 | struct device_driver driver; | 466 | struct device_driver driver; |
| 459 | }; | 467 | }; |
| 460 | #define to_phy_driver(d) container_of(d, struct phy_driver, driver) | 468 | #define to_phy_driver(d) container_of(d, struct phy_driver, driver) |
| @@ -560,6 +568,8 @@ int phy_init_eee(struct phy_device *phydev, bool clk_stop_enable); | |||
| 560 | int phy_get_eee_err(struct phy_device *phydev); | 568 | int phy_get_eee_err(struct phy_device *phydev); |
| 561 | int phy_ethtool_set_eee(struct phy_device *phydev, struct ethtool_eee *data); | 569 | int phy_ethtool_set_eee(struct phy_device *phydev, struct ethtool_eee *data); |
| 562 | int phy_ethtool_get_eee(struct phy_device *phydev, struct ethtool_eee *data); | 570 | int phy_ethtool_get_eee(struct phy_device *phydev, struct ethtool_eee *data); |
| 571 | int phy_ethtool_set_wol(struct phy_device *phydev, struct ethtool_wolinfo *wol); | ||
| 572 | void phy_ethtool_get_wol(struct phy_device *phydev, struct ethtool_wolinfo *wol); | ||
| 563 | 573 | ||
| 564 | int __init mdio_bus_init(void); | 574 | int __init mdio_bus_init(void); |
| 565 | void mdio_bus_exit(void); | 575 | void mdio_bus_exit(void); |
diff --git a/include/linux/platform_data/brcmfmac-sdio.h b/include/linux/platform_data/brcmfmac-sdio.h new file mode 100644 index 000000000000..1ade657d5fc1 --- /dev/null +++ b/include/linux/platform_data/brcmfmac-sdio.h | |||
| @@ -0,0 +1,124 @@ | |||
| 1 | /* | ||
| 2 | * Copyright (c) 2013 Broadcom Corporation | ||
| 3 | * | ||
| 4 | * Permission to use, copy, modify, and/or distribute this software for any | ||
| 5 | * purpose with or without fee is hereby granted, provided that the above | ||
| 6 | * copyright notice and this permission notice appear in all copies. | ||
| 7 | * | ||
| 8 | * THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES | ||
| 9 | * WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF | ||
| 10 | * MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY | ||
| 11 | * SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES | ||
| 12 | * WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN ACTION | ||
| 13 | * OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF OR IN | ||
| 14 | * CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE. | ||
| 15 | */ | ||
| 16 | |||
| 17 | #ifndef _LINUX_BRCMFMAC_PLATFORM_H | ||
| 18 | #define _LINUX_BRCMFMAC_PLATFORM_H | ||
| 19 | |||
| 20 | /* | ||
| 21 | * Platform specific driver functions and data. Through the platform specific | ||
| 22 | * device data functions can be provided to help the brcmfmac driver to | ||
| 23 | * operate with the device in combination with the used platform. | ||
| 24 | * | ||
| 25 | * Use the platform data in the following (similar) way: | ||
| 26 | * | ||
| 27 | * | ||
| 28 | #include <brcmfmac_platform.h> | ||
| 29 | |||
| 30 | |||
| 31 | static void brcmfmac_power_on(void) | ||
| 32 | { | ||
| 33 | } | ||
| 34 | |||
| 35 | static void brcmfmac_power_off(void) | ||
| 36 | { | ||
| 37 | } | ||
| 38 | |||
| 39 | static void brcmfmac_reset(void) | ||
| 40 | { | ||
| 41 | } | ||
| 42 | |||
| 43 | static struct brcmfmac_sdio_platform_data brcmfmac_sdio_pdata = { | ||
| 44 | .power_on = brcmfmac_power_on, | ||
| 45 | .power_off = brcmfmac_power_off, | ||
| 46 | .reset = brcmfmac_reset | ||
| 47 | }; | ||
| 48 | |||
| 49 | static struct platform_device brcmfmac_device = { | ||
| 50 | .name = BRCMFMAC_SDIO_PDATA_NAME, | ||
| 51 | .id = PLATFORM_DEVID_NONE, | ||
| 52 | .dev.platform_data = &brcmfmac_sdio_pdata | ||
| 53 | }; | ||
| 54 | |||
| 55 | void __init brcmfmac_init_pdata(void) | ||
| 56 | { | ||
| 57 | brcmfmac_sdio_pdata.oob_irq_supported = true; | ||
| 58 | brcmfmac_sdio_pdata.oob_irq_nr = gpio_to_irq(GPIO_BRCMF_SDIO_OOB); | ||
| 59 | brcmfmac_sdio_pdata.oob_irq_flags = IORESOURCE_IRQ | | ||
| 60 | IORESOURCE_IRQ_HIGHLEVEL; | ||
| 61 | platform_device_register(&brcmfmac_device); | ||
| 62 | } | ||
| 63 | * | ||
| 64 | * | ||
| 65 | * Note: the brcmfmac can be loaded as module or be statically built-in into | ||
| 66 | * the kernel. If built-in then do note that it uses module_init (and | ||
| 67 | * module_exit) routines which equal device_initcall. So if you intend to | ||
| 68 | * create a module with the platform specific data for the brcmfmac and have | ||
| 69 | * it built-in to the kernel then use a higher initcall then device_initcall | ||
| 70 | * (see init.h). If this is not done then brcmfmac will load without problems | ||
| 71 | * but will not pickup the platform data. | ||
| 72 | * | ||
| 73 | * When the driver does not "detect" platform driver data then it will continue | ||
| 74 | * without reporting anything and just assume there is no data needed. Which is | ||
| 75 | * probably true for most platforms. | ||
| 76 | * | ||
| 77 | * Explanation of the platform_data fields: | ||
| 78 | * | ||
| 79 | * drive_strength: is the preferred drive_strength to be used for the SDIO | ||
| 80 | * pins. If 0 then a default value will be used. This is the target drive | ||
| 81 | * strength, the exact drive strength which will be used depends on the | ||
| 82 | * capabilities of the device. | ||
| 83 | * | ||
| 84 | * oob_irq_supported: does the board have support for OOB interrupts. SDIO | ||
| 85 | * in-band interrupts are relatively slow and for having less overhead on | ||
| 86 | * interrupt processing an out of band interrupt can be used. If the HW | ||
| 87 | * supports this then enable this by setting this field to true and configure | ||
| 88 | * the oob related fields. | ||
| 89 | * | ||
| 90 | * oob_irq_nr, oob_irq_flags: the OOB interrupt information. The values are | ||
| 91 | * used for registering the irq using request_irq function. | ||
| 92 | * | ||
| 93 | * power_on: This function is called by the brcmfmac when the module gets | ||
| 94 | * loaded. This can be particularly useful for low power devices. The platform | ||
| 95 | * spcific routine may for example decide to power up the complete device. | ||
| 96 | * If there is no use-case for this function then provide NULL. | ||
| 97 | * | ||
| 98 | * power_off: This function is called by the brcmfmac when the module gets | ||
| 99 | * unloaded. At this point the device can be powered down or otherwise be reset. | ||
| 100 | * So if an actual power_off is not supported but reset is then reset the device | ||
| 101 | * when this function gets called. This can be particularly useful for low power | ||
| 102 | * devices. If there is no use-case for this function (either power-down or | ||
| 103 | * reset) then provide NULL. | ||
| 104 | * | ||
| 105 | * reset: This function can get called if the device communication broke down. | ||
| 106 | * This functionality is particularly useful in case of SDIO type devices. It is | ||
| 107 | * possible to reset a dongle via sdio data interface, but it requires that | ||
| 108 | * this is fully functional. This function is chip/module specific and this | ||
| 109 | * function should return only after the complete reset has completed. | ||
| 110 | */ | ||
| 111 | |||
| 112 | #define BRCMFMAC_SDIO_PDATA_NAME "brcmfmac_sdio" | ||
| 113 | |||
| 114 | struct brcmfmac_sdio_platform_data { | ||
| 115 | unsigned int drive_strength; | ||
| 116 | bool oob_irq_supported; | ||
| 117 | unsigned int oob_irq_nr; | ||
| 118 | unsigned long oob_irq_flags; | ||
| 119 | void (*power_on)(void); | ||
| 120 | void (*power_off)(void); | ||
| 121 | void (*reset)(void); | ||
| 122 | }; | ||
| 123 | |||
| 124 | #endif /* _LINUX_BRCMFMAC_PLATFORM_H */ | ||
diff --git a/include/linux/platform_data/cpsw.h b/include/linux/platform_data/cpsw.h index 798fb80b024b..bb3cd58d71e3 100644 --- a/include/linux/platform_data/cpsw.h +++ b/include/linux/platform_data/cpsw.h | |||
| @@ -30,7 +30,7 @@ struct cpsw_platform_data { | |||
| 30 | u32 channels; /* number of cpdma channels (symmetric) */ | 30 | u32 channels; /* number of cpdma channels (symmetric) */ |
| 31 | u32 slaves; /* number of slave cpgmac ports */ | 31 | u32 slaves; /* number of slave cpgmac ports */ |
| 32 | struct cpsw_slave_data *slave_data; | 32 | struct cpsw_slave_data *slave_data; |
| 33 | u32 cpts_active_slave; /* time stamping slave */ | 33 | u32 active_slave; /* time stamping, ethtool and SIOCGMIIPHY slave */ |
| 34 | u32 cpts_clock_mult; /* convert input clock ticks to nanoseconds */ | 34 | u32 cpts_clock_mult; /* convert input clock ticks to nanoseconds */ |
| 35 | u32 cpts_clock_shift; /* convert input clock ticks to nanoseconds */ | 35 | u32 cpts_clock_shift; /* convert input clock ticks to nanoseconds */ |
| 36 | u32 ale_entries; /* ale table size */ | 36 | u32 ale_entries; /* ale table size */ |
diff --git a/include/linux/rtnetlink.h b/include/linux/rtnetlink.h index 489dd7bb28ec..f28544b2f9af 100644 --- a/include/linux/rtnetlink.h +++ b/include/linux/rtnetlink.h | |||
| @@ -69,6 +69,15 @@ extern int ndo_dflt_fdb_dump(struct sk_buff *skb, | |||
| 69 | struct netlink_callback *cb, | 69 | struct netlink_callback *cb, |
| 70 | struct net_device *dev, | 70 | struct net_device *dev, |
| 71 | int idx); | 71 | int idx); |
| 72 | extern int ndo_dflt_fdb_add(struct ndmsg *ndm, | ||
| 73 | struct nlattr *tb[], | ||
| 74 | struct net_device *dev, | ||
| 75 | const unsigned char *addr, | ||
| 76 | u16 flags); | ||
| 77 | extern int ndo_dflt_fdb_del(struct ndmsg *ndm, | ||
| 78 | struct nlattr *tb[], | ||
| 79 | struct net_device *dev, | ||
| 80 | const unsigned char *addr); | ||
| 72 | 81 | ||
| 73 | extern int ndo_dflt_bridge_getlink(struct sk_buff *skb, u32 pid, u32 seq, | 82 | extern int ndo_dflt_bridge_getlink(struct sk_buff *skb, u32 pid, u32 seq, |
| 74 | struct net_device *dev, u16 mode); | 83 | struct net_device *dev, u16 mode); |
diff --git a/include/linux/sctp.h b/include/linux/sctp.h index c11a28706fa4..3bfe8d6ee248 100644 --- a/include/linux/sctp.h +++ b/include/linux/sctp.h | |||
| @@ -53,7 +53,9 @@ | |||
| 53 | 53 | ||
| 54 | #include <linux/in.h> /* We need in_addr. */ | 54 | #include <linux/in.h> /* We need in_addr. */ |
| 55 | #include <linux/in6.h> /* We need in6_addr. */ | 55 | #include <linux/in6.h> /* We need in6_addr. */ |
| 56 | #include <linux/skbuff.h> | ||
| 56 | 57 | ||
| 58 | #include <uapi/linux/sctp.h> | ||
| 57 | 59 | ||
| 58 | /* Section 3.1. SCTP Common Header Format */ | 60 | /* Section 3.1. SCTP Common Header Format */ |
| 59 | typedef struct sctphdr { | 61 | typedef struct sctphdr { |
| @@ -63,14 +65,10 @@ typedef struct sctphdr { | |||
| 63 | __le32 checksum; | 65 | __le32 checksum; |
| 64 | } __packed sctp_sctphdr_t; | 66 | } __packed sctp_sctphdr_t; |
| 65 | 67 | ||
| 66 | #ifdef __KERNEL__ | ||
| 67 | #include <linux/skbuff.h> | ||
| 68 | |||
| 69 | static inline struct sctphdr *sctp_hdr(const struct sk_buff *skb) | 68 | static inline struct sctphdr *sctp_hdr(const struct sk_buff *skb) |
| 70 | { | 69 | { |
| 71 | return (struct sctphdr *)skb_transport_header(skb); | 70 | return (struct sctphdr *)skb_transport_header(skb); |
| 72 | } | 71 | } |
| 73 | #endif | ||
| 74 | 72 | ||
| 75 | /* Section 3.2. Chunk Field Descriptions. */ | 73 | /* Section 3.2. Chunk Field Descriptions. */ |
| 76 | typedef struct sctp_chunkhdr { | 74 | typedef struct sctp_chunkhdr { |
diff --git a/include/linux/sh_eth.h b/include/linux/sh_eth.h index b17d765ded84..fc305713fc6d 100644 --- a/include/linux/sh_eth.h +++ b/include/linux/sh_eth.h | |||
| @@ -6,6 +6,7 @@ | |||
| 6 | enum {EDMAC_LITTLE_ENDIAN, EDMAC_BIG_ENDIAN}; | 6 | enum {EDMAC_LITTLE_ENDIAN, EDMAC_BIG_ENDIAN}; |
| 7 | enum { | 7 | enum { |
| 8 | SH_ETH_REG_GIGABIT, | 8 | SH_ETH_REG_GIGABIT, |
| 9 | SH_ETH_REG_FAST_RCAR, | ||
| 9 | SH_ETH_REG_FAST_SH4, | 10 | SH_ETH_REG_FAST_SH4, |
| 10 | SH_ETH_REG_FAST_SH3_SH2 | 11 | SH_ETH_REG_FAST_SH3_SH2 |
| 11 | }; | 12 | }; |
diff --git a/include/linux/skbuff.h b/include/linux/skbuff.h index b8292d8cc9fa..2e0ced1af3b1 100644 --- a/include/linux/skbuff.h +++ b/include/linux/skbuff.h | |||
| @@ -32,6 +32,7 @@ | |||
| 32 | #include <linux/hrtimer.h> | 32 | #include <linux/hrtimer.h> |
| 33 | #include <linux/dma-mapping.h> | 33 | #include <linux/dma-mapping.h> |
| 34 | #include <linux/netdev_features.h> | 34 | #include <linux/netdev_features.h> |
| 35 | #include <net/flow_keys.h> | ||
| 35 | 36 | ||
| 36 | /* Don't change this without changing skb_csum_unnecessary! */ | 37 | /* Don't change this without changing skb_csum_unnecessary! */ |
| 37 | #define CHECKSUM_NONE 0 | 38 | #define CHECKSUM_NONE 0 |
| @@ -316,6 +317,8 @@ enum { | |||
| 316 | SKB_GSO_FCOE = 1 << 5, | 317 | SKB_GSO_FCOE = 1 << 5, |
| 317 | 318 | ||
| 318 | SKB_GSO_GRE = 1 << 6, | 319 | SKB_GSO_GRE = 1 << 6, |
| 320 | |||
| 321 | SKB_GSO_UDP_TUNNEL = 1 << 7, | ||
| 319 | }; | 322 | }; |
| 320 | 323 | ||
| 321 | #if BITS_PER_LONG > 32 | 324 | #if BITS_PER_LONG > 32 |
| @@ -384,9 +387,11 @@ typedef unsigned char *sk_buff_data_t; | |||
| 384 | * @secmark: security marking | 387 | * @secmark: security marking |
| 385 | * @mark: Generic packet mark | 388 | * @mark: Generic packet mark |
| 386 | * @dropcount: total number of sk_receive_queue overflows | 389 | * @dropcount: total number of sk_receive_queue overflows |
| 390 | * @vlan_proto: vlan encapsulation protocol | ||
| 387 | * @vlan_tci: vlan tag control information | 391 | * @vlan_tci: vlan tag control information |
| 388 | * @inner_transport_header: Inner transport layer header (encapsulation) | 392 | * @inner_transport_header: Inner transport layer header (encapsulation) |
| 389 | * @inner_network_header: Network layer header (encapsulation) | 393 | * @inner_network_header: Network layer header (encapsulation) |
| 394 | * @inner_mac_header: Link layer header (encapsulation) | ||
| 390 | * @transport_header: Transport layer header | 395 | * @transport_header: Transport layer header |
| 391 | * @network_header: Network layer header | 396 | * @network_header: Network layer header |
| 392 | * @mac_header: Link layer header | 397 | * @mac_header: Link layer header |
| @@ -461,6 +466,7 @@ struct sk_buff { | |||
| 461 | 466 | ||
| 462 | __u32 rxhash; | 467 | __u32 rxhash; |
| 463 | 468 | ||
| 469 | __be16 vlan_proto; | ||
| 464 | __u16 vlan_tci; | 470 | __u16 vlan_tci; |
| 465 | 471 | ||
| 466 | #ifdef CONFIG_NET_SCHED | 472 | #ifdef CONFIG_NET_SCHED |
| @@ -505,6 +511,7 @@ struct sk_buff { | |||
| 505 | 511 | ||
| 506 | sk_buff_data_t inner_transport_header; | 512 | sk_buff_data_t inner_transport_header; |
| 507 | sk_buff_data_t inner_network_header; | 513 | sk_buff_data_t inner_network_header; |
| 514 | sk_buff_data_t inner_mac_header; | ||
| 508 | sk_buff_data_t transport_header; | 515 | sk_buff_data_t transport_header; |
| 509 | sk_buff_data_t network_header; | 516 | sk_buff_data_t network_header; |
| 510 | sk_buff_data_t mac_header; | 517 | sk_buff_data_t mac_header; |
| @@ -570,7 +577,40 @@ static inline void skb_dst_set(struct sk_buff *skb, struct dst_entry *dst) | |||
| 570 | skb->_skb_refdst = (unsigned long)dst; | 577 | skb->_skb_refdst = (unsigned long)dst; |
| 571 | } | 578 | } |
| 572 | 579 | ||
| 573 | extern void skb_dst_set_noref(struct sk_buff *skb, struct dst_entry *dst); | 580 | extern void __skb_dst_set_noref(struct sk_buff *skb, struct dst_entry *dst, |
| 581 | bool force); | ||
| 582 | |||
| 583 | /** | ||
| 584 | * skb_dst_set_noref - sets skb dst, hopefully, without taking reference | ||
| 585 | * @skb: buffer | ||
| 586 | * @dst: dst entry | ||
| 587 | * | ||
| 588 | * Sets skb dst, assuming a reference was not taken on dst. | ||
| 589 | * If dst entry is cached, we do not take reference and dst_release | ||
| 590 | * will be avoided by refdst_drop. If dst entry is not cached, we take | ||
| 591 | * reference, so that last dst_release can destroy the dst immediately. | ||
| 592 | */ | ||
| 593 | static inline void skb_dst_set_noref(struct sk_buff *skb, struct dst_entry *dst) | ||
| 594 | { | ||
| 595 | __skb_dst_set_noref(skb, dst, false); | ||
| 596 | } | ||
| 597 | |||
| 598 | /** | ||
| 599 | * skb_dst_set_noref_force - sets skb dst, without taking reference | ||
| 600 | * @skb: buffer | ||
| 601 | * @dst: dst entry | ||
| 602 | * | ||
| 603 | * Sets skb dst, assuming a reference was not taken on dst. | ||
| 604 | * No reference is taken and no dst_release will be called. While for | ||
| 605 | * cached dsts deferred reclaim is a basic feature, for entries that are | ||
| 606 | * not cached it is caller's job to guarantee that last dst_release for | ||
| 607 | * provided dst happens when nobody uses it, eg. after a RCU grace period. | ||
| 608 | */ | ||
| 609 | static inline void skb_dst_set_noref_force(struct sk_buff *skb, | ||
| 610 | struct dst_entry *dst) | ||
| 611 | { | ||
| 612 | __skb_dst_set_noref(skb, dst, true); | ||
| 613 | } | ||
| 574 | 614 | ||
| 575 | /** | 615 | /** |
| 576 | * skb_dst_is_noref - Test if skb dst isn't refcounted | 616 | * skb_dst_is_noref - Test if skb dst isn't refcounted |
| @@ -611,6 +651,12 @@ static inline struct sk_buff *alloc_skb_fclone(unsigned int size, | |||
| 611 | return __alloc_skb(size, priority, SKB_ALLOC_FCLONE, NUMA_NO_NODE); | 651 | return __alloc_skb(size, priority, SKB_ALLOC_FCLONE, NUMA_NO_NODE); |
| 612 | } | 652 | } |
| 613 | 653 | ||
| 654 | extern struct sk_buff *__alloc_skb_head(gfp_t priority, int node); | ||
| 655 | static inline struct sk_buff *alloc_skb_head(gfp_t priority) | ||
| 656 | { | ||
| 657 | return __alloc_skb_head(priority, -1); | ||
| 658 | } | ||
| 659 | |||
| 614 | extern struct sk_buff *skb_morph(struct sk_buff *dst, struct sk_buff *src); | 660 | extern struct sk_buff *skb_morph(struct sk_buff *dst, struct sk_buff *src); |
| 615 | extern int skb_copy_ubufs(struct sk_buff *skb, gfp_t gfp_mask); | 661 | extern int skb_copy_ubufs(struct sk_buff *skb, gfp_t gfp_mask); |
| 616 | extern struct sk_buff *skb_clone(struct sk_buff *skb, | 662 | extern struct sk_buff *skb_clone(struct sk_buff *skb, |
| @@ -1471,6 +1517,7 @@ static inline void skb_reserve(struct sk_buff *skb, int len) | |||
| 1471 | 1517 | ||
| 1472 | static inline void skb_reset_inner_headers(struct sk_buff *skb) | 1518 | static inline void skb_reset_inner_headers(struct sk_buff *skb) |
| 1473 | { | 1519 | { |
| 1520 | skb->inner_mac_header = skb->mac_header; | ||
| 1474 | skb->inner_network_header = skb->network_header; | 1521 | skb->inner_network_header = skb->network_header; |
| 1475 | skb->inner_transport_header = skb->transport_header; | 1522 | skb->inner_transport_header = skb->transport_header; |
| 1476 | } | 1523 | } |
| @@ -1516,6 +1563,22 @@ static inline void skb_set_inner_network_header(struct sk_buff *skb, | |||
| 1516 | skb->inner_network_header += offset; | 1563 | skb->inner_network_header += offset; |
| 1517 | } | 1564 | } |
| 1518 | 1565 | ||
| 1566 | static inline unsigned char *skb_inner_mac_header(const struct sk_buff *skb) | ||
| 1567 | { | ||
| 1568 | return skb->head + skb->inner_mac_header; | ||
| 1569 | } | ||
| 1570 | |||
| 1571 | static inline void skb_reset_inner_mac_header(struct sk_buff *skb) | ||
| 1572 | { | ||
| 1573 | skb->inner_mac_header = skb->data - skb->head; | ||
| 1574 | } | ||
| 1575 | |||
| 1576 | static inline void skb_set_inner_mac_header(struct sk_buff *skb, | ||
| 1577 | const int offset) | ||
| 1578 | { | ||
| 1579 | skb_reset_inner_mac_header(skb); | ||
| 1580 | skb->inner_mac_header += offset; | ||
| 1581 | } | ||
| 1519 | static inline bool skb_transport_header_was_set(const struct sk_buff *skb) | 1582 | static inline bool skb_transport_header_was_set(const struct sk_buff *skb) |
| 1520 | { | 1583 | { |
| 1521 | return skb->transport_header != ~0U; | 1584 | return skb->transport_header != ~0U; |
| @@ -1609,6 +1672,21 @@ static inline void skb_set_inner_network_header(struct sk_buff *skb, | |||
| 1609 | skb->inner_network_header = skb->data + offset; | 1672 | skb->inner_network_header = skb->data + offset; |
| 1610 | } | 1673 | } |
| 1611 | 1674 | ||
| 1675 | static inline unsigned char *skb_inner_mac_header(const struct sk_buff *skb) | ||
| 1676 | { | ||
| 1677 | return skb->inner_mac_header; | ||
| 1678 | } | ||
| 1679 | |||
| 1680 | static inline void skb_reset_inner_mac_header(struct sk_buff *skb) | ||
| 1681 | { | ||
| 1682 | skb->inner_mac_header = skb->data; | ||
| 1683 | } | ||
| 1684 | |||
| 1685 | static inline void skb_set_inner_mac_header(struct sk_buff *skb, | ||
| 1686 | const int offset) | ||
| 1687 | { | ||
| 1688 | skb->inner_mac_header = skb->data + offset; | ||
| 1689 | } | ||
| 1612 | static inline bool skb_transport_header_was_set(const struct sk_buff *skb) | 1690 | static inline bool skb_transport_header_was_set(const struct sk_buff *skb) |
| 1613 | { | 1691 | { |
| 1614 | return skb->transport_header != NULL; | 1692 | return skb->transport_header != NULL; |
| @@ -1666,6 +1744,19 @@ static inline void skb_set_mac_header(struct sk_buff *skb, const int offset) | |||
| 1666 | } | 1744 | } |
| 1667 | #endif /* NET_SKBUFF_DATA_USES_OFFSET */ | 1745 | #endif /* NET_SKBUFF_DATA_USES_OFFSET */ |
| 1668 | 1746 | ||
| 1747 | static inline void skb_probe_transport_header(struct sk_buff *skb, | ||
| 1748 | const int offset_hint) | ||
| 1749 | { | ||
| 1750 | struct flow_keys keys; | ||
| 1751 | |||
| 1752 | if (skb_transport_header_was_set(skb)) | ||
| 1753 | return; | ||
| 1754 | else if (skb_flow_dissect(skb, &keys)) | ||
| 1755 | skb_set_transport_header(skb, keys.thoff); | ||
| 1756 | else | ||
| 1757 | skb_set_transport_header(skb, offset_hint); | ||
| 1758 | } | ||
| 1759 | |||
| 1669 | static inline void skb_mac_header_rebuild(struct sk_buff *skb) | 1760 | static inline void skb_mac_header_rebuild(struct sk_buff *skb) |
| 1670 | { | 1761 | { |
| 1671 | if (skb_mac_header_was_set(skb)) { | 1762 | if (skb_mac_header_was_set(skb)) { |
| @@ -2811,6 +2902,8 @@ static inline void skb_checksum_none_assert(const struct sk_buff *skb) | |||
| 2811 | 2902 | ||
| 2812 | bool skb_partial_csum_set(struct sk_buff *skb, u16 start, u16 off); | 2903 | bool skb_partial_csum_set(struct sk_buff *skb, u16 start, u16 off); |
| 2813 | 2904 | ||
| 2905 | u32 __skb_get_poff(const struct sk_buff *skb); | ||
| 2906 | |||
| 2814 | /** | 2907 | /** |
| 2815 | * skb_head_is_locked - Determine if the skb->head is locked down | 2908 | * skb_head_is_locked - Determine if the skb->head is locked down |
| 2816 | * @skb: skb to check | 2909 | * @skb: skb to check |
diff --git a/include/linux/sock_diag.h b/include/linux/sock_diag.h index e8d702e0fd89..54f91d35e5fd 100644 --- a/include/linux/sock_diag.h +++ b/include/linux/sock_diag.h | |||
| @@ -1,6 +1,7 @@ | |||
| 1 | #ifndef __SOCK_DIAG_H__ | 1 | #ifndef __SOCK_DIAG_H__ |
| 2 | #define __SOCK_DIAG_H__ | 2 | #define __SOCK_DIAG_H__ |
| 3 | 3 | ||
| 4 | #include <linux/user_namespace.h> | ||
| 4 | #include <uapi/linux/sock_diag.h> | 5 | #include <uapi/linux/sock_diag.h> |
| 5 | 6 | ||
| 6 | struct sk_buff; | 7 | struct sk_buff; |
| @@ -22,5 +23,7 @@ int sock_diag_check_cookie(void *sk, __u32 *cookie); | |||
| 22 | void sock_diag_save_cookie(void *sk, __u32 *cookie); | 23 | void sock_diag_save_cookie(void *sk, __u32 *cookie); |
| 23 | 24 | ||
| 24 | int sock_diag_put_meminfo(struct sock *sk, struct sk_buff *skb, int attr); | 25 | int sock_diag_put_meminfo(struct sock *sk, struct sk_buff *skb, int attr); |
| 26 | int sock_diag_put_filterinfo(struct user_namespace *user_ns, struct sock *sk, | ||
| 27 | struct sk_buff *skb, int attrtype); | ||
| 25 | 28 | ||
| 26 | #endif | 29 | #endif |
diff --git a/include/linux/socket.h b/include/linux/socket.h index 2b9f74b0ffea..428c37a1f95c 100644 --- a/include/linux/socket.h +++ b/include/linux/socket.h | |||
| @@ -298,6 +298,7 @@ struct ucred { | |||
| 298 | #define SOL_IUCV 277 | 298 | #define SOL_IUCV 277 |
| 299 | #define SOL_CAIF 278 | 299 | #define SOL_CAIF 278 |
| 300 | #define SOL_ALG 279 | 300 | #define SOL_ALG 279 |
| 301 | #define SOL_NFC 280 | ||
| 301 | 302 | ||
| 302 | /* IPX options */ | 303 | /* IPX options */ |
| 303 | #define IPX_TYPE 1 | 304 | #define IPX_TYPE 1 |
diff --git a/include/linux/spi/at86rf230.h b/include/linux/spi/at86rf230.h index b2b1afbb3202..aa327a8105ad 100644 --- a/include/linux/spi/at86rf230.h +++ b/include/linux/spi/at86rf230.h | |||
| @@ -26,6 +26,20 @@ struct at86rf230_platform_data { | |||
| 26 | int rstn; | 26 | int rstn; |
| 27 | int slp_tr; | 27 | int slp_tr; |
| 28 | int dig2; | 28 | int dig2; |
| 29 | |||
| 30 | /* Setting the irq_type will configure the driver to request | ||
| 31 | * the platform irq trigger type according to the given value | ||
| 32 | * and configure the interrupt polarity of the device to the | ||
| 33 | * corresponding polarity. | ||
| 34 | * | ||
| 35 | * Allowed values are: IRQF_TRIGGER_RISING, IRQF_TRIGGER_FALLING, | ||
| 36 | * IRQF_TRIGGER_HIGH and IRQF_TRIGGER_LOW | ||
| 37 | * | ||
| 38 | * Setting it to 0, the driver does not touch the trigger type | ||
| 39 | * configuration of the interrupt and sets the interrupt polarity | ||
| 40 | * of the device to high active (the default value). | ||
| 41 | */ | ||
| 42 | int irq_type; | ||
| 29 | }; | 43 | }; |
| 30 | 44 | ||
| 31 | #endif | 45 | #endif |
diff --git a/include/linux/ssb/ssb.h b/include/linux/ssb/ssb.h index 22958d68ecfe..c64999fd1660 100644 --- a/include/linux/ssb/ssb.h +++ b/include/linux/ssb/ssb.h | |||
| @@ -26,9 +26,9 @@ struct ssb_sprom_core_pwr_info { | |||
| 26 | 26 | ||
| 27 | struct ssb_sprom { | 27 | struct ssb_sprom { |
| 28 | u8 revision; | 28 | u8 revision; |
| 29 | u8 il0mac[6]; /* MAC address for 802.11b/g */ | 29 | u8 il0mac[6] __aligned(sizeof(u16)); /* MAC address for 802.11b/g */ |
| 30 | u8 et0mac[6]; /* MAC address for Ethernet */ | 30 | u8 et0mac[6] __aligned(sizeof(u16)); /* MAC address for Ethernet */ |
| 31 | u8 et1mac[6]; /* MAC address for 802.11a */ | 31 | u8 et1mac[6] __aligned(sizeof(u16)); /* MAC address for 802.11a */ |
| 32 | u8 et0phyaddr; /* MII address for enet0 */ | 32 | u8 et0phyaddr; /* MII address for enet0 */ |
| 33 | u8 et1phyaddr; /* MII address for enet1 */ | 33 | u8 et1phyaddr; /* MII address for enet1 */ |
| 34 | u8 et0mdcport; /* MDIO for enet0 */ | 34 | u8 et0mdcport; /* MDIO for enet0 */ |
| @@ -340,13 +340,61 @@ enum ssb_bustype { | |||
| 340 | #define SSB_BOARDVENDOR_DELL 0x1028 /* Dell */ | 340 | #define SSB_BOARDVENDOR_DELL 0x1028 /* Dell */ |
| 341 | #define SSB_BOARDVENDOR_HP 0x0E11 /* HP */ | 341 | #define SSB_BOARDVENDOR_HP 0x0E11 /* HP */ |
| 342 | /* board_type */ | 342 | /* board_type */ |
| 343 | #define SSB_BOARD_BCM94301CB 0x0406 | ||
| 344 | #define SSB_BOARD_BCM94301MP 0x0407 | ||
| 345 | #define SSB_BOARD_BU4309 0x040A | ||
| 346 | #define SSB_BOARD_BCM94309CB 0x040B | ||
| 347 | #define SSB_BOARD_BCM4309MP 0x040C | ||
| 348 | #define SSB_BOARD_BU4306 0x0416 | ||
| 343 | #define SSB_BOARD_BCM94306MP 0x0418 | 349 | #define SSB_BOARD_BCM94306MP 0x0418 |
| 344 | #define SSB_BOARD_BCM4309G 0x0421 | 350 | #define SSB_BOARD_BCM4309G 0x0421 |
| 345 | #define SSB_BOARD_BCM4306CB 0x0417 | 351 | #define SSB_BOARD_BCM4306CB 0x0417 |
| 346 | #define SSB_BOARD_BCM4309MP 0x040C | 352 | #define SSB_BOARD_BCM94306PC 0x0425 /* pcmcia 3.3v 4306 card */ |
| 353 | #define SSB_BOARD_BCM94306CBSG 0x042B /* with SiGe PA */ | ||
| 354 | #define SSB_BOARD_PCSG94306 0x042D /* with SiGe PA */ | ||
| 355 | #define SSB_BOARD_BU4704SD 0x042E /* with sdram */ | ||
| 356 | #define SSB_BOARD_BCM94704AGR 0x042F /* dual 11a/11g Router */ | ||
| 357 | #define SSB_BOARD_BCM94308MP 0x0430 /* 11a-only minipci */ | ||
| 358 | #define SSB_BOARD_BU4318 0x0447 | ||
| 359 | #define SSB_BOARD_CB4318 0x0448 | ||
| 360 | #define SSB_BOARD_MPG4318 0x0449 | ||
| 347 | #define SSB_BOARD_MP4318 0x044A | 361 | #define SSB_BOARD_MP4318 0x044A |
| 348 | #define SSB_BOARD_BU4306 0x0416 | 362 | #define SSB_BOARD_SD4318 0x044B |
| 349 | #define SSB_BOARD_BU4309 0x040A | 363 | #define SSB_BOARD_BCM94306P 0x044C /* with SiGe */ |
| 364 | #define SSB_BOARD_BCM94303MP 0x044E | ||
| 365 | #define SSB_BOARD_BCM94306MPM 0x0450 | ||
| 366 | #define SSB_BOARD_BCM94306MPL 0x0453 | ||
| 367 | #define SSB_BOARD_PC4303 0x0454 /* pcmcia */ | ||
| 368 | #define SSB_BOARD_BCM94306MPLNA 0x0457 | ||
| 369 | #define SSB_BOARD_BCM94306MPH 0x045B | ||
| 370 | #define SSB_BOARD_BCM94306PCIV 0x045C | ||
| 371 | #define SSB_BOARD_BCM94318MPGH 0x0463 | ||
| 372 | #define SSB_BOARD_BU4311 0x0464 | ||
| 373 | #define SSB_BOARD_BCM94311MC 0x0465 | ||
| 374 | #define SSB_BOARD_BCM94311MCAG 0x0466 | ||
| 375 | /* 4321 boards */ | ||
| 376 | #define SSB_BOARD_BU4321 0x046B | ||
| 377 | #define SSB_BOARD_BU4321E 0x047C | ||
| 378 | #define SSB_BOARD_MP4321 0x046C | ||
| 379 | #define SSB_BOARD_CB2_4321 0x046D | ||
| 380 | #define SSB_BOARD_CB2_4321_AG 0x0066 | ||
| 381 | #define SSB_BOARD_MC4321 0x046E | ||
| 382 | /* 4325 boards */ | ||
| 383 | #define SSB_BOARD_BCM94325DEVBU 0x0490 | ||
| 384 | #define SSB_BOARD_BCM94325BGABU 0x0491 | ||
| 385 | #define SSB_BOARD_BCM94325SDGWB 0x0492 | ||
| 386 | #define SSB_BOARD_BCM94325SDGMDL 0x04AA | ||
| 387 | #define SSB_BOARD_BCM94325SDGMDL2 0x04C6 | ||
| 388 | #define SSB_BOARD_BCM94325SDGMDL3 0x04C9 | ||
| 389 | #define SSB_BOARD_BCM94325SDABGWBA 0x04E1 | ||
| 390 | /* 4322 boards */ | ||
| 391 | #define SSB_BOARD_BCM94322MC 0x04A4 | ||
| 392 | #define SSB_BOARD_BCM94322USB 0x04A8 /* dualband */ | ||
| 393 | #define SSB_BOARD_BCM94322HM 0x04B0 | ||
| 394 | #define SSB_BOARD_BCM94322USB2D 0x04Bf /* single band discrete front end */ | ||
| 395 | /* 4312 boards */ | ||
| 396 | #define SSB_BOARD_BU4312 0x048A | ||
| 397 | #define SSB_BOARD_BCM4312MCGSG 0x04B5 | ||
| 350 | /* chip_package */ | 398 | /* chip_package */ |
| 351 | #define SSB_CHIPPACK_BCM4712S 1 /* Small 200pin 4712 */ | 399 | #define SSB_CHIPPACK_BCM4712S 1 /* Small 200pin 4712 */ |
| 352 | #define SSB_CHIPPACK_BCM4712M 2 /* Medium 225pin 4712 */ | 400 | #define SSB_CHIPPACK_BCM4712M 2 /* Medium 225pin 4712 */ |
diff --git a/include/linux/ssb/ssb_regs.h b/include/linux/ssb/ssb_regs.h index 6ecfa02ddbac..3a7256955b10 100644 --- a/include/linux/ssb/ssb_regs.h +++ b/include/linux/ssb/ssb_regs.h | |||
| @@ -289,11 +289,11 @@ | |||
| 289 | #define SSB_SPROM4_ETHPHY_ET1A_SHIFT 5 | 289 | #define SSB_SPROM4_ETHPHY_ET1A_SHIFT 5 |
| 290 | #define SSB_SPROM4_ETHPHY_ET0M (1<<14) /* MDIO for enet0 */ | 290 | #define SSB_SPROM4_ETHPHY_ET0M (1<<14) /* MDIO for enet0 */ |
| 291 | #define SSB_SPROM4_ETHPHY_ET1M (1<<15) /* MDIO for enet1 */ | 291 | #define SSB_SPROM4_ETHPHY_ET1M (1<<15) /* MDIO for enet1 */ |
| 292 | #define SSB_SPROM4_ANTAVAIL 0x005D /* Antenna available bitfields */ | 292 | #define SSB_SPROM4_ANTAVAIL 0x005C /* Antenna available bitfields */ |
| 293 | #define SSB_SPROM4_ANTAVAIL_A 0x00FF /* A-PHY bitfield */ | 293 | #define SSB_SPROM4_ANTAVAIL_BG 0x00FF /* B-PHY and G-PHY bitfield */ |
| 294 | #define SSB_SPROM4_ANTAVAIL_A_SHIFT 0 | 294 | #define SSB_SPROM4_ANTAVAIL_BG_SHIFT 0 |
| 295 | #define SSB_SPROM4_ANTAVAIL_BG 0xFF00 /* B-PHY and G-PHY bitfield */ | 295 | #define SSB_SPROM4_ANTAVAIL_A 0xFF00 /* A-PHY bitfield */ |
| 296 | #define SSB_SPROM4_ANTAVAIL_BG_SHIFT 8 | 296 | #define SSB_SPROM4_ANTAVAIL_A_SHIFT 8 |
| 297 | #define SSB_SPROM4_AGAIN01 0x005E /* Antenna Gain (in dBm Q5.2) */ | 297 | #define SSB_SPROM4_AGAIN01 0x005E /* Antenna Gain (in dBm Q5.2) */ |
| 298 | #define SSB_SPROM4_AGAIN0 0x00FF /* Antenna 0 */ | 298 | #define SSB_SPROM4_AGAIN0 0x00FF /* Antenna 0 */ |
| 299 | #define SSB_SPROM4_AGAIN0_SHIFT 0 | 299 | #define SSB_SPROM4_AGAIN0_SHIFT 0 |
diff --git a/include/linux/tcp.h b/include/linux/tcp.h index f28408c07dc2..5adbc33d1ab3 100644 --- a/include/linux/tcp.h +++ b/include/linux/tcp.h | |||
| @@ -90,9 +90,6 @@ struct tcp_options_received { | |||
| 90 | sack_ok : 4, /* SACK seen on SYN packet */ | 90 | sack_ok : 4, /* SACK seen on SYN packet */ |
| 91 | snd_wscale : 4, /* Window scaling received from sender */ | 91 | snd_wscale : 4, /* Window scaling received from sender */ |
| 92 | rcv_wscale : 4; /* Window scaling to send to receiver */ | 92 | rcv_wscale : 4; /* Window scaling to send to receiver */ |
| 93 | u8 cookie_plus:6, /* bytes in authenticator/cookie option */ | ||
| 94 | cookie_out_never:1, | ||
| 95 | cookie_in_always:1; | ||
| 96 | u8 num_sacks; /* Number of SACK blocks */ | 93 | u8 num_sacks; /* Number of SACK blocks */ |
| 97 | u16 user_mss; /* mss requested by user in ioctl */ | 94 | u16 user_mss; /* mss requested by user in ioctl */ |
| 98 | u16 mss_clamp; /* Maximal mss, negotiated at connection setup */ | 95 | u16 mss_clamp; /* Maximal mss, negotiated at connection setup */ |
| @@ -102,7 +99,6 @@ static inline void tcp_clear_options(struct tcp_options_received *rx_opt) | |||
| 102 | { | 99 | { |
| 103 | rx_opt->tstamp_ok = rx_opt->sack_ok = 0; | 100 | rx_opt->tstamp_ok = rx_opt->sack_ok = 0; |
| 104 | rx_opt->wscale_ok = rx_opt->snd_wscale = 0; | 101 | rx_opt->wscale_ok = rx_opt->snd_wscale = 0; |
| 105 | rx_opt->cookie_plus = 0; | ||
| 106 | } | 102 | } |
| 107 | 103 | ||
| 108 | /* This is the max number of SACKS that we'll generate and process. It's safe | 104 | /* This is the max number of SACKS that we'll generate and process. It's safe |
| @@ -191,20 +187,19 @@ struct tcp_sock { | |||
| 191 | u32 window_clamp; /* Maximal window to advertise */ | 187 | u32 window_clamp; /* Maximal window to advertise */ |
| 192 | u32 rcv_ssthresh; /* Current window clamp */ | 188 | u32 rcv_ssthresh; /* Current window clamp */ |
| 193 | 189 | ||
| 194 | u32 frto_highmark; /* snd_nxt when RTO occurred */ | ||
| 195 | u16 advmss; /* Advertised MSS */ | 190 | u16 advmss; /* Advertised MSS */ |
| 196 | u8 frto_counter; /* Number of new acks after RTO */ | 191 | u8 unused; |
| 197 | u8 nonagle : 4,/* Disable Nagle algorithm? */ | 192 | u8 nonagle : 4,/* Disable Nagle algorithm? */ |
| 198 | thin_lto : 1,/* Use linear timeouts for thin streams */ | 193 | thin_lto : 1,/* Use linear timeouts for thin streams */ |
| 199 | thin_dupack : 1,/* Fast retransmit on first dupack */ | 194 | thin_dupack : 1,/* Fast retransmit on first dupack */ |
| 200 | repair : 1, | 195 | repair : 1, |
| 201 | unused : 1; | 196 | frto : 1;/* F-RTO (RFC5682) activated in CA_Loss */ |
| 202 | u8 repair_queue; | 197 | u8 repair_queue; |
| 203 | u8 do_early_retrans:1,/* Enable RFC5827 early-retransmit */ | 198 | u8 do_early_retrans:1,/* Enable RFC5827 early-retransmit */ |
| 204 | early_retrans_delayed:1, /* Delayed ER timer installed */ | ||
| 205 | syn_data:1, /* SYN includes data */ | 199 | syn_data:1, /* SYN includes data */ |
| 206 | syn_fastopen:1, /* SYN includes Fast Open option */ | 200 | syn_fastopen:1, /* SYN includes Fast Open option */ |
| 207 | syn_data_acked:1;/* data in SYN is acked by SYN-ACK */ | 201 | syn_data_acked:1;/* data in SYN is acked by SYN-ACK */ |
| 202 | u32 tlp_high_seq; /* snd_nxt at the time of TLP retransmit. */ | ||
| 208 | 203 | ||
| 209 | /* RTT measurement */ | 204 | /* RTT measurement */ |
| 210 | u32 srtt; /* smoothed round trip time << 3 */ | 205 | u32 srtt; /* smoothed round trip time << 3 */ |
| @@ -320,12 +315,6 @@ struct tcp_sock { | |||
| 320 | struct tcp_md5sig_info __rcu *md5sig_info; | 315 | struct tcp_md5sig_info __rcu *md5sig_info; |
| 321 | #endif | 316 | #endif |
| 322 | 317 | ||
| 323 | /* When the cookie options are generated and exchanged, then this | ||
| 324 | * object holds a reference to them (cookie_values->kref). Also | ||
| 325 | * contains related tcp_cookie_transactions fields. | ||
| 326 | */ | ||
| 327 | struct tcp_cookie_values *cookie_values; | ||
| 328 | |||
| 329 | /* TCP fastopen related information */ | 318 | /* TCP fastopen related information */ |
| 330 | struct tcp_fastopen_request *fastopen_req; | 319 | struct tcp_fastopen_request *fastopen_req; |
| 331 | /* fastopen_rsk points to request_sock that resulted in this big | 320 | /* fastopen_rsk points to request_sock that resulted in this big |
| @@ -361,10 +350,6 @@ struct tcp_timewait_sock { | |||
| 361 | #ifdef CONFIG_TCP_MD5SIG | 350 | #ifdef CONFIG_TCP_MD5SIG |
| 362 | struct tcp_md5sig_key *tw_md5_key; | 351 | struct tcp_md5sig_key *tw_md5_key; |
| 363 | #endif | 352 | #endif |
| 364 | /* Few sockets in timewait have cookies; in that case, then this | ||
| 365 | * object holds a reference to them (tw_cookie_values->kref). | ||
| 366 | */ | ||
| 367 | struct tcp_cookie_values *tw_cookie_values; | ||
| 368 | }; | 353 | }; |
| 369 | 354 | ||
| 370 | static inline struct tcp_timewait_sock *tcp_twsk(const struct sock *sk) | 355 | static inline struct tcp_timewait_sock *tcp_twsk(const struct sock *sk) |
diff --git a/include/linux/usb/usbnet.h b/include/linux/usb/usbnet.h index 0e5ac93bab10..da46327fca17 100644 --- a/include/linux/usb/usbnet.h +++ b/include/linux/usb/usbnet.h | |||
| @@ -72,6 +72,7 @@ struct usbnet { | |||
| 72 | # define EVENT_DEVICE_REPORT_IDLE 8 | 72 | # define EVENT_DEVICE_REPORT_IDLE 8 |
| 73 | # define EVENT_NO_RUNTIME_PM 9 | 73 | # define EVENT_NO_RUNTIME_PM 9 |
| 74 | # define EVENT_RX_KILL 10 | 74 | # define EVENT_RX_KILL 10 |
| 75 | # define EVENT_LINK_CHANGE 11 | ||
| 75 | }; | 76 | }; |
| 76 | 77 | ||
| 77 | static inline struct usb_driver *driver_of(struct usb_interface *intf) | 78 | static inline struct usb_driver *driver_of(struct usb_interface *intf) |
| @@ -245,5 +246,6 @@ extern void usbnet_get_drvinfo(struct net_device *, struct ethtool_drvinfo *); | |||
| 245 | extern int usbnet_nway_reset(struct net_device *net); | 246 | extern int usbnet_nway_reset(struct net_device *net); |
| 246 | 247 | ||
| 247 | extern int usbnet_manage_power(struct usbnet *, int); | 248 | extern int usbnet_manage_power(struct usbnet *, int); |
| 249 | extern void usbnet_link_change(struct usbnet *, bool, bool); | ||
| 248 | 250 | ||
| 249 | #endif /* __LINUX_USB_USBNET_H */ | 251 | #endif /* __LINUX_USB_USBNET_H */ |
diff --git a/include/linux/virtio.h b/include/linux/virtio.h index ff6714e6d0f5..2d7a5e045908 100644 --- a/include/linux/virtio.h +++ b/include/linux/virtio.h | |||
| @@ -58,12 +58,6 @@ void *virtqueue_detach_unused_buf(struct virtqueue *vq); | |||
| 58 | 58 | ||
| 59 | unsigned int virtqueue_get_vring_size(struct virtqueue *vq); | 59 | unsigned int virtqueue_get_vring_size(struct virtqueue *vq); |
| 60 | 60 | ||
| 61 | /* FIXME: Obsolete accessor, but required for virtio_net merge. */ | ||
| 62 | static inline unsigned int virtqueue_get_queue_index(struct virtqueue *vq) | ||
| 63 | { | ||
| 64 | return vq->index; | ||
| 65 | } | ||
| 66 | |||
| 67 | /** | 61 | /** |
| 68 | * virtio_device - representation of a device using virtio | 62 | * virtio_device - representation of a device using virtio |
| 69 | * @index: unique position on the virtio bus | 63 | * @index: unique position on the virtio bus |
diff --git a/include/linux/vm_sockets.h b/include/linux/vm_sockets.h new file mode 100644 index 000000000000..0805eecba8f7 --- /dev/null +++ b/include/linux/vm_sockets.h | |||
| @@ -0,0 +1,23 @@ | |||
| 1 | /* | ||
| 2 | * VMware vSockets Driver | ||
| 3 | * | ||
| 4 | * Copyright (C) 2007-2013 VMware, Inc. All rights reserved. | ||
| 5 | * | ||
| 6 | * This program is free software; you can redistribute it and/or modify it | ||
| 7 | * under the terms of the GNU General Public License as published by the Free | ||
| 8 | * Software Foundation version 2 and no later version. | ||
| 9 | * | ||
| 10 | * This program is distributed in the hope that it will be useful, but WITHOUT | ||
| 11 | * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or | ||
| 12 | * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for | ||
| 13 | * more details. | ||
| 14 | */ | ||
| 15 | |||
| 16 | #ifndef _VM_SOCKETS_H | ||
| 17 | #define _VM_SOCKETS_H | ||
| 18 | |||
| 19 | #include <uapi/linux/vm_sockets.h> | ||
| 20 | |||
| 21 | int vm_sockets_get_local_cid(void); | ||
| 22 | |||
| 23 | #endif /* _VM_SOCKETS_H */ | ||
diff --git a/include/net/af_unix.h b/include/net/af_unix.h index 0a996a3517ed..dbdfd2b0f3b3 100644 --- a/include/net/af_unix.h +++ b/include/net/af_unix.h | |||
| @@ -29,7 +29,8 @@ struct unix_address { | |||
| 29 | 29 | ||
| 30 | struct unix_skb_parms { | 30 | struct unix_skb_parms { |
| 31 | struct pid *pid; /* Skb credentials */ | 31 | struct pid *pid; /* Skb credentials */ |
| 32 | const struct cred *cred; | 32 | kuid_t uid; |
| 33 | kgid_t gid; | ||
| 33 | struct scm_fp_list *fp; /* Passed files */ | 34 | struct scm_fp_list *fp; /* Passed files */ |
| 34 | #ifdef CONFIG_SECURITY_NETWORK | 35 | #ifdef CONFIG_SECURITY_NETWORK |
| 35 | u32 secid; /* Security ID */ | 36 | u32 secid; /* Security ID */ |
| @@ -56,9 +57,10 @@ struct unix_sock { | |||
| 56 | struct list_head link; | 57 | struct list_head link; |
| 57 | atomic_long_t inflight; | 58 | atomic_long_t inflight; |
| 58 | spinlock_t lock; | 59 | spinlock_t lock; |
| 59 | unsigned int gc_candidate : 1; | ||
| 60 | unsigned int gc_maybe_cycle : 1; | ||
| 61 | unsigned char recursion_level; | 60 | unsigned char recursion_level; |
| 61 | unsigned long gc_flags; | ||
| 62 | #define UNIX_GC_CANDIDATE 0 | ||
| 63 | #define UNIX_GC_MAYBE_CYCLE 1 | ||
| 62 | struct socket_wq peer_wq; | 64 | struct socket_wq peer_wq; |
| 63 | }; | 65 | }; |
| 64 | #define unix_sk(__sk) ((struct unix_sock *)__sk) | 66 | #define unix_sk(__sk) ((struct unix_sock *)__sk) |
diff --git a/include/net/bluetooth/bluetooth.h b/include/net/bluetooth/bluetooth.h index 9531beee09b5..6912ef9a1881 100644 --- a/include/net/bluetooth/bluetooth.h +++ b/include/net/bluetooth/bluetooth.h | |||
| @@ -193,11 +193,11 @@ static inline bool bdaddr_type_is_le(__u8 type) | |||
| 193 | #define BDADDR_LOCAL (&(bdaddr_t) {{0, 0, 0, 0xff, 0xff, 0xff} }) | 193 | #define BDADDR_LOCAL (&(bdaddr_t) {{0, 0, 0, 0xff, 0xff, 0xff} }) |
| 194 | 194 | ||
| 195 | /* Copy, swap, convert BD Address */ | 195 | /* Copy, swap, convert BD Address */ |
| 196 | static inline int bacmp(bdaddr_t *ba1, bdaddr_t *ba2) | 196 | static inline int bacmp(const bdaddr_t *ba1, const bdaddr_t *ba2) |
| 197 | { | 197 | { |
| 198 | return memcmp(ba1, ba2, sizeof(bdaddr_t)); | 198 | return memcmp(ba1, ba2, sizeof(bdaddr_t)); |
| 199 | } | 199 | } |
| 200 | static inline void bacpy(bdaddr_t *dst, bdaddr_t *src) | 200 | static inline void bacpy(bdaddr_t *dst, const bdaddr_t *src) |
| 201 | { | 201 | { |
| 202 | memcpy(dst, src, sizeof(bdaddr_t)); | 202 | memcpy(dst, src, sizeof(bdaddr_t)); |
| 203 | } | 203 | } |
| @@ -232,7 +232,7 @@ struct bt_sock_list { | |||
| 232 | }; | 232 | }; |
| 233 | 233 | ||
| 234 | int bt_sock_register(int proto, const struct net_proto_family *ops); | 234 | int bt_sock_register(int proto, const struct net_proto_family *ops); |
| 235 | int bt_sock_unregister(int proto); | 235 | void bt_sock_unregister(int proto); |
| 236 | void bt_sock_link(struct bt_sock_list *l, struct sock *s); | 236 | void bt_sock_link(struct bt_sock_list *l, struct sock *s); |
| 237 | void bt_sock_unlink(struct bt_sock_list *l, struct sock *s); | 237 | void bt_sock_unlink(struct bt_sock_list *l, struct sock *s); |
| 238 | int bt_sock_recvmsg(struct kiocb *iocb, struct socket *sock, | 238 | int bt_sock_recvmsg(struct kiocb *iocb, struct socket *sock, |
| @@ -260,12 +260,23 @@ struct l2cap_ctrl { | |||
| 260 | __u8 retries; | 260 | __u8 retries; |
| 261 | }; | 261 | }; |
| 262 | 262 | ||
| 263 | struct hci_dev; | ||
| 264 | |||
| 265 | typedef void (*hci_req_complete_t)(struct hci_dev *hdev, u8 status); | ||
| 266 | |||
| 267 | struct hci_req_ctrl { | ||
| 268 | bool start; | ||
| 269 | u8 event; | ||
| 270 | hci_req_complete_t complete; | ||
| 271 | }; | ||
| 272 | |||
| 263 | struct bt_skb_cb { | 273 | struct bt_skb_cb { |
| 264 | __u8 pkt_type; | 274 | __u8 pkt_type; |
| 265 | __u8 incoming; | 275 | __u8 incoming; |
| 266 | __u16 expect; | 276 | __u16 expect; |
| 267 | __u8 force_active; | 277 | __u8 force_active; |
| 268 | struct l2cap_ctrl control; | 278 | struct l2cap_ctrl control; |
| 279 | struct hci_req_ctrl req; | ||
| 269 | }; | 280 | }; |
| 270 | #define bt_cb(skb) ((struct bt_skb_cb *)((skb)->cb)) | 281 | #define bt_cb(skb) ((struct bt_skb_cb *)((skb)->cb)) |
| 271 | 282 | ||
diff --git a/include/net/bluetooth/hci.h b/include/net/bluetooth/hci.h index 7f12c25f1fca..e0512aaef4b8 100644 --- a/include/net/bluetooth/hci.h +++ b/include/net/bluetooth/hci.h | |||
| @@ -119,10 +119,16 @@ enum { | |||
| 119 | HCI_CONNECTABLE, | 119 | HCI_CONNECTABLE, |
| 120 | HCI_DISCOVERABLE, | 120 | HCI_DISCOVERABLE, |
| 121 | HCI_LINK_SECURITY, | 121 | HCI_LINK_SECURITY, |
| 122 | HCI_PENDING_CLASS, | ||
| 123 | HCI_PERIODIC_INQ, | 122 | HCI_PERIODIC_INQ, |
| 123 | HCI_FAST_CONNECTABLE, | ||
| 124 | }; | 124 | }; |
| 125 | 125 | ||
| 126 | /* A mask for the flags that are supposed to remain when a reset happens | ||
| 127 | * or the HCI device is closed. | ||
| 128 | */ | ||
| 129 | #define HCI_PERSISTENT_MASK (BIT(HCI_LE_SCAN) | BIT(HCI_PERIODIC_INQ) | \ | ||
| 130 | BIT(HCI_FAST_CONNECTABLE)) | ||
| 131 | |||
| 126 | /* HCI ioctl defines */ | 132 | /* HCI ioctl defines */ |
| 127 | #define HCIDEVUP _IOW('H', 201, int) | 133 | #define HCIDEVUP _IOW('H', 201, int) |
| 128 | #define HCIDEVDOWN _IOW('H', 202, int) | 134 | #define HCIDEVDOWN _IOW('H', 202, int) |
| @@ -881,12 +887,25 @@ struct hci_rp_read_data_block_size { | |||
| 881 | __le16 num_blocks; | 887 | __le16 num_blocks; |
| 882 | } __packed; | 888 | } __packed; |
| 883 | 889 | ||
| 890 | #define HCI_OP_READ_PAGE_SCAN_ACTIVITY 0x0c1b | ||
| 891 | struct hci_rp_read_page_scan_activity { | ||
| 892 | __u8 status; | ||
| 893 | __le16 interval; | ||
| 894 | __le16 window; | ||
| 895 | } __packed; | ||
| 896 | |||
| 884 | #define HCI_OP_WRITE_PAGE_SCAN_ACTIVITY 0x0c1c | 897 | #define HCI_OP_WRITE_PAGE_SCAN_ACTIVITY 0x0c1c |
| 885 | struct hci_cp_write_page_scan_activity { | 898 | struct hci_cp_write_page_scan_activity { |
| 886 | __le16 interval; | 899 | __le16 interval; |
| 887 | __le16 window; | 900 | __le16 window; |
| 888 | } __packed; | 901 | } __packed; |
| 889 | 902 | ||
| 903 | #define HCI_OP_READ_PAGE_SCAN_TYPE 0x0c46 | ||
| 904 | struct hci_rp_read_page_scan_type { | ||
| 905 | __u8 status; | ||
| 906 | __u8 type; | ||
| 907 | } __packed; | ||
| 908 | |||
| 890 | #define HCI_OP_WRITE_PAGE_SCAN_TYPE 0x0c47 | 909 | #define HCI_OP_WRITE_PAGE_SCAN_TYPE 0x0c47 |
| 891 | #define PAGE_SCAN_TYPE_STANDARD 0x00 | 910 | #define PAGE_SCAN_TYPE_STANDARD 0x00 |
| 892 | #define PAGE_SCAN_TYPE_INTERLACED 0x01 | 911 | #define PAGE_SCAN_TYPE_INTERLACED 0x01 |
| @@ -965,6 +984,9 @@ struct hci_cp_le_set_adv_data { | |||
| 965 | 984 | ||
| 966 | #define HCI_OP_LE_SET_ADV_ENABLE 0x200a | 985 | #define HCI_OP_LE_SET_ADV_ENABLE 0x200a |
| 967 | 986 | ||
| 987 | #define LE_SCAN_PASSIVE 0x00 | ||
| 988 | #define LE_SCAN_ACTIVE 0x01 | ||
| 989 | |||
| 968 | #define HCI_OP_LE_SET_SCAN_PARAM 0x200b | 990 | #define HCI_OP_LE_SET_SCAN_PARAM 0x200b |
| 969 | struct hci_cp_le_set_scan_param { | 991 | struct hci_cp_le_set_scan_param { |
| 970 | __u8 type; | 992 | __u8 type; |
| @@ -974,8 +996,10 @@ struct hci_cp_le_set_scan_param { | |||
| 974 | __u8 filter_policy; | 996 | __u8 filter_policy; |
| 975 | } __packed; | 997 | } __packed; |
| 976 | 998 | ||
| 977 | #define LE_SCANNING_DISABLED 0x00 | 999 | #define LE_SCAN_DISABLE 0x00 |
| 978 | #define LE_SCANNING_ENABLED 0x01 | 1000 | #define LE_SCAN_ENABLE 0x01 |
| 1001 | #define LE_SCAN_FILTER_DUP_DISABLE 0x00 | ||
| 1002 | #define LE_SCAN_FILTER_DUP_ENABLE 0x01 | ||
| 979 | 1003 | ||
| 980 | #define HCI_OP_LE_SET_SCAN_ENABLE 0x200c | 1004 | #define HCI_OP_LE_SET_SCAN_ENABLE 0x200c |
| 981 | struct hci_cp_le_set_scan_enable { | 1005 | struct hci_cp_le_set_scan_enable { |
diff --git a/include/net/bluetooth/hci_core.h b/include/net/bluetooth/hci_core.h index 90cf75afcb02..35a57cd1704c 100644 --- a/include/net/bluetooth/hci_core.h +++ b/include/net/bluetooth/hci_core.h | |||
| @@ -134,6 +134,8 @@ struct amp_assoc { | |||
| 134 | __u8 data[HCI_MAX_AMP_ASSOC_SIZE]; | 134 | __u8 data[HCI_MAX_AMP_ASSOC_SIZE]; |
| 135 | }; | 135 | }; |
| 136 | 136 | ||
| 137 | #define HCI_MAX_PAGES 3 | ||
| 138 | |||
| 137 | #define NUM_REASSEMBLY 4 | 139 | #define NUM_REASSEMBLY 4 |
| 138 | struct hci_dev { | 140 | struct hci_dev { |
| 139 | struct list_head list; | 141 | struct list_head list; |
| @@ -151,8 +153,8 @@ struct hci_dev { | |||
| 151 | __u8 dev_class[3]; | 153 | __u8 dev_class[3]; |
| 152 | __u8 major_class; | 154 | __u8 major_class; |
| 153 | __u8 minor_class; | 155 | __u8 minor_class; |
| 154 | __u8 features[8]; | 156 | __u8 max_page; |
| 155 | __u8 host_features[8]; | 157 | __u8 features[HCI_MAX_PAGES][8]; |
| 156 | __u8 le_features[8]; | 158 | __u8 le_features[8]; |
| 157 | __u8 le_white_list_size; | 159 | __u8 le_white_list_size; |
| 158 | __u8 le_states[8]; | 160 | __u8 le_states[8]; |
| @@ -165,6 +167,10 @@ struct hci_dev { | |||
| 165 | __u16 voice_setting; | 167 | __u16 voice_setting; |
| 166 | __u8 io_capability; | 168 | __u8 io_capability; |
| 167 | __s8 inq_tx_power; | 169 | __s8 inq_tx_power; |
| 170 | __u16 page_scan_interval; | ||
| 171 | __u16 page_scan_window; | ||
| 172 | __u8 page_scan_type; | ||
| 173 | |||
| 168 | __u16 devid_source; | 174 | __u16 devid_source; |
| 169 | __u16 devid_vendor; | 175 | __u16 devid_vendor; |
| 170 | __u16 devid_product; | 176 | __u16 devid_product; |
| @@ -240,6 +246,7 @@ struct hci_dev { | |||
| 240 | struct sk_buff_head raw_q; | 246 | struct sk_buff_head raw_q; |
| 241 | struct sk_buff_head cmd_q; | 247 | struct sk_buff_head cmd_q; |
| 242 | 248 | ||
| 249 | struct sk_buff *recv_evt; | ||
| 243 | struct sk_buff *sent_cmd; | 250 | struct sk_buff *sent_cmd; |
| 244 | struct sk_buff *reassembly[NUM_REASSEMBLY]; | 251 | struct sk_buff *reassembly[NUM_REASSEMBLY]; |
| 245 | 252 | ||
| @@ -248,8 +255,6 @@ struct hci_dev { | |||
| 248 | __u32 req_status; | 255 | __u32 req_status; |
| 249 | __u32 req_result; | 256 | __u32 req_result; |
| 250 | 257 | ||
| 251 | __u16 init_last_cmd; | ||
| 252 | |||
| 253 | struct list_head mgmt_pending; | 258 | struct list_head mgmt_pending; |
| 254 | 259 | ||
| 255 | struct discovery_state discovery; | 260 | struct discovery_state discovery; |
| @@ -266,8 +271,6 @@ struct hci_dev { | |||
| 266 | 271 | ||
| 267 | struct hci_dev_stats stat; | 272 | struct hci_dev_stats stat; |
| 268 | 273 | ||
| 269 | struct sk_buff_head driver_init; | ||
| 270 | |||
| 271 | atomic_t promisc; | 274 | atomic_t promisc; |
| 272 | 275 | ||
| 273 | struct dentry *debugfs; | 276 | struct dentry *debugfs; |
| @@ -290,6 +293,7 @@ struct hci_dev { | |||
| 290 | int (*open)(struct hci_dev *hdev); | 293 | int (*open)(struct hci_dev *hdev); |
| 291 | int (*close)(struct hci_dev *hdev); | 294 | int (*close)(struct hci_dev *hdev); |
| 292 | int (*flush)(struct hci_dev *hdev); | 295 | int (*flush)(struct hci_dev *hdev); |
| 296 | int (*setup)(struct hci_dev *hdev); | ||
| 293 | int (*send)(struct sk_buff *skb); | 297 | int (*send)(struct sk_buff *skb); |
| 294 | void (*notify)(struct hci_dev *hdev, unsigned int evt); | 298 | void (*notify)(struct hci_dev *hdev, unsigned int evt); |
| 295 | int (*ioctl)(struct hci_dev *hdev, unsigned int cmd, unsigned long arg); | 299 | int (*ioctl)(struct hci_dev *hdev, unsigned int cmd, unsigned long arg); |
| @@ -311,7 +315,7 @@ struct hci_conn { | |||
| 311 | bool out; | 315 | bool out; |
| 312 | __u8 attempt; | 316 | __u8 attempt; |
| 313 | __u8 dev_class[3]; | 317 | __u8 dev_class[3]; |
| 314 | __u8 features[8]; | 318 | __u8 features[HCI_MAX_PAGES][8]; |
| 315 | __u16 interval; | 319 | __u16 interval; |
| 316 | __u16 pkt_type; | 320 | __u16 pkt_type; |
| 317 | __u16 link_policy; | 321 | __u16 link_policy; |
| @@ -343,7 +347,6 @@ struct hci_conn { | |||
| 343 | struct timer_list auto_accept_timer; | 347 | struct timer_list auto_accept_timer; |
| 344 | 348 | ||
| 345 | struct device dev; | 349 | struct device dev; |
| 346 | atomic_t devref; | ||
| 347 | 350 | ||
| 348 | struct hci_dev *hdev; | 351 | struct hci_dev *hdev; |
| 349 | void *l2cap_data; | 352 | void *l2cap_data; |
| @@ -574,7 +577,7 @@ static inline struct hci_conn *hci_conn_hash_lookup_state(struct hci_dev *hdev, | |||
| 574 | return NULL; | 577 | return NULL; |
| 575 | } | 578 | } |
| 576 | 579 | ||
| 577 | void hci_acl_disconn(struct hci_conn *conn, __u8 reason); | 580 | void hci_disconnect(struct hci_conn *conn, __u8 reason); |
| 578 | void hci_setup_sync(struct hci_conn *conn, __u16 handle); | 581 | void hci_setup_sync(struct hci_conn *conn, __u16 handle); |
| 579 | void hci_sco_setup(struct hci_conn *conn, __u8 status); | 582 | void hci_sco_setup(struct hci_conn *conn, __u8 status); |
| 580 | 583 | ||
| @@ -582,7 +585,6 @@ struct hci_conn *hci_conn_add(struct hci_dev *hdev, int type, bdaddr_t *dst); | |||
| 582 | int hci_conn_del(struct hci_conn *conn); | 585 | int hci_conn_del(struct hci_conn *conn); |
| 583 | void hci_conn_hash_flush(struct hci_dev *hdev); | 586 | void hci_conn_hash_flush(struct hci_dev *hdev); |
| 584 | void hci_conn_check_pending(struct hci_dev *hdev); | 587 | void hci_conn_check_pending(struct hci_dev *hdev); |
| 585 | void hci_conn_accept(struct hci_conn *conn, int mask); | ||
| 586 | 588 | ||
| 587 | struct hci_chan *hci_chan_create(struct hci_conn *conn); | 589 | struct hci_chan *hci_chan_create(struct hci_conn *conn); |
| 588 | void hci_chan_del(struct hci_chan *chan); | 590 | void hci_chan_del(struct hci_chan *chan); |
| @@ -599,8 +601,36 @@ int hci_conn_switch_role(struct hci_conn *conn, __u8 role); | |||
| 599 | 601 | ||
| 600 | void hci_conn_enter_active_mode(struct hci_conn *conn, __u8 force_active); | 602 | void hci_conn_enter_active_mode(struct hci_conn *conn, __u8 force_active); |
| 601 | 603 | ||
| 602 | void hci_conn_hold_device(struct hci_conn *conn); | 604 | /* |
| 603 | void hci_conn_put_device(struct hci_conn *conn); | 605 | * hci_conn_get() and hci_conn_put() are used to control the life-time of an |
| 606 | * "hci_conn" object. They do not guarantee that the hci_conn object is running, | ||
| 607 | * working or anything else. They just guarantee that the object is available | ||
| 608 | * and can be dereferenced. So you can use its locks, local variables and any | ||
| 609 | * other constant data. | ||
| 610 | * Before accessing runtime data, you _must_ lock the object and then check that | ||
| 611 | * it is still running. As soon as you release the locks, the connection might | ||
| 612 | * get dropped, though. | ||
| 613 | * | ||
| 614 | * On the other hand, hci_conn_hold() and hci_conn_drop() are used to control | ||
| 615 | * how long the underlying connection is held. So every channel that runs on the | ||
| 616 | * hci_conn object calls this to prevent the connection from disappearing. As | ||
| 617 | * long as you hold a device, you must also guarantee that you have a valid | ||
| 618 | * reference to the device via hci_conn_get() (or the initial reference from | ||
| 619 | * hci_conn_add()). | ||
| 620 | * The hold()/drop() ref-count is known to drop below 0 sometimes, which doesn't | ||
| 621 | * break because nobody cares for that. But this means, we cannot use | ||
| 622 | * _get()/_drop() in it, but require the caller to have a valid ref (FIXME). | ||
| 623 | */ | ||
| 624 | |||
| 625 | static inline void hci_conn_get(struct hci_conn *conn) | ||
| 626 | { | ||
| 627 | get_device(&conn->dev); | ||
| 628 | } | ||
| 629 | |||
| 630 | static inline void hci_conn_put(struct hci_conn *conn) | ||
| 631 | { | ||
| 632 | put_device(&conn->dev); | ||
| 633 | } | ||
| 604 | 634 | ||
| 605 | static inline void hci_conn_hold(struct hci_conn *conn) | 635 | static inline void hci_conn_hold(struct hci_conn *conn) |
| 606 | { | 636 | { |
| @@ -610,7 +640,7 @@ static inline void hci_conn_hold(struct hci_conn *conn) | |||
| 610 | cancel_delayed_work(&conn->disc_work); | 640 | cancel_delayed_work(&conn->disc_work); |
| 611 | } | 641 | } |
| 612 | 642 | ||
| 613 | static inline void hci_conn_put(struct hci_conn *conn) | 643 | static inline void hci_conn_drop(struct hci_conn *conn) |
| 614 | { | 644 | { |
| 615 | BT_DBG("hcon %p orig refcnt %d", conn, atomic_read(&conn->refcnt)); | 645 | BT_DBG("hcon %p orig refcnt %d", conn, atomic_read(&conn->refcnt)); |
| 616 | 646 | ||
| @@ -742,8 +772,6 @@ int hci_add_remote_oob_data(struct hci_dev *hdev, bdaddr_t *bdaddr, u8 *hash, | |||
| 742 | u8 *randomizer); | 772 | u8 *randomizer); |
| 743 | int hci_remove_remote_oob_data(struct hci_dev *hdev, bdaddr_t *bdaddr); | 773 | int hci_remove_remote_oob_data(struct hci_dev *hdev, bdaddr_t *bdaddr); |
| 744 | 774 | ||
| 745 | int hci_update_ad(struct hci_dev *hdev); | ||
| 746 | |||
| 747 | void hci_event_packet(struct hci_dev *hdev, struct sk_buff *skb); | 775 | void hci_event_packet(struct hci_dev *hdev, struct sk_buff *skb); |
| 748 | 776 | ||
| 749 | int hci_recv_frame(struct sk_buff *skb); | 777 | int hci_recv_frame(struct sk_buff *skb); |
| @@ -760,29 +788,29 @@ void hci_conn_del_sysfs(struct hci_conn *conn); | |||
| 760 | #define SET_HCIDEV_DEV(hdev, pdev) ((hdev)->dev.parent = (pdev)) | 788 | #define SET_HCIDEV_DEV(hdev, pdev) ((hdev)->dev.parent = (pdev)) |
| 761 | 789 | ||
| 762 | /* ----- LMP capabilities ----- */ | 790 | /* ----- LMP capabilities ----- */ |
| 763 | #define lmp_encrypt_capable(dev) ((dev)->features[0] & LMP_ENCRYPT) | 791 | #define lmp_encrypt_capable(dev) ((dev)->features[0][0] & LMP_ENCRYPT) |
| 764 | #define lmp_rswitch_capable(dev) ((dev)->features[0] & LMP_RSWITCH) | 792 | #define lmp_rswitch_capable(dev) ((dev)->features[0][0] & LMP_RSWITCH) |
| 765 | #define lmp_hold_capable(dev) ((dev)->features[0] & LMP_HOLD) | 793 | #define lmp_hold_capable(dev) ((dev)->features[0][0] & LMP_HOLD) |
| 766 | #define lmp_sniff_capable(dev) ((dev)->features[0] & LMP_SNIFF) | 794 | #define lmp_sniff_capable(dev) ((dev)->features[0][0] & LMP_SNIFF) |
| 767 | #define lmp_park_capable(dev) ((dev)->features[1] & LMP_PARK) | 795 | #define lmp_park_capable(dev) ((dev)->features[0][1] & LMP_PARK) |
| 768 | #define lmp_inq_rssi_capable(dev) ((dev)->features[3] & LMP_RSSI_INQ) | 796 | #define lmp_inq_rssi_capable(dev) ((dev)->features[0][3] & LMP_RSSI_INQ) |
| 769 | #define lmp_esco_capable(dev) ((dev)->features[3] & LMP_ESCO) | 797 | #define lmp_esco_capable(dev) ((dev)->features[0][3] & LMP_ESCO) |
| 770 | #define lmp_bredr_capable(dev) (!((dev)->features[4] & LMP_NO_BREDR)) | 798 | #define lmp_bredr_capable(dev) (!((dev)->features[0][4] & LMP_NO_BREDR)) |
| 771 | #define lmp_le_capable(dev) ((dev)->features[4] & LMP_LE) | 799 | #define lmp_le_capable(dev) ((dev)->features[0][4] & LMP_LE) |
| 772 | #define lmp_sniffsubr_capable(dev) ((dev)->features[5] & LMP_SNIFF_SUBR) | 800 | #define lmp_sniffsubr_capable(dev) ((dev)->features[0][5] & LMP_SNIFF_SUBR) |
| 773 | #define lmp_pause_enc_capable(dev) ((dev)->features[5] & LMP_PAUSE_ENC) | 801 | #define lmp_pause_enc_capable(dev) ((dev)->features[0][5] & LMP_PAUSE_ENC) |
| 774 | #define lmp_ext_inq_capable(dev) ((dev)->features[6] & LMP_EXT_INQ) | 802 | #define lmp_ext_inq_capable(dev) ((dev)->features[0][6] & LMP_EXT_INQ) |
| 775 | #define lmp_le_br_capable(dev) !!((dev)->features[6] & LMP_SIMUL_LE_BR) | 803 | #define lmp_le_br_capable(dev) (!!((dev)->features[0][6] & LMP_SIMUL_LE_BR)) |
| 776 | #define lmp_ssp_capable(dev) ((dev)->features[6] & LMP_SIMPLE_PAIR) | 804 | #define lmp_ssp_capable(dev) ((dev)->features[0][6] & LMP_SIMPLE_PAIR) |
| 777 | #define lmp_no_flush_capable(dev) ((dev)->features[6] & LMP_NO_FLUSH) | 805 | #define lmp_no_flush_capable(dev) ((dev)->features[0][6] & LMP_NO_FLUSH) |
| 778 | #define lmp_lsto_capable(dev) ((dev)->features[7] & LMP_LSTO) | 806 | #define lmp_lsto_capable(dev) ((dev)->features[0][7] & LMP_LSTO) |
| 779 | #define lmp_inq_tx_pwr_capable(dev) ((dev)->features[7] & LMP_INQ_TX_PWR) | 807 | #define lmp_inq_tx_pwr_capable(dev) ((dev)->features[0][7] & LMP_INQ_TX_PWR) |
| 780 | #define lmp_ext_feat_capable(dev) ((dev)->features[7] & LMP_EXTFEATURES) | 808 | #define lmp_ext_feat_capable(dev) ((dev)->features[0][7] & LMP_EXTFEATURES) |
| 781 | 809 | ||
| 782 | /* ----- Extended LMP capabilities ----- */ | 810 | /* ----- Extended LMP capabilities ----- */ |
| 783 | #define lmp_host_ssp_capable(dev) ((dev)->host_features[0] & LMP_HOST_SSP) | 811 | #define lmp_host_ssp_capable(dev) ((dev)->features[1][0] & LMP_HOST_SSP) |
| 784 | #define lmp_host_le_capable(dev) !!((dev)->host_features[0] & LMP_HOST_LE) | 812 | #define lmp_host_le_capable(dev) (!!((dev)->features[1][0] & LMP_HOST_LE)) |
| 785 | #define lmp_host_le_br_capable(dev) !!((dev)->host_features[0] & LMP_HOST_LE_BREDR) | 813 | #define lmp_host_le_br_capable(dev) (!!((dev)->features[1][0] & LMP_HOST_LE_BREDR)) |
| 786 | 814 | ||
| 787 | /* returns true if at least one AMP active */ | 815 | /* returns true if at least one AMP active */ |
| 788 | static inline bool hci_amp_capable(void) | 816 | static inline bool hci_amp_capable(void) |
| @@ -1041,7 +1069,31 @@ static inline u16 eir_append_data(u8 *eir, u16 eir_len, u8 type, u8 *data, | |||
| 1041 | int hci_register_cb(struct hci_cb *hcb); | 1069 | int hci_register_cb(struct hci_cb *hcb); |
| 1042 | int hci_unregister_cb(struct hci_cb *hcb); | 1070 | int hci_unregister_cb(struct hci_cb *hcb); |
| 1043 | 1071 | ||
| 1044 | int hci_send_cmd(struct hci_dev *hdev, __u16 opcode, __u32 plen, void *param); | 1072 | struct hci_request { |
| 1073 | struct hci_dev *hdev; | ||
| 1074 | struct sk_buff_head cmd_q; | ||
| 1075 | |||
| 1076 | /* If something goes wrong when building the HCI request, the error | ||
| 1077 | * value is stored in this field. | ||
| 1078 | */ | ||
| 1079 | int err; | ||
| 1080 | }; | ||
| 1081 | |||
| 1082 | void hci_req_init(struct hci_request *req, struct hci_dev *hdev); | ||
| 1083 | int hci_req_run(struct hci_request *req, hci_req_complete_t complete); | ||
| 1084 | void hci_req_add(struct hci_request *req, u16 opcode, u32 plen, | ||
| 1085 | const void *param); | ||
| 1086 | void hci_req_add_ev(struct hci_request *req, u16 opcode, u32 plen, | ||
| 1087 | const void *param, u8 event); | ||
| 1088 | void hci_req_cmd_complete(struct hci_dev *hdev, u16 opcode, u8 status); | ||
| 1089 | |||
| 1090 | struct sk_buff *__hci_cmd_sync(struct hci_dev *hdev, u16 opcode, u32 plen, | ||
| 1091 | const void *param, u32 timeout); | ||
| 1092 | struct sk_buff *__hci_cmd_sync_ev(struct hci_dev *hdev, u16 opcode, u32 plen, | ||
| 1093 | const void *param, u8 event, u32 timeout); | ||
| 1094 | |||
| 1095 | int hci_send_cmd(struct hci_dev *hdev, __u16 opcode, __u32 plen, | ||
| 1096 | const void *param); | ||
| 1045 | void hci_send_acl(struct hci_chan *chan, struct sk_buff *skb, __u16 flags); | 1097 | void hci_send_acl(struct hci_chan *chan, struct sk_buff *skb, __u16 flags); |
| 1046 | void hci_send_sco(struct hci_conn *conn, struct sk_buff *skb); | 1098 | void hci_send_sco(struct hci_conn *conn, struct sk_buff *skb); |
| 1047 | 1099 | ||
| @@ -1153,7 +1205,7 @@ struct hci_sec_filter { | |||
| 1153 | #define hci_req_lock(d) mutex_lock(&d->req_lock) | 1205 | #define hci_req_lock(d) mutex_lock(&d->req_lock) |
| 1154 | #define hci_req_unlock(d) mutex_unlock(&d->req_lock) | 1206 | #define hci_req_unlock(d) mutex_unlock(&d->req_lock) |
| 1155 | 1207 | ||
| 1156 | void hci_req_complete(struct hci_dev *hdev, __u16 cmd, int result); | 1208 | void hci_update_ad(struct hci_request *req); |
| 1157 | 1209 | ||
| 1158 | void hci_le_conn_update(struct hci_conn *conn, u16 min, u16 max, | 1210 | void hci_le_conn_update(struct hci_conn *conn, u16 min, u16 max, |
| 1159 | u16 latency, u16 to_multiplier); | 1211 | u16 latency, u16 to_multiplier); |
diff --git a/include/net/bluetooth/l2cap.h b/include/net/bluetooth/l2cap.h index cdd33021f831..fb94cf13c777 100644 --- a/include/net/bluetooth/l2cap.h +++ b/include/net/bluetooth/l2cap.h | |||
| @@ -583,6 +583,14 @@ struct l2cap_conn { | |||
| 583 | 583 | ||
| 584 | struct list_head chan_l; | 584 | struct list_head chan_l; |
| 585 | struct mutex chan_lock; | 585 | struct mutex chan_lock; |
| 586 | struct kref ref; | ||
| 587 | struct list_head users; | ||
| 588 | }; | ||
| 589 | |||
| 590 | struct l2cap_user { | ||
| 591 | struct list_head list; | ||
| 592 | int (*probe) (struct l2cap_conn *conn, struct l2cap_user *user); | ||
| 593 | void (*remove) (struct l2cap_conn *conn, struct l2cap_user *user); | ||
| 586 | }; | 594 | }; |
| 587 | 595 | ||
| 588 | #define L2CAP_INFO_CL_MTU_REQ_SENT 0x01 | 596 | #define L2CAP_INFO_CL_MTU_REQ_SENT 0x01 |
| @@ -786,6 +794,7 @@ extern bool disable_ertm; | |||
| 786 | 794 | ||
| 787 | int l2cap_init_sockets(void); | 795 | int l2cap_init_sockets(void); |
| 788 | void l2cap_cleanup_sockets(void); | 796 | void l2cap_cleanup_sockets(void); |
| 797 | bool l2cap_is_socket(struct socket *sock); | ||
| 789 | 798 | ||
| 790 | void __l2cap_connect_rsp_defer(struct l2cap_chan *chan); | 799 | void __l2cap_connect_rsp_defer(struct l2cap_chan *chan); |
| 791 | int __l2cap_wait_ack(struct sock *sk); | 800 | int __l2cap_wait_ack(struct sock *sk); |
| @@ -812,4 +821,10 @@ void l2cap_logical_cfm(struct l2cap_chan *chan, struct hci_chan *hchan, | |||
| 812 | u8 status); | 821 | u8 status); |
| 813 | void __l2cap_physical_cfm(struct l2cap_chan *chan, int result); | 822 | void __l2cap_physical_cfm(struct l2cap_chan *chan, int result); |
| 814 | 823 | ||
| 824 | void l2cap_conn_get(struct l2cap_conn *conn); | ||
| 825 | void l2cap_conn_put(struct l2cap_conn *conn); | ||
| 826 | |||
| 827 | int l2cap_register_user(struct l2cap_conn *conn, struct l2cap_user *user); | ||
| 828 | void l2cap_unregister_user(struct l2cap_conn *conn, struct l2cap_user *user); | ||
| 829 | |||
| 815 | #endif /* __L2CAP_H */ | 830 | #endif /* __L2CAP_H */ |
diff --git a/include/net/bluetooth/rfcomm.h b/include/net/bluetooth/rfcomm.h index e2e3ecad1008..7afd4199d6b6 100644 --- a/include/net/bluetooth/rfcomm.h +++ b/include/net/bluetooth/rfcomm.h | |||
| @@ -158,7 +158,6 @@ struct rfcomm_session { | |||
| 158 | struct timer_list timer; | 158 | struct timer_list timer; |
| 159 | unsigned long state; | 159 | unsigned long state; |
| 160 | unsigned long flags; | 160 | unsigned long flags; |
| 161 | atomic_t refcnt; | ||
| 162 | int initiator; | 161 | int initiator; |
| 163 | 162 | ||
| 164 | /* Default DLC parameters */ | 163 | /* Default DLC parameters */ |
| @@ -276,11 +275,6 @@ static inline void rfcomm_dlc_unthrottle(struct rfcomm_dlc *d) | |||
| 276 | void rfcomm_session_getaddr(struct rfcomm_session *s, bdaddr_t *src, | 275 | void rfcomm_session_getaddr(struct rfcomm_session *s, bdaddr_t *src, |
| 277 | bdaddr_t *dst); | 276 | bdaddr_t *dst); |
| 278 | 277 | ||
| 279 | static inline void rfcomm_session_hold(struct rfcomm_session *s) | ||
| 280 | { | ||
| 281 | atomic_inc(&s->refcnt); | ||
| 282 | } | ||
| 283 | |||
| 284 | /* ---- RFCOMM sockets ---- */ | 278 | /* ---- RFCOMM sockets ---- */ |
| 285 | struct sockaddr_rc { | 279 | struct sockaddr_rc { |
| 286 | sa_family_t rc_family; | 280 | sa_family_t rc_family; |
diff --git a/include/net/caif/caif_dev.h b/include/net/caif/caif_dev.h index ef2dd9438bb1..028b754ae9b1 100644 --- a/include/net/caif/caif_dev.h +++ b/include/net/caif/caif_dev.h | |||
| @@ -1,6 +1,6 @@ | |||
| 1 | /* | 1 | /* |
| 2 | * Copyright (C) ST-Ericsson AB 2010 | 2 | * Copyright (C) ST-Ericsson AB 2010 |
| 3 | * Author: Sjur Brendeland/ sjur.brandeland@stericsson.com | 3 | * Author: Sjur Brendeland |
| 4 | * License terms: GNU General Public License (GPL) version 2 | 4 | * License terms: GNU General Public License (GPL) version 2 |
| 5 | */ | 5 | */ |
| 6 | 6 | ||
diff --git a/include/net/caif/caif_device.h b/include/net/caif/caif_device.h index d02f044adb8a..d6e3c4267c81 100644 --- a/include/net/caif/caif_device.h +++ b/include/net/caif/caif_device.h | |||
| @@ -1,6 +1,6 @@ | |||
| 1 | /* | 1 | /* |
| 2 | * Copyright (C) ST-Ericsson AB 2010 | 2 | * Copyright (C) ST-Ericsson AB 2010 |
| 3 | * Author: Sjur Brendeland/ sjur.brandeland@stericsson.com | 3 | * Author: Sjur Brendeland |
| 4 | * License terms: GNU General Public License (GPL) version 2 | 4 | * License terms: GNU General Public License (GPL) version 2 |
| 5 | */ | 5 | */ |
| 6 | 6 | ||
diff --git a/include/net/caif/caif_hsi.h b/include/net/caif/caif_hsi.h index bcb9cc3ce98b..4795e817afe5 100644 --- a/include/net/caif/caif_hsi.h +++ b/include/net/caif/caif_hsi.h | |||
| @@ -1,6 +1,5 @@ | |||
| 1 | /* | 1 | /* |
| 2 | * Copyright (C) ST-Ericsson AB 2010 | 2 | * Copyright (C) ST-Ericsson AB 2010 |
| 3 | * Contact: Sjur Brendeland / sjur.brandeland@stericsson.com | ||
| 4 | * Author: Daniel Martensson / daniel.martensson@stericsson.com | 3 | * Author: Daniel Martensson / daniel.martensson@stericsson.com |
| 5 | * Dmitry.Tarnyagin / dmitry.tarnyagin@stericsson.com | 4 | * Dmitry.Tarnyagin / dmitry.tarnyagin@stericsson.com |
| 6 | * License terms: GNU General Public License (GPL) version 2 | 5 | * License terms: GNU General Public License (GPL) version 2 |
diff --git a/include/net/caif/caif_layer.h b/include/net/caif/caif_layer.h index 0f3a39125f90..94e5ed64dc6d 100644 --- a/include/net/caif/caif_layer.h +++ b/include/net/caif/caif_layer.h | |||
| @@ -1,6 +1,6 @@ | |||
| 1 | /* | 1 | /* |
| 2 | * Copyright (C) ST-Ericsson AB 2010 | 2 | * Copyright (C) ST-Ericsson AB 2010 |
| 3 | * Author: Sjur Brendeland / sjur.brandeland@stericsson.com | 3 | * Author: Sjur Brendeland |
| 4 | * License terms: GNU General Public License (GPL) version 2 | 4 | * License terms: GNU General Public License (GPL) version 2 |
| 5 | */ | 5 | */ |
| 6 | 6 | ||
diff --git a/include/net/caif/caif_shm.h b/include/net/caif/caif_shm.h deleted file mode 100644 index 5bcce55438cf..000000000000 --- a/include/net/caif/caif_shm.h +++ /dev/null | |||
| @@ -1,26 +0,0 @@ | |||
| 1 | /* | ||
| 2 | * Copyright (C) ST-Ericsson AB 2010 | ||
| 3 | * Contact: Sjur Brendeland / sjur.brandeland@stericsson.com | ||
| 4 | * Author: Amarnath Revanna / amarnath.bangalore.revanna@stericsson.com | ||
| 5 | * License terms: GNU General Public License (GPL) version 2 | ||
| 6 | */ | ||
| 7 | |||
| 8 | #ifndef CAIF_SHM_H_ | ||
| 9 | #define CAIF_SHM_H_ | ||
| 10 | |||
| 11 | struct shmdev_layer { | ||
| 12 | u32 shm_base_addr; | ||
| 13 | u32 shm_total_sz; | ||
| 14 | u32 shm_id; | ||
| 15 | u32 shm_loopback; | ||
| 16 | void *hmbx; | ||
| 17 | int (*pshmdev_mbxsend) (u32 shm_id, u32 mbx_msg); | ||
| 18 | int (*pshmdev_mbxsetup) (void *pshmdrv_cb, | ||
| 19 | struct shmdev_layer *pshm_dev, void *pshm_drv); | ||
| 20 | struct net_device *pshm_netdev; | ||
| 21 | }; | ||
| 22 | |||
| 23 | extern int caif_shmcore_probe(struct shmdev_layer *pshm_dev); | ||
| 24 | extern void caif_shmcore_remove(struct net_device *pshm_netdev); | ||
| 25 | |||
| 26 | #endif | ||
diff --git a/include/net/caif/cfcnfg.h b/include/net/caif/cfcnfg.h index 90b4ff8bad83..70bfd017581f 100644 --- a/include/net/caif/cfcnfg.h +++ b/include/net/caif/cfcnfg.h | |||
| @@ -1,6 +1,6 @@ | |||
| 1 | /* | 1 | /* |
| 2 | * Copyright (C) ST-Ericsson AB 2010 | 2 | * Copyright (C) ST-Ericsson AB 2010 |
| 3 | * Author: Sjur Brendeland/sjur.brandeland@stericsson.com | 3 | * Author: Sjur Brendeland |
| 4 | * License terms: GNU General Public License (GPL) version 2 | 4 | * License terms: GNU General Public License (GPL) version 2 |
| 5 | */ | 5 | */ |
| 6 | 6 | ||
diff --git a/include/net/caif/cfctrl.h b/include/net/caif/cfctrl.h index 9e5425b4a1d7..f2ae33d23baf 100644 --- a/include/net/caif/cfctrl.h +++ b/include/net/caif/cfctrl.h | |||
| @@ -1,6 +1,6 @@ | |||
| 1 | /* | 1 | /* |
| 2 | * Copyright (C) ST-Ericsson AB 2010 | 2 | * Copyright (C) ST-Ericsson AB 2010 |
| 3 | * Author: Sjur Brendeland/sjur.brandeland@stericsson.com | 3 | * Author: Sjur Brendeland |
| 4 | * License terms: GNU General Public License (GPL) version 2 | 4 | * License terms: GNU General Public License (GPL) version 2 |
| 5 | */ | 5 | */ |
| 6 | 6 | ||
diff --git a/include/net/caif/cffrml.h b/include/net/caif/cffrml.h index afac1a48cce7..a06e33fbaa8b 100644 --- a/include/net/caif/cffrml.h +++ b/include/net/caif/cffrml.h | |||
| @@ -1,6 +1,6 @@ | |||
| 1 | /* | 1 | /* |
| 2 | * Copyright (C) ST-Ericsson AB 2010 | 2 | * Copyright (C) ST-Ericsson AB 2010 |
| 3 | * Author: Sjur Brendeland/sjur.brandeland@stericsson.com | 3 | * Author: Sjur Brendeland |
| 4 | * License terms: GNU General Public License (GPL) version 2 | 4 | * License terms: GNU General Public License (GPL) version 2 |
| 5 | */ | 5 | */ |
| 6 | 6 | ||
diff --git a/include/net/caif/cfmuxl.h b/include/net/caif/cfmuxl.h index 5847a196b8ad..752999572f21 100644 --- a/include/net/caif/cfmuxl.h +++ b/include/net/caif/cfmuxl.h | |||
| @@ -1,6 +1,6 @@ | |||
| 1 | /* | 1 | /* |
| 2 | * Copyright (C) ST-Ericsson AB 2010 | 2 | * Copyright (C) ST-Ericsson AB 2010 |
| 3 | * Author: Sjur Brendeland/sjur.brandeland@stericsson.com | 3 | * Author: Sjur Brendeland |
| 4 | * License terms: GNU General Public License (GPL) version 2 | 4 | * License terms: GNU General Public License (GPL) version 2 |
| 5 | */ | 5 | */ |
| 6 | 6 | ||
diff --git a/include/net/caif/cfpkt.h b/include/net/caif/cfpkt.h index 83a89ba3005b..1c1ad46250d5 100644 --- a/include/net/caif/cfpkt.h +++ b/include/net/caif/cfpkt.h | |||
| @@ -1,6 +1,6 @@ | |||
| 1 | /* | 1 | /* |
| 2 | * Copyright (C) ST-Ericsson AB 2010 | 2 | * Copyright (C) ST-Ericsson AB 2010 |
| 3 | * Author: Sjur Brendeland/sjur.brandeland@stericsson.com | 3 | * Author: Sjur Brendeland |
| 4 | * License terms: GNU General Public License (GPL) version 2 | 4 | * License terms: GNU General Public License (GPL) version 2 |
| 5 | */ | 5 | */ |
| 6 | 6 | ||
diff --git a/include/net/caif/cfserl.h b/include/net/caif/cfserl.h index f121299a3427..b5b020f3c72e 100644 --- a/include/net/caif/cfserl.h +++ b/include/net/caif/cfserl.h | |||
| @@ -1,6 +1,6 @@ | |||
| 1 | /* | 1 | /* |
| 2 | * Copyright (C) ST-Ericsson AB 2010 | 2 | * Copyright (C) ST-Ericsson AB 2010 |
| 3 | * Author: Sjur Brendeland/sjur.brandeland@stericsson.com | 3 | * Author: Sjur Brendeland |
| 4 | * License terms: GNU General Public License (GPL) version 2 | 4 | * License terms: GNU General Public License (GPL) version 2 |
| 5 | */ | 5 | */ |
| 6 | 6 | ||
diff --git a/include/net/caif/cfsrvl.h b/include/net/caif/cfsrvl.h index 0f5905241843..cd47705c2cc3 100644 --- a/include/net/caif/cfsrvl.h +++ b/include/net/caif/cfsrvl.h | |||
| @@ -1,6 +1,6 @@ | |||
| 1 | /* | 1 | /* |
| 2 | * Copyright (C) ST-Ericsson AB 2010 | 2 | * Copyright (C) ST-Ericsson AB 2010 |
| 3 | * Author: Sjur Brendeland/sjur.brandeland@stericsson.com | 3 | * Author: Sjur Brendeland |
| 4 | * License terms: GNU General Public License (GPL) version 2 | 4 | * License terms: GNU General Public License (GPL) version 2 |
| 5 | */ | 5 | */ |
| 6 | 6 | ||
diff --git a/include/net/cfg80211.h b/include/net/cfg80211.h index d581c6de5d64..26b5b692c22b 100644 --- a/include/net/cfg80211.h +++ b/include/net/cfg80211.h | |||
| @@ -611,22 +611,10 @@ struct cfg80211_ap_settings { | |||
| 611 | }; | 611 | }; |
| 612 | 612 | ||
| 613 | /** | 613 | /** |
| 614 | * enum plink_action - actions to perform in mesh peers | ||
| 615 | * | ||
| 616 | * @PLINK_ACTION_INVALID: action 0 is reserved | ||
| 617 | * @PLINK_ACTION_OPEN: start mesh peer link establishment | ||
| 618 | * @PLINK_ACTION_BLOCK: block traffic from this mesh peer | ||
| 619 | */ | ||
| 620 | enum plink_actions { | ||
| 621 | PLINK_ACTION_INVALID, | ||
| 622 | PLINK_ACTION_OPEN, | ||
| 623 | PLINK_ACTION_BLOCK, | ||
| 624 | }; | ||
| 625 | |||
| 626 | /** | ||
| 627 | * enum station_parameters_apply_mask - station parameter values to apply | 614 | * enum station_parameters_apply_mask - station parameter values to apply |
| 628 | * @STATION_PARAM_APPLY_UAPSD: apply new uAPSD parameters (uapsd_queues, max_sp) | 615 | * @STATION_PARAM_APPLY_UAPSD: apply new uAPSD parameters (uapsd_queues, max_sp) |
| 629 | * @STATION_PARAM_APPLY_CAPABILITY: apply new capability | 616 | * @STATION_PARAM_APPLY_CAPABILITY: apply new capability |
| 617 | * @STATION_PARAM_APPLY_PLINK_STATE: apply new plink state | ||
| 630 | * | 618 | * |
| 631 | * Not all station parameters have in-band "no change" signalling, | 619 | * Not all station parameters have in-band "no change" signalling, |
| 632 | * for those that don't these flags will are used. | 620 | * for those that don't these flags will are used. |
| @@ -634,6 +622,7 @@ enum plink_actions { | |||
| 634 | enum station_parameters_apply_mask { | 622 | enum station_parameters_apply_mask { |
| 635 | STATION_PARAM_APPLY_UAPSD = BIT(0), | 623 | STATION_PARAM_APPLY_UAPSD = BIT(0), |
| 636 | STATION_PARAM_APPLY_CAPABILITY = BIT(1), | 624 | STATION_PARAM_APPLY_CAPABILITY = BIT(1), |
| 625 | STATION_PARAM_APPLY_PLINK_STATE = BIT(2), | ||
| 637 | }; | 626 | }; |
| 638 | 627 | ||
| 639 | /** | 628 | /** |
| @@ -669,7 +658,7 @@ enum station_parameters_apply_mask { | |||
| 669 | * @ext_capab_len: number of extended capabilities | 658 | * @ext_capab_len: number of extended capabilities |
| 670 | */ | 659 | */ |
| 671 | struct station_parameters { | 660 | struct station_parameters { |
| 672 | u8 *supported_rates; | 661 | const u8 *supported_rates; |
| 673 | struct net_device *vlan; | 662 | struct net_device *vlan; |
| 674 | u32 sta_flags_mask, sta_flags_set; | 663 | u32 sta_flags_mask, sta_flags_set; |
| 675 | u32 sta_modify_mask; | 664 | u32 sta_modify_mask; |
| @@ -678,17 +667,60 @@ struct station_parameters { | |||
| 678 | u8 supported_rates_len; | 667 | u8 supported_rates_len; |
| 679 | u8 plink_action; | 668 | u8 plink_action; |
| 680 | u8 plink_state; | 669 | u8 plink_state; |
| 681 | struct ieee80211_ht_cap *ht_capa; | 670 | const struct ieee80211_ht_cap *ht_capa; |
| 682 | struct ieee80211_vht_cap *vht_capa; | 671 | const struct ieee80211_vht_cap *vht_capa; |
| 683 | u8 uapsd_queues; | 672 | u8 uapsd_queues; |
| 684 | u8 max_sp; | 673 | u8 max_sp; |
| 685 | enum nl80211_mesh_power_mode local_pm; | 674 | enum nl80211_mesh_power_mode local_pm; |
| 686 | u16 capability; | 675 | u16 capability; |
| 687 | u8 *ext_capab; | 676 | const u8 *ext_capab; |
| 688 | u8 ext_capab_len; | 677 | u8 ext_capab_len; |
| 689 | }; | 678 | }; |
| 690 | 679 | ||
| 691 | /** | 680 | /** |
| 681 | * enum cfg80211_station_type - the type of station being modified | ||
| 682 | * @CFG80211_STA_AP_CLIENT: client of an AP interface | ||
| 683 | * @CFG80211_STA_AP_MLME_CLIENT: client of an AP interface that has | ||
| 684 | * the AP MLME in the device | ||
| 685 | * @CFG80211_STA_AP_STA: AP station on managed interface | ||
| 686 | * @CFG80211_STA_IBSS: IBSS station | ||
| 687 | * @CFG80211_STA_TDLS_PEER_SETUP: TDLS peer on managed interface (dummy entry | ||
| 688 | * while TDLS setup is in progress, it moves out of this state when | ||
| 689 | * being marked authorized; use this only if TDLS with external setup is | ||
| 690 | * supported/used) | ||
| 691 | * @CFG80211_STA_TDLS_PEER_ACTIVE: TDLS peer on managed interface (active | ||
| 692 | * entry that is operating, has been marked authorized by userspace) | ||
| 693 | * @CFG80211_STA_MESH_PEER_KERNEL: peer on mesh interface (kernel managed) | ||
| 694 | * @CFG80211_STA_MESH_PEER_USER: peer on mesh interface (user managed) | ||
| 695 | */ | ||
| 696 | enum cfg80211_station_type { | ||
| 697 | CFG80211_STA_AP_CLIENT, | ||
| 698 | CFG80211_STA_AP_MLME_CLIENT, | ||
| 699 | CFG80211_STA_AP_STA, | ||
| 700 | CFG80211_STA_IBSS, | ||
| 701 | CFG80211_STA_TDLS_PEER_SETUP, | ||
| 702 | CFG80211_STA_TDLS_PEER_ACTIVE, | ||
| 703 | CFG80211_STA_MESH_PEER_KERNEL, | ||
| 704 | CFG80211_STA_MESH_PEER_USER, | ||
| 705 | }; | ||
| 706 | |||
| 707 | /** | ||
| 708 | * cfg80211_check_station_change - validate parameter changes | ||
| 709 | * @wiphy: the wiphy this operates on | ||
| 710 | * @params: the new parameters for a station | ||
| 711 | * @statype: the type of station being modified | ||
| 712 | * | ||
| 713 | * Utility function for the @change_station driver method. Call this function | ||
| 714 | * with the appropriate station type looking up the station (and checking that | ||
| 715 | * it exists). It will verify whether the station change is acceptable, and if | ||
| 716 | * not will return an error code. Note that it may modify the parameters for | ||
| 717 | * backward compatibility reasons, so don't use them before calling this. | ||
| 718 | */ | ||
| 719 | int cfg80211_check_station_change(struct wiphy *wiphy, | ||
| 720 | struct station_parameters *params, | ||
| 721 | enum cfg80211_station_type statype); | ||
| 722 | |||
| 723 | /** | ||
| 692 | * enum station_info_flags - station information flags | 724 | * enum station_info_flags - station information flags |
| 693 | * | 725 | * |
| 694 | * Used by the driver to indicate which info in &struct station_info | 726 | * Used by the driver to indicate which info in &struct station_info |
| @@ -1119,6 +1151,7 @@ struct mesh_config { | |||
| 1119 | * @ie_len: length of vendor information elements | 1151 | * @ie_len: length of vendor information elements |
| 1120 | * @is_authenticated: this mesh requires authentication | 1152 | * @is_authenticated: this mesh requires authentication |
| 1121 | * @is_secure: this mesh uses security | 1153 | * @is_secure: this mesh uses security |
| 1154 | * @user_mpm: userspace handles all MPM functions | ||
| 1122 | * @dtim_period: DTIM period to use | 1155 | * @dtim_period: DTIM period to use |
| 1123 | * @beacon_interval: beacon interval to use | 1156 | * @beacon_interval: beacon interval to use |
| 1124 | * @mcast_rate: multicat rate for Mesh Node [6Mbps is the default for 802.11a] | 1157 | * @mcast_rate: multicat rate for Mesh Node [6Mbps is the default for 802.11a] |
| @@ -1136,6 +1169,7 @@ struct mesh_setup { | |||
| 1136 | u8 ie_len; | 1169 | u8 ie_len; |
| 1137 | bool is_authenticated; | 1170 | bool is_authenticated; |
| 1138 | bool is_secure; | 1171 | bool is_secure; |
| 1172 | bool user_mpm; | ||
| 1139 | u8 dtim_period; | 1173 | u8 dtim_period; |
| 1140 | u16 beacon_interval; | 1174 | u16 beacon_interval; |
| 1141 | int mcast_rate[IEEE80211_NUM_BANDS]; | 1175 | int mcast_rate[IEEE80211_NUM_BANDS]; |
| @@ -1398,9 +1432,11 @@ struct cfg80211_auth_request { | |||
| 1398 | * enum cfg80211_assoc_req_flags - Over-ride default behaviour in association. | 1432 | * enum cfg80211_assoc_req_flags - Over-ride default behaviour in association. |
| 1399 | * | 1433 | * |
| 1400 | * @ASSOC_REQ_DISABLE_HT: Disable HT (802.11n) | 1434 | * @ASSOC_REQ_DISABLE_HT: Disable HT (802.11n) |
| 1435 | * @ASSOC_REQ_DISABLE_VHT: Disable VHT | ||
| 1401 | */ | 1436 | */ |
| 1402 | enum cfg80211_assoc_req_flags { | 1437 | enum cfg80211_assoc_req_flags { |
| 1403 | ASSOC_REQ_DISABLE_HT = BIT(0), | 1438 | ASSOC_REQ_DISABLE_HT = BIT(0), |
| 1439 | ASSOC_REQ_DISABLE_VHT = BIT(1), | ||
| 1404 | }; | 1440 | }; |
| 1405 | 1441 | ||
| 1406 | /** | 1442 | /** |
| @@ -1422,6 +1458,8 @@ enum cfg80211_assoc_req_flags { | |||
| 1422 | * @ht_capa: HT Capabilities over-rides. Values set in ht_capa_mask | 1458 | * @ht_capa: HT Capabilities over-rides. Values set in ht_capa_mask |
| 1423 | * will be used in ht_capa. Un-supported values will be ignored. | 1459 | * will be used in ht_capa. Un-supported values will be ignored. |
| 1424 | * @ht_capa_mask: The bits of ht_capa which are to be used. | 1460 | * @ht_capa_mask: The bits of ht_capa which are to be used. |
| 1461 | * @vht_capa: VHT capability override | ||
| 1462 | * @vht_capa_mask: VHT capability mask indicating which fields to use | ||
| 1425 | */ | 1463 | */ |
| 1426 | struct cfg80211_assoc_request { | 1464 | struct cfg80211_assoc_request { |
| 1427 | struct cfg80211_bss *bss; | 1465 | struct cfg80211_bss *bss; |
| @@ -1432,6 +1470,7 @@ struct cfg80211_assoc_request { | |||
| 1432 | u32 flags; | 1470 | u32 flags; |
| 1433 | struct ieee80211_ht_cap ht_capa; | 1471 | struct ieee80211_ht_cap ht_capa; |
| 1434 | struct ieee80211_ht_cap ht_capa_mask; | 1472 | struct ieee80211_ht_cap ht_capa_mask; |
| 1473 | struct ieee80211_vht_cap vht_capa, vht_capa_mask; | ||
| 1435 | }; | 1474 | }; |
| 1436 | 1475 | ||
| 1437 | /** | 1476 | /** |
| @@ -1542,6 +1581,8 @@ struct cfg80211_ibss_params { | |||
| 1542 | * @ht_capa: HT Capabilities over-rides. Values set in ht_capa_mask | 1581 | * @ht_capa: HT Capabilities over-rides. Values set in ht_capa_mask |
| 1543 | * will be used in ht_capa. Un-supported values will be ignored. | 1582 | * will be used in ht_capa. Un-supported values will be ignored. |
| 1544 | * @ht_capa_mask: The bits of ht_capa which are to be used. | 1583 | * @ht_capa_mask: The bits of ht_capa which are to be used. |
| 1584 | * @vht_capa: VHT Capability overrides | ||
| 1585 | * @vht_capa_mask: The bits of vht_capa which are to be used. | ||
| 1545 | */ | 1586 | */ |
| 1546 | struct cfg80211_connect_params { | 1587 | struct cfg80211_connect_params { |
| 1547 | struct ieee80211_channel *channel; | 1588 | struct ieee80211_channel *channel; |
| @@ -1560,6 +1601,8 @@ struct cfg80211_connect_params { | |||
| 1560 | int bg_scan_period; | 1601 | int bg_scan_period; |
| 1561 | struct ieee80211_ht_cap ht_capa; | 1602 | struct ieee80211_ht_cap ht_capa; |
| 1562 | struct ieee80211_ht_cap ht_capa_mask; | 1603 | struct ieee80211_ht_cap ht_capa_mask; |
| 1604 | struct ieee80211_vht_cap vht_capa; | ||
| 1605 | struct ieee80211_vht_cap vht_capa_mask; | ||
| 1563 | }; | 1606 | }; |
| 1564 | 1607 | ||
| 1565 | /** | 1608 | /** |
| @@ -1722,6 +1765,21 @@ struct cfg80211_gtk_rekey_data { | |||
| 1722 | }; | 1765 | }; |
| 1723 | 1766 | ||
| 1724 | /** | 1767 | /** |
| 1768 | * struct cfg80211_update_ft_ies_params - FT IE Information | ||
| 1769 | * | ||
| 1770 | * This structure provides information needed to update the fast transition IE | ||
| 1771 | * | ||
| 1772 | * @md: The Mobility Domain ID, 2 Octet value | ||
| 1773 | * @ie: Fast Transition IEs | ||
| 1774 | * @ie_len: Length of ft_ie in octets | ||
| 1775 | */ | ||
| 1776 | struct cfg80211_update_ft_ies_params { | ||
| 1777 | u16 md; | ||
| 1778 | const u8 *ie; | ||
| 1779 | size_t ie_len; | ||
| 1780 | }; | ||
| 1781 | |||
| 1782 | /** | ||
| 1725 | * struct cfg80211_ops - backend description for wireless configuration | 1783 | * struct cfg80211_ops - backend description for wireless configuration |
| 1726 | * | 1784 | * |
| 1727 | * This struct is registered by fullmac card drivers and/or wireless stacks | 1785 | * This struct is registered by fullmac card drivers and/or wireless stacks |
| @@ -1781,9 +1839,8 @@ struct cfg80211_gtk_rekey_data { | |||
| 1781 | * @change_station: Modify a given station. Note that flags changes are not much | 1839 | * @change_station: Modify a given station. Note that flags changes are not much |
| 1782 | * validated in cfg80211, in particular the auth/assoc/authorized flags | 1840 | * validated in cfg80211, in particular the auth/assoc/authorized flags |
| 1783 | * might come to the driver in invalid combinations -- make sure to check | 1841 | * might come to the driver in invalid combinations -- make sure to check |
| 1784 | * them, also against the existing state! Also, supported_rates changes are | 1842 | * them, also against the existing state! Drivers must call |
| 1785 | * not checked in station mode -- drivers need to reject (or ignore) them | 1843 | * cfg80211_check_station_change() to validate the information. |
| 1786 | * for anything but TDLS peers. | ||
| 1787 | * @get_station: get station information for the station identified by @mac | 1844 | * @get_station: get station information for the station identified by @mac |
| 1788 | * @dump_station: dump station callback -- resume dump at index @idx | 1845 | * @dump_station: dump station callback -- resume dump at index @idx |
| 1789 | * | 1846 | * |
| @@ -1941,6 +1998,16 @@ struct cfg80211_gtk_rekey_data { | |||
| 1941 | * advertise the support for MAC based ACL have to implement this callback. | 1998 | * advertise the support for MAC based ACL have to implement this callback. |
| 1942 | * | 1999 | * |
| 1943 | * @start_radar_detection: Start radar detection in the driver. | 2000 | * @start_radar_detection: Start radar detection in the driver. |
| 2001 | * | ||
| 2002 | * @update_ft_ies: Provide updated Fast BSS Transition information to the | ||
| 2003 | * driver. If the SME is in the driver/firmware, this information can be | ||
| 2004 | * used in building Authentication and Reassociation Request frames. | ||
| 2005 | * | ||
| 2006 | * @crit_proto_start: Indicates a critical protocol needs more link reliability | ||
| 2007 | * for a given duration (milliseconds). The protocol is provided so the | ||
| 2008 | * driver can take the most appropriate actions. | ||
| 2009 | * @crit_proto_stop: Indicates critical protocol no longer needs increased link | ||
| 2010 | * reliability. This operation can not fail. | ||
| 1944 | */ | 2011 | */ |
| 1945 | struct cfg80211_ops { | 2012 | struct cfg80211_ops { |
| 1946 | int (*suspend)(struct wiphy *wiphy, struct cfg80211_wowlan *wow); | 2013 | int (*suspend)(struct wiphy *wiphy, struct cfg80211_wowlan *wow); |
| @@ -2168,6 +2235,14 @@ struct cfg80211_ops { | |||
| 2168 | int (*start_radar_detection)(struct wiphy *wiphy, | 2235 | int (*start_radar_detection)(struct wiphy *wiphy, |
| 2169 | struct net_device *dev, | 2236 | struct net_device *dev, |
| 2170 | struct cfg80211_chan_def *chandef); | 2237 | struct cfg80211_chan_def *chandef); |
| 2238 | int (*update_ft_ies)(struct wiphy *wiphy, struct net_device *dev, | ||
| 2239 | struct cfg80211_update_ft_ies_params *ftie); | ||
| 2240 | int (*crit_proto_start)(struct wiphy *wiphy, | ||
| 2241 | struct wireless_dev *wdev, | ||
| 2242 | enum nl80211_crit_proto_id protocol, | ||
| 2243 | u16 duration); | ||
| 2244 | void (*crit_proto_stop)(struct wiphy *wiphy, | ||
| 2245 | struct wireless_dev *wdev); | ||
| 2171 | }; | 2246 | }; |
| 2172 | 2247 | ||
| 2173 | /* | 2248 | /* |
| @@ -2485,6 +2560,8 @@ struct wiphy_wowlan_support { | |||
| 2485 | * @ap_sme_capa: AP SME capabilities, flags from &enum nl80211_ap_sme_features. | 2560 | * @ap_sme_capa: AP SME capabilities, flags from &enum nl80211_ap_sme_features. |
| 2486 | * @ht_capa_mod_mask: Specify what ht_cap values can be over-ridden. | 2561 | * @ht_capa_mod_mask: Specify what ht_cap values can be over-ridden. |
| 2487 | * If null, then none can be over-ridden. | 2562 | * If null, then none can be over-ridden. |
| 2563 | * @vht_capa_mod_mask: Specify what VHT capabilities can be over-ridden. | ||
| 2564 | * If null, then none can be over-ridden. | ||
| 2488 | * | 2565 | * |
| 2489 | * @max_acl_mac_addrs: Maximum number of MAC addresses that the device | 2566 | * @max_acl_mac_addrs: Maximum number of MAC addresses that the device |
| 2490 | * supports for ACL. | 2567 | * supports for ACL. |
| @@ -2593,6 +2670,7 @@ struct wiphy { | |||
| 2593 | struct dentry *debugfsdir; | 2670 | struct dentry *debugfsdir; |
| 2594 | 2671 | ||
| 2595 | const struct ieee80211_ht_cap *ht_capa_mod_mask; | 2672 | const struct ieee80211_ht_cap *ht_capa_mod_mask; |
| 2673 | const struct ieee80211_vht_cap *vht_capa_mod_mask; | ||
| 2596 | 2674 | ||
| 2597 | #ifdef CONFIG_NET_NS | 2675 | #ifdef CONFIG_NET_NS |
| 2598 | /* the network namespace this phy lives in currently */ | 2676 | /* the network namespace this phy lives in currently */ |
| @@ -3958,6 +4036,17 @@ bool cfg80211_reg_can_beacon(struct wiphy *wiphy, | |||
| 3958 | void cfg80211_ch_switch_notify(struct net_device *dev, | 4036 | void cfg80211_ch_switch_notify(struct net_device *dev, |
| 3959 | struct cfg80211_chan_def *chandef); | 4037 | struct cfg80211_chan_def *chandef); |
| 3960 | 4038 | ||
| 4039 | /** | ||
| 4040 | * ieee80211_operating_class_to_band - convert operating class to band | ||
| 4041 | * | ||
| 4042 | * @operating_class: the operating class to convert | ||
| 4043 | * @band: band pointer to fill | ||
| 4044 | * | ||
| 4045 | * Returns %true if the conversion was successful, %false otherwise. | ||
| 4046 | */ | ||
| 4047 | bool ieee80211_operating_class_to_band(u8 operating_class, | ||
| 4048 | enum ieee80211_band *band); | ||
| 4049 | |||
| 3961 | /* | 4050 | /* |
| 3962 | * cfg80211_tdls_oper_request - request userspace to perform TDLS operation | 4051 | * cfg80211_tdls_oper_request - request userspace to perform TDLS operation |
| 3963 | * @dev: the device on which the operation is requested | 4052 | * @dev: the device on which the operation is requested |
| @@ -4002,6 +4091,30 @@ u32 cfg80211_calculate_bitrate(struct rate_info *rate); | |||
| 4002 | void cfg80211_unregister_wdev(struct wireless_dev *wdev); | 4091 | void cfg80211_unregister_wdev(struct wireless_dev *wdev); |
| 4003 | 4092 | ||
| 4004 | /** | 4093 | /** |
| 4094 | * struct cfg80211_ft_event - FT Information Elements | ||
| 4095 | * @ies: FT IEs | ||
| 4096 | * @ies_len: length of the FT IE in bytes | ||
| 4097 | * @target_ap: target AP's MAC address | ||
| 4098 | * @ric_ies: RIC IE | ||
| 4099 | * @ric_ies_len: length of the RIC IE in bytes | ||
| 4100 | */ | ||
| 4101 | struct cfg80211_ft_event_params { | ||
| 4102 | const u8 *ies; | ||
| 4103 | size_t ies_len; | ||
| 4104 | const u8 *target_ap; | ||
| 4105 | const u8 *ric_ies; | ||
| 4106 | size_t ric_ies_len; | ||
| 4107 | }; | ||
| 4108 | |||
| 4109 | /** | ||
| 4110 | * cfg80211_ft_event - notify userspace about FT IE and RIC IE | ||
| 4111 | * @netdev: network device | ||
| 4112 | * @ft_event: IE information | ||
| 4113 | */ | ||
| 4114 | void cfg80211_ft_event(struct net_device *netdev, | ||
| 4115 | struct cfg80211_ft_event_params *ft_event); | ||
| 4116 | |||
| 4117 | /** | ||
| 4005 | * cfg80211_get_p2p_attr - find and copy a P2P attribute from IE buffer | 4118 | * cfg80211_get_p2p_attr - find and copy a P2P attribute from IE buffer |
| 4006 | * @ies: the input IE buffer | 4119 | * @ies: the input IE buffer |
| 4007 | * @len: the input length | 4120 | * @len: the input length |
| @@ -4036,6 +4149,17 @@ void cfg80211_report_wowlan_wakeup(struct wireless_dev *wdev, | |||
| 4036 | struct cfg80211_wowlan_wakeup *wakeup, | 4149 | struct cfg80211_wowlan_wakeup *wakeup, |
| 4037 | gfp_t gfp); | 4150 | gfp_t gfp); |
| 4038 | 4151 | ||
| 4152 | /** | ||
| 4153 | * cfg80211_crit_proto_stopped() - indicate critical protocol stopped by driver. | ||
| 4154 | * | ||
| 4155 | * @wdev: the wireless device for which critical protocol is stopped. | ||
| 4156 | * | ||
| 4157 | * This function can be called by the driver to indicate it has reverted | ||
| 4158 | * operation back to normal. One reason could be that the duration given | ||
| 4159 | * by .crit_proto_start() has expired. | ||
| 4160 | */ | ||
| 4161 | void cfg80211_crit_proto_stopped(struct wireless_dev *wdev, gfp_t gfp); | ||
| 4162 | |||
| 4039 | /* Logging, debugging and troubleshooting/diagnostic helpers. */ | 4163 | /* Logging, debugging and troubleshooting/diagnostic helpers. */ |
| 4040 | 4164 | ||
| 4041 | /* wiphy_printk helpers, similar to dev_printk */ | 4165 | /* wiphy_printk helpers, similar to dev_printk */ |
diff --git a/include/net/cls_cgroup.h b/include/net/cls_cgroup.h index 2581638f4a3d..0fee0617fb7d 100644 --- a/include/net/cls_cgroup.h +++ b/include/net/cls_cgroup.h | |||
| @@ -24,7 +24,7 @@ struct cgroup_cls_state | |||
| 24 | u32 classid; | 24 | u32 classid; |
| 25 | }; | 25 | }; |
| 26 | 26 | ||
| 27 | extern void sock_update_classid(struct sock *sk, struct task_struct *task); | 27 | extern void sock_update_classid(struct sock *sk); |
| 28 | 28 | ||
| 29 | #if IS_BUILTIN(CONFIG_NET_CLS_CGROUP) | 29 | #if IS_BUILTIN(CONFIG_NET_CLS_CGROUP) |
| 30 | static inline u32 task_cls_classid(struct task_struct *p) | 30 | static inline u32 task_cls_classid(struct task_struct *p) |
| @@ -61,7 +61,7 @@ static inline u32 task_cls_classid(struct task_struct *p) | |||
| 61 | } | 61 | } |
| 62 | #endif | 62 | #endif |
| 63 | #else /* !CGROUP_NET_CLS_CGROUP */ | 63 | #else /* !CGROUP_NET_CLS_CGROUP */ |
| 64 | static inline void sock_update_classid(struct sock *sk, struct task_struct *task) | 64 | static inline void sock_update_classid(struct sock *sk) |
| 65 | { | 65 | { |
| 66 | } | 66 | } |
| 67 | 67 | ||
diff --git a/include/net/dn_fib.h b/include/net/dn_fib.h index 1ee9d4bda30d..74004af31c48 100644 --- a/include/net/dn_fib.h +++ b/include/net/dn_fib.h | |||
| @@ -1,24 +1,9 @@ | |||
| 1 | #ifndef _NET_DN_FIB_H | 1 | #ifndef _NET_DN_FIB_H |
| 2 | #define _NET_DN_FIB_H | 2 | #define _NET_DN_FIB_H |
| 3 | 3 | ||
| 4 | /* WARNING: The ordering of these elements must match ordering | 4 | #include <linux/netlink.h> |
| 5 | * of RTA_* rtnetlink attribute numbers. | 5 | |
| 6 | */ | 6 | extern const struct nla_policy rtm_dn_policy[]; |
| 7 | struct dn_kern_rta { | ||
| 8 | void *rta_dst; | ||
| 9 | void *rta_src; | ||
| 10 | int *rta_iif; | ||
| 11 | int *rta_oif; | ||
| 12 | void *rta_gw; | ||
| 13 | u32 *rta_priority; | ||
| 14 | void *rta_prefsrc; | ||
| 15 | struct rtattr *rta_mx; | ||
| 16 | struct rtattr *rta_mp; | ||
| 17 | unsigned char *rta_protoinfo; | ||
| 18 | u32 *rta_flow; | ||
| 19 | struct rta_cacheinfo *rta_ci; | ||
| 20 | struct rta_session *rta_sess; | ||
| 21 | }; | ||
| 22 | 7 | ||
| 23 | struct dn_fib_res { | 8 | struct dn_fib_res { |
| 24 | struct fib_rule *r; | 9 | struct fib_rule *r; |
| @@ -93,10 +78,10 @@ struct dn_fib_table { | |||
| 93 | u32 n; | 78 | u32 n; |
| 94 | 79 | ||
| 95 | int (*insert)(struct dn_fib_table *t, struct rtmsg *r, | 80 | int (*insert)(struct dn_fib_table *t, struct rtmsg *r, |
| 96 | struct dn_kern_rta *rta, struct nlmsghdr *n, | 81 | struct nlattr *attrs[], struct nlmsghdr *n, |
| 97 | struct netlink_skb_parms *req); | 82 | struct netlink_skb_parms *req); |
| 98 | int (*delete)(struct dn_fib_table *t, struct rtmsg *r, | 83 | int (*delete)(struct dn_fib_table *t, struct rtmsg *r, |
| 99 | struct dn_kern_rta *rta, struct nlmsghdr *n, | 84 | struct nlattr *attrs[], struct nlmsghdr *n, |
| 100 | struct netlink_skb_parms *req); | 85 | struct netlink_skb_parms *req); |
| 101 | int (*lookup)(struct dn_fib_table *t, const struct flowidn *fld, | 86 | int (*lookup)(struct dn_fib_table *t, const struct flowidn *fld, |
| 102 | struct dn_fib_res *res); | 87 | struct dn_fib_res *res); |
| @@ -116,13 +101,12 @@ extern void dn_fib_cleanup(void); | |||
| 116 | extern int dn_fib_ioctl(struct socket *sock, unsigned int cmd, | 101 | extern int dn_fib_ioctl(struct socket *sock, unsigned int cmd, |
| 117 | unsigned long arg); | 102 | unsigned long arg); |
| 118 | extern struct dn_fib_info *dn_fib_create_info(const struct rtmsg *r, | 103 | extern struct dn_fib_info *dn_fib_create_info(const struct rtmsg *r, |
| 119 | struct dn_kern_rta *rta, | 104 | struct nlattr *attrs[], |
| 120 | const struct nlmsghdr *nlh, int *errp); | 105 | const struct nlmsghdr *nlh, int *errp); |
| 121 | extern int dn_fib_semantic_match(int type, struct dn_fib_info *fi, | 106 | extern int dn_fib_semantic_match(int type, struct dn_fib_info *fi, |
| 122 | const struct flowidn *fld, | 107 | const struct flowidn *fld, |
| 123 | struct dn_fib_res *res); | 108 | struct dn_fib_res *res); |
| 124 | extern void dn_fib_release_info(struct dn_fib_info *fi); | 109 | extern void dn_fib_release_info(struct dn_fib_info *fi); |
| 125 | extern __le16 dn_fib_get_attr16(struct rtattr *attr, int attrlen, int type); | ||
| 126 | extern void dn_fib_flush(void); | 110 | extern void dn_fib_flush(void); |
| 127 | extern void dn_fib_select_multipath(const struct flowidn *fld, | 111 | extern void dn_fib_select_multipath(const struct flowidn *fld, |
| 128 | struct dn_fib_res *res); | 112 | struct dn_fib_res *res); |
diff --git a/include/net/firewire.h b/include/net/firewire.h new file mode 100644 index 000000000000..31bcbfe7a220 --- /dev/null +++ b/include/net/firewire.h | |||
| @@ -0,0 +1,25 @@ | |||
| 1 | #ifndef _NET_FIREWIRE_H | ||
| 2 | #define _NET_FIREWIRE_H | ||
| 3 | |||
| 4 | /* Pseudo L2 address */ | ||
| 5 | #define FWNET_ALEN 16 | ||
| 6 | union fwnet_hwaddr { | ||
| 7 | u8 u[FWNET_ALEN]; | ||
| 8 | /* "Hardware address" defined in RFC2734/RF3146 */ | ||
| 9 | struct { | ||
| 10 | __be64 uniq_id; /* EUI-64 */ | ||
| 11 | u8 max_rec; /* max packet size */ | ||
| 12 | u8 sspd; /* max speed */ | ||
| 13 | __be16 fifo_hi; /* hi 16bits of FIFO addr */ | ||
| 14 | __be32 fifo_lo; /* lo 32bits of FIFO addr */ | ||
| 15 | } __packed uc; | ||
| 16 | }; | ||
| 17 | |||
| 18 | /* Pseudo L2 Header */ | ||
| 19 | #define FWNET_HLEN 18 | ||
| 20 | struct fwnet_header { | ||
| 21 | u8 h_dest[FWNET_ALEN]; /* destination address */ | ||
| 22 | __be16 h_proto; /* packet type ID field */ | ||
| 23 | } __packed; | ||
| 24 | |||
| 25 | #endif | ||
diff --git a/include/net/genetlink.h b/include/net/genetlink.h index bdfbe68c1c3b..93024a47e0e2 100644 --- a/include/net/genetlink.h +++ b/include/net/genetlink.h | |||
| @@ -50,6 +50,7 @@ struct genl_family { | |||
| 50 | unsigned int version; | 50 | unsigned int version; |
| 51 | unsigned int maxattr; | 51 | unsigned int maxattr; |
| 52 | bool netnsok; | 52 | bool netnsok; |
| 53 | bool parallel_ops; | ||
| 53 | int (*pre_doit)(struct genl_ops *ops, | 54 | int (*pre_doit)(struct genl_ops *ops, |
| 54 | struct sk_buff *skb, | 55 | struct sk_buff *skb, |
| 55 | struct genl_info *info); | 56 | struct genl_info *info); |
diff --git a/include/net/gre.h b/include/net/gre.h index 82665474bcb7..9f03a390c826 100644 --- a/include/net/gre.h +++ b/include/net/gre.h | |||
| @@ -2,6 +2,7 @@ | |||
| 2 | #define __LINUX_GRE_H | 2 | #define __LINUX_GRE_H |
| 3 | 3 | ||
| 4 | #include <linux/skbuff.h> | 4 | #include <linux/skbuff.h> |
| 5 | #include <net/ip_tunnels.h> | ||
| 5 | 6 | ||
| 6 | #define GREPROTO_CISCO 0 | 7 | #define GREPROTO_CISCO 0 |
| 7 | #define GREPROTO_PPTP 1 | 8 | #define GREPROTO_PPTP 1 |
| @@ -12,7 +13,57 @@ struct gre_protocol { | |||
| 12 | void (*err_handler)(struct sk_buff *skb, u32 info); | 13 | void (*err_handler)(struct sk_buff *skb, u32 info); |
| 13 | }; | 14 | }; |
| 14 | 15 | ||
| 16 | struct gre_base_hdr { | ||
| 17 | __be16 flags; | ||
| 18 | __be16 protocol; | ||
| 19 | }; | ||
| 20 | #define GRE_HEADER_SECTION 4 | ||
| 21 | |||
| 15 | int gre_add_protocol(const struct gre_protocol *proto, u8 version); | 22 | int gre_add_protocol(const struct gre_protocol *proto, u8 version); |
| 16 | int gre_del_protocol(const struct gre_protocol *proto, u8 version); | 23 | int gre_del_protocol(const struct gre_protocol *proto, u8 version); |
| 17 | 24 | ||
| 25 | static inline __be16 gre_flags_to_tnl_flags(__be16 flags) | ||
| 26 | { | ||
| 27 | __be16 tflags = 0; | ||
| 28 | |||
| 29 | if (flags & GRE_CSUM) | ||
| 30 | tflags |= TUNNEL_CSUM; | ||
| 31 | if (flags & GRE_ROUTING) | ||
| 32 | tflags |= TUNNEL_ROUTING; | ||
| 33 | if (flags & GRE_KEY) | ||
| 34 | tflags |= TUNNEL_KEY; | ||
| 35 | if (flags & GRE_SEQ) | ||
| 36 | tflags |= TUNNEL_SEQ; | ||
| 37 | if (flags & GRE_STRICT) | ||
| 38 | tflags |= TUNNEL_STRICT; | ||
| 39 | if (flags & GRE_REC) | ||
| 40 | tflags |= TUNNEL_REC; | ||
| 41 | if (flags & GRE_VERSION) | ||
| 42 | tflags |= TUNNEL_VERSION; | ||
| 43 | |||
| 44 | return tflags; | ||
| 45 | } | ||
| 46 | |||
| 47 | static inline __be16 tnl_flags_to_gre_flags(__be16 tflags) | ||
| 48 | { | ||
| 49 | __be16 flags = 0; | ||
| 50 | |||
| 51 | if (tflags & TUNNEL_CSUM) | ||
| 52 | flags |= GRE_CSUM; | ||
| 53 | if (tflags & TUNNEL_ROUTING) | ||
| 54 | flags |= GRE_ROUTING; | ||
| 55 | if (tflags & TUNNEL_KEY) | ||
| 56 | flags |= GRE_KEY; | ||
| 57 | if (tflags & TUNNEL_SEQ) | ||
| 58 | flags |= GRE_SEQ; | ||
| 59 | if (tflags & TUNNEL_STRICT) | ||
| 60 | flags |= GRE_STRICT; | ||
| 61 | if (tflags & TUNNEL_REC) | ||
| 62 | flags |= GRE_REC; | ||
| 63 | if (tflags & TUNNEL_VERSION) | ||
| 64 | flags |= GRE_VERSION; | ||
| 65 | |||
| 66 | return flags; | ||
| 67 | } | ||
| 68 | |||
| 18 | #endif | 69 | #endif |
diff --git a/include/net/ieee802154_netdev.h b/include/net/ieee802154_netdev.h index d104c882fc29..8196d5d40359 100644 --- a/include/net/ieee802154_netdev.h +++ b/include/net/ieee802154_netdev.h | |||
| @@ -85,6 +85,8 @@ struct wpan_phy; | |||
| 85 | * Use wpan_wpy_put to put that reference. | 85 | * Use wpan_wpy_put to put that reference. |
| 86 | */ | 86 | */ |
| 87 | struct ieee802154_mlme_ops { | 87 | struct ieee802154_mlme_ops { |
| 88 | /* The following fields are optional (can be NULL). */ | ||
| 89 | |||
| 88 | int (*assoc_req)(struct net_device *dev, | 90 | int (*assoc_req)(struct net_device *dev, |
| 89 | struct ieee802154_addr *addr, | 91 | struct ieee802154_addr *addr, |
| 90 | u8 channel, u8 page, u8 cap); | 92 | u8 channel, u8 page, u8 cap); |
| @@ -101,6 +103,8 @@ struct ieee802154_mlme_ops { | |||
| 101 | int (*scan_req)(struct net_device *dev, | 103 | int (*scan_req)(struct net_device *dev, |
| 102 | u8 type, u32 channels, u8 page, u8 duration); | 104 | u8 type, u32 channels, u8 page, u8 duration); |
| 103 | 105 | ||
| 106 | /* The fields below are required. */ | ||
| 107 | |||
| 104 | struct wpan_phy *(*get_phy)(const struct net_device *dev); | 108 | struct wpan_phy *(*get_phy)(const struct net_device *dev); |
| 105 | 109 | ||
| 106 | /* | 110 | /* |
| @@ -110,7 +114,6 @@ struct ieee802154_mlme_ops { | |||
| 110 | u16 (*get_pan_id)(const struct net_device *dev); | 114 | u16 (*get_pan_id)(const struct net_device *dev); |
| 111 | u16 (*get_short_addr)(const struct net_device *dev); | 115 | u16 (*get_short_addr)(const struct net_device *dev); |
| 112 | u8 (*get_dsn)(const struct net_device *dev); | 116 | u8 (*get_dsn)(const struct net_device *dev); |
| 113 | u8 (*get_bsn)(const struct net_device *dev); | ||
| 114 | }; | 117 | }; |
| 115 | 118 | ||
| 116 | /* The IEEE 802.15.4 standard defines 2 type of the devices: | 119 | /* The IEEE 802.15.4 standard defines 2 type of the devices: |
diff --git a/include/net/if_inet6.h b/include/net/if_inet6.h index 93563221d29a..100fb8cec17c 100644 --- a/include/net/if_inet6.h +++ b/include/net/if_inet6.h | |||
| @@ -71,6 +71,8 @@ struct inet6_ifaddr { | |||
| 71 | struct inet6_ifaddr *ifpub; | 71 | struct inet6_ifaddr *ifpub; |
| 72 | int regen_count; | 72 | int regen_count; |
| 73 | #endif | 73 | #endif |
| 74 | bool tokenized; | ||
| 75 | |||
| 74 | struct rcu_head rcu; | 76 | struct rcu_head rcu; |
| 75 | }; | 77 | }; |
| 76 | 78 | ||
| @@ -187,6 +189,8 @@ struct inet6_dev { | |||
| 187 | struct list_head tempaddr_list; | 189 | struct list_head tempaddr_list; |
| 188 | #endif | 190 | #endif |
| 189 | 191 | ||
| 192 | struct in6_addr token; | ||
| 193 | |||
| 190 | struct neigh_parms *nd_parms; | 194 | struct neigh_parms *nd_parms; |
| 191 | struct inet6_dev *next; | 195 | struct inet6_dev *next; |
| 192 | struct ipv6_devconf cnf; | 196 | struct ipv6_devconf cnf; |
diff --git a/include/net/inet_connection_sock.h b/include/net/inet_connection_sock.h index 183292722f6e..de2c78529afa 100644 --- a/include/net/inet_connection_sock.h +++ b/include/net/inet_connection_sock.h | |||
| @@ -133,6 +133,8 @@ struct inet_connection_sock { | |||
| 133 | #define ICSK_TIME_RETRANS 1 /* Retransmit timer */ | 133 | #define ICSK_TIME_RETRANS 1 /* Retransmit timer */ |
| 134 | #define ICSK_TIME_DACK 2 /* Delayed ack timer */ | 134 | #define ICSK_TIME_DACK 2 /* Delayed ack timer */ |
| 135 | #define ICSK_TIME_PROBE0 3 /* Zero window probe timer */ | 135 | #define ICSK_TIME_PROBE0 3 /* Zero window probe timer */ |
| 136 | #define ICSK_TIME_EARLY_RETRANS 4 /* Early retransmit timer */ | ||
| 137 | #define ICSK_TIME_LOSS_PROBE 5 /* Tail loss probe timer */ | ||
| 136 | 138 | ||
| 137 | static inline struct inet_connection_sock *inet_csk(const struct sock *sk) | 139 | static inline struct inet_connection_sock *inet_csk(const struct sock *sk) |
| 138 | { | 140 | { |
| @@ -222,7 +224,8 @@ static inline void inet_csk_reset_xmit_timer(struct sock *sk, const int what, | |||
| 222 | when = max_when; | 224 | when = max_when; |
| 223 | } | 225 | } |
| 224 | 226 | ||
| 225 | if (what == ICSK_TIME_RETRANS || what == ICSK_TIME_PROBE0) { | 227 | if (what == ICSK_TIME_RETRANS || what == ICSK_TIME_PROBE0 || |
| 228 | what == ICSK_TIME_EARLY_RETRANS || what == ICSK_TIME_LOSS_PROBE) { | ||
| 226 | icsk->icsk_pending = what; | 229 | icsk->icsk_pending = what; |
| 227 | icsk->icsk_timeout = jiffies + when; | 230 | icsk->icsk_timeout = jiffies + when; |
| 228 | sk_reset_timer(sk, &icsk->icsk_retransmit_timer, icsk->icsk_timeout); | 231 | sk_reset_timer(sk, &icsk->icsk_retransmit_timer, icsk->icsk_timeout); |
diff --git a/include/net/inet_frag.h b/include/net/inet_frag.h index 0a1dcc2fa2f5..4182c9be8bb5 100644 --- a/include/net/inet_frag.h +++ b/include/net/inet_frag.h | |||
| @@ -41,7 +41,7 @@ struct inet_frag_queue { | |||
| 41 | struct netns_frags *net; | 41 | struct netns_frags *net; |
| 42 | }; | 42 | }; |
| 43 | 43 | ||
| 44 | #define INETFRAGS_HASHSZ 64 | 44 | #define INETFRAGS_HASHSZ 1024 |
| 45 | 45 | ||
| 46 | /* averaged: | 46 | /* averaged: |
| 47 | * max_depth = default ipfrag_high_thresh / INETFRAGS_HASHSZ / | 47 | * max_depth = default ipfrag_high_thresh / INETFRAGS_HASHSZ / |
| @@ -50,10 +50,16 @@ struct inet_frag_queue { | |||
| 50 | */ | 50 | */ |
| 51 | #define INETFRAGS_MAXDEPTH 128 | 51 | #define INETFRAGS_MAXDEPTH 128 |
| 52 | 52 | ||
| 53 | struct inet_frag_bucket { | ||
| 54 | struct hlist_head chain; | ||
| 55 | spinlock_t chain_lock; | ||
| 56 | }; | ||
| 57 | |||
| 53 | struct inet_frags { | 58 | struct inet_frags { |
| 54 | struct hlist_head hash[INETFRAGS_HASHSZ]; | 59 | struct inet_frag_bucket hash[INETFRAGS_HASHSZ]; |
| 55 | /* This rwlock is a global lock (seperate per IPv4, IPv6 and | 60 | /* This rwlock is a global lock (seperate per IPv4, IPv6 and |
| 56 | * netfilter). Important to keep this on a seperate cacheline. | 61 | * netfilter). Important to keep this on a seperate cacheline. |
| 62 | * Its primarily a rebuild protection rwlock. | ||
| 57 | */ | 63 | */ |
| 58 | rwlock_t lock ____cacheline_aligned_in_smp; | 64 | rwlock_t lock ____cacheline_aligned_in_smp; |
| 59 | int secret_interval; | 65 | int secret_interval; |
| @@ -143,6 +149,7 @@ static inline void inet_frag_lru_del(struct inet_frag_queue *q) | |||
| 143 | { | 149 | { |
| 144 | spin_lock(&q->net->lru_lock); | 150 | spin_lock(&q->net->lru_lock); |
| 145 | list_del(&q->lru_list); | 151 | list_del(&q->lru_list); |
| 152 | q->net->nqueues--; | ||
| 146 | spin_unlock(&q->net->lru_lock); | 153 | spin_unlock(&q->net->lru_lock); |
| 147 | } | 154 | } |
| 148 | 155 | ||
| @@ -151,6 +158,19 @@ static inline void inet_frag_lru_add(struct netns_frags *nf, | |||
| 151 | { | 158 | { |
| 152 | spin_lock(&nf->lru_lock); | 159 | spin_lock(&nf->lru_lock); |
| 153 | list_add_tail(&q->lru_list, &nf->lru_list); | 160 | list_add_tail(&q->lru_list, &nf->lru_list); |
| 161 | q->net->nqueues++; | ||
| 154 | spin_unlock(&nf->lru_lock); | 162 | spin_unlock(&nf->lru_lock); |
| 155 | } | 163 | } |
| 164 | |||
| 165 | /* RFC 3168 support : | ||
| 166 | * We want to check ECN values of all fragments, do detect invalid combinations. | ||
| 167 | * In ipq->ecn, we store the OR value of each ip4_frag_ecn() fragment value. | ||
| 168 | */ | ||
| 169 | #define IPFRAG_ECN_NOT_ECT 0x01 /* one frag had ECN_NOT_ECT */ | ||
| 170 | #define IPFRAG_ECN_ECT_1 0x02 /* one frag had ECN_ECT_1 */ | ||
| 171 | #define IPFRAG_ECN_ECT_0 0x04 /* one frag had ECN_ECT_0 */ | ||
| 172 | #define IPFRAG_ECN_CE 0x08 /* one frag had ECN_CE */ | ||
| 173 | |||
| 174 | extern const u8 ip_frag_ecn_table[16]; | ||
| 175 | |||
| 156 | #endif | 176 | #endif |
diff --git a/include/net/ip6_tunnel.h b/include/net/ip6_tunnel.h index e03047f7090b..4da5de10d1d4 100644 --- a/include/net/ip6_tunnel.h +++ b/include/net/ip6_tunnel.h | |||
| @@ -3,6 +3,7 @@ | |||
| 3 | 3 | ||
| 4 | #include <linux/ipv6.h> | 4 | #include <linux/ipv6.h> |
| 5 | #include <linux/netdevice.h> | 5 | #include <linux/netdevice.h> |
| 6 | #include <linux/if_tunnel.h> | ||
| 6 | #include <linux/ip6_tunnel.h> | 7 | #include <linux/ip6_tunnel.h> |
| 7 | 8 | ||
| 8 | #define IP6TUNNEL_ERR_TIMEO (30*HZ) | 9 | #define IP6TUNNEL_ERR_TIMEO (30*HZ) |
| @@ -68,4 +69,24 @@ __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 | __u32 ip6_tnl_get_cap(struct ip6_tnl *t, const struct in6_addr *laddr, |
| 69 | const struct in6_addr *raddr); | 70 | const struct in6_addr *raddr); |
| 70 | 71 | ||
| 72 | static inline void ip6tunnel_xmit(struct sk_buff *skb, struct net_device *dev) | ||
| 73 | { | ||
| 74 | struct net_device_stats *stats = &dev->stats; | ||
| 75 | int pkt_len, err; | ||
| 76 | |||
| 77 | nf_reset(skb); | ||
| 78 | pkt_len = skb->len; | ||
| 79 | err = ip6_local_out(skb); | ||
| 80 | |||
| 81 | if (net_xmit_eval(err) == 0) { | ||
| 82 | struct pcpu_tstats *tstats = this_cpu_ptr(dev->tstats); | ||
| 83 | u64_stats_update_begin(&tstats->syncp); | ||
| 84 | tstats->tx_bytes += pkt_len; | ||
| 85 | tstats->tx_packets++; | ||
| 86 | u64_stats_update_end(&tstats->syncp); | ||
| 87 | } else { | ||
| 88 | stats->tx_errors++; | ||
| 89 | stats->tx_aborted_errors++; | ||
| 90 | } | ||
| 91 | } | ||
| 71 | #endif | 92 | #endif |
diff --git a/include/net/ip_tunnels.h b/include/net/ip_tunnels.h new file mode 100644 index 000000000000..4b6f0b28f41f --- /dev/null +++ b/include/net/ip_tunnels.h | |||
| @@ -0,0 +1,177 @@ | |||
| 1 | #ifndef __NET_IP_TUNNELS_H | ||
| 2 | #define __NET_IP_TUNNELS_H 1 | ||
| 3 | |||
| 4 | #include <linux/if_tunnel.h> | ||
| 5 | #include <linux/netdevice.h> | ||
| 6 | #include <linux/skbuff.h> | ||
| 7 | #include <linux/types.h> | ||
| 8 | #include <linux/u64_stats_sync.h> | ||
| 9 | #include <net/dsfield.h> | ||
| 10 | #include <net/gro_cells.h> | ||
| 11 | #include <net/inet_ecn.h> | ||
| 12 | #include <net/ip.h> | ||
| 13 | #include <net/rtnetlink.h> | ||
| 14 | |||
| 15 | #if IS_ENABLED(CONFIG_IPV6) | ||
| 16 | #include <net/ipv6.h> | ||
| 17 | #include <net/ip6_fib.h> | ||
| 18 | #include <net/ip6_route.h> | ||
| 19 | #endif | ||
| 20 | |||
| 21 | /* Keep error state on tunnel for 30 sec */ | ||
| 22 | #define IPTUNNEL_ERR_TIMEO (30*HZ) | ||
| 23 | |||
| 24 | /* 6rd prefix/relay information */ | ||
| 25 | #ifdef CONFIG_IPV6_SIT_6RD | ||
| 26 | struct ip_tunnel_6rd_parm { | ||
| 27 | struct in6_addr prefix; | ||
| 28 | __be32 relay_prefix; | ||
| 29 | u16 prefixlen; | ||
| 30 | u16 relay_prefixlen; | ||
| 31 | }; | ||
| 32 | #endif | ||
| 33 | |||
| 34 | struct ip_tunnel_prl_entry { | ||
| 35 | struct ip_tunnel_prl_entry __rcu *next; | ||
| 36 | __be32 addr; | ||
| 37 | u16 flags; | ||
| 38 | struct rcu_head rcu_head; | ||
| 39 | }; | ||
| 40 | |||
| 41 | struct ip_tunnel { | ||
| 42 | struct ip_tunnel __rcu *next; | ||
| 43 | struct hlist_node hash_node; | ||
| 44 | struct net_device *dev; | ||
| 45 | |||
| 46 | int err_count; /* Number of arrived ICMP errors */ | ||
| 47 | unsigned long err_time; /* Time when the last ICMP error | ||
| 48 | * arrived */ | ||
| 49 | |||
| 50 | /* These four fields used only by GRE */ | ||
| 51 | __u32 i_seqno; /* The last seen seqno */ | ||
| 52 | __u32 o_seqno; /* The last output seqno */ | ||
| 53 | int hlen; /* Precalculated header length */ | ||
| 54 | int mlink; | ||
| 55 | |||
| 56 | struct ip_tunnel_parm parms; | ||
| 57 | |||
| 58 | /* for SIT */ | ||
| 59 | #ifdef CONFIG_IPV6_SIT_6RD | ||
| 60 | struct ip_tunnel_6rd_parm ip6rd; | ||
| 61 | #endif | ||
| 62 | struct ip_tunnel_prl_entry __rcu *prl; /* potential router list */ | ||
| 63 | unsigned int prl_count; /* # of entries in PRL */ | ||
| 64 | int ip_tnl_net_id; | ||
| 65 | struct gro_cells gro_cells; | ||
| 66 | }; | ||
| 67 | |||
| 68 | #define TUNNEL_CSUM __cpu_to_be16(0x01) | ||
| 69 | #define TUNNEL_ROUTING __cpu_to_be16(0x02) | ||
| 70 | #define TUNNEL_KEY __cpu_to_be16(0x04) | ||
| 71 | #define TUNNEL_SEQ __cpu_to_be16(0x08) | ||
| 72 | #define TUNNEL_STRICT __cpu_to_be16(0x10) | ||
| 73 | #define TUNNEL_REC __cpu_to_be16(0x20) | ||
| 74 | #define TUNNEL_VERSION __cpu_to_be16(0x40) | ||
| 75 | #define TUNNEL_NO_KEY __cpu_to_be16(0x80) | ||
| 76 | |||
| 77 | struct tnl_ptk_info { | ||
| 78 | __be16 flags; | ||
| 79 | __be16 proto; | ||
| 80 | __be32 key; | ||
| 81 | __be32 seq; | ||
| 82 | }; | ||
| 83 | |||
| 84 | #define PACKET_RCVD 0 | ||
| 85 | #define PACKET_REJECT 1 | ||
| 86 | |||
| 87 | #define IP_TNL_HASH_BITS 10 | ||
| 88 | #define IP_TNL_HASH_SIZE (1 << IP_TNL_HASH_BITS) | ||
| 89 | |||
| 90 | struct ip_tunnel_net { | ||
| 91 | struct hlist_head *tunnels; | ||
| 92 | struct net_device *fb_tunnel_dev; | ||
| 93 | }; | ||
| 94 | |||
| 95 | int ip_tunnel_init(struct net_device *dev); | ||
| 96 | void ip_tunnel_uninit(struct net_device *dev); | ||
| 97 | void ip_tunnel_dellink(struct net_device *dev, struct list_head *head); | ||
| 98 | int __net_init ip_tunnel_init_net(struct net *net, int ip_tnl_net_id, | ||
| 99 | struct rtnl_link_ops *ops, char *devname); | ||
| 100 | |||
| 101 | void __net_exit ip_tunnel_delete_net(struct ip_tunnel_net *itn); | ||
| 102 | |||
| 103 | void ip_tunnel_xmit(struct sk_buff *skb, struct net_device *dev, | ||
| 104 | const struct iphdr *tnl_params); | ||
| 105 | int ip_tunnel_ioctl(struct net_device *dev, struct ip_tunnel_parm *p, int cmd); | ||
| 106 | int ip_tunnel_change_mtu(struct net_device *dev, int new_mtu); | ||
| 107 | |||
| 108 | struct rtnl_link_stats64 *ip_tunnel_get_stats64(struct net_device *dev, | ||
| 109 | struct rtnl_link_stats64 *tot); | ||
| 110 | struct ip_tunnel *ip_tunnel_lookup(struct ip_tunnel_net *itn, | ||
| 111 | int link, __be16 flags, | ||
| 112 | __be32 remote, __be32 local, | ||
| 113 | __be32 key); | ||
| 114 | |||
| 115 | int ip_tunnel_rcv(struct ip_tunnel *tunnel, struct sk_buff *skb, | ||
| 116 | const struct tnl_ptk_info *tpi, bool log_ecn_error); | ||
| 117 | int ip_tunnel_changelink(struct net_device *dev, struct nlattr *tb[], | ||
| 118 | struct ip_tunnel_parm *p); | ||
| 119 | int ip_tunnel_newlink(struct net_device *dev, struct nlattr *tb[], | ||
| 120 | struct ip_tunnel_parm *p); | ||
| 121 | void ip_tunnel_setup(struct net_device *dev, int net_id); | ||
| 122 | |||
| 123 | /* Extract dsfield from inner protocol */ | ||
| 124 | static inline u8 ip_tunnel_get_dsfield(const struct iphdr *iph, | ||
| 125 | const struct sk_buff *skb) | ||
| 126 | { | ||
| 127 | if (skb->protocol == htons(ETH_P_IP)) | ||
| 128 | return iph->tos; | ||
| 129 | else if (skb->protocol == htons(ETH_P_IPV6)) | ||
| 130 | return ipv6_get_dsfield((const struct ipv6hdr *)iph); | ||
| 131 | else | ||
| 132 | return 0; | ||
| 133 | } | ||
| 134 | |||
| 135 | /* Propogate ECN bits out */ | ||
| 136 | static inline u8 ip_tunnel_ecn_encap(u8 tos, const struct iphdr *iph, | ||
| 137 | const struct sk_buff *skb) | ||
| 138 | { | ||
| 139 | u8 inner = ip_tunnel_get_dsfield(iph, skb); | ||
| 140 | |||
| 141 | return INET_ECN_encapsulate(tos, inner); | ||
| 142 | } | ||
| 143 | |||
| 144 | static inline void tunnel_ip_select_ident(struct sk_buff *skb, | ||
| 145 | const struct iphdr *old_iph, | ||
| 146 | struct dst_entry *dst) | ||
| 147 | { | ||
| 148 | struct iphdr *iph = ip_hdr(skb); | ||
| 149 | |||
| 150 | /* Use inner packet iph-id if possible. */ | ||
| 151 | if (skb->protocol == htons(ETH_P_IP) && old_iph->id) | ||
| 152 | iph->id = old_iph->id; | ||
| 153 | else | ||
| 154 | __ip_select_ident(iph, dst, | ||
| 155 | (skb_shinfo(skb)->gso_segs ?: 1) - 1); | ||
| 156 | } | ||
| 157 | |||
| 158 | static inline void iptunnel_xmit(struct sk_buff *skb, struct net_device *dev) | ||
| 159 | { | ||
| 160 | int err; | ||
| 161 | int pkt_len = skb->len - skb_transport_offset(skb); | ||
| 162 | struct pcpu_tstats *tstats = this_cpu_ptr(dev->tstats); | ||
| 163 | |||
| 164 | nf_reset(skb); | ||
| 165 | |||
| 166 | err = ip_local_out(skb); | ||
| 167 | if (likely(net_xmit_eval(err) == 0)) { | ||
| 168 | u64_stats_update_begin(&tstats->syncp); | ||
| 169 | tstats->tx_bytes += pkt_len; | ||
| 170 | tstats->tx_packets++; | ||
| 171 | u64_stats_update_end(&tstats->syncp); | ||
| 172 | } else { | ||
| 173 | dev->stats.tx_errors++; | ||
| 174 | dev->stats.tx_aborted_errors++; | ||
| 175 | } | ||
| 176 | } | ||
| 177 | #endif /* __NET_IP_TUNNELS_H */ | ||
diff --git a/include/net/ip_vs.h b/include/net/ip_vs.h index fce8e6b66d55..4c062ccff9aa 100644 --- a/include/net/ip_vs.h +++ b/include/net/ip_vs.h | |||
| @@ -233,6 +233,21 @@ static inline void ip_vs_addr_copy(int af, union nf_inet_addr *dst, | |||
| 233 | dst->ip = src->ip; | 233 | dst->ip = src->ip; |
| 234 | } | 234 | } |
| 235 | 235 | ||
| 236 | static inline void ip_vs_addr_set(int af, union nf_inet_addr *dst, | ||
| 237 | const union nf_inet_addr *src) | ||
| 238 | { | ||
| 239 | #ifdef CONFIG_IP_VS_IPV6 | ||
| 240 | if (af == AF_INET6) { | ||
| 241 | dst->in6 = src->in6; | ||
| 242 | return; | ||
| 243 | } | ||
| 244 | #endif | ||
| 245 | dst->ip = src->ip; | ||
| 246 | dst->all[1] = 0; | ||
| 247 | dst->all[2] = 0; | ||
| 248 | dst->all[3] = 0; | ||
| 249 | } | ||
| 250 | |||
| 236 | static inline int ip_vs_addr_equal(int af, const union nf_inet_addr *a, | 251 | static inline int ip_vs_addr_equal(int af, const union nf_inet_addr *a, |
| 237 | const union nf_inet_addr *b) | 252 | const union nf_inet_addr *b) |
| 238 | { | 253 | { |
| @@ -344,8 +359,6 @@ static inline const char *ip_vs_dbg_addr(int af, char *buf, size_t buf_len, | |||
| 344 | #define LeaveFunction(level) do {} while (0) | 359 | #define LeaveFunction(level) do {} while (0) |
| 345 | #endif | 360 | #endif |
| 346 | 361 | ||
| 347 | #define IP_VS_WAIT_WHILE(expr) while (expr) { cpu_relax(); } | ||
| 348 | |||
| 349 | 362 | ||
| 350 | /* | 363 | /* |
| 351 | * The port number of FTP service (in network order). | 364 | * The port number of FTP service (in network order). |
| @@ -459,7 +472,7 @@ struct ip_vs_estimator { | |||
| 459 | struct ip_vs_stats { | 472 | struct ip_vs_stats { |
| 460 | struct ip_vs_stats_user ustats; /* statistics */ | 473 | struct ip_vs_stats_user ustats; /* statistics */ |
| 461 | struct ip_vs_estimator est; /* estimator */ | 474 | struct ip_vs_estimator est; /* estimator */ |
| 462 | struct ip_vs_cpu_stats *cpustats; /* per cpu counters */ | 475 | struct ip_vs_cpu_stats __percpu *cpustats; /* per cpu counters */ |
| 463 | spinlock_t lock; /* spin lock */ | 476 | spinlock_t lock; /* spin lock */ |
| 464 | struct ip_vs_stats_user ustats0; /* reset values */ | 477 | struct ip_vs_stats_user ustats0; /* reset values */ |
| 465 | }; | 478 | }; |
| @@ -566,20 +579,19 @@ struct ip_vs_conn_param { | |||
| 566 | */ | 579 | */ |
| 567 | struct ip_vs_conn { | 580 | struct ip_vs_conn { |
| 568 | struct hlist_node c_list; /* hashed list heads */ | 581 | struct hlist_node c_list; /* hashed list heads */ |
| 569 | #ifdef CONFIG_NET_NS | ||
| 570 | struct net *net; /* Name space */ | ||
| 571 | #endif | ||
| 572 | /* Protocol, addresses and port numbers */ | 582 | /* Protocol, addresses and port numbers */ |
| 573 | u16 af; /* address family */ | ||
| 574 | __be16 cport; | 583 | __be16 cport; |
| 575 | __be16 vport; | ||
| 576 | __be16 dport; | 584 | __be16 dport; |
| 577 | __u32 fwmark; /* Fire wall mark from skb */ | 585 | __be16 vport; |
| 586 | u16 af; /* address family */ | ||
| 578 | union nf_inet_addr caddr; /* client address */ | 587 | union nf_inet_addr caddr; /* client address */ |
| 579 | union nf_inet_addr vaddr; /* virtual address */ | 588 | union nf_inet_addr vaddr; /* virtual address */ |
| 580 | union nf_inet_addr daddr; /* destination address */ | 589 | union nf_inet_addr daddr; /* destination address */ |
| 581 | volatile __u32 flags; /* status flags */ | 590 | volatile __u32 flags; /* status flags */ |
| 582 | __u16 protocol; /* Which protocol (TCP/UDP) */ | 591 | __u16 protocol; /* Which protocol (TCP/UDP) */ |
| 592 | #ifdef CONFIG_NET_NS | ||
| 593 | struct net *net; /* Name space */ | ||
| 594 | #endif | ||
| 583 | 595 | ||
| 584 | /* counter and timer */ | 596 | /* counter and timer */ |
| 585 | atomic_t refcnt; /* reference count */ | 597 | atomic_t refcnt; /* reference count */ |
| @@ -593,6 +605,7 @@ struct ip_vs_conn { | |||
| 593 | * state transition triggerd | 605 | * state transition triggerd |
| 594 | * synchronization | 606 | * synchronization |
| 595 | */ | 607 | */ |
| 608 | __u32 fwmark; /* Fire wall mark from skb */ | ||
| 596 | unsigned long sync_endtime; /* jiffies + sent_retries */ | 609 | unsigned long sync_endtime; /* jiffies + sent_retries */ |
| 597 | 610 | ||
| 598 | /* Control members */ | 611 | /* Control members */ |
| @@ -620,6 +633,8 @@ struct ip_vs_conn { | |||
| 620 | const struct ip_vs_pe *pe; | 633 | const struct ip_vs_pe *pe; |
| 621 | char *pe_data; | 634 | char *pe_data; |
| 622 | __u8 pe_data_len; | 635 | __u8 pe_data_len; |
| 636 | |||
| 637 | struct rcu_head rcu_head; | ||
| 623 | }; | 638 | }; |
| 624 | 639 | ||
| 625 | /* | 640 | /* |
| @@ -663,7 +678,7 @@ struct ip_vs_service_user_kern { | |||
| 663 | u16 af; | 678 | u16 af; |
| 664 | u16 protocol; | 679 | u16 protocol; |
| 665 | union nf_inet_addr addr; /* virtual ip address */ | 680 | union nf_inet_addr addr; /* virtual ip address */ |
| 666 | u16 port; | 681 | __be16 port; |
| 667 | u32 fwmark; /* firwall mark of service */ | 682 | u32 fwmark; /* firwall mark of service */ |
| 668 | 683 | ||
| 669 | /* virtual service options */ | 684 | /* virtual service options */ |
| @@ -671,14 +686,14 @@ struct ip_vs_service_user_kern { | |||
| 671 | char *pe_name; | 686 | char *pe_name; |
| 672 | unsigned int flags; /* virtual service flags */ | 687 | unsigned int flags; /* virtual service flags */ |
| 673 | unsigned int timeout; /* persistent timeout in sec */ | 688 | unsigned int timeout; /* persistent timeout in sec */ |
| 674 | u32 netmask; /* persistent netmask */ | 689 | __be32 netmask; /* persistent netmask or plen */ |
| 675 | }; | 690 | }; |
| 676 | 691 | ||
| 677 | 692 | ||
| 678 | struct ip_vs_dest_user_kern { | 693 | struct ip_vs_dest_user_kern { |
| 679 | /* destination server address */ | 694 | /* destination server address */ |
| 680 | union nf_inet_addr addr; | 695 | union nf_inet_addr addr; |
| 681 | u16 port; | 696 | __be16 port; |
| 682 | 697 | ||
| 683 | /* real server options */ | 698 | /* real server options */ |
| 684 | unsigned int conn_flags; /* connection flags */ | 699 | unsigned int conn_flags; /* connection flags */ |
| @@ -695,10 +710,9 @@ struct ip_vs_dest_user_kern { | |||
| 695 | * and the forwarding entries | 710 | * and the forwarding entries |
| 696 | */ | 711 | */ |
| 697 | struct ip_vs_service { | 712 | struct ip_vs_service { |
| 698 | struct list_head s_list; /* for normal service table */ | 713 | struct hlist_node s_list; /* for normal service table */ |
| 699 | struct list_head f_list; /* for fwmark-based service table */ | 714 | struct hlist_node f_list; /* for fwmark-based service table */ |
| 700 | atomic_t refcnt; /* reference counter */ | 715 | atomic_t refcnt; /* reference counter */ |
| 701 | atomic_t usecnt; /* use counter */ | ||
| 702 | 716 | ||
| 703 | u16 af; /* address family */ | 717 | u16 af; /* address family */ |
| 704 | __u16 protocol; /* which protocol (TCP/UDP) */ | 718 | __u16 protocol; /* which protocol (TCP/UDP) */ |
| @@ -707,31 +721,41 @@ struct ip_vs_service { | |||
| 707 | __u32 fwmark; /* firewall mark of the service */ | 721 | __u32 fwmark; /* firewall mark of the service */ |
| 708 | unsigned int flags; /* service status flags */ | 722 | unsigned int flags; /* service status flags */ |
| 709 | unsigned int timeout; /* persistent timeout in ticks */ | 723 | unsigned int timeout; /* persistent timeout in ticks */ |
| 710 | __be32 netmask; /* grouping granularity */ | 724 | __be32 netmask; /* grouping granularity, mask/plen */ |
| 711 | struct net *net; | 725 | struct net *net; |
| 712 | 726 | ||
| 713 | struct list_head destinations; /* real server d-linked list */ | 727 | struct list_head destinations; /* real server d-linked list */ |
| 714 | __u32 num_dests; /* number of servers */ | 728 | __u32 num_dests; /* number of servers */ |
| 715 | struct ip_vs_stats stats; /* statistics for the service */ | 729 | struct ip_vs_stats stats; /* statistics for the service */ |
| 716 | struct ip_vs_app *inc; /* bind conns to this app inc */ | ||
| 717 | 730 | ||
| 718 | /* for scheduling */ | 731 | /* for scheduling */ |
| 719 | struct ip_vs_scheduler *scheduler; /* bound scheduler object */ | 732 | struct ip_vs_scheduler __rcu *scheduler; /* bound scheduler object */ |
| 720 | rwlock_t sched_lock; /* lock sched_data */ | 733 | spinlock_t sched_lock; /* lock sched_data */ |
| 721 | void *sched_data; /* scheduler application data */ | 734 | void *sched_data; /* scheduler application data */ |
| 722 | 735 | ||
| 723 | /* alternate persistence engine */ | 736 | /* alternate persistence engine */ |
| 724 | struct ip_vs_pe *pe; | 737 | struct ip_vs_pe __rcu *pe; |
| 738 | |||
| 739 | struct rcu_head rcu_head; | ||
| 725 | }; | 740 | }; |
| 726 | 741 | ||
| 742 | /* Information for cached dst */ | ||
| 743 | struct ip_vs_dest_dst { | ||
| 744 | struct dst_entry *dst_cache; /* destination cache entry */ | ||
| 745 | u32 dst_cookie; | ||
| 746 | union nf_inet_addr dst_saddr; | ||
| 747 | struct rcu_head rcu_head; | ||
| 748 | }; | ||
| 727 | 749 | ||
| 750 | /* In grace period after removing */ | ||
| 751 | #define IP_VS_DEST_STATE_REMOVING 0x01 | ||
| 728 | /* | 752 | /* |
| 729 | * The real server destination forwarding entry | 753 | * The real server destination forwarding entry |
| 730 | * with ip address, port number, and so on. | 754 | * with ip address, port number, and so on. |
| 731 | */ | 755 | */ |
| 732 | struct ip_vs_dest { | 756 | struct ip_vs_dest { |
| 733 | struct list_head n_list; /* for the dests in the service */ | 757 | struct list_head n_list; /* for the dests in the service */ |
| 734 | struct list_head d_list; /* for table with all the dests */ | 758 | struct hlist_node d_list; /* for table with all the dests */ |
| 735 | 759 | ||
| 736 | u16 af; /* address family */ | 760 | u16 af; /* address family */ |
| 737 | __be16 port; /* port number of the server */ | 761 | __be16 port; /* port number of the server */ |
| @@ -742,6 +766,7 @@ struct ip_vs_dest { | |||
| 742 | 766 | ||
| 743 | atomic_t refcnt; /* reference counter */ | 767 | atomic_t refcnt; /* reference counter */ |
| 744 | struct ip_vs_stats stats; /* statistics */ | 768 | struct ip_vs_stats stats; /* statistics */ |
| 769 | unsigned long state; /* state flags */ | ||
| 745 | 770 | ||
| 746 | /* connection counters and thresholds */ | 771 | /* connection counters and thresholds */ |
| 747 | atomic_t activeconns; /* active connections */ | 772 | atomic_t activeconns; /* active connections */ |
| @@ -752,10 +777,7 @@ struct ip_vs_dest { | |||
| 752 | 777 | ||
| 753 | /* for destination cache */ | 778 | /* for destination cache */ |
| 754 | spinlock_t dst_lock; /* lock of dst_cache */ | 779 | spinlock_t dst_lock; /* lock of dst_cache */ |
| 755 | struct dst_entry *dst_cache; /* destination cache entry */ | 780 | struct ip_vs_dest_dst __rcu *dest_dst; /* cached dst info */ |
| 756 | u32 dst_rtos; /* RT_TOS(tos) for dst */ | ||
| 757 | u32 dst_cookie; | ||
| 758 | union nf_inet_addr dst_saddr; | ||
| 759 | 781 | ||
| 760 | /* for virtual service */ | 782 | /* for virtual service */ |
| 761 | struct ip_vs_service *svc; /* service it belongs to */ | 783 | struct ip_vs_service *svc; /* service it belongs to */ |
| @@ -763,6 +785,10 @@ struct ip_vs_dest { | |||
| 763 | __be16 vport; /* virtual port number */ | 785 | __be16 vport; /* virtual port number */ |
| 764 | union nf_inet_addr vaddr; /* virtual IP address */ | 786 | union nf_inet_addr vaddr; /* virtual IP address */ |
| 765 | __u32 vfwmark; /* firewall mark of service */ | 787 | __u32 vfwmark; /* firewall mark of service */ |
| 788 | |||
| 789 | struct list_head t_list; /* in dest_trash */ | ||
| 790 | struct rcu_head rcu_head; | ||
| 791 | unsigned int in_rs_table:1; /* we are in rs_table */ | ||
| 766 | }; | 792 | }; |
| 767 | 793 | ||
| 768 | 794 | ||
| @@ -778,9 +804,13 @@ struct ip_vs_scheduler { | |||
| 778 | /* scheduler initializing service */ | 804 | /* scheduler initializing service */ |
| 779 | int (*init_service)(struct ip_vs_service *svc); | 805 | int (*init_service)(struct ip_vs_service *svc); |
| 780 | /* scheduling service finish */ | 806 | /* scheduling service finish */ |
| 781 | int (*done_service)(struct ip_vs_service *svc); | 807 | void (*done_service)(struct ip_vs_service *svc); |
| 782 | /* scheduler updating service */ | 808 | /* dest is linked */ |
| 783 | int (*update_service)(struct ip_vs_service *svc); | 809 | int (*add_dest)(struct ip_vs_service *svc, struct ip_vs_dest *dest); |
| 810 | /* dest is unlinked */ | ||
| 811 | int (*del_dest)(struct ip_vs_service *svc, struct ip_vs_dest *dest); | ||
| 812 | /* dest is updated */ | ||
| 813 | int (*upd_dest)(struct ip_vs_service *svc, struct ip_vs_dest *dest); | ||
| 784 | 814 | ||
| 785 | /* selecting a server from the given service */ | 815 | /* selecting a server from the given service */ |
| 786 | struct ip_vs_dest* (*schedule)(struct ip_vs_service *svc, | 816 | struct ip_vs_dest* (*schedule)(struct ip_vs_service *svc, |
| @@ -819,6 +849,7 @@ struct ip_vs_app { | |||
| 819 | struct ip_vs_app *app; /* its real application */ | 849 | struct ip_vs_app *app; /* its real application */ |
| 820 | __be16 port; /* port number in net order */ | 850 | __be16 port; /* port number in net order */ |
| 821 | atomic_t usecnt; /* usage counter */ | 851 | atomic_t usecnt; /* usage counter */ |
| 852 | struct rcu_head rcu_head; | ||
| 822 | 853 | ||
| 823 | /* | 854 | /* |
| 824 | * output hook: Process packet in inout direction, diff set for TCP. | 855 | * output hook: Process packet in inout direction, diff set for TCP. |
| @@ -881,6 +912,9 @@ struct ipvs_master_sync_state { | |||
| 881 | struct netns_ipvs *ipvs; | 912 | struct netns_ipvs *ipvs; |
| 882 | }; | 913 | }; |
| 883 | 914 | ||
| 915 | /* How much time to keep dests in trash */ | ||
| 916 | #define IP_VS_DEST_TRASH_PERIOD (120 * HZ) | ||
| 917 | |||
| 884 | /* IPVS in network namespace */ | 918 | /* IPVS in network namespace */ |
| 885 | struct netns_ipvs { | 919 | struct netns_ipvs { |
| 886 | int gen; /* Generation */ | 920 | int gen; /* Generation */ |
| @@ -892,7 +926,7 @@ struct netns_ipvs { | |||
| 892 | #define IP_VS_RTAB_SIZE (1 << IP_VS_RTAB_BITS) | 926 | #define IP_VS_RTAB_SIZE (1 << IP_VS_RTAB_BITS) |
| 893 | #define IP_VS_RTAB_MASK (IP_VS_RTAB_SIZE - 1) | 927 | #define IP_VS_RTAB_MASK (IP_VS_RTAB_SIZE - 1) |
| 894 | 928 | ||
| 895 | struct list_head rs_table[IP_VS_RTAB_SIZE]; | 929 | struct hlist_head rs_table[IP_VS_RTAB_SIZE]; |
| 896 | /* ip_vs_app */ | 930 | /* ip_vs_app */ |
| 897 | struct list_head app_list; | 931 | struct list_head app_list; |
| 898 | /* ip_vs_proto */ | 932 | /* ip_vs_proto */ |
| @@ -904,7 +938,6 @@ struct netns_ipvs { | |||
| 904 | #define TCP_APP_TAB_SIZE (1 << TCP_APP_TAB_BITS) | 938 | #define TCP_APP_TAB_SIZE (1 << TCP_APP_TAB_BITS) |
| 905 | #define TCP_APP_TAB_MASK (TCP_APP_TAB_SIZE - 1) | 939 | #define TCP_APP_TAB_MASK (TCP_APP_TAB_SIZE - 1) |
| 906 | struct list_head tcp_apps[TCP_APP_TAB_SIZE]; | 940 | struct list_head tcp_apps[TCP_APP_TAB_SIZE]; |
| 907 | spinlock_t tcp_app_lock; | ||
| 908 | #endif | 941 | #endif |
| 909 | /* ip_vs_proto_udp */ | 942 | /* ip_vs_proto_udp */ |
| 910 | #ifdef CONFIG_IP_VS_PROTO_UDP | 943 | #ifdef CONFIG_IP_VS_PROTO_UDP |
| @@ -912,7 +945,6 @@ struct netns_ipvs { | |||
| 912 | #define UDP_APP_TAB_SIZE (1 << UDP_APP_TAB_BITS) | 945 | #define UDP_APP_TAB_SIZE (1 << UDP_APP_TAB_BITS) |
| 913 | #define UDP_APP_TAB_MASK (UDP_APP_TAB_SIZE - 1) | 946 | #define UDP_APP_TAB_MASK (UDP_APP_TAB_SIZE - 1) |
| 914 | struct list_head udp_apps[UDP_APP_TAB_SIZE]; | 947 | struct list_head udp_apps[UDP_APP_TAB_SIZE]; |
| 915 | spinlock_t udp_app_lock; | ||
| 916 | #endif | 948 | #endif |
| 917 | /* ip_vs_proto_sctp */ | 949 | /* ip_vs_proto_sctp */ |
| 918 | #ifdef CONFIG_IP_VS_PROTO_SCTP | 950 | #ifdef CONFIG_IP_VS_PROTO_SCTP |
| @@ -921,7 +953,6 @@ struct netns_ipvs { | |||
| 921 | #define SCTP_APP_TAB_MASK (SCTP_APP_TAB_SIZE - 1) | 953 | #define SCTP_APP_TAB_MASK (SCTP_APP_TAB_SIZE - 1) |
| 922 | /* Hash table for SCTP application incarnations */ | 954 | /* Hash table for SCTP application incarnations */ |
| 923 | struct list_head sctp_apps[SCTP_APP_TAB_SIZE]; | 955 | struct list_head sctp_apps[SCTP_APP_TAB_SIZE]; |
| 924 | spinlock_t sctp_app_lock; | ||
| 925 | #endif | 956 | #endif |
| 926 | /* ip_vs_conn */ | 957 | /* ip_vs_conn */ |
| 927 | atomic_t conn_count; /* connection counter */ | 958 | atomic_t conn_count; /* connection counter */ |
| @@ -931,9 +962,10 @@ struct netns_ipvs { | |||
| 931 | 962 | ||
| 932 | int num_services; /* no of virtual services */ | 963 | int num_services; /* no of virtual services */ |
| 933 | 964 | ||
| 934 | rwlock_t rs_lock; /* real services table */ | ||
| 935 | /* Trash for destinations */ | 965 | /* Trash for destinations */ |
| 936 | struct list_head dest_trash; | 966 | struct list_head dest_trash; |
| 967 | spinlock_t dest_trash_lock; | ||
| 968 | struct timer_list dest_trash_timer; /* expiration timer */ | ||
| 937 | /* Service counters */ | 969 | /* Service counters */ |
| 938 | atomic_t ftpsvc_counter; | 970 | atomic_t ftpsvc_counter; |
| 939 | atomic_t nullsvc_counter; | 971 | atomic_t nullsvc_counter; |
| @@ -1181,9 +1213,19 @@ struct ip_vs_conn * ip_vs_conn_out_get_proto(int af, const struct sk_buff *skb, | |||
| 1181 | const struct ip_vs_iphdr *iph, | 1213 | const struct ip_vs_iphdr *iph, |
| 1182 | int inverse); | 1214 | int inverse); |
| 1183 | 1215 | ||
| 1216 | /* Get reference to gain full access to conn. | ||
| 1217 | * By default, RCU read-side critical sections have access only to | ||
| 1218 | * conn fields and its PE data, see ip_vs_conn_rcu_free() for reference. | ||
| 1219 | */ | ||
| 1220 | static inline bool __ip_vs_conn_get(struct ip_vs_conn *cp) | ||
| 1221 | { | ||
| 1222 | return atomic_inc_not_zero(&cp->refcnt); | ||
| 1223 | } | ||
| 1224 | |||
| 1184 | /* put back the conn without restarting its timer */ | 1225 | /* put back the conn without restarting its timer */ |
| 1185 | static inline void __ip_vs_conn_put(struct ip_vs_conn *cp) | 1226 | static inline void __ip_vs_conn_put(struct ip_vs_conn *cp) |
| 1186 | { | 1227 | { |
| 1228 | smp_mb__before_atomic_dec(); | ||
| 1187 | atomic_dec(&cp->refcnt); | 1229 | atomic_dec(&cp->refcnt); |
| 1188 | } | 1230 | } |
| 1189 | extern void ip_vs_conn_put(struct ip_vs_conn *cp); | 1231 | extern void ip_vs_conn_put(struct ip_vs_conn *cp); |
| @@ -1298,8 +1340,6 @@ extern void ip_vs_app_inc_put(struct ip_vs_app *inc); | |||
| 1298 | extern int ip_vs_app_pkt_out(struct ip_vs_conn *, struct sk_buff *skb); | 1340 | extern int ip_vs_app_pkt_out(struct ip_vs_conn *, struct sk_buff *skb); |
| 1299 | extern int ip_vs_app_pkt_in(struct ip_vs_conn *, struct sk_buff *skb); | 1341 | extern int ip_vs_app_pkt_in(struct ip_vs_conn *, struct sk_buff *skb); |
| 1300 | 1342 | ||
| 1301 | void ip_vs_bind_pe(struct ip_vs_service *svc, struct ip_vs_pe *pe); | ||
| 1302 | void ip_vs_unbind_pe(struct ip_vs_service *svc); | ||
| 1303 | int register_ip_vs_pe(struct ip_vs_pe *pe); | 1343 | int register_ip_vs_pe(struct ip_vs_pe *pe); |
| 1304 | int unregister_ip_vs_pe(struct ip_vs_pe *pe); | 1344 | int unregister_ip_vs_pe(struct ip_vs_pe *pe); |
| 1305 | struct ip_vs_pe *ip_vs_pe_getbyname(const char *name); | 1345 | struct ip_vs_pe *ip_vs_pe_getbyname(const char *name); |
| @@ -1346,7 +1386,8 @@ extern int register_ip_vs_scheduler(struct ip_vs_scheduler *scheduler); | |||
| 1346 | extern int unregister_ip_vs_scheduler(struct ip_vs_scheduler *scheduler); | 1386 | extern int unregister_ip_vs_scheduler(struct ip_vs_scheduler *scheduler); |
| 1347 | extern int ip_vs_bind_scheduler(struct ip_vs_service *svc, | 1387 | extern int ip_vs_bind_scheduler(struct ip_vs_service *svc, |
| 1348 | struct ip_vs_scheduler *scheduler); | 1388 | struct ip_vs_scheduler *scheduler); |
| 1349 | extern int ip_vs_unbind_scheduler(struct ip_vs_service *svc); | 1389 | extern void ip_vs_unbind_scheduler(struct ip_vs_service *svc, |
| 1390 | struct ip_vs_scheduler *sched); | ||
| 1350 | extern struct ip_vs_scheduler *ip_vs_scheduler_get(const char *sched_name); | 1391 | extern struct ip_vs_scheduler *ip_vs_scheduler_get(const char *sched_name); |
| 1351 | extern void ip_vs_scheduler_put(struct ip_vs_scheduler *scheduler); | 1392 | extern void ip_vs_scheduler_put(struct ip_vs_scheduler *scheduler); |
| 1352 | extern struct ip_vs_conn * | 1393 | extern struct ip_vs_conn * |
| @@ -1366,17 +1407,12 @@ extern struct ip_vs_stats ip_vs_stats; | |||
| 1366 | extern int sysctl_ip_vs_sync_ver; | 1407 | extern int sysctl_ip_vs_sync_ver; |
| 1367 | 1408 | ||
| 1368 | extern struct ip_vs_service * | 1409 | extern struct ip_vs_service * |
| 1369 | ip_vs_service_get(struct net *net, int af, __u32 fwmark, __u16 protocol, | 1410 | ip_vs_service_find(struct net *net, int af, __u32 fwmark, __u16 protocol, |
| 1370 | const union nf_inet_addr *vaddr, __be16 vport); | 1411 | const union nf_inet_addr *vaddr, __be16 vport); |
| 1371 | 1412 | ||
| 1372 | static inline void ip_vs_service_put(struct ip_vs_service *svc) | 1413 | extern bool |
| 1373 | { | 1414 | ip_vs_has_real_service(struct net *net, int af, __u16 protocol, |
| 1374 | atomic_dec(&svc->usecnt); | 1415 | const union nf_inet_addr *daddr, __be16 dport); |
| 1375 | } | ||
| 1376 | |||
| 1377 | extern struct ip_vs_dest * | ||
| 1378 | ip_vs_lookup_real_service(struct net *net, int af, __u16 protocol, | ||
| 1379 | const union nf_inet_addr *daddr, __be16 dport); | ||
| 1380 | 1416 | ||
| 1381 | extern int ip_vs_use_count_inc(void); | 1417 | extern int ip_vs_use_count_inc(void); |
| 1382 | extern void ip_vs_use_count_dec(void); | 1418 | extern void ip_vs_use_count_dec(void); |
| @@ -1388,8 +1424,18 @@ extern struct ip_vs_dest * | |||
| 1388 | ip_vs_find_dest(struct net *net, int af, const union nf_inet_addr *daddr, | 1424 | ip_vs_find_dest(struct net *net, int af, const union nf_inet_addr *daddr, |
| 1389 | __be16 dport, const union nf_inet_addr *vaddr, __be16 vport, | 1425 | __be16 dport, const union nf_inet_addr *vaddr, __be16 vport, |
| 1390 | __u16 protocol, __u32 fwmark, __u32 flags); | 1426 | __u16 protocol, __u32 fwmark, __u32 flags); |
| 1391 | extern struct ip_vs_dest *ip_vs_try_bind_dest(struct ip_vs_conn *cp); | 1427 | extern void ip_vs_try_bind_dest(struct ip_vs_conn *cp); |
| 1392 | 1428 | ||
| 1429 | static inline void ip_vs_dest_hold(struct ip_vs_dest *dest) | ||
| 1430 | { | ||
| 1431 | atomic_inc(&dest->refcnt); | ||
| 1432 | } | ||
| 1433 | |||
| 1434 | static inline void ip_vs_dest_put(struct ip_vs_dest *dest) | ||
| 1435 | { | ||
| 1436 | smp_mb__before_atomic_dec(); | ||
| 1437 | atomic_dec(&dest->refcnt); | ||
| 1438 | } | ||
| 1393 | 1439 | ||
| 1394 | /* | 1440 | /* |
| 1395 | * IPVS sync daemon data and function prototypes | 1441 | * IPVS sync daemon data and function prototypes |
| @@ -1428,7 +1474,7 @@ extern int ip_vs_dr_xmit(struct sk_buff *skb, struct ip_vs_conn *cp, | |||
| 1428 | extern int ip_vs_icmp_xmit(struct sk_buff *skb, struct ip_vs_conn *cp, | 1474 | extern int ip_vs_icmp_xmit(struct sk_buff *skb, struct ip_vs_conn *cp, |
| 1429 | struct ip_vs_protocol *pp, int offset, | 1475 | struct ip_vs_protocol *pp, int offset, |
| 1430 | unsigned int hooknum, struct ip_vs_iphdr *iph); | 1476 | unsigned int hooknum, struct ip_vs_iphdr *iph); |
| 1431 | extern void ip_vs_dst_reset(struct ip_vs_dest *dest); | 1477 | extern void ip_vs_dest_dst_rcu_free(struct rcu_head *head); |
| 1432 | 1478 | ||
| 1433 | #ifdef CONFIG_IP_VS_IPV6 | 1479 | #ifdef CONFIG_IP_VS_IPV6 |
| 1434 | extern int ip_vs_bypass_xmit_v6(struct sk_buff *skb, struct ip_vs_conn *cp, | 1480 | extern int ip_vs_bypass_xmit_v6(struct sk_buff *skb, struct ip_vs_conn *cp, |
diff --git a/include/net/ipip.h b/include/net/ipip.h deleted file mode 100644 index 982141c15200..000000000000 --- a/include/net/ipip.h +++ /dev/null | |||
| @@ -1,87 +0,0 @@ | |||
| 1 | #ifndef __NET_IPIP_H | ||
| 2 | #define __NET_IPIP_H 1 | ||
| 3 | |||
| 4 | #include <linux/if_tunnel.h> | ||
| 5 | #include <net/gro_cells.h> | ||
| 6 | #include <net/ip.h> | ||
| 7 | |||
| 8 | /* Keep error state on tunnel for 30 sec */ | ||
| 9 | #define IPTUNNEL_ERR_TIMEO (30*HZ) | ||
| 10 | |||
| 11 | /* 6rd prefix/relay information */ | ||
| 12 | struct ip_tunnel_6rd_parm { | ||
| 13 | struct in6_addr prefix; | ||
| 14 | __be32 relay_prefix; | ||
| 15 | u16 prefixlen; | ||
| 16 | u16 relay_prefixlen; | ||
| 17 | }; | ||
| 18 | |||
| 19 | struct ip_tunnel { | ||
| 20 | struct ip_tunnel __rcu *next; | ||
| 21 | struct net_device *dev; | ||
| 22 | |||
| 23 | int err_count; /* Number of arrived ICMP errors */ | ||
| 24 | unsigned long err_time; /* Time when the last ICMP error arrived */ | ||
| 25 | |||
| 26 | /* These four fields used only by GRE */ | ||
| 27 | __u32 i_seqno; /* The last seen seqno */ | ||
| 28 | __u32 o_seqno; /* The last output seqno */ | ||
| 29 | int hlen; /* Precalculated GRE header length */ | ||
| 30 | int mlink; | ||
| 31 | |||
| 32 | struct ip_tunnel_parm parms; | ||
| 33 | |||
| 34 | /* for SIT */ | ||
| 35 | #ifdef CONFIG_IPV6_SIT_6RD | ||
| 36 | struct ip_tunnel_6rd_parm ip6rd; | ||
| 37 | #endif | ||
| 38 | struct ip_tunnel_prl_entry __rcu *prl; /* potential router list */ | ||
| 39 | unsigned int prl_count; /* # of entries in PRL */ | ||
| 40 | |||
| 41 | struct gro_cells gro_cells; | ||
| 42 | }; | ||
| 43 | |||
| 44 | struct ip_tunnel_prl_entry { | ||
| 45 | struct ip_tunnel_prl_entry __rcu *next; | ||
| 46 | __be32 addr; | ||
| 47 | u16 flags; | ||
| 48 | struct rcu_head rcu_head; | ||
| 49 | }; | ||
| 50 | |||
| 51 | static inline void iptunnel_xmit(struct sk_buff *skb, struct net_device *dev) | ||
| 52 | { | ||
| 53 | int err; | ||
| 54 | struct iphdr *iph = ip_hdr(skb); | ||
| 55 | int pkt_len = skb->len - skb_transport_offset(skb); | ||
| 56 | struct pcpu_tstats *tstats = this_cpu_ptr(dev->tstats); | ||
| 57 | |||
| 58 | nf_reset(skb); | ||
| 59 | skb->ip_summed = CHECKSUM_NONE; | ||
| 60 | ip_select_ident(iph, skb_dst(skb), NULL); | ||
| 61 | |||
| 62 | err = ip_local_out(skb); | ||
| 63 | if (likely(net_xmit_eval(err) == 0)) { | ||
| 64 | u64_stats_update_begin(&tstats->syncp); | ||
| 65 | tstats->tx_bytes += pkt_len; | ||
| 66 | tstats->tx_packets++; | ||
| 67 | u64_stats_update_end(&tstats->syncp); | ||
| 68 | } else { | ||
| 69 | dev->stats.tx_errors++; | ||
| 70 | dev->stats.tx_aborted_errors++; | ||
| 71 | } | ||
| 72 | } | ||
| 73 | |||
| 74 | static inline void tunnel_ip_select_ident(struct sk_buff *skb, | ||
| 75 | const struct iphdr *old_iph, | ||
| 76 | struct dst_entry *dst) | ||
| 77 | { | ||
| 78 | struct iphdr *iph = ip_hdr(skb); | ||
| 79 | |||
| 80 | /* Use inner packet iph-id if possible. */ | ||
| 81 | if (skb->protocol == htons(ETH_P_IP) && old_iph->id) | ||
| 82 | iph->id = old_iph->id; | ||
| 83 | else | ||
| 84 | __ip_select_ident(iph, dst, | ||
| 85 | (skb_shinfo(skb)->gso_segs ?: 1) - 1); | ||
| 86 | } | ||
| 87 | #endif | ||
diff --git a/include/net/ipv6.h b/include/net/ipv6.h index 64d12e77719a..0810aa57c780 100644 --- a/include/net/ipv6.h +++ b/include/net/ipv6.h | |||
| @@ -217,7 +217,7 @@ struct ipv6_txoptions { | |||
| 217 | }; | 217 | }; |
| 218 | 218 | ||
| 219 | struct ip6_flowlabel { | 219 | struct ip6_flowlabel { |
| 220 | struct ip6_flowlabel *next; | 220 | struct ip6_flowlabel __rcu *next; |
| 221 | __be32 label; | 221 | __be32 label; |
| 222 | atomic_t users; | 222 | atomic_t users; |
| 223 | struct in6_addr dst; | 223 | struct in6_addr dst; |
| @@ -238,9 +238,9 @@ struct ip6_flowlabel { | |||
| 238 | #define IPV6_FLOWLABEL_MASK cpu_to_be32(0x000FFFFF) | 238 | #define IPV6_FLOWLABEL_MASK cpu_to_be32(0x000FFFFF) |
| 239 | 239 | ||
| 240 | struct ipv6_fl_socklist { | 240 | struct ipv6_fl_socklist { |
| 241 | struct ipv6_fl_socklist *next; | 241 | struct ipv6_fl_socklist __rcu *next; |
| 242 | struct ip6_flowlabel *fl; | 242 | struct ip6_flowlabel *fl; |
| 243 | struct rcu_head rcu; | 243 | struct rcu_head rcu; |
| 244 | }; | 244 | }; |
| 245 | 245 | ||
| 246 | extern struct ip6_flowlabel *fl6_sock_lookup(struct sock *sk, __be32 label); | 246 | extern struct ip6_flowlabel *fl6_sock_lookup(struct sock *sk, __be32 label); |
| @@ -320,6 +320,18 @@ static inline int ipv6_addr_src_scope(const struct in6_addr *addr) | |||
| 320 | return __ipv6_addr_src_scope(__ipv6_addr_type(addr)); | 320 | return __ipv6_addr_src_scope(__ipv6_addr_type(addr)); |
| 321 | } | 321 | } |
| 322 | 322 | ||
| 323 | static inline bool __ipv6_addr_needs_scope_id(int type) | ||
| 324 | { | ||
| 325 | return type & IPV6_ADDR_LINKLOCAL || | ||
| 326 | (type & IPV6_ADDR_MULTICAST && | ||
| 327 | (type & (IPV6_ADDR_LOOPBACK|IPV6_ADDR_LINKLOCAL))); | ||
| 328 | } | ||
| 329 | |||
| 330 | static inline __u32 ipv6_iface_scope_id(const struct in6_addr *addr, int iface) | ||
| 331 | { | ||
| 332 | return __ipv6_addr_needs_scope_id(__ipv6_addr_type(addr)) ? iface : 0; | ||
| 333 | } | ||
| 334 | |||
| 323 | static inline int ipv6_addr_cmp(const struct in6_addr *a1, const struct in6_addr *a2) | 335 | static inline int ipv6_addr_cmp(const struct in6_addr *a1, const struct in6_addr *a2) |
| 324 | { | 336 | { |
| 325 | return memcmp(a1, a2, sizeof(struct in6_addr)); | 337 | return memcmp(a1, a2, sizeof(struct in6_addr)); |
| @@ -466,6 +478,7 @@ struct ip6_create_arg { | |||
| 466 | u32 user; | 478 | u32 user; |
| 467 | const struct in6_addr *src; | 479 | const struct in6_addr *src; |
| 468 | const struct in6_addr *dst; | 480 | const struct in6_addr *dst; |
| 481 | u8 ecn; | ||
| 469 | }; | 482 | }; |
| 470 | 483 | ||
| 471 | void ip6_frag_init(struct inet_frag_queue *q, void *a); | 484 | void ip6_frag_init(struct inet_frag_queue *q, void *a); |
| @@ -485,6 +498,7 @@ struct frag_queue { | |||
| 485 | int iif; | 498 | int iif; |
| 486 | unsigned int csum; | 499 | unsigned int csum; |
| 487 | __u16 nhoffset; | 500 | __u16 nhoffset; |
| 501 | u8 ecn; | ||
| 488 | }; | 502 | }; |
| 489 | 503 | ||
| 490 | void ip6_expire_frag_queue(struct net *net, struct frag_queue *fq, | 504 | void ip6_expire_frag_queue(struct net *net, struct frag_queue *fq, |
diff --git a/include/net/mac80211.h b/include/net/mac80211.h index f7eba1300d82..04c2d4670dc6 100644 --- a/include/net/mac80211.h +++ b/include/net/mac80211.h | |||
| @@ -93,9 +93,11 @@ struct device; | |||
| 93 | * enum ieee80211_max_queues - maximum number of queues | 93 | * enum ieee80211_max_queues - maximum number of queues |
| 94 | * | 94 | * |
| 95 | * @IEEE80211_MAX_QUEUES: Maximum number of regular device queues. | 95 | * @IEEE80211_MAX_QUEUES: Maximum number of regular device queues. |
| 96 | * @IEEE80211_MAX_QUEUE_MAP: bitmap with maximum queues set | ||
| 96 | */ | 97 | */ |
| 97 | enum ieee80211_max_queues { | 98 | enum ieee80211_max_queues { |
| 98 | IEEE80211_MAX_QUEUES = 16, | 99 | IEEE80211_MAX_QUEUES = 16, |
| 100 | IEEE80211_MAX_QUEUE_MAP = BIT(IEEE80211_MAX_QUEUES) - 1, | ||
| 99 | }; | 101 | }; |
| 100 | 102 | ||
| 101 | #define IEEE80211_INVAL_HW_QUEUE 0xff | 103 | #define IEEE80211_INVAL_HW_QUEUE 0xff |
| @@ -126,6 +128,7 @@ enum ieee80211_ac_numbers { | |||
| 126 | * 2^n-1 in the range 1..32767] | 128 | * 2^n-1 in the range 1..32767] |
| 127 | * @cw_max: maximum contention window [like @cw_min] | 129 | * @cw_max: maximum contention window [like @cw_min] |
| 128 | * @txop: maximum burst time in units of 32 usecs, 0 meaning disabled | 130 | * @txop: maximum burst time in units of 32 usecs, 0 meaning disabled |
| 131 | * @acm: is mandatory admission control required for the access category | ||
| 129 | * @uapsd: is U-APSD mode enabled for the queue | 132 | * @uapsd: is U-APSD mode enabled for the queue |
| 130 | */ | 133 | */ |
| 131 | struct ieee80211_tx_queue_params { | 134 | struct ieee80211_tx_queue_params { |
| @@ -133,6 +136,7 @@ struct ieee80211_tx_queue_params { | |||
| 133 | u16 cw_min; | 136 | u16 cw_min; |
| 134 | u16 cw_max; | 137 | u16 cw_max; |
| 135 | u8 aifs; | 138 | u8 aifs; |
| 139 | bool acm; | ||
| 136 | bool uapsd; | 140 | bool uapsd; |
| 137 | }; | 141 | }; |
| 138 | 142 | ||
| @@ -207,7 +211,7 @@ struct ieee80211_chanctx_conf { | |||
| 207 | * @BSS_CHANGED_QOS: QoS for this association was enabled/disabled. Note | 211 | * @BSS_CHANGED_QOS: QoS for this association was enabled/disabled. Note |
| 208 | * that it is only ever disabled for station mode. | 212 | * that it is only ever disabled for station mode. |
| 209 | * @BSS_CHANGED_IDLE: Idle changed for this BSS/interface. | 213 | * @BSS_CHANGED_IDLE: Idle changed for this BSS/interface. |
| 210 | * @BSS_CHANGED_SSID: SSID changed for this BSS (AP mode) | 214 | * @BSS_CHANGED_SSID: SSID changed for this BSS (AP and IBSS mode) |
| 211 | * @BSS_CHANGED_AP_PROBE_RESP: Probe Response changed for this BSS (AP mode) | 215 | * @BSS_CHANGED_AP_PROBE_RESP: Probe Response changed for this BSS (AP mode) |
| 212 | * @BSS_CHANGED_PS: PS changed for this BSS (STA mode) | 216 | * @BSS_CHANGED_PS: PS changed for this BSS (STA mode) |
| 213 | * @BSS_CHANGED_TXPOWER: TX power setting changed for this interface | 217 | * @BSS_CHANGED_TXPOWER: TX power setting changed for this interface |
| @@ -324,12 +328,11 @@ enum ieee80211_rssi_event { | |||
| 324 | * your driver/device needs to do. | 328 | * your driver/device needs to do. |
| 325 | * @ps: power-save mode (STA only). This flag is NOT affected by | 329 | * @ps: power-save mode (STA only). This flag is NOT affected by |
| 326 | * offchannel/dynamic_ps operations. | 330 | * offchannel/dynamic_ps operations. |
| 327 | * @ssid: The SSID of the current vif. Only valid in AP-mode. | 331 | * @ssid: The SSID of the current vif. Valid in AP and IBSS mode. |
| 328 | * @ssid_len: Length of SSID given in @ssid. | 332 | * @ssid_len: Length of SSID given in @ssid. |
| 329 | * @hidden_ssid: The SSID of the current vif is hidden. Only valid in AP-mode. | 333 | * @hidden_ssid: The SSID of the current vif is hidden. Only valid in AP-mode. |
| 330 | * @txpower: TX power in dBm | 334 | * @txpower: TX power in dBm |
| 331 | * @p2p_ctwindow: P2P CTWindow, only for P2P client interfaces | 335 | * @p2p_noa_attr: P2P NoA attribute for P2P powersave |
| 332 | * @p2p_oppps: P2P opportunistic PS is enabled | ||
| 333 | */ | 336 | */ |
| 334 | struct ieee80211_bss_conf { | 337 | struct ieee80211_bss_conf { |
| 335 | const u8 *bssid; | 338 | const u8 *bssid; |
| @@ -363,8 +366,7 @@ struct ieee80211_bss_conf { | |||
| 363 | size_t ssid_len; | 366 | size_t ssid_len; |
| 364 | bool hidden_ssid; | 367 | bool hidden_ssid; |
| 365 | int txpower; | 368 | int txpower; |
| 366 | u8 p2p_ctwindow; | 369 | struct ieee80211_p2p_noa_attr p2p_noa_attr; |
| 367 | bool p2p_oppps; | ||
| 368 | }; | 370 | }; |
| 369 | 371 | ||
| 370 | /** | 372 | /** |
| @@ -561,6 +563,9 @@ enum mac80211_rate_control_flags { | |||
| 561 | /* maximum number of rate stages */ | 563 | /* maximum number of rate stages */ |
| 562 | #define IEEE80211_TX_MAX_RATES 4 | 564 | #define IEEE80211_TX_MAX_RATES 4 |
| 563 | 565 | ||
| 566 | /* maximum number of rate table entries */ | ||
| 567 | #define IEEE80211_TX_RATE_TABLE_SIZE 4 | ||
| 568 | |||
| 564 | /** | 569 | /** |
| 565 | * struct ieee80211_tx_rate - rate selection/status | 570 | * struct ieee80211_tx_rate - rate selection/status |
| 566 | * | 571 | * |
| @@ -601,8 +606,8 @@ static inline void ieee80211_rate_set_vht(struct ieee80211_tx_rate *rate, | |||
| 601 | u8 mcs, u8 nss) | 606 | u8 mcs, u8 nss) |
| 602 | { | 607 | { |
| 603 | WARN_ON(mcs & ~0xF); | 608 | WARN_ON(mcs & ~0xF); |
| 604 | WARN_ON(nss & ~0x7); | 609 | WARN_ON((nss - 1) & ~0x7); |
| 605 | rate->idx = (nss << 4) | mcs; | 610 | rate->idx = ((nss - 1) << 4) | mcs; |
| 606 | } | 611 | } |
| 607 | 612 | ||
| 608 | static inline u8 | 613 | static inline u8 |
| @@ -614,7 +619,7 @@ ieee80211_rate_get_vht_mcs(const struct ieee80211_tx_rate *rate) | |||
| 614 | static inline u8 | 619 | static inline u8 |
| 615 | ieee80211_rate_get_vht_nss(const struct ieee80211_tx_rate *rate) | 620 | ieee80211_rate_get_vht_nss(const struct ieee80211_tx_rate *rate) |
| 616 | { | 621 | { |
| 617 | return rate->idx >> 4; | 622 | return (rate->idx >> 4) + 1; |
| 618 | } | 623 | } |
| 619 | 624 | ||
| 620 | /** | 625 | /** |
| @@ -655,7 +660,11 @@ struct ieee80211_tx_info { | |||
| 655 | struct ieee80211_tx_rate rates[ | 660 | struct ieee80211_tx_rate rates[ |
| 656 | IEEE80211_TX_MAX_RATES]; | 661 | IEEE80211_TX_MAX_RATES]; |
| 657 | s8 rts_cts_rate_idx; | 662 | s8 rts_cts_rate_idx; |
| 658 | /* 3 bytes free */ | 663 | u8 use_rts:1; |
| 664 | u8 use_cts_prot:1; | ||
| 665 | u8 short_preamble:1; | ||
| 666 | u8 skip_table:1; | ||
| 667 | /* 2 bytes free */ | ||
| 659 | }; | 668 | }; |
| 660 | /* only needed before rate control */ | 669 | /* only needed before rate control */ |
| 661 | unsigned long jiffies; | 670 | unsigned long jiffies; |
| @@ -676,6 +685,8 @@ struct ieee80211_tx_info { | |||
| 676 | struct { | 685 | struct { |
| 677 | struct ieee80211_tx_rate driver_rates[ | 686 | struct ieee80211_tx_rate driver_rates[ |
| 678 | IEEE80211_TX_MAX_RATES]; | 687 | IEEE80211_TX_MAX_RATES]; |
| 688 | u8 pad[4]; | ||
| 689 | |||
| 679 | void *rate_driver_data[ | 690 | void *rate_driver_data[ |
| 680 | IEEE80211_TX_INFO_RATE_DRIVER_DATA_SIZE / sizeof(void *)]; | 691 | IEEE80211_TX_INFO_RATE_DRIVER_DATA_SIZE / sizeof(void *)]; |
| 681 | }; | 692 | }; |
| @@ -974,8 +985,7 @@ enum ieee80211_smps_mode { | |||
| 974 | * @power_level: requested transmit power (in dBm), backward compatibility | 985 | * @power_level: requested transmit power (in dBm), backward compatibility |
| 975 | * value only that is set to the minimum of all interfaces | 986 | * value only that is set to the minimum of all interfaces |
| 976 | * | 987 | * |
| 977 | * @channel: the channel to tune to | 988 | * @chandef: the channel definition to tune to |
| 978 | * @channel_type: the channel (HT) type | ||
| 979 | * @radar_enabled: whether radar detection is enabled | 989 | * @radar_enabled: whether radar detection is enabled |
| 980 | * | 990 | * |
| 981 | * @long_frame_max_tx_count: Maximum number of transmissions for a "long" frame | 991 | * @long_frame_max_tx_count: Maximum number of transmissions for a "long" frame |
| @@ -1001,8 +1011,7 @@ struct ieee80211_conf { | |||
| 1001 | 1011 | ||
| 1002 | u8 long_frame_max_tx_count, short_frame_max_tx_count; | 1012 | u8 long_frame_max_tx_count, short_frame_max_tx_count; |
| 1003 | 1013 | ||
| 1004 | struct ieee80211_channel *channel; | 1014 | struct cfg80211_chan_def chandef; |
| 1005 | enum nl80211_channel_type channel_type; | ||
| 1006 | bool radar_enabled; | 1015 | bool radar_enabled; |
| 1007 | enum ieee80211_smps_mode smps_mode; | 1016 | enum ieee80211_smps_mode smps_mode; |
| 1008 | }; | 1017 | }; |
| @@ -1019,13 +1028,13 @@ struct ieee80211_conf { | |||
| 1019 | * the driver passed into mac80211. | 1028 | * the driver passed into mac80211. |
| 1020 | * @block_tx: Indicates whether transmission must be blocked before the | 1029 | * @block_tx: Indicates whether transmission must be blocked before the |
| 1021 | * scheduled channel switch, as indicated by the AP. | 1030 | * scheduled channel switch, as indicated by the AP. |
| 1022 | * @channel: the new channel to switch to | 1031 | * @chandef: the new channel to switch to |
| 1023 | * @count: the number of TBTT's until the channel switch event | 1032 | * @count: the number of TBTT's until the channel switch event |
| 1024 | */ | 1033 | */ |
| 1025 | struct ieee80211_channel_switch { | 1034 | struct ieee80211_channel_switch { |
| 1026 | u64 timestamp; | 1035 | u64 timestamp; |
| 1027 | bool block_tx; | 1036 | bool block_tx; |
| 1028 | struct ieee80211_channel *channel; | 1037 | struct cfg80211_chan_def chandef; |
| 1029 | u8 count; | 1038 | u8 count; |
| 1030 | }; | 1039 | }; |
| 1031 | 1040 | ||
| @@ -1067,6 +1076,9 @@ enum ieee80211_vif_flags { | |||
| 1067 | * path needing to access it; even though the netdev carrier will always | 1076 | * path needing to access it; even though the netdev carrier will always |
| 1068 | * be off when it is %NULL there can still be races and packets could be | 1077 | * be off when it is %NULL there can still be races and packets could be |
| 1069 | * processed after it switches back to %NULL. | 1078 | * processed after it switches back to %NULL. |
| 1079 | * @debugfs_dir: debugfs dentry, can be used by drivers to create own per | ||
| 1080 | * interface debug files. Note that it will be NULL for the virtual | ||
| 1081 | * monitor interface (if that is requested.) | ||
| 1070 | * @drv_priv: data area for driver use, will always be aligned to | 1082 | * @drv_priv: data area for driver use, will always be aligned to |
| 1071 | * sizeof(void *). | 1083 | * sizeof(void *). |
| 1072 | */ | 1084 | */ |
| @@ -1083,6 +1095,10 @@ struct ieee80211_vif { | |||
| 1083 | 1095 | ||
| 1084 | u32 driver_flags; | 1096 | u32 driver_flags; |
| 1085 | 1097 | ||
| 1098 | #ifdef CONFIG_MAC80211_DEBUGFS | ||
| 1099 | struct dentry *debugfs_dir; | ||
| 1100 | #endif | ||
| 1101 | |||
| 1086 | /* must be last */ | 1102 | /* must be last */ |
| 1087 | u8 drv_priv[0] __aligned(sizeof(void *)); | 1103 | u8 drv_priv[0] __aligned(sizeof(void *)); |
| 1088 | }; | 1104 | }; |
| @@ -1101,8 +1117,6 @@ static inline bool ieee80211_vif_is_mesh(struct ieee80211_vif *vif) | |||
| 1101 | * These flags are used for communication about keys between the driver | 1117 | * These flags are used for communication about keys between the driver |
| 1102 | * and mac80211, with the @flags parameter of &struct ieee80211_key_conf. | 1118 | * and mac80211, with the @flags parameter of &struct ieee80211_key_conf. |
| 1103 | * | 1119 | * |
| 1104 | * @IEEE80211_KEY_FLAG_WMM_STA: Set by mac80211, this flag indicates | ||
| 1105 | * that the STA this key will be used with could be using QoS. | ||
| 1106 | * @IEEE80211_KEY_FLAG_GENERATE_IV: This flag should be set by the | 1120 | * @IEEE80211_KEY_FLAG_GENERATE_IV: This flag should be set by the |
| 1107 | * driver to indicate that it requires IV generation for this | 1121 | * driver to indicate that it requires IV generation for this |
| 1108 | * particular key. | 1122 | * particular key. |
| @@ -1127,7 +1141,6 @@ static inline bool ieee80211_vif_is_mesh(struct ieee80211_vif *vif) | |||
| 1127 | * %IEEE80211_KEY_FLAG_SW_MGMT_TX flag to encrypt such frames in SW. | 1141 | * %IEEE80211_KEY_FLAG_SW_MGMT_TX flag to encrypt such frames in SW. |
| 1128 | */ | 1142 | */ |
| 1129 | enum ieee80211_key_flags { | 1143 | enum ieee80211_key_flags { |
| 1130 | IEEE80211_KEY_FLAG_WMM_STA = 1<<0, | ||
| 1131 | IEEE80211_KEY_FLAG_GENERATE_IV = 1<<1, | 1144 | IEEE80211_KEY_FLAG_GENERATE_IV = 1<<1, |
| 1132 | IEEE80211_KEY_FLAG_GENERATE_MMIC= 1<<2, | 1145 | IEEE80211_KEY_FLAG_GENERATE_MMIC= 1<<2, |
| 1133 | IEEE80211_KEY_FLAG_PAIRWISE = 1<<3, | 1146 | IEEE80211_KEY_FLAG_PAIRWISE = 1<<3, |
| @@ -1219,6 +1232,24 @@ enum ieee80211_sta_rx_bandwidth { | |||
| 1219 | }; | 1232 | }; |
| 1220 | 1233 | ||
| 1221 | /** | 1234 | /** |
| 1235 | * struct ieee80211_sta_rates - station rate selection table | ||
| 1236 | * | ||
| 1237 | * @rcu_head: RCU head used for freeing the table on update | ||
| 1238 | * @rates: transmit rates/flags to be used by default. | ||
| 1239 | * Overriding entries per-packet is possible by using cb tx control. | ||
| 1240 | */ | ||
| 1241 | struct ieee80211_sta_rates { | ||
| 1242 | struct rcu_head rcu_head; | ||
| 1243 | struct { | ||
| 1244 | s8 idx; | ||
| 1245 | u8 count; | ||
| 1246 | u8 count_cts; | ||
| 1247 | u8 count_rts; | ||
| 1248 | u16 flags; | ||
| 1249 | } rate[IEEE80211_TX_RATE_TABLE_SIZE]; | ||
| 1250 | }; | ||
| 1251 | |||
| 1252 | /** | ||
| 1222 | * struct ieee80211_sta - station table entry | 1253 | * struct ieee80211_sta - station table entry |
| 1223 | * | 1254 | * |
| 1224 | * A station table entry represents a station we are possibly | 1255 | * A station table entry represents a station we are possibly |
| @@ -1231,9 +1262,8 @@ enum ieee80211_sta_rx_bandwidth { | |||
| 1231 | * @addr: MAC address | 1262 | * @addr: MAC address |
| 1232 | * @aid: AID we assigned to the station if we're an AP | 1263 | * @aid: AID we assigned to the station if we're an AP |
| 1233 | * @supp_rates: Bitmap of supported rates (per band) | 1264 | * @supp_rates: Bitmap of supported rates (per band) |
| 1234 | * @ht_cap: HT capabilities of this STA; restricted to our own TX capabilities | 1265 | * @ht_cap: HT capabilities of this STA; restricted to our own capabilities |
| 1235 | * @vht_cap: VHT capabilities of this STA; Not restricting any capabilities | 1266 | * @vht_cap: VHT capabilities of this STA; restricted to our own capabilities |
| 1236 | * of remote STA. Taking as is. | ||
| 1237 | * @wme: indicates whether the STA supports WME. Only valid during AP-mode. | 1267 | * @wme: indicates whether the STA supports WME. Only valid during AP-mode. |
| 1238 | * @drv_priv: data area for driver use, will always be aligned to | 1268 | * @drv_priv: data area for driver use, will always be aligned to |
| 1239 | * sizeof(void *), size is determined in hw information. | 1269 | * sizeof(void *), size is determined in hw information. |
| @@ -1246,6 +1276,7 @@ enum ieee80211_sta_rx_bandwidth { | |||
| 1246 | * notifications and capabilities. The value is only valid after | 1276 | * notifications and capabilities. The value is only valid after |
| 1247 | * the station moves to associated state. | 1277 | * the station moves to associated state. |
| 1248 | * @smps_mode: current SMPS mode (off, static or dynamic) | 1278 | * @smps_mode: current SMPS mode (off, static or dynamic) |
| 1279 | * @tx_rates: rate control selection table | ||
| 1249 | */ | 1280 | */ |
| 1250 | struct ieee80211_sta { | 1281 | struct ieee80211_sta { |
| 1251 | u32 supp_rates[IEEE80211_NUM_BANDS]; | 1282 | u32 supp_rates[IEEE80211_NUM_BANDS]; |
| @@ -1259,6 +1290,7 @@ struct ieee80211_sta { | |||
| 1259 | u8 rx_nss; | 1290 | u8 rx_nss; |
| 1260 | enum ieee80211_sta_rx_bandwidth bandwidth; | 1291 | enum ieee80211_sta_rx_bandwidth bandwidth; |
| 1261 | enum ieee80211_smps_mode smps_mode; | 1292 | enum ieee80211_smps_mode smps_mode; |
| 1293 | struct ieee80211_sta_rates __rcu *rates; | ||
| 1262 | 1294 | ||
| 1263 | /* must be last */ | 1295 | /* must be last */ |
| 1264 | u8 drv_priv[0] __aligned(sizeof(void *)); | 1296 | u8 drv_priv[0] __aligned(sizeof(void *)); |
| @@ -1414,6 +1446,9 @@ struct ieee80211_tx_control { | |||
| 1414 | * for different virtual interfaces. See the doc section on HW queue | 1446 | * for different virtual interfaces. See the doc section on HW queue |
| 1415 | * control for more details. | 1447 | * control for more details. |
| 1416 | * | 1448 | * |
| 1449 | * @IEEE80211_HW_SUPPORTS_RC_TABLE: The driver supports using a rate | ||
| 1450 | * selection table provided by the rate control algorithm. | ||
| 1451 | * | ||
| 1417 | * @IEEE80211_HW_P2P_DEV_ADDR_FOR_INTF: Use the P2P Device address for any | 1452 | * @IEEE80211_HW_P2P_DEV_ADDR_FOR_INTF: Use the P2P Device address for any |
| 1418 | * P2P Interface. This will be honoured even if more than one interface | 1453 | * P2P Interface. This will be honoured even if more than one interface |
| 1419 | * is supported. | 1454 | * is supported. |
| @@ -1446,6 +1481,7 @@ enum ieee80211_hw_flags { | |||
| 1446 | IEEE80211_HW_SUPPORTS_PER_STA_GTK = 1<<21, | 1481 | IEEE80211_HW_SUPPORTS_PER_STA_GTK = 1<<21, |
| 1447 | IEEE80211_HW_AP_LINK_PS = 1<<22, | 1482 | IEEE80211_HW_AP_LINK_PS = 1<<22, |
| 1448 | IEEE80211_HW_TX_AMPDU_SETUP_IN_HW = 1<<23, | 1483 | IEEE80211_HW_TX_AMPDU_SETUP_IN_HW = 1<<23, |
| 1484 | IEEE80211_HW_SUPPORTS_RC_TABLE = 1<<24, | ||
| 1449 | IEEE80211_HW_P2P_DEV_ADDR_FOR_INTF = 1<<25, | 1485 | IEEE80211_HW_P2P_DEV_ADDR_FOR_INTF = 1<<25, |
| 1450 | IEEE80211_HW_TIMING_BEACON_ONLY = 1<<26, | 1486 | IEEE80211_HW_TIMING_BEACON_ONLY = 1<<26, |
| 1451 | }; | 1487 | }; |
| @@ -1531,6 +1567,17 @@ enum ieee80211_hw_flags { | |||
| 1531 | * @netdev_features: netdev features to be set in each netdev created | 1567 | * @netdev_features: netdev features to be set in each netdev created |
| 1532 | * from this HW. Note only HW checksum features are currently | 1568 | * from this HW. Note only HW checksum features are currently |
| 1533 | * compatible with mac80211. Other feature bits will be rejected. | 1569 | * compatible with mac80211. Other feature bits will be rejected. |
| 1570 | * | ||
| 1571 | * @uapsd_queues: This bitmap is included in (re)association frame to indicate | ||
| 1572 | * for each access category if it is uAPSD trigger-enabled and delivery- | ||
| 1573 | * enabled. Use IEEE80211_WMM_IE_STA_QOSINFO_AC_* to set this bitmap. | ||
| 1574 | * Each bit corresponds to different AC. Value '1' in specific bit means | ||
| 1575 | * that corresponding AC is both trigger- and delivery-enabled. '0' means | ||
| 1576 | * neither enabled. | ||
| 1577 | * | ||
| 1578 | * @uapsd_max_sp_len: maximum number of total buffered frames the WMM AP may | ||
| 1579 | * deliver to a WMM STA during any Service Period triggered by the WMM STA. | ||
| 1580 | * Use IEEE80211_WMM_IE_STA_QOSINFO_SP_* for correct values. | ||
| 1534 | */ | 1581 | */ |
| 1535 | struct ieee80211_hw { | 1582 | struct ieee80211_hw { |
| 1536 | struct ieee80211_conf conf; | 1583 | struct ieee80211_conf conf; |
| @@ -1556,6 +1603,8 @@ struct ieee80211_hw { | |||
| 1556 | u8 radiotap_mcs_details; | 1603 | u8 radiotap_mcs_details; |
| 1557 | u16 radiotap_vht_details; | 1604 | u16 radiotap_vht_details; |
| 1558 | netdev_features_t netdev_features; | 1605 | netdev_features_t netdev_features; |
| 1606 | u8 uapsd_queues; | ||
| 1607 | u8 uapsd_max_sp_len; | ||
| 1559 | }; | 1608 | }; |
| 1560 | 1609 | ||
| 1561 | /** | 1610 | /** |
| @@ -1950,14 +1999,14 @@ void ieee80211_free_txskb(struct ieee80211_hw *hw, struct sk_buff *skb); | |||
| 1950 | * filter those response frames except in the case of frames that | 1999 | * filter those response frames except in the case of frames that |
| 1951 | * are buffered in the driver -- those must remain buffered to avoid | 2000 | * are buffered in the driver -- those must remain buffered to avoid |
| 1952 | * reordering. Because it is possible that no frames are released | 2001 | * reordering. Because it is possible that no frames are released |
| 1953 | * in this case, the driver must call ieee80211_sta_eosp_irqsafe() | 2002 | * in this case, the driver must call ieee80211_sta_eosp() |
| 1954 | * to indicate to mac80211 that the service period ended anyway. | 2003 | * to indicate to mac80211 that the service period ended anyway. |
| 1955 | * | 2004 | * |
| 1956 | * Finally, if frames from multiple TIDs are released from mac80211 | 2005 | * Finally, if frames from multiple TIDs are released from mac80211 |
| 1957 | * but the driver might reorder them, it must clear & set the flags | 2006 | * but the driver might reorder them, it must clear & set the flags |
| 1958 | * appropriately (only the last frame may have %IEEE80211_TX_STATUS_EOSP) | 2007 | * appropriately (only the last frame may have %IEEE80211_TX_STATUS_EOSP) |
| 1959 | * and also take care of the EOSP and MORE_DATA bits in the frame. | 2008 | * and also take care of the EOSP and MORE_DATA bits in the frame. |
| 1960 | * The driver may also use ieee80211_sta_eosp_irqsafe() in this case. | 2009 | * The driver may also use ieee80211_sta_eosp() in this case. |
| 1961 | */ | 2010 | */ |
| 1962 | 2011 | ||
| 1963 | /** | 2012 | /** |
| @@ -2135,6 +2184,24 @@ enum ieee80211_rate_control_changed { | |||
| 2135 | }; | 2184 | }; |
| 2136 | 2185 | ||
| 2137 | /** | 2186 | /** |
| 2187 | * enum ieee80211_roc_type - remain on channel type | ||
| 2188 | * | ||
| 2189 | * With the support for multi channel contexts and multi channel operations, | ||
| 2190 | * remain on channel operations might be limited/deferred/aborted by other | ||
| 2191 | * flows/operations which have higher priority (and vise versa). | ||
| 2192 | * Specifying the ROC type can be used by devices to prioritize the ROC | ||
| 2193 | * operations compared to other operations/flows. | ||
| 2194 | * | ||
| 2195 | * @IEEE80211_ROC_TYPE_NORMAL: There are no special requirements for this ROC. | ||
| 2196 | * @IEEE80211_ROC_TYPE_MGMT_TX: The remain on channel request is required | ||
| 2197 | * for sending managment frames offchannel. | ||
| 2198 | */ | ||
| 2199 | enum ieee80211_roc_type { | ||
| 2200 | IEEE80211_ROC_TYPE_NORMAL = 0, | ||
| 2201 | IEEE80211_ROC_TYPE_MGMT_TX, | ||
| 2202 | }; | ||
| 2203 | |||
| 2204 | /** | ||
| 2138 | * struct ieee80211_ops - callbacks from mac80211 to the driver | 2205 | * struct ieee80211_ops - callbacks from mac80211 to the driver |
| 2139 | * | 2206 | * |
| 2140 | * This structure contains various callbacks that the driver may | 2207 | * This structure contains various callbacks that the driver may |
| @@ -2212,18 +2279,6 @@ enum ieee80211_rate_control_changed { | |||
| 2212 | * MAC address of the device going away. | 2279 | * MAC address of the device going away. |
| 2213 | * Hence, this callback must be implemented. It can sleep. | 2280 | * Hence, this callback must be implemented. It can sleep. |
| 2214 | * | 2281 | * |
| 2215 | * @add_interface_debugfs: Drivers can use this callback to add debugfs files | ||
| 2216 | * when a vif is added to mac80211. This callback and | ||
| 2217 | * @remove_interface_debugfs should be within a CONFIG_MAC80211_DEBUGFS | ||
| 2218 | * conditional. @remove_interface_debugfs must be provided for cleanup. | ||
| 2219 | * This callback can sleep. | ||
| 2220 | * | ||
| 2221 | * @remove_interface_debugfs: Remove the debugfs files which were added using | ||
| 2222 | * @add_interface_debugfs. This callback must remove all debugfs entries | ||
| 2223 | * that were added because mac80211 only removes interface debugfs when the | ||
| 2224 | * interface is destroyed, not when it is removed from the driver. | ||
| 2225 | * This callback can sleep. | ||
| 2226 | * | ||
| 2227 | * @config: Handler for configuration requests. IEEE 802.11 code calls this | 2282 | * @config: Handler for configuration requests. IEEE 802.11 code calls this |
| 2228 | * function to change hardware configuration, e.g., channel. | 2283 | * function to change hardware configuration, e.g., channel. |
| 2229 | * This function should never fail but returns a negative error code | 2284 | * This function should never fail but returns a negative error code |
| @@ -2245,6 +2300,9 @@ enum ieee80211_rate_control_changed { | |||
| 2245 | * See the section "Frame filtering" for more information. | 2300 | * See the section "Frame filtering" for more information. |
| 2246 | * This callback must be implemented and can sleep. | 2301 | * This callback must be implemented and can sleep. |
| 2247 | * | 2302 | * |
| 2303 | * @set_multicast_list: Configure the device's interface specific RX multicast | ||
| 2304 | * filter. This callback is optional. This callback must be atomic. | ||
| 2305 | * | ||
| 2248 | * @set_tim: Set TIM bit. mac80211 calls this function when a TIM bit | 2306 | * @set_tim: Set TIM bit. mac80211 calls this function when a TIM bit |
| 2249 | * must be set or cleared for a given STA. Must be atomic. | 2307 | * must be set or cleared for a given STA. Must be atomic. |
| 2250 | * | 2308 | * |
| @@ -2426,8 +2484,11 @@ enum ieee80211_rate_control_changed { | |||
| 2426 | * @testmode_dump: Implement a cfg80211 test mode dump. The callback can sleep. | 2484 | * @testmode_dump: Implement a cfg80211 test mode dump. The callback can sleep. |
| 2427 | * | 2485 | * |
| 2428 | * @flush: Flush all pending frames from the hardware queue, making sure | 2486 | * @flush: Flush all pending frames from the hardware queue, making sure |
| 2429 | * that the hardware queues are empty. If the parameter @drop is set | 2487 | * that the hardware queues are empty. The @queues parameter is a bitmap |
| 2430 | * to %true, pending frames may be dropped. The callback can sleep. | 2488 | * of queues to flush, which is useful if different virtual interfaces |
| 2489 | * use different hardware queues; it may also indicate all queues. | ||
| 2490 | * If the parameter @drop is set to %true, pending frames may be dropped. | ||
| 2491 | * The callback can sleep. | ||
| 2431 | * | 2492 | * |
| 2432 | * @channel_switch: Drivers that need (or want) to offload the channel | 2493 | * @channel_switch: Drivers that need (or want) to offload the channel |
| 2433 | * switch operation for CSAs received from the AP may implement this | 2494 | * switch operation for CSAs received from the AP may implement this |
| @@ -2492,7 +2553,7 @@ enum ieee80211_rate_control_changed { | |||
| 2492 | * setting the EOSP flag in the QoS header of the frames. Also, when the | 2553 | * setting the EOSP flag in the QoS header of the frames. Also, when the |
| 2493 | * service period ends, the driver must set %IEEE80211_TX_STATUS_EOSP | 2554 | * service period ends, the driver must set %IEEE80211_TX_STATUS_EOSP |
| 2494 | * on the last frame in the SP. Alternatively, it may call the function | 2555 | * on the last frame in the SP. Alternatively, it may call the function |
| 2495 | * ieee80211_sta_eosp_irqsafe() to inform mac80211 of the end of the SP. | 2556 | * ieee80211_sta_eosp() to inform mac80211 of the end of the SP. |
| 2496 | * This callback must be atomic. | 2557 | * This callback must be atomic. |
| 2497 | * @allow_buffered_frames: Prepare device to allow the given number of frames | 2558 | * @allow_buffered_frames: Prepare device to allow the given number of frames |
| 2498 | * to go out to the given station. The frames will be sent by mac80211 | 2559 | * to go out to the given station. The frames will be sent by mac80211 |
| @@ -2503,7 +2564,7 @@ enum ieee80211_rate_control_changed { | |||
| 2503 | * them between the TIDs, it must set the %IEEE80211_TX_STATUS_EOSP flag | 2564 | * them between the TIDs, it must set the %IEEE80211_TX_STATUS_EOSP flag |
| 2504 | * on the last frame and clear it on all others and also handle the EOSP | 2565 | * on the last frame and clear it on all others and also handle the EOSP |
| 2505 | * bit in the QoS header correctly. Alternatively, it can also call the | 2566 | * bit in the QoS header correctly. Alternatively, it can also call the |
| 2506 | * ieee80211_sta_eosp_irqsafe() function. | 2567 | * ieee80211_sta_eosp() function. |
| 2507 | * The @tids parameter is a bitmap and tells the driver which TIDs the | 2568 | * The @tids parameter is a bitmap and tells the driver which TIDs the |
| 2508 | * frames will be on; it will at most have two bits set. | 2569 | * frames will be on; it will at most have two bits set. |
| 2509 | * This callback must be atomic. | 2570 | * This callback must be atomic. |
| @@ -2591,6 +2652,10 @@ struct ieee80211_ops { | |||
| 2591 | unsigned int changed_flags, | 2652 | unsigned int changed_flags, |
| 2592 | unsigned int *total_flags, | 2653 | unsigned int *total_flags, |
| 2593 | u64 multicast); | 2654 | u64 multicast); |
| 2655 | void (*set_multicast_list)(struct ieee80211_hw *hw, | ||
| 2656 | struct ieee80211_vif *vif, bool allmulti, | ||
| 2657 | struct netdev_hw_addr_list *mc_list); | ||
| 2658 | |||
| 2594 | int (*set_tim)(struct ieee80211_hw *hw, struct ieee80211_sta *sta, | 2659 | int (*set_tim)(struct ieee80211_hw *hw, struct ieee80211_sta *sta, |
| 2595 | bool set); | 2660 | bool set); |
| 2596 | int (*set_key)(struct ieee80211_hw *hw, enum set_key_cmd cmd, | 2661 | int (*set_key)(struct ieee80211_hw *hw, enum set_key_cmd cmd, |
| @@ -2637,12 +2702,6 @@ struct ieee80211_ops { | |||
| 2637 | struct ieee80211_vif *vif, | 2702 | struct ieee80211_vif *vif, |
| 2638 | struct ieee80211_sta *sta, | 2703 | struct ieee80211_sta *sta, |
| 2639 | struct dentry *dir); | 2704 | struct dentry *dir); |
| 2640 | void (*add_interface_debugfs)(struct ieee80211_hw *hw, | ||
| 2641 | struct ieee80211_vif *vif, | ||
| 2642 | struct dentry *dir); | ||
| 2643 | void (*remove_interface_debugfs)(struct ieee80211_hw *hw, | ||
| 2644 | struct ieee80211_vif *vif, | ||
| 2645 | struct dentry *dir); | ||
| 2646 | #endif | 2705 | #endif |
| 2647 | void (*sta_notify)(struct ieee80211_hw *hw, struct ieee80211_vif *vif, | 2706 | void (*sta_notify)(struct ieee80211_hw *hw, struct ieee80211_vif *vif, |
| 2648 | enum sta_notify_cmd, struct ieee80211_sta *sta); | 2707 | enum sta_notify_cmd, struct ieee80211_sta *sta); |
| @@ -2677,7 +2736,7 @@ struct ieee80211_ops { | |||
| 2677 | struct netlink_callback *cb, | 2736 | struct netlink_callback *cb, |
| 2678 | void *data, int len); | 2737 | void *data, int len); |
| 2679 | #endif | 2738 | #endif |
| 2680 | void (*flush)(struct ieee80211_hw *hw, bool drop); | 2739 | void (*flush)(struct ieee80211_hw *hw, u32 queues, bool drop); |
| 2681 | void (*channel_switch)(struct ieee80211_hw *hw, | 2740 | void (*channel_switch)(struct ieee80211_hw *hw, |
| 2682 | struct ieee80211_channel_switch *ch_switch); | 2741 | struct ieee80211_channel_switch *ch_switch); |
| 2683 | int (*napi_poll)(struct ieee80211_hw *hw, int budget); | 2742 | int (*napi_poll)(struct ieee80211_hw *hw, int budget); |
| @@ -2687,7 +2746,8 @@ struct ieee80211_ops { | |||
| 2687 | int (*remain_on_channel)(struct ieee80211_hw *hw, | 2746 | int (*remain_on_channel)(struct ieee80211_hw *hw, |
| 2688 | struct ieee80211_vif *vif, | 2747 | struct ieee80211_vif *vif, |
| 2689 | struct ieee80211_channel *chan, | 2748 | struct ieee80211_channel *chan, |
| 2690 | int duration); | 2749 | int duration, |
| 2750 | enum ieee80211_roc_type type); | ||
| 2691 | int (*cancel_remain_on_channel)(struct ieee80211_hw *hw); | 2751 | int (*cancel_remain_on_channel)(struct ieee80211_hw *hw); |
| 2692 | int (*set_ringparam)(struct ieee80211_hw *hw, u32 tx, u32 rx); | 2752 | int (*set_ringparam)(struct ieee80211_hw *hw, u32 tx, u32 rx); |
| 2693 | void (*get_ringparam)(struct ieee80211_hw *hw, | 2753 | void (*get_ringparam)(struct ieee80211_hw *hw, |
| @@ -3108,6 +3168,25 @@ void ieee80211_sta_set_buffered(struct ieee80211_sta *sta, | |||
| 3108 | u8 tid, bool buffered); | 3168 | u8 tid, bool buffered); |
| 3109 | 3169 | ||
| 3110 | /** | 3170 | /** |
| 3171 | * ieee80211_get_tx_rates - get the selected transmit rates for a packet | ||
| 3172 | * | ||
| 3173 | * Call this function in a driver with per-packet rate selection support | ||
| 3174 | * to combine the rate info in the packet tx info with the most recent | ||
| 3175 | * rate selection table for the station entry. | ||
| 3176 | * | ||
| 3177 | * @vif: &struct ieee80211_vif pointer from the add_interface callback. | ||
| 3178 | * @sta: the receiver station to which this packet is sent. | ||
| 3179 | * @skb: the frame to be transmitted. | ||
| 3180 | * @dest: buffer for extracted rate/retry information | ||
| 3181 | * @max_rates: maximum number of rates to fetch | ||
| 3182 | */ | ||
| 3183 | void ieee80211_get_tx_rates(struct ieee80211_vif *vif, | ||
| 3184 | struct ieee80211_sta *sta, | ||
| 3185 | struct sk_buff *skb, | ||
| 3186 | struct ieee80211_tx_rate *dest, | ||
| 3187 | int max_rates); | ||
| 3188 | |||
| 3189 | /** | ||
| 3111 | * ieee80211_tx_status - transmit status callback | 3190 | * ieee80211_tx_status - transmit status callback |
| 3112 | * | 3191 | * |
| 3113 | * Call this function for all transmitted frames after they have been | 3192 | * Call this function for all transmitted frames after they have been |
| @@ -3842,14 +3921,17 @@ void ieee80211_sta_block_awake(struct ieee80211_hw *hw, | |||
| 3842 | * %IEEE80211_TX_STATUS_EOSP bit and call this function instead. | 3921 | * %IEEE80211_TX_STATUS_EOSP bit and call this function instead. |
| 3843 | * This applies for PS-Poll as well as uAPSD. | 3922 | * This applies for PS-Poll as well as uAPSD. |
| 3844 | * | 3923 | * |
| 3845 | * Note that there is no non-_irqsafe version right now as | 3924 | * Note that just like with _tx_status() and _rx() drivers must |
| 3846 | * it wasn't needed, but just like _tx_status() and _rx() | 3925 | * not mix calls to irqsafe/non-irqsafe versions, this function |
| 3847 | * must not be mixed in irqsafe/non-irqsafe versions, this | 3926 | * must not be mixed with those either. Use the all irqsafe, or |
| 3848 | * function must not be mixed with those either. Use the | 3927 | * all non-irqsafe, don't mix! |
| 3849 | * all irqsafe, or all non-irqsafe, don't mix! If you need | 3928 | * |
| 3850 | * the non-irqsafe version of this, you need to add it. | 3929 | * NB: the _irqsafe version of this function doesn't exist, no |
| 3930 | * driver needs it right now. Don't call this function if | ||
| 3931 | * you'd need the _irqsafe version, look at the git history | ||
| 3932 | * and restore the _irqsafe version! | ||
| 3851 | */ | 3933 | */ |
| 3852 | void ieee80211_sta_eosp_irqsafe(struct ieee80211_sta *pubsta); | 3934 | void ieee80211_sta_eosp(struct ieee80211_sta *pubsta); |
| 3853 | 3935 | ||
| 3854 | /** | 3936 | /** |
| 3855 | * ieee80211_iter_keys - iterate keys programmed into the device | 3937 | * ieee80211_iter_keys - iterate keys programmed into the device |
| @@ -4079,7 +4161,7 @@ void ieee80211_send_bar(struct ieee80211_vif *vif, u8 *ra, u16 tid, u16 ssn); | |||
| 4079 | * (deprecated; this will be removed once drivers get updated to use | 4161 | * (deprecated; this will be removed once drivers get updated to use |
| 4080 | * rate_idx_mask) | 4162 | * rate_idx_mask) |
| 4081 | * @rate_idx_mask: user-requested (legacy) rate mask | 4163 | * @rate_idx_mask: user-requested (legacy) rate mask |
| 4082 | * @rate_idx_mcs_mask: user-requested MCS rate mask | 4164 | * @rate_idx_mcs_mask: user-requested MCS rate mask (NULL if not in use) |
| 4083 | * @bss: whether this frame is sent out in AP or IBSS mode | 4165 | * @bss: whether this frame is sent out in AP or IBSS mode |
| 4084 | */ | 4166 | */ |
| 4085 | struct ieee80211_tx_rate_control { | 4167 | struct ieee80211_tx_rate_control { |
| @@ -4091,7 +4173,7 @@ struct ieee80211_tx_rate_control { | |||
| 4091 | bool rts, short_preamble; | 4173 | bool rts, short_preamble; |
| 4092 | u8 max_rate_idx; | 4174 | u8 max_rate_idx; |
| 4093 | u32 rate_idx_mask; | 4175 | u32 rate_idx_mask; |
| 4094 | u8 rate_idx_mcs_mask[IEEE80211_HT_MCS_MASK_LEN]; | 4176 | u8 *rate_idx_mcs_mask; |
| 4095 | bool bss; | 4177 | bool bss; |
| 4096 | }; | 4178 | }; |
| 4097 | 4179 | ||
| @@ -4180,37 +4262,55 @@ bool rate_usable_index_exists(struct ieee80211_supported_band *sband, | |||
| 4180 | return false; | 4262 | return false; |
| 4181 | } | 4263 | } |
| 4182 | 4264 | ||
| 4265 | /** | ||
| 4266 | * rate_control_set_rates - pass the sta rate selection to mac80211/driver | ||
| 4267 | * | ||
| 4268 | * When not doing a rate control probe to test rates, rate control should pass | ||
| 4269 | * its rate selection to mac80211. If the driver supports receiving a station | ||
| 4270 | * rate table, it will use it to ensure that frames are always sent based on | ||
| 4271 | * the most recent rate control module decision. | ||
| 4272 | * | ||
| 4273 | * @hw: pointer as obtained from ieee80211_alloc_hw() | ||
| 4274 | * @pubsta: &struct ieee80211_sta pointer to the target destination. | ||
| 4275 | * @rates: new tx rate set to be used for this station. | ||
| 4276 | */ | ||
| 4277 | int rate_control_set_rates(struct ieee80211_hw *hw, | ||
| 4278 | struct ieee80211_sta *pubsta, | ||
| 4279 | struct ieee80211_sta_rates *rates); | ||
| 4280 | |||
| 4183 | int ieee80211_rate_control_register(struct rate_control_ops *ops); | 4281 | int ieee80211_rate_control_register(struct rate_control_ops *ops); |
| 4184 | void ieee80211_rate_control_unregister(struct rate_control_ops *ops); | 4282 | void ieee80211_rate_control_unregister(struct rate_control_ops *ops); |
| 4185 | 4283 | ||
| 4186 | static inline bool | 4284 | static inline bool |
| 4187 | conf_is_ht20(struct ieee80211_conf *conf) | 4285 | conf_is_ht20(struct ieee80211_conf *conf) |
| 4188 | { | 4286 | { |
| 4189 | return conf->channel_type == NL80211_CHAN_HT20; | 4287 | return conf->chandef.width == NL80211_CHAN_WIDTH_20; |
| 4190 | } | 4288 | } |
| 4191 | 4289 | ||
| 4192 | static inline bool | 4290 | static inline bool |
| 4193 | conf_is_ht40_minus(struct ieee80211_conf *conf) | 4291 | conf_is_ht40_minus(struct ieee80211_conf *conf) |
| 4194 | { | 4292 | { |
| 4195 | return conf->channel_type == NL80211_CHAN_HT40MINUS; | 4293 | return conf->chandef.width == NL80211_CHAN_WIDTH_40 && |
| 4294 | conf->chandef.center_freq1 < conf->chandef.chan->center_freq; | ||
| 4196 | } | 4295 | } |
| 4197 | 4296 | ||
| 4198 | static inline bool | 4297 | static inline bool |
| 4199 | conf_is_ht40_plus(struct ieee80211_conf *conf) | 4298 | conf_is_ht40_plus(struct ieee80211_conf *conf) |
| 4200 | { | 4299 | { |
| 4201 | return conf->channel_type == NL80211_CHAN_HT40PLUS; | 4300 | return conf->chandef.width == NL80211_CHAN_WIDTH_40 && |
| 4301 | conf->chandef.center_freq1 > conf->chandef.chan->center_freq; | ||
| 4202 | } | 4302 | } |
| 4203 | 4303 | ||
| 4204 | static inline bool | 4304 | static inline bool |
| 4205 | conf_is_ht40(struct ieee80211_conf *conf) | 4305 | conf_is_ht40(struct ieee80211_conf *conf) |
| 4206 | { | 4306 | { |
| 4207 | return conf_is_ht40_minus(conf) || conf_is_ht40_plus(conf); | 4307 | return conf->chandef.width == NL80211_CHAN_WIDTH_40; |
| 4208 | } | 4308 | } |
| 4209 | 4309 | ||
| 4210 | static inline bool | 4310 | static inline bool |
| 4211 | conf_is_ht(struct ieee80211_conf *conf) | 4311 | conf_is_ht(struct ieee80211_conf *conf) |
| 4212 | { | 4312 | { |
| 4213 | return conf->channel_type != NL80211_CHAN_NO_HT; | 4313 | return conf->chandef.width != NL80211_CHAN_WIDTH_20_NOHT; |
| 4214 | } | 4314 | } |
| 4215 | 4315 | ||
| 4216 | static inline enum nl80211_iftype | 4316 | static inline enum nl80211_iftype |
diff --git a/include/net/net_namespace.h b/include/net/net_namespace.h index de644bcd8613..b17697827482 100644 --- a/include/net/net_namespace.h +++ b/include/net/net_namespace.h | |||
| @@ -17,6 +17,7 @@ | |||
| 17 | #include <net/netns/ipv6.h> | 17 | #include <net/netns/ipv6.h> |
| 18 | #include <net/netns/sctp.h> | 18 | #include <net/netns/sctp.h> |
| 19 | #include <net/netns/dccp.h> | 19 | #include <net/netns/dccp.h> |
| 20 | #include <net/netns/netfilter.h> | ||
| 20 | #include <net/netns/x_tables.h> | 21 | #include <net/netns/x_tables.h> |
| 21 | #if defined(CONFIG_NF_CONNTRACK) || defined(CONFIG_NF_CONNTRACK_MODULE) | 22 | #if defined(CONFIG_NF_CONNTRACK) || defined(CONFIG_NF_CONNTRACK_MODULE) |
| 22 | #include <net/netns/conntrack.h> | 23 | #include <net/netns/conntrack.h> |
| @@ -94,6 +95,7 @@ struct net { | |||
| 94 | struct netns_dccp dccp; | 95 | struct netns_dccp dccp; |
| 95 | #endif | 96 | #endif |
| 96 | #ifdef CONFIG_NETFILTER | 97 | #ifdef CONFIG_NETFILTER |
| 98 | struct netns_nf nf; | ||
| 97 | struct netns_xt xt; | 99 | struct netns_xt xt; |
| 98 | #if defined(CONFIG_NF_CONNTRACK) || defined(CONFIG_NF_CONNTRACK_MODULE) | 100 | #if defined(CONFIG_NF_CONNTRACK) || defined(CONFIG_NF_CONNTRACK_MODULE) |
| 99 | struct netns_ct ct; | 101 | struct netns_ct ct; |
diff --git a/include/net/netfilter/nf_conntrack.h b/include/net/netfilter/nf_conntrack.h index caca0c4d6b4b..644d9c223d24 100644 --- a/include/net/netfilter/nf_conntrack.h +++ b/include/net/netfilter/nf_conntrack.h | |||
| @@ -184,7 +184,7 @@ extern int nf_conntrack_hash_check_insert(struct nf_conn *ct); | |||
| 184 | extern void nf_ct_delete_from_lists(struct nf_conn *ct); | 184 | extern void nf_ct_delete_from_lists(struct nf_conn *ct); |
| 185 | extern void nf_ct_dying_timeout(struct nf_conn *ct); | 185 | extern void nf_ct_dying_timeout(struct nf_conn *ct); |
| 186 | 186 | ||
| 187 | extern void nf_conntrack_flush_report(struct net *net, u32 pid, int report); | 187 | extern void nf_conntrack_flush_report(struct net *net, u32 portid, int report); |
| 188 | 188 | ||
| 189 | extern bool nf_ct_get_tuplepr(const struct sk_buff *skb, | 189 | extern bool nf_ct_get_tuplepr(const struct sk_buff *skb, |
| 190 | unsigned int nhoff, u_int16_t l3num, | 190 | unsigned int nhoff, u_int16_t l3num, |
diff --git a/include/net/netfilter/nf_conntrack_core.h b/include/net/netfilter/nf_conntrack_core.h index 930275fa2ea6..fb2b6234e937 100644 --- a/include/net/netfilter/nf_conntrack_core.h +++ b/include/net/netfilter/nf_conntrack_core.h | |||
| @@ -27,6 +27,7 @@ extern unsigned int nf_conntrack_in(struct net *net, | |||
| 27 | 27 | ||
| 28 | extern int nf_conntrack_init_net(struct net *net); | 28 | extern int nf_conntrack_init_net(struct net *net); |
| 29 | extern void nf_conntrack_cleanup_net(struct net *net); | 29 | extern void nf_conntrack_cleanup_net(struct net *net); |
| 30 | extern void nf_conntrack_cleanup_net_list(struct list_head *net_exit_list); | ||
| 30 | 31 | ||
| 31 | extern int nf_conntrack_proto_pernet_init(struct net *net); | 32 | extern int nf_conntrack_proto_pernet_init(struct net *net); |
| 32 | extern void nf_conntrack_proto_pernet_fini(struct net *net); | 33 | extern void nf_conntrack_proto_pernet_fini(struct net *net); |
diff --git a/include/net/netfilter/nf_conntrack_expect.h b/include/net/netfilter/nf_conntrack_expect.h index cbbae7621e22..3f3aecbc8632 100644 --- a/include/net/netfilter/nf_conntrack_expect.h +++ b/include/net/netfilter/nf_conntrack_expect.h | |||
| @@ -88,7 +88,7 @@ nf_ct_find_expectation(struct net *net, u16 zone, | |||
| 88 | const struct nf_conntrack_tuple *tuple); | 88 | const struct nf_conntrack_tuple *tuple); |
| 89 | 89 | ||
| 90 | void nf_ct_unlink_expect_report(struct nf_conntrack_expect *exp, | 90 | void nf_ct_unlink_expect_report(struct nf_conntrack_expect *exp, |
| 91 | u32 pid, int report); | 91 | u32 portid, int report); |
| 92 | static inline void nf_ct_unlink_expect(struct nf_conntrack_expect *exp) | 92 | static inline void nf_ct_unlink_expect(struct nf_conntrack_expect *exp) |
| 93 | { | 93 | { |
| 94 | nf_ct_unlink_expect_report(exp, 0, 0); | 94 | nf_ct_unlink_expect_report(exp, 0, 0); |
| @@ -106,7 +106,7 @@ void nf_ct_expect_init(struct nf_conntrack_expect *, unsigned int, u_int8_t, | |||
| 106 | u_int8_t, const __be16 *, const __be16 *); | 106 | u_int8_t, const __be16 *, const __be16 *); |
| 107 | void nf_ct_expect_put(struct nf_conntrack_expect *exp); | 107 | void nf_ct_expect_put(struct nf_conntrack_expect *exp); |
| 108 | int nf_ct_expect_related_report(struct nf_conntrack_expect *expect, | 108 | int nf_ct_expect_related_report(struct nf_conntrack_expect *expect, |
| 109 | u32 pid, int report); | 109 | u32 portid, int report); |
| 110 | static inline int nf_ct_expect_related(struct nf_conntrack_expect *expect) | 110 | static inline int nf_ct_expect_related(struct nf_conntrack_expect *expect) |
| 111 | { | 111 | { |
| 112 | return nf_ct_expect_related_report(expect, 0, 0); | 112 | return nf_ct_expect_related_report(expect, 0, 0); |
diff --git a/include/net/netfilter/nf_log.h b/include/net/netfilter/nf_log.h index e991bd0a27af..31f1fb9eb784 100644 --- a/include/net/netfilter/nf_log.h +++ b/include/net/netfilter/nf_log.h | |||
| @@ -49,12 +49,18 @@ struct nf_logger { | |||
| 49 | int nf_log_register(u_int8_t pf, struct nf_logger *logger); | 49 | int nf_log_register(u_int8_t pf, struct nf_logger *logger); |
| 50 | void nf_log_unregister(struct nf_logger *logger); | 50 | void nf_log_unregister(struct nf_logger *logger); |
| 51 | 51 | ||
| 52 | int nf_log_bind_pf(u_int8_t pf, const struct nf_logger *logger); | 52 | void nf_log_set(struct net *net, u_int8_t pf, |
| 53 | void nf_log_unbind_pf(u_int8_t pf); | 53 | const struct nf_logger *logger); |
| 54 | void nf_log_unset(struct net *net, const struct nf_logger *logger); | ||
| 55 | |||
| 56 | int nf_log_bind_pf(struct net *net, u_int8_t pf, | ||
| 57 | const struct nf_logger *logger); | ||
| 58 | void nf_log_unbind_pf(struct net *net, u_int8_t pf); | ||
| 54 | 59 | ||
| 55 | /* Calls the registered backend logging function */ | 60 | /* Calls the registered backend logging function */ |
| 56 | __printf(7, 8) | 61 | __printf(8, 9) |
| 57 | void nf_log_packet(u_int8_t pf, | 62 | void nf_log_packet(struct net *net, |
| 63 | u_int8_t pf, | ||
| 58 | unsigned int hooknum, | 64 | unsigned int hooknum, |
| 59 | const struct sk_buff *skb, | 65 | const struct sk_buff *skb, |
| 60 | const struct net_device *in, | 66 | const struct net_device *in, |
diff --git a/include/net/netfilter/nf_queue.h b/include/net/netfilter/nf_queue.h index fb1c0be38b6d..aaba4bbcdda0 100644 --- a/include/net/netfilter/nf_queue.h +++ b/include/net/netfilter/nf_queue.h | |||
| @@ -9,10 +9,13 @@ struct nf_queue_entry { | |||
| 9 | 9 | ||
| 10 | struct nf_hook_ops *elem; | 10 | struct nf_hook_ops *elem; |
| 11 | u_int8_t pf; | 11 | u_int8_t pf; |
| 12 | u16 size; /* sizeof(entry) + saved route keys */ | ||
| 12 | unsigned int hook; | 13 | unsigned int hook; |
| 13 | struct net_device *indev; | 14 | struct net_device *indev; |
| 14 | struct net_device *outdev; | 15 | struct net_device *outdev; |
| 15 | int (*okfn)(struct sk_buff *); | 16 | int (*okfn)(struct sk_buff *); |
| 17 | |||
| 18 | /* extra space to store route keys */ | ||
| 16 | }; | 19 | }; |
| 17 | 20 | ||
| 18 | #define nf_queue_entry_reroute(x) ((void *)x + sizeof(struct nf_queue_entry)) | 21 | #define nf_queue_entry_reroute(x) ((void *)x + sizeof(struct nf_queue_entry)) |
| @@ -27,4 +30,7 @@ void nf_register_queue_handler(const struct nf_queue_handler *qh); | |||
| 27 | void nf_unregister_queue_handler(void); | 30 | void nf_unregister_queue_handler(void); |
| 28 | extern void nf_reinject(struct nf_queue_entry *entry, unsigned int verdict); | 31 | extern void nf_reinject(struct nf_queue_entry *entry, unsigned int verdict); |
| 29 | 32 | ||
| 33 | bool nf_queue_entry_get_refs(struct nf_queue_entry *entry); | ||
| 34 | void nf_queue_entry_release_refs(struct nf_queue_entry *entry); | ||
| 35 | |||
| 30 | #endif /* _NF_QUEUE_H */ | 36 | #endif /* _NF_QUEUE_H */ |
diff --git a/include/net/netns/ipv6.h b/include/net/netns/ipv6.h index 1242f371718b..005e2c2e39a9 100644 --- a/include/net/netns/ipv6.h +++ b/include/net/netns/ipv6.h | |||
| @@ -71,6 +71,7 @@ struct netns_ipv6 { | |||
| 71 | struct fib_rules_ops *mr6_rules_ops; | 71 | struct fib_rules_ops *mr6_rules_ops; |
| 72 | #endif | 72 | #endif |
| 73 | #endif | 73 | #endif |
| 74 | atomic_t dev_addr_genid; | ||
| 74 | }; | 75 | }; |
| 75 | 76 | ||
| 76 | #if IS_ENABLED(CONFIG_NF_DEFRAG_IPV6) | 77 | #if IS_ENABLED(CONFIG_NF_DEFRAG_IPV6) |
diff --git a/include/net/netns/netfilter.h b/include/net/netns/netfilter.h new file mode 100644 index 000000000000..88740024ccf3 --- /dev/null +++ b/include/net/netns/netfilter.h | |||
| @@ -0,0 +1,18 @@ | |||
| 1 | #ifndef __NETNS_NETFILTER_H | ||
| 2 | #define __NETNS_NETFILTER_H | ||
| 3 | |||
| 4 | #include <linux/proc_fs.h> | ||
| 5 | #include <linux/netfilter.h> | ||
| 6 | |||
| 7 | struct nf_logger; | ||
| 8 | |||
| 9 | struct netns_nf { | ||
| 10 | #if defined CONFIG_PROC_FS | ||
| 11 | struct proc_dir_entry *proc_netfilter; | ||
| 12 | #endif | ||
| 13 | const struct nf_logger __rcu *nf_loggers[NFPROTO_NUMPROTO]; | ||
| 14 | #ifdef CONFIG_SYSCTL | ||
| 15 | struct ctl_table_header *nf_log_dir_header; | ||
| 16 | #endif | ||
| 17 | }; | ||
| 18 | #endif | ||
diff --git a/include/net/netprio_cgroup.h b/include/net/netprio_cgroup.h index 1d04b6f0fbd4..50ab8c26ab59 100644 --- a/include/net/netprio_cgroup.h +++ b/include/net/netprio_cgroup.h | |||
| @@ -29,7 +29,7 @@ struct cgroup_netprio_state { | |||
| 29 | struct cgroup_subsys_state css; | 29 | struct cgroup_subsys_state css; |
| 30 | }; | 30 | }; |
| 31 | 31 | ||
| 32 | extern void sock_update_netprioidx(struct sock *sk, struct task_struct *task); | 32 | extern void sock_update_netprioidx(struct sock *sk); |
| 33 | 33 | ||
| 34 | #if IS_BUILTIN(CONFIG_NETPRIO_CGROUP) | 34 | #if IS_BUILTIN(CONFIG_NETPRIO_CGROUP) |
| 35 | 35 | ||
| @@ -68,7 +68,7 @@ static inline u32 task_netprioidx(struct task_struct *p) | |||
| 68 | return 0; | 68 | return 0; |
| 69 | } | 69 | } |
| 70 | 70 | ||
| 71 | #define sock_update_netprioidx(sk, task) | 71 | #define sock_update_netprioidx(sk) |
| 72 | 72 | ||
| 73 | #endif /* CONFIG_NETPRIO_CGROUP */ | 73 | #endif /* CONFIG_NETPRIO_CGROUP */ |
| 74 | 74 | ||
diff --git a/include/net/nfc/nfc.h b/include/net/nfc/nfc.h index 87a6417fc934..5eb80bb3cbb2 100644 --- a/include/net/nfc/nfc.h +++ b/include/net/nfc/nfc.h | |||
| @@ -122,6 +122,8 @@ struct nfc_dev { | |||
| 122 | 122 | ||
| 123 | bool shutting_down; | 123 | bool shutting_down; |
| 124 | 124 | ||
| 125 | struct rfkill *rfkill; | ||
| 126 | |||
| 125 | struct nfc_ops *ops; | 127 | struct nfc_ops *ops; |
| 126 | }; | 128 | }; |
| 127 | #define to_nfc_dev(_dev) container_of(_dev, struct nfc_dev, dev) | 129 | #define to_nfc_dev(_dev) container_of(_dev, struct nfc_dev, dev) |
diff --git a/include/net/request_sock.h b/include/net/request_sock.h index a51dbd17c2de..59795e42c8b6 100644 --- a/include/net/request_sock.h +++ b/include/net/request_sock.h | |||
| @@ -27,19 +27,13 @@ struct sk_buff; | |||
| 27 | struct dst_entry; | 27 | struct dst_entry; |
| 28 | struct proto; | 28 | struct proto; |
| 29 | 29 | ||
| 30 | /* empty to "strongly type" an otherwise void parameter. | ||
| 31 | */ | ||
| 32 | struct request_values { | ||
| 33 | }; | ||
| 34 | |||
| 35 | struct request_sock_ops { | 30 | struct request_sock_ops { |
| 36 | int family; | 31 | int family; |
| 37 | int obj_size; | 32 | int obj_size; |
| 38 | struct kmem_cache *slab; | 33 | struct kmem_cache *slab; |
| 39 | char *slab_name; | 34 | char *slab_name; |
| 40 | int (*rtx_syn_ack)(struct sock *sk, | 35 | int (*rtx_syn_ack)(struct sock *sk, |
| 41 | struct request_sock *req, | 36 | struct request_sock *req); |
| 42 | struct request_values *rvp); | ||
| 43 | void (*send_ack)(struct sock *sk, struct sk_buff *skb, | 37 | void (*send_ack)(struct sock *sk, struct sk_buff *skb, |
| 44 | struct request_sock *req); | 38 | struct request_sock *req); |
| 45 | void (*send_reset)(struct sock *sk, | 39 | void (*send_reset)(struct sock *sk, |
| @@ -54,7 +48,7 @@ extern int inet_rtx_syn_ack(struct sock *parent, struct request_sock *req); | |||
| 54 | /* struct request_sock - mini sock to represent a connection request | 48 | /* struct request_sock - mini sock to represent a connection request |
| 55 | */ | 49 | */ |
| 56 | struct request_sock { | 50 | struct request_sock { |
| 57 | struct request_sock *dl_next; /* Must be first member! */ | 51 | struct request_sock *dl_next; |
| 58 | u16 mss; | 52 | u16 mss; |
| 59 | u8 num_retrans; /* number of retransmits */ | 53 | u8 num_retrans; /* number of retransmits */ |
| 60 | u8 cookie_ts:1; /* syncookie: encode tcpopts in timestamp */ | 54 | u8 cookie_ts:1; /* syncookie: encode tcpopts in timestamp */ |
diff --git a/include/net/rtnetlink.h b/include/net/rtnetlink.h index 5a15fabd6a75..702664833a53 100644 --- a/include/net/rtnetlink.h +++ b/include/net/rtnetlink.h | |||
| @@ -4,7 +4,7 @@ | |||
| 4 | #include <linux/rtnetlink.h> | 4 | #include <linux/rtnetlink.h> |
| 5 | #include <net/netlink.h> | 5 | #include <net/netlink.h> |
| 6 | 6 | ||
| 7 | typedef int (*rtnl_doit_func)(struct sk_buff *, struct nlmsghdr *, void *); | 7 | typedef int (*rtnl_doit_func)(struct sk_buff *, struct nlmsghdr *); |
| 8 | typedef int (*rtnl_dumpit_func)(struct sk_buff *, struct netlink_callback *); | 8 | typedef int (*rtnl_dumpit_func)(struct sk_buff *, struct netlink_callback *); |
| 9 | typedef u16 (*rtnl_calcit_func)(struct sk_buff *, struct nlmsghdr *); | 9 | typedef u16 (*rtnl_calcit_func)(struct sk_buff *, struct nlmsghdr *); |
| 10 | 10 | ||
diff --git a/include/net/scm.h b/include/net/scm.h index b11708105681..8de2d37d2077 100644 --- a/include/net/scm.h +++ b/include/net/scm.h | |||
| @@ -26,7 +26,6 @@ struct scm_fp_list { | |||
| 26 | 26 | ||
| 27 | struct scm_cookie { | 27 | struct scm_cookie { |
| 28 | struct pid *pid; /* Skb credentials */ | 28 | struct pid *pid; /* Skb credentials */ |
| 29 | const struct cred *cred; | ||
| 30 | struct scm_fp_list *fp; /* Passed files */ | 29 | struct scm_fp_list *fp; /* Passed files */ |
| 31 | struct scm_creds creds; /* Skb credentials */ | 30 | struct scm_creds creds; /* Skb credentials */ |
| 32 | #ifdef CONFIG_SECURITY_NETWORK | 31 | #ifdef CONFIG_SECURITY_NETWORK |
| @@ -51,23 +50,18 @@ static __inline__ void unix_get_peersec_dgram(struct socket *sock, struct scm_co | |||
| 51 | #endif /* CONFIG_SECURITY_NETWORK */ | 50 | #endif /* CONFIG_SECURITY_NETWORK */ |
| 52 | 51 | ||
| 53 | static __inline__ void scm_set_cred(struct scm_cookie *scm, | 52 | static __inline__ void scm_set_cred(struct scm_cookie *scm, |
| 54 | struct pid *pid, const struct cred *cred) | 53 | struct pid *pid, kuid_t uid, kgid_t gid) |
| 55 | { | 54 | { |
| 56 | scm->pid = get_pid(pid); | 55 | scm->pid = get_pid(pid); |
| 57 | scm->cred = cred ? get_cred(cred) : NULL; | ||
| 58 | scm->creds.pid = pid_vnr(pid); | 56 | scm->creds.pid = pid_vnr(pid); |
| 59 | scm->creds.uid = cred ? cred->uid : INVALID_UID; | 57 | scm->creds.uid = uid; |
| 60 | scm->creds.gid = cred ? cred->gid : INVALID_GID; | 58 | scm->creds.gid = gid; |
| 61 | } | 59 | } |
| 62 | 60 | ||
| 63 | static __inline__ void scm_destroy_cred(struct scm_cookie *scm) | 61 | static __inline__ void scm_destroy_cred(struct scm_cookie *scm) |
| 64 | { | 62 | { |
| 65 | put_pid(scm->pid); | 63 | put_pid(scm->pid); |
| 66 | scm->pid = NULL; | 64 | scm->pid = NULL; |
| 67 | |||
| 68 | if (scm->cred) | ||
| 69 | put_cred(scm->cred); | ||
| 70 | scm->cred = NULL; | ||
| 71 | } | 65 | } |
| 72 | 66 | ||
| 73 | static __inline__ void scm_destroy(struct scm_cookie *scm) | 67 | static __inline__ void scm_destroy(struct scm_cookie *scm) |
| @@ -81,8 +75,10 @@ static __inline__ int scm_send(struct socket *sock, struct msghdr *msg, | |||
| 81 | struct scm_cookie *scm, bool forcecreds) | 75 | struct scm_cookie *scm, bool forcecreds) |
| 82 | { | 76 | { |
| 83 | memset(scm, 0, sizeof(*scm)); | 77 | memset(scm, 0, sizeof(*scm)); |
| 78 | scm->creds.uid = INVALID_UID; | ||
| 79 | scm->creds.gid = INVALID_GID; | ||
| 84 | if (forcecreds) | 80 | if (forcecreds) |
| 85 | scm_set_cred(scm, task_tgid(current), current_cred()); | 81 | scm_set_cred(scm, task_tgid(current), current_uid(), current_gid()); |
| 86 | unix_get_peersec_dgram(sock, scm); | 82 | unix_get_peersec_dgram(sock, scm); |
| 87 | if (msg->msg_controllen <= 0) | 83 | if (msg->msg_controllen <= 0) |
| 88 | return 0; | 84 | return 0; |
diff --git a/include/net/sctp/checksum.h b/include/net/sctp/checksum.h index befc8d2a1b9f..5a2110d3176d 100644 --- a/include/net/sctp/checksum.h +++ b/include/net/sctp/checksum.h | |||
| @@ -77,7 +77,7 @@ static inline __u32 sctp_update_cksum(__u8 *buffer, __u16 length, __u32 crc32) | |||
| 77 | return sctp_crc32c(crc32, buffer, length); | 77 | return sctp_crc32c(crc32, buffer, length); |
| 78 | } | 78 | } |
| 79 | 79 | ||
| 80 | static inline __le32 sctp_end_cksum(__be32 crc32) | 80 | static inline __le32 sctp_end_cksum(__u32 crc32) |
| 81 | { | 81 | { |
| 82 | return cpu_to_le32(~crc32); | 82 | return cpu_to_le32(~crc32); |
| 83 | } | 83 | } |
diff --git a/include/net/sctp/constants.h b/include/net/sctp/constants.h index a7dd5c50df79..ca50e0751e47 100644 --- a/include/net/sctp/constants.h +++ b/include/net/sctp/constants.h | |||
| @@ -49,7 +49,6 @@ | |||
| 49 | 49 | ||
| 50 | #include <linux/sctp.h> | 50 | #include <linux/sctp.h> |
| 51 | #include <linux/ipv6.h> /* For ipv6hdr. */ | 51 | #include <linux/ipv6.h> /* For ipv6hdr. */ |
| 52 | #include <net/sctp/user.h> | ||
| 53 | #include <net/tcp_states.h> /* For TCP states used in sctp_sock_state_t */ | 52 | #include <net/tcp_states.h> /* For TCP states used in sctp_sock_state_t */ |
| 54 | 53 | ||
| 55 | /* Value used for stream negotiation. */ | 54 | /* Value used for stream negotiation. */ |
diff --git a/include/net/sctp/structs.h b/include/net/sctp/structs.h index 0e0f9d2322e3..1bd4c4144fe8 100644 --- a/include/net/sctp/structs.h +++ b/include/net/sctp/structs.h | |||
| @@ -399,7 +399,6 @@ struct sctp_stream { | |||
| 399 | struct sctp_ssnmap { | 399 | struct sctp_ssnmap { |
| 400 | struct sctp_stream in; | 400 | struct sctp_stream in; |
| 401 | struct sctp_stream out; | 401 | struct sctp_stream out; |
| 402 | int malloced; | ||
| 403 | }; | 402 | }; |
| 404 | 403 | ||
| 405 | struct sctp_ssnmap *sctp_ssnmap_new(__u16 in, __u16 out, | 404 | struct sctp_ssnmap *sctp_ssnmap_new(__u16 in, __u16 out, |
| @@ -715,8 +714,7 @@ struct sctp_packet { | |||
| 715 | has_sack:1, /* This packet contains a SACK chunk. */ | 714 | has_sack:1, /* This packet contains a SACK chunk. */ |
| 716 | has_auth:1, /* This packet contains an AUTH chunk */ | 715 | has_auth:1, /* This packet contains an AUTH chunk */ |
| 717 | has_data:1, /* This packet contains at least 1 DATA chunk */ | 716 | has_data:1, /* This packet contains at least 1 DATA chunk */ |
| 718 | ipfragok:1, /* So let ip fragment this packet */ | 717 | ipfragok:1; /* So let ip fragment this packet */ |
| 719 | malloced:1; /* Is it malloced? */ | ||
| 720 | }; | 718 | }; |
| 721 | 719 | ||
| 722 | struct sctp_packet *sctp_packet_init(struct sctp_packet *, | 720 | struct sctp_packet *sctp_packet_init(struct sctp_packet *, |
| @@ -780,10 +778,7 @@ struct sctp_transport { | |||
| 780 | hb_sent:1, | 778 | hb_sent:1, |
| 781 | 779 | ||
| 782 | /* Is the Path MTU update pending on this tranport */ | 780 | /* Is the Path MTU update pending on this tranport */ |
| 783 | pmtu_pending:1, | 781 | pmtu_pending:1; |
| 784 | |||
| 785 | /* Is this structure kfree()able? */ | ||
| 786 | malloced:1; | ||
| 787 | 782 | ||
| 788 | /* Has this transport moved the ctsn since we last sacked */ | 783 | /* Has this transport moved the ctsn since we last sacked */ |
| 789 | __u32 sack_generation; | 784 | __u32 sack_generation; |
| @@ -992,8 +987,6 @@ struct sctp_inq { | |||
| 992 | * messages. | 987 | * messages. |
| 993 | */ | 988 | */ |
| 994 | struct work_struct immediate; | 989 | struct work_struct immediate; |
| 995 | |||
| 996 | int malloced; /* Is this structure kfree()able? */ | ||
| 997 | }; | 990 | }; |
| 998 | 991 | ||
| 999 | void sctp_inq_init(struct sctp_inq *); | 992 | void sctp_inq_init(struct sctp_inq *); |
| @@ -1062,9 +1055,6 @@ struct sctp_outq { | |||
| 1062 | 1055 | ||
| 1063 | /* Is this structure empty? */ | 1056 | /* Is this structure empty? */ |
| 1064 | char empty; | 1057 | char empty; |
| 1065 | |||
| 1066 | /* Are we kfree()able? */ | ||
| 1067 | char malloced; | ||
| 1068 | }; | 1058 | }; |
| 1069 | 1059 | ||
| 1070 | void sctp_outq_init(struct sctp_association *, struct sctp_outq *); | 1060 | void sctp_outq_init(struct sctp_association *, struct sctp_outq *); |
| @@ -1102,8 +1092,6 @@ struct sctp_bind_addr { | |||
| 1102 | * peer(s) in INIT and INIT ACK chunks. | 1092 | * peer(s) in INIT and INIT ACK chunks. |
| 1103 | */ | 1093 | */ |
| 1104 | struct list_head address_list; | 1094 | struct list_head address_list; |
| 1105 | |||
| 1106 | int malloced; /* Are we kfree()able? */ | ||
| 1107 | }; | 1095 | }; |
| 1108 | 1096 | ||
| 1109 | void sctp_bind_addr_init(struct sctp_bind_addr *, __u16 port); | 1097 | void sctp_bind_addr_init(struct sctp_bind_addr *, __u16 port); |
| @@ -1174,11 +1162,9 @@ struct sctp_ep_common { | |||
| 1174 | /* Some fields to help us manage this object. | 1162 | /* Some fields to help us manage this object. |
| 1175 | * refcnt - Reference count access to this object. | 1163 | * refcnt - Reference count access to this object. |
| 1176 | * dead - Do not attempt to use this object. | 1164 | * dead - Do not attempt to use this object. |
| 1177 | * malloced - Do we need to kfree this object? | ||
| 1178 | */ | 1165 | */ |
| 1179 | atomic_t refcnt; | 1166 | atomic_t refcnt; |
| 1180 | char dead; | 1167 | bool dead; |
| 1181 | char malloced; | ||
| 1182 | 1168 | ||
| 1183 | /* What socket does this endpoint belong to? */ | 1169 | /* What socket does this endpoint belong to? */ |
| 1184 | struct sock *sk; | 1170 | struct sock *sk; |
diff --git a/include/net/sctp/ulpqueue.h b/include/net/sctp/ulpqueue.h index ff1b8ba73ab1..00e50ba3f24b 100644 --- a/include/net/sctp/ulpqueue.h +++ b/include/net/sctp/ulpqueue.h | |||
| @@ -49,7 +49,6 @@ | |||
| 49 | 49 | ||
| 50 | /* A structure to carry information to the ULP (e.g. Sockets API) */ | 50 | /* A structure to carry information to the ULP (e.g. Sockets API) */ |
| 51 | struct sctp_ulpq { | 51 | struct sctp_ulpq { |
| 52 | char malloced; | ||
| 53 | char pd_mode; | 52 | char pd_mode; |
| 54 | struct sctp_association *asoc; | 53 | struct sctp_association *asoc; |
| 55 | struct sk_buff_head reasm; | 54 | struct sk_buff_head reasm; |
diff --git a/include/net/secure_seq.h b/include/net/secure_seq.h index c2e542b27a5a..6ca975bebd37 100644 --- a/include/net/secure_seq.h +++ b/include/net/secure_seq.h | |||
| @@ -3,6 +3,7 @@ | |||
| 3 | 3 | ||
| 4 | #include <linux/types.h> | 4 | #include <linux/types.h> |
| 5 | 5 | ||
| 6 | extern void net_secret_init(void); | ||
| 6 | extern __u32 secure_ip_id(__be32 daddr); | 7 | extern __u32 secure_ip_id(__be32 daddr); |
| 7 | extern __u32 secure_ipv6_id(const __be32 daddr[4]); | 8 | extern __u32 secure_ipv6_id(const __be32 daddr[4]); |
| 8 | extern u32 secure_ipv4_port_ephemeral(__be32 saddr, __be32 daddr, __be16 dport); | 9 | extern u32 secure_ipv4_port_ephemeral(__be32 saddr, __be32 daddr, __be16 dport); |
diff --git a/include/net/sock.h b/include/net/sock.h index 14f6e9d19dc7..5c97b0fc5623 100644 --- a/include/net/sock.h +++ b/include/net/sock.h | |||
| @@ -667,6 +667,7 @@ enum sock_flags { | |||
| 667 | * user-space instead. | 667 | * user-space instead. |
| 668 | */ | 668 | */ |
| 669 | SOCK_FILTER_LOCKED, /* Filter cannot be changed anymore */ | 669 | SOCK_FILTER_LOCKED, /* Filter cannot be changed anymore */ |
| 670 | SOCK_SELECT_ERR_QUEUE, /* Wake select on error queue */ | ||
| 670 | }; | 671 | }; |
| 671 | 672 | ||
| 672 | static inline void sock_copy_flags(struct sock *nsk, struct sock *osk) | 673 | static inline void sock_copy_flags(struct sock *nsk, struct sock *osk) |
| @@ -2158,10 +2159,9 @@ static inline void sock_recv_ts_and_drops(struct msghdr *msg, struct sock *sk, | |||
| 2158 | * @sk: socket sending this packet | 2159 | * @sk: socket sending this packet |
| 2159 | * @tx_flags: filled with instructions for time stamping | 2160 | * @tx_flags: filled with instructions for time stamping |
| 2160 | * | 2161 | * |
| 2161 | * Currently only depends on SOCK_TIMESTAMPING* flags. Returns error code if | 2162 | * Currently only depends on SOCK_TIMESTAMPING* flags. |
| 2162 | * parameters are invalid. | ||
| 2163 | */ | 2163 | */ |
| 2164 | extern int sock_tx_timestamp(struct sock *sk, __u8 *tx_flags); | 2164 | extern void sock_tx_timestamp(struct sock *sk, __u8 *tx_flags); |
| 2165 | 2165 | ||
| 2166 | /** | 2166 | /** |
| 2167 | * sk_eat_skb - Release a skb if it is no longer needed | 2167 | * sk_eat_skb - Release a skb if it is no longer needed |
diff --git a/include/net/tcp.h b/include/net/tcp.h index cf0694d4ad60..5bba80fbd1d9 100644 --- a/include/net/tcp.h +++ b/include/net/tcp.h | |||
| @@ -179,7 +179,6 @@ extern void tcp_time_wait(struct sock *sk, int state, int timeo); | |||
| 179 | #define TCPOPT_SACK 5 /* SACK Block */ | 179 | #define TCPOPT_SACK 5 /* SACK Block */ |
| 180 | #define TCPOPT_TIMESTAMP 8 /* Better RTT estimations/PAWS */ | 180 | #define TCPOPT_TIMESTAMP 8 /* Better RTT estimations/PAWS */ |
| 181 | #define TCPOPT_MD5SIG 19 /* MD5 Signature (RFC2385) */ | 181 | #define TCPOPT_MD5SIG 19 /* MD5 Signature (RFC2385) */ |
| 182 | #define TCPOPT_COOKIE 253 /* Cookie extension (experimental) */ | ||
| 183 | #define TCPOPT_EXP 254 /* Experimental */ | 182 | #define TCPOPT_EXP 254 /* Experimental */ |
| 184 | /* Magic number to be after the option value for sharing TCP | 183 | /* Magic number to be after the option value for sharing TCP |
| 185 | * experimental options. See draft-ietf-tcpm-experimental-options-00.txt | 184 | * experimental options. See draft-ietf-tcpm-experimental-options-00.txt |
| @@ -273,7 +272,6 @@ extern int sysctl_tcp_app_win; | |||
| 273 | extern int sysctl_tcp_adv_win_scale; | 272 | extern int sysctl_tcp_adv_win_scale; |
| 274 | extern int sysctl_tcp_tw_reuse; | 273 | extern int sysctl_tcp_tw_reuse; |
| 275 | extern int sysctl_tcp_frto; | 274 | extern int sysctl_tcp_frto; |
| 276 | extern int sysctl_tcp_frto_response; | ||
| 277 | extern int sysctl_tcp_low_latency; | 275 | extern int sysctl_tcp_low_latency; |
| 278 | extern int sysctl_tcp_dma_copybreak; | 276 | extern int sysctl_tcp_dma_copybreak; |
| 279 | extern int sysctl_tcp_nometrics_save; | 277 | extern int sysctl_tcp_nometrics_save; |
| @@ -284,7 +282,6 @@ extern int sysctl_tcp_base_mss; | |||
| 284 | extern int sysctl_tcp_workaround_signed_windows; | 282 | extern int sysctl_tcp_workaround_signed_windows; |
| 285 | extern int sysctl_tcp_slow_start_after_idle; | 283 | extern int sysctl_tcp_slow_start_after_idle; |
| 286 | extern int sysctl_tcp_max_ssthresh; | 284 | extern int sysctl_tcp_max_ssthresh; |
| 287 | extern int sysctl_tcp_cookie_size; | ||
| 288 | extern int sysctl_tcp_thin_linear_timeouts; | 285 | extern int sysctl_tcp_thin_linear_timeouts; |
| 289 | extern int sysctl_tcp_thin_dupack; | 286 | extern int sysctl_tcp_thin_dupack; |
| 290 | extern int sysctl_tcp_early_retrans; | 287 | extern int sysctl_tcp_early_retrans; |
| @@ -373,6 +370,7 @@ extern int tcp_sendmsg(struct kiocb *iocb, struct sock *sk, struct msghdr *msg, | |||
| 373 | extern int tcp_sendpage(struct sock *sk, struct page *page, int offset, | 370 | extern int tcp_sendpage(struct sock *sk, struct page *page, int offset, |
| 374 | size_t size, int flags); | 371 | size_t size, int flags); |
| 375 | extern void tcp_release_cb(struct sock *sk); | 372 | extern void tcp_release_cb(struct sock *sk); |
| 373 | extern void tcp_wfree(struct sk_buff *skb); | ||
| 376 | extern void tcp_write_timer_handler(struct sock *sk); | 374 | extern void tcp_write_timer_handler(struct sock *sk); |
| 377 | extern void tcp_delack_timer_handler(struct sock *sk); | 375 | extern void tcp_delack_timer_handler(struct sock *sk); |
| 378 | extern int tcp_ioctl(struct sock *sk, int cmd, unsigned long arg); | 376 | extern int tcp_ioctl(struct sock *sk, int cmd, unsigned long arg); |
| @@ -425,8 +423,6 @@ extern struct sock * tcp_check_req(struct sock *sk,struct sk_buff *skb, | |||
| 425 | bool fastopen); | 423 | bool fastopen); |
| 426 | extern int tcp_child_process(struct sock *parent, struct sock *child, | 424 | extern int tcp_child_process(struct sock *parent, struct sock *child, |
| 427 | struct sk_buff *skb); | 425 | struct sk_buff *skb); |
| 428 | extern bool tcp_use_frto(struct sock *sk); | ||
| 429 | extern void tcp_enter_frto(struct sock *sk); | ||
| 430 | extern void tcp_enter_loss(struct sock *sk, int how); | 426 | extern void tcp_enter_loss(struct sock *sk, int how); |
| 431 | extern void tcp_clear_retrans(struct tcp_sock *tp); | 427 | extern void tcp_clear_retrans(struct tcp_sock *tp); |
| 432 | extern void tcp_update_metrics(struct sock *sk); | 428 | extern void tcp_update_metrics(struct sock *sk); |
| @@ -454,7 +450,7 @@ extern void tcp_syn_ack_timeout(struct sock *sk, struct request_sock *req); | |||
| 454 | extern int tcp_recvmsg(struct kiocb *iocb, struct sock *sk, struct msghdr *msg, | 450 | extern int tcp_recvmsg(struct kiocb *iocb, struct sock *sk, struct msghdr *msg, |
| 455 | size_t len, int nonblock, int flags, int *addr_len); | 451 | size_t len, int nonblock, int flags, int *addr_len); |
| 456 | extern void tcp_parse_options(const struct sk_buff *skb, | 452 | extern void tcp_parse_options(const struct sk_buff *skb, |
| 457 | struct tcp_options_received *opt_rx, const u8 **hvpp, | 453 | struct tcp_options_received *opt_rx, |
| 458 | int estab, struct tcp_fastopen_cookie *foc); | 454 | int estab, struct tcp_fastopen_cookie *foc); |
| 459 | extern const u8 *tcp_parse_md5sig_option(const struct tcphdr *th); | 455 | extern const u8 *tcp_parse_md5sig_option(const struct tcphdr *th); |
| 460 | 456 | ||
| @@ -476,7 +472,6 @@ extern int tcp_v4_connect(struct sock *sk, struct sockaddr *uaddr, | |||
| 476 | extern int tcp_connect(struct sock *sk); | 472 | extern int tcp_connect(struct sock *sk); |
| 477 | extern struct sk_buff * tcp_make_synack(struct sock *sk, struct dst_entry *dst, | 473 | extern struct sk_buff * tcp_make_synack(struct sock *sk, struct dst_entry *dst, |
| 478 | struct request_sock *req, | 474 | struct request_sock *req, |
| 479 | struct request_values *rvp, | ||
| 480 | struct tcp_fastopen_cookie *foc); | 475 | struct tcp_fastopen_cookie *foc); |
| 481 | extern int tcp_disconnect(struct sock *sk, int flags); | 476 | extern int tcp_disconnect(struct sock *sk, int flags); |
| 482 | 477 | ||
| @@ -543,6 +538,8 @@ extern bool tcp_syn_flood_action(struct sock *sk, | |||
| 543 | extern void tcp_push_one(struct sock *, unsigned int mss_now); | 538 | extern void tcp_push_one(struct sock *, unsigned int mss_now); |
| 544 | extern void tcp_send_ack(struct sock *sk); | 539 | extern void tcp_send_ack(struct sock *sk); |
| 545 | extern void tcp_send_delayed_ack(struct sock *sk); | 540 | extern void tcp_send_delayed_ack(struct sock *sk); |
| 541 | extern void tcp_send_loss_probe(struct sock *sk); | ||
| 542 | extern bool tcp_schedule_loss_probe(struct sock *sk); | ||
| 546 | 543 | ||
| 547 | /* tcp_input.c */ | 544 | /* tcp_input.c */ |
| 548 | extern void tcp_cwnd_application_limited(struct sock *sk); | 545 | extern void tcp_cwnd_application_limited(struct sock *sk); |
| @@ -756,7 +753,6 @@ enum tcp_ca_event { | |||
| 756 | CA_EVENT_TX_START, /* first transmit when no packets in flight */ | 753 | CA_EVENT_TX_START, /* first transmit when no packets in flight */ |
| 757 | CA_EVENT_CWND_RESTART, /* congestion window restart */ | 754 | CA_EVENT_CWND_RESTART, /* congestion window restart */ |
| 758 | CA_EVENT_COMPLETE_CWR, /* end of congestion recovery */ | 755 | CA_EVENT_COMPLETE_CWR, /* end of congestion recovery */ |
| 759 | CA_EVENT_FRTO, /* fast recovery timeout */ | ||
| 760 | CA_EVENT_LOSS, /* loss timeout */ | 756 | CA_EVENT_LOSS, /* loss timeout */ |
| 761 | CA_EVENT_FAST_ACK, /* in sequence ack */ | 757 | CA_EVENT_FAST_ACK, /* in sequence ack */ |
| 762 | CA_EVENT_SLOW_ACK, /* other ack */ | 758 | CA_EVENT_SLOW_ACK, /* other ack */ |
| @@ -873,8 +869,8 @@ static inline void tcp_enable_fack(struct tcp_sock *tp) | |||
| 873 | static inline void tcp_enable_early_retrans(struct tcp_sock *tp) | 869 | static inline void tcp_enable_early_retrans(struct tcp_sock *tp) |
| 874 | { | 870 | { |
| 875 | tp->do_early_retrans = sysctl_tcp_early_retrans && | 871 | tp->do_early_retrans = sysctl_tcp_early_retrans && |
| 876 | !sysctl_tcp_thin_dupack && sysctl_tcp_reordering == 3; | 872 | sysctl_tcp_early_retrans < 4 && !sysctl_tcp_thin_dupack && |
| 877 | tp->early_retrans_delayed = 0; | 873 | sysctl_tcp_reordering == 3; |
| 878 | } | 874 | } |
| 879 | 875 | ||
| 880 | static inline void tcp_disable_early_retrans(struct tcp_sock *tp) | 876 | static inline void tcp_disable_early_retrans(struct tcp_sock *tp) |
| @@ -1030,50 +1026,7 @@ static inline void tcp_prequeue_init(struct tcp_sock *tp) | |||
| 1030 | #endif | 1026 | #endif |
| 1031 | } | 1027 | } |
| 1032 | 1028 | ||
| 1033 | /* Packet is added to VJ-style prequeue for processing in process | 1029 | extern bool tcp_prequeue(struct sock *sk, struct sk_buff *skb); |
| 1034 | * context, if a reader task is waiting. Apparently, this exciting | ||
| 1035 | * idea (VJ's mail "Re: query about TCP header on tcp-ip" of 07 Sep 93) | ||
| 1036 | * failed somewhere. Latency? Burstiness? Well, at least now we will | ||
| 1037 | * see, why it failed. 8)8) --ANK | ||
| 1038 | * | ||
| 1039 | * NOTE: is this not too big to inline? | ||
| 1040 | */ | ||
| 1041 | static inline bool tcp_prequeue(struct sock *sk, struct sk_buff *skb) | ||
| 1042 | { | ||
| 1043 | struct tcp_sock *tp = tcp_sk(sk); | ||
| 1044 | |||
| 1045 | if (sysctl_tcp_low_latency || !tp->ucopy.task) | ||
| 1046 | return false; | ||
| 1047 | |||
| 1048 | if (skb->len <= tcp_hdrlen(skb) && | ||
| 1049 | skb_queue_len(&tp->ucopy.prequeue) == 0) | ||
| 1050 | return false; | ||
| 1051 | |||
| 1052 | __skb_queue_tail(&tp->ucopy.prequeue, skb); | ||
| 1053 | tp->ucopy.memory += skb->truesize; | ||
| 1054 | if (tp->ucopy.memory > sk->sk_rcvbuf) { | ||
| 1055 | struct sk_buff *skb1; | ||
| 1056 | |||
| 1057 | BUG_ON(sock_owned_by_user(sk)); | ||
| 1058 | |||
| 1059 | while ((skb1 = __skb_dequeue(&tp->ucopy.prequeue)) != NULL) { | ||
| 1060 | sk_backlog_rcv(sk, skb1); | ||
| 1061 | NET_INC_STATS_BH(sock_net(sk), | ||
| 1062 | LINUX_MIB_TCPPREQUEUEDROPPED); | ||
| 1063 | } | ||
| 1064 | |||
| 1065 | tp->ucopy.memory = 0; | ||
| 1066 | } else if (skb_queue_len(&tp->ucopy.prequeue) == 1) { | ||
| 1067 | wake_up_interruptible_sync_poll(sk_sleep(sk), | ||
| 1068 | POLLIN | POLLRDNORM | POLLRDBAND); | ||
| 1069 | if (!inet_csk_ack_scheduled(sk)) | ||
| 1070 | inet_csk_reset_xmit_timer(sk, ICSK_TIME_DACK, | ||
| 1071 | (3 * tcp_rto_min(sk)) / 4, | ||
| 1072 | TCP_RTO_MAX); | ||
| 1073 | } | ||
| 1074 | return true; | ||
| 1075 | } | ||
| 1076 | |||
| 1077 | 1030 | ||
| 1078 | #undef STATE_TRACE | 1031 | #undef STATE_TRACE |
| 1079 | 1032 | ||
| @@ -1630,91 +1583,6 @@ struct tcp_request_sock_ops { | |||
| 1630 | #endif | 1583 | #endif |
| 1631 | }; | 1584 | }; |
| 1632 | 1585 | ||
| 1633 | /* Using SHA1 for now, define some constants. | ||
| 1634 | */ | ||
| 1635 | #define COOKIE_DIGEST_WORDS (SHA_DIGEST_WORDS) | ||
| 1636 | #define COOKIE_MESSAGE_WORDS (SHA_MESSAGE_BYTES / 4) | ||
| 1637 | #define COOKIE_WORKSPACE_WORDS (COOKIE_DIGEST_WORDS + COOKIE_MESSAGE_WORDS) | ||
| 1638 | |||
| 1639 | extern int tcp_cookie_generator(u32 *bakery); | ||
| 1640 | |||
| 1641 | /** | ||
| 1642 | * struct tcp_cookie_values - each socket needs extra space for the | ||
| 1643 | * cookies, together with (optional) space for any SYN data. | ||
| 1644 | * | ||
| 1645 | * A tcp_sock contains a pointer to the current value, and this is | ||
| 1646 | * cloned to the tcp_timewait_sock. | ||
| 1647 | * | ||
| 1648 | * @cookie_pair: variable data from the option exchange. | ||
| 1649 | * | ||
| 1650 | * @cookie_desired: user specified tcpct_cookie_desired. Zero | ||
| 1651 | * indicates default (sysctl_tcp_cookie_size). | ||
| 1652 | * After cookie sent, remembers size of cookie. | ||
| 1653 | * Range 0, TCP_COOKIE_MIN to TCP_COOKIE_MAX. | ||
| 1654 | * | ||
| 1655 | * @s_data_desired: user specified tcpct_s_data_desired. When the | ||
| 1656 | * constant payload is specified (@s_data_constant), | ||
| 1657 | * holds its length instead. | ||
| 1658 | * Range 0 to TCP_MSS_DESIRED. | ||
| 1659 | * | ||
| 1660 | * @s_data_payload: constant data that is to be included in the | ||
| 1661 | * payload of SYN or SYNACK segments when the | ||
| 1662 | * cookie option is present. | ||
| 1663 | */ | ||
| 1664 | struct tcp_cookie_values { | ||
| 1665 | struct kref kref; | ||
| 1666 | u8 cookie_pair[TCP_COOKIE_PAIR_SIZE]; | ||
| 1667 | u8 cookie_pair_size; | ||
| 1668 | u8 cookie_desired; | ||
| 1669 | u16 s_data_desired:11, | ||
| 1670 | s_data_constant:1, | ||
| 1671 | s_data_in:1, | ||
| 1672 | s_data_out:1, | ||
| 1673 | s_data_unused:2; | ||
| 1674 | u8 s_data_payload[0]; | ||
| 1675 | }; | ||
| 1676 | |||
| 1677 | static inline void tcp_cookie_values_release(struct kref *kref) | ||
| 1678 | { | ||
| 1679 | kfree(container_of(kref, struct tcp_cookie_values, kref)); | ||
| 1680 | } | ||
| 1681 | |||
| 1682 | /* The length of constant payload data. Note that s_data_desired is | ||
| 1683 | * overloaded, depending on s_data_constant: either the length of constant | ||
| 1684 | * data (returned here) or the limit on variable data. | ||
| 1685 | */ | ||
| 1686 | static inline int tcp_s_data_size(const struct tcp_sock *tp) | ||
| 1687 | { | ||
| 1688 | return (tp->cookie_values != NULL && tp->cookie_values->s_data_constant) | ||
| 1689 | ? tp->cookie_values->s_data_desired | ||
| 1690 | : 0; | ||
| 1691 | } | ||
| 1692 | |||
| 1693 | /** | ||
| 1694 | * struct tcp_extend_values - tcp_ipv?.c to tcp_output.c workspace. | ||
| 1695 | * | ||
| 1696 | * As tcp_request_sock has already been extended in other places, the | ||
| 1697 | * only remaining method is to pass stack values along as function | ||
| 1698 | * parameters. These parameters are not needed after sending SYNACK. | ||
| 1699 | * | ||
| 1700 | * @cookie_bakery: cryptographic secret and message workspace. | ||
| 1701 | * | ||
| 1702 | * @cookie_plus: bytes in authenticator/cookie option, copied from | ||
| 1703 | * struct tcp_options_received (above). | ||
| 1704 | */ | ||
| 1705 | struct tcp_extend_values { | ||
| 1706 | struct request_values rv; | ||
| 1707 | u32 cookie_bakery[COOKIE_WORKSPACE_WORDS]; | ||
| 1708 | u8 cookie_plus:6, | ||
| 1709 | cookie_out_never:1, | ||
| 1710 | cookie_in_always:1; | ||
| 1711 | }; | ||
| 1712 | |||
| 1713 | static inline struct tcp_extend_values *tcp_xv(struct request_values *rvp) | ||
| 1714 | { | ||
| 1715 | return (struct tcp_extend_values *)rvp; | ||
| 1716 | } | ||
| 1717 | |||
| 1718 | extern void tcp_v4_init(void); | 1586 | extern void tcp_v4_init(void); |
| 1719 | extern void tcp_init(void); | 1587 | extern void tcp_init(void); |
| 1720 | 1588 | ||
diff --git a/include/net/xfrm.h b/include/net/xfrm.h index 24c8886fd969..ae16531d0d35 100644 --- a/include/net/xfrm.h +++ b/include/net/xfrm.h | |||
| @@ -162,6 +162,7 @@ struct xfrm_state { | |||
| 162 | xfrm_address_t saddr; | 162 | xfrm_address_t saddr; |
| 163 | int header_len; | 163 | int header_len; |
| 164 | int trailer_len; | 164 | int trailer_len; |
| 165 | u32 extra_flags; | ||
| 165 | } props; | 166 | } props; |
| 166 | 167 | ||
| 167 | struct xfrm_lifetime_cfg lft; | 168 | struct xfrm_lifetime_cfg lft; |
diff --git a/include/uapi/asm-generic/socket.h b/include/uapi/asm-generic/socket.h index 4ef3acbba5da..c5d2e3a1cf68 100644 --- a/include/uapi/asm-generic/socket.h +++ b/include/uapi/asm-generic/socket.h | |||
| @@ -74,4 +74,6 @@ | |||
| 74 | 74 | ||
| 75 | #define SO_LOCK_FILTER 44 | 75 | #define SO_LOCK_FILTER 44 |
| 76 | 76 | ||
| 77 | #define SO_SELECT_ERR_QUEUE 45 | ||
| 78 | |||
| 77 | #endif /* __ASM_GENERIC_SOCKET_H */ | 79 | #endif /* __ASM_GENERIC_SOCKET_H */ |
diff --git a/include/uapi/linux/Kbuild b/include/uapi/linux/Kbuild index 5c8a1d25e21c..ab5d4992e568 100644 --- a/include/uapi/linux/Kbuild +++ b/include/uapi/linux/Kbuild | |||
| @@ -285,6 +285,7 @@ header-y += nvram.h | |||
| 285 | header-y += omap3isp.h | 285 | header-y += omap3isp.h |
| 286 | header-y += omapfb.h | 286 | header-y += omapfb.h |
| 287 | header-y += oom.h | 287 | header-y += oom.h |
| 288 | header-y += openvswitch.h | ||
| 288 | header-y += packet_diag.h | 289 | header-y += packet_diag.h |
| 289 | header-y += param.h | 290 | header-y += param.h |
| 290 | header-y += parport.h | 291 | header-y += parport.h |
| @@ -331,6 +332,7 @@ header-y += rtnetlink.h | |||
| 331 | header-y += scc.h | 332 | header-y += scc.h |
| 332 | header-y += sched.h | 333 | header-y += sched.h |
| 333 | header-y += screen_info.h | 334 | header-y += screen_info.h |
| 335 | header-y += sctp.h | ||
| 334 | header-y += sdla.h | 336 | header-y += sdla.h |
| 335 | header-y += seccomp.h | 337 | header-y += seccomp.h |
| 336 | header-y += securebits.h | 338 | header-y += securebits.h |
diff --git a/include/uapi/linux/caif/caif_socket.h b/include/uapi/linux/caif/caif_socket.h index 3f3bac6af7bc..586e9f98184f 100644 --- a/include/uapi/linux/caif/caif_socket.h +++ b/include/uapi/linux/caif/caif_socket.h | |||
| @@ -1,7 +1,7 @@ | |||
| 1 | /* linux/caif_socket.h | 1 | /* linux/caif_socket.h |
| 2 | * CAIF Definitions for CAIF socket and network layer | 2 | * CAIF Definitions for CAIF socket and network layer |
| 3 | * Copyright (C) ST-Ericsson AB 2010 | 3 | * Copyright (C) ST-Ericsson AB 2010 |
| 4 | * Author: Sjur Brendeland/ sjur.brandeland@stericsson.com | 4 | * Author: Sjur Brendeland |
| 5 | * License terms: GNU General Public License (GPL) version 2 | 5 | * License terms: GNU General Public License (GPL) version 2 |
| 6 | */ | 6 | */ |
| 7 | 7 | ||
diff --git a/include/uapi/linux/caif/if_caif.h b/include/uapi/linux/caif/if_caif.h index 5e7eed4edf51..7618aabe8c6b 100644 --- a/include/uapi/linux/caif/if_caif.h +++ b/include/uapi/linux/caif/if_caif.h | |||
| @@ -1,6 +1,6 @@ | |||
| 1 | /* | 1 | /* |
| 2 | * Copyright (C) ST-Ericsson AB 2010 | 2 | * Copyright (C) ST-Ericsson AB 2010 |
| 3 | * Author: Sjur Brendeland/ sjur.brandeland@stericsson.com | 3 | * Author: Sjur Brendeland |
| 4 | * License terms: GNU General Public License (GPL) version 2 | 4 | * License terms: GNU General Public License (GPL) version 2 |
| 5 | */ | 5 | */ |
| 6 | 6 | ||
diff --git a/include/uapi/linux/cn_proc.h b/include/uapi/linux/cn_proc.h index 0d7b49973bb3..f6c271035bbd 100644 --- a/include/uapi/linux/cn_proc.h +++ b/include/uapi/linux/cn_proc.h | |||
| @@ -56,7 +56,9 @@ struct proc_event { | |||
| 56 | PROC_EVENT_PTRACE = 0x00000100, | 56 | PROC_EVENT_PTRACE = 0x00000100, |
| 57 | PROC_EVENT_COMM = 0x00000200, | 57 | PROC_EVENT_COMM = 0x00000200, |
| 58 | /* "next" should be 0x00000400 */ | 58 | /* "next" should be 0x00000400 */ |
| 59 | /* "last" is the last process event: exit */ | 59 | /* "last" is the last process event: exit, |
| 60 | * while "next to last" is coredumping event */ | ||
| 61 | PROC_EVENT_COREDUMP = 0x40000000, | ||
| 60 | PROC_EVENT_EXIT = 0x80000000 | 62 | PROC_EVENT_EXIT = 0x80000000 |
| 61 | } what; | 63 | } what; |
| 62 | __u32 cpu; | 64 | __u32 cpu; |
| @@ -110,11 +112,17 @@ struct proc_event { | |||
| 110 | char comm[16]; | 112 | char comm[16]; |
| 111 | } comm; | 113 | } comm; |
| 112 | 114 | ||
| 115 | struct coredump_proc_event { | ||
| 116 | __kernel_pid_t process_pid; | ||
| 117 | __kernel_pid_t process_tgid; | ||
| 118 | } coredump; | ||
| 119 | |||
| 113 | struct exit_proc_event { | 120 | struct exit_proc_event { |
| 114 | __kernel_pid_t process_pid; | 121 | __kernel_pid_t process_pid; |
| 115 | __kernel_pid_t process_tgid; | 122 | __kernel_pid_t process_tgid; |
| 116 | __u32 exit_code, exit_signal; | 123 | __u32 exit_code, exit_signal; |
| 117 | } exit; | 124 | } exit; |
| 125 | |||
| 118 | } event_data; | 126 | } event_data; |
| 119 | }; | 127 | }; |
| 120 | 128 | ||
diff --git a/include/uapi/linux/filter.h b/include/uapi/linux/filter.h index 9cfde6941099..8eb9ccaa5b48 100644 --- a/include/uapi/linux/filter.h +++ b/include/uapi/linux/filter.h | |||
| @@ -129,7 +129,8 @@ struct sock_fprog { /* Required for SO_ATTACH_FILTER. */ | |||
| 129 | #define SKF_AD_ALU_XOR_X 40 | 129 | #define SKF_AD_ALU_XOR_X 40 |
| 130 | #define SKF_AD_VLAN_TAG 44 | 130 | #define SKF_AD_VLAN_TAG 44 |
| 131 | #define SKF_AD_VLAN_TAG_PRESENT 48 | 131 | #define SKF_AD_VLAN_TAG_PRESENT 48 |
| 132 | #define SKF_AD_MAX 52 | 132 | #define SKF_AD_PAY_OFFSET 52 |
| 133 | #define SKF_AD_MAX 56 | ||
| 133 | #define SKF_NET_OFF (-0x100000) | 134 | #define SKF_NET_OFF (-0x100000) |
| 134 | #define SKF_LL_OFF (-0x200000) | 135 | #define SKF_LL_OFF (-0x200000) |
| 135 | 136 | ||
diff --git a/include/uapi/linux/if_ether.h b/include/uapi/linux/if_ether.h index 798032d01112..ade07f1c491a 100644 --- a/include/uapi/linux/if_ether.h +++ b/include/uapi/linux/if_ether.h | |||
| @@ -94,6 +94,9 @@ | |||
| 94 | #define ETH_P_EDSA 0xDADA /* Ethertype DSA [ NOT AN OFFICIALLY REGISTERED ID ] */ | 94 | #define ETH_P_EDSA 0xDADA /* Ethertype DSA [ NOT AN OFFICIALLY REGISTERED ID ] */ |
| 95 | #define ETH_P_AF_IUCV 0xFBFB /* IBM af_iucv [ NOT AN OFFICIALLY REGISTERED ID ] */ | 95 | #define ETH_P_AF_IUCV 0xFBFB /* IBM af_iucv [ NOT AN OFFICIALLY REGISTERED ID ] */ |
| 96 | 96 | ||
| 97 | #define ETH_P_802_3_MIN 0x0600 /* If the value in the ethernet type is less than this value | ||
| 98 | * then the frame is Ethernet II. Else it is 802.3 */ | ||
| 99 | |||
| 97 | /* | 100 | /* |
| 98 | * Non DIX types. Won't clash for 1500 types. | 101 | * Non DIX types. Won't clash for 1500 types. |
| 99 | */ | 102 | */ |
diff --git a/include/uapi/linux/if_link.h b/include/uapi/linux/if_link.h index c4edfe11f1f7..b05823cae784 100644 --- a/include/uapi/linux/if_link.h +++ b/include/uapi/linux/if_link.h | |||
| @@ -201,6 +201,7 @@ enum { | |||
| 201 | IFLA_INET6_MCAST, /* MC things. What of them? */ | 201 | IFLA_INET6_MCAST, /* MC things. What of them? */ |
| 202 | IFLA_INET6_CACHEINFO, /* time values and max reasm size */ | 202 | IFLA_INET6_CACHEINFO, /* time values and max reasm size */ |
| 203 | IFLA_INET6_ICMP6STATS, /* statistics (icmpv6) */ | 203 | IFLA_INET6_ICMP6STATS, /* statistics (icmpv6) */ |
| 204 | IFLA_INET6_TOKEN, /* device token */ | ||
| 204 | __IFLA_INET6_MAX | 205 | __IFLA_INET6_MAX |
| 205 | }; | 206 | }; |
| 206 | 207 | ||
| @@ -249,6 +250,7 @@ enum { | |||
| 249 | IFLA_VLAN_FLAGS, | 250 | IFLA_VLAN_FLAGS, |
| 250 | IFLA_VLAN_EGRESS_QOS, | 251 | IFLA_VLAN_EGRESS_QOS, |
| 251 | IFLA_VLAN_INGRESS_QOS, | 252 | IFLA_VLAN_INGRESS_QOS, |
| 253 | IFLA_VLAN_PROTOCOL, | ||
| 252 | __IFLA_VLAN_MAX, | 254 | __IFLA_VLAN_MAX, |
| 253 | }; | 255 | }; |
| 254 | 256 | ||
| @@ -295,7 +297,7 @@ enum macvlan_mode { | |||
| 295 | enum { | 297 | enum { |
| 296 | IFLA_VXLAN_UNSPEC, | 298 | IFLA_VXLAN_UNSPEC, |
| 297 | IFLA_VXLAN_ID, | 299 | IFLA_VXLAN_ID, |
| 298 | IFLA_VXLAN_GROUP, | 300 | IFLA_VXLAN_GROUP, /* group or remote address */ |
| 299 | IFLA_VXLAN_LINK, | 301 | IFLA_VXLAN_LINK, |
| 300 | IFLA_VXLAN_LOCAL, | 302 | IFLA_VXLAN_LOCAL, |
| 301 | IFLA_VXLAN_TTL, | 303 | IFLA_VXLAN_TTL, |
| @@ -303,11 +305,12 @@ enum { | |||
| 303 | IFLA_VXLAN_LEARNING, | 305 | IFLA_VXLAN_LEARNING, |
| 304 | IFLA_VXLAN_AGEING, | 306 | IFLA_VXLAN_AGEING, |
| 305 | IFLA_VXLAN_LIMIT, | 307 | IFLA_VXLAN_LIMIT, |
| 306 | IFLA_VXLAN_PORT_RANGE, | 308 | IFLA_VXLAN_PORT_RANGE, /* source port */ |
| 307 | IFLA_VXLAN_PROXY, | 309 | IFLA_VXLAN_PROXY, |
| 308 | IFLA_VXLAN_RSC, | 310 | IFLA_VXLAN_RSC, |
| 309 | IFLA_VXLAN_L2MISS, | 311 | IFLA_VXLAN_L2MISS, |
| 310 | IFLA_VXLAN_L3MISS, | 312 | IFLA_VXLAN_L3MISS, |
| 313 | IFLA_VXLAN_PORT, /* destination port */ | ||
| 311 | __IFLA_VXLAN_MAX | 314 | __IFLA_VXLAN_MAX |
| 312 | }; | 315 | }; |
| 313 | #define IFLA_VXLAN_MAX (__IFLA_VXLAN_MAX - 1) | 316 | #define IFLA_VXLAN_MAX (__IFLA_VXLAN_MAX - 1) |
diff --git a/include/uapi/linux/if_packet.h b/include/uapi/linux/if_packet.h index f9a60375f0d0..b950c02030c0 100644 --- a/include/uapi/linux/if_packet.h +++ b/include/uapi/linux/if_packet.h | |||
| @@ -55,6 +55,8 @@ struct sockaddr_ll { | |||
| 55 | #define PACKET_FANOUT_HASH 0 | 55 | #define PACKET_FANOUT_HASH 0 |
| 56 | #define PACKET_FANOUT_LB 1 | 56 | #define PACKET_FANOUT_LB 1 |
| 57 | #define PACKET_FANOUT_CPU 2 | 57 | #define PACKET_FANOUT_CPU 2 |
| 58 | #define PACKET_FANOUT_ROLLOVER 3 | ||
| 59 | #define PACKET_FANOUT_FLAG_ROLLOVER 0x1000 | ||
| 58 | #define PACKET_FANOUT_FLAG_DEFRAG 0x8000 | 60 | #define PACKET_FANOUT_FLAG_DEFRAG 0x8000 |
| 59 | 61 | ||
| 60 | struct tpacket_stats { | 62 | struct tpacket_stats { |
| @@ -84,19 +86,24 @@ struct tpacket_auxdata { | |||
| 84 | }; | 86 | }; |
| 85 | 87 | ||
| 86 | /* Rx ring - header status */ | 88 | /* Rx ring - header status */ |
| 87 | #define TP_STATUS_KERNEL 0x0 | 89 | #define TP_STATUS_KERNEL 0 |
| 88 | #define TP_STATUS_USER 0x1 | 90 | #define TP_STATUS_USER (1 << 0) |
| 89 | #define TP_STATUS_COPY 0x2 | 91 | #define TP_STATUS_COPY (1 << 1) |
| 90 | #define TP_STATUS_LOSING 0x4 | 92 | #define TP_STATUS_LOSING (1 << 2) |
| 91 | #define TP_STATUS_CSUMNOTREADY 0x8 | 93 | #define TP_STATUS_CSUMNOTREADY (1 << 3) |
| 92 | #define TP_STATUS_VLAN_VALID 0x10 /* auxdata has valid tp_vlan_tci */ | 94 | #define TP_STATUS_VLAN_VALID (1 << 4) /* auxdata has valid tp_vlan_tci */ |
| 93 | #define TP_STATUS_BLK_TMO 0x20 | 95 | #define TP_STATUS_BLK_TMO (1 << 5) |
| 94 | 96 | ||
| 95 | /* Tx ring - header status */ | 97 | /* Tx ring - header status */ |
| 96 | #define TP_STATUS_AVAILABLE 0x0 | 98 | #define TP_STATUS_AVAILABLE 0 |
| 97 | #define TP_STATUS_SEND_REQUEST 0x1 | 99 | #define TP_STATUS_SEND_REQUEST (1 << 0) |
| 98 | #define TP_STATUS_SENDING 0x2 | 100 | #define TP_STATUS_SENDING (1 << 1) |
| 99 | #define TP_STATUS_WRONG_FORMAT 0x4 | 101 | #define TP_STATUS_WRONG_FORMAT (1 << 2) |
| 102 | |||
| 103 | /* Rx and Tx ring - header status */ | ||
| 104 | #define TP_STATUS_TS_SOFTWARE (1 << 29) | ||
| 105 | #define TP_STATUS_TS_SYS_HARDWARE (1 << 30) | ||
| 106 | #define TP_STATUS_TS_RAW_HARDWARE (1 << 31) | ||
| 100 | 107 | ||
| 101 | /* Rx ring - feature request bits */ | 108 | /* Rx ring - feature request bits */ |
| 102 | #define TP_FT_REQ_FILL_RXHASH 0x1 | 109 | #define TP_FT_REQ_FILL_RXHASH 0x1 |
diff --git a/include/uapi/linux/ip_vs.h b/include/uapi/linux/ip_vs.h index 8a2d438dc499..a24537725e80 100644 --- a/include/uapi/linux/ip_vs.h +++ b/include/uapi/linux/ip_vs.h | |||
| @@ -280,8 +280,8 @@ struct ip_vs_daemon_user { | |||
| 280 | #define IPVS_GENL_VERSION 0x1 | 280 | #define IPVS_GENL_VERSION 0x1 |
| 281 | 281 | ||
| 282 | struct ip_vs_flags { | 282 | struct ip_vs_flags { |
| 283 | __be32 flags; | 283 | __u32 flags; |
| 284 | __be32 mask; | 284 | __u32 mask; |
| 285 | }; | 285 | }; |
| 286 | 286 | ||
| 287 | /* Generic Netlink command attributes */ | 287 | /* Generic Netlink command attributes */ |
diff --git a/include/uapi/linux/neighbour.h b/include/uapi/linux/neighbour.h index adb068c53c4e..f175212420ab 100644 --- a/include/uapi/linux/neighbour.h +++ b/include/uapi/linux/neighbour.h | |||
| @@ -21,6 +21,9 @@ enum { | |||
| 21 | NDA_CACHEINFO, | 21 | NDA_CACHEINFO, |
| 22 | NDA_PROBES, | 22 | NDA_PROBES, |
| 23 | NDA_VLAN, | 23 | NDA_VLAN, |
| 24 | NDA_PORT, | ||
| 25 | NDA_VNI, | ||
| 26 | NDA_IFINDEX, | ||
| 24 | __NDA_MAX | 27 | __NDA_MAX |
| 25 | }; | 28 | }; |
| 26 | 29 | ||
diff --git a/include/uapi/linux/netfilter/ipset/ip_set.h b/include/uapi/linux/netfilter/ipset/ip_set.h index fbee42807a11..8024cdf13b70 100644 --- a/include/uapi/linux/netfilter/ipset/ip_set.h +++ b/include/uapi/linux/netfilter/ipset/ip_set.h | |||
| @@ -108,6 +108,8 @@ enum { | |||
| 108 | IPSET_ATTR_CIDR2, | 108 | IPSET_ATTR_CIDR2, |
| 109 | IPSET_ATTR_IP2_TO, | 109 | IPSET_ATTR_IP2_TO, |
| 110 | IPSET_ATTR_IFACE, | 110 | IPSET_ATTR_IFACE, |
| 111 | IPSET_ATTR_BYTES, | ||
| 112 | IPSET_ATTR_PACKETS, | ||
| 111 | __IPSET_ATTR_ADT_MAX, | 113 | __IPSET_ATTR_ADT_MAX, |
| 112 | }; | 114 | }; |
| 113 | #define IPSET_ATTR_ADT_MAX (__IPSET_ATTR_ADT_MAX - 1) | 115 | #define IPSET_ATTR_ADT_MAX (__IPSET_ATTR_ADT_MAX - 1) |
| @@ -137,12 +139,13 @@ enum ipset_errno { | |||
| 137 | IPSET_ERR_REFERENCED, | 139 | IPSET_ERR_REFERENCED, |
| 138 | IPSET_ERR_IPADDR_IPV4, | 140 | IPSET_ERR_IPADDR_IPV4, |
| 139 | IPSET_ERR_IPADDR_IPV6, | 141 | IPSET_ERR_IPADDR_IPV6, |
| 142 | IPSET_ERR_COUNTER, | ||
| 140 | 143 | ||
| 141 | /* Type specific error codes */ | 144 | /* Type specific error codes */ |
| 142 | IPSET_ERR_TYPE_SPECIFIC = 4352, | 145 | IPSET_ERR_TYPE_SPECIFIC = 4352, |
| 143 | }; | 146 | }; |
| 144 | 147 | ||
| 145 | /* Flags at command level */ | 148 | /* Flags at command level or match/target flags, lower half of cmdattrs*/ |
| 146 | enum ipset_cmd_flags { | 149 | enum ipset_cmd_flags { |
| 147 | IPSET_FLAG_BIT_EXIST = 0, | 150 | IPSET_FLAG_BIT_EXIST = 0, |
| 148 | IPSET_FLAG_EXIST = (1 << IPSET_FLAG_BIT_EXIST), | 151 | IPSET_FLAG_EXIST = (1 << IPSET_FLAG_BIT_EXIST), |
| @@ -150,10 +153,20 @@ enum ipset_cmd_flags { | |||
| 150 | IPSET_FLAG_LIST_SETNAME = (1 << IPSET_FLAG_BIT_LIST_SETNAME), | 153 | IPSET_FLAG_LIST_SETNAME = (1 << IPSET_FLAG_BIT_LIST_SETNAME), |
| 151 | IPSET_FLAG_BIT_LIST_HEADER = 2, | 154 | IPSET_FLAG_BIT_LIST_HEADER = 2, |
| 152 | IPSET_FLAG_LIST_HEADER = (1 << IPSET_FLAG_BIT_LIST_HEADER), | 155 | IPSET_FLAG_LIST_HEADER = (1 << IPSET_FLAG_BIT_LIST_HEADER), |
| 153 | IPSET_FLAG_CMD_MAX = 15, /* Lower half */ | 156 | IPSET_FLAG_BIT_SKIP_COUNTER_UPDATE = 3, |
| 157 | IPSET_FLAG_SKIP_COUNTER_UPDATE = | ||
| 158 | (1 << IPSET_FLAG_BIT_SKIP_COUNTER_UPDATE), | ||
| 159 | IPSET_FLAG_BIT_SKIP_SUBCOUNTER_UPDATE = 4, | ||
| 160 | IPSET_FLAG_SKIP_SUBCOUNTER_UPDATE = | ||
| 161 | (1 << IPSET_FLAG_BIT_SKIP_SUBCOUNTER_UPDATE), | ||
| 162 | IPSET_FLAG_BIT_MATCH_COUNTERS = 5, | ||
| 163 | IPSET_FLAG_MATCH_COUNTERS = (1 << IPSET_FLAG_BIT_MATCH_COUNTERS), | ||
| 164 | IPSET_FLAG_BIT_RETURN_NOMATCH = 7, | ||
| 165 | IPSET_FLAG_RETURN_NOMATCH = (1 << IPSET_FLAG_BIT_RETURN_NOMATCH), | ||
| 166 | IPSET_FLAG_CMD_MAX = 15, | ||
| 154 | }; | 167 | }; |
| 155 | 168 | ||
| 156 | /* Flags at CADT attribute level */ | 169 | /* Flags at CADT attribute level, upper half of cmdattrs */ |
| 157 | enum ipset_cadt_flags { | 170 | enum ipset_cadt_flags { |
| 158 | IPSET_FLAG_BIT_BEFORE = 0, | 171 | IPSET_FLAG_BIT_BEFORE = 0, |
| 159 | IPSET_FLAG_BEFORE = (1 << IPSET_FLAG_BIT_BEFORE), | 172 | IPSET_FLAG_BEFORE = (1 << IPSET_FLAG_BIT_BEFORE), |
| @@ -161,7 +174,9 @@ enum ipset_cadt_flags { | |||
| 161 | IPSET_FLAG_PHYSDEV = (1 << IPSET_FLAG_BIT_PHYSDEV), | 174 | IPSET_FLAG_PHYSDEV = (1 << IPSET_FLAG_BIT_PHYSDEV), |
| 162 | IPSET_FLAG_BIT_NOMATCH = 2, | 175 | IPSET_FLAG_BIT_NOMATCH = 2, |
| 163 | IPSET_FLAG_NOMATCH = (1 << IPSET_FLAG_BIT_NOMATCH), | 176 | IPSET_FLAG_NOMATCH = (1 << IPSET_FLAG_BIT_NOMATCH), |
| 164 | IPSET_FLAG_CADT_MAX = 15, /* Upper half */ | 177 | IPSET_FLAG_BIT_WITH_COUNTERS = 3, |
| 178 | IPSET_FLAG_WITH_COUNTERS = (1 << IPSET_FLAG_BIT_WITH_COUNTERS), | ||
| 179 | IPSET_FLAG_CADT_MAX = 15, | ||
| 165 | }; | 180 | }; |
| 166 | 181 | ||
| 167 | /* Commands with settype-specific attributes */ | 182 | /* Commands with settype-specific attributes */ |
| @@ -190,6 +205,7 @@ enum ip_set_dim { | |||
| 190 | * If changed, new revision of iptables match/target is required. | 205 | * If changed, new revision of iptables match/target is required. |
| 191 | */ | 206 | */ |
| 192 | IPSET_DIM_MAX = 6, | 207 | IPSET_DIM_MAX = 6, |
| 208 | /* Backward compatibility: set match revision 2 */ | ||
| 193 | IPSET_BIT_RETURN_NOMATCH = 7, | 209 | IPSET_BIT_RETURN_NOMATCH = 7, |
| 194 | }; | 210 | }; |
| 195 | 211 | ||
| @@ -202,6 +218,18 @@ enum ip_set_kopt { | |||
| 202 | IPSET_RETURN_NOMATCH = (1 << IPSET_BIT_RETURN_NOMATCH), | 218 | IPSET_RETURN_NOMATCH = (1 << IPSET_BIT_RETURN_NOMATCH), |
| 203 | }; | 219 | }; |
| 204 | 220 | ||
| 221 | enum { | ||
| 222 | IPSET_COUNTER_NONE = 0, | ||
| 223 | IPSET_COUNTER_EQ, | ||
| 224 | IPSET_COUNTER_NE, | ||
| 225 | IPSET_COUNTER_LT, | ||
| 226 | IPSET_COUNTER_GT, | ||
| 227 | }; | ||
| 228 | |||
| 229 | struct ip_set_counter_match { | ||
| 230 | __u8 op; | ||
| 231 | __u64 value; | ||
| 232 | }; | ||
| 205 | 233 | ||
| 206 | /* Interface to iptables/ip6tables */ | 234 | /* Interface to iptables/ip6tables */ |
| 207 | 235 | ||
diff --git a/include/uapi/linux/netfilter/nfnetlink_queue.h b/include/uapi/linux/netfilter/nfnetlink_queue.h index 70ec8c2bc11a..a2308ae5a73d 100644 --- a/include/uapi/linux/netfilter/nfnetlink_queue.h +++ b/include/uapi/linux/netfilter/nfnetlink_queue.h | |||
| @@ -45,6 +45,7 @@ enum nfqnl_attr_type { | |||
| 45 | NFQA_CT, /* nf_conntrack_netlink.h */ | 45 | NFQA_CT, /* nf_conntrack_netlink.h */ |
| 46 | NFQA_CT_INFO, /* enum ip_conntrack_info */ | 46 | NFQA_CT_INFO, /* enum ip_conntrack_info */ |
| 47 | NFQA_CAP_LEN, /* __u32 length of captured packet */ | 47 | NFQA_CAP_LEN, /* __u32 length of captured packet */ |
| 48 | NFQA_SKB_INFO, /* __u32 skb meta information */ | ||
| 48 | 49 | ||
| 49 | __NFQA_MAX | 50 | __NFQA_MAX |
| 50 | }; | 51 | }; |
| @@ -96,6 +97,13 @@ enum nfqnl_attr_config { | |||
| 96 | /* Flags for NFQA_CFG_FLAGS */ | 97 | /* Flags for NFQA_CFG_FLAGS */ |
| 97 | #define NFQA_CFG_F_FAIL_OPEN (1 << 0) | 98 | #define NFQA_CFG_F_FAIL_OPEN (1 << 0) |
| 98 | #define NFQA_CFG_F_CONNTRACK (1 << 1) | 99 | #define NFQA_CFG_F_CONNTRACK (1 << 1) |
| 99 | #define NFQA_CFG_F_MAX (1 << 2) | 100 | #define NFQA_CFG_F_GSO (1 << 2) |
| 101 | #define NFQA_CFG_F_MAX (1 << 3) | ||
| 102 | |||
| 103 | /* flags for NFQA_SKB_INFO */ | ||
| 104 | /* packet appears to have wrong checksums, but they are ok */ | ||
| 105 | #define NFQA_SKB_CSUMNOTREADY (1 << 0) | ||
| 106 | /* packet is GSO (i.e., exceeds device mtu) */ | ||
| 107 | #define NFQA_SKB_GSO (1 << 1) | ||
| 100 | 108 | ||
| 101 | #endif /* _NFNETLINK_QUEUE_H */ | 109 | #endif /* _NFNETLINK_QUEUE_H */ |
diff --git a/include/uapi/linux/netfilter/xt_NFQUEUE.h b/include/uapi/linux/netfilter/xt_NFQUEUE.h index 9eafdbbb401c..8bb5fe657d34 100644 --- a/include/uapi/linux/netfilter/xt_NFQUEUE.h +++ b/include/uapi/linux/netfilter/xt_NFQUEUE.h | |||
| @@ -26,4 +26,13 @@ struct xt_NFQ_info_v2 { | |||
| 26 | __u16 bypass; | 26 | __u16 bypass; |
| 27 | }; | 27 | }; |
| 28 | 28 | ||
| 29 | struct xt_NFQ_info_v3 { | ||
| 30 | __u16 queuenum; | ||
| 31 | __u16 queues_total; | ||
| 32 | __u16 flags; | ||
| 33 | #define NFQ_FLAG_BYPASS 0x01 /* for compatibility with v2 */ | ||
| 34 | #define NFQ_FLAG_CPU_FANOUT 0x02 /* use current CPU (no hashing) */ | ||
| 35 | #define NFQ_FLAG_MASK 0x03 | ||
| 36 | }; | ||
| 37 | |||
| 29 | #endif /* _XT_NFQ_TARGET_H */ | 38 | #endif /* _XT_NFQ_TARGET_H */ |
diff --git a/include/uapi/linux/netfilter/xt_set.h b/include/uapi/linux/netfilter/xt_set.h index e3a9978f259f..964d3d42f874 100644 --- a/include/uapi/linux/netfilter/xt_set.h +++ b/include/uapi/linux/netfilter/xt_set.h | |||
| @@ -62,4 +62,13 @@ struct xt_set_info_target_v2 { | |||
| 62 | __u32 timeout; | 62 | __u32 timeout; |
| 63 | }; | 63 | }; |
| 64 | 64 | ||
| 65 | /* Revision 3 match */ | ||
| 66 | |||
| 67 | struct xt_set_info_match_v3 { | ||
| 68 | struct xt_set_info match_set; | ||
| 69 | struct ip_set_counter_match packets; | ||
| 70 | struct ip_set_counter_match bytes; | ||
| 71 | __u32 flags; | ||
| 72 | }; | ||
| 73 | |||
| 65 | #endif /*_XT_SET_H*/ | 74 | #endif /*_XT_SET_H*/ |
diff --git a/include/uapi/linux/netfilter_ipv6/ip6t_frag.h b/include/uapi/linux/netfilter_ipv6/ip6t_frag.h index b47f61b9e082..dfd8bc2268cf 100644 --- a/include/uapi/linux/netfilter_ipv6/ip6t_frag.h +++ b/include/uapi/linux/netfilter_ipv6/ip6t_frag.h | |||
| @@ -4,9 +4,9 @@ | |||
| 4 | #include <linux/types.h> | 4 | #include <linux/types.h> |
| 5 | 5 | ||
| 6 | struct ip6t_frag { | 6 | struct ip6t_frag { |
| 7 | __u32 ids[2]; /* Security Parameter Index */ | 7 | __u32 ids[2]; /* Identification range */ |
| 8 | __u32 hdrlen; /* Header Length */ | 8 | __u32 hdrlen; /* Header Length */ |
| 9 | __u8 flags; /* */ | 9 | __u8 flags; /* Flags */ |
| 10 | __u8 invflags; /* Inverse flags */ | 10 | __u8 invflags; /* Inverse flags */ |
| 11 | }; | 11 | }; |
| 12 | 12 | ||
diff --git a/include/uapi/linux/netlink.h b/include/uapi/linux/netlink.h index 78d5b8a546d6..1a85940f8ab7 100644 --- a/include/uapi/linux/netlink.h +++ b/include/uapi/linux/netlink.h | |||
| @@ -1,6 +1,7 @@ | |||
| 1 | #ifndef _UAPI__LINUX_NETLINK_H | 1 | #ifndef _UAPI__LINUX_NETLINK_H |
| 2 | #define _UAPI__LINUX_NETLINK_H | 2 | #define _UAPI__LINUX_NETLINK_H |
| 3 | 3 | ||
| 4 | #include <linux/kernel.h> | ||
| 4 | #include <linux/socket.h> /* for __kernel_sa_family_t */ | 5 | #include <linux/socket.h> /* for __kernel_sa_family_t */ |
| 5 | #include <linux/types.h> | 6 | #include <linux/types.h> |
| 6 | 7 | ||
| @@ -78,7 +79,7 @@ struct nlmsghdr { | |||
| 78 | #define NLMSG_ALIGNTO 4U | 79 | #define NLMSG_ALIGNTO 4U |
| 79 | #define NLMSG_ALIGN(len) ( ((len)+NLMSG_ALIGNTO-1) & ~(NLMSG_ALIGNTO-1) ) | 80 | #define NLMSG_ALIGN(len) ( ((len)+NLMSG_ALIGNTO-1) & ~(NLMSG_ALIGNTO-1) ) |
| 80 | #define NLMSG_HDRLEN ((int) NLMSG_ALIGN(sizeof(struct nlmsghdr))) | 81 | #define NLMSG_HDRLEN ((int) NLMSG_ALIGN(sizeof(struct nlmsghdr))) |
| 81 | #define NLMSG_LENGTH(len) ((len)+NLMSG_ALIGN(NLMSG_HDRLEN)) | 82 | #define NLMSG_LENGTH(len) ((len) + NLMSG_HDRLEN) |
| 82 | #define NLMSG_SPACE(len) NLMSG_ALIGN(NLMSG_LENGTH(len)) | 83 | #define NLMSG_SPACE(len) NLMSG_ALIGN(NLMSG_LENGTH(len)) |
| 83 | #define NLMSG_DATA(nlh) ((void*)(((char*)nlh) + NLMSG_LENGTH(0))) | 84 | #define NLMSG_DATA(nlh) ((void*)(((char*)nlh) + NLMSG_LENGTH(0))) |
| 84 | #define NLMSG_NEXT(nlh,len) ((len) -= NLMSG_ALIGN((nlh)->nlmsg_len), \ | 85 | #define NLMSG_NEXT(nlh,len) ((len) -= NLMSG_ALIGN((nlh)->nlmsg_len), \ |
| @@ -105,11 +106,42 @@ struct nlmsgerr { | |||
| 105 | #define NETLINK_PKTINFO 3 | 106 | #define NETLINK_PKTINFO 3 |
| 106 | #define NETLINK_BROADCAST_ERROR 4 | 107 | #define NETLINK_BROADCAST_ERROR 4 |
| 107 | #define NETLINK_NO_ENOBUFS 5 | 108 | #define NETLINK_NO_ENOBUFS 5 |
| 109 | #define NETLINK_RX_RING 6 | ||
| 110 | #define NETLINK_TX_RING 7 | ||
| 108 | 111 | ||
| 109 | struct nl_pktinfo { | 112 | struct nl_pktinfo { |
| 110 | __u32 group; | 113 | __u32 group; |
| 111 | }; | 114 | }; |
| 112 | 115 | ||
| 116 | struct nl_mmap_req { | ||
| 117 | unsigned int nm_block_size; | ||
| 118 | unsigned int nm_block_nr; | ||
| 119 | unsigned int nm_frame_size; | ||
| 120 | unsigned int nm_frame_nr; | ||
| 121 | }; | ||
| 122 | |||
| 123 | struct nl_mmap_hdr { | ||
| 124 | unsigned int nm_status; | ||
| 125 | unsigned int nm_len; | ||
| 126 | __u32 nm_group; | ||
| 127 | /* credentials */ | ||
| 128 | __u32 nm_pid; | ||
| 129 | __u32 nm_uid; | ||
| 130 | __u32 nm_gid; | ||
| 131 | }; | ||
| 132 | |||
| 133 | enum nl_mmap_status { | ||
| 134 | NL_MMAP_STATUS_UNUSED, | ||
| 135 | NL_MMAP_STATUS_RESERVED, | ||
| 136 | NL_MMAP_STATUS_VALID, | ||
| 137 | NL_MMAP_STATUS_COPY, | ||
| 138 | NL_MMAP_STATUS_SKIP, | ||
| 139 | }; | ||
| 140 | |||
| 141 | #define NL_MMAP_MSG_ALIGNMENT NLMSG_ALIGNTO | ||
| 142 | #define NL_MMAP_MSG_ALIGN(sz) __ALIGN_KERNEL(sz, NL_MMAP_MSG_ALIGNMENT) | ||
| 143 | #define NL_MMAP_HDRLEN NL_MMAP_MSG_ALIGN(sizeof(struct nl_mmap_hdr)) | ||
| 144 | |||
| 113 | #define NET_MAJOR 36 /* Major 36 is reserved for networking */ | 145 | #define NET_MAJOR 36 /* Major 36 is reserved for networking */ |
| 114 | 146 | ||
| 115 | enum { | 147 | enum { |
diff --git a/include/uapi/linux/netlink_diag.h b/include/uapi/linux/netlink_diag.h new file mode 100644 index 000000000000..4e31db4eea41 --- /dev/null +++ b/include/uapi/linux/netlink_diag.h | |||
| @@ -0,0 +1,52 @@ | |||
| 1 | #ifndef __NETLINK_DIAG_H__ | ||
| 2 | #define __NETLINK_DIAG_H__ | ||
| 3 | |||
| 4 | #include <linux/types.h> | ||
| 5 | |||
| 6 | struct netlink_diag_req { | ||
| 7 | __u8 sdiag_family; | ||
| 8 | __u8 sdiag_protocol; | ||
| 9 | __u16 pad; | ||
| 10 | __u32 ndiag_ino; | ||
| 11 | __u32 ndiag_show; | ||
| 12 | __u32 ndiag_cookie[2]; | ||
| 13 | }; | ||
| 14 | |||
| 15 | struct netlink_diag_msg { | ||
| 16 | __u8 ndiag_family; | ||
| 17 | __u8 ndiag_type; | ||
| 18 | __u8 ndiag_protocol; | ||
| 19 | __u8 ndiag_state; | ||
| 20 | |||
| 21 | __u32 ndiag_portid; | ||
| 22 | __u32 ndiag_dst_portid; | ||
| 23 | __u32 ndiag_dst_group; | ||
| 24 | __u32 ndiag_ino; | ||
| 25 | __u32 ndiag_cookie[2]; | ||
| 26 | }; | ||
| 27 | |||
| 28 | struct netlink_diag_ring { | ||
| 29 | __u32 ndr_block_size; | ||
| 30 | __u32 ndr_block_nr; | ||
| 31 | __u32 ndr_frame_size; | ||
| 32 | __u32 ndr_frame_nr; | ||
| 33 | }; | ||
| 34 | |||
| 35 | enum { | ||
| 36 | NETLINK_DIAG_MEMINFO, | ||
| 37 | NETLINK_DIAG_GROUPS, | ||
| 38 | NETLINK_DIAG_RX_RING, | ||
| 39 | NETLINK_DIAG_TX_RING, | ||
| 40 | |||
| 41 | __NETLINK_DIAG_MAX, | ||
| 42 | }; | ||
| 43 | |||
| 44 | #define NETLINK_DIAG_MAX (__NETLINK_DIAG_MAX - 1) | ||
| 45 | |||
| 46 | #define NDIAG_PROTO_ALL ((__u8) ~0) | ||
| 47 | |||
| 48 | #define NDIAG_SHOW_MEMINFO 0x00000001 /* show memory info of a socket */ | ||
| 49 | #define NDIAG_SHOW_GROUPS 0x00000002 /* show groups of a netlink socket */ | ||
| 50 | #define NDIAG_SHOW_RING_CFG 0x00000004 /* show ring configuration */ | ||
| 51 | |||
| 52 | #endif | ||
diff --git a/include/uapi/linux/nfc.h b/include/uapi/linux/nfc.h index 7969f46f1bb3..7c6f627a717d 100644 --- a/include/uapi/linux/nfc.h +++ b/include/uapi/linux/nfc.h | |||
| @@ -90,6 +90,8 @@ enum nfc_commands { | |||
| 90 | NFC_CMD_LLC_SET_PARAMS, | 90 | NFC_CMD_LLC_SET_PARAMS, |
| 91 | NFC_CMD_ENABLE_SE, | 91 | NFC_CMD_ENABLE_SE, |
| 92 | NFC_CMD_DISABLE_SE, | 92 | NFC_CMD_DISABLE_SE, |
| 93 | NFC_CMD_LLC_SDREQ, | ||
| 94 | NFC_EVENT_LLC_SDRES, | ||
| 93 | /* private: internal use only */ | 95 | /* private: internal use only */ |
| 94 | __NFC_CMD_AFTER_LAST | 96 | __NFC_CMD_AFTER_LAST |
| 95 | }; | 97 | }; |
| @@ -140,11 +142,21 @@ enum nfc_attrs { | |||
| 140 | NFC_ATTR_LLC_PARAM_RW, | 142 | NFC_ATTR_LLC_PARAM_RW, |
| 141 | NFC_ATTR_LLC_PARAM_MIUX, | 143 | NFC_ATTR_LLC_PARAM_MIUX, |
| 142 | NFC_ATTR_SE, | 144 | NFC_ATTR_SE, |
| 145 | NFC_ATTR_LLC_SDP, | ||
| 143 | /* private: internal use only */ | 146 | /* private: internal use only */ |
| 144 | __NFC_ATTR_AFTER_LAST | 147 | __NFC_ATTR_AFTER_LAST |
| 145 | }; | 148 | }; |
| 146 | #define NFC_ATTR_MAX (__NFC_ATTR_AFTER_LAST - 1) | 149 | #define NFC_ATTR_MAX (__NFC_ATTR_AFTER_LAST - 1) |
| 147 | 150 | ||
| 151 | enum nfc_sdp_attr { | ||
| 152 | NFC_SDP_ATTR_UNSPEC, | ||
| 153 | NFC_SDP_ATTR_URI, | ||
| 154 | NFC_SDP_ATTR_SAP, | ||
| 155 | /* private: internal use only */ | ||
| 156 | __NFC_SDP_ATTR_AFTER_LAST | ||
| 157 | }; | ||
| 158 | #define NFC_SDP_ATTR_MAX (__NFC_SDP_ATTR_AFTER_LAST - 1) | ||
| 159 | |||
| 148 | #define NFC_DEVICE_NAME_MAXSIZE 8 | 160 | #define NFC_DEVICE_NAME_MAXSIZE 8 |
| 149 | #define NFC_NFCID1_MAXSIZE 10 | 161 | #define NFC_NFCID1_MAXSIZE 10 |
| 150 | #define NFC_SENSB_RES_MAXSIZE 12 | 162 | #define NFC_SENSB_RES_MAXSIZE 12 |
| @@ -220,4 +232,11 @@ struct sockaddr_nfc_llcp { | |||
| 220 | #define NFC_LLCP_DIRECTION_RX 0x00 | 232 | #define NFC_LLCP_DIRECTION_RX 0x00 |
| 221 | #define NFC_LLCP_DIRECTION_TX 0x01 | 233 | #define NFC_LLCP_DIRECTION_TX 0x01 |
| 222 | 234 | ||
| 235 | /* socket option names */ | ||
| 236 | #define NFC_LLCP_RW 0 | ||
| 237 | #define NFC_LLCP_MIUX 1 | ||
| 238 | #define NFC_LLCP_REMOTE_MIU 2 | ||
| 239 | #define NFC_LLCP_REMOTE_LTO 3 | ||
| 240 | #define NFC_LLCP_REMOTE_RW 4 | ||
| 241 | |||
| 223 | #endif /*__LINUX_NFC_H */ | 242 | #endif /*__LINUX_NFC_H */ |
diff --git a/include/uapi/linux/nl80211.h b/include/uapi/linux/nl80211.h index c46bb016f4e4..d1e48b5e348f 100644 --- a/include/uapi/linux/nl80211.h +++ b/include/uapi/linux/nl80211.h | |||
| @@ -36,7 +36,21 @@ | |||
| 36 | * The station is still assumed to belong to the AP interface it was added | 36 | * The station is still assumed to belong to the AP interface it was added |
| 37 | * to. | 37 | * to. |
| 38 | * | 38 | * |
| 39 | * TODO: need more info? | 39 | * Station handling varies per interface type and depending on the driver's |
| 40 | * capabilities. | ||
| 41 | * | ||
| 42 | * For drivers supporting TDLS with external setup (WIPHY_FLAG_SUPPORTS_TDLS | ||
| 43 | * and WIPHY_FLAG_TDLS_EXTERNAL_SETUP), the station lifetime is as follows: | ||
| 44 | * - a setup station entry is added, not yet authorized, without any rate | ||
| 45 | * or capability information, this just exists to avoid race conditions | ||
| 46 | * - when the TDLS setup is done, a single NL80211_CMD_SET_STATION is valid | ||
| 47 | * to add rate and capability information to the station and at the same | ||
| 48 | * time mark it authorized. | ||
| 49 | * - %NL80211_TDLS_ENABLE_LINK is then used | ||
| 50 | * - after this, the only valid operation is to remove it by tearing down | ||
| 51 | * the TDLS link (%NL80211_TDLS_DISABLE_LINK) | ||
| 52 | * | ||
| 53 | * TODO: need more info for other interface types | ||
| 40 | */ | 54 | */ |
| 41 | 55 | ||
| 42 | /** | 56 | /** |
| @@ -499,9 +513,11 @@ | |||
| 499 | * @NL80211_CMD_NEW_PEER_CANDIDATE: Notification on the reception of a | 513 | * @NL80211_CMD_NEW_PEER_CANDIDATE: Notification on the reception of a |
| 500 | * beacon or probe response from a compatible mesh peer. This is only | 514 | * beacon or probe response from a compatible mesh peer. This is only |
| 501 | * sent while no station information (sta_info) exists for the new peer | 515 | * sent while no station information (sta_info) exists for the new peer |
| 502 | * candidate and when @NL80211_MESH_SETUP_USERSPACE_AUTH is set. On | 516 | * candidate and when @NL80211_MESH_SETUP_USERSPACE_AUTH, |
| 503 | * reception of this notification, userspace may decide to create a new | 517 | * @NL80211_MESH_SETUP_USERSPACE_AMPE, or |
| 504 | * station (@NL80211_CMD_NEW_STATION). To stop this notification from | 518 | * @NL80211_MESH_SETUP_USERSPACE_MPM is set. On reception of this |
| 519 | * notification, userspace may decide to create a new station | ||
| 520 | * (@NL80211_CMD_NEW_STATION). To stop this notification from | ||
| 505 | * reoccurring, the userspace authentication daemon may want to create the | 521 | * reoccurring, the userspace authentication daemon may want to create the |
| 506 | * new station with the AUTHENTICATED flag unset and maybe change it later | 522 | * new station with the AUTHENTICATED flag unset and maybe change it later |
| 507 | * depending on the authentication result. | 523 | * depending on the authentication result. |
| @@ -611,6 +627,25 @@ | |||
| 611 | * %NL80211_ATTR_RADAR_EVENT is used to inform about the type of the | 627 | * %NL80211_ATTR_RADAR_EVENT is used to inform about the type of the |
| 612 | * event. | 628 | * event. |
| 613 | * | 629 | * |
| 630 | * @NL80211_CMD_GET_PROTOCOL_FEATURES: Get global nl80211 protocol features, | ||
| 631 | * i.e. features for the nl80211 protocol rather than device features. | ||
| 632 | * Returns the features in the %NL80211_ATTR_PROTOCOL_FEATURES bitmap. | ||
| 633 | * | ||
| 634 | * @NL80211_CMD_UPDATE_FT_IES: Pass down the most up-to-date Fast Transition | ||
| 635 | * Information Element to the WLAN driver | ||
| 636 | * | ||
| 637 | * @NL80211_CMD_FT_EVENT: Send a Fast transition event from the WLAN driver | ||
| 638 | * to the supplicant. This will carry the target AP's MAC address along | ||
| 639 | * with the relevant Information Elements. This event is used to report | ||
| 640 | * received FT IEs (MDIE, FTIE, RSN IE, TIE, RICIE). | ||
| 641 | * | ||
| 642 | * @NL80211_CMD_CRIT_PROTOCOL_START: Indicates user-space will start running | ||
| 643 | * a critical protocol that needs more reliability in the connection to | ||
| 644 | * complete. | ||
| 645 | * | ||
| 646 | * @NL80211_CMD_CRIT_PROTOCOL_STOP: Indicates the connection reliability can | ||
| 647 | * return back to normal. | ||
| 648 | * | ||
| 614 | * @NL80211_CMD_MAX: highest used command number | 649 | * @NL80211_CMD_MAX: highest used command number |
| 615 | * @__NL80211_CMD_AFTER_LAST: internal use | 650 | * @__NL80211_CMD_AFTER_LAST: internal use |
| 616 | */ | 651 | */ |
| @@ -765,6 +800,14 @@ enum nl80211_commands { | |||
| 765 | 800 | ||
| 766 | NL80211_CMD_RADAR_DETECT, | 801 | NL80211_CMD_RADAR_DETECT, |
| 767 | 802 | ||
| 803 | NL80211_CMD_GET_PROTOCOL_FEATURES, | ||
| 804 | |||
| 805 | NL80211_CMD_UPDATE_FT_IES, | ||
| 806 | NL80211_CMD_FT_EVENT, | ||
| 807 | |||
| 808 | NL80211_CMD_CRIT_PROTOCOL_START, | ||
| 809 | NL80211_CMD_CRIT_PROTOCOL_STOP, | ||
| 810 | |||
| 768 | /* add new commands above here */ | 811 | /* add new commands above here */ |
| 769 | 812 | ||
| 770 | /* used to define NL80211_CMD_MAX below */ | 813 | /* used to define NL80211_CMD_MAX below */ |
| @@ -884,7 +927,8 @@ enum nl80211_commands { | |||
| 884 | * consisting of a nested array. | 927 | * consisting of a nested array. |
| 885 | * | 928 | * |
| 886 | * @NL80211_ATTR_MESH_ID: mesh id (1-32 bytes). | 929 | * @NL80211_ATTR_MESH_ID: mesh id (1-32 bytes). |
| 887 | * @NL80211_ATTR_STA_PLINK_ACTION: action to perform on the mesh peer link. | 930 | * @NL80211_ATTR_STA_PLINK_ACTION: action to perform on the mesh peer link |
| 931 | * (see &enum nl80211_plink_action). | ||
| 888 | * @NL80211_ATTR_MPATH_NEXT_HOP: MAC address of the next hop for a mesh path. | 932 | * @NL80211_ATTR_MPATH_NEXT_HOP: MAC address of the next hop for a mesh path. |
| 889 | * @NL80211_ATTR_MPATH_INFO: information about a mesh_path, part of mesh path | 933 | * @NL80211_ATTR_MPATH_INFO: information about a mesh_path, part of mesh path |
| 890 | * info given for %NL80211_CMD_GET_MPATH, nested attribute described at | 934 | * info given for %NL80211_CMD_GET_MPATH, nested attribute described at |
| @@ -1167,10 +1211,10 @@ enum nl80211_commands { | |||
| 1167 | * @NL80211_ATTR_SUPPORT_MESH_AUTH: Currently, this means the underlying driver | 1211 | * @NL80211_ATTR_SUPPORT_MESH_AUTH: Currently, this means the underlying driver |
| 1168 | * allows auth frames in a mesh to be passed to userspace for processing via | 1212 | * allows auth frames in a mesh to be passed to userspace for processing via |
| 1169 | * the @NL80211_MESH_SETUP_USERSPACE_AUTH flag. | 1213 | * the @NL80211_MESH_SETUP_USERSPACE_AUTH flag. |
| 1170 | * @NL80211_ATTR_STA_PLINK_STATE: The state of a mesh peer link as | 1214 | * @NL80211_ATTR_STA_PLINK_STATE: The state of a mesh peer link as defined in |
| 1171 | * defined in &enum nl80211_plink_state. Used when userspace is | 1215 | * &enum nl80211_plink_state. Used when userspace is driving the peer link |
| 1172 | * driving the peer link management state machine. | 1216 | * management state machine. @NL80211_MESH_SETUP_USERSPACE_AMPE or |
| 1173 | * @NL80211_MESH_SETUP_USERSPACE_AMPE must be enabled. | 1217 | * @NL80211_MESH_SETUP_USERSPACE_MPM must be enabled. |
| 1174 | * | 1218 | * |
| 1175 | * @NL80211_ATTR_WOWLAN_TRIGGERS_SUPPORTED: indicates, as part of the wiphy | 1219 | * @NL80211_ATTR_WOWLAN_TRIGGERS_SUPPORTED: indicates, as part of the wiphy |
| 1176 | * capabilities, the supported WoWLAN triggers | 1220 | * capabilities, the supported WoWLAN triggers |
| @@ -1368,6 +1412,23 @@ enum nl80211_commands { | |||
| 1368 | * advertised to the driver, e.g., to enable TDLS off channel operations | 1412 | * advertised to the driver, e.g., to enable TDLS off channel operations |
| 1369 | * and PU-APSD. | 1413 | * and PU-APSD. |
| 1370 | * | 1414 | * |
| 1415 | * @NL80211_ATTR_PROTOCOL_FEATURES: global nl80211 feature flags, see | ||
| 1416 | * &enum nl80211_protocol_features, the attribute is a u32. | ||
| 1417 | * | ||
| 1418 | * @NL80211_ATTR_SPLIT_WIPHY_DUMP: flag attribute, userspace supports | ||
| 1419 | * receiving the data for a single wiphy split across multiple | ||
| 1420 | * messages, given with wiphy dump message | ||
| 1421 | * | ||
| 1422 | * @NL80211_ATTR_MDID: Mobility Domain Identifier | ||
| 1423 | * | ||
| 1424 | * @NL80211_ATTR_IE_RIC: Resource Information Container Information | ||
| 1425 | * Element | ||
| 1426 | * | ||
| 1427 | * @NL80211_ATTR_CRIT_PROT_ID: critical protocol identifier requiring increased | ||
| 1428 | * reliability, see &enum nl80211_crit_proto_id (u16). | ||
| 1429 | * @NL80211_ATTR_MAX_CRIT_PROT_DURATION: duration in milliseconds in which | ||
| 1430 | * the connection should have increased reliability (u16). | ||
| 1431 | * | ||
| 1371 | * @NL80211_ATTR_MAX: highest attribute number currently defined | 1432 | * @NL80211_ATTR_MAX: highest attribute number currently defined |
| 1372 | * @__NL80211_ATTR_AFTER_LAST: internal use | 1433 | * @__NL80211_ATTR_AFTER_LAST: internal use |
| 1373 | */ | 1434 | */ |
| @@ -1654,6 +1715,18 @@ enum nl80211_attrs { | |||
| 1654 | NL80211_ATTR_STA_CAPABILITY, | 1715 | NL80211_ATTR_STA_CAPABILITY, |
| 1655 | NL80211_ATTR_STA_EXT_CAPABILITY, | 1716 | NL80211_ATTR_STA_EXT_CAPABILITY, |
| 1656 | 1717 | ||
| 1718 | NL80211_ATTR_PROTOCOL_FEATURES, | ||
| 1719 | NL80211_ATTR_SPLIT_WIPHY_DUMP, | ||
| 1720 | |||
| 1721 | NL80211_ATTR_DISABLE_VHT, | ||
| 1722 | NL80211_ATTR_VHT_CAPABILITY_MASK, | ||
| 1723 | |||
| 1724 | NL80211_ATTR_MDID, | ||
| 1725 | NL80211_ATTR_IE_RIC, | ||
| 1726 | |||
| 1727 | NL80211_ATTR_CRIT_PROT_ID, | ||
| 1728 | NL80211_ATTR_MAX_CRIT_PROT_DURATION, | ||
| 1729 | |||
| 1657 | /* add attributes here, update the policy in nl80211.c */ | 1730 | /* add attributes here, update the policy in nl80211.c */ |
| 1658 | 1731 | ||
| 1659 | __NL80211_ATTR_AFTER_LAST, | 1732 | __NL80211_ATTR_AFTER_LAST, |
| @@ -2412,8 +2485,10 @@ enum nl80211_mesh_power_mode { | |||
| 2412 | * @NL80211_MESHCONF_TTL: specifies the value of TTL field set at a source mesh | 2485 | * @NL80211_MESHCONF_TTL: specifies the value of TTL field set at a source mesh |
| 2413 | * point. | 2486 | * point. |
| 2414 | * | 2487 | * |
| 2415 | * @NL80211_MESHCONF_AUTO_OPEN_PLINKS: whether we should automatically | 2488 | * @NL80211_MESHCONF_AUTO_OPEN_PLINKS: whether we should automatically open |
| 2416 | * open peer links when we detect compatible mesh peers. | 2489 | * peer links when we detect compatible mesh peers. Disabled if |
| 2490 | * @NL80211_MESH_SETUP_USERSPACE_MPM or @NL80211_MESH_SETUP_USERSPACE_AMPE are | ||
| 2491 | * set. | ||
| 2417 | * | 2492 | * |
| 2418 | * @NL80211_MESHCONF_HWMP_MAX_PREQ_RETRIES: the number of action frames | 2493 | * @NL80211_MESHCONF_HWMP_MAX_PREQ_RETRIES: the number of action frames |
| 2419 | * containing a PREQ that an MP can send to a particular destination (path | 2494 | * containing a PREQ that an MP can send to a particular destination (path |
| @@ -2559,6 +2634,9 @@ enum nl80211_meshconf_params { | |||
| 2559 | * vendor specific synchronization method or disable it to use the default | 2634 | * vendor specific synchronization method or disable it to use the default |
| 2560 | * neighbor offset synchronization | 2635 | * neighbor offset synchronization |
| 2561 | * | 2636 | * |
| 2637 | * @NL80211_MESH_SETUP_USERSPACE_MPM: Enable this option if userspace will | ||
| 2638 | * implement an MPM which handles peer allocation and state. | ||
| 2639 | * | ||
| 2562 | * @NL80211_MESH_SETUP_ATTR_MAX: highest possible mesh setup attribute number | 2640 | * @NL80211_MESH_SETUP_ATTR_MAX: highest possible mesh setup attribute number |
| 2563 | * | 2641 | * |
| 2564 | * @__NL80211_MESH_SETUP_ATTR_AFTER_LAST: Internal use | 2642 | * @__NL80211_MESH_SETUP_ATTR_AFTER_LAST: Internal use |
| @@ -2571,6 +2649,7 @@ enum nl80211_mesh_setup_params { | |||
| 2571 | NL80211_MESH_SETUP_USERSPACE_AUTH, | 2649 | NL80211_MESH_SETUP_USERSPACE_AUTH, |
| 2572 | NL80211_MESH_SETUP_USERSPACE_AMPE, | 2650 | NL80211_MESH_SETUP_USERSPACE_AMPE, |
| 2573 | NL80211_MESH_SETUP_ENABLE_VENDOR_SYNC, | 2651 | NL80211_MESH_SETUP_ENABLE_VENDOR_SYNC, |
| 2652 | NL80211_MESH_SETUP_USERSPACE_MPM, | ||
| 2574 | 2653 | ||
| 2575 | /* keep last */ | 2654 | /* keep last */ |
| 2576 | __NL80211_MESH_SETUP_ATTR_AFTER_LAST, | 2655 | __NL80211_MESH_SETUP_ATTR_AFTER_LAST, |
| @@ -3307,6 +3386,23 @@ enum nl80211_plink_state { | |||
| 3307 | MAX_NL80211_PLINK_STATES = NUM_NL80211_PLINK_STATES - 1 | 3386 | MAX_NL80211_PLINK_STATES = NUM_NL80211_PLINK_STATES - 1 |
| 3308 | }; | 3387 | }; |
| 3309 | 3388 | ||
| 3389 | /** | ||
| 3390 | * enum nl80211_plink_action - actions to perform in mesh peers | ||
| 3391 | * | ||
| 3392 | * @NL80211_PLINK_ACTION_NO_ACTION: perform no action | ||
| 3393 | * @NL80211_PLINK_ACTION_OPEN: start mesh peer link establishment | ||
| 3394 | * @NL80211_PLINK_ACTION_BLOCK: block traffic from this mesh peer | ||
| 3395 | * @NUM_NL80211_PLINK_ACTIONS: number of possible actions | ||
| 3396 | */ | ||
| 3397 | enum plink_actions { | ||
| 3398 | NL80211_PLINK_ACTION_NO_ACTION, | ||
| 3399 | NL80211_PLINK_ACTION_OPEN, | ||
| 3400 | NL80211_PLINK_ACTION_BLOCK, | ||
| 3401 | |||
| 3402 | NUM_NL80211_PLINK_ACTIONS, | ||
| 3403 | }; | ||
| 3404 | |||
| 3405 | |||
| 3310 | #define NL80211_KCK_LEN 16 | 3406 | #define NL80211_KCK_LEN 16 |
| 3311 | #define NL80211_KEK_LEN 16 | 3407 | #define NL80211_KEK_LEN 16 |
| 3312 | #define NL80211_REPLAY_CTR_LEN 8 | 3408 | #define NL80211_REPLAY_CTR_LEN 8 |
| @@ -3456,6 +3552,10 @@ enum nl80211_ap_sme_features { | |||
| 3456 | * stations the authenticated/associated bits have to be set in the mask. | 3552 | * stations the authenticated/associated bits have to be set in the mask. |
| 3457 | * @NL80211_FEATURE_ADVERTISE_CHAN_LIMITS: cfg80211 advertises channel limits | 3553 | * @NL80211_FEATURE_ADVERTISE_CHAN_LIMITS: cfg80211 advertises channel limits |
| 3458 | * (HT40, VHT 80/160 MHz) if this flag is set | 3554 | * (HT40, VHT 80/160 MHz) if this flag is set |
| 3555 | * @NL80211_FEATURE_USERSPACE_MPM: This driver supports a userspace Mesh | ||
| 3556 | * Peering Management entity which may be implemented by registering for | ||
| 3557 | * beacons or NL80211_CMD_NEW_PEER_CANDIDATE events. The mesh beacon is | ||
| 3558 | * still generated by the driver. | ||
| 3459 | */ | 3559 | */ |
| 3460 | enum nl80211_feature_flags { | 3560 | enum nl80211_feature_flags { |
| 3461 | NL80211_FEATURE_SK_TX_STATUS = 1 << 0, | 3561 | NL80211_FEATURE_SK_TX_STATUS = 1 << 0, |
| @@ -3474,6 +3574,7 @@ enum nl80211_feature_flags { | |||
| 3474 | /* bit 13 is reserved */ | 3574 | /* bit 13 is reserved */ |
| 3475 | NL80211_FEATURE_ADVERTISE_CHAN_LIMITS = 1 << 14, | 3575 | NL80211_FEATURE_ADVERTISE_CHAN_LIMITS = 1 << 14, |
| 3476 | NL80211_FEATURE_FULL_AP_CLIENT_STATE = 1 << 15, | 3576 | NL80211_FEATURE_FULL_AP_CLIENT_STATE = 1 << 15, |
| 3577 | NL80211_FEATURE_USERSPACE_MPM = 1 << 16, | ||
| 3477 | }; | 3578 | }; |
| 3478 | 3579 | ||
| 3479 | /** | 3580 | /** |
| @@ -3587,4 +3688,37 @@ enum nl80211_dfs_state { | |||
| 3587 | NL80211_DFS_AVAILABLE, | 3688 | NL80211_DFS_AVAILABLE, |
| 3588 | }; | 3689 | }; |
| 3589 | 3690 | ||
| 3691 | /** | ||
| 3692 | * enum enum nl80211_protocol_features - nl80211 protocol features | ||
| 3693 | * @NL80211_PROTOCOL_FEATURE_SPLIT_WIPHY_DUMP: nl80211 supports splitting | ||
| 3694 | * wiphy dumps (if requested by the application with the attribute | ||
| 3695 | * %NL80211_ATTR_SPLIT_WIPHY_DUMP. Also supported is filtering the | ||
| 3696 | * wiphy dump by %NL80211_ATTR_WIPHY, %NL80211_ATTR_IFINDEX or | ||
| 3697 | * %NL80211_ATTR_WDEV. | ||
| 3698 | */ | ||
| 3699 | enum nl80211_protocol_features { | ||
| 3700 | NL80211_PROTOCOL_FEATURE_SPLIT_WIPHY_DUMP = 1 << 0, | ||
| 3701 | }; | ||
| 3702 | |||
| 3703 | /** | ||
| 3704 | * enum nl80211_crit_proto_id - nl80211 critical protocol identifiers | ||
| 3705 | * | ||
| 3706 | * @NL80211_CRIT_PROTO_UNSPEC: protocol unspecified. | ||
| 3707 | * @NL80211_CRIT_PROTO_DHCP: BOOTP or DHCPv6 protocol. | ||
| 3708 | * @NL80211_CRIT_PROTO_EAPOL: EAPOL protocol. | ||
| 3709 | * @NL80211_CRIT_PROTO_APIPA: APIPA protocol. | ||
| 3710 | * @NUM_NL80211_CRIT_PROTO: must be kept last. | ||
| 3711 | */ | ||
| 3712 | enum nl80211_crit_proto_id { | ||
| 3713 | NL80211_CRIT_PROTO_UNSPEC, | ||
| 3714 | NL80211_CRIT_PROTO_DHCP, | ||
| 3715 | NL80211_CRIT_PROTO_EAPOL, | ||
| 3716 | NL80211_CRIT_PROTO_APIPA, | ||
| 3717 | /* add other protocols before this one */ | ||
| 3718 | NUM_NL80211_CRIT_PROTO | ||
| 3719 | }; | ||
| 3720 | |||
| 3721 | /* maximum duration for critical protocol measures */ | ||
| 3722 | #define NL80211_CRIT_PROTO_MAX_DURATION 5000 /* msec */ | ||
| 3723 | |||
| 3590 | #endif /* __LINUX_NL80211_H */ | 3724 | #endif /* __LINUX_NL80211_H */ |
diff --git a/include/uapi/linux/openvswitch.h b/include/uapi/linux/openvswitch.h new file mode 100644 index 000000000000..405918dd7b3f --- /dev/null +++ b/include/uapi/linux/openvswitch.h | |||
| @@ -0,0 +1,456 @@ | |||
| 1 | |||
| 2 | /* | ||
| 3 | * Copyright (c) 2007-2011 Nicira Networks. | ||
| 4 | * | ||
| 5 | * This program is free software; you can redistribute it and/or | ||
| 6 | * modify it under the terms of version 2 of the GNU General Public | ||
| 7 | * License as published by the Free Software Foundation. | ||
| 8 | * | ||
| 9 | * This program is distributed in the hope that it will be useful, but | ||
| 10 | * WITHOUT ANY WARRANTY; without even the implied warranty of | ||
| 11 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU | ||
| 12 | * General Public License for more details. | ||
| 13 | * | ||
| 14 | * You should have received a copy of the GNU General Public License | ||
| 15 | * along with this program; if not, write to the Free Software | ||
| 16 | * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA | ||
| 17 | * 02110-1301, USA | ||
| 18 | */ | ||
| 19 | |||
| 20 | #ifndef _UAPI__LINUX_OPENVSWITCH_H | ||
| 21 | #define _UAPI__LINUX_OPENVSWITCH_H 1 | ||
| 22 | |||
| 23 | #include <linux/types.h> | ||
| 24 | #include <linux/if_ether.h> | ||
| 25 | |||
| 26 | /** | ||
| 27 | * struct ovs_header - header for OVS Generic Netlink messages. | ||
| 28 | * @dp_ifindex: ifindex of local port for datapath (0 to make a request not | ||
| 29 | * specific to a datapath). | ||
| 30 | * | ||
| 31 | * Attributes following the header are specific to a particular OVS Generic | ||
| 32 | * Netlink family, but all of the OVS families use this header. | ||
| 33 | */ | ||
| 34 | |||
| 35 | struct ovs_header { | ||
| 36 | int dp_ifindex; | ||
| 37 | }; | ||
| 38 | |||
| 39 | /* Datapaths. */ | ||
| 40 | |||
| 41 | #define OVS_DATAPATH_FAMILY "ovs_datapath" | ||
| 42 | #define OVS_DATAPATH_MCGROUP "ovs_datapath" | ||
| 43 | #define OVS_DATAPATH_VERSION 0x1 | ||
| 44 | |||
| 45 | enum ovs_datapath_cmd { | ||
| 46 | OVS_DP_CMD_UNSPEC, | ||
| 47 | OVS_DP_CMD_NEW, | ||
| 48 | OVS_DP_CMD_DEL, | ||
| 49 | OVS_DP_CMD_GET, | ||
| 50 | OVS_DP_CMD_SET | ||
| 51 | }; | ||
| 52 | |||
| 53 | /** | ||
| 54 | * enum ovs_datapath_attr - attributes for %OVS_DP_* commands. | ||
| 55 | * @OVS_DP_ATTR_NAME: Name of the network device that serves as the "local | ||
| 56 | * port". This is the name of the network device whose dp_ifindex is given in | ||
| 57 | * the &struct ovs_header. Always present in notifications. Required in | ||
| 58 | * %OVS_DP_NEW requests. May be used as an alternative to specifying | ||
| 59 | * dp_ifindex in other requests (with a dp_ifindex of 0). | ||
| 60 | * @OVS_DP_ATTR_UPCALL_PID: The Netlink socket in userspace that is initially | ||
| 61 | * set on the datapath port (for OVS_ACTION_ATTR_MISS). Only valid on | ||
| 62 | * %OVS_DP_CMD_NEW requests. A value of zero indicates that upcalls should | ||
| 63 | * not be sent. | ||
| 64 | * @OVS_DP_ATTR_STATS: Statistics about packets that have passed through the | ||
| 65 | * datapath. Always present in notifications. | ||
| 66 | * | ||
| 67 | * These attributes follow the &struct ovs_header within the Generic Netlink | ||
| 68 | * payload for %OVS_DP_* commands. | ||
| 69 | */ | ||
| 70 | enum ovs_datapath_attr { | ||
| 71 | OVS_DP_ATTR_UNSPEC, | ||
| 72 | OVS_DP_ATTR_NAME, /* name of dp_ifindex netdev */ | ||
| 73 | OVS_DP_ATTR_UPCALL_PID, /* Netlink PID to receive upcalls */ | ||
| 74 | OVS_DP_ATTR_STATS, /* struct ovs_dp_stats */ | ||
| 75 | __OVS_DP_ATTR_MAX | ||
| 76 | }; | ||
| 77 | |||
| 78 | #define OVS_DP_ATTR_MAX (__OVS_DP_ATTR_MAX - 1) | ||
| 79 | |||
| 80 | struct ovs_dp_stats { | ||
| 81 | __u64 n_hit; /* Number of flow table matches. */ | ||
| 82 | __u64 n_missed; /* Number of flow table misses. */ | ||
| 83 | __u64 n_lost; /* Number of misses not sent to userspace. */ | ||
| 84 | __u64 n_flows; /* Number of flows present */ | ||
| 85 | }; | ||
| 86 | |||
| 87 | struct ovs_vport_stats { | ||
| 88 | __u64 rx_packets; /* total packets received */ | ||
| 89 | __u64 tx_packets; /* total packets transmitted */ | ||
| 90 | __u64 rx_bytes; /* total bytes received */ | ||
| 91 | __u64 tx_bytes; /* total bytes transmitted */ | ||
| 92 | __u64 rx_errors; /* bad packets received */ | ||
| 93 | __u64 tx_errors; /* packet transmit problems */ | ||
| 94 | __u64 rx_dropped; /* no space in linux buffers */ | ||
| 95 | __u64 tx_dropped; /* no space available in linux */ | ||
| 96 | }; | ||
| 97 | |||
| 98 | /* Fixed logical ports. */ | ||
| 99 | #define OVSP_LOCAL ((__u32)0) | ||
| 100 | |||
| 101 | /* Packet transfer. */ | ||
| 102 | |||
| 103 | #define OVS_PACKET_FAMILY "ovs_packet" | ||
| 104 | #define OVS_PACKET_VERSION 0x1 | ||
| 105 | |||
| 106 | enum ovs_packet_cmd { | ||
| 107 | OVS_PACKET_CMD_UNSPEC, | ||
| 108 | |||
| 109 | /* Kernel-to-user notifications. */ | ||
| 110 | OVS_PACKET_CMD_MISS, /* Flow table miss. */ | ||
| 111 | OVS_PACKET_CMD_ACTION, /* OVS_ACTION_ATTR_USERSPACE action. */ | ||
| 112 | |||
| 113 | /* Userspace commands. */ | ||
| 114 | OVS_PACKET_CMD_EXECUTE /* Apply actions to a packet. */ | ||
| 115 | }; | ||
| 116 | |||
| 117 | /** | ||
| 118 | * enum ovs_packet_attr - attributes for %OVS_PACKET_* commands. | ||
| 119 | * @OVS_PACKET_ATTR_PACKET: Present for all notifications. Contains the entire | ||
| 120 | * packet as received, from the start of the Ethernet header onward. For | ||
| 121 | * %OVS_PACKET_CMD_ACTION, %OVS_PACKET_ATTR_PACKET reflects changes made by | ||
| 122 | * actions preceding %OVS_ACTION_ATTR_USERSPACE, but %OVS_PACKET_ATTR_KEY is | ||
| 123 | * the flow key extracted from the packet as originally received. | ||
| 124 | * @OVS_PACKET_ATTR_KEY: Present for all notifications. Contains the flow key | ||
| 125 | * extracted from the packet as nested %OVS_KEY_ATTR_* attributes. This allows | ||
| 126 | * userspace to adapt its flow setup strategy by comparing its notion of the | ||
| 127 | * flow key against the kernel's. | ||
| 128 | * @OVS_PACKET_ATTR_ACTIONS: Contains actions for the packet. Used | ||
| 129 | * for %OVS_PACKET_CMD_EXECUTE. It has nested %OVS_ACTION_ATTR_* attributes. | ||
| 130 | * @OVS_PACKET_ATTR_USERDATA: Present for an %OVS_PACKET_CMD_ACTION | ||
| 131 | * notification if the %OVS_ACTION_ATTR_USERSPACE action specified an | ||
| 132 | * %OVS_USERSPACE_ATTR_USERDATA attribute, with the same length and content | ||
| 133 | * specified there. | ||
| 134 | * | ||
| 135 | * These attributes follow the &struct ovs_header within the Generic Netlink | ||
| 136 | * payload for %OVS_PACKET_* commands. | ||
| 137 | */ | ||
| 138 | enum ovs_packet_attr { | ||
| 139 | OVS_PACKET_ATTR_UNSPEC, | ||
| 140 | OVS_PACKET_ATTR_PACKET, /* Packet data. */ | ||
| 141 | OVS_PACKET_ATTR_KEY, /* Nested OVS_KEY_ATTR_* attributes. */ | ||
| 142 | OVS_PACKET_ATTR_ACTIONS, /* Nested OVS_ACTION_ATTR_* attributes. */ | ||
| 143 | OVS_PACKET_ATTR_USERDATA, /* OVS_ACTION_ATTR_USERSPACE arg. */ | ||
| 144 | __OVS_PACKET_ATTR_MAX | ||
| 145 | }; | ||
| 146 | |||
| 147 | #define OVS_PACKET_ATTR_MAX (__OVS_PACKET_ATTR_MAX - 1) | ||
| 148 | |||
| 149 | /* Virtual ports. */ | ||
| 150 | |||
| 151 | #define OVS_VPORT_FAMILY "ovs_vport" | ||
| 152 | #define OVS_VPORT_MCGROUP "ovs_vport" | ||
| 153 | #define OVS_VPORT_VERSION 0x1 | ||
| 154 | |||
| 155 | enum ovs_vport_cmd { | ||
| 156 | OVS_VPORT_CMD_UNSPEC, | ||
| 157 | OVS_VPORT_CMD_NEW, | ||
| 158 | OVS_VPORT_CMD_DEL, | ||
| 159 | OVS_VPORT_CMD_GET, | ||
| 160 | OVS_VPORT_CMD_SET | ||
| 161 | }; | ||
| 162 | |||
| 163 | enum ovs_vport_type { | ||
| 164 | OVS_VPORT_TYPE_UNSPEC, | ||
| 165 | OVS_VPORT_TYPE_NETDEV, /* network device */ | ||
| 166 | OVS_VPORT_TYPE_INTERNAL, /* network device implemented by datapath */ | ||
| 167 | __OVS_VPORT_TYPE_MAX | ||
| 168 | }; | ||
| 169 | |||
| 170 | #define OVS_VPORT_TYPE_MAX (__OVS_VPORT_TYPE_MAX - 1) | ||
| 171 | |||
| 172 | /** | ||
| 173 | * enum ovs_vport_attr - attributes for %OVS_VPORT_* commands. | ||
| 174 | * @OVS_VPORT_ATTR_PORT_NO: 32-bit port number within datapath. | ||
| 175 | * @OVS_VPORT_ATTR_TYPE: 32-bit %OVS_VPORT_TYPE_* constant describing the type | ||
| 176 | * of vport. | ||
| 177 | * @OVS_VPORT_ATTR_NAME: Name of vport. For a vport based on a network device | ||
| 178 | * this is the name of the network device. Maximum length %IFNAMSIZ-1 bytes | ||
| 179 | * plus a null terminator. | ||
| 180 | * @OVS_VPORT_ATTR_OPTIONS: Vport-specific configuration information. | ||
| 181 | * @OVS_VPORT_ATTR_UPCALL_PID: The Netlink socket in userspace that | ||
| 182 | * OVS_PACKET_CMD_MISS upcalls will be directed to for packets received on | ||
| 183 | * this port. A value of zero indicates that upcalls should not be sent. | ||
| 184 | * @OVS_VPORT_ATTR_STATS: A &struct ovs_vport_stats giving statistics for | ||
| 185 | * packets sent or received through the vport. | ||
| 186 | * | ||
| 187 | * These attributes follow the &struct ovs_header within the Generic Netlink | ||
| 188 | * payload for %OVS_VPORT_* commands. | ||
| 189 | * | ||
| 190 | * For %OVS_VPORT_CMD_NEW requests, the %OVS_VPORT_ATTR_TYPE and | ||
| 191 | * %OVS_VPORT_ATTR_NAME attributes are required. %OVS_VPORT_ATTR_PORT_NO is | ||
| 192 | * optional; if not specified a free port number is automatically selected. | ||
| 193 | * Whether %OVS_VPORT_ATTR_OPTIONS is required or optional depends on the type | ||
| 194 | * of vport. | ||
| 195 | * and other attributes are ignored. | ||
| 196 | * | ||
| 197 | * For other requests, if %OVS_VPORT_ATTR_NAME is specified then it is used to | ||
| 198 | * look up the vport to operate on; otherwise dp_idx from the &struct | ||
| 199 | * ovs_header plus %OVS_VPORT_ATTR_PORT_NO determine the vport. | ||
| 200 | */ | ||
| 201 | enum ovs_vport_attr { | ||
| 202 | OVS_VPORT_ATTR_UNSPEC, | ||
| 203 | OVS_VPORT_ATTR_PORT_NO, /* u32 port number within datapath */ | ||
| 204 | OVS_VPORT_ATTR_TYPE, /* u32 OVS_VPORT_TYPE_* constant. */ | ||
| 205 | OVS_VPORT_ATTR_NAME, /* string name, up to IFNAMSIZ bytes long */ | ||
| 206 | OVS_VPORT_ATTR_OPTIONS, /* nested attributes, varies by vport type */ | ||
| 207 | OVS_VPORT_ATTR_UPCALL_PID, /* u32 Netlink PID to receive upcalls */ | ||
| 208 | OVS_VPORT_ATTR_STATS, /* struct ovs_vport_stats */ | ||
| 209 | __OVS_VPORT_ATTR_MAX | ||
| 210 | }; | ||
| 211 | |||
| 212 | #define OVS_VPORT_ATTR_MAX (__OVS_VPORT_ATTR_MAX - 1) | ||
| 213 | |||
| 214 | /* Flows. */ | ||
| 215 | |||
| 216 | #define OVS_FLOW_FAMILY "ovs_flow" | ||
| 217 | #define OVS_FLOW_MCGROUP "ovs_flow" | ||
| 218 | #define OVS_FLOW_VERSION 0x1 | ||
| 219 | |||
| 220 | enum ovs_flow_cmd { | ||
| 221 | OVS_FLOW_CMD_UNSPEC, | ||
| 222 | OVS_FLOW_CMD_NEW, | ||
| 223 | OVS_FLOW_CMD_DEL, | ||
| 224 | OVS_FLOW_CMD_GET, | ||
| 225 | OVS_FLOW_CMD_SET | ||
| 226 | }; | ||
| 227 | |||
| 228 | struct ovs_flow_stats { | ||
| 229 | __u64 n_packets; /* Number of matched packets. */ | ||
| 230 | __u64 n_bytes; /* Number of matched bytes. */ | ||
| 231 | }; | ||
| 232 | |||
| 233 | enum ovs_key_attr { | ||
| 234 | OVS_KEY_ATTR_UNSPEC, | ||
| 235 | OVS_KEY_ATTR_ENCAP, /* Nested set of encapsulated attributes. */ | ||
| 236 | OVS_KEY_ATTR_PRIORITY, /* u32 skb->priority */ | ||
| 237 | OVS_KEY_ATTR_IN_PORT, /* u32 OVS dp port number */ | ||
| 238 | OVS_KEY_ATTR_ETHERNET, /* struct ovs_key_ethernet */ | ||
| 239 | OVS_KEY_ATTR_VLAN, /* be16 VLAN TCI */ | ||
| 240 | OVS_KEY_ATTR_ETHERTYPE, /* be16 Ethernet type */ | ||
| 241 | OVS_KEY_ATTR_IPV4, /* struct ovs_key_ipv4 */ | ||
| 242 | OVS_KEY_ATTR_IPV6, /* struct ovs_key_ipv6 */ | ||
| 243 | OVS_KEY_ATTR_TCP, /* struct ovs_key_tcp */ | ||
| 244 | OVS_KEY_ATTR_UDP, /* struct ovs_key_udp */ | ||
| 245 | OVS_KEY_ATTR_ICMP, /* struct ovs_key_icmp */ | ||
| 246 | OVS_KEY_ATTR_ICMPV6, /* struct ovs_key_icmpv6 */ | ||
| 247 | OVS_KEY_ATTR_ARP, /* struct ovs_key_arp */ | ||
| 248 | OVS_KEY_ATTR_ND, /* struct ovs_key_nd */ | ||
| 249 | OVS_KEY_ATTR_SKB_MARK, /* u32 skb mark */ | ||
| 250 | __OVS_KEY_ATTR_MAX | ||
| 251 | }; | ||
| 252 | |||
| 253 | #define OVS_KEY_ATTR_MAX (__OVS_KEY_ATTR_MAX - 1) | ||
| 254 | |||
| 255 | /** | ||
| 256 | * enum ovs_frag_type - IPv4 and IPv6 fragment type | ||
| 257 | * @OVS_FRAG_TYPE_NONE: Packet is not a fragment. | ||
| 258 | * @OVS_FRAG_TYPE_FIRST: Packet is a fragment with offset 0. | ||
| 259 | * @OVS_FRAG_TYPE_LATER: Packet is a fragment with nonzero offset. | ||
| 260 | * | ||
| 261 | * Used as the @ipv4_frag in &struct ovs_key_ipv4 and as @ipv6_frag &struct | ||
| 262 | * ovs_key_ipv6. | ||
| 263 | */ | ||
| 264 | enum ovs_frag_type { | ||
| 265 | OVS_FRAG_TYPE_NONE, | ||
| 266 | OVS_FRAG_TYPE_FIRST, | ||
| 267 | OVS_FRAG_TYPE_LATER, | ||
| 268 | __OVS_FRAG_TYPE_MAX | ||
| 269 | }; | ||
| 270 | |||
| 271 | #define OVS_FRAG_TYPE_MAX (__OVS_FRAG_TYPE_MAX - 1) | ||
| 272 | |||
| 273 | struct ovs_key_ethernet { | ||
| 274 | __u8 eth_src[ETH_ALEN]; | ||
| 275 | __u8 eth_dst[ETH_ALEN]; | ||
| 276 | }; | ||
| 277 | |||
| 278 | struct ovs_key_ipv4 { | ||
| 279 | __be32 ipv4_src; | ||
| 280 | __be32 ipv4_dst; | ||
| 281 | __u8 ipv4_proto; | ||
| 282 | __u8 ipv4_tos; | ||
| 283 | __u8 ipv4_ttl; | ||
| 284 | __u8 ipv4_frag; /* One of OVS_FRAG_TYPE_*. */ | ||
| 285 | }; | ||
| 286 | |||
| 287 | struct ovs_key_ipv6 { | ||
| 288 | __be32 ipv6_src[4]; | ||
| 289 | __be32 ipv6_dst[4]; | ||
| 290 | __be32 ipv6_label; /* 20-bits in least-significant bits. */ | ||
| 291 | __u8 ipv6_proto; | ||
| 292 | __u8 ipv6_tclass; | ||
| 293 | __u8 ipv6_hlimit; | ||
| 294 | __u8 ipv6_frag; /* One of OVS_FRAG_TYPE_*. */ | ||
| 295 | }; | ||
| 296 | |||
| 297 | struct ovs_key_tcp { | ||
| 298 | __be16 tcp_src; | ||
| 299 | __be16 tcp_dst; | ||
| 300 | }; | ||
| 301 | |||
| 302 | struct ovs_key_udp { | ||
| 303 | __be16 udp_src; | ||
| 304 | __be16 udp_dst; | ||
| 305 | }; | ||
| 306 | |||
| 307 | struct ovs_key_icmp { | ||
| 308 | __u8 icmp_type; | ||
| 309 | __u8 icmp_code; | ||
| 310 | }; | ||
| 311 | |||
| 312 | struct ovs_key_icmpv6 { | ||
| 313 | __u8 icmpv6_type; | ||
| 314 | __u8 icmpv6_code; | ||
| 315 | }; | ||
| 316 | |||
| 317 | struct ovs_key_arp { | ||
| 318 | __be32 arp_sip; | ||
| 319 | __be32 arp_tip; | ||
| 320 | __be16 arp_op; | ||
| 321 | __u8 arp_sha[ETH_ALEN]; | ||
| 322 | __u8 arp_tha[ETH_ALEN]; | ||
| 323 | }; | ||
| 324 | |||
| 325 | struct ovs_key_nd { | ||
| 326 | __u32 nd_target[4]; | ||
| 327 | __u8 nd_sll[ETH_ALEN]; | ||
| 328 | __u8 nd_tll[ETH_ALEN]; | ||
| 329 | }; | ||
| 330 | |||
| 331 | /** | ||
| 332 | * enum ovs_flow_attr - attributes for %OVS_FLOW_* commands. | ||
| 333 | * @OVS_FLOW_ATTR_KEY: Nested %OVS_KEY_ATTR_* attributes specifying the flow | ||
| 334 | * key. Always present in notifications. Required for all requests (except | ||
| 335 | * dumps). | ||
| 336 | * @OVS_FLOW_ATTR_ACTIONS: Nested %OVS_ACTION_ATTR_* attributes specifying | ||
| 337 | * the actions to take for packets that match the key. Always present in | ||
| 338 | * notifications. Required for %OVS_FLOW_CMD_NEW requests, optional for | ||
| 339 | * %OVS_FLOW_CMD_SET requests. | ||
| 340 | * @OVS_FLOW_ATTR_STATS: &struct ovs_flow_stats giving statistics for this | ||
| 341 | * flow. Present in notifications if the stats would be nonzero. Ignored in | ||
| 342 | * requests. | ||
| 343 | * @OVS_FLOW_ATTR_TCP_FLAGS: An 8-bit value giving the OR'd value of all of the | ||
| 344 | * TCP flags seen on packets in this flow. Only present in notifications for | ||
| 345 | * TCP flows, and only if it would be nonzero. Ignored in requests. | ||
| 346 | * @OVS_FLOW_ATTR_USED: A 64-bit integer giving the time, in milliseconds on | ||
| 347 | * the system monotonic clock, at which a packet was last processed for this | ||
| 348 | * flow. Only present in notifications if a packet has been processed for this | ||
| 349 | * flow. Ignored in requests. | ||
| 350 | * @OVS_FLOW_ATTR_CLEAR: If present in a %OVS_FLOW_CMD_SET request, clears the | ||
| 351 | * last-used time, accumulated TCP flags, and statistics for this flow. | ||
| 352 | * Otherwise ignored in requests. Never present in notifications. | ||
| 353 | * | ||
| 354 | * These attributes follow the &struct ovs_header within the Generic Netlink | ||
| 355 | * payload for %OVS_FLOW_* commands. | ||
| 356 | */ | ||
| 357 | enum ovs_flow_attr { | ||
| 358 | OVS_FLOW_ATTR_UNSPEC, | ||
| 359 | OVS_FLOW_ATTR_KEY, /* Sequence of OVS_KEY_ATTR_* attributes. */ | ||
| 360 | OVS_FLOW_ATTR_ACTIONS, /* Nested OVS_ACTION_ATTR_* attributes. */ | ||
| 361 | OVS_FLOW_ATTR_STATS, /* struct ovs_flow_stats. */ | ||
| 362 | OVS_FLOW_ATTR_TCP_FLAGS, /* 8-bit OR'd TCP flags. */ | ||
| 363 | OVS_FLOW_ATTR_USED, /* u64 msecs last used in monotonic time. */ | ||
| 364 | OVS_FLOW_ATTR_CLEAR, /* Flag to clear stats, tcp_flags, used. */ | ||
| 365 | __OVS_FLOW_ATTR_MAX | ||
| 366 | }; | ||
| 367 | |||
| 368 | #define OVS_FLOW_ATTR_MAX (__OVS_FLOW_ATTR_MAX - 1) | ||
| 369 | |||
| 370 | /** | ||
| 371 | * enum ovs_sample_attr - Attributes for %OVS_ACTION_ATTR_SAMPLE action. | ||
| 372 | * @OVS_SAMPLE_ATTR_PROBABILITY: 32-bit fraction of packets to sample with | ||
| 373 | * @OVS_ACTION_ATTR_SAMPLE. A value of 0 samples no packets, a value of | ||
| 374 | * %UINT32_MAX samples all packets and intermediate values sample intermediate | ||
| 375 | * fractions of packets. | ||
| 376 | * @OVS_SAMPLE_ATTR_ACTIONS: Set of actions to execute in sampling event. | ||
| 377 | * Actions are passed as nested attributes. | ||
| 378 | * | ||
| 379 | * Executes the specified actions with the given probability on a per-packet | ||
| 380 | * basis. | ||
| 381 | */ | ||
| 382 | enum ovs_sample_attr { | ||
| 383 | OVS_SAMPLE_ATTR_UNSPEC, | ||
| 384 | OVS_SAMPLE_ATTR_PROBABILITY, /* u32 number */ | ||
| 385 | OVS_SAMPLE_ATTR_ACTIONS, /* Nested OVS_ACTION_ATTR_* attributes. */ | ||
| 386 | __OVS_SAMPLE_ATTR_MAX, | ||
| 387 | }; | ||
| 388 | |||
| 389 | #define OVS_SAMPLE_ATTR_MAX (__OVS_SAMPLE_ATTR_MAX - 1) | ||
| 390 | |||
| 391 | /** | ||
| 392 | * enum ovs_userspace_attr - Attributes for %OVS_ACTION_ATTR_USERSPACE action. | ||
| 393 | * @OVS_USERSPACE_ATTR_PID: u32 Netlink PID to which the %OVS_PACKET_CMD_ACTION | ||
| 394 | * message should be sent. Required. | ||
| 395 | * @OVS_USERSPACE_ATTR_USERDATA: If present, its variable-length argument is | ||
| 396 | * copied to the %OVS_PACKET_CMD_ACTION message as %OVS_PACKET_ATTR_USERDATA. | ||
| 397 | */ | ||
| 398 | enum ovs_userspace_attr { | ||
| 399 | OVS_USERSPACE_ATTR_UNSPEC, | ||
| 400 | OVS_USERSPACE_ATTR_PID, /* u32 Netlink PID to receive upcalls. */ | ||
| 401 | OVS_USERSPACE_ATTR_USERDATA, /* Optional user-specified cookie. */ | ||
| 402 | __OVS_USERSPACE_ATTR_MAX | ||
| 403 | }; | ||
| 404 | |||
| 405 | #define OVS_USERSPACE_ATTR_MAX (__OVS_USERSPACE_ATTR_MAX - 1) | ||
| 406 | |||
| 407 | /** | ||
| 408 | * struct ovs_action_push_vlan - %OVS_ACTION_ATTR_PUSH_VLAN action argument. | ||
| 409 | * @vlan_tpid: Tag protocol identifier (TPID) to push. | ||
| 410 | * @vlan_tci: Tag control identifier (TCI) to push. The CFI bit must be set | ||
| 411 | * (but it will not be set in the 802.1Q header that is pushed). | ||
| 412 | * | ||
| 413 | * The @vlan_tpid value is typically %ETH_P_8021Q. The only acceptable TPID | ||
| 414 | * values are those that the kernel module also parses as 802.1Q headers, to | ||
| 415 | * prevent %OVS_ACTION_ATTR_PUSH_VLAN followed by %OVS_ACTION_ATTR_POP_VLAN | ||
| 416 | * from having surprising results. | ||
| 417 | */ | ||
| 418 | struct ovs_action_push_vlan { | ||
| 419 | __be16 vlan_tpid; /* 802.1Q TPID. */ | ||
| 420 | __be16 vlan_tci; /* 802.1Q TCI (VLAN ID and priority). */ | ||
| 421 | }; | ||
| 422 | |||
| 423 | /** | ||
| 424 | * enum ovs_action_attr - Action types. | ||
| 425 | * | ||
| 426 | * @OVS_ACTION_ATTR_OUTPUT: Output packet to port. | ||
| 427 | * @OVS_ACTION_ATTR_USERSPACE: Send packet to userspace according to nested | ||
| 428 | * %OVS_USERSPACE_ATTR_* attributes. | ||
| 429 | * @OVS_ACTION_ATTR_SET: Replaces the contents of an existing header. The | ||
| 430 | * single nested %OVS_KEY_ATTR_* attribute specifies a header to modify and its | ||
| 431 | * value. | ||
| 432 | * @OVS_ACTION_ATTR_PUSH_VLAN: Push a new outermost 802.1Q header onto the | ||
| 433 | * packet. | ||
| 434 | * @OVS_ACTION_ATTR_POP_VLAN: Pop the outermost 802.1Q header off the packet. | ||
| 435 | * @OVS_ACTION_ATTR_SAMPLE: Probabilitically executes actions, as specified in | ||
| 436 | * the nested %OVS_SAMPLE_ATTR_* attributes. | ||
| 437 | * | ||
| 438 | * Only a single header can be set with a single %OVS_ACTION_ATTR_SET. Not all | ||
| 439 | * fields within a header are modifiable, e.g. the IPv4 protocol and fragment | ||
| 440 | * type may not be changed. | ||
| 441 | */ | ||
| 442 | |||
| 443 | enum ovs_action_attr { | ||
| 444 | OVS_ACTION_ATTR_UNSPEC, | ||
| 445 | OVS_ACTION_ATTR_OUTPUT, /* u32 port number. */ | ||
| 446 | OVS_ACTION_ATTR_USERSPACE, /* Nested OVS_USERSPACE_ATTR_*. */ | ||
| 447 | OVS_ACTION_ATTR_SET, /* One nested OVS_KEY_ATTR_*. */ | ||
| 448 | OVS_ACTION_ATTR_PUSH_VLAN, /* struct ovs_action_push_vlan. */ | ||
| 449 | OVS_ACTION_ATTR_POP_VLAN, /* No argument. */ | ||
| 450 | OVS_ACTION_ATTR_SAMPLE, /* Nested OVS_SAMPLE_ATTR_*. */ | ||
| 451 | __OVS_ACTION_ATTR_MAX | ||
| 452 | }; | ||
| 453 | |||
| 454 | #define OVS_ACTION_ATTR_MAX (__OVS_ACTION_ATTR_MAX - 1) | ||
| 455 | |||
| 456 | #endif /* _LINUX_OPENVSWITCH_H */ | ||
diff --git a/include/uapi/linux/packet_diag.h b/include/uapi/linux/packet_diag.h index afafd703ad92..b2cc0cd9c4d9 100644 --- a/include/uapi/linux/packet_diag.h +++ b/include/uapi/linux/packet_diag.h | |||
| @@ -16,6 +16,8 @@ struct packet_diag_req { | |||
| 16 | #define PACKET_SHOW_MCLIST 0x00000002 /* A set of packet_diag_mclist-s */ | 16 | #define PACKET_SHOW_MCLIST 0x00000002 /* A set of packet_diag_mclist-s */ |
| 17 | #define PACKET_SHOW_RING_CFG 0x00000004 /* Rings configuration parameters */ | 17 | #define PACKET_SHOW_RING_CFG 0x00000004 /* Rings configuration parameters */ |
| 18 | #define PACKET_SHOW_FANOUT 0x00000008 | 18 | #define PACKET_SHOW_FANOUT 0x00000008 |
| 19 | #define PACKET_SHOW_MEMINFO 0x00000010 | ||
| 20 | #define PACKET_SHOW_FILTER 0x00000020 | ||
| 19 | 21 | ||
| 20 | struct packet_diag_msg { | 22 | struct packet_diag_msg { |
| 21 | __u8 pdiag_family; | 23 | __u8 pdiag_family; |
| @@ -32,6 +34,9 @@ enum { | |||
| 32 | PACKET_DIAG_RX_RING, | 34 | PACKET_DIAG_RX_RING, |
| 33 | PACKET_DIAG_TX_RING, | 35 | PACKET_DIAG_TX_RING, |
| 34 | PACKET_DIAG_FANOUT, | 36 | PACKET_DIAG_FANOUT, |
| 37 | PACKET_DIAG_UID, | ||
| 38 | PACKET_DIAG_MEMINFO, | ||
| 39 | PACKET_DIAG_FILTER, | ||
| 35 | 40 | ||
| 36 | __PACKET_DIAG_MAX, | 41 | __PACKET_DIAG_MAX, |
| 37 | }; | 42 | }; |
diff --git a/include/uapi/linux/pkt_sched.h b/include/uapi/linux/pkt_sched.h index 32aef0a439ef..dbd71b0c7d8c 100644 --- a/include/uapi/linux/pkt_sched.h +++ b/include/uapi/linux/pkt_sched.h | |||
| @@ -348,6 +348,7 @@ enum { | |||
| 348 | TCA_HTB_INIT, | 348 | TCA_HTB_INIT, |
| 349 | TCA_HTB_CTAB, | 349 | TCA_HTB_CTAB, |
| 350 | TCA_HTB_RTAB, | 350 | TCA_HTB_RTAB, |
| 351 | TCA_HTB_DIRECT_QLEN, | ||
| 351 | __TCA_HTB_MAX, | 352 | __TCA_HTB_MAX, |
| 352 | }; | 353 | }; |
| 353 | 354 | ||
diff --git a/include/uapi/linux/rfkill.h b/include/uapi/linux/rfkill.h index 2753c6cc9740..058757f7a733 100644 --- a/include/uapi/linux/rfkill.h +++ b/include/uapi/linux/rfkill.h | |||
| @@ -37,6 +37,7 @@ | |||
| 37 | * @RFKILL_TYPE_WWAN: switch is on a wireless WAN device. | 37 | * @RFKILL_TYPE_WWAN: switch is on a wireless WAN device. |
| 38 | * @RFKILL_TYPE_GPS: switch is on a GPS device. | 38 | * @RFKILL_TYPE_GPS: switch is on a GPS device. |
| 39 | * @RFKILL_TYPE_FM: switch is on a FM radio device. | 39 | * @RFKILL_TYPE_FM: switch is on a FM radio device. |
| 40 | * @RFKILL_TYPE_NFC: switch is on an NFC device. | ||
| 40 | * @NUM_RFKILL_TYPES: number of defined rfkill types | 41 | * @NUM_RFKILL_TYPES: number of defined rfkill types |
| 41 | */ | 42 | */ |
| 42 | enum rfkill_type { | 43 | enum rfkill_type { |
| @@ -48,6 +49,7 @@ enum rfkill_type { | |||
| 48 | RFKILL_TYPE_WWAN, | 49 | RFKILL_TYPE_WWAN, |
| 49 | RFKILL_TYPE_GPS, | 50 | RFKILL_TYPE_GPS, |
| 50 | RFKILL_TYPE_FM, | 51 | RFKILL_TYPE_FM, |
| 52 | RFKILL_TYPE_NFC, | ||
| 51 | NUM_RFKILL_TYPES, | 53 | NUM_RFKILL_TYPES, |
| 52 | }; | 54 | }; |
| 53 | 55 | ||
diff --git a/include/net/sctp/user.h b/include/uapi/linux/sctp.h index 9a0ae091366d..66b466e4ca08 100644 --- a/include/net/sctp/user.h +++ b/include/uapi/linux/sctp.h | |||
| @@ -42,15 +42,17 @@ | |||
| 42 | * Jon Grimm <jgrimm@us.ibm.com> | 42 | * Jon Grimm <jgrimm@us.ibm.com> |
| 43 | * Daisy Chang <daisyc@us.ibm.com> | 43 | * Daisy Chang <daisyc@us.ibm.com> |
| 44 | * Ryan Layer <rmlayer@us.ibm.com> | 44 | * Ryan Layer <rmlayer@us.ibm.com> |
| 45 | * Ardelle Fan <ardelle.fan@intel.com> | 45 | * Ardelle Fan <ardelle.fan@intel.com> |
| 46 | * Sridhar Samudrala <sri@us.ibm.com> | 46 | * Sridhar Samudrala <sri@us.ibm.com> |
| 47 | * Inaky Perez-Gonzalez <inaky.gonzalez@intel.com> | ||
| 48 | * Vlad Yasevich <vladislav.yasevich@hp.com> | ||
| 47 | * | 49 | * |
| 48 | * Any bugs reported given to us we will try to fix... any fixes shared will | 50 | * Any bugs reported given to us we will try to fix... any fixes shared will |
| 49 | * be incorporated into the next SCTP release. | 51 | * be incorporated into the next SCTP release. |
| 50 | */ | 52 | */ |
| 51 | 53 | ||
| 52 | #ifndef __net_sctp_user_h__ | 54 | #ifndef _UAPI_SCTP_H |
| 53 | #define __net_sctp_user_h__ | 55 | #define _UAPI_SCTP_H |
| 54 | 56 | ||
| 55 | #include <linux/types.h> | 57 | #include <linux/types.h> |
| 56 | #include <linux/socket.h> | 58 | #include <linux/socket.h> |
| @@ -165,17 +167,23 @@ enum sctp_sinfo_flags { | |||
| 165 | SCTP_ADDR_OVER = 2, /* Override the primary destination. */ | 167 | SCTP_ADDR_OVER = 2, /* Override the primary destination. */ |
| 166 | SCTP_ABORT=4, /* Send an ABORT message to the peer. */ | 168 | SCTP_ABORT=4, /* Send an ABORT message to the peer. */ |
| 167 | SCTP_SACK_IMMEDIATELY = 8, /* SACK should be sent without delay */ | 169 | SCTP_SACK_IMMEDIATELY = 8, /* SACK should be sent without delay */ |
| 168 | SCTP_EOF=MSG_FIN, /* Initiate graceful shutdown process. */ | 170 | SCTP_EOF=MSG_FIN, /* Initiate graceful shutdown process. */ |
| 169 | }; | 171 | }; |
| 170 | 172 | ||
| 173 | typedef union { | ||
| 174 | __u8 raw; | ||
| 175 | struct sctp_initmsg init; | ||
| 176 | struct sctp_sndrcvinfo sndrcv; | ||
| 177 | } sctp_cmsg_data_t; | ||
| 171 | 178 | ||
| 172 | /* These are cmsg_types. */ | 179 | /* These are cmsg_types. */ |
| 173 | typedef enum sctp_cmsg_type { | 180 | typedef enum sctp_cmsg_type { |
| 174 | SCTP_INIT, /* 5.2.1 SCTP Initiation Structure */ | 181 | SCTP_INIT, /* 5.2.1 SCTP Initiation Structure */ |
| 182 | #define SCTP_INIT SCTP_INIT | ||
| 175 | SCTP_SNDRCV, /* 5.2.2 SCTP Header Information Structure */ | 183 | SCTP_SNDRCV, /* 5.2.2 SCTP Header Information Structure */ |
| 184 | #define SCTP_SNDRCV SCTP_SNDRCV | ||
| 176 | } sctp_cmsg_t; | 185 | } sctp_cmsg_t; |
| 177 | 186 | ||
| 178 | |||
| 179 | /* | 187 | /* |
| 180 | * 5.3.1.1 SCTP_ASSOC_CHANGE | 188 | * 5.3.1.1 SCTP_ASSOC_CHANGE |
| 181 | * | 189 | * |
| @@ -345,6 +353,12 @@ struct sctp_pdapi_event { | |||
| 345 | 353 | ||
| 346 | enum { SCTP_PARTIAL_DELIVERY_ABORTED=0, }; | 354 | enum { SCTP_PARTIAL_DELIVERY_ABORTED=0, }; |
| 347 | 355 | ||
| 356 | /* | ||
| 357 | * 5.3.1.8. SCTP_AUTHENTICATION_EVENT | ||
| 358 | * | ||
| 359 | * When a receiver is using authentication this message will provide | ||
| 360 | * notifications regarding new keys being made active as well as errors. | ||
| 361 | */ | ||
| 348 | struct sctp_authkey_event { | 362 | struct sctp_authkey_event { |
| 349 | __u16 auth_type; | 363 | __u16 auth_type; |
| 350 | __u16 auth_flags; | 364 | __u16 auth_flags; |
| @@ -421,15 +435,23 @@ union sctp_notification { | |||
| 421 | enum sctp_sn_type { | 435 | enum sctp_sn_type { |
| 422 | SCTP_SN_TYPE_BASE = (1<<15), | 436 | SCTP_SN_TYPE_BASE = (1<<15), |
| 423 | SCTP_ASSOC_CHANGE, | 437 | SCTP_ASSOC_CHANGE, |
| 438 | #define SCTP_ASSOC_CHANGE SCTP_ASSOC_CHANGE | ||
| 424 | SCTP_PEER_ADDR_CHANGE, | 439 | SCTP_PEER_ADDR_CHANGE, |
| 440 | #define SCTP_PEER_ADDR_CHANGE SCTP_PEER_ADDR_CHANGE | ||
| 425 | SCTP_SEND_FAILED, | 441 | SCTP_SEND_FAILED, |
| 442 | #define SCTP_SEND_FAILED SCTP_SEND_FAILED | ||
| 426 | SCTP_REMOTE_ERROR, | 443 | SCTP_REMOTE_ERROR, |
| 444 | #define SCTP_REMOTE_ERROR SCTP_REMOTE_ERROR | ||
| 427 | SCTP_SHUTDOWN_EVENT, | 445 | SCTP_SHUTDOWN_EVENT, |
| 446 | #define SCTP_SHUTDOWN_EVENT SCTP_SHUTDOWN_EVENT | ||
| 428 | SCTP_PARTIAL_DELIVERY_EVENT, | 447 | SCTP_PARTIAL_DELIVERY_EVENT, |
| 448 | #define SCTP_PARTIAL_DELIVERY_EVENT SCTP_PARTIAL_DELIVERY_EVENT | ||
| 429 | SCTP_ADAPTATION_INDICATION, | 449 | SCTP_ADAPTATION_INDICATION, |
| 450 | #define SCTP_ADAPTATION_INDICATION SCTP_ADAPTATION_INDICATION | ||
| 430 | SCTP_AUTHENTICATION_EVENT, | 451 | SCTP_AUTHENTICATION_EVENT, |
| 431 | #define SCTP_AUTHENTICATION_INDICATION SCTP_AUTHENTICATION_EVENT | 452 | #define SCTP_AUTHENTICATION_INDICATION SCTP_AUTHENTICATION_EVENT |
| 432 | SCTP_SENDER_DRY_EVENT, | 453 | SCTP_SENDER_DRY_EVENT, |
| 454 | #define SCTP_SENDER_DRY_EVENT SCTP_SENDER_DRY_EVENT | ||
| 433 | }; | 455 | }; |
| 434 | 456 | ||
| 435 | /* Notification error codes used to fill up the error fields in some | 457 | /* Notification error codes used to fill up the error fields in some |
| @@ -454,7 +476,7 @@ typedef enum sctp_sn_error { | |||
| 454 | * | 476 | * |
| 455 | * The protocol parameters used to initialize and bound retransmission | 477 | * The protocol parameters used to initialize and bound retransmission |
| 456 | * timeout (RTO) are tunable. See [SCTP] for more information on how | 478 | * timeout (RTO) are tunable. See [SCTP] for more information on how |
| 457 | * these parameters are used in RTO calculation. | 479 | * these parameters are used in RTO calculation. |
| 458 | */ | 480 | */ |
| 459 | struct sctp_rtoinfo { | 481 | struct sctp_rtoinfo { |
| 460 | sctp_assoc_t srto_assoc_id; | 482 | sctp_assoc_t srto_assoc_id; |
| @@ -504,6 +526,9 @@ struct sctp_prim { | |||
| 504 | struct sockaddr_storage ssp_addr; | 526 | struct sockaddr_storage ssp_addr; |
| 505 | } __attribute__((packed, aligned(4))); | 527 | } __attribute__((packed, aligned(4))); |
| 506 | 528 | ||
| 529 | /* For backward compatibility use, define the old name too */ | ||
| 530 | #define sctp_setprim sctp_prim | ||
| 531 | |||
| 507 | /* | 532 | /* |
| 508 | * 7.1.11 Set Adaptation Layer Indicator (SCTP_ADAPTATION_LAYER) | 533 | * 7.1.11 Set Adaptation Layer Indicator (SCTP_ADAPTATION_LAYER) |
| 509 | * | 534 | * |
| @@ -564,12 +589,27 @@ struct sctp_authchunk { | |||
| 564 | * | 589 | * |
| 565 | * This option gets or sets the list of HMAC algorithms that the local | 590 | * This option gets or sets the list of HMAC algorithms that the local |
| 566 | * endpoint requires the peer to use. | 591 | * endpoint requires the peer to use. |
| 567 | */ | 592 | */ |
| 593 | #ifndef __KERNEL__ | ||
| 594 | /* This here is only used by user space as is. It might not be a good idea | ||
| 595 | * to export/reveal the whole structure with reserved fields etc. | ||
| 596 | */ | ||
| 597 | enum { | ||
| 598 | SCTP_AUTH_HMAC_ID_SHA1 = 1, | ||
| 599 | SCTP_AUTH_HMAC_ID_SHA256 = 3, | ||
| 600 | }; | ||
| 601 | #endif | ||
| 602 | |||
| 568 | struct sctp_hmacalgo { | 603 | struct sctp_hmacalgo { |
| 569 | __u32 shmac_num_idents; | 604 | __u32 shmac_num_idents; |
| 570 | __u16 shmac_idents[]; | 605 | __u16 shmac_idents[]; |
| 571 | }; | 606 | }; |
| 572 | 607 | ||
| 608 | /* Sadly, user and kernel space have different names for | ||
| 609 | * this structure member, so this is to not break anything. | ||
| 610 | */ | ||
| 611 | #define shmac_number_of_idents shmac_num_idents | ||
| 612 | |||
| 573 | /* | 613 | /* |
| 574 | * 7.1.20. Set a shared key (SCTP_AUTH_KEY) | 614 | * 7.1.20. Set a shared key (SCTP_AUTH_KEY) |
| 575 | * | 615 | * |
| @@ -691,6 +731,24 @@ struct sctp_authchunks { | |||
| 691 | uint8_t gauth_chunks[]; | 731 | uint8_t gauth_chunks[]; |
| 692 | }; | 732 | }; |
| 693 | 733 | ||
| 734 | /* The broken spelling has been released already in lksctp-tools header, | ||
| 735 | * so don't break anyone, now that it's fixed. | ||
| 736 | */ | ||
| 737 | #define guth_number_of_chunks gauth_number_of_chunks | ||
| 738 | |||
| 739 | /* Association states. */ | ||
| 740 | enum sctp_sstat_state { | ||
| 741 | SCTP_EMPTY = 0, | ||
| 742 | SCTP_CLOSED = 1, | ||
| 743 | SCTP_COOKIE_WAIT = 2, | ||
| 744 | SCTP_COOKIE_ECHOED = 3, | ||
| 745 | SCTP_ESTABLISHED = 4, | ||
| 746 | SCTP_SHUTDOWN_PENDING = 5, | ||
| 747 | SCTP_SHUTDOWN_SENT = 6, | ||
| 748 | SCTP_SHUTDOWN_RECEIVED = 7, | ||
| 749 | SCTP_SHUTDOWN_ACK_SENT = 8, | ||
| 750 | }; | ||
| 751 | |||
| 694 | /* | 752 | /* |
| 695 | * 8.2.6. Get the Current Identifiers of Associations | 753 | * 8.2.6. Get the Current Identifiers of Associations |
| 696 | * (SCTP_GET_ASSOC_ID_LIST) | 754 | * (SCTP_GET_ASSOC_ID_LIST) |
| @@ -705,15 +763,20 @@ struct sctp_assoc_ids { | |||
| 705 | 763 | ||
| 706 | /* | 764 | /* |
| 707 | * 8.3, 8.5 get all peer/local addresses in an association. | 765 | * 8.3, 8.5 get all peer/local addresses in an association. |
| 708 | * This parameter struct is used by SCTP_GET_PEER_ADDRS and | 766 | * This parameter struct is used by SCTP_GET_PEER_ADDRS and |
| 709 | * SCTP_GET_LOCAL_ADDRS socket options used internally to implement | 767 | * SCTP_GET_LOCAL_ADDRS socket options used internally to implement |
| 710 | * sctp_getpaddrs() and sctp_getladdrs() API. | 768 | * sctp_getpaddrs() and sctp_getladdrs() API. |
| 711 | */ | 769 | */ |
| 712 | struct sctp_getaddrs_old { | 770 | struct sctp_getaddrs_old { |
| 713 | sctp_assoc_t assoc_id; | 771 | sctp_assoc_t assoc_id; |
| 714 | int addr_num; | 772 | int addr_num; |
| 773 | #ifdef __KERNEL__ | ||
| 715 | struct sockaddr __user *addrs; | 774 | struct sockaddr __user *addrs; |
| 775 | #else | ||
| 776 | struct sockaddr *addrs; | ||
| 777 | #endif | ||
| 716 | }; | 778 | }; |
| 779 | |||
| 717 | struct sctp_getaddrs { | 780 | struct sctp_getaddrs { |
| 718 | sctp_assoc_t assoc_id; /*input*/ | 781 | sctp_assoc_t assoc_id; /*input*/ |
| 719 | __u32 addr_num; /*output*/ | 782 | __u32 addr_num; /*output*/ |
| @@ -779,4 +842,5 @@ struct sctp_paddrthlds { | |||
| 779 | __u16 spt_pathmaxrxt; | 842 | __u16 spt_pathmaxrxt; |
| 780 | __u16 spt_pathpfthld; | 843 | __u16 spt_pathpfthld; |
| 781 | }; | 844 | }; |
| 782 | #endif /* __net_sctp_user_h__ */ | 845 | |
| 846 | #endif /* _UAPI_SCTP_H */ | ||
diff --git a/include/uapi/linux/snmp.h b/include/uapi/linux/snmp.h index b49eab89c9fd..df2e8b4f9c03 100644 --- a/include/uapi/linux/snmp.h +++ b/include/uapi/linux/snmp.h | |||
| @@ -50,6 +50,7 @@ enum | |||
| 50 | IPSTATS_MIB_OUTMCASTOCTETS, /* OutMcastOctets */ | 50 | IPSTATS_MIB_OUTMCASTOCTETS, /* OutMcastOctets */ |
| 51 | IPSTATS_MIB_INBCASTOCTETS, /* InBcastOctets */ | 51 | IPSTATS_MIB_INBCASTOCTETS, /* InBcastOctets */ |
| 52 | IPSTATS_MIB_OUTBCASTOCTETS, /* OutBcastOctets */ | 52 | IPSTATS_MIB_OUTBCASTOCTETS, /* OutBcastOctets */ |
| 53 | IPSTATS_MIB_CSUMERRORS, /* InCsumErrors */ | ||
| 53 | __IPSTATS_MIB_MAX | 54 | __IPSTATS_MIB_MAX |
| 54 | }; | 55 | }; |
| 55 | 56 | ||
| @@ -87,6 +88,7 @@ enum | |||
| 87 | ICMP_MIB_OUTTIMESTAMPREPS, /* OutTimestampReps */ | 88 | ICMP_MIB_OUTTIMESTAMPREPS, /* OutTimestampReps */ |
| 88 | ICMP_MIB_OUTADDRMASKS, /* OutAddrMasks */ | 89 | ICMP_MIB_OUTADDRMASKS, /* OutAddrMasks */ |
| 89 | ICMP_MIB_OUTADDRMASKREPS, /* OutAddrMaskReps */ | 90 | ICMP_MIB_OUTADDRMASKREPS, /* OutAddrMaskReps */ |
| 91 | ICMP_MIB_CSUMERRORS, /* InCsumErrors */ | ||
| 90 | __ICMP_MIB_MAX | 92 | __ICMP_MIB_MAX |
| 91 | }; | 93 | }; |
| 92 | 94 | ||
| @@ -103,6 +105,7 @@ enum | |||
| 103 | ICMP6_MIB_INERRORS, /* InErrors */ | 105 | ICMP6_MIB_INERRORS, /* InErrors */ |
| 104 | ICMP6_MIB_OUTMSGS, /* OutMsgs */ | 106 | ICMP6_MIB_OUTMSGS, /* OutMsgs */ |
| 105 | ICMP6_MIB_OUTERRORS, /* OutErrors */ | 107 | ICMP6_MIB_OUTERRORS, /* OutErrors */ |
| 108 | ICMP6_MIB_CSUMERRORS, /* InCsumErrors */ | ||
| 106 | __ICMP6_MIB_MAX | 109 | __ICMP6_MIB_MAX |
| 107 | }; | 110 | }; |
| 108 | 111 | ||
| @@ -130,6 +133,7 @@ enum | |||
| 130 | TCP_MIB_RETRANSSEGS, /* RetransSegs */ | 133 | TCP_MIB_RETRANSSEGS, /* RetransSegs */ |
| 131 | TCP_MIB_INERRS, /* InErrs */ | 134 | TCP_MIB_INERRS, /* InErrs */ |
| 132 | TCP_MIB_OUTRSTS, /* OutRsts */ | 135 | TCP_MIB_OUTRSTS, /* OutRsts */ |
| 136 | TCP_MIB_CSUMERRORS, /* InCsumErrors */ | ||
| 133 | __TCP_MIB_MAX | 137 | __TCP_MIB_MAX |
| 134 | }; | 138 | }; |
| 135 | 139 | ||
| @@ -147,6 +151,7 @@ enum | |||
| 147 | UDP_MIB_OUTDATAGRAMS, /* OutDatagrams */ | 151 | UDP_MIB_OUTDATAGRAMS, /* OutDatagrams */ |
| 148 | UDP_MIB_RCVBUFERRORS, /* RcvbufErrors */ | 152 | UDP_MIB_RCVBUFERRORS, /* RcvbufErrors */ |
| 149 | UDP_MIB_SNDBUFERRORS, /* SndbufErrors */ | 153 | UDP_MIB_SNDBUFERRORS, /* SndbufErrors */ |
| 154 | UDP_MIB_CSUMERRORS, /* InCsumErrors */ | ||
| 150 | __UDP_MIB_MAX | 155 | __UDP_MIB_MAX |
| 151 | }; | 156 | }; |
| 152 | 157 | ||
| @@ -202,6 +207,8 @@ enum | |||
| 202 | LINUX_MIB_TCPFORWARDRETRANS, /* TCPForwardRetrans */ | 207 | LINUX_MIB_TCPFORWARDRETRANS, /* TCPForwardRetrans */ |
| 203 | LINUX_MIB_TCPSLOWSTARTRETRANS, /* TCPSlowStartRetrans */ | 208 | LINUX_MIB_TCPSLOWSTARTRETRANS, /* TCPSlowStartRetrans */ |
| 204 | LINUX_MIB_TCPTIMEOUTS, /* TCPTimeouts */ | 209 | LINUX_MIB_TCPTIMEOUTS, /* TCPTimeouts */ |
| 210 | LINUX_MIB_TCPLOSSPROBES, /* TCPLossProbes */ | ||
| 211 | LINUX_MIB_TCPLOSSPROBERECOVERY, /* TCPLossProbeRecovery */ | ||
| 205 | LINUX_MIB_TCPRENORECOVERYFAIL, /* TCPRenoRecoveryFail */ | 212 | LINUX_MIB_TCPRENORECOVERYFAIL, /* TCPRenoRecoveryFail */ |
| 206 | LINUX_MIB_TCPSACKRECOVERYFAIL, /* TCPSackRecoveryFail */ | 213 | LINUX_MIB_TCPSACKRECOVERYFAIL, /* TCPSackRecoveryFail */ |
| 207 | LINUX_MIB_TCPSCHEDULERFAILED, /* TCPSchedulerFailed */ | 214 | LINUX_MIB_TCPSCHEDULERFAILED, /* TCPSchedulerFailed */ |
| @@ -245,6 +252,7 @@ enum | |||
| 245 | LINUX_MIB_TCPFASTOPENPASSIVEFAIL, /* TCPFastOpenPassiveFail */ | 252 | LINUX_MIB_TCPFASTOPENPASSIVEFAIL, /* TCPFastOpenPassiveFail */ |
| 246 | LINUX_MIB_TCPFASTOPENLISTENOVERFLOW, /* TCPFastOpenListenOverflow */ | 253 | LINUX_MIB_TCPFASTOPENLISTENOVERFLOW, /* TCPFastOpenListenOverflow */ |
| 247 | LINUX_MIB_TCPFASTOPENCOOKIEREQD, /* TCPFastOpenCookieReqd */ | 254 | LINUX_MIB_TCPFASTOPENCOOKIEREQD, /* TCPFastOpenCookieReqd */ |
| 255 | LINUX_MIB_TCPSPURIOUS_RTX_HOSTQUEUES, /* TCPSpuriousRtxHostQueues */ | ||
| 248 | __LINUX_MIB_MAX | 256 | __LINUX_MIB_MAX |
| 249 | }; | 257 | }; |
| 250 | 258 | ||
diff --git a/include/uapi/linux/tcp.h b/include/uapi/linux/tcp.h index 6b1ead0b0c9d..8d776ebc4829 100644 --- a/include/uapi/linux/tcp.h +++ b/include/uapi/linux/tcp.h | |||
| @@ -102,7 +102,6 @@ enum { | |||
| 102 | #define TCP_QUICKACK 12 /* Block/reenable quick acks */ | 102 | #define TCP_QUICKACK 12 /* Block/reenable quick acks */ |
| 103 | #define TCP_CONGESTION 13 /* Congestion control algorithm */ | 103 | #define TCP_CONGESTION 13 /* Congestion control algorithm */ |
| 104 | #define TCP_MD5SIG 14 /* TCP MD5 Signature (RFC2385) */ | 104 | #define TCP_MD5SIG 14 /* TCP MD5 Signature (RFC2385) */ |
| 105 | #define TCP_COOKIE_TRANSACTIONS 15 /* TCP Cookie Transactions */ | ||
| 106 | #define TCP_THIN_LINEAR_TIMEOUTS 16 /* Use linear timeouts for thin streams*/ | 105 | #define TCP_THIN_LINEAR_TIMEOUTS 16 /* Use linear timeouts for thin streams*/ |
| 107 | #define TCP_THIN_DUPACK 17 /* Fast retrans. after 1 dupack */ | 106 | #define TCP_THIN_DUPACK 17 /* Fast retrans. after 1 dupack */ |
| 108 | #define TCP_USER_TIMEOUT 18 /* How long for loss retry before timeout */ | 107 | #define TCP_USER_TIMEOUT 18 /* How long for loss retry before timeout */ |
| @@ -199,29 +198,4 @@ struct tcp_md5sig { | |||
| 199 | __u8 tcpm_key[TCP_MD5SIG_MAXKEYLEN]; /* key (binary) */ | 198 | __u8 tcpm_key[TCP_MD5SIG_MAXKEYLEN]; /* key (binary) */ |
| 200 | }; | 199 | }; |
| 201 | 200 | ||
| 202 | /* for TCP_COOKIE_TRANSACTIONS (TCPCT) socket option */ | ||
| 203 | #define TCP_COOKIE_MIN 8 /* 64-bits */ | ||
| 204 | #define TCP_COOKIE_MAX 16 /* 128-bits */ | ||
| 205 | #define TCP_COOKIE_PAIR_SIZE (2*TCP_COOKIE_MAX) | ||
| 206 | |||
| 207 | /* Flags for both getsockopt and setsockopt */ | ||
| 208 | #define TCP_COOKIE_IN_ALWAYS (1 << 0) /* Discard SYN without cookie */ | ||
| 209 | #define TCP_COOKIE_OUT_NEVER (1 << 1) /* Prohibit outgoing cookies, | ||
| 210 | * supercedes everything. */ | ||
| 211 | |||
| 212 | /* Flags for getsockopt */ | ||
| 213 | #define TCP_S_DATA_IN (1 << 2) /* Was data received? */ | ||
| 214 | #define TCP_S_DATA_OUT (1 << 3) /* Was data sent? */ | ||
| 215 | |||
| 216 | /* TCP_COOKIE_TRANSACTIONS data */ | ||
| 217 | struct tcp_cookie_transactions { | ||
| 218 | __u16 tcpct_flags; /* see above */ | ||
| 219 | __u8 __tcpct_pad1; /* zero */ | ||
| 220 | __u8 tcpct_cookie_desired; /* bytes */ | ||
| 221 | __u16 tcpct_s_data_desired; /* bytes of variable data */ | ||
| 222 | __u16 tcpct_used; /* bytes in value */ | ||
| 223 | __u8 tcpct_value[TCP_MSS_DEFAULT]; | ||
| 224 | }; | ||
| 225 | |||
| 226 | |||
| 227 | #endif /* _UAPI_LINUX_TCP_H */ | 201 | #endif /* _UAPI_LINUX_TCP_H */ |
diff --git a/include/uapi/linux/vm_sockets.h b/include/uapi/linux/vm_sockets.h index df91301847ec..b4ed5d895699 100644 --- a/include/uapi/linux/vm_sockets.h +++ b/include/uapi/linux/vm_sockets.h | |||
| @@ -13,12 +13,10 @@ | |||
| 13 | * more details. | 13 | * more details. |
| 14 | */ | 14 | */ |
| 15 | 15 | ||
| 16 | #ifndef _VM_SOCKETS_H_ | 16 | #ifndef _UAPI_VM_SOCKETS_H |
| 17 | #define _VM_SOCKETS_H_ | 17 | #define _UAPI_VM_SOCKETS_H |
| 18 | 18 | ||
| 19 | #if !defined(__KERNEL__) | 19 | #include <linux/socket.h> |
| 20 | #include <sys/socket.h> | ||
| 21 | #endif | ||
| 22 | 20 | ||
| 23 | /* Option name for STREAM socket buffer size. Use as the option name in | 21 | /* Option name for STREAM socket buffer size. Use as the option name in |
| 24 | * setsockopt(3) or getsockopt(3) to set or get an unsigned long long that | 22 | * setsockopt(3) or getsockopt(3) to set or get an unsigned long long that |
| @@ -137,14 +135,13 @@ | |||
| 137 | #define VM_SOCKETS_VERSION_MINOR(_v) (((_v) & 0x0000FFFF)) | 135 | #define VM_SOCKETS_VERSION_MINOR(_v) (((_v) & 0x0000FFFF)) |
| 138 | 136 | ||
| 139 | /* Address structure for vSockets. The address family should be set to | 137 | /* Address structure for vSockets. The address family should be set to |
| 140 | * whatever vmci_sock_get_af_value_fd() returns. The structure members should | 138 | * AF_VSOCK. The structure members should all align on their natural |
| 141 | * all align on their natural boundaries without resorting to compiler packing | 139 | * boundaries without resorting to compiler packing directives. The total size |
| 142 | * directives. The total size of this structure should be exactly the same as | 140 | * of this structure should be exactly the same as that of struct sockaddr. |
| 143 | * that of struct sockaddr. | ||
| 144 | */ | 141 | */ |
| 145 | 142 | ||
| 146 | struct sockaddr_vm { | 143 | struct sockaddr_vm { |
| 147 | sa_family_t svm_family; | 144 | __kernel_sa_family_t svm_family; |
| 148 | unsigned short svm_reserved1; | 145 | unsigned short svm_reserved1; |
| 149 | unsigned int svm_port; | 146 | unsigned int svm_port; |
| 150 | unsigned int svm_cid; | 147 | unsigned int svm_cid; |
| @@ -156,8 +153,4 @@ struct sockaddr_vm { | |||
| 156 | 153 | ||
| 157 | #define IOCTL_VM_SOCKETS_GET_LOCAL_CID _IO(7, 0xb9) | 154 | #define IOCTL_VM_SOCKETS_GET_LOCAL_CID _IO(7, 0xb9) |
| 158 | 155 | ||
| 159 | #if defined(__KERNEL__) | 156 | #endif /* _UAPI_VM_SOCKETS_H */ |
| 160 | int vm_sockets_get_local_cid(void); | ||
| 161 | #endif | ||
| 162 | |||
| 163 | #endif | ||
diff --git a/include/uapi/linux/xfrm.h b/include/uapi/linux/xfrm.h index 28e493b5b94c..a8cd6a4a2970 100644 --- a/include/uapi/linux/xfrm.h +++ b/include/uapi/linux/xfrm.h | |||
| @@ -297,6 +297,7 @@ enum xfrm_attr_type_t { | |||
| 297 | XFRMA_MARK, /* struct xfrm_mark */ | 297 | XFRMA_MARK, /* struct xfrm_mark */ |
| 298 | XFRMA_TFCPAD, /* __u32 */ | 298 | XFRMA_TFCPAD, /* __u32 */ |
| 299 | XFRMA_REPLAY_ESN_VAL, /* struct xfrm_replay_esn */ | 299 | XFRMA_REPLAY_ESN_VAL, /* struct xfrm_replay_esn */ |
| 300 | XFRMA_SA_EXTRA_FLAGS, /* __u32 */ | ||
| 300 | __XFRMA_MAX | 301 | __XFRMA_MAX |
| 301 | 302 | ||
| 302 | #define XFRMA_MAX (__XFRMA_MAX - 1) | 303 | #define XFRMA_MAX (__XFRMA_MAX - 1) |
| @@ -367,6 +368,8 @@ struct xfrm_usersa_info { | |||
| 367 | #define XFRM_STATE_ESN 128 | 368 | #define XFRM_STATE_ESN 128 |
| 368 | }; | 369 | }; |
| 369 | 370 | ||
| 371 | #define XFRM_SA_XFLAG_DONT_ENCAP_DSCP 1 | ||
| 372 | |||
| 370 | struct xfrm_usersa_id { | 373 | struct xfrm_usersa_id { |
| 371 | xfrm_address_t daddr; | 374 | xfrm_address_t daddr; |
| 372 | __be32 spi; | 375 | __be32 spi; |
diff --git a/include/xen/interface/io/netif.h b/include/xen/interface/io/netif.h index 9dfc12000980..3ef3fe05ee99 100644 --- a/include/xen/interface/io/netif.h +++ b/include/xen/interface/io/netif.h | |||
| @@ -13,6 +13,24 @@ | |||
| 13 | #include <xen/interface/grant_table.h> | 13 | #include <xen/interface/grant_table.h> |
| 14 | 14 | ||
| 15 | /* | 15 | /* |
| 16 | * Older implementation of Xen network frontend / backend has an | ||
| 17 | * implicit dependency on the MAX_SKB_FRAGS as the maximum number of | ||
| 18 | * ring slots a skb can use. Netfront / netback may not work as | ||
| 19 | * expected when frontend and backend have different MAX_SKB_FRAGS. | ||
| 20 | * | ||
| 21 | * A better approach is to add mechanism for netfront / netback to | ||
| 22 | * negotiate this value. However we cannot fix all possible | ||
| 23 | * frontends, so we need to define a value which states the minimum | ||
| 24 | * slots backend must support. | ||
| 25 | * | ||
| 26 | * The minimum value derives from older Linux kernel's MAX_SKB_FRAGS | ||
| 27 | * (18), which is proved to work with most frontends. Any new backend | ||
| 28 | * which doesn't negotiate with frontend should expect frontend to | ||
| 29 | * send a valid packet using slots up to this value. | ||
| 30 | */ | ||
| 31 | #define XEN_NETIF_NR_SLOTS_MIN 18 | ||
| 32 | |||
| 33 | /* | ||
| 16 | * Notifications after enqueuing any type of message should be conditional on | 34 | * Notifications after enqueuing any type of message should be conditional on |
| 17 | * the appropriate req_event or rsp_event field in the shared ring. | 35 | * the appropriate req_event or rsp_event field in the shared ring. |
| 18 | * If the client sends notification for rx requests then it should specify | 36 | * If the client sends notification for rx requests then it should specify |
| @@ -47,6 +65,7 @@ | |||
| 47 | #define _XEN_NETTXF_extra_info (3) | 65 | #define _XEN_NETTXF_extra_info (3) |
| 48 | #define XEN_NETTXF_extra_info (1U<<_XEN_NETTXF_extra_info) | 66 | #define XEN_NETTXF_extra_info (1U<<_XEN_NETTXF_extra_info) |
| 49 | 67 | ||
| 68 | #define XEN_NETIF_MAX_TX_SIZE 0xFFFF | ||
| 50 | struct xen_netif_tx_request { | 69 | struct xen_netif_tx_request { |
| 51 | grant_ref_t gref; /* Reference to buffer page */ | 70 | grant_ref_t gref; /* Reference to buffer page */ |
| 52 | uint16_t offset; /* Offset within buffer page */ | 71 | uint16_t offset; /* Offset within buffer page */ |
