diff options
Diffstat (limited to 'include')
274 files changed, 7019 insertions, 1610 deletions
diff --git a/include/acpi/acpi_bus.h b/include/acpi/acpi_bus.h index 78ca429929f7..ff103ba96b78 100644 --- a/include/acpi/acpi_bus.h +++ b/include/acpi/acpi_bus.h | |||
| @@ -381,7 +381,7 @@ struct acpi_pci_root *acpi_pci_find_root(acpi_handle handle); | |||
| 381 | int acpi_enable_wakeup_device_power(struct acpi_device *dev, int state); | 381 | int acpi_enable_wakeup_device_power(struct acpi_device *dev, int state); |
| 382 | int acpi_disable_wakeup_device_power(struct acpi_device *dev); | 382 | int acpi_disable_wakeup_device_power(struct acpi_device *dev); |
| 383 | 383 | ||
| 384 | #ifdef CONFIG_PM_OPS | 384 | #ifdef CONFIG_PM |
| 385 | int acpi_pm_device_sleep_state(struct device *, int *); | 385 | int acpi_pm_device_sleep_state(struct device *, int *); |
| 386 | #else | 386 | #else |
| 387 | static inline int acpi_pm_device_sleep_state(struct device *d, int *p) | 387 | static inline int acpi_pm_device_sleep_state(struct device *d, int *p) |
diff --git a/include/asm-generic/cputime.h b/include/asm-generic/cputime.h index 2bcc5c7c22a6..61e03dd7939e 100644 --- a/include/asm-generic/cputime.h +++ b/include/asm-generic/cputime.h | |||
| @@ -30,6 +30,9 @@ typedef u64 cputime64_t; | |||
| 30 | #define cputime64_to_jiffies64(__ct) (__ct) | 30 | #define cputime64_to_jiffies64(__ct) (__ct) |
| 31 | #define jiffies64_to_cputime64(__jif) (__jif) | 31 | #define jiffies64_to_cputime64(__jif) (__jif) |
| 32 | #define cputime_to_cputime64(__ct) ((u64) __ct) | 32 | #define cputime_to_cputime64(__ct) ((u64) __ct) |
| 33 | #define cputime64_gt(__a, __b) ((__a) > (__b)) | ||
| 34 | |||
| 35 | #define nsecs_to_cputime64(__ct) nsecs_to_jiffies64(__ct) | ||
| 33 | 36 | ||
| 34 | 37 | ||
| 35 | /* | 38 | /* |
diff --git a/include/asm-generic/fcntl.h b/include/asm-generic/fcntl.h index 0fc16e3f0bfc..84793c7025e2 100644 --- a/include/asm-generic/fcntl.h +++ b/include/asm-generic/fcntl.h | |||
| @@ -80,6 +80,10 @@ | |||
| 80 | #define O_SYNC (__O_SYNC|O_DSYNC) | 80 | #define O_SYNC (__O_SYNC|O_DSYNC) |
| 81 | #endif | 81 | #endif |
| 82 | 82 | ||
| 83 | #ifndef O_PATH | ||
| 84 | #define O_PATH 010000000 | ||
| 85 | #endif | ||
| 86 | |||
| 83 | #ifndef O_NDELAY | 87 | #ifndef O_NDELAY |
| 84 | #define O_NDELAY O_NONBLOCK | 88 | #define O_NDELAY O_NONBLOCK |
| 85 | #endif | 89 | #endif |
diff --git a/include/asm-generic/futex.h b/include/asm-generic/futex.h index 3c2344f48136..01f227e14254 100644 --- a/include/asm-generic/futex.h +++ b/include/asm-generic/futex.h | |||
| @@ -6,7 +6,7 @@ | |||
| 6 | #include <asm/errno.h> | 6 | #include <asm/errno.h> |
| 7 | 7 | ||
| 8 | static inline int | 8 | static inline int |
| 9 | futex_atomic_op_inuser (int encoded_op, int __user *uaddr) | 9 | futex_atomic_op_inuser (int encoded_op, u32 __user *uaddr) |
| 10 | { | 10 | { |
| 11 | int op = (encoded_op >> 28) & 7; | 11 | int op = (encoded_op >> 28) & 7; |
| 12 | int cmp = (encoded_op >> 24) & 15; | 12 | int cmp = (encoded_op >> 24) & 15; |
| @@ -16,7 +16,7 @@ futex_atomic_op_inuser (int encoded_op, int __user *uaddr) | |||
| 16 | if (encoded_op & (FUTEX_OP_OPARG_SHIFT << 28)) | 16 | if (encoded_op & (FUTEX_OP_OPARG_SHIFT << 28)) |
| 17 | oparg = 1 << oparg; | 17 | oparg = 1 << oparg; |
| 18 | 18 | ||
| 19 | if (! access_ok (VERIFY_WRITE, uaddr, sizeof(int))) | 19 | if (! access_ok (VERIFY_WRITE, uaddr, sizeof(u32))) |
| 20 | return -EFAULT; | 20 | return -EFAULT; |
| 21 | 21 | ||
| 22 | pagefault_disable(); | 22 | pagefault_disable(); |
| @@ -48,7 +48,8 @@ futex_atomic_op_inuser (int encoded_op, int __user *uaddr) | |||
| 48 | } | 48 | } |
| 49 | 49 | ||
| 50 | static inline int | 50 | static inline int |
| 51 | futex_atomic_cmpxchg_inatomic(int __user *uaddr, int oldval, int newval) | 51 | futex_atomic_cmpxchg_inatomic(u32 *uval, u32 __user *uaddr, |
| 52 | u32 oldval, u32 newval) | ||
| 52 | { | 53 | { |
| 53 | return -ENOSYS; | 54 | return -ENOSYS; |
| 54 | } | 55 | } |
diff --git a/include/asm-generic/ioctls.h b/include/asm-generic/ioctls.h index 3f3f2d189fb8..199975fac395 100644 --- a/include/asm-generic/ioctls.h +++ b/include/asm-generic/ioctls.h | |||
| @@ -73,6 +73,7 @@ | |||
| 73 | #define TCSETXF 0x5434 | 73 | #define TCSETXF 0x5434 |
| 74 | #define TCSETXW 0x5435 | 74 | #define TCSETXW 0x5435 |
| 75 | #define TIOCSIG _IOW('T', 0x36, int) /* pty: generate signal */ | 75 | #define TIOCSIG _IOW('T', 0x36, int) /* pty: generate signal */ |
| 76 | #define TIOCVHANGUP 0x5437 | ||
| 76 | 77 | ||
| 77 | #define FIONCLEX 0x5450 | 78 | #define FIONCLEX 0x5450 |
| 78 | #define FIOCLEX 0x5451 | 79 | #define FIOCLEX 0x5451 |
diff --git a/include/asm-generic/pgtable.h b/include/asm-generic/pgtable.h index 31b6188df221..b4bfe338ea0e 100644 --- a/include/asm-generic/pgtable.h +++ b/include/asm-generic/pgtable.h | |||
| @@ -4,6 +4,8 @@ | |||
| 4 | #ifndef __ASSEMBLY__ | 4 | #ifndef __ASSEMBLY__ |
| 5 | #ifdef CONFIG_MMU | 5 | #ifdef CONFIG_MMU |
| 6 | 6 | ||
| 7 | #include <linux/mm_types.h> | ||
| 8 | |||
| 7 | #ifndef __HAVE_ARCH_PTEP_SET_ACCESS_FLAGS | 9 | #ifndef __HAVE_ARCH_PTEP_SET_ACCESS_FLAGS |
| 8 | extern int ptep_set_access_flags(struct vm_area_struct *vma, | 10 | extern int ptep_set_access_flags(struct vm_area_struct *vma, |
| 9 | unsigned long address, pte_t *ptep, | 11 | unsigned long address, pte_t *ptep, |
diff --git a/include/asm-generic/sections.h b/include/asm-generic/sections.h index b3bfabc258f3..c1a1216e29ce 100644 --- a/include/asm-generic/sections.h +++ b/include/asm-generic/sections.h | |||
| @@ -11,6 +11,7 @@ extern char _sinittext[], _einittext[]; | |||
| 11 | extern char _end[]; | 11 | extern char _end[]; |
| 12 | extern char __per_cpu_load[], __per_cpu_start[], __per_cpu_end[]; | 12 | extern char __per_cpu_load[], __per_cpu_start[], __per_cpu_end[]; |
| 13 | extern char __kprobes_text_start[], __kprobes_text_end[]; | 13 | extern char __kprobes_text_start[], __kprobes_text_end[]; |
| 14 | extern char __entry_text_start[], __entry_text_end[]; | ||
| 14 | extern char __initdata_begin[], __initdata_end[]; | 15 | extern char __initdata_begin[], __initdata_end[]; |
| 15 | extern char __start_rodata[], __end_rodata[]; | 16 | extern char __start_rodata[], __end_rodata[]; |
| 16 | 17 | ||
diff --git a/include/asm-generic/unistd.h b/include/asm-generic/unistd.h index b969770196c2..57af0338d270 100644 --- a/include/asm-generic/unistd.h +++ b/include/asm-generic/unistd.h | |||
| @@ -646,9 +646,13 @@ __SYSCALL(__NR_prlimit64, sys_prlimit64) | |||
| 646 | __SYSCALL(__NR_fanotify_init, sys_fanotify_init) | 646 | __SYSCALL(__NR_fanotify_init, sys_fanotify_init) |
| 647 | #define __NR_fanotify_mark 263 | 647 | #define __NR_fanotify_mark 263 |
| 648 | __SYSCALL(__NR_fanotify_mark, sys_fanotify_mark) | 648 | __SYSCALL(__NR_fanotify_mark, sys_fanotify_mark) |
| 649 | #define __NR_name_to_handle_at 264 | ||
| 650 | __SYSCALL(__NR_name_to_handle_at, sys_name_to_handle_at) | ||
| 651 | #define __NR_open_by_handle_at 265 | ||
| 652 | __SYSCALL(__NR_open_by_handle_at, sys_open_by_handle_at) | ||
| 649 | 653 | ||
| 650 | #undef __NR_syscalls | 654 | #undef __NR_syscalls |
| 651 | #define __NR_syscalls 264 | 655 | #define __NR_syscalls 266 |
| 652 | 656 | ||
| 653 | /* | 657 | /* |
| 654 | * All syscalls below here should go away really, | 658 | * All syscalls below here should go away really, |
diff --git a/include/asm-generic/vmlinux.lds.h b/include/asm-generic/vmlinux.lds.h index fe77e3395b40..32c45e5fe0ab 100644 --- a/include/asm-generic/vmlinux.lds.h +++ b/include/asm-generic/vmlinux.lds.h | |||
| @@ -15,7 +15,7 @@ | |||
| 15 | * HEAD_TEXT_SECTION | 15 | * HEAD_TEXT_SECTION |
| 16 | * INIT_TEXT_SECTION(PAGE_SIZE) | 16 | * INIT_TEXT_SECTION(PAGE_SIZE) |
| 17 | * INIT_DATA_SECTION(...) | 17 | * INIT_DATA_SECTION(...) |
| 18 | * PERCPU(PAGE_SIZE) | 18 | * PERCPU(CACHELINE_SIZE, PAGE_SIZE) |
| 19 | * __init_end = .; | 19 | * __init_end = .; |
| 20 | * | 20 | * |
| 21 | * _stext = .; | 21 | * _stext = .; |
| @@ -424,6 +424,12 @@ | |||
| 424 | *(.kprobes.text) \ | 424 | *(.kprobes.text) \ |
| 425 | VMLINUX_SYMBOL(__kprobes_text_end) = .; | 425 | VMLINUX_SYMBOL(__kprobes_text_end) = .; |
| 426 | 426 | ||
| 427 | #define ENTRY_TEXT \ | ||
| 428 | ALIGN_FUNCTION(); \ | ||
| 429 | VMLINUX_SYMBOL(__entry_text_start) = .; \ | ||
| 430 | *(.entry.text) \ | ||
| 431 | VMLINUX_SYMBOL(__entry_text_end) = .; | ||
| 432 | |||
| 427 | #ifdef CONFIG_FUNCTION_GRAPH_TRACER | 433 | #ifdef CONFIG_FUNCTION_GRAPH_TRACER |
| 428 | #define IRQENTRY_TEXT \ | 434 | #define IRQENTRY_TEXT \ |
| 429 | ALIGN_FUNCTION(); \ | 435 | ALIGN_FUNCTION(); \ |
| @@ -683,13 +689,18 @@ | |||
| 683 | 689 | ||
| 684 | /** | 690 | /** |
| 685 | * PERCPU_VADDR - define output section for percpu area | 691 | * PERCPU_VADDR - define output section for percpu area |
| 692 | * @cacheline: cacheline size | ||
| 686 | * @vaddr: explicit base address (optional) | 693 | * @vaddr: explicit base address (optional) |
| 687 | * @phdr: destination PHDR (optional) | 694 | * @phdr: destination PHDR (optional) |
| 688 | * | 695 | * |
| 689 | * Macro which expands to output section for percpu area. If @vaddr | 696 | * Macro which expands to output section for percpu area. |
| 690 | * is not blank, it specifies explicit base address and all percpu | 697 | * |
| 691 | * symbols will be offset from the given address. If blank, @vaddr | 698 | * @cacheline is used to align subsections to avoid false cacheline |
| 692 | * always equals @laddr + LOAD_OFFSET. | 699 | * sharing between subsections for different purposes. |
| 700 | * | ||
| 701 | * If @vaddr is not blank, it specifies explicit base address and all | ||
| 702 | * percpu symbols will be offset from the given address. If blank, | ||
| 703 | * @vaddr always equals @laddr + LOAD_OFFSET. | ||
| 693 | * | 704 | * |
| 694 | * @phdr defines the output PHDR to use if not blank. Be warned that | 705 | * @phdr defines the output PHDR to use if not blank. Be warned that |
| 695 | * output PHDR is sticky. If @phdr is specified, the next output | 706 | * output PHDR is sticky. If @phdr is specified, the next output |
| @@ -700,7 +711,7 @@ | |||
| 700 | * If there is no need to put the percpu section at a predetermined | 711 | * If there is no need to put the percpu section at a predetermined |
| 701 | * address, use PERCPU(). | 712 | * address, use PERCPU(). |
| 702 | */ | 713 | */ |
| 703 | #define PERCPU_VADDR(vaddr, phdr) \ | 714 | #define PERCPU_VADDR(cacheline, vaddr, phdr) \ |
| 704 | VMLINUX_SYMBOL(__per_cpu_load) = .; \ | 715 | VMLINUX_SYMBOL(__per_cpu_load) = .; \ |
| 705 | .data..percpu vaddr : AT(VMLINUX_SYMBOL(__per_cpu_load) \ | 716 | .data..percpu vaddr : AT(VMLINUX_SYMBOL(__per_cpu_load) \ |
| 706 | - LOAD_OFFSET) { \ | 717 | - LOAD_OFFSET) { \ |
| @@ -708,7 +719,9 @@ | |||
| 708 | *(.data..percpu..first) \ | 719 | *(.data..percpu..first) \ |
| 709 | . = ALIGN(PAGE_SIZE); \ | 720 | . = ALIGN(PAGE_SIZE); \ |
| 710 | *(.data..percpu..page_aligned) \ | 721 | *(.data..percpu..page_aligned) \ |
| 722 | . = ALIGN(cacheline); \ | ||
| 711 | *(.data..percpu..readmostly) \ | 723 | *(.data..percpu..readmostly) \ |
| 724 | . = ALIGN(cacheline); \ | ||
| 712 | *(.data..percpu) \ | 725 | *(.data..percpu) \ |
| 713 | *(.data..percpu..shared_aligned) \ | 726 | *(.data..percpu..shared_aligned) \ |
| 714 | VMLINUX_SYMBOL(__per_cpu_end) = .; \ | 727 | VMLINUX_SYMBOL(__per_cpu_end) = .; \ |
| @@ -717,18 +730,18 @@ | |||
| 717 | 730 | ||
| 718 | /** | 731 | /** |
| 719 | * PERCPU - define output section for percpu area, simple version | 732 | * PERCPU - define output section for percpu area, simple version |
| 733 | * @cacheline: cacheline size | ||
| 720 | * @align: required alignment | 734 | * @align: required alignment |
| 721 | * | 735 | * |
| 722 | * Align to @align and outputs output section for percpu area. This | 736 | * Align to @align and outputs output section for percpu area. This macro |
| 723 | * macro doesn't maniuplate @vaddr or @phdr and __per_cpu_load and | 737 | * doesn't manipulate @vaddr or @phdr and __per_cpu_load and |
| 724 | * __per_cpu_start will be identical. | 738 | * __per_cpu_start will be identical. |
| 725 | * | 739 | * |
| 726 | * This macro is equivalent to ALIGN(align); PERCPU_VADDR( , ) except | 740 | * This macro is equivalent to ALIGN(@align); PERCPU_VADDR(@cacheline,,) |
| 727 | * that __per_cpu_load is defined as a relative symbol against | 741 | * except that __per_cpu_load is defined as a relative symbol against |
| 728 | * .data..percpu which is required for relocatable x86_32 | 742 | * .data..percpu which is required for relocatable x86_32 configuration. |
| 729 | * configuration. | ||
| 730 | */ | 743 | */ |
| 731 | #define PERCPU(align) \ | 744 | #define PERCPU(cacheline, align) \ |
| 732 | . = ALIGN(align); \ | 745 | . = ALIGN(align); \ |
| 733 | .data..percpu : AT(ADDR(.data..percpu) - LOAD_OFFSET) { \ | 746 | .data..percpu : AT(ADDR(.data..percpu) - LOAD_OFFSET) { \ |
| 734 | VMLINUX_SYMBOL(__per_cpu_load) = .; \ | 747 | VMLINUX_SYMBOL(__per_cpu_load) = .; \ |
| @@ -736,7 +749,9 @@ | |||
| 736 | *(.data..percpu..first) \ | 749 | *(.data..percpu..first) \ |
| 737 | . = ALIGN(PAGE_SIZE); \ | 750 | . = ALIGN(PAGE_SIZE); \ |
| 738 | *(.data..percpu..page_aligned) \ | 751 | *(.data..percpu..page_aligned) \ |
| 752 | . = ALIGN(cacheline); \ | ||
| 739 | *(.data..percpu..readmostly) \ | 753 | *(.data..percpu..readmostly) \ |
| 754 | . = ALIGN(cacheline); \ | ||
| 740 | *(.data..percpu) \ | 755 | *(.data..percpu) \ |
| 741 | *(.data..percpu..shared_aligned) \ | 756 | *(.data..percpu..shared_aligned) \ |
| 742 | VMLINUX_SYMBOL(__per_cpu_end) = .; \ | 757 | VMLINUX_SYMBOL(__per_cpu_end) = .; \ |
diff --git a/include/drm/drmP.h b/include/drm/drmP.h index fe29aadb129d..348843b80150 100644 --- a/include/drm/drmP.h +++ b/include/drm/drmP.h | |||
| @@ -1101,7 +1101,7 @@ struct drm_device { | |||
| 1101 | struct platform_device *platformdev; /**< Platform device struture */ | 1101 | struct platform_device *platformdev; /**< Platform device struture */ |
| 1102 | 1102 | ||
| 1103 | struct drm_sg_mem *sg; /**< Scatter gather memory */ | 1103 | struct drm_sg_mem *sg; /**< Scatter gather memory */ |
| 1104 | int num_crtcs; /**< Number of CRTCs on this device */ | 1104 | unsigned int num_crtcs; /**< Number of CRTCs on this device */ |
| 1105 | void *dev_private; /**< device private data */ | 1105 | void *dev_private; /**< device private data */ |
| 1106 | void *mm_private; | 1106 | void *mm_private; |
| 1107 | struct address_space *dev_mapping; | 1107 | struct address_space *dev_mapping; |
diff --git a/include/keys/rxrpc-type.h b/include/keys/rxrpc-type.h index 5cb86c307f5d..fc4875433817 100644 --- a/include/keys/rxrpc-type.h +++ b/include/keys/rxrpc-type.h | |||
| @@ -99,7 +99,6 @@ struct rxrpc_key_token { | |||
| 99 | * structure of raw payloads passed to add_key() or instantiate key | 99 | * structure of raw payloads passed to add_key() or instantiate key |
| 100 | */ | 100 | */ |
| 101 | struct rxrpc_key_data_v1 { | 101 | struct rxrpc_key_data_v1 { |
| 102 | u32 kif_version; /* 1 */ | ||
| 103 | u16 security_index; | 102 | u16 security_index; |
| 104 | u16 ticket_length; | 103 | u16 ticket_length; |
| 105 | u32 expiry; /* time_t */ | 104 | u32 expiry; /* time_t */ |
diff --git a/include/linux/ata.h b/include/linux/ata.h index 0c4929fa34d3..32df2b6ef0e0 100644 --- a/include/linux/ata.h +++ b/include/linux/ata.h | |||
| @@ -89,6 +89,7 @@ enum { | |||
| 89 | ATA_ID_SPG = 98, | 89 | ATA_ID_SPG = 98, |
| 90 | ATA_ID_LBA_CAPACITY_2 = 100, | 90 | ATA_ID_LBA_CAPACITY_2 = 100, |
| 91 | ATA_ID_SECTOR_SIZE = 106, | 91 | ATA_ID_SECTOR_SIZE = 106, |
| 92 | ATA_ID_WWN = 108, | ||
| 92 | ATA_ID_LOGICAL_SECTOR_SIZE = 117, /* and 118 */ | 93 | ATA_ID_LOGICAL_SECTOR_SIZE = 117, /* and 118 */ |
| 93 | ATA_ID_LAST_LUN = 126, | 94 | ATA_ID_LAST_LUN = 126, |
| 94 | ATA_ID_DLF = 128, | 95 | ATA_ID_DLF = 128, |
| @@ -103,6 +104,7 @@ enum { | |||
| 103 | ATA_ID_SERNO_LEN = 20, | 104 | ATA_ID_SERNO_LEN = 20, |
| 104 | ATA_ID_FW_REV_LEN = 8, | 105 | ATA_ID_FW_REV_LEN = 8, |
| 105 | ATA_ID_PROD_LEN = 40, | 106 | ATA_ID_PROD_LEN = 40, |
| 107 | ATA_ID_WWN_LEN = 8, | ||
| 106 | 108 | ||
| 107 | ATA_PCI_CTL_OFS = 2, | 109 | ATA_PCI_CTL_OFS = 2, |
| 108 | 110 | ||
| @@ -598,42 +600,42 @@ static inline bool ata_id_has_dipm(const u16 *id) | |||
| 598 | } | 600 | } |
| 599 | 601 | ||
| 600 | 602 | ||
| 601 | static inline int ata_id_has_fua(const u16 *id) | 603 | static inline bool ata_id_has_fua(const u16 *id) |
| 602 | { | 604 | { |
| 603 | if ((id[ATA_ID_CFSSE] & 0xC000) != 0x4000) | 605 | if ((id[ATA_ID_CFSSE] & 0xC000) != 0x4000) |
| 604 | return 0; | 606 | return false; |
| 605 | return id[ATA_ID_CFSSE] & (1 << 6); | 607 | return id[ATA_ID_CFSSE] & (1 << 6); |
| 606 | } | 608 | } |
| 607 | 609 | ||
| 608 | static inline int ata_id_has_flush(const u16 *id) | 610 | static inline bool ata_id_has_flush(const u16 *id) |
| 609 | { | 611 | { |
| 610 | if ((id[ATA_ID_COMMAND_SET_2] & 0xC000) != 0x4000) | 612 | if ((id[ATA_ID_COMMAND_SET_2] & 0xC000) != 0x4000) |
| 611 | return 0; | 613 | return false; |
| 612 | return id[ATA_ID_COMMAND_SET_2] & (1 << 12); | 614 | return id[ATA_ID_COMMAND_SET_2] & (1 << 12); |
| 613 | } | 615 | } |
| 614 | 616 | ||
| 615 | static inline int ata_id_flush_enabled(const u16 *id) | 617 | static inline bool ata_id_flush_enabled(const u16 *id) |
| 616 | { | 618 | { |
| 617 | if (ata_id_has_flush(id) == 0) | 619 | if (ata_id_has_flush(id) == 0) |
| 618 | return 0; | 620 | return false; |
| 619 | if ((id[ATA_ID_CSF_DEFAULT] & 0xC000) != 0x4000) | 621 | if ((id[ATA_ID_CSF_DEFAULT] & 0xC000) != 0x4000) |
| 620 | return 0; | 622 | return false; |
| 621 | return id[ATA_ID_CFS_ENABLE_2] & (1 << 12); | 623 | return id[ATA_ID_CFS_ENABLE_2] & (1 << 12); |
| 622 | } | 624 | } |
| 623 | 625 | ||
| 624 | static inline int ata_id_has_flush_ext(const u16 *id) | 626 | static inline bool ata_id_has_flush_ext(const u16 *id) |
| 625 | { | 627 | { |
| 626 | if ((id[ATA_ID_COMMAND_SET_2] & 0xC000) != 0x4000) | 628 | if ((id[ATA_ID_COMMAND_SET_2] & 0xC000) != 0x4000) |
| 627 | return 0; | 629 | return false; |
| 628 | return id[ATA_ID_COMMAND_SET_2] & (1 << 13); | 630 | return id[ATA_ID_COMMAND_SET_2] & (1 << 13); |
| 629 | } | 631 | } |
| 630 | 632 | ||
| 631 | static inline int ata_id_flush_ext_enabled(const u16 *id) | 633 | static inline bool ata_id_flush_ext_enabled(const u16 *id) |
| 632 | { | 634 | { |
| 633 | if (ata_id_has_flush_ext(id) == 0) | 635 | if (ata_id_has_flush_ext(id) == 0) |
| 634 | return 0; | 636 | return false; |
| 635 | if ((id[ATA_ID_CSF_DEFAULT] & 0xC000) != 0x4000) | 637 | if ((id[ATA_ID_CSF_DEFAULT] & 0xC000) != 0x4000) |
| 636 | return 0; | 638 | return false; |
| 637 | /* | 639 | /* |
| 638 | * some Maxtor disks have bit 13 defined incorrectly | 640 | * some Maxtor disks have bit 13 defined incorrectly |
| 639 | * so check bit 10 too | 641 | * so check bit 10 too |
| @@ -686,64 +688,64 @@ static inline u16 ata_id_logical_sector_offset(const u16 *id, | |||
| 686 | return 0; | 688 | return 0; |
| 687 | } | 689 | } |
| 688 | 690 | ||
| 689 | static inline int ata_id_has_lba48(const u16 *id) | 691 | static inline bool ata_id_has_lba48(const u16 *id) |
| 690 | { | 692 | { |
| 691 | if ((id[ATA_ID_COMMAND_SET_2] & 0xC000) != 0x4000) | 693 | if ((id[ATA_ID_COMMAND_SET_2] & 0xC000) != 0x4000) |
| 692 | return 0; | 694 | return false; |
| 693 | if (!ata_id_u64(id, ATA_ID_LBA_CAPACITY_2)) | 695 | if (!ata_id_u64(id, ATA_ID_LBA_CAPACITY_2)) |
| 694 | return 0; | 696 | return false; |
| 695 | return id[ATA_ID_COMMAND_SET_2] & (1 << 10); | 697 | return id[ATA_ID_COMMAND_SET_2] & (1 << 10); |
| 696 | } | 698 | } |
| 697 | 699 | ||
| 698 | static inline int ata_id_lba48_enabled(const u16 *id) | 700 | static inline bool ata_id_lba48_enabled(const u16 *id) |
| 699 | { | 701 | { |
| 700 | if (ata_id_has_lba48(id) == 0) | 702 | if (ata_id_has_lba48(id) == 0) |
| 701 | return 0; | 703 | return false; |
| 702 | if ((id[ATA_ID_CSF_DEFAULT] & 0xC000) != 0x4000) | 704 | if ((id[ATA_ID_CSF_DEFAULT] & 0xC000) != 0x4000) |
| 703 | return 0; | 705 | return false; |
| 704 | return id[ATA_ID_CFS_ENABLE_2] & (1 << 10); | 706 | return id[ATA_ID_CFS_ENABLE_2] & (1 << 10); |
| 705 | } | 707 | } |
| 706 | 708 | ||
| 707 | static inline int ata_id_hpa_enabled(const u16 *id) | 709 | static inline bool ata_id_hpa_enabled(const u16 *id) |
| 708 | { | 710 | { |
| 709 | /* Yes children, word 83 valid bits cover word 82 data */ | 711 | /* Yes children, word 83 valid bits cover word 82 data */ |
| 710 | if ((id[ATA_ID_COMMAND_SET_2] & 0xC000) != 0x4000) | 712 | if ((id[ATA_ID_COMMAND_SET_2] & 0xC000) != 0x4000) |
| 711 | return 0; | 713 | return false; |
| 712 | /* And 87 covers 85-87 */ | 714 | /* And 87 covers 85-87 */ |
| 713 | if ((id[ATA_ID_CSF_DEFAULT] & 0xC000) != 0x4000) | 715 | if ((id[ATA_ID_CSF_DEFAULT] & 0xC000) != 0x4000) |
| 714 | return 0; | 716 | return false; |
| 715 | /* Check command sets enabled as well as supported */ | 717 | /* Check command sets enabled as well as supported */ |
| 716 | if ((id[ATA_ID_CFS_ENABLE_1] & (1 << 10)) == 0) | 718 | if ((id[ATA_ID_CFS_ENABLE_1] & (1 << 10)) == 0) |
| 717 | return 0; | 719 | return false; |
| 718 | return id[ATA_ID_COMMAND_SET_1] & (1 << 10); | 720 | return id[ATA_ID_COMMAND_SET_1] & (1 << 10); |
| 719 | } | 721 | } |
| 720 | 722 | ||
| 721 | static inline int ata_id_has_wcache(const u16 *id) | 723 | static inline bool ata_id_has_wcache(const u16 *id) |
| 722 | { | 724 | { |
| 723 | /* Yes children, word 83 valid bits cover word 82 data */ | 725 | /* Yes children, word 83 valid bits cover word 82 data */ |
| 724 | if ((id[ATA_ID_COMMAND_SET_2] & 0xC000) != 0x4000) | 726 | if ((id[ATA_ID_COMMAND_SET_2] & 0xC000) != 0x4000) |
| 725 | return 0; | 727 | return false; |
| 726 | return id[ATA_ID_COMMAND_SET_1] & (1 << 5); | 728 | return id[ATA_ID_COMMAND_SET_1] & (1 << 5); |
| 727 | } | 729 | } |
| 728 | 730 | ||
| 729 | static inline int ata_id_has_pm(const u16 *id) | 731 | static inline bool ata_id_has_pm(const u16 *id) |
| 730 | { | 732 | { |
| 731 | if ((id[ATA_ID_COMMAND_SET_2] & 0xC000) != 0x4000) | 733 | if ((id[ATA_ID_COMMAND_SET_2] & 0xC000) != 0x4000) |
| 732 | return 0; | 734 | return false; |
| 733 | return id[ATA_ID_COMMAND_SET_1] & (1 << 3); | 735 | return id[ATA_ID_COMMAND_SET_1] & (1 << 3); |
| 734 | } | 736 | } |
| 735 | 737 | ||
| 736 | static inline int ata_id_rahead_enabled(const u16 *id) | 738 | static inline bool ata_id_rahead_enabled(const u16 *id) |
| 737 | { | 739 | { |
| 738 | if ((id[ATA_ID_CSF_DEFAULT] & 0xC000) != 0x4000) | 740 | if ((id[ATA_ID_CSF_DEFAULT] & 0xC000) != 0x4000) |
| 739 | return 0; | 741 | return false; |
| 740 | return id[ATA_ID_CFS_ENABLE_1] & (1 << 6); | 742 | return id[ATA_ID_CFS_ENABLE_1] & (1 << 6); |
| 741 | } | 743 | } |
| 742 | 744 | ||
| 743 | static inline int ata_id_wcache_enabled(const u16 *id) | 745 | static inline bool ata_id_wcache_enabled(const u16 *id) |
| 744 | { | 746 | { |
| 745 | if ((id[ATA_ID_CSF_DEFAULT] & 0xC000) != 0x4000) | 747 | if ((id[ATA_ID_CSF_DEFAULT] & 0xC000) != 0x4000) |
| 746 | return 0; | 748 | return false; |
| 747 | return id[ATA_ID_CFS_ENABLE_1] & (1 << 5); | 749 | return id[ATA_ID_CFS_ENABLE_1] & (1 << 5); |
| 748 | } | 750 | } |
| 749 | 751 | ||
| @@ -773,7 +775,7 @@ static inline unsigned int ata_id_major_version(const u16 *id) | |||
| 773 | return mver; | 775 | return mver; |
| 774 | } | 776 | } |
| 775 | 777 | ||
| 776 | static inline int ata_id_is_sata(const u16 *id) | 778 | static inline bool ata_id_is_sata(const u16 *id) |
| 777 | { | 779 | { |
| 778 | /* | 780 | /* |
| 779 | * See if word 93 is 0 AND drive is at least ATA-5 compatible | 781 | * See if word 93 is 0 AND drive is at least ATA-5 compatible |
| @@ -782,37 +784,40 @@ static inline int ata_id_is_sata(const u16 *id) | |||
| 782 | * 0x0000 and 0xffff along with the earlier ATA revisions... | 784 | * 0x0000 and 0xffff along with the earlier ATA revisions... |
| 783 | */ | 785 | */ |
| 784 | if (id[ATA_ID_HW_CONFIG] == 0 && (short)id[ATA_ID_MAJOR_VER] >= 0x0020) | 786 | if (id[ATA_ID_HW_CONFIG] == 0 && (short)id[ATA_ID_MAJOR_VER] >= 0x0020) |
| 785 | return 1; | 787 | return true; |
| 786 | return 0; | 788 | return false; |
| 787 | } | 789 | } |
| 788 | 790 | ||
| 789 | static inline int ata_id_has_tpm(const u16 *id) | 791 | static inline bool ata_id_has_tpm(const u16 *id) |
| 790 | { | 792 | { |
| 791 | /* The TPM bits are only valid on ATA8 */ | 793 | /* The TPM bits are only valid on ATA8 */ |
| 792 | if (ata_id_major_version(id) < 8) | 794 | if (ata_id_major_version(id) < 8) |
| 793 | return 0; | 795 | return false; |
| 794 | if ((id[48] & 0xC000) != 0x4000) | 796 | if ((id[48] & 0xC000) != 0x4000) |
| 795 | return 0; | 797 | return false; |
| 796 | return id[48] & (1 << 0); | 798 | return id[48] & (1 << 0); |
| 797 | } | 799 | } |
| 798 | 800 | ||
| 799 | static inline int ata_id_has_dword_io(const u16 *id) | 801 | static inline bool ata_id_has_dword_io(const u16 *id) |
| 800 | { | 802 | { |
| 801 | /* ATA 8 reuses this flag for "trusted" computing */ | 803 | /* ATA 8 reuses this flag for "trusted" computing */ |
| 802 | if (ata_id_major_version(id) > 7) | 804 | if (ata_id_major_version(id) > 7) |
| 803 | return 0; | 805 | return false; |
| 804 | if (id[ATA_ID_DWORD_IO] & (1 << 0)) | 806 | return id[ATA_ID_DWORD_IO] & (1 << 0); |
| 805 | return 1; | ||
| 806 | return 0; | ||
| 807 | } | 807 | } |
| 808 | 808 | ||
| 809 | static inline int ata_id_has_unload(const u16 *id) | 809 | static inline bool ata_id_has_unload(const u16 *id) |
| 810 | { | 810 | { |
| 811 | if (ata_id_major_version(id) >= 7 && | 811 | if (ata_id_major_version(id) >= 7 && |
| 812 | (id[ATA_ID_CFSSE] & 0xC000) == 0x4000 && | 812 | (id[ATA_ID_CFSSE] & 0xC000) == 0x4000 && |
| 813 | id[ATA_ID_CFSSE] & (1 << 13)) | 813 | id[ATA_ID_CFSSE] & (1 << 13)) |
| 814 | return 1; | 814 | return true; |
| 815 | return 0; | 815 | return false; |
| 816 | } | ||
| 817 | |||
| 818 | static inline bool ata_id_has_wwn(const u16 *id) | ||
| 819 | { | ||
| 820 | return (id[ATA_ID_CSF_DEFAULT] & 0xC100) == 0x4100; | ||
| 816 | } | 821 | } |
| 817 | 822 | ||
| 818 | static inline int ata_id_form_factor(const u16 *id) | 823 | static inline int ata_id_form_factor(const u16 *id) |
| @@ -843,25 +848,25 @@ static inline int ata_id_rotation_rate(const u16 *id) | |||
| 843 | return val; | 848 | return val; |
| 844 | } | 849 | } |
| 845 | 850 | ||
| 846 | static inline int ata_id_has_trim(const u16 *id) | 851 | static inline bool ata_id_has_trim(const u16 *id) |
| 847 | { | 852 | { |
| 848 | if (ata_id_major_version(id) >= 7 && | 853 | if (ata_id_major_version(id) >= 7 && |
| 849 | (id[ATA_ID_DATA_SET_MGMT] & 1)) | 854 | (id[ATA_ID_DATA_SET_MGMT] & 1)) |
| 850 | return 1; | 855 | return true; |
| 851 | return 0; | 856 | return false; |
| 852 | } | 857 | } |
| 853 | 858 | ||
| 854 | static inline int ata_id_has_zero_after_trim(const u16 *id) | 859 | static inline bool ata_id_has_zero_after_trim(const u16 *id) |
| 855 | { | 860 | { |
| 856 | /* DSM supported, deterministic read, and read zero after trim set */ | 861 | /* DSM supported, deterministic read, and read zero after trim set */ |
| 857 | if (ata_id_has_trim(id) && | 862 | if (ata_id_has_trim(id) && |
| 858 | (id[ATA_ID_ADDITIONAL_SUPP] & 0x4020) == 0x4020) | 863 | (id[ATA_ID_ADDITIONAL_SUPP] & 0x4020) == 0x4020) |
| 859 | return 1; | 864 | return true; |
| 860 | 865 | ||
| 861 | return 0; | 866 | return false; |
| 862 | } | 867 | } |
| 863 | 868 | ||
| 864 | static inline int ata_id_current_chs_valid(const u16 *id) | 869 | static inline bool ata_id_current_chs_valid(const u16 *id) |
| 865 | { | 870 | { |
| 866 | /* For ATA-1 devices, if the INITIALIZE DEVICE PARAMETERS command | 871 | /* For ATA-1 devices, if the INITIALIZE DEVICE PARAMETERS command |
| 867 | has not been issued to the device then the values of | 872 | has not been issued to the device then the values of |
| @@ -873,11 +878,11 @@ static inline int ata_id_current_chs_valid(const u16 *id) | |||
| 873 | id[ATA_ID_CUR_SECTORS]; /* sectors in current translation */ | 878 | id[ATA_ID_CUR_SECTORS]; /* sectors in current translation */ |
| 874 | } | 879 | } |
| 875 | 880 | ||
| 876 | static inline int ata_id_is_cfa(const u16 *id) | 881 | static inline bool ata_id_is_cfa(const u16 *id) |
| 877 | { | 882 | { |
| 878 | if ((id[ATA_ID_CONFIG] == 0x848A) || /* Traditional CF */ | 883 | if ((id[ATA_ID_CONFIG] == 0x848A) || /* Traditional CF */ |
| 879 | (id[ATA_ID_CONFIG] == 0x844A)) /* Delkin Devices CF */ | 884 | (id[ATA_ID_CONFIG] == 0x844A)) /* Delkin Devices CF */ |
| 880 | return 1; | 885 | return true; |
| 881 | /* | 886 | /* |
| 882 | * CF specs don't require specific value in the word 0 anymore and yet | 887 | * CF specs don't require specific value in the word 0 anymore and yet |
| 883 | * they forbid to report the ATA version in the word 80 and require the | 888 | * they forbid to report the ATA version in the word 80 and require the |
| @@ -886,44 +891,40 @@ static inline int ata_id_is_cfa(const u16 *id) | |||
| 886 | * and while those that don't indicate CFA feature support need some | 891 | * and while those that don't indicate CFA feature support need some |
| 887 | * sort of quirk list, it seems impractical for the ones that do... | 892 | * sort of quirk list, it seems impractical for the ones that do... |
| 888 | */ | 893 | */ |
| 889 | if ((id[ATA_ID_COMMAND_SET_2] & 0xC004) == 0x4004) | 894 | return (id[ATA_ID_COMMAND_SET_2] & 0xC004) == 0x4004; |
| 890 | return 1; | ||
| 891 | return 0; | ||
| 892 | } | 895 | } |
| 893 | 896 | ||
| 894 | static inline int ata_id_is_ssd(const u16 *id) | 897 | static inline bool ata_id_is_ssd(const u16 *id) |
| 895 | { | 898 | { |
| 896 | return id[ATA_ID_ROT_SPEED] == 0x01; | 899 | return id[ATA_ID_ROT_SPEED] == 0x01; |
| 897 | } | 900 | } |
| 898 | 901 | ||
| 899 | static inline int ata_id_pio_need_iordy(const u16 *id, const u8 pio) | 902 | static inline bool ata_id_pio_need_iordy(const u16 *id, const u8 pio) |
| 900 | { | 903 | { |
| 901 | /* CF spec. r4.1 Table 22 says no IORDY on PIO5 and PIO6. */ | 904 | /* CF spec. r4.1 Table 22 says no IORDY on PIO5 and PIO6. */ |
| 902 | if (pio > 4 && ata_id_is_cfa(id)) | 905 | if (pio > 4 && ata_id_is_cfa(id)) |
| 903 | return 0; | 906 | return false; |
| 904 | /* For PIO3 and higher it is mandatory. */ | 907 | /* For PIO3 and higher it is mandatory. */ |
| 905 | if (pio > 2) | 908 | if (pio > 2) |
| 906 | return 1; | 909 | return true; |
| 907 | /* Turn it on when possible. */ | 910 | /* Turn it on when possible. */ |
| 908 | if (ata_id_has_iordy(id)) | 911 | return ata_id_has_iordy(id); |
| 909 | return 1; | ||
| 910 | return 0; | ||
| 911 | } | 912 | } |
| 912 | 913 | ||
| 913 | static inline int ata_drive_40wire(const u16 *dev_id) | 914 | static inline bool ata_drive_40wire(const u16 *dev_id) |
| 914 | { | 915 | { |
| 915 | if (ata_id_is_sata(dev_id)) | 916 | if (ata_id_is_sata(dev_id)) |
| 916 | return 0; /* SATA */ | 917 | return false; /* SATA */ |
| 917 | if ((dev_id[ATA_ID_HW_CONFIG] & 0xE000) == 0x6000) | 918 | if ((dev_id[ATA_ID_HW_CONFIG] & 0xE000) == 0x6000) |
| 918 | return 0; /* 80 wire */ | 919 | return false; /* 80 wire */ |
| 919 | return 1; | 920 | return true; |
| 920 | } | 921 | } |
| 921 | 922 | ||
| 922 | static inline int ata_drive_40wire_relaxed(const u16 *dev_id) | 923 | static inline bool ata_drive_40wire_relaxed(const u16 *dev_id) |
| 923 | { | 924 | { |
| 924 | if ((dev_id[ATA_ID_HW_CONFIG] & 0x2000) == 0x2000) | 925 | if ((dev_id[ATA_ID_HW_CONFIG] & 0x2000) == 0x2000) |
| 925 | return 0; /* 80 wire */ | 926 | return false; /* 80 wire */ |
| 926 | return 1; | 927 | return true; |
| 927 | } | 928 | } |
| 928 | 929 | ||
| 929 | static inline int atapi_cdb_len(const u16 *dev_id) | 930 | static inline int atapi_cdb_len(const u16 *dev_id) |
| @@ -936,12 +937,12 @@ static inline int atapi_cdb_len(const u16 *dev_id) | |||
| 936 | } | 937 | } |
| 937 | } | 938 | } |
| 938 | 939 | ||
| 939 | static inline int atapi_command_packet_set(const u16 *dev_id) | 940 | static inline bool atapi_command_packet_set(const u16 *dev_id) |
| 940 | { | 941 | { |
| 941 | return (dev_id[ATA_ID_CONFIG] >> 8) & 0x1f; | 942 | return (dev_id[ATA_ID_CONFIG] >> 8) & 0x1f; |
| 942 | } | 943 | } |
| 943 | 944 | ||
| 944 | static inline int atapi_id_dmadir(const u16 *dev_id) | 945 | static inline bool atapi_id_dmadir(const u16 *dev_id) |
| 945 | { | 946 | { |
| 946 | return ata_id_major_version(dev_id) >= 7 && (dev_id[62] & 0x8000); | 947 | return ata_id_major_version(dev_id) >= 7 && (dev_id[62] & 0x8000); |
| 947 | } | 948 | } |
| @@ -954,13 +955,13 @@ static inline int atapi_id_dmadir(const u16 *dev_id) | |||
| 954 | * | 955 | * |
| 955 | * It is called only once for each device. | 956 | * It is called only once for each device. |
| 956 | */ | 957 | */ |
| 957 | static inline int ata_id_is_lba_capacity_ok(u16 *id) | 958 | static inline bool ata_id_is_lba_capacity_ok(u16 *id) |
| 958 | { | 959 | { |
| 959 | unsigned long lba_sects, chs_sects, head, tail; | 960 | unsigned long lba_sects, chs_sects, head, tail; |
| 960 | 961 | ||
| 961 | /* No non-LBA info .. so valid! */ | 962 | /* No non-LBA info .. so valid! */ |
| 962 | if (id[ATA_ID_CYLS] == 0) | 963 | if (id[ATA_ID_CYLS] == 0) |
| 963 | return 1; | 964 | return true; |
| 964 | 965 | ||
| 965 | lba_sects = ata_id_u32(id, ATA_ID_LBA_CAPACITY); | 966 | lba_sects = ata_id_u32(id, ATA_ID_LBA_CAPACITY); |
| 966 | 967 | ||
| @@ -975,13 +976,13 @@ static inline int ata_id_is_lba_capacity_ok(u16 *id) | |||
| 975 | id[ATA_ID_SECTORS] == 63 && | 976 | id[ATA_ID_SECTORS] == 63 && |
| 976 | (id[ATA_ID_HEADS] == 15 || id[ATA_ID_HEADS] == 16) && | 977 | (id[ATA_ID_HEADS] == 15 || id[ATA_ID_HEADS] == 16) && |
| 977 | (lba_sects >= 16383 * 63 * id[ATA_ID_HEADS])) | 978 | (lba_sects >= 16383 * 63 * id[ATA_ID_HEADS])) |
| 978 | return 1; | 979 | return true; |
| 979 | 980 | ||
| 980 | chs_sects = id[ATA_ID_CYLS] * id[ATA_ID_HEADS] * id[ATA_ID_SECTORS]; | 981 | chs_sects = id[ATA_ID_CYLS] * id[ATA_ID_HEADS] * id[ATA_ID_SECTORS]; |
| 981 | 982 | ||
| 982 | /* perform a rough sanity check on lba_sects: within 10% is OK */ | 983 | /* perform a rough sanity check on lba_sects: within 10% is OK */ |
| 983 | if (lba_sects - chs_sects < chs_sects/10) | 984 | if (lba_sects - chs_sects < chs_sects/10) |
| 984 | return 1; | 985 | return true; |
| 985 | 986 | ||
| 986 | /* some drives have the word order reversed */ | 987 | /* some drives have the word order reversed */ |
| 987 | head = (lba_sects >> 16) & 0xffff; | 988 | head = (lba_sects >> 16) & 0xffff; |
| @@ -990,10 +991,10 @@ static inline int ata_id_is_lba_capacity_ok(u16 *id) | |||
| 990 | 991 | ||
| 991 | if (lba_sects - chs_sects < chs_sects/10) { | 992 | if (lba_sects - chs_sects < chs_sects/10) { |
| 992 | *(__le32 *)&id[ATA_ID_LBA_CAPACITY] = __cpu_to_le32(lba_sects); | 993 | *(__le32 *)&id[ATA_ID_LBA_CAPACITY] = __cpu_to_le32(lba_sects); |
| 993 | return 1; /* LBA capacity is (now) good */ | 994 | return true; /* LBA capacity is (now) good */ |
| 994 | } | 995 | } |
| 995 | 996 | ||
| 996 | return 0; /* LBA capacity value may be bad */ | 997 | return false; /* LBA capacity value may be bad */ |
| 997 | } | 998 | } |
| 998 | 999 | ||
| 999 | static inline void ata_id_to_hd_driveid(u16 *id) | 1000 | static inline void ata_id_to_hd_driveid(u16 *id) |
| @@ -1051,19 +1052,19 @@ static inline int is_multi_taskfile(struct ata_taskfile *tf) | |||
| 1051 | (tf->command == ATA_CMD_WRITE_MULTI_FUA_EXT); | 1052 | (tf->command == ATA_CMD_WRITE_MULTI_FUA_EXT); |
| 1052 | } | 1053 | } |
| 1053 | 1054 | ||
| 1054 | static inline int ata_ok(u8 status) | 1055 | static inline bool ata_ok(u8 status) |
| 1055 | { | 1056 | { |
| 1056 | return ((status & (ATA_BUSY | ATA_DRDY | ATA_DF | ATA_DRQ | ATA_ERR)) | 1057 | return ((status & (ATA_BUSY | ATA_DRDY | ATA_DF | ATA_DRQ | ATA_ERR)) |
| 1057 | == ATA_DRDY); | 1058 | == ATA_DRDY); |
| 1058 | } | 1059 | } |
| 1059 | 1060 | ||
| 1060 | static inline int lba_28_ok(u64 block, u32 n_block) | 1061 | static inline bool lba_28_ok(u64 block, u32 n_block) |
| 1061 | { | 1062 | { |
| 1062 | /* check the ending block number: must be LESS THAN 0x0fffffff */ | 1063 | /* check the ending block number: must be LESS THAN 0x0fffffff */ |
| 1063 | return ((block + n_block) < ((1 << 28) - 1)) && (n_block <= 256); | 1064 | return ((block + n_block) < ((1 << 28) - 1)) && (n_block <= 256); |
| 1064 | } | 1065 | } |
| 1065 | 1066 | ||
| 1066 | static inline int lba_48_ok(u64 block, u32 n_block) | 1067 | static inline bool lba_48_ok(u64 block, u32 n_block) |
| 1067 | { | 1068 | { |
| 1068 | /* check the ending block number */ | 1069 | /* check the ending block number */ |
| 1069 | return ((block + n_block - 1) < ((u64)1 << 48)) && (n_block <= 65536); | 1070 | return ((block + n_block - 1) < ((u64)1 << 48)) && (n_block <= 65536); |
diff --git a/include/linux/audit.h b/include/linux/audit.h index 359df0487690..9d339eb27881 100644 --- a/include/linux/audit.h +++ b/include/linux/audit.h | |||
| @@ -103,6 +103,8 @@ | |||
| 103 | #define AUDIT_BPRM_FCAPS 1321 /* Information about fcaps increasing perms */ | 103 | #define AUDIT_BPRM_FCAPS 1321 /* Information about fcaps increasing perms */ |
| 104 | #define AUDIT_CAPSET 1322 /* Record showing argument to sys_capset */ | 104 | #define AUDIT_CAPSET 1322 /* Record showing argument to sys_capset */ |
| 105 | #define AUDIT_MMAP 1323 /* Record showing descriptor and flags in mmap */ | 105 | #define AUDIT_MMAP 1323 /* Record showing descriptor and flags in mmap */ |
| 106 | #define AUDIT_NETFILTER_PKT 1324 /* Packets traversing netfilter chains */ | ||
| 107 | #define AUDIT_NETFILTER_CFG 1325 /* Netfilter chain modifications */ | ||
| 106 | 108 | ||
| 107 | #define AUDIT_AVC 1400 /* SE Linux avc denial or grant */ | 109 | #define AUDIT_AVC 1400 /* SE Linux avc denial or grant */ |
| 108 | #define AUDIT_SELINUX_ERR 1401 /* Internal SE Linux Errors */ | 110 | #define AUDIT_SELINUX_ERR 1401 /* Internal SE Linux Errors */ |
diff --git a/include/linux/blkdev.h b/include/linux/blkdev.h index 4d18ff34670a..d5063e1b5555 100644 --- a/include/linux/blkdev.h +++ b/include/linux/blkdev.h | |||
| @@ -699,7 +699,7 @@ extern void blk_start_queue(struct request_queue *q); | |||
| 699 | extern void blk_stop_queue(struct request_queue *q); | 699 | extern void blk_stop_queue(struct request_queue *q); |
| 700 | extern void blk_sync_queue(struct request_queue *q); | 700 | extern void blk_sync_queue(struct request_queue *q); |
| 701 | extern void __blk_stop_queue(struct request_queue *q); | 701 | extern void __blk_stop_queue(struct request_queue *q); |
| 702 | extern void __blk_run_queue(struct request_queue *); | 702 | extern void __blk_run_queue(struct request_queue *q, bool force_kblockd); |
| 703 | extern void blk_run_queue(struct request_queue *); | 703 | extern void blk_run_queue(struct request_queue *); |
| 704 | extern int blk_rq_map_user(struct request_queue *, struct request *, | 704 | extern int blk_rq_map_user(struct request_queue *, struct request *, |
| 705 | struct rq_map_data *, void __user *, unsigned long, | 705 | struct rq_map_data *, void __user *, unsigned long, |
| @@ -1088,7 +1088,6 @@ static inline void put_dev_sector(Sector p) | |||
| 1088 | 1088 | ||
| 1089 | struct work_struct; | 1089 | struct work_struct; |
| 1090 | int kblockd_schedule_work(struct request_queue *q, struct work_struct *work); | 1090 | int kblockd_schedule_work(struct request_queue *q, struct work_struct *work); |
| 1091 | int kblockd_schedule_delayed_work(struct request_queue *q, struct delayed_work *dwork, unsigned long delay); | ||
| 1092 | 1091 | ||
| 1093 | #ifdef CONFIG_BLK_CGROUP | 1092 | #ifdef CONFIG_BLK_CGROUP |
| 1094 | /* | 1093 | /* |
| @@ -1136,7 +1135,6 @@ static inline uint64_t rq_io_start_time_ns(struct request *req) | |||
| 1136 | extern int blk_throtl_init(struct request_queue *q); | 1135 | extern int blk_throtl_init(struct request_queue *q); |
| 1137 | extern void blk_throtl_exit(struct request_queue *q); | 1136 | extern void blk_throtl_exit(struct request_queue *q); |
| 1138 | extern int blk_throtl_bio(struct request_queue *q, struct bio **bio); | 1137 | extern int blk_throtl_bio(struct request_queue *q, struct bio **bio); |
| 1139 | extern void throtl_schedule_delayed_work(struct request_queue *q, unsigned long delay); | ||
| 1140 | extern void throtl_shutdown_timer_wq(struct request_queue *q); | 1138 | extern void throtl_shutdown_timer_wq(struct request_queue *q); |
| 1141 | #else /* CONFIG_BLK_DEV_THROTTLING */ | 1139 | #else /* CONFIG_BLK_DEV_THROTTLING */ |
| 1142 | static inline int blk_throtl_bio(struct request_queue *q, struct bio **bio) | 1140 | static inline int blk_throtl_bio(struct request_queue *q, struct bio **bio) |
| @@ -1146,7 +1144,6 @@ static inline int blk_throtl_bio(struct request_queue *q, struct bio **bio) | |||
| 1146 | 1144 | ||
| 1147 | static inline int blk_throtl_init(struct request_queue *q) { return 0; } | 1145 | static inline int blk_throtl_init(struct request_queue *q) { return 0; } |
| 1148 | static inline int blk_throtl_exit(struct request_queue *q) { return 0; } | 1146 | static inline int blk_throtl_exit(struct request_queue *q) { return 0; } |
| 1149 | static inline void throtl_schedule_delayed_work(struct request_queue *q, unsigned long delay) {} | ||
| 1150 | static inline void throtl_shutdown_timer_wq(struct request_queue *q) {} | 1147 | static inline void throtl_shutdown_timer_wq(struct request_queue *q) {} |
| 1151 | #endif /* CONFIG_BLK_DEV_THROTTLING */ | 1148 | #endif /* CONFIG_BLK_DEV_THROTTLING */ |
| 1152 | 1149 | ||
diff --git a/include/linux/blktrace_api.h b/include/linux/blktrace_api.h index 3395cf7130f5..b22fb0d3db0f 100644 --- a/include/linux/blktrace_api.h +++ b/include/linux/blktrace_api.h | |||
| @@ -245,7 +245,6 @@ static inline int blk_cmd_buf_len(struct request *rq) | |||
| 245 | 245 | ||
| 246 | extern void blk_dump_cmd(char *buf, struct request *rq); | 246 | extern void blk_dump_cmd(char *buf, struct request *rq); |
| 247 | extern void blk_fill_rwbs(char *rwbs, u32 rw, int bytes); | 247 | extern void blk_fill_rwbs(char *rwbs, u32 rw, int bytes); |
| 248 | extern void blk_fill_rwbs_rq(char *rwbs, struct request *rq); | ||
| 249 | 248 | ||
| 250 | #endif /* CONFIG_EVENT_TRACING && CONFIG_BLOCK */ | 249 | #endif /* CONFIG_EVENT_TRACING && CONFIG_BLOCK */ |
| 251 | 250 | ||
diff --git a/include/linux/ceph/messenger.h b/include/linux/ceph/messenger.h index c3011beac30d..31d91a64838b 100644 --- a/include/linux/ceph/messenger.h +++ b/include/linux/ceph/messenger.h | |||
| @@ -123,6 +123,7 @@ struct ceph_msg_pos { | |||
| 123 | #define SOCK_CLOSED 11 /* socket state changed to closed */ | 123 | #define SOCK_CLOSED 11 /* socket state changed to closed */ |
| 124 | #define OPENING 13 /* open connection w/ (possibly new) peer */ | 124 | #define OPENING 13 /* open connection w/ (possibly new) peer */ |
| 125 | #define DEAD 14 /* dead, about to kfree */ | 125 | #define DEAD 14 /* dead, about to kfree */ |
| 126 | #define BACKOFF 15 | ||
| 126 | 127 | ||
| 127 | /* | 128 | /* |
| 128 | * A single connection with another host. | 129 | * A single connection with another host. |
| @@ -160,7 +161,6 @@ struct ceph_connection { | |||
| 160 | struct list_head out_queue; | 161 | struct list_head out_queue; |
| 161 | struct list_head out_sent; /* sending or sent but unacked */ | 162 | struct list_head out_sent; /* sending or sent but unacked */ |
| 162 | u64 out_seq; /* last message queued for send */ | 163 | u64 out_seq; /* last message queued for send */ |
| 163 | bool out_keepalive_pending; | ||
| 164 | 164 | ||
| 165 | u64 in_seq, in_seq_acked; /* last message received, acked */ | 165 | u64 in_seq, in_seq_acked; /* last message received, acked */ |
| 166 | 166 | ||
diff --git a/include/linux/cgroup.h b/include/linux/cgroup.h index ce104e33cd22..e654fa239916 100644 --- a/include/linux/cgroup.h +++ b/include/linux/cgroup.h | |||
| @@ -474,7 +474,8 @@ struct cgroup_subsys { | |||
| 474 | struct cgroup *old_cgrp, struct task_struct *tsk, | 474 | struct cgroup *old_cgrp, struct task_struct *tsk, |
| 475 | bool threadgroup); | 475 | bool threadgroup); |
| 476 | void (*fork)(struct cgroup_subsys *ss, struct task_struct *task); | 476 | void (*fork)(struct cgroup_subsys *ss, struct task_struct *task); |
| 477 | void (*exit)(struct cgroup_subsys *ss, struct task_struct *task); | 477 | void (*exit)(struct cgroup_subsys *ss, struct cgroup *cgrp, |
| 478 | struct cgroup *old_cgrp, struct task_struct *task); | ||
| 478 | int (*populate)(struct cgroup_subsys *ss, | 479 | int (*populate)(struct cgroup_subsys *ss, |
| 479 | struct cgroup *cgrp); | 480 | struct cgroup *cgrp); |
| 480 | void (*post_clone)(struct cgroup_subsys *ss, struct cgroup *cgrp); | 481 | void (*post_clone)(struct cgroup_subsys *ss, struct cgroup *cgrp); |
| @@ -626,6 +627,7 @@ bool css_is_ancestor(struct cgroup_subsys_state *cg, | |||
| 626 | /* Get id and depth of css */ | 627 | /* Get id and depth of css */ |
| 627 | unsigned short css_id(struct cgroup_subsys_state *css); | 628 | unsigned short css_id(struct cgroup_subsys_state *css); |
| 628 | unsigned short css_depth(struct cgroup_subsys_state *css); | 629 | unsigned short css_depth(struct cgroup_subsys_state *css); |
| 630 | struct cgroup_subsys_state *cgroup_css_from_dir(struct file *f, int id); | ||
| 629 | 631 | ||
| 630 | #else /* !CONFIG_CGROUPS */ | 632 | #else /* !CONFIG_CGROUPS */ |
| 631 | 633 | ||
diff --git a/include/linux/cgroup_subsys.h b/include/linux/cgroup_subsys.h index ccefff02b6cb..cdbfcb8780ec 100644 --- a/include/linux/cgroup_subsys.h +++ b/include/linux/cgroup_subsys.h | |||
| @@ -65,4 +65,8 @@ SUBSYS(net_cls) | |||
| 65 | SUBSYS(blkio) | 65 | SUBSYS(blkio) |
| 66 | #endif | 66 | #endif |
| 67 | 67 | ||
| 68 | #ifdef CONFIG_CGROUP_PERF | ||
| 69 | SUBSYS(perf) | ||
| 70 | #endif | ||
| 71 | |||
| 68 | /* */ | 72 | /* */ |
diff --git a/include/linux/connector.h b/include/linux/connector.h index 7e8ca75d2dad..bcafc942e5e4 100644 --- a/include/linux/connector.h +++ b/include/linux/connector.h | |||
| @@ -42,8 +42,9 @@ | |||
| 42 | #define CN_VAL_DM_USERSPACE_LOG 0x1 | 42 | #define CN_VAL_DM_USERSPACE_LOG 0x1 |
| 43 | #define CN_IDX_DRBD 0x8 | 43 | #define CN_IDX_DRBD 0x8 |
| 44 | #define CN_VAL_DRBD 0x1 | 44 | #define CN_VAL_DRBD 0x1 |
| 45 | #define CN_KVP_IDX 0x9 /* HyperV KVP */ | ||
| 45 | 46 | ||
| 46 | #define CN_NETLINK_USERS 8 | 47 | #define CN_NETLINK_USERS 9 |
| 47 | 48 | ||
| 48 | /* | 49 | /* |
| 49 | * Maximum connector's message size. | 50 | * Maximum connector's message size. |
| @@ -128,14 +129,17 @@ struct cn_dev { | |||
| 128 | struct cn_queue_dev *cbdev; | 129 | struct cn_queue_dev *cbdev; |
| 129 | }; | 130 | }; |
| 130 | 131 | ||
| 131 | int cn_add_callback(struct cb_id *, char *, void (*callback) (struct cn_msg *, struct netlink_skb_parms *)); | 132 | int cn_add_callback(struct cb_id *id, const char *name, |
| 133 | void (*callback)(struct cn_msg *, struct netlink_skb_parms *)); | ||
| 132 | void cn_del_callback(struct cb_id *); | 134 | void cn_del_callback(struct cb_id *); |
| 133 | int cn_netlink_send(struct cn_msg *, u32, gfp_t); | 135 | int cn_netlink_send(struct cn_msg *, u32, gfp_t); |
| 134 | 136 | ||
| 135 | int cn_queue_add_callback(struct cn_queue_dev *dev, char *name, struct cb_id *id, void (*callback)(struct cn_msg *, struct netlink_skb_parms *)); | 137 | int cn_queue_add_callback(struct cn_queue_dev *dev, const char *name, |
| 138 | struct cb_id *id, | ||
| 139 | void (*callback)(struct cn_msg *, struct netlink_skb_parms *)); | ||
| 136 | void cn_queue_del_callback(struct cn_queue_dev *dev, struct cb_id *id); | 140 | void cn_queue_del_callback(struct cn_queue_dev *dev, struct cb_id *id); |
| 137 | 141 | ||
| 138 | struct cn_queue_dev *cn_queue_alloc_dev(char *name, struct sock *); | 142 | struct cn_queue_dev *cn_queue_alloc_dev(const char *name, struct sock *); |
| 139 | void cn_queue_free_dev(struct cn_queue_dev *dev); | 143 | void cn_queue_free_dev(struct cn_queue_dev *dev); |
| 140 | 144 | ||
| 141 | int cn_cb_equal(struct cb_id *, struct cb_id *); | 145 | int cn_cb_equal(struct cb_id *, struct cb_id *); |
diff --git a/include/linux/cpu_rmap.h b/include/linux/cpu_rmap.h new file mode 100644 index 000000000000..473771a528c0 --- /dev/null +++ b/include/linux/cpu_rmap.h | |||
| @@ -0,0 +1,73 @@ | |||
| 1 | /* | ||
| 2 | * cpu_rmap.c: CPU affinity reverse-map support | ||
| 3 | * Copyright 2011 Solarflare Communications Inc. | ||
| 4 | * | ||
| 5 | * This program is free software; you can redistribute it and/or modify it | ||
| 6 | * under the terms of the GNU General Public License version 2 as published | ||
| 7 | * by the Free Software Foundation, incorporated herein by reference. | ||
| 8 | */ | ||
| 9 | |||
| 10 | #include <linux/cpumask.h> | ||
| 11 | #include <linux/gfp.h> | ||
| 12 | #include <linux/slab.h> | ||
| 13 | |||
| 14 | /** | ||
| 15 | * struct cpu_rmap - CPU affinity reverse-map | ||
| 16 | * @size: Number of objects to be reverse-mapped | ||
| 17 | * @used: Number of objects added | ||
| 18 | * @obj: Pointer to array of object pointers | ||
| 19 | * @near: For each CPU, the index and distance to the nearest object, | ||
| 20 | * based on affinity masks | ||
| 21 | */ | ||
| 22 | struct cpu_rmap { | ||
| 23 | u16 size, used; | ||
| 24 | void **obj; | ||
| 25 | struct { | ||
| 26 | u16 index; | ||
| 27 | u16 dist; | ||
| 28 | } near[0]; | ||
| 29 | }; | ||
| 30 | #define CPU_RMAP_DIST_INF 0xffff | ||
| 31 | |||
| 32 | extern struct cpu_rmap *alloc_cpu_rmap(unsigned int size, gfp_t flags); | ||
| 33 | |||
| 34 | /** | ||
| 35 | * free_cpu_rmap - free CPU affinity reverse-map | ||
| 36 | * @rmap: Reverse-map allocated with alloc_cpu_rmap(), or %NULL | ||
| 37 | */ | ||
| 38 | static inline void free_cpu_rmap(struct cpu_rmap *rmap) | ||
| 39 | { | ||
| 40 | kfree(rmap); | ||
| 41 | } | ||
| 42 | |||
| 43 | extern int cpu_rmap_add(struct cpu_rmap *rmap, void *obj); | ||
| 44 | extern int cpu_rmap_update(struct cpu_rmap *rmap, u16 index, | ||
| 45 | const struct cpumask *affinity); | ||
| 46 | |||
| 47 | static inline u16 cpu_rmap_lookup_index(struct cpu_rmap *rmap, unsigned int cpu) | ||
| 48 | { | ||
| 49 | return rmap->near[cpu].index; | ||
| 50 | } | ||
| 51 | |||
| 52 | static inline void *cpu_rmap_lookup_obj(struct cpu_rmap *rmap, unsigned int cpu) | ||
| 53 | { | ||
| 54 | return rmap->obj[rmap->near[cpu].index]; | ||
| 55 | } | ||
| 56 | |||
| 57 | #ifdef CONFIG_GENERIC_HARDIRQS | ||
| 58 | |||
| 59 | /** | ||
| 60 | * alloc_irq_cpu_rmap - allocate CPU affinity reverse-map for IRQs | ||
| 61 | * @size: Number of objects to be mapped | ||
| 62 | * | ||
| 63 | * Must be called in process context. | ||
| 64 | */ | ||
| 65 | static inline struct cpu_rmap *alloc_irq_cpu_rmap(unsigned int size) | ||
| 66 | { | ||
| 67 | return alloc_cpu_rmap(size, GFP_KERNEL); | ||
| 68 | } | ||
| 69 | extern void free_irq_cpu_rmap(struct cpu_rmap *rmap); | ||
| 70 | |||
| 71 | extern int irq_cpu_rmap_add(struct cpu_rmap *rmap, int irq); | ||
| 72 | |||
| 73 | #endif | ||
diff --git a/include/linux/dcbnl.h b/include/linux/dcbnl.h index 68cd248f6d3e..c52280047e2c 100644 --- a/include/linux/dcbnl.h +++ b/include/linux/dcbnl.h | |||
| @@ -1,5 +1,5 @@ | |||
| 1 | /* | 1 | /* |
| 2 | * Copyright (c) 2008, Intel Corporation. | 2 | * Copyright (c) 2008-2011, Intel Corporation. |
| 3 | * | 3 | * |
| 4 | * This program is free software; you can redistribute it and/or modify it | 4 | * This program is free software; you can redistribute it and/or modify it |
| 5 | * under the terms and conditions of the GNU General Public License, | 5 | * under the terms and conditions of the GNU General Public License, |
| @@ -25,9 +25,14 @@ | |||
| 25 | /* IEEE 802.1Qaz std supported values */ | 25 | /* IEEE 802.1Qaz std supported values */ |
| 26 | #define IEEE_8021QAZ_MAX_TCS 8 | 26 | #define IEEE_8021QAZ_MAX_TCS 8 |
| 27 | 27 | ||
| 28 | #define IEEE_8021QAZ_TSA_STRICT 0 | ||
| 29 | #define IEEE_8021QAZ_TSA_CB_SHAPER 1 | ||
| 30 | #define IEEE_8021QAZ_TSA_ETS 2 | ||
| 31 | #define IEEE_8021QAZ_TSA_VENDOR 255 | ||
| 32 | |||
| 28 | /* This structure contains the IEEE 802.1Qaz ETS managed object | 33 | /* This structure contains the IEEE 802.1Qaz ETS managed object |
| 29 | * | 34 | * |
| 30 | * @willing: willing bit in ETS configuratin TLV | 35 | * @willing: willing bit in ETS configuration TLV |
| 31 | * @ets_cap: indicates supported capacity of ets feature | 36 | * @ets_cap: indicates supported capacity of ets feature |
| 32 | * @cbs: credit based shaper ets algorithm supported | 37 | * @cbs: credit based shaper ets algorithm supported |
| 33 | * @tc_tx_bw: tc tx bandwidth indexed by traffic class | 38 | * @tc_tx_bw: tc tx bandwidth indexed by traffic class |
| @@ -82,6 +87,50 @@ struct ieee_pfc { | |||
| 82 | __u64 indications[IEEE_8021QAZ_MAX_TCS]; | 87 | __u64 indications[IEEE_8021QAZ_MAX_TCS]; |
| 83 | }; | 88 | }; |
| 84 | 89 | ||
| 90 | /* CEE DCBX std supported values */ | ||
| 91 | #define CEE_DCBX_MAX_PGS 8 | ||
| 92 | #define CEE_DCBX_MAX_PRIO 8 | ||
| 93 | |||
| 94 | /** | ||
| 95 | * struct cee_pg - CEE Priority-Group managed object | ||
| 96 | * | ||
| 97 | * @willing: willing bit in the PG tlv | ||
| 98 | * @error: error bit in the PG tlv | ||
| 99 | * @pg_en: enable bit of the PG feature | ||
| 100 | * @tcs_supported: number of traffic classes supported | ||
| 101 | * @pg_bw: bandwidth percentage for each priority group | ||
| 102 | * @prio_pg: priority to PG mapping indexed by priority | ||
| 103 | */ | ||
| 104 | struct cee_pg { | ||
| 105 | __u8 willing; | ||
| 106 | __u8 error; | ||
| 107 | __u8 pg_en; | ||
| 108 | __u8 tcs_supported; | ||
| 109 | __u8 pg_bw[CEE_DCBX_MAX_PGS]; | ||
| 110 | __u8 prio_pg[CEE_DCBX_MAX_PGS]; | ||
| 111 | }; | ||
| 112 | |||
| 113 | /** | ||
| 114 | * struct cee_pfc - CEE PFC managed object | ||
| 115 | * | ||
| 116 | * @willing: willing bit in the PFC tlv | ||
| 117 | * @error: error bit in the PFC tlv | ||
| 118 | * @pfc_en: bitmap indicating pfc enabled traffic classes | ||
| 119 | * @tcs_supported: number of traffic classes supported | ||
| 120 | */ | ||
| 121 | struct cee_pfc { | ||
| 122 | __u8 willing; | ||
| 123 | __u8 error; | ||
| 124 | __u8 pfc_en; | ||
| 125 | __u8 tcs_supported; | ||
| 126 | }; | ||
| 127 | |||
| 128 | /* IEEE 802.1Qaz std supported values */ | ||
| 129 | #define IEEE_8021QAZ_APP_SEL_ETHERTYPE 1 | ||
| 130 | #define IEEE_8021QAZ_APP_SEL_STREAM 2 | ||
| 131 | #define IEEE_8021QAZ_APP_SEL_DGRAM 3 | ||
| 132 | #define IEEE_8021QAZ_APP_SEL_ANY 4 | ||
| 133 | |||
| 85 | /* This structure contains the IEEE 802.1Qaz APP managed object. This | 134 | /* This structure contains the IEEE 802.1Qaz APP managed object. This |
| 86 | * object is also used for the CEE std as well. There is no difference | 135 | * object is also used for the CEE std as well. There is no difference |
| 87 | * between the objects. | 136 | * between the objects. |
| @@ -101,8 +150,22 @@ struct ieee_pfc { | |||
| 101 | */ | 150 | */ |
| 102 | struct dcb_app { | 151 | struct dcb_app { |
| 103 | __u8 selector; | 152 | __u8 selector; |
| 104 | __u32 protocol; | ||
| 105 | __u8 priority; | 153 | __u8 priority; |
| 154 | __u16 protocol; | ||
| 155 | }; | ||
| 156 | |||
| 157 | /** | ||
| 158 | * struct dcb_peer_app_info - APP feature information sent by the peer | ||
| 159 | * | ||
| 160 | * @willing: willing bit in the peer APP tlv | ||
| 161 | * @error: error bit in the peer APP tlv | ||
| 162 | * | ||
| 163 | * In addition to this information the full peer APP tlv also contains | ||
| 164 | * a table of 'app_count' APP objects defined above. | ||
| 165 | */ | ||
| 166 | struct dcb_peer_app_info { | ||
| 167 | __u8 willing; | ||
| 168 | __u8 error; | ||
| 106 | }; | 169 | }; |
| 107 | 170 | ||
| 108 | struct dcbmsg { | 171 | struct dcbmsg { |
| @@ -139,6 +202,7 @@ struct dcbmsg { | |||
| 139 | * @DCB_CMD_SDCBX: set DCBX engine configuration | 202 | * @DCB_CMD_SDCBX: set DCBX engine configuration |
| 140 | * @DCB_CMD_GFEATCFG: get DCBX features flags | 203 | * @DCB_CMD_GFEATCFG: get DCBX features flags |
| 141 | * @DCB_CMD_SFEATCFG: set DCBX features negotiation flags | 204 | * @DCB_CMD_SFEATCFG: set DCBX features negotiation flags |
| 205 | * @DCB_CMD_CEE_GET: get CEE aggregated configuration | ||
| 142 | */ | 206 | */ |
| 143 | enum dcbnl_commands { | 207 | enum dcbnl_commands { |
| 144 | DCB_CMD_UNDEFINED, | 208 | DCB_CMD_UNDEFINED, |
| @@ -181,6 +245,8 @@ enum dcbnl_commands { | |||
| 181 | DCB_CMD_GFEATCFG, | 245 | DCB_CMD_GFEATCFG, |
| 182 | DCB_CMD_SFEATCFG, | 246 | DCB_CMD_SFEATCFG, |
| 183 | 247 | ||
| 248 | DCB_CMD_CEE_GET, | ||
| 249 | |||
| 184 | __DCB_CMD_ENUM_MAX, | 250 | __DCB_CMD_ENUM_MAX, |
| 185 | DCB_CMD_MAX = __DCB_CMD_ENUM_MAX - 1, | 251 | DCB_CMD_MAX = __DCB_CMD_ENUM_MAX - 1, |
| 186 | }; | 252 | }; |
| @@ -203,6 +269,7 @@ enum dcbnl_commands { | |||
| 203 | * @DCB_ATTR_IEEE: IEEE 802.1Qaz supported attributes (NLA_NESTED) | 269 | * @DCB_ATTR_IEEE: IEEE 802.1Qaz supported attributes (NLA_NESTED) |
| 204 | * @DCB_ATTR_DCBX: DCBX engine configuration in the device (NLA_U8) | 270 | * @DCB_ATTR_DCBX: DCBX engine configuration in the device (NLA_U8) |
| 205 | * @DCB_ATTR_FEATCFG: DCBX features flags (NLA_NESTED) | 271 | * @DCB_ATTR_FEATCFG: DCBX features flags (NLA_NESTED) |
| 272 | * @DCB_ATTR_CEE: CEE std supported attributes (NLA_NESTED) | ||
| 206 | */ | 273 | */ |
| 207 | enum dcbnl_attrs { | 274 | enum dcbnl_attrs { |
| 208 | DCB_ATTR_UNDEFINED, | 275 | DCB_ATTR_UNDEFINED, |
| @@ -226,15 +293,32 @@ enum dcbnl_attrs { | |||
| 226 | DCB_ATTR_DCBX, | 293 | DCB_ATTR_DCBX, |
| 227 | DCB_ATTR_FEATCFG, | 294 | DCB_ATTR_FEATCFG, |
| 228 | 295 | ||
| 296 | /* CEE nested attributes */ | ||
| 297 | DCB_ATTR_CEE, | ||
| 298 | |||
| 229 | __DCB_ATTR_ENUM_MAX, | 299 | __DCB_ATTR_ENUM_MAX, |
| 230 | DCB_ATTR_MAX = __DCB_ATTR_ENUM_MAX - 1, | 300 | DCB_ATTR_MAX = __DCB_ATTR_ENUM_MAX - 1, |
| 231 | }; | 301 | }; |
| 232 | 302 | ||
| 303 | /** | ||
| 304 | * enum ieee_attrs - IEEE 802.1Qaz get/set attributes | ||
| 305 | * | ||
| 306 | * @DCB_ATTR_IEEE_UNSPEC: unspecified | ||
| 307 | * @DCB_ATTR_IEEE_ETS: negotiated ETS configuration | ||
| 308 | * @DCB_ATTR_IEEE_PFC: negotiated PFC configuration | ||
| 309 | * @DCB_ATTR_IEEE_APP_TABLE: negotiated APP configuration | ||
| 310 | * @DCB_ATTR_IEEE_PEER_ETS: peer ETS configuration - get only | ||
| 311 | * @DCB_ATTR_IEEE_PEER_PFC: peer PFC configuration - get only | ||
| 312 | * @DCB_ATTR_IEEE_PEER_APP: peer APP tlv - get only | ||
| 313 | */ | ||
| 233 | enum ieee_attrs { | 314 | enum ieee_attrs { |
| 234 | DCB_ATTR_IEEE_UNSPEC, | 315 | DCB_ATTR_IEEE_UNSPEC, |
| 235 | DCB_ATTR_IEEE_ETS, | 316 | DCB_ATTR_IEEE_ETS, |
| 236 | DCB_ATTR_IEEE_PFC, | 317 | DCB_ATTR_IEEE_PFC, |
| 237 | DCB_ATTR_IEEE_APP_TABLE, | 318 | DCB_ATTR_IEEE_APP_TABLE, |
| 319 | DCB_ATTR_IEEE_PEER_ETS, | ||
| 320 | DCB_ATTR_IEEE_PEER_PFC, | ||
| 321 | DCB_ATTR_IEEE_PEER_APP, | ||
| 238 | __DCB_ATTR_IEEE_MAX | 322 | __DCB_ATTR_IEEE_MAX |
| 239 | }; | 323 | }; |
| 240 | #define DCB_ATTR_IEEE_MAX (__DCB_ATTR_IEEE_MAX - 1) | 324 | #define DCB_ATTR_IEEE_MAX (__DCB_ATTR_IEEE_MAX - 1) |
| @@ -247,6 +331,31 @@ enum ieee_attrs_app { | |||
| 247 | #define DCB_ATTR_IEEE_APP_MAX (__DCB_ATTR_IEEE_APP_MAX - 1) | 331 | #define DCB_ATTR_IEEE_APP_MAX (__DCB_ATTR_IEEE_APP_MAX - 1) |
| 248 | 332 | ||
| 249 | /** | 333 | /** |
| 334 | * enum cee_attrs - CEE DCBX get attributes | ||
| 335 | * | ||
| 336 | * @DCB_ATTR_CEE_UNSPEC: unspecified | ||
| 337 | * @DCB_ATTR_CEE_PEER_PG: peer PG configuration - get only | ||
| 338 | * @DCB_ATTR_CEE_PEER_PFC: peer PFC configuration - get only | ||
| 339 | * @DCB_ATTR_CEE_PEER_APP: peer APP tlv - get only | ||
| 340 | */ | ||
| 341 | enum cee_attrs { | ||
| 342 | DCB_ATTR_CEE_UNSPEC, | ||
| 343 | DCB_ATTR_CEE_PEER_PG, | ||
| 344 | DCB_ATTR_CEE_PEER_PFC, | ||
| 345 | DCB_ATTR_CEE_PEER_APP_TABLE, | ||
| 346 | __DCB_ATTR_CEE_MAX | ||
| 347 | }; | ||
| 348 | #define DCB_ATTR_CEE_MAX (__DCB_ATTR_CEE_MAX - 1) | ||
| 349 | |||
| 350 | enum peer_app_attr { | ||
| 351 | DCB_ATTR_CEE_PEER_APP_UNSPEC, | ||
| 352 | DCB_ATTR_CEE_PEER_APP_INFO, | ||
| 353 | DCB_ATTR_CEE_PEER_APP, | ||
| 354 | __DCB_ATTR_CEE_PEER_APP_MAX | ||
| 355 | }; | ||
| 356 | #define DCB_ATTR_CEE_PEER_APP_MAX (__DCB_ATTR_CEE_PEER_APP_MAX - 1) | ||
| 357 | |||
| 358 | /** | ||
| 250 | * enum dcbnl_pfc_attrs - DCB Priority Flow Control user priority nested attrs | 359 | * enum dcbnl_pfc_attrs - DCB Priority Flow Control user priority nested attrs |
| 251 | * | 360 | * |
| 252 | * @DCB_PFC_UP_ATTR_UNDEFINED: unspecified attribute to catch errors | 361 | * @DCB_PFC_UP_ATTR_UNDEFINED: unspecified attribute to catch errors |
diff --git a/include/linux/dccp.h b/include/linux/dccp.h index 010e2d87ed75..d638e85dc501 100644 --- a/include/linux/dccp.h +++ b/include/linux/dccp.h | |||
| @@ -279,8 +279,6 @@ enum dccp_state { | |||
| 279 | DCCP_MAX_STATES | 279 | DCCP_MAX_STATES |
| 280 | }; | 280 | }; |
| 281 | 281 | ||
| 282 | #define DCCP_STATE_MASK 0x1f | ||
| 283 | |||
| 284 | enum { | 282 | enum { |
| 285 | DCCPF_OPEN = TCPF_ESTABLISHED, | 283 | DCCPF_OPEN = TCPF_ESTABLISHED, |
| 286 | DCCPF_REQUESTING = TCPF_SYN_SENT, | 284 | DCCPF_REQUESTING = TCPF_SYN_SENT, |
diff --git a/include/linux/debugobjects.h b/include/linux/debugobjects.h index 597692f1fc8d..65970b811e22 100644 --- a/include/linux/debugobjects.h +++ b/include/linux/debugobjects.h | |||
| @@ -34,7 +34,10 @@ struct debug_obj { | |||
| 34 | 34 | ||
| 35 | /** | 35 | /** |
| 36 | * struct debug_obj_descr - object type specific debug description structure | 36 | * struct debug_obj_descr - object type specific debug description structure |
| 37 | * | ||
| 37 | * @name: name of the object typee | 38 | * @name: name of the object typee |
| 39 | * @debug_hint: function returning address, which have associated | ||
| 40 | * kernel symbol, to allow identify the object | ||
| 38 | * @fixup_init: fixup function, which is called when the init check | 41 | * @fixup_init: fixup function, which is called when the init check |
| 39 | * fails | 42 | * fails |
| 40 | * @fixup_activate: fixup function, which is called when the activate check | 43 | * @fixup_activate: fixup function, which is called when the activate check |
| @@ -46,7 +49,7 @@ struct debug_obj { | |||
| 46 | */ | 49 | */ |
| 47 | struct debug_obj_descr { | 50 | struct debug_obj_descr { |
| 48 | const char *name; | 51 | const char *name; |
| 49 | 52 | void *(*debug_hint) (void *addr); | |
| 50 | int (*fixup_init) (void *addr, enum debug_obj_state state); | 53 | int (*fixup_init) (void *addr, enum debug_obj_state state); |
| 51 | int (*fixup_activate) (void *addr, enum debug_obj_state state); | 54 | int (*fixup_activate) (void *addr, enum debug_obj_state state); |
| 52 | int (*fixup_destroy) (void *addr, enum debug_obj_state state); | 55 | int (*fixup_destroy) (void *addr, enum debug_obj_state state); |
diff --git a/include/linux/device.h b/include/linux/device.h index 1bf5cf0b4513..144ec135875f 100644 --- a/include/linux/device.h +++ b/include/linux/device.h | |||
| @@ -128,9 +128,7 @@ struct device_driver { | |||
| 128 | 128 | ||
| 129 | bool suppress_bind_attrs; /* disables bind/unbind via sysfs */ | 129 | bool suppress_bind_attrs; /* disables bind/unbind via sysfs */ |
| 130 | 130 | ||
| 131 | #if defined(CONFIG_OF) | ||
| 132 | const struct of_device_id *of_match_table; | 131 | const struct of_device_id *of_match_table; |
| 133 | #endif | ||
| 134 | 132 | ||
| 135 | int (*probe) (struct device *dev); | 133 | int (*probe) (struct device *dev); |
| 136 | int (*remove) (struct device *dev); | 134 | int (*remove) (struct device *dev); |
| @@ -422,6 +420,7 @@ struct device { | |||
| 422 | void *platform_data; /* Platform specific data, device | 420 | void *platform_data; /* Platform specific data, device |
| 423 | core doesn't touch it */ | 421 | core doesn't touch it */ |
| 424 | struct dev_pm_info power; | 422 | struct dev_pm_info power; |
| 423 | struct dev_power_domain *pwr_domain; | ||
| 425 | 424 | ||
| 426 | #ifdef CONFIG_NUMA | 425 | #ifdef CONFIG_NUMA |
| 427 | int numa_node; /* NUMA node this device is close to */ | 426 | int numa_node; /* NUMA node this device is close to */ |
| @@ -441,9 +440,9 @@ struct device { | |||
| 441 | override */ | 440 | override */ |
| 442 | /* arch specific additions */ | 441 | /* arch specific additions */ |
| 443 | struct dev_archdata archdata; | 442 | struct dev_archdata archdata; |
| 444 | #ifdef CONFIG_OF | 443 | |
| 445 | struct device_node *of_node; | 444 | struct device_node *of_node; /* associated device tree node */ |
| 446 | #endif | 445 | const struct of_device_id *of_match; /* matching of_device_id from driver */ |
| 447 | 446 | ||
| 448 | dev_t devt; /* dev_t, creates the sysfs "dev" */ | 447 | dev_t devt; /* dev_t, creates the sysfs "dev" */ |
| 449 | 448 | ||
diff --git a/include/linux/dmi.h b/include/linux/dmi.h index 90e087f8d951..f156cca25ad0 100644 --- a/include/linux/dmi.h +++ b/include/linux/dmi.h | |||
| @@ -23,6 +23,53 @@ enum dmi_device_type { | |||
| 23 | DMI_DEV_TYPE_DEV_ONBOARD = -3, | 23 | DMI_DEV_TYPE_DEV_ONBOARD = -3, |
| 24 | }; | 24 | }; |
| 25 | 25 | ||
| 26 | enum dmi_entry_type { | ||
| 27 | DMI_ENTRY_BIOS = 0, | ||
| 28 | DMI_ENTRY_SYSTEM, | ||
| 29 | DMI_ENTRY_BASEBOARD, | ||
| 30 | DMI_ENTRY_CHASSIS, | ||
| 31 | DMI_ENTRY_PROCESSOR, | ||
| 32 | DMI_ENTRY_MEM_CONTROLLER, | ||
| 33 | DMI_ENTRY_MEM_MODULE, | ||
| 34 | DMI_ENTRY_CACHE, | ||
| 35 | DMI_ENTRY_PORT_CONNECTOR, | ||
| 36 | DMI_ENTRY_SYSTEM_SLOT, | ||
| 37 | DMI_ENTRY_ONBOARD_DEVICE, | ||
| 38 | DMI_ENTRY_OEMSTRINGS, | ||
| 39 | DMI_ENTRY_SYSCONF, | ||
| 40 | DMI_ENTRY_BIOS_LANG, | ||
| 41 | DMI_ENTRY_GROUP_ASSOC, | ||
| 42 | DMI_ENTRY_SYSTEM_EVENT_LOG, | ||
| 43 | DMI_ENTRY_PHYS_MEM_ARRAY, | ||
| 44 | DMI_ENTRY_MEM_DEVICE, | ||
| 45 | DMI_ENTRY_32_MEM_ERROR, | ||
| 46 | DMI_ENTRY_MEM_ARRAY_MAPPED_ADDR, | ||
| 47 | DMI_ENTRY_MEM_DEV_MAPPED_ADDR, | ||
| 48 | DMI_ENTRY_BUILTIN_POINTING_DEV, | ||
| 49 | DMI_ENTRY_PORTABLE_BATTERY, | ||
| 50 | DMI_ENTRY_SYSTEM_RESET, | ||
| 51 | DMI_ENTRY_HW_SECURITY, | ||
| 52 | DMI_ENTRY_SYSTEM_POWER_CONTROLS, | ||
| 53 | DMI_ENTRY_VOLTAGE_PROBE, | ||
| 54 | DMI_ENTRY_COOLING_DEV, | ||
| 55 | DMI_ENTRY_TEMP_PROBE, | ||
| 56 | DMI_ENTRY_ELECTRICAL_CURRENT_PROBE, | ||
| 57 | DMI_ENTRY_OOB_REMOTE_ACCESS, | ||
| 58 | DMI_ENTRY_BIS_ENTRY, | ||
| 59 | DMI_ENTRY_SYSTEM_BOOT, | ||
| 60 | DMI_ENTRY_MGMT_DEV, | ||
| 61 | DMI_ENTRY_MGMT_DEV_COMPONENT, | ||
| 62 | DMI_ENTRY_MGMT_DEV_THRES, | ||
| 63 | DMI_ENTRY_MEM_CHANNEL, | ||
| 64 | DMI_ENTRY_IPMI_DEV, | ||
| 65 | DMI_ENTRY_SYS_POWER_SUPPLY, | ||
| 66 | DMI_ENTRY_ADDITIONAL, | ||
| 67 | DMI_ENTRY_ONBOARD_DEV_EXT, | ||
| 68 | DMI_ENTRY_MGMT_CONTROLLER_HOST, | ||
| 69 | DMI_ENTRY_INACTIVE = 126, | ||
| 70 | DMI_ENTRY_END_OF_TABLE = 127, | ||
| 71 | }; | ||
| 72 | |||
| 26 | struct dmi_header { | 73 | struct dmi_header { |
| 27 | u8 type; | 74 | u8 type; |
| 28 | u8 length; | 75 | u8 length; |
diff --git a/include/linux/dynamic_debug.h b/include/linux/dynamic_debug.h index 1c70028f81f9..0c9653f11c18 100644 --- a/include/linux/dynamic_debug.h +++ b/include/linux/dynamic_debug.h | |||
| @@ -31,6 +31,10 @@ struct _ddebug { | |||
| 31 | * writes commands to <debugfs>/dynamic_debug/control | 31 | * writes commands to <debugfs>/dynamic_debug/control |
| 32 | */ | 32 | */ |
| 33 | #define _DPRINTK_FLAGS_PRINT (1<<0) /* printk() a message using the format */ | 33 | #define _DPRINTK_FLAGS_PRINT (1<<0) /* printk() a message using the format */ |
| 34 | #define _DPRINTK_FLAGS_INCL_MODNAME (1<<1) | ||
| 35 | #define _DPRINTK_FLAGS_INCL_FUNCNAME (1<<2) | ||
| 36 | #define _DPRINTK_FLAGS_INCL_LINENO (1<<3) | ||
| 37 | #define _DPRINTK_FLAGS_INCL_TID (1<<4) | ||
| 34 | #define _DPRINTK_FLAGS_DEFAULT 0 | 38 | #define _DPRINTK_FLAGS_DEFAULT 0 |
| 35 | unsigned int flags:8; | 39 | unsigned int flags:8; |
| 36 | char enabled; | 40 | char enabled; |
| @@ -42,6 +46,8 @@ int ddebug_add_module(struct _ddebug *tab, unsigned int n, | |||
| 42 | 46 | ||
| 43 | #if defined(CONFIG_DYNAMIC_DEBUG) | 47 | #if defined(CONFIG_DYNAMIC_DEBUG) |
| 44 | extern int ddebug_remove_module(const char *mod_name); | 48 | extern int ddebug_remove_module(const char *mod_name); |
| 49 | extern int __dynamic_pr_debug(struct _ddebug *descriptor, const char *fmt, ...) | ||
| 50 | __attribute__ ((format (printf, 2, 3))); | ||
| 45 | 51 | ||
| 46 | #define dynamic_pr_debug(fmt, ...) do { \ | 52 | #define dynamic_pr_debug(fmt, ...) do { \ |
| 47 | static struct _ddebug descriptor \ | 53 | static struct _ddebug descriptor \ |
| @@ -50,7 +56,7 @@ extern int ddebug_remove_module(const char *mod_name); | |||
| 50 | { KBUILD_MODNAME, __func__, __FILE__, fmt, __LINE__, \ | 56 | { KBUILD_MODNAME, __func__, __FILE__, fmt, __LINE__, \ |
| 51 | _DPRINTK_FLAGS_DEFAULT }; \ | 57 | _DPRINTK_FLAGS_DEFAULT }; \ |
| 52 | if (unlikely(descriptor.enabled)) \ | 58 | if (unlikely(descriptor.enabled)) \ |
| 53 | printk(KERN_DEBUG pr_fmt(fmt), ##__VA_ARGS__); \ | 59 | __dynamic_pr_debug(&descriptor, pr_fmt(fmt), ##__VA_ARGS__); \ |
| 54 | } while (0) | 60 | } while (0) |
| 55 | 61 | ||
| 56 | 62 | ||
diff --git a/include/linux/efi.h b/include/linux/efi.h index fb737bc19a8c..33fa1203024e 100644 --- a/include/linux/efi.h +++ b/include/linux/efi.h | |||
| @@ -397,4 +397,41 @@ static inline void memrange_efi_to_native(u64 *addr, u64 *npages) | |||
| 397 | *addr &= PAGE_MASK; | 397 | *addr &= PAGE_MASK; |
| 398 | } | 398 | } |
| 399 | 399 | ||
| 400 | #if defined(CONFIG_EFI_VARS) || defined(CONFIG_EFI_VARS_MODULE) | ||
| 401 | /* | ||
| 402 | * EFI Variable support. | ||
| 403 | * | ||
| 404 | * Different firmware drivers can expose their EFI-like variables using | ||
| 405 | * the following. | ||
| 406 | */ | ||
| 407 | |||
| 408 | struct efivar_operations { | ||
| 409 | efi_get_variable_t *get_variable; | ||
| 410 | efi_get_next_variable_t *get_next_variable; | ||
| 411 | efi_set_variable_t *set_variable; | ||
| 412 | }; | ||
| 413 | |||
| 414 | struct efivars { | ||
| 415 | /* | ||
| 416 | * ->lock protects two things: | ||
| 417 | * 1) ->list - adds, removals, reads, writes | ||
| 418 | * 2) ops.[gs]et_variable() calls. | ||
| 419 | * It must not be held when creating sysfs entries or calling kmalloc. | ||
| 420 | * ops.get_next_variable() is only called from register_efivars(), | ||
| 421 | * which is protected by the BKL, so that path is safe. | ||
| 422 | */ | ||
| 423 | spinlock_t lock; | ||
| 424 | struct list_head list; | ||
| 425 | struct kset *kset; | ||
| 426 | struct bin_attribute *new_var, *del_var; | ||
| 427 | const struct efivar_operations *ops; | ||
| 428 | }; | ||
| 429 | |||
| 430 | int register_efivars(struct efivars *efivars, | ||
| 431 | const struct efivar_operations *ops, | ||
| 432 | struct kobject *parent_kobj); | ||
| 433 | void unregister_efivars(struct efivars *efivars); | ||
| 434 | |||
| 435 | #endif /* CONFIG_EFI_VARS */ | ||
| 436 | |||
| 400 | #endif /* _LINUX_EFI_H */ | 437 | #endif /* _LINUX_EFI_H */ |
diff --git a/include/linux/ethtool.h b/include/linux/ethtool.h index 1908929204a9..aac3e2eeb4fd 100644 --- a/include/linux/ethtool.h +++ b/include/linux/ethtool.h | |||
| @@ -251,6 +251,7 @@ enum ethtool_stringset { | |||
| 251 | ETH_SS_STATS, | 251 | ETH_SS_STATS, |
| 252 | ETH_SS_PRIV_FLAGS, | 252 | ETH_SS_PRIV_FLAGS, |
| 253 | ETH_SS_NTUPLE_FILTERS, | 253 | ETH_SS_NTUPLE_FILTERS, |
| 254 | ETH_SS_FEATURES, | ||
| 254 | }; | 255 | }; |
| 255 | 256 | ||
| 256 | /* for passing string sets for data tagging */ | 257 | /* for passing string sets for data tagging */ |
| @@ -523,6 +524,92 @@ struct ethtool_flash { | |||
| 523 | char data[ETHTOOL_FLASH_MAX_FILENAME]; | 524 | char data[ETHTOOL_FLASH_MAX_FILENAME]; |
| 524 | }; | 525 | }; |
| 525 | 526 | ||
| 527 | /* for returning and changing feature sets */ | ||
| 528 | |||
| 529 | /** | ||
| 530 | * struct ethtool_get_features_block - block with state of 32 features | ||
| 531 | * @available: mask of changeable features | ||
| 532 | * @requested: mask of features requested to be enabled if possible | ||
| 533 | * @active: mask of currently enabled features | ||
| 534 | * @never_changed: mask of features not changeable for any device | ||
| 535 | */ | ||
| 536 | struct ethtool_get_features_block { | ||
| 537 | __u32 available; | ||
| 538 | __u32 requested; | ||
| 539 | __u32 active; | ||
| 540 | __u32 never_changed; | ||
| 541 | }; | ||
| 542 | |||
| 543 | /** | ||
| 544 | * struct ethtool_gfeatures - command to get state of device's features | ||
| 545 | * @cmd: command number = %ETHTOOL_GFEATURES | ||
| 546 | * @size: in: number of elements in the features[] array; | ||
| 547 | * out: number of elements in features[] needed to hold all features | ||
| 548 | * @features: state of features | ||
| 549 | */ | ||
| 550 | struct ethtool_gfeatures { | ||
| 551 | __u32 cmd; | ||
| 552 | __u32 size; | ||
| 553 | struct ethtool_get_features_block features[0]; | ||
| 554 | }; | ||
| 555 | |||
| 556 | /** | ||
| 557 | * struct ethtool_set_features_block - block with request for 32 features | ||
| 558 | * @valid: mask of features to be changed | ||
| 559 | * @requested: values of features to be changed | ||
| 560 | */ | ||
| 561 | struct ethtool_set_features_block { | ||
| 562 | __u32 valid; | ||
| 563 | __u32 requested; | ||
| 564 | }; | ||
| 565 | |||
| 566 | /** | ||
| 567 | * struct ethtool_sfeatures - command to request change in device's features | ||
| 568 | * @cmd: command number = %ETHTOOL_SFEATURES | ||
| 569 | * @size: array size of the features[] array | ||
| 570 | * @features: feature change masks | ||
| 571 | */ | ||
| 572 | struct ethtool_sfeatures { | ||
| 573 | __u32 cmd; | ||
| 574 | __u32 size; | ||
| 575 | struct ethtool_set_features_block features[0]; | ||
| 576 | }; | ||
| 577 | |||
| 578 | /* | ||
| 579 | * %ETHTOOL_SFEATURES changes features present in features[].valid to the | ||
| 580 | * values of corresponding bits in features[].requested. Bits in .requested | ||
| 581 | * not set in .valid or not changeable are ignored. | ||
| 582 | * | ||
| 583 | * Returns %EINVAL when .valid contains undefined or never-changable bits | ||
| 584 | * or size is not equal to required number of features words (32-bit blocks). | ||
| 585 | * Returns >= 0 if request was completed; bits set in the value mean: | ||
| 586 | * %ETHTOOL_F_UNSUPPORTED - there were bits set in .valid that are not | ||
| 587 | * changeable (not present in %ETHTOOL_GFEATURES' features[].available) | ||
| 588 | * those bits were ignored. | ||
| 589 | * %ETHTOOL_F_WISH - some or all changes requested were recorded but the | ||
| 590 | * resulting state of bits masked by .valid is not equal to .requested. | ||
| 591 | * Probably there are other device-specific constraints on some features | ||
| 592 | * in the set. When %ETHTOOL_F_UNSUPPORTED is set, .valid is considered | ||
| 593 | * here as though ignored bits were cleared. | ||
| 594 | * %ETHTOOL_F_COMPAT - some or all changes requested were made by calling | ||
| 595 | * compatibility functions. Requested offload state cannot be properly | ||
| 596 | * managed by kernel. | ||
| 597 | * | ||
| 598 | * Meaning of bits in the masks are obtained by %ETHTOOL_GSSET_INFO (number of | ||
| 599 | * bits in the arrays - always multiple of 32) and %ETHTOOL_GSTRINGS commands | ||
| 600 | * for ETH_SS_FEATURES string set. First entry in the table corresponds to least | ||
| 601 | * significant bit in features[0] fields. Empty strings mark undefined features. | ||
| 602 | */ | ||
| 603 | enum ethtool_sfeatures_retval_bits { | ||
| 604 | ETHTOOL_F_UNSUPPORTED__BIT, | ||
| 605 | ETHTOOL_F_WISH__BIT, | ||
| 606 | ETHTOOL_F_COMPAT__BIT, | ||
| 607 | }; | ||
| 608 | |||
| 609 | #define ETHTOOL_F_UNSUPPORTED (1 << ETHTOOL_F_UNSUPPORTED__BIT) | ||
| 610 | #define ETHTOOL_F_WISH (1 << ETHTOOL_F_WISH__BIT) | ||
| 611 | #define ETHTOOL_F_COMPAT (1 << ETHTOOL_F_COMPAT__BIT) | ||
| 612 | |||
| 526 | #ifdef __KERNEL__ | 613 | #ifdef __KERNEL__ |
| 527 | 614 | ||
| 528 | #include <linux/rculist.h> | 615 | #include <linux/rculist.h> |
| @@ -543,7 +630,6 @@ struct net_device; | |||
| 543 | 630 | ||
| 544 | /* Some generic methods drivers may use in their ethtool_ops */ | 631 | /* Some generic methods drivers may use in their ethtool_ops */ |
| 545 | u32 ethtool_op_get_link(struct net_device *dev); | 632 | u32 ethtool_op_get_link(struct net_device *dev); |
| 546 | u32 ethtool_op_get_rx_csum(struct net_device *dev); | ||
| 547 | u32 ethtool_op_get_tx_csum(struct net_device *dev); | 633 | u32 ethtool_op_get_tx_csum(struct net_device *dev); |
| 548 | int ethtool_op_set_tx_csum(struct net_device *dev, u32 data); | 634 | int ethtool_op_set_tx_csum(struct net_device *dev, u32 data); |
| 549 | int ethtool_op_set_tx_hw_csum(struct net_device *dev, u32 data); | 635 | int ethtool_op_set_tx_hw_csum(struct net_device *dev, u32 data); |
| @@ -744,6 +830,9 @@ struct ethtool_ops { | |||
| 744 | #define ETHTOOL_GRXFHINDIR 0x00000038 /* Get RX flow hash indir'n table */ | 830 | #define ETHTOOL_GRXFHINDIR 0x00000038 /* Get RX flow hash indir'n table */ |
| 745 | #define ETHTOOL_SRXFHINDIR 0x00000039 /* Set RX flow hash indir'n table */ | 831 | #define ETHTOOL_SRXFHINDIR 0x00000039 /* Set RX flow hash indir'n table */ |
| 746 | 832 | ||
| 833 | #define ETHTOOL_GFEATURES 0x0000003a /* Get device offload settings */ | ||
| 834 | #define ETHTOOL_SFEATURES 0x0000003b /* Change device offload settings */ | ||
| 835 | |||
| 747 | /* compatibility with older code */ | 836 | /* compatibility with older code */ |
| 748 | #define SPARC_ETH_GSET ETHTOOL_GSET | 837 | #define SPARC_ETH_GSET ETHTOOL_GSET |
| 749 | #define SPARC_ETH_SSET ETHTOOL_SSET | 838 | #define SPARC_ETH_SSET ETHTOOL_SSET |
diff --git a/include/linux/exportfs.h b/include/linux/exportfs.h index 28028988c862..33a42f24b275 100644 --- a/include/linux/exportfs.h +++ b/include/linux/exportfs.h | |||
| @@ -8,6 +8,9 @@ struct inode; | |||
| 8 | struct super_block; | 8 | struct super_block; |
| 9 | struct vfsmount; | 9 | struct vfsmount; |
| 10 | 10 | ||
| 11 | /* limit the handle size to NFSv4 handle size now */ | ||
| 12 | #define MAX_HANDLE_SZ 128 | ||
| 13 | |||
| 11 | /* | 14 | /* |
| 12 | * The fileid_type identifies how the file within the filesystem is encoded. | 15 | * The fileid_type identifies how the file within the filesystem is encoded. |
| 13 | * In theory this is freely set and parsed by the filesystem, but we try to | 16 | * In theory this is freely set and parsed by the filesystem, but we try to |
| @@ -121,8 +124,10 @@ struct fid { | |||
| 121 | * set, the encode_fh() should store sufficient information so that a good | 124 | * set, the encode_fh() should store sufficient information so that a good |
| 122 | * attempt can be made to find not only the file but also it's place in the | 125 | * attempt can be made to find not only the file but also it's place in the |
| 123 | * filesystem. This typically means storing a reference to de->d_parent in | 126 | * filesystem. This typically means storing a reference to de->d_parent in |
| 124 | * the filehandle fragment. encode_fh() should return the number of bytes | 127 | * the filehandle fragment. encode_fh() should return the fileid_type on |
| 125 | * stored or a negative error code such as %-ENOSPC | 128 | * success and on error returns 255 (if the space needed to encode fh is |
| 129 | * greater than @max_len*4 bytes). On error @max_len contains the minimum | ||
| 130 | * size(in 4 byte unit) needed to encode the file handle. | ||
| 126 | * | 131 | * |
| 127 | * fh_to_dentry: | 132 | * fh_to_dentry: |
| 128 | * @fh_to_dentry is given a &struct super_block (@sb) and a file handle | 133 | * @fh_to_dentry is given a &struct super_block (@sb) and a file handle |
diff --git a/include/linux/ext3_fs.h b/include/linux/ext3_fs.h index 65990ef612f5..6043c64c207a 100644 --- a/include/linux/ext3_fs.h +++ b/include/linux/ext3_fs.h | |||
| @@ -884,7 +884,8 @@ extern int ext3fs_dirhash(const char *name, int len, struct | |||
| 884 | dx_hash_info *hinfo); | 884 | dx_hash_info *hinfo); |
| 885 | 885 | ||
| 886 | /* ialloc.c */ | 886 | /* ialloc.c */ |
| 887 | extern struct inode * ext3_new_inode (handle_t *, struct inode *, int); | 887 | extern struct inode * ext3_new_inode (handle_t *, struct inode *, |
| 888 | const struct qstr *, int); | ||
| 888 | extern void ext3_free_inode (handle_t *, struct inode *); | 889 | extern void ext3_free_inode (handle_t *, struct inode *); |
| 889 | extern struct inode * ext3_orphan_get (struct super_block *, unsigned long); | 890 | extern struct inode * ext3_orphan_get (struct super_block *, unsigned long); |
| 890 | extern unsigned long ext3_count_free_inodes (struct super_block *); | 891 | extern unsigned long ext3_count_free_inodes (struct super_block *); |
diff --git a/include/linux/fcntl.h b/include/linux/fcntl.h index a562fa5fb4e3..f550f894ba15 100644 --- a/include/linux/fcntl.h +++ b/include/linux/fcntl.h | |||
| @@ -46,6 +46,7 @@ | |||
| 46 | unlinking file. */ | 46 | unlinking file. */ |
| 47 | #define AT_SYMLINK_FOLLOW 0x400 /* Follow symbolic links. */ | 47 | #define AT_SYMLINK_FOLLOW 0x400 /* Follow symbolic links. */ |
| 48 | #define AT_NO_AUTOMOUNT 0x800 /* Suppress terminal automount traversal */ | 48 | #define AT_NO_AUTOMOUNT 0x800 /* Suppress terminal automount traversal */ |
| 49 | #define AT_EMPTY_PATH 0x1000 /* Allow empty relative pathname */ | ||
| 49 | 50 | ||
| 50 | #ifdef __KERNEL__ | 51 | #ifdef __KERNEL__ |
| 51 | 52 | ||
diff --git a/include/linux/file.h b/include/linux/file.h index e85baebf6279..21a79958541c 100644 --- a/include/linux/file.h +++ b/include/linux/file.h | |||
| @@ -29,6 +29,8 @@ static inline void fput_light(struct file *file, int fput_needed) | |||
| 29 | 29 | ||
| 30 | extern struct file *fget(unsigned int fd); | 30 | extern struct file *fget(unsigned int fd); |
| 31 | extern struct file *fget_light(unsigned int fd, int *fput_needed); | 31 | extern struct file *fget_light(unsigned int fd, int *fput_needed); |
| 32 | extern struct file *fget_raw(unsigned int fd); | ||
| 33 | extern struct file *fget_raw_light(unsigned int fd, int *fput_needed); | ||
| 32 | extern void set_close_on_exec(unsigned int fd, int flag); | 34 | extern void set_close_on_exec(unsigned int fd, int flag); |
| 33 | extern void put_filp(struct file *); | 35 | extern void put_filp(struct file *); |
| 34 | extern int alloc_fd(unsigned start, unsigned flags); | 36 | extern int alloc_fd(unsigned start, unsigned flags); |
diff --git a/include/linux/firmware.h b/include/linux/firmware.h index 53d1e6c4f848..21b3e7588abd 100644 --- a/include/linux/firmware.h +++ b/include/linux/firmware.h | |||
| @@ -39,7 +39,7 @@ struct builtin_fw { | |||
| 39 | int request_firmware(const struct firmware **fw, const char *name, | 39 | int request_firmware(const struct firmware **fw, const char *name, |
| 40 | struct device *device); | 40 | struct device *device); |
| 41 | int request_firmware_nowait( | 41 | int request_firmware_nowait( |
| 42 | struct module *module, int uevent, | 42 | struct module *module, bool uevent, |
| 43 | const char *name, struct device *device, gfp_t gfp, void *context, | 43 | const char *name, struct device *device, gfp_t gfp, void *context, |
| 44 | void (*cont)(const struct firmware *fw, void *context)); | 44 | void (*cont)(const struct firmware *fw, void *context)); |
| 45 | 45 | ||
| @@ -52,7 +52,7 @@ static inline int request_firmware(const struct firmware **fw, | |||
| 52 | return -EINVAL; | 52 | return -EINVAL; |
| 53 | } | 53 | } |
| 54 | static inline int request_firmware_nowait( | 54 | static inline int request_firmware_nowait( |
| 55 | struct module *module, int uevent, | 55 | struct module *module, bool uevent, |
| 56 | const char *name, struct device *device, gfp_t gfp, void *context, | 56 | const char *name, struct device *device, gfp_t gfp, void *context, |
| 57 | void (*cont)(const struct firmware *fw, void *context)) | 57 | void (*cont)(const struct firmware *fw, void *context)) |
| 58 | { | 58 | { |
diff --git a/include/linux/freezer.h b/include/linux/freezer.h index da7e52b099f3..1effc8b56b4e 100644 --- a/include/linux/freezer.h +++ b/include/linux/freezer.h | |||
| @@ -109,7 +109,7 @@ static inline void freezer_count(void) | |||
| 109 | } | 109 | } |
| 110 | 110 | ||
| 111 | /* | 111 | /* |
| 112 | * Check if the task should be counted as freezeable by the freezer | 112 | * Check if the task should be counted as freezable by the freezer |
| 113 | */ | 113 | */ |
| 114 | static inline int freezer_should_skip(struct task_struct *p) | 114 | static inline int freezer_should_skip(struct task_struct *p) |
| 115 | { | 115 | { |
diff --git a/include/linux/fs.h b/include/linux/fs.h index bd3215940c37..92f7e04aea11 100644 --- a/include/linux/fs.h +++ b/include/linux/fs.h | |||
| @@ -102,6 +102,9 @@ struct inodes_stat_t { | |||
| 102 | /* File is huge (eg. /dev/kmem): treat loff_t as unsigned */ | 102 | /* File is huge (eg. /dev/kmem): treat loff_t as unsigned */ |
| 103 | #define FMODE_UNSIGNED_OFFSET ((__force fmode_t)0x2000) | 103 | #define FMODE_UNSIGNED_OFFSET ((__force fmode_t)0x2000) |
| 104 | 104 | ||
| 105 | /* File is opened with O_PATH; almost nothing can be done with it */ | ||
| 106 | #define FMODE_PATH ((__force fmode_t)0x4000) | ||
| 107 | |||
| 105 | /* File was opened by fanotify and shouldn't generate fanotify events */ | 108 | /* File was opened by fanotify and shouldn't generate fanotify events */ |
| 106 | #define FMODE_NONOTIFY ((__force fmode_t)0x1000000) | 109 | #define FMODE_NONOTIFY ((__force fmode_t)0x1000000) |
| 107 | 110 | ||
| @@ -649,6 +652,7 @@ struct address_space { | |||
| 649 | spinlock_t private_lock; /* for use by the address_space */ | 652 | spinlock_t private_lock; /* for use by the address_space */ |
| 650 | struct list_head private_list; /* ditto */ | 653 | struct list_head private_list; /* ditto */ |
| 651 | struct address_space *assoc_mapping; /* ditto */ | 654 | struct address_space *assoc_mapping; /* ditto */ |
| 655 | struct mutex unmap_mutex; /* to protect unmapping */ | ||
| 652 | } __attribute__((aligned(sizeof(long)))); | 656 | } __attribute__((aligned(sizeof(long)))); |
| 653 | /* | 657 | /* |
| 654 | * On most architectures that alignment is already the case; but | 658 | * On most architectures that alignment is already the case; but |
| @@ -797,8 +801,7 @@ struct inode { | |||
| 797 | #endif | 801 | #endif |
| 798 | 802 | ||
| 799 | #ifdef CONFIG_IMA | 803 | #ifdef CONFIG_IMA |
| 800 | /* protected by i_lock */ | 804 | atomic_t i_readcount; /* struct files open RO */ |
| 801 | unsigned int i_readcount; /* struct files open RO */ | ||
| 802 | #endif | 805 | #endif |
| 803 | atomic_t i_writecount; | 806 | atomic_t i_writecount; |
| 804 | #ifdef CONFIG_SECURITY | 807 | #ifdef CONFIG_SECURITY |
| @@ -977,6 +980,13 @@ struct file { | |||
| 977 | #endif | 980 | #endif |
| 978 | }; | 981 | }; |
| 979 | 982 | ||
| 983 | struct file_handle { | ||
| 984 | __u32 handle_bytes; | ||
| 985 | int handle_type; | ||
| 986 | /* file identifier */ | ||
| 987 | unsigned char f_handle[0]; | ||
| 988 | }; | ||
| 989 | |||
| 980 | #define get_file(x) atomic_long_inc(&(x)->f_count) | 990 | #define get_file(x) atomic_long_inc(&(x)->f_count) |
| 981 | #define fput_atomic(x) atomic_long_add_unless(&(x)->f_count, -1, 1) | 991 | #define fput_atomic(x) atomic_long_add_unless(&(x)->f_count, -1, 1) |
| 982 | #define file_count(x) atomic_long_read(&(x)->f_count) | 992 | #define file_count(x) atomic_long_read(&(x)->f_count) |
| @@ -1400,6 +1410,7 @@ struct super_block { | |||
| 1400 | wait_queue_head_t s_wait_unfrozen; | 1410 | wait_queue_head_t s_wait_unfrozen; |
| 1401 | 1411 | ||
| 1402 | char s_id[32]; /* Informational name */ | 1412 | char s_id[32]; /* Informational name */ |
| 1413 | u8 s_uuid[16]; /* UUID */ | ||
| 1403 | 1414 | ||
| 1404 | void *s_fs_info; /* Filesystem private info */ | 1415 | void *s_fs_info; /* Filesystem private info */ |
| 1405 | fmode_t s_mode; | 1416 | fmode_t s_mode; |
| @@ -1620,6 +1631,8 @@ struct super_operations { | |||
| 1620 | void (*umount_begin) (struct super_block *); | 1631 | void (*umount_begin) (struct super_block *); |
| 1621 | 1632 | ||
| 1622 | int (*show_options)(struct seq_file *, struct vfsmount *); | 1633 | int (*show_options)(struct seq_file *, struct vfsmount *); |
| 1634 | int (*show_devname)(struct seq_file *, struct vfsmount *); | ||
| 1635 | int (*show_path)(struct seq_file *, struct vfsmount *); | ||
| 1623 | int (*show_stats)(struct seq_file *, struct vfsmount *); | 1636 | int (*show_stats)(struct seq_file *, struct vfsmount *); |
| 1624 | #ifdef CONFIG_QUOTA | 1637 | #ifdef CONFIG_QUOTA |
| 1625 | ssize_t (*quota_read)(struct super_block *, int, char *, size_t, loff_t); | 1638 | ssize_t (*quota_read)(struct super_block *, int, char *, size_t, loff_t); |
| @@ -1783,8 +1796,6 @@ int sync_inode_metadata(struct inode *inode, int wait); | |||
| 1783 | struct file_system_type { | 1796 | struct file_system_type { |
| 1784 | const char *name; | 1797 | const char *name; |
| 1785 | int fs_flags; | 1798 | int fs_flags; |
| 1786 | int (*get_sb) (struct file_system_type *, int, | ||
| 1787 | const char *, void *, struct vfsmount *); | ||
| 1788 | struct dentry *(*mount) (struct file_system_type *, int, | 1799 | struct dentry *(*mount) (struct file_system_type *, int, |
| 1789 | const char *, void *); | 1800 | const char *, void *); |
| 1790 | void (*kill_sb) (struct super_block *); | 1801 | void (*kill_sb) (struct super_block *); |
| @@ -1807,24 +1818,12 @@ extern struct dentry *mount_ns(struct file_system_type *fs_type, int flags, | |||
| 1807 | extern struct dentry *mount_bdev(struct file_system_type *fs_type, | 1818 | extern struct dentry *mount_bdev(struct file_system_type *fs_type, |
| 1808 | int flags, const char *dev_name, void *data, | 1819 | int flags, const char *dev_name, void *data, |
| 1809 | int (*fill_super)(struct super_block *, void *, int)); | 1820 | int (*fill_super)(struct super_block *, void *, int)); |
| 1810 | extern int get_sb_bdev(struct file_system_type *fs_type, | ||
| 1811 | int flags, const char *dev_name, void *data, | ||
| 1812 | int (*fill_super)(struct super_block *, void *, int), | ||
| 1813 | struct vfsmount *mnt); | ||
| 1814 | extern struct dentry *mount_single(struct file_system_type *fs_type, | 1821 | extern struct dentry *mount_single(struct file_system_type *fs_type, |
| 1815 | int flags, void *data, | 1822 | int flags, void *data, |
| 1816 | int (*fill_super)(struct super_block *, void *, int)); | 1823 | int (*fill_super)(struct super_block *, void *, int)); |
| 1817 | extern int get_sb_single(struct file_system_type *fs_type, | ||
| 1818 | int flags, void *data, | ||
| 1819 | int (*fill_super)(struct super_block *, void *, int), | ||
| 1820 | struct vfsmount *mnt); | ||
| 1821 | extern struct dentry *mount_nodev(struct file_system_type *fs_type, | 1824 | extern struct dentry *mount_nodev(struct file_system_type *fs_type, |
| 1822 | int flags, void *data, | 1825 | int flags, void *data, |
| 1823 | int (*fill_super)(struct super_block *, void *, int)); | 1826 | int (*fill_super)(struct super_block *, void *, int)); |
| 1824 | extern int get_sb_nodev(struct file_system_type *fs_type, | ||
| 1825 | int flags, void *data, | ||
| 1826 | int (*fill_super)(struct super_block *, void *, int), | ||
| 1827 | struct vfsmount *mnt); | ||
| 1828 | void generic_shutdown_super(struct super_block *sb); | 1827 | void generic_shutdown_super(struct super_block *sb); |
| 1829 | void kill_block_super(struct super_block *sb); | 1828 | void kill_block_super(struct super_block *sb); |
| 1830 | void kill_anon_super(struct super_block *sb); | 1829 | void kill_anon_super(struct super_block *sb); |
| @@ -1873,6 +1872,8 @@ extern void drop_collected_mounts(struct vfsmount *); | |||
| 1873 | extern int iterate_mounts(int (*)(struct vfsmount *, void *), void *, | 1872 | extern int iterate_mounts(int (*)(struct vfsmount *, void *), void *, |
| 1874 | struct vfsmount *); | 1873 | struct vfsmount *); |
| 1875 | extern int vfs_statfs(struct path *, struct kstatfs *); | 1874 | extern int vfs_statfs(struct path *, struct kstatfs *); |
| 1875 | extern int user_statfs(const char __user *, struct kstatfs *); | ||
| 1876 | extern int fd_statfs(int, struct kstatfs *); | ||
| 1876 | extern int statfs_by_dentry(struct dentry *, struct kstatfs *); | 1877 | extern int statfs_by_dentry(struct dentry *, struct kstatfs *); |
| 1877 | extern int freeze_super(struct super_block *super); | 1878 | extern int freeze_super(struct super_block *super); |
| 1878 | extern int thaw_super(struct super_block *super); | 1879 | extern int thaw_super(struct super_block *super); |
| @@ -1989,6 +1990,8 @@ extern int do_fallocate(struct file *file, int mode, loff_t offset, | |||
| 1989 | extern long do_sys_open(int dfd, const char __user *filename, int flags, | 1990 | extern long do_sys_open(int dfd, const char __user *filename, int flags, |
| 1990 | int mode); | 1991 | int mode); |
| 1991 | extern struct file *filp_open(const char *, int, int); | 1992 | extern struct file *filp_open(const char *, int, int); |
| 1993 | extern struct file *file_open_root(struct dentry *, struct vfsmount *, | ||
| 1994 | const char *, int); | ||
| 1992 | extern struct file * dentry_open(struct dentry *, struct vfsmount *, int, | 1995 | extern struct file * dentry_open(struct dentry *, struct vfsmount *, int, |
| 1993 | const struct cred *); | 1996 | const struct cred *); |
| 1994 | extern int filp_close(struct file *, fl_owner_t id); | 1997 | extern int filp_close(struct file *, fl_owner_t id); |
| @@ -2139,7 +2142,7 @@ extern void check_disk_size_change(struct gendisk *disk, | |||
| 2139 | struct block_device *bdev); | 2142 | struct block_device *bdev); |
| 2140 | extern int revalidate_disk(struct gendisk *); | 2143 | extern int revalidate_disk(struct gendisk *); |
| 2141 | extern int check_disk_change(struct block_device *); | 2144 | extern int check_disk_change(struct block_device *); |
| 2142 | extern int __invalidate_device(struct block_device *); | 2145 | extern int __invalidate_device(struct block_device *, bool); |
| 2143 | extern int invalidate_partition(struct gendisk *, int); | 2146 | extern int invalidate_partition(struct gendisk *, int); |
| 2144 | #endif | 2147 | #endif |
| 2145 | unsigned long invalidate_mapping_pages(struct address_space *mapping, | 2148 | unsigned long invalidate_mapping_pages(struct address_space *mapping, |
| @@ -2199,15 +2202,31 @@ static inline void allow_write_access(struct file *file) | |||
| 2199 | if (file) | 2202 | if (file) |
| 2200 | atomic_inc(&file->f_path.dentry->d_inode->i_writecount); | 2203 | atomic_inc(&file->f_path.dentry->d_inode->i_writecount); |
| 2201 | } | 2204 | } |
| 2205 | #ifdef CONFIG_IMA | ||
| 2206 | static inline void i_readcount_dec(struct inode *inode) | ||
| 2207 | { | ||
| 2208 | BUG_ON(!atomic_read(&inode->i_readcount)); | ||
| 2209 | atomic_dec(&inode->i_readcount); | ||
| 2210 | } | ||
| 2211 | static inline void i_readcount_inc(struct inode *inode) | ||
| 2212 | { | ||
| 2213 | atomic_inc(&inode->i_readcount); | ||
| 2214 | } | ||
| 2215 | #else | ||
| 2216 | static inline void i_readcount_dec(struct inode *inode) | ||
| 2217 | { | ||
| 2218 | return; | ||
| 2219 | } | ||
| 2220 | static inline void i_readcount_inc(struct inode *inode) | ||
| 2221 | { | ||
| 2222 | return; | ||
| 2223 | } | ||
| 2224 | #endif | ||
| 2202 | extern int do_pipe_flags(int *, int); | 2225 | extern int do_pipe_flags(int *, int); |
| 2203 | extern struct file *create_read_pipe(struct file *f, int flags); | 2226 | extern struct file *create_read_pipe(struct file *f, int flags); |
| 2204 | extern struct file *create_write_pipe(int flags); | 2227 | extern struct file *create_write_pipe(int flags); |
| 2205 | extern void free_write_pipe(struct file *); | 2228 | extern void free_write_pipe(struct file *); |
| 2206 | 2229 | ||
| 2207 | extern struct file *do_filp_open(int dfd, const char *pathname, | ||
| 2208 | int open_flag, int mode, int acc_mode); | ||
| 2209 | extern int may_open(struct path *, int, int); | ||
| 2210 | |||
| 2211 | extern int kernel_read(struct file *, loff_t, char *, unsigned long); | 2230 | extern int kernel_read(struct file *, loff_t, char *, unsigned long); |
| 2212 | extern struct file * open_exec(const char *); | 2231 | extern struct file * open_exec(const char *); |
| 2213 | 2232 | ||
| @@ -2225,6 +2244,7 @@ extern loff_t vfs_llseek(struct file *file, loff_t offset, int origin); | |||
| 2225 | 2244 | ||
| 2226 | extern int inode_init_always(struct super_block *, struct inode *); | 2245 | extern int inode_init_always(struct super_block *, struct inode *); |
| 2227 | extern void inode_init_once(struct inode *); | 2246 | extern void inode_init_once(struct inode *); |
| 2247 | extern void address_space_init_once(struct address_space *mapping); | ||
| 2228 | extern void ihold(struct inode * inode); | 2248 | extern void ihold(struct inode * inode); |
| 2229 | extern void iput(struct inode *); | 2249 | extern void iput(struct inode *); |
| 2230 | extern struct inode * igrab(struct inode *); | 2250 | extern struct inode * igrab(struct inode *); |
diff --git a/include/linux/ftrace.h b/include/linux/ftrace.h index dcd6a7c3a435..ca29e03c1fac 100644 --- a/include/linux/ftrace.h +++ b/include/linux/ftrace.h | |||
| @@ -428,6 +428,7 @@ extern void unregister_ftrace_graph(void); | |||
| 428 | 428 | ||
| 429 | extern void ftrace_graph_init_task(struct task_struct *t); | 429 | extern void ftrace_graph_init_task(struct task_struct *t); |
| 430 | extern void ftrace_graph_exit_task(struct task_struct *t); | 430 | extern void ftrace_graph_exit_task(struct task_struct *t); |
| 431 | extern void ftrace_graph_init_idle_task(struct task_struct *t, int cpu); | ||
| 431 | 432 | ||
| 432 | static inline int task_curr_ret_stack(struct task_struct *t) | 433 | static inline int task_curr_ret_stack(struct task_struct *t) |
| 433 | { | 434 | { |
| @@ -451,6 +452,7 @@ static inline void unpause_graph_tracing(void) | |||
| 451 | 452 | ||
| 452 | static inline void ftrace_graph_init_task(struct task_struct *t) { } | 453 | static inline void ftrace_graph_init_task(struct task_struct *t) { } |
| 453 | static inline void ftrace_graph_exit_task(struct task_struct *t) { } | 454 | static inline void ftrace_graph_exit_task(struct task_struct *t) { } |
| 455 | static inline void ftrace_graph_init_idle_task(struct task_struct *t, int cpu) { } | ||
| 454 | 456 | ||
| 455 | static inline int register_ftrace_graph(trace_func_graph_ret_t retfunc, | 457 | static inline int register_ftrace_graph(trace_func_graph_ret_t retfunc, |
| 456 | trace_func_graph_ent_t entryfunc) | 458 | trace_func_graph_ent_t entryfunc) |
diff --git a/include/linux/ftrace_event.h b/include/linux/ftrace_event.h index 47e3997f7b5c..22b32af1b5ec 100644 --- a/include/linux/ftrace_event.h +++ b/include/linux/ftrace_event.h | |||
| @@ -37,7 +37,6 @@ struct trace_entry { | |||
| 37 | unsigned char flags; | 37 | unsigned char flags; |
| 38 | unsigned char preempt_count; | 38 | unsigned char preempt_count; |
| 39 | int pid; | 39 | int pid; |
| 40 | int lock_depth; | ||
| 41 | }; | 40 | }; |
| 42 | 41 | ||
| 43 | #define FTRACE_MAX_EVENT \ | 42 | #define FTRACE_MAX_EVENT \ |
| @@ -208,7 +207,6 @@ struct ftrace_event_call { | |||
| 208 | 207 | ||
| 209 | #define PERF_MAX_TRACE_SIZE 2048 | 208 | #define PERF_MAX_TRACE_SIZE 2048 |
| 210 | 209 | ||
| 211 | #define MAX_FILTER_PRED 32 | ||
| 212 | #define MAX_FILTER_STR_VAL 256 /* Should handle KSYM_SYMBOL_LEN */ | 210 | #define MAX_FILTER_STR_VAL 256 /* Should handle KSYM_SYMBOL_LEN */ |
| 213 | 211 | ||
| 214 | extern void destroy_preds(struct ftrace_event_call *call); | 212 | extern void destroy_preds(struct ftrace_event_call *call); |
diff --git a/include/linux/gfp.h b/include/linux/gfp.h index 0b84c61607e8..dca31761b311 100644 --- a/include/linux/gfp.h +++ b/include/linux/gfp.h | |||
| @@ -332,16 +332,19 @@ alloc_pages(gfp_t gfp_mask, unsigned int order) | |||
| 332 | return alloc_pages_current(gfp_mask, order); | 332 | return alloc_pages_current(gfp_mask, order); |
| 333 | } | 333 | } |
| 334 | extern struct page *alloc_pages_vma(gfp_t gfp_mask, int order, | 334 | extern struct page *alloc_pages_vma(gfp_t gfp_mask, int order, |
| 335 | struct vm_area_struct *vma, unsigned long addr); | 335 | struct vm_area_struct *vma, unsigned long addr, |
| 336 | int node); | ||
| 336 | #else | 337 | #else |
| 337 | #define alloc_pages(gfp_mask, order) \ | 338 | #define alloc_pages(gfp_mask, order) \ |
| 338 | alloc_pages_node(numa_node_id(), gfp_mask, order) | 339 | alloc_pages_node(numa_node_id(), gfp_mask, order) |
| 339 | #define alloc_pages_vma(gfp_mask, order, vma, addr) \ | 340 | #define alloc_pages_vma(gfp_mask, order, vma, addr, node) \ |
| 340 | alloc_pages(gfp_mask, order) | 341 | alloc_pages(gfp_mask, order) |
| 341 | #endif | 342 | #endif |
| 342 | #define alloc_page(gfp_mask) alloc_pages(gfp_mask, 0) | 343 | #define alloc_page(gfp_mask) alloc_pages(gfp_mask, 0) |
| 343 | #define alloc_page_vma(gfp_mask, vma, addr) \ | 344 | #define alloc_page_vma(gfp_mask, vma, addr) \ |
| 344 | alloc_pages_vma(gfp_mask, 0, vma, addr) | 345 | alloc_pages_vma(gfp_mask, 0, vma, addr, numa_node_id()) |
| 346 | #define alloc_page_vma_node(gfp_mask, vma, addr, node) \ | ||
| 347 | alloc_pages_vma(gfp_mask, 0, vma, addr, node) | ||
| 345 | 348 | ||
| 346 | extern unsigned long __get_free_pages(gfp_t gfp_mask, unsigned int order); | 349 | extern unsigned long __get_free_pages(gfp_t gfp_mask, unsigned int order); |
| 347 | extern unsigned long get_zeroed_page(gfp_t gfp_mask); | 350 | extern unsigned long get_zeroed_page(gfp_t gfp_mask); |
diff --git a/include/linux/hardirq.h b/include/linux/hardirq.h index 32f9fd6619b4..ba362171e8ae 100644 --- a/include/linux/hardirq.h +++ b/include/linux/hardirq.h | |||
| @@ -93,13 +93,6 @@ | |||
| 93 | */ | 93 | */ |
| 94 | #define in_nmi() (preempt_count() & NMI_MASK) | 94 | #define in_nmi() (preempt_count() & NMI_MASK) |
| 95 | 95 | ||
| 96 | #if defined(CONFIG_PREEMPT) && defined(CONFIG_BKL) | ||
| 97 | # include <linux/sched.h> | ||
| 98 | # define PREEMPT_INATOMIC_BASE (current->lock_depth >= 0) | ||
| 99 | #else | ||
| 100 | # define PREEMPT_INATOMIC_BASE 0 | ||
| 101 | #endif | ||
| 102 | |||
| 103 | #if defined(CONFIG_PREEMPT) | 96 | #if defined(CONFIG_PREEMPT) |
| 104 | # define PREEMPT_CHECK_OFFSET 1 | 97 | # define PREEMPT_CHECK_OFFSET 1 |
| 105 | #else | 98 | #else |
| @@ -113,7 +106,7 @@ | |||
| 113 | * used in the general case to determine whether sleeping is possible. | 106 | * used in the general case to determine whether sleeping is possible. |
| 114 | * Do not use in_atomic() in driver code. | 107 | * Do not use in_atomic() in driver code. |
| 115 | */ | 108 | */ |
| 116 | #define in_atomic() ((preempt_count() & ~PREEMPT_ACTIVE) != PREEMPT_INATOMIC_BASE) | 109 | #define in_atomic() ((preempt_count() & ~PREEMPT_ACTIVE) != 0) |
| 117 | 110 | ||
| 118 | /* | 111 | /* |
| 119 | * Check whether we were atomic before we did preempt_disable(): | 112 | * Check whether we were atomic before we did preempt_disable(): |
diff --git a/include/linux/hrtimer.h b/include/linux/hrtimer.h index f376ddc64c4d..62f500c724f9 100644 --- a/include/linux/hrtimer.h +++ b/include/linux/hrtimer.h | |||
| @@ -54,11 +54,13 @@ enum hrtimer_restart { | |||
| 54 | * 0x00 inactive | 54 | * 0x00 inactive |
| 55 | * 0x01 enqueued into rbtree | 55 | * 0x01 enqueued into rbtree |
| 56 | * 0x02 callback function running | 56 | * 0x02 callback function running |
| 57 | * 0x04 timer is migrated to another cpu | ||
| 57 | * | 58 | * |
| 58 | * Special cases: | 59 | * Special cases: |
| 59 | * 0x03 callback function running and enqueued | 60 | * 0x03 callback function running and enqueued |
| 60 | * (was requeued on another CPU) | 61 | * (was requeued on another CPU) |
| 61 | * 0x09 timer was migrated on CPU hotunplug | 62 | * 0x05 timer was migrated on CPU hotunplug |
| 63 | * | ||
| 62 | * The "callback function running and enqueued" status is only possible on | 64 | * The "callback function running and enqueued" status is only possible on |
| 63 | * SMP. It happens for example when a posix timer expired and the callback | 65 | * SMP. It happens for example when a posix timer expired and the callback |
| 64 | * queued a signal. Between dropping the lock which protects the posix timer | 66 | * queued a signal. Between dropping the lock which protects the posix timer |
| @@ -67,8 +69,11 @@ enum hrtimer_restart { | |||
| 67 | * as otherwise the timer could be removed before the softirq code finishes the | 69 | * as otherwise the timer could be removed before the softirq code finishes the |
| 68 | * the handling of the timer. | 70 | * the handling of the timer. |
| 69 | * | 71 | * |
| 70 | * The HRTIMER_STATE_ENQUEUED bit is always or'ed to the current state to | 72 | * The HRTIMER_STATE_ENQUEUED bit is always or'ed to the current state |
| 71 | * preserve the HRTIMER_STATE_CALLBACK bit in the above scenario. | 73 | * to preserve the HRTIMER_STATE_CALLBACK in the above scenario. This |
| 74 | * also affects HRTIMER_STATE_MIGRATE where the preservation is not | ||
| 75 | * necessary. HRTIMER_STATE_MIGRATE is cleared after the timer is | ||
| 76 | * enqueued on the new cpu. | ||
| 72 | * | 77 | * |
| 73 | * All state transitions are protected by cpu_base->lock. | 78 | * All state transitions are protected by cpu_base->lock. |
| 74 | */ | 79 | */ |
| @@ -148,7 +153,12 @@ struct hrtimer_clock_base { | |||
| 148 | #endif | 153 | #endif |
| 149 | }; | 154 | }; |
| 150 | 155 | ||
| 151 | #define HRTIMER_MAX_CLOCK_BASES 2 | 156 | enum hrtimer_base_type { |
| 157 | HRTIMER_BASE_REALTIME, | ||
| 158 | HRTIMER_BASE_MONOTONIC, | ||
| 159 | HRTIMER_BASE_BOOTTIME, | ||
| 160 | HRTIMER_MAX_CLOCK_BASES, | ||
| 161 | }; | ||
| 152 | 162 | ||
| 153 | /* | 163 | /* |
| 154 | * struct hrtimer_cpu_base - the per cpu clock bases | 164 | * struct hrtimer_cpu_base - the per cpu clock bases |
| @@ -308,6 +318,7 @@ static inline int hrtimer_is_hres_active(struct hrtimer *timer) | |||
| 308 | 318 | ||
| 309 | extern ktime_t ktime_get(void); | 319 | extern ktime_t ktime_get(void); |
| 310 | extern ktime_t ktime_get_real(void); | 320 | extern ktime_t ktime_get_real(void); |
| 321 | extern ktime_t ktime_get_boottime(void); | ||
| 311 | 322 | ||
| 312 | 323 | ||
| 313 | DECLARE_PER_CPU(struct tick_device, tick_cpu_device); | 324 | DECLARE_PER_CPU(struct tick_device, tick_cpu_device); |
| @@ -370,8 +381,9 @@ extern int hrtimer_get_res(const clockid_t which_clock, struct timespec *tp); | |||
| 370 | extern ktime_t hrtimer_get_next_event(void); | 381 | extern ktime_t hrtimer_get_next_event(void); |
| 371 | 382 | ||
| 372 | /* | 383 | /* |
| 373 | * A timer is active, when it is enqueued into the rbtree or the callback | 384 | * A timer is active, when it is enqueued into the rbtree or the |
| 374 | * function is running. | 385 | * callback function is running or it's in the state of being migrated |
| 386 | * to another cpu. | ||
| 375 | */ | 387 | */ |
| 376 | static inline int hrtimer_active(const struct hrtimer *timer) | 388 | static inline int hrtimer_active(const struct hrtimer *timer) |
| 377 | { | 389 | { |
diff --git a/include/linux/huge_mm.h b/include/linux/huge_mm.h index 8e6c8c42bc3c..df29c8fde36b 100644 --- a/include/linux/huge_mm.h +++ b/include/linux/huge_mm.h | |||
| @@ -57,7 +57,8 @@ extern pmd_t *page_check_address_pmd(struct page *page, | |||
| 57 | (transparent_hugepage_flags & \ | 57 | (transparent_hugepage_flags & \ |
| 58 | (1<<TRANSPARENT_HUGEPAGE_REQ_MADV_FLAG) && \ | 58 | (1<<TRANSPARENT_HUGEPAGE_REQ_MADV_FLAG) && \ |
| 59 | ((__vma)->vm_flags & VM_HUGEPAGE))) && \ | 59 | ((__vma)->vm_flags & VM_HUGEPAGE))) && \ |
| 60 | !((__vma)->vm_flags & VM_NOHUGEPAGE)) | 60 | !((__vma)->vm_flags & VM_NOHUGEPAGE) && \ |
| 61 | !is_vma_temporary_stack(__vma)) | ||
| 61 | #define transparent_hugepage_defrag(__vma) \ | 62 | #define transparent_hugepage_defrag(__vma) \ |
| 62 | ((transparent_hugepage_flags & \ | 63 | ((transparent_hugepage_flags & \ |
| 63 | (1<<TRANSPARENT_HUGEPAGE_DEFRAG_FLAG)) || \ | 64 | (1<<TRANSPARENT_HUGEPAGE_DEFRAG_FLAG)) || \ |
diff --git a/include/linux/i2c.h b/include/linux/i2c.h index 903576df88dc..06a8d9c7de98 100644 --- a/include/linux/i2c.h +++ b/include/linux/i2c.h | |||
| @@ -258,9 +258,7 @@ struct i2c_board_info { | |||
| 258 | unsigned short addr; | 258 | unsigned short addr; |
| 259 | void *platform_data; | 259 | void *platform_data; |
| 260 | struct dev_archdata *archdata; | 260 | struct dev_archdata *archdata; |
| 261 | #ifdef CONFIG_OF | ||
| 262 | struct device_node *of_node; | 261 | struct device_node *of_node; |
| 263 | #endif | ||
| 264 | int irq; | 262 | int irq; |
| 265 | }; | 263 | }; |
| 266 | 264 | ||
diff --git a/include/linux/i2c/twl.h b/include/linux/i2c/twl.h index 61b9609e55f2..a4bd05b7bd22 100644 --- a/include/linux/i2c/twl.h +++ b/include/linux/i2c/twl.h | |||
| @@ -600,6 +600,8 @@ struct twl4030_usb_data { | |||
| 600 | int (*phy_power)(struct device *dev, int iD, int on); | 600 | int (*phy_power)(struct device *dev, int iD, int on); |
| 601 | /* enable/disable phy clocks */ | 601 | /* enable/disable phy clocks */ |
| 602 | int (*phy_set_clock)(struct device *dev, int on); | 602 | int (*phy_set_clock)(struct device *dev, int on); |
| 603 | /* suspend/resume of phy */ | ||
| 604 | int (*phy_suspend)(struct device *dev, int suspend); | ||
| 603 | }; | 605 | }; |
| 604 | 606 | ||
| 605 | struct twl4030_ins { | 607 | struct twl4030_ins { |
diff --git a/include/linux/icmpv6.h b/include/linux/icmpv6.h index 4c4c74ec5987..ba45e6bc0764 100644 --- a/include/linux/icmpv6.h +++ b/include/linux/icmpv6.h | |||
| @@ -183,10 +183,10 @@ extern void icmpv6_cleanup(void); | |||
| 183 | extern void icmpv6_param_prob(struct sk_buff *skb, | 183 | extern void icmpv6_param_prob(struct sk_buff *skb, |
| 184 | u8 code, int pos); | 184 | u8 code, int pos); |
| 185 | 185 | ||
| 186 | struct flowi; | 186 | struct flowi6; |
| 187 | struct in6_addr; | 187 | struct in6_addr; |
| 188 | extern void icmpv6_flow_init(struct sock *sk, | 188 | extern void icmpv6_flow_init(struct sock *sk, |
| 189 | struct flowi *fl, | 189 | struct flowi6 *fl6, |
| 190 | u8 type, | 190 | u8 type, |
| 191 | const struct in6_addr *saddr, | 191 | const struct in6_addr *saddr, |
| 192 | const struct in6_addr *daddr, | 192 | const struct in6_addr *daddr, |
diff --git a/include/linux/ieee80211.h b/include/linux/ieee80211.h index 294169e31364..2d1c6117d92c 100644 --- a/include/linux/ieee80211.h +++ b/include/linux/ieee80211.h | |||
| @@ -1325,6 +1325,9 @@ enum { | |||
| 1325 | /* Although the spec says 8 I'm seeing 6 in practice */ | 1325 | /* Although the spec says 8 I'm seeing 6 in practice */ |
| 1326 | #define IEEE80211_COUNTRY_IE_MIN_LEN 6 | 1326 | #define IEEE80211_COUNTRY_IE_MIN_LEN 6 |
| 1327 | 1327 | ||
| 1328 | /* The Country String field of the element shall be 3 octets in length */ | ||
| 1329 | #define IEEE80211_COUNTRY_STRING_LEN 3 | ||
| 1330 | |||
| 1328 | /* | 1331 | /* |
| 1329 | * For regulatory extension stuff see IEEE 802.11-2007 | 1332 | * For regulatory extension stuff see IEEE 802.11-2007 |
| 1330 | * Annex I (page 1141) and Annex J (page 1147). Also | 1333 | * Annex I (page 1141) and Annex J (page 1147). Also |
diff --git a/include/linux/if.h b/include/linux/if.h index 123959927745..3bc63e6a02f7 100644 --- a/include/linux/if.h +++ b/include/linux/if.h | |||
| @@ -71,11 +71,10 @@ | |||
| 71 | * release skb->dst | 71 | * release skb->dst |
| 72 | */ | 72 | */ |
| 73 | #define IFF_DONT_BRIDGE 0x800 /* disallow bridging this ether dev */ | 73 | #define IFF_DONT_BRIDGE 0x800 /* disallow bridging this ether dev */ |
| 74 | #define IFF_IN_NETPOLL 0x1000 /* whether we are processing netpoll */ | 74 | #define IFF_DISABLE_NETPOLL 0x1000 /* disable netpoll at run-time */ |
| 75 | #define IFF_DISABLE_NETPOLL 0x2000 /* disable netpoll at run-time */ | 75 | #define IFF_MACVLAN_PORT 0x2000 /* device used as macvlan port */ |
| 76 | #define IFF_MACVLAN_PORT 0x4000 /* device used as macvlan port */ | 76 | #define IFF_BRIDGE_PORT 0x4000 /* device used as bridge port */ |
| 77 | #define IFF_BRIDGE_PORT 0x8000 /* device used as bridge port */ | 77 | #define IFF_OVS_DATAPATH 0x8000 /* device used as Open vSwitch |
| 78 | #define IFF_OVS_DATAPATH 0x10000 /* device used as Open vSwitch | ||
| 79 | * datapath port */ | 78 | * datapath port */ |
| 80 | 79 | ||
| 81 | #define IF_GET_IFACE 0x0001 /* for querying only */ | 80 | #define IF_GET_IFACE 0x0001 /* for querying only */ |
diff --git a/include/linux/if_link.h b/include/linux/if_link.h index 6485d2a89bec..f4a2e6b1b864 100644 --- a/include/linux/if_link.h +++ b/include/linux/if_link.h | |||
| @@ -135,6 +135,7 @@ enum { | |||
| 135 | IFLA_VF_PORTS, | 135 | IFLA_VF_PORTS, |
| 136 | IFLA_PORT_SELF, | 136 | IFLA_PORT_SELF, |
| 137 | IFLA_AF_SPEC, | 137 | IFLA_AF_SPEC, |
| 138 | IFLA_GROUP, /* Group the device belongs to */ | ||
| 138 | __IFLA_MAX | 139 | __IFLA_MAX |
| 139 | }; | 140 | }; |
| 140 | 141 | ||
diff --git a/include/linux/igmp.h b/include/linux/igmp.h index 74cfcff0148b..82de336b8155 100644 --- a/include/linux/igmp.h +++ b/include/linux/igmp.h | |||
| @@ -217,7 +217,7 @@ struct ip_mc_list { | |||
| 217 | #define IGMPV3_QQIC(value) IGMPV3_EXP(0x80, 4, 3, value) | 217 | #define IGMPV3_QQIC(value) IGMPV3_EXP(0x80, 4, 3, value) |
| 218 | #define IGMPV3_MRC(value) IGMPV3_EXP(0x80, 4, 3, value) | 218 | #define IGMPV3_MRC(value) IGMPV3_EXP(0x80, 4, 3, value) |
| 219 | 219 | ||
| 220 | extern int ip_check_mc(struct in_device *dev, __be32 mc_addr, __be32 src_addr, u16 proto); | 220 | extern int ip_check_mc_rcu(struct in_device *dev, __be32 mc_addr, __be32 src_addr, u16 proto); |
| 221 | extern int igmp_rcv(struct sk_buff *); | 221 | extern int igmp_rcv(struct sk_buff *); |
| 222 | extern int ip_mc_join_group(struct sock *sk, struct ip_mreqn *imr); | 222 | extern int ip_mc_join_group(struct sock *sk, struct ip_mreqn *imr); |
| 223 | extern int ip_mc_leave_group(struct sock *sk, struct ip_mreqn *imr); | 223 | extern int ip_mc_leave_group(struct sock *sk, struct ip_mreqn *imr); |
diff --git a/include/linux/ima.h b/include/linux/ima.h index 975837e7d6c0..09e6e62f9953 100644 --- a/include/linux/ima.h +++ b/include/linux/ima.h | |||
| @@ -20,7 +20,6 @@ extern void ima_inode_free(struct inode *inode); | |||
| 20 | extern int ima_file_check(struct file *file, int mask); | 20 | extern int ima_file_check(struct file *file, int mask); |
| 21 | extern void ima_file_free(struct file *file); | 21 | extern void ima_file_free(struct file *file); |
| 22 | extern int ima_file_mmap(struct file *file, unsigned long prot); | 22 | extern int ima_file_mmap(struct file *file, unsigned long prot); |
| 23 | extern void ima_counts_get(struct file *file); | ||
| 24 | 23 | ||
| 25 | #else | 24 | #else |
| 26 | static inline int ima_bprm_check(struct linux_binprm *bprm) | 25 | static inline int ima_bprm_check(struct linux_binprm *bprm) |
| @@ -53,10 +52,5 @@ static inline int ima_file_mmap(struct file *file, unsigned long prot) | |||
| 53 | return 0; | 52 | return 0; |
| 54 | } | 53 | } |
| 55 | 54 | ||
| 56 | static inline void ima_counts_get(struct file *file) | ||
| 57 | { | ||
| 58 | return; | ||
| 59 | } | ||
| 60 | |||
| 61 | #endif /* CONFIG_IMA_H */ | 55 | #endif /* CONFIG_IMA_H */ |
| 62 | #endif /* _LINUX_IMA_H */ | 56 | #endif /* _LINUX_IMA_H */ |
diff --git a/include/linux/inetdevice.h b/include/linux/inetdevice.h index ae8fdc54e0c0..5f8146695b7f 100644 --- a/include/linux/inetdevice.h +++ b/include/linux/inetdevice.h | |||
| @@ -144,6 +144,7 @@ static inline void ipv4_devconf_setall(struct in_device *in_dev) | |||
| 144 | #define IN_DEV_ARP_NOTIFY(in_dev) IN_DEV_MAXCONF((in_dev), ARP_NOTIFY) | 144 | #define IN_DEV_ARP_NOTIFY(in_dev) IN_DEV_MAXCONF((in_dev), ARP_NOTIFY) |
| 145 | 145 | ||
| 146 | struct in_ifaddr { | 146 | struct in_ifaddr { |
| 147 | struct hlist_node hash; | ||
| 147 | struct in_ifaddr *ifa_next; | 148 | struct in_ifaddr *ifa_next; |
| 148 | struct in_device *ifa_dev; | 149 | struct in_device *ifa_dev; |
| 149 | struct rcu_head rcu_head; | 150 | struct rcu_head rcu_head; |
diff --git a/include/linux/input/matrix_keypad.h b/include/linux/input/matrix_keypad.h index 697474691749..fe7c4b9ae270 100644 --- a/include/linux/input/matrix_keypad.h +++ b/include/linux/input/matrix_keypad.h | |||
| @@ -4,8 +4,8 @@ | |||
| 4 | #include <linux/types.h> | 4 | #include <linux/types.h> |
| 5 | #include <linux/input.h> | 5 | #include <linux/input.h> |
| 6 | 6 | ||
| 7 | #define MATRIX_MAX_ROWS 16 | 7 | #define MATRIX_MAX_ROWS 32 |
| 8 | #define MATRIX_MAX_COLS 16 | 8 | #define MATRIX_MAX_COLS 32 |
| 9 | 9 | ||
| 10 | #define KEY(row, col, val) ((((row) & (MATRIX_MAX_ROWS - 1)) << 24) |\ | 10 | #define KEY(row, col, val) ((((row) & (MATRIX_MAX_ROWS - 1)) << 24) |\ |
| 11 | (((col) & (MATRIX_MAX_COLS - 1)) << 16) |\ | 11 | (((col) & (MATRIX_MAX_COLS - 1)) << 16) |\ |
diff --git a/include/linux/interrupt.h b/include/linux/interrupt.h index 55e0d4253e49..59b72ca1c5d1 100644 --- a/include/linux/interrupt.h +++ b/include/linux/interrupt.h | |||
| @@ -14,6 +14,8 @@ | |||
| 14 | #include <linux/smp.h> | 14 | #include <linux/smp.h> |
| 15 | #include <linux/percpu.h> | 15 | #include <linux/percpu.h> |
| 16 | #include <linux/hrtimer.h> | 16 | #include <linux/hrtimer.h> |
| 17 | #include <linux/kref.h> | ||
| 18 | #include <linux/workqueue.h> | ||
| 17 | 19 | ||
| 18 | #include <asm/atomic.h> | 20 | #include <asm/atomic.h> |
| 19 | #include <asm/ptrace.h> | 21 | #include <asm/ptrace.h> |
| @@ -55,7 +57,8 @@ | |||
| 55 | * Used by threaded interrupts which need to keep the | 57 | * Used by threaded interrupts which need to keep the |
| 56 | * irq line disabled until the threaded handler has been run. | 58 | * irq line disabled until the threaded handler has been run. |
| 57 | * IRQF_NO_SUSPEND - Do not disable this IRQ during suspend | 59 | * IRQF_NO_SUSPEND - Do not disable this IRQ during suspend |
| 58 | * | 60 | * IRQF_FORCE_RESUME - Force enable it on resume even if IRQF_NO_SUSPEND is set |
| 61 | * IRQF_NO_THREAD - Interrupt cannot be threaded | ||
| 59 | */ | 62 | */ |
| 60 | #define IRQF_DISABLED 0x00000020 | 63 | #define IRQF_DISABLED 0x00000020 |
| 61 | #define IRQF_SAMPLE_RANDOM 0x00000040 | 64 | #define IRQF_SAMPLE_RANDOM 0x00000040 |
| @@ -67,22 +70,10 @@ | |||
| 67 | #define IRQF_IRQPOLL 0x00001000 | 70 | #define IRQF_IRQPOLL 0x00001000 |
| 68 | #define IRQF_ONESHOT 0x00002000 | 71 | #define IRQF_ONESHOT 0x00002000 |
| 69 | #define IRQF_NO_SUSPEND 0x00004000 | 72 | #define IRQF_NO_SUSPEND 0x00004000 |
| 73 | #define IRQF_FORCE_RESUME 0x00008000 | ||
| 74 | #define IRQF_NO_THREAD 0x00010000 | ||
| 70 | 75 | ||
| 71 | #define IRQF_TIMER (__IRQF_TIMER | IRQF_NO_SUSPEND) | 76 | #define IRQF_TIMER (__IRQF_TIMER | IRQF_NO_SUSPEND | IRQF_NO_THREAD) |
| 72 | |||
| 73 | /* | ||
| 74 | * Bits used by threaded handlers: | ||
| 75 | * IRQTF_RUNTHREAD - signals that the interrupt handler thread should run | ||
| 76 | * IRQTF_DIED - handler thread died | ||
| 77 | * IRQTF_WARNED - warning "IRQ_WAKE_THREAD w/o thread_fn" has been printed | ||
| 78 | * IRQTF_AFFINITY - irq thread is requested to adjust affinity | ||
| 79 | */ | ||
| 80 | enum { | ||
| 81 | IRQTF_RUNTHREAD, | ||
| 82 | IRQTF_DIED, | ||
| 83 | IRQTF_WARNED, | ||
| 84 | IRQTF_AFFINITY, | ||
| 85 | }; | ||
| 86 | 77 | ||
| 87 | /* | 78 | /* |
| 88 | * These values can be returned by request_any_context_irq() and | 79 | * These values can be returned by request_any_context_irq() and |
| @@ -110,6 +101,7 @@ typedef irqreturn_t (*irq_handler_t)(int, void *); | |||
| 110 | * @thread_fn: interupt handler function for threaded interrupts | 101 | * @thread_fn: interupt handler function for threaded interrupts |
| 111 | * @thread: thread pointer for threaded interrupts | 102 | * @thread: thread pointer for threaded interrupts |
| 112 | * @thread_flags: flags related to @thread | 103 | * @thread_flags: flags related to @thread |
| 104 | * @thread_mask: bitmask for keeping track of @thread activity | ||
| 113 | */ | 105 | */ |
| 114 | struct irqaction { | 106 | struct irqaction { |
| 115 | irq_handler_t handler; | 107 | irq_handler_t handler; |
| @@ -120,6 +112,7 @@ struct irqaction { | |||
| 120 | irq_handler_t thread_fn; | 112 | irq_handler_t thread_fn; |
| 121 | struct task_struct *thread; | 113 | struct task_struct *thread; |
| 122 | unsigned long thread_flags; | 114 | unsigned long thread_flags; |
| 115 | unsigned long thread_mask; | ||
| 123 | const char *name; | 116 | const char *name; |
| 124 | struct proc_dir_entry *dir; | 117 | struct proc_dir_entry *dir; |
| 125 | } ____cacheline_internodealigned_in_smp; | 118 | } ____cacheline_internodealigned_in_smp; |
| @@ -240,6 +233,35 @@ extern int irq_can_set_affinity(unsigned int irq); | |||
| 240 | extern int irq_select_affinity(unsigned int irq); | 233 | extern int irq_select_affinity(unsigned int irq); |
| 241 | 234 | ||
| 242 | extern int irq_set_affinity_hint(unsigned int irq, const struct cpumask *m); | 235 | extern int irq_set_affinity_hint(unsigned int irq, const struct cpumask *m); |
| 236 | |||
| 237 | /** | ||
| 238 | * struct irq_affinity_notify - context for notification of IRQ affinity changes | ||
| 239 | * @irq: Interrupt to which notification applies | ||
| 240 | * @kref: Reference count, for internal use | ||
| 241 | * @work: Work item, for internal use | ||
| 242 | * @notify: Function to be called on change. This will be | ||
| 243 | * called in process context. | ||
| 244 | * @release: Function to be called on release. This will be | ||
| 245 | * called in process context. Once registered, the | ||
| 246 | * structure must only be freed when this function is | ||
| 247 | * called or later. | ||
| 248 | */ | ||
| 249 | struct irq_affinity_notify { | ||
| 250 | unsigned int irq; | ||
| 251 | struct kref kref; | ||
| 252 | struct work_struct work; | ||
| 253 | void (*notify)(struct irq_affinity_notify *, const cpumask_t *mask); | ||
| 254 | void (*release)(struct kref *ref); | ||
| 255 | }; | ||
| 256 | |||
| 257 | extern int | ||
| 258 | irq_set_affinity_notifier(unsigned int irq, struct irq_affinity_notify *notify); | ||
| 259 | |||
| 260 | static inline void irq_run_affinity_notifiers(void) | ||
| 261 | { | ||
| 262 | flush_scheduled_work(); | ||
| 263 | } | ||
| 264 | |||
| 243 | #else /* CONFIG_SMP */ | 265 | #else /* CONFIG_SMP */ |
| 244 | 266 | ||
| 245 | static inline int irq_set_affinity(unsigned int irq, const struct cpumask *m) | 267 | static inline int irq_set_affinity(unsigned int irq, const struct cpumask *m) |
| @@ -255,7 +277,7 @@ static inline int irq_can_set_affinity(unsigned int irq) | |||
| 255 | static inline int irq_select_affinity(unsigned int irq) { return 0; } | 277 | static inline int irq_select_affinity(unsigned int irq) { return 0; } |
| 256 | 278 | ||
| 257 | static inline int irq_set_affinity_hint(unsigned int irq, | 279 | static inline int irq_set_affinity_hint(unsigned int irq, |
| 258 | const struct cpumask *m) | 280 | const struct cpumask *m) |
| 259 | { | 281 | { |
| 260 | return -EINVAL; | 282 | return -EINVAL; |
| 261 | } | 283 | } |
| @@ -314,16 +336,24 @@ static inline void enable_irq_lockdep_irqrestore(unsigned int irq, unsigned long | |||
| 314 | } | 336 | } |
| 315 | 337 | ||
| 316 | /* IRQ wakeup (PM) control: */ | 338 | /* IRQ wakeup (PM) control: */ |
| 317 | extern int set_irq_wake(unsigned int irq, unsigned int on); | 339 | extern int irq_set_irq_wake(unsigned int irq, unsigned int on); |
| 340 | |||
| 341 | #ifndef CONFIG_GENERIC_HARDIRQS_NO_COMPAT | ||
| 342 | /* Please do not use: Use the replacement functions instead */ | ||
| 343 | static inline int set_irq_wake(unsigned int irq, unsigned int on) | ||
| 344 | { | ||
| 345 | return irq_set_irq_wake(irq, on); | ||
| 346 | } | ||
| 347 | #endif | ||
| 318 | 348 | ||
| 319 | static inline int enable_irq_wake(unsigned int irq) | 349 | static inline int enable_irq_wake(unsigned int irq) |
| 320 | { | 350 | { |
| 321 | return set_irq_wake(irq, 1); | 351 | return irq_set_irq_wake(irq, 1); |
| 322 | } | 352 | } |
| 323 | 353 | ||
| 324 | static inline int disable_irq_wake(unsigned int irq) | 354 | static inline int disable_irq_wake(unsigned int irq) |
| 325 | { | 355 | { |
| 326 | return set_irq_wake(irq, 0); | 356 | return irq_set_irq_wake(irq, 0); |
| 327 | } | 357 | } |
| 328 | 358 | ||
| 329 | #else /* !CONFIG_GENERIC_HARDIRQS */ | 359 | #else /* !CONFIG_GENERIC_HARDIRQS */ |
| @@ -353,6 +383,13 @@ static inline int disable_irq_wake(unsigned int irq) | |||
| 353 | } | 383 | } |
| 354 | #endif /* CONFIG_GENERIC_HARDIRQS */ | 384 | #endif /* CONFIG_GENERIC_HARDIRQS */ |
| 355 | 385 | ||
| 386 | |||
| 387 | #ifdef CONFIG_IRQ_FORCED_THREADING | ||
| 388 | extern bool force_irqthreads; | ||
| 389 | #else | ||
| 390 | #define force_irqthreads (0) | ||
| 391 | #endif | ||
| 392 | |||
| 356 | #ifndef __ARCH_SET_SOFTIRQ_PENDING | 393 | #ifndef __ARCH_SET_SOFTIRQ_PENDING |
| 357 | #define set_softirq_pending(x) (local_softirq_pending() = (x)) | 394 | #define set_softirq_pending(x) (local_softirq_pending() = (x)) |
| 358 | #define or_softirq_pending(x) (local_softirq_pending() |= (x)) | 395 | #define or_softirq_pending(x) (local_softirq_pending() |= (x)) |
| @@ -426,6 +463,13 @@ extern void raise_softirq(unsigned int nr); | |||
| 426 | */ | 463 | */ |
| 427 | DECLARE_PER_CPU(struct list_head [NR_SOFTIRQS], softirq_work_list); | 464 | DECLARE_PER_CPU(struct list_head [NR_SOFTIRQS], softirq_work_list); |
| 428 | 465 | ||
| 466 | DECLARE_PER_CPU(struct task_struct *, ksoftirqd); | ||
| 467 | |||
| 468 | static inline struct task_struct *this_cpu_ksoftirqd(void) | ||
| 469 | { | ||
| 470 | return this_cpu_read(ksoftirqd); | ||
| 471 | } | ||
| 472 | |||
| 429 | /* Try to send a softirq to a remote cpu. If this cannot be done, the | 473 | /* Try to send a softirq to a remote cpu. If this cannot be done, the |
| 430 | * work will be queued to the local cpu. | 474 | * work will be queued to the local cpu. |
| 431 | */ | 475 | */ |
| @@ -645,6 +689,7 @@ static inline void init_irq_proc(void) | |||
| 645 | 689 | ||
| 646 | struct seq_file; | 690 | struct seq_file; |
| 647 | int show_interrupts(struct seq_file *p, void *v); | 691 | int show_interrupts(struct seq_file *p, void *v); |
| 692 | int arch_show_interrupts(struct seq_file *p, int prec); | ||
| 648 | 693 | ||
| 649 | extern int early_irq_init(void); | 694 | extern int early_irq_init(void); |
| 650 | extern int arch_probe_nr_irqs(void); | 695 | extern int arch_probe_nr_irqs(void); |
diff --git a/include/linux/ip_vs.h b/include/linux/ip_vs.h index 5f43a3b2e3ad..4deb3834d62c 100644 --- a/include/linux/ip_vs.h +++ b/include/linux/ip_vs.h | |||
| @@ -89,6 +89,14 @@ | |||
| 89 | #define IP_VS_CONN_F_TEMPLATE 0x1000 /* template, not connection */ | 89 | #define IP_VS_CONN_F_TEMPLATE 0x1000 /* template, not connection */ |
| 90 | #define IP_VS_CONN_F_ONE_PACKET 0x2000 /* forward only one packet */ | 90 | #define IP_VS_CONN_F_ONE_PACKET 0x2000 /* forward only one packet */ |
| 91 | 91 | ||
| 92 | #define IP_VS_CONN_F_BACKUP_MASK (IP_VS_CONN_F_FWD_MASK | \ | ||
| 93 | IP_VS_CONN_F_NOOUTPUT | \ | ||
| 94 | IP_VS_CONN_F_INACTIVE | \ | ||
| 95 | IP_VS_CONN_F_SEQ_MASK | \ | ||
| 96 | IP_VS_CONN_F_NO_CPORT | \ | ||
| 97 | IP_VS_CONN_F_TEMPLATE \ | ||
| 98 | ) | ||
| 99 | |||
| 92 | /* Flags that are not sent to backup server start from bit 16 */ | 100 | /* Flags that are not sent to backup server start from bit 16 */ |
| 93 | #define IP_VS_CONN_F_NFCT (1 << 16) /* use netfilter conntrack */ | 101 | #define IP_VS_CONN_F_NFCT (1 << 16) /* use netfilter conntrack */ |
| 94 | 102 | ||
diff --git a/include/linux/irq.h b/include/linux/irq.h index 80fcb53057bc..1d3577f30d45 100644 --- a/include/linux/irq.h +++ b/include/linux/irq.h | |||
| @@ -29,61 +29,104 @@ | |||
| 29 | #include <asm/irq_regs.h> | 29 | #include <asm/irq_regs.h> |
| 30 | 30 | ||
| 31 | struct irq_desc; | 31 | struct irq_desc; |
| 32 | struct irq_data; | ||
| 32 | typedef void (*irq_flow_handler_t)(unsigned int irq, | 33 | typedef void (*irq_flow_handler_t)(unsigned int irq, |
| 33 | struct irq_desc *desc); | 34 | struct irq_desc *desc); |
| 34 | 35 | typedef void (*irq_preflow_handler_t)(struct irq_data *data); | |
| 35 | 36 | ||
| 36 | /* | 37 | /* |
| 37 | * IRQ line status. | 38 | * IRQ line status. |
| 38 | * | 39 | * |
| 39 | * Bits 0-7 are reserved for the IRQF_* bits in linux/interrupt.h | 40 | * Bits 0-7 are the same as the IRQF_* bits in linux/interrupt.h |
| 41 | * | ||
| 42 | * IRQ_TYPE_NONE - default, unspecified type | ||
| 43 | * IRQ_TYPE_EDGE_RISING - rising edge triggered | ||
| 44 | * IRQ_TYPE_EDGE_FALLING - falling edge triggered | ||
| 45 | * IRQ_TYPE_EDGE_BOTH - rising and falling edge triggered | ||
| 46 | * IRQ_TYPE_LEVEL_HIGH - high level triggered | ||
| 47 | * IRQ_TYPE_LEVEL_LOW - low level triggered | ||
| 48 | * IRQ_TYPE_LEVEL_MASK - Mask to filter out the level bits | ||
| 49 | * IRQ_TYPE_SENSE_MASK - Mask for all the above bits | ||
| 50 | * IRQ_TYPE_PROBE - Special flag for probing in progress | ||
| 51 | * | ||
| 52 | * Bits which can be modified via irq_set/clear/modify_status_flags() | ||
| 53 | * IRQ_LEVEL - Interrupt is level type. Will be also | ||
| 54 | * updated in the code when the above trigger | ||
| 55 | * bits are modified via set_irq_type() | ||
| 56 | * IRQ_PER_CPU - Mark an interrupt PER_CPU. Will protect | ||
| 57 | * it from affinity setting | ||
| 58 | * IRQ_NOPROBE - Interrupt cannot be probed by autoprobing | ||
| 59 | * IRQ_NOREQUEST - Interrupt cannot be requested via | ||
| 60 | * request_irq() | ||
| 61 | * IRQ_NOAUTOEN - Interrupt is not automatically enabled in | ||
| 62 | * request/setup_irq() | ||
| 63 | * IRQ_NO_BALANCING - Interrupt cannot be balanced (affinity set) | ||
| 64 | * IRQ_MOVE_PCNTXT - Interrupt can be migrated from process context | ||
| 65 | * IRQ_NESTED_TRHEAD - Interrupt nests into another thread | ||
| 66 | * | ||
| 67 | * Deprecated bits. They are kept updated as long as | ||
| 68 | * CONFIG_GENERIC_HARDIRQS_NO_COMPAT is not set. Will go away soon. These bits | ||
| 69 | * are internal state of the core code and if you really need to acces | ||
| 70 | * them then talk to the genirq maintainer instead of hacking | ||
| 71 | * something weird. | ||
| 40 | * | 72 | * |
| 41 | * IRQ types | ||
| 42 | */ | 73 | */ |
| 43 | #define IRQ_TYPE_NONE 0x00000000 /* Default, unspecified type */ | 74 | enum { |
| 44 | #define IRQ_TYPE_EDGE_RISING 0x00000001 /* Edge rising type */ | 75 | IRQ_TYPE_NONE = 0x00000000, |
| 45 | #define IRQ_TYPE_EDGE_FALLING 0x00000002 /* Edge falling type */ | 76 | IRQ_TYPE_EDGE_RISING = 0x00000001, |
| 46 | #define IRQ_TYPE_EDGE_BOTH (IRQ_TYPE_EDGE_FALLING | IRQ_TYPE_EDGE_RISING) | 77 | IRQ_TYPE_EDGE_FALLING = 0x00000002, |
| 47 | #define IRQ_TYPE_LEVEL_HIGH 0x00000004 /* Level high type */ | 78 | IRQ_TYPE_EDGE_BOTH = (IRQ_TYPE_EDGE_FALLING | IRQ_TYPE_EDGE_RISING), |
| 48 | #define IRQ_TYPE_LEVEL_LOW 0x00000008 /* Level low type */ | 79 | IRQ_TYPE_LEVEL_HIGH = 0x00000004, |
| 49 | #define IRQ_TYPE_SENSE_MASK 0x0000000f /* Mask of the above */ | 80 | IRQ_TYPE_LEVEL_LOW = 0x00000008, |
| 50 | #define IRQ_TYPE_PROBE 0x00000010 /* Probing in progress */ | 81 | IRQ_TYPE_LEVEL_MASK = (IRQ_TYPE_LEVEL_LOW | IRQ_TYPE_LEVEL_HIGH), |
| 51 | 82 | IRQ_TYPE_SENSE_MASK = 0x0000000f, | |
| 52 | /* Internal flags */ | 83 | |
| 53 | #define IRQ_INPROGRESS 0x00000100 /* IRQ handler active - do not enter! */ | 84 | IRQ_TYPE_PROBE = 0x00000010, |
| 54 | #define IRQ_DISABLED 0x00000200 /* IRQ disabled - do not enter! */ | 85 | |
| 55 | #define IRQ_PENDING 0x00000400 /* IRQ pending - replay on enable */ | 86 | IRQ_LEVEL = (1 << 8), |
| 56 | #define IRQ_REPLAY 0x00000800 /* IRQ has been replayed but not acked yet */ | 87 | IRQ_PER_CPU = (1 << 9), |
| 57 | #define IRQ_AUTODETECT 0x00001000 /* IRQ is being autodetected */ | 88 | IRQ_NOPROBE = (1 << 10), |
| 58 | #define IRQ_WAITING 0x00002000 /* IRQ not yet seen - for autodetection */ | 89 | IRQ_NOREQUEST = (1 << 11), |
| 59 | #define IRQ_LEVEL 0x00004000 /* IRQ level triggered */ | 90 | IRQ_NOAUTOEN = (1 << 12), |
| 60 | #define IRQ_MASKED 0x00008000 /* IRQ masked - shouldn't be seen again */ | 91 | IRQ_NO_BALANCING = (1 << 13), |
| 61 | #define IRQ_PER_CPU 0x00010000 /* IRQ is per CPU */ | 92 | IRQ_MOVE_PCNTXT = (1 << 14), |
| 62 | #define IRQ_NOPROBE 0x00020000 /* IRQ is not valid for probing */ | 93 | IRQ_NESTED_THREAD = (1 << 15), |
| 63 | #define IRQ_NOREQUEST 0x00040000 /* IRQ cannot be requested */ | 94 | |
| 64 | #define IRQ_NOAUTOEN 0x00080000 /* IRQ will not be enabled on request irq */ | 95 | #ifndef CONFIG_GENERIC_HARDIRQS_NO_COMPAT |
| 65 | #define IRQ_WAKEUP 0x00100000 /* IRQ triggers system wakeup */ | 96 | IRQ_INPROGRESS = (1 << 16), |
| 66 | #define IRQ_MOVE_PENDING 0x00200000 /* need to re-target IRQ destination */ | 97 | IRQ_REPLAY = (1 << 17), |
| 67 | #define IRQ_NO_BALANCING 0x00400000 /* IRQ is excluded from balancing */ | 98 | IRQ_WAITING = (1 << 18), |
| 68 | #define IRQ_SPURIOUS_DISABLED 0x00800000 /* IRQ was disabled by the spurious trap */ | 99 | IRQ_DISABLED = (1 << 19), |
| 69 | #define IRQ_MOVE_PCNTXT 0x01000000 /* IRQ migration from process context */ | 100 | IRQ_PENDING = (1 << 20), |
| 70 | #define IRQ_AFFINITY_SET 0x02000000 /* IRQ affinity was set from userspace*/ | 101 | IRQ_MASKED = (1 << 21), |
| 71 | #define IRQ_SUSPENDED 0x04000000 /* IRQ has gone through suspend sequence */ | 102 | IRQ_MOVE_PENDING = (1 << 22), |
| 72 | #define IRQ_ONESHOT 0x08000000 /* IRQ is not unmasked after hardirq */ | 103 | IRQ_AFFINITY_SET = (1 << 23), |
| 73 | #define IRQ_NESTED_THREAD 0x10000000 /* IRQ is nested into another, no own handler thread */ | 104 | IRQ_WAKEUP = (1 << 24), |
| 105 | #endif | ||
| 106 | }; | ||
| 74 | 107 | ||
| 75 | #define IRQF_MODIFY_MASK \ | 108 | #define IRQF_MODIFY_MASK \ |
| 76 | (IRQ_TYPE_SENSE_MASK | IRQ_NOPROBE | IRQ_NOREQUEST | \ | 109 | (IRQ_TYPE_SENSE_MASK | IRQ_NOPROBE | IRQ_NOREQUEST | \ |
| 77 | IRQ_NOAUTOEN | IRQ_MOVE_PCNTXT | IRQ_LEVEL | IRQ_NO_BALANCING | \ | 110 | IRQ_NOAUTOEN | IRQ_MOVE_PCNTXT | IRQ_LEVEL | IRQ_NO_BALANCING | \ |
| 78 | IRQ_PER_CPU) | 111 | IRQ_PER_CPU | IRQ_NESTED_THREAD) |
| 79 | 112 | ||
| 80 | #ifdef CONFIG_IRQ_PER_CPU | 113 | #define IRQ_NO_BALANCING_MASK (IRQ_PER_CPU | IRQ_NO_BALANCING) |
| 81 | # define CHECK_IRQ_PER_CPU(var) ((var) & IRQ_PER_CPU) | 114 | |
| 82 | # define IRQ_NO_BALANCING_MASK (IRQ_PER_CPU | IRQ_NO_BALANCING) | 115 | static inline __deprecated bool CHECK_IRQ_PER_CPU(unsigned int status) |
| 83 | #else | 116 | { |
| 84 | # define CHECK_IRQ_PER_CPU(var) 0 | 117 | return status & IRQ_PER_CPU; |
| 85 | # define IRQ_NO_BALANCING_MASK IRQ_NO_BALANCING | 118 | } |
| 86 | #endif | 119 | |
| 120 | /* | ||
| 121 | * Return value for chip->irq_set_affinity() | ||
| 122 | * | ||
| 123 | * IRQ_SET_MASK_OK - OK, core updates irq_data.affinity | ||
| 124 | * IRQ_SET_MASK_NOCPY - OK, chip did update irq_data.affinity | ||
| 125 | */ | ||
| 126 | enum { | ||
| 127 | IRQ_SET_MASK_OK = 0, | ||
| 128 | IRQ_SET_MASK_OK_NOCOPY, | ||
| 129 | }; | ||
| 87 | 130 | ||
| 88 | struct msi_desc; | 131 | struct msi_desc; |
| 89 | 132 | ||
| @@ -91,6 +134,8 @@ struct msi_desc; | |||
| 91 | * struct irq_data - per irq and irq chip data passed down to chip functions | 134 | * struct irq_data - per irq and irq chip data passed down to chip functions |
| 92 | * @irq: interrupt number | 135 | * @irq: interrupt number |
| 93 | * @node: node index useful for balancing | 136 | * @node: node index useful for balancing |
| 137 | * @state_use_accessor: status information for irq chip functions. | ||
| 138 | * Use accessor functions to deal with it | ||
| 94 | * @chip: low level interrupt hardware access | 139 | * @chip: low level interrupt hardware access |
| 95 | * @handler_data: per-IRQ data for the irq_chip methods | 140 | * @handler_data: per-IRQ data for the irq_chip methods |
| 96 | * @chip_data: platform-specific per-chip private data for the chip | 141 | * @chip_data: platform-specific per-chip private data for the chip |
| @@ -105,6 +150,7 @@ struct msi_desc; | |||
| 105 | struct irq_data { | 150 | struct irq_data { |
| 106 | unsigned int irq; | 151 | unsigned int irq; |
| 107 | unsigned int node; | 152 | unsigned int node; |
| 153 | unsigned int state_use_accessors; | ||
| 108 | struct irq_chip *chip; | 154 | struct irq_chip *chip; |
| 109 | void *handler_data; | 155 | void *handler_data; |
| 110 | void *chip_data; | 156 | void *chip_data; |
| @@ -114,6 +160,80 @@ struct irq_data { | |||
| 114 | #endif | 160 | #endif |
| 115 | }; | 161 | }; |
| 116 | 162 | ||
| 163 | /* | ||
| 164 | * Bit masks for irq_data.state | ||
| 165 | * | ||
| 166 | * IRQD_TRIGGER_MASK - Mask for the trigger type bits | ||
| 167 | * IRQD_SETAFFINITY_PENDING - Affinity setting is pending | ||
| 168 | * IRQD_NO_BALANCING - Balancing disabled for this IRQ | ||
| 169 | * IRQD_PER_CPU - Interrupt is per cpu | ||
| 170 | * IRQD_AFFINITY_SET - Interrupt affinity was set | ||
| 171 | * IRQD_LEVEL - Interrupt is level triggered | ||
| 172 | * IRQD_WAKEUP_STATE - Interrupt is configured for wakeup | ||
| 173 | * from suspend | ||
| 174 | * IRDQ_MOVE_PCNTXT - Interrupt can be moved in process | ||
| 175 | * context | ||
| 176 | */ | ||
| 177 | enum { | ||
| 178 | IRQD_TRIGGER_MASK = 0xf, | ||
| 179 | IRQD_SETAFFINITY_PENDING = (1 << 8), | ||
| 180 | IRQD_NO_BALANCING = (1 << 10), | ||
| 181 | IRQD_PER_CPU = (1 << 11), | ||
| 182 | IRQD_AFFINITY_SET = (1 << 12), | ||
| 183 | IRQD_LEVEL = (1 << 13), | ||
| 184 | IRQD_WAKEUP_STATE = (1 << 14), | ||
| 185 | IRQD_MOVE_PCNTXT = (1 << 15), | ||
| 186 | }; | ||
| 187 | |||
| 188 | static inline bool irqd_is_setaffinity_pending(struct irq_data *d) | ||
| 189 | { | ||
| 190 | return d->state_use_accessors & IRQD_SETAFFINITY_PENDING; | ||
| 191 | } | ||
| 192 | |||
| 193 | static inline bool irqd_is_per_cpu(struct irq_data *d) | ||
| 194 | { | ||
| 195 | return d->state_use_accessors & IRQD_PER_CPU; | ||
| 196 | } | ||
| 197 | |||
| 198 | static inline bool irqd_can_balance(struct irq_data *d) | ||
| 199 | { | ||
| 200 | return !(d->state_use_accessors & (IRQD_PER_CPU | IRQD_NO_BALANCING)); | ||
| 201 | } | ||
| 202 | |||
| 203 | static inline bool irqd_affinity_was_set(struct irq_data *d) | ||
| 204 | { | ||
| 205 | return d->state_use_accessors & IRQD_AFFINITY_SET; | ||
| 206 | } | ||
| 207 | |||
| 208 | static inline u32 irqd_get_trigger_type(struct irq_data *d) | ||
| 209 | { | ||
| 210 | return d->state_use_accessors & IRQD_TRIGGER_MASK; | ||
| 211 | } | ||
| 212 | |||
| 213 | /* | ||
| 214 | * Must only be called inside irq_chip.irq_set_type() functions. | ||
| 215 | */ | ||
| 216 | static inline void irqd_set_trigger_type(struct irq_data *d, u32 type) | ||
| 217 | { | ||
| 218 | d->state_use_accessors &= ~IRQD_TRIGGER_MASK; | ||
| 219 | d->state_use_accessors |= type & IRQD_TRIGGER_MASK; | ||
| 220 | } | ||
| 221 | |||
| 222 | static inline bool irqd_is_level_type(struct irq_data *d) | ||
| 223 | { | ||
| 224 | return d->state_use_accessors & IRQD_LEVEL; | ||
| 225 | } | ||
| 226 | |||
| 227 | static inline bool irqd_is_wakeup_set(struct irq_data *d) | ||
| 228 | { | ||
| 229 | return d->state_use_accessors & IRQD_WAKEUP_STATE; | ||
| 230 | } | ||
| 231 | |||
| 232 | static inline bool irqd_can_move_in_process_context(struct irq_data *d) | ||
| 233 | { | ||
| 234 | return d->state_use_accessors & IRQD_MOVE_PCNTXT; | ||
| 235 | } | ||
| 236 | |||
| 117 | /** | 237 | /** |
| 118 | * struct irq_chip - hardware interrupt chip descriptor | 238 | * struct irq_chip - hardware interrupt chip descriptor |
| 119 | * | 239 | * |
| @@ -150,6 +270,7 @@ struct irq_data { | |||
| 150 | * @irq_set_wake: enable/disable power-management wake-on of an IRQ | 270 | * @irq_set_wake: enable/disable power-management wake-on of an IRQ |
| 151 | * @irq_bus_lock: function to lock access to slow bus (i2c) chips | 271 | * @irq_bus_lock: function to lock access to slow bus (i2c) chips |
| 152 | * @irq_bus_sync_unlock:function to sync and unlock slow bus (i2c) chips | 272 | * @irq_bus_sync_unlock:function to sync and unlock slow bus (i2c) chips |
| 273 | * @flags: chip specific flags | ||
| 153 | * | 274 | * |
| 154 | * @release: release function solely used by UML | 275 | * @release: release function solely used by UML |
| 155 | */ | 276 | */ |
| @@ -196,12 +317,27 @@ struct irq_chip { | |||
| 196 | void (*irq_bus_lock)(struct irq_data *data); | 317 | void (*irq_bus_lock)(struct irq_data *data); |
| 197 | void (*irq_bus_sync_unlock)(struct irq_data *data); | 318 | void (*irq_bus_sync_unlock)(struct irq_data *data); |
| 198 | 319 | ||
| 320 | unsigned long flags; | ||
| 321 | |||
| 199 | /* Currently used only by UML, might disappear one day.*/ | 322 | /* Currently used only by UML, might disappear one day.*/ |
| 200 | #ifdef CONFIG_IRQ_RELEASE_METHOD | 323 | #ifdef CONFIG_IRQ_RELEASE_METHOD |
| 201 | void (*release)(unsigned int irq, void *dev_id); | 324 | void (*release)(unsigned int irq, void *dev_id); |
| 202 | #endif | 325 | #endif |
| 203 | }; | 326 | }; |
| 204 | 327 | ||
| 328 | /* | ||
| 329 | * irq_chip specific flags | ||
| 330 | * | ||
| 331 | * IRQCHIP_SET_TYPE_MASKED: Mask before calling chip.irq_set_type() | ||
| 332 | * IRQCHIP_EOI_IF_HANDLED: Only issue irq_eoi() when irq was handled | ||
| 333 | * IRQCHIP_MASK_ON_SUSPEND: Mask non wake irqs in the suspend path | ||
| 334 | */ | ||
| 335 | enum { | ||
| 336 | IRQCHIP_SET_TYPE_MASKED = (1 << 0), | ||
| 337 | IRQCHIP_EOI_IF_HANDLED = (1 << 1), | ||
| 338 | IRQCHIP_MASK_ON_SUSPEND = (1 << 2), | ||
| 339 | }; | ||
| 340 | |||
| 205 | /* This include will go away once we isolated irq_desc usage to core code */ | 341 | /* This include will go away once we isolated irq_desc usage to core code */ |
| 206 | #include <linux/irqdesc.h> | 342 | #include <linux/irqdesc.h> |
| 207 | 343 | ||
| @@ -218,7 +354,7 @@ struct irq_chip { | |||
| 218 | # define ARCH_IRQ_INIT_FLAGS 0 | 354 | # define ARCH_IRQ_INIT_FLAGS 0 |
| 219 | #endif | 355 | #endif |
| 220 | 356 | ||
| 221 | #define IRQ_DEFAULT_INIT_FLAGS (IRQ_DISABLED | ARCH_IRQ_INIT_FLAGS) | 357 | #define IRQ_DEFAULT_INIT_FLAGS ARCH_IRQ_INIT_FLAGS |
| 222 | 358 | ||
| 223 | struct irqaction; | 359 | struct irqaction; |
| 224 | extern int setup_irq(unsigned int irq, struct irqaction *new); | 360 | extern int setup_irq(unsigned int irq, struct irqaction *new); |
| @@ -229,9 +365,13 @@ extern void remove_irq(unsigned int irq, struct irqaction *act); | |||
| 229 | #if defined(CONFIG_SMP) && defined(CONFIG_GENERIC_PENDING_IRQ) | 365 | #if defined(CONFIG_SMP) && defined(CONFIG_GENERIC_PENDING_IRQ) |
| 230 | void move_native_irq(int irq); | 366 | void move_native_irq(int irq); |
| 231 | void move_masked_irq(int irq); | 367 | void move_masked_irq(int irq); |
| 368 | void irq_move_irq(struct irq_data *data); | ||
| 369 | void irq_move_masked_irq(struct irq_data *data); | ||
| 232 | #else | 370 | #else |
| 233 | static inline void move_native_irq(int irq) { } | 371 | static inline void move_native_irq(int irq) { } |
| 234 | static inline void move_masked_irq(int irq) { } | 372 | static inline void move_masked_irq(int irq) { } |
| 373 | static inline void irq_move_irq(struct irq_data *data) { } | ||
| 374 | static inline void irq_move_masked_irq(struct irq_data *data) { } | ||
| 235 | #endif | 375 | #endif |
| 236 | 376 | ||
| 237 | extern int no_irq_affinity; | 377 | extern int no_irq_affinity; |
| @@ -267,23 +407,23 @@ extern struct irq_chip no_irq_chip; | |||
| 267 | extern struct irq_chip dummy_irq_chip; | 407 | extern struct irq_chip dummy_irq_chip; |
| 268 | 408 | ||
| 269 | extern void | 409 | extern void |
| 270 | set_irq_chip_and_handler(unsigned int irq, struct irq_chip *chip, | 410 | irq_set_chip_and_handler_name(unsigned int irq, struct irq_chip *chip, |
| 271 | irq_flow_handler_t handle); | ||
| 272 | extern void | ||
| 273 | set_irq_chip_and_handler_name(unsigned int irq, struct irq_chip *chip, | ||
| 274 | irq_flow_handler_t handle, const char *name); | 411 | irq_flow_handler_t handle, const char *name); |
| 275 | 412 | ||
| 413 | static inline void irq_set_chip_and_handler(unsigned int irq, struct irq_chip *chip, | ||
| 414 | irq_flow_handler_t handle) | ||
| 415 | { | ||
| 416 | irq_set_chip_and_handler_name(irq, chip, handle, NULL); | ||
| 417 | } | ||
| 418 | |||
| 276 | extern void | 419 | extern void |
| 277 | __set_irq_handler(unsigned int irq, irq_flow_handler_t handle, int is_chained, | 420 | __irq_set_handler(unsigned int irq, irq_flow_handler_t handle, int is_chained, |
| 278 | const char *name); | 421 | const char *name); |
| 279 | 422 | ||
| 280 | /* | ||
| 281 | * Set a highlevel flow handler for a given IRQ: | ||
| 282 | */ | ||
| 283 | static inline void | 423 | static inline void |
| 284 | set_irq_handler(unsigned int irq, irq_flow_handler_t handle) | 424 | irq_set_handler(unsigned int irq, irq_flow_handler_t handle) |
| 285 | { | 425 | { |
| 286 | __set_irq_handler(irq, handle, 0, NULL); | 426 | __irq_set_handler(irq, handle, 0, NULL); |
| 287 | } | 427 | } |
| 288 | 428 | ||
| 289 | /* | 429 | /* |
| @@ -292,14 +432,11 @@ set_irq_handler(unsigned int irq, irq_flow_handler_t handle) | |||
| 292 | * IRQ_NOREQUEST and IRQ_NOPROBE) | 432 | * IRQ_NOREQUEST and IRQ_NOPROBE) |
| 293 | */ | 433 | */ |
| 294 | static inline void | 434 | static inline void |
| 295 | set_irq_chained_handler(unsigned int irq, | 435 | irq_set_chained_handler(unsigned int irq, irq_flow_handler_t handle) |
| 296 | irq_flow_handler_t handle) | ||
| 297 | { | 436 | { |
| 298 | __set_irq_handler(irq, handle, 1, NULL); | 437 | __irq_set_handler(irq, handle, 1, NULL); |
| 299 | } | 438 | } |
| 300 | 439 | ||
| 301 | extern void set_irq_nested_thread(unsigned int irq, int nest); | ||
| 302 | |||
| 303 | void irq_modify_status(unsigned int irq, unsigned long clr, unsigned long set); | 440 | void irq_modify_status(unsigned int irq, unsigned long clr, unsigned long set); |
| 304 | 441 | ||
| 305 | static inline void irq_set_status_flags(unsigned int irq, unsigned long set) | 442 | static inline void irq_set_status_flags(unsigned int irq, unsigned long set) |
| @@ -312,16 +449,24 @@ static inline void irq_clear_status_flags(unsigned int irq, unsigned long clr) | |||
| 312 | irq_modify_status(irq, clr, 0); | 449 | irq_modify_status(irq, clr, 0); |
| 313 | } | 450 | } |
| 314 | 451 | ||
| 315 | static inline void set_irq_noprobe(unsigned int irq) | 452 | static inline void irq_set_noprobe(unsigned int irq) |
| 316 | { | 453 | { |
| 317 | irq_modify_status(irq, 0, IRQ_NOPROBE); | 454 | irq_modify_status(irq, 0, IRQ_NOPROBE); |
| 318 | } | 455 | } |
| 319 | 456 | ||
| 320 | static inline void set_irq_probe(unsigned int irq) | 457 | static inline void irq_set_probe(unsigned int irq) |
| 321 | { | 458 | { |
| 322 | irq_modify_status(irq, IRQ_NOPROBE, 0); | 459 | irq_modify_status(irq, IRQ_NOPROBE, 0); |
| 323 | } | 460 | } |
| 324 | 461 | ||
| 462 | static inline void irq_set_nested_thread(unsigned int irq, bool nest) | ||
| 463 | { | ||
| 464 | if (nest) | ||
| 465 | irq_set_status_flags(irq, IRQ_NESTED_THREAD); | ||
| 466 | else | ||
| 467 | irq_clear_status_flags(irq, IRQ_NESTED_THREAD); | ||
| 468 | } | ||
| 469 | |||
| 325 | /* Handle dynamic irq creation and destruction */ | 470 | /* Handle dynamic irq creation and destruction */ |
| 326 | extern unsigned int create_irq_nr(unsigned int irq_want, int node); | 471 | extern unsigned int create_irq_nr(unsigned int irq_want, int node); |
| 327 | extern int create_irq(void); | 472 | extern int create_irq(void); |
| @@ -338,14 +483,14 @@ static inline void dynamic_irq_init(unsigned int irq) | |||
| 338 | } | 483 | } |
| 339 | 484 | ||
| 340 | /* Set/get chip/data for an IRQ: */ | 485 | /* Set/get chip/data for an IRQ: */ |
| 341 | extern int set_irq_chip(unsigned int irq, struct irq_chip *chip); | 486 | extern int irq_set_chip(unsigned int irq, struct irq_chip *chip); |
| 342 | extern int set_irq_data(unsigned int irq, void *data); | 487 | extern int irq_set_handler_data(unsigned int irq, void *data); |
| 343 | extern int set_irq_chip_data(unsigned int irq, void *data); | 488 | extern int irq_set_chip_data(unsigned int irq, void *data); |
| 344 | extern int set_irq_type(unsigned int irq, unsigned int type); | 489 | extern int irq_set_irq_type(unsigned int irq, unsigned int type); |
| 345 | extern int set_irq_msi(unsigned int irq, struct msi_desc *entry); | 490 | extern int irq_set_msi_desc(unsigned int irq, struct msi_desc *entry); |
| 346 | extern struct irq_data *irq_get_irq_data(unsigned int irq); | 491 | extern struct irq_data *irq_get_irq_data(unsigned int irq); |
| 347 | 492 | ||
| 348 | static inline struct irq_chip *get_irq_chip(unsigned int irq) | 493 | static inline struct irq_chip *irq_get_chip(unsigned int irq) |
| 349 | { | 494 | { |
| 350 | struct irq_data *d = irq_get_irq_data(irq); | 495 | struct irq_data *d = irq_get_irq_data(irq); |
| 351 | return d ? d->chip : NULL; | 496 | return d ? d->chip : NULL; |
| @@ -356,7 +501,7 @@ static inline struct irq_chip *irq_data_get_irq_chip(struct irq_data *d) | |||
| 356 | return d->chip; | 501 | return d->chip; |
| 357 | } | 502 | } |
| 358 | 503 | ||
| 359 | static inline void *get_irq_chip_data(unsigned int irq) | 504 | static inline void *irq_get_chip_data(unsigned int irq) |
| 360 | { | 505 | { |
| 361 | struct irq_data *d = irq_get_irq_data(irq); | 506 | struct irq_data *d = irq_get_irq_data(irq); |
| 362 | return d ? d->chip_data : NULL; | 507 | return d ? d->chip_data : NULL; |
| @@ -367,18 +512,18 @@ static inline void *irq_data_get_irq_chip_data(struct irq_data *d) | |||
| 367 | return d->chip_data; | 512 | return d->chip_data; |
| 368 | } | 513 | } |
| 369 | 514 | ||
| 370 | static inline void *get_irq_data(unsigned int irq) | 515 | static inline void *irq_get_handler_data(unsigned int irq) |
| 371 | { | 516 | { |
| 372 | struct irq_data *d = irq_get_irq_data(irq); | 517 | struct irq_data *d = irq_get_irq_data(irq); |
| 373 | return d ? d->handler_data : NULL; | 518 | return d ? d->handler_data : NULL; |
| 374 | } | 519 | } |
| 375 | 520 | ||
| 376 | static inline void *irq_data_get_irq_data(struct irq_data *d) | 521 | static inline void *irq_data_get_irq_handler_data(struct irq_data *d) |
| 377 | { | 522 | { |
| 378 | return d->handler_data; | 523 | return d->handler_data; |
| 379 | } | 524 | } |
| 380 | 525 | ||
| 381 | static inline struct msi_desc *get_irq_msi(unsigned int irq) | 526 | static inline struct msi_desc *irq_get_msi_desc(unsigned int irq) |
| 382 | { | 527 | { |
| 383 | struct irq_data *d = irq_get_irq_data(irq); | 528 | struct irq_data *d = irq_get_irq_data(irq); |
| 384 | return d ? d->msi_desc : NULL; | 529 | return d ? d->msi_desc : NULL; |
| @@ -389,6 +534,89 @@ static inline struct msi_desc *irq_data_get_msi(struct irq_data *d) | |||
| 389 | return d->msi_desc; | 534 | return d->msi_desc; |
| 390 | } | 535 | } |
| 391 | 536 | ||
| 537 | #ifndef CONFIG_GENERIC_HARDIRQS_NO_COMPAT | ||
| 538 | /* Please do not use: Use the replacement functions instead */ | ||
| 539 | static inline int set_irq_chip(unsigned int irq, struct irq_chip *chip) | ||
| 540 | { | ||
| 541 | return irq_set_chip(irq, chip); | ||
| 542 | } | ||
| 543 | static inline int set_irq_data(unsigned int irq, void *data) | ||
| 544 | { | ||
| 545 | return irq_set_handler_data(irq, data); | ||
| 546 | } | ||
| 547 | static inline int set_irq_chip_data(unsigned int irq, void *data) | ||
| 548 | { | ||
| 549 | return irq_set_chip_data(irq, data); | ||
| 550 | } | ||
| 551 | static inline int set_irq_type(unsigned int irq, unsigned int type) | ||
| 552 | { | ||
| 553 | return irq_set_irq_type(irq, type); | ||
| 554 | } | ||
| 555 | static inline int set_irq_msi(unsigned int irq, struct msi_desc *entry) | ||
| 556 | { | ||
| 557 | return irq_set_msi_desc(irq, entry); | ||
| 558 | } | ||
| 559 | static inline struct irq_chip *get_irq_chip(unsigned int irq) | ||
| 560 | { | ||
| 561 | return irq_get_chip(irq); | ||
| 562 | } | ||
| 563 | static inline void *get_irq_chip_data(unsigned int irq) | ||
| 564 | { | ||
| 565 | return irq_get_chip_data(irq); | ||
| 566 | } | ||
| 567 | static inline void *get_irq_data(unsigned int irq) | ||
| 568 | { | ||
| 569 | return irq_get_handler_data(irq); | ||
| 570 | } | ||
| 571 | static inline void *irq_data_get_irq_data(struct irq_data *d) | ||
| 572 | { | ||
| 573 | return irq_data_get_irq_handler_data(d); | ||
| 574 | } | ||
| 575 | static inline struct msi_desc *get_irq_msi(unsigned int irq) | ||
| 576 | { | ||
| 577 | return irq_get_msi_desc(irq); | ||
| 578 | } | ||
| 579 | static inline void set_irq_noprobe(unsigned int irq) | ||
| 580 | { | ||
| 581 | irq_set_noprobe(irq); | ||
| 582 | } | ||
| 583 | static inline void set_irq_probe(unsigned int irq) | ||
| 584 | { | ||
| 585 | irq_set_probe(irq); | ||
| 586 | } | ||
| 587 | static inline void set_irq_nested_thread(unsigned int irq, int nest) | ||
| 588 | { | ||
| 589 | irq_set_nested_thread(irq, nest); | ||
| 590 | } | ||
| 591 | static inline void | ||
| 592 | set_irq_chip_and_handler_name(unsigned int irq, struct irq_chip *chip, | ||
| 593 | irq_flow_handler_t handle, const char *name) | ||
| 594 | { | ||
| 595 | irq_set_chip_and_handler_name(irq, chip, handle, name); | ||
| 596 | } | ||
| 597 | static inline void | ||
| 598 | set_irq_chip_and_handler(unsigned int irq, struct irq_chip *chip, | ||
| 599 | irq_flow_handler_t handle) | ||
| 600 | { | ||
| 601 | irq_set_chip_and_handler(irq, chip, handle); | ||
| 602 | } | ||
| 603 | static inline void | ||
| 604 | __set_irq_handler(unsigned int irq, irq_flow_handler_t handle, int is_chained, | ||
| 605 | const char *name) | ||
| 606 | { | ||
| 607 | __irq_set_handler(irq, handle, is_chained, name); | ||
| 608 | } | ||
| 609 | static inline void set_irq_handler(unsigned int irq, irq_flow_handler_t handle) | ||
| 610 | { | ||
| 611 | irq_set_handler(irq, handle); | ||
| 612 | } | ||
| 613 | static inline void | ||
| 614 | set_irq_chained_handler(unsigned int irq, irq_flow_handler_t handle) | ||
| 615 | { | ||
| 616 | irq_set_chained_handler(irq, handle); | ||
| 617 | } | ||
| 618 | #endif | ||
| 619 | |||
| 392 | int irq_alloc_descs(int irq, unsigned int from, unsigned int cnt, int node); | 620 | int irq_alloc_descs(int irq, unsigned int from, unsigned int cnt, int node); |
| 393 | void irq_free_descs(unsigned int irq, unsigned int cnt); | 621 | void irq_free_descs(unsigned int irq, unsigned int cnt); |
| 394 | int irq_reserve_irqs(unsigned int from, unsigned int cnt); | 622 | int irq_reserve_irqs(unsigned int from, unsigned int cnt); |
diff --git a/include/linux/irqdesc.h b/include/linux/irqdesc.h index c1a95b7b58de..00218371518b 100644 --- a/include/linux/irqdesc.h +++ b/include/linux/irqdesc.h | |||
| @@ -8,6 +8,7 @@ | |||
| 8 | * For now it's included from <linux/irq.h> | 8 | * For now it's included from <linux/irq.h> |
| 9 | */ | 9 | */ |
| 10 | 10 | ||
| 11 | struct irq_affinity_notify; | ||
| 11 | struct proc_dir_entry; | 12 | struct proc_dir_entry; |
| 12 | struct timer_rand_state; | 13 | struct timer_rand_state; |
| 13 | /** | 14 | /** |
| @@ -18,13 +19,16 @@ struct timer_rand_state; | |||
| 18 | * @handle_irq: highlevel irq-events handler [if NULL, __do_IRQ()] | 19 | * @handle_irq: highlevel irq-events handler [if NULL, __do_IRQ()] |
| 19 | * @action: the irq action chain | 20 | * @action: the irq action chain |
| 20 | * @status: status information | 21 | * @status: status information |
| 22 | * @core_internal_state__do_not_mess_with_it: core internal status information | ||
| 21 | * @depth: disable-depth, for nested irq_disable() calls | 23 | * @depth: disable-depth, for nested irq_disable() calls |
| 22 | * @wake_depth: enable depth, for multiple set_irq_wake() callers | 24 | * @wake_depth: enable depth, for multiple set_irq_wake() callers |
| 23 | * @irq_count: stats field to detect stalled irqs | 25 | * @irq_count: stats field to detect stalled irqs |
| 24 | * @last_unhandled: aging timer for unhandled count | 26 | * @last_unhandled: aging timer for unhandled count |
| 25 | * @irqs_unhandled: stats field for spurious unhandled interrupts | 27 | * @irqs_unhandled: stats field for spurious unhandled interrupts |
| 26 | * @lock: locking for SMP | 28 | * @lock: locking for SMP |
| 29 | * @affinity_notify: context for notification of affinity changes | ||
| 27 | * @pending_mask: pending rebalanced interrupts | 30 | * @pending_mask: pending rebalanced interrupts |
| 31 | * @threads_oneshot: bitfield to handle shared oneshot threads | ||
| 28 | * @threads_active: number of irqaction threads currently running | 32 | * @threads_active: number of irqaction threads currently running |
| 29 | * @wait_for_threads: wait queue for sync_irq to wait for threaded handlers | 33 | * @wait_for_threads: wait queue for sync_irq to wait for threaded handlers |
| 30 | * @dir: /proc/irq/ procfs entry | 34 | * @dir: /proc/irq/ procfs entry |
| @@ -45,6 +49,7 @@ struct irq_desc { | |||
| 45 | struct { | 49 | struct { |
| 46 | unsigned int irq; | 50 | unsigned int irq; |
| 47 | unsigned int node; | 51 | unsigned int node; |
| 52 | unsigned int pad_do_not_even_think_about_it; | ||
| 48 | struct irq_chip *chip; | 53 | struct irq_chip *chip; |
| 49 | void *handler_data; | 54 | void *handler_data; |
| 50 | void *chip_data; | 55 | void *chip_data; |
| @@ -59,9 +64,16 @@ struct irq_desc { | |||
| 59 | struct timer_rand_state *timer_rand_state; | 64 | struct timer_rand_state *timer_rand_state; |
| 60 | unsigned int __percpu *kstat_irqs; | 65 | unsigned int __percpu *kstat_irqs; |
| 61 | irq_flow_handler_t handle_irq; | 66 | irq_flow_handler_t handle_irq; |
| 67 | #ifdef CONFIG_IRQ_PREFLOW_FASTEOI | ||
| 68 | irq_preflow_handler_t preflow_handler; | ||
| 69 | #endif | ||
| 62 | struct irqaction *action; /* IRQ action list */ | 70 | struct irqaction *action; /* IRQ action list */ |
| 71 | #ifdef CONFIG_GENERIC_HARDIRQS_NO_COMPAT | ||
| 72 | unsigned int status_use_accessors; | ||
| 73 | #else | ||
| 63 | unsigned int status; /* IRQ status */ | 74 | unsigned int status; /* IRQ status */ |
| 64 | 75 | #endif | |
| 76 | unsigned int core_internal_state__do_not_mess_with_it; | ||
| 65 | unsigned int depth; /* nested irq disables */ | 77 | unsigned int depth; /* nested irq disables */ |
| 66 | unsigned int wake_depth; /* nested wake enables */ | 78 | unsigned int wake_depth; /* nested wake enables */ |
| 67 | unsigned int irq_count; /* For detecting broken IRQs */ | 79 | unsigned int irq_count; /* For detecting broken IRQs */ |
| @@ -70,10 +82,12 @@ struct irq_desc { | |||
| 70 | raw_spinlock_t lock; | 82 | raw_spinlock_t lock; |
| 71 | #ifdef CONFIG_SMP | 83 | #ifdef CONFIG_SMP |
| 72 | const struct cpumask *affinity_hint; | 84 | const struct cpumask *affinity_hint; |
| 85 | struct irq_affinity_notify *affinity_notify; | ||
| 73 | #ifdef CONFIG_GENERIC_PENDING_IRQ | 86 | #ifdef CONFIG_GENERIC_PENDING_IRQ |
| 74 | cpumask_var_t pending_mask; | 87 | cpumask_var_t pending_mask; |
| 75 | #endif | 88 | #endif |
| 76 | #endif | 89 | #endif |
| 90 | unsigned long threads_oneshot; | ||
| 77 | atomic_t threads_active; | 91 | atomic_t threads_active; |
| 78 | wait_queue_head_t wait_for_threads; | 92 | wait_queue_head_t wait_for_threads; |
| 79 | #ifdef CONFIG_PROC_FS | 93 | #ifdef CONFIG_PROC_FS |
| @@ -95,10 +109,51 @@ static inline struct irq_desc *move_irq_desc(struct irq_desc *desc, int node) | |||
| 95 | 109 | ||
| 96 | #ifdef CONFIG_GENERIC_HARDIRQS | 110 | #ifdef CONFIG_GENERIC_HARDIRQS |
| 97 | 111 | ||
| 98 | #define get_irq_desc_chip(desc) ((desc)->irq_data.chip) | 112 | static inline struct irq_data *irq_desc_get_irq_data(struct irq_desc *desc) |
| 99 | #define get_irq_desc_chip_data(desc) ((desc)->irq_data.chip_data) | 113 | { |
| 100 | #define get_irq_desc_data(desc) ((desc)->irq_data.handler_data) | 114 | return &desc->irq_data; |
| 101 | #define get_irq_desc_msi(desc) ((desc)->irq_data.msi_desc) | 115 | } |
| 116 | |||
| 117 | static inline struct irq_chip *irq_desc_get_chip(struct irq_desc *desc) | ||
| 118 | { | ||
| 119 | return desc->irq_data.chip; | ||
| 120 | } | ||
| 121 | |||
| 122 | static inline void *irq_desc_get_chip_data(struct irq_desc *desc) | ||
| 123 | { | ||
| 124 | return desc->irq_data.chip_data; | ||
| 125 | } | ||
| 126 | |||
| 127 | static inline void *irq_desc_get_handler_data(struct irq_desc *desc) | ||
| 128 | { | ||
| 129 | return desc->irq_data.handler_data; | ||
| 130 | } | ||
| 131 | |||
| 132 | static inline struct msi_desc *irq_desc_get_msi_desc(struct irq_desc *desc) | ||
| 133 | { | ||
| 134 | return desc->irq_data.msi_desc; | ||
| 135 | } | ||
| 136 | |||
| 137 | #ifndef CONFIG_GENERIC_HARDIRQS_NO_COMPAT | ||
| 138 | static inline struct irq_chip *get_irq_desc_chip(struct irq_desc *desc) | ||
| 139 | { | ||
| 140 | return irq_desc_get_chip(desc); | ||
| 141 | } | ||
| 142 | static inline void *get_irq_desc_data(struct irq_desc *desc) | ||
| 143 | { | ||
| 144 | return irq_desc_get_handler_data(desc); | ||
| 145 | } | ||
| 146 | |||
| 147 | static inline void *get_irq_desc_chip_data(struct irq_desc *desc) | ||
| 148 | { | ||
| 149 | return irq_desc_get_chip_data(desc); | ||
| 150 | } | ||
| 151 | |||
| 152 | static inline struct msi_desc *get_irq_desc_msi(struct irq_desc *desc) | ||
| 153 | { | ||
| 154 | return irq_desc_get_msi_desc(desc); | ||
| 155 | } | ||
| 156 | #endif | ||
| 102 | 157 | ||
| 103 | /* | 158 | /* |
| 104 | * Architectures call this to let the generic IRQ layer | 159 | * Architectures call this to let the generic IRQ layer |
| @@ -123,6 +178,7 @@ static inline int irq_has_action(unsigned int irq) | |||
| 123 | return desc->action != NULL; | 178 | return desc->action != NULL; |
| 124 | } | 179 | } |
| 125 | 180 | ||
| 181 | #ifndef CONFIG_GENERIC_HARDIRQS_NO_COMPAT | ||
| 126 | static inline int irq_balancing_disabled(unsigned int irq) | 182 | static inline int irq_balancing_disabled(unsigned int irq) |
| 127 | { | 183 | { |
| 128 | struct irq_desc *desc; | 184 | struct irq_desc *desc; |
| @@ -130,6 +186,7 @@ static inline int irq_balancing_disabled(unsigned int irq) | |||
| 130 | desc = irq_to_desc(irq); | 186 | desc = irq_to_desc(irq); |
| 131 | return desc->status & IRQ_NO_BALANCING_MASK; | 187 | return desc->status & IRQ_NO_BALANCING_MASK; |
| 132 | } | 188 | } |
| 189 | #endif | ||
| 133 | 190 | ||
| 134 | /* caller has locked the irq_desc and both params are valid */ | 191 | /* caller has locked the irq_desc and both params are valid */ |
| 135 | static inline void __set_irq_handler_unlocked(int irq, | 192 | static inline void __set_irq_handler_unlocked(int irq, |
| @@ -140,6 +197,17 @@ static inline void __set_irq_handler_unlocked(int irq, | |||
| 140 | desc = irq_to_desc(irq); | 197 | desc = irq_to_desc(irq); |
| 141 | desc->handle_irq = handler; | 198 | desc->handle_irq = handler; |
| 142 | } | 199 | } |
| 200 | |||
| 201 | #ifdef CONFIG_IRQ_PREFLOW_FASTEOI | ||
| 202 | static inline void | ||
| 203 | __irq_set_preflow_handler(unsigned int irq, irq_preflow_handler_t handler) | ||
| 204 | { | ||
| 205 | struct irq_desc *desc; | ||
| 206 | |||
| 207 | desc = irq_to_desc(irq); | ||
| 208 | desc->preflow_handler = handler; | ||
| 209 | } | ||
| 210 | #endif | ||
| 143 | #endif | 211 | #endif |
| 144 | 212 | ||
| 145 | #endif | 213 | #endif |
diff --git a/include/linux/jiffies.h b/include/linux/jiffies.h index 6811f4bfc6e7..922aa313c9f9 100644 --- a/include/linux/jiffies.h +++ b/include/linux/jiffies.h | |||
| @@ -307,6 +307,7 @@ extern clock_t jiffies_to_clock_t(long x); | |||
| 307 | extern unsigned long clock_t_to_jiffies(unsigned long x); | 307 | extern unsigned long clock_t_to_jiffies(unsigned long x); |
| 308 | extern u64 jiffies_64_to_clock_t(u64 x); | 308 | extern u64 jiffies_64_to_clock_t(u64 x); |
| 309 | extern u64 nsec_to_clock_t(u64 x); | 309 | extern u64 nsec_to_clock_t(u64 x); |
| 310 | extern u64 nsecs_to_jiffies64(u64 n); | ||
| 310 | extern unsigned long nsecs_to_jiffies(u64 n); | 311 | extern unsigned long nsecs_to_jiffies(u64 n); |
| 311 | 312 | ||
| 312 | #define TIMESTAMP_SIZE 30 | 313 | #define TIMESTAMP_SIZE 30 |
diff --git a/include/linux/kbd_kern.h b/include/linux/kbd_kern.h index 506ad20c18f8..4b0761cc7dd9 100644 --- a/include/linux/kbd_kern.h +++ b/include/linux/kbd_kern.h | |||
| @@ -50,11 +50,12 @@ struct kbd_struct { | |||
| 50 | #define VC_CAPSLOCK 2 /* capslock mode */ | 50 | #define VC_CAPSLOCK 2 /* capslock mode */ |
| 51 | #define VC_KANALOCK 3 /* kanalock mode */ | 51 | #define VC_KANALOCK 3 /* kanalock mode */ |
| 52 | 52 | ||
| 53 | unsigned char kbdmode:2; /* one 2-bit value */ | 53 | unsigned char kbdmode:3; /* one 3-bit value */ |
| 54 | #define VC_XLATE 0 /* translate keycodes using keymap */ | 54 | #define VC_XLATE 0 /* translate keycodes using keymap */ |
| 55 | #define VC_MEDIUMRAW 1 /* medium raw (keycode) mode */ | 55 | #define VC_MEDIUMRAW 1 /* medium raw (keycode) mode */ |
| 56 | #define VC_RAW 2 /* raw (scancode) mode */ | 56 | #define VC_RAW 2 /* raw (scancode) mode */ |
| 57 | #define VC_UNICODE 3 /* Unicode mode */ | 57 | #define VC_UNICODE 3 /* Unicode mode */ |
| 58 | #define VC_OFF 4 /* disabled mode */ | ||
| 58 | 59 | ||
| 59 | unsigned char modeflags:5; | 60 | unsigned char modeflags:5; |
| 60 | #define VC_APPLIC 0 /* application key mode */ | 61 | #define VC_APPLIC 0 /* application key mode */ |
diff --git a/include/linux/kd.h b/include/linux/kd.h index 15f2853ea58f..c36d8476db55 100644 --- a/include/linux/kd.h +++ b/include/linux/kd.h | |||
| @@ -81,6 +81,7 @@ struct unimapinit { | |||
| 81 | #define K_XLATE 0x01 | 81 | #define K_XLATE 0x01 |
| 82 | #define K_MEDIUMRAW 0x02 | 82 | #define K_MEDIUMRAW 0x02 |
| 83 | #define K_UNICODE 0x03 | 83 | #define K_UNICODE 0x03 |
| 84 | #define K_OFF 0x04 | ||
| 84 | #define KDGKBMODE 0x4B44 /* gets current keyboard mode */ | 85 | #define KDGKBMODE 0x4B44 /* gets current keyboard mode */ |
| 85 | #define KDSKBMODE 0x4B45 /* sets current keyboard mode */ | 86 | #define KDSKBMODE 0x4B45 /* sets current keyboard mode */ |
| 86 | 87 | ||
diff --git a/include/linux/key-type.h b/include/linux/key-type.h index 65833d4d5998..9efd081bb31e 100644 --- a/include/linux/key-type.h +++ b/include/linux/key-type.h | |||
| @@ -41,6 +41,9 @@ struct key_type { | |||
| 41 | */ | 41 | */ |
| 42 | size_t def_datalen; | 42 | size_t def_datalen; |
| 43 | 43 | ||
| 44 | /* vet a description */ | ||
| 45 | int (*vet_description)(const char *description); | ||
| 46 | |||
| 44 | /* instantiate a key of this type | 47 | /* instantiate a key of this type |
| 45 | * - this method should call key_payload_reserve() to determine if the | 48 | * - this method should call key_payload_reserve() to determine if the |
| 46 | * user's quota will hold the payload | 49 | * user's quota will hold the payload |
| @@ -102,11 +105,20 @@ extern int key_instantiate_and_link(struct key *key, | |||
| 102 | size_t datalen, | 105 | size_t datalen, |
| 103 | struct key *keyring, | 106 | struct key *keyring, |
| 104 | struct key *instkey); | 107 | struct key *instkey); |
| 105 | extern int key_negate_and_link(struct key *key, | 108 | extern int key_reject_and_link(struct key *key, |
| 106 | unsigned timeout, | 109 | unsigned timeout, |
| 110 | unsigned error, | ||
| 107 | struct key *keyring, | 111 | struct key *keyring, |
| 108 | struct key *instkey); | 112 | struct key *instkey); |
| 109 | extern void complete_request_key(struct key_construction *cons, int error); | 113 | extern void complete_request_key(struct key_construction *cons, int error); |
| 110 | 114 | ||
| 115 | static inline int key_negate_and_link(struct key *key, | ||
| 116 | unsigned timeout, | ||
| 117 | struct key *keyring, | ||
| 118 | struct key *instkey) | ||
| 119 | { | ||
| 120 | return key_reject_and_link(key, timeout, ENOKEY, keyring, instkey); | ||
| 121 | } | ||
| 122 | |||
| 111 | #endif /* CONFIG_KEYS */ | 123 | #endif /* CONFIG_KEYS */ |
| 112 | #endif /* _LINUX_KEY_TYPE_H */ | 124 | #endif /* _LINUX_KEY_TYPE_H */ |
diff --git a/include/linux/key.h b/include/linux/key.h index 3db0adce1fda..b2bb01719561 100644 --- a/include/linux/key.h +++ b/include/linux/key.h | |||
| @@ -170,6 +170,7 @@ struct key { | |||
| 170 | struct list_head link; | 170 | struct list_head link; |
| 171 | unsigned long x[2]; | 171 | unsigned long x[2]; |
| 172 | void *p[2]; | 172 | void *p[2]; |
| 173 | int reject_error; | ||
| 173 | } type_data; | 174 | } type_data; |
| 174 | 175 | ||
| 175 | /* key data | 176 | /* key data |
| @@ -275,6 +276,10 @@ static inline key_serial_t key_serial(struct key *key) | |||
| 275 | return key ? key->serial : 0; | 276 | return key ? key->serial : 0; |
| 276 | } | 277 | } |
| 277 | 278 | ||
| 279 | #define rcu_dereference_key(KEY) \ | ||
| 280 | (rcu_dereference_protected((KEY)->payload.rcudata, \ | ||
| 281 | rwsem_is_locked(&((struct key *)(KEY))->sem))) | ||
| 282 | |||
| 278 | #ifdef CONFIG_SYSCTL | 283 | #ifdef CONFIG_SYSCTL |
| 279 | extern ctl_table key_sysctls[]; | 284 | extern ctl_table key_sysctls[]; |
| 280 | #endif | 285 | #endif |
diff --git a/include/linux/keyctl.h b/include/linux/keyctl.h index bd383f1944fb..9b0b865ce622 100644 --- a/include/linux/keyctl.h +++ b/include/linux/keyctl.h | |||
| @@ -53,5 +53,7 @@ | |||
| 53 | #define KEYCTL_ASSUME_AUTHORITY 16 /* assume request_key() authorisation */ | 53 | #define KEYCTL_ASSUME_AUTHORITY 16 /* assume request_key() authorisation */ |
| 54 | #define KEYCTL_GET_SECURITY 17 /* get key security label */ | 54 | #define KEYCTL_GET_SECURITY 17 /* get key security label */ |
| 55 | #define KEYCTL_SESSION_TO_PARENT 18 /* apply session keyring to parent process */ | 55 | #define KEYCTL_SESSION_TO_PARENT 18 /* apply session keyring to parent process */ |
| 56 | #define KEYCTL_REJECT 19 /* reject a partially constructed key */ | ||
| 57 | #define KEYCTL_INSTANTIATE_IOV 20 /* instantiate a partially constructed key */ | ||
| 56 | 58 | ||
| 57 | #endif /* _LINUX_KEYCTL_H */ | 59 | #endif /* _LINUX_KEYCTL_H */ |
diff --git a/include/linux/kobject.h b/include/linux/kobject.h index 8f6d12151048..9229b64ee3aa 100644 --- a/include/linux/kobject.h +++ b/include/linux/kobject.h | |||
| @@ -85,11 +85,13 @@ static inline const char *kobject_name(const struct kobject *kobj) | |||
| 85 | extern void kobject_init(struct kobject *kobj, struct kobj_type *ktype); | 85 | extern void kobject_init(struct kobject *kobj, struct kobj_type *ktype); |
| 86 | extern int __must_check kobject_add(struct kobject *kobj, | 86 | extern int __must_check kobject_add(struct kobject *kobj, |
| 87 | struct kobject *parent, | 87 | struct kobject *parent, |
| 88 | const char *fmt, ...); | 88 | const char *fmt, ...) |
| 89 | __attribute__((format(printf, 3, 4))); | ||
| 89 | extern int __must_check kobject_init_and_add(struct kobject *kobj, | 90 | extern int __must_check kobject_init_and_add(struct kobject *kobj, |
| 90 | struct kobj_type *ktype, | 91 | struct kobj_type *ktype, |
| 91 | struct kobject *parent, | 92 | struct kobject *parent, |
| 92 | const char *fmt, ...); | 93 | const char *fmt, ...) |
| 94 | __attribute__((format(printf, 4, 5))); | ||
| 93 | 95 | ||
| 94 | extern void kobject_del(struct kobject *kobj); | 96 | extern void kobject_del(struct kobject *kobj); |
| 95 | 97 | ||
| @@ -224,8 +226,8 @@ static inline int kobject_uevent_env(struct kobject *kobj, | |||
| 224 | char *envp[]) | 226 | char *envp[]) |
| 225 | { return 0; } | 227 | { return 0; } |
| 226 | 228 | ||
| 227 | static inline int add_uevent_var(struct kobj_uevent_env *env, | 229 | static inline __attribute__((format(printf, 2, 3))) |
| 228 | const char *format, ...) | 230 | int add_uevent_var(struct kobj_uevent_env *env, const char *format, ...) |
| 229 | { return 0; } | 231 | { return 0; } |
| 230 | 232 | ||
| 231 | static inline int kobject_action_type(const char *buf, size_t count, | 233 | static inline int kobject_action_type(const char *buf, size_t count, |
diff --git a/include/linux/kthread.h b/include/linux/kthread.h index ce0775aa64c3..7ff16f7d3ed4 100644 --- a/include/linux/kthread.h +++ b/include/linux/kthread.h | |||
| @@ -64,7 +64,7 @@ struct kthread_work { | |||
| 64 | }; | 64 | }; |
| 65 | 65 | ||
| 66 | #define KTHREAD_WORKER_INIT(worker) { \ | 66 | #define KTHREAD_WORKER_INIT(worker) { \ |
| 67 | .lock = SPIN_LOCK_UNLOCKED, \ | 67 | .lock = __SPIN_LOCK_UNLOCKED((worker).lock), \ |
| 68 | .work_list = LIST_HEAD_INIT((worker).work_list), \ | 68 | .work_list = LIST_HEAD_INIT((worker).work_list), \ |
| 69 | } | 69 | } |
| 70 | 70 | ||
diff --git a/include/linux/libata.h b/include/linux/libata.h index c9c5d7ad1a2b..c71f46960f39 100644 --- a/include/linux/libata.h +++ b/include/linux/libata.h | |||
| @@ -179,10 +179,6 @@ enum { | |||
| 179 | ATA_FLAG_SLAVE_POSS = (1 << 0), /* host supports slave dev */ | 179 | ATA_FLAG_SLAVE_POSS = (1 << 0), /* host supports slave dev */ |
| 180 | /* (doesn't imply presence) */ | 180 | /* (doesn't imply presence) */ |
| 181 | ATA_FLAG_SATA = (1 << 1), | 181 | ATA_FLAG_SATA = (1 << 1), |
| 182 | ATA_FLAG_NO_LEGACY = (1 << 2), /* no legacy mode check */ | ||
| 183 | ATA_FLAG_MMIO = (1 << 3), /* use MMIO, not PIO */ | ||
| 184 | ATA_FLAG_SRST = (1 << 4), /* (obsolete) use ATA SRST, not E.D.D. */ | ||
| 185 | ATA_FLAG_SATA_RESET = (1 << 5), /* (obsolete) use COMRESET */ | ||
| 186 | ATA_FLAG_NO_ATAPI = (1 << 6), /* No ATAPI support */ | 182 | ATA_FLAG_NO_ATAPI = (1 << 6), /* No ATAPI support */ |
| 187 | ATA_FLAG_PIO_DMA = (1 << 7), /* PIO cmds via DMA */ | 183 | ATA_FLAG_PIO_DMA = (1 << 7), /* PIO cmds via DMA */ |
| 188 | ATA_FLAG_PIO_LBA48 = (1 << 8), /* Host DMA engine is LBA28 only */ | 184 | ATA_FLAG_PIO_LBA48 = (1 << 8), /* Host DMA engine is LBA28 only */ |
| @@ -198,7 +194,6 @@ enum { | |||
| 198 | ATA_FLAG_ACPI_SATA = (1 << 17), /* need native SATA ACPI layout */ | 194 | ATA_FLAG_ACPI_SATA = (1 << 17), /* need native SATA ACPI layout */ |
| 199 | ATA_FLAG_AN = (1 << 18), /* controller supports AN */ | 195 | ATA_FLAG_AN = (1 << 18), /* controller supports AN */ |
| 200 | ATA_FLAG_PMP = (1 << 19), /* controller supports PMP */ | 196 | ATA_FLAG_PMP = (1 << 19), /* controller supports PMP */ |
| 201 | ATA_FLAG_LPM = (1 << 20), /* driver can handle LPM */ | ||
| 202 | ATA_FLAG_EM = (1 << 21), /* driver supports enclosure | 197 | ATA_FLAG_EM = (1 << 21), /* driver supports enclosure |
| 203 | * management */ | 198 | * management */ |
| 204 | ATA_FLAG_SW_ACTIVITY = (1 << 22), /* driver supports sw activity | 199 | ATA_FLAG_SW_ACTIVITY = (1 << 22), /* driver supports sw activity |
| @@ -1050,6 +1045,8 @@ extern int ata_scsi_change_queue_depth(struct scsi_device *sdev, | |||
| 1050 | int queue_depth, int reason); | 1045 | int queue_depth, int reason); |
| 1051 | extern struct ata_device *ata_dev_pair(struct ata_device *adev); | 1046 | extern struct ata_device *ata_dev_pair(struct ata_device *adev); |
| 1052 | extern int ata_do_set_mode(struct ata_link *link, struct ata_device **r_failed_dev); | 1047 | extern int ata_do_set_mode(struct ata_link *link, struct ata_device **r_failed_dev); |
| 1048 | extern void ata_scsi_port_error_handler(struct Scsi_Host *host, struct ata_port *ap); | ||
| 1049 | extern void ata_scsi_cmd_error_handler(struct Scsi_Host *host, struct ata_port *ap, struct list_head *eh_q); | ||
| 1053 | 1050 | ||
| 1054 | extern int ata_cable_40wire(struct ata_port *ap); | 1051 | extern int ata_cable_40wire(struct ata_port *ap); |
| 1055 | extern int ata_cable_80wire(struct ata_port *ap); | 1052 | extern int ata_cable_80wire(struct ata_port *ap); |
| @@ -1613,6 +1610,9 @@ extern void ata_sff_irq_on(struct ata_port *ap); | |||
| 1613 | extern void ata_sff_irq_clear(struct ata_port *ap); | 1610 | extern void ata_sff_irq_clear(struct ata_port *ap); |
| 1614 | extern int ata_sff_hsm_move(struct ata_port *ap, struct ata_queued_cmd *qc, | 1611 | extern int ata_sff_hsm_move(struct ata_port *ap, struct ata_queued_cmd *qc, |
| 1615 | u8 status, int in_wq); | 1612 | u8 status, int in_wq); |
| 1613 | extern void ata_sff_queue_work(struct work_struct *work); | ||
| 1614 | extern void ata_sff_queue_delayed_work(struct delayed_work *dwork, | ||
| 1615 | unsigned long delay); | ||
| 1616 | extern void ata_sff_queue_pio_task(struct ata_link *link, unsigned long delay); | 1616 | extern void ata_sff_queue_pio_task(struct ata_link *link, unsigned long delay); |
| 1617 | extern unsigned int ata_sff_qc_issue(struct ata_queued_cmd *qc); | 1617 | extern unsigned int ata_sff_qc_issue(struct ata_queued_cmd *qc); |
| 1618 | extern bool ata_sff_qc_fill_rtf(struct ata_queued_cmd *qc); | 1618 | extern bool ata_sff_qc_fill_rtf(struct ata_queued_cmd *qc); |
diff --git a/include/linux/list.h b/include/linux/list.h index 9a5f8a71810c..3a54266a1e85 100644 --- a/include/linux/list.h +++ b/include/linux/list.h | |||
| @@ -96,6 +96,11 @@ static inline void __list_del(struct list_head * prev, struct list_head * next) | |||
| 96 | * in an undefined state. | 96 | * in an undefined state. |
| 97 | */ | 97 | */ |
| 98 | #ifndef CONFIG_DEBUG_LIST | 98 | #ifndef CONFIG_DEBUG_LIST |
| 99 | static inline void __list_del_entry(struct list_head *entry) | ||
| 100 | { | ||
| 101 | __list_del(entry->prev, entry->next); | ||
| 102 | } | ||
| 103 | |||
| 99 | static inline void list_del(struct list_head *entry) | 104 | static inline void list_del(struct list_head *entry) |
| 100 | { | 105 | { |
| 101 | __list_del(entry->prev, entry->next); | 106 | __list_del(entry->prev, entry->next); |
| @@ -103,6 +108,7 @@ static inline void list_del(struct list_head *entry) | |||
| 103 | entry->prev = LIST_POISON2; | 108 | entry->prev = LIST_POISON2; |
| 104 | } | 109 | } |
| 105 | #else | 110 | #else |
| 111 | extern void __list_del_entry(struct list_head *entry); | ||
| 106 | extern void list_del(struct list_head *entry); | 112 | extern void list_del(struct list_head *entry); |
| 107 | #endif | 113 | #endif |
| 108 | 114 | ||
| @@ -135,7 +141,7 @@ static inline void list_replace_init(struct list_head *old, | |||
| 135 | */ | 141 | */ |
| 136 | static inline void list_del_init(struct list_head *entry) | 142 | static inline void list_del_init(struct list_head *entry) |
| 137 | { | 143 | { |
| 138 | __list_del(entry->prev, entry->next); | 144 | __list_del_entry(entry); |
| 139 | INIT_LIST_HEAD(entry); | 145 | INIT_LIST_HEAD(entry); |
| 140 | } | 146 | } |
| 141 | 147 | ||
| @@ -146,7 +152,7 @@ static inline void list_del_init(struct list_head *entry) | |||
| 146 | */ | 152 | */ |
| 147 | static inline void list_move(struct list_head *list, struct list_head *head) | 153 | static inline void list_move(struct list_head *list, struct list_head *head) |
| 148 | { | 154 | { |
| 149 | __list_del(list->prev, list->next); | 155 | __list_del_entry(list); |
| 150 | list_add(list, head); | 156 | list_add(list, head); |
| 151 | } | 157 | } |
| 152 | 158 | ||
| @@ -158,7 +164,7 @@ static inline void list_move(struct list_head *list, struct list_head *head) | |||
| 158 | static inline void list_move_tail(struct list_head *list, | 164 | static inline void list_move_tail(struct list_head *list, |
| 159 | struct list_head *head) | 165 | struct list_head *head) |
| 160 | { | 166 | { |
| 161 | __list_del(list->prev, list->next); | 167 | __list_del_entry(list); |
| 162 | list_add_tail(list, head); | 168 | list_add_tail(list, head); |
| 163 | } | 169 | } |
| 164 | 170 | ||
diff --git a/include/linux/magic.h b/include/linux/magic.h index 62730ea2b56e..6cfe344f9559 100644 --- a/include/linux/magic.h +++ b/include/linux/magic.h | |||
| @@ -27,6 +27,7 @@ | |||
| 27 | #define ISOFS_SUPER_MAGIC 0x9660 | 27 | #define ISOFS_SUPER_MAGIC 0x9660 |
| 28 | #define JFFS2_SUPER_MAGIC 0x72b6 | 28 | #define JFFS2_SUPER_MAGIC 0x72b6 |
| 29 | #define ANON_INODE_FS_MAGIC 0x09041934 | 29 | #define ANON_INODE_FS_MAGIC 0x09041934 |
| 30 | #define PSTOREFS_MAGIC 0x6165676C | ||
| 30 | 31 | ||
| 31 | #define MINIX_SUPER_MAGIC 0x137F /* original minix fs */ | 32 | #define MINIX_SUPER_MAGIC 0x137F /* original minix fs */ |
| 32 | #define MINIX_SUPER_MAGIC2 0x138F /* minix fs, 30 char names */ | 33 | #define MINIX_SUPER_MAGIC2 0x138F /* minix fs, 30 char names */ |
diff --git a/include/linux/memory.h b/include/linux/memory.h index 06c1fa0a5c7b..e1e3b2b84f85 100644 --- a/include/linux/memory.h +++ b/include/linux/memory.h | |||
| @@ -21,7 +21,8 @@ | |||
| 21 | #include <linux/mutex.h> | 21 | #include <linux/mutex.h> |
| 22 | 22 | ||
| 23 | struct memory_block { | 23 | struct memory_block { |
| 24 | unsigned long phys_index; | 24 | unsigned long start_section_nr; |
| 25 | unsigned long end_section_nr; | ||
| 25 | unsigned long state; | 26 | unsigned long state; |
| 26 | int section_count; | 27 | int section_count; |
| 27 | 28 | ||
diff --git a/include/linux/mfd/wm8994/core.h b/include/linux/mfd/wm8994/core.h index 3fd36845ca45..ef4f0b6083a3 100644 --- a/include/linux/mfd/wm8994/core.h +++ b/include/linux/mfd/wm8994/core.h | |||
| @@ -71,6 +71,7 @@ struct wm8994 { | |||
| 71 | u16 irq_masks_cache[WM8994_NUM_IRQ_REGS]; | 71 | u16 irq_masks_cache[WM8994_NUM_IRQ_REGS]; |
| 72 | 72 | ||
| 73 | /* Used over suspend/resume */ | 73 | /* Used over suspend/resume */ |
| 74 | bool suspended; | ||
| 74 | u16 ldo_regs[WM8994_NUM_LDO_REGS]; | 75 | u16 ldo_regs[WM8994_NUM_LDO_REGS]; |
| 75 | u16 gpio_regs[WM8994_NUM_GPIO_REGS]; | 76 | u16 gpio_regs[WM8994_NUM_GPIO_REGS]; |
| 76 | 77 | ||
diff --git a/include/linux/micrel_phy.h b/include/linux/micrel_phy.h new file mode 100644 index 000000000000..dd8da342a991 --- /dev/null +++ b/include/linux/micrel_phy.h | |||
| @@ -0,0 +1,16 @@ | |||
| 1 | #ifndef _MICREL_PHY_H | ||
| 2 | #define _MICREL_PHY_H | ||
| 3 | |||
| 4 | #define MICREL_PHY_ID_MASK 0x00fffff0 | ||
| 5 | |||
| 6 | #define PHY_ID_KSZ9021 0x00221611 | ||
| 7 | #define PHY_ID_KS8737 0x00221720 | ||
| 8 | #define PHY_ID_KS8041 0x00221510 | ||
| 9 | #define PHY_ID_KS8051 0x00221550 | ||
| 10 | /* both for ks8001 Rev. A/B, and for ks8721 Rev 3. */ | ||
| 11 | #define PHY_ID_KS8001 0x0022161A | ||
| 12 | |||
| 13 | /* struct phy_device dev_flags definitions */ | ||
| 14 | #define MICREL_PHY_50MHZ_CLK 0x00000001 | ||
| 15 | |||
| 16 | #endif /* _MICREL_PHY_H */ | ||
diff --git a/include/linux/mm.h b/include/linux/mm.h index f6385fc17ad4..679300c050f5 100644 --- a/include/linux/mm.h +++ b/include/linux/mm.h | |||
| @@ -1309,8 +1309,6 @@ int add_from_early_node_map(struct range *range, int az, | |||
| 1309 | int nr_range, int nid); | 1309 | int nr_range, int nid); |
| 1310 | u64 __init find_memory_core_early(int nid, u64 size, u64 align, | 1310 | u64 __init find_memory_core_early(int nid, u64 size, u64 align, |
| 1311 | u64 goal, u64 limit); | 1311 | u64 goal, u64 limit); |
| 1312 | void *__alloc_memory_core_early(int nodeid, u64 size, u64 align, | ||
| 1313 | u64 goal, u64 limit); | ||
| 1314 | typedef int (*work_fn_t)(unsigned long, unsigned long, void *); | 1312 | typedef int (*work_fn_t)(unsigned long, unsigned long, void *); |
| 1315 | extern void work_with_active_regions(int nid, work_fn_t work_fn, void *data); | 1313 | extern void work_with_active_regions(int nid, work_fn_t work_fn, void *data); |
| 1316 | extern void sparse_memory_present_with_active_regions(int nid); | 1314 | extern void sparse_memory_present_with_active_regions(int nid); |
diff --git a/include/linux/module.h b/include/linux/module.h index 9bdf27c7615b..5de42043dff0 100644 --- a/include/linux/module.h +++ b/include/linux/module.h | |||
| @@ -62,7 +62,7 @@ struct module_version_attribute { | |||
| 62 | struct module_attribute mattr; | 62 | struct module_attribute mattr; |
| 63 | const char *module_name; | 63 | const char *module_name; |
| 64 | const char *version; | 64 | const char *version; |
| 65 | }; | 65 | } __attribute__ ((__aligned__(sizeof(void *)))); |
| 66 | 66 | ||
| 67 | struct module_kobject | 67 | struct module_kobject |
| 68 | { | 68 | { |
diff --git a/include/linux/namei.h b/include/linux/namei.h index f276d4fa01fc..9c8603872c36 100644 --- a/include/linux/namei.h +++ b/include/linux/namei.h | |||
| @@ -19,7 +19,6 @@ struct nameidata { | |||
| 19 | struct path path; | 19 | struct path path; |
| 20 | struct qstr last; | 20 | struct qstr last; |
| 21 | struct path root; | 21 | struct path root; |
| 22 | struct file *file; | ||
| 23 | struct inode *inode; /* path.dentry.d_inode */ | 22 | struct inode *inode; /* path.dentry.d_inode */ |
| 24 | unsigned int flags; | 23 | unsigned int flags; |
| 25 | unsigned seq; | 24 | unsigned seq; |
| @@ -63,6 +62,10 @@ enum {LAST_NORM, LAST_ROOT, LAST_DOT, LAST_DOTDOT, LAST_BIND}; | |||
| 63 | #define LOOKUP_EXCL 0x0400 | 62 | #define LOOKUP_EXCL 0x0400 |
| 64 | #define LOOKUP_RENAME_TARGET 0x0800 | 63 | #define LOOKUP_RENAME_TARGET 0x0800 |
| 65 | 64 | ||
| 65 | #define LOOKUP_JUMPED 0x1000 | ||
| 66 | #define LOOKUP_ROOT 0x2000 | ||
| 67 | #define LOOKUP_EMPTY 0x4000 | ||
| 68 | |||
| 66 | extern int user_path_at(int, const char __user *, unsigned, struct path *); | 69 | extern int user_path_at(int, const char __user *, unsigned, struct path *); |
| 67 | 70 | ||
| 68 | #define user_path(name, path) user_path_at(AT_FDCWD, name, LOOKUP_FOLLOW, path) | 71 | #define user_path(name, path) user_path_at(AT_FDCWD, name, LOOKUP_FOLLOW, path) |
| @@ -72,7 +75,7 @@ extern int user_path_at(int, const char __user *, unsigned, struct path *); | |||
| 72 | 75 | ||
| 73 | extern int kern_path(const char *, unsigned, struct path *); | 76 | extern int kern_path(const char *, unsigned, struct path *); |
| 74 | 77 | ||
| 75 | extern int path_lookup(const char *, unsigned, struct nameidata *); | 78 | extern int kern_path_parent(const char *, struct nameidata *); |
| 76 | extern int vfs_path_lookup(struct dentry *, struct vfsmount *, | 79 | extern int vfs_path_lookup(struct dentry *, struct vfsmount *, |
| 77 | const char *, unsigned int, struct nameidata *); | 80 | const char *, unsigned int, struct nameidata *); |
| 78 | 81 | ||
diff --git a/include/linux/net.h b/include/linux/net.h index 16faa130088c..94de83c0f877 100644 --- a/include/linux/net.h +++ b/include/linux/net.h | |||
| @@ -118,6 +118,7 @@ enum sock_shutdown_cmd { | |||
| 118 | }; | 118 | }; |
| 119 | 119 | ||
| 120 | struct socket_wq { | 120 | struct socket_wq { |
| 121 | /* Note: wait MUST be first field of socket_wq */ | ||
| 121 | wait_queue_head_t wait; | 122 | wait_queue_head_t wait; |
| 122 | struct fasync_struct *fasync_list; | 123 | struct fasync_struct *fasync_list; |
| 123 | struct rcu_head rcu; | 124 | struct rcu_head rcu; |
| @@ -142,7 +143,7 @@ struct socket { | |||
| 142 | 143 | ||
| 143 | unsigned long flags; | 144 | unsigned long flags; |
| 144 | 145 | ||
| 145 | struct socket_wq *wq; | 146 | struct socket_wq __rcu *wq; |
| 146 | 147 | ||
| 147 | struct file *file; | 148 | struct file *file; |
| 148 | struct sock *sk; | 149 | struct sock *sk; |
diff --git a/include/linux/netdevice.h b/include/linux/netdevice.h index d971346b0340..5eeb2cd3631c 100644 --- a/include/linux/netdevice.h +++ b/include/linux/netdevice.h | |||
| @@ -138,6 +138,9 @@ static inline bool dev_xmit_complete(int rc) | |||
| 138 | 138 | ||
| 139 | #define MAX_ADDR_LEN 32 /* Largest hardware address length */ | 139 | #define MAX_ADDR_LEN 32 /* Largest hardware address length */ |
| 140 | 140 | ||
| 141 | /* Initial net device group. All devices belong to group 0 by default. */ | ||
| 142 | #define INIT_NETDEV_GROUP 0 | ||
| 143 | |||
| 141 | #ifdef __KERNEL__ | 144 | #ifdef __KERNEL__ |
| 142 | /* | 145 | /* |
| 143 | * Compute the worst case header length according to the protocols | 146 | * Compute the worst case header length according to the protocols |
| @@ -387,7 +390,55 @@ enum gro_result { | |||
| 387 | }; | 390 | }; |
| 388 | typedef enum gro_result gro_result_t; | 391 | typedef enum gro_result gro_result_t; |
| 389 | 392 | ||
| 390 | typedef struct sk_buff *rx_handler_func_t(struct sk_buff *skb); | 393 | /* |
| 394 | * enum rx_handler_result - Possible return values for rx_handlers. | ||
| 395 | * @RX_HANDLER_CONSUMED: skb was consumed by rx_handler, do not process it | ||
| 396 | * further. | ||
| 397 | * @RX_HANDLER_ANOTHER: Do another round in receive path. This is indicated in | ||
| 398 | * case skb->dev was changed by rx_handler. | ||
| 399 | * @RX_HANDLER_EXACT: Force exact delivery, no wildcard. | ||
| 400 | * @RX_HANDLER_PASS: Do nothing, passe the skb as if no rx_handler was called. | ||
| 401 | * | ||
| 402 | * rx_handlers are functions called from inside __netif_receive_skb(), to do | ||
| 403 | * special processing of the skb, prior to delivery to protocol handlers. | ||
| 404 | * | ||
| 405 | * Currently, a net_device can only have a single rx_handler registered. Trying | ||
| 406 | * to register a second rx_handler will return -EBUSY. | ||
| 407 | * | ||
| 408 | * To register a rx_handler on a net_device, use netdev_rx_handler_register(). | ||
| 409 | * To unregister a rx_handler on a net_device, use | ||
| 410 | * netdev_rx_handler_unregister(). | ||
| 411 | * | ||
| 412 | * Upon return, rx_handler is expected to tell __netif_receive_skb() what to | ||
| 413 | * do with the skb. | ||
| 414 | * | ||
| 415 | * If the rx_handler consumed to skb in some way, it should return | ||
| 416 | * RX_HANDLER_CONSUMED. This is appropriate when the rx_handler arranged for | ||
| 417 | * the skb to be delivered in some other ways. | ||
| 418 | * | ||
| 419 | * If the rx_handler changed skb->dev, to divert the skb to another | ||
| 420 | * net_device, it should return RX_HANDLER_ANOTHER. The rx_handler for the | ||
| 421 | * new device will be called if it exists. | ||
| 422 | * | ||
| 423 | * If the rx_handler consider the skb should be ignored, it should return | ||
| 424 | * RX_HANDLER_EXACT. The skb will only be delivered to protocol handlers that | ||
| 425 | * are registred on exact device (ptype->dev == skb->dev). | ||
| 426 | * | ||
| 427 | * If the rx_handler didn't changed skb->dev, but want the skb to be normally | ||
| 428 | * delivered, it should return RX_HANDLER_PASS. | ||
| 429 | * | ||
| 430 | * A device without a registered rx_handler will behave as if rx_handler | ||
| 431 | * returned RX_HANDLER_PASS. | ||
| 432 | */ | ||
| 433 | |||
| 434 | enum rx_handler_result { | ||
| 435 | RX_HANDLER_CONSUMED, | ||
| 436 | RX_HANDLER_ANOTHER, | ||
| 437 | RX_HANDLER_EXACT, | ||
| 438 | RX_HANDLER_PASS, | ||
| 439 | }; | ||
| 440 | typedef enum rx_handler_result rx_handler_result_t; | ||
| 441 | typedef rx_handler_result_t rx_handler_func_t(struct sk_buff **pskb); | ||
| 391 | 442 | ||
| 392 | extern void __napi_schedule(struct napi_struct *n); | 443 | extern void __napi_schedule(struct napi_struct *n); |
| 393 | 444 | ||
| @@ -551,14 +602,16 @@ struct rps_map { | |||
| 551 | #define RPS_MAP_SIZE(_num) (sizeof(struct rps_map) + (_num * sizeof(u16))) | 602 | #define RPS_MAP_SIZE(_num) (sizeof(struct rps_map) + (_num * sizeof(u16))) |
| 552 | 603 | ||
| 553 | /* | 604 | /* |
| 554 | * The rps_dev_flow structure contains the mapping of a flow to a CPU and the | 605 | * The rps_dev_flow structure contains the mapping of a flow to a CPU, the |
| 555 | * tail pointer for that CPU's input queue at the time of last enqueue. | 606 | * tail pointer for that CPU's input queue at the time of last enqueue, and |
| 607 | * a hardware filter index. | ||
| 556 | */ | 608 | */ |
| 557 | struct rps_dev_flow { | 609 | struct rps_dev_flow { |
| 558 | u16 cpu; | 610 | u16 cpu; |
| 559 | u16 fill; | 611 | u16 filter; |
| 560 | unsigned int last_qtail; | 612 | unsigned int last_qtail; |
| 561 | }; | 613 | }; |
| 614 | #define RPS_NO_FILTER 0xffff | ||
| 562 | 615 | ||
| 563 | /* | 616 | /* |
| 564 | * The rps_dev_flow_table structure contains a table of flow mappings. | 617 | * The rps_dev_flow_table structure contains a table of flow mappings. |
| @@ -608,6 +661,11 @@ static inline void rps_reset_sock_flow(struct rps_sock_flow_table *table, | |||
| 608 | 661 | ||
| 609 | extern struct rps_sock_flow_table __rcu *rps_sock_flow_table; | 662 | extern struct rps_sock_flow_table __rcu *rps_sock_flow_table; |
| 610 | 663 | ||
| 664 | #ifdef CONFIG_RFS_ACCEL | ||
| 665 | extern bool rps_may_expire_flow(struct net_device *dev, u16 rxq_index, | ||
| 666 | u32 flow_id, u16 filter_id); | ||
| 667 | #endif | ||
| 668 | |||
| 611 | /* This structure contains an instance of an RX queue. */ | 669 | /* This structure contains an instance of an RX queue. */ |
| 612 | struct netdev_rx_queue { | 670 | struct netdev_rx_queue { |
| 613 | struct rps_map __rcu *rps_map; | 671 | struct rps_map __rcu *rps_map; |
| @@ -643,6 +701,14 @@ struct xps_dev_maps { | |||
| 643 | (nr_cpu_ids * sizeof(struct xps_map *))) | 701 | (nr_cpu_ids * sizeof(struct xps_map *))) |
| 644 | #endif /* CONFIG_XPS */ | 702 | #endif /* CONFIG_XPS */ |
| 645 | 703 | ||
| 704 | #define TC_MAX_QUEUE 16 | ||
| 705 | #define TC_BITMASK 15 | ||
| 706 | /* HW offloaded queuing disciplines txq count and offset maps */ | ||
| 707 | struct netdev_tc_txq { | ||
| 708 | u16 count; | ||
| 709 | u16 offset; | ||
| 710 | }; | ||
| 711 | |||
| 646 | /* | 712 | /* |
| 647 | * This structure defines the management hooks for network devices. | 713 | * This structure defines the management hooks for network devices. |
| 648 | * The following hooks can be defined; unless noted otherwise, they are | 714 | * The following hooks can be defined; unless noted otherwise, they are |
| @@ -753,6 +819,74 @@ struct xps_dev_maps { | |||
| 753 | * int (*ndo_set_vf_port)(struct net_device *dev, int vf, | 819 | * int (*ndo_set_vf_port)(struct net_device *dev, int vf, |
| 754 | * struct nlattr *port[]); | 820 | * struct nlattr *port[]); |
| 755 | * int (*ndo_get_vf_port)(struct net_device *dev, int vf, struct sk_buff *skb); | 821 | * int (*ndo_get_vf_port)(struct net_device *dev, int vf, struct sk_buff *skb); |
| 822 | * int (*ndo_setup_tc)(struct net_device *dev, u8 tc) | ||
| 823 | * Called to setup 'tc' number of traffic classes in the net device. This | ||
| 824 | * is always called from the stack with the rtnl lock held and netif tx | ||
| 825 | * queues stopped. This allows the netdevice to perform queue management | ||
| 826 | * safely. | ||
| 827 | * | ||
| 828 | * Fiber Channel over Ethernet (FCoE) offload functions. | ||
| 829 | * int (*ndo_fcoe_enable)(struct net_device *dev); | ||
| 830 | * Called when the FCoE protocol stack wants to start using LLD for FCoE | ||
| 831 | * so the underlying device can perform whatever needed configuration or | ||
| 832 | * initialization to support acceleration of FCoE traffic. | ||
| 833 | * | ||
| 834 | * int (*ndo_fcoe_disable)(struct net_device *dev); | ||
| 835 | * Called when the FCoE protocol stack wants to stop using LLD for FCoE | ||
| 836 | * so the underlying device can perform whatever needed clean-ups to | ||
| 837 | * stop supporting acceleration of FCoE traffic. | ||
| 838 | * | ||
| 839 | * int (*ndo_fcoe_ddp_setup)(struct net_device *dev, u16 xid, | ||
| 840 | * struct scatterlist *sgl, unsigned int sgc); | ||
| 841 | * Called when the FCoE Initiator wants to initialize an I/O that | ||
| 842 | * is a possible candidate for Direct Data Placement (DDP). The LLD can | ||
| 843 | * perform necessary setup and returns 1 to indicate the device is set up | ||
| 844 | * successfully to perform DDP on this I/O, otherwise this returns 0. | ||
| 845 | * | ||
| 846 | * int (*ndo_fcoe_ddp_done)(struct net_device *dev, u16 xid); | ||
| 847 | * Called when the FCoE Initiator/Target is done with the DDPed I/O as | ||
| 848 | * indicated by the FC exchange id 'xid', so the underlying device can | ||
| 849 | * clean up and reuse resources for later DDP requests. | ||
| 850 | * | ||
| 851 | * int (*ndo_fcoe_ddp_target)(struct net_device *dev, u16 xid, | ||
| 852 | * struct scatterlist *sgl, unsigned int sgc); | ||
| 853 | * Called when the FCoE Target wants to initialize an I/O that | ||
| 854 | * is a possible candidate for Direct Data Placement (DDP). The LLD can | ||
| 855 | * perform necessary setup and returns 1 to indicate the device is set up | ||
| 856 | * successfully to perform DDP on this I/O, otherwise this returns 0. | ||
| 857 | * | ||
| 858 | * int (*ndo_fcoe_get_wwn)(struct net_device *dev, u64 *wwn, int type); | ||
| 859 | * Called when the underlying device wants to override default World Wide | ||
| 860 | * Name (WWN) generation mechanism in FCoE protocol stack to pass its own | ||
| 861 | * World Wide Port Name (WWPN) or World Wide Node Name (WWNN) to the FCoE | ||
| 862 | * protocol stack to use. | ||
| 863 | * | ||
| 864 | * RFS acceleration. | ||
| 865 | * int (*ndo_rx_flow_steer)(struct net_device *dev, const struct sk_buff *skb, | ||
| 866 | * u16 rxq_index, u32 flow_id); | ||
| 867 | * Set hardware filter for RFS. rxq_index is the target queue index; | ||
| 868 | * flow_id is a flow ID to be passed to rps_may_expire_flow() later. | ||
| 869 | * Return the filter ID on success, or a negative error code. | ||
| 870 | * | ||
| 871 | * Slave management functions (for bridge, bonding, etc). User should | ||
| 872 | * call netdev_set_master() to set dev->master properly. | ||
| 873 | * int (*ndo_add_slave)(struct net_device *dev, struct net_device *slave_dev); | ||
| 874 | * Called to make another netdev an underling. | ||
| 875 | * | ||
| 876 | * int (*ndo_del_slave)(struct net_device *dev, struct net_device *slave_dev); | ||
| 877 | * Called to release previously enslaved netdev. | ||
| 878 | * | ||
| 879 | * Feature/offload setting functions. | ||
| 880 | * u32 (*ndo_fix_features)(struct net_device *dev, u32 features); | ||
| 881 | * Adjusts the requested feature flags according to device-specific | ||
| 882 | * constraints, and returns the resulting flags. Must not modify | ||
| 883 | * the device state. | ||
| 884 | * | ||
| 885 | * int (*ndo_set_features)(struct net_device *dev, u32 features); | ||
| 886 | * Called to update device configuration to new features. Passed | ||
| 887 | * feature set might be less than what was returned by ndo_fix_features()). | ||
| 888 | * Must return >0 or -errno if it changed dev->features itself. | ||
| 889 | * | ||
| 756 | */ | 890 | */ |
| 757 | #define HAVE_NET_DEVICE_OPS | 891 | #define HAVE_NET_DEVICE_OPS |
| 758 | struct net_device_ops { | 892 | struct net_device_ops { |
| @@ -811,6 +945,7 @@ struct net_device_ops { | |||
| 811 | struct nlattr *port[]); | 945 | struct nlattr *port[]); |
| 812 | int (*ndo_get_vf_port)(struct net_device *dev, | 946 | int (*ndo_get_vf_port)(struct net_device *dev, |
| 813 | int vf, struct sk_buff *skb); | 947 | int vf, struct sk_buff *skb); |
| 948 | int (*ndo_setup_tc)(struct net_device *dev, u8 tc); | ||
| 814 | #if defined(CONFIG_FCOE) || defined(CONFIG_FCOE_MODULE) | 949 | #if defined(CONFIG_FCOE) || defined(CONFIG_FCOE_MODULE) |
| 815 | int (*ndo_fcoe_enable)(struct net_device *dev); | 950 | int (*ndo_fcoe_enable)(struct net_device *dev); |
| 816 | int (*ndo_fcoe_disable)(struct net_device *dev); | 951 | int (*ndo_fcoe_disable)(struct net_device *dev); |
| @@ -820,11 +955,29 @@ struct net_device_ops { | |||
| 820 | unsigned int sgc); | 955 | unsigned int sgc); |
| 821 | int (*ndo_fcoe_ddp_done)(struct net_device *dev, | 956 | int (*ndo_fcoe_ddp_done)(struct net_device *dev, |
| 822 | u16 xid); | 957 | u16 xid); |
| 958 | int (*ndo_fcoe_ddp_target)(struct net_device *dev, | ||
| 959 | u16 xid, | ||
| 960 | struct scatterlist *sgl, | ||
| 961 | unsigned int sgc); | ||
| 823 | #define NETDEV_FCOE_WWNN 0 | 962 | #define NETDEV_FCOE_WWNN 0 |
| 824 | #define NETDEV_FCOE_WWPN 1 | 963 | #define NETDEV_FCOE_WWPN 1 |
| 825 | int (*ndo_fcoe_get_wwn)(struct net_device *dev, | 964 | int (*ndo_fcoe_get_wwn)(struct net_device *dev, |
| 826 | u64 *wwn, int type); | 965 | u64 *wwn, int type); |
| 827 | #endif | 966 | #endif |
| 967 | #ifdef CONFIG_RFS_ACCEL | ||
| 968 | int (*ndo_rx_flow_steer)(struct net_device *dev, | ||
| 969 | const struct sk_buff *skb, | ||
| 970 | u16 rxq_index, | ||
| 971 | u32 flow_id); | ||
| 972 | #endif | ||
| 973 | int (*ndo_add_slave)(struct net_device *dev, | ||
| 974 | struct net_device *slave_dev); | ||
| 975 | int (*ndo_del_slave)(struct net_device *dev, | ||
| 976 | struct net_device *slave_dev); | ||
| 977 | u32 (*ndo_fix_features)(struct net_device *dev, | ||
| 978 | u32 features); | ||
| 979 | int (*ndo_set_features)(struct net_device *dev, | ||
| 980 | u32 features); | ||
| 828 | }; | 981 | }; |
| 829 | 982 | ||
| 830 | /* | 983 | /* |
| @@ -876,8 +1029,18 @@ struct net_device { | |||
| 876 | struct list_head napi_list; | 1029 | struct list_head napi_list; |
| 877 | struct list_head unreg_list; | 1030 | struct list_head unreg_list; |
| 878 | 1031 | ||
| 879 | /* Net device features */ | 1032 | /* currently active device features */ |
| 880 | unsigned long features; | 1033 | u32 features; |
| 1034 | /* user-changeable features */ | ||
| 1035 | u32 hw_features; | ||
| 1036 | /* user-requested features */ | ||
| 1037 | u32 wanted_features; | ||
| 1038 | /* VLAN feature mask */ | ||
| 1039 | u32 vlan_features; | ||
| 1040 | |||
| 1041 | /* Net device feature bits; if you change something, | ||
| 1042 | * also update netdev_features_strings[] in ethtool.c */ | ||
| 1043 | |||
| 881 | #define NETIF_F_SG 1 /* Scatter/gather IO. */ | 1044 | #define NETIF_F_SG 1 /* Scatter/gather IO. */ |
| 882 | #define NETIF_F_IP_CSUM 2 /* Can checksum TCP/UDP over IPv4. */ | 1045 | #define NETIF_F_IP_CSUM 2 /* Can checksum TCP/UDP over IPv4. */ |
| 883 | #define NETIF_F_NO_CSUM 4 /* Does not require checksum. F.e. loopack. */ | 1046 | #define NETIF_F_NO_CSUM 4 /* Does not require checksum. F.e. loopack. */ |
| @@ -902,6 +1065,7 @@ struct net_device { | |||
| 902 | #define NETIF_F_FCOE_MTU (1 << 26) /* Supports max FCoE MTU, 2158 bytes*/ | 1065 | #define NETIF_F_FCOE_MTU (1 << 26) /* Supports max FCoE MTU, 2158 bytes*/ |
| 903 | #define NETIF_F_NTUPLE (1 << 27) /* N-tuple filters supported */ | 1066 | #define NETIF_F_NTUPLE (1 << 27) /* N-tuple filters supported */ |
| 904 | #define NETIF_F_RXHASH (1 << 28) /* Receive hashing offload */ | 1067 | #define NETIF_F_RXHASH (1 << 28) /* Receive hashing offload */ |
| 1068 | #define NETIF_F_RXCSUM (1 << 29) /* Receive checksumming offload */ | ||
| 905 | 1069 | ||
| 906 | /* Segmentation offload features */ | 1070 | /* Segmentation offload features */ |
| 907 | #define NETIF_F_GSO_SHIFT 16 | 1071 | #define NETIF_F_GSO_SHIFT 16 |
| @@ -913,6 +1077,12 @@ struct net_device { | |||
| 913 | #define NETIF_F_TSO6 (SKB_GSO_TCPV6 << NETIF_F_GSO_SHIFT) | 1077 | #define NETIF_F_TSO6 (SKB_GSO_TCPV6 << NETIF_F_GSO_SHIFT) |
| 914 | #define NETIF_F_FSO (SKB_GSO_FCOE << NETIF_F_GSO_SHIFT) | 1078 | #define NETIF_F_FSO (SKB_GSO_FCOE << NETIF_F_GSO_SHIFT) |
| 915 | 1079 | ||
| 1080 | /* Features valid for ethtool to change */ | ||
| 1081 | /* = all defined minus driver/device-class-related */ | ||
| 1082 | #define NETIF_F_NEVER_CHANGE (NETIF_F_HIGHDMA | NETIF_F_VLAN_CHALLENGED | \ | ||
| 1083 | NETIF_F_LLTX | NETIF_F_NETNS_LOCAL) | ||
| 1084 | #define NETIF_F_ETHTOOL_BITS (0x3f3fffff & ~NETIF_F_NEVER_CHANGE) | ||
| 1085 | |||
| 916 | /* List of features with software fallbacks. */ | 1086 | /* List of features with software fallbacks. */ |
| 917 | #define NETIF_F_GSO_SOFTWARE (NETIF_F_TSO | NETIF_F_TSO_ECN | \ | 1087 | #define NETIF_F_GSO_SOFTWARE (NETIF_F_TSO | NETIF_F_TSO_ECN | \ |
| 918 | NETIF_F_TSO6 | NETIF_F_UFO) | 1088 | NETIF_F_TSO6 | NETIF_F_UFO) |
| @@ -923,6 +1093,12 @@ struct net_device { | |||
| 923 | #define NETIF_F_V6_CSUM (NETIF_F_GEN_CSUM | NETIF_F_IPV6_CSUM) | 1093 | #define NETIF_F_V6_CSUM (NETIF_F_GEN_CSUM | NETIF_F_IPV6_CSUM) |
| 924 | #define NETIF_F_ALL_CSUM (NETIF_F_V4_CSUM | NETIF_F_V6_CSUM) | 1094 | #define NETIF_F_ALL_CSUM (NETIF_F_V4_CSUM | NETIF_F_V6_CSUM) |
| 925 | 1095 | ||
| 1096 | #define NETIF_F_ALL_TSO (NETIF_F_TSO | NETIF_F_TSO6 | NETIF_F_TSO_ECN) | ||
| 1097 | |||
| 1098 | #define NETIF_F_ALL_TX_OFFLOADS (NETIF_F_ALL_CSUM | NETIF_F_SG | \ | ||
| 1099 | NETIF_F_FRAGLIST | NETIF_F_ALL_TSO | \ | ||
| 1100 | NETIF_F_SCTP_CSUM | NETIF_F_FCOE_CRC) | ||
| 1101 | |||
| 926 | /* | 1102 | /* |
| 927 | * If one device supports one of these features, then enable them | 1103 | * If one device supports one of these features, then enable them |
| 928 | * for all in netdev_increment_features. | 1104 | * for all in netdev_increment_features. |
| @@ -931,6 +1107,9 @@ struct net_device { | |||
| 931 | NETIF_F_SG | NETIF_F_HIGHDMA | \ | 1107 | NETIF_F_SG | NETIF_F_HIGHDMA | \ |
| 932 | NETIF_F_FRAGLIST) | 1108 | NETIF_F_FRAGLIST) |
| 933 | 1109 | ||
| 1110 | /* changeable features with no special hardware requirements */ | ||
| 1111 | #define NETIF_F_SOFT_FEATURES (NETIF_F_GSO | NETIF_F_GRO) | ||
| 1112 | |||
| 934 | /* Interface index. Unique device identifier */ | 1113 | /* Interface index. Unique device identifier */ |
| 935 | int ifindex; | 1114 | int ifindex; |
| 936 | int iflink; | 1115 | int iflink; |
| @@ -1039,6 +1218,13 @@ struct net_device { | |||
| 1039 | 1218 | ||
| 1040 | /* Number of RX queues currently active in device */ | 1219 | /* Number of RX queues currently active in device */ |
| 1041 | unsigned int real_num_rx_queues; | 1220 | unsigned int real_num_rx_queues; |
| 1221 | |||
| 1222 | #ifdef CONFIG_RFS_ACCEL | ||
| 1223 | /* CPU reverse-mapping for RX completion interrupts, indexed | ||
| 1224 | * by RX queue number. Assigned by driver. This must only be | ||
| 1225 | * set if the ndo_rx_flow_steer operation is defined. */ | ||
| 1226 | struct cpu_rmap *rx_cpu_rmap; | ||
| 1227 | #endif | ||
| 1042 | #endif | 1228 | #endif |
| 1043 | 1229 | ||
| 1044 | rx_handler_func_t __rcu *rx_handler; | 1230 | rx_handler_func_t __rcu *rx_handler; |
| @@ -1132,9 +1318,6 @@ struct net_device { | |||
| 1132 | /* rtnetlink link ops */ | 1318 | /* rtnetlink link ops */ |
| 1133 | const struct rtnl_link_ops *rtnl_link_ops; | 1319 | const struct rtnl_link_ops *rtnl_link_ops; |
| 1134 | 1320 | ||
| 1135 | /* VLAN feature mask */ | ||
| 1136 | unsigned long vlan_features; | ||
| 1137 | |||
| 1138 | /* for setting kernel sock attribute on TCP connection setup */ | 1321 | /* for setting kernel sock attribute on TCP connection setup */ |
| 1139 | #define GSO_MAX_SIZE 65536 | 1322 | #define GSO_MAX_SIZE 65536 |
| 1140 | unsigned int gso_max_size; | 1323 | unsigned int gso_max_size; |
| @@ -1143,6 +1326,9 @@ struct net_device { | |||
| 1143 | /* Data Center Bridging netlink ops */ | 1326 | /* Data Center Bridging netlink ops */ |
| 1144 | const struct dcbnl_rtnl_ops *dcbnl_ops; | 1327 | const struct dcbnl_rtnl_ops *dcbnl_ops; |
| 1145 | #endif | 1328 | #endif |
| 1329 | u8 num_tc; | ||
| 1330 | struct netdev_tc_txq tc_to_txq[TC_MAX_QUEUE]; | ||
| 1331 | u8 prio_tc_map[TC_BITMASK + 1]; | ||
| 1146 | 1332 | ||
| 1147 | #if defined(CONFIG_FCOE) || defined(CONFIG_FCOE_MODULE) | 1333 | #if defined(CONFIG_FCOE) || defined(CONFIG_FCOE_MODULE) |
| 1148 | /* max exchange id for FCoE LRO by ddp */ | 1334 | /* max exchange id for FCoE LRO by ddp */ |
| @@ -1153,12 +1339,66 @@ struct net_device { | |||
| 1153 | 1339 | ||
| 1154 | /* phy device may attach itself for hardware timestamping */ | 1340 | /* phy device may attach itself for hardware timestamping */ |
| 1155 | struct phy_device *phydev; | 1341 | struct phy_device *phydev; |
| 1342 | |||
| 1343 | /* group the device belongs to */ | ||
| 1344 | int group; | ||
| 1156 | }; | 1345 | }; |
| 1157 | #define to_net_dev(d) container_of(d, struct net_device, dev) | 1346 | #define to_net_dev(d) container_of(d, struct net_device, dev) |
| 1158 | 1347 | ||
| 1159 | #define NETDEV_ALIGN 32 | 1348 | #define NETDEV_ALIGN 32 |
| 1160 | 1349 | ||
| 1161 | static inline | 1350 | static inline |
| 1351 | int netdev_get_prio_tc_map(const struct net_device *dev, u32 prio) | ||
| 1352 | { | ||
| 1353 | return dev->prio_tc_map[prio & TC_BITMASK]; | ||
| 1354 | } | ||
| 1355 | |||
| 1356 | static inline | ||
| 1357 | int netdev_set_prio_tc_map(struct net_device *dev, u8 prio, u8 tc) | ||
| 1358 | { | ||
| 1359 | if (tc >= dev->num_tc) | ||
| 1360 | return -EINVAL; | ||
| 1361 | |||
| 1362 | dev->prio_tc_map[prio & TC_BITMASK] = tc & TC_BITMASK; | ||
| 1363 | return 0; | ||
| 1364 | } | ||
| 1365 | |||
| 1366 | static inline | ||
| 1367 | void netdev_reset_tc(struct net_device *dev) | ||
| 1368 | { | ||
| 1369 | dev->num_tc = 0; | ||
| 1370 | memset(dev->tc_to_txq, 0, sizeof(dev->tc_to_txq)); | ||
| 1371 | memset(dev->prio_tc_map, 0, sizeof(dev->prio_tc_map)); | ||
| 1372 | } | ||
| 1373 | |||
| 1374 | static inline | ||
| 1375 | int netdev_set_tc_queue(struct net_device *dev, u8 tc, u16 count, u16 offset) | ||
| 1376 | { | ||
| 1377 | if (tc >= dev->num_tc) | ||
| 1378 | return -EINVAL; | ||
| 1379 | |||
| 1380 | dev->tc_to_txq[tc].count = count; | ||
| 1381 | dev->tc_to_txq[tc].offset = offset; | ||
| 1382 | return 0; | ||
| 1383 | } | ||
| 1384 | |||
| 1385 | static inline | ||
| 1386 | int netdev_set_num_tc(struct net_device *dev, u8 num_tc) | ||
| 1387 | { | ||
| 1388 | if (num_tc > TC_MAX_QUEUE) | ||
| 1389 | return -EINVAL; | ||
| 1390 | |||
| 1391 | dev->num_tc = num_tc; | ||
| 1392 | return 0; | ||
| 1393 | } | ||
| 1394 | |||
| 1395 | static inline | ||
| 1396 | int netdev_get_num_tc(struct net_device *dev) | ||
| 1397 | { | ||
| 1398 | return dev->num_tc; | ||
| 1399 | } | ||
| 1400 | |||
| 1401 | static inline | ||
| 1162 | struct netdev_queue *netdev_get_tx_queue(const struct net_device *dev, | 1402 | struct netdev_queue *netdev_get_tx_queue(const struct net_device *dev, |
| 1163 | unsigned int index) | 1403 | unsigned int index) |
| 1164 | { | 1404 | { |
| @@ -1300,7 +1540,7 @@ struct packet_type { | |||
| 1300 | struct packet_type *, | 1540 | struct packet_type *, |
| 1301 | struct net_device *); | 1541 | struct net_device *); |
| 1302 | struct sk_buff *(*gso_segment)(struct sk_buff *skb, | 1542 | struct sk_buff *(*gso_segment)(struct sk_buff *skb, |
| 1303 | int features); | 1543 | u32 features); |
| 1304 | int (*gso_send_check)(struct sk_buff *skb); | 1544 | int (*gso_send_check)(struct sk_buff *skb); |
| 1305 | struct sk_buff **(*gro_receive)(struct sk_buff **head, | 1545 | struct sk_buff **(*gro_receive)(struct sk_buff **head, |
| 1306 | struct sk_buff *skb); | 1546 | struct sk_buff *skb); |
| @@ -1345,7 +1585,7 @@ static inline struct net_device *next_net_device_rcu(struct net_device *dev) | |||
| 1345 | struct net *net; | 1585 | struct net *net; |
| 1346 | 1586 | ||
| 1347 | net = dev_net(dev); | 1587 | net = dev_net(dev); |
| 1348 | lh = rcu_dereference(dev->dev_list.next); | 1588 | lh = rcu_dereference(list_next_rcu(&dev->dev_list)); |
| 1349 | return lh == &net->dev_base_head ? NULL : net_device_entry(lh); | 1589 | return lh == &net->dev_base_head ? NULL : net_device_entry(lh); |
| 1350 | } | 1590 | } |
| 1351 | 1591 | ||
| @@ -1355,6 +1595,13 @@ static inline struct net_device *first_net_device(struct net *net) | |||
| 1355 | net_device_entry(net->dev_base_head.next); | 1595 | net_device_entry(net->dev_base_head.next); |
| 1356 | } | 1596 | } |
| 1357 | 1597 | ||
| 1598 | static inline struct net_device *first_net_device_rcu(struct net *net) | ||
| 1599 | { | ||
| 1600 | struct list_head *lh = rcu_dereference(list_next_rcu(&net->dev_base_head)); | ||
| 1601 | |||
| 1602 | return lh == &net->dev_base_head ? NULL : net_device_entry(lh); | ||
| 1603 | } | ||
| 1604 | |||
| 1358 | extern int netdev_boot_setup_check(struct net_device *dev); | 1605 | extern int netdev_boot_setup_check(struct net_device *dev); |
| 1359 | extern unsigned long netdev_boot_base(const char *prefix, int unit); | 1606 | extern unsigned long netdev_boot_base(const char *prefix, int unit); |
| 1360 | extern struct net_device *dev_getbyhwaddr_rcu(struct net *net, unsigned short type, | 1607 | extern struct net_device *dev_getbyhwaddr_rcu(struct net *net, unsigned short type, |
| @@ -1606,8 +1853,7 @@ static inline void netif_tx_wake_all_queues(struct net_device *dev) | |||
| 1606 | static inline void netif_tx_stop_queue(struct netdev_queue *dev_queue) | 1853 | static inline void netif_tx_stop_queue(struct netdev_queue *dev_queue) |
| 1607 | { | 1854 | { |
| 1608 | if (WARN_ON(!dev_queue)) { | 1855 | if (WARN_ON(!dev_queue)) { |
| 1609 | printk(KERN_INFO "netif_stop_queue() cannot be called before " | 1856 | pr_info("netif_stop_queue() cannot be called before register_netdev()\n"); |
| 1610 | "register_netdev()"); | ||
| 1611 | return; | 1857 | return; |
| 1612 | } | 1858 | } |
| 1613 | set_bit(__QUEUE_STATE_XOFF, &dev_queue->state); | 1859 | set_bit(__QUEUE_STATE_XOFF, &dev_queue->state); |
| @@ -1844,6 +2090,7 @@ extern int dev_set_alias(struct net_device *, const char *, size_t); | |||
| 1844 | extern int dev_change_net_namespace(struct net_device *, | 2090 | extern int dev_change_net_namespace(struct net_device *, |
| 1845 | struct net *, const char *); | 2091 | struct net *, const char *); |
| 1846 | extern int dev_set_mtu(struct net_device *, int); | 2092 | extern int dev_set_mtu(struct net_device *, int); |
| 2093 | extern void dev_set_group(struct net_device *, int); | ||
| 1847 | extern int dev_set_mac_address(struct net_device *, | 2094 | extern int dev_set_mac_address(struct net_device *, |
| 1848 | struct sockaddr *); | 2095 | struct sockaddr *); |
| 1849 | extern int dev_hard_start_xmit(struct sk_buff *skb, | 2096 | extern int dev_hard_start_xmit(struct sk_buff *skb, |
| @@ -2267,8 +2514,10 @@ extern int netdev_max_backlog; | |||
| 2267 | extern int netdev_tstamp_prequeue; | 2514 | extern int netdev_tstamp_prequeue; |
| 2268 | extern int weight_p; | 2515 | extern int weight_p; |
| 2269 | extern int netdev_set_master(struct net_device *dev, struct net_device *master); | 2516 | extern int netdev_set_master(struct net_device *dev, struct net_device *master); |
| 2517 | extern int netdev_set_bond_master(struct net_device *dev, | ||
| 2518 | struct net_device *master); | ||
| 2270 | extern int skb_checksum_help(struct sk_buff *skb); | 2519 | extern int skb_checksum_help(struct sk_buff *skb); |
| 2271 | extern struct sk_buff *skb_gso_segment(struct sk_buff *skb, int features); | 2520 | extern struct sk_buff *skb_gso_segment(struct sk_buff *skb, u32 features); |
| 2272 | #ifdef CONFIG_BUG | 2521 | #ifdef CONFIG_BUG |
| 2273 | extern void netdev_rx_csum_fault(struct net_device *dev); | 2522 | extern void netdev_rx_csum_fault(struct net_device *dev); |
| 2274 | #else | 2523 | #else |
| @@ -2295,22 +2544,26 @@ extern char *netdev_drivername(const struct net_device *dev, char *buffer, int l | |||
| 2295 | 2544 | ||
| 2296 | extern void linkwatch_run_queue(void); | 2545 | extern void linkwatch_run_queue(void); |
| 2297 | 2546 | ||
| 2298 | unsigned long netdev_increment_features(unsigned long all, unsigned long one, | 2547 | static inline u32 netdev_get_wanted_features(struct net_device *dev) |
| 2299 | unsigned long mask); | 2548 | { |
| 2300 | unsigned long netdev_fix_features(unsigned long features, const char *name); | 2549 | return (dev->features & ~dev->hw_features) | dev->wanted_features; |
| 2550 | } | ||
| 2551 | u32 netdev_increment_features(u32 all, u32 one, u32 mask); | ||
| 2552 | u32 netdev_fix_features(struct net_device *dev, u32 features); | ||
| 2553 | void netdev_update_features(struct net_device *dev); | ||
| 2301 | 2554 | ||
| 2302 | void netif_stacked_transfer_operstate(const struct net_device *rootdev, | 2555 | void netif_stacked_transfer_operstate(const struct net_device *rootdev, |
| 2303 | struct net_device *dev); | 2556 | struct net_device *dev); |
| 2304 | 2557 | ||
| 2305 | int netif_skb_features(struct sk_buff *skb); | 2558 | u32 netif_skb_features(struct sk_buff *skb); |
| 2306 | 2559 | ||
| 2307 | static inline int net_gso_ok(int features, int gso_type) | 2560 | static inline int net_gso_ok(u32 features, int gso_type) |
| 2308 | { | 2561 | { |
| 2309 | int feature = gso_type << NETIF_F_GSO_SHIFT; | 2562 | int feature = gso_type << NETIF_F_GSO_SHIFT; |
| 2310 | return (features & feature) == feature; | 2563 | return (features & feature) == feature; |
| 2311 | } | 2564 | } |
| 2312 | 2565 | ||
| 2313 | static inline int skb_gso_ok(struct sk_buff *skb, int features) | 2566 | static inline int skb_gso_ok(struct sk_buff *skb, u32 features) |
| 2314 | { | 2567 | { |
| 2315 | return net_gso_ok(features, skb_shinfo(skb)->gso_type) && | 2568 | return net_gso_ok(features, skb_shinfo(skb)->gso_type) && |
| 2316 | (!skb_has_frag_list(skb) || (features & NETIF_F_FRAGLIST)); | 2569 | (!skb_has_frag_list(skb) || (features & NETIF_F_FRAGLIST)); |
| @@ -2328,15 +2581,9 @@ static inline void netif_set_gso_max_size(struct net_device *dev, | |||
| 2328 | dev->gso_max_size = size; | 2581 | dev->gso_max_size = size; |
| 2329 | } | 2582 | } |
| 2330 | 2583 | ||
| 2331 | extern int __skb_bond_should_drop(struct sk_buff *skb, | 2584 | static inline int netif_is_bond_slave(struct net_device *dev) |
| 2332 | struct net_device *master); | ||
| 2333 | |||
| 2334 | static inline int skb_bond_should_drop(struct sk_buff *skb, | ||
| 2335 | struct net_device *master) | ||
| 2336 | { | 2585 | { |
| 2337 | if (master) | 2586 | return dev->flags & IFF_SLAVE && dev->priv_flags & IFF_BONDING; |
| 2338 | return __skb_bond_should_drop(skb, master); | ||
| 2339 | return 0; | ||
| 2340 | } | 2587 | } |
| 2341 | 2588 | ||
| 2342 | extern struct pernet_operations __net_initdata loopback_net_ops; | 2589 | extern struct pernet_operations __net_initdata loopback_net_ops; |
| @@ -2351,6 +2598,8 @@ static inline int dev_ethtool_get_settings(struct net_device *dev, | |||
| 2351 | 2598 | ||
| 2352 | static inline u32 dev_ethtool_get_rx_csum(struct net_device *dev) | 2599 | static inline u32 dev_ethtool_get_rx_csum(struct net_device *dev) |
| 2353 | { | 2600 | { |
| 2601 | if (dev->hw_features & NETIF_F_RXCSUM) | ||
| 2602 | return !!(dev->features & NETIF_F_RXCSUM); | ||
| 2354 | if (!dev->ethtool_ops || !dev->ethtool_ops->get_rx_csum) | 2603 | if (!dev->ethtool_ops || !dev->ethtool_ops->get_rx_csum) |
| 2355 | return 0; | 2604 | return 0; |
| 2356 | return dev->ethtool_ops->get_rx_csum(dev); | 2605 | return dev->ethtool_ops->get_rx_csum(dev); |
| @@ -2392,6 +2641,9 @@ extern int netdev_notice(const struct net_device *dev, const char *format, ...) | |||
| 2392 | extern int netdev_info(const struct net_device *dev, const char *format, ...) | 2641 | extern int netdev_info(const struct net_device *dev, const char *format, ...) |
| 2393 | __attribute__ ((format (printf, 2, 3))); | 2642 | __attribute__ ((format (printf, 2, 3))); |
| 2394 | 2643 | ||
| 2644 | #define MODULE_ALIAS_NETDEV(device) \ | ||
| 2645 | MODULE_ALIAS("netdev-" device) | ||
| 2646 | |||
| 2395 | #if defined(DEBUG) | 2647 | #if defined(DEBUG) |
| 2396 | #define netdev_dbg(__dev, format, args...) \ | 2648 | #define netdev_dbg(__dev, format, args...) \ |
| 2397 | netdev_printk(KERN_DEBUG, __dev, format, ##args) | 2649 | netdev_printk(KERN_DEBUG, __dev, format, ##args) |
diff --git a/include/linux/netfilter.h b/include/linux/netfilter.h index 1893837b3966..eeec00abb664 100644 --- a/include/linux/netfilter.h +++ b/include/linux/netfilter.h | |||
| @@ -24,16 +24,20 @@ | |||
| 24 | #define NF_MAX_VERDICT NF_STOP | 24 | #define NF_MAX_VERDICT NF_STOP |
| 25 | 25 | ||
| 26 | /* we overload the higher bits for encoding auxiliary data such as the queue | 26 | /* we overload the higher bits for encoding auxiliary data such as the queue |
| 27 | * number. Not nice, but better than additional function arguments. */ | 27 | * number or errno values. Not nice, but better than additional function |
| 28 | #define NF_VERDICT_MASK 0x0000ffff | 28 | * arguments. */ |
| 29 | #define NF_VERDICT_BITS 16 | 29 | #define NF_VERDICT_MASK 0x000000ff |
| 30 | |||
| 31 | /* extra verdict flags have mask 0x0000ff00 */ | ||
| 32 | #define NF_VERDICT_FLAG_QUEUE_BYPASS 0x00008000 | ||
| 30 | 33 | ||
| 34 | /* queue number (NF_QUEUE) or errno (NF_DROP) */ | ||
| 31 | #define NF_VERDICT_QMASK 0xffff0000 | 35 | #define NF_VERDICT_QMASK 0xffff0000 |
| 32 | #define NF_VERDICT_QBITS 16 | 36 | #define NF_VERDICT_QBITS 16 |
| 33 | 37 | ||
| 34 | #define NF_QUEUE_NR(x) ((((x) << NF_VERDICT_BITS) & NF_VERDICT_QMASK) | NF_QUEUE) | 38 | #define NF_QUEUE_NR(x) ((((x) << 16) & NF_VERDICT_QMASK) | NF_QUEUE) |
| 35 | 39 | ||
| 36 | #define NF_DROP_ERR(x) (((-x) << NF_VERDICT_BITS) | NF_DROP) | 40 | #define NF_DROP_ERR(x) (((-x) << 16) | NF_DROP) |
| 37 | 41 | ||
| 38 | /* only for userspace compatibility */ | 42 | /* only for userspace compatibility */ |
| 39 | #ifndef __KERNEL__ | 43 | #ifndef __KERNEL__ |
| @@ -41,6 +45,9 @@ | |||
| 41 | <= 0x2000 is used for protocol-flags. */ | 45 | <= 0x2000 is used for protocol-flags. */ |
| 42 | #define NFC_UNKNOWN 0x4000 | 46 | #define NFC_UNKNOWN 0x4000 |
| 43 | #define NFC_ALTERED 0x8000 | 47 | #define NFC_ALTERED 0x8000 |
| 48 | |||
| 49 | /* NF_VERDICT_BITS should be 8 now, but userspace might break if this changes */ | ||
| 50 | #define NF_VERDICT_BITS 16 | ||
| 44 | #endif | 51 | #endif |
| 45 | 52 | ||
| 46 | enum nf_inet_hooks { | 53 | enum nf_inet_hooks { |
| @@ -72,6 +79,10 @@ union nf_inet_addr { | |||
| 72 | 79 | ||
| 73 | #ifdef __KERNEL__ | 80 | #ifdef __KERNEL__ |
| 74 | #ifdef CONFIG_NETFILTER | 81 | #ifdef CONFIG_NETFILTER |
| 82 | static inline int NF_DROP_GETERR(int verdict) | ||
| 83 | { | ||
| 84 | return -(verdict >> NF_VERDICT_QBITS); | ||
| 85 | } | ||
| 75 | 86 | ||
| 76 | static inline int nf_inet_addr_cmp(const union nf_inet_addr *a1, | 87 | static inline int nf_inet_addr_cmp(const union nf_inet_addr *a1, |
| 77 | const union nf_inet_addr *a2) | 88 | const union nf_inet_addr *a2) |
| @@ -267,7 +278,7 @@ struct nf_afinfo { | |||
| 267 | int route_key_size; | 278 | int route_key_size; |
| 268 | }; | 279 | }; |
| 269 | 280 | ||
| 270 | extern const struct nf_afinfo *nf_afinfo[NFPROTO_NUMPROTO]; | 281 | extern const struct nf_afinfo __rcu *nf_afinfo[NFPROTO_NUMPROTO]; |
| 271 | static inline const struct nf_afinfo *nf_get_afinfo(unsigned short family) | 282 | static inline const struct nf_afinfo *nf_get_afinfo(unsigned short family) |
| 272 | { | 283 | { |
| 273 | return rcu_dereference(nf_afinfo[family]); | 284 | return rcu_dereference(nf_afinfo[family]); |
| @@ -357,9 +368,9 @@ nf_nat_decode_session(struct sk_buff *skb, struct flowi *fl, u_int8_t family) | |||
| 357 | #endif /*CONFIG_NETFILTER*/ | 368 | #endif /*CONFIG_NETFILTER*/ |
| 358 | 369 | ||
| 359 | #if defined(CONFIG_NF_CONNTRACK) || defined(CONFIG_NF_CONNTRACK_MODULE) | 370 | #if defined(CONFIG_NF_CONNTRACK) || defined(CONFIG_NF_CONNTRACK_MODULE) |
| 360 | extern void (*ip_ct_attach)(struct sk_buff *, struct sk_buff *); | 371 | extern void (*ip_ct_attach)(struct sk_buff *, struct sk_buff *) __rcu; |
| 361 | extern void nf_ct_attach(struct sk_buff *, struct sk_buff *); | 372 | extern void nf_ct_attach(struct sk_buff *, struct sk_buff *); |
| 362 | extern void (*nf_ct_destroy)(struct nf_conntrack *); | 373 | extern void (*nf_ct_destroy)(struct nf_conntrack *) __rcu; |
| 363 | #else | 374 | #else |
| 364 | static inline void nf_ct_attach(struct sk_buff *new, struct sk_buff *skb) {} | 375 | static inline void nf_ct_attach(struct sk_buff *new, struct sk_buff *skb) {} |
| 365 | #endif | 376 | #endif |
diff --git a/include/linux/netfilter/Kbuild b/include/linux/netfilter/Kbuild index 9d40effe7ca7..a1b410c76fc3 100644 --- a/include/linux/netfilter/Kbuild +++ b/include/linux/netfilter/Kbuild | |||
| @@ -1,3 +1,5 @@ | |||
| 1 | header-y += ipset/ | ||
| 2 | |||
| 1 | header-y += nf_conntrack_common.h | 3 | header-y += nf_conntrack_common.h |
| 2 | header-y += nf_conntrack_ftp.h | 4 | header-y += nf_conntrack_ftp.h |
| 3 | header-y += nf_conntrack_sctp.h | 5 | header-y += nf_conntrack_sctp.h |
| @@ -9,6 +11,7 @@ header-y += nfnetlink_conntrack.h | |||
| 9 | header-y += nfnetlink_log.h | 11 | header-y += nfnetlink_log.h |
| 10 | header-y += nfnetlink_queue.h | 12 | header-y += nfnetlink_queue.h |
| 11 | header-y += x_tables.h | 13 | header-y += x_tables.h |
| 14 | header-y += xt_AUDIT.h | ||
| 12 | header-y += xt_CHECKSUM.h | 15 | header-y += xt_CHECKSUM.h |
| 13 | header-y += xt_CLASSIFY.h | 16 | header-y += xt_CLASSIFY.h |
| 14 | header-y += xt_CONNMARK.h | 17 | header-y += xt_CONNMARK.h |
| @@ -26,6 +29,7 @@ header-y += xt_TCPMSS.h | |||
| 26 | header-y += xt_TCPOPTSTRIP.h | 29 | header-y += xt_TCPOPTSTRIP.h |
| 27 | header-y += xt_TEE.h | 30 | header-y += xt_TEE.h |
| 28 | header-y += xt_TPROXY.h | 31 | header-y += xt_TPROXY.h |
| 32 | header-y += xt_addrtype.h | ||
| 29 | header-y += xt_cluster.h | 33 | header-y += xt_cluster.h |
| 30 | header-y += xt_comment.h | 34 | header-y += xt_comment.h |
| 31 | header-y += xt_connbytes.h | 35 | header-y += xt_connbytes.h |
| @@ -34,6 +38,7 @@ header-y += xt_connmark.h | |||
| 34 | header-y += xt_conntrack.h | 38 | header-y += xt_conntrack.h |
| 35 | header-y += xt_cpu.h | 39 | header-y += xt_cpu.h |
| 36 | header-y += xt_dccp.h | 40 | header-y += xt_dccp.h |
| 41 | header-y += xt_devgroup.h | ||
| 37 | header-y += xt_dscp.h | 42 | header-y += xt_dscp.h |
| 38 | header-y += xt_esp.h | 43 | header-y += xt_esp.h |
| 39 | header-y += xt_hashlimit.h | 44 | header-y += xt_hashlimit.h |
| @@ -54,7 +59,9 @@ header-y += xt_quota.h | |||
| 54 | header-y += xt_rateest.h | 59 | header-y += xt_rateest.h |
| 55 | header-y += xt_realm.h | 60 | header-y += xt_realm.h |
| 56 | header-y += xt_recent.h | 61 | header-y += xt_recent.h |
| 62 | header-y += xt_set.h | ||
| 57 | header-y += xt_sctp.h | 63 | header-y += xt_sctp.h |
| 64 | header-y += xt_socket.h | ||
| 58 | header-y += xt_state.h | 65 | header-y += xt_state.h |
| 59 | header-y += xt_statistic.h | 66 | header-y += xt_statistic.h |
| 60 | header-y += xt_string.h | 67 | header-y += xt_string.h |
diff --git a/include/linux/netfilter/ipset/Kbuild b/include/linux/netfilter/ipset/Kbuild new file mode 100644 index 000000000000..601fe71d34d5 --- /dev/null +++ b/include/linux/netfilter/ipset/Kbuild | |||
| @@ -0,0 +1,4 @@ | |||
| 1 | header-y += ip_set.h | ||
| 2 | header-y += ip_set_bitmap.h | ||
| 3 | header-y += ip_set_hash.h | ||
| 4 | header-y += ip_set_list.h | ||
diff --git a/include/linux/netfilter/ipset/ip_set.h b/include/linux/netfilter/ipset/ip_set.h new file mode 100644 index 000000000000..ec333d83f3b4 --- /dev/null +++ b/include/linux/netfilter/ipset/ip_set.h | |||
| @@ -0,0 +1,452 @@ | |||
| 1 | #ifndef _IP_SET_H | ||
| 2 | #define _IP_SET_H | ||
| 3 | |||
| 4 | /* Copyright (C) 2000-2002 Joakim Axelsson <gozem@linux.nu> | ||
| 5 | * Patrick Schaaf <bof@bof.de> | ||
| 6 | * Martin Josefsson <gandalf@wlug.westbo.se> | ||
| 7 | * Copyright (C) 2003-2011 Jozsef Kadlecsik <kadlec@blackhole.kfki.hu> | ||
| 8 | * | ||
| 9 | * This program is free software; you can redistribute it and/or modify | ||
| 10 | * it under the terms of the GNU General Public License version 2 as | ||
| 11 | * published by the Free Software Foundation. | ||
| 12 | */ | ||
| 13 | |||
| 14 | /* The protocol version */ | ||
| 15 | #define IPSET_PROTOCOL 6 | ||
| 16 | |||
| 17 | /* The max length of strings including NUL: set and type identifiers */ | ||
| 18 | #define IPSET_MAXNAMELEN 32 | ||
| 19 | |||
| 20 | /* Message types and commands */ | ||
| 21 | enum ipset_cmd { | ||
| 22 | IPSET_CMD_NONE, | ||
| 23 | IPSET_CMD_PROTOCOL, /* 1: Return protocol version */ | ||
| 24 | IPSET_CMD_CREATE, /* 2: Create a new (empty) set */ | ||
| 25 | IPSET_CMD_DESTROY, /* 3: Destroy a (empty) set */ | ||
| 26 | IPSET_CMD_FLUSH, /* 4: Remove all elements from a set */ | ||
| 27 | IPSET_CMD_RENAME, /* 5: Rename a set */ | ||
| 28 | IPSET_CMD_SWAP, /* 6: Swap two sets */ | ||
| 29 | IPSET_CMD_LIST, /* 7: List sets */ | ||
| 30 | IPSET_CMD_SAVE, /* 8: Save sets */ | ||
| 31 | IPSET_CMD_ADD, /* 9: Add an element to a set */ | ||
| 32 | IPSET_CMD_DEL, /* 10: Delete an element from a set */ | ||
| 33 | IPSET_CMD_TEST, /* 11: Test an element in a set */ | ||
| 34 | IPSET_CMD_HEADER, /* 12: Get set header data only */ | ||
| 35 | IPSET_CMD_TYPE, /* 13: Get set type */ | ||
| 36 | IPSET_MSG_MAX, /* Netlink message commands */ | ||
| 37 | |||
| 38 | /* Commands in userspace: */ | ||
| 39 | IPSET_CMD_RESTORE = IPSET_MSG_MAX, /* 14: Enter restore mode */ | ||
| 40 | IPSET_CMD_HELP, /* 15: Get help */ | ||
| 41 | IPSET_CMD_VERSION, /* 16: Get program version */ | ||
| 42 | IPSET_CMD_QUIT, /* 17: Quit from interactive mode */ | ||
| 43 | |||
| 44 | IPSET_CMD_MAX, | ||
| 45 | |||
| 46 | IPSET_CMD_COMMIT = IPSET_CMD_MAX, /* 18: Commit buffered commands */ | ||
| 47 | }; | ||
| 48 | |||
| 49 | /* Attributes at command level */ | ||
| 50 | enum { | ||
| 51 | IPSET_ATTR_UNSPEC, | ||
| 52 | IPSET_ATTR_PROTOCOL, /* 1: Protocol version */ | ||
| 53 | IPSET_ATTR_SETNAME, /* 2: Name of the set */ | ||
| 54 | IPSET_ATTR_TYPENAME, /* 3: Typename */ | ||
| 55 | IPSET_ATTR_SETNAME2 = IPSET_ATTR_TYPENAME, /* Setname at rename/swap */ | ||
| 56 | IPSET_ATTR_REVISION, /* 4: Settype revision */ | ||
| 57 | IPSET_ATTR_FAMILY, /* 5: Settype family */ | ||
| 58 | IPSET_ATTR_FLAGS, /* 6: Flags at command level */ | ||
| 59 | IPSET_ATTR_DATA, /* 7: Nested attributes */ | ||
| 60 | IPSET_ATTR_ADT, /* 8: Multiple data containers */ | ||
| 61 | IPSET_ATTR_LINENO, /* 9: Restore lineno */ | ||
| 62 | IPSET_ATTR_PROTOCOL_MIN, /* 10: Minimal supported version number */ | ||
| 63 | IPSET_ATTR_REVISION_MIN = IPSET_ATTR_PROTOCOL_MIN, /* type rev min */ | ||
| 64 | __IPSET_ATTR_CMD_MAX, | ||
| 65 | }; | ||
| 66 | #define IPSET_ATTR_CMD_MAX (__IPSET_ATTR_CMD_MAX - 1) | ||
| 67 | |||
| 68 | /* CADT specific attributes */ | ||
| 69 | enum { | ||
| 70 | IPSET_ATTR_IP = IPSET_ATTR_UNSPEC + 1, | ||
| 71 | IPSET_ATTR_IP_FROM = IPSET_ATTR_IP, | ||
| 72 | IPSET_ATTR_IP_TO, /* 2 */ | ||
| 73 | IPSET_ATTR_CIDR, /* 3 */ | ||
| 74 | IPSET_ATTR_PORT, /* 4 */ | ||
| 75 | IPSET_ATTR_PORT_FROM = IPSET_ATTR_PORT, | ||
| 76 | IPSET_ATTR_PORT_TO, /* 5 */ | ||
| 77 | IPSET_ATTR_TIMEOUT, /* 6 */ | ||
| 78 | IPSET_ATTR_PROTO, /* 7 */ | ||
| 79 | IPSET_ATTR_CADT_FLAGS, /* 8 */ | ||
| 80 | IPSET_ATTR_CADT_LINENO = IPSET_ATTR_LINENO, /* 9 */ | ||
| 81 | /* Reserve empty slots */ | ||
| 82 | IPSET_ATTR_CADT_MAX = 16, | ||
| 83 | /* Create-only specific attributes */ | ||
| 84 | IPSET_ATTR_GC, | ||
| 85 | IPSET_ATTR_HASHSIZE, | ||
| 86 | IPSET_ATTR_MAXELEM, | ||
| 87 | IPSET_ATTR_NETMASK, | ||
| 88 | IPSET_ATTR_PROBES, | ||
| 89 | IPSET_ATTR_RESIZE, | ||
| 90 | IPSET_ATTR_SIZE, | ||
| 91 | /* Kernel-only */ | ||
| 92 | IPSET_ATTR_ELEMENTS, | ||
| 93 | IPSET_ATTR_REFERENCES, | ||
| 94 | IPSET_ATTR_MEMSIZE, | ||
| 95 | |||
| 96 | __IPSET_ATTR_CREATE_MAX, | ||
| 97 | }; | ||
| 98 | #define IPSET_ATTR_CREATE_MAX (__IPSET_ATTR_CREATE_MAX - 1) | ||
| 99 | |||
| 100 | /* ADT specific attributes */ | ||
| 101 | enum { | ||
| 102 | IPSET_ATTR_ETHER = IPSET_ATTR_CADT_MAX + 1, | ||
| 103 | IPSET_ATTR_NAME, | ||
| 104 | IPSET_ATTR_NAMEREF, | ||
| 105 | IPSET_ATTR_IP2, | ||
| 106 | IPSET_ATTR_CIDR2, | ||
| 107 | __IPSET_ATTR_ADT_MAX, | ||
| 108 | }; | ||
| 109 | #define IPSET_ATTR_ADT_MAX (__IPSET_ATTR_ADT_MAX - 1) | ||
| 110 | |||
| 111 | /* IP specific attributes */ | ||
| 112 | enum { | ||
| 113 | IPSET_ATTR_IPADDR_IPV4 = IPSET_ATTR_UNSPEC + 1, | ||
| 114 | IPSET_ATTR_IPADDR_IPV6, | ||
| 115 | __IPSET_ATTR_IPADDR_MAX, | ||
| 116 | }; | ||
| 117 | #define IPSET_ATTR_IPADDR_MAX (__IPSET_ATTR_IPADDR_MAX - 1) | ||
| 118 | |||
| 119 | /* Error codes */ | ||
| 120 | enum ipset_errno { | ||
| 121 | IPSET_ERR_PRIVATE = 4096, | ||
| 122 | IPSET_ERR_PROTOCOL, | ||
| 123 | IPSET_ERR_FIND_TYPE, | ||
| 124 | IPSET_ERR_MAX_SETS, | ||
| 125 | IPSET_ERR_BUSY, | ||
| 126 | IPSET_ERR_EXIST_SETNAME2, | ||
| 127 | IPSET_ERR_TYPE_MISMATCH, | ||
| 128 | IPSET_ERR_EXIST, | ||
| 129 | IPSET_ERR_INVALID_CIDR, | ||
| 130 | IPSET_ERR_INVALID_NETMASK, | ||
| 131 | IPSET_ERR_INVALID_FAMILY, | ||
| 132 | IPSET_ERR_TIMEOUT, | ||
| 133 | IPSET_ERR_REFERENCED, | ||
| 134 | IPSET_ERR_IPADDR_IPV4, | ||
| 135 | IPSET_ERR_IPADDR_IPV6, | ||
| 136 | |||
| 137 | /* Type specific error codes */ | ||
| 138 | IPSET_ERR_TYPE_SPECIFIC = 4352, | ||
| 139 | }; | ||
| 140 | |||
| 141 | /* Flags at command level */ | ||
| 142 | enum ipset_cmd_flags { | ||
| 143 | IPSET_FLAG_BIT_EXIST = 0, | ||
| 144 | IPSET_FLAG_EXIST = (1 << IPSET_FLAG_BIT_EXIST), | ||
| 145 | }; | ||
| 146 | |||
| 147 | /* Flags at CADT attribute level */ | ||
| 148 | enum ipset_cadt_flags { | ||
| 149 | IPSET_FLAG_BIT_BEFORE = 0, | ||
| 150 | IPSET_FLAG_BEFORE = (1 << IPSET_FLAG_BIT_BEFORE), | ||
| 151 | }; | ||
| 152 | |||
| 153 | /* Commands with settype-specific attributes */ | ||
| 154 | enum ipset_adt { | ||
| 155 | IPSET_ADD, | ||
| 156 | IPSET_DEL, | ||
| 157 | IPSET_TEST, | ||
| 158 | IPSET_ADT_MAX, | ||
| 159 | IPSET_CREATE = IPSET_ADT_MAX, | ||
| 160 | IPSET_CADT_MAX, | ||
| 161 | }; | ||
| 162 | |||
| 163 | #ifdef __KERNEL__ | ||
| 164 | #include <linux/ip.h> | ||
| 165 | #include <linux/ipv6.h> | ||
| 166 | #include <linux/netlink.h> | ||
| 167 | #include <linux/netfilter.h> | ||
| 168 | #include <linux/vmalloc.h> | ||
| 169 | #include <net/netlink.h> | ||
| 170 | |||
| 171 | /* Sets are identified by an index in kernel space. Tweak with ip_set_id_t | ||
| 172 | * and IPSET_INVALID_ID if you want to increase the max number of sets. | ||
| 173 | */ | ||
| 174 | typedef u16 ip_set_id_t; | ||
| 175 | |||
| 176 | #define IPSET_INVALID_ID 65535 | ||
| 177 | |||
| 178 | enum ip_set_dim { | ||
| 179 | IPSET_DIM_ZERO = 0, | ||
| 180 | IPSET_DIM_ONE, | ||
| 181 | IPSET_DIM_TWO, | ||
| 182 | IPSET_DIM_THREE, | ||
| 183 | /* Max dimension in elements. | ||
| 184 | * If changed, new revision of iptables match/target is required. | ||
| 185 | */ | ||
| 186 | IPSET_DIM_MAX = 6, | ||
| 187 | }; | ||
| 188 | |||
| 189 | /* Option flags for kernel operations */ | ||
| 190 | enum ip_set_kopt { | ||
| 191 | IPSET_INV_MATCH = (1 << IPSET_DIM_ZERO), | ||
| 192 | IPSET_DIM_ONE_SRC = (1 << IPSET_DIM_ONE), | ||
| 193 | IPSET_DIM_TWO_SRC = (1 << IPSET_DIM_TWO), | ||
| 194 | IPSET_DIM_THREE_SRC = (1 << IPSET_DIM_THREE), | ||
| 195 | }; | ||
| 196 | |||
| 197 | /* Set features */ | ||
| 198 | enum ip_set_feature { | ||
| 199 | IPSET_TYPE_IP_FLAG = 0, | ||
| 200 | IPSET_TYPE_IP = (1 << IPSET_TYPE_IP_FLAG), | ||
| 201 | IPSET_TYPE_PORT_FLAG = 1, | ||
| 202 | IPSET_TYPE_PORT = (1 << IPSET_TYPE_PORT_FLAG), | ||
| 203 | IPSET_TYPE_MAC_FLAG = 2, | ||
| 204 | IPSET_TYPE_MAC = (1 << IPSET_TYPE_MAC_FLAG), | ||
| 205 | IPSET_TYPE_IP2_FLAG = 3, | ||
| 206 | IPSET_TYPE_IP2 = (1 << IPSET_TYPE_IP2_FLAG), | ||
| 207 | IPSET_TYPE_NAME_FLAG = 4, | ||
| 208 | IPSET_TYPE_NAME = (1 << IPSET_TYPE_NAME_FLAG), | ||
| 209 | /* Strictly speaking not a feature, but a flag for dumping: | ||
| 210 | * this settype must be dumped last */ | ||
| 211 | IPSET_DUMP_LAST_FLAG = 7, | ||
| 212 | IPSET_DUMP_LAST = (1 << IPSET_DUMP_LAST_FLAG), | ||
| 213 | }; | ||
| 214 | |||
| 215 | struct ip_set; | ||
| 216 | |||
| 217 | typedef int (*ipset_adtfn)(struct ip_set *set, void *value, u32 timeout); | ||
| 218 | |||
| 219 | /* Set type, variant-specific part */ | ||
| 220 | struct ip_set_type_variant { | ||
| 221 | /* Kernelspace: test/add/del entries | ||
| 222 | * returns negative error code, | ||
| 223 | * zero for no match/success to add/delete | ||
| 224 | * positive for matching element */ | ||
| 225 | int (*kadt)(struct ip_set *set, const struct sk_buff * skb, | ||
| 226 | enum ipset_adt adt, u8 pf, u8 dim, u8 flags); | ||
| 227 | |||
| 228 | /* Userspace: test/add/del entries | ||
| 229 | * returns negative error code, | ||
| 230 | * zero for no match/success to add/delete | ||
| 231 | * positive for matching element */ | ||
| 232 | int (*uadt)(struct ip_set *set, struct nlattr *tb[], | ||
| 233 | enum ipset_adt adt, u32 *lineno, u32 flags); | ||
| 234 | |||
| 235 | /* Low level add/del/test functions */ | ||
| 236 | ipset_adtfn adt[IPSET_ADT_MAX]; | ||
| 237 | |||
| 238 | /* When adding entries and set is full, try to resize the set */ | ||
| 239 | int (*resize)(struct ip_set *set, bool retried); | ||
| 240 | /* Destroy the set */ | ||
| 241 | void (*destroy)(struct ip_set *set); | ||
| 242 | /* Flush the elements */ | ||
| 243 | void (*flush)(struct ip_set *set); | ||
| 244 | /* Expire entries before listing */ | ||
| 245 | void (*expire)(struct ip_set *set); | ||
| 246 | /* List set header data */ | ||
| 247 | int (*head)(struct ip_set *set, struct sk_buff *skb); | ||
| 248 | /* List elements */ | ||
| 249 | int (*list)(const struct ip_set *set, struct sk_buff *skb, | ||
| 250 | struct netlink_callback *cb); | ||
| 251 | |||
| 252 | /* Return true if "b" set is the same as "a" | ||
| 253 | * according to the create set parameters */ | ||
| 254 | bool (*same_set)(const struct ip_set *a, const struct ip_set *b); | ||
| 255 | }; | ||
| 256 | |||
| 257 | /* The core set type structure */ | ||
| 258 | struct ip_set_type { | ||
| 259 | struct list_head list; | ||
| 260 | |||
| 261 | /* Typename */ | ||
| 262 | char name[IPSET_MAXNAMELEN]; | ||
| 263 | /* Protocol version */ | ||
| 264 | u8 protocol; | ||
| 265 | /* Set features to control swapping */ | ||
| 266 | u8 features; | ||
| 267 | /* Set type dimension */ | ||
| 268 | u8 dimension; | ||
| 269 | /* Supported family: may be AF_UNSPEC for both AF_INET/AF_INET6 */ | ||
| 270 | u8 family; | ||
| 271 | /* Type revision */ | ||
| 272 | u8 revision; | ||
| 273 | |||
| 274 | /* Create set */ | ||
| 275 | int (*create)(struct ip_set *set, struct nlattr *tb[], u32 flags); | ||
| 276 | |||
| 277 | /* Attribute policies */ | ||
| 278 | const struct nla_policy create_policy[IPSET_ATTR_CREATE_MAX + 1]; | ||
| 279 | const struct nla_policy adt_policy[IPSET_ATTR_ADT_MAX + 1]; | ||
| 280 | |||
| 281 | /* Set this to THIS_MODULE if you are a module, otherwise NULL */ | ||
| 282 | struct module *me; | ||
| 283 | }; | ||
| 284 | |||
| 285 | /* register and unregister set type */ | ||
| 286 | extern int ip_set_type_register(struct ip_set_type *set_type); | ||
| 287 | extern void ip_set_type_unregister(struct ip_set_type *set_type); | ||
| 288 | |||
| 289 | /* A generic IP set */ | ||
| 290 | struct ip_set { | ||
| 291 | /* The name of the set */ | ||
| 292 | char name[IPSET_MAXNAMELEN]; | ||
| 293 | /* Lock protecting the set data */ | ||
| 294 | rwlock_t lock; | ||
| 295 | /* References to the set */ | ||
| 296 | atomic_t ref; | ||
| 297 | /* The core set type */ | ||
| 298 | struct ip_set_type *type; | ||
| 299 | /* The type variant doing the real job */ | ||
| 300 | const struct ip_set_type_variant *variant; | ||
| 301 | /* The actual INET family of the set */ | ||
| 302 | u8 family; | ||
| 303 | /* The type specific data */ | ||
| 304 | void *data; | ||
| 305 | }; | ||
| 306 | |||
| 307 | /* register and unregister set references */ | ||
| 308 | extern ip_set_id_t ip_set_get_byname(const char *name, struct ip_set **set); | ||
| 309 | extern void ip_set_put_byindex(ip_set_id_t index); | ||
| 310 | extern const char * ip_set_name_byindex(ip_set_id_t index); | ||
| 311 | extern ip_set_id_t ip_set_nfnl_get(const char *name); | ||
| 312 | extern ip_set_id_t ip_set_nfnl_get_byindex(ip_set_id_t index); | ||
| 313 | extern void ip_set_nfnl_put(ip_set_id_t index); | ||
| 314 | |||
| 315 | /* API for iptables set match, and SET target */ | ||
| 316 | extern int ip_set_add(ip_set_id_t id, const struct sk_buff *skb, | ||
| 317 | u8 family, u8 dim, u8 flags); | ||
| 318 | extern int ip_set_del(ip_set_id_t id, const struct sk_buff *skb, | ||
| 319 | u8 family, u8 dim, u8 flags); | ||
| 320 | extern int ip_set_test(ip_set_id_t id, const struct sk_buff *skb, | ||
| 321 | u8 family, u8 dim, u8 flags); | ||
| 322 | |||
| 323 | /* Utility functions */ | ||
| 324 | extern void * ip_set_alloc(size_t size); | ||
| 325 | extern void ip_set_free(void *members); | ||
| 326 | extern int ip_set_get_ipaddr4(struct nlattr *nla, __be32 *ipaddr); | ||
| 327 | extern int ip_set_get_ipaddr6(struct nlattr *nla, union nf_inet_addr *ipaddr); | ||
| 328 | |||
| 329 | static inline int | ||
| 330 | ip_set_get_hostipaddr4(struct nlattr *nla, u32 *ipaddr) | ||
| 331 | { | ||
| 332 | __be32 ip; | ||
| 333 | int ret = ip_set_get_ipaddr4(nla, &ip); | ||
| 334 | |||
| 335 | if (ret) | ||
| 336 | return ret; | ||
| 337 | *ipaddr = ntohl(ip); | ||
| 338 | return 0; | ||
| 339 | } | ||
| 340 | |||
| 341 | /* Ignore IPSET_ERR_EXIST errors if asked to do so? */ | ||
| 342 | static inline bool | ||
| 343 | ip_set_eexist(int ret, u32 flags) | ||
| 344 | { | ||
| 345 | return ret == -IPSET_ERR_EXIST && (flags & IPSET_FLAG_EXIST); | ||
| 346 | } | ||
| 347 | |||
| 348 | /* Check the NLA_F_NET_BYTEORDER flag */ | ||
| 349 | static inline bool | ||
| 350 | ip_set_attr_netorder(struct nlattr *tb[], int type) | ||
| 351 | { | ||
| 352 | return tb[type] && (tb[type]->nla_type & NLA_F_NET_BYTEORDER); | ||
| 353 | } | ||
| 354 | |||
| 355 | static inline bool | ||
| 356 | ip_set_optattr_netorder(struct nlattr *tb[], int type) | ||
| 357 | { | ||
| 358 | return !tb[type] || (tb[type]->nla_type & NLA_F_NET_BYTEORDER); | ||
| 359 | } | ||
| 360 | |||
| 361 | /* Useful converters */ | ||
| 362 | static inline u32 | ||
| 363 | ip_set_get_h32(const struct nlattr *attr) | ||
| 364 | { | ||
| 365 | return ntohl(nla_get_be32(attr)); | ||
| 366 | } | ||
| 367 | |||
| 368 | static inline u16 | ||
| 369 | ip_set_get_h16(const struct nlattr *attr) | ||
| 370 | { | ||
| 371 | return ntohs(nla_get_be16(attr)); | ||
| 372 | } | ||
| 373 | |||
| 374 | #define ipset_nest_start(skb, attr) nla_nest_start(skb, attr | NLA_F_NESTED) | ||
| 375 | #define ipset_nest_end(skb, start) nla_nest_end(skb, start) | ||
| 376 | |||
| 377 | #define NLA_PUT_IPADDR4(skb, type, ipaddr) \ | ||
| 378 | do { \ | ||
| 379 | struct nlattr *__nested = ipset_nest_start(skb, type); \ | ||
| 380 | \ | ||
| 381 | if (!__nested) \ | ||
| 382 | goto nla_put_failure; \ | ||
| 383 | NLA_PUT_NET32(skb, IPSET_ATTR_IPADDR_IPV4, ipaddr); \ | ||
| 384 | ipset_nest_end(skb, __nested); \ | ||
| 385 | } while (0) | ||
| 386 | |||
| 387 | #define NLA_PUT_IPADDR6(skb, type, ipaddrptr) \ | ||
| 388 | do { \ | ||
| 389 | struct nlattr *__nested = ipset_nest_start(skb, type); \ | ||
| 390 | \ | ||
| 391 | if (!__nested) \ | ||
| 392 | goto nla_put_failure; \ | ||
| 393 | NLA_PUT(skb, IPSET_ATTR_IPADDR_IPV6, \ | ||
| 394 | sizeof(struct in6_addr), ipaddrptr); \ | ||
| 395 | ipset_nest_end(skb, __nested); \ | ||
| 396 | } while (0) | ||
| 397 | |||
| 398 | /* Get address from skbuff */ | ||
| 399 | static inline __be32 | ||
| 400 | ip4addr(const struct sk_buff *skb, bool src) | ||
| 401 | { | ||
| 402 | return src ? ip_hdr(skb)->saddr : ip_hdr(skb)->daddr; | ||
| 403 | } | ||
| 404 | |||
| 405 | static inline void | ||
| 406 | ip4addrptr(const struct sk_buff *skb, bool src, __be32 *addr) | ||
| 407 | { | ||
| 408 | *addr = src ? ip_hdr(skb)->saddr : ip_hdr(skb)->daddr; | ||
| 409 | } | ||
| 410 | |||
| 411 | static inline void | ||
| 412 | ip6addrptr(const struct sk_buff *skb, bool src, struct in6_addr *addr) | ||
| 413 | { | ||
| 414 | memcpy(addr, src ? &ipv6_hdr(skb)->saddr : &ipv6_hdr(skb)->daddr, | ||
| 415 | sizeof(*addr)); | ||
| 416 | } | ||
| 417 | |||
| 418 | /* Calculate the bytes required to store the inclusive range of a-b */ | ||
| 419 | static inline int | ||
| 420 | bitmap_bytes(u32 a, u32 b) | ||
| 421 | { | ||
| 422 | return 4 * ((((b - a + 8) / 8) + 3) / 4); | ||
| 423 | } | ||
| 424 | |||
| 425 | /* Interface to iptables/ip6tables */ | ||
| 426 | |||
| 427 | #define SO_IP_SET 83 | ||
| 428 | |||
| 429 | union ip_set_name_index { | ||
| 430 | char name[IPSET_MAXNAMELEN]; | ||
| 431 | ip_set_id_t index; | ||
| 432 | }; | ||
| 433 | |||
| 434 | #define IP_SET_OP_GET_BYNAME 0x00000006 /* Get set index by name */ | ||
| 435 | struct ip_set_req_get_set { | ||
| 436 | unsigned op; | ||
| 437 | unsigned version; | ||
| 438 | union ip_set_name_index set; | ||
| 439 | }; | ||
| 440 | |||
| 441 | #define IP_SET_OP_GET_BYINDEX 0x00000007 /* Get set name by index */ | ||
| 442 | /* Uses ip_set_req_get_set */ | ||
| 443 | |||
| 444 | #define IP_SET_OP_VERSION 0x00000100 /* Ask kernel version */ | ||
| 445 | struct ip_set_req_version { | ||
| 446 | unsigned op; | ||
| 447 | unsigned version; | ||
| 448 | }; | ||
| 449 | |||
| 450 | #endif /* __KERNEL__ */ | ||
| 451 | |||
| 452 | #endif /*_IP_SET_H */ | ||
diff --git a/include/linux/netfilter/ipset/ip_set_ahash.h b/include/linux/netfilter/ipset/ip_set_ahash.h new file mode 100644 index 000000000000..ec9d9bea1e37 --- /dev/null +++ b/include/linux/netfilter/ipset/ip_set_ahash.h | |||
| @@ -0,0 +1,1074 @@ | |||
| 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 | /* Hashing which uses arrays to resolve clashing. The hash table is resized | ||
| 9 | * (doubled) when searching becomes too long. | ||
| 10 | * Internally jhash is used with the assumption that the size of the | ||
| 11 | * stored data is a multiple of sizeof(u32). If storage supports timeout, | ||
| 12 | * the timeout field must be the last one in the data structure - that field | ||
| 13 | * is ignored when computing the hash key. | ||
| 14 | * | ||
| 15 | * Readers and resizing | ||
| 16 | * | ||
| 17 | * Resizing can be triggered by userspace command only, and those | ||
| 18 | * are serialized by the nfnl mutex. During resizing the set is | ||
| 19 | * read-locked, so the only possible concurrent operations are | ||
| 20 | * the kernel side readers. Those must be protected by proper RCU locking. | ||
| 21 | */ | ||
| 22 | |||
| 23 | /* Number of elements to store in an initial array block */ | ||
| 24 | #define AHASH_INIT_SIZE 4 | ||
| 25 | /* Max number of elements to store in an array block */ | ||
| 26 | #define AHASH_MAX_SIZE (3*4) | ||
| 27 | |||
| 28 | /* A hash bucket */ | ||
| 29 | struct hbucket { | ||
| 30 | void *value; /* the array of the values */ | ||
| 31 | u8 size; /* size of the array */ | ||
| 32 | u8 pos; /* position of the first free entry */ | ||
| 33 | }; | ||
| 34 | |||
| 35 | /* The hash table: the table size stored here in order to make resizing easy */ | ||
| 36 | struct htable { | ||
| 37 | u8 htable_bits; /* size of hash table == 2^htable_bits */ | ||
| 38 | struct hbucket bucket[0]; /* hashtable buckets */ | ||
| 39 | }; | ||
| 40 | |||
| 41 | #define hbucket(h, i) &((h)->bucket[i]) | ||
| 42 | |||
| 43 | /* Book-keeping of the prefixes added to the set */ | ||
| 44 | struct ip_set_hash_nets { | ||
| 45 | u8 cidr; /* the different cidr values in the set */ | ||
| 46 | u32 nets; /* number of elements per cidr */ | ||
| 47 | }; | ||
| 48 | |||
| 49 | /* The generic ip_set hash structure */ | ||
| 50 | struct ip_set_hash { | ||
| 51 | struct htable *table; /* the hash table */ | ||
| 52 | u32 maxelem; /* max elements in the hash */ | ||
| 53 | u32 elements; /* current element (vs timeout) */ | ||
| 54 | u32 initval; /* random jhash init value */ | ||
| 55 | u32 timeout; /* timeout value, if enabled */ | ||
| 56 | struct timer_list gc; /* garbage collection when timeout enabled */ | ||
| 57 | #ifdef IP_SET_HASH_WITH_NETMASK | ||
| 58 | u8 netmask; /* netmask value for subnets to store */ | ||
| 59 | #endif | ||
| 60 | #ifdef IP_SET_HASH_WITH_NETS | ||
| 61 | struct ip_set_hash_nets nets[0]; /* book-keeping of prefixes */ | ||
| 62 | #endif | ||
| 63 | }; | ||
| 64 | |||
| 65 | /* Compute htable_bits from the user input parameter hashsize */ | ||
| 66 | static u8 | ||
| 67 | htable_bits(u32 hashsize) | ||
| 68 | { | ||
| 69 | /* Assume that hashsize == 2^htable_bits */ | ||
| 70 | u8 bits = fls(hashsize - 1); | ||
| 71 | if (jhash_size(bits) != hashsize) | ||
| 72 | /* Round up to the first 2^n value */ | ||
| 73 | bits = fls(hashsize); | ||
| 74 | |||
| 75 | return bits; | ||
| 76 | } | ||
| 77 | |||
| 78 | #ifdef IP_SET_HASH_WITH_NETS | ||
| 79 | |||
| 80 | #define SET_HOST_MASK(family) (family == AF_INET ? 32 : 128) | ||
| 81 | |||
| 82 | /* Network cidr size book keeping when the hash stores different | ||
| 83 | * sized networks */ | ||
| 84 | static void | ||
| 85 | add_cidr(struct ip_set_hash *h, u8 cidr, u8 host_mask) | ||
| 86 | { | ||
| 87 | u8 i; | ||
| 88 | |||
| 89 | ++h->nets[cidr-1].nets; | ||
| 90 | |||
| 91 | pr_debug("add_cidr added %u: %u\n", cidr, h->nets[cidr-1].nets); | ||
| 92 | |||
| 93 | if (h->nets[cidr-1].nets > 1) | ||
| 94 | return; | ||
| 95 | |||
| 96 | /* New cidr size */ | ||
| 97 | for (i = 0; i < host_mask && h->nets[i].cidr; i++) { | ||
| 98 | /* Add in increasing prefix order, so larger cidr first */ | ||
| 99 | if (h->nets[i].cidr < cidr) | ||
| 100 | swap(h->nets[i].cidr, cidr); | ||
| 101 | } | ||
| 102 | if (i < host_mask) | ||
| 103 | h->nets[i].cidr = cidr; | ||
| 104 | } | ||
| 105 | |||
| 106 | static void | ||
| 107 | del_cidr(struct ip_set_hash *h, u8 cidr, u8 host_mask) | ||
| 108 | { | ||
| 109 | u8 i; | ||
| 110 | |||
| 111 | --h->nets[cidr-1].nets; | ||
| 112 | |||
| 113 | pr_debug("del_cidr deleted %u: %u\n", cidr, h->nets[cidr-1].nets); | ||
| 114 | |||
| 115 | if (h->nets[cidr-1].nets != 0) | ||
| 116 | return; | ||
| 117 | |||
| 118 | /* All entries with this cidr size deleted, so cleanup h->cidr[] */ | ||
| 119 | for (i = 0; i < host_mask - 1 && h->nets[i].cidr; i++) { | ||
| 120 | if (h->nets[i].cidr == cidr) | ||
| 121 | h->nets[i].cidr = cidr = h->nets[i+1].cidr; | ||
| 122 | } | ||
| 123 | h->nets[i - 1].cidr = 0; | ||
| 124 | } | ||
| 125 | #endif | ||
| 126 | |||
| 127 | /* Destroy the hashtable part of the set */ | ||
| 128 | static void | ||
| 129 | ahash_destroy(struct htable *t) | ||
| 130 | { | ||
| 131 | struct hbucket *n; | ||
| 132 | u32 i; | ||
| 133 | |||
| 134 | for (i = 0; i < jhash_size(t->htable_bits); i++) { | ||
| 135 | n = hbucket(t, i); | ||
| 136 | if (n->size) | ||
| 137 | /* FIXME: use slab cache */ | ||
| 138 | kfree(n->value); | ||
| 139 | } | ||
| 140 | |||
| 141 | ip_set_free(t); | ||
| 142 | } | ||
| 143 | |||
| 144 | /* Calculate the actual memory size of the set data */ | ||
| 145 | static size_t | ||
| 146 | ahash_memsize(const struct ip_set_hash *h, size_t dsize, u8 host_mask) | ||
| 147 | { | ||
| 148 | u32 i; | ||
| 149 | struct htable *t = h->table; | ||
| 150 | size_t memsize = sizeof(*h) | ||
| 151 | + sizeof(*t) | ||
| 152 | #ifdef IP_SET_HASH_WITH_NETS | ||
| 153 | + sizeof(struct ip_set_hash_nets) * host_mask | ||
| 154 | #endif | ||
| 155 | + jhash_size(t->htable_bits) * sizeof(struct hbucket); | ||
| 156 | |||
| 157 | for (i = 0; i < jhash_size(t->htable_bits); i++) | ||
| 158 | memsize += t->bucket[i].size * dsize; | ||
| 159 | |||
| 160 | return memsize; | ||
| 161 | } | ||
| 162 | |||
| 163 | /* Flush a hash type of set: destroy all elements */ | ||
| 164 | static void | ||
| 165 | ip_set_hash_flush(struct ip_set *set) | ||
| 166 | { | ||
| 167 | struct ip_set_hash *h = set->data; | ||
| 168 | struct htable *t = h->table; | ||
| 169 | struct hbucket *n; | ||
| 170 | u32 i; | ||
| 171 | |||
| 172 | for (i = 0; i < jhash_size(t->htable_bits); i++) { | ||
| 173 | n = hbucket(t, i); | ||
| 174 | if (n->size) { | ||
| 175 | n->size = n->pos = 0; | ||
| 176 | /* FIXME: use slab cache */ | ||
| 177 | kfree(n->value); | ||
| 178 | } | ||
| 179 | } | ||
| 180 | #ifdef IP_SET_HASH_WITH_NETS | ||
| 181 | memset(h->nets, 0, sizeof(struct ip_set_hash_nets) | ||
| 182 | * SET_HOST_MASK(set->family)); | ||
| 183 | #endif | ||
| 184 | h->elements = 0; | ||
| 185 | } | ||
| 186 | |||
| 187 | /* Destroy a hash type of set */ | ||
| 188 | static void | ||
| 189 | ip_set_hash_destroy(struct ip_set *set) | ||
| 190 | { | ||
| 191 | struct ip_set_hash *h = set->data; | ||
| 192 | |||
| 193 | if (with_timeout(h->timeout)) | ||
| 194 | del_timer_sync(&h->gc); | ||
| 195 | |||
| 196 | ahash_destroy(h->table); | ||
| 197 | kfree(h); | ||
| 198 | |||
| 199 | set->data = NULL; | ||
| 200 | } | ||
| 201 | |||
| 202 | #define HKEY(data, initval, htable_bits) \ | ||
| 203 | (jhash2((u32 *)(data), sizeof(struct type_pf_elem)/sizeof(u32), initval) \ | ||
| 204 | & jhash_mask(htable_bits)) | ||
| 205 | |||
| 206 | #endif /* _IP_SET_AHASH_H */ | ||
| 207 | |||
| 208 | #define CONCAT(a, b, c) a##b##c | ||
| 209 | #define TOKEN(a, b, c) CONCAT(a, b, c) | ||
| 210 | |||
| 211 | /* Type/family dependent function prototypes */ | ||
| 212 | |||
| 213 | #define type_pf_data_equal TOKEN(TYPE, PF, _data_equal) | ||
| 214 | #define type_pf_data_isnull TOKEN(TYPE, PF, _data_isnull) | ||
| 215 | #define type_pf_data_copy TOKEN(TYPE, PF, _data_copy) | ||
| 216 | #define type_pf_data_zero_out TOKEN(TYPE, PF, _data_zero_out) | ||
| 217 | #define type_pf_data_netmask TOKEN(TYPE, PF, _data_netmask) | ||
| 218 | #define type_pf_data_list TOKEN(TYPE, PF, _data_list) | ||
| 219 | #define type_pf_data_tlist TOKEN(TYPE, PF, _data_tlist) | ||
| 220 | |||
| 221 | #define type_pf_elem TOKEN(TYPE, PF, _elem) | ||
| 222 | #define type_pf_telem TOKEN(TYPE, PF, _telem) | ||
| 223 | #define type_pf_data_timeout TOKEN(TYPE, PF, _data_timeout) | ||
| 224 | #define type_pf_data_expired TOKEN(TYPE, PF, _data_expired) | ||
| 225 | #define type_pf_data_timeout_set TOKEN(TYPE, PF, _data_timeout_set) | ||
| 226 | |||
| 227 | #define type_pf_elem_add TOKEN(TYPE, PF, _elem_add) | ||
| 228 | #define type_pf_add TOKEN(TYPE, PF, _add) | ||
| 229 | #define type_pf_del TOKEN(TYPE, PF, _del) | ||
| 230 | #define type_pf_test_cidrs TOKEN(TYPE, PF, _test_cidrs) | ||
| 231 | #define type_pf_test TOKEN(TYPE, PF, _test) | ||
| 232 | |||
| 233 | #define type_pf_elem_tadd TOKEN(TYPE, PF, _elem_tadd) | ||
| 234 | #define type_pf_del_telem TOKEN(TYPE, PF, _ahash_del_telem) | ||
| 235 | #define type_pf_expire TOKEN(TYPE, PF, _expire) | ||
| 236 | #define type_pf_tadd TOKEN(TYPE, PF, _tadd) | ||
| 237 | #define type_pf_tdel TOKEN(TYPE, PF, _tdel) | ||
| 238 | #define type_pf_ttest_cidrs TOKEN(TYPE, PF, _ahash_ttest_cidrs) | ||
| 239 | #define type_pf_ttest TOKEN(TYPE, PF, _ahash_ttest) | ||
| 240 | |||
| 241 | #define type_pf_resize TOKEN(TYPE, PF, _resize) | ||
| 242 | #define type_pf_tresize TOKEN(TYPE, PF, _tresize) | ||
| 243 | #define type_pf_flush ip_set_hash_flush | ||
| 244 | #define type_pf_destroy ip_set_hash_destroy | ||
| 245 | #define type_pf_head TOKEN(TYPE, PF, _head) | ||
| 246 | #define type_pf_list TOKEN(TYPE, PF, _list) | ||
| 247 | #define type_pf_tlist TOKEN(TYPE, PF, _tlist) | ||
| 248 | #define type_pf_same_set TOKEN(TYPE, PF, _same_set) | ||
| 249 | #define type_pf_kadt TOKEN(TYPE, PF, _kadt) | ||
| 250 | #define type_pf_uadt TOKEN(TYPE, PF, _uadt) | ||
| 251 | #define type_pf_gc TOKEN(TYPE, PF, _gc) | ||
| 252 | #define type_pf_gc_init TOKEN(TYPE, PF, _gc_init) | ||
| 253 | #define type_pf_variant TOKEN(TYPE, PF, _variant) | ||
| 254 | #define type_pf_tvariant TOKEN(TYPE, PF, _tvariant) | ||
| 255 | |||
| 256 | /* Flavour without timeout */ | ||
| 257 | |||
| 258 | /* Get the ith element from the array block n */ | ||
| 259 | #define ahash_data(n, i) \ | ||
| 260 | ((struct type_pf_elem *)((n)->value) + (i)) | ||
| 261 | |||
| 262 | /* Add an element to the hash table when resizing the set: | ||
| 263 | * we spare the maintenance of the internal counters. */ | ||
| 264 | static int | ||
| 265 | type_pf_elem_add(struct hbucket *n, const struct type_pf_elem *value) | ||
| 266 | { | ||
| 267 | if (n->pos >= n->size) { | ||
| 268 | void *tmp; | ||
| 269 | |||
| 270 | if (n->size >= AHASH_MAX_SIZE) | ||
| 271 | /* Trigger rehashing */ | ||
| 272 | return -EAGAIN; | ||
| 273 | |||
| 274 | tmp = kzalloc((n->size + AHASH_INIT_SIZE) | ||
| 275 | * sizeof(struct type_pf_elem), | ||
| 276 | GFP_ATOMIC); | ||
| 277 | if (!tmp) | ||
| 278 | return -ENOMEM; | ||
| 279 | if (n->size) { | ||
| 280 | memcpy(tmp, n->value, | ||
| 281 | sizeof(struct type_pf_elem) * n->size); | ||
| 282 | kfree(n->value); | ||
| 283 | } | ||
| 284 | n->value = tmp; | ||
| 285 | n->size += AHASH_INIT_SIZE; | ||
| 286 | } | ||
| 287 | type_pf_data_copy(ahash_data(n, n->pos++), value); | ||
| 288 | return 0; | ||
| 289 | } | ||
| 290 | |||
| 291 | /* Resize a hash: create a new hash table with doubling the hashsize | ||
| 292 | * and inserting the elements to it. Repeat until we succeed or | ||
| 293 | * fail due to memory pressures. */ | ||
| 294 | static int | ||
| 295 | type_pf_resize(struct ip_set *set, bool retried) | ||
| 296 | { | ||
| 297 | struct ip_set_hash *h = set->data; | ||
| 298 | struct htable *t, *orig = h->table; | ||
| 299 | u8 htable_bits = orig->htable_bits; | ||
| 300 | const struct type_pf_elem *data; | ||
| 301 | struct hbucket *n, *m; | ||
| 302 | u32 i, j; | ||
| 303 | int ret; | ||
| 304 | |||
| 305 | retry: | ||
| 306 | ret = 0; | ||
| 307 | htable_bits++; | ||
| 308 | pr_debug("attempt to resize set %s from %u to %u, t %p\n", | ||
| 309 | set->name, orig->htable_bits, htable_bits, orig); | ||
| 310 | if (!htable_bits) | ||
| 311 | /* In case we have plenty of memory :-) */ | ||
| 312 | return -IPSET_ERR_HASH_FULL; | ||
| 313 | t = ip_set_alloc(sizeof(*t) | ||
| 314 | + jhash_size(htable_bits) * sizeof(struct hbucket)); | ||
| 315 | if (!t) | ||
| 316 | return -ENOMEM; | ||
| 317 | t->htable_bits = htable_bits; | ||
| 318 | |||
| 319 | read_lock_bh(&set->lock); | ||
| 320 | for (i = 0; i < jhash_size(orig->htable_bits); i++) { | ||
| 321 | n = hbucket(orig, i); | ||
| 322 | for (j = 0; j < n->pos; j++) { | ||
| 323 | data = ahash_data(n, j); | ||
| 324 | m = hbucket(t, HKEY(data, h->initval, htable_bits)); | ||
| 325 | ret = type_pf_elem_add(m, data); | ||
| 326 | if (ret < 0) { | ||
| 327 | read_unlock_bh(&set->lock); | ||
| 328 | ahash_destroy(t); | ||
| 329 | if (ret == -EAGAIN) | ||
| 330 | goto retry; | ||
| 331 | return ret; | ||
| 332 | } | ||
| 333 | } | ||
| 334 | } | ||
| 335 | |||
| 336 | rcu_assign_pointer(h->table, t); | ||
| 337 | read_unlock_bh(&set->lock); | ||
| 338 | |||
| 339 | /* Give time to other readers of the set */ | ||
| 340 | synchronize_rcu_bh(); | ||
| 341 | |||
| 342 | pr_debug("set %s resized from %u (%p) to %u (%p)\n", set->name, | ||
| 343 | orig->htable_bits, orig, t->htable_bits, t); | ||
| 344 | ahash_destroy(orig); | ||
| 345 | |||
| 346 | return 0; | ||
| 347 | } | ||
| 348 | |||
| 349 | /* Add an element to a hash and update the internal counters when succeeded, | ||
| 350 | * otherwise report the proper error code. */ | ||
| 351 | static int | ||
| 352 | type_pf_add(struct ip_set *set, void *value, u32 timeout) | ||
| 353 | { | ||
| 354 | struct ip_set_hash *h = set->data; | ||
| 355 | struct htable *t; | ||
| 356 | const struct type_pf_elem *d = value; | ||
| 357 | struct hbucket *n; | ||
| 358 | int i, ret = 0; | ||
| 359 | u32 key; | ||
| 360 | |||
| 361 | if (h->elements >= h->maxelem) | ||
| 362 | return -IPSET_ERR_HASH_FULL; | ||
| 363 | |||
| 364 | rcu_read_lock_bh(); | ||
| 365 | t = rcu_dereference_bh(h->table); | ||
| 366 | key = HKEY(value, h->initval, t->htable_bits); | ||
| 367 | n = hbucket(t, key); | ||
| 368 | for (i = 0; i < n->pos; i++) | ||
| 369 | if (type_pf_data_equal(ahash_data(n, i), d)) { | ||
| 370 | ret = -IPSET_ERR_EXIST; | ||
| 371 | goto out; | ||
| 372 | } | ||
| 373 | |||
| 374 | ret = type_pf_elem_add(n, value); | ||
| 375 | if (ret != 0) | ||
| 376 | goto out; | ||
| 377 | |||
| 378 | #ifdef IP_SET_HASH_WITH_NETS | ||
| 379 | add_cidr(h, d->cidr, HOST_MASK); | ||
| 380 | #endif | ||
| 381 | h->elements++; | ||
| 382 | out: | ||
| 383 | rcu_read_unlock_bh(); | ||
| 384 | return ret; | ||
| 385 | } | ||
| 386 | |||
| 387 | /* Delete an element from the hash: swap it with the last element | ||
| 388 | * and free up space if possible. | ||
| 389 | */ | ||
| 390 | static int | ||
| 391 | type_pf_del(struct ip_set *set, void *value, u32 timeout) | ||
| 392 | { | ||
| 393 | struct ip_set_hash *h = set->data; | ||
| 394 | struct htable *t = h->table; | ||
| 395 | const struct type_pf_elem *d = value; | ||
| 396 | struct hbucket *n; | ||
| 397 | int i; | ||
| 398 | struct type_pf_elem *data; | ||
| 399 | u32 key; | ||
| 400 | |||
| 401 | key = HKEY(value, h->initval, t->htable_bits); | ||
| 402 | n = hbucket(t, key); | ||
| 403 | for (i = 0; i < n->pos; i++) { | ||
| 404 | data = ahash_data(n, i); | ||
| 405 | if (!type_pf_data_equal(data, d)) | ||
| 406 | continue; | ||
| 407 | if (i != n->pos - 1) | ||
| 408 | /* Not last one */ | ||
| 409 | type_pf_data_copy(data, ahash_data(n, n->pos - 1)); | ||
| 410 | |||
| 411 | n->pos--; | ||
| 412 | h->elements--; | ||
| 413 | #ifdef IP_SET_HASH_WITH_NETS | ||
| 414 | del_cidr(h, d->cidr, HOST_MASK); | ||
| 415 | #endif | ||
| 416 | if (n->pos + AHASH_INIT_SIZE < n->size) { | ||
| 417 | void *tmp = kzalloc((n->size - AHASH_INIT_SIZE) | ||
| 418 | * sizeof(struct type_pf_elem), | ||
| 419 | GFP_ATOMIC); | ||
| 420 | if (!tmp) | ||
| 421 | return 0; | ||
| 422 | n->size -= AHASH_INIT_SIZE; | ||
| 423 | memcpy(tmp, n->value, | ||
| 424 | n->size * sizeof(struct type_pf_elem)); | ||
| 425 | kfree(n->value); | ||
| 426 | n->value = tmp; | ||
| 427 | } | ||
| 428 | return 0; | ||
| 429 | } | ||
| 430 | |||
| 431 | return -IPSET_ERR_EXIST; | ||
| 432 | } | ||
| 433 | |||
| 434 | #ifdef IP_SET_HASH_WITH_NETS | ||
| 435 | |||
| 436 | /* Special test function which takes into account the different network | ||
| 437 | * sizes added to the set */ | ||
| 438 | static int | ||
| 439 | type_pf_test_cidrs(struct ip_set *set, struct type_pf_elem *d, u32 timeout) | ||
| 440 | { | ||
| 441 | struct ip_set_hash *h = set->data; | ||
| 442 | struct htable *t = h->table; | ||
| 443 | struct hbucket *n; | ||
| 444 | const struct type_pf_elem *data; | ||
| 445 | int i, j = 0; | ||
| 446 | u32 key; | ||
| 447 | u8 host_mask = SET_HOST_MASK(set->family); | ||
| 448 | |||
| 449 | pr_debug("test by nets\n"); | ||
| 450 | for (; j < host_mask && h->nets[j].cidr; j++) { | ||
| 451 | type_pf_data_netmask(d, h->nets[j].cidr); | ||
| 452 | key = HKEY(d, h->initval, t->htable_bits); | ||
| 453 | n = hbucket(t, key); | ||
| 454 | for (i = 0; i < n->pos; i++) { | ||
| 455 | data = ahash_data(n, i); | ||
| 456 | if (type_pf_data_equal(data, d)) | ||
| 457 | return 1; | ||
| 458 | } | ||
| 459 | } | ||
| 460 | return 0; | ||
| 461 | } | ||
| 462 | #endif | ||
| 463 | |||
| 464 | /* Test whether the element is added to the set */ | ||
| 465 | static int | ||
| 466 | type_pf_test(struct ip_set *set, void *value, u32 timeout) | ||
| 467 | { | ||
| 468 | struct ip_set_hash *h = set->data; | ||
| 469 | struct htable *t = h->table; | ||
| 470 | struct type_pf_elem *d = value; | ||
| 471 | struct hbucket *n; | ||
| 472 | const struct type_pf_elem *data; | ||
| 473 | int i; | ||
| 474 | u32 key; | ||
| 475 | |||
| 476 | #ifdef IP_SET_HASH_WITH_NETS | ||
| 477 | /* If we test an IP address and not a network address, | ||
| 478 | * try all possible network sizes */ | ||
| 479 | if (d->cidr == SET_HOST_MASK(set->family)) | ||
| 480 | return type_pf_test_cidrs(set, d, timeout); | ||
| 481 | #endif | ||
| 482 | |||
| 483 | key = HKEY(d, h->initval, t->htable_bits); | ||
| 484 | n = hbucket(t, key); | ||
| 485 | for (i = 0; i < n->pos; i++) { | ||
| 486 | data = ahash_data(n, i); | ||
| 487 | if (type_pf_data_equal(data, d)) | ||
| 488 | return 1; | ||
| 489 | } | ||
| 490 | return 0; | ||
| 491 | } | ||
| 492 | |||
| 493 | /* Reply a HEADER request: fill out the header part of the set */ | ||
| 494 | static int | ||
| 495 | type_pf_head(struct ip_set *set, struct sk_buff *skb) | ||
| 496 | { | ||
| 497 | const struct ip_set_hash *h = set->data; | ||
| 498 | struct nlattr *nested; | ||
| 499 | size_t memsize; | ||
| 500 | |||
| 501 | read_lock_bh(&set->lock); | ||
| 502 | memsize = ahash_memsize(h, with_timeout(h->timeout) | ||
| 503 | ? sizeof(struct type_pf_telem) | ||
| 504 | : sizeof(struct type_pf_elem), | ||
| 505 | set->family == AF_INET ? 32 : 128); | ||
| 506 | read_unlock_bh(&set->lock); | ||
| 507 | |||
| 508 | nested = ipset_nest_start(skb, IPSET_ATTR_DATA); | ||
| 509 | if (!nested) | ||
| 510 | goto nla_put_failure; | ||
| 511 | NLA_PUT_NET32(skb, IPSET_ATTR_HASHSIZE, | ||
| 512 | htonl(jhash_size(h->table->htable_bits))); | ||
| 513 | NLA_PUT_NET32(skb, IPSET_ATTR_MAXELEM, htonl(h->maxelem)); | ||
| 514 | #ifdef IP_SET_HASH_WITH_NETMASK | ||
| 515 | if (h->netmask != HOST_MASK) | ||
| 516 | NLA_PUT_U8(skb, IPSET_ATTR_NETMASK, h->netmask); | ||
| 517 | #endif | ||
| 518 | NLA_PUT_NET32(skb, IPSET_ATTR_REFERENCES, | ||
| 519 | htonl(atomic_read(&set->ref) - 1)); | ||
| 520 | NLA_PUT_NET32(skb, IPSET_ATTR_MEMSIZE, htonl(memsize)); | ||
| 521 | if (with_timeout(h->timeout)) | ||
| 522 | NLA_PUT_NET32(skb, IPSET_ATTR_TIMEOUT, htonl(h->timeout)); | ||
| 523 | ipset_nest_end(skb, nested); | ||
| 524 | |||
| 525 | return 0; | ||
| 526 | nla_put_failure: | ||
| 527 | return -EMSGSIZE; | ||
| 528 | } | ||
| 529 | |||
| 530 | /* Reply a LIST/SAVE request: dump the elements of the specified set */ | ||
| 531 | static int | ||
| 532 | type_pf_list(const struct ip_set *set, | ||
| 533 | struct sk_buff *skb, struct netlink_callback *cb) | ||
| 534 | { | ||
| 535 | const struct ip_set_hash *h = set->data; | ||
| 536 | const struct htable *t = h->table; | ||
| 537 | struct nlattr *atd, *nested; | ||
| 538 | const struct hbucket *n; | ||
| 539 | const struct type_pf_elem *data; | ||
| 540 | u32 first = cb->args[2]; | ||
| 541 | /* We assume that one hash bucket fills into one page */ | ||
| 542 | void *incomplete; | ||
| 543 | int i; | ||
| 544 | |||
| 545 | atd = ipset_nest_start(skb, IPSET_ATTR_ADT); | ||
| 546 | if (!atd) | ||
| 547 | return -EMSGSIZE; | ||
| 548 | pr_debug("list hash set %s\n", set->name); | ||
| 549 | for (; cb->args[2] < jhash_size(t->htable_bits); cb->args[2]++) { | ||
| 550 | incomplete = skb_tail_pointer(skb); | ||
| 551 | n = hbucket(t, cb->args[2]); | ||
| 552 | pr_debug("cb->args[2]: %lu, t %p n %p\n", cb->args[2], t, n); | ||
| 553 | for (i = 0; i < n->pos; i++) { | ||
| 554 | data = ahash_data(n, i); | ||
| 555 | pr_debug("list hash %lu hbucket %p i %u, data %p\n", | ||
| 556 | cb->args[2], n, i, data); | ||
| 557 | nested = ipset_nest_start(skb, IPSET_ATTR_DATA); | ||
| 558 | if (!nested) { | ||
| 559 | if (cb->args[2] == first) { | ||
| 560 | nla_nest_cancel(skb, atd); | ||
| 561 | return -EMSGSIZE; | ||
| 562 | } else | ||
| 563 | goto nla_put_failure; | ||
| 564 | } | ||
| 565 | if (type_pf_data_list(skb, data)) | ||
| 566 | goto nla_put_failure; | ||
| 567 | ipset_nest_end(skb, nested); | ||
| 568 | } | ||
| 569 | } | ||
| 570 | ipset_nest_end(skb, atd); | ||
| 571 | /* Set listing finished */ | ||
| 572 | cb->args[2] = 0; | ||
| 573 | |||
| 574 | return 0; | ||
| 575 | |||
| 576 | nla_put_failure: | ||
| 577 | nlmsg_trim(skb, incomplete); | ||
| 578 | ipset_nest_end(skb, atd); | ||
| 579 | if (unlikely(first == cb->args[2])) { | ||
| 580 | pr_warning("Can't list set %s: one bucket does not fit into " | ||
| 581 | "a message. Please report it!\n", set->name); | ||
| 582 | cb->args[2] = 0; | ||
| 583 | return -EMSGSIZE; | ||
| 584 | } | ||
| 585 | return 0; | ||
| 586 | } | ||
| 587 | |||
| 588 | static int | ||
| 589 | type_pf_kadt(struct ip_set *set, const struct sk_buff * skb, | ||
| 590 | enum ipset_adt adt, u8 pf, u8 dim, u8 flags); | ||
| 591 | static int | ||
| 592 | type_pf_uadt(struct ip_set *set, struct nlattr *tb[], | ||
| 593 | enum ipset_adt adt, u32 *lineno, u32 flags); | ||
| 594 | |||
| 595 | static const struct ip_set_type_variant type_pf_variant = { | ||
| 596 | .kadt = type_pf_kadt, | ||
| 597 | .uadt = type_pf_uadt, | ||
| 598 | .adt = { | ||
| 599 | [IPSET_ADD] = type_pf_add, | ||
| 600 | [IPSET_DEL] = type_pf_del, | ||
| 601 | [IPSET_TEST] = type_pf_test, | ||
| 602 | }, | ||
| 603 | .destroy = type_pf_destroy, | ||
| 604 | .flush = type_pf_flush, | ||
| 605 | .head = type_pf_head, | ||
| 606 | .list = type_pf_list, | ||
| 607 | .resize = type_pf_resize, | ||
| 608 | .same_set = type_pf_same_set, | ||
| 609 | }; | ||
| 610 | |||
| 611 | /* Flavour with timeout support */ | ||
| 612 | |||
| 613 | #define ahash_tdata(n, i) \ | ||
| 614 | (struct type_pf_elem *)((struct type_pf_telem *)((n)->value) + (i)) | ||
| 615 | |||
| 616 | static inline u32 | ||
| 617 | type_pf_data_timeout(const struct type_pf_elem *data) | ||
| 618 | { | ||
| 619 | const struct type_pf_telem *tdata = | ||
| 620 | (const struct type_pf_telem *) data; | ||
| 621 | |||
| 622 | return tdata->timeout; | ||
| 623 | } | ||
| 624 | |||
| 625 | static inline bool | ||
| 626 | type_pf_data_expired(const struct type_pf_elem *data) | ||
| 627 | { | ||
| 628 | const struct type_pf_telem *tdata = | ||
| 629 | (const struct type_pf_telem *) data; | ||
| 630 | |||
| 631 | return ip_set_timeout_expired(tdata->timeout); | ||
| 632 | } | ||
| 633 | |||
| 634 | static inline void | ||
| 635 | type_pf_data_timeout_set(struct type_pf_elem *data, u32 timeout) | ||
| 636 | { | ||
| 637 | struct type_pf_telem *tdata = (struct type_pf_telem *) data; | ||
| 638 | |||
| 639 | tdata->timeout = ip_set_timeout_set(timeout); | ||
| 640 | } | ||
| 641 | |||
| 642 | static int | ||
| 643 | type_pf_elem_tadd(struct hbucket *n, const struct type_pf_elem *value, | ||
| 644 | u32 timeout) | ||
| 645 | { | ||
| 646 | struct type_pf_elem *data; | ||
| 647 | |||
| 648 | if (n->pos >= n->size) { | ||
| 649 | void *tmp; | ||
| 650 | |||
| 651 | if (n->size >= AHASH_MAX_SIZE) | ||
| 652 | /* Trigger rehashing */ | ||
| 653 | return -EAGAIN; | ||
| 654 | |||
| 655 | tmp = kzalloc((n->size + AHASH_INIT_SIZE) | ||
| 656 | * sizeof(struct type_pf_telem), | ||
| 657 | GFP_ATOMIC); | ||
| 658 | if (!tmp) | ||
| 659 | return -ENOMEM; | ||
| 660 | if (n->size) { | ||
| 661 | memcpy(tmp, n->value, | ||
| 662 | sizeof(struct type_pf_telem) * n->size); | ||
| 663 | kfree(n->value); | ||
| 664 | } | ||
| 665 | n->value = tmp; | ||
| 666 | n->size += AHASH_INIT_SIZE; | ||
| 667 | } | ||
| 668 | data = ahash_tdata(n, n->pos++); | ||
| 669 | type_pf_data_copy(data, value); | ||
| 670 | type_pf_data_timeout_set(data, timeout); | ||
| 671 | return 0; | ||
| 672 | } | ||
| 673 | |||
| 674 | /* Delete expired elements from the hashtable */ | ||
| 675 | static void | ||
| 676 | type_pf_expire(struct ip_set_hash *h) | ||
| 677 | { | ||
| 678 | struct htable *t = h->table; | ||
| 679 | struct hbucket *n; | ||
| 680 | struct type_pf_elem *data; | ||
| 681 | u32 i; | ||
| 682 | int j; | ||
| 683 | |||
| 684 | for (i = 0; i < jhash_size(t->htable_bits); i++) { | ||
| 685 | n = hbucket(t, i); | ||
| 686 | for (j = 0; j < n->pos; j++) { | ||
| 687 | data = ahash_tdata(n, j); | ||
| 688 | if (type_pf_data_expired(data)) { | ||
| 689 | pr_debug("expired %u/%u\n", i, j); | ||
| 690 | #ifdef IP_SET_HASH_WITH_NETS | ||
| 691 | del_cidr(h, data->cidr, HOST_MASK); | ||
| 692 | #endif | ||
| 693 | if (j != n->pos - 1) | ||
| 694 | /* Not last one */ | ||
| 695 | type_pf_data_copy(data, | ||
| 696 | ahash_tdata(n, n->pos - 1)); | ||
| 697 | n->pos--; | ||
| 698 | h->elements--; | ||
| 699 | } | ||
| 700 | } | ||
| 701 | if (n->pos + AHASH_INIT_SIZE < n->size) { | ||
| 702 | void *tmp = kzalloc((n->size - AHASH_INIT_SIZE) | ||
| 703 | * sizeof(struct type_pf_telem), | ||
| 704 | GFP_ATOMIC); | ||
| 705 | if (!tmp) | ||
| 706 | /* Still try to delete expired elements */ | ||
| 707 | continue; | ||
| 708 | n->size -= AHASH_INIT_SIZE; | ||
| 709 | memcpy(tmp, n->value, | ||
| 710 | n->size * sizeof(struct type_pf_telem)); | ||
| 711 | kfree(n->value); | ||
| 712 | n->value = tmp; | ||
| 713 | } | ||
| 714 | } | ||
| 715 | } | ||
| 716 | |||
| 717 | static int | ||
| 718 | type_pf_tresize(struct ip_set *set, bool retried) | ||
| 719 | { | ||
| 720 | struct ip_set_hash *h = set->data; | ||
| 721 | struct htable *t, *orig = h->table; | ||
| 722 | u8 htable_bits = orig->htable_bits; | ||
| 723 | const struct type_pf_elem *data; | ||
| 724 | struct hbucket *n, *m; | ||
| 725 | u32 i, j; | ||
| 726 | int ret; | ||
| 727 | |||
| 728 | /* Try to cleanup once */ | ||
| 729 | if (!retried) { | ||
| 730 | i = h->elements; | ||
| 731 | write_lock_bh(&set->lock); | ||
| 732 | type_pf_expire(set->data); | ||
| 733 | write_unlock_bh(&set->lock); | ||
| 734 | if (h->elements < i) | ||
| 735 | return 0; | ||
| 736 | } | ||
| 737 | |||
| 738 | retry: | ||
| 739 | ret = 0; | ||
| 740 | htable_bits++; | ||
| 741 | if (!htable_bits) | ||
| 742 | /* In case we have plenty of memory :-) */ | ||
| 743 | return -IPSET_ERR_HASH_FULL; | ||
| 744 | t = ip_set_alloc(sizeof(*t) | ||
| 745 | + jhash_size(htable_bits) * sizeof(struct hbucket)); | ||
| 746 | if (!t) | ||
| 747 | return -ENOMEM; | ||
| 748 | t->htable_bits = htable_bits; | ||
| 749 | |||
| 750 | read_lock_bh(&set->lock); | ||
| 751 | for (i = 0; i < jhash_size(orig->htable_bits); i++) { | ||
| 752 | n = hbucket(orig, i); | ||
| 753 | for (j = 0; j < n->pos; j++) { | ||
| 754 | data = ahash_tdata(n, j); | ||
| 755 | m = hbucket(t, HKEY(data, h->initval, htable_bits)); | ||
| 756 | ret = type_pf_elem_tadd(m, data, | ||
| 757 | type_pf_data_timeout(data)); | ||
| 758 | if (ret < 0) { | ||
| 759 | read_unlock_bh(&set->lock); | ||
| 760 | ahash_destroy(t); | ||
| 761 | if (ret == -EAGAIN) | ||
| 762 | goto retry; | ||
| 763 | return ret; | ||
| 764 | } | ||
| 765 | } | ||
| 766 | } | ||
| 767 | |||
| 768 | rcu_assign_pointer(h->table, t); | ||
| 769 | read_unlock_bh(&set->lock); | ||
| 770 | |||
| 771 | /* Give time to other readers of the set */ | ||
| 772 | synchronize_rcu_bh(); | ||
| 773 | |||
| 774 | ahash_destroy(orig); | ||
| 775 | |||
| 776 | return 0; | ||
| 777 | } | ||
| 778 | |||
| 779 | static int | ||
| 780 | type_pf_tadd(struct ip_set *set, void *value, u32 timeout) | ||
| 781 | { | ||
| 782 | struct ip_set_hash *h = set->data; | ||
| 783 | struct htable *t = h->table; | ||
| 784 | const struct type_pf_elem *d = value; | ||
| 785 | struct hbucket *n; | ||
| 786 | struct type_pf_elem *data; | ||
| 787 | int ret = 0, i, j = AHASH_MAX_SIZE + 1; | ||
| 788 | u32 key; | ||
| 789 | |||
| 790 | if (h->elements >= h->maxelem) | ||
| 791 | /* FIXME: when set is full, we slow down here */ | ||
| 792 | type_pf_expire(h); | ||
| 793 | if (h->elements >= h->maxelem) | ||
| 794 | return -IPSET_ERR_HASH_FULL; | ||
| 795 | |||
| 796 | rcu_read_lock_bh(); | ||
| 797 | t = rcu_dereference_bh(h->table); | ||
| 798 | key = HKEY(d, h->initval, t->htable_bits); | ||
| 799 | n = hbucket(t, key); | ||
| 800 | for (i = 0; i < n->pos; i++) { | ||
| 801 | data = ahash_tdata(n, i); | ||
| 802 | if (type_pf_data_equal(data, d)) { | ||
| 803 | if (type_pf_data_expired(data)) | ||
| 804 | j = i; | ||
| 805 | else { | ||
| 806 | ret = -IPSET_ERR_EXIST; | ||
| 807 | goto out; | ||
| 808 | } | ||
| 809 | } else if (j == AHASH_MAX_SIZE + 1 && | ||
| 810 | type_pf_data_expired(data)) | ||
| 811 | j = i; | ||
| 812 | } | ||
| 813 | if (j != AHASH_MAX_SIZE + 1) { | ||
| 814 | data = ahash_tdata(n, j); | ||
| 815 | #ifdef IP_SET_HASH_WITH_NETS | ||
| 816 | del_cidr(h, data->cidr, HOST_MASK); | ||
| 817 | add_cidr(h, d->cidr, HOST_MASK); | ||
| 818 | #endif | ||
| 819 | type_pf_data_copy(data, d); | ||
| 820 | type_pf_data_timeout_set(data, timeout); | ||
| 821 | goto out; | ||
| 822 | } | ||
| 823 | ret = type_pf_elem_tadd(n, d, timeout); | ||
| 824 | if (ret != 0) | ||
| 825 | goto out; | ||
| 826 | |||
| 827 | #ifdef IP_SET_HASH_WITH_NETS | ||
| 828 | add_cidr(h, d->cidr, HOST_MASK); | ||
| 829 | #endif | ||
| 830 | h->elements++; | ||
| 831 | out: | ||
| 832 | rcu_read_unlock_bh(); | ||
| 833 | return ret; | ||
| 834 | } | ||
| 835 | |||
| 836 | static int | ||
| 837 | type_pf_tdel(struct ip_set *set, void *value, u32 timeout) | ||
| 838 | { | ||
| 839 | struct ip_set_hash *h = set->data; | ||
| 840 | struct htable *t = h->table; | ||
| 841 | const struct type_pf_elem *d = value; | ||
| 842 | struct hbucket *n; | ||
| 843 | int i, ret = 0; | ||
| 844 | struct type_pf_elem *data; | ||
| 845 | u32 key; | ||
| 846 | |||
| 847 | key = HKEY(value, h->initval, t->htable_bits); | ||
| 848 | n = hbucket(t, key); | ||
| 849 | for (i = 0; i < n->pos; i++) { | ||
| 850 | data = ahash_tdata(n, i); | ||
| 851 | if (!type_pf_data_equal(data, d)) | ||
| 852 | continue; | ||
| 853 | if (type_pf_data_expired(data)) | ||
| 854 | ret = -IPSET_ERR_EXIST; | ||
| 855 | if (i != n->pos - 1) | ||
| 856 | /* Not last one */ | ||
| 857 | type_pf_data_copy(data, ahash_tdata(n, n->pos - 1)); | ||
| 858 | |||
| 859 | n->pos--; | ||
| 860 | h->elements--; | ||
| 861 | #ifdef IP_SET_HASH_WITH_NETS | ||
| 862 | del_cidr(h, d->cidr, HOST_MASK); | ||
| 863 | #endif | ||
| 864 | if (n->pos + AHASH_INIT_SIZE < n->size) { | ||
| 865 | void *tmp = kzalloc((n->size - AHASH_INIT_SIZE) | ||
| 866 | * sizeof(struct type_pf_telem), | ||
| 867 | GFP_ATOMIC); | ||
| 868 | if (!tmp) | ||
| 869 | return 0; | ||
| 870 | n->size -= AHASH_INIT_SIZE; | ||
| 871 | memcpy(tmp, n->value, | ||
| 872 | n->size * sizeof(struct type_pf_telem)); | ||
| 873 | kfree(n->value); | ||
| 874 | n->value = tmp; | ||
| 875 | } | ||
| 876 | return 0; | ||
| 877 | } | ||
| 878 | |||
| 879 | return -IPSET_ERR_EXIST; | ||
| 880 | } | ||
| 881 | |||
| 882 | #ifdef IP_SET_HASH_WITH_NETS | ||
| 883 | static int | ||
| 884 | type_pf_ttest_cidrs(struct ip_set *set, struct type_pf_elem *d, u32 timeout) | ||
| 885 | { | ||
| 886 | struct ip_set_hash *h = set->data; | ||
| 887 | struct htable *t = h->table; | ||
| 888 | struct type_pf_elem *data; | ||
| 889 | struct hbucket *n; | ||
| 890 | int i, j = 0; | ||
| 891 | u32 key; | ||
| 892 | u8 host_mask = SET_HOST_MASK(set->family); | ||
| 893 | |||
| 894 | for (; j < host_mask && h->nets[j].cidr; j++) { | ||
| 895 | type_pf_data_netmask(d, h->nets[j].cidr); | ||
| 896 | key = HKEY(d, h->initval, t->htable_bits); | ||
| 897 | n = hbucket(t, key); | ||
| 898 | for (i = 0; i < n->pos; i++) { | ||
| 899 | data = ahash_tdata(n, i); | ||
| 900 | if (type_pf_data_equal(data, d)) | ||
| 901 | return !type_pf_data_expired(data); | ||
| 902 | } | ||
| 903 | } | ||
| 904 | return 0; | ||
| 905 | } | ||
| 906 | #endif | ||
| 907 | |||
| 908 | static int | ||
| 909 | type_pf_ttest(struct ip_set *set, void *value, u32 timeout) | ||
| 910 | { | ||
| 911 | struct ip_set_hash *h = set->data; | ||
| 912 | struct htable *t = h->table; | ||
| 913 | struct type_pf_elem *data, *d = value; | ||
| 914 | struct hbucket *n; | ||
| 915 | int i; | ||
| 916 | u32 key; | ||
| 917 | |||
| 918 | #ifdef IP_SET_HASH_WITH_NETS | ||
| 919 | if (d->cidr == SET_HOST_MASK(set->family)) | ||
| 920 | return type_pf_ttest_cidrs(set, d, timeout); | ||
| 921 | #endif | ||
| 922 | key = HKEY(d, h->initval, t->htable_bits); | ||
| 923 | n = hbucket(t, key); | ||
| 924 | for (i = 0; i < n->pos; i++) { | ||
| 925 | data = ahash_tdata(n, i); | ||
| 926 | if (type_pf_data_equal(data, d)) | ||
| 927 | return !type_pf_data_expired(data); | ||
| 928 | } | ||
| 929 | return 0; | ||
| 930 | } | ||
| 931 | |||
| 932 | static int | ||
| 933 | type_pf_tlist(const struct ip_set *set, | ||
| 934 | struct sk_buff *skb, struct netlink_callback *cb) | ||
| 935 | { | ||
| 936 | const struct ip_set_hash *h = set->data; | ||
| 937 | const struct htable *t = h->table; | ||
| 938 | struct nlattr *atd, *nested; | ||
| 939 | const struct hbucket *n; | ||
| 940 | const struct type_pf_elem *data; | ||
| 941 | u32 first = cb->args[2]; | ||
| 942 | /* We assume that one hash bucket fills into one page */ | ||
| 943 | void *incomplete; | ||
| 944 | int i; | ||
| 945 | |||
| 946 | atd = ipset_nest_start(skb, IPSET_ATTR_ADT); | ||
| 947 | if (!atd) | ||
| 948 | return -EMSGSIZE; | ||
| 949 | for (; cb->args[2] < jhash_size(t->htable_bits); cb->args[2]++) { | ||
| 950 | incomplete = skb_tail_pointer(skb); | ||
| 951 | n = hbucket(t, cb->args[2]); | ||
| 952 | for (i = 0; i < n->pos; i++) { | ||
| 953 | data = ahash_tdata(n, i); | ||
| 954 | pr_debug("list %p %u\n", n, i); | ||
| 955 | if (type_pf_data_expired(data)) | ||
| 956 | continue; | ||
| 957 | pr_debug("do list %p %u\n", n, i); | ||
| 958 | nested = ipset_nest_start(skb, IPSET_ATTR_DATA); | ||
| 959 | if (!nested) { | ||
| 960 | if (cb->args[2] == first) { | ||
| 961 | nla_nest_cancel(skb, atd); | ||
| 962 | return -EMSGSIZE; | ||
| 963 | } else | ||
| 964 | goto nla_put_failure; | ||
| 965 | } | ||
| 966 | if (type_pf_data_tlist(skb, data)) | ||
| 967 | goto nla_put_failure; | ||
| 968 | ipset_nest_end(skb, nested); | ||
| 969 | } | ||
| 970 | } | ||
| 971 | ipset_nest_end(skb, atd); | ||
| 972 | /* Set listing finished */ | ||
| 973 | cb->args[2] = 0; | ||
| 974 | |||
| 975 | return 0; | ||
| 976 | |||
| 977 | nla_put_failure: | ||
| 978 | nlmsg_trim(skb, incomplete); | ||
| 979 | ipset_nest_end(skb, atd); | ||
| 980 | if (unlikely(first == cb->args[2])) { | ||
| 981 | pr_warning("Can't list set %s: one bucket does not fit into " | ||
| 982 | "a message. Please report it!\n", set->name); | ||
| 983 | cb->args[2] = 0; | ||
| 984 | return -EMSGSIZE; | ||
| 985 | } | ||
| 986 | return 0; | ||
| 987 | } | ||
| 988 | |||
| 989 | static const struct ip_set_type_variant type_pf_tvariant = { | ||
| 990 | .kadt = type_pf_kadt, | ||
| 991 | .uadt = type_pf_uadt, | ||
| 992 | .adt = { | ||
| 993 | [IPSET_ADD] = type_pf_tadd, | ||
| 994 | [IPSET_DEL] = type_pf_tdel, | ||
| 995 | [IPSET_TEST] = type_pf_ttest, | ||
| 996 | }, | ||
| 997 | .destroy = type_pf_destroy, | ||
| 998 | .flush = type_pf_flush, | ||
| 999 | .head = type_pf_head, | ||
| 1000 | .list = type_pf_tlist, | ||
| 1001 | .resize = type_pf_tresize, | ||
| 1002 | .same_set = type_pf_same_set, | ||
| 1003 | }; | ||
| 1004 | |||
| 1005 | static void | ||
| 1006 | type_pf_gc(unsigned long ul_set) | ||
| 1007 | { | ||
| 1008 | struct ip_set *set = (struct ip_set *) ul_set; | ||
| 1009 | struct ip_set_hash *h = set->data; | ||
| 1010 | |||
| 1011 | pr_debug("called\n"); | ||
| 1012 | write_lock_bh(&set->lock); | ||
| 1013 | type_pf_expire(h); | ||
| 1014 | write_unlock_bh(&set->lock); | ||
| 1015 | |||
| 1016 | h->gc.expires = jiffies + IPSET_GC_PERIOD(h->timeout) * HZ; | ||
| 1017 | add_timer(&h->gc); | ||
| 1018 | } | ||
| 1019 | |||
| 1020 | static void | ||
| 1021 | type_pf_gc_init(struct ip_set *set) | ||
| 1022 | { | ||
| 1023 | struct ip_set_hash *h = set->data; | ||
| 1024 | |||
| 1025 | init_timer(&h->gc); | ||
| 1026 | h->gc.data = (unsigned long) set; | ||
| 1027 | h->gc.function = type_pf_gc; | ||
| 1028 | h->gc.expires = jiffies + IPSET_GC_PERIOD(h->timeout) * HZ; | ||
| 1029 | add_timer(&h->gc); | ||
| 1030 | pr_debug("gc initialized, run in every %u\n", | ||
| 1031 | IPSET_GC_PERIOD(h->timeout)); | ||
| 1032 | } | ||
| 1033 | |||
| 1034 | #undef type_pf_data_equal | ||
| 1035 | #undef type_pf_data_isnull | ||
| 1036 | #undef type_pf_data_copy | ||
| 1037 | #undef type_pf_data_zero_out | ||
| 1038 | #undef type_pf_data_list | ||
| 1039 | #undef type_pf_data_tlist | ||
| 1040 | |||
| 1041 | #undef type_pf_elem | ||
| 1042 | #undef type_pf_telem | ||
| 1043 | #undef type_pf_data_timeout | ||
| 1044 | #undef type_pf_data_expired | ||
| 1045 | #undef type_pf_data_netmask | ||
| 1046 | #undef type_pf_data_timeout_set | ||
| 1047 | |||
| 1048 | #undef type_pf_elem_add | ||
| 1049 | #undef type_pf_add | ||
| 1050 | #undef type_pf_del | ||
| 1051 | #undef type_pf_test_cidrs | ||
| 1052 | #undef type_pf_test | ||
| 1053 | |||
| 1054 | #undef type_pf_elem_tadd | ||
| 1055 | #undef type_pf_expire | ||
| 1056 | #undef type_pf_tadd | ||
| 1057 | #undef type_pf_tdel | ||
| 1058 | #undef type_pf_ttest_cidrs | ||
| 1059 | #undef type_pf_ttest | ||
| 1060 | |||
| 1061 | #undef type_pf_resize | ||
| 1062 | #undef type_pf_tresize | ||
| 1063 | #undef type_pf_flush | ||
| 1064 | #undef type_pf_destroy | ||
| 1065 | #undef type_pf_head | ||
| 1066 | #undef type_pf_list | ||
| 1067 | #undef type_pf_tlist | ||
| 1068 | #undef type_pf_same_set | ||
| 1069 | #undef type_pf_kadt | ||
| 1070 | #undef type_pf_uadt | ||
| 1071 | #undef type_pf_gc | ||
| 1072 | #undef type_pf_gc_init | ||
| 1073 | #undef type_pf_variant | ||
| 1074 | #undef type_pf_tvariant | ||
diff --git a/include/linux/netfilter/ipset/ip_set_bitmap.h b/include/linux/netfilter/ipset/ip_set_bitmap.h new file mode 100644 index 000000000000..61a9e8746c83 --- /dev/null +++ b/include/linux/netfilter/ipset/ip_set_bitmap.h | |||
| @@ -0,0 +1,31 @@ | |||
| 1 | #ifndef __IP_SET_BITMAP_H | ||
| 2 | #define __IP_SET_BITMAP_H | ||
| 3 | |||
| 4 | /* Bitmap type specific error codes */ | ||
| 5 | enum { | ||
| 6 | /* The element is out of the range of the set */ | ||
| 7 | IPSET_ERR_BITMAP_RANGE = IPSET_ERR_TYPE_SPECIFIC, | ||
| 8 | /* The range exceeds the size limit of the set type */ | ||
| 9 | IPSET_ERR_BITMAP_RANGE_SIZE, | ||
| 10 | }; | ||
| 11 | |||
| 12 | #ifdef __KERNEL__ | ||
| 13 | #define IPSET_BITMAP_MAX_RANGE 0x0000FFFF | ||
| 14 | |||
| 15 | /* Common functions */ | ||
| 16 | |||
| 17 | static inline u32 | ||
| 18 | range_to_mask(u32 from, u32 to, u8 *bits) | ||
| 19 | { | ||
| 20 | u32 mask = 0xFFFFFFFE; | ||
| 21 | |||
| 22 | *bits = 32; | ||
| 23 | while (--(*bits) > 0 && mask && (to & mask) != from) | ||
| 24 | mask <<= 1; | ||
| 25 | |||
| 26 | return mask; | ||
| 27 | } | ||
| 28 | |||
| 29 | #endif /* __KERNEL__ */ | ||
| 30 | |||
| 31 | #endif /* __IP_SET_BITMAP_H */ | ||
diff --git a/include/linux/netfilter/ipset/ip_set_getport.h b/include/linux/netfilter/ipset/ip_set_getport.h new file mode 100644 index 000000000000..3882a81a3b3c --- /dev/null +++ b/include/linux/netfilter/ipset/ip_set_getport.h | |||
| @@ -0,0 +1,21 @@ | |||
| 1 | #ifndef _IP_SET_GETPORT_H | ||
| 2 | #define _IP_SET_GETPORT_H | ||
| 3 | |||
| 4 | extern bool ip_set_get_ip4_port(const struct sk_buff *skb, bool src, | ||
| 5 | __be16 *port, u8 *proto); | ||
| 6 | |||
| 7 | #if defined(CONFIG_IP6_NF_IPTABLES) || defined(CONFIG_IP6_NF_IPTABLES_MODULE) | ||
| 8 | extern bool ip_set_get_ip6_port(const struct sk_buff *skb, bool src, | ||
| 9 | __be16 *port, u8 *proto); | ||
| 10 | #else | ||
| 11 | static inline bool ip_set_get_ip6_port(const struct sk_buff *skb, bool src, | ||
| 12 | __be16 *port, u8 *proto) | ||
| 13 | { | ||
| 14 | return false; | ||
| 15 | } | ||
| 16 | #endif | ||
| 17 | |||
| 18 | extern bool ip_set_get_ip_port(const struct sk_buff *skb, u8 pf, bool src, | ||
| 19 | __be16 *port); | ||
| 20 | |||
| 21 | #endif /*_IP_SET_GETPORT_H*/ | ||
diff --git a/include/linux/netfilter/ipset/ip_set_hash.h b/include/linux/netfilter/ipset/ip_set_hash.h new file mode 100644 index 000000000000..b86f15c04524 --- /dev/null +++ b/include/linux/netfilter/ipset/ip_set_hash.h | |||
| @@ -0,0 +1,26 @@ | |||
| 1 | #ifndef __IP_SET_HASH_H | ||
| 2 | #define __IP_SET_HASH_H | ||
| 3 | |||
| 4 | /* Hash type specific error codes */ | ||
| 5 | enum { | ||
| 6 | /* Hash is full */ | ||
| 7 | IPSET_ERR_HASH_FULL = IPSET_ERR_TYPE_SPECIFIC, | ||
| 8 | /* Null-valued element */ | ||
| 9 | IPSET_ERR_HASH_ELEM, | ||
| 10 | /* Invalid protocol */ | ||
| 11 | IPSET_ERR_INVALID_PROTO, | ||
| 12 | /* Protocol missing but must be specified */ | ||
| 13 | IPSET_ERR_MISSING_PROTO, | ||
| 14 | }; | ||
| 15 | |||
| 16 | #ifdef __KERNEL__ | ||
| 17 | |||
| 18 | #define IPSET_DEFAULT_HASHSIZE 1024 | ||
| 19 | #define IPSET_MIMINAL_HASHSIZE 64 | ||
| 20 | #define IPSET_DEFAULT_MAXELEM 65536 | ||
| 21 | #define IPSET_DEFAULT_PROBES 4 | ||
| 22 | #define IPSET_DEFAULT_RESIZE 100 | ||
| 23 | |||
| 24 | #endif /* __KERNEL__ */ | ||
| 25 | |||
| 26 | #endif /* __IP_SET_HASH_H */ | ||
diff --git a/include/linux/netfilter/ipset/ip_set_list.h b/include/linux/netfilter/ipset/ip_set_list.h new file mode 100644 index 000000000000..40a63f302613 --- /dev/null +++ b/include/linux/netfilter/ipset/ip_set_list.h | |||
| @@ -0,0 +1,27 @@ | |||
| 1 | #ifndef __IP_SET_LIST_H | ||
| 2 | #define __IP_SET_LIST_H | ||
| 3 | |||
| 4 | /* List type specific error codes */ | ||
| 5 | enum { | ||
| 6 | /* Set name to be added/deleted/tested does not exist. */ | ||
| 7 | IPSET_ERR_NAME = IPSET_ERR_TYPE_SPECIFIC, | ||
| 8 | /* list:set type is not permitted to add */ | ||
| 9 | IPSET_ERR_LOOP, | ||
| 10 | /* Missing reference set */ | ||
| 11 | IPSET_ERR_BEFORE, | ||
| 12 | /* Reference set does not exist */ | ||
| 13 | IPSET_ERR_NAMEREF, | ||
| 14 | /* Set is full */ | ||
| 15 | IPSET_ERR_LIST_FULL, | ||
| 16 | /* Reference set is not added to the set */ | ||
| 17 | IPSET_ERR_REF_EXIST, | ||
| 18 | }; | ||
| 19 | |||
| 20 | #ifdef __KERNEL__ | ||
| 21 | |||
| 22 | #define IP_SET_LIST_DEFAULT_SIZE 8 | ||
| 23 | #define IP_SET_LIST_MIN_SIZE 4 | ||
| 24 | |||
| 25 | #endif /* __KERNEL__ */ | ||
| 26 | |||
| 27 | #endif /* __IP_SET_LIST_H */ | ||
diff --git a/include/linux/netfilter/ipset/ip_set_timeout.h b/include/linux/netfilter/ipset/ip_set_timeout.h new file mode 100644 index 000000000000..9f30c5f2ec1c --- /dev/null +++ b/include/linux/netfilter/ipset/ip_set_timeout.h | |||
| @@ -0,0 +1,127 @@ | |||
| 1 | #ifndef _IP_SET_TIMEOUT_H | ||
| 2 | #define _IP_SET_TIMEOUT_H | ||
| 3 | |||
| 4 | /* Copyright (C) 2003-2011 Jozsef Kadlecsik <kadlec@blackhole.kfki.hu> | ||
| 5 | * | ||
| 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 | ||
| 8 | * published by the Free Software Foundation. | ||
| 9 | */ | ||
| 10 | |||
| 11 | #ifdef __KERNEL__ | ||
| 12 | |||
| 13 | /* How often should the gc be run by default */ | ||
| 14 | #define IPSET_GC_TIME (3 * 60) | ||
| 15 | |||
| 16 | /* Timeout period depending on the timeout value of the given set */ | ||
| 17 | #define IPSET_GC_PERIOD(timeout) \ | ||
| 18 | ((timeout/3) ? min_t(u32, (timeout)/3, IPSET_GC_TIME) : 1) | ||
| 19 | |||
| 20 | /* Set is defined without timeout support: timeout value may be 0 */ | ||
| 21 | #define IPSET_NO_TIMEOUT UINT_MAX | ||
| 22 | |||
| 23 | #define with_timeout(timeout) ((timeout) != IPSET_NO_TIMEOUT) | ||
| 24 | |||
| 25 | static inline unsigned int | ||
| 26 | ip_set_timeout_uget(struct nlattr *tb) | ||
| 27 | { | ||
| 28 | unsigned int timeout = ip_set_get_h32(tb); | ||
| 29 | |||
| 30 | /* Userspace supplied TIMEOUT parameter: adjust crazy size */ | ||
| 31 | return timeout == IPSET_NO_TIMEOUT ? IPSET_NO_TIMEOUT - 1 : timeout; | ||
| 32 | } | ||
| 33 | |||
| 34 | #ifdef IP_SET_BITMAP_TIMEOUT | ||
| 35 | |||
| 36 | /* Bitmap specific timeout constants and macros for the entries */ | ||
| 37 | |||
| 38 | /* Bitmap entry is unset */ | ||
| 39 | #define IPSET_ELEM_UNSET 0 | ||
| 40 | /* Bitmap entry is set with no timeout value */ | ||
| 41 | #define IPSET_ELEM_PERMANENT (UINT_MAX/2) | ||
| 42 | |||
| 43 | static inline bool | ||
| 44 | ip_set_timeout_test(unsigned long timeout) | ||
| 45 | { | ||
| 46 | return timeout != IPSET_ELEM_UNSET && | ||
| 47 | (timeout == IPSET_ELEM_PERMANENT || | ||
| 48 | time_after(timeout, jiffies)); | ||
| 49 | } | ||
| 50 | |||
| 51 | static inline bool | ||
| 52 | ip_set_timeout_expired(unsigned long timeout) | ||
| 53 | { | ||
| 54 | return timeout != IPSET_ELEM_UNSET && | ||
| 55 | timeout != IPSET_ELEM_PERMANENT && | ||
| 56 | time_before(timeout, jiffies); | ||
| 57 | } | ||
| 58 | |||
| 59 | static inline unsigned long | ||
| 60 | ip_set_timeout_set(u32 timeout) | ||
| 61 | { | ||
| 62 | unsigned long t; | ||
| 63 | |||
| 64 | if (!timeout) | ||
| 65 | return IPSET_ELEM_PERMANENT; | ||
| 66 | |||
| 67 | t = timeout * HZ + jiffies; | ||
| 68 | if (t == IPSET_ELEM_UNSET || t == IPSET_ELEM_PERMANENT) | ||
| 69 | /* Bingo! */ | ||
| 70 | t++; | ||
| 71 | |||
| 72 | return t; | ||
| 73 | } | ||
| 74 | |||
| 75 | static inline u32 | ||
| 76 | ip_set_timeout_get(unsigned long timeout) | ||
| 77 | { | ||
| 78 | return timeout == IPSET_ELEM_PERMANENT ? 0 : (timeout - jiffies)/HZ; | ||
| 79 | } | ||
| 80 | |||
| 81 | #else | ||
| 82 | |||
| 83 | /* Hash specific timeout constants and macros for the entries */ | ||
| 84 | |||
| 85 | /* Hash entry is set with no timeout value */ | ||
| 86 | #define IPSET_ELEM_PERMANENT 0 | ||
| 87 | |||
| 88 | static inline bool | ||
| 89 | ip_set_timeout_test(unsigned long timeout) | ||
| 90 | { | ||
| 91 | return timeout == IPSET_ELEM_PERMANENT || | ||
| 92 | time_after(timeout, jiffies); | ||
| 93 | } | ||
| 94 | |||
| 95 | static inline bool | ||
| 96 | ip_set_timeout_expired(unsigned long timeout) | ||
| 97 | { | ||
| 98 | return timeout != IPSET_ELEM_PERMANENT && | ||
| 99 | time_before(timeout, jiffies); | ||
| 100 | } | ||
| 101 | |||
| 102 | static inline unsigned long | ||
| 103 | ip_set_timeout_set(u32 timeout) | ||
| 104 | { | ||
| 105 | unsigned long t; | ||
| 106 | |||
| 107 | if (!timeout) | ||
| 108 | return IPSET_ELEM_PERMANENT; | ||
| 109 | |||
| 110 | t = timeout * HZ + jiffies; | ||
| 111 | if (t == IPSET_ELEM_PERMANENT) | ||
| 112 | /* Bingo! :-) */ | ||
| 113 | t++; | ||
| 114 | |||
| 115 | return t; | ||
| 116 | } | ||
| 117 | |||
| 118 | static inline u32 | ||
| 119 | ip_set_timeout_get(unsigned long timeout) | ||
| 120 | { | ||
| 121 | return timeout == IPSET_ELEM_PERMANENT ? 0 : (timeout - jiffies)/HZ; | ||
| 122 | } | ||
| 123 | #endif /* ! IP_SET_BITMAP_TIMEOUT */ | ||
| 124 | |||
| 125 | #endif /* __KERNEL__ */ | ||
| 126 | |||
| 127 | #endif /* _IP_SET_TIMEOUT_H */ | ||
diff --git a/include/linux/netfilter/ipset/pfxlen.h b/include/linux/netfilter/ipset/pfxlen.h new file mode 100644 index 000000000000..0e1fb50da562 --- /dev/null +++ b/include/linux/netfilter/ipset/pfxlen.h | |||
| @@ -0,0 +1,35 @@ | |||
| 1 | #ifndef _PFXLEN_H | ||
| 2 | #define _PFXLEN_H | ||
| 3 | |||
| 4 | #include <asm/byteorder.h> | ||
| 5 | #include <linux/netfilter.h> | ||
| 6 | |||
| 7 | /* Prefixlen maps, by Jan Engelhardt */ | ||
| 8 | extern const union nf_inet_addr ip_set_netmask_map[]; | ||
| 9 | extern const union nf_inet_addr ip_set_hostmask_map[]; | ||
| 10 | |||
| 11 | static inline __be32 | ||
| 12 | ip_set_netmask(u8 pfxlen) | ||
| 13 | { | ||
| 14 | return ip_set_netmask_map[pfxlen].ip; | ||
| 15 | } | ||
| 16 | |||
| 17 | static inline const __be32 * | ||
| 18 | ip_set_netmask6(u8 pfxlen) | ||
| 19 | { | ||
| 20 | return &ip_set_netmask_map[pfxlen].ip6[0]; | ||
| 21 | } | ||
| 22 | |||
| 23 | static inline u32 | ||
| 24 | ip_set_hostmask(u8 pfxlen) | ||
| 25 | { | ||
| 26 | return (__force u32) ip_set_hostmask_map[pfxlen].ip; | ||
| 27 | } | ||
| 28 | |||
| 29 | static inline const __be32 * | ||
| 30 | ip_set_hostmask6(u8 pfxlen) | ||
| 31 | { | ||
| 32 | return &ip_set_hostmask_map[pfxlen].ip6[0]; | ||
| 33 | } | ||
| 34 | |||
| 35 | #endif /*_PFXLEN_H */ | ||
diff --git a/include/linux/netfilter/nf_conntrack_snmp.h b/include/linux/netfilter/nf_conntrack_snmp.h new file mode 100644 index 000000000000..064bc63a5346 --- /dev/null +++ b/include/linux/netfilter/nf_conntrack_snmp.h | |||
| @@ -0,0 +1,9 @@ | |||
| 1 | #ifndef _NF_CONNTRACK_SNMP_H | ||
| 2 | #define _NF_CONNTRACK_SNMP_H | ||
| 3 | |||
| 4 | extern int (*nf_nat_snmp_hook)(struct sk_buff *skb, | ||
| 5 | unsigned int protoff, | ||
| 6 | struct nf_conn *ct, | ||
| 7 | enum ip_conntrack_info ctinfo); | ||
| 8 | |||
| 9 | #endif /* _NF_CONNTRACK_SNMP_H */ | ||
diff --git a/include/linux/netfilter/nfnetlink.h b/include/linux/netfilter/nfnetlink.h index 361d6b5630ee..2b11fc1a86be 100644 --- a/include/linux/netfilter/nfnetlink.h +++ b/include/linux/netfilter/nfnetlink.h | |||
| @@ -47,7 +47,8 @@ struct nfgenmsg { | |||
| 47 | #define NFNL_SUBSYS_QUEUE 3 | 47 | #define NFNL_SUBSYS_QUEUE 3 |
| 48 | #define NFNL_SUBSYS_ULOG 4 | 48 | #define NFNL_SUBSYS_ULOG 4 |
| 49 | #define NFNL_SUBSYS_OSF 5 | 49 | #define NFNL_SUBSYS_OSF 5 |
| 50 | #define NFNL_SUBSYS_COUNT 6 | 50 | #define NFNL_SUBSYS_IPSET 6 |
| 51 | #define NFNL_SUBSYS_COUNT 7 | ||
| 51 | 52 | ||
| 52 | #ifdef __KERNEL__ | 53 | #ifdef __KERNEL__ |
| 53 | 54 | ||
diff --git a/include/linux/netfilter/nfnetlink_conntrack.h b/include/linux/netfilter/nfnetlink_conntrack.h index 19711e3ffd42..debf1aefd753 100644 --- a/include/linux/netfilter/nfnetlink_conntrack.h +++ b/include/linux/netfilter/nfnetlink_conntrack.h | |||
| @@ -42,6 +42,7 @@ enum ctattr_type { | |||
| 42 | CTA_SECMARK, /* obsolete */ | 42 | CTA_SECMARK, /* obsolete */ |
| 43 | CTA_ZONE, | 43 | CTA_ZONE, |
| 44 | CTA_SECCTX, | 44 | CTA_SECCTX, |
| 45 | CTA_TIMESTAMP, | ||
| 45 | __CTA_MAX | 46 | __CTA_MAX |
| 46 | }; | 47 | }; |
| 47 | #define CTA_MAX (__CTA_MAX - 1) | 48 | #define CTA_MAX (__CTA_MAX - 1) |
| @@ -127,6 +128,14 @@ enum ctattr_counters { | |||
| 127 | }; | 128 | }; |
| 128 | #define CTA_COUNTERS_MAX (__CTA_COUNTERS_MAX - 1) | 129 | #define CTA_COUNTERS_MAX (__CTA_COUNTERS_MAX - 1) |
| 129 | 130 | ||
| 131 | enum ctattr_tstamp { | ||
| 132 | CTA_TIMESTAMP_UNSPEC, | ||
| 133 | CTA_TIMESTAMP_START, | ||
| 134 | CTA_TIMESTAMP_STOP, | ||
| 135 | __CTA_TIMESTAMP_MAX | ||
| 136 | }; | ||
| 137 | #define CTA_TIMESTAMP_MAX (__CTA_TIMESTAMP_MAX - 1) | ||
| 138 | |||
| 130 | enum ctattr_nat { | 139 | enum ctattr_nat { |
| 131 | CTA_NAT_UNSPEC, | 140 | CTA_NAT_UNSPEC, |
| 132 | CTA_NAT_MINIP, | 141 | CTA_NAT_MINIP, |
diff --git a/include/linux/netfilter/x_tables.h b/include/linux/netfilter/x_tables.h index 6712e713b299..37219525ff6f 100644 --- a/include/linux/netfilter/x_tables.h +++ b/include/linux/netfilter/x_tables.h | |||
| @@ -611,8 +611,9 @@ struct _compat_xt_align { | |||
| 611 | extern void xt_compat_lock(u_int8_t af); | 611 | extern void xt_compat_lock(u_int8_t af); |
| 612 | extern void xt_compat_unlock(u_int8_t af); | 612 | extern void xt_compat_unlock(u_int8_t af); |
| 613 | 613 | ||
| 614 | extern int xt_compat_add_offset(u_int8_t af, unsigned int offset, short delta); | 614 | extern int xt_compat_add_offset(u_int8_t af, unsigned int offset, int delta); |
| 615 | extern void xt_compat_flush_offsets(u_int8_t af); | 615 | extern void xt_compat_flush_offsets(u_int8_t af); |
| 616 | extern void xt_compat_init_offsets(u_int8_t af, unsigned int number); | ||
| 616 | extern int xt_compat_calc_jump(u_int8_t af, unsigned int offset); | 617 | extern int xt_compat_calc_jump(u_int8_t af, unsigned int offset); |
| 617 | 618 | ||
| 618 | extern int xt_compat_match_offset(const struct xt_match *match); | 619 | extern int xt_compat_match_offset(const struct xt_match *match); |
diff --git a/include/linux/netfilter/xt_AUDIT.h b/include/linux/netfilter/xt_AUDIT.h new file mode 100644 index 000000000000..38751d2ea52b --- /dev/null +++ b/include/linux/netfilter/xt_AUDIT.h | |||
| @@ -0,0 +1,30 @@ | |||
| 1 | /* | ||
| 2 | * Header file for iptables xt_AUDIT target | ||
| 3 | * | ||
| 4 | * (C) 2010-2011 Thomas Graf <tgraf@redhat.com> | ||
| 5 | * (C) 2010-2011 Red Hat, Inc. | ||
| 6 | * | ||
| 7 | * This program is free software; you can redistribute it and/or modify | ||
| 8 | * it under the terms of the GNU General Public License version 2 as | ||
| 9 | * published by the Free Software Foundation. | ||
| 10 | */ | ||
| 11 | |||
| 12 | #ifndef _XT_AUDIT_TARGET_H | ||
| 13 | #define _XT_AUDIT_TARGET_H | ||
| 14 | |||
| 15 | #include <linux/types.h> | ||
| 16 | |||
| 17 | enum { | ||
| 18 | XT_AUDIT_TYPE_ACCEPT = 0, | ||
| 19 | XT_AUDIT_TYPE_DROP, | ||
| 20 | XT_AUDIT_TYPE_REJECT, | ||
| 21 | __XT_AUDIT_TYPE_MAX, | ||
| 22 | }; | ||
| 23 | |||
| 24 | #define XT_AUDIT_TYPE_MAX (__XT_AUDIT_TYPE_MAX - 1) | ||
| 25 | |||
| 26 | struct xt_audit_info { | ||
| 27 | __u8 type; /* XT_AUDIT_TYPE_* */ | ||
| 28 | }; | ||
| 29 | |||
| 30 | #endif /* _XT_AUDIT_TARGET_H */ | ||
diff --git a/include/linux/netfilter/xt_CT.h b/include/linux/netfilter/xt_CT.h index 1b564106891d..b56e76811c04 100644 --- a/include/linux/netfilter/xt_CT.h +++ b/include/linux/netfilter/xt_CT.h | |||
| @@ -1,14 +1,16 @@ | |||
| 1 | #ifndef _XT_CT_H | 1 | #ifndef _XT_CT_H |
| 2 | #define _XT_CT_H | 2 | #define _XT_CT_H |
| 3 | 3 | ||
| 4 | #include <linux/types.h> | ||
| 5 | |||
| 4 | #define XT_CT_NOTRACK 0x1 | 6 | #define XT_CT_NOTRACK 0x1 |
| 5 | 7 | ||
| 6 | struct xt_ct_target_info { | 8 | struct xt_ct_target_info { |
| 7 | u_int16_t flags; | 9 | __u16 flags; |
| 8 | u_int16_t zone; | 10 | __u16 zone; |
| 9 | u_int32_t ct_events; | 11 | __u32 ct_events; |
| 10 | u_int32_t exp_events; | 12 | __u32 exp_events; |
| 11 | char helper[16]; | 13 | char helper[16]; |
| 12 | 14 | ||
| 13 | /* Used internally by the kernel */ | 15 | /* Used internally by the kernel */ |
| 14 | struct nf_conn *ct __attribute__((aligned(8))); | 16 | struct nf_conn *ct __attribute__((aligned(8))); |
diff --git a/include/linux/netfilter/xt_NFQUEUE.h b/include/linux/netfilter/xt_NFQUEUE.h index 2584f4a777de..9eafdbbb401c 100644 --- a/include/linux/netfilter/xt_NFQUEUE.h +++ b/include/linux/netfilter/xt_NFQUEUE.h | |||
| @@ -20,4 +20,10 @@ struct xt_NFQ_info_v1 { | |||
| 20 | __u16 queues_total; | 20 | __u16 queues_total; |
| 21 | }; | 21 | }; |
| 22 | 22 | ||
| 23 | struct xt_NFQ_info_v2 { | ||
| 24 | __u16 queuenum; | ||
| 25 | __u16 queues_total; | ||
| 26 | __u16 bypass; | ||
| 27 | }; | ||
| 28 | |||
| 23 | #endif /* _XT_NFQ_TARGET_H */ | 29 | #endif /* _XT_NFQ_TARGET_H */ |
diff --git a/include/linux/netfilter/xt_TCPOPTSTRIP.h b/include/linux/netfilter/xt_TCPOPTSTRIP.h index 2db543214ff5..7157318499c2 100644 --- a/include/linux/netfilter/xt_TCPOPTSTRIP.h +++ b/include/linux/netfilter/xt_TCPOPTSTRIP.h | |||
| @@ -1,13 +1,15 @@ | |||
| 1 | #ifndef _XT_TCPOPTSTRIP_H | 1 | #ifndef _XT_TCPOPTSTRIP_H |
| 2 | #define _XT_TCPOPTSTRIP_H | 2 | #define _XT_TCPOPTSTRIP_H |
| 3 | 3 | ||
| 4 | #include <linux/types.h> | ||
| 5 | |||
| 4 | #define tcpoptstrip_set_bit(bmap, idx) \ | 6 | #define tcpoptstrip_set_bit(bmap, idx) \ |
| 5 | (bmap[(idx) >> 5] |= 1U << (idx & 31)) | 7 | (bmap[(idx) >> 5] |= 1U << (idx & 31)) |
| 6 | #define tcpoptstrip_test_bit(bmap, idx) \ | 8 | #define tcpoptstrip_test_bit(bmap, idx) \ |
| 7 | (((1U << (idx & 31)) & bmap[(idx) >> 5]) != 0) | 9 | (((1U << (idx & 31)) & bmap[(idx) >> 5]) != 0) |
| 8 | 10 | ||
| 9 | struct xt_tcpoptstrip_target_info { | 11 | struct xt_tcpoptstrip_target_info { |
| 10 | u_int32_t strip_bmap[8]; | 12 | __u32 strip_bmap[8]; |
| 11 | }; | 13 | }; |
| 12 | 14 | ||
| 13 | #endif /* _XT_TCPOPTSTRIP_H */ | 15 | #endif /* _XT_TCPOPTSTRIP_H */ |
diff --git a/include/linux/netfilter/xt_TPROXY.h b/include/linux/netfilter/xt_TPROXY.h index 3f3d69361289..902043c2073f 100644 --- a/include/linux/netfilter/xt_TPROXY.h +++ b/include/linux/netfilter/xt_TPROXY.h | |||
| @@ -1,19 +1,21 @@ | |||
| 1 | #ifndef _XT_TPROXY_H | 1 | #ifndef _XT_TPROXY_H |
| 2 | #define _XT_TPROXY_H | 2 | #define _XT_TPROXY_H |
| 3 | 3 | ||
| 4 | #include <linux/types.h> | ||
| 5 | |||
| 4 | /* TPROXY target is capable of marking the packet to perform | 6 | /* TPROXY target is capable of marking the packet to perform |
| 5 | * redirection. We can get rid of that whenever we get support for | 7 | * redirection. We can get rid of that whenever we get support for |
| 6 | * mutliple targets in the same rule. */ | 8 | * mutliple targets in the same rule. */ |
| 7 | struct xt_tproxy_target_info { | 9 | struct xt_tproxy_target_info { |
| 8 | u_int32_t mark_mask; | 10 | __u32 mark_mask; |
| 9 | u_int32_t mark_value; | 11 | __u32 mark_value; |
| 10 | __be32 laddr; | 12 | __be32 laddr; |
| 11 | __be16 lport; | 13 | __be16 lport; |
| 12 | }; | 14 | }; |
| 13 | 15 | ||
| 14 | struct xt_tproxy_target_info_v1 { | 16 | struct xt_tproxy_target_info_v1 { |
| 15 | u_int32_t mark_mask; | 17 | __u32 mark_mask; |
| 16 | u_int32_t mark_value; | 18 | __u32 mark_value; |
| 17 | union nf_inet_addr laddr; | 19 | union nf_inet_addr laddr; |
| 18 | __be16 lport; | 20 | __be16 lport; |
| 19 | }; | 21 | }; |
diff --git a/include/linux/netfilter/xt_addrtype.h b/include/linux/netfilter/xt_addrtype.h new file mode 100644 index 000000000000..b156baa9d55e --- /dev/null +++ b/include/linux/netfilter/xt_addrtype.h | |||
| @@ -0,0 +1,44 @@ | |||
| 1 | #ifndef _XT_ADDRTYPE_H | ||
| 2 | #define _XT_ADDRTYPE_H | ||
| 3 | |||
| 4 | #include <linux/types.h> | ||
| 5 | |||
| 6 | enum { | ||
| 7 | XT_ADDRTYPE_INVERT_SOURCE = 0x0001, | ||
| 8 | XT_ADDRTYPE_INVERT_DEST = 0x0002, | ||
| 9 | XT_ADDRTYPE_LIMIT_IFACE_IN = 0x0004, | ||
| 10 | XT_ADDRTYPE_LIMIT_IFACE_OUT = 0x0008, | ||
| 11 | }; | ||
| 12 | |||
| 13 | |||
| 14 | /* rtn_type enum values from rtnetlink.h, but shifted */ | ||
| 15 | enum { | ||
| 16 | XT_ADDRTYPE_UNSPEC = 1 << 0, | ||
| 17 | XT_ADDRTYPE_UNICAST = 1 << 1, /* 1 << RTN_UNICAST */ | ||
| 18 | XT_ADDRTYPE_LOCAL = 1 << 2, /* 1 << RTN_LOCAL, etc */ | ||
| 19 | XT_ADDRTYPE_BROADCAST = 1 << 3, | ||
| 20 | XT_ADDRTYPE_ANYCAST = 1 << 4, | ||
| 21 | XT_ADDRTYPE_MULTICAST = 1 << 5, | ||
| 22 | XT_ADDRTYPE_BLACKHOLE = 1 << 6, | ||
| 23 | XT_ADDRTYPE_UNREACHABLE = 1 << 7, | ||
| 24 | XT_ADDRTYPE_PROHIBIT = 1 << 8, | ||
| 25 | XT_ADDRTYPE_THROW = 1 << 9, | ||
| 26 | XT_ADDRTYPE_NAT = 1 << 10, | ||
| 27 | XT_ADDRTYPE_XRESOLVE = 1 << 11, | ||
| 28 | }; | ||
| 29 | |||
| 30 | struct xt_addrtype_info_v1 { | ||
| 31 | __u16 source; /* source-type mask */ | ||
| 32 | __u16 dest; /* dest-type mask */ | ||
| 33 | __u32 flags; | ||
| 34 | }; | ||
| 35 | |||
| 36 | /* revision 0 */ | ||
| 37 | struct xt_addrtype_info { | ||
| 38 | __u16 source; /* source-type mask */ | ||
| 39 | __u16 dest; /* dest-type mask */ | ||
| 40 | __u32 invert_source; | ||
| 41 | __u32 invert_dest; | ||
| 42 | }; | ||
| 43 | |||
| 44 | #endif | ||
diff --git a/include/linux/netfilter/xt_cluster.h b/include/linux/netfilter/xt_cluster.h index 886682656f09..9b883c8fbf54 100644 --- a/include/linux/netfilter/xt_cluster.h +++ b/include/linux/netfilter/xt_cluster.h | |||
| @@ -1,15 +1,17 @@ | |||
| 1 | #ifndef _XT_CLUSTER_MATCH_H | 1 | #ifndef _XT_CLUSTER_MATCH_H |
| 2 | #define _XT_CLUSTER_MATCH_H | 2 | #define _XT_CLUSTER_MATCH_H |
| 3 | 3 | ||
| 4 | #include <linux/types.h> | ||
| 5 | |||
| 4 | enum xt_cluster_flags { | 6 | enum xt_cluster_flags { |
| 5 | XT_CLUSTER_F_INV = (1 << 0) | 7 | XT_CLUSTER_F_INV = (1 << 0) |
| 6 | }; | 8 | }; |
| 7 | 9 | ||
| 8 | struct xt_cluster_match_info { | 10 | struct xt_cluster_match_info { |
| 9 | u_int32_t total_nodes; | 11 | __u32 total_nodes; |
| 10 | u_int32_t node_mask; | 12 | __u32 node_mask; |
| 11 | u_int32_t hash_seed; | 13 | __u32 hash_seed; |
| 12 | u_int32_t flags; | 14 | __u32 flags; |
| 13 | }; | 15 | }; |
| 14 | 16 | ||
| 15 | #define XT_CLUSTER_NODES_MAX 32 | 17 | #define XT_CLUSTER_NODES_MAX 32 |
diff --git a/include/linux/netfilter/xt_comment.h b/include/linux/netfilter/xt_comment.h index eacfedc6b5d0..0ea5e79f5bd7 100644 --- a/include/linux/netfilter/xt_comment.h +++ b/include/linux/netfilter/xt_comment.h | |||
| @@ -4,7 +4,7 @@ | |||
| 4 | #define XT_MAX_COMMENT_LEN 256 | 4 | #define XT_MAX_COMMENT_LEN 256 |
| 5 | 5 | ||
| 6 | struct xt_comment_info { | 6 | struct xt_comment_info { |
| 7 | unsigned char comment[XT_MAX_COMMENT_LEN]; | 7 | char comment[XT_MAX_COMMENT_LEN]; |
| 8 | }; | 8 | }; |
| 9 | 9 | ||
| 10 | #endif /* XT_COMMENT_H */ | 10 | #endif /* XT_COMMENT_H */ |
diff --git a/include/linux/netfilter/xt_connlimit.h b/include/linux/netfilter/xt_connlimit.h index 7e3284bcbd2b..0ca66e97acbc 100644 --- a/include/linux/netfilter/xt_connlimit.h +++ b/include/linux/netfilter/xt_connlimit.h | |||
| @@ -1,8 +1,15 @@ | |||
| 1 | #ifndef _XT_CONNLIMIT_H | 1 | #ifndef _XT_CONNLIMIT_H |
| 2 | #define _XT_CONNLIMIT_H | 2 | #define _XT_CONNLIMIT_H |
| 3 | 3 | ||
| 4 | #include <linux/types.h> | ||
| 5 | |||
| 4 | struct xt_connlimit_data; | 6 | struct xt_connlimit_data; |
| 5 | 7 | ||
| 8 | enum { | ||
| 9 | XT_CONNLIMIT_INVERT = 1 << 0, | ||
| 10 | XT_CONNLIMIT_DADDR = 1 << 1, | ||
| 11 | }; | ||
| 12 | |||
| 6 | struct xt_connlimit_info { | 13 | struct xt_connlimit_info { |
| 7 | union { | 14 | union { |
| 8 | union nf_inet_addr mask; | 15 | union nf_inet_addr mask; |
| @@ -13,7 +20,14 @@ struct xt_connlimit_info { | |||
| 13 | }; | 20 | }; |
| 14 | #endif | 21 | #endif |
| 15 | }; | 22 | }; |
| 16 | unsigned int limit, inverse; | 23 | unsigned int limit; |
| 24 | union { | ||
| 25 | /* revision 0 */ | ||
| 26 | unsigned int inverse; | ||
| 27 | |||
| 28 | /* revision 1 */ | ||
| 29 | __u32 flags; | ||
| 30 | }; | ||
| 17 | 31 | ||
| 18 | /* Used internally by the kernel */ | 32 | /* Used internally by the kernel */ |
| 19 | struct xt_connlimit_data *data __attribute__((aligned(8))); | 33 | struct xt_connlimit_data *data __attribute__((aligned(8))); |
diff --git a/include/linux/netfilter/xt_conntrack.h b/include/linux/netfilter/xt_conntrack.h index 54f47a2f6152..74b904d8f99c 100644 --- a/include/linux/netfilter/xt_conntrack.h +++ b/include/linux/netfilter/xt_conntrack.h | |||
| @@ -58,4 +58,19 @@ struct xt_conntrack_mtinfo2 { | |||
| 58 | __u16 state_mask, status_mask; | 58 | __u16 state_mask, status_mask; |
| 59 | }; | 59 | }; |
| 60 | 60 | ||
| 61 | struct xt_conntrack_mtinfo3 { | ||
| 62 | union nf_inet_addr origsrc_addr, origsrc_mask; | ||
| 63 | union nf_inet_addr origdst_addr, origdst_mask; | ||
| 64 | union nf_inet_addr replsrc_addr, replsrc_mask; | ||
| 65 | union nf_inet_addr repldst_addr, repldst_mask; | ||
| 66 | __u32 expires_min, expires_max; | ||
| 67 | __u16 l4proto; | ||
| 68 | __u16 origsrc_port, origdst_port; | ||
| 69 | __u16 replsrc_port, repldst_port; | ||
| 70 | __u16 match_flags, invert_flags; | ||
| 71 | __u16 state_mask, status_mask; | ||
| 72 | __u16 origsrc_port_high, origdst_port_high; | ||
| 73 | __u16 replsrc_port_high, repldst_port_high; | ||
| 74 | }; | ||
| 75 | |||
| 61 | #endif /*_XT_CONNTRACK_H*/ | 76 | #endif /*_XT_CONNTRACK_H*/ |
diff --git a/include/linux/netfilter/xt_devgroup.h b/include/linux/netfilter/xt_devgroup.h new file mode 100644 index 000000000000..1babde0ec900 --- /dev/null +++ b/include/linux/netfilter/xt_devgroup.h | |||
| @@ -0,0 +1,21 @@ | |||
| 1 | #ifndef _XT_DEVGROUP_H | ||
| 2 | #define _XT_DEVGROUP_H | ||
| 3 | |||
| 4 | #include <linux/types.h> | ||
| 5 | |||
| 6 | enum xt_devgroup_flags { | ||
| 7 | XT_DEVGROUP_MATCH_SRC = 0x1, | ||
| 8 | XT_DEVGROUP_INVERT_SRC = 0x2, | ||
| 9 | XT_DEVGROUP_MATCH_DST = 0x4, | ||
| 10 | XT_DEVGROUP_INVERT_DST = 0x8, | ||
| 11 | }; | ||
| 12 | |||
| 13 | struct xt_devgroup_info { | ||
| 14 | __u32 flags; | ||
| 15 | __u32 src_group; | ||
| 16 | __u32 src_mask; | ||
| 17 | __u32 dst_group; | ||
| 18 | __u32 dst_mask; | ||
| 19 | }; | ||
| 20 | |||
| 21 | #endif /* _XT_DEVGROUP_H */ | ||
diff --git a/include/linux/netfilter/xt_quota.h b/include/linux/netfilter/xt_quota.h index b0d28c659ab7..ca6e03e47a17 100644 --- a/include/linux/netfilter/xt_quota.h +++ b/include/linux/netfilter/xt_quota.h | |||
| @@ -1,6 +1,8 @@ | |||
| 1 | #ifndef _XT_QUOTA_H | 1 | #ifndef _XT_QUOTA_H |
| 2 | #define _XT_QUOTA_H | 2 | #define _XT_QUOTA_H |
| 3 | 3 | ||
| 4 | #include <linux/types.h> | ||
| 5 | |||
| 4 | enum xt_quota_flags { | 6 | enum xt_quota_flags { |
| 5 | XT_QUOTA_INVERT = 0x1, | 7 | XT_QUOTA_INVERT = 0x1, |
| 6 | }; | 8 | }; |
| @@ -9,9 +11,9 @@ enum xt_quota_flags { | |||
| 9 | struct xt_quota_priv; | 11 | struct xt_quota_priv; |
| 10 | 12 | ||
| 11 | struct xt_quota_info { | 13 | struct xt_quota_info { |
| 12 | u_int32_t flags; | 14 | __u32 flags; |
| 13 | u_int32_t pad; | 15 | __u32 pad; |
| 14 | aligned_u64 quota; | 16 | aligned_u64 quota; |
| 15 | 17 | ||
| 16 | /* Used internally by the kernel */ | 18 | /* Used internally by the kernel */ |
| 17 | struct xt_quota_priv *master; | 19 | struct xt_quota_priv *master; |
diff --git a/include/linux/netfilter/xt_set.h b/include/linux/netfilter/xt_set.h new file mode 100644 index 000000000000..081f1ded2842 --- /dev/null +++ b/include/linux/netfilter/xt_set.h | |||
| @@ -0,0 +1,56 @@ | |||
| 1 | #ifndef _XT_SET_H | ||
| 2 | #define _XT_SET_H | ||
| 3 | |||
| 4 | #include <linux/types.h> | ||
| 5 | #include <linux/netfilter/ipset/ip_set.h> | ||
| 6 | |||
| 7 | /* Revision 0 interface: backward compatible with netfilter/iptables */ | ||
| 8 | |||
| 9 | /* | ||
| 10 | * Option flags for kernel operations (xt_set_info_v0) | ||
| 11 | */ | ||
| 12 | #define IPSET_SRC 0x01 /* Source match/add */ | ||
| 13 | #define IPSET_DST 0x02 /* Destination match/add */ | ||
| 14 | #define IPSET_MATCH_INV 0x04 /* Inverse matching */ | ||
| 15 | |||
| 16 | struct xt_set_info_v0 { | ||
| 17 | ip_set_id_t index; | ||
| 18 | union { | ||
| 19 | __u32 flags[IPSET_DIM_MAX + 1]; | ||
| 20 | struct { | ||
| 21 | __u32 __flags[IPSET_DIM_MAX]; | ||
| 22 | __u8 dim; | ||
| 23 | __u8 flags; | ||
| 24 | } compat; | ||
| 25 | } u; | ||
| 26 | }; | ||
| 27 | |||
| 28 | /* match and target infos */ | ||
| 29 | struct xt_set_info_match_v0 { | ||
| 30 | struct xt_set_info_v0 match_set; | ||
| 31 | }; | ||
| 32 | |||
| 33 | struct xt_set_info_target_v0 { | ||
| 34 | struct xt_set_info_v0 add_set; | ||
| 35 | struct xt_set_info_v0 del_set; | ||
| 36 | }; | ||
| 37 | |||
| 38 | /* Revision 1: current interface to netfilter/iptables */ | ||
| 39 | |||
| 40 | struct xt_set_info { | ||
| 41 | ip_set_id_t index; | ||
| 42 | __u8 dim; | ||
| 43 | __u8 flags; | ||
| 44 | }; | ||
| 45 | |||
| 46 | /* match and target infos */ | ||
| 47 | struct xt_set_info_match { | ||
| 48 | struct xt_set_info match_set; | ||
| 49 | }; | ||
| 50 | |||
| 51 | struct xt_set_info_target { | ||
| 52 | struct xt_set_info add_set; | ||
| 53 | struct xt_set_info del_set; | ||
| 54 | }; | ||
| 55 | |||
| 56 | #endif /*_XT_SET_H*/ | ||
diff --git a/include/linux/netfilter/xt_socket.h b/include/linux/netfilter/xt_socket.h index 6f475b8ff34b..26d7217bd4f1 100644 --- a/include/linux/netfilter/xt_socket.h +++ b/include/linux/netfilter/xt_socket.h | |||
| @@ -1,6 +1,8 @@ | |||
| 1 | #ifndef _XT_SOCKET_H | 1 | #ifndef _XT_SOCKET_H |
| 2 | #define _XT_SOCKET_H | 2 | #define _XT_SOCKET_H |
| 3 | 3 | ||
| 4 | #include <linux/types.h> | ||
| 5 | |||
| 4 | enum { | 6 | enum { |
| 5 | XT_SOCKET_TRANSPARENT = 1 << 0, | 7 | XT_SOCKET_TRANSPARENT = 1 << 0, |
| 6 | }; | 8 | }; |
diff --git a/include/linux/netfilter/xt_time.h b/include/linux/netfilter/xt_time.h index 14b6df412c9f..7c37fac576c4 100644 --- a/include/linux/netfilter/xt_time.h +++ b/include/linux/netfilter/xt_time.h | |||
| @@ -1,14 +1,16 @@ | |||
| 1 | #ifndef _XT_TIME_H | 1 | #ifndef _XT_TIME_H |
| 2 | #define _XT_TIME_H 1 | 2 | #define _XT_TIME_H 1 |
| 3 | 3 | ||
| 4 | #include <linux/types.h> | ||
| 5 | |||
| 4 | struct xt_time_info { | 6 | struct xt_time_info { |
| 5 | u_int32_t date_start; | 7 | __u32 date_start; |
| 6 | u_int32_t date_stop; | 8 | __u32 date_stop; |
| 7 | u_int32_t daytime_start; | 9 | __u32 daytime_start; |
| 8 | u_int32_t daytime_stop; | 10 | __u32 daytime_stop; |
| 9 | u_int32_t monthdays_match; | 11 | __u32 monthdays_match; |
| 10 | u_int8_t weekdays_match; | 12 | __u8 weekdays_match; |
| 11 | u_int8_t flags; | 13 | __u8 flags; |
| 12 | }; | 14 | }; |
| 13 | 15 | ||
| 14 | enum { | 16 | enum { |
diff --git a/include/linux/netfilter/xt_u32.h b/include/linux/netfilter/xt_u32.h index 9947f56cdbdd..04d1bfea03c2 100644 --- a/include/linux/netfilter/xt_u32.h +++ b/include/linux/netfilter/xt_u32.h | |||
| @@ -1,6 +1,8 @@ | |||
| 1 | #ifndef _XT_U32_H | 1 | #ifndef _XT_U32_H |
| 2 | #define _XT_U32_H 1 | 2 | #define _XT_U32_H 1 |
| 3 | 3 | ||
| 4 | #include <linux/types.h> | ||
| 5 | |||
| 4 | enum xt_u32_ops { | 6 | enum xt_u32_ops { |
| 5 | XT_U32_AND, | 7 | XT_U32_AND, |
| 6 | XT_U32_LEFTSH, | 8 | XT_U32_LEFTSH, |
| @@ -9,13 +11,13 @@ enum xt_u32_ops { | |||
| 9 | }; | 11 | }; |
| 10 | 12 | ||
| 11 | struct xt_u32_location_element { | 13 | struct xt_u32_location_element { |
| 12 | u_int32_t number; | 14 | __u32 number; |
| 13 | u_int8_t nextop; | 15 | __u8 nextop; |
| 14 | }; | 16 | }; |
| 15 | 17 | ||
| 16 | struct xt_u32_value_element { | 18 | struct xt_u32_value_element { |
| 17 | u_int32_t min; | 19 | __u32 min; |
| 18 | u_int32_t max; | 20 | __u32 max; |
| 19 | }; | 21 | }; |
| 20 | 22 | ||
| 21 | /* | 23 | /* |
| @@ -27,14 +29,14 @@ struct xt_u32_value_element { | |||
| 27 | struct xt_u32_test { | 29 | struct xt_u32_test { |
| 28 | struct xt_u32_location_element location[XT_U32_MAXSIZE+1]; | 30 | struct xt_u32_location_element location[XT_U32_MAXSIZE+1]; |
| 29 | struct xt_u32_value_element value[XT_U32_MAXSIZE+1]; | 31 | struct xt_u32_value_element value[XT_U32_MAXSIZE+1]; |
| 30 | u_int8_t nnums; | 32 | __u8 nnums; |
| 31 | u_int8_t nvalues; | 33 | __u8 nvalues; |
| 32 | }; | 34 | }; |
| 33 | 35 | ||
| 34 | struct xt_u32 { | 36 | struct xt_u32 { |
| 35 | struct xt_u32_test tests[XT_U32_MAXSIZE+1]; | 37 | struct xt_u32_test tests[XT_U32_MAXSIZE+1]; |
| 36 | u_int8_t ntests; | 38 | __u8 ntests; |
| 37 | u_int8_t invert; | 39 | __u8 invert; |
| 38 | }; | 40 | }; |
| 39 | 41 | ||
| 40 | #endif /* _XT_U32_H */ | 42 | #endif /* _XT_U32_H */ |
diff --git a/include/linux/netfilter_bridge/ebt_802_3.h b/include/linux/netfilter_bridge/ebt_802_3.h index c73ef0b18bdc..be5be1577a56 100644 --- a/include/linux/netfilter_bridge/ebt_802_3.h +++ b/include/linux/netfilter_bridge/ebt_802_3.h | |||
| @@ -1,6 +1,8 @@ | |||
| 1 | #ifndef __LINUX_BRIDGE_EBT_802_3_H | 1 | #ifndef __LINUX_BRIDGE_EBT_802_3_H |
| 2 | #define __LINUX_BRIDGE_EBT_802_3_H | 2 | #define __LINUX_BRIDGE_EBT_802_3_H |
| 3 | 3 | ||
| 4 | #include <linux/types.h> | ||
| 5 | |||
| 4 | #define EBT_802_3_SAP 0x01 | 6 | #define EBT_802_3_SAP 0x01 |
| 5 | #define EBT_802_3_TYPE 0x02 | 7 | #define EBT_802_3_TYPE 0x02 |
| 6 | 8 | ||
| @@ -24,24 +26,24 @@ | |||
| 24 | 26 | ||
| 25 | /* ui has one byte ctrl, ni has two */ | 27 | /* ui has one byte ctrl, ni has two */ |
| 26 | struct hdr_ui { | 28 | struct hdr_ui { |
| 27 | uint8_t dsap; | 29 | __u8 dsap; |
| 28 | uint8_t ssap; | 30 | __u8 ssap; |
| 29 | uint8_t ctrl; | 31 | __u8 ctrl; |
| 30 | uint8_t orig[3]; | 32 | __u8 orig[3]; |
| 31 | __be16 type; | 33 | __be16 type; |
| 32 | }; | 34 | }; |
| 33 | 35 | ||
| 34 | struct hdr_ni { | 36 | struct hdr_ni { |
| 35 | uint8_t dsap; | 37 | __u8 dsap; |
| 36 | uint8_t ssap; | 38 | __u8 ssap; |
| 37 | __be16 ctrl; | 39 | __be16 ctrl; |
| 38 | uint8_t orig[3]; | 40 | __u8 orig[3]; |
| 39 | __be16 type; | 41 | __be16 type; |
| 40 | }; | 42 | }; |
| 41 | 43 | ||
| 42 | struct ebt_802_3_hdr { | 44 | struct ebt_802_3_hdr { |
| 43 | uint8_t daddr[6]; | 45 | __u8 daddr[6]; |
| 44 | uint8_t saddr[6]; | 46 | __u8 saddr[6]; |
| 45 | __be16 len; | 47 | __be16 len; |
| 46 | union { | 48 | union { |
| 47 | struct hdr_ui ui; | 49 | struct hdr_ui ui; |
| @@ -59,10 +61,10 @@ static inline struct ebt_802_3_hdr *ebt_802_3_hdr(const struct sk_buff *skb) | |||
| 59 | #endif | 61 | #endif |
| 60 | 62 | ||
| 61 | struct ebt_802_3_info { | 63 | struct ebt_802_3_info { |
| 62 | uint8_t sap; | 64 | __u8 sap; |
| 63 | __be16 type; | 65 | __be16 type; |
| 64 | uint8_t bitmask; | 66 | __u8 bitmask; |
| 65 | uint8_t invflags; | 67 | __u8 invflags; |
| 66 | }; | 68 | }; |
| 67 | 69 | ||
| 68 | #endif | 70 | #endif |
diff --git a/include/linux/netfilter_bridge/ebt_among.h b/include/linux/netfilter_bridge/ebt_among.h index 0009558609a7..bd4e3ad0b706 100644 --- a/include/linux/netfilter_bridge/ebt_among.h +++ b/include/linux/netfilter_bridge/ebt_among.h | |||
| @@ -1,6 +1,8 @@ | |||
| 1 | #ifndef __LINUX_BRIDGE_EBT_AMONG_H | 1 | #ifndef __LINUX_BRIDGE_EBT_AMONG_H |
| 2 | #define __LINUX_BRIDGE_EBT_AMONG_H | 2 | #define __LINUX_BRIDGE_EBT_AMONG_H |
| 3 | 3 | ||
| 4 | #include <linux/types.h> | ||
| 5 | |||
| 4 | #define EBT_AMONG_DST 0x01 | 6 | #define EBT_AMONG_DST 0x01 |
| 5 | #define EBT_AMONG_SRC 0x02 | 7 | #define EBT_AMONG_SRC 0x02 |
| 6 | 8 | ||
| @@ -30,7 +32,7 @@ | |||
| 30 | */ | 32 | */ |
| 31 | 33 | ||
| 32 | struct ebt_mac_wormhash_tuple { | 34 | struct ebt_mac_wormhash_tuple { |
| 33 | uint32_t cmp[2]; | 35 | __u32 cmp[2]; |
| 34 | __be32 ip; | 36 | __be32 ip; |
| 35 | }; | 37 | }; |
| 36 | 38 | ||
diff --git a/include/linux/netfilter_bridge/ebt_arp.h b/include/linux/netfilter_bridge/ebt_arp.h index cbf4843b6b0f..522f3e427f49 100644 --- a/include/linux/netfilter_bridge/ebt_arp.h +++ b/include/linux/netfilter_bridge/ebt_arp.h | |||
| @@ -1,6 +1,8 @@ | |||
| 1 | #ifndef __LINUX_BRIDGE_EBT_ARP_H | 1 | #ifndef __LINUX_BRIDGE_EBT_ARP_H |
| 2 | #define __LINUX_BRIDGE_EBT_ARP_H | 2 | #define __LINUX_BRIDGE_EBT_ARP_H |
| 3 | 3 | ||
| 4 | #include <linux/types.h> | ||
| 5 | |||
| 4 | #define EBT_ARP_OPCODE 0x01 | 6 | #define EBT_ARP_OPCODE 0x01 |
| 5 | #define EBT_ARP_HTYPE 0x02 | 7 | #define EBT_ARP_HTYPE 0x02 |
| 6 | #define EBT_ARP_PTYPE 0x04 | 8 | #define EBT_ARP_PTYPE 0x04 |
| @@ -27,8 +29,8 @@ struct ebt_arp_info | |||
| 27 | unsigned char smmsk[ETH_ALEN]; | 29 | unsigned char smmsk[ETH_ALEN]; |
| 28 | unsigned char dmaddr[ETH_ALEN]; | 30 | unsigned char dmaddr[ETH_ALEN]; |
| 29 | unsigned char dmmsk[ETH_ALEN]; | 31 | unsigned char dmmsk[ETH_ALEN]; |
| 30 | uint8_t bitmask; | 32 | __u8 bitmask; |
| 31 | uint8_t invflags; | 33 | __u8 invflags; |
| 32 | }; | 34 | }; |
| 33 | 35 | ||
| 34 | #endif | 36 | #endif |
diff --git a/include/linux/netfilter_bridge/ebt_ip.h b/include/linux/netfilter_bridge/ebt_ip.h index 6a708fb92241..c4bbc41b0ea4 100644 --- a/include/linux/netfilter_bridge/ebt_ip.h +++ b/include/linux/netfilter_bridge/ebt_ip.h | |||
| @@ -15,6 +15,8 @@ | |||
| 15 | #ifndef __LINUX_BRIDGE_EBT_IP_H | 15 | #ifndef __LINUX_BRIDGE_EBT_IP_H |
| 16 | #define __LINUX_BRIDGE_EBT_IP_H | 16 | #define __LINUX_BRIDGE_EBT_IP_H |
| 17 | 17 | ||
| 18 | #include <linux/types.h> | ||
| 19 | |||
| 18 | #define EBT_IP_SOURCE 0x01 | 20 | #define EBT_IP_SOURCE 0x01 |
| 19 | #define EBT_IP_DEST 0x02 | 21 | #define EBT_IP_DEST 0x02 |
| 20 | #define EBT_IP_TOS 0x04 | 22 | #define EBT_IP_TOS 0x04 |
| @@ -31,12 +33,12 @@ struct ebt_ip_info { | |||
| 31 | __be32 daddr; | 33 | __be32 daddr; |
| 32 | __be32 smsk; | 34 | __be32 smsk; |
| 33 | __be32 dmsk; | 35 | __be32 dmsk; |
| 34 | uint8_t tos; | 36 | __u8 tos; |
| 35 | uint8_t protocol; | 37 | __u8 protocol; |
| 36 | uint8_t bitmask; | 38 | __u8 bitmask; |
| 37 | uint8_t invflags; | 39 | __u8 invflags; |
| 38 | uint16_t sport[2]; | 40 | __u16 sport[2]; |
| 39 | uint16_t dport[2]; | 41 | __u16 dport[2]; |
| 40 | }; | 42 | }; |
| 41 | 43 | ||
| 42 | #endif | 44 | #endif |
diff --git a/include/linux/netfilter_bridge/ebt_ip6.h b/include/linux/netfilter_bridge/ebt_ip6.h index e5de98701519..42b889682721 100644 --- a/include/linux/netfilter_bridge/ebt_ip6.h +++ b/include/linux/netfilter_bridge/ebt_ip6.h | |||
| @@ -12,14 +12,19 @@ | |||
| 12 | #ifndef __LINUX_BRIDGE_EBT_IP6_H | 12 | #ifndef __LINUX_BRIDGE_EBT_IP6_H |
| 13 | #define __LINUX_BRIDGE_EBT_IP6_H | 13 | #define __LINUX_BRIDGE_EBT_IP6_H |
| 14 | 14 | ||
| 15 | #include <linux/types.h> | ||
| 16 | |||
| 15 | #define EBT_IP6_SOURCE 0x01 | 17 | #define EBT_IP6_SOURCE 0x01 |
| 16 | #define EBT_IP6_DEST 0x02 | 18 | #define EBT_IP6_DEST 0x02 |
| 17 | #define EBT_IP6_TCLASS 0x04 | 19 | #define EBT_IP6_TCLASS 0x04 |
| 18 | #define EBT_IP6_PROTO 0x08 | 20 | #define EBT_IP6_PROTO 0x08 |
| 19 | #define EBT_IP6_SPORT 0x10 | 21 | #define EBT_IP6_SPORT 0x10 |
| 20 | #define EBT_IP6_DPORT 0x20 | 22 | #define EBT_IP6_DPORT 0x20 |
| 23 | #define EBT_IP6_ICMP6 0x40 | ||
| 24 | |||
| 21 | #define EBT_IP6_MASK (EBT_IP6_SOURCE | EBT_IP6_DEST | EBT_IP6_TCLASS |\ | 25 | #define EBT_IP6_MASK (EBT_IP6_SOURCE | EBT_IP6_DEST | EBT_IP6_TCLASS |\ |
| 22 | EBT_IP6_PROTO | EBT_IP6_SPORT | EBT_IP6_DPORT) | 26 | EBT_IP6_PROTO | EBT_IP6_SPORT | EBT_IP6_DPORT | \ |
| 27 | EBT_IP6_ICMP6) | ||
| 23 | #define EBT_IP6_MATCH "ip6" | 28 | #define EBT_IP6_MATCH "ip6" |
| 24 | 29 | ||
| 25 | /* the same values are used for the invflags */ | 30 | /* the same values are used for the invflags */ |
| @@ -28,12 +33,18 @@ struct ebt_ip6_info { | |||
| 28 | struct in6_addr daddr; | 33 | struct in6_addr daddr; |
| 29 | struct in6_addr smsk; | 34 | struct in6_addr smsk; |
| 30 | struct in6_addr dmsk; | 35 | struct in6_addr dmsk; |
| 31 | uint8_t tclass; | 36 | __u8 tclass; |
| 32 | uint8_t protocol; | 37 | __u8 protocol; |
| 33 | uint8_t bitmask; | 38 | __u8 bitmask; |
| 34 | uint8_t invflags; | 39 | __u8 invflags; |
| 35 | uint16_t sport[2]; | 40 | union { |
| 36 | uint16_t dport[2]; | 41 | __u16 sport[2]; |
| 42 | __u8 icmpv6_type[2]; | ||
| 43 | }; | ||
| 44 | union { | ||
| 45 | __u16 dport[2]; | ||
| 46 | __u8 icmpv6_code[2]; | ||
| 47 | }; | ||
| 37 | }; | 48 | }; |
| 38 | 49 | ||
| 39 | #endif | 50 | #endif |
diff --git a/include/linux/netfilter_bridge/ebt_limit.h b/include/linux/netfilter_bridge/ebt_limit.h index 4bf76b751676..66d80b30ba0e 100644 --- a/include/linux/netfilter_bridge/ebt_limit.h +++ b/include/linux/netfilter_bridge/ebt_limit.h | |||
| @@ -1,6 +1,8 @@ | |||
| 1 | #ifndef __LINUX_BRIDGE_EBT_LIMIT_H | 1 | #ifndef __LINUX_BRIDGE_EBT_LIMIT_H |
| 2 | #define __LINUX_BRIDGE_EBT_LIMIT_H | 2 | #define __LINUX_BRIDGE_EBT_LIMIT_H |
| 3 | 3 | ||
| 4 | #include <linux/types.h> | ||
| 5 | |||
| 4 | #define EBT_LIMIT_MATCH "limit" | 6 | #define EBT_LIMIT_MATCH "limit" |
| 5 | 7 | ||
| 6 | /* timings are in milliseconds. */ | 8 | /* timings are in milliseconds. */ |
| @@ -10,13 +12,13 @@ | |||
| 10 | seconds, or one every 59 hours. */ | 12 | seconds, or one every 59 hours. */ |
| 11 | 13 | ||
| 12 | struct ebt_limit_info { | 14 | struct ebt_limit_info { |
| 13 | u_int32_t avg; /* Average secs between packets * scale */ | 15 | __u32 avg; /* Average secs between packets * scale */ |
| 14 | u_int32_t burst; /* Period multiplier for upper limit. */ | 16 | __u32 burst; /* Period multiplier for upper limit. */ |
| 15 | 17 | ||
| 16 | /* Used internally by the kernel */ | 18 | /* Used internally by the kernel */ |
| 17 | unsigned long prev; | 19 | unsigned long prev; |
| 18 | u_int32_t credit; | 20 | __u32 credit; |
| 19 | u_int32_t credit_cap, cost; | 21 | __u32 credit_cap, cost; |
| 20 | }; | 22 | }; |
| 21 | 23 | ||
| 22 | #endif | 24 | #endif |
diff --git a/include/linux/netfilter_bridge/ebt_log.h b/include/linux/netfilter_bridge/ebt_log.h index cc2cdfb764bc..7e7f1d1fe494 100644 --- a/include/linux/netfilter_bridge/ebt_log.h +++ b/include/linux/netfilter_bridge/ebt_log.h | |||
| @@ -1,6 +1,8 @@ | |||
| 1 | #ifndef __LINUX_BRIDGE_EBT_LOG_H | 1 | #ifndef __LINUX_BRIDGE_EBT_LOG_H |
| 2 | #define __LINUX_BRIDGE_EBT_LOG_H | 2 | #define __LINUX_BRIDGE_EBT_LOG_H |
| 3 | 3 | ||
| 4 | #include <linux/types.h> | ||
| 5 | |||
| 4 | #define EBT_LOG_IP 0x01 /* if the frame is made by ip, log the ip information */ | 6 | #define EBT_LOG_IP 0x01 /* if the frame is made by ip, log the ip information */ |
| 5 | #define EBT_LOG_ARP 0x02 | 7 | #define EBT_LOG_ARP 0x02 |
| 6 | #define EBT_LOG_NFLOG 0x04 | 8 | #define EBT_LOG_NFLOG 0x04 |
| @@ -10,9 +12,9 @@ | |||
| 10 | #define EBT_LOG_WATCHER "log" | 12 | #define EBT_LOG_WATCHER "log" |
| 11 | 13 | ||
| 12 | struct ebt_log_info { | 14 | struct ebt_log_info { |
| 13 | uint8_t loglevel; | 15 | __u8 loglevel; |
| 14 | uint8_t prefix[EBT_LOG_PREFIX_SIZE]; | 16 | __u8 prefix[EBT_LOG_PREFIX_SIZE]; |
| 15 | uint32_t bitmask; | 17 | __u32 bitmask; |
| 16 | }; | 18 | }; |
| 17 | 19 | ||
| 18 | #endif | 20 | #endif |
diff --git a/include/linux/netfilter_bridge/ebt_mark_m.h b/include/linux/netfilter_bridge/ebt_mark_m.h index 9ceb10ec0ed6..410f9e5a71d4 100644 --- a/include/linux/netfilter_bridge/ebt_mark_m.h +++ b/include/linux/netfilter_bridge/ebt_mark_m.h | |||
| @@ -1,13 +1,15 @@ | |||
| 1 | #ifndef __LINUX_BRIDGE_EBT_MARK_M_H | 1 | #ifndef __LINUX_BRIDGE_EBT_MARK_M_H |
| 2 | #define __LINUX_BRIDGE_EBT_MARK_M_H | 2 | #define __LINUX_BRIDGE_EBT_MARK_M_H |
| 3 | 3 | ||
| 4 | #include <linux/types.h> | ||
| 5 | |||
| 4 | #define EBT_MARK_AND 0x01 | 6 | #define EBT_MARK_AND 0x01 |
| 5 | #define EBT_MARK_OR 0x02 | 7 | #define EBT_MARK_OR 0x02 |
| 6 | #define EBT_MARK_MASK (EBT_MARK_AND | EBT_MARK_OR) | 8 | #define EBT_MARK_MASK (EBT_MARK_AND | EBT_MARK_OR) |
| 7 | struct ebt_mark_m_info { | 9 | struct ebt_mark_m_info { |
| 8 | unsigned long mark, mask; | 10 | unsigned long mark, mask; |
| 9 | uint8_t invert; | 11 | __u8 invert; |
| 10 | uint8_t bitmask; | 12 | __u8 bitmask; |
| 11 | }; | 13 | }; |
| 12 | #define EBT_MARK_MATCH "mark_m" | 14 | #define EBT_MARK_MATCH "mark_m" |
| 13 | 15 | ||
diff --git a/include/linux/netfilter_bridge/ebt_nflog.h b/include/linux/netfilter_bridge/ebt_nflog.h index 052817849b83..df829fce9125 100644 --- a/include/linux/netfilter_bridge/ebt_nflog.h +++ b/include/linux/netfilter_bridge/ebt_nflog.h | |||
| @@ -1,6 +1,8 @@ | |||
| 1 | #ifndef __LINUX_BRIDGE_EBT_NFLOG_H | 1 | #ifndef __LINUX_BRIDGE_EBT_NFLOG_H |
| 2 | #define __LINUX_BRIDGE_EBT_NFLOG_H | 2 | #define __LINUX_BRIDGE_EBT_NFLOG_H |
| 3 | 3 | ||
| 4 | #include <linux/types.h> | ||
| 5 | |||
| 4 | #define EBT_NFLOG_MASK 0x0 | 6 | #define EBT_NFLOG_MASK 0x0 |
| 5 | 7 | ||
| 6 | #define EBT_NFLOG_PREFIX_SIZE 64 | 8 | #define EBT_NFLOG_PREFIX_SIZE 64 |
| @@ -10,11 +12,11 @@ | |||
| 10 | #define EBT_NFLOG_DEFAULT_THRESHOLD 1 | 12 | #define EBT_NFLOG_DEFAULT_THRESHOLD 1 |
| 11 | 13 | ||
| 12 | struct ebt_nflog_info { | 14 | struct ebt_nflog_info { |
| 13 | u_int32_t len; | 15 | __u32 len; |
| 14 | u_int16_t group; | 16 | __u16 group; |
| 15 | u_int16_t threshold; | 17 | __u16 threshold; |
| 16 | u_int16_t flags; | 18 | __u16 flags; |
| 17 | u_int16_t pad; | 19 | __u16 pad; |
| 18 | char prefix[EBT_NFLOG_PREFIX_SIZE]; | 20 | char prefix[EBT_NFLOG_PREFIX_SIZE]; |
| 19 | }; | 21 | }; |
| 20 | 22 | ||
diff --git a/include/linux/netfilter_bridge/ebt_pkttype.h b/include/linux/netfilter_bridge/ebt_pkttype.h index 51a799840931..c241badcd036 100644 --- a/include/linux/netfilter_bridge/ebt_pkttype.h +++ b/include/linux/netfilter_bridge/ebt_pkttype.h | |||
| @@ -1,9 +1,11 @@ | |||
| 1 | #ifndef __LINUX_BRIDGE_EBT_PKTTYPE_H | 1 | #ifndef __LINUX_BRIDGE_EBT_PKTTYPE_H |
| 2 | #define __LINUX_BRIDGE_EBT_PKTTYPE_H | 2 | #define __LINUX_BRIDGE_EBT_PKTTYPE_H |
| 3 | 3 | ||
| 4 | #include <linux/types.h> | ||
| 5 | |||
| 4 | struct ebt_pkttype_info { | 6 | struct ebt_pkttype_info { |
| 5 | uint8_t pkt_type; | 7 | __u8 pkt_type; |
| 6 | uint8_t invert; | 8 | __u8 invert; |
| 7 | }; | 9 | }; |
| 8 | #define EBT_PKTTYPE_MATCH "pkttype" | 10 | #define EBT_PKTTYPE_MATCH "pkttype" |
| 9 | 11 | ||
diff --git a/include/linux/netfilter_bridge/ebt_stp.h b/include/linux/netfilter_bridge/ebt_stp.h index e503a0aa2728..1025b9f5fb7d 100644 --- a/include/linux/netfilter_bridge/ebt_stp.h +++ b/include/linux/netfilter_bridge/ebt_stp.h | |||
| @@ -1,6 +1,8 @@ | |||
| 1 | #ifndef __LINUX_BRIDGE_EBT_STP_H | 1 | #ifndef __LINUX_BRIDGE_EBT_STP_H |
| 2 | #define __LINUX_BRIDGE_EBT_STP_H | 2 | #define __LINUX_BRIDGE_EBT_STP_H |
| 3 | 3 | ||
| 4 | #include <linux/types.h> | ||
| 5 | |||
| 4 | #define EBT_STP_TYPE 0x0001 | 6 | #define EBT_STP_TYPE 0x0001 |
| 5 | 7 | ||
| 6 | #define EBT_STP_FLAGS 0x0002 | 8 | #define EBT_STP_FLAGS 0x0002 |
| @@ -21,24 +23,24 @@ | |||
| 21 | #define EBT_STP_MATCH "stp" | 23 | #define EBT_STP_MATCH "stp" |
| 22 | 24 | ||
| 23 | struct ebt_stp_config_info { | 25 | struct ebt_stp_config_info { |
| 24 | uint8_t flags; | 26 | __u8 flags; |
| 25 | uint16_t root_priol, root_priou; | 27 | __u16 root_priol, root_priou; |
| 26 | char root_addr[6], root_addrmsk[6]; | 28 | char root_addr[6], root_addrmsk[6]; |
| 27 | uint32_t root_costl, root_costu; | 29 | __u32 root_costl, root_costu; |
| 28 | uint16_t sender_priol, sender_priou; | 30 | __u16 sender_priol, sender_priou; |
| 29 | char sender_addr[6], sender_addrmsk[6]; | 31 | char sender_addr[6], sender_addrmsk[6]; |
| 30 | uint16_t portl, portu; | 32 | __u16 portl, portu; |
| 31 | uint16_t msg_agel, msg_ageu; | 33 | __u16 msg_agel, msg_ageu; |
| 32 | uint16_t max_agel, max_ageu; | 34 | __u16 max_agel, max_ageu; |
| 33 | uint16_t hello_timel, hello_timeu; | 35 | __u16 hello_timel, hello_timeu; |
| 34 | uint16_t forward_delayl, forward_delayu; | 36 | __u16 forward_delayl, forward_delayu; |
| 35 | }; | 37 | }; |
| 36 | 38 | ||
| 37 | struct ebt_stp_info { | 39 | struct ebt_stp_info { |
| 38 | uint8_t type; | 40 | __u8 type; |
| 39 | struct ebt_stp_config_info config; | 41 | struct ebt_stp_config_info config; |
| 40 | uint16_t bitmask; | 42 | __u16 bitmask; |
| 41 | uint16_t invflags; | 43 | __u16 invflags; |
| 42 | }; | 44 | }; |
| 43 | 45 | ||
| 44 | #endif | 46 | #endif |
diff --git a/include/linux/netfilter_bridge/ebt_ulog.h b/include/linux/netfilter_bridge/ebt_ulog.h index b677e2671541..89a6becb5269 100644 --- a/include/linux/netfilter_bridge/ebt_ulog.h +++ b/include/linux/netfilter_bridge/ebt_ulog.h | |||
| @@ -1,6 +1,8 @@ | |||
| 1 | #ifndef _EBT_ULOG_H | 1 | #ifndef _EBT_ULOG_H |
| 2 | #define _EBT_ULOG_H | 2 | #define _EBT_ULOG_H |
| 3 | 3 | ||
| 4 | #include <linux/types.h> | ||
| 5 | |||
| 4 | #define EBT_ULOG_DEFAULT_NLGROUP 0 | 6 | #define EBT_ULOG_DEFAULT_NLGROUP 0 |
| 5 | #define EBT_ULOG_DEFAULT_QTHRESHOLD 1 | 7 | #define EBT_ULOG_DEFAULT_QTHRESHOLD 1 |
| 6 | #define EBT_ULOG_MAXNLGROUPS 32 /* hardcoded netlink max */ | 8 | #define EBT_ULOG_MAXNLGROUPS 32 /* hardcoded netlink max */ |
| @@ -10,7 +12,7 @@ | |||
| 10 | #define EBT_ULOG_VERSION 1 | 12 | #define EBT_ULOG_VERSION 1 |
| 11 | 13 | ||
| 12 | struct ebt_ulog_info { | 14 | struct ebt_ulog_info { |
| 13 | uint32_t nlgroup; | 15 | __u32 nlgroup; |
| 14 | unsigned int cprange; | 16 | unsigned int cprange; |
| 15 | unsigned int qthreshold; | 17 | unsigned int qthreshold; |
| 16 | char prefix[EBT_ULOG_PREFIX_LEN]; | 18 | char prefix[EBT_ULOG_PREFIX_LEN]; |
diff --git a/include/linux/netfilter_bridge/ebt_vlan.h b/include/linux/netfilter_bridge/ebt_vlan.h index 1d98be4031e7..967d1d5cf98d 100644 --- a/include/linux/netfilter_bridge/ebt_vlan.h +++ b/include/linux/netfilter_bridge/ebt_vlan.h | |||
| @@ -1,6 +1,8 @@ | |||
| 1 | #ifndef __LINUX_BRIDGE_EBT_VLAN_H | 1 | #ifndef __LINUX_BRIDGE_EBT_VLAN_H |
| 2 | #define __LINUX_BRIDGE_EBT_VLAN_H | 2 | #define __LINUX_BRIDGE_EBT_VLAN_H |
| 3 | 3 | ||
| 4 | #include <linux/types.h> | ||
| 5 | |||
| 4 | #define EBT_VLAN_ID 0x01 | 6 | #define EBT_VLAN_ID 0x01 |
| 5 | #define EBT_VLAN_PRIO 0x02 | 7 | #define EBT_VLAN_PRIO 0x02 |
| 6 | #define EBT_VLAN_ENCAP 0x04 | 8 | #define EBT_VLAN_ENCAP 0x04 |
| @@ -8,12 +10,12 @@ | |||
| 8 | #define EBT_VLAN_MATCH "vlan" | 10 | #define EBT_VLAN_MATCH "vlan" |
| 9 | 11 | ||
| 10 | struct ebt_vlan_info { | 12 | struct ebt_vlan_info { |
| 11 | uint16_t id; /* VLAN ID {1-4095} */ | 13 | __u16 id; /* VLAN ID {1-4095} */ |
| 12 | uint8_t prio; /* VLAN User Priority {0-7} */ | 14 | __u8 prio; /* VLAN User Priority {0-7} */ |
| 13 | __be16 encap; /* VLAN Encapsulated frame code {0-65535} */ | 15 | __be16 encap; /* VLAN Encapsulated frame code {0-65535} */ |
| 14 | uint8_t bitmask; /* Args bitmask bit 1=1 - ID arg, | 16 | __u8 bitmask; /* Args bitmask bit 1=1 - ID arg, |
| 15 | bit 2=1 User-Priority arg, bit 3=1 encap*/ | 17 | bit 2=1 User-Priority arg, bit 3=1 encap*/ |
| 16 | uint8_t invflags; /* Inverse bitmask bit 1=1 - inversed ID arg, | 18 | __u8 invflags; /* Inverse bitmask bit 1=1 - inversed ID arg, |
| 17 | bit 2=1 - inversed Pirority arg */ | 19 | bit 2=1 - inversed Pirority arg */ |
| 18 | }; | 20 | }; |
| 19 | 21 | ||
diff --git a/include/linux/netfilter_ipv4/ipt_CLUSTERIP.h b/include/linux/netfilter_ipv4/ipt_CLUSTERIP.h index e5a3687c8a72..c6a204c97047 100644 --- a/include/linux/netfilter_ipv4/ipt_CLUSTERIP.h +++ b/include/linux/netfilter_ipv4/ipt_CLUSTERIP.h | |||
| @@ -1,6 +1,8 @@ | |||
| 1 | #ifndef _IPT_CLUSTERIP_H_target | 1 | #ifndef _IPT_CLUSTERIP_H_target |
| 2 | #define _IPT_CLUSTERIP_H_target | 2 | #define _IPT_CLUSTERIP_H_target |
| 3 | 3 | ||
| 4 | #include <linux/types.h> | ||
| 5 | |||
| 4 | enum clusterip_hashmode { | 6 | enum clusterip_hashmode { |
| 5 | CLUSTERIP_HASHMODE_SIP = 0, | 7 | CLUSTERIP_HASHMODE_SIP = 0, |
| 6 | CLUSTERIP_HASHMODE_SIP_SPT, | 8 | CLUSTERIP_HASHMODE_SIP_SPT, |
| @@ -17,15 +19,15 @@ struct clusterip_config; | |||
| 17 | 19 | ||
| 18 | struct ipt_clusterip_tgt_info { | 20 | struct ipt_clusterip_tgt_info { |
| 19 | 21 | ||
| 20 | u_int32_t flags; | 22 | __u32 flags; |
| 21 | 23 | ||
| 22 | /* only relevant for new ones */ | 24 | /* only relevant for new ones */ |
| 23 | u_int8_t clustermac[6]; | 25 | __u8 clustermac[6]; |
| 24 | u_int16_t num_total_nodes; | 26 | __u16 num_total_nodes; |
| 25 | u_int16_t num_local_nodes; | 27 | __u16 num_local_nodes; |
| 26 | u_int16_t local_nodes[CLUSTERIP_MAX_NODES]; | 28 | __u16 local_nodes[CLUSTERIP_MAX_NODES]; |
| 27 | u_int32_t hash_mode; | 29 | __u32 hash_mode; |
| 28 | u_int32_t hash_initval; | 30 | __u32 hash_initval; |
| 29 | 31 | ||
| 30 | /* Used internally by the kernel */ | 32 | /* Used internally by the kernel */ |
| 31 | struct clusterip_config *config; | 33 | struct clusterip_config *config; |
diff --git a/include/linux/netfilter_ipv4/ipt_ECN.h b/include/linux/netfilter_ipv4/ipt_ECN.h index 7ca45918ab8e..bb88d5315a4d 100644 --- a/include/linux/netfilter_ipv4/ipt_ECN.h +++ b/include/linux/netfilter_ipv4/ipt_ECN.h | |||
| @@ -8,6 +8,8 @@ | |||
| 8 | */ | 8 | */ |
| 9 | #ifndef _IPT_ECN_TARGET_H | 9 | #ifndef _IPT_ECN_TARGET_H |
| 10 | #define _IPT_ECN_TARGET_H | 10 | #define _IPT_ECN_TARGET_H |
| 11 | |||
| 12 | #include <linux/types.h> | ||
| 11 | #include <linux/netfilter/xt_DSCP.h> | 13 | #include <linux/netfilter/xt_DSCP.h> |
| 12 | 14 | ||
| 13 | #define IPT_ECN_IP_MASK (~XT_DSCP_MASK) | 15 | #define IPT_ECN_IP_MASK (~XT_DSCP_MASK) |
| @@ -19,11 +21,11 @@ | |||
| 19 | #define IPT_ECN_OP_MASK 0xce | 21 | #define IPT_ECN_OP_MASK 0xce |
| 20 | 22 | ||
| 21 | struct ipt_ECN_info { | 23 | struct ipt_ECN_info { |
| 22 | u_int8_t operation; /* bitset of operations */ | 24 | __u8 operation; /* bitset of operations */ |
| 23 | u_int8_t ip_ect; /* ECT codepoint of IPv4 header, pre-shifted */ | 25 | __u8 ip_ect; /* ECT codepoint of IPv4 header, pre-shifted */ |
| 24 | union { | 26 | union { |
| 25 | struct { | 27 | struct { |
| 26 | u_int8_t ece:1, cwr:1; /* TCP ECT bits */ | 28 | __u8 ece:1, cwr:1; /* TCP ECT bits */ |
| 27 | } tcp; | 29 | } tcp; |
| 28 | } proto; | 30 | } proto; |
| 29 | }; | 31 | }; |
diff --git a/include/linux/netfilter_ipv4/ipt_SAME.h b/include/linux/netfilter_ipv4/ipt_SAME.h index 2529660c5b38..5bca78267afd 100644 --- a/include/linux/netfilter_ipv4/ipt_SAME.h +++ b/include/linux/netfilter_ipv4/ipt_SAME.h | |||
| @@ -1,15 +1,17 @@ | |||
| 1 | #ifndef _IPT_SAME_H | 1 | #ifndef _IPT_SAME_H |
| 2 | #define _IPT_SAME_H | 2 | #define _IPT_SAME_H |
| 3 | 3 | ||
| 4 | #include <linux/types.h> | ||
| 5 | |||
| 4 | #define IPT_SAME_MAX_RANGE 10 | 6 | #define IPT_SAME_MAX_RANGE 10 |
| 5 | 7 | ||
| 6 | #define IPT_SAME_NODST 0x01 | 8 | #define IPT_SAME_NODST 0x01 |
| 7 | 9 | ||
| 8 | struct ipt_same_info { | 10 | struct ipt_same_info { |
| 9 | unsigned char info; | 11 | unsigned char info; |
| 10 | u_int32_t rangesize; | 12 | __u32 rangesize; |
| 11 | u_int32_t ipnum; | 13 | __u32 ipnum; |
| 12 | u_int32_t *iparray; | 14 | __u32 *iparray; |
| 13 | 15 | ||
| 14 | /* hangs off end. */ | 16 | /* hangs off end. */ |
| 15 | struct nf_nat_range range[IPT_SAME_MAX_RANGE]; | 17 | struct nf_nat_range range[IPT_SAME_MAX_RANGE]; |
diff --git a/include/linux/netfilter_ipv4/ipt_TTL.h b/include/linux/netfilter_ipv4/ipt_TTL.h index ee6611edc112..f6ac169d92f9 100644 --- a/include/linux/netfilter_ipv4/ipt_TTL.h +++ b/include/linux/netfilter_ipv4/ipt_TTL.h | |||
| @@ -4,6 +4,8 @@ | |||
| 4 | #ifndef _IPT_TTL_H | 4 | #ifndef _IPT_TTL_H |
| 5 | #define _IPT_TTL_H | 5 | #define _IPT_TTL_H |
| 6 | 6 | ||
| 7 | #include <linux/types.h> | ||
| 8 | |||
| 7 | enum { | 9 | enum { |
| 8 | IPT_TTL_SET = 0, | 10 | IPT_TTL_SET = 0, |
| 9 | IPT_TTL_INC, | 11 | IPT_TTL_INC, |
| @@ -13,8 +15,8 @@ enum { | |||
| 13 | #define IPT_TTL_MAXMODE IPT_TTL_DEC | 15 | #define IPT_TTL_MAXMODE IPT_TTL_DEC |
| 14 | 16 | ||
| 15 | struct ipt_TTL_info { | 17 | struct ipt_TTL_info { |
| 16 | u_int8_t mode; | 18 | __u8 mode; |
| 17 | u_int8_t ttl; | 19 | __u8 ttl; |
| 18 | }; | 20 | }; |
| 19 | 21 | ||
| 20 | 22 | ||
diff --git a/include/linux/netfilter_ipv4/ipt_addrtype.h b/include/linux/netfilter_ipv4/ipt_addrtype.h index 446de6aef983..0da42237c8da 100644 --- a/include/linux/netfilter_ipv4/ipt_addrtype.h +++ b/include/linux/netfilter_ipv4/ipt_addrtype.h | |||
| @@ -1,6 +1,8 @@ | |||
| 1 | #ifndef _IPT_ADDRTYPE_H | 1 | #ifndef _IPT_ADDRTYPE_H |
| 2 | #define _IPT_ADDRTYPE_H | 2 | #define _IPT_ADDRTYPE_H |
| 3 | 3 | ||
| 4 | #include <linux/types.h> | ||
| 5 | |||
| 4 | enum { | 6 | enum { |
| 5 | IPT_ADDRTYPE_INVERT_SOURCE = 0x0001, | 7 | IPT_ADDRTYPE_INVERT_SOURCE = 0x0001, |
| 6 | IPT_ADDRTYPE_INVERT_DEST = 0x0002, | 8 | IPT_ADDRTYPE_INVERT_DEST = 0x0002, |
| @@ -9,17 +11,17 @@ enum { | |||
| 9 | }; | 11 | }; |
| 10 | 12 | ||
| 11 | struct ipt_addrtype_info_v1 { | 13 | struct ipt_addrtype_info_v1 { |
| 12 | u_int16_t source; /* source-type mask */ | 14 | __u16 source; /* source-type mask */ |
| 13 | u_int16_t dest; /* dest-type mask */ | 15 | __u16 dest; /* dest-type mask */ |
| 14 | u_int32_t flags; | 16 | __u32 flags; |
| 15 | }; | 17 | }; |
| 16 | 18 | ||
| 17 | /* revision 0 */ | 19 | /* revision 0 */ |
| 18 | struct ipt_addrtype_info { | 20 | struct ipt_addrtype_info { |
| 19 | u_int16_t source; /* source-type mask */ | 21 | __u16 source; /* source-type mask */ |
| 20 | u_int16_t dest; /* dest-type mask */ | 22 | __u16 dest; /* dest-type mask */ |
| 21 | u_int32_t invert_source; | 23 | __u32 invert_source; |
| 22 | u_int32_t invert_dest; | 24 | __u32 invert_dest; |
| 23 | }; | 25 | }; |
| 24 | 26 | ||
| 25 | #endif | 27 | #endif |
diff --git a/include/linux/netfilter_ipv4/ipt_ah.h b/include/linux/netfilter_ipv4/ipt_ah.h index 2e555b4d05e3..4e02bb0119e3 100644 --- a/include/linux/netfilter_ipv4/ipt_ah.h +++ b/include/linux/netfilter_ipv4/ipt_ah.h | |||
| @@ -1,9 +1,11 @@ | |||
| 1 | #ifndef _IPT_AH_H | 1 | #ifndef _IPT_AH_H |
| 2 | #define _IPT_AH_H | 2 | #define _IPT_AH_H |
| 3 | 3 | ||
| 4 | #include <linux/types.h> | ||
| 5 | |||
| 4 | struct ipt_ah { | 6 | struct ipt_ah { |
| 5 | u_int32_t spis[2]; /* Security Parameter Index */ | 7 | __u32 spis[2]; /* Security Parameter Index */ |
| 6 | u_int8_t invflags; /* Inverse flags */ | 8 | __u8 invflags; /* Inverse flags */ |
| 7 | }; | 9 | }; |
| 8 | 10 | ||
| 9 | 11 | ||
diff --git a/include/linux/netfilter_ipv4/ipt_ecn.h b/include/linux/netfilter_ipv4/ipt_ecn.h index 9945baa4ccd7..eabf95fb7d3e 100644 --- a/include/linux/netfilter_ipv4/ipt_ecn.h +++ b/include/linux/netfilter_ipv4/ipt_ecn.h | |||
| @@ -8,6 +8,8 @@ | |||
| 8 | */ | 8 | */ |
| 9 | #ifndef _IPT_ECN_H | 9 | #ifndef _IPT_ECN_H |
| 10 | #define _IPT_ECN_H | 10 | #define _IPT_ECN_H |
| 11 | |||
| 12 | #include <linux/types.h> | ||
| 11 | #include <linux/netfilter/xt_dscp.h> | 13 | #include <linux/netfilter/xt_dscp.h> |
| 12 | 14 | ||
| 13 | #define IPT_ECN_IP_MASK (~XT_DSCP_MASK) | 15 | #define IPT_ECN_IP_MASK (~XT_DSCP_MASK) |
| @@ -20,12 +22,12 @@ | |||
| 20 | 22 | ||
| 21 | /* match info */ | 23 | /* match info */ |
| 22 | struct ipt_ecn_info { | 24 | struct ipt_ecn_info { |
| 23 | u_int8_t operation; | 25 | __u8 operation; |
| 24 | u_int8_t invert; | 26 | __u8 invert; |
| 25 | u_int8_t ip_ect; | 27 | __u8 ip_ect; |
| 26 | union { | 28 | union { |
| 27 | struct { | 29 | struct { |
| 28 | u_int8_t ect; | 30 | __u8 ect; |
| 29 | } tcp; | 31 | } tcp; |
| 30 | } proto; | 32 | } proto; |
| 31 | }; | 33 | }; |
diff --git a/include/linux/netfilter_ipv4/ipt_ttl.h b/include/linux/netfilter_ipv4/ipt_ttl.h index ee24fd86a3aa..37bee4442486 100644 --- a/include/linux/netfilter_ipv4/ipt_ttl.h +++ b/include/linux/netfilter_ipv4/ipt_ttl.h | |||
| @@ -4,6 +4,8 @@ | |||
| 4 | #ifndef _IPT_TTL_H | 4 | #ifndef _IPT_TTL_H |
| 5 | #define _IPT_TTL_H | 5 | #define _IPT_TTL_H |
| 6 | 6 | ||
| 7 | #include <linux/types.h> | ||
| 8 | |||
| 7 | enum { | 9 | enum { |
| 8 | IPT_TTL_EQ = 0, /* equals */ | 10 | IPT_TTL_EQ = 0, /* equals */ |
| 9 | IPT_TTL_NE, /* not equals */ | 11 | IPT_TTL_NE, /* not equals */ |
| @@ -13,8 +15,8 @@ enum { | |||
| 13 | 15 | ||
| 14 | 16 | ||
| 15 | struct ipt_ttl_info { | 17 | struct ipt_ttl_info { |
| 16 | u_int8_t mode; | 18 | __u8 mode; |
| 17 | u_int8_t ttl; | 19 | __u8 ttl; |
| 18 | }; | 20 | }; |
| 19 | 21 | ||
| 20 | 22 | ||
diff --git a/include/linux/netfilter_ipv6/ip6t_HL.h b/include/linux/netfilter_ipv6/ip6t_HL.h index afb7813d45ab..ebd8ead1bb63 100644 --- a/include/linux/netfilter_ipv6/ip6t_HL.h +++ b/include/linux/netfilter_ipv6/ip6t_HL.h | |||
| @@ -5,6 +5,8 @@ | |||
| 5 | #ifndef _IP6T_HL_H | 5 | #ifndef _IP6T_HL_H |
| 6 | #define _IP6T_HL_H | 6 | #define _IP6T_HL_H |
| 7 | 7 | ||
| 8 | #include <linux/types.h> | ||
| 9 | |||
| 8 | enum { | 10 | enum { |
| 9 | IP6T_HL_SET = 0, | 11 | IP6T_HL_SET = 0, |
| 10 | IP6T_HL_INC, | 12 | IP6T_HL_INC, |
| @@ -14,8 +16,8 @@ enum { | |||
| 14 | #define IP6T_HL_MAXMODE IP6T_HL_DEC | 16 | #define IP6T_HL_MAXMODE IP6T_HL_DEC |
| 15 | 17 | ||
| 16 | struct ip6t_HL_info { | 18 | struct ip6t_HL_info { |
| 17 | u_int8_t mode; | 19 | __u8 mode; |
| 18 | u_int8_t hop_limit; | 20 | __u8 hop_limit; |
| 19 | }; | 21 | }; |
| 20 | 22 | ||
| 21 | 23 | ||
diff --git a/include/linux/netfilter_ipv6/ip6t_REJECT.h b/include/linux/netfilter_ipv6/ip6t_REJECT.h index 6be6504162bb..205ed62e4605 100644 --- a/include/linux/netfilter_ipv6/ip6t_REJECT.h +++ b/include/linux/netfilter_ipv6/ip6t_REJECT.h | |||
| @@ -1,6 +1,8 @@ | |||
| 1 | #ifndef _IP6T_REJECT_H | 1 | #ifndef _IP6T_REJECT_H |
| 2 | #define _IP6T_REJECT_H | 2 | #define _IP6T_REJECT_H |
| 3 | 3 | ||
| 4 | #include <linux/types.h> | ||
| 5 | |||
| 4 | enum ip6t_reject_with { | 6 | enum ip6t_reject_with { |
| 5 | IP6T_ICMP6_NO_ROUTE, | 7 | IP6T_ICMP6_NO_ROUTE, |
| 6 | IP6T_ICMP6_ADM_PROHIBITED, | 8 | IP6T_ICMP6_ADM_PROHIBITED, |
| @@ -12,7 +14,7 @@ enum ip6t_reject_with { | |||
| 12 | }; | 14 | }; |
| 13 | 15 | ||
| 14 | struct ip6t_reject_info { | 16 | struct ip6t_reject_info { |
| 15 | u_int32_t with; /* reject type */ | 17 | __u32 with; /* reject type */ |
| 16 | }; | 18 | }; |
| 17 | 19 | ||
| 18 | #endif /*_IP6T_REJECT_H*/ | 20 | #endif /*_IP6T_REJECT_H*/ |
diff --git a/include/linux/netfilter_ipv6/ip6t_ah.h b/include/linux/netfilter_ipv6/ip6t_ah.h index 17a745cfb2c7..5da2b65cb3ad 100644 --- a/include/linux/netfilter_ipv6/ip6t_ah.h +++ b/include/linux/netfilter_ipv6/ip6t_ah.h | |||
| @@ -1,11 +1,13 @@ | |||
| 1 | #ifndef _IP6T_AH_H | 1 | #ifndef _IP6T_AH_H |
| 2 | #define _IP6T_AH_H | 2 | #define _IP6T_AH_H |
| 3 | 3 | ||
| 4 | #include <linux/types.h> | ||
| 5 | |||
| 4 | struct ip6t_ah { | 6 | struct ip6t_ah { |
| 5 | u_int32_t spis[2]; /* Security Parameter Index */ | 7 | __u32 spis[2]; /* Security Parameter Index */ |
| 6 | u_int32_t hdrlen; /* Header Length */ | 8 | __u32 hdrlen; /* Header Length */ |
| 7 | u_int8_t hdrres; /* Test of the Reserved Filed */ | 9 | __u8 hdrres; /* Test of the Reserved Filed */ |
| 8 | u_int8_t invflags; /* Inverse flags */ | 10 | __u8 invflags; /* Inverse flags */ |
| 9 | }; | 11 | }; |
| 10 | 12 | ||
| 11 | #define IP6T_AH_SPI 0x01 | 13 | #define IP6T_AH_SPI 0x01 |
diff --git a/include/linux/netfilter_ipv6/ip6t_frag.h b/include/linux/netfilter_ipv6/ip6t_frag.h index 3724d0850920..b47f61b9e082 100644 --- a/include/linux/netfilter_ipv6/ip6t_frag.h +++ b/include/linux/netfilter_ipv6/ip6t_frag.h | |||
| @@ -1,11 +1,13 @@ | |||
| 1 | #ifndef _IP6T_FRAG_H | 1 | #ifndef _IP6T_FRAG_H |
| 2 | #define _IP6T_FRAG_H | 2 | #define _IP6T_FRAG_H |
| 3 | 3 | ||
| 4 | #include <linux/types.h> | ||
| 5 | |||
| 4 | struct ip6t_frag { | 6 | struct ip6t_frag { |
| 5 | u_int32_t ids[2]; /* Security Parameter Index */ | 7 | __u32 ids[2]; /* Security Parameter Index */ |
| 6 | u_int32_t hdrlen; /* Header Length */ | 8 | __u32 hdrlen; /* Header Length */ |
| 7 | u_int8_t flags; /* */ | 9 | __u8 flags; /* */ |
| 8 | u_int8_t invflags; /* Inverse flags */ | 10 | __u8 invflags; /* Inverse flags */ |
| 9 | }; | 11 | }; |
| 10 | 12 | ||
| 11 | #define IP6T_FRAG_IDS 0x01 | 13 | #define IP6T_FRAG_IDS 0x01 |
diff --git a/include/linux/netfilter_ipv6/ip6t_hl.h b/include/linux/netfilter_ipv6/ip6t_hl.h index 5ef91b8319a8..6e76dbc6c19a 100644 --- a/include/linux/netfilter_ipv6/ip6t_hl.h +++ b/include/linux/netfilter_ipv6/ip6t_hl.h | |||
| @@ -5,6 +5,8 @@ | |||
| 5 | #ifndef _IP6T_HL_H | 5 | #ifndef _IP6T_HL_H |
| 6 | #define _IP6T_HL_H | 6 | #define _IP6T_HL_H |
| 7 | 7 | ||
| 8 | #include <linux/types.h> | ||
| 9 | |||
| 8 | enum { | 10 | enum { |
| 9 | IP6T_HL_EQ = 0, /* equals */ | 11 | IP6T_HL_EQ = 0, /* equals */ |
| 10 | IP6T_HL_NE, /* not equals */ | 12 | IP6T_HL_NE, /* not equals */ |
| @@ -14,8 +16,8 @@ enum { | |||
| 14 | 16 | ||
| 15 | 17 | ||
| 16 | struct ip6t_hl_info { | 18 | struct ip6t_hl_info { |
| 17 | u_int8_t mode; | 19 | __u8 mode; |
| 18 | u_int8_t hop_limit; | 20 | __u8 hop_limit; |
| 19 | }; | 21 | }; |
| 20 | 22 | ||
| 21 | 23 | ||
diff --git a/include/linux/netfilter_ipv6/ip6t_ipv6header.h b/include/linux/netfilter_ipv6/ip6t_ipv6header.h index 01dfd445596a..efae3a20c214 100644 --- a/include/linux/netfilter_ipv6/ip6t_ipv6header.h +++ b/include/linux/netfilter_ipv6/ip6t_ipv6header.h | |||
| @@ -8,10 +8,12 @@ on whether they contain certain headers */ | |||
| 8 | #ifndef __IPV6HEADER_H | 8 | #ifndef __IPV6HEADER_H |
| 9 | #define __IPV6HEADER_H | 9 | #define __IPV6HEADER_H |
| 10 | 10 | ||
| 11 | #include <linux/types.h> | ||
| 12 | |||
| 11 | struct ip6t_ipv6header_info { | 13 | struct ip6t_ipv6header_info { |
| 12 | u_int8_t matchflags; | 14 | __u8 matchflags; |
| 13 | u_int8_t invflags; | 15 | __u8 invflags; |
| 14 | u_int8_t modeflag; | 16 | __u8 modeflag; |
| 15 | }; | 17 | }; |
| 16 | 18 | ||
| 17 | #define MASK_HOPOPTS 128 | 19 | #define MASK_HOPOPTS 128 |
diff --git a/include/linux/netfilter_ipv6/ip6t_mh.h b/include/linux/netfilter_ipv6/ip6t_mh.h index 18549bca2d1f..a7729a5025cd 100644 --- a/include/linux/netfilter_ipv6/ip6t_mh.h +++ b/include/linux/netfilter_ipv6/ip6t_mh.h | |||
| @@ -1,10 +1,12 @@ | |||
| 1 | #ifndef _IP6T_MH_H | 1 | #ifndef _IP6T_MH_H |
| 2 | #define _IP6T_MH_H | 2 | #define _IP6T_MH_H |
| 3 | 3 | ||
| 4 | #include <linux/types.h> | ||
| 5 | |||
| 4 | /* MH matching stuff */ | 6 | /* MH matching stuff */ |
| 5 | struct ip6t_mh { | 7 | struct ip6t_mh { |
| 6 | u_int8_t types[2]; /* MH type range */ | 8 | __u8 types[2]; /* MH type range */ |
| 7 | u_int8_t invflags; /* Inverse flags */ | 9 | __u8 invflags; /* Inverse flags */ |
| 8 | }; | 10 | }; |
| 9 | 11 | ||
| 10 | /* Values for "invflags" field in struct ip6t_mh. */ | 12 | /* Values for "invflags" field in struct ip6t_mh. */ |
diff --git a/include/linux/netfilter_ipv6/ip6t_opts.h b/include/linux/netfilter_ipv6/ip6t_opts.h index 62d89bcd9f9c..17d419a811fd 100644 --- a/include/linux/netfilter_ipv6/ip6t_opts.h +++ b/include/linux/netfilter_ipv6/ip6t_opts.h | |||
| @@ -1,14 +1,16 @@ | |||
| 1 | #ifndef _IP6T_OPTS_H | 1 | #ifndef _IP6T_OPTS_H |
| 2 | #define _IP6T_OPTS_H | 2 | #define _IP6T_OPTS_H |
| 3 | 3 | ||
| 4 | #include <linux/types.h> | ||
| 5 | |||
| 4 | #define IP6T_OPTS_OPTSNR 16 | 6 | #define IP6T_OPTS_OPTSNR 16 |
| 5 | 7 | ||
| 6 | struct ip6t_opts { | 8 | struct ip6t_opts { |
| 7 | u_int32_t hdrlen; /* Header Length */ | 9 | __u32 hdrlen; /* Header Length */ |
| 8 | u_int8_t flags; /* */ | 10 | __u8 flags; /* */ |
| 9 | u_int8_t invflags; /* Inverse flags */ | 11 | __u8 invflags; /* Inverse flags */ |
| 10 | u_int16_t opts[IP6T_OPTS_OPTSNR]; /* opts */ | 12 | __u16 opts[IP6T_OPTS_OPTSNR]; /* opts */ |
| 11 | u_int8_t optsnr; /* Nr of OPts */ | 13 | __u8 optsnr; /* Nr of OPts */ |
| 12 | }; | 14 | }; |
| 13 | 15 | ||
| 14 | #define IP6T_OPTS_LEN 0x01 | 16 | #define IP6T_OPTS_LEN 0x01 |
diff --git a/include/linux/netfilter_ipv6/ip6t_rt.h b/include/linux/netfilter_ipv6/ip6t_rt.h index ab91bfd2cd00..7605a5ff81cd 100644 --- a/include/linux/netfilter_ipv6/ip6t_rt.h +++ b/include/linux/netfilter_ipv6/ip6t_rt.h | |||
| @@ -1,18 +1,19 @@ | |||
| 1 | #ifndef _IP6T_RT_H | 1 | #ifndef _IP6T_RT_H |
| 2 | #define _IP6T_RT_H | 2 | #define _IP6T_RT_H |
| 3 | 3 | ||
| 4 | #include <linux/types.h> | ||
| 4 | /*#include <linux/in6.h>*/ | 5 | /*#include <linux/in6.h>*/ |
| 5 | 6 | ||
| 6 | #define IP6T_RT_HOPS 16 | 7 | #define IP6T_RT_HOPS 16 |
| 7 | 8 | ||
| 8 | struct ip6t_rt { | 9 | struct ip6t_rt { |
| 9 | u_int32_t rt_type; /* Routing Type */ | 10 | __u32 rt_type; /* Routing Type */ |
| 10 | u_int32_t segsleft[2]; /* Segments Left */ | 11 | __u32 segsleft[2]; /* Segments Left */ |
| 11 | u_int32_t hdrlen; /* Header Length */ | 12 | __u32 hdrlen; /* Header Length */ |
| 12 | u_int8_t flags; /* */ | 13 | __u8 flags; /* */ |
| 13 | u_int8_t invflags; /* Inverse flags */ | 14 | __u8 invflags; /* Inverse flags */ |
| 14 | struct in6_addr addrs[IP6T_RT_HOPS]; /* Hops */ | 15 | struct in6_addr addrs[IP6T_RT_HOPS]; /* Hops */ |
| 15 | u_int8_t addrnr; /* Nr of Addresses */ | 16 | __u8 addrnr; /* Nr of Addresses */ |
| 16 | }; | 17 | }; |
| 17 | 18 | ||
| 18 | #define IP6T_RT_TYP 0x01 | 19 | #define IP6T_RT_TYP 0x01 |
diff --git a/include/linux/netlink.h b/include/linux/netlink.h index e2b9e63afa68..4c4ac3f3ce5a 100644 --- a/include/linux/netlink.h +++ b/include/linux/netlink.h | |||
| @@ -160,10 +160,6 @@ struct netlink_skb_parms { | |||
| 160 | struct ucred creds; /* Skb credentials */ | 160 | struct ucred creds; /* Skb credentials */ |
| 161 | __u32 pid; | 161 | __u32 pid; |
| 162 | __u32 dst_group; | 162 | __u32 dst_group; |
| 163 | kernel_cap_t eff_cap; | ||
| 164 | __u32 loginuid; /* Login (audit) uid */ | ||
| 165 | __u32 sessionid; /* Session id (audit) */ | ||
| 166 | __u32 sid; /* SELinux security id */ | ||
| 167 | }; | 163 | }; |
| 168 | 164 | ||
| 169 | #define NETLINK_CB(skb) (*(struct netlink_skb_parms*)&((skb)->cb)) | 165 | #define NETLINK_CB(skb) (*(struct netlink_skb_parms*)&((skb)->cb)) |
diff --git a/include/linux/nfs_fs_sb.h b/include/linux/nfs_fs_sb.h index b197563913bf..3e112de12d8d 100644 --- a/include/linux/nfs_fs_sb.h +++ b/include/linux/nfs_fs_sb.h | |||
| @@ -68,11 +68,7 @@ struct nfs_client { | |||
| 68 | unsigned char cl_id_uniquifier; | 68 | unsigned char cl_id_uniquifier; |
| 69 | u32 cl_cb_ident; /* v4.0 callback identifier */ | 69 | u32 cl_cb_ident; /* v4.0 callback identifier */ |
| 70 | const struct nfs4_minor_version_ops *cl_mvops; | 70 | const struct nfs4_minor_version_ops *cl_mvops; |
| 71 | #endif /* CONFIG_NFS_V4 */ | ||
| 72 | 71 | ||
| 73 | #ifdef CONFIG_NFS_V4_1 | ||
| 74 | /* clientid returned from EXCHANGE_ID, used by session operations */ | ||
| 75 | u64 cl_ex_clid; | ||
| 76 | /* The sequence id to use for the next CREATE_SESSION */ | 72 | /* The sequence id to use for the next CREATE_SESSION */ |
| 77 | u32 cl_seqid; | 73 | u32 cl_seqid; |
| 78 | /* The flags used for obtaining the clientid during EXCHANGE_ID */ | 74 | /* The flags used for obtaining the clientid during EXCHANGE_ID */ |
| @@ -80,7 +76,7 @@ struct nfs_client { | |||
| 80 | struct nfs4_session *cl_session; /* sharred session */ | 76 | struct nfs4_session *cl_session; /* sharred session */ |
| 81 | struct list_head cl_layouts; | 77 | struct list_head cl_layouts; |
| 82 | struct pnfs_deviceid_cache *cl_devid_cache; /* pNFS deviceid cache */ | 78 | struct pnfs_deviceid_cache *cl_devid_cache; /* pNFS deviceid cache */ |
| 83 | #endif /* CONFIG_NFS_V4_1 */ | 79 | #endif /* CONFIG_NFS_V4 */ |
| 84 | 80 | ||
| 85 | #ifdef CONFIG_NFS_FSCACHE | 81 | #ifdef CONFIG_NFS_FSCACHE |
| 86 | struct fscache_cookie *fscache; /* client index cache cookie */ | 82 | struct fscache_cookie *fscache; /* client index cache cookie */ |
| @@ -185,7 +181,7 @@ struct nfs_server { | |||
| 185 | /* maximum number of slots to use */ | 181 | /* maximum number of slots to use */ |
| 186 | #define NFS4_MAX_SLOT_TABLE RPC_MAX_SLOT_TABLE | 182 | #define NFS4_MAX_SLOT_TABLE RPC_MAX_SLOT_TABLE |
| 187 | 183 | ||
| 188 | #if defined(CONFIG_NFS_V4_1) | 184 | #if defined(CONFIG_NFS_V4) |
| 189 | 185 | ||
| 190 | /* Sessions */ | 186 | /* Sessions */ |
| 191 | #define SLOT_TABLE_SZ (NFS4_MAX_SLOT_TABLE/(8*sizeof(long))) | 187 | #define SLOT_TABLE_SZ (NFS4_MAX_SLOT_TABLE/(8*sizeof(long))) |
| @@ -225,5 +221,5 @@ struct nfs4_session { | |||
| 225 | struct nfs_client *clp; | 221 | struct nfs_client *clp; |
| 226 | }; | 222 | }; |
| 227 | 223 | ||
| 228 | #endif /* CONFIG_NFS_V4_1 */ | 224 | #endif /* CONFIG_NFS_V4 */ |
| 229 | #endif | 225 | #endif |
diff --git a/include/linux/nl80211.h b/include/linux/nl80211.h index 821ffb954f14..30022189104d 100644 --- a/include/linux/nl80211.h +++ b/include/linux/nl80211.h | |||
| @@ -1243,6 +1243,8 @@ enum nl80211_rate_info { | |||
| 1243 | * @NL80211_STA_INFO_LLID: the station's mesh LLID | 1243 | * @NL80211_STA_INFO_LLID: the station's mesh LLID |
| 1244 | * @NL80211_STA_INFO_PLID: the station's mesh PLID | 1244 | * @NL80211_STA_INFO_PLID: the station's mesh PLID |
| 1245 | * @NL80211_STA_INFO_PLINK_STATE: peer link state for the station | 1245 | * @NL80211_STA_INFO_PLINK_STATE: peer link state for the station |
| 1246 | * @NL80211_STA_INFO_RX_BITRATE: last unicast data frame rx rate, nested | ||
| 1247 | * attribute, like NL80211_STA_INFO_TX_BITRATE. | ||
| 1246 | * @__NL80211_STA_INFO_AFTER_LAST: internal | 1248 | * @__NL80211_STA_INFO_AFTER_LAST: internal |
| 1247 | * @NL80211_STA_INFO_MAX: highest possible station info attribute | 1249 | * @NL80211_STA_INFO_MAX: highest possible station info attribute |
| 1248 | */ | 1250 | */ |
| @@ -1261,6 +1263,7 @@ enum nl80211_sta_info { | |||
| 1261 | NL80211_STA_INFO_TX_RETRIES, | 1263 | NL80211_STA_INFO_TX_RETRIES, |
| 1262 | NL80211_STA_INFO_TX_FAILED, | 1264 | NL80211_STA_INFO_TX_FAILED, |
| 1263 | NL80211_STA_INFO_SIGNAL_AVG, | 1265 | NL80211_STA_INFO_SIGNAL_AVG, |
| 1266 | NL80211_STA_INFO_RX_BITRATE, | ||
| 1264 | 1267 | ||
| 1265 | /* keep last */ | 1268 | /* keep last */ |
| 1266 | __NL80211_STA_INFO_AFTER_LAST, | 1269 | __NL80211_STA_INFO_AFTER_LAST, |
diff --git a/include/linux/node.h b/include/linux/node.h index 1466945cc9ef..92370e22343c 100644 --- a/include/linux/node.h +++ b/include/linux/node.h | |||
| @@ -39,7 +39,8 @@ extern int register_cpu_under_node(unsigned int cpu, unsigned int nid); | |||
| 39 | extern int unregister_cpu_under_node(unsigned int cpu, unsigned int nid); | 39 | extern int unregister_cpu_under_node(unsigned int cpu, unsigned int nid); |
| 40 | extern int register_mem_sect_under_node(struct memory_block *mem_blk, | 40 | extern int register_mem_sect_under_node(struct memory_block *mem_blk, |
| 41 | int nid); | 41 | int nid); |
| 42 | extern int unregister_mem_sect_under_nodes(struct memory_block *mem_blk); | 42 | extern int unregister_mem_sect_under_nodes(struct memory_block *mem_blk, |
| 43 | unsigned long phys_index); | ||
| 43 | 44 | ||
| 44 | #ifdef CONFIG_HUGETLBFS | 45 | #ifdef CONFIG_HUGETLBFS |
| 45 | extern void register_hugetlbfs_with_node(node_registration_func_t doregister, | 46 | extern void register_hugetlbfs_with_node(node_registration_func_t doregister, |
| @@ -67,7 +68,8 @@ static inline int register_mem_sect_under_node(struct memory_block *mem_blk, | |||
| 67 | { | 68 | { |
| 68 | return 0; | 69 | return 0; |
| 69 | } | 70 | } |
| 70 | static inline int unregister_mem_sect_under_nodes(struct memory_block *mem_blk) | 71 | static inline int unregister_mem_sect_under_nodes(struct memory_block *mem_blk, |
| 72 | unsigned long phys_index) | ||
| 71 | { | 73 | { |
| 72 | return 0; | 74 | return 0; |
| 73 | } | 75 | } |
diff --git a/include/linux/of.h b/include/linux/of.h index cad7cf0ab278..bfc0ed1b0ced 100644 --- a/include/linux/of.h +++ b/include/linux/of.h | |||
| @@ -23,8 +23,6 @@ | |||
| 23 | 23 | ||
| 24 | #include <asm/byteorder.h> | 24 | #include <asm/byteorder.h> |
| 25 | 25 | ||
| 26 | #ifdef CONFIG_OF | ||
| 27 | |||
| 28 | typedef u32 phandle; | 26 | typedef u32 phandle; |
| 29 | typedef u32 ihandle; | 27 | typedef u32 ihandle; |
| 30 | 28 | ||
| @@ -65,11 +63,18 @@ struct device_node { | |||
| 65 | #endif | 63 | #endif |
| 66 | }; | 64 | }; |
| 67 | 65 | ||
| 66 | #ifdef CONFIG_OF | ||
| 67 | |||
| 68 | /* Pointer for first entry in chain of all nodes. */ | 68 | /* Pointer for first entry in chain of all nodes. */ |
| 69 | extern struct device_node *allnodes; | 69 | extern struct device_node *allnodes; |
| 70 | extern struct device_node *of_chosen; | 70 | extern struct device_node *of_chosen; |
| 71 | extern rwlock_t devtree_lock; | 71 | extern rwlock_t devtree_lock; |
| 72 | 72 | ||
| 73 | static inline bool of_have_populated_dt(void) | ||
| 74 | { | ||
| 75 | return allnodes != NULL; | ||
| 76 | } | ||
| 77 | |||
| 73 | static inline bool of_node_is_root(const struct device_node *node) | 78 | static inline bool of_node_is_root(const struct device_node *node) |
| 74 | { | 79 | { |
| 75 | return node && (node->parent == NULL); | 80 | return node && (node->parent == NULL); |
| @@ -103,7 +108,7 @@ extern void of_node_put(struct device_node *node); | |||
| 103 | #endif | 108 | #endif |
| 104 | 109 | ||
| 105 | /* | 110 | /* |
| 106 | * OF address retreival & translation | 111 | * OF address retrieval & translation |
| 107 | */ | 112 | */ |
| 108 | 113 | ||
| 109 | /* Helper to read a big number; size is in cells (not bytes) */ | 114 | /* Helper to read a big number; size is in cells (not bytes) */ |
| @@ -222,5 +227,12 @@ extern void of_attach_node(struct device_node *); | |||
| 222 | extern void of_detach_node(struct device_node *); | 227 | extern void of_detach_node(struct device_node *); |
| 223 | #endif | 228 | #endif |
| 224 | 229 | ||
| 230 | #else | ||
| 231 | |||
| 232 | static inline bool of_have_populated_dt(void) | ||
| 233 | { | ||
| 234 | return false; | ||
| 235 | } | ||
| 236 | |||
| 225 | #endif /* CONFIG_OF */ | 237 | #endif /* CONFIG_OF */ |
| 226 | #endif /* _LINUX_OF_H */ | 238 | #endif /* _LINUX_OF_H */ |
diff --git a/include/linux/of_device.h b/include/linux/of_device.h index 975d347079d9..8bfe6c1d4365 100644 --- a/include/linux/of_device.h +++ b/include/linux/of_device.h | |||
| @@ -18,10 +18,11 @@ extern void of_device_make_bus_id(struct device *dev); | |||
| 18 | * @drv: the device_driver structure to test | 18 | * @drv: the device_driver structure to test |
| 19 | * @dev: the device structure to match against | 19 | * @dev: the device structure to match against |
| 20 | */ | 20 | */ |
| 21 | static inline int of_driver_match_device(const struct device *dev, | 21 | static inline int of_driver_match_device(struct device *dev, |
| 22 | const struct device_driver *drv) | 22 | const struct device_driver *drv) |
| 23 | { | 23 | { |
| 24 | return of_match_device(drv->of_match_table, dev) != NULL; | 24 | dev->of_match = of_match_device(drv->of_match_table, dev); |
| 25 | return dev->of_match != NULL; | ||
| 25 | } | 26 | } |
| 26 | 27 | ||
| 27 | extern struct platform_device *of_dev_get(struct platform_device *dev); | 28 | extern struct platform_device *of_dev_get(struct platform_device *dev); |
diff --git a/include/linux/of_pci.h b/include/linux/of_pci.h new file mode 100644 index 000000000000..85a27b650d76 --- /dev/null +++ b/include/linux/of_pci.h | |||
| @@ -0,0 +1,9 @@ | |||
| 1 | #ifndef __OF_PCI_H | ||
| 2 | #define __OF_PCI_H | ||
| 3 | |||
| 4 | #include <linux/pci.h> | ||
| 5 | |||
| 6 | struct pci_dev; | ||
| 7 | struct of_irq; | ||
| 8 | int of_irq_map_pci(struct pci_dev *pdev, struct of_irq *out_irq); | ||
| 9 | #endif | ||
diff --git a/include/linux/of_platform.h b/include/linux/of_platform.h index a68716ad38ce..17c7e21c0bd7 100644 --- a/include/linux/of_platform.h +++ b/include/linux/of_platform.h | |||
| @@ -23,13 +23,7 @@ | |||
| 23 | * of_platform_driver - Legacy of-aware driver for platform devices. | 23 | * of_platform_driver - Legacy of-aware driver for platform devices. |
| 24 | * | 24 | * |
| 25 | * An of_platform_driver driver is attached to a basic platform_device on | 25 | * An of_platform_driver driver is attached to a basic platform_device on |
| 26 | * ether the "platform bus" (platform_bus_type), or the ibm ebus | 26 | * the ibm ebus (ibmebus_bus_type). |
| 27 | * (ibmebus_bus_type). | ||
| 28 | * | ||
| 29 | * of_platform_driver is being phased out when used with the platform_bus_type, | ||
| 30 | * and regular platform_drivers should be used instead. When the transition | ||
| 31 | * is complete, only ibmebus will be using this structure, and the | ||
| 32 | * platform_driver member of this structure will be removed. | ||
| 33 | */ | 27 | */ |
| 34 | struct of_platform_driver | 28 | struct of_platform_driver |
| 35 | { | 29 | { |
| @@ -42,26 +36,16 @@ struct of_platform_driver | |||
| 42 | int (*shutdown)(struct platform_device* dev); | 36 | int (*shutdown)(struct platform_device* dev); |
| 43 | 37 | ||
| 44 | struct device_driver driver; | 38 | struct device_driver driver; |
| 45 | struct platform_driver platform_driver; | ||
| 46 | }; | 39 | }; |
| 47 | #define to_of_platform_driver(drv) \ | 40 | #define to_of_platform_driver(drv) \ |
| 48 | container_of(drv,struct of_platform_driver, driver) | 41 | container_of(drv,struct of_platform_driver, driver) |
| 49 | 42 | ||
| 50 | extern int of_register_driver(struct of_platform_driver *drv, | ||
| 51 | struct bus_type *bus); | ||
| 52 | extern void of_unregister_driver(struct of_platform_driver *drv); | ||
| 53 | |||
| 54 | /* Platform drivers register/unregister */ | 43 | /* Platform drivers register/unregister */ |
| 55 | extern int of_register_platform_driver(struct of_platform_driver *drv); | ||
| 56 | extern void of_unregister_platform_driver(struct of_platform_driver *drv); | ||
| 57 | |||
| 58 | extern struct platform_device *of_device_alloc(struct device_node *np, | 44 | extern struct platform_device *of_device_alloc(struct device_node *np, |
| 59 | const char *bus_id, | 45 | const char *bus_id, |
| 60 | struct device *parent); | 46 | struct device *parent); |
| 61 | extern struct platform_device *of_find_device_by_node(struct device_node *np); | 47 | extern struct platform_device *of_find_device_by_node(struct device_node *np); |
| 62 | 48 | ||
| 63 | extern int of_bus_type_init(struct bus_type *bus, const char *name); | ||
| 64 | |||
| 65 | #if !defined(CONFIG_SPARC) /* SPARC has its own device registration method */ | 49 | #if !defined(CONFIG_SPARC) /* SPARC has its own device registration method */ |
| 66 | /* Platform devices and busses creation */ | 50 | /* Platform devices and busses creation */ |
| 67 | extern struct platform_device *of_platform_device_create(struct device_node *np, | 51 | extern struct platform_device *of_platform_device_create(struct device_node *np, |
diff --git a/include/linux/oprofile.h b/include/linux/oprofile.h index 32fb81212fd1..1ca64113efe8 100644 --- a/include/linux/oprofile.h +++ b/include/linux/oprofile.h | |||
| @@ -16,6 +16,8 @@ | |||
| 16 | #include <linux/types.h> | 16 | #include <linux/types.h> |
| 17 | #include <linux/spinlock.h> | 17 | #include <linux/spinlock.h> |
| 18 | #include <linux/init.h> | 18 | #include <linux/init.h> |
| 19 | #include <linux/errno.h> | ||
| 20 | #include <linux/printk.h> | ||
| 19 | #include <asm/atomic.h> | 21 | #include <asm/atomic.h> |
| 20 | 22 | ||
| 21 | /* Each escaped entry is prefixed by ESCAPE_CODE | 23 | /* Each escaped entry is prefixed by ESCAPE_CODE |
| @@ -186,10 +188,17 @@ int oprofile_add_data(struct op_entry *entry, unsigned long val); | |||
| 186 | int oprofile_add_data64(struct op_entry *entry, u64 val); | 188 | int oprofile_add_data64(struct op_entry *entry, u64 val); |
| 187 | int oprofile_write_commit(struct op_entry *entry); | 189 | int oprofile_write_commit(struct op_entry *entry); |
| 188 | 190 | ||
| 189 | #ifdef CONFIG_PERF_EVENTS | 191 | #ifdef CONFIG_HW_PERF_EVENTS |
| 190 | int __init oprofile_perf_init(struct oprofile_operations *ops); | 192 | int __init oprofile_perf_init(struct oprofile_operations *ops); |
| 191 | void oprofile_perf_exit(void); | 193 | void oprofile_perf_exit(void); |
| 192 | char *op_name_from_perf_id(void); | 194 | char *op_name_from_perf_id(void); |
| 193 | #endif /* CONFIG_PERF_EVENTS */ | 195 | #else |
| 196 | static inline int __init oprofile_perf_init(struct oprofile_operations *ops) | ||
| 197 | { | ||
| 198 | pr_info("oprofile: hardware counters not available\n"); | ||
| 199 | return -ENODEV; | ||
| 200 | } | ||
| 201 | static inline void oprofile_perf_exit(void) { } | ||
| 202 | #endif /* CONFIG_HW_PERF_EVENTS */ | ||
| 194 | 203 | ||
| 195 | #endif /* OPROFILE_H */ | 204 | #endif /* OPROFILE_H */ |
diff --git a/include/linux/pata_arasan_cf_data.h b/include/linux/pata_arasan_cf_data.h new file mode 100644 index 000000000000..a6ee9aa898bb --- /dev/null +++ b/include/linux/pata_arasan_cf_data.h | |||
| @@ -0,0 +1,49 @@ | |||
| 1 | /* | ||
| 2 | * include/linux/pata_arasan_cf_data.h | ||
| 3 | * | ||
| 4 | * Arasan Compact Flash host controller platform data header file | ||
| 5 | * | ||
| 6 | * Copyright (C) 2011 ST Microelectronics | ||
| 7 | * Viresh Kumar <viresh.kumar@st.com> | ||
| 8 | * | ||
| 9 | * This file is licensed under the terms of the GNU General Public | ||
| 10 | * License version 2. This program is licensed "as is" without any | ||
| 11 | * warranty of any kind, whether express or implied. | ||
| 12 | */ | ||
| 13 | |||
| 14 | #ifndef _PATA_ARASAN_CF_DATA_H | ||
| 15 | #define _PATA_ARASAN_CF_DATA_H | ||
| 16 | |||
| 17 | #include <linux/platform_device.h> | ||
| 18 | |||
| 19 | struct arasan_cf_pdata { | ||
| 20 | u8 cf_if_clk; | ||
| 21 | #define CF_IF_CLK_100M (0x0) | ||
| 22 | #define CF_IF_CLK_75M (0x1) | ||
| 23 | #define CF_IF_CLK_66M (0x2) | ||
| 24 | #define CF_IF_CLK_50M (0x3) | ||
| 25 | #define CF_IF_CLK_40M (0x4) | ||
| 26 | #define CF_IF_CLK_33M (0x5) | ||
| 27 | #define CF_IF_CLK_25M (0x6) | ||
| 28 | #define CF_IF_CLK_125M (0x7) | ||
| 29 | #define CF_IF_CLK_150M (0x8) | ||
| 30 | #define CF_IF_CLK_166M (0x9) | ||
| 31 | #define CF_IF_CLK_200M (0xA) | ||
| 32 | /* | ||
| 33 | * Platform specific incapabilities of CF controller is handled via | ||
| 34 | * quirks | ||
| 35 | */ | ||
| 36 | u32 quirk; | ||
| 37 | #define CF_BROKEN_PIO (1) | ||
| 38 | #define CF_BROKEN_MWDMA (1 << 1) | ||
| 39 | #define CF_BROKEN_UDMA (1 << 2) | ||
| 40 | /* This is platform specific data for the DMA controller */ | ||
| 41 | void *dma_priv; | ||
| 42 | }; | ||
| 43 | |||
| 44 | static inline void | ||
| 45 | set_arasan_cf_pdata(struct platform_device *pdev, struct arasan_cf_pdata *data) | ||
| 46 | { | ||
| 47 | pdev->dev.platform_data = data; | ||
| 48 | } | ||
| 49 | #endif /* _PATA_ARASAN_CF_DATA_H */ | ||
diff --git a/include/linux/pci.h b/include/linux/pci.h index 559d02897075..ff5bccb87136 100644 --- a/include/linux/pci.h +++ b/include/linux/pci.h | |||
| @@ -1479,6 +1479,7 @@ void pci_request_acs(void); | |||
| 1479 | #define PCI_VPD_RO_KEYWORD_PARTNO "PN" | 1479 | #define PCI_VPD_RO_KEYWORD_PARTNO "PN" |
| 1480 | #define PCI_VPD_RO_KEYWORD_MFR_ID "MN" | 1480 | #define PCI_VPD_RO_KEYWORD_MFR_ID "MN" |
| 1481 | #define PCI_VPD_RO_KEYWORD_VENDOR0 "V0" | 1481 | #define PCI_VPD_RO_KEYWORD_VENDOR0 "V0" |
| 1482 | #define PCI_VPD_RO_KEYWORD_CHKSUM "RV" | ||
| 1482 | 1483 | ||
| 1483 | /** | 1484 | /** |
| 1484 | * pci_vpd_lrdt_size - Extracts the Large Resource Data Type length | 1485 | * pci_vpd_lrdt_size - Extracts the Large Resource Data Type length |
diff --git a/include/linux/pci_ids.h b/include/linux/pci_ids.h index 3adb06ebf841..580de67f318b 100644 --- a/include/linux/pci_ids.h +++ b/include/linux/pci_ids.h | |||
| @@ -518,6 +518,7 @@ | |||
| 518 | #define PCI_DEVICE_ID_AMD_11H_NB_MISC 0x1303 | 518 | #define PCI_DEVICE_ID_AMD_11H_NB_MISC 0x1303 |
| 519 | #define PCI_DEVICE_ID_AMD_11H_NB_LINK 0x1304 | 519 | #define PCI_DEVICE_ID_AMD_11H_NB_LINK 0x1304 |
| 520 | #define PCI_DEVICE_ID_AMD_15H_NB_MISC 0x1603 | 520 | #define PCI_DEVICE_ID_AMD_15H_NB_MISC 0x1603 |
| 521 | #define PCI_DEVICE_ID_AMD_15H_NB_LINK 0x1604 | ||
| 521 | #define PCI_DEVICE_ID_AMD_CNB17H_F3 0x1703 | 522 | #define PCI_DEVICE_ID_AMD_CNB17H_F3 0x1703 |
| 522 | #define PCI_DEVICE_ID_AMD_LANCE 0x2000 | 523 | #define PCI_DEVICE_ID_AMD_LANCE 0x2000 |
| 523 | #define PCI_DEVICE_ID_AMD_LANCE_HOME 0x2001 | 524 | #define PCI_DEVICE_ID_AMD_LANCE_HOME 0x2001 |
diff --git a/include/linux/percpu.h b/include/linux/percpu.h index 27c3c6fcfad3..3a5c4449fd36 100644 --- a/include/linux/percpu.h +++ b/include/linux/percpu.h | |||
| @@ -255,6 +255,30 @@ extern void __bad_size_call_parameter(void); | |||
| 255 | pscr2_ret__; \ | 255 | pscr2_ret__; \ |
| 256 | }) | 256 | }) |
| 257 | 257 | ||
| 258 | /* | ||
| 259 | * Special handling for cmpxchg_double. cmpxchg_double is passed two | ||
| 260 | * percpu variables. The first has to be aligned to a double word | ||
| 261 | * boundary and the second has to follow directly thereafter. | ||
| 262 | */ | ||
| 263 | #define __pcpu_double_call_return_bool(stem, pcp1, pcp2, ...) \ | ||
| 264 | ({ \ | ||
| 265 | bool pdcrb_ret__; \ | ||
| 266 | __verify_pcpu_ptr(&pcp1); \ | ||
| 267 | BUILD_BUG_ON(sizeof(pcp1) != sizeof(pcp2)); \ | ||
| 268 | VM_BUG_ON((unsigned long)(&pcp1) % (2 * sizeof(pcp1))); \ | ||
| 269 | VM_BUG_ON((unsigned long)(&pcp2) != \ | ||
| 270 | (unsigned long)(&pcp1) + sizeof(pcp1)); \ | ||
| 271 | switch(sizeof(pcp1)) { \ | ||
| 272 | case 1: pdcrb_ret__ = stem##1(pcp1, pcp2, __VA_ARGS__); break; \ | ||
| 273 | case 2: pdcrb_ret__ = stem##2(pcp1, pcp2, __VA_ARGS__); break; \ | ||
| 274 | case 4: pdcrb_ret__ = stem##4(pcp1, pcp2, __VA_ARGS__); break; \ | ||
| 275 | case 8: pdcrb_ret__ = stem##8(pcp1, pcp2, __VA_ARGS__); break; \ | ||
| 276 | default: \ | ||
| 277 | __bad_size_call_parameter(); break; \ | ||
| 278 | } \ | ||
| 279 | pdcrb_ret__; \ | ||
| 280 | }) | ||
| 281 | |||
| 258 | #define __pcpu_size_call(stem, variable, ...) \ | 282 | #define __pcpu_size_call(stem, variable, ...) \ |
| 259 | do { \ | 283 | do { \ |
| 260 | __verify_pcpu_ptr(&(variable)); \ | 284 | __verify_pcpu_ptr(&(variable)); \ |
| @@ -501,6 +525,45 @@ do { \ | |||
| 501 | #endif | 525 | #endif |
| 502 | 526 | ||
| 503 | /* | 527 | /* |
| 528 | * cmpxchg_double replaces two adjacent scalars at once. The first | ||
| 529 | * two parameters are per cpu variables which have to be of the same | ||
| 530 | * size. A truth value is returned to indicate success or failure | ||
| 531 | * (since a double register result is difficult to handle). There is | ||
| 532 | * very limited hardware support for these operations, so only certain | ||
| 533 | * sizes may work. | ||
| 534 | */ | ||
| 535 | #define _this_cpu_generic_cmpxchg_double(pcp1, pcp2, oval1, oval2, nval1, nval2) \ | ||
| 536 | ({ \ | ||
| 537 | int ret__; \ | ||
| 538 | preempt_disable(); \ | ||
| 539 | ret__ = __this_cpu_generic_cmpxchg_double(pcp1, pcp2, \ | ||
| 540 | oval1, oval2, nval1, nval2); \ | ||
| 541 | preempt_enable(); \ | ||
| 542 | ret__; \ | ||
| 543 | }) | ||
| 544 | |||
| 545 | #ifndef this_cpu_cmpxchg_double | ||
| 546 | # ifndef this_cpu_cmpxchg_double_1 | ||
| 547 | # define this_cpu_cmpxchg_double_1(pcp1, pcp2, oval1, oval2, nval1, nval2) \ | ||
| 548 | _this_cpu_generic_cmpxchg_double(pcp1, pcp2, oval1, oval2, nval1, nval2) | ||
| 549 | # endif | ||
| 550 | # ifndef this_cpu_cmpxchg_double_2 | ||
| 551 | # define this_cpu_cmpxchg_double_2(pcp1, pcp2, oval1, oval2, nval1, nval2) \ | ||
| 552 | _this_cpu_generic_cmpxchg_double(pcp1, pcp2, oval1, oval2, nval1, nval2) | ||
| 553 | # endif | ||
| 554 | # ifndef this_cpu_cmpxchg_double_4 | ||
| 555 | # define this_cpu_cmpxchg_double_4(pcp1, pcp2, oval1, oval2, nval1, nval2) \ | ||
| 556 | _this_cpu_generic_cmpxchg_double(pcp1, pcp2, oval1, oval2, nval1, nval2) | ||
| 557 | # endif | ||
| 558 | # ifndef this_cpu_cmpxchg_double_8 | ||
| 559 | # define this_cpu_cmpxchg_double_8(pcp1, pcp2, oval1, oval2, nval1, nval2) \ | ||
| 560 | _this_cpu_generic_cmpxchg_double(pcp1, pcp2, oval1, oval2, nval1, nval2) | ||
| 561 | # endif | ||
| 562 | # define this_cpu_cmpxchg_double(pcp1, pcp2, oval1, oval2, nval1, nval2) \ | ||
| 563 | __pcpu_double_call_return_bool(this_cpu_cmpxchg_double_, (pcp1), (pcp2), (oval1), (oval2), (nval1), (nval2)) | ||
| 564 | #endif | ||
| 565 | |||
| 566 | /* | ||
| 504 | * Generic percpu operations that do not require preemption handling. | 567 | * Generic percpu operations that do not require preemption handling. |
| 505 | * Either we do not care about races or the caller has the | 568 | * Either we do not care about races or the caller has the |
| 506 | * responsibility of handling preemptions issues. Arch code can still | 569 | * responsibility of handling preemptions issues. Arch code can still |
| @@ -703,6 +766,39 @@ do { \ | |||
| 703 | __pcpu_size_call_return2(__this_cpu_cmpxchg_, pcp, oval, nval) | 766 | __pcpu_size_call_return2(__this_cpu_cmpxchg_, pcp, oval, nval) |
| 704 | #endif | 767 | #endif |
| 705 | 768 | ||
| 769 | #define __this_cpu_generic_cmpxchg_double(pcp1, pcp2, oval1, oval2, nval1, nval2) \ | ||
| 770 | ({ \ | ||
| 771 | int __ret = 0; \ | ||
| 772 | if (__this_cpu_read(pcp1) == (oval1) && \ | ||
| 773 | __this_cpu_read(pcp2) == (oval2)) { \ | ||
| 774 | __this_cpu_write(pcp1, (nval1)); \ | ||
| 775 | __this_cpu_write(pcp2, (nval2)); \ | ||
| 776 | __ret = 1; \ | ||
| 777 | } \ | ||
| 778 | (__ret); \ | ||
| 779 | }) | ||
| 780 | |||
| 781 | #ifndef __this_cpu_cmpxchg_double | ||
| 782 | # ifndef __this_cpu_cmpxchg_double_1 | ||
| 783 | # define __this_cpu_cmpxchg_double_1(pcp1, pcp2, oval1, oval2, nval1, nval2) \ | ||
| 784 | __this_cpu_generic_cmpxchg_double(pcp1, pcp2, oval1, oval2, nval1, nval2) | ||
| 785 | # endif | ||
| 786 | # ifndef __this_cpu_cmpxchg_double_2 | ||
| 787 | # define __this_cpu_cmpxchg_double_2(pcp1, pcp2, oval1, oval2, nval1, nval2) \ | ||
| 788 | __this_cpu_generic_cmpxchg_double(pcp1, pcp2, oval1, oval2, nval1, nval2) | ||
| 789 | # endif | ||
| 790 | # ifndef __this_cpu_cmpxchg_double_4 | ||
| 791 | # define __this_cpu_cmpxchg_double_4(pcp1, pcp2, oval1, oval2, nval1, nval2) \ | ||
| 792 | __this_cpu_generic_cmpxchg_double(pcp1, pcp2, oval1, oval2, nval1, nval2) | ||
| 793 | # endif | ||
| 794 | # ifndef __this_cpu_cmpxchg_double_8 | ||
| 795 | # define __this_cpu_cmpxchg_double_8(pcp1, pcp2, oval1, oval2, nval1, nval2) \ | ||
| 796 | __this_cpu_generic_cmpxchg_double(pcp1, pcp2, oval1, oval2, nval1, nval2) | ||
| 797 | # endif | ||
| 798 | # define __this_cpu_cmpxchg_double(pcp1, pcp2, oval1, oval2, nval1, nval2) \ | ||
| 799 | __pcpu_double_call_return_bool(__this_cpu_cmpxchg_double_, (pcp1), (pcp2), (oval1), (oval2), (nval1), (nval2)) | ||
| 800 | #endif | ||
| 801 | |||
| 706 | /* | 802 | /* |
| 707 | * IRQ safe versions of the per cpu RMW operations. Note that these operations | 803 | * IRQ safe versions of the per cpu RMW operations. Note that these operations |
| 708 | * are *not* safe against modification of the same variable from another | 804 | * are *not* safe against modification of the same variable from another |
| @@ -823,4 +919,36 @@ do { \ | |||
| 823 | __pcpu_size_call_return2(irqsafe_cpu_cmpxchg_, (pcp), oval, nval) | 919 | __pcpu_size_call_return2(irqsafe_cpu_cmpxchg_, (pcp), oval, nval) |
| 824 | #endif | 920 | #endif |
| 825 | 921 | ||
| 922 | #define irqsafe_generic_cpu_cmpxchg_double(pcp1, pcp2, oval1, oval2, nval1, nval2) \ | ||
| 923 | ({ \ | ||
| 924 | int ret__; \ | ||
| 925 | unsigned long flags; \ | ||
| 926 | local_irq_save(flags); \ | ||
| 927 | ret__ = __this_cpu_generic_cmpxchg_double(pcp1, pcp2, \ | ||
| 928 | oval1, oval2, nval1, nval2); \ | ||
| 929 | local_irq_restore(flags); \ | ||
| 930 | ret__; \ | ||
| 931 | }) | ||
| 932 | |||
| 933 | #ifndef irqsafe_cpu_cmpxchg_double | ||
| 934 | # ifndef irqsafe_cpu_cmpxchg_double_1 | ||
| 935 | # define irqsafe_cpu_cmpxchg_double_1(pcp1, pcp2, oval1, oval2, nval1, nval2) \ | ||
| 936 | irqsafe_generic_cpu_cmpxchg_double(pcp1, pcp2, oval1, oval2, nval1, nval2) | ||
| 937 | # endif | ||
| 938 | # ifndef irqsafe_cpu_cmpxchg_double_2 | ||
| 939 | # define irqsafe_cpu_cmpxchg_double_2(pcp1, pcp2, oval1, oval2, nval1, nval2) \ | ||
| 940 | irqsafe_generic_cpu_cmpxchg_double(pcp1, pcp2, oval1, oval2, nval1, nval2) | ||
| 941 | # endif | ||
| 942 | # ifndef irqsafe_cpu_cmpxchg_double_4 | ||
| 943 | # define irqsafe_cpu_cmpxchg_double_4(pcp1, pcp2, oval1, oval2, nval1, nval2) \ | ||
| 944 | irqsafe_generic_cpu_cmpxchg_double(pcp1, pcp2, oval1, oval2, nval1, nval2) | ||
| 945 | # endif | ||
| 946 | # ifndef irqsafe_cpu_cmpxchg_double_8 | ||
| 947 | # define irqsafe_cpu_cmpxchg_double_8(pcp1, pcp2, oval1, oval2, nval1, nval2) \ | ||
| 948 | irqsafe_generic_cpu_cmpxchg_double(pcp1, pcp2, oval1, oval2, nval1, nval2) | ||
| 949 | # endif | ||
| 950 | # define irqsafe_cpu_cmpxchg_double(pcp1, pcp2, oval1, oval2, nval1, nval2) \ | ||
| 951 | __pcpu_double_call_return_int(irqsafe_cpu_cmpxchg_double_, (pcp1), (pcp2), (oval1), (oval2), (nval1), (nval2)) | ||
| 952 | #endif | ||
| 953 | |||
| 826 | #endif /* __LINUX_PERCPU_H */ | 954 | #endif /* __LINUX_PERCPU_H */ |
diff --git a/include/linux/perf_event.h b/include/linux/perf_event.h index dda5b0a3ff60..614615b8d42b 100644 --- a/include/linux/perf_event.h +++ b/include/linux/perf_event.h | |||
| @@ -225,8 +225,14 @@ struct perf_event_attr { | |||
| 225 | }; | 225 | }; |
| 226 | 226 | ||
| 227 | __u32 bp_type; | 227 | __u32 bp_type; |
| 228 | __u64 bp_addr; | 228 | union { |
| 229 | __u64 bp_len; | 229 | __u64 bp_addr; |
| 230 | __u64 config1; /* extension of config */ | ||
| 231 | }; | ||
| 232 | union { | ||
| 233 | __u64 bp_len; | ||
| 234 | __u64 config2; /* extension of config1 */ | ||
| 235 | }; | ||
| 230 | }; | 236 | }; |
| 231 | 237 | ||
| 232 | /* | 238 | /* |
| @@ -464,6 +470,7 @@ enum perf_callchain_context { | |||
| 464 | 470 | ||
| 465 | #define PERF_FLAG_FD_NO_GROUP (1U << 0) | 471 | #define PERF_FLAG_FD_NO_GROUP (1U << 0) |
| 466 | #define PERF_FLAG_FD_OUTPUT (1U << 1) | 472 | #define PERF_FLAG_FD_OUTPUT (1U << 1) |
| 473 | #define PERF_FLAG_PID_CGROUP (1U << 2) /* pid=cgroup id, per-cpu mode only */ | ||
| 467 | 474 | ||
| 468 | #ifdef __KERNEL__ | 475 | #ifdef __KERNEL__ |
| 469 | /* | 476 | /* |
| @@ -471,6 +478,7 @@ enum perf_callchain_context { | |||
| 471 | */ | 478 | */ |
| 472 | 479 | ||
| 473 | #ifdef CONFIG_PERF_EVENTS | 480 | #ifdef CONFIG_PERF_EVENTS |
| 481 | # include <linux/cgroup.h> | ||
| 474 | # include <asm/perf_event.h> | 482 | # include <asm/perf_event.h> |
| 475 | # include <asm/local64.h> | 483 | # include <asm/local64.h> |
| 476 | #endif | 484 | #endif |
| @@ -539,6 +547,9 @@ struct hw_perf_event { | |||
| 539 | unsigned long event_base; | 547 | unsigned long event_base; |
| 540 | int idx; | 548 | int idx; |
| 541 | int last_cpu; | 549 | int last_cpu; |
| 550 | unsigned int extra_reg; | ||
| 551 | u64 extra_config; | ||
| 552 | int extra_alloc; | ||
| 542 | }; | 553 | }; |
| 543 | struct { /* software */ | 554 | struct { /* software */ |
| 544 | struct hrtimer hrtimer; | 555 | struct hrtimer hrtimer; |
| @@ -716,6 +727,22 @@ struct swevent_hlist { | |||
| 716 | #define PERF_ATTACH_GROUP 0x02 | 727 | #define PERF_ATTACH_GROUP 0x02 |
| 717 | #define PERF_ATTACH_TASK 0x04 | 728 | #define PERF_ATTACH_TASK 0x04 |
| 718 | 729 | ||
| 730 | #ifdef CONFIG_CGROUP_PERF | ||
| 731 | /* | ||
| 732 | * perf_cgroup_info keeps track of time_enabled for a cgroup. | ||
| 733 | * This is a per-cpu dynamically allocated data structure. | ||
| 734 | */ | ||
| 735 | struct perf_cgroup_info { | ||
| 736 | u64 time; | ||
| 737 | u64 timestamp; | ||
| 738 | }; | ||
| 739 | |||
| 740 | struct perf_cgroup { | ||
| 741 | struct cgroup_subsys_state css; | ||
| 742 | struct perf_cgroup_info *info; /* timing info, one per cpu */ | ||
| 743 | }; | ||
| 744 | #endif | ||
| 745 | |||
| 719 | /** | 746 | /** |
| 720 | * struct perf_event - performance event kernel representation: | 747 | * struct perf_event - performance event kernel representation: |
| 721 | */ | 748 | */ |
| @@ -832,6 +859,11 @@ struct perf_event { | |||
| 832 | struct event_filter *filter; | 859 | struct event_filter *filter; |
| 833 | #endif | 860 | #endif |
| 834 | 861 | ||
| 862 | #ifdef CONFIG_CGROUP_PERF | ||
| 863 | struct perf_cgroup *cgrp; /* cgroup event is attach to */ | ||
| 864 | int cgrp_defer_enabled; | ||
| 865 | #endif | ||
| 866 | |||
| 835 | #endif /* CONFIG_PERF_EVENTS */ | 867 | #endif /* CONFIG_PERF_EVENTS */ |
| 836 | }; | 868 | }; |
| 837 | 869 | ||
| @@ -886,6 +918,7 @@ struct perf_event_context { | |||
| 886 | u64 generation; | 918 | u64 generation; |
| 887 | int pin_count; | 919 | int pin_count; |
| 888 | struct rcu_head rcu_head; | 920 | struct rcu_head rcu_head; |
| 921 | int nr_cgroups; /* cgroup events present */ | ||
| 889 | }; | 922 | }; |
| 890 | 923 | ||
| 891 | /* | 924 | /* |
| @@ -905,6 +938,9 @@ struct perf_cpu_context { | |||
| 905 | struct list_head rotation_list; | 938 | struct list_head rotation_list; |
| 906 | int jiffies_interval; | 939 | int jiffies_interval; |
| 907 | struct pmu *active_pmu; | 940 | struct pmu *active_pmu; |
| 941 | #ifdef CONFIG_CGROUP_PERF | ||
| 942 | struct perf_cgroup *cgrp; | ||
| 943 | #endif | ||
| 908 | }; | 944 | }; |
| 909 | 945 | ||
| 910 | struct perf_output_handle { | 946 | struct perf_output_handle { |
| @@ -1040,11 +1076,11 @@ have_event: | |||
| 1040 | __perf_sw_event(event_id, nr, nmi, regs, addr); | 1076 | __perf_sw_event(event_id, nr, nmi, regs, addr); |
| 1041 | } | 1077 | } |
| 1042 | 1078 | ||
| 1043 | extern atomic_t perf_task_events; | 1079 | extern atomic_t perf_sched_events; |
| 1044 | 1080 | ||
| 1045 | static inline void perf_event_task_sched_in(struct task_struct *task) | 1081 | static inline void perf_event_task_sched_in(struct task_struct *task) |
| 1046 | { | 1082 | { |
| 1047 | COND_STMT(&perf_task_events, __perf_event_task_sched_in(task)); | 1083 | COND_STMT(&perf_sched_events, __perf_event_task_sched_in(task)); |
| 1048 | } | 1084 | } |
| 1049 | 1085 | ||
| 1050 | static inline | 1086 | static inline |
| @@ -1052,7 +1088,7 @@ void perf_event_task_sched_out(struct task_struct *task, struct task_struct *nex | |||
| 1052 | { | 1088 | { |
| 1053 | perf_sw_event(PERF_COUNT_SW_CONTEXT_SWITCHES, 1, 1, NULL, 0); | 1089 | perf_sw_event(PERF_COUNT_SW_CONTEXT_SWITCHES, 1, 1, NULL, 0); |
| 1054 | 1090 | ||
| 1055 | COND_STMT(&perf_task_events, __perf_event_task_sched_out(task, next)); | 1091 | COND_STMT(&perf_sched_events, __perf_event_task_sched_out(task, next)); |
| 1056 | } | 1092 | } |
| 1057 | 1093 | ||
| 1058 | extern void perf_event_mmap(struct vm_area_struct *vma); | 1094 | extern void perf_event_mmap(struct vm_area_struct *vma); |
| @@ -1083,6 +1119,10 @@ extern int sysctl_perf_event_paranoid; | |||
| 1083 | extern int sysctl_perf_event_mlock; | 1119 | extern int sysctl_perf_event_mlock; |
| 1084 | extern int sysctl_perf_event_sample_rate; | 1120 | extern int sysctl_perf_event_sample_rate; |
| 1085 | 1121 | ||
| 1122 | extern int perf_proc_update_handler(struct ctl_table *table, int write, | ||
| 1123 | void __user *buffer, size_t *lenp, | ||
| 1124 | loff_t *ppos); | ||
| 1125 | |||
| 1086 | static inline bool perf_paranoid_tracepoint_raw(void) | 1126 | static inline bool perf_paranoid_tracepoint_raw(void) |
| 1087 | { | 1127 | { |
| 1088 | return sysctl_perf_event_paranoid > -1; | 1128 | return sysctl_perf_event_paranoid > -1; |
diff --git a/include/linux/phonet.h b/include/linux/phonet.h index 26c8df786918..6fb13841db45 100644 --- a/include/linux/phonet.h +++ b/include/linux/phonet.h | |||
| @@ -36,9 +36,7 @@ | |||
| 36 | /* Socket options for SOL_PNPIPE level */ | 36 | /* Socket options for SOL_PNPIPE level */ |
| 37 | #define PNPIPE_ENCAP 1 | 37 | #define PNPIPE_ENCAP 1 |
| 38 | #define PNPIPE_IFINDEX 2 | 38 | #define PNPIPE_IFINDEX 2 |
| 39 | #define PNPIPE_PIPE_HANDLE 3 | 39 | #define PNPIPE_HANDLE 3 |
| 40 | #define PNPIPE_ENABLE 4 | ||
| 41 | /* unused slot */ | ||
| 42 | 40 | ||
| 43 | #define PNADDR_ANY 0 | 41 | #define PNADDR_ANY 0 |
| 44 | #define PNADDR_BROADCAST 0xFC | 42 | #define PNADDR_BROADCAST 0xFC |
diff --git a/include/linux/pkt_sched.h b/include/linux/pkt_sched.h index 2cfa4bc8dea6..b1032a3fafdc 100644 --- a/include/linux/pkt_sched.h +++ b/include/linux/pkt_sched.h | |||
| @@ -247,6 +247,35 @@ struct tc_gred_sopt { | |||
| 247 | __u16 pad1; | 247 | __u16 pad1; |
| 248 | }; | 248 | }; |
| 249 | 249 | ||
| 250 | /* CHOKe section */ | ||
| 251 | |||
| 252 | enum { | ||
| 253 | TCA_CHOKE_UNSPEC, | ||
| 254 | TCA_CHOKE_PARMS, | ||
| 255 | TCA_CHOKE_STAB, | ||
| 256 | __TCA_CHOKE_MAX, | ||
| 257 | }; | ||
| 258 | |||
| 259 | #define TCA_CHOKE_MAX (__TCA_CHOKE_MAX - 1) | ||
| 260 | |||
| 261 | struct tc_choke_qopt { | ||
| 262 | __u32 limit; /* Hard queue length (packets) */ | ||
| 263 | __u32 qth_min; /* Min average threshold (packets) */ | ||
| 264 | __u32 qth_max; /* Max average threshold (packets) */ | ||
| 265 | unsigned char Wlog; /* log(W) */ | ||
| 266 | unsigned char Plog; /* log(P_max/(qth_max-qth_min)) */ | ||
| 267 | unsigned char Scell_log; /* cell size for idle damping */ | ||
| 268 | unsigned char flags; /* see RED flags */ | ||
| 269 | }; | ||
| 270 | |||
| 271 | struct tc_choke_xstats { | ||
| 272 | __u32 early; /* Early drops */ | ||
| 273 | __u32 pdrop; /* Drops due to queue limits */ | ||
| 274 | __u32 other; /* Drops due to drop() calls */ | ||
| 275 | __u32 marked; /* Marked packets */ | ||
| 276 | __u32 matched; /* Drops due to flow match */ | ||
| 277 | }; | ||
| 278 | |||
| 250 | /* HTB section */ | 279 | /* HTB section */ |
| 251 | #define TC_HTB_NUMPRIO 8 | 280 | #define TC_HTB_NUMPRIO 8 |
| 252 | #define TC_HTB_MAXDEPTH 8 | 281 | #define TC_HTB_MAXDEPTH 8 |
| @@ -435,6 +464,7 @@ enum { | |||
| 435 | TCA_NETEM_DELAY_DIST, | 464 | TCA_NETEM_DELAY_DIST, |
| 436 | TCA_NETEM_REORDER, | 465 | TCA_NETEM_REORDER, |
| 437 | TCA_NETEM_CORRUPT, | 466 | TCA_NETEM_CORRUPT, |
| 467 | TCA_NETEM_LOSS, | ||
| 438 | __TCA_NETEM_MAX, | 468 | __TCA_NETEM_MAX, |
| 439 | }; | 469 | }; |
| 440 | 470 | ||
| @@ -465,7 +495,33 @@ struct tc_netem_corrupt { | |||
| 465 | __u32 correlation; | 495 | __u32 correlation; |
| 466 | }; | 496 | }; |
| 467 | 497 | ||
| 498 | enum { | ||
| 499 | NETEM_LOSS_UNSPEC, | ||
| 500 | NETEM_LOSS_GI, /* General Intuitive - 4 state model */ | ||
| 501 | NETEM_LOSS_GE, /* Gilbert Elliot models */ | ||
| 502 | __NETEM_LOSS_MAX | ||
| 503 | }; | ||
| 504 | #define NETEM_LOSS_MAX (__NETEM_LOSS_MAX - 1) | ||
| 505 | |||
| 506 | /* State transition probablities for 4 state model */ | ||
| 507 | struct tc_netem_gimodel { | ||
| 508 | __u32 p13; | ||
| 509 | __u32 p31; | ||
| 510 | __u32 p32; | ||
| 511 | __u32 p14; | ||
| 512 | __u32 p23; | ||
| 513 | }; | ||
| 514 | |||
| 515 | /* Gilbert-Elliot models */ | ||
| 516 | struct tc_netem_gemodel { | ||
| 517 | __u32 p; | ||
| 518 | __u32 r; | ||
| 519 | __u32 h; | ||
| 520 | __u32 k1; | ||
| 521 | }; | ||
| 522 | |||
| 468 | #define NETEM_DIST_SCALE 8192 | 523 | #define NETEM_DIST_SCALE 8192 |
| 524 | #define NETEM_DIST_MAX 16384 | ||
| 469 | 525 | ||
| 470 | /* DRR */ | 526 | /* DRR */ |
| 471 | 527 | ||
| @@ -481,4 +537,55 @@ struct tc_drr_stats { | |||
| 481 | __u32 deficit; | 537 | __u32 deficit; |
| 482 | }; | 538 | }; |
| 483 | 539 | ||
| 540 | /* MQPRIO */ | ||
| 541 | #define TC_QOPT_BITMASK 15 | ||
| 542 | #define TC_QOPT_MAX_QUEUE 16 | ||
| 543 | |||
| 544 | struct tc_mqprio_qopt { | ||
| 545 | __u8 num_tc; | ||
| 546 | __u8 prio_tc_map[TC_QOPT_BITMASK + 1]; | ||
| 547 | __u8 hw; | ||
| 548 | __u16 count[TC_QOPT_MAX_QUEUE]; | ||
| 549 | __u16 offset[TC_QOPT_MAX_QUEUE]; | ||
| 550 | }; | ||
| 551 | |||
| 552 | /* SFB */ | ||
| 553 | |||
| 554 | enum { | ||
| 555 | TCA_SFB_UNSPEC, | ||
| 556 | TCA_SFB_PARMS, | ||
| 557 | __TCA_SFB_MAX, | ||
| 558 | }; | ||
| 559 | |||
| 560 | #define TCA_SFB_MAX (__TCA_SFB_MAX - 1) | ||
| 561 | |||
| 562 | /* | ||
| 563 | * Note: increment, decrement are Q0.16 fixed-point values. | ||
| 564 | */ | ||
| 565 | struct tc_sfb_qopt { | ||
| 566 | __u32 rehash_interval; /* delay between hash move, in ms */ | ||
| 567 | __u32 warmup_time; /* double buffering warmup time in ms (warmup_time < rehash_interval) */ | ||
| 568 | __u32 max; /* max len of qlen_min */ | ||
| 569 | __u32 bin_size; /* maximum queue length per bin */ | ||
| 570 | __u32 increment; /* probability increment, (d1 in Blue) */ | ||
| 571 | __u32 decrement; /* probability decrement, (d2 in Blue) */ | ||
| 572 | __u32 limit; /* max SFB queue length */ | ||
| 573 | __u32 penalty_rate; /* inelastic flows are rate limited to 'rate' pps */ | ||
| 574 | __u32 penalty_burst; | ||
| 575 | }; | ||
| 576 | |||
| 577 | struct tc_sfb_xstats { | ||
| 578 | __u32 earlydrop; | ||
| 579 | __u32 penaltydrop; | ||
| 580 | __u32 bucketdrop; | ||
| 581 | __u32 queuedrop; | ||
| 582 | __u32 childdrop; /* drops in child qdisc */ | ||
| 583 | __u32 marked; | ||
| 584 | __u32 maxqlen; | ||
| 585 | __u32 maxprob; | ||
| 586 | __u32 avgprob; | ||
| 587 | }; | ||
| 588 | |||
| 589 | #define SFB_MAX_PROB 0xFFFF | ||
| 590 | |||
| 484 | #endif | 591 | #endif |
diff --git a/include/linux/platform_data/msm_serial_hs.h b/include/linux/platform_data/msm_serial_hs.h new file mode 100644 index 000000000000..98a2046f8b31 --- /dev/null +++ b/include/linux/platform_data/msm_serial_hs.h | |||
| @@ -0,0 +1,49 @@ | |||
| 1 | /* | ||
| 2 | * Copyright (C) 2008 Google, Inc. | ||
| 3 | * Author: Nick Pelly <npelly@google.com> | ||
| 4 | * | ||
| 5 | * This software is licensed under the terms of the GNU General Public | ||
| 6 | * License version 2, as published by the Free Software Foundation, and | ||
| 7 | * may be copied, distributed, and modified under those terms. | ||
| 8 | * | ||
| 9 | * This program is distributed in the hope that it will be useful, | ||
| 10 | * but WITHOUT ANY WARRANTY; without even the implied warranty of | ||
| 11 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the | ||
| 12 | * GNU General Public License for more details. | ||
| 13 | */ | ||
| 14 | |||
| 15 | #ifndef __ASM_ARCH_MSM_SERIAL_HS_H | ||
| 16 | #define __ASM_ARCH_MSM_SERIAL_HS_H | ||
| 17 | |||
| 18 | #include <linux/serial_core.h> | ||
| 19 | |||
| 20 | /* API to request the uart clock off or on for low power management | ||
| 21 | * Clients should call request_clock_off() when no uart data is expected, | ||
| 22 | * and must call request_clock_on() before any further uart data can be | ||
| 23 | * received. */ | ||
| 24 | extern void msm_hs_request_clock_off(struct uart_port *uport); | ||
| 25 | extern void msm_hs_request_clock_on(struct uart_port *uport); | ||
| 26 | |||
| 27 | /** | ||
| 28 | * struct msm_serial_hs_platform_data | ||
| 29 | * @rx_wakeup_irq: Rx activity irq | ||
| 30 | * @rx_to_inject: extra character to be inserted to Rx tty on wakeup | ||
| 31 | * @inject_rx: 1 = insert rx_to_inject. 0 = do not insert extra character | ||
| 32 | * @exit_lpm_cb: function called before every Tx transaction | ||
| 33 | * | ||
| 34 | * This is an optional structure required for UART Rx GPIO IRQ based | ||
| 35 | * wakeup from low power state. UART wakeup can be triggered by RX activity | ||
| 36 | * (using a wakeup GPIO on the UART RX pin). This should only be used if | ||
| 37 | * there is not a wakeup GPIO on the UART CTS, and the first RX byte is | ||
| 38 | * known (eg., with the Bluetooth Texas Instruments HCILL protocol), | ||
| 39 | * since the first RX byte will always be lost. RTS will be asserted even | ||
| 40 | * while the UART is clocked off in this mode of operation. | ||
| 41 | */ | ||
| 42 | struct msm_serial_hs_platform_data { | ||
| 43 | int rx_wakeup_irq; | ||
| 44 | unsigned char inject_rx_on_wakeup; | ||
| 45 | char rx_to_inject; | ||
| 46 | void (*exit_lpm_cb)(struct uart_port *); | ||
| 47 | }; | ||
| 48 | |||
| 49 | #endif | ||
diff --git a/include/linux/platform_data/tegra_usb.h b/include/linux/platform_data/tegra_usb.h new file mode 100644 index 000000000000..6bca5b569acb --- /dev/null +++ b/include/linux/platform_data/tegra_usb.h | |||
| @@ -0,0 +1,31 @@ | |||
| 1 | /* | ||
| 2 | * Copyright (C) 2010 Google, Inc. | ||
| 3 | * | ||
| 4 | * This software is licensed under the terms of the GNU General Public | ||
| 5 | * License version 2, as published by the Free Software Foundation, and | ||
| 6 | * may be copied, distributed, and modified under those terms. | ||
| 7 | * | ||
| 8 | * This program is distributed in the hope that it will be useful, | ||
| 9 | * but WITHOUT ANY WARRANTY; without even the implied warranty of | ||
| 10 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the | ||
| 11 | * GNU General Public License for more details. | ||
| 12 | * | ||
| 13 | */ | ||
| 14 | |||
| 15 | #ifndef _TEGRA_USB_H_ | ||
| 16 | #define _TEGRA_USB_H_ | ||
| 17 | |||
| 18 | enum tegra_usb_operating_modes { | ||
| 19 | TEGRA_USB_DEVICE, | ||
| 20 | TEGRA_USB_HOST, | ||
| 21 | TEGRA_USB_OTG, | ||
| 22 | }; | ||
| 23 | |||
| 24 | struct tegra_ehci_platform_data { | ||
| 25 | enum tegra_usb_operating_modes operating_mode; | ||
| 26 | /* power down the phy on bus suspend */ | ||
| 27 | int power_down_on_bus_suspend; | ||
| 28 | void *phy_config; | ||
| 29 | }; | ||
| 30 | |||
| 31 | #endif /* _TEGRA_USB_H_ */ | ||
diff --git a/include/linux/platform_data/uio_pruss.h b/include/linux/platform_data/uio_pruss.h new file mode 100644 index 000000000000..f39140aabc6f --- /dev/null +++ b/include/linux/platform_data/uio_pruss.h | |||
| @@ -0,0 +1,25 @@ | |||
| 1 | /* | ||
| 2 | * include/linux/platform_data/uio_pruss.h | ||
| 3 | * | ||
| 4 | * Platform data for uio_pruss driver | ||
| 5 | * | ||
| 6 | * Copyright (C) 2010-11 Texas Instruments Incorporated - http://www.ti.com/ | ||
| 7 | * | ||
| 8 | * This program is free software; you can redistribute it and/or | ||
| 9 | * modify it under the terms of the GNU General Public License as | ||
| 10 | * published by the Free Software Foundation version 2. | ||
| 11 | * | ||
| 12 | * This program is distributed "as is" WITHOUT ANY WARRANTY of any | ||
| 13 | * kind, whether express or implied; without even the implied warranty | ||
| 14 | * of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the | ||
| 15 | * GNU General Public License for more details. | ||
| 16 | */ | ||
| 17 | |||
| 18 | #ifndef _UIO_PRUSS_H_ | ||
| 19 | #define _UIO_PRUSS_H_ | ||
| 20 | |||
| 21 | /* To configure the PRUSS INTC base offset for UIO driver */ | ||
| 22 | struct uio_pruss_pdata { | ||
| 23 | u32 pintc_base; | ||
| 24 | }; | ||
| 25 | #endif /* _UIO_PRUSS_H_ */ | ||
diff --git a/include/linux/platform_device.h b/include/linux/platform_device.h index 2e700ec0601f..d96db9825708 100644 --- a/include/linux/platform_device.h +++ b/include/linux/platform_device.h | |||
| @@ -130,8 +130,15 @@ extern void platform_driver_unregister(struct platform_driver *); | |||
| 130 | extern int platform_driver_probe(struct platform_driver *driver, | 130 | extern int platform_driver_probe(struct platform_driver *driver, |
| 131 | int (*probe)(struct platform_device *)); | 131 | int (*probe)(struct platform_device *)); |
| 132 | 132 | ||
| 133 | #define platform_get_drvdata(_dev) dev_get_drvdata(&(_dev)->dev) | 133 | static inline void *platform_get_drvdata(const struct platform_device *pdev) |
| 134 | #define platform_set_drvdata(_dev,data) dev_set_drvdata(&(_dev)->dev, (data)) | 134 | { |
| 135 | return dev_get_drvdata(&pdev->dev); | ||
| 136 | } | ||
| 137 | |||
| 138 | static inline void platform_set_drvdata(struct platform_device *pdev, void *data) | ||
| 139 | { | ||
| 140 | dev_set_drvdata(&pdev->dev, data); | ||
| 141 | } | ||
| 135 | 142 | ||
| 136 | extern struct platform_device *platform_create_bundle(struct platform_driver *driver, | 143 | extern struct platform_device *platform_create_bundle(struct platform_driver *driver, |
| 137 | int (*probe)(struct platform_device *), | 144 | int (*probe)(struct platform_device *), |
diff --git a/include/linux/plist.h b/include/linux/plist.h index 7254eda078e5..c9b9f322c8d8 100644 --- a/include/linux/plist.h +++ b/include/linux/plist.h | |||
| @@ -31,15 +31,17 @@ | |||
| 31 | * | 31 | * |
| 32 | * Simple ASCII art explanation: | 32 | * Simple ASCII art explanation: |
| 33 | * | 33 | * |
| 34 | * |HEAD | | 34 | * pl:prio_list (only for plist_node) |
| 35 | * | | | 35 | * nl:node_list |
| 36 | * |prio_list.prev|<------------------------------------| | 36 | * HEAD| NODE(S) |
| 37 | * |prio_list.next|<->|pl|<->|pl|<--------------->|pl|<-| | 37 | * | |
| 38 | * |10 | |10| |21| |21| |21| |40| (prio) | 38 | * ||------------------------------------| |
| 39 | * | | | | | | | | | | | | | 39 | * ||->|pl|<->|pl|<--------------->|pl|<-| |
| 40 | * | | | | | | | | | | | | | 40 | * | |10| |21| |21| |21| |40| (prio) |
| 41 | * |node_list.next|<->|nl|<->|nl|<->|nl|<->|nl|<->|nl|<-| | 41 | * | | | | | | | | | | | |
| 42 | * |node_list.prev|<------------------------------------| | 42 | * | | | | | | | | | | | |
| 43 | * |->|nl|<->|nl|<->|nl|<->|nl|<->|nl|<->|nl|<-| | ||
| 44 | * |-------------------------------------------| | ||
| 43 | * | 45 | * |
| 44 | * The nodes on the prio_list list are sorted by priority to simplify | 46 | * The nodes on the prio_list list are sorted by priority to simplify |
| 45 | * the insertion of new nodes. There are no nodes with duplicate | 47 | * the insertion of new nodes. There are no nodes with duplicate |
| @@ -78,7 +80,6 @@ | |||
| 78 | #include <linux/spinlock_types.h> | 80 | #include <linux/spinlock_types.h> |
| 79 | 81 | ||
| 80 | struct plist_head { | 82 | struct plist_head { |
| 81 | struct list_head prio_list; | ||
| 82 | struct list_head node_list; | 83 | struct list_head node_list; |
| 83 | #ifdef CONFIG_DEBUG_PI_LIST | 84 | #ifdef CONFIG_DEBUG_PI_LIST |
| 84 | raw_spinlock_t *rawlock; | 85 | raw_spinlock_t *rawlock; |
| @@ -88,7 +89,8 @@ struct plist_head { | |||
| 88 | 89 | ||
| 89 | struct plist_node { | 90 | struct plist_node { |
| 90 | int prio; | 91 | int prio; |
| 91 | struct plist_head plist; | 92 | struct list_head prio_list; |
| 93 | struct list_head node_list; | ||
| 92 | }; | 94 | }; |
| 93 | 95 | ||
| 94 | #ifdef CONFIG_DEBUG_PI_LIST | 96 | #ifdef CONFIG_DEBUG_PI_LIST |
| @@ -100,7 +102,6 @@ struct plist_node { | |||
| 100 | #endif | 102 | #endif |
| 101 | 103 | ||
| 102 | #define _PLIST_HEAD_INIT(head) \ | 104 | #define _PLIST_HEAD_INIT(head) \ |
| 103 | .prio_list = LIST_HEAD_INIT((head).prio_list), \ | ||
| 104 | .node_list = LIST_HEAD_INIT((head).node_list) | 105 | .node_list = LIST_HEAD_INIT((head).node_list) |
| 105 | 106 | ||
| 106 | /** | 107 | /** |
| @@ -133,7 +134,8 @@ struct plist_node { | |||
| 133 | #define PLIST_NODE_INIT(node, __prio) \ | 134 | #define PLIST_NODE_INIT(node, __prio) \ |
| 134 | { \ | 135 | { \ |
| 135 | .prio = (__prio), \ | 136 | .prio = (__prio), \ |
| 136 | .plist = { _PLIST_HEAD_INIT((node).plist) }, \ | 137 | .prio_list = LIST_HEAD_INIT((node).prio_list), \ |
| 138 | .node_list = LIST_HEAD_INIT((node).node_list), \ | ||
| 137 | } | 139 | } |
| 138 | 140 | ||
| 139 | /** | 141 | /** |
| @@ -144,7 +146,6 @@ struct plist_node { | |||
| 144 | static inline void | 146 | static inline void |
| 145 | plist_head_init(struct plist_head *head, spinlock_t *lock) | 147 | plist_head_init(struct plist_head *head, spinlock_t *lock) |
| 146 | { | 148 | { |
| 147 | INIT_LIST_HEAD(&head->prio_list); | ||
| 148 | INIT_LIST_HEAD(&head->node_list); | 149 | INIT_LIST_HEAD(&head->node_list); |
| 149 | #ifdef CONFIG_DEBUG_PI_LIST | 150 | #ifdef CONFIG_DEBUG_PI_LIST |
| 150 | head->spinlock = lock; | 151 | head->spinlock = lock; |
| @@ -160,7 +161,6 @@ plist_head_init(struct plist_head *head, spinlock_t *lock) | |||
| 160 | static inline void | 161 | static inline void |
| 161 | plist_head_init_raw(struct plist_head *head, raw_spinlock_t *lock) | 162 | plist_head_init_raw(struct plist_head *head, raw_spinlock_t *lock) |
| 162 | { | 163 | { |
| 163 | INIT_LIST_HEAD(&head->prio_list); | ||
| 164 | INIT_LIST_HEAD(&head->node_list); | 164 | INIT_LIST_HEAD(&head->node_list); |
| 165 | #ifdef CONFIG_DEBUG_PI_LIST | 165 | #ifdef CONFIG_DEBUG_PI_LIST |
| 166 | head->rawlock = lock; | 166 | head->rawlock = lock; |
| @@ -176,7 +176,8 @@ plist_head_init_raw(struct plist_head *head, raw_spinlock_t *lock) | |||
| 176 | static inline void plist_node_init(struct plist_node *node, int prio) | 176 | static inline void plist_node_init(struct plist_node *node, int prio) |
| 177 | { | 177 | { |
| 178 | node->prio = prio; | 178 | node->prio = prio; |
| 179 | plist_head_init(&node->plist, NULL); | 179 | INIT_LIST_HEAD(&node->prio_list); |
| 180 | INIT_LIST_HEAD(&node->node_list); | ||
| 180 | } | 181 | } |
| 181 | 182 | ||
| 182 | extern void plist_add(struct plist_node *node, struct plist_head *head); | 183 | extern void plist_add(struct plist_node *node, struct plist_head *head); |
| @@ -188,7 +189,7 @@ extern void plist_del(struct plist_node *node, struct plist_head *head); | |||
| 188 | * @head: the head for your list | 189 | * @head: the head for your list |
| 189 | */ | 190 | */ |
| 190 | #define plist_for_each(pos, head) \ | 191 | #define plist_for_each(pos, head) \ |
| 191 | list_for_each_entry(pos, &(head)->node_list, plist.node_list) | 192 | list_for_each_entry(pos, &(head)->node_list, node_list) |
| 192 | 193 | ||
| 193 | /** | 194 | /** |
| 194 | * plist_for_each_safe - iterate safely over a plist of given type | 195 | * plist_for_each_safe - iterate safely over a plist of given type |
| @@ -199,7 +200,7 @@ extern void plist_del(struct plist_node *node, struct plist_head *head); | |||
| 199 | * Iterate over a plist of given type, safe against removal of list entry. | 200 | * Iterate over a plist of given type, safe against removal of list entry. |
| 200 | */ | 201 | */ |
| 201 | #define plist_for_each_safe(pos, n, head) \ | 202 | #define plist_for_each_safe(pos, n, head) \ |
| 202 | list_for_each_entry_safe(pos, n, &(head)->node_list, plist.node_list) | 203 | list_for_each_entry_safe(pos, n, &(head)->node_list, node_list) |
| 203 | 204 | ||
| 204 | /** | 205 | /** |
| 205 | * plist_for_each_entry - iterate over list of given type | 206 | * plist_for_each_entry - iterate over list of given type |
| @@ -208,7 +209,7 @@ extern void plist_del(struct plist_node *node, struct plist_head *head); | |||
| 208 | * @mem: the name of the list_struct within the struct | 209 | * @mem: the name of the list_struct within the struct |
| 209 | */ | 210 | */ |
| 210 | #define plist_for_each_entry(pos, head, mem) \ | 211 | #define plist_for_each_entry(pos, head, mem) \ |
| 211 | list_for_each_entry(pos, &(head)->node_list, mem.plist.node_list) | 212 | list_for_each_entry(pos, &(head)->node_list, mem.node_list) |
| 212 | 213 | ||
| 213 | /** | 214 | /** |
| 214 | * plist_for_each_entry_safe - iterate safely over list of given type | 215 | * plist_for_each_entry_safe - iterate safely over list of given type |
| @@ -220,7 +221,7 @@ extern void plist_del(struct plist_node *node, struct plist_head *head); | |||
| 220 | * Iterate over list of given type, safe against removal of list entry. | 221 | * Iterate over list of given type, safe against removal of list entry. |
| 221 | */ | 222 | */ |
| 222 | #define plist_for_each_entry_safe(pos, n, head, m) \ | 223 | #define plist_for_each_entry_safe(pos, n, head, m) \ |
| 223 | list_for_each_entry_safe(pos, n, &(head)->node_list, m.plist.node_list) | 224 | list_for_each_entry_safe(pos, n, &(head)->node_list, m.node_list) |
| 224 | 225 | ||
| 225 | /** | 226 | /** |
| 226 | * plist_head_empty - return !0 if a plist_head is empty | 227 | * plist_head_empty - return !0 if a plist_head is empty |
| @@ -237,7 +238,7 @@ static inline int plist_head_empty(const struct plist_head *head) | |||
| 237 | */ | 238 | */ |
| 238 | static inline int plist_node_empty(const struct plist_node *node) | 239 | static inline int plist_node_empty(const struct plist_node *node) |
| 239 | { | 240 | { |
| 240 | return plist_head_empty(&node->plist); | 241 | return list_empty(&node->node_list); |
| 241 | } | 242 | } |
| 242 | 243 | ||
| 243 | /* All functions below assume the plist_head is not empty. */ | 244 | /* All functions below assume the plist_head is not empty. */ |
| @@ -285,7 +286,7 @@ static inline int plist_node_empty(const struct plist_node *node) | |||
| 285 | static inline struct plist_node *plist_first(const struct plist_head *head) | 286 | static inline struct plist_node *plist_first(const struct plist_head *head) |
| 286 | { | 287 | { |
| 287 | return list_entry(head->node_list.next, | 288 | return list_entry(head->node_list.next, |
| 288 | struct plist_node, plist.node_list); | 289 | struct plist_node, node_list); |
| 289 | } | 290 | } |
| 290 | 291 | ||
| 291 | /** | 292 | /** |
| @@ -297,7 +298,7 @@ static inline struct plist_node *plist_first(const struct plist_head *head) | |||
| 297 | static inline struct plist_node *plist_last(const struct plist_head *head) | 298 | static inline struct plist_node *plist_last(const struct plist_head *head) |
| 298 | { | 299 | { |
| 299 | return list_entry(head->node_list.prev, | 300 | return list_entry(head->node_list.prev, |
| 300 | struct plist_node, plist.node_list); | 301 | struct plist_node, node_list); |
| 301 | } | 302 | } |
| 302 | 303 | ||
| 303 | #endif | 304 | #endif |
diff --git a/include/linux/pm.h b/include/linux/pm.h index dd9c7ab38270..6618216bb973 100644 --- a/include/linux/pm.h +++ b/include/linux/pm.h | |||
| @@ -267,7 +267,7 @@ const struct dev_pm_ops name = { \ | |||
| 267 | * callbacks provided by device drivers supporting both the system sleep PM and | 267 | * callbacks provided by device drivers supporting both the system sleep PM and |
| 268 | * runtime PM, make the pm member point to generic_subsys_pm_ops. | 268 | * runtime PM, make the pm member point to generic_subsys_pm_ops. |
| 269 | */ | 269 | */ |
| 270 | #ifdef CONFIG_PM_OPS | 270 | #ifdef CONFIG_PM |
| 271 | extern struct dev_pm_ops generic_subsys_pm_ops; | 271 | extern struct dev_pm_ops generic_subsys_pm_ops; |
| 272 | #define GENERIC_SUBSYS_PM_OPS (&generic_subsys_pm_ops) | 272 | #define GENERIC_SUBSYS_PM_OPS (&generic_subsys_pm_ops) |
| 273 | #else | 273 | #else |
| @@ -431,6 +431,8 @@ struct dev_pm_info { | |||
| 431 | struct list_head entry; | 431 | struct list_head entry; |
| 432 | struct completion completion; | 432 | struct completion completion; |
| 433 | struct wakeup_source *wakeup; | 433 | struct wakeup_source *wakeup; |
| 434 | #else | ||
| 435 | unsigned int should_wakeup:1; | ||
| 434 | #endif | 436 | #endif |
| 435 | #ifdef CONFIG_PM_RUNTIME | 437 | #ifdef CONFIG_PM_RUNTIME |
| 436 | struct timer_list suspend_timer; | 438 | struct timer_list suspend_timer; |
| @@ -463,6 +465,14 @@ struct dev_pm_info { | |||
| 463 | 465 | ||
| 464 | extern void update_pm_runtime_accounting(struct device *dev); | 466 | extern void update_pm_runtime_accounting(struct device *dev); |
| 465 | 467 | ||
| 468 | /* | ||
| 469 | * Power domains provide callbacks that are executed during system suspend, | ||
| 470 | * hibernation, system resume and during runtime PM transitions along with | ||
| 471 | * subsystem-level and driver-level callbacks. | ||
| 472 | */ | ||
| 473 | struct dev_power_domain { | ||
| 474 | struct dev_pm_ops ops; | ||
| 475 | }; | ||
| 466 | 476 | ||
| 467 | /* | 477 | /* |
| 468 | * The PM_EVENT_ messages are also used by drivers implementing the legacy | 478 | * The PM_EVENT_ messages are also used by drivers implementing the legacy |
| @@ -563,15 +573,6 @@ enum dpm_order { | |||
| 563 | DPM_ORDER_DEV_LAST, | 573 | DPM_ORDER_DEV_LAST, |
| 564 | }; | 574 | }; |
| 565 | 575 | ||
| 566 | /* | ||
| 567 | * Global Power Management flags | ||
| 568 | * Used to keep APM and ACPI from both being active | ||
| 569 | */ | ||
| 570 | extern unsigned int pm_flags; | ||
| 571 | |||
| 572 | #define PM_APM 1 | ||
| 573 | #define PM_ACPI 2 | ||
| 574 | |||
| 575 | extern int pm_generic_suspend(struct device *dev); | 576 | extern int pm_generic_suspend(struct device *dev); |
| 576 | extern int pm_generic_resume(struct device *dev); | 577 | extern int pm_generic_resume(struct device *dev); |
| 577 | extern int pm_generic_freeze(struct device *dev); | 578 | extern int pm_generic_freeze(struct device *dev); |
diff --git a/include/linux/pm_runtime.h b/include/linux/pm_runtime.h index d34f067e2a7f..8de9aa6e7def 100644 --- a/include/linux/pm_runtime.h +++ b/include/linux/pm_runtime.h | |||
| @@ -87,6 +87,11 @@ static inline bool pm_runtime_enabled(struct device *dev) | |||
| 87 | return !dev->power.disable_depth; | 87 | return !dev->power.disable_depth; |
| 88 | } | 88 | } |
| 89 | 89 | ||
| 90 | static inline bool pm_runtime_callbacks_present(struct device *dev) | ||
| 91 | { | ||
| 92 | return !dev->power.no_callbacks; | ||
| 93 | } | ||
| 94 | |||
| 90 | static inline void pm_runtime_mark_last_busy(struct device *dev) | 95 | static inline void pm_runtime_mark_last_busy(struct device *dev) |
| 91 | { | 96 | { |
| 92 | ACCESS_ONCE(dev->power.last_busy) = jiffies; | 97 | ACCESS_ONCE(dev->power.last_busy) = jiffies; |
| @@ -133,6 +138,7 @@ static inline int pm_generic_runtime_resume(struct device *dev) { return 0; } | |||
| 133 | static inline void pm_runtime_no_callbacks(struct device *dev) {} | 138 | static inline void pm_runtime_no_callbacks(struct device *dev) {} |
| 134 | static inline void pm_runtime_irq_safe(struct device *dev) {} | 139 | static inline void pm_runtime_irq_safe(struct device *dev) {} |
| 135 | 140 | ||
| 141 | static inline bool pm_runtime_callbacks_present(struct device *dev) { return false; } | ||
| 136 | static inline void pm_runtime_mark_last_busy(struct device *dev) {} | 142 | static inline void pm_runtime_mark_last_busy(struct device *dev) {} |
| 137 | static inline void __pm_runtime_use_autosuspend(struct device *dev, | 143 | static inline void __pm_runtime_use_autosuspend(struct device *dev, |
| 138 | bool use) {} | 144 | bool use) {} |
diff --git a/include/linux/pm_wakeup.h b/include/linux/pm_wakeup.h index 9cff00dd6b63..a32da962d693 100644 --- a/include/linux/pm_wakeup.h +++ b/include/linux/pm_wakeup.h | |||
| @@ -62,18 +62,11 @@ struct wakeup_source { | |||
| 62 | * Changes to device_may_wakeup take effect on the next pm state change. | 62 | * Changes to device_may_wakeup take effect on the next pm state change. |
| 63 | */ | 63 | */ |
| 64 | 64 | ||
| 65 | static inline void device_set_wakeup_capable(struct device *dev, bool capable) | ||
| 66 | { | ||
| 67 | dev->power.can_wakeup = capable; | ||
| 68 | } | ||
| 69 | |||
| 70 | static inline bool device_can_wakeup(struct device *dev) | 65 | static inline bool device_can_wakeup(struct device *dev) |
| 71 | { | 66 | { |
| 72 | return dev->power.can_wakeup; | 67 | return dev->power.can_wakeup; |
| 73 | } | 68 | } |
| 74 | 69 | ||
| 75 | |||
| 76 | |||
| 77 | static inline bool device_may_wakeup(struct device *dev) | 70 | static inline bool device_may_wakeup(struct device *dev) |
| 78 | { | 71 | { |
| 79 | return dev->power.can_wakeup && !!dev->power.wakeup; | 72 | return dev->power.can_wakeup && !!dev->power.wakeup; |
| @@ -88,6 +81,7 @@ extern struct wakeup_source *wakeup_source_register(const char *name); | |||
| 88 | extern void wakeup_source_unregister(struct wakeup_source *ws); | 81 | extern void wakeup_source_unregister(struct wakeup_source *ws); |
| 89 | extern int device_wakeup_enable(struct device *dev); | 82 | extern int device_wakeup_enable(struct device *dev); |
| 90 | extern int device_wakeup_disable(struct device *dev); | 83 | extern int device_wakeup_disable(struct device *dev); |
| 84 | extern void device_set_wakeup_capable(struct device *dev, bool capable); | ||
| 91 | extern int device_init_wakeup(struct device *dev, bool val); | 85 | extern int device_init_wakeup(struct device *dev, bool val); |
| 92 | extern int device_set_wakeup_enable(struct device *dev, bool enable); | 86 | extern int device_set_wakeup_enable(struct device *dev, bool enable); |
| 93 | extern void __pm_stay_awake(struct wakeup_source *ws); | 87 | extern void __pm_stay_awake(struct wakeup_source *ws); |
| @@ -109,11 +103,6 @@ static inline bool device_can_wakeup(struct device *dev) | |||
| 109 | return dev->power.can_wakeup; | 103 | return dev->power.can_wakeup; |
| 110 | } | 104 | } |
| 111 | 105 | ||
| 112 | static inline bool device_may_wakeup(struct device *dev) | ||
| 113 | { | ||
| 114 | return false; | ||
| 115 | } | ||
| 116 | |||
| 117 | static inline struct wakeup_source *wakeup_source_create(const char *name) | 106 | static inline struct wakeup_source *wakeup_source_create(const char *name) |
| 118 | { | 107 | { |
| 119 | return NULL; | 108 | return NULL; |
| @@ -134,24 +123,32 @@ static inline void wakeup_source_unregister(struct wakeup_source *ws) {} | |||
| 134 | 123 | ||
| 135 | static inline int device_wakeup_enable(struct device *dev) | 124 | static inline int device_wakeup_enable(struct device *dev) |
| 136 | { | 125 | { |
| 137 | return -EINVAL; | 126 | dev->power.should_wakeup = true; |
| 127 | return 0; | ||
| 138 | } | 128 | } |
| 139 | 129 | ||
| 140 | static inline int device_wakeup_disable(struct device *dev) | 130 | static inline int device_wakeup_disable(struct device *dev) |
| 141 | { | 131 | { |
| 132 | dev->power.should_wakeup = false; | ||
| 142 | return 0; | 133 | return 0; |
| 143 | } | 134 | } |
| 144 | 135 | ||
| 145 | static inline int device_init_wakeup(struct device *dev, bool val) | 136 | static inline int device_set_wakeup_enable(struct device *dev, bool enable) |
| 146 | { | 137 | { |
| 147 | dev->power.can_wakeup = val; | 138 | dev->power.should_wakeup = enable; |
| 148 | return val ? -EINVAL : 0; | 139 | return 0; |
| 149 | } | 140 | } |
| 150 | 141 | ||
| 142 | static inline int device_init_wakeup(struct device *dev, bool val) | ||
| 143 | { | ||
| 144 | device_set_wakeup_capable(dev, val); | ||
| 145 | device_set_wakeup_enable(dev, val); | ||
| 146 | return 0; | ||
| 147 | } | ||
| 151 | 148 | ||
| 152 | static inline int device_set_wakeup_enable(struct device *dev, bool enable) | 149 | static inline bool device_may_wakeup(struct device *dev) |
| 153 | { | 150 | { |
| 154 | return -EINVAL; | 151 | return dev->power.can_wakeup && dev->power.should_wakeup; |
| 155 | } | 152 | } |
| 156 | 153 | ||
| 157 | static inline void __pm_stay_awake(struct wakeup_source *ws) {} | 154 | static inline void __pm_stay_awake(struct wakeup_source *ws) {} |
diff --git a/include/linux/posix-clock.h b/include/linux/posix-clock.h new file mode 100644 index 000000000000..369e19d3750b --- /dev/null +++ b/include/linux/posix-clock.h | |||
| @@ -0,0 +1,150 @@ | |||
| 1 | /* | ||
| 2 | * posix-clock.h - support for dynamic clock devices | ||
| 3 | * | ||
| 4 | * Copyright (C) 2010 OMICRON electronics GmbH | ||
| 5 | * | ||
| 6 | * This program is free software; you can redistribute it and/or modify | ||
| 7 | * it under the terms of the GNU General Public License as published by | ||
| 8 | * the Free Software Foundation; either version 2 of the License, or | ||
| 9 | * (at your option) any later version. | ||
| 10 | * | ||
| 11 | * This program is distributed in the hope that it will be useful, | ||
| 12 | * but WITHOUT ANY WARRANTY; without even the implied warranty of | ||
| 13 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the | ||
| 14 | * GNU General Public License for more details. | ||
| 15 | * | ||
| 16 | * You should have received a copy of the GNU General Public License | ||
| 17 | * along with this program; if not, write to the Free Software | ||
| 18 | * Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. | ||
| 19 | */ | ||
| 20 | #ifndef _LINUX_POSIX_CLOCK_H_ | ||
| 21 | #define _LINUX_POSIX_CLOCK_H_ | ||
| 22 | |||
| 23 | #include <linux/cdev.h> | ||
| 24 | #include <linux/fs.h> | ||
| 25 | #include <linux/poll.h> | ||
| 26 | #include <linux/posix-timers.h> | ||
| 27 | |||
| 28 | struct posix_clock; | ||
| 29 | |||
| 30 | /** | ||
| 31 | * struct posix_clock_operations - functional interface to the clock | ||
| 32 | * | ||
| 33 | * Every posix clock is represented by a character device. Drivers may | ||
| 34 | * optionally offer extended capabilities by implementing the | ||
| 35 | * character device methods. The character device file operations are | ||
| 36 | * first handled by the clock device layer, then passed on to the | ||
| 37 | * driver by calling these functions. | ||
| 38 | * | ||
| 39 | * @owner: The clock driver should set to THIS_MODULE | ||
| 40 | * @clock_adjtime: Adjust the clock | ||
| 41 | * @clock_gettime: Read the current time | ||
| 42 | * @clock_getres: Get the clock resolution | ||
| 43 | * @clock_settime: Set the current time value | ||
| 44 | * @timer_create: Create a new timer | ||
| 45 | * @timer_delete: Remove a previously created timer | ||
| 46 | * @timer_gettime: Get remaining time and interval of a timer | ||
| 47 | * @timer_setttime: Set a timer's initial expiration and interval | ||
| 48 | * @fasync: Optional character device fasync method | ||
| 49 | * @mmap: Optional character device mmap method | ||
| 50 | * @open: Optional character device open method | ||
| 51 | * @release: Optional character device release method | ||
| 52 | * @ioctl: Optional character device ioctl method | ||
| 53 | * @read: Optional character device read method | ||
| 54 | * @poll: Optional character device poll method | ||
| 55 | */ | ||
| 56 | struct posix_clock_operations { | ||
| 57 | struct module *owner; | ||
| 58 | |||
| 59 | int (*clock_adjtime)(struct posix_clock *pc, struct timex *tx); | ||
| 60 | |||
| 61 | int (*clock_gettime)(struct posix_clock *pc, struct timespec *ts); | ||
| 62 | |||
| 63 | int (*clock_getres) (struct posix_clock *pc, struct timespec *ts); | ||
| 64 | |||
| 65 | int (*clock_settime)(struct posix_clock *pc, | ||
| 66 | const struct timespec *ts); | ||
| 67 | |||
| 68 | int (*timer_create) (struct posix_clock *pc, struct k_itimer *kit); | ||
| 69 | |||
| 70 | int (*timer_delete) (struct posix_clock *pc, struct k_itimer *kit); | ||
| 71 | |||
| 72 | void (*timer_gettime)(struct posix_clock *pc, | ||
| 73 | struct k_itimer *kit, struct itimerspec *tsp); | ||
| 74 | |||
| 75 | int (*timer_settime)(struct posix_clock *pc, | ||
| 76 | struct k_itimer *kit, int flags, | ||
| 77 | struct itimerspec *tsp, struct itimerspec *old); | ||
| 78 | /* | ||
| 79 | * Optional character device methods: | ||
| 80 | */ | ||
| 81 | int (*fasync) (struct posix_clock *pc, | ||
| 82 | int fd, struct file *file, int on); | ||
| 83 | |||
| 84 | long (*ioctl) (struct posix_clock *pc, | ||
| 85 | unsigned int cmd, unsigned long arg); | ||
| 86 | |||
| 87 | int (*mmap) (struct posix_clock *pc, | ||
| 88 | struct vm_area_struct *vma); | ||
| 89 | |||
| 90 | int (*open) (struct posix_clock *pc, fmode_t f_mode); | ||
| 91 | |||
| 92 | uint (*poll) (struct posix_clock *pc, | ||
| 93 | struct file *file, poll_table *wait); | ||
| 94 | |||
| 95 | int (*release) (struct posix_clock *pc); | ||
| 96 | |||
| 97 | ssize_t (*read) (struct posix_clock *pc, | ||
| 98 | uint flags, char __user *buf, size_t cnt); | ||
| 99 | }; | ||
| 100 | |||
| 101 | /** | ||
| 102 | * struct posix_clock - represents a dynamic posix clock | ||
| 103 | * | ||
| 104 | * @ops: Functional interface to the clock | ||
| 105 | * @cdev: Character device instance for this clock | ||
| 106 | * @kref: Reference count. | ||
| 107 | * @mutex: Protects the 'zombie' field from concurrent access. | ||
| 108 | * @zombie: If 'zombie' is true, then the hardware has disappeared. | ||
| 109 | * @release: A function to free the structure when the reference count reaches | ||
| 110 | * zero. May be NULL if structure is statically allocated. | ||
| 111 | * | ||
| 112 | * Drivers should embed their struct posix_clock within a private | ||
| 113 | * structure, obtaining a reference to it during callbacks using | ||
| 114 | * container_of(). | ||
| 115 | */ | ||
| 116 | struct posix_clock { | ||
| 117 | struct posix_clock_operations ops; | ||
| 118 | struct cdev cdev; | ||
| 119 | struct kref kref; | ||
| 120 | struct mutex mutex; | ||
| 121 | bool zombie; | ||
| 122 | void (*release)(struct posix_clock *clk); | ||
| 123 | }; | ||
| 124 | |||
| 125 | /** | ||
| 126 | * posix_clock_register() - register a new clock | ||
| 127 | * @clk: Pointer to the clock. Caller must provide 'ops' and 'release' | ||
| 128 | * @devid: Allocated device id | ||
| 129 | * | ||
| 130 | * A clock driver calls this function to register itself with the | ||
| 131 | * clock device subsystem. If 'clk' points to dynamically allocated | ||
| 132 | * memory, then the caller must provide a 'release' function to free | ||
| 133 | * that memory. | ||
| 134 | * | ||
| 135 | * Returns zero on success, non-zero otherwise. | ||
| 136 | */ | ||
| 137 | int posix_clock_register(struct posix_clock *clk, dev_t devid); | ||
| 138 | |||
| 139 | /** | ||
| 140 | * posix_clock_unregister() - unregister a clock | ||
| 141 | * @clk: Clock instance previously registered via posix_clock_register() | ||
| 142 | * | ||
| 143 | * A clock driver calls this function to remove itself from the clock | ||
| 144 | * device subsystem. The posix_clock itself will remain (in an | ||
| 145 | * inactive state) until its reference count drops to zero, at which | ||
| 146 | * point it will be deallocated with its 'release' method. | ||
| 147 | */ | ||
| 148 | void posix_clock_unregister(struct posix_clock *clk); | ||
| 149 | |||
| 150 | #endif | ||
diff --git a/include/linux/posix-timers.h b/include/linux/posix-timers.h index 3e23844a6990..d51243ae0726 100644 --- a/include/linux/posix-timers.h +++ b/include/linux/posix-timers.h | |||
| @@ -4,6 +4,7 @@ | |||
| 4 | #include <linux/spinlock.h> | 4 | #include <linux/spinlock.h> |
| 5 | #include <linux/list.h> | 5 | #include <linux/list.h> |
| 6 | #include <linux/sched.h> | 6 | #include <linux/sched.h> |
| 7 | #include <linux/timex.h> | ||
| 7 | 8 | ||
| 8 | union cpu_time_count { | 9 | union cpu_time_count { |
| 9 | cputime_t cpu; | 10 | cputime_t cpu; |
| @@ -17,10 +18,21 @@ struct cpu_timer_list { | |||
| 17 | int firing; | 18 | int firing; |
| 18 | }; | 19 | }; |
| 19 | 20 | ||
| 21 | /* | ||
| 22 | * Bit fields within a clockid: | ||
| 23 | * | ||
| 24 | * The most significant 29 bits hold either a pid or a file descriptor. | ||
| 25 | * | ||
| 26 | * Bit 2 indicates whether a cpu clock refers to a thread or a process. | ||
| 27 | * | ||
| 28 | * Bits 1 and 0 give the type: PROF=0, VIRT=1, SCHED=2, or FD=3. | ||
| 29 | * | ||
| 30 | * A clockid is invalid if bits 2, 1, and 0 are all set. | ||
| 31 | */ | ||
| 20 | #define CPUCLOCK_PID(clock) ((pid_t) ~((clock) >> 3)) | 32 | #define CPUCLOCK_PID(clock) ((pid_t) ~((clock) >> 3)) |
| 21 | #define CPUCLOCK_PERTHREAD(clock) \ | 33 | #define CPUCLOCK_PERTHREAD(clock) \ |
| 22 | (((clock) & (clockid_t) CPUCLOCK_PERTHREAD_MASK) != 0) | 34 | (((clock) & (clockid_t) CPUCLOCK_PERTHREAD_MASK) != 0) |
| 23 | #define CPUCLOCK_PID_MASK 7 | 35 | |
| 24 | #define CPUCLOCK_PERTHREAD_MASK 4 | 36 | #define CPUCLOCK_PERTHREAD_MASK 4 |
| 25 | #define CPUCLOCK_WHICH(clock) ((clock) & (clockid_t) CPUCLOCK_CLOCK_MASK) | 37 | #define CPUCLOCK_WHICH(clock) ((clock) & (clockid_t) CPUCLOCK_CLOCK_MASK) |
| 26 | #define CPUCLOCK_CLOCK_MASK 3 | 38 | #define CPUCLOCK_CLOCK_MASK 3 |
| @@ -28,12 +40,17 @@ struct cpu_timer_list { | |||
| 28 | #define CPUCLOCK_VIRT 1 | 40 | #define CPUCLOCK_VIRT 1 |
| 29 | #define CPUCLOCK_SCHED 2 | 41 | #define CPUCLOCK_SCHED 2 |
| 30 | #define CPUCLOCK_MAX 3 | 42 | #define CPUCLOCK_MAX 3 |
| 43 | #define CLOCKFD CPUCLOCK_MAX | ||
| 44 | #define CLOCKFD_MASK (CPUCLOCK_PERTHREAD_MASK|CPUCLOCK_CLOCK_MASK) | ||
| 31 | 45 | ||
| 32 | #define MAKE_PROCESS_CPUCLOCK(pid, clock) \ | 46 | #define MAKE_PROCESS_CPUCLOCK(pid, clock) \ |
| 33 | ((~(clockid_t) (pid) << 3) | (clockid_t) (clock)) | 47 | ((~(clockid_t) (pid) << 3) | (clockid_t) (clock)) |
| 34 | #define MAKE_THREAD_CPUCLOCK(tid, clock) \ | 48 | #define MAKE_THREAD_CPUCLOCK(tid, clock) \ |
| 35 | MAKE_PROCESS_CPUCLOCK((tid), (clock) | CPUCLOCK_PERTHREAD_MASK) | 49 | MAKE_PROCESS_CPUCLOCK((tid), (clock) | CPUCLOCK_PERTHREAD_MASK) |
| 36 | 50 | ||
| 51 | #define FD_TO_CLOCKID(fd) ((~(clockid_t) (fd) << 3) | CLOCKFD) | ||
| 52 | #define CLOCKID_TO_FD(clk) ((unsigned int) ~((clk) >> 3)) | ||
| 53 | |||
| 37 | /* POSIX.1b interval timer structure. */ | 54 | /* POSIX.1b interval timer structure. */ |
| 38 | struct k_itimer { | 55 | struct k_itimer { |
| 39 | struct list_head list; /* free/ allocate list */ | 56 | struct list_head list; /* free/ allocate list */ |
| @@ -67,10 +84,11 @@ struct k_itimer { | |||
| 67 | }; | 84 | }; |
| 68 | 85 | ||
| 69 | struct k_clock { | 86 | struct k_clock { |
| 70 | int res; /* in nanoseconds */ | ||
| 71 | int (*clock_getres) (const clockid_t which_clock, struct timespec *tp); | 87 | int (*clock_getres) (const clockid_t which_clock, struct timespec *tp); |
| 72 | int (*clock_set) (const clockid_t which_clock, struct timespec * tp); | 88 | int (*clock_set) (const clockid_t which_clock, |
| 89 | const struct timespec *tp); | ||
| 73 | int (*clock_get) (const clockid_t which_clock, struct timespec * tp); | 90 | int (*clock_get) (const clockid_t which_clock, struct timespec * tp); |
| 91 | int (*clock_adj) (const clockid_t which_clock, struct timex *tx); | ||
| 74 | int (*timer_create) (struct k_itimer *timer); | 92 | int (*timer_create) (struct k_itimer *timer); |
| 75 | int (*nsleep) (const clockid_t which_clock, int flags, | 93 | int (*nsleep) (const clockid_t which_clock, int flags, |
| 76 | struct timespec *, struct timespec __user *); | 94 | struct timespec *, struct timespec __user *); |
| @@ -84,28 +102,14 @@ struct k_clock { | |||
| 84 | struct itimerspec * cur_setting); | 102 | struct itimerspec * cur_setting); |
| 85 | }; | 103 | }; |
| 86 | 104 | ||
| 87 | void register_posix_clock(const clockid_t clock_id, struct k_clock *new_clock); | 105 | extern struct k_clock clock_posix_cpu; |
| 106 | extern struct k_clock clock_posix_dynamic; | ||
| 88 | 107 | ||
| 89 | /* error handlers for timer_create, nanosleep and settime */ | 108 | void posix_timers_register_clock(const clockid_t clock_id, struct k_clock *new_clock); |
| 90 | int do_posix_clock_nonanosleep(const clockid_t, int flags, struct timespec *, | ||
| 91 | struct timespec __user *); | ||
| 92 | int do_posix_clock_nosettime(const clockid_t, struct timespec *tp); | ||
| 93 | 109 | ||
| 94 | /* function to call to trigger timer event */ | 110 | /* function to call to trigger timer event */ |
| 95 | int posix_timer_event(struct k_itimer *timr, int si_private); | 111 | int posix_timer_event(struct k_itimer *timr, int si_private); |
| 96 | 112 | ||
| 97 | int posix_cpu_clock_getres(const clockid_t which_clock, struct timespec *ts); | ||
| 98 | int posix_cpu_clock_get(const clockid_t which_clock, struct timespec *ts); | ||
| 99 | int posix_cpu_clock_set(const clockid_t which_clock, const struct timespec *ts); | ||
| 100 | int posix_cpu_timer_create(struct k_itimer *timer); | ||
| 101 | int posix_cpu_nsleep(const clockid_t which_clock, int flags, | ||
| 102 | struct timespec *rqtp, struct timespec __user *rmtp); | ||
| 103 | long posix_cpu_nsleep_restart(struct restart_block *restart_block); | ||
| 104 | int posix_cpu_timer_set(struct k_itimer *timer, int flags, | ||
| 105 | struct itimerspec *new, struct itimerspec *old); | ||
| 106 | int posix_cpu_timer_del(struct k_itimer *timer); | ||
| 107 | void posix_cpu_timer_get(struct k_itimer *timer, struct itimerspec *itp); | ||
| 108 | |||
| 109 | void posix_cpu_timer_schedule(struct k_itimer *timer); | 113 | void posix_cpu_timer_schedule(struct k_itimer *timer); |
| 110 | 114 | ||
| 111 | void run_posix_cpu_timers(struct task_struct *task); | 115 | void run_posix_cpu_timers(struct task_struct *task); |
diff --git a/include/linux/pstore.h b/include/linux/pstore.h new file mode 100644 index 000000000000..41977737bb7d --- /dev/null +++ b/include/linux/pstore.h | |||
| @@ -0,0 +1,60 @@ | |||
| 1 | /* | ||
| 2 | * Persistent Storage - pstore.h | ||
| 3 | * | ||
| 4 | * Copyright (C) 2010 Intel Corporation <tony.luck@intel.com> | ||
| 5 | * | ||
| 6 | * This code is the generic layer to export data records from platform | ||
| 7 | * level persistent storage via a file system. | ||
| 8 | * | ||
| 9 | * This program is free software; you can redistribute it and/or modify | ||
| 10 | * it under the terms of the GNU General Public License version 2 as | ||
| 11 | * published by the Free Software Foundation. | ||
| 12 | * | ||
| 13 | * This program is distributed in the hope that it will be useful, | ||
| 14 | * but WITHOUT ANY WARRANTY; without even the implied warranty of | ||
| 15 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the | ||
| 16 | * GNU General Public License for more details. | ||
| 17 | * | ||
| 18 | * You should have received a copy of the GNU General Public License | ||
| 19 | * along with this program; if not, write to the Free Software | ||
| 20 | * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA | ||
| 21 | */ | ||
| 22 | #ifndef _LINUX_PSTORE_H | ||
| 23 | #define _LINUX_PSTORE_H | ||
| 24 | |||
| 25 | /* types */ | ||
| 26 | enum pstore_type_id { | ||
| 27 | PSTORE_TYPE_DMESG = 0, | ||
| 28 | PSTORE_TYPE_MCE = 1, | ||
| 29 | PSTORE_TYPE_UNKNOWN = 255 | ||
| 30 | }; | ||
| 31 | |||
| 32 | struct pstore_info { | ||
| 33 | struct module *owner; | ||
| 34 | char *name; | ||
| 35 | struct mutex buf_mutex; /* serialize access to 'buf' */ | ||
| 36 | char *buf; | ||
| 37 | size_t bufsize; | ||
| 38 | size_t (*read)(u64 *id, enum pstore_type_id *type, | ||
| 39 | struct timespec *time); | ||
| 40 | u64 (*write)(enum pstore_type_id type, size_t size); | ||
| 41 | int (*erase)(u64 id); | ||
| 42 | }; | ||
| 43 | |||
| 44 | #ifdef CONFIG_PSTORE | ||
| 45 | extern int pstore_register(struct pstore_info *); | ||
| 46 | extern int pstore_write(enum pstore_type_id type, char *buf, size_t size); | ||
| 47 | #else | ||
| 48 | static inline int | ||
| 49 | pstore_register(struct pstore_info *psi) | ||
| 50 | { | ||
| 51 | return -ENODEV; | ||
| 52 | } | ||
| 53 | static inline int | ||
| 54 | pstore_write(enum pstore_type_id type, char *buf, size_t size) | ||
| 55 | { | ||
| 56 | return -ENODEV; | ||
| 57 | } | ||
| 58 | #endif | ||
| 59 | |||
| 60 | #endif /*_LINUX_PSTORE_H*/ | ||
diff --git a/include/linux/ptrace.h b/include/linux/ptrace.h index 092a04f874a8..a1147e5dd245 100644 --- a/include/linux/ptrace.h +++ b/include/linux/ptrace.h | |||
| @@ -102,11 +102,8 @@ | |||
| 102 | 102 | ||
| 103 | extern long arch_ptrace(struct task_struct *child, long request, | 103 | extern long arch_ptrace(struct task_struct *child, long request, |
| 104 | unsigned long addr, unsigned long data); | 104 | unsigned long addr, unsigned long data); |
| 105 | extern int ptrace_traceme(void); | ||
| 106 | extern int ptrace_readdata(struct task_struct *tsk, unsigned long src, char __user *dst, int len); | 105 | extern int ptrace_readdata(struct task_struct *tsk, unsigned long src, char __user *dst, int len); |
| 107 | extern int ptrace_writedata(struct task_struct *tsk, char __user *src, unsigned long dst, int len); | 106 | extern int ptrace_writedata(struct task_struct *tsk, char __user *src, unsigned long dst, int len); |
| 108 | extern int ptrace_attach(struct task_struct *tsk); | ||
| 109 | extern int ptrace_detach(struct task_struct *, unsigned int); | ||
| 110 | extern void ptrace_disable(struct task_struct *); | 107 | extern void ptrace_disable(struct task_struct *); |
| 111 | extern int ptrace_check_attach(struct task_struct *task, int kill); | 108 | extern int ptrace_check_attach(struct task_struct *task, int kill); |
| 112 | extern int ptrace_request(struct task_struct *child, long request, | 109 | extern int ptrace_request(struct task_struct *child, long request, |
diff --git a/include/linux/reiserfs_xattr.h b/include/linux/reiserfs_xattr.h index 3b94c91f20a6..6deef5dc95fb 100644 --- a/include/linux/reiserfs_xattr.h +++ b/include/linux/reiserfs_xattr.h | |||
| @@ -63,6 +63,7 @@ extern const struct xattr_handler reiserfs_xattr_trusted_handler; | |||
| 63 | extern const struct xattr_handler reiserfs_xattr_security_handler; | 63 | extern const struct xattr_handler reiserfs_xattr_security_handler; |
| 64 | #ifdef CONFIG_REISERFS_FS_SECURITY | 64 | #ifdef CONFIG_REISERFS_FS_SECURITY |
| 65 | int reiserfs_security_init(struct inode *dir, struct inode *inode, | 65 | int reiserfs_security_init(struct inode *dir, struct inode *inode, |
| 66 | const struct qstr *qstr, | ||
| 66 | struct reiserfs_security_handle *sec); | 67 | struct reiserfs_security_handle *sec); |
| 67 | int reiserfs_security_write(struct reiserfs_transaction_handle *th, | 68 | int reiserfs_security_write(struct reiserfs_transaction_handle *th, |
| 68 | struct inode *inode, | 69 | struct inode *inode, |
| @@ -130,6 +131,7 @@ static inline void reiserfs_init_xattr_rwsem(struct inode *inode) | |||
| 130 | #ifndef CONFIG_REISERFS_FS_SECURITY | 131 | #ifndef CONFIG_REISERFS_FS_SECURITY |
| 131 | static inline int reiserfs_security_init(struct inode *dir, | 132 | static inline int reiserfs_security_init(struct inode *dir, |
| 132 | struct inode *inode, | 133 | struct inode *inode, |
| 134 | const struct qstr *qstr, | ||
| 133 | struct reiserfs_security_handle *sec) | 135 | struct reiserfs_security_handle *sec) |
| 134 | { | 136 | { |
| 135 | return 0; | 137 | return 0; |
diff --git a/include/linux/ring_buffer.h b/include/linux/ring_buffer.h index 8d3a2486544d..ab38ac80b0f9 100644 --- a/include/linux/ring_buffer.h +++ b/include/linux/ring_buffer.h | |||
| @@ -100,6 +100,8 @@ void ring_buffer_free(struct ring_buffer *buffer); | |||
| 100 | 100 | ||
| 101 | int ring_buffer_resize(struct ring_buffer *buffer, unsigned long size); | 101 | int ring_buffer_resize(struct ring_buffer *buffer, unsigned long size); |
| 102 | 102 | ||
| 103 | void ring_buffer_change_overwrite(struct ring_buffer *buffer, int val); | ||
| 104 | |||
| 103 | struct ring_buffer_event *ring_buffer_lock_reserve(struct ring_buffer *buffer, | 105 | struct ring_buffer_event *ring_buffer_lock_reserve(struct ring_buffer *buffer, |
| 104 | unsigned long length); | 106 | unsigned long length); |
| 105 | int ring_buffer_unlock_commit(struct ring_buffer *buffer, | 107 | int ring_buffer_unlock_commit(struct ring_buffer *buffer, |
diff --git a/include/linux/rio_regs.h b/include/linux/rio_regs.h index d63dcbaea169..9026b30238f3 100644 --- a/include/linux/rio_regs.h +++ b/include/linux/rio_regs.h | |||
| @@ -14,10 +14,12 @@ | |||
| 14 | #define LINUX_RIO_REGS_H | 14 | #define LINUX_RIO_REGS_H |
| 15 | 15 | ||
| 16 | /* | 16 | /* |
| 17 | * In RapidIO, each device has a 2MB configuration space that is | 17 | * In RapidIO, each device has a 16MB configuration space that is |
| 18 | * accessed via maintenance transactions. Portions of configuration | 18 | * accessed via maintenance transactions. Portions of configuration |
| 19 | * space are standardized and/or reserved. | 19 | * space are standardized and/or reserved. |
| 20 | */ | 20 | */ |
| 21 | #define RIO_MAINT_SPACE_SZ 0x1000000 /* 16MB of RapidIO mainenance space */ | ||
| 22 | |||
| 21 | #define RIO_DEV_ID_CAR 0x00 /* [I] Device Identity CAR */ | 23 | #define RIO_DEV_ID_CAR 0x00 /* [I] Device Identity CAR */ |
| 22 | #define RIO_DEV_INFO_CAR 0x04 /* [I] Device Information CAR */ | 24 | #define RIO_DEV_INFO_CAR 0x04 /* [I] Device Information CAR */ |
| 23 | #define RIO_ASM_ID_CAR 0x08 /* [I] Assembly Identity CAR */ | 25 | #define RIO_ASM_ID_CAR 0x08 /* [I] Assembly Identity CAR */ |
diff --git a/include/linux/rtc.h b/include/linux/rtc.h index a0b639f8e805..2ca7e8a78060 100644 --- a/include/linux/rtc.h +++ b/include/linux/rtc.h | |||
| @@ -133,7 +133,6 @@ extern struct class *rtc_class; | |||
| 133 | * The (current) exceptions are mostly filesystem hooks: | 133 | * The (current) exceptions are mostly filesystem hooks: |
| 134 | * - the proc() hook for procfs | 134 | * - the proc() hook for procfs |
| 135 | * - non-ioctl() chardev hooks: open(), release(), read_callback() | 135 | * - non-ioctl() chardev hooks: open(), release(), read_callback() |
| 136 | * - periodic irq calls: irq_set_state(), irq_set_freq() | ||
| 137 | * | 136 | * |
| 138 | * REVISIT those periodic irq calls *do* have ops_lock when they're | 137 | * REVISIT those periodic irq calls *do* have ops_lock when they're |
| 139 | * issued through ioctl() ... | 138 | * issued through ioctl() ... |
| @@ -148,11 +147,8 @@ struct rtc_class_ops { | |||
| 148 | int (*set_alarm)(struct device *, struct rtc_wkalrm *); | 147 | int (*set_alarm)(struct device *, struct rtc_wkalrm *); |
| 149 | int (*proc)(struct device *, struct seq_file *); | 148 | int (*proc)(struct device *, struct seq_file *); |
| 150 | int (*set_mmss)(struct device *, unsigned long secs); | 149 | int (*set_mmss)(struct device *, unsigned long secs); |
| 151 | int (*irq_set_state)(struct device *, int enabled); | ||
| 152 | int (*irq_set_freq)(struct device *, int freq); | ||
| 153 | int (*read_callback)(struct device *, int data); | 150 | int (*read_callback)(struct device *, int data); |
| 154 | int (*alarm_irq_enable)(struct device *, unsigned int enabled); | 151 | int (*alarm_irq_enable)(struct device *, unsigned int enabled); |
| 155 | int (*update_irq_enable)(struct device *, unsigned int enabled); | ||
| 156 | }; | 152 | }; |
| 157 | 153 | ||
| 158 | #define RTC_DEVICE_NAME_SIZE 20 | 154 | #define RTC_DEVICE_NAME_SIZE 20 |
| @@ -203,6 +199,18 @@ struct rtc_device | |||
| 203 | struct hrtimer pie_timer; /* sub second exp, so needs hrtimer */ | 199 | struct hrtimer pie_timer; /* sub second exp, so needs hrtimer */ |
| 204 | int pie_enabled; | 200 | int pie_enabled; |
| 205 | struct work_struct irqwork; | 201 | struct work_struct irqwork; |
| 202 | |||
| 203 | |||
| 204 | #ifdef CONFIG_RTC_INTF_DEV_UIE_EMUL | ||
| 205 | struct work_struct uie_task; | ||
| 206 | struct timer_list uie_timer; | ||
| 207 | /* Those fields are protected by rtc->irq_lock */ | ||
| 208 | unsigned int oldsecs; | ||
| 209 | unsigned int uie_irq_active:1; | ||
| 210 | unsigned int stop_uie_polling:1; | ||
| 211 | unsigned int uie_task_active:1; | ||
| 212 | unsigned int uie_timer_active:1; | ||
| 213 | #endif | ||
| 206 | }; | 214 | }; |
| 207 | #define to_rtc_device(d) container_of(d, struct rtc_device, dev) | 215 | #define to_rtc_device(d) container_of(d, struct rtc_device, dev) |
| 208 | 216 | ||
| @@ -215,6 +223,7 @@ extern void rtc_device_unregister(struct rtc_device *rtc); | |||
| 215 | extern int rtc_read_time(struct rtc_device *rtc, struct rtc_time *tm); | 223 | extern int rtc_read_time(struct rtc_device *rtc, struct rtc_time *tm); |
| 216 | extern int rtc_set_time(struct rtc_device *rtc, struct rtc_time *tm); | 224 | extern int rtc_set_time(struct rtc_device *rtc, struct rtc_time *tm); |
| 217 | extern int rtc_set_mmss(struct rtc_device *rtc, unsigned long secs); | 225 | extern int rtc_set_mmss(struct rtc_device *rtc, unsigned long secs); |
| 226 | int __rtc_read_alarm(struct rtc_device *rtc, struct rtc_wkalrm *alarm); | ||
| 218 | extern int rtc_read_alarm(struct rtc_device *rtc, | 227 | extern int rtc_read_alarm(struct rtc_device *rtc, |
| 219 | struct rtc_wkalrm *alrm); | 228 | struct rtc_wkalrm *alrm); |
| 220 | extern int rtc_set_alarm(struct rtc_device *rtc, | 229 | extern int rtc_set_alarm(struct rtc_device *rtc, |
| @@ -235,7 +244,10 @@ extern int rtc_irq_set_freq(struct rtc_device *rtc, | |||
| 235 | struct rtc_task *task, int freq); | 244 | struct rtc_task *task, int freq); |
| 236 | extern int rtc_update_irq_enable(struct rtc_device *rtc, unsigned int enabled); | 245 | extern int rtc_update_irq_enable(struct rtc_device *rtc, unsigned int enabled); |
| 237 | extern int rtc_alarm_irq_enable(struct rtc_device *rtc, unsigned int enabled); | 246 | extern int rtc_alarm_irq_enable(struct rtc_device *rtc, unsigned int enabled); |
| 247 | extern int rtc_dev_update_irq_enable_emul(struct rtc_device *rtc, | ||
| 248 | unsigned int enabled); | ||
| 238 | 249 | ||
| 250 | void rtc_handle_legacy_irq(struct rtc_device *rtc, int num, int mode); | ||
| 239 | void rtc_aie_update_irq(void *private); | 251 | void rtc_aie_update_irq(void *private); |
| 240 | void rtc_uie_update_irq(void *private); | 252 | void rtc_uie_update_irq(void *private); |
| 241 | enum hrtimer_restart rtc_pie_update_irq(struct hrtimer *timer); | 253 | enum hrtimer_restart rtc_pie_update_irq(struct hrtimer *timer); |
diff --git a/include/linux/rwlock_types.h b/include/linux/rwlock_types.h index bd31808c7d8e..cc0072e93e36 100644 --- a/include/linux/rwlock_types.h +++ b/include/linux/rwlock_types.h | |||
| @@ -43,14 +43,6 @@ typedef struct { | |||
| 43 | RW_DEP_MAP_INIT(lockname) } | 43 | RW_DEP_MAP_INIT(lockname) } |
| 44 | #endif | 44 | #endif |
| 45 | 45 | ||
| 46 | /* | ||
| 47 | * RW_LOCK_UNLOCKED defeat lockdep state tracking and is hence | ||
| 48 | * deprecated. | ||
| 49 | * | ||
| 50 | * Please use DEFINE_RWLOCK() or __RW_LOCK_UNLOCKED() as appropriate. | ||
| 51 | */ | ||
| 52 | #define RW_LOCK_UNLOCKED __RW_LOCK_UNLOCKED(old_style_rw_init) | ||
| 53 | |||
| 54 | #define DEFINE_RWLOCK(x) rwlock_t x = __RW_LOCK_UNLOCKED(x) | 46 | #define DEFINE_RWLOCK(x) rwlock_t x = __RW_LOCK_UNLOCKED(x) |
| 55 | 47 | ||
| 56 | #endif /* __LINUX_RWLOCK_TYPES_H */ | 48 | #endif /* __LINUX_RWLOCK_TYPES_H */ |
diff --git a/include/linux/rwsem-spinlock.h b/include/linux/rwsem-spinlock.h index bdfcc2527970..34701241b673 100644 --- a/include/linux/rwsem-spinlock.h +++ b/include/linux/rwsem-spinlock.h | |||
| @@ -12,15 +12,7 @@ | |||
| 12 | #error "please don't include linux/rwsem-spinlock.h directly, use linux/rwsem.h instead" | 12 | #error "please don't include linux/rwsem-spinlock.h directly, use linux/rwsem.h instead" |
| 13 | #endif | 13 | #endif |
| 14 | 14 | ||
| 15 | #include <linux/spinlock.h> | ||
| 16 | #include <linux/list.h> | ||
| 17 | |||
| 18 | #ifdef __KERNEL__ | 15 | #ifdef __KERNEL__ |
| 19 | |||
| 20 | #include <linux/types.h> | ||
| 21 | |||
| 22 | struct rwsem_waiter; | ||
| 23 | |||
| 24 | /* | 16 | /* |
| 25 | * the rw-semaphore definition | 17 | * the rw-semaphore definition |
| 26 | * - if activity is 0 then there are no active readers or writers | 18 | * - if activity is 0 then there are no active readers or writers |
| @@ -37,28 +29,7 @@ struct rw_semaphore { | |||
| 37 | #endif | 29 | #endif |
| 38 | }; | 30 | }; |
| 39 | 31 | ||
| 40 | #ifdef CONFIG_DEBUG_LOCK_ALLOC | 32 | #define RWSEM_UNLOCKED_VALUE 0x00000000 |
| 41 | # define __RWSEM_DEP_MAP_INIT(lockname) , .dep_map = { .name = #lockname } | ||
| 42 | #else | ||
| 43 | # define __RWSEM_DEP_MAP_INIT(lockname) | ||
| 44 | #endif | ||
| 45 | |||
| 46 | #define __RWSEM_INITIALIZER(name) \ | ||
| 47 | { 0, __SPIN_LOCK_UNLOCKED(name.wait_lock), LIST_HEAD_INIT((name).wait_list) \ | ||
| 48 | __RWSEM_DEP_MAP_INIT(name) } | ||
| 49 | |||
| 50 | #define DECLARE_RWSEM(name) \ | ||
| 51 | struct rw_semaphore name = __RWSEM_INITIALIZER(name) | ||
| 52 | |||
| 53 | extern void __init_rwsem(struct rw_semaphore *sem, const char *name, | ||
| 54 | struct lock_class_key *key); | ||
| 55 | |||
| 56 | #define init_rwsem(sem) \ | ||
| 57 | do { \ | ||
| 58 | static struct lock_class_key __key; \ | ||
| 59 | \ | ||
| 60 | __init_rwsem((sem), #sem, &__key); \ | ||
| 61 | } while (0) | ||
| 62 | 33 | ||
| 63 | extern void __down_read(struct rw_semaphore *sem); | 34 | extern void __down_read(struct rw_semaphore *sem); |
| 64 | extern int __down_read_trylock(struct rw_semaphore *sem); | 35 | extern int __down_read_trylock(struct rw_semaphore *sem); |
diff --git a/include/linux/rwsem.h b/include/linux/rwsem.h index efd348fe8ca7..a8afe9cd000c 100644 --- a/include/linux/rwsem.h +++ b/include/linux/rwsem.h | |||
| @@ -11,6 +11,9 @@ | |||
| 11 | 11 | ||
| 12 | #include <linux/types.h> | 12 | #include <linux/types.h> |
| 13 | #include <linux/kernel.h> | 13 | #include <linux/kernel.h> |
| 14 | #include <linux/list.h> | ||
| 15 | #include <linux/spinlock.h> | ||
| 16 | |||
| 14 | #include <asm/system.h> | 17 | #include <asm/system.h> |
| 15 | #include <asm/atomic.h> | 18 | #include <asm/atomic.h> |
| 16 | 19 | ||
| @@ -19,9 +22,57 @@ struct rw_semaphore; | |||
| 19 | #ifdef CONFIG_RWSEM_GENERIC_SPINLOCK | 22 | #ifdef CONFIG_RWSEM_GENERIC_SPINLOCK |
| 20 | #include <linux/rwsem-spinlock.h> /* use a generic implementation */ | 23 | #include <linux/rwsem-spinlock.h> /* use a generic implementation */ |
| 21 | #else | 24 | #else |
| 22 | #include <asm/rwsem.h> /* use an arch-specific implementation */ | 25 | /* All arch specific implementations share the same struct */ |
| 26 | struct rw_semaphore { | ||
| 27 | long count; | ||
| 28 | spinlock_t wait_lock; | ||
| 29 | struct list_head wait_list; | ||
| 30 | #ifdef CONFIG_DEBUG_LOCK_ALLOC | ||
| 31 | struct lockdep_map dep_map; | ||
| 32 | #endif | ||
| 33 | }; | ||
| 34 | |||
| 35 | extern struct rw_semaphore *rwsem_down_read_failed(struct rw_semaphore *sem); | ||
| 36 | extern struct rw_semaphore *rwsem_down_write_failed(struct rw_semaphore *sem); | ||
| 37 | extern struct rw_semaphore *rwsem_wake(struct rw_semaphore *); | ||
| 38 | extern struct rw_semaphore *rwsem_downgrade_wake(struct rw_semaphore *sem); | ||
| 39 | |||
| 40 | /* Include the arch specific part */ | ||
| 41 | #include <asm/rwsem.h> | ||
| 42 | |||
| 43 | /* In all implementations count != 0 means locked */ | ||
| 44 | static inline int rwsem_is_locked(struct rw_semaphore *sem) | ||
| 45 | { | ||
| 46 | return sem->count != 0; | ||
| 47 | } | ||
| 48 | |||
| 49 | #endif | ||
| 50 | |||
| 51 | /* Common initializer macros and functions */ | ||
| 52 | |||
| 53 | #ifdef CONFIG_DEBUG_LOCK_ALLOC | ||
| 54 | # define __RWSEM_DEP_MAP_INIT(lockname) , .dep_map = { .name = #lockname } | ||
| 55 | #else | ||
| 56 | # define __RWSEM_DEP_MAP_INIT(lockname) | ||
| 23 | #endif | 57 | #endif |
| 24 | 58 | ||
| 59 | #define __RWSEM_INITIALIZER(name) \ | ||
| 60 | { RWSEM_UNLOCKED_VALUE, __SPIN_LOCK_UNLOCKED(name.wait_lock), \ | ||
| 61 | LIST_HEAD_INIT((name).wait_list) __RWSEM_DEP_MAP_INIT(name) } | ||
| 62 | |||
| 63 | #define DECLARE_RWSEM(name) \ | ||
| 64 | struct rw_semaphore name = __RWSEM_INITIALIZER(name) | ||
| 65 | |||
| 66 | extern void __init_rwsem(struct rw_semaphore *sem, const char *name, | ||
| 67 | struct lock_class_key *key); | ||
| 68 | |||
| 69 | #define init_rwsem(sem) \ | ||
| 70 | do { \ | ||
| 71 | static struct lock_class_key __key; \ | ||
| 72 | \ | ||
| 73 | __init_rwsem((sem), #sem, &__key); \ | ||
| 74 | } while (0) | ||
| 75 | |||
| 25 | /* | 76 | /* |
| 26 | * lock for reading | 77 | * lock for reading |
| 27 | */ | 78 | */ |
diff --git a/include/linux/sched.h b/include/linux/sched.h index d747f948b34e..c15936fe998b 100644 --- a/include/linux/sched.h +++ b/include/linux/sched.h | |||
| @@ -1058,6 +1058,7 @@ struct sched_class { | |||
| 1058 | void (*enqueue_task) (struct rq *rq, struct task_struct *p, int flags); | 1058 | void (*enqueue_task) (struct rq *rq, struct task_struct *p, int flags); |
| 1059 | void (*dequeue_task) (struct rq *rq, struct task_struct *p, int flags); | 1059 | void (*dequeue_task) (struct rq *rq, struct task_struct *p, int flags); |
| 1060 | void (*yield_task) (struct rq *rq); | 1060 | void (*yield_task) (struct rq *rq); |
| 1061 | bool (*yield_to_task) (struct rq *rq, struct task_struct *p, bool preempt); | ||
| 1061 | 1062 | ||
| 1062 | void (*check_preempt_curr) (struct rq *rq, struct task_struct *p, int flags); | 1063 | void (*check_preempt_curr) (struct rq *rq, struct task_struct *p, int flags); |
| 1063 | 1064 | ||
| @@ -1084,12 +1085,10 @@ struct sched_class { | |||
| 1084 | void (*task_tick) (struct rq *rq, struct task_struct *p, int queued); | 1085 | void (*task_tick) (struct rq *rq, struct task_struct *p, int queued); |
| 1085 | void (*task_fork) (struct task_struct *p); | 1086 | void (*task_fork) (struct task_struct *p); |
| 1086 | 1087 | ||
| 1087 | void (*switched_from) (struct rq *this_rq, struct task_struct *task, | 1088 | void (*switched_from) (struct rq *this_rq, struct task_struct *task); |
| 1088 | int running); | 1089 | void (*switched_to) (struct rq *this_rq, struct task_struct *task); |
| 1089 | void (*switched_to) (struct rq *this_rq, struct task_struct *task, | ||
| 1090 | int running); | ||
| 1091 | void (*prio_changed) (struct rq *this_rq, struct task_struct *task, | 1090 | void (*prio_changed) (struct rq *this_rq, struct task_struct *task, |
| 1092 | int oldprio, int running); | 1091 | int oldprio); |
| 1093 | 1092 | ||
| 1094 | unsigned int (*get_rr_interval) (struct rq *rq, | 1093 | unsigned int (*get_rr_interval) (struct rq *rq, |
| 1095 | struct task_struct *task); | 1094 | struct task_struct *task); |
| @@ -1715,7 +1714,6 @@ extern void thread_group_times(struct task_struct *p, cputime_t *ut, cputime_t * | |||
| 1715 | /* | 1714 | /* |
| 1716 | * Per process flags | 1715 | * Per process flags |
| 1717 | */ | 1716 | */ |
| 1718 | #define PF_KSOFTIRQD 0x00000001 /* I am ksoftirqd */ | ||
| 1719 | #define PF_STARTING 0x00000002 /* being created */ | 1717 | #define PF_STARTING 0x00000002 /* being created */ |
| 1720 | #define PF_EXITING 0x00000004 /* getting shut down */ | 1718 | #define PF_EXITING 0x00000004 /* getting shut down */ |
| 1721 | #define PF_EXITPIDONE 0x00000008 /* pi exit done on shut down */ | 1719 | #define PF_EXITPIDONE 0x00000008 /* pi exit done on shut down */ |
| @@ -1744,7 +1742,7 @@ extern void thread_group_times(struct task_struct *p, cputime_t *ut, cputime_t * | |||
| 1744 | #define PF_MCE_EARLY 0x08000000 /* Early kill for mce process policy */ | 1742 | #define PF_MCE_EARLY 0x08000000 /* Early kill for mce process policy */ |
| 1745 | #define PF_MEMPOLICY 0x10000000 /* Non-default NUMA mempolicy */ | 1743 | #define PF_MEMPOLICY 0x10000000 /* Non-default NUMA mempolicy */ |
| 1746 | #define PF_MUTEX_TESTER 0x20000000 /* Thread belongs to the rt mutex tester */ | 1744 | #define PF_MUTEX_TESTER 0x20000000 /* Thread belongs to the rt mutex tester */ |
| 1747 | #define PF_FREEZER_SKIP 0x40000000 /* Freezer should not count it as freezeable */ | 1745 | #define PF_FREEZER_SKIP 0x40000000 /* Freezer should not count it as freezable */ |
| 1748 | #define PF_FREEZER_NOSIG 0x80000000 /* Freezer won't send signals to it */ | 1746 | #define PF_FREEZER_NOSIG 0x80000000 /* Freezer won't send signals to it */ |
| 1749 | 1747 | ||
| 1750 | /* | 1748 | /* |
| @@ -1945,8 +1943,6 @@ int sched_rt_handler(struct ctl_table *table, int write, | |||
| 1945 | void __user *buffer, size_t *lenp, | 1943 | void __user *buffer, size_t *lenp, |
| 1946 | loff_t *ppos); | 1944 | loff_t *ppos); |
| 1947 | 1945 | ||
| 1948 | extern unsigned int sysctl_sched_compat_yield; | ||
| 1949 | |||
| 1950 | #ifdef CONFIG_SCHED_AUTOGROUP | 1946 | #ifdef CONFIG_SCHED_AUTOGROUP |
| 1951 | extern unsigned int sysctl_sched_autogroup_enabled; | 1947 | extern unsigned int sysctl_sched_autogroup_enabled; |
| 1952 | 1948 | ||
| @@ -1977,6 +1973,7 @@ static inline int rt_mutex_getprio(struct task_struct *p) | |||
| 1977 | # define rt_mutex_adjust_pi(p) do { } while (0) | 1973 | # define rt_mutex_adjust_pi(p) do { } while (0) |
| 1978 | #endif | 1974 | #endif |
| 1979 | 1975 | ||
| 1976 | extern bool yield_to(struct task_struct *p, bool preempt); | ||
| 1980 | extern void set_user_nice(struct task_struct *p, long nice); | 1977 | extern void set_user_nice(struct task_struct *p, long nice); |
| 1981 | extern int task_prio(const struct task_struct *p); | 1978 | extern int task_prio(const struct task_struct *p); |
| 1982 | extern int task_nice(const struct task_struct *p); | 1979 | extern int task_nice(const struct task_struct *p); |
| @@ -2049,7 +2046,7 @@ extern void release_uids(struct user_namespace *ns); | |||
| 2049 | 2046 | ||
| 2050 | #include <asm/current.h> | 2047 | #include <asm/current.h> |
| 2051 | 2048 | ||
| 2052 | extern void do_timer(unsigned long ticks); | 2049 | extern void xtime_update(unsigned long ticks); |
| 2053 | 2050 | ||
| 2054 | extern int wake_up_state(struct task_struct *tsk, unsigned int state); | 2051 | extern int wake_up_state(struct task_struct *tsk, unsigned int state); |
| 2055 | extern int wake_up_process(struct task_struct *tsk); | 2052 | extern int wake_up_process(struct task_struct *tsk); |
| @@ -2578,13 +2575,6 @@ static inline void inc_syscw(struct task_struct *tsk) | |||
| 2578 | #define TASK_SIZE_OF(tsk) TASK_SIZE | 2575 | #define TASK_SIZE_OF(tsk) TASK_SIZE |
| 2579 | #endif | 2576 | #endif |
| 2580 | 2577 | ||
| 2581 | /* | ||
| 2582 | * Call the function if the target task is executing on a CPU right now: | ||
| 2583 | */ | ||
| 2584 | extern void task_oncpu_function_call(struct task_struct *p, | ||
| 2585 | void (*func) (void *info), void *info); | ||
| 2586 | |||
| 2587 | |||
| 2588 | #ifdef CONFIG_MM_OWNER | 2578 | #ifdef CONFIG_MM_OWNER |
| 2589 | extern void mm_update_next_owner(struct mm_struct *mm); | 2579 | extern void mm_update_next_owner(struct mm_struct *mm); |
| 2590 | extern void mm_init_owner(struct mm_struct *mm, struct task_struct *p); | 2580 | extern void mm_init_owner(struct mm_struct *mm, struct task_struct *p); |
diff --git a/include/linux/security.h b/include/linux/security.h index b2b7f9749f5e..56cac520d014 100644 --- a/include/linux/security.h +++ b/include/linux/security.h | |||
| @@ -25,6 +25,7 @@ | |||
| 25 | #include <linux/fs.h> | 25 | #include <linux/fs.h> |
| 26 | #include <linux/fsnotify.h> | 26 | #include <linux/fsnotify.h> |
| 27 | #include <linux/binfmts.h> | 27 | #include <linux/binfmts.h> |
| 28 | #include <linux/dcache.h> | ||
| 28 | #include <linux/signal.h> | 29 | #include <linux/signal.h> |
| 29 | #include <linux/resource.h> | 30 | #include <linux/resource.h> |
| 30 | #include <linux/sem.h> | 31 | #include <linux/sem.h> |
| @@ -53,7 +54,7 @@ struct audit_krule; | |||
| 53 | */ | 54 | */ |
| 54 | extern int cap_capable(struct task_struct *tsk, const struct cred *cred, | 55 | extern int cap_capable(struct task_struct *tsk, const struct cred *cred, |
| 55 | int cap, int audit); | 56 | int cap, int audit); |
| 56 | extern int cap_settime(struct timespec *ts, struct timezone *tz); | 57 | extern int cap_settime(const struct timespec *ts, const struct timezone *tz); |
| 57 | extern int cap_ptrace_access_check(struct task_struct *child, unsigned int mode); | 58 | extern int cap_ptrace_access_check(struct task_struct *child, unsigned int mode); |
| 58 | extern int cap_ptrace_traceme(struct task_struct *parent); | 59 | extern int cap_ptrace_traceme(struct task_struct *parent); |
| 59 | extern int cap_capget(struct task_struct *target, kernel_cap_t *effective, kernel_cap_t *inheritable, kernel_cap_t *permitted); | 60 | extern int cap_capget(struct task_struct *target, kernel_cap_t *effective, kernel_cap_t *inheritable, kernel_cap_t *permitted); |
| @@ -267,6 +268,12 @@ static inline void security_free_mnt_opts(struct security_mnt_opts *opts) | |||
| 267 | * @orig the original mount data copied from userspace. | 268 | * @orig the original mount data copied from userspace. |
| 268 | * @copy copied data which will be passed to the security module. | 269 | * @copy copied data which will be passed to the security module. |
| 269 | * Returns 0 if the copy was successful. | 270 | * Returns 0 if the copy was successful. |
| 271 | * @sb_remount: | ||
| 272 | * Extracts security system specifc mount options and verifys no changes | ||
| 273 | * are being made to those options. | ||
| 274 | * @sb superblock being remounted | ||
| 275 | * @data contains the filesystem-specific data. | ||
| 276 | * Return 0 if permission is granted. | ||
| 270 | * @sb_umount: | 277 | * @sb_umount: |
| 271 | * Check permission before the @mnt file system is unmounted. | 278 | * Check permission before the @mnt file system is unmounted. |
| 272 | * @mnt contains the mounted file system. | 279 | * @mnt contains the mounted file system. |
| @@ -315,6 +322,7 @@ static inline void security_free_mnt_opts(struct security_mnt_opts *opts) | |||
| 315 | * then it should return -EOPNOTSUPP to skip this processing. | 322 | * then it should return -EOPNOTSUPP to skip this processing. |
| 316 | * @inode contains the inode structure of the newly created inode. | 323 | * @inode contains the inode structure of the newly created inode. |
| 317 | * @dir contains the inode structure of the parent directory. | 324 | * @dir contains the inode structure of the parent directory. |
| 325 | * @qstr contains the last path component of the new object | ||
| 318 | * @name will be set to the allocated name suffix (e.g. selinux). | 326 | * @name will be set to the allocated name suffix (e.g. selinux). |
| 319 | * @value will be set to the allocated attribute value. | 327 | * @value will be set to the allocated attribute value. |
| 320 | * @len will be set to the length of the value. | 328 | * @len will be set to the length of the value. |
| @@ -1257,12 +1265,6 @@ static inline void security_free_mnt_opts(struct security_mnt_opts *opts) | |||
| 1257 | * @cap contains the capability <include/linux/capability.h>. | 1265 | * @cap contains the capability <include/linux/capability.h>. |
| 1258 | * @audit: Whether to write an audit message or not | 1266 | * @audit: Whether to write an audit message or not |
| 1259 | * Return 0 if the capability is granted for @tsk. | 1267 | * Return 0 if the capability is granted for @tsk. |
| 1260 | * @sysctl: | ||
| 1261 | * Check permission before accessing the @table sysctl variable in the | ||
| 1262 | * manner specified by @op. | ||
| 1263 | * @table contains the ctl_table structure for the sysctl variable. | ||
| 1264 | * @op contains the operation (001 = search, 002 = write, 004 = read). | ||
| 1265 | * Return 0 if permission is granted. | ||
| 1266 | * @syslog: | 1268 | * @syslog: |
| 1267 | * Check permission before accessing the kernel message ring or changing | 1269 | * Check permission before accessing the kernel message ring or changing |
| 1268 | * logging to the console. | 1270 | * logging to the console. |
| @@ -1383,11 +1385,10 @@ struct security_operations { | |||
| 1383 | const kernel_cap_t *permitted); | 1385 | const kernel_cap_t *permitted); |
| 1384 | int (*capable) (struct task_struct *tsk, const struct cred *cred, | 1386 | int (*capable) (struct task_struct *tsk, const struct cred *cred, |
| 1385 | int cap, int audit); | 1387 | int cap, int audit); |
| 1386 | int (*sysctl) (struct ctl_table *table, int op); | ||
| 1387 | int (*quotactl) (int cmds, int type, int id, struct super_block *sb); | 1388 | int (*quotactl) (int cmds, int type, int id, struct super_block *sb); |
| 1388 | int (*quota_on) (struct dentry *dentry); | 1389 | int (*quota_on) (struct dentry *dentry); |
| 1389 | int (*syslog) (int type); | 1390 | int (*syslog) (int type); |
| 1390 | int (*settime) (struct timespec *ts, struct timezone *tz); | 1391 | int (*settime) (const struct timespec *ts, const struct timezone *tz); |
| 1391 | int (*vm_enough_memory) (struct mm_struct *mm, long pages); | 1392 | int (*vm_enough_memory) (struct mm_struct *mm, long pages); |
| 1392 | 1393 | ||
| 1393 | int (*bprm_set_creds) (struct linux_binprm *bprm); | 1394 | int (*bprm_set_creds) (struct linux_binprm *bprm); |
| @@ -1399,6 +1400,7 @@ struct security_operations { | |||
| 1399 | int (*sb_alloc_security) (struct super_block *sb); | 1400 | int (*sb_alloc_security) (struct super_block *sb); |
| 1400 | void (*sb_free_security) (struct super_block *sb); | 1401 | void (*sb_free_security) (struct super_block *sb); |
| 1401 | int (*sb_copy_data) (char *orig, char *copy); | 1402 | int (*sb_copy_data) (char *orig, char *copy); |
| 1403 | int (*sb_remount) (struct super_block *sb, void *data); | ||
| 1402 | int (*sb_kern_mount) (struct super_block *sb, int flags, void *data); | 1404 | int (*sb_kern_mount) (struct super_block *sb, int flags, void *data); |
| 1403 | int (*sb_show_options) (struct seq_file *m, struct super_block *sb); | 1405 | int (*sb_show_options) (struct seq_file *m, struct super_block *sb); |
| 1404 | int (*sb_statfs) (struct dentry *dentry); | 1406 | int (*sb_statfs) (struct dentry *dentry); |
| @@ -1435,7 +1437,8 @@ struct security_operations { | |||
| 1435 | int (*inode_alloc_security) (struct inode *inode); | 1437 | int (*inode_alloc_security) (struct inode *inode); |
| 1436 | void (*inode_free_security) (struct inode *inode); | 1438 | void (*inode_free_security) (struct inode *inode); |
| 1437 | int (*inode_init_security) (struct inode *inode, struct inode *dir, | 1439 | int (*inode_init_security) (struct inode *inode, struct inode *dir, |
| 1438 | char **name, void **value, size_t *len); | 1440 | const struct qstr *qstr, char **name, |
| 1441 | void **value, size_t *len); | ||
| 1439 | int (*inode_create) (struct inode *dir, | 1442 | int (*inode_create) (struct inode *dir, |
| 1440 | struct dentry *dentry, int mode); | 1443 | struct dentry *dentry, int mode); |
| 1441 | int (*inode_link) (struct dentry *old_dentry, | 1444 | int (*inode_link) (struct dentry *old_dentry, |
| @@ -1623,7 +1626,7 @@ struct security_operations { | |||
| 1623 | int (*xfrm_policy_lookup) (struct xfrm_sec_ctx *ctx, u32 fl_secid, u8 dir); | 1626 | int (*xfrm_policy_lookup) (struct xfrm_sec_ctx *ctx, u32 fl_secid, u8 dir); |
| 1624 | int (*xfrm_state_pol_flow_match) (struct xfrm_state *x, | 1627 | int (*xfrm_state_pol_flow_match) (struct xfrm_state *x, |
| 1625 | struct xfrm_policy *xp, | 1628 | struct xfrm_policy *xp, |
| 1626 | struct flowi *fl); | 1629 | const struct flowi *fl); |
| 1627 | int (*xfrm_decode_session) (struct sk_buff *skb, u32 *secid, int ckall); | 1630 | int (*xfrm_decode_session) (struct sk_buff *skb, u32 *secid, int ckall); |
| 1628 | #endif /* CONFIG_SECURITY_NETWORK_XFRM */ | 1631 | #endif /* CONFIG_SECURITY_NETWORK_XFRM */ |
| 1629 | 1632 | ||
| @@ -1665,11 +1668,10 @@ int security_capset(struct cred *new, const struct cred *old, | |||
| 1665 | int security_capable(const struct cred *cred, int cap); | 1668 | int security_capable(const struct cred *cred, int cap); |
| 1666 | int security_real_capable(struct task_struct *tsk, int cap); | 1669 | int security_real_capable(struct task_struct *tsk, int cap); |
| 1667 | int security_real_capable_noaudit(struct task_struct *tsk, int cap); | 1670 | int security_real_capable_noaudit(struct task_struct *tsk, int cap); |
| 1668 | int security_sysctl(struct ctl_table *table, int op); | ||
| 1669 | int security_quotactl(int cmds, int type, int id, struct super_block *sb); | 1671 | int security_quotactl(int cmds, int type, int id, struct super_block *sb); |
| 1670 | int security_quota_on(struct dentry *dentry); | 1672 | int security_quota_on(struct dentry *dentry); |
| 1671 | int security_syslog(int type); | 1673 | int security_syslog(int type); |
| 1672 | int security_settime(struct timespec *ts, struct timezone *tz); | 1674 | int security_settime(const struct timespec *ts, const struct timezone *tz); |
| 1673 | int security_vm_enough_memory(long pages); | 1675 | int security_vm_enough_memory(long pages); |
| 1674 | int security_vm_enough_memory_mm(struct mm_struct *mm, long pages); | 1676 | int security_vm_enough_memory_mm(struct mm_struct *mm, long pages); |
| 1675 | int security_vm_enough_memory_kern(long pages); | 1677 | int security_vm_enough_memory_kern(long pages); |
| @@ -1681,6 +1683,7 @@ int security_bprm_secureexec(struct linux_binprm *bprm); | |||
| 1681 | int security_sb_alloc(struct super_block *sb); | 1683 | int security_sb_alloc(struct super_block *sb); |
| 1682 | void security_sb_free(struct super_block *sb); | 1684 | void security_sb_free(struct super_block *sb); |
| 1683 | int security_sb_copy_data(char *orig, char *copy); | 1685 | int security_sb_copy_data(char *orig, char *copy); |
| 1686 | int security_sb_remount(struct super_block *sb, void *data); | ||
| 1684 | int security_sb_kern_mount(struct super_block *sb, int flags, void *data); | 1687 | int security_sb_kern_mount(struct super_block *sb, int flags, void *data); |
| 1685 | int security_sb_show_options(struct seq_file *m, struct super_block *sb); | 1688 | int security_sb_show_options(struct seq_file *m, struct super_block *sb); |
| 1686 | int security_sb_statfs(struct dentry *dentry); | 1689 | int security_sb_statfs(struct dentry *dentry); |
| @@ -1696,7 +1699,8 @@ int security_sb_parse_opts_str(char *options, struct security_mnt_opts *opts); | |||
| 1696 | int security_inode_alloc(struct inode *inode); | 1699 | int security_inode_alloc(struct inode *inode); |
| 1697 | void security_inode_free(struct inode *inode); | 1700 | void security_inode_free(struct inode *inode); |
| 1698 | int security_inode_init_security(struct inode *inode, struct inode *dir, | 1701 | int security_inode_init_security(struct inode *inode, struct inode *dir, |
| 1699 | char **name, void **value, size_t *len); | 1702 | const struct qstr *qstr, char **name, |
| 1703 | void **value, size_t *len); | ||
| 1700 | int security_inode_create(struct inode *dir, struct dentry *dentry, int mode); | 1704 | int security_inode_create(struct inode *dir, struct dentry *dentry, int mode); |
| 1701 | int security_inode_link(struct dentry *old_dentry, struct inode *dir, | 1705 | int security_inode_link(struct dentry *old_dentry, struct inode *dir, |
| 1702 | struct dentry *new_dentry); | 1706 | struct dentry *new_dentry); |
| @@ -1883,11 +1887,6 @@ int security_real_capable_noaudit(struct task_struct *tsk, int cap) | |||
| 1883 | return ret; | 1887 | return ret; |
| 1884 | } | 1888 | } |
| 1885 | 1889 | ||
| 1886 | static inline int security_sysctl(struct ctl_table *table, int op) | ||
| 1887 | { | ||
| 1888 | return 0; | ||
| 1889 | } | ||
| 1890 | |||
| 1891 | static inline int security_quotactl(int cmds, int type, int id, | 1890 | static inline int security_quotactl(int cmds, int type, int id, |
| 1892 | struct super_block *sb) | 1891 | struct super_block *sb) |
| 1893 | { | 1892 | { |
| @@ -1904,7 +1903,8 @@ static inline int security_syslog(int type) | |||
| 1904 | return 0; | 1903 | return 0; |
| 1905 | } | 1904 | } |
| 1906 | 1905 | ||
| 1907 | static inline int security_settime(struct timespec *ts, struct timezone *tz) | 1906 | static inline int security_settime(const struct timespec *ts, |
| 1907 | const struct timezone *tz) | ||
| 1908 | { | 1908 | { |
| 1909 | return cap_settime(ts, tz); | 1909 | return cap_settime(ts, tz); |
| 1910 | } | 1910 | } |
| @@ -1964,6 +1964,11 @@ static inline int security_sb_copy_data(char *orig, char *copy) | |||
| 1964 | return 0; | 1964 | return 0; |
| 1965 | } | 1965 | } |
| 1966 | 1966 | ||
| 1967 | static inline int security_sb_remount(struct super_block *sb, void *data) | ||
| 1968 | { | ||
| 1969 | return 0; | ||
| 1970 | } | ||
| 1971 | |||
| 1967 | static inline int security_sb_kern_mount(struct super_block *sb, int flags, void *data) | 1972 | static inline int security_sb_kern_mount(struct super_block *sb, int flags, void *data) |
| 1968 | { | 1973 | { |
| 1969 | return 0; | 1974 | return 0; |
| @@ -2023,6 +2028,7 @@ static inline void security_inode_free(struct inode *inode) | |||
| 2023 | 2028 | ||
| 2024 | static inline int security_inode_init_security(struct inode *inode, | 2029 | static inline int security_inode_init_security(struct inode *inode, |
| 2025 | struct inode *dir, | 2030 | struct inode *dir, |
| 2031 | const struct qstr *qstr, | ||
| 2026 | char **name, | 2032 | char **name, |
| 2027 | void **value, | 2033 | void **value, |
| 2028 | size_t *len) | 2034 | size_t *len) |
| @@ -2761,7 +2767,8 @@ int security_xfrm_state_delete(struct xfrm_state *x); | |||
| 2761 | void security_xfrm_state_free(struct xfrm_state *x); | 2767 | void security_xfrm_state_free(struct xfrm_state *x); |
| 2762 | int security_xfrm_policy_lookup(struct xfrm_sec_ctx *ctx, u32 fl_secid, u8 dir); | 2768 | int security_xfrm_policy_lookup(struct xfrm_sec_ctx *ctx, u32 fl_secid, u8 dir); |
| 2763 | int security_xfrm_state_pol_flow_match(struct xfrm_state *x, | 2769 | int security_xfrm_state_pol_flow_match(struct xfrm_state *x, |
| 2764 | struct xfrm_policy *xp, struct flowi *fl); | 2770 | struct xfrm_policy *xp, |
| 2771 | const struct flowi *fl); | ||
| 2765 | int security_xfrm_decode_session(struct sk_buff *skb, u32 *secid); | 2772 | int security_xfrm_decode_session(struct sk_buff *skb, u32 *secid); |
| 2766 | void security_skb_classify_flow(struct sk_buff *skb, struct flowi *fl); | 2773 | void security_skb_classify_flow(struct sk_buff *skb, struct flowi *fl); |
| 2767 | 2774 | ||
| @@ -2813,7 +2820,7 @@ static inline int security_xfrm_policy_lookup(struct xfrm_sec_ctx *ctx, u32 fl_s | |||
| 2813 | } | 2820 | } |
| 2814 | 2821 | ||
| 2815 | static inline int security_xfrm_state_pol_flow_match(struct xfrm_state *x, | 2822 | static inline int security_xfrm_state_pol_flow_match(struct xfrm_state *x, |
| 2816 | struct xfrm_policy *xp, struct flowi *fl) | 2823 | struct xfrm_policy *xp, const struct flowi *fl) |
| 2817 | { | 2824 | { |
| 2818 | return 1; | 2825 | return 1; |
| 2819 | } | 2826 | } |
diff --git a/include/linux/skbuff.h b/include/linux/skbuff.h index bf221d65d9ad..24cfa626931e 100644 --- a/include/linux/skbuff.h +++ b/include/linux/skbuff.h | |||
| @@ -388,10 +388,7 @@ struct sk_buff { | |||
| 388 | kmemcheck_bitfield_begin(flags2); | 388 | kmemcheck_bitfield_begin(flags2); |
| 389 | __u16 queue_mapping:16; | 389 | __u16 queue_mapping:16; |
| 390 | #ifdef CONFIG_IPV6_NDISC_NODETYPE | 390 | #ifdef CONFIG_IPV6_NDISC_NODETYPE |
| 391 | __u8 ndisc_nodetype:2, | 391 | __u8 ndisc_nodetype:2; |
| 392 | deliver_no_wcard:1; | ||
| 393 | #else | ||
| 394 | __u8 deliver_no_wcard:1; | ||
| 395 | #endif | 392 | #endif |
| 396 | __u8 ooo_okay:1; | 393 | __u8 ooo_okay:1; |
| 397 | kmemcheck_bitfield_end(flags2); | 394 | kmemcheck_bitfield_end(flags2); |
| @@ -1801,6 +1798,15 @@ static inline int pskb_trim_rcsum(struct sk_buff *skb, unsigned int len) | |||
| 1801 | prefetch(skb->prev), (skb != (struct sk_buff *)(queue)); \ | 1798 | prefetch(skb->prev), (skb != (struct sk_buff *)(queue)); \ |
| 1802 | skb = skb->prev) | 1799 | skb = skb->prev) |
| 1803 | 1800 | ||
| 1801 | #define skb_queue_reverse_walk_safe(queue, skb, tmp) \ | ||
| 1802 | for (skb = (queue)->prev, tmp = skb->prev; \ | ||
| 1803 | skb != (struct sk_buff *)(queue); \ | ||
| 1804 | skb = tmp, tmp = skb->prev) | ||
| 1805 | |||
| 1806 | #define skb_queue_reverse_walk_from_safe(queue, skb, tmp) \ | ||
| 1807 | for (tmp = skb->prev; \ | ||
| 1808 | skb != (struct sk_buff *)(queue); \ | ||
| 1809 | skb = tmp, tmp = skb->prev) | ||
| 1804 | 1810 | ||
| 1805 | static inline bool skb_has_frag_list(const struct sk_buff *skb) | 1811 | static inline bool skb_has_frag_list(const struct sk_buff *skb) |
| 1806 | { | 1812 | { |
| @@ -1868,7 +1874,7 @@ extern void skb_split(struct sk_buff *skb, | |||
| 1868 | extern int skb_shift(struct sk_buff *tgt, struct sk_buff *skb, | 1874 | extern int skb_shift(struct sk_buff *tgt, struct sk_buff *skb, |
| 1869 | int shiftlen); | 1875 | int shiftlen); |
| 1870 | 1876 | ||
| 1871 | extern struct sk_buff *skb_segment(struct sk_buff *skb, int features); | 1877 | extern struct sk_buff *skb_segment(struct sk_buff *skb, u32 features); |
| 1872 | 1878 | ||
| 1873 | static inline void *skb_header_pointer(const struct sk_buff *skb, int offset, | 1879 | static inline void *skb_header_pointer(const struct sk_buff *skb, int offset, |
| 1874 | int len, void *buffer) | 1880 | int len, void *buffer) |
diff --git a/include/linux/smp_lock.h b/include/linux/smp_lock.h deleted file mode 100644 index 3a1988202731..000000000000 --- a/include/linux/smp_lock.h +++ /dev/null | |||
| @@ -1,65 +0,0 @@ | |||
| 1 | #ifndef __LINUX_SMPLOCK_H | ||
| 2 | #define __LINUX_SMPLOCK_H | ||
| 3 | |||
| 4 | #ifdef CONFIG_LOCK_KERNEL | ||
| 5 | #include <linux/sched.h> | ||
| 6 | |||
| 7 | extern int __lockfunc __reacquire_kernel_lock(void); | ||
| 8 | extern void __lockfunc __release_kernel_lock(void); | ||
| 9 | |||
| 10 | /* | ||
| 11 | * Release/re-acquire global kernel lock for the scheduler | ||
| 12 | */ | ||
| 13 | #define release_kernel_lock(tsk) do { \ | ||
| 14 | if (unlikely((tsk)->lock_depth >= 0)) \ | ||
| 15 | __release_kernel_lock(); \ | ||
| 16 | } while (0) | ||
| 17 | |||
| 18 | static inline int reacquire_kernel_lock(struct task_struct *task) | ||
| 19 | { | ||
| 20 | if (unlikely(task->lock_depth >= 0)) | ||
| 21 | return __reacquire_kernel_lock(); | ||
| 22 | return 0; | ||
| 23 | } | ||
| 24 | |||
| 25 | extern void __lockfunc | ||
| 26 | _lock_kernel(const char *func, const char *file, int line) | ||
| 27 | __acquires(kernel_lock); | ||
| 28 | |||
| 29 | extern void __lockfunc | ||
| 30 | _unlock_kernel(const char *func, const char *file, int line) | ||
| 31 | __releases(kernel_lock); | ||
| 32 | |||
| 33 | #define lock_kernel() do { \ | ||
| 34 | _lock_kernel(__func__, __FILE__, __LINE__); \ | ||
| 35 | } while (0) | ||
| 36 | |||
| 37 | #define unlock_kernel() do { \ | ||
| 38 | _unlock_kernel(__func__, __FILE__, __LINE__); \ | ||
| 39 | } while (0) | ||
| 40 | |||
| 41 | /* | ||
| 42 | * Various legacy drivers don't really need the BKL in a specific | ||
| 43 | * function, but they *do* need to know that the BKL became available. | ||
| 44 | * This function just avoids wrapping a bunch of lock/unlock pairs | ||
| 45 | * around code which doesn't really need it. | ||
| 46 | */ | ||
| 47 | static inline void cycle_kernel_lock(void) | ||
| 48 | { | ||
| 49 | lock_kernel(); | ||
| 50 | unlock_kernel(); | ||
| 51 | } | ||
| 52 | |||
| 53 | #else | ||
| 54 | |||
| 55 | #ifdef CONFIG_BKL /* provoke build bug if not set */ | ||
| 56 | #define lock_kernel() | ||
| 57 | #define unlock_kernel() | ||
| 58 | #define cycle_kernel_lock() do { } while(0) | ||
| 59 | #endif /* CONFIG_BKL */ | ||
| 60 | |||
| 61 | #define release_kernel_lock(task) do { } while(0) | ||
| 62 | #define reacquire_kernel_lock(task) 0 | ||
| 63 | |||
| 64 | #endif /* CONFIG_LOCK_KERNEL */ | ||
| 65 | #endif /* __LINUX_SMPLOCK_H */ | ||
diff --git a/include/linux/sockios.h b/include/linux/sockios.h index 241f179347d9..7997a506ad41 100644 --- a/include/linux/sockios.h +++ b/include/linux/sockios.h | |||
| @@ -22,7 +22,7 @@ | |||
| 22 | 22 | ||
| 23 | /* Linux-specific socket ioctls */ | 23 | /* Linux-specific socket ioctls */ |
| 24 | #define SIOCINQ FIONREAD | 24 | #define SIOCINQ FIONREAD |
| 25 | #define SIOCOUTQ TIOCOUTQ | 25 | #define SIOCOUTQ TIOCOUTQ /* output queue size (not sent + not acked) */ |
| 26 | 26 | ||
| 27 | /* Routing table calls. */ | 27 | /* Routing table calls. */ |
| 28 | #define SIOCADDRT 0x890B /* add routing table entry */ | 28 | #define SIOCADDRT 0x890B /* add routing table entry */ |
| @@ -83,6 +83,8 @@ | |||
| 83 | 83 | ||
| 84 | #define SIOCWANDEV 0x894A /* get/set netdev parameters */ | 84 | #define SIOCWANDEV 0x894A /* get/set netdev parameters */ |
| 85 | 85 | ||
| 86 | #define SIOCOUTQNSD 0x894B /* output queue size (not sent only) */ | ||
| 87 | |||
| 86 | /* ARP cache control calls. */ | 88 | /* ARP cache control calls. */ |
| 87 | /* 0x8950 - 0x8952 * obsolete calls, don't re-use */ | 89 | /* 0x8950 - 0x8952 * obsolete calls, don't re-use */ |
| 88 | #define SIOCDARP 0x8953 /* delete ARP table entry */ | 90 | #define SIOCDARP 0x8953 /* delete ARP table entry */ |
diff --git a/include/linux/spi/ifx_modem.h b/include/linux/spi/ifx_modem.h index a68f3b19d112..394fec9e7722 100644 --- a/include/linux/spi/ifx_modem.h +++ b/include/linux/spi/ifx_modem.h | |||
| @@ -2,13 +2,18 @@ | |||
| 2 | #define LINUX_IFX_MODEM_H | 2 | #define LINUX_IFX_MODEM_H |
| 3 | 3 | ||
| 4 | struct ifx_modem_platform_data { | 4 | struct ifx_modem_platform_data { |
| 5 | unsigned short rst_out; /* modem reset out */ | 5 | unsigned short rst_out; /* modem reset out */ |
| 6 | unsigned short pwr_on; /* power on */ | 6 | unsigned short pwr_on; /* power on */ |
| 7 | unsigned short rst_pmu; /* reset modem */ | 7 | unsigned short rst_pmu; /* reset modem */ |
| 8 | unsigned short tx_pwr; /* modem power threshold */ | 8 | unsigned short tx_pwr; /* modem power threshold */ |
| 9 | unsigned short srdy; /* SRDY */ | 9 | unsigned short srdy; /* SRDY */ |
| 10 | unsigned short mrdy; /* MRDY */ | 10 | unsigned short mrdy; /* MRDY */ |
| 11 | unsigned short is_6160; /* Modem type */ | 11 | unsigned char modem_type; /* Modem type */ |
| 12 | unsigned long max_hz; /* max SPI frequency */ | ||
| 13 | unsigned short use_dma:1; /* spi protocol driver supplies | ||
| 14 | dma-able addrs */ | ||
| 12 | }; | 15 | }; |
| 16 | #define IFX_MODEM_6160 1 | ||
| 17 | #define IFX_MODEM_6260 2 | ||
| 13 | 18 | ||
| 14 | #endif | 19 | #endif |
diff --git a/include/linux/spinlock_types.h b/include/linux/spinlock_types.h index 851b7783720d..73548eb13a5d 100644 --- a/include/linux/spinlock_types.h +++ b/include/linux/spinlock_types.h | |||
| @@ -81,14 +81,6 @@ typedef struct spinlock { | |||
| 81 | #define __SPIN_LOCK_UNLOCKED(lockname) \ | 81 | #define __SPIN_LOCK_UNLOCKED(lockname) \ |
| 82 | (spinlock_t ) __SPIN_LOCK_INITIALIZER(lockname) | 82 | (spinlock_t ) __SPIN_LOCK_INITIALIZER(lockname) |
| 83 | 83 | ||
| 84 | /* | ||
| 85 | * SPIN_LOCK_UNLOCKED defeats lockdep state tracking and is hence | ||
| 86 | * deprecated. | ||
| 87 | * Please use DEFINE_SPINLOCK() or __SPIN_LOCK_UNLOCKED() as | ||
| 88 | * appropriate. | ||
| 89 | */ | ||
| 90 | #define SPIN_LOCK_UNLOCKED __SPIN_LOCK_UNLOCKED(old_style_spin_init) | ||
| 91 | |||
| 92 | #define DEFINE_SPINLOCK(x) spinlock_t x = __SPIN_LOCK_UNLOCKED(x) | 84 | #define DEFINE_SPINLOCK(x) spinlock_t x = __SPIN_LOCK_UNLOCKED(x) |
| 93 | 85 | ||
| 94 | #include <linux/rwlock_types.h> | 86 | #include <linux/rwlock_types.h> |
diff --git a/include/linux/ssb/ssb_regs.h b/include/linux/ssb/ssb_regs.h index 489f7b6d61c5..402955ae48ce 100644 --- a/include/linux/ssb/ssb_regs.h +++ b/include/linux/ssb/ssb_regs.h | |||
| @@ -85,6 +85,8 @@ | |||
| 85 | #define SSB_IMSTATE_AP_RSV 0x00000030 /* Reserved */ | 85 | #define SSB_IMSTATE_AP_RSV 0x00000030 /* Reserved */ |
| 86 | #define SSB_IMSTATE_IBE 0x00020000 /* In Band Error */ | 86 | #define SSB_IMSTATE_IBE 0x00020000 /* In Band Error */ |
| 87 | #define SSB_IMSTATE_TO 0x00040000 /* Timeout */ | 87 | #define SSB_IMSTATE_TO 0x00040000 /* Timeout */ |
| 88 | #define SSB_IMSTATE_BUSY 0x01800000 /* Busy (Backplane rev >= 2.3 only) */ | ||
| 89 | #define SSB_IMSTATE_REJECT 0x02000000 /* Reject (Backplane rev >= 2.3 only) */ | ||
| 88 | #define SSB_INTVEC 0x0F94 /* SB Interrupt Mask */ | 90 | #define SSB_INTVEC 0x0F94 /* SB Interrupt Mask */ |
| 89 | #define SSB_INTVEC_PCI 0x00000001 /* Enable interrupts for PCI */ | 91 | #define SSB_INTVEC_PCI 0x00000001 /* Enable interrupts for PCI */ |
| 90 | #define SSB_INTVEC_ENET0 0x00000002 /* Enable interrupts for enet 0 */ | 92 | #define SSB_INTVEC_ENET0 0x00000002 /* Enable interrupts for enet 0 */ |
| @@ -97,7 +99,6 @@ | |||
| 97 | #define SSB_TMSLOW_RESET 0x00000001 /* Reset */ | 99 | #define SSB_TMSLOW_RESET 0x00000001 /* Reset */ |
| 98 | #define SSB_TMSLOW_REJECT_22 0x00000002 /* Reject (Backplane rev 2.2) */ | 100 | #define SSB_TMSLOW_REJECT_22 0x00000002 /* Reject (Backplane rev 2.2) */ |
| 99 | #define SSB_TMSLOW_REJECT_23 0x00000004 /* Reject (Backplane rev 2.3) */ | 101 | #define SSB_TMSLOW_REJECT_23 0x00000004 /* Reject (Backplane rev 2.3) */ |
| 100 | #define SSB_TMSLOW_PHYCLK 0x00000010 /* MAC PHY Clock Control Enable */ | ||
| 101 | #define SSB_TMSLOW_CLOCK 0x00010000 /* Clock Enable */ | 102 | #define SSB_TMSLOW_CLOCK 0x00010000 /* Clock Enable */ |
| 102 | #define SSB_TMSLOW_FGC 0x00020000 /* Force Gated Clocks On */ | 103 | #define SSB_TMSLOW_FGC 0x00020000 /* Force Gated Clocks On */ |
| 103 | #define SSB_TMSLOW_PE 0x40000000 /* Power Management Enable */ | 104 | #define SSB_TMSLOW_PE 0x40000000 /* Power Management Enable */ |
| @@ -268,6 +269,8 @@ | |||
| 268 | /* SPROM Revision 4 */ | 269 | /* SPROM Revision 4 */ |
| 269 | #define SSB_SPROM4_BFLLO 0x0044 /* Boardflags (low 16 bits) */ | 270 | #define SSB_SPROM4_BFLLO 0x0044 /* Boardflags (low 16 bits) */ |
| 270 | #define SSB_SPROM4_BFLHI 0x0046 /* Board Flags Hi */ | 271 | #define SSB_SPROM4_BFLHI 0x0046 /* Board Flags Hi */ |
| 272 | #define SSB_SPROM4_BFL2LO 0x0048 /* Board flags 2 (low 16 bits) */ | ||
| 273 | #define SSB_SPROM4_BFL2HI 0x004A /* Board flags 2 Hi */ | ||
| 271 | #define SSB_SPROM4_IL0MAC 0x004C /* 6 byte MAC address for a/b/g/n */ | 274 | #define SSB_SPROM4_IL0MAC 0x004C /* 6 byte MAC address for a/b/g/n */ |
| 272 | #define SSB_SPROM4_CCODE 0x0052 /* Country Code (2 bytes) */ | 275 | #define SSB_SPROM4_CCODE 0x0052 /* Country Code (2 bytes) */ |
| 273 | #define SSB_SPROM4_GPIOA 0x0056 /* Gen. Purpose IO # 0 and 1 */ | 276 | #define SSB_SPROM4_GPIOA 0x0056 /* Gen. Purpose IO # 0 and 1 */ |
| @@ -358,6 +361,8 @@ | |||
| 358 | #define SSB_SPROM5_CCODE 0x0044 /* Country Code (2 bytes) */ | 361 | #define SSB_SPROM5_CCODE 0x0044 /* Country Code (2 bytes) */ |
| 359 | #define SSB_SPROM5_BFLLO 0x004A /* Boardflags (low 16 bits) */ | 362 | #define SSB_SPROM5_BFLLO 0x004A /* Boardflags (low 16 bits) */ |
| 360 | #define SSB_SPROM5_BFLHI 0x004C /* Board Flags Hi */ | 363 | #define SSB_SPROM5_BFLHI 0x004C /* Board Flags Hi */ |
| 364 | #define SSB_SPROM5_BFL2LO 0x004E /* Board flags 2 (low 16 bits) */ | ||
| 365 | #define SSB_SPROM5_BFL2HI 0x0050 /* Board flags 2 Hi */ | ||
| 361 | #define SSB_SPROM5_IL0MAC 0x0052 /* 6 byte MAC address for a/b/g/n */ | 366 | #define SSB_SPROM5_IL0MAC 0x0052 /* 6 byte MAC address for a/b/g/n */ |
| 362 | #define SSB_SPROM5_GPIOA 0x0076 /* Gen. Purpose IO # 0 and 1 */ | 367 | #define SSB_SPROM5_GPIOA 0x0076 /* Gen. Purpose IO # 0 and 1 */ |
| 363 | #define SSB_SPROM5_GPIOA_P0 0x00FF /* Pin 0 */ | 368 | #define SSB_SPROM5_GPIOA_P0 0x00FF /* Pin 0 */ |
diff --git a/include/linux/sunrpc/sched.h b/include/linux/sunrpc/sched.h index 88513fd8e208..d81db8012c63 100644 --- a/include/linux/sunrpc/sched.h +++ b/include/linux/sunrpc/sched.h | |||
| @@ -212,6 +212,7 @@ struct rpc_task *rpc_run_task(const struct rpc_task_setup *); | |||
| 212 | struct rpc_task *rpc_run_bc_task(struct rpc_rqst *req, | 212 | struct rpc_task *rpc_run_bc_task(struct rpc_rqst *req, |
| 213 | const struct rpc_call_ops *ops); | 213 | const struct rpc_call_ops *ops); |
| 214 | void rpc_put_task(struct rpc_task *); | 214 | void rpc_put_task(struct rpc_task *); |
| 215 | void rpc_put_task_async(struct rpc_task *); | ||
| 215 | void rpc_exit_task(struct rpc_task *); | 216 | void rpc_exit_task(struct rpc_task *); |
| 216 | void rpc_exit(struct rpc_task *, int); | 217 | void rpc_exit(struct rpc_task *, int); |
| 217 | void rpc_release_calldata(const struct rpc_call_ops *, void *); | 218 | void rpc_release_calldata(const struct rpc_call_ops *, void *); |
diff --git a/include/linux/syscalls.h b/include/linux/syscalls.h index 98664db1be47..1f5c18e6f4f1 100644 --- a/include/linux/syscalls.h +++ b/include/linux/syscalls.h | |||
| @@ -62,6 +62,7 @@ struct robust_list_head; | |||
| 62 | struct getcpu_cache; | 62 | struct getcpu_cache; |
| 63 | struct old_linux_dirent; | 63 | struct old_linux_dirent; |
| 64 | struct perf_event_attr; | 64 | struct perf_event_attr; |
| 65 | struct file_handle; | ||
| 65 | 66 | ||
| 66 | #include <linux/types.h> | 67 | #include <linux/types.h> |
| 67 | #include <linux/aio_abi.h> | 68 | #include <linux/aio_abi.h> |
| @@ -132,11 +133,11 @@ extern struct trace_event_functions exit_syscall_print_funcs; | |||
| 132 | .class = &event_class_syscall_enter, \ | 133 | .class = &event_class_syscall_enter, \ |
| 133 | .event.funcs = &enter_syscall_print_funcs, \ | 134 | .event.funcs = &enter_syscall_print_funcs, \ |
| 134 | .data = (void *)&__syscall_meta_##sname,\ | 135 | .data = (void *)&__syscall_meta_##sname,\ |
| 136 | .flags = TRACE_EVENT_FL_CAP_ANY, \ | ||
| 135 | }; \ | 137 | }; \ |
| 136 | static struct ftrace_event_call __used \ | 138 | static struct ftrace_event_call __used \ |
| 137 | __attribute__((section("_ftrace_events"))) \ | 139 | __attribute__((section("_ftrace_events"))) \ |
| 138 | *__event_enter_##sname = &event_enter_##sname; \ | 140 | *__event_enter_##sname = &event_enter_##sname; |
| 139 | __TRACE_EVENT_FLAGS(enter_##sname, TRACE_EVENT_FL_CAP_ANY) | ||
| 140 | 141 | ||
| 141 | #define SYSCALL_TRACE_EXIT_EVENT(sname) \ | 142 | #define SYSCALL_TRACE_EXIT_EVENT(sname) \ |
| 142 | static struct syscall_metadata __syscall_meta_##sname; \ | 143 | static struct syscall_metadata __syscall_meta_##sname; \ |
| @@ -146,11 +147,11 @@ extern struct trace_event_functions exit_syscall_print_funcs; | |||
| 146 | .class = &event_class_syscall_exit, \ | 147 | .class = &event_class_syscall_exit, \ |
| 147 | .event.funcs = &exit_syscall_print_funcs, \ | 148 | .event.funcs = &exit_syscall_print_funcs, \ |
| 148 | .data = (void *)&__syscall_meta_##sname,\ | 149 | .data = (void *)&__syscall_meta_##sname,\ |
| 150 | .flags = TRACE_EVENT_FL_CAP_ANY, \ | ||
| 149 | }; \ | 151 | }; \ |
| 150 | static struct ftrace_event_call __used \ | 152 | static struct ftrace_event_call __used \ |
| 151 | __attribute__((section("_ftrace_events"))) \ | 153 | __attribute__((section("_ftrace_events"))) \ |
| 152 | *__event_exit_##sname = &event_exit_##sname; \ | 154 | *__event_exit_##sname = &event_exit_##sname; |
| 153 | __TRACE_EVENT_FLAGS(exit_##sname, TRACE_EVENT_FL_CAP_ANY) | ||
| 154 | 155 | ||
| 155 | #define SYSCALL_METADATA(sname, nb) \ | 156 | #define SYSCALL_METADATA(sname, nb) \ |
| 156 | SYSCALL_TRACE_ENTER_EVENT(sname); \ | 157 | SYSCALL_TRACE_ENTER_EVENT(sname); \ |
| @@ -158,6 +159,7 @@ extern struct trace_event_functions exit_syscall_print_funcs; | |||
| 158 | static struct syscall_metadata __used \ | 159 | static struct syscall_metadata __used \ |
| 159 | __syscall_meta_##sname = { \ | 160 | __syscall_meta_##sname = { \ |
| 160 | .name = "sys"#sname, \ | 161 | .name = "sys"#sname, \ |
| 162 | .syscall_nr = -1, /* Filled in at boot */ \ | ||
| 161 | .nb_args = nb, \ | 163 | .nb_args = nb, \ |
| 162 | .types = types_##sname, \ | 164 | .types = types_##sname, \ |
| 163 | .args = args_##sname, \ | 165 | .args = args_##sname, \ |
| @@ -175,6 +177,7 @@ extern struct trace_event_functions exit_syscall_print_funcs; | |||
| 175 | static struct syscall_metadata __used \ | 177 | static struct syscall_metadata __used \ |
| 176 | __syscall_meta__##sname = { \ | 178 | __syscall_meta__##sname = { \ |
| 177 | .name = "sys_"#sname, \ | 179 | .name = "sys_"#sname, \ |
| 180 | .syscall_nr = -1, /* Filled in at boot */ \ | ||
| 178 | .nb_args = 0, \ | 181 | .nb_args = 0, \ |
| 179 | .enter_event = &event_enter__##sname, \ | 182 | .enter_event = &event_enter__##sname, \ |
| 180 | .exit_event = &event_exit__##sname, \ | 183 | .exit_event = &event_exit__##sname, \ |
| @@ -313,6 +316,8 @@ asmlinkage long sys_clock_settime(clockid_t which_clock, | |||
| 313 | const struct timespec __user *tp); | 316 | const struct timespec __user *tp); |
| 314 | asmlinkage long sys_clock_gettime(clockid_t which_clock, | 317 | asmlinkage long sys_clock_gettime(clockid_t which_clock, |
| 315 | struct timespec __user *tp); | 318 | struct timespec __user *tp); |
| 319 | asmlinkage long sys_clock_adjtime(clockid_t which_clock, | ||
| 320 | struct timex __user *tx); | ||
| 316 | asmlinkage long sys_clock_getres(clockid_t which_clock, | 321 | asmlinkage long sys_clock_getres(clockid_t which_clock, |
| 317 | struct timespec __user *tp); | 322 | struct timespec __user *tp); |
| 318 | asmlinkage long sys_clock_nanosleep(clockid_t which_clock, int flags, | 323 | asmlinkage long sys_clock_nanosleep(clockid_t which_clock, int flags, |
| @@ -832,5 +837,10 @@ asmlinkage long sys_mmap_pgoff(unsigned long addr, unsigned long len, | |||
| 832 | unsigned long prot, unsigned long flags, | 837 | unsigned long prot, unsigned long flags, |
| 833 | unsigned long fd, unsigned long pgoff); | 838 | unsigned long fd, unsigned long pgoff); |
| 834 | asmlinkage long sys_old_mmap(struct mmap_arg_struct __user *arg); | 839 | asmlinkage long sys_old_mmap(struct mmap_arg_struct __user *arg); |
| 835 | 840 | asmlinkage long sys_name_to_handle_at(int dfd, const char __user *name, | |
| 841 | struct file_handle __user *handle, | ||
| 842 | int __user *mnt_id, int flag); | ||
| 843 | asmlinkage long sys_open_by_handle_at(int mountdirfd, | ||
| 844 | struct file_handle __user *handle, | ||
| 845 | int flags); | ||
| 836 | #endif | 846 | #endif |
diff --git a/include/linux/syscore_ops.h b/include/linux/syscore_ops.h new file mode 100644 index 000000000000..27b3b0bc41a9 --- /dev/null +++ b/include/linux/syscore_ops.h | |||
| @@ -0,0 +1,29 @@ | |||
| 1 | /* | ||
| 2 | * syscore_ops.h - System core operations. | ||
| 3 | * | ||
| 4 | * Copyright (C) 2011 Rafael J. Wysocki <rjw@sisk.pl>, Novell Inc. | ||
| 5 | * | ||
| 6 | * This file is released under the GPLv2. | ||
| 7 | */ | ||
| 8 | |||
| 9 | #ifndef _LINUX_SYSCORE_OPS_H | ||
| 10 | #define _LINUX_SYSCORE_OPS_H | ||
| 11 | |||
| 12 | #include <linux/list.h> | ||
| 13 | |||
| 14 | struct syscore_ops { | ||
| 15 | struct list_head node; | ||
| 16 | int (*suspend)(void); | ||
| 17 | void (*resume)(void); | ||
| 18 | void (*shutdown)(void); | ||
| 19 | }; | ||
| 20 | |||
| 21 | extern void register_syscore_ops(struct syscore_ops *ops); | ||
| 22 | extern void unregister_syscore_ops(struct syscore_ops *ops); | ||
| 23 | #ifdef CONFIG_PM_SLEEP | ||
| 24 | extern int syscore_suspend(void); | ||
| 25 | extern void syscore_resume(void); | ||
| 26 | #endif | ||
| 27 | extern void syscore_shutdown(void); | ||
| 28 | |||
| 29 | #endif | ||
diff --git a/include/linux/sysctl.h b/include/linux/sysctl.h index 7bb5cb64f3b8..11684d9e6bd2 100644 --- a/include/linux/sysctl.h +++ b/include/linux/sysctl.h | |||
| @@ -930,6 +930,7 @@ enum | |||
| 930 | 930 | ||
| 931 | #ifdef __KERNEL__ | 931 | #ifdef __KERNEL__ |
| 932 | #include <linux/list.h> | 932 | #include <linux/list.h> |
| 933 | #include <linux/rcupdate.h> | ||
| 933 | 934 | ||
| 934 | /* For the /proc/sys support */ | 935 | /* For the /proc/sys support */ |
| 935 | struct ctl_table; | 936 | struct ctl_table; |
| @@ -1037,10 +1038,15 @@ struct ctl_table_root { | |||
| 1037 | struct ctl_table trees. */ | 1038 | struct ctl_table trees. */ |
| 1038 | struct ctl_table_header | 1039 | struct ctl_table_header |
| 1039 | { | 1040 | { |
| 1040 | struct ctl_table *ctl_table; | 1041 | union { |
| 1041 | struct list_head ctl_entry; | 1042 | struct { |
| 1042 | int used; | 1043 | struct ctl_table *ctl_table; |
| 1043 | int count; | 1044 | struct list_head ctl_entry; |
| 1045 | int used; | ||
| 1046 | int count; | ||
| 1047 | }; | ||
| 1048 | struct rcu_head rcu; | ||
| 1049 | }; | ||
| 1044 | struct completion *unregistering; | 1050 | struct completion *unregistering; |
| 1045 | struct ctl_table *ctl_table_arg; | 1051 | struct ctl_table *ctl_table_arg; |
| 1046 | struct ctl_table_root *root; | 1052 | struct ctl_table_root *root; |
diff --git a/include/linux/thermal.h b/include/linux/thermal.h index 8651556dbd52..d3ec89fb4122 100644 --- a/include/linux/thermal.h +++ b/include/linux/thermal.h | |||
| @@ -172,6 +172,14 @@ void thermal_zone_device_update(struct thermal_zone_device *); | |||
| 172 | struct thermal_cooling_device *thermal_cooling_device_register(char *, void *, | 172 | struct thermal_cooling_device *thermal_cooling_device_register(char *, void *, |
| 173 | const struct thermal_cooling_device_ops *); | 173 | const struct thermal_cooling_device_ops *); |
| 174 | void thermal_cooling_device_unregister(struct thermal_cooling_device *); | 174 | void thermal_cooling_device_unregister(struct thermal_cooling_device *); |
| 175 | |||
| 176 | #ifdef CONFIG_NET | ||
| 175 | extern int generate_netlink_event(u32 orig, enum events event); | 177 | extern int generate_netlink_event(u32 orig, enum events event); |
| 178 | #else | ||
| 179 | static inline int generate_netlink_event(u32 orig, enum events event) | ||
| 180 | { | ||
| 181 | return 0; | ||
| 182 | } | ||
| 183 | #endif | ||
| 176 | 184 | ||
| 177 | #endif /* __THERMAL_H__ */ | 185 | #endif /* __THERMAL_H__ */ |
diff --git a/include/linux/thread_info.h b/include/linux/thread_info.h index c90696544176..20fc303947d3 100644 --- a/include/linux/thread_info.h +++ b/include/linux/thread_info.h | |||
| @@ -18,9 +18,6 @@ struct compat_timespec; | |||
| 18 | struct restart_block { | 18 | struct restart_block { |
| 19 | long (*fn)(struct restart_block *); | 19 | long (*fn)(struct restart_block *); |
| 20 | union { | 20 | union { |
| 21 | struct { | ||
| 22 | unsigned long arg0, arg1, arg2, arg3; | ||
| 23 | }; | ||
| 24 | /* For futex_wait and futex_wait_requeue_pi */ | 21 | /* For futex_wait and futex_wait_requeue_pi */ |
| 25 | struct { | 22 | struct { |
| 26 | u32 __user *uaddr; | 23 | u32 __user *uaddr; |
diff --git a/include/linux/ti_wilink_st.h b/include/linux/ti_wilink_st.h index 4c7be2263011..7071ec5d0118 100644 --- a/include/linux/ti_wilink_st.h +++ b/include/linux/ti_wilink_st.h | |||
| @@ -26,15 +26,6 @@ | |||
| 26 | #define TI_WILINK_ST_H | 26 | #define TI_WILINK_ST_H |
| 27 | 27 | ||
| 28 | /** | 28 | /** |
| 29 | * enum kim_gpio_state - Few protocols such as FM have ACTIVE LOW | ||
| 30 | * gpio states for their chip/core enable gpios | ||
| 31 | */ | ||
| 32 | enum kim_gpio_state { | ||
| 33 | KIM_GPIO_INACTIVE, | ||
| 34 | KIM_GPIO_ACTIVE, | ||
| 35 | }; | ||
| 36 | |||
| 37 | /** | ||
| 38 | * enum proto-type - The protocol on WiLink chips which share a | 29 | * enum proto-type - The protocol on WiLink chips which share a |
| 39 | * common physical interface like UART. | 30 | * common physical interface like UART. |
| 40 | */ | 31 | */ |
| @@ -42,7 +33,7 @@ enum proto_type { | |||
| 42 | ST_BT, | 33 | ST_BT, |
| 43 | ST_FM, | 34 | ST_FM, |
| 44 | ST_GPS, | 35 | ST_GPS, |
| 45 | ST_MAX, | 36 | ST_MAX_CHANNELS = 16, |
| 46 | }; | 37 | }; |
| 47 | 38 | ||
| 48 | /** | 39 | /** |
| @@ -62,6 +53,17 @@ enum proto_type { | |||
| 62 | * @priv_data: privdate data holder for the protocol drivers, sent | 53 | * @priv_data: privdate data holder for the protocol drivers, sent |
| 63 | * from the protocol drivers during registration, and sent back on | 54 | * from the protocol drivers during registration, and sent back on |
| 64 | * reg_complete_cb and recv. | 55 | * reg_complete_cb and recv. |
| 56 | * @chnl_id: channel id the protocol driver is interested in, the channel | ||
| 57 | * id is nothing but the 1st byte of the packet in UART frame. | ||
| 58 | * @max_frame_size: size of the largest frame the protocol can receive. | ||
| 59 | * @hdr_len: length of the header structure of the protocol. | ||
| 60 | * @offset_len_in_hdr: this provides the offset of the length field in the | ||
| 61 | * header structure of the protocol header, to assist ST to know | ||
| 62 | * how much to receive, if the data is split across UART frames. | ||
| 63 | * @len_size: whether the length field inside the header is 2 bytes | ||
| 64 | * or 1 byte. | ||
| 65 | * @reserve: the number of bytes ST needs to reserve in the skb being | ||
| 66 | * prepared for the protocol driver. | ||
| 65 | */ | 67 | */ |
| 66 | struct st_proto_s { | 68 | struct st_proto_s { |
| 67 | enum proto_type type; | 69 | enum proto_type type; |
| @@ -70,10 +72,17 @@ struct st_proto_s { | |||
| 70 | void (*reg_complete_cb) (void *, char data); | 72 | void (*reg_complete_cb) (void *, char data); |
| 71 | long (*write) (struct sk_buff *skb); | 73 | long (*write) (struct sk_buff *skb); |
| 72 | void *priv_data; | 74 | void *priv_data; |
| 75 | |||
| 76 | unsigned char chnl_id; | ||
| 77 | unsigned short max_frame_size; | ||
| 78 | unsigned char hdr_len; | ||
| 79 | unsigned char offset_len_in_hdr; | ||
| 80 | unsigned char len_size; | ||
| 81 | unsigned char reserve; | ||
| 73 | }; | 82 | }; |
| 74 | 83 | ||
| 75 | extern long st_register(struct st_proto_s *); | 84 | extern long st_register(struct st_proto_s *); |
| 76 | extern long st_unregister(enum proto_type); | 85 | extern long st_unregister(struct st_proto_s *); |
| 77 | 86 | ||
| 78 | 87 | ||
| 79 | /* | 88 | /* |
| @@ -114,6 +123,7 @@ extern long st_unregister(enum proto_type); | |||
| 114 | * @rx_skb: the skb where all data for a protocol gets accumulated, | 123 | * @rx_skb: the skb where all data for a protocol gets accumulated, |
| 115 | * since tty might not call receive when a complete event packet | 124 | * since tty might not call receive when a complete event packet |
| 116 | * is received, the states, count and the skb needs to be maintained. | 125 | * is received, the states, count and the skb needs to be maintained. |
| 126 | * @rx_chnl: the channel ID for which the data is getting accumalated for. | ||
| 117 | * @txq: the list of skbs which needs to be sent onto the TTY. | 127 | * @txq: the list of skbs which needs to be sent onto the TTY. |
| 118 | * @tx_waitq: if the chip is not in AWAKE state, the skbs needs to be queued | 128 | * @tx_waitq: if the chip is not in AWAKE state, the skbs needs to be queued |
| 119 | * up in here, PM(WAKEUP_IND) data needs to be sent and then the skbs | 129 | * up in here, PM(WAKEUP_IND) data needs to be sent and then the skbs |
| @@ -135,10 +145,11 @@ struct st_data_s { | |||
| 135 | #define ST_TX_SENDING 1 | 145 | #define ST_TX_SENDING 1 |
| 136 | #define ST_TX_WAKEUP 2 | 146 | #define ST_TX_WAKEUP 2 |
| 137 | unsigned long tx_state; | 147 | unsigned long tx_state; |
| 138 | struct st_proto_s *list[ST_MAX]; | 148 | struct st_proto_s *list[ST_MAX_CHANNELS]; |
| 139 | unsigned long rx_state; | 149 | unsigned long rx_state; |
| 140 | unsigned long rx_count; | 150 | unsigned long rx_count; |
| 141 | struct sk_buff *rx_skb; | 151 | struct sk_buff *rx_skb; |
| 152 | unsigned char rx_chnl; | ||
| 142 | struct sk_buff_head txq, tx_waitq; | 153 | struct sk_buff_head txq, tx_waitq; |
| 143 | spinlock_t lock; | 154 | spinlock_t lock; |
| 144 | unsigned char protos_registered; | 155 | unsigned char protos_registered; |
| @@ -146,6 +157,11 @@ struct st_data_s { | |||
| 146 | void *kim_data; | 157 | void *kim_data; |
| 147 | }; | 158 | }; |
| 148 | 159 | ||
| 160 | /* | ||
| 161 | * wrapper around tty->ops->write_room to check | ||
| 162 | * availability during firmware download | ||
| 163 | */ | ||
| 164 | int st_get_uart_wr_room(struct st_data_s *st_gdata); | ||
| 149 | /** | 165 | /** |
| 150 | * st_int_write - | 166 | * st_int_write - |
| 151 | * point this to tty->driver->write or tty->ops->write | 167 | * point this to tty->driver->write or tty->ops->write |
| @@ -186,8 +202,9 @@ void gps_chrdrv_stub_init(void); | |||
| 186 | /* time in msec to wait for | 202 | /* time in msec to wait for |
| 187 | * line discipline to be installed | 203 | * line discipline to be installed |
| 188 | */ | 204 | */ |
| 189 | #define LDISC_TIME 500 | 205 | #define LDISC_TIME 1000 |
| 190 | #define CMD_RESP_TIME 500 | 206 | #define CMD_RESP_TIME 800 |
| 207 | #define CMD_WR_TIME 5000 | ||
| 191 | #define MAKEWORD(a, b) ((unsigned short)(((unsigned char)(a)) \ | 208 | #define MAKEWORD(a, b) ((unsigned short)(((unsigned char)(a)) \ |
| 192 | | ((unsigned short)((unsigned char)(b))) << 8)) | 209 | | ((unsigned short)((unsigned char)(b))) << 8)) |
| 193 | 210 | ||
| @@ -210,6 +227,7 @@ struct chip_version { | |||
| 210 | unsigned short maj_ver; | 227 | unsigned short maj_ver; |
| 211 | }; | 228 | }; |
| 212 | 229 | ||
| 230 | #define UART_DEV_NAME_LEN 32 | ||
| 213 | /** | 231 | /** |
| 214 | * struct kim_data_s - the KIM internal data, embedded as the | 232 | * struct kim_data_s - the KIM internal data, embedded as the |
| 215 | * platform's drv data. One for each ST device in the system. | 233 | * platform's drv data. One for each ST device in the system. |
| @@ -225,14 +243,11 @@ struct chip_version { | |||
| 225 | * the ldisc was properly installed. | 243 | * the ldisc was properly installed. |
| 226 | * @resp_buffer: data buffer for the .bts fw file name. | 244 | * @resp_buffer: data buffer for the .bts fw file name. |
| 227 | * @fw_entry: firmware class struct to request/release the fw. | 245 | * @fw_entry: firmware class struct to request/release the fw. |
| 228 | * @gpios: the list of core/chip enable gpios for BT, FM and GPS cores. | ||
| 229 | * @rx_state: the rx state for kim's receive func during fw download. | 246 | * @rx_state: the rx state for kim's receive func during fw download. |
| 230 | * @rx_count: the rx count for the kim's receive func during fw download. | 247 | * @rx_count: the rx count for the kim's receive func during fw download. |
| 231 | * @rx_skb: all of fw data might not come at once, and hence data storage for | 248 | * @rx_skb: all of fw data might not come at once, and hence data storage for |
| 232 | * whole of the fw response, only HCI_EVENTs and hence diff from ST's | 249 | * whole of the fw response, only HCI_EVENTs and hence diff from ST's |
| 233 | * response. | 250 | * response. |
| 234 | * @rfkill: rfkill data for each of the cores to be registered with rfkill. | ||
| 235 | * @rf_protos: proto types of the data registered with rfkill sub-system. | ||
| 236 | * @core_data: ST core's data, which mainly is the tty's disc_data | 251 | * @core_data: ST core's data, which mainly is the tty's disc_data |
| 237 | * @version: chip version available via a sysfs entry. | 252 | * @version: chip version available via a sysfs entry. |
| 238 | * | 253 | * |
| @@ -243,14 +258,16 @@ struct kim_data_s { | |||
| 243 | struct completion kim_rcvd, ldisc_installed; | 258 | struct completion kim_rcvd, ldisc_installed; |
| 244 | char resp_buffer[30]; | 259 | char resp_buffer[30]; |
| 245 | const struct firmware *fw_entry; | 260 | const struct firmware *fw_entry; |
| 246 | long gpios[ST_MAX]; | 261 | long nshutdown; |
| 247 | unsigned long rx_state; | 262 | unsigned long rx_state; |
| 248 | unsigned long rx_count; | 263 | unsigned long rx_count; |
| 249 | struct sk_buff *rx_skb; | 264 | struct sk_buff *rx_skb; |
| 250 | struct rfkill *rfkill[ST_MAX]; | ||
| 251 | enum proto_type rf_protos[ST_MAX]; | ||
| 252 | struct st_data_s *core_data; | 265 | struct st_data_s *core_data; |
| 253 | struct chip_version version; | 266 | struct chip_version version; |
| 267 | unsigned char ldisc_install; | ||
| 268 | unsigned char dev_name[UART_DEV_NAME_LEN]; | ||
| 269 | unsigned char flow_cntrl; | ||
| 270 | unsigned long baud_rate; | ||
| 254 | }; | 271 | }; |
| 255 | 272 | ||
| 256 | /** | 273 | /** |
| @@ -262,7 +279,6 @@ long st_kim_start(void *); | |||
| 262 | long st_kim_stop(void *); | 279 | long st_kim_stop(void *); |
| 263 | 280 | ||
| 264 | void st_kim_recv(void *, const unsigned char *, long count); | 281 | void st_kim_recv(void *, const unsigned char *, long count); |
| 265 | void st_kim_chip_toggle(enum proto_type, enum kim_gpio_state); | ||
| 266 | void st_kim_complete(void *); | 282 | void st_kim_complete(void *); |
| 267 | void kim_st_list_protocols(struct st_data_s *, void *); | 283 | void kim_st_list_protocols(struct st_data_s *, void *); |
| 268 | 284 | ||
| @@ -338,12 +354,8 @@ struct hci_command { | |||
| 338 | 354 | ||
| 339 | /* ST LL receiver states */ | 355 | /* ST LL receiver states */ |
| 340 | #define ST_W4_PACKET_TYPE 0 | 356 | #define ST_W4_PACKET_TYPE 0 |
| 341 | #define ST_BT_W4_EVENT_HDR 1 | 357 | #define ST_W4_HEADER 1 |
| 342 | #define ST_BT_W4_ACL_HDR 2 | 358 | #define ST_W4_DATA 2 |
| 343 | #define ST_BT_W4_SCO_HDR 3 | ||
| 344 | #define ST_BT_W4_DATA 4 | ||
| 345 | #define ST_FM_W4_EVENT_HDR 5 | ||
| 346 | #define ST_GPS_W4_EVENT_HDR 6 | ||
| 347 | 359 | ||
| 348 | /* ST LL state machines */ | 360 | /* ST LL state machines */ |
| 349 | #define ST_LL_ASLEEP 0 | 361 | #define ST_LL_ASLEEP 0 |
| @@ -397,4 +409,14 @@ struct gps_event_hdr { | |||
| 397 | u16 plen; | 409 | u16 plen; |
| 398 | } __attribute__ ((packed)); | 410 | } __attribute__ ((packed)); |
| 399 | 411 | ||
| 412 | /* platform data */ | ||
| 413 | struct ti_st_plat_data { | ||
| 414 | long nshutdown_gpio; | ||
| 415 | unsigned char dev_name[UART_DEV_NAME_LEN]; /* uart name */ | ||
| 416 | unsigned char flow_cntrl; /* flow control flag */ | ||
| 417 | unsigned long baud_rate; | ||
| 418 | int (*suspend)(struct platform_device *, pm_message_t); | ||
| 419 | int (*resume)(struct platform_device *); | ||
| 420 | }; | ||
| 421 | |||
| 400 | #endif /* TI_WILINK_ST_H */ | 422 | #endif /* TI_WILINK_ST_H */ |
diff --git a/include/linux/time.h b/include/linux/time.h index 1e6d3b59238d..454a26205787 100644 --- a/include/linux/time.h +++ b/include/linux/time.h | |||
| @@ -113,8 +113,6 @@ static inline struct timespec timespec_sub(struct timespec lhs, | |||
| 113 | #define timespec_valid(ts) \ | 113 | #define timespec_valid(ts) \ |
| 114 | (((ts)->tv_sec >= 0) && (((unsigned long) (ts)->tv_nsec) < NSEC_PER_SEC)) | 114 | (((ts)->tv_sec >= 0) && (((unsigned long) (ts)->tv_nsec) < NSEC_PER_SEC)) |
| 115 | 115 | ||
| 116 | extern seqlock_t xtime_lock; | ||
| 117 | |||
| 118 | extern void read_persistent_clock(struct timespec *ts); | 116 | extern void read_persistent_clock(struct timespec *ts); |
| 119 | extern void read_boot_clock(struct timespec *ts); | 117 | extern void read_boot_clock(struct timespec *ts); |
| 120 | extern int update_persistent_clock(struct timespec now); | 118 | extern int update_persistent_clock(struct timespec now); |
| @@ -125,8 +123,9 @@ extern int timekeeping_suspended; | |||
| 125 | unsigned long get_seconds(void); | 123 | unsigned long get_seconds(void); |
| 126 | struct timespec current_kernel_time(void); | 124 | struct timespec current_kernel_time(void); |
| 127 | struct timespec __current_kernel_time(void); /* does not take xtime_lock */ | 125 | struct timespec __current_kernel_time(void); /* does not take xtime_lock */ |
| 128 | struct timespec __get_wall_to_monotonic(void); /* does not take xtime_lock */ | ||
| 129 | struct timespec get_monotonic_coarse(void); | 126 | struct timespec get_monotonic_coarse(void); |
| 127 | void get_xtime_and_monotonic_and_sleep_offset(struct timespec *xtim, | ||
| 128 | struct timespec *wtom, struct timespec *sleep); | ||
| 130 | 129 | ||
| 131 | #define CURRENT_TIME (current_kernel_time()) | 130 | #define CURRENT_TIME (current_kernel_time()) |
| 132 | #define CURRENT_TIME_SEC ((struct timespec) { get_seconds(), 0 }) | 131 | #define CURRENT_TIME_SEC ((struct timespec) { get_seconds(), 0 }) |
| @@ -147,8 +146,9 @@ static inline u32 arch_gettimeoffset(void) { return 0; } | |||
| 147 | #endif | 146 | #endif |
| 148 | 147 | ||
| 149 | extern void do_gettimeofday(struct timeval *tv); | 148 | extern void do_gettimeofday(struct timeval *tv); |
| 150 | extern int do_settimeofday(struct timespec *tv); | 149 | extern int do_settimeofday(const struct timespec *tv); |
| 151 | extern int do_sys_settimeofday(struct timespec *tv, struct timezone *tz); | 150 | extern int do_sys_settimeofday(const struct timespec *tv, |
| 151 | const struct timezone *tz); | ||
| 152 | #define do_posix_clock_monotonic_gettime(ts) ktime_get_ts(ts) | 152 | #define do_posix_clock_monotonic_gettime(ts) ktime_get_ts(ts) |
| 153 | extern long do_utimes(int dfd, const char __user *filename, struct timespec *times, int flags); | 153 | extern long do_utimes(int dfd, const char __user *filename, struct timespec *times, int flags); |
| 154 | struct itimerval; | 154 | struct itimerval; |
| @@ -162,12 +162,13 @@ extern void getnstime_raw_and_real(struct timespec *ts_raw, | |||
| 162 | struct timespec *ts_real); | 162 | struct timespec *ts_real); |
| 163 | extern void getboottime(struct timespec *ts); | 163 | extern void getboottime(struct timespec *ts); |
| 164 | extern void monotonic_to_bootbased(struct timespec *ts); | 164 | extern void monotonic_to_bootbased(struct timespec *ts); |
| 165 | extern void get_monotonic_boottime(struct timespec *ts); | ||
| 165 | 166 | ||
| 166 | extern struct timespec timespec_trunc(struct timespec t, unsigned gran); | 167 | extern struct timespec timespec_trunc(struct timespec t, unsigned gran); |
| 167 | extern int timekeeping_valid_for_hres(void); | 168 | extern int timekeeping_valid_for_hres(void); |
| 168 | extern u64 timekeeping_max_deferment(void); | 169 | extern u64 timekeeping_max_deferment(void); |
| 169 | extern void update_wall_time(void); | ||
| 170 | extern void timekeeping_leap_insert(int leapsecond); | 170 | extern void timekeeping_leap_insert(int leapsecond); |
| 171 | extern int timekeeping_inject_offset(struct timespec *ts); | ||
| 171 | 172 | ||
| 172 | struct tms; | 173 | struct tms; |
| 173 | extern void do_sys_times(struct tms *); | 174 | extern void do_sys_times(struct tms *); |
| @@ -292,6 +293,7 @@ struct itimerval { | |||
| 292 | #define CLOCK_MONOTONIC_RAW 4 | 293 | #define CLOCK_MONOTONIC_RAW 4 |
| 293 | #define CLOCK_REALTIME_COARSE 5 | 294 | #define CLOCK_REALTIME_COARSE 5 |
| 294 | #define CLOCK_MONOTONIC_COARSE 6 | 295 | #define CLOCK_MONOTONIC_COARSE 6 |
| 296 | #define CLOCK_BOOTTIME 7 | ||
| 295 | 297 | ||
| 296 | /* | 298 | /* |
| 297 | * The IDs of various hardware clocks: | 299 | * The IDs of various hardware clocks: |
diff --git a/include/linux/timex.h b/include/linux/timex.h index d23999f9499d..aa60fe7b6ed6 100644 --- a/include/linux/timex.h +++ b/include/linux/timex.h | |||
| @@ -73,7 +73,7 @@ struct timex { | |||
| 73 | long tolerance; /* clock frequency tolerance (ppm) | 73 | long tolerance; /* clock frequency tolerance (ppm) |
| 74 | * (read only) | 74 | * (read only) |
| 75 | */ | 75 | */ |
| 76 | struct timeval time; /* (read only) */ | 76 | struct timeval time; /* (read only, except for ADJ_SETOFFSET) */ |
| 77 | long tick; /* (modified) usecs between clock ticks */ | 77 | long tick; /* (modified) usecs between clock ticks */ |
| 78 | 78 | ||
| 79 | long ppsfreq; /* pps frequency (scaled ppm) (ro) */ | 79 | long ppsfreq; /* pps frequency (scaled ppm) (ro) */ |
| @@ -102,6 +102,7 @@ struct timex { | |||
| 102 | #define ADJ_STATUS 0x0010 /* clock status */ | 102 | #define ADJ_STATUS 0x0010 /* clock status */ |
| 103 | #define ADJ_TIMECONST 0x0020 /* pll time constant */ | 103 | #define ADJ_TIMECONST 0x0020 /* pll time constant */ |
| 104 | #define ADJ_TAI 0x0080 /* set TAI offset */ | 104 | #define ADJ_TAI 0x0080 /* set TAI offset */ |
| 105 | #define ADJ_SETOFFSET 0x0100 /* add 'time' to current time */ | ||
| 105 | #define ADJ_MICRO 0x1000 /* select microsecond resolution */ | 106 | #define ADJ_MICRO 0x1000 /* select microsecond resolution */ |
| 106 | #define ADJ_NANO 0x2000 /* select nanosecond resolution */ | 107 | #define ADJ_NANO 0x2000 /* select nanosecond resolution */ |
| 107 | #define ADJ_TICK 0x4000 /* tick value */ | 108 | #define ADJ_TICK 0x4000 /* tick value */ |
diff --git a/include/linux/tipc.h b/include/linux/tipc.h index 1eefa3f6d1f4..a5b994a204d2 100644 --- a/include/linux/tipc.h +++ b/include/linux/tipc.h | |||
| @@ -2,7 +2,7 @@ | |||
| 2 | * include/linux/tipc.h: Include file for TIPC socket interface | 2 | * include/linux/tipc.h: Include file for TIPC socket interface |
| 3 | * | 3 | * |
| 4 | * Copyright (c) 2003-2006, Ericsson AB | 4 | * Copyright (c) 2003-2006, Ericsson AB |
| 5 | * Copyright (c) 2005, Wind River Systems | 5 | * Copyright (c) 2005, 2010-2011, Wind River Systems |
| 6 | * All rights reserved. | 6 | * All rights reserved. |
| 7 | * | 7 | * |
| 8 | * Redistribution and use in source and binary forms, with or without | 8 | * Redistribution and use in source and binary forms, with or without |
| @@ -130,12 +130,6 @@ static inline unsigned int tipc_node(__u32 addr) | |||
| 130 | #define TIPC_SUB_PORTS 0x01 /* filter for port availability */ | 130 | #define TIPC_SUB_PORTS 0x01 /* filter for port availability */ |
| 131 | #define TIPC_SUB_SERVICE 0x02 /* filter for service availability */ | 131 | #define TIPC_SUB_SERVICE 0x02 /* filter for service availability */ |
| 132 | #define TIPC_SUB_CANCEL 0x04 /* cancel a subscription */ | 132 | #define TIPC_SUB_CANCEL 0x04 /* cancel a subscription */ |
| 133 | #if 0 | ||
| 134 | /* The following filter options are not currently implemented */ | ||
| 135 | #define TIPC_SUB_NO_BIND_EVTS 0x04 /* filter out "publish" events */ | ||
| 136 | #define TIPC_SUB_NO_UNBIND_EVTS 0x08 /* filter out "withdraw" events */ | ||
| 137 | #define TIPC_SUB_SINGLE_EVT 0x10 /* expire after first event */ | ||
| 138 | #endif | ||
| 139 | 133 | ||
| 140 | #define TIPC_WAIT_FOREVER (~0) /* timeout for permanent subscription */ | 134 | #define TIPC_WAIT_FOREVER (~0) /* timeout for permanent subscription */ |
| 141 | 135 | ||
diff --git a/include/linux/tipc_config.h b/include/linux/tipc_config.h index 7d42460a5e3c..0db239590b4d 100644 --- a/include/linux/tipc_config.h +++ b/include/linux/tipc_config.h | |||
| @@ -2,7 +2,7 @@ | |||
| 2 | * include/linux/tipc_config.h: Include file for TIPC configuration interface | 2 | * include/linux/tipc_config.h: Include file for TIPC configuration interface |
| 3 | * | 3 | * |
| 4 | * Copyright (c) 2003-2006, Ericsson AB | 4 | * Copyright (c) 2003-2006, Ericsson AB |
| 5 | * Copyright (c) 2005-2007, Wind River Systems | 5 | * Copyright (c) 2005-2007, 2010-2011, Wind River Systems |
| 6 | * All rights reserved. | 6 | * All rights reserved. |
| 7 | * | 7 | * |
| 8 | * Redistribution and use in source and binary forms, with or without | 8 | * Redistribution and use in source and binary forms, with or without |
| @@ -76,13 +76,6 @@ | |||
| 76 | #define TIPC_CMD_SHOW_LINK_STATS 0x000B /* tx link_name, rx ultra_string */ | 76 | #define TIPC_CMD_SHOW_LINK_STATS 0x000B /* tx link_name, rx ultra_string */ |
| 77 | #define TIPC_CMD_SHOW_STATS 0x000F /* tx unsigned, rx ultra_string */ | 77 | #define TIPC_CMD_SHOW_STATS 0x000F /* tx unsigned, rx ultra_string */ |
| 78 | 78 | ||
| 79 | #if 0 | ||
| 80 | #define TIPC_CMD_SHOW_PORT_STATS 0x0008 /* tx port_ref, rx ultra_string */ | ||
| 81 | #define TIPC_CMD_RESET_PORT_STATS 0x0009 /* tx port_ref, rx none */ | ||
| 82 | #define TIPC_CMD_GET_ROUTES 0x000A /* tx ?, rx ? */ | ||
| 83 | #define TIPC_CMD_GET_LINK_PEER 0x000D /* tx link_name, rx ? */ | ||
| 84 | #endif | ||
| 85 | |||
| 86 | /* | 79 | /* |
| 87 | * Protected commands: | 80 | * Protected commands: |
| 88 | * May only be issued by "network administration capable" process. | 81 | * May only be issued by "network administration capable" process. |
| @@ -96,7 +89,7 @@ | |||
| 96 | #define TIPC_CMD_GET_MAX_SUBSCR 0x4006 /* tx none, rx unsigned */ | 89 | #define TIPC_CMD_GET_MAX_SUBSCR 0x4006 /* tx none, rx unsigned */ |
| 97 | #define TIPC_CMD_GET_MAX_ZONES 0x4007 /* obsoleted */ | 90 | #define TIPC_CMD_GET_MAX_ZONES 0x4007 /* obsoleted */ |
| 98 | #define TIPC_CMD_GET_MAX_CLUSTERS 0x4008 /* obsoleted */ | 91 | #define TIPC_CMD_GET_MAX_CLUSTERS 0x4008 /* obsoleted */ |
| 99 | #define TIPC_CMD_GET_MAX_NODES 0x4009 /* tx none, rx unsigned */ | 92 | #define TIPC_CMD_GET_MAX_NODES 0x4009 /* obsoleted */ |
| 100 | #define TIPC_CMD_GET_MAX_SLAVES 0x400A /* obsoleted */ | 93 | #define TIPC_CMD_GET_MAX_SLAVES 0x400A /* obsoleted */ |
| 101 | #define TIPC_CMD_GET_NETID 0x400B /* tx none, rx unsigned */ | 94 | #define TIPC_CMD_GET_NETID 0x400B /* tx none, rx unsigned */ |
| 102 | 95 | ||
| @@ -109,13 +102,6 @@ | |||
| 109 | #define TIPC_CMD_DUMP_LOG 0x410B /* tx none, rx ultra_string */ | 102 | #define TIPC_CMD_DUMP_LOG 0x410B /* tx none, rx ultra_string */ |
| 110 | #define TIPC_CMD_RESET_LINK_STATS 0x410C /* tx link_name, rx none */ | 103 | #define TIPC_CMD_RESET_LINK_STATS 0x410C /* tx link_name, rx none */ |
| 111 | 104 | ||
| 112 | #if 0 | ||
| 113 | #define TIPC_CMD_CREATE_LINK 0x4103 /* tx link_create, rx none */ | ||
| 114 | #define TIPC_CMD_REMOVE_LINK 0x4104 /* tx link_name, rx none */ | ||
| 115 | #define TIPC_CMD_BLOCK_LINK 0x4105 /* tx link_name, rx none */ | ||
| 116 | #define TIPC_CMD_UNBLOCK_LINK 0x4106 /* tx link_name, rx none */ | ||
| 117 | #endif | ||
| 118 | |||
| 119 | /* | 105 | /* |
| 120 | * Private commands: | 106 | * Private commands: |
| 121 | * May only be issued by "network administration capable" process. | 107 | * May only be issued by "network administration capable" process. |
| @@ -123,16 +109,13 @@ | |||
| 123 | */ | 109 | */ |
| 124 | 110 | ||
| 125 | #define TIPC_CMD_SET_NODE_ADDR 0x8001 /* tx net_addr, rx none */ | 111 | #define TIPC_CMD_SET_NODE_ADDR 0x8001 /* tx net_addr, rx none */ |
| 126 | #if 0 | ||
| 127 | #define TIPC_CMD_SET_ZONE_MASTER 0x8002 /* tx none, rx none */ | ||
| 128 | #endif | ||
| 129 | #define TIPC_CMD_SET_REMOTE_MNG 0x8003 /* tx unsigned, rx none */ | 112 | #define TIPC_CMD_SET_REMOTE_MNG 0x8003 /* tx unsigned, rx none */ |
| 130 | #define TIPC_CMD_SET_MAX_PORTS 0x8004 /* tx unsigned, rx none */ | 113 | #define TIPC_CMD_SET_MAX_PORTS 0x8004 /* tx unsigned, rx none */ |
| 131 | #define TIPC_CMD_SET_MAX_PUBL 0x8005 /* tx unsigned, rx none */ | 114 | #define TIPC_CMD_SET_MAX_PUBL 0x8005 /* tx unsigned, rx none */ |
| 132 | #define TIPC_CMD_SET_MAX_SUBSCR 0x8006 /* tx unsigned, rx none */ | 115 | #define TIPC_CMD_SET_MAX_SUBSCR 0x8006 /* tx unsigned, rx none */ |
| 133 | #define TIPC_CMD_SET_MAX_ZONES 0x8007 /* obsoleted */ | 116 | #define TIPC_CMD_SET_MAX_ZONES 0x8007 /* obsoleted */ |
| 134 | #define TIPC_CMD_SET_MAX_CLUSTERS 0x8008 /* obsoleted */ | 117 | #define TIPC_CMD_SET_MAX_CLUSTERS 0x8008 /* obsoleted */ |
| 135 | #define TIPC_CMD_SET_MAX_NODES 0x8009 /* tx unsigned, rx none */ | 118 | #define TIPC_CMD_SET_MAX_NODES 0x8009 /* obsoleted */ |
| 136 | #define TIPC_CMD_SET_MAX_SLAVES 0x800A /* obsoleted */ | 119 | #define TIPC_CMD_SET_MAX_SLAVES 0x800A /* obsoleted */ |
| 137 | #define TIPC_CMD_SET_NETID 0x800B /* tx unsigned, rx none */ | 120 | #define TIPC_CMD_SET_NETID 0x800B /* tx unsigned, rx none */ |
| 138 | 121 | ||
| @@ -193,6 +176,10 @@ | |||
| 193 | #define TIPC_DEF_LINK_TOL 1500 | 176 | #define TIPC_DEF_LINK_TOL 1500 |
| 194 | #define TIPC_MAX_LINK_TOL 30000 | 177 | #define TIPC_MAX_LINK_TOL 30000 |
| 195 | 178 | ||
| 179 | #if (TIPC_MIN_LINK_TOL < 16) | ||
| 180 | #error "TIPC_MIN_LINK_TOL is too small (abort limit may be NaN)" | ||
| 181 | #endif | ||
| 182 | |||
| 196 | /* | 183 | /* |
| 197 | * Link window limits (min, default, max), in packets | 184 | * Link window limits (min, default, max), in packets |
| 198 | */ | 185 | */ |
| @@ -215,7 +202,7 @@ struct tipc_link_info { | |||
| 215 | 202 | ||
| 216 | struct tipc_bearer_config { | 203 | struct tipc_bearer_config { |
| 217 | __be32 priority; /* Range [1,31]. Override per link */ | 204 | __be32 priority; /* Range [1,31]. Override per link */ |
| 218 | __be32 detect_scope; | 205 | __be32 disc_domain; /* <Z.C.N> describing desired nodes */ |
| 219 | char name[TIPC_MAX_BEARER_NAME]; | 206 | char name[TIPC_MAX_BEARER_NAME]; |
| 220 | }; | 207 | }; |
| 221 | 208 | ||
| @@ -247,15 +234,6 @@ struct tipc_name_table_query { | |||
| 247 | #define TIPC_CFG_NOT_SUPPORTED "\x84" /* request is not supported by TIPC */ | 234 | #define TIPC_CFG_NOT_SUPPORTED "\x84" /* request is not supported by TIPC */ |
| 248 | #define TIPC_CFG_INVALID_VALUE "\x85" /* request has invalid argument value */ | 235 | #define TIPC_CFG_INVALID_VALUE "\x85" /* request has invalid argument value */ |
| 249 | 236 | ||
| 250 | #if 0 | ||
| 251 | /* prototypes TLV structures for proposed commands */ | ||
| 252 | struct tipc_link_create { | ||
| 253 | __u32 domain; | ||
| 254 | struct tipc_media_addr peer_addr; | ||
| 255 | char bearer_name[TIPC_MAX_BEARER_NAME]; | ||
| 256 | }; | ||
| 257 | #endif | ||
| 258 | |||
| 259 | /* | 237 | /* |
| 260 | * A TLV consists of a descriptor, followed by the TLV value. | 238 | * A TLV consists of a descriptor, followed by the TLV value. |
| 261 | * TLV descriptor fields are stored in network byte order; | 239 | * TLV descriptor fields are stored in network byte order; |
diff --git a/include/linux/tty.h b/include/linux/tty.h index 54e4eaaa0561..4e53d4641b38 100644 --- a/include/linux/tty.h +++ b/include/linux/tty.h | |||
| @@ -448,6 +448,7 @@ extern void tty_encode_baud_rate(struct tty_struct *tty, | |||
| 448 | speed_t ibaud, speed_t obaud); | 448 | speed_t ibaud, speed_t obaud); |
| 449 | extern void tty_termios_copy_hw(struct ktermios *new, struct ktermios *old); | 449 | extern void tty_termios_copy_hw(struct ktermios *new, struct ktermios *old); |
| 450 | extern int tty_termios_hw_change(struct ktermios *a, struct ktermios *b); | 450 | extern int tty_termios_hw_change(struct ktermios *a, struct ktermios *b); |
| 451 | extern int tty_set_termios(struct tty_struct *tty, struct ktermios *kt); | ||
| 451 | 452 | ||
| 452 | extern struct tty_ldisc *tty_ldisc_ref(struct tty_struct *); | 453 | extern struct tty_ldisc *tty_ldisc_ref(struct tty_struct *); |
| 453 | extern void tty_ldisc_deref(struct tty_ldisc *); | 454 | extern void tty_ldisc_deref(struct tty_ldisc *); |
| @@ -584,10 +585,10 @@ extern int pcxe_open(struct tty_struct *tty, struct file *filp); | |||
| 584 | 585 | ||
| 585 | /* vt.c */ | 586 | /* vt.c */ |
| 586 | 587 | ||
| 587 | extern int vt_ioctl(struct tty_struct *tty, struct file *file, | 588 | extern int vt_ioctl(struct tty_struct *tty, |
| 588 | unsigned int cmd, unsigned long arg); | 589 | unsigned int cmd, unsigned long arg); |
| 589 | 590 | ||
| 590 | extern long vt_compat_ioctl(struct tty_struct *tty, struct file * file, | 591 | extern long vt_compat_ioctl(struct tty_struct *tty, |
| 591 | unsigned int cmd, unsigned long arg); | 592 | unsigned int cmd, unsigned long arg); |
| 592 | 593 | ||
| 593 | /* tty_mutex.c */ | 594 | /* tty_mutex.c */ |
diff --git a/include/linux/tty_driver.h b/include/linux/tty_driver.h index c3d43eb4150c..9deeac855240 100644 --- a/include/linux/tty_driver.h +++ b/include/linux/tty_driver.h | |||
| @@ -98,8 +98,7 @@ | |||
| 98 | * | 98 | * |
| 99 | * Note: Do not call this function directly, call tty_write_room | 99 | * Note: Do not call this function directly, call tty_write_room |
| 100 | * | 100 | * |
| 101 | * int (*ioctl)(struct tty_struct *tty, struct file * file, | 101 | * int (*ioctl)(struct tty_struct *tty, unsigned int cmd, unsigned long arg); |
| 102 | * unsigned int cmd, unsigned long arg); | ||
| 103 | * | 102 | * |
| 104 | * This routine allows the tty driver to implement | 103 | * This routine allows the tty driver to implement |
| 105 | * device-specific ioctls. If the ioctl number passed in cmd | 104 | * device-specific ioctls. If the ioctl number passed in cmd |
| @@ -107,7 +106,7 @@ | |||
| 107 | * | 106 | * |
| 108 | * Optional | 107 | * Optional |
| 109 | * | 108 | * |
| 110 | * long (*compat_ioctl)(struct tty_struct *tty, struct file * file, | 109 | * long (*compat_ioctl)(struct tty_struct *tty,, |
| 111 | * unsigned int cmd, unsigned long arg); | 110 | * unsigned int cmd, unsigned long arg); |
| 112 | * | 111 | * |
| 113 | * implement ioctl processing for 32 bit process on 64 bit system | 112 | * implement ioctl processing for 32 bit process on 64 bit system |
| @@ -256,9 +255,9 @@ struct tty_operations { | |||
| 256 | void (*flush_chars)(struct tty_struct *tty); | 255 | void (*flush_chars)(struct tty_struct *tty); |
| 257 | int (*write_room)(struct tty_struct *tty); | 256 | int (*write_room)(struct tty_struct *tty); |
| 258 | int (*chars_in_buffer)(struct tty_struct *tty); | 257 | int (*chars_in_buffer)(struct tty_struct *tty); |
| 259 | int (*ioctl)(struct tty_struct *tty, struct file * file, | 258 | int (*ioctl)(struct tty_struct *tty, |
| 260 | unsigned int cmd, unsigned long arg); | 259 | unsigned int cmd, unsigned long arg); |
| 261 | long (*compat_ioctl)(struct tty_struct *tty, struct file * file, | 260 | long (*compat_ioctl)(struct tty_struct *tty, |
| 262 | unsigned int cmd, unsigned long arg); | 261 | unsigned int cmd, unsigned long arg); |
| 263 | void (*set_termios)(struct tty_struct *tty, struct ktermios * old); | 262 | void (*set_termios)(struct tty_struct *tty, struct ktermios * old); |
| 264 | void (*throttle)(struct tty_struct * tty); | 263 | void (*throttle)(struct tty_struct * tty); |
| @@ -271,8 +270,8 @@ struct tty_operations { | |||
| 271 | void (*set_ldisc)(struct tty_struct *tty); | 270 | void (*set_ldisc)(struct tty_struct *tty); |
| 272 | void (*wait_until_sent)(struct tty_struct *tty, int timeout); | 271 | void (*wait_until_sent)(struct tty_struct *tty, int timeout); |
| 273 | void (*send_xchar)(struct tty_struct *tty, char ch); | 272 | void (*send_xchar)(struct tty_struct *tty, char ch); |
| 274 | int (*tiocmget)(struct tty_struct *tty, struct file *file); | 273 | int (*tiocmget)(struct tty_struct *tty); |
| 275 | int (*tiocmset)(struct tty_struct *tty, struct file *file, | 274 | int (*tiocmset)(struct tty_struct *tty, |
| 276 | unsigned int set, unsigned int clear); | 275 | unsigned int set, unsigned int clear); |
| 277 | int (*resize)(struct tty_struct *tty, struct winsize *ws); | 276 | int (*resize)(struct tty_struct *tty, struct winsize *ws); |
| 278 | int (*set_termiox)(struct tty_struct *tty, struct termiox *tnew); | 277 | int (*set_termiox)(struct tty_struct *tty, struct termiox *tnew); |
diff --git a/include/linux/usb.h b/include/linux/usb.h index bd69b65f3356..e63efeb378e3 100644 --- a/include/linux/usb.h +++ b/include/linux/usb.h | |||
| @@ -976,6 +976,7 @@ extern int usb_disabled(void); | |||
| 976 | #define URB_SETUP_MAP_SINGLE 0x00100000 /* Setup packet DMA mapped */ | 976 | #define URB_SETUP_MAP_SINGLE 0x00100000 /* Setup packet DMA mapped */ |
| 977 | #define URB_SETUP_MAP_LOCAL 0x00200000 /* HCD-local setup packet */ | 977 | #define URB_SETUP_MAP_LOCAL 0x00200000 /* HCD-local setup packet */ |
| 978 | #define URB_DMA_SG_COMBINED 0x00400000 /* S-G entries were combined */ | 978 | #define URB_DMA_SG_COMBINED 0x00400000 /* S-G entries were combined */ |
| 979 | #define URB_ALIGNED_TEMP_BUFFER 0x00800000 /* Temp buffer was alloc'd */ | ||
| 979 | 980 | ||
| 980 | struct usb_iso_packet_descriptor { | 981 | struct usb_iso_packet_descriptor { |
| 981 | unsigned int offset; | 982 | unsigned int offset; |
diff --git a/include/linux/usb/Kbuild b/include/linux/usb/Kbuild index 51410e0200cf..ed91fb62674b 100644 --- a/include/linux/usb/Kbuild +++ b/include/linux/usb/Kbuild | |||
| @@ -2,6 +2,7 @@ header-y += audio.h | |||
| 2 | header-y += cdc.h | 2 | header-y += cdc.h |
| 3 | header-y += ch9.h | 3 | header-y += ch9.h |
| 4 | header-y += ch11.h | 4 | header-y += ch11.h |
| 5 | header-y += functionfs.h | ||
| 5 | header-y += gadgetfs.h | 6 | header-y += gadgetfs.h |
| 6 | header-y += midi.h | 7 | header-y += midi.h |
| 7 | header-y += g_printer.h | 8 | header-y += g_printer.h |
diff --git a/include/linux/usb/ch11.h b/include/linux/usb/ch11.h index 10ec0699bea4..4ebaf0824179 100644 --- a/include/linux/usb/ch11.h +++ b/include/linux/usb/ch11.h | |||
| @@ -26,6 +26,7 @@ | |||
| 26 | #define HUB_RESET_TT 9 | 26 | #define HUB_RESET_TT 9 |
| 27 | #define HUB_GET_TT_STATE 10 | 27 | #define HUB_GET_TT_STATE 10 |
| 28 | #define HUB_STOP_TT 11 | 28 | #define HUB_STOP_TT 11 |
| 29 | #define HUB_SET_DEPTH 12 | ||
| 29 | 30 | ||
| 30 | /* | 31 | /* |
| 31 | * Hub class additional requests defined by USB 3.0 spec | 32 | * Hub class additional requests defined by USB 3.0 spec |
| @@ -61,6 +62,12 @@ | |||
| 61 | #define USB_PORT_FEAT_TEST 21 | 62 | #define USB_PORT_FEAT_TEST 21 |
| 62 | #define USB_PORT_FEAT_INDICATOR 22 | 63 | #define USB_PORT_FEAT_INDICATOR 22 |
| 63 | #define USB_PORT_FEAT_C_PORT_L1 23 | 64 | #define USB_PORT_FEAT_C_PORT_L1 23 |
| 65 | #define USB_PORT_FEAT_C_PORT_LINK_STATE 25 | ||
| 66 | #define USB_PORT_FEAT_C_PORT_CONFIG_ERROR 26 | ||
| 67 | #define USB_PORT_FEAT_PORT_REMOTE_WAKE_MASK 27 | ||
| 68 | #define USB_PORT_FEAT_BH_PORT_RESET 28 | ||
| 69 | #define USB_PORT_FEAT_C_BH_PORT_RESET 29 | ||
| 70 | #define USB_PORT_FEAT_FORCE_LINKPM_ACCEPT 30 | ||
| 64 | 71 | ||
| 65 | /* | 72 | /* |
| 66 | * Port feature selectors added by USB 3.0 spec. | 73 | * Port feature selectors added by USB 3.0 spec. |
| @@ -102,7 +109,6 @@ struct usb_port_status { | |||
| 102 | #define USB_PORT_STAT_TEST 0x0800 | 109 | #define USB_PORT_STAT_TEST 0x0800 |
| 103 | #define USB_PORT_STAT_INDICATOR 0x1000 | 110 | #define USB_PORT_STAT_INDICATOR 0x1000 |
| 104 | /* bits 13 to 15 are reserved */ | 111 | /* bits 13 to 15 are reserved */ |
| 105 | #define USB_PORT_STAT_SUPER_SPEED 0x8000 /* Linux-internal */ | ||
| 106 | 112 | ||
| 107 | /* | 113 | /* |
| 108 | * Additions to wPortStatus bit field from USB 3.0 | 114 | * Additions to wPortStatus bit field from USB 3.0 |
| @@ -110,8 +116,14 @@ struct usb_port_status { | |||
| 110 | */ | 116 | */ |
| 111 | #define USB_PORT_STAT_LINK_STATE 0x01e0 | 117 | #define USB_PORT_STAT_LINK_STATE 0x01e0 |
| 112 | #define USB_SS_PORT_STAT_POWER 0x0200 | 118 | #define USB_SS_PORT_STAT_POWER 0x0200 |
| 119 | #define USB_SS_PORT_STAT_SPEED 0x1c00 | ||
| 113 | #define USB_PORT_STAT_SPEED_5GBPS 0x0000 | 120 | #define USB_PORT_STAT_SPEED_5GBPS 0x0000 |
| 114 | /* Valid only if port is enabled */ | 121 | /* Valid only if port is enabled */ |
| 122 | /* Bits that are the same from USB 2.0 */ | ||
| 123 | #define USB_SS_PORT_STAT_MASK (USB_PORT_STAT_CONNECTION | \ | ||
| 124 | USB_PORT_STAT_ENABLE | \ | ||
| 125 | USB_PORT_STAT_OVERCURRENT | \ | ||
| 126 | USB_PORT_STAT_RESET) | ||
| 115 | 127 | ||
| 116 | /* | 128 | /* |
| 117 | * Definitions for PORT_LINK_STATE values | 129 | * Definitions for PORT_LINK_STATE values |
| @@ -132,8 +144,8 @@ struct usb_port_status { | |||
| 132 | 144 | ||
| 133 | /* | 145 | /* |
| 134 | * wPortChange bit field | 146 | * wPortChange bit field |
| 135 | * See USB 2.0 spec Table 11-22 | 147 | * See USB 2.0 spec Table 11-22 and USB 2.0 LPM ECN Table-4.10 |
| 136 | * Bits 0 to 4 shown, bits 5 to 15 are reserved | 148 | * Bits 0 to 5 shown, bits 6 to 15 are reserved |
| 137 | */ | 149 | */ |
| 138 | #define USB_PORT_STAT_C_CONNECTION 0x0001 | 150 | #define USB_PORT_STAT_C_CONNECTION 0x0001 |
| 139 | #define USB_PORT_STAT_C_ENABLE 0x0002 | 151 | #define USB_PORT_STAT_C_ENABLE 0x0002 |
| @@ -141,6 +153,13 @@ struct usb_port_status { | |||
| 141 | #define USB_PORT_STAT_C_OVERCURRENT 0x0008 | 153 | #define USB_PORT_STAT_C_OVERCURRENT 0x0008 |
| 142 | #define USB_PORT_STAT_C_RESET 0x0010 | 154 | #define USB_PORT_STAT_C_RESET 0x0010 |
| 143 | #define USB_PORT_STAT_C_L1 0x0020 | 155 | #define USB_PORT_STAT_C_L1 0x0020 |
| 156 | /* | ||
| 157 | * USB 3.0 wPortChange bit fields | ||
| 158 | * See USB 3.0 spec Table 10-11 | ||
| 159 | */ | ||
| 160 | #define USB_PORT_STAT_C_BH_RESET 0x0020 | ||
| 161 | #define USB_PORT_STAT_C_LINK_STATE 0x0040 | ||
| 162 | #define USB_PORT_STAT_C_CONFIG_ERROR 0x0080 | ||
| 144 | 163 | ||
| 145 | /* | 164 | /* |
| 146 | * wHubCharacteristics (masks) | 165 | * wHubCharacteristics (masks) |
| @@ -175,7 +194,9 @@ struct usb_hub_status { | |||
| 175 | */ | 194 | */ |
| 176 | 195 | ||
| 177 | #define USB_DT_HUB (USB_TYPE_CLASS | 0x09) | 196 | #define USB_DT_HUB (USB_TYPE_CLASS | 0x09) |
| 197 | #define USB_DT_SS_HUB (USB_TYPE_CLASS | 0x0a) | ||
| 178 | #define USB_DT_HUB_NONVAR_SIZE 7 | 198 | #define USB_DT_HUB_NONVAR_SIZE 7 |
| 199 | #define USB_DT_SS_HUB_SIZE 12 | ||
| 179 | 200 | ||
| 180 | struct usb_hub_descriptor { | 201 | struct usb_hub_descriptor { |
| 181 | __u8 bDescLength; | 202 | __u8 bDescLength; |
| @@ -184,11 +205,22 @@ struct usb_hub_descriptor { | |||
| 184 | __le16 wHubCharacteristics; | 205 | __le16 wHubCharacteristics; |
| 185 | __u8 bPwrOn2PwrGood; | 206 | __u8 bPwrOn2PwrGood; |
| 186 | __u8 bHubContrCurrent; | 207 | __u8 bHubContrCurrent; |
| 187 | /* add 1 bit for hub status change; round to bytes */ | ||
| 188 | __u8 DeviceRemovable[(USB_MAXCHILDREN + 1 + 7) / 8]; | ||
| 189 | __u8 PortPwrCtrlMask[(USB_MAXCHILDREN + 1 + 7) / 8]; | ||
| 190 | } __attribute__ ((packed)); | ||
| 191 | 208 | ||
| 209 | /* 2.0 and 3.0 hubs differ here */ | ||
| 210 | union { | ||
| 211 | struct { | ||
| 212 | /* add 1 bit for hub status change; round to bytes */ | ||
| 213 | __u8 DeviceRemovable[(USB_MAXCHILDREN + 1 + 7) / 8]; | ||
| 214 | __u8 PortPwrCtrlMask[(USB_MAXCHILDREN + 1 + 7) / 8]; | ||
| 215 | } __attribute__ ((packed)) hs; | ||
| 216 | |||
| 217 | struct { | ||
| 218 | __u8 bHubHdrDecLat; | ||
| 219 | __u16 wHubDelay; | ||
| 220 | __u16 DeviceRemovable; | ||
| 221 | } __attribute__ ((packed)) ss; | ||
| 222 | } u; | ||
| 223 | } __attribute__ ((packed)); | ||
| 192 | 224 | ||
| 193 | /* port indicator status selectors, tables 11-7 and 11-25 */ | 225 | /* port indicator status selectors, tables 11-7 and 11-25 */ |
| 194 | #define HUB_LED_AUTO 0 | 226 | #define HUB_LED_AUTO 0 |
diff --git a/include/linux/usb/ch9.h b/include/linux/usb/ch9.h index ab461948b579..b72f305ce6bd 100644 --- a/include/linux/usb/ch9.h +++ b/include/linux/usb/ch9.h | |||
| @@ -584,7 +584,9 @@ struct usb_ss_ep_comp_descriptor { | |||
| 584 | 584 | ||
| 585 | #define USB_DT_SS_EP_COMP_SIZE 6 | 585 | #define USB_DT_SS_EP_COMP_SIZE 6 |
| 586 | /* Bits 4:0 of bmAttributes if this is a bulk endpoint */ | 586 | /* Bits 4:0 of bmAttributes if this is a bulk endpoint */ |
| 587 | #define USB_SS_MAX_STREAMS(p) (1 << (p & 0x1f)) | 587 | #define USB_SS_MAX_STREAMS(p) (1 << ((p) & 0x1f)) |
| 588 | /* Bits 1:0 of bmAttributes if this is an isoc endpoint */ | ||
| 589 | #define USB_SS_MULT(p) (1 + ((p) & 0x3)) | ||
| 588 | 590 | ||
| 589 | /*-------------------------------------------------------------------------*/ | 591 | /*-------------------------------------------------------------------------*/ |
| 590 | 592 | ||
diff --git a/include/linux/usb/ehci_def.h b/include/linux/usb/ehci_def.h index 2e262cb15425..656380245198 100644 --- a/include/linux/usb/ehci_def.h +++ b/include/linux/usb/ehci_def.h | |||
| @@ -127,7 +127,9 @@ struct ehci_regs { | |||
| 127 | #define PORT_WKDISC_E (1<<21) /* wake on disconnect (enable) */ | 127 | #define PORT_WKDISC_E (1<<21) /* wake on disconnect (enable) */ |
| 128 | #define PORT_WKCONN_E (1<<20) /* wake on connect (enable) */ | 128 | #define PORT_WKCONN_E (1<<20) /* wake on connect (enable) */ |
| 129 | /* 19:16 for port testing */ | 129 | /* 19:16 for port testing */ |
| 130 | #define PORT_TEST_PKT (0x4<<16) /* Port Test Control - packet test */ | 130 | #define PORT_TEST(x) (((x)&0xf)<<16) /* Port Test Control */ |
| 131 | #define PORT_TEST_PKT PORT_TEST(0x4) /* Port Test Control - packet test */ | ||
| 132 | #define PORT_TEST_FORCE PORT_TEST(0x5) /* Port Test Control - force enable */ | ||
| 131 | #define PORT_LED_OFF (0<<14) | 133 | #define PORT_LED_OFF (0<<14) |
| 132 | #define PORT_LED_AMBER (1<<14) | 134 | #define PORT_LED_AMBER (1<<14) |
| 133 | #define PORT_LED_GREEN (2<<14) | 135 | #define PORT_LED_GREEN (2<<14) |
diff --git a/include/linux/usb/hcd.h b/include/linux/usb/hcd.h index a854fe89484e..0097136ba45d 100644 --- a/include/linux/usb/hcd.h +++ b/include/linux/usb/hcd.h | |||
| @@ -76,6 +76,10 @@ struct usb_hcd { | |||
| 76 | struct kref kref; /* reference counter */ | 76 | struct kref kref; /* reference counter */ |
| 77 | 77 | ||
| 78 | const char *product_desc; /* product/vendor string */ | 78 | const char *product_desc; /* product/vendor string */ |
| 79 | int speed; /* Speed for this roothub. | ||
| 80 | * May be different from | ||
| 81 | * hcd->driver->flags & HCD_MASK | ||
| 82 | */ | ||
| 79 | char irq_descr[24]; /* driver + bus # */ | 83 | char irq_descr[24]; /* driver + bus # */ |
| 80 | 84 | ||
| 81 | struct timer_list rh_timer; /* drives root-hub polling */ | 85 | struct timer_list rh_timer; /* drives root-hub polling */ |
| @@ -99,6 +103,8 @@ struct usb_hcd { | |||
| 99 | #define HCD_FLAG_POLL_RH 2 /* poll for rh status? */ | 103 | #define HCD_FLAG_POLL_RH 2 /* poll for rh status? */ |
| 100 | #define HCD_FLAG_POLL_PENDING 3 /* status has changed? */ | 104 | #define HCD_FLAG_POLL_PENDING 3 /* status has changed? */ |
| 101 | #define HCD_FLAG_WAKEUP_PENDING 4 /* root hub is resuming? */ | 105 | #define HCD_FLAG_WAKEUP_PENDING 4 /* root hub is resuming? */ |
| 106 | #define HCD_FLAG_RH_RUNNING 5 /* root hub is running? */ | ||
| 107 | #define HCD_FLAG_DEAD 6 /* controller has died? */ | ||
| 102 | 108 | ||
| 103 | /* The flags can be tested using these macros; they are likely to | 109 | /* The flags can be tested using these macros; they are likely to |
| 104 | * be slightly faster than test_bit(). | 110 | * be slightly faster than test_bit(). |
| @@ -108,6 +114,8 @@ struct usb_hcd { | |||
| 108 | #define HCD_POLL_RH(hcd) ((hcd)->flags & (1U << HCD_FLAG_POLL_RH)) | 114 | #define HCD_POLL_RH(hcd) ((hcd)->flags & (1U << HCD_FLAG_POLL_RH)) |
| 109 | #define HCD_POLL_PENDING(hcd) ((hcd)->flags & (1U << HCD_FLAG_POLL_PENDING)) | 115 | #define HCD_POLL_PENDING(hcd) ((hcd)->flags & (1U << HCD_FLAG_POLL_PENDING)) |
| 110 | #define HCD_WAKEUP_PENDING(hcd) ((hcd)->flags & (1U << HCD_FLAG_WAKEUP_PENDING)) | 116 | #define HCD_WAKEUP_PENDING(hcd) ((hcd)->flags & (1U << HCD_FLAG_WAKEUP_PENDING)) |
| 117 | #define HCD_RH_RUNNING(hcd) ((hcd)->flags & (1U << HCD_FLAG_RH_RUNNING)) | ||
| 118 | #define HCD_DEAD(hcd) ((hcd)->flags & (1U << HCD_FLAG_DEAD)) | ||
| 111 | 119 | ||
| 112 | /* Flags that get set only during HCD registration or removal. */ | 120 | /* Flags that get set only during HCD registration or removal. */ |
| 113 | unsigned rh_registered:1;/* is root hub registered? */ | 121 | unsigned rh_registered:1;/* is root hub registered? */ |
| @@ -138,7 +146,9 @@ struct usb_hcd { | |||
| 138 | * bandwidth_mutex should be dropped after a successful control message | 146 | * bandwidth_mutex should be dropped after a successful control message |
| 139 | * to the device, or resetting the bandwidth after a failed attempt. | 147 | * to the device, or resetting the bandwidth after a failed attempt. |
| 140 | */ | 148 | */ |
| 141 | struct mutex bandwidth_mutex; | 149 | struct mutex *bandwidth_mutex; |
| 150 | struct usb_hcd *shared_hcd; | ||
| 151 | struct usb_hcd *primary_hcd; | ||
| 142 | 152 | ||
| 143 | 153 | ||
| 144 | #define HCD_BUFFER_POOLS 4 | 154 | #define HCD_BUFFER_POOLS 4 |
| @@ -201,6 +211,7 @@ struct hc_driver { | |||
| 201 | int flags; | 211 | int flags; |
| 202 | #define HCD_MEMORY 0x0001 /* HC regs use memory (else I/O) */ | 212 | #define HCD_MEMORY 0x0001 /* HC regs use memory (else I/O) */ |
| 203 | #define HCD_LOCAL_MEM 0x0002 /* HC needs local memory */ | 213 | #define HCD_LOCAL_MEM 0x0002 /* HC needs local memory */ |
| 214 | #define HCD_SHARED 0x0004 /* Two (or more) usb_hcds share HW */ | ||
| 204 | #define HCD_USB11 0x0010 /* USB 1.1 */ | 215 | #define HCD_USB11 0x0010 /* USB 1.1 */ |
| 205 | #define HCD_USB2 0x0020 /* USB 2.0 */ | 216 | #define HCD_USB2 0x0020 /* USB 2.0 */ |
| 206 | #define HCD_USB3 0x0040 /* USB 3.0 */ | 217 | #define HCD_USB3 0x0040 /* USB 3.0 */ |
| @@ -234,6 +245,19 @@ struct hc_driver { | |||
| 234 | int (*urb_dequeue)(struct usb_hcd *hcd, | 245 | int (*urb_dequeue)(struct usb_hcd *hcd, |
| 235 | struct urb *urb, int status); | 246 | struct urb *urb, int status); |
| 236 | 247 | ||
| 248 | /* | ||
| 249 | * (optional) these hooks allow an HCD to override the default DMA | ||
| 250 | * mapping and unmapping routines. In general, they shouldn't be | ||
| 251 | * necessary unless the host controller has special DMA requirements, | ||
| 252 | * such as alignment contraints. If these are not specified, the | ||
| 253 | * general usb_hcd_(un)?map_urb_for_dma functions will be used instead | ||
| 254 | * (and it may be a good idea to call these functions in your HCD | ||
| 255 | * implementation) | ||
| 256 | */ | ||
| 257 | int (*map_urb_for_dma)(struct usb_hcd *hcd, struct urb *urb, | ||
| 258 | gfp_t mem_flags); | ||
| 259 | void (*unmap_urb_for_dma)(struct usb_hcd *hcd, struct urb *urb); | ||
| 260 | |||
| 237 | /* hw synch, freeing endpoint resources that urb_dequeue can't */ | 261 | /* hw synch, freeing endpoint resources that urb_dequeue can't */ |
| 238 | void (*endpoint_disable)(struct usb_hcd *hcd, | 262 | void (*endpoint_disable)(struct usb_hcd *hcd, |
| 239 | struct usb_host_endpoint *ep); | 263 | struct usb_host_endpoint *ep); |
| @@ -330,8 +354,10 @@ extern int usb_hcd_submit_urb(struct urb *urb, gfp_t mem_flags); | |||
| 330 | extern int usb_hcd_unlink_urb(struct urb *urb, int status); | 354 | extern int usb_hcd_unlink_urb(struct urb *urb, int status); |
| 331 | extern void usb_hcd_giveback_urb(struct usb_hcd *hcd, struct urb *urb, | 355 | extern void usb_hcd_giveback_urb(struct usb_hcd *hcd, struct urb *urb, |
| 332 | int status); | 356 | int status); |
| 333 | extern void unmap_urb_setup_for_dma(struct usb_hcd *, struct urb *); | 357 | extern int usb_hcd_map_urb_for_dma(struct usb_hcd *hcd, struct urb *urb, |
| 334 | extern void unmap_urb_for_dma(struct usb_hcd *, struct urb *); | 358 | gfp_t mem_flags); |
| 359 | extern void usb_hcd_unmap_urb_setup_for_dma(struct usb_hcd *, struct urb *); | ||
| 360 | extern void usb_hcd_unmap_urb_for_dma(struct usb_hcd *, struct urb *); | ||
| 335 | extern void usb_hcd_flush_endpoint(struct usb_device *udev, | 361 | extern void usb_hcd_flush_endpoint(struct usb_device *udev, |
| 336 | struct usb_host_endpoint *ep); | 362 | struct usb_host_endpoint *ep); |
| 337 | extern void usb_hcd_disable_endpoint(struct usb_device *udev, | 363 | extern void usb_hcd_disable_endpoint(struct usb_device *udev, |
| @@ -347,8 +373,12 @@ extern int usb_hcd_get_frame_number(struct usb_device *udev); | |||
| 347 | 373 | ||
| 348 | extern struct usb_hcd *usb_create_hcd(const struct hc_driver *driver, | 374 | extern struct usb_hcd *usb_create_hcd(const struct hc_driver *driver, |
| 349 | struct device *dev, const char *bus_name); | 375 | struct device *dev, const char *bus_name); |
| 376 | extern struct usb_hcd *usb_create_shared_hcd(const struct hc_driver *driver, | ||
| 377 | struct device *dev, const char *bus_name, | ||
| 378 | struct usb_hcd *shared_hcd); | ||
| 350 | extern struct usb_hcd *usb_get_hcd(struct usb_hcd *hcd); | 379 | extern struct usb_hcd *usb_get_hcd(struct usb_hcd *hcd); |
| 351 | extern void usb_put_hcd(struct usb_hcd *hcd); | 380 | extern void usb_put_hcd(struct usb_hcd *hcd); |
| 381 | extern int usb_hcd_is_primary_hcd(struct usb_hcd *hcd); | ||
| 352 | extern int usb_add_hcd(struct usb_hcd *hcd, | 382 | extern int usb_add_hcd(struct usb_hcd *hcd, |
| 353 | unsigned int irqnum, unsigned long irqflags); | 383 | unsigned int irqnum, unsigned long irqflags); |
| 354 | extern void usb_remove_hcd(struct usb_hcd *hcd); | 384 | extern void usb_remove_hcd(struct usb_hcd *hcd); |
| @@ -622,13 +652,6 @@ static inline void usbmon_urb_complete(struct usb_bus *bus, struct urb *urb, | |||
| 622 | 652 | ||
| 623 | /*-------------------------------------------------------------------------*/ | 653 | /*-------------------------------------------------------------------------*/ |
| 624 | 654 | ||
| 625 | /* hub.h ... DeviceRemovable in 2.4.2-ac11, gone in 2.4.10 */ | ||
| 626 | /* bleech -- resurfaced in 2.4.11 or 2.4.12 */ | ||
| 627 | #define bitmap DeviceRemovable | ||
| 628 | |||
| 629 | |||
| 630 | /*-------------------------------------------------------------------------*/ | ||
| 631 | |||
| 632 | /* random stuff */ | 655 | /* random stuff */ |
| 633 | 656 | ||
| 634 | #define RUN_CONTEXT (in_irq() ? "in_irq" \ | 657 | #define RUN_CONTEXT (in_irq() ? "in_irq" \ |
diff --git a/include/linux/usb/msm_hsusb.h b/include/linux/usb/msm_hsusb.h index 3675e03b1539..3657403eac18 100644 --- a/include/linux/usb/msm_hsusb.h +++ b/include/linux/usb/msm_hsusb.h | |||
| @@ -55,7 +55,7 @@ enum otg_control_type { | |||
| 55 | 55 | ||
| 56 | /** | 56 | /** |
| 57 | * struct msm_otg_platform_data - platform device data | 57 | * struct msm_otg_platform_data - platform device data |
| 58 | * for msm72k_otg driver. | 58 | * for msm_otg driver. |
| 59 | * @phy_init_seq: PHY configuration sequence. val, reg pairs | 59 | * @phy_init_seq: PHY configuration sequence. val, reg pairs |
| 60 | * terminated by -1. | 60 | * terminated by -1. |
| 61 | * @vbus_power: VBUS power on/off routine. | 61 | * @vbus_power: VBUS power on/off routine. |
diff --git a/include/linux/usb/otg.h b/include/linux/usb/otg.h index a1a1e7a73ec9..6e40718f5abe 100644 --- a/include/linux/usb/otg.h +++ b/include/linux/usb/otg.h | |||
| @@ -66,6 +66,7 @@ struct otg_transceiver { | |||
| 66 | 66 | ||
| 67 | u8 default_a; | 67 | u8 default_a; |
| 68 | enum usb_otg_state state; | 68 | enum usb_otg_state state; |
| 69 | enum usb_xceiv_events last_event; | ||
| 69 | 70 | ||
| 70 | struct usb_bus *host; | 71 | struct usb_bus *host; |
| 71 | struct usb_gadget *gadget; | 72 | struct usb_gadget *gadget; |
| @@ -74,7 +75,7 @@ struct otg_transceiver { | |||
| 74 | void __iomem *io_priv; | 75 | void __iomem *io_priv; |
| 75 | 76 | ||
| 76 | /* for notification of usb_xceiv_events */ | 77 | /* for notification of usb_xceiv_events */ |
| 77 | struct blocking_notifier_head notifier; | 78 | struct atomic_notifier_head notifier; |
| 78 | 79 | ||
| 79 | /* to pass extra port status to the root hub */ | 80 | /* to pass extra port status to the root hub */ |
| 80 | u16 port_status; | 81 | u16 port_status; |
| @@ -234,13 +235,13 @@ otg_start_srp(struct otg_transceiver *otg) | |||
| 234 | static inline int | 235 | static inline int |
| 235 | otg_register_notifier(struct otg_transceiver *otg, struct notifier_block *nb) | 236 | otg_register_notifier(struct otg_transceiver *otg, struct notifier_block *nb) |
| 236 | { | 237 | { |
| 237 | return blocking_notifier_chain_register(&otg->notifier, nb); | 238 | return atomic_notifier_chain_register(&otg->notifier, nb); |
| 238 | } | 239 | } |
| 239 | 240 | ||
| 240 | static inline void | 241 | static inline void |
| 241 | otg_unregister_notifier(struct otg_transceiver *otg, struct notifier_block *nb) | 242 | otg_unregister_notifier(struct otg_transceiver *otg, struct notifier_block *nb) |
| 242 | { | 243 | { |
| 243 | blocking_notifier_chain_unregister(&otg->notifier, nb); | 244 | atomic_notifier_chain_unregister(&otg->notifier, nb); |
| 244 | } | 245 | } |
| 245 | 246 | ||
| 246 | /* for OTG controller drivers (and maybe other stuff) */ | 247 | /* for OTG controller drivers (and maybe other stuff) */ |
diff --git a/include/linux/usb/serial.h b/include/linux/usb/serial.h index c9049139a7a5..b29f70b2ecae 100644 --- a/include/linux/usb/serial.h +++ b/include/linux/usb/serial.h | |||
| @@ -191,7 +191,8 @@ static inline void usb_set_serial_data(struct usb_serial *serial, void *data) | |||
| 191 | * @id_table: pointer to a list of usb_device_id structures that define all | 191 | * @id_table: pointer to a list of usb_device_id structures that define all |
| 192 | * of the devices this structure can support. | 192 | * of the devices this structure can support. |
| 193 | * @num_ports: the number of different ports this device will have. | 193 | * @num_ports: the number of different ports this device will have. |
| 194 | * @bulk_in_size: bytes to allocate for bulk-in buffer (0 = end-point size) | 194 | * @bulk_in_size: minimum number of bytes to allocate for bulk-in buffer |
| 195 | * (0 = end-point size) | ||
| 195 | * @bulk_out_size: bytes to allocate for bulk-out buffer (0 = end-point size) | 196 | * @bulk_out_size: bytes to allocate for bulk-out buffer (0 = end-point size) |
| 196 | * @calc_num_ports: pointer to a function to determine how many ports this | 197 | * @calc_num_ports: pointer to a function to determine how many ports this |
| 197 | * device has dynamically. It will be called after the probe() | 198 | * device has dynamically. It will be called after the probe() |
| @@ -260,7 +261,7 @@ struct usb_serial_driver { | |||
| 260 | const unsigned char *buf, int count); | 261 | const unsigned char *buf, int count); |
| 261 | /* Called only by the tty layer */ | 262 | /* Called only by the tty layer */ |
| 262 | int (*write_room)(struct tty_struct *tty); | 263 | int (*write_room)(struct tty_struct *tty); |
| 263 | int (*ioctl)(struct tty_struct *tty, struct file *file, | 264 | int (*ioctl)(struct tty_struct *tty, |
| 264 | unsigned int cmd, unsigned long arg); | 265 | unsigned int cmd, unsigned long arg); |
| 265 | void (*set_termios)(struct tty_struct *tty, | 266 | void (*set_termios)(struct tty_struct *tty, |
| 266 | struct usb_serial_port *port, struct ktermios *old); | 267 | struct usb_serial_port *port, struct ktermios *old); |
| @@ -268,8 +269,8 @@ struct usb_serial_driver { | |||
| 268 | int (*chars_in_buffer)(struct tty_struct *tty); | 269 | int (*chars_in_buffer)(struct tty_struct *tty); |
| 269 | void (*throttle)(struct tty_struct *tty); | 270 | void (*throttle)(struct tty_struct *tty); |
| 270 | void (*unthrottle)(struct tty_struct *tty); | 271 | void (*unthrottle)(struct tty_struct *tty); |
| 271 | int (*tiocmget)(struct tty_struct *tty, struct file *file); | 272 | int (*tiocmget)(struct tty_struct *tty); |
| 272 | int (*tiocmset)(struct tty_struct *tty, struct file *file, | 273 | int (*tiocmset)(struct tty_struct *tty, |
| 273 | unsigned int set, unsigned int clear); | 274 | unsigned int set, unsigned int clear); |
| 274 | int (*get_icount)(struct tty_struct *tty, | 275 | int (*get_icount)(struct tty_struct *tty, |
| 275 | struct serial_icounter_struct *icount); | 276 | struct serial_icounter_struct *icount); |
diff --git a/include/linux/usb/ulpi.h b/include/linux/usb/ulpi.h index 82b1507f4735..9595796d62ed 100644 --- a/include/linux/usb/ulpi.h +++ b/include/linux/usb/ulpi.h | |||
| @@ -184,4 +184,9 @@ | |||
| 184 | struct otg_transceiver *otg_ulpi_create(struct otg_io_access_ops *ops, | 184 | struct otg_transceiver *otg_ulpi_create(struct otg_io_access_ops *ops, |
| 185 | unsigned int flags); | 185 | unsigned int flags); |
| 186 | 186 | ||
| 187 | #ifdef CONFIG_USB_ULPI_VIEWPORT | ||
| 188 | /* access ops for controllers with a viewport register */ | ||
| 189 | extern struct otg_io_access_ops ulpi_viewport_access_ops; | ||
| 190 | #endif | ||
| 191 | |||
| 187 | #endif /* __LINUX_USB_ULPI_H */ | 192 | #endif /* __LINUX_USB_ULPI_H */ |
diff --git a/include/linux/vt_kern.h b/include/linux/vt_kern.h index 6625cc1ab758..4d05e14ea60c 100644 --- a/include/linux/vt_kern.h +++ b/include/linux/vt_kern.h | |||
| @@ -142,14 +142,6 @@ static inline bool vt_force_oops_output(struct vc_data *vc) | |||
| 142 | return false; | 142 | return false; |
| 143 | } | 143 | } |
| 144 | 144 | ||
| 145 | /* | ||
| 146 | * vc_screen.c shares this temporary buffer with the console write code so that | ||
| 147 | * we can easily avoid touching user space while holding the console spinlock. | ||
| 148 | */ | ||
| 149 | |||
| 150 | #define CON_BUF_SIZE (CONFIG_BASE_SMALL ? 256 : PAGE_SIZE) | ||
| 151 | extern char con_buf[CON_BUF_SIZE]; | ||
| 152 | extern struct mutex con_buf_mtx; | ||
| 153 | extern char vt_dont_switch; | 145 | extern char vt_dont_switch; |
| 154 | extern int default_utf8; | 146 | extern int default_utf8; |
| 155 | extern int global_cursor_default; | 147 | extern int global_cursor_default; |
diff --git a/include/linux/workqueue.h b/include/linux/workqueue.h index 1ac11586a2f5..f584aba78ca9 100644 --- a/include/linux/workqueue.h +++ b/include/linux/workqueue.h | |||
| @@ -250,7 +250,7 @@ static inline unsigned int work_static(struct work_struct *work) { return 0; } | |||
| 250 | enum { | 250 | enum { |
| 251 | WQ_NON_REENTRANT = 1 << 0, /* guarantee non-reentrance */ | 251 | WQ_NON_REENTRANT = 1 << 0, /* guarantee non-reentrance */ |
| 252 | WQ_UNBOUND = 1 << 1, /* not bound to any cpu */ | 252 | WQ_UNBOUND = 1 << 1, /* not bound to any cpu */ |
| 253 | WQ_FREEZEABLE = 1 << 2, /* freeze during suspend */ | 253 | WQ_FREEZABLE = 1 << 2, /* freeze during suspend */ |
| 254 | WQ_MEM_RECLAIM = 1 << 3, /* may be used for memory reclaim */ | 254 | WQ_MEM_RECLAIM = 1 << 3, /* may be used for memory reclaim */ |
| 255 | WQ_HIGHPRI = 1 << 4, /* high priority */ | 255 | WQ_HIGHPRI = 1 << 4, /* high priority */ |
| 256 | WQ_CPU_INTENSIVE = 1 << 5, /* cpu instensive workqueue */ | 256 | WQ_CPU_INTENSIVE = 1 << 5, /* cpu instensive workqueue */ |
| @@ -286,11 +286,15 @@ enum { | |||
| 286 | * any specific CPU, not concurrency managed, and all queued works are | 286 | * any specific CPU, not concurrency managed, and all queued works are |
| 287 | * executed immediately as long as max_active limit is not reached and | 287 | * executed immediately as long as max_active limit is not reached and |
| 288 | * resources are available. | 288 | * resources are available. |
| 289 | * | ||
| 290 | * system_freezable_wq is equivalent to system_wq except that it's | ||
| 291 | * freezable. | ||
| 289 | */ | 292 | */ |
| 290 | extern struct workqueue_struct *system_wq; | 293 | extern struct workqueue_struct *system_wq; |
| 291 | extern struct workqueue_struct *system_long_wq; | 294 | extern struct workqueue_struct *system_long_wq; |
| 292 | extern struct workqueue_struct *system_nrt_wq; | 295 | extern struct workqueue_struct *system_nrt_wq; |
| 293 | extern struct workqueue_struct *system_unbound_wq; | 296 | extern struct workqueue_struct *system_unbound_wq; |
| 297 | extern struct workqueue_struct *system_freezable_wq; | ||
| 294 | 298 | ||
| 295 | extern struct workqueue_struct * | 299 | extern struct workqueue_struct * |
| 296 | __alloc_workqueue_key(const char *name, unsigned int flags, int max_active, | 300 | __alloc_workqueue_key(const char *name, unsigned int flags, int max_active, |
| @@ -318,7 +322,7 @@ __alloc_workqueue_key(const char *name, unsigned int flags, int max_active, | |||
| 318 | /** | 322 | /** |
| 319 | * alloc_ordered_workqueue - allocate an ordered workqueue | 323 | * alloc_ordered_workqueue - allocate an ordered workqueue |
| 320 | * @name: name of the workqueue | 324 | * @name: name of the workqueue |
| 321 | * @flags: WQ_* flags (only WQ_FREEZEABLE and WQ_MEM_RECLAIM are meaningful) | 325 | * @flags: WQ_* flags (only WQ_FREEZABLE and WQ_MEM_RECLAIM are meaningful) |
| 322 | * | 326 | * |
| 323 | * Allocate an ordered workqueue. An ordered workqueue executes at | 327 | * Allocate an ordered workqueue. An ordered workqueue executes at |
| 324 | * most one work item at any given time in the queued order. They are | 328 | * most one work item at any given time in the queued order. They are |
| @@ -335,8 +339,8 @@ alloc_ordered_workqueue(const char *name, unsigned int flags) | |||
| 335 | 339 | ||
| 336 | #define create_workqueue(name) \ | 340 | #define create_workqueue(name) \ |
| 337 | alloc_workqueue((name), WQ_MEM_RECLAIM, 1) | 341 | alloc_workqueue((name), WQ_MEM_RECLAIM, 1) |
| 338 | #define create_freezeable_workqueue(name) \ | 342 | #define create_freezable_workqueue(name) \ |
| 339 | alloc_workqueue((name), WQ_FREEZEABLE | WQ_UNBOUND | WQ_MEM_RECLAIM, 1) | 343 | alloc_workqueue((name), WQ_FREEZABLE | WQ_UNBOUND | WQ_MEM_RECLAIM, 1) |
| 340 | #define create_singlethread_workqueue(name) \ | 344 | #define create_singlethread_workqueue(name) \ |
| 341 | alloc_workqueue((name), WQ_UNBOUND | WQ_MEM_RECLAIM, 1) | 345 | alloc_workqueue((name), WQ_UNBOUND | WQ_MEM_RECLAIM, 1) |
| 342 | 346 | ||
diff --git a/include/linux/xattr.h b/include/linux/xattr.h index e6131ef98d8f..6050783005bd 100644 --- a/include/linux/xattr.h +++ b/include/linux/xattr.h | |||
| @@ -42,11 +42,13 @@ | |||
| 42 | #define XATTR_SMACK_IPOUT "SMACK64IPOUT" | 42 | #define XATTR_SMACK_IPOUT "SMACK64IPOUT" |
| 43 | #define XATTR_SMACK_EXEC "SMACK64EXEC" | 43 | #define XATTR_SMACK_EXEC "SMACK64EXEC" |
| 44 | #define XATTR_SMACK_TRANSMUTE "SMACK64TRANSMUTE" | 44 | #define XATTR_SMACK_TRANSMUTE "SMACK64TRANSMUTE" |
| 45 | #define XATTR_SMACK_MMAP "SMACK64MMAP" | ||
| 45 | #define XATTR_NAME_SMACK XATTR_SECURITY_PREFIX XATTR_SMACK_SUFFIX | 46 | #define XATTR_NAME_SMACK XATTR_SECURITY_PREFIX XATTR_SMACK_SUFFIX |
| 46 | #define XATTR_NAME_SMACKIPIN XATTR_SECURITY_PREFIX XATTR_SMACK_IPIN | 47 | #define XATTR_NAME_SMACKIPIN XATTR_SECURITY_PREFIX XATTR_SMACK_IPIN |
| 47 | #define XATTR_NAME_SMACKIPOUT XATTR_SECURITY_PREFIX XATTR_SMACK_IPOUT | 48 | #define XATTR_NAME_SMACKIPOUT XATTR_SECURITY_PREFIX XATTR_SMACK_IPOUT |
| 48 | #define XATTR_NAME_SMACKEXEC XATTR_SECURITY_PREFIX XATTR_SMACK_EXEC | 49 | #define XATTR_NAME_SMACKEXEC XATTR_SECURITY_PREFIX XATTR_SMACK_EXEC |
| 49 | #define XATTR_NAME_SMACKTRANSMUTE XATTR_SECURITY_PREFIX XATTR_SMACK_TRANSMUTE | 50 | #define XATTR_NAME_SMACKTRANSMUTE XATTR_SECURITY_PREFIX XATTR_SMACK_TRANSMUTE |
| 51 | #define XATTR_NAME_SMACKMMAP XATTR_SECURITY_PREFIX XATTR_SMACK_MMAP | ||
| 50 | 52 | ||
| 51 | #define XATTR_CAPS_SUFFIX "capability" | 53 | #define XATTR_CAPS_SUFFIX "capability" |
| 52 | #define XATTR_NAME_CAPS XATTR_SECURITY_PREFIX XATTR_CAPS_SUFFIX | 54 | #define XATTR_NAME_CAPS XATTR_SECURITY_PREFIX XATTR_CAPS_SUFFIX |
diff --git a/include/linux/xfrm.h b/include/linux/xfrm.h index 930fdd2de79c..22e61fdf75a2 100644 --- a/include/linux/xfrm.h +++ b/include/linux/xfrm.h | |||
| @@ -84,6 +84,16 @@ struct xfrm_replay_state { | |||
| 84 | __u32 bitmap; | 84 | __u32 bitmap; |
| 85 | }; | 85 | }; |
| 86 | 86 | ||
| 87 | struct xfrm_replay_state_esn { | ||
| 88 | unsigned int bmp_len; | ||
| 89 | __u32 oseq; | ||
| 90 | __u32 seq; | ||
| 91 | __u32 oseq_hi; | ||
| 92 | __u32 seq_hi; | ||
| 93 | __u32 replay_window; | ||
| 94 | __u32 bmp[0]; | ||
| 95 | }; | ||
| 96 | |||
| 87 | struct xfrm_algo { | 97 | struct xfrm_algo { |
| 88 | char alg_name[64]; | 98 | char alg_name[64]; |
| 89 | unsigned int alg_key_len; /* in bits */ | 99 | unsigned int alg_key_len; /* in bits */ |
| @@ -284,6 +294,7 @@ enum xfrm_attr_type_t { | |||
| 284 | XFRMA_ALG_AUTH_TRUNC, /* struct xfrm_algo_auth */ | 294 | XFRMA_ALG_AUTH_TRUNC, /* struct xfrm_algo_auth */ |
| 285 | XFRMA_MARK, /* struct xfrm_mark */ | 295 | XFRMA_MARK, /* struct xfrm_mark */ |
| 286 | XFRMA_TFCPAD, /* __u32 */ | 296 | XFRMA_TFCPAD, /* __u32 */ |
| 297 | XFRMA_REPLAY_ESN_VAL, /* struct xfrm_replay_esn */ | ||
| 287 | __XFRMA_MAX | 298 | __XFRMA_MAX |
| 288 | 299 | ||
| 289 | #define XFRMA_MAX (__XFRMA_MAX - 1) | 300 | #define XFRMA_MAX (__XFRMA_MAX - 1) |
| @@ -350,6 +361,8 @@ struct xfrm_usersa_info { | |||
| 350 | #define XFRM_STATE_WILDRECV 8 | 361 | #define XFRM_STATE_WILDRECV 8 |
| 351 | #define XFRM_STATE_ICMP 16 | 362 | #define XFRM_STATE_ICMP 16 |
| 352 | #define XFRM_STATE_AF_UNSPEC 32 | 363 | #define XFRM_STATE_AF_UNSPEC 32 |
| 364 | #define XFRM_STATE_ALIGN4 64 | ||
| 365 | #define XFRM_STATE_ESN 128 | ||
| 353 | }; | 366 | }; |
| 354 | 367 | ||
| 355 | struct xfrm_usersa_id { | 368 | struct xfrm_usersa_id { |
diff --git a/include/net/9p/9p.h b/include/net/9p/9p.h index 071fd7a8d781..6b75a6971346 100644 --- a/include/net/9p/9p.h +++ b/include/net/9p/9p.h | |||
| @@ -139,6 +139,8 @@ do { \ | |||
| 139 | */ | 139 | */ |
| 140 | 140 | ||
| 141 | enum p9_msg_t { | 141 | enum p9_msg_t { |
| 142 | P9_TSYNCFS = 0, | ||
| 143 | P9_RSYNCFS, | ||
| 142 | P9_TLERROR = 6, | 144 | P9_TLERROR = 6, |
| 143 | P9_RLERROR, | 145 | P9_RLERROR, |
| 144 | P9_TSTATFS = 8, | 146 | P9_TSTATFS = 8, |
| @@ -688,7 +690,11 @@ struct p9_rwstat { | |||
| 688 | * @id: protocol operating identifier of type &p9_msg_t | 690 | * @id: protocol operating identifier of type &p9_msg_t |
| 689 | * @tag: transaction id of the request | 691 | * @tag: transaction id of the request |
| 690 | * @offset: used by marshalling routines to track currentposition in buffer | 692 | * @offset: used by marshalling routines to track currentposition in buffer |
| 691 | * @capacity: used by marshalling routines to track total capacity | 693 | * @capacity: used by marshalling routines to track total malloc'd capacity |
| 694 | * @pubuf: Payload user buffer given by the caller | ||
| 695 | * @pubuf: Payload kernel buffer given by the caller | ||
| 696 | * @pbuf_size: pubuf/pkbuf(only one will be !NULL) size to be read/write. | ||
| 697 | * @private: For transport layer's use. | ||
| 692 | * @sdata: payload | 698 | * @sdata: payload |
| 693 | * | 699 | * |
| 694 | * &p9_fcall represents the structure for all 9P RPC | 700 | * &p9_fcall represents the structure for all 9P RPC |
| @@ -705,6 +711,10 @@ struct p9_fcall { | |||
| 705 | 711 | ||
| 706 | size_t offset; | 712 | size_t offset; |
| 707 | size_t capacity; | 713 | size_t capacity; |
| 714 | char __user *pubuf; | ||
| 715 | char *pkbuf; | ||
| 716 | size_t pbuf_size; | ||
| 717 | void *private; | ||
| 708 | 718 | ||
| 709 | uint8_t *sdata; | 719 | uint8_t *sdata; |
| 710 | }; | 720 | }; |
diff --git a/include/net/9p/client.h b/include/net/9p/client.h index 83ba6a4d58a3..0a30977e3c1f 100644 --- a/include/net/9p/client.h +++ b/include/net/9p/client.h | |||
| @@ -230,6 +230,7 @@ int p9_client_create_dotl(struct p9_fid *ofid, char *name, u32 flags, u32 mode, | |||
| 230 | gid_t gid, struct p9_qid *qid); | 230 | gid_t gid, struct p9_qid *qid); |
| 231 | int p9_client_clunk(struct p9_fid *fid); | 231 | int p9_client_clunk(struct p9_fid *fid); |
| 232 | int p9_client_fsync(struct p9_fid *fid, int datasync); | 232 | int p9_client_fsync(struct p9_fid *fid, int datasync); |
| 233 | int p9_client_sync_fs(struct p9_fid *fid); | ||
| 233 | int p9_client_remove(struct p9_fid *fid); | 234 | int p9_client_remove(struct p9_fid *fid); |
| 234 | int p9_client_read(struct p9_fid *fid, char *data, char __user *udata, | 235 | int p9_client_read(struct p9_fid *fid, char *data, char __user *udata, |
| 235 | u64 offset, u32 count); | 236 | u64 offset, u32 count); |
diff --git a/include/net/9p/transport.h b/include/net/9p/transport.h index 6d5886efb102..82868f18c573 100644 --- a/include/net/9p/transport.h +++ b/include/net/9p/transport.h | |||
| @@ -26,11 +26,19 @@ | |||
| 26 | #ifndef NET_9P_TRANSPORT_H | 26 | #ifndef NET_9P_TRANSPORT_H |
| 27 | #define NET_9P_TRANSPORT_H | 27 | #define NET_9P_TRANSPORT_H |
| 28 | 28 | ||
| 29 | #define P9_TRANS_PREF_PAYLOAD_MASK 0x1 | ||
| 30 | |||
| 31 | /* Default. Add Payload to PDU before sending it down to transport layer */ | ||
| 32 | #define P9_TRANS_PREF_PAYLOAD_DEF 0x0 | ||
| 33 | /* Send pay load seperately to transport layer along with PDU.*/ | ||
| 34 | #define P9_TRANS_PREF_PAYLOAD_SEP 0x1 | ||
| 35 | |||
| 29 | /** | 36 | /** |
| 30 | * struct p9_trans_module - transport module interface | 37 | * struct p9_trans_module - transport module interface |
| 31 | * @list: used to maintain a list of currently available transports | 38 | * @list: used to maintain a list of currently available transports |
| 32 | * @name: the human-readable name of the transport | 39 | * @name: the human-readable name of the transport |
| 33 | * @maxsize: transport provided maximum packet size | 40 | * @maxsize: transport provided maximum packet size |
| 41 | * @pref: Preferences of this transport | ||
| 34 | * @def: set if this transport should be considered the default | 42 | * @def: set if this transport should be considered the default |
| 35 | * @create: member function to create a new connection on this transport | 43 | * @create: member function to create a new connection on this transport |
| 36 | * @request: member function to issue a request to the transport | 44 | * @request: member function to issue a request to the transport |
| @@ -47,6 +55,7 @@ struct p9_trans_module { | |||
| 47 | struct list_head list; | 55 | struct list_head list; |
| 48 | char *name; /* name of transport */ | 56 | char *name; /* name of transport */ |
| 49 | int maxsize; /* max message size of transport */ | 57 | int maxsize; /* max message size of transport */ |
| 58 | int pref; /* Preferences of this transport */ | ||
| 50 | int def; /* this transport should be default */ | 59 | int def; /* this transport should be default */ |
| 51 | struct module *owner; | 60 | struct module *owner; |
| 52 | int (*create)(struct p9_client *, const char *, char *); | 61 | int (*create)(struct p9_client *, const char *, char *); |
diff --git a/include/net/bluetooth/bluetooth.h b/include/net/bluetooth/bluetooth.h index 0c5e72503b77..43750439c521 100644 --- a/include/net/bluetooth/bluetooth.h +++ b/include/net/bluetooth/bluetooth.h | |||
| @@ -64,6 +64,11 @@ struct bt_security { | |||
| 64 | 64 | ||
| 65 | #define BT_DEFER_SETUP 7 | 65 | #define BT_DEFER_SETUP 7 |
| 66 | 66 | ||
| 67 | #define BT_FLUSHABLE 8 | ||
| 68 | |||
| 69 | #define BT_FLUSHABLE_OFF 0 | ||
| 70 | #define BT_FLUSHABLE_ON 1 | ||
| 71 | |||
| 67 | #define BT_INFO(fmt, arg...) printk(KERN_INFO "Bluetooth: " fmt "\n" , ## arg) | 72 | #define BT_INFO(fmt, arg...) printk(KERN_INFO "Bluetooth: " fmt "\n" , ## arg) |
| 68 | #define BT_ERR(fmt, arg...) printk(KERN_ERR "%s: " fmt "\n" , __func__ , ## arg) | 73 | #define BT_ERR(fmt, arg...) printk(KERN_ERR "%s: " fmt "\n" , __func__ , ## arg) |
| 69 | #define BT_DBG(fmt, arg...) pr_debug("%s: " fmt "\n" , __func__ , ## arg) | 74 | #define BT_DBG(fmt, arg...) pr_debug("%s: " fmt "\n" , __func__ , ## arg) |
| @@ -200,4 +205,32 @@ extern void bt_sysfs_cleanup(void); | |||
| 200 | 205 | ||
| 201 | extern struct dentry *bt_debugfs; | 206 | extern struct dentry *bt_debugfs; |
| 202 | 207 | ||
| 208 | #ifdef CONFIG_BT_L2CAP | ||
| 209 | int l2cap_init(void); | ||
| 210 | void l2cap_exit(void); | ||
| 211 | #else | ||
| 212 | static inline int l2cap_init(void) | ||
| 213 | { | ||
| 214 | return 0; | ||
| 215 | } | ||
| 216 | |||
| 217 | static inline void l2cap_exit(void) | ||
| 218 | { | ||
| 219 | } | ||
| 220 | #endif | ||
| 221 | |||
| 222 | #ifdef CONFIG_BT_SCO | ||
| 223 | int sco_init(void); | ||
| 224 | void sco_exit(void); | ||
| 225 | #else | ||
| 226 | static inline int sco_init(void) | ||
| 227 | { | ||
| 228 | return 0; | ||
| 229 | } | ||
| 230 | |||
| 231 | static inline void sco_exit(void) | ||
| 232 | { | ||
| 233 | } | ||
| 234 | #endif | ||
| 235 | |||
| 203 | #endif /* __BLUETOOTH_H */ | 236 | #endif /* __BLUETOOTH_H */ |
diff --git a/include/net/bluetooth/hci.h b/include/net/bluetooth/hci.h index 29a7a8ca0438..ec6acf2f1c0b 100644 --- a/include/net/bluetooth/hci.h +++ b/include/net/bluetooth/hci.h | |||
| @@ -76,6 +76,14 @@ enum { | |||
| 76 | HCI_INQUIRY, | 76 | HCI_INQUIRY, |
| 77 | 77 | ||
| 78 | HCI_RAW, | 78 | HCI_RAW, |
| 79 | |||
| 80 | HCI_SETUP, | ||
| 81 | HCI_AUTO_OFF, | ||
| 82 | HCI_MGMT, | ||
| 83 | HCI_PAIRABLE, | ||
| 84 | HCI_SERVICE_CACHE, | ||
| 85 | HCI_LINK_KEYS, | ||
| 86 | HCI_DEBUG_KEYS, | ||
| 79 | }; | 87 | }; |
| 80 | 88 | ||
| 81 | /* HCI ioctl defines */ | 89 | /* HCI ioctl defines */ |
| @@ -111,6 +119,7 @@ enum { | |||
| 111 | #define HCI_PAIRING_TIMEOUT (60000) /* 60 seconds */ | 119 | #define HCI_PAIRING_TIMEOUT (60000) /* 60 seconds */ |
| 112 | #define HCI_IDLE_TIMEOUT (6000) /* 6 seconds */ | 120 | #define HCI_IDLE_TIMEOUT (6000) /* 6 seconds */ |
| 113 | #define HCI_INIT_TIMEOUT (10000) /* 10 seconds */ | 121 | #define HCI_INIT_TIMEOUT (10000) /* 10 seconds */ |
| 122 | #define HCI_CMD_TIMEOUT (1000) /* 1 seconds */ | ||
| 114 | 123 | ||
| 115 | /* HCI data types */ | 124 | /* HCI data types */ |
| 116 | #define HCI_COMMAND_PKT 0x01 | 125 | #define HCI_COMMAND_PKT 0x01 |
| @@ -150,6 +159,7 @@ enum { | |||
| 150 | #define EDR_ESCO_MASK (ESCO_2EV3 | ESCO_3EV3 | ESCO_2EV5 | ESCO_3EV5) | 159 | #define EDR_ESCO_MASK (ESCO_2EV3 | ESCO_3EV3 | ESCO_2EV5 | ESCO_3EV5) |
| 151 | 160 | ||
| 152 | /* ACL flags */ | 161 | /* ACL flags */ |
| 162 | #define ACL_START_NO_FLUSH 0x00 | ||
| 153 | #define ACL_CONT 0x01 | 163 | #define ACL_CONT 0x01 |
| 154 | #define ACL_START 0x02 | 164 | #define ACL_START 0x02 |
| 155 | #define ACL_ACTIVE_BCAST 0x04 | 165 | #define ACL_ACTIVE_BCAST 0x04 |
| @@ -159,6 +169,8 @@ enum { | |||
| 159 | #define SCO_LINK 0x00 | 169 | #define SCO_LINK 0x00 |
| 160 | #define ACL_LINK 0x01 | 170 | #define ACL_LINK 0x01 |
| 161 | #define ESCO_LINK 0x02 | 171 | #define ESCO_LINK 0x02 |
| 172 | /* Low Energy links do not have defined link type. Use invented one */ | ||
| 173 | #define LE_LINK 0x80 | ||
| 162 | 174 | ||
| 163 | /* LMP features */ | 175 | /* LMP features */ |
| 164 | #define LMP_3SLOT 0x01 | 176 | #define LMP_3SLOT 0x01 |
| @@ -183,17 +195,25 @@ enum { | |||
| 183 | #define LMP_PSCHEME 0x02 | 195 | #define LMP_PSCHEME 0x02 |
| 184 | #define LMP_PCONTROL 0x04 | 196 | #define LMP_PCONTROL 0x04 |
| 185 | 197 | ||
| 198 | #define LMP_RSSI_INQ 0x40 | ||
| 186 | #define LMP_ESCO 0x80 | 199 | #define LMP_ESCO 0x80 |
| 187 | 200 | ||
| 188 | #define LMP_EV4 0x01 | 201 | #define LMP_EV4 0x01 |
| 189 | #define LMP_EV5 0x02 | 202 | #define LMP_EV5 0x02 |
| 203 | #define LMP_LE 0x40 | ||
| 190 | 204 | ||
| 191 | #define LMP_SNIFF_SUBR 0x02 | 205 | #define LMP_SNIFF_SUBR 0x02 |
| 206 | #define LMP_PAUSE_ENC 0x04 | ||
| 192 | #define LMP_EDR_ESCO_2M 0x20 | 207 | #define LMP_EDR_ESCO_2M 0x20 |
| 193 | #define LMP_EDR_ESCO_3M 0x40 | 208 | #define LMP_EDR_ESCO_3M 0x40 |
| 194 | #define LMP_EDR_3S_ESCO 0x80 | 209 | #define LMP_EDR_3S_ESCO 0x80 |
| 195 | 210 | ||
| 211 | #define LMP_EXT_INQ 0x01 | ||
| 196 | #define LMP_SIMPLE_PAIR 0x08 | 212 | #define LMP_SIMPLE_PAIR 0x08 |
| 213 | #define LMP_NO_FLUSH 0x40 | ||
| 214 | |||
| 215 | #define LMP_LSTO 0x01 | ||
| 216 | #define LMP_INQ_TX_PWR 0x02 | ||
| 197 | 217 | ||
| 198 | /* Connection modes */ | 218 | /* Connection modes */ |
| 199 | #define HCI_CM_ACTIVE 0x0000 | 219 | #define HCI_CM_ACTIVE 0x0000 |
| @@ -225,6 +245,8 @@ enum { | |||
| 225 | #define HCI_AT_GENERAL_BONDING_MITM 0x05 | 245 | #define HCI_AT_GENERAL_BONDING_MITM 0x05 |
| 226 | 246 | ||
| 227 | /* ----- HCI Commands ---- */ | 247 | /* ----- HCI Commands ---- */ |
| 248 | #define HCI_OP_NOP 0x0000 | ||
| 249 | |||
| 228 | #define HCI_OP_INQUIRY 0x0401 | 250 | #define HCI_OP_INQUIRY 0x0401 |
| 229 | struct hci_cp_inquiry { | 251 | struct hci_cp_inquiry { |
| 230 | __u8 lap[3]; | 252 | __u8 lap[3]; |
| @@ -292,11 +314,19 @@ struct hci_cp_pin_code_reply { | |||
| 292 | __u8 pin_len; | 314 | __u8 pin_len; |
| 293 | __u8 pin_code[16]; | 315 | __u8 pin_code[16]; |
| 294 | } __packed; | 316 | } __packed; |
| 317 | struct hci_rp_pin_code_reply { | ||
| 318 | __u8 status; | ||
| 319 | bdaddr_t bdaddr; | ||
| 320 | } __packed; | ||
| 295 | 321 | ||
| 296 | #define HCI_OP_PIN_CODE_NEG_REPLY 0x040e | 322 | #define HCI_OP_PIN_CODE_NEG_REPLY 0x040e |
| 297 | struct hci_cp_pin_code_neg_reply { | 323 | struct hci_cp_pin_code_neg_reply { |
| 298 | bdaddr_t bdaddr; | 324 | bdaddr_t bdaddr; |
| 299 | } __packed; | 325 | } __packed; |
| 326 | struct hci_rp_pin_code_neg_reply { | ||
| 327 | __u8 status; | ||
| 328 | bdaddr_t bdaddr; | ||
| 329 | } __packed; | ||
| 300 | 330 | ||
| 301 | #define HCI_OP_CHANGE_CONN_PTYPE 0x040f | 331 | #define HCI_OP_CHANGE_CONN_PTYPE 0x040f |
| 302 | struct hci_cp_change_conn_ptype { | 332 | struct hci_cp_change_conn_ptype { |
| @@ -377,6 +407,31 @@ struct hci_cp_reject_sync_conn_req { | |||
| 377 | __u8 reason; | 407 | __u8 reason; |
| 378 | } __packed; | 408 | } __packed; |
| 379 | 409 | ||
| 410 | #define HCI_OP_IO_CAPABILITY_REPLY 0x042b | ||
| 411 | struct hci_cp_io_capability_reply { | ||
| 412 | bdaddr_t bdaddr; | ||
| 413 | __u8 capability; | ||
| 414 | __u8 oob_data; | ||
| 415 | __u8 authentication; | ||
| 416 | } __packed; | ||
| 417 | |||
| 418 | #define HCI_OP_USER_CONFIRM_REPLY 0x042c | ||
| 419 | struct hci_cp_user_confirm_reply { | ||
| 420 | bdaddr_t bdaddr; | ||
| 421 | } __packed; | ||
| 422 | struct hci_rp_user_confirm_reply { | ||
| 423 | __u8 status; | ||
| 424 | bdaddr_t bdaddr; | ||
| 425 | } __packed; | ||
| 426 | |||
| 427 | #define HCI_OP_USER_CONFIRM_NEG_REPLY 0x042d | ||
| 428 | |||
| 429 | #define HCI_OP_IO_CAPABILITY_NEG_REPLY 0x0434 | ||
| 430 | struct hci_cp_io_capability_neg_reply { | ||
| 431 | bdaddr_t bdaddr; | ||
| 432 | __u8 reason; | ||
| 433 | } __packed; | ||
| 434 | |||
| 380 | #define HCI_OP_SNIFF_MODE 0x0803 | 435 | #define HCI_OP_SNIFF_MODE 0x0803 |
| 381 | struct hci_cp_sniff_mode { | 436 | struct hci_cp_sniff_mode { |
| 382 | __le16 handle; | 437 | __le16 handle; |
| @@ -474,6 +529,12 @@ struct hci_cp_set_event_flt { | |||
| 474 | #define HCI_CONN_SETUP_AUTO_OFF 0x01 | 529 | #define HCI_CONN_SETUP_AUTO_OFF 0x01 |
| 475 | #define HCI_CONN_SETUP_AUTO_ON 0x02 | 530 | #define HCI_CONN_SETUP_AUTO_ON 0x02 |
| 476 | 531 | ||
| 532 | #define HCI_OP_DELETE_STORED_LINK_KEY 0x0c12 | ||
| 533 | struct hci_cp_delete_stored_link_key { | ||
| 534 | bdaddr_t bdaddr; | ||
| 535 | __u8 delete_all; | ||
| 536 | } __packed; | ||
| 537 | |||
| 477 | #define HCI_OP_WRITE_LOCAL_NAME 0x0c13 | 538 | #define HCI_OP_WRITE_LOCAL_NAME 0x0c13 |
| 478 | struct hci_cp_write_local_name { | 539 | struct hci_cp_write_local_name { |
| 479 | __u8 name[248]; | 540 | __u8 name[248]; |
| @@ -537,6 +598,8 @@ struct hci_cp_host_buffer_size { | |||
| 537 | __le16 sco_max_pkt; | 598 | __le16 sco_max_pkt; |
| 538 | } __packed; | 599 | } __packed; |
| 539 | 600 | ||
| 601 | #define HCI_OP_WRITE_INQUIRY_MODE 0x0c45 | ||
| 602 | |||
| 540 | #define HCI_OP_READ_SSP_MODE 0x0c55 | 603 | #define HCI_OP_READ_SSP_MODE 0x0c55 |
| 541 | struct hci_rp_read_ssp_mode { | 604 | struct hci_rp_read_ssp_mode { |
| 542 | __u8 status; | 605 | __u8 status; |
| @@ -548,6 +611,8 @@ struct hci_cp_write_ssp_mode { | |||
| 548 | __u8 mode; | 611 | __u8 mode; |
| 549 | } __packed; | 612 | } __packed; |
| 550 | 613 | ||
| 614 | #define HCI_OP_READ_INQ_RSP_TX_POWER 0x0c58 | ||
| 615 | |||
| 551 | #define HCI_OP_READ_LOCAL_VERSION 0x1001 | 616 | #define HCI_OP_READ_LOCAL_VERSION 0x1001 |
| 552 | struct hci_rp_read_local_version { | 617 | struct hci_rp_read_local_version { |
| 553 | __u8 status; | 618 | __u8 status; |
| @@ -593,6 +658,47 @@ struct hci_rp_read_bd_addr { | |||
| 593 | bdaddr_t bdaddr; | 658 | bdaddr_t bdaddr; |
| 594 | } __packed; | 659 | } __packed; |
| 595 | 660 | ||
| 661 | #define HCI_OP_LE_SET_EVENT_MASK 0x2001 | ||
| 662 | struct hci_cp_le_set_event_mask { | ||
| 663 | __u8 mask[8]; | ||
| 664 | } __packed; | ||
| 665 | |||
| 666 | #define HCI_OP_LE_READ_BUFFER_SIZE 0x2002 | ||
| 667 | struct hci_rp_le_read_buffer_size { | ||
| 668 | __u8 status; | ||
| 669 | __le16 le_mtu; | ||
| 670 | __u8 le_max_pkt; | ||
| 671 | } __packed; | ||
| 672 | |||
| 673 | #define HCI_OP_LE_CREATE_CONN 0x200d | ||
| 674 | struct hci_cp_le_create_conn { | ||
| 675 | __le16 scan_interval; | ||
| 676 | __le16 scan_window; | ||
| 677 | __u8 filter_policy; | ||
| 678 | __u8 peer_addr_type; | ||
| 679 | bdaddr_t peer_addr; | ||
| 680 | __u8 own_address_type; | ||
| 681 | __le16 conn_interval_min; | ||
| 682 | __le16 conn_interval_max; | ||
| 683 | __le16 conn_latency; | ||
| 684 | __le16 supervision_timeout; | ||
| 685 | __le16 min_ce_len; | ||
| 686 | __le16 max_ce_len; | ||
| 687 | } __packed; | ||
| 688 | |||
| 689 | #define HCI_OP_LE_CREATE_CONN_CANCEL 0x200e | ||
| 690 | |||
| 691 | #define HCI_OP_LE_CONN_UPDATE 0x2013 | ||
| 692 | struct hci_cp_le_conn_update { | ||
| 693 | __le16 handle; | ||
| 694 | __le16 conn_interval_min; | ||
| 695 | __le16 conn_interval_max; | ||
| 696 | __le16 conn_latency; | ||
| 697 | __le16 supervision_timeout; | ||
| 698 | __le16 min_ce_len; | ||
| 699 | __le16 max_ce_len; | ||
| 700 | } __packed; | ||
| 701 | |||
| 596 | /* ---- HCI Events ---- */ | 702 | /* ---- HCI Events ---- */ |
| 597 | #define HCI_EV_INQUIRY_COMPLETE 0x01 | 703 | #define HCI_EV_INQUIRY_COMPLETE 0x01 |
| 598 | 704 | ||
| @@ -833,6 +939,20 @@ struct hci_ev_io_capa_request { | |||
| 833 | bdaddr_t bdaddr; | 939 | bdaddr_t bdaddr; |
| 834 | } __packed; | 940 | } __packed; |
| 835 | 941 | ||
| 942 | #define HCI_EV_IO_CAPA_REPLY 0x32 | ||
| 943 | struct hci_ev_io_capa_reply { | ||
| 944 | bdaddr_t bdaddr; | ||
| 945 | __u8 capability; | ||
| 946 | __u8 oob_data; | ||
| 947 | __u8 authentication; | ||
| 948 | } __packed; | ||
| 949 | |||
| 950 | #define HCI_EV_USER_CONFIRM_REQUEST 0x33 | ||
| 951 | struct hci_ev_user_confirm_req { | ||
| 952 | bdaddr_t bdaddr; | ||
| 953 | __le32 passkey; | ||
| 954 | } __packed; | ||
| 955 | |||
| 836 | #define HCI_EV_SIMPLE_PAIR_COMPLETE 0x36 | 956 | #define HCI_EV_SIMPLE_PAIR_COMPLETE 0x36 |
| 837 | struct hci_ev_simple_pair_complete { | 957 | struct hci_ev_simple_pair_complete { |
| 838 | __u8 status; | 958 | __u8 status; |
| @@ -845,6 +965,25 @@ struct hci_ev_remote_host_features { | |||
| 845 | __u8 features[8]; | 965 | __u8 features[8]; |
| 846 | } __packed; | 966 | } __packed; |
| 847 | 967 | ||
| 968 | #define HCI_EV_LE_META 0x3e | ||
| 969 | struct hci_ev_le_meta { | ||
| 970 | __u8 subevent; | ||
| 971 | } __packed; | ||
| 972 | |||
| 973 | /* Low energy meta events */ | ||
| 974 | #define HCI_EV_LE_CONN_COMPLETE 0x01 | ||
| 975 | struct hci_ev_le_conn_complete { | ||
| 976 | __u8 status; | ||
| 977 | __le16 handle; | ||
| 978 | __u8 role; | ||
| 979 | __u8 bdaddr_type; | ||
| 980 | bdaddr_t bdaddr; | ||
| 981 | __le16 interval; | ||
| 982 | __le16 latency; | ||
| 983 | __le16 supervision_timeout; | ||
| 984 | __u8 clk_accurancy; | ||
| 985 | } __packed; | ||
| 986 | |||
| 848 | /* Internal events generated by Bluetooth stack */ | 987 | /* Internal events generated by Bluetooth stack */ |
| 849 | #define HCI_EV_STACK_INTERNAL 0xfd | 988 | #define HCI_EV_STACK_INTERNAL 0xfd |
| 850 | struct hci_ev_stack_internal { | 989 | struct hci_ev_stack_internal { |
diff --git a/include/net/bluetooth/hci_core.h b/include/net/bluetooth/hci_core.h index d2cf88407690..441dadbf6a89 100644 --- a/include/net/bluetooth/hci_core.h +++ b/include/net/bluetooth/hci_core.h | |||
| @@ -60,12 +60,28 @@ struct hci_conn_hash { | |||
| 60 | spinlock_t lock; | 60 | spinlock_t lock; |
| 61 | unsigned int acl_num; | 61 | unsigned int acl_num; |
| 62 | unsigned int sco_num; | 62 | unsigned int sco_num; |
| 63 | unsigned int le_num; | ||
| 63 | }; | 64 | }; |
| 64 | 65 | ||
| 65 | struct bdaddr_list { | 66 | struct bdaddr_list { |
| 66 | struct list_head list; | 67 | struct list_head list; |
| 67 | bdaddr_t bdaddr; | 68 | bdaddr_t bdaddr; |
| 68 | }; | 69 | }; |
| 70 | |||
| 71 | struct bt_uuid { | ||
| 72 | struct list_head list; | ||
| 73 | u8 uuid[16]; | ||
| 74 | u8 svc_hint; | ||
| 75 | }; | ||
| 76 | |||
| 77 | struct link_key { | ||
| 78 | struct list_head list; | ||
| 79 | bdaddr_t bdaddr; | ||
| 80 | u8 type; | ||
| 81 | u8 val[16]; | ||
| 82 | u8 pin_len; | ||
| 83 | }; | ||
| 84 | |||
| 69 | #define NUM_REASSEMBLY 4 | 85 | #define NUM_REASSEMBLY 4 |
| 70 | struct hci_dev { | 86 | struct hci_dev { |
| 71 | struct list_head list; | 87 | struct list_head list; |
| @@ -80,13 +96,18 @@ struct hci_dev { | |||
| 80 | bdaddr_t bdaddr; | 96 | bdaddr_t bdaddr; |
| 81 | __u8 dev_name[248]; | 97 | __u8 dev_name[248]; |
| 82 | __u8 dev_class[3]; | 98 | __u8 dev_class[3]; |
| 99 | __u8 major_class; | ||
| 100 | __u8 minor_class; | ||
| 83 | __u8 features[8]; | 101 | __u8 features[8]; |
| 84 | __u8 commands[64]; | 102 | __u8 commands[64]; |
| 85 | __u8 ssp_mode; | 103 | __u8 ssp_mode; |
| 86 | __u8 hci_ver; | 104 | __u8 hci_ver; |
| 87 | __u16 hci_rev; | 105 | __u16 hci_rev; |
| 106 | __u8 lmp_ver; | ||
| 88 | __u16 manufacturer; | 107 | __u16 manufacturer; |
| 108 | __le16 lmp_subver; | ||
| 89 | __u16 voice_setting; | 109 | __u16 voice_setting; |
| 110 | __u8 io_capability; | ||
| 90 | 111 | ||
| 91 | __u16 pkt_type; | 112 | __u16 pkt_type; |
| 92 | __u16 esco_type; | 113 | __u16 esco_type; |
| @@ -102,18 +123,26 @@ struct hci_dev { | |||
| 102 | atomic_t cmd_cnt; | 123 | atomic_t cmd_cnt; |
| 103 | unsigned int acl_cnt; | 124 | unsigned int acl_cnt; |
| 104 | unsigned int sco_cnt; | 125 | unsigned int sco_cnt; |
| 126 | unsigned int le_cnt; | ||
| 105 | 127 | ||
| 106 | unsigned int acl_mtu; | 128 | unsigned int acl_mtu; |
| 107 | unsigned int sco_mtu; | 129 | unsigned int sco_mtu; |
| 130 | unsigned int le_mtu; | ||
| 108 | unsigned int acl_pkts; | 131 | unsigned int acl_pkts; |
| 109 | unsigned int sco_pkts; | 132 | unsigned int sco_pkts; |
| 133 | unsigned int le_pkts; | ||
| 110 | 134 | ||
| 111 | unsigned long cmd_last_tx; | ||
| 112 | unsigned long acl_last_tx; | 135 | unsigned long acl_last_tx; |
| 113 | unsigned long sco_last_tx; | 136 | unsigned long sco_last_tx; |
| 137 | unsigned long le_last_tx; | ||
| 114 | 138 | ||
| 115 | struct workqueue_struct *workqueue; | 139 | struct workqueue_struct *workqueue; |
| 116 | 140 | ||
| 141 | struct work_struct power_on; | ||
| 142 | struct work_struct power_off; | ||
| 143 | struct timer_list off_timer; | ||
| 144 | |||
| 145 | struct timer_list cmd_timer; | ||
| 117 | struct tasklet_struct cmd_task; | 146 | struct tasklet_struct cmd_task; |
| 118 | struct tasklet_struct rx_task; | 147 | struct tasklet_struct rx_task; |
| 119 | struct tasklet_struct tx_task; | 148 | struct tasklet_struct tx_task; |
| @@ -129,12 +158,17 @@ struct hci_dev { | |||
| 129 | wait_queue_head_t req_wait_q; | 158 | wait_queue_head_t req_wait_q; |
| 130 | __u32 req_status; | 159 | __u32 req_status; |
| 131 | __u32 req_result; | 160 | __u32 req_result; |
| 132 | __u16 req_last_cmd; | 161 | |
| 162 | __u16 init_last_cmd; | ||
| 133 | 163 | ||
| 134 | struct inquiry_cache inq_cache; | 164 | struct inquiry_cache inq_cache; |
| 135 | struct hci_conn_hash conn_hash; | 165 | struct hci_conn_hash conn_hash; |
| 136 | struct list_head blacklist; | 166 | struct list_head blacklist; |
| 137 | 167 | ||
| 168 | struct list_head uuids; | ||
| 169 | |||
| 170 | struct list_head link_keys; | ||
| 171 | |||
| 138 | struct hci_dev_stats stat; | 172 | struct hci_dev_stats stat; |
| 139 | 173 | ||
| 140 | struct sk_buff_head driver_init; | 174 | struct sk_buff_head driver_init; |
| @@ -165,31 +199,37 @@ struct hci_dev { | |||
| 165 | struct hci_conn { | 199 | struct hci_conn { |
| 166 | struct list_head list; | 200 | struct list_head list; |
| 167 | 201 | ||
| 168 | atomic_t refcnt; | 202 | atomic_t refcnt; |
| 169 | spinlock_t lock; | 203 | spinlock_t lock; |
| 170 | 204 | ||
| 171 | bdaddr_t dst; | 205 | bdaddr_t dst; |
| 172 | __u16 handle; | 206 | __u16 handle; |
| 173 | __u16 state; | 207 | __u16 state; |
| 174 | __u8 mode; | 208 | __u8 mode; |
| 175 | __u8 type; | 209 | __u8 type; |
| 176 | __u8 out; | 210 | __u8 out; |
| 177 | __u8 attempt; | 211 | __u8 attempt; |
| 178 | __u8 dev_class[3]; | 212 | __u8 dev_class[3]; |
| 179 | __u8 features[8]; | 213 | __u8 features[8]; |
| 180 | __u8 ssp_mode; | 214 | __u8 ssp_mode; |
| 181 | __u16 interval; | 215 | __u16 interval; |
| 182 | __u16 pkt_type; | 216 | __u16 pkt_type; |
| 183 | __u16 link_policy; | 217 | __u16 link_policy; |
| 184 | __u32 link_mode; | 218 | __u32 link_mode; |
| 185 | __u8 auth_type; | 219 | __u8 auth_type; |
| 186 | __u8 sec_level; | 220 | __u8 sec_level; |
| 187 | __u8 pending_sec_level; | 221 | __u8 pending_sec_level; |
| 188 | __u8 power_save; | 222 | __u8 pin_length; |
| 189 | __u16 disc_timeout; | 223 | __u8 io_capability; |
| 190 | unsigned long pend; | 224 | __u8 power_save; |
| 191 | 225 | __u16 disc_timeout; | |
| 192 | unsigned int sent; | 226 | unsigned long pend; |
| 227 | |||
| 228 | __u8 remote_cap; | ||
| 229 | __u8 remote_oob; | ||
| 230 | __u8 remote_auth; | ||
| 231 | |||
| 232 | unsigned int sent; | ||
| 193 | 233 | ||
| 194 | struct sk_buff_head data_q; | 234 | struct sk_buff_head data_q; |
| 195 | 235 | ||
| @@ -208,6 +248,10 @@ struct hci_conn { | |||
| 208 | void *priv; | 248 | void *priv; |
| 209 | 249 | ||
| 210 | struct hci_conn *link; | 250 | struct hci_conn *link; |
| 251 | |||
| 252 | void (*connect_cfm_cb) (struct hci_conn *conn, u8 status); | ||
| 253 | void (*security_cfm_cb) (struct hci_conn *conn, u8 status); | ||
| 254 | void (*disconn_cfm_cb) (struct hci_conn *conn, u8 reason); | ||
| 211 | }; | 255 | }; |
| 212 | 256 | ||
| 213 | extern struct hci_proto *hci_proto[]; | 257 | extern struct hci_proto *hci_proto[]; |
| @@ -274,24 +318,40 @@ static inline void hci_conn_hash_add(struct hci_dev *hdev, struct hci_conn *c) | |||
| 274 | { | 318 | { |
| 275 | struct hci_conn_hash *h = &hdev->conn_hash; | 319 | struct hci_conn_hash *h = &hdev->conn_hash; |
| 276 | list_add(&c->list, &h->list); | 320 | list_add(&c->list, &h->list); |
| 277 | if (c->type == ACL_LINK) | 321 | switch (c->type) { |
| 322 | case ACL_LINK: | ||
| 278 | h->acl_num++; | 323 | h->acl_num++; |
| 279 | else | 324 | break; |
| 325 | case LE_LINK: | ||
| 326 | h->le_num++; | ||
| 327 | break; | ||
| 328 | case SCO_LINK: | ||
| 329 | case ESCO_LINK: | ||
| 280 | h->sco_num++; | 330 | h->sco_num++; |
| 331 | break; | ||
| 332 | } | ||
| 281 | } | 333 | } |
| 282 | 334 | ||
| 283 | static inline void hci_conn_hash_del(struct hci_dev *hdev, struct hci_conn *c) | 335 | static inline void hci_conn_hash_del(struct hci_dev *hdev, struct hci_conn *c) |
| 284 | { | 336 | { |
| 285 | struct hci_conn_hash *h = &hdev->conn_hash; | 337 | struct hci_conn_hash *h = &hdev->conn_hash; |
| 286 | list_del(&c->list); | 338 | list_del(&c->list); |
| 287 | if (c->type == ACL_LINK) | 339 | switch (c->type) { |
| 340 | case ACL_LINK: | ||
| 288 | h->acl_num--; | 341 | h->acl_num--; |
| 289 | else | 342 | break; |
| 343 | case LE_LINK: | ||
| 344 | h->le_num--; | ||
| 345 | break; | ||
| 346 | case SCO_LINK: | ||
| 347 | case ESCO_LINK: | ||
| 290 | h->sco_num--; | 348 | h->sco_num--; |
| 349 | break; | ||
| 350 | } | ||
| 291 | } | 351 | } |
| 292 | 352 | ||
| 293 | static inline struct hci_conn *hci_conn_hash_lookup_handle(struct hci_dev *hdev, | 353 | static inline struct hci_conn *hci_conn_hash_lookup_handle(struct hci_dev *hdev, |
| 294 | __u16 handle) | 354 | __u16 handle) |
| 295 | { | 355 | { |
| 296 | struct hci_conn_hash *h = &hdev->conn_hash; | 356 | struct hci_conn_hash *h = &hdev->conn_hash; |
| 297 | struct list_head *p; | 357 | struct list_head *p; |
| @@ -306,7 +366,7 @@ static inline struct hci_conn *hci_conn_hash_lookup_handle(struct hci_dev *hdev, | |||
| 306 | } | 366 | } |
| 307 | 367 | ||
| 308 | static inline struct hci_conn *hci_conn_hash_lookup_ba(struct hci_dev *hdev, | 368 | static inline struct hci_conn *hci_conn_hash_lookup_ba(struct hci_dev *hdev, |
| 309 | __u8 type, bdaddr_t *ba) | 369 | __u8 type, bdaddr_t *ba) |
| 310 | { | 370 | { |
| 311 | struct hci_conn_hash *h = &hdev->conn_hash; | 371 | struct hci_conn_hash *h = &hdev->conn_hash; |
| 312 | struct list_head *p; | 372 | struct list_head *p; |
| @@ -321,7 +381,7 @@ static inline struct hci_conn *hci_conn_hash_lookup_ba(struct hci_dev *hdev, | |||
| 321 | } | 381 | } |
| 322 | 382 | ||
| 323 | static inline struct hci_conn *hci_conn_hash_lookup_state(struct hci_dev *hdev, | 383 | static inline struct hci_conn *hci_conn_hash_lookup_state(struct hci_dev *hdev, |
| 324 | __u8 type, __u16 state) | 384 | __u8 type, __u16 state) |
| 325 | { | 385 | { |
| 326 | struct hci_conn_hash *h = &hdev->conn_hash; | 386 | struct hci_conn_hash *h = &hdev->conn_hash; |
| 327 | struct list_head *p; | 387 | struct list_head *p; |
| @@ -437,6 +497,16 @@ int hci_inquiry(void __user *arg); | |||
| 437 | struct bdaddr_list *hci_blacklist_lookup(struct hci_dev *hdev, bdaddr_t *bdaddr); | 497 | struct bdaddr_list *hci_blacklist_lookup(struct hci_dev *hdev, bdaddr_t *bdaddr); |
| 438 | int hci_blacklist_clear(struct hci_dev *hdev); | 498 | int hci_blacklist_clear(struct hci_dev *hdev); |
| 439 | 499 | ||
| 500 | int hci_uuids_clear(struct hci_dev *hdev); | ||
| 501 | |||
| 502 | int hci_link_keys_clear(struct hci_dev *hdev); | ||
| 503 | struct link_key *hci_find_link_key(struct hci_dev *hdev, bdaddr_t *bdaddr); | ||
| 504 | int hci_add_link_key(struct hci_dev *hdev, int new_key, bdaddr_t *bdaddr, | ||
| 505 | u8 *key, u8 type, u8 pin_len); | ||
| 506 | int hci_remove_link_key(struct hci_dev *hdev, bdaddr_t *bdaddr); | ||
| 507 | |||
| 508 | void hci_del_off_timer(struct hci_dev *hdev); | ||
| 509 | |||
| 440 | void hci_event_packet(struct hci_dev *hdev, struct sk_buff *skb); | 510 | void hci_event_packet(struct hci_dev *hdev, struct sk_buff *skb); |
| 441 | 511 | ||
| 442 | int hci_recv_frame(struct sk_buff *skb); | 512 | int hci_recv_frame(struct sk_buff *skb); |
| @@ -458,6 +528,8 @@ void hci_conn_del_sysfs(struct hci_conn *conn); | |||
| 458 | #define lmp_sniffsubr_capable(dev) ((dev)->features[5] & LMP_SNIFF_SUBR) | 528 | #define lmp_sniffsubr_capable(dev) ((dev)->features[5] & LMP_SNIFF_SUBR) |
| 459 | #define lmp_esco_capable(dev) ((dev)->features[3] & LMP_ESCO) | 529 | #define lmp_esco_capable(dev) ((dev)->features[3] & LMP_ESCO) |
| 460 | #define lmp_ssp_capable(dev) ((dev)->features[6] & LMP_SIMPLE_PAIR) | 530 | #define lmp_ssp_capable(dev) ((dev)->features[6] & LMP_SIMPLE_PAIR) |
| 531 | #define lmp_no_flush_capable(dev) ((dev)->features[6] & LMP_NO_FLUSH) | ||
| 532 | #define lmp_le_capable(dev) ((dev)->features[4] & LMP_LE) | ||
| 461 | 533 | ||
| 462 | /* ----- HCI protocols ----- */ | 534 | /* ----- HCI protocols ----- */ |
| 463 | struct hci_proto { | 535 | struct hci_proto { |
| @@ -503,6 +575,9 @@ static inline void hci_proto_connect_cfm(struct hci_conn *conn, __u8 status) | |||
| 503 | hp = hci_proto[HCI_PROTO_SCO]; | 575 | hp = hci_proto[HCI_PROTO_SCO]; |
| 504 | if (hp && hp->connect_cfm) | 576 | if (hp && hp->connect_cfm) |
| 505 | hp->connect_cfm(conn, status); | 577 | hp->connect_cfm(conn, status); |
| 578 | |||
| 579 | if (conn->connect_cfm_cb) | ||
| 580 | conn->connect_cfm_cb(conn, status); | ||
| 506 | } | 581 | } |
| 507 | 582 | ||
| 508 | static inline int hci_proto_disconn_ind(struct hci_conn *conn) | 583 | static inline int hci_proto_disconn_ind(struct hci_conn *conn) |
| @@ -532,6 +607,9 @@ static inline void hci_proto_disconn_cfm(struct hci_conn *conn, __u8 reason) | |||
| 532 | hp = hci_proto[HCI_PROTO_SCO]; | 607 | hp = hci_proto[HCI_PROTO_SCO]; |
| 533 | if (hp && hp->disconn_cfm) | 608 | if (hp && hp->disconn_cfm) |
| 534 | hp->disconn_cfm(conn, reason); | 609 | hp->disconn_cfm(conn, reason); |
| 610 | |||
| 611 | if (conn->disconn_cfm_cb) | ||
| 612 | conn->disconn_cfm_cb(conn, reason); | ||
| 535 | } | 613 | } |
| 536 | 614 | ||
| 537 | static inline void hci_proto_auth_cfm(struct hci_conn *conn, __u8 status) | 615 | static inline void hci_proto_auth_cfm(struct hci_conn *conn, __u8 status) |
| @@ -551,6 +629,9 @@ static inline void hci_proto_auth_cfm(struct hci_conn *conn, __u8 status) | |||
| 551 | hp = hci_proto[HCI_PROTO_SCO]; | 629 | hp = hci_proto[HCI_PROTO_SCO]; |
| 552 | if (hp && hp->security_cfm) | 630 | if (hp && hp->security_cfm) |
| 553 | hp->security_cfm(conn, status, encrypt); | 631 | hp->security_cfm(conn, status, encrypt); |
| 632 | |||
| 633 | if (conn->security_cfm_cb) | ||
| 634 | conn->security_cfm_cb(conn, status); | ||
| 554 | } | 635 | } |
| 555 | 636 | ||
| 556 | static inline void hci_proto_encrypt_cfm(struct hci_conn *conn, __u8 status, __u8 encrypt) | 637 | static inline void hci_proto_encrypt_cfm(struct hci_conn *conn, __u8 status, __u8 encrypt) |
| @@ -564,6 +645,9 @@ static inline void hci_proto_encrypt_cfm(struct hci_conn *conn, __u8 status, __u | |||
| 564 | hp = hci_proto[HCI_PROTO_SCO]; | 645 | hp = hci_proto[HCI_PROTO_SCO]; |
| 565 | if (hp && hp->security_cfm) | 646 | if (hp && hp->security_cfm) |
| 566 | hp->security_cfm(conn, status, encrypt); | 647 | hp->security_cfm(conn, status, encrypt); |
| 648 | |||
| 649 | if (conn->security_cfm_cb) | ||
| 650 | conn->security_cfm_cb(conn, status); | ||
| 567 | } | 651 | } |
| 568 | 652 | ||
| 569 | int hci_register_proto(struct hci_proto *hproto); | 653 | int hci_register_proto(struct hci_proto *hproto); |
| @@ -660,12 +744,29 @@ void *hci_sent_cmd_data(struct hci_dev *hdev, __u16 opcode); | |||
| 660 | void hci_si_event(struct hci_dev *hdev, int type, int dlen, void *data); | 744 | void hci_si_event(struct hci_dev *hdev, int type, int dlen, void *data); |
| 661 | 745 | ||
| 662 | /* ----- HCI Sockets ----- */ | 746 | /* ----- HCI Sockets ----- */ |
| 663 | void hci_send_to_sock(struct hci_dev *hdev, struct sk_buff *skb); | 747 | void hci_send_to_sock(struct hci_dev *hdev, struct sk_buff *skb, |
| 748 | struct sock *skip_sk); | ||
| 664 | 749 | ||
| 665 | /* Management interface */ | 750 | /* Management interface */ |
| 666 | int mgmt_control(struct sock *sk, struct msghdr *msg, size_t len); | 751 | int mgmt_control(struct sock *sk, struct msghdr *msg, size_t len); |
| 667 | int mgmt_index_added(u16 index); | 752 | int mgmt_index_added(u16 index); |
| 668 | int mgmt_index_removed(u16 index); | 753 | int mgmt_index_removed(u16 index); |
| 754 | int mgmt_powered(u16 index, u8 powered); | ||
| 755 | int mgmt_discoverable(u16 index, u8 discoverable); | ||
| 756 | int mgmt_connectable(u16 index, u8 connectable); | ||
| 757 | int mgmt_new_key(u16 index, struct link_key *key, u8 old_key_type); | ||
| 758 | int mgmt_connected(u16 index, bdaddr_t *bdaddr); | ||
| 759 | int mgmt_disconnected(u16 index, bdaddr_t *bdaddr); | ||
| 760 | int mgmt_disconnect_failed(u16 index); | ||
| 761 | int mgmt_connect_failed(u16 index, bdaddr_t *bdaddr, u8 status); | ||
| 762 | int mgmt_pin_code_request(u16 index, bdaddr_t *bdaddr); | ||
| 763 | int mgmt_pin_code_reply_complete(u16 index, bdaddr_t *bdaddr, u8 status); | ||
| 764 | int mgmt_pin_code_neg_reply_complete(u16 index, bdaddr_t *bdaddr, u8 status); | ||
| 765 | int mgmt_user_confirm_request(u16 index, bdaddr_t *bdaddr, __le32 value); | ||
| 766 | int mgmt_user_confirm_reply_complete(u16 index, bdaddr_t *bdaddr, u8 status); | ||
| 767 | int mgmt_user_confirm_neg_reply_complete(u16 index, bdaddr_t *bdaddr, | ||
| 768 | u8 status); | ||
| 769 | int mgmt_auth_failed(u16 index, bdaddr_t *bdaddr, u8 status); | ||
| 669 | 770 | ||
| 670 | /* HCI info for socket */ | 771 | /* HCI info for socket */ |
| 671 | #define hci_pi(sk) ((struct hci_pinfo *) sk) | 772 | #define hci_pi(sk) ((struct hci_pinfo *) sk) |
| @@ -697,4 +798,6 @@ struct hci_sec_filter { | |||
| 697 | 798 | ||
| 698 | void hci_req_complete(struct hci_dev *hdev, __u16 cmd, int result); | 799 | void hci_req_complete(struct hci_dev *hdev, __u16 cmd, int result); |
| 699 | 800 | ||
| 801 | void hci_le_conn_update(struct hci_conn *conn, u16 min, u16 max, | ||
| 802 | u16 latency, u16 to_multiplier); | ||
| 700 | #endif /* __HCI_CORE_H */ | 803 | #endif /* __HCI_CORE_H */ |
diff --git a/include/net/bluetooth/l2cap.h b/include/net/bluetooth/l2cap.h index 7ad25ca60ec0..4f4bff1eaed6 100644 --- a/include/net/bluetooth/l2cap.h +++ b/include/net/bluetooth/l2cap.h | |||
| @@ -38,6 +38,7 @@ | |||
| 38 | #define L2CAP_DEFAULT_MAX_PDU_SIZE 1009 /* Sized for 3-DH5 packet */ | 38 | #define L2CAP_DEFAULT_MAX_PDU_SIZE 1009 /* Sized for 3-DH5 packet */ |
| 39 | #define L2CAP_DEFAULT_ACK_TO 200 | 39 | #define L2CAP_DEFAULT_ACK_TO 200 |
| 40 | #define L2CAP_LOCAL_BUSY_TRIES 12 | 40 | #define L2CAP_LOCAL_BUSY_TRIES 12 |
| 41 | #define L2CAP_LE_DEFAULT_MTU 23 | ||
| 41 | 42 | ||
| 42 | #define L2CAP_CONN_TIMEOUT (40000) /* 40 seconds */ | 43 | #define L2CAP_CONN_TIMEOUT (40000) /* 40 seconds */ |
| 43 | #define L2CAP_INFO_TIMEOUT (4000) /* 4 seconds */ | 44 | #define L2CAP_INFO_TIMEOUT (4000) /* 4 seconds */ |
| @@ -88,6 +89,8 @@ struct l2cap_conninfo { | |||
| 88 | #define L2CAP_ECHO_RSP 0x09 | 89 | #define L2CAP_ECHO_RSP 0x09 |
| 89 | #define L2CAP_INFO_REQ 0x0a | 90 | #define L2CAP_INFO_REQ 0x0a |
| 90 | #define L2CAP_INFO_RSP 0x0b | 91 | #define L2CAP_INFO_RSP 0x0b |
| 92 | #define L2CAP_CONN_PARAM_UPDATE_REQ 0x12 | ||
| 93 | #define L2CAP_CONN_PARAM_UPDATE_RSP 0x13 | ||
| 91 | 94 | ||
| 92 | /* L2CAP feature mask */ | 95 | /* L2CAP feature mask */ |
| 93 | #define L2CAP_FEAT_FLOWCTL 0x00000001 | 96 | #define L2CAP_FEAT_FLOWCTL 0x00000001 |
| @@ -160,6 +163,9 @@ struct l2cap_conn_rsp { | |||
| 160 | /* channel indentifier */ | 163 | /* channel indentifier */ |
| 161 | #define L2CAP_CID_SIGNALING 0x0001 | 164 | #define L2CAP_CID_SIGNALING 0x0001 |
| 162 | #define L2CAP_CID_CONN_LESS 0x0002 | 165 | #define L2CAP_CID_CONN_LESS 0x0002 |
| 166 | #define L2CAP_CID_LE_DATA 0x0004 | ||
| 167 | #define L2CAP_CID_LE_SIGNALING 0x0005 | ||
| 168 | #define L2CAP_CID_SMP 0x0006 | ||
| 163 | #define L2CAP_CID_DYN_START 0x0040 | 169 | #define L2CAP_CID_DYN_START 0x0040 |
| 164 | #define L2CAP_CID_DYN_END 0xffff | 170 | #define L2CAP_CID_DYN_END 0xffff |
| 165 | 171 | ||
| @@ -255,6 +261,21 @@ struct l2cap_info_rsp { | |||
| 255 | #define L2CAP_IR_SUCCESS 0x0000 | 261 | #define L2CAP_IR_SUCCESS 0x0000 |
| 256 | #define L2CAP_IR_NOTSUPP 0x0001 | 262 | #define L2CAP_IR_NOTSUPP 0x0001 |
| 257 | 263 | ||
| 264 | struct l2cap_conn_param_update_req { | ||
| 265 | __le16 min; | ||
| 266 | __le16 max; | ||
| 267 | __le16 latency; | ||
| 268 | __le16 to_multiplier; | ||
| 269 | } __packed; | ||
| 270 | |||
| 271 | struct l2cap_conn_param_update_rsp { | ||
| 272 | __le16 result; | ||
| 273 | } __packed; | ||
| 274 | |||
| 275 | /* Connection Parameters result */ | ||
| 276 | #define L2CAP_CONN_PARAM_ACCEPTED 0x0000 | ||
| 277 | #define L2CAP_CONN_PARAM_REJECTED 0x0001 | ||
| 278 | |||
| 258 | /* ----- L2CAP connections ----- */ | 279 | /* ----- L2CAP connections ----- */ |
| 259 | struct l2cap_chan_list { | 280 | struct l2cap_chan_list { |
| 260 | struct sock *head; | 281 | struct sock *head; |
| @@ -327,6 +348,7 @@ struct l2cap_pinfo { | |||
| 327 | __u8 sec_level; | 348 | __u8 sec_level; |
| 328 | __u8 role_switch; | 349 | __u8 role_switch; |
| 329 | __u8 force_reliable; | 350 | __u8 force_reliable; |
| 351 | __u8 flushable; | ||
| 330 | 352 | ||
| 331 | __u8 conf_req[64]; | 353 | __u8 conf_req[64]; |
| 332 | __u8 conf_len; | 354 | __u8 conf_len; |
| @@ -423,6 +445,35 @@ static inline int l2cap_tx_window_full(struct sock *sk) | |||
| 423 | #define __is_sframe(ctrl) ((ctrl) & L2CAP_CTRL_FRAME_TYPE) | 445 | #define __is_sframe(ctrl) ((ctrl) & L2CAP_CTRL_FRAME_TYPE) |
| 424 | #define __is_sar_start(ctrl) (((ctrl) & L2CAP_CTRL_SAR) == L2CAP_SDU_START) | 446 | #define __is_sar_start(ctrl) (((ctrl) & L2CAP_CTRL_SAR) == L2CAP_SDU_START) |
| 425 | 447 | ||
| 426 | void l2cap_load(void); | 448 | extern int disable_ertm; |
| 449 | extern const struct proto_ops l2cap_sock_ops; | ||
| 450 | extern struct bt_sock_list l2cap_sk_list; | ||
| 451 | |||
| 452 | int l2cap_init_sockets(void); | ||
| 453 | void l2cap_cleanup_sockets(void); | ||
| 454 | |||
| 455 | u8 l2cap_get_ident(struct l2cap_conn *conn); | ||
| 456 | void l2cap_send_cmd(struct l2cap_conn *conn, u8 ident, u8 code, u16 len, void *data); | ||
| 457 | int l2cap_build_conf_req(struct sock *sk, void *data); | ||
| 458 | int __l2cap_wait_ack(struct sock *sk); | ||
| 459 | |||
| 460 | struct sk_buff *l2cap_create_connless_pdu(struct sock *sk, struct msghdr *msg, size_t len); | ||
| 461 | struct sk_buff *l2cap_create_basic_pdu(struct sock *sk, struct msghdr *msg, size_t len); | ||
| 462 | struct sk_buff *l2cap_create_iframe_pdu(struct sock *sk, struct msghdr *msg, size_t len, u16 control, u16 sdulen); | ||
| 463 | int l2cap_sar_segment_sdu(struct sock *sk, struct msghdr *msg, size_t len); | ||
| 464 | void l2cap_do_send(struct sock *sk, struct sk_buff *skb); | ||
| 465 | void l2cap_streaming_send(struct sock *sk); | ||
| 466 | int l2cap_ertm_send(struct sock *sk); | ||
| 467 | |||
| 468 | void l2cap_sock_set_timer(struct sock *sk, long timeout); | ||
| 469 | void l2cap_sock_clear_timer(struct sock *sk); | ||
| 470 | void __l2cap_sock_close(struct sock *sk, int reason); | ||
| 471 | void l2cap_sock_kill(struct sock *sk); | ||
| 472 | void l2cap_sock_init(struct sock *sk, struct sock *parent); | ||
| 473 | struct sock *l2cap_sock_alloc(struct net *net, struct socket *sock, | ||
| 474 | int proto, gfp_t prio); | ||
| 475 | void l2cap_send_disconn_req(struct l2cap_conn *conn, struct sock *sk, int err); | ||
| 476 | void l2cap_chan_del(struct sock *sk, int err); | ||
| 477 | int l2cap_do_connect(struct sock *sk); | ||
| 427 | 478 | ||
| 428 | #endif /* __L2CAP_H */ | 479 | #endif /* __L2CAP_H */ |
diff --git a/include/net/bluetooth/mgmt.h b/include/net/bluetooth/mgmt.h index ca29c1367ffd..5fabfa886b3e 100644 --- a/include/net/bluetooth/mgmt.h +++ b/include/net/bluetooth/mgmt.h | |||
| @@ -21,11 +21,13 @@ | |||
| 21 | SOFTWARE IS DISCLAIMED. | 21 | SOFTWARE IS DISCLAIMED. |
| 22 | */ | 22 | */ |
| 23 | 23 | ||
| 24 | #define MGMT_INDEX_NONE 0xFFFF | ||
| 25 | |||
| 24 | struct mgmt_hdr { | 26 | struct mgmt_hdr { |
| 25 | __le16 opcode; | 27 | __le16 opcode; |
| 28 | __le16 index; | ||
| 26 | __le16 len; | 29 | __le16 len; |
| 27 | } __packed; | 30 | } __packed; |
| 28 | #define MGMT_HDR_SIZE 4 | ||
| 29 | 31 | ||
| 30 | #define MGMT_OP_READ_VERSION 0x0001 | 32 | #define MGMT_OP_READ_VERSION 0x0001 |
| 31 | struct mgmt_rp_read_version { | 33 | struct mgmt_rp_read_version { |
| @@ -40,13 +42,10 @@ struct mgmt_rp_read_index_list { | |||
| 40 | } __packed; | 42 | } __packed; |
| 41 | 43 | ||
| 42 | #define MGMT_OP_READ_INFO 0x0004 | 44 | #define MGMT_OP_READ_INFO 0x0004 |
| 43 | struct mgmt_cp_read_info { | ||
| 44 | __le16 index; | ||
| 45 | } __packed; | ||
| 46 | struct mgmt_rp_read_info { | 45 | struct mgmt_rp_read_info { |
| 47 | __le16 index; | ||
| 48 | __u8 type; | 46 | __u8 type; |
| 49 | __u8 powered; | 47 | __u8 powered; |
| 48 | __u8 connectable; | ||
| 50 | __u8 discoverable; | 49 | __u8 discoverable; |
| 51 | __u8 pairable; | 50 | __u8 pairable; |
| 52 | __u8 sec_mode; | 51 | __u8 sec_mode; |
| @@ -58,6 +57,116 @@ struct mgmt_rp_read_info { | |||
| 58 | __u16 hci_rev; | 57 | __u16 hci_rev; |
| 59 | } __packed; | 58 | } __packed; |
| 60 | 59 | ||
| 60 | struct mgmt_mode { | ||
| 61 | __u8 val; | ||
| 62 | } __packed; | ||
| 63 | |||
| 64 | #define MGMT_OP_SET_POWERED 0x0005 | ||
| 65 | |||
| 66 | #define MGMT_OP_SET_DISCOVERABLE 0x0006 | ||
| 67 | |||
| 68 | #define MGMT_OP_SET_CONNECTABLE 0x0007 | ||
| 69 | |||
| 70 | #define MGMT_OP_SET_PAIRABLE 0x0008 | ||
| 71 | |||
| 72 | #define MGMT_OP_ADD_UUID 0x0009 | ||
| 73 | struct mgmt_cp_add_uuid { | ||
| 74 | __u8 uuid[16]; | ||
| 75 | __u8 svc_hint; | ||
| 76 | } __packed; | ||
| 77 | |||
| 78 | #define MGMT_OP_REMOVE_UUID 0x000A | ||
| 79 | struct mgmt_cp_remove_uuid { | ||
| 80 | __u8 uuid[16]; | ||
| 81 | } __packed; | ||
| 82 | |||
| 83 | #define MGMT_OP_SET_DEV_CLASS 0x000B | ||
| 84 | struct mgmt_cp_set_dev_class { | ||
| 85 | __u8 major; | ||
| 86 | __u8 minor; | ||
| 87 | } __packed; | ||
| 88 | |||
| 89 | #define MGMT_OP_SET_SERVICE_CACHE 0x000C | ||
| 90 | struct mgmt_cp_set_service_cache { | ||
| 91 | __u8 enable; | ||
| 92 | } __packed; | ||
| 93 | |||
| 94 | struct mgmt_key_info { | ||
| 95 | bdaddr_t bdaddr; | ||
| 96 | u8 type; | ||
| 97 | u8 val[16]; | ||
| 98 | u8 pin_len; | ||
| 99 | } __packed; | ||
| 100 | |||
| 101 | #define MGMT_OP_LOAD_KEYS 0x000D | ||
| 102 | struct mgmt_cp_load_keys { | ||
| 103 | __u8 debug_keys; | ||
| 104 | __le16 key_count; | ||
| 105 | struct mgmt_key_info keys[0]; | ||
| 106 | } __packed; | ||
| 107 | |||
| 108 | #define MGMT_OP_REMOVE_KEY 0x000E | ||
| 109 | struct mgmt_cp_remove_key { | ||
| 110 | bdaddr_t bdaddr; | ||
| 111 | __u8 disconnect; | ||
| 112 | } __packed; | ||
| 113 | |||
| 114 | #define MGMT_OP_DISCONNECT 0x000F | ||
| 115 | struct mgmt_cp_disconnect { | ||
| 116 | bdaddr_t bdaddr; | ||
| 117 | } __packed; | ||
| 118 | struct mgmt_rp_disconnect { | ||
| 119 | bdaddr_t bdaddr; | ||
| 120 | } __packed; | ||
| 121 | |||
| 122 | #define MGMT_OP_GET_CONNECTIONS 0x0010 | ||
| 123 | struct mgmt_rp_get_connections { | ||
| 124 | __le16 conn_count; | ||
| 125 | bdaddr_t conn[0]; | ||
| 126 | } __packed; | ||
| 127 | |||
| 128 | #define MGMT_OP_PIN_CODE_REPLY 0x0011 | ||
| 129 | struct mgmt_cp_pin_code_reply { | ||
| 130 | bdaddr_t bdaddr; | ||
| 131 | __u8 pin_len; | ||
| 132 | __u8 pin_code[16]; | ||
| 133 | } __packed; | ||
| 134 | struct mgmt_rp_pin_code_reply { | ||
| 135 | bdaddr_t bdaddr; | ||
| 136 | uint8_t status; | ||
| 137 | } __packed; | ||
| 138 | |||
| 139 | #define MGMT_OP_PIN_CODE_NEG_REPLY 0x0012 | ||
| 140 | struct mgmt_cp_pin_code_neg_reply { | ||
| 141 | bdaddr_t bdaddr; | ||
| 142 | } __packed; | ||
| 143 | |||
| 144 | #define MGMT_OP_SET_IO_CAPABILITY 0x0013 | ||
| 145 | struct mgmt_cp_set_io_capability { | ||
| 146 | __u8 io_capability; | ||
| 147 | } __packed; | ||
| 148 | |||
| 149 | #define MGMT_OP_PAIR_DEVICE 0x0014 | ||
| 150 | struct mgmt_cp_pair_device { | ||
| 151 | bdaddr_t bdaddr; | ||
| 152 | __u8 io_cap; | ||
| 153 | } __packed; | ||
| 154 | struct mgmt_rp_pair_device { | ||
| 155 | bdaddr_t bdaddr; | ||
| 156 | __u8 status; | ||
| 157 | } __packed; | ||
| 158 | |||
| 159 | #define MGMT_OP_USER_CONFIRM_REPLY 0x0015 | ||
| 160 | struct mgmt_cp_user_confirm_reply { | ||
| 161 | bdaddr_t bdaddr; | ||
| 162 | } __packed; | ||
| 163 | struct mgmt_rp_user_confirm_reply { | ||
| 164 | bdaddr_t bdaddr; | ||
| 165 | __u8 status; | ||
| 166 | } __packed; | ||
| 167 | |||
| 168 | #define MGMT_OP_USER_CONFIRM_NEG_REPLY 0x0016 | ||
| 169 | |||
| 61 | #define MGMT_EV_CMD_COMPLETE 0x0001 | 170 | #define MGMT_EV_CMD_COMPLETE 0x0001 |
| 62 | struct mgmt_ev_cmd_complete { | 171 | struct mgmt_ev_cmd_complete { |
| 63 | __le16 opcode; | 172 | __le16 opcode; |
| @@ -72,16 +181,56 @@ struct mgmt_ev_cmd_status { | |||
| 72 | 181 | ||
| 73 | #define MGMT_EV_CONTROLLER_ERROR 0x0003 | 182 | #define MGMT_EV_CONTROLLER_ERROR 0x0003 |
| 74 | struct mgmt_ev_controller_error { | 183 | struct mgmt_ev_controller_error { |
| 75 | __le16 index; | ||
| 76 | __u8 error_code; | 184 | __u8 error_code; |
| 77 | } __packed; | 185 | } __packed; |
| 78 | 186 | ||
| 79 | #define MGMT_EV_INDEX_ADDED 0x0004 | 187 | #define MGMT_EV_INDEX_ADDED 0x0004 |
| 80 | struct mgmt_ev_index_added { | ||
| 81 | __le16 index; | ||
| 82 | } __packed; | ||
| 83 | 188 | ||
| 84 | #define MGMT_EV_INDEX_REMOVED 0x0005 | 189 | #define MGMT_EV_INDEX_REMOVED 0x0005 |
| 85 | struct mgmt_ev_index_removed { | 190 | |
| 86 | __le16 index; | 191 | #define MGMT_EV_POWERED 0x0006 |
| 192 | |||
| 193 | #define MGMT_EV_DISCOVERABLE 0x0007 | ||
| 194 | |||
| 195 | #define MGMT_EV_CONNECTABLE 0x0008 | ||
| 196 | |||
| 197 | #define MGMT_EV_PAIRABLE 0x0009 | ||
| 198 | |||
| 199 | #define MGMT_EV_NEW_KEY 0x000A | ||
| 200 | struct mgmt_ev_new_key { | ||
| 201 | struct mgmt_key_info key; | ||
| 202 | __u8 old_key_type; | ||
| 203 | } __packed; | ||
| 204 | |||
| 205 | #define MGMT_EV_CONNECTED 0x000B | ||
| 206 | struct mgmt_ev_connected { | ||
| 207 | bdaddr_t bdaddr; | ||
| 208 | } __packed; | ||
| 209 | |||
| 210 | #define MGMT_EV_DISCONNECTED 0x000C | ||
| 211 | struct mgmt_ev_disconnected { | ||
| 212 | bdaddr_t bdaddr; | ||
| 213 | } __packed; | ||
| 214 | |||
| 215 | #define MGMT_EV_CONNECT_FAILED 0x000D | ||
| 216 | struct mgmt_ev_connect_failed { | ||
| 217 | bdaddr_t bdaddr; | ||
| 218 | __u8 status; | ||
| 219 | } __packed; | ||
| 220 | |||
| 221 | #define MGMT_EV_PIN_CODE_REQUEST 0x000E | ||
| 222 | struct mgmt_ev_pin_code_request { | ||
| 223 | bdaddr_t bdaddr; | ||
| 224 | } __packed; | ||
| 225 | |||
| 226 | #define MGMT_EV_USER_CONFIRM_REQUEST 0x000F | ||
| 227 | struct mgmt_ev_user_confirm_request { | ||
| 228 | bdaddr_t bdaddr; | ||
| 229 | __le32 value; | ||
| 230 | } __packed; | ||
| 231 | |||
| 232 | #define MGMT_EV_AUTH_FAILED 0x0010 | ||
| 233 | struct mgmt_ev_auth_failed { | ||
| 234 | bdaddr_t bdaddr; | ||
| 235 | __u8 status; | ||
| 87 | } __packed; | 236 | } __packed; |
diff --git a/include/net/bluetooth/smp.h b/include/net/bluetooth/smp.h new file mode 100644 index 000000000000..8f2edbf979dc --- /dev/null +++ b/include/net/bluetooth/smp.h | |||
| @@ -0,0 +1,76 @@ | |||
| 1 | #ifndef __SMP_H | ||
| 2 | #define __SMP_H | ||
| 3 | |||
| 4 | struct smp_command_hdr { | ||
| 5 | __u8 code; | ||
| 6 | } __packed; | ||
| 7 | |||
| 8 | #define SMP_CMD_PAIRING_REQ 0x01 | ||
| 9 | #define SMP_CMD_PAIRING_RSP 0x02 | ||
| 10 | struct smp_cmd_pairing { | ||
| 11 | __u8 io_capability; | ||
| 12 | __u8 oob_flag; | ||
| 13 | __u8 auth_req; | ||
| 14 | __u8 max_key_size; | ||
| 15 | __u8 init_key_dist; | ||
| 16 | __u8 resp_key_dist; | ||
| 17 | } __packed; | ||
| 18 | |||
| 19 | #define SMP_CMD_PAIRING_CONFIRM 0x03 | ||
| 20 | struct smp_cmd_pairing_confirm { | ||
| 21 | __u8 confirm_val[16]; | ||
| 22 | } __packed; | ||
| 23 | |||
| 24 | #define SMP_CMD_PAIRING_RANDOM 0x04 | ||
| 25 | struct smp_cmd_pairing_random { | ||
| 26 | __u8 rand_val[16]; | ||
| 27 | } __packed; | ||
| 28 | |||
| 29 | #define SMP_CMD_PAIRING_FAIL 0x05 | ||
| 30 | struct smp_cmd_pairing_fail { | ||
| 31 | __u8 reason; | ||
| 32 | } __packed; | ||
| 33 | |||
| 34 | #define SMP_CMD_ENCRYPT_INFO 0x06 | ||
| 35 | struct smp_cmd_encrypt_info { | ||
| 36 | __u8 ltk[16]; | ||
| 37 | } __packed; | ||
| 38 | |||
| 39 | #define SMP_CMD_MASTER_IDENT 0x07 | ||
| 40 | struct smp_cmd_master_ident { | ||
| 41 | __u16 ediv; | ||
| 42 | __u8 rand[8]; | ||
| 43 | } __packed; | ||
| 44 | |||
| 45 | #define SMP_CMD_IDENT_INFO 0x08 | ||
| 46 | struct smp_cmd_ident_info { | ||
| 47 | __u8 irk[16]; | ||
| 48 | } __packed; | ||
| 49 | |||
| 50 | #define SMP_CMD_IDENT_ADDR_INFO 0x09 | ||
| 51 | struct smp_cmd_ident_addr_info { | ||
| 52 | __u8 addr_type; | ||
| 53 | bdaddr_t bdaddr; | ||
| 54 | } __packed; | ||
| 55 | |||
| 56 | #define SMP_CMD_SIGN_INFO 0x0a | ||
| 57 | struct smp_cmd_sign_info { | ||
| 58 | __u8 csrk[16]; | ||
| 59 | } __packed; | ||
| 60 | |||
| 61 | #define SMP_CMD_SECURITY_REQ 0x0b | ||
| 62 | struct smp_cmd_security_req { | ||
| 63 | __u8 auth_req; | ||
| 64 | } __packed; | ||
| 65 | |||
| 66 | #define SMP_PASSKEY_ENTRY_FAILED 0x01 | ||
| 67 | #define SMP_OOB_NOT_AVAIL 0x02 | ||
| 68 | #define SMP_AUTH_REQUIREMENTS 0x03 | ||
| 69 | #define SMP_CONFIRM_FAILED 0x04 | ||
| 70 | #define SMP_PAIRING_NOTSUPP 0x05 | ||
| 71 | #define SMP_ENC_KEY_SIZE 0x06 | ||
| 72 | #define SMP_CMD_NOTSUPP 0x07 | ||
| 73 | #define SMP_UNSPECIFIED 0x08 | ||
| 74 | #define SMP_REPEATED_ATTEMPTS 0x09 | ||
| 75 | |||
| 76 | #endif /* __SMP_H */ | ||
diff --git a/include/net/cfg80211.h b/include/net/cfg80211.h index 1322695beb52..60f7876b6da8 100644 --- a/include/net/cfg80211.h +++ b/include/net/cfg80211.h | |||
| @@ -413,7 +413,7 @@ struct station_parameters { | |||
| 413 | * @STATION_INFO_PLID: @plid filled | 413 | * @STATION_INFO_PLID: @plid filled |
| 414 | * @STATION_INFO_PLINK_STATE: @plink_state filled | 414 | * @STATION_INFO_PLINK_STATE: @plink_state filled |
| 415 | * @STATION_INFO_SIGNAL: @signal filled | 415 | * @STATION_INFO_SIGNAL: @signal filled |
| 416 | * @STATION_INFO_TX_BITRATE: @tx_bitrate fields are filled | 416 | * @STATION_INFO_TX_BITRATE: @txrate fields are filled |
| 417 | * (tx_bitrate, tx_bitrate_flags and tx_bitrate_mcs) | 417 | * (tx_bitrate, tx_bitrate_flags and tx_bitrate_mcs) |
| 418 | * @STATION_INFO_RX_PACKETS: @rx_packets filled | 418 | * @STATION_INFO_RX_PACKETS: @rx_packets filled |
| 419 | * @STATION_INFO_TX_PACKETS: @tx_packets filled | 419 | * @STATION_INFO_TX_PACKETS: @tx_packets filled |
| @@ -421,6 +421,7 @@ struct station_parameters { | |||
| 421 | * @STATION_INFO_TX_FAILED: @tx_failed filled | 421 | * @STATION_INFO_TX_FAILED: @tx_failed filled |
| 422 | * @STATION_INFO_RX_DROP_MISC: @rx_dropped_misc filled | 422 | * @STATION_INFO_RX_DROP_MISC: @rx_dropped_misc filled |
| 423 | * @STATION_INFO_SIGNAL_AVG: @signal_avg filled | 423 | * @STATION_INFO_SIGNAL_AVG: @signal_avg filled |
| 424 | * @STATION_INFO_RX_BITRATE: @rxrate fields are filled | ||
| 424 | */ | 425 | */ |
| 425 | enum station_info_flags { | 426 | enum station_info_flags { |
| 426 | STATION_INFO_INACTIVE_TIME = 1<<0, | 427 | STATION_INFO_INACTIVE_TIME = 1<<0, |
| @@ -437,6 +438,7 @@ enum station_info_flags { | |||
| 437 | STATION_INFO_TX_FAILED = 1<<11, | 438 | STATION_INFO_TX_FAILED = 1<<11, |
| 438 | STATION_INFO_RX_DROP_MISC = 1<<12, | 439 | STATION_INFO_RX_DROP_MISC = 1<<12, |
| 439 | STATION_INFO_SIGNAL_AVG = 1<<13, | 440 | STATION_INFO_SIGNAL_AVG = 1<<13, |
| 441 | STATION_INFO_RX_BITRATE = 1<<14, | ||
| 440 | }; | 442 | }; |
| 441 | 443 | ||
| 442 | /** | 444 | /** |
| @@ -506,6 +508,7 @@ struct station_info { | |||
| 506 | s8 signal; | 508 | s8 signal; |
| 507 | s8 signal_avg; | 509 | s8 signal_avg; |
| 508 | struct rate_info txrate; | 510 | struct rate_info txrate; |
| 511 | struct rate_info rxrate; | ||
| 509 | u32 rx_packets; | 512 | u32 rx_packets; |
| 510 | u32 tx_packets; | 513 | u32 tx_packets; |
| 511 | u32 tx_retries; | 514 | u32 tx_retries; |
| @@ -1194,6 +1197,10 @@ struct cfg80211_pmksa { | |||
| 1194 | * (also see nl80211.h @NL80211_ATTR_WIPHY_ANTENNA_TX). | 1197 | * (also see nl80211.h @NL80211_ATTR_WIPHY_ANTENNA_TX). |
| 1195 | * | 1198 | * |
| 1196 | * @get_antenna: Get current antenna configuration from device (tx_ant, rx_ant). | 1199 | * @get_antenna: Get current antenna configuration from device (tx_ant, rx_ant). |
| 1200 | * | ||
| 1201 | * @set_ringparam: Set tx and rx ring sizes. | ||
| 1202 | * | ||
| 1203 | * @get_ringparam: Get tx and rx ring current and maximum sizes. | ||
| 1197 | */ | 1204 | */ |
| 1198 | struct cfg80211_ops { | 1205 | struct cfg80211_ops { |
| 1199 | int (*suspend)(struct wiphy *wiphy); | 1206 | int (*suspend)(struct wiphy *wiphy); |
| @@ -1361,6 +1368,10 @@ struct cfg80211_ops { | |||
| 1361 | 1368 | ||
| 1362 | int (*set_antenna)(struct wiphy *wiphy, u32 tx_ant, u32 rx_ant); | 1369 | int (*set_antenna)(struct wiphy *wiphy, u32 tx_ant, u32 rx_ant); |
| 1363 | int (*get_antenna)(struct wiphy *wiphy, u32 *tx_ant, u32 *rx_ant); | 1370 | int (*get_antenna)(struct wiphy *wiphy, u32 *tx_ant, u32 *rx_ant); |
| 1371 | |||
| 1372 | int (*set_ringparam)(struct wiphy *wiphy, u32 tx, u32 rx); | ||
| 1373 | void (*get_ringparam)(struct wiphy *wiphy, | ||
| 1374 | u32 *tx, u32 *tx_max, u32 *rx, u32 *rx_max); | ||
| 1364 | }; | 1375 | }; |
| 1365 | 1376 | ||
| 1366 | /* | 1377 | /* |
| @@ -1790,8 +1801,9 @@ static inline void *wdev_priv(struct wireless_dev *wdev) | |||
| 1790 | /** | 1801 | /** |
| 1791 | * ieee80211_channel_to_frequency - convert channel number to frequency | 1802 | * ieee80211_channel_to_frequency - convert channel number to frequency |
| 1792 | * @chan: channel number | 1803 | * @chan: channel number |
| 1804 | * @band: band, necessary due to channel number overlap | ||
| 1793 | */ | 1805 | */ |
| 1794 | extern int ieee80211_channel_to_frequency(int chan); | 1806 | extern int ieee80211_channel_to_frequency(int chan, enum ieee80211_band band); |
| 1795 | 1807 | ||
| 1796 | /** | 1808 | /** |
| 1797 | * ieee80211_frequency_to_channel - convert frequency to channel number | 1809 | * ieee80211_frequency_to_channel - convert frequency to channel number |
diff --git a/include/net/dcbnl.h b/include/net/dcbnl.h index a8e7852b10ab..e5983c9053dc 100644 --- a/include/net/dcbnl.h +++ b/include/net/dcbnl.h | |||
| @@ -43,6 +43,8 @@ struct dcbnl_rtnl_ops { | |||
| 43 | int (*ieee_setpfc) (struct net_device *, struct ieee_pfc *); | 43 | int (*ieee_setpfc) (struct net_device *, struct ieee_pfc *); |
| 44 | int (*ieee_getapp) (struct net_device *, struct dcb_app *); | 44 | int (*ieee_getapp) (struct net_device *, struct dcb_app *); |
| 45 | int (*ieee_setapp) (struct net_device *, struct dcb_app *); | 45 | int (*ieee_setapp) (struct net_device *, struct dcb_app *); |
| 46 | int (*ieee_peer_getets) (struct net_device *, struct ieee_ets *); | ||
| 47 | int (*ieee_peer_getpfc) (struct net_device *, struct ieee_pfc *); | ||
| 46 | 48 | ||
| 47 | /* CEE std */ | 49 | /* CEE std */ |
| 48 | u8 (*getstate)(struct net_device *); | 50 | u8 (*getstate)(struct net_device *); |
| @@ -77,7 +79,14 @@ struct dcbnl_rtnl_ops { | |||
| 77 | u8 (*getdcbx)(struct net_device *); | 79 | u8 (*getdcbx)(struct net_device *); |
| 78 | u8 (*setdcbx)(struct net_device *, u8); | 80 | u8 (*setdcbx)(struct net_device *, u8); |
| 79 | 81 | ||
| 82 | /* peer apps */ | ||
| 83 | int (*peer_getappinfo)(struct net_device *, struct dcb_peer_app_info *, | ||
| 84 | u16 *); | ||
| 85 | int (*peer_getapptable)(struct net_device *, struct dcb_app *); | ||
| 80 | 86 | ||
| 87 | /* CEE peer */ | ||
| 88 | int (*cee_peer_getpg) (struct net_device *, struct cee_pg *); | ||
| 89 | int (*cee_peer_getpfc) (struct net_device *, struct cee_pfc *); | ||
| 81 | }; | 90 | }; |
| 82 | 91 | ||
| 83 | #endif /* __NET_DCBNL_H__ */ | 92 | #endif /* __NET_DCBNL_H__ */ |
diff --git a/include/net/dn.h b/include/net/dn.h index a514a3cf4573..298521e0d8a2 100644 --- a/include/net/dn.h +++ b/include/net/dn.h | |||
| @@ -192,10 +192,10 @@ static inline void dn_dn2eth(unsigned char *ethaddr, __le16 addr) | |||
| 192 | ethaddr[5] = (__u8)(a >> 8); | 192 | ethaddr[5] = (__u8)(a >> 8); |
| 193 | } | 193 | } |
| 194 | 194 | ||
| 195 | static inline void dn_sk_ports_copy(struct flowi *fl, struct dn_scp *scp) | 195 | static inline void dn_sk_ports_copy(struct flowidn *fld, struct dn_scp *scp) |
| 196 | { | 196 | { |
| 197 | fl->uli_u.dnports.sport = scp->addrloc; | 197 | fld->fld_sport = scp->addrloc; |
| 198 | fl->uli_u.dnports.dport = scp->addrrem; | 198 | fld->fld_dport = scp->addrrem; |
| 199 | } | 199 | } |
| 200 | 200 | ||
| 201 | extern unsigned dn_mss_from_pmtu(struct net_device *dev, int mtu); | 201 | extern unsigned dn_mss_from_pmtu(struct net_device *dev, int mtu); |
diff --git a/include/net/dn_fib.h b/include/net/dn_fib.h index bbcde3238e58..782ef7cb4930 100644 --- a/include/net/dn_fib.h +++ b/include/net/dn_fib.h | |||
| @@ -98,7 +98,7 @@ struct dn_fib_table { | |||
| 98 | int (*delete)(struct dn_fib_table *t, struct rtmsg *r, | 98 | int (*delete)(struct dn_fib_table *t, struct rtmsg *r, |
| 99 | struct dn_kern_rta *rta, struct nlmsghdr *n, | 99 | struct dn_kern_rta *rta, struct nlmsghdr *n, |
| 100 | struct netlink_skb_parms *req); | 100 | struct netlink_skb_parms *req); |
| 101 | int (*lookup)(struct dn_fib_table *t, const struct flowi *fl, | 101 | int (*lookup)(struct dn_fib_table *t, const struct flowidn *fld, |
| 102 | struct dn_fib_res *res); | 102 | struct dn_fib_res *res); |
| 103 | int (*flush)(struct dn_fib_table *t); | 103 | int (*flush)(struct dn_fib_table *t); |
| 104 | int (*dump)(struct dn_fib_table *t, struct sk_buff *skb, struct netlink_callback *cb); | 104 | int (*dump)(struct dn_fib_table *t, struct sk_buff *skb, struct netlink_callback *cb); |
| @@ -119,12 +119,12 @@ extern struct dn_fib_info *dn_fib_create_info(const struct rtmsg *r, | |||
| 119 | struct dn_kern_rta *rta, | 119 | struct dn_kern_rta *rta, |
| 120 | const struct nlmsghdr *nlh, int *errp); | 120 | const struct nlmsghdr *nlh, int *errp); |
| 121 | extern int dn_fib_semantic_match(int type, struct dn_fib_info *fi, | 121 | extern int dn_fib_semantic_match(int type, struct dn_fib_info *fi, |
| 122 | const struct flowi *fl, | 122 | const struct flowidn *fld, |
| 123 | struct dn_fib_res *res); | 123 | struct dn_fib_res *res); |
| 124 | extern void dn_fib_release_info(struct dn_fib_info *fi); | 124 | 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); | 125 | extern __le16 dn_fib_get_attr16(struct rtattr *attr, int attrlen, int type); |
| 126 | extern void dn_fib_flush(void); | 126 | extern void dn_fib_flush(void); |
| 127 | extern void dn_fib_select_multipath(const struct flowi *fl, | 127 | extern void dn_fib_select_multipath(const struct flowidn *fld, |
| 128 | struct dn_fib_res *res); | 128 | struct dn_fib_res *res); |
| 129 | 129 | ||
| 130 | /* | 130 | /* |
| @@ -141,7 +141,7 @@ extern void dn_fib_table_cleanup(void); | |||
| 141 | extern void dn_fib_rules_init(void); | 141 | extern void dn_fib_rules_init(void); |
| 142 | extern void dn_fib_rules_cleanup(void); | 142 | extern void dn_fib_rules_cleanup(void); |
| 143 | extern unsigned dnet_addr_type(__le16 addr); | 143 | extern unsigned dnet_addr_type(__le16 addr); |
| 144 | extern int dn_fib_lookup(struct flowi *fl, struct dn_fib_res *res); | 144 | extern int dn_fib_lookup(struct flowidn *fld, struct dn_fib_res *res); |
| 145 | 145 | ||
| 146 | extern int dn_fib_dump(struct sk_buff *skb, struct netlink_callback *cb); | 146 | extern int dn_fib_dump(struct sk_buff *skb, struct netlink_callback *cb); |
| 147 | 147 | ||
diff --git a/include/net/dn_route.h b/include/net/dn_route.h index 9b185df265fb..81712cfa1ddf 100644 --- a/include/net/dn_route.h +++ b/include/net/dn_route.h | |||
| @@ -16,7 +16,7 @@ | |||
| 16 | *******************************************************************************/ | 16 | *******************************************************************************/ |
| 17 | 17 | ||
| 18 | extern struct sk_buff *dn_alloc_skb(struct sock *sk, int size, gfp_t pri); | 18 | extern struct sk_buff *dn_alloc_skb(struct sock *sk, int size, gfp_t pri); |
| 19 | extern int dn_route_output_sock(struct dst_entry **pprt, struct flowi *, struct sock *sk, int flags); | 19 | extern int dn_route_output_sock(struct dst_entry **pprt, struct flowidn *, struct sock *sk, int flags); |
| 20 | extern int dn_cache_dump(struct sk_buff *skb, struct netlink_callback *cb); | 20 | extern int dn_cache_dump(struct sk_buff *skb, struct netlink_callback *cb); |
| 21 | extern void dn_rt_cache_flush(int delay); | 21 | extern void dn_rt_cache_flush(int delay); |
| 22 | 22 | ||
| @@ -67,7 +67,7 @@ extern void dn_rt_cache_flush(int delay); | |||
| 67 | struct dn_route { | 67 | struct dn_route { |
| 68 | struct dst_entry dst; | 68 | struct dst_entry dst; |
| 69 | 69 | ||
| 70 | struct flowi fl; | 70 | struct flowidn fld; |
| 71 | 71 | ||
| 72 | __le16 rt_saddr; | 72 | __le16 rt_saddr; |
| 73 | __le16 rt_daddr; | 73 | __le16 rt_daddr; |
| @@ -82,12 +82,12 @@ struct dn_route { | |||
| 82 | 82 | ||
| 83 | static inline bool dn_is_input_route(struct dn_route *rt) | 83 | static inline bool dn_is_input_route(struct dn_route *rt) |
| 84 | { | 84 | { |
| 85 | return rt->fl.iif != 0; | 85 | return rt->fld.flowidn_iif != 0; |
| 86 | } | 86 | } |
| 87 | 87 | ||
| 88 | static inline bool dn_is_output_route(struct dn_route *rt) | 88 | static inline bool dn_is_output_route(struct dn_route *rt) |
| 89 | { | 89 | { |
| 90 | return rt->fl.iif == 0; | 90 | return rt->fld.flowidn_iif == 0; |
| 91 | } | 91 | } |
| 92 | 92 | ||
| 93 | extern void dn_route_init(void); | 93 | extern void dn_route_init(void); |
diff --git a/include/net/dst.h b/include/net/dst.h index 93b0310317be..2a46cbaef92d 100644 --- a/include/net/dst.h +++ b/include/net/dst.h | |||
| @@ -40,24 +40,10 @@ struct dst_entry { | |||
| 40 | struct rcu_head rcu_head; | 40 | struct rcu_head rcu_head; |
| 41 | struct dst_entry *child; | 41 | struct dst_entry *child; |
| 42 | struct net_device *dev; | 42 | struct net_device *dev; |
| 43 | short error; | 43 | struct dst_ops *ops; |
| 44 | short obsolete; | 44 | unsigned long _metrics; |
| 45 | int flags; | ||
| 46 | #define DST_HOST 0x0001 | ||
| 47 | #define DST_NOXFRM 0x0002 | ||
| 48 | #define DST_NOPOLICY 0x0004 | ||
| 49 | #define DST_NOHASH 0x0008 | ||
| 50 | #define DST_NOCACHE 0x0010 | ||
| 51 | unsigned long expires; | 45 | unsigned long expires; |
| 52 | |||
| 53 | unsigned short header_len; /* more space at head required */ | ||
| 54 | unsigned short trailer_len; /* space to reserve at tail */ | ||
| 55 | |||
| 56 | unsigned int rate_tokens; | ||
| 57 | unsigned long rate_last; /* rate limiting for ICMP */ | ||
| 58 | |||
| 59 | struct dst_entry *path; | 46 | struct dst_entry *path; |
| 60 | |||
| 61 | struct neighbour *neighbour; | 47 | struct neighbour *neighbour; |
| 62 | struct hh_cache *hh; | 48 | struct hh_cache *hh; |
| 63 | #ifdef CONFIG_XFRM | 49 | #ifdef CONFIG_XFRM |
| @@ -68,17 +54,16 @@ struct dst_entry { | |||
| 68 | int (*input)(struct sk_buff*); | 54 | int (*input)(struct sk_buff*); |
| 69 | int (*output)(struct sk_buff*); | 55 | int (*output)(struct sk_buff*); |
| 70 | 56 | ||
| 71 | struct dst_ops *ops; | 57 | short error; |
| 72 | 58 | short obsolete; | |
| 73 | u32 _metrics[RTAX_MAX]; | 59 | unsigned short header_len; /* more space at head required */ |
| 74 | 60 | unsigned short trailer_len; /* space to reserve at tail */ | |
| 75 | #ifdef CONFIG_NET_CLS_ROUTE | 61 | #ifdef CONFIG_IP_ROUTE_CLASSID |
| 76 | __u32 tclassid; | 62 | __u32 tclassid; |
| 77 | #else | 63 | #else |
| 78 | __u32 __pad2; | 64 | __u32 __pad2; |
| 79 | #endif | 65 | #endif |
| 80 | 66 | ||
| 81 | |||
| 82 | /* | 67 | /* |
| 83 | * Align __refcnt to a 64 bytes alignment | 68 | * Align __refcnt to a 64 bytes alignment |
| 84 | * (L1_CACHE_SIZE would be too much) | 69 | * (L1_CACHE_SIZE would be too much) |
| @@ -93,6 +78,12 @@ struct dst_entry { | |||
| 93 | atomic_t __refcnt; /* client references */ | 78 | atomic_t __refcnt; /* client references */ |
| 94 | int __use; | 79 | int __use; |
| 95 | unsigned long lastuse; | 80 | unsigned long lastuse; |
| 81 | int flags; | ||
| 82 | #define DST_HOST 0x0001 | ||
| 83 | #define DST_NOXFRM 0x0002 | ||
| 84 | #define DST_NOPOLICY 0x0004 | ||
| 85 | #define DST_NOHASH 0x0008 | ||
| 86 | #define DST_NOCACHE 0x0010 | ||
| 96 | union { | 87 | union { |
| 97 | struct dst_entry *next; | 88 | struct dst_entry *next; |
| 98 | struct rtable __rcu *rt_next; | 89 | struct rtable __rcu *rt_next; |
| @@ -103,10 +94,70 @@ struct dst_entry { | |||
| 103 | 94 | ||
| 104 | #ifdef __KERNEL__ | 95 | #ifdef __KERNEL__ |
| 105 | 96 | ||
| 97 | extern u32 *dst_cow_metrics_generic(struct dst_entry *dst, unsigned long old); | ||
| 98 | extern const u32 dst_default_metrics[RTAX_MAX]; | ||
| 99 | |||
| 100 | #define DST_METRICS_READ_ONLY 0x1UL | ||
| 101 | #define __DST_METRICS_PTR(Y) \ | ||
| 102 | ((u32 *)((Y) & ~DST_METRICS_READ_ONLY)) | ||
| 103 | #define DST_METRICS_PTR(X) __DST_METRICS_PTR((X)->_metrics) | ||
| 104 | |||
| 105 | static inline bool dst_metrics_read_only(const struct dst_entry *dst) | ||
| 106 | { | ||
| 107 | return dst->_metrics & DST_METRICS_READ_ONLY; | ||
| 108 | } | ||
| 109 | |||
| 110 | extern void __dst_destroy_metrics_generic(struct dst_entry *dst, unsigned long old); | ||
| 111 | |||
| 112 | static inline void dst_destroy_metrics_generic(struct dst_entry *dst) | ||
| 113 | { | ||
| 114 | unsigned long val = dst->_metrics; | ||
| 115 | if (!(val & DST_METRICS_READ_ONLY)) | ||
| 116 | __dst_destroy_metrics_generic(dst, val); | ||
| 117 | } | ||
| 118 | |||
| 119 | static inline u32 *dst_metrics_write_ptr(struct dst_entry *dst) | ||
| 120 | { | ||
| 121 | unsigned long p = dst->_metrics; | ||
| 122 | |||
| 123 | if (p & DST_METRICS_READ_ONLY) | ||
| 124 | return dst->ops->cow_metrics(dst, p); | ||
| 125 | return __DST_METRICS_PTR(p); | ||
| 126 | } | ||
| 127 | |||
| 128 | /* This may only be invoked before the entry has reached global | ||
| 129 | * visibility. | ||
| 130 | */ | ||
| 131 | static inline void dst_init_metrics(struct dst_entry *dst, | ||
| 132 | const u32 *src_metrics, | ||
| 133 | bool read_only) | ||
| 134 | { | ||
| 135 | dst->_metrics = ((unsigned long) src_metrics) | | ||
| 136 | (read_only ? DST_METRICS_READ_ONLY : 0); | ||
| 137 | } | ||
| 138 | |||
| 139 | static inline void dst_copy_metrics(struct dst_entry *dest, const struct dst_entry *src) | ||
| 140 | { | ||
| 141 | u32 *dst_metrics = dst_metrics_write_ptr(dest); | ||
| 142 | |||
| 143 | if (dst_metrics) { | ||
| 144 | u32 *src_metrics = DST_METRICS_PTR(src); | ||
| 145 | |||
| 146 | memcpy(dst_metrics, src_metrics, RTAX_MAX * sizeof(u32)); | ||
| 147 | } | ||
| 148 | } | ||
| 149 | |||
| 150 | static inline u32 *dst_metrics_ptr(struct dst_entry *dst) | ||
| 151 | { | ||
| 152 | return DST_METRICS_PTR(dst); | ||
| 153 | } | ||
| 154 | |||
| 106 | static inline u32 | 155 | static inline u32 |
| 107 | dst_metric_raw(const struct dst_entry *dst, const int metric) | 156 | dst_metric_raw(const struct dst_entry *dst, const int metric) |
| 108 | { | 157 | { |
| 109 | return dst->_metrics[metric-1]; | 158 | u32 *p = DST_METRICS_PTR(dst); |
| 159 | |||
| 160 | return p[metric-1]; | ||
| 110 | } | 161 | } |
| 111 | 162 | ||
| 112 | static inline u32 | 163 | static inline u32 |
| @@ -131,22 +182,10 @@ dst_metric_advmss(const struct dst_entry *dst) | |||
| 131 | 182 | ||
| 132 | static inline void dst_metric_set(struct dst_entry *dst, int metric, u32 val) | 183 | static inline void dst_metric_set(struct dst_entry *dst, int metric, u32 val) |
| 133 | { | 184 | { |
| 134 | dst->_metrics[metric-1] = val; | 185 | u32 *p = dst_metrics_write_ptr(dst); |
| 135 | } | ||
| 136 | 186 | ||
| 137 | static inline void dst_import_metrics(struct dst_entry *dst, const u32 *src_metrics) | 187 | if (p) |
| 138 | { | 188 | p[metric-1] = val; |
| 139 | memcpy(dst->_metrics, src_metrics, RTAX_MAX * sizeof(u32)); | ||
| 140 | } | ||
| 141 | |||
| 142 | static inline void dst_copy_metrics(struct dst_entry *dest, const struct dst_entry *src) | ||
| 143 | { | ||
| 144 | dst_import_metrics(dest, src->_metrics); | ||
| 145 | } | ||
| 146 | |||
| 147 | static inline u32 *dst_metrics_ptr(struct dst_entry *dst) | ||
| 148 | { | ||
| 149 | return dst->_metrics; | ||
| 150 | } | 189 | } |
| 151 | 190 | ||
| 152 | static inline u32 | 191 | static inline u32 |
| @@ -181,8 +220,6 @@ static inline u32 | |||
| 181 | dst_allfrag(const struct dst_entry *dst) | 220 | dst_allfrag(const struct dst_entry *dst) |
| 182 | { | 221 | { |
| 183 | int ret = dst_feature(dst, RTAX_FEATURE_ALLFRAG); | 222 | int ret = dst_feature(dst, RTAX_FEATURE_ALLFRAG); |
| 184 | /* Yes, _exactly_. This is paranoia. */ | ||
| 185 | barrier(); | ||
| 186 | return ret; | 223 | return ret; |
| 187 | } | 224 | } |
| 188 | 225 | ||
| @@ -315,7 +352,7 @@ static inline struct dst_entry *skb_dst_pop(struct sk_buff *skb) | |||
| 315 | } | 352 | } |
| 316 | 353 | ||
| 317 | extern int dst_discard(struct sk_buff *skb); | 354 | extern int dst_discard(struct sk_buff *skb); |
| 318 | extern void * dst_alloc(struct dst_ops * ops); | 355 | extern void *dst_alloc(struct dst_ops * ops, int initial_ref); |
| 319 | extern void __dst_free(struct dst_entry * dst); | 356 | extern void __dst_free(struct dst_entry * dst); |
| 320 | extern struct dst_entry *dst_destroy(struct dst_entry * dst); | 357 | extern struct dst_entry *dst_destroy(struct dst_entry * dst); |
| 321 | 358 | ||
| @@ -384,27 +421,22 @@ extern void dst_init(void); | |||
| 384 | 421 | ||
| 385 | /* Flags for xfrm_lookup flags argument. */ | 422 | /* Flags for xfrm_lookup flags argument. */ |
| 386 | enum { | 423 | enum { |
| 387 | XFRM_LOOKUP_WAIT = 1 << 0, | 424 | XFRM_LOOKUP_ICMP = 1 << 0, |
| 388 | XFRM_LOOKUP_ICMP = 1 << 1, | ||
| 389 | }; | 425 | }; |
| 390 | 426 | ||
| 391 | struct flowi; | 427 | struct flowi; |
| 392 | #ifndef CONFIG_XFRM | 428 | #ifndef CONFIG_XFRM |
| 393 | static inline int xfrm_lookup(struct net *net, struct dst_entry **dst_p, | 429 | static inline struct dst_entry *xfrm_lookup(struct net *net, |
| 394 | struct flowi *fl, struct sock *sk, int flags) | 430 | struct dst_entry *dst_orig, |
| 431 | const struct flowi *fl, struct sock *sk, | ||
| 432 | int flags) | ||
| 395 | { | 433 | { |
| 396 | return 0; | 434 | return dst_orig; |
| 397 | } | 435 | } |
| 398 | static inline int __xfrm_lookup(struct net *net, struct dst_entry **dst_p, | ||
| 399 | struct flowi *fl, struct sock *sk, int flags) | ||
| 400 | { | ||
| 401 | return 0; | ||
| 402 | } | ||
| 403 | #else | 436 | #else |
| 404 | extern int xfrm_lookup(struct net *net, struct dst_entry **dst_p, | 437 | extern struct dst_entry *xfrm_lookup(struct net *net, struct dst_entry *dst_orig, |
| 405 | struct flowi *fl, struct sock *sk, int flags); | 438 | const struct flowi *fl, struct sock *sk, |
| 406 | extern int __xfrm_lookup(struct net *net, struct dst_entry **dst_p, | 439 | int flags); |
| 407 | struct flowi *fl, struct sock *sk, int flags); | ||
| 408 | #endif | 440 | #endif |
| 409 | #endif | 441 | #endif |
| 410 | 442 | ||
diff --git a/include/net/dst_ops.h b/include/net/dst_ops.h index 21a320b8708e..dc0746328947 100644 --- a/include/net/dst_ops.h +++ b/include/net/dst_ops.h | |||
| @@ -18,6 +18,7 @@ struct dst_ops { | |||
| 18 | struct dst_entry * (*check)(struct dst_entry *, __u32 cookie); | 18 | struct dst_entry * (*check)(struct dst_entry *, __u32 cookie); |
| 19 | unsigned int (*default_advmss)(const struct dst_entry *); | 19 | unsigned int (*default_advmss)(const struct dst_entry *); |
| 20 | unsigned int (*default_mtu)(const struct dst_entry *); | 20 | unsigned int (*default_mtu)(const struct dst_entry *); |
| 21 | u32 * (*cow_metrics)(struct dst_entry *, unsigned long); | ||
| 21 | void (*destroy)(struct dst_entry *); | 22 | void (*destroy)(struct dst_entry *); |
| 22 | void (*ifdown)(struct dst_entry *, | 23 | void (*ifdown)(struct dst_entry *, |
| 23 | struct net_device *dev, int how); | 24 | struct net_device *dev, int how); |
diff --git a/include/net/flow.h b/include/net/flow.h index 240b7f356c71..7fe5a0f9483a 100644 --- a/include/net/flow.h +++ b/include/net/flow.h | |||
| @@ -10,78 +10,136 @@ | |||
| 10 | #include <linux/in6.h> | 10 | #include <linux/in6.h> |
| 11 | #include <asm/atomic.h> | 11 | #include <asm/atomic.h> |
| 12 | 12 | ||
| 13 | struct flowi { | 13 | struct flowi_common { |
| 14 | int oif; | 14 | int flowic_oif; |
| 15 | int iif; | 15 | int flowic_iif; |
| 16 | __u32 mark; | 16 | __u32 flowic_mark; |
| 17 | __u8 flowic_tos; | ||
| 18 | __u8 flowic_scope; | ||
| 19 | __u8 flowic_proto; | ||
| 20 | __u8 flowic_flags; | ||
| 21 | #define FLOWI_FLAG_ANYSRC 0x01 | ||
| 22 | #define FLOWI_FLAG_PRECOW_METRICS 0x02 | ||
| 23 | #define FLOWI_FLAG_CAN_SLEEP 0x04 | ||
| 24 | __u32 flowic_secid; | ||
| 25 | }; | ||
| 17 | 26 | ||
| 27 | union flowi_uli { | ||
| 28 | struct { | ||
| 29 | __be16 sport; | ||
| 30 | __be16 dport; | ||
| 31 | } ports; | ||
| 32 | |||
| 33 | struct { | ||
| 34 | __u8 type; | ||
| 35 | __u8 code; | ||
| 36 | } icmpt; | ||
| 37 | |||
| 38 | struct { | ||
| 39 | __le16 sport; | ||
| 40 | __le16 dport; | ||
| 41 | } dnports; | ||
| 42 | |||
| 43 | __be32 spi; | ||
| 44 | __be32 gre_key; | ||
| 45 | |||
| 46 | struct { | ||
| 47 | __u8 type; | ||
| 48 | } mht; | ||
| 49 | }; | ||
| 50 | |||
| 51 | struct flowi4 { | ||
| 52 | struct flowi_common __fl_common; | ||
| 53 | #define flowi4_oif __fl_common.flowic_oif | ||
| 54 | #define flowi4_iif __fl_common.flowic_iif | ||
| 55 | #define flowi4_mark __fl_common.flowic_mark | ||
| 56 | #define flowi4_tos __fl_common.flowic_tos | ||
| 57 | #define flowi4_scope __fl_common.flowic_scope | ||
| 58 | #define flowi4_proto __fl_common.flowic_proto | ||
| 59 | #define flowi4_flags __fl_common.flowic_flags | ||
| 60 | #define flowi4_secid __fl_common.flowic_secid | ||
| 61 | __be32 daddr; | ||
| 62 | __be32 saddr; | ||
| 63 | union flowi_uli uli; | ||
| 64 | #define fl4_sport uli.ports.sport | ||
| 65 | #define fl4_dport uli.ports.dport | ||
| 66 | #define fl4_icmp_type uli.icmpt.type | ||
| 67 | #define fl4_icmp_code uli.icmpt.code | ||
| 68 | #define fl4_ipsec_spi uli.spi | ||
| 69 | #define fl4_mh_type uli.mht.type | ||
| 70 | #define fl4_gre_key uli.gre_key | ||
| 71 | }; | ||
| 72 | |||
| 73 | struct flowi6 { | ||
| 74 | struct flowi_common __fl_common; | ||
| 75 | #define flowi6_oif __fl_common.flowic_oif | ||
| 76 | #define flowi6_iif __fl_common.flowic_iif | ||
| 77 | #define flowi6_mark __fl_common.flowic_mark | ||
| 78 | #define flowi6_tos __fl_common.flowic_tos | ||
| 79 | #define flowi6_scope __fl_common.flowic_scope | ||
| 80 | #define flowi6_proto __fl_common.flowic_proto | ||
| 81 | #define flowi6_flags __fl_common.flowic_flags | ||
| 82 | #define flowi6_secid __fl_common.flowic_secid | ||
| 83 | struct in6_addr daddr; | ||
| 84 | struct in6_addr saddr; | ||
| 85 | __be32 flowlabel; | ||
| 86 | union flowi_uli uli; | ||
| 87 | #define fl6_sport uli.ports.sport | ||
| 88 | #define fl6_dport uli.ports.dport | ||
| 89 | #define fl6_icmp_type uli.icmpt.type | ||
| 90 | #define fl6_icmp_code uli.icmpt.code | ||
| 91 | #define fl6_ipsec_spi uli.spi | ||
| 92 | #define fl6_mh_type uli.mht.type | ||
| 93 | #define fl6_gre_key uli.gre_key | ||
| 94 | }; | ||
| 95 | |||
| 96 | struct flowidn { | ||
| 97 | struct flowi_common __fl_common; | ||
| 98 | #define flowidn_oif __fl_common.flowic_oif | ||
| 99 | #define flowidn_iif __fl_common.flowic_iif | ||
| 100 | #define flowidn_mark __fl_common.flowic_mark | ||
| 101 | #define flowidn_scope __fl_common.flowic_scope | ||
| 102 | #define flowidn_proto __fl_common.flowic_proto | ||
| 103 | #define flowidn_flags __fl_common.flowic_flags | ||
| 104 | __le16 daddr; | ||
| 105 | __le16 saddr; | ||
| 106 | union flowi_uli uli; | ||
| 107 | #define fld_sport uli.ports.sport | ||
| 108 | #define fld_dport uli.ports.dport | ||
| 109 | }; | ||
| 110 | |||
| 111 | struct flowi { | ||
| 18 | union { | 112 | union { |
| 19 | struct { | 113 | struct flowi_common __fl_common; |
| 20 | __be32 daddr; | 114 | struct flowi4 ip4; |
| 21 | __be32 saddr; | 115 | struct flowi6 ip6; |
| 22 | __u8 tos; | 116 | struct flowidn dn; |
| 23 | __u8 scope; | 117 | } u; |
| 24 | } ip4_u; | 118 | #define flowi_oif u.__fl_common.flowic_oif |
| 25 | 119 | #define flowi_iif u.__fl_common.flowic_iif | |
| 26 | struct { | 120 | #define flowi_mark u.__fl_common.flowic_mark |
| 27 | struct in6_addr daddr; | 121 | #define flowi_tos u.__fl_common.flowic_tos |
| 28 | struct in6_addr saddr; | 122 | #define flowi_scope u.__fl_common.flowic_scope |
| 29 | __be32 flowlabel; | 123 | #define flowi_proto u.__fl_common.flowic_proto |
| 30 | } ip6_u; | 124 | #define flowi_flags u.__fl_common.flowic_flags |
| 31 | 125 | #define flowi_secid u.__fl_common.flowic_secid | |
| 32 | struct { | ||
| 33 | __le16 daddr; | ||
| 34 | __le16 saddr; | ||
| 35 | __u8 scope; | ||
| 36 | } dn_u; | ||
| 37 | } nl_u; | ||
| 38 | #define fld_dst nl_u.dn_u.daddr | ||
| 39 | #define fld_src nl_u.dn_u.saddr | ||
| 40 | #define fld_scope nl_u.dn_u.scope | ||
| 41 | #define fl6_dst nl_u.ip6_u.daddr | ||
| 42 | #define fl6_src nl_u.ip6_u.saddr | ||
| 43 | #define fl6_flowlabel nl_u.ip6_u.flowlabel | ||
| 44 | #define fl4_dst nl_u.ip4_u.daddr | ||
| 45 | #define fl4_src nl_u.ip4_u.saddr | ||
| 46 | #define fl4_tos nl_u.ip4_u.tos | ||
| 47 | #define fl4_scope nl_u.ip4_u.scope | ||
| 48 | |||
| 49 | __u8 proto; | ||
| 50 | __u8 flags; | ||
| 51 | #define FLOWI_FLAG_ANYSRC 0x01 | ||
| 52 | union { | ||
| 53 | struct { | ||
| 54 | __be16 sport; | ||
| 55 | __be16 dport; | ||
| 56 | } ports; | ||
| 57 | |||
| 58 | struct { | ||
| 59 | __u8 type; | ||
| 60 | __u8 code; | ||
| 61 | } icmpt; | ||
| 62 | |||
| 63 | struct { | ||
| 64 | __le16 sport; | ||
| 65 | __le16 dport; | ||
| 66 | } dnports; | ||
| 67 | |||
| 68 | __be32 spi; | ||
| 69 | __be32 gre_key; | ||
| 70 | |||
| 71 | struct { | ||
| 72 | __u8 type; | ||
| 73 | } mht; | ||
| 74 | } uli_u; | ||
| 75 | #define fl_ip_sport uli_u.ports.sport | ||
| 76 | #define fl_ip_dport uli_u.ports.dport | ||
| 77 | #define fl_icmp_type uli_u.icmpt.type | ||
| 78 | #define fl_icmp_code uli_u.icmpt.code | ||
| 79 | #define fl_ipsec_spi uli_u.spi | ||
| 80 | #define fl_mh_type uli_u.mht.type | ||
| 81 | #define fl_gre_key uli_u.gre_key | ||
| 82 | __u32 secid; /* used by xfrm; see secid.txt */ | ||
| 83 | } __attribute__((__aligned__(BITS_PER_LONG/8))); | 126 | } __attribute__((__aligned__(BITS_PER_LONG/8))); |
| 84 | 127 | ||
| 128 | static inline struct flowi *flowi4_to_flowi(struct flowi4 *fl4) | ||
| 129 | { | ||
| 130 | return container_of(fl4, struct flowi, u.ip4); | ||
| 131 | } | ||
| 132 | |||
| 133 | static inline struct flowi *flowi6_to_flowi(struct flowi6 *fl6) | ||
| 134 | { | ||
| 135 | return container_of(fl6, struct flowi, u.ip6); | ||
| 136 | } | ||
| 137 | |||
| 138 | static inline struct flowi *flowidn_to_flowi(struct flowidn *fldn) | ||
| 139 | { | ||
| 140 | return container_of(fldn, struct flowi, u.dn); | ||
| 141 | } | ||
| 142 | |||
| 85 | #define FLOW_DIR_IN 0 | 143 | #define FLOW_DIR_IN 0 |
| 86 | #define FLOW_DIR_OUT 1 | 144 | #define FLOW_DIR_OUT 1 |
| 87 | #define FLOW_DIR_FWD 2 | 145 | #define FLOW_DIR_FWD 2 |
| @@ -101,20 +159,14 @@ struct flow_cache_ops { | |||
| 101 | }; | 159 | }; |
| 102 | 160 | ||
| 103 | typedef struct flow_cache_object *(*flow_resolve_t)( | 161 | typedef struct flow_cache_object *(*flow_resolve_t)( |
| 104 | struct net *net, struct flowi *key, u16 family, | 162 | struct net *net, const struct flowi *key, u16 family, |
| 105 | u8 dir, struct flow_cache_object *oldobj, void *ctx); | 163 | u8 dir, struct flow_cache_object *oldobj, void *ctx); |
| 106 | 164 | ||
| 107 | extern struct flow_cache_object *flow_cache_lookup( | 165 | extern struct flow_cache_object *flow_cache_lookup( |
| 108 | struct net *net, struct flowi *key, u16 family, | 166 | struct net *net, const struct flowi *key, u16 family, |
| 109 | u8 dir, flow_resolve_t resolver, void *ctx); | 167 | u8 dir, flow_resolve_t resolver, void *ctx); |
| 110 | 168 | ||
| 111 | extern void flow_cache_flush(void); | 169 | extern void flow_cache_flush(void); |
| 112 | extern atomic_t flow_cache_genid; | 170 | extern atomic_t flow_cache_genid; |
| 113 | 171 | ||
| 114 | static inline int flow_cache_uli_match(struct flowi *fl1, struct flowi *fl2) | ||
| 115 | { | ||
| 116 | return (fl1->proto == fl2->proto && | ||
| 117 | !memcmp(&fl1->uli_u, &fl2->uli_u, sizeof(fl1->uli_u))); | ||
| 118 | } | ||
| 119 | |||
| 120 | #endif | 172 | #endif |
diff --git a/include/net/icmp.h b/include/net/icmp.h index 6e991e0d0d6f..f0698b955b73 100644 --- a/include/net/icmp.h +++ b/include/net/icmp.h | |||
| @@ -45,7 +45,4 @@ extern int icmp_ioctl(struct sock *sk, int cmd, unsigned long arg); | |||
| 45 | extern int icmp_init(void); | 45 | extern int icmp_init(void); |
| 46 | extern void icmp_out_count(struct net *net, unsigned char type); | 46 | extern void icmp_out_count(struct net *net, unsigned char type); |
| 47 | 47 | ||
| 48 | /* Move into dst.h ? */ | ||
| 49 | extern int xrlim_allow(struct dst_entry *dst, int timeout); | ||
| 50 | |||
| 51 | #endif /* _ICMP_H */ | 48 | #endif /* _ICMP_H */ |
diff --git a/include/net/ieee80211_radiotap.h b/include/net/ieee80211_radiotap.h index af49f8ab7f81..b0be5fb9de19 100644 --- a/include/net/ieee80211_radiotap.h +++ b/include/net/ieee80211_radiotap.h | |||
| @@ -178,6 +178,11 @@ struct ieee80211_radiotap_header { | |||
| 178 | * | 178 | * |
| 179 | * Number of unicast retries a transmitted frame used. | 179 | * Number of unicast retries a transmitted frame used. |
| 180 | * | 180 | * |
| 181 | * IEEE80211_RADIOTAP_MCS u8, u8, u8 unitless | ||
| 182 | * | ||
| 183 | * Contains a bitmap of known fields/flags, the flags, and | ||
| 184 | * the MCS index. | ||
| 185 | * | ||
| 181 | */ | 186 | */ |
| 182 | enum ieee80211_radiotap_type { | 187 | enum ieee80211_radiotap_type { |
| 183 | IEEE80211_RADIOTAP_TSFT = 0, | 188 | IEEE80211_RADIOTAP_TSFT = 0, |
| @@ -199,6 +204,8 @@ enum ieee80211_radiotap_type { | |||
| 199 | IEEE80211_RADIOTAP_RTS_RETRIES = 16, | 204 | IEEE80211_RADIOTAP_RTS_RETRIES = 16, |
| 200 | IEEE80211_RADIOTAP_DATA_RETRIES = 17, | 205 | IEEE80211_RADIOTAP_DATA_RETRIES = 17, |
| 201 | 206 | ||
| 207 | IEEE80211_RADIOTAP_MCS = 19, | ||
| 208 | |||
| 202 | /* valid in every it_present bitmap, even vendor namespaces */ | 209 | /* valid in every it_present bitmap, even vendor namespaces */ |
| 203 | IEEE80211_RADIOTAP_RADIOTAP_NAMESPACE = 29, | 210 | IEEE80211_RADIOTAP_RADIOTAP_NAMESPACE = 29, |
| 204 | IEEE80211_RADIOTAP_VENDOR_NAMESPACE = 30, | 211 | IEEE80211_RADIOTAP_VENDOR_NAMESPACE = 30, |
| @@ -245,6 +252,24 @@ enum ieee80211_radiotap_type { | |||
| 245 | #define IEEE80211_RADIOTAP_F_TX_CTS 0x0002 /* used cts 'protection' */ | 252 | #define IEEE80211_RADIOTAP_F_TX_CTS 0x0002 /* used cts 'protection' */ |
| 246 | #define IEEE80211_RADIOTAP_F_TX_RTS 0x0004 /* used rts/cts handshake */ | 253 | #define IEEE80211_RADIOTAP_F_TX_RTS 0x0004 /* used rts/cts handshake */ |
| 247 | 254 | ||
| 255 | |||
| 256 | /* For IEEE80211_RADIOTAP_MCS */ | ||
| 257 | #define IEEE80211_RADIOTAP_MCS_HAVE_BW 0x01 | ||
| 258 | #define IEEE80211_RADIOTAP_MCS_HAVE_MCS 0x02 | ||
| 259 | #define IEEE80211_RADIOTAP_MCS_HAVE_GI 0x04 | ||
| 260 | #define IEEE80211_RADIOTAP_MCS_HAVE_FMT 0x08 | ||
| 261 | #define IEEE80211_RADIOTAP_MCS_HAVE_FEC 0x10 | ||
| 262 | |||
| 263 | #define IEEE80211_RADIOTAP_MCS_BW_MASK 0x03 | ||
| 264 | #define IEEE80211_RADIOTAP_MCS_BW_20 0 | ||
| 265 | #define IEEE80211_RADIOTAP_MCS_BW_40 1 | ||
| 266 | #define IEEE80211_RADIOTAP_MCS_BW_20L 2 | ||
| 267 | #define IEEE80211_RADIOTAP_MCS_BW_20U 3 | ||
| 268 | #define IEEE80211_RADIOTAP_MCS_SGI 0x04 | ||
| 269 | #define IEEE80211_RADIOTAP_MCS_FMT_GF 0x08 | ||
| 270 | #define IEEE80211_RADIOTAP_MCS_FEC_LDPC 0x10 | ||
| 271 | |||
| 272 | |||
| 248 | /* Ugly macro to convert literal channel numbers into their mhz equivalents | 273 | /* Ugly macro to convert literal channel numbers into their mhz equivalents |
| 249 | * There are certianly some conditions that will break this (like feeding it '30') | 274 | * There are certianly some conditions that will break this (like feeding it '30') |
| 250 | * but they shouldn't arise since nothing talks on channel 30. */ | 275 | * but they shouldn't arise since nothing talks on channel 30. */ |
diff --git a/include/net/inet_sock.h b/include/net/inet_sock.h index 8181498fa96c..7a37369f8ea3 100644 --- a/include/net/inet_sock.h +++ b/include/net/inet_sock.h | |||
| @@ -86,6 +86,19 @@ static inline struct inet_request_sock *inet_rsk(const struct request_sock *sk) | |||
| 86 | return (struct inet_request_sock *)sk; | 86 | return (struct inet_request_sock *)sk; |
| 87 | } | 87 | } |
| 88 | 88 | ||
| 89 | struct inet_cork { | ||
| 90 | unsigned int flags; | ||
| 91 | unsigned int fragsize; | ||
| 92 | struct ip_options *opt; | ||
| 93 | struct dst_entry *dst; | ||
| 94 | int length; /* Total length of all frames */ | ||
| 95 | __be32 addr; | ||
| 96 | struct flowi fl; | ||
| 97 | struct page *page; | ||
| 98 | u32 off; | ||
| 99 | u8 tx_flags; | ||
| 100 | }; | ||
| 101 | |||
| 89 | struct ip_mc_socklist; | 102 | struct ip_mc_socklist; |
| 90 | struct ipv6_pinfo; | 103 | struct ipv6_pinfo; |
| 91 | struct rtable; | 104 | struct rtable; |
| @@ -143,15 +156,7 @@ struct inet_sock { | |||
| 143 | int mc_index; | 156 | int mc_index; |
| 144 | __be32 mc_addr; | 157 | __be32 mc_addr; |
| 145 | struct ip_mc_socklist __rcu *mc_list; | 158 | struct ip_mc_socklist __rcu *mc_list; |
| 146 | struct { | 159 | struct inet_cork cork; |
| 147 | unsigned int flags; | ||
| 148 | unsigned int fragsize; | ||
| 149 | struct ip_options *opt; | ||
| 150 | struct dst_entry *dst; | ||
| 151 | int length; /* Total length of all frames */ | ||
| 152 | __be32 addr; | ||
| 153 | struct flowi fl; | ||
| 154 | } cork; | ||
| 155 | }; | 160 | }; |
| 156 | 161 | ||
| 157 | #define IPCORK_OPT 1 /* ip-options has been held in ipcork.opt */ | 162 | #define IPCORK_OPT 1 /* ip-options has been held in ipcork.opt */ |
| @@ -219,7 +224,13 @@ static inline struct request_sock *inet_reqsk_alloc(struct request_sock_ops *ops | |||
| 219 | 224 | ||
| 220 | static inline __u8 inet_sk_flowi_flags(const struct sock *sk) | 225 | static inline __u8 inet_sk_flowi_flags(const struct sock *sk) |
| 221 | { | 226 | { |
| 222 | return inet_sk(sk)->transparent ? FLOWI_FLAG_ANYSRC : 0; | 227 | __u8 flags = 0; |
| 228 | |||
| 229 | if (inet_sk(sk)->transparent) | ||
| 230 | flags |= FLOWI_FLAG_ANYSRC; | ||
| 231 | if (sk->sk_protocol == IPPROTO_TCP) | ||
| 232 | flags |= FLOWI_FLAG_PRECOW_METRICS; | ||
| 233 | return flags; | ||
| 223 | } | 234 | } |
| 224 | 235 | ||
| 225 | #endif /* _INET_SOCK_H */ | 236 | #endif /* _INET_SOCK_H */ |
diff --git a/include/net/inetpeer.h b/include/net/inetpeer.h index 599d96e74114..e6dd8da6b2ad 100644 --- a/include/net/inetpeer.h +++ b/include/net/inetpeer.h | |||
| @@ -11,15 +11,20 @@ | |||
| 11 | #include <linux/init.h> | 11 | #include <linux/init.h> |
| 12 | #include <linux/jiffies.h> | 12 | #include <linux/jiffies.h> |
| 13 | #include <linux/spinlock.h> | 13 | #include <linux/spinlock.h> |
| 14 | #include <linux/rtnetlink.h> | ||
| 14 | #include <net/ipv6.h> | 15 | #include <net/ipv6.h> |
| 15 | #include <asm/atomic.h> | 16 | #include <asm/atomic.h> |
| 16 | 17 | ||
| 17 | struct inetpeer_addr { | 18 | struct inetpeer_addr_base { |
| 18 | union { | 19 | union { |
| 19 | __be32 a4; | 20 | __be32 a4; |
| 20 | __be32 a6[4]; | 21 | __be32 a6[4]; |
| 21 | }; | 22 | }; |
| 22 | __u16 family; | 23 | }; |
| 24 | |||
| 25 | struct inetpeer_addr { | ||
| 26 | struct inetpeer_addr_base addr; | ||
| 27 | __u16 family; | ||
| 23 | }; | 28 | }; |
| 24 | 29 | ||
| 25 | struct inet_peer { | 30 | struct inet_peer { |
| @@ -33,15 +38,22 @@ struct inet_peer { | |||
| 33 | atomic_t refcnt; | 38 | atomic_t refcnt; |
| 34 | /* | 39 | /* |
| 35 | * Once inet_peer is queued for deletion (refcnt == -1), following fields | 40 | * Once inet_peer is queued for deletion (refcnt == -1), following fields |
| 36 | * are not available: rid, ip_id_count, tcp_ts, tcp_ts_stamp | 41 | * are not available: rid, ip_id_count, tcp_ts, tcp_ts_stamp, metrics |
| 37 | * We can share memory with rcu_head to keep inet_peer small | 42 | * We can share memory with rcu_head to help keep inet_peer small. |
| 38 | */ | 43 | */ |
| 39 | union { | 44 | union { |
| 40 | struct { | 45 | struct { |
| 41 | atomic_t rid; /* Frag reception counter */ | 46 | atomic_t rid; /* Frag reception counter */ |
| 42 | atomic_t ip_id_count; /* IP ID for the next packet */ | 47 | atomic_t ip_id_count; /* IP ID for the next packet */ |
| 43 | __u32 tcp_ts; | 48 | __u32 tcp_ts; |
| 44 | __u32 tcp_ts_stamp; | 49 | __u32 tcp_ts_stamp; |
| 50 | u32 metrics[RTAX_MAX]; | ||
| 51 | u32 rate_tokens; /* rate limiting for ICMP */ | ||
| 52 | unsigned long rate_last; | ||
| 53 | unsigned long pmtu_expires; | ||
| 54 | u32 pmtu_orig; | ||
| 55 | u32 pmtu_learned; | ||
| 56 | struct inetpeer_addr_base redirect_learned; | ||
| 45 | }; | 57 | }; |
| 46 | struct rcu_head rcu; | 58 | struct rcu_head rcu; |
| 47 | }; | 59 | }; |
| @@ -49,6 +61,13 @@ struct inet_peer { | |||
| 49 | 61 | ||
| 50 | void inet_initpeers(void) __init; | 62 | void inet_initpeers(void) __init; |
| 51 | 63 | ||
| 64 | #define INETPEER_METRICS_NEW (~(u32) 0) | ||
| 65 | |||
| 66 | static inline bool inet_metrics_new(const struct inet_peer *p) | ||
| 67 | { | ||
| 68 | return p->metrics[RTAX_LOCK-1] == INETPEER_METRICS_NEW; | ||
| 69 | } | ||
| 70 | |||
| 52 | /* can be called with or without local BH being disabled */ | 71 | /* can be called with or without local BH being disabled */ |
| 53 | struct inet_peer *inet_getpeer(struct inetpeer_addr *daddr, int create); | 72 | struct inet_peer *inet_getpeer(struct inetpeer_addr *daddr, int create); |
| 54 | 73 | ||
| @@ -56,7 +75,7 @@ static inline struct inet_peer *inet_getpeer_v4(__be32 v4daddr, int create) | |||
| 56 | { | 75 | { |
| 57 | struct inetpeer_addr daddr; | 76 | struct inetpeer_addr daddr; |
| 58 | 77 | ||
| 59 | daddr.a4 = v4daddr; | 78 | daddr.addr.a4 = v4daddr; |
| 60 | daddr.family = AF_INET; | 79 | daddr.family = AF_INET; |
| 61 | return inet_getpeer(&daddr, create); | 80 | return inet_getpeer(&daddr, create); |
| 62 | } | 81 | } |
| @@ -65,13 +84,14 @@ static inline struct inet_peer *inet_getpeer_v6(struct in6_addr *v6daddr, int cr | |||
| 65 | { | 84 | { |
| 66 | struct inetpeer_addr daddr; | 85 | struct inetpeer_addr daddr; |
| 67 | 86 | ||
| 68 | ipv6_addr_copy((struct in6_addr *)daddr.a6, v6daddr); | 87 | ipv6_addr_copy((struct in6_addr *)daddr.addr.a6, v6daddr); |
| 69 | daddr.family = AF_INET6; | 88 | daddr.family = AF_INET6; |
| 70 | return inet_getpeer(&daddr, create); | 89 | return inet_getpeer(&daddr, create); |
| 71 | } | 90 | } |
| 72 | 91 | ||
| 73 | /* can be called from BH context or outside */ | 92 | /* can be called from BH context or outside */ |
| 74 | extern void inet_putpeer(struct inet_peer *p); | 93 | extern void inet_putpeer(struct inet_peer *p); |
| 94 | extern bool inet_peer_xrlim_allow(struct inet_peer *peer, int timeout); | ||
| 75 | 95 | ||
| 76 | /* | 96 | /* |
| 77 | * temporary check to make sure we dont access rid, ip_id_count, tcp_ts, | 97 | * temporary check to make sure we dont access rid, ip_id_count, tcp_ts, |
diff --git a/include/net/ip.h b/include/net/ip.h index 67fac78a186b..a4f631108c54 100644 --- a/include/net/ip.h +++ b/include/net/ip.h | |||
| @@ -116,8 +116,24 @@ extern int ip_append_data(struct sock *sk, | |||
| 116 | extern int ip_generic_getfrag(void *from, char *to, int offset, int len, int odd, struct sk_buff *skb); | 116 | extern int ip_generic_getfrag(void *from, char *to, int offset, int len, int odd, struct sk_buff *skb); |
| 117 | extern ssize_t ip_append_page(struct sock *sk, struct page *page, | 117 | extern ssize_t ip_append_page(struct sock *sk, struct page *page, |
| 118 | int offset, size_t size, int flags); | 118 | int offset, size_t size, int flags); |
| 119 | extern struct sk_buff *__ip_make_skb(struct sock *sk, | ||
| 120 | struct sk_buff_head *queue, | ||
| 121 | struct inet_cork *cork); | ||
| 122 | extern int ip_send_skb(struct sk_buff *skb); | ||
| 119 | extern int ip_push_pending_frames(struct sock *sk); | 123 | extern int ip_push_pending_frames(struct sock *sk); |
| 120 | extern void ip_flush_pending_frames(struct sock *sk); | 124 | extern void ip_flush_pending_frames(struct sock *sk); |
| 125 | extern struct sk_buff *ip_make_skb(struct sock *sk, | ||
| 126 | int getfrag(void *from, char *to, int offset, int len, | ||
| 127 | int odd, struct sk_buff *skb), | ||
| 128 | void *from, int length, int transhdrlen, | ||
| 129 | struct ipcm_cookie *ipc, | ||
| 130 | struct rtable **rtp, | ||
| 131 | unsigned int flags); | ||
| 132 | |||
| 133 | static inline struct sk_buff *ip_finish_skb(struct sock *sk) | ||
| 134 | { | ||
| 135 | return __ip_make_skb(sk, &sk->sk_write_queue, &inet_sk(sk)->cork); | ||
| 136 | } | ||
| 121 | 137 | ||
| 122 | /* datagram.c */ | 138 | /* datagram.c */ |
| 123 | extern int ip4_datagram_connect(struct sock *sk, | 139 | extern int ip4_datagram_connect(struct sock *sk, |
diff --git a/include/net/ip6_fib.h b/include/net/ip6_fib.h index 708ff7cb8806..bc3cde0a810c 100644 --- a/include/net/ip6_fib.h +++ b/include/net/ip6_fib.h | |||
| @@ -108,6 +108,7 @@ struct rt6_info { | |||
| 108 | u32 rt6i_flags; | 108 | u32 rt6i_flags; |
| 109 | struct rt6key rt6i_src; | 109 | struct rt6key rt6i_src; |
| 110 | u32 rt6i_metric; | 110 | u32 rt6i_metric; |
| 111 | u32 rt6i_peer_genid; | ||
| 111 | 112 | ||
| 112 | struct inet6_dev *rt6i_idev; | 113 | struct inet6_dev *rt6i_idev; |
| 113 | struct inet_peer *rt6i_peer; | 114 | struct inet_peer *rt6i_peer; |
| @@ -182,7 +183,7 @@ struct fib6_table { | |||
| 182 | 183 | ||
| 183 | typedef struct rt6_info *(*pol_lookup_t)(struct net *, | 184 | typedef struct rt6_info *(*pol_lookup_t)(struct net *, |
| 184 | struct fib6_table *, | 185 | struct fib6_table *, |
| 185 | struct flowi *, int); | 186 | struct flowi6 *, int); |
| 186 | 187 | ||
| 187 | /* | 188 | /* |
| 188 | * exported functions | 189 | * exported functions |
| @@ -191,7 +192,7 @@ typedef struct rt6_info *(*pol_lookup_t)(struct net *, | |||
| 191 | extern struct fib6_table *fib6_get_table(struct net *net, u32 id); | 192 | extern struct fib6_table *fib6_get_table(struct net *net, u32 id); |
| 192 | extern struct fib6_table *fib6_new_table(struct net *net, u32 id); | 193 | extern struct fib6_table *fib6_new_table(struct net *net, u32 id); |
| 193 | extern struct dst_entry *fib6_rule_lookup(struct net *net, | 194 | extern struct dst_entry *fib6_rule_lookup(struct net *net, |
| 194 | struct flowi *fl, int flags, | 195 | struct flowi6 *fl6, int flags, |
| 195 | pol_lookup_t lookup); | 196 | pol_lookup_t lookup); |
| 196 | 197 | ||
| 197 | extern struct fib6_node *fib6_lookup(struct fib6_node *root, | 198 | extern struct fib6_node *fib6_lookup(struct fib6_node *root, |
diff --git a/include/net/ip6_route.h b/include/net/ip6_route.h index 8552f0a2e854..642a80bb42cf 100644 --- a/include/net/ip6_route.h +++ b/include/net/ip6_route.h | |||
| @@ -71,7 +71,7 @@ extern void ip6_route_input(struct sk_buff *skb); | |||
| 71 | 71 | ||
| 72 | extern struct dst_entry * ip6_route_output(struct net *net, | 72 | extern struct dst_entry * ip6_route_output(struct net *net, |
| 73 | struct sock *sk, | 73 | struct sock *sk, |
| 74 | struct flowi *fl); | 74 | struct flowi6 *fl6); |
| 75 | 75 | ||
| 76 | extern int ip6_route_init(void); | 76 | extern int ip6_route_init(void); |
| 77 | extern void ip6_route_cleanup(void); | 77 | extern void ip6_route_cleanup(void); |
diff --git a/include/net/ip_fib.h b/include/net/ip_fib.h index 07bdb5e9e8ac..a1a858035913 100644 --- a/include/net/ip_fib.h +++ b/include/net/ip_fib.h | |||
| @@ -51,15 +51,17 @@ struct fib_nh { | |||
| 51 | struct fib_info *nh_parent; | 51 | struct fib_info *nh_parent; |
| 52 | unsigned nh_flags; | 52 | unsigned nh_flags; |
| 53 | unsigned char nh_scope; | 53 | unsigned char nh_scope; |
| 54 | unsigned char nh_cfg_scope; | ||
| 54 | #ifdef CONFIG_IP_ROUTE_MULTIPATH | 55 | #ifdef CONFIG_IP_ROUTE_MULTIPATH |
| 55 | int nh_weight; | 56 | int nh_weight; |
| 56 | int nh_power; | 57 | int nh_power; |
| 57 | #endif | 58 | #endif |
| 58 | #ifdef CONFIG_NET_CLS_ROUTE | 59 | #ifdef CONFIG_IP_ROUTE_CLASSID |
| 59 | __u32 nh_tclassid; | 60 | __u32 nh_tclassid; |
| 60 | #endif | 61 | #endif |
| 61 | int nh_oif; | 62 | int nh_oif; |
| 62 | __be32 nh_gw; | 63 | __be32 nh_gw; |
| 64 | __be32 nh_saddr; | ||
| 63 | }; | 65 | }; |
| 64 | 66 | ||
| 65 | /* | 67 | /* |
| @@ -77,7 +79,7 @@ struct fib_info { | |||
| 77 | int fib_protocol; | 79 | int fib_protocol; |
| 78 | __be32 fib_prefsrc; | 80 | __be32 fib_prefsrc; |
| 79 | u32 fib_priority; | 81 | u32 fib_priority; |
| 80 | u32 fib_metrics[RTAX_MAX]; | 82 | u32 *fib_metrics; |
| 81 | #define fib_mtu fib_metrics[RTAX_MTU-1] | 83 | #define fib_mtu fib_metrics[RTAX_MTU-1] |
| 82 | #define fib_window fib_metrics[RTAX_WINDOW-1] | 84 | #define fib_window fib_metrics[RTAX_WINDOW-1] |
| 83 | #define fib_rtt fib_metrics[RTAX_RTT-1] | 85 | #define fib_rtt fib_metrics[RTAX_RTT-1] |
| @@ -96,12 +98,15 @@ struct fib_info { | |||
| 96 | struct fib_rule; | 98 | struct fib_rule; |
| 97 | #endif | 99 | #endif |
| 98 | 100 | ||
| 101 | struct fib_table; | ||
| 99 | struct fib_result { | 102 | struct fib_result { |
| 100 | unsigned char prefixlen; | 103 | unsigned char prefixlen; |
| 101 | unsigned char nh_sel; | 104 | unsigned char nh_sel; |
| 102 | unsigned char type; | 105 | unsigned char type; |
| 103 | unsigned char scope; | 106 | unsigned char scope; |
| 104 | struct fib_info *fi; | 107 | struct fib_info *fi; |
| 108 | struct fib_table *table; | ||
| 109 | struct list_head *fa_head; | ||
| 105 | #ifdef CONFIG_IP_MULTIPLE_TABLES | 110 | #ifdef CONFIG_IP_MULTIPLE_TABLES |
| 106 | struct fib_rule *r; | 111 | struct fib_rule *r; |
| 107 | #endif | 112 | #endif |
| @@ -136,11 +141,13 @@ struct fib_result_nl { | |||
| 136 | 141 | ||
| 137 | #endif /* CONFIG_IP_ROUTE_MULTIPATH */ | 142 | #endif /* CONFIG_IP_ROUTE_MULTIPATH */ |
| 138 | 143 | ||
| 139 | #define FIB_RES_PREFSRC(res) ((res).fi->fib_prefsrc ? : __fib_res_prefsrc(&res)) | 144 | #define FIB_RES_SADDR(res) (FIB_RES_NH(res).nh_saddr) |
| 140 | #define FIB_RES_GW(res) (FIB_RES_NH(res).nh_gw) | 145 | #define FIB_RES_GW(res) (FIB_RES_NH(res).nh_gw) |
| 141 | #define FIB_RES_DEV(res) (FIB_RES_NH(res).nh_dev) | 146 | #define FIB_RES_DEV(res) (FIB_RES_NH(res).nh_dev) |
| 142 | #define FIB_RES_OIF(res) (FIB_RES_NH(res).nh_oif) | 147 | #define FIB_RES_OIF(res) (FIB_RES_NH(res).nh_oif) |
| 143 | 148 | ||
| 149 | #define FIB_RES_PREFSRC(res) ((res).fi->fib_prefsrc ? : FIB_RES_SADDR(res)) | ||
| 150 | |||
| 144 | struct fib_table { | 151 | struct fib_table { |
| 145 | struct hlist_node tb_hlist; | 152 | struct hlist_node tb_hlist; |
| 146 | u32 tb_id; | 153 | u32 tb_id; |
| @@ -148,16 +155,13 @@ struct fib_table { | |||
| 148 | unsigned char tb_data[0]; | 155 | unsigned char tb_data[0]; |
| 149 | }; | 156 | }; |
| 150 | 157 | ||
| 151 | extern int fib_table_lookup(struct fib_table *tb, const struct flowi *flp, | 158 | extern int fib_table_lookup(struct fib_table *tb, const struct flowi4 *flp, |
| 152 | struct fib_result *res, int fib_flags); | 159 | struct fib_result *res, int fib_flags); |
| 153 | extern int fib_table_insert(struct fib_table *, struct fib_config *); | 160 | extern int fib_table_insert(struct fib_table *, struct fib_config *); |
| 154 | extern int fib_table_delete(struct fib_table *, struct fib_config *); | 161 | extern int fib_table_delete(struct fib_table *, struct fib_config *); |
| 155 | extern int fib_table_dump(struct fib_table *table, struct sk_buff *skb, | 162 | extern int fib_table_dump(struct fib_table *table, struct sk_buff *skb, |
| 156 | struct netlink_callback *cb); | 163 | struct netlink_callback *cb); |
| 157 | extern int fib_table_flush(struct fib_table *table); | 164 | extern int fib_table_flush(struct fib_table *table); |
| 158 | extern void fib_table_select_default(struct fib_table *table, | ||
| 159 | const struct flowi *flp, | ||
| 160 | struct fib_result *res); | ||
| 161 | extern void fib_free_table(struct fib_table *tb); | 165 | extern void fib_free_table(struct fib_table *tb); |
| 162 | 166 | ||
| 163 | 167 | ||
| @@ -182,7 +186,7 @@ static inline struct fib_table *fib_new_table(struct net *net, u32 id) | |||
| 182 | return fib_get_table(net, id); | 186 | return fib_get_table(net, id); |
| 183 | } | 187 | } |
| 184 | 188 | ||
| 185 | static inline int fib_lookup(struct net *net, const struct flowi *flp, | 189 | static inline int fib_lookup(struct net *net, const struct flowi4 *flp, |
| 186 | struct fib_result *res) | 190 | struct fib_result *res) |
| 187 | { | 191 | { |
| 188 | struct fib_table *table; | 192 | struct fib_table *table; |
| @@ -201,11 +205,11 @@ static inline int fib_lookup(struct net *net, const struct flowi *flp, | |||
| 201 | extern int __net_init fib4_rules_init(struct net *net); | 205 | extern int __net_init fib4_rules_init(struct net *net); |
| 202 | extern void __net_exit fib4_rules_exit(struct net *net); | 206 | extern void __net_exit fib4_rules_exit(struct net *net); |
| 203 | 207 | ||
| 204 | #ifdef CONFIG_NET_CLS_ROUTE | 208 | #ifdef CONFIG_IP_ROUTE_CLASSID |
| 205 | extern u32 fib_rules_tclass(struct fib_result *res); | 209 | extern u32 fib_rules_tclass(const struct fib_result *res); |
| 206 | #endif | 210 | #endif |
| 207 | 211 | ||
| 208 | extern int fib_lookup(struct net *n, struct flowi *flp, struct fib_result *res); | 212 | extern int fib_lookup(struct net *n, struct flowi4 *flp, struct fib_result *res); |
| 209 | 213 | ||
| 210 | extern struct fib_table *fib_new_table(struct net *net, u32 id); | 214 | extern struct fib_table *fib_new_table(struct net *net, u32 id); |
| 211 | extern struct fib_table *fib_get_table(struct net *net, u32 id); | 215 | extern struct fib_table *fib_get_table(struct net *net, u32 id); |
| @@ -218,24 +222,23 @@ extern void ip_fib_init(void); | |||
| 218 | extern int fib_validate_source(__be32 src, __be32 dst, u8 tos, int oif, | 222 | extern int fib_validate_source(__be32 src, __be32 dst, u8 tos, int oif, |
| 219 | struct net_device *dev, __be32 *spec_dst, | 223 | struct net_device *dev, __be32 *spec_dst, |
| 220 | u32 *itag, u32 mark); | 224 | u32 *itag, u32 mark); |
| 221 | extern void fib_select_default(struct net *net, const struct flowi *flp, | 225 | extern void fib_select_default(struct fib_result *res); |
| 222 | struct fib_result *res); | ||
| 223 | 226 | ||
| 224 | /* Exported by fib_semantics.c */ | 227 | /* Exported by fib_semantics.c */ |
| 225 | extern int ip_fib_check_default(__be32 gw, struct net_device *dev); | 228 | extern int ip_fib_check_default(__be32 gw, struct net_device *dev); |
| 226 | extern int fib_sync_down_dev(struct net_device *dev, int force); | 229 | extern int fib_sync_down_dev(struct net_device *dev, int force); |
| 227 | extern int fib_sync_down_addr(struct net *net, __be32 local); | 230 | extern int fib_sync_down_addr(struct net *net, __be32 local); |
| 231 | extern void fib_update_nh_saddrs(struct net_device *dev); | ||
| 228 | extern int fib_sync_up(struct net_device *dev); | 232 | extern int fib_sync_up(struct net_device *dev); |
| 229 | extern __be32 __fib_res_prefsrc(struct fib_result *res); | 233 | extern void fib_select_multipath(struct fib_result *res); |
| 230 | extern void fib_select_multipath(const struct flowi *flp, struct fib_result *res); | ||
| 231 | 234 | ||
| 232 | /* Exported by fib_{hash|trie}.c */ | 235 | /* Exported by fib_trie.c */ |
| 233 | extern void fib_hash_init(void); | 236 | extern void fib_trie_init(void); |
| 234 | extern struct fib_table *fib_hash_table(u32 id); | 237 | extern struct fib_table *fib_trie_table(u32 id); |
| 235 | 238 | ||
| 236 | static inline void fib_combine_itag(u32 *itag, struct fib_result *res) | 239 | static inline void fib_combine_itag(u32 *itag, const struct fib_result *res) |
| 237 | { | 240 | { |
| 238 | #ifdef CONFIG_NET_CLS_ROUTE | 241 | #ifdef CONFIG_IP_ROUTE_CLASSID |
| 239 | #ifdef CONFIG_IP_MULTIPLE_TABLES | 242 | #ifdef CONFIG_IP_MULTIPLE_TABLES |
| 240 | u32 rtag; | 243 | u32 rtag; |
| 241 | #endif | 244 | #endif |
diff --git a/include/net/ip_vs.h b/include/net/ip_vs.h index b7bbd6c28cfa..272f59336b73 100644 --- a/include/net/ip_vs.h +++ b/include/net/ip_vs.h | |||
| @@ -28,6 +28,80 @@ | |||
| 28 | #if defined(CONFIG_NF_CONNTRACK) || defined(CONFIG_NF_CONNTRACK_MODULE) | 28 | #if defined(CONFIG_NF_CONNTRACK) || defined(CONFIG_NF_CONNTRACK_MODULE) |
| 29 | #include <net/netfilter/nf_conntrack.h> | 29 | #include <net/netfilter/nf_conntrack.h> |
| 30 | #endif | 30 | #endif |
| 31 | #include <net/net_namespace.h> /* Netw namespace */ | ||
| 32 | |||
| 33 | /* | ||
| 34 | * Generic access of ipvs struct | ||
| 35 | */ | ||
| 36 | static inline struct netns_ipvs *net_ipvs(struct net* net) | ||
| 37 | { | ||
| 38 | return net->ipvs; | ||
| 39 | } | ||
| 40 | /* | ||
| 41 | * Get net ptr from skb in traffic cases | ||
| 42 | * use skb_sknet when call is from userland (ioctl or netlink) | ||
| 43 | */ | ||
| 44 | static inline struct net *skb_net(const struct sk_buff *skb) | ||
| 45 | { | ||
| 46 | #ifdef CONFIG_NET_NS | ||
| 47 | #ifdef CONFIG_IP_VS_DEBUG | ||
| 48 | /* | ||
| 49 | * This is used for debug only. | ||
| 50 | * Start with the most likely hit | ||
| 51 | * End with BUG | ||
| 52 | */ | ||
| 53 | if (likely(skb->dev && skb->dev->nd_net)) | ||
| 54 | return dev_net(skb->dev); | ||
| 55 | if (skb_dst(skb)->dev) | ||
| 56 | return dev_net(skb_dst(skb)->dev); | ||
| 57 | WARN(skb->sk, "Maybe skb_sknet should be used in %s() at line:%d\n", | ||
| 58 | __func__, __LINE__); | ||
| 59 | if (likely(skb->sk && skb->sk->sk_net)) | ||
| 60 | return sock_net(skb->sk); | ||
| 61 | pr_err("There is no net ptr to find in the skb in %s() line:%d\n", | ||
| 62 | __func__, __LINE__); | ||
| 63 | BUG(); | ||
| 64 | #else | ||
| 65 | return dev_net(skb->dev ? : skb_dst(skb)->dev); | ||
| 66 | #endif | ||
| 67 | #else | ||
| 68 | return &init_net; | ||
| 69 | #endif | ||
| 70 | } | ||
| 71 | |||
| 72 | static inline struct net *skb_sknet(const struct sk_buff *skb) | ||
| 73 | { | ||
| 74 | #ifdef CONFIG_NET_NS | ||
| 75 | #ifdef CONFIG_IP_VS_DEBUG | ||
| 76 | /* Start with the most likely hit */ | ||
| 77 | if (likely(skb->sk && skb->sk->sk_net)) | ||
| 78 | return sock_net(skb->sk); | ||
| 79 | WARN(skb->dev, "Maybe skb_net should be used instead in %s() line:%d\n", | ||
| 80 | __func__, __LINE__); | ||
| 81 | if (likely(skb->dev && skb->dev->nd_net)) | ||
| 82 | return dev_net(skb->dev); | ||
| 83 | pr_err("There is no net ptr to find in the skb in %s() line:%d\n", | ||
| 84 | __func__, __LINE__); | ||
| 85 | BUG(); | ||
| 86 | #else | ||
| 87 | return sock_net(skb->sk); | ||
| 88 | #endif | ||
| 89 | #else | ||
| 90 | return &init_net; | ||
| 91 | #endif | ||
| 92 | } | ||
| 93 | /* | ||
| 94 | * This one needed for single_open_net since net is stored directly in | ||
| 95 | * private not as a struct i.e. seq_file_net cant be used. | ||
| 96 | */ | ||
| 97 | static inline struct net *seq_file_single_net(struct seq_file *seq) | ||
| 98 | { | ||
| 99 | #ifdef CONFIG_NET_NS | ||
| 100 | return (struct net *)seq->private; | ||
| 101 | #else | ||
| 102 | return &init_net; | ||
| 103 | #endif | ||
| 104 | } | ||
| 31 | 105 | ||
| 32 | /* Connections' size value needed by ip_vs_ctl.c */ | 106 | /* Connections' size value needed by ip_vs_ctl.c */ |
| 33 | extern int ip_vs_conn_tab_size; | 107 | extern int ip_vs_conn_tab_size; |
| @@ -258,6 +332,23 @@ struct ip_vs_seq { | |||
| 258 | before last resized pkt */ | 332 | before last resized pkt */ |
| 259 | }; | 333 | }; |
| 260 | 334 | ||
| 335 | /* | ||
| 336 | * counters per cpu | ||
| 337 | */ | ||
| 338 | struct ip_vs_counters { | ||
| 339 | __u32 conns; /* connections scheduled */ | ||
| 340 | __u32 inpkts; /* incoming packets */ | ||
| 341 | __u32 outpkts; /* outgoing packets */ | ||
| 342 | __u64 inbytes; /* incoming bytes */ | ||
| 343 | __u64 outbytes; /* outgoing bytes */ | ||
| 344 | }; | ||
| 345 | /* | ||
| 346 | * Stats per cpu | ||
| 347 | */ | ||
| 348 | struct ip_vs_cpu_stats { | ||
| 349 | struct ip_vs_counters ustats; | ||
| 350 | struct u64_stats_sync syncp; | ||
| 351 | }; | ||
| 261 | 352 | ||
| 262 | /* | 353 | /* |
| 263 | * IPVS statistics objects | 354 | * IPVS statistics objects |
| @@ -279,10 +370,11 @@ struct ip_vs_estimator { | |||
| 279 | }; | 370 | }; |
| 280 | 371 | ||
| 281 | struct ip_vs_stats { | 372 | struct ip_vs_stats { |
| 282 | struct ip_vs_stats_user ustats; /* statistics */ | 373 | struct ip_vs_stats_user ustats; /* statistics */ |
| 283 | struct ip_vs_estimator est; /* estimator */ | 374 | struct ip_vs_estimator est; /* estimator */ |
| 284 | 375 | struct ip_vs_cpu_stats *cpustats; /* per cpu counters */ | |
| 285 | spinlock_t lock; /* spin lock */ | 376 | spinlock_t lock; /* spin lock */ |
| 377 | struct ip_vs_stats_user ustats0; /* reset values */ | ||
| 286 | }; | 378 | }; |
| 287 | 379 | ||
| 288 | struct dst_entry; | 380 | struct dst_entry; |
| @@ -290,6 +382,7 @@ struct iphdr; | |||
| 290 | struct ip_vs_conn; | 382 | struct ip_vs_conn; |
| 291 | struct ip_vs_app; | 383 | struct ip_vs_app; |
| 292 | struct sk_buff; | 384 | struct sk_buff; |
| 385 | struct ip_vs_proto_data; | ||
| 293 | 386 | ||
| 294 | struct ip_vs_protocol { | 387 | struct ip_vs_protocol { |
| 295 | struct ip_vs_protocol *next; | 388 | struct ip_vs_protocol *next; |
| @@ -297,21 +390,22 @@ struct ip_vs_protocol { | |||
| 297 | u16 protocol; | 390 | u16 protocol; |
| 298 | u16 num_states; | 391 | u16 num_states; |
| 299 | int dont_defrag; | 392 | int dont_defrag; |
| 300 | atomic_t appcnt; /* counter of proto app incs */ | ||
| 301 | int *timeout_table; /* protocol timeout table */ | ||
| 302 | 393 | ||
| 303 | void (*init)(struct ip_vs_protocol *pp); | 394 | void (*init)(struct ip_vs_protocol *pp); |
| 304 | 395 | ||
| 305 | void (*exit)(struct ip_vs_protocol *pp); | 396 | void (*exit)(struct ip_vs_protocol *pp); |
| 306 | 397 | ||
| 398 | void (*init_netns)(struct net *net, struct ip_vs_proto_data *pd); | ||
| 399 | |||
| 400 | void (*exit_netns)(struct net *net, struct ip_vs_proto_data *pd); | ||
| 401 | |||
| 307 | int (*conn_schedule)(int af, struct sk_buff *skb, | 402 | int (*conn_schedule)(int af, struct sk_buff *skb, |
| 308 | struct ip_vs_protocol *pp, | 403 | struct ip_vs_proto_data *pd, |
| 309 | int *verdict, struct ip_vs_conn **cpp); | 404 | int *verdict, struct ip_vs_conn **cpp); |
| 310 | 405 | ||
| 311 | struct ip_vs_conn * | 406 | struct ip_vs_conn * |
| 312 | (*conn_in_get)(int af, | 407 | (*conn_in_get)(int af, |
| 313 | const struct sk_buff *skb, | 408 | const struct sk_buff *skb, |
| 314 | struct ip_vs_protocol *pp, | ||
| 315 | const struct ip_vs_iphdr *iph, | 409 | const struct ip_vs_iphdr *iph, |
| 316 | unsigned int proto_off, | 410 | unsigned int proto_off, |
| 317 | int inverse); | 411 | int inverse); |
| @@ -319,7 +413,6 @@ struct ip_vs_protocol { | |||
| 319 | struct ip_vs_conn * | 413 | struct ip_vs_conn * |
| 320 | (*conn_out_get)(int af, | 414 | (*conn_out_get)(int af, |
| 321 | const struct sk_buff *skb, | 415 | const struct sk_buff *skb, |
| 322 | struct ip_vs_protocol *pp, | ||
| 323 | const struct ip_vs_iphdr *iph, | 416 | const struct ip_vs_iphdr *iph, |
| 324 | unsigned int proto_off, | 417 | unsigned int proto_off, |
| 325 | int inverse); | 418 | int inverse); |
| @@ -337,11 +430,11 @@ struct ip_vs_protocol { | |||
| 337 | 430 | ||
| 338 | int (*state_transition)(struct ip_vs_conn *cp, int direction, | 431 | int (*state_transition)(struct ip_vs_conn *cp, int direction, |
| 339 | const struct sk_buff *skb, | 432 | const struct sk_buff *skb, |
| 340 | struct ip_vs_protocol *pp); | 433 | struct ip_vs_proto_data *pd); |
| 341 | 434 | ||
| 342 | int (*register_app)(struct ip_vs_app *inc); | 435 | int (*register_app)(struct net *net, struct ip_vs_app *inc); |
| 343 | 436 | ||
| 344 | void (*unregister_app)(struct ip_vs_app *inc); | 437 | void (*unregister_app)(struct net *net, struct ip_vs_app *inc); |
| 345 | 438 | ||
| 346 | int (*app_conn_bind)(struct ip_vs_conn *cp); | 439 | int (*app_conn_bind)(struct ip_vs_conn *cp); |
| 347 | 440 | ||
| @@ -350,14 +443,26 @@ struct ip_vs_protocol { | |||
| 350 | int offset, | 443 | int offset, |
| 351 | const char *msg); | 444 | const char *msg); |
| 352 | 445 | ||
| 353 | void (*timeout_change)(struct ip_vs_protocol *pp, int flags); | 446 | void (*timeout_change)(struct ip_vs_proto_data *pd, int flags); |
| 447 | }; | ||
| 354 | 448 | ||
| 355 | int (*set_state_timeout)(struct ip_vs_protocol *pp, char *sname, int to); | 449 | /* |
| 450 | * protocol data per netns | ||
| 451 | */ | ||
| 452 | struct ip_vs_proto_data { | ||
| 453 | struct ip_vs_proto_data *next; | ||
| 454 | struct ip_vs_protocol *pp; | ||
| 455 | int *timeout_table; /* protocol timeout table */ | ||
| 456 | atomic_t appcnt; /* counter of proto app incs. */ | ||
| 457 | struct tcp_states_t *tcp_state_table; | ||
| 356 | }; | 458 | }; |
| 357 | 459 | ||
| 358 | extern struct ip_vs_protocol * ip_vs_proto_get(unsigned short proto); | 460 | extern struct ip_vs_protocol *ip_vs_proto_get(unsigned short proto); |
| 461 | extern struct ip_vs_proto_data *ip_vs_proto_data_get(struct net *net, | ||
| 462 | unsigned short proto); | ||
| 359 | 463 | ||
| 360 | struct ip_vs_conn_param { | 464 | struct ip_vs_conn_param { |
| 465 | struct net *net; | ||
| 361 | const union nf_inet_addr *caddr; | 466 | const union nf_inet_addr *caddr; |
| 362 | const union nf_inet_addr *vaddr; | 467 | const union nf_inet_addr *vaddr; |
| 363 | __be16 cport; | 468 | __be16 cport; |
| @@ -374,17 +479,20 @@ struct ip_vs_conn_param { | |||
| 374 | * IP_VS structure allocated for each dynamically scheduled connection | 479 | * IP_VS structure allocated for each dynamically scheduled connection |
| 375 | */ | 480 | */ |
| 376 | struct ip_vs_conn { | 481 | struct ip_vs_conn { |
| 377 | struct list_head c_list; /* hashed list heads */ | 482 | struct hlist_node c_list; /* hashed list heads */ |
| 378 | 483 | #ifdef CONFIG_NET_NS | |
| 484 | struct net *net; /* Name space */ | ||
| 485 | #endif | ||
| 379 | /* Protocol, addresses and port numbers */ | 486 | /* Protocol, addresses and port numbers */ |
| 380 | u16 af; /* address family */ | 487 | u16 af; /* address family */ |
| 381 | union nf_inet_addr caddr; /* client address */ | 488 | __be16 cport; |
| 382 | union nf_inet_addr vaddr; /* virtual address */ | 489 | __be16 vport; |
| 383 | union nf_inet_addr daddr; /* destination address */ | 490 | __be16 dport; |
| 384 | volatile __u32 flags; /* status flags */ | 491 | __u32 fwmark; /* Fire wall mark from skb */ |
| 385 | __be16 cport; | 492 | union nf_inet_addr caddr; /* client address */ |
| 386 | __be16 vport; | 493 | union nf_inet_addr vaddr; /* virtual address */ |
| 387 | __be16 dport; | 494 | union nf_inet_addr daddr; /* destination address */ |
| 495 | volatile __u32 flags; /* status flags */ | ||
| 388 | __u16 protocol; /* Which protocol (TCP/UDP) */ | 496 | __u16 protocol; /* Which protocol (TCP/UDP) */ |
| 389 | 497 | ||
| 390 | /* counter and timer */ | 498 | /* counter and timer */ |
| @@ -422,10 +530,38 @@ struct ip_vs_conn { | |||
| 422 | struct ip_vs_seq in_seq; /* incoming seq. struct */ | 530 | struct ip_vs_seq in_seq; /* incoming seq. struct */ |
| 423 | struct ip_vs_seq out_seq; /* outgoing seq. struct */ | 531 | struct ip_vs_seq out_seq; /* outgoing seq. struct */ |
| 424 | 532 | ||
| 533 | const struct ip_vs_pe *pe; | ||
| 425 | char *pe_data; | 534 | char *pe_data; |
| 426 | __u8 pe_data_len; | 535 | __u8 pe_data_len; |
| 427 | }; | 536 | }; |
| 428 | 537 | ||
| 538 | /* | ||
| 539 | * To save some memory in conn table when name space is disabled. | ||
| 540 | */ | ||
| 541 | static inline struct net *ip_vs_conn_net(const struct ip_vs_conn *cp) | ||
| 542 | { | ||
| 543 | #ifdef CONFIG_NET_NS | ||
| 544 | return cp->net; | ||
| 545 | #else | ||
| 546 | return &init_net; | ||
| 547 | #endif | ||
| 548 | } | ||
| 549 | static inline void ip_vs_conn_net_set(struct ip_vs_conn *cp, struct net *net) | ||
| 550 | { | ||
| 551 | #ifdef CONFIG_NET_NS | ||
| 552 | cp->net = net; | ||
| 553 | #endif | ||
| 554 | } | ||
| 555 | |||
| 556 | static inline int ip_vs_conn_net_eq(const struct ip_vs_conn *cp, | ||
| 557 | struct net *net) | ||
| 558 | { | ||
| 559 | #ifdef CONFIG_NET_NS | ||
| 560 | return cp->net == net; | ||
| 561 | #else | ||
| 562 | return 1; | ||
| 563 | #endif | ||
| 564 | } | ||
| 429 | 565 | ||
| 430 | /* | 566 | /* |
| 431 | * Extended internal versions of struct ip_vs_service_user and | 567 | * Extended internal versions of struct ip_vs_service_user and |
| @@ -485,6 +621,7 @@ struct ip_vs_service { | |||
| 485 | unsigned flags; /* service status flags */ | 621 | unsigned flags; /* service status flags */ |
| 486 | unsigned timeout; /* persistent timeout in ticks */ | 622 | unsigned timeout; /* persistent timeout in ticks */ |
| 487 | __be32 netmask; /* grouping granularity */ | 623 | __be32 netmask; /* grouping granularity */ |
| 624 | struct net *net; | ||
| 488 | 625 | ||
| 489 | struct list_head destinations; /* real server d-linked list */ | 626 | struct list_head destinations; /* real server d-linked list */ |
| 490 | __u32 num_dests; /* number of servers */ | 627 | __u32 num_dests; /* number of servers */ |
| @@ -510,8 +647,8 @@ struct ip_vs_dest { | |||
| 510 | struct list_head d_list; /* for table with all the dests */ | 647 | struct list_head d_list; /* for table with all the dests */ |
| 511 | 648 | ||
| 512 | u16 af; /* address family */ | 649 | u16 af; /* address family */ |
| 513 | union nf_inet_addr addr; /* IP address of the server */ | ||
| 514 | __be16 port; /* port number of the server */ | 650 | __be16 port; /* port number of the server */ |
| 651 | union nf_inet_addr addr; /* IP address of the server */ | ||
| 515 | volatile unsigned flags; /* dest status flags */ | 652 | volatile unsigned flags; /* dest status flags */ |
| 516 | atomic_t conn_flags; /* flags to copy to conn */ | 653 | atomic_t conn_flags; /* flags to copy to conn */ |
| 517 | atomic_t weight; /* server weight */ | 654 | atomic_t weight; /* server weight */ |
| @@ -538,8 +675,8 @@ struct ip_vs_dest { | |||
| 538 | /* for virtual service */ | 675 | /* for virtual service */ |
| 539 | struct ip_vs_service *svc; /* service it belongs to */ | 676 | struct ip_vs_service *svc; /* service it belongs to */ |
| 540 | __u16 protocol; /* which protocol (TCP/UDP) */ | 677 | __u16 protocol; /* which protocol (TCP/UDP) */ |
| 541 | union nf_inet_addr vaddr; /* virtual IP address */ | ||
| 542 | __be16 vport; /* virtual port number */ | 678 | __be16 vport; /* virtual port number */ |
| 679 | union nf_inet_addr vaddr; /* virtual IP address */ | ||
| 543 | __u32 vfwmark; /* firewall mark of service */ | 680 | __u32 vfwmark; /* firewall mark of service */ |
| 544 | }; | 681 | }; |
| 545 | 682 | ||
| @@ -651,6 +788,171 @@ struct ip_vs_app { | |||
| 651 | void (*timeout_change)(struct ip_vs_app *app, int flags); | 788 | void (*timeout_change)(struct ip_vs_app *app, int flags); |
| 652 | }; | 789 | }; |
| 653 | 790 | ||
| 791 | /* IPVS in network namespace */ | ||
| 792 | struct netns_ipvs { | ||
| 793 | int gen; /* Generation */ | ||
| 794 | /* | ||
| 795 | * Hash table: for real service lookups | ||
| 796 | */ | ||
| 797 | #define IP_VS_RTAB_BITS 4 | ||
| 798 | #define IP_VS_RTAB_SIZE (1 << IP_VS_RTAB_BITS) | ||
| 799 | #define IP_VS_RTAB_MASK (IP_VS_RTAB_SIZE - 1) | ||
| 800 | |||
| 801 | struct list_head rs_table[IP_VS_RTAB_SIZE]; | ||
| 802 | /* ip_vs_app */ | ||
| 803 | struct list_head app_list; | ||
| 804 | struct mutex app_mutex; | ||
| 805 | struct lock_class_key app_key; /* mutex debuging */ | ||
| 806 | |||
| 807 | /* ip_vs_proto */ | ||
| 808 | #define IP_VS_PROTO_TAB_SIZE 32 /* must be power of 2 */ | ||
| 809 | struct ip_vs_proto_data *proto_data_table[IP_VS_PROTO_TAB_SIZE]; | ||
| 810 | /* ip_vs_proto_tcp */ | ||
| 811 | #ifdef CONFIG_IP_VS_PROTO_TCP | ||
| 812 | #define TCP_APP_TAB_BITS 4 | ||
| 813 | #define TCP_APP_TAB_SIZE (1 << TCP_APP_TAB_BITS) | ||
| 814 | #define TCP_APP_TAB_MASK (TCP_APP_TAB_SIZE - 1) | ||
| 815 | struct list_head tcp_apps[TCP_APP_TAB_SIZE]; | ||
| 816 | spinlock_t tcp_app_lock; | ||
| 817 | #endif | ||
| 818 | /* ip_vs_proto_udp */ | ||
| 819 | #ifdef CONFIG_IP_VS_PROTO_UDP | ||
| 820 | #define UDP_APP_TAB_BITS 4 | ||
| 821 | #define UDP_APP_TAB_SIZE (1 << UDP_APP_TAB_BITS) | ||
| 822 | #define UDP_APP_TAB_MASK (UDP_APP_TAB_SIZE - 1) | ||
| 823 | struct list_head udp_apps[UDP_APP_TAB_SIZE]; | ||
| 824 | spinlock_t udp_app_lock; | ||
| 825 | #endif | ||
| 826 | /* ip_vs_proto_sctp */ | ||
| 827 | #ifdef CONFIG_IP_VS_PROTO_SCTP | ||
| 828 | #define SCTP_APP_TAB_BITS 4 | ||
| 829 | #define SCTP_APP_TAB_SIZE (1 << SCTP_APP_TAB_BITS) | ||
| 830 | #define SCTP_APP_TAB_MASK (SCTP_APP_TAB_SIZE - 1) | ||
| 831 | /* Hash table for SCTP application incarnations */ | ||
| 832 | struct list_head sctp_apps[SCTP_APP_TAB_SIZE]; | ||
| 833 | spinlock_t sctp_app_lock; | ||
| 834 | #endif | ||
| 835 | /* ip_vs_conn */ | ||
| 836 | atomic_t conn_count; /* connection counter */ | ||
| 837 | |||
| 838 | /* ip_vs_ctl */ | ||
| 839 | struct ip_vs_stats tot_stats; /* Statistics & est. */ | ||
| 840 | |||
| 841 | int num_services; /* no of virtual services */ | ||
| 842 | |||
| 843 | rwlock_t rs_lock; /* real services table */ | ||
| 844 | /* semaphore for IPVS sockopts. And, [gs]etsockopt may sleep. */ | ||
| 845 | struct lock_class_key ctl_key; /* ctl_mutex debuging */ | ||
| 846 | /* Trash for destinations */ | ||
| 847 | struct list_head dest_trash; | ||
| 848 | /* Service counters */ | ||
| 849 | atomic_t ftpsvc_counter; | ||
| 850 | atomic_t nullsvc_counter; | ||
| 851 | |||
| 852 | #ifdef CONFIG_SYSCTL | ||
| 853 | /* 1/rate drop and drop-entry variables */ | ||
| 854 | struct delayed_work defense_work; /* Work handler */ | ||
| 855 | int drop_rate; | ||
| 856 | int drop_counter; | ||
| 857 | atomic_t dropentry; | ||
| 858 | /* locks in ctl.c */ | ||
| 859 | spinlock_t dropentry_lock; /* drop entry handling */ | ||
| 860 | spinlock_t droppacket_lock; /* drop packet handling */ | ||
| 861 | spinlock_t securetcp_lock; /* state and timeout tables */ | ||
| 862 | |||
| 863 | /* sys-ctl struct */ | ||
| 864 | struct ctl_table_header *sysctl_hdr; | ||
| 865 | struct ctl_table *sysctl_tbl; | ||
| 866 | #endif | ||
| 867 | |||
| 868 | /* sysctl variables */ | ||
| 869 | int sysctl_amemthresh; | ||
| 870 | int sysctl_am_droprate; | ||
| 871 | int sysctl_drop_entry; | ||
| 872 | int sysctl_drop_packet; | ||
| 873 | int sysctl_secure_tcp; | ||
| 874 | #ifdef CONFIG_IP_VS_NFCT | ||
| 875 | int sysctl_conntrack; | ||
| 876 | #endif | ||
| 877 | int sysctl_snat_reroute; | ||
| 878 | int sysctl_sync_ver; | ||
| 879 | int sysctl_cache_bypass; | ||
| 880 | int sysctl_expire_nodest_conn; | ||
| 881 | int sysctl_expire_quiescent_template; | ||
| 882 | int sysctl_sync_threshold[2]; | ||
| 883 | int sysctl_nat_icmp_send; | ||
| 884 | |||
| 885 | /* ip_vs_lblc */ | ||
| 886 | int sysctl_lblc_expiration; | ||
| 887 | struct ctl_table_header *lblc_ctl_header; | ||
| 888 | struct ctl_table *lblc_ctl_table; | ||
| 889 | /* ip_vs_lblcr */ | ||
| 890 | int sysctl_lblcr_expiration; | ||
| 891 | struct ctl_table_header *lblcr_ctl_header; | ||
| 892 | struct ctl_table *lblcr_ctl_table; | ||
| 893 | /* ip_vs_est */ | ||
| 894 | struct list_head est_list; /* estimator list */ | ||
| 895 | spinlock_t est_lock; | ||
| 896 | struct timer_list est_timer; /* Estimation timer */ | ||
| 897 | /* ip_vs_sync */ | ||
| 898 | struct list_head sync_queue; | ||
| 899 | spinlock_t sync_lock; | ||
| 900 | struct ip_vs_sync_buff *sync_buff; | ||
| 901 | spinlock_t sync_buff_lock; | ||
| 902 | struct sockaddr_in sync_mcast_addr; | ||
| 903 | struct task_struct *master_thread; | ||
| 904 | struct task_struct *backup_thread; | ||
| 905 | int send_mesg_maxlen; | ||
| 906 | int recv_mesg_maxlen; | ||
| 907 | volatile int sync_state; | ||
| 908 | volatile int master_syncid; | ||
| 909 | volatile int backup_syncid; | ||
| 910 | /* multicast interface name */ | ||
| 911 | char master_mcast_ifn[IP_VS_IFNAME_MAXLEN]; | ||
| 912 | char backup_mcast_ifn[IP_VS_IFNAME_MAXLEN]; | ||
| 913 | /* net name space ptr */ | ||
| 914 | struct net *net; /* Needed by timer routines */ | ||
| 915 | }; | ||
| 916 | |||
| 917 | #define DEFAULT_SYNC_THRESHOLD 3 | ||
| 918 | #define DEFAULT_SYNC_PERIOD 50 | ||
| 919 | #define DEFAULT_SYNC_VER 1 | ||
| 920 | |||
| 921 | #ifdef CONFIG_SYSCTL | ||
| 922 | |||
| 923 | static inline int sysctl_sync_threshold(struct netns_ipvs *ipvs) | ||
| 924 | { | ||
| 925 | return ipvs->sysctl_sync_threshold[0]; | ||
| 926 | } | ||
| 927 | |||
| 928 | static inline int sysctl_sync_period(struct netns_ipvs *ipvs) | ||
| 929 | { | ||
| 930 | return ipvs->sysctl_sync_threshold[1]; | ||
| 931 | } | ||
| 932 | |||
| 933 | static inline int sysctl_sync_ver(struct netns_ipvs *ipvs) | ||
| 934 | { | ||
| 935 | return ipvs->sysctl_sync_ver; | ||
| 936 | } | ||
| 937 | |||
| 938 | #else | ||
| 939 | |||
| 940 | static inline int sysctl_sync_threshold(struct netns_ipvs *ipvs) | ||
| 941 | { | ||
| 942 | return DEFAULT_SYNC_THRESHOLD; | ||
| 943 | } | ||
| 944 | |||
| 945 | static inline int sysctl_sync_period(struct netns_ipvs *ipvs) | ||
| 946 | { | ||
| 947 | return DEFAULT_SYNC_PERIOD; | ||
| 948 | } | ||
| 949 | |||
| 950 | static inline int sysctl_sync_ver(struct netns_ipvs *ipvs) | ||
| 951 | { | ||
| 952 | return DEFAULT_SYNC_VER; | ||
| 953 | } | ||
| 954 | |||
| 955 | #endif | ||
| 654 | 956 | ||
| 655 | /* | 957 | /* |
| 656 | * IPVS core functions | 958 | * IPVS core functions |
| @@ -674,13 +976,14 @@ enum { | |||
| 674 | IP_VS_DIR_LAST, | 976 | IP_VS_DIR_LAST, |
| 675 | }; | 977 | }; |
| 676 | 978 | ||
| 677 | static inline void ip_vs_conn_fill_param(int af, int protocol, | 979 | static inline void ip_vs_conn_fill_param(struct net *net, int af, int protocol, |
| 678 | const union nf_inet_addr *caddr, | 980 | const union nf_inet_addr *caddr, |
| 679 | __be16 cport, | 981 | __be16 cport, |
| 680 | const union nf_inet_addr *vaddr, | 982 | const union nf_inet_addr *vaddr, |
| 681 | __be16 vport, | 983 | __be16 vport, |
| 682 | struct ip_vs_conn_param *p) | 984 | struct ip_vs_conn_param *p) |
| 683 | { | 985 | { |
| 986 | p->net = net; | ||
| 684 | p->af = af; | 987 | p->af = af; |
| 685 | p->protocol = protocol; | 988 | p->protocol = protocol; |
| 686 | p->caddr = caddr; | 989 | p->caddr = caddr; |
| @@ -695,7 +998,6 @@ struct ip_vs_conn *ip_vs_conn_in_get(const struct ip_vs_conn_param *p); | |||
| 695 | struct ip_vs_conn *ip_vs_ct_in_get(const struct ip_vs_conn_param *p); | 998 | struct ip_vs_conn *ip_vs_ct_in_get(const struct ip_vs_conn_param *p); |
| 696 | 999 | ||
| 697 | struct ip_vs_conn * ip_vs_conn_in_get_proto(int af, const struct sk_buff *skb, | 1000 | struct ip_vs_conn * ip_vs_conn_in_get_proto(int af, const struct sk_buff *skb, |
| 698 | struct ip_vs_protocol *pp, | ||
| 699 | const struct ip_vs_iphdr *iph, | 1001 | const struct ip_vs_iphdr *iph, |
| 700 | unsigned int proto_off, | 1002 | unsigned int proto_off, |
| 701 | int inverse); | 1003 | int inverse); |
| @@ -703,7 +1005,6 @@ struct ip_vs_conn * ip_vs_conn_in_get_proto(int af, const struct sk_buff *skb, | |||
| 703 | struct ip_vs_conn *ip_vs_conn_out_get(const struct ip_vs_conn_param *p); | 1005 | struct ip_vs_conn *ip_vs_conn_out_get(const struct ip_vs_conn_param *p); |
| 704 | 1006 | ||
| 705 | struct ip_vs_conn * ip_vs_conn_out_get_proto(int af, const struct sk_buff *skb, | 1007 | struct ip_vs_conn * ip_vs_conn_out_get_proto(int af, const struct sk_buff *skb, |
| 706 | struct ip_vs_protocol *pp, | ||
| 707 | const struct ip_vs_iphdr *iph, | 1008 | const struct ip_vs_iphdr *iph, |
| 708 | unsigned int proto_off, | 1009 | unsigned int proto_off, |
| 709 | int inverse); | 1010 | int inverse); |
| @@ -719,14 +1020,14 @@ extern void ip_vs_conn_fill_cport(struct ip_vs_conn *cp, __be16 cport); | |||
| 719 | struct ip_vs_conn *ip_vs_conn_new(const struct ip_vs_conn_param *p, | 1020 | struct ip_vs_conn *ip_vs_conn_new(const struct ip_vs_conn_param *p, |
| 720 | const union nf_inet_addr *daddr, | 1021 | const union nf_inet_addr *daddr, |
| 721 | __be16 dport, unsigned flags, | 1022 | __be16 dport, unsigned flags, |
| 722 | struct ip_vs_dest *dest); | 1023 | struct ip_vs_dest *dest, __u32 fwmark); |
| 723 | extern void ip_vs_conn_expire_now(struct ip_vs_conn *cp); | 1024 | extern void ip_vs_conn_expire_now(struct ip_vs_conn *cp); |
| 724 | 1025 | ||
| 725 | extern const char * ip_vs_state_name(__u16 proto, int state); | 1026 | extern const char * ip_vs_state_name(__u16 proto, int state); |
| 726 | 1027 | ||
| 727 | extern void ip_vs_tcp_conn_listen(struct ip_vs_conn *cp); | 1028 | extern void ip_vs_tcp_conn_listen(struct net *net, struct ip_vs_conn *cp); |
| 728 | extern int ip_vs_check_template(struct ip_vs_conn *ct); | 1029 | extern int ip_vs_check_template(struct ip_vs_conn *ct); |
| 729 | extern void ip_vs_random_dropentry(void); | 1030 | extern void ip_vs_random_dropentry(struct net *net); |
| 730 | extern int ip_vs_conn_init(void); | 1031 | extern int ip_vs_conn_init(void); |
| 731 | extern void ip_vs_conn_cleanup(void); | 1032 | extern void ip_vs_conn_cleanup(void); |
| 732 | 1033 | ||
| @@ -796,12 +1097,12 @@ ip_vs_control_add(struct ip_vs_conn *cp, struct ip_vs_conn *ctl_cp) | |||
| 796 | * (from ip_vs_app.c) | 1097 | * (from ip_vs_app.c) |
| 797 | */ | 1098 | */ |
| 798 | #define IP_VS_APP_MAX_PORTS 8 | 1099 | #define IP_VS_APP_MAX_PORTS 8 |
| 799 | extern int register_ip_vs_app(struct ip_vs_app *app); | 1100 | extern int register_ip_vs_app(struct net *net, struct ip_vs_app *app); |
| 800 | extern void unregister_ip_vs_app(struct ip_vs_app *app); | 1101 | extern void unregister_ip_vs_app(struct net *net, struct ip_vs_app *app); |
| 801 | extern int ip_vs_bind_app(struct ip_vs_conn *cp, struct ip_vs_protocol *pp); | 1102 | extern int ip_vs_bind_app(struct ip_vs_conn *cp, struct ip_vs_protocol *pp); |
| 802 | extern void ip_vs_unbind_app(struct ip_vs_conn *cp); | 1103 | extern void ip_vs_unbind_app(struct ip_vs_conn *cp); |
| 803 | extern int | 1104 | extern int register_ip_vs_app_inc(struct net *net, struct ip_vs_app *app, |
| 804 | register_ip_vs_app_inc(struct ip_vs_app *app, __u16 proto, __u16 port); | 1105 | __u16 proto, __u16 port); |
| 805 | extern int ip_vs_app_inc_get(struct ip_vs_app *inc); | 1106 | extern int ip_vs_app_inc_get(struct ip_vs_app *inc); |
| 806 | extern void ip_vs_app_inc_put(struct ip_vs_app *inc); | 1107 | extern void ip_vs_app_inc_put(struct ip_vs_app *inc); |
| 807 | 1108 | ||
| @@ -814,15 +1115,27 @@ void ip_vs_bind_pe(struct ip_vs_service *svc, struct ip_vs_pe *pe); | |||
| 814 | void ip_vs_unbind_pe(struct ip_vs_service *svc); | 1115 | void ip_vs_unbind_pe(struct ip_vs_service *svc); |
| 815 | int register_ip_vs_pe(struct ip_vs_pe *pe); | 1116 | int register_ip_vs_pe(struct ip_vs_pe *pe); |
| 816 | int unregister_ip_vs_pe(struct ip_vs_pe *pe); | 1117 | int unregister_ip_vs_pe(struct ip_vs_pe *pe); |
| 817 | extern struct ip_vs_pe *ip_vs_pe_get(const char *name); | 1118 | struct ip_vs_pe *ip_vs_pe_getbyname(const char *name); |
| 818 | extern void ip_vs_pe_put(struct ip_vs_pe *pe); | 1119 | struct ip_vs_pe *__ip_vs_pe_getbyname(const char *pe_name); |
| 1120 | |||
| 1121 | static inline void ip_vs_pe_get(const struct ip_vs_pe *pe) | ||
| 1122 | { | ||
| 1123 | if (pe && pe->module) | ||
| 1124 | __module_get(pe->module); | ||
| 1125 | } | ||
| 1126 | |||
| 1127 | static inline void ip_vs_pe_put(const struct ip_vs_pe *pe) | ||
| 1128 | { | ||
| 1129 | if (pe && pe->module) | ||
| 1130 | module_put(pe->module); | ||
| 1131 | } | ||
| 819 | 1132 | ||
| 820 | /* | 1133 | /* |
| 821 | * IPVS protocol functions (from ip_vs_proto.c) | 1134 | * IPVS protocol functions (from ip_vs_proto.c) |
| 822 | */ | 1135 | */ |
| 823 | extern int ip_vs_protocol_init(void); | 1136 | extern int ip_vs_protocol_init(void); |
| 824 | extern void ip_vs_protocol_cleanup(void); | 1137 | extern void ip_vs_protocol_cleanup(void); |
| 825 | extern void ip_vs_protocol_timeout_change(int flags); | 1138 | extern void ip_vs_protocol_timeout_change(struct netns_ipvs *ipvs, int flags); |
| 826 | extern int *ip_vs_create_timeout_table(int *table, int size); | 1139 | extern int *ip_vs_create_timeout_table(int *table, int size); |
| 827 | extern int | 1140 | extern int |
| 828 | ip_vs_set_state_timeout(int *table, int num, const char *const *names, | 1141 | ip_vs_set_state_timeout(int *table, int num, const char *const *names, |
| @@ -852,26 +1165,23 @@ extern struct ip_vs_scheduler *ip_vs_scheduler_get(const char *sched_name); | |||
| 852 | extern void ip_vs_scheduler_put(struct ip_vs_scheduler *scheduler); | 1165 | extern void ip_vs_scheduler_put(struct ip_vs_scheduler *scheduler); |
| 853 | extern struct ip_vs_conn * | 1166 | extern struct ip_vs_conn * |
| 854 | ip_vs_schedule(struct ip_vs_service *svc, struct sk_buff *skb, | 1167 | ip_vs_schedule(struct ip_vs_service *svc, struct sk_buff *skb, |
| 855 | struct ip_vs_protocol *pp, int *ignored); | 1168 | struct ip_vs_proto_data *pd, int *ignored); |
| 856 | extern int ip_vs_leave(struct ip_vs_service *svc, struct sk_buff *skb, | 1169 | extern int ip_vs_leave(struct ip_vs_service *svc, struct sk_buff *skb, |
| 857 | struct ip_vs_protocol *pp); | 1170 | struct ip_vs_proto_data *pd); |
| 1171 | |||
| 1172 | extern void ip_vs_scheduler_err(struct ip_vs_service *svc, const char *msg); | ||
| 858 | 1173 | ||
| 859 | 1174 | ||
| 860 | /* | 1175 | /* |
| 861 | * IPVS control data and functions (from ip_vs_ctl.c) | 1176 | * IPVS control data and functions (from ip_vs_ctl.c) |
| 862 | */ | 1177 | */ |
| 863 | extern int sysctl_ip_vs_cache_bypass; | ||
| 864 | extern int sysctl_ip_vs_expire_nodest_conn; | ||
| 865 | extern int sysctl_ip_vs_expire_quiescent_template; | ||
| 866 | extern int sysctl_ip_vs_sync_threshold[2]; | ||
| 867 | extern int sysctl_ip_vs_nat_icmp_send; | ||
| 868 | extern int sysctl_ip_vs_conntrack; | ||
| 869 | extern int sysctl_ip_vs_snat_reroute; | ||
| 870 | extern struct ip_vs_stats ip_vs_stats; | 1178 | extern struct ip_vs_stats ip_vs_stats; |
| 871 | extern const struct ctl_path net_vs_ctl_path[]; | 1179 | extern const struct ctl_path net_vs_ctl_path[]; |
| 1180 | extern int sysctl_ip_vs_sync_ver; | ||
| 872 | 1181 | ||
| 1182 | extern void ip_vs_sync_switch_mode(struct net *net, int mode); | ||
| 873 | extern struct ip_vs_service * | 1183 | extern struct ip_vs_service * |
| 874 | ip_vs_service_get(int af, __u32 fwmark, __u16 protocol, | 1184 | ip_vs_service_get(struct net *net, int af, __u32 fwmark, __u16 protocol, |
| 875 | const union nf_inet_addr *vaddr, __be16 vport); | 1185 | const union nf_inet_addr *vaddr, __be16 vport); |
| 876 | 1186 | ||
| 877 | static inline void ip_vs_service_put(struct ip_vs_service *svc) | 1187 | static inline void ip_vs_service_put(struct ip_vs_service *svc) |
| @@ -880,7 +1190,7 @@ static inline void ip_vs_service_put(struct ip_vs_service *svc) | |||
| 880 | } | 1190 | } |
| 881 | 1191 | ||
| 882 | extern struct ip_vs_dest * | 1192 | extern struct ip_vs_dest * |
| 883 | ip_vs_lookup_real_service(int af, __u16 protocol, | 1193 | ip_vs_lookup_real_service(struct net *net, int af, __u16 protocol, |
| 884 | const union nf_inet_addr *daddr, __be16 dport); | 1194 | const union nf_inet_addr *daddr, __be16 dport); |
| 885 | 1195 | ||
| 886 | extern int ip_vs_use_count_inc(void); | 1196 | extern int ip_vs_use_count_inc(void); |
| @@ -888,8 +1198,9 @@ extern void ip_vs_use_count_dec(void); | |||
| 888 | extern int ip_vs_control_init(void); | 1198 | extern int ip_vs_control_init(void); |
| 889 | extern void ip_vs_control_cleanup(void); | 1199 | extern void ip_vs_control_cleanup(void); |
| 890 | extern struct ip_vs_dest * | 1200 | extern struct ip_vs_dest * |
| 891 | ip_vs_find_dest(int af, const union nf_inet_addr *daddr, __be16 dport, | 1201 | ip_vs_find_dest(struct net *net, int af, const union nf_inet_addr *daddr, |
| 892 | const union nf_inet_addr *vaddr, __be16 vport, __u16 protocol); | 1202 | __be16 dport, const union nf_inet_addr *vaddr, __be16 vport, |
| 1203 | __u16 protocol, __u32 fwmark); | ||
| 893 | extern struct ip_vs_dest *ip_vs_try_bind_dest(struct ip_vs_conn *cp); | 1204 | extern struct ip_vs_dest *ip_vs_try_bind_dest(struct ip_vs_conn *cp); |
| 894 | 1205 | ||
| 895 | 1206 | ||
| @@ -897,14 +1208,12 @@ extern struct ip_vs_dest *ip_vs_try_bind_dest(struct ip_vs_conn *cp); | |||
| 897 | * IPVS sync daemon data and function prototypes | 1208 | * IPVS sync daemon data and function prototypes |
| 898 | * (from ip_vs_sync.c) | 1209 | * (from ip_vs_sync.c) |
| 899 | */ | 1210 | */ |
| 900 | extern volatile int ip_vs_sync_state; | 1211 | extern int start_sync_thread(struct net *net, int state, char *mcast_ifn, |
| 901 | extern volatile int ip_vs_master_syncid; | 1212 | __u8 syncid); |
| 902 | extern volatile int ip_vs_backup_syncid; | 1213 | extern int stop_sync_thread(struct net *net, int state); |
| 903 | extern char ip_vs_master_mcast_ifn[IP_VS_IFNAME_MAXLEN]; | 1214 | extern void ip_vs_sync_conn(struct net *net, struct ip_vs_conn *cp); |
| 904 | extern char ip_vs_backup_mcast_ifn[IP_VS_IFNAME_MAXLEN]; | 1215 | extern int ip_vs_sync_init(void); |
| 905 | extern int start_sync_thread(int state, char *mcast_ifn, __u8 syncid); | 1216 | extern void ip_vs_sync_cleanup(void); |
| 906 | extern int stop_sync_thread(int state); | ||
| 907 | extern void ip_vs_sync_conn(struct ip_vs_conn *cp); | ||
| 908 | 1217 | ||
| 909 | 1218 | ||
| 910 | /* | 1219 | /* |
| @@ -912,9 +1221,11 @@ extern void ip_vs_sync_conn(struct ip_vs_conn *cp); | |||
| 912 | */ | 1221 | */ |
| 913 | extern int ip_vs_estimator_init(void); | 1222 | extern int ip_vs_estimator_init(void); |
| 914 | extern void ip_vs_estimator_cleanup(void); | 1223 | extern void ip_vs_estimator_cleanup(void); |
| 915 | extern void ip_vs_new_estimator(struct ip_vs_stats *stats); | 1224 | extern void ip_vs_start_estimator(struct net *net, struct ip_vs_stats *stats); |
| 916 | extern void ip_vs_kill_estimator(struct ip_vs_stats *stats); | 1225 | extern void ip_vs_stop_estimator(struct net *net, struct ip_vs_stats *stats); |
| 917 | extern void ip_vs_zero_estimator(struct ip_vs_stats *stats); | 1226 | extern void ip_vs_zero_estimator(struct ip_vs_stats *stats); |
| 1227 | extern void ip_vs_read_estimator(struct ip_vs_stats_user *dst, | ||
| 1228 | struct ip_vs_stats *stats); | ||
| 918 | 1229 | ||
| 919 | /* | 1230 | /* |
| 920 | * Various IPVS packet transmitters (from ip_vs_xmit.c) | 1231 | * Various IPVS packet transmitters (from ip_vs_xmit.c) |
| @@ -947,21 +1258,25 @@ extern int ip_vs_icmp_xmit_v6 | |||
| 947 | int offset); | 1258 | int offset); |
| 948 | #endif | 1259 | #endif |
| 949 | 1260 | ||
| 1261 | #ifdef CONFIG_SYSCTL | ||
| 950 | /* | 1262 | /* |
| 951 | * This is a simple mechanism to ignore packets when | 1263 | * This is a simple mechanism to ignore packets when |
| 952 | * we are loaded. Just set ip_vs_drop_rate to 'n' and | 1264 | * we are loaded. Just set ip_vs_drop_rate to 'n' and |
| 953 | * we start to drop 1/rate of the packets | 1265 | * we start to drop 1/rate of the packets |
| 954 | */ | 1266 | */ |
| 955 | extern int ip_vs_drop_rate; | ||
| 956 | extern int ip_vs_drop_counter; | ||
| 957 | 1267 | ||
| 958 | static __inline__ int ip_vs_todrop(void) | 1268 | static inline int ip_vs_todrop(struct netns_ipvs *ipvs) |
| 959 | { | 1269 | { |
| 960 | if (!ip_vs_drop_rate) return 0; | 1270 | if (!ipvs->drop_rate) |
| 961 | if (--ip_vs_drop_counter > 0) return 0; | 1271 | return 0; |
| 962 | ip_vs_drop_counter = ip_vs_drop_rate; | 1272 | if (--ipvs->drop_counter > 0) |
| 1273 | return 0; | ||
| 1274 | ipvs->drop_counter = ipvs->drop_rate; | ||
| 963 | return 1; | 1275 | return 1; |
| 964 | } | 1276 | } |
| 1277 | #else | ||
| 1278 | static inline int ip_vs_todrop(struct netns_ipvs *ipvs) { return 0; } | ||
| 1279 | #endif | ||
| 965 | 1280 | ||
| 966 | /* | 1281 | /* |
| 967 | * ip_vs_fwd_tag returns the forwarding tag of the connection | 1282 | * ip_vs_fwd_tag returns the forwarding tag of the connection |
| @@ -1031,7 +1346,7 @@ static inline void ip_vs_notrack(struct sk_buff *skb) | |||
| 1031 | { | 1346 | { |
| 1032 | #if defined(CONFIG_NF_CONNTRACK) || defined(CONFIG_NF_CONNTRACK_MODULE) | 1347 | #if defined(CONFIG_NF_CONNTRACK) || defined(CONFIG_NF_CONNTRACK_MODULE) |
| 1033 | enum ip_conntrack_info ctinfo; | 1348 | enum ip_conntrack_info ctinfo; |
| 1034 | struct nf_conn *ct = ct = nf_ct_get(skb, &ctinfo); | 1349 | struct nf_conn *ct = nf_ct_get(skb, &ctinfo); |
| 1035 | 1350 | ||
| 1036 | if (!ct || !nf_ct_is_untracked(ct)) { | 1351 | if (!ct || !nf_ct_is_untracked(ct)) { |
| 1037 | nf_reset(skb); | 1352 | nf_reset(skb); |
| @@ -1047,9 +1362,13 @@ static inline void ip_vs_notrack(struct sk_buff *skb) | |||
| 1047 | * Netfilter connection tracking | 1362 | * Netfilter connection tracking |
| 1048 | * (from ip_vs_nfct.c) | 1363 | * (from ip_vs_nfct.c) |
| 1049 | */ | 1364 | */ |
| 1050 | static inline int ip_vs_conntrack_enabled(void) | 1365 | static inline int ip_vs_conntrack_enabled(struct netns_ipvs *ipvs) |
| 1051 | { | 1366 | { |
| 1052 | return sysctl_ip_vs_conntrack; | 1367 | #ifdef CONFIG_SYSCTL |
| 1368 | return ipvs->sysctl_conntrack; | ||
| 1369 | #else | ||
| 1370 | return 0; | ||
| 1371 | #endif | ||
| 1053 | } | 1372 | } |
| 1054 | 1373 | ||
| 1055 | extern void ip_vs_update_conntrack(struct sk_buff *skb, struct ip_vs_conn *cp, | 1374 | extern void ip_vs_update_conntrack(struct sk_buff *skb, struct ip_vs_conn *cp, |
| @@ -1062,7 +1381,7 @@ extern void ip_vs_conn_drop_conntrack(struct ip_vs_conn *cp); | |||
| 1062 | 1381 | ||
| 1063 | #else | 1382 | #else |
| 1064 | 1383 | ||
| 1065 | static inline int ip_vs_conntrack_enabled(void) | 1384 | static inline int ip_vs_conntrack_enabled(struct netns_ipvs *ipvs) |
| 1066 | { | 1385 | { |
| 1067 | return 0; | 1386 | return 0; |
| 1068 | } | 1387 | } |
| @@ -1084,6 +1403,20 @@ static inline void ip_vs_conn_drop_conntrack(struct ip_vs_conn *cp) | |||
| 1084 | /* CONFIG_IP_VS_NFCT */ | 1403 | /* CONFIG_IP_VS_NFCT */ |
| 1085 | #endif | 1404 | #endif |
| 1086 | 1405 | ||
| 1406 | static inline unsigned int | ||
| 1407 | ip_vs_dest_conn_overhead(struct ip_vs_dest *dest) | ||
| 1408 | { | ||
| 1409 | /* | ||
| 1410 | * We think the overhead of processing active connections is 256 | ||
| 1411 | * times higher than that of inactive connections in average. (This | ||
| 1412 | * 256 times might not be accurate, we will change it later) We | ||
| 1413 | * use the following formula to estimate the overhead now: | ||
| 1414 | * dest->activeconns*256 + dest->inactconns | ||
| 1415 | */ | ||
| 1416 | return (atomic_read(&dest->activeconns) << 8) + | ||
| 1417 | atomic_read(&dest->inactconns); | ||
| 1418 | } | ||
| 1419 | |||
| 1087 | #endif /* __KERNEL__ */ | 1420 | #endif /* __KERNEL__ */ |
| 1088 | 1421 | ||
| 1089 | #endif /* _NET_IP_VS_H */ | 1422 | #endif /* _NET_IP_VS_H */ |
diff --git a/include/net/ipv6.h b/include/net/ipv6.h index 4a3cd2cd2f5e..34200f9e6805 100644 --- a/include/net/ipv6.h +++ b/include/net/ipv6.h | |||
| @@ -89,6 +89,18 @@ | |||
| 89 | #define IPV6_ADDR_SCOPE_GLOBAL 0x0e | 89 | #define IPV6_ADDR_SCOPE_GLOBAL 0x0e |
| 90 | 90 | ||
| 91 | /* | 91 | /* |
| 92 | * Addr flags | ||
| 93 | */ | ||
| 94 | #ifdef __KERNEL__ | ||
| 95 | #define IPV6_ADDR_MC_FLAG_TRANSIENT(a) \ | ||
| 96 | ((a)->s6_addr[1] & 0x10) | ||
| 97 | #define IPV6_ADDR_MC_FLAG_PREFIX(a) \ | ||
| 98 | ((a)->s6_addr[1] & 0x20) | ||
| 99 | #define IPV6_ADDR_MC_FLAG_RENDEZVOUS(a) \ | ||
| 100 | ((a)->s6_addr[1] & 0x40) | ||
| 101 | #endif | ||
| 102 | |||
| 103 | /* | ||
| 92 | * fragmentation header | 104 | * fragmentation header |
| 93 | */ | 105 | */ |
| 94 | 106 | ||
| @@ -480,7 +492,7 @@ extern int ip6_rcv_finish(struct sk_buff *skb); | |||
| 480 | */ | 492 | */ |
| 481 | extern int ip6_xmit(struct sock *sk, | 493 | extern int ip6_xmit(struct sock *sk, |
| 482 | struct sk_buff *skb, | 494 | struct sk_buff *skb, |
| 483 | struct flowi *fl, | 495 | struct flowi6 *fl6, |
| 484 | struct ipv6_txoptions *opt); | 496 | struct ipv6_txoptions *opt); |
| 485 | 497 | ||
| 486 | extern int ip6_nd_hdr(struct sock *sk, | 498 | extern int ip6_nd_hdr(struct sock *sk, |
| @@ -500,7 +512,7 @@ extern int ip6_append_data(struct sock *sk, | |||
| 500 | int hlimit, | 512 | int hlimit, |
| 501 | int tclass, | 513 | int tclass, |
| 502 | struct ipv6_txoptions *opt, | 514 | struct ipv6_txoptions *opt, |
| 503 | struct flowi *fl, | 515 | struct flowi6 *fl6, |
| 504 | struct rt6_info *rt, | 516 | struct rt6_info *rt, |
| 505 | unsigned int flags, | 517 | unsigned int flags, |
| 506 | int dontfrag); | 518 | int dontfrag); |
| @@ -511,13 +523,17 @@ extern void ip6_flush_pending_frames(struct sock *sk); | |||
| 511 | 523 | ||
| 512 | extern int ip6_dst_lookup(struct sock *sk, | 524 | extern int ip6_dst_lookup(struct sock *sk, |
| 513 | struct dst_entry **dst, | 525 | struct dst_entry **dst, |
| 514 | struct flowi *fl); | 526 | struct flowi6 *fl6); |
| 515 | extern int ip6_dst_blackhole(struct sock *sk, | 527 | extern struct dst_entry * ip6_dst_lookup_flow(struct sock *sk, |
| 516 | struct dst_entry **dst, | 528 | struct flowi6 *fl6, |
| 517 | struct flowi *fl); | 529 | const struct in6_addr *final_dst, |
| 518 | extern int ip6_sk_dst_lookup(struct sock *sk, | 530 | bool can_sleep); |
| 519 | struct dst_entry **dst, | 531 | extern struct dst_entry * ip6_sk_dst_lookup_flow(struct sock *sk, |
| 520 | struct flowi *fl); | 532 | struct flowi6 *fl6, |
| 533 | const struct in6_addr *final_dst, | ||
| 534 | bool can_sleep); | ||
| 535 | extern struct dst_entry * ip6_blackhole_route(struct net *net, | ||
| 536 | struct dst_entry *orig_dst); | ||
| 521 | 537 | ||
| 522 | /* | 538 | /* |
| 523 | * skb processing functions | 539 | * skb processing functions |
| @@ -550,7 +566,7 @@ extern int ipv6_ext_hdr(u8 nexthdr); | |||
| 550 | 566 | ||
| 551 | extern int ipv6_find_tlv(struct sk_buff *skb, int offset, int type); | 567 | extern int ipv6_find_tlv(struct sk_buff *skb, int offset, int type); |
| 552 | 568 | ||
| 553 | extern struct in6_addr *fl6_update_dst(struct flowi *fl, | 569 | extern struct in6_addr *fl6_update_dst(struct flowi6 *fl6, |
| 554 | const struct ipv6_txoptions *opt, | 570 | const struct ipv6_txoptions *opt, |
| 555 | struct in6_addr *orig); | 571 | struct in6_addr *orig); |
| 556 | 572 | ||
| @@ -584,8 +600,8 @@ extern int ipv6_recv_error(struct sock *sk, struct msghdr *msg, int len); | |||
| 584 | extern int ipv6_recv_rxpmtu(struct sock *sk, struct msghdr *msg, int len); | 600 | extern int ipv6_recv_rxpmtu(struct sock *sk, struct msghdr *msg, int len); |
| 585 | extern void ipv6_icmp_error(struct sock *sk, struct sk_buff *skb, int err, __be16 port, | 601 | extern void ipv6_icmp_error(struct sock *sk, struct sk_buff *skb, int err, __be16 port, |
| 586 | u32 info, u8 *payload); | 602 | u32 info, u8 *payload); |
| 587 | extern void ipv6_local_error(struct sock *sk, int err, struct flowi *fl, u32 info); | 603 | extern void ipv6_local_error(struct sock *sk, int err, struct flowi6 *fl6, u32 info); |
| 588 | extern void ipv6_local_rxpmtu(struct sock *sk, struct flowi *fl, u32 mtu); | 604 | extern void ipv6_local_rxpmtu(struct sock *sk, struct flowi6 *fl6, u32 mtu); |
| 589 | 605 | ||
| 590 | extern int inet6_release(struct socket *sock); | 606 | extern int inet6_release(struct socket *sock); |
| 591 | extern int inet6_bind(struct socket *sock, struct sockaddr *uaddr, | 607 | extern int inet6_bind(struct socket *sock, struct sockaddr *uaddr, |
diff --git a/include/net/irda/ircomm_tty.h b/include/net/irda/ircomm_tty.h index eea2e6152389..59ba38bc400f 100644 --- a/include/net/irda/ircomm_tty.h +++ b/include/net/irda/ircomm_tty.h | |||
| @@ -120,10 +120,10 @@ struct ircomm_tty_cb { | |||
| 120 | void ircomm_tty_start(struct tty_struct *tty); | 120 | void ircomm_tty_start(struct tty_struct *tty); |
| 121 | void ircomm_tty_check_modem_status(struct ircomm_tty_cb *self); | 121 | void ircomm_tty_check_modem_status(struct ircomm_tty_cb *self); |
| 122 | 122 | ||
| 123 | extern int ircomm_tty_tiocmget(struct tty_struct *tty, struct file *file); | 123 | extern int ircomm_tty_tiocmget(struct tty_struct *tty); |
| 124 | extern int ircomm_tty_tiocmset(struct tty_struct *tty, struct file *file, | 124 | extern int ircomm_tty_tiocmset(struct tty_struct *tty, |
| 125 | unsigned int set, unsigned int clear); | 125 | unsigned int set, unsigned int clear); |
| 126 | extern int ircomm_tty_ioctl(struct tty_struct *tty, struct file *file, | 126 | extern int ircomm_tty_ioctl(struct tty_struct *tty, |
| 127 | unsigned int cmd, unsigned long arg); | 127 | unsigned int cmd, unsigned long arg); |
| 128 | extern void ircomm_tty_set_termios(struct tty_struct *tty, | 128 | extern void ircomm_tty_set_termios(struct tty_struct *tty, |
| 129 | struct ktermios *old_termios); | 129 | struct ktermios *old_termios); |
diff --git a/include/net/mac80211.h b/include/net/mac80211.h index 62c0ce2d1dc8..8650e7bf2ed0 100644 --- a/include/net/mac80211.h +++ b/include/net/mac80211.h | |||
| @@ -341,6 +341,9 @@ struct ieee80211_bss_conf { | |||
| 341 | * the off-channel channel when a remain-on-channel offload is done | 341 | * the off-channel channel when a remain-on-channel offload is done |
| 342 | * in hardware -- normal packets still flow and are expected to be | 342 | * in hardware -- normal packets still flow and are expected to be |
| 343 | * handled properly by the device. | 343 | * handled properly by the device. |
| 344 | * @IEEE80211_TX_INTFL_TKIP_MIC_FAILURE: Marks this packet to be used for TKIP | ||
| 345 | * testing. It will be sent out with incorrect Michael MIC key to allow | ||
| 346 | * TKIP countermeasures to be tested. | ||
| 344 | * | 347 | * |
| 345 | * Note: If you have to add new flags to the enumeration, then don't | 348 | * Note: If you have to add new flags to the enumeration, then don't |
| 346 | * forget to update %IEEE80211_TX_TEMPORARY_FLAGS when necessary. | 349 | * forget to update %IEEE80211_TX_TEMPORARY_FLAGS when necessary. |
| @@ -370,6 +373,7 @@ enum mac80211_tx_control_flags { | |||
| 370 | IEEE80211_TX_CTL_LDPC = BIT(22), | 373 | IEEE80211_TX_CTL_LDPC = BIT(22), |
| 371 | IEEE80211_TX_CTL_STBC = BIT(23) | BIT(24), | 374 | IEEE80211_TX_CTL_STBC = BIT(23) | BIT(24), |
| 372 | IEEE80211_TX_CTL_TX_OFFCHAN = BIT(25), | 375 | IEEE80211_TX_CTL_TX_OFFCHAN = BIT(25), |
| 376 | IEEE80211_TX_INTFL_TKIP_MIC_FAILURE = BIT(26), | ||
| 373 | }; | 377 | }; |
| 374 | 378 | ||
| 375 | #define IEEE80211_TX_CTL_STBC_SHIFT 23 | 379 | #define IEEE80211_TX_CTL_STBC_SHIFT 23 |
| @@ -595,9 +599,10 @@ ieee80211_tx_info_clear_status(struct ieee80211_tx_info *info) | |||
| 595 | * the frame. | 599 | * the frame. |
| 596 | * @RX_FLAG_FAILED_PLCP_CRC: Set this flag if the PCLP check failed on | 600 | * @RX_FLAG_FAILED_PLCP_CRC: Set this flag if the PCLP check failed on |
| 597 | * the frame. | 601 | * the frame. |
| 598 | * @RX_FLAG_TSFT: The timestamp passed in the RX status (@mactime field) | 602 | * @RX_FLAG_MACTIME_MPDU: The timestamp passed in the RX status (@mactime |
| 599 | * is valid. This is useful in monitor mode and necessary for beacon frames | 603 | * field) is valid and contains the time the first symbol of the MPDU |
| 600 | * to enable IBSS merging. | 604 | * was received. This is useful in monitor mode and for proper IBSS |
| 605 | * merging. | ||
| 601 | * @RX_FLAG_SHORTPRE: Short preamble was used for this frame | 606 | * @RX_FLAG_SHORTPRE: Short preamble was used for this frame |
| 602 | * @RX_FLAG_HT: HT MCS was used and rate_idx is MCS index | 607 | * @RX_FLAG_HT: HT MCS was used and rate_idx is MCS index |
| 603 | * @RX_FLAG_40MHZ: HT40 (40 MHz) was used | 608 | * @RX_FLAG_40MHZ: HT40 (40 MHz) was used |
| @@ -610,7 +615,7 @@ enum mac80211_rx_flags { | |||
| 610 | RX_FLAG_IV_STRIPPED = 1<<4, | 615 | RX_FLAG_IV_STRIPPED = 1<<4, |
| 611 | RX_FLAG_FAILED_FCS_CRC = 1<<5, | 616 | RX_FLAG_FAILED_FCS_CRC = 1<<5, |
| 612 | RX_FLAG_FAILED_PLCP_CRC = 1<<6, | 617 | RX_FLAG_FAILED_PLCP_CRC = 1<<6, |
| 613 | RX_FLAG_TSFT = 1<<7, | 618 | RX_FLAG_MACTIME_MPDU = 1<<7, |
| 614 | RX_FLAG_SHORTPRE = 1<<8, | 619 | RX_FLAG_SHORTPRE = 1<<8, |
| 615 | RX_FLAG_HT = 1<<9, | 620 | RX_FLAG_HT = 1<<9, |
| 616 | RX_FLAG_40MHZ = 1<<10, | 621 | RX_FLAG_40MHZ = 1<<10, |
| @@ -1069,6 +1074,13 @@ enum ieee80211_tkip_key_type { | |||
| 1069 | * to decrypt group addressed frames, then IBSS RSN support is still | 1074 | * to decrypt group addressed frames, then IBSS RSN support is still |
| 1070 | * possible but software crypto will be used. Advertise the wiphy flag | 1075 | * possible but software crypto will be used. Advertise the wiphy flag |
| 1071 | * only in that case. | 1076 | * only in that case. |
| 1077 | * | ||
| 1078 | * @IEEE80211_HW_AP_LINK_PS: When operating in AP mode the device | ||
| 1079 | * autonomously manages the PS status of connected stations. When | ||
| 1080 | * this flag is set mac80211 will not trigger PS mode for connected | ||
| 1081 | * stations based on the PM bit of incoming frames. | ||
| 1082 | * Use ieee80211_start_ps()/ieee8021_end_ps() to manually configure | ||
| 1083 | * the PS mode of connected stations. | ||
| 1072 | */ | 1084 | */ |
| 1073 | enum ieee80211_hw_flags { | 1085 | enum ieee80211_hw_flags { |
| 1074 | IEEE80211_HW_HAS_RATE_CONTROL = 1<<0, | 1086 | IEEE80211_HW_HAS_RATE_CONTROL = 1<<0, |
| @@ -1093,6 +1105,7 @@ enum ieee80211_hw_flags { | |||
| 1093 | IEEE80211_HW_CONNECTION_MONITOR = 1<<19, | 1105 | IEEE80211_HW_CONNECTION_MONITOR = 1<<19, |
| 1094 | IEEE80211_HW_SUPPORTS_CQM_RSSI = 1<<20, | 1106 | IEEE80211_HW_SUPPORTS_CQM_RSSI = 1<<20, |
| 1095 | IEEE80211_HW_SUPPORTS_PER_STA_GTK = 1<<21, | 1107 | IEEE80211_HW_SUPPORTS_PER_STA_GTK = 1<<21, |
| 1108 | IEEE80211_HW_AP_LINK_PS = 1<<22, | ||
| 1096 | }; | 1109 | }; |
| 1097 | 1110 | ||
| 1098 | /** | 1111 | /** |
| @@ -1147,6 +1160,17 @@ enum ieee80211_hw_flags { | |||
| 1147 | * @napi_weight: weight used for NAPI polling. You must specify an | 1160 | * @napi_weight: weight used for NAPI polling. You must specify an |
| 1148 | * appropriate value here if a napi_poll operation is provided | 1161 | * appropriate value here if a napi_poll operation is provided |
| 1149 | * by your driver. | 1162 | * by your driver. |
| 1163 | |||
| 1164 | * @max_rx_aggregation_subframes: maximum buffer size (number of | ||
| 1165 | * sub-frames) to be used for A-MPDU block ack receiver | ||
| 1166 | * aggregation. | ||
| 1167 | * This is only relevant if the device has restrictions on the | ||
| 1168 | * number of subframes, if it relies on mac80211 to do reordering | ||
| 1169 | * it shouldn't be set. | ||
| 1170 | * | ||
| 1171 | * @max_tx_aggregation_subframes: maximum number of subframes in an | ||
| 1172 | * aggregate an HT driver will transmit, used by the peer as a | ||
| 1173 | * hint to size its reorder buffer. | ||
| 1150 | */ | 1174 | */ |
| 1151 | struct ieee80211_hw { | 1175 | struct ieee80211_hw { |
| 1152 | struct ieee80211_conf conf; | 1176 | struct ieee80211_conf conf; |
| @@ -1165,6 +1189,8 @@ struct ieee80211_hw { | |||
| 1165 | u8 max_rates; | 1189 | u8 max_rates; |
| 1166 | u8 max_report_rates; | 1190 | u8 max_report_rates; |
| 1167 | u8 max_rate_tries; | 1191 | u8 max_rate_tries; |
| 1192 | u8 max_rx_aggregation_subframes; | ||
| 1193 | u8 max_tx_aggregation_subframes; | ||
| 1168 | }; | 1194 | }; |
| 1169 | 1195 | ||
| 1170 | /** | 1196 | /** |
| @@ -1688,7 +1714,9 @@ enum ieee80211_ampdu_mlme_action { | |||
| 1688 | * station, AP, IBSS/WDS/mesh peer etc. This callback can sleep. | 1714 | * station, AP, IBSS/WDS/mesh peer etc. This callback can sleep. |
| 1689 | * | 1715 | * |
| 1690 | * @sta_notify: Notifies low level driver about power state transition of an | 1716 | * @sta_notify: Notifies low level driver about power state transition of an |
| 1691 | * associated station, AP, IBSS/WDS/mesh peer etc. Must be atomic. | 1717 | * associated station, AP, IBSS/WDS/mesh peer etc. For a VIF operating |
| 1718 | * in AP mode, this callback will not be called when the flag | ||
| 1719 | * %IEEE80211_HW_AP_LINK_PS is set. Must be atomic. | ||
| 1692 | * | 1720 | * |
| 1693 | * @conf_tx: Configure TX queue parameters (EDCF (aifs, cw_min, cw_max), | 1721 | * @conf_tx: Configure TX queue parameters (EDCF (aifs, cw_min, cw_max), |
| 1694 | * bursting) for a hardware TX queue. | 1722 | * bursting) for a hardware TX queue. |
| @@ -1723,6 +1751,10 @@ enum ieee80211_ampdu_mlme_action { | |||
| 1723 | * ieee80211_ampdu_mlme_action. Starting sequence number (@ssn) | 1751 | * ieee80211_ampdu_mlme_action. Starting sequence number (@ssn) |
| 1724 | * is the first frame we expect to perform the action on. Notice | 1752 | * is the first frame we expect to perform the action on. Notice |
| 1725 | * that TX/RX_STOP can pass NULL for this parameter. | 1753 | * that TX/RX_STOP can pass NULL for this parameter. |
| 1754 | * The @buf_size parameter is only valid when the action is set to | ||
| 1755 | * %IEEE80211_AMPDU_TX_OPERATIONAL and indicates the peer's reorder | ||
| 1756 | * buffer size (number of subframes) for this session -- aggregates | ||
| 1757 | * containing more subframes than this may not be transmitted to the peer. | ||
| 1726 | * Returns a negative error code on failure. | 1758 | * Returns a negative error code on failure. |
| 1727 | * The callback can sleep. | 1759 | * The callback can sleep. |
| 1728 | * | 1760 | * |
| @@ -1767,9 +1799,18 @@ enum ieee80211_ampdu_mlme_action { | |||
| 1767 | * ieee80211_remain_on_channel_expired(). This callback may sleep. | 1799 | * ieee80211_remain_on_channel_expired(). This callback may sleep. |
| 1768 | * @cancel_remain_on_channel: Requests that an ongoing off-channel period is | 1800 | * @cancel_remain_on_channel: Requests that an ongoing off-channel period is |
| 1769 | * aborted before it expires. This callback may sleep. | 1801 | * aborted before it expires. This callback may sleep. |
| 1802 | * @offchannel_tx: Transmit frame on another channel, wait for a response | ||
| 1803 | * and return. Reliable TX status must be reported for the frame. If the | ||
| 1804 | * return value is 1, then the @remain_on_channel will be used with a | ||
| 1805 | * regular transmission (if supported.) | ||
| 1806 | * @offchannel_tx_cancel_wait: cancel wait associated with offchannel TX | ||
| 1807 | * | ||
| 1808 | * @set_ringparam: Set tx and rx ring sizes. | ||
| 1809 | * | ||
| 1810 | * @get_ringparam: Get tx and rx ring current and maximum sizes. | ||
| 1770 | */ | 1811 | */ |
| 1771 | struct ieee80211_ops { | 1812 | struct ieee80211_ops { |
| 1772 | int (*tx)(struct ieee80211_hw *hw, struct sk_buff *skb); | 1813 | void (*tx)(struct ieee80211_hw *hw, struct sk_buff *skb); |
| 1773 | int (*start)(struct ieee80211_hw *hw); | 1814 | int (*start)(struct ieee80211_hw *hw); |
| 1774 | void (*stop)(struct ieee80211_hw *hw); | 1815 | void (*stop)(struct ieee80211_hw *hw); |
| 1775 | int (*add_interface)(struct ieee80211_hw *hw, | 1816 | int (*add_interface)(struct ieee80211_hw *hw, |
| @@ -1825,7 +1866,8 @@ struct ieee80211_ops { | |||
| 1825 | int (*ampdu_action)(struct ieee80211_hw *hw, | 1866 | int (*ampdu_action)(struct ieee80211_hw *hw, |
| 1826 | struct ieee80211_vif *vif, | 1867 | struct ieee80211_vif *vif, |
| 1827 | enum ieee80211_ampdu_mlme_action action, | 1868 | enum ieee80211_ampdu_mlme_action action, |
| 1828 | struct ieee80211_sta *sta, u16 tid, u16 *ssn); | 1869 | struct ieee80211_sta *sta, u16 tid, u16 *ssn, |
| 1870 | u8 buf_size); | ||
| 1829 | int (*get_survey)(struct ieee80211_hw *hw, int idx, | 1871 | int (*get_survey)(struct ieee80211_hw *hw, int idx, |
| 1830 | struct survey_info *survey); | 1872 | struct survey_info *survey); |
| 1831 | void (*rfkill_poll)(struct ieee80211_hw *hw); | 1873 | void (*rfkill_poll)(struct ieee80211_hw *hw); |
| @@ -1845,6 +1887,14 @@ struct ieee80211_ops { | |||
| 1845 | enum nl80211_channel_type channel_type, | 1887 | enum nl80211_channel_type channel_type, |
| 1846 | int duration); | 1888 | int duration); |
| 1847 | int (*cancel_remain_on_channel)(struct ieee80211_hw *hw); | 1889 | int (*cancel_remain_on_channel)(struct ieee80211_hw *hw); |
| 1890 | int (*offchannel_tx)(struct ieee80211_hw *hw, struct sk_buff *skb, | ||
| 1891 | struct ieee80211_channel *chan, | ||
| 1892 | enum nl80211_channel_type channel_type, | ||
| 1893 | unsigned int wait); | ||
| 1894 | int (*offchannel_tx_cancel_wait)(struct ieee80211_hw *hw); | ||
| 1895 | int (*set_ringparam)(struct ieee80211_hw *hw, u32 tx, u32 rx); | ||
| 1896 | void (*get_ringparam)(struct ieee80211_hw *hw, | ||
| 1897 | u32 *tx, u32 *tx_max, u32 *rx, u32 *rx_max); | ||
| 1848 | }; | 1898 | }; |
| 1849 | 1899 | ||
| 1850 | /** | 1900 | /** |
| @@ -2113,6 +2163,48 @@ static inline void ieee80211_rx_ni(struct ieee80211_hw *hw, | |||
| 2113 | local_bh_enable(); | 2163 | local_bh_enable(); |
| 2114 | } | 2164 | } |
| 2115 | 2165 | ||
| 2166 | /** | ||
| 2167 | * ieee80211_sta_ps_transition - PS transition for connected sta | ||
| 2168 | * | ||
| 2169 | * When operating in AP mode with the %IEEE80211_HW_AP_LINK_PS | ||
| 2170 | * flag set, use this function to inform mac80211 about a connected station | ||
| 2171 | * entering/leaving PS mode. | ||
| 2172 | * | ||
| 2173 | * This function may not be called in IRQ context or with softirqs enabled. | ||
| 2174 | * | ||
| 2175 | * Calls to this function for a single hardware must be synchronized against | ||
| 2176 | * each other. | ||
| 2177 | * | ||
| 2178 | * The function returns -EINVAL when the requested PS mode is already set. | ||
| 2179 | * | ||
| 2180 | * @sta: currently connected sta | ||
| 2181 | * @start: start or stop PS | ||
| 2182 | */ | ||
| 2183 | int ieee80211_sta_ps_transition(struct ieee80211_sta *sta, bool start); | ||
| 2184 | |||
| 2185 | /** | ||
| 2186 | * ieee80211_sta_ps_transition_ni - PS transition for connected sta | ||
| 2187 | * (in process context) | ||
| 2188 | * | ||
| 2189 | * Like ieee80211_sta_ps_transition() but can be called in process context | ||
| 2190 | * (internally disables bottom halves). Concurrent call restriction still | ||
| 2191 | * applies. | ||
| 2192 | * | ||
| 2193 | * @sta: currently connected sta | ||
| 2194 | * @start: start or stop PS | ||
| 2195 | */ | ||
| 2196 | static inline int ieee80211_sta_ps_transition_ni(struct ieee80211_sta *sta, | ||
| 2197 | bool start) | ||
| 2198 | { | ||
| 2199 | int ret; | ||
| 2200 | |||
| 2201 | local_bh_disable(); | ||
| 2202 | ret = ieee80211_sta_ps_transition(sta, start); | ||
| 2203 | local_bh_enable(); | ||
| 2204 | |||
| 2205 | return ret; | ||
| 2206 | } | ||
| 2207 | |||
| 2116 | /* | 2208 | /* |
| 2117 | * The TX headroom reserved by mac80211 for its own tx_status functions. | 2209 | * The TX headroom reserved by mac80211 for its own tx_status functions. |
| 2118 | * This is enough for the radiotap header. | 2210 | * This is enough for the radiotap header. |
diff --git a/include/net/net_namespace.h b/include/net/net_namespace.h index 1bf812b21fb7..3ae491932bc8 100644 --- a/include/net/net_namespace.h +++ b/include/net/net_namespace.h | |||
| @@ -27,6 +27,7 @@ struct sock; | |||
| 27 | struct ctl_table_header; | 27 | struct ctl_table_header; |
| 28 | struct net_generic; | 28 | struct net_generic; |
| 29 | struct sock; | 29 | struct sock; |
| 30 | struct netns_ipvs; | ||
| 30 | 31 | ||
| 31 | 32 | ||
| 32 | #define NETDEV_HASHBITS 8 | 33 | #define NETDEV_HASHBITS 8 |
| @@ -94,6 +95,7 @@ struct net { | |||
| 94 | #ifdef CONFIG_XFRM | 95 | #ifdef CONFIG_XFRM |
| 95 | struct netns_xfrm xfrm; | 96 | struct netns_xfrm xfrm; |
| 96 | #endif | 97 | #endif |
| 98 | struct netns_ipvs *ipvs; | ||
| 97 | }; | 99 | }; |
| 98 | 100 | ||
| 99 | 101 | ||
diff --git a/include/net/netevent.h b/include/net/netevent.h index e82b7bab3ff3..22b239c17eaa 100644 --- a/include/net/netevent.h +++ b/include/net/netevent.h | |||
| @@ -21,7 +21,6 @@ struct netevent_redirect { | |||
| 21 | 21 | ||
| 22 | enum netevent_notif_type { | 22 | enum netevent_notif_type { |
| 23 | NETEVENT_NEIGH_UPDATE = 1, /* arg is struct neighbour ptr */ | 23 | NETEVENT_NEIGH_UPDATE = 1, /* arg is struct neighbour ptr */ |
| 24 | NETEVENT_PMTU_UPDATE, /* arg is struct dst_entry ptr */ | ||
| 25 | NETEVENT_REDIRECT, /* arg is struct netevent_redirect ptr */ | 24 | NETEVENT_REDIRECT, /* arg is struct netevent_redirect ptr */ |
| 26 | }; | 25 | }; |
| 27 | 26 | ||
diff --git a/include/net/netfilter/nf_conntrack.h b/include/net/netfilter/nf_conntrack.h index d85cff10e169..d0d13378991e 100644 --- a/include/net/netfilter/nf_conntrack.h +++ b/include/net/netfilter/nf_conntrack.h | |||
| @@ -50,11 +50,24 @@ union nf_conntrack_expect_proto { | |||
| 50 | /* per conntrack: application helper private data */ | 50 | /* per conntrack: application helper private data */ |
| 51 | union nf_conntrack_help { | 51 | union nf_conntrack_help { |
| 52 | /* insert conntrack helper private data (master) here */ | 52 | /* insert conntrack helper private data (master) here */ |
| 53 | #if defined(CONFIG_NF_CONNTRACK_FTP) || defined(CONFIG_NF_CONNTRACK_FTP_MODULE) | ||
| 53 | struct nf_ct_ftp_master ct_ftp_info; | 54 | struct nf_ct_ftp_master ct_ftp_info; |
| 55 | #endif | ||
| 56 | #if defined(CONFIG_NF_CONNTRACK_PPTP) || \ | ||
| 57 | defined(CONFIG_NF_CONNTRACK_PPTP_MODULE) | ||
| 54 | struct nf_ct_pptp_master ct_pptp_info; | 58 | struct nf_ct_pptp_master ct_pptp_info; |
| 59 | #endif | ||
| 60 | #if defined(CONFIG_NF_CONNTRACK_H323) || \ | ||
| 61 | defined(CONFIG_NF_CONNTRACK_H323_MODULE) | ||
| 55 | struct nf_ct_h323_master ct_h323_info; | 62 | struct nf_ct_h323_master ct_h323_info; |
| 63 | #endif | ||
| 64 | #if defined(CONFIG_NF_CONNTRACK_SANE) || \ | ||
| 65 | defined(CONFIG_NF_CONNTRACK_SANE_MODULE) | ||
| 56 | struct nf_ct_sane_master ct_sane_info; | 66 | struct nf_ct_sane_master ct_sane_info; |
| 67 | #endif | ||
| 68 | #if defined(CONFIG_NF_CONNTRACK_SIP) || defined(CONFIG_NF_CONNTRACK_SIP_MODULE) | ||
| 57 | struct nf_ct_sip_master ct_sip_info; | 69 | struct nf_ct_sip_master ct_sip_info; |
| 70 | #endif | ||
| 58 | }; | 71 | }; |
| 59 | 72 | ||
| 60 | #include <linux/types.h> | 73 | #include <linux/types.h> |
| @@ -116,14 +129,14 @@ struct nf_conn { | |||
| 116 | u_int32_t secmark; | 129 | u_int32_t secmark; |
| 117 | #endif | 130 | #endif |
| 118 | 131 | ||
| 119 | /* Storage reserved for other modules: */ | ||
| 120 | union nf_conntrack_proto proto; | ||
| 121 | |||
| 122 | /* Extensions */ | 132 | /* Extensions */ |
| 123 | struct nf_ct_ext *ext; | 133 | struct nf_ct_ext *ext; |
| 124 | #ifdef CONFIG_NET_NS | 134 | #ifdef CONFIG_NET_NS |
| 125 | struct net *ct_net; | 135 | struct net *ct_net; |
| 126 | #endif | 136 | #endif |
| 137 | |||
| 138 | /* Storage reserved for other modules, must be the last member */ | ||
| 139 | union nf_conntrack_proto proto; | ||
| 127 | }; | 140 | }; |
| 128 | 141 | ||
| 129 | static inline struct nf_conn * | 142 | static inline struct nf_conn * |
| @@ -189,9 +202,9 @@ extern void nf_ct_l3proto_module_put(unsigned short l3proto); | |||
| 189 | * Allocate a hashtable of hlist_head (if nulls == 0), | 202 | * Allocate a hashtable of hlist_head (if nulls == 0), |
| 190 | * or hlist_nulls_head (if nulls == 1) | 203 | * or hlist_nulls_head (if nulls == 1) |
| 191 | */ | 204 | */ |
| 192 | extern void *nf_ct_alloc_hashtable(unsigned int *sizep, int *vmalloced, int nulls); | 205 | extern void *nf_ct_alloc_hashtable(unsigned int *sizep, int nulls); |
| 193 | 206 | ||
| 194 | extern void nf_ct_free_hashtable(void *hash, int vmalloced, unsigned int size); | 207 | extern void nf_ct_free_hashtable(void *hash, unsigned int size); |
| 195 | 208 | ||
| 196 | extern struct nf_conntrack_tuple_hash * | 209 | extern struct nf_conntrack_tuple_hash * |
| 197 | __nf_conntrack_find(struct net *net, u16 zone, | 210 | __nf_conntrack_find(struct net *net, u16 zone, |
diff --git a/include/net/netfilter/nf_conntrack_ecache.h b/include/net/netfilter/nf_conntrack_ecache.h index 349cefedc9f3..4283508b3e18 100644 --- a/include/net/netfilter/nf_conntrack_ecache.h +++ b/include/net/netfilter/nf_conntrack_ecache.h | |||
| @@ -23,12 +23,17 @@ struct nf_conntrack_ecache { | |||
| 23 | static inline struct nf_conntrack_ecache * | 23 | static inline struct nf_conntrack_ecache * |
| 24 | nf_ct_ecache_find(const struct nf_conn *ct) | 24 | nf_ct_ecache_find(const struct nf_conn *ct) |
| 25 | { | 25 | { |
| 26 | #ifdef CONFIG_NF_CONNTRACK_EVENTS | ||
| 26 | return nf_ct_ext_find(ct, NF_CT_EXT_ECACHE); | 27 | return nf_ct_ext_find(ct, NF_CT_EXT_ECACHE); |
| 28 | #else | ||
| 29 | return NULL; | ||
| 30 | #endif | ||
| 27 | } | 31 | } |
| 28 | 32 | ||
| 29 | static inline struct nf_conntrack_ecache * | 33 | static inline struct nf_conntrack_ecache * |
| 30 | nf_ct_ecache_ext_add(struct nf_conn *ct, u16 ctmask, u16 expmask, gfp_t gfp) | 34 | nf_ct_ecache_ext_add(struct nf_conn *ct, u16 ctmask, u16 expmask, gfp_t gfp) |
| 31 | { | 35 | { |
| 36 | #ifdef CONFIG_NF_CONNTRACK_EVENTS | ||
| 32 | struct net *net = nf_ct_net(ct); | 37 | struct net *net = nf_ct_net(ct); |
| 33 | struct nf_conntrack_ecache *e; | 38 | struct nf_conntrack_ecache *e; |
| 34 | 39 | ||
| @@ -45,6 +50,9 @@ nf_ct_ecache_ext_add(struct nf_conn *ct, u16 ctmask, u16 expmask, gfp_t gfp) | |||
| 45 | e->expmask = expmask; | 50 | e->expmask = expmask; |
| 46 | } | 51 | } |
| 47 | return e; | 52 | return e; |
| 53 | #else | ||
| 54 | return NULL; | ||
| 55 | #endif | ||
| 48 | }; | 56 | }; |
| 49 | 57 | ||
| 50 | #ifdef CONFIG_NF_CONNTRACK_EVENTS | 58 | #ifdef CONFIG_NF_CONNTRACK_EVENTS |
| @@ -59,7 +67,7 @@ struct nf_ct_event_notifier { | |||
| 59 | int (*fcn)(unsigned int events, struct nf_ct_event *item); | 67 | int (*fcn)(unsigned int events, struct nf_ct_event *item); |
| 60 | }; | 68 | }; |
| 61 | 69 | ||
| 62 | extern struct nf_ct_event_notifier *nf_conntrack_event_cb; | 70 | extern struct nf_ct_event_notifier __rcu *nf_conntrack_event_cb; |
| 63 | extern int nf_conntrack_register_notifier(struct nf_ct_event_notifier *nb); | 71 | extern int nf_conntrack_register_notifier(struct nf_ct_event_notifier *nb); |
| 64 | extern void nf_conntrack_unregister_notifier(struct nf_ct_event_notifier *nb); | 72 | extern void nf_conntrack_unregister_notifier(struct nf_ct_event_notifier *nb); |
| 65 | 73 | ||
| @@ -156,7 +164,7 @@ struct nf_exp_event_notifier { | |||
| 156 | int (*fcn)(unsigned int events, struct nf_exp_event *item); | 164 | int (*fcn)(unsigned int events, struct nf_exp_event *item); |
| 157 | }; | 165 | }; |
| 158 | 166 | ||
| 159 | extern struct nf_exp_event_notifier *nf_expect_event_cb; | 167 | extern struct nf_exp_event_notifier __rcu *nf_expect_event_cb; |
| 160 | extern int nf_ct_expect_register_notifier(struct nf_exp_event_notifier *nb); | 168 | extern int nf_ct_expect_register_notifier(struct nf_exp_event_notifier *nb); |
| 161 | extern void nf_ct_expect_unregister_notifier(struct nf_exp_event_notifier *nb); | 169 | extern void nf_ct_expect_unregister_notifier(struct nf_exp_event_notifier *nb); |
| 162 | 170 | ||
diff --git a/include/net/netfilter/nf_conntrack_extend.h b/include/net/netfilter/nf_conntrack_extend.h index 0772d296dfdb..2dcf31703acb 100644 --- a/include/net/netfilter/nf_conntrack_extend.h +++ b/include/net/netfilter/nf_conntrack_extend.h | |||
| @@ -7,10 +7,19 @@ | |||
| 7 | 7 | ||
| 8 | enum nf_ct_ext_id { | 8 | enum nf_ct_ext_id { |
| 9 | NF_CT_EXT_HELPER, | 9 | NF_CT_EXT_HELPER, |
| 10 | #if defined(CONFIG_NF_NAT) || defined(CONFIG_NF_NAT_MODULE) | ||
| 10 | NF_CT_EXT_NAT, | 11 | NF_CT_EXT_NAT, |
| 12 | #endif | ||
| 11 | NF_CT_EXT_ACCT, | 13 | NF_CT_EXT_ACCT, |
| 14 | #ifdef CONFIG_NF_CONNTRACK_EVENTS | ||
| 12 | NF_CT_EXT_ECACHE, | 15 | NF_CT_EXT_ECACHE, |
| 16 | #endif | ||
| 17 | #ifdef CONFIG_NF_CONNTRACK_ZONES | ||
| 13 | NF_CT_EXT_ZONE, | 18 | NF_CT_EXT_ZONE, |
| 19 | #endif | ||
| 20 | #ifdef CONFIG_NF_CONNTRACK_TIMESTAMP | ||
| 21 | NF_CT_EXT_TSTAMP, | ||
| 22 | #endif | ||
| 14 | NF_CT_EXT_NUM, | 23 | NF_CT_EXT_NUM, |
| 15 | }; | 24 | }; |
| 16 | 25 | ||
| @@ -19,6 +28,7 @@ enum nf_ct_ext_id { | |||
| 19 | #define NF_CT_EXT_ACCT_TYPE struct nf_conn_counter | 28 | #define NF_CT_EXT_ACCT_TYPE struct nf_conn_counter |
| 20 | #define NF_CT_EXT_ECACHE_TYPE struct nf_conntrack_ecache | 29 | #define NF_CT_EXT_ECACHE_TYPE struct nf_conntrack_ecache |
| 21 | #define NF_CT_EXT_ZONE_TYPE struct nf_conntrack_zone | 30 | #define NF_CT_EXT_ZONE_TYPE struct nf_conntrack_zone |
| 31 | #define NF_CT_EXT_TSTAMP_TYPE struct nf_conn_tstamp | ||
| 22 | 32 | ||
| 23 | /* Extensions: optional stuff which isn't permanently in struct. */ | 33 | /* Extensions: optional stuff which isn't permanently in struct. */ |
| 24 | struct nf_ct_ext { | 34 | struct nf_ct_ext { |
diff --git a/include/net/netfilter/nf_conntrack_helper.h b/include/net/netfilter/nf_conntrack_helper.h index 32c305dbdab6..f1c1311adc2c 100644 --- a/include/net/netfilter/nf_conntrack_helper.h +++ b/include/net/netfilter/nf_conntrack_helper.h | |||
| @@ -63,4 +63,10 @@ static inline struct nf_conn_help *nfct_help(const struct nf_conn *ct) | |||
| 63 | extern int nf_conntrack_helper_init(void); | 63 | extern int nf_conntrack_helper_init(void); |
| 64 | extern void nf_conntrack_helper_fini(void); | 64 | extern void nf_conntrack_helper_fini(void); |
| 65 | 65 | ||
| 66 | extern int nf_conntrack_broadcast_help(struct sk_buff *skb, | ||
| 67 | unsigned int protoff, | ||
| 68 | struct nf_conn *ct, | ||
| 69 | enum ip_conntrack_info ctinfo, | ||
| 70 | unsigned int timeout); | ||
| 71 | |||
| 66 | #endif /*_NF_CONNTRACK_HELPER_H*/ | 72 | #endif /*_NF_CONNTRACK_HELPER_H*/ |
diff --git a/include/net/netfilter/nf_conntrack_l3proto.h b/include/net/netfilter/nf_conntrack_l3proto.h index a7547611e8f1..e8010f445ae1 100644 --- a/include/net/netfilter/nf_conntrack_l3proto.h +++ b/include/net/netfilter/nf_conntrack_l3proto.h | |||
| @@ -73,7 +73,7 @@ struct nf_conntrack_l3proto { | |||
| 73 | struct module *me; | 73 | struct module *me; |
| 74 | }; | 74 | }; |
| 75 | 75 | ||
| 76 | extern struct nf_conntrack_l3proto *nf_ct_l3protos[AF_MAX]; | 76 | extern struct nf_conntrack_l3proto __rcu *nf_ct_l3protos[AF_MAX]; |
| 77 | 77 | ||
| 78 | /* Protocol registration. */ | 78 | /* Protocol registration. */ |
| 79 | extern int nf_conntrack_l3proto_register(struct nf_conntrack_l3proto *proto); | 79 | extern int nf_conntrack_l3proto_register(struct nf_conntrack_l3proto *proto); |
diff --git a/include/net/netfilter/nf_conntrack_timestamp.h b/include/net/netfilter/nf_conntrack_timestamp.h new file mode 100644 index 000000000000..fc9c82b1f06b --- /dev/null +++ b/include/net/netfilter/nf_conntrack_timestamp.h | |||
| @@ -0,0 +1,65 @@ | |||
| 1 | #ifndef _NF_CONNTRACK_TSTAMP_H | ||
| 2 | #define _NF_CONNTRACK_TSTAMP_H | ||
| 3 | |||
| 4 | #include <net/net_namespace.h> | ||
| 5 | #include <linux/netfilter/nf_conntrack_common.h> | ||
| 6 | #include <linux/netfilter/nf_conntrack_tuple_common.h> | ||
| 7 | #include <net/netfilter/nf_conntrack.h> | ||
| 8 | #include <net/netfilter/nf_conntrack_extend.h> | ||
| 9 | |||
| 10 | struct nf_conn_tstamp { | ||
| 11 | u_int64_t start; | ||
| 12 | u_int64_t stop; | ||
| 13 | }; | ||
| 14 | |||
| 15 | static inline | ||
| 16 | struct nf_conn_tstamp *nf_conn_tstamp_find(const struct nf_conn *ct) | ||
| 17 | { | ||
| 18 | #ifdef CONFIG_NF_CONNTRACK_TIMESTAMP | ||
| 19 | return nf_ct_ext_find(ct, NF_CT_EXT_TSTAMP); | ||
| 20 | #else | ||
| 21 | return NULL; | ||
| 22 | #endif | ||
| 23 | } | ||
| 24 | |||
| 25 | static inline | ||
| 26 | struct nf_conn_tstamp *nf_ct_tstamp_ext_add(struct nf_conn *ct, gfp_t gfp) | ||
| 27 | { | ||
| 28 | #ifdef CONFIG_NF_CONNTRACK_TIMESTAMP | ||
| 29 | struct net *net = nf_ct_net(ct); | ||
| 30 | |||
| 31 | if (!net->ct.sysctl_tstamp) | ||
| 32 | return NULL; | ||
| 33 | |||
| 34 | return nf_ct_ext_add(ct, NF_CT_EXT_TSTAMP, gfp); | ||
| 35 | #else | ||
| 36 | return NULL; | ||
| 37 | #endif | ||
| 38 | }; | ||
| 39 | |||
| 40 | static inline bool nf_ct_tstamp_enabled(struct net *net) | ||
| 41 | { | ||
| 42 | return net->ct.sysctl_tstamp != 0; | ||
| 43 | } | ||
| 44 | |||
| 45 | static inline void nf_ct_set_tstamp(struct net *net, bool enable) | ||
| 46 | { | ||
| 47 | net->ct.sysctl_tstamp = enable; | ||
| 48 | } | ||
| 49 | |||
| 50 | #ifdef CONFIG_NF_CONNTRACK_TIMESTAMP | ||
| 51 | extern int nf_conntrack_tstamp_init(struct net *net); | ||
| 52 | extern void nf_conntrack_tstamp_fini(struct net *net); | ||
| 53 | #else | ||
| 54 | static inline int nf_conntrack_tstamp_init(struct net *net) | ||
| 55 | { | ||
| 56 | return 0; | ||
| 57 | } | ||
| 58 | |||
| 59 | static inline void nf_conntrack_tstamp_fini(struct net *net) | ||
| 60 | { | ||
| 61 | return; | ||
| 62 | } | ||
| 63 | #endif /* CONFIG_NF_CONNTRACK_TIMESTAMP */ | ||
| 64 | |||
| 65 | #endif /* _NF_CONNTRACK_TSTAMP_H */ | ||
diff --git a/include/net/netfilter/nf_nat.h b/include/net/netfilter/nf_nat.h index f5f09f032a90..aff80b190c12 100644 --- a/include/net/netfilter/nf_nat.h +++ b/include/net/netfilter/nf_nat.h | |||
| @@ -56,7 +56,9 @@ struct nf_nat_multi_range_compat { | |||
| 56 | /* per conntrack: nat application helper private data */ | 56 | /* per conntrack: nat application helper private data */ |
| 57 | union nf_conntrack_nat_help { | 57 | union nf_conntrack_nat_help { |
| 58 | /* insert nat helper private data here */ | 58 | /* insert nat helper private data here */ |
| 59 | #if defined(CONFIG_NF_NAT_PPTP) || defined(CONFIG_NF_NAT_PPTP_MODULE) | ||
| 59 | struct nf_nat_pptp nat_pptp_info; | 60 | struct nf_nat_pptp nat_pptp_info; |
| 61 | #endif | ||
| 60 | }; | 62 | }; |
| 61 | 63 | ||
| 62 | struct nf_conn; | 64 | struct nf_conn; |
| @@ -84,7 +86,11 @@ extern int nf_nat_used_tuple(const struct nf_conntrack_tuple *tuple, | |||
| 84 | 86 | ||
| 85 | static inline struct nf_conn_nat *nfct_nat(const struct nf_conn *ct) | 87 | static inline struct nf_conn_nat *nfct_nat(const struct nf_conn *ct) |
| 86 | { | 88 | { |
| 89 | #if defined(CONFIG_NF_NAT) || defined(CONFIG_NF_NAT_MODULE) | ||
| 87 | return nf_ct_ext_find(ct, NF_CT_EXT_NAT); | 90 | return nf_ct_ext_find(ct, NF_CT_EXT_NAT); |
| 91 | #else | ||
| 92 | return NULL; | ||
| 93 | #endif | ||
| 88 | } | 94 | } |
| 89 | 95 | ||
| 90 | #else /* !__KERNEL__: iptables wants this to compile. */ | 96 | #else /* !__KERNEL__: iptables wants this to compile. */ |
diff --git a/include/net/netfilter/nf_nat_core.h b/include/net/netfilter/nf_nat_core.h index 33602ab66190..3dc7b98effeb 100644 --- a/include/net/netfilter/nf_nat_core.h +++ b/include/net/netfilter/nf_nat_core.h | |||
| @@ -21,9 +21,9 @@ static inline int nf_nat_initialized(struct nf_conn *ct, | |||
| 21 | enum nf_nat_manip_type manip) | 21 | enum nf_nat_manip_type manip) |
| 22 | { | 22 | { |
| 23 | if (manip == IP_NAT_MANIP_SRC) | 23 | if (manip == IP_NAT_MANIP_SRC) |
| 24 | return test_bit(IPS_SRC_NAT_DONE_BIT, &ct->status); | 24 | return ct->status & IPS_SRC_NAT_DONE; |
| 25 | else | 25 | else |
| 26 | return test_bit(IPS_DST_NAT_DONE_BIT, &ct->status); | 26 | return ct->status & IPS_DST_NAT_DONE; |
| 27 | } | 27 | } |
| 28 | 28 | ||
| 29 | struct nlattr; | 29 | struct nlattr; |
diff --git a/include/net/netfilter/nf_tproxy_core.h b/include/net/netfilter/nf_tproxy_core.h index cd85b3bc8327..e505358d8999 100644 --- a/include/net/netfilter/nf_tproxy_core.h +++ b/include/net/netfilter/nf_tproxy_core.h | |||
| @@ -201,18 +201,8 @@ nf_tproxy_get_sock_v6(struct net *net, const u8 protocol, | |||
| 201 | } | 201 | } |
| 202 | #endif | 202 | #endif |
| 203 | 203 | ||
| 204 | static inline void | ||
| 205 | nf_tproxy_put_sock(struct sock *sk) | ||
| 206 | { | ||
| 207 | /* TIME_WAIT inet sockets have to be handled differently */ | ||
| 208 | if ((sk->sk_protocol == IPPROTO_TCP) && (sk->sk_state == TCP_TIME_WAIT)) | ||
| 209 | inet_twsk_put(inet_twsk(sk)); | ||
| 210 | else | ||
| 211 | sock_put(sk); | ||
| 212 | } | ||
| 213 | |||
| 214 | /* assign a socket to the skb -- consumes sk */ | 204 | /* assign a socket to the skb -- consumes sk */ |
| 215 | int | 205 | void |
| 216 | nf_tproxy_assign_sock(struct sk_buff *skb, struct sock *sk); | 206 | nf_tproxy_assign_sock(struct sk_buff *skb, struct sock *sk); |
| 217 | 207 | ||
| 218 | #endif | 208 | #endif |
diff --git a/include/net/netlink.h b/include/net/netlink.h index 373f1a900cf4..8a3906a08f5f 100644 --- a/include/net/netlink.h +++ b/include/net/netlink.h | |||
| @@ -856,18 +856,27 @@ static inline int nla_put_msecs(struct sk_buff *skb, int attrtype, | |||
| 856 | #define NLA_PUT_BE16(skb, attrtype, value) \ | 856 | #define NLA_PUT_BE16(skb, attrtype, value) \ |
| 857 | NLA_PUT_TYPE(skb, __be16, attrtype, value) | 857 | NLA_PUT_TYPE(skb, __be16, attrtype, value) |
| 858 | 858 | ||
| 859 | #define NLA_PUT_NET16(skb, attrtype, value) \ | ||
| 860 | NLA_PUT_BE16(skb, attrtype | NLA_F_NET_BYTEORDER, value) | ||
| 861 | |||
| 859 | #define NLA_PUT_U32(skb, attrtype, value) \ | 862 | #define NLA_PUT_U32(skb, attrtype, value) \ |
| 860 | NLA_PUT_TYPE(skb, u32, attrtype, value) | 863 | NLA_PUT_TYPE(skb, u32, attrtype, value) |
| 861 | 864 | ||
| 862 | #define NLA_PUT_BE32(skb, attrtype, value) \ | 865 | #define NLA_PUT_BE32(skb, attrtype, value) \ |
| 863 | NLA_PUT_TYPE(skb, __be32, attrtype, value) | 866 | NLA_PUT_TYPE(skb, __be32, attrtype, value) |
| 864 | 867 | ||
| 868 | #define NLA_PUT_NET32(skb, attrtype, value) \ | ||
| 869 | NLA_PUT_BE32(skb, attrtype | NLA_F_NET_BYTEORDER, value) | ||
| 870 | |||
| 865 | #define NLA_PUT_U64(skb, attrtype, value) \ | 871 | #define NLA_PUT_U64(skb, attrtype, value) \ |
| 866 | NLA_PUT_TYPE(skb, u64, attrtype, value) | 872 | NLA_PUT_TYPE(skb, u64, attrtype, value) |
| 867 | 873 | ||
| 868 | #define NLA_PUT_BE64(skb, attrtype, value) \ | 874 | #define NLA_PUT_BE64(skb, attrtype, value) \ |
| 869 | NLA_PUT_TYPE(skb, __be64, attrtype, value) | 875 | NLA_PUT_TYPE(skb, __be64, attrtype, value) |
| 870 | 876 | ||
| 877 | #define NLA_PUT_NET64(skb, attrtype, value) \ | ||
| 878 | NLA_PUT_BE64(skb, attrtype | NLA_F_NET_BYTEORDER, value) | ||
| 879 | |||
| 871 | #define NLA_PUT_STRING(skb, attrtype, value) \ | 880 | #define NLA_PUT_STRING(skb, attrtype, value) \ |
| 872 | NLA_PUT(skb, attrtype, strlen(value) + 1, value) | 881 | NLA_PUT(skb, attrtype, strlen(value) + 1, value) |
| 873 | 882 | ||
diff --git a/include/net/netns/conntrack.h b/include/net/netns/conntrack.h index d4958d4c6574..341eb089349e 100644 --- a/include/net/netns/conntrack.h +++ b/include/net/netns/conntrack.h | |||
| @@ -21,15 +21,15 @@ struct netns_ct { | |||
| 21 | int sysctl_events; | 21 | int sysctl_events; |
| 22 | unsigned int sysctl_events_retry_timeout; | 22 | unsigned int sysctl_events_retry_timeout; |
| 23 | int sysctl_acct; | 23 | int sysctl_acct; |
| 24 | int sysctl_tstamp; | ||
| 24 | int sysctl_checksum; | 25 | int sysctl_checksum; |
| 25 | unsigned int sysctl_log_invalid; /* Log invalid packets */ | 26 | unsigned int sysctl_log_invalid; /* Log invalid packets */ |
| 26 | #ifdef CONFIG_SYSCTL | 27 | #ifdef CONFIG_SYSCTL |
| 27 | struct ctl_table_header *sysctl_header; | 28 | struct ctl_table_header *sysctl_header; |
| 28 | struct ctl_table_header *acct_sysctl_header; | 29 | struct ctl_table_header *acct_sysctl_header; |
| 30 | struct ctl_table_header *tstamp_sysctl_header; | ||
| 29 | struct ctl_table_header *event_sysctl_header; | 31 | struct ctl_table_header *event_sysctl_header; |
| 30 | #endif | 32 | #endif |
| 31 | int hash_vmalloc; | ||
| 32 | int expect_vmalloc; | ||
| 33 | char *slabname; | 33 | char *slabname; |
| 34 | }; | 34 | }; |
| 35 | #endif | 35 | #endif |
diff --git a/include/net/netns/ipv4.h b/include/net/netns/ipv4.h index d68c3f121774..e2e2ef57eca2 100644 --- a/include/net/netns/ipv4.h +++ b/include/net/netns/ipv4.h | |||
| @@ -43,7 +43,6 @@ struct netns_ipv4 { | |||
| 43 | struct xt_table *nat_table; | 43 | struct xt_table *nat_table; |
| 44 | struct hlist_head *nat_bysource; | 44 | struct hlist_head *nat_bysource; |
| 45 | unsigned int nat_htable_size; | 45 | unsigned int nat_htable_size; |
| 46 | int nat_vmalloced; | ||
| 47 | #endif | 46 | #endif |
| 48 | 47 | ||
| 49 | int sysctl_icmp_echo_ignore_all; | 48 | int sysctl_icmp_echo_ignore_all; |
diff --git a/include/net/phonet/pep.h b/include/net/phonet/pep.h index b60b28c99e87..b669fe6dbc3b 100644 --- a/include/net/phonet/pep.h +++ b/include/net/phonet/pep.h | |||
| @@ -28,7 +28,6 @@ struct pep_sock { | |||
| 28 | 28 | ||
| 29 | /* XXX: union-ify listening vs connected stuff ? */ | 29 | /* XXX: union-ify listening vs connected stuff ? */ |
| 30 | /* Listening socket stuff: */ | 30 | /* Listening socket stuff: */ |
| 31 | struct hlist_head ackq; | ||
| 32 | struct hlist_head hlist; | 31 | struct hlist_head hlist; |
| 33 | 32 | ||
| 34 | /* Connected socket stuff: */ | 33 | /* Connected socket stuff: */ |
| @@ -45,10 +44,6 @@ struct pep_sock { | |||
| 45 | u8 tx_fc; /* TX flow control */ | 44 | u8 tx_fc; /* TX flow control */ |
| 46 | u8 init_enable; /* auto-enable at creation */ | 45 | u8 init_enable; /* auto-enable at creation */ |
| 47 | u8 aligned; | 46 | u8 aligned; |
| 48 | #ifdef CONFIG_PHONET_PIPECTRLR | ||
| 49 | u8 pipe_state; | ||
| 50 | struct sockaddr_pn remote_pep; | ||
| 51 | #endif | ||
| 52 | }; | 47 | }; |
| 53 | 48 | ||
| 54 | static inline struct pep_sock *pep_sk(struct sock *sk) | 49 | static inline struct pep_sock *pep_sk(struct sock *sk) |
| @@ -158,6 +153,7 @@ enum { | |||
| 158 | PN_LEGACY_FLOW_CONTROL, | 153 | PN_LEGACY_FLOW_CONTROL, |
| 159 | PN_ONE_CREDIT_FLOW_CONTROL, | 154 | PN_ONE_CREDIT_FLOW_CONTROL, |
| 160 | PN_MULTI_CREDIT_FLOW_CONTROL, | 155 | PN_MULTI_CREDIT_FLOW_CONTROL, |
| 156 | PN_MAX_FLOW_CONTROL, | ||
| 161 | }; | 157 | }; |
| 162 | 158 | ||
| 163 | #define pn_flow_safe(fc) ((fc) >> 1) | 159 | #define pn_flow_safe(fc) ((fc) >> 1) |
| @@ -169,21 +165,4 @@ enum { | |||
| 169 | PEP_IND_READY, | 165 | PEP_IND_READY, |
| 170 | }; | 166 | }; |
| 171 | 167 | ||
| 172 | #ifdef CONFIG_PHONET_PIPECTRLR | ||
| 173 | #define PNS_PEP_CONNECT_UTID 0x02 | ||
| 174 | #define PNS_PIPE_CREATED_IND_UTID 0x04 | ||
| 175 | #define PNS_PIPE_ENABLE_UTID 0x0A | ||
| 176 | #define PNS_PIPE_ENABLED_IND_UTID 0x0C | ||
| 177 | #define PNS_PIPE_DISABLE_UTID 0x0F | ||
| 178 | #define PNS_PIPE_DISABLED_IND_UTID 0x11 | ||
| 179 | #define PNS_PEP_DISCONNECT_UTID 0x06 | ||
| 180 | |||
| 181 | /* Used for tracking state of a pipe */ | ||
| 182 | enum { | ||
| 183 | PIPE_IDLE, | ||
| 184 | PIPE_DISABLED, | ||
| 185 | PIPE_ENABLED, | ||
| 186 | }; | ||
| 187 | #endif /* CONFIG_PHONET_PIPECTRLR */ | ||
| 188 | |||
| 189 | #endif | 168 | #endif |
diff --git a/include/net/phonet/phonet.h b/include/net/phonet/phonet.h index 5395e09187df..68e509750caa 100644 --- a/include/net/phonet/phonet.h +++ b/include/net/phonet/phonet.h | |||
| @@ -36,6 +36,7 @@ | |||
| 36 | struct pn_sock { | 36 | struct pn_sock { |
| 37 | struct sock sk; | 37 | struct sock sk; |
| 38 | u16 sobject; | 38 | u16 sobject; |
| 39 | u16 dobject; | ||
| 39 | u8 resource; | 40 | u8 resource; |
| 40 | }; | 41 | }; |
| 41 | 42 | ||
diff --git a/include/net/protocol.h b/include/net/protocol.h index dc07495bce4c..6f7eb800974a 100644 --- a/include/net/protocol.h +++ b/include/net/protocol.h | |||
| @@ -38,7 +38,7 @@ struct net_protocol { | |||
| 38 | void (*err_handler)(struct sk_buff *skb, u32 info); | 38 | void (*err_handler)(struct sk_buff *skb, u32 info); |
| 39 | int (*gso_send_check)(struct sk_buff *skb); | 39 | int (*gso_send_check)(struct sk_buff *skb); |
| 40 | struct sk_buff *(*gso_segment)(struct sk_buff *skb, | 40 | struct sk_buff *(*gso_segment)(struct sk_buff *skb, |
| 41 | int features); | 41 | u32 features); |
| 42 | struct sk_buff **(*gro_receive)(struct sk_buff **head, | 42 | struct sk_buff **(*gro_receive)(struct sk_buff **head, |
| 43 | struct sk_buff *skb); | 43 | struct sk_buff *skb); |
| 44 | int (*gro_complete)(struct sk_buff *skb); | 44 | int (*gro_complete)(struct sk_buff *skb); |
| @@ -57,7 +57,7 @@ struct inet6_protocol { | |||
| 57 | 57 | ||
| 58 | int (*gso_send_check)(struct sk_buff *skb); | 58 | int (*gso_send_check)(struct sk_buff *skb); |
| 59 | struct sk_buff *(*gso_segment)(struct sk_buff *skb, | 59 | struct sk_buff *(*gso_segment)(struct sk_buff *skb, |
| 60 | int features); | 60 | u32 features); |
| 61 | struct sk_buff **(*gro_receive)(struct sk_buff **head, | 61 | struct sk_buff **(*gro_receive)(struct sk_buff **head, |
| 62 | struct sk_buff *skb); | 62 | struct sk_buff *skb); |
| 63 | int (*gro_complete)(struct sk_buff *skb); | 63 | int (*gro_complete)(struct sk_buff *skb); |
diff --git a/include/net/route.h b/include/net/route.h index 93e10c453f6b..30d6cae3841a 100644 --- a/include/net/route.h +++ b/include/net/route.h | |||
| @@ -49,36 +49,43 @@ | |||
| 49 | 49 | ||
| 50 | struct fib_nh; | 50 | struct fib_nh; |
| 51 | struct inet_peer; | 51 | struct inet_peer; |
| 52 | struct fib_info; | ||
| 52 | struct rtable { | 53 | struct rtable { |
| 53 | struct dst_entry dst; | 54 | struct dst_entry dst; |
| 54 | 55 | ||
| 55 | /* Cache lookup keys */ | 56 | /* Lookup key. */ |
| 56 | struct flowi fl; | 57 | __be32 rt_key_dst; |
| 58 | __be32 rt_key_src; | ||
| 57 | 59 | ||
| 58 | int rt_genid; | 60 | int rt_genid; |
| 59 | unsigned rt_flags; | 61 | unsigned rt_flags; |
| 60 | __u16 rt_type; | 62 | __u16 rt_type; |
| 63 | __u8 rt_tos; | ||
| 61 | 64 | ||
| 62 | __be32 rt_dst; /* Path destination */ | 65 | __be32 rt_dst; /* Path destination */ |
| 63 | __be32 rt_src; /* Path source */ | 66 | __be32 rt_src; /* Path source */ |
| 64 | int rt_iif; | 67 | int rt_iif; |
| 68 | int rt_oif; | ||
| 69 | __u32 rt_mark; | ||
| 65 | 70 | ||
| 66 | /* Info on neighbour */ | 71 | /* Info on neighbour */ |
| 67 | __be32 rt_gateway; | 72 | __be32 rt_gateway; |
| 68 | 73 | ||
| 69 | /* Miscellaneous cached information */ | 74 | /* Miscellaneous cached information */ |
| 70 | __be32 rt_spec_dst; /* RFC1122 specific destination */ | 75 | __be32 rt_spec_dst; /* RFC1122 specific destination */ |
| 76 | u32 rt_peer_genid; | ||
| 71 | struct inet_peer *peer; /* long-living peer info */ | 77 | struct inet_peer *peer; /* long-living peer info */ |
| 78 | struct fib_info *fi; /* for client ref to shared metrics */ | ||
| 72 | }; | 79 | }; |
| 73 | 80 | ||
| 74 | static inline bool rt_is_input_route(struct rtable *rt) | 81 | static inline bool rt_is_input_route(struct rtable *rt) |
| 75 | { | 82 | { |
| 76 | return rt->fl.iif != 0; | 83 | return rt->rt_iif != 0; |
| 77 | } | 84 | } |
| 78 | 85 | ||
| 79 | static inline bool rt_is_output_route(struct rtable *rt) | 86 | static inline bool rt_is_output_route(struct rtable *rt) |
| 80 | { | 87 | { |
| 81 | return rt->fl.iif == 0; | 88 | return rt->rt_iif == 0; |
| 82 | } | 89 | } |
| 83 | 90 | ||
| 84 | struct ip_rt_acct { | 91 | struct ip_rt_acct { |
| @@ -115,9 +122,63 @@ extern void ip_rt_redirect(__be32 old_gw, __be32 dst, __be32 new_gw, | |||
| 115 | __be32 src, struct net_device *dev); | 122 | __be32 src, struct net_device *dev); |
| 116 | extern void rt_cache_flush(struct net *net, int how); | 123 | extern void rt_cache_flush(struct net *net, int how); |
| 117 | extern void rt_cache_flush_batch(struct net *net); | 124 | extern void rt_cache_flush_batch(struct net *net); |
| 118 | extern int __ip_route_output_key(struct net *, struct rtable **, const struct flowi *flp); | 125 | extern struct rtable *__ip_route_output_key(struct net *, const struct flowi4 *flp); |
| 119 | extern int ip_route_output_key(struct net *, struct rtable **, struct flowi *flp); | 126 | extern struct rtable *ip_route_output_flow(struct net *, struct flowi4 *flp, |
| 120 | extern int ip_route_output_flow(struct net *, struct rtable **rp, struct flowi *flp, struct sock *sk, int flags); | 127 | struct sock *sk); |
| 128 | extern struct dst_entry *ipv4_blackhole_route(struct net *net, struct dst_entry *dst_orig); | ||
| 129 | |||
| 130 | static inline struct rtable *ip_route_output_key(struct net *net, struct flowi4 *flp) | ||
| 131 | { | ||
| 132 | return ip_route_output_flow(net, flp, NULL); | ||
| 133 | } | ||
| 134 | |||
| 135 | static inline struct rtable *ip_route_output(struct net *net, __be32 daddr, | ||
| 136 | __be32 saddr, u8 tos, int oif) | ||
| 137 | { | ||
| 138 | struct flowi4 fl4 = { | ||
| 139 | .flowi4_oif = oif, | ||
| 140 | .daddr = daddr, | ||
| 141 | .saddr = saddr, | ||
| 142 | .flowi4_tos = tos, | ||
| 143 | }; | ||
| 144 | return ip_route_output_key(net, &fl4); | ||
| 145 | } | ||
| 146 | |||
| 147 | static inline struct rtable *ip_route_output_ports(struct net *net, struct sock *sk, | ||
| 148 | __be32 daddr, __be32 saddr, | ||
| 149 | __be16 dport, __be16 sport, | ||
| 150 | __u8 proto, __u8 tos, int oif) | ||
| 151 | { | ||
| 152 | struct flowi4 fl4 = { | ||
| 153 | .flowi4_oif = oif, | ||
| 154 | .flowi4_flags = sk ? inet_sk_flowi_flags(sk) : 0, | ||
| 155 | .flowi4_mark = sk ? sk->sk_mark : 0, | ||
| 156 | .daddr = daddr, | ||
| 157 | .saddr = saddr, | ||
| 158 | .flowi4_tos = tos, | ||
| 159 | .flowi4_proto = proto, | ||
| 160 | .fl4_dport = dport, | ||
| 161 | .fl4_sport = sport, | ||
| 162 | }; | ||
| 163 | if (sk) | ||
| 164 | security_sk_classify_flow(sk, flowi4_to_flowi(&fl4)); | ||
| 165 | return ip_route_output_flow(net, &fl4, sk); | ||
| 166 | } | ||
| 167 | |||
| 168 | static inline struct rtable *ip_route_output_gre(struct net *net, | ||
| 169 | __be32 daddr, __be32 saddr, | ||
| 170 | __be32 gre_key, __u8 tos, int oif) | ||
| 171 | { | ||
| 172 | struct flowi4 fl4 = { | ||
| 173 | .flowi4_oif = oif, | ||
| 174 | .daddr = daddr, | ||
| 175 | .saddr = saddr, | ||
| 176 | .flowi4_tos = tos, | ||
| 177 | .flowi4_proto = IPPROTO_GRE, | ||
| 178 | .fl4_gre_key = gre_key, | ||
| 179 | }; | ||
| 180 | return ip_route_output_key(net, &fl4); | ||
| 181 | } | ||
| 121 | 182 | ||
| 122 | extern int ip_route_input_common(struct sk_buff *skb, __be32 dst, __be32 src, | 183 | extern int ip_route_input_common(struct sk_buff *skb, __be32 dst, __be32 src, |
| 123 | u8 tos, struct net_device *devin, bool noref); | 184 | u8 tos, struct net_device *devin, bool noref); |
| @@ -162,57 +223,68 @@ static inline char rt_tos2priority(u8 tos) | |||
| 162 | return ip_tos2prio[IPTOS_TOS(tos)>>1]; | 223 | return ip_tos2prio[IPTOS_TOS(tos)>>1]; |
| 163 | } | 224 | } |
| 164 | 225 | ||
| 165 | static inline int ip_route_connect(struct rtable **rp, __be32 dst, | 226 | static inline struct rtable *ip_route_connect(__be32 dst, __be32 src, u32 tos, |
| 166 | __be32 src, u32 tos, int oif, u8 protocol, | 227 | int oif, u8 protocol, |
| 167 | __be16 sport, __be16 dport, struct sock *sk, | 228 | __be16 sport, __be16 dport, |
| 168 | int flags) | 229 | struct sock *sk, bool can_sleep) |
| 169 | { | 230 | { |
| 170 | struct flowi fl = { .oif = oif, | 231 | struct flowi4 fl4 = { |
| 171 | .mark = sk->sk_mark, | 232 | .flowi4_oif = oif, |
| 172 | .fl4_dst = dst, | 233 | .flowi4_mark = sk->sk_mark, |
| 173 | .fl4_src = src, | 234 | .daddr = dst, |
| 174 | .fl4_tos = tos, | 235 | .saddr = src, |
| 175 | .proto = protocol, | 236 | .flowi4_tos = tos, |
| 176 | .fl_ip_sport = sport, | 237 | .flowi4_proto = protocol, |
| 177 | .fl_ip_dport = dport }; | 238 | .fl4_sport = sport, |
| 178 | int err; | 239 | .fl4_dport = dport, |
| 240 | }; | ||
| 179 | struct net *net = sock_net(sk); | 241 | struct net *net = sock_net(sk); |
| 242 | struct rtable *rt; | ||
| 180 | 243 | ||
| 181 | if (inet_sk(sk)->transparent) | 244 | if (inet_sk(sk)->transparent) |
| 182 | fl.flags |= FLOWI_FLAG_ANYSRC; | 245 | fl4.flowi4_flags |= FLOWI_FLAG_ANYSRC; |
| 246 | if (protocol == IPPROTO_TCP) | ||
| 247 | fl4.flowi4_flags |= FLOWI_FLAG_PRECOW_METRICS; | ||
| 248 | if (can_sleep) | ||
| 249 | fl4.flowi4_flags |= FLOWI_FLAG_CAN_SLEEP; | ||
| 183 | 250 | ||
| 184 | if (!dst || !src) { | 251 | if (!dst || !src) { |
| 185 | err = __ip_route_output_key(net, rp, &fl); | 252 | rt = __ip_route_output_key(net, &fl4); |
| 186 | if (err) | 253 | if (IS_ERR(rt)) |
| 187 | return err; | 254 | return rt; |
| 188 | fl.fl4_dst = (*rp)->rt_dst; | 255 | fl4.daddr = rt->rt_dst; |
| 189 | fl.fl4_src = (*rp)->rt_src; | 256 | fl4.saddr = rt->rt_src; |
| 190 | ip_rt_put(*rp); | 257 | ip_rt_put(rt); |
| 191 | *rp = NULL; | ||
| 192 | } | 258 | } |
| 193 | security_sk_classify_flow(sk, &fl); | 259 | security_sk_classify_flow(sk, flowi4_to_flowi(&fl4)); |
| 194 | return ip_route_output_flow(net, rp, &fl, sk, flags); | 260 | return ip_route_output_flow(net, &fl4, sk); |
| 195 | } | 261 | } |
| 196 | 262 | ||
| 197 | static inline int ip_route_newports(struct rtable **rp, u8 protocol, | 263 | static inline struct rtable *ip_route_newports(struct rtable *rt, |
| 198 | __be16 sport, __be16 dport, struct sock *sk) | 264 | u8 protocol, __be16 orig_sport, |
| 265 | __be16 orig_dport, __be16 sport, | ||
| 266 | __be16 dport, struct sock *sk) | ||
| 199 | { | 267 | { |
| 200 | if (sport != (*rp)->fl.fl_ip_sport || | 268 | if (sport != orig_sport || dport != orig_dport) { |
| 201 | dport != (*rp)->fl.fl_ip_dport) { | 269 | struct flowi4 fl4 = { |
| 202 | struct flowi fl; | 270 | .flowi4_oif = rt->rt_oif, |
| 203 | 271 | .flowi4_mark = rt->rt_mark, | |
| 204 | memcpy(&fl, &(*rp)->fl, sizeof(fl)); | 272 | .daddr = rt->rt_key_dst, |
| 205 | fl.fl_ip_sport = sport; | 273 | .saddr = rt->rt_key_src, |
| 206 | fl.fl_ip_dport = dport; | 274 | .flowi4_tos = rt->rt_tos, |
| 207 | fl.proto = protocol; | 275 | .flowi4_proto = protocol, |
| 276 | .fl4_sport = sport, | ||
| 277 | .fl4_dport = dport | ||
| 278 | }; | ||
| 208 | if (inet_sk(sk)->transparent) | 279 | if (inet_sk(sk)->transparent) |
| 209 | fl.flags |= FLOWI_FLAG_ANYSRC; | 280 | fl4.flowi4_flags |= FLOWI_FLAG_ANYSRC; |
| 210 | ip_rt_put(*rp); | 281 | if (protocol == IPPROTO_TCP) |
| 211 | *rp = NULL; | 282 | fl4.flowi4_flags |= FLOWI_FLAG_PRECOW_METRICS; |
| 212 | security_sk_classify_flow(sk, &fl); | 283 | ip_rt_put(rt); |
| 213 | return ip_route_output_flow(sock_net(sk), rp, &fl, sk, 0); | 284 | security_sk_classify_flow(sk, flowi4_to_flowi(&fl4)); |
| 285 | return ip_route_output_flow(sock_net(sk), &fl4, sk); | ||
| 214 | } | 286 | } |
| 215 | return 0; | 287 | return rt; |
| 216 | } | 288 | } |
| 217 | 289 | ||
| 218 | extern void rt_bind_peer(struct rtable *rt, int create); | 290 | extern void rt_bind_peer(struct rtable *rt, int create); |
diff --git a/include/net/sch_generic.h b/include/net/sch_generic.h index 160a407c1963..a9505b6a18e3 100644 --- a/include/net/sch_generic.h +++ b/include/net/sch_generic.h | |||
| @@ -31,10 +31,12 @@ enum qdisc_state_t { | |||
| 31 | * following bits are only changed while qdisc lock is held | 31 | * following bits are only changed while qdisc lock is held |
| 32 | */ | 32 | */ |
| 33 | enum qdisc___state_t { | 33 | enum qdisc___state_t { |
| 34 | __QDISC___STATE_RUNNING, | 34 | __QDISC___STATE_RUNNING = 1, |
| 35 | __QDISC___STATE_THROTTLED = 2, | ||
| 35 | }; | 36 | }; |
| 36 | 37 | ||
| 37 | struct qdisc_size_table { | 38 | struct qdisc_size_table { |
| 39 | struct rcu_head rcu; | ||
| 38 | struct list_head list; | 40 | struct list_head list; |
| 39 | struct tc_sizespec szopts; | 41 | struct tc_sizespec szopts; |
| 40 | int refcnt; | 42 | int refcnt; |
| @@ -46,14 +48,13 @@ struct Qdisc { | |||
| 46 | struct sk_buff * (*dequeue)(struct Qdisc *dev); | 48 | struct sk_buff * (*dequeue)(struct Qdisc *dev); |
| 47 | unsigned flags; | 49 | unsigned flags; |
| 48 | #define TCQ_F_BUILTIN 1 | 50 | #define TCQ_F_BUILTIN 1 |
| 49 | #define TCQ_F_THROTTLED 2 | 51 | #define TCQ_F_INGRESS 2 |
| 50 | #define TCQ_F_INGRESS 4 | 52 | #define TCQ_F_CAN_BYPASS 4 |
| 51 | #define TCQ_F_CAN_BYPASS 8 | 53 | #define TCQ_F_MQROOT 8 |
| 52 | #define TCQ_F_MQROOT 16 | ||
| 53 | #define TCQ_F_WARN_NONWC (1 << 16) | 54 | #define TCQ_F_WARN_NONWC (1 << 16) |
| 54 | int padded; | 55 | int padded; |
| 55 | struct Qdisc_ops *ops; | 56 | struct Qdisc_ops *ops; |
| 56 | struct qdisc_size_table *stab; | 57 | struct qdisc_size_table __rcu *stab; |
| 57 | struct list_head list; | 58 | struct list_head list; |
| 58 | u32 handle; | 59 | u32 handle; |
| 59 | u32 parent; | 60 | u32 parent; |
| @@ -78,25 +79,44 @@ struct Qdisc { | |||
| 78 | unsigned long state; | 79 | unsigned long state; |
| 79 | struct sk_buff_head q; | 80 | struct sk_buff_head q; |
| 80 | struct gnet_stats_basic_packed bstats; | 81 | struct gnet_stats_basic_packed bstats; |
| 81 | unsigned long __state; | 82 | unsigned int __state; |
| 82 | struct gnet_stats_queue qstats; | 83 | struct gnet_stats_queue qstats; |
| 83 | struct rcu_head rcu_head; | 84 | struct rcu_head rcu_head; |
| 84 | spinlock_t busylock; | 85 | spinlock_t busylock; |
| 86 | u32 limit; | ||
| 85 | }; | 87 | }; |
| 86 | 88 | ||
| 87 | static inline bool qdisc_is_running(struct Qdisc *qdisc) | 89 | static inline bool qdisc_is_running(const struct Qdisc *qdisc) |
| 88 | { | 90 | { |
| 89 | return test_bit(__QDISC___STATE_RUNNING, &qdisc->__state); | 91 | return (qdisc->__state & __QDISC___STATE_RUNNING) ? true : false; |
| 90 | } | 92 | } |
| 91 | 93 | ||
| 92 | static inline bool qdisc_run_begin(struct Qdisc *qdisc) | 94 | static inline bool qdisc_run_begin(struct Qdisc *qdisc) |
| 93 | { | 95 | { |
| 94 | return !__test_and_set_bit(__QDISC___STATE_RUNNING, &qdisc->__state); | 96 | if (qdisc_is_running(qdisc)) |
| 97 | return false; | ||
| 98 | qdisc->__state |= __QDISC___STATE_RUNNING; | ||
| 99 | return true; | ||
| 95 | } | 100 | } |
| 96 | 101 | ||
| 97 | static inline void qdisc_run_end(struct Qdisc *qdisc) | 102 | static inline void qdisc_run_end(struct Qdisc *qdisc) |
| 98 | { | 103 | { |
| 99 | __clear_bit(__QDISC___STATE_RUNNING, &qdisc->__state); | 104 | qdisc->__state &= ~__QDISC___STATE_RUNNING; |
| 105 | } | ||
| 106 | |||
| 107 | static inline bool qdisc_is_throttled(const struct Qdisc *qdisc) | ||
| 108 | { | ||
| 109 | return (qdisc->__state & __QDISC___STATE_THROTTLED) ? true : false; | ||
| 110 | } | ||
| 111 | |||
| 112 | static inline void qdisc_throttled(struct Qdisc *qdisc) | ||
| 113 | { | ||
| 114 | qdisc->__state |= __QDISC___STATE_THROTTLED; | ||
| 115 | } | ||
| 116 | |||
| 117 | static inline void qdisc_unthrottled(struct Qdisc *qdisc) | ||
| 118 | { | ||
| 119 | qdisc->__state &= ~__QDISC___STATE_THROTTLED; | ||
| 100 | } | 120 | } |
| 101 | 121 | ||
| 102 | struct Qdisc_class_ops { | 122 | struct Qdisc_class_ops { |
| @@ -199,7 +219,7 @@ struct tcf_proto { | |||
| 199 | 219 | ||
| 200 | struct qdisc_skb_cb { | 220 | struct qdisc_skb_cb { |
| 201 | unsigned int pkt_len; | 221 | unsigned int pkt_len; |
| 202 | char data[]; | 222 | long data[]; |
| 203 | }; | 223 | }; |
| 204 | 224 | ||
| 205 | static inline int qdisc_qlen(struct Qdisc *q) | 225 | static inline int qdisc_qlen(struct Qdisc *q) |
| @@ -331,8 +351,8 @@ extern struct Qdisc *qdisc_alloc(struct netdev_queue *dev_queue, | |||
| 331 | struct Qdisc_ops *ops); | 351 | struct Qdisc_ops *ops); |
| 332 | extern struct Qdisc *qdisc_create_dflt(struct netdev_queue *dev_queue, | 352 | extern struct Qdisc *qdisc_create_dflt(struct netdev_queue *dev_queue, |
| 333 | struct Qdisc_ops *ops, u32 parentid); | 353 | struct Qdisc_ops *ops, u32 parentid); |
| 334 | extern void qdisc_calculate_pkt_len(struct sk_buff *skb, | 354 | extern void __qdisc_calculate_pkt_len(struct sk_buff *skb, |
| 335 | struct qdisc_size_table *stab); | 355 | const struct qdisc_size_table *stab); |
| 336 | extern void tcf_destroy(struct tcf_proto *tp); | 356 | extern void tcf_destroy(struct tcf_proto *tp); |
| 337 | extern void tcf_destroy_chain(struct tcf_proto **fl); | 357 | extern void tcf_destroy_chain(struct tcf_proto **fl); |
| 338 | 358 | ||
| @@ -411,12 +431,20 @@ enum net_xmit_qdisc_t { | |||
| 411 | #define net_xmit_drop_count(e) (1) | 431 | #define net_xmit_drop_count(e) (1) |
| 412 | #endif | 432 | #endif |
| 413 | 433 | ||
| 414 | static inline int qdisc_enqueue(struct sk_buff *skb, struct Qdisc *sch) | 434 | static inline void qdisc_calculate_pkt_len(struct sk_buff *skb, |
| 435 | const struct Qdisc *sch) | ||
| 415 | { | 436 | { |
| 416 | #ifdef CONFIG_NET_SCHED | 437 | #ifdef CONFIG_NET_SCHED |
| 417 | if (sch->stab) | 438 | struct qdisc_size_table *stab = rcu_dereference_bh(sch->stab); |
| 418 | qdisc_calculate_pkt_len(skb, sch->stab); | 439 | |
| 440 | if (stab) | ||
| 441 | __qdisc_calculate_pkt_len(skb, stab); | ||
| 419 | #endif | 442 | #endif |
| 443 | } | ||
| 444 | |||
| 445 | static inline int qdisc_enqueue(struct sk_buff *skb, struct Qdisc *sch) | ||
| 446 | { | ||
| 447 | qdisc_calculate_pkt_len(skb, sch); | ||
| 420 | return sch->enqueue(skb, sch); | 448 | return sch->enqueue(skb, sch); |
| 421 | } | 449 | } |
| 422 | 450 | ||
diff --git a/include/net/sock.h b/include/net/sock.h index bc1cf7d88ccb..da0534d3401c 100644 --- a/include/net/sock.h +++ b/include/net/sock.h | |||
| @@ -281,7 +281,7 @@ struct sock { | |||
| 281 | int sk_rcvbuf; | 281 | int sk_rcvbuf; |
| 282 | 282 | ||
| 283 | struct sk_filter __rcu *sk_filter; | 283 | struct sk_filter __rcu *sk_filter; |
| 284 | struct socket_wq *sk_wq; | 284 | struct socket_wq __rcu *sk_wq; |
| 285 | 285 | ||
| 286 | #ifdef CONFIG_NET_DMA | 286 | #ifdef CONFIG_NET_DMA |
| 287 | struct sk_buff_head sk_async_wait_queue; | 287 | struct sk_buff_head sk_async_wait_queue; |
| @@ -1191,7 +1191,7 @@ extern void sk_filter_release_rcu(struct rcu_head *rcu); | |||
| 1191 | static inline void sk_filter_release(struct sk_filter *fp) | 1191 | static inline void sk_filter_release(struct sk_filter *fp) |
| 1192 | { | 1192 | { |
| 1193 | if (atomic_dec_and_test(&fp->refcnt)) | 1193 | if (atomic_dec_and_test(&fp->refcnt)) |
| 1194 | call_rcu_bh(&fp->rcu, sk_filter_release_rcu); | 1194 | call_rcu(&fp->rcu, sk_filter_release_rcu); |
| 1195 | } | 1195 | } |
| 1196 | 1196 | ||
| 1197 | static inline void sk_filter_uncharge(struct sock *sk, struct sk_filter *fp) | 1197 | static inline void sk_filter_uncharge(struct sock *sk, struct sk_filter *fp) |
| @@ -1266,7 +1266,8 @@ static inline void sk_set_socket(struct sock *sk, struct socket *sock) | |||
| 1266 | 1266 | ||
| 1267 | static inline wait_queue_head_t *sk_sleep(struct sock *sk) | 1267 | static inline wait_queue_head_t *sk_sleep(struct sock *sk) |
| 1268 | { | 1268 | { |
| 1269 | return &sk->sk_wq->wait; | 1269 | BUILD_BUG_ON(offsetof(struct socket_wq, wait) != 0); |
| 1270 | return &rcu_dereference_raw(sk->sk_wq)->wait; | ||
| 1270 | } | 1271 | } |
| 1271 | /* Detach socket from process context. | 1272 | /* Detach socket from process context. |
| 1272 | * Announce socket dead, detach it from wait queue and inode. | 1273 | * Announce socket dead, detach it from wait queue and inode. |
| @@ -1287,7 +1288,7 @@ static inline void sock_orphan(struct sock *sk) | |||
| 1287 | static inline void sock_graft(struct sock *sk, struct socket *parent) | 1288 | static inline void sock_graft(struct sock *sk, struct socket *parent) |
| 1288 | { | 1289 | { |
| 1289 | write_lock_bh(&sk->sk_callback_lock); | 1290 | write_lock_bh(&sk->sk_callback_lock); |
| 1290 | rcu_assign_pointer(sk->sk_wq, parent->wq); | 1291 | sk->sk_wq = parent->wq; |
| 1291 | parent->sk = sk; | 1292 | parent->sk = sk; |
| 1292 | sk_set_socket(sk, parent); | 1293 | sk_set_socket(sk, parent); |
| 1293 | security_sock_graft(sk, parent); | 1294 | security_sock_graft(sk, parent); |
diff --git a/include/net/tcp.h b/include/net/tcp.h index 38509f047382..cda30ea354a2 100644 --- a/include/net/tcp.h +++ b/include/net/tcp.h | |||
| @@ -196,6 +196,9 @@ extern void tcp_time_wait(struct sock *sk, int state, int timeo); | |||
| 196 | /* TCP thin-stream limits */ | 196 | /* TCP thin-stream limits */ |
| 197 | #define TCP_THIN_LINEAR_RETRIES 6 /* After 6 linear retries, do exp. backoff */ | 197 | #define TCP_THIN_LINEAR_RETRIES 6 /* After 6 linear retries, do exp. backoff */ |
| 198 | 198 | ||
| 199 | /* TCP initial congestion window as per draft-hkchu-tcpm-initcwnd-01 */ | ||
| 200 | #define TCP_INIT_CWND 10 | ||
| 201 | |||
| 199 | extern struct inet_timewait_death_row tcp_death_row; | 202 | extern struct inet_timewait_death_row tcp_death_row; |
| 200 | 203 | ||
| 201 | /* sysctl variables for tcp */ | 204 | /* sysctl variables for tcp */ |
| @@ -799,15 +802,6 @@ static inline __u32 tcp_current_ssthresh(const struct sock *sk) | |||
| 799 | /* Use define here intentionally to get WARN_ON location shown at the caller */ | 802 | /* Use define here intentionally to get WARN_ON location shown at the caller */ |
| 800 | #define tcp_verify_left_out(tp) WARN_ON(tcp_left_out(tp) > tp->packets_out) | 803 | #define tcp_verify_left_out(tp) WARN_ON(tcp_left_out(tp) > tp->packets_out) |
| 801 | 804 | ||
| 802 | /* | ||
| 803 | * Convert RFC 3390 larger initial window into an equivalent number of packets. | ||
| 804 | * This is based on the numbers specified in RFC 5681, 3.1. | ||
| 805 | */ | ||
| 806 | static inline u32 rfc3390_bytes_to_packets(const u32 smss) | ||
| 807 | { | ||
| 808 | return smss <= 1095 ? 4 : (smss > 2190 ? 2 : 3); | ||
| 809 | } | ||
| 810 | |||
| 811 | extern void tcp_enter_cwr(struct sock *sk, const int set_ssthresh); | 805 | extern void tcp_enter_cwr(struct sock *sk, const int set_ssthresh); |
| 812 | extern __u32 tcp_init_cwnd(struct tcp_sock *tp, struct dst_entry *dst); | 806 | extern __u32 tcp_init_cwnd(struct tcp_sock *tp, struct dst_entry *dst); |
| 813 | 807 | ||
| @@ -1074,8 +1068,6 @@ static inline int tcp_paws_reject(const struct tcp_options_received *rx_opt, | |||
| 1074 | return 1; | 1068 | return 1; |
| 1075 | } | 1069 | } |
| 1076 | 1070 | ||
| 1077 | #define TCP_CHECK_TIMER(sk) do { } while (0) | ||
| 1078 | |||
| 1079 | static inline void tcp_mib_init(struct net *net) | 1071 | static inline void tcp_mib_init(struct net *net) |
| 1080 | { | 1072 | { |
| 1081 | /* See RFC 2012 */ | 1073 | /* See RFC 2012 */ |
| @@ -1404,7 +1396,7 @@ extern struct request_sock_ops tcp6_request_sock_ops; | |||
| 1404 | extern void tcp_v4_destroy_sock(struct sock *sk); | 1396 | extern void tcp_v4_destroy_sock(struct sock *sk); |
| 1405 | 1397 | ||
| 1406 | extern int tcp_v4_gso_send_check(struct sk_buff *skb); | 1398 | extern int tcp_v4_gso_send_check(struct sk_buff *skb); |
| 1407 | extern struct sk_buff *tcp_tso_segment(struct sk_buff *skb, int features); | 1399 | extern struct sk_buff *tcp_tso_segment(struct sk_buff *skb, u32 features); |
| 1408 | extern struct sk_buff **tcp_gro_receive(struct sk_buff **head, | 1400 | extern struct sk_buff **tcp_gro_receive(struct sk_buff **head, |
| 1409 | struct sk_buff *skb); | 1401 | struct sk_buff *skb); |
| 1410 | extern struct sk_buff **tcp4_gro_receive(struct sk_buff **head, | 1402 | extern struct sk_buff **tcp4_gro_receive(struct sk_buff **head, |
diff --git a/include/net/transp_v6.h b/include/net/transp_v6.h index 42a0eb68b7b6..eeb077dd735f 100644 --- a/include/net/transp_v6.h +++ b/include/net/transp_v6.h | |||
| @@ -14,7 +14,7 @@ extern struct proto udpv6_prot; | |||
| 14 | extern struct proto udplitev6_prot; | 14 | extern struct proto udplitev6_prot; |
| 15 | extern struct proto tcpv6_prot; | 15 | extern struct proto tcpv6_prot; |
| 16 | 16 | ||
| 17 | struct flowi; | 17 | struct flowi6; |
| 18 | 18 | ||
| 19 | /* extention headers */ | 19 | /* extention headers */ |
| 20 | extern int ipv6_exthdrs_init(void); | 20 | extern int ipv6_exthdrs_init(void); |
| @@ -42,7 +42,7 @@ extern int datagram_recv_ctl(struct sock *sk, | |||
| 42 | 42 | ||
| 43 | extern int datagram_send_ctl(struct net *net, | 43 | extern int datagram_send_ctl(struct net *net, |
| 44 | struct msghdr *msg, | 44 | struct msghdr *msg, |
| 45 | struct flowi *fl, | 45 | struct flowi6 *fl6, |
| 46 | struct ipv6_txoptions *opt, | 46 | struct ipv6_txoptions *opt, |
| 47 | int *hlimit, int *tclass, | 47 | int *hlimit, int *tclass, |
| 48 | int *dontfrag); | 48 | int *dontfrag); |
diff --git a/include/net/udp.h b/include/net/udp.h index bb967dd59bf7..67ea6fcb3ec0 100644 --- a/include/net/udp.h +++ b/include/net/udp.h | |||
| @@ -144,6 +144,17 @@ static inline __wsum udp_csum_outgoing(struct sock *sk, struct sk_buff *skb) | |||
| 144 | return csum; | 144 | return csum; |
| 145 | } | 145 | } |
| 146 | 146 | ||
| 147 | static inline __wsum udp_csum(struct sk_buff *skb) | ||
| 148 | { | ||
| 149 | __wsum csum = csum_partial(skb_transport_header(skb), | ||
| 150 | sizeof(struct udphdr), skb->csum); | ||
| 151 | |||
| 152 | for (skb = skb_shinfo(skb)->frag_list; skb; skb = skb->next) { | ||
| 153 | csum = csum_add(csum, skb->csum); | ||
| 154 | } | ||
| 155 | return csum; | ||
| 156 | } | ||
| 157 | |||
| 147 | /* hash routines shared between UDPv4/6 and UDP-Litev4/6 */ | 158 | /* hash routines shared between UDPv4/6 and UDP-Litev4/6 */ |
| 148 | static inline void udp_lib_hash(struct sock *sk) | 159 | static inline void udp_lib_hash(struct sock *sk) |
| 149 | { | 160 | { |
| @@ -245,5 +256,5 @@ extern void udp4_proc_exit(void); | |||
| 245 | extern void udp_init(void); | 256 | extern void udp_init(void); |
| 246 | 257 | ||
| 247 | extern int udp4_ufo_send_check(struct sk_buff *skb); | 258 | extern int udp4_ufo_send_check(struct sk_buff *skb); |
| 248 | extern struct sk_buff *udp4_ufo_fragment(struct sk_buff *skb, int features); | 259 | extern struct sk_buff *udp4_ufo_fragment(struct sk_buff *skb, u32 features); |
| 249 | #endif /* _UDP_H */ | 260 | #endif /* _UDP_H */ |
diff --git a/include/net/udplite.h b/include/net/udplite.h index afdffe607b24..673a024c6b2a 100644 --- a/include/net/udplite.h +++ b/include/net/udplite.h | |||
| @@ -115,6 +115,18 @@ static inline __wsum udplite_csum_outgoing(struct sock *sk, struct sk_buff *skb) | |||
| 115 | return csum; | 115 | return csum; |
| 116 | } | 116 | } |
| 117 | 117 | ||
| 118 | static inline __wsum udplite_csum(struct sk_buff *skb) | ||
| 119 | { | ||
| 120 | struct sock *sk = skb->sk; | ||
| 121 | int cscov = udplite_sender_cscov(udp_sk(sk), udp_hdr(skb)); | ||
| 122 | const int off = skb_transport_offset(skb); | ||
| 123 | const int len = skb->len - off; | ||
| 124 | |||
| 125 | skb->ip_summed = CHECKSUM_NONE; /* no HW support for checksumming */ | ||
| 126 | |||
| 127 | return skb_checksum(skb, off, min(cscov, len), 0); | ||
| 128 | } | ||
| 129 | |||
| 118 | extern void udplite4_register(void); | 130 | extern void udplite4_register(void); |
| 119 | extern int udplite_get_port(struct sock *sk, unsigned short snum, | 131 | extern int udplite_get_port(struct sock *sk, unsigned short snum, |
| 120 | int (*scmp)(const struct sock *, const struct sock *)); | 132 | int (*scmp)(const struct sock *, const struct sock *)); |
diff --git a/include/net/xfrm.h b/include/net/xfrm.h index b9f385da758e..42a8c32a10e2 100644 --- a/include/net/xfrm.h +++ b/include/net/xfrm.h | |||
| @@ -36,6 +36,7 @@ | |||
| 36 | #define XFRM_PROTO_ROUTING IPPROTO_ROUTING | 36 | #define XFRM_PROTO_ROUTING IPPROTO_ROUTING |
| 37 | #define XFRM_PROTO_DSTOPTS IPPROTO_DSTOPTS | 37 | #define XFRM_PROTO_DSTOPTS IPPROTO_DSTOPTS |
| 38 | 38 | ||
| 39 | #define XFRM_ALIGN4(len) (((len) + 3) & ~3) | ||
| 39 | #define XFRM_ALIGN8(len) (((len) + 7) & ~7) | 40 | #define XFRM_ALIGN8(len) (((len) + 7) & ~7) |
| 40 | #define MODULE_ALIAS_XFRM_MODE(family, encap) \ | 41 | #define MODULE_ALIAS_XFRM_MODE(family, encap) \ |
| 41 | MODULE_ALIAS("xfrm-mode-" __stringify(family) "-" __stringify(encap)) | 42 | MODULE_ALIAS("xfrm-mode-" __stringify(family) "-" __stringify(encap)) |
| @@ -185,9 +186,14 @@ struct xfrm_state { | |||
| 185 | 186 | ||
| 186 | /* State for replay detection */ | 187 | /* State for replay detection */ |
| 187 | struct xfrm_replay_state replay; | 188 | struct xfrm_replay_state replay; |
| 189 | struct xfrm_replay_state_esn *replay_esn; | ||
| 188 | 190 | ||
| 189 | /* Replay detection state at the time we sent the last notification */ | 191 | /* Replay detection state at the time we sent the last notification */ |
| 190 | struct xfrm_replay_state preplay; | 192 | struct xfrm_replay_state preplay; |
| 193 | struct xfrm_replay_state_esn *preplay_esn; | ||
| 194 | |||
| 195 | /* The functions for replay detection. */ | ||
| 196 | struct xfrm_replay *repl; | ||
| 191 | 197 | ||
| 192 | /* internal flag that only holds state for delayed aevent at the | 198 | /* internal flag that only holds state for delayed aevent at the |
| 193 | * moment | 199 | * moment |
| @@ -258,6 +264,15 @@ struct km_event { | |||
| 258 | struct net *net; | 264 | struct net *net; |
| 259 | }; | 265 | }; |
| 260 | 266 | ||
| 267 | struct xfrm_replay { | ||
| 268 | void (*advance)(struct xfrm_state *x, __be32 net_seq); | ||
| 269 | int (*check)(struct xfrm_state *x, | ||
| 270 | struct sk_buff *skb, | ||
| 271 | __be32 net_seq); | ||
| 272 | void (*notify)(struct xfrm_state *x, int event); | ||
| 273 | int (*overflow)(struct xfrm_state *x, struct sk_buff *skb); | ||
| 274 | }; | ||
| 275 | |||
| 261 | struct net_device; | 276 | struct net_device; |
| 262 | struct xfrm_type; | 277 | struct xfrm_type; |
| 263 | struct xfrm_dst; | 278 | struct xfrm_dst; |
| @@ -266,25 +281,26 @@ struct xfrm_policy_afinfo { | |||
| 266 | struct dst_ops *dst_ops; | 281 | struct dst_ops *dst_ops; |
| 267 | void (*garbage_collect)(struct net *net); | 282 | void (*garbage_collect)(struct net *net); |
| 268 | struct dst_entry *(*dst_lookup)(struct net *net, int tos, | 283 | struct dst_entry *(*dst_lookup)(struct net *net, int tos, |
| 269 | xfrm_address_t *saddr, | 284 | const xfrm_address_t *saddr, |
| 270 | xfrm_address_t *daddr); | 285 | const xfrm_address_t *daddr); |
| 271 | int (*get_saddr)(struct net *net, xfrm_address_t *saddr, xfrm_address_t *daddr); | 286 | int (*get_saddr)(struct net *net, xfrm_address_t *saddr, xfrm_address_t *daddr); |
| 272 | void (*decode_session)(struct sk_buff *skb, | 287 | void (*decode_session)(struct sk_buff *skb, |
| 273 | struct flowi *fl, | 288 | struct flowi *fl, |
| 274 | int reverse); | 289 | int reverse); |
| 275 | int (*get_tos)(struct flowi *fl); | 290 | int (*get_tos)(const struct flowi *fl); |
| 276 | int (*init_path)(struct xfrm_dst *path, | 291 | int (*init_path)(struct xfrm_dst *path, |
| 277 | struct dst_entry *dst, | 292 | struct dst_entry *dst, |
| 278 | int nfheader_len); | 293 | int nfheader_len); |
| 279 | int (*fill_dst)(struct xfrm_dst *xdst, | 294 | int (*fill_dst)(struct xfrm_dst *xdst, |
| 280 | struct net_device *dev, | 295 | struct net_device *dev, |
| 281 | struct flowi *fl); | 296 | const struct flowi *fl); |
| 297 | struct dst_entry *(*blackhole_route)(struct net *net, struct dst_entry *orig); | ||
| 282 | }; | 298 | }; |
| 283 | 299 | ||
| 284 | extern int xfrm_policy_register_afinfo(struct xfrm_policy_afinfo *afinfo); | 300 | extern int xfrm_policy_register_afinfo(struct xfrm_policy_afinfo *afinfo); |
| 285 | extern int xfrm_policy_unregister_afinfo(struct xfrm_policy_afinfo *afinfo); | 301 | extern int xfrm_policy_unregister_afinfo(struct xfrm_policy_afinfo *afinfo); |
| 286 | extern void km_policy_notify(struct xfrm_policy *xp, int dir, struct km_event *c); | 302 | extern void km_policy_notify(struct xfrm_policy *xp, int dir, const struct km_event *c); |
| 287 | extern void km_state_notify(struct xfrm_state *x, struct km_event *c); | 303 | extern void km_state_notify(struct xfrm_state *x, const struct km_event *c); |
| 288 | 304 | ||
| 289 | struct xfrm_tmpl; | 305 | struct xfrm_tmpl; |
| 290 | extern int km_query(struct xfrm_state *x, struct xfrm_tmpl *t, struct xfrm_policy *pol); | 306 | extern int km_query(struct xfrm_state *x, struct xfrm_tmpl *t, struct xfrm_policy *pol); |
| @@ -299,9 +315,12 @@ struct xfrm_state_afinfo { | |||
| 299 | const struct xfrm_type *type_map[IPPROTO_MAX]; | 315 | const struct xfrm_type *type_map[IPPROTO_MAX]; |
| 300 | struct xfrm_mode *mode_map[XFRM_MODE_MAX]; | 316 | struct xfrm_mode *mode_map[XFRM_MODE_MAX]; |
| 301 | int (*init_flags)(struct xfrm_state *x); | 317 | int (*init_flags)(struct xfrm_state *x); |
| 302 | void (*init_tempsel)(struct xfrm_selector *sel, struct flowi *fl); | 318 | void (*init_tempsel)(struct xfrm_selector *sel, |
| 303 | void (*init_temprop)(struct xfrm_state *x, struct xfrm_tmpl *tmpl, | 319 | const struct flowi *fl); |
| 304 | xfrm_address_t *daddr, xfrm_address_t *saddr); | 320 | void (*init_temprop)(struct xfrm_state *x, |
| 321 | const struct xfrm_tmpl *tmpl, | ||
| 322 | const xfrm_address_t *daddr, | ||
| 323 | const xfrm_address_t *saddr); | ||
| 305 | int (*tmpl_sort)(struct xfrm_tmpl **dst, struct xfrm_tmpl **src, int n); | 324 | int (*tmpl_sort)(struct xfrm_tmpl **dst, struct xfrm_tmpl **src, int n); |
| 306 | int (*state_sort)(struct xfrm_state **dst, struct xfrm_state **src, int n); | 325 | int (*state_sort)(struct xfrm_state **dst, struct xfrm_state **src, int n); |
| 307 | int (*output)(struct sk_buff *skb); | 326 | int (*output)(struct sk_buff *skb); |
| @@ -332,7 +351,8 @@ struct xfrm_type { | |||
| 332 | void (*destructor)(struct xfrm_state *); | 351 | void (*destructor)(struct xfrm_state *); |
| 333 | int (*input)(struct xfrm_state *, struct sk_buff *skb); | 352 | int (*input)(struct xfrm_state *, struct sk_buff *skb); |
| 334 | int (*output)(struct xfrm_state *, struct sk_buff *pskb); | 353 | int (*output)(struct xfrm_state *, struct sk_buff *pskb); |
| 335 | int (*reject)(struct xfrm_state *, struct sk_buff *, struct flowi *); | 354 | int (*reject)(struct xfrm_state *, struct sk_buff *, |
| 355 | const struct flowi *); | ||
| 336 | int (*hdr_offset)(struct xfrm_state *, struct sk_buff *, u8 **); | 356 | int (*hdr_offset)(struct xfrm_state *, struct sk_buff *, u8 **); |
| 337 | /* Estimate maximal size of result of transformation of a dgram */ | 357 | /* Estimate maximal size of result of transformation of a dgram */ |
| 338 | u32 (*get_mtu)(struct xfrm_state *, int size); | 358 | u32 (*get_mtu)(struct xfrm_state *, int size); |
| @@ -501,7 +521,7 @@ struct xfrm_policy { | |||
| 501 | struct xfrm_tmpl xfrm_vec[XFRM_MAX_DEPTH]; | 521 | struct xfrm_tmpl xfrm_vec[XFRM_MAX_DEPTH]; |
| 502 | }; | 522 | }; |
| 503 | 523 | ||
| 504 | static inline struct net *xp_net(struct xfrm_policy *xp) | 524 | static inline struct net *xp_net(const struct xfrm_policy *xp) |
| 505 | { | 525 | { |
| 506 | return read_pnet(&xp->xp_net); | 526 | return read_pnet(&xp->xp_net); |
| 507 | } | 527 | } |
| @@ -545,13 +565,17 @@ struct xfrm_migrate { | |||
| 545 | struct xfrm_mgr { | 565 | struct xfrm_mgr { |
| 546 | struct list_head list; | 566 | struct list_head list; |
| 547 | char *id; | 567 | char *id; |
| 548 | int (*notify)(struct xfrm_state *x, struct km_event *c); | 568 | int (*notify)(struct xfrm_state *x, const struct km_event *c); |
| 549 | int (*acquire)(struct xfrm_state *x, struct xfrm_tmpl *, struct xfrm_policy *xp, int dir); | 569 | int (*acquire)(struct xfrm_state *x, struct xfrm_tmpl *, struct xfrm_policy *xp, int dir); |
| 550 | struct xfrm_policy *(*compile_policy)(struct sock *sk, int opt, u8 *data, int len, int *dir); | 570 | struct xfrm_policy *(*compile_policy)(struct sock *sk, int opt, u8 *data, int len, int *dir); |
| 551 | int (*new_mapping)(struct xfrm_state *x, xfrm_address_t *ipaddr, __be16 sport); | 571 | int (*new_mapping)(struct xfrm_state *x, xfrm_address_t *ipaddr, __be16 sport); |
| 552 | int (*notify_policy)(struct xfrm_policy *x, int dir, struct km_event *c); | 572 | int (*notify_policy)(struct xfrm_policy *x, int dir, const struct km_event *c); |
| 553 | int (*report)(struct net *net, u8 proto, struct xfrm_selector *sel, xfrm_address_t *addr); | 573 | int (*report)(struct net *net, u8 proto, struct xfrm_selector *sel, xfrm_address_t *addr); |
| 554 | int (*migrate)(struct xfrm_selector *sel, u8 dir, u8 type, struct xfrm_migrate *m, int num_bundles, struct xfrm_kmaddress *k); | 574 | int (*migrate)(const struct xfrm_selector *sel, |
| 575 | u8 dir, u8 type, | ||
| 576 | const struct xfrm_migrate *m, | ||
| 577 | int num_bundles, | ||
| 578 | const struct xfrm_kmaddress *k); | ||
| 555 | }; | 579 | }; |
| 556 | 580 | ||
| 557 | extern int xfrm_register_km(struct xfrm_mgr *km); | 581 | extern int xfrm_register_km(struct xfrm_mgr *km); |
| @@ -570,8 +594,14 @@ struct xfrm_skb_cb { | |||
| 570 | 594 | ||
| 571 | /* Sequence number for replay protection. */ | 595 | /* Sequence number for replay protection. */ |
| 572 | union { | 596 | union { |
| 573 | u64 output; | 597 | struct { |
| 574 | __be32 input; | 598 | __u32 low; |
| 599 | __u32 hi; | ||
| 600 | } output; | ||
| 601 | struct { | ||
| 602 | __be32 low; | ||
| 603 | __be32 hi; | ||
| 604 | } input; | ||
| 575 | } seq; | 605 | } seq; |
| 576 | }; | 606 | }; |
| 577 | 607 | ||
| @@ -675,6 +705,8 @@ extern void xfrm_audit_state_delete(struct xfrm_state *x, int result, | |||
| 675 | u32 auid, u32 ses, u32 secid); | 705 | u32 auid, u32 ses, u32 secid); |
| 676 | extern void xfrm_audit_state_replay_overflow(struct xfrm_state *x, | 706 | extern void xfrm_audit_state_replay_overflow(struct xfrm_state *x, |
| 677 | struct sk_buff *skb); | 707 | struct sk_buff *skb); |
| 708 | extern void xfrm_audit_state_replay(struct xfrm_state *x, | ||
| 709 | struct sk_buff *skb, __be32 net_seq); | ||
| 678 | extern void xfrm_audit_state_notfound_simple(struct sk_buff *skb, u16 family); | 710 | extern void xfrm_audit_state_notfound_simple(struct sk_buff *skb, u16 family); |
| 679 | extern void xfrm_audit_state_notfound(struct sk_buff *skb, u16 family, | 711 | extern void xfrm_audit_state_notfound(struct sk_buff *skb, u16 family, |
| 680 | __be32 net_spi, __be32 net_seq); | 712 | __be32 net_spi, __be32 net_seq); |
| @@ -707,6 +739,11 @@ static inline void xfrm_audit_state_replay_overflow(struct xfrm_state *x, | |||
| 707 | { | 739 | { |
| 708 | } | 740 | } |
| 709 | 741 | ||
| 742 | static inline void xfrm_audit_state_replay(struct xfrm_state *x, | ||
| 743 | struct sk_buff *skb, __be32 net_seq) | ||
| 744 | { | ||
| 745 | } | ||
| 746 | |||
| 710 | static inline void xfrm_audit_state_notfound_simple(struct sk_buff *skb, | 747 | static inline void xfrm_audit_state_notfound_simple(struct sk_buff *skb, |
| 711 | u16 family) | 748 | u16 family) |
| 712 | { | 749 | { |
| @@ -762,10 +799,11 @@ static inline void xfrm_state_hold(struct xfrm_state *x) | |||
| 762 | atomic_inc(&x->refcnt); | 799 | atomic_inc(&x->refcnt); |
| 763 | } | 800 | } |
| 764 | 801 | ||
| 765 | static __inline__ int addr_match(void *token1, void *token2, int prefixlen) | 802 | static inline bool addr_match(const void *token1, const void *token2, |
| 803 | int prefixlen) | ||
| 766 | { | 804 | { |
| 767 | __be32 *a1 = token1; | 805 | const __be32 *a1 = token1; |
| 768 | __be32 *a2 = token2; | 806 | const __be32 *a2 = token2; |
| 769 | int pdw; | 807 | int pdw; |
| 770 | int pbi; | 808 | int pbi; |
| 771 | 809 | ||
| @@ -774,7 +812,7 @@ static __inline__ int addr_match(void *token1, void *token2, int prefixlen) | |||
| 774 | 812 | ||
| 775 | if (pdw) | 813 | if (pdw) |
| 776 | if (memcmp(a1, a2, pdw << 2)) | 814 | if (memcmp(a1, a2, pdw << 2)) |
| 777 | return 0; | 815 | return false; |
| 778 | 816 | ||
| 779 | if (pbi) { | 817 | if (pbi) { |
| 780 | __be32 mask; | 818 | __be32 mask; |
| @@ -782,32 +820,32 @@ static __inline__ int addr_match(void *token1, void *token2, int prefixlen) | |||
| 782 | mask = htonl((0xffffffff) << (32 - pbi)); | 820 | mask = htonl((0xffffffff) << (32 - pbi)); |
| 783 | 821 | ||
| 784 | if ((a1[pdw] ^ a2[pdw]) & mask) | 822 | if ((a1[pdw] ^ a2[pdw]) & mask) |
| 785 | return 0; | 823 | return false; |
| 786 | } | 824 | } |
| 787 | 825 | ||
| 788 | return 1; | 826 | return true; |
| 789 | } | 827 | } |
| 790 | 828 | ||
| 791 | static __inline__ | 829 | static __inline__ |
| 792 | __be16 xfrm_flowi_sport(struct flowi *fl) | 830 | __be16 xfrm_flowi_sport(const struct flowi *fl, const union flowi_uli *uli) |
| 793 | { | 831 | { |
| 794 | __be16 port; | 832 | __be16 port; |
| 795 | switch(fl->proto) { | 833 | switch(fl->flowi_proto) { |
| 796 | case IPPROTO_TCP: | 834 | case IPPROTO_TCP: |
| 797 | case IPPROTO_UDP: | 835 | case IPPROTO_UDP: |
| 798 | case IPPROTO_UDPLITE: | 836 | case IPPROTO_UDPLITE: |
| 799 | case IPPROTO_SCTP: | 837 | case IPPROTO_SCTP: |
| 800 | port = fl->fl_ip_sport; | 838 | port = uli->ports.sport; |
| 801 | break; | 839 | break; |
| 802 | case IPPROTO_ICMP: | 840 | case IPPROTO_ICMP: |
| 803 | case IPPROTO_ICMPV6: | 841 | case IPPROTO_ICMPV6: |
| 804 | port = htons(fl->fl_icmp_type); | 842 | port = htons(uli->icmpt.type); |
| 805 | break; | 843 | break; |
| 806 | case IPPROTO_MH: | 844 | case IPPROTO_MH: |
| 807 | port = htons(fl->fl_mh_type); | 845 | port = htons(uli->mht.type); |
| 808 | break; | 846 | break; |
| 809 | case IPPROTO_GRE: | 847 | case IPPROTO_GRE: |
| 810 | port = htons(ntohl(fl->fl_gre_key) >> 16); | 848 | port = htons(ntohl(uli->gre_key) >> 16); |
| 811 | break; | 849 | break; |
| 812 | default: | 850 | default: |
| 813 | port = 0; /*XXX*/ | 851 | port = 0; /*XXX*/ |
| @@ -816,22 +854,22 @@ __be16 xfrm_flowi_sport(struct flowi *fl) | |||
| 816 | } | 854 | } |
| 817 | 855 | ||
| 818 | static __inline__ | 856 | static __inline__ |
| 819 | __be16 xfrm_flowi_dport(struct flowi *fl) | 857 | __be16 xfrm_flowi_dport(const struct flowi *fl, const union flowi_uli *uli) |
| 820 | { | 858 | { |
| 821 | __be16 port; | 859 | __be16 port; |
| 822 | switch(fl->proto) { | 860 | switch(fl->flowi_proto) { |
| 823 | case IPPROTO_TCP: | 861 | case IPPROTO_TCP: |
| 824 | case IPPROTO_UDP: | 862 | case IPPROTO_UDP: |
| 825 | case IPPROTO_UDPLITE: | 863 | case IPPROTO_UDPLITE: |
| 826 | case IPPROTO_SCTP: | 864 | case IPPROTO_SCTP: |
| 827 | port = fl->fl_ip_dport; | 865 | port = uli->ports.dport; |
| 828 | break; | 866 | break; |
| 829 | case IPPROTO_ICMP: | 867 | case IPPROTO_ICMP: |
| 830 | case IPPROTO_ICMPV6: | 868 | case IPPROTO_ICMPV6: |
| 831 | port = htons(fl->fl_icmp_code); | 869 | port = htons(uli->icmpt.code); |
| 832 | break; | 870 | break; |
| 833 | case IPPROTO_GRE: | 871 | case IPPROTO_GRE: |
| 834 | port = htons(ntohl(fl->fl_gre_key) & 0xffff); | 872 | port = htons(ntohl(uli->gre_key) & 0xffff); |
| 835 | break; | 873 | break; |
| 836 | default: | 874 | default: |
| 837 | port = 0; /*XXX*/ | 875 | port = 0; /*XXX*/ |
| @@ -839,7 +877,8 @@ __be16 xfrm_flowi_dport(struct flowi *fl) | |||
| 839 | return port; | 877 | return port; |
| 840 | } | 878 | } |
| 841 | 879 | ||
| 842 | extern int xfrm_selector_match(struct xfrm_selector *sel, struct flowi *fl, | 880 | extern int xfrm_selector_match(const struct xfrm_selector *sel, |
| 881 | const struct flowi *fl, | ||
| 843 | unsigned short family); | 882 | unsigned short family); |
| 844 | 883 | ||
| 845 | #ifdef CONFIG_SECURITY_NETWORK_XFRM | 884 | #ifdef CONFIG_SECURITY_NETWORK_XFRM |
| @@ -947,7 +986,7 @@ secpath_reset(struct sk_buff *skb) | |||
| 947 | } | 986 | } |
| 948 | 987 | ||
| 949 | static inline int | 988 | static inline int |
| 950 | xfrm_addr_any(xfrm_address_t *addr, unsigned short family) | 989 | xfrm_addr_any(const xfrm_address_t *addr, unsigned short family) |
| 951 | { | 990 | { |
| 952 | switch (family) { | 991 | switch (family) { |
| 953 | case AF_INET: | 992 | case AF_INET: |
| @@ -959,21 +998,21 @@ xfrm_addr_any(xfrm_address_t *addr, unsigned short family) | |||
| 959 | } | 998 | } |
| 960 | 999 | ||
| 961 | static inline int | 1000 | static inline int |
| 962 | __xfrm4_state_addr_cmp(struct xfrm_tmpl *tmpl, struct xfrm_state *x) | 1001 | __xfrm4_state_addr_cmp(const struct xfrm_tmpl *tmpl, const struct xfrm_state *x) |
| 963 | { | 1002 | { |
| 964 | return (tmpl->saddr.a4 && | 1003 | return (tmpl->saddr.a4 && |
| 965 | tmpl->saddr.a4 != x->props.saddr.a4); | 1004 | tmpl->saddr.a4 != x->props.saddr.a4); |
| 966 | } | 1005 | } |
| 967 | 1006 | ||
| 968 | static inline int | 1007 | static inline int |
| 969 | __xfrm6_state_addr_cmp(struct xfrm_tmpl *tmpl, struct xfrm_state *x) | 1008 | __xfrm6_state_addr_cmp(const struct xfrm_tmpl *tmpl, const struct xfrm_state *x) |
| 970 | { | 1009 | { |
| 971 | return (!ipv6_addr_any((struct in6_addr*)&tmpl->saddr) && | 1010 | return (!ipv6_addr_any((struct in6_addr*)&tmpl->saddr) && |
| 972 | ipv6_addr_cmp((struct in6_addr *)&tmpl->saddr, (struct in6_addr*)&x->props.saddr)); | 1011 | ipv6_addr_cmp((struct in6_addr *)&tmpl->saddr, (struct in6_addr*)&x->props.saddr)); |
| 973 | } | 1012 | } |
| 974 | 1013 | ||
| 975 | static inline int | 1014 | static inline int |
| 976 | xfrm_state_addr_cmp(struct xfrm_tmpl *tmpl, struct xfrm_state *x, unsigned short family) | 1015 | xfrm_state_addr_cmp(const struct xfrm_tmpl *tmpl, const struct xfrm_state *x, unsigned short family) |
| 977 | { | 1016 | { |
| 978 | switch (family) { | 1017 | switch (family) { |
| 979 | case AF_INET: | 1018 | case AF_INET: |
| @@ -1126,49 +1165,49 @@ static inline int xfrm6_policy_check_reverse(struct sock *sk, int dir, | |||
| 1126 | #endif | 1165 | #endif |
| 1127 | 1166 | ||
| 1128 | static __inline__ | 1167 | static __inline__ |
| 1129 | xfrm_address_t *xfrm_flowi_daddr(struct flowi *fl, unsigned short family) | 1168 | xfrm_address_t *xfrm_flowi_daddr(const struct flowi *fl, unsigned short family) |
| 1130 | { | 1169 | { |
| 1131 | switch (family){ | 1170 | switch (family){ |
| 1132 | case AF_INET: | 1171 | case AF_INET: |
| 1133 | return (xfrm_address_t *)&fl->fl4_dst; | 1172 | return (xfrm_address_t *)&fl->u.ip4.daddr; |
| 1134 | case AF_INET6: | 1173 | case AF_INET6: |
| 1135 | return (xfrm_address_t *)&fl->fl6_dst; | 1174 | return (xfrm_address_t *)&fl->u.ip6.daddr; |
| 1136 | } | 1175 | } |
| 1137 | return NULL; | 1176 | return NULL; |
| 1138 | } | 1177 | } |
| 1139 | 1178 | ||
| 1140 | static __inline__ | 1179 | static __inline__ |
| 1141 | xfrm_address_t *xfrm_flowi_saddr(struct flowi *fl, unsigned short family) | 1180 | xfrm_address_t *xfrm_flowi_saddr(const struct flowi *fl, unsigned short family) |
| 1142 | { | 1181 | { |
| 1143 | switch (family){ | 1182 | switch (family){ |
| 1144 | case AF_INET: | 1183 | case AF_INET: |
| 1145 | return (xfrm_address_t *)&fl->fl4_src; | 1184 | return (xfrm_address_t *)&fl->u.ip4.saddr; |
| 1146 | case AF_INET6: | 1185 | case AF_INET6: |
| 1147 | return (xfrm_address_t *)&fl->fl6_src; | 1186 | return (xfrm_address_t *)&fl->u.ip6.saddr; |
| 1148 | } | 1187 | } |
| 1149 | return NULL; | 1188 | return NULL; |
| 1150 | } | 1189 | } |
| 1151 | 1190 | ||
| 1152 | static __inline__ | 1191 | static __inline__ |
| 1153 | void xfrm_flowi_addr_get(struct flowi *fl, | 1192 | void xfrm_flowi_addr_get(const struct flowi *fl, |
| 1154 | xfrm_address_t *saddr, xfrm_address_t *daddr, | 1193 | xfrm_address_t *saddr, xfrm_address_t *daddr, |
| 1155 | unsigned short family) | 1194 | unsigned short family) |
| 1156 | { | 1195 | { |
| 1157 | switch(family) { | 1196 | switch(family) { |
| 1158 | case AF_INET: | 1197 | case AF_INET: |
| 1159 | memcpy(&saddr->a4, &fl->fl4_src, sizeof(saddr->a4)); | 1198 | memcpy(&saddr->a4, &fl->u.ip4.saddr, sizeof(saddr->a4)); |
| 1160 | memcpy(&daddr->a4, &fl->fl4_dst, sizeof(daddr->a4)); | 1199 | memcpy(&daddr->a4, &fl->u.ip4.daddr, sizeof(daddr->a4)); |
| 1161 | break; | 1200 | break; |
| 1162 | case AF_INET6: | 1201 | case AF_INET6: |
| 1163 | ipv6_addr_copy((struct in6_addr *)&saddr->a6, &fl->fl6_src); | 1202 | ipv6_addr_copy((struct in6_addr *)&saddr->a6, &fl->u.ip6.saddr); |
| 1164 | ipv6_addr_copy((struct in6_addr *)&daddr->a6, &fl->fl6_dst); | 1203 | ipv6_addr_copy((struct in6_addr *)&daddr->a6, &fl->u.ip6.daddr); |
| 1165 | break; | 1204 | break; |
| 1166 | } | 1205 | } |
| 1167 | } | 1206 | } |
| 1168 | 1207 | ||
| 1169 | static __inline__ int | 1208 | static __inline__ int |
| 1170 | __xfrm4_state_addr_check(struct xfrm_state *x, | 1209 | __xfrm4_state_addr_check(const struct xfrm_state *x, |
| 1171 | xfrm_address_t *daddr, xfrm_address_t *saddr) | 1210 | const xfrm_address_t *daddr, const xfrm_address_t *saddr) |
| 1172 | { | 1211 | { |
| 1173 | if (daddr->a4 == x->id.daddr.a4 && | 1212 | if (daddr->a4 == x->id.daddr.a4 && |
| 1174 | (saddr->a4 == x->props.saddr.a4 || !saddr->a4 || !x->props.saddr.a4)) | 1213 | (saddr->a4 == x->props.saddr.a4 || !saddr->a4 || !x->props.saddr.a4)) |
| @@ -1177,8 +1216,8 @@ __xfrm4_state_addr_check(struct xfrm_state *x, | |||
| 1177 | } | 1216 | } |
| 1178 | 1217 | ||
| 1179 | static __inline__ int | 1218 | static __inline__ int |
| 1180 | __xfrm6_state_addr_check(struct xfrm_state *x, | 1219 | __xfrm6_state_addr_check(const struct xfrm_state *x, |
| 1181 | xfrm_address_t *daddr, xfrm_address_t *saddr) | 1220 | const xfrm_address_t *daddr, const xfrm_address_t *saddr) |
| 1182 | { | 1221 | { |
| 1183 | if (!ipv6_addr_cmp((struct in6_addr *)daddr, (struct in6_addr *)&x->id.daddr) && | 1222 | if (!ipv6_addr_cmp((struct in6_addr *)daddr, (struct in6_addr *)&x->id.daddr) && |
| 1184 | (!ipv6_addr_cmp((struct in6_addr *)saddr, (struct in6_addr *)&x->props.saddr)|| | 1223 | (!ipv6_addr_cmp((struct in6_addr *)saddr, (struct in6_addr *)&x->props.saddr)|| |
| @@ -1189,8 +1228,8 @@ __xfrm6_state_addr_check(struct xfrm_state *x, | |||
| 1189 | } | 1228 | } |
| 1190 | 1229 | ||
| 1191 | static __inline__ int | 1230 | static __inline__ int |
| 1192 | xfrm_state_addr_check(struct xfrm_state *x, | 1231 | xfrm_state_addr_check(const struct xfrm_state *x, |
| 1193 | xfrm_address_t *daddr, xfrm_address_t *saddr, | 1232 | const xfrm_address_t *daddr, const xfrm_address_t *saddr, |
| 1194 | unsigned short family) | 1233 | unsigned short family) |
| 1195 | { | 1234 | { |
| 1196 | switch (family) { | 1235 | switch (family) { |
| @@ -1203,23 +1242,23 @@ xfrm_state_addr_check(struct xfrm_state *x, | |||
| 1203 | } | 1242 | } |
| 1204 | 1243 | ||
| 1205 | static __inline__ int | 1244 | static __inline__ int |
| 1206 | xfrm_state_addr_flow_check(struct xfrm_state *x, struct flowi *fl, | 1245 | xfrm_state_addr_flow_check(const struct xfrm_state *x, const struct flowi *fl, |
| 1207 | unsigned short family) | 1246 | unsigned short family) |
| 1208 | { | 1247 | { |
| 1209 | switch (family) { | 1248 | switch (family) { |
| 1210 | case AF_INET: | 1249 | case AF_INET: |
| 1211 | return __xfrm4_state_addr_check(x, | 1250 | return __xfrm4_state_addr_check(x, |
| 1212 | (xfrm_address_t *)&fl->fl4_dst, | 1251 | (const xfrm_address_t *)&fl->u.ip4.daddr, |
| 1213 | (xfrm_address_t *)&fl->fl4_src); | 1252 | (const xfrm_address_t *)&fl->u.ip4.saddr); |
| 1214 | case AF_INET6: | 1253 | case AF_INET6: |
| 1215 | return __xfrm6_state_addr_check(x, | 1254 | return __xfrm6_state_addr_check(x, |
| 1216 | (xfrm_address_t *)&fl->fl6_dst, | 1255 | (const xfrm_address_t *)&fl->u.ip6.daddr, |
| 1217 | (xfrm_address_t *)&fl->fl6_src); | 1256 | (const xfrm_address_t *)&fl->u.ip6.saddr); |
| 1218 | } | 1257 | } |
| 1219 | return 0; | 1258 | return 0; |
| 1220 | } | 1259 | } |
| 1221 | 1260 | ||
| 1222 | static inline int xfrm_state_kern(struct xfrm_state *x) | 1261 | static inline int xfrm_state_kern(const struct xfrm_state *x) |
| 1223 | { | 1262 | { |
| 1224 | return atomic_read(&x->tunnel_users); | 1263 | return atomic_read(&x->tunnel_users); |
| 1225 | } | 1264 | } |
| @@ -1323,8 +1362,10 @@ extern int xfrm_state_walk(struct net *net, struct xfrm_state_walk *walk, | |||
| 1323 | int (*func)(struct xfrm_state *, int, void*), void *); | 1362 | int (*func)(struct xfrm_state *, int, void*), void *); |
| 1324 | extern void xfrm_state_walk_done(struct xfrm_state_walk *walk); | 1363 | extern void xfrm_state_walk_done(struct xfrm_state_walk *walk); |
| 1325 | extern struct xfrm_state *xfrm_state_alloc(struct net *net); | 1364 | extern struct xfrm_state *xfrm_state_alloc(struct net *net); |
| 1326 | extern struct xfrm_state *xfrm_state_find(xfrm_address_t *daddr, xfrm_address_t *saddr, | 1365 | extern struct xfrm_state *xfrm_state_find(const xfrm_address_t *daddr, |
| 1327 | struct flowi *fl, struct xfrm_tmpl *tmpl, | 1366 | const xfrm_address_t *saddr, |
| 1367 | const struct flowi *fl, | ||
| 1368 | struct xfrm_tmpl *tmpl, | ||
| 1328 | struct xfrm_policy *pol, int *err, | 1369 | struct xfrm_policy *pol, int *err, |
| 1329 | unsigned short family); | 1370 | unsigned short family); |
| 1330 | extern struct xfrm_state *xfrm_stateonly_find(struct net *net, u32 mark, | 1371 | extern struct xfrm_state *xfrm_stateonly_find(struct net *net, u32 mark, |
| @@ -1337,11 +1378,11 @@ extern void xfrm_state_insert(struct xfrm_state *x); | |||
| 1337 | extern int xfrm_state_add(struct xfrm_state *x); | 1378 | extern int xfrm_state_add(struct xfrm_state *x); |
| 1338 | extern int xfrm_state_update(struct xfrm_state *x); | 1379 | extern int xfrm_state_update(struct xfrm_state *x); |
| 1339 | extern struct xfrm_state *xfrm_state_lookup(struct net *net, u32 mark, | 1380 | extern struct xfrm_state *xfrm_state_lookup(struct net *net, u32 mark, |
| 1340 | xfrm_address_t *daddr, __be32 spi, | 1381 | const xfrm_address_t *daddr, __be32 spi, |
| 1341 | u8 proto, unsigned short family); | 1382 | u8 proto, unsigned short family); |
| 1342 | extern struct xfrm_state *xfrm_state_lookup_byaddr(struct net *net, u32 mark, | 1383 | extern struct xfrm_state *xfrm_state_lookup_byaddr(struct net *net, u32 mark, |
| 1343 | xfrm_address_t *daddr, | 1384 | const xfrm_address_t *daddr, |
| 1344 | xfrm_address_t *saddr, | 1385 | const xfrm_address_t *saddr, |
| 1345 | u8 proto, | 1386 | u8 proto, |
| 1346 | unsigned short family); | 1387 | unsigned short family); |
| 1347 | #ifdef CONFIG_XFRM_SUB_POLICY | 1388 | #ifdef CONFIG_XFRM_SUB_POLICY |
| @@ -1386,10 +1427,8 @@ extern int xfrm_state_delete(struct xfrm_state *x); | |||
| 1386 | extern int xfrm_state_flush(struct net *net, u8 proto, struct xfrm_audit *audit_info); | 1427 | extern int xfrm_state_flush(struct net *net, u8 proto, struct xfrm_audit *audit_info); |
| 1387 | extern void xfrm_sad_getinfo(struct net *net, struct xfrmk_sadinfo *si); | 1428 | extern void xfrm_sad_getinfo(struct net *net, struct xfrmk_sadinfo *si); |
| 1388 | extern void xfrm_spd_getinfo(struct net *net, struct xfrmk_spdinfo *si); | 1429 | extern void xfrm_spd_getinfo(struct net *net, struct xfrmk_spdinfo *si); |
| 1389 | extern int xfrm_replay_check(struct xfrm_state *x, | 1430 | extern u32 xfrm_replay_seqhi(struct xfrm_state *x, __be32 net_seq); |
| 1390 | struct sk_buff *skb, __be32 seq); | 1431 | extern int xfrm_init_replay(struct xfrm_state *x); |
| 1391 | extern void xfrm_replay_advance(struct xfrm_state *x, __be32 seq); | ||
| 1392 | extern void xfrm_replay_notify(struct xfrm_state *x, int event); | ||
| 1393 | extern int xfrm_state_mtu(struct xfrm_state *x, int mtu); | 1432 | extern int xfrm_state_mtu(struct xfrm_state *x, int mtu); |
| 1394 | extern int xfrm_init_state(struct xfrm_state *x); | 1433 | extern int xfrm_init_state(struct xfrm_state *x); |
| 1395 | extern int xfrm_prepare_input(struct xfrm_state *x, struct sk_buff *skb); | 1434 | extern int xfrm_prepare_input(struct xfrm_state *x, struct sk_buff *skb); |
| @@ -1468,19 +1507,19 @@ u32 xfrm_get_acqseq(void); | |||
| 1468 | extern int xfrm_alloc_spi(struct xfrm_state *x, u32 minspi, u32 maxspi); | 1507 | extern int xfrm_alloc_spi(struct xfrm_state *x, u32 minspi, u32 maxspi); |
| 1469 | struct xfrm_state *xfrm_find_acq(struct net *net, struct xfrm_mark *mark, | 1508 | struct xfrm_state *xfrm_find_acq(struct net *net, struct xfrm_mark *mark, |
| 1470 | u8 mode, u32 reqid, u8 proto, | 1509 | u8 mode, u32 reqid, u8 proto, |
| 1471 | xfrm_address_t *daddr, | 1510 | const xfrm_address_t *daddr, |
| 1472 | xfrm_address_t *saddr, int create, | 1511 | const xfrm_address_t *saddr, int create, |
| 1473 | unsigned short family); | 1512 | unsigned short family); |
| 1474 | extern int xfrm_sk_policy_insert(struct sock *sk, int dir, struct xfrm_policy *pol); | 1513 | extern int xfrm_sk_policy_insert(struct sock *sk, int dir, struct xfrm_policy *pol); |
| 1475 | 1514 | ||
| 1476 | #ifdef CONFIG_XFRM_MIGRATE | 1515 | #ifdef CONFIG_XFRM_MIGRATE |
| 1477 | extern int km_migrate(struct xfrm_selector *sel, u8 dir, u8 type, | 1516 | extern int km_migrate(const struct xfrm_selector *sel, u8 dir, u8 type, |
| 1478 | struct xfrm_migrate *m, int num_bundles, | 1517 | const struct xfrm_migrate *m, int num_bundles, |
| 1479 | struct xfrm_kmaddress *k); | 1518 | const struct xfrm_kmaddress *k); |
| 1480 | extern struct xfrm_state * xfrm_migrate_state_find(struct xfrm_migrate *m); | 1519 | extern struct xfrm_state * xfrm_migrate_state_find(struct xfrm_migrate *m); |
| 1481 | extern struct xfrm_state * xfrm_state_migrate(struct xfrm_state *x, | 1520 | extern struct xfrm_state * xfrm_state_migrate(struct xfrm_state *x, |
| 1482 | struct xfrm_migrate *m); | 1521 | struct xfrm_migrate *m); |
| 1483 | extern int xfrm_migrate(struct xfrm_selector *sel, u8 dir, u8 type, | 1522 | extern int xfrm_migrate(const struct xfrm_selector *sel, u8 dir, u8 type, |
| 1484 | struct xfrm_migrate *m, int num_bundles, | 1523 | struct xfrm_migrate *m, int num_bundles, |
| 1485 | struct xfrm_kmaddress *k); | 1524 | struct xfrm_kmaddress *k); |
| 1486 | #endif | 1525 | #endif |
| @@ -1500,10 +1539,10 @@ extern struct xfrm_algo_desc *xfrm_ealg_get_byidx(unsigned int idx); | |||
| 1500 | extern struct xfrm_algo_desc *xfrm_aalg_get_byid(int alg_id); | 1539 | extern struct xfrm_algo_desc *xfrm_aalg_get_byid(int alg_id); |
| 1501 | extern struct xfrm_algo_desc *xfrm_ealg_get_byid(int alg_id); | 1540 | extern struct xfrm_algo_desc *xfrm_ealg_get_byid(int alg_id); |
| 1502 | extern struct xfrm_algo_desc *xfrm_calg_get_byid(int alg_id); | 1541 | extern struct xfrm_algo_desc *xfrm_calg_get_byid(int alg_id); |
| 1503 | extern struct xfrm_algo_desc *xfrm_aalg_get_byname(char *name, int probe); | 1542 | extern struct xfrm_algo_desc *xfrm_aalg_get_byname(const char *name, int probe); |
| 1504 | extern struct xfrm_algo_desc *xfrm_ealg_get_byname(char *name, int probe); | 1543 | extern struct xfrm_algo_desc *xfrm_ealg_get_byname(const char *name, int probe); |
| 1505 | extern struct xfrm_algo_desc *xfrm_calg_get_byname(char *name, int probe); | 1544 | extern struct xfrm_algo_desc *xfrm_calg_get_byname(const char *name, int probe); |
| 1506 | extern struct xfrm_algo_desc *xfrm_aead_get_byname(char *name, int icv_len, | 1545 | extern struct xfrm_algo_desc *xfrm_aead_get_byname(const char *name, int icv_len, |
| 1507 | int probe); | 1546 | int probe); |
| 1508 | 1547 | ||
| 1509 | struct hash_desc; | 1548 | struct hash_desc; |
| @@ -1511,7 +1550,8 @@ struct scatterlist; | |||
| 1511 | typedef int (icv_update_fn_t)(struct hash_desc *, struct scatterlist *, | 1550 | typedef int (icv_update_fn_t)(struct hash_desc *, struct scatterlist *, |
| 1512 | unsigned int); | 1551 | unsigned int); |
| 1513 | 1552 | ||
| 1514 | static inline int xfrm_addr_cmp(xfrm_address_t *a, xfrm_address_t *b, | 1553 | static inline int xfrm_addr_cmp(const xfrm_address_t *a, |
| 1554 | const xfrm_address_t *b, | ||
| 1515 | int family) | 1555 | int family) |
| 1516 | { | 1556 | { |
| 1517 | switch (family) { | 1557 | switch (family) { |
| @@ -1544,16 +1584,21 @@ static inline int xfrm_aevent_is_on(struct net *net) | |||
| 1544 | } | 1584 | } |
| 1545 | #endif | 1585 | #endif |
| 1546 | 1586 | ||
| 1547 | static inline int xfrm_alg_len(struct xfrm_algo *alg) | 1587 | static inline int xfrm_alg_len(const struct xfrm_algo *alg) |
| 1548 | { | 1588 | { |
| 1549 | return sizeof(*alg) + ((alg->alg_key_len + 7) / 8); | 1589 | return sizeof(*alg) + ((alg->alg_key_len + 7) / 8); |
| 1550 | } | 1590 | } |
| 1551 | 1591 | ||
| 1552 | static inline int xfrm_alg_auth_len(struct xfrm_algo_auth *alg) | 1592 | static inline int xfrm_alg_auth_len(const struct xfrm_algo_auth *alg) |
| 1553 | { | 1593 | { |
| 1554 | return sizeof(*alg) + ((alg->alg_key_len + 7) / 8); | 1594 | return sizeof(*alg) + ((alg->alg_key_len + 7) / 8); |
| 1555 | } | 1595 | } |
| 1556 | 1596 | ||
| 1597 | static inline int xfrm_replay_state_esn_len(struct xfrm_replay_state_esn *replay_esn) | ||
| 1598 | { | ||
| 1599 | return sizeof(*replay_esn) + replay_esn->bmp_len * sizeof(__u32); | ||
| 1600 | } | ||
| 1601 | |||
| 1557 | #ifdef CONFIG_XFRM_MIGRATE | 1602 | #ifdef CONFIG_XFRM_MIGRATE |
| 1558 | static inline struct xfrm_algo *xfrm_algo_clone(struct xfrm_algo *orig) | 1603 | static inline struct xfrm_algo *xfrm_algo_clone(struct xfrm_algo *orig) |
| 1559 | { | 1604 | { |
| @@ -1597,7 +1642,7 @@ static inline int xfrm_mark_get(struct nlattr **attrs, struct xfrm_mark *m) | |||
| 1597 | return m->v & m->m; | 1642 | return m->v & m->m; |
| 1598 | } | 1643 | } |
| 1599 | 1644 | ||
| 1600 | static inline int xfrm_mark_put(struct sk_buff *skb, struct xfrm_mark *m) | 1645 | static inline int xfrm_mark_put(struct sk_buff *skb, const struct xfrm_mark *m) |
| 1601 | { | 1646 | { |
| 1602 | if (m->m | m->v) | 1647 | if (m->m | m->v) |
| 1603 | NLA_PUT(skb, XFRMA_MARK, sizeof(struct xfrm_mark), m); | 1648 | NLA_PUT(skb, XFRMA_MARK, sizeof(struct xfrm_mark), m); |
diff --git a/include/pcmcia/ds.h b/include/pcmcia/ds.h index 8479b66c067b..3fd5064dd43a 100644 --- a/include/pcmcia/ds.h +++ b/include/pcmcia/ds.h | |||
| @@ -261,6 +261,7 @@ void pcmcia_disable_device(struct pcmcia_device *p_dev); | |||
| 261 | #define CONF_ENABLE_ESR 0x0008 | 261 | #define CONF_ENABLE_ESR 0x0008 |
| 262 | #define CONF_ENABLE_IOCARD 0x0010 /* auto-enabled if IO resources or IRQ | 262 | #define CONF_ENABLE_IOCARD 0x0010 /* auto-enabled if IO resources or IRQ |
| 263 | * (CONF_ENABLE_IRQ) in use */ | 263 | * (CONF_ENABLE_IRQ) in use */ |
| 264 | #define CONF_ENABLE_ZVCARD 0x0020 | ||
| 264 | 265 | ||
| 265 | /* flags used by pcmcia_loop_config() autoconfiguration */ | 266 | /* flags used by pcmcia_loop_config() autoconfiguration */ |
| 266 | #define CONF_AUTO_CHECK_VCC 0x0100 /* check for matching Vcc? */ | 267 | #define CONF_AUTO_CHECK_VCC 0x0100 /* check for matching Vcc? */ |
diff --git a/include/scsi/sas_ata.h b/include/scsi/sas_ata.h index c583193ae929..9c159f74c6d0 100644 --- a/include/scsi/sas_ata.h +++ b/include/scsi/sas_ata.h | |||
| @@ -39,6 +39,11 @@ int sas_ata_init_host_and_port(struct domain_device *found_dev, | |||
| 39 | struct scsi_target *starget); | 39 | struct scsi_target *starget); |
| 40 | 40 | ||
| 41 | void sas_ata_task_abort(struct sas_task *task); | 41 | void sas_ata_task_abort(struct sas_task *task); |
| 42 | void sas_ata_strategy_handler(struct Scsi_Host *shost); | ||
| 43 | int sas_ata_timed_out(struct scsi_cmnd *cmd, struct sas_task *task, | ||
| 44 | enum blk_eh_timer_return *rtn); | ||
| 45 | int sas_ata_eh(struct Scsi_Host *shost, struct list_head *work_q, | ||
| 46 | struct list_head *done_q); | ||
| 42 | 47 | ||
| 43 | #else | 48 | #else |
| 44 | 49 | ||
| @@ -55,6 +60,23 @@ static inline int sas_ata_init_host_and_port(struct domain_device *found_dev, | |||
| 55 | static inline void sas_ata_task_abort(struct sas_task *task) | 60 | static inline void sas_ata_task_abort(struct sas_task *task) |
| 56 | { | 61 | { |
| 57 | } | 62 | } |
| 63 | |||
| 64 | static inline void sas_ata_strategy_handler(struct Scsi_Host *shost) | ||
| 65 | { | ||
| 66 | } | ||
| 67 | |||
| 68 | static inline int sas_ata_timed_out(struct scsi_cmnd *cmd, | ||
| 69 | struct sas_task *task, | ||
| 70 | enum blk_eh_timer_return *rtn) | ||
| 71 | { | ||
| 72 | return 0; | ||
| 73 | } | ||
| 74 | static inline int sas_ata_eh(struct Scsi_Host *shost, struct list_head *work_q, | ||
| 75 | struct list_head *done_q) | ||
| 76 | { | ||
| 77 | return 0; | ||
| 78 | } | ||
| 79 | |||
| 58 | #endif | 80 | #endif |
| 59 | 81 | ||
| 60 | #endif /* _SAS_ATA_H_ */ | 82 | #endif /* _SAS_ATA_H_ */ |
diff --git a/include/sound/wm8903.h b/include/sound/wm8903.h index b4a0db2307ef..1eeebd534f7e 100644 --- a/include/sound/wm8903.h +++ b/include/sound/wm8903.h | |||
| @@ -17,13 +17,9 @@ | |||
| 17 | /* | 17 | /* |
| 18 | * R6 (0x06) - Mic Bias Control 0 | 18 | * R6 (0x06) - Mic Bias Control 0 |
| 19 | */ | 19 | */ |
| 20 | #define WM8903_MICDET_HYST_ENA 0x0080 /* MICDET_HYST_ENA */ | 20 | #define WM8903_MICDET_THR_MASK 0x0030 /* MICDET_THR - [5:4] */ |
| 21 | #define WM8903_MICDET_HYST_ENA_MASK 0x0080 /* MICDET_HYST_ENA */ | 21 | #define WM8903_MICDET_THR_SHIFT 4 /* MICDET_THR - [5:4] */ |
| 22 | #define WM8903_MICDET_HYST_ENA_SHIFT 7 /* MICDET_HYST_ENA */ | 22 | #define WM8903_MICDET_THR_WIDTH 2 /* MICDET_THR - [5:4] */ |
| 23 | #define WM8903_MICDET_HYST_ENA_WIDTH 1 /* MICDET_HYST_ENA */ | ||
| 24 | #define WM8903_MICDET_THR_MASK 0x0070 /* MICDET_THR - [6:4] */ | ||
| 25 | #define WM8903_MICDET_THR_SHIFT 4 /* MICDET_THR - [6:4] */ | ||
| 26 | #define WM8903_MICDET_THR_WIDTH 3 /* MICDET_THR - [6:4] */ | ||
| 27 | #define WM8903_MICSHORT_THR_MASK 0x000C /* MICSHORT_THR - [3:2] */ | 23 | #define WM8903_MICSHORT_THR_MASK 0x000C /* MICSHORT_THR - [3:2] */ |
| 28 | #define WM8903_MICSHORT_THR_SHIFT 2 /* MICSHORT_THR - [3:2] */ | 24 | #define WM8903_MICSHORT_THR_SHIFT 2 /* MICSHORT_THR - [3:2] */ |
| 29 | #define WM8903_MICSHORT_THR_WIDTH 2 /* MICSHORT_THR - [3:2] */ | 25 | #define WM8903_MICSHORT_THR_WIDTH 2 /* MICSHORT_THR - [3:2] */ |
diff --git a/include/target/target_core_base.h b/include/target/target_core_base.h index 07fdfb6b9a9a..0828b6c8610a 100644 --- a/include/target/target_core_base.h +++ b/include/target/target_core_base.h | |||
| @@ -8,7 +8,6 @@ | |||
| 8 | #include <scsi/scsi_cmnd.h> | 8 | #include <scsi/scsi_cmnd.h> |
| 9 | #include <net/sock.h> | 9 | #include <net/sock.h> |
| 10 | #include <net/tcp.h> | 10 | #include <net/tcp.h> |
| 11 | #include "target_core_mib.h" | ||
| 12 | 11 | ||
| 13 | #define TARGET_CORE_MOD_VERSION "v4.0.0-rc6" | 12 | #define TARGET_CORE_MOD_VERSION "v4.0.0-rc6" |
| 14 | #define SHUTDOWN_SIGS (sigmask(SIGKILL)|sigmask(SIGINT)|sigmask(SIGABRT)) | 13 | #define SHUTDOWN_SIGS (sigmask(SIGKILL)|sigmask(SIGINT)|sigmask(SIGABRT)) |
| @@ -195,6 +194,21 @@ typedef enum { | |||
| 195 | SAM_TASK_ATTR_EMULATED | 194 | SAM_TASK_ATTR_EMULATED |
| 196 | } t10_task_attr_index_t; | 195 | } t10_task_attr_index_t; |
| 197 | 196 | ||
| 197 | /* | ||
| 198 | * Used for target SCSI statistics | ||
| 199 | */ | ||
| 200 | typedef enum { | ||
| 201 | SCSI_INST_INDEX, | ||
| 202 | SCSI_DEVICE_INDEX, | ||
| 203 | SCSI_AUTH_INTR_INDEX, | ||
| 204 | SCSI_INDEX_TYPE_MAX | ||
| 205 | } scsi_index_t; | ||
| 206 | |||
| 207 | struct scsi_index_table { | ||
| 208 | spinlock_t lock; | ||
| 209 | u32 scsi_mib_index[SCSI_INDEX_TYPE_MAX]; | ||
| 210 | } ____cacheline_aligned; | ||
| 211 | |||
| 198 | struct se_cmd; | 212 | struct se_cmd; |
| 199 | 213 | ||
| 200 | struct t10_alua { | 214 | struct t10_alua { |
| @@ -578,8 +592,6 @@ struct se_node_acl { | |||
| 578 | spinlock_t stats_lock; | 592 | spinlock_t stats_lock; |
| 579 | /* Used for PR SPEC_I_PT=1 and REGISTER_AND_MOVE */ | 593 | /* Used for PR SPEC_I_PT=1 and REGISTER_AND_MOVE */ |
| 580 | atomic_t acl_pr_ref_count; | 594 | atomic_t acl_pr_ref_count; |
| 581 | /* Used for MIB access */ | ||
| 582 | atomic_t mib_ref_count; | ||
| 583 | struct se_dev_entry *device_list; | 595 | struct se_dev_entry *device_list; |
| 584 | struct se_session *nacl_sess; | 596 | struct se_session *nacl_sess; |
| 585 | struct se_portal_group *se_tpg; | 597 | struct se_portal_group *se_tpg; |
| @@ -595,8 +607,6 @@ struct se_node_acl { | |||
| 595 | } ____cacheline_aligned; | 607 | } ____cacheline_aligned; |
| 596 | 608 | ||
| 597 | struct se_session { | 609 | struct se_session { |
| 598 | /* Used for MIB access */ | ||
| 599 | atomic_t mib_ref_count; | ||
| 600 | u64 sess_bin_isid; | 610 | u64 sess_bin_isid; |
| 601 | struct se_node_acl *se_node_acl; | 611 | struct se_node_acl *se_node_acl; |
| 602 | struct se_portal_group *se_tpg; | 612 | struct se_portal_group *se_tpg; |
| @@ -806,7 +816,6 @@ struct se_hba { | |||
| 806 | /* Virtual iSCSI devices attached. */ | 816 | /* Virtual iSCSI devices attached. */ |
| 807 | u32 dev_count; | 817 | u32 dev_count; |
| 808 | u32 hba_index; | 818 | u32 hba_index; |
| 809 | atomic_t dev_mib_access_count; | ||
| 810 | atomic_t load_balance_queue; | 819 | atomic_t load_balance_queue; |
| 811 | atomic_t left_queue_depth; | 820 | atomic_t left_queue_depth; |
| 812 | /* Maximum queue depth the HBA can handle. */ | 821 | /* Maximum queue depth the HBA can handle. */ |
| @@ -845,6 +854,12 @@ struct se_lun { | |||
| 845 | 854 | ||
| 846 | #define SE_LUN(c) ((struct se_lun *)(c)->se_lun) | 855 | #define SE_LUN(c) ((struct se_lun *)(c)->se_lun) |
| 847 | 856 | ||
| 857 | struct scsi_port_stats { | ||
| 858 | u64 cmd_pdus; | ||
| 859 | u64 tx_data_octets; | ||
| 860 | u64 rx_data_octets; | ||
| 861 | } ____cacheline_aligned; | ||
| 862 | |||
| 848 | struct se_port { | 863 | struct se_port { |
| 849 | /* RELATIVE TARGET PORT IDENTIFER */ | 864 | /* RELATIVE TARGET PORT IDENTIFER */ |
| 850 | u16 sep_rtpi; | 865 | u16 sep_rtpi; |
| @@ -867,6 +882,7 @@ struct se_port { | |||
| 867 | } ____cacheline_aligned; | 882 | } ____cacheline_aligned; |
| 868 | 883 | ||
| 869 | struct se_tpg_np { | 884 | struct se_tpg_np { |
| 885 | struct se_portal_group *tpg_np_parent; | ||
| 870 | struct config_group tpg_np_group; | 886 | struct config_group tpg_np_group; |
| 871 | } ____cacheline_aligned; | 887 | } ____cacheline_aligned; |
| 872 | 888 | ||
diff --git a/include/target/target_core_transport.h b/include/target/target_core_transport.h index 66f44e56eb80..2e8ec51f0615 100644 --- a/include/target/target_core_transport.h +++ b/include/target/target_core_transport.h | |||
| @@ -111,6 +111,8 @@ struct se_subsystem_api; | |||
| 111 | 111 | ||
| 112 | extern int init_se_global(void); | 112 | extern int init_se_global(void); |
| 113 | extern void release_se_global(void); | 113 | extern void release_se_global(void); |
| 114 | extern void init_scsi_index_table(void); | ||
| 115 | extern u32 scsi_get_new_index(scsi_index_t); | ||
| 114 | extern void transport_init_queue_obj(struct se_queue_obj *); | 116 | extern void transport_init_queue_obj(struct se_queue_obj *); |
| 115 | extern int transport_subsystem_check_init(void); | 117 | extern int transport_subsystem_check_init(void); |
| 116 | extern int transport_subsystem_register(struct se_subsystem_api *); | 118 | extern int transport_subsystem_register(struct se_subsystem_api *); |
| @@ -133,6 +135,8 @@ extern void transport_complete_task(struct se_task *, int); | |||
| 133 | extern void transport_add_task_to_execute_queue(struct se_task *, | 135 | extern void transport_add_task_to_execute_queue(struct se_task *, |
| 134 | struct se_task *, | 136 | struct se_task *, |
| 135 | struct se_device *); | 137 | struct se_device *); |
| 138 | extern void transport_remove_task_from_execute_queue(struct se_task *, | ||
| 139 | struct se_device *); | ||
| 136 | unsigned char *transport_dump_cmd_direction(struct se_cmd *); | 140 | unsigned char *transport_dump_cmd_direction(struct se_cmd *); |
| 137 | extern void transport_dump_dev_state(struct se_device *, char *, int *); | 141 | extern void transport_dump_dev_state(struct se_device *, char *, int *); |
| 138 | extern void transport_dump_dev_info(struct se_device *, struct se_lun *, | 142 | extern void transport_dump_dev_info(struct se_device *, struct se_lun *, |
diff --git a/include/trace/events/bkl.h b/include/trace/events/bkl.h deleted file mode 100644 index 1af72dc24278..000000000000 --- a/include/trace/events/bkl.h +++ /dev/null | |||
| @@ -1,61 +0,0 @@ | |||
| 1 | #undef TRACE_SYSTEM | ||
| 2 | #define TRACE_SYSTEM bkl | ||
| 3 | |||
| 4 | #if !defined(_TRACE_BKL_H) || defined(TRACE_HEADER_MULTI_READ) | ||
| 5 | #define _TRACE_BKL_H | ||
| 6 | |||
| 7 | #include <linux/tracepoint.h> | ||
| 8 | |||
| 9 | TRACE_EVENT(lock_kernel, | ||
| 10 | |||
| 11 | TP_PROTO(const char *func, const char *file, int line), | ||
| 12 | |||
| 13 | TP_ARGS(func, file, line), | ||
| 14 | |||
| 15 | TP_STRUCT__entry( | ||
| 16 | __field( int, depth ) | ||
| 17 | __field_ext( const char *, func, FILTER_PTR_STRING ) | ||
| 18 | __field_ext( const char *, file, FILTER_PTR_STRING ) | ||
| 19 | __field( int, line ) | ||
| 20 | ), | ||
| 21 | |||
| 22 | TP_fast_assign( | ||
| 23 | /* We want to record the lock_depth after lock is acquired */ | ||
| 24 | __entry->depth = current->lock_depth + 1; | ||
| 25 | __entry->func = func; | ||
| 26 | __entry->file = file; | ||
| 27 | __entry->line = line; | ||
| 28 | ), | ||
| 29 | |||
| 30 | TP_printk("depth=%d file:line=%s:%d func=%s()", __entry->depth, | ||
| 31 | __entry->file, __entry->line, __entry->func) | ||
| 32 | ); | ||
| 33 | |||
| 34 | TRACE_EVENT(unlock_kernel, | ||
| 35 | |||
| 36 | TP_PROTO(const char *func, const char *file, int line), | ||
| 37 | |||
| 38 | TP_ARGS(func, file, line), | ||
| 39 | |||
| 40 | TP_STRUCT__entry( | ||
| 41 | __field(int, depth ) | ||
| 42 | __field(const char *, func ) | ||
| 43 | __field(const char *, file ) | ||
| 44 | __field(int, line ) | ||
| 45 | ), | ||
| 46 | |||
| 47 | TP_fast_assign( | ||
| 48 | __entry->depth = current->lock_depth; | ||
| 49 | __entry->func = func; | ||
| 50 | __entry->file = file; | ||
| 51 | __entry->line = line; | ||
| 52 | ), | ||
| 53 | |||
| 54 | TP_printk("depth=%d file:line=%s:%d func=%s()", __entry->depth, | ||
| 55 | __entry->file, __entry->line, __entry->func) | ||
| 56 | ); | ||
| 57 | |||
| 58 | #endif /* _TRACE_BKL_H */ | ||
| 59 | |||
| 60 | /* This part must be outside protection */ | ||
| 61 | #include <trace/define_trace.h> | ||
diff --git a/include/trace/events/block.h b/include/trace/events/block.h index aba421d68f6f..78f18adb49c8 100644 --- a/include/trace/events/block.h +++ b/include/trace/events/block.h | |||
| @@ -31,7 +31,7 @@ DECLARE_EVENT_CLASS(block_rq_with_error, | |||
| 31 | 0 : blk_rq_sectors(rq); | 31 | 0 : blk_rq_sectors(rq); |
| 32 | __entry->errors = rq->errors; | 32 | __entry->errors = rq->errors; |
| 33 | 33 | ||
| 34 | blk_fill_rwbs_rq(__entry->rwbs, rq); | 34 | blk_fill_rwbs(__entry->rwbs, rq->cmd_flags, blk_rq_bytes(rq)); |
| 35 | blk_dump_cmd(__get_str(cmd), rq); | 35 | blk_dump_cmd(__get_str(cmd), rq); |
| 36 | ), | 36 | ), |
| 37 | 37 | ||
| @@ -118,7 +118,7 @@ DECLARE_EVENT_CLASS(block_rq, | |||
| 118 | __entry->bytes = (rq->cmd_type == REQ_TYPE_BLOCK_PC) ? | 118 | __entry->bytes = (rq->cmd_type == REQ_TYPE_BLOCK_PC) ? |
| 119 | blk_rq_bytes(rq) : 0; | 119 | blk_rq_bytes(rq) : 0; |
| 120 | 120 | ||
| 121 | blk_fill_rwbs_rq(__entry->rwbs, rq); | 121 | blk_fill_rwbs(__entry->rwbs, rq->cmd_flags, blk_rq_bytes(rq)); |
| 122 | blk_dump_cmd(__get_str(cmd), rq); | 122 | blk_dump_cmd(__get_str(cmd), rq); |
| 123 | memcpy(__entry->comm, current->comm, TASK_COMM_LEN); | 123 | memcpy(__entry->comm, current->comm, TASK_COMM_LEN); |
| 124 | ), | 124 | ), |
| @@ -563,7 +563,7 @@ TRACE_EVENT(block_rq_remap, | |||
| 563 | __entry->nr_sector = blk_rq_sectors(rq); | 563 | __entry->nr_sector = blk_rq_sectors(rq); |
| 564 | __entry->old_dev = dev; | 564 | __entry->old_dev = dev; |
| 565 | __entry->old_sector = from; | 565 | __entry->old_sector = from; |
| 566 | blk_fill_rwbs_rq(__entry->rwbs, rq); | 566 | blk_fill_rwbs(__entry->rwbs, rq->cmd_flags, blk_rq_bytes(rq)); |
| 567 | ), | 567 | ), |
| 568 | 568 | ||
| 569 | TP_printk("%d,%d %s %llu + %u <- (%d,%d) %llu", | 569 | TP_printk("%d,%d %s %llu + %u <- (%d,%d) %llu", |
diff --git a/include/trace/events/mce.h b/include/trace/events/mce.h index 7eee77895cb3..4cbbcef6baa8 100644 --- a/include/trace/events/mce.h +++ b/include/trace/events/mce.h | |||
| @@ -17,36 +17,36 @@ TRACE_EVENT(mce_record, | |||
| 17 | TP_STRUCT__entry( | 17 | TP_STRUCT__entry( |
| 18 | __field( u64, mcgcap ) | 18 | __field( u64, mcgcap ) |
| 19 | __field( u64, mcgstatus ) | 19 | __field( u64, mcgstatus ) |
| 20 | __field( u8, bank ) | ||
| 21 | __field( u64, status ) | 20 | __field( u64, status ) |
| 22 | __field( u64, addr ) | 21 | __field( u64, addr ) |
| 23 | __field( u64, misc ) | 22 | __field( u64, misc ) |
| 24 | __field( u64, ip ) | 23 | __field( u64, ip ) |
| 25 | __field( u8, cs ) | ||
| 26 | __field( u64, tsc ) | 24 | __field( u64, tsc ) |
| 27 | __field( u64, walltime ) | 25 | __field( u64, walltime ) |
| 28 | __field( u32, cpu ) | 26 | __field( u32, cpu ) |
| 29 | __field( u32, cpuid ) | 27 | __field( u32, cpuid ) |
| 30 | __field( u32, apicid ) | 28 | __field( u32, apicid ) |
| 31 | __field( u32, socketid ) | 29 | __field( u32, socketid ) |
| 30 | __field( u8, cs ) | ||
| 31 | __field( u8, bank ) | ||
| 32 | __field( u8, cpuvendor ) | 32 | __field( u8, cpuvendor ) |
| 33 | ), | 33 | ), |
| 34 | 34 | ||
| 35 | TP_fast_assign( | 35 | TP_fast_assign( |
| 36 | __entry->mcgcap = m->mcgcap; | 36 | __entry->mcgcap = m->mcgcap; |
| 37 | __entry->mcgstatus = m->mcgstatus; | 37 | __entry->mcgstatus = m->mcgstatus; |
| 38 | __entry->bank = m->bank; | ||
| 39 | __entry->status = m->status; | 38 | __entry->status = m->status; |
| 40 | __entry->addr = m->addr; | 39 | __entry->addr = m->addr; |
| 41 | __entry->misc = m->misc; | 40 | __entry->misc = m->misc; |
| 42 | __entry->ip = m->ip; | 41 | __entry->ip = m->ip; |
| 43 | __entry->cs = m->cs; | ||
| 44 | __entry->tsc = m->tsc; | 42 | __entry->tsc = m->tsc; |
| 45 | __entry->walltime = m->time; | 43 | __entry->walltime = m->time; |
| 46 | __entry->cpu = m->extcpu; | 44 | __entry->cpu = m->extcpu; |
| 47 | __entry->cpuid = m->cpuid; | 45 | __entry->cpuid = m->cpuid; |
| 48 | __entry->apicid = m->apicid; | 46 | __entry->apicid = m->apicid; |
| 49 | __entry->socketid = m->socketid; | 47 | __entry->socketid = m->socketid; |
| 48 | __entry->cs = m->cs; | ||
| 49 | __entry->bank = m->bank; | ||
| 50 | __entry->cpuvendor = m->cpuvendor; | 50 | __entry->cpuvendor = m->cpuvendor; |
| 51 | ), | 51 | ), |
| 52 | 52 | ||
diff --git a/include/trace/events/module.h b/include/trace/events/module.h index c6bae36547e5..21a546d27c0c 100644 --- a/include/trace/events/module.h +++ b/include/trace/events/module.h | |||
| @@ -108,14 +108,14 @@ TRACE_EVENT(module_request, | |||
| 108 | TP_ARGS(name, wait, ip), | 108 | TP_ARGS(name, wait, ip), |
| 109 | 109 | ||
| 110 | TP_STRUCT__entry( | 110 | TP_STRUCT__entry( |
| 111 | __field( bool, wait ) | ||
| 112 | __field( unsigned long, ip ) | 111 | __field( unsigned long, ip ) |
| 112 | __field( bool, wait ) | ||
| 113 | __string( name, name ) | 113 | __string( name, name ) |
| 114 | ), | 114 | ), |
| 115 | 115 | ||
| 116 | TP_fast_assign( | 116 | TP_fast_assign( |
| 117 | __entry->wait = wait; | ||
| 118 | __entry->ip = ip; | 117 | __entry->ip = ip; |
| 118 | __entry->wait = wait; | ||
| 119 | __assign_str(name, name); | 119 | __assign_str(name, name); |
| 120 | ), | 120 | ), |
| 121 | 121 | ||
| @@ -129,4 +129,3 @@ TRACE_EVENT(module_request, | |||
| 129 | 129 | ||
| 130 | /* This part must be outside protection */ | 130 | /* This part must be outside protection */ |
| 131 | #include <trace/define_trace.h> | 131 | #include <trace/define_trace.h> |
| 132 | |||
diff --git a/include/trace/events/skb.h b/include/trace/events/skb.h index f10293c41b1e..0c68ae22da22 100644 --- a/include/trace/events/skb.h +++ b/include/trace/events/skb.h | |||
| @@ -19,14 +19,14 @@ TRACE_EVENT(kfree_skb, | |||
| 19 | 19 | ||
| 20 | TP_STRUCT__entry( | 20 | TP_STRUCT__entry( |
| 21 | __field( void *, skbaddr ) | 21 | __field( void *, skbaddr ) |
| 22 | __field( unsigned short, protocol ) | ||
| 23 | __field( void *, location ) | 22 | __field( void *, location ) |
| 23 | __field( unsigned short, protocol ) | ||
| 24 | ), | 24 | ), |
| 25 | 25 | ||
| 26 | TP_fast_assign( | 26 | TP_fast_assign( |
| 27 | __entry->skbaddr = skb; | 27 | __entry->skbaddr = skb; |
| 28 | __entry->protocol = ntohs(skb->protocol); | ||
| 29 | __entry->location = location; | 28 | __entry->location = location; |
| 29 | __entry->protocol = ntohs(skb->protocol); | ||
| 30 | ), | 30 | ), |
| 31 | 31 | ||
| 32 | TP_printk("skbaddr=%p protocol=%u location=%p", | 32 | TP_printk("skbaddr=%p protocol=%u location=%p", |
diff --git a/include/xen/events.h b/include/xen/events.h index 00f53ddcc062..d3b9010ee96a 100644 --- a/include/xen/events.h +++ b/include/xen/events.h | |||
| @@ -23,6 +23,12 @@ int bind_ipi_to_irqhandler(enum ipi_vector ipi, | |||
| 23 | unsigned long irqflags, | 23 | unsigned long irqflags, |
| 24 | const char *devname, | 24 | const char *devname, |
| 25 | void *dev_id); | 25 | void *dev_id); |
| 26 | int bind_interdomain_evtchn_to_irqhandler(unsigned int remote_domain, | ||
| 27 | unsigned int remote_port, | ||
| 28 | irq_handler_t handler, | ||
| 29 | unsigned long irqflags, | ||
| 30 | const char *devname, | ||
| 31 | void *dev_id); | ||
| 26 | 32 | ||
| 27 | /* | 33 | /* |
| 28 | * Common unbind function for all event sources. Takes IRQ to unbind from. | 34 | * Common unbind function for all event sources. Takes IRQ to unbind from. |
| @@ -75,11 +81,9 @@ int xen_allocate_pirq(unsigned gsi, int shareable, char *name); | |||
| 75 | int xen_map_pirq_gsi(unsigned pirq, unsigned gsi, int shareable, char *name); | 81 | int xen_map_pirq_gsi(unsigned pirq, unsigned gsi, int shareable, char *name); |
| 76 | 82 | ||
| 77 | #ifdef CONFIG_PCI_MSI | 83 | #ifdef CONFIG_PCI_MSI |
| 78 | /* Allocate an irq and a pirq to be used with MSIs. */ | 84 | int xen_allocate_pirq_msi(struct pci_dev *dev, struct msi_desc *msidesc); |
| 79 | #define XEN_ALLOC_PIRQ (1 << 0) | 85 | int xen_bind_pirq_msi_to_irq(struct pci_dev *dev, struct msi_desc *msidesc, |
| 80 | #define XEN_ALLOC_IRQ (1 << 1) | 86 | int pirq, int vector, const char *name); |
| 81 | void xen_allocate_pirq_msi(char *name, int *irq, int *pirq, int alloc_mask); | ||
| 82 | int xen_create_msi_irq(struct pci_dev *dev, struct msi_desc *msidesc, int type); | ||
| 83 | #endif | 87 | #endif |
| 84 | 88 | ||
| 85 | /* De-allocates the above mentioned physical interrupt. */ | 89 | /* De-allocates the above mentioned physical interrupt. */ |
diff --git a/include/xen/interface/io/blkif.h b/include/xen/interface/io/blkif.h index c2d1fa4dc1ee..61e523af3c46 100644 --- a/include/xen/interface/io/blkif.h +++ b/include/xen/interface/io/blkif.h | |||
| @@ -51,11 +51,7 @@ typedef uint64_t blkif_sector_t; | |||
| 51 | */ | 51 | */ |
| 52 | #define BLKIF_MAX_SEGMENTS_PER_REQUEST 11 | 52 | #define BLKIF_MAX_SEGMENTS_PER_REQUEST 11 |
| 53 | 53 | ||
| 54 | struct blkif_request { | 54 | struct blkif_request_rw { |
| 55 | uint8_t operation; /* BLKIF_OP_??? */ | ||
| 56 | uint8_t nr_segments; /* number of segments */ | ||
| 57 | blkif_vdev_t handle; /* only for read/write requests */ | ||
| 58 | uint64_t id; /* private guest value, echoed in resp */ | ||
| 59 | blkif_sector_t sector_number;/* start sector idx on disk (r/w only) */ | 55 | blkif_sector_t sector_number;/* start sector idx on disk (r/w only) */ |
| 60 | struct blkif_request_segment { | 56 | struct blkif_request_segment { |
| 61 | grant_ref_t gref; /* reference to I/O buffer frame */ | 57 | grant_ref_t gref; /* reference to I/O buffer frame */ |
| @@ -65,6 +61,16 @@ struct blkif_request { | |||
| 65 | } seg[BLKIF_MAX_SEGMENTS_PER_REQUEST]; | 61 | } seg[BLKIF_MAX_SEGMENTS_PER_REQUEST]; |
| 66 | }; | 62 | }; |
| 67 | 63 | ||
| 64 | struct blkif_request { | ||
| 65 | uint8_t operation; /* BLKIF_OP_??? */ | ||
| 66 | uint8_t nr_segments; /* number of segments */ | ||
| 67 | blkif_vdev_t handle; /* only for read/write requests */ | ||
| 68 | uint64_t id; /* private guest value, echoed in resp */ | ||
| 69 | union { | ||
| 70 | struct blkif_request_rw rw; | ||
| 71 | } u; | ||
| 72 | }; | ||
| 73 | |||
| 68 | struct blkif_response { | 74 | struct blkif_response { |
| 69 | uint64_t id; /* copied from request */ | 75 | uint64_t id; /* copied from request */ |
| 70 | uint8_t operation; /* copied from request */ | 76 | uint8_t operation; /* copied from request */ |
| @@ -91,4 +97,25 @@ DEFINE_RING_TYPES(blkif, struct blkif_request, struct blkif_response); | |||
| 91 | #define VDISK_REMOVABLE 0x2 | 97 | #define VDISK_REMOVABLE 0x2 |
| 92 | #define VDISK_READONLY 0x4 | 98 | #define VDISK_READONLY 0x4 |
| 93 | 99 | ||
| 100 | /* Xen-defined major numbers for virtual disks, they look strangely | ||
| 101 | * familiar */ | ||
| 102 | #define XEN_IDE0_MAJOR 3 | ||
| 103 | #define XEN_IDE1_MAJOR 22 | ||
| 104 | #define XEN_SCSI_DISK0_MAJOR 8 | ||
| 105 | #define XEN_SCSI_DISK1_MAJOR 65 | ||
| 106 | #define XEN_SCSI_DISK2_MAJOR 66 | ||
| 107 | #define XEN_SCSI_DISK3_MAJOR 67 | ||
| 108 | #define XEN_SCSI_DISK4_MAJOR 68 | ||
| 109 | #define XEN_SCSI_DISK5_MAJOR 69 | ||
| 110 | #define XEN_SCSI_DISK6_MAJOR 70 | ||
| 111 | #define XEN_SCSI_DISK7_MAJOR 71 | ||
| 112 | #define XEN_SCSI_DISK8_MAJOR 128 | ||
| 113 | #define XEN_SCSI_DISK9_MAJOR 129 | ||
| 114 | #define XEN_SCSI_DISK10_MAJOR 130 | ||
| 115 | #define XEN_SCSI_DISK11_MAJOR 131 | ||
| 116 | #define XEN_SCSI_DISK12_MAJOR 132 | ||
| 117 | #define XEN_SCSI_DISK13_MAJOR 133 | ||
| 118 | #define XEN_SCSI_DISK14_MAJOR 134 | ||
| 119 | #define XEN_SCSI_DISK15_MAJOR 135 | ||
| 120 | |||
| 94 | #endif /* __XEN_PUBLIC_IO_BLKIF_H__ */ | 121 | #endif /* __XEN_PUBLIC_IO_BLKIF_H__ */ |
diff --git a/include/xen/interface/io/netif.h b/include/xen/interface/io/netif.h index 518481c95f18..cb94668f6e9f 100644 --- a/include/xen/interface/io/netif.h +++ b/include/xen/interface/io/netif.h | |||
| @@ -22,50 +22,50 @@ | |||
| 22 | 22 | ||
| 23 | /* | 23 | /* |
| 24 | * This is the 'wire' format for packets: | 24 | * This is the 'wire' format for packets: |
| 25 | * Request 1: netif_tx_request -- NETTXF_* (any flags) | 25 | * Request 1: xen_netif_tx_request -- XEN_NETTXF_* (any flags) |
| 26 | * [Request 2: netif_tx_extra] (only if request 1 has NETTXF_extra_info) | 26 | * [Request 2: xen_netif_extra_info] (only if request 1 has XEN_NETTXF_extra_info) |
| 27 | * [Request 3: netif_tx_extra] (only if request 2 has XEN_NETIF_EXTRA_MORE) | 27 | * [Request 3: xen_netif_extra_info] (only if request 2 has XEN_NETIF_EXTRA_MORE) |
| 28 | * Request 4: netif_tx_request -- NETTXF_more_data | 28 | * Request 4: xen_netif_tx_request -- XEN_NETTXF_more_data |
| 29 | * Request 5: netif_tx_request -- NETTXF_more_data | 29 | * Request 5: xen_netif_tx_request -- XEN_NETTXF_more_data |
| 30 | * ... | 30 | * ... |
| 31 | * Request N: netif_tx_request -- 0 | 31 | * Request N: xen_netif_tx_request -- 0 |
| 32 | */ | 32 | */ |
| 33 | 33 | ||
| 34 | /* Protocol checksum field is blank in the packet (hardware offload)? */ | 34 | /* Protocol checksum field is blank in the packet (hardware offload)? */ |
| 35 | #define _NETTXF_csum_blank (0) | 35 | #define _XEN_NETTXF_csum_blank (0) |
| 36 | #define NETTXF_csum_blank (1U<<_NETTXF_csum_blank) | 36 | #define XEN_NETTXF_csum_blank (1U<<_XEN_NETTXF_csum_blank) |
| 37 | 37 | ||
| 38 | /* Packet data has been validated against protocol checksum. */ | 38 | /* Packet data has been validated against protocol checksum. */ |
| 39 | #define _NETTXF_data_validated (1) | 39 | #define _XEN_NETTXF_data_validated (1) |
| 40 | #define NETTXF_data_validated (1U<<_NETTXF_data_validated) | 40 | #define XEN_NETTXF_data_validated (1U<<_XEN_NETTXF_data_validated) |
| 41 | 41 | ||
| 42 | /* Packet continues in the next request descriptor. */ | 42 | /* Packet continues in the next request descriptor. */ |
| 43 | #define _NETTXF_more_data (2) | 43 | #define _XEN_NETTXF_more_data (2) |
| 44 | #define NETTXF_more_data (1U<<_NETTXF_more_data) | 44 | #define XEN_NETTXF_more_data (1U<<_XEN_NETTXF_more_data) |
| 45 | 45 | ||
| 46 | /* Packet to be followed by extra descriptor(s). */ | 46 | /* Packet to be followed by extra descriptor(s). */ |
| 47 | #define _NETTXF_extra_info (3) | 47 | #define _XEN_NETTXF_extra_info (3) |
| 48 | #define NETTXF_extra_info (1U<<_NETTXF_extra_info) | 48 | #define XEN_NETTXF_extra_info (1U<<_XEN_NETTXF_extra_info) |
| 49 | 49 | ||
| 50 | struct xen_netif_tx_request { | 50 | struct xen_netif_tx_request { |
| 51 | grant_ref_t gref; /* Reference to buffer page */ | 51 | grant_ref_t gref; /* Reference to buffer page */ |
| 52 | uint16_t offset; /* Offset within buffer page */ | 52 | uint16_t offset; /* Offset within buffer page */ |
| 53 | uint16_t flags; /* NETTXF_* */ | 53 | uint16_t flags; /* XEN_NETTXF_* */ |
| 54 | uint16_t id; /* Echoed in response message. */ | 54 | uint16_t id; /* Echoed in response message. */ |
| 55 | uint16_t size; /* Packet size in bytes. */ | 55 | uint16_t size; /* Packet size in bytes. */ |
| 56 | }; | 56 | }; |
| 57 | 57 | ||
| 58 | /* Types of netif_extra_info descriptors. */ | 58 | /* Types of xen_netif_extra_info descriptors. */ |
| 59 | #define XEN_NETIF_EXTRA_TYPE_NONE (0) /* Never used - invalid */ | 59 | #define XEN_NETIF_EXTRA_TYPE_NONE (0) /* Never used - invalid */ |
| 60 | #define XEN_NETIF_EXTRA_TYPE_GSO (1) /* u.gso */ | 60 | #define XEN_NETIF_EXTRA_TYPE_GSO (1) /* u.gso */ |
| 61 | #define XEN_NETIF_EXTRA_TYPE_MAX (2) | 61 | #define XEN_NETIF_EXTRA_TYPE_MAX (2) |
| 62 | 62 | ||
| 63 | /* netif_extra_info flags. */ | 63 | /* xen_netif_extra_info flags. */ |
| 64 | #define _XEN_NETIF_EXTRA_FLAG_MORE (0) | 64 | #define _XEN_NETIF_EXTRA_FLAG_MORE (0) |
| 65 | #define XEN_NETIF_EXTRA_FLAG_MORE (1U<<_XEN_NETIF_EXTRA_FLAG_MORE) | 65 | #define XEN_NETIF_EXTRA_FLAG_MORE (1U<<_XEN_NETIF_EXTRA_FLAG_MORE) |
| 66 | 66 | ||
| 67 | /* GSO types - only TCPv4 currently supported. */ | 67 | /* GSO types - only TCPv4 currently supported. */ |
| 68 | #define XEN_NETIF_GSO_TYPE_TCPV4 (1) | 68 | #define XEN_NETIF_GSO_TYPE_TCPV4 (1) |
| 69 | 69 | ||
| 70 | /* | 70 | /* |
| 71 | * This structure needs to fit within both netif_tx_request and | 71 | * This structure needs to fit within both netif_tx_request and |
| @@ -107,7 +107,7 @@ struct xen_netif_extra_info { | |||
| 107 | 107 | ||
| 108 | struct xen_netif_tx_response { | 108 | struct xen_netif_tx_response { |
| 109 | uint16_t id; | 109 | uint16_t id; |
| 110 | int16_t status; /* NETIF_RSP_* */ | 110 | int16_t status; /* XEN_NETIF_RSP_* */ |
| 111 | }; | 111 | }; |
| 112 | 112 | ||
| 113 | struct xen_netif_rx_request { | 113 | struct xen_netif_rx_request { |
| @@ -116,25 +116,29 @@ struct xen_netif_rx_request { | |||
| 116 | }; | 116 | }; |
| 117 | 117 | ||
| 118 | /* Packet data has been validated against protocol checksum. */ | 118 | /* Packet data has been validated against protocol checksum. */ |
| 119 | #define _NETRXF_data_validated (0) | 119 | #define _XEN_NETRXF_data_validated (0) |
| 120 | #define NETRXF_data_validated (1U<<_NETRXF_data_validated) | 120 | #define XEN_NETRXF_data_validated (1U<<_XEN_NETRXF_data_validated) |
| 121 | 121 | ||
| 122 | /* Protocol checksum field is blank in the packet (hardware offload)? */ | 122 | /* Protocol checksum field is blank in the packet (hardware offload)? */ |
| 123 | #define _NETRXF_csum_blank (1) | 123 | #define _XEN_NETRXF_csum_blank (1) |
| 124 | #define NETRXF_csum_blank (1U<<_NETRXF_csum_blank) | 124 | #define XEN_NETRXF_csum_blank (1U<<_XEN_NETRXF_csum_blank) |
| 125 | 125 | ||
| 126 | /* Packet continues in the next request descriptor. */ | 126 | /* Packet continues in the next request descriptor. */ |
| 127 | #define _NETRXF_more_data (2) | 127 | #define _XEN_NETRXF_more_data (2) |
| 128 | #define NETRXF_more_data (1U<<_NETRXF_more_data) | 128 | #define XEN_NETRXF_more_data (1U<<_XEN_NETRXF_more_data) |
| 129 | 129 | ||
| 130 | /* Packet to be followed by extra descriptor(s). */ | 130 | /* Packet to be followed by extra descriptor(s). */ |
| 131 | #define _NETRXF_extra_info (3) | 131 | #define _XEN_NETRXF_extra_info (3) |
| 132 | #define NETRXF_extra_info (1U<<_NETRXF_extra_info) | 132 | #define XEN_NETRXF_extra_info (1U<<_XEN_NETRXF_extra_info) |
| 133 | |||
| 134 | /* GSO Prefix descriptor. */ | ||
| 135 | #define _XEN_NETRXF_gso_prefix (4) | ||
| 136 | #define XEN_NETRXF_gso_prefix (1U<<_XEN_NETRXF_gso_prefix) | ||
| 133 | 137 | ||
| 134 | struct xen_netif_rx_response { | 138 | struct xen_netif_rx_response { |
| 135 | uint16_t id; | 139 | uint16_t id; |
| 136 | uint16_t offset; /* Offset in page of start of received packet */ | 140 | uint16_t offset; /* Offset in page of start of received packet */ |
| 137 | uint16_t flags; /* NETRXF_* */ | 141 | uint16_t flags; /* XEN_NETRXF_* */ |
| 138 | int16_t status; /* -ve: BLKIF_RSP_* ; +ve: Rx'ed pkt size. */ | 142 | int16_t status; /* -ve: BLKIF_RSP_* ; +ve: Rx'ed pkt size. */ |
| 139 | }; | 143 | }; |
| 140 | 144 | ||
| @@ -149,10 +153,10 @@ DEFINE_RING_TYPES(xen_netif_rx, | |||
| 149 | struct xen_netif_rx_request, | 153 | struct xen_netif_rx_request, |
| 150 | struct xen_netif_rx_response); | 154 | struct xen_netif_rx_response); |
| 151 | 155 | ||
| 152 | #define NETIF_RSP_DROPPED -2 | 156 | #define XEN_NETIF_RSP_DROPPED -2 |
| 153 | #define NETIF_RSP_ERROR -1 | 157 | #define XEN_NETIF_RSP_ERROR -1 |
| 154 | #define NETIF_RSP_OKAY 0 | 158 | #define XEN_NETIF_RSP_OKAY 0 |
| 155 | /* No response: used for auxiliary requests (e.g., netif_tx_extra). */ | 159 | /* No response: used for auxiliary requests (e.g., xen_netif_extra_info). */ |
| 156 | #define NETIF_RSP_NULL 1 | 160 | #define XEN_NETIF_RSP_NULL 1 |
| 157 | 161 | ||
| 158 | #endif | 162 | #endif |
diff --git a/include/xen/interface/xen.h b/include/xen/interface/xen.h index 2befa3e2f1bc..b33257bc7e83 100644 --- a/include/xen/interface/xen.h +++ b/include/xen/interface/xen.h | |||
| @@ -30,7 +30,7 @@ | |||
| 30 | #define __HYPERVISOR_stack_switch 3 | 30 | #define __HYPERVISOR_stack_switch 3 |
| 31 | #define __HYPERVISOR_set_callbacks 4 | 31 | #define __HYPERVISOR_set_callbacks 4 |
| 32 | #define __HYPERVISOR_fpu_taskswitch 5 | 32 | #define __HYPERVISOR_fpu_taskswitch 5 |
| 33 | #define __HYPERVISOR_sched_op 6 | 33 | #define __HYPERVISOR_sched_op_compat 6 |
| 34 | #define __HYPERVISOR_dom0_op 7 | 34 | #define __HYPERVISOR_dom0_op 7 |
| 35 | #define __HYPERVISOR_set_debugreg 8 | 35 | #define __HYPERVISOR_set_debugreg 8 |
| 36 | #define __HYPERVISOR_get_debugreg 9 | 36 | #define __HYPERVISOR_get_debugreg 9 |
| @@ -52,7 +52,7 @@ | |||
| 52 | #define __HYPERVISOR_mmuext_op 26 | 52 | #define __HYPERVISOR_mmuext_op 26 |
| 53 | #define __HYPERVISOR_acm_op 27 | 53 | #define __HYPERVISOR_acm_op 27 |
| 54 | #define __HYPERVISOR_nmi_op 28 | 54 | #define __HYPERVISOR_nmi_op 28 |
| 55 | #define __HYPERVISOR_sched_op_new 29 | 55 | #define __HYPERVISOR_sched_op 29 |
| 56 | #define __HYPERVISOR_callback_op 30 | 56 | #define __HYPERVISOR_callback_op 30 |
| 57 | #define __HYPERVISOR_xenoprof_op 31 | 57 | #define __HYPERVISOR_xenoprof_op 31 |
| 58 | #define __HYPERVISOR_event_channel_op 32 | 58 | #define __HYPERVISOR_event_channel_op 32 |
diff --git a/include/xen/xen-ops.h b/include/xen/xen-ops.h index 98b92154a264..03c85d7387fb 100644 --- a/include/xen/xen-ops.h +++ b/include/xen/xen-ops.h | |||
| @@ -5,9 +5,9 @@ | |||
| 5 | 5 | ||
| 6 | DECLARE_PER_CPU(struct vcpu_info *, xen_vcpu); | 6 | DECLARE_PER_CPU(struct vcpu_info *, xen_vcpu); |
| 7 | 7 | ||
| 8 | void xen_pre_suspend(void); | 8 | void xen_arch_pre_suspend(void); |
| 9 | void xen_post_suspend(int suspend_cancelled); | 9 | void xen_arch_post_suspend(int suspend_cancelled); |
| 10 | void xen_hvm_post_suspend(int suspend_cancelled); | 10 | void xen_arch_hvm_post_suspend(int suspend_cancelled); |
| 11 | 11 | ||
| 12 | void xen_mm_pin_all(void); | 12 | void xen_mm_pin_all(void); |
| 13 | void xen_mm_unpin_all(void); | 13 | void xen_mm_unpin_all(void); |
